md_name = EVP_MD_get0_name(md);
if (xoflen > 0) {
- if (!(EVP_MD_get_flags(md) & EVP_MD_FLAG_XOF)) {
+ if (!EVP_MD_xof(md)) {
BIO_printf(bio_err, "Length can only be specified for XOF\n");
goto end;
}
if (!opt_md_silent(mdname, &md))
return -1;
- if (EVP_MD_get_flags(md) & EVP_MD_FLAG_XOF) {
+ if (EVP_MD_xof(md)) {
ctx = EVP_MD_CTX_new();
if (ctx == NULL) {
count = -1;
#ifdef FIPS_MODULE
/* XOF are approved as standalone; Shake256 in Ed448; MGF */
- if ((EVP_MD_get_flags(md) & EVP_MD_FLAG_XOF) != 0) {
+ if (EVP_MD_xof(md)) {
ERR_raise(ERR_LIB_RSA, RSA_R_DIGEST_NOT_ALLOWED);
return 0;
}
- if ((EVP_MD_get_flags(mgf1md) & EVP_MD_FLAG_XOF) != 0) {
+ if (EVP_MD_xof(mgf1md)) {
ERR_raise(ERR_LIB_RSA, RSA_R_MGF1_DIGEST_NOT_ALLOWED);
return 0;
}
#ifdef FIPS_MODULE
/* XOF are approved as standalone; Shake256 in Ed448; MGF */
- if ((EVP_MD_get_flags(md) & EVP_MD_FLAG_XOF) != 0) {
+ if (EVP_MD_xof(md)) {
ERR_raise(ERR_LIB_RSA, RSA_R_DIGEST_NOT_ALLOWED);
return -1;
}
- if ((EVP_MD_get_flags(mgf1md) & EVP_MD_FLAG_XOF) != 0) {
+ if (EVP_MD_xof(mgf1md)) {
ERR_raise(ERR_LIB_RSA, RSA_R_MGF1_DIGEST_NOT_ALLOWED);
return -1;
}
if (c == NULL)
goto err;
mdlen = EVP_MD_get_size(dgst);
- if (mdlen < 0)
+ if (mdlen <= 0)
goto err;
/* step 4 */
for (i = 0; outlen < len; i++) {
if (pdhctx->kdf_md == NULL)
return 0;
/* XOF digests are not allowed */
- if ((EVP_MD_get_flags(pdhctx->kdf_md) & EVP_MD_FLAG_XOF) != 0) {
+ if (EVP_MD_xof(pdhctx->kdf_md)) {
ERR_raise(ERR_LIB_PROV, PROV_R_XOF_DIGESTS_NOT_ALLOWED);
return 0;
}
if (pectx->kdf_md == NULL)
return 0;
/* XOF digests are not allowed */
- if ((EVP_MD_get_flags(pectx->kdf_md) & EVP_MD_FLAG_XOF) != 0) {
+ if (EVP_MD_xof(pectx->kdf_md)) {
ERR_raise(ERR_LIB_PROV, PROV_R_XOF_DIGESTS_NOT_ALLOWED);
return 0;
}
/* Confirm digest is allowed. Allow all digests that are not XOF */
md = ossl_prov_digest_md(&drbg->digest);
if (md != NULL) {
- if ((EVP_MD_get_flags(md) & EVP_MD_FLAG_XOF) != 0) {
+ if (EVP_MD_xof(md)) {
ERR_raise(ERR_LIB_PROV, PROV_R_XOF_DIGESTS_NOT_ALLOWED);
return 0;
}
if (!ossl_prov_digest_load_from_params(&ctx->digest, params, provctx))
return 0;
md = ossl_prov_digest_md(&ctx->digest);
- if ((EVP_MD_get_flags(md) & EVP_MD_FLAG_XOF) != 0) {
+ if (EVP_MD_xof(md)) {
ERR_raise(ERR_LIB_PROV, PROV_R_XOF_DIGESTS_NOT_ALLOWED);
return 0;
}
return 0;
md = ossl_prov_digest_md(&ctx->digest);
- if ((EVP_MD_get_flags(md) & EVP_MD_FLAG_XOF) != 0) {
+ if (EVP_MD_xof(md)) {
ERR_raise(ERR_LIB_PROV, PROV_R_XOF_DIGESTS_NOT_ALLOWED);
return 0;
}
return 0;
md = ossl_prov_digest_md(&ctx->digest);
- if ((EVP_MD_get_flags(md) & EVP_MD_FLAG_XOF) != 0) {
+ if (EVP_MD_xof(md)) {
ERR_raise(ERR_LIB_PROV, PROV_R_XOF_DIGESTS_NOT_ALLOWED);
return 0;
}
return 0;
md = ossl_prov_digest_md(&digest);
- if ((EVP_MD_get_flags(md) & EVP_MD_FLAG_XOF) != 0) {
+ if (EVP_MD_xof(md)) {
ERR_raise(ERR_LIB_PROV, PROV_R_XOF_DIGESTS_NOT_ALLOWED);
ossl_prov_digest_reset(&digest);
return 0;
if (!ossl_prov_digest_load_from_params(&ctx->digest, params, provctx))
return 0;
md = ossl_prov_digest_md(&ctx->digest);
- if ((EVP_MD_get_flags(md) & EVP_MD_FLAG_XOF) != 0) {
+ if (EVP_MD_xof(md)) {
ERR_raise(ERR_LIB_PROV, PROV_R_XOF_DIGESTS_NOT_ALLOWED);
return 0;
}
}
#else /* FIPS_MODULE */
/* Outside of FIPS, any digests that are not XOF are allowed */
- if ((EVP_MD_get_flags(md) & EVP_MD_FLAG_XOF) != 0) {
+ if (EVP_MD_xof(md)) {
ERR_raise(ERR_LIB_PROV, PROV_R_XOF_DIGESTS_NOT_ALLOWED);
return 0;
}
goto err;
}
/* XOF digests don't work */
- if ((EVP_MD_get_flags(md) & EVP_MD_FLAG_XOF) != 0) {
+ if (EVP_MD_xof(md)) {
ERR_raise(ERR_LIB_PROV, PROV_R_XOF_DIGESTS_NOT_ALLOWED);
goto err;
}
goto err;
}
/* XOF digests don't work */
- if ((EVP_MD_get_flags(md) & EVP_MD_FLAG_XOF) != 0) {
+ if (EVP_MD_xof(md)) {
ERR_raise(ERR_LIB_PROV, PROV_R_XOF_DIGESTS_NOT_ALLOWED);
goto err;
}
* We don't support XOF digests with RSA PSS (yet), so just fail.
* When we do support them, uncomment the second clause.
*/
- if ((EVP_MD_get_flags(md) & EVP_MD_FLAG_XOF) != 0
+ if (EVP_MD_xof(md)
/* && ctx->pad_mode != RSA_PKCS1_PSS_PADDING */) {
ERR_raise(ERR_LIB_PROV, PROV_R_XOF_DIGESTS_NOT_ALLOWED);
goto err;
return 0;
/* XOF digests don't work */
- if ((EVP_MD_get_flags(psm2ctx->md) & EVP_MD_FLAG_XOF) != 0) {
+ if (EVP_MD_xof(psm2ctx->md)) {
ERR_raise(ERR_LIB_PROV, PROV_R_XOF_DIGESTS_NOT_ALLOWED);
return 0;
}
goto err;
}
- xof |= (EVP_MD_get_flags(expected->digest) & EVP_MD_FLAG_XOF) != 0;
+ xof |= EVP_MD_xof(expected->digest);
if (xof) {
EVP_MD_CTX *mctx_cpy;