From 39e53c2b7c29e4ccf1fb01e1c20dce0e04f95058 Mon Sep 17 00:00:00 2001 From: Juliusz Sosinowicz Date: Wed, 6 Jul 2022 11:59:29 +0200 Subject: [PATCH] Add wc_EccPublicKeyToDer_ex doxygen entry --- configure.ac | 2 +- doc/dox_comments/header_files/asn_public.h | 44 ++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index ddef3c78d..7867a0545 100644 --- a/configure.ac +++ b/configure.ac @@ -4823,7 +4823,7 @@ AC_ARG_ENABLE([pkcs7], [ ENABLED_PKCS7=$enableval ], [ ENABLED_PKCS7=no ] ) - + if test "x$ENABLED_WPAS_DPP" = "xyes" then ENABLED_PKCS7=yes diff --git a/doc/dox_comments/header_files/asn_public.h b/doc/dox_comments/header_files/asn_public.h index 77decc8bc..b493cc4b8 100644 --- a/doc/dox_comments/header_files/asn_public.h +++ b/doc/dox_comments/header_files/asn_public.h @@ -1452,6 +1452,50 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx, int wc_EccPublicKeyToDer(ecc_key* key, byte* output, word32 inLen, int with_AlgCurve); +/*! + \ingroup ASN + + \brief This function converts the ECC public key to DER format. It + returns the size of buffer used. The public ECC key in DER format is stored + in output buffer. with_AlgCurve is a flag for when to include a header that + has the Algorithm and Curve information. The comp parameter + + \return >0 Success, size of buffer used + \return BAD_FUNC_ARG Returned if output or key is null. + \return LENGTH_ONLY_E Error in getting ECC public key size. + \return BUFFER_E Returned when output buffer is too small. + + \param key Pointer to ECC key + \param output Pointer to output buffer to write to. + \param inLen Size of buffer. + \param with_AlgCurve a flag for when to include a header that has the + Algorithm and Curve information. + \param comp Boolean value. If true the ECC public key will be written in + compressed form. If false it will be written in an uncompressed format. + + _Example_ + \code + ecc_key key; + wc_ecc_init(&key); + WC_WC_RNG rng; + wc_InitRng(&rng); + wc_ecc_make_key(&rng, 24, &key); + int derSz = // Some appropriate size for der; + byte der[derSz]; + + // Write out a compressed ECC key + if(wc_EccPublicKeyToDer_ex(&key, der, derSz, 1, 1) < 0) + { + // Error converting ECC public key to der + } + \endcode + + \sa wc_EccKeyToDer + \sa wc_EccPublicKeyDecode +*/ +int wc_EccPublicKeyToDer_ex(ecc_key* key, byte* output, + word32 inLen, int with_AlgCurve, int comp); + /*! \ingroup ASN