[openssl] master update
Richard Levitte
levitte at openssl.org
Thu Sep 12 11:20:23 UTC 2019
The branch master has been updated
via 022351fdc3b01cfcb6c1b064c56d8a1393ed0ec8 (commit)
from 05c9c7b02d3e4e66fc0c0446af1116bd5b19f6dc (commit)
- Log -----------------------------------------------------------------
commit 022351fdc3b01cfcb6c1b064c56d8a1393ed0ec8
Author: Richard Levitte <levitte at openssl.org>
Date: Fri Jun 7 10:52:25 2019 +0200
test/evp_test.c: try fetching algorithms
Instead of relying on implicit fetches, try explicit fetches when available.
Reviewed-by: Paul Dale <paul.dale at oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9121)
-----------------------------------------------------------------------
Summary of changes:
test/evp_test.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/test/evp_test.c b/test/evp_test.c
index 69ccb9739e..b1194d2bc9 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -325,6 +325,7 @@ static int parse_bin(const char *value, unsigned char **buf, size_t *buflen)
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 */
@@ -336,8 +337,10 @@ static int digest_test_init(EVP_TEST *t, const char *alg)
{
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;
@@ -349,6 +352,9 @@ static int digest_test_init(EVP_TEST *t, const char *alg)
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;
}
@@ -358,6 +364,7 @@ static void digest_test_cleanup(EVP_TEST *t)
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,
@@ -472,6 +479,7 @@ static const EVP_TEST_METHOD digest_test_method = {
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;
@@ -494,10 +502,12 @@ typedef struct cipher_data_st {
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;
@@ -507,6 +517,7 @@ static int cipher_test_init(EVP_TEST *t, const char *alg)
}
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
@@ -520,6 +531,8 @@ static int cipher_test_init(EVP_TEST *t, const char *alg)
cdat->aead = 0;
t->data = cdat;
+ if (fetched_cipher != NULL)
+ TEST_info("%s is fetched", alg);
return 1;
}
@@ -535,6 +548,7 @@ static void cipher_test_cleanup(EVP_TEST *t)
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,
More information about the openssl-commits
mailing list