t->nskip++;
} else {
/* run the test */
- t->err = NULL;
- if (t->meth->run_test(t) != 1) {
+ if (t->err == NULL && t->meth->run_test(t) != 1) {
fprintf(stderr, "%s test error line %d\n",
t->meth->name, t->start_line);
return 0;
return 1;
}
t.in = in;
+ t.err = NULL;
while (BIO_gets(in, buf, sizeof(buf))) {
t.line++;
if (!process_test(&t, buf, 0))
if (!kdata->ctx)
return 0;
if (keyopinit(kdata->ctx) <= 0)
- return 0;
+ t->err = "KEYOP_INIT_ERROR";
return 1;
}
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) {
+ if (rv == -2) {
+ t->err = "PKEY_CTRL_INVALID";
+ rv = 1;
+ } else if (p != NULL && rv <= 0) {
+ /* If p has an OID and lookup fails assume disabled algorithm */
+ int nid = OBJ_sn2nid(p);
+ if (nid == NID_undef)
+ nid = OBJ_ln2nid(p);
+ if ((nid != NID_undef) && EVP_get_digestbynid(nid) == NULL &&
+ EVP_get_cipherbynid(nid) == NULL) {
t->skip = 1;
rv = 1;
+ } else {
+ t->err = "PKEY_CTRL_ERROR";
+ rv = 1;
}
}
OPENSSL_free(tmpval);
Input = "0123456789ABCDEF1234"
Output = c09d402423cbf233d26cae21f954547bc43fe80fd41360a0336cfdbe9aedad05bef6fd2eaee6cd60089a52482d4809a238149520df3bdde4cb9e23d9307b05c0a6f327052325a29adf2cc95b66523be7024e2a585c3d4db15dfbe146efe0ecdc0402e33fe5d40324ee96c5c3edd374a15cdc0f5d84aa243c0f07e188c6518fbfceae158a9943be398e31097da81b62074f626eff738be6160741d5a26957a482b3251fd85d8df78b98148459de10aa93305dbb4a5230aa1da291a9b0e481918f99b7638d72bb687f97661d304ae145d64a474437a4ef39d7b8059332ddeb07e92bf6e0e3acaf8afedc93795e4511737ec1e7aab6d5bc9466afc950c1c17b48ad
+# Illegal RSA key derivation
+Derive = RSA-2048
+Result = KEYOP_INIT_ERROR
+
+# Invalid ctrl
+Sign = RSA-2048
+Ctrl = rsa_mgf1_md:sha1
+Result = PKEY_CTRL_INVALID
+
# EC tests
Verify = P-256
Derive=Bob-25519
PeerKey=Alice-25519-PUBLIC
SharedSecret=4A5D9D5BA4CE2DE1728E3BF480350F25E07E21C947D19E3376F09B3C1E161742
+
+# Illegal sign/verify operations with X25519 key
+
+Sign=Alice-25519
+Result = KEYOP_INIT_ERROR
+
+Verify=Alice-25519
+Result = KEYOP_INIT_ERROR