changeset 9325:0086f8da5d8d

Usage of ngx_explicit_memzero() in internal md5 and sha1. The goal of the context cleanup in ngx_md5_final() and ngx_sha1_final() is to clear potentially sensitive data, so ngx_explicit_memzero() is appropriate.
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 31 Aug 2024 00:30:44 +0300
parents 03cdd806c0f2
children 75794cb1f5ea
files src/core/ngx_md5.c src/core/ngx_sha1.c
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/ngx_md5.c
+++ b/src/core/ngx_md5.c
@@ -107,7 +107,7 @@ ngx_md5_final(u_char result[16], ngx_md5
     result[14] = (u_char) (ctx->d >> 16);
     result[15] = (u_char) (ctx->d >> 24);
 
-    ngx_memzero(ctx, sizeof(*ctx));
+    ngx_explicit_memzero(ctx, sizeof(*ctx));
 }
 
 
--- a/src/core/ngx_sha1.c
+++ b/src/core/ngx_sha1.c
@@ -113,7 +113,7 @@ ngx_sha1_final(u_char result[20], ngx_sh
     result[18] = (u_char) (ctx->e >> 8);
     result[19] = (u_char) ctx->e;
 
-    ngx_memzero(ctx, sizeof(*ctx));
+    ngx_explicit_memzero(ctx, sizeof(*ctx));
 }