OpenCoverage

evp_asn1.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/evp_asn1.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len)-
3{-
4 ASN1_STRING *os;-
5-
6 if ((
(os = ASN1_OCT...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
os = ASN1_OCTET_STRING_new()) ==
(os = ASN1_OCT...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-26
7 ((void *)0)
(os = ASN1_OCT...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-26
8 )-
9 return
never executed: return 0;
0;
never executed: return 0;
0
10 if (!ASN1_OCTET_STRING_set(os, data, len)
!ASN1_OCTET_ST...os, data, len)Description
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-26
11 ASN1_OCTET_STRING_free(os);-
12 return
never executed: return 0;
0;
never executed: return 0;
0
13 }-
14 ASN1_TYPE_set(a, 4, os);-
15 return
executed 26 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 26 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
26
16}-
17-
18-
19int ASN1_TYPE_get_octetstring(const ASN1_TYPE *a, unsigned char *data, int max_len)-
20{-
21 int ret, num;-
22 const unsigned char *p;-
23-
24 if ((
(a->type != 4)Description
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
a->type != 4)
(a->type != 4)Description
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| (
(a->value.octe... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
a->value.octet_string ==
(a->value.octe... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-26
25 ((void *)0)
(a->value.octe... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-26
26 )
(a->value.octe... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-26
27 ERR_put_error(13,(135),(109),__FILE__,36);-
28 return
never executed: return -1;
-1;
never executed: return -1;
0
29 }-
30 p = ASN1_STRING_get0_data(a->value.octet_string);-
31 ret = ASN1_STRING_length(a->value.octet_string);-
32 if (ret < max_len
ret < max_lenDescription
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-26
33 num = ret;
never executed: num = ret;
0
34 else-
35 num = max_len;
executed 26 times by 1 test: num = max_len;
Executed by:
  • libcrypto.so.1.1
26
36 memcpy(data, p, num);-
37 return
executed 26 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 26 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
26
38}-
39-
40typedef struct {-
41 int32_t num;-
42 ASN1_OCTET_STRING *oct;-
43} asn1_int_oct;-
44-
45static const ASN1_TEMPLATE asn1_int_oct_seq_tt[] = {-
46 { ((0x1 << 12)), (0), -
47 __builtin_offsetof (-
48 asn1_int_oct-
49 , -
50 num-
51 )-
52 , "num", (&(INT32_it)) },-
53 { (0), (0), -
54 __builtin_offsetof (-
55 asn1_int_oct-
56 , -
57 oct-
58 )-
59 , "oct", (&(ASN1_OCTET_STRING_it)) }-
60} ; static const ASN1_ITEM asn1_int_oct_it = { 0x1, 16, asn1_int_oct_seq_tt, sizeof(asn1_int_oct_seq_tt) / sizeof(ASN1_TEMPLATE), -
61 ((void *)0)-
62 , sizeof(asn1_int_oct), "asn1_int_oct" };-
63-
64extern const ASN1_ITEM asn1_int_oct_it;-
65-
66int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data,-
67 int len)-
68{-
69 asn1_int_oct atmp;-
70 ASN1_OCTET_STRING oct;-
71-
72 atmp.num = num;-
73 atmp.oct = &oct;-
74 oct.data = data;-
75 oct.type = 4;-
76 oct.length = len;-
77 oct.flags = 0;-
78-
79 if (ASN1_TYPE_pack_sequence((&(asn1_int_oct_it)), &atmp, &a)
ASN1_TYPE_pack...)), &atmp, &a)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-2
80 return
executed 2 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 2 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
2
81 return
never executed: return 0;
0;
never executed: return 0;
0
82}-
83-
84-
85-
86-
87-
88int ASN1_TYPE_get_int_octetstring(const ASN1_TYPE *a, long *num,-
89 unsigned char *data, int max_len)-
90{-
91 asn1_int_oct *atmp = -
92 ((void *)0)-
93 ;-
94 int ret = -1, n;-
95-
96 if ((
(a->type != 16)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
a->type != 16)
(a->type != 16)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| (
(a->value.sequ... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
a->value.sequence ==
(a->value.sequ... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2
97 ((void *)0)
(a->value.sequ... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2
98 )
(a->value.sequ... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-2
99 goto
never executed: goto err;
err;
never executed: goto err;
0
100 }-
101-
102 atmp = ASN1_TYPE_unpack_sequence((&(asn1_int_oct_it)), a);-
103-
104 if (atmp ==
atmp == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2
105 ((void *)0)
atmp == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2
106 )-
107 goto
never executed: goto err;
err;
never executed: goto err;
0
108-
109 if (num !=
num != ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-2
110 ((void *)0)
num != ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-2
111 )-
112 *
executed 2 times by 1 test: *num = atmp->num;
Executed by:
  • libcrypto.so.1.1
num = atmp->num;
executed 2 times by 1 test: *num = atmp->num;
Executed by:
  • libcrypto.so.1.1
2
113-
114 ret = ASN1_STRING_length(atmp->oct);-
115 if (max_len > ret
max_len > retDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-2
116 n = ret;
never executed: n = ret;
0
117 else-
118 n = max_len;
executed 2 times by 1 test: n = max_len;
Executed by:
  • libcrypto.so.1.1
2
119-
120 if (data !=
data != ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-2
121 ((void *)0)
data != ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-2
122 )-
123 memcpy(data, ASN1_STRING_get0_data(atmp->oct), n);
executed 2 times by 1 test: memcpy(data, ASN1_STRING_get0_data(atmp->oct), n);
Executed by:
  • libcrypto.so.1.1
2
124 if (ret == -1
ret == -1Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-2
125 err:-
126 ERR_put_error(13,(134),(109),__FILE__,111);-
127 }
never executed: end of block
0
128 ASN1_item_free(((void*) (1 ? atmp : (asn1_int_oct*)0)), (&(asn1_int_oct_it)));-
129 return
executed 2 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 2 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
2
130}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2