src/wolfSSL/src/internal.c
int VerifyRsaSign(const byte* sig, word32 sigSz,
                  const byte* plain, word32 plainSz, RsaKey* key)
{
    #ifdef WOLFSSL_SMALL_STACK
        byte* verifySig = NULL;
    #else
        byte verifySig[ENCRYPT_LEN];
    #endif
    byte* out = NULL;  /* inline result */
    int   ret;

    WOLFSSL_ENTER("VerifyRsaSign");

    if (sig == NULL || plain == NULL || key == NULL) {
        WOLFSSL_MSG("Null pointer input");
        return BAD_FUNC_ARG;
    }

    if (sigSz > ENCRYPT_LEN) {
        WOLFSSL_MSG("Signature buffer too big");
        return BUFFER_E;
    }

    #ifdef WOLFSSL_SMALL_STACK
        verifySig = (byte*)XMALLOC(ENCRYPT_LEN, NULL,
                                   DYNAMIC_TYPE_SIGNATURE);
        if (verifySig == NULL)
            return MEMORY_ERROR;
    #endif

    XMEMCPY(verifySig, sig, sigSz);
    ret = wc_RsaSSL_VerifyInline(verifySig, sigSz, &out, key);

    if (ret != (int)plainSz || !out || XMEMCMP(plain, out, plainSz) != 0) {
        WOLFSSL_MSG("RSA Signature verification failed");
        ret = RSA_SIGN_FAULT;
    } else {
        ret = 0;  /* RSA reset */
    }

    #ifdef WOLFSSL_SMALL_STACK
        XFREE(verifySig, NULL, DYNAMIC_TYPE_SIGNATURE);
    #endif

    return ret;
}
/* Verify RSA signature, 0 on success */
Verify RSA signature, 0 on success
Verify RSA signature 0 on success
int VerifyRsaSign(const byte* sig, word32 sigSz,
                  const byte* plain, word32 plainSz, RsaKey* key)
{
    #ifdef WOLFSSL_SMALL_STACK
        byte* verifySig = NULL;
    #else
        byte verifySig[ENCRYPT_LEN];
    #endif
    byte* out = NULL;  
    int   ret;
    WOLFSSL_ENTER("VerifyRsaSign");
    if (sig == NULL || plain == NULL || key == NULL) {
        WOLFSSL_MSG("Null pointer input");
        return BAD_FUNC_ARG;
    }
    if (sigSz > ENCRYPT_LEN) {
        WOLFSSL_MSG("Signature buffer too big");
        return BUFFER_E;
    }
    #ifdef WOLFSSL_SMALL_STACK
        verifySig = (byte*)XMALLOC(ENCRYPT_LEN, NULL,
                                   DYNAMIC_TYPE_SIGNATURE);
        if (verifySig == NULL)
            return MEMORY_ERROR;
    #endif
    XMEMCPY(verifySig, sig, sigSz);
    ret = wc_RsaSSL_VerifyInline(verifySig, sigSz, &out, key);
    if (ret != (int)plainSz || !out || XMEMCMP(plain, out, plainSz) != 0) {
        WOLFSSL_MSG("RSA Signature verification failed");
        ret = RSA_SIGN_FAULT;
    } else {
        ret = 0;  
    }
    #ifdef WOLFSSL_SMALL_STACK
        XFREE(verifySig, NULL, DYNAMIC_TYPE_SIGNATURE);
    #endif
    return ret;
}
int VerifyRsaSign ( const byte * sig , word32 sigSz , const byte * plain , word32 plainSz , RsaKey * key ) { #ifdef WOLFSSL_SMALL_STACK byte * verifySig = NULL ; #else byte verifySig [ ENCRYPT_LEN ] ; #endif byte * out = NULL ; int ret ; WOLFSSL_ENTER ( " " ) ; if ( sig == NULL || plain == NULL || key == NULL ) { WOLFSSL_MSG ( " " ) ; return BAD_FUNC_ARG ; } if ( sigSz > ENCRYPT_LEN ) { WOLFSSL_MSG ( " " ) ; return BUFFER_E ; } #ifdef WOLFSSL_SMALL_STACK verifySig = ( byte * ) XMALLOC ( ENCRYPT_LEN , NULL , DYNAMIC_TYPE_SIGNATURE ) ; if ( verifySig == NULL ) return MEMORY_ERROR ; #endif XMEMCPY ( verifySig , sig , sigSz ) ; ret = wc_RsaSSL_VerifyInline ( verifySig , sigSz , & out , key ) ; if ( ret != ( int ) plainSz || ! out || XMEMCMP ( plain , out , plainSz ) != 0 ) { WOLFSSL_MSG ( " " ) ; ret = RSA_SIGN_FAULT ; } else { ret = 0 ; } #ifdef WOLFSSL_SMALL_STACK XFREE ( verifySig , NULL , DYNAMIC_TYPE_SIGNATURE ) ; #endif return ret ; }
Verify RSA signature, 0 on success
Verify RSA signature 0 on success
/* inline result */ /* RSA reset */