summaryrefslogtreecommitdiff
path: root/crypt/sha512.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-07-02 12:30:03 -0400
committerUlrich Drepper <drepper@gmail.com>2011-07-02 12:30:03 -0400
commitfcfc776bc6242fdefde0efd7b0c315fbeca08555 (patch)
treec46c6b25047a2ed2f6baea7b76985f1d7bec3c4c /crypt/sha512.h
parent99231d9abe0fd74c7957d25b08c1d1ede4cae5a0 (diff)
Optimize long-word additions in SHA implementation
Diffstat (limited to 'crypt/sha512.h')
-rw-r--r--crypt/sha512.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/crypt/sha512.h b/crypt/sha512.h
index 9952c5f862..90e55dccb2 100644
--- a/crypt/sha512.h
+++ b/crypt/sha512.h
@@ -1,6 +1,6 @@
/* Declaration of functions and data types used for SHA512 sum computing
library functions.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -24,6 +24,9 @@
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
+#ifdef _LIBC
+# include <bits/wordsize.h>
+#endif
/* Structure to save state of computation between the single steps. */
@@ -31,7 +34,14 @@ struct sha512_ctx
{
uint64_t H[8];
- uint64_t total[2];
+ union
+ {
+#if defined __GNUC__ && __WORDSIZE == 64
+# define USE_TOTAL128
+ unsigned int total128 __attribute__ ((__mode__ (TI)));
+#endif
+ uint64_t total[2];
+ };
uint64_t buflen;
char buffer[256] __attribute__ ((__aligned__ (__alignof__ (uint64_t))));
};