OpenCoverage

hmac.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/hmac/hmac.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,-
3 const EVP_MD *md, ENGINE *impl)-
4{-
5 int rv = 0;-
6 int i, j, reset = 0;-
7 unsigned char pad[144];-
8-
9-
10 if (md !=
md != ((void *)0)Description
TRUEevaluated 53523 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 55 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
55-53523
11 ((void *)0)
md != ((void *)0)Description
TRUEevaluated 53523 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 55 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
55-53523
12 && md != ctx->md
md != ctx->mdDescription
TRUEevaluated 53523 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
&& (key ==
key == ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 53521 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-53523
13 ((void *)0)
key == ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 53521 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2-53521
14 || len < 0
len < 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 53520 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
))
1-53520
15 return
executed 3 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 3 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
3
16-
17 if (md !=
md != ((void *)0)Description
TRUEevaluated 53520 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 55 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
55-53520
18 ((void *)0)
md != ((void *)0)Description
TRUEevaluated 53520 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 55 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
55-53520
19 ) {-
20 reset = 1;-
21 ctx->md = md;-
22 }
executed 53520 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else if (ctx->md
ctx->mdDescription
TRUEevaluated 53 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
2-53520
23 md = ctx->md;-
24 }
executed 53 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
53
25 return
executed 2 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 2 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
2
26 }-
27-
28 if (key !=
key != ((void *)0)Description
TRUEevaluated 53521 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 52 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
52-53521
29 ((void *)0)
key != ((void *)0)Description
TRUEevaluated 53521 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 52 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
52-53521
30 ) {-
31 reset = 1;-
32 j = EVP_MD_block_size(md);-
33 if (!((j <= (int)sizeof(ctx->key)) != 0)
!((j <= (int)s...x->key)) != 0)Description
TRUEnever evaluated
FALSEevaluated 53521 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-53521
34 return
never executed: return 0;
0;
never executed: return 0;
0
35 if (j < len
j < lenDescription
TRUEevaluated 206 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 53315 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
206-53315
36 if (!EVP_DigestInit_ex(ctx->md_ctx, md, impl)
!EVP_DigestIni...ctx, md, impl)Description
TRUEnever evaluated
FALSEevaluated 206 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-206
37 || !EVP_DigestUpdate(ctx->md_ctx, key, len)
!EVP_DigestUpd...ctx, key, len)Description
TRUEnever evaluated
FALSEevaluated 206 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-206
38 || !EVP_DigestFinal_ex(ctx->md_ctx, ctx->key,
!EVP_DigestFin...x->key_length)Description
TRUEnever evaluated
FALSEevaluated 206 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-206
39 &ctx->key_length)
!EVP_DigestFin...x->key_length)Description
TRUEnever evaluated
FALSEevaluated 206 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-206
40 return
never executed: return 0;
0;
never executed: return 0;
0
41 }
executed 206 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
206
42 if (len < 0
len < 0Description
TRUEnever evaluated
FALSEevaluated 53315 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| len > (int)sizeof(ctx->key)
len > (int)sizeof(ctx->key)Description
TRUEnever evaluated
FALSEevaluated 53315 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-53315
43 return
never executed: return 0;
0;
never executed: return 0;
0
44 memcpy(ctx->key, key, len);-
45 ctx->key_length = len;-
46 }
executed 53315 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
53315
47 if (ctx->key_length != 144
ctx->key_length != 144Description
TRUEevaluated 53520 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
1-53520
48 memset(&ctx->key[ctx->key_length], 0,
executed 53520 times by 1 test: memset(&ctx->key[ctx->key_length], 0, 144 - ctx->key_length);
Executed by:
  • libcrypto.so.1.1
53520
49 144 - ctx->key_length);
executed 53520 times by 1 test: memset(&ctx->key[ctx->key_length], 0, 144 - ctx->key_length);
Executed by:
  • libcrypto.so.1.1
53520
50 }
executed 53521 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
53521
51-
52 if (reset
resetDescription
TRUEevaluated 53521 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 52 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
52-53521
53 for (i = 0; i < 144
i < 144Description
TRUEevaluated 7707024 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 53521 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; i++)
53521-7707024
54 pad[i] = 0x36 ^ ctx->key[i];
executed 7707024 times by 1 test: pad[i] = 0x36 ^ ctx->key[i];
Executed by:
  • libcrypto.so.1.1
7707024
55 if (!EVP_DigestInit_ex(ctx->i_ctx, md, impl)
!EVP_DigestIni...ctx, md, impl)Description
TRUEnever evaluated
FALSEevaluated 53521 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-53521
56 || !EVP_DigestUpdate(ctx->i_ctx, pad, EVP_MD_block_size(md))
!EVP_DigestUpd...lock_size(md))Description
TRUEnever evaluated
FALSEevaluated 53521 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-53521
57 goto
never executed: goto err;
err;
never executed: goto err;
0
58-
59 for (i = 0; i < 144
i < 144Description
TRUEevaluated 7707024 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 53521 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; i++)
53521-7707024
60 pad[i] = 0x5c ^ ctx->key[i];
executed 7707024 times by 1 test: pad[i] = 0x5c ^ ctx->key[i];
Executed by:
  • libcrypto.so.1.1
