OpenCoverage

x_bignum.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/asn1/x_bignum.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2static int bn_new(ASN1_VALUE **pval, const ASN1_ITEM *it);-
3static void bn_free(ASN1_VALUE **pval, const ASN1_ITEM *it);-
4-
5static int bn_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype,-
6 const ASN1_ITEM *it);-
7static int bn_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,-
8 int utype, char *free_cont, const ASN1_ITEM *it);-
9-
10static ASN1_PRIMITIVE_FUNCS bignum_pf = {-
11 -
12((void *)0)-
13 ,-
14 0,-
15 bn_new,-
16 bn_free,-
17 0,-
18 bn_c2i,-
19 bn_i2c-
20};-
21-
22const ASN1_ITEM BIGNUM_it = {-
23 .itype = 0x0,-
24 .utype = 2,-
25 .templates = -
26 ((void *)0)-
27 ,-
28 .tcount = 0,-
29 .funcs = &bignum_pf,-
30 .size = 0,-
31 .sname = "BIGNUM",-
32};-
33-
34const ASN1_ITEM CBIGNUM_it = {-
35 .itype = 0x0,-
36 .utype = 2,-
37 .templates = -
38 ((void *)0)-
39 ,-
40 .tcount = 0,-
41 .funcs = &bignum_pf,-
42 .size = 0,-
43 .sname = "BIGNUM",-
44};-
45-
46static int-
47bn_new(ASN1_VALUE **pval, const ASN1_ITEM *it)-
48{-
49 *pval = (ASN1_VALUE *)BN_new();-
50 if (*
*pvalDescription
TRUEevaluated 2403 times by 7 tests
Evaluated by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
FALSEnever evaluated
pval
*pvalDescription
TRUEevaluated 2403 times by 7 tests
Evaluated by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
FALSEnever evaluated
)
0-2403
51 return
executed 2403 times by 7 tests: return 1;
Executed by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
1;
executed 2403 times by 7 tests: return 1;
Executed by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
2403
52 else-
53 return
never executed: return 0;
0;
never executed: return 0;
0
54}-
55-
56static void-
57bn_free(ASN1_VALUE **pval, const ASN1_ITEM *it)-
58{-
59 if (*
*pval == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1216 times by 1 test
Evaluated by:
  • ecdsatest
pval ==
*pval == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1216 times by 1 test
Evaluated by:
  • ecdsatest
0-1216
60 ((void *)0)
*pval == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1216 times by 1 test
Evaluated by:
  • ecdsatest
0-1216
61 )-
62 return;
never executed: return;
0
63 BN_clear_free((BIGNUM *)*pval);-
64 *pval = -
65 ((void *)0)-
66 ;-
67}
executed 1216 times by 1 test: end of block
Executed by:
  • ecdsatest
1216
68-
69static int-
70bn_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it)-
71{-
72 BIGNUM *bn;-
73 int pad, len;-
74-
75 if (*
*pval == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 5650 times by 4 tests
Evaluated by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • ssltest
pval ==
*pval == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 5650 times by 4 tests
Evaluated by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • ssltest
0-5650
76 ((void *)0)
*pval == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 5650 times by 4 tests
Evaluated by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • ssltest
0-5650
77 )-
78 return
never executed: return -1;
-1;
never executed: return -1;
0
79 bn = (BIGNUM *)*pval;-
80-
81 if (BN_num_bits(bn) & 0x7
BN_num_bits(bn) & 0x7Description
TRUEevaluated 3719 times by 3 tests
Evaluated by:
  • ecdsatest
  • libcrypto.so.44.0.1
  • ssltest
FALSEevaluated 1931 times by 4 tests
Evaluated by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • ssltest
)
1931-3719
82 pad = 0;
executed 3719 times by 3 tests: pad = 0;
Executed by:
  • ecdsatest
  • libcrypto.so.44.0.1
  • ssltest
3719
83 else-
84 pad = 1;
executed 1931 times by 4 tests: pad = 1;
Executed by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • ssltest
1931
85 if (cont
contDescription
TRUEevaluated 1528 times by 4 tests
Evaluated by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • ssltest
FALSEevaluated 4122 times by 4 tests
Evaluated by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • ssltest
) {
1528-4122
86 if (pad
padDescription
TRUEevaluated 517 times by 4 tests
Evaluated by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • ssltest
FALSEevaluated 1011 times by 3 tests
Evaluated by:
  • ecdsatest
  • libcrypto.so.44.0.1
  • ssltest
)
517-1011
87 *
executed 517 times by 4 tests: *cont++ = 0;
Executed by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • ssltest
cont++ = 0;
executed 517 times by 4 tests: *cont++ = 0;
Executed by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • ssltest
517
88 len = BN_bn2bin(bn, cont);-
89 }
executed 1528 times by 4 tests: end of block
Executed by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • ssltest
else
1528
90 len = ((BN_num_bits(bn)+7)/8);
executed 4122 times by 4 tests: len = ((BN_num_bits(bn)+7)/8);
Executed by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • ssltest
4122
91 return
executed 5650 times by 4 tests: return pad + len;
Executed by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • ssltest
pad + len;
executed 5650 times by 4 tests: return pad + len;
Executed by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • ssltest
5650
92}-
93-
94static int-
95bn_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype,-
96 char *free_cont, const ASN1_ITEM *it)-
97{-
98 BIGNUM *bn;-
99-
100 if (*
*pval == ((void *)0)Description
TRUEevaluated 1187 times by 6 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
FALSEevaluated 912 times by 1 test
Evaluated by:
  • ecdsatest
pval ==
*pval == ((void *)0)Description
TRUEevaluated 1187 times by 6 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
FALSEevaluated 912 times by 1 test
Evaluated by:
  • ecdsatest
912-1187
101 ((void *)0)
*pval == ((void *)0)Description
TRUEevaluated 1187 times by 6 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
FALSEevaluated 912 times by 1 test
Evaluated by:
  • ecdsatest
912-1187
102 ) {-
103 if (bn_new(pval, it) == 0
bn_new(pval, it) == 0Description
TRUEnever evaluated
FALSEevaluated 1187 times by 6 tests
Evaluated by:
  • dsatest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
)
0-1187
104 return
never executed: return 0;
0;
never executed: return 0;
0
105 }
executed 1187 times by 6 tests: end of block
Executed by:
  • dsatest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
1187
106 bn = (BIGNUM *)*pval;-
107 if (!BN_bin2bn(cont, len, bn)
!BN_bin2bn(cont, len, bn)Description
TRUEnever evaluated
FALSEevaluated 2099 times by 7 tests
Evaluated by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
) {
0-2099
108 bn_free(pval, it);-
109 return
never executed: return 0;
0;
never executed: return 0;
0
110 }-
111 return
executed 2099 times by 7 tests: return 1;
Executed by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
1;
executed 2099 times by 7 tests: return 1;
Executed by:
  • dsatest
  • ecdsatest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
2099
112}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2