linux/crypto/algif_aead.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * algif_aead: User-space interface for AEAD algorithms
 *
 * Copyright (C) 2014, Stephan Mueller <[email protected]>
 *
 * This file provides the user-space API for AEAD ciphers.
 *
 * The following concept of the memory management is used:
 *
 * The kernel maintains two SGLs, the TX SGL and the RX SGL. The TX SGL is
 * filled by user space with the data submitted via sendmsg (maybe with
 * MSG_SPLICE_PAGES).  Filling up the TX SGL does not cause a crypto operation
 * -- the data will only be tracked by the kernel. Upon receipt of one recvmsg
 * call, the caller must provide a buffer which is tracked with the RX SGL.
 *
 * During the processing of the recvmsg operation, the cipher request is
 * allocated and prepared. As part of the recvmsg operation, the processed
 * TX buffers are extracted from the TX SGL into a separate SGL.
 *
 * After the completion of the crypto operation, the RX SGL and the cipher
 * request is released. The extracted TX SGL parts are released together with
 * the RX SGL release.
 */

#include <crypto/internal/aead.h>
#include <crypto/scatterwalk.h>
#include <crypto/if_alg.h>
#include <crypto/skcipher.h>
#include <crypto/null.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/net.h>
#include <net/sock.h>

struct aead_tfm {};

static inline bool aead_sufficient_data(struct sock *sk)
{}

static int aead_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
{}

static int crypto_aead_copy_sgl(struct crypto_sync_skcipher *null_tfm,
				struct scatterlist *src,
				struct scatterlist *dst, unsigned int len)
{}

static int _aead_recvmsg(struct socket *sock, struct msghdr *msg,
			 size_t ignored, int flags)
{}

static int aead_recvmsg(struct socket *sock, struct msghdr *msg,
			size_t ignored, int flags)
{}

static struct proto_ops algif_aead_ops =;

static int aead_check_key(struct socket *sock)
{}

static int aead_sendmsg_nokey(struct socket *sock, struct msghdr *msg,
				  size_t size)
{}

static int aead_recvmsg_nokey(struct socket *sock, struct msghdr *msg,
				  size_t ignored, int flags)
{}

static struct proto_ops algif_aead_ops_nokey =;

static void *aead_bind(const char *name, u32 type, u32 mask)
{}

static void aead_release(void *private)
{}

static int aead_setauthsize(void *private, unsigned int authsize)
{}

static int aead_setkey(void *private, const u8 *key, unsigned int keylen)
{}

static void aead_sock_destruct(struct sock *sk)
{}

static int aead_accept_parent_nokey(void *private, struct sock *sk)
{}

static int aead_accept_parent(void *private, struct sock *sk)
{}

static const struct af_alg_type algif_type_aead =;

static int __init algif_aead_init(void)
{}

static void __exit algif_aead_exit(void)
{}

module_init();
module_exit(algif_aead_exit);
MODULE_LICENSE();
MODULE_AUTHOR();
MODULE_DESCRIPTION();