Skip to content

Commit

Permalink
Merge branch 'mldsa-test-suite' of github.com:jakemas/aws-lc into mld…
Browse files Browse the repository at this point in the history
…sa-test-suite
  • Loading branch information
jakemas committed Dec 20, 2024
2 parents f7d1dad + 43e8954 commit b489226
Show file tree
Hide file tree
Showing 1,191 changed files with 1,852 additions and 29 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/integrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,24 @@ jobs:
- name: Run accp build
run: |
./tests/ci/integration/run_accp_integration.sh
ruby-releases:
if: github.repository_owner == 'aws'
strategy:
fail-fast: false
matrix:
fips:
- "0"
- "1"
runs-on: ubuntu-latest
name: Ruby releases (FIPS=${{ matrix.fips}})
steps:
- name: Install OS Dependencies
run: |
sudo apt-get update
sudo apt-get -y --no-install-recommends install cmake gcc ninja-build golang make autoconf ruby libyaml-dev
- uses: actions/checkout@v3
- name: Build AWS-LC, build ruby, run tests
run: |
./tests/ci/integration/run_ruby_integration.sh ruby_3_2 ruby_3_1
env:
FIPS: ${{ matrix.fips }}
3 changes: 3 additions & 0 deletions crypto/fipsmodule/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ if((((ARCH STREQUAL "x86_64") AND NOT MY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX) OR

p256/p256_montjscalarmul.S
p256/p256_montjscalarmul_alt.S
p256/bignum_montinv_p256.S

p384/bignum_add_p384.S
p384/bignum_sub_p384.S
Expand All @@ -223,6 +224,7 @@ if((((ARCH STREQUAL "x86_64") AND NOT MY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX) OR
p384/p384_montjdouble_alt.S
p384/p384_montjscalarmul.S
p384/p384_montjscalarmul_alt.S
p384/bignum_montinv_p384.S

p521/bignum_add_p521.S
p521/bignum_sub_p521.S
Expand All @@ -237,6 +239,7 @@ if((((ARCH STREQUAL "x86_64") AND NOT MY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX) OR
p521/p521_jdouble_alt.S
p521/p521_jscalarmul.S
p521/p521_jscalarmul_alt.S
p521/bignum_inv_p521.S

curve25519/bignum_mod_n25519.S
curve25519/bignum_neg_p25519.S
Expand Down
6 changes: 6 additions & 0 deletions crypto/fipsmodule/ec/p256-nistz.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ static BN_ULONG is_not_zero(BN_ULONG in) {
// the Montgomery domain.
static void ecp_nistz256_mod_inverse_sqr_mont(BN_ULONG r[P256_LIMBS],
const BN_ULONG in[P256_LIMBS]) {
#if defined(EC_NISTP_USE_S2N_BIGNUM)
ec_nistp_felem_limb in_sqr[P256_LIMBS];
ecp_nistz256_sqr_mont(in_sqr, in);
bignum_montinv_p256(r, in_sqr);
#else
// This implements the addition chain described in
// https://briansmith.org/ecc-inversion-addition-chains-01#p256_field_inversion
BN_ULONG x2[P256_LIMBS], x3[P256_LIMBS], x6[P256_LIMBS], x12[P256_LIMBS],
Expand Down Expand Up @@ -188,6 +193,7 @@ static void ecp_nistz256_mod_inverse_sqr_mont(BN_ULONG r[P256_LIMBS],

ecp_nistz256_sqr_mont(ret, ret);
ecp_nistz256_sqr_mont(r, ret); // 2^256 - 2^224 + 2^192 + 2^96 - 2^2
#endif
}

// r = p * p_scalar
Expand Down
6 changes: 6 additions & 0 deletions crypto/fipsmodule/ec/p384.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ static void p384_from_scalar(p384_felem out, const EC_SCALAR *in) {
// ffffffff 00000000 00000000 fffffffc
static void p384_inv_square(p384_felem out,
const p384_felem in) {
#if defined(EC_NISTP_USE_S2N_BIGNUM)
ec_nistp_felem_limb in_sqr[P384_NLIMBS];
p384_felem_sqr(in_sqr, in);
bignum_montinv_p384(out, in_sqr);
#else
// This implements the addition chain described in
// https://briansmith.org/ecc-inversion-addition-chains-01#p384_field_inversion
// The side comments show the value of the exponent:
Expand Down Expand Up @@ -222,6 +227,7 @@ static void p384_inv_square(p384_felem out,

p384_felem_sqr(ret, ret);
p384_felem_sqr(out, ret); // 2^384 - 2^128 - 2^96 + 2^32 - 2^2 = p - 3
#endif
}

static void p384_point_double(p384_felem x_out,
Expand Down
4 changes: 4 additions & 0 deletions crypto/fipsmodule/ec/p521.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ static void p521_to_generic(EC_FELEM *out, const p521_felem in) {
// The code is autogenerated by the ECCKiila project:
// https://arxiv.org/abs/2007.11481
static void p521_felem_inv(p521_felem output, const p521_felem t1) {
#if defined(EC_NISTP_USE_S2N_BIGNUM)
bignum_inv_p521(output, t1);
#else
/* temporary variables */
p521_felem acc, t2, t4, t8, t16, t32, t64;
p521_felem t128, t256, t512, t516, t518, t519;
Expand Down Expand Up @@ -240,6 +243,7 @@ static void p521_felem_inv(p521_felem output, const p521_felem t1) {
p521_felem_sqr(acc, t519);
p521_felem_sqr(acc, acc);
p521_felem_mul(output, acc, t1);
#endif
}

static void p521_point_double(p521_felem x_out,
Expand Down
30 changes: 24 additions & 6 deletions crypto/pkcs7/pkcs7.c
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,12 @@ static BIO *pkcs7_data_decode(PKCS7 *p7, EVP_PKEY *pkey, X509 *pcert) {
case NID_pkcs7_enveloped:
rsk = p7->d.enveloped->recipientinfo;
enc_alg = p7->d.enveloped->enc_data->algorithm;
if (enc_alg == NULL || enc_alg->parameter == NULL ||
enc_alg->parameter->value.octet_string == NULL ||
enc_alg->algorithm == NULL) {
OPENSSL_PUT_ERROR(PKCS7, ERR_R_PKCS7_LIB);
goto err;
}
// |data_body| is NULL if the optional EncryptedContent is missing.
data_body = p7->d.enveloped->enc_data->enc_data;
cipher = EVP_get_cipherbynid(OBJ_obj2nid(enc_alg->algorithm));
Expand All @@ -1219,7 +1225,7 @@ static BIO *pkcs7_data_decode(PKCS7 *p7, EVP_PKEY *pkey, X509 *pcert) {
goto err;
}

// Detached content must be supplied via in_bio instead
// envelopedData must have data content to decrypt
if (data_body == NULL) {
OPENSSL_PUT_ERROR(PKCS7, PKCS7_R_NO_CONTENT);
goto err;
Expand Down Expand Up @@ -1250,7 +1256,10 @@ static BIO *pkcs7_data_decode(PKCS7 *p7, EVP_PKEY *pkey, X509 *pcert) {
if (!pkcs7_cmp_ri(ri, pcert)) {
break;
}
#if !defined(BORINGSSL_UNSAFE_FUZZER_MODE)
// For fuzz testing, we do not want to bail out early.
ri = NULL;
#endif
}
if (ri == NULL) {
OPENSSL_PUT_ERROR(PKCS7, PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE);
Expand Down Expand Up @@ -1290,14 +1299,14 @@ static BIO *pkcs7_data_decode(PKCS7 *p7, EVP_PKEY *pkey, X509 *pcert) {
!EVP_CipherInit_ex(evp_ctx, cipher, NULL, NULL, NULL, 0)) {
goto err;
}
uint8_t iv[EVP_MAX_IV_LENGTH];
OPENSSL_memcpy(iv, enc_alg->parameter->value.octet_string->data,
enc_alg->parameter->value.octet_string->length);
const int expected_iv_len = EVP_CIPHER_CTX_iv_length(evp_ctx);
if (enc_alg->parameter->value.octet_string->length != expected_iv_len) {
OPENSSL_PUT_ERROR(PKCS7, ERR_R_PKCS7_LIB);
goto err;
}
uint8_t iv[EVP_MAX_IV_LENGTH];
OPENSSL_memcpy(iv, enc_alg->parameter->value.octet_string->data,
expected_iv_len);
if (!EVP_CipherInit_ex(evp_ctx, NULL, NULL, NULL, iv, 0)) {
goto err;
}
Expand All @@ -1323,9 +1332,12 @@ static BIO *pkcs7_data_decode(PKCS7 *p7, EVP_PKEY *pkey, X509 *pcert) {

OPENSSL_free(cek);
OPENSSL_free(dummy_key);
cek = NULL;
dummy_key = NULL;
out = cipher_bio;

if (data_body && data_body->length > 0) {
// We verify data_body != NULL above
if (data_body->length > 0) {
data_bio = BIO_new_mem_buf(data_body->data, data_body->length);
} else {
data_bio = BIO_new(BIO_s_mem());
Expand Down Expand Up @@ -1360,7 +1372,7 @@ PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509) {
return ri;
}

int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags) {
int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int _flags) {
GUARD_PTR(p7);
GUARD_PTR(pkey);
GUARD_PTR(data);
Expand Down Expand Up @@ -1590,8 +1602,11 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
}
// NOTE: unlike most of our functions, |X509_verify_cert| can return <= 0
if (X509_verify_cert(cert_ctx) <= 0) {
#if !defined(BORINGSSL_UNSAFE_FUZZER_MODE)
// For fuzz testing, we do not want to bail out early.
OPENSSL_PUT_ERROR(PKCS7, PKCS7_R_CERTIFICATE_VERIFY_ERROR);
goto out;
#endif
}
}

Expand All @@ -1607,8 +1622,11 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
PKCS7_SIGNER_INFO *si = sk_PKCS7_SIGNER_INFO_value(sinfos, ii);
X509 *signer = sk_X509_value(signers, ii);
if (!pkcs7_signature_verify(p7bio, p7, si, signer)) {
#if !defined(BORINGSSL_UNSAFE_FUZZER_MODE)
// For fuzz testing, we do not want to bail out early.
OPENSSL_PUT_ERROR(PKCS7, PKCS7_R_SIGNATURE_FAILURE);
goto out;
#endif
}
}

Expand Down
2 changes: 2 additions & 0 deletions fuzz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ fuzzer(ocsp)
fuzzer(ocsp_http)
fuzzer(ocsp_parse_url)
fuzzer(pkcs12)
fuzzer(pkcs7_decrypt)
fuzzer(pkcs7_verify)
fuzzer(pkcs8)
fuzzer(pkcs8_v2)
fuzzer(privkey)
Expand Down
157 changes: 157 additions & 0 deletions fuzz/pkcs7_decrypt.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC

#include <cstdint>

#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/pkcs7.h>
#include <openssl/rsa.h>
#include <openssl/x509.h>
#include <openssl/pem.h>

// The corpus was created using the following key.
// If you change the key, the corpus should be augmented with inputs
// created using (or "seeded" from) PKCS7 values encrypted with
// the new key.
static const char kKey[] = R"(
-----BEGIN PRIVATE KEY-----
MIIJQQIBADANBgkqhkiG9w0BAQEFAASCCSswggknAgEAAoICAQC1+MOn+BopcEVR
4QMvjXdAxGkWFllXyQFDToL+qOiPRU1yN7C8KCtkbOAFttJIO4O/i0iZ7KqYbnmB
6YUA/ONAcakocnrdoESgRJcVMeAxDk/11OtMF5yIfeOOO/TUeVNmAUaT63gFbKy/
adpqhzJtOv9BBl5VcYNGGSE+0wtbmjpmNsxunEQR1KLDc97fGYHeRfKoSyrCIEE8
IaAEpKGR2Sku3v9Jwh7RpjupgiUAkH6pJk7VMZm5vl2wFjYvfysgjeN5ZtsxFDMa
PYZStpxMxpNd5C9DsO2Ljp5NMpGfNGmG4ZqiaQg8z2cIM6ESmN1zDJdUh5IXed1f
OxBZD/poUFH0wDRFWnvzlaPmjJEFrYLMK8svnE5nEQp9vu93ISFBx7cofs+niMaU
XPEqaRSqruifN2M1it3kOf/8YZl1vurs+VtHD6nOJo6bd11+37aBidIB/BaWnzLr
DmSTcPFa1tkTHwoLqc9+jThTq9jZ6w3lAMPpsoenyD19UmQB589+4kNp2SIO/Ttz
VQCGgQPXE2jDCl6G9aIPMkfvpPZK4THVil3WQRCFYnYdDO4HQXo2ZuC4RiqgY5yg
feoL+fa9k383lgxxAHQLS7xsbaVB40RmfdbdevgPYIwZNNO78ddRmMdSv6IknSW9
gydGzY//btY+t1SWcBZWzn1Ewq8g2QIDAQABAoICAFQ/liZAIaypxA5ChP0RG/Mq
fBSzyC1ybFlDEjbg8LrUNST6T6LtXhmipp0+pWC33SljTPumrNzh2POir+djLbt6
Y/zL88KEHwGsf95aNxe/Lpn8N+wEyn4O+rmxXIq6mTgSwyBc1jZ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J0lvYMn
Rs2P/27WPrdUlnAWVs59RMKvINkCAwEAAaMQMA4wDAYDVR0TAQH/BAIwADANBgkq
hkiG9w0BAQsFAAOCAgEAMZR8p6FGActr5RNICECEKnp6qfgaZiQFwKg64uovggh3
PU4VhRGWtNAD4E8/G37I1WjEJwSh6YrthQJrSmfnVxUgXwZqW3Ou5UJpaWwReEMV
xXwznJTwoUwD9pzh/+2QeNYV+6CPmGPD8znhh9QzOoo1mIaUNdDGN7K6dVBBBr7O
Dm67qWXf8AoWLUO5XTiha5V19Jsyxszo2Ntfef9mK4LIszuRbMrpfMlUEvuO3oLa
SLScdPonEPF7CGuyJcyVVJ4T+mqTzmQ9AKzujjXk3sqw5rFbPIC+ei5Fdf0SXsgS
jEX83uZPZRIMjkyiVjDsWwDDumaTJ/KCUhaqGzJ6/ZKLEvKCgtgDQg2QetmRzS5j
c9CC6I6Kfx01cJ6wOlJY22DDjWJAviEP40/TVk1xoEWyiErEiYq3vdCRRoxSR55N
/tjiQM0XbiGfKfx2KrAHFIsRQsqHF0bL4HDjCh29cz3jleWdLGNPwrdfLtPMcXf8
Eu6/5vlz8BUuaR08fjv59tfdedLDRlbpZFERMio6PINFoRuVtbcgVw5xHucHjl3p
shp0eY7uylv5j8j1X7m5fp+BZKILGHLKVrE2ihJgyS9je2Jf40Fb+Hu+1dcsAKd+
jbgtnMeOs3SWELGeAG2TXsKmNOb0OwzGeL5jJpe6tsEUiQQQxhfarBIlxoTPizI=
-----END CERTIFICATE-----
)";

class SharedData {
public:
EVP_PKEY *key = nullptr;
X509 *cert = nullptr;

SharedData() {
{
BIO *key_bio = BIO_new_mem_buf(const_cast<char *>(kKey), sizeof(kKey) - 1);
key = PEM_read_bio_PrivateKey(key_bio, nullptr, nullptr, nullptr);
BIO_free(key_bio);
}
{
BIO *cert_bio = BIO_new_mem_buf(const_cast<char *>(kCert), sizeof(kCert) - 1);
cert = PEM_read_bio_X509(cert_bio, nullptr, nullptr, nullptr);
BIO_free(cert_bio);
}
}

~SharedData() {
X509_free(cert);
EVP_PKEY_free(key);
}
};

static SharedData sharedData;


extern "C" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {
PKCS7 *pkcs7 = nullptr;

pkcs7 = d2i_PKCS7(nullptr, &buf, len);
if (pkcs7 == nullptr) {
goto end;
}

{
BIO *data_bio = BIO_new(BIO_s_mem());
OPENSSL_BEGIN_ALLOW_DEPRECATED
PKCS7_decrypt(pkcs7, sharedData.key, NULL, data_bio, 0);
OPENSSL_END_ALLOW_DEPRECATED
BIO_free(data_bio);
}

{
BIO *data_bio = BIO_new(BIO_s_mem());
OPENSSL_BEGIN_ALLOW_DEPRECATED
PKCS7_decrypt(pkcs7, sharedData.key, sharedData.cert, data_bio, 0);
OPENSSL_END_ALLOW_DEPRECATED
BIO_free(data_bio);
}

end:
PKCS7_free(pkcs7);

return 0;
}
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2�
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
>�
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
>S
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0�
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0�0
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
;�
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$�
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0�0�0�
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit b489226

Please sign in to comment.