LCOV - code coverage report
Current view: top level - crypto - s2n_composite_cipher_aes_sha.c (source / functions) Hit Total Coverage
Test: unit_test_coverage.info Lines: 126 126 100.0 %
Date: 2026-08-22 07:27:53 Functions: 23 23 100.0 %
Branches: 42 140 30.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
       3                 :            :  *
       4                 :            :  * Licensed under the Apache License, Version 2.0 (the "License").
       5                 :            :  * You may not use this file except in compliance with the License.
       6                 :            :  * A copy of the License is located at
       7                 :            :  *
       8                 :            :  *  http://aws.amazon.com/apache2.0
       9                 :            :  *
      10                 :            :  * or in the "license" file accompanying this file. This file is distributed
      11                 :            :  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
      12                 :            :  * express or implied. See the License for the specific language governing
      13                 :            :  * permissions and limitations under the License.
      14                 :            :  */
      15                 :            : 
      16                 :            : #include <openssl/aes.h>
      17                 :            : #include <openssl/evp.h>
      18                 :            : #include <openssl/sha.h>
      19                 :            : 
      20                 :            : #include "crypto/s2n_cipher.h"
      21                 :            : #include "crypto/s2n_fips.h"
      22                 :            : #include "crypto/s2n_openssl.h"
      23                 :            : #include "tls/s2n_crypto.h"
      24                 :            : #include "utils/s2n_blob.h"
      25                 :            : #include "utils/s2n_safety.h"
      26                 :            : 
      27                 :            : /* LibreSSL and BoringSSL support the cipher, but the interface is different from Openssl's. We
      28                 :            :  * should define a separate s2n_cipher struct for LibreSSL and BoringSSL.
      29                 :            :  */
      30                 :            : #if !defined(LIBRESSL_VERSION_NUMBER) && !defined(OPENSSL_IS_BORINGSSL)
      31                 :            :     /* Symbols for AES-SHA1-CBC composite ciphers were added in Openssl 1.0.1
      32                 :            :      * These composite ciphers exhibit erratic behavior in LibreSSL releases.
      33                 :            :      */
      34                 :            :     #if S2N_OPENSSL_VERSION_AT_LEAST(1, 0, 1)
      35                 :            :         #define S2N_AES_SHA1_COMPOSITE_AVAILABLE
      36                 :            :     #endif
      37                 :            :     #if defined(AWSLC_API_VERSION) && (AWSLC_API_VERSION <= 17)
      38                 :            :         #undef S2N_AES_SHA1_COMPOSITE_AVAILABLE
      39                 :            :     #endif
      40                 :            :     /* Symbols for AES-SHA256-CBC composite ciphers were added in Openssl 1.0.2
      41                 :            :      * See https://www.openssl.org/news/cl102.txt
      42                 :            :      * These composite ciphers exhibit erratic behavior in LibreSSL releases.
      43                 :            :      */
      44                 :            :     #if S2N_OPENSSL_VERSION_AT_LEAST(1, 0, 2)
      45                 :            :         #define S2N_AES_SHA256_COMPOSITE_AVAILABLE
      46                 :            :     #endif
      47                 :            :     #if defined(AWSLC_API_VERSION) && (AWSLC_API_VERSION <= 17)
      48                 :            :         #undef S2N_AES_SHA256_COMPOSITE_AVAILABLE
      49                 :            :     #endif
      50                 :            : #endif
      51                 :            : 
      52                 :            : /* Silly accessors, but we avoid using version macro guards in multiple places */
      53                 :            : static const EVP_CIPHER *s2n_evp_aes_128_cbc_hmac_sha1(void)
      54                 :      50652 : {
      55                 :      50652 : #if defined(S2N_AES_SHA1_COMPOSITE_AVAILABLE)
      56                 :      50652 :     return EVP_aes_128_cbc_hmac_sha1();
      57                 :            : #else
      58                 :            :     return NULL;
      59                 :            : #endif
      60                 :      50652 : }
      61                 :            : 
      62                 :            : static const EVP_CIPHER *s2n_evp_aes_256_cbc_hmac_sha1(void)
      63                 :      50383 : {
      64                 :      50383 : #if defined(S2N_AES_SHA1_COMPOSITE_AVAILABLE)
      65                 :      50383 :     return EVP_aes_256_cbc_hmac_sha1();
      66                 :            : #else
      67                 :            :     return NULL;
      68                 :            : #endif
      69                 :      50383 : }
      70                 :            : 
      71                 :            : static const EVP_CIPHER *s2n_evp_aes_128_cbc_hmac_sha256(void)
      72                 :      50232 : {
      73                 :      50232 : #if defined(S2N_AES_SHA256_COMPOSITE_AVAILABLE)
      74                 :      50232 :     return EVP_aes_128_cbc_hmac_sha256();
      75                 :            : #else
      76                 :            :     return NULL;
      77                 :            : #endif
      78                 :      50232 : }
      79                 :            : 
      80                 :            : static const EVP_CIPHER *s2n_evp_aes_256_cbc_hmac_sha256(void)
      81                 :      49297 : {
      82                 :      49297 : #if defined(S2N_AES_SHA256_COMPOSITE_AVAILABLE)
      83                 :      49297 :     return EVP_aes_256_cbc_hmac_sha256();
      84                 :            : #else
      85                 :            :     return NULL;
      86                 :            : #endif
      87                 :      49297 : }
      88                 :            : 
      89                 :            : static bool s2n_composite_cipher_aes128_sha_available(void)
      90                 :       1398 : {
      91                 :            :     /* EVP_aes_128_cbc_hmac_sha1() returns NULL if the implementations aren't available.
      92                 :            :      * See https://github.com/openssl/openssl/blob/master/crypto/evp/e_aes_cbc_hmac_sha1.c#L952
      93                 :            :      *
      94                 :            :      * Composite ciphers cannot be used when FIPS mode is set. Ciphers require the
      95                 :            :      * EVP_CIPH_FLAG_FIPS OpenSSL flag to be set for use when in FIPS mode, and composite
      96                 :            :      * ciphers cause OpenSSL errors due to the lack of the flag.
      97                 :            :      */
      98 [ +  - ][ +  - ]:       1398 :     return (!s2n_is_in_fips_mode() && s2n_evp_aes_128_cbc_hmac_sha1() ? true : false);
      99                 :       1398 : }
     100                 :            : 
     101                 :            : static bool s2n_composite_cipher_aes256_sha_available(void)
     102                 :       1397 : {
     103                 :            :     /* Composite ciphers cannot be used when FIPS mode is set. Ciphers require the
     104                 :            :      * EVP_CIPH_FLAG_FIPS OpenSSL flag to be set for use when in FIPS mode, and composite
     105                 :            :      * ciphers cause OpenSSL errors due to the lack of the flag.
     106                 :            :      */
     107 [ +  - ][ +  - ]:       1397 :     return (!s2n_is_in_fips_mode() && s2n_evp_aes_256_cbc_hmac_sha1() ? true : false);
     108                 :       1397 : }
     109                 :            : 
     110                 :            : static bool s2n_composite_cipher_aes128_sha256_available(void)
     111                 :       1398 : {
     112                 :            :     /* Composite ciphers cannot be used when FIPS mode is set. Ciphers require the
     113                 :            :      * EVP_CIPH_FLAG_FIPS OpenSSL flag to be set for use when in FIPS mode, and composite
     114                 :            :      * ciphers cause OpenSSL errors due to the lack of the flag.
     115                 :            :      */
     116 [ +  - ][ +  - ]:       1398 :     return (!s2n_is_in_fips_mode() && s2n_evp_aes_128_cbc_hmac_sha256() ? true : false);
     117                 :       1398 : }
     118                 :            : 
     119                 :            : static bool s2n_composite_cipher_aes256_sha256_available(void)
     120                 :        699 : {
     121                 :            :     /* Composite ciphers cannot be used when FIPS mode is set. Ciphers require the
     122                 :            :      * EVP_CIPH_FLAG_FIPS OpenSSL flag to be set for use when in FIPS mode, and composite
     123                 :            :      * ciphers cause OpenSSL errors due to the lack of the flag.
     124                 :            :      */
     125 [ +  - ][ +  - ]:        699 :     return (!s2n_is_in_fips_mode() && s2n_evp_aes_256_cbc_hmac_sha256() ? true : false);
     126                 :        699 : }
     127                 :            : 
     128                 :            : static int s2n_composite_cipher_aes_sha_initial_hmac(struct s2n_session_key *key, uint8_t *sequence_number, uint8_t content_type,
     129                 :            :         uint16_t protocol_version, uint16_t payload_and_eiv_len, int *extra)
     130                 :     271597 : {
     131                 :            :     /* BoringSSL and AWS-LC(AWSLC_API_VERSION <= 17) do not support these composite ciphers with the existing EVP API, and they took out the
     132                 :            :      * constants used below. This method should never be called with BoringSSL or AWS-LC(AWSLC_API_VERSION <= 17) because the isAvaliable checked
     133                 :            :      * will fail. Instead of defining a possibly dangerous default or hard coding this to 0x16 error out with BoringSSL and AWS-LC(AWSLC_API_VERSION <= 17).
     134                 :            :      */
     135                 :            : #if defined(OPENSSL_IS_BORINGSSL) || (defined(AWSLC_API_VERSION) && (AWSLC_API_VERSION <= 17))
     136                 :            :     POSIX_BAIL(S2N_ERR_UNIMPLEMENTED);
     137                 :            : #else
     138                 :     271597 :     uint8_t ctrl_buf[S2N_TLS12_AAD_LEN] = { 0 };
     139                 :     271597 :     struct s2n_blob ctrl_blob = { 0 };
     140         [ -  + ]:     271597 :     POSIX_GUARD(s2n_blob_init(&ctrl_blob, ctrl_buf, S2N_TLS12_AAD_LEN));
     141                 :     271597 :     struct s2n_stuffer ctrl_stuffer = { 0 };
     142         [ -  + ]:     271597 :     POSIX_GUARD(s2n_stuffer_init(&ctrl_stuffer, &ctrl_blob));
     143                 :            : 
     144         [ -  + ]:     271597 :     POSIX_GUARD(s2n_stuffer_write_bytes(&ctrl_stuffer, sequence_number, S2N_TLS_SEQUENCE_NUM_LEN));
     145         [ -  + ]:     271597 :     POSIX_GUARD(s2n_stuffer_write_uint8(&ctrl_stuffer, content_type));
     146         [ -  + ]:     271597 :     POSIX_GUARD(s2n_stuffer_write_uint16(&ctrl_stuffer, protocol_version));
     147         [ -  + ]:     271597 :     POSIX_GUARD(s2n_stuffer_write_uint16(&ctrl_stuffer, payload_and_eiv_len));
     148                 :            : 
     149                 :            :     /* This will unnecessarily mangle the input buffer, which is fine since it's temporary
     150                 :            :      * Return value will be length of digest, padding, and padding length byte.
     151                 :            :      * See https://github.com/openssl/openssl/blob/master/crypto/evp/e_aes_cbc_hmac_sha1.c#L814
     152                 :            :      * and https://github.com/openssl/openssl/blob/4f0c475719defd7c051964ef9964cc6e5b3a63bf/ssl/record/ssl3_record.c#L743
     153                 :            :      */
     154                 :     271597 :     int ctrl_ret = EVP_CIPHER_CTX_ctrl(key->evp_cipher_ctx, EVP_CTRL_AEAD_TLS1_AAD, S2N_TLS12_AAD_LEN, ctrl_buf);
     155                 :            : 
     156 [ -  + ][ #  # ]:     271597 :     S2N_ERROR_IF(ctrl_ret <= 0, S2N_ERR_INITIAL_HMAC);
     157                 :            : 
     158                 :     271597 :     *extra = ctrl_ret;
     159                 :     271597 :     return 0;
     160                 :     271597 : #endif
     161                 :     271597 : }
     162                 :            : 
     163                 :            : static int s2n_composite_cipher_aes_sha_encrypt(struct s2n_session_key *key, struct s2n_blob *iv, struct s2n_blob *in, struct s2n_blob *out)
     164                 :     163985 : {
     165 [ #  # ][ -  + ]:     163985 :     POSIX_ENSURE_EQ(out->size, in->size);
     166                 :            : 
     167 [ -  + ][ #  # ]:     163985 :     POSIX_GUARD_OSSL(EVP_EncryptInit_ex(key->evp_cipher_ctx, NULL, NULL, NULL, iv->data), S2N_ERR_KEY_INIT);
     168                 :            : 
     169                 :            :     /* len is set by EVP_EncryptUpdate and checked post operation */
     170                 :     163985 :     int len = 0;
     171 [ -  + ][ #  # ]:     163985 :     POSIX_GUARD_OSSL(EVP_EncryptUpdate(key->evp_cipher_ctx, out->data, &len, in->data, in->size), S2N_ERR_ENCRYPT);
     172                 :            : 
     173 [ -  + ][ #  # ]:     163985 :     POSIX_ENSURE((int64_t) len == (int64_t) in->size, S2N_ERR_ENCRYPT);
     174                 :            : 
     175                 :     163985 :     return 0;
     176                 :     163985 : }
     177                 :            : 
     178                 :            : static int s2n_composite_cipher_aes_sha_decrypt(struct s2n_session_key *key, struct s2n_blob *iv, struct s2n_blob *in, struct s2n_blob *out)
     179                 :     107612 : {
     180 [ -  + ][ #  # ]:     107612 :     POSIX_ENSURE_EQ(out->size, in->size);
     181 [ -  + ][ #  # ]:     107612 :     POSIX_GUARD_OSSL(EVP_DecryptInit_ex(key->evp_cipher_ctx, NULL, NULL, NULL, iv->data), S2N_ERR_KEY_INIT);
     182                 :            : 
     183                 :     107612 :     int len = 0;
     184 [ #  # ][ -  + ]:     107612 :     POSIX_GUARD_OSSL(EVP_DecryptUpdate(key->evp_cipher_ctx, out->data, &len, in->data, in->size), S2N_ERR_DECRYPT);
     185 [ #  # ][ -  + ]:     107612 :     POSIX_ENSURE((int64_t) len == (int64_t) in->size, S2N_ERR_DECRYPT);
     186                 :            : 
     187                 :     107612 :     return 0;
     188                 :     107612 : }
     189                 :            : 
     190                 :            : static int s2n_composite_cipher_aes_sha_set_mac_write_key(struct s2n_session_key *key, uint8_t *mac_key, uint32_t mac_size)
     191                 :      98240 : {
     192 [ #  # ][ -  + ]:      98240 :     POSIX_ENSURE_EQ(mac_size, SHA_DIGEST_LENGTH);
     193                 :            : 
     194                 :      98240 :     EVP_CIPHER_CTX_ctrl(key->evp_cipher_ctx, EVP_CTRL_AEAD_SET_MAC_KEY, mac_size, mac_key);
     195                 :            : 
     196                 :      98240 :     return 0;
     197                 :      98240 : }
     198                 :            : 
     199                 :            : static int s2n_composite_cipher_aes_sha256_set_mac_write_key(struct s2n_session_key *key, uint8_t *mac_key, uint32_t mac_size)
     200                 :      97432 : {
     201 [ #  # ][ -  + ]:      97432 :     POSIX_ENSURE_EQ(mac_size, SHA256_DIGEST_LENGTH);
     202                 :            : 
     203                 :      97432 :     EVP_CIPHER_CTX_ctrl(key->evp_cipher_ctx, EVP_CTRL_AEAD_SET_MAC_KEY, mac_size, mac_key);
     204                 :            : 
     205                 :      97432 :     return 0;
     206                 :      97432 : }
     207                 :            : 
     208                 :            : static S2N_RESULT s2n_composite_cipher_aes128_sha_set_encryption_key(struct s2n_session_key *key, struct s2n_blob *in)
     209                 :      24627 : {
     210 [ #  # ][ -  + ]:      24627 :     RESULT_ENSURE_EQ(in->size, 16);
     211                 :            : 
     212 [ -  + ][ #  # ]:      24627 :     RESULT_GUARD_OSSL(EVP_EncryptInit_ex(key->evp_cipher_ctx, s2n_evp_aes_128_cbc_hmac_sha1(), NULL, in->data, NULL), S2N_ERR_KEY_INIT);
     213                 :            :     /* Padding must be disabled after key init to take effect. */
     214                 :      24627 :     EVP_CIPHER_CTX_set_padding(key->evp_cipher_ctx, 0);
     215                 :            : 
     216                 :      24627 :     return S2N_RESULT_OK;
     217                 :      24627 : }
     218                 :            : 
     219                 :            : static S2N_RESULT s2n_composite_cipher_aes128_sha_set_decryption_key(struct s2n_session_key *key, struct s2n_blob *in)
     220                 :      24627 : {
     221 [ -  + ][ #  # ]:      24627 :     RESULT_ENSURE_EQ(in->size, 16);
     222                 :            : 
     223 [ #  # ][ -  + ]:      24627 :     RESULT_GUARD_OSSL(EVP_DecryptInit_ex(key->evp_cipher_ctx, s2n_evp_aes_128_cbc_hmac_sha1(), NULL, in->data, NULL), S2N_ERR_KEY_INIT);
     224                 :            :     /* Padding must be disabled after key init to take effect. */
     225                 :      24627 :     EVP_CIPHER_CTX_set_padding(key->evp_cipher_ctx, 0);
     226                 :            : 
     227                 :      24627 :     return S2N_RESULT_OK;
     228                 :      24627 : }
     229                 :            : 
     230                 :            : static S2N_RESULT s2n_composite_cipher_aes256_sha_set_encryption_key(struct s2n_session_key *key, struct s2n_blob *in)
     231                 :      24493 : {
     232 [ -  + ][ #  # ]:      24493 :     RESULT_ENSURE_EQ(in->size, 32);
     233                 :            : 
     234 [ #  # ][ -  + ]:      24493 :     RESULT_GUARD_OSSL(EVP_EncryptInit_ex(key->evp_cipher_ctx, s2n_evp_aes_256_cbc_hmac_sha1(), NULL, in->data, NULL), S2N_ERR_KEY_INIT);
     235                 :            :     /* Padding must be disabled after key init to take effect. */
     236                 :      24493 :     EVP_CIPHER_CTX_set_padding(key->evp_cipher_ctx, 0);
     237                 :            : 
     238                 :      24493 :     return S2N_RESULT_OK;
     239                 :      24493 : }
     240                 :            : 
     241                 :            : static S2N_RESULT s2n_composite_cipher_aes256_sha_set_decryption_key(struct s2n_session_key *key, struct s2n_blob *in)
     242                 :      24493 : {
     243 [ -  + ][ #  # ]:      24493 :     RESULT_ENSURE_EQ(in->size, 32);
     244                 :            : 
     245 [ -  + ][ #  # ]:      24493 :     RESULT_GUARD_OSSL(EVP_DecryptInit_ex(key->evp_cipher_ctx, s2n_evp_aes_256_cbc_hmac_sha1(), NULL, in->data, NULL), S2N_ERR_KEY_INIT);
     246                 :            :     /* Padding must be disabled after key init to take effect. */
     247                 :      24493 :     EVP_CIPHER_CTX_set_padding(key->evp_cipher_ctx, 0);
     248                 :            : 
     249                 :      24493 :     return S2N_RESULT_OK;
     250                 :      24493 : }
     251                 :            : 
     252                 :            : static S2N_RESULT s2n_composite_cipher_aes128_sha256_set_encryption_key(struct s2n_session_key *key, struct s2n_blob *in)
     253                 :      24417 : {
     254 [ -  + ][ #  # ]:      24417 :     RESULT_ENSURE_EQ(in->size, 16);
     255                 :            : 
     256 [ -  + ][ #  # ]:      24417 :     RESULT_GUARD_OSSL(EVP_EncryptInit_ex(key->evp_cipher_ctx, s2n_evp_aes_128_cbc_hmac_sha256(), NULL, in->data, NULL), S2N_ERR_KEY_INIT);
     257                 :            :     /* Padding must be disabled after key init to take effect. */
     258                 :      24417 :     EVP_CIPHER_CTX_set_padding(key->evp_cipher_ctx, 0);
     259                 :            : 
     260                 :      24417 :     return S2N_RESULT_OK;
     261                 :      24417 : }
     262                 :            : 
     263                 :            : static S2N_RESULT s2n_composite_cipher_aes128_sha256_set_decryption_key(struct s2n_session_key *key, struct s2n_blob *in)
     264                 :      24417 : {
     265 [ -  + ][ #  # ]:      24417 :     RESULT_ENSURE_EQ(in->size, 16);
     266                 :            : 
     267 [ -  + ][ #  # ]:      24417 :     RESULT_GUARD_OSSL(EVP_DecryptInit_ex(key->evp_cipher_ctx, s2n_evp_aes_128_cbc_hmac_sha256(), NULL, in->data, NULL), S2N_ERR_KEY_INIT);
     268                 :            :     /* Padding must be disabled after key init to take effect. */
     269                 :      24417 :     EVP_CIPHER_CTX_set_padding(key->evp_cipher_ctx, 0);
     270                 :            : 
     271                 :      24417 :     return S2N_RESULT_OK;
     272                 :      24417 : }
     273                 :            : 
     274                 :            : static S2N_RESULT s2n_composite_cipher_aes256_sha256_set_encryption_key(struct s2n_session_key *key, struct s2n_blob *in)
     275                 :      24299 : {
     276 [ -  + ][ #  # ]:      24299 :     RESULT_ENSURE_EQ(in->size, 32);
     277                 :            : 
     278 [ -  + ][ #  # ]:      24299 :     RESULT_GUARD_OSSL(EVP_EncryptInit_ex(key->evp_cipher_ctx, s2n_evp_aes_256_cbc_hmac_sha256(), NULL, in->data, NULL), S2N_ERR_KEY_INIT);
     279                 :            :     /* Padding must be disabled after key init to take effect. */
     280                 :      24299 :     EVP_CIPHER_CTX_set_padding(key->evp_cipher_ctx, 0);
     281                 :            : 
     282                 :      24299 :     return S2N_RESULT_OK;
     283                 :      24299 : }
     284                 :            : 
     285                 :            : static S2N_RESULT s2n_composite_cipher_aes256_sha256_set_decryption_key(struct s2n_session_key *key, struct s2n_blob *in)
     286                 :      24299 : {
     287 [ -  + ][ #  # ]:      24299 :     RESULT_ENSURE_EQ(in->size, 32);
     288                 :            : 
     289 [ #  # ][ -  + ]:      24299 :     RESULT_GUARD_OSSL(EVP_DecryptInit_ex(key->evp_cipher_ctx, s2n_evp_aes_256_cbc_hmac_sha256(), NULL, in->data, NULL), S2N_ERR_KEY_INIT);
     290                 :            :     /* Padding must be disabled after key init to take effect. */
     291                 :      24299 :     EVP_CIPHER_CTX_set_padding(key->evp_cipher_ctx, 0);
     292                 :            : 
     293                 :      24299 :     return S2N_RESULT_OK;
     294                 :      24299 : }
     295                 :            : 
     296                 :            : static S2N_RESULT s2n_composite_cipher_aes_sha_init(struct s2n_session_key *key)
     297                 :       1540 : {
     298 [ #  # ][ -  + ]:       1540 :     RESULT_EVP_CTX_INIT(key->evp_cipher_ctx);
     299                 :            : 
     300                 :       1540 :     return S2N_RESULT_OK;
     301                 :       1540 : }
     302                 :            : 
     303                 :            : static S2N_RESULT s2n_composite_cipher_aes_sha_destroy_key(struct s2n_session_key *key)
     304                 :     388342 : {
     305                 :     388342 :     EVP_CIPHER_CTX_cleanup(key->evp_cipher_ctx);
     306                 :            : 
     307                 :     388342 :     return S2N_RESULT_OK;
     308                 :     388342 : }
     309                 :            : 
     310                 :            : const struct s2n_cipher s2n_aes128_sha = {
     311                 :            :     .key_material_size = 16,
     312                 :            :     .type = S2N_COMPOSITE,
     313                 :            :     .io.comp = {
     314                 :            :             .block_size = 16,
     315                 :            :             .record_iv_size = 16,
     316                 :            :             .mac_key_size = SHA_DIGEST_LENGTH,
     317                 :            :             .decrypt = s2n_composite_cipher_aes_sha_decrypt,
     318                 :            :             .encrypt = s2n_composite_cipher_aes_sha_encrypt,
     319                 :            :             .set_mac_write_key = s2n_composite_cipher_aes_sha_set_mac_write_key,
     320                 :            :             .initial_hmac = s2n_composite_cipher_aes_sha_initial_hmac },
     321                 :            :     .is_available = s2n_composite_cipher_aes128_sha_available,
     322                 :            :     .init = s2n_composite_cipher_aes_sha_init,
     323                 :            :     .set_encryption_key = s2n_composite_cipher_aes128_sha_set_encryption_key,
     324                 :            :     .set_decryption_key = s2n_composite_cipher_aes128_sha_set_decryption_key,
     325                 :            :     .destroy_key = s2n_composite_cipher_aes_sha_destroy_key,
     326                 :            : };
     327                 :            : 
     328                 :            : const struct s2n_cipher s2n_aes256_sha = {
     329                 :            :     .key_material_size = 32,
     330                 :            :     .type = S2N_COMPOSITE,
     331                 :            :     .io.comp = {
     332                 :            :             .block_size = 16,
     333                 :            :             .record_iv_size = 16,
     334                 :            :             .mac_key_size = SHA_DIGEST_LENGTH,
     335                 :            :             .decrypt = s2n_composite_cipher_aes_sha_decrypt,
     336                 :            :             .encrypt = s2n_composite_cipher_aes_sha_encrypt,
     337                 :            :             .set_mac_write_key = s2n_composite_cipher_aes_sha_set_mac_write_key,
     338                 :            :             .initial_hmac = s2n_composite_cipher_aes_sha_initial_hmac },
     339                 :            :     .is_available = s2n_composite_cipher_aes256_sha_available,
     340                 :            :     .init = s2n_composite_cipher_aes_sha_init,
     341                 :            :     .set_encryption_key = s2n_composite_cipher_aes256_sha_set_encryption_key,
     342                 :            :     .set_decryption_key = s2n_composite_cipher_aes256_sha_set_decryption_key,
     343                 :            :     .destroy_key = s2n_composite_cipher_aes_sha_destroy_key,
     344                 :            : };
     345                 :            : 
     346                 :            : const struct s2n_cipher s2n_aes128_sha256 = {
     347                 :            :     .key_material_size = 16,
     348                 :            :     .type = S2N_COMPOSITE,
     349                 :            :     .io.comp = {
     350                 :            :             .block_size = 16,
     351                 :            :             .record_iv_size = 16,
     352                 :            :             .mac_key_size = SHA256_DIGEST_LENGTH,
     353                 :            :             .decrypt = s2n_composite_cipher_aes_sha_decrypt,
     354                 :            :             .encrypt = s2n_composite_cipher_aes_sha_encrypt,
     355                 :            :             .set_mac_write_key = s2n_composite_cipher_aes_sha256_set_mac_write_key,
     356                 :            :             .initial_hmac = s2n_composite_cipher_aes_sha_initial_hmac },
     357                 :            :     .is_available = s2n_composite_cipher_aes128_sha256_available,
     358                 :            :     .init = s2n_composite_cipher_aes_sha_init,
     359                 :            :     .set_encryption_key = s2n_composite_cipher_aes128_sha256_set_encryption_key,
     360                 :            :     .set_decryption_key = s2n_composite_cipher_aes128_sha256_set_decryption_key,
     361                 :            :     .destroy_key = s2n_composite_cipher_aes_sha_destroy_key,
     362                 :            : };
     363                 :            : 
     364                 :            : const struct s2n_cipher s2n_aes256_sha256 = {
     365                 :            :     .key_material_size = 32,
     366                 :            :     .type = S2N_COMPOSITE,
     367                 :            :     .io.comp = {
     368                 :            :             .block_size = 16,
     369                 :            :             .record_iv_size = 16,
     370                 :            :             .mac_key_size = SHA256_DIGEST_LENGTH,
     371                 :            :             .decrypt = s2n_composite_cipher_aes_sha_decrypt,
     372                 :            :             .encrypt = s2n_composite_cipher_aes_sha_encrypt,
     373                 :            :             .set_mac_write_key = s2n_composite_cipher_aes_sha256_set_mac_write_key,
     374                 :            :             .initial_hmac = s2n_composite_cipher_aes_sha_initial_hmac },
     375                 :            :     .is_available = s2n_composite_cipher_aes256_sha256_available,
     376                 :            :     .init = s2n_composite_cipher_aes_sha_init,
     377                 :            :     .set_encryption_key = s2n_composite_cipher_aes256_sha256_set_encryption_key,
     378                 :            :     .set_decryption_key = s2n_composite_cipher_aes256_sha256_set_decryption_key,
     379                 :            :     .destroy_key = s2n_composite_cipher_aes_sha_destroy_key,
     380                 :            : };

Generated by: LCOV version 1.14