Update SM4_CBC_CTX and SM4_CTR_CTX

To support UADK and other third-party SM4 implementations
This commit is contained in:
Zhi Guan
2024-01-03 10:17:31 +08:00
parent f53f69d1e2
commit 92818b3fe5

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2023 The GmSSL Project. All Rights Reserved.
* Copyright 2014-2024 The GmSSL Project. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
@@ -82,7 +82,10 @@ int sm4_gcm_decrypt(const SM4_KEY *key, const uint8_t *iv, size_t ivlen,
typedef struct {
SM4_KEY sm4_key;
union {
SM4_KEY sm4_key;
void *handle;
};
uint8_t iv[SM4_BLOCK_SIZE];
uint8_t block[SM4_BLOCK_SIZE];
size_t block_nbytes;
@@ -98,7 +101,10 @@ int sm4_cbc_decrypt_finish(SM4_CBC_CTX *ctx, uint8_t *out, size_t *outlen);
typedef struct {
SM4_KEY sm4_key;
union {
SM4_KEY sm4_key;
void *handle;
};
uint8_t ctr[SM4_BLOCK_SIZE];
uint8_t block[SM4_BLOCK_SIZE];
size_t block_nbytes;