Skip to content

Commit

Permalink
Upstream merge 2024 12 13 (aws#2060)
Browse files Browse the repository at this point in the history
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license and the ISC license.
  • Loading branch information
samuel40791765 authored Dec 19, 2024
2 parents d0501c5 + dc1cc97 commit f45bc34
Show file tree
Hide file tree
Showing 33 changed files with 270 additions and 149 deletions.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,8 @@ if(BUILD_TESTING)

add_custom_target(
acvp_tests
COMMAND ${CMAKE_COMMAND} -E echo
COMMAND ${CMAKE_COMMAND} -E echo "Running ACVP tests"
COMMAND ${GO_EXECUTABLE} run check_expected.go
-tool ${ACVP_TOOL}
-module-wrappers modulewrapper:$<TARGET_FILE:modulewrapper>,testmodulewrapper:${TEST_WRAPPER}
Expand Down Expand Up @@ -1164,6 +1166,7 @@ if(BUILD_TESTING)
if(BUILD_LIBSSL)
add_custom_target(
run_ssl_runner_tests
COMMAND ${CMAKE_COMMAND} -E echo "Running SSL tests"
COMMAND cd ssl/test/runner &&
${GO_EXECUTABLE} test -timeout ${GO_TEST_TIMEOUT} -shim-path $<TARGET_FILE:bssl_shim>
${HANDSHAKER_ARGS} ${RUNNER_ARGS} ${AWS_LC_SSL_RUNNER_INDEX_FILTER} ${SSL_TRANSFER_ARGS}
Expand All @@ -1173,6 +1176,7 @@ if(BUILD_TESTING)

add_custom_target(
run_ssl_runner_tests_valgrind
COMMAND ${CMAKE_COMMAND} -E echo "Running SSL tests"
COMMAND cd ssl/test/runner &&
${GO_EXECUTABLE} test -timeout ${GO_TEST_TIMEOUT} -shim-path $<TARGET_FILE:bssl_shim> -valgrind
${HANDSHAKER_ARGS} ${RUNNER_ARGS} ${AWS_LC_SSL_RUNNER_INDEX_FILTER} ${SSL_TRANSFER_ARGS}
Expand All @@ -1182,7 +1186,11 @@ if(BUILD_TESTING)

add_custom_target(
run_tests
COMMAND ${CMAKE_COMMAND} -E echo
COMMAND ${CMAKE_COMMAND} -E echo "Running Go tests"
COMMAND ${GO_EXECUTABLE} test ${GO_TESTS}
COMMAND ${CMAKE_COMMAND} -E echo
COMMAND ${CMAKE_COMMAND} -E echo "Running unit tests"
COMMAND ${GO_EXECUTABLE} run util/all_tests.go -build-dir
${PROJECT_BINARY_DIR}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
Expand All @@ -1191,7 +1199,10 @@ if(BUILD_TESTING)
else()
add_custom_target(
run_tests
COMMAND ${CMAKE_COMMAND} -E echo "Running Go tests"
COMMAND ${GO_EXECUTABLE} test ${GO_TESTS}
COMMAND ${CMAKE_COMMAND} -E echo
COMMAND ${CMAKE_COMMAND} -E echo "Running unit tests"
COMMAND ${GO_EXECUTABLE} run util/all_tests.go -build-dir
${PROJECT_BINARY_DIR} -ssl-tests=false
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
Expand Down
1 change: 0 additions & 1 deletion crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,6 @@ function(build_libcrypto name module_source)
if(FIPS_DELOCATE OR FIPS_SHARED)
add_dependencies(${name} bcm_o_target)
endif()
SET_TARGET_PROPERTIES(${name} PROPERTIES LINKER_LANGUAGE C)
if(WIN32)
target_link_libraries(${name} PUBLIC ws2_32)
endif()
Expand Down
2 changes: 0 additions & 2 deletions crypto/cipher_extra/e_aes_cbc_hmac_sha1.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,6 @@ static const EVP_CIPHER aesni_128_cbc_hmac_sha1_cipher = {
AES_BLOCK_SIZE /* iv len */,
sizeof(EVP_AES_HMAC_SHA1) /* ctx_size */,
EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_AEAD_CIPHER /* flags */,
NULL /* app_data */,
aesni_cbc_hmac_sha1_init_key,
aesni_cbc_hmac_sha1_cipher,
NULL /* cleanup */,
Expand All @@ -385,7 +384,6 @@ static const EVP_CIPHER aesni_256_cbc_hmac_sha1_cipher = {
AES_BLOCK_SIZE /* iv len */,
sizeof(EVP_AES_HMAC_SHA1) /* ctx_size */,
EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_AEAD_CIPHER /* flags */,
NULL /* app_data */,
aesni_cbc_hmac_sha1_init_key,
aesni_cbc_hmac_sha1_cipher,
NULL,
Expand Down
2 changes: 0 additions & 2 deletions crypto/cipher_extra/e_aes_cbc_hmac_sha256.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ static const EVP_CIPHER aesni_128_cbc_hmac_sha256_cipher = {
AES_BLOCK_SIZE /* iv len */,
sizeof(EVP_AES_HMAC_SHA256) /* ctx_size */,
EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_AEAD_CIPHER /* flags */,
NULL /* app_data */,
aesni_cbc_hmac_sha256_init_key,
aesni_cbc_hmac_sha256_cipher,
NULL /* cleanup */,
Expand All @@ -381,7 +380,6 @@ static const EVP_CIPHER aesni_256_cbc_hmac_sha256_cipher = {
AES_BLOCK_SIZE /* iv len */,
sizeof(EVP_AES_HMAC_SHA256) /* ctx_size */,
EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_AEAD_CIPHER /* flags */,
NULL /* app_data */,
aesni_cbc_hmac_sha256_init_key,
aesni_cbc_hmac_sha256_cipher,
NULL /* cleanup */,
Expand Down
1 change: 0 additions & 1 deletion crypto/cipher_extra/e_chacha20poly1305.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,6 @@ static EVP_CIPHER cipher_chacha20_poly1305 = {
sizeof(CIPHER_CHACHA_POLY_CTX),
EVP_CIPH_FLAG_AEAD_CIPHER | EVP_CIPH_CUSTOM_IV | EVP_CIPH_ALWAYS_CALL_INIT |
EVP_CIPH_CTRL_INIT | EVP_CIPH_CUSTOM_COPY | EVP_CIPH_FLAG_CUSTOM_CIPHER,
NULL, // app_data
cipher_chacha20_poly1305_init,
cipher_chacha20_poly1305_do_cipher,
cipher_chacha20_poly1305_cleanup,
Expand Down
6 changes: 0 additions & 6 deletions crypto/cipher_extra/e_des.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ static const EVP_CIPHER evp_des_cbc = {
/* iv_len = */ 8,
/* ctx_size = */ sizeof(EVP_DES_KEY),
/* flags = */ EVP_CIPH_CBC_MODE,
/* app_data = */ NULL,
/* init = */ des_init_key,
/* cipher = */ des_cbc_cipher,
/* cleanup = */ NULL,
Expand Down Expand Up @@ -121,7 +120,6 @@ static const EVP_CIPHER evp_des_ecb = {
/* iv_len = */ 0,
/* ctx_size = */ sizeof(EVP_DES_KEY),
/* flags = */ EVP_CIPH_ECB_MODE,
/* app_data = */ NULL,
/* init = */ des_init_key,
/* cipher = */ des_ecb_cipher,
/* cleanup = */ NULL,
Expand Down Expand Up @@ -161,7 +159,6 @@ static const EVP_CIPHER evp_des_ede3_cbc = {
/* iv_len = */ 8,
/* ctx_size = */ sizeof(DES_EDE_KEY),
/* flags = */ EVP_CIPH_CBC_MODE,
/* app_data = */ NULL,
/* init = */ des_ede3_init_key,
/* cipher = */ des_ede3_cbc_cipher,
/* cleanup = */ NULL,
Expand All @@ -187,7 +184,6 @@ static const EVP_CIPHER evp_des_ede_cbc = {
/* iv_len = */ 8,
/* ctx_size = */ sizeof(DES_EDE_KEY),
/* flags = */ EVP_CIPH_CBC_MODE,
/* app_data = */ NULL,
/* init = */ des_ede_init_key,
/* cipher = */ des_ede3_cbc_cipher,
/* cleanup = */ NULL,
Expand Down Expand Up @@ -218,7 +214,6 @@ static const EVP_CIPHER evp_des_ede = {
/* iv_len = */ 0,
/* ctx_size = */ sizeof(DES_EDE_KEY),
/* flags = */ EVP_CIPH_ECB_MODE,
/* app_data = */ NULL,
/* init = */ des_ede_init_key,
/* cipher = */ des_ede_ecb_cipher,
/* cleanup = */ NULL,
Expand All @@ -234,7 +229,6 @@ static const EVP_CIPHER evp_des_ede3 = {
/* iv_len = */ 0,
/* ctx_size = */ sizeof(DES_EDE_KEY),
/* flags = */ EVP_CIPH_ECB_MODE,
/* app_data = */ NULL,
/* init = */ des_ede3_init_key,
/* cipher = */ des_ede_ecb_cipher,
/* cleanup = */ NULL,
Expand Down
6 changes: 3 additions & 3 deletions crypto/cipher_extra/e_null.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ static int null_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out,
}

static const EVP_CIPHER n_cipher = {
NID_undef, 1 /* block size */, 0 /* key_len */, 0 /* iv_len */,
0 /* ctx_size */, 0 /* flags */, NULL /* app_data */, null_init_key,
null_cipher, NULL /* cleanup */, NULL /* ctrl */,
NID_undef, 1 /* block size */, 0 /* key_len */, 0 /* iv_len */,
0 /* ctx_size */, 0 /* flags */, null_init_key, null_cipher,
NULL /* cleanup */, NULL /* ctrl */,
};

const EVP_CIPHER *EVP_enc_null(void) { return &n_cipher; }
2 changes: 0 additions & 2 deletions crypto/cipher_extra/e_rc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ static const EVP_CIPHER rc2_40_cbc = {
8 /* iv len */,
sizeof(EVP_RC2_KEY),
EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT,
NULL /* app_data */,
rc2_init_key,
rc2_cbc_cipher,
NULL,
Expand All @@ -451,7 +450,6 @@ static const EVP_CIPHER rc2_cbc = {
8 /* iv len */,
sizeof(EVP_RC2_KEY),
EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT,
NULL /* app_data */,
rc2_init_key,
rc2_cbc_cipher,
NULL,
Expand Down
9 changes: 5 additions & 4 deletions crypto/cipher_extra/e_rc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ static int rc4_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out, const uint8_t *in,
}

static const EVP_CIPHER rc4 = {
NID_rc4, 1 /* block_size */, 16 /* key_size */,
0 /* iv_len */, sizeof(RC4_KEY), EVP_CIPH_VARIABLE_LENGTH,
NULL /* app_data */, rc4_init_key, rc4_cipher,
NULL /* cleanup */, NULL /* ctrl */, };
NID_rc4, 1 /* block_size */, 16 /* key_size */,
0 /* iv_len */, sizeof(RC4_KEY), EVP_CIPH_VARIABLE_LENGTH,
rc4_init_key, rc4_cipher, NULL /* cleanup */,
NULL /* ctrl */,
};

const EVP_CIPHER *EVP_rc4(void) { return &rc4; }
33 changes: 15 additions & 18 deletions crypto/decrepit/blowfish/blowfish.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,30 +594,27 @@ static int bf_cfb_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out, const uint8_t *in,
}

static const EVP_CIPHER bf_ecb = {
NID_bf_ecb, BF_BLOCK /* block_size */,
16 /* key_size */, BF_BLOCK /* iv_len */,
sizeof(BF_KEY), EVP_CIPH_ECB_MODE | EVP_CIPH_VARIABLE_LENGTH,
NULL /* app_data */, bf_init_key,
bf_ecb_cipher, NULL /* cleanup */,
NULL /* ctrl */,
NID_bf_ecb, BF_BLOCK /* block_size */,
16 /* key_size */, BF_BLOCK /* iv_len */,
sizeof(BF_KEY), EVP_CIPH_ECB_MODE | EVP_CIPH_VARIABLE_LENGTH,
bf_init_key, bf_ecb_cipher,
NULL /* cleanup */, NULL /* ctrl */,
};

static const EVP_CIPHER bf_cbc = {
NID_bf_cbc, BF_BLOCK /* block_size */,
16 /* key_size */, BF_BLOCK /* iv_len */,
sizeof(BF_KEY), EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH,
NULL /* app_data */, bf_init_key,
bf_cbc_cipher, NULL /* cleanup */,
NULL /* ctrl */,
NID_bf_cbc, BF_BLOCK /* block_size */,
16 /* key_size */, BF_BLOCK /* iv_len */,
sizeof(BF_KEY), EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH,
bf_init_key, bf_cbc_cipher,
NULL /* cleanup */, NULL /* ctrl */,
};

static const EVP_CIPHER bf_cfb = {
NID_bf_cfb64, 1 /* block_size */,
16 /* key_size */, BF_BLOCK /* iv_len */,
sizeof(BF_KEY), EVP_CIPH_CFB_MODE | EVP_CIPH_VARIABLE_LENGTH,
NULL /* app_data */, bf_init_key,
bf_cfb_cipher, NULL /* cleanup */,
NULL /* ctrl */,
NID_bf_cfb64, 1 /* block_size */,
16 /* key_size */, BF_BLOCK /* iv_len */,
sizeof(BF_KEY), EVP_CIPH_CFB_MODE | EVP_CIPH_VARIABLE_LENGTH,
bf_init_key, bf_cfb_cipher,
NULL /* cleanup */, NULL /* ctrl */,
};

const EVP_CIPHER *EVP_bf_ecb(void) { return &bf_ecb; }
Expand Down
22 changes: 10 additions & 12 deletions crypto/decrepit/cast/cast.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,21 +384,19 @@ static int cast_cbc_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out, const uint8_t *in,
}

static const EVP_CIPHER cast5_ecb = {
NID_cast5_ecb, CAST_BLOCK,
CAST_KEY_LENGTH, CAST_BLOCK /* iv_len */,
sizeof(CAST_KEY), EVP_CIPH_ECB_MODE | EVP_CIPH_VARIABLE_LENGTH,
NULL /* app_data */, cast_init_key,
cast_ecb_cipher, NULL /* cleanup */,
NULL /* ctrl */,
NID_cast5_ecb, CAST_BLOCK,
CAST_KEY_LENGTH, CAST_BLOCK /* iv_len */,
sizeof(CAST_KEY), EVP_CIPH_ECB_MODE | EVP_CIPH_VARIABLE_LENGTH,
cast_init_key, cast_ecb_cipher,
NULL /* cleanup */, NULL /* ctrl */,
};

static const EVP_CIPHER cast5_cbc = {
NID_cast5_cbc, CAST_BLOCK,
CAST_KEY_LENGTH, CAST_BLOCK /* iv_len */,
sizeof(CAST_KEY), EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH,
NULL /* app_data */, cast_init_key,
cast_cbc_cipher, NULL /* cleanup */,
NULL /* ctrl */,
NID_cast5_cbc, CAST_BLOCK,
CAST_KEY_LENGTH, CAST_BLOCK /* iv_len */,
sizeof(CAST_KEY), EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH,
cast_init_key, cast_cbc_cipher,
NULL /* cleanup */, NULL /* ctrl */,
};

const EVP_CIPHER *EVP_cast5_ecb(void) { return &cast5_ecb; }
Expand Down
64 changes: 32 additions & 32 deletions crypto/decrepit/cfb/cfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,66 +105,66 @@ static int aes_cfb128_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out,
}

static const EVP_CIPHER aes_128_cfb1 = {
NID_aes_128_cfb1, 1 /* block_size */, 16 /* key_size */,
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
NULL /* app_data */, aes_cfb_init_key, aes_cfb1_cipher,
NULL /* cleanup */, NULL /* ctrl */,
NID_aes_128_cfb1, 1 /* block_size */, 16 /* key_size */,
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
aes_cfb_init_key, aes_cfb1_cipher, NULL /* cleanup */,
NULL /* ctrl */,
};

static const EVP_CIPHER aes_128_cfb8 = {
NID_aes_128_cfb8, 1 /* block_size */, 16 /* key_size */,
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
NULL /* app_data */, aes_cfb_init_key, aes_cfb8_cipher,
NULL /* cleanup */, NULL /* ctrl */,
NID_aes_128_cfb8, 1 /* block_size */, 16 /* key_size */,
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
aes_cfb_init_key, aes_cfb8_cipher, NULL /* cleanup */,
NULL /* ctrl */,
};

static const EVP_CIPHER aes_128_cfb128 = {
NID_aes_128_cfb128, 1 /* block_size */, 16 /* key_size */,
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
NULL /* app_data */, aes_cfb_init_key, aes_cfb128_cipher,
NULL /* cleanup */, NULL /* ctrl */,
NID_aes_128_cfb128, 1 /* block_size */, 16 /* key_size */,
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
aes_cfb_init_key, aes_cfb128_cipher, NULL /* cleanup */,
NULL /* ctrl */,
};

static const EVP_CIPHER aes_192_cfb1 = {
NID_aes_192_cfb1, 1 /* block_size */, 24 /* key_size */,
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
NULL /* app_data */, aes_cfb_init_key, aes_cfb1_cipher,
NULL /* cleanup */, NULL /* ctrl */,
NID_aes_192_cfb1, 1 /* block_size */, 24 /* key_size */,
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
aes_cfb_init_key, aes_cfb1_cipher, NULL /* cleanup */,
NULL /* ctrl */,
};

static const EVP_CIPHER aes_192_cfb8 = {
NID_aes_192_cfb8, 1 /* block_size */, 24 /* key_size */,
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
NULL /* app_data */, aes_cfb_init_key, aes_cfb8_cipher,
NULL /* cleanup */, NULL /* ctrl */,
NID_aes_192_cfb8, 1 /* block_size */, 24 /* key_size */,
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
aes_cfb_init_key, aes_cfb8_cipher, NULL /* cleanup */,
NULL /* ctrl */,
};

static const EVP_CIPHER aes_192_cfb128 = {
NID_aes_192_cfb128, 1 /* block_size */, 24 /* key_size */,
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
NULL /* app_data */, aes_cfb_init_key, aes_cfb128_cipher,
NULL /* cleanup */, NULL /* ctrl */,
NID_aes_192_cfb128, 1 /* block_size */, 24 /* key_size */,
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
aes_cfb_init_key, aes_cfb128_cipher, NULL /* cleanup */,
NULL /* ctrl */,
};

static const EVP_CIPHER aes_256_cfb1 = {
NID_aes_256_cfb1, 1 /* block_size */, 32 /* key_size */,
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
NULL /* app_data */, aes_cfb_init_key, aes_cfb1_cipher,
NULL /* cleanup */, NULL /* ctrl */,
NID_aes_256_cfb1, 1 /* block_size */, 32 /* key_size */,
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
aes_cfb_init_key, aes_cfb1_cipher, NULL /* cleanup */,
NULL /* ctrl */,
};

static const EVP_CIPHER aes_256_cfb8 = {
NID_aes_256_cfb8, 1 /* block_size */, 32 /* key_size */,
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
NULL /* app_data */, aes_cfb_init_key, aes_cfb8_cipher,
NULL /* cleanup */, NULL /* ctrl */,
aes_cfb_init_key, aes_cfb8_cipher, NULL /* cleanup */,
NULL /* ctrl */,
};

static const EVP_CIPHER aes_256_cfb128 = {
NID_aes_256_cfb128, 1 /* block_size */, 32 /* key_size */,
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
NULL /* app_data */, aes_cfb_init_key, aes_cfb128_cipher,
NULL /* cleanup */, NULL /* ctrl */,
aes_cfb_init_key, aes_cfb128_cipher, NULL /* cleanup */,
NULL /* ctrl */,
};

const EVP_CIPHER *EVP_aes_128_cfb1(void) { return &aes_128_cfb1; }
Expand Down
1 change: 1 addition & 0 deletions crypto/digest_extra/digest_extra.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ int EVP_marshal_digest_algorithm(CBB *cbb, const EVP_MD *md) {
return 0;
}

// TODO(crbug.com/boringssl/710): Is this correct? See RFC 4055, section 2.1.
if (!CBB_add_asn1(&algorithm, &null, CBS_ASN1_NULL) ||
!CBB_flush(cbb)) {
return 0;
Expand Down
Loading

0 comments on commit f45bc34

Please sign in to comment.