OpenCoverage

a_sign.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/asn1/a_sign.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6int-
7ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,-
8 ASN1_BIT_STRING *signature, void *asn, EVP_PKEY *pkey, const EVP_MD *type)-
9{-
10 EVP_MD_CTX ctx;-
11 EVP_MD_CTX_init(&ctx);-
12 if (!EVP_DigestSignInit(&ctx,
!EVP_DigestSig...d *)0) , pkey)Description
TRUEnever evaluated
FALSEnever evaluated
0
13 ((void *)0)
!EVP_DigestSig...d *)0) , pkey)Description
TRUEnever evaluated
FALSEnever evaluated
0
14 , type,
!EVP_DigestSig...d *)0) , pkey)Description
TRUEnever evaluated
FALSEnever evaluated
0
15 ((void *)0)
!EVP_DigestSig...d *)0) , pkey)Description
TRUEnever evaluated
FALSEnever evaluated
0
16 , pkey)
!EVP_DigestSig...d *)0) , pkey)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
17 EVP_MD_CTX_cleanup(&ctx);-
18 return
never executed: return 0;
0;
never executed: return 0;
0
19 }-
20 return
never executed: return ASN1_item_sign_ctx(it, algor1, algor2, signature, asn, &ctx);
ASN1_item_sign_ctx(it, algor1, algor2, signature, asn, &ctx);
never executed: return ASN1_item_sign_ctx(it, algor1, algor2, signature, asn, &ctx);
0
21}-
22-
23-
24int-
25ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,-
26 ASN1_BIT_STRING *signature, void *asn, EVP_MD_CTX *ctx)-
27{-
28 const EVP_MD *type;-
29 EVP_PKEY *pkey;-
30 unsigned char *buf_in = -
31 ((void *)0)-
32 , *buf_out = -
33 ((void *)0)-
34 ;-
35 size_t inl = 0, outl = 0, outll = 0;-
36 int signid, paramtype;-
37 int rv;-
38-
39 type = EVP_MD_CTX_md(ctx);-
40 pkey = EVP_PKEY_CTX_get0_pkey(ctx->pctx);-
41-
42 if (!type
!typeDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
|| !pkey
!pkeyDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
) {
0-2
43 ERR_put_error(13,(0xfff),(217),__FILE__,156);-
44 return
never executed: return 0;
0;
never executed: return 0;
0
45 }-
46-
47 if (pkey->ameth->item_sign
pkey->ameth->item_signDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
) {
1
48 rv = pkey->ameth->item_sign(ctx, it, asn, algor1, algor2,-
49 signature);-
50 if (rv == 1
rv == 1Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
)
0-1
51 outl = signature->length;
never executed: outl = signature->length;
0
52-
53-
54-
55-
56-
57-
58 if (rv <= 0
rv <= 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
)
0-1
59 ERR_put_error(13,(0xfff),(6),__FILE__,172);
never executed: ERR_put_error(13,(0xfff),(6),__FILE__,172);
0
60 if (rv <= 1
rv <= 1Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
)
0-1
61 goto
never executed: goto err;
err;
never executed: goto err;
0
62 }
executed 1 time by 1 test: end of block
Executed by:
  • libcrypto.so.44.0.1
else
1
63 rv = 2;
executed 1 time by 1 test: rv = 2;
Executed by:
  • libcrypto.so.44.0.1
1
64-
65 if (rv == 2
rv == 2Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
FALSEnever evaluated
) {
0-2
66 if (type->flags & 0x0004
type->flags & 0x0004Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
FALSEnever evaluated
) {
0-2
67 if (!pkey->ameth
!pkey->amethDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
||
0-2
68 !OBJ_find_sigid_by_algs(&signid,
!OBJ_find_sigi...meth->pkey_id)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
0-2
69 EVP_MD_type(type), pkey->ameth->pkey_id)
!OBJ_find_sigi...meth->pkey_id)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
) {
0-2
70 ERR_put_error(13,(0xfff),(198),__FILE__,183);-
71 return
never executed: return 0;
0;
never executed: return 0;
0
72 }-
73 }
executed 2 times by 1 test: end of block
Executed by:
  • libcrypto.so.44.0.1
else
2
74 signid = type->pkey_type;
never executed: signid = type->pkey_type;
0
75-
76 if (pkey->ameth->pkey_flags & 0x4
pkey->ameth->pkey_flags & 0x4Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
)
1
77 paramtype = 5;
executed 1 time by 1 test: paramtype = 5;
Executed by:
  • libcrypto.so.44.0.1
