summaryrefslogtreecommitdiffstats
path: root/test/evp_test.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2019-08-23 17:41:23 +0200
committerRichard Levitte <levitte@openssl.org>2019-08-23 18:25:12 +0200
commitf42c225d7f9a0bce0bf46103343402d3f0ad742f (patch)
tree3efb66d8808dfe966c4ce3a327df0d16a2a268be /test/evp_test.c
parent00372d7551ccf41ddb4fe8f00d62923e4dc65574 (diff)
test/evp_test.c: distinguish parsing errors from processing errors
Parsing functions are at liberty to return: 1: when parsing on processing of the parsed value succeeded 0: when the parsed keyword is unknown -1: when the parsed value processing failed Some parsing functions didn't do this quite right, they returned 0 when they should have returned -1, causing a message like this: Line 123: unknown keyword PeerKey When this message (which is displayed when the parsing function returns -1) would have been more appropriate: Line 123: error processing keyword PeerKey = ffdhe2048-2-pub Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/9682)
Diffstat (limited to 'test/evp_test.c')
-rw-r--r--test/evp_test.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/evp_test.c b/test/evp_test.c
index 76a0231c8b..2dfa8d0318 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -557,7 +557,7 @@ static int cipher_test_parse(EVP_TEST *t, const char *keyword,
if (cdat->aad[i] == NULL)
return parse_bin(value, &cdat->aad[i], &cdat->aad_len[i]);
}
- return 0;
+ return -1;
}
if (strcmp(keyword, "Tag") == 0)
return parse_bin(value, &cdat->tag, &cdat->tag_len);
@@ -567,7 +567,7 @@ static int cipher_test_parse(EVP_TEST *t, const char *keyword,
else if (strcmp(value, "FALSE") == 0)
cdat->tag_late = 0;
else
- return 0;
+ return -1;
return 1;
}
}
@@ -578,7 +578,7 @@ static int cipher_test_parse(EVP_TEST *t, const char *keyword,
else if (strcmp(value, "DECRYPT") == 0)
cdat->enc = 0;
else
- return 0;
+ return -1;
return 1;
}
return 0;
@@ -1016,7 +1016,7 @@ static int mac_test_parse(EVP_TEST *t,
if (strcmp(keyword, "Algorithm") == 0) {
mdata->alg = OPENSSL_strdup(value);
if (!mdata->alg)
- return 0;
+ return -1;
return 1;
}
if (strcmp(keyword, "Input") == 0)
@@ -1533,9 +1533,9 @@ static int pderive_test_parse(EVP_TEST *t,
if (strcmp(keyword, "PeerKey") == 0) {
EVP_PKEY *peer;
if (find_key(&peer, value, public_keys) == 0)
- return 0;
+ return -1;
if (EVP_PKEY_derive_set_peer(kdata->ctx, peer) <= 0)
- return 0;
+ return -1;
return 1;
}
if (strcmp(keyword, "SharedSecret") == 0)
@@ -2529,7 +2529,7 @@ static int digestsigver_test_parse(EVP_TEST *t,
}
if (strcmp(keyword, "Ctrl") == 0) {
if (mdata->pctx == NULL)
- return 0;
+ return -1;
return pkey_test_ctrl(t, mdata->pctx, value);
}
return 0;