diff --git a/library/chacha20.c b/library/chacha20.c index 0f97116f0c..b67e7ef40e 100644 --- a/library/chacha20.c +++ b/library/chacha20.c @@ -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; } diff --git a/library/chachapoly.c b/library/chachapoly.c index a6fbebe10e..3580a36367 100644 --- a/library/chachapoly.c +++ b/library/chachapoly.c @@ -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 */