aboutsummaryrefslogtreecommitdiffstats
path: root/include/crypto
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-05-11 05:48:12 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2015-05-12 22:31:53 -0400
commit5d1d65f8bea6de3d9c2c60fdfdd2da02da5ea672 (patch)
tree0ae938f7c50e7a8227f2f93087edf843b44621e5 /include/crypto
parent53033d4d36b0299ef02e28155913414ec1089aac (diff)
crypto: aead - Convert top level interface to new style
This patch converts the top-level aead interface to the new style. All user-level AEAD interface code have been moved into crypto/aead.h. The allocation/free functions have switched over to the new way of allocating tfms. This patch also removes the double indrection on setkey so the indirection now exists only at the alg level. Apart from these there are no user-visible changes. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto')
-rw-r--r--include/crypto/aead.h436
-rw-r--r--include/crypto/algapi.h33
-rw-r--r--include/crypto/internal/aead.h38
3 files changed, 467 insertions, 40 deletions
diff --git a/include/crypto/aead.h b/include/crypto/aead.h
index 94b19be67574..dbcad08f4891 100644
--- a/include/crypto/aead.h
+++ b/include/crypto/aead.h
@@ -18,6 +18,62 @@
18#include <linux/slab.h> 18#include <linux/slab.h>
19 19
20/** 20/**
21 * DOC: Authenticated Encryption With Associated Data (AEAD) Cipher API
22 *
23 * The AEAD cipher API is used with the ciphers of type CRYPTO_ALG_TYPE_AEAD
24 * (listed as type "aead" in /proc/crypto)
25 *
26 * The most prominent examples for this type of encryption is GCM and CCM.
27 * However, the kernel supports other types of AEAD ciphers which are defined
28 * with the following cipher string:
29 *
30 * authenc(keyed message digest, block cipher)
31 *
32 * For example: authenc(hmac(sha256), cbc(aes))
33 *
34 * The example code provided for the asynchronous block cipher operation
35 * applies here as well. Naturally all *ablkcipher* symbols must be exchanged
36 * the *aead* pendants discussed in the following. In addtion, for the AEAD
37 * operation, the aead_request_set_assoc function must be used to set the
38 * pointer to the associated data memory location before performing the
39 * encryption or decryption operation. In case of an encryption, the associated
40 * data memory is filled during the encryption operation. For decryption, the
41 * associated data memory must contain data that is used to verify the integrity
42 * of the decrypted data. Another deviation from the asynchronous block cipher
43 * operation is that the caller should explicitly check for -EBADMSG of the
44 * crypto_aead_decrypt. That error indicates an authentication error, i.e.
45 * a breach in the integrity of the message. In essence, that -EBADMSG error
46 * code is the key bonus an AEAD cipher has over "standard" block chaining
47 * modes.
48 */
49
50/**
51 * struct aead_request - AEAD request
52 * @base: Common attributes for async crypto requests
53 * @assoclen: Length in bytes of associated data for authentication
54 * @cryptlen: Length of data to be encrypted or decrypted
55 * @iv: Initialisation vector
56 * @assoc: Associated data
57 * @src: Source data
58 * @dst: Destination data
59 * @__ctx: Start of private context data
60 */
61struct aead_request {
62 struct crypto_async_request base;
63
64 unsigned int assoclen;
65 unsigned int cryptlen;
66
67 u8 *iv;
68
69 struct scatterlist *assoc;
70 struct scatterlist *src;
71 struct scatterlist *dst;
72
73 void *__ctx[] CRYPTO_MINALIGN_ATTR;
74};
75
76/**
21 * struct aead_givcrypt_request - AEAD request with IV generation 77 * struct aead_givcrypt_request - AEAD request with IV generation
22 * @seq: Sequence number for IV generation 78 * @seq: Sequence number for IV generation
23 * @giv: Space for generated IV 79 * @giv: Space for generated IV
@@ -30,6 +86,380 @@ struct aead_givcrypt_request {
30 struct aead_request areq; 86 struct aead_request areq;
31}; 87};
32 88
89struct crypto_aead {
90 int (*encrypt)(struct aead_request *req);
91 int (*decrypt)(struct aead_request *req);
92 int (*givencrypt)(struct aead_givcrypt_request *req);
93 int (*givdecrypt)(struct aead_givcrypt_request *req);
94
95 struct crypto_aead *child;
96
97 unsigned int ivsize;
98 unsigned int authsize;
99 unsigned int reqsize;
100
101 struct crypto_tfm base;
102};
103
104static inline struct crypto_aead *__crypto_aead_cast(struct crypto_tfm *tfm)
105{
106 return container_of(tfm, struct crypto_aead, base);
107}
108
109/**
110 * crypto_alloc_aead() - allocate AEAD cipher handle
111 * @alg_name: is the cra_name / name or cra_driver_name / driver name of the
112 * AEAD cipher
113 * @type: specifies the type of the cipher
114 * @mask: specifies the mask for the cipher
115 *
116 * Allocate a cipher handle for an AEAD. The returned struct
117 * crypto_aead is the cipher handle that is required for any subsequent
118 * API invocation for that AEAD.
119 *
120 * Return: allocated cipher handle in case of success; IS_ERR() is true in case
121 * of an error, PTR_ERR() returns the error code.
122 */
123struct crypto_aead *crypto_alloc_aead(const char *alg_name, u32 type, u32 mask);
124
125static inline struct crypto_tfm *crypto_aead_tfm(struct crypto_aead *tfm)
126{
127 return &tfm->base;
128}
129
130/**
131 * crypto_free_aead() - zeroize and free aead handle
132 * @tfm: cipher handle to be freed
133 */
134static inline void crypto_free_aead(struct crypto_aead *tfm)
135{
136 crypto_destroy_tfm(tfm, crypto_aead_tfm(tfm));
137}
138
139static inline struct crypto_aead *crypto_aead_crt(struct crypto_aead *tfm)
140{
141 return tfm;
142}
143
144/**
145 * crypto_aead_ivsize() - obtain IV size
146 * @tfm: cipher handle
147 *
148 * The size of the IV for the aead referenced by the cipher handle is
149 * returned. This IV size may be zero if the cipher does not need an IV.
150 *
151 * Return: IV size in bytes
152 */
153static inline unsigned int crypto_aead_ivsize(struct crypto_aead *tfm)
154{
155 return tfm->ivsize;
156}
157
158/**
159 * crypto_aead_authsize() - obtain maximum authentication data size
160 * @tfm: cipher handle
161 *
162 * The maximum size of the authentication data for the AEAD cipher referenced
163 * by the AEAD cipher handle is returned. The authentication data size may be
164 * zero if the cipher implements a hard-coded maximum.
165 *
166 * The authentication data may also be known as "tag value".
167 *
168 * Return: authentication data size / tag size in bytes
169 */
170static inline unsigned int crypto_aead_authsize(struct crypto_aead *tfm)
171{
172 return tfm->authsize;
173}
174
175/**
176 * crypto_aead_blocksize() - obtain block size of cipher
177 * @tfm: cipher handle
178 *
179 * The block size for the AEAD referenced with the cipher handle is returned.
180 * The caller may use that information to allocate appropriate memory for the
181 * data returned by the encryption or decryption operation
182 *
183 * Return: block size of cipher
184 */
185static inline unsigned int crypto_aead_blocksize(struct crypto_aead *tfm)
186{
187 return crypto_tfm_alg_blocksize(crypto_aead_tfm(tfm));
188}
189
190static inline unsigned int crypto_aead_alignmask(struct crypto_aead *tfm)
191{
192 return crypto_tfm_alg_alignmask(crypto_aead_tfm(tfm));
193}
194
195static inline u32 crypto_aead_get_flags(struct crypto_aead *tfm)
196{
197 return crypto_tfm_get_flags(crypto_aead_tfm(tfm));
198}
199
200static inline void crypto_aead_set_flags(struct crypto_aead *tfm, u32 flags)
201{
202 crypto_tfm_set_flags(crypto_aead_tfm(tfm), flags);
203}
204
205static inline void crypto_aead_clear_flags(struct crypto_aead *tfm, u32 flags)
206{
207 crypto_tfm_clear_flags(crypto_aead_tfm(tfm), flags);
208}
209
210/**
211 * crypto_aead_setkey() - set key for cipher
212 * @tfm: cipher handle
213 * @key: buffer holding the key
214 * @keylen: length of the key in bytes
215 *
216 * The caller provided key is set for the AEAD referenced by the cipher
217 * handle.
218 *
219 * Note, the key length determines the cipher type. Many block ciphers implement
220 * different cipher modes depending on the key size, such as AES-128 vs AES-192
221 * vs. AES-256. When providing a 16 byte key for an AES cipher handle, AES-128
222 * is performed.
223 *
224 * Return: 0 if the setting of the key was successful; < 0 if an error occurred
225 */
226int crypto_aead_setkey(struct crypto_aead *tfm,
227 const u8 *key, unsigned int keylen);
228
229/**
230 * crypto_aead_setauthsize() - set authentication data size
231 * @tfm: cipher handle
232 * @authsize: size of the authentication data / tag in bytes
233 *
234 * Set the authentication data size / tag size. AEAD requires an authentication
235 * tag (or MAC) in addition to the associated data.
236 *
237 * Return: 0 if the setting of the key was successful; < 0 if an error occurred
238 */
239int crypto_aead_setauthsize(struct crypto_aead *tfm, unsigned int authsize);
240
241static inline struct crypto_aead *crypto_aead_reqtfm(struct aead_request *req)
242{
243 return __crypto_aead_cast(req->base.tfm);
244}
245
246/**
247 * crypto_aead_encrypt() - encrypt plaintext
248 * @req: reference to the aead_request handle that holds all information
249 * needed to perform the cipher operation
250 *
251 * Encrypt plaintext data using the aead_request handle. That data structure
252 * and how it is filled with data is discussed with the aead_request_*
253 * functions.
254 *
255 * IMPORTANT NOTE The encryption operation creates the authentication data /
256 * tag. That data is concatenated with the created ciphertext.
257 * The ciphertext memory size is therefore the given number of
258 * block cipher blocks + the size defined by the
259 * crypto_aead_setauthsize invocation. The caller must ensure
260 * that sufficient memory is available for the ciphertext and
261 * the authentication tag.
262 *
263 * Return: 0 if the cipher operation was successful; < 0 if an error occurred
264 */
265static inline int crypto_aead_encrypt(struct aead_request *req)
266{
267 return crypto_aead_reqtfm(req)->encrypt(req);
268}
269
270/**
271 * crypto_aead_decrypt() - decrypt ciphertext
272 * @req: reference to the ablkcipher_request handle that holds all information
273 * needed to perform the cipher operation
274 *
275 * Decrypt ciphertext data using the aead_request handle. That data structure
276 * and how it is filled with data is discussed with the aead_request_*
277 * functions.
278 *
279 * IMPORTANT NOTE The caller must concatenate the ciphertext followed by the
280 * authentication data / tag. That authentication data / tag
281 * must have the size defined by the crypto_aead_setauthsize
282 * invocation.
283 *
284 *
285 * Return: 0 if the cipher operation was successful; -EBADMSG: The AEAD
286 * cipher operation performs the authentication of the data during the
287 * decryption operation. Therefore, the function returns this error if
288 * the authentication of the ciphertext was unsuccessful (i.e. the
289 * integrity of the ciphertext or the associated data was violated);
290 * < 0 if an error occurred.
291 */
292static inline int crypto_aead_decrypt(struct aead_request *req)
293{
294 if (req->cryptlen < crypto_aead_authsize(crypto_aead_reqtfm(req)))
295 return -EINVAL;
296
297 return crypto_aead_reqtfm(req)->decrypt(req);
298}
299
300/**
301 * DOC: Asynchronous AEAD Request Handle
302 *
303 * The aead_request data structure contains all pointers to data required for
304 * the AEAD cipher operation. This includes the cipher handle (which can be
305 * used by multiple aead_request instances), pointer to plaintext and
306 * ciphertext, asynchronous callback function, etc. It acts as a handle to the
307 * aead_request_* API calls in a similar way as AEAD handle to the
308 * crypto_aead_* API calls.
309 */
310
311/**
312 * crypto_aead_reqsize() - obtain size of the request data structure
313 * @tfm: cipher handle
314 *
315 * Return: number of bytes
316 */
317static inline unsigned int crypto_aead_reqsize(struct crypto_aead *tfm)
318{
319 return tfm->reqsize;
320}
321
322/**
323 * aead_request_set_tfm() - update cipher handle reference in request
324 * @req: request handle to be modified
325 * @tfm: cipher handle that shall be added to the request handle
326 *
327 * Allow the caller to replace the existing aead handle in the request
328 * data structure with a different one.
329 */
330static inline void aead_request_set_tfm(struct aead_request *req,
331 struct crypto_aead *tfm)
332{
333 req->base.tfm = crypto_aead_tfm(tfm->child);
334}
335
336/**
337 * aead_request_alloc() - allocate request data structure
338 * @tfm: cipher handle to be registered with the request
339 * @gfp: memory allocation flag that is handed to kmalloc by the API call.
340 *
341 * Allocate the request data structure that must be used with the AEAD
342 * encrypt and decrypt API calls. During the allocation, the provided aead
343 * handle is registered in the request data structure.
344 *
345 * Return: allocated request handle in case of success; IS_ERR() is true in case
346 * of an error, PTR_ERR() returns the error code.
347 */
348static inline struct aead_request *aead_request_alloc(struct crypto_aead *tfm,
349 gfp_t gfp)
350{
351 struct aead_request *req;
352
353 req = kmalloc(sizeof(*req) + crypto_aead_reqsize(tfm), gfp);
354
355 if (likely(req))
356 aead_request_set_tfm(req, tfm);
357
358 return req;
359}
360
361/**
362 * aead_request_free() - zeroize and free request data structure
363 * @req: request data structure cipher handle to be freed
364 */
365static inline void aead_request_free(struct aead_request *req)
366{
367 kzfree(req);
368}
369
370/**
371 * aead_request_set_callback() - set asynchronous callback function
372 * @req: request handle
373 * @flags: specify zero or an ORing of the flags
374 * CRYPTO_TFM_REQ_MAY_BACKLOG the request queue may back log and
375 * increase the wait queue beyond the initial maximum size;
376 * CRYPTO_TFM_REQ_MAY_SLEEP the request processing may sleep
377 * @compl: callback function pointer to be registered with the request handle
378 * @data: The data pointer refers to memory that is not used by the kernel
379 * crypto API, but provided to the callback function for it to use. Here,
380 * the caller can provide a reference to memory the callback function can
381 * operate on. As the callback function is invoked asynchronously to the
382 * related functionality, it may need to access data structures of the
383 * related functionality which can be referenced using this pointer. The
384 * callback function can access the memory via the "data" field in the
385 * crypto_async_request data structure provided to the callback function.
386 *
387 * Setting the callback function that is triggered once the cipher operation
388 * completes
389 *
390 * The callback function is registered with the aead_request handle and
391 * must comply with the following template
392 *
393 * void callback_function(struct crypto_async_request *req, int error)
394 */
395static inline void aead_request_set_callback(struct aead_request *req,
396 u32 flags,
397 crypto_completion_t compl,
398 void *data)
399{
400 req->base.complete = compl;
401 req->base.data = data;
402 req->base.flags = flags;
403}
404
405/**
406 * aead_request_set_crypt - set data buffers
407 * @req: request handle
408 * @src: source scatter / gather list
409 * @dst: destination scatter / gather list
410 * @cryptlen: number of bytes to process from @src
411 * @iv: IV for the cipher operation which must comply with the IV size defined
412 * by crypto_aead_ivsize()
413 *
414 * Setting the source data and destination data scatter / gather lists.
415 *
416 * For encryption, the source is treated as the plaintext and the
417 * destination is the ciphertext. For a decryption operation, the use is
418 * reversed - the source is the ciphertext and the destination is the plaintext.
419 *
420 * IMPORTANT NOTE AEAD requires an authentication tag (MAC). For decryption,
421 * the caller must concatenate the ciphertext followed by the
422 * authentication tag and provide the entire data stream to the
423 * decryption operation (i.e. the data length used for the
424 * initialization of the scatterlist and the data length for the
425 * decryption operation is identical). For encryption, however,
426 * the authentication tag is created while encrypting the data.
427 * The destination buffer must hold sufficient space for the
428 * ciphertext and the authentication tag while the encryption
429 * invocation must only point to the plaintext data size. The
430 * following code snippet illustrates the memory usage
431 * buffer = kmalloc(ptbuflen + (enc ? authsize : 0));
432 * sg_init_one(&sg, buffer, ptbuflen + (enc ? authsize : 0));
433 * aead_request_set_crypt(req, &sg, &sg, ptbuflen, iv);
434 */
435static inline void aead_request_set_crypt(struct aead_request *req,
436 struct scatterlist *src,
437 struct scatterlist *dst,
438 unsigned int cryptlen, u8 *iv)
439{
440 req->src = src;
441 req->dst = dst;
442 req->cryptlen = cryptlen;
443 req->iv = iv;
444}
445
446/**
447 * aead_request_set_assoc() - set the associated data scatter / gather list
448 * @req: request handle
449 * @assoc: associated data scatter / gather list
450 * @assoclen: number of bytes to process from @assoc
451 *
452 * For encryption, the memory is filled with the associated data. For
453 * decryption, the memory must point to the associated data.
454 */
455static inline void aead_request_set_assoc(struct aead_request *req,
456 struct scatterlist *assoc,
457 unsigned int assoclen)
458{
459 req->assoc = assoc;
460 req->assoclen = assoclen;
461}
462
33static inline struct crypto_aead *aead_givcrypt_reqtfm( 463static inline struct crypto_aead *aead_givcrypt_reqtfm(
34 struct aead_givcrypt_request *req) 464 struct aead_givcrypt_request *req)
35{ 465{
@@ -38,14 +468,12 @@ static inline struct crypto_aead *aead_givcrypt_reqtfm(
38 468
39static inline int crypto_aead_givencrypt(struct aead_givcrypt_request *req) 469static inline int crypto_aead_givencrypt(struct aead_givcrypt_request *req)
40{ 470{
41 struct aead_tfm *crt = crypto_aead_crt(aead_givcrypt_reqtfm(req)); 471 return aead_givcrypt_reqtfm(req)->givencrypt(req);
42 return crt->givencrypt(req);
43}; 472};
44 473
45static inline int crypto_aead_givdecrypt(struct aead_givcrypt_request *req) 474static inline int crypto_aead_givdecrypt(struct aead_givcrypt_request *req)
46{ 475{
47 struct aead_tfm *crt = crypto_aead_crt(aead_givcrypt_reqtfm(req)); 476 return aead_givcrypt_reqtfm(req)->givdecrypt(req);
48 return crt->givdecrypt(req);
49}; 477};
50 478
51static inline void aead_givcrypt_set_tfm(struct aead_givcrypt_request *req, 479static inline void aead_givcrypt_set_tfm(struct aead_givcrypt_request *req,
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index a949bf70983b..d4ebf6e9af6a 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -17,6 +17,7 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/skbuff.h> 18#include <linux/skbuff.h>
19 19
20struct crypto_aead;
20struct module; 21struct module;
21struct rtattr; 22struct rtattr;
22struct seq_file; 23struct seq_file;
@@ -126,7 +127,6 @@ struct ablkcipher_walk {
126}; 127};
127 128
128extern const struct crypto_type crypto_ablkcipher_type; 129extern const struct crypto_type crypto_ablkcipher_type;
129extern const struct crypto_type crypto_aead_type;
130extern const struct crypto_type crypto_blkcipher_type; 130extern const struct crypto_type crypto_blkcipher_type;
131 131
132void crypto_mod_put(struct crypto_alg *alg); 132void crypto_mod_put(struct crypto_alg *alg);
@@ -241,22 +241,6 @@ static inline void *crypto_ablkcipher_ctx_aligned(struct crypto_ablkcipher *tfm)
241 return crypto_tfm_ctx_aligned(&tfm->base); 241 return crypto_tfm_ctx_aligned(&tfm->base);
242} 242}
243 243
244static inline struct aead_alg *crypto_aead_alg(struct crypto_aead *tfm)
245{
246 return &crypto_aead_tfm(tfm)->__crt_alg->cra_aead;
247}
248
249static inline void *crypto_aead_ctx(struct crypto_aead *tfm)
250{
251 return crypto_tfm_ctx(&tfm->base);
252}
253
254static inline struct crypto_instance *crypto_aead_alg_instance(
255 struct crypto_aead *aead)
256{
257 return crypto_tfm_alg_instance(&aead->base);
258}
259
260static inline struct crypto_blkcipher *crypto_spawn_blkcipher( 244static inline struct crypto_blkcipher *crypto_spawn_blkcipher(
261 struct crypto_spawn *spawn) 245 struct crypto_spawn *spawn)
262{ 246{
@@ -365,21 +349,6 @@ static inline int ablkcipher_tfm_in_queue(struct crypto_queue *queue,
365 return crypto_tfm_in_queue(queue, crypto_ablkcipher_tfm(tfm)); 349 return crypto_tfm_in_queue(queue, crypto_ablkcipher_tfm(tfm));
366} 350}
367 351
368static inline void *aead_request_ctx(struct aead_request *req)
369{
370 return req->__ctx;
371}
372
373static inline void aead_request_complete(struct aead_request *req, int err)
374{
375 req->base.complete(&req->base, err);
376}
377
378static inline u32 aead_request_flags(struct aead_request *req)
379{
380 return req->base.flags;
381}
382
383static inline struct crypto_alg *crypto_get_attr_alg(struct rtattr **tb, 352static inline struct crypto_alg *crypto_get_attr_alg(struct rtattr **tb,
384 u32 type, u32 mask) 353 u32 type, u32 mask)
385{ 354{
diff --git a/include/crypto/internal/aead.h b/include/crypto/internal/aead.h
index 750948cf4621..a2d104aa3430 100644
--- a/include/crypto/internal/aead.h
+++ b/include/crypto/internal/aead.h
@@ -23,8 +23,40 @@ struct crypto_aead_spawn {
23 struct crypto_spawn base; 23 struct crypto_spawn base;
24}; 24};
25 25
26extern const struct crypto_type crypto_aead_type;
26extern const struct crypto_type crypto_nivaead_type; 27extern const struct crypto_type crypto_nivaead_type;
27 28
29static inline struct aead_alg *crypto_aead_alg(struct crypto_aead *tfm)
30{
31 return &crypto_aead_tfm(tfm)->__crt_alg->cra_aead;
32}
33
34static inline void *crypto_aead_ctx(struct crypto_aead *tfm)
35{
36 return crypto_tfm_ctx(&tfm->base);
37}
38
39static inline struct crypto_instance *crypto_aead_alg_instance(
40 struct crypto_aead *aead)
41{
42 return crypto_tfm_alg_instance(&aead->base);
43}
44
45static inline void *aead_request_ctx(struct aead_request *req)
46{
47 return req->__ctx;
48}
49
50static inline void aead_request_complete(struct aead_request *req, int err)
51{
52 req->base.complete(&req->base, err);
53}
54
55static inline u32 aead_request_flags(struct aead_request *req)
56{
57 return req->base.flags;
58}
59
28static inline void crypto_set_aead_spawn( 60static inline void crypto_set_aead_spawn(
29 struct crypto_aead_spawn *spawn, struct crypto_instance *inst) 61 struct crypto_aead_spawn *spawn, struct crypto_instance *inst)
30{ 62{
@@ -50,9 +82,7 @@ static inline struct crypto_alg *crypto_aead_spawn_alg(
50static inline struct crypto_aead *crypto_spawn_aead( 82static inline struct crypto_aead *crypto_spawn_aead(
51 struct crypto_aead_spawn *spawn) 83 struct crypto_aead_spawn *spawn)
52{ 84{
53 return __crypto_aead_cast( 85 return crypto_spawn_tfm2(&spawn->base);
54 crypto_spawn_tfm(&spawn->base, CRYPTO_ALG_TYPE_AEAD,
55 CRYPTO_ALG_TYPE_MASK));
56} 86}
57 87
58struct crypto_instance *aead_geniv_alloc(struct crypto_template *tmpl, 88struct crypto_instance *aead_geniv_alloc(struct crypto_template *tmpl,
@@ -64,7 +94,7 @@ void aead_geniv_exit(struct crypto_tfm *tfm);
64 94
65static inline struct crypto_aead *aead_geniv_base(struct crypto_aead *geniv) 95static inline struct crypto_aead *aead_geniv_base(struct crypto_aead *geniv)
66{ 96{
67 return crypto_aead_crt(geniv)->base; 97 return geniv->child;
68} 98}
69 99
70static inline void *aead_givcrypt_reqctx(struct aead_givcrypt_request *req) 100static inline void *aead_givcrypt_reqctx(struct aead_givcrypt_request *req)