Skip to content

Commit

Permalink
crypto: qat - fix invalid check for RSA keylen in fips mode
Browse files Browse the repository at this point in the history
The condition checking allowed key length was invalid.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Tadeusz Struk authored and Herbert Xu committed Jul 21, 2015
1 parent a9d4f82 commit 3cf080a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/crypto/qat/qat_common/qat_asym_algs.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ int qat_rsa_get_n(void *context, size_t hdrlen, unsigned char tag,
ctx->key_sz = vlen;
ret = -EINVAL;
/* In FIPS mode only allow key size 2K & 3K */
if (fips_enabled && (ctx->key_sz != 256 || ctx->key_sz != 384)) {
if (fips_enabled && (ctx->key_sz != 256 && ctx->key_sz != 384)) {
pr_err("QAT: RSA: key size not allowed in FIPS mode\n");
goto err;
}
Expand Down Expand Up @@ -510,7 +510,7 @@ int qat_rsa_get_d(void *context, size_t hdrlen, unsigned char tag,
goto err;

/* In FIPS mode only allow key size 2K & 3K */
if (fips_enabled && (vlen != 256 || vlen != 384)) {
if (fips_enabled && (vlen != 256 && vlen != 384)) {
pr_err("QAT: RSA: key size not allowed in FIPS mode\n");
goto err;
}
Expand Down

0 comments on commit 3cf080a

Please sign in to comment.