提交 354c3ace 编写于 作者: B Ben Laurie

Add first cut symmetric crypto support.

上级 52129c0b
......@@ -12,6 +12,9 @@
*) applies to 0.9.6a/0.9.6b/0.9.6c and 0.9.7
+) applies to 0.9.7 only
+) Add symmetric cipher support to ENGINE. Expect the API to change!
[Ben Laurie]
+) New CRL functions: X509_CRL_set_version(), X509_CRL_set_issuer_name()
X509_CRL_set_lastUpdate(), X509_CRL_set_nextUpdate(), X509_CRL_sort(),
X509_REVOKED_set_serialNumber(), and X509_REVOKED_set_revocationDate().
......
Output of `Configure TABLE':
*** BC-16
$cc = bcc
......@@ -70,7 +71,7 @@ $ranlib =
*** CygWin32
$cc = gcc
$cflags = -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall
$cflags = -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -mcpu=i486 -Wall
$unistd =
$thread_cflag =
$sys_id = CYGWIN32
......@@ -93,7 +94,7 @@ $ranlib =
*** FreeBSD
$cc = gcc
$cflags = -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall
$cflags = -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -mcpu=i486 -Wall
$unistd =
$thread_cflag = (unknown)
$sys_id =
......@@ -139,7 +140,7 @@ $ranlib =
*** FreeBSD-elf
$cc = gcc
$cflags = -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall
$cflags = -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -mcpu=i486 -Wall
$unistd =
$thread_cflag = -pthread -D_REENTRANT -D_THREAD_SAFE -D_THREADSAFE
$sys_id =
......@@ -185,7 +186,7 @@ $ranlib =
*** Mingw32
$cc = gcc
$cflags = -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall
$cflags = -DL_ENDIAN -fomit-frame-pointer -O3 -mcpu=i486 -Wall
$unistd =
$thread_cflag =
$sys_id =
......@@ -254,7 +255,7 @@ $ranlib =
*** NetBSD-x86
$cc = gcc
$cflags = -DTERMIOS -O3 -fomit-frame-pointer -m486 -Wall
$cflags = -DTERMIOS -O3 -fomit-frame-pointer -mcpu=i486 -Wall
$unistd =
$thread_cflag = (unknown)
$sys_id =
......@@ -369,7 +370,7 @@ $ranlib =
*** OpenBSD-x86
$cc = gcc
$cflags = -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -m486
$cflags = -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -mcpu=i486
$unistd =
$thread_cflag = (unknown)
$sys_id =
......@@ -691,12 +692,12 @@ $ranlib =
*** alpha-cc
$cc = cc
$cflags = -std1 -tune host -O4 -readonly_strings
$cflags = -std1 -tune host -fast -readonly_strings
$unistd =
$thread_cflag = (unknown)
$thread_cflag = -pthread
$sys_id =
$lflags =
$bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHUNK
$lflags = SIXTY_FOUR_BIT_LONG RC4_CHUNK
$bn_ops =
$bn_obj =
$des_obj =
$bf_obj =
......@@ -705,11 +706,34 @@ $sha1_obj =
$cast_obj =
$rc4_obj =
$rmd160_obj =
$rc5_obj =
$dso_scheme = dlfcn
$shared_target= tru64-shared
$shared_cflag =
$shared_extension = .so
$rc5_obj = dlfcn
$dso_scheme = tru64-shared
$shared_target=
$shared_cflag = .so
$shared_extension =
$ranlib =
*** alpha-cc-rpath
$cc = cc
$cflags = -std1 -tune host -fast -readonly_strings
$unistd =
$thread_cflag = -pthread
$sys_id =
$lflags = SIXTY_FOUR_BIT_LONG RC4_CHUNK
$bn_ops =
$bn_obj =
$des_obj =
$bf_obj =
$md5_obj =
$sha1_obj =
$cast_obj =
$rc4_obj =
$rmd160_obj =
$rc5_obj = dlfcn
$dso_scheme = tru64-shared-rpath
$shared_target=
$shared_cflag = .so
$shared_extension =
$ranlib =
*** alpha-gcc
......@@ -718,8 +742,8 @@ $cflags = -O3
$unistd =
$thread_cflag = (unknown)
$sys_id =
$lflags =
$bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_RISC1
$lflags = SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_RISC1
$bn_ops =
$bn_obj =
$des_obj =
$bf_obj =
......@@ -728,21 +752,44 @@ $sha1_obj =
$cast_obj =
$rc4_obj =
$rmd160_obj =
$rc5_obj =
$dso_scheme = dlfcn
$shared_target= tru64-shared
$shared_cflag =
$shared_extension = .so
$rc5_obj = dlfcn
$dso_scheme = alpha-osf1-shared
$shared_target=
$shared_cflag = .so
$shared_extension =
$ranlib =
*** alpha164-cc
$cc = cc
$cflags = -std1 -tune host -fast -readonly_strings
$unistd =
$thread_cflag = -pthread
$sys_id =
$lflags = SIXTY_FOUR_BIT_LONG RC4_CHUNK
$bn_ops =
$bn_obj =
$des_obj =
$bf_obj =
$md5_obj =
$sha1_obj =
$cast_obj =
$rc4_obj =
$rmd160_obj =
$rc5_obj = dlfcn
$dso_scheme = tru64-shared
$shared_target=
$shared_cflag = .so
$shared_extension =
$ranlib =
*** alphaold-cc
$cc = cc
$cflags = -std1 -tune host -O4 -readonly_strings
$unistd =
$thread_cflag = (unknown)
$sys_id =
$lflags =
$bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHUNK
$lflags = SIXTY_FOUR_BIT_LONG RC4_CHUNK
$bn_ops =
$bn_obj =
$des_obj =
$bf_obj =
......@@ -751,16 +798,16 @@ $sha1_obj =
$cast_obj =
$rc4_obj =
$rmd160_obj =
$rc5_obj =
$dso_scheme = dlfcn
$shared_target= tru64-shared
$shared_cflag =
$shared_extension = .so
$rc5_obj = dlfcn
$dso_scheme = alpha-osf1-shared
$shared_target=
$shared_cflag = .so
$shared_extension =
$ranlib =
*** bsdi-elf-gcc
$cc = gcc
$cflags = -DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall
$cflags = -DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -mcpu=i486 -Wall
$unistd =
$thread_cflag = (unknown)
$sys_id =
......@@ -783,7 +830,7 @@ $ranlib =
*** bsdi-gcc
$cc = gcc
$cflags = -O3 -ffast-math -DL_ENDIAN -DPERL5 -m486
$cflags = -O3 -ffast-math -DL_ENDIAN -DPERL5 -mcpu=i486
$unistd =
$thread_cflag = (unknown)
$sys_id =
......@@ -1036,7 +1083,7 @@ $ranlib =
*** debug-bodo
$cc = gcc
$cflags = -DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -m486 -pedantic -Wshadow -Wall
$cflags = -DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -mcpu=i486 -pedantic -Wshadow -Wall
$unistd =
$thread_cflag = -D_REENTRANT
$sys_id =
......@@ -1059,7 +1106,7 @@ $ranlib =
*** debug-levitte-linux-elf
$cc = gcc
$cflags = -DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -m486 -pedantic -ansi -Wall -Wshadow -Wid-clash-31 -Wno-long-long -pipe
$cflags = -DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wid-clash-31 -Wno-long-long -pipe
$unistd =
$thread_cflag = -D_REENTRANT
$sys_id =
......@@ -1082,7 +1129,7 @@ $ranlib =
*** debug-levitte-linux-noasm
$cc = gcc
$cflags = -DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -m486 -pedantic -ansi -Wall -Wshadow -Wid-clash-31 -Wno-long-long -pipe
$cflags = -DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wid-clash-31 -Wno-long-long -pipe
$unistd =
$thread_cflag = -D_REENTRANT
$sys_id =
......@@ -1105,7 +1152,7 @@ $ranlib =
*** debug-linux-elf
$cc = gcc
$cflags = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall
$cflags = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=i486 -Wall
$unistd =
$thread_cflag = -D_REENTRANT
$sys_id =
......@@ -1128,7 +1175,7 @@ $ranlib =
*** debug-linux-elf-noefence
$cc = gcc
$cflags = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall
$cflags = -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=i486 -Wall
$unistd =
$thread_cflag = -D_REENTRANT
$sys_id =
......@@ -1266,7 +1313,7 @@ $ranlib =
*** debug-steve
$cc = gcc
$cflags = -DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -g -m486 -pedantic -Wall -Werror -Wshadow -pipe
$cflags = -DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -g -mcpu=i486 -pedantic -Wall -Werror -Wshadow -pipe
$unistd =
$thread_cflag = -D_REENTRANT
$sys_id =
......@@ -1289,7 +1336,7 @@ $ranlib =
*** debug-ulf
$cc = gcc
$cflags = -DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -g -O2 -m486 -Wall -Werror -Wshadow -pipe
$cflags = -DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -g -O2 -mcpu=i486 -Wall -Werror -Wshadow -pipe
$unistd =
$thread_cflag = -D_REENTRANT
$sys_id =
......@@ -1818,7 +1865,7 @@ $ranlib =
*** hurd-x86
$cc = gcc
$cflags = -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -m486 -Wall
$cflags = -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -mcpu=i486 -Wall
$unistd =
$thread_cflag = -D_REENTRANT
$sys_id =
......@@ -2071,7 +2118,7 @@ $ranlib =
*** linux-aout
$cc = gcc
$cflags = -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall
$cflags = -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -mcpu=i486 -Wall
$unistd =
$thread_cflag = (unknown)
$sys_id =
......@@ -2094,7 +2141,7 @@ $ranlib =
*** linux-elf
$cc = gcc
$cflags = -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall
$cflags = -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -mcpu=i486 -Wall
$unistd =
$thread_cflag = -D_REENTRANT
$sys_id =
......@@ -2807,7 +2854,7 @@ $ranlib =
*** solaris-x86-gcc
$cc = gcc
$cflags = -O3 -fomit-frame-pointer -m486 -Wall -DL_ENDIAN -DOPENSSL_NO_INLINE_ASM
$cflags = -O3 -fomit-frame-pointer -mcpu=i486 -Wall -DL_ENDIAN -DOPENSSL_NO_INLINE_ASM
$unistd =
$thread_cflag = -D_REENTRANT
$sys_id =
......
......@@ -1165,7 +1165,11 @@ ENGINE *setup_engine(BIO *err, const char *engine, int debug)
BIO_printf(err,"can't use that engine\n");
return NULL;
}
ENGINE_load_engine_ciphers(e);
BIO_printf(err,"engine \"%s\" set.\n", engine);
/* Free our "structural" reference. */
ENGINE_free(e);
}
......
......@@ -94,7 +94,7 @@ static void identity(void *ptr)
return;
}
static int append_buf(char **buf, char *s, int *size, int step)
static int append_buf(char **buf, const char *s, int *size, int step)
{
int l = strlen(s);
......@@ -430,6 +430,7 @@ skip_arg_loop:
{
int cap_size = 256;
char *cap_buf = NULL;
int k,n;
if (ENGINE_get_RSA(e) != NULL
&& !append_buf(&cap_buf, "RSA",
......@@ -448,6 +449,13 @@ skip_arg_loop:
&cap_size, 256))
goto end;
n=ENGINE_cipher_num(e);
for(k=0 ; k < n ; ++k)
if(!append_buf(&cap_buf,
OBJ_nid2sn(ENGINE_get_cipher(e, k)->nid),
&cap_size, 256))
goto end;
if (cap_buf && (*cap_buf != '\0'))
BIO_printf(bio_out, " [%s]", cap_buf);
......
......@@ -152,8 +152,7 @@ cfb64enc.o: ../../include/openssl/opensslconf.h cfb64enc.c des_locl.h
cfb_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
cfb_enc.o: ../../include/openssl/opensslconf.h cfb_enc.c des_locl.h
des_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
des_enc.o: ../../include/openssl/opensslconf.h des_enc.c des_locl.h des_locl.h
des_enc.o: ncbc_enc.c
des_enc.o: ../../include/openssl/opensslconf.h des_enc.c des_locl.h ncbc_enc.c
ecb3_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
ecb3_enc.o: ../../include/openssl/opensslconf.h des_locl.h ecb3_enc.c
ecb_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
......
......@@ -24,9 +24,13 @@ APPS=
LIB=$(TOP)/libcrypto.a
LIBSRC= engine_err.c engine_lib.c engine_list.c engine_all.c engine_openssl.c \
hw_atalla.c hw_cswift.c hw_ncipher.c hw_nuron.c hw_ubsec.c
engine_evp.c \
hw_atalla.c hw_cswift.c hw_ncipher.c hw_nuron.c hw_ubsec.c \
hw_openbsd_dev_crypto.c
LIBOBJ= engine_err.o engine_lib.o engine_list.o engine_all.o engine_openssl.o \
hw_atalla.o hw_cswift.o hw_ncipher.o hw_nuron.o hw_ubsec.o
engine_evp.o \
hw_atalla.o hw_cswift.o hw_ncipher.o hw_nuron.o hw_ubsec.o \
hw_openbsd_dev_crypto.o
SRC= $(LIBSRC)
......@@ -103,6 +107,18 @@ engine_err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
engine_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
engine_err.o: ../../include/openssl/types.h ../../include/openssl/ui.h
engine_err.o: engine_err.c
engine_evp.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
engine_evp.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
engine_evp.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
engine_evp.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
engine_evp.o: ../../include/openssl/evp.h ../../include/openssl/obj_mac.h
engine_evp.o: ../../include/openssl/objects.h
engine_evp.o: ../../include/openssl/opensslconf.h
engine_evp.o: ../../include/openssl/opensslv.h ../../include/openssl/rand.h
engine_evp.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
engine_evp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
engine_evp.o: ../../include/openssl/types.h ../../include/openssl/ui.h
engine_evp.o: engine_evp.c engine_int.h
engine_lib.o: ../../e_os.h ../../include/openssl/asn1.h
engine_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
engine_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
......@@ -194,6 +210,25 @@ hw_nuron.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
hw_nuron.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
hw_nuron.o: ../../include/openssl/types.h ../../include/openssl/ui.h
hw_nuron.o: ../cryptlib.h hw_nuron.c
hw_openbsd_dev_crypto.o: ../../include/openssl/asn1.h
hw_openbsd_dev_crypto.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
hw_openbsd_dev_crypto.o: ../../include/openssl/crypto.h
hw_openbsd_dev_crypto.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
hw_openbsd_dev_crypto.o: ../../include/openssl/e_os2.h
hw_openbsd_dev_crypto.o: ../../include/openssl/engine.h
hw_openbsd_dev_crypto.o: ../../include/openssl/evp.h
hw_openbsd_dev_crypto.o: ../../include/openssl/obj_mac.h
hw_openbsd_dev_crypto.o: ../../include/openssl/objects.h
hw_openbsd_dev_crypto.o: ../../include/openssl/opensslconf.h
hw_openbsd_dev_crypto.o: ../../include/openssl/opensslv.h
hw_openbsd_dev_crypto.o: ../../include/openssl/rand.h
hw_openbsd_dev_crypto.o: ../../include/openssl/rsa.h
hw_openbsd_dev_crypto.o: ../../include/openssl/safestack.h
hw_openbsd_dev_crypto.o: ../../include/openssl/stack.h
hw_openbsd_dev_crypto.o: ../../include/openssl/symhacks.h
hw_openbsd_dev_crypto.o: ../../include/openssl/types.h
hw_openbsd_dev_crypto.o: ../../include/openssl/ui.h engine_int.h
hw_openbsd_dev_crypto.o: hw_openbsd_dev_crypto.c
hw_ubsec.o: ../../e_os.h ../../include/openssl/asn1.h
hw_ubsec.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
hw_ubsec.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
......
......@@ -304,8 +304,12 @@ void ENGINE_load_chil(void);
void ENGINE_load_atalla(void);
void ENGINE_load_nuron(void);
void ENGINE_load_ubsec(void);
void ENGINE_load_openbsd_dev_crypto(void);
void ENGINE_load_builtin_engines(void);
/* Load all the currently known ciphers from all engines */
void ENGINE_load_ciphers(void);
/* Send parametrised control commands to the engine. The possibilities to send
* down an integer, a pointer to data or a function pointer are provided. Any of
* the parameters may or may not be NULL, depending on the command number. In
......@@ -373,6 +377,7 @@ int ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f);
int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f);
int ENGINE_set_flags(ENGINE *e, int flags);
int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns);
int ENGINE_add_cipher(ENGINE *e,const EVP_CIPHER *c);
/* Copies across all ENGINE methods and pointers. NB: This does *not* change
* reference counts however. */
int ENGINE_cpy(ENGINE *dest, const ENGINE *src);
......@@ -399,6 +404,8 @@ const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e);
const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e);
const DH_METHOD *ENGINE_get_DH(const ENGINE *e);
const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e);
int ENGINE_cipher_num(const ENGINE *e);
const EVP_CIPHER *ENGINE_get_cipher(const ENGINE *e, int n);
BN_MOD_EXP ENGINE_get_BN_mod_exp(const ENGINE *e);
BN_MOD_EXP_CRT ENGINE_get_BN_mod_exp_crt(const ENGINE *e);
ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e);
......@@ -473,6 +480,10 @@ int ENGINE_set_default(ENGINE *e, unsigned int flags);
* no need to call both (although no harm is done). */
int ENGINE_clear_defaults(void);
/* Instruct an engine to load any EVP ciphers it knows of */
/* XXX make this work via defaults? */
void ENGINE_load_engine_ciphers(ENGINE *e);
/* Obligatory error function. */
void ERR_load_ENGINE_strings(void);
......
......@@ -117,6 +117,15 @@ void ENGINE_load_ubsec(void)
#endif /* !OPENSSL_NO_HW */
}
void ENGINE_load_openbsd_dev_crypto(void)
{
#ifndef OPENSSL_NO_HW
# ifdef OPENSSL_OPENBSD_DEV_CRYPTO
engine_add(ENGINE_openbsd_dev_crypto());
# endif
#endif /* !OPENSSL_NO_HW */
}
void ENGINE_load_builtin_engines(void)
{
static int done=0;
......@@ -129,4 +138,5 @@ void ENGINE_load_builtin_engines(void)
ENGINE_load_atalla();
ENGINE_load_nuron();
ENGINE_load_ubsec();
ENGINE_load_openbsd_dev_crypto();
}
/* Written by Ben Laurie <ben@algroup.co.uk> August 2001 */
/* ====================================================================
* Copyright (c) 2000 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* licensing@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
#include <openssl/engine.h>
#include <openssl/evp.h>
#include "engine_int.h"
#include <string.h>
int ENGINE_add_cipher(ENGINE *e,const EVP_CIPHER *c)
{
ENGINE_EVP_CIPHER *p;
p=OPENSSL_malloc(sizeof *p);
p->cipher=c;
if(!e->ciphers)
e->ciphers=sk_ENGINE_EVP_CIPHER_new_null();
sk_ENGINE_EVP_CIPHER_push(e->ciphers,p);
return 1;
}
void ENGINE_free_engine_cipher(ENGINE_EVP_CIPHER *p)
{ OPENSSL_free(p); }
int ENGINE_cipher_num(const ENGINE *e)
{ return sk_ENGINE_EVP_CIPHER_num(e->ciphers); }
const EVP_CIPHER *ENGINE_get_cipher(const ENGINE *e, int n)
{ return sk_ENGINE_EVP_CIPHER_value(e->ciphers, n)->cipher; }
void ENGINE_load_ciphers()
{
ENGINE *e;
for(e=ENGINE_get_first() ; e ; e=ENGINE_get_next(e))
ENGINE_load_engine_ciphers(e);
}
void ENGINE_load_engine_ciphers(ENGINE *e)
{
int n;
for(n=0 ; n < sk_ENGINE_EVP_CIPHER_num(e->ciphers) ; ++n)
EVP_add_cipher(sk_ENGINE_EVP_CIPHER_value(e->ciphers,n)->cipher);
}
......@@ -87,6 +87,15 @@ extern "C" {
#endif
typedef struct engine_evp_cipher_st
{
const EVP_CIPHER *cipher;
} ENGINE_EVP_CIPHER;
DECLARE_STACK_OF(ENGINE_EVP_CIPHER)
void ENGINE_free_engine_cipher(ENGINE_EVP_CIPHER *p);
/* NB: Bitwise OR-able values for the "flags" variable in ENGINE are now exposed
* in engine.h. */
......@@ -100,6 +109,7 @@ struct engine_st
const DSA_METHOD *dsa_meth;
const DH_METHOD *dh_meth;
const RAND_METHOD *rand_meth;
BN_MOD_EXP bn_mod_exp;
BN_MOD_EXP_CRT bn_mod_exp_crt;
ENGINE_GEN_INT_FUNC_PTR init;
......@@ -107,6 +117,9 @@ struct engine_st
ENGINE_CTRL_FUNC_PTR ctrl;
ENGINE_LOAD_KEY_PTR load_privkey;
ENGINE_LOAD_KEY_PTR load_pubkey;
STACK_OF(ENGINE_EVP_CIPHER) *ciphers;
const ENGINE_CMD_DEFN *cmd_defns;
int flags;
/* reference count on the structure itself */
......@@ -156,6 +169,10 @@ ENGINE *ENGINE_nuron();
ENGINE *ENGINE_ubsec();
#endif /* !OPENSSL_NO_HW_UBSEC */
#ifdef OPENSSL_OPENBSD_DEV_CRYPTO
ENGINE *ENGINE_openbsd_dev_crypto(void);
#endif
#endif /* !OPENSSL_NO_HW */
#ifdef __cplusplus
......
......@@ -417,6 +417,7 @@ int ENGINE_free(ENGINE *e)
abort();
}
#endif
sk_ENGINE_EVP_CIPHER_pop_free(e->ciphers,ENGINE_free_engine_cipher);
CRYPTO_free_ex_data(engine_ex_data_stack, e, &e->ex_data);
OPENSSL_free(e);
return 1;
......
/* Written by Ben Laurie <ben@algroup.co.uk> August 2001 */
/* ====================================================================
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* licensing@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
#include <openssl/engine.h>
#include <openssl/evp.h>
#include "engine_int.h"
static void load_ciphers(ENGINE *e)
{
ENGINE_add_cipher(e,EVP_dev_crypto_des_ede3_cbc());
}
ENGINE *ENGINE_openbsd_dev_crypto(void)
{
ENGINE *engine=ENGINE_new();
if(!ENGINE_set_id(engine,"openbsd_dev_crypto")
|| !ENGINE_set_name(engine,"OpenBSD /dev/crypto"))
{
ENGINE_free(engine);
return NULL;
}
load_ciphers(engine);
return engine;
}
......@@ -513,6 +513,7 @@ names.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
names.o: ../../include/openssl/symhacks.h ../../include/openssl/types.h
names.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
names.o: ../cryptlib.h names.c
openbsd_hw.o: openbsd_hw.c
p5_crpt.o: ../../e_os.h ../../include/openssl/asn1.h
p5_crpt.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
p5_crpt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
......
......@@ -82,11 +82,7 @@ void OpenSSL_add_all_ciphers(void)
EVP_add_cipher_alias(SN_des_cbc,"DES");
EVP_add_cipher_alias(SN_des_cbc,"des");
EVP_add_cipher(EVP_des_ede_cbc());
# ifdef OPENSSL_OPENBSD_DEV_CRYPTO
EVP_add_cipher(EVP_dev_crypto_des_ede3_cbc());
# else
EVP_add_cipher(EVP_des_ede3_cbc());
# endif
EVP_add_cipher_alias(SN_des_ede3_cbc,"DES3");
EVP_add_cipher_alias(SN_des_ede3_cbc,"des3");
......
......@@ -106,7 +106,6 @@ static int dev_crypto_init(EVP_CIPHER_CTX *ctx)
static int dev_crypto_cleanup(EVP_CIPHER_CTX *ctx)
{
fprintf(stderr,"clean up session %d\n",data(ctx)->ses);
if(ioctl(fd,CIOCFSESSION,&data(ctx)->ses) == -1)
err("CIOCFSESSION failed");
......@@ -140,7 +139,6 @@ static int dev_crypto_des_ede3_init_key(EVP_CIPHER_CTX *ctx,
ctx->cipher=EVP_des_ede3_cbc();
return ctx->cipher->init(ctx,key,iv,enc);
}
fprintf(stderr,"created session %d\n",data(ctx)->ses);
return 1;
}
......
......@@ -424,6 +424,26 @@ STACK_OF(type) \
#define sk_DIST_POINT_pop(st) SKM_sk_pop(DIST_POINT, (st))
#define sk_DIST_POINT_sort(st) SKM_sk_sort(DIST_POINT, (st))
#define sk_ENGINE_EVP_CIPHER_new(st) SKM_sk_new(ENGINE_EVP_CIPHER, (st))
#define sk_ENGINE_EVP_CIPHER_new_null() SKM_sk_new_null(ENGINE_EVP_CIPHER)
#define sk_ENGINE_EVP_CIPHER_free(st) SKM_sk_free(ENGINE_EVP_CIPHER, (st))
#define sk_ENGINE_EVP_CIPHER_num(st) SKM_sk_num(ENGINE_EVP_CIPHER, (st))
#define sk_ENGINE_EVP_CIPHER_value(st, i) SKM_sk_value(ENGINE_EVP_CIPHER, (st), (i))
#define sk_ENGINE_EVP_CIPHER_set(st, i, val) SKM_sk_set(ENGINE_EVP_CIPHER, (st), (i), (val))
#define sk_ENGINE_EVP_CIPHER_zero(st) SKM_sk_zero(ENGINE_EVP_CIPHER, (st))
#define sk_ENGINE_EVP_CIPHER_push(st, val) SKM_sk_push(ENGINE_EVP_CIPHER, (st), (val))
#define sk_ENGINE_EVP_CIPHER_unshift(st, val) SKM_sk_unshift(ENGINE_EVP_CIPHER, (st), (val))
#define sk_ENGINE_EVP_CIPHER_find(st, val) SKM_sk_find(ENGINE_EVP_CIPHER, (st), (val))
#define sk_ENGINE_EVP_CIPHER_delete(st, i) SKM_sk_delete(ENGINE_EVP_CIPHER, (st), (i))
#define sk_ENGINE_EVP_CIPHER_delete_ptr(st, ptr) SKM_sk_delete_ptr(ENGINE_EVP_CIPHER, (st), (ptr))
#define sk_ENGINE_EVP_CIPHER_insert(st, val, i) SKM_sk_insert(ENGINE_EVP_CIPHER, (st), (val), (i))
#define sk_ENGINE_EVP_CIPHER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ENGINE_EVP_CIPHER, (st), (cmp))
#define sk_ENGINE_EVP_CIPHER_dup(st) SKM_sk_dup(ENGINE_EVP_CIPHER, st)
#define sk_ENGINE_EVP_CIPHER_pop_free(st, free_func) SKM_sk_pop_free(ENGINE_EVP_CIPHER, (st), (free_func))
#define sk_ENGINE_EVP_CIPHER_shift(st) SKM_sk_shift(ENGINE_EVP_CIPHER, (st))
#define sk_ENGINE_EVP_CIPHER_pop(st) SKM_sk_pop(ENGINE_EVP_CIPHER, (st))
#define sk_ENGINE_EVP_CIPHER_sort(st) SKM_sk_sort(ENGINE_EVP_CIPHER, (st))
#define sk_GENERAL_NAME_new(st) SKM_sk_new(GENERAL_NAME, (st))
#define sk_GENERAL_NAME_new_null() SKM_sk_new_null(GENERAL_NAME)
#define sk_GENERAL_NAME_free(st) SKM_sk_free(GENERAL_NAME, (st))
......
......@@ -325,6 +325,20 @@ x509_vfy.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
x509_vfy.o: ../../include/openssl/symhacks.h ../../include/openssl/types.h
x509_vfy.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
x509_vfy.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_vfy.c
x509cset.o: ../../e_os.h ../../include/openssl/asn1.h
x509cset.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
x509cset.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
x509cset.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
x509cset.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
x509cset.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
x509cset.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
x509cset.o: ../../include/openssl/opensslconf.h
x509cset.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
x509cset.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
x509cset.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
x509cset.o: ../../include/openssl/symhacks.h ../../include/openssl/types.h
x509cset.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
x509cset.o: ../cryptlib.h x509cset.c
x509name.o: ../../e_os.h ../../include/openssl/asn1.h
x509name.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
x509name.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
......
......@@ -2628,3 +2628,7 @@ HMAC_CTX_cleanup 3076 EXIST::FUNCTION:HMAC
EVP_MD_CTX_cleanup 3077 EXIST::FUNCTION:
EVP_MD_CTX_destroy 3078 EXIST::FUNCTION:
des_release_key 3079 EXIST::FUNCTION:DES
ENGINE_load_openbsd_dev_crypto 3080 EXIST::FUNCTION:
ENGINE_add_all_evp 3081 EXIST::FUNCTION:
ENGINE_add_evp_cipher 3082 EXIST::FUNCTION:
ENGINE_load_evp 3083 EXIST::FUNCTION:
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册