openhitls/0004-init-add-const.patch

608 lines
29 KiB
Diff
Raw Permalink Normal View History

From 2c5f84885c9f107f943da46e1372bd9e4539e87d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A6=BB=E6=A0=87=E9=87=8F?= <875922464@qq.com>
Date: Sat, 30 Nov 2024 18:15:19 +0800
Subject: [PATCH 04/10] init add const
---
crypto/hmac/include/crypt_hmac.h | 2 +-
crypto/hmac/src/hmac.c | 2 +-
crypto/include/crypt_local_types.h | 6 +++---
crypto/md5/include/crypt_md5.h | 2 +-
crypto/md5/src/md5.c | 2 +-
crypto/modes/include/crypt_modes_cbc.h | 2 +-
crypto/modes/include/crypt_modes_ccm.h | 2 +-
crypto/modes/include/crypt_modes_cfb.h | 2 +-
crypto/modes/include/crypt_modes_chacha20poly1305.h | 2 +-
crypto/modes/include/crypt_modes_ctr.h | 2 +-
crypto/modes/include/crypt_modes_ecb.h | 2 +-
crypto/modes/include/crypt_modes_gcm.h | 2 +-
crypto/modes/include/crypt_modes_ofb.h | 2 +-
crypto/modes/include/crypt_modes_xts.h | 2 +-
crypto/modes/src/modes_cbc.c | 2 +-
crypto/modes/src/modes_ccm.c | 2 +-
crypto/modes/src/modes_cfb.c | 2 +-
crypto/modes/src/modes_chacha20_poly1305.c | 2 +-
crypto/modes/src/modes_ctr.c | 2 +-
crypto/modes/src/modes_ecb.c | 2 +-
crypto/modes/src/modes_gcm.c | 2 +-
crypto/modes/src/modes_ofb.c | 2 +-
crypto/modes/src/modes_xts.c | 2 +-
crypto/sha1/include/crypt_sha1.h | 2 +-
crypto/sha1/src/sha1.c | 2 +-
crypto/sha2/include/crypt_sha2.h | 8 ++++----
crypto/sha2/src/sha2_256.c | 4 ++--
crypto/sha2/src/sha2_512.c | 4 ++--
crypto/sha3/include/crypt_sha3.h | 12 ++++++------
crypto/sha3/src/sha3.c | 12 ++++++------
crypto/sm3/include/crypt_sm3.h | 2 +-
crypto/sm3/src/sm3_public.c | 2 +-
include/crypto/crypt_eal_implprovider.h | 6 +++---
33 files changed, 52 insertions(+), 52 deletions(-)
diff --git a/crypto/hmac/include/crypt_hmac.h b/crypto/hmac/include/crypt_hmac.h
index 22e68dd..ecddd3c 100644
--- a/crypto/hmac/include/crypt_hmac.h
+++ b/crypto/hmac/include/crypt_hmac.h
@@ -33,7 +33,7 @@ extern "C" {
typedef struct HMAC_Ctx CRYPT_HMAC_Ctx;
CRYPT_HMAC_Ctx *CRYPT_HMAC_NewCtx(CRYPT_MAC_AlgId id);
-int32_t CRYPT_HMAC_Init(CRYPT_HMAC_Ctx *ctx, const uint8_t *key, uint32_t len, BSL_Param *param);
+int32_t CRYPT_HMAC_Init(CRYPT_HMAC_Ctx *ctx, const uint8_t *key, uint32_t len, const BSL_Param *param);
int32_t CRYPT_HMAC_Update(CRYPT_HMAC_Ctx *ctx, const uint8_t *in, uint32_t len);
int32_t CRYPT_HMAC_Final(CRYPT_HMAC_Ctx *ctx, uint8_t *out, uint32_t *len);
void CRYPT_HMAC_Reinit(CRYPT_HMAC_Ctx *ctx);
diff --git a/crypto/hmac/src/hmac.c b/crypto/hmac/src/hmac.c
index e626659..10b294f 100644
--- a/crypto/hmac/src/hmac.c
+++ b/crypto/hmac/src/hmac.c
@@ -93,7 +93,7 @@ static void HmacCleanseData(uint8_t *tmp, uint32_t tmpLen, uint8_t *ipad, uint32
BSL_SAL_CleanseData(opad, opadLen);
}
-int32_t CRYPT_HMAC_Init(CRYPT_HMAC_Ctx *ctx, const uint8_t *key, uint32_t len, BSL_Param *param)
+int32_t CRYPT_HMAC_Init(CRYPT_HMAC_Ctx *ctx, const uint8_t *key, uint32_t len, const BSL_Param *param)
{
if (ctx == NULL || ctx->method == NULL || (key == NULL && len != 0)) {
BSL_ERR_PUSH_ERROR(CRYPT_NULL_INPUT);
diff --git a/crypto/include/crypt_local_types.h b/crypto/include/crypt_local_types.h
index d4e1352..1ed48a1 100644
--- a/crypto/include/crypt_local_types.h
+++ b/crypto/include/crypt_local_types.h
@@ -31,7 +31,7 @@ typedef int32_t (*GetLenFunc)(const void *ctx);
/* Prototype of the MD algorithm operation functions */
typedef void* (*MdNewCtx)(void);
typedef void* (*MdProvNewCtx)(void *provCtx, int32_t algId);
-typedef int32_t (*MdInit)(void *data, BSL_Param *param);
+typedef int32_t (*MdInit)(void *data, const BSL_Param *param);
typedef int32_t (*MdUpdate)(void *data, const uint8_t *input, uint32_t len);
typedef int32_t (*MdFinal)(void *data, uint8_t *out, uint32_t *len);
typedef void (*MdDeinit)(void *data);
@@ -180,7 +180,7 @@ typedef enum {
typedef void *(*CipherNewCtx)(int32_t alg);
typedef void *(*CipherProvNewCtx)(void *provCtx, int32_t alg);
typedef int32_t (*CipherInitCtx)(void *ctx, const uint8_t *key, uint32_t keyLen, const uint8_t *iv,
- uint32_t ivLen, BSL_Param *param, bool enc);
+ uint32_t ivLen, const BSL_Param *param, bool enc);
typedef int32_t (*CipherDeInitCtx)(void *ctx);
typedef int32_t (*CipherUpdate)(void *ctx, const uint8_t *in, uint32_t inLen, uint8_t *out, uint32_t *outLen);
typedef int32_t (*CipherFinal)(void *ctx, uint8_t *out, uint32_t *outLen);
@@ -233,7 +233,7 @@ typedef struct {
typedef void* (*MacNewCtx)(CRYPT_MAC_AlgId id);
typedef void* (*MacProvNewCtx)(void *provCtx, int32_t algId);
// Complete key initialization.
-typedef int32_t (*MacInit)(void *ctx, const uint8_t *key, uint32_t len, BSL_Param *param);
+typedef int32_t (*MacInit)(void *ctx, const uint8_t *key, uint32_t len, const BSL_Param *param);
typedef int32_t (*MacUpdate)(void *ctx, const uint8_t *in, uint32_t len);
typedef int32_t (*MacFinal)(void *ctx, const uint8_t *out, uint32_t *len);
typedef void (*MacDeinit)(void *ctx);
diff --git a/crypto/md5/include/crypt_md5.h b/crypto/md5/include/crypt_md5.h
index 5c2b438..a206349 100644
--- a/crypto/md5/include/crypt_md5.h
+++ b/crypto/md5/include/crypt_md5.h
@@ -58,7 +58,7 @@ void CRYPT_MD5_FreeCtx(CRYPT_MD5_Ctx *ctx);
* @retval #CRYPT_SUCCESS Initialization succeeded.
* @retval #CRYPT_NULL_INPUT Pointer ctx is NULL
*/
-int32_t CRYPT_MD5_Init(CRYPT_MD5_Ctx *ctx, BSL_Param *param);
+int32_t CRYPT_MD5_Init(CRYPT_MD5_Ctx *ctx, const BSL_Param *param);
/**
* @ingroup MD5
diff --git a/crypto/md5/src/md5.c b/crypto/md5/src/md5.c
index 22c51f0..a28fc01 100644
--- a/crypto/md5/src/md5.c
+++ b/crypto/md5/src/md5.c
@@ -55,7 +55,7 @@ void CRYPT_MD5_FreeCtx(CRYPT_MD5_Ctx *ctx)
BSL_SAL_ClearFree(ctx, sizeof(CRYPT_MD5_Ctx));
}
-int32_t CRYPT_MD5_Init(CRYPT_MD5_Ctx *ctx, BSL_Param *param)
+int32_t CRYPT_MD5_Init(CRYPT_MD5_Ctx *ctx, const BSL_Param *param)
{
if (ctx == NULL) {
BSL_ERR_PUSH_ERROR(CRYPT_NULL_INPUT);
diff --git a/crypto/modes/include/crypt_modes_cbc.h b/crypto/modes/include/crypt_modes_cbc.h
index bf9890a..9bead46 100644
--- a/crypto/modes/include/crypt_modes_cbc.h
+++ b/crypto/modes/include/crypt_modes_cbc.h
@@ -53,7 +53,7 @@ int32_t SM4_CBC_InitCtx(MODES_CipherCtx *modeCtx, const uint8_t *key, uint32_t k
int32_t MODES_CBC_UpdateEx(MODES_CipherCtx *modeCtx, const uint8_t *in, uint32_t inLen, uint8_t *out, uint32_t *outLen);
int32_t MODES_CBC_InitCtxEx(MODES_CipherCtx *modeCtx, const uint8_t *key, uint32_t keyLen, const uint8_t *iv,
- uint32_t ivLen, BSL_Param *param, bool enc);
+ uint32_t ivLen, const BSL_Param *param, bool enc);
int32_t MODES_CBC_FinalEx(MODES_CipherCtx *modeCtx, uint8_t *out, uint32_t *outLen);
#ifdef __cplusplus
}
diff --git a/crypto/modes/include/crypt_modes_ccm.h b/crypto/modes/include/crypt_modes_ccm.h
index 43eff90..00b3db5 100644
--- a/crypto/modes/include/crypt_modes_ccm.h
+++ b/crypto/modes/include/crypt_modes_ccm.h
@@ -32,7 +32,7 @@ typedef struct ModesCcmCtx MODES_CCM_Ctx;
// CCM mode universal implementation
MODES_CCM_Ctx *MODES_CCM_NewCtx(int32_t algId);
int32_t MODES_CCM_InitCtx(MODES_CCM_Ctx *modeCtx, const uint8_t *key, uint32_t keyLen, const uint8_t *iv,
- uint32_t ivLen, BSL_Param *param, bool enc);
+ uint32_t ivLen, const BSL_Param *param, bool enc);
int32_t MODES_CCM_Update(MODES_CCM_Ctx *modeCtx, const uint8_t *in, uint32_t inLen, uint8_t *out, uint32_t *outLen);
int32_t MODES_CCM_Final(MODES_CCM_Ctx *modeCtx, uint8_t *out, uint32_t *outLen);
diff --git a/crypto/modes/include/crypt_modes_cfb.h b/crypto/modes/include/crypt_modes_cfb.h
index 8ff6f99..e421a57 100644
--- a/crypto/modes/include/crypt_modes_cfb.h
+++ b/crypto/modes/include/crypt_modes_cfb.h
@@ -50,7 +50,7 @@ int32_t SM4_CFB_Update(MODES_CFB_Ctx *modeCtx, const uint8_t *in, uint32_t inLen
int32_t MODES_CFB_InitCtxEx(MODES_CFB_Ctx *modeCtx, const uint8_t *key, uint32_t keyLen, const uint8_t *iv,
- uint32_t ivLen, BSL_Param *param, bool enc);
+ uint32_t ivLen, const BSL_Param *param, bool enc);
int32_t MODES_CFB_UpdateEx(MODES_CFB_Ctx *modeCtx, const uint8_t *in, uint32_t inLen, uint8_t *out, uint32_t *outLen);
#ifdef __cplusplus
diff --git a/crypto/modes/include/crypt_modes_chacha20poly1305.h b/crypto/modes/include/crypt_modes_chacha20poly1305.h
index 8841c93..42ff76c 100644
--- a/crypto/modes/include/crypt_modes_chacha20poly1305.h
+++ b/crypto/modes/include/crypt_modes_chacha20poly1305.h
@@ -32,7 +32,7 @@ typedef struct ModesChaChaCtx MODES_CHACHAPOLY_Ctx;
MODES_CHACHAPOLY_Ctx *MODES_CHACHA20POLY1305_NewCtx(int32_t algId);
int32_t MODES_CHACHA20POLY1305_InitCtx(MODES_CHACHAPOLY_Ctx *modeCtx, const uint8_t *key,
- uint32_t keyLen, const uint8_t *iv, uint32_t ivLen, BSL_Param *param, bool enc);
+ uint32_t keyLen, const uint8_t *iv, uint32_t ivLen, const BSL_Param *param, bool enc);
int32_t MODES_CHACHA20POLY1305_Update(MODES_CHACHAPOLY_Ctx *modeCtx, const uint8_t *in, uint32_t inLen,
uint8_t *out, uint32_t *outLen);
diff --git a/crypto/modes/include/crypt_modes_ctr.h b/crypto/modes/include/crypt_modes_ctr.h
index 989044f..5f64239 100644
--- a/crypto/modes/include/crypt_modes_ctr.h
+++ b/crypto/modes/include/crypt_modes_ctr.h
@@ -48,7 +48,7 @@ int32_t SM4_CTR_InitCtx(MODES_CipherCtx *modeCtx, const uint8_t *key, uint32_t k
uint32_t ivLen, bool enc);
int32_t MODES_CTR_InitCtxEx(MODES_CipherCtx *modeCtx, const uint8_t *key, uint32_t keyLen, const uint8_t *iv,
- uint32_t ivLen, BSL_Param *param, bool enc);
+ uint32_t ivLen, const BSL_Param *param, bool enc);
int32_t MODES_CTR_UpdateEx(MODES_CipherCtx *modeCtx, const uint8_t *in, uint32_t inLen, uint8_t *out, uint32_t *outLen);
diff --git a/crypto/modes/include/crypt_modes_ecb.h b/crypto/modes/include/crypt_modes_ecb.h
index b906d25..a41d8dd 100644
--- a/crypto/modes/include/crypt_modes_ecb.h
+++ b/crypto/modes/include/crypt_modes_ecb.h
@@ -50,7 +50,7 @@ int32_t SM4_ECB_Update(MODES_CipherCtx *modeCtx, const uint8_t *in, uint32_t inL
int32_t SM4_ECB_Final(MODES_CipherCtx *modeCtx, uint8_t *out, uint32_t *outLen);
int32_t MODES_ECB_InitCtxEx(MODES_CipherCtx *modeCtx, const uint8_t *key, uint32_t keyLen, const uint8_t *iv,
- uint32_t ivLen, BSL_Param *param, bool enc);
+ uint32_t ivLen, const BSL_Param *param, bool enc);
int32_t MODES_ECB_UpdateEx(MODES_CipherCtx *modeCtx, const uint8_t *in, uint32_t inLen, uint8_t *out, uint32_t *outLen);
int32_t MODES_ECB_FinalEx(MODES_CipherCtx *modeCtx, uint8_t *out, uint32_t *outLen);
diff --git a/crypto/modes/include/crypt_modes_gcm.h b/crypto/modes/include/crypt_modes_gcm.h
index f3aa95f..5212cb5 100644
--- a/crypto/modes/include/crypt_modes_gcm.h
+++ b/crypto/modes/include/crypt_modes_gcm.h
@@ -49,7 +49,7 @@ int32_t SM4_GCM_InitCtx(MODES_GCM_Ctx *modeCtx, const uint8_t *key, uint32_t key
int32_t SM4_GCM_Update(MODES_GCM_Ctx *modeCtx, const uint8_t *in, uint32_t inLen, uint8_t *out, uint32_t *outLen);
int32_t MODES_GCM_InitCtxEx(MODES_GCM_Ctx *modeCtx, const uint8_t *key, uint32_t keyLen, const uint8_t *iv,
- uint32_t ivLen, BSL_Param *param, bool enc);
+ uint32_t ivLen, const BSL_Param *param, bool enc);
int32_t MODES_GCM_UpdateEx(MODES_GCM_Ctx *modeCtx, const uint8_t *in, uint32_t inLen, uint8_t *out, uint32_t *outLen);
diff --git a/crypto/modes/include/crypt_modes_ofb.h b/crypto/modes/include/crypt_modes_ofb.h
index b346522..43ebfbf 100644
--- a/crypto/modes/include/crypt_modes_ofb.h
+++ b/crypto/modes/include/crypt_modes_ofb.h
@@ -46,7 +46,7 @@ int32_t SM4_OFB_InitCtx(MODES_CipherCtx *modeCtx, const uint8_t *key, uint32_t k
int32_t SM4_OFB_Update(MODES_CipherCtx *modeCtx, const uint8_t *in, uint32_t inLen, uint8_t *out, uint32_t *outLen);
int32_t MODES_OFB_InitCtxEx(MODES_CipherCtx *modeCtx, const uint8_t *key, uint32_t keyLen, const uint8_t *iv,
- uint32_t ivLen, BSL_Param *param, bool enc);
+ uint32_t ivLen, const BSL_Param *param, bool enc);
int32_t MODES_OFB_UpdateEx(MODES_CipherCtx *modeCtx, const uint8_t *in, uint32_t inLen, uint8_t *out, uint32_t *outLen);
diff --git a/crypto/modes/include/crypt_modes_xts.h b/crypto/modes/include/crypt_modes_xts.h
index d310048..9281262 100644
--- a/crypto/modes/include/crypt_modes_xts.h
+++ b/crypto/modes/include/crypt_modes_xts.h
@@ -46,7 +46,7 @@ int32_t SM4_XTS_InitCtx(MODES_XTS_Ctx *modeCtx, const uint8_t *key, uint32_t key
uint32_t ivLen, bool enc);
int32_t MODES_XTS_InitCtxEx(MODES_XTS_Ctx *modeCtx, const uint8_t *key, uint32_t keyLen, const uint8_t *iv,
- uint32_t ivLen, BSL_Param *param, bool enc);
+ uint32_t ivLen, const BSL_Param *param, bool enc);
int32_t MODES_XTS_UpdateEx(MODES_XTS_Ctx *modeCtx, const uint8_t *in, uint32_t inLen, uint8_t *out, uint32_t *outLen);
#ifdef __cplusplus
diff --git a/crypto/modes/src/modes_cbc.c b/crypto/modes/src/modes_cbc.c
index c4b2ba5..94a8cb2 100644
--- a/crypto/modes/src/modes_cbc.c
+++ b/crypto/modes/src/modes_cbc.c
@@ -207,7 +207,7 @@ int32_t MODES_CBC_UpdateEx(MODES_CipherCtx *modeCtx, const uint8_t *in, uint32_t
}
}
int32_t MODES_CBC_InitCtxEx(MODES_CipherCtx *modeCtx, const uint8_t *key, uint32_t keyLen, const uint8_t *iv,
- uint32_t ivLen, BSL_Param *param, bool enc)
+ uint32_t ivLen, const BSL_Param *param, bool enc)
{
(void)param;
if (modeCtx == NULL) {
diff --git a/crypto/modes/src/modes_ccm.c b/crypto/modes/src/modes_ccm.c
index dcc8e19..26320d9 100644
--- a/crypto/modes/src/modes_ccm.c
+++ b/crypto/modes/src/modes_ccm.c
@@ -536,7 +536,7 @@ MODES_CCM_Ctx *MODES_CCM_NewCtx(int32_t algId)
}
int32_t MODES_CCM_InitCtx(MODES_CCM_Ctx *modeCtx, const uint8_t *key, uint32_t keyLen, const uint8_t *iv,
- uint32_t ivLen, BSL_Param *param, bool enc)
+ uint32_t ivLen, const BSL_Param *param, bool enc)
{
(void)param;
if (modeCtx == NULL) {
diff --git a/crypto/modes/src/modes_cfb.c b/crypto/modes/src/modes_cfb.c
index 87a95dd..8b14251 100644
--- a/crypto/modes/src/modes_cfb.c
+++ b/crypto/modes/src/modes_cfb.c
@@ -404,7 +404,7 @@ void MODES_CFB_FreeCtx(MODES_CFB_Ctx *modeCtx)
}
int32_t MODES_CFB_InitCtxEx(MODES_CFB_Ctx *modeCtx, const uint8_t *key, uint32_t keyLen, const uint8_t *iv,
- uint32_t ivLen, BSL_Param *param, bool enc)
+ uint32_t ivLen, const BSL_Param *param, bool enc)
{
(void) param;
if (modeCtx == NULL) {
diff --git a/crypto/modes/src/modes_chacha20_poly1305.c b/crypto/modes/src/modes_chacha20_poly1305.c
index 3f12ffd..0ca6913 100644
--- a/crypto/modes/src/modes_chacha20_poly1305.c
+++ b/crypto/modes/src/modes_chacha20_poly1305.c
@@ -346,7 +346,7 @@ MODES_CHACHAPOLY_Ctx *MODES_CHACHA20POLY1305_NewCtx(int32_t algId)
}
int32_t MODES_CHACHA20POLY1305_InitCtx(MODES_CHACHAPOLY_Ctx *modeCtx, const uint8_t *key, uint32_t keyLen,
- const uint8_t *iv, uint32_t ivLen, BSL_Param *param, bool enc)
+ const uint8_t *iv, uint32_t ivLen, const BSL_Param *param, bool enc)
{
(void)param;
if (modeCtx == NULL) {
diff --git a/crypto/modes/src/modes_ctr.c b/crypto/modes/src/modes_ctr.c
index 0841bc0..a6f72cb 100644
--- a/crypto/modes/src/modes_ctr.c
+++ b/crypto/modes/src/modes_ctr.c
@@ -148,7 +148,7 @@ void MODES_CTR_FreeCtx(MODES_CipherCtx *modeCtx)
}
int32_t MODES_CTR_InitCtxEx(MODES_CipherCtx *modeCtx, const uint8_t *key, uint32_t keyLen, const uint8_t *iv,
- uint32_t ivLen, BSL_Param *param, bool enc)
+ uint32_t ivLen, const BSL_Param *param, bool enc)
{
(void)param;
if (modeCtx == NULL) {
diff --git a/crypto/modes/src/modes_ecb.c b/crypto/modes/src/modes_ecb.c
index 8129bc6..b7d23a0 100644
--- a/crypto/modes/src/modes_ecb.c
+++ b/crypto/modes/src/modes_ecb.c
@@ -147,7 +147,7 @@ void MODES_ECB_FreeCtx(MODES_CipherCtx *modeCtx)
}
int32_t MODES_ECB_InitCtxEx(MODES_CipherCtx *modeCtx, const uint8_t *key, uint32_t keyLen, const uint8_t *iv,
- uint32_t ivLen, BSL_Param *param, bool enc)
+ uint32_t ivLen, const BSL_Param *param, bool enc)
{
(void)param;
if (modeCtx == NULL) {
diff --git a/crypto/modes/src/modes_gcm.c b/crypto/modes/src/modes_gcm.c
index 79664b3..128fb50 100644
--- a/crypto/modes/src/modes_gcm.c
+++ b/crypto/modes/src/modes_gcm.c
@@ -523,7 +523,7 @@ void MODES_GCM_FreeCtx(MODES_GCM_Ctx *modeCtx)
int32_t MODES_GCM_InitCtxEx(MODES_GCM_Ctx *modeCtx, const uint8_t *key, uint32_t keyLen, const uint8_t *iv,
- uint32_t ivLen, BSL_Param *param, bool enc)
+ uint32_t ivLen, const BSL_Param *param, bool enc)
{
(void)param;
if (modeCtx == NULL) {
diff --git a/crypto/modes/src/modes_ofb.c b/crypto/modes/src/modes_ofb.c
index 5e9caff..c3131b2 100644
--- a/crypto/modes/src/modes_ofb.c
+++ b/crypto/modes/src/modes_ofb.c
@@ -137,7 +137,7 @@ void MODES_OFB_FreeCtx(MODES_CipherCtx *modeCtx)
}
int32_t MODES_OFB_InitCtxEx(MODES_CipherCtx *modeCtx, const uint8_t *key, uint32_t keyLen, const uint8_t *iv,
- uint32_t ivLen, BSL_Param *param, bool enc)
+ uint32_t ivLen, const BSL_Param *param, bool enc)
{
(void) param;
if (modeCtx == NULL) {
diff --git a/crypto/modes/src/modes_xts.c b/crypto/modes/src/modes_xts.c
index 5e52196..0b55dd6 100644
--- a/crypto/modes/src/modes_xts.c
+++ b/crypto/modes/src/modes_xts.c
@@ -438,7 +438,7 @@ void MODES_XTS_FreeCtx(MODES_XTS_Ctx *modeCtx)
int32_t MODES_XTS_InitCtxEx(MODES_XTS_Ctx *modeCtx, const uint8_t *key, uint32_t keyLen, const uint8_t *iv,
- uint32_t ivLen, BSL_Param *param, bool enc)
+ uint32_t ivLen, const BSL_Param *param, bool enc)
{
(void) param;
if (modeCtx == NULL) {
diff --git a/crypto/sha1/include/crypt_sha1.h b/crypto/sha1/include/crypt_sha1.h
index 1360d03..e5a89ff 100644
--- a/crypto/sha1/include/crypt_sha1.h
+++ b/crypto/sha1/include/crypt_sha1.h
@@ -62,7 +62,7 @@ void CRYPT_SHA1_FreeCtx(CRYPT_SHA1_Ctx *ctx);
* @retval #CRYPT_SUCCESS initialization succeeded.
* @retval #CRYPT_NULL_INPUT Pointer ctx is NULL
*/
-int32_t CRYPT_SHA1_Init(CRYPT_SHA1_Ctx *ctx, BSL_Param *param);
+int32_t CRYPT_SHA1_Init(CRYPT_SHA1_Ctx *ctx, const BSL_Param *param);
/**
* @ingroup SHA1
diff --git a/crypto/sha1/src/sha1.c b/crypto/sha1/src/sha1.c
index fc619ee..265fab7 100644
--- a/crypto/sha1/src/sha1.c
+++ b/crypto/sha1/src/sha1.c
@@ -57,7 +57,7 @@ void CRYPT_SHA1_FreeCtx(CRYPT_SHA1_Ctx *ctx)
/* e767 is because H is defined in SHA1 and MD5.
But the both the macros are different. So masked
this error */
-int32_t CRYPT_SHA1_Init(CRYPT_SHA1_Ctx *ctx, BSL_Param *param)
+int32_t CRYPT_SHA1_Init(CRYPT_SHA1_Ctx *ctx, const BSL_Param *param)
{
if (ctx == NULL) {
BSL_ERR_PUSH_ERROR(CRYPT_NULL_INPUT);
diff --git a/crypto/sha2/include/crypt_sha2.h b/crypto/sha2/include/crypt_sha2.h
index 7ebc447..20c476a 100644
--- a/crypto/sha2/include/crypt_sha2.h
+++ b/crypto/sha2/include/crypt_sha2.h
@@ -94,7 +94,7 @@ void CRYPT_SHA2_224_FreeCtx(CRYPT_SHA2_224_Ctx *ctx);
* @retval #CRYPT_SUCCESS ctx is initialized
* @retval #CRYPT_NULL_INPUT ctx is NULL
*/
-int32_t CRYPT_SHA2_224_Init(CRYPT_SHA2_224_Ctx *ctx, BSL_Param *param);
+int32_t CRYPT_SHA2_224_Init(CRYPT_SHA2_224_Ctx *ctx, const BSL_Param *param);
/**
* @defgroup CRYPT_SHA2_224_Update
@@ -196,7 +196,7 @@ void CRYPT_SHA2_256_FreeCtx(CRYPT_SHA2_256_Ctx *ctx);
* @retval #CRYPT_SUCCESS ctx is initialized
* @retval #CRYPT_NULL_INPUT ctx is NULL
*/
-int32_t CRYPT_SHA2_256_Init(CRYPT_SHA2_256_Ctx *ctx, BSL_Param *param);
+int32_t CRYPT_SHA2_256_Init(CRYPT_SHA2_256_Ctx *ctx, const BSL_Param *param);
/**
* @defgroup CRYPT_SHA2_256_Update
@@ -299,7 +299,7 @@ void CRYPT_SHA2_384_FreeCtx(CRYPT_SHA2_384_Ctx *ctx);
* @retval #CRYPT_SUCCESS ctx is initialized
* @retval #CRYPT_NULL_INPUT ctx is NULL
*/
-int32_t CRYPT_SHA2_384_Init(CRYPT_SHA2_384_Ctx *ctx, BSL_Param *param);
+int32_t CRYPT_SHA2_384_Init(CRYPT_SHA2_384_Ctx *ctx, const BSL_Param *param);
/**
* @ingroup LLF Low Level Functions
@@ -397,7 +397,7 @@ void CRYPT_SHA2_512_FreeCtx(CRYPT_SHA2_512_Ctx *ctx);
* @retval #CRYPT_SUCCESS ctx is initialized
* @retval #CRYPT_NULL_INPUT ctx is NULL
*/
-int32_t CRYPT_SHA2_512_Init(CRYPT_SHA2_512_Ctx *ctx, BSL_Param *param);
+int32_t CRYPT_SHA2_512_Init(CRYPT_SHA2_512_Ctx *ctx, const BSL_Param *param);
/**
* @ingroup LLF Low Level Functions
diff --git a/crypto/sha2/src/sha2_256.c b/crypto/sha2/src/sha2_256.c
index 729e44a..db55f88 100644
--- a/crypto/sha2/src/sha2_256.c
+++ b/crypto/sha2/src/sha2_256.c
@@ -48,7 +48,7 @@ void CRYPT_SHA2_256_FreeCtx(CRYPT_SHA2_256_Ctx *ctx)
BSL_SAL_ClearFree(ctx, sizeof(CRYPT_SHA2_256_Ctx));
}
-int32_t CRYPT_SHA2_256_Init(CRYPT_SHA2_256_Ctx *ctx, BSL_Param *param)
+int32_t CRYPT_SHA2_256_Init(CRYPT_SHA2_256_Ctx *ctx, const BSL_Param *param)
{
if (ctx == NULL) {
BSL_ERR_PUSH_ERROR(CRYPT_NULL_INPUT);
@@ -286,7 +286,7 @@ void CRYPT_SHA2_224_FreeCtx(CRYPT_SHA2_224_Ctx *ctx)
BSL_SAL_ClearFree(ctx, sizeof(CRYPT_SHA2_224_Ctx));
}
-int32_t CRYPT_SHA2_224_Init(CRYPT_SHA2_224_Ctx *ctx, BSL_Param *param)
+int32_t CRYPT_SHA2_224_Init(CRYPT_SHA2_224_Ctx *ctx, const BSL_Param *param)
{
if (ctx == NULL) {
BSL_ERR_PUSH_ERROR(CRYPT_NULL_INPUT);
diff --git a/crypto/sha2/src/sha2_512.c b/crypto/sha2/src/sha2_512.c
index d7db263..30379f1 100644
--- a/crypto/sha2/src/sha2_512.c
+++ b/crypto/sha2/src/sha2_512.c
@@ -87,7 +87,7 @@ void CRYPT_SHA2_512_FreeCtx(CRYPT_SHA2_512_Ctx *ctx)
BSL_SAL_ClearFree(ctx, sizeof(CRYPT_SHA2_512_Ctx));
}
-int32_t CRYPT_SHA2_512_Init(CRYPT_SHA2_512_Ctx *ctx, BSL_Param *param)
+int32_t CRYPT_SHA2_512_Init(CRYPT_SHA2_512_Ctx *ctx, const BSL_Param *param)
{
if (ctx == NULL) {
BSL_ERR_PUSH_ERROR(CRYPT_NULL_INPUT);
@@ -284,7 +284,7 @@ void CRYPT_SHA2_384_FreeCtx(CRYPT_SHA2_384_Ctx *ctx)
BSL_SAL_ClearFree(ctx, sizeof(CRYPT_SHA2_384_Ctx));
}
-int32_t CRYPT_SHA2_384_Init(CRYPT_SHA2_384_Ctx *ctx, BSL_Param *param)
+int32_t CRYPT_SHA2_384_Init(CRYPT_SHA2_384_Ctx *ctx, const BSL_Param *param)
{
if (ctx == NULL) {
BSL_ERR_PUSH_ERROR(CRYPT_NULL_INPUT);
diff --git a/crypto/sha3/include/crypt_sha3.h b/crypto/sha3/include/crypt_sha3.h
index 7306a59..997de83 100644
--- a/crypto/sha3/include/crypt_sha3.h
+++ b/crypto/sha3/include/crypt_sha3.h
@@ -87,15 +87,15 @@ void CRYPT_SHAKE256_FreeCtx(CRYPT_SHAKE256_Ctx* ctx);
// free context
// Initialize the context
-int32_t CRYPT_SHA3_224_Init(CRYPT_SHA3_224_Ctx *ctx, BSL_Param *param);
+int32_t CRYPT_SHA3_224_Init(CRYPT_SHA3_224_Ctx *ctx, const BSL_Param *param);
-int32_t CRYPT_SHA3_256_Init(CRYPT_SHA3_256_Ctx *ctx, BSL_Param *param);
+int32_t CRYPT_SHA3_256_Init(CRYPT_SHA3_256_Ctx *ctx, const BSL_Param *param);
-int32_t CRYPT_SHA3_384_Init(CRYPT_SHA3_384_Ctx *ctx, BSL_Param *param);
+int32_t CRYPT_SHA3_384_Init(CRYPT_SHA3_384_Ctx *ctx, const BSL_Param *param);
-int32_t CRYPT_SHA3_512_Init(CRYPT_SHA3_512_Ctx *ctx, BSL_Param *param);
-int32_t CRYPT_SHAKE128_Init(CRYPT_SHAKE128_Ctx *ctx, BSL_Param *param);
-int32_t CRYPT_SHAKE256_Init(CRYPT_SHAKE256_Ctx *ctx, BSL_Param *param);
+int32_t CRYPT_SHA3_512_Init(CRYPT_SHA3_512_Ctx *ctx, const BSL_Param *param);
+int32_t CRYPT_SHAKE128_Init(CRYPT_SHAKE128_Ctx *ctx, const BSL_Param *param);
+int32_t CRYPT_SHAKE256_Init(CRYPT_SHAKE256_Ctx *ctx, const BSL_Param *param);
// Data update API
int32_t CRYPT_SHA3_224_Update(CRYPT_SHA3_224_Ctx *ctx, const uint8_t *in, uint32_t len);
diff --git a/crypto/sha3/src/sha3.c b/crypto/sha3/src/sha3.c
index aecddd2..b408be9 100644
--- a/crypto/sha3/src/sha3.c
+++ b/crypto/sha3/src/sha3.c
@@ -214,42 +214,42 @@ void CRYPT_SHAKE256_FreeCtx(CRYPT_SHAKE256_Ctx* ctx)
CRYPT_SHA3_FreeCtx(ctx);
}
-int32_t CRYPT_SHA3_224_Init(CRYPT_SHA3_224_Ctx *ctx, BSL_Param *param)
+int32_t CRYPT_SHA3_224_Init(CRYPT_SHA3_224_Ctx *ctx, const BSL_Param *param)
{
(void) param;
// 0x06 is SHA3 padding character, see https://keccak.team/keccak_specs_summary.html
return CRYPT_SHA3_Init(ctx, CRYPT_SHA3_224_DIGESTSIZE, CRYPT_SHA3_224_BLOCKSIZE, 0x06);
}
-int32_t CRYPT_SHA3_256_Init(CRYPT_SHA3_256_Ctx *ctx, BSL_Param *param)
+int32_t CRYPT_SHA3_256_Init(CRYPT_SHA3_256_Ctx *ctx, const BSL_Param *param)
{
(void) param;
// 0x06 is SHA3 padding character, see https://keccak.team/keccak_specs_summary.html
return CRYPT_SHA3_Init(ctx, CRYPT_SHA3_256_DIGESTSIZE, CRYPT_SHA3_256_BLOCKSIZE, 0x06);
}
-int32_t CRYPT_SHA3_384_Init(CRYPT_SHA3_384_Ctx *ctx, BSL_Param *param)
+int32_t CRYPT_SHA3_384_Init(CRYPT_SHA3_384_Ctx *ctx, const BSL_Param *param)
{
(void) param;
// 0x06 is SHA3 padding character, see https://keccak.team/keccak_specs_summary.html
return CRYPT_SHA3_Init(ctx, CRYPT_SHA3_384_DIGESTSIZE, CRYPT_SHA3_384_BLOCKSIZE, 0x06);
}
-int32_t CRYPT_SHA3_512_Init(CRYPT_SHA3_512_Ctx *ctx, BSL_Param *param)
+int32_t CRYPT_SHA3_512_Init(CRYPT_SHA3_512_Ctx *ctx, const BSL_Param *param)
{
(void) param;
// 0x06 is SHA3 padding character, see https://keccak.team/keccak_specs_summary.html
return CRYPT_SHA3_Init(ctx, CRYPT_SHA3_512_DIGESTSIZE, CRYPT_SHA3_512_BLOCKSIZE, 0x06);
}
-int32_t CRYPT_SHAKE128_Init(CRYPT_SHAKE128_Ctx *ctx, BSL_Param *param)
+int32_t CRYPT_SHAKE128_Init(CRYPT_SHAKE128_Ctx *ctx, const BSL_Param *param)
{
(void) param;
// 0x1f is SHA3 padding character, see https://keccak.team/keccak_specs_summary.html
return CRYPT_SHA3_Init(ctx, 0, CRYPT_SHAKE128_BLOCKSIZE, 0x1F);
}
-int32_t CRYPT_SHAKE256_Init(CRYPT_SHAKE256_Ctx *ctx, BSL_Param *param)
+int32_t CRYPT_SHAKE256_Init(CRYPT_SHAKE256_Ctx *ctx, const BSL_Param *param)
{
(void) param;
// 0x1f is SHA3 padding character, see https://keccak.team/keccak_specs_summary.html
diff --git a/crypto/sm3/include/crypt_sm3.h b/crypto/sm3/include/crypt_sm3.h
index 2a173c1..3c1f6ee 100644
--- a/crypto/sm3/include/crypt_sm3.h
+++ b/crypto/sm3/include/crypt_sm3.h
@@ -60,7 +60,7 @@ void CRYPT_SM3_FreeCtx(CRYPT_SM3_Ctx *ctx);
* @retval #CRYPT_SUCCESS initialization succeeded.
* @retval #CRYPT_NULL_INPUT Pointer ctx is NULL
*/
-int32_t CRYPT_SM3_Init(CRYPT_SM3_Ctx *ctx, BSL_Param *param);
+int32_t CRYPT_SM3_Init(CRYPT_SM3_Ctx *ctx, const BSL_Param *param);
/**
* @ingroup SM3
diff --git a/crypto/sm3/src/sm3_public.c b/crypto/sm3/src/sm3_public.c
index 169f4b8..5a18820 100644
--- a/crypto/sm3/src/sm3_public.c
+++ b/crypto/sm3/src/sm3_public.c
@@ -49,7 +49,7 @@ void CRYPT_SM3_FreeCtx(CRYPT_SM3_Ctx *ctx)
BSL_SAL_ClearFree(ctx, sizeof(CRYPT_SM3_Ctx));
}
-int32_t CRYPT_SM3_Init(CRYPT_SM3_Ctx *ctx, BSL_Param *param)
+int32_t CRYPT_SM3_Init(CRYPT_SM3_Ctx *ctx, const BSL_Param *param)
{
if (ctx == NULL) {
BSL_ERR_PUSH_ERROR(CRYPT_NULL_INPUT);
diff --git a/include/crypto/crypt_eal_implprovider.h b/include/crypto/crypt_eal_implprovider.h
index d99c1c3..6d0377b 100644
--- a/include/crypto/crypt_eal_implprovider.h
+++ b/include/crypto/crypt_eal_implprovider.h
@@ -109,7 +109,7 @@ typedef int32_t (*CRYPT_EAL_ImplProviderInit)(CRYPT_EAL_ProvMgrCtx *mgrCtx, BSL_
typedef void *(*CRYPT_EAL_ImplCipherNewCtx)(void *provCtx, int32_t algId);
typedef int32_t (*CRYPT_EAL_ImplCipherInitCtx)(void *ctx, const uint8_t *key, uint32_t keyLen,
- const uint8_t *iv, uint32_t ivLen, BSL_Param *param, bool enc);
+ const uint8_t *iv, uint32_t ivLen, const BSL_Param *param, bool enc);
typedef int32_t (*CRYPT_EAL_ImplCipherUpdate)(void *ctx, const uint8_t *in, uint32_t inLen,
uint8_t *out, uint32_t *outLen);
typedef int32_t (*CRYPT_EAL_ImplCipherFinal)(void *ctx, const uint8_t *in, uint32_t inLen,
@@ -198,7 +198,7 @@ typedef int32_t (*CRYPT_EAL_ImplPkeyExchCtrl)(void *ctx, int32_t cmd, void *val,
#define CRYPT_EAL_IMPLMD_FREECTX 8
typedef void *(*CRYPT_EAL_ImplMdNewCtx)(void *provCtx, int32_t algId);
-typedef int32_t (*CRYPT_EAL_ImplMdInitCtx)(void *ctx, BSL_Param *param);
+typedef int32_t (*CRYPT_EAL_ImplMdInitCtx)(void *ctx, const BSL_Param *param);
typedef int32_t (*CRYPT_EAL_ImplMdUpdate)(const void *ctx, const uint8_t *input, uint32_t len);
typedef int32_t (*CRYPT_EAL_ImplMdFinal)(const void *ctx, uint8_t *out, uint32_t *outLen);
typedef int32_t (*CRYPT_EAL_ImplMdDeInitCtx)(void *ctx);
@@ -217,7 +217,7 @@ typedef void (*CRYPT_EAL_ImplMdFreeCtx)(void *ctx);
#define CRYPT_EAL_IMPLMAC_FREECTX 8
typedef void *(*CRYPT_EAL_ImplMacNewCtx)(void *provCtx, int32_t algId);
-typedef int32_t (*CRYPT_EAL_ImplMacInit)(void *ctx, const uint8_t *key, uint32_t len, BSL_Param *param);
+typedef int32_t (*CRYPT_EAL_ImplMacInit)(void *ctx, const uint8_t *key, uint32_t len, const BSL_Param *param);
typedef int32_t (*CRYPT_EAL_ImplMacUpdate)(const void *ctx, const uint8_t *input, uint32_t len);
typedef int32_t (*CRYPT_EAL_ImplMacFinal)(const void *ctx, uint8_t *out, uint32_t *outLen);
typedef int32_t (*CRYPT_EAL_ImplMacDeInitCtx)(void *ctx);
--
2.42.0.windows.2