From 4bc9f37163c84288ac2844d9d26fc942d4625045 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Sat, 13 Jul 2024 10:05:00 +0900 Subject: [PATCH] sign: Use explicit_bzero to clear secret key material Suggested in: https://github.com/ostreedev/ostree/pull/3278#discussion_r1675696052 Signed-off-by: Daiki Ueno --- src/libostree/ostree-sign-ed25519.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libostree/ostree-sign-ed25519.c b/src/libostree/ostree-sign-ed25519.c index e0e3ac4613..e3b5b7a35c 100644 --- a/src/libostree/ostree-sign-ed25519.c +++ b/src/libostree/ostree-sign-ed25519.c @@ -27,6 +27,7 @@ #include "otcore.h" #include #include +#include #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "OSTreeSign" @@ -320,7 +321,7 @@ ostree_sign_ed25519_clear_keys (OstreeSign *self, GError **error) /* Clear secret key */ if (sign->secret_key != NULL) { - memset (sign->secret_key, 0, OSTREE_SIGN_ED25519_SECKEY_SIZE); + explicit_bzero (sign->secret_key, OSTREE_SIGN_ED25519_SECKEY_SIZE); g_free (sign->secret_key); sign->secret_key = NULL; }