test_suite_rsa.function: remove redundant test cases

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
This commit is contained in:
Yanray Wang 2023-03-15 16:55:32 +08:00
parent 644b901a4c
commit ac36115355
2 changed files with 3 additions and 71 deletions

View file

@ -7,46 +7,6 @@ rsa_init_free:0
RSA init-free-init-free
rsa_init_free:1
RSA retrieves context with PKCS#1 v1.5 and None MD
depends_on:MBEDTLS_PKCS1_V15
# MBEDTLS_RSA_PKCS_V15:MBEDTLS_MD_NONE
rsa_ctx_param_validation:0:0
RSA retrieves context with PKCS#1 v1.5 and MD5
depends_on:MBEDTLS_PKCS1_V15:MBEDTLS_HAS_ALG_MD5_VIA_LOWLEVEL_OR_PSA
# MBEDTLS_RSA_PKCS_V15:MBEDTLS_MD_MD5
rsa_ctx_param_validation:0:1
RSA retrieves context with PKCS#1 v1.5 and SHA-256
depends_on:MBEDTLS_PKCS1_V15:MBEDTLS_HAS_ALG_SHA_256_VIA_LOWLEVEL_OR_PSA
# MBEDTLS_RSA_PKCS_V15:MBEDTLS_MD_SHA256
rsa_ctx_param_validation:0:4
RSA retrieves context with PKCS#1 v1.5 and RIPEMD-160
depends_on:MBEDTLS_PKCS1_V15:MBEDTLS_HAS_ALG_RIPEMD160_VIA_LOWLEVEL_OR_PSA
# MBEDTLS_RSA_PKCS_V15:MBEDTLS_MD_RIPEMD160
rsa_ctx_param_validation:0:7
RSA retrieves context with PKCS#1 v2.1 and SHA1
depends_on:MBEDTLS_PKCS1_V21:MBEDTLS_HAS_ALG_SHA_1_VIA_LOWLEVEL_OR_PSA
# MBEDTLS_RSA_PKCS_V21:MBEDTLS_MD_SHA1
rsa_ctx_param_validation:1:2
RSA retrieves context with PKCS#1 v2.1 and SHA224
depends_on:MBEDTLS_PKCS1_V21:MBEDTLS_HAS_ALG_SHA_224_VIA_LOWLEVEL_OR_PSA
# MBEDTLS_RSA_PKCS_V21:MBEDTLS_MD_SHA224
rsa_ctx_param_validation:1:3
RSA retrieves context with PKCS#1 v2.1 and SHA384
depends_on:MBEDTLS_PKCS1_V21:MBEDTLS_HAS_ALG_SHA_384_VIA_LOWLEVEL_OR_PSA
# MBEDTLS_RSA_PKCS_V21:MBEDTLS_MD_SHA384
rsa_ctx_param_validation:1:5
RSA retrieves context with PKCS#1 v2.1 and SHA512
depends_on:MBEDTLS_PKCS1_V21:MBEDTLS_HAS_ALG_SHA_512_VIA_LOWLEVEL_OR_PSA
# MBEDTLS_RSA_PKCS_V21:MBEDTLS_MD_SHA512
rsa_ctx_param_validation:1:6
RSA PKCS1 Verify v1.5 CAVS #1
depends_on:MBEDTLS_HAS_ALG_SHA_1_VIA_LOWLEVEL_OR_PSA:MBEDTLS_PKCS1_V15
# Good padding but wrong hash

View file

@ -21,22 +21,19 @@ void rsa_invalid_param()
mbedtls_rsa_init(&ctx);
TEST_EQUAL(mbedtls_rsa_get_padding_mode(&ctx), MBEDTLS_RSA_PKCS_V15);
TEST_EQUAL(mbedtls_rsa_get_hash_id(&ctx), MBEDTLS_MD_NONE);
TEST_EQUAL(mbedtls_rsa_set_padding(&ctx,
invalid_padding,
MBEDTLS_MD_NONE),
MBEDTLS_ERR_RSA_INVALID_PADDING);
TEST_EQUAL(mbedtls_rsa_get_padding_mode(&ctx), MBEDTLS_RSA_PKCS_V15);
TEST_EQUAL(mbedtls_rsa_get_hash_id(&ctx), MBEDTLS_MD_NONE);
TEST_EQUAL(mbedtls_rsa_set_padding(&ctx,
MBEDTLS_RSA_PKCS_V21,
invalid_hash_id),
MBEDTLS_ERR_RSA_INVALID_PADDING);
TEST_EQUAL(mbedtls_rsa_get_padding_mode(&ctx), MBEDTLS_RSA_PKCS_V15);
TEST_EQUAL(mbedtls_rsa_get_hash_id(&ctx), MBEDTLS_MD_NONE);
TEST_EQUAL(mbedtls_rsa_pkcs1_sign(&ctx, NULL,
NULL, MBEDTLS_MD_NONE,
buf_len,
@ -64,9 +61,6 @@ void rsa_invalid_param()
MBEDTLS_RSA_PKCS_V15,
MBEDTLS_MD_NONE),
MBEDTLS_ERR_RSA_INVALID_PADDING);
TEST_EQUAL(mbedtls_rsa_get_padding_mode(&ctx), MBEDTLS_RSA_PKCS_V15);
TEST_EQUAL(mbedtls_rsa_get_hash_id(&ctx), MBEDTLS_MD_NONE);
#endif
#if defined(MBEDTLS_PKCS1_V15)
@ -100,9 +94,6 @@ void rsa_invalid_param()
MBEDTLS_RSA_PKCS_V21,
MBEDTLS_MD_NONE),
MBEDTLS_ERR_RSA_INVALID_PADDING);
TEST_EQUAL(mbedtls_rsa_get_padding_mode(&ctx), MBEDTLS_RSA_PKCS_V15);
TEST_EQUAL(mbedtls_rsa_get_hash_id(&ctx), MBEDTLS_MD_NONE);
#endif
#if defined(MBEDTLS_PKCS1_V21)
@ -170,25 +161,6 @@ void rsa_init_free(int reinit)
}
/* END_CASE */
/* BEGIN_CASE */
void rsa_ctx_param_validation(int padding_mode, int hash_id)
{
mbedtls_rsa_context ctx;
mbedtls_rsa_init(&ctx);
TEST_ASSERT(mbedtls_rsa_set_padding(&ctx,
padding_mode,
hash_id) == 0);
TEST_ASSERT(mbedtls_rsa_get_padding_mode(&ctx) == padding_mode);
TEST_ASSERT(mbedtls_rsa_get_hash_id(&ctx) == hash_id);
exit:
mbedtls_rsa_free(&ctx);
}
/* END_CASE */
/* BEGIN_CASE */
void mbedtls_rsa_pkcs1_sign(data_t *message_str, int padding_mode,
int digest, int mod, char *input_P,