From 1330093b9c7e0325ca76589fb9ace5b664830c6d Mon Sep 17 00:00:00 2001 From: Nicola Tuveri Date: Tue, 10 Nov 2020 12:28:52 +0200 Subject: [PATCH] [test][pkey_check] Add more invalid SM2 key tests Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/13359) --- test/recipes/91-test_pkey_check.t | 4 +++- test/recipes/91-test_pkey_check_data/sm2_bad_0.pem | 4 ++++ test/recipes/91-test_pkey_check_data/sm2_bad_1.pem | 4 ++++ .../{sm2_bad_max.pem => sm2_bad_neg1.pem} | 0 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 test/recipes/91-test_pkey_check_data/sm2_bad_0.pem create mode 100644 test/recipes/91-test_pkey_check_data/sm2_bad_1.pem rename test/recipes/91-test_pkey_check_data/{sm2_bad_max.pem => sm2_bad_neg1.pem} (100%) diff --git a/test/recipes/91-test_pkey_check.t b/test/recipes/91-test_pkey_check.t index c85ab5c3773..4dce838d1f1 100644 --- a/test/recipes/91-test_pkey_check.t +++ b/test/recipes/91-test_pkey_check.t @@ -46,7 +46,9 @@ push(@tests, ( push(@tests, ( # For SM2 keys the range for the secret scalar `k` is `1 <= k < n-1` - "sm2_bad_max.pem", # `k` set to `n-1` (invalid, because SM2 range) + "sm2_bad_neg1.pem", # `k` set to `n-1` (invalid, because SM2 range) + "sm2_bad_0.pem", # `k` set to `n` (equivalent to `0 mod n`, invalid) + "sm2_bad_1.pem", # `k` set to `n+1` (equivalent to `1 mod n`, invalid) )) unless disabled("sm2"); plan skip_all => "No tests within the current enabled feature set" diff --git a/test/recipes/91-test_pkey_check_data/sm2_bad_0.pem b/test/recipes/91-test_pkey_check_data/sm2_bad_0.pem new file mode 100644 index 00000000000..5ad2bd184b7 --- /dev/null +++ b/test/recipes/91-test_pkey_check_data/sm2_bad_0.pem @@ -0,0 +1,4 @@ +-----BEGIN PRIVATE KEY----- +MEECAQAwEwYHKoZIzj0CAQYIKoEcz1UBgi0EJzAlAgEBBCD////+//////////// +////cgPfayHGBStTu/QJOdVBIw== +-----END PRIVATE KEY----- diff --git a/test/recipes/91-test_pkey_check_data/sm2_bad_1.pem b/test/recipes/91-test_pkey_check_data/sm2_bad_1.pem new file mode 100644 index 00000000000..d094d4d2964 --- /dev/null +++ b/test/recipes/91-test_pkey_check_data/sm2_bad_1.pem @@ -0,0 +1,4 @@ +-----BEGIN PRIVATE KEY----- +MEECAQAwEwYHKoZIzj0CAQYIKoEcz1UBgi0EJzAlAgEBBCD////+//////////// +////cgPfayHGBStTu/QJOdVBJA== +-----END PRIVATE KEY----- diff --git a/test/recipes/91-test_pkey_check_data/sm2_bad_max.pem b/test/recipes/91-test_pkey_check_data/sm2_bad_neg1.pem similarity index 100% rename from test/recipes/91-test_pkey_check_data/sm2_bad_max.pem rename to test/recipes/91-test_pkey_check_data/sm2_bad_neg1.pem -- 2.47.2