FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/wolfcrypt/src/evp.c
/* Finalize structure for verifying signature
 *
 * ctx    WOLFSSL_EVP_MD_CTX structure to finalize
 * sig    buffer holding signature
 * siglen length of sig buffer
 * pkey   key to verify with
 *
 * returns WOLFSSL_SUCCESS on success and WOLFSSL_FAILURE on failure
 */
Finalize structure for verifying signature
ctx    WOLFSSL_EVP_MD_CTX structure to finalize
sig    buffer holding signature
siglen length of sig buffer
pkey   key to verify with

returns WOLFSSL_SUCCESS on success and WOLFSSL_FAILURE on failure
Finalize structure for verifying signature ctx WOLFSSL_EVP_MD_CTX structure to finalize sig buffer holding signature siglen length of sig buffer pkey key to verify with returns WOLFSSL_SUCCESS on success and WOLFSSL_FAILURE on failure
int wolfSSL_EVP_VerifyFinal(WOLFSSL_EVP_MD_CTX *ctx,
        unsigned char*sig, unsigned int siglen, WOLFSSL_EVP_PKEY *pkey)
{
    int ret;
    unsigned char md[WC_MAX_DIGEST_SIZE];
    unsigned int mdsize;
    if (ctx == NULL) return WOLFSSL_FAILURE;
    WOLFSSL_ENTER("EVP_VerifyFinal");
    ret = wolfSSL_EVP_DigestFinal(ctx, md, &mdsize);
    if (ret <= 0) return ret;
    (void)sig;
    (void)siglen;
    switch (pkey->type) {
#if !defined(NO_RSA) && !defined(HAVE_USER_RSA)
    case EVP_PKEY_RSA: {
        int nid = wolfSSL_EVP_MD_type(wolfSSL_EVP_MD_CTX_md(ctx));
        if (nid < 0) break;
        return wolfSSL_RSA_verify(nid, md, mdsize, sig,
                (unsigned int)siglen, pkey->rsa);
    }
#endif 
    case EVP_PKEY_DSA:
    case EVP_PKEY_EC:
        WOLFSSL_MSG("not implemented");
        FALL_THROUGH;
    default:
        break;
    }
    return WOLFSSL_FAILURE;
}
int wolfSSL_EVP_VerifyFinal ( WOLFSSL_EVP_MD_CTX * ctx , unsigned char * sig , unsigned int siglen , WOLFSSL_EVP_PKEY * pkey ) { int ret ; unsigned char md [ WC_MAX_DIGEST_SIZE ] ; unsigned int mdsize ; if ( ctx == NULL ) return WOLFSSL_FAILURE ; WOLFSSL_ENTER ( " " ) ; ret = wolfSSL_EVP_DigestFinal ( ctx , md , & mdsize ) ; if ( ret <= 0 ) return ret ; ( void ) sig ; ( void ) siglen ; switch ( pkey -> type ) { #if ! defined ( NO_RSA ) && ! defined ( HAVE_USER_RSA ) case EVP_PKEY_RSA : { int nid = wolfSSL_EVP_MD_type ( wolfSSL_EVP_MD_CTX_md ( ctx ) ) ; if ( nid < 0 ) break ; return wolfSSL_RSA_verify ( nid , md , mdsize , sig , ( unsigned int ) siglen , pkey -> rsa ) ; } #endif case EVP_PKEY_DSA : case EVP_PKEY_EC : WOLFSSL_MSG ( " " ) ; FALL_THROUGH ; default : break ; } return WOLFSSL_FAILURE ; }
Finalize structure for verifying signature
 ctx    WOLFSSL_EVP_MD_CTX structure to finalize
 sig    buffer holding signature
 siglen length of sig buffer
 pkey   key to verify with
Finalize structure for verifying signature ctx WOLFSSL_EVP_MD_CTX structure to finalize sig buffer holding signature siglen length of sig buffer pkey key to verify with
/* NO_RSA */