OpenCoverage

ct_vfy.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/ct/ct_vfy.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6typedef enum sct_signature_type_t {-
7 SIGNATURE_TYPE_NOT_SET = -1,-
8 SIGNATURE_TYPE_CERT_TIMESTAMP,-
9 SIGNATURE_TYPE_TREE_HASH-
10} SCT_SIGNATURE_TYPE;-
11-
12-
13-
14-
15-
16static int sct_ctx_update(EVP_MD_CTX *ctx, const SCT_CTX *sctx, const SCT *sct)-
17{-
18 unsigned char tmpbuf[12];-
19 unsigned char *p, *der;-
20 size_t derlen;-
21 if (sct->entry_type == CT_LOG_ENTRY_TYPE_NOT_SET
sct->entry_typ...Y_TYPE_NOT_SETDescription
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-8
22 return
never executed: return 0;
0;
never executed: return 0;
0
23 if (sct->entry_type == CT_LOG_ENTRY_TYPE_PRECERT
sct->entry_typ...Y_TYPE_PRECERTDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
&& sctx->ihash ==
sctx->ihash == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
24 ((void *)0)
sctx->ihash == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
25 )-
26 return
never executed: return 0;
0;
never executed: return 0;
0
27-
28 p = tmpbuf;-
29 *p++ = sct->version;-
30 *p++ = SIGNATURE_TYPE_CERT_TIMESTAMP;-
31 (*((p)++)=(unsigned char)(((sct->timestamp)>>56)&0xff), *((p)++)=(unsigned char)(((sct->timestamp)>>48)&0xff), *((p)++)=(unsigned char)(((sct->timestamp)>>40)&0xff), *((p)++)=(unsigned char)(((sct->timestamp)>>32)&0xff), *((p)++)=(unsigned char)(((sct->timestamp)>>24)&0xff), *((p)++)=(unsigned char)(((sct->timestamp)>>16)&0xff), *((p)++)=(unsigned char)(((sct->timestamp)>> 8)&0xff), *((p)++)=(unsigned char)(((sct->timestamp) )&0xff));-
32 ((p[0]=(unsigned char)(((sct->entry_type)>> 8)&0xff), p[1]=(unsigned char)(((sct->entry_type) )&0xff)),p+=2);-
33-
34 if (!EVP_DigestUpdate(ctx, tmpbuf, p - tmpbuf)
!EVP_DigestUpd...f, p - tmpbuf)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-8
35 return
never executed: return 0;
0;
never executed: return 0;
0
36-
37 if (sct->entry_type == CT_LOG_ENTRY_TYPE_X509
sct->entry_typ...NTRY_TYPE_X509Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-8
38 der = sctx->certder;-
39 derlen = sctx->certderlen;-
40 }
never executed: end of block
else {
0
41 if (!EVP_DigestUpdate(ctx, sctx->ihash, sctx->ihashlen)
!EVP_DigestUpd...ctx->ihashlen)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-8
42 return
never executed: return 0;
0;
never executed: return 0;
0
43 der = sctx->preder;-
44 derlen = sctx->prederlen;-
45 }
executed 8 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
8
46-
47-
48 if (der ==
der == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
49 ((void *)0)
der == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
50 )-
51 return
never executed: return 0;
0;
never executed: return 0;
0
52-
53-
54 p = tmpbuf;-
55 ((p[0]=(unsigned char)(((derlen)>>16)&0xff), p[1]=(unsigned char)(((derlen)>> 8)&0xff), p[2]=(unsigned char)(((derlen) )&0xff)),p+=3);-
56-
57 if (!EVP_DigestUpdate(ctx, tmpbuf, 3)
!EVP_DigestUpd...tx, tmpbuf, 3)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-8
58 return
never executed: return 0;
0;
never executed: return 0;
0
59 if (!EVP_DigestUpdate(ctx, der, derlen)
!EVP_DigestUpd..., der, derlen)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-8
60 return
never executed: return 0;
0;
never executed: return 0;
0
61-
62-
63 p = tmpbuf;-
64 ((p[0]=(unsigned char)(((sct->ext_len)>> 8)&0xff), p[1]=(unsigned char)(((sct->ext_len) )&0xff)),p+=2);-
65 if (!EVP_DigestUpdate(ctx, tmpbuf, 2)
!EVP_DigestUpd...tx, tmpbuf, 2)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-8
66 return
never executed: return 0;
0;
never executed: return 0;
0
67-
68 if (sct->ext_len
sct->ext_lenDescription
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& !EVP_DigestUpdate(ctx, sct->ext, sct->ext_len)
!EVP_DigestUpd... sct->ext_len)Description
TRUEnever evaluated
FALSEnever evaluated
)
0-8
69 return
never executed: return 0;
0;
never executed: return 0;
0
70-
71 return
executed 8 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 8 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
8
72}-
73-
74int SCT_CTX_verify(const SCT_CTX *sctx, const SCT *sct)-
75{-
76 EVP_MD_CTX *ctx = -
77 ((void *)0)-
78 ;-
79 int ret = 0;-
80-
81 if (!SCT_is_complete(sct)
!SCT_is_complete(sct)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| sctx->pkey ==
sctx->pkey == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9
82 ((void *)0)
sctx->pkey == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9
83 ||-
84 sct->entry_type == CT_LOG_ENTRY_TYPE_NOT_SET
sct->entry_typ...Y_TYPE_NOT_SETDescription
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
||
0-9
85 (sct->entry_type == CT_LOG_ENTRY_TYPE_PRECERT
sct->entry_typ...Y_TYPE_PRECERTDescription
TRUEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
&& sctx->ihash ==
sctx->ihash == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9
86 ((void *)0)
sctx->ihash == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9
87 )) {-
88 ERR_put_error(50,(128),(106),__FILE__,104);-
89 return
never executed: return 0;
0;
never executed: return 0;
0
90 }-
91 if (sct->version != SCT_VERSION_V1
sct->version != SCT_VERSION_V1Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-9
92 ERR_put_error(50,(128),(115),__FILE__,108);-
93 return
never executed: return 0;
0;
never executed: return 0;
0
94 }-
95 if (sct->log_id_len != sctx->pkeyhashlen
sct->log_id_le...x->pkeyhashlenDescription
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
||
0-9
96 memcmp(sct->log_id, sctx->pkeyhash, sctx->pkeyhashlen) != 0
memcmp(sct->lo...yhashlen) != 0Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-9
97 ERR_put_error(50,(128),(114),__FILE__,113);-
98 return
never executed: return 0;
0;
never executed: return 0;
0
99 }-
100 if (sct->timestamp > sctx->epoch_time_in_ms
sct->timestamp...och_time_in_msDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1-8
101 ERR_put_error(50,(128),(116),__FILE__,117);-
102 return
executed 1 time by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 1 time by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
1
103 }-
104-
105 ctx = EVP_MD_CTX_new();-
106 if (ctx ==
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
107 ((void *)0)
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
108 )-
109 goto
never executed: goto end;
end;
never executed: goto end;
0
110-
111 if (!EVP_DigestVerifyInit(ctx,
!EVP_DigestVer... , sctx->pkey)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
112 ((void *)0)
!EVP_DigestVer... , sctx->pkey)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
113 , EVP_sha256(),
!EVP_DigestVer... , sctx->pkey)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
114 ((void *)0)
!EVP_DigestVer... , sctx->pkey)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
115 , sctx->pkey)
!EVP_DigestVer... , sctx->pkey)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-8
116 goto
never executed: goto end;
end;
never executed: goto end;
0
117-
118 if (!sct_ctx_update(ctx, sctx, sct)
!sct_ctx_updat...tx, sctx, sct)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-8
119 goto
never executed: goto end;
end;
never executed: goto end;
0
120-
121-
122 ret = EVP_DigestVerifyFinal(ctx, sct->sig, sct->sig_len);-
123-
124 if (ret == 0
ret == 0Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-8
125 ERR_put_error(50,(128),(107),__FILE__,135);
never executed: ERR_put_error(50,(128),(107),__FILE__,135);
0
126-
127end:
code before this statement executed 8 times by 1 test: end:
Executed by:
  • libcrypto.so.1.1
8
128 EVP_MD_CTX_free(ctx);-
129 return
executed 8 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 8 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
8
130}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2