Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=551a09a7a954f720067f207657bbbd26a3fe156a
Commit:     551a09a7a954f720067f207657bbbd26a3fe156a
Parent:     5e553110f27ff77591ec7305c6216ad6949f7a95
Author:     Herbert Xu <[EMAIL PROTECTED]>
AuthorDate: Sat Dec 1 21:47:07 2007 +1100
Committer:  Herbert Xu <[EMAIL PROTECTED]>
CommitDate: Fri Jan 11 08:16:39 2008 +1100

    [CRYPTO] api: Sanitise mask when allocating ablkcipher/hash
    
    When allocating ablkcipher/hash objects, we use a mask that's wider than
    the usual type mask.  This patch sanitises the mask supplied by the user
    so we don't end up using a narrower mask which may lead to unintended
    results.
    
    Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>
---
 include/linux/crypto.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 48aa595..ef7642e 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -532,6 +532,7 @@ static inline struct crypto_ablkcipher 
*crypto_alloc_ablkcipher(
        const char *alg_name, u32 type, u32 mask)
 {
        type &= ~CRYPTO_ALG_TYPE_MASK;
+       mask &= ~CRYPTO_ALG_TYPE_MASK;
        type |= CRYPTO_ALG_TYPE_BLKCIPHER;
        mask |= CRYPTO_ALG_TYPE_BLKCIPHER_MASK;
 
@@ -554,6 +555,7 @@ static inline int crypto_has_ablkcipher(const char 
*alg_name, u32 type,
                                        u32 mask)
 {
        type &= ~CRYPTO_ALG_TYPE_MASK;
+       mask &= ~CRYPTO_ALG_TYPE_MASK;
        type |= CRYPTO_ALG_TYPE_BLKCIPHER;
        mask |= CRYPTO_ALG_TYPE_BLKCIPHER_MASK;
 
@@ -1086,6 +1088,7 @@ static inline struct crypto_hash *crypto_alloc_hash(const 
char *alg_name,
                                                    u32 type, u32 mask)
 {
        type &= ~CRYPTO_ALG_TYPE_MASK;
+       mask &= ~CRYPTO_ALG_TYPE_MASK;
        type |= CRYPTO_ALG_TYPE_HASH;
        mask |= CRYPTO_ALG_TYPE_HASH_MASK;
 
@@ -1105,6 +1108,7 @@ static inline void crypto_free_hash(struct crypto_hash 
*tfm)
 static inline int crypto_has_hash(const char *alg_name, u32 type, u32 mask)
 {
        type &= ~CRYPTO_ALG_TYPE_MASK;
+       mask &= ~CRYPTO_ALG_TYPE_MASK;
        type |= CRYPTO_ALG_TYPE_HASH;
        mask |= CRYPTO_ALG_TYPE_HASH_MASK;
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to