OpenCoverage

chacha.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/chacha/chacha.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4void-
5ChaCha_set_key(ChaCha_ctx *ctx, const unsigned char *key, uint32_t keybits)-
6{-
7 chacha_keysetup((chacha_ctx *)ctx, key, keybits);-
8 ctx->unused = 0;-
9}
executed 32 times by 2 tests: end of block
Executed by:
  • chachatest
  • evptest
32
10-
11void-
12ChaCha_set_iv(ChaCha_ctx *ctx, const unsigned char *iv,-
13 const unsigned char *counter)-
14{-
15 chacha_ivsetup((chacha_ctx *)ctx, iv, counter);-
16 ctx->unused = 0;-
17}
executed 32 times by 2 tests: end of block
Executed by:
  • chachatest
  • evptest
32
18-
19void-
20ChaCha(ChaCha_ctx *ctx, unsigned char *out, const unsigned char *in, size_t len)-
21{-
22 unsigned char *k;-
23 int i, l;-
24-
25-
26 if (ctx->unused > 0
ctx->unused > 0Description
TRUEevaluated 552 times by 1 test
Evaluated by:
  • chachatest
FALSEevaluated 32 times by 2 tests
Evaluated by:
  • chachatest
  • evptest
) {
32-552
27 k = ctx->ks + 64 - ctx->unused;-
28 l = (
(len > ctx->unused)Description
TRUEnever evaluated
FALSEevaluated 552 times by 1 test
Evaluated by:
  • chachatest
len > ctx->unused)
(len > ctx->unused)Description
TRUEnever evaluated
FALSEevaluated 552 times by 1 test
Evaluated by:
  • chachatest
? ctx->unused : len;
0-552
29 for (i = 0; i < l
i < lDescription
TRUEevaluated 768 times by 1 test
Evaluated by:
  • chachatest
FALSEevaluated 552 times by 1 test
Evaluated by:
  • chachatest
; i++)
552-768
30 *(
executed 768 times by 1 test: *(out++) = *(in++) ^ *(k++);
Executed by:
  • chachatest
out++) = *(in++) ^ *(k++);
executed 768 times by 1 test: *(out++) = *(in++) ^ *(k++);
Executed by:
  • chachatest
768
31 ctx->unused -= l;-
32 len -= l;-
33 }
executed 552 times by 1 test: end of block
Executed by:
  • chachatest
552
34-
35 chacha_encrypt_bytes((chacha_ctx *)ctx, in, out, (uint32_t)len);-
36}
executed 584 times by 2 tests: end of block
Executed by:
  • chachatest
  • evptest
584
37-
38void-
39CRYPTO_chacha_20(unsigned char *out, const unsigned char *in, size_t len,-
40 const unsigned char key[32], const unsigned char iv[8], uint64_t counter)-
41{-
42 struct chacha_ctx ctx;-
43-
44-
45-
46-
47-
48-
49 chacha_keysetup(&ctx, key, 256);-
50 chacha_ivsetup(&ctx, iv, -
51 ((void *)0)-
52 );-
53 if (counter != 0
counter != 0Description
TRUEevaluated 325 times by 3 tests
Evaluated by:
  • aeadtest
  • ssltest
  • tlstest
FALSEevaluated 11 times by 2 tests
Evaluated by:
  • aeadtest
  • chachatest
) {
11-325
54 ctx.input[12] = (uint32_t)counter;-
55 ctx.input[13] = (uint32_t)(counter >> 32);-
56 }
executed 325 times by 3 tests: end of block
Executed by:
  • aeadtest
  • ssltest
  • tlstest
325
57-
58 chacha_encrypt_bytes(&ctx, in, out, (uint32_t)len);-
59}
executed 336 times by 4 tests: end of block
Executed by:
  • aeadtest
  • chachatest
  • ssltest
  • tlstest
336
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2