From: Nicola Tuveri Date: Tue, 10 Nov 2020 10:28:52 +0000 (+0200) Subject: [test][pkey_check] Add more invalid SM2 key tests X-Git-Tag: openssl-3.0.0-alpha11~153 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1330093b9c7e0325ca76589fb9ace5b664830c6d;p=thirdparty%2Fopenssl.git [test][pkey_check] Add more invalid SM2 key tests Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/13359) --- 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