Skip to content

Initial implementation of SSHKDF for wolfprovider#382

Open
ColtonWilley wants to merge 2 commits intowolfSSL:masterfrom
ColtonWilley:wp_sshkdf
Open

Initial implementation of SSHKDF for wolfprovider#382
ColtonWilley wants to merge 2 commits intowolfSSL:masterfrom
ColtonWilley:wp_sshkdf

Conversation

@ColtonWilley
Copy link
Copy Markdown
Contributor

Initial implementation of SSHKDF for wolfprovider

@ColtonWilley ColtonWilley requested a review from padelsbach April 2, 2026 17:09
/* Test input shared secret K. */
unsigned char inKey[] = {
0x00, 0x00, 0x00, 0x80,
0x55, 0xba, 0xe9, 0x31, 0xc0, 0x7f, 0xd8, 0x24,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we add a test case with the MSB set to test the sign extension path?

* its own mpint encoding internally, so strip the caller's encoding
* to avoid double-encoding. */
if (rawKeySz >= 4) {
word32 mpintLen = ((word32)rawKey[0] << 24) |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

wp_kbkdf.c uses this approach for endianness swap. Consider matching it here:

/* We are not guaranteed to have these available from wolfssl, so implement
 * them here */
static void wp_c32toa(word32 wc_u32, byte* c) {
#ifdef WOLFSSL_USE_ALIGN
    c[0] = (byte)((wc_u32 >> 24) & 0xff);
    c[1] = (byte)((wc_u32 >> 16) & 0xff);
    c[2] = (byte)((wc_u32 >>  8) & 0xff);
    c[3] = (byte) (wc_u32 &        0xff);
#elif defined(LITTLE_ENDIAN_ORDER)
    *(word32*)c = ByteReverseWord32(wc_u32);
#else
    *(word32*)c = wc_u32;
#endif

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.

2 participants