1
78 else-
79 paramtype = -1;
executed 1 time by 1 test: paramtype = -1;
Executed by:
  • libcrypto.so.44.0.1
1
80-
81 if (algor1
algor1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
FALSEnever evaluated
)
0-2
82 X509_ALGOR_set0(algor1,
executed 2 times by 1 test: X509_ALGOR_set0(algor1, OBJ_nid2obj(signid), paramtype, ((void *)0) );
Executed by:
  • libcrypto.so.44.0.1
2
83 OBJ_nid2obj(signid), paramtype,
executed 2 times by 1 test: X509_ALGOR_set0(algor1, OBJ_nid2obj(signid), paramtype, ((void *)0) );
Executed by:
  • libcrypto.so.44.0.1
2
84 ((void *)0)
executed 2 times by 1 test: X509_ALGOR_set0(algor1, OBJ_nid2obj(signid), paramtype, ((void *)0) );
Executed by:
  • libcrypto.so.44.0.1
2
85 );
executed 2 times by 1 test: X509_ALGOR_set0(algor1, OBJ_nid2obj(signid), paramtype, ((void *)0) );
Executed by:
  • libcrypto.so.44.0.1
2
86 if (algor2
algor2Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
FALSEnever evaluated
)
0-2
87 X509_ALGOR_set0(algor2,
executed 2 times by 1 test: X509_ALGOR_set0(algor2, OBJ_nid2obj(signid), paramtype, ((void *)0) );
Executed by:
  • libcrypto.so.44.0.1
2
88 OBJ_nid2obj(signid), paramtype,
executed 2 times by 1 test: X509_ALGOR_set0(algor2, OBJ_nid2obj(signid), paramtype, ((void *)0) );
Executed by:
  • libcrypto.so.44.0.1
2
89 ((void *)0)
executed 2 times by 1 test: X509_ALGOR_set0(algor2, OBJ_nid2obj(signid), paramtype, ((void *)0) );
Executed by:
  • libcrypto.so.44.0.1
2
90 );
executed 2 times by 1 test: X509_ALGOR_set0(algor2, OBJ_nid2obj(signid), paramtype, ((void *)0) );
Executed by:
  • libcrypto.so.44.0.1
2
91-
92 }
executed 2 times by 1 test: end of block
Executed by:
  • libcrypto.so.44.0.1
2
93-
94 inl = ASN1_item_i2d(asn, &buf_in, it);-
95 outll = outl = EVP_PKEY_size(pkey);-
96 buf_out = malloc(outl);-
97 if ((
(buf_in == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
buf_in ==
(buf_in == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
0-2
98 ((void *)0)
(buf_in == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
0-2
99 )
(buf_in == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
|| (
(buf_out == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
buf_out ==
(buf_out == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
0-2
100 ((void *)0)
(buf_out == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
0-2
101 )
(buf_out == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
) {
0-2
102 outl = 0;-
103 ERR_put_error(13,(0xfff),((1|64)),__FILE__,208);-
104 goto
never executed: goto err;
err;
never executed: goto err;
0
105 }-
106-
107 if (!EVP_DigestUpdate(ctx,buf_in,inl)
!EVP_DigestUpd...tx,buf_in,inl)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
||
0-2
108 !EVP_DigestSignFinal(ctx, buf_out, &outl)
!EVP_DigestSig...uf_out, &outl)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
) {
0-2
109 outl = 0;-
110 ERR_put_error(13,(0xfff),(6),__FILE__,215);-
111 goto
never executed: goto err;
err;
never executed: goto err;
0
112 }-
113 free(signature->data);-
114 signature->data = buf_out;-
115 buf_out = -
116 ((void *)0)-
117 ;-
118 signature->length = outl;-
119-
120-
121-
122 signature->flags &= ~(0x08|0x07);-
123 signature->flags |= 0x08;-
124-
125err:
code before this statement executed 2 times by 1 test: err:
Executed by:
  • libcrypto.so.44.0.1
2
126 EVP_MD_CTX_cleanup(ctx);-
127 freezero((char *)buf_in, inl);-
128 freezero((char *)buf_out, outll);-
129 return
executed 2 times by 1 test: return (outl);
Executed by:
  • libcrypto.so.44.0.1
(outl);
executed 2 times by 1 test: return (outl);
Executed by:
  • libcrypto.so.44.0.1
2
130}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2