![Herbert Xu](/assets/img/avatar_default.png)
This patch adds the underlying givcrypt operations for aead and associated support elements. The rationale is identical to that of the skcipher givcrypt operations, i.e., sometimes only the algorithm knows how the IV should be generated. A new request type aead_givcrypt_request is added which contains an embedded aead_request structure with two new elements to support this operation. The new elements are seq and giv. The seq field should contain a strictly increasing 64-bit integer which may be used by certain IV generators as an input value. The giv field will be used to store the generated IV. It does not need to obey the alignment requirements of the algorithm because it's not used during the operation. The existing iv field must still be available as it will be used to store intermediate IVs and the output IV if chaining is desired. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
39 lines
920 B
C
39 lines
920 B
C
/*
|
|
* AEAD: Authenticated Encryption with Associated Data
|
|
*
|
|
* Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.au>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the Free
|
|
* Software Foundation; either version 2 of the License, or (at your option)
|
|
* any later version.
|
|
*
|
|
*/
|
|
|
|
#ifndef _CRYPTO_AEAD_H
|
|
#define _CRYPTO_AEAD_H
|
|
|
|
#include <linux/crypto.h>
|
|
#include <linux/kernel.h>
|
|
|
|
/**
|
|
* struct aead_givcrypt_request - AEAD request with IV generation
|
|
* @seq: Sequence number for IV generation
|
|
* @giv: Space for generated IV
|
|
* @areq: The AEAD request itself
|
|
*/
|
|
struct aead_givcrypt_request {
|
|
u64 seq;
|
|
u8 *giv;
|
|
|
|
struct aead_request areq;
|
|
};
|
|
|
|
static inline struct crypto_aead *aead_givcrypt_reqtfm(
|
|
struct aead_givcrypt_request *req)
|
|
{
|
|
return crypto_aead_reqtfm(&req->areq);
|
|
}
|
|
|
|
#endif /* _CRYPTO_AEAD_H */
|