summaryrefslogtreecommitdiff
path: root/user/yubikey-personalization/wipe-mem.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2024-05-29 20:49:05 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2024-08-07 10:08:08 -0500
commita6b7d25bd68b330b63e5d9471346a3f39d1eac0d (patch)
tree7fcaebee56fb29019dd71a524f680a31360ff44b /user/yubikey-personalization/wipe-mem.patch
parent803468584d029d1948fbedf8d1f44df0647ce19a (diff)
downloadpackages-a6b7d25bd68b330b63e5d9471346a3f39d1eac0d.tar.gz
packages-a6b7d25bd68b330b63e5d9471346a3f39d1eac0d.tar.bz2
packages-a6b7d25bd68b330b63e5d9471346a3f39d1eac0d.tar.xz
packages-a6b7d25bd68b330b63e5d9471346a3f39d1eac0d.zip
user/yubikey-personalization: Patches
* Update for GCC 10 compatibility. * Memory safety issues.
Diffstat (limited to 'user/yubikey-personalization/wipe-mem.patch')
-rw-r--r--user/yubikey-personalization/wipe-mem.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/user/yubikey-personalization/wipe-mem.patch b/user/yubikey-personalization/wipe-mem.patch
new file mode 100644
index 000000000..a5ef05e8d
--- /dev/null
+++ b/user/yubikey-personalization/wipe-mem.patch
@@ -0,0 +1,29 @@
+From 13f69440ac7cca05a94bd9cf9011e2ea352dad68 Mon Sep 17 00:00:00 2001
+From: Gabriel Kihlman <g.kihlman@yubico.com>
+Date: Mon, 27 Apr 2020 14:56:00 +0200
+Subject: [PATCH] Wipe stack memory containing key material before returning
+
+---
+ ykpers.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/ykpers.c b/ykpers.c
+index 81cb0df..2413b35 100644
+--- a/ykpers.c
++++ b/ykpers.c
+@@ -280,6 +280,7 @@ int ykp_AES_key_from_hex(YKP_CONFIG *cfg, const char *hexkey) {
+
+ yubikey_hex_decode(aesbin, hexkey, sizeof(aesbin));
+ memcpy(cfg->ykcore_config.key, aesbin, sizeof(cfg->ykcore_config.key));
++ insecure_memzero (aesbin, sizeof(aesbin));
+
+ return 0;
+ }
+@@ -330,6 +331,7 @@ int ykp_HMAC_key_from_hex(YKP_CONFIG *cfg, const char *hexkey) {
+ i = sizeof(cfg->ykcore_config.key);
+ memcpy(cfg->ykcore_config.key, aesbin, i);
+ memcpy(cfg->ykcore_config.uid, aesbin + i, 20 - i);
++ insecure_memzero (aesbin, sizeof(aesbin));
+
+ return 0;
+ }