diff options
| author | Michael Brown | 2025-12-11 16:02:28 +0100 |
|---|---|---|
| committer | Michael Brown | 2025-12-11 16:09:58 +0100 |
| commit | fb1188936ca29af61709afd8b866ea55d4a05a67 (patch) | |
| tree | 5f319cca897d210a2e087ca8337633351726b414 /src/include | |
| parent | [crypto] Allow for addition of arbitrary Weierstrass curve points (diff) | |
| download | ipxe-fb1188936ca29af61709afd8b866ea55d4a05a67.tar.gz ipxe-fb1188936ca29af61709afd8b866ea55d4a05a67.tar.xz ipxe-fb1188936ca29af61709afd8b866ea55d4a05a67.zip | |
[crypto] Generalise rsa_parse_integer() to asn1_enter_unsigned()
ECDSA signature values and private keys are fixed-length unsigned
integers modulo N (the group order of the elliptic curve) and are
therefore most naturally represented in ASN.1 using ASN1_OCTET_STRING.
Private key representations do use ASN1_OCTET_STRING, but signature
values tend to use ASN1_INTEGER, which adds no value but does ensure
that the encoding becomes variable-length and requires handling a
pointless extra zero byte if the MSB of the unsigned value happens to
be set.
RSA also makes use of ASN1_INTEGER for modulus and exponent values.
Generalise the existing rsa_parse_integer() to asn1_enter_unsigned()
to allow this code to be reused for ECDSA.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/ipxe/asn1.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/ipxe/asn1.h b/src/include/ipxe/asn1.h index 641a1190d..914d42f57 100644 --- a/src/include/ipxe/asn1.h +++ b/src/include/ipxe/asn1.h @@ -488,6 +488,7 @@ extern int asn1_skip_any ( struct asn1_cursor *cursor ); extern int asn1_shrink_any ( struct asn1_cursor *cursor ); extern int asn1_enter_bits ( struct asn1_cursor *cursor, unsigned int *unused ); +extern int asn1_enter_unsigned ( struct asn1_cursor *cursor ); extern int asn1_boolean ( const struct asn1_cursor *cursor ); extern int asn1_integer ( const struct asn1_cursor *cursor, int *value ); extern int asn1_compare ( const struct asn1_cursor *cursor1, |
