FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/wolfcrypt/src/evp.c
/* try and populate public pkey_sz and pkey.ptr */
try and populate public pkey_sz and pkey.ptr
try and populate public pkey_sz and pkey . ptr
static void ECC_populate_EVP_PKEY(EVP_PKEY* pkey, ecc_key* ecc)
{
    int ret;
    if (!pkey || !ecc)
        return;
    if ((ret = wc_EccPublicKeyDerSize(ecc, 1)) > 0) {
        int derSz = ret;
        char* derBuf = (char*)XMALLOC(derSz, NULL, DYNAMIC_TYPE_TMP_BUFFER);
        if (derBuf) {
            ret = wc_EccPublicKeyToDer(ecc, (byte*)derBuf, derSz, 1);
            if (ret >= 0) {
                if (pkey->pkey.ptr) {
                    XFREE(pkey->pkey.ptr, NULL, DYNAMIC_TYPE_OPENSSL);
                }
                pkey->pkey_sz = ret;
                pkey->pkey.ptr = derBuf;
            }
            else { 
                XFREE(derBuf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
                derBuf = NULL;
            }
        }
    }
}
static void ECC_populate_EVP_PKEY ( EVP_PKEY * pkey , ecc_key * ecc ) { int ret ; if ( ! pkey || ! ecc ) return ; if ( ( ret = wc_EccPublicKeyDerSize ( ecc , 1 ) ) > 0 ) { int derSz = ret ; char * derBuf = ( char * ) XMALLOC ( derSz , NULL , DYNAMIC_TYPE_TMP_BUFFER ) ; if ( derBuf ) { ret = wc_EccPublicKeyToDer ( ecc , ( byte * ) derBuf , derSz , 1 ) ; if ( ret >= 0 ) { if ( pkey -> pkey . ptr ) { XFREE ( pkey -> pkey . ptr , NULL , DYNAMIC_TYPE_OPENSSL ) ; } pkey -> pkey_sz = ret ; pkey -> pkey . ptr = derBuf ; } else { XFREE ( derBuf , NULL , DYNAMIC_TYPE_TMP_BUFFER ) ; derBuf = NULL ; } } } }
try and populate public pkey_sz and pkey.ptr
try and populate public pkey_sz and pkey . ptr
/* failure - okay to ignore */