1 /* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef HKS_REQUEST_H 17 #define HKS_REQUEST_H 18 19 #include "hks_type_inner.h" 20 21 enum HksMessage { 22 #ifndef _HKS_L1_TEE_ 23 HKS_MSG_BASE = 0x3a400, /* range of message value defined by router. globally unique */ 24 #else 25 HKS_MSG_BASE = 1000, /* range of message value defined by SmartLock. Max 65535 */ 26 #endif 27 HKS_MSG_GEN_KEY = HKS_MSG_BASE, 28 HKS_MSG_IMPORT_KEY, 29 HKS_MSG_EXPORT_PUBLIC_KEY, 30 HKS_MSG_IMPORT_WRAPPED_KEY, 31 HKS_MSG_DELETE_KEY, 32 HKS_MSG_GET_KEY_PARAMSET, 33 HKS_MSG_KEY_EXIST, 34 HKS_MSG_GENERATE_RANDOM, 35 HKS_MSG_SIGN, 36 HKS_MSG_VERIFY, 37 HKS_MSG_ENCRYPT, 38 HKS_MSG_DECRYPT, 39 HKS_MSG_AGREE_KEY, 40 HKS_MSG_DERIVE_KEY, 41 HKS_MSG_MAC, 42 HKS_MSG_GET_KEY_INFO_LIST, 43 HKS_MSG_ATTEST_KEY, 44 HKS_MSG_GET_CERTIFICATE_CHAIN, 45 HKS_MSG_INIT, 46 HKS_MSG_UPDATE, 47 HKS_MSG_FINISH, 48 HKS_MSG_ABORT, 49 HKS_MSG_MAX, /* new cmd type must be added before HKS_MSG_MAX */ 50 }; 51 52 #ifdef __cplusplus 53 extern "C" { 54 #endif 55 56 /* 57 * SendRequest - Send the request message to target module by function call or ipc or other ways. 58 * @type: the request message type. 59 * @inBlob: the input serialized data blob. 60 * @outBlob: the output serialized data blob, can be null. 61 */ 62 int32_t HksSendRequest(enum HksMessage type, const struct HksBlob *inBlob, struct HksBlob *outBlob, 63 const struct HksParamSet *paramSet); 64 65 #ifdef __cplusplus 66 } 67 #endif 68 69 #endif /* HKS_REQUEST_H */ 70