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_CLIENT_IPC_H 17 #define HKS_CLIENT_IPC_H 18 19 #include "hks_type_inner.h" 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 int32_t HksClientInitialize(void); 26 27 int32_t HksClientRefreshKeyInfo(void); 28 29 int32_t HksClientGenerateKey(const struct HksBlob *keyAlias, const struct HksParamSet *paramSetIn, 30 struct HksParamSet *paramSetOut); 31 32 int32_t HksClientImportKey(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet, 33 const struct HksBlob *key); 34 35 int32_t HksClientExportPublicKey(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet, 36 struct HksBlob *key); 37 38 int32_t HksClientImportWrappedKey(const struct HksBlob *keyAlias, const struct HksBlob *wrappingKeyAlias, 39 const struct HksParamSet *paramSet, const struct HksBlob *wrappedKeyData); 40 41 int32_t HksClientDeleteKey(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet); 42 43 int32_t HksClientGetKeyParamSet(const struct HksBlob *keyAlias, struct HksParamSet *paramSet); 44 45 int32_t HksClientKeyExist(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet); 46 47 int32_t HksClientGenerateRandom(struct HksBlob *random, const struct HksParamSet *paramSet); 48 49 int32_t HksClientSign(const struct HksBlob *key, const struct HksParamSet *paramSet, 50 const struct HksBlob *srcData, struct HksBlob *signature); 51 52 int32_t HksClientVerify(const struct HksBlob *key, const struct HksParamSet *paramSet, 53 const struct HksBlob *srcData, const struct HksBlob *signature); 54 55 int32_t HksClientEncrypt(const struct HksBlob *key, const struct HksParamSet *paramSet, 56 const struct HksBlob *plainText, struct HksBlob *cipherText); 57 58 int32_t HksClientDecrypt(const struct HksBlob *key, const struct HksParamSet *paramSet, 59 const struct HksBlob *cipherText, struct HksBlob *plainText); 60 61 int32_t HksClientAgreeKey(const struct HksParamSet *paramSet, const struct HksBlob *privateKey, 62 const struct HksBlob *peerPublicKey, struct HksBlob *agreedKey); 63 64 int32_t HksClientDeriveKey(const struct HksParamSet *paramSet, const struct HksBlob *mainKey, 65 struct HksBlob *derivedKey); 66 67 int32_t HksClientMac(const struct HksBlob *key, const struct HksParamSet *paramSet, const struct HksBlob *srcData, 68 struct HksBlob *mac); 69 70 int32_t HksClientGetKeyInfoList(struct HksKeyInfo *keyInfoList, uint32_t *listCount); 71 72 int32_t HksClientAttestKey(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet, 73 struct HksCertChain *certChain); 74 75 int32_t HksClientInit(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet, struct HksBlob *handle, 76 struct HksBlob *token); 77 78 int32_t HksClientUpdate(const struct HksBlob *handle, const struct HksParamSet *paramSet, const struct HksBlob *inData, 79 struct HksBlob *outData); 80 81 int32_t HksClientFinish(const struct HksBlob *handle, const struct HksParamSet *paramSet, const struct HksBlob *inData, 82 struct HksBlob *outData); 83 84 int32_t HksClientAbort(const struct HksBlob *handle, const struct HksParamSet *paramSet); 85 86 #ifdef __cplusplus 87 } 88 #endif 89 90 #endif /* HKS_CLIENT_IPC_H */ 91