[PATCH 2 of 4] md5: use explicit memzero to avoid optimizations
Vadim Fedorenko
vadim.fedorenko at cdnnow.ru
Mon Apr 17 23:07:08 UTC 2023
# HG changeset patch
# User Vadim Fedorenko <vadim.fedorenko at cdnnow.ru>
# Date 1681771200 -10800
# Tue Apr 18 01:40:00 2023 +0300
# Node ID 8f8773a3076bdbd91fc7a4e96d7a068f7ff29b09
# Parent 0a1c8cb5c05141f3ea3135d9f01688f7693fc7df
md5: use explicit memzero to avoid optimizations.
GCC11 is optimizing memzero functions in md5 implementation.
Use ngx_explicit_memzero() instead.
---
src/core/ngx_md5.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff -r 0a1c8cb5c051 -r 8f8773a3076b src/core/ngx_md5.c
--- a/src/core/ngx_md5.c Tue Apr 18 01:39:32 2023 +0300
+++ b/src/core/ngx_md5.c Tue Apr 18 01:40:00 2023 +0300
@@ -70,13 +70,13 @@
free = 64 - used;
if (free < 8) {
- ngx_memzero(&ctx->buffer[used], free);
+ ngx_explicit_memzero(&ctx->buffer[used], free);
(void) ngx_md5_body(ctx, ctx->buffer, 64);
used = 0;
free = 64;
}
- ngx_memzero(&ctx->buffer[used], free - 8);
+ ngx_explicit_memzero(&ctx->buffer[used], free - 8);
ctx->bytes <<= 3;
ctx->buffer[56] = (u_char) ctx->bytes;
@@ -107,7 +107,7 @@
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));
}
More information about the nginx-devel
mailing list