OpenCoverage

a_strex.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/a_strex.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2 * Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.-
3 *-
4 * Licensed under the OpenSSL license (the "License"). You may not use-
5 * this file except in compliance with the License. You can obtain a copy-
6 * in the file LICENSE in the source distribution or at-
7 * https://www.openssl.org/source/license.html-
8 */-
9-
10#include <stdio.h>-
11#include <string.h>-
12#include "internal/cryptlib.h"-
13#include "internal/asn1_int.h"-
14#include <openssl/crypto.h>-
15#include <openssl/x509.h>-
16#include <openssl/asn1.h>-
17-
18#include "charmap.h"-
19-
20/*-
21 * ASN1_STRING_print_ex() and X509_NAME_print_ex(). Enhanced string and name-
22 * printing routines handling multibyte characters, RFC2253 and a host of-
23 * other options.-
24 */-
25-
26#define CHARTYPE_BS_ESC (ASN1_STRFLGS_ESC_2253 | CHARTYPE_FIRST_ESC_2253 | CHARTYPE_LAST_ESC_2253)-
27-
28#define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \-
29 ASN1_STRFLGS_ESC_2254 | \-
30 ASN1_STRFLGS_ESC_QUOTE | \-
31 ASN1_STRFLGS_ESC_CTRL | \-
32 ASN1_STRFLGS_ESC_MSB)-
33-
34/*-
35 * Three IO functions for sending data to memory, a BIO and and a FILE-
36 * pointer.-
37 */-
38static int send_bio_chars(void *arg, const void *buf, int len)-
39{-
40 if (!arg)
!argDescription
TRUEevaluated 139865 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 235228 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
139865-235228
41 return 1;
executed 139865 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
139865
42 if (BIO_write(arg, buf, len) != len)
BIO_write(arg,...f, len) != lenDescription
TRUEnever evaluated
FALSEevaluated 235228 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-235228
43 return 0;
never executed: return 0;
0
44 return 1;
executed 235228 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
235228
45}-
46-
47#ifndef OPENSSL_NO_STDIO-
48static int send_fp_chars(void *arg, const void *buf, int len)-
49{-
50 if (!arg)
!argDescription
TRUEnever evaluated
FALSEnever evaluated
0
51 return 1;
never executed: return 1;
0
52 if (fwrite(buf, 1, len, arg) != (unsigned int)len)
fwrite(buf, 1,...signed int)lenDescription
TRUEnever evaluated
FALSEnever evaluated
0
53 return 0;
never executed: return 0;
0
54 return 1;
never executed: return 1;
0
55}-
56#endif-
57-
58typedef int char_io (void *arg, const void *buf, int len);-
59-
60/*-
61 * This function handles display of strings, one character at a time. It is-
62 * passed an unsigned long for each character because it could come from 2 or-
63 * even 4 byte forms.-
64 */-
65-
66static int do_esc_char(unsigned long c, unsigned short flags, char *do_quotes,-
67 char_io *io_ch, void *arg)-
68{-
69 unsigned short chflgs;-
70 unsigned char chtmp;-
71 char tmphex[HEX_SIZE(long) + 3];-
72-
73 if (c > 0xffffffffL)
c > 0xffffffffLDescription
TRUEnever evaluated
FALSEevaluated 274774 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-274774
74 return -1;
never executed: return -1;
0
75 if (c > 0xffff) {
c > 0xffffDescription
TRUEevaluated 209 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 274565 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
209-274565
76 BIO_snprintf(tmphex, sizeof(tmphex), "\\W%08lX", c);-
77 if (!io_ch(arg, tmphex, 10))
!io_ch(arg, tmphex, 10)Description
TRUEnever evaluated
FALSEevaluated 209 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-209
78 return -1;
never executed: return -1;
0
79 return 10;
executed 209 times by 1 test: return 10;
Executed by:
  • libcrypto.so.1.1
209
80 }-
81 if (c > 0xff) {
c > 0xffDescription
TRUEevaluated 500 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 274065 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
500-274065
82 BIO_snprintf(tmphex, sizeof(tmphex), "\\U%04lX", c);-
83 if (!io_ch(arg, tmphex, 6))
!io_ch(arg, tmphex, 6)Description
TRUEnever evaluated
FALSEevaluated 500 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-500
84 return -1;
never executed: return -1;
0
85 return 6;
executed 500 times by 1 test: return 6;
Executed by:
  • libcrypto.so.1.1
500
86 }-
87 chtmp = (unsigned char)c;-
88 if (chtmp > 0x7f)
chtmp > 0x7fDescription
TRUEevaluated 122020 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 152045 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
122020-152045
89 chflgs = flags & ASN1_STRFLGS_ESC_MSB;
executed 122020 times by 1 test: chflgs = flags & 4;
Executed by:
  • libcrypto.so.1.1
122020
90 else-
91 chflgs = char_type[chtmp] & flags;
executed 152045 times by 1 test: chflgs = char_type[chtmp] & flags;
Executed by:
  • libcrypto.so.1.1
152045
92 if (chflgs & CHARTYPE_BS_ESC) {
chflgs & (1 | 0x20 | 0x40)Description
TRUEevaluated 2120 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 271945 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2120-271945
93 /* If we don't escape with quotes, signal we need quotes */-
94 if (chflgs & ASN1_STRFLGS_ESC_QUOTE) {
chflgs & 8Description
TRUEevaluated 1528 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 592 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
592-1528
95 if (do_quotes)
do_quotesDescription
TRUEevaluated 764 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 764 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
764
96 *do_quotes = 1;
executed 764 times by 1 test: *do_quotes = 1;
Executed by:
  • libcrypto.so.1.1
764
97 if (!io_ch(arg, &chtmp, 1))
!io_ch(arg, &chtmp, 1)Description
TRUEnever evaluated
FALSEevaluated 1528 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1528
98 return -1;
never executed: return -1;
0
99 return 1;
executed 1528 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1528
100 }-
101 if (!io_ch(arg, "\\", 1))
!io_ch(arg, "\\", 1)Description
TRUEnever evaluated
FALSEevaluated 592 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-592
102 return -1;
never executed: return -1;
0
103 if (!io_ch(arg, &chtmp, 1))
!io_ch(arg, &chtmp, 1)Description
TRUEnever evaluated
FALSEevaluated 592 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-592
104 return -1;
never executed: return -1;
0
105 return 2;
executed 592 times by 1 test: return 2;
Executed by:
  • libcrypto.so.1.1
592
106 }-
107 if (chflgs & (ASN1_STRFLGS_ESC_CTRL
chflgs & (2 | 4 | 0x400)Description
TRUEevaluated 124188 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 147757 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
124188-147757
108 | ASN1_STRFLGS_ESC_MSB
chflgs & (2 | 4 | 0x400)Description
TRUEevaluated 124188 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 147757 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
124188-147757
109 | ASN1_STRFLGS_ESC_2254)) {
chflgs & (2 | 4 | 0x400)Description
TRUEevaluated 124188 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 147757 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
124188-147757
110 BIO_snprintf(tmphex, 11, "\\%02X", chtmp);-
111 if (!io_ch(arg, tmphex, 3))
!io_ch(arg, tmphex, 3)Description
TRUEnever evaluated
FALSEevaluated 124188 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-124188
112 return -1;
never executed: return -1;
0
113 return 3;
executed 124188 times by 1 test: return 3;
Executed by:
  • libcrypto.so.1.1
124188
114 }-
115 /*-
116 * If we get this far and do any escaping at all must escape the escape-
117 * character itself: backslash.-
118 */-
119 if (chtmp == '\\' && (flags & ESC_FLAGS)) {
chtmp == '\\'Description
TRUEevaluated 256 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 147501 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(flags & (1 | ... | 8 | 2 | 4))Description
TRUEnever evaluated
FALSEevaluated 256 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-147501
120 if (!io_ch(arg, "\\\\", 2))
!io_ch(arg, "\\\\", 2)Description
TRUEnever evaluated
FALSEnever evaluated
0
121 return -1;
never executed: return -1;
0
122 return 2;
never executed: return 2;
0
123 }-
124 if (!io_ch(arg, &chtmp, 1))
!io_ch(arg, &chtmp, 1)Description
TRUEnever evaluated
FALSEevaluated 147757 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-147757
125 return -1;
never executed: return -1;
0
126 return 1;
executed 147757 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
147757
127}-
128-
129#define BUF_TYPE_WIDTH_MASK 0x7-
130#define BUF_TYPE_CONVUTF8 0x8-
131-
132/*-
133 * This function sends each character in a buffer to do_esc_char(). It-
134 * interprets the content formats and converts to or from UTF8 as-
135 * appropriate.-
136 */-
137-
138static int do_buf(unsigned char *buf, int buflen,-
139 int type, unsigned short flags, char *quotes, char_io *io_ch,-
140 void *arg)-
141{-
142 int i, outlen, len, charwidth;-
143 unsigned short orflags;-
144 unsigned char *p, *q;-
145 unsigned long c;-
146-
147 p = buf;-
148 q = buf + buflen;-
149 outlen = 0;-
150 charwidth = type & BUF_TYPE_WIDTH_MASK;-
151-
152 switch (charwidth) {-
153 case 4:
executed 3476 times by 1 test: case 4:
Executed by:
  • libcrypto.so.1.1
3476
154 if (buflen & 3) {
buflen & 3Description
TRUEnever evaluated
FALSEevaluated 3476 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-3476
155 ASN1err(ASN1_F_DO_BUF, ASN1_R_INVALID_UNIVERSALSTRING_LENGTH);-
156 return -1;
never executed: return -1;
0
157 }-
158 break;
executed 3476 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
3476
159 case 2:
executed 6574 times by 1 test: case 2:
Executed by:
  • libcrypto.so.1.1
6574
160 if (buflen & 1) {
buflen & 1Description
TRUEnever evaluated
FALSEevaluated 6574 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-6574
161 ASN1err(ASN1_F_DO_BUF, ASN1_R_INVALID_BMPSTRING_LENGTH);-
162 return -1;
never executed: return -1;
0
163 }-
164 break;
executed 6574 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
6574
165 default:
executed 19623 times by 1 test: default:
Executed by:
  • libcrypto.so.1.1
19623
166 break;
executed 19623 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
19623
167 }-
168-
169 while (p != q) {
p != qDescription
TRUEevaluated 199023 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 24336 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
24336-199023
170 if (p == buf && flags & ASN1_STRFLGS_ESC_2253)
p == bufDescription
TRUEevaluated 22559 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 176464 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
flags & 1Description
TRUEevaluated 16274 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6285 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
6285-176464
171 orflags = CHARTYPE_FIRST_ESC_2253;
executed 16274 times by 1 test: orflags = 0x20;
Executed by:
  • libcrypto.so.1.1
16274
172 else-
173 orflags = 0;
executed 182749 times by 1 test: orflags = 0;
Executed by:
  • libcrypto.so.1.1
182749
174-
175 switch (charwidth) {-
176 case 4:
executed 1186 times by 1 test: case 4:
Executed by:
  • libcrypto.so.1.1
1186
177 c = ((unsigned long)*p++) << 24;-
178 c |= ((unsigned long)*p++) << 16;-
179 c |= ((unsigned long)*p++) << 8;-
180 c |= *p++;-
181 break;
executed 1186 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
1186
182-
183 case 2:
executed 38246 times by 1 test: case 2:
Executed by:
  • libcrypto.so.1.1
38246
184 c = ((unsigned long)*p++) << 8;-
185 c |= *p++;-
186 break;
executed 38246 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
38246
187-
188 case 1:
executed 147420 times by 1 test: case 1:
Executed by:
  • libcrypto.so.1.1
147420
189 c = *p++;-
190 break;
executed 147420 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
147420
191-
192 case 0:
executed 12171 times by 1 test: case 0:
Executed by:
  • libcrypto.so.1.1
12171
193 i = UTF8_getc(p, buflen, &c);-
194 if (i < 0)
i < 0Description
TRUEevaluated 5337 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6834 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
5337-6834
195 return -1; /* Invalid UTF8String */
executed 5337 times by 1 test: return -1;
Executed by:
  • libcrypto.so.1.1
5337
196 buflen -= i;-
197 p += i;-
198 break;
executed 6834 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
6834
199 default:
never executed: default:
0
200 return -1; /* invalid width */
never executed: return -1;
0
201 }-
202 if (p == q && flags & ASN1_STRFLGS_ESC_2253)
p == qDescription
TRUEevaluated 17222 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 176464 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
flags & 1Description
TRUEevaluated 16274 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 948 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
948-176464
203 orflags = CHARTYPE_LAST_ESC_2253;
executed 16274 times by 1 test: orflags = 0x40;
Executed by:
  • libcrypto.so.1.1
16274
204 if (type & BUF_TYPE_CONVUTF8) {
type & 0x8Description
TRUEevaluated 80090 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 113596 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
80090-113596
205 unsigned char utfbuf[6];-
206 int utflen;-
207 utflen = UTF8_putc(utfbuf, sizeof(utfbuf), c);-
208 for (i = 0; i < utflen; i++) {
i < utflenDescription
TRUEevaluated 161178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 80090 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
80090-161178
209 /*-
210 * We don't need to worry about setting orflags correctly-
211 * because if utflen==1 its value will be correct anyway-
212 * otherwise each character will be > 0x7f and so the-
213 * character will never be escaped on first and last.-
214 */-
215 len = do_esc_char(utfbuf[i], flags | orflags, quotes,-
216 io_ch, arg);-
217 if (len < 0)
len < 0Description
TRUEnever evaluated
FALSEevaluated 161178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-161178
218 return -1;
never executed: return -1;
0
219 outlen += len;-
220 }
executed 161178 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
161178
221 } else {
executed 80090 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
80090
222 len = do_esc_char(c, flags | orflags, quotes,-
223 io_ch, arg);-
224 if (len < 0)
len < 0Description
TRUEnever evaluated
FALSEevaluated 113596 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-113596
225 return -1;
never executed: return -1;
0
226 outlen += len;-
227 }
executed 113596 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
113596
228 }-
229 return outlen;
executed 24336 times by 1 test: return outlen;
Executed by:
  • libcrypto.so.1.1
24336
230}-
231-
232/* This function hex dumps a buffer of characters */-
233-
234static int do_hex_dump(char_io *io_ch, void *arg, unsigned char *buf,-
235 int buflen)-
236{-
237 static const char hexdig[] = "0123456789ABCDEF";-
238 unsigned char *p, *q;-
239 char hextmp[2];-
240 if (arg) {
argDescription
TRUEevaluated 6930 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-6930
241 p = buf;-
242 q = buf + buflen;-
243 while (p != q) {
p != qDescription
TRUEevaluated 44616 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6930 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
6930-44616
244 hextmp[0] = hexdig[*p >> 4];-
245 hextmp[1] = hexdig[*p & 0xf];-
246 if (!io_ch(arg, hextmp, 2))
!io_ch(arg, hextmp, 2)Description
TRUEnever evaluated
FALSEevaluated 44616 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-44616
247 return -1;
never executed: return -1;
0
248 p++;-
249 }
executed 44616 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
44616
250 }
executed 6930 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
6930
251 return buflen << 1;
executed 6930 times by 1 test: return buflen << 1;
Executed by:
  • libcrypto.so.1.1
6930
252}-
253-
254/*-
255 * "dump" a string. This is done when the type is unknown, or the flags-
256 * request it. We can either dump the content octets or the entire DER-
257 * encoding. This uses the RFC2253 #01234 format.-
258 */-
259-
260static int do_dump(unsigned long lflags, char_io *io_ch, void *arg,-
261 const ASN1_STRING *str)-
262{-
263 /*-
264 * Placing the ASN1_STRING in a temp ASN1_TYPE allows the DER encoding to-
265 * readily obtained-
266 */-
267 ASN1_TYPE t;-
268 unsigned char *der_buf, *p;-
269 int outlen, der_len;-
270-
271 if (!io_ch(arg, "#", 1))
!io_ch(arg, "#", 1)Description
TRUEnever evaluated
FALSEevaluated 6930 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-6930
272 return -1;
never executed: return -1;
0
273 /* If we don't dump DER encoding just dump content octets */-
274 if (!(lflags & ASN1_STRFLGS_DUMP_DER)) {
!(lflags & 0x200)Description
TRUEevaluated 3014 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3916 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
3014-3916
275 outlen = do_hex_dump(io_ch, arg, str->data, str->length);-
276 if (outlen < 0)
outlen < 0Description
TRUEnever evaluated
FALSEevaluated 3014 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-3014
277 return -1;
never executed: return -1;
0
278 return outlen + 1;
executed 3014 times by 1 test: return outlen + 1;
Executed by:
  • libcrypto.so.1.1
3014
279 }-
280 t.type = str->type;-
281 t.value.ptr = (char *)str;-
282 der_len = i2d_ASN1_TYPE(&t, NULL);-
283 if ((der_buf = OPENSSL_malloc(der_len)) == NULL) {
(der_buf = CRY...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 3916 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-3916
284 ASN1err(ASN1_F_DO_DUMP, ERR_R_MALLOC_FAILURE);-
285 return -1;
never executed: return -1;
0
286 }-
287 p = der_buf;-
288 i2d_ASN1_TYPE(&t, &p);-
289 outlen = do_hex_dump(io_ch, arg, der_buf, der_len);-
290 OPENSSL_free(der_buf);-
291 if (outlen < 0)
outlen < 0Description
TRUEnever evaluated
FALSEevaluated 3916 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-3916
292 return -1;
never executed: return -1;
0
293 return outlen + 1;
executed 3916 times by 1 test: return outlen + 1;
Executed by:
  • libcrypto.so.1.1
3916
294}-
295-
296/*-
297 * Lookup table to convert tags to character widths, 0 = UTF8 encoded, -1 is-
298 * used for non string types otherwise it is the number of bytes per-
299 * character-
300 */-
301-
302static const signed char tag2nbyte[] = {-
303 -1, -1, -1, -1, -1, /* 0-4 */-
304 -1, -1, -1, -1, -1, /* 5-9 */-
305 -1, -1, /* 10-11 */-
306 0, /* 12 V_ASN1_UTF8STRING */-
307 -1, -1, -1, -1, -1, /* 13-17 */-
308 1, /* 18 V_ASN1_NUMERICSTRING */-
309 1, /* 19 V_ASN1_PRINTABLESTRING */-
310 1, /* 20 V_ASN1_T61STRING */-
311 -1, /* 21 */-
312 1, /* 22 V_ASN1_IA5STRING */-
313 1, /* 23 V_ASN1_UTCTIME */-
314 1, /* 24 V_ASN1_GENERALIZEDTIME */-
315 -1, /* 25 */-
316 1, /* 26 V_ASN1_ISO64STRING */-
317 -1, /* 27 */-
318 4, /* 28 V_ASN1_UNIVERSALSTRING */-
319 -1, /* 29 */-
320 2 /* 30 V_ASN1_BMPSTRING */-
321};-
322-
323/*-
324 * This is the main function, print out an ASN1_STRING taking note of various-
325 * escape and display options. Returns number of characters written or -1 if-
326 * an error occurred.-
327 */-
328-
329static int do_print_ex(char_io *io_ch, void *arg, unsigned long lflags,-
330 const ASN1_STRING *str)-
331{-
332 int outlen, len;-
333 int type;-
334 char quotes;-
335 unsigned short flags;-
336 quotes = 0;-
337 /* Keep a copy of escape flags */-
338 flags = (unsigned short)(lflags & ESC_FLAGS);-
339-
340 type = str->type;-
341-
342 outlen = 0;-
343-
344 if (lflags & ASN1_STRFLGS_SHOW_TYPE) {
lflags & 0x40Description
TRUEevaluated 3014 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 21421 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
3014-21421
345 const char *tagname;-
346 tagname = ASN1_tag2str(type);-
347 outlen += strlen(tagname);-
348 if (!io_ch(arg, tagname, outlen) || !io_ch(arg, ":", 1))
!io_ch(arg, tagname, outlen)Description
TRUEnever evaluated
FALSEevaluated 3014 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
!io_ch(arg, ":", 1)Description
TRUEnever evaluated
FALSEevaluated 3014 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-3014
349 return -1;
never executed: return -1;
0
350 outlen++;-
351 }
executed 3014 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
3014
352-
353 /* Decide what to do with type, either dump content or display it */-
354-
355 /* Dump everything */-
356 if (lflags & ASN1_STRFLGS_DUMP_ALL)
lflags & 0x80Description
TRUEevaluated 3014 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 21421 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
3014-21421
357 type = -1;
executed 3014 times by 1 test: type = -1;
Executed by:
  • libcrypto.so.1.1
3014
358 /* Ignore the string type */-
359 else if (lflags & ASN1_STRFLGS_IGNORE_TYPE)
lflags & 0x20Description
TRUEnever evaluated
FALSEevaluated 21421 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-21421
360 type = 1;
never executed: type = 1;
0
361 else {-
362 /* Else determine width based on type */-
363 if ((type > 0) && (type < 31))
(type > 0)Description
TRUEevaluated 21421 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
(type < 31)Description
TRUEevaluated 21181 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 240 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-21421
364 type = tag2nbyte[type];
executed 21181 times by 1 test: type = tag2nbyte[type];
Executed by:
  • libcrypto.so.1.1
21181
365 else-
366 type = -1;
executed 240 times by 1 test: type = -1;
Executed by:
  • libcrypto.so.1.1
240
367 if ((type == -1) && !(lflags & ASN1_STRFLGS_DUMP_UNKNOWN))
(type == -1)Description
TRUEevaluated 3916 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 17505 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
!(lflags & 0x100)Description
TRUEnever evaluated
FALSEevaluated 3916 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-17505
368 type = 1;
never executed: type = 1;
0
369 }
executed 21421 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
21421
370-
371 if (type == -1) {
type == -1Description
TRUEevaluated 6930 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 17505 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
6930-17505
372 len = do_dump(lflags, io_ch, arg, str);-
373 if (len < 0)
len < 0Description
TRUEnever evaluated
FALSEevaluated 6930 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-6930
374 return -1;
never executed: return -1;
0
375 outlen += len;-
376 return outlen;
executed 6930 times by 1 test: return outlen;
Executed by:
  • libcrypto.so.1.1
6930
377 }-
378-
379 if (lflags & ASN1_STRFLGS_UTF8_CONVERT) {
lflags & 0x10Description
TRUEevaluated 11301 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6204 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
6204-11301
380 /*-
381 * Note: if string is UTF8 and we want to convert to UTF8 then we-
382 * just interpret it as 1 byte per character to avoid converting-
383 * twice.-
384 */-
385 if (!type)
!typeDescription
TRUEevaluated 3204 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8097 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
3204-8097
386 type = 1;
executed 3204 times by 1 test: type = 1;
Executed by:
  • libcrypto.so.1.1
3204
387 else-
388 type |= BUF_TYPE_CONVUTF8;
executed 8097 times by 1 test: type |= 0x8;
Executed by:
  • libcrypto.so.1.1
8097
389 }-
390-
391 len = do_buf(str->data, str->length, type, flags, &quotes, io_ch, NULL);-
392 if (len < 0)
len < 0Description
TRUEevaluated 5337 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 12168 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
5337-12168
393 return -1;
executed 5337 times by 1 test: return -1;
Executed by:
  • libcrypto.so.1.1
5337
394 outlen += len;-
395 if (quotes)
quotesDescription
TRUEevaluated 578 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 11590 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
578-11590
396 outlen += 2;
executed 578 times by 1 test: outlen += 2;
Executed by:
  • libcrypto.so.1.1
578
397 if (!arg)
!argDescription
TRUEnever evaluated
FALSEevaluated 12168 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-12168
398 return outlen;
never executed: return outlen;
0
399 if (quotes && !io_ch(arg, "\"", 1))
quotesDescription
TRUEevaluated 578 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 11590 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
!io_ch(arg, "\"", 1)Description
TRUEnever evaluated
FALSEevaluated 578 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-11590
400 return -1;
never executed: return -1;
0
401 if (do_buf(str->data, str->length, type, flags, NULL, io_ch, arg) < 0)
do_buf(str->da...o_ch, arg) < 0Description
TRUEnever evaluated
FALSEevaluated 12168 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-12168
402 return -1;
never executed: return -1;
0
403 if (quotes && !io_ch(arg, "\"", 1))
quotesDescription
TRUEevaluated 578 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 11590 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
!io_ch(arg, "\"", 1)Description
TRUEnever evaluated
FALSEevaluated 578 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-11590
404 return -1;
never executed: return -1;
0
405 return outlen;
executed 12168 times by 1 test: return outlen;
Executed by:
  • libcrypto.so.1.1
12168
406}-
407-
408/* Used for line indenting: print 'indent' spaces */-
409-
410static int do_indent(char_io *io_ch, void *arg, int indent)-
411{-
412 int i;-
413 for (i = 0; i < indent; i++)
i < indentDescription
TRUEevaluated 175 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 12100 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
175-12100
414 if (!io_ch(arg, " ", 1))
!io_ch(arg, " ", 1)Description
TRUEnever evaluated
FALSEevaluated 175 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-175
415 return 0;
never executed: return 0;
0
416 return 1;
executed 12100 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
12100
417}-
418-
419#define FN_WIDTH_LN 25-
420#define FN_WIDTH_SN 10-
421-
422static int do_name_ex(char_io *io_ch, void *arg, const X509_NAME *n,-
423 int indent, unsigned long flags)-
424{-
425 int i, prev = -1, orflags, cnt;-
426 int fn_opt, fn_nid;-
427 ASN1_OBJECT *fn;-
428 const ASN1_STRING *val;-
429 const X509_NAME_ENTRY *ent;-
430 char objtmp[80];-
431 const char *objbuf;-
432 int outlen, len;-
433 char *sep_dn, *sep_mv, *sep_eq;-
434 int sep_dn_len, sep_mv_len, sep_eq_len;-
435 if (indent < 0)
indent < 0Description
TRUEnever evaluated
FALSEevaluated 7182 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-7182
436 indent = 0;
never executed: indent = 0;
0
437 outlen = indent;-
438 if (!do_indent(io_ch, arg, indent))
!do_indent(io_ch, arg, indent)Description
TRUEnever evaluated
FALSEevaluated 7182 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-7182
439 return -1;
never executed: return -1;
0
440 switch (flags & XN_FLAG_SEP_MASK) {-
441 case XN_FLAG_SEP_MULTILINE:
executed 2 times by 1 test: case (4 << 16):
Executed by:
  • libcrypto.so.1.1
2
442 sep_dn = "\n";-
443 sep_dn_len = 1;-
444 sep_mv = " + ";-
445 sep_mv_len = 3;-
446 break;
executed 2 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
2
447-
448 case XN_FLAG_SEP_COMMA_PLUS:
never executed: case (1 << 16):
0
449 sep_dn = ",";-
450 sep_dn_len = 1;-
451 sep_mv = "+";-
452 sep_mv_len = 1;-
453 indent = 0;-
454 break;
never executed: break;
0
455-
456 case XN_FLAG_SEP_CPLUS_SPC:
executed 7180 times by 1 test: case (2 << 16):
Executed by:
  • libcrypto.so.1.1
7180
457 sep_dn = ", ";-
458 sep_dn_len = 2;-
459 sep_mv = " + ";-
460 sep_mv_len = 3;-
461 indent = 0;-
462 break;
executed 7180 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
7180
463-
464 case XN_FLAG_SEP_SPLUS_SPC:
never executed: case (3 << 16):
0
465 sep_dn = "; ";-
466 sep_dn_len = 2;-
467 sep_mv = " + ";-
468 sep_mv_len = 3;-
469 indent = 0;-
470 break;
never executed: break;
0
471-
472 default:
never executed: default:
0
473 return -1;
never executed: return -1;
0
474 }-
475-
476 if (flags & XN_FLAG_SPC_EQ) {
flags & (1 << 23)Description
TRUEevaluated 7177 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
5-7177
477 sep_eq = " = ";-
478 sep_eq_len = 3;-
479 } else {
executed 7177 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
7177
480 sep_eq = "=";-
481 sep_eq_len = 1;-
482 }
executed 5 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
5
483-
484 fn_opt = flags & XN_FLAG_FN_MASK;-
485-
486 cnt = X509_NAME_entry_count(n);-
487 for (i = 0; i < cnt; i++) {
i < cntDescription
TRUEevaluated 15238 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 7182 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
7182-15238
488 if (flags & XN_FLAG_DN_REV)
flags & (1 << 20)Description
TRUEnever evaluated
FALSEevaluated 15238 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15238
489 ent = X509_NAME_get_entry(n, cnt - i - 1);
never executed: ent = X509_NAME_get_entry(n, cnt - i - 1);
0
490 else-
491 ent = X509_NAME_get_entry(n, i);
executed 15238 times by 1 test: ent = X509_NAME_get_entry(n, i);
Executed by:
  • libcrypto.so.1.1
15238
492 if (prev != -1) {
prev != -1Description
TRUEevaluated 10346 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4892 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4892-10346
493 if (prev == X509_NAME_ENTRY_set(ent)) {
prev == X509_N...ENTRY_set(ent)Description
TRUEevaluated 5435 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4911 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4911-5435
494 if (!io_ch(arg, sep_mv, sep_mv_len))
!io_ch(arg, se...v, sep_mv_len)Description
TRUEnever evaluated
FALSEevaluated 5435 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-5435
495 return -1;
never executed: return -1;
0
496 outlen += sep_mv_len;-
497 } else {
executed 5435 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
5435
498 if (!io_ch(arg, sep_dn, sep_dn_len))
!io_ch(arg, se...n, sep_dn_len)Description
TRUEnever evaluated
FALSEevaluated 4911 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4911
499 return -1;
never executed: return -1;
0
500 outlen += sep_dn_len;-
501 if (!do_indent(io_ch, arg, indent))
!do_indent(io_ch, arg, indent)Description
TRUEnever evaluated
FALSEevaluated 4911 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4911
502 return -1;
never executed: return -1;
0
503 outlen += indent;-
504 }
executed 4911 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
4911
505 }-
506 prev = X509_NAME_ENTRY_set(ent);-
507 fn = X509_NAME_ENTRY_get_object(ent);-
508 val = X509_NAME_ENTRY_get_data(ent);-
509 fn_nid = OBJ_obj2nid(fn);-
510 if (fn_opt != XN_FLAG_FN_NONE) {
fn_opt != (3 << 21)Description
TRUEevaluated 15238 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-15238
511 int objlen, fld_len;-
512 if ((fn_opt == XN_FLAG_FN_OID) || (fn_nid == NID_undef)) {
(fn_opt == (2 << 21))Description
TRUEnever evaluated
FALSEevaluated 15238 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(fn_nid == 0)Description
TRUEevaluated 8233 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 7005 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15238
513 OBJ_obj2txt(objtmp, sizeof(objtmp), fn, 1);-
514 fld_len = 0; /* XXX: what should this be? */-
515 objbuf = objtmp;-
516 } else {
executed 8233 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
8233
517 if (fn_opt == XN_FLAG_FN_SN) {
fn_opt == 0Description
TRUEevaluated 6998 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 7 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
7-6998
518 fld_len = FN_WIDTH_SN;-
519 objbuf = OBJ_nid2sn(fn_nid);-
520 } else if (fn_opt == XN_FLAG_FN_LN) {
executed 6998 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
fn_opt == (1 << 21)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-6998
521 fld_len = FN_WIDTH_LN;-
522 objbuf = OBJ_nid2ln(fn_nid);-
523 } else {
executed 7 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
7
524 fld_len = 0; /* XXX: what should this be? */-
525 objbuf = "";-
526 }
never executed: end of block
0
527 }-
528 objlen = strlen(objbuf);-
529 if (!io_ch(arg, objbuf, objlen))
!io_ch(arg, objbuf, objlen)Description
TRUEnever evaluated
FALSEevaluated 15238 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15238
530 return -1;
never executed: return -1;
0
531 if ((objlen < fld_len) && (flags & XN_FLAG_FN_ALIGN)) {
(objlen < fld_len)Description
TRUEevaluated 4090 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 11148 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(flags & (1 << 25))Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4083 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
7-11148
532 if (!do_indent(io_ch, arg, fld_len - objlen))
!do_indent(io_..._len - objlen)Description
TRUEnever evaluated
FALSEevaluated 7 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-7
533 return -1;
never executed: return -1;
0
534 outlen += fld_len - objlen;-
535 }
executed 7 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
7
536 if (!io_ch(arg, sep_eq, sep_eq_len))
!io_ch(arg, se...q, sep_eq_len)Description
TRUEnever evaluated
FALSEevaluated 15238 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15238
537 return -1;
never executed: return -1;
0
538 outlen += objlen + sep_eq_len;-
539 }
executed 15238 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
15238
540 /*-
541 * If the field name is unknown then fix up the DER dump flag. We-
542 * might want to limit this further so it will DER dump on anything-
543 * other than a few 'standard' fields.-
544 */-
545 if ((fn_nid == NID_undef) && (flags & XN_FLAG_DUMP_UNKNOWN_FIELDS))
(fn_nid == 0)Description
TRUEevaluated 8233 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 7005 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(flags & (1 << 24))Description
TRUEnever evaluated
FALSEevaluated 8233 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8233
546 orflags = ASN1_STRFLGS_DUMP_ALL;
never executed: orflags = 0x80;
0
547 else-
548 orflags = 0;
executed 15238 times by 1 test: orflags = 0;
Executed by:
  • libcrypto.so.1.1
15238
549-
550 len = do_print_ex(io_ch, arg, flags | orflags, val);-
551 if (len < 0)
len < 0Description
TRUEnever evaluated
FALSEevaluated 15238 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15238
552 return -1;
never executed: return -1;
0
553 outlen += len;-
554 }
executed 15238 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
15238
555 return outlen;
executed 7182 times by 1 test: return outlen;
Executed by:
  • libcrypto.so.1.1
7182
556}-
557-
558/* Wrappers round the main functions */-
559-
560int X509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent,-
561 unsigned long flags)-
562{-
563 if (flags == XN_FLAG_COMPAT)
flags == 0Description
TRUEevaluated 5796 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 7182 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
5796-7182
564 return X509_NAME_print(out, nm, indent);
executed 5796 times by 1 test: return X509_NAME_print(out, nm, indent);
Executed by:
  • libcrypto.so.1.1
5796
565 return do_name_ex(send_bio_chars, out, nm, indent, flags);
executed 7182 times by 1 test: return do_name_ex(send_bio_chars, out, nm, indent, flags);
Executed by:
  • libcrypto.so.1.1
7182
566}-
567-
568#ifndef OPENSSL_NO_STDIO-
569int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent,-
570 unsigned long flags)-
571{-
572 if (flags == XN_FLAG_COMPAT) {
flags == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
573 BIO *btmp;-
574 int ret;-
575 btmp = BIO_new_fp(fp, BIO_NOCLOSE);-
576 if (!btmp)
!btmpDescription
TRUEnever evaluated
FALSEnever evaluated
0
577 return -1;
never executed: return -1;
0
578 ret = X509_NAME_print(btmp, nm, indent);-
579 BIO_free(btmp);-
580 return ret;
never executed: return ret;
0
581 }-
582 return do_name_ex(send_fp_chars, fp, nm, indent, flags);
never executed: return do_name_ex(send_fp_chars, fp, nm, indent, flags);
0
583}-
584#endif-
585-
586int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags)-
587{-
588 return do_print_ex(send_bio_chars, out, flags, str);
executed 9197 times by 1 test: return do_print_ex(send_bio_chars, out, flags, str);
Executed by:
  • libcrypto.so.1.1
9197
589}-
590-
591#ifndef OPENSSL_NO_STDIO-
592int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str, unsigned long flags)-
593{-
594 return do_print_ex(send_fp_chars, fp, flags, str);
never executed: return do_print_ex(send_fp_chars, fp, flags, str);
0
595}-
596#endif-
597-
598/*-
599 * Utility function: convert any string type to UTF8, returns number of bytes-
600 * in output string or a negative error code-
601 */-
602-
603int ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in)-
604{-
605 ASN1_STRING stmp, *str = &stmp;-
606 int mbflag, type, ret;-
607 if (!in)
!inDescription
TRUEnever evaluated
FALSEevaluated 154154 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-154154
608 return -1;
never executed: return -1;
0
609 type = in->type;-
610 if ((type < 0) || (type > 30))
(type < 0)Description
TRUEnever evaluated
FALSEevaluated 154154 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(type > 30)Description
TRUEnever evaluated
FALSEevaluated 154154 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-154154
611 return -1;
never executed: return -1;
0
612 mbflag = tag2nbyte[type];-
613 if (mbflag == -1)
mbflag == -1Description
TRUEnever evaluated
FALSEevaluated 154154 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-154154
614 return -1;
never executed: return -1;
0
615 mbflag |= MBSTRING_FLAG;-
616 stmp.data = NULL;-
617 stmp.length = 0;-
618 stmp.flags = 0;-
619 ret =-
620 ASN1_mbstring_copy(&str, in->data, in->length, mbflag,-
621 B_ASN1_UTF8STRING);-
622 if (ret < 0)
ret < 0Description
TRUEevaluated 4656 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 149498 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4656-149498
623 return ret;
executed 4656 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
4656
624 *out = stmp.data;-
625 return stmp.length;
executed 149498 times by 1 test: return stmp.length;
Executed by:
  • libcrypto.so.1.1
149498
626}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2