Blame include/uapi/linux/tls.h

Packit Service 3880ab
/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
Packit Service 3880ab
/*
Packit Service 3880ab
 * Copyright (c) 2016-2017, Mellanox Technologies. All rights reserved.
Packit Service 3880ab
 *
Packit Service 3880ab
 * This software is available to you under a choice of one of two
Packit Service 3880ab
 * licenses.  You may choose to be licensed under the terms of the GNU
Packit Service 3880ab
 * General Public License (GPL) Version 2, available from the file
Packit Service 3880ab
 * COPYING in the main directory of this source tree, or the
Packit Service 3880ab
 * OpenIB.org BSD license below:
Packit Service 3880ab
 *
Packit Service 3880ab
 *     Redistribution and use in source and binary forms, with or
Packit Service 3880ab
 *     without modification, are permitted provided that the following
Packit Service 3880ab
 *     conditions are met:
Packit Service 3880ab
 *
Packit Service 3880ab
 *      - Redistributions of source code must retain the above
Packit Service 3880ab
 *        copyright notice, this list of conditions and the following
Packit Service 3880ab
 *        disclaimer.
Packit Service 3880ab
 *
Packit Service 3880ab
 *      - Redistributions in binary form must reproduce the above
Packit Service 3880ab
 *        copyright notice, this list of conditions and the following
Packit Service 3880ab
 *        disclaimer in the documentation and/or other materials
Packit Service 3880ab
 *        provided with the distribution.
Packit Service 3880ab
 *
Packit Service 3880ab
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Packit Service 3880ab
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Packit Service 3880ab
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Packit Service 3880ab
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
Packit Service 3880ab
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
Packit Service 3880ab
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
Packit Service 3880ab
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
Packit Service 3880ab
 * SOFTWARE.
Packit Service 3880ab
 */
