summaryrefslogtreecommitdiffstats
path: root/test/evp_extra_test.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2022-06-24 11:02:22 +0100
committerTomas Mraz <tomas@openssl.org>2022-06-28 17:05:10 +0200
commit995eccb611431a4857cac3283e2442c01109d428 (patch)
tree4d02fe6fa8e79e24619a1d47c39ca45c1a70e10b /test/evp_extra_test.c
parent518f1ee81d5a6910365ef404888d0e119a87fd81 (diff)
Add a test for an all 0 RSA key
Testing a key with all values set to 0. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18651)
Diffstat (limited to 'test/evp_extra_test.c')
-rw-r--r--test/evp_extra_test.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c
index b68de52dd7..dfcd317773 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 */