src/wolfSSL/wolfcrypt/src/rsa.c
static int wc_MGF(int type, byte* seed, word32 seedSz,
                                                        byte* out, word32 outSz)
{
    int ret;

    switch(type) {
        #ifndef NO_SHA
        case WC_MGF1SHA1:
                ret = wc_MGF1(WC_HASH_TYPE_SHA, seed, seedSz, out, outSz);
                break;
        #endif
        #ifndef NO_SHA256
        case WC_MGF1SHA256:
                ret = wc_MGF1(WC_HASH_TYPE_SHA256, seed, seedSz, out, outSz);
                break;
        #endif
        #ifdef WOLFSSL_SHA512
        #ifdef WOLFSSL_SHA384
        case WC_MGF1SHA384:
                ret = wc_MGF1(WC_HASH_TYPE_SHA384, seed, seedSz, out, outSz);
                break;
        #endif
        case WC_MGF1SHA512:
                ret = wc_MGF1(WC_HASH_TYPE_SHA512, seed, seedSz, out, outSz);
                break;
        #endif
        default:
            WOLFSSL_MSG("Unknown MGF function: check build options");
            ret = BAD_FUNC_ARG;
    }

    /* in case of default avoid unused warning */
    (void)seed;
    (void)seedSz;
    (void)out;
    (void)outSz;

    return ret;
}
/* helper function to direct which mask generation function is used
   switeched on type input
 */
helper function to direct which mask generation function is used
switeched on type input
helper function to direct which mask generation function is used switeched on type input
static int wc_MGF(int type, byte* seed, word32 seedSz,
                                                        byte* out, word32 outSz)
{
    int ret;
    switch(type) {
        #ifndef NO_SHA
        case WC_MGF1SHA1:
                ret = wc_MGF1(WC_HASH_TYPE_SHA, seed, seedSz, out, outSz);
                break;
        #endif
        #ifndef NO_SHA256
        case WC_MGF1SHA256:
                ret = wc_MGF1(WC_HASH_TYPE_SHA256, seed, seedSz, out, outSz);
                break;
        #endif
        #ifdef WOLFSSL_SHA512
        #ifdef WOLFSSL_SHA384
        case WC_MGF1SHA384:
                ret = wc_MGF1(WC_HASH_TYPE_SHA384, seed, seedSz, out, outSz);
                break;
        #endif
        case WC_MGF1SHA512:
                ret = wc_MGF1(WC_HASH_TYPE_SHA512, seed, seedSz, out, outSz);
                break;
        #endif
        default:
            WOLFSSL_MSG("Unknown MGF function: check build options");
            ret = BAD_FUNC_ARG;
    }
    (void)seed;
    (void)seedSz;
    (void)out;
    (void)outSz;
    return ret;
}
static int wc_MGF ( int type , byte * seed , word32 seedSz , byte * out , word32 outSz ) { int ret ; switch ( type ) { #ifndef NO_SHA case WC_MGF1SHA1 : ret = wc_MGF1 ( WC_HASH_TYPE_SHA , seed , seedSz , out , outSz ) ; break ; #endif #ifndef NO_SHA256 case WC_MGF1SHA256 : ret = wc_MGF1 ( WC_HASH_TYPE_SHA256 , seed , seedSz , out , outSz ) ; break ; #endif #ifdef WOLFSSL_SHA512 #ifdef WOLFSSL_SHA384 case WC_MGF1SHA384 : ret = wc_MGF1 ( WC_HASH_TYPE_SHA384 , seed , seedSz , out , outSz ) ; break ; #endif case WC_MGF1SHA512 : ret = wc_MGF1 ( WC_HASH_TYPE_SHA512 , seed , seedSz , out , outSz ) ; break ; #endif default : WOLFSSL_MSG ( " " ) ; ret = BAD_FUNC_ARG ; } ( void ) seed ; ( void ) seedSz ; ( void ) out ; ( void ) outSz ; return ret ; }
helper function to direct which mask generation function is used
switeched on type input
helper function to direct which mask generation function is used switeched on type input
/* in case of default avoid unused warning */