-
Notifications
You must be signed in to change notification settings - Fork 471
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
Fixing OpenSSL SHA2 incremental API integration #1454
Conversation
As we prefetch objects, it's probably worth exiting in case on initialization failure? |
Good point. And while we're at it, initialize only those objects that we'll also need (depending on OQS_USE_XYZ_OPENSSL). |
In theory, the problem is we need only some openssl-provided implementations for a particular application. So lack of SHA3 hashes shouldn't stop using SHA2. |
Agreed. Is anything in this PR precluding this? |
I don't know. |
Let's cross that bridge as and if we reach it. |
@@ -117,9 +117,9 @@ static int do_sha384(void) { | |||
OQS_SHA2_sha384_ctx state2; | |||
OQS_SHA2_sha384_inc_ctx_clone(&state2, &state); | |||
// hash with first state | |||
if (msg_len > 64) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rename this file to test_sha2.c
? I think that's more clearer than test_hash.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file name was not my choice. It's also embedded in test scripts. Are you sure you want this? Let's hope nobody else relies on this name...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep it as test_hash.c
; in principal one could add other hash algorithms to it. And in some sense, it does behave differently than test_aes.c
and test_sha3.c
: the AES and SHA-3 ones test against internal specified test vectors, where as test_hash.c
just computes the hash of the supplied input which needs to be externally checked against another implementation or test vector.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per Douglas' comment above, left unchanged in 5f8d02c
} | ||
EVP_DigestFinal_ex((EVP_MD_CTX *) state->ctx, out, &md_len); | ||
OQS_OPENSSL_GUARD(EVP_DigestFinal_ex((EVP_MD_CTX *) state->ctx, out, &md_len)); | ||
EVP_MD_CTX_free((EVP_MD_CTX *) state->ctx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would there be any value in setting state->ctx = NULL
after this as a precaution against double frees?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so changed in 5f8d02c
I'm okay to merge this. |
@xvzcf : Merge is currently blocked by your feedback. Please mark change requests/conversations as resolved or provide explicit approval. |
Possibly fixes open-quantum-safe/oqs-provider#168. Fixes issues in #1420.