| Line | Source | Count |
| 1 | int tls13_enc(SSL *s, SSL3_RECORD *recs, size_t n_recs, int sending) | - |
| 2 | { | - |
| 3 | EVP_CIPHER_CTX *ctx; | - |
| 4 | unsigned char iv[16], recheader[5]; | - |
| 5 | size_t ivlen, taglen, offset, loop, hdrlen; | - |
| 6 | unsigned char *staticiv; | - |
| 7 | unsigned char *seq; | - |
| 8 | int lenu, lenf; | - |
| 9 | SSL3_RECORD *rec = &recs[0]; | - |
| 10 | uint32_t alg_enc; | - |
| 11 | WPACKET wpkt; | - |
| 12 | | - |
| 13 | if (n_recs != 1| TRUE | never evaluated | | FALSE | evaluated 36974 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
) { | 0-36974 |
| 14 | | - |
| 15 | | - |
| 16 | ossl_statem_fatal((s), (80), (609), ((4|64)), | - |
| 17 | __FILE__ | - |
| 18 | , | - |
| 19 | 41 | - |
| 20 | ) | - |
| 21 | ; | - |
| 22 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 23 | } | - |
| 24 | | - |
| 25 | if (sending| TRUE | evaluated 15084 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
| | FALSE | evaluated 21890 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
) { | 15084-21890 |
| 26 | ctx = s->enc_write_ctx; | - |
| 27 | staticiv = s->write_iv; | - |
| 28 | seq = ((&s->rlayer)->write_sequence); | - |
| 29 | }executed 15084 times by 2 tests: end of blockExecuted by:- libssl.so.1.1
- tls13encryptiontest
else { | 15084 |
| 30 | ctx = s->enc_read_ctx; | - |
| 31 | staticiv = s->read_iv; | - |
| 32 | seq = ((&s->rlayer)->read_sequence); | - |
| 33 | }executed 21890 times by 2 tests: end of blockExecuted by:- libssl.so.1.1
- tls13encryptiontest
| 21890 |
| 34 | | - |
| 35 | | - |
| 36 | | - |
| 37 | | - |
| 38 | | - |
| 39 | | - |
| 40 | | - |
| 41 | if (ctx == | TRUE | evaluated 3185 times by 1 test | | FALSE | evaluated 33789 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 3185-33789 |
| 42 | ((void *)0)| TRUE | evaluated 3185 times by 1 test | | FALSE | evaluated 33789 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 3185-33789 |
| 43 | || rec->type == 21| TRUE | evaluated 23 times by 1 test | | FALSE | evaluated 33766 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
) { | 23-33766 |
| 44 | memmove(rec->data, rec->input, rec->length); | - |
| 45 | rec->input = rec->data; | - |
| 46 | returnexecuted 3208 times by 1 test: return 1; 1;executed 3208 times by 1 test: return 1; | 3208 |
| 47 | } | - |
| 48 | | - |
| 49 | ivlen = EVP_CIPHER_CTX_iv_length(ctx); | - |
| 50 | | - |
| 51 | if (s->early_data_state == SSL_EARLY_DATA_WRITING| TRUE | evaluated 49 times by 1 test | | FALSE | evaluated 33717 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 49-33717 |
| 52 | || s->early_data_state == SSL_EARLY_DATA_WRITE_RETRY| TRUE | evaluated 12 times by 1 test | | FALSE | evaluated 33705 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
) { | 12-33705 |
| 53 | if (s->session != | TRUE | evaluated 61 times by 1 test | | FALSE | never evaluated |
| 0-61 |
| 54 | ((void *)0)| TRUE | evaluated 61 times by 1 test | | FALSE | never evaluated |
| 0-61 |
| 55 | && s->session->ext.max_early_data > 0| TRUE | evaluated 50 times by 1 test | | FALSE | evaluated 11 times by 1 test |
) { | 11-50 |
| 56 | alg_enc = s->session->cipher->algorithm_enc; | - |
| 57 | }executed 50 times by 1 test: end of block else { | 50 |
| 58 | if (!((s->psksession != | TRUE | evaluated 11 times by 1 test | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | evaluated 11 times by 1 test |
| 0-11 |
| 59 | ((void *)0)| TRUE | evaluated 11 times by 1 test | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | evaluated 11 times by 1 test |
| 0-11 |
| 60 | && s->psksession->ext.max_early_data > 0| TRUE | evaluated 11 times by 1 test | | FALSE | never evaluated |
) != 0)| TRUE | never evaluated | | FALSE | evaluated 11 times by 1 test |
| 0-11 |
| 61 | ) { | - |
| 62 | ossl_statem_fatal((s), (80), (609), ((4|64)), | - |
| 63 | __FILE__ | - |
| 64 | , | - |
| 65 | 77 | - |
| 66 | ) | - |
| 67 | ; | - |
| 68 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 69 | } | - |
| 70 | alg_enc = s->psksession->cipher->algorithm_enc; | - |
| 71 | }executed 11 times by 1 test: end of block | 11 |
| 72 | } else { | - |
| 73 | | - |
| 74 | | - |
| 75 | | - |
| 76 | | - |
| 77 | if (!((s->s3->tmp.new_cipher != | TRUE | never evaluated | | FALSE | evaluated 33705 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33705 |
| 78 | ((void *)0)| TRUE | never evaluated | | FALSE | evaluated 33705 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33705 |
| 79 | ) != 0)| TRUE | never evaluated | | FALSE | evaluated 33705 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
) { | 0-33705 |
| 80 | ossl_statem_fatal((s), (80), (609), ((4|64)), | - |
| 81 | __FILE__ | - |
| 82 | , | - |
| 83 | 89 | - |
| 84 | ) | - |
| 85 | ; | - |
| 86 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 87 | } | - |
| 88 | alg_enc = s->s3->tmp.new_cipher->algorithm_enc; | - |
| 89 | }executed 33705 times by 2 tests: end of blockExecuted by:- libssl.so.1.1
- tls13encryptiontest
| 33705 |
| 90 | | - |
| 91 | if (alg_enc & (0x00004000U | 0x00008000U | 0x00010000U | 0x00020000U)| TRUE | evaluated 42 times by 1 test | | FALSE | evaluated 33724 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
) { | 42-33724 |
| 92 | if (alg_enc & (0x00010000U | 0x00020000U)| TRUE | never evaluated | | FALSE | evaluated 42 times by 1 test |
) | 0-42 |
| 93 | taglen = 8; never executed: taglen = 8; | 0 |
| 94 | else | - |
| 95 | taglen = 16;executed 42 times by 1 test: taglen = 16; | 42 |
| 96 | if (sending| TRUE | evaluated 21 times by 1 test | | FALSE | evaluated 21 times by 1 test |
&& EVP_CIPHER_CTX_ctrl(ctx, 0x11, taglen,| TRUE | never evaluated | | FALSE | evaluated 21 times by 1 test |
| 0-21 |
| 97 | | TRUE | never evaluated | | FALSE | evaluated 21 times by 1 test |
| 0-21 |
| 98 | ((void *)0)| TRUE | never evaluated | | FALSE | evaluated 21 times by 1 test |
| 0-21 |
| 99 | ) <= 0| TRUE | never evaluated | | FALSE | evaluated 21 times by 1 test |
) { | 0-21 |
| 100 | ossl_statem_fatal((s), (80), (609), ((4|64)), | - |
| 101 | __FILE__ | - |
| 102 | , | - |
| 103 | 103 | - |
| 104 | ) | - |
| 105 | ; | - |
| 106 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 107 | } | - |
| 108 | }executed 42 times by 1 test: end of block else if (alg_enc & (0x00001000U | 0x00002000U)| TRUE | evaluated 25243 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
| | FALSE | evaluated 8481 times by 1 test |
) { | 42-25243 |
| 109 | taglen = 16; | - |
| 110 | }executed 25243 times by 2 tests: end of blockExecuted by:- libssl.so.1.1
- tls13encryptiontest
else if (alg_enc & (0x00080000U)| TRUE | evaluated 8481 times by 1 test | | FALSE | never evaluated |
) { | 0-25243 |
| 111 | taglen = 16; | - |
| 112 | }executed 8481 times by 1 test: end of block else { | 8481 |
| 113 | ossl_statem_fatal((s), (80), (609), ((4|64)), | - |
| 114 | __FILE__ | - |
| 115 | , | - |
| 116 | 112 | - |
| 117 | ) | - |
| 118 | ; | - |
| 119 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 120 | } | - |
| 121 | | - |
| 122 | if (!sending| TRUE | evaluated 21366 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
| | FALSE | evaluated 12400 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
) { | 12400-21366 |
| 123 | | - |
| 124 | | - |
| 125 | | - |
| 126 | | - |
| 127 | if (rec->length < taglen + 1| TRUE | evaluated 7 times by 1 test | | FALSE | evaluated 21359 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
) | 7-21359 |
| 128 | returnexecuted 7 times by 1 test: return 0; 0;executed 7 times by 1 test: return 0; | 7 |
| 129 | rec->length -= taglen; | - |
| 130 | }executed 21359 times by 2 tests: end of blockExecuted by:- libssl.so.1.1
- tls13encryptiontest
| 21359 |
| 131 | | - |
| 132 | | - |
| 133 | if (ivlen < 8| TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
) { | 0-33759 |
| 134 | | - |
| 135 | ossl_statem_fatal((s), (80), (609), ((4|64)), | - |
| 136 | __FILE__ | - |
| 137 | , | - |
| 138 | 130 | - |
| 139 | ) | - |
| 140 | ; | - |
| 141 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 142 | } | - |
| 143 | offset = ivlen - 8; | - |
| 144 | memcpy(iv, staticiv, offset); | - |
| 145 | for (loop = 0; loop < 8| TRUE | evaluated 270072 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
| | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
; loop++) | 33759-270072 |
| 146 | iv[offset + loop] = staticiv[offset + loop] ^ seq[loop];executed 270072 times by 2 tests: iv[offset + loop] = staticiv[offset + loop] ^ seq[loop];Executed by:- libssl.so.1.1
- tls13encryptiontest
| 270072 |
| 147 | | - |
| 148 | | - |
| 149 | for (loop = 8; loop > 0| TRUE | evaluated 33795 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
| | FALSE | never evaluated |
; loop--) { | 0-33795 |
| 150 | ++seq[loop - 1]; | - |
| 151 | if (seq[loop - 1] != 0| TRUE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
| | FALSE | evaluated 36 times by 1 test |
) | 36-33759 |
| 152 | break;executed 33759 times by 2 tests: break;Executed by:- libssl.so.1.1
- tls13encryptiontest
| 33759 |
| 153 | }executed 36 times by 1 test: end of block | 36 |
| 154 | if (loop == 0| TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
) { | 0-33759 |
| 155 | | - |
| 156 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 157 | } | - |
| 158 | | - |
| 159 | | - |
| 160 | if (EVP_CipherInit_ex(ctx, | TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33759 |
| 161 | ((void *)0)| TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33759 |
| 162 | , | TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33759 |
| 163 | ((void *)0)| TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33759 |
| 164 | , | TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33759 |
| 165 | ((void *)0)| TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33759 |
| 166 | , iv, sending) <= 0| TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33759 |
| 167 | || (!sending| TRUE | evaluated 21359 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
| | FALSE | evaluated 12400 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
&& EVP_CIPHER_CTX_ctrl(ctx, 0x11,| TRUE | never evaluated | | FALSE | evaluated 21359 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-21359 |
| 168 | taglen,| TRUE | never evaluated | | FALSE | evaluated 21359 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-21359 |
| 169 | rec->data + rec->length) <= 0| TRUE | never evaluated | | FALSE | evaluated 21359 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
)) { | 0-21359 |
| 170 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 171 | } | - |
| 172 | | - |
| 173 | | - |
| 174 | if (!WPACKET_init_static_len(&wpkt, recheader, sizeof(recheader), 0)| TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33759 |
| 175 | || !WPACKET_put_bytes__((&wpkt), (rec->type), 1)| TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33759 |
| 176 | || !WPACKET_put_bytes__((&wpkt), (rec->rec_version), 2)| TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33759 |
| 177 | || !WPACKET_put_bytes__((&wpkt), (rec->length + taglen), 2)| TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33759 |
| 178 | || !WPACKET_get_total_written(&wpkt, &hdrlen)| TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33759 |
| 179 | || hdrlen != 5| TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33759 |
| 180 | || !WPACKET_finish(&wpkt)| TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
) { | 0-33759 |
| 181 | WPACKET_cleanup(&wpkt); | - |
| 182 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 183 | } | - |
| 184 | | - |
| 185 | | - |
| 186 | | - |
| 187 | | - |
| 188 | | - |
| 189 | if (((| TRUE | evaluated 42 times by 1 test | | FALSE | evaluated 33717 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
alg_enc & (0x00004000U | 0x00008000U | 0x00010000U | 0x00020000U)) != 0| TRUE | evaluated 42 times by 1 test | | FALSE | evaluated 33717 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 42-33717 |
| 190 | && EVP_CipherUpdate(ctx, | TRUE | never evaluated | | FALSE | evaluated 42 times by 1 test |
| 0-42 |
| 191 | ((void *)0)| TRUE | never evaluated | | FALSE | evaluated 42 times by 1 test |
| 0-42 |
| 192 | , &lenu, | TRUE | never evaluated | | FALSE | evaluated 42 times by 1 test |
| 0-42 |
| 193 | ((void *)0)| TRUE | never evaluated | | FALSE | evaluated 42 times by 1 test |
| 0-42 |
| 194 | ,| TRUE | never evaluated | | FALSE | evaluated 42 times by 1 test |
| 0-42 |
| 195 | (unsigned int)rec->length) <= 0| TRUE | never evaluated | | FALSE | evaluated 42 times by 1 test |
) | 0-42 |
| 196 | || EVP_CipherUpdate(ctx, | TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33759 |
| 197 | ((void *)0)| TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33759 |
| 198 | , &lenu, recheader,| TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33759 |
| 199 | sizeof(recheader)) <= 0| TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33759 |
| 200 | || EVP_CipherUpdate(ctx, rec->data, &lenu, rec->input,| TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33759 |
| 201 | (unsigned int)rec->length) <= 0| TRUE | never evaluated | | FALSE | evaluated 33759 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-33759 |
| 202 | || EVP_CipherFinal_ex(ctx, rec->data + lenu, &lenf) <= 0| TRUE | evaluated 10596 times by 1 test | | FALSE | evaluated 23163 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 10596-23163 |
| 203 | || (| TRUE | never evaluated | | FALSE | evaluated 23163 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
size_t)(lenu + lenf) != rec->length| TRUE | never evaluated | | FALSE | evaluated 23163 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
) { | 0-23163 |
| 204 | returnexecuted 10596 times by 1 test: return -1; -1;executed 10596 times by 1 test: return -1; | 10596 |
| 205 | } | - |
| 206 | if (sending| TRUE | evaluated 12400 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
| | FALSE | evaluated 10763 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
) { | 10763-12400 |
| 207 | | - |
| 208 | if (EVP_CIPHER_CTX_ctrl(ctx, 0x10, taglen,| TRUE | never evaluated | | FALSE | evaluated 12400 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
| 0-12400 |
| 209 | rec->data + rec->length) <= 0| TRUE | never evaluated | | FALSE | evaluated 12400 times by 2 testsEvaluated by:- libssl.so.1.1
- tls13encryptiontest
|
) { | 0-12400 |
| 210 | ossl_statem_fatal((s), (80), (609), ((4|64)), | - |
| 211 | __FILE__ | - |
| 212 | , | - |
| 213 | 189 | - |
| 214 | ) | - |
| 215 | ; | - |
| 216 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 217 | } | - |
| 218 | rec->length += taglen; | - |
| 219 | }executed 12400 times by 2 tests: end of blockExecuted by:- libssl.so.1.1
- tls13encryptiontest
| 12400 |
| 220 | | - |
| 221 | returnexecuted 23163 times by 2 tests: return 1;Executed by:- libssl.so.1.1
- tls13encryptiontest
1;executed 23163 times by 2 tests: return 1;Executed by:- libssl.so.1.1
- tls13encryptiontest
| 23163 |
| 222 | } | - |
| | |