Skip to content
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

Add Dilithium to genkey, sign-verify and gen-sig-ver test #150

Merged
merged 4 commits into from
Nov 1, 2024

Conversation

Yu-Ma28051503
Copy link
Contributor

No description provided.

@wolfSSL-Bot
Copy link

Can one of the admins verify this patch?

@JacobBarthelmeh
Copy link
Contributor

OK to test

@JacobBarthelmeh JacobBarthelmeh self-assigned this Sep 16, 2024
Copy link
Contributor

@JacobBarthelmeh JacobBarthelmeh left a comment

Choose a reason for hiding this comment

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

Thanks @Yu-Ma28051503, great start on this! Please add a test case to the tests/ directory. Possibly in genkey_sign_verify sub-folder or a new folder if wanted for Dlithium tests.

int ret = WOLFCLU_SUCCESS;

int fNameSz;
int fExtSz = 6;
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a comment on why 6 is the value chosen here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This value is sizeof of file extension such as ".priv\0" and ".pub\0\0".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed it

int keySz, int level, int withAlg, int keyType)
{
#ifdef HAVE_DILITHIUM
dilithium_key key;
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets start this out with supporting small stack. WOLFSSL_SMALL_STACK.

Copy link
Contributor

Choose a reason for hiding this comment

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

Having the compile time option of putting large variables on the heap instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed it

/* set up the file name output buffer */
if (ret == WOLFCLU_SUCCESS) {
fNameSz = (int)XSTRLEN(fName);
fOutNameBuf = (char*)XMALLOC(fNameSz + fExtSz, HEAP_HINT,
Copy link
Contributor

Choose a reason for hiding this comment

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

Sanity checks on the size before malloc. If fNameSz + fExtSz wraps around int type, fNameSz for some reason is negative, possibly upper bounds to avoid an abuse but is trickier to make a great upper bounds value here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed it

@Yu-Ma28051503
Copy link
Contributor Author

Yu-Ma28051503 commented Sep 17, 2024

Thank you to test.
I'm sorry that a new commit was accidentally made without fixing the modifications.
So please wait a little longer for the fixes.

@Yu-Ma28051503 Yu-Ma28051503 changed the title Add Dlithium to genkey Add Dlithium to genkey. sign-verify and gen-sig-ver test Sep 17, 2024
@Yu-Ma28051503 Yu-Ma28051503 changed the title Add Dlithium to genkey. sign-verify and gen-sig-ver test Add Dlithium to genkey, sign-verify and gen-sig-ver test Sep 17, 2024
@Yu-Ma28051503 Yu-Ma28051503 changed the title Add Dlithium to genkey, sign-verify and gen-sig-ver test Add Dilithium to genkey, sign-verify and gen-sig-ver test Sep 17, 2024
@JacobBarthelmeh JacobBarthelmeh merged commit b668228 into wolfSSL:main Nov 1, 2024
1 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants