Debian Codegraph @

upstream/debian-unstable/man3/OPENSSL_hexchar2int.3ssl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "OPENSSL_HEXCHAR2INT 3SSL"
58 .TH OPENSSL_HEXCHAR2INT 3SSL 2026-04-07 3.6.2 OpenSSL
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 OPENSSL_hexchar2int,
65 OPENSSL_hexstr2buf_ex, OPENSSL_hexstr2buf,
66 OPENSSL_buf2hexstr_ex, OPENSSL_buf2hexstr
67 \&\- Hex encoding and decoding functions
68 .SH SYNOPSIS
69 .IX Header "SYNOPSIS"
70 .Vb 1
71 \& #include <openssl/crypto.h>
72 \&
73 \& int OPENSSL_hexchar2int(unsigned char c);
74 \& int OPENSSL_hexstr2buf_ex(unsigned char *buf, size_t buf_n, long *buflen,
75 \& const char *str, const char sep);
76 \& unsigned char *OPENSSL_hexstr2buf(const char *str, long *len);
77 \& int OPENSSL_buf2hexstr_ex(char *str, size_t str_n, size_t *strlength,
78 \& const unsigned char *buf, long buflen,
79 \& const char sep);
80 \& char *OPENSSL_buf2hexstr(const unsigned char *buf, long buflen);
81 .Ve
82 .SH DESCRIPTION
83 .IX Header "DESCRIPTION"
84 \&\fBOPENSSL_hexchar2int()\fR converts a hexadecimal character to its numeric
85 equivalent.
86 .PP
87 \&\fBOPENSSL_hexstr2buf_ex()\fR decodes the hex string \fBstr\fR and places the
88 resulting string of bytes in the given \fIbuf\fR.
89 The character \fIsep\fR is the separator between the bytes, setting this to '\e0'
90 means that there is no separator.
91 \&\fIbuf_n\fR gives the size of the buffer.
92 If \fIbuflen\fR is not NULL, it is filled in with the result length.
93 To find out how large the result will be, call this function with NULL
94 for \fIbuf\fR.
95 Colons between two-character hex "bytes" are accepted and ignored.
96 An odd number of hex digits is an error.
97 .PP
98 \&\fBOPENSSL_hexstr2buf()\fR does the same thing as \fBOPENSSL_hexstr2buf_ex()\fR,
99 but allocates the space for the result, and returns the result. It uses a
100 default separator of ':'.
101 The memory is allocated by calling \fBOPENSSL_malloc()\fR and should be
102 released by calling \fBOPENSSL_free()\fR.
103 .PP
104 \&\fBOPENSSL_buf2hexstr_ex()\fR encodes the contents of the given \fIbuf\fR with
105 length \fIbuflen\fR and places the resulting hexadecimal character string
106 in the given \fIstr\fR.
107 The character \fIsep\fR is the separator between the bytes, setting this to '\e0'
108 means that there is no separator.
109 \&\fIstr_n\fR gives the size of the of the string buffer.
110 If \fIstrlength\fR is not NULL, it is filled in with the result length.
111 To find out how large the result will be, call this function with NULL
112 for \fIstr\fR.
113 .PP
114 \&\fBOPENSSL_buf2hexstr()\fR does the same thing as \fBOPENSSL_buf2hexstr_ex()\fR,
115 but allocates the space for the result, and returns the result. It uses a
116 default separator of ':'.
117 The memory is allocated by calling \fBOPENSSL_malloc()\fR and should be
118 released by calling \fBOPENSSL_free()\fR.
119 .SH "RETURN VALUES"
120 .IX Header "RETURN VALUES"
121 OPENSSL_hexchar2int returns the value of a decoded hex character,
122 or \-1 on error.
123 .PP
124 \&\fBOPENSSL_buf2hexstr()\fR and \fBOPENSSL_hexstr2buf()\fR
125 return a pointer to allocated memory, or NULL on error.
126 .PP
127 \&\fBOPENSSL_buf2hexstr_ex()\fR and \fBOPENSSL_hexstr2buf_ex()\fR return 1 on
128 success, or 0 on error.
129 .SH COPYRIGHT
130 .IX Header "COPYRIGHT"
131 Copyright 2016\-2022 The OpenSSL Project Authors. All Rights Reserved.
132 .PP
133 Licensed under the Apache License 2.0 (the "License"). You may not use
134 this file except in compliance with the License. You can obtain a copy
135 in the file LICENSE in the source distribution or at
136 <https://www.openssl.org/source/license.html>.