summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2016-11-10 10:03:37 +0100
committerMatt Caswell <matt@openssl.org>2016-11-10 10:26:06 +0000
commit3f7452e45a3c3ca4194edb0723f53465e0d788a1 (patch)
tree4c59a6277a0c80a3f07e2567f49f610ea5d7dc3c /test
parent267d4fb1830ffd66fbc80a4e89e85ca67fdce3bb (diff)
Fix the evp_test Ctrl keyword processing
Skip the test if the value after ":" is a disabled algorithm, rather than failing it Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit dfbdf4abb7c62156f36925db95728142c4223225)
Diffstat (limited to 'test')
-rw-r--r--test/evp_test.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/test/evp_test.c b/test/evp_test.c
index a0dbffb2da..0c352d67ff 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -1246,7 +1246,8 @@ static void pkey_test_cleanup(struct evp_test *t)
EVP_PKEY_CTX_free(kdata->ctx);
}
-static int pkey_test_ctrl(EVP_PKEY_CTX *pctx, const char *value)
+static int pkey_test_ctrl(struct evp_test *t, EVP_PKEY_CTX *pctx,
+ const char *value)
{
int rv;
char *p, *tmpval;
@@ -1258,6 +1259,13 @@ static int pkey_test_ctrl(EVP_PKEY_CTX *pctx, const char *value)
if (p != NULL)
*p++ = 0;
rv = EVP_PKEY_CTX_ctrl_str(pctx, tmpval, p);
+ if (p != NULL && rv <= 0 && rv != -2) {
+ /* If p has an OID assume disabled algorithm */
+ if (OBJ_sn2nid(p) != NID_undef || OBJ_ln2nid(p) != NID_undef) {
+ t->skip = 1;
+ rv = 1;
+ }
+ }
OPENSSL_free(tmpval);
return rv > 0;
}
@@ -1271,7 +1279,7 @@ static int pkey_test_parse(struct evp_test *t,
if (strcmp(keyword, "Output") == 0)
return test_bin(value, &kdata->output, &kdata->output_len);
if (strcmp(keyword, "Ctrl") == 0)
- return pkey_test_ctrl(kdata->ctx, value);
+ return pkey_test_ctrl(t, kdata->ctx, value);
return 0;
}
@@ -1391,7 +1399,7 @@ static int pderive_test_parse(struct evp_test *t,
if (strcmp(keyword, "SharedSecret") == 0)
return test_bin(value, &kdata->output, &kdata->output_len);
if (strcmp(keyword, "Ctrl") == 0)
- return pkey_test_ctrl(kdata->ctx, value);
+ return pkey_test_ctrl(t, kdata->ctx, value);
return 0;
}
@@ -1812,7 +1820,7 @@ static int kdf_test_parse(struct evp_test *t,
if (strcmp(keyword, "Output") == 0)
return test_bin(value, &kdata->output, &kdata->output_len);
if (strncmp(keyword, "Ctrl", 4) == 0)
- return pkey_test_ctrl(kdata->ctx, value);
+ return pkey_test_ctrl(t, kdata->ctx, value);
return 0;
}