Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkcs11-tool testsuite improvements #1150

Merged
merged 2 commits into from
Sep 17, 2017

Conversation

Jakuje
Copy link
Member

@Jakuje Jakuje commented Sep 13, 2017

The randomization should not happen for the RSA_PKCS mechanism, since the data is already filled with ASN1 encoded DigestInfo + SHA1 hash.

The second commit improves handling of decryption testcases to get reasonable reports in single stream (not writing first part of line to stdout and the second to stderr) and avoids hard-failures with OAEP mechanisms (CKR_MECHANISM_PARAM_INVALID).

Checklist
  • Tested with the following card: YubiHSM2 with its own PKCS#11 module
    • tested PKCS#11

@@ -4847,7 +4847,7 @@ static int encrypt_decrypt(CK_SESSION_HANDLE session,
return 0;

if (EVP_PKEY_size(pkey) > (int)sizeof(encrypted)) {
fprintf(stderr, "Ciphertext buffer too small\n");
printf("Ciphertext buffer too small\n");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why print errors on stdout instead of stderr?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not an error, but part of the "testsuite report", which starts on line 4843, does not end with a newline and expects some result to be added (which is in this case "error").

printf("    %s: ", p11_mechanism_to_name(mech_type));

We can go the other way round and print everything on the stderr too. But if part is printed to the first stream and the second part is printed to the second stream, the formatting is undefined.

@frankmorgner
Copy link
Member

OK, thanks for the clearification

@frankmorgner frankmorgner merged commit 41b55b9 into OpenSC:master Sep 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants