1 /* 2 * Copyright (c) 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_TEST_ADAPT_FOR_DE_H 17 #define HKS_TEST_ADAPT_FOR_DE_H 18 19 #include "hks_api.h" 20 #include "hks_param.h" 21 #include "hks_type.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 int32_t ConstructNewParamSet(const struct HksParamSet *paramSet, struct HksParamSet **newParamSet); 28 29 int32_t HksGenerateKeyForDe(const struct HksBlob *keyAlias, 30 const struct HksParamSet *paramSet, struct HksParamSet *paramSetOut); 31 32 int32_t HksImportKeyForDe(const struct HksBlob *keyAlias, 33 const struct HksParamSet *paramSet, const struct HksBlob *key); 34 35 int32_t HksImportWrappedKeyForDe(const struct HksBlob *keyAlias, const struct HksBlob *wrappingKeyAlias, 36 const struct HksParamSet *paramSet, const struct HksBlob *wrappedKeyData); 37 38 int32_t HksExportPublicKeyForDe(const struct HksBlob *keyAlias, 39 const struct HksParamSet *paramSet, struct HksBlob *key); 40 41 int32_t HksDeleteKeyForDe(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet); 42 43 int32_t HksGetKeyParamSetForDe(const struct HksBlob *keyAlias, 44 const struct HksParamSet *paramSet, struct HksParamSet *paramSetOut); 45 46 int32_t HksKeyExistForDe(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet); 47 48 int32_t HksSignForDe(const struct HksBlob *key, const struct HksParamSet *paramSet, 49 const struct HksBlob *srcData, struct HksBlob *signature); 50 51 int32_t HksVerifyForDe(const struct HksBlob *key, const struct HksParamSet *paramSet, 52 const struct HksBlob *srcData, const struct HksBlob *signature); 53 54 int32_t HksEncryptForDe(const struct HksBlob *key, const struct HksParamSet *paramSet, 55 const struct HksBlob *plainText, struct HksBlob *cipherText); 56 57 int32_t HksDecryptForDe(const struct HksBlob *key, const struct HksParamSet *paramSet, 58 const struct HksBlob *cipherText, struct HksBlob *plainText); 59 60 int32_t HksAgreeKeyForDe(const struct HksParamSet *paramSet, const struct HksBlob *privateKey, 61 const struct HksBlob *peerPublicKey, struct HksBlob *agreedKey); 62 63 int32_t HksDeriveKeyForDe(const struct HksParamSet *paramSet, const struct HksBlob *mainKey, 64 struct HksBlob *derivedKey); 65 66 int32_t HksMacForDe(const struct HksBlob *key, const struct HksParamSet *paramSet, 67 const struct HksBlob *srcData, struct HksBlob *mac); 68 69 int32_t HksGetKeyInfoListForDe(const struct HksParamSet *paramSet, 70 struct HksKeyInfo *keyInfoList, uint32_t *listCount); 71 72 int32_t HksAttestKeyForDe(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet, 73 struct HksCertChain *certChain); 74 75 int32_t HksAnonAttestKeyForDe(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet, 76 struct HksCertChain *certChain); 77 78 int32_t HksInitForDe(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet, 79 struct HksBlob *handle, struct HksBlob *token); 80 81 int32_t HksUpdateForDe(const struct HksBlob *handle, const struct HksParamSet *paramSet, 82 const struct HksBlob *inData, struct HksBlob *outData); 83 84 int32_t HksFinishForDe(const struct HksBlob *handle, const struct HksParamSet *paramSet, 85 const struct HksBlob *inData, struct HksBlob *outData); 86 87 #ifdef __cplusplus 88 } 89 #endif 90 #endif