FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/wolfcrypt/src/evp.c
/* Creates a new WOLFSSL_EVP_PKEY_CTX structure.
 *
 * pkey  key structure to use with new WOLFSSL_EVP_PEKY_CTX
 * e     engine to use. It should be NULL at this time.
 *
 * return the new structure on success and NULL if failed.
 */
Creates a new WOLFSSL_EVP_PKEY_CTX structure.
pkey  key structure to use with new WOLFSSL_EVP_PEKY_CTX
e     engine to use. It should be NULL at this time.

return the new structure on success and NULL if failed.
Creates a new WOLFSSL_EVP_PKEY_CTX structure . pkey key structure to use with new WOLFSSL_EVP_PEKY_CTX e engine to use . It should be NULL at this time . return the new structure on success and NULL if failed .
WOLFSSL_EVP_PKEY_CTX *wolfSSL_EVP_PKEY_CTX_new(WOLFSSL_EVP_PKEY *pkey, WOLFSSL_ENGINE *e)
{
    WOLFSSL_EVP_PKEY_CTX* ctx;
    int type = NID_undef;
    if (pkey == NULL) return 0;
    if (e != NULL) return 0;
    WOLFSSL_ENTER("EVP_PKEY_CTX_new");
    ctx = (WOLFSSL_EVP_PKEY_CTX*)XMALLOC(sizeof(WOLFSSL_EVP_PKEY_CTX), NULL,
            DYNAMIC_TYPE_PUBLIC_KEY);
    if (ctx == NULL) return NULL;
    XMEMSET(ctx, 0, sizeof(WOLFSSL_EVP_PKEY_CTX));
    ctx->pkey = pkey;
#if !defined(NO_RSA) && !defined(HAVE_USER_RSA)
    ctx->padding = RSA_PKCS1_PADDING;
#endif
    type = wolfSSL_EVP_PKEY_type(pkey->type);
    if (type != NID_undef) {
        if (wc_LockMutex(&pkey->refMutex) != 0) {
            WOLFSSL_MSG("Couldn't lock pkey mutex");
        }
        pkey->references++;
        wc_UnLockMutex(&pkey->refMutex);
    }
    return ctx;
}
WOLFSSL_EVP_PKEY_CTX * wolfSSL_EVP_PKEY_CTX_new ( WOLFSSL_EVP_PKEY * pkey , WOLFSSL_ENGINE * e ) { WOLFSSL_EVP_PKEY_CTX * ctx ; int type = NID_undef ; if ( pkey == NULL ) return 0 ; if ( e != NULL ) return 0 ; WOLFSSL_ENTER ( " " ) ; ctx = ( WOLFSSL_EVP_PKEY_CTX * ) XMALLOC ( sizeof ( WOLFSSL_EVP_PKEY_CTX ) , NULL , DYNAMIC_TYPE_PUBLIC_KEY ) ; if ( ctx == NULL ) return NULL ; XMEMSET ( ctx , 0 , sizeof ( WOLFSSL_EVP_PKEY_CTX ) ) ; ctx -> pkey = pkey ; #if ! defined ( NO_RSA ) && ! defined ( HAVE_USER_RSA ) ctx -> padding = RSA_PKCS1_PADDING ; #endif type = wolfSSL_EVP_PKEY_type ( pkey -> type ) ; if ( type != NID_undef ) { if ( wc_LockMutex ( & pkey -> refMutex ) != 0 ) { WOLFSSL_MSG ( " " ) ; } pkey -> references ++ ; wc_UnLockMutex ( & pkey -> refMutex ) ; } return ctx ; }
Creates a new WOLFSSL_EVP_PKEY_CTX structure.
Creates a new WOLFSSL_EVP_PKEY_CTX structure .