Commit 9cfe5212 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 849ee3d4 79960943
...@@ -409,7 +409,7 @@ static int ccm_nx_decrypt(struct aead_request *req, ...@@ -409,7 +409,7 @@ static int ccm_nx_decrypt(struct aead_request *req,
processed += to_process; processed += to_process;
} while (processed < nbytes); } while (processed < nbytes);
rc = memcmp(csbcpb->cpb.aes_ccm.out_pat_or_mac, priv->oauth_tag, rc = crypto_memneq(csbcpb->cpb.aes_ccm.out_pat_or_mac, priv->oauth_tag,
authsize) ? -EBADMSG : 0; authsize) ? -EBADMSG : 0;
out: out:
spin_unlock_irqrestore(&nx_ctx->lock, irq_flags); spin_unlock_irqrestore(&nx_ctx->lock, irq_flags);
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <crypto/internal/aead.h> #include <crypto/internal/aead.h>
#include <crypto/aes.h> #include <crypto/aes.h>
#include <crypto/algapi.h>
#include <crypto/scatterwalk.h> #include <crypto/scatterwalk.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -418,7 +419,7 @@ static int gcm_aes_nx_crypt(struct aead_request *req, int enc, ...@@ -418,7 +419,7 @@ static int gcm_aes_nx_crypt(struct aead_request *req, int enc,
itag, req->src, req->assoclen + nbytes, itag, req->src, req->assoclen + nbytes,
crypto_aead_authsize(crypto_aead_reqtfm(req)), crypto_aead_authsize(crypto_aead_reqtfm(req)),
SCATTERWALK_FROM_SG); SCATTERWALK_FROM_SG);
rc = memcmp(itag, otag, rc = crypto_memneq(itag, otag,
crypto_aead_authsize(crypto_aead_reqtfm(req))) ? crypto_aead_authsize(crypto_aead_reqtfm(req))) ?
-EBADMSG : 0; -EBADMSG : 0;
} }
......
...@@ -977,7 +977,7 @@ static void ipsec_esp_decrypt_swauth_done(struct device *dev, ...@@ -977,7 +977,7 @@ static void ipsec_esp_decrypt_swauth_done(struct device *dev,
} else } else
oicv = (char *)&edesc->link_tbl[0]; oicv = (char *)&edesc->link_tbl[0];
err = memcmp(oicv, icv, authsize) ? -EBADMSG : 0; err = crypto_memneq(oicv, icv, authsize) ? -EBADMSG : 0;
} }
kfree(edesc); kfree(edesc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment