Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crypto/caam: bugfix: ECDSA r/s alignment
The previous assumption was that the CAAM did not like leading zero bytes on the R/S integers. The R/S values are DER encoded 2 complement integers that might have a leading zero byte if the MSB in the first byte is 1. That bit is the sign bit and ECDSA integers are always positive. The CAAM expects the R/S integers to have the following lengths: - 32 bytes for secp256r1 - 48 bytes for secp384r1 - 66 bytes for secp521r1 This means that sometimes the R/S values can be larger than what the CAAM expects and in that case the zero byte must be stripped. If however the encoded integer is shorter it must be prepended with zero bytes to match the above table.
- Loading branch information
1 parent
7b7609b
commit c61b074
Showing
1 changed file
with
49 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters