• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022-2023 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 HCF_CIPHER_FACTORY_SPI_H
17 #define HCF_CIPHER_FACTORY_SPI_H
18 
19 #include <stdint.h>
20 #include "cipher.h"
21 #include "algorithm_parameter.h"
22 #include "key.h"
23 #include "blob.h"
24 #include "result.h"
25 #include "params_parser.h"
26 
27 typedef struct HcfCipherGeneratorSpi HcfCipherGeneratorSpi;
28 
29 struct HcfCipherGeneratorSpi {
30     HcfObjectBase base;
31 
32     HcfResult (*init)(HcfCipherGeneratorSpi *self, enum HcfCryptoMode opMode,
33         HcfKey *key, HcfParamsSpec *params);
34 
35     HcfResult (*update)(HcfCipherGeneratorSpi *self, HcfBlob *input, HcfBlob *output);
36 
37     HcfResult (*doFinal)(HcfCipherGeneratorSpi *self, HcfBlob *input, HcfBlob *output);
38 
39     HcfResult (*setCipherSpecUint8Array)(HcfCipherGeneratorSpi *self, CipherSpecItem item, HcfBlob pSource);
40 
41     HcfResult (*getCipherSpecString)(HcfCipherGeneratorSpi *self, CipherSpecItem item, char **returnString);
42 
43     HcfResult (*getCipherSpecUint8Array)(HcfCipherGeneratorSpi *self, CipherSpecItem item, HcfBlob *returnUint8Array);
44 };
45 
46 #endif
47