Mercurial > gnulib
annotate lib/sha1.c @ 40186:8964917f9574
autoupdate
author | Karl Berry <karl@freefriends.org> |
---|---|
date | Mon, 18 Feb 2019 08:02:49 -0800 |
parents | b06060465f09 |
children |
rev | line source |
---|---|
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
1 /* sha1.c - Functions to compute SHA1 message digest of files or |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
2 memory blocks according to the NIST specification FIPS-180-1. |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
3 |
40057
b06060465f09
maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents:
39711
diff
changeset
|
4 Copyright (C) 2000-2001, 2003-2006, 2008-2019 Free Software Foundation, Inc. |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
5 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
6 This program is free software; you can redistribute it and/or modify it |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
7 under the terms of the GNU General Public License as published by the |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
8 Free Software Foundation; either version 2, or (at your option) any |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
9 later version. |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
10 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
11 This program is distributed in the hope that it will be useful, |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
14 GNU General Public License for more details. |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
15 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
16 You should have received a copy of the GNU General Public License |
19190 | 17 along with this program; if not, see <https://www.gnu.org/licenses/>. */ |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
18 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
19 /* Written by Scott G. Miller |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
20 Credits: |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
21 Robert Klep <robert@ilse.nl> -- Expansion function fix |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
22 */ |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
23 |
7302
8a1a9361108c
* _fpending.c: Include <config.h> unconditionally, since we no
Paul Eggert <eggert@cs.ucla.edu>
parents:
6787
diff
changeset
|
24 #include <config.h> |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
25 |
17554
0c8459454095
md5, sha1, sha256, sha512: use openssl routines if available
Pádraig Brady <P@draigBrady.com>
parents:
17249
diff
changeset
|
26 #if HAVE_OPENSSL_SHA1 |
0c8459454095
md5, sha1, sha256, sha512: use openssl routines if available
Pádraig Brady <P@draigBrady.com>
parents:
17249
diff
changeset
|
27 # define GL_OPENSSL_INLINE _GL_EXTERN_INLINE |
0c8459454095
md5, sha1, sha256, sha512: use openssl routines if available
Pádraig Brady <P@draigBrady.com>
parents:
17249
diff
changeset
|
28 #endif |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
29 #include "sha1.h" |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
30 |
15997
d8fd2f096b83
crypto libraries: use stdalign
Paul Eggert <eggert@cs.ucla.edu>
parents:
14079
diff
changeset
|
31 #include <stdalign.h> |
d8fd2f096b83
crypto libraries: use stdalign
Paul Eggert <eggert@cs.ucla.edu>
parents:
14079
diff
changeset
|
32 #include <stdint.h> |
12198
e8fbc5424b99
digests, copy-file: increase the IO buffer size from 4KiB to 32KiB
Pádraig Brady <P@draigBrady.com>
parents:
9796
diff
changeset
|
33 #include <stdlib.h> |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
34 #include <string.h> |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
35 |
5318
7c24a825b51d
Remove dependencies on unlocked-io.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5165
diff
changeset
|
36 #if USE_UNLOCKED_IO |
7c24a825b51d
Remove dependencies on unlocked-io.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5165
diff
changeset
|
37 # include "unlocked-io.h" |
7c24a825b51d
Remove dependencies on unlocked-io.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5165
diff
changeset
|
38 #endif |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
39 |
39693 | 40 #include <byteswap.h> |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
41 #ifdef WORDS_BIGENDIAN |
6222
3bdede13630a
Merge glibc and coreutils changes into gnulib, plus a few
Paul Eggert <eggert@cs.ucla.edu>
parents:
5848
diff
changeset
|
42 # define SWAP(n) (n) |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
43 #else |
39693 | 44 # define SWAP(n) bswap_32 (n) |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
45 #endif |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
46 |
12198
e8fbc5424b99
digests, copy-file: increase the IO buffer size from 4KiB to 32KiB
Pádraig Brady <P@draigBrady.com>
parents:
9796
diff
changeset
|
47 #define BLOCKSIZE 32768 |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
48 #if BLOCKSIZE % 64 != 0 |
6222
3bdede13630a
Merge glibc and coreutils changes into gnulib, plus a few
Paul Eggert <eggert@cs.ucla.edu>
parents:
5848
diff
changeset
|
49 # error "invalid BLOCKSIZE" |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
50 #endif |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
51 |
17554
0c8459454095
md5, sha1, sha256, sha512: use openssl routines if available
Pádraig Brady <P@draigBrady.com>
parents:
17249
diff
changeset
|
52 #if ! HAVE_OPENSSL_SHA1 |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
53 /* This array contains the bytes used to pad the buffer to the next |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
54 64-byte boundary. (RFC 1321, 3.1: Step 1) */ |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
55 static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
56 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
57 |
6553 | 58 /* Take a pointer to a 160 bit block of data (five 32 bit ints) and |
59 initialize it to the start constants of the SHA1 algorithm. This | |
60 must be called before using hash in the call to sha1_hash. */ | |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
61 void |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
62 sha1_init_ctx (struct sha1_ctx *ctx) |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
63 { |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
64 ctx->A = 0x67452301; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
65 ctx->B = 0xefcdab89; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
66 ctx->C = 0x98badcfe; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
67 ctx->D = 0x10325476; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
68 ctx->E = 0xc3d2e1f0; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
69 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
70 ctx->total[0] = ctx->total[1] = 0; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
71 ctx->buflen = 0; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
72 } |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
73 |
9656
9a9b67d137e3
sha1: remove the result buffer alignment constraint
Peter Palfrader <weasel@debian.org>
parents:
7302
diff
changeset
|
74 /* Copy the 4 byte value from v into the memory location pointed to by *cp, |
9a9b67d137e3
sha1: remove the result buffer alignment constraint
Peter Palfrader <weasel@debian.org>
parents:
7302
diff
changeset
|
75 If your architecture allows unaligned access this is equivalent to |
9a9b67d137e3
sha1: remove the result buffer alignment constraint
Peter Palfrader <weasel@debian.org>
parents:
7302
diff
changeset
|
76 * (uint32_t *) cp = v */ |
17183
f3fa9d9507c7
arctwo, md4, md5, sha1, sha256, sha512: no 'static inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
16860
diff
changeset
|
77 static void |
9656
9a9b67d137e3
sha1: remove the result buffer alignment constraint
Peter Palfrader <weasel@debian.org>
parents:
7302
diff
changeset
|
78 set_uint32 (char *cp, uint32_t v) |
9a9b67d137e3
sha1: remove the result buffer alignment constraint
Peter Palfrader <weasel@debian.org>
parents:
7302
diff
changeset
|
79 { |
9662
52902e86c444
Prefer "sizeof v" over the equivalent "4".
Jim Meyering <meyering@redhat.com>
parents:
9660
diff
changeset
|
80 memcpy (cp, &v, sizeof v); |
9656
9a9b67d137e3
sha1: remove the result buffer alignment constraint
Peter Palfrader <weasel@debian.org>
parents:
7302
diff
changeset
|
81 } |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
82 |
9656
9a9b67d137e3
sha1: remove the result buffer alignment constraint
Peter Palfrader <weasel@debian.org>
parents:
7302
diff
changeset
|
83 /* Put result from CTX in first 20 bytes following RESBUF. The result |
9a9b67d137e3
sha1: remove the result buffer alignment constraint
Peter Palfrader <weasel@debian.org>
parents:
7302
diff
changeset
|
84 must be in little endian byte order. */ |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
85 void * |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
86 sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf) |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
87 { |
9656
9a9b67d137e3
sha1: remove the result buffer alignment constraint
Peter Palfrader <weasel@debian.org>
parents:
7302
diff
changeset
|
88 char *r = resbuf; |
9666
c219f369ca5e
Use "sizeof VAR", rather than a literal "4".
Jim Meyering <meyering@redhat.com>
parents:
9662
diff
changeset
|
89 set_uint32 (r + 0 * sizeof ctx->A, SWAP (ctx->A)); |
c219f369ca5e
Use "sizeof VAR", rather than a literal "4".
Jim Meyering <meyering@redhat.com>
parents:
9662
diff
changeset
|
90 set_uint32 (r + 1 * sizeof ctx->B, SWAP (ctx->B)); |
c219f369ca5e
Use "sizeof VAR", rather than a literal "4".
Jim Meyering <meyering@redhat.com>
parents:
9662
diff
changeset
|
91 set_uint32 (r + 2 * sizeof ctx->C, SWAP (ctx->C)); |
c219f369ca5e
Use "sizeof VAR", rather than a literal "4".
Jim Meyering <meyering@redhat.com>
parents:
9662
diff
changeset
|
92 set_uint32 (r + 3 * sizeof ctx->D, SWAP (ctx->D)); |
c219f369ca5e
Use "sizeof VAR", rather than a literal "4".
Jim Meyering <meyering@redhat.com>
parents:
9662
diff
changeset
|
93 set_uint32 (r + 4 * sizeof ctx->E, SWAP (ctx->E)); |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
94 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
95 return resbuf; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
96 } |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
97 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
98 /* Process the remaining bytes in the internal buffer and the usual |
9656
9a9b67d137e3
sha1: remove the result buffer alignment constraint
Peter Palfrader <weasel@debian.org>
parents:
7302
diff
changeset
|
99 prolog according to the standard and write the result to RESBUF. */ |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
100 void * |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
101 sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf) |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
102 { |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
103 /* Take yet unprocessed bytes into account. */ |
6381
865e2ea2dde4
Separate sha1 from md5. Use stdint.h in both modules.
Simon Josefsson <simon@josefsson.org>
parents:
6222
diff
changeset
|
104 uint32_t bytes = ctx->buflen; |
6553 | 105 size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4; |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
106 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
107 /* Now count remaining bytes. */ |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
108 ctx->total[0] += bytes; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
109 if (ctx->total[0] < bytes) |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
110 ++ctx->total[1]; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
111 |
6553 | 112 /* Put the 64-bit file length in *bits* at the end of the buffer. */ |
113 ctx->buffer[size - 2] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)); | |
114 ctx->buffer[size - 1] = SWAP (ctx->total[0] << 3); | |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
115 |
6553 | 116 memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes); |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
117 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
118 /* Process last bytes. */ |
6553 | 119 sha1_process_block (ctx->buffer, size * 4, ctx); |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
120 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
121 return sha1_read_ctx (ctx, resbuf); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
122 } |
17554
0c8459454095
md5, sha1, sha256, sha512: use openssl routines if available
Pádraig Brady <P@draigBrady.com>
parents:
17249
diff
changeset
|
123 #endif |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
124 |
19684
560df898e0e9
crypto: omit stream ops Emacs doesn’t need
Paul Eggert <eggert@cs.ucla.edu>
parents:
19619
diff
changeset
|
125 #ifdef GL_COMPILE_CRYPTO_STREAM |
560df898e0e9
crypto: omit stream ops Emacs doesn’t need
Paul Eggert <eggert@cs.ucla.edu>
parents:
19619
diff
changeset
|
126 |
560df898e0e9
crypto: omit stream ops Emacs doesn’t need
Paul Eggert <eggert@cs.ucla.edu>
parents:
19619
diff
changeset
|
127 #include "af_alg.h" |
560df898e0e9
crypto: omit stream ops Emacs doesn’t need
Paul Eggert <eggert@cs.ucla.edu>
parents:
19619
diff
changeset
|
128 |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
129 /* Compute SHA1 message digest for bytes read from STREAM. The |
19616 | 130 resulting message digest number will be written into the 20 bytes |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
131 beginning at RESBLOCK. */ |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
132 int |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
133 sha1_stream (FILE *stream, void *resblock) |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
134 { |
19619
57bf41f3355e
crypto/{md5,sha1,sha256,sha512}: simplify
Paul Eggert <eggert@cs.ucla.edu>
parents:
19616
diff
changeset
|
135 switch (afalg_stream (stream, "sha1", resblock, SHA1_DIGEST_SIZE)) |
57bf41f3355e
crypto/{md5,sha1,sha256,sha512}: simplify
Paul Eggert <eggert@cs.ucla.edu>
parents:
19616
diff
changeset
|
136 { |
57bf41f3355e
crypto/{md5,sha1,sha256,sha512}: simplify
Paul Eggert <eggert@cs.ucla.edu>
parents:
19616
diff
changeset
|
137 case 0: return 0; |
57bf41f3355e
crypto/{md5,sha1,sha256,sha512}: simplify
Paul Eggert <eggert@cs.ucla.edu>
parents:
19616
diff
changeset
|
138 case -EIO: return 1; |
57bf41f3355e
crypto/{md5,sha1,sha256,sha512}: simplify
Paul Eggert <eggert@cs.ucla.edu>
parents:
19616
diff
changeset
|
139 } |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
140 |
19619
57bf41f3355e
crypto/{md5,sha1,sha256,sha512}: simplify
Paul Eggert <eggert@cs.ucla.edu>
parents:
19616
diff
changeset
|
141 char *buffer = malloc (BLOCKSIZE + 72); |
12198
e8fbc5424b99
digests, copy-file: increase the IO buffer size from 4KiB to 32KiB
Pádraig Brady <P@draigBrady.com>
parents:
9796
diff
changeset
|
142 if (!buffer) |
e8fbc5424b99
digests, copy-file: increase the IO buffer size from 4KiB to 32KiB
Pádraig Brady <P@draigBrady.com>
parents:
9796
diff
changeset
|
143 return 1; |
e8fbc5424b99
digests, copy-file: increase the IO buffer size from 4KiB to 32KiB
Pádraig Brady <P@draigBrady.com>
parents:
9796
diff
changeset
|
144 |
19619
57bf41f3355e
crypto/{md5,sha1,sha256,sha512}: simplify
Paul Eggert <eggert@cs.ucla.edu>
parents:
19616
diff
changeset
|
145 struct sha1_ctx ctx; |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
146 sha1_init_ctx (&ctx); |
19619
57bf41f3355e
crypto/{md5,sha1,sha256,sha512}: simplify
Paul Eggert <eggert@cs.ucla.edu>
parents:
19616
diff
changeset
|
147 size_t sum; |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
148 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
149 /* Iterate over full file contents. */ |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
150 while (1) |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
151 { |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
152 /* We read the file in blocks of BLOCKSIZE bytes. One call of the |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
153 computation function processes the whole buffer so that with the |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
154 next round of the loop another block can be read. */ |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
155 size_t n; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
156 sum = 0; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
157 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
158 /* Read block. Take care for partial reads. */ |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
159 while (1) |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
160 { |
39707
5fd4481b1d32
af_alg: avoid hangs when reading from streams
Pádraig Brady <P@draigBrady.com>
parents:
39693
diff
changeset
|
161 /* Either process a partial fread() from this loop, |
5fd4481b1d32
af_alg: avoid hangs when reading from streams
Pádraig Brady <P@draigBrady.com>
parents:
39693
diff
changeset
|
162 or the fread() in afalg_stream may have gotten EOF. |
39711
e693c621c472
maint: clarify comments about sticky EOF
Pádraig Brady <P@draigBrady.com>
parents:
39707
diff
changeset
|
163 We need to avoid a subsequent fread() as EOF may |
e693c621c472
maint: clarify comments about sticky EOF
Pádraig Brady <P@draigBrady.com>
parents:
39707
diff
changeset
|
164 not be sticky. For details of such systems, see: |
e693c621c472
maint: clarify comments about sticky EOF
Pádraig Brady <P@draigBrady.com>
parents:
39707
diff
changeset
|
165 https://sourceware.org/bugzilla/show_bug.cgi?id=1190 */ |
39707
5fd4481b1d32
af_alg: avoid hangs when reading from streams
Pádraig Brady <P@draigBrady.com>
parents:
39693
diff
changeset
|
166 if (feof (stream)) |
5fd4481b1d32
af_alg: avoid hangs when reading from streams
Pádraig Brady <P@draigBrady.com>
parents:
39693
diff
changeset
|
167 goto process_partial_block; |
5fd4481b1d32
af_alg: avoid hangs when reading from streams
Pádraig Brady <P@draigBrady.com>
parents:
39693
diff
changeset
|
168 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
169 n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
170 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
171 sum += n; |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
172 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
173 if (sum == BLOCKSIZE) |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
174 break; |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
175 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
176 if (n == 0) |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
177 { |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
178 /* Check for the error flag IFF N == 0, so that we don't |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
179 exit the loop after a partial read due to e.g., EAGAIN |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
180 or EWOULDBLOCK. */ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
181 if (ferror (stream)) |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
182 { |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
183 free (buffer); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
184 return 1; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
185 } |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
186 goto process_partial_block; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
187 } |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
188 } |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
189 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
190 /* Process buffer with BLOCKSIZE bytes. Note that |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
191 BLOCKSIZE % 64 == 0 |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
192 */ |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
193 sha1_process_block (buffer, BLOCKSIZE, &ctx); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
194 } |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
195 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
196 process_partial_block:; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
197 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
198 /* Process any remaining bytes. */ |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
199 if (sum > 0) |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
200 sha1_process_bytes (buffer, sum, &ctx); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
201 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
202 /* Construct result in desired memory. */ |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
203 sha1_finish_ctx (&ctx, resblock); |
12198
e8fbc5424b99
digests, copy-file: increase the IO buffer size from 4KiB to 32KiB
Pádraig Brady <P@draigBrady.com>
parents:
9796
diff
changeset
|
204 free (buffer); |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
205 return 0; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
206 } |
19684
560df898e0e9
crypto: omit stream ops Emacs doesn’t need
Paul Eggert <eggert@cs.ucla.edu>
parents:
19619
diff
changeset
|
207 #endif |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
208 |
17554
0c8459454095
md5, sha1, sha256, sha512: use openssl routines if available
Pádraig Brady <P@draigBrady.com>
parents:
17249
diff
changeset
|
209 #if ! HAVE_OPENSSL_SHA1 |
6787
caee82d64491
sha1.c (sha1_buffer): Correct comment: s/MD5/SHA1/. From James Lemley.
Jim Meyering <jim@meyering.net>
parents:
6784
diff
changeset
|
210 /* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
211 result is always in little endian byte order, so that a byte-wise |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
212 output yields to the wanted ASCII representation of the message |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
213 digest. */ |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
214 void * |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
215 sha1_buffer (const char *buffer, size_t len, void *resblock) |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
216 { |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
217 struct sha1_ctx ctx; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
218 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
219 /* Initialize the computation context. */ |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
220 sha1_init_ctx (&ctx); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
221 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
222 /* Process whole buffer but last len % 64 bytes. */ |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
223 sha1_process_bytes (buffer, len, &ctx); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
224 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
225 /* Put result in desired memory area. */ |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
226 return sha1_finish_ctx (&ctx, resblock); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
227 } |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
228 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
229 void |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
230 sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx) |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
231 { |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
232 /* When we already have some bits in our internal buffer concatenate |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
233 both inputs first. */ |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
234 if (ctx->buflen != 0) |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
235 { |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
236 size_t left_over = ctx->buflen; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
237 size_t add = 128 - left_over > len ? len : 128 - left_over; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
238 |
6553 | 239 memcpy (&((char *) ctx->buffer)[left_over], buffer, add); |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
240 ctx->buflen += add; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
241 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
242 if (ctx->buflen > 64) |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
243 { |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
244 sha1_process_block (ctx->buffer, ctx->buflen & ~63, ctx); |
9796 | 245 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
246 ctx->buflen &= 63; |
18756
34f03a221ea4
md5, sha1, sha256, sha512: Add comments regarding correctness.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
247 /* The regions in the following copy operation cannot overlap, |
34f03a221ea4
md5, sha1, sha256, sha512: Add comments regarding correctness.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
248 because ctx->buflen < 64 ≤ (left_over + add) & ~63. */ |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
249 memcpy (ctx->buffer, |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
250 &((char *) ctx->buffer)[(left_over + add) & ~63], |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
251 ctx->buflen); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
252 } |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
253 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
254 buffer = (const char *) buffer + add; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
255 len -= add; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
256 } |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
257 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
258 /* Process available complete blocks. */ |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
259 if (len >= 64) |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
260 { |
18531
c76b85c7da8d
md4,md5,sha*: allow _STRING_INLINE_unaligned enable unaligned operation
Pádraig Brady <P@draigBrady.com>
parents:
18189
diff
changeset
|
261 #if !(_STRING_ARCH_unaligned || _STRING_INLINE_unaligned) |
15997
d8fd2f096b83
crypto libraries: use stdalign
Paul Eggert <eggert@cs.ucla.edu>
parents:
14079
diff
changeset
|
262 # define UNALIGNED_P(p) ((uintptr_t) (p) % alignof (uint32_t) != 0) |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
263 if (UNALIGNED_P (buffer)) |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
264 while (len > 64) |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
265 { |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
266 sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
267 buffer = (const char *) buffer + 64; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
268 len -= 64; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
269 } |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
270 else |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
271 #endif |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
272 { |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
273 sha1_process_block (buffer, len & ~63, ctx); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
274 buffer = (const char *) buffer + (len & ~63); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
275 len &= 63; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
276 } |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
277 } |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
278 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
279 /* Move remaining bytes in internal buffer. */ |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
280 if (len > 0) |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
281 { |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
282 size_t left_over = ctx->buflen; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
283 |
6553 | 284 memcpy (&((char *) ctx->buffer)[left_over], buffer, len); |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
285 left_over += len; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
286 if (left_over >= 64) |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
287 { |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
288 sha1_process_block (ctx->buffer, 64, ctx); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
289 left_over -= 64; |
18756
34f03a221ea4
md5, sha1, sha256, sha512: Add comments regarding correctness.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
290 /* The regions in the following copy operation cannot overlap, |
34f03a221ea4
md5, sha1, sha256, sha512: Add comments regarding correctness.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
291 because left_over ≤ 64. */ |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
292 memcpy (ctx->buffer, &ctx->buffer[16], left_over); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
293 } |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
294 ctx->buflen = left_over; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
295 } |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
296 } |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
297 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
298 /* --- Code below is the primary difference between md5.c and sha1.c --- */ |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
299 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
300 /* SHA1 round constants */ |
6784
fe34cbd2306e
2006-05-10 Paul Eggert <eggert@cs.ucla.edu>
Simon Josefsson <simon@josefsson.org>
parents:
6553
diff
changeset
|
301 #define K1 0x5a827999 |
fe34cbd2306e
2006-05-10 Paul Eggert <eggert@cs.ucla.edu>
Simon Josefsson <simon@josefsson.org>
parents:
6553
diff
changeset
|
302 #define K2 0x6ed9eba1 |
fe34cbd2306e
2006-05-10 Paul Eggert <eggert@cs.ucla.edu>
Simon Josefsson <simon@josefsson.org>
parents:
6553
diff
changeset
|
303 #define K3 0x8f1bbcdc |
fe34cbd2306e
2006-05-10 Paul Eggert <eggert@cs.ucla.edu>
Simon Josefsson <simon@josefsson.org>
parents:
6553
diff
changeset
|
304 #define K4 0xca62c1d6 |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
305 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
306 /* Round functions. Note that F2 is the same as F4. */ |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
307 #define F1(B,C,D) ( D ^ ( B & ( C ^ D ) ) ) |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
308 #define F2(B,C,D) (B ^ C ^ D) |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
309 #define F3(B,C,D) ( ( B & C ) | ( D & ( B | C ) ) ) |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
310 #define F4(B,C,D) (B ^ C ^ D) |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
311 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
312 /* Process LEN bytes of BUFFER, accumulating context into CTX. |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
313 It is assumed that LEN % 64 == 0. |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
314 Most of this code comes from GnuPG's cipher/sha1.c. */ |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
315 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
316 void |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
317 sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx) |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
318 { |
6381
865e2ea2dde4
Separate sha1 from md5. Use stdint.h in both modules.
Simon Josefsson <simon@josefsson.org>
parents:
6222
diff
changeset
|
319 const uint32_t *words = buffer; |
865e2ea2dde4
Separate sha1 from md5. Use stdint.h in both modules.
Simon Josefsson <simon@josefsson.org>
parents:
6222
diff
changeset
|
320 size_t nwords = len / sizeof (uint32_t); |
865e2ea2dde4
Separate sha1 from md5. Use stdint.h in both modules.
Simon Josefsson <simon@josefsson.org>
parents:
6222
diff
changeset
|
321 const uint32_t *endp = words + nwords; |
865e2ea2dde4
Separate sha1 from md5. Use stdint.h in both modules.
Simon Josefsson <simon@josefsson.org>
parents:
6222
diff
changeset
|
322 uint32_t x[16]; |
865e2ea2dde4
Separate sha1 from md5. Use stdint.h in both modules.
Simon Josefsson <simon@josefsson.org>
parents:
6222
diff
changeset
|
323 uint32_t a = ctx->A; |
865e2ea2dde4
Separate sha1 from md5. Use stdint.h in both modules.
Simon Josefsson <simon@josefsson.org>
parents:
6222
diff
changeset
|
324 uint32_t b = ctx->B; |
865e2ea2dde4
Separate sha1 from md5. Use stdint.h in both modules.
Simon Josefsson <simon@josefsson.org>
parents:
6222
diff
changeset
|
325 uint32_t c = ctx->C; |
865e2ea2dde4
Separate sha1 from md5. Use stdint.h in both modules.
Simon Josefsson <simon@josefsson.org>
parents:
6222
diff
changeset
|
326 uint32_t d = ctx->D; |
865e2ea2dde4
Separate sha1 from md5. Use stdint.h in both modules.
Simon Josefsson <simon@josefsson.org>
parents:
6222
diff
changeset
|
327 uint32_t e = ctx->E; |
16860
a3feab896112
crypto: fix bug in large buffer handling
Paul Eggert <eggert@cs.ucla.edu>
parents:
16366
diff
changeset
|
328 uint32_t lolen = len; |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
329 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
330 /* First increment the byte count. RFC 1321 specifies the possible |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
331 length of the file up to 2^64 bits. Here we only compute the |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
332 number of bytes. Do a double word increment. */ |
16860
a3feab896112
crypto: fix bug in large buffer handling
Paul Eggert <eggert@cs.ucla.edu>
parents:
16366
diff
changeset
|
333 ctx->total[0] += lolen; |
a3feab896112
crypto: fix bug in large buffer handling
Paul Eggert <eggert@cs.ucla.edu>
parents:
16366
diff
changeset
|
334 ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen); |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
335 |
6784
fe34cbd2306e
2006-05-10 Paul Eggert <eggert@cs.ucla.edu>
Simon Josefsson <simon@josefsson.org>
parents:
6553
diff
changeset
|
336 #define rol(x, n) (((x) << (n)) | ((uint32_t) (x) >> (32 - (n)))) |
6222
3bdede13630a
Merge glibc and coreutils changes into gnulib, plus a few
Paul Eggert <eggert@cs.ucla.edu>
parents:
5848
diff
changeset
|
337 |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
338 #define M(I) ( tm = x[I&0x0f] ^ x[(I-14)&0x0f] \ |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
339 ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
340 , (x[I&0x0f] = rol(tm, 1)) ) |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
341 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
342 #define R(A,B,C,D,E,F,K,M) do { E += rol( A, 5 ) \ |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
343 + F( B, C, D ) \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
344 + K \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
345 + M; \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
346 B = rol( B, 30 ); \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
347 } while(0) |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
348 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
349 while (words < endp) |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
350 { |
6381
865e2ea2dde4
Separate sha1 from md5. Use stdint.h in both modules.
Simon Josefsson <simon@josefsson.org>
parents:
6222
diff
changeset
|
351 uint32_t tm; |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
352 int t; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
353 for (t = 0; t < 16; t++) |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
354 { |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
355 x[t] = SWAP (*words); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
356 words++; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12198
diff
changeset
|
357 } |
5165
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
358 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
359 R( a, b, c, d, e, F1, K1, x[ 0] ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
360 R( e, a, b, c, d, F1, K1, x[ 1] ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
361 R( d, e, a, b, c, F1, K1, x[ 2] ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
362 R( c, d, e, a, b, F1, K1, x[ 3] ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
363 R( b, c, d, e, a, F1, K1, x[ 4] ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
364 R( a, b, c, d, e, F1, K1, x[ 5] ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
365 R( e, a, b, c, d, F1, K1, x[ 6] ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
366 R( d, e, a, b, c, F1, K1, x[ 7] ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
367 R( c, d, e, a, b, F1, K1, x[ 8] ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
368 R( b, c, d, e, a, F1, K1, x[ 9] ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
369 R( a, b, c, d, e, F1, K1, x[10] ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
370 R( e, a, b, c, d, F1, K1, x[11] ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
371 R( d, e, a, b, c, F1, K1, x[12] ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
372 R( c, d, e, a, b, F1, K1, x[13] ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
373 R( b, c, d, e, a, F1, K1, x[14] ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
374 R( a, b, c, d, e, F1, K1, x[15] ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
375 R( e, a, b, c, d, F1, K1, M(16) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
376 R( d, e, a, b, c, F1, K1, M(17) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
377 R( c, d, e, a, b, F1, K1, M(18) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
378 R( b, c, d, e, a, F1, K1, M(19) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
379 R( a, b, c, d, e, F2, K2, M(20) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
380 R( e, a, b, c, d, F2, K2, M(21) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
381 R( d, e, a, b, c, F2, K2, M(22) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
382 R( c, d, e, a, b, F2, K2, M(23) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
383 R( b, c, d, e, a, F2, K2, M(24) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
384 R( a, b, c, d, e, F2, K2, M(25) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
385 R( e, a, b, c, d, F2, K2, M(26) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
386 R( d, e, a, b, c, F2, K2, M(27) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
387 R( c, d, e, a, b, F2, K2, M(28) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
388 R( b, c, d, e, a, F2, K2, M(29) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
389 R( a, b, c, d, e, F2, K2, M(30) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
390 R( e, a, b, c, d, F2, K2, M(31) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
391 R( d, e, a, b, c, F2, K2, M(32) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
392 R( c, d, e, a, b, F2, K2, M(33) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
393 R( b, c, d, e, a, F2, K2, M(34) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
394 R( a, b, c, d, e, F2, K2, M(35) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
395 R( e, a, b, c, d, F2, K2, M(36) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
396 R( d, e, a, b, c, F2, K2, M(37) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
397 R( c, d, e, a, b, F2, K2, M(38) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
398 R( b, c, d, e, a, F2, K2, M(39) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
399 R( a, b, c, d, e, F3, K3, M(40) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
400 R( e, a, b, c, d, F3, K3, M(41) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
401 R( d, e, a, b, c, F3, K3, M(42) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
402 R( c, d, e, a, b, F3, K3, M(43) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
403 R( b, c, d, e, a, F3, K3, M(44) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
404 R( a, b, c, d, e, F3, K3, M(45) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
405 R( e, a, b, c, d, F3, K3, M(46) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
406 R( d, e, a, b, c, F3, K3, M(47) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
407 R( c, d, e, a, b, F3, K3, M(48) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
408 R( b, c, d, e, a, F3, K3, M(49) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
409 R( a, b, c, d, e, F3, K3, M(50) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
410 R( e, a, b, c, d, F3, K3, M(51) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
411 R( d, e, a, b, c, F3, K3, M(52) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
412 R( c, d, e, a, b, F3, K3, M(53) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
413 R( b, c, d, e, a, F3, K3, M(54) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
414 R( a, b, c, d, e, F3, K3, M(55) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
415 R( e, a, b, c, d, F3, K3, M(56) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
416 R( d, e, a, b, c, F3, K3, M(57) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
417 R( c, d, e, a, b, F3, K3, M(58) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
418 R( b, c, d, e, a, F3, K3, M(59) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
419 R( a, b, c, d, e, F4, K4, M(60) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
420 R( e, a, b, c, d, F4, K4, M(61) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
421 R( d, e, a, b, c, F4, K4, M(62) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
422 R( c, d, e, a, b, F4, K4, M(63) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
423 R( b, c, d, e, a, F4, K4, M(64) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
424 R( a, b, c, d, e, F4, K4, M(65) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
425 R( e, a, b, c, d, F4, K4, M(66) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
426 R( d, e, a, b, c, F4, K4, M(67) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
427 R( c, d, e, a, b, F4, K4, M(68) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
428 R( b, c, d, e, a, F4, K4, M(69) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
429 R( a, b, c, d, e, F4, K4, M(70) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
430 R( e, a, b, c, d, F4, K4, M(71) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
431 R( d, e, a, b, c, F4, K4, M(72) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
432 R( c, d, e, a, b, F4, K4, M(73) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
433 R( b, c, d, e, a, F4, K4, M(74) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
434 R( a, b, c, d, e, F4, K4, M(75) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
435 R( e, a, b, c, d, F4, K4, M(76) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
436 R( d, e, a, b, c, F4, K4, M(77) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
437 R( c, d, e, a, b, F4, K4, M(78) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
438 R( b, c, d, e, a, F4, K4, M(79) ); |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
439 |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
440 a = ctx->A += a; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
441 b = ctx->B += b; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
442 c = ctx->C += c; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
443 d = ctx->D += d; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
444 e = ctx->E += e; |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
445 } |
9d7fe6ace357
Add uint32_t.m4, uintptr_t.m4, and finish renaming sha->sha1.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
446 } |
17554
0c8459454095
md5, sha1, sha256, sha512: use openssl routines if available
Pádraig Brady <P@draigBrady.com>
parents:
17249
diff
changeset
|
447 #endif |
19496
33ee5e90be64
maint: Add encoding marker for Emacs to non-ASCII sources.
Bruno Haible <bruno@clisp.org>
parents:
19484
diff
changeset
|
448 |
33ee5e90be64
maint: Add encoding marker for Emacs to non-ASCII sources.
Bruno Haible <bruno@clisp.org>
parents:
19484
diff
changeset
|
449 /* |
33ee5e90be64
maint: Add encoding marker for Emacs to non-ASCII sources.
Bruno Haible <bruno@clisp.org>
parents:
19484
diff
changeset
|
450 * Hey Emacs! |
33ee5e90be64
maint: Add encoding marker for Emacs to non-ASCII sources.
Bruno Haible <bruno@clisp.org>
parents:
19484
diff
changeset
|
451 * Local Variables: |
33ee5e90be64
maint: Add encoding marker for Emacs to non-ASCII sources.
Bruno Haible <bruno@clisp.org>
parents:
19484
diff
changeset
|
452 * coding: utf-8 |
33ee5e90be64
maint: Add encoding marker for Emacs to non-ASCII sources.
Bruno Haible <bruno@clisp.org>
parents:
19484
diff
changeset
|
453 * End: |
33ee5e90be64
maint: Add encoding marker for Emacs to non-ASCII sources.
Bruno Haible <bruno@clisp.org>
parents:
19484
diff
changeset
|
454 */ |