diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2019-10-03 16:05:49 +1000 |
---|---|---|
committer | Shane Lontis <shane.lontis@oracle.com> | 2019-10-03 16:05:49 +1000 |
commit | 6a41156c20cbccc56c46bf6a5f7d2ac45cc1679a (patch) | |
tree | acb2b71b15d5fe8b962ffb6141967cb4a379c201 /test/evp_test.c | |
parent | 0399aba7e05ea9bb1a58bd2e1b164f353f6ef1c9 (diff) |
Add rc5 ciphers to default provider
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10006)
Diffstat (limited to 'test/evp_test.c')
-rw-r--r-- | test/evp_test.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/evp_test.c b/test/evp_test.c index 03581ff447..04519545f1 100644 --- a/test/evp_test.c +++ b/test/evp_test.c @@ -486,6 +486,7 @@ typedef struct cipher_data_st { unsigned char *key; size_t key_len; unsigned char *iv; + unsigned int rounds; size_t iv_len; unsigned char *plaintext; size_t plaintext_len; @@ -559,6 +560,13 @@ static int cipher_test_parse(EVP_TEST *t, const char *keyword, if (strcmp(keyword, "Key") == 0) return parse_bin(value, &cdat->key, &cdat->key_len); + if (strcmp(keyword, "Rounds") == 0) { + i = atoi(value); + if (i < 0) + return -1; + cdat->rounds = (unsigned int)i; + return 1; + } if (strcmp(keyword, "IV") == 0) return parse_bin(value, &cdat->iv, &cdat->iv_len); if (strcmp(keyword, "Plaintext") == 0) @@ -683,6 +691,15 @@ static int cipher_test_enc(EVP_TEST *t, int enc, } } + if (expected->rounds > 0) { + int rounds = (int)expected->rounds; + + if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_RC5_ROUNDS, rounds, NULL)) { + t->err = "INVALID_ROUNDS"; + goto err; + } + } + if (!EVP_CIPHER_CTX_set_key_length(ctx, expected->key_len)) { t->err = "INVALID_KEY_LENGTH"; goto err; |