summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/openssh/openssh-6.2p2/mac.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/openssh/openssh-6.2p2/mac.patch')
-rw-r--r--meta/recipes-connectivity/openssh/openssh-6.2p2/mac.patch76
1 files changed, 76 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/openssh/openssh-6.2p2/mac.patch b/meta/recipes-connectivity/openssh/openssh-6.2p2/mac.patch
new file mode 100644
index 0000000000..69fb69daeb
--- /dev/null
+++ b/meta/recipes-connectivity/openssh/openssh-6.2p2/mac.patch
@@ -0,0 +1,76 @@
1[PATCH] force the MAC output to be 64-bit aligned
2
3Upstream-Status: Backport[anoncvs.mindrot.org/index.cgi/openssh/mac.c?r1=1.27&r2=1.28]
4
5Backport patch to fix segment fault due to unaligned memory access
6
7Wed Jun 5 22:12:37 2013 UTC (7 days, 3 hours ago) by dtucker
8Branch: MAIN
9CVS Tags: HEAD
10Changes since 1.27: +11 -8 lines
11Diff to previous 1.27
12
13 - dtucker@cvs.openbsd.org 2013/06/03 00:03:18
14 [mac.c]
15 force the MAC output to be 64-bit aligned so umac won't see
16unaligned
17 accesses on strict-alignment architectures. bz#2101, patch from
18 tomas.kuthan at oracle.com, ok djm@
19---
20 mac.c | 18 +++++++++++-------
21 1 file changed, 11 insertions(+), 7 deletions(-)
22
23diff --git a/mac.c b/mac.c
24index 3f2dc6f..a5a80d3 100644
25--- a/mac.c
26+++ b/mac.c
27@@ -152,12 +152,16 @@ mac_init(Mac *mac)
28 u_char *
29 mac_compute(Mac *mac, u_int32_t seqno, u_char *data, int datalen)
30 {
31- static u_char m[EVP_MAX_MD_SIZE];
32+ static union {
33+ u_char m[EVP_MAX_MD_SIZE];
34+ u_int64_t for_align;
35+ } u;
36+
37 u_char b[4], nonce[8];
38
39- if (mac->mac_len > sizeof(m))
40+ if (mac->mac_len > sizeof(u))
41 fatal("mac_compute: mac too long %u %lu",
42- mac->mac_len, (u_long)sizeof(m));
43+ mac->mac_len, (u_long)sizeof(u));
44
45 switch (mac->type) {
46 case SSH_EVP:
47@@ -166,22 +170,22 @@ mac_compute(Mac *mac, u_int32_t seqno, u_char *data, int datalen)
48 HMAC_Init(&mac->evp_ctx, NULL, 0, NULL);
49 HMAC_Update(&mac->evp_ctx, b, sizeof(b));
50 HMAC_Update(&mac->evp_ctx, data, datalen);
51- HMAC_Final(&mac->evp_ctx, m, NULL);
52+ HMAC_Final(&mac->evp_ctx, u.m, NULL);
53 break;
54 case SSH_UMAC:
55 put_u64(nonce, seqno);
56 umac_update(mac->umac_ctx, data, datalen);
57- umac_final(mac->umac_ctx, m, nonce);
58+ umac_final(mac->umac_ctx, u.m, nonce);
59 break;
60 case SSH_UMAC128:
61 put_u64(nonce, seqno);
62 umac128_update(mac->umac_ctx, data, datalen);
63- umac128_final(mac->umac_ctx, m, nonce);
64+ umac128_final(mac->umac_ctx, u.m, nonce);
65 break;
66 default:
67 fatal("mac_compute: unknown MAC type");
68 }
69- return (m);
70+ return (u.m);
71 }
72
73 void
74--
751.7.9.5
76