-
Notifications
You must be signed in to change notification settings - Fork 836
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!
|
||
/* 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.
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.
fail_K
is the "unknown macros" subtest. the overlong-line notes are purely informational -- indeed it would just be silly to make that a hard warning.
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.
@@ -6044,6 +6044,17 @@ then | |||
AM_CFLAGS="$AM_CFLAGS -DHAVE_XCHACHA" | |||
fi | |||
|
|||
# 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.
Should it be part of experimental or all yet?
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.
Its a complete but limited implementation. Its fair to list it under experimental for now. Should I require WOLFSSL_EXPERIMENTAL_SETTINGS
to enable ASCON for now?
} | ||
} | ||
|
||
int wc_AsconHash256_Init(wc_AsconHash256* a) |
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.
Should this have heap hint and devId for future API planning or just add an ex version when that time comes? Same for wc_AsconHash256_New
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 those options fit more into an _ex
version of the API. This one should be the simplest case that should cover most use cases.
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.