Add documentation to find_ecdsa_private_key()
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
This commit is contained in:
parent
05132ed490
commit
17a0655c8d
1 changed files with 17 additions and 0 deletions
|
@ -823,12 +823,29 @@ static int pk_ecdsa_sig_asn1_from_psa( unsigned char *sig, size_t *sig_len,
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Locate an ECDSA privateKey in a RFC 5915, or SEC1 Appendix C.4 ASN.1 buffer
|
||||||
|
*
|
||||||
|
* [in/out] buf: ASN.1 buffer start as input - ECDSA privateKey start as output
|
||||||
|
* [in] end: ASN.1 buffer end
|
||||||
|
* [out] key_len: the ECDSA privateKey length in bytes
|
||||||
|
*/
|
||||||
static int find_ecdsa_private_key( unsigned char **buf, unsigned char *end,
|
static int find_ecdsa_private_key( unsigned char **buf, unsigned char *end,
|
||||||
size_t *key_len )
|
size_t *key_len )
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* RFC 5915, or SEC1 Appendix C.4
|
||||||
|
*
|
||||||
|
* ECPrivateKey ::= SEQUENCE {
|
||||||
|
* version INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1),
|
||||||
|
* privateKey OCTET STRING,
|
||||||
|
* parameters [0] ECParameters {{ NamedCurve }} OPTIONAL,
|
||||||
|
* publicKey [1] BIT STRING OPTIONAL
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
if( ( ret = mbedtls_asn1_get_tag( buf, end, &len,
|
if( ( ret = mbedtls_asn1_get_tag( buf, end, &len,
|
||||||
MBEDTLS_ASN1_CONSTRUCTED |
|
MBEDTLS_ASN1_CONSTRUCTED |
|
||||||
MBEDTLS_ASN1_SEQUENCE ) ) != 0 )
|
MBEDTLS_ASN1_SEQUENCE ) ) != 0 )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue