OpenCoverage

x_algor.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/asn1/x_algor.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3static const ASN1_TEMPLATE X509_ALGOR_seq_tt[] = {-
4 {-
5 .offset = -
6 __builtin_offsetof (-
7 X509_ALGOR-
8 , -
9 algorithm-
10 )-
11 ,-
12 .field_name = "algorithm",-
13 .item = &ASN1_OBJECT_it,-
14 },-
15 {-
16 .flags = (0x1),-
17 .offset = -
18 __builtin_offsetof (-
19 X509_ALGOR-
20 , -
21 parameter-
22 )-
23 ,-
24 .field_name = "parameter",-
25 .item = &ASN1_ANY_it,-
26 },-
27};-
28-
29const ASN1_ITEM X509_ALGOR_it = {-
30 .itype = 0x1,-
31 .utype = 16,-
32 .templates = X509_ALGOR_seq_tt,-
33 .tcount = sizeof(X509_ALGOR_seq_tt) / sizeof(ASN1_TEMPLATE),-
34 .size = sizeof(X509_ALGOR),-
35 .sname = "X509_ALGOR",-
36};-
37-
38static const ASN1_TEMPLATE X509_ALGORS_item_tt = {-
39 .flags = (0x2 << 1),-
40 .tag = 0,-
41 .offset = 0,-
42 .field_name = "algorithms",-
43 .item = &X509_ALGOR_it,-
44};-
45-
46const ASN1_ITEM X509_ALGORS_it = {-
47 .itype = 0x0,-
48 .utype = -1,-
49 .templates = &X509_ALGORS_item_tt,-
50 .tcount = 0,-
51 .funcs = -
52 ((void *)0)-
53 ,-
54 .size = 0,-
55 .sname = "X509_ALGORS",-
56};-
57-
58-
59X509_ALGOR *-
60d2i_X509_ALGOR(X509_ALGOR **a, const unsigned char **in, long len)-
61{-
62 return
never executed: return (X509_ALGOR *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_ALGOR_it);
(X509_ALGOR *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
never executed: return (X509_ALGOR *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_ALGOR_it);
0
63 &X509_ALGOR_it);
never executed: return (X509_ALGOR *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_ALGOR_it);
0
64}-
65-
66int-
67i2d_X509_ALGOR(X509_ALGOR *a, unsigned char **out)-
68{-
69 return
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_ALGOR_it);
ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_ALGOR_it);
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_ALGOR_it);
0
70}-
71-
72X509_ALGOR *-
73X509_ALGOR_new(void)-
74{-
75 return
executed 26 times by 1 test: return (X509_ALGOR *)ASN1_item_new(&X509_ALGOR_it);
Executed by:
  • pkcs7test
(X509_ALGOR *)ASN1_item_new(&X509_ALGOR_it);
executed 26 times by 1 test: return (X509_ALGOR *)ASN1_item_new(&X509_ALGOR_it);
Executed by:
  • pkcs7test
26
76}-
77-
78void-
79X509_ALGOR_free(X509_ALGOR *a)-
80{-
81 ASN1_item_free((ASN1_VALUE *)a, &X509_ALGOR_it);-
82}
executed 25 times by 2 tests: end of block
Executed by:
  • freenull
  • pkcs7test
