18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * fs/hmdfs/comm/crypto.h 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef HMDFS_FS_ENCRYPTION_H 98c2ecf20Sopenharmony_ci#define HMDFS_FS_ENCRYPTION_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include "transport.h" 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#define MAX_LABLE_SIZE 30 148c2ecf20Sopenharmony_ci#define CRYPTO_IV_OFFSET 0 158c2ecf20Sopenharmony_ci#define CRYPTO_SALT_OFFSET (CRYPTO_IV_OFFSET + TLS_CIPHER_AES_GCM_128_IV_SIZE) 168c2ecf20Sopenharmony_ci#define CRYPTO_SEQ_OFFSET \ 178c2ecf20Sopenharmony_ci (CRYPTO_SALT_OFFSET + TLS_CIPHER_AES_GCM_128_SALT_SIZE) 188c2ecf20Sopenharmony_ci#define REKEY_LIFETIME (60 * 60 * HZ) 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_cienum HKDF_TYPE { 218c2ecf20Sopenharmony_ci HKDF_TYPE_KEY_INITIATOR = 0, 228c2ecf20Sopenharmony_ci HKDF_TYPE_KEY_ACCEPTER = 1, 238c2ecf20Sopenharmony_ci HKDF_TYPE_REKEY = 2, 248c2ecf20Sopenharmony_ci HKDF_TYPE_IV = 3, 258c2ecf20Sopenharmony_ci}; 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_cienum SET_CRYPTO_TYPE { 288c2ecf20Sopenharmony_ci SET_CRYPTO_SEND = 0, 298c2ecf20Sopenharmony_ci SET_CRYPTO_RECV = 1, 308c2ecf20Sopenharmony_ci}; 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ciint tls_crypto_info_init(struct connection *conn_impl); 338c2ecf20Sopenharmony_ciint set_crypto_info(struct connection *conn_impl, int set_type); 348c2ecf20Sopenharmony_ciint update_key(__u8 *old_key, __u8 *new_key, int type); 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#endif 37