summaryrefslogtreecommitdiff
path: root/lib/sha256.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-05-21 10:32:25 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2018-05-21 10:35:38 -0700
commit0c01176747a88b4444ae10fd37b70c2c123d51d8 (patch)
treec99184ea99dd2661a74d5f7748cb8768043a6ee4 /lib/sha256.c
parente90c77eb2608f23caa798a9910d8dc0f9901904a (diff)
downloadgnulib-0c01176747a88b4444ae10fd37b70c2c123d51d8.tar.gz
crypto: omit stream ops Emacs doesn’t need
* lib/md5.c (md5_stream): * lib/sha1.c (sha1_stream): * lib/sha256.c (shaxxx_stream, sha256_stream, sha224_stream): * lib/sha512.c (shaxxx_stream, sha512_stream, sha384_stream): Compile stream functions only if GL_COMPILE_CRYPTO_STREAM is defined. Emacs needs this, as it does not use the stream operations and doesn’t need all the af_alg stuff we’ve recently added. Perhaps a similar change is needed to the other crypto modules, but this patch changes only those needed for Emacs. * modules/crypto/md5-buffer, modules/crypto/sha1-buffer: * modules/crypto/sha256-buffer, modules/crypto/sha512-buffer: New modules, used by Emacs. * modules/crypto/md5, modules/crypto/sha1, modules/crypto/sha256: * modules/crypto/sha512: Rewrite to depend on the new modules.
Diffstat (limited to 'lib/sha256.c')
-rw-r--r--lib/sha256.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/sha256.c b/lib/sha256.c
index 5503c209f7..a036befcaf 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -32,8 +32,6 @@
#include <stdlib.h>
#include <string.h>
-#include "af_alg.h"
-
#if USE_UNLOCKED_IO
# include "unlocked-io.h"
#endif
@@ -171,6 +169,10 @@ sha224_finish_ctx (struct sha256_ctx *ctx, void *resbuf)
}
#endif
+#ifdef GL_COMPILE_CRYPTO_STREAM
+
+#include "af_alg.h"
+
/* Compute message digest for bytes read from STREAM using algorithm ALG.
Write the message digest into RESBLOCK, which contains HASHLEN bytes.
The initial and finishing operations are INIT_CTX and FINISH_CTX.
@@ -264,6 +266,7 @@ sha224_stream (FILE *stream, void *resblock)
return shaxxx_stream (stream, "sha224", resblock, SHA224_DIGEST_SIZE,
sha224_init_ctx, sha224_finish_ctx);
}
+#endif
#if ! HAVE_OPENSSL_SHA256
/* Compute SHA256 message digest for LEN bytes beginning at BUFFER. The