From: Matt Caswell Date: Fri, 24 Jun 2022 10:02:22 +0000 (+0100) Subject: Add a test for an all 0 RSA key X-Git-Tag: openssl-3.2.0-alpha1~2473 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=995eccb611431a4857cac3283e2442c01109d428;p=thirdparty%2Fopenssl.git Add a test for an all 0 RSA key Testing a key with all values set to 0. Reviewed-by: Paul Dale Reviewed-by: Shane Lontis Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/18651) --- diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c index b68de52dd77..dfcd3177730 100644 --- a/test/evp_extra_test.c +++ b/test/evp_extra_test.c @@ -244,6 +244,16 @@ static const unsigned char kExampleBadRSAKeyDER[] = { 0x8c, 0x95, 0xba, 0xf6, 0x04, 0xb3, 0x0a, 0xf4, 0xcb, 0xf0, 0xce, }; +/* + * kExampleBad2RSAKeyDER is an RSA private key in ASN.1, DER format. All + * values are 0. + */ +static const unsigned char kExampleBad2RSAKeyDER[] = { + 0x30, 0x1b, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, + 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, + 0x01, 0x00, 0x02, 0x01, 0x00 +}; + static const unsigned char kMsg[] = { 1, 2, 3, 4 }; static const unsigned char kSignature[] = { @@ -556,6 +566,8 @@ static APK_DATA keycheckdata[] = { 0}, {kExampleBadRSAKeyDER, sizeof(kExampleBadRSAKeyDER), "RSA", EVP_PKEY_RSA, 0, 1, 1, 0}, + {kExampleBad2RSAKeyDER, sizeof(kExampleBad2RSAKeyDER), "RSA", EVP_PKEY_RSA, + 0, 0, 1 /* Since there are no "params" in an RSA key this passes */, 0}, #ifndef OPENSSL_NO_EC {kExampleECKeyDER, sizeof(kExampleECKeyDER), "EC", EVP_PKEY_EC, 1, 1, 1, 0}, /* group is also associated in our pub key */