-
Notifications
You must be signed in to change notification settings - Fork 876
SRTP/SRTCP KDF: add implementation #6888
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
retest this please |
Output keys remain (partially) uninitialized if too large: #include <wolfssl/options.h>
#include <wolfssl/wolfcrypt/kdf.h>
#define CF_CHECK_EQ(expr, res) if ( (expr) != (res) ) { goto end; }
int main(void)
{
uint8_t key[32] = {0};
uint8_t salt[10] = {0};
uint8_t index[6] = {0};
#define KEYSIZE 256
uint8_t* key1 = malloc(KEYSIZE);
uint8_t* key2 = malloc(KEYSIZE);
uint8_t* key3 = malloc(KEYSIZE);
CF_CHECK_EQ(
wc_SRTP_KDF(
key, sizeof(key),
salt, sizeof(salt),
-1,
index,
key1, KEYSIZE,
key2, KEYSIZE,
key3, KEYSIZE), 0);
{
FILE* fp = fopen("/dev/null", "wb");
fwrite(key1, KEYSIZE, 1, fp);
fwrite(key2, KEYSIZE, 1, fp);
fwrite(key3, KEYSIZE, 1, fp);
fclose(fp);
}
free(key1);
free(key2);
free(key3);
end:
return 0;
}
Would it be possible to return error in this case to prevent accidental misuse? |
Thanks Guido. I used the wrong type for the keySz in the internal function. Let us know if there is anything else. Sean :-) |
Confirmed fixed, and I cannot find any other bugs with this code at the moment. |
Add implementation of SRTP KDF and SRTCP KDF. One shot APIs compatible with SP 800-135 and ACVP testing. Tests added to test.c. Benchmarking added. Doxygen added.
JacobBarthelmeh
approved these changes
Nov 7, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add implementation of SRTP KDF and SRTCP KDF.
One shot APIs compatible with SP 800-135 and ACVP testing. Tests added to test.c.
Benchmarking added.
Doxygen added.
Testing
./configure --enable-srtp-kdf
Tests added to test.c
Checklist