1 /* 2 * Copyright (c) 2021-2024 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_CLIENT_CHECK_H 17 #define HKS_CLIENT_CHECK_H 18 19 #ifdef HKS_CONFIG_FILE 20 #include HKS_CONFIG_FILE 21 #else 22 #include "hks_config.h" 23 #endif 24 25 #include <stdint.h> 26 27 #include "hks_type.h" 28 #include "hks_type_inner.h" 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 int32_t HksCheckProcessNameAndKeyAlias(const struct HksBlob *processName, const struct HksBlob *keyAlias); 34 35 int32_t HksCheckGenAndImportKeyParams(const struct HksBlob *processName, const struct HksBlob *keyAlias, 36 const struct HksParamSet *paramSetIn, const struct HksBlob *key); 37 38 int32_t HksCheckImportWrappedKeyParams(const struct HksBlob *processName, const struct HksBlob *keyAlias, 39 const struct HksBlob *wrappingKeyAlias, const struct HksParamSet *paramSetIn, const struct HksBlob *wrappedKeyData); 40 41 int32_t HksCheckAllParams(const struct HksBlob *processName, const struct HksBlob *keyAlias, 42 const struct HksParamSet *paramSet, const struct HksBlob *data1, const struct HksBlob *data2); 43 44 int32_t HksCheckGetKeyParamSetParams(const struct HksBlob *processName, const struct HksBlob *keyAlias, 45 const struct HksParamSet *paramSet); 46 47 int32_t HksCheckGenerateRandomParams(const struct HksBlob *processName, const struct HksBlob *random); 48 49 int32_t HksCheckExportPublicKeyParams(const struct HksBlob *processName, const struct HksBlob *keyAlias, 50 const struct HksBlob *key); 51 52 int32_t HksCheckDeriveKeyParams(const struct HksBlob *processName, const struct HksParamSet *paramSet, 53 const struct HksBlob *mainKey, const struct HksBlob *derivedKey); 54 55 int32_t HksCheckGetKeyInfoListParams(const struct HksBlob *processName, const struct HksKeyInfo *keyInfoList, 56 const uint32_t *listCount); 57 58 #ifdef HKS_SUPPORT_API_ATTEST_KEY 59 int32_t HksCheckAttestKeyParams(const struct HksBlob *processName, const struct HksBlob *keyAlias, 60 const struct HksParamSet *paramSet, struct HksBlob *certChain); 61 #endif 62 63 int32_t HksCheckServiceInitParams(const struct HksBlob *processName, const struct HksBlob *keyAlias, 64 const struct HksParamSet *paramSet); 65 66 int32_t HksCheckAndGetUserAuthInfo(const struct HksParamSet *paramSet, uint32_t *userAuthType, 67 uint32_t *authAccessType); 68 69 int32_t HksCheckUserAuthKeyPurposeValidity(const struct HksParamSet *paramSet); 70 71 int32_t HksCheckListAliasesParam(const struct HksBlob *processName); 72 73 bool HksCheckIsAllowedWrap(const struct HksParamSet *paramSet); 74 75 int32_t HKsCheckOldKeyAliasDiffNewKeyAlias(const struct HksBlob *oldKeyAlias, 76 const struct HksBlob *newKeyAlias); 77 78 int32_t HksCheckOldKeyExist(const struct HksProcessInfo *processInfo, const struct HksBlob *oldKeyAlias, 79 const struct HksParamSet *paramSet); 80 81 int32_t HksCheckNewKeyNotExist(const struct HksProcessInfo *processInfo, const struct HksBlob *newKeyAlias, 82 const struct HksParamSet *paramSet); 83 84 int32_t HksCheckProcessInConfigList(const struct HksBlob *processName); 85 86 int32_t HksCheckChangeStorageLevelParams(const struct HksBlob *processName, const struct HksBlob *keyAlias, 87 const struct HksParamSet *srcParamSet, const struct HksParamSet *destParamSet); 88 89 #ifdef __cplusplus 90 } 91 #endif 92 93 #endif 94