typedef struct digest_data_st {
/* Digest this test is for */
const EVP_MD *digest;
+ EVP_MD *fetched_digest;
/* Input to digest */
STACK_OF(EVP_TEST_BUFFER) *input;
/* Expected output */
{
DIGEST_DATA *mdat;
const EVP_MD *digest;
+ EVP_MD *fetched_digest;
- if ((digest = EVP_get_digestbyname(alg)) == NULL) {
+ if ((digest = fetched_digest = EVP_MD_fetch(NULL, alg, NULL)) == NULL
+ && (digest = EVP_get_digestbyname(alg)) == NULL) {
/* If alg has an OID assume disabled algorithm */
if (OBJ_sn2nid(alg) != NID_undef || OBJ_ln2nid(alg) != NID_undef) {
t->skip = 1;
return 0;
t->data = mdat;
mdat->digest = digest;
+ mdat->fetched_digest = fetched_digest;
+ if (fetched_digest != NULL)
+ TEST_info("%s is fetched", alg);
return 1;
}
sk_EVP_TEST_BUFFER_pop_free(mdat->input, evp_test_buffer_free);
OPENSSL_free(mdat->output);
+ EVP_MD_meth_free(mdat->fetched_digest);
}
static int digest_test_parse(EVP_TEST *t,
typedef struct cipher_data_st {
const EVP_CIPHER *cipher;
+ EVP_CIPHER *fetched_cipher;
int enc;
/* EVP_CIPH_GCM_MODE, EVP_CIPH_CCM_MODE or EVP_CIPH_OCB_MODE if AEAD */
int aead;
static int cipher_test_init(EVP_TEST *t, const char *alg)
{
const EVP_CIPHER *cipher;
+ EVP_CIPHER *fetched_cipher;
CIPHER_DATA *cdat;
int m;
- if ((cipher = EVP_get_cipherbyname(alg)) == NULL) {
+ if ((cipher = fetched_cipher = EVP_CIPHER_fetch(NULL, alg, NULL)) == NULL
+ && (cipher = EVP_get_cipherbyname(alg)) == NULL) {
/* If alg has an OID assume disabled algorithm */
if (OBJ_sn2nid(alg) != NID_undef || OBJ_ln2nid(alg) != NID_undef) {
t->skip = 1;
}
cdat = OPENSSL_zalloc(sizeof(*cdat));
cdat->cipher = cipher;
+ cdat->fetched_cipher = fetched_cipher;
cdat->enc = -1;
m = EVP_CIPHER_mode(cipher);
if (m == EVP_CIPH_GCM_MODE
cdat->aead = 0;
t->data = cdat;
+ if (fetched_cipher != NULL)
+ TEST_info("%s is fetched", alg);
return 1;
}
for (i = 0; i < AAD_NUM; i++)
OPENSSL_free(cdat->aad[i]);
OPENSSL_free(cdat->tag);
+ EVP_CIPHER_meth_free(cdat->fetched_cipher);
}
static int cipher_test_parse(EVP_TEST *t, const char *keyword,