summaryrefslogtreecommitdiff
path: root/lib/sha512.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2006-10-15 06:17:45 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2006-10-15 06:17:45 +0000
commitdd8398a3c642b1397f64e338d2b0008e33790dec (patch)
treee74087d4d653ebb99f546e0cd894ba85c758d2f0 /lib/sha512.h
parent443d5095786055328de8ede2648b9331405de083 (diff)
downloadcoreutils-dd8398a3c642b1397f64e338d2b0008e33790dec.tar.xz
[m4/ChangeLog]
* sha512.m4 (gl_SHA512): Add u64.h to AC_LIBSOURCES. [lib/ChangeLog] Port sha512sum to hosts where uintmax_t is only 32 bits, e.g., HP/Tandom NonStop OSS circa 2005 has 32-bit uintmax_t, 64-bit intmax_t. * u64.h: New file. * sha512.c (SWAP, sha512_init_ctx, sha384_init_ctx, sha512_read_ctx): (sha384_read_ctx, sha512_conclude_ctx, sha512_process_bytes): (sha512_round_constants, F2, F1, sha512_process_block): (S0, S1, SS0, SS1, M, R): Rewrite to use u64.h instead of assuming uint64_t. * sha512.h: Include u64.h rather than stdint.h. (rol64): Remove; moved to u64.h and renamed to u64rol.
Diffstat (limited to 'lib/sha512.h')
-rw-r--r--lib/sha512.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/sha512.h b/lib/sha512.h
index b90e71ad4..995511e91 100644
--- a/lib/sha512.h
+++ b/lib/sha512.h
@@ -20,16 +20,17 @@
# define SHA512_H 1
# include <stdio.h>
-# include <stdint.h>
+
+# include "u64.h"
/* Structure to save state of computation between the single steps. */
struct sha512_ctx
{
- uint64_t state[8];
+ u64 state[8];
- uint64_t total[2];
- uint64_t buflen;
- uint64_t buffer[32];
+ u64 total[2];
+ size_t buflen;
+ u64 buffer[32];
};
@@ -85,6 +86,4 @@ extern int sha384_stream (FILE *stream, void *resblock);
extern void *sha512_buffer (const char *buffer, size_t len, void *resblock);
extern void *sha384_buffer (const char *buffer, size_t len, void *resblock);
-# define rol64(x,n) ( ((x) << (n)) | ((x) >> (64-(n))) )
-
#endif