mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-09-19 00:29:56 +00:00
Adapt ChaCha20 counter helper for 3.6
Signed-off-by: Ben Taylor <[email protected]>
This commit is contained in:
+3
-3
@@ -202,8 +202,8 @@ int mbedtls_chacha20_starts(mbedtls_chacha20_context *ctx,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int chacha20_check_counter_wrap(const mbedtls_chacha20_context *ctx,
|
||||
size_t size)
|
||||
int mbedtls_chacha20_check_counter_wrap(const mbedtls_chacha20_context *ctx,
|
||||
size_t size)
|
||||
{
|
||||
size_t available_keystream = 0;
|
||||
uint64_t needed_blocks = 0;
|
||||
@@ -255,7 +255,7 @@ int mbedtls_chacha20_update(mbedtls_chacha20_context *ctx,
|
||||
size_t offset = 0U;
|
||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||
|
||||
ret = chacha20_check_counter_wrap(ctx, size);
|
||||
ret = mbedtls_chacha20_check_counter_wrap(ctx, size);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
|
||||
#if !defined(MBEDTLS_CHACHAPOLY_ALT)
|
||||
|
||||
int mbedtls_chacha20_check_counter_wrap(const mbedtls_chacha20_context *ctx,
|
||||
size_t size);
|
||||
|
||||
#define CHACHAPOLY_STATE_INIT (0)
|
||||
#define CHACHAPOLY_STATE_AAD (1)
|
||||
#define CHACHAPOLY_STATE_CIPHERTEXT (2) /* Encrypting or decrypting */
|
||||
|
||||
Reference in New Issue
Block a user