src/wolfSSL/src/internal.c
static word32 QSH_MaxSecret(QSHKey* key)
{
    byte isNtru = 0;
    word16 inSz = 48;
    word16 outSz;
    DRBG_HANDLE drbg = 0;
    byte bufIn[48];
    int ret = 0;

    if (key == NULL || key->pub.length == 0)
        return 0;

    switch(key->name) {
#ifdef HAVE_NTRU
            case WOLFSSL_NTRU_EESS439:
                isNtru   = 1;
                break;
            case WOLFSSL_NTRU_EESS593:
                isNtru   = 1;
                break;
            case WOLFSSL_NTRU_EESS743:
                isNtru   = 1;
                break;
#endif
        default:
            WOLFSSL_MSG("Unknown QSH encryption scheme size!");
            return 0;
    }

    if (isNtru) {
        ret = ntru_crypto_drbg_external_instantiate(GetEntropy, &drbg);
        if (ret != DRBG_OK)
            return NTRU_DRBG_ERROR;
        ret = ntru_crypto_ntru_encrypt(drbg, key->pub.length,
                            key->pub.buffer, inSz, bufIn, &outSz, NULL);
        if (ret != NTRU_OK) {
            return NTRU_ENCRYPT_ERROR;
        }
        ntru_crypto_drbg_uninstantiate(drbg);
        return outSz;
    }

    return 0;
}
/* Get the max cipher text for corresponding encryption scheme
   (encrypting  48 or max plain text whichever is smaller)
 */
Get the max cipher text for corresponding encryption scheme
(encrypting  48 or max plain text whichever is smaller)
Get the max cipher text for corresponding encryption scheme ( encrypting 48 or max plain text whichever is smaller )
static word32 QSH_MaxSecret(QSHKey* key)
{
    byte isNtru = 0;
    word16 inSz = 48;
    word16 outSz;
    DRBG_HANDLE drbg = 0;
    byte bufIn[48];
    int ret = 0;
    if (key == NULL || key->pub.length == 0)
        return 0;
    switch(key->name) {
#ifdef HAVE_NTRU
            case WOLFSSL_NTRU_EESS439:
                isNtru   = 1;
                break;
            case WOLFSSL_NTRU_EESS593:
                isNtru   = 1;
                break;
            case WOLFSSL_NTRU_EESS743:
                isNtru   = 1;
                break;
#endif
        default:
            WOLFSSL_MSG("Unknown QSH encryption scheme size!");
            return 0;
    }
    if (isNtru) {
        ret = ntru_crypto_drbg_external_instantiate(GetEntropy, &drbg);
        if (ret != DRBG_OK)
            return NTRU_DRBG_ERROR;
        ret = ntru_crypto_ntru_encrypt(drbg, key->pub.length,
                            key->pub.buffer, inSz, bufIn, &outSz, NULL);
        if (ret != NTRU_OK) {
            return NTRU_ENCRYPT_ERROR;
        }
        ntru_crypto_drbg_uninstantiate(drbg);
        return outSz;
    }
    return 0;
}
static word32 QSH_MaxSecret ( QSHKey * key ) { byte isNtru = 0 ; word16 inSz = 48 ; word16 outSz ; DRBG_HANDLE drbg = 0 ; byte bufIn [ 48 ] ; int ret = 0 ; if ( key == NULL || key -> pub . length == 0 ) return 0 ; switch ( key -> name ) { #ifdef HAVE_NTRU case WOLFSSL_NTRU_EESS439 : isNtru = 1 ; break ; case WOLFSSL_NTRU_EESS593 : isNtru = 1 ; break ; case WOLFSSL_NTRU_EESS743 : isNtru = 1 ; break ; #endif default : WOLFSSL_MSG ( " " ) ; return 0 ; } if ( isNtru ) { ret = ntru_crypto_drbg_external_instantiate ( GetEntropy , & drbg ) ; if ( ret != DRBG_OK ) return NTRU_DRBG_ERROR ; ret = ntru_crypto_ntru_encrypt ( drbg , key -> pub . length , key -> pub . buffer , inSz , bufIn , & outSz , NULL ) ; if ( ret != NTRU_OK ) { return NTRU_ENCRYPT_ERROR ; } ntru_crypto_drbg_uninstantiate ( drbg ) ; return outSz ; } return 0 ; }
Get the max cipher text for corresponding encryption scheme
(encrypting  48 or max plain text whichever is smaller)
Get the max cipher text for corresponding encryption scheme ( encrypting 48 or max plain text whichever is smaller )