From: Chris Hanson Date: Thu, 8 Mar 2001 06:28:54 +0000 (+0000) Subject: Add support for loading crypto code as shared libraries. This allows X-Git-Tag: 20090517-FFI~2929 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=15c6b802f965d86f805603fb395ae050b2e7baef;p=mit-scheme.git Add support for loading crypto code as shared libraries. This allows a package to be distributed that will work even if the target machine doesn't have the required libraries installed. It also allows us to leave MIT Scheme in Debian's "main" section while still providing crypto support. --- diff --git a/v7/src/microcode/configure.in b/v7/src/microcode/configure.in index 882d78b9b..cf18a3cfc 100644 --- a/v7/src/microcode/configure.in +++ b/v7/src/microcode/configure.in @@ -16,13 +16,15 @@ dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -AC_REVISION([$Id: configure.in,v 11.7 2001/03/03 05:17:32 cph Exp $]) +AC_REVISION([$Id: configure.in,v 11.8 2001/03/08 06:27:58 cph Exp $]) AC_INIT(boot.c) AC_CONFIG_HEADER(config.h) dnl Feature options. AC_ARG_ENABLE(static-libs, [ --enable-static-libs Link some libraries statically [no]]) +AC_ARG_ENABLE(dynamic-crypto, +[ --enable-dynamic-crypto Link crypto primitives dynamically [yes]]) AC_ARG_WITH(openssl, [ --with-openssl Use the OpenSSL crypto library if available [yes]]) AC_ARG_WITH(mhash, @@ -42,6 +44,11 @@ STATIC_LIBS= QUASI_STATIC_LIBS= STATIC_PREFIX= STATIC_SUFFIX= +CRYPTO_TARGETS= +PRBFISH_LIBS= +PRMD5_LIBS= +SCHEME_DEFS= +DLD_LDFLAGS= dnl Checks for programs. AC_PROG_CC @@ -92,6 +99,9 @@ AC_CHECK_LIB(termcap, tparam, if test "${ac_cv_lib_dl_dlopen}" = "yes"; then OPTIONAL_BASES="${OPTIONAL_BASES} pruxdld" + enable_dynamic_crypto="${enable_dynamic_crypto:-yes}" +else + enable_dynamic_crypto=no fi dnl OK, now some complex logic to handle the crypto stuff. @@ -101,27 +111,41 @@ test "${with_openssl:-yes}" = "no" && scheme_cv_lib_crypto=no test "${with_mhash:-yes}" = "no" && scheme_cv_lib_mhash=no test "${with_mcrypt:-yes}" = "no" && scheme_cv_lib_mcrypt=no +if test "${enable_dynamic_crypto}" = "yes"; then + SCHEME_DEFS="${SCHEME_DEFS} -DCRYPTO_MODULES" +fi + dnl Next, we decide which libraries to use. We mostly want support dnl for Blowfish and MD5, each of which can come from multiple libraries. -have_blowfish=no -have_md5=no +HAVE_BLOWFISH=no +HAVE_MD5=no dnl The OpenSSL crypto library provides support for both, and is preferred. if test "${scheme_cv_lib_crypto}" = "yes"; then AC_DEFINE(HAVE_LIBCRYPTO) - QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lcrypto" - OPTIONAL_BASES="${OPTIONAL_BASES} prbfish prmd5" - have_blowfish=yes - have_md5=yes + if test "${enable_dynamic_crypto}" = "yes"; then + CRYPTO_TARGETS="${CRYPTO_TARGETS} prbfish.so prmd5.so" + PRBFISH_LIBS="-lcrypto" + PRMD5_LIBS="-lcrypto" + else + QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lcrypto" + OPTIONAL_BASES="${OPTIONAL_BASES} prbfish prmd5" + fi + HAVE_BLOWFISH=yes + HAVE_MD5=yes fi dnl The mhash library provides md5 support. It can be loaded in addition dnl to other MD5 libraries and provides a rich set of hashes. if test "${scheme_cv_lib_mhash}" = "yes"; then AC_DEFINE(HAVE_LIBMHASH) - QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lmhash" - OPTIONAL_BASES="${OPTIONAL_BASES} prmhash" - have_md5=yes + if test "${enable_dynamic_crypto}" = "yes"; then + CRYPTO_TARGETS="${CRYPTO_TARGETS} prmhash.so" + else + QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lmhash" + OPTIONAL_BASES="${OPTIONAL_BASES} prmhash" + fi + HAVE_MD5=yes fi dnl The mcrypt library provides blowfish, but its CFB mode is 8 bit. @@ -129,31 +153,46 @@ dnl We have been using 64-bit CFB, so this isn't really compatible. dnl But mcrypt provides many ciphers and can be loaded in addition. if test "${scheme_cv_lib_mcrypt}" = "yes"; then AC_DEFINE(HAVE_LIBMCRYPT) - QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lmcrypt -lltdl" - OPTIONAL_BASES="${OPTIONAL_BASES} prmcrypt" + if test "${enable_dynamic_crypto}" = "yes"; then + CRYPTO_TARGETS="${CRYPTO_TARGETS} prmcrypt.so" + else + QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lmcrypt -lltdl" + OPTIONAL_BASES="${OPTIONAL_BASES} prmcrypt" + fi fi dnl This is a stripped-down library that provides just Blowfish. It dnl seems to be code that was extracted from OpenSSL long ago. We dnl used this for a long time but no longer do. -if test "${have_blowfish}" = "no"; then +if test "${HAVE_BLOWFISH}" = "no"; then if test "${scheme_cv_lib_blowfish}" = "yes"; then AC_DEFINE(HAVE_LIBBLOWFISH) - STATIC_LIBS="${STATIC_LIBS} -lblowfish" - OPTIONAL_BASES="${OPTIONAL_BASES} prbfish" + if test "${enable_dynamic_crypto}" = "yes"; then + CRYPTO_TARGETS="${CRYPTO_TARGETS} prbfish.so" + PRBFISH_LIBS="-lblowfish" + else + STATIC_LIBS="${STATIC_LIBS} -lblowfish" + OPTIONAL_BASES="${OPTIONAL_BASES} prbfish" + fi fi fi dnl This is Phil Karn's MD5 implementation, which seems to have nearly dnl the same interface as that of OpenSSL. -if test "${have_md5}" = "no"; then +if test "${HAVE_MD5}" = "no"; then if test "${scheme_cv_lib_md5}" = "yes"; then AC_DEFINE(HAVE_LIBMD5) - STATIC_LIBS="${STATIC_LIBS} -lmd5" - OPTIONAL_BASES="${OPTIONAL_BASES} prmd5" + if test "${enable_dynamic_crypto}" = "yes"; then + CRYPTO_TARGETS="${CRYPTO_TARGETS} prmd5.so" + PRMD5_LIBS="-lmd5" + else + STATIC_LIBS="${STATIC_LIBS} -lmd5" + OPTIONAL_BASES="${OPTIONAL_BASES} prmd5" + fi fi fi + if test "${scheme_cv_lib_gdbm}" = "yes"; then AC_DEFINE(HAVE_LIBGDBM) QUASI_STATIC_LIBS="${QUASI_STATIC_LIBS} -lgdbm" @@ -458,6 +497,7 @@ linux-gnu) STATIC_PREFIX="-Xlinker -Bstatic" STATIC_SUFFIX="-Xlinker -Bdynamic" fi + DLD_LDFLAGS="-export-dynamic" AC_MSG_CHECKING([for ELF binaries]) AC_TRY_RUN( [int @@ -549,5 +589,10 @@ AC_SUBST(OPTIONAL_SOURCES) AC_SUBST(STATIC_LIBS) AC_SUBST(STATIC_PREFIX) AC_SUBST(STATIC_SUFFIX) +AC_SUBST(CRYPTO_TARGETS) +AC_SUBST(PRBFISH_LIBS) +AC_SUBST(PRMD5_LIBS) +AC_SUBST(SCHEME_DEFS) +AC_SUBST(DLD_LDFLAGS) AC_OUTPUT(Makefile) diff --git a/v7/src/microcode/makegen/Makefile.in.in b/v7/src/microcode/makegen/Makefile.in.in index 70a354741..72b49702d 100644 --- a/v7/src/microcode/makegen/Makefile.in.in +++ b/v7/src/microcode/makegen/Makefile.in.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in.in,v 1.13 2000/12/08 19:07:28 cph Exp $ +# $Id: Makefile.in.in,v 1.14 2001/03/08 06:28:54 cph Exp $ # -# Copyright (c) 2000 Massachusetts Institute of Technology +# Copyright (c) 2000-2001 Massachusetts Institute of Technology # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -65,7 +65,7 @@ TAR = tar GZIP_ENV = --best DEFS = -DMIT_SCHEME -DDEFAULT_LIBRARY_PATH=\"$(AUXDIR)\" @DEFS@ \ - -I. -I$(srcdir) -I. + @SCHEME_DEFS@ -I. -I$(srcdir) -I. CFLAGS = @CFLAGS@ X_CFLAGS = @X_CFLAGS@ CPPFLAGS = @CPPFLAGS@ @@ -86,9 +86,10 @@ GC_HEAD_FILES = @GC_HEAD_FILES@ OPTIONAL_SOURCES = @OPTIONAL_SOURCES@ OPTIONAL_OBJECTS = @OPTIONAL_OBJECTS@ STATIC_LIBS = @STATIC_PREFIX@ @STATIC_LIBS@ @STATIC_SUFFIX@ -STATIC_PREFIX = @STATIC_PREFIX@ -STATIC_SUFFIX = @STATIC_SUFFIX@ X_LIBS = @X_PRE_LIBS@ @LIB_X11@ @X_EXTRA_LIBS@ +CRYPTO_TARGETS = @CRYPTO_TARGETS@ +PRBFISH_LIBS = @PRBFISH_LIBS@ +PRMD5_LIBS = @PRMD5_LIBS@ # **** Non-configured files **** @@ -114,19 +115,20 @@ SHARED_OBJECTS = $(CORE_OBJECTS) $(OS_PRIM_OBJECTS) $(UNIX_OBJECTS) \ bin_PROGRAMS = scheme bchscheme aux_PROGRAMS = gcdrone +aux_LIBS = $(CRYPTO_TARGETS) aux_DATA = utabmd.bin EXTRA_PROGRAMS = findprim bintopsb psbtobin scheme_SOURCES = $(SHARED_SOURCES) $(STD_GC_SOURCES) usrdef.c scheme_OBJECTS = $(SHARED_OBJECTS) $(STD_GC_OBJECTS) usrdef.o scheme_DEPENDENCIES = -scheme_LDFLAGS = @X_LIBS@ +scheme_LDFLAGS = @X_LIBS@ @DLD_LDFLAGS@ scheme_LIBS = $(STATIC_LIBS) $(X_LIBS) $(LIBS) bchscheme_SOURCES = $(SHARED_SOURCES) $(BCH_GC_SOURCES) bchdef.c bchscheme_OBJECTS = $(SHARED_OBJECTS) $(BCH_GC_OBJECTS) bchdef.o bchscheme_DEPENDENCIES = -bchscheme_LDFLAGS = @X_LIBS@ +bchscheme_LDFLAGS = @X_LIBS@ @DLD_LDFLAGS@ bchscheme_LIBS = $(STATIC_LIBS) $(X_LIBS) $(LIBS) bchdrn_SOURCES = bchdrn.c bchutl.c @@ -154,11 +156,12 @@ psbtobin_LDFLAGS = psbtobin_LIBS = $(LIBS) ALL_PROGRAMS = $(bin_PROGRAMS) $(aux_PROGRAMS) +ALL_LIBS = $(aux_LIBS) ALL_DATA = $(aux_DATA) MOSTLYCLEAN_FILES = *.o cmpauxmd.s usrdef.c bchdef.c -CLEAN_FILES = $(ALL_PROGRAMS) $(ALL_DATA) $(EXTRA_PROGRAMS) +CLEAN_FILES = $(ALL_PROGRAMS) $(ALL_LIBS) $(ALL_DATA) $(EXTRA_PROGRAMS) DISTCLEAN_FILES = Makefile config.h config.cache config.log config.status \ cmpauxmd.m4 cmpintmd.h TAGS @@ -181,7 +184,7 @@ MAINTAINER_CLEAN_FILES = Makefile.in Makefile.deps config.h.in configure # **** Main rules **** -all: $(ALL_PROGRAMS) $(ALL_DATA) +all: $(ALL_PROGRAMS) $(ALL_LIBS) $(ALL_DATA) scheme: $(scheme_OBJECTS) $(scheme_DEPENDENCIES) -rm -f $@ @@ -218,6 +221,18 @@ psbtobin: $(psbtobin_OBJECTS) $(psbtobin_DEPENDENCIES) utabmd.bin: utabmd.scm scheme -compiler -eval '(sf "utabmd")' < /dev/null +prbfish.so: prbfish.o + ld -shared -o $@ $^ $(PRBFISH_LIBS) + +prmd5.so: prmd5.o + ld -shared -o $@ $^ $(PRMD5_LIBS) + +prmhash.so: prmhash.o + ld -shared -o $@ $^ -lmhash + +prmcrypt.so: prmcrypt.o + ld -shared -o $@ $^ -lmcrypt -lltdl + tags: TAGS TAGS: etags -r '/^DEF[A-Za-z_ \t(]+"\([^"]+\)"/' *.[ch] @@ -235,7 +250,8 @@ maintainer-clean: distclean -rm -f $(MAINTAINER_CLEAN_FILES) ( cd cmpauxmd && $(MAKE) $@ ) -install: install-binPROGRAMS install-auxPROGRAMS install-auxDATA +install: install-binPROGRAMS install-auxPROGRAMS install-auxLIBS \ + install-auxDATA install-binPROGRAMS: $(bin_PROGRAMS) $(mkinstalldirs) $(DESTDIR)$(bindir) @@ -257,6 +273,16 @@ install-auxPROGRAMS: $(aux_PROGRAMS) fi; \ done +install-auxLIBS: $(aux_LIBS) + $(mkinstalldirs) $(DESTDIR)$(AUXDIR)/lib + @list='$(aux_LIBS)'; \ + for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_LIBS) $$p $(DESTDIR)$(AUXDIR)/lib/."; \ + $(INSTALL_LIBS) $$p $(DESTDIR)$(AUXDIR)/lib/.; \ + fi; \ + done + install-auxDATA: $(aux_DATA) $(mkinstalldirs) $(DESTDIR)$(AUXDIR) @list='$(aux_DATA)'; \ diff --git a/v7/src/microcode/prbfish.c b/v7/src/microcode/prbfish.c index 1e179abb8..ba920be45 100644 --- a/v7/src/microcode/prbfish.c +++ b/v7/src/microcode/prbfish.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: prbfish.c,v 1.10 2001/03/01 04:25:54 cph Exp $ +$Id: prbfish.c,v 1.11 2001/03/08 06:28:22 cph Exp $ Copyright (c) 1997-2001 Massachusetts Institute of Technology @@ -229,3 +229,66 @@ Returned value is the new value of NUM.") (&num)); PRIMITIVE_RETURN (long_to_integer (num)); } + +#ifdef CRYPTO_MODULES + +char * +DEFUN_VOID (dload_initialize_file) +{ + declare_primitive + ("BLOWFISH-SET-KEY", Prim_blowfish_set_key, 1, 1, + "(STRING)\n\ +Generate a Blowfish key from STRING.\n\ +STRING must be 72 bytes or less in length.\n\ +For text-string keys, use MD5 on the text, and pass the digest here."); + declare_primitive + ("BLOWFISH-ECB", Prim_blowfish_ecb, 4, 4, + "(INPUT OUTPUT KEY-VECTOR ENCRYPT?)\n\ +Apply Blowfish in Electronic Code Book mode.\n\ +INPUT is an 8-byte string.\n\ +OUTPUT is an 8-byte string.\n\ +KEY is a Blowfish key.\n\ +ENCRYPT? says whether to encrypt (#T) or decrypt (#F)."); + declare_primitive + ("BLOWFISH-CBC-V2", Prim_blowfish_cbc, 5, 5, + "(INPUT OUTPUT KEY INIT-VECTOR ENCRYPT?)\n\ +Apply Blowfish in Cipher Block Chaining mode.\n\ +INPUT is a string whose length is a multiple of 8 bytes.\n\ +OUTPUT is a string whose length is the same as INPUT.\n\ +KEY is a Blowfish key.\n\ +INIT-VECTOR is an 8-byte string; it is modified after each call.\n\ + The value from any call may be passed in to a later call.\n\ +ENCRYPT? says whether to encrypt (#T) or decrypt (#F)."); + declare_primitive + ("BLOWFISH-CFB64-SUBSTRING-V2", Prim_blowfish_cfb64_substring, 9, 9, + "(INPUT ISTART IEND OUTPUT OSTART KEY INIT-VECTOR NUM ENCRYPT?)\n\ +Apply Blowfish in Cipher Feed-Back mode.\n\ +\(INPUT,ISTART,IEND) is an arbitrary substring.\n\ +OUTPUT is a string as large as the input substring.\n\ +OSTART says where to start writing to the output string.\n\ +KEY is a Blowfish key.\n\ +INIT-VECTOR is an 8-byte string; it is modified after each call.\n\ + The value from any call may be passed in to a later call.\n\ + The initial value must be unique for each message/key pair.\n\ +NUM is a digit from 0 to 7 inclusive; it is the low 3 bits of the\n\ + number of bytes that have previously been processed in this stream.\n\ +ENCRYPT? says whether to encrypt (#T) or decrypt (#F).\n\ +Returned value is the new value of NUM."); + declare_primitive + ("BLOWFISH-OFB64-SUBSTRING", Prim_blowfish_ofb64_substring, 8, 8, + "(INPUT ISTART IEND OUTPUT OSTART KEY INIT-VECTOR NUM)\n\ +Apply Blowfish in Output Feed-Back mode.\n\ +(INPUT,ISTART,IEND) is an arbitrary substring.\n\ +OUTPUT is a string as large as the input substring.\n\ +OSTART says where to start writing to the output string.\n\ +KEY is a Blowfish key.\n\ +INIT-VECTOR is an 8-byte string; it is modified after each call.\n\ + The value from any call may be passed in to a later call.\n\ + The initial value must be unique for each message/key pair.\n\ +NUM is a digit from 0 to 7 inclusive; it is the low 3 bits of the\n\ + number of bytes that have previously been processed in this stream.\n\ +Returned value is the new value of NUM."); + return "#prbfish"; +} + +#endif diff --git a/v7/src/microcode/prmcrypt.c b/v7/src/microcode/prmcrypt.c index 884414ae1..aab84d22b 100644 --- a/v7/src/microcode/prmcrypt.c +++ b/v7/src/microcode/prmcrypt.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: prmcrypt.c,v 1.1 2001/02/28 21:42:01 cph Exp $ +$Id: prmcrypt.c,v 1.2 2001/03/08 06:28:24 cph Exp $ Copyright (c) 2001 Massachusetts Institute of Technology @@ -329,3 +329,59 @@ DEFINE_PRIMITIVE ("MCRYPT_MODULE_GET_ALGO_SUPPORTED_KEY_SIZES", Prim_mcrypt_modu PRIMITIVE_RETURN (convert_key_sizes (sizes, n_sizes)); } } + +#ifdef CRYPTO_MODULES + +char * +DEFUN_VOID (dload_initialize_file) +{ + declare_primitive + ("MCRYPT_MODULE_OPEN", Prim_mcrypt_module_open, 2, 2, 0); + declare_primitive + ("MCRYPT_GENERIC_INIT", Prim_mcrypt_generic_init, 3, 3, 0); + declare_primitive + ("MCRYPT_GENERIC", Prim_mcrypt_generic, 4, 4, 0); + declare_primitive + ("MDECRYPT_GENERIC", Prim_mdecrypt_generic, 4, 4, 0); + declare_primitive + ("MCRYPT_GENERIC_END", Prim_mcrypt_generic_end, 1, 1, 0); + declare_primitive + ("MCRYPT_ENC_SELF_TEST", Prim_mcrypt_enc_self_test, 1, 1, 0); + declare_primitive + ("MCRYPT_ENC_IS_BLOCK_ALGORITHM_MODE", Prim_mcrypt_enc_is_block_algorithm_mode, 1, 1, 0); + declare_primitive + ("MCRYPT_ENC_IS_BLOCK_ALGORITHM", Prim_mcrypt_enc_is_block_algorithm, 1, 1, 0); + declare_primitive + ("MCRYPT_ENC_IS_BLOCK_MODE", Prim_mcrypt_enc_is_block_mode, 1, 1, 0); + declare_primitive + ("MCRYPT_ENC_GET_KEY_SIZE", Prim_mcrypt_enc_get_key_size, 1, 1, 0); + declare_primitive + ("MCRYPT_ENC_GET_IV_SIZE", Prim_mcrypt_enc_get_iv_size, 1, 1, 0); + declare_primitive + ("MCRYPT_ENC_GET_ALGORITHMS_NAME", Prim_mcrypt_enc_get_algorithms_name, 1, 1, 0); + declare_primitive + ("MCRYPT_ENC_GET_MODES_NAME", Prim_mcrypt_enc_get_modes_name, 1, 1, 0); + declare_primitive + ("MCRYPT_MODULE_SELF_TEST", Prim_mcrypt_module_self_test, 1, 1, 0); + declare_primitive + ("MCRYPT_MODULE_IS_BLOCK_ALGORITHM_MODE", Prim_mcrypt_module_is_block_algorithm_mode, 1, 1, 0); + declare_primitive + ("MCRYPT_MODULE_IS_BLOCK_ALGORITHM", Prim_mcrypt_module_is_block_algorithm, 1, 1, 0); + declare_primitive + ("MCRYPT_MODULE_IS_BLOCK_MODE", Prim_mcrypt_module_is_block_mode, 1, 1, 0); + declare_primitive + ("MCRYPT_MODULE_GET_ALGO_BLOCK_SIZE", Prim_mcrypt_module_get_algo_block_size, 1, 1, 0); + declare_primitive + ("MCRYPT_MODULE_GET_ALGO_KEY_SIZE", Prim_mcrypt_module_get_algo_key_size, 1, 1, 0); + declare_primitive + ("MCRYPT_LIST_ALGORITHMS", Prim_mcrypt_list_algorithms, 0, 0, 0); + declare_primitive + ("MCRYPT_LIST_MODES", Prim_mcrypt_list_modes, 0, 0, 0); + declare_primitive + ("MCRYPT_ENC_GET_SUPPORTED_KEY_SIZES", Prim_mcrypt_enc_get_supported_key_sizes, 1, 1, 0); + declare_primitive + ("MCRYPT_MODULE_GET_ALGO_SUPPORTED_KEY_SIZES", Prim_mcrypt_module_get_algo_supported_key_sizes, 1, 1, 0); + return "#prmcrypt"; +} + +#endif diff --git a/v7/src/microcode/prmd5.c b/v7/src/microcode/prmd5.c index 6830d1448..ddbf1e651 100644 --- a/v7/src/microcode/prmd5.c +++ b/v7/src/microcode/prmd5.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: prmd5.c,v 1.5 2001/03/01 04:25:57 cph Exp $ +$Id: prmd5.c,v 1.6 2001/03/08 06:28:28 cph Exp $ Copyright (c) 1997-2001 Massachusetts Institute of Technology @@ -144,3 +144,33 @@ Finalize CONTEXT and return the digest as a 16-byte string.") } } } + +#ifdef CRYPTO_MODULES + +char * +DEFUN_VOID (dload_initialize_file) +{ + declare_primitive + ("MD5", Prim_md5, 1, 1, + "(STRING)\n\ +Generate an MD5 digest of string.\n\ +The digest is returned as a 16-byte string."); + + declare_primitive + ("MD5-INIT", Prim_md5_init, 0, 0, + "()\n\ +Create and return an MD5 digest context."); + + declare_primitive + ("MD5-UPDATE", Prim_md5_update, 4, 4, + "(CONTEXT STRING START END)\n\ +Update CONTEXT with the contents of the substring (STRING,START,END)."); + + declare_primitive + ("MD5-FINAL", Prim_md5_final, 1, 1, + "(CONTEXT)\n\ +Finalize CONTEXT and return the digest as a 16-byte string."); + return "#prmd5"; +} + +#endif diff --git a/v7/src/microcode/prmhash.c b/v7/src/microcode/prmhash.c index 21773aa28..5db733ace 100644 --- a/v7/src/microcode/prmhash.c +++ b/v7/src/microcode/prmhash.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: prmhash.c,v 11.1 2000/04/10 02:52:53 cph Exp $ +$Id: prmhash.c,v 11.2 2001/03/08 06:28:31 cph Exp $ -Copyright (c) 2000 Massachusetts Institute of Technology +Copyright (c) 2000-2001 Massachusetts Institute of Technology This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -369,3 +369,47 @@ DEFINE_PRIMITIVE ("MHASH_KEYGEN", Prim_mhash_keygen, 4, 4, 0) == 0)); } } + +#ifdef CRYPTO_MODULES + +char * +DEFUN_VOID (dload_initialize_file) +{ + declare_primitive + ("MHASH_COUNT", Prim_mhash_count, 0, 0, 0); + declare_primitive + ("MHASH_GET_BLOCK_SIZE", Prim_mhash_get_block_size, 1, 1, 0); + declare_primitive + ("MHASH_GET_HASH_PBLOCK", Prim_mhash_get_hash_pblock, 1, 1, 0); + declare_primitive + ("MHASH_GET_HASH_NAME", Prim_mhash_get_hash_name, 1, 1, 0); + declare_primitive + ("MHASH_INIT", Prim_mhash_init, 1, 1, 0); + declare_primitive + ("MHASH_HMAC_INIT", Prim_mhash_hmac_init, 3, 3, 0); + declare_primitive + ("MHASH", Prim_mhash, 4, 4, 0); + declare_primitive + ("MHASH_END", Prim_mhash_end, 1, 1, 0); + declare_primitive + ("MHASH_HMAC_END", Prim_mhash_hmac_end, 1, 1, 0); + declare_primitive + ("MHASH_KEYGEN_COUNT", Prim_mhash_keygen_count, 0, 0, 0); + declare_primitive + ("MHASH_GET_KEYGEN_NAME", Prim_mhash_get_keygen_name, 1, 1, 0); + declare_primitive + ("MHASH_KEYGEN_USES_SALT", Prim_mhash_keygen_uses_salt, 1, 1, 0); + declare_primitive + ("MHASH_KEYGEN_USES_COUNT", Prim_mhash_keygen_uses_count, 1, 1, 0); + declare_primitive + ("MHASH_KEYGEN_USES_HASH_ALGORITHM", Prim_mhash_keygen_uses_hash_algorithm, 1, 1, 0); + declare_primitive + ("MHASH_GET_KEYGEN_SALT_SIZE", Prim_mhash_get_keygen_salt_size, 1, 1, 0); + declare_primitive + ("MHASH_GET_KEYGEN_MAX_KEY_SIZE", Prim_mhash_get_keygen_max_key_size, 1, 1, 0); + declare_primitive + ("MHASH_KEYGEN", Prim_mhash_keygen, 4, 4, 0); + return "#prmd5"; +} + +#endif diff --git a/v7/src/microcode/version.h b/v7/src/microcode/version.h index c73b2fc51..d4fc7e9cb 100644 --- a/v7/src/microcode/version.h +++ b/v7/src/microcode/version.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: version.h,v 11.178 2001/02/28 20:03:03 cph Exp $ +$Id: version.h,v 11.179 2001/03/08 06:28:34 cph Exp $ Copyright (c) 1988-2001 Massachusetts Institute of Technology @@ -24,7 +24,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. /* Scheme system release version */ #ifndef SCHEME_RELEASE -#define SCHEME_RELEASE "7.5.14" +#define SCHEME_RELEASE "7.5.15" #endif /* Microcode release version */ @@ -33,5 +33,5 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #define SCHEME_VERSION 14 #endif #ifndef SCHEME_SUBVERSION -#define SCHEME_SUBVERSION 2 +#define SCHEME_SUBVERSION 3 #endif