Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
0002 /*
0003  * Copyright (c) 2016-2017, Mellanox Technologies. All rights reserved.
0004  *
0005  * This software is available to you under a choice of one of two
0006  * licenses.  You may choose to be licensed under the terms of the GNU
0007  * General Public License (GPL) Version 2, available from the file
0008  * COPYING in the main directory of this source tree, or the
0009  * OpenIB.org BSD license below:
0010  *
0011  *     Redistribution and use in source and binary forms, with or
0012  *     without modification, are permitted provided that the following
0013  *     conditions are met:
0014  *
0015  *      - Redistributions of source code must retain the above
0016  *        copyright notice, this list of conditions and the following
0017  *        disclaimer.
0018  *
0019  *      - Redistributions in binary form must reproduce the above
0020  *        copyright notice, this list of conditions and the following
0021  *        disclaimer in the documentation and/or other materials
0022  *        provided with the distribution.
0023  *
0024  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0025  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0026  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0027  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
0028  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
0029  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0030  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
0031  * SOFTWARE.
0032  */
0033 
0034 #ifndef _UAPI_LINUX_TLS_H
0035 #define _UAPI_LINUX_TLS_H
0036 
0037 #include <linux/types.h>
0038 
0039 /* TLS socket options */
0040 #define TLS_TX          1   /* Set transmit parameters */
0041 #define TLS_RX          2   /* Set receive parameters */
0042 
0043 /* Supported versions */
0044 #define TLS_VERSION_MINOR(ver)  ((ver) & 0xFF)
0045 #define TLS_VERSION_MAJOR(ver)  (((ver) >> 8) & 0xFF)
0046 
0047 #define TLS_VERSION_NUMBER(id)  ((((id##_VERSION_MAJOR) & 0xFF) << 8) | \
0048                  ((id##_VERSION_MINOR) & 0xFF))
0049 
0050 #define TLS_1_2_VERSION_MAJOR   0x3
0051 #define TLS_1_2_VERSION_MINOR   0x3
0052 #define TLS_1_2_VERSION     TLS_VERSION_NUMBER(TLS_1_2)
0053 
0054 /* Supported ciphers */
0055 #define TLS_CIPHER_AES_GCM_128              51
0056 #define TLS_CIPHER_AES_GCM_128_IV_SIZE          8
0057 #define TLS_CIPHER_AES_GCM_128_KEY_SIZE     16
0058 #define TLS_CIPHER_AES_GCM_128_SALT_SIZE        4
0059 #define TLS_CIPHER_AES_GCM_128_TAG_SIZE     16
0060 #define TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE     8
0061 
0062 #define TLS_SET_RECORD_TYPE 1
0063 #define TLS_GET_RECORD_TYPE 2
0064 
0065 struct tls_crypto_info {
0066     __u16 version;
0067     __u16 cipher_type;
0068 };
0069 
0070 struct tls12_crypto_info_aes_gcm_128 {
0071     struct tls_crypto_info info;
0072     unsigned char iv[TLS_CIPHER_AES_GCM_128_IV_SIZE];
0073     unsigned char key[TLS_CIPHER_AES_GCM_128_KEY_SIZE];
0074     unsigned char salt[TLS_CIPHER_AES_GCM_128_SALT_SIZE];
0075     unsigned char rec_seq[TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE];
0076 };
0077 
0078 #endif /* _UAPI_LINUX_TLS_H */