FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/wolfcrypt/src/evp.c
/* Deep copy of EVP_MD hasher
     * return WOLFSSL_SUCCESS on success */
Deep copy of EVP_MD hasher
return WOLFSSL_SUCCESS on success
Deep copy of EVP_MD hasher return WOLFSSL_SUCCESS on success
static int wolfSSL_EVP_MD_Copy_Hasher(WOLFSSL_EVP_MD_CTX* des,
            const WOLFSSL_EVP_MD_CTX* src)
    {
        int ret;
        if (src->isHMAC) {
            ret = wolfSSL_HmacCopy(&des->hash.hmac, (Hmac*)&src->hash.hmac);
        }
        else {
            switch (src->macType) {
                case WC_HASH_TYPE_MD5:
            #ifndef NO_MD5
                    ret = wc_Md5Copy((wc_Md5*)&src->hash.digest,
                            (wc_Md5*)&des->hash.digest);
            #else
                    ret = NOT_COMPILED_IN;
            #endif 
                    break;
                case WC_HASH_TYPE_SHA:
            #ifndef NO_SHA
                    ret = wc_ShaCopy((wc_Sha*)&src->hash.digest,
                            (wc_Sha*)&des->hash.digest);
            #else
                    ret = NOT_COMPILED_IN;
            #endif 
                    break;
                case WC_HASH_TYPE_SHA224:
            #ifdef WOLFSSL_SHA224
                    ret = wc_Sha224Copy((wc_Sha224*)&src->hash.digest,
                            (wc_Sha224*)&des->hash.digest);
            #else
                    ret = NOT_COMPILED_IN;
            #endif 
                    break;
                case WC_HASH_TYPE_SHA256:
            #ifndef NO_SHA256
                    ret = wc_Sha256Copy((wc_Sha256*)&src->hash.digest,
                            (wc_Sha256*)&des->hash.digest);
            #else
                    ret = NOT_COMPILED_IN;
            #endif 
                    break;
                case WC_HASH_TYPE_SHA384:
            #ifdef WOLFSSL_SHA384
                    ret = wc_Sha384Copy((wc_Sha384*)&src->hash.digest,
                            (wc_Sha384*)&des->hash.digest);
            #else
                    ret = NOT_COMPILED_IN;
            #endif 
                    break;
                case WC_HASH_TYPE_SHA512:
            #ifdef WOLFSSL_SHA512
                    ret = wc_Sha512Copy((wc_Sha512*)&src->hash.digest,
                        (wc_Sha512*)&des->hash.digest);
            #else
                    ret = NOT_COMPILED_IN;
            #endif 
                    break;
                case WC_HASH_TYPE_SHA3_224:
            #if defined(WOLFSSL_SHA3) && !defined(WOLFSSL_NOSHA3_224)
                    ret = wc_Sha3_224_Copy((wc_Sha3*)&src->hash.digest,
                            (wc_Sha3*)&des->hash.digest);
            #else
                    ret = NOT_COMPILED_IN;
            #endif
                    break;
                case WC_HASH_TYPE_SHA3_256:
            #if defined(WOLFSSL_SHA3) && !defined(WOLFSSL_NOSHA3_256)
                    ret = wc_Sha3_256_Copy((wc_Sha3*)&src->hash.digest,
                            (wc_Sha3*)&des->hash.digest);
            #else
                    ret = NOT_COMPILED_IN;
            #endif
                    break;
                case WC_HASH_TYPE_SHA3_384:
            #if defined(WOLFSSL_SHA3)
                    ret = wc_Sha3_384_Copy((wc_Sha3*)&src->hash.digest,
                            (wc_Sha3*)&des->hash.digest);
            #else
                    ret = NOT_COMPILED_IN;
            #endif
                    break;
                case WC_HASH_TYPE_SHA3_512:
            #if defined(WOLFSSL_SHA3) && !defined(WOLFSSL_NOSHA3_512)
                    ret = wc_Sha3_512_Copy((wc_Sha3*)&src->hash.digest,
                        (wc_Sha3*)&des->hash.digest);
            #else
                    ret = NOT_COMPILED_IN;
            #endif
                    break;
                case WC_HASH_TYPE_NONE:
                case WC_HASH_TYPE_MD2:
                case WC_HASH_TYPE_MD4:
                case WC_HASH_TYPE_MD5_SHA:
                case WC_HASH_TYPE_BLAKE2B:
                case WC_HASH_TYPE_BLAKE2S:
                default:
                    ret = BAD_FUNC_ARG;
                    break;
            }
        }
        return ret == 0 ? WOLFSSL_SUCCESS : WOLFSSL_FAILURE;
    }
