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 secp256r1 support #7

Merged
merged 10 commits into from
Aug 29, 2023
Merged

Add secp256r1 support #7

merged 10 commits into from
Aug 29, 2023

Conversation

contrun
Copy link
Collaborator

@contrun contrun commented Aug 13, 2023

No description provided.

add tests for secp256r1

fix secp256r1 test

create separated auth programs

remove lazy static

remove verbose outputs, add more comments

add docs for secp256r1
Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
c/auth.c Outdated Show resolved Hide resolved
docs/secp256r1.md Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
c/auth_libecc.c Outdated Show resolved Hide resolved
c/auth_libecc.c Outdated Show resolved Hide resolved
c/secp256r1.h Outdated
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
MUST_HAVE(aff_buf_len == affine_buffer_size);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add a failed test case to trigger MUST_HAVE

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The aff_buf_len is actually set from

CHECK(secp256r1_verify_signature(signature_ptr, SECP256R1_SIGNATURE_SIZE, pub_key_ptr, SECP256R1_PUBKEY_SIZE, msg, msg_len ));
, which means that aff_buf_len is always SECP256R1_PUBKEY_SIZE. I refactor the code to return an error code instead of using MUST_HAVE. The functionailty of MUST_HAVE is been checked by manually flipping the condition here
MUST_HAVE(ec_name != NULL);
and running the tests which failed as expect.

docs/secp256r1.md Outdated Show resolved Hide resolved
@contrun contrun force-pushed the secp256r1 branch 2 times, most recently from 10410f0 to c41c999 Compare August 25, 2023 01:05
c/ckb_auth.h Outdated Show resolved Hide resolved
@XuJiandong XuJiandong merged commit 8cfecf8 into nervosnetwork:main Aug 29, 2023
1 check passed
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