Adapt asn1_write_algorithm_identifier() to params
diff --git a/include/polarssl/asn1write.h b/include/polarssl/asn1write.h
index 1eb7e69..d7f7b52 100644
--- a/include/polarssl/asn1write.h
+++ b/include/polarssl/asn1write.h
@@ -115,17 +115,19 @@
/**
* \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
diff --git a/include/polarssl/oid.h b/include/polarssl/oid.h
index 6981237..ba0ce7d 100644
--- a/include/polarssl/oid.h
+++ b/include/polarssl/oid.h
@@ -370,6 +370,18 @@
*/
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_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
*