Skip to content

Commit

Permalink
crypto: aead - Fix corner case in crypto_lookup_aead
Browse files Browse the repository at this point in the history
When the user explicitly states that they don't care whether the
algorithm has been tested (type = CRYPTO_ALG_TESTED and mask = 0),
there is a corner case where we may erroneously return ENOENT.

This patch fixes it by correcting the logic in the test.

Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
herbertx committed Apr 26, 2015
1 parent 2673953 commit 80f7b35
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crypto/aead.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ struct crypto_alg *crypto_lookup_aead(const char *name, u32 type, u32 mask)
return alg;

if (alg->cra_type == &crypto_aead_type) {
if ((alg->cra_flags ^ type ^ ~mask) & CRYPTO_ALG_TESTED) {
if (~alg->cra_flags & (type ^ ~mask) & CRYPTO_ALG_TESTED) {
crypto_mod_put(alg);
alg = ERR_PTR(-ENOENT);
}
Expand Down

0 comments on commit 80f7b35

Please sign in to comment.