2 * algif_aead: User-space interface for AEAD algorithms
4 * Copyright (C) 2014, Stephan Mueller <smueller@chronox.de>
6 * This file provides the user-space API for AEAD ciphers.
8 * This file is derived from algif_skcipher.c.
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the Free
12 * Software Foundation; either version 2 of the License, or (at your option)
16 #include <crypto/internal/aead.h>
17 #include <crypto/scatterwalk.h>
18 #include <crypto/if_alg.h>
19 #include <linux/init.h>
20 #include <linux/list.h>
21 #include <linux/kernel.h>
23 #include <linux/module.h>
24 #include <linux/net.h>
29 struct scatterlist sg
[ALG_MAX_PAGES
];
32 struct aead_async_rsgl
{
33 struct af_alg_sgl sgl
;
34 struct list_head list
;
37 struct aead_async_req
{
38 struct scatterlist
*tsgl
;
39 struct aead_async_rsgl first_rsgl
;
40 struct list_head list
;
48 struct crypto_aead
*aead
;
53 struct aead_sg_list tsgl
;
54 struct aead_async_rsgl first_rsgl
;
55 struct list_head list
;
59 struct af_alg_completion completion
;
69 struct aead_request aead_req
;
72 static inline int aead_sndbuf(struct sock
*sk
)
74 struct alg_sock
*ask
= alg_sk(sk
);
75 struct aead_ctx
*ctx
= ask
->private;
77 return max_t(int, max_t(int, sk
->sk_sndbuf
& PAGE_MASK
, PAGE_SIZE
) -
81 static inline bool aead_writable(struct sock
*sk
)
83 return PAGE_SIZE
<= aead_sndbuf(sk
);
86 static inline bool aead_sufficient_data(struct aead_ctx
*ctx
)
88 unsigned as
= crypto_aead_authsize(crypto_aead_reqtfm(&ctx
->aead_req
));
91 * The minimum amount of memory needed for an AEAD cipher is
92 * the AAD and in case of decryption the tag.
94 return ctx
->used
>= ctx
->aead_assoclen
+ (ctx
->enc
? 0 : as
);
97 static void aead_reset_ctx(struct aead_ctx
*ctx
)
99 struct aead_sg_list
*sgl
= &ctx
->tsgl
;
101 sg_init_table(sgl
->sg
, ALG_MAX_PAGES
);
108 static void aead_put_sgl(struct sock
*sk
)
110 struct alg_sock
*ask
= alg_sk(sk
);
111 struct aead_ctx
*ctx
= ask
->private;
112 struct aead_sg_list
*sgl
= &ctx
->tsgl
;
113 struct scatterlist
*sg
= sgl
->sg
;
116 for (i
= 0; i
< sgl
->cur
; i
++) {
117 if (!sg_page(sg
+ i
))
120 put_page(sg_page(sg
+ i
));
121 sg_assign_page(sg
+ i
, NULL
);
126 static void aead_wmem_wakeup(struct sock
*sk
)
128 struct socket_wq
*wq
;
130 if (!aead_writable(sk
))
134 wq
= rcu_dereference(sk
->sk_wq
);
135 if (skwq_has_sleeper(wq
))
136 wake_up_interruptible_sync_poll(&wq
->wait
, POLLIN
|
139 sk_wake_async(sk
, SOCK_WAKE_WAITD
, POLL_IN
);
143 static int aead_wait_for_data(struct sock
*sk
, unsigned flags
)
145 struct alg_sock
*ask
= alg_sk(sk
);
146 struct aead_ctx
*ctx
= ask
->private;
149 int err
= -ERESTARTSYS
;
151 if (flags
& MSG_DONTWAIT
)
154 sk_set_bit(SOCKWQ_ASYNC_WAITDATA
, sk
);
157 if (signal_pending(current
))
159 prepare_to_wait(sk_sleep(sk
), &wait
, TASK_INTERRUPTIBLE
);
160 timeout
= MAX_SCHEDULE_TIMEOUT
;
161 if (sk_wait_event(sk
, &timeout
, !ctx
->more
)) {
166 finish_wait(sk_sleep(sk
), &wait
);
168 sk_clear_bit(SOCKWQ_ASYNC_WAITDATA
, sk
);
173 static void aead_data_wakeup(struct sock
*sk
)
175 struct alg_sock
*ask
= alg_sk(sk
);
176 struct aead_ctx
*ctx
= ask
->private;
177 struct socket_wq
*wq
;
185 wq
= rcu_dereference(sk
->sk_wq
);
186 if (skwq_has_sleeper(wq
))
187 wake_up_interruptible_sync_poll(&wq
->wait
, POLLOUT
|
190 sk_wake_async(sk
, SOCK_WAKE_SPACE
, POLL_OUT
);
194 static int aead_sendmsg(struct socket
*sock
, struct msghdr
*msg
, size_t size
)
196 struct sock
*sk
= sock
->sk
;
197 struct alg_sock
*ask
= alg_sk(sk
);
198 struct aead_ctx
*ctx
= ask
->private;
200 crypto_aead_ivsize(crypto_aead_reqtfm(&ctx
->aead_req
));
201 struct aead_sg_list
*sgl
= &ctx
->tsgl
;
202 struct af_alg_control con
= {};
208 if (msg
->msg_controllen
) {
209 err
= af_alg_cmsg_send(msg
, &con
);
225 if (con
.iv
&& con
.iv
->ivlen
!= ivsize
)
230 if (!ctx
->more
&& ctx
->used
)
236 memcpy(ctx
->iv
, con
.iv
->iv
, ivsize
);
238 ctx
->aead_assoclen
= con
.aead_assoclen
;
243 struct scatterlist
*sg
= NULL
;
245 /* use the existing memory in an allocated page */
247 sg
= sgl
->sg
+ sgl
->cur
- 1;
248 len
= min_t(unsigned long, len
,
249 PAGE_SIZE
- sg
->offset
- sg
->length
);
250 err
= memcpy_from_msg(page_address(sg_page(sg
)) +
251 sg
->offset
+ sg
->length
,
257 ctx
->merge
= (sg
->offset
+ sg
->length
) &
266 if (!aead_writable(sk
)) {
267 /* user space sent too much data */
273 /* allocate a new page */
274 len
= min_t(unsigned long, size
, aead_sndbuf(sk
));
278 if (sgl
->cur
>= ALG_MAX_PAGES
) {
284 sg
= sgl
->sg
+ sgl
->cur
;
285 plen
= min_t(size_t, len
, PAGE_SIZE
);
287 sg_assign_page(sg
, alloc_page(GFP_KERNEL
));
292 err
= memcpy_from_msg(page_address(sg_page(sg
)),
295 __free_page(sg_page(sg
));
296 sg_assign_page(sg
, NULL
);
307 ctx
->merge
= plen
& (PAGE_SIZE
- 1);
313 ctx
->more
= msg
->msg_flags
& MSG_MORE
;
314 if (!ctx
->more
&& !aead_sufficient_data(ctx
)) {
320 aead_data_wakeup(sk
);
323 return err
?: copied
;
326 static ssize_t
aead_sendpage(struct socket
*sock
, struct page
*page
,
327 int offset
, size_t size
, int flags
)
329 struct sock
*sk
= sock
->sk
;
330 struct alg_sock
*ask
= alg_sk(sk
);
331 struct aead_ctx
*ctx
= ask
->private;
332 struct aead_sg_list
*sgl
= &ctx
->tsgl
;
335 if (flags
& MSG_SENDPAGE_NOTLAST
)
338 if (sgl
->cur
>= ALG_MAX_PAGES
)
342 if (!ctx
->more
&& ctx
->used
)
348 if (!aead_writable(sk
)) {
349 /* user space sent too much data */
358 sg_set_page(sgl
->sg
+ sgl
->cur
, page
, size
, offset
);
365 ctx
->more
= flags
& MSG_MORE
;
366 if (!ctx
->more
&& !aead_sufficient_data(ctx
)) {
372 aead_data_wakeup(sk
);
378 #define GET_ASYM_REQ(req, tfm) (struct aead_async_req *) \
379 ((char *)req + sizeof(struct aead_request) + \
380 crypto_aead_reqsize(tfm))
382 #define GET_REQ_SIZE(tfm) sizeof(struct aead_async_req) + \
383 crypto_aead_reqsize(tfm) + crypto_aead_ivsize(tfm) + \
384 sizeof(struct aead_request)
386 static void aead_async_cb(struct crypto_async_request
*_req
, int err
)
388 struct aead_request
*req
= _req
->data
;
389 struct crypto_aead
*tfm
= crypto_aead_reqtfm(req
);
390 struct aead_async_req
*areq
= GET_ASYM_REQ(req
, tfm
);
391 struct sock
*sk
= areq
->sk
;
392 struct scatterlist
*sg
= areq
->tsgl
;
393 struct aead_async_rsgl
*rsgl
;
394 struct kiocb
*iocb
= areq
->iocb
;
395 unsigned int i
, reqlen
= GET_REQ_SIZE(tfm
);
397 list_for_each_entry(rsgl
, &areq
->list
, list
) {
398 af_alg_free_sg(&rsgl
->sgl
);
399 if (rsgl
!= &areq
->first_rsgl
)
400 sock_kfree_s(sk
, rsgl
, sizeof(*rsgl
));
403 for (i
= 0; i
< areq
->tsgls
; i
++)
404 put_page(sg_page(sg
+ i
));
406 sock_kfree_s(sk
, areq
->tsgl
, sizeof(*areq
->tsgl
) * areq
->tsgls
);
407 sock_kfree_s(sk
, req
, reqlen
);
409 iocb
->ki_complete(iocb
, err
, err
);
412 static int aead_recvmsg_async(struct socket
*sock
, struct msghdr
*msg
,
415 struct sock
*sk
= sock
->sk
;
416 struct alg_sock
*ask
= alg_sk(sk
);
417 struct aead_ctx
*ctx
= ask
->private;
418 struct crypto_aead
*tfm
= crypto_aead_reqtfm(&ctx
->aead_req
);
419 struct aead_async_req
*areq
;
420 struct aead_request
*req
= NULL
;
421 struct aead_sg_list
*sgl
= &ctx
->tsgl
;
422 struct aead_async_rsgl
*last_rsgl
= NULL
, *rsgl
;
423 unsigned int as
= crypto_aead_authsize(tfm
);
424 unsigned int i
, reqlen
= GET_REQ_SIZE(tfm
);
428 size_t usedpages
= 0;
432 err
= aead_wait_for_data(sk
, flags
);
437 if (!aead_sufficient_data(ctx
))
446 req
= sock_kmalloc(sk
, reqlen
, GFP_KERNEL
);
450 areq
= GET_ASYM_REQ(req
, tfm
);
451 memset(&areq
->first_rsgl
, '\0', sizeof(areq
->first_rsgl
));
452 INIT_LIST_HEAD(&areq
->list
);
453 areq
->iocb
= msg
->msg_iocb
;
455 memcpy(areq
->iv
, ctx
->iv
, crypto_aead_ivsize(tfm
));
456 aead_request_set_tfm(req
, tfm
);
457 aead_request_set_ad(req
, ctx
->aead_assoclen
);
458 aead_request_set_callback(req
, CRYPTO_TFM_REQ_MAY_BACKLOG
,
460 used
-= ctx
->aead_assoclen
;
462 /* take over all tx sgls from ctx */
463 areq
->tsgl
= sock_kmalloc(sk
, sizeof(*areq
->tsgl
) * sgl
->cur
,
465 if (unlikely(!areq
->tsgl
))
468 sg_init_table(areq
->tsgl
, sgl
->cur
);
469 for (i
= 0; i
< sgl
->cur
; i
++)
470 sg_set_page(&areq
->tsgl
[i
], sg_page(&sgl
->sg
[i
]),
471 sgl
->sg
[i
].length
, sgl
->sg
[i
].offset
);
473 areq
->tsgls
= sgl
->cur
;
476 while (outlen
> usedpages
&& iov_iter_count(&msg
->msg_iter
)) {
477 size_t seglen
= min_t(size_t, iov_iter_count(&msg
->msg_iter
),
478 (outlen
- usedpages
));
480 if (list_empty(&areq
->list
)) {
481 rsgl
= &areq
->first_rsgl
;
484 rsgl
= sock_kmalloc(sk
, sizeof(*rsgl
), GFP_KERNEL
);
485 if (unlikely(!rsgl
)) {
490 rsgl
->sgl
.npages
= 0;
491 list_add_tail(&rsgl
->list
, &areq
->list
);
493 /* make one iovec available as scatterlist */
494 err
= af_alg_make_sg(&rsgl
->sgl
, &msg
->msg_iter
, seglen
);
500 /* chain the new scatterlist with previous one */
502 af_alg_link_sg(&last_rsgl
->sgl
, &rsgl
->sgl
);
506 iov_iter_advance(&msg
->msg_iter
, err
);
509 /* ensure output buffer is sufficiently large */
510 if (usedpages
< outlen
) {
515 aead_request_set_crypt(req
, areq
->tsgl
, areq
->first_rsgl
.sgl
.sg
, used
,
517 err
= ctx
->enc
? crypto_aead_encrypt(req
) : crypto_aead_decrypt(req
);
519 if (err
== -EINPROGRESS
) {
524 } else if (err
== -EBADMSG
) {
532 list_for_each_entry(rsgl
, &areq
->list
, list
) {
533 af_alg_free_sg(&rsgl
->sgl
);
534 if (rsgl
!= &areq
->first_rsgl
)
535 sock_kfree_s(sk
, rsgl
, sizeof(*rsgl
));
538 sock_kfree_s(sk
, areq
->tsgl
, sizeof(*areq
->tsgl
) * areq
->tsgls
);
540 sock_kfree_s(sk
, req
, reqlen
);
542 aead_wmem_wakeup(sk
);
544 return err
? err
: outlen
;
547 static int aead_recvmsg_sync(struct socket
*sock
, struct msghdr
*msg
, int flags
)
549 struct sock
*sk
= sock
->sk
;
550 struct alg_sock
*ask
= alg_sk(sk
);
551 struct aead_ctx
*ctx
= ask
->private;
552 unsigned as
= crypto_aead_authsize(crypto_aead_reqtfm(&ctx
->aead_req
));
553 struct aead_sg_list
*sgl
= &ctx
->tsgl
;
554 struct aead_async_rsgl
*last_rsgl
= NULL
;
555 struct aead_async_rsgl
*rsgl
, *tmp
;
557 unsigned long used
= 0;
559 size_t usedpages
= 0;
564 * AEAD memory structure: For encryption, the tag is appended to the
565 * ciphertext which implies that the memory allocated for the ciphertext
566 * must be increased by the tag length. For decryption, the tag
567 * is expected to be concatenated to the ciphertext. The plaintext
568 * therefore has a memory size of the ciphertext minus the tag length.
570 * The memory structure for cipher operation has the following
572 * AEAD encryption input: assoc data || plaintext
573 * AEAD encryption output: cipherntext || auth tag
574 * AEAD decryption input: assoc data || ciphertext || auth tag
575 * AEAD decryption output: plaintext
579 err
= aead_wait_for_data(sk
, flags
);
584 /* data length provided by caller via sendmsg/sendpage */
588 * Make sure sufficient data is present -- note, the same check is
589 * is also present in sendmsg/sendpage. The checks in sendpage/sendmsg
590 * shall provide an information to the data sender that something is
591 * wrong, but they are irrelevant to maintain the kernel integrity.
592 * We need this check here too in case user space decides to not honor
593 * the error message in sendmsg/sendpage and still call recvmsg. This
594 * check here protects the kernel integrity.
596 if (!aead_sufficient_data(ctx
))
600 * Calculate the minimum output buffer size holding the result of the
601 * cipher operation. When encrypting data, the receiving buffer is
602 * larger by the tag length compared to the input buffer as the
603 * encryption operation generates the tag. For decryption, the input
604 * buffer provides the tag which is consumed resulting in only the
605 * plaintext without a buffer for the tag returned to the caller.
613 * The cipher operation input data is reduced by the associated data
614 * length as this data is processed separately later on.
616 used
-= ctx
->aead_assoclen
;
618 /* convert iovecs of output buffers into scatterlists */
619 while (outlen
> usedpages
&& iov_iter_count(&msg
->msg_iter
)) {
620 size_t seglen
= min_t(size_t, iov_iter_count(&msg
->msg_iter
),
621 (outlen
- usedpages
));
623 if (list_empty(&ctx
->list
)) {
624 rsgl
= &ctx
->first_rsgl
;
626 rsgl
= sock_kmalloc(sk
, sizeof(*rsgl
), GFP_KERNEL
);
627 if (unlikely(!rsgl
)) {
632 rsgl
->sgl
.npages
= 0;
633 list_add_tail(&rsgl
->list
, &ctx
->list
);
635 /* make one iovec available as scatterlist */
636 err
= af_alg_make_sg(&rsgl
->sgl
, &msg
->msg_iter
, seglen
);
640 /* chain the new scatterlist with previous one */
642 af_alg_link_sg(&last_rsgl
->sgl
, &rsgl
->sgl
);
646 iov_iter_advance(&msg
->msg_iter
, err
);
649 /* ensure output buffer is sufficiently large */
650 if (usedpages
< outlen
) {
655 sg_mark_end(sgl
->sg
+ sgl
->cur
- 1);
656 aead_request_set_crypt(&ctx
->aead_req
, sgl
->sg
, ctx
->first_rsgl
.sgl
.sg
,
658 aead_request_set_ad(&ctx
->aead_req
, ctx
->aead_assoclen
);
660 err
= af_alg_wait_for_completion(ctx
->enc
?
661 crypto_aead_encrypt(&ctx
->aead_req
) :
662 crypto_aead_decrypt(&ctx
->aead_req
),
666 /* EBADMSG implies a valid cipher operation took place */
677 list_for_each_entry_safe(rsgl
, tmp
, &ctx
->list
, list
) {
678 af_alg_free_sg(&rsgl
->sgl
);
679 list_del(&rsgl
->list
);
680 if (rsgl
!= &ctx
->first_rsgl
)
681 sock_kfree_s(sk
, rsgl
, sizeof(*rsgl
));
683 INIT_LIST_HEAD(&ctx
->list
);
684 aead_wmem_wakeup(sk
);
687 return err
? err
: outlen
;
690 static int aead_recvmsg(struct socket
*sock
, struct msghdr
*msg
, size_t ignored
,
693 return (msg
->msg_iocb
&& !is_sync_kiocb(msg
->msg_iocb
)) ?
694 aead_recvmsg_async(sock
, msg
, flags
) :
695 aead_recvmsg_sync(sock
, msg
, flags
);
698 static unsigned int aead_poll(struct file
*file
, struct socket
*sock
,
701 struct sock
*sk
= sock
->sk
;
702 struct alg_sock
*ask
= alg_sk(sk
);
703 struct aead_ctx
*ctx
= ask
->private;
706 sock_poll_wait(file
, sk_sleep(sk
), wait
);
710 mask
|= POLLIN
| POLLRDNORM
;
712 if (aead_writable(sk
))
713 mask
|= POLLOUT
| POLLWRNORM
| POLLWRBAND
;
718 static struct proto_ops algif_aead_ops
= {
721 .connect
= sock_no_connect
,
722 .socketpair
= sock_no_socketpair
,
723 .getname
= sock_no_getname
,
724 .ioctl
= sock_no_ioctl
,
725 .listen
= sock_no_listen
,
726 .shutdown
= sock_no_shutdown
,
727 .getsockopt
= sock_no_getsockopt
,
728 .mmap
= sock_no_mmap
,
729 .bind
= sock_no_bind
,
730 .accept
= sock_no_accept
,
731 .setsockopt
= sock_no_setsockopt
,
733 .release
= af_alg_release
,
734 .sendmsg
= aead_sendmsg
,
735 .sendpage
= aead_sendpage
,
736 .recvmsg
= aead_recvmsg
,
740 static int aead_check_key(struct socket
*sock
)
744 struct alg_sock
*pask
;
745 struct aead_tfm
*tfm
;
746 struct sock
*sk
= sock
->sk
;
747 struct alg_sock
*ask
= alg_sk(sk
);
754 pask
= alg_sk(ask
->parent
);
758 lock_sock_nested(psk
, SINGLE_DEPTH_NESTING
);
778 static int aead_sendmsg_nokey(struct socket
*sock
, struct msghdr
*msg
,
783 err
= aead_check_key(sock
);
787 return aead_sendmsg(sock
, msg
, size
);
790 static ssize_t
aead_sendpage_nokey(struct socket
*sock
, struct page
*page
,
791 int offset
, size_t size
, int flags
)
795 err
= aead_check_key(sock
);
799 return aead_sendpage(sock
, page
, offset
, size
, flags
);
802 static int aead_recvmsg_nokey(struct socket
*sock
, struct msghdr
*msg
,
803 size_t ignored
, int flags
)
807 err
= aead_check_key(sock
);
811 return aead_recvmsg(sock
, msg
, ignored
, flags
);
814 static struct proto_ops algif_aead_ops_nokey
= {
817 .connect
= sock_no_connect
,
818 .socketpair
= sock_no_socketpair
,
819 .getname
= sock_no_getname
,
820 .ioctl
= sock_no_ioctl
,
821 .listen
= sock_no_listen
,
822 .shutdown
= sock_no_shutdown
,
823 .getsockopt
= sock_no_getsockopt
,
824 .mmap
= sock_no_mmap
,
825 .bind
= sock_no_bind
,
826 .accept
= sock_no_accept
,
827 .setsockopt
= sock_no_setsockopt
,
829 .release
= af_alg_release
,
830 .sendmsg
= aead_sendmsg_nokey
,
831 .sendpage
= aead_sendpage_nokey
,
832 .recvmsg
= aead_recvmsg_nokey
,
836 static void *aead_bind(const char *name
, u32 type
, u32 mask
)
838 struct aead_tfm
*tfm
;
839 struct crypto_aead
*aead
;
841 tfm
= kzalloc(sizeof(*tfm
), GFP_KERNEL
);
843 return ERR_PTR(-ENOMEM
);
845 aead
= crypto_alloc_aead(name
, type
, mask
);
848 return ERR_CAST(aead
);
856 static void aead_release(void *private)
858 struct aead_tfm
*tfm
= private;
860 crypto_free_aead(tfm
->aead
);
864 static int aead_setauthsize(void *private, unsigned int authsize
)
866 struct aead_tfm
*tfm
= private;
868 return crypto_aead_setauthsize(tfm
->aead
, authsize
);
871 static int aead_setkey(void *private, const u8
*key
, unsigned int keylen
)
873 struct aead_tfm
*tfm
= private;
876 err
= crypto_aead_setkey(tfm
->aead
, key
, keylen
);
882 static void aead_sock_destruct(struct sock
*sk
)
884 struct alg_sock
*ask
= alg_sk(sk
);
885 struct aead_ctx
*ctx
= ask
->private;
886 unsigned int ivlen
= crypto_aead_ivsize(
887 crypto_aead_reqtfm(&ctx
->aead_req
));
889 WARN_ON(atomic_read(&sk
->sk_refcnt
) != 0);
891 sock_kzfree_s(sk
, ctx
->iv
, ivlen
);
892 sock_kfree_s(sk
, ctx
, ctx
->len
);
893 af_alg_release_parent(sk
);
896 static int aead_accept_parent_nokey(void *private, struct sock
*sk
)
898 struct aead_ctx
*ctx
;
899 struct alg_sock
*ask
= alg_sk(sk
);
900 struct aead_tfm
*tfm
= private;
901 struct crypto_aead
*aead
= tfm
->aead
;
902 unsigned int len
= sizeof(*ctx
) + crypto_aead_reqsize(aead
);
903 unsigned int ivlen
= crypto_aead_ivsize(aead
);
905 ctx
= sock_kmalloc(sk
, len
, GFP_KERNEL
);
910 ctx
->iv
= sock_kmalloc(sk
, ivlen
, GFP_KERNEL
);
912 sock_kfree_s(sk
, ctx
, len
);
915 memset(ctx
->iv
, 0, ivlen
);
923 ctx
->aead_assoclen
= 0;
924 af_alg_init_completion(&ctx
->completion
);
925 sg_init_table(ctx
->tsgl
.sg
, ALG_MAX_PAGES
);
926 INIT_LIST_HEAD(&ctx
->list
);
930 aead_request_set_tfm(&ctx
->aead_req
, aead
);
931 aead_request_set_callback(&ctx
->aead_req
, CRYPTO_TFM_REQ_MAY_BACKLOG
,
932 af_alg_complete
, &ctx
->completion
);
934 sk
->sk_destruct
= aead_sock_destruct
;
939 static int aead_accept_parent(void *private, struct sock
*sk
)
941 struct aead_tfm
*tfm
= private;
946 return aead_accept_parent_nokey(private, sk
);
949 static const struct af_alg_type algif_type_aead
= {
951 .release
= aead_release
,
952 .setkey
= aead_setkey
,
953 .setauthsize
= aead_setauthsize
,
954 .accept
= aead_accept_parent
,
955 .accept_nokey
= aead_accept_parent_nokey
,
956 .ops
= &algif_aead_ops
,
957 .ops_nokey
= &algif_aead_ops_nokey
,
962 static int __init
algif_aead_init(void)
964 return af_alg_register_type(&algif_type_aead
);
967 static void __exit
algif_aead_exit(void)
969 int err
= af_alg_unregister_type(&algif_type_aead
);
973 module_init(algif_aead_init
);
974 module_exit(algif_aead_exit
);
975 MODULE_LICENSE("GPL");
976 MODULE_AUTHOR("Stephan Mueller <smueller@chronox.de>");
977 MODULE_DESCRIPTION("AEAD kernel crypto API user space interface");