aboutsummaryrefslogtreecommitdiff
path: root/sys/netgraph
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2008-12-16 19:15:31 +0000
committerAlexander Motin <mav@FreeBSD.org>2008-12-16 19:15:31 +0000
commitb3d298b9b9381fcaf6e23753450750beacceb189 (patch)
treea12b97fc6f773be6ef1a590073ec52d007b122a3 /sys/netgraph
parentce8be7b8b096fbf3e9a4dc169f0de30d18be4b43 (diff)
downloadsrc-b3d298b9b9381fcaf6e23753450750beacceb189.tar.gz
src-b3d298b9b9381fcaf6e23753450750beacceb189.zip
Unroll two loops of SHA1Update(). 60 bytes of static memory is not a price.
Notes
Notes: svn path=/head/; revision=186189
Diffstat (limited to 'sys/netgraph')
-rw-r--r--sys/netgraph/ng_mppc.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/sys/netgraph/ng_mppc.c b/sys/netgraph/ng_mppc.c
index 472968f8d82c..5a6c302fa0cd 100644
--- a/sys/netgraph/ng_mppc.c
+++ b/sys/netgraph/ng_mppc.c
@@ -824,21 +824,24 @@ ng_mppc_reset_req(node_p node)
static void
ng_mppc_getkey(const u_char *h, u_char *h2, int len)
{
- static const u_char pad1[10] =
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
- static const u_char pad2[10] =
- { 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, };
+ static const u_char pad1[40] =
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ static const u_char pad2[40] =
+ { 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2,
+ 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2,
+ 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2,
+ 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2 };
u_char hash[20];
SHA1_CTX c;
- int k;
SHA1Init(&c);
SHA1Update(&c, h, len);
- for (k = 0; k < 4; k++)
- SHA1Update(&c, pad1, sizeof(pad1));
+ SHA1Update(&c, pad1, sizeof(pad1));
SHA1Update(&c, h2, len);
- for (k = 0; k < 4; k++)
- SHA1Update(&c, pad2, sizeof(pad2));
+ SHA1Update(&c, pad2, sizeof(pad2));
SHA1Final(hash, &c);
bcopy(hash, h2, len);
}