-
Notifications
You must be signed in to change notification settings - Fork 38
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
Use fake pub key #163
Use fake pub key #163
Conversation
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.
fix & ship
break; | ||
|
||
default: | ||
break; |
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.
raise error?
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.
we can fatal assert here? curve being supported should already have been verified
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 thought about that, but seems like our API doesn't really raise error for the unknown enum eg: https://github.com/awslabs/aws-c-cal/blob/main/source/windows/bcrypt_ecc.c#L56. But, yeah, I can raise the error here.
break; | ||
|
||
default: | ||
break; |
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.
we can fatal assert here? curve being supported should already have been verified
We use SecCreateKeyWithData to create ECC key. Expected format for the key passed to that api is a byte buffer consisting of "0x04 | x | y | p", where x,y is public pair and p is private key.
Note that in some cases we only have private key (as we derived it as described above) and we need to construct SecKey from that.
In those cases our code just passes 0,0 point for x,y, i.e. "0x04 | 0 | 0 | p".
This used to work on Macs before 14, but in 14+ SecCreateKeyWithData returns error, which is reasonable since 0,0 is not a valid public point.
To get around the issue, we use a fake public key, which is a valid public point, but not matching the private key as a quick workaround.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.