From 3443bd25702232a393172995f8aff5567817162d Mon Sep 17 00:00:00 2001 From: Mateusz Starzyk Date: Mon, 7 Jun 2021 16:03:27 +0200 Subject: [PATCH] Add comment on exiting early from mbedtls_gcm_update(). Signed-off-by: Mateusz Starzyk --- library/gcm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/gcm.c b/library/gcm.c index 01e12e69ca..be72f99412 100644 --- a/library/gcm.c +++ b/library/gcm.c @@ -454,7 +454,9 @@ int mbedtls_gcm_update( mbedtls_gcm_context *ctx, *output_length = input_length; /* Exit early if input_length==0 so that we don't do any pointer arithmetic - * on a potentially null pointer. */ + * on a potentially null pointer. + * Returning early also means that the last partial block of AD remains + * untouched for mbedtls_gcm_finish */ if( input_length == 0 ) return( 0 );