mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-23 15:55:10 +01:00
Some more EC pubkey parsing refactoring
Fix a bug in pk_rsa() and pk_ec() along the way
This commit is contained in:
parent
1c808a011c
commit
a2d4e644ac
5 changed files with 54 additions and 75 deletions
|
|
@ -212,6 +212,19 @@ int asn1_get_int( unsigned char **p,
|
|||
int asn1_get_bitstring( unsigned char **p, const unsigned char *end,
|
||||
asn1_bitstring *bs);
|
||||
|
||||
/**
|
||||
* Retrieve a bitstring ASN.1 tag without unused bits and its value.
|
||||
* Updates the pointer to the beginning of the bit/octet string.
|
||||
*
|
||||
* \param p The position in the ASN.1 data
|
||||
* \param end End of data
|
||||
* \param len Length of the actual bit/octect string in bytes
|
||||
*
|
||||
* \return 0 if successful or a specific ASN.1 error code.
|
||||
*/
|
||||
int asn1_get_bitstring_null( unsigned char **p, const unsigned char *end,
|
||||
size_t *len );
|
||||
|
||||
/**
|
||||
* Parses and splits an ASN.1 "SEQUENCE OF <tag>"
|
||||
* Updated the pointer to immediately behind the full sequence tag.
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
* \warning You must make sure the PK context actually holds an RSA context
|
||||
* before using this macro!
|
||||
*/
|
||||
#define pk_rsa( pk ) ( (rsa_context *) pk.data )
|
||||
#define pk_rsa( pk ) ( (rsa_context *) (pk).data )
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_ECP_C)
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
* \warning You must make sure the PK context actually holds an EC context
|
||||
* before using this macro!
|
||||
*/
|
||||
#define pk_ec( pk ) ( (ecp_keypair *) pk.data )
|
||||
#define pk_ec( pk ) ( (ecp_keypair *) (pk).data )
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue