mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
[CRYPTO] aead: Make authsize a run-time parameter
As it is authsize is an algorithm paramter which cannot be changed at run-time. This is inconvenient because hardware that implements such algorithms would have to register each authsize that they support separately. Since authsize is a property common to all AEAD algorithms, we can add a function setauthsize that sets it at run-time, just like setkey. This patch does exactly that and also changes authenc so that authsize is no longer a parameter of its template. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
e29bc6ad0e
commit
7ba683a6de
4 changed files with 38 additions and 32 deletions
|
@ -187,11 +187,12 @@ struct ablkcipher_alg {
|
|||
struct aead_alg {
|
||||
int (*setkey)(struct crypto_aead *tfm, const u8 *key,
|
||||
unsigned int keylen);
|
||||
int (*setauthsize)(struct crypto_aead *tfm, unsigned int authsize);
|
||||
int (*encrypt)(struct aead_request *req);
|
||||
int (*decrypt)(struct aead_request *req);
|
||||
|
||||
unsigned int ivsize;
|
||||
unsigned int authsize;
|
||||
unsigned int maxauthsize;
|
||||
};
|
||||
|
||||
struct blkcipher_alg {
|
||||
|
@ -754,6 +755,8 @@ static inline int crypto_aead_setkey(struct crypto_aead *tfm, const u8 *key,
|
|||
return crypto_aead_crt(tfm)->setkey(tfm, key, keylen);
|
||||
}
|
||||
|
||||
int crypto_aead_setauthsize(struct crypto_aead *tfm, unsigned int authsize);
|
||||
|
||||
static inline struct crypto_aead *crypto_aead_reqtfm(struct aead_request *req)
|
||||
{
|
||||
return __crypto_aead_cast(req->base.tfm);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue