Skip to content

Commit 9cfe521

Browse files
committed
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes from Herbert Xu: "This fixes a couple of crypto drivers that were using memcmp to verify authentication tags. They now use crypto_memneq instead" * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: crypto: talitos - Fix timing leak in ESP ICV verification crypto: nx - Fix timing leak in GCM and CCM decryption
2 parents 849ee3d + 7996094 commit 9cfe521

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

drivers/crypto/nx/nx-aes-ccm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ static int ccm_nx_decrypt(struct aead_request *req,
409409
processed += to_process;
410410
} while (processed < nbytes);
411411

412-
rc = memcmp(csbcpb->cpb.aes_ccm.out_pat_or_mac, priv->oauth_tag,
412+
rc = crypto_memneq(csbcpb->cpb.aes_ccm.out_pat_or_mac, priv->oauth_tag,
413413
authsize) ? -EBADMSG : 0;
414414
out:
415415
spin_unlock_irqrestore(&nx_ctx->lock, irq_flags);

drivers/crypto/nx/nx-aes-gcm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include <crypto/internal/aead.h>
2323
#include <crypto/aes.h>
24+
#include <crypto/algapi.h>
2425
#include <crypto/scatterwalk.h>
2526
#include <linux/module.h>
2627
#include <linux/types.h>
@@ -418,7 +419,7 @@ static int gcm_aes_nx_crypt(struct aead_request *req, int enc,
418419
itag, req->src, req->assoclen + nbytes,
419420
crypto_aead_authsize(crypto_aead_reqtfm(req)),
420421
SCATTERWALK_FROM_SG);
421-
rc = memcmp(itag, otag,
422+
rc = crypto_memneq(itag, otag,
422423
crypto_aead_authsize(crypto_aead_reqtfm(req))) ?
423424
-EBADMSG : 0;
424425
}

drivers/crypto/talitos.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@ static void ipsec_esp_decrypt_swauth_done(struct device *dev,
977977
} else
978978
oicv = (char *)&edesc->link_tbl[0];
979979

980-
err = memcmp(oicv, icv, authsize) ? -EBADMSG : 0;
980+
err = crypto_memneq(oicv, icv, authsize) ? -EBADMSG : 0;
981981
}
982982

983983
kfree(edesc);

0 commit comments

Comments
 (0)