static int wolfSSL_EVP_MD_Copy_Hasher ( WOLFSSL_EVP_MD_CTX * des , const WOLFSSL_EVP_MD_CTX * src ) { int ret ; if ( src -> isHMAC ) { ret = wolfSSL_HmacCopy ( & des -> hash . hmac , ( Hmac * ) & src -> hash . hmac ) ; } else { switch ( src -> macType ) { case WC_HASH_TYPE_MD5 : #ifndef NO_MD5 ret = wc_Md5Copy ( ( wc_Md5 * ) & src -> hash . digest , ( wc_Md5 * ) & des -> hash . digest ) ; #else ret = NOT_COMPILED_IN ; #endif break ; case WC_HASH_TYPE_SHA : #ifndef NO_SHA ret = wc_ShaCopy ( ( wc_Sha * ) & src -> hash . digest , ( wc_Sha * ) & des -> hash . digest ) ; #else ret = NOT_COMPILED_IN ; #endif break ; case WC_HASH_TYPE_SHA224 : #ifdef WOLFSSL_SHA224 ret = wc_Sha224Copy ( ( wc_Sha224 * ) & src -> hash . digest , ( wc_Sha224 * ) & des -> hash . digest ) ; #else ret = NOT_COMPILED_IN ; #endif break ; case WC_HASH_TYPE_SHA256 : #ifndef NO_SHA256 ret = wc_Sha256Copy ( ( wc_Sha256 * ) & src -> hash . digest , ( wc_Sha256 * ) & des -> hash . digest ) ; #else ret = NOT_COMPILED_IN ; #endif break ; case WC_HASH_TYPE_SHA384 : #ifdef WOLFSSL_SHA384 ret = wc_Sha384Copy ( ( wc_Sha384 * ) & src -> hash . digest , ( wc_Sha384 * ) & des -> hash . digest ) ; #else ret = NOT_COMPILED_IN ; #endif break ; case WC_HASH_TYPE_SHA512 : #ifdef WOLFSSL_SHA512 ret = wc_Sha512Copy ( ( wc_Sha512 * ) & src -> hash . digest , ( wc_Sha512 * ) & des -> hash . digest ) ; #else ret = NOT_COMPILED_IN ; #endif break ; case WC_HASH_TYPE_SHA3_224 : #if defined ( WOLFSSL_SHA3 ) && ! defined ( WOLFSSL_NOSHA3_224 ) ret = wc_Sha3_224_Copy ( ( wc_Sha3 * ) & src -> hash . digest , ( wc_Sha3 * ) & des -> hash . digest ) ; #else ret = NOT_COMPILED_IN ; #endif break ; case WC_HASH_TYPE_SHA3_256 : #if defined ( WOLFSSL_SHA3 ) && ! defined ( WOLFSSL_NOSHA3_256 ) ret = wc_Sha3_256_Copy ( ( wc_Sha3 * ) & src -> hash . digest , ( wc_Sha3 * ) & des -> hash . digest ) ; #else ret = NOT_COMPILED_IN ; #endif break ; case WC_HASH_TYPE_SHA3_384 : #if defined ( WOLFSSL_SHA3 ) ret = wc_Sha3_384_Copy ( ( wc_Sha3 * ) & src -> hash . digest , ( wc_Sha3 * ) & des -> hash . digest ) ; #else ret = NOT_COMPILED_IN ; #endif break ; case WC_HASH_TYPE_SHA3_512 : #if defined ( WOLFSSL_SHA3 ) && ! defined ( WOLFSSL_NOSHA3_512 ) ret = wc_Sha3_512_Copy ( ( wc_Sha3 * ) & src -> hash . digest , ( wc_Sha3 * ) & des -> hash . digest ) ; #else ret = NOT_COMPILED_IN ; #endif break ; case WC_HASH_TYPE_NONE : case WC_HASH_TYPE_MD2 : case WC_HASH_TYPE_MD4 : case WC_HASH_TYPE_MD5_SHA : case WC_HASH_TYPE_BLAKE2B : case WC_HASH_TYPE_BLAKE2S : default : ret = BAD_FUNC_ARG ; break ; } } return ret == 0 ? WOLFSSL_SUCCESS : WOLFSSL_FAILURE ; }
Deep copy of EVP_MD hasher
 return WOLFSSL_SUCCESS on success
Deep copy of EVP_MD hasher return WOLFSSL_SUCCESS on success
/* !NO_MD5 */ /* !NO_SHA */ /* WOLFSSL_SHA224 */ /* !NO_SHA256 */ /* WOLFSSL_SHA384 */ /* WOLFSSL_SHA512 */