| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/ssl/d1_enc.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | int | - | ||||||||||||||||||
| 6 | dtls1_enc(SSL *s, int send) | - | ||||||||||||||||||
| 7 | { | - | ||||||||||||||||||
| 8 | SSL3_RECORD *rec; | - | ||||||||||||||||||
| 9 | EVP_CIPHER_CTX *ds; | - | ||||||||||||||||||
| 10 | unsigned long l; | - | ||||||||||||||||||
| 11 | int bs, i, j, k, mac_size = 0; | - | ||||||||||||||||||
| 12 | const EVP_CIPHER *enc; | - | ||||||||||||||||||
| 13 | - | |||||||||||||||||||
| 14 | if (send
| 153-176 | ||||||||||||||||||
| 15 | if (EVP_MD_CTX_md(s->internal->write_hash)
| 66-110 | ||||||||||||||||||
| 16 | mac_size = EVP_MD_size(EVP_MD_CTX_md(s->internal->write_hash)); | - | ||||||||||||||||||
| 17 | if (mac_size < 0
| 0-66 | ||||||||||||||||||
| 18 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 19 | } executed 66 times by 1 test: end of blockExecuted by:
| 66 | ||||||||||||||||||
| 20 | ds = s->internal->enc_write_ctx; | - | ||||||||||||||||||
| 21 | rec = &((s->s3->internal)->wrec); | - | ||||||||||||||||||
| 22 | if (s->internal->enc_write_ctx ==
| 66-110 | ||||||||||||||||||
| 23 | ((void *)0)
| 66-110 | ||||||||||||||||||
| 24 | ) | - | ||||||||||||||||||
| 25 | enc = executed 110 times by 2 tests: enc = ((void *)0) ;Executed by:
| 110 | ||||||||||||||||||
| 26 | ((void *)0) executed 110 times by 2 tests: enc = ((void *)0) ;Executed by:
| 110 | ||||||||||||||||||
| 27 | ; executed 110 times by 2 tests: enc = ((void *)0) ;Executed by:
| 110 | ||||||||||||||||||
| 28 | else { | - | ||||||||||||||||||
| 29 | enc = EVP_CIPHER_CTX_cipher(s->internal->enc_write_ctx); | - | ||||||||||||||||||
| 30 | if (rec->data != rec->input
| 0-66 | ||||||||||||||||||
| 31 | - | |||||||||||||||||||
| 32 | - | |||||||||||||||||||
| 33 | - | |||||||||||||||||||
| 34 | - | |||||||||||||||||||
| 35 | - | |||||||||||||||||||
| 36 | } never executed: else if (EVP_CIPHER_block_size(ds->cipher) > 1end of block
| 0-54 | ||||||||||||||||||
| 37 | arc4random_buf(rec->input, | - | ||||||||||||||||||
| 38 | EVP_CIPHER_block_size(ds->cipher)); | - | ||||||||||||||||||
| 39 | } executed 54 times by 1 test: end of blockExecuted by:
| 54 | ||||||||||||||||||
| 40 | } executed 66 times by 1 test: end of blockExecuted by:
| 66 | ||||||||||||||||||
| 41 | } else { | - | ||||||||||||||||||
| 42 | if (EVP_MD_CTX_md(s->read_hash)
| 44-109 | ||||||||||||||||||
| 43 | mac_size = EVP_MD_size(EVP_MD_CTX_md(s->read_hash)); | - | ||||||||||||||||||
| 44 | (void)((mac_size >= 0) ? 0 : (OpenSSLDie(__FILE__, 167, "mac_size >= 0"),1)); | - | ||||||||||||||||||
| 45 | } executed 44 times by 1 test: end of blockExecuted by:
| 44 | ||||||||||||||||||
| 46 | ds = s->enc_read_ctx; | - | ||||||||||||||||||
| 47 | rec = &((s->s3->internal)->rrec); | - | ||||||||||||||||||
| 48 | if (s->enc_read_ctx ==
| 44-109 | ||||||||||||||||||
| 49 | ((void *)0)
| 44-109 | ||||||||||||||||||
| 50 | ) | - | ||||||||||||||||||
| 51 | enc = executed 109 times by 1 test: enc = ((void *)0) ;Executed by:
| 109 | ||||||||||||||||||
| 52 | ((void *)0) executed 109 times by 1 test: enc = ((void *)0) ;Executed by:
| 109 | ||||||||||||||||||
| 53 | ; executed 109 times by 1 test: enc = ((void *)0) ;Executed by:
| 109 | ||||||||||||||||||
| 54 | else | - | ||||||||||||||||||
| 55 | enc = EVP_CIPHER_CTX_cipher(s->enc_read_ctx); executed 44 times by 1 test: enc = EVP_CIPHER_CTX_cipher(s->enc_read_ctx);Executed by:
| 44 | ||||||||||||||||||
| 56 | } | - | ||||||||||||||||||
| 57 | - | |||||||||||||||||||
| 58 | - | |||||||||||||||||||
| 59 | if ((
| 11-318 | ||||||||||||||||||
| 60 | ((void *)0)
| 11-318 | ||||||||||||||||||
| 61 | )
| 11-318 | ||||||||||||||||||
| 62 | ((void *)0)
| 110-208 | ||||||||||||||||||
| 63 | )
| 0-208 | ||||||||||||||||||
| 64 | ((void *)0)
| 0-110 | ||||||||||||||||||
| 65 | )
| 0-110 | ||||||||||||||||||
| 66 | memmove(rec->data, rec->input, rec->length); | - | ||||||||||||||||||
| 67 | rec->input = rec->data; | - | ||||||||||||||||||
| 68 | } executed 219 times by 2 tests: else {end of blockExecuted by:
| 219 | ||||||||||||||||||
| 69 | l = rec->length; | - | ||||||||||||||||||
| 70 | bs = EVP_CIPHER_block_size(ds->cipher); | - | ||||||||||||||||||
| 71 | - | |||||||||||||||||||
| 72 | if ((
| 20-90 | ||||||||||||||||||
| 73 | i = bs - ((int)l % bs); | - | ||||||||||||||||||
| 74 | - | |||||||||||||||||||
| 75 | - | |||||||||||||||||||
| 76 | - | |||||||||||||||||||
| 77 | - | |||||||||||||||||||
| 78 | j = i - 1; | - | ||||||||||||||||||
| 79 | for (k = (int)l; k < (int)(l + i)
| 54-436 | ||||||||||||||||||
| 80 | rec->input[k] = j; executed 436 times by 1 test: rec->input[k] = j;Executed by:
| 436 | ||||||||||||||||||
| 81 | l += i; | - | ||||||||||||||||||
| 82 | rec->length += i; | - | ||||||||||||||||||
| 83 | } executed 54 times by 1 test: end of blockExecuted by:
| 54 | ||||||||||||||||||
| 84 | - | |||||||||||||||||||
| 85 | - | |||||||||||||||||||
| 86 | if (!send
| 44-66 | ||||||||||||||||||
| 87 | if (l == 0
| 0-44 | ||||||||||||||||||
| 88 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 89 | } executed 44 times by 1 test: end of blockExecuted by:
| 44 | ||||||||||||||||||
| 90 | - | |||||||||||||||||||
| 91 | EVP_Cipher(ds, rec->data, rec->input, l); | - | ||||||||||||||||||
| 92 | - | |||||||||||||||||||
| 93 | - | |||||||||||||||||||
| 94 | if ((
| 20-90 | ||||||||||||||||||
| 95 | return executed 36 times by 1 test: tls1_cbc_remove_padding(s, rec, bs, mac_size);return tls1_cbc_remove_padding(s, rec, bs, mac_size);Executed by:
executed 36 times by 1 test: return tls1_cbc_remove_padding(s, rec, bs, mac_size);Executed by:
| 36 | ||||||||||||||||||
| 96 | } executed 74 times by 1 test: end of blockExecuted by:
| 74 | ||||||||||||||||||
| 97 | return executed 293 times by 2 tests: (1);return (1);Executed by:
executed 293 times by 2 tests: return (1);Executed by:
| 293 | ||||||||||||||||||
| 98 | } | - | ||||||||||||||||||
| Switch to Source code | Preprocessed file |