-
Notifications
You must be signed in to change notification settings - Fork 833
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
Initial ASCON hash256 and AEAD128 support based on NIST SP 800-232 ipd #8307
base: master
Are you sure you want to change the base?
Conversation
bd2fa1e
to
e8b9bc4
Compare
retest this please |
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.
Nice work!
@@ -40,6 +40,8 @@ jobs: | |||
--enable-dtls-mtu', | |||
'--enable-dtls --enable-dtlscid --enable-dtls13 --enable-secure-renegotiation | |||
--enable-psk --enable-aesccm --enable-nullcipher CPPFLAGS=-DWOLFSSL_STATIC_RSA', | |||
'--enable-ascon', | |||
'--enable-ascon CPPFLAGS=-DWOLFSSL_ASCON_UNROLL', |
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.
WOLFSSL_ASCON_UNROLL
add well-formed but unknown macros to /tmp/workspace/PRB-multi-test-script/wolfssl/.wolfssl_known_macro_extras.
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.
Adding
|
||
/* KATs taken from https://github.com/ascon/ascon-c */ | ||
|
||
/* crypto_hash/asconhash256/LWC_HASH_KAT_256.txt |
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.
overlong lines added:
wolfcrypt/test/ascon-kat.h:32 { 0x0B, 0x3B, 0xE5, 0x85, 0x0F, 0x2F, 0x6B, 0x98, 0xCA, 0xF2, 0x9F, 0x8F, 0xDE, 0xA8, 0x9B, 0x64, 0xA1, 0xFA, 0x70, 0xAA, 0x24, 0x9B, 0x8F, 0x83, 0x9B, 0xD5, 0x3B, 0xAA, 0x30, 0x4D, 0x92, 0xB2 },
wolfcrypt/test/ascon-kat.h:33 { 0x07, 0x28, 0x62, 0x10, 0x35, 0xAF, 0x3E, 0xD2, 0xBC, 0xA0, 0x3B, 0xF6, 0xFD, 0xE9, 0x00, 0xF9, 0x45, 0x6F, 0x53, 0x30, 0xE4, 0xB5, 0xEE, 0x23, 0xE7, 0xF6, 0xA1, 0xE7, 0x02, 0x91, 0xBC, 0x80 },
wolfcrypt/test/ascon-kat.h:34 { 0x61, 0x15, 0xE7, 0xC9, 0xC4, 0x08, 0x1C, 0x27, 0x97, 0xFC, 0x8F, 0xE1, 0xBC, 0x57, 0xA8, 0x36, 0xAF, 0xA1, 0xC5, 0x38, 0x1E, 0x55, 0x6D, 0xD5, 0x83, 0x86, 0x0C, 0xA2, 0xDF, 0xB4, 0x8D, 0xD2 },
wolfcrypt/test/ascon-kat.h:35 { 0x26, 0x5A, 0xB8, 0x9A, 0x60, 0x9F, 0x5A, 0x05, 0xDC, 0xA5, 0x7E, 0x83, 0xFB, 0xBA, 0x70, 0x0F, 0x9A, 0x2D, 0x2C, 0x42, 0x11, 0xBA, 0x4C, 0xC9, 0xF0, 0xA1, 0xA3, 0x69, 0xE1, 0x7B, 0x91, 0x5C },
wolfcrypt/test/ascon-kat.h:36 { 0xD7, 0xE4, 0xC7, 0xED, 0x9B, 0x8A, 0x32, 0x5C, 0xD0, 0x8B, 0x9E, 0xF2, 0x59, 0xF8, 0x87, 0x70, 0x54, 0xEC, 0xD8, 0x30, 0x4F, 0xE1, 0xB2, 0xD7, 0xFD, 0x84, 0x71, 0x37, 0xDF, 0x67, 0x27, 0xEE },
wolfcrypt/test/ascon-kat.h:37 { 0xC7, 0xB2, 0x89, 0x62, 0xD4, 0xF5, 0xC2, 0x21, 0x1F, 0x46, 0x6F, 0x83, 0xD3, 0xC5, 0x7A, 0xE1, 0x50, 0x43, 0x87, 0xE2, 0xA3, 0x26, 0x94, 0x97, 0x47, 0xA8, 0x37, 0x64, 0x47, 0xA6, 0xBB, 0x51 },
wolfcrypt/test/ascon-kat.h:38 { 0xDC, 0x0C, 0x67, 0x48, 0xAF, 0x8F, 0xFE, 0x63, 0xE1, 0x08, 0x4A, 0xA3, 0xE5, 0x78, 0x6A, 0x19, 0x46, 0x85, 0xC8, 0x8C, 0x21, 0x34, 0x8B, 0x29, 0xE1, 0x84, 0xFB, 0x50, 0x40, 0x97, 0x03, 0xBC },
wolfcrypt/test/ascon-kat.h:39 { 0x3E, 0x4D, 0x27, 0x3B, 0xA6, 0x9B, 0x3B, 0x9C, 0x53, 0x21, 0x61, 0x07, 0xE8, 0x8B, 0x75, 0xCD, 0xBE, 0xED, 0xBC, 0xBF, 0x8F, 0xAF, 0x02, 0x19, 0xC3, 0x92, 0x8A, 0xB6, 0x2B, 0x11, 0x65, 0x77 },
[...and more...]
check-source-text fail_K```
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.
I think its acceptable to have overlong lines in the KAT test data. I'm asking @douzzer if there is any way to suppress this warning.
wolfcrypt/src/ascon.c
Outdated
@@ -0,0 +1,527 @@ | |||
/* ascon.c | |||
* | |||
* Copyright (C) 2006-2023 wolfSSL Inc. |
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.
2024 (for a few more days)
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.
Making it 2025.
wolfcrypt/src/ascon.c
Outdated
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA | ||
*/ | ||
|
||
#ifdef HAVE_ASCON |
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.
You need config.h and then settings.h above HAVE_ASCON
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.
Fixing
wolfcrypt/src/ascon.c
Outdated
|
||
wc_AsconHash256* wc_AsconHash256_New(void) | ||
{ | ||
wc_AsconHash256* ret = (wc_AsconHash256*)XMALLOC(sizeof(wc_AsconHash256), NULL, |
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.
wolfcrypt/src/ascon.c:179 wc_AsconHash256* ret = (wc_AsconHash256*)XMALLOC(sizeof(wc_AsconHash256), NULL,
wolfcrypt/src/ascon.c:281 wc_AsconAEAD128 *ret = (wc_AsconAEAD128*) XMALLOC(sizeof(wc_AsconAEAD128), NULL,```
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.
Fixing.
Implemented based on the NIST Initial Public Draft "NIST SP 800-232 ipd". Testing based on KAT's available at https://github.com/ascon/ascon-c. Added configuration for testing in github action.
Implemented based on the NIST Initial Public Draft "NIST SP 800-232 ipd". Testing based on KAT's available at https://github.com/ascon/ascon-c. Added configuration for testing in github action.