Adapt asn1_write_algorithm_identifier() to params

This commit is contained in:
Manuel Pégourié-Gonnard 2013-09-12 02:17:54 +02:00 committed by Paul Bakker
parent 3837daec9e
commit edda9041fc
5 changed files with 41 additions and 36 deletions

View file

@ -115,17 +115,19 @@ int asn1_write_oid( unsigned char **p, unsigned char *start,
/**
* \brief Write an AlgorithmIdentifier sequence in ASN.1 format
* Note: function works backwards in data buffer
* Note: Uses NULL as algorithm parameter
*
* \param p reference to current position pointer
* \param start start of the buffer (for bounds-checking)
* \param oid the OID of the algorithm
* \param oid_len length of the OID
* \param par_len length of parameters, which must be already written.
* If 0, NULL parameters are added
*
* \return the length written or a negative error code
*/
int asn1_write_algorithm_identifier( unsigned char **p, unsigned char *start,
const char *oid, size_t oid_len );
const char *oid, size_t oid_len,
size_t par_len );
/**
* \brief Write a boolean tag (ASN1_BOOLEAN) and value in ASN.1 format

View file

@ -370,6 +370,18 @@ int oid_get_attr_short_name( const asn1_buf *oid, const char **short_name );
*/
int oid_get_pk_alg( const asn1_buf *oid, pk_type_t *pk_alg );
/**
* \brief Translate pk_type into PublicKeyAlgorithm OID
*
* \param pk_alg Public key type to look for
* \param oid place to store ASN.1 OID string pointer
* \param olen length of the OID
*
* \return 0 if successful, or POLARSSL_ERR_OID_NOT_FOUND
*/
int oid_get_oid_by_pk_alg( pk_type_t pk_alg,
const char **oid, size_t *olen );
#if defined(POLARSSL_ECP_C)
/**
* \brief Translate NamedCurve OID into an EC group identifier
@ -382,9 +394,9 @@ int oid_get_pk_alg( const asn1_buf *oid, pk_type_t *pk_alg );
int oid_get_ec_grp( const asn1_buf *oid, ecp_group_id *grp_id );
/**
* \brief Translate EC group identifier into NamedCurve OID
* \brief Translate EC group identifier into NamedCurve OID
*
* \param grp_id EC group identifier
* \param grp_id EC group identifier
* \param oid place to store ASN.1 OID string pointer
* \param olen length of the OID
*