Packit Service 3880ab
Packit Service 3880ab
#ifndef _LINUX_TLS_H
Packit Service 3880ab
#define _LINUX_TLS_H
Packit Service 3880ab
Packit Service 3880ab
#include <linux/types.h>
Packit Service 3880ab
Packit Service 3880ab
/* TLS socket options */
Packit Service 3880ab
#define TLS_TX			1	/* Set transmit parameters */
Packit Service 3880ab
#define TLS_RX			2	/* Set receive parameters */
Packit Service 3880ab
Packit Service 3880ab
/* Supported versions */
Packit Service 3880ab
#define TLS_VERSION_MINOR(ver)	((ver) & 0xFF)
Packit Service 3880ab
#define TLS_VERSION_MAJOR(ver)	(((ver) >> 8) & 0xFF)
Packit Service 3880ab
Packit Service 3880ab
#define TLS_VERSION_NUMBER(id)	((((id##_VERSION_MAJOR) & 0xFF) << 8) |	\
Packit Service 3880ab
				 ((id##_VERSION_MINOR) & 0xFF))
Packit Service 3880ab
Packit Service 3880ab
#define TLS_1_2_VERSION_MAJOR	0x3
Packit Service 3880ab
#define TLS_1_2_VERSION_MINOR	0x3
Packit Service 3880ab
#define TLS_1_2_VERSION		TLS_VERSION_NUMBER(TLS_1_2)
Packit Service 3880ab
Packit Service 3880ab
#define TLS_1_3_VERSION_MAJOR	0x3
Packit Service 3880ab
#define TLS_1_3_VERSION_MINOR	0x4
Packit Service 3880ab
#define TLS_1_3_VERSION		TLS_VERSION_NUMBER(TLS_1_3)
Packit Service 3880ab
Packit Service 3880ab
/* Supported ciphers */
Packit Service 3880ab
#define TLS_CIPHER_AES_GCM_128				51
Packit Service 3880ab
#define TLS_CIPHER_AES_GCM_128_IV_SIZE			8
Packit Service 3880ab
#define TLS_CIPHER_AES_GCM_128_KEY_SIZE		16
Packit Service 3880ab
#define TLS_CIPHER_AES_GCM_128_SALT_SIZE		4
Packit Service 3880ab
#define TLS_CIPHER_AES_GCM_128_TAG_SIZE		16
Packit Service 3880ab
#define TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE		8
Packit Service 3880ab
Packit Service 3880ab
#define TLS_CIPHER_AES_GCM_256				52
Packit Service 3880ab
#define TLS_CIPHER_AES_GCM_256_IV_SIZE			8
Packit Service 3880ab
#define TLS_CIPHER_AES_GCM_256_KEY_SIZE		32
Packit Service 3880ab
#define TLS_CIPHER_AES_GCM_256_SALT_SIZE		4
Packit Service 3880ab
#define TLS_CIPHER_AES_GCM_256_TAG_SIZE		16
Packit Service 3880ab
#define TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE		8
Packit Service 3880ab
Packit Service 3880ab
#define TLS_CIPHER_AES_CCM_128				53
Packit Service 3880ab
#define TLS_CIPHER_AES_CCM_128_IV_SIZE			8
Packit Service 3880ab
#define TLS_CIPHER_AES_CCM_128_KEY_SIZE		16
Packit Service 3880ab
#define TLS_CIPHER_AES_CCM_128_SALT_SIZE		4
Packit Service 3880ab
#define TLS_CIPHER_AES_CCM_128_TAG_SIZE		16
Packit Service 3880ab
#define TLS_CIPHER_AES_CCM_128_REC_SEQ_SIZE		8
Packit Service 3880ab
Packit Service 3880ab
#define TLS_SET_RECORD_TYPE	1
Packit Service 3880ab
#define TLS_GET_RECORD_TYPE	2
Packit Service 3880ab
Packit Service 3880ab
struct tls_crypto_info {
Packit Service 3880ab
	__u16 version;
Packit Service 3880ab
	__u16 cipher_type;
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
struct tls12_crypto_info_aes_gcm_128 {
Packit Service 3880ab
	struct tls_crypto_info info;
Packit Service 3880ab
	unsigned char iv[TLS_CIPHER_AES_GCM_128_IV_SIZE];
Packit Service 3880ab
	unsigned char key[TLS_CIPHER_AES_GCM_128_KEY_SIZE];
Packit Service 3880ab
	unsigned char salt[TLS_CIPHER_AES_GCM_128_SALT_SIZE];
Packit Service 3880ab
	unsigned char rec_seq[TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE];
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
struct tls12_crypto_info_aes_gcm_256 {
Packit Service 3880ab
	struct tls_crypto_info info;
Packit Service 3880ab
	unsigned char iv[TLS_CIPHER_AES_GCM_256_IV_SIZE];
Packit Service 3880ab
	unsigned char key[TLS_CIPHER_AES_GCM_256_KEY_SIZE];
Packit Service 3880ab
	unsigned char salt[TLS_CIPHER_AES_GCM_256_SALT_SIZE];
Packit Service 3880ab
	unsigned char rec_seq[TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE];
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
struct tls12_crypto_info_aes_ccm_128 {
Packit Service 3880ab
	struct tls_crypto_info info;
Packit Service 3880ab
	unsigned char iv[TLS_CIPHER_AES_CCM_128_IV_SIZE];
Packit Service 3880ab
	unsigned char key[TLS_CIPHER_AES_CCM_128_KEY_SIZE];
Packit Service 3880ab
	unsigned char salt[TLS_CIPHER_AES_CCM_128_SALT_SIZE];
Packit Service 3880ab
	unsigned char rec_seq[TLS_CIPHER_AES_CCM_128_REC_SEQ_SIZE];
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
enum {
Packit Service 3880ab
	TLS_INFO_UNSPEC,
Packit Service 3880ab
	TLS_INFO_VERSION,
Packit Service 3880ab
	TLS_INFO_CIPHER,
Packit Service 3880ab
	TLS_INFO_TXCONF,
Packit Service 3880ab
	TLS_INFO_RXCONF,
Packit Service 3880ab
	__TLS_INFO_MAX,
Packit Service 3880ab
};
Packit Service 3880ab
#define TLS_INFO_MAX (__TLS_INFO_MAX - 1)
Packit Service 3880ab
Packit Service 3880ab
#define TLS_CONF_BASE 1
Packit Service 3880ab
#define TLS_CONF_SW 2
Packit Service 3880ab
#define TLS_CONF_HW 3
Packit Service 3880ab
#define TLS_CONF_HW_RECORD 4
Packit Service 3880ab
Packit Service 3880ab
#endif /* _LINUX_TLS_H */