OpenCoverage

poly1305.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/poly1305/poly1305.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3size_t Poly1305_ctx_size(void)-
4{-
5 return
executed 13290 times by 1 test: return sizeof(struct poly1305_context);
Executed by:
  • libcrypto.so.1.1
sizeof(struct poly1305_context);
executed 13290 times by 1 test: return sizeof(struct poly1305_context);
Executed by:
  • libcrypto.so.1.1
13290
6}-
7-
8-
9static unsigned int U8TOU32(const unsigned char *p)-
10{-
11 return
executed 60844 times by 2 tests: return (((unsigned int)(p[0] & 0xff)) | ((unsigned int)(p[1] & 0xff) << 8) | ((unsigned int)(p[2] & 0xff) << 16) | ((unsigned int)(p[3] & 0xff) << 24));
Executed by:
  • libcrypto.so.1.1
  • poly1305_internal_test
(((unsigned int)(p[0] & 0xff)) |
executed 60844 times by 2 tests: return (((unsigned int)(p[0] & 0xff)) | ((unsigned int)(p[1] & 0xff) << 8) | ((unsigned int)(p[2] & 0xff) << 16) | ((unsigned int)(p[3] & 0xff) << 24));
Executed by:
  • libcrypto.so.1.1
  • poly1305_internal_test
60844
12 ((unsigned int)(p[1] & 0xff) << 8) |
executed 60844 times by 2 tests: return (((unsigned int)(p[0] & 0xff)) | ((unsigned int)(p[1] & 0xff) << 8) | ((unsigned int)(p[2] & 0xff) << 16) | ((unsigned int)(p[3] & 0xff) << 24));
Executed by:
  • libcrypto.so.1.1
  • poly1305_internal_test
60844
13 ((unsigned int)(p[2] & 0xff) << 16) |
executed 60844 times by 2 tests: return (((unsigned int)(p[0] & 0xff)) | ((unsigned int)(p[1] & 0xff) << 8) | ((unsigned int)(p[2] & 0xff) << 16) | ((unsigned int)(p[3] & 0xff) << 24));
Executed by:
  • libcrypto.so.1.1
  • poly1305_internal_test
60844
14 ((unsigned int)(p[3] & 0xff) << 24));
executed 60844 times by 2 tests: return (((unsigned int)(p[0] & 0xff)) | ((unsigned int)(p[1] & 0xff) << 8) | ((unsigned int)(p[2] & 0xff) << 16) | ((unsigned int)(p[3] & 0xff) << 24));
Executed by:
  • libcrypto.so.1.1
  • poly1305_internal_test
60844
15}-
16int poly1305_init(void *ctx, const unsigned char key[16], void *func);-
17void poly1305_blocks(void *ctx, const unsigned char *inp, size_t len,-
18 unsigned int padbit);-
19void poly1305_emit(void *ctx, unsigned char mac[16],-
20 const unsigned int nonce[4]);-
21-
22-
23void Poly1305_Init(POLY1305 *ctx, const unsigned char key[32])-
24{-
25 ctx->nonce[0] = U8TOU32(&key[16]);-
26 ctx->nonce[1] = U8TOU32(&key[20]);-
27 ctx->nonce[2] = U8TOU32(&key[24]);-
28 ctx->nonce[3] = U8TOU32(&key[28]);-
29 if (!poly1305_init(ctx->opaque, key, &ctx->func)
!poly1305_init...y, &ctx->func)Description
TRUEnever evaluated
FALSEevaluated 15211 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • poly1305_internal_test
) {
0-15211
30 ctx->func.blocks = poly1305_blocks;-
31 ctx->func.emit = poly1305_emit;-
32 }
never executed: end of block
0
33-
34-
35 ctx->num = 0;-
36-
37}
executed 15211 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • poly1305_internal_test
15211
38void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)-
39{-
40-
41-
42-
43-
44-
45-
46-
47 poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks;-
48-
49 size_t rem, num;-
50-
51 if ((
(num = ctx->num)Description
TRUEevaluated 24990 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • poly1305_internal_test
FALSEevaluated 43508 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • poly1305_internal_test
num = ctx->num)
(num = ctx->num)Description
TRUEevaluated 24990 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • poly1305_internal_test
FALSEevaluated 43508 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • poly1305_internal_test
) {
24990-43508
52 rem = 16 - num;-
53 if (len >= rem
len >= remDescription
TRUEevaluated 24846 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • poly1305_internal_test
FALSEevaluated 144 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
144-24846
54 memcpy(ctx->data + num, inp, rem);-
55 (*poly1305_blocks_p)(ctx->opaque, ctx->data, 16, 1);-
56 inp += rem;-
57 len -= rem;-
58 }
executed 24846 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • poly1305_internal_test
else {
24846
59-
60 memcpy(ctx->data + num, inp, len);-
61 ctx->num = num + len;-
62 return;
executed 144 times by 1 test: return;
Executed by:
  • libcrypto.so.1.1
144
63 }-
64 }-
65-
66 rem = len % 16;-
67 len -= rem;-
68-
69 if (len >= 16
len >= 16Description
TRUEevaluated 34363 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • poly1305_internal_test
FALSEevaluated 33991 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • poly1305_internal_test
) {
33991-34363
70 (*poly1305_blocks_p)(ctx->opaque, inp, len, 1);-
71 inp += len;-
72 }
executed 34363 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • poly1305_internal_test
34363
73-
74 if (rem
remDescription
TRUEevaluated 24965 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • poly1305_internal_test
FALSEevaluated 43389 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • poly1305_internal_test
)
24965-43389
75 memcpy(ctx->data, inp, rem);
executed 24965 times by 2 tests: memcpy(ctx->data, inp, rem);
Executed by:
  • libcrypto.so.1.1
  • poly1305_internal_test
24965
76-
77 ctx->num = rem;-
78}
executed 68354 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • poly1305_internal_test
68354
79-
80void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16])-
81{-
82-
83 poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks;-
84 poly1305_emit_f poly1305_emit_p = ctx->func.emit;-
85-
86 size_t num;-
87-
88 if ((
(num = ctx->num)Description
TRUEevaluated 119 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • poly1305_internal_test
FALSEevaluated 15092 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • poly1305_internal_test
num = ctx->num)
(num = ctx->num)Description
TRUEevaluated 119 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • poly1305_internal_test
FALSEevaluated 15092 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • poly1305_internal_test
) {
119-15092
89 ctx->data[num++] = 1;-
90 while (num < 16
num < 16Description
TRUEevaluated 780 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • poly1305_internal_test
FALSEevaluated 119 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • poly1305_internal_test
)
119-780
91 ctx->data[num++] = 0;
executed 780 times by 2 tests: ctx->data[num++] = 0;
Executed by:
  • libcrypto.so.1.1
  • poly1305_internal_test
780
92 (*poly1305_blocks_p)(ctx->opaque, ctx->data, 16, 0);-
93 }
executed 119 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • poly1305_internal_test
119
94-
95 (*poly1305_emit_p)(ctx->opaque, mac, ctx->nonce);-
96-
97-
98 OPENSSL_cleanse(ctx, sizeof(*ctx));-
99}
executed 15211 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • poly1305_internal_test
15211
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2