summaryrefslogtreecommitdiff
path: root/dev-libs/bglibs/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-04-12 03:41:30 +0100
committerV3n3RiX <venerix@redcorelinux.org>2020-04-12 03:41:30 +0100
commit623ee73d661e5ed8475cb264511f683407d87365 (patch)
tree993eb27c93ec7a2d2d19550300d888fc1fed9e69 /dev-libs/bglibs/files
parentceeeb463cc1eef97fd62eaee8bf2196ba04bc384 (diff)
gentoo Easter resync : 12.04.2020
Diffstat (limited to 'dev-libs/bglibs/files')
-rw-r--r--dev-libs/bglibs/files/bglibs-2.04-stack-buffers.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/dev-libs/bglibs/files/bglibs-2.04-stack-buffers.patch b/dev-libs/bglibs/files/bglibs-2.04-stack-buffers.patch
new file mode 100644
index 000000000000..6c6fb1133d4a
--- /dev/null
+++ b/dev-libs/bglibs/files/bglibs-2.04-stack-buffers.patch
@@ -0,0 +1,47 @@
+From 25252211283e05c692c8baf3e8a7c70224821762 Mon Sep 17 00:00:00 2001
+From: Rolf Eike Beer <eike@sf-mail.de>
+Date: Fri, 15 Nov 2019 19:40:22 +0100
+Subject: [PATCH] properly align the HMAC state buffers on the stack
+
+They need to have the same alignment as the contained data type, i.e. up to
+uint64. Otherwise usage of SHA HMACs causes bus errors on sparc.
+---
+ crypto/hmac.c | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/crypto/hmac.c b/crypto/hmac.c
+index abff0df..f4e48c0 100644
+--- a/crypto/hmac.c
++++ b/crypto/hmac.c
+@@ -34,7 +34,8 @@ void hmac_prepare(const struct hmac_control_block* hcb,
+ void* midstate,
+ const str* secret)
+ {
+- unsigned char state[hcb->state_size];
++ uint64 statebuf[(hcb->state_size + 7) / sizeof(uint64)];
++ unsigned char *state = (unsigned char *)statebuf;
+ unsigned char block[hcb->block_size];
+ unsigned i;
+
+@@ -80,8 +81,9 @@ void hmac_finish(const struct hmac_control_block* hcb,
+ const str* nonce,
+ void* output)
+ {
+- unsigned char state[hcb->state_size];
+-
++ uint64 statebuf[(hcb->state_size + 7) / sizeof(uint64)];
++ unsigned char *state = (unsigned char *)statebuf;
++
+ /* Generate H1 = H(K XOR ipad, nonce) */
+ hcb->inject(state, midstate);
+ hcb->update(state, (const unsigned char*)nonce->s, nonce->len);
+@@ -106,7 +108,8 @@ void hmac(const struct hmac_control_block* hcb,
+ const str* nonce,
+ void* output)
+ {
+- unsigned char midstate[hcb->state_size*2];
++ uint64 statebuf[(hcb->state_size * 2 + 7) / sizeof(uint64)];
++ unsigned char *midstate = (unsigned char *)statebuf;
+
+ hmac_prepare(hcb, midstate, secret);
+ hmac_finish(hcb, midstate, nonce, output);