FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/wolfcrypt/src/rsa.c
/* Verify the message signed with RSA-PSS.
 * The input buffer is reused for the output buffer.
 * Salt length is equal to hash length.
 *
 * in     Buffer holding encrypted data.
 * inLen  Length of data in buffer.
 * out    Pointer to address containing the PSS data.
 * digest Hash of the data that is being verified.
 * digestLen Length of hash.
 * hash   Hash algorithm.
 * mgf    Mask generation function.
 * key    Public RSA key.
 * returns the length of the PSS data on success and negative indicates failure.
 */
Verify the message signed with RSA-PSS.
The input buffer is reused for the output buffer.
Salt length is equal to hash length.

in     Buffer holding encrypted data.
inLen  Length of data in buffer.
out    Pointer to address containing the PSS data.
digest Hash of the data that is being verified.
digestLen Length of hash.
hash   Hash algorithm.
mgf    Mask generation function.
key    Public RSA key.
returns the length of the PSS data on success and negative indicates failure.
Verify the message signed with RSA - PSS . The input buffer is reused for the output buffer . Salt length is equal to hash length . in Buffer holding encrypted data . inLen Length of data in buffer . out Pointer to address containing the PSS data . digest Hash of the data that is being verified . digestLen Length of hash . hash Hash algorithm . mgf Mask generation function . key Public RSA key . returns the length of the PSS data on success and negative indicates failure .
int wc_RsaPSS_VerifyCheckInline(byte* in, word32 inLen, byte** out,
                           const byte* digest, word32 digestLen,
                           enum wc_HashType hash, int mgf, RsaKey* key)
{
    int ret = 0, verify, saltLen, hLen, bits = 0;
    hLen = wc_HashGetDigestSize(hash);
    if (hLen < 0)
        return hLen;
    if ((word32)hLen != digestLen)
        return BAD_FUNC_ARG;
    saltLen = hLen;
    #ifdef WOLFSSL_SHA512
        bits = mp_count_bits(&key->n);
        if (bits == 1024 && hLen == WC_SHA512_DIGEST_SIZE)
            saltLen = RSA_PSS_SALT_MAX_SZ;
    #endif
    verify = wc_RsaPSS_VerifyInline_ex(in, inLen, out, hash, mgf, saltLen, key);
    if (verify > 0)
        ret = wc_RsaPSS_CheckPadding_ex(digest, digestLen, *out, verify,
                                        hash, saltLen, bits);
    if (ret == 0)
        ret = verify;
    return ret;
}
int wc_RsaPSS_VerifyCheckInline ( byte * in , word32 inLen , byte * * out , const byte * digest , word32 digestLen , enum wc_HashType hash , int mgf , RsaKey * key ) { int ret = 0 , verify , saltLen , hLen , bits = 0 ; hLen = wc_HashGetDigestSize ( hash ) ; if ( hLen < 0 ) return hLen ; if ( ( word32 ) hLen != digestLen ) return BAD_FUNC_ARG ; saltLen = hLen ; #ifdef WOLFSSL_SHA512 bits = mp_count_bits ( & key -> n ) ; if ( bits == 1024 && hLen == WC_SHA512_DIGEST_SIZE ) saltLen = RSA_PSS_SALT_MAX_SZ ; #endif verify = wc_RsaPSS_VerifyInline_ex ( in , inLen , out , hash , mgf , saltLen , key ) ; if ( verify > 0 ) ret = wc_RsaPSS_CheckPadding_ex ( digest , digestLen , * out , verify , hash , saltLen , bits ) ; if ( ret == 0 ) ret = verify ; return ret ; }
Verify the message signed with RSA-PSS.
Verify the message signed with RSA - PSS .
/* See FIPS 186-4 section 5.5 item (e). */