1094332d3Sopenharmony_ci/* 2094332d3Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 3094332d3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4094332d3Sopenharmony_ci * you may not use this file except in compliance with the License. 5094332d3Sopenharmony_ci * You may obtain a copy of the License at 6094332d3Sopenharmony_ci * 7094332d3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8094332d3Sopenharmony_ci * 9094332d3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10094332d3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11094332d3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12094332d3Sopenharmony_ci * See the License for the specific language governing permissions and 13094332d3Sopenharmony_ci * limitations under the License. 14094332d3Sopenharmony_ci */ 15094332d3Sopenharmony_ci 16094332d3Sopenharmony_ci#ifndef HUKS_HDI_PASSTHROUGH_ADAPTER_H 17094332d3Sopenharmony_ci#define HUKS_HDI_PASSTHROUGH_ADAPTER_H 18094332d3Sopenharmony_ci 19094332d3Sopenharmony_ci#include "huks_hdi_template.h" 20094332d3Sopenharmony_ci#include "huks_sa_type.h" 21094332d3Sopenharmony_ci#include "huks_sa_hdi_struct.h" 22094332d3Sopenharmony_ci 23094332d3Sopenharmony_ci#ifdef __cplusplus 24094332d3Sopenharmony_ciextern "C" { 25094332d3Sopenharmony_ci#endif 26094332d3Sopenharmony_ci 27094332d3Sopenharmony_ciint32_t HuksHdiAdapterGenerateKey(const struct HksBlob *keyAlias, const struct HksParamSet *paramSetIn, 28094332d3Sopenharmony_ci const struct HksBlob *keyIn, struct HksBlob *keyOut); 29094332d3Sopenharmony_ci 30094332d3Sopenharmony_ciint32_t HuksHdiAdapterSign(const struct HksBlob *key, const struct HksParamSet *paramSet, const struct HksBlob *srcData, 31094332d3Sopenharmony_ci struct HksBlob *signature); 32094332d3Sopenharmony_ci 33094332d3Sopenharmony_ciint32_t HuksHdiAdapterVerify(const struct HksBlob *key, const struct HksParamSet *paramSet, 34094332d3Sopenharmony_ci const struct HksBlob *srcData, const struct HksBlob *signature); 35094332d3Sopenharmony_ci 36094332d3Sopenharmony_ciint32_t HuksHdiAdapterEncrypt(const struct HksBlob *key, const struct HksParamSet *paramSet, 37094332d3Sopenharmony_ci const struct HksBlob *plainText, struct HksBlob *cipherText); 38094332d3Sopenharmony_ci 39094332d3Sopenharmony_ciint32_t HuksHdiAdapterDecrypt(const struct HksBlob *key, const struct HksParamSet *paramSet, 40094332d3Sopenharmony_ci const struct HksBlob *cipherText, struct HksBlob *plainText); 41094332d3Sopenharmony_ci 42094332d3Sopenharmony_ciint32_t HuksHdiAdapterGenerateRandom(const struct HksParamSet *paramSet, struct HksBlob *random); 43094332d3Sopenharmony_ci 44094332d3Sopenharmony_ciint32_t HuksHdiAdapterImportKey(const struct HksBlob *keyAlias, const struct HksBlob *key, 45094332d3Sopenharmony_ci const struct HksParamSet *paramSet, struct HksBlob *keyOut); 46094332d3Sopenharmony_ci 47094332d3Sopenharmony_ciint32_t HuksHdiAdapterExportPublicKey(const struct HksBlob *key, const struct HksParamSet *paramSet, 48094332d3Sopenharmony_ci struct HksBlob *keyOut); 49094332d3Sopenharmony_ci 50094332d3Sopenharmony_ciint32_t HuksHdiAdapterAgreeKey(const struct HksParamSet *paramSet, const struct HksBlob *privateKey, 51094332d3Sopenharmony_ci const struct HksBlob *peerPublicKey, struct HksBlob *agreedKey); 52094332d3Sopenharmony_ci 53094332d3Sopenharmony_ciint32_t HuksHdiAdapterDeriveKey(const struct HksParamSet *paramSet, const struct HksBlob *kdfKey, 54094332d3Sopenharmony_ci struct HksBlob *derivedKey); 55094332d3Sopenharmony_ci 56094332d3Sopenharmony_ciint32_t HuksHdiAdapterMac(const struct HksBlob *key, const struct HksParamSet *paramSet, const struct HksBlob *srcData, 57094332d3Sopenharmony_ci struct HksBlob *mac); 58094332d3Sopenharmony_ci 59094332d3Sopenharmony_ciint32_t HuksHdiAdapterModuleInit(void); 60094332d3Sopenharmony_ci 61094332d3Sopenharmony_ciint32_t HuksHdiAdapterModuleDestroy(void); 62094332d3Sopenharmony_ci 63094332d3Sopenharmony_ciint32_t HuksHdiAdapterImportWrappedKey(const struct HksBlob *wrappingKeyAlias, const struct HksBlob *wrappingKey, 64094332d3Sopenharmony_ci const struct HksBlob *wrappedKeyData, const struct HksParamSet *paramSet, struct HksBlob *keyOut); 65094332d3Sopenharmony_ci 66094332d3Sopenharmony_ciint32_t HuksHdiAdapterInit(const struct HksBlob *key, const struct HksParamSet *paramSet, struct HksBlob *handle, 67094332d3Sopenharmony_ci struct HksBlob *token); 68094332d3Sopenharmony_ci 69094332d3Sopenharmony_ciint32_t HuksHdiAdapterUpdate(const struct HksBlob *handle, const struct HksParamSet *paramSet, 70094332d3Sopenharmony_ci const struct HksBlob *inData, struct HksBlob *outData); 71094332d3Sopenharmony_ci 72094332d3Sopenharmony_ciint32_t HuksHdiAdapterFinish(const struct HksBlob *handle, const struct HksParamSet *paramSet, 73094332d3Sopenharmony_ci const struct HksBlob *inData, struct HksBlob *outData); 74094332d3Sopenharmony_ci 75094332d3Sopenharmony_ciint32_t HuksHdiAdapterAbort(const struct HksBlob *handle, const struct HksParamSet *paramSet); 76094332d3Sopenharmony_ci 77094332d3Sopenharmony_ciint32_t HuksHdiAdapterGetKeyProperties(const struct HksParamSet *paramSet, const struct HksBlob *key); 78094332d3Sopenharmony_ci 79094332d3Sopenharmony_ciint32_t HuksHdiAdapterAttestKey(const struct HksBlob *key, const struct HksParamSet *paramSet, 80094332d3Sopenharmony_ci struct HksBlob *certChain); 81094332d3Sopenharmony_ci 82094332d3Sopenharmony_ciint32_t HuksHdiAdapterUpgradeKey(const struct HksBlob *oldKey, const struct HksParamSet *paramSet, 83094332d3Sopenharmony_ci struct HksBlob *newKey); 84094332d3Sopenharmony_ci 85094332d3Sopenharmony_ciint32_t HuksInitHuksCoreEngine(void); 86094332d3Sopenharmony_ci 87094332d3Sopenharmony_ciint32_t HuksReleaseCoreEngine(void); 88094332d3Sopenharmony_ci 89094332d3Sopenharmony_cistruct HuksHdi *HuksGetCoreEngine(void); 90094332d3Sopenharmony_ci 91094332d3Sopenharmony_ci#ifdef __cplusplus 92094332d3Sopenharmony_ci} 93094332d3Sopenharmony_ci#endif 94094332d3Sopenharmony_ci 95094332d3Sopenharmony_ci#endif