From de8f24ea083384bb66b32ec105dc4743c5663cdf Mon Sep 17 00:00:00 2001 From: beck <> Date: Wed, 29 Sep 1999 04:37:45 +0000 Subject: OpenSSL 0.9.4 merge --- src/lib/libcrypto/evp/Makefile.ssl | 1034 +++++++++++++++++++++++++++++++++++- src/lib/libcrypto/evp/bio_b64.c | 39 +- src/lib/libcrypto/evp/bio_enc.c | 58 +- src/lib/libcrypto/evp/bio_md.c | 48 +- src/lib/libcrypto/evp/bio_ok.c | 552 +++++++++++++++++++ src/lib/libcrypto/evp/c_all.c | 77 +-- src/lib/libcrypto/evp/digest.c | 29 +- src/lib/libcrypto/evp/e_cbc_3d.c | 64 +-- src/lib/libcrypto/evp/e_cbc_bf.c | 31 +- src/lib/libcrypto/evp/e_cbc_c.c | 28 +- src/lib/libcrypto/evp/e_cbc_d.c | 40 +- src/lib/libcrypto/evp/e_cbc_i.c | 28 +- src/lib/libcrypto/evp/e_cbc_r2.c | 122 ++++- src/lib/libcrypto/evp/e_cbc_r5.c | 26 +- src/lib/libcrypto/evp/e_cfb_3d.c | 69 +-- src/lib/libcrypto/evp/e_cfb_bf.c | 29 +- src/lib/libcrypto/evp/e_cfb_c.c | 26 +- src/lib/libcrypto/evp/e_cfb_d.c | 34 +- src/lib/libcrypto/evp/e_cfb_i.c | 26 +- src/lib/libcrypto/evp/e_cfb_r2.c | 30 +- src/lib/libcrypto/evp/e_cfb_r5.c | 26 +- src/lib/libcrypto/evp/e_dsa.c | 6 +- src/lib/libcrypto/evp/e_ecb_3d.c | 67 ++- src/lib/libcrypto/evp/e_ecb_bf.c | 29 +- src/lib/libcrypto/evp/e_ecb_c.c | 26 +- src/lib/libcrypto/evp/e_ecb_d.c | 48 +- src/lib/libcrypto/evp/e_ecb_i.c | 26 +- src/lib/libcrypto/evp/e_ecb_r2.c | 30 +- src/lib/libcrypto/evp/e_ecb_r5.c | 26 +- src/lib/libcrypto/evp/e_null.c | 26 +- src/lib/libcrypto/evp/e_ofb_3d.c | 65 +-- src/lib/libcrypto/evp/e_ofb_bf.c | 29 +- src/lib/libcrypto/evp/e_ofb_c.c | 26 +- src/lib/libcrypto/evp/e_ofb_d.c | 41 +- src/lib/libcrypto/evp/e_ofb_i.c | 26 +- src/lib/libcrypto/evp/e_ofb_r2.c | 30 +- src/lib/libcrypto/evp/e_ofb_r5.c | 26 +- src/lib/libcrypto/evp/e_rc4.c | 28 +- src/lib/libcrypto/evp/e_xcbc_d.c | 42 +- src/lib/libcrypto/evp/encode.c | 57 +- src/lib/libcrypto/evp/evp.err | 24 - src/lib/libcrypto/evp/evp.h | 347 +++++------- src/lib/libcrypto/evp/evp_enc.c | 71 +-- src/lib/libcrypto/evp/evp_err.c | 144 +++-- src/lib/libcrypto/evp/evp_key.c | 31 +- src/lib/libcrypto/evp/evp_lib.c | 51 +- src/lib/libcrypto/evp/evp_pbe.c | 134 +++++ src/lib/libcrypto/evp/evp_pkey.c | 298 +++++++++++ src/lib/libcrypto/evp/m_dss.c | 11 +- src/lib/libcrypto/evp/m_dss1.c | 10 +- src/lib/libcrypto/evp/m_md2.c | 11 +- src/lib/libcrypto/evp/m_md5.c | 10 +- src/lib/libcrypto/evp/m_mdc2.c | 10 +- src/lib/libcrypto/evp/m_null.c | 10 +- src/lib/libcrypto/evp/m_ripemd.c | 11 +- src/lib/libcrypto/evp/m_sha.c | 11 +- src/lib/libcrypto/evp/m_sha1.c | 10 +- src/lib/libcrypto/evp/names.c | 239 ++------- src/lib/libcrypto/evp/p5_crpt.c | 146 +++++ src/lib/libcrypto/evp/p5_crpt2.c | 247 +++++++++ src/lib/libcrypto/evp/p_dec.c | 23 +- src/lib/libcrypto/evp/p_enc.c | 23 +- src/lib/libcrypto/evp/p_lib.c | 53 +- src/lib/libcrypto/evp/p_open.c | 22 +- src/lib/libcrypto/evp/p_seal.c | 27 +- src/lib/libcrypto/evp/p_sign.c | 25 +- src/lib/libcrypto/evp/p_verify.c | 15 +- src/lib/libcrypto/evp/pk_lib.c | 82 --- 68 files changed, 3419 insertions(+), 1747 deletions(-) create mode 100644 src/lib/libcrypto/evp/bio_ok.c delete mode 100644 src/lib/libcrypto/evp/evp.err create mode 100644 src/lib/libcrypto/evp/evp_pbe.c create mode 100644 src/lib/libcrypto/evp/evp_pkey.c create mode 100644 src/lib/libcrypto/evp/p5_crpt.c create mode 100644 src/lib/libcrypto/evp/p5_crpt2.c delete mode 100644 src/lib/libcrypto/evp/pk_lib.c (limited to 'src/lib/libcrypto/evp') diff --git a/src/lib/libcrypto/evp/Makefile.ssl b/src/lib/libcrypto/evp/Makefile.ssl index 8bf2516458..dda2586ed1 100644 --- a/src/lib/libcrypto/evp/Makefile.ssl +++ b/src/lib/libcrypto/evp/Makefile.ssl @@ -7,16 +7,16 @@ TOP= ../.. CC= cc INCLUDES= -I.. -I../../include CFLAG=-g +INSTALL_PREFIX= +OPENSSLDIR= /usr/local/ssl INSTALLTOP=/usr/local/ssl MAKE= make -f Makefile.ssl -MAKEDEPEND= makedepend -f Makefile.ssl +MAKEDEPEND= $(TOP)/util/domd $(TOP) MAKEFILE= Makefile.ssl AR= ar r CFLAGS= $(INCLUDES) $(CFLAG) -ERR=evp -ERRC=evp_err GENERAL=Makefile TEST= APPS= @@ -34,8 +34,8 @@ LIBSRC= encode.c digest.c evp_enc.c evp_key.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 \ - bio_md.c bio_b64.c bio_enc.c $(ERRC).c e_null.c \ - c_all.c evp_lib.c + bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c \ + c_all.c evp_lib.c bio_ok.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 \ @@ -49,8 +49,8 @@ LIBOBJ= encode.o digest.o evp_enc.o evp_key.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 \ - bio_md.o bio_b64.o bio_enc.o $(ERRC).o e_null.o \ - c_all.o evp_lib.o + bio_md.o bio_b64.o bio_enc.o evp_err.o e_null.o \ + c_all.o evp_lib.o bio_ok.o evp_pkey.o evp_pbe.o p5_crpt.o p5_crpt2.o SRC= $(LIBSRC) @@ -66,24 +66,23 @@ all: lib lib: $(LIBOBJ) $(AR) $(LIB) $(LIBOBJ) - sh $(TOP)/util/ranlib.sh $(LIB) + $(RANLIB) $(LIB) @touch lib files: - perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO + $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO links: - /bin/rm -f Makefile - $(TOP)/util/point.sh Makefile.ssl Makefile ; - $(TOP)/util/mklink.sh ../../include $(EXHEADER) - $(TOP)/util/mklink.sh ../../test $(TEST) - $(TOP)/util/mklink.sh ../../apps $(APPS) + @$(TOP)/util/point.sh Makefile.ssl Makefile + @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) + @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) + @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) install: @for i in $(EXHEADER) ; \ do \ - (cp $$i $(INSTALLTOP)/include/$$i; \ - chmod 644 $(INSTALLTOP)/include/$$i ); \ + (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ + chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ done; tags: @@ -95,17 +94,1006 @@ lint: lint -DLINT $(INCLUDES) $(SRC)>fluff depend: - $(MAKEDEPEND) $(INCLUDES) $(LIBSRC) + $(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(LIBSRC) dclean: - perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new + $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new mv -f Makefile.new $(MAKEFILE) clean: - /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff - -errors: - perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h - perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c + rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff # DO NOT DELETE THIS LINE -- make depend depends on it. + +bio_b64.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +bio_b64.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +bio_b64.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +bio_b64.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +bio_b64.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +bio_b64.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +bio_b64.o: ../../include/openssl/err.h ../../include/openssl/evp.h +bio_b64.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +bio_b64.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +bio_b64.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +bio_b64.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +bio_b64.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +bio_b64.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +bio_b64.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +bio_b64.o: ../../include/openssl/stack.h ../cryptlib.h +bio_enc.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +bio_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +bio_enc.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +bio_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +bio_enc.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +bio_enc.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +bio_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h +bio_enc.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +bio_enc.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +bio_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +bio_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +bio_enc.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +bio_enc.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +bio_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +bio_enc.o: ../../include/openssl/stack.h ../cryptlib.h +bio_md.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +bio_md.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +bio_md.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +bio_md.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +bio_md.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +bio_md.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +bio_md.o: ../../include/openssl/err.h ../../include/openssl/evp.h +bio_md.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +bio_md.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +bio_md.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +bio_md.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +bio_md.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +bio_md.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +bio_md.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +bio_md.o: ../../include/openssl/stack.h ../cryptlib.h +bio_ok.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +bio_ok.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +bio_ok.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +bio_ok.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +bio_ok.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +bio_ok.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +bio_ok.o: ../../include/openssl/err.h ../../include/openssl/evp.h +bio_ok.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +bio_ok.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +bio_ok.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +bio_ok.o: ../../include/openssl/opensslv.h ../../include/openssl/rand.h +bio_ok.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +bio_ok.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +bio_ok.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +bio_ok.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +bio_ok.o: ../cryptlib.h +c_all.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +c_all.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +c_all.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +c_all.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +c_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +c_all.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +c_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h +c_all.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +c_all.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +c_all.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +c_all.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs12.h +c_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +c_all.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +c_all.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +c_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +c_all.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +c_all.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +digest.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +digest.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +digest.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +digest.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +digest.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +digest.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h +digest.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +digest.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +digest.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +digest.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +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_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 +e_null.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +e_null.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +e_null.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +e_null.o: ../../include/openssl/err.h ../../include/openssl/evp.h +e_null.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +e_null.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +e_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +e_null.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +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_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 +e_rc4.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +e_rc4.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +e_rc4.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +e_rc4.o: ../../include/openssl/err.h ../../include/openssl/evp.h +e_rc4.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +e_rc4.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +e_rc4.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +e_rc4.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +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_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 +e_xcbc_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +e_xcbc_d.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +e_xcbc_d.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +e_xcbc_d.o: ../../include/openssl/err.h ../../include/openssl/evp.h +e_xcbc_d.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +e_xcbc_d.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +e_xcbc_d.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +e_xcbc_d.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +e_xcbc_d.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +e_xcbc_d.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +e_xcbc_d.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +e_xcbc_d.o: ../../include/openssl/stack.h ../cryptlib.h +encode.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +encode.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +encode.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +encode.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +encode.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +encode.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +encode.o: ../../include/openssl/err.h ../../include/openssl/evp.h +encode.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +encode.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +encode.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +encode.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +encode.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +encode.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +encode.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +encode.o: ../../include/openssl/stack.h ../cryptlib.h +evp_enc.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +evp_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +evp_enc.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +evp_enc.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +evp_enc.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +evp_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h +evp_enc.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +evp_enc.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +evp_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +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_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 +evp_err.o: ../../include/openssl/des.h ../../include/openssl/dh.h +evp_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h +evp_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h +evp_err.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +evp_err.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +evp_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +evp_err.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +evp_err.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +evp_err.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +evp_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +evp_err.o: ../../include/openssl/stack.h +evp_key.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +evp_key.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +evp_key.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +evp_key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +evp_key.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +evp_key.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +evp_key.o: ../../include/openssl/err.h ../../include/openssl/evp.h +evp_key.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +evp_key.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +evp_key.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +evp_key.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +evp_key.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +evp_key.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +evp_key.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +evp_key.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +evp_key.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +evp_key.o: ../cryptlib.h +evp_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +evp_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +evp_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +evp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +evp_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +evp_lib.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +evp_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h +evp_lib.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +evp_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +evp_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +evp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +evp_lib.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +evp_lib.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +evp_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +evp_lib.o: ../../include/openssl/stack.h ../cryptlib.h +evp_pbe.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +evp_pbe.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +evp_pbe.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +evp_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +evp_pbe.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +evp_pbe.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +evp_pbe.o: ../../include/openssl/err.h ../../include/openssl/evp.h +evp_pbe.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +evp_pbe.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +evp_pbe.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +evp_pbe.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +evp_pbe.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +evp_pbe.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +evp_pbe.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +evp_pbe.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +evp_pbe.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +evp_pbe.o: ../cryptlib.h +evp_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +evp_pkey.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +evp_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +evp_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +evp_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +evp_pkey.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +evp_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h +evp_pkey.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +evp_pkey.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +evp_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +evp_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +evp_pkey.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h +evp_pkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +evp_pkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +evp_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +evp_pkey.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +evp_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +m_dss.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +m_dss.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +m_dss.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +m_dss.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +m_dss.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +m_dss.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +m_dss.o: ../../include/openssl/err.h ../../include/openssl/evp.h +m_dss.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +m_dss.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +m_dss.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +m_dss.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +m_dss.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +m_dss.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +m_dss.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +m_dss.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +m_dss.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +m_dss.o: ../cryptlib.h +m_dss1.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +m_dss1.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +m_dss1.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +m_dss1.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +m_dss1.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +m_dss1.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +m_dss1.o: ../../include/openssl/err.h ../../include/openssl/evp.h +m_dss1.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +m_dss1.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +m_dss1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +m_dss1.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +m_dss1.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +m_dss1.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +m_dss1.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +m_dss1.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +m_dss1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +m_dss1.o: ../cryptlib.h +m_md2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +m_md2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +m_md2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +m_md2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +m_md2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +m_md2.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +m_md2.o: ../../include/openssl/err.h ../../include/openssl/evp.h +m_md2.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +m_md2.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +m_md2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +m_md2.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +m_md2.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +m_md2.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +m_md2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +m_md2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +m_md2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +m_md2.o: ../cryptlib.h +m_md5.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +m_md5.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +m_md5.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +m_md5.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +m_md5.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +m_md5.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +m_md5.o: ../../include/openssl/err.h ../../include/openssl/evp.h +m_md5.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +m_md5.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +m_md5.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +m_md5.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +m_md5.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +m_md5.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +m_md5.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +m_md5.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +m_md5.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +m_md5.o: ../cryptlib.h +m_mdc2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +m_mdc2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +m_mdc2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +m_mdc2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +m_mdc2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +m_mdc2.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +m_mdc2.o: ../../include/openssl/err.h ../../include/openssl/evp.h +m_mdc2.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +m_mdc2.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +m_mdc2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +m_mdc2.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +m_mdc2.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +m_mdc2.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +m_mdc2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +m_mdc2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +m_mdc2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +m_mdc2.o: ../cryptlib.h +m_null.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +m_null.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +m_null.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +m_null.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +m_null.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +m_null.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +m_null.o: ../../include/openssl/err.h ../../include/openssl/evp.h +m_null.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +m_null.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +m_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +m_null.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +m_null.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +m_null.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +m_null.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +m_null.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +m_null.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +m_null.o: ../cryptlib.h +m_ripemd.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +m_ripemd.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +m_ripemd.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +m_ripemd.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +m_ripemd.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +m_ripemd.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +m_ripemd.o: ../../include/openssl/err.h ../../include/openssl/evp.h +m_ripemd.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +m_ripemd.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +m_ripemd.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +m_ripemd.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +m_ripemd.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +m_ripemd.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +m_ripemd.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +m_ripemd.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +m_ripemd.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +m_ripemd.o: ../cryptlib.h +m_sha.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +m_sha.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +m_sha.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +m_sha.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +m_sha.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +m_sha.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +m_sha.o: ../../include/openssl/err.h ../../include/openssl/evp.h +m_sha.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +m_sha.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +m_sha.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +m_sha.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +m_sha.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +m_sha.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +m_sha.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +m_sha.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +m_sha.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +m_sha.o: ../cryptlib.h +m_sha1.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +m_sha1.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +m_sha1.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +m_sha1.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +m_sha1.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +m_sha1.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +m_sha1.o: ../../include/openssl/err.h ../../include/openssl/evp.h +m_sha1.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +m_sha1.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +m_sha1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +m_sha1.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +m_sha1.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +m_sha1.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +m_sha1.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +m_sha1.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +m_sha1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +m_sha1.o: ../cryptlib.h +names.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +names.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +names.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +names.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +names.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +names.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +names.o: ../../include/openssl/err.h ../../include/openssl/evp.h +names.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +names.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +names.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +names.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +names.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +names.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +names.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +names.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +names.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +names.o: ../cryptlib.h +p5_crpt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +p5_crpt.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +p5_crpt.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +p5_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +p5_crpt.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +p5_crpt.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +p5_crpt.o: ../../include/openssl/err.h ../../include/openssl/evp.h +p5_crpt.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +p5_crpt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +p5_crpt.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +p5_crpt.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +p5_crpt.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +p5_crpt.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +p5_crpt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +p5_crpt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +p5_crpt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +p5_crpt.o: ../cryptlib.h +p5_crpt2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +p5_crpt2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +p5_crpt2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +p5_crpt2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +p5_crpt2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +p5_crpt2.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +p5_crpt2.o: ../../include/openssl/err.h ../../include/openssl/evp.h +p5_crpt2.o: ../../include/openssl/hmac.h ../../include/openssl/idea.h +p5_crpt2.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +p5_crpt2.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +p5_crpt2.o: ../../include/openssl/opensslconf.h +p5_crpt2.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +p5_crpt2.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +p5_crpt2.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +p5_crpt2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +p5_crpt2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +p5_crpt2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +p5_crpt2.o: ../cryptlib.h +p_dec.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +p_dec.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +p_dec.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +p_dec.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +p_dec.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +p_dec.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +p_dec.o: ../../include/openssl/err.h ../../include/openssl/evp.h +p_dec.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +p_dec.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +p_dec.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +p_dec.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +p_dec.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h +p_dec.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +p_dec.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +p_dec.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +p_dec.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +p_dec.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +p_enc.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +p_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +p_enc.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +p_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +p_enc.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +p_enc.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +p_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h +p_enc.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +p_enc.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +p_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +p_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +p_enc.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h +p_enc.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +p_enc.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +p_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +p_enc.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +p_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +p_lib.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +p_lib.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +p_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +p_lib.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +p_lib.o: ../../include/openssl/des.h ../../include/openssl/dh.h +p_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +p_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +p_lib.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +p_lib.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +p_lib.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +p_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +p_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +p_lib.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +p_lib.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +p_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +p_lib.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +p_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +p_open.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +p_open.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +p_open.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +p_open.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +p_open.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +p_open.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +p_open.o: ../../include/openssl/err.h ../../include/openssl/evp.h +p_open.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +p_open.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +p_open.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +p_open.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +p_open.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +p_open.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +p_open.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +p_open.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +p_open.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +p_open.o: ../cryptlib.h +p_seal.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +p_seal.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +p_seal.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +p_seal.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +p_seal.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +p_seal.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +p_seal.o: ../../include/openssl/err.h ../../include/openssl/evp.h +p_seal.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +p_seal.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +p_seal.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +p_seal.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +p_seal.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h +p_seal.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +p_seal.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +p_seal.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +p_seal.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +p_seal.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +p_sign.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +p_sign.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +p_sign.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +p_sign.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +p_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +p_sign.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +p_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h +p_sign.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +p_sign.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +p_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +p_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +p_sign.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +p_sign.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +p_sign.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +p_sign.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +p_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +p_sign.o: ../cryptlib.h +p_verify.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +p_verify.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +p_verify.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +p_verify.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +p_verify.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +p_verify.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +p_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h +p_verify.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +p_verify.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +p_verify.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +p_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +p_verify.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +p_verify.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +p_verify.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +p_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +p_verify.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +p_verify.o: ../cryptlib.h diff --git a/src/lib/libcrypto/evp/bio_b64.c b/src/lib/libcrypto/evp/bio_b64.c index 73172b9a07..84729119df 100644 --- a/src/lib/libcrypto/evp/bio_b64.c +++ b/src/lib/libcrypto/evp/bio_b64.c @@ -59,10 +59,9 @@ #include #include #include "cryptlib.h" -#include "buffer.h" -#include "evp.h" +#include +#include -#ifndef NOPROTO static int b64_write(BIO *h,char *buf,int num); static int b64_read(BIO *h,char *buf,int size); /*static int b64_puts(BIO *h,char *str); */ @@ -70,16 +69,6 @@ static int b64_read(BIO *h,char *buf,int size); static long b64_ctrl(BIO *h,int cmd,long arg1,char *arg2); static int b64_new(BIO *h); static int b64_free(BIO *data); -#else -static int b64_write(); -static int b64_read(); -/*static int b64_puts(); */ -/*static int b64_gets(); */ -static long b64_ctrl(); -static int b64_new(); -static int b64_free(); -#endif - #define B64_BLOCK_SIZE 1024 #define B64_BLOCK_SIZE2 768 #define B64_NONE 0 @@ -113,13 +102,12 @@ static BIO_METHOD methods_b64= b64_free, }; -BIO_METHOD *BIO_f_base64() +BIO_METHOD *BIO_f_base64(void) { return(&methods_b64); } -static int b64_new(bi) -BIO *bi; +static int b64_new(BIO *bi) { BIO_B64_CTX *ctx; @@ -140,8 +128,7 @@ BIO *bi; return(1); } -static int b64_free(a) -BIO *a; +static int b64_free(BIO *a) { if (a == NULL) return(0); Free(a->ptr); @@ -151,10 +138,7 @@ BIO *a; return(1); } -static int b64_read(b,out,outl) -BIO *b; -char *out; -int outl; +static int b64_read(BIO *b, char *out, int outl) { int ret=0,i,ii,j,k,x,n,num,ret_code=0; BIO_B64_CTX *ctx; @@ -354,10 +338,7 @@ int outl; return((ret == 0)?ret_code:ret); } -static int b64_write(b,in,inl) -BIO *b; -char *in; -int inl; +static int b64_write(BIO *b, char *in, int inl) { int ret=inl,n,i; BIO_B64_CTX *ctx; @@ -451,11 +432,7 @@ int inl; return(ret); } -static long b64_ctrl(b,cmd,num,ptr) -BIO *b; -int cmd; -long num; -char *ptr; +static long b64_ctrl(BIO *b, int cmd, long num, char *ptr) { BIO_B64_CTX *ctx; long ret=1; diff --git a/src/lib/libcrypto/evp/bio_enc.c b/src/lib/libcrypto/evp/bio_enc.c index 6c30ddfc54..0a7b1ecf07 100644 --- a/src/lib/libcrypto/evp/bio_enc.c +++ b/src/lib/libcrypto/evp/bio_enc.c @@ -59,10 +59,9 @@ #include #include #include "cryptlib.h" -#include "buffer.h" -#include "evp.h" +#include +#include -#ifndef NOPROTO static int enc_write(BIO *h,char *buf,int num); static int enc_read(BIO *h,char *buf,int size); /*static int enc_puts(BIO *h,char *str); */ @@ -70,16 +69,6 @@ static int enc_read(BIO *h,char *buf,int size); static long enc_ctrl(BIO *h,int cmd,long arg1,char *arg2); static int enc_new(BIO *h); static int enc_free(BIO *data); -#else -static int enc_write(); -static int enc_read(); -/*static int enc_puts(); */ -/*static int enc_gets(); */ -static long enc_ctrl(); -static int enc_new(); -static int enc_free(); -#endif - #define ENC_BLOCK_SIZE (1024*4) typedef struct enc_struct @@ -105,13 +94,12 @@ static BIO_METHOD methods_enc= enc_free, }; -BIO_METHOD *BIO_f_cipher() +BIO_METHOD *BIO_f_cipher(void) { return(&methods_enc); } -static int enc_new(bi) -BIO *bi; +static int enc_new(BIO *bi) { BIO_ENC_CTX *ctx; @@ -131,8 +119,7 @@ BIO *bi; return(1); } -static int enc_free(a) -BIO *a; +static int enc_free(BIO *a) { BIO_ENC_CTX *b; @@ -147,10 +134,7 @@ BIO *a; return(1); } -static int enc_read(b,out,outl) -BIO *b; -char *out; -int outl; +static int enc_read(BIO *b, char *out, int outl) { int ret=0,i; BIO_ENC_CTX *ctx; @@ -230,10 +214,7 @@ int outl; return((ret == 0)?ctx->cont:ret); } -static int enc_write(b,in,inl) -BIO *b; -char *in; -int inl; +static int enc_write(BIO *b, char *in, int inl) { int ret=0,n,i; BIO_ENC_CTX *ctx; @@ -288,16 +269,13 @@ int inl; return(ret); } -static long enc_ctrl(b,cmd,num,ptr) -BIO *b; -int cmd; -long num; -char *ptr; +static long enc_ctrl(BIO *b, int cmd, long num, char *ptr) { BIO *dbio; BIO_ENC_CTX *ctx,*dctx; long ret=1; int i; + EVP_CIPHER_CTX **c_ctx; ctx=(BIO_ENC_CTX *)b->ptr; @@ -364,7 +342,11 @@ again: ret=BIO_ctrl(b->next_bio,cmd,num,ptr); BIO_copy_next_retry(b); break; - + case BIO_C_GET_CIPHER_CTX: + c_ctx=(EVP_CIPHER_CTX **)ptr; + (*c_ctx)= &(ctx->cipher); + b->init=1; + break; case BIO_CTRL_DUP: dbio=(BIO *)ptr; dctx=(BIO_ENC_CTX *)dbio->ptr; @@ -398,19 +380,15 @@ EVP_CIPHER_ctx *c; } */ -void BIO_set_cipher(b,c,k,i,e) -BIO *b; -EVP_CIPHER *c; -unsigned char *k; -unsigned char *i; -int e; +void BIO_set_cipher(BIO *b, const EVP_CIPHER *c, unsigned char *k, + unsigned char *i, int e) { BIO_ENC_CTX *ctx; if (b == NULL) return; if ((b->callback != NULL) && - (b->callback(b,BIO_CB_CTRL,(char *)c,BIO_CTRL_SET,e,0L) <= 0)) + (b->callback(b,BIO_CB_CTRL,(const char *)c,BIO_CTRL_SET,e,0L) <= 0)) return; b->init=1; @@ -418,6 +396,6 @@ int e; EVP_CipherInit(&(ctx->cipher),c,k,i,e); if (b->callback != NULL) - b->callback(b,BIO_CB_CTRL,(char *)c,BIO_CTRL_SET,e,1L); + b->callback(b,BIO_CB_CTRL,(const char *)c,BIO_CTRL_SET,e,1L); } diff --git a/src/lib/libcrypto/evp/bio_md.c b/src/lib/libcrypto/evp/bio_md.c index fa5fdc055b..317167f9c4 100644 --- a/src/lib/libcrypto/evp/bio_md.c +++ b/src/lib/libcrypto/evp/bio_md.c @@ -59,13 +59,12 @@ #include #include #include "cryptlib.h" -#include "buffer.h" -#include "evp.h" +#include +#include /* BIO_put and BIO_get both add to the digest, * BIO_gets returns the digest */ -#ifndef NOPROTO static int md_write(BIO *h,char *buf,int num); static int md_read(BIO *h,char *buf,int size); /*static int md_puts(BIO *h,char *str); */ @@ -73,16 +72,6 @@ static int md_gets(BIO *h,char *str,int size); static long md_ctrl(BIO *h,int cmd,long arg1,char *arg2); static int md_new(BIO *h); static int md_free(BIO *data); -#else -static int md_write(); -static int md_read(); -/*static int md_puts(); */ -static int md_gets(); -static long md_ctrl(); -static int md_new(); -static int md_free(); -#endif - static BIO_METHOD methods_md= { BIO_TYPE_MD,"message digest", @@ -95,13 +84,12 @@ static BIO_METHOD methods_md= md_free, }; -BIO_METHOD *BIO_f_md() +BIO_METHOD *BIO_f_md(void) { return(&methods_md); } -static int md_new(bi) -BIO *bi; +static int md_new(BIO *bi) { EVP_MD_CTX *ctx; @@ -114,8 +102,7 @@ BIO *bi; return(1); } -static int md_free(a) -BIO *a; +static int md_free(BIO *a) { if (a == NULL) return(0); Free(a->ptr); @@ -125,10 +112,7 @@ BIO *a; return(1); } -static int md_read(b,out,outl) -BIO *b; -char *out; -int outl; +static int md_read(BIO *b, char *out, int outl) { int ret=0; EVP_MD_CTX *ctx; @@ -152,10 +136,7 @@ int outl; return(ret); } -static int md_write(b,in,inl) -BIO *b; -char *in; -int inl; +static int md_write(BIO *b, char *in, int inl) { int ret=0; EVP_MD_CTX *ctx; @@ -178,14 +159,10 @@ int inl; return(ret); } -static long md_ctrl(b,cmd,num,ptr) -BIO *b; -int cmd; -long num; -char *ptr; +static long md_ctrl(BIO *b, int cmd, long num, char *ptr) { EVP_MD_CTX *ctx,*dctx,**pctx; - EVP_MD **ppmd; + const EVP_MD **ppmd; EVP_MD *md; long ret=1; BIO *dbio; @@ -204,7 +181,7 @@ char *ptr; case BIO_C_GET_MD: if (b->init) { - ppmd=(EVP_MD **)ptr; + ppmd=(const EVP_MD **)ptr; *ppmd=ctx->digest; } else @@ -243,10 +220,7 @@ char *ptr; return(ret); } -static int md_gets(bp,buf,size) -BIO *bp; -char *buf; -int size; +static int md_gets(BIO *bp, char *buf, int size) { EVP_MD_CTX *ctx; unsigned int ret; diff --git a/src/lib/libcrypto/evp/bio_ok.c b/src/lib/libcrypto/evp/bio_ok.c new file mode 100644 index 0000000000..101275d648 --- /dev/null +++ b/src/lib/libcrypto/evp/bio_ok.c @@ -0,0 +1,552 @@ +/* crypto/evp/bio_ok.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.] + */ + +/* + From: Arne Ansper + + Why BIO_f_reliable? + + I wrote function which took BIO* as argument, read data from it + and processed it. Then I wanted to store the input file in + encrypted form. OK I pushed BIO_f_cipher to the BIO stack + and everything was OK. BUT if user types wrong password + BIO_f_cipher outputs only garbage and my function crashes. Yes + I can and I should fix my function, but BIO_f_cipher is + easy way to add encryption support to many exisiting applications + and it's hard to debug and fix them all. + + So I wanted another BIO which would catch the incorrect passwords and + file damages which cause garbage on BIO_f_cipher's output. + + The easy way is to push the BIO_f_md and save the checksum at + the end of the file. However there are several problems with this + approach: + + 1) you must somehow separate checksum from actual data. + 2) you need lot's of memory when reading the file, because you + must read to the end of the file and verify the checksum before + leting the application to read the data. + + BIO_f_reliable tries to solve both problems, so that you can + read and write arbitraly long streams using only fixed amount + of memory. + + BIO_f_reliable splits data stream into blocks. Each block is prefixed + with it's length and suffixed with it's digest. So you need only + several Kbytes of memory to buffer single block before verifying + it's digest. + + BIO_f_reliable goes futher and adds several important capabilities: + + 1) the digest of the block is computed over the whole stream + -- so nobody can rearrange the blocks or remove or replace them. + + 2) to detect invalid passwords right at the start BIO_f_reliable + adds special prefix to the stream. In order to avoid known plain-text + attacks this prefix is generated as follows: + + *) digest is initialized with random seed instead of + standardized one. + *) same seed is written to ouput + *) well-known text is then hashed and the output + of the digest is also written to output. + + reader can now read the seed from stream, hash the same string + and then compare the digest output. + + Bad things: BIO_f_reliable knows what's going on in EVP_Digest. I + initialy wrote and tested this code on x86 machine and wrote the + digests out in machine-dependent order :( There are people using + this code and I cannot change this easily without making existing + data files unreadable. + +*/ + +#include +#include +#include "cryptlib.h" +#include +#include +#include +#include + +static int ok_write(BIO *h,char *buf,int num); +static int ok_read(BIO *h,char *buf,int size); +static long ok_ctrl(BIO *h,int cmd,long arg1,char *arg2); +static int ok_new(BIO *h); +static int ok_free(BIO *data); +static void sig_out(BIO* b); +static void sig_in(BIO* b); +static void block_out(BIO* b); +static void block_in(BIO* b); +#define OK_BLOCK_SIZE (1024*4) +#define OK_BLOCK_BLOCK 4 +#define IOBS (OK_BLOCK_SIZE+ OK_BLOCK_BLOCK+ 3*EVP_MAX_MD_SIZE) +#define WELLKNOWN "The quick brown fox jumped over the lazy dog's back." + +#ifndef L_ENDIAN +#define swapem(x) \ + ((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \ + (((unsigned long int)(x) & 0x0000ff00U) << 8) | \ + (((unsigned long int)(x) & 0x00ff0000U) >> 8) | \ + (((unsigned long int)(x) & 0xff000000U) >> 24))) +#else +#define swapem(x) (x) +#endif + +typedef struct ok_struct + { + int buf_len; + int buf_off; + int buf_len_save; + int buf_off_save; + int cont; /* <= 0 when finished */ + int finished; + EVP_MD_CTX md; + int blockout; /* output block is ready */ + int sigio; /* must process signature */ + char buf[IOBS]; + } BIO_OK_CTX; + +static BIO_METHOD methods_ok= + { + BIO_TYPE_CIPHER,"reliable", + ok_write, + ok_read, + NULL, /* ok_puts, */ + NULL, /* ok_gets, */ + ok_ctrl, + ok_new, + ok_free, + }; + +BIO_METHOD *BIO_f_reliable(void) + { + return(&methods_ok); + } + +static int ok_new(BIO *bi) + { + BIO_OK_CTX *ctx; + + ctx=(BIO_OK_CTX *)Malloc(sizeof(BIO_OK_CTX)); + if (ctx == NULL) return(0); + + ctx->buf_len=0; + ctx->buf_off=0; + ctx->buf_len_save=0; + ctx->buf_off_save=0; + ctx->cont=1; + ctx->finished=0; + ctx->blockout= 0; + ctx->sigio=1; + + bi->init=0; + bi->ptr=(char *)ctx; + bi->flags=0; + return(1); + } + +static int ok_free(BIO *a) + { + if (a == NULL) return(0); + memset(a->ptr,0,sizeof(BIO_OK_CTX)); + Free(a->ptr); + a->ptr=NULL; + a->init=0; + a->flags=0; + return(1); + } + +static int ok_read(BIO *b, char *out, int outl) + { + int ret=0,i,n; + BIO_OK_CTX *ctx; + + if (out == NULL) return(0); + ctx=(BIO_OK_CTX *)b->ptr; + + if ((ctx == NULL) || (b->next_bio == NULL) || (b->init == 0)) return(0); + + while(outl > 0) + { + + /* copy clean bytes to output buffer */ + if (ctx->blockout) + { + i=ctx->buf_len-ctx->buf_off; + if (i > outl) i=outl; + memcpy(out,&(ctx->buf[ctx->buf_off]),i); + ret+=i; + out+=i; + outl-=i; + ctx->buf_off+=i; + + /* all clean bytes are out */ + if (ctx->buf_len == ctx->buf_off) + { + ctx->buf_off=0; + + /* copy start of the next block into proper place */ + if(ctx->buf_len_save- ctx->buf_off_save > 0) + { + ctx->buf_len= ctx->buf_len_save- ctx->buf_off_save; + memmove(ctx->buf, &(ctx->buf[ctx->buf_off_save]), + ctx->buf_len); + } + else + { + ctx->buf_len=0; + } + ctx->blockout= 0; + } + } + + /* output buffer full -- cancel */ + if (outl == 0) break; + + /* no clean bytes in buffer -- fill it */ + n=IOBS- ctx->buf_len; + i=BIO_read(b->next_bio,&(ctx->buf[ctx->buf_len]),n); + + if (i <= 0) break; /* nothing new */ + + ctx->buf_len+= i; + + /* no signature yet -- check if we got one */ + if (ctx->sigio == 1) sig_in(b); + + /* signature ok -- check if we got block */ + if (ctx->sigio == 0) block_in(b); + + /* invalid block -- cancel */ + if (ctx->cont <= 0) break; + + } + + BIO_clear_retry_flags(b); + BIO_copy_next_retry(b); + return(ret); + } + +static int ok_write(BIO *b, char *in, int inl) + { + int ret=0,n,i; + BIO_OK_CTX *ctx; + + ctx=(BIO_OK_CTX *)b->ptr; + ret=inl; + + if ((ctx == NULL) || (b->next_bio == NULL) || (b->init == 0)) return(0); + + if(ctx->sigio) sig_out(b); + + do{ + BIO_clear_retry_flags(b); + n=ctx->buf_len-ctx->buf_off; + while (ctx->blockout && n > 0) + { + i=BIO_write(b->next_bio,&(ctx->buf[ctx->buf_off]),n); + if (i <= 0) + { + BIO_copy_next_retry(b); + if(!BIO_should_retry(b)) + ctx->cont= 0; + return(i); + } + ctx->buf_off+=i; + n-=i; + } + + /* at this point all pending data has been written */ + ctx->blockout= 0; + if (ctx->buf_len == ctx->buf_off) + { + ctx->buf_len=OK_BLOCK_BLOCK; + ctx->buf_off=0; + } + + if ((in == NULL) || (inl <= 0)) return(0); + + n= (inl+ ctx->buf_len > OK_BLOCK_SIZE+ OK_BLOCK_BLOCK) ? + OK_BLOCK_SIZE+ OK_BLOCK_BLOCK- ctx->buf_len : inl; + + memcpy((unsigned char *)(&(ctx->buf[ctx->buf_len])),(unsigned char *)in,n); + ctx->buf_len+= n; + inl-=n; + in+=n; + + if(ctx->buf_len >= OK_BLOCK_SIZE+ OK_BLOCK_BLOCK) + { + block_out(b); + } + }while(inl > 0); + + BIO_clear_retry_flags(b); + BIO_copy_next_retry(b); + return(ret); + } + +static long ok_ctrl(BIO *b, int cmd, long num, char *ptr) + { + BIO_OK_CTX *ctx; + EVP_MD *md; + const EVP_MD **ppmd; + long ret=1; + int i; + + ctx=(BIO_OK_CTX *)b->ptr; + + switch (cmd) + { + case BIO_CTRL_RESET: + ctx->buf_len=0; + ctx->buf_off=0; + ctx->buf_len_save=0; + ctx->buf_off_save=0; + ctx->cont=1; + ctx->finished=0; + ctx->blockout= 0; + ctx->sigio=1; + ret=BIO_ctrl(b->next_bio,cmd,num,ptr); + break; + case BIO_CTRL_EOF: /* More to read */ + if (ctx->cont <= 0) + ret=1; + else + ret=BIO_ctrl(b->next_bio,cmd,num,ptr); + break; + case BIO_CTRL_PENDING: /* More to read in buffer */ + case BIO_CTRL_WPENDING: /* More to read in buffer */ + ret=ctx->blockout ? ctx->buf_len-ctx->buf_off : 0; + if (ret <= 0) + ret=BIO_ctrl(b->next_bio,cmd,num,ptr); + break; + case BIO_CTRL_FLUSH: + /* do a final write */ + if(ctx->blockout == 0) + block_out(b); + + while (ctx->blockout) + { + i=ok_write(b,NULL,0); + if (i < 0) + { + ret=i; + break; + } + } + + ctx->finished=1; + ctx->buf_off=ctx->buf_len=0; + ctx->cont=(int)ret; + + /* Finally flush the underlying BIO */ + ret=BIO_ctrl(b->next_bio,cmd,num,ptr); + break; + case BIO_C_DO_STATE_MACHINE: + BIO_clear_retry_flags(b); + ret=BIO_ctrl(b->next_bio,cmd,num,ptr); + BIO_copy_next_retry(b); + break; + case BIO_CTRL_INFO: + ret=(long)ctx->cont; + break; + case BIO_C_SET_MD: + md=(EVP_MD *)ptr; + EVP_DigestInit(&(ctx->md),md); + b->init=1; + break; + case BIO_C_GET_MD: + if (b->init) + { + ppmd=(const EVP_MD **)ptr; + *ppmd=ctx->md.digest; + } + else + ret=0; + break; + default: + ret=BIO_ctrl(b->next_bio,cmd,num,ptr); + break; + } + return(ret); + } + +static void longswap(void *_ptr, int len) +{ +#ifndef L_ENDIAN + int i; + char *ptr=_ptr; + + for(i= 0;i < len;i+= 4){ + *((unsigned long *)&(ptr[i]))= swapem(*((unsigned long *)&(ptr[i]))); + } +#endif +} + +static void sig_out(BIO* b) + { + BIO_OK_CTX *ctx; + EVP_MD_CTX *md; + + ctx=(BIO_OK_CTX *)b->ptr; + md= &(ctx->md); + + if(ctx->buf_len+ 2* md->digest->md_size > OK_BLOCK_SIZE) return; + + EVP_DigestInit(md, md->digest); + RAND_bytes(&(md->md.base[0]), md->digest->md_size); + memcpy(&(ctx->buf[ctx->buf_len]), &(md->md.base[0]), md->digest->md_size); + longswap(&(ctx->buf[ctx->buf_len]), md->digest->md_size); + ctx->buf_len+= md->digest->md_size; + + EVP_DigestUpdate(md, (unsigned char*)WELLKNOWN, strlen(WELLKNOWN)); + md->digest->final(&(ctx->buf[ctx->buf_len]), &(md->md.base[0])); + ctx->buf_len+= md->digest->md_size; + ctx->blockout= 1; + ctx->sigio= 0; + } + +static void sig_in(BIO* b) + { + BIO_OK_CTX *ctx; + EVP_MD_CTX *md; + unsigned char tmp[EVP_MAX_MD_SIZE]; + int ret= 0; + + ctx=(BIO_OK_CTX *)b->ptr; + md= &(ctx->md); + + if(ctx->buf_len- ctx->buf_off < 2* md->digest->md_size) return; + + EVP_DigestInit(md, md->digest); + memcpy(&(md->md.base[0]), &(ctx->buf[ctx->buf_off]), md->digest->md_size); + longswap(&(md->md.base[0]), md->digest->md_size); + ctx->buf_off+= md->digest->md_size; + + EVP_DigestUpdate(md, (unsigned char*)WELLKNOWN, strlen(WELLKNOWN)); + md->digest->final(tmp, &(md->md.base[0])); + ret= memcmp(&(ctx->buf[ctx->buf_off]), tmp, md->digest->md_size) == 0; + ctx->buf_off+= md->digest->md_size; + if(ret == 1) + { + ctx->sigio= 0; + if(ctx->buf_len != ctx->buf_off) + { + memmove(ctx->buf, &(ctx->buf[ctx->buf_off]), ctx->buf_len- ctx->buf_off); + } + ctx->buf_len-= ctx->buf_off; + ctx->buf_off= 0; + } + else + { + ctx->cont= 0; + } + } + +static void block_out(BIO* b) + { + BIO_OK_CTX *ctx; + EVP_MD_CTX *md; + unsigned long tl; + + ctx=(BIO_OK_CTX *)b->ptr; + md= &(ctx->md); + + tl= ctx->buf_len- OK_BLOCK_BLOCK; + tl= swapem(tl); + memcpy(ctx->buf, &tl, OK_BLOCK_BLOCK); + tl= swapem(tl); + EVP_DigestUpdate(md, (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl); + md->digest->final(&(ctx->buf[ctx->buf_len]), &(md->md.base[0])); + ctx->buf_len+= md->digest->md_size; + ctx->blockout= 1; + } + +static void block_in(BIO* b) + { + BIO_OK_CTX *ctx; + EVP_MD_CTX *md; + long tl= 0; + unsigned char tmp[EVP_MAX_MD_SIZE]; + + ctx=(BIO_OK_CTX *)b->ptr; + md= &(ctx->md); + + memcpy(&tl, ctx->buf, OK_BLOCK_BLOCK); + tl= swapem(tl); + if (ctx->buf_len < tl+ OK_BLOCK_BLOCK+ md->digest->md_size) return; + + EVP_DigestUpdate(md, (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl); + md->digest->final(tmp, &(md->md.base[0])); + if(memcmp(&(ctx->buf[tl+ OK_BLOCK_BLOCK]), tmp, md->digest->md_size) == 0) + { + /* there might be parts from next block lurking around ! */ + ctx->buf_off_save= tl+ OK_BLOCK_BLOCK+ md->digest->md_size; + ctx->buf_len_save= ctx->buf_len; + ctx->buf_off= OK_BLOCK_BLOCK; + ctx->buf_len= tl+ OK_BLOCK_BLOCK; + ctx->blockout= 1; + } + else + { + ctx->cont= 0; + } + } + diff --git a/src/lib/libcrypto/evp/c_all.c b/src/lib/libcrypto/evp/c_all.c index e77d1c896b..a4d3b43fb9 100644 --- a/src/lib/libcrypto/evp/c_all.c +++ b/src/lib/libcrypto/evp/c_all.c @@ -58,16 +58,17 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include +#include -void SSLeay_add_all_algorithms() +void SSLeay_add_all_algorithms(void) { SSLeay_add_all_ciphers(); SSLeay_add_all_digests(); } -void SSLeay_add_all_ciphers() +void SSLeay_add_all_ciphers(void) { #ifndef NO_DES EVP_add_cipher(EVP_des_cfb()); @@ -79,16 +80,16 @@ void SSLeay_add_all_ciphers() EVP_add_cipher(EVP_des_ede3_ofb()); EVP_add_cipher(EVP_desx_cbc()); - EVP_add_alias(SN_desx_cbc,"DESX"); - EVP_add_alias(SN_desx_cbc,"desx"); + EVP_add_cipher_alias(SN_desx_cbc,"DESX"); + EVP_add_cipher_alias(SN_desx_cbc,"desx"); EVP_add_cipher(EVP_des_cbc()); - EVP_add_alias(SN_des_cbc,"DES"); - EVP_add_alias(SN_des_cbc,"des"); + EVP_add_cipher_alias(SN_des_cbc,"DES"); + EVP_add_cipher_alias(SN_des_cbc,"des"); EVP_add_cipher(EVP_des_ede_cbc()); EVP_add_cipher(EVP_des_ede3_cbc()); - EVP_add_alias(SN_des_ede3_cbc,"DES3"); - EVP_add_alias(SN_des_ede3_cbc,"des3"); + EVP_add_cipher_alias(SN_des_ede3_cbc,"DES3"); + EVP_add_cipher_alias(SN_des_ede3_cbc,"des3"); EVP_add_cipher(EVP_des_ecb()); EVP_add_cipher(EVP_des_ede()); @@ -105,8 +106,8 @@ void SSLeay_add_all_ciphers() EVP_add_cipher(EVP_idea_cfb()); EVP_add_cipher(EVP_idea_ofb()); EVP_add_cipher(EVP_idea_cbc()); - EVP_add_alias(SN_idea_cbc,"IDEA"); - EVP_add_alias(SN_idea_cbc,"idea"); + EVP_add_cipher_alias(SN_idea_cbc,"IDEA"); + EVP_add_cipher_alias(SN_idea_cbc,"idea"); #endif #ifndef NO_RC2 @@ -115,18 +116,19 @@ void SSLeay_add_all_ciphers() EVP_add_cipher(EVP_rc2_ofb()); EVP_add_cipher(EVP_rc2_cbc()); EVP_add_cipher(EVP_rc2_40_cbc()); - EVP_add_alias(SN_rc2_cbc,"RC2"); - EVP_add_alias(SN_rc2_cbc,"rc2"); + EVP_add_cipher(EVP_rc2_64_cbc()); + EVP_add_cipher_alias(SN_rc2_cbc,"RC2"); + EVP_add_cipher_alias(SN_rc2_cbc,"rc2"); #endif -#ifndef NO_BLOWFISH +#ifndef NO_BF EVP_add_cipher(EVP_bf_ecb()); EVP_add_cipher(EVP_bf_cfb()); EVP_add_cipher(EVP_bf_ofb()); EVP_add_cipher(EVP_bf_cbc()); - EVP_add_alias(SN_bf_cbc,"BF"); - EVP_add_alias(SN_bf_cbc,"bf"); - EVP_add_alias(SN_bf_cbc,"blowfish"); + EVP_add_cipher_alias(SN_bf_cbc,"BF"); + EVP_add_cipher_alias(SN_bf_cbc,"bf"); + EVP_add_cipher_alias(SN_bf_cbc,"blowfish"); #endif #ifndef NO_CAST @@ -134,10 +136,10 @@ void SSLeay_add_all_ciphers() EVP_add_cipher(EVP_cast5_cfb()); EVP_add_cipher(EVP_cast5_ofb()); EVP_add_cipher(EVP_cast5_cbc()); - EVP_add_alias(SN_cast5_cbc,"CAST"); - EVP_add_alias(SN_cast5_cbc,"cast"); - EVP_add_alias(SN_cast5_cbc,"CAST-cbc"); - EVP_add_alias(SN_cast5_cbc,"cast-cbc"); + EVP_add_cipher_alias(SN_cast5_cbc,"CAST"); + EVP_add_cipher_alias(SN_cast5_cbc,"cast"); + EVP_add_cipher_alias(SN_cast5_cbc,"CAST-cbc"); + EVP_add_cipher_alias(SN_cast5_cbc,"cast-cbc"); #endif #ifndef NO_RC5 @@ -145,23 +147,21 @@ void SSLeay_add_all_ciphers() EVP_add_cipher(EVP_rc5_32_12_16_cfb()); EVP_add_cipher(EVP_rc5_32_12_16_ofb()); EVP_add_cipher(EVP_rc5_32_12_16_cbc()); - EVP_add_alias(SN_rc5_cbc,"rc5"); - EVP_add_alias(SN_rc5_cbc,"RC5"); - EVP_add_alias(SN_rc5_cbc,"rc5-cbc"); - EVP_add_alias(SN_rc5_cbc,"RC5-cbc"); + EVP_add_cipher_alias(SN_rc5_cbc,"rc5"); + EVP_add_cipher_alias(SN_rc5_cbc,"RC5"); #endif } -void SSLeay_add_all_digests() +void SSLeay_add_all_digests(void) { #ifndef NO_MD2 EVP_add_digest(EVP_md2()); #endif #ifndef NO_MD5 EVP_add_digest(EVP_md5()); - EVP_add_alias(SN_md5,"ssl2-md5"); - EVP_add_alias(SN_md5,"ssl3-md5"); + EVP_add_digest_alias(SN_md5,"ssl2-md5"); + EVP_add_digest_alias(SN_md5,"ssl3-md5"); #endif #ifndef NO_SHA EVP_add_digest(EVP_sha()); @@ -169,22 +169,25 @@ void SSLeay_add_all_digests() EVP_add_digest(EVP_dss()); #endif #endif -#ifndef NO_SHA1 +#ifndef NO_SHA EVP_add_digest(EVP_sha1()); - EVP_add_alias(SN_sha1,"ssl3-sha1"); + EVP_add_digest_alias(SN_sha1,"ssl3-sha1"); + EVP_add_digest_alias(SN_sha1WithRSAEncryption,SN_sha1WithRSA); #ifndef NO_DSA EVP_add_digest(EVP_dss1()); - EVP_add_alias(SN_dsaWithSHA1,SN_dsaWithSHA1_2); - EVP_add_alias(SN_dsaWithSHA1,"DSS1"); - EVP_add_alias(SN_dsaWithSHA1,"dss1"); + EVP_add_digest_alias(SN_dsaWithSHA1,SN_dsaWithSHA1_2); + EVP_add_digest_alias(SN_dsaWithSHA1,"DSS1"); + EVP_add_digest_alias(SN_dsaWithSHA1,"dss1"); #endif #endif #if !defined(NO_MDC2) && !defined(NO_DES) EVP_add_digest(EVP_mdc2()); #endif -#ifndef NO_RIPEMD160 +#ifndef NO_RIPEMD EVP_add_digest(EVP_ripemd160()); - EVP_add_alias(SN_ripemd160,"ripemd"); - EVP_add_alias(SN_ripemd160,"rmd160"); + EVP_add_digest_alias(SN_ripemd160,"ripemd"); + EVP_add_digest_alias(SN_ripemd160,"rmd160"); #endif + PKCS12_PBE_add(); + PKCS5_PBE_add(); } diff --git a/src/lib/libcrypto/evp/digest.c b/src/lib/libcrypto/evp/digest.c index d65f0036f7..c560733568 100644 --- a/src/lib/libcrypto/evp/digest.c +++ b/src/lib/libcrypto/evp/digest.c @@ -58,32 +58,35 @@ #include #include "cryptlib.h" -#include "objects.h" -#include "evp.h" +#include +#include -void EVP_DigestInit(ctx,type) -EVP_MD_CTX *ctx; -EVP_MD *type; +void EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) { ctx->digest=type; type->init(&(ctx->md)); } -void EVP_DigestUpdate(ctx,data,count) -EVP_MD_CTX *ctx; -unsigned char *data; -unsigned int count; +void EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, + unsigned int count) { ctx->digest->update(&(ctx->md.base[0]),data,(unsigned long)count); } -void EVP_DigestFinal(ctx,md,size) -EVP_MD_CTX *ctx; -unsigned char *md; -unsigned int *size; +void EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) { ctx->digest->final(md,&(ctx->md.base[0])); if (size != NULL) *size=ctx->digest->md_size; memset(&(ctx->md),0,sizeof(ctx->md)); } + +int EVP_MD_CTX_copy(EVP_MD_CTX *out, EVP_MD_CTX *in) +{ + if ((in == NULL) || (in->digest == NULL)) { + EVPerr(EVP_F_EVP_MD_CTX_COPY,EVP_R_INPUT_NOT_INITIALIZED); + return 0; + } + memcpy((char *)out,(char *)in,in->digest->ctx_size); + return 1; +} diff --git a/src/lib/libcrypto/evp/e_cbc_3d.c b/src/lib/libcrypto/evp/e_cbc_3d.c index 5761bf186a..02ccc6dc90 100644 --- a/src/lib/libcrypto/evp/e_cbc_3d.c +++ b/src/lib/libcrypto/evp/e_cbc_3d.c @@ -56,24 +56,18 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DES #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void des_cbc_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void des_cbc_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void des_cbc_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void des_cbc_ede_init_key(); -static void des_cbc_ede3_init_key(); -static void des_cbc_ede_cipher(); -#endif - static EVP_CIPHER d_cbc_ede_cipher2= { NID_des_ede_cbc, @@ -83,8 +77,8 @@ static EVP_CIPHER d_cbc_ede_cipher2= NULL, sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ede)), - EVP_CIPHER_get_asn1_iv, EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, }; static EVP_CIPHER d_cbc_ede_cipher3= @@ -100,64 +94,58 @@ static EVP_CIPHER d_cbc_ede_cipher3= EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_des_ede_cbc() +EVP_CIPHER *EVP_des_ede_cbc(void) { return(&d_cbc_ede_cipher2); } -EVP_CIPHER *EVP_des_ede3_cbc() +EVP_CIPHER *EVP_des_ede3_cbc(void) { return(&d_cbc_ede_cipher3); } -static void des_cbc_ede_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void des_cbc_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { + des_cblock *deskey = (des_cblock *)key; + if (iv != NULL) memcpy(&(ctx->oiv[0]),iv,8); memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); - if (key != NULL) + if (deskey != NULL) { - des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); - des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + des_set_key(&deskey[0],ctx->c.des_ede.ks1); + des_set_key(&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)); } } -static void des_cbc_ede3_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void des_cbc_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { + des_cblock *deskey = (des_cblock *)key; + if (iv != NULL) memcpy(&(ctx->oiv[0]),iv,8); memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); - if (key != NULL) + if (deskey != NULL) { - des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); - des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); - des_set_key((des_cblock *)&(key[16]),ctx->c.des_ede.ks3); + des_set_key(&deskey[0],ctx->c.des_ede.ks1); + des_set_key(&deskey[1],ctx->c.des_ede.ks2); + des_set_key(&deskey[2],ctx->c.des_ede.ks3); } } -static void des_cbc_ede_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void des_cbc_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { - des_ede3_cbc_encrypt( - (des_cblock *)in,(des_cblock *)out, - (long)inl, ctx->c.des_ede.ks1, + 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]), + (des_cblock *) &(ctx->iv[0]), ctx->encrypt); } +#endif diff --git a/src/lib/libcrypto/evp/e_cbc_bf.c b/src/lib/libcrypto/evp/e_cbc_bf.c index be605f4a13..9bcba3c516 100644 --- a/src/lib/libcrypto/evp/e_cbc_bf.c +++ b/src/lib/libcrypto/evp/e_cbc_bf.c @@ -56,23 +56,16 @@ * [including the GNU Public Licence.] */ -#ifndef NO_BLOWFISH - +#ifndef NO_BF #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void bf_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void bf_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void bf_cbc_init_key(); -static void bf_cbc_cipher(); -#endif - static EVP_CIPHER bfish_cbc_cipher= { NID_bf_cbc, @@ -82,20 +75,17 @@ static EVP_CIPHER bfish_cbc_cipher= NULL, sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ sizeof((((EVP_CIPHER_CTX *)NULL)->c.bf_ks)), - EVP_CIPHER_get_asn1_iv, EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_bf_cbc() +EVP_CIPHER *EVP_bf_cbc(void) { return(&bfish_cbc_cipher); } -static void bf_cbc_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void bf_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { if (iv != NULL) memcpy(&(ctx->oiv[0]),iv,8); @@ -104,11 +94,8 @@ int enc; BF_set_key(&(ctx->c.bf_ks),EVP_BLOWFISH_KEY_SIZE,key); } -static void bf_cbc_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void bf_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { BF_cbc_encrypt( in,out,(long)inl, diff --git a/src/lib/libcrypto/evp/e_cbc_c.c b/src/lib/libcrypto/evp/e_cbc_c.c index b50c7874b3..6845b0b44c 100644 --- a/src/lib/libcrypto/evp/e_cbc_c.c +++ b/src/lib/libcrypto/evp/e_cbc_c.c @@ -60,19 +60,13 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void cast_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void cast_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void cast_cbc_init_key(); -static void cast_cbc_cipher(); -#endif - static EVP_CIPHER cast5_cbc_cipher= { NID_cast5_cbc, @@ -82,20 +76,17 @@ static EVP_CIPHER cast5_cbc_cipher= NULL, sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ sizeof((((EVP_CIPHER_CTX *)NULL)->c.cast_ks)), - EVP_CIPHER_get_asn1_iv, EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_cast5_cbc() +EVP_CIPHER *EVP_cast5_cbc(void) { return(&cast5_cbc_cipher); } -static void cast_cbc_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void cast_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { if (iv != NULL) memcpy(&(ctx->oiv[0]),iv,8); @@ -104,11 +95,8 @@ int enc; CAST_set_key(&(ctx->c.cast_ks),EVP_CAST5_KEY_SIZE,key); } -static void cast_cbc_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void cast_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { CAST_cbc_encrypt( in,out,(long)inl, diff --git a/src/lib/libcrypto/evp/e_cbc_d.c b/src/lib/libcrypto/evp/e_cbc_d.c index c67706e3a0..9203f3f52d 100644 --- a/src/lib/libcrypto/evp/e_cbc_d.c +++ b/src/lib/libcrypto/evp/e_cbc_d.c @@ -56,21 +56,16 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DES #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void des_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void des_cbc_init_key(); -static void des_cbc_cipher(); -#endif - static EVP_CIPHER d_cbc_cipher= { NID_des_cbc, @@ -80,37 +75,32 @@ static EVP_CIPHER d_cbc_cipher= NULL, sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ sizeof((((EVP_CIPHER_CTX *)NULL)->c.des_ks)), - EVP_CIPHER_get_asn1_iv, EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_des_cbc() +EVP_CIPHER *EVP_des_cbc(void) { return(&d_cbc_cipher); } -static void des_cbc_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void des_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { + des_cblock *deskey = (des_cblock *)key; + if (iv != NULL) memcpy(&(ctx->oiv[0]),iv,8); memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); - if (key != NULL) - des_set_key((des_cblock *)key,ctx->c.des_ks); + if (deskey != NULL) + des_set_key(deskey,ctx->c.des_ks); } -static void des_cbc_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { - des_ncbc_encrypt( - (des_cblock *)in,(des_cblock *)out, - (long)inl, ctx->c.des_ks, + des_ncbc_encrypt(in,out,inl,ctx->c.des_ks, (des_cblock *)&(ctx->iv[0]), ctx->encrypt); } +#endif diff --git a/src/lib/libcrypto/evp/e_cbc_i.c b/src/lib/libcrypto/evp/e_cbc_i.c index 312ffcb721..34b44aa21f 100644 --- a/src/lib/libcrypto/evp/e_cbc_i.c +++ b/src/lib/libcrypto/evp/e_cbc_i.c @@ -60,19 +60,13 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void idea_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void idea_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void idea_cbc_init_key(); -static void idea_cbc_cipher(); -#endif - static EVP_CIPHER i_cbc_cipher= { NID_idea_cbc, @@ -82,20 +76,17 @@ static EVP_CIPHER i_cbc_cipher= NULL, sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ sizeof((((EVP_CIPHER_CTX *)NULL)->c.idea_ks)), - EVP_CIPHER_get_asn1_iv, EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_idea_cbc() +EVP_CIPHER *EVP_idea_cbc(void) { return(&i_cbc_cipher); } -static void idea_cbc_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void idea_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { if (iv != NULL) memcpy(&(ctx->oiv[0]),iv,8); @@ -116,11 +107,8 @@ int enc; } } -static void idea_cbc_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void idea_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { idea_cbc_encrypt( in,out,(long)inl, diff --git a/src/lib/libcrypto/evp/e_cbc_r2.c b/src/lib/libcrypto/evp/e_cbc_r2.c index 4f8002f16d..9dfada4ea6 100644 --- a/src/lib/libcrypto/evp/e_cbc_r2.c +++ b/src/lib/libcrypto/evp/e_cbc_r2.c @@ -60,18 +60,21 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void rc2_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void rc2_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void rc2_cbc_init_key(); -static void rc2_cbc_cipher(); -#endif +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= { @@ -82,8 +85,21 @@ static EVP_CIPHER r2_cbc_cipher= NULL, sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2_ks)), - EVP_CIPHER_get_asn1_iv, - EVP_CIPHER_set_asn1_iv, + rc2_set_asn1_type_and_iv, + rc2_get_asn1_type_and_iv, + }; + +static EVP_CIPHER r2_64_cbc_cipher= + { + NID_rc2_64_cbc, + 8,8 /* 64 bit */,8, + 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, }; static EVP_CIPHER r2_40_cbc_cipher= @@ -95,23 +111,27 @@ static EVP_CIPHER r2_40_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, }; -EVP_CIPHER *EVP_rc2_cbc() +EVP_CIPHER *EVP_rc2_cbc(void) { return(&r2_cbc_cipher); } -EVP_CIPHER *EVP_rc2_40_cbc() +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 void rc2_cbc_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void rc2_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { if (iv != NULL) memcpy(&(ctx->oiv[0]),iv,8); @@ -121,11 +141,8 @@ int enc; key,EVP_CIPHER_CTX_key_length(ctx)*8); } -static void rc2_cbc_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void rc2_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { RC2_cbc_encrypt( in,out,(long)inl, @@ -133,4 +150,67 @@ unsigned int inl; ctx->encrypt); } +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; + 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/src/lib/libcrypto/evp/e_cbc_r5.c b/src/lib/libcrypto/evp/e_cbc_r5.c index f7d46ca91f..cea3fe333a 100644 --- a/src/lib/libcrypto/evp/e_cbc_r5.c +++ b/src/lib/libcrypto/evp/e_cbc_r5.c @@ -60,19 +60,13 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void r_32_12_16_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void r_32_12_16_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void r_32_12_16_cbc_init_key(); -static void r_32_12_16_cbc_cipher(); -#endif - static EVP_CIPHER rc5_32_12_16_cbc_cipher= { NID_rc5_cbc, @@ -86,16 +80,13 @@ static EVP_CIPHER rc5_32_12_16_cbc_cipher= NULL, }; -EVP_CIPHER *EVP_rc5_32_12_16_cbc() +EVP_CIPHER *EVP_rc5_32_12_16_cbc(void) { return(&rc5_32_12_16_cbc_cipher); } -static void r_32_12_16_cbc_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void r_32_12_16_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { if (iv != NULL) memcpy(&(ctx->oiv[0]),iv,8); @@ -105,11 +96,8 @@ int enc; key,RC5_12_ROUNDS); } -static void r_32_12_16_cbc_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void 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, diff --git a/src/lib/libcrypto/evp/e_cfb_3d.c b/src/lib/libcrypto/evp/e_cfb_3d.c index e7e3419411..bd32b072e2 100644 --- a/src/lib/libcrypto/evp/e_cfb_3d.c +++ b/src/lib/libcrypto/evp/e_cfb_3d.c @@ -56,24 +56,18 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DES #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void des_ede_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void des_ede3_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void des_ede_cfb_init_key(); -static void des_ede3_cfb_init_key(); -static void des_ede_cfb_cipher(); -#endif - static EVP_CIPHER d_ede_cfb_cipher2= { NID_des_ede_cfb64, @@ -100,67 +94,62 @@ static EVP_CIPHER d_ede3_cfb_cipher3= EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_des_ede_cfb() +EVP_CIPHER *EVP_des_ede_cfb(void) { return(&d_ede_cfb_cipher2); } -EVP_CIPHER *EVP_des_ede3_cfb() +EVP_CIPHER *EVP_des_ede3_cfb(void) { return(&d_ede3_cfb_cipher3); } -static void des_ede_cfb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void des_ede_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { + des_cblock *deskey = (des_cblock *)key; + ctx->num=0; if (iv != NULL) memcpy(&(ctx->oiv[0]),iv,8); memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); - if (key != NULL) + if (deskey != NULL) { - des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); - des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + des_set_key(&deskey[0],ctx->c.des_ede.ks1); + des_set_key(&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)); } } -static void des_ede3_cfb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void des_ede3_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { + des_cblock *deskey = (des_cblock *)key; + ctx->num=0; if (iv != NULL) memcpy(&(ctx->oiv[0]),iv,8); memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); - if (key != NULL) + if (deskey != NULL) { - des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); - des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); - des_set_key((des_cblock *)&(key[16]),ctx->c.des_ede.ks3); + des_set_key(&deskey[0],ctx->c.des_ede.ks1); + des_set_key(&deskey[1],ctx->c.des_ede.ks2); + des_set_key(&deskey[2],ctx->c.des_ede.ks3); } } -static void des_ede_cfb_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void 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); + 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); } +#endif diff --git a/src/lib/libcrypto/evp/e_cfb_bf.c b/src/lib/libcrypto/evp/e_cfb_bf.c index 8aba2564b8..63e1e624ea 100644 --- a/src/lib/libcrypto/evp/e_cfb_bf.c +++ b/src/lib/libcrypto/evp/e_cfb_bf.c @@ -56,23 +56,16 @@ * [including the GNU Public Licence.] */ -#ifndef NO_BLOWFISH - +#ifndef NO_BF #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void bf_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void bf_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void bf_cfb_init_key(); -static void bf_cfb_cipher(); -#endif - static EVP_CIPHER bfish_cfb_cipher= { NID_bf_cfb64, @@ -86,16 +79,13 @@ static EVP_CIPHER bfish_cfb_cipher= EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_bf_cfb() +EVP_CIPHER *EVP_bf_cfb(void) { return(&bfish_cfb_cipher); } -static void bf_cfb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void bf_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { ctx->num=0; @@ -106,11 +96,8 @@ int enc; BF_set_key(&(ctx->c.bf_ks),EVP_BLOWFISH_KEY_SIZE,key); } -static void bf_cfb_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void bf_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { BF_cfb64_encrypt( in,out, diff --git a/src/lib/libcrypto/evp/e_cfb_c.c b/src/lib/libcrypto/evp/e_cfb_c.c index 936df55fd8..f04bac034b 100644 --- a/src/lib/libcrypto/evp/e_cfb_c.c +++ b/src/lib/libcrypto/evp/e_cfb_c.c @@ -60,19 +60,13 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void cast_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void cast_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void cast_cfb_init_key(); -static void cast_cfb_cipher(); -#endif - static EVP_CIPHER cast5_cfb_cipher= { NID_cast5_cfb64, @@ -86,16 +80,13 @@ static EVP_CIPHER cast5_cfb_cipher= EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_cast5_cfb() +EVP_CIPHER *EVP_cast5_cfb(void) { return(&cast5_cfb_cipher); } -static void cast_cfb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void cast_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { ctx->num=0; @@ -106,11 +97,8 @@ int enc; CAST_set_key(&(ctx->c.cast_ks),EVP_CAST5_KEY_SIZE,key); } -static void cast_cfb_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void cast_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { CAST_cfb64_encrypt( in,out, diff --git a/src/lib/libcrypto/evp/e_cfb_d.c b/src/lib/libcrypto/evp/e_cfb_d.c index 9ae4558f51..6bdf20b646 100644 --- a/src/lib/libcrypto/evp/e_cfb_d.c +++ b/src/lib/libcrypto/evp/e_cfb_d.c @@ -58,19 +58,14 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO +#ifndef NO_DES static void des_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void des_cfb_init_key(); -static void des_cfb_cipher(); -#endif - static EVP_CIPHER d_cfb_cipher= { NID_des_cfb64, @@ -84,31 +79,27 @@ static EVP_CIPHER d_cfb_cipher= EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_des_cfb() +EVP_CIPHER *EVP_des_cfb(void) { return(&d_cfb_cipher); } -static void des_cfb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void des_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { + des_cblock *deskey = (des_cblock *)key; + ctx->num=0; if (iv != NULL) memcpy(&(ctx->oiv[0]),iv,8); memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); - if (key != NULL) - des_set_key((des_cblock *)key,ctx->c.des_ks); + if (deskey != NULL) + des_set_key(deskey,ctx->c.des_ks); } -static void des_cfb_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { des_cfb64_encrypt( in,out, @@ -116,3 +107,4 @@ unsigned int inl; (des_cblock *)&(ctx->iv[0]), &ctx->num,ctx->encrypt); } +#endif diff --git a/src/lib/libcrypto/evp/e_cfb_i.c b/src/lib/libcrypto/evp/e_cfb_i.c index 9225efaa86..31c76c6dac 100644 --- a/src/lib/libcrypto/evp/e_cfb_i.c +++ b/src/lib/libcrypto/evp/e_cfb_i.c @@ -60,19 +60,13 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void idea_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void idea_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void idea_cfb_init_key(); -static void idea_cfb_cipher(); -#endif - static EVP_CIPHER i_cfb_cipher= { NID_idea_cfb64, @@ -86,16 +80,13 @@ static EVP_CIPHER i_cfb_cipher= EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_idea_cfb() +EVP_CIPHER *EVP_idea_cfb(void) { return(&i_cfb_cipher); } -static void idea_cfb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void idea_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { ctx->num=0; @@ -106,11 +97,8 @@ int enc; idea_set_encrypt_key(key,&(ctx->c.idea_ks)); } -static void idea_cfb_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void idea_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { idea_cfb64_encrypt( in,out,(long)inl, diff --git a/src/lib/libcrypto/evp/e_cfb_r2.c b/src/lib/libcrypto/evp/e_cfb_r2.c index af5a39d1f4..32dd77eb7c 100644 --- a/src/lib/libcrypto/evp/e_cfb_r2.c +++ b/src/lib/libcrypto/evp/e_cfb_r2.c @@ -60,19 +60,13 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void rc2_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void rc2_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void rc2_cfb_init_key(); -static void rc2_cfb_cipher(); -#endif - static EVP_CIPHER r2_cfb_cipher= { NID_rc2_cfb64, @@ -86,16 +80,13 @@ static EVP_CIPHER r2_cfb_cipher= EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_rc2_cfb() +EVP_CIPHER *EVP_rc2_cfb(void) { return(&r2_cfb_cipher); } -static void rc2_cfb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void rc2_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { ctx->num=0; @@ -103,15 +94,12 @@ int enc; memcpy(&(ctx->oiv[0]),iv,8); memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); if (key != NULL) - RC2_set_key(&(ctx->c.rc2_ks),EVP_RC2_KEY_SIZE,key, - EVP_RC2_KEY_SIZE*8); + RC2_set_key(&(ctx->c.rc2_ks),EVP_CIPHER_CTX_key_length(ctx), + key,EVP_CIPHER_CTX_key_length(ctx)*8); } -static void rc2_cfb_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void rc2_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { RC2_cfb64_encrypt( in,out, diff --git a/src/lib/libcrypto/evp/e_cfb_r5.c b/src/lib/libcrypto/evp/e_cfb_r5.c index a2fddaedc0..8e79728946 100644 --- a/src/lib/libcrypto/evp/e_cfb_r5.c +++ b/src/lib/libcrypto/evp/e_cfb_r5.c @@ -60,19 +60,13 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void rc5_32_12_16_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void rc5_32_12_16_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void rc5_32_12_16_cfb_init_key(); -static void rc5_32_12_16_cfb_cipher(); -#endif - static EVP_CIPHER rc5_cfb_cipher= { NID_rc5_cfb64, @@ -86,16 +80,13 @@ static EVP_CIPHER rc5_cfb_cipher= EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_rc5_32_12_16_cfb() +EVP_CIPHER *EVP_rc5_32_12_16_cfb(void) { return(&rc5_cfb_cipher); } -static void rc5_32_12_16_cfb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void rc5_32_12_16_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { ctx->num=0; @@ -107,11 +98,8 @@ int enc; RC5_12_ROUNDS); } -static void rc5_32_12_16_cfb_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void 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, diff --git a/src/lib/libcrypto/evp/e_dsa.c b/src/lib/libcrypto/evp/e_dsa.c index 6715c3e95e..b96f2738b3 100644 --- a/src/lib/libcrypto/evp/e_dsa.c +++ b/src/lib/libcrypto/evp/e_dsa.c @@ -58,9 +58,9 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" -#include "x509.h" +#include +#include +#include static EVP_PKEY_METHOD dss_method= { diff --git a/src/lib/libcrypto/evp/e_ecb_3d.c b/src/lib/libcrypto/evp/e_ecb_3d.c index 908fc0760a..354a8b79a7 100644 --- a/src/lib/libcrypto/evp/e_ecb_3d.c +++ b/src/lib/libcrypto/evp/e_ecb_3d.c @@ -56,24 +56,18 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DES #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void des_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void des_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void des_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void des_ede_init_key(); -static void des_ede3_init_key(); -static void des_ede_cipher(); -#endif - static EVP_CIPHER d_ede_cipher2= { NID_des_ede, @@ -99,63 +93,66 @@ static EVP_CIPHER d_ede3_cipher3= NULL, }; -EVP_CIPHER *EVP_des_ede() +EVP_CIPHER *EVP_des_ede(void) { return(&d_ede_cipher2); } -EVP_CIPHER *EVP_des_ede3() +EVP_CIPHER *EVP_des_ede3(void) { return(&d_ede3_cipher3); } -static void des_ede_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void des_ede_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { - if (key != NULL) + des_cblock *deskey = (des_cblock *)key; + + if (deskey != NULL) { - des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); - des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + des_set_key(&deskey[0],ctx->c.des_ede.ks1); + des_set_key(&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)); } } -static void des_ede3_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void des_ede3_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { - if (key != NULL) + des_cblock *deskey = (des_cblock *)key; + + if (deskey != NULL) { - des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); - des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); - des_set_key((des_cblock *)&(key[16]),ctx->c.des_ede.ks3); + des_set_key(&deskey[0],ctx->c.des_ede.ks1); + des_set_key(&deskey[1],ctx->c.des_ede.ks2); + des_set_key(&deskey[2],ctx->c.des_ede.ks3); } } -static void des_ede_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void 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; inl-=8; for (i=0; i<=inl; i+=8) { - des_ecb3_encrypt( - (des_cblock *)&(in[i]),(des_cblock *)&(out[i]), + 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++; */ } } +#endif diff --git a/src/lib/libcrypto/evp/e_ecb_bf.c b/src/lib/libcrypto/evp/e_ecb_bf.c index 142a9d3123..334736d253 100644 --- a/src/lib/libcrypto/evp/e_ecb_bf.c +++ b/src/lib/libcrypto/evp/e_ecb_bf.c @@ -56,23 +56,16 @@ * [including the GNU Public Licence.] */ -#ifndef NO_BLOWFISH - +#ifndef NO_BF #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void bf_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void bf_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void bf_ecb_init_key(); -static void bf_ecb_cipher(); -#endif - static EVP_CIPHER bfish_ecb_cipher= { NID_bf_ecb, @@ -86,26 +79,20 @@ static EVP_CIPHER bfish_ecb_cipher= NULL, }; -EVP_CIPHER *EVP_bf_ecb() +EVP_CIPHER *EVP_bf_ecb(void) { return(&bfish_ecb_cipher); } -static void bf_ecb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void bf_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { if (key != NULL) BF_set_key(&(ctx->c.bf_ks),EVP_BLOWFISH_KEY_SIZE,key); } -static void bf_ecb_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void bf_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { unsigned int i; diff --git a/src/lib/libcrypto/evp/e_ecb_c.c b/src/lib/libcrypto/evp/e_ecb_c.c index 34e0c18296..ad14e203cb 100644 --- a/src/lib/libcrypto/evp/e_ecb_c.c +++ b/src/lib/libcrypto/evp/e_ecb_c.c @@ -60,19 +60,13 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void cast_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void cast_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void cast_ecb_init_key(); -static void cast_ecb_cipher(); -#endif - static EVP_CIPHER cast5_ecb_cipher= { NID_cast5_ecb, @@ -86,26 +80,20 @@ static EVP_CIPHER cast5_ecb_cipher= NULL, }; -EVP_CIPHER *EVP_cast5_ecb() +EVP_CIPHER *EVP_cast5_ecb(void) { return(&cast5_ecb_cipher); } -static void cast_ecb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void cast_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { if (key != NULL) CAST_set_key(&(ctx->c.cast_ks),EVP_CAST5_KEY_SIZE,key); } -static void cast_ecb_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void cast_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { unsigned int i; diff --git a/src/lib/libcrypto/evp/e_ecb_d.c b/src/lib/libcrypto/evp/e_ecb_d.c index 7a409d6459..5fb4e64b1c 100644 --- a/src/lib/libcrypto/evp/e_ecb_d.c +++ b/src/lib/libcrypto/evp/e_ecb_d.c @@ -56,21 +56,16 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DES #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void des_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void des_ecb_init_key(); -static void des_ecb_cipher(); -#endif - static EVP_CIPHER d_ecb_cipher= { NID_des_ecb, @@ -84,35 +79,40 @@ static EVP_CIPHER d_ecb_cipher= NULL, }; -EVP_CIPHER *EVP_des_ecb() +EVP_CIPHER *EVP_des_ecb(void) { return(&d_ecb_cipher); } -static void des_ecb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void des_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { - if (key != NULL) - des_set_key((des_cblock *)key,ctx->c.des_ks); + des_cblock *deskey = (des_cblock *)key; + + if (deskey != NULL) + des_set_key(deskey,ctx->c.des_ks); } -static void des_ecb_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void 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; inl-=8; for (i=0; i<=inl; i+=8) { - des_ecb_encrypt( - (des_cblock *)&(in[i]),(des_cblock *)&(out[i]), - ctx->c.des_ks,ctx->encrypt); + /* 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++; */ } } +#endif diff --git a/src/lib/libcrypto/evp/e_ecb_i.c b/src/lib/libcrypto/evp/e_ecb_i.c index e24022a12c..50a3da1bba 100644 --- a/src/lib/libcrypto/evp/e_ecb_i.c +++ b/src/lib/libcrypto/evp/e_ecb_i.c @@ -60,19 +60,13 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void idea_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void idea_ecb_init_key(); -static void idea_ecb_cipher(); -#endif - static EVP_CIPHER i_ecb_cipher= { NID_idea_ecb, @@ -86,16 +80,13 @@ static EVP_CIPHER i_ecb_cipher= NULL, }; -EVP_CIPHER *EVP_idea_ecb() +EVP_CIPHER *EVP_idea_ecb(void) { return(&i_ecb_cipher); } -static void idea_ecb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void idea_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { if (key != NULL) { @@ -113,11 +104,8 @@ int enc; } } -static void idea_ecb_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { unsigned int i; diff --git a/src/lib/libcrypto/evp/e_ecb_r2.c b/src/lib/libcrypto/evp/e_ecb_r2.c index e35b06dc6d..3c2330130d 100644 --- a/src/lib/libcrypto/evp/e_ecb_r2.c +++ b/src/lib/libcrypto/evp/e_ecb_r2.c @@ -60,19 +60,13 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void rc2_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void rc2_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void rc2_ecb_init_key(); -static void rc2_ecb_cipher(); -#endif - static EVP_CIPHER r2_ecb_cipher= { NID_rc2_ecb, @@ -86,27 +80,21 @@ static EVP_CIPHER r2_ecb_cipher= NULL, }; -EVP_CIPHER *EVP_rc2_ecb() +EVP_CIPHER *EVP_rc2_ecb(void) { return(&r2_ecb_cipher); } -static void rc2_ecb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void rc2_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { if (key != NULL) - RC2_set_key(&(ctx->c.rc2_ks),EVP_RC2_KEY_SIZE,key, - EVP_RC2_KEY_SIZE*8); + RC2_set_key(&(ctx->c.rc2_ks),EVP_CIPHER_CTX_key_length(ctx), + key,EVP_CIPHER_CTX_key_length(ctx)*8); } -static void rc2_ecb_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void rc2_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { unsigned int i; diff --git a/src/lib/libcrypto/evp/e_ecb_r5.c b/src/lib/libcrypto/evp/e_ecb_r5.c index 08f4a82651..ef43ce34bf 100644 --- a/src/lib/libcrypto/evp/e_ecb_r5.c +++ b/src/lib/libcrypto/evp/e_ecb_r5.c @@ -60,19 +60,13 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void rc5_32_12_16_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void rc5_32_12_16_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void rc5_32_12_16_ecb_init_key(); -static void rc5_32_12_16_ecb_cipher(); -#endif - static EVP_CIPHER rc5_ecb_cipher= { NID_rc5_ecb, @@ -86,27 +80,21 @@ static EVP_CIPHER rc5_ecb_cipher= NULL, }; -EVP_CIPHER *EVP_rc5_32_12_16_ecb() +EVP_CIPHER *EVP_rc5_32_12_16_ecb(void) { return(&rc5_ecb_cipher); } -static void rc5_32_12_16_ecb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void rc5_32_12_16_ecb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { if (key != NULL) RC5_32_set_key(&(ctx->c.rc5_ks),EVP_RC5_32_12_16_KEY_SIZE,key, RC5_12_ROUNDS); } -static void rc5_32_12_16_ecb_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void rc5_32_12_16_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { unsigned int i; diff --git a/src/lib/libcrypto/evp/e_null.c b/src/lib/libcrypto/evp/e_null.c index e4e7ca7606..0a62c10aa9 100644 --- a/src/lib/libcrypto/evp/e_null.c +++ b/src/lib/libcrypto/evp/e_null.c @@ -58,19 +58,13 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void null_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void null_init_key(); -static void null_cipher(); -#endif - static EVP_CIPHER n_cipher= { NID_undef, @@ -83,25 +77,19 @@ static EVP_CIPHER n_cipher= NULL, }; -EVP_CIPHER *EVP_enc_null() +EVP_CIPHER *EVP_enc_null(void) { return(&n_cipher); } -static void null_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void null_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { memset(&(ctx->c),0,sizeof(ctx->c)); } -static void null_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { if (in != out) memcpy((char *)out,(char *)in,(int)inl); diff --git a/src/lib/libcrypto/evp/e_ofb_3d.c b/src/lib/libcrypto/evp/e_ofb_3d.c index c3add18e93..5233567c0c 100644 --- a/src/lib/libcrypto/evp/e_ofb_3d.c +++ b/src/lib/libcrypto/evp/e_ofb_3d.c @@ -56,24 +56,18 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DES #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void des_ede_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void des_ede3_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void des_ede_ofb_init_key(); -static void des_ede3_ofb_init_key(); -static void des_ede_ofb_cipher(); -#endif - static EVP_CIPHER d_ede_ofb_cipher2= { NID_des_ede_ofb64, @@ -100,66 +94,59 @@ static EVP_CIPHER d_ede3_ofb_cipher3= EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_des_ede_ofb() +EVP_CIPHER *EVP_des_ede_ofb(void) { return(&d_ede_ofb_cipher2); } -EVP_CIPHER *EVP_des_ede3_ofb() +EVP_CIPHER *EVP_des_ede3_ofb(void) { return(&d_ede3_ofb_cipher3); } -static void des_ede_ofb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void des_ede_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { + des_cblock *deskey = (des_cblock *)key; + ctx->num=0; if (iv != NULL) memcpy(&(ctx->oiv[0]),iv,8); memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); - if (key != NULL) + if (deskey != NULL) { - des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); - des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); + des_set_key(&deskey[0],ctx->c.des_ede.ks1); + des_set_key(&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)); } } -static void des_ede3_ofb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void des_ede3_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { + des_cblock *deskey = (des_cblock *)key; + ctx->num=0; if (iv != NULL) memcpy(&(ctx->oiv[0]),iv,8); memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); - if (key != NULL) + if (deskey != NULL) { - des_set_key((des_cblock *)key,ctx->c.des_ede.ks1); - des_set_key((des_cblock *)&(key[8]),ctx->c.des_ede.ks2); - des_set_key((des_cblock *)&(key[16]),ctx->c.des_ede.ks3); + des_set_key(&deskey[0],ctx->c.des_ede.ks1); + des_set_key(&deskey[1],ctx->c.des_ede.ks2); + des_set_key(&deskey[2],ctx->c.des_ede.ks3); } } -static void des_ede_ofb_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void 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[0]), - &ctx->num); + 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); } +#endif diff --git a/src/lib/libcrypto/evp/e_ofb_bf.c b/src/lib/libcrypto/evp/e_ofb_bf.c index 492f9b9082..c82154b549 100644 --- a/src/lib/libcrypto/evp/e_ofb_bf.c +++ b/src/lib/libcrypto/evp/e_ofb_bf.c @@ -56,23 +56,16 @@ * [including the GNU Public Licence.] */ -#ifndef NO_BLOWFISH - +#ifndef NO_BF #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void bf_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void bf_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void bf_ofb_init_key(); -static void bf_ofb_cipher(); -#endif - static EVP_CIPHER bfish_ofb_cipher= { NID_bf_ofb64, @@ -86,16 +79,13 @@ static EVP_CIPHER bfish_ofb_cipher= EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_bf_ofb() +EVP_CIPHER *EVP_bf_ofb(void) { return(&bfish_ofb_cipher); } -static void bf_ofb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void bf_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { ctx->num=0; @@ -106,11 +96,8 @@ int enc; BF_set_key(&(ctx->c.bf_ks),EVP_BLOWFISH_KEY_SIZE,key); } -static void bf_ofb_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void bf_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { BF_ofb64_encrypt( in,out, diff --git a/src/lib/libcrypto/evp/e_ofb_c.c b/src/lib/libcrypto/evp/e_ofb_c.c index f1eef4469c..971043de4c 100644 --- a/src/lib/libcrypto/evp/e_ofb_c.c +++ b/src/lib/libcrypto/evp/e_ofb_c.c @@ -60,19 +60,13 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void cast_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void cast_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void cast_ofb_init_key(); -static void cast_ofb_cipher(); -#endif - static EVP_CIPHER cast5_ofb_cipher= { NID_cast5_ofb64, @@ -86,16 +80,13 @@ static EVP_CIPHER cast5_ofb_cipher= EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_cast5_ofb() +EVP_CIPHER *EVP_cast5_ofb(void) { return(&cast5_ofb_cipher); } -static void cast_ofb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void cast_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { ctx->num=0; @@ -106,11 +97,8 @@ int enc; CAST_set_key(&(ctx->c.cast_ks),EVP_CAST5_KEY_SIZE,key); } -static void cast_ofb_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void cast_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { CAST_ofb64_encrypt( in,out, diff --git a/src/lib/libcrypto/evp/e_ofb_d.c b/src/lib/libcrypto/evp/e_ofb_d.c index 09d4b4139d..398b3a002e 100644 --- a/src/lib/libcrypto/evp/e_ofb_d.c +++ b/src/lib/libcrypto/evp/e_ofb_d.c @@ -56,21 +56,16 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DES #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void des_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void des_ofb_init_key(); -static void des_ofb_cipher(); -#endif - static EVP_CIPHER d_ofb_cipher= { NID_des_ofb64, @@ -84,35 +79,29 @@ static EVP_CIPHER d_ofb_cipher= EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_des_ofb() +EVP_CIPHER *EVP_des_ofb(void) { return(&d_ofb_cipher); } -static void des_ofb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void des_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { + des_cblock *deskey = (des_cblock *)key; + ctx->num=0; if (iv != NULL) memcpy(&(ctx->oiv[0]),iv,8); memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); - if (key != NULL) - des_set_key((des_cblock *)key,ctx->c.des_ks); + if (deskey != NULL) + des_set_key(deskey,ctx->c.des_ks); } -static void des_ofb_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void 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[0]), - &ctx->num); + des_ofb64_encrypt(in,out,inl,ctx->c.des_ks, + (des_cblock *)&(ctx->iv[0]),&ctx->num); } +#endif diff --git a/src/lib/libcrypto/evp/e_ofb_i.c b/src/lib/libcrypto/evp/e_ofb_i.c index 96c8afd9c8..389206ef36 100644 --- a/src/lib/libcrypto/evp/e_ofb_i.c +++ b/src/lib/libcrypto/evp/e_ofb_i.c @@ -60,19 +60,13 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void idea_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void idea_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void idea_ofb_init_key(); -static void idea_ofb_cipher(); -#endif - static EVP_CIPHER i_ofb_cipher= { NID_idea_ofb64, @@ -86,16 +80,13 @@ static EVP_CIPHER i_ofb_cipher= EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_idea_ofb() +EVP_CIPHER *EVP_idea_ofb(void) { return(&i_ofb_cipher); } -static void idea_ofb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void idea_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { ctx->num=0; @@ -106,11 +97,8 @@ int enc; idea_set_encrypt_key(key,&(ctx->c.idea_ks)); } -static void idea_ofb_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void idea_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { idea_ofb64_encrypt( in,out,(long)inl, diff --git a/src/lib/libcrypto/evp/e_ofb_r2.c b/src/lib/libcrypto/evp/e_ofb_r2.c index 0f6d729988..60ae3d4507 100644 --- a/src/lib/libcrypto/evp/e_ofb_r2.c +++ b/src/lib/libcrypto/evp/e_ofb_r2.c @@ -60,19 +60,13 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void rc2_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void rc2_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void rc2_ofb_init_key(); -static void rc2_ofb_cipher(); -#endif - static EVP_CIPHER r2_ofb_cipher= { NID_rc2_ofb64, @@ -86,16 +80,13 @@ static EVP_CIPHER r2_ofb_cipher= EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_rc2_ofb() +EVP_CIPHER *EVP_rc2_ofb(void) { return(&r2_ofb_cipher); } -static void rc2_ofb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void rc2_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { ctx->num=0; @@ -103,15 +94,12 @@ int enc; memcpy(&(ctx->oiv[0]),iv,8); memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); if (key != NULL) - RC2_set_key(&(ctx->c.rc2_ks),EVP_RC2_KEY_SIZE,key, - EVP_RC2_KEY_SIZE*8); + RC2_set_key(&(ctx->c.rc2_ks),EVP_CIPHER_CTX_key_length(ctx), + key,EVP_CIPHER_CTX_key_length(ctx)*8); } -static void rc2_ofb_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void rc2_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { RC2_ofb64_encrypt( in,out, diff --git a/src/lib/libcrypto/evp/e_ofb_r5.c b/src/lib/libcrypto/evp/e_ofb_r5.c index db28d6c317..30136824eb 100644 --- a/src/lib/libcrypto/evp/e_ofb_r5.c +++ b/src/lib/libcrypto/evp/e_ofb_r5.c @@ -60,19 +60,13 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void rc5_32_12_16_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void rc5_32_12_16_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void rc5_32_12_16_ofb_init_key(); -static void rc5_32_12_16_ofb_cipher(); -#endif - static EVP_CIPHER rc5_ofb_cipher= { NID_rc5_ofb64, @@ -86,16 +80,13 @@ static EVP_CIPHER rc5_ofb_cipher= EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_rc5_32_12_16_ofb() +EVP_CIPHER *EVP_rc5_32_12_16_ofb(void) { return(&rc5_ofb_cipher); } -static void rc5_32_12_16_ofb_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void rc5_32_12_16_ofb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { ctx->num=0; @@ -107,11 +98,8 @@ int enc; RC5_12_ROUNDS); } -static void rc5_32_12_16_ofb_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void 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, diff --git a/src/lib/libcrypto/evp/e_rc4.c b/src/lib/libcrypto/evp/e_rc4.c index 7e9790a94c..c7e58a75cc 100644 --- a/src/lib/libcrypto/evp/e_rc4.c +++ b/src/lib/libcrypto/evp/e_rc4.c @@ -60,19 +60,13 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void rc4_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void rc4_init_key(); -static void rc4_cipher(); -#endif - static EVP_CIPHER r4_cipher= { NID_rc4, @@ -94,21 +88,18 @@ static EVP_CIPHER r4_40_cipher= rc4_cipher, }; -EVP_CIPHER *EVP_rc4() +EVP_CIPHER *EVP_rc4(void) { return(&r4_cipher); } -EVP_CIPHER *EVP_rc4_40() +EVP_CIPHER *EVP_rc4_40(void) { return(&r4_40_cipher); } -static void rc4_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void rc4_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { if (key != NULL) memcpy(&(ctx->c.rc4.key[0]),key,EVP_CIPHER_CTX_key_length(ctx)); @@ -116,11 +107,8 @@ int enc; ctx->c.rc4.key); } -static void rc4_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { RC4(&(ctx->c.rc4.ks),inl,in,out); } diff --git a/src/lib/libcrypto/evp/e_xcbc_d.c b/src/lib/libcrypto/evp/e_xcbc_d.c index 0d7fda0c47..3a6628a75c 100644 --- a/src/lib/libcrypto/evp/e_xcbc_d.c +++ b/src/lib/libcrypto/evp/e_xcbc_d.c @@ -56,21 +56,16 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DES #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -#ifndef NOPROTO static void desx_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, unsigned char *iv,int enc); static void desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned char *in, unsigned int inl); -#else -static void desx_cbc_init_key(); -static void desx_cbc_cipher(); -#endif - static EVP_CIPHER d_xcbc_cipher= { NID_desx_cbc, @@ -84,39 +79,34 @@ static EVP_CIPHER d_xcbc_cipher= EVP_CIPHER_get_asn1_iv, }; -EVP_CIPHER *EVP_desx_cbc() +EVP_CIPHER *EVP_desx_cbc(void) { return(&d_xcbc_cipher); } -static void desx_cbc_init_key(ctx,key,iv,enc) -EVP_CIPHER_CTX *ctx; -unsigned char *key; -unsigned char *iv; -int enc; +static void desx_cbc_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key, + unsigned char *iv, int enc) { + des_cblock *deskey = (des_cblock *)key; + if (iv != NULL) memcpy(&(ctx->oiv[0]),iv,8); memcpy(&(ctx->iv[0]),&(ctx->oiv[0]),8); - if (key != NULL) + if (deskey != NULL) { - des_set_key((des_cblock *)key,ctx->c.desx_cbc.ks); + des_set_key(deskey,ctx->c.desx_cbc.ks); memcpy(&(ctx->c.desx_cbc.inw[0]),&(key[8]),8); memcpy(&(ctx->c.desx_cbc.outw[0]),&(key[16]),8); } } -static void desx_cbc_cipher(ctx,out,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -unsigned char *in; -unsigned int inl; +static void desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + unsigned char *in, unsigned int inl) { - des_xcbc_encrypt( - (des_cblock *)in,(des_cblock *)out, - (long)inl, ctx->c.desx_cbc.ks, + des_xcbc_encrypt(in,out,inl,ctx->c.desx_cbc.ks, (des_cblock *)&(ctx->iv[0]), - (des_cblock *)&(ctx->c.desx_cbc.inw[0]), - (des_cblock *)&(ctx->c.desx_cbc.outw[0]), + &ctx->c.desx_cbc.inw, + &ctx->c.desx_cbc.outw, ctx->encrypt); } +#endif diff --git a/src/lib/libcrypto/evp/encode.c b/src/lib/libcrypto/evp/encode.c index 14d47c1eed..0152624a76 100644 --- a/src/lib/libcrypto/evp/encode.c +++ b/src/lib/libcrypto/evp/encode.c @@ -58,10 +58,21 @@ #include #include "cryptlib.h" -#include "evp.h" +#include +#ifndef CHARSET_EBCDIC #define conv_bin2ascii(a) (data_bin2ascii[(a)&0x3f]) #define conv_ascii2bin(a) (data_ascii2bin[(a)&0x7f]) +#else +/* We assume that PEM encoded files are EBCDIC files + * (i.e., printable text files). Convert them here while decoding. + * When encoding, output is EBCDIC (text) format again. + * (No need for conversion in the conv_bin2ascii macro, as the + * underlying textstring data_bin2ascii[] is already EBCDIC) + */ +#define conv_bin2ascii(a) (data_bin2ascii[(a)&0x3f]) +#define conv_ascii2bin(a) (data_ascii2bin[os_toascii[a]&0x7f]) +#endif /* 64 char lines * pad input with 0 @@ -110,20 +121,15 @@ static unsigned char data_ascii2bin[128]={ 0x31,0x32,0x33,0xFF,0xFF,0xFF,0xFF,0xFF, }; -void EVP_EncodeInit(ctx) -EVP_ENCODE_CTX *ctx; +void EVP_EncodeInit(EVP_ENCODE_CTX *ctx) { ctx->length=48; ctx->num=0; ctx->line_num=0; } -void EVP_EncodeUpdate(ctx,out,outl,in,inl) -EVP_ENCODE_CTX *ctx; -unsigned char *out; -int *outl; -unsigned char *in; -int inl; +void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, + unsigned char *in, int inl) { int i,j; unsigned int total=0; @@ -165,10 +171,7 @@ int inl; *outl=total; } -void EVP_EncodeFinal(ctx,out,outl) -EVP_ENCODE_CTX *ctx; -unsigned char *out; -int *outl; +void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl) { unsigned int ret=0; @@ -182,9 +185,7 @@ int *outl; *outl=ret; } -int EVP_EncodeBlock(t,f,dlen) -unsigned char *t,*f; -int dlen; +int EVP_EncodeBlock(unsigned char *t, unsigned char *f, int dlen) { int i,ret=0; unsigned long l; @@ -218,8 +219,7 @@ int dlen; return(ret); } -void EVP_DecodeInit(ctx) -EVP_ENCODE_CTX *ctx; +void EVP_DecodeInit(EVP_ENCODE_CTX *ctx) { ctx->length=30; ctx->num=0; @@ -231,12 +231,8 @@ EVP_ENCODE_CTX *ctx; * 0 for last line * 1 for full line */ -int EVP_DecodeUpdate(ctx,out,outl,in,inl) -EVP_ENCODE_CTX *ctx; -unsigned char *out; -int *outl; -unsigned char *in; -int inl; +int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, + unsigned char *in, int inl) { int seof= -1,eof=0,rv= -1,ret=0,i,v,tmp,n,ln,tmp2,exp_nl; unsigned char *d; @@ -341,9 +337,7 @@ end: return(rv); } -int EVP_DecodeBlock(t,f,n) -unsigned char *t,*f; -int n; +int EVP_DecodeBlock(unsigned char *t, unsigned char *f, int n) { int i,ret=0,a,b,c,d; unsigned long l; @@ -383,10 +377,7 @@ int n; return(ret); } -int EVP_DecodeFinal(ctx,out,outl) -EVP_ENCODE_CTX *ctx; -unsigned char *out; -int *outl; +int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl) { int i; @@ -404,9 +395,7 @@ int *outl; } #ifdef undef -int EVP_DecodeValid(buf,len) -unsigned char *buf; -int len; +int EVP_DecodeValid(unsigned char *buf, int len) { int i,num=0,bad=0; diff --git a/src/lib/libcrypto/evp/evp.err b/src/lib/libcrypto/evp/evp.err deleted file mode 100644 index cfc17437bc..0000000000 --- a/src/lib/libcrypto/evp/evp.err +++ /dev/null @@ -1,24 +0,0 @@ -/* Error codes for the EVP functions. */ - -/* Function codes. */ -#define EVP_F_D2I_PKEY 100 -#define EVP_F_EVP_DECRYPTFINAL 101 -#define EVP_F_EVP_OPENINIT 102 -#define EVP_F_EVP_PKEY_COPY_PARAMETERS 103 -#define EVP_F_EVP_PKEY_DECRYPT 104 -#define EVP_F_EVP_PKEY_ENCRYPT 105 -#define EVP_F_EVP_PKEY_NEW 106 -#define EVP_F_EVP_SIGNFINAL 107 -#define EVP_F_EVP_VERIFYFINAL 108 - -/* Reason codes. */ -#define EVP_R_BAD_DECRYPT 100 -#define EVP_R_DIFFERENT_KEY_TYPES 101 -#define EVP_R_IV_TOO_LARGE 102 -#define EVP_R_MISSING_PARMATERS 103 -#define EVP_R_NO_SIGN_FUNCTION_CONFIGURED 104 -#define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105 -#define EVP_R_PUBLIC_KEY_NOT_RSA 106 -#define EVP_R_UNSUPPORTED_CIPHER 107 -#define EVP_R_WRONG_FINAL_BLOCK_LENGTH 108 -#define EVP_R_WRONG_PUBLIC_KEY_TYPE 109 diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h index b39fad93a4..570fe27d39 100644 --- a/src/lib/libcrypto/evp/evp.h +++ b/src/lib/libcrypto/evp/evp.h @@ -64,40 +64,40 @@ extern "C" { #endif #ifndef NO_MD2 -#include "md2.h" +#include #endif #ifndef NO_MD5 -#include "md5.h" +#include #endif -#if !defined(NO_SHA) || !defined(NO_SHA1) -#include "sha.h" +#ifndef NO_SHA +#include #endif #ifndef NO_RIPEMD -#include "ripemd.h" +#include #endif #ifndef NO_DES -#include "des.h" +#include #endif #ifndef NO_RC4 -#include "rc4.h" +#include #endif #ifndef NO_RC2 -#include "rc2.h" +#include #endif #ifndef NO_RC5 -#include "rc5.h" +#include #endif -#ifndef NO_BLOWFISH -#include "blowfish.h" +#ifndef NO_BF +#include #endif #ifndef NO_CAST -#include "cast.h" +#include #endif #ifndef NO_IDEA -#include "idea.h" +#include #endif #ifndef NO_MDC2 -#include "mdc2.h" +#include #endif #define EVP_RC2_KEY_SIZE 16 @@ -109,25 +109,23 @@ extern "C" { #define EVP_MAX_KEY_LENGTH 24 #define EVP_MAX_IV_LENGTH 8 +#define PKCS5_SALT_LEN 8 +/* Default PKCS#5 iteration count */ +#define PKCS5_DEFAULT_ITER 2048 + #ifndef NO_RSA -#include "rsa.h" -#else -#define RSA long +#include #endif #ifndef NO_DSA -#include "dsa.h" -#else -#define DSA long +#include #endif #ifndef NO_DH -#include "dh.h" -#else -#define DH long +#include #endif -#include "objects.h" +#include #define EVP_PK_RSA 0x0001 #define EVP_PK_DSA 0x0002 @@ -159,16 +157,18 @@ typedef struct evp_pkey_st int references; union { char *ptr; +#ifndef NO_RSA struct rsa_st *rsa; /* RSA */ +#endif +#ifndef NO_DSA struct dsa_st *dsa; /* DSA */ +#endif +#ifndef NO_DH struct dh_st *dh; /* DH */ +#endif } pkey; int save_parameters; -#ifdef HEADER_STACK_H - STACK /* X509_ATTRIBUTE */ *attributes; /* [ 0 ] */ -#else - char /* X509_ATTRIBUTE */ *attributes; /* [ 0 ] */ -#endif + STACK /*X509_ATTRIBUTE*/ *attributes; /* [ 0 ] */ } EVP_PKEY; #define EVP_PKEY_MO_SIGN 0x0001 @@ -183,7 +183,7 @@ typedef struct evp_pkey_st * This is required because for various smart-card perform the digest and * signing/verification on-board. To handle this case, the specific * EVP_MD and EVP_PKEY_METHODs need to be closely associated. - * When a PKEY is created, it will have a EVP_PKEY_METHOD ossociated with it. + * When a PKEY is created, it will have a EVP_PKEY_METHOD associated with it. * This can either be software or a token to provide the required low level * routines. */ @@ -194,28 +194,28 @@ typedef struct evp_pkey_md_st EVP_PKEY_METHOD *pkey; } EVP_PKEY_MD; -#define EVP_rsa_md2() +#define EVP_rsa_md2() \ EVP_PKEY_MD_add(NID_md2WithRSAEncryption,\ EVP_rsa_pkcs1(),EVP_md2()) -#define EVP_rsa_md5() +#define EVP_rsa_md5() \ EVP_PKEY_MD_add(NID_md5WithRSAEncryption,\ EVP_rsa_pkcs1(),EVP_md5()) -#define EVP_rsa_sha0() +#define EVP_rsa_sha0() \ EVP_PKEY_MD_add(NID_shaWithRSAEncryption,\ EVP_rsa_pkcs1(),EVP_sha()) -#define EVP_rsa_sha1() +#define EVP_rsa_sha1() \ EVP_PKEY_MD_add(NID_sha1WithRSAEncryption,\ EVP_rsa_pkcs1(),EVP_sha1()) -#define EVP_rsa_ripemd160() +#define EVP_rsa_ripemd160() \ EVP_PKEY_MD_add(NID_ripemd160WithRSA,\ EVP_rsa_pkcs1(),EVP_ripemd160()) -#define EVP_rsa_mdc2() +#define EVP_rsa_mdc2() \ EVP_PKEY_MD_add(NID_mdc2WithRSA,\ EVP_rsa_octet_string(),EVP_mdc2()) -#define EVP_dsa_sha() +#define EVP_dsa_sha() \ EVP_PKEY_MD_add(NID_dsaWithSHA,\ EVP_dsa(),EVP_mdc2()) -#define EVP_dsa_sha1() +#define EVP_dsa_sha1() \ EVP_PKEY_MD_add(NID_dsaWithSHA1,\ EVP_dsa(),EVP_sha1()) @@ -261,6 +261,8 @@ typedef struct env_md_st int ctx_size; /* how big does the ctx need to be */ } EVP_MD; + + #define EVP_PKEY_NULL_method NULL,NULL,{0,0,0,0} #ifndef NO_DSA @@ -287,7 +289,7 @@ typedef struct env_md_st typedef struct env_md_ctx_st { - EVP_MD *digest; + const EVP_MD *digest; union { unsigned char base[4]; #ifndef NO_MD2 @@ -296,10 +298,10 @@ typedef struct env_md_ctx_st #ifndef NO_MD5 MD5_CTX md5; #endif -#ifndef NO_MD5 +#ifndef NO_RIPEMD RIPEMD160_CTX ripemd160; #endif -#if !defined(NO_SHA) || !defined(NO_SHA1) +#ifndef NO_SHA SHA_CTX sha; #endif #ifndef NO_MDC2 @@ -326,13 +328,13 @@ typedef struct evp_cipher_st typedef struct evp_cipher_info_st { - EVP_CIPHER *cipher; + const EVP_CIPHER *cipher; unsigned char iv[EVP_MAX_IV_LENGTH]; } EVP_CIPHER_INFO; typedef struct evp_cipher_ctx_st { - EVP_CIPHER *cipher; + const EVP_CIPHER *cipher; int encrypt; /* encrypt or decrypt */ int buf_len; /* number we have left */ @@ -355,8 +357,8 @@ typedef struct evp_cipher_ctx_st struct { des_key_schedule ks;/* key schedule */ - C_Block inw; - C_Block outw; + des_cblock inw; + des_cblock outw; } desx_cbc; struct { @@ -374,7 +376,7 @@ typedef struct evp_cipher_ctx_st #ifndef NO_RC5 RC5_32_KEY rc5_ks;/* key schedule */ #endif -#ifndef NO_BLOWFISH +#ifndef NO_BF BF_KEY bf_ks;/* key schedule */ #endif #ifndef NO_CAST @@ -396,6 +398,11 @@ typedef struct evp_Encode_Ctx_st int expect_nl; } EVP_ENCODE_CTX; +/* Password based encryption function */ +typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, EVP_CIPHER *cipher, + EVP_MD *md, int en_de); + #define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ (char *)(rsa)) #define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ @@ -430,6 +437,7 @@ typedef struct evp_Encode_Ctx_st #define EVP_CIPHER_CTX_iv_length(e) ((e)->cipher->iv_len) #define EVP_CIPHER_CTX_get_app_data(e) ((e)->app_data) #define EVP_CIPHER_CTX_set_app_data(e,d) ((e)->app_data=(char *)(d)) +#define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) #define EVP_ENCODE_LENGTH(l) (((l+2)/3*4)+(l/48+1)*2+80) #define EVP_DECODE_LENGTH(l) ((l+3)/4*3+80) @@ -441,43 +449,56 @@ typedef struct evp_Encode_Ctx_st #define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) #define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) -#define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)md) +#ifdef CONST_STRICT +void BIO_set_md(BIO *,const EVP_MD *md); +#else +# define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)md) +#endif #define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)mdp) #define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(char *)mdcp) #define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) +#define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp) #define EVP_Cipher(c,o,i,l) (c)->cipher->do_cipher((c),(o),(i),(l)) -#ifndef NOPROTO +#define EVP_add_cipher_alias(n,alias) \ + OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) +#define EVP_add_digest_alias(n,alias) \ + OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n)) +#define EVP_delete_cipher_alias(alias) \ + OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS); +#define EVP_delete_digest_alias(alias) \ + OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); -void EVP_DigestInit(EVP_MD_CTX *ctx, EVP_MD *type); -void EVP_DigestUpdate(EVP_MD_CTX *ctx,unsigned char *d,unsigned int cnt); + +int EVP_MD_CTX_copy(EVP_MD_CTX *out,EVP_MD_CTX *in); +void EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); +void EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d, + unsigned int cnt); void EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s); -int EVP_read_pw_string(char *buf,int length,char *prompt,int verify); +int EVP_read_pw_string(char *buf,int length,const char *prompt,int verify); void EVP_set_pw_prompt(char *prompt); char * EVP_get_pw_prompt(void); -int EVP_BytesToKey(EVP_CIPHER *type,EVP_MD *md,unsigned char *salt, +int EVP_BytesToKey(const EVP_CIPHER *type,EVP_MD *md,unsigned char *salt, unsigned char *data, int datal, int count, unsigned char *key,unsigned char *iv); -EVP_CIPHER *EVP_get_cipherbyname(char *name); - -void EVP_EncryptInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type, +void EVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type, unsigned char *key, unsigned char *iv); void EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, unsigned char *in, int inl); void EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); -void EVP_DecryptInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type, +void EVP_DecryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type, unsigned char *key, unsigned char *iv); void EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, unsigned char *in, int inl); int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); -void EVP_CipherInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type, unsigned char *key, - unsigned char *iv,int enc); +void EVP_CipherInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type, + unsigned char *key,unsigned char *iv,int enc); void EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, unsigned char *in, int inl); int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); @@ -519,7 +540,8 @@ void EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); BIO_METHOD *BIO_f_md(void); BIO_METHOD *BIO_f_base64(void); BIO_METHOD *BIO_f_cipher(void); -void BIO_set_cipher(BIO *b,EVP_CIPHER *c,unsigned char *k, +BIO_METHOD *BIO_f_reliable(void); +void BIO_set_cipher(BIO *b,const EVP_CIPHER *c,unsigned char *k, unsigned char *i, int enc); #endif @@ -556,6 +578,7 @@ EVP_CIPHER *EVP_idea_cbc(void); EVP_CIPHER *EVP_rc2_ecb(void); EVP_CIPHER *EVP_rc2_cbc(void); EVP_CIPHER *EVP_rc2_40_cbc(void); +EVP_CIPHER *EVP_rc2_64_cbc(void); EVP_CIPHER *EVP_rc2_cfb(void); EVP_CIPHER *EVP_rc2_ofb(void); EVP_CIPHER *EVP_bf_ecb(void); @@ -577,11 +600,9 @@ void SSLeay_add_all_digests(void); int EVP_add_cipher(EVP_CIPHER *cipher); int EVP_add_digest(EVP_MD *digest); -int EVP_add_alias(char *name,char *alias); -int EVP_delete_alias(char *name); -EVP_CIPHER *EVP_get_cipherbyname(char *name); -EVP_MD *EVP_get_digestbyname(char *name); +const EVP_CIPHER *EVP_get_cipherbyname(const char *name); +const EVP_MD *EVP_get_digestbyname(const char *name); void EVP_cleanup(void); int EVP_PKEY_decrypt(unsigned char *dec_key,unsigned char *enc_key, @@ -607,6 +628,8 @@ int EVP_PKEY_missing_parameters(EVP_PKEY *pkey); int EVP_PKEY_save_parameters(EVP_PKEY *pkey,int mode); int EVP_PKEY_cmp_parameters(EVP_PKEY *a,EVP_PKEY *b); +int EVP_CIPHER_type(const EVP_CIPHER *ctx); + /* calls methods */ int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); @@ -615,177 +638,81 @@ int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type); int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type); -#else - -void EVP_DigestInit(); -void EVP_DigestUpdate(); -void EVP_DigestFinal(); - -int EVP_read_pw_string(); -void EVP_set_pw_prompt(); -char * EVP_get_pw_prompt(); - -int EVP_BytesToKey(); - -EVP_CIPHER *EVP_get_cipherbyname(); - -void EVP_EncryptInit(); -void EVP_EncryptUpdate(); -void EVP_EncryptFinal(); - -void EVP_DecryptInit(); -void EVP_DecryptUpdate(); -int EVP_DecryptFinal(); - -void EVP_CipherInit(); -void EVP_CipherUpdate(); -int EVP_CipherFinal(); - -int EVP_SignFinal(); - -int EVP_VerifyFinal(); - -int EVP_OpenInit(); -int EVP_OpenFinal(); - -int EVP_SealInit(); -void EVP_SealFinal(); - -void EVP_EncodeInit(); -void EVP_EncodeUpdate(); -void EVP_EncodeFinal(); -int EVP_EncodeBlock(); - -void EVP_DecodeInit(); -int EVP_DecodeUpdate(); -int EVP_DecodeFinal(); -int EVP_DecodeBlock(); - -void ERR_load_EVP_strings(); - -void EVP_CIPHER_CTX_init(); -void EVP_CIPHER_CTX_cleanup(); - -#ifdef HEADER_BIO_H -BIO_METHOD *BIO_f_md(); -BIO_METHOD *BIO_f_base64(); -BIO_METHOD *BIO_f_cipher(); -void BIO_set_cipher(); -#endif - -EVP_MD *EVP_md_null(); -EVP_MD *EVP_md2(); -EVP_MD *EVP_md5(); -EVP_MD *EVP_sha(); -EVP_MD *EVP_sha1(); -EVP_MD *EVP_dss(); -EVP_MD *EVP_dss1(); -EVP_MD *EVP_mdc2(); - -EVP_CIPHER *EVP_enc_null(); -EVP_CIPHER *EVP_des_ecb(); -EVP_CIPHER *EVP_des_ede(); -EVP_CIPHER *EVP_des_ede3(); -EVP_CIPHER *EVP_des_cfb(); -EVP_CIPHER *EVP_des_ede_cfb(); -EVP_CIPHER *EVP_des_ede3_cfb(); -EVP_CIPHER *EVP_des_ofb(); -EVP_CIPHER *EVP_des_ede_ofb(); -EVP_CIPHER *EVP_des_ede3_ofb(); -EVP_CIPHER *EVP_des_cbc(); -EVP_CIPHER *EVP_des_ede_cbc(); -EVP_CIPHER *EVP_des_ede3_cbc(); -EVP_CIPHER *EVP_desx_cbc(); -EVP_CIPHER *EVP_rc4(); -EVP_CIPHER *EVP_rc4_40(); -EVP_CIPHER *EVP_idea_ecb(); -EVP_CIPHER *EVP_idea_cfb(); -EVP_CIPHER *EVP_idea_ofb(); -EVP_CIPHER *EVP_idea_cbc(); -EVP_CIPHER *EVP_rc2_ecb(); -EVP_CIPHER *EVP_rc2_cbc(); -EVP_CIPHER *EVP_rc2_40_cbc(); -EVP_CIPHER *EVP_rc2_cfb(); -EVP_CIPHER *EVP_rc2_ofb(); -EVP_CIPHER *EVP_bf_ecb(); -EVP_CIPHER *EVP_bf_cbc(); -EVP_CIPHER *EVP_bf_cfb(); -EVP_CIPHER *EVP_bf_ofb(); -EVP_CIPHER *EVP_cast5_ecb(); -EVP_CIPHER *EVP_cast5_cbc(); -EVP_CIPHER *EVP_cast5_cfb(); -EVP_CIPHER *EVP_cast5_ofb(); -EVP_CIPHER *EVP_rc5_32_12_16_cbc(); -EVP_CIPHER *EVP_rc5_32_12_16_ecb(); -EVP_CIPHER *EVP_rc5_32_12_16_cfb(); -EVP_CIPHER *EVP_rc5_32_12_16_ofb(); - -void SSLeay_add_all_algorithms(); -void SSLeay_add_all_ciphers(); -void SSLeay_add_all_digests(); - -int EVP_add_cipher(); -int EVP_add_digest(); -int EVP_add_alias(); -int EVP_delete_alias(); - -EVP_CIPHER *EVP_get_cipherbyname(); -EVP_MD *EVP_get_digestbyname(); -void EVP_cleanup(); - -int EVP_PKEY_decrypt(); -int EVP_PKEY_encrypt(); -int EVP_PKEY_type(); -int EVP_PKEY_bits(); -int EVP_PKEY_size(); -int EVP_PKEY_assign(); -EVP_PKEY * EVP_PKEY_new(); -void EVP_PKEY_free(); -EVP_PKEY * d2i_PublicKey(); -int i2d_PublicKey(); - -EVP_PKEY * d2i_PrivateKey(); -int i2d_PrivateKey(); - -int EVP_PKEY_copy_parameters(); -int EVP_PKEY_missing_parameters(); -int EVP_PKEY_save_parameters(); -int EVP_PKEY_cmp_parameters(); - -int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); -int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); - -int EVP_CIPHER_set_asn1_iv(); -int EVP_CIPHER_get_asn1_iv(); - -#endif +/* PKCS5 password based encryption */ +int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, EVP_CIPHER *cipher, EVP_MD *md, + int en_de); +int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, + unsigned char *salt, int saltlen, int iter, + int keylen, unsigned char *out); +int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, EVP_CIPHER *cipher, EVP_MD *md, + int en_de); + +void PKCS5_PBE_add(void); + +int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen, + ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); +int EVP_PBE_alg_add(int nid, EVP_CIPHER *cipher, EVP_MD *md, + EVP_PBE_KEYGEN *keygen); +void EVP_PBE_cleanup(void); /* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ + /* Error codes for the EVP functions. */ /* Function codes. */ #define EVP_F_D2I_PKEY 100 #define EVP_F_EVP_DECRYPTFINAL 101 +#define EVP_F_EVP_MD_CTX_COPY 110 #define EVP_F_EVP_OPENINIT 102 +#define EVP_F_EVP_PBE_ALG_ADD 115 +#define EVP_F_EVP_PBE_CIPHERINIT 116 +#define EVP_F_EVP_PKCS82PKEY 111 +#define EVP_F_EVP_PKCS8_SET_BROKEN 112 +#define EVP_F_EVP_PKEY2PKCS8 113 #define EVP_F_EVP_PKEY_COPY_PARAMETERS 103 #define EVP_F_EVP_PKEY_DECRYPT 104 #define EVP_F_EVP_PKEY_ENCRYPT 105 #define EVP_F_EVP_PKEY_NEW 106 #define EVP_F_EVP_SIGNFINAL 107 #define EVP_F_EVP_VERIFYFINAL 108 +#define EVP_F_PKCS5_PBE_KEYIVGEN 117 +#define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118 +#define EVP_F_RC2_MAGIC_TO_METH 109 /* Reason codes. */ #define EVP_R_BAD_DECRYPT 100 +#define EVP_R_BN_DECODE_ERROR 112 +#define EVP_R_BN_PUBKEY_ERROR 113 +#define EVP_R_CIPHER_PARAMETER_ERROR 122 +#define EVP_R_DECODE_ERROR 114 #define EVP_R_DIFFERENT_KEY_TYPES 101 +#define EVP_R_ENCODE_ERROR 115 +#define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119 +#define EVP_R_INPUT_NOT_INITIALIZED 111 #define EVP_R_IV_TOO_LARGE 102 +#define EVP_R_KEYGEN_FAILURE 120 #define EVP_R_MISSING_PARMATERS 103 +#define EVP_R_NO_DSA_PARAMETERS 116 #define EVP_R_NO_SIGN_FUNCTION_CONFIGURED 104 #define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105 +#define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE 117 #define EVP_R_PUBLIC_KEY_NOT_RSA 106 +#define EVP_R_UNKNOWN_PBE_ALGORITHM 121 #define EVP_R_UNSUPPORTED_CIPHER 107 -#define EVP_R_WRONG_FINAL_BLOCK_LENGTH 108 -#define EVP_R_WRONG_PUBLIC_KEY_TYPE 109 - +#define EVP_R_UNSUPPORTED_KEYLENGTH 123 +#define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 124 +#define EVP_R_UNSUPPORTED_KEY_SIZE 108 +#define EVP_R_UNSUPPORTED_PRF 125 +#define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM 118 +#define EVP_R_UNSUPPORTED_SALT_TYPE 126 +#define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109 +#define EVP_R_WRONG_PUBLIC_KEY_TYPE 110 + #ifdef __cplusplus } #endif diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c index 93cc3a9464..5299a65b6a 100644 --- a/src/lib/libcrypto/evp/evp_enc.c +++ b/src/lib/libcrypto/evp/evp_enc.c @@ -58,23 +58,18 @@ #include #include "cryptlib.h" -#include "evp.h" +#include -char *EVP_version="EVP part of SSLeay 0.9.0b 29-Jun-1998"; +const char *EVP_version="EVP" OPENSSL_VERSION_PTEXT; -void EVP_CIPHER_CTX_init(ctx) -EVP_CIPHER_CTX *ctx; +void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx) { memset(ctx,0,sizeof(EVP_CIPHER_CTX)); /* ctx->cipher=NULL; */ } -void EVP_CipherInit(ctx,data,key,iv,enc) -EVP_CIPHER_CTX *ctx; -EVP_CIPHER *data; -unsigned char *key; -unsigned char *iv; -int enc; +void EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *data, + unsigned char *key, unsigned char *iv, int enc) { if (enc) EVP_EncryptInit(ctx,data,key,iv); @@ -82,22 +77,15 @@ int enc; EVP_DecryptInit(ctx,data,key,iv); } -void EVP_CipherUpdate(ctx,out,outl,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -int *outl; -unsigned char *in; -int inl; +void EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, + unsigned char *in, int inl) { if (ctx->encrypt) EVP_EncryptUpdate(ctx,out,outl,in,inl); else EVP_DecryptUpdate(ctx,out,outl,in,inl); } -int EVP_CipherFinal(ctx,out,outl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -int *outl; +int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) { if (ctx->encrypt) { @@ -107,11 +95,8 @@ int *outl; else return(EVP_DecryptFinal(ctx,out,outl)); } -void EVP_EncryptInit(ctx,cipher,key,iv) -EVP_CIPHER_CTX *ctx; -EVP_CIPHER *cipher; -unsigned char *key; -unsigned char *iv; +void EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, + unsigned char *key, unsigned char *iv) { if (cipher != NULL) ctx->cipher=cipher; @@ -120,11 +105,8 @@ unsigned char *iv; ctx->buf_len=0; } -void EVP_DecryptInit(ctx,cipher,key,iv) -EVP_CIPHER_CTX *ctx; -EVP_CIPHER *cipher; -unsigned char *key; -unsigned char *iv; +void EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, + unsigned char *key, unsigned char *iv) { if (cipher != NULL) ctx->cipher=cipher; @@ -134,12 +116,8 @@ unsigned char *iv; } -void EVP_EncryptUpdate(ctx,out,outl,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -int *outl; -unsigned char *in; -int inl; +void EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, + unsigned char *in, int inl) { int i,j,bl; @@ -179,10 +157,7 @@ int inl; ctx->buf_len=i; } -void EVP_EncryptFinal(ctx,out,outl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -int *outl; +void EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) { int i,n,b,bl; @@ -200,12 +175,8 @@ int *outl; *outl=b; } -void EVP_DecryptUpdate(ctx,out,outl,in,inl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -int *outl; -unsigned char *in; -int inl; +void EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, + unsigned char *in, int inl) { int b,bl,n; int keep_last=0; @@ -249,10 +220,7 @@ int inl; } } -int EVP_DecryptFinal(ctx,out,outl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -int *outl; +int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) { int i,b; int n; @@ -293,8 +261,7 @@ int *outl; return(1); } -void EVP_CIPHER_CTX_cleanup(c) -EVP_CIPHER_CTX *c; +void EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) { if ((c->cipher != NULL) && (c->cipher->cleanup != NULL)) c->cipher->cleanup(c); diff --git a/src/lib/libcrypto/evp/evp_err.c b/src/lib/libcrypto/evp/evp_err.c index 2b0a0ab93f..c61cc922e8 100644 --- a/src/lib/libcrypto/evp/evp_err.c +++ b/src/lib/libcrypto/evp/evp_err.c @@ -1,63 +1,65 @@ -/* lib/evp/evp_err.c */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. +/* crypto/evp/evp_err.c */ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. 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. + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following 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.] + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * */ + +/* NOTE: this file was auto generated by the mkerr.pl script: any changes + * made to it will be overwritten when the script next updates this file. + */ + #include -#include "err.h" -#include "evp.h" +#include +#include /* BEGIN ERROR CODES */ #ifndef NO_ERR @@ -65,39 +67,65 @@ static ERR_STRING_DATA EVP_str_functs[]= { {ERR_PACK(0,EVP_F_D2I_PKEY,0), "D2I_PKEY"}, {ERR_PACK(0,EVP_F_EVP_DECRYPTFINAL,0), "EVP_DecryptFinal"}, +{ERR_PACK(0,EVP_F_EVP_MD_CTX_COPY,0), "EVP_MD_CTX_copy"}, {ERR_PACK(0,EVP_F_EVP_OPENINIT,0), "EVP_OpenInit"}, +{ERR_PACK(0,EVP_F_EVP_PBE_ALG_ADD,0), "EVP_PBE_alg_add"}, +{ERR_PACK(0,EVP_F_EVP_PBE_CIPHERINIT,0), "EVP_PBE_CipherInit"}, +{ERR_PACK(0,EVP_F_EVP_PKCS82PKEY,0), "EVP_PKCS82PKEY"}, +{ERR_PACK(0,EVP_F_EVP_PKCS8_SET_BROKEN,0), "EVP_PKCS8_SET_BROKEN"}, +{ERR_PACK(0,EVP_F_EVP_PKEY2PKCS8,0), "EVP_PKEY2PKCS8"}, {ERR_PACK(0,EVP_F_EVP_PKEY_COPY_PARAMETERS,0), "EVP_PKEY_copy_parameters"}, {ERR_PACK(0,EVP_F_EVP_PKEY_DECRYPT,0), "EVP_PKEY_decrypt"}, {ERR_PACK(0,EVP_F_EVP_PKEY_ENCRYPT,0), "EVP_PKEY_encrypt"}, {ERR_PACK(0,EVP_F_EVP_PKEY_NEW,0), "EVP_PKEY_new"}, {ERR_PACK(0,EVP_F_EVP_SIGNFINAL,0), "EVP_SignFinal"}, {ERR_PACK(0,EVP_F_EVP_VERIFYFINAL,0), "EVP_VerifyFinal"}, -{0,NULL}, +{ERR_PACK(0,EVP_F_PKCS5_PBE_KEYIVGEN,0), "PKCS5_PBE_keyivgen"}, +{ERR_PACK(0,EVP_F_PKCS5_V2_PBE_KEYIVGEN,0), "PKCS5_v2_PBE_keyivgen"}, +{ERR_PACK(0,EVP_F_RC2_MAGIC_TO_METH,0), "RC2_MAGIC_TO_METH"}, +{0,NULL} }; static ERR_STRING_DATA EVP_str_reasons[]= { {EVP_R_BAD_DECRYPT ,"bad decrypt"}, +{EVP_R_BN_DECODE_ERROR ,"bn decode error"}, +{EVP_R_BN_PUBKEY_ERROR ,"bn pubkey error"}, +{EVP_R_CIPHER_PARAMETER_ERROR ,"cipher parameter error"}, +{EVP_R_DECODE_ERROR ,"decode error"}, {EVP_R_DIFFERENT_KEY_TYPES ,"different key types"}, +{EVP_R_ENCODE_ERROR ,"encode error"}, +{EVP_R_EVP_PBE_CIPHERINIT_ERROR ,"evp pbe cipherinit error"}, +{EVP_R_INPUT_NOT_INITIALIZED ,"input not initialized"}, {EVP_R_IV_TOO_LARGE ,"iv too large"}, +{EVP_R_KEYGEN_FAILURE ,"keygen failure"}, {EVP_R_MISSING_PARMATERS ,"missing parmaters"}, +{EVP_R_NO_DSA_PARAMETERS ,"no dsa parameters"}, {EVP_R_NO_SIGN_FUNCTION_CONFIGURED ,"no sign function configured"}, {EVP_R_NO_VERIFY_FUNCTION_CONFIGURED ,"no verify function configured"}, +{EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE ,"pkcs8 unknown broken type"}, {EVP_R_PUBLIC_KEY_NOT_RSA ,"public key not rsa"}, +{EVP_R_UNKNOWN_PBE_ALGORITHM ,"unknown pbe algorithm"}, {EVP_R_UNSUPPORTED_CIPHER ,"unsupported cipher"}, +{EVP_R_UNSUPPORTED_KEYLENGTH ,"unsupported keylength"}, +{EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION,"unsupported key derivation function"}, +{EVP_R_UNSUPPORTED_KEY_SIZE ,"unsupported key size"}, +{EVP_R_UNSUPPORTED_PRF ,"unsupported prf"}, +{EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM ,"unsupported private key algorithm"}, +{EVP_R_UNSUPPORTED_SALT_TYPE ,"unsupported salt type"}, {EVP_R_WRONG_FINAL_BLOCK_LENGTH ,"wrong final block length"}, {EVP_R_WRONG_PUBLIC_KEY_TYPE ,"wrong public key type"}, -{0,NULL}, +{0,NULL} }; #endif -void ERR_load_EVP_strings() +void ERR_load_EVP_strings(void) { static int init=1; - if (init); - {; + if (init) + { init=0; #ifndef NO_ERR ERR_load_strings(ERR_LIB_EVP,EVP_str_functs); diff --git a/src/lib/libcrypto/evp/evp_key.c b/src/lib/libcrypto/evp/evp_key.c index dafa686f64..21eda418bc 100644 --- a/src/lib/libcrypto/evp/evp_key.c +++ b/src/lib/libcrypto/evp/evp_key.c @@ -58,15 +58,14 @@ #include #include "cryptlib.h" -#include "x509.h" -#include "objects.h" -#include "evp.h" +#include +#include +#include /* should be init to zeros. */ static char prompt_string[80]; -void EVP_set_pw_prompt(prompt) -char *prompt; +void EVP_set_pw_prompt(char *prompt) { if (prompt == NULL) prompt_string[0]='\0'; @@ -74,7 +73,7 @@ char *prompt; strncpy(prompt_string,prompt,79); } -char *EVP_get_pw_prompt() +char *EVP_get_pw_prompt(void) { if (prompt_string[0] == '\0') return(NULL); @@ -83,29 +82,19 @@ char *EVP_get_pw_prompt() } #ifdef NO_DES -int des_read_pw_string(char *buf,int len,char *prompt,int verify); +int des_read_pw_string(char *buf,int len,const char *prompt,int verify); #endif -int EVP_read_pw_string(buf,len,prompt,verify) -char *buf; -int len; -char *prompt; -int verify; +int EVP_read_pw_string(char *buf, int len, const char *prompt, int verify) { if ((prompt == NULL) && (prompt_string[0] != '\0')) prompt=prompt_string; return(des_read_pw_string(buf,len,prompt,verify)); } -int EVP_BytesToKey(type,md,salt,data,datal,count,key,iv) -EVP_CIPHER *type; -EVP_MD *md; -unsigned char *salt; -unsigned char *data; -int datal; -int count; -unsigned char *key; -unsigned char *iv; +int EVP_BytesToKey(const EVP_CIPHER *type, EVP_MD *md, unsigned char *salt, + unsigned char *data, int datal, int count, unsigned char *key, + unsigned char *iv) { EVP_MD_CTX c; unsigned char md_buf[EVP_MAX_MD_SIZE]; diff --git a/src/lib/libcrypto/evp/evp_lib.c b/src/lib/libcrypto/evp/evp_lib.c index 69784eb555..3f9bf55828 100644 --- a/src/lib/libcrypto/evp/evp_lib.c +++ b/src/lib/libcrypto/evp/evp_lib.c @@ -58,12 +58,10 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include -int EVP_CIPHER_param_to_asn1(c,type) -EVP_CIPHER_CTX *c; -ASN1_TYPE *type; +int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type) { int ret; @@ -74,9 +72,7 @@ ASN1_TYPE *type; return(ret); } -int EVP_CIPHER_asn1_to_param(c,type) -EVP_CIPHER_CTX *c; -ASN1_TYPE *type; +int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type) { int ret; @@ -87,9 +83,7 @@ ASN1_TYPE *type; return(ret); } -int EVP_CIPHER_get_asn1_iv(c,type) -EVP_CIPHER_CTX *c; -ASN1_TYPE *type; +int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) { int i=0,l; @@ -97,14 +91,15 @@ ASN1_TYPE *type; { l=EVP_CIPHER_CTX_iv_length(c); i=ASN1_TYPE_get_octetstring(type,c->oiv,l); - memcpy(c->iv,c->oiv,l); + if (i != l) + return(-1); + else if (i > 0) + memcpy(c->iv,c->oiv,l); } return(i); } -int EVP_CIPHER_set_asn1_iv(c,type) -EVP_CIPHER_CTX *c; -ASN1_TYPE *type; +int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) { int i=0,j; @@ -115,3 +110,29 @@ ASN1_TYPE *type; } return(i); } + +/* Convert the various cipher NIDs and dummies to a proper OID NID */ +int EVP_CIPHER_type(const EVP_CIPHER *ctx) +{ + int nid; + nid = EVP_CIPHER_nid(ctx); + + switch(nid) { + + case NID_rc2_cbc: + case NID_rc2_64_cbc: + case NID_rc2_40_cbc: + + return NID_rc2_cbc; + + case NID_rc4: + case NID_rc4_40: + + return NID_rc4; + + default: + + return nid; + } +} + diff --git a/src/lib/libcrypto/evp/evp_pbe.c b/src/lib/libcrypto/evp/evp_pbe.c new file mode 100644 index 0000000000..353c3ad667 --- /dev/null +++ b/src/lib/libcrypto/evp/evp_pbe.c @@ -0,0 +1,134 @@ +/* evp_pbe.c */ +/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL + * project 1999. + */ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#include +#include +#include +#include "cryptlib.h" + +/* Password based encryption (PBE) functions */ + +static STACK *pbe_algs; + +/* Setup a cipher context from a PBE algorithm */ + +typedef struct { +int pbe_nid; +EVP_CIPHER *cipher; +EVP_MD *md; +EVP_PBE_KEYGEN *keygen; +} EVP_PBE_CTL; + +int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen, + ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de) +{ + + EVP_PBE_CTL *pbetmp, pbelu; + int i; + pbelu.pbe_nid = OBJ_obj2nid(pbe_obj); + if (pbelu.pbe_nid != NID_undef) i = sk_find(pbe_algs, (char *)&pbelu); + else i = -1; + + if (i == -1) { + char obj_tmp[80]; + EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_UNKNOWN_PBE_ALGORITHM); + if (!pbe_obj) strcpy (obj_tmp, "NULL"); + else i2t_ASN1_OBJECT(obj_tmp, 80, pbe_obj); + ERR_add_error_data(2, "TYPE=", obj_tmp); + return 0; + } + if (passlen == -1) passlen = strlen(pass); + pbetmp = (EVP_PBE_CTL *)sk_value (pbe_algs, i); + i = (*pbetmp->keygen)(ctx, pass, passlen, param, pbetmp->cipher, + pbetmp->md, en_de); + if (!i) { + EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_KEYGEN_FAILURE); + return 0; + } + return 1; +} + +static int pbe_cmp (EVP_PBE_CTL **pbe1, EVP_PBE_CTL **pbe2) +{ + return ((*pbe1)->pbe_nid - (*pbe2)->pbe_nid); +} + +/* Add a PBE algorithm */ + +int EVP_PBE_alg_add (int nid, EVP_CIPHER *cipher, EVP_MD *md, + EVP_PBE_KEYGEN *keygen) +{ + EVP_PBE_CTL *pbe_tmp; + if (!pbe_algs) pbe_algs = sk_new (pbe_cmp); + if (!(pbe_tmp = (EVP_PBE_CTL*) Malloc (sizeof(EVP_PBE_CTL)))) { + EVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE); + return 0; + } + pbe_tmp->pbe_nid = nid; + pbe_tmp->cipher = cipher; + pbe_tmp->md = md; + pbe_tmp->keygen = keygen; + sk_push (pbe_algs, (char *)pbe_tmp); + return 1; +} + +void EVP_PBE_cleanup(void) +{ + sk_pop_free(pbe_algs, FreeFunc); + pbe_algs = NULL; +} diff --git a/src/lib/libcrypto/evp/evp_pkey.c b/src/lib/libcrypto/evp/evp_pkey.c new file mode 100644 index 0000000000..421e452db1 --- /dev/null +++ b/src/lib/libcrypto/evp/evp_pkey.c @@ -0,0 +1,298 @@ +/* evp_pkey.c */ +/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL + * project 1999. + */ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#include +#include +#include "cryptlib.h" +#include +#include + +/* Extract a private key from a PKCS8 structure */ + +EVP_PKEY *EVP_PKCS82PKEY (PKCS8_PRIV_KEY_INFO *p8) +{ + EVP_PKEY *pkey; +#ifndef NO_RSA + RSA *rsa; +#endif +#ifndef NO_DSA + DSA *dsa; + ASN1_INTEGER *dsapriv; + STACK *ndsa; + BN_CTX *ctx; + int plen; +#endif + X509_ALGOR *a; + unsigned char *p; + int pkeylen; + char obj_tmp[80]; + + switch (p8->broken) { + case PKCS8_OK: + p = p8->pkey->value.octet_string->data; + pkeylen = p8->pkey->value.octet_string->length; + break; + + case PKCS8_NO_OCTET: + p = p8->pkey->value.sequence->data; + pkeylen = p8->pkey->value.sequence->length; + break; + + default: + EVPerr(EVP_F_EVP_PKCS82PKEY,EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE); + return NULL; + break; + } + if (!(pkey = EVP_PKEY_new())) { + EVPerr(EVP_F_EVP_PKCS82PKEY,ERR_R_MALLOC_FAILURE); + return NULL; + } + a = p8->pkeyalg; + switch (OBJ_obj2nid(a->algorithm)) + { +#ifndef NO_RSA + case NID_rsaEncryption: + if (!(rsa = d2i_RSAPrivateKey (NULL, &p, pkeylen))) { + EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); + return NULL; + } + EVP_PKEY_assign_RSA (pkey, rsa); + break; +#endif +#ifndef NO_DSA + case NID_dsa: + /* PKCS#8 DSA is weird: you just get a private key integer + * and parameters in the AlgorithmIdentifier the pubkey must + * be recalculated. + */ + + /* Check for broken Netscape Database DSA PKCS#8, UGH! */ + if(*p == (V_ASN1_SEQUENCE|V_ASN1_CONSTRUCTED)) { + if(!(ndsa = ASN1_seq_unpack(p, pkeylen, + (char *(*)())d2i_ASN1_INTEGER, + ASN1_STRING_free))) { + EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); + return NULL; + } + if(sk_num(ndsa) != 2 ) { + EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); + sk_pop_free(ndsa, ASN1_STRING_free); + return NULL; + } + dsapriv = (ASN1_INTEGER *) sk_pop(ndsa); + sk_pop_free(ndsa, ASN1_STRING_free); + } else if (!(dsapriv=d2i_ASN1_INTEGER (NULL, &p, pkeylen))) { + EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); + return NULL; + } + /* Retrieve parameters */ + if (a->parameter->type != V_ASN1_SEQUENCE) { + EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_NO_DSA_PARAMETERS); + return NULL; + } + p = a->parameter->value.sequence->data; + plen = a->parameter->value.sequence->length; + if (!(dsa = d2i_DSAparams (NULL, &p, plen))) { + EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); + return NULL; + } + /* We have parameters now set private key */ + if (!(dsa->priv_key = ASN1_INTEGER_to_BN(dsapriv, NULL))) { + EVPerr(EVP_F_EVP_PKCS82PKEY,EVP_R_BN_DECODE_ERROR); + DSA_free (dsa); + return NULL; + } + /* Calculate public key (ouch!) */ + if (!(dsa->pub_key = BN_new())) { + EVPerr(EVP_F_EVP_PKCS82PKEY,ERR_R_MALLOC_FAILURE); + DSA_free (dsa); + return NULL; + } + if (!(ctx = BN_CTX_new())) { + EVPerr(EVP_F_EVP_PKCS82PKEY,ERR_R_MALLOC_FAILURE); + DSA_free (dsa); + return NULL; + } + + if (!BN_mod_exp(dsa->pub_key, dsa->g, + dsa->priv_key, dsa->p, ctx)) { + + EVPerr(EVP_F_EVP_PKCS82PKEY,EVP_R_BN_PUBKEY_ERROR); + BN_CTX_free (ctx); + DSA_free (dsa); + return NULL; + } + + EVP_PKEY_assign_DSA (pkey, dsa); + BN_CTX_free (ctx); + break; +#endif + default: + EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM); + if (!a->algorithm) strcpy (obj_tmp, "NULL"); + else i2t_ASN1_OBJECT(obj_tmp, 80, a->algorithm); + ERR_add_error_data(2, "TYPE=", obj_tmp); + EVP_PKEY_free (pkey); + return NULL; + } + return pkey; +} + +/* Turn a private key into a PKCS8 structure */ + +PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey) +{ + PKCS8_PRIV_KEY_INFO *p8; +#ifndef NO_DSA + ASN1_INTEGER *dpkey; + unsigned char *p, *q; + int len; +#endif + if (!(p8 = PKCS8_PRIV_KEY_INFO_new())) { + EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); + return NULL; + } + ASN1_INTEGER_set (p8->version, 0); + if (!(p8->pkeyalg->parameter = ASN1_TYPE_new ())) { + EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); + PKCS8_PRIV_KEY_INFO_free (p8); + return NULL; + } + switch (EVP_PKEY_type(pkey->type)) { +#ifndef NO_RSA + case EVP_PKEY_RSA: + + p8->pkeyalg->algorithm = OBJ_nid2obj(NID_rsaEncryption); + p8->pkeyalg->parameter->type = V_ASN1_NULL; + if (!ASN1_pack_string ((char *)pkey, i2d_PrivateKey, + &p8->pkey->value.octet_string)) { + EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); + PKCS8_PRIV_KEY_INFO_free (p8); + return NULL; + } + break; +#endif +#ifndef NO_DSA + case EVP_PKEY_DSA: + p8->pkeyalg->algorithm = OBJ_nid2obj(NID_dsa); + + /* get paramaters and place in AlgorithmIdentifier */ + len = i2d_DSAparams (pkey->pkey.dsa, NULL); + if (!(p = Malloc(len))) { + EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); + PKCS8_PRIV_KEY_INFO_free (p8); + return NULL; + } + q = p; + i2d_DSAparams (pkey->pkey.dsa, &q); + p8->pkeyalg->parameter->type = V_ASN1_SEQUENCE; + p8->pkeyalg->parameter->value.sequence = ASN1_STRING_new(); + ASN1_STRING_set(p8->pkeyalg->parameter->value.sequence, p, len); + Free(p); + /* Get private key into an integer and pack */ + if (!(dpkey = BN_to_ASN1_INTEGER (pkey->pkey.dsa->priv_key, NULL))) { + EVPerr(EVP_F_EVP_PKEY2PKCS8,EVP_R_ENCODE_ERROR); + PKCS8_PRIV_KEY_INFO_free (p8); + return NULL; + } + + if (!ASN1_pack_string((char *)dpkey, i2d_ASN1_INTEGER, + &p8->pkey->value.octet_string)) { + EVPerr(EVP_F_EVP_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); + ASN1_INTEGER_free (dpkey); + PKCS8_PRIV_KEY_INFO_free (p8); + return NULL; + } + ASN1_INTEGER_free (dpkey); + break; +#endif + default: + EVPerr(EVP_F_EVP_PKEY2PKCS8, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM); + PKCS8_PRIV_KEY_INFO_free (p8); + return NULL; + } + p8->pkey->type = V_ASN1_OCTET_STRING; + RAND_seed (p8->pkey->value.octet_string->data, + p8->pkey->value.octet_string->length); + return p8; +} + +PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken) +{ + switch (broken) { + + case PKCS8_OK: + p8->broken = PKCS8_OK; + return p8; + break; + + case PKCS8_NO_OCTET: + p8->broken = PKCS8_NO_OCTET; + p8->pkey->type = V_ASN1_SEQUENCE; + return p8; + break; + + default: + EVPerr(EVP_F_EVP_PKCS8_SET_BROKEN,EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE); + return NULL; + break; + + } +} + + diff --git a/src/lib/libcrypto/evp/m_dss.c b/src/lib/libcrypto/evp/m_dss.c index 3549b1699c..8ea826868e 100644 --- a/src/lib/libcrypto/evp/m_dss.c +++ b/src/lib/libcrypto/evp/m_dss.c @@ -58,10 +58,11 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" -#include "x509.h" +#include +#include +#include +#ifndef NO_SHA static EVP_MD dsa_md= { NID_dsaWithSHA, @@ -75,8 +76,8 @@ static EVP_MD dsa_md= sizeof(EVP_MD *)+sizeof(SHA_CTX), }; -EVP_MD *EVP_dss() +EVP_MD *EVP_dss(void) { return(&dsa_md); } - +#endif diff --git a/src/lib/libcrypto/evp/m_dss1.c b/src/lib/libcrypto/evp/m_dss1.c index ff256b7b20..9d8d1ce23e 100644 --- a/src/lib/libcrypto/evp/m_dss1.c +++ b/src/lib/libcrypto/evp/m_dss1.c @@ -56,11 +56,12 @@ * [including the GNU Public Licence.] */ +#ifndef NO_SHA #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" -#include "x509.h" +#include +#include +#include static EVP_MD dss1_md= { @@ -75,7 +76,8 @@ static EVP_MD dss1_md= sizeof(EVP_MD *)+sizeof(SHA_CTX), }; -EVP_MD *EVP_dss1() +EVP_MD *EVP_dss1(void) { return(&dss1_md); } +#endif diff --git a/src/lib/libcrypto/evp/m_md2.c b/src/lib/libcrypto/evp/m_md2.c index 2209416142..3281e91809 100644 --- a/src/lib/libcrypto/evp/m_md2.c +++ b/src/lib/libcrypto/evp/m_md2.c @@ -56,11 +56,12 @@ * [including the GNU Public Licence.] */ +#ifndef NO_MD2 #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" -#include "x509.h" +#include +#include +#include static EVP_MD md2_md= { @@ -75,8 +76,8 @@ static EVP_MD md2_md= sizeof(EVP_MD *)+sizeof(MD2_CTX), }; -EVP_MD *EVP_md2() +EVP_MD *EVP_md2(void) { return(&md2_md); } - +#endif diff --git a/src/lib/libcrypto/evp/m_md5.c b/src/lib/libcrypto/evp/m_md5.c index d65db9aa1d..9fc9530127 100644 --- a/src/lib/libcrypto/evp/m_md5.c +++ b/src/lib/libcrypto/evp/m_md5.c @@ -56,11 +56,12 @@ * [including the GNU Public Licence.] */ +#ifndef NO_MD5 #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" -#include "x509.h" +#include +#include +#include static EVP_MD md5_md= { @@ -75,7 +76,8 @@ static EVP_MD md5_md= sizeof(EVP_MD *)+sizeof(MD5_CTX), }; -EVP_MD *EVP_md5() +EVP_MD *EVP_md5(void) { return(&md5_md); } +#endif diff --git a/src/lib/libcrypto/evp/m_mdc2.c b/src/lib/libcrypto/evp/m_mdc2.c index 64a853eb7f..2c7f1ae515 100644 --- a/src/lib/libcrypto/evp/m_mdc2.c +++ b/src/lib/libcrypto/evp/m_mdc2.c @@ -56,11 +56,12 @@ * [including the GNU Public Licence.] */ +#ifndef NO_MDC2 #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" -#include "x509.h" +#include +#include +#include static EVP_MD mdc2_md= { @@ -75,7 +76,8 @@ static EVP_MD mdc2_md= sizeof(EVP_MD *)+sizeof(MDC2_CTX), }; -EVP_MD *EVP_mdc2() +EVP_MD *EVP_mdc2(void) { return(&mdc2_md); } +#endif diff --git a/src/lib/libcrypto/evp/m_null.c b/src/lib/libcrypto/evp/m_null.c index 6d80560df2..e2dadf3dab 100644 --- a/src/lib/libcrypto/evp/m_null.c +++ b/src/lib/libcrypto/evp/m_null.c @@ -58,11 +58,11 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" -#include "x509.h" +#include +#include +#include -static void function() +static void function(void) { } @@ -80,7 +80,7 @@ static EVP_MD null_md= sizeof(EVP_MD *), }; -EVP_MD *EVP_md_null() +EVP_MD *EVP_md_null(void) { return(&null_md); } diff --git a/src/lib/libcrypto/evp/m_ripemd.c b/src/lib/libcrypto/evp/m_ripemd.c index 04c5d8897b..3d781a4e8d 100644 --- a/src/lib/libcrypto/evp/m_ripemd.c +++ b/src/lib/libcrypto/evp/m_ripemd.c @@ -56,11 +56,13 @@ * [including the GNU Public Licence.] */ +#ifndef NO_RIPEMD #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" -#include "x509.h" +#include +#include +#include +#include static EVP_MD ripemd160_md= { @@ -75,7 +77,8 @@ static EVP_MD ripemd160_md= sizeof(EVP_MD *)+sizeof(RIPEMD160_CTX), }; -EVP_MD *EVP_ripemd160() +EVP_MD *EVP_ripemd160(void) { return(&ripemd160_md); } +#endif diff --git a/src/lib/libcrypto/evp/m_sha.c b/src/lib/libcrypto/evp/m_sha.c index af4e434a22..6d35b71b85 100644 --- a/src/lib/libcrypto/evp/m_sha.c +++ b/src/lib/libcrypto/evp/m_sha.c @@ -56,11 +56,12 @@ * [including the GNU Public Licence.] */ +#ifndef NO_SHA #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" -#include "x509.h" +#include +#include +#include static EVP_MD sha_md= { @@ -75,8 +76,8 @@ static EVP_MD sha_md= sizeof(EVP_MD *)+sizeof(SHA_CTX), }; -EVP_MD *EVP_sha() +EVP_MD *EVP_sha(void) { return(&sha_md); } - +#endif diff --git a/src/lib/libcrypto/evp/m_sha1.c b/src/lib/libcrypto/evp/m_sha1.c index 87135a9cf2..57a1ab0cce 100644 --- a/src/lib/libcrypto/evp/m_sha1.c +++ b/src/lib/libcrypto/evp/m_sha1.c @@ -56,11 +56,12 @@ * [including the GNU Public Licence.] */ +#ifndef NO_SHA #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" -#include "x509.h" +#include +#include +#include static EVP_MD sha1_md= { @@ -75,7 +76,8 @@ static EVP_MD sha1_md= sizeof(EVP_MD *)+sizeof(SHA_CTX), }; -EVP_MD *EVP_sha1() +EVP_MD *EVP_sha1(void) { return(&sha1_md); } +#endif diff --git a/src/lib/libcrypto/evp/names.c b/src/lib/libcrypto/evp/names.c index e0774da20d..3e8f460328 100644 --- a/src/lib/libcrypto/evp/names.c +++ b/src/lib/libcrypto/evp/names.c @@ -58,228 +58,61 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" +#include +#include +#include -typedef struct aliases_st { - char *alias; - /* This must be the last field becaue I will allocate things - * so they go off the end of it */ - char name[4]; - } ALIASES; - -static STACK /* ALIASES */ *aliases=NULL; -static STACK /* EVP_CIPHERS */ *ciphers=NULL; -static STACK /* EVP_MD */ *digests=NULL; - -static int cipher_nid_cmp(a,b) -EVP_CIPHER **a,**b; - { return((*a)->nid - (*b)->nid); } - -static int digest_type_cmp(a,b) -EVP_MD **a,**b; - { return((*a)->pkey_type - (*b)->pkey_type); } - -int EVP_add_cipher(c) -EVP_CIPHER *c; - { - int i; - - if (ciphers == NULL) - { - ciphers=sk_new(cipher_nid_cmp); - if (ciphers == NULL) return(0); - } - if ((i=sk_find(ciphers,(char *)c)) >= 0) - { - if (sk_value(ciphers,i) == (char *)c) - return(1); - sk_delete(ciphers,i); - } - return(sk_push(ciphers,(char *)c)); - } - -int EVP_add_digest(md) -EVP_MD *md; +int EVP_add_cipher(EVP_CIPHER *c) { - int i; - char *n; + int r; - if (digests == NULL) - { - digests=sk_new(digest_type_cmp); - if (digests == NULL) return(0); - } - if ((i=sk_find(digests,(char *)md)) >= 0) - { - if (sk_value(digests,i) == (char *)md) - return(1); - sk_delete(digests,i); - } - if (md->type != md->pkey_type) - { - n=OBJ_nid2sn(md->pkey_type); - EVP_add_alias(n,OBJ_nid2sn(md->type)); - EVP_add_alias(n,OBJ_nid2ln(md->type)); - } - sk_push(digests,(char *)md); - return(1); - } - -static int alias_cmp(a,b) -ALIASES **a,**b; - { - return(strcmp((*a)->alias,(*b)->alias)); + r=OBJ_NAME_add(OBJ_nid2sn(c->nid),OBJ_NAME_TYPE_CIPHER_METH,(char *)c); + if (r == 0) return(0); + r=OBJ_NAME_add(OBJ_nid2ln(c->nid),OBJ_NAME_TYPE_CIPHER_METH,(char *)c); + return(r); } -int EVP_add_alias(name,aname) -char *name; -char *aname; +int EVP_add_digest(EVP_MD *md) { - int l1,l2,i; - ALIASES *a; - char *p; + int r; + const char *name; - if ((name == NULL) || (aname == NULL)) return(0); - l1=strlen(name)+1; - l2=strlen(aname)+1; - i=sizeof(ALIASES)+l1+l2; - if ((a=(ALIASES *)Malloc(i)) == NULL) - return(0); - strcpy(a->name,name); - p= &(a->name[l1]); - strcpy(p,aname); - a->alias=p; + name=OBJ_nid2sn(md->type); + r=OBJ_NAME_add(name,OBJ_NAME_TYPE_MD_METH,(char *)md); + if (r == 0) return(0); + r=OBJ_NAME_add(OBJ_nid2ln(md->type),OBJ_NAME_TYPE_MD_METH,(char *)md); + if (r == 0) return(0); - if (aliases == NULL) - { - aliases=sk_new(alias_cmp); - if (aliases == NULL) goto err; - } - - if ((i=sk_find(aliases,(char *)a)) >= 0) + if (md->type != md->pkey_type) { - Free(sk_delete(aliases,i)); + r=OBJ_NAME_add(OBJ_nid2sn(md->pkey_type), + OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,name); + if (r == 0) return(0); + r=OBJ_NAME_add(OBJ_nid2ln(md->pkey_type), + OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,name); } - if (!sk_push(aliases,(char *)a)) goto err; - return(1); -err: - return(0); + return(r); } -int EVP_delete_alias(name) -char *name; +const EVP_CIPHER *EVP_get_cipherbyname(const char *name) { - ALIASES a; - int i; + const EVP_CIPHER *cp; - if (aliases != NULL) - { - a.alias=name; - if ((i=sk_find(aliases,(char *)&a)) >= 0) - { - Free(sk_delete(aliases,i)); - return(1); - } - } - return(0); + cp=(const EVP_CIPHER *)OBJ_NAME_get(name,OBJ_NAME_TYPE_CIPHER_METH); + return(cp); } -EVP_CIPHER *EVP_get_cipherbyname(name) -char *name; +const EVP_MD *EVP_get_digestbyname(const char *name) { - int nid,num=6,i; - EVP_CIPHER c,*cp; - ALIASES a,*ap; - - if (ciphers == NULL) return(NULL); - for (;;) - { - if (num-- <= 0) return(NULL); - if (aliases != NULL) - { - a.alias=name; - i=sk_find(aliases,(char *)&a); - if (i >= 0) - { - ap=(ALIASES *)sk_value(aliases,i); - name=ap->name; - continue; - } - } + const EVP_MD *cp; - nid=OBJ_txt2nid(name); - if (nid == NID_undef) return(NULL); - c.nid=nid; - i=sk_find(ciphers,(char *)&c); - if (i >= 0) - { - cp=(EVP_CIPHER *)sk_value(ciphers,i); - return(cp); - } - else - return(NULL); - } + cp=(const EVP_MD *)OBJ_NAME_get(name,OBJ_NAME_TYPE_MD_METH); + return(cp); } -EVP_MD *EVP_get_digestbyname(name) -char *name; +void EVP_cleanup(void) { - int nid,num=6,i; - EVP_MD c,*cp; - ALIASES a,*ap; - - if (digests == NULL) return(NULL); - - for (;;) - { - if (num-- <= 0) return(NULL); - - if (aliases != NULL) - { - a.alias=name; - i=sk_find(aliases,(char *)&a); - if (i >= 0) - { - ap=(ALIASES *)sk_value(aliases,i); - name=ap->name; - continue; - } - } - - nid=OBJ_txt2nid(name); - if (nid == NID_undef) return(NULL); - c.pkey_type=nid; - i=sk_find(digests,(char *)&c); - if (i >= 0) - { - cp=(EVP_MD *)sk_value(digests,i); - return(cp); - } - else - return(NULL); - } - } - -void EVP_cleanup() - { - int i; - - if (aliases != NULL) - { - for (i=0; i +#include +#include +#include +#include "cryptlib.h" + +/* PKCS#5 v1.5 compatible PBE functions: see PKCS#5 v2.0 for more info. + */ + +void PKCS5_PBE_add(void) +{ +#ifndef NO_DES +# ifndef NO_MD5 +EVP_PBE_alg_add(NID_pbeWithMD5AndDES_CBC, EVP_des_cbc(), EVP_md5(), + PKCS5_PBE_keyivgen); +# endif +# ifndef NO_MD2 +EVP_PBE_alg_add(NID_pbeWithMD2AndDES_CBC, EVP_des_cbc(), EVP_md2(), + PKCS5_PBE_keyivgen); +# endif +# ifndef NO_SHA +EVP_PBE_alg_add(NID_pbeWithSHA1AndDES_CBC, EVP_des_cbc(), EVP_sha1(), + PKCS5_PBE_keyivgen); +# endif +#endif +#ifndef NO_RC2 +# ifndef NO_MD5 +EVP_PBE_alg_add(NID_pbeWithMD5AndRC2_CBC, EVP_rc2_64_cbc(), EVP_md5(), + PKCS5_PBE_keyivgen); +# endif +# ifndef NO_MD2 +EVP_PBE_alg_add(NID_pbeWithMD2AndRC2_CBC, EVP_rc2_64_cbc(), EVP_md2(), + PKCS5_PBE_keyivgen); +# endif +# ifndef NO_SHA +EVP_PBE_alg_add(NID_pbeWithSHA1AndRC2_CBC, EVP_rc2_64_cbc(), EVP_sha1(), + PKCS5_PBE_keyivgen); +# endif +#endif +#ifndef NO_HMAC +EVP_PBE_alg_add(NID_pbes2, NULL, NULL, PKCS5_v2_PBE_keyivgen); +#endif +} + +int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen, + ASN1_TYPE *param, EVP_CIPHER *cipher, EVP_MD *md, + int en_de) +{ + EVP_MD_CTX ctx; + unsigned char md_tmp[EVP_MAX_MD_SIZE]; + unsigned char key[EVP_MAX_KEY_LENGTH], iv[EVP_MAX_IV_LENGTH]; + int i; + PBEPARAM *pbe; + int saltlen, iter; + unsigned char *salt, *pbuf; + + /* Extract useful info from parameter */ + pbuf = param->value.sequence->data; + if (!param || (param->type != V_ASN1_SEQUENCE) || + !(pbe = d2i_PBEPARAM (NULL, &pbuf, param->value.sequence->length))) { + EVPerr(EVP_F_PKCS5_PBE_KEYIVGEN,EVP_R_DECODE_ERROR); + return 0; + } + + if (!pbe->iter) iter = 1; + else iter = ASN1_INTEGER_get (pbe->iter); + salt = pbe->salt->data; + saltlen = pbe->salt->length; + + EVP_DigestInit (&ctx, md); + EVP_DigestUpdate (&ctx, pass, passlen); + EVP_DigestUpdate (&ctx, salt, saltlen); + PBEPARAM_free(pbe); + EVP_DigestFinal (&ctx, md_tmp, NULL); + for (i = 1; i < iter; i++) { + EVP_DigestInit(&ctx, md); + EVP_DigestUpdate(&ctx, md_tmp, EVP_MD_size(md)); + EVP_DigestFinal (&ctx, md_tmp, NULL); + } + memcpy (key, md_tmp, EVP_CIPHER_key_length(cipher)); + memcpy (iv, md_tmp + (16 - EVP_CIPHER_iv_length(cipher)), + EVP_CIPHER_iv_length(cipher)); + EVP_CipherInit(cctx, cipher, key, iv, en_de); + memset(md_tmp, 0, EVP_MAX_MD_SIZE); + memset(key, 0, EVP_MAX_KEY_LENGTH); + memset(iv, 0, EVP_MAX_IV_LENGTH); + return 1; +} diff --git a/src/lib/libcrypto/evp/p5_crpt2.c b/src/lib/libcrypto/evp/p5_crpt2.c new file mode 100644 index 0000000000..27a2c518be --- /dev/null +++ b/src/lib/libcrypto/evp/p5_crpt2.c @@ -0,0 +1,247 @@ +/* p5_crpt2.c */ +/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL + * project 1999. + */ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +#if !defined(NO_HMAC) && !defined(NO_SHA) +#include +#include +#include +#include +#include +#include "cryptlib.h" + +/* set this to print out info about the keygen algorithm */ +/* #define DEBUG_PKCS5V2 */ + +#ifdef DEBUG_PKCS5V2 + static void h__dump (const unsigned char *p, int len); +#endif + +/* This is an implementation of PKCS#5 v2.0 password based encryption key + * derivation function PBKDF2 using the only currently defined function HMAC + * with SHA1. Verified against test vectors posted by Peter Gutmann + * to the PKCS-TNG mailing list. + */ + +int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, + unsigned char *salt, int saltlen, int iter, + int keylen, unsigned char *out) +{ + unsigned char digtmp[SHA_DIGEST_LENGTH], *p, itmp[4]; + int cplen, j, k, tkeylen; + unsigned long i = 1; + HMAC_CTX hctx; + p = out; + tkeylen = keylen; + if(passlen == -1) passlen = strlen(pass); + while(tkeylen) { + if(tkeylen > SHA_DIGEST_LENGTH) cplen = SHA_DIGEST_LENGTH; + else cplen = tkeylen; + /* We are unlikely to ever use more than 256 blocks (5120 bits!) + * but just in case... + */ + itmp[0] = (unsigned char)((i >> 24) & 0xff); + itmp[1] = (unsigned char)((i >> 16) & 0xff); + itmp[2] = (unsigned char)((i >> 8) & 0xff); + itmp[3] = (unsigned char)(i & 0xff); + HMAC_Init(&hctx, pass, passlen, EVP_sha1()); + HMAC_Update(&hctx, salt, saltlen); + HMAC_Update(&hctx, itmp, 4); + HMAC_Final(&hctx, digtmp, NULL); + memcpy(p, digtmp, cplen); + for(j = 1; j < iter; j++) { + HMAC(EVP_sha1(), pass, passlen, + digtmp, SHA_DIGEST_LENGTH, digtmp, NULL); + for(k = 0; k < cplen; k++) p[k] ^= digtmp[k]; + } + tkeylen-= cplen; + i++; + p+= cplen; + } + HMAC_cleanup(&hctx); +#ifdef DEBUG_PKCS5V2 + fprintf(stderr, "Password:\n"); + h__dump (pass, passlen); + fprintf(stderr, "Salt:\n"); + h__dump (salt, saltlen); + fprintf(stderr, "Iteration count %d\n", iter); + fprintf(stderr, "Key:\n"); + h__dump (out, keylen); +#endif + return 1; +} + +#ifdef DO_TEST +main() +{ + unsigned char out[4]; + unsigned char salt[] = {0x12, 0x34, 0x56, 0x78}; + PKCS5_PBKDF2_HMAC_SHA1("password", -1, salt, 4, 5, 4, out); + fprintf(stderr, "Out %02X %02X %02X %02X\n", + out[0], out[1], out[2], out[3]); +} + +#endif + +/* Now the key derivation function itself. This is a bit evil because + * it has to check the ASN1 parameters are valid: and there are quite a + * few of them... + */ + +int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, EVP_CIPHER *c, EVP_MD *md, + int en_de) +{ + unsigned char *pbuf, *salt, key[EVP_MAX_KEY_LENGTH]; + int saltlen, keylen, iter, plen; + PBE2PARAM *pbe2 = NULL; + const EVP_CIPHER *cipher; + PBKDF2PARAM *kdf = NULL; + + pbuf = param->value.sequence->data; + plen = param->value.sequence->length; + if(!param || (param->type != V_ASN1_SEQUENCE) || + !(pbe2 = d2i_PBE2PARAM(NULL, &pbuf, plen))) { + EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,EVP_R_DECODE_ERROR); + return 0; + } + + /* See if we recognise the key derivation function */ + + if(OBJ_obj2nid(pbe2->keyfunc->algorithm) != NID_id_pbkdf2) { + EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, + EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION); + goto err; + } + + /* lets see if we recognise the encryption algorithm. + */ + + cipher = EVP_get_cipherbyname( + OBJ_nid2sn(OBJ_obj2nid(pbe2->encryption->algorithm))); + + if(!cipher) { + EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, + EVP_R_UNSUPPORTED_CIPHER); + goto err; + } + + /* Fixup cipher based on AlgorithmIdentifier */ + EVP_CipherInit(ctx, cipher, NULL, NULL, en_de); + if(EVP_CIPHER_asn1_to_param(ctx, pbe2->encryption->parameter) < 0) { + EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, + EVP_R_CIPHER_PARAMETER_ERROR); + goto err; + } + keylen = EVP_CIPHER_CTX_key_length(ctx); + + /* Now decode key derivation function */ + + pbuf = pbe2->keyfunc->parameter->value.sequence->data; + plen = pbe2->keyfunc->parameter->value.sequence->length; + if(!pbe2->keyfunc->parameter || + (pbe2->keyfunc->parameter->type != V_ASN1_SEQUENCE) || + !(kdf = d2i_PBKDF2PARAM(NULL, &pbuf, plen)) ) { + EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,EVP_R_DECODE_ERROR); + goto err; + } + + PBE2PARAM_free(pbe2); + pbe2 = NULL; + + /* Now check the parameters of the kdf */ + + if(kdf->keylength && (ASN1_INTEGER_get(kdf->keylength) != keylen)){ + EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, + EVP_R_UNSUPPORTED_KEYLENGTH); + goto err; + } + + if(kdf->prf && (OBJ_obj2nid(kdf->prf->algorithm) != NID_hmacWithSHA1)) { + EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, EVP_R_UNSUPPORTED_PRF); + goto err; + } + + if(kdf->salt->type != V_ASN1_OCTET_STRING) { + EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, + EVP_R_UNSUPPORTED_SALT_TYPE); + goto err; + } + + /* it seems that its all OK */ + salt = kdf->salt->value.octet_string->data; + saltlen = kdf->salt->value.octet_string->length; + iter = ASN1_INTEGER_get(kdf->iter); + PKCS5_PBKDF2_HMAC_SHA1(pass, passlen, salt, saltlen, iter, keylen, key); + EVP_CipherInit(ctx, NULL, key, NULL, en_de); + memset(key, 0, keylen); + PBKDF2PARAM_free(kdf); + return 1; + + err: + PBE2PARAM_free(pbe2); + PBKDF2PARAM_free(kdf); + return 0; +} + +#ifdef DEBUG_PKCS5V2 +static void h__dump (const unsigned char *p, int len) +{ + for (; len --; p++) fprintf(stderr, "%02X ", *p); + fprintf(stderr, "\n"); +} +#endif +#endif diff --git a/src/lib/libcrypto/evp/p_dec.c b/src/lib/libcrypto/evp/p_dec.c index e845ce70c7..57b5daa453 100644 --- a/src/lib/libcrypto/evp/p_dec.c +++ b/src/lib/libcrypto/evp/p_dec.c @@ -58,27 +58,30 @@ #include #include "cryptlib.h" -#include "rand.h" -#include "rsa.h" -#include "evp.h" -#include "objects.h" -#include "x509.h" +#include +#ifndef NO_RSA +#include +#endif +#include +#include +#include -int EVP_PKEY_decrypt(key,ek,ekl,priv) -unsigned char *key; -unsigned char *ek; -int ekl; -EVP_PKEY *priv; +int EVP_PKEY_decrypt(unsigned char *key, unsigned char *ek, int ekl, + EVP_PKEY *priv) { int ret= -1; +#ifndef NO_RSA if (priv->type != EVP_PKEY_RSA) { +#endif EVPerr(EVP_F_EVP_PKEY_DECRYPT,EVP_R_PUBLIC_KEY_NOT_RSA); +#ifndef NO_RSA goto err; } ret=RSA_private_decrypt(ekl,ek,key,priv->pkey.rsa,RSA_PKCS1_PADDING); err: +#endif return(ret); } diff --git a/src/lib/libcrypto/evp/p_enc.c b/src/lib/libcrypto/evp/p_enc.c index a26bfad02a..4cf6acaf5d 100644 --- a/src/lib/libcrypto/evp/p_enc.c +++ b/src/lib/libcrypto/evp/p_enc.c @@ -58,26 +58,29 @@ #include #include "cryptlib.h" -#include "rand.h" -#include "rsa.h" -#include "evp.h" -#include "objects.h" -#include "x509.h" +#include +#ifndef NO_RSA +#include +#endif +#include +#include +#include -int EVP_PKEY_encrypt(ek,key,key_len,pubk) -unsigned char *ek; -unsigned char *key; -int key_len; -EVP_PKEY *pubk; +int EVP_PKEY_encrypt(unsigned char *ek, unsigned char *key, int key_len, + EVP_PKEY *pubk) { int ret=0; +#ifndef NO_RSA if (pubk->type != EVP_PKEY_RSA) { +#endif EVPerr(EVP_F_EVP_PKEY_ENCRYPT,EVP_R_PUBLIC_KEY_NOT_RSA); +#ifndef NO_RSA goto err; } ret=RSA_public_encrypt(key_len,key,ek,pubk->pkey.rsa,RSA_PKCS1_PADDING); err: +#endif return(ret); } diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c index 395351b373..3422b77de6 100644 --- a/src/lib/libcrypto/evp/p_lib.c +++ b/src/lib/libcrypto/evp/p_lib.c @@ -58,22 +58,13 @@ #include #include "cryptlib.h" -#include "objects.h" -#include "evp.h" -#include "asn1_mac.h" -#include "x509.h" +#include +#include +#include +#include -/* EVPerr(EVP_F_D2I_PKEY,EVP_R_UNSUPPORTED_CIPHER); */ -/* EVPerr(EVP_F_D2I_PKEY,EVP_R_IV_TOO_LARGE); */ - -#ifndef NOPROTO static void EVP_PKEY_free_it(EVP_PKEY *x); -#else -static void EVP_PKEY_free_it(); -#endif - -int EVP_PKEY_bits(pkey) -EVP_PKEY *pkey; +int EVP_PKEY_bits(EVP_PKEY *pkey) { #ifndef NO_RSA if (pkey->type == EVP_PKEY_RSA) @@ -87,9 +78,10 @@ EVP_PKEY *pkey; return(0); } -int EVP_PKEY_size(pkey) -EVP_PKEY *pkey; +int EVP_PKEY_size(EVP_PKEY *pkey) { + if (pkey == NULL) + return(0); #ifndef NO_RSA if (pkey->type == EVP_PKEY_RSA) return(RSA_size(pkey->pkey.rsa)); @@ -102,9 +94,7 @@ EVP_PKEY *pkey; return(0); } -int EVP_PKEY_save_parameters(pkey,mode) -EVP_PKEY *pkey; -int mode; +int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode) { #ifndef NO_DSA if (pkey->type == EVP_PKEY_DSA) @@ -119,8 +109,7 @@ int mode; return(0); } -int EVP_PKEY_copy_parameters(to,from) -EVP_PKEY *to,*from; +int EVP_PKEY_copy_parameters(EVP_PKEY *to, EVP_PKEY *from) { if (to->type != from->type) { @@ -156,8 +145,7 @@ err: return(0); } -int EVP_PKEY_missing_parameters(pkey) -EVP_PKEY *pkey; +int EVP_PKEY_missing_parameters(EVP_PKEY *pkey) { #ifndef NO_DSA if (pkey->type == EVP_PKEY_DSA) @@ -172,8 +160,7 @@ EVP_PKEY *pkey; return(0); } -int EVP_PKEY_cmp_parameters(a,b) -EVP_PKEY *a,*b; +int EVP_PKEY_cmp_parameters(EVP_PKEY *a, EVP_PKEY *b) { #ifndef NO_DSA if ((a->type == EVP_PKEY_DSA) && (b->type == EVP_PKEY_DSA)) @@ -189,7 +176,7 @@ EVP_PKEY *a,*b; return(-1); } -EVP_PKEY *EVP_PKEY_new() +EVP_PKEY *EVP_PKEY_new(void) { EVP_PKEY *ret; @@ -207,10 +194,7 @@ EVP_PKEY *EVP_PKEY_new() return(ret); } -int EVP_PKEY_assign(pkey,type,key) -EVP_PKEY *pkey; -int type; -char *key; +int EVP_PKEY_assign(EVP_PKEY *pkey, int type, char *key) { if (pkey == NULL) return(0); if (pkey->pkey.ptr != NULL) @@ -221,8 +205,7 @@ char *key; return(1); } -int EVP_PKEY_type(type) -int type; +int EVP_PKEY_type(int type) { switch (type) { @@ -242,8 +225,7 @@ int type; } } -void EVP_PKEY_free(x) -EVP_PKEY *x; +void EVP_PKEY_free(EVP_PKEY *x) { int i; @@ -265,8 +247,7 @@ EVP_PKEY *x; Free((char *)x); } -static void EVP_PKEY_free_it(x) -EVP_PKEY *x; +static void EVP_PKEY_free_it(EVP_PKEY *x) { switch (x->type) { diff --git a/src/lib/libcrypto/evp/p_open.c b/src/lib/libcrypto/evp/p_open.c index 28a8e02252..ddb9fd6942 100644 --- a/src/lib/libcrypto/evp/p_open.c +++ b/src/lib/libcrypto/evp/p_open.c @@ -56,19 +56,15 @@ * [including the GNU Public Licence.] */ +#ifndef NO_RSA #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" -#include "x509.h" +#include +#include +#include -int EVP_OpenInit(ctx,type,ek,ekl,iv,priv) -EVP_CIPHER_CTX *ctx; -EVP_CIPHER *type; -unsigned char *ek; -int ekl; -unsigned char *iv; -EVP_PKEY *priv; +int EVP_OpenInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char *ek, + int ekl, unsigned char *iv, EVP_PKEY *priv) { unsigned char *key=NULL; int i,size=0,ret=0; @@ -106,10 +102,7 @@ err: return(ret); } -int EVP_OpenFinal(ctx,out,outl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -int *outl; +int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) { int i; @@ -117,3 +110,4 @@ int *outl; EVP_DecryptInit(ctx,NULL,NULL,NULL); return(i); } +#endif diff --git a/src/lib/libcrypto/evp/p_seal.c b/src/lib/libcrypto/evp/p_seal.c index 09a408de35..09b46f4b0e 100644 --- a/src/lib/libcrypto/evp/p_seal.c +++ b/src/lib/libcrypto/evp/p_seal.c @@ -58,20 +58,16 @@ #include #include "cryptlib.h" -#include "rand.h" -#include "rsa.h" -#include "evp.h" -#include "objects.h" -#include "x509.h" +#include +#ifndef NO_RSA +#include +#endif +#include +#include +#include -int EVP_SealInit(ctx,type,ek,ekl,iv,pubk,npubk) -EVP_CIPHER_CTX *ctx; -EVP_CIPHER *type; -unsigned char **ek; -int *ekl; -unsigned char *iv; -EVP_PKEY **pubk; -int npubk; +int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek, + int *ekl, unsigned char *iv, EVP_PKEY **pubk, int npubk) { unsigned char key[EVP_MAX_KEY_LENGTH]; int i; @@ -105,10 +101,7 @@ int inl; } */ -void EVP_SealFinal(ctx,out,outl) -EVP_CIPHER_CTX *ctx; -unsigned char *out; -int *outl; +void EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) { EVP_EncryptFinal(ctx,out,outl); EVP_EncryptInit(ctx,NULL,NULL,NULL); diff --git a/src/lib/libcrypto/evp/p_sign.c b/src/lib/libcrypto/evp/p_sign.c index 073270ce31..1fa32ac17e 100644 --- a/src/lib/libcrypto/evp/p_sign.c +++ b/src/lib/libcrypto/evp/p_sign.c @@ -58,32 +58,25 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" -#include "x509.h" +#include +#include +#include #ifdef undef -void EVP_SignInit(ctx,type) -EVP_MD_CTX *ctx; -EVP_MD *type; +void EVP_SignInit(EVP_MD_CTX *ctx, EVP_MD *type) { EVP_DigestInit(ctx,type); } -void EVP_SignUpdate(ctx,data,count) -EVP_MD_CTX *ctx; -unsigned char *data; -unsigned int count; +void EVP_SignUpdate(EVP_MD_CTX *ctx, unsigned char *data, + unsigned int count) { EVP_DigestUpdate(ctx,data,count); } #endif -int EVP_SignFinal(ctx,sigret,siglen,pkey) -EVP_MD_CTX *ctx; -unsigned char *sigret; -unsigned int *siglen; -EVP_PKEY *pkey; +int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen, + EVP_PKEY *pkey) { unsigned char m[EVP_MAX_MD_SIZE]; unsigned int m_len; @@ -91,7 +84,7 @@ EVP_PKEY *pkey; MS_STATIC EVP_MD_CTX tmp_ctx; *siglen=0; - memcpy(&tmp_ctx,ctx,sizeof(EVP_MD_CTX)); + EVP_MD_CTX_copy(&tmp_ctx,ctx); EVP_DigestFinal(&tmp_ctx,&(m[0]),&m_len); for (i=0; i<4; i++) { diff --git a/src/lib/libcrypto/evp/p_verify.c b/src/lib/libcrypto/evp/p_verify.c index 8d727d8f02..dcb54f3abb 100644 --- a/src/lib/libcrypto/evp/p_verify.c +++ b/src/lib/libcrypto/evp/p_verify.c @@ -58,15 +58,12 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" -#include "x509.h" +#include +#include +#include -int EVP_VerifyFinal(ctx,sigbuf,siglen,pkey) -EVP_MD_CTX *ctx; -unsigned char *sigbuf; -unsigned int siglen; -EVP_PKEY *pkey; +int EVP_VerifyFinal(EVP_MD_CTX *ctx, unsigned char *sigbuf, + unsigned int siglen, EVP_PKEY *pkey) { unsigned char m[EVP_MAX_MD_SIZE]; unsigned int m_len; @@ -88,7 +85,7 @@ EVP_PKEY *pkey; EVPerr(EVP_F_EVP_VERIFYFINAL,EVP_R_WRONG_PUBLIC_KEY_TYPE); return(-1); } - memcpy(&tmp_ctx,ctx,sizeof(EVP_MD_CTX)); + EVP_MD_CTX_copy(&tmp_ctx,ctx); EVP_DigestFinal(&tmp_ctx,&(m[0]),&m_len); if (ctx->digest->verify == NULL) { diff --git a/src/lib/libcrypto/evp/pk_lib.c b/src/lib/libcrypto/evp/pk_lib.c deleted file mode 100644 index 08f9fabbae..0000000000 --- a/src/lib/libcrypto/evp/pk_lib.c +++ /dev/null @@ -1,82 +0,0 @@ -/* crypto/evp/pk_lib.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 "evp.h" -#include "objects.h" - -static LHASH *pk_md=NULL; - -static LHASH *pk_md=NULL; - -int EVP_add_pkey_md(oid,pkm,md) -int oid; -EVP_PKEY_METHOD *pkm; -EVP_MD *md; - { - } - -EVP_add_pkey(pkm) -EVP_PKEY_METHOD *pkm; - { - } - -EVP_PKEY_METHOD:q - - -- cgit v1.2.3-55-g6feb