-
Notifications
You must be signed in to change notification settings - Fork 14
Fix/hkdf null salt openssl3 #76
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,5 +1,5 @@ | ||||||
| /** | ||||||
| * Copyright 2020 Comcast Cable Communications Management, LLC | ||||||
| * Copyright 2020-2026 Comcast Cable Communications Management, LLC | ||||||
| * | ||||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
| * you may not use this file except in compliance with the License. | ||||||
|
|
@@ -393,12 +393,12 @@ static Sec_Result hkdf(SEC_BYTE* key, SEC_SIZE key_len, SEC_BYTE* out, const SEC | |||||
| return SEC_RESULT_FAILURE; | ||||||
| } | ||||||
|
|
||||||
| #if OPENSSL_VERSION_NUMBER >= 0x30000000 | ||||||
| if (EVP_PKEY_CTX_set1_hkdf_salt(pctx, reinterpret_cast<const unsigned char*>(use_salt ? "salt" : nullptr), | ||||||
| // OpenSSL 3.x OSSL_PARAM_construct_octet_string() rejects NULL data pointer | ||||||
| // even when length is 0, causing EVP_PKEY_CTX_set1_hkdf_salt() to fail. | ||||||
| // Pass "" instead of nullptr to satisfy the non-NULL check. | ||||||
| if (EVP_PKEY_CTX_set1_hkdf_salt(pctx, | ||||||
| reinterpret_cast<const unsigned char*>(use_salt ? "salt" : ""), | ||||||
| use_salt ? 4 : 0) <= 0) { | ||||||
|
Comment on lines
+396
to
401
|
||||||
| use_salt ? 4 : 0) <= 0) { | |
| use_salt ? sizeof("salt") - 1 : 0) <= 0) { |
Uh oh!
There was an error while loading. Please reload this page.