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

Sporadic failure of ES256 #103

Closed
t089 opened this issue Oct 7, 2019 · 2 comments · Fixed by #104
Closed

Sporadic failure of ES256 #103

t089 opened this issue Oct 7, 2019 · 2 comments · Fixed by #104
Labels
bug Something isn't working

Comments

@t089
Copy link

t089 commented Oct 7, 2019

The patch in #102 introduced a subtle bug: In case where the r or s value of the signature is a "small" number, BN_bn2bin will actually produce less than 32 bytes per value. In this case some 0 padding is necessary to make sure that the final signature is 2 x 32 = 64 bytes long. See eg: kylebrowning/APNSwift#48

@t089
Copy link
Author

t089 commented Oct 7, 2019

To reproduce run
swift test --sanitize=address -c release -Xswiftc -enable-testing --disable-index-store
in a loop until it fails.

@tanner0101 tanner0101 added the bug Something isn't working label Oct 7, 2019
tanner0101 added a commit that referenced this issue Oct 7, 2019
@tanner0101
Copy link
Member

@t089 thanks for the helpful report. I've added a test case for this and fixed the issue here: vapor/jwt-kit#104

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants