]> Savannah Git Hosting - gnulib.git/commitdiff
crypto: omit stream ops Emacs doesn’t need
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 21 May 2018 17:32:25 +0000 (10:32 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 21 May 2018 17:35:38 +0000 (10:35 -0700)
* 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.

13 files changed:
ChangeLog
lib/md5.c
lib/sha1.c
lib/sha256.c
lib/sha512.c
modules/crypto/md5
modules/crypto/md5-buffer [new file with mode: 0644]
modules/crypto/sha1
modules/crypto/sha1-buffer [new file with mode: 0644]
modules/crypto/sha256
modules/crypto/sha256-buffer [new file with mode: 0644]
modules/crypto/sha512
modules/crypto/sha512-buffer [new file with mode: 0644]

index 78f2ee911184a3745545bd3aed00a98f0a6cac21..daa6c2b9e47f1bb17f841f2ac252c70bec7ccd9c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2018-05-21  Paul Eggert  <eggert@cs.ucla.edu>
+
+       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.
+
 2018-05-20  Pádraig Brady  <P@draigBrady.com>
 
        fts: avoid a memory leak edge case
index 9b414aaf8b1678ce9d97e6431caabad2bf7d7b95..b276a454585a2a2940a907aeace54ec85cfec139 100644 (file)
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -32,8 +32,6 @@
 #include <string.h>
 #include <sys/types.h>
 
-#include "af_alg.h"
-
 #if USE_UNLOCKED_IO
 # include "unlocked-io.h"
 #endif
@@ -136,6 +134,10 @@ md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
 }
 #endif
 
+#if defined _LIBC || defined GL_COMPILE_CRYPTO_STREAM
+
+#include "af_alg.h"
+
 /* Compute MD5 message digest for bytes read from STREAM.  The
    resulting message digest number will be written into the 16 bytes
    beginning at RESBLOCK.  */
@@ -212,6 +214,7 @@ process_partial_block:
   free (buffer);
   return 0;
 }
+#endif
 
 #if ! HAVE_OPENSSL_MD5
 /* Compute MD5 message digest for LEN bytes beginning at BUFFER.  The
index 847e452b77da7d8958efdf80db80fe8bebffaac9..bb370f3ff4727b50f93dea3ae487fccb7d8b5f92 100644 (file)
@@ -33,8 +33,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "af_alg.h"
-
 #if USE_UNLOCKED_IO
 # include "unlocked-io.h"
 #endif
@@ -124,6 +122,10 @@ sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf)
 }
 #endif
 
+#ifdef GL_COMPILE_CRYPTO_STREAM
+
+#include "af_alg.h"
+
 /* Compute SHA1 message digest for bytes read from STREAM.  The
    resulting message digest number will be written into the 20 bytes
    beginning at RESBLOCK.  */
@@ -200,6 +202,7 @@ sha1_stream (FILE *stream, void *resblock)
   free (buffer);
   return 0;
 }
+#endif
 
 #if ! HAVE_OPENSSL_SHA1
 /* Compute SHA1 message digest for LEN bytes beginning at BUFFER.  The
index 5503c209f79231780746fdce4b06fcd44ad2c420..a036befcafd114c2181b9e99590cd5aed61b50b5 100644 (file)
@@ -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
index 852c43495057502a0d344e0206d7091bcf7fe3c4..e175e705f5210359a44bb47763dd5a2cdec3f585 100644 (file)
@@ -32,8 +32,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "af_alg.h"
-
 #if USE_UNLOCKED_IO
 # include "unlocked-io.h"
 #endif
@@ -179,6 +177,10 @@ sha384_finish_ctx (struct sha512_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.
@@ -272,6 +274,7 @@ sha384_stream (FILE *stream, void *resblock)
   return shaxxx_stream (stream, "sha384", resblock, SHA384_DIGEST_SIZE,
                         sha384_init_ctx, sha384_finish_ctx);
 }
+#endif
 
 #if ! HAVE_OPENSSL_SHA512
 /* Compute SHA512 message digest for LEN bytes beginning at BUFFER.  The
index 7d8b3fa1cdede4ad99715b0dae9c926f8defcf43..4c0e165c03f34fecd04f85b8f2218879789fc7e6 100644 (file)
@@ -2,29 +2,20 @@ Description:
 Compute MD5 checksum.
 
 Files:
-lib/gl_openssl.h
-lib/md5.h
-lib/md5.c
-m4/gl-openssl.m4
-m4/md5.m4
 
 Depends-on:
 crypto/af_alg
-extern-inline
-stdalign
-stdint
+crypto/md5-buffer
 
 configure.ac:
-gl_MD5
+AC_DEFINE([GL_COMPILE_CRYPTO_STREAM], 1, [Compile Gnulib crypto stream ops.])
 
 Makefile.am:
-lib_SOURCES += md5.c
 
 Include:
 "md5.h"
 
 Link:
-$(LIB_CRYPTO)
 
 License:
 LGPLv2+
diff --git a/modules/crypto/md5-buffer b/modules/crypto/md5-buffer
new file mode 100644 (file)
index 0000000..e5fb39c
--- /dev/null
@@ -0,0 +1,32 @@
+Description:
+Compute MD5 checksum.
+
+Files:
+lib/gl_openssl.h
+lib/md5.h
+lib/md5.c
+m4/gl-openssl.m4
+m4/md5.m4
+
+Depends-on:
+extern-inline
+stdalign
+stdint
+
+configure.ac:
+gl_MD5
+
+Makefile.am:
+lib_SOURCES += md5.c
+
+Include:
+"md5.h"
+
+Link:
+$(LIB_CRYPTO)
+
+License:
+LGPLv2+
+
+Maintainer:
+Jim Meyering, glibc
index e9fc83afc8facac19ed00e1232fbf4f84ab93e44..27ca39427a1fbecd49a67c34b5719b2aae73b726 100644 (file)
@@ -2,29 +2,20 @@ Description:
 Compute SHA1 checksum.
 
 Files:
-lib/gl_openssl.h
-lib/sha1.h
-lib/sha1.c
-m4/gl-openssl.m4
-m4/sha1.m4
 
 Depends-on:
 crypto/af_alg
-extern-inline
-stdalign
-stdint
+crypto/sha1-buffer
 
 configure.ac:
-gl_SHA1
+AC_DEFINE([GL_COMPILE_CRYPTO_STREAM], 1, [Compile Gnulib crypto stream ops.])
 
 Makefile.am:
-lib_SOURCES += sha1.c
 
 Include:
 "sha1.h"
 
 Link:
-$(LIB_CRYPTO)
 
 License:
 LGPLv2+
diff --git a/modules/crypto/sha1-buffer b/modules/crypto/sha1-buffer
new file mode 100644 (file)
index 0000000..d65f994
--- /dev/null
@@ -0,0 +1,32 @@
+Description:
+Compute SHA1 checksum.
+
+Files:
+lib/gl_openssl.h
+lib/sha1.h
+lib/sha1.c
+m4/gl-openssl.m4
+m4/sha1.m4
+
+Depends-on:
+extern-inline
+stdalign
+stdint
+
+configure.ac:
+gl_SHA1
+
+Makefile.am:
+lib_SOURCES += sha1.c
+
+Include:
+"sha1.h"
+
+Link:
+$(LIB_CRYPTO)
+
+License:
+LGPLv2+
+
+Maintainer:
+Jim Meyering
index 2343940ccb0e5e9a7f1ba77e8c0a5f52d52f42d1..6a7528015e5490f6d5a1f3cd5129d963e7ee0afb 100644 (file)
@@ -2,29 +2,20 @@ Description:
 Compute SHA224 and SHA256 checksums.
 
 Files:
-lib/gl_openssl.h
-lib/sha256.h
-lib/sha256.c
-m4/gl-openssl.m4
-m4/sha256.m4
 
 Depends-on:
 crypto/af_alg
-extern-inline
-stdalign
-stdint
+crypto/sha256-buffer
 
 configure.ac:
-gl_SHA256
+AC_DEFINE([GL_COMPILE_CRYPTO_STREAM], 1, [Compile Gnulib crypto stream ops.])
 
 Makefile.am:
-lib_SOURCES += sha256.c
 
 Include:
 "sha256.h"
 
 Link:
-$(LIB_CRYPTO)
 
 License:
 LGPLv2+
diff --git a/modules/crypto/sha256-buffer b/modules/crypto/sha256-buffer
new file mode 100644 (file)
index 0000000..37fabfd
--- /dev/null
@@ -0,0 +1,32 @@
+Description:
+Compute SHA224 and SHA256 checksums.
+
+Files:
+lib/gl_openssl.h
+lib/sha256.h
+lib/sha256.c
+m4/gl-openssl.m4
+m4/sha256.m4
+
+Depends-on:
+extern-inline
+stdalign
+stdint
+
+configure.ac:
+gl_SHA256
+
+Makefile.am:
+lib_SOURCES += sha256.c
+
+Include:
+"sha256.h"
+
+Link:
+$(LIB_CRYPTO)
+
+License:
+LGPLv2+
+
+Maintainer:
+Jim Meyering
index 127e67c9247dec95c3cd6eca02d75135b04bab80..da45e816b0e7d2fed48b316d5c1f2b0a58253703 100644 (file)
@@ -2,30 +2,20 @@ Description:
 Compute SHA384 and SHA512 checksums.
 
 Files:
-lib/gl_openssl.h
-lib/sha512.h
-lib/sha512.c
-m4/gl-openssl.m4
-m4/sha512.m4
 
 Depends-on:
 crypto/af_alg
-extern-inline
-stdalign
-stdint
-u64
+crypto/sha512-buffer
 
 configure.ac:
-gl_SHA512
+AC_DEFINE([GL_COMPILE_CRYPTO_STREAM], 1, [Compile Gnulib crypto stream ops.])
 
 Makefile.am:
-lib_SOURCES += sha512.c
 
 Include:
 "sha512.h"
 
 Link:
-$(LIB_CRYPTO)
 
 License:
 LGPLv2+
diff --git a/modules/crypto/sha512-buffer b/modules/crypto/sha512-buffer
new file mode 100644 (file)
index 0000000..4c97604
--- /dev/null
@@ -0,0 +1,33 @@
+Description:
+Compute SHA384 and SHA512 checksums.
+
+Files:
+lib/gl_openssl.h
+lib/sha512.h
+lib/sha512.c
+m4/gl-openssl.m4
+m4/sha512.m4
+
+Depends-on:
+extern-inline
+stdalign
+stdint
+u64
+
+configure.ac:
+gl_SHA512
+
+Makefile.am:
+lib_SOURCES += sha512.c
+
+Include:
+"sha512.h"
+
+Link:
+$(LIB_CRYPTO)
+
+License:
+LGPLv2+
+
+Maintainer:
+Jim Meyering