API参考
载入中...
搜索中...
未找到
crypt_modes_hctr.h
1/*
2 * This file is part of the openHiTLS project.
3 *
4 * openHiTLS is licensed under the Mulan PSL v2.
5 * You can use this software according to the terms and conditions of the Mulan PSL v2.
6 * You may obtain a copy of Mulan PSL v2 at:
7 *
8 * http://license.coscl.org.cn/MulanPSL2
9 *
10 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13 * See the Mulan PSL v2 for more details.
14 */
15
16#ifndef CRYPT_MODES_HCTR_H
17#define CRYPT_MODES_HCTR_H
18
19#include "hitls_build.h"
20#ifdef HITLS_CRYPTO_HCTR
21
22#include "crypt_modes.h"
23#include "crypt_types.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif /* __cplusplus */
28
29typedef struct MODES_HCTR_Buffer {
30 uint8_t *buffer; // Pointer to the data buffer.
31 uint32_t bufSize; // The allocated size of the buffer.
32 uint32_t dataLen; // The current length of the data stored in the buffer.
33} MODES_HCTR_Buffer;
34
35// HCTR mode universal implementation
36void *MODES_HCTR_NewCtx(void *provCtx, int32_t algId);
37int32_t MODES_HCTR_Init(MODES_CipherCtx *modeCtx, const uint8_t *key, uint32_t keyLen, const uint8_t *iv,
38 uint32_t ivLen, void *param, bool enc);
39int32_t MODES_HCTR_Update(MODES_CipherCtx *modeCtx, const uint8_t *in, uint32_t inLen, uint8_t *out, uint32_t *outLen);
40int32_t MODES_HCTR_Final(MODES_CipherCtx *modeCtx, uint8_t *out, uint32_t *outLen);
41int32_t MODES_HCTR_DeInit(MODES_CipherCtx *modeCtx);
42int32_t MODES_HCTR_Ctrl(MODES_CipherCtx *modeCtx, int32_t cmd, void *val, uint32_t valLen);
43void MODES_HCTR_Free(MODES_CipherCtx *modeCtx);
44MODES_CipherCtx *MODES_HCTR_DupCtx(const MODES_CipherCtx *modeCtx);
45
46#ifdef __cplusplus
47}
48#endif /* __cplusplus */
49
50#endif /* HITLS_CRYPTO_HCTR */
51#endif /* CRYPT_MODES_HCTR_H */