+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
#include <string.h>
#include <sys/types.h>
-#include "af_alg.h"
-
#if USE_UNLOCKED_IO
# include "unlocked-io.h"
#endif
}
#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. */
free (buffer);
return 0;
}
+#endif
#if ! HAVE_OPENSSL_MD5
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
#include <stdlib.h>
#include <string.h>
-#include "af_alg.h"
-
#if USE_UNLOCKED_IO
# include "unlocked-io.h"
#endif
}
#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. */
free (buffer);
return 0;
}
+#endif
#if ! HAVE_OPENSSL_SHA1
/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The
#include <stdlib.h>
#include <string.h>
-#include "af_alg.h"
-
#if USE_UNLOCKED_IO
# include "unlocked-io.h"
#endif
}
#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.
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
#include <stdlib.h>
#include <string.h>
-#include "af_alg.h"
-
#if USE_UNLOCKED_IO
# include "unlocked-io.h"
#endif
}
#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.
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
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+
--- /dev/null
+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
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+
--- /dev/null
+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
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+
--- /dev/null
+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
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+
--- /dev/null
+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