From: Dr. Stephen Henson Date: Tue, 30 May 2000 02:10:57 +0000 (+0000) Subject: Fourth phase EVP revision. X-Git-Tag: OpenSSL-engine-0_9_6-beta1~69^2~1 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=57ae2e242878b87a36bbc529e1b6432584fc93db;p=oweals%2Fopenssl.git Fourth phase EVP revision. Declare ciphers in terms of macros. This reduces the amount of code and places each block cipher EVP definition in a single file instead of being spread over 4 files. --- diff --git a/CHANGES b/CHANGES index c002077345..34ad6c80b8 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,9 @@ cipher mode. They also all do nothing if the 'key' parameter is NULL and for CFB and OFB modes they zero ctx->num. + Most of the routines have the same form and so can be declared in terms + of macros. + By shifting this to the top level EVP_CipherInit() it can be removed from all individual ciphers. If the cipher wants to handle IVs or keys differently it can set the EVP_CIPH_CUSTOM_IV or EVP_CIPH_ALWAYS_CALL_INIT diff --git a/crypto/evp/Makefile.ssl b/crypto/evp/Makefile.ssl index 1150e88929..de43060eaf 100644 --- a/crypto/evp/Makefile.ssl +++ b/crypto/evp/Makefile.ssl @@ -23,14 +23,9 @@ APPS= LIB=$(TOP)/libcrypto.a LIBSRC= encode.c digest.c evp_enc.c evp_key.c \ - e_ecb_d.c e_cbc_d.c e_cfb_d.c e_ofb_d.c \ - e_ecb_i.c e_cbc_i.c e_cfb_i.c e_ofb_i.c \ - e_ecb_3d.c e_cbc_3d.c e_rc4.c names.c \ - e_cfb_3d.c e_ofb_3d.c e_xcbc_d.c \ - e_ecb_r2.c e_cbc_r2.c e_cfb_r2.c e_ofb_r2.c \ - e_ecb_bf.c e_cbc_bf.c e_cfb_bf.c e_ofb_bf.c \ - e_ecb_c.c e_cbc_c.c e_cfb_c.c e_ofb_c.c \ - e_ecb_r5.c e_cbc_r5.c e_cfb_r5.c e_ofb_r5.c \ + e_des.c e_bf.c e_idea.c e_des3.c \ + e_rc4.c names.c \ + e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \ m_null.c m_md2.c m_md5.c m_sha.c m_sha1.c m_dss.c m_dss1.c m_mdc2.c \ m_ripemd.c \ p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c \ @@ -39,14 +34,9 @@ LIBSRC= encode.c digest.c evp_enc.c evp_key.c \ evp_pkey.c evp_pbe.c p5_crpt.c p5_crpt2.c LIBOBJ= encode.o digest.o evp_enc.o evp_key.o \ - e_ecb_d.o e_cbc_d.o e_cfb_d.o e_ofb_d.o \ - e_ecb_i.o e_cbc_i.o e_cfb_i.o e_ofb_i.o \ - e_ecb_3d.o e_cbc_3d.o e_rc4.o names.o \ - e_cfb_3d.o e_ofb_3d.o e_xcbc_d.o \ - e_ecb_r2.o e_cbc_r2.o e_cfb_r2.o e_ofb_r2.o \ - e_ecb_bf.o e_cbc_bf.o e_cfb_bf.o e_ofb_bf.o \ - e_ecb_c.o e_cbc_c.o e_cfb_c.o e_ofb_c.o \ - e_ecb_r5.o e_cbc_r5.o e_cfb_r5.o e_ofb_r5.o \ + e_des.o e_bf.o e_idea.o e_des3.o \ + e_rc4.o names.o \ + e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \ m_null.o m_md2.o m_md5.o m_sha.o m_sha1.o m_dss.o m_dss1.o m_mdc2.o \ m_ripemd.o \ p_open.o p_seal.o p_sign.o p_verify.o p_lib.o p_enc.o p_dec.o \ @@ -232,321 +222,81 @@ digest.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h digest.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h digest.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h digest.o: ../../include/openssl/stack.h ../cryptlib.h -e_cbc_3d.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_cbc_3d.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_cbc_3d.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_cbc_3d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_cbc_3d.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_cbc_3d.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_cbc_3d.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_cbc_3d.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_cbc_3d.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_cbc_3d.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_cbc_3d.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_cbc_3d.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_cbc_3d.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_cbc_3d.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_cbc_3d.o: ../../include/openssl/stack.h ../cryptlib.h -e_cbc_bf.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_cbc_bf.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_cbc_bf.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_cbc_bf.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_cbc_bf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_cbc_bf.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_cbc_bf.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_cbc_bf.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_cbc_bf.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_cbc_bf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_cbc_bf.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_cbc_bf.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_cbc_bf.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_cbc_bf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_cbc_bf.o: ../../include/openssl/stack.h ../cryptlib.h -e_cbc_c.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_cbc_c.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_cbc_c.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_cbc_c.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_cbc_c.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_cbc_c.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_cbc_c.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_cbc_c.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_cbc_c.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_cbc_c.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_cbc_c.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_cbc_c.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_cbc_c.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_cbc_c.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_cbc_c.o: ../../include/openssl/stack.h ../cryptlib.h -e_cbc_d.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_cbc_d.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_cbc_d.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_cbc_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_cbc_d.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_cbc_d.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_cbc_d.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_cbc_d.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_cbc_d.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_cbc_d.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_cbc_d.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_cbc_d.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_cbc_d.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_cbc_d.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_cbc_d.o: ../../include/openssl/stack.h ../cryptlib.h -e_cbc_i.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_cbc_i.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_cbc_i.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_cbc_i.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_cbc_i.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_cbc_i.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_cbc_i.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_cbc_i.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_cbc_i.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_cbc_i.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_cbc_i.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_cbc_i.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_cbc_i.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_cbc_i.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_cbc_i.o: ../../include/openssl/stack.h ../cryptlib.h -e_cbc_r2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_cbc_r2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_cbc_r2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_cbc_r2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_cbc_r2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_cbc_r2.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_cbc_r2.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_cbc_r2.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_cbc_r2.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_cbc_r2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_cbc_r2.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_cbc_r2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_cbc_r2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_cbc_r2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_cbc_r2.o: ../../include/openssl/stack.h ../cryptlib.h -e_cbc_r5.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_cbc_r5.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_cbc_r5.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_cbc_r5.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_cbc_r5.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_cbc_r5.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_cbc_r5.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_cbc_r5.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_cbc_r5.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_cbc_r5.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_cbc_r5.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_cbc_r5.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_cbc_r5.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_cbc_r5.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_cbc_r5.o: ../../include/openssl/stack.h ../cryptlib.h -e_cfb_3d.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_cfb_3d.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_cfb_3d.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_cfb_3d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_cfb_3d.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_cfb_3d.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_cfb_3d.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_cfb_3d.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_cfb_3d.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_cfb_3d.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_cfb_3d.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_cfb_3d.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_cfb_3d.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_cfb_3d.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_cfb_3d.o: ../../include/openssl/stack.h ../cryptlib.h -e_cfb_bf.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_cfb_bf.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_cfb_bf.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_cfb_bf.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_cfb_bf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_cfb_bf.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_cfb_bf.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_cfb_bf.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_cfb_bf.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_cfb_bf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_cfb_bf.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_cfb_bf.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_cfb_bf.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_cfb_bf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_cfb_bf.o: ../../include/openssl/stack.h ../cryptlib.h -e_cfb_c.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_cfb_c.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_cfb_c.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_cfb_c.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_cfb_c.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_cfb_c.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_cfb_c.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_cfb_c.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_cfb_c.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_cfb_c.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_cfb_c.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_cfb_c.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_cfb_c.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_cfb_c.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_cfb_c.o: ../../include/openssl/stack.h ../cryptlib.h -e_cfb_d.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_cfb_d.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_cfb_d.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_cfb_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_cfb_d.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_cfb_d.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_cfb_d.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_cfb_d.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_cfb_d.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_cfb_d.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_cfb_d.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_cfb_d.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_cfb_d.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_cfb_d.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_cfb_d.o: ../../include/openssl/stack.h ../cryptlib.h -e_cfb_i.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_cfb_i.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_cfb_i.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_cfb_i.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_cfb_i.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_cfb_i.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_cfb_i.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_cfb_i.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_cfb_i.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_cfb_i.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_cfb_i.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_cfb_i.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_cfb_i.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_cfb_i.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_cfb_i.o: ../../include/openssl/stack.h ../cryptlib.h -e_cfb_r2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_cfb_r2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_cfb_r2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_cfb_r2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_cfb_r2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_cfb_r2.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_cfb_r2.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_cfb_r2.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_cfb_r2.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_cfb_r2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_cfb_r2.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_cfb_r2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_cfb_r2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_cfb_r2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_cfb_r2.o: ../../include/openssl/stack.h ../cryptlib.h -e_cfb_r5.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_cfb_r5.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_cfb_r5.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_cfb_r5.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_cfb_r5.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_cfb_r5.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_cfb_r5.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_cfb_r5.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_cfb_r5.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_cfb_r5.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_cfb_r5.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_cfb_r5.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_cfb_r5.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_cfb_r5.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_cfb_r5.o: ../../include/openssl/stack.h ../cryptlib.h -e_ecb_3d.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_ecb_3d.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_ecb_3d.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_ecb_3d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_ecb_3d.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_ecb_3d.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_ecb_3d.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_ecb_3d.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_ecb_3d.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_ecb_3d.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_ecb_3d.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_ecb_3d.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_ecb_3d.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_ecb_3d.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_ecb_3d.o: ../../include/openssl/stack.h ../cryptlib.h -e_ecb_bf.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_ecb_bf.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_ecb_bf.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_ecb_bf.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_ecb_bf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_ecb_bf.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_ecb_bf.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_ecb_bf.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_ecb_bf.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_ecb_bf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_ecb_bf.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_ecb_bf.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_ecb_bf.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_ecb_bf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_ecb_bf.o: ../../include/openssl/stack.h ../cryptlib.h -e_ecb_c.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_ecb_c.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_ecb_c.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_ecb_c.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_ecb_c.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_ecb_c.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_ecb_c.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_ecb_c.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_ecb_c.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_ecb_c.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_ecb_c.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_ecb_c.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_ecb_c.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_ecb_c.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_ecb_c.o: ../../include/openssl/stack.h ../cryptlib.h -e_ecb_d.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_ecb_d.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_ecb_d.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_ecb_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_ecb_d.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_ecb_d.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_ecb_d.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_ecb_d.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_ecb_d.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_ecb_d.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_ecb_d.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_ecb_d.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_ecb_d.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_ecb_d.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_ecb_d.o: ../../include/openssl/stack.h ../cryptlib.h -e_ecb_i.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_ecb_i.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_ecb_i.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_ecb_i.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_ecb_i.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_ecb_i.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_ecb_i.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_ecb_i.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_ecb_i.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_ecb_i.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_ecb_i.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_ecb_i.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_ecb_i.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_ecb_i.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_ecb_i.o: ../../include/openssl/stack.h ../cryptlib.h -e_ecb_r2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_ecb_r2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_ecb_r2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_ecb_r2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_ecb_r2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_ecb_r2.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_ecb_r2.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_ecb_r2.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_ecb_r2.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_ecb_r2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_ecb_r2.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_ecb_r2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_ecb_r2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_ecb_r2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_ecb_r2.o: ../../include/openssl/stack.h ../cryptlib.h -e_ecb_r5.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_ecb_r5.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_ecb_r5.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_ecb_r5.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_ecb_r5.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_ecb_r5.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_ecb_r5.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_ecb_r5.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_ecb_r5.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_ecb_r5.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_ecb_r5.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_ecb_r5.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_ecb_r5.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_ecb_r5.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_ecb_r5.o: ../../include/openssl/stack.h ../cryptlib.h +e_bf.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +e_bf.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +e_bf.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +e_bf.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +e_bf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +e_bf.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +e_bf.o: ../../include/openssl/err.h ../../include/openssl/evp.h +e_bf.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +e_bf.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +e_bf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +e_bf.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +e_bf.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +e_bf.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +e_bf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +e_bf.o: ../../include/openssl/stack.h ../cryptlib.h evp_locl.h +e_cast.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +e_cast.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +e_cast.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +e_cast.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +e_cast.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +e_cast.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +e_cast.o: ../../include/openssl/err.h ../../include/openssl/evp.h +e_cast.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +e_cast.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +e_cast.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +e_cast.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +e_cast.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +e_cast.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +e_cast.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +e_cast.o: ../../include/openssl/stack.h ../cryptlib.h evp_locl.h +e_des.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +e_des.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +e_des.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +e_des.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +e_des.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +e_des.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +e_des.o: ../../include/openssl/err.h ../../include/openssl/evp.h +e_des.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +e_des.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +e_des.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +e_des.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +e_des.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +e_des.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +e_des.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +e_des.o: ../../include/openssl/stack.h ../cryptlib.h evp_locl.h +e_des3.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +e_des3.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +e_des3.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +e_des3.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +e_des3.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +e_des3.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +e_des3.o: ../../include/openssl/err.h ../../include/openssl/evp.h +e_des3.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +e_des3.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +e_des3.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +e_des3.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +e_des3.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +e_des3.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +e_des3.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +e_des3.o: ../../include/openssl/stack.h ../cryptlib.h evp_locl.h +e_idea.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +e_idea.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +e_idea.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +e_idea.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +e_idea.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +e_idea.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +e_idea.o: ../../include/openssl/err.h ../../include/openssl/evp.h +e_idea.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +e_idea.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +e_idea.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +e_idea.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +e_idea.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +e_idea.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +e_idea.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +e_idea.o: ../../include/openssl/stack.h ../cryptlib.h evp_locl.h e_null.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h e_null.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h e_null.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h @@ -562,111 +312,21 @@ e_null.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h e_null.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h e_null.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h e_null.o: ../../include/openssl/stack.h ../cryptlib.h -e_ofb_3d.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_ofb_3d.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_ofb_3d.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_ofb_3d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_ofb_3d.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_ofb_3d.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_ofb_3d.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_ofb_3d.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_ofb_3d.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_ofb_3d.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_ofb_3d.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_ofb_3d.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_ofb_3d.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_ofb_3d.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_ofb_3d.o: ../../include/openssl/stack.h ../cryptlib.h -e_ofb_bf.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_ofb_bf.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_ofb_bf.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_ofb_bf.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_ofb_bf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_ofb_bf.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_ofb_bf.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_ofb_bf.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_ofb_bf.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_ofb_bf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_ofb_bf.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_ofb_bf.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_ofb_bf.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_ofb_bf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_ofb_bf.o: ../../include/openssl/stack.h ../cryptlib.h -e_ofb_c.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_ofb_c.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_ofb_c.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_ofb_c.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_ofb_c.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_ofb_c.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_ofb_c.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_ofb_c.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_ofb_c.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_ofb_c.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_ofb_c.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_ofb_c.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_ofb_c.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_ofb_c.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_ofb_c.o: ../../include/openssl/stack.h ../cryptlib.h -e_ofb_d.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_ofb_d.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_ofb_d.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_ofb_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_ofb_d.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_ofb_d.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_ofb_d.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_ofb_d.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_ofb_d.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_ofb_d.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_ofb_d.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_ofb_d.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_ofb_d.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_ofb_d.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_ofb_d.o: ../../include/openssl/stack.h ../cryptlib.h -e_ofb_i.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_ofb_i.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_ofb_i.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_ofb_i.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_ofb_i.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_ofb_i.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_ofb_i.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_ofb_i.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_ofb_i.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_ofb_i.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_ofb_i.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_ofb_i.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_ofb_i.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_ofb_i.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_ofb_i.o: ../../include/openssl/stack.h ../cryptlib.h -e_ofb_r2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_ofb_r2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_ofb_r2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_ofb_r2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_ofb_r2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_ofb_r2.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_ofb_r2.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_ofb_r2.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_ofb_r2.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_ofb_r2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_ofb_r2.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_ofb_r2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_ofb_r2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_ofb_r2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_ofb_r2.o: ../../include/openssl/stack.h ../cryptlib.h -e_ofb_r5.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -e_ofb_r5.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -e_ofb_r5.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h -e_ofb_r5.o: ../../include/openssl/crypto.h ../../include/openssl/des.h -e_ofb_r5.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h -e_ofb_r5.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -e_ofb_r5.o: ../../include/openssl/err.h ../../include/openssl/evp.h -e_ofb_r5.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -e_ofb_r5.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -e_ofb_r5.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -e_ofb_r5.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h -e_ofb_r5.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -e_ofb_r5.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h -e_ofb_r5.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -e_ofb_r5.o: ../../include/openssl/stack.h ../cryptlib.h +e_rc2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +e_rc2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +e_rc2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +e_rc2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +e_rc2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +e_rc2.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +e_rc2.o: ../../include/openssl/err.h ../../include/openssl/evp.h +e_rc2.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +e_rc2.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +e_rc2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +e_rc2.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +e_rc2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +e_rc2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +e_rc2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +e_rc2.o: ../../include/openssl/stack.h ../cryptlib.h evp_locl.h e_rc4.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h e_rc4.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h e_rc4.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h @@ -682,6 +342,21 @@ e_rc4.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h e_rc4.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h e_rc4.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h e_rc4.o: ../../include/openssl/stack.h ../cryptlib.h +e_rc5.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +e_rc5.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +e_rc5.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +e_rc5.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +e_rc5.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +e_rc5.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +e_rc5.o: ../../include/openssl/err.h ../../include/openssl/evp.h +e_rc5.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +e_rc5.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +e_rc5.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +e_rc5.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +e_rc5.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +e_rc5.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +e_rc5.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +e_rc5.o: ../../include/openssl/stack.h ../cryptlib.h evp_locl.h e_xcbc_d.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h e_xcbc_d.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h e_xcbc_d.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h @@ -726,7 +401,7 @@ evp_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h evp_enc.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h evp_enc.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h evp_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -evp_enc.o: ../../include/openssl/stack.h ../cryptlib.h +evp_enc.o: ../../include/openssl/stack.h ../cryptlib.h evp_locl.h evp_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h evp_err.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h evp_err.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h diff --git a/crypto/evp/e_bf.c b/crypto/evp/e_bf.c new file mode 100644 index 0000000000..5f6b0f933f --- /dev/null +++ b/crypto/evp/e_bf.c @@ -0,0 +1,80 @@ +/* crypto/evp/e_bf.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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 acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS 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 AUTHOR OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_BF +#include +#include "cryptlib.h" +#include +#include "evp_locl.h" +#include + +static int bf_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); + +IMPLEMENT_BLOCK_CIPHER(bf, bf_ks, BF, bf_ks, NID_bf, 8, 16, 8, + 0, bf_init_key, NULL, + EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL) + +static int bf_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) + { + BF_set_key(&(ctx->c.bf_ks),EVP_CIPHER_CTX_key_length(ctx),key); + return 1; + } + +#endif diff --git a/crypto/evp/e_cast.c b/crypto/evp/e_cast.c new file mode 100644 index 0000000000..e0a9430b13 --- /dev/null +++ b/crypto/evp/e_cast.c @@ -0,0 +1,82 @@ +/* crypto/evp/e_cast.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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 acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS 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 AUTHOR OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_CAST + +#include +#include "cryptlib.h" +#include +#include +#include "evp_locl.h" + +static int cast_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); + +IMPLEMENT_BLOCK_CIPHER(cast5, cast_ks, CAST, cast_ks, + NID_cast5, 8, EVP_CAST5_KEY_SIZE, 8, + EVP_CIPH_VARIABLE_LENGTH, cast_init_key, NULL, + EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL) + +static int cast_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) + { + CAST_set_key(&(ctx->c.cast_ks),EVP_CIPHER_CTX_key_length(ctx),key); + return 1; + } + +#endif diff --git a/crypto/evp/e_cbc_3d.c b/crypto/evp/e_cbc_3d.c deleted file mode 100644 index bf58d4920d..0000000000 --- a/crypto/evp/e_cbc_3d.c +++ /dev/null @@ -1,145 +0,0 @@ -/* crypto/evp/e_cbc_3d.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_DES -#include -#include "cryptlib.h" -#include -#include - -static int des_cbc_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int des_cbc_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int des_cbc_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER d_cbc_ede_cipher2= - { - NID_des_ede_cbc, - 8,16,8, - EVP_CIPH_CBC_MODE, - des_cbc_ede_init_key, - des_cbc_ede_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -static EVP_CIPHER d_cbc_ede_cipher3= - { - NID_des_ede3_cbc, - 8,24,8, - EVP_CIPH_CBC_MODE, - des_cbc_ede3_init_key, - des_cbc_ede_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -EVP_CIPHER *EVP_des_ede_cbc(void) - { - return(&d_cbc_ede_cipher2); - } - -EVP_CIPHER *EVP_des_ede3_cbc(void) - { - return(&d_cbc_ede_cipher3); - } - -static int des_cbc_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - des_cblock *deskey = (des_cblock *)key; - - des_set_key_unchecked(&deskey[0],ctx->c.des_ede.ks1); - des_set_key_unchecked(&deskey[1],ctx->c.des_ede.ks2); - memcpy( (char *)ctx->c.des_ede.ks3, - (char *)ctx->c.des_ede.ks1, - sizeof(ctx->c.des_ede.ks1)); - return 1; - } - -static int des_cbc_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - des_cblock *deskey = (des_cblock *)key; - - des_set_key_unchecked(&deskey[0],ctx->c.des_ede.ks1); - des_set_key_unchecked(&deskey[1],ctx->c.des_ede.ks2); - des_set_key_unchecked(&deskey[2],ctx->c.des_ede.ks3); - - return 1; - } - -static int des_cbc_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - des_ede3_cbc_encrypt(in,out,inl, ctx->c.des_ede.ks1, - ctx->c.des_ede.ks2,ctx->c.des_ede.ks3, - (des_cblock *) &(ctx->iv[0]), - ctx->encrypt); - return 1; - } -#endif diff --git a/crypto/evp/e_cbc_bf.c b/crypto/evp/e_cbc_bf.c deleted file mode 100644 index a2e1413266..0000000000 --- a/crypto/evp/e_cbc_bf.c +++ /dev/null @@ -1,106 +0,0 @@ -/* crypto/evp/e_cbc_bf.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_BF -#include -#include "cryptlib.h" -#include -#include - -static int bf_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int bf_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER bfish_cbc_cipher= - { - NID_bf_cbc, - 8,EVP_BLOWFISH_KEY_SIZE,8, - EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH, - bf_cbc_init_key, - bf_cbc_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.bf_ks)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -EVP_CIPHER *EVP_bf_cbc(void) - { - return(&bfish_cbc_cipher); - } - -static int bf_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - BF_set_key(&(ctx->c.bf_ks),EVP_CIPHER_CTX_key_length(ctx),key); - return 1; - } - -static int bf_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - BF_cbc_encrypt( - in,out,(long)inl, - &(ctx->c.bf_ks),&(ctx->iv[0]), - ctx->encrypt); - return 1; - } - -#endif diff --git a/crypto/evp/e_cbc_c.c b/crypto/evp/e_cbc_c.c deleted file mode 100644 index 8164f2b1cd..0000000000 --- a/crypto/evp/e_cbc_c.c +++ /dev/null @@ -1,107 +0,0 @@ -/* crypto/evp/e_cbc_c.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_CAST - -#include -#include "cryptlib.h" -#include -#include - -static int cast_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int cast_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER cast5_cbc_cipher= - { - NID_cast5_cbc, - 8,EVP_CAST5_KEY_SIZE,8, - EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH, - cast_cbc_init_key, - cast_cbc_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.cast_ks)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -EVP_CIPHER *EVP_cast5_cbc(void) - { - return(&cast5_cbc_cipher); - } - -static int cast_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - CAST_set_key(&(ctx->c.cast_ks),EVP_CIPHER_CTX_key_length(ctx),key); - return 1; - } - -static int cast_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - CAST_cbc_encrypt( - in,out,(long)inl, - &(ctx->c.cast_ks),&(ctx->iv[0]), - ctx->encrypt); - return 1; - } - -#endif diff --git a/crypto/evp/e_cbc_d.c b/crypto/evp/e_cbc_d.c deleted file mode 100644 index 2c9287b583..0000000000 --- a/crypto/evp/e_cbc_d.c +++ /dev/null @@ -1,106 +0,0 @@ -/* crypto/evp/e_cbc_d.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_DES -#include -#include "cryptlib.h" -#include -#include - -static int des_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER d_cbc_cipher= - { - NID_des_cbc, - 8,8,8, - EVP_CIPH_CBC_MODE, - des_cbc_init_key, - des_cbc_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ks)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -EVP_CIPHER *EVP_des_cbc(void) - { - return(&d_cbc_cipher); - } - -static int des_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - des_cblock *deskey = (des_cblock *)key; - - des_set_key_unchecked(deskey,ctx->c.des_ks); - return 1; - } - -static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - des_ncbc_encrypt(in,out,inl,ctx->c.des_ks, - (des_cblock *)&(ctx->iv[0]), - ctx->encrypt); - return 1; - } -#endif diff --git a/crypto/evp/e_cbc_i.c b/crypto/evp/e_cbc_i.c deleted file mode 100644 index c2c023a1b8..0000000000 --- a/crypto/evp/e_cbc_i.c +++ /dev/null @@ -1,116 +0,0 @@ -/* crypto/evp/e_cbc_i.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_IDEA - -#include -#include "cryptlib.h" -#include -#include - -static int idea_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int idea_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER i_cbc_cipher= - { - NID_idea_cbc, - 8,16,8, - EVP_CIPH_CBC_MODE, - idea_cbc_init_key, - idea_cbc_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.idea_ks)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -EVP_CIPHER *EVP_idea_cbc(void) - { - return(&i_cbc_cipher); - } - -static int idea_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - if (enc) idea_set_encrypt_key(key,&(ctx->c.idea_ks)); - else - { - IDEA_KEY_SCHEDULE tmp; - - idea_set_encrypt_key(key,&tmp); - idea_set_decrypt_key(&tmp,&(ctx->c.idea_ks)); - memset((unsigned char *)&tmp,0, - sizeof(IDEA_KEY_SCHEDULE)); - } - return 1; - } - -static int idea_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - idea_cbc_encrypt( - in,out,(long)inl, - &(ctx->c.idea_ks),&(ctx->iv[0]), - ctx->encrypt); - return 1; - } - -#endif diff --git a/crypto/evp/e_cbc_r2.c b/crypto/evp/e_cbc_r2.c deleted file mode 100644 index 3552b67417..0000000000 --- a/crypto/evp/e_cbc_r2.c +++ /dev/null @@ -1,221 +0,0 @@ -/* crypto/evp/e_cbc_r2.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_RC2 - -#include -#include "cryptlib.h" -#include -#include - -static int rc2_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int rc2_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static int rc2_meth_to_magic(const EVP_CIPHER *e); -static EVP_CIPHER *rc2_magic_to_meth(int i); -static int rc2_set_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); -static int rc2_get_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); - -#define RC2_40_MAGIC 0xa0 -#define RC2_64_MAGIC 0x78 -#define RC2_128_MAGIC 0x3a - -static EVP_CIPHER r2_cbc_cipher= - { - NID_rc2_cbc, - 8,EVP_RC2_KEY_SIZE,8, - EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH, - rc2_cbc_init_key, - rc2_cbc_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), - rc2_set_asn1_type_and_iv, - rc2_get_asn1_type_and_iv, - NULL - }; - -static EVP_CIPHER r2_64_cbc_cipher= - { - NID_rc2_64_cbc, - 8,8 /* 64 bit */,8, - EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH, - rc2_cbc_init_key, - rc2_cbc_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), - rc2_set_asn1_type_and_iv, - rc2_get_asn1_type_and_iv, - NULL - }; - -static EVP_CIPHER r2_40_cbc_cipher= - { - NID_rc2_40_cbc, - 8,5 /* 40 bit */,8, - EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH, - rc2_cbc_init_key, - rc2_cbc_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), - rc2_set_asn1_type_and_iv, - rc2_get_asn1_type_and_iv, - NULL - }; - -EVP_CIPHER *EVP_rc2_cbc(void) - { - return(&r2_cbc_cipher); - } - -EVP_CIPHER *EVP_rc2_64_cbc(void) - { - return(&r2_64_cbc_cipher); - } - -EVP_CIPHER *EVP_rc2_40_cbc(void) - { - return(&r2_40_cbc_cipher); - } - -static int rc2_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - RC2_set_key(&(ctx->c.rc2_ks),EVP_CIPHER_CTX_key_length(ctx), - key,EVP_CIPHER_key_length(ctx->cipher)*8); - return 1; - } - -static int rc2_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - RC2_cbc_encrypt( - in,out,(long)inl, - &(ctx->c.rc2_ks),&(ctx->iv[0]), - ctx->encrypt); - return 1; - } - -static int rc2_meth_to_magic(const EVP_CIPHER *e) - { - int i; - - i=EVP_CIPHER_key_length(e); - if (i == 16) return(RC2_128_MAGIC); - else if (i == 8) return(RC2_64_MAGIC); - else if (i == 5) return(RC2_40_MAGIC); - else return(0); - } - -static EVP_CIPHER *rc2_magic_to_meth(int i) - { - if (i == RC2_128_MAGIC) return(EVP_rc2_cbc()); - else if (i == RC2_64_MAGIC) return(EVP_rc2_64_cbc()); - else if (i == RC2_40_MAGIC) return(EVP_rc2_40_cbc()); - else - { - EVPerr(EVP_F_RC2_MAGIC_TO_METH,EVP_R_UNSUPPORTED_KEY_SIZE); - return(NULL); - } - } - -static int rc2_get_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) - { - long num=0; - int i=0,l; - EVP_CIPHER *e; - - if (type != NULL) - { - l=EVP_CIPHER_CTX_iv_length(c); - i=ASN1_TYPE_get_int_octetstring(type,&num,c->oiv,l); - if (i != l) - return(-1); - else if (i > 0) - memcpy(c->iv,c->oiv,l); - e=rc2_magic_to_meth((int)num); - if (e == NULL) - return(-1); - if (e != EVP_CIPHER_CTX_cipher(c)) - { - EVP_CIPHER_CTX_cipher(c)=e; - EVP_CIPHER_CTX_set_key_length(c, EVP_CIPHER_key_length(c)); - rc2_cbc_init_key(c,NULL,NULL,1); - } - } - return(i); - } - -static int rc2_set_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) - { - long num; - int i=0,j; - - if (type != NULL) - { - num=rc2_meth_to_magic(EVP_CIPHER_CTX_cipher(c)); - j=EVP_CIPHER_CTX_iv_length(c); - i=ASN1_TYPE_set_int_octetstring(type,num,c->oiv,j); - } - return(i); - } - -#endif diff --git a/crypto/evp/e_cbc_r5.c b/crypto/evp/e_cbc_r5.c deleted file mode 100644 index 616644df27..0000000000 --- a/crypto/evp/e_cbc_r5.c +++ /dev/null @@ -1,108 +0,0 @@ -/* crypto/evp/e_cbc_r5.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_RC5 - -#include -#include "cryptlib.h" -#include -#include - -static int r_32_12_16_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int r_32_12_16_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER rc5_32_12_16_cbc_cipher= - { - NID_rc5_cbc, - 8,EVP_RC5_32_12_16_KEY_SIZE,8, - EVP_CIPH_CBC_MODE, - r_32_12_16_cbc_init_key, - r_32_12_16_cbc_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc5_ks)), - NULL, - NULL, - NULL - }; - -EVP_CIPHER *EVP_rc5_32_12_16_cbc(void) - { - return(&rc5_32_12_16_cbc_cipher); - } - -static int r_32_12_16_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - RC5_32_set_key(&(ctx->c.rc5_ks),EVP_RC5_32_12_16_KEY_SIZE, - key,RC5_12_ROUNDS); - return 1; - } - -static int r_32_12_16_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - RC5_32_cbc_encrypt( - in,out,(long)inl, - &(ctx->c.rc5_ks),&(ctx->iv[0]), - ctx->encrypt); - return 1; - } - -#endif diff --git a/crypto/evp/e_cfb_3d.c b/crypto/evp/e_cfb_3d.c deleted file mode 100644 index 140832703a..0000000000 --- a/crypto/evp/e_cfb_3d.c +++ /dev/null @@ -1,146 +0,0 @@ -/* crypto/evp/e_cfb_3d.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_DES -#include -#include "cryptlib.h" -#include -#include - -static int des_ede_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int des_ede3_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER d_ede_cfb_cipher2= - { - NID_des_ede_cfb64, - 1,16,8, - EVP_CIPH_CFB_MODE, - des_ede_cfb_init_key, - des_ede_cfb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -static EVP_CIPHER d_ede3_cfb_cipher3= - { - NID_des_ede3_cfb64, - 1,24,8, - EVP_CIPH_CFB_MODE, - des_ede3_cfb_init_key, - des_ede_cfb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -EVP_CIPHER *EVP_des_ede_cfb(void) - { - return(&d_ede_cfb_cipher2); - } - -EVP_CIPHER *EVP_des_ede3_cfb(void) - { - return(&d_ede3_cfb_cipher3); - } - -static int des_ede_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - des_cblock *deskey = (des_cblock *)key; - - des_set_key_unchecked(&deskey[0],ctx->c.des_ede.ks1); - des_set_key_unchecked(&deskey[1],ctx->c.des_ede.ks2); - memcpy( (char *)ctx->c.des_ede.ks3, - (char *)ctx->c.des_ede.ks1, - sizeof(ctx->c.des_ede.ks1)); - return 1; - } - -static int des_ede3_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - des_cblock *deskey = (des_cblock *)key; - - des_set_key_unchecked(&deskey[0],ctx->c.des_ede.ks1); - des_set_key_unchecked(&deskey[1],ctx->c.des_ede.ks2); - des_set_key_unchecked(&deskey[2],ctx->c.des_ede.ks3); - return 1; - } - -static int des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - des_ede3_cfb64_encrypt(in,out,(long)inl, - ctx->c.des_ede.ks1, - ctx->c.des_ede.ks2, - ctx->c.des_ede.ks3, - (des_cblock*)&(ctx->iv[0]), - &ctx->num,ctx->encrypt); - return 1; - } -#endif diff --git a/crypto/evp/e_cfb_bf.c b/crypto/evp/e_cfb_bf.c deleted file mode 100644 index b82139ac40..0000000000 --- a/crypto/evp/e_cfb_bf.c +++ /dev/null @@ -1,106 +0,0 @@ -/* crypto/evp/e_cfb_bf.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_BF -#include -#include "cryptlib.h" -#include -#include - -static int bf_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int bf_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER bfish_cfb_cipher= - { - NID_bf_cfb64, - 1,EVP_BLOWFISH_KEY_SIZE,8, - EVP_CIPH_CFB_MODE | EVP_CIPH_VARIABLE_LENGTH, - bf_cfb_init_key, - bf_cfb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.bf_ks)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -EVP_CIPHER *EVP_bf_cfb(void) - { - return(&bfish_cfb_cipher); - } - -static int bf_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - BF_set_key(&(ctx->c.bf_ks),EVP_CIPHER_CTX_key_length(ctx),key); - return 1; - } - -static int bf_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - BF_cfb64_encrypt( - in,out, - (long)inl, &(ctx->c.bf_ks), - &(ctx->iv[0]), - &ctx->num,ctx->encrypt); - return 1; - } -#endif diff --git a/crypto/evp/e_cfb_c.c b/crypto/evp/e_cfb_c.c deleted file mode 100644 index bbdeac24f4..0000000000 --- a/crypto/evp/e_cfb_c.c +++ /dev/null @@ -1,107 +0,0 @@ -/* crypto/evp/e_cfb_c.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_CAST - -#include -#include "cryptlib.h" -#include -#include - -static int cast_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int cast_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER cast5_cfb_cipher= - { - NID_cast5_cfb64, - 1,EVP_CAST5_KEY_SIZE,8, - EVP_CIPH_CFB_MODE | EVP_CIPH_VARIABLE_LENGTH, - cast_cfb_init_key, - cast_cfb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.cast_ks)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -EVP_CIPHER *EVP_cast5_cfb(void) - { - return(&cast5_cfb_cipher); - } - -static int cast_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - CAST_set_key(&(ctx->c.cast_ks),EVP_CIPHER_CTX_key_length(ctx),key); - return 1; - } - -static int cast_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - CAST_cfb64_encrypt( - in,out, - (long)inl, &(ctx->c.cast_ks), - &(ctx->iv[0]), - &ctx->num,ctx->encrypt); - return 1; - } -#endif diff --git a/crypto/evp/e_cfb_d.c b/crypto/evp/e_cfb_d.c deleted file mode 100644 index 72a26e32cf..0000000000 --- a/crypto/evp/e_cfb_d.c +++ /dev/null @@ -1,108 +0,0 @@ -/* crypto/evp/e_cfb_d.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include -#include "cryptlib.h" -#include -#include - -#ifndef NO_DES -static int des_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER d_cfb_cipher= - { - NID_des_cfb64, - 1,8,8, - EVP_CIPH_CFB_MODE, - des_cfb_init_key, - des_cfb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ks)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -EVP_CIPHER *EVP_des_cfb(void) - { - return(&d_cfb_cipher); - } - -static int des_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - des_cblock *deskey = (des_cblock *)key; - - des_set_key_unchecked(deskey,ctx->c.des_ks); - return 1; - } - -static int des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - des_cfb64_encrypt( - in,out, - (long)inl, ctx->c.des_ks, - (des_cblock *)&(ctx->iv[0]), - &ctx->num,ctx->encrypt); - return 1; - } -#endif diff --git a/crypto/evp/e_cfb_i.c b/crypto/evp/e_cfb_i.c deleted file mode 100644 index eb5b8f400d..0000000000 --- a/crypto/evp/e_cfb_i.c +++ /dev/null @@ -1,107 +0,0 @@ -/* crypto/evp/e_cfb_i.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_IDEA - -#include -#include "cryptlib.h" -#include -#include - -static int idea_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int idea_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER i_cfb_cipher= - { - NID_idea_cfb64, - 1,IDEA_KEY_LENGTH,IDEA_BLOCK, - EVP_CIPH_CFB_MODE, - idea_cfb_init_key, - idea_cfb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.idea_ks)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -EVP_CIPHER *EVP_idea_cfb(void) - { - return(&i_cfb_cipher); - } - -static int idea_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - idea_set_encrypt_key(key,&(ctx->c.idea_ks)); - return 1; - } - -static int idea_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - idea_cfb64_encrypt( - in,out,(long)inl, - &(ctx->c.idea_ks),&(ctx->iv[0]), - &ctx->num,ctx->encrypt); - return 1; - } - -#endif diff --git a/crypto/evp/e_cfb_r2.c b/crypto/evp/e_cfb_r2.c deleted file mode 100644 index 661bfad8b4..0000000000 --- a/crypto/evp/e_cfb_r2.c +++ /dev/null @@ -1,108 +0,0 @@ -/* crypto/evp/e_cfb_r2.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_RC2 - -#include -#include "cryptlib.h" -#include -#include - -static int rc2_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int rc2_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER r2_cfb_cipher= - { - NID_rc2_cfb64, - 1,EVP_RC2_KEY_SIZE,8, - EVP_CIPH_CFB_MODE | EVP_CIPH_VARIABLE_LENGTH, - rc2_cfb_init_key, - rc2_cfb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -EVP_CIPHER *EVP_rc2_cfb(void) - { - return(&r2_cfb_cipher); - } - -static int rc2_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - RC2_set_key(&(ctx->c.rc2_ks),EVP_CIPHER_CTX_key_length(ctx), - key,EVP_CIPHER_key_length(ctx->cipher)*8); - return 1; - } - -static int rc2_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - RC2_cfb64_encrypt( - in,out, - (long)inl, &(ctx->c.rc2_ks), - &(ctx->iv[0]), - &ctx->num,ctx->encrypt); - return 1; - } -#endif diff --git a/crypto/evp/e_cfb_r5.c b/crypto/evp/e_cfb_r5.c deleted file mode 100644 index 730fcc4fac..0000000000 --- a/crypto/evp/e_cfb_r5.c +++ /dev/null @@ -1,108 +0,0 @@ -/* crypto/evp/e_cfb_r5.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_RC5 - -#include -#include "cryptlib.h" -#include -#include - -static int rc5_32_12_16_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int rc5_32_12_16_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER rc5_cfb_cipher= - { - NID_rc5_cfb64, - 1,EVP_RC5_32_12_16_KEY_SIZE,8, - EVP_CIPH_CFB_MODE, - rc5_32_12_16_cfb_init_key, - rc5_32_12_16_cfb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc5_ks)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -EVP_CIPHER *EVP_rc5_32_12_16_cfb(void) - { - return(&rc5_cfb_cipher); - } - -static int rc5_32_12_16_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - RC5_32_set_key(&(ctx->c.rc5_ks),EVP_RC5_32_12_16_KEY_SIZE,key, - RC5_12_ROUNDS); - return 1; - } - -static int rc5_32_12_16_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - RC5_32_cfb64_encrypt( - in,out, - (long)inl, &(ctx->c.rc5_ks), - &(ctx->iv[0]), - &ctx->num,ctx->encrypt); - return 1; - } -#endif diff --git a/crypto/evp/e_des.c b/crypto/evp/e_des.c new file mode 100644 index 0000000000..485133a234 --- /dev/null +++ b/crypto/evp/e_des.c @@ -0,0 +1,112 @@ +/* crypto/evp/e_des.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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 acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS 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 AUTHOR OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_DES +#include +#include "cryptlib.h" +#include +#include +#include "evp_locl.h" + +static int des_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); + +/* Because of various casts and different names can't use IMPLEMENT_BLOCK_CIPHER */ + +static int des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) +{ + BLOCK_CIPHER_ecb_loop() + des_ecb_encrypt((des_cblock *)(in + i), (des_cblock *)(out + i), ctx->c.des_ks, ctx->encrypt); + return 1; +} + +static int des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) +{ + des_ofb64_encrypt(in, out, (long)inl, ctx->c.des_ks, (des_cblock *)ctx->iv, &ctx->num); + return 1; +} + +static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) +{ + des_ncbc_encrypt(in, out, (long)inl, ctx->c.des_ks, (des_cblock *)ctx->iv, ctx->encrypt); + return 1; +} + +static int des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) +{ + des_cfb64_encrypt(in, out, (long)inl, ctx->c.des_ks, (des_cblock *)ctx->iv, &ctx->num, ctx->encrypt); + return 1; +} + +BLOCK_CIPHER_defs(des, des_ks, NID_des, 8, 8, 8, + 0, des_init_key, NULL, + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + NULL) + + +static int des_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) + { + des_cblock *deskey = (des_cblock *)key; + + des_set_key_unchecked(deskey,ctx->c.des_ks); + return 1; + } + +#endif diff --git a/crypto/evp/e_des3.c b/crypto/evp/e_des3.c new file mode 100644 index 0000000000..c11c2b6856 --- /dev/null +++ b/crypto/evp/e_des3.c @@ -0,0 +1,161 @@ +/* crypto/evp/e_des3.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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 acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS 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 AUTHOR OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_DES +#include +#include "cryptlib.h" +#include +#include +#include "evp_locl.h" + +static int des_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); + +static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); + +/* Because of various casts and different args can't use IMPLEMENT_BLOCK_CIPHER */ + +static int des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) +{ + BLOCK_CIPHER_ecb_loop() + des_ecb3_encrypt((des_cblock *)(in + i), (des_cblock *)(out + i), + ctx->c.des_ede.ks1, ctx->c.des_ede.ks2, ctx->c.des_ede.ks3, + ctx->encrypt); + return 1; +} + +static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) +{ + des_ede3_ofb64_encrypt(in, out, (long)inl, + ctx->c.des_ede.ks1, ctx->c.des_ede.ks2, ctx->c.des_ede.ks3, + (des_cblock *)ctx->iv, &ctx->num); + return 1; +} + +static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) +{ + des_ede3_cbc_encrypt(in, out, (long)inl, + ctx->c.des_ede.ks1, ctx->c.des_ede.ks2, ctx->c.des_ede.ks3, + (des_cblock *)ctx->iv, ctx->encrypt); + return 1; +} + +static int des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) +{ + des_ede3_cfb64_encrypt(in, out, (long)inl, + ctx->c.des_ede.ks1, ctx->c.des_ede.ks2, ctx->c.des_ede.ks3, + (des_cblock *)ctx->iv, &ctx->num, ctx->encrypt); + return 1; +} + +#define NID_des_ede_ecb NID_des_ede + +BLOCK_CIPHER_defs(des_ede, des_ede, NID_des_ede, 8, 16, 8, + 0, des_ede_init_key, NULL, + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + NULL) + +#define NID_des_ede3_ecb NID_des_ede3 +#define des_ede3_cfb_cipher des_ede_cfb_cipher +#define des_ede3_ofb_cipher des_ede_ofb_cipher +#define des_ede3_cbc_cipher des_ede_cbc_cipher +#define des_ede3_ecb_cipher des_ede_ecb_cipher + +BLOCK_CIPHER_defs(des_ede3, des_ede, NID_des_ede3, 8, 24, 8, + 0, des_ede3_init_key, NULL, + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, + NULL) + +static int des_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) + { + des_cblock *deskey = (des_cblock *)key; + + des_set_key_unchecked(&deskey[0],ctx->c.des_ede.ks1); + des_set_key_unchecked(&deskey[1],ctx->c.des_ede.ks2); + memcpy( (char *)ctx->c.des_ede.ks3, + (char *)ctx->c.des_ede.ks1, + sizeof(ctx->c.des_ede.ks1)); + return 1; + } + +static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) + { + des_cblock *deskey = (des_cblock *)key; + + des_set_key_unchecked(&deskey[0],ctx->c.des_ede.ks1); + des_set_key_unchecked(&deskey[1],ctx->c.des_ede.ks2); + des_set_key_unchecked(&deskey[2],ctx->c.des_ede.ks3); + + return 1; + } + +EVP_CIPHER *EVP_des_ede(void) +{ + return &des_ede_ecb; +} + +EVP_CIPHER *EVP_des_ede3(void) +{ + return &des_ede3_ecb; +} +#endif diff --git a/crypto/evp/e_ecb_3d.c b/crypto/evp/e_ecb_3d.c deleted file mode 100644 index f024b0068f..0000000000 --- a/crypto/evp/e_ecb_3d.c +++ /dev/null @@ -1,160 +0,0 @@ -/* crypto/evp/e_ecb_3d.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_DES -#include -#include "cryptlib.h" -#include -#include - -static int des_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int des_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER d_ede_cipher2= - { - NID_des_ede, - 8,16,0, - EVP_CIPH_ECB_MODE, - des_ede_init_key, - des_ede_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), - NULL, - NULL, - NULL - }; - -static EVP_CIPHER d_ede3_cipher3= - { - NID_des_ede3, - 8,24,0, - EVP_CIPH_ECB_MODE, - des_ede3_init_key, - des_ede_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), - NULL, - NULL, - NULL - }; - -EVP_CIPHER *EVP_des_ede(void) - { - return(&d_ede_cipher2); - } - -EVP_CIPHER *EVP_des_ede3(void) - { - return(&d_ede3_cipher3); - } - -static int des_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - des_cblock *deskey = (des_cblock *)key; - - des_set_key_unchecked(&deskey[0],ctx->c.des_ede.ks1); - des_set_key_unchecked(&deskey[1],ctx->c.des_ede.ks2); - memcpy( (char *)ctx->c.des_ede.ks3, - (char *)ctx->c.des_ede.ks1, - sizeof(ctx->c.des_ede.ks1)); - return 1; - } - -static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - des_cblock *deskey = (des_cblock *)key; - - des_set_key_unchecked(&deskey[0],ctx->c.des_ede.ks1); - des_set_key_unchecked(&deskey[1],ctx->c.des_ede.ks2); - des_set_key_unchecked(&deskey[2],ctx->c.des_ede.ks3); - return 1; - } - -static int des_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - unsigned int i; - des_cblock *output /* = (des_cblock *)out */; - des_cblock *input /* = (des_cblock *)in */; - - if (inl < 8) return 1; - inl-=8; - for (i=0; i<=inl; i+=8) - { - output = (des_cblock *)(out + i); - input = (des_cblock *)(in + i); - - des_ecb3_encrypt(input,output, - ctx->c.des_ede.ks1, - ctx->c.des_ede.ks2, - ctx->c.des_ede.ks3, - ctx->encrypt); - - /* output++; */ - /* input++; */ - } - return 1; - } -#endif diff --git a/crypto/evp/e_ecb_bf.c b/crypto/evp/e_ecb_bf.c deleted file mode 100644 index b63577900d..0000000000 --- a/crypto/evp/e_ecb_bf.c +++ /dev/null @@ -1,112 +0,0 @@ -/* crypto/evp/e_ecb_bf.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_BF -#include -#include "cryptlib.h" -#include -#include - -static int bf_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int bf_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER bfish_ecb_cipher= - { - NID_bf_ecb, - 8,EVP_BLOWFISH_KEY_SIZE,0, - EVP_CIPH_ECB_MODE | EVP_CIPH_VARIABLE_LENGTH, - bf_ecb_init_key, - bf_ecb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.bf_ks)), - NULL, - NULL, - NULL - }; - -EVP_CIPHER *EVP_bf_ecb(void) - { - return(&bfish_ecb_cipher); - } - -static int bf_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - BF_set_key(&(ctx->c.bf_ks),EVP_CIPHER_CTX_key_length(ctx),key); - return 1; - } - -static int bf_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - unsigned int i; - - if (inl < 8) return 1; - inl-=8; - for (i=0; i<=inl; i+=8) - { - BF_ecb_encrypt( - &(in[i]),&(out[i]), - &(ctx->c.bf_ks),ctx->encrypt); - } - return 1; - } - -#endif diff --git a/crypto/evp/e_ecb_c.c b/crypto/evp/e_ecb_c.c deleted file mode 100644 index 3d59b89eeb..0000000000 --- a/crypto/evp/e_ecb_c.c +++ /dev/null @@ -1,113 +0,0 @@ -/* crypto/evp/e_ecb_c.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_CAST - -#include -#include "cryptlib.h" -#include -#include - -static int cast_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int cast_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER cast5_ecb_cipher= - { - NID_cast5_ecb, - 8,EVP_CAST5_KEY_SIZE,0, - EVP_CIPH_ECB_MODE | EVP_CIPH_VARIABLE_LENGTH, - cast_ecb_init_key, - cast_ecb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.cast_ks)), - NULL, - NULL, - NULL - }; - -EVP_CIPHER *EVP_cast5_ecb(void) - { - return(&cast5_ecb_cipher); - } - -static int cast_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - CAST_set_key(&(ctx->c.cast_ks),EVP_CIPHER_CTX_key_length(ctx),key); - return 1; - } - -static int cast_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - unsigned int i; - - if (inl < 8) return 1; - inl-=8; - for (i=0; i<=inl; i+=8) - { - CAST_ecb_encrypt( - &(in[i]),&(out[i]), - &(ctx->c.cast_ks),ctx->encrypt); - } - return 1; - } - -#endif diff --git a/crypto/evp/e_ecb_d.c b/crypto/evp/e_ecb_d.c deleted file mode 100644 index deac93b01a..0000000000 --- a/crypto/evp/e_ecb_d.c +++ /dev/null @@ -1,121 +0,0 @@ -/* crypto/evp/e_ecb_d.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_DES -#include -#include "cryptlib.h" -#include -#include - -static int des_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER d_ecb_cipher= - { - NID_des_ecb, - 8,8,0, - EVP_CIPH_ECB_MODE, - des_ecb_init_key, - des_ecb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ks)), - NULL, - NULL, - NULL - }; - -EVP_CIPHER *EVP_des_ecb(void) - { - return(&d_ecb_cipher); - } - -static int des_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - des_cblock *deskey = (des_cblock *)key; - - des_set_key_unchecked(deskey,ctx->c.des_ks); - return 1; - } - -static int des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - unsigned int i; - des_cblock *output /* = (des_cblock *)out */; - des_cblock *input /* = (des_cblock *)in */; - - if (inl < 8) return 1; - inl-=8; - for (i=0; i<=inl; i+=8) - { - /* Either this ... */ - output = (des_cblock *)(out + i); - input = (des_cblock *)(in + i); - - des_ecb_encrypt(input,output,ctx->c.des_ks,ctx->encrypt); - - /* ... or this. */ - /* output++; */ - /* input++; */ - } - return 1; - } -#endif diff --git a/crypto/evp/e_ecb_i.c b/crypto/evp/e_ecb_i.c deleted file mode 100644 index ab8b64e723..0000000000 --- a/crypto/evp/e_ecb_i.c +++ /dev/null @@ -1,122 +0,0 @@ -/* crypto/evp/e_ecb_i.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_IDEA - -#include -#include "cryptlib.h" -#include -#include - -static int idea_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER i_ecb_cipher= - { - NID_idea_ecb, - 8,16,0, - EVP_CIPH_ECB_MODE, - idea_ecb_init_key, - idea_ecb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.idea_ks)), - NULL, - NULL, - NULL - }; - -EVP_CIPHER *EVP_idea_ecb(void) - { - return(&i_ecb_cipher); - } - -static int idea_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - if (enc) - idea_set_encrypt_key(key,&(ctx->c.idea_ks)); - else - { - IDEA_KEY_SCHEDULE tmp; - - idea_set_encrypt_key(key,&tmp); - idea_set_decrypt_key(&tmp, &(ctx->c.idea_ks)); - memset((unsigned char *)&tmp,0, - sizeof(IDEA_KEY_SCHEDULE)); - } - return 1; - } - -static int idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - unsigned int i; - - if (inl < 8) return 1; - inl-=8; - for (i=0; i<=inl; i+=8) - { - idea_ecb_encrypt( - &(in[i]),&(out[i]),&(ctx->c.idea_ks)); - } - return 1; - } - -#endif diff --git a/crypto/evp/e_ecb_r2.c b/crypto/evp/e_ecb_r2.c deleted file mode 100644 index 596b78ba72..0000000000 --- a/crypto/evp/e_ecb_r2.c +++ /dev/null @@ -1,114 +0,0 @@ -/* crypto/evp/e_ecb_r2.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_RC2 - -#include -#include "cryptlib.h" -#include -#include - -static int rc2_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int rc2_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER r2_ecb_cipher= - { - NID_rc2_ecb, - 8,EVP_RC2_KEY_SIZE,0, - EVP_CIPH_ECB_MODE | EVP_CIPH_VARIABLE_LENGTH, - rc2_ecb_init_key, - rc2_ecb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), - NULL, - NULL, - NULL - }; - -EVP_CIPHER *EVP_rc2_ecb(void) - { - return(&r2_ecb_cipher); - } - -static int rc2_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - RC2_set_key(&(ctx->c.rc2_ks),EVP_CIPHER_CTX_key_length(ctx), - key,EVP_CIPHER_key_length(ctx->cipher)*8); - return 1; - } - -static int rc2_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - unsigned int i; - - if (inl < 8) return 1; - inl-=8; - for (i=0; i<=inl; i+=8) - { - RC2_ecb_encrypt( - &(in[i]),&(out[i]), - &(ctx->c.rc2_ks),ctx->encrypt); - } - return 1; - } - -#endif diff --git a/crypto/evp/e_ecb_r5.c b/crypto/evp/e_ecb_r5.c deleted file mode 100644 index 1baadb7be5..0000000000 --- a/crypto/evp/e_ecb_r5.c +++ /dev/null @@ -1,114 +0,0 @@ -/* crypto/evp/e_ecb_r5.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_RC5 - -#include -#include "cryptlib.h" -#include -#include - -static int rc5_32_12_16_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int rc5_32_12_16_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER rc5_ecb_cipher= - { - NID_rc5_ecb, - 8,EVP_RC5_32_12_16_KEY_SIZE,0, - EVP_CIPH_ECB_MODE, - rc5_32_12_16_ecb_init_key, - rc5_32_12_16_ecb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc5_ks)), - NULL, - NULL, - NULL - }; - -EVP_CIPHER *EVP_rc5_32_12_16_ecb(void) - { - return(&rc5_ecb_cipher); - } - -static int rc5_32_12_16_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - RC5_32_set_key(&(ctx->c.rc5_ks),EVP_RC5_32_12_16_KEY_SIZE,key, - RC5_12_ROUNDS); - return 1; - } - -static int rc5_32_12_16_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - unsigned int i; - - if (inl < 8) return 1; - inl-=8; - for (i=0; i<=inl; i+=8) - { - RC5_32_ecb_encrypt( - &(in[i]),&(out[i]), - &(ctx->c.rc5_ks),ctx->encrypt); - } - return 1; - } - -#endif diff --git a/crypto/evp/e_idea.c b/crypto/evp/e_idea.c new file mode 100644 index 0000000000..c643a063a6 --- /dev/null +++ b/crypto/evp/e_idea.c @@ -0,0 +1,111 @@ +/* crypto/evp/e_idea.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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 acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS 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 AUTHOR OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_IDEA + +#include +#include "cryptlib.h" +#include +#include +#include "evp_locl.h" + +static int idea_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); + +/* NB idea_ecb_encrypt doesn't take an 'encrypt' argument so we treat it as a special + * case + */ + +static int idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl) +{ + BLOCK_CIPHER_ecb_loop() + idea_ecb_encrypt(in + i, out + i, &ctx->c.idea_ks); + return 1; +} + +/* Can't use IMPLEMENT_BLOCK_CIPHER because idea_ecb_encrypt is different */ + +BLOCK_CIPHER_func_cbc(idea, idea, idea_ks) +BLOCK_CIPHER_func_ofb(idea, idea, idea_ks) +BLOCK_CIPHER_func_cfb(idea, idea, idea_ks) + +BLOCK_CIPHER_defs(idea, idea_ks, NID_idea, 8, 16, 8, + 0, idea_init_key, NULL, + EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL) + +static int idea_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) + { + if(!enc) { + if (EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_OFB_MODE) enc = 1; + else if (EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_CFB_MODE) enc = 1; + } + if (enc) idea_set_encrypt_key(key,&(ctx->c.idea_ks)); + else + { + IDEA_KEY_SCHEDULE tmp; + + idea_set_encrypt_key(key,&tmp); + idea_set_decrypt_key(&tmp,&(ctx->c.idea_ks)); + memset((unsigned char *)&tmp,0, + sizeof(IDEA_KEY_SCHEDULE)); + } + return 1; + } + +#endif diff --git a/crypto/evp/e_ofb_3d.c b/crypto/evp/e_ofb_3d.c deleted file mode 100644 index 14ac11c31e..0000000000 --- a/crypto/evp/e_ofb_3d.c +++ /dev/null @@ -1,145 +0,0 @@ -/* crypto/evp/e_ofb_3d.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_DES -#include -#include "cryptlib.h" -#include -#include - -static int des_ede_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int des_ede3_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER d_ede_ofb_cipher2= - { - NID_des_ede_ofb64, - 1,16,8, - EVP_CIPH_OFB_MODE, - des_ede_ofb_init_key, - des_ede_ofb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -static EVP_CIPHER d_ede3_ofb_cipher3= - { - NID_des_ede3_ofb64, - 1,24,8, - EVP_CIPH_OFB_MODE, - des_ede3_ofb_init_key, - des_ede_ofb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -EVP_CIPHER *EVP_des_ede_ofb(void) - { - return(&d_ede_ofb_cipher2); - } - -EVP_CIPHER *EVP_des_ede3_ofb(void) - { - return(&d_ede3_ofb_cipher3); - } - -static int des_ede_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - des_cblock *deskey = (des_cblock *)key; - - des_set_key_unchecked(&deskey[0],ctx->c.des_ede.ks1); - des_set_key_unchecked(&deskey[1],ctx->c.des_ede.ks2); - memcpy( (char *)ctx->c.des_ede.ks3, - (char *)ctx->c.des_ede.ks1, - sizeof(ctx->c.des_ede.ks1)); - - return 1; - } - -static int des_ede3_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - des_cblock *deskey = (des_cblock *)key; - - des_set_key_unchecked(&deskey[0],ctx->c.des_ede.ks1); - des_set_key_unchecked(&deskey[1],ctx->c.des_ede.ks2); - des_set_key_unchecked(&deskey[2],ctx->c.des_ede.ks3); - - return 1; - } - -static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - des_ede3_ofb64_encrypt(in,out,inl,ctx->c.des_ede.ks1, - ctx->c.des_ede.ks2, ctx->c.des_ede.ks3, - (des_cblock *)&(ctx->iv[0]),&ctx->num); - return 1; - } -#endif diff --git a/crypto/evp/e_ofb_bf.c b/crypto/evp/e_ofb_bf.c deleted file mode 100644 index 6d4b62a391..0000000000 --- a/crypto/evp/e_ofb_bf.c +++ /dev/null @@ -1,107 +0,0 @@ -/* crypto/evp/e_ofb_bf.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_BF -#include -#include "cryptlib.h" -#include -#include - -static int bf_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int bf_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER bfish_ofb_cipher= - { - NID_bf_ofb64, - 1,EVP_BLOWFISH_KEY_SIZE,8, - EVP_CIPH_OFB_MODE | EVP_CIPH_VARIABLE_LENGTH, - bf_ofb_init_key, - bf_ofb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.bf_ks)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -EVP_CIPHER *EVP_bf_ofb(void) - { - return(&bfish_ofb_cipher); - } - -static int bf_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - BF_set_key(&(ctx->c.bf_ks),EVP_CIPHER_CTX_key_length(ctx),key); - return 1; - } - -static int bf_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - BF_ofb64_encrypt( - in,out, - (long)inl, &(ctx->c.bf_ks), - &(ctx->iv[0]), - &ctx->num); - return 1; - } - -#endif diff --git a/crypto/evp/e_ofb_c.c b/crypto/evp/e_ofb_c.c deleted file mode 100644 index 20c843c22f..0000000000 --- a/crypto/evp/e_ofb_c.c +++ /dev/null @@ -1,108 +0,0 @@ -/* crypto/evp/e_ofb_c.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_CAST - -#include -#include "cryptlib.h" -#include -#include - -static int cast_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int cast_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER cast5_ofb_cipher= - { - NID_cast5_ofb64, - 1,EVP_CAST5_KEY_SIZE,8, - EVP_CIPH_OFB_MODE | EVP_CIPH_VARIABLE_LENGTH, - cast_ofb_init_key, - cast_ofb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.cast_ks)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -EVP_CIPHER *EVP_cast5_ofb(void) - { - return(&cast5_ofb_cipher); - } - -static int cast_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - CAST_set_key(&(ctx->c.cast_ks),EVP_CIPHER_CTX_key_length(ctx),key); - return 1; - } - -static int cast_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - CAST_ofb64_encrypt( - in,out, - (long)inl, &(ctx->c.cast_ks), - &(ctx->iv[0]), - &ctx->num); - return 1; - } - -#endif diff --git a/crypto/evp/e_ofb_d.c b/crypto/evp/e_ofb_d.c deleted file mode 100644 index 0926e9cb7b..0000000000 --- a/crypto/evp/e_ofb_d.c +++ /dev/null @@ -1,104 +0,0 @@ -/* crypto/evp/e_ofb_d.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_DES -#include -#include "cryptlib.h" -#include -#include - -static int des_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER d_ofb_cipher= - { - NID_des_ofb64, - 1,8,8, - EVP_CIPH_OFB_MODE, - des_ofb_init_key, - des_ofb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ks)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -EVP_CIPHER *EVP_des_ofb(void) - { - return(&d_ofb_cipher); - } - -static int des_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - des_cblock *deskey = (des_cblock *)key; - des_set_key_unchecked(deskey,ctx->c.des_ks); - return 1; - } - -static int des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - des_ofb64_encrypt(in,out,inl,ctx->c.des_ks, - (des_cblock *)&(ctx->iv[0]),&ctx->num); - return 1; - } -#endif diff --git a/crypto/evp/e_ofb_i.c b/crypto/evp/e_ofb_i.c deleted file mode 100644 index b6f6aa2f53..0000000000 --- a/crypto/evp/e_ofb_i.c +++ /dev/null @@ -1,107 +0,0 @@ -/* crypto/evp/e_ofb_i.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_IDEA - -#include -#include "cryptlib.h" -#include -#include - -static int idea_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int idea_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER i_ofb_cipher= - { - NID_idea_ofb64, - 1,IDEA_KEY_LENGTH,IDEA_BLOCK, - EVP_CIPH_OFB_MODE, - idea_ofb_init_key, - idea_ofb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.idea_ks)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -EVP_CIPHER *EVP_idea_ofb(void) - { - return(&i_ofb_cipher); - } - -static int idea_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - idea_set_encrypt_key(key,&(ctx->c.idea_ks)); - return 1; - } - -static int idea_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - idea_ofb64_encrypt( - in,out,(long)inl, - &(ctx->c.idea_ks),&(ctx->iv[0]), - &ctx->num); - return 1; - } - -#endif diff --git a/crypto/evp/e_ofb_r2.c b/crypto/evp/e_ofb_r2.c deleted file mode 100644 index b71cc78bcb..0000000000 --- a/crypto/evp/e_ofb_r2.c +++ /dev/null @@ -1,109 +0,0 @@ -/* crypto/evp/e_ofb_r2.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_RC2 - -#include -#include "cryptlib.h" -#include -#include - -static int rc2_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int rc2_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER r2_ofb_cipher= - { - NID_rc2_ofb64, - 1,EVP_RC2_KEY_SIZE,8, - EVP_CIPH_OFB_MODE | EVP_CIPH_VARIABLE_LENGTH, - rc2_ofb_init_key, - rc2_ofb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -EVP_CIPHER *EVP_rc2_ofb(void) - { - return(&r2_ofb_cipher); - } - -static int rc2_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - RC2_set_key(&(ctx->c.rc2_ks),EVP_CIPHER_CTX_key_length(ctx), - key,EVP_CIPHER_key_length(ctx->cipher)*8); - return 1; - } - -static int rc2_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - RC2_ofb64_encrypt( - in,out, - (long)inl, &(ctx->c.rc2_ks), - &(ctx->iv[0]), - &ctx->num); - return 1; - } - -#endif diff --git a/crypto/evp/e_ofb_r5.c b/crypto/evp/e_ofb_r5.c deleted file mode 100644 index 3eba2790c1..0000000000 --- a/crypto/evp/e_ofb_r5.c +++ /dev/null @@ -1,109 +0,0 @@ -/* crypto/evp/e_ofb_r5.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * 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 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 acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS 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 AUTHOR OR 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. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_RC5 - -#include -#include "cryptlib.h" -#include -#include - -static int rc5_32_12_16_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv,int enc); -static int rc5_32_12_16_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl); -static EVP_CIPHER rc5_ofb_cipher= - { - NID_rc5_ofb64, - 1,EVP_RC5_32_12_16_KEY_SIZE,8, - EVP_CIPH_OFB_MODE, - rc5_32_12_16_ofb_init_key, - rc5_32_12_16_ofb_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc5_ks)), - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL - }; - -EVP_CIPHER *EVP_rc5_32_12_16_ofb(void) - { - return(&rc5_ofb_cipher); - } - -static int rc5_32_12_16_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, - unsigned char *iv, int enc) - { - RC5_32_set_key(&(ctx->c.rc5_ks),EVP_RC5_32_12_16_KEY_SIZE,key, - RC5_12_ROUNDS); - return 1; - } - -static int rc5_32_12_16_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - unsigned char *in, unsigned int inl) - { - RC5_32_ofb64_encrypt( - in,out, - (long)inl, &(ctx->c.rc5_ks), - &(ctx->iv[0]), - &ctx->num); - return 1; - } - -#endif diff --git a/crypto/evp/e_rc2.c b/crypto/evp/e_rc2.c new file mode 100644 index 0000000000..4c3bf1e649 --- /dev/null +++ b/crypto/evp/e_rc2.c @@ -0,0 +1,198 @@ +/* crypto/evp/e_rc2.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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 acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS 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 AUTHOR OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_RC2 + +#include +#include "cryptlib.h" +#include +#include +#include "evp_locl.h" + +static int rc2_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); +static int rc2_meth_to_magic(const EVP_CIPHER *e); +static EVP_CIPHER *rc2_magic_to_meth(int i); +static int rc2_set_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); +static int rc2_get_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); + +IMPLEMENT_BLOCK_CIPHER(rc2, rc2.ks, RC2, rc2, NID_rc2, + 8, + EVP_RC2_KEY_SIZE, 8, + EVP_CIPH_VARIABLE_LENGTH, rc2_init_key, NULL, + rc2_set_asn1_type_and_iv, rc2_get_asn1_type_and_iv, NULL) + +#define RC2_40_MAGIC 0xa0 +#define RC2_64_MAGIC 0x78 +#define RC2_128_MAGIC 0x3a + +static EVP_CIPHER r2_64_cbc_cipher= + { + NID_rc2_64_cbc, + 8,8 /* 64 bit */,8, + EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH, + rc2_init_key, + rc2_cbc_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2)), + rc2_set_asn1_type_and_iv, + rc2_get_asn1_type_and_iv, + NULL, + NULL + }; + +static EVP_CIPHER r2_40_cbc_cipher= + { + NID_rc2_40_cbc, + 8,5 /* 40 bit */,8, + EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH, + rc2_init_key, + rc2_cbc_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2)), + rc2_set_asn1_type_and_iv, + rc2_get_asn1_type_and_iv, + NULL, + NULL + }; + +EVP_CIPHER *EVP_rc2_64_cbc(void) + { + return(&r2_64_cbc_cipher); + } + +EVP_CIPHER *EVP_rc2_40_cbc(void) + { + return(&r2_40_cbc_cipher); + } + +static int rc2_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) + { + RC2_set_key(&(ctx->c.rc2.ks),EVP_CIPHER_CTX_key_length(ctx), + key,EVP_CIPHER_key_length(ctx->cipher)*8); + return 1; + } + +static int rc2_meth_to_magic(const EVP_CIPHER *e) + { + int i; + + i=EVP_CIPHER_key_length(e); + if (i == 16) return(RC2_128_MAGIC); + else if (i == 8) return(RC2_64_MAGIC); + else if (i == 5) return(RC2_40_MAGIC); + else return(0); + } + +static EVP_CIPHER *rc2_magic_to_meth(int i) + { + if (i == RC2_128_MAGIC) return(EVP_rc2_cbc()); + else if (i == RC2_64_MAGIC) return(EVP_rc2_64_cbc()); + else if (i == RC2_40_MAGIC) return(EVP_rc2_40_cbc()); + else + { + EVPerr(EVP_F_RC2_MAGIC_TO_METH,EVP_R_UNSUPPORTED_KEY_SIZE); + return(NULL); + } + } + +static int rc2_get_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) + { + long num=0; + int i=0,l; + EVP_CIPHER *e; + + if (type != NULL) + { + l=EVP_CIPHER_CTX_iv_length(c); + i=ASN1_TYPE_get_int_octetstring(type,&num,c->oiv,l); + if (i != l) + return(-1); + else if (i > 0) + memcpy(c->iv,c->oiv,l); + e=rc2_magic_to_meth((int)num); + if (e == NULL) + return(-1); + if (e != EVP_CIPHER_CTX_cipher(c)) + { + EVP_CIPHER_CTX_cipher(c)=e; + EVP_CIPHER_CTX_set_key_length(c, EVP_CIPHER_key_length(c)); + rc2_init_key(c,NULL,NULL,1); + } + } + return(i); + } + +static int rc2_set_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) + { + long num; + int i=0,j; + + if (type != NULL) + { + num=rc2_meth_to_magic(EVP_CIPHER_CTX_cipher(c)); + j=EVP_CIPHER_CTX_iv_length(c); + i=ASN1_TYPE_set_int_octetstring(type,num,c->oiv,j); + } + return(i); + } + +#endif diff --git a/crypto/evp/e_rc5.c b/crypto/evp/e_rc5.c new file mode 100644 index 0000000000..3998e0c6c8 --- /dev/null +++ b/crypto/evp/e_rc5.c @@ -0,0 +1,118 @@ +/* crypto/evp/e_rc5.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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 acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS 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 AUTHOR OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef NO_RC5 + +#include +#include "cryptlib.h" +#include +#include +#include "evp_locl.h" + +static int r_32_12_16_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv,int enc); + +IMPLEMENT_BLOCK_CIPHER(rc5_32_12_16, rc5.ks, RC5_32, rc5, NID_rc5, + 8, EVP_RC5_32_12_16_KEY_SIZE, 8, + 0, r_32_12_16_init_key, NULL, + NULL, NULL, NULL) + +#if 0 +static int r_32_12_16_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl); +static EVP_CIPHER rc5_32_12_16_cbc_cipher= + { + NID_rc5_cbc, + 8,EVP_RC5_32_12_16_KEY_SIZE,8, + EVP_CIPH_CBC_MODE, + r_32_12_16_cbc_init_key, + r_32_12_16_cbc_cipher, + NULL, + sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ + sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc5)), + NULL, + NULL, + NULL + }; + +EVP_CIPHER *EVP_rc5_32_12_16_cbc(void) + { + return(&rc5_32_12_16_cbc_cipher); + } +#endif + +static int r_32_12_16_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) + { + RC5_32_set_key(&(ctx->c.rc5.ks),EVP_RC5_32_12_16_KEY_SIZE, + key,RC5_12_ROUNDS); + return 1; + } +#if 0 +static int r_32_12_16_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) + { + RC5_32_cbc_encrypt( + in,out,(long)inl, + &(ctx->c.rc5.ks),&(ctx->iv[0]), + ctx->encrypt); + return 1; + } +#endif + +#endif diff --git a/crypto/evp/evp.h b/crypto/evp/evp.h index 2c41c7ef0c..abb1490b81 100644 --- a/crypto/evp/evp.h +++ b/crypto/evp/evp.h @@ -354,7 +354,19 @@ struct evp_cipher_st #define EVP_CIPH_CUSTOM_IV 0x10 /* Set if the cipher's init() function should be called if key is NULL */ #define EVP_CIPH_ALWAYS_CALL_INIT 0x20 +/* Call ctrl() to init cipher parameters */ +#define EVP_CIPH_CTRL_INIT 0x40 +/* Don't use standard key length function */ +#define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 +/* ctrl() values */ + +#define EVP_CTRL_INIT 0x0 +#define EVP_CTRL_SET_KEY_LENGTH 0x1 +#define EVP_CTRL_GET_RC2_KEY_BITS 0x2 +#define EVP_CTRL_SET_RC2_KEY_BITS 0x3 +#define EVP_CTRL_GET_RC5_ROUNDS 0x4 +#define EVP_CTRL_SET_RC5_ROUNDS 0x5 typedef struct evp_cipher_info_st { @@ -402,10 +414,16 @@ struct evp_cipher_ctx_st IDEA_KEY_SCHEDULE idea_ks;/* key schedule */ #endif #ifndef NO_RC2 - RC2_KEY rc2_ks;/* key schedule */ + struct { + int key_bits; /* effective key bits */ + RC2_KEY ks;/* key schedule */ + } rc2; #endif #ifndef NO_RC5 - RC5_32_KEY rc5_ks;/* key schedule */ + struct { + int rounds; /* number of rounds */ + RC5_32_KEY ks;/* key schedule */ + } rc5; #endif #ifndef NO_BF BF_KEY bf_ks;/* key schedule */ diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c index 09f7d7ea5e..4bf3a565a7 100644 --- a/crypto/evp/evp_enc.c +++ b/crypto/evp/evp_enc.c @@ -60,6 +60,7 @@ #include "cryptlib.h" #include #include +#include "evp_locl.h" const char *EVP_version="EVP" OPENSSL_VERSION_PTEXT; @@ -309,4 +310,3 @@ int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, int keylen) EVPerr(EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH,EVP_R_INVALID_KEY_LENGTH); return 0; } -