7707024
61 if (!EVP_DigestInit_ex(ctx->o_ctx, md, impl)
!EVP_DigestIni...ctx, md, impl)Description
TRUEnever evaluated
FALSEevaluated 53521 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-53521
62 || !EVP_DigestUpdate(ctx->o_ctx, pad, EVP_MD_block_size(md))
!EVP_DigestUpd...lock_size(md))Description
TRUEnever evaluated
FALSEevaluated 53521 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-53521
63 goto
never executed: goto err;
err;
never executed: goto err;
0
64 }
executed 53521 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
53521
65 if (!EVP_MD_CTX_copy_ex(ctx->md_ctx, ctx->i_ctx)
!EVP_MD_CTX_co...x, ctx->i_ctx)Description
TRUEnever evaluated
FALSEevaluated 53573 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-53573
66 goto
never executed: goto err;
err;
never executed: goto err;
0
67 rv = 1;-
68 err:
code before this statement executed 53573 times by 1 test: err:
Executed by:
  • libcrypto.so.1.1
53573
69 if (reset
resetDescription
TRUEevaluated 53521 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 52 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
52-53521
70 OPENSSL_cleanse(pad, sizeof(pad));
executed 53521 times by 1 test: OPENSSL_cleanse(pad, sizeof(pad));
Executed by:
  • libcrypto.so.1.1
53521
71 return
executed 53573 times by 1 test: return rv;
Executed by:
  • libcrypto.so.1.1
rv;
executed 53573 times by 1 test: return rv;
Executed by:
  • libcrypto.so.1.1
53573
72}-
73-
74-
75int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md)-
76{-
77 if (key
keyDescription
TRUEnever evaluated
FALSEnever evaluated
&& md
mdDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
78 HMAC_CTX_reset(ctx);
never executed: HMAC_CTX_reset(ctx);
0
79 return
never executed: return HMAC_Init_ex(ctx, key, len, md, ((void *)0) );
HMAC_Init_ex(ctx, key, len, md,
never executed: return HMAC_Init_ex(ctx, key, len, md, ((void *)0) );
0
80 ((void *)0)
never executed: return HMAC_Init_ex(ctx, key, len, md, ((void *)0) );
0
81 );
never executed: return HMAC_Init_ex(ctx, key, len, md, ((void *)0) );
0
82}-
83-
84-
85int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len)-
86{-
87 if (!ctx->md
!ctx->mdDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 218860 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
3-218860
88 return
executed 3 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 3 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
3
89 return
executed 218860 times by 1 test: return EVP_DigestUpdate(ctx->md_ctx, data, len);
Executed by:
  • libcrypto.so.1.1
EVP_DigestUpdate(ctx->md_ctx, data, len);
executed 218860 times by 1 test: return EVP_DigestUpdate(ctx->md_ctx, data, len);
Executed by:
  • libcrypto.so.1.1
218860
90}-
91-
92int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len)-
93{-
94 unsigned int i;-
95 unsigned char buf[64];-
96-
97 if (!ctx->md
!ctx->mdDescription
TRUEnever evaluated
FALSEevaluated 163219 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-163219
98 goto
never executed: goto err;
err;
never executed: goto err;
0
99-
100 if (!EVP_DigestFinal_ex(ctx->md_ctx, buf, &i)
!EVP_DigestFin..._ctx, buf, &i)Description
TRUEnever evaluated
FALSEevaluated 163219 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-163219
101 goto
never executed: goto err;
err;
never executed: goto err;
0
102 if (!EVP_MD_CTX_copy_ex(ctx->md_ctx, ctx->o_ctx)
!EVP_MD_CTX_co...x, ctx->o_ctx)Description
TRUEnever evaluated
FALSEevaluated 163219 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-163219
103 goto
never executed: goto err;
err;
never executed: goto err;
0
104 if (!EVP_DigestUpdate(ctx->md_ctx, buf, i)
!EVP_DigestUpd...d_ctx, buf, i)Description
TRUEnever evaluated
FALSEevaluated 163219 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-163219
105 goto
never executed: goto err;
err;
never executed: goto err;
0
106 if (!EVP_DigestFinal_ex(ctx->md_ctx, md, len)
!EVP_DigestFin..._ctx, md, len)Description
TRUEnever evaluated
FALSEevaluated 163219 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-163219
107 goto
never executed: goto err;
err;
never executed: goto err;
0
108 return
executed 163219 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 163219 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
163219
109 err:-
110 return
never executed: return 0;
0;
never executed: return 0;
0
111}-
112-
113size_t HMAC_size(const HMAC_CTX *ctx)-
114{-
115 int size = EVP_MD_size((ctx)->md);-
116-
117 return
executed 221 times by 1 test: return (size < 0) ? 0 : size;
Executed by:
  • libcrypto.so.1.1
(
(size < 0)Description
TRUEnever evaluated
FALSEevaluated 221 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
size < 0)
(size < 0)Description
TRUEnever evaluated
FALSEevaluated 221 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
? 0 : size;
executed 221 times by 1 test: return (size < 0) ? 0 : size;
Executed by:
  • libcrypto.so.1.1
0-221
118}-
119-
120HMAC_CTX *HMAC_CTX_new(void)-
121{-
122 HMAC_CTX *ctx = CRYPTO_zalloc(sizeof(HMAC_CTX), __FILE__, 128);-
123-
124 if (ctx !=
ctx != ((void *)0)Description
TRUEevaluated 215927 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-215927
125 ((void *)0)
ctx != ((void *)0)Description
TRUEevaluated 215927 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-215927
126 ) {-
127 if (!HMAC_CTX_reset(ctx)
!HMAC_CTX_reset(ctx)Description
TRUEnever evaluated
FALSEevaluated 215927 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-215927
128 HMAC_CTX_free(ctx);-
129 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
130 ((void *)0)
never executed: return ((void *)0) ;
0
131 ;
never executed: return ((void *)0) ;
0
132 }-
133 }
executed 215927 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
215927
134 return
executed 215927 times by 1 test: return ctx;
Executed by:
  • libcrypto.so.1.1
ctx;
executed 215927 times by 1 test: return ctx;
Executed by:
  • libcrypto.so.1.1
215927
135}-
136-
137static void hmac_ctx_cleanup(HMAC_CTX *ctx)-
138{-
139 EVP_MD_CTX_reset(ctx->i_ctx);-
140 EVP_MD_CTX_reset(ctx->o_ctx);-
141 EVP_MD_CTX_reset(ctx->md_ctx);-
142 ctx->md = -
143 ((void *)0)-
144 ;-
145 ctx->key_length = 0;-
146 OPENSSL_cleanse(ctx->key, sizeof(ctx->key));-
147}
executed 431855 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
431855
148-
149void HMAC_CTX_free(HMAC_CTX *ctx)-
150{-
151 if (ctx !=
ctx != ((void *)0)Description
TRUEevaluated 215927 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1191 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1191-215927
152 ((void *)0)
ctx != ((void *)0)Description
TRUEevaluated 215927 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1191 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1191-215927
153 ) {-
154 hmac_ctx_cleanup(ctx);-
155 EVP_MD_CTX_free(ctx->i_ctx);-
156 EVP_MD_CTX_free(ctx->o_ctx);-
157 EVP_MD_CTX_free(ctx->md_ctx);-
158 CRYPTO_free(ctx, __FILE__, 156);-
159 }
executed 215927 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
215927
160}
executed 217118 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
217118
161-
162static int hmac_ctx_alloc_mds(HMAC_CTX *ctx)-
163{-
164 if (ctx->i_ctx ==
ctx->i_ctx == ((void *)0)Description
TRUEevaluated 215927 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 207331 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
207331-215927
165 ((void *)0)
ctx->i_ctx == ((void *)0)Description
TRUEevaluated 215927 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 207331 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
207331-215927
166 )-
167 ctx->i_ctx = EVP_MD_CTX_new();
executed 215927 times by 1 test: ctx->i_ctx = EVP_MD_CTX_new();
Executed by:
  • libcrypto.so.1.1
215927
168 if (ctx->i_ctx ==
ctx->i_ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 423258 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-423258
169 ((void *)0)
ctx->i_ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 423258 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-423258
170 )-
171 return
never executed: return 0;
0;
never executed: return 0;
0
172 if (ctx->o_ctx ==
ctx->o_ctx == ((void *)0)Description
TRUEevaluated 215927 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 207331 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
207331-215927
173 ((void *)0)
ctx->o_ctx == ((void *)0)Description
TRUEevaluated 215927 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 207331 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
207331-215927
174 )-
175 ctx->o_ctx = EVP_MD_CTX_new();
executed 215927 times by 1 test: ctx->o_ctx = EVP_MD_CTX_new();
Executed by:
  • libcrypto.so.1.1
215927
176 if (ctx->o_ctx ==
ctx->o_ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 423258 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-423258
177 ((void *)0)
ctx->o_ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 423258 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-423258
178 )-
179 return
never executed: return 0;
0;
never executed: return 0;
0
180 if (ctx->md_ctx ==
ctx->md_ctx == ((void *)0)Description
TRUEevaluated 215927 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 207331 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
207331-215927
181 ((void *)0)
ctx->md_ctx == ((void *)0)Description
TRUEevaluated 215927 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 207331 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
207331-215927
182 )-
183 ctx->md_ctx = EVP_MD_CTX_new();
executed 215927 times by 1 test: ctx->md_ctx = EVP_MD_CTX_new();
Executed by:
  • libcrypto.so.1.1
215927
184 if (ctx->md_ctx ==
ctx->md_ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 423258 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-423258
185 ((void *)0)
ctx->md_ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 423258 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-423258
186 )-
187 return
never executed: return 0;
0;
never executed: return 0;
0
188 return
executed 423258 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 423258 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
423258
189}-
190-
191int HMAC_CTX_reset(HMAC_CTX *ctx)-
192{-
193 hmac_ctx_cleanup(ctx);-
194 if (!hmac_ctx_alloc_mds(ctx)
!hmac_ctx_alloc_mds(ctx)Description
TRUEnever evaluated
FALSEevaluated 215928 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-215928
195 hmac_ctx_cleanup(ctx);-
196 return
never executed: return 0;
0;
never executed: return 0;
0
197 }-
198 return
executed 215928 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 215928 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
215928
199}-
200-
201int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx)-
202{-
203 if (!hmac_ctx_alloc_mds(dctx)
!hmac_ctx_alloc_mds(dctx)Description
TRUEnever evaluated
FALSEevaluated 207330 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-207330
204 goto
never executed: goto err;
err;
never executed: goto err;
0
205 if (!EVP_MD_CTX_copy_ex(dctx->i_ctx, sctx->i_ctx)
!EVP_MD_CTX_co..., sctx->i_ctx)Description
TRUEnever evaluated
FALSEevaluated 207330 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-207330
206 goto
never executed: goto err;
err;
never executed: goto err;
0
207 if (!EVP_MD_CTX_copy_ex(dctx->o_ctx, sctx->o_ctx)
!EVP_MD_CTX_co..., sctx->o_ctx)Description
TRUEnever evaluated
FALSEevaluated 207330 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-207330
208 goto
never executed: goto err;
err;
never executed: goto err;
0
209 if (!EVP_MD_CTX_copy_ex(dctx->md_ctx, sctx->md_ctx)
!EVP_MD_CTX_co... sctx->md_ctx)Description
TRUEnever evaluated
FALSEevaluated 207330 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-207330
210 goto
never executed: goto err;
err;
never executed: goto err;
0
211 memcpy(dctx->key, sctx->key, 144);-
212 dctx->key_length = sctx->key_length;-
213 dctx->md = sctx->md;-
214 return
executed 207330 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 207330 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
207330
215 err:-
216 hmac_ctx_cleanup(dctx);-
217 return
never executed: return 0;
0;
never executed: return 0;
0
218}-
219-
220unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,-
221 const unsigned char *d, size_t n, unsigned char *md,-
222 unsigned int *md_len)-
223{-
224 HMAC_CTX *c = -
225 ((void *)0)-
226 ;-
227 static unsigned char m[64];-
228 static const unsigned char dummy_key[1] = {'\0'};-
229-
230 if (md ==
md == ((void *)0)Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4480 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
5-4480
231 ((void *)0)
md == ((void *)0)Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4480 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
5-4480
232 )-
233 md = m;
executed 5 times by 1 test: md = m;
Executed by:
  • libcrypto.so.1.1
5
234 if ((
(c = HMAC_CTX_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4485 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
c = HMAC_CTX_new()) ==
(c = HMAC_CTX_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4485 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4485
235 ((void *)0)
(c = HMAC_CTX_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4485 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4485
236 )-
237 goto
never executed: goto err;
err;
never executed: goto err;
0
238-
239-
240 if (key ==
key == ((void *)0)Description
TRUEevaluated 1571 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2914 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1571-2914
241 ((void *)0)
key == ((void *)0)Description
TRUEevaluated 1571 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2914 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1571-2914
242 && key_len == 0
key_len == 0Description
TRUEevaluated 1571 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-1571
243 key = dummy_key;-
244 }
executed 1571 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1571
245-
246 if (!HMAC_Init_ex(c, key, key_len, evp_md,
!HMAC_Init_ex(... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 4485 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4485
247 ((void *)0)
!HMAC_Init_ex(... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 4485 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4485
248 )
!HMAC_Init_ex(... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 4485 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-4485
249 goto
never executed: goto err;
err;
never executed: goto err;
0
250 if (!HMAC_Update(c, d, n)
!HMAC_Update(c, d, n)Description
TRUEnever evaluated
FALSEevaluated 4485 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-4485
251 goto
never executed: goto err;
err;
never executed: goto err;
0
252 if (!HMAC_Final(c, md, md_len)
!HMAC_Final(c, md, md_len)Description
TRUEnever evaluated
FALSEevaluated 4485 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-4485
253 goto
never executed: goto err;
err;
never executed: goto err;
0
254 HMAC_CTX_free(c);-
255 return
executed 4485 times by 1 test: return md;
Executed by:
  • libcrypto.so.1.1
md;
executed 4485 times by 1 test: return md;
Executed by:
  • libcrypto.so.1.1
4485
256 err:-
257 HMAC_CTX_free(c);-
258 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
259 ((void *)0)
never executed: return ((void *)0) ;
0
260 ;
never executed: return ((void *)0) ;
0
261}-
262-
263void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags)-
264{-
265 EVP_MD_CTX_set_flags(ctx->i_ctx, flags);-
266 EVP_MD_CTX_set_flags(ctx->o_ctx, flags);-
267 EVP_MD_CTX_set_flags(ctx->md_ctx, flags);-
268}
executed 19206 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
19206
269-
270const EVP_MD *HMAC_CTX_get_md(const HMAC_CTX *ctx)-
271{-
272 return
executed 3 times by 1 test: return ctx->md;
Executed by:
  • libcrypto.so.1.1
ctx->md;
executed 3 times by 1 test: return ctx->md;
Executed by:
  • libcrypto.so.1.1
3
273}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2