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 the following issues: API: - A large number of bug fixes for the af_alg interface, credit goes to Dmitry Vyukov for discovering and reporting these issues. Algorithms: - sw842 needs to select crc32. - The soft dependency on crc32c is now in the correct spot. Drivers: - The atmel AES driver needs HAS_DMA. - The atmel AES driver was a missing break statement, fortunately it's only a debug function. - A number of bug fixes for the Intel qat driver" * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (24 commits) crypto: algif_skcipher - sendmsg SG marking is off by one crypto: crc32c - Fix crc32c soft dependency crypto: algif_skcipher - Load TX SG list after waiting crypto: atmel-aes - Add missing break to atmel_aes_reg_name crypto: algif_skcipher - Fix race condition in skcipher_check_key crypto: algif_hash - Fix race condition in hash_check_key crypto: CRYPTO_DEV_ATMEL_AES should depend on HAS_DMA lib: sw842: select crc32 crypto: af_alg - Forbid bind(2) when nokey child sockets are present crypto: algif_skcipher - Remove custom release parent function crypto: algif_hash - Remove custom release parent function crypto: af_alg - Allow af_af_alg_release_parent to be called on nokey path crypto: qat - update init_esram for C3xxx dev type crypto: qat - fix timeout issues crypto: qat - remove to call get_sram_bar_id for qat_c3xxx crypto: algif_skcipher - Add key check exception for cipher_null crypto: skcipher - Add crypto_skcipher_has_setkey crypto: algif_hash - Require setkey before accept(2) crypto: hash - Add crypto_ahash_has_setkey crypto: algif_skcipher - Add nokey compatibility path ...
This commit is contained in:
commit
48162a203e
15 changed files with 411 additions and 45 deletions
|
@ -204,6 +204,7 @@ struct crypto_ahash {
|
|||
unsigned int keylen);
|
||||
|
||||
unsigned int reqsize;
|
||||
bool has_setkey;
|
||||
struct crypto_tfm base;
|
||||
};
|
||||
|
||||
|
@ -375,6 +376,11 @@ static inline void *ahash_request_ctx(struct ahash_request *req)
|
|||
int crypto_ahash_setkey(struct crypto_ahash *tfm, const u8 *key,
|
||||
unsigned int keylen);
|
||||
|
||||
static inline bool crypto_ahash_has_setkey(struct crypto_ahash *tfm)
|
||||
{
|
||||
return tfm->has_setkey;
|
||||
}
|
||||
|
||||
/**
|
||||
* crypto_ahash_finup() - update and finalize message digest
|
||||
* @req: reference to the ahash_request handle that holds all information
|
||||
|
|
|
@ -30,6 +30,9 @@ struct alg_sock {
|
|||
|
||||
struct sock *parent;
|
||||
|
||||
unsigned int refcnt;
|
||||
unsigned int nokey_refcnt;
|
||||
|
||||
const struct af_alg_type *type;
|
||||
void *private;
|
||||
};
|
||||
|
@ -50,9 +53,11 @@ struct af_alg_type {
|
|||
void (*release)(void *private);
|
||||
int (*setkey)(void *private, const u8 *key, unsigned int keylen);
|
||||
int (*accept)(void *private, struct sock *sk);
|
||||
int (*accept_nokey)(void *private, struct sock *sk);
|
||||
int (*setauthsize)(void *private, unsigned int authsize);
|
||||
|
||||
struct proto_ops *ops;
|
||||
struct proto_ops *ops_nokey;
|
||||
struct module *owner;
|
||||
char name[14];
|
||||
};
|
||||
|
@ -67,6 +72,7 @@ int af_alg_register_type(const struct af_alg_type *type);
|
|||
int af_alg_unregister_type(const struct af_alg_type *type);
|
||||
|
||||
int af_alg_release(struct socket *sock);
|
||||
void af_alg_release_parent(struct sock *sk);
|
||||
int af_alg_accept(struct sock *sk, struct socket *newsock);
|
||||
|
||||
int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov_iter *iter, int len);
|
||||
|
@ -83,11 +89,6 @@ static inline struct alg_sock *alg_sk(struct sock *sk)
|
|||
return (struct alg_sock *)sk;
|
||||
}
|
||||
|
||||
static inline void af_alg_release_parent(struct sock *sk)
|
||||
{
|
||||
sock_put(alg_sk(sk)->parent);
|
||||
}
|
||||
|
||||
static inline void af_alg_init_completion(struct af_alg_completion *completion)
|
||||
{
|
||||
init_completion(&completion->completion);
|
||||
|
|
|
@ -61,6 +61,8 @@ struct crypto_skcipher {
|
|||
unsigned int ivsize;
|
||||
unsigned int reqsize;
|
||||
|
||||
bool has_setkey;
|
||||
|
||||
struct crypto_tfm base;
|
||||
};
|
||||
|
||||
|
@ -305,6 +307,11 @@ static inline int crypto_skcipher_setkey(struct crypto_skcipher *tfm,
|
|||
return tfm->setkey(tfm, key, keylen);
|
||||
}
|
||||
|
||||
static inline bool crypto_skcipher_has_setkey(struct crypto_skcipher *tfm)
|
||||
{
|
||||
return tfm->has_setkey;
|
||||
}
|
||||
|
||||
/**
|
||||
* crypto_skcipher_reqtfm() - obtain cipher handle from request
|
||||
* @req: skcipher_request out of which the cipher handle is to be obtained
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue