1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * fs/hmdfs/comm/crypto.h 4 * 5 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 6 */ 7 8 #ifndef HMDFS_FS_ENCRYPTION_H 9 #define HMDFS_FS_ENCRYPTION_H 10 11 #include "transport.h" 12 13 #define MAX_LABLE_SIZE 30 14 #define CRYPTO_IV_OFFSET 0 15 #define CRYPTO_SALT_OFFSET (CRYPTO_IV_OFFSET + TLS_CIPHER_AES_GCM_128_IV_SIZE) 16 #define CRYPTO_SEQ_OFFSET \ 17 (CRYPTO_SALT_OFFSET + TLS_CIPHER_AES_GCM_128_SALT_SIZE) 18 #define REKEY_LIFETIME (60 * 60 * HZ) 19 20 enum HKDF_TYPE { 21 HKDF_TYPE_KEY_INITIATOR = 0, 22 HKDF_TYPE_KEY_ACCEPTER = 1, 23 HKDF_TYPE_REKEY = 2, 24 HKDF_TYPE_IV = 3, 25 }; 26 27 enum SET_CRYPTO_TYPE { 28 SET_CRYPTO_SEND = 0, 29 SET_CRYPTO_RECV = 1, 30 }; 31 32 int tls_crypto_info_init(struct connection *conn_impl); 33 int set_crypto_info(struct connection *conn_impl, int set_type); 34 int update_key(__u8 *old_key, __u8 *new_key, int type); 35 36 #endif 37