OpenCoverage

a_print.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/a_print.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2 * Copyright 1995-2017 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 "internal/ctype.h"-
12#include "internal/cryptlib.h"-
13#include <openssl/asn1.h>-
14-
15int ASN1_PRINTABLE_type(const unsigned char *s, int len)-
16{-
17 int c;-
18 int ia5 = 0;-
19 int t61 = 0;-
20-
21 if (len <= 0)
len <= 0Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2
22 len = -1;
never executed: len = -1;
0
23 if (s == NULL)
s == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2
24 return V_ASN1_PRINTABLESTRING;
never executed: return 19;
0
25-
26 while ((*s) && (len-- != 0)) {
(*s)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(len-- != 0)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-4
27 c = *(s++);-
28 if (!ossl_isasn1print(c))
!(ossl_ctype_c...k((c), 0x800))Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
29 ia5 = 1;
never executed: ia5 = 1;
0
30 if (!ossl_isascii(c))
!(((c) & ~127) == 0)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
31 t61 = 1;
never executed: t61 = 1;
0
32 }
executed 4 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
4
33 if (t61)
t61Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2
34 return V_ASN1_T61STRING;
never executed: return 20;
0
35 if (ia5)
ia5Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2
36 return V_ASN1_IA5STRING;
never executed: return 22;
0
37 return V_ASN1_PRINTABLESTRING;
executed 2 times by 1 test: return 19;
Executed by:
  • libcrypto.so.1.1
2
38}-
39-
40int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s)-
41{-
42 int i;-
43 unsigned char *p;-
44-
45 if (s->type != V_ASN1_UNIVERSALSTRING)
s->type != 28Description
TRUEnever evaluated
FALSEnever evaluated
0
46 return 0;
never executed: return 0;
0
47 if ((s->length % 4) != 0)
(s->length % 4) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
48 return 0;
never executed: return 0;
0
49 p = s->data;-
50 for (i = 0; i < s->length; i += 4) {
i < s->lengthDescription
TRUEnever evaluated
FALSEnever evaluated
0
51 if ((p[0] != '\0') || (p[1] != '\0') || (p[2] != '\0'))
(p[0] != '\0')Description
TRUEnever evaluated
FALSEnever evaluated
(p[1] != '\0')Description
TRUEnever evaluated
FALSEnever evaluated
(p[2] != '\0')Description
TRUEnever evaluated
FALSEnever evaluated
0
52 break;
never executed: break;
0
53 else-
54 p += 4;
never executed: p += 4;
0
55 }-
56 if (i < s->length)
i < s->lengthDescription
TRUEnever evaluated
FALSEnever evaluated
0
57 return 0;
never executed: return 0;
0
58 p = s->data;-
59 for (i = 3; i < s->length; i += 4) {
i < s->lengthDescription
TRUEnever evaluated
FALSEnever evaluated
0
60 *(p++) = s->data[i];-
61 }
never executed: end of block
0
62 *(p) = '\0';-
63 s->length /= 4;-
64 s->type = ASN1_PRINTABLE_type(s->data, s->length);-
65 return 1;
never executed: return 1;
0
66}-
67-
68int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v)-
69{-
70 int i, n;-
71 char buf[80];-
72 const char *p;-
73-
74 if (v == NULL)
v == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 60274 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-60274
75 return 0;
never executed: return 0;
0
76 n = 0;-
77 p = (const char *)v->data;-
78 for (i = 0; i < v->length; i++) {
i < v->lengthDescription
TRUEevaluated 1095817 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 60274 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
60274-1095817
79 if ((p[i] > '~') || ((p[i] < ' ') &&
(p[i] > '~')Description
TRUEevaluated 2635 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1093182 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(p[i] < ' ')Description
TRUEevaluated 777460 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 315722 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2635-1093182
80 (p[i] != '\n') && (p[i] != '\r')))
(p[i] != '\n')Description
TRUEevaluated 770147 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 7313 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(p[i] != '\r')Description
TRUEevaluated 762132 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8015 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
7313-770147
81 buf[n] = '.';
executed 764767 times by 1 test: buf[n] = '.';
Executed by:
  • libcrypto.so.1.1
764767
82 else-
83 buf[n] = p[i];
executed 331050 times by 1 test: buf[n] = p[i];
Executed by:
  • libcrypto.so.1.1
331050
84 n++;-
85 if (n >= 80) {
n >= 80Description
TRUEevaluated 3476 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1092341 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
3476-1092341
86 if (BIO_write(bp, buf, n) <= 0)
BIO_write(bp, buf, n) <= 0Description
TRUEnever evaluated
FALSEevaluated 3476 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-3476
87 return 0;
never executed: return 0;
0
88 n = 0;-
89 }
executed 3476 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
3476
90 }
executed 1095817 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1095817
91 if (n > 0)
n > 0Description
TRUEevaluated 52135 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8139 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
8139-52135
92 if (BIO_write(bp, buf, n) <= 0)
BIO_write(bp, buf, n) <= 0Description
TRUEnever evaluated
FALSEevaluated 52135 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-52135
93 return 0;
never executed: return 0;
0
94 return 1;
executed 60274 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
60274
95}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2