25
83-
84X509_ALGORS *-
85d2i_X509_ALGORS(X509_ALGORS **a, const unsigned char **in, long len)-
86{-
87 return
never executed: return (X509_ALGORS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_ALGORS_it);
(X509_ALGORS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
never executed: return (X509_ALGORS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_ALGORS_it);
0
88 &X509_ALGORS_it);
never executed: return (X509_ALGORS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_ALGORS_it);
0
89}-
90-
91int-
92i2d_X509_ALGORS(X509_ALGORS *a, unsigned char **out)-
93{-
94 return
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_ALGORS_it);
ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_ALGORS_it);
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_ALGORS_it);
0
95}-
96-
97X509_ALGOR *-
98X509_ALGOR_dup(X509_ALGOR *x)-
99{-
100 return
never executed: return ASN1_item_dup(&X509_ALGOR_it, x);
ASN1_item_dup(&X509_ALGOR_it, x);
never executed: return ASN1_item_dup(&X509_ALGOR_it, x);
0
101}-
102-
103int-
104X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval)-
105{-
106 if (!alg
!algDescription
TRUEnever evaluated
FALSEevaluated 14 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
)
0-14
107 return
never executed: return 0;
0;
never executed: return 0;
0
108 if (ptype != -1
ptype != -1Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
) {
2-12
109 if (alg->parameter ==
alg->parameter == ((void *)0)Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
FALSEnever evaluated
0-12
110 ((void *)0)
alg->parameter == ((void *)0)Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
FALSEnever evaluated
0-12
111 )-
112 alg->parameter = ASN1_TYPE_new();
executed 12 times by 2 tests: alg->parameter = ASN1_TYPE_new();
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
12
113 if (alg->parameter ==
alg->parameter == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 12 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
0-12
114 ((void *)0)
alg->parameter == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 12 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
0-12
115 )-
116 return
never executed: return 0;
0;
never executed: return 0;
0
117 }
executed 12 times by 2 tests: end of block
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
12
118 if (alg
algDescription
TRUEevaluated 14 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
FALSEnever evaluated
) {
0-14
119 if (alg->algorithm
alg->algorithmDescription
TRUEevaluated 14 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
FALSEnever evaluated
)
0-14
120 ASN1_OBJECT_free(alg->algorithm);
executed 14 times by 2 tests: ASN1_OBJECT_free(alg->algorithm);
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
14
121 alg->algorithm = aobj;-
122 }
executed 14 times by 2 tests: end of block
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
14
123 if (ptype == 0
ptype == 0Description
TRUEnever evaluated
FALSEevaluated 14 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
)
0-14
124 return
never executed: return 1;
1;
never executed: return 1;
0
125 if (ptype == -1
ptype == -1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
FALSEevaluated 12 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
) {
2-12
126 if (alg->parameter
alg->parameterDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
) {
0-2
127 ASN1_TYPE_free(alg->parameter);-
128 alg->parameter = -
129 ((void *)0)-
130 ;-
131 }
never executed: end of block
0
132 }
executed 2 times by 1 test: end of block
Executed by:
  • libcrypto.so.44.0.1
else
2
133 ASN1_TYPE_set(alg->parameter, ptype, pval);
executed 12 times by 2 tests: ASN1_TYPE_set(alg->parameter, ptype, pval);
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
12
134 return
executed 14 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
1;
executed 14 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
14
135}-
136-
137void-
138X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype, const void **ppval,-
139 const X509_ALGOR *algor)-
140{-
141 if (paobj
paobjDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
)
0-2
142 *
never executed: *paobj = algor->algorithm;
paobj = algor->algorithm;
never executed: *paobj = algor->algorithm;
0
143 if (pptype
pptypeDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
FALSEnever evaluated
) {
0-2
144 if (algor->parameter ==
algor->paramet...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
0-2
145 ((void *)0)
algor->paramet...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
0-2
146 ) {-
147 *pptype = -1;-
148 return;
never executed: return;
0
149 } else-
150 *
executed 2 times by 1 test: *pptype = algor->parameter->type;
Executed by:
  • libcrypto.so.44.0.1
pptype = algor->parameter->type;
executed 2 times by 1 test: *pptype = algor->parameter->type;
Executed by:
  • libcrypto.so.44.0.1
2
151 if (ppval
ppvalDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
FALSEnever evaluated
)
0-2
152 *
executed 2 times by 1 test: *ppval = algor->parameter->value.ptr;
Executed by:
  • libcrypto.so.44.0.1
ppval = algor->parameter->value.ptr;
executed 2 times by 1 test: *ppval = algor->parameter->value.ptr;
Executed by:
  • libcrypto.so.44.0.1
2
153 }
executed 2 times by 1 test: end of block
Executed by:
  • libcrypto.so.44.0.1
2
154}
executed 2 times by 1 test: end of block
Executed by:
  • libcrypto.so.44.0.1
2
155-
156-
157-
158void-
159X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md)-
160{-
161 int param_type;-
162-
163 if (md->flags & 0x0008
md->flags & 0x0008Description
TRUEnever evaluated
FALSEnever evaluated
)
0
164 param_type = -1;
never executed: param_type = -1;
0
165 else-
166 param_type = 5;
never executed: param_type = 5;
0
167-
168 X509_ALGOR_set0(alg, OBJ_nid2obj(EVP_MD_type(md)), param_type, -
169 ((void *)0)-
170 );-
171}
never executed: end of block
0
172-
173-
174int-
175X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b)-
176{-
177 int rv = OBJ_cmp(a->algorithm, b->algorithm);-
178 if (!rv
!rvDescription
TRUEevaluated 72 times by 2 tests
Evaluated by:
  • ssltest
  • tlstest
FALSEnever evaluated
) {
0-72
179 if (!a->parameter
!a->parameterDescription
TRUEnever evaluated
FALSEevaluated 72 times by 2 tests
Evaluated by:
  • ssltest
  • tlstest
&& !b->parameter
!b->parameterDescription
TRUEnever evaluated
FALSEnever evaluated
)
0-72
180 rv = 0;
never executed: rv = 0;
0
181 else-
182 rv = ASN1_TYPE_cmp(a->parameter, b->parameter);
executed 72 times by 2 tests: rv = ASN1_TYPE_cmp(a->parameter, b->parameter);
Executed by:
  • ssltest
  • tlstest
72
183 }-
184 return
executed 72 times by 2 tests: return(rv);
Executed by:
  • ssltest
  • tlstest
(rv);
executed 72 times by 2 tests: return(rv);
Executed by:
  • ssltest
  • tlstest
72
185}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2