diff options
Diffstat (limited to 'src/lib/libcrypto/evp')
52 files changed, 11357 insertions, 382 deletions
diff --git a/src/lib/libcrypto/evp/Makefile b/src/lib/libcrypto/evp/Makefile index c204f84c1d..9de56dc03d 100644 --- a/src/lib/libcrypto/evp/Makefile +++ b/src/lib/libcrypto/evp/Makefile | |||
| @@ -18,10 +18,10 @@ TESTDATA=evptests.txt | |||
| 18 | APPS= | 18 | APPS= |
| 19 | 19 | ||
| 20 | LIB=$(TOP)/libcrypto.a | 20 | LIB=$(TOP)/libcrypto.a |
| 21 | LIBSRC= encode.c digest.c dig_eng.c evp_enc.c evp_key.c evp_acnf.c evp_cnf.c \ | 21 | LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \ |
| 22 | e_des.c e_bf.c e_idea.c e_des3.c e_camellia.c\ | 22 | e_des.c e_bf.c e_idea.c e_des3.c e_camellia.c\ |
| 23 | e_rc4.c e_aes.c names.c e_seed.c \ | 23 | e_rc4.c e_aes.c names.c e_seed.c \ |
| 24 | e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c enc_min.c \ | 24 | e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \ |
| 25 | m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c \ | 25 | m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c \ |
| 26 | m_dss.c m_dss1.c m_mdc2.c m_ripemd.c m_ecdsa.c\ | 26 | m_dss.c m_dss1.c m_mdc2.c m_ripemd.c m_ecdsa.c\ |
| 27 | p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c \ | 27 | p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c \ |
| @@ -30,10 +30,10 @@ LIBSRC= encode.c digest.c dig_eng.c evp_enc.c evp_key.c evp_acnf.c evp_cnf.c \ | |||
| 30 | evp_pkey.c evp_pbe.c p5_crpt.c p5_crpt2.c \ | 30 | evp_pkey.c evp_pbe.c p5_crpt.c p5_crpt2.c \ |
| 31 | e_old.c | 31 | e_old.c |
| 32 | 32 | ||
| 33 | LIBOBJ= encode.o digest.o dig_eng.o evp_enc.o evp_key.o evp_acnf.o evp_cnf.o \ | 33 | LIBOBJ= encode.o digest.o evp_enc.o evp_key.o evp_acnf.o \ |
| 34 | e_des.o e_bf.o e_idea.o e_des3.o e_camellia.o\ | 34 | e_des.o e_bf.o e_idea.o e_des3.o e_camellia.o\ |
| 35 | e_rc4.o e_aes.o names.o e_seed.o \ | 35 | e_rc4.o e_aes.o names.o e_seed.o \ |
| 36 | e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o enc_min.o \ | 36 | e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \ |
| 37 | m_null.o m_md2.o m_md4.o m_md5.o m_sha.o m_sha1.o \ | 37 | m_null.o m_md2.o m_md4.o m_md5.o m_sha.o m_sha1.o \ |
| 38 | m_dss.o m_dss1.o m_mdc2.o m_ripemd.o m_ecdsa.o\ | 38 | m_dss.o m_dss1.o m_mdc2.o m_ripemd.o m_ecdsa.o\ |
| 39 | p_open.o p_seal.o p_sign.o p_verify.o p_lib.o p_enc.o p_dec.o \ | 39 | p_open.o p_seal.o p_sign.o p_verify.o p_lib.o p_enc.o p_dec.o \ |
| @@ -55,7 +55,7 @@ top: | |||
| 55 | all: lib | 55 | all: lib |
| 56 | 56 | ||
| 57 | lib: $(LIBOBJ) | 57 | lib: $(LIBOBJ) |
| 58 | $(ARX) $(LIB) $(LIBOBJ) | 58 | $(AR) $(LIB) $(LIBOBJ) |
| 59 | $(RANLIB) $(LIB) || echo Never mind. | 59 | $(RANLIB) $(LIB) || echo Never mind. |
| 60 | @touch lib | 60 | @touch lib |
| 61 | 61 | ||
| @@ -101,201 +101,177 @@ bio_b64.o: ../../e_os.h ../../include/openssl/asn1.h | |||
| 101 | bio_b64.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 101 | bio_b64.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 102 | bio_b64.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 102 | bio_b64.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 103 | bio_b64.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 103 | bio_b64.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 104 | bio_b64.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 104 | bio_b64.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 105 | bio_b64.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 105 | bio_b64.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 106 | bio_b64.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 106 | bio_b64.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 107 | bio_b64.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | 107 | bio_b64.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 108 | bio_b64.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 108 | bio_b64.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_b64.c |
| 109 | bio_b64.o: ../cryptlib.h bio_b64.c | ||
| 110 | bio_enc.o: ../../e_os.h ../../include/openssl/asn1.h | 109 | bio_enc.o: ../../e_os.h ../../include/openssl/asn1.h |
| 111 | bio_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 110 | bio_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 112 | bio_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 111 | bio_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 113 | bio_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 112 | bio_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 114 | bio_enc.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 113 | bio_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 115 | bio_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 114 | bio_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 116 | bio_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 115 | bio_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 117 | bio_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | 116 | bio_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 118 | bio_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 117 | bio_enc.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_enc.c |
| 119 | bio_enc.o: ../cryptlib.h bio_enc.c | ||
| 120 | bio_md.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 118 | bio_md.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 121 | bio_md.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 119 | bio_md.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 122 | bio_md.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 120 | bio_md.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 123 | bio_md.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 121 | bio_md.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 124 | bio_md.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 122 | bio_md.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 125 | bio_md.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 123 | bio_md.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 126 | bio_md.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 124 | bio_md.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h |
| 127 | bio_md.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 125 | bio_md.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 128 | bio_md.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_md.c | 126 | bio_md.o: ../cryptlib.h bio_md.c |
| 129 | bio_ok.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 127 | bio_ok.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 130 | bio_ok.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 128 | bio_ok.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 131 | bio_ok.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 129 | bio_ok.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 132 | bio_ok.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 130 | bio_ok.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 133 | bio_ok.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 131 | bio_ok.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 134 | bio_ok.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 132 | bio_ok.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 135 | bio_ok.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 133 | bio_ok.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h |
| 136 | bio_ok.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | 134 | bio_ok.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 137 | bio_ok.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 135 | bio_ok.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_ok.c |
| 138 | bio_ok.o: ../cryptlib.h bio_ok.c | ||
| 139 | c_all.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 136 | c_all.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 140 | c_all.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 137 | c_all.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 141 | c_all.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 138 | c_all.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 142 | c_all.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 139 | c_all.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 143 | c_all.o: ../../include/openssl/engine.h ../../include/openssl/err.h | 140 | c_all.o: ../../include/openssl/engine.h ../../include/openssl/err.h |
| 144 | c_all.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 141 | c_all.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 145 | c_all.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 142 | c_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 146 | c_all.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 143 | c_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 147 | c_all.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 144 | c_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 148 | c_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 145 | c_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 149 | c_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 146 | c_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 150 | c_all.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 147 | c_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 151 | c_all.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_all.c | 148 | c_all.o: ../cryptlib.h c_all.c |
| 152 | c_allc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 149 | c_allc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 153 | c_allc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 150 | c_allc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 154 | c_allc.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 151 | c_allc.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 155 | c_allc.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 152 | c_allc.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 156 | c_allc.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 153 | c_allc.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 157 | c_allc.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 154 | c_allc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 158 | c_allc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 155 | c_allc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 159 | c_allc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 156 | c_allc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 160 | c_allc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | 157 | c_allc.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h |
| 161 | c_allc.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 158 | c_allc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 162 | c_allc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 159 | c_allc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 163 | c_allc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 160 | c_allc.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 164 | c_allc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_allc.c | 161 | c_allc.o: ../cryptlib.h c_allc.c |
| 165 | c_alld.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 162 | c_alld.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 166 | c_alld.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 163 | c_alld.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 167 | c_alld.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 164 | c_alld.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 168 | c_alld.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 165 | c_alld.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 169 | c_alld.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 166 | c_alld.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 170 | c_alld.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 167 | c_alld.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 171 | c_alld.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 168 | c_alld.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 172 | c_alld.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 169 | c_alld.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 173 | c_alld.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | 170 | c_alld.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h |
| 174 | c_alld.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 171 | c_alld.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 175 | c_alld.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 172 | c_alld.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 176 | c_alld.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 173 | c_alld.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 177 | c_alld.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_alld.c | 174 | c_alld.o: ../cryptlib.h c_alld.c |
| 178 | dig_eng.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 179 | dig_eng.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 180 | dig_eng.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 181 | dig_eng.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 182 | dig_eng.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 183 | dig_eng.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 184 | dig_eng.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | ||
| 185 | dig_eng.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 186 | dig_eng.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 187 | dig_eng.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 188 | dig_eng.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 189 | dig_eng.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 190 | dig_eng.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 191 | dig_eng.o: ../cryptlib.h dig_eng.c evp_locl.h | ||
| 192 | digest.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 175 | digest.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 193 | digest.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 176 | digest.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 194 | digest.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 177 | digest.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 195 | digest.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 178 | digest.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 196 | digest.o: ../../include/openssl/engine.h ../../include/openssl/err.h | 179 | digest.o: ../../include/openssl/engine.h ../../include/openssl/err.h |
| 197 | digest.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 180 | digest.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 198 | digest.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 181 | digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 199 | digest.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 182 | digest.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 200 | digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 183 | digest.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 201 | digest.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 184 | digest.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 202 | digest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 185 | digest.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 203 | digest.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 186 | digest.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 204 | digest.o: ../../include/openssl/x509_vfy.h ../cryptlib.h digest.c evp_locl.h | 187 | digest.o: ../cryptlib.h digest.c |
| 205 | e_aes.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | 188 | e_aes.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h |
| 206 | e_aes.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | 189 | e_aes.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h |
| 207 | e_aes.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 190 | e_aes.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 208 | e_aes.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 191 | e_aes.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 209 | e_aes.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 192 | e_aes.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 210 | e_aes.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 193 | e_aes.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 211 | e_aes.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 194 | e_aes.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h |
| 212 | e_aes.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 195 | e_aes.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h e_aes.c |
| 213 | e_aes.o: ../../include/openssl/symhacks.h e_aes.c evp_locl.h | 196 | e_aes.o: evp_locl.h |
| 214 | e_bf.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 197 | e_bf.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 215 | e_bf.o: ../../include/openssl/blowfish.h ../../include/openssl/buffer.h | 198 | e_bf.o: ../../include/openssl/blowfish.h ../../include/openssl/buffer.h |
| 216 | e_bf.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 199 | e_bf.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 217 | e_bf.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 200 | e_bf.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 218 | e_bf.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 201 | e_bf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 219 | e_bf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 202 | e_bf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 220 | e_bf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 203 | e_bf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 221 | e_bf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | 204 | e_bf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 222 | e_bf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 205 | e_bf.o: ../../include/openssl/symhacks.h ../cryptlib.h e_bf.c evp_locl.h |
| 223 | e_bf.o: ../cryptlib.h e_bf.c evp_locl.h | ||
| 224 | e_camellia.o: ../../include/openssl/opensslconf.h e_camellia.c | 206 | e_camellia.o: ../../include/openssl/opensslconf.h e_camellia.c |
| 225 | e_cast.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 207 | e_cast.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 226 | e_cast.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | 208 | e_cast.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h |
| 227 | e_cast.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 209 | e_cast.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 228 | e_cast.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 210 | e_cast.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 229 | e_cast.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 211 | e_cast.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 230 | e_cast.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 212 | e_cast.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 231 | e_cast.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 213 | e_cast.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 232 | e_cast.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | 214 | e_cast.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 233 | e_cast.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 215 | e_cast.o: ../../include/openssl/symhacks.h ../cryptlib.h e_cast.c evp_locl.h |
| 234 | e_cast.o: ../cryptlib.h e_cast.c evp_locl.h | ||
| 235 | e_des.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 216 | e_des.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 236 | e_des.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 217 | e_des.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 237 | e_des.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | 218 | e_des.o: ../../include/openssl/des.h ../../include/openssl/des_old.h |
| 238 | e_des.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 219 | e_des.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 239 | e_des.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 220 | e_des.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 240 | e_des.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 221 | e_des.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 241 | e_des.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 222 | e_des.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 242 | e_des.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 223 | e_des.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h |
| 243 | e_des.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | 224 | e_des.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 244 | e_des.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 225 | e_des.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h |
| 245 | e_des.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | 226 | e_des.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des.c evp_locl.h |
| 246 | e_des.o: ../cryptlib.h e_des.c evp_locl.h | ||
| 247 | e_des3.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 227 | e_des3.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 248 | e_des3.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 228 | e_des3.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 249 | e_des3.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | 229 | e_des3.o: ../../include/openssl/des.h ../../include/openssl/des_old.h |
| 250 | e_des3.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 230 | e_des3.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 251 | e_des3.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 231 | e_des3.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 252 | e_des3.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 232 | e_des3.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 253 | e_des3.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 233 | e_des3.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 254 | e_des3.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 234 | e_des3.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h |
| 255 | e_des3.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | 235 | e_des3.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 256 | e_des3.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 236 | e_des3.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h |
| 257 | e_des3.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | 237 | e_des3.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des3.c evp_locl.h |
| 258 | e_des3.o: ../cryptlib.h e_des3.c evp_locl.h | ||
| 259 | e_idea.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 238 | e_idea.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 260 | e_idea.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 239 | e_idea.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 261 | e_idea.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 240 | e_idea.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 262 | e_idea.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 241 | e_idea.o: ../../include/openssl/evp.h ../../include/openssl/idea.h |
| 263 | e_idea.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | 242 | e_idea.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 264 | e_idea.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 243 | e_idea.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 265 | e_idea.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 244 | e_idea.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 266 | e_idea.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | 245 | e_idea.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 267 | e_idea.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 246 | e_idea.o: ../../include/openssl/symhacks.h ../cryptlib.h e_idea.c evp_locl.h |
| 268 | e_idea.o: ../cryptlib.h e_idea.c evp_locl.h | ||
| 269 | e_null.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 247 | e_null.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 270 | e_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 248 | e_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 271 | e_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 249 | e_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 272 | e_null.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 250 | e_null.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 273 | e_null.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 251 | e_null.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 274 | e_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 252 | e_null.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 275 | e_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 253 | e_null.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h |
| 276 | e_null.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 254 | e_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 277 | e_null.o: ../../include/openssl/symhacks.h ../cryptlib.h e_null.c | 255 | e_null.o: ../cryptlib.h e_null.c |
| 278 | e_old.o: e_old.c | 256 | e_old.o: e_old.c |
| 279 | e_rc2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 257 | e_rc2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 280 | e_rc2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 258 | e_rc2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 281 | e_rc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 259 | e_rc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 282 | e_rc2.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 260 | e_rc2.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 283 | e_rc2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 261 | e_rc2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 284 | e_rc2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 262 | e_rc2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 285 | e_rc2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 263 | e_rc2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h |
| 286 | e_rc2.o: ../../include/openssl/rc2.h ../../include/openssl/safestack.h | 264 | e_rc2.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 287 | e_rc2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 265 | e_rc2.o: ../../include/openssl/symhacks.h ../cryptlib.h e_rc2.c evp_locl.h |
| 288 | e_rc2.o: ../cryptlib.h e_rc2.c evp_locl.h | ||
| 289 | e_rc4.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 266 | e_rc4.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 290 | e_rc4.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 267 | e_rc4.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 291 | e_rc4.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 268 | e_rc4.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 292 | e_rc4.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 269 | e_rc4.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 293 | e_rc4.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 270 | e_rc4.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 294 | e_rc4.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 271 | e_rc4.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 295 | e_rc4.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 272 | e_rc4.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc4.h |
| 296 | e_rc4.o: ../../include/openssl/rc4.h ../../include/openssl/safestack.h | 273 | e_rc4.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 297 | e_rc4.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 274 | e_rc4.o: ../../include/openssl/symhacks.h ../cryptlib.h e_rc4.c |
| 298 | e_rc4.o: ../cryptlib.h e_rc4.c evp_locl.h | ||
| 299 | e_rc5.o: ../../e_os.h ../../include/openssl/bio.h | 275 | e_rc5.o: ../../e_os.h ../../include/openssl/bio.h |
| 300 | e_rc5.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 276 | e_rc5.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 301 | e_rc5.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 277 | e_rc5.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| @@ -306,141 +282,107 @@ e_rc5.o: ../../include/openssl/symhacks.h ../cryptlib.h e_rc5.c | |||
| 306 | e_seed.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | 282 | e_seed.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 307 | e_seed.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 283 | e_seed.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 308 | e_seed.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 284 | e_seed.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 309 | e_seed.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 285 | e_seed.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 310 | e_seed.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 286 | e_seed.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 311 | e_seed.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 287 | e_seed.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 312 | e_seed.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | 288 | e_seed.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 313 | e_seed.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 289 | e_seed.o: ../../include/openssl/symhacks.h e_seed.c |
| 314 | e_seed.o: e_seed.c | ||
| 315 | e_xcbc_d.o: ../../e_os.h ../../include/openssl/asn1.h | 290 | e_xcbc_d.o: ../../e_os.h ../../include/openssl/asn1.h |
| 316 | e_xcbc_d.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 291 | e_xcbc_d.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 317 | e_xcbc_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | 292 | e_xcbc_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h |
| 318 | e_xcbc_d.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | 293 | e_xcbc_d.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h |
| 319 | e_xcbc_d.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 294 | e_xcbc_d.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 320 | e_xcbc_d.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 295 | e_xcbc_d.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 321 | e_xcbc_d.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 296 | e_xcbc_d.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 322 | e_xcbc_d.o: ../../include/openssl/opensslconf.h | ||
| 323 | e_xcbc_d.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 297 | e_xcbc_d.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 324 | e_xcbc_d.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 298 | e_xcbc_d.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 325 | e_xcbc_d.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | 299 | e_xcbc_d.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h |
| 326 | e_xcbc_d.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_xcbc_d.c | 300 | e_xcbc_d.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_xcbc_d.c |
| 327 | enc_min.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 328 | enc_min.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 329 | enc_min.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 330 | enc_min.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 331 | enc_min.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 332 | enc_min.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 333 | enc_min.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | ||
| 334 | enc_min.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 335 | enc_min.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 336 | enc_min.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 337 | enc_min.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 338 | enc_min.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 339 | enc_min.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 340 | enc_min.o: ../../include/openssl/x509_vfy.h ../cryptlib.h enc_min.c evp_locl.h | ||
| 341 | encode.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 301 | encode.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 342 | encode.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 302 | encode.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 343 | encode.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 303 | encode.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 344 | encode.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 304 | encode.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 345 | encode.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 305 | encode.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 346 | encode.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 306 | encode.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 347 | encode.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 307 | encode.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h |
| 348 | encode.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 308 | encode.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 349 | encode.o: ../../include/openssl/symhacks.h ../cryptlib.h encode.c | 309 | encode.o: ../cryptlib.h encode.c |
| 350 | evp_acnf.o: ../../e_os.h ../../include/openssl/asn1.h | 310 | evp_acnf.o: ../../e_os.h ../../include/openssl/asn1.h |
| 351 | evp_acnf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 311 | evp_acnf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 352 | evp_acnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | 312 | evp_acnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h |
| 353 | evp_acnf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 313 | evp_acnf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 354 | evp_acnf.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 314 | evp_acnf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 355 | evp_acnf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 315 | evp_acnf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 356 | evp_acnf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 316 | evp_acnf.o: ../../include/openssl/opensslconf.h |
| 357 | evp_acnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 317 | evp_acnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 358 | evp_acnf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 318 | evp_acnf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 359 | evp_acnf.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_acnf.c | 319 | evp_acnf.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_acnf.c |
| 360 | evp_cnf.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 361 | evp_cnf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 362 | evp_cnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 363 | evp_cnf.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 364 | evp_cnf.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 365 | evp_cnf.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 366 | evp_cnf.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | ||
| 367 | evp_cnf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 368 | evp_cnf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 369 | evp_cnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 370 | evp_cnf.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 371 | evp_cnf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 372 | evp_cnf.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 373 | evp_cnf.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 374 | evp_cnf.o: ../cryptlib.h evp_cnf.c | ||
| 375 | evp_enc.o: ../../e_os.h ../../include/openssl/asn1.h | 320 | evp_enc.o: ../../e_os.h ../../include/openssl/asn1.h |
| 376 | evp_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 321 | evp_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 377 | evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 322 | evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 378 | evp_enc.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 323 | evp_enc.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 379 | evp_enc.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | 324 | evp_enc.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 380 | evp_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 325 | evp_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 381 | evp_enc.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 326 | evp_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 382 | evp_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 327 | evp_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 383 | evp_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 328 | evp_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 384 | evp_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 329 | evp_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h |
| 385 | evp_enc.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | 330 | evp_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 386 | evp_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 331 | evp_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 387 | evp_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 332 | evp_enc.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 388 | evp_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_enc.c evp_locl.h | 333 | evp_enc.o: ../cryptlib.h evp_enc.c evp_locl.h |
| 389 | evp_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | 334 | evp_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 390 | evp_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 335 | evp_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 391 | evp_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 336 | evp_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 392 | evp_err.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 337 | evp_err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 393 | evp_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 338 | evp_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 394 | evp_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 339 | evp_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 395 | evp_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | 340 | evp_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 396 | evp_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 341 | evp_err.o: ../../include/openssl/symhacks.h evp_err.c |
| 397 | evp_err.o: evp_err.c | ||
| 398 | evp_key.o: ../../e_os.h ../../include/openssl/asn1.h | 342 | evp_key.o: ../../e_os.h ../../include/openssl/asn1.h |
| 399 | evp_key.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 343 | evp_key.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 400 | evp_key.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 344 | evp_key.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 401 | evp_key.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 345 | evp_key.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 402 | evp_key.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 346 | evp_key.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 403 | evp_key.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 347 | evp_key.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 404 | evp_key.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 348 | evp_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 405 | evp_key.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 349 | evp_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 406 | evp_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 350 | evp_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 407 | evp_key.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 351 | evp_key.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 408 | evp_key.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 352 | evp_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 409 | evp_key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | 353 | evp_key.o: ../../include/openssl/ui.h ../../include/openssl/x509.h |
| 410 | evp_key.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 354 | evp_key.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_key.c |
| 411 | evp_key.o: ../cryptlib.h evp_key.c | ||
| 412 | evp_lib.o: ../../e_os.h ../../include/openssl/asn1.h | 355 | evp_lib.o: ../../e_os.h ../../include/openssl/asn1.h |
| 413 | evp_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 356 | evp_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 414 | evp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 357 | evp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 415 | evp_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 358 | evp_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 416 | evp_lib.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 359 | evp_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 417 | evp_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 360 | evp_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 418 | evp_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 361 | evp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 419 | evp_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | 362 | evp_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 420 | evp_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 363 | evp_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_lib.c |
| 421 | evp_lib.o: ../cryptlib.h evp_lib.c | ||
| 422 | evp_pbe.o: ../../e_os.h ../../include/openssl/asn1.h | 364 | evp_pbe.o: ../../e_os.h ../../include/openssl/asn1.h |
| 423 | evp_pbe.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 365 | evp_pbe.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 424 | evp_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 366 | evp_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 425 | evp_pbe.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 367 | evp_pbe.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 426 | evp_pbe.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 368 | evp_pbe.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 427 | evp_pbe.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 369 | evp_pbe.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 428 | evp_pbe.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 370 | evp_pbe.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 429 | evp_pbe.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 371 | evp_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 430 | evp_pbe.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 372 | evp_pbe.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 431 | evp_pbe.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 373 | evp_pbe.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 432 | evp_pbe.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 374 | evp_pbe.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 433 | evp_pbe.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 375 | evp_pbe.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 434 | evp_pbe.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_pbe.c | 376 | evp_pbe.o: ../cryptlib.h evp_pbe.c |
| 435 | evp_pkey.o: ../../e_os.h ../../include/openssl/asn1.h | 377 | evp_pkey.o: ../../e_os.h ../../include/openssl/asn1.h |
| 436 | evp_pkey.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | 378 | evp_pkey.o: ../../include/openssl/bio.h ../../include/openssl/bn.h |
| 437 | evp_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 379 | evp_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 438 | evp_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 380 | evp_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
| 439 | evp_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 381 | evp_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 440 | evp_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 382 | evp_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 441 | evp_pkey.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 383 | evp_pkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 442 | evp_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 384 | evp_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 443 | evp_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 385 | evp_pkey.o: ../../include/openssl/opensslconf.h |
| 444 | evp_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 386 | evp_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 445 | evp_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | 387 | evp_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h |
| 446 | evp_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | 388 | evp_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h |
| @@ -452,110 +394,106 @@ m_dss.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | |||
| 452 | m_dss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 394 | m_dss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
| 453 | m_dss.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 395 | m_dss.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 454 | m_dss.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 396 | m_dss.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 455 | m_dss.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 397 | m_dss.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 456 | m_dss.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 398 | m_dss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 457 | m_dss.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 399 | m_dss.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 458 | m_dss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 400 | m_dss.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 459 | m_dss.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 401 | m_dss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 460 | m_dss.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 402 | m_dss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 461 | m_dss.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 403 | m_dss.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 462 | m_dss.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_dss.c | 404 | m_dss.o: ../cryptlib.h m_dss.c |
| 463 | m_dss1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 405 | m_dss1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 464 | m_dss1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 406 | m_dss1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 465 | m_dss1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 407 | m_dss1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
| 466 | m_dss1.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 408 | m_dss1.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 467 | m_dss1.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 409 | m_dss1.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 468 | m_dss1.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 410 | m_dss1.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 469 | m_dss1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 411 | m_dss1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 470 | m_dss1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 412 | m_dss1.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 471 | m_dss1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 413 | m_dss1.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 472 | m_dss1.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 414 | m_dss1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 473 | m_dss1.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 415 | m_dss1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 474 | m_dss1.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 416 | m_dss1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 475 | m_dss1.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_dss1.c | 417 | m_dss1.o: ../cryptlib.h m_dss1.c |
| 476 | m_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h | 418 | m_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h |
| 477 | m_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 419 | m_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 478 | m_ecdsa.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 420 | m_ecdsa.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 479 | m_ecdsa.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 421 | m_ecdsa.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 480 | m_ecdsa.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 422 | m_ecdsa.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 481 | m_ecdsa.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 423 | m_ecdsa.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 482 | m_ecdsa.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 424 | m_ecdsa.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 483 | m_ecdsa.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 425 | m_ecdsa.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 484 | m_ecdsa.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 426 | m_ecdsa.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 485 | m_ecdsa.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 427 | m_ecdsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 486 | m_ecdsa.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 428 | m_ecdsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 487 | m_ecdsa.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 429 | m_ecdsa.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 488 | m_ecdsa.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_ecdsa.c | 430 | m_ecdsa.o: ../cryptlib.h m_ecdsa.c |
| 489 | m_md2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 431 | m_md2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 490 | m_md2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 432 | m_md2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 491 | m_md2.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 433 | m_md2.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 492 | m_md2.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 434 | m_md2.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 493 | m_md2.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 435 | m_md2.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 494 | m_md2.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 436 | m_md2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h |
| 495 | m_md2.o: ../../include/openssl/md2.h ../../include/openssl/obj_mac.h | 437 | m_md2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 496 | m_md2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 438 | m_md2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 497 | m_md2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 439 | m_md2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 498 | m_md2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | 440 | m_md2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h |
| 499 | m_md2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 441 | m_md2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 500 | m_md2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 442 | m_md2.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 501 | m_md2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 443 | m_md2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_md2.c |
| 502 | m_md2.o: ../cryptlib.h evp_locl.h m_md2.c | ||
| 503 | m_md4.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 444 | m_md4.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 504 | m_md4.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 445 | m_md4.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 505 | m_md4.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 446 | m_md4.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 506 | m_md4.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 447 | m_md4.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 507 | m_md4.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 448 | m_md4.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 508 | m_md4.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 449 | m_md4.o: ../../include/openssl/lhash.h ../../include/openssl/md4.h |
| 509 | m_md4.o: ../../include/openssl/md4.h ../../include/openssl/obj_mac.h | 450 | m_md4.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 510 | m_md4.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 451 | m_md4.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 511 | m_md4.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 452 | m_md4.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 512 | m_md4.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | 453 | m_md4.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h |
| 513 | m_md4.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 454 | m_md4.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 514 | m_md4.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 455 | m_md4.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 515 | m_md4.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 456 | m_md4.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_md4.c |
| 516 | m_md4.o: ../cryptlib.h evp_locl.h m_md4.c | ||
| 517 | m_md5.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 457 | m_md5.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 518 | m_md5.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 458 | m_md5.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 519 | m_md5.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 459 | m_md5.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 520 | m_md5.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 460 | m_md5.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 521 | m_md5.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 461 | m_md5.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 522 | m_md5.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 462 | m_md5.o: ../../include/openssl/lhash.h ../../include/openssl/md5.h |
| 523 | m_md5.o: ../../include/openssl/md5.h ../../include/openssl/obj_mac.h | 463 | m_md5.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 524 | m_md5.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 464 | m_md5.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 525 | m_md5.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 465 | m_md5.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 526 | m_md5.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | 466 | m_md5.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h |
| 527 | m_md5.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 467 | m_md5.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 528 | m_md5.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 468 | m_md5.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 529 | m_md5.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 469 | m_md5.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_md5.c |
| 530 | m_md5.o: ../cryptlib.h evp_locl.h m_md5.c | ||
| 531 | m_mdc2.o: ../../e_os.h ../../include/openssl/bio.h | 470 | m_mdc2.o: ../../e_os.h ../../include/openssl/bio.h |
| 532 | m_mdc2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 471 | m_mdc2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 533 | m_mdc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 472 | m_mdc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 534 | m_mdc2.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | 473 | m_mdc2.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h |
| 535 | m_mdc2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 474 | m_mdc2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 536 | m_mdc2.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 475 | m_mdc2.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 537 | m_mdc2.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_locl.h m_mdc2.c | 476 | m_mdc2.o: ../../include/openssl/symhacks.h ../cryptlib.h m_mdc2.c |
| 538 | m_null.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 477 | m_null.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 539 | m_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 478 | m_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 540 | m_null.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 479 | m_null.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 541 | m_null.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 480 | m_null.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 542 | m_null.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 481 | m_null.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 543 | m_null.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 482 | m_null.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 544 | m_null.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 483 | m_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 545 | m_null.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 484 | m_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 546 | m_null.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 485 | m_null.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 547 | m_null.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 486 | m_null.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 548 | m_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 487 | m_null.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 549 | m_null.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 488 | m_null.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_null.c |
| 550 | m_null.o: ../cryptlib.h m_null.c | ||
| 551 | m_ripemd.o: ../../e_os.h ../../include/openssl/asn1.h | 489 | m_ripemd.o: ../../e_os.h ../../include/openssl/asn1.h |
| 552 | m_ripemd.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 490 | m_ripemd.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 553 | m_ripemd.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 491 | m_ripemd.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 554 | m_ripemd.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 492 | m_ripemd.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 555 | m_ripemd.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 493 | m_ripemd.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 556 | m_ripemd.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 494 | m_ripemd.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 557 | m_ripemd.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 495 | m_ripemd.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 558 | m_ripemd.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 496 | m_ripemd.o: ../../include/openssl/opensslconf.h |
| 559 | m_ripemd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 497 | m_ripemd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 560 | m_ripemd.o: ../../include/openssl/pkcs7.h ../../include/openssl/ripemd.h | 498 | m_ripemd.o: ../../include/openssl/pkcs7.h ../../include/openssl/ripemd.h |
| 561 | m_ripemd.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | 499 | m_ripemd.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h |
| @@ -567,62 +505,60 @@ m_sha.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | |||
| 567 | m_sha.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 505 | m_sha.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 568 | m_sha.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 506 | m_sha.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 569 | m_sha.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 507 | m_sha.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 570 | m_sha.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 508 | m_sha.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 571 | m_sha.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 509 | m_sha.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 572 | m_sha.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 510 | m_sha.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 573 | m_sha.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 511 | m_sha.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h |
| 574 | m_sha.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | 512 | m_sha.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 575 | m_sha.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 513 | m_sha.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 576 | m_sha.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 514 | m_sha.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 577 | m_sha.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_locl.h m_sha.c | 515 | m_sha.o: ../cryptlib.h m_sha.c |
| 578 | m_sha1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 516 | m_sha1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 579 | m_sha1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 517 | m_sha1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 580 | m_sha1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 518 | m_sha1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 581 | m_sha1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 519 | m_sha1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 582 | m_sha1.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 520 | m_sha1.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 583 | m_sha1.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 521 | m_sha1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 584 | m_sha1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 522 | m_sha1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 585 | m_sha1.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 523 | m_sha1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 586 | m_sha1.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 524 | m_sha1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h |
| 587 | m_sha1.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | 525 | m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 588 | m_sha1.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 526 | m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 589 | m_sha1.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 527 | m_sha1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 590 | m_sha1.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_sha1.c | 528 | m_sha1.o: ../cryptlib.h m_sha1.c |
| 591 | names.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 529 | names.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 592 | names.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 530 | names.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 593 | names.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 531 | names.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 594 | names.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 532 | names.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 595 | names.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 533 | names.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 596 | names.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 534 | names.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 597 | names.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 535 | names.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 598 | names.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 536 | names.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 599 | names.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 537 | names.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 600 | names.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 538 | names.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 601 | names.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 539 | names.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 602 | names.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 540 | names.o: ../../include/openssl/x509_vfy.h ../cryptlib.h names.c |
| 603 | names.o: ../cryptlib.h names.c | ||
| 604 | p5_crpt.o: ../../e_os.h ../../include/openssl/asn1.h | 541 | p5_crpt.o: ../../e_os.h ../../include/openssl/asn1.h |
| 605 | p5_crpt.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 542 | p5_crpt.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 606 | p5_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 543 | p5_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 607 | p5_crpt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 544 | p5_crpt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 608 | p5_crpt.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 545 | p5_crpt.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 609 | p5_crpt.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 546 | p5_crpt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 610 | p5_crpt.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 547 | p5_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 611 | p5_crpt.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 548 | p5_crpt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 612 | p5_crpt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 549 | p5_crpt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 613 | p5_crpt.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 550 | p5_crpt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 614 | p5_crpt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 551 | p5_crpt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 615 | p5_crpt.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 552 | p5_crpt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 616 | p5_crpt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p5_crpt.c | 553 | p5_crpt.o: ../cryptlib.h p5_crpt.c |
| 617 | p5_crpt2.o: ../../e_os.h ../../include/openssl/asn1.h | 554 | p5_crpt2.o: ../../e_os.h ../../include/openssl/asn1.h |
| 618 | p5_crpt2.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 555 | p5_crpt2.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 619 | p5_crpt2.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 556 | p5_crpt2.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 620 | p5_crpt2.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 557 | p5_crpt2.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 621 | p5_crpt2.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 558 | p5_crpt2.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 622 | p5_crpt2.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 559 | p5_crpt2.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h |
| 623 | p5_crpt2.o: ../../include/openssl/hmac.h ../../include/openssl/lhash.h | 560 | p5_crpt2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 624 | p5_crpt2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 561 | p5_crpt2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 625 | p5_crpt2.o: ../../include/openssl/opensslconf.h | ||
| 626 | p5_crpt2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 562 | p5_crpt2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 627 | p5_crpt2.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 563 | p5_crpt2.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 628 | p5_crpt2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 564 | p5_crpt2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| @@ -633,29 +569,27 @@ p_dec.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | |||
| 633 | p_dec.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 569 | p_dec.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 634 | p_dec.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 570 | p_dec.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 635 | p_dec.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 571 | p_dec.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 636 | p_dec.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 572 | p_dec.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 637 | p_dec.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 573 | p_dec.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 638 | p_dec.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 574 | p_dec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 639 | p_dec.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 575 | p_dec.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h |
| 640 | p_dec.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | 576 | p_dec.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h |
| 641 | p_dec.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 577 | p_dec.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 642 | p_dec.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 578 | p_dec.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 643 | p_dec.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 579 | p_dec.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_dec.c |
| 644 | p_dec.o: ../cryptlib.h p_dec.c | ||
| 645 | p_enc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 580 | p_enc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 646 | p_enc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 581 | p_enc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 647 | p_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 582 | p_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 648 | p_enc.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 583 | p_enc.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 649 | p_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 584 | p_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 650 | p_enc.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 585 | p_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 651 | p_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 586 | p_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 652 | p_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 587 | p_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 653 | p_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 588 | p_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h |
| 654 | p_enc.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | 589 | p_enc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h |
| 655 | p_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 590 | p_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 656 | p_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 591 | p_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 657 | p_enc.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 592 | p_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_enc.c |
| 658 | p_enc.o: ../cryptlib.h p_enc.c | ||
| 659 | p_lib.o: ../../e_os.h ../../include/openssl/asn1.h | 593 | p_lib.o: ../../e_os.h ../../include/openssl/asn1.h |
| 660 | p_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | 594 | p_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h |
| 661 | p_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | 595 | p_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h |
| @@ -663,63 +597,60 @@ p_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | |||
| 663 | p_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 597 | p_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
| 664 | p_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 598 | p_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 665 | p_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 599 | p_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 666 | p_lib.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 600 | p_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 667 | p_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 601 | p_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 668 | p_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 602 | p_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 669 | p_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 603 | p_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 670 | p_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | 604 | p_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h |
| 671 | p_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 605 | p_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 672 | p_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 606 | p_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 673 | p_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 607 | p_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_lib.c |
| 674 | p_lib.o: ../cryptlib.h p_lib.c | ||
| 675 | p_open.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 608 | p_open.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 676 | p_open.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 609 | p_open.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 677 | p_open.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 610 | p_open.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 678 | p_open.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 611 | p_open.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 679 | p_open.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 612 | p_open.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 680 | p_open.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 613 | p_open.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 681 | p_open.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 614 | p_open.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 682 | p_open.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 615 | p_open.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 683 | p_open.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 616 | p_open.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h |
| 684 | p_open.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | 617 | p_open.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 685 | p_open.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 618 | p_open.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 686 | p_open.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 619 | p_open.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 687 | p_open.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_open.c | 620 | p_open.o: ../cryptlib.h p_open.c |
| 688 | p_seal.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 621 | p_seal.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 689 | p_seal.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 622 | p_seal.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 690 | p_seal.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 623 | p_seal.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 691 | p_seal.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 624 | p_seal.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 692 | p_seal.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 625 | p_seal.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 693 | p_seal.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 626 | p_seal.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 694 | p_seal.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 627 | p_seal.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 695 | p_seal.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 628 | p_seal.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 696 | p_seal.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 629 | p_seal.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h |
| 697 | p_seal.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | 630 | p_seal.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h |
| 698 | p_seal.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 631 | p_seal.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 699 | p_seal.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 632 | p_seal.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 700 | p_seal.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 633 | p_seal.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_seal.c |
| 701 | p_seal.o: ../cryptlib.h p_seal.c | ||
| 702 | p_sign.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 634 | p_sign.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 703 | p_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 635 | p_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 704 | p_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 636 | p_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 705 | p_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 637 | p_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 706 | p_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 638 | p_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 707 | p_sign.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 639 | p_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 708 | p_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 640 | p_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 709 | p_sign.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 641 | p_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 710 | p_sign.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 642 | p_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 711 | p_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 643 | p_sign.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 712 | p_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 644 | p_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 713 | p_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 645 | p_sign.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_sign.c |
| 714 | p_sign.o: ../cryptlib.h p_sign.c | ||
| 715 | p_verify.o: ../../e_os.h ../../include/openssl/asn1.h | 646 | p_verify.o: ../../e_os.h ../../include/openssl/asn1.h |
| 716 | p_verify.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 647 | p_verify.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 717 | p_verify.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 648 | p_verify.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 718 | p_verify.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 649 | p_verify.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 719 | p_verify.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 650 | p_verify.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 720 | p_verify.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 651 | p_verify.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 721 | p_verify.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 652 | p_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 722 | p_verify.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 653 | p_verify.o: ../../include/openssl/opensslconf.h |
| 723 | p_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 654 | p_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 724 | p_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 655 | p_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 725 | p_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 656 | p_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
diff --git a/src/lib/libcrypto/evp/Makefile.ssl b/src/lib/libcrypto/evp/Makefile.ssl new file mode 100644 index 0000000000..f33aebd33a --- /dev/null +++ b/src/lib/libcrypto/evp/Makefile.ssl | |||
| @@ -0,0 +1,1059 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/evp/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= evp | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST=evp_test.c | ||
| 23 | TESTDATA=evptests.txt | ||
| 24 | APPS= | ||
| 25 | |||
| 26 | LIB=$(TOP)/libcrypto.a | ||
| 27 | LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \ | ||
| 28 | e_des.c e_bf.c e_idea.c e_des3.c \ | ||
| 29 | e_rc4.c e_aes.c names.c \ | ||
| 30 | e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \ | ||
| 31 | m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c \ | ||
| 32 | m_dss.c m_dss1.c m_mdc2.c m_ripemd.c \ | ||
| 33 | p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c \ | ||
| 34 | bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c \ | ||
| 35 | c_all.c c_allc.c c_alld.c evp_lib.c bio_ok.c \ | ||
| 36 | evp_pkey.c evp_pbe.c p5_crpt.c p5_crpt2.c | ||
| 37 | |||
| 38 | LIBOBJ= encode.o digest.o evp_enc.o evp_key.o evp_acnf.o \ | ||
| 39 | e_des.o e_bf.o e_idea.o e_des3.o \ | ||
| 40 | e_rc4.o e_aes.o names.o \ | ||
| 41 | e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \ | ||
| 42 | m_null.o m_md2.o m_md4.o m_md5.o m_sha.o m_sha1.o \ | ||
| 43 | m_dss.o m_dss1.o m_mdc2.o m_ripemd.o \ | ||
| 44 | p_open.o p_seal.o p_sign.o p_verify.o p_lib.o p_enc.o p_dec.o \ | ||
| 45 | bio_md.o bio_b64.o bio_enc.o evp_err.o e_null.o \ | ||
| 46 | c_all.o c_allc.o c_alld.o evp_lib.o bio_ok.o \ | ||
| 47 | evp_pkey.o evp_pbe.o p5_crpt.o p5_crpt2.o | ||
| 48 | |||
| 49 | SRC= $(LIBSRC) | ||
| 50 | |||
| 51 | EXHEADER= evp.h | ||
| 52 | HEADER= $(EXHEADER) | ||
| 53 | |||
| 54 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 55 | |||
| 56 | top: | ||
| 57 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 58 | |||
| 59 | all: lib | ||
| 60 | |||
| 61 | lib: $(LIBOBJ) | ||
| 62 | $(AR) $(LIB) $(LIBOBJ) | ||
| 63 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 64 | @touch lib | ||
| 65 | |||
| 66 | files: | ||
| 67 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 68 | |||
| 69 | links: | ||
| 70 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 71 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 72 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 73 | cp $(TESTDATA) ../../test | ||
| 74 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 75 | |||
| 76 | install: | ||
| 77 | @for i in $(EXHEADER) ; \ | ||
| 78 | do \ | ||
| 79 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 80 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 81 | done; | ||
| 82 | |||
| 83 | tags: | ||
| 84 | ctags $(SRC) | ||
| 85 | |||
| 86 | tests: | ||
| 87 | |||
| 88 | lint: | ||
| 89 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 90 | |||
| 91 | depend: | ||
| 92 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC) | ||
| 93 | |||
| 94 | dclean: | ||
| 95 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 96 | mv -f Makefile.new $(MAKEFILE) | ||
| 97 | |||
| 98 | clean: | ||
| 99 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 100 | |||
| 101 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 102 | |||
| 103 | bio_b64.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 104 | bio_b64.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 105 | bio_b64.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 106 | bio_b64.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 107 | bio_b64.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 108 | bio_b64.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 109 | bio_b64.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 110 | bio_b64.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 111 | bio_b64.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 112 | bio_b64.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 113 | bio_b64.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 114 | bio_b64.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 115 | bio_b64.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 116 | bio_b64.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h | ||
| 117 | bio_b64.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 118 | bio_b64.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 119 | bio_b64.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 120 | bio_b64.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 121 | bio_b64.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 122 | bio_b64.o: ../cryptlib.h bio_b64.c | ||
| 123 | bio_enc.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 124 | bio_enc.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 125 | bio_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 126 | bio_enc.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 127 | bio_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 128 | bio_enc.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 129 | bio_enc.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 130 | bio_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 131 | bio_enc.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 132 | bio_enc.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 133 | bio_enc.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 134 | bio_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 135 | bio_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 136 | bio_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h | ||
| 137 | bio_enc.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 138 | bio_enc.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 139 | bio_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 140 | bio_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 141 | bio_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 142 | bio_enc.o: ../cryptlib.h bio_enc.c | ||
| 143 | bio_md.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 144 | bio_md.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 145 | bio_md.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 146 | bio_md.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 147 | bio_md.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 148 | bio_md.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 149 | bio_md.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 150 | bio_md.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 151 | bio_md.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 152 | bio_md.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 153 | bio_md.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 154 | bio_md.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 155 | bio_md.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 156 | bio_md.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 157 | bio_md.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 158 | bio_md.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 159 | bio_md.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 160 | bio_md.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 161 | bio_md.o: ../../include/openssl/ui_compat.h ../cryptlib.h bio_md.c | ||
| 162 | bio_ok.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 163 | bio_ok.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 164 | bio_ok.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 165 | bio_ok.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 166 | bio_ok.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 167 | bio_ok.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 168 | bio_ok.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 169 | bio_ok.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 170 | bio_ok.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 171 | bio_ok.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 172 | bio_ok.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 173 | bio_ok.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 174 | bio_ok.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 175 | bio_ok.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 176 | bio_ok.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 177 | bio_ok.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 178 | bio_ok.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 179 | bio_ok.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 180 | bio_ok.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 181 | bio_ok.o: ../cryptlib.h bio_ok.c | ||
| 182 | c_all.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 183 | c_all.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 184 | c_all.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 185 | c_all.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 186 | c_all.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 187 | c_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 188 | c_all.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
| 189 | c_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 190 | c_all.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 191 | c_all.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 192 | c_all.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 193 | c_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 194 | c_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 195 | c_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 196 | c_all.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 197 | c_all.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 198 | c_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 199 | c_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 200 | c_all.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 201 | c_all.o: ../../include/openssl/ui_compat.h ../cryptlib.h c_all.c | ||
| 202 | c_allc.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 203 | c_allc.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 204 | c_allc.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 205 | c_allc.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 206 | c_allc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 207 | c_allc.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 208 | c_allc.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 209 | c_allc.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 210 | c_allc.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 211 | c_allc.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 212 | c_allc.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 213 | c_allc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 214 | c_allc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 215 | c_allc.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 216 | c_allc.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 217 | c_allc.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 218 | c_allc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 219 | c_allc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 220 | c_allc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 221 | c_allc.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 222 | c_allc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_allc.c | ||
| 223 | c_alld.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 224 | c_alld.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 225 | c_alld.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 226 | c_alld.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 227 | c_alld.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 228 | c_alld.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 229 | c_alld.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 230 | c_alld.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 231 | c_alld.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 232 | c_alld.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 233 | c_alld.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 234 | c_alld.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 235 | c_alld.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 236 | c_alld.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 237 | c_alld.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 238 | c_alld.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 239 | c_alld.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 240 | c_alld.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 241 | c_alld.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 242 | c_alld.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 243 | c_alld.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_alld.c | ||
| 244 | digest.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 245 | digest.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 246 | digest.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 247 | digest.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 248 | digest.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 249 | digest.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 250 | digest.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
| 251 | digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 252 | digest.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 253 | digest.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 254 | digest.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 255 | digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 256 | digest.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 257 | digest.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 258 | digest.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 259 | digest.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 260 | digest.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 261 | digest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 262 | digest.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 263 | digest.o: ../../include/openssl/ui_compat.h ../cryptlib.h digest.c | ||
| 264 | e_aes.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 265 | e_aes.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 266 | e_aes.o: ../../include/openssl/bn.h ../../include/openssl/cast.h | ||
| 267 | e_aes.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 268 | e_aes.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 269 | e_aes.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 270 | e_aes.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 271 | e_aes.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 272 | e_aes.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 273 | e_aes.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 274 | e_aes.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 275 | e_aes.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 276 | e_aes.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h | ||
| 277 | e_aes.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 278 | e_aes.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 279 | e_aes.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 280 | e_aes.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 281 | e_aes.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h e_aes.c | ||
| 282 | e_aes.o: evp_locl.h | ||
| 283 | e_bf.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 284 | e_bf.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 285 | e_bf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 286 | e_bf.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 287 | e_bf.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 288 | e_bf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 289 | e_bf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 290 | e_bf.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 291 | e_bf.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 292 | e_bf.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 293 | e_bf.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 294 | e_bf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 295 | e_bf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 296 | e_bf.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 297 | e_bf.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 298 | e_bf.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 299 | e_bf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 300 | e_bf.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 301 | e_bf.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_bf.c evp_locl.h | ||
| 302 | e_cast.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 303 | e_cast.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 304 | e_cast.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 305 | e_cast.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 306 | e_cast.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 307 | e_cast.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 308 | e_cast.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 309 | e_cast.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 310 | e_cast.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 311 | e_cast.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 312 | e_cast.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 313 | e_cast.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 314 | e_cast.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 315 | e_cast.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 316 | e_cast.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 317 | e_cast.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 318 | e_cast.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 319 | e_cast.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 320 | e_cast.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_cast.c evp_locl.h | ||
| 321 | e_des.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 322 | e_des.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 323 | e_des.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 324 | e_des.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 325 | e_des.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 326 | e_des.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 327 | e_des.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 328 | e_des.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 329 | e_des.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 330 | e_des.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 331 | e_des.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 332 | e_des.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 333 | e_des.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 334 | e_des.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 335 | e_des.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 336 | e_des.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 337 | e_des.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 338 | e_des.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 339 | e_des.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des.c evp_locl.h | ||
| 340 | e_des3.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 341 | e_des3.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 342 | e_des3.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 343 | e_des3.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 344 | e_des3.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 345 | e_des3.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 346 | e_des3.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 347 | e_des3.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 348 | e_des3.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 349 | e_des3.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 350 | e_des3.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 351 | e_des3.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 352 | e_des3.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 353 | e_des3.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 354 | e_des3.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 355 | e_des3.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 356 | e_des3.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 357 | e_des3.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 358 | e_des3.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des3.c evp_locl.h | ||
| 359 | e_idea.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 360 | e_idea.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 361 | e_idea.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 362 | e_idea.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 363 | e_idea.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 364 | e_idea.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 365 | e_idea.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 366 | e_idea.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 367 | e_idea.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 368 | e_idea.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 369 | e_idea.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 370 | e_idea.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 371 | e_idea.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 372 | e_idea.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 373 | e_idea.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 374 | e_idea.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 375 | e_idea.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 376 | e_idea.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 377 | e_idea.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_idea.c evp_locl.h | ||
| 378 | e_null.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 379 | e_null.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 380 | e_null.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 381 | e_null.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 382 | e_null.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 383 | e_null.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 384 | e_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 385 | e_null.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 386 | e_null.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 387 | e_null.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 388 | e_null.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 389 | e_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 390 | e_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 391 | e_null.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 392 | e_null.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 393 | e_null.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 394 | e_null.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 395 | e_null.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 396 | e_null.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_null.c | ||
| 397 | e_rc2.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 398 | e_rc2.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 399 | e_rc2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 400 | e_rc2.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 401 | e_rc2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 402 | e_rc2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 403 | e_rc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 404 | e_rc2.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 405 | e_rc2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 406 | e_rc2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 407 | e_rc2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 408 | e_rc2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 409 | e_rc2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 410 | e_rc2.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 411 | e_rc2.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 412 | e_rc2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 413 | e_rc2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 414 | e_rc2.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 415 | e_rc2.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_rc2.c evp_locl.h | ||
| 416 | e_rc4.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 417 | e_rc4.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 418 | e_rc4.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 419 | e_rc4.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 420 | e_rc4.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 421 | e_rc4.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 422 | e_rc4.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 423 | e_rc4.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 424 | e_rc4.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 425 | e_rc4.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 426 | e_rc4.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 427 | e_rc4.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 428 | e_rc4.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 429 | e_rc4.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 430 | e_rc4.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 431 | e_rc4.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 432 | e_rc4.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 433 | e_rc4.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 434 | e_rc4.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_rc4.c | ||
| 435 | e_rc5.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 436 | e_rc5.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 437 | e_rc5.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 438 | e_rc5.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 439 | e_rc5.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 440 | e_rc5.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 441 | e_rc5.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 442 | e_rc5.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 443 | e_rc5.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 444 | e_rc5.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 445 | e_rc5.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 446 | e_rc5.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 447 | e_rc5.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 448 | e_rc5.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 449 | e_rc5.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 450 | e_rc5.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 451 | e_rc5.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 452 | e_rc5.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 453 | e_rc5.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_rc5.c evp_locl.h | ||
| 454 | e_xcbc_d.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 455 | e_xcbc_d.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 456 | e_xcbc_d.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 457 | e_xcbc_d.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 458 | e_xcbc_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 459 | e_xcbc_d.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 460 | e_xcbc_d.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 461 | e_xcbc_d.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 462 | e_xcbc_d.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 463 | e_xcbc_d.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 464 | e_xcbc_d.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 465 | e_xcbc_d.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 466 | e_xcbc_d.o: ../../include/openssl/opensslconf.h | ||
| 467 | e_xcbc_d.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 468 | e_xcbc_d.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 469 | e_xcbc_d.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 470 | e_xcbc_d.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 471 | e_xcbc_d.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 472 | e_xcbc_d.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 473 | e_xcbc_d.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_xcbc_d.c | ||
| 474 | encode.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 475 | encode.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 476 | encode.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 477 | encode.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 478 | encode.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 479 | encode.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 480 | encode.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 481 | encode.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 482 | encode.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 483 | encode.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 484 | encode.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 485 | encode.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 486 | encode.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 487 | encode.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 488 | encode.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 489 | encode.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 490 | encode.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 491 | encode.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 492 | encode.o: ../../include/openssl/ui_compat.h ../cryptlib.h encode.c | ||
| 493 | evp_acnf.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 494 | evp_acnf.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 495 | evp_acnf.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 496 | evp_acnf.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 497 | evp_acnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 498 | evp_acnf.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 499 | evp_acnf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 500 | evp_acnf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 501 | evp_acnf.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 502 | evp_acnf.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 503 | evp_acnf.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 504 | evp_acnf.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 505 | evp_acnf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 506 | evp_acnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 507 | evp_acnf.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 508 | evp_acnf.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 509 | evp_acnf.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 510 | evp_acnf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 511 | evp_acnf.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 512 | evp_acnf.o: ../../include/openssl/ui_compat.h ../cryptlib.h evp_acnf.c | ||
| 513 | evp_enc.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 514 | evp_enc.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 515 | evp_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 516 | evp_enc.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 517 | evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 518 | evp_enc.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 519 | evp_enc.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 520 | evp_enc.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 521 | evp_enc.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 522 | evp_enc.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 523 | evp_enc.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 524 | evp_enc.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 525 | evp_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 526 | evp_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 527 | evp_enc.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 528 | evp_enc.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 529 | evp_enc.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 530 | evp_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 531 | evp_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 532 | evp_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 533 | evp_enc.o: ../cryptlib.h evp_enc.c evp_locl.h | ||
| 534 | evp_err.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 535 | evp_err.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 536 | evp_err.o: ../../include/openssl/bn.h ../../include/openssl/cast.h | ||
| 537 | evp_err.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 538 | evp_err.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 539 | evp_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 540 | evp_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 541 | evp_err.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 542 | evp_err.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 543 | evp_err.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 544 | evp_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 545 | evp_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 546 | evp_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h | ||
| 547 | evp_err.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 548 | evp_err.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 549 | evp_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 550 | evp_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 551 | evp_err.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 552 | evp_err.o: evp_err.c | ||
| 553 | evp_key.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 554 | evp_key.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 555 | evp_key.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 556 | evp_key.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 557 | evp_key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 558 | evp_key.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 559 | evp_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 560 | evp_key.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 561 | evp_key.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 562 | evp_key.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 563 | evp_key.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 564 | evp_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 565 | evp_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 566 | evp_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 567 | evp_key.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 568 | evp_key.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 569 | evp_key.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 570 | evp_key.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 571 | evp_key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 572 | evp_key.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 573 | evp_key.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_key.c | ||
| 574 | evp_lib.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 575 | evp_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 576 | evp_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 577 | evp_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 578 | evp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 579 | evp_lib.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 580 | evp_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 581 | evp_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 582 | evp_lib.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 583 | evp_lib.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 584 | evp_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 585 | evp_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 586 | evp_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 587 | evp_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h | ||
| 588 | evp_lib.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 589 | evp_lib.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 590 | evp_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 591 | evp_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 592 | evp_lib.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 593 | evp_lib.o: ../cryptlib.h evp_lib.c | ||
| 594 | evp_pbe.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 595 | evp_pbe.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 596 | evp_pbe.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 597 | evp_pbe.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 598 | evp_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 599 | evp_pbe.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 600 | evp_pbe.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 601 | evp_pbe.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 602 | evp_pbe.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 603 | evp_pbe.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 604 | evp_pbe.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 605 | evp_pbe.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 606 | evp_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 607 | evp_pbe.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 608 | evp_pbe.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 609 | evp_pbe.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 610 | evp_pbe.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 611 | evp_pbe.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 612 | evp_pbe.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 613 | evp_pbe.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 614 | evp_pbe.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_pbe.c | ||
| 615 | evp_pkey.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 616 | evp_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 617 | evp_pkey.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 618 | evp_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 619 | evp_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 620 | evp_pkey.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 621 | evp_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 622 | evp_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 623 | evp_pkey.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 624 | evp_pkey.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 625 | evp_pkey.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 626 | evp_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 627 | evp_pkey.o: ../../include/openssl/opensslconf.h | ||
| 628 | evp_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 629 | evp_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 630 | evp_pkey.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 631 | evp_pkey.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 632 | evp_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 633 | evp_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 634 | evp_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 635 | evp_pkey.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 636 | evp_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_pkey.c | ||
| 637 | m_dss.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 638 | m_dss.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 639 | m_dss.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 640 | m_dss.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 641 | m_dss.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 642 | m_dss.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 643 | m_dss.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 644 | m_dss.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 645 | m_dss.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 646 | m_dss.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 647 | m_dss.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 648 | m_dss.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 649 | m_dss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 650 | m_dss.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 651 | m_dss.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 652 | m_dss.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 653 | m_dss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 654 | m_dss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 655 | m_dss.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 656 | m_dss.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 657 | m_dss.o: ../cryptlib.h m_dss.c | ||
| 658 | m_dss1.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 659 | m_dss1.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 660 | m_dss1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 661 | m_dss1.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 662 | m_dss1.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 663 | m_dss1.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 664 | m_dss1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 665 | m_dss1.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 666 | m_dss1.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 667 | m_dss1.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 668 | m_dss1.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 669 | m_dss1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 670 | m_dss1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 671 | m_dss1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 672 | m_dss1.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 673 | m_dss1.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 674 | m_dss1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 675 | m_dss1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 676 | m_dss1.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 677 | m_dss1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 678 | m_dss1.o: ../cryptlib.h m_dss1.c | ||
| 679 | m_md2.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 680 | m_md2.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 681 | m_md2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 682 | m_md2.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 683 | m_md2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 684 | m_md2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 685 | m_md2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 686 | m_md2.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 687 | m_md2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 688 | m_md2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 689 | m_md2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 690 | m_md2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 691 | m_md2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 692 | m_md2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 693 | m_md2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 694 | m_md2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 695 | m_md2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 696 | m_md2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 697 | m_md2.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 698 | m_md2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 699 | m_md2.o: ../cryptlib.h m_md2.c | ||
| 700 | m_md4.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 701 | m_md4.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 702 | m_md4.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 703 | m_md4.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 704 | m_md4.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 705 | m_md4.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 706 | m_md4.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 707 | m_md4.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 708 | m_md4.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 709 | m_md4.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 710 | m_md4.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 711 | m_md4.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 712 | m_md4.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 713 | m_md4.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 714 | m_md4.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 715 | m_md4.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 716 | m_md4.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 717 | m_md4.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 718 | m_md4.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 719 | m_md4.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 720 | m_md4.o: ../cryptlib.h m_md4.c | ||
| 721 | m_md5.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 722 | m_md5.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 723 | m_md5.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 724 | m_md5.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 725 | m_md5.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 726 | m_md5.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 727 | m_md5.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 728 | m_md5.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 729 | m_md5.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 730 | m_md5.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 731 | m_md5.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 732 | m_md5.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 733 | m_md5.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 734 | m_md5.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 735 | m_md5.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 736 | m_md5.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 737 | m_md5.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 738 | m_md5.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 739 | m_md5.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 740 | m_md5.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 741 | m_md5.o: ../cryptlib.h m_md5.c | ||
| 742 | m_mdc2.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 743 | m_mdc2.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 744 | m_mdc2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 745 | m_mdc2.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 746 | m_mdc2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 747 | m_mdc2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 748 | m_mdc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 749 | m_mdc2.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 750 | m_mdc2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 751 | m_mdc2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 752 | m_mdc2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 753 | m_mdc2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 754 | m_mdc2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 755 | m_mdc2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 756 | m_mdc2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 757 | m_mdc2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 758 | m_mdc2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 759 | m_mdc2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 760 | m_mdc2.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 761 | m_mdc2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 762 | m_mdc2.o: ../cryptlib.h m_mdc2.c | ||
| 763 | m_null.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 764 | m_null.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 765 | m_null.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 766 | m_null.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 767 | m_null.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 768 | m_null.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 769 | m_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 770 | m_null.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 771 | m_null.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 772 | m_null.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 773 | m_null.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 774 | m_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 775 | m_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 776 | m_null.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 777 | m_null.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 778 | m_null.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 779 | m_null.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 780 | m_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 781 | m_null.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 782 | m_null.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 783 | m_null.o: ../cryptlib.h m_null.c | ||
| 784 | m_ripemd.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 785 | m_ripemd.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 786 | m_ripemd.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 787 | m_ripemd.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 788 | m_ripemd.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 789 | m_ripemd.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 790 | m_ripemd.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 791 | m_ripemd.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 792 | m_ripemd.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 793 | m_ripemd.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 794 | m_ripemd.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 795 | m_ripemd.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 796 | m_ripemd.o: ../../include/openssl/opensslconf.h | ||
| 797 | m_ripemd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 798 | m_ripemd.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 799 | m_ripemd.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 800 | m_ripemd.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 801 | m_ripemd.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 802 | m_ripemd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 803 | m_ripemd.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 804 | m_ripemd.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 805 | m_ripemd.o: ../cryptlib.h m_ripemd.c | ||
| 806 | m_sha.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 807 | m_sha.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 808 | m_sha.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 809 | m_sha.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 810 | m_sha.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 811 | m_sha.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 812 | m_sha.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 813 | m_sha.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 814 | m_sha.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 815 | m_sha.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 816 | m_sha.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 817 | m_sha.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 818 | m_sha.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 819 | m_sha.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 820 | m_sha.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 821 | m_sha.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 822 | m_sha.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 823 | m_sha.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 824 | m_sha.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 825 | m_sha.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 826 | m_sha.o: ../cryptlib.h m_sha.c | ||
| 827 | m_sha1.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 828 | m_sha1.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 829 | m_sha1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 830 | m_sha1.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 831 | m_sha1.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 832 | m_sha1.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 833 | m_sha1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 834 | m_sha1.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 835 | m_sha1.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 836 | m_sha1.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 837 | m_sha1.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 838 | m_sha1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 839 | m_sha1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 840 | m_sha1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 841 | m_sha1.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 842 | m_sha1.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 843 | m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 844 | m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 845 | m_sha1.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 846 | m_sha1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 847 | m_sha1.o: ../cryptlib.h m_sha1.c | ||
| 848 | names.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 849 | names.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 850 | names.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 851 | names.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 852 | names.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 853 | names.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 854 | names.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 855 | names.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 856 | names.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 857 | names.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 858 | names.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 859 | names.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 860 | names.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 861 | names.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 862 | names.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 863 | names.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 864 | names.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 865 | names.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 866 | names.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 867 | names.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 868 | names.o: ../cryptlib.h names.c | ||
| 869 | p5_crpt.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 870 | p5_crpt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 871 | p5_crpt.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 872 | p5_crpt.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 873 | p5_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 874 | p5_crpt.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 875 | p5_crpt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 876 | p5_crpt.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 877 | p5_crpt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 878 | p5_crpt.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 879 | p5_crpt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 880 | p5_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 881 | p5_crpt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 882 | p5_crpt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 883 | p5_crpt.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 884 | p5_crpt.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 885 | p5_crpt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 886 | p5_crpt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 887 | p5_crpt.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 888 | p5_crpt.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 889 | p5_crpt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p5_crpt.c | ||
| 890 | p5_crpt2.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 891 | p5_crpt2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 892 | p5_crpt2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 893 | p5_crpt2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 894 | p5_crpt2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 895 | p5_crpt2.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 896 | p5_crpt2.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 897 | p5_crpt2.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 898 | p5_crpt2.o: ../../include/openssl/hmac.h ../../include/openssl/idea.h | ||
| 899 | p5_crpt2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 900 | p5_crpt2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 901 | p5_crpt2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 902 | p5_crpt2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 903 | p5_crpt2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 904 | p5_crpt2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 905 | p5_crpt2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 906 | p5_crpt2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 907 | p5_crpt2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 908 | p5_crpt2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 909 | p5_crpt2.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 910 | p5_crpt2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 911 | p5_crpt2.o: ../cryptlib.h p5_crpt2.c | ||
| 912 | p_dec.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 913 | p_dec.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 914 | p_dec.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 915 | p_dec.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 916 | p_dec.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 917 | p_dec.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 918 | p_dec.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 919 | p_dec.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 920 | p_dec.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 921 | p_dec.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 922 | p_dec.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 923 | p_dec.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 924 | p_dec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 925 | p_dec.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 926 | p_dec.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 927 | p_dec.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 928 | p_dec.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 929 | p_dec.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 930 | p_dec.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 931 | p_dec.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 932 | p_dec.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_dec.c | ||
| 933 | p_enc.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 934 | p_enc.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 935 | p_enc.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 936 | p_enc.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 937 | p_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 938 | p_enc.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 939 | p_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 940 | p_enc.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 941 | p_enc.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 942 | p_enc.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 943 | p_enc.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 944 | p_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 945 | p_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 946 | p_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 947 | p_enc.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 948 | p_enc.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 949 | p_enc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 950 | p_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 951 | p_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 952 | p_enc.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 953 | p_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_enc.c | ||
| 954 | p_lib.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 955 | p_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | ||
| 956 | p_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 957 | p_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 958 | p_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 959 | p_lib.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 960 | p_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 961 | p_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 962 | p_lib.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 963 | p_lib.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 964 | p_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 965 | p_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 966 | p_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 967 | p_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 968 | p_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 969 | p_lib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 970 | p_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 971 | p_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 972 | p_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 973 | p_lib.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 974 | p_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_lib.c | ||
| 975 | p_open.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 976 | p_open.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 977 | p_open.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 978 | p_open.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 979 | p_open.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 980 | p_open.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 981 | p_open.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 982 | p_open.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 983 | p_open.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 984 | p_open.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 985 | p_open.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 986 | p_open.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 987 | p_open.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 988 | p_open.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 989 | p_open.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 990 | p_open.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 991 | p_open.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 992 | p_open.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 993 | p_open.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 994 | p_open.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 995 | p_open.o: ../cryptlib.h p_open.c | ||
| 996 | p_seal.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 997 | p_seal.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 998 | p_seal.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 999 | p_seal.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 1000 | p_seal.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 1001 | p_seal.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 1002 | p_seal.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 1003 | p_seal.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 1004 | p_seal.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 1005 | p_seal.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 1006 | p_seal.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 1007 | p_seal.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 1008 | p_seal.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 1009 | p_seal.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 1010 | p_seal.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 1011 | p_seal.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 1012 | p_seal.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 1013 | p_seal.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 1014 | p_seal.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 1015 | p_seal.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 1016 | p_seal.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_seal.c | ||
| 1017 | p_sign.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 1018 | p_sign.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 1019 | p_sign.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 1020 | p_sign.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 1021 | p_sign.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 1022 | p_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 1023 | p_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 1024 | p_sign.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 1025 | p_sign.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 1026 | p_sign.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 1027 | p_sign.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 1028 | p_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 1029 | p_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 1030 | p_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 1031 | p_sign.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 1032 | p_sign.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 1033 | p_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 1034 | p_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 1035 | p_sign.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 1036 | p_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 1037 | p_sign.o: ../cryptlib.h p_sign.c | ||
| 1038 | p_verify.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 1039 | p_verify.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 1040 | p_verify.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 1041 | p_verify.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 1042 | p_verify.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 1043 | p_verify.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 1044 | p_verify.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 1045 | p_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 1046 | p_verify.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 1047 | p_verify.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 1048 | p_verify.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 1049 | p_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 1050 | p_verify.o: ../../include/openssl/opensslconf.h | ||
| 1051 | p_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 1052 | p_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 1053 | p_verify.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 1054 | p_verify.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 1055 | p_verify.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 1056 | p_verify.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 1057 | p_verify.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 1058 | p_verify.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 1059 | p_verify.o: ../cryptlib.h p_verify.c | ||
diff --git a/src/lib/libcrypto/evp/bio_b64.c b/src/lib/libcrypto/evp/bio_b64.c new file mode 100644 index 0000000000..fa5cbc7eb1 --- /dev/null +++ b/src/lib/libcrypto/evp/bio_b64.c | |||
| @@ -0,0 +1,567 @@ | |||
| 1 | /* crypto/evp/bio_b64.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <errno.h> | ||
| 61 | #include "cryptlib.h" | ||
| 62 | #include <openssl/buffer.h> | ||
| 63 | #include <openssl/evp.h> | ||
| 64 | |||
| 65 | static int b64_write(BIO *h, const char *buf, int num); | ||
| 66 | static int b64_read(BIO *h, char *buf, int size); | ||
| 67 | /*static int b64_puts(BIO *h, const char *str); */ | ||
| 68 | /*static int b64_gets(BIO *h, char *str, int size); */ | ||
| 69 | static long b64_ctrl(BIO *h, int cmd, long arg1, void *arg2); | ||
| 70 | static int b64_new(BIO *h); | ||
| 71 | static int b64_free(BIO *data); | ||
| 72 | static long b64_callback_ctrl(BIO *h,int cmd,bio_info_cb *fp); | ||
| 73 | #define B64_BLOCK_SIZE 1024 | ||
| 74 | #define B64_BLOCK_SIZE2 768 | ||
| 75 | #define B64_NONE 0 | ||
| 76 | #define B64_ENCODE 1 | ||
| 77 | #define B64_DECODE 2 | ||
| 78 | |||
| 79 | typedef struct b64_struct | ||
| 80 | { | ||
| 81 | /*BIO *bio; moved to the BIO structure */ | ||
| 82 | int buf_len; | ||
| 83 | int buf_off; | ||
| 84 | int tmp_len; /* used to find the start when decoding */ | ||
| 85 | int tmp_nl; /* If true, scan until '\n' */ | ||
| 86 | int encode; | ||
| 87 | int start; /* have we started decoding yet? */ | ||
| 88 | int cont; /* <= 0 when finished */ | ||
| 89 | EVP_ENCODE_CTX base64; | ||
| 90 | char buf[EVP_ENCODE_LENGTH(B64_BLOCK_SIZE)+10]; | ||
| 91 | char tmp[B64_BLOCK_SIZE]; | ||
| 92 | } BIO_B64_CTX; | ||
| 93 | |||
| 94 | static BIO_METHOD methods_b64= | ||
| 95 | { | ||
| 96 | BIO_TYPE_BASE64,"base64 encoding", | ||
| 97 | b64_write, | ||
| 98 | b64_read, | ||
| 99 | NULL, /* b64_puts, */ | ||
| 100 | NULL, /* b64_gets, */ | ||
| 101 | b64_ctrl, | ||
| 102 | b64_new, | ||
| 103 | b64_free, | ||
| 104 | b64_callback_ctrl, | ||
| 105 | }; | ||
| 106 | |||
| 107 | BIO_METHOD *BIO_f_base64(void) | ||
| 108 | { | ||
| 109 | return(&methods_b64); | ||
| 110 | } | ||
| 111 | |||
| 112 | static int b64_new(BIO *bi) | ||
| 113 | { | ||
| 114 | BIO_B64_CTX *ctx; | ||
| 115 | |||
| 116 | ctx=(BIO_B64_CTX *)OPENSSL_malloc(sizeof(BIO_B64_CTX)); | ||
| 117 | if (ctx == NULL) return(0); | ||
| 118 | |||
| 119 | ctx->buf_len=0; | ||
| 120 | ctx->tmp_len=0; | ||
| 121 | ctx->tmp_nl=0; | ||
| 122 | ctx->buf_off=0; | ||
| 123 | ctx->cont=1; | ||
| 124 | ctx->start=1; | ||
| 125 | ctx->encode=0; | ||
| 126 | |||
| 127 | bi->init=1; | ||
| 128 | bi->ptr=(char *)ctx; | ||
| 129 | bi->flags=0; | ||
| 130 | return(1); | ||
| 131 | } | ||
| 132 | |||
| 133 | static int b64_free(BIO *a) | ||
| 134 | { | ||
| 135 | if (a == NULL) return(0); | ||
| 136 | OPENSSL_free(a->ptr); | ||
| 137 | a->ptr=NULL; | ||
| 138 | a->init=0; | ||
| 139 | a->flags=0; | ||
| 140 | return(1); | ||
| 141 | } | ||
| 142 | |||
| 143 | static int b64_read(BIO *b, char *out, int outl) | ||
| 144 | { | ||
| 145 | int ret=0,i,ii,j,k,x,n,num,ret_code=0; | ||
| 146 | BIO_B64_CTX *ctx; | ||
| 147 | unsigned char *p,*q; | ||
| 148 | |||
| 149 | if (out == NULL) return(0); | ||
| 150 | ctx=(BIO_B64_CTX *)b->ptr; | ||
| 151 | |||
| 152 | if ((ctx == NULL) || (b->next_bio == NULL)) return(0); | ||
| 153 | |||
| 154 | if (ctx->encode != B64_DECODE) | ||
| 155 | { | ||
| 156 | ctx->encode=B64_DECODE; | ||
| 157 | ctx->buf_len=0; | ||
| 158 | ctx->buf_off=0; | ||
| 159 | ctx->tmp_len=0; | ||
| 160 | EVP_DecodeInit(&(ctx->base64)); | ||
| 161 | } | ||
| 162 | |||
| 163 | /* First check if there are bytes decoded/encoded */ | ||
| 164 | if (ctx->buf_len > 0) | ||
| 165 | { | ||
| 166 | i=ctx->buf_len-ctx->buf_off; | ||
| 167 | if (i > outl) i=outl; | ||
| 168 | OPENSSL_assert(ctx->buf_off+i < (int)sizeof(ctx->buf)); | ||
| 169 | memcpy(out,&(ctx->buf[ctx->buf_off]),i); | ||
| 170 | ret=i; | ||
| 171 | out+=i; | ||
| 172 | outl-=i; | ||
| 173 | ctx->buf_off+=i; | ||
| 174 | if (ctx->buf_len == ctx->buf_off) | ||
| 175 | { | ||
| 176 | ctx->buf_len=0; | ||
| 177 | ctx->buf_off=0; | ||
| 178 | } | ||
| 179 | } | ||
| 180 | |||
| 181 | /* At this point, we have room of outl bytes and an empty | ||
| 182 | * buffer, so we should read in some more. */ | ||
| 183 | |||
| 184 | ret_code=0; | ||
| 185 | while (outl > 0) | ||
| 186 | { | ||
| 187 | |||
| 188 | if (ctx->cont <= 0) | ||
| 189 | break; | ||
| 190 | |||
| 191 | i=BIO_read(b->next_bio,&(ctx->tmp[ctx->tmp_len]), | ||
| 192 | B64_BLOCK_SIZE-ctx->tmp_len); | ||
| 193 | |||
| 194 | if (i <= 0) | ||
| 195 | { | ||
| 196 | ret_code=i; | ||
| 197 | |||
| 198 | /* Should be continue next time we are called? */ | ||
| 199 | if (!BIO_should_retry(b->next_bio)) | ||
| 200 | { | ||
| 201 | ctx->cont=i; | ||
| 202 | /* If buffer empty break */ | ||
| 203 | if(ctx->tmp_len == 0) | ||
| 204 | break; | ||
| 205 | /* Fall through and process what we have */ | ||
| 206 | else | ||
| 207 | i = 0; | ||
| 208 | } | ||
| 209 | /* else we retry and add more data to buffer */ | ||
| 210 | else | ||
| 211 | break; | ||
| 212 | } | ||
| 213 | i+=ctx->tmp_len; | ||
| 214 | ctx->tmp_len = i; | ||
| 215 | |||
| 216 | /* We need to scan, a line at a time until we | ||
| 217 | * have a valid line if we are starting. */ | ||
| 218 | if (ctx->start && (BIO_get_flags(b) & BIO_FLAGS_BASE64_NO_NL)) | ||
| 219 | { | ||
| 220 | /* ctx->start=1; */ | ||
| 221 | ctx->tmp_len=0; | ||
| 222 | } | ||
| 223 | else if (ctx->start) | ||
| 224 | { | ||
| 225 | q=p=(unsigned char *)ctx->tmp; | ||
| 226 | for (j=0; j<i; j++) | ||
| 227 | { | ||
| 228 | if (*(q++) != '\n') continue; | ||
| 229 | |||
| 230 | /* due to a previous very long line, | ||
| 231 | * we need to keep on scanning for a '\n' | ||
| 232 | * before we even start looking for | ||
| 233 | * base64 encoded stuff. */ | ||
| 234 | if (ctx->tmp_nl) | ||
| 235 | { | ||
| 236 | p=q; | ||
| 237 | ctx->tmp_nl=0; | ||
| 238 | continue; | ||
| 239 | } | ||
| 240 | |||
| 241 | k=EVP_DecodeUpdate(&(ctx->base64), | ||
| 242 | (unsigned char *)ctx->buf, | ||
| 243 | &num,p,q-p); | ||
| 244 | if ((k <= 0) && (num == 0) && (ctx->start)) | ||
| 245 | EVP_DecodeInit(&ctx->base64); | ||
| 246 | else | ||
| 247 | { | ||
| 248 | if (p != (unsigned char *) | ||
| 249 | &(ctx->tmp[0])) | ||
| 250 | { | ||
| 251 | i-=(p- (unsigned char *) | ||
| 252 | &(ctx->tmp[0])); | ||
| 253 | for (x=0; x < i; x++) | ||
| 254 | ctx->tmp[x]=p[x]; | ||
| 255 | } | ||
| 256 | EVP_DecodeInit(&ctx->base64); | ||
| 257 | ctx->start=0; | ||
| 258 | break; | ||
| 259 | } | ||
| 260 | p=q; | ||
| 261 | } | ||
| 262 | |||
| 263 | /* we fell off the end without starting */ | ||
| 264 | if (j == i) | ||
| 265 | { | ||
| 266 | /* Is this is one long chunk?, if so, keep on | ||
| 267 | * reading until a new line. */ | ||
| 268 | if (p == (unsigned char *)&(ctx->tmp[0])) | ||
| 269 | { | ||
| 270 | /* Check buffer full */ | ||
| 271 | if (i == B64_BLOCK_SIZE) | ||
| 272 | { | ||
| 273 | ctx->tmp_nl=1; | ||
| 274 | ctx->tmp_len=0; | ||
| 275 | } | ||
| 276 | } | ||
| 277 | else if (p != q) /* finished on a '\n' */ | ||
| 278 | { | ||
| 279 | n=q-p; | ||
| 280 | for (ii=0; ii<n; ii++) | ||
| 281 | ctx->tmp[ii]=p[ii]; | ||
| 282 | ctx->tmp_len=n; | ||
| 283 | } | ||
| 284 | /* else finished on a '\n' */ | ||
| 285 | continue; | ||
| 286 | } | ||
| 287 | else | ||
| 288 | ctx->tmp_len=0; | ||
| 289 | } | ||
| 290 | /* If buffer isn't full and we can retry then | ||
| 291 | * restart to read in more data. | ||
| 292 | */ | ||
| 293 | else if ((i < B64_BLOCK_SIZE) && (ctx->cont > 0)) | ||
| 294 | continue; | ||
| 295 | |||
| 296 | if (BIO_get_flags(b) & BIO_FLAGS_BASE64_NO_NL) | ||
| 297 | { | ||
| 298 | int z,jj; | ||
| 299 | |||
| 300 | jj=(i>>2)<<2; | ||
| 301 | z=EVP_DecodeBlock((unsigned char *)ctx->buf, | ||
| 302 | (unsigned char *)ctx->tmp,jj); | ||
| 303 | if (jj > 2) | ||
| 304 | { | ||
| 305 | if (ctx->tmp[jj-1] == '=') | ||
| 306 | { | ||
| 307 | z--; | ||
| 308 | if (ctx->tmp[jj-2] == '=') | ||
| 309 | z--; | ||
| 310 | } | ||
| 311 | } | ||
| 312 | /* z is now number of output bytes and jj is the | ||
| 313 | * number consumed */ | ||
| 314 | if (jj != i) | ||
| 315 | { | ||
| 316 | memcpy((unsigned char *)ctx->tmp, | ||
| 317 | (unsigned char *)&(ctx->tmp[jj]),i-jj); | ||
| 318 | ctx->tmp_len=i-jj; | ||
| 319 | } | ||
| 320 | ctx->buf_len=0; | ||
| 321 | if (z > 0) | ||
| 322 | { | ||
| 323 | ctx->buf_len=z; | ||
| 324 | i=1; | ||
| 325 | } | ||
| 326 | else | ||
| 327 | i=z; | ||
| 328 | } | ||
| 329 | else | ||
| 330 | { | ||
| 331 | i=EVP_DecodeUpdate(&(ctx->base64), | ||
| 332 | (unsigned char *)ctx->buf,&ctx->buf_len, | ||
| 333 | (unsigned char *)ctx->tmp,i); | ||
| 334 | ctx->tmp_len = 0; | ||
| 335 | } | ||
| 336 | ctx->buf_off=0; | ||
| 337 | if (i < 0) | ||
| 338 | { | ||
| 339 | ret_code=0; | ||
| 340 | ctx->buf_len=0; | ||
| 341 | break; | ||
| 342 | } | ||
| 343 | |||
| 344 | if (ctx->buf_len <= outl) | ||
| 345 | i=ctx->buf_len; | ||
| 346 | else | ||
| 347 | i=outl; | ||
| 348 | |||
| 349 | memcpy(out,ctx->buf,i); | ||
| 350 | ret+=i; | ||
| 351 | ctx->buf_off=i; | ||
| 352 | if (ctx->buf_off == ctx->buf_len) | ||
| 353 | { | ||
| 354 | ctx->buf_len=0; | ||
| 355 | ctx->buf_off=0; | ||
| 356 | } | ||
| 357 | outl-=i; | ||
| 358 | out+=i; | ||
| 359 | } | ||
| 360 | BIO_clear_retry_flags(b); | ||
| 361 | BIO_copy_next_retry(b); | ||
| 362 | return((ret == 0)?ret_code:ret); | ||
| 363 | } | ||
| 364 | |||
| 365 | static int b64_write(BIO *b, const char *in, int inl) | ||
| 366 | { | ||
| 367 | int ret=inl,n,i; | ||
| 368 | BIO_B64_CTX *ctx; | ||
| 369 | |||
| 370 | ctx=(BIO_B64_CTX *)b->ptr; | ||
| 371 | BIO_clear_retry_flags(b); | ||
| 372 | |||
| 373 | if (ctx->encode != B64_ENCODE) | ||
| 374 | { | ||
| 375 | ctx->encode=B64_ENCODE; | ||
| 376 | ctx->buf_len=0; | ||
| 377 | ctx->buf_off=0; | ||
| 378 | ctx->tmp_len=0; | ||
| 379 | EVP_EncodeInit(&(ctx->base64)); | ||
| 380 | } | ||
| 381 | |||
| 382 | n=ctx->buf_len-ctx->buf_off; | ||
| 383 | while (n > 0) | ||
| 384 | { | ||
| 385 | i=BIO_write(b->next_bio,&(ctx->buf[ctx->buf_off]),n); | ||
| 386 | if (i <= 0) | ||
| 387 | { | ||
| 388 | BIO_copy_next_retry(b); | ||
| 389 | return(i); | ||
| 390 | } | ||
| 391 | ctx->buf_off+=i; | ||
| 392 | n-=i; | ||
| 393 | } | ||
| 394 | /* at this point all pending data has been written */ | ||
| 395 | ctx->buf_off=0; | ||
| 396 | ctx->buf_len=0; | ||
| 397 | |||
| 398 | if ((in == NULL) || (inl <= 0)) return(0); | ||
| 399 | |||
| 400 | while (inl > 0) | ||
| 401 | { | ||
| 402 | n=(inl > B64_BLOCK_SIZE)?B64_BLOCK_SIZE:inl; | ||
| 403 | |||
| 404 | if (BIO_get_flags(b) & BIO_FLAGS_BASE64_NO_NL) | ||
| 405 | { | ||
| 406 | if (ctx->tmp_len > 0) | ||
| 407 | { | ||
| 408 | n=3-ctx->tmp_len; | ||
| 409 | /* There's a teoretical possibility for this */ | ||
| 410 | if (n > inl) | ||
| 411 | n=inl; | ||
| 412 | memcpy(&(ctx->tmp[ctx->tmp_len]),in,n); | ||
| 413 | ctx->tmp_len+=n; | ||
| 414 | if (ctx->tmp_len < 3) | ||
| 415 | break; | ||
| 416 | ctx->buf_len=EVP_EncodeBlock( | ||
| 417 | (unsigned char *)ctx->buf, | ||
| 418 | (unsigned char *)ctx->tmp, | ||
| 419 | ctx->tmp_len); | ||
| 420 | /* Since we're now done using the temporary | ||
| 421 | buffer, the length should be 0'd */ | ||
| 422 | ctx->tmp_len=0; | ||
| 423 | } | ||
| 424 | else | ||
| 425 | { | ||
| 426 | if (n < 3) | ||
| 427 | { | ||
| 428 | memcpy(&(ctx->tmp[0]),in,n); | ||
| 429 | ctx->tmp_len=n; | ||
| 430 | break; | ||
| 431 | } | ||
| 432 | n-=n%3; | ||
| 433 | ctx->buf_len=EVP_EncodeBlock( | ||
| 434 | (unsigned char *)ctx->buf, | ||
| 435 | (unsigned char *)in,n); | ||
| 436 | } | ||
| 437 | } | ||
| 438 | else | ||
| 439 | { | ||
| 440 | EVP_EncodeUpdate(&(ctx->base64), | ||
| 441 | (unsigned char *)ctx->buf,&ctx->buf_len, | ||
| 442 | (unsigned char *)in,n); | ||
| 443 | } | ||
| 444 | inl-=n; | ||
| 445 | in+=n; | ||
| 446 | |||
| 447 | ctx->buf_off=0; | ||
| 448 | n=ctx->buf_len; | ||
| 449 | while (n > 0) | ||
| 450 | { | ||
| 451 | i=BIO_write(b->next_bio,&(ctx->buf[ctx->buf_off]),n); | ||
| 452 | if (i <= 0) | ||
| 453 | { | ||
| 454 | BIO_copy_next_retry(b); | ||
| 455 | return((ret == 0)?i:ret); | ||
| 456 | } | ||
| 457 | n-=i; | ||
| 458 | ctx->buf_off+=i; | ||
| 459 | } | ||
| 460 | ctx->buf_len=0; | ||
| 461 | ctx->buf_off=0; | ||
| 462 | } | ||
| 463 | return(ret); | ||
| 464 | } | ||
| 465 | |||
| 466 | static long b64_ctrl(BIO *b, int cmd, long num, void *ptr) | ||
| 467 | { | ||
| 468 | BIO_B64_CTX *ctx; | ||
| 469 | long ret=1; | ||
| 470 | int i; | ||
| 471 | |||
| 472 | ctx=(BIO_B64_CTX *)b->ptr; | ||
| 473 | |||
| 474 | switch (cmd) | ||
| 475 | { | ||
| 476 | case BIO_CTRL_RESET: | ||
| 477 | ctx->cont=1; | ||
| 478 | ctx->start=1; | ||
| 479 | ctx->encode=B64_NONE; | ||
| 480 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 481 | break; | ||
| 482 | case BIO_CTRL_EOF: /* More to read */ | ||
| 483 | if (ctx->cont <= 0) | ||
| 484 | ret=1; | ||
| 485 | else | ||
| 486 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 487 | break; | ||
| 488 | case BIO_CTRL_WPENDING: /* More to write in buffer */ | ||
| 489 | ret=ctx->buf_len-ctx->buf_off; | ||
| 490 | if ((ret == 0) && (ctx->encode != B64_NONE) | ||
| 491 | && (ctx->base64.num != 0)) | ||
| 492 | ret=1; | ||
| 493 | else if (ret <= 0) | ||
| 494 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 495 | break; | ||
| 496 | case BIO_CTRL_PENDING: /* More to read in buffer */ | ||
| 497 | ret=ctx->buf_len-ctx->buf_off; | ||
| 498 | if (ret <= 0) | ||
| 499 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 500 | break; | ||
| 501 | case BIO_CTRL_FLUSH: | ||
| 502 | /* do a final write */ | ||
| 503 | again: | ||
| 504 | while (ctx->buf_len != ctx->buf_off) | ||
| 505 | { | ||
| 506 | i=b64_write(b,NULL,0); | ||
| 507 | if (i < 0) | ||
| 508 | return i; | ||
| 509 | } | ||
| 510 | if (BIO_get_flags(b) & BIO_FLAGS_BASE64_NO_NL) | ||
| 511 | { | ||
| 512 | if (ctx->tmp_len != 0) | ||
| 513 | { | ||
| 514 | ctx->buf_len=EVP_EncodeBlock( | ||
| 515 | (unsigned char *)ctx->buf, | ||
| 516 | (unsigned char *)ctx->tmp, | ||
| 517 | ctx->tmp_len); | ||
| 518 | ctx->buf_off=0; | ||
| 519 | ctx->tmp_len=0; | ||
| 520 | goto again; | ||
| 521 | } | ||
| 522 | } | ||
| 523 | else if (ctx->encode != B64_NONE && ctx->base64.num != 0) | ||
| 524 | { | ||
| 525 | ctx->buf_off=0; | ||
| 526 | EVP_EncodeFinal(&(ctx->base64), | ||
| 527 | (unsigned char *)ctx->buf, | ||
| 528 | &(ctx->buf_len)); | ||
| 529 | /* push out the bytes */ | ||
| 530 | goto again; | ||
| 531 | } | ||
| 532 | /* Finally flush the underlying BIO */ | ||
| 533 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 534 | break; | ||
| 535 | |||
| 536 | case BIO_C_DO_STATE_MACHINE: | ||
| 537 | BIO_clear_retry_flags(b); | ||
| 538 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 539 | BIO_copy_next_retry(b); | ||
| 540 | break; | ||
| 541 | |||
| 542 | case BIO_CTRL_DUP: | ||
| 543 | break; | ||
| 544 | case BIO_CTRL_INFO: | ||
| 545 | case BIO_CTRL_GET: | ||
| 546 | case BIO_CTRL_SET: | ||
| 547 | default: | ||
| 548 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 549 | break; | ||
| 550 | } | ||
| 551 | return(ret); | ||
| 552 | } | ||
| 553 | |||
| 554 | static long b64_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp) | ||
| 555 | { | ||
| 556 | long ret=1; | ||
| 557 | |||
| 558 | if (b->next_bio == NULL) return(0); | ||
| 559 | switch (cmd) | ||
| 560 | { | ||
| 561 | default: | ||
| 562 | ret=BIO_callback_ctrl(b->next_bio,cmd,fp); | ||
| 563 | break; | ||
| 564 | } | ||
| 565 | return(ret); | ||
| 566 | } | ||
| 567 | |||
diff --git a/src/lib/libcrypto/evp/bio_enc.c b/src/lib/libcrypto/evp/bio_enc.c new file mode 100644 index 0000000000..f6ac94c6e1 --- /dev/null +++ b/src/lib/libcrypto/evp/bio_enc.c | |||
| @@ -0,0 +1,426 @@ | |||
| 1 | /* crypto/evp/bio_enc.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <errno.h> | ||
| 61 | #include "cryptlib.h" | ||
| 62 | #include <openssl/buffer.h> | ||
| 63 | #include <openssl/evp.h> | ||
| 64 | |||
| 65 | static int enc_write(BIO *h, const char *buf, int num); | ||
| 66 | static int enc_read(BIO *h, char *buf, int size); | ||
| 67 | /*static int enc_puts(BIO *h, const char *str); */ | ||
| 68 | /*static int enc_gets(BIO *h, char *str, int size); */ | ||
| 69 | static long enc_ctrl(BIO *h, int cmd, long arg1, void *arg2); | ||
| 70 | static int enc_new(BIO *h); | ||
| 71 | static int enc_free(BIO *data); | ||
| 72 | static long enc_callback_ctrl(BIO *h, int cmd, bio_info_cb *fps); | ||
| 73 | #define ENC_BLOCK_SIZE (1024*4) | ||
| 74 | #define BUF_OFFSET (EVP_MAX_BLOCK_LENGTH*2) | ||
| 75 | |||
| 76 | typedef struct enc_struct | ||
| 77 | { | ||
| 78 | int buf_len; | ||
| 79 | int buf_off; | ||
| 80 | int cont; /* <= 0 when finished */ | ||
| 81 | int finished; | ||
| 82 | int ok; /* bad decrypt */ | ||
| 83 | EVP_CIPHER_CTX cipher; | ||
| 84 | /* buf is larger than ENC_BLOCK_SIZE because EVP_DecryptUpdate | ||
| 85 | * can return up to a block more data than is presented to it | ||
| 86 | */ | ||
| 87 | char buf[ENC_BLOCK_SIZE+BUF_OFFSET+2]; | ||
| 88 | } BIO_ENC_CTX; | ||
| 89 | |||
| 90 | static BIO_METHOD methods_enc= | ||
| 91 | { | ||
| 92 | BIO_TYPE_CIPHER,"cipher", | ||
| 93 | enc_write, | ||
| 94 | enc_read, | ||
| 95 | NULL, /* enc_puts, */ | ||
| 96 | NULL, /* enc_gets, */ | ||
| 97 | enc_ctrl, | ||
| 98 | enc_new, | ||
| 99 | enc_free, | ||
| 100 | enc_callback_ctrl, | ||
| 101 | }; | ||
| 102 | |||
| 103 | BIO_METHOD *BIO_f_cipher(void) | ||
| 104 | { | ||
| 105 | return(&methods_enc); | ||
| 106 | } | ||
| 107 | |||
| 108 | static int enc_new(BIO *bi) | ||
| 109 | { | ||
| 110 | BIO_ENC_CTX *ctx; | ||
| 111 | |||
| 112 | ctx=(BIO_ENC_CTX *)OPENSSL_malloc(sizeof(BIO_ENC_CTX)); | ||
| 113 | if (ctx == NULL) return(0); | ||
| 114 | EVP_CIPHER_CTX_init(&ctx->cipher); | ||
| 115 | |||
| 116 | ctx->buf_len=0; | ||
| 117 | ctx->buf_off=0; | ||
| 118 | ctx->cont=1; | ||
| 119 | ctx->finished=0; | ||
| 120 | ctx->ok=1; | ||
| 121 | |||
| 122 | bi->init=0; | ||
| 123 | bi->ptr=(char *)ctx; | ||
| 124 | bi->flags=0; | ||
| 125 | return(1); | ||
| 126 | } | ||
| 127 | |||
| 128 | static int enc_free(BIO *a) | ||
| 129 | { | ||
| 130 | BIO_ENC_CTX *b; | ||
| 131 | |||
| 132 | if (a == NULL) return(0); | ||
| 133 | b=(BIO_ENC_CTX *)a->ptr; | ||
| 134 | EVP_CIPHER_CTX_cleanup(&(b->cipher)); | ||
| 135 | OPENSSL_cleanse(a->ptr,sizeof(BIO_ENC_CTX)); | ||
| 136 | OPENSSL_free(a->ptr); | ||
| 137 | a->ptr=NULL; | ||
| 138 | a->init=0; | ||
| 139 | a->flags=0; | ||
| 140 | return(1); | ||
| 141 | } | ||
| 142 | |||
| 143 | static int enc_read(BIO *b, char *out, int outl) | ||
| 144 | { | ||
| 145 | int ret=0,i; | ||
| 146 | BIO_ENC_CTX *ctx; | ||
| 147 | |||
| 148 | if (out == NULL) return(0); | ||
| 149 | ctx=(BIO_ENC_CTX *)b->ptr; | ||
| 150 | |||
| 151 | if ((ctx == NULL) || (b->next_bio == NULL)) return(0); | ||
| 152 | |||
| 153 | /* First check if there are bytes decoded/encoded */ | ||
| 154 | if (ctx->buf_len > 0) | ||
| 155 | { | ||
| 156 | i=ctx->buf_len-ctx->buf_off; | ||
| 157 | if (i > outl) i=outl; | ||
| 158 | memcpy(out,&(ctx->buf[ctx->buf_off]),i); | ||
| 159 | ret=i; | ||
| 160 | out+=i; | ||
| 161 | outl-=i; | ||
| 162 | ctx->buf_off+=i; | ||
| 163 | if (ctx->buf_len == ctx->buf_off) | ||
| 164 | { | ||
| 165 | ctx->buf_len=0; | ||
| 166 | ctx->buf_off=0; | ||
| 167 | } | ||
| 168 | } | ||
| 169 | |||
| 170 | /* At this point, we have room of outl bytes and an empty | ||
| 171 | * buffer, so we should read in some more. */ | ||
| 172 | |||
| 173 | while (outl > 0) | ||
| 174 | { | ||
| 175 | if (ctx->cont <= 0) break; | ||
| 176 | |||
| 177 | /* read in at IV offset, read the EVP_Cipher | ||
| 178 | * documentation about why */ | ||
| 179 | i=BIO_read(b->next_bio,&(ctx->buf[BUF_OFFSET]),ENC_BLOCK_SIZE); | ||
| 180 | |||
| 181 | if (i <= 0) | ||
| 182 | { | ||
| 183 | /* Should be continue next time we are called? */ | ||
| 184 | if (!BIO_should_retry(b->next_bio)) | ||
| 185 | { | ||
| 186 | ctx->cont=i; | ||
| 187 | i=EVP_CipherFinal_ex(&(ctx->cipher), | ||
| 188 | (unsigned char *)ctx->buf, | ||
| 189 | &(ctx->buf_len)); | ||
| 190 | ctx->ok=i; | ||
| 191 | ctx->buf_off=0; | ||
| 192 | } | ||
| 193 | else | ||
| 194 | { | ||
| 195 | ret=(ret == 0)?i:ret; | ||
| 196 | break; | ||
| 197 | } | ||
| 198 | } | ||
| 199 | else | ||
| 200 | { | ||
| 201 | EVP_CipherUpdate(&(ctx->cipher), | ||
| 202 | (unsigned char *)ctx->buf,&ctx->buf_len, | ||
| 203 | (unsigned char *)&(ctx->buf[BUF_OFFSET]),i); | ||
| 204 | ctx->cont=1; | ||
| 205 | /* Note: it is possible for EVP_CipherUpdate to | ||
| 206 | * decrypt zero bytes because this is or looks like | ||
| 207 | * the final block: if this happens we should retry | ||
| 208 | * and either read more data or decrypt the final | ||
| 209 | * block | ||
| 210 | */ | ||
| 211 | if(ctx->buf_len == 0) continue; | ||
| 212 | } | ||
| 213 | |||
| 214 | if (ctx->buf_len <= outl) | ||
| 215 | i=ctx->buf_len; | ||
| 216 | else | ||
| 217 | i=outl; | ||
| 218 | if (i <= 0) break; | ||
| 219 | memcpy(out,ctx->buf,i); | ||
| 220 | ret+=i; | ||
| 221 | ctx->buf_off=i; | ||
| 222 | outl-=i; | ||
| 223 | out+=i; | ||
| 224 | } | ||
| 225 | |||
| 226 | BIO_clear_retry_flags(b); | ||
| 227 | BIO_copy_next_retry(b); | ||
| 228 | return((ret == 0)?ctx->cont:ret); | ||
| 229 | } | ||
| 230 | |||
| 231 | static int enc_write(BIO *b, const char *in, int inl) | ||
| 232 | { | ||
| 233 | int ret=0,n,i; | ||
| 234 | BIO_ENC_CTX *ctx; | ||
| 235 | |||
| 236 | ctx=(BIO_ENC_CTX *)b->ptr; | ||
| 237 | ret=inl; | ||
| 238 | |||
| 239 | BIO_clear_retry_flags(b); | ||
| 240 | n=ctx->buf_len-ctx->buf_off; | ||
| 241 | while (n > 0) | ||
| 242 | { | ||
| 243 | i=BIO_write(b->next_bio,&(ctx->buf[ctx->buf_off]),n); | ||
| 244 | if (i <= 0) | ||
| 245 | { | ||
| 246 | BIO_copy_next_retry(b); | ||
| 247 | return(i); | ||
| 248 | } | ||
| 249 | ctx->buf_off+=i; | ||
| 250 | n-=i; | ||
| 251 | } | ||
| 252 | /* at this point all pending data has been written */ | ||
| 253 | |||
| 254 | if ((in == NULL) || (inl <= 0)) return(0); | ||
| 255 | |||
| 256 | ctx->buf_off=0; | ||
| 257 | while (inl > 0) | ||
| 258 | { | ||
| 259 | n=(inl > ENC_BLOCK_SIZE)?ENC_BLOCK_SIZE:inl; | ||
| 260 | EVP_CipherUpdate(&(ctx->cipher), | ||
| 261 | (unsigned char *)ctx->buf,&ctx->buf_len, | ||
| 262 | (unsigned char *)in,n); | ||
| 263 | inl-=n; | ||
| 264 | in+=n; | ||
| 265 | |||
| 266 | ctx->buf_off=0; | ||
| 267 | n=ctx->buf_len; | ||
| 268 | while (n > 0) | ||
| 269 | { | ||
| 270 | i=BIO_write(b->next_bio,&(ctx->buf[ctx->buf_off]),n); | ||
| 271 | if (i <= 0) | ||
| 272 | { | ||
| 273 | BIO_copy_next_retry(b); | ||
| 274 | return (ret == inl) ? i : ret - inl; | ||
| 275 | } | ||
| 276 | n-=i; | ||
| 277 | ctx->buf_off+=i; | ||
| 278 | } | ||
| 279 | ctx->buf_len=0; | ||
| 280 | ctx->buf_off=0; | ||
| 281 | } | ||
| 282 | BIO_copy_next_retry(b); | ||
| 283 | return(ret); | ||
| 284 | } | ||
| 285 | |||
| 286 | static long enc_ctrl(BIO *b, int cmd, long num, void *ptr) | ||
| 287 | { | ||
| 288 | BIO *dbio; | ||
| 289 | BIO_ENC_CTX *ctx,*dctx; | ||
| 290 | long ret=1; | ||
| 291 | int i; | ||
| 292 | EVP_CIPHER_CTX **c_ctx; | ||
| 293 | |||
| 294 | ctx=(BIO_ENC_CTX *)b->ptr; | ||
| 295 | |||
| 296 | switch (cmd) | ||
| 297 | { | ||
| 298 | case BIO_CTRL_RESET: | ||
| 299 | ctx->ok=1; | ||
| 300 | ctx->finished=0; | ||
| 301 | EVP_CipherInit_ex(&(ctx->cipher),NULL,NULL,NULL,NULL, | ||
| 302 | ctx->cipher.encrypt); | ||
| 303 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 304 | break; | ||
| 305 | case BIO_CTRL_EOF: /* More to read */ | ||
| 306 | if (ctx->cont <= 0) | ||
| 307 | ret=1; | ||
| 308 | else | ||
| 309 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 310 | break; | ||
| 311 | case BIO_CTRL_WPENDING: | ||
| 312 | ret=ctx->buf_len-ctx->buf_off; | ||
| 313 | if (ret <= 0) | ||
| 314 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 315 | break; | ||
| 316 | case BIO_CTRL_PENDING: /* More to read in buffer */ | ||
| 317 | ret=ctx->buf_len-ctx->buf_off; | ||
| 318 | if (ret <= 0) | ||
| 319 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 320 | break; | ||
| 321 | case BIO_CTRL_FLUSH: | ||
| 322 | /* do a final write */ | ||
| 323 | again: | ||
| 324 | while (ctx->buf_len != ctx->buf_off) | ||
| 325 | { | ||
| 326 | i=enc_write(b,NULL,0); | ||
| 327 | if (i < 0) | ||
| 328 | return i; | ||
| 329 | } | ||
| 330 | |||
| 331 | if (!ctx->finished) | ||
| 332 | { | ||
| 333 | ctx->finished=1; | ||
| 334 | ctx->buf_off=0; | ||
| 335 | ret=EVP_CipherFinal_ex(&(ctx->cipher), | ||
| 336 | (unsigned char *)ctx->buf, | ||
| 337 | &(ctx->buf_len)); | ||
| 338 | ctx->ok=(int)ret; | ||
| 339 | if (ret <= 0) break; | ||
| 340 | |||
| 341 | /* push out the bytes */ | ||
| 342 | goto again; | ||
| 343 | } | ||
| 344 | |||
| 345 | /* Finally flush the underlying BIO */ | ||
| 346 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 347 | break; | ||
| 348 | case BIO_C_GET_CIPHER_STATUS: | ||
| 349 | ret=(long)ctx->ok; | ||
| 350 | break; | ||
| 351 | case BIO_C_DO_STATE_MACHINE: | ||
| 352 | BIO_clear_retry_flags(b); | ||
| 353 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 354 | BIO_copy_next_retry(b); | ||
| 355 | break; | ||
| 356 | case BIO_C_GET_CIPHER_CTX: | ||
| 357 | c_ctx=(EVP_CIPHER_CTX **)ptr; | ||
| 358 | (*c_ctx)= &(ctx->cipher); | ||
| 359 | b->init=1; | ||
| 360 | break; | ||
| 361 | case BIO_CTRL_DUP: | ||
| 362 | dbio=(BIO *)ptr; | ||
| 363 | dctx=(BIO_ENC_CTX *)dbio->ptr; | ||
| 364 | memcpy(&(dctx->cipher),&(ctx->cipher),sizeof(ctx->cipher)); | ||
| 365 | dbio->init=1; | ||
| 366 | break; | ||
| 367 | default: | ||
| 368 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 369 | break; | ||
| 370 | } | ||
| 371 | return(ret); | ||
| 372 | } | ||
| 373 | |||
| 374 | static long enc_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp) | ||
| 375 | { | ||
| 376 | long ret=1; | ||
| 377 | |||
| 378 | if (b->next_bio == NULL) return(0); | ||
| 379 | switch (cmd) | ||
| 380 | { | ||
| 381 | default: | ||
| 382 | ret=BIO_callback_ctrl(b->next_bio,cmd,fp); | ||
| 383 | break; | ||
| 384 | } | ||
| 385 | return(ret); | ||
| 386 | } | ||
| 387 | |||
| 388 | /* | ||
| 389 | void BIO_set_cipher_ctx(b,c) | ||
| 390 | BIO *b; | ||
| 391 | EVP_CIPHER_ctx *c; | ||
| 392 | { | ||
| 393 | if (b == NULL) return; | ||
| 394 | |||
| 395 | if ((b->callback != NULL) && | ||
| 396 | (b->callback(b,BIO_CB_CTRL,(char *)c,BIO_CTRL_SET,e,0L) <= 0)) | ||
| 397 | return; | ||
| 398 | |||
| 399 | b->init=1; | ||
| 400 | ctx=(BIO_ENC_CTX *)b->ptr; | ||
| 401 | memcpy(ctx->cipher,c,sizeof(EVP_CIPHER_CTX)); | ||
| 402 | |||
| 403 | if (b->callback != NULL) | ||
| 404 | b->callback(b,BIO_CB_CTRL,(char *)c,BIO_CTRL_SET,e,1L); | ||
| 405 | } | ||
| 406 | */ | ||
| 407 | |||
| 408 | void BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k, | ||
| 409 | const unsigned char *i, int e) | ||
| 410 | { | ||
| 411 | BIO_ENC_CTX *ctx; | ||
| 412 | |||
| 413 | if (b == NULL) return; | ||
| 414 | |||
| 415 | if ((b->callback != NULL) && | ||
| 416 | (b->callback(b,BIO_CB_CTRL,(const char *)c,BIO_CTRL_SET,e,0L) <= 0)) | ||
| 417 | return; | ||
| 418 | |||
| 419 | b->init=1; | ||
| 420 | ctx=(BIO_ENC_CTX *)b->ptr; | ||
| 421 | EVP_CipherInit_ex(&(ctx->cipher),c,NULL, k,i,e); | ||
| 422 | |||
| 423 | if (b->callback != NULL) | ||
| 424 | b->callback(b,BIO_CB_CTRL,(const char *)c,BIO_CTRL_SET,e,1L); | ||
| 425 | } | ||
| 426 | |||
diff --git a/src/lib/libcrypto/evp/bio_md.c b/src/lib/libcrypto/evp/bio_md.c new file mode 100644 index 0000000000..d648ac6da6 --- /dev/null +++ b/src/lib/libcrypto/evp/bio_md.c | |||
| @@ -0,0 +1,269 @@ | |||
| 1 | /* crypto/evp/bio_md.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <errno.h> | ||
| 61 | #include "cryptlib.h" | ||
| 62 | #include <openssl/buffer.h> | ||
| 63 | #include <openssl/evp.h> | ||
| 64 | |||
| 65 | /* BIO_put and BIO_get both add to the digest, | ||
| 66 | * BIO_gets returns the digest */ | ||
| 67 | |||
| 68 | static int md_write(BIO *h, char const *buf, int num); | ||
| 69 | static int md_read(BIO *h, char *buf, int size); | ||
| 70 | /*static int md_puts(BIO *h, const char *str); */ | ||
| 71 | static int md_gets(BIO *h, char *str, int size); | ||
| 72 | static long md_ctrl(BIO *h, int cmd, long arg1, void *arg2); | ||
| 73 | static int md_new(BIO *h); | ||
| 74 | static int md_free(BIO *data); | ||
| 75 | static long md_callback_ctrl(BIO *h,int cmd,bio_info_cb *fp); | ||
| 76 | |||
| 77 | static BIO_METHOD methods_md= | ||
| 78 | { | ||
| 79 | BIO_TYPE_MD,"message digest", | ||
| 80 | md_write, | ||
| 81 | md_read, | ||
| 82 | NULL, /* md_puts, */ | ||
| 83 | md_gets, | ||
| 84 | md_ctrl, | ||
| 85 | md_new, | ||
| 86 | md_free, | ||
| 87 | md_callback_ctrl, | ||
| 88 | }; | ||
| 89 | |||
| 90 | BIO_METHOD *BIO_f_md(void) | ||
| 91 | { | ||
| 92 | return(&methods_md); | ||
| 93 | } | ||
| 94 | |||
| 95 | static int md_new(BIO *bi) | ||
| 96 | { | ||
| 97 | EVP_MD_CTX *ctx; | ||
| 98 | |||
| 99 | ctx=EVP_MD_CTX_create(); | ||
| 100 | if (ctx == NULL) return(0); | ||
| 101 | |||
| 102 | bi->init=0; | ||
| 103 | bi->ptr=(char *)ctx; | ||
| 104 | bi->flags=0; | ||
| 105 | return(1); | ||
| 106 | } | ||
| 107 | |||
| 108 | static int md_free(BIO *a) | ||
| 109 | { | ||
| 110 | if (a == NULL) return(0); | ||
| 111 | EVP_MD_CTX_destroy(a->ptr); | ||
| 112 | a->ptr=NULL; | ||
| 113 | a->init=0; | ||
| 114 | a->flags=0; | ||
| 115 | return(1); | ||
| 116 | } | ||
| 117 | |||
| 118 | static int md_read(BIO *b, char *out, int outl) | ||
| 119 | { | ||
| 120 | int ret=0; | ||
| 121 | EVP_MD_CTX *ctx; | ||
| 122 | |||
| 123 | if (out == NULL) return(0); | ||
| 124 | ctx=b->ptr; | ||
| 125 | |||
| 126 | if ((ctx == NULL) || (b->next_bio == NULL)) return(0); | ||
| 127 | |||
| 128 | ret=BIO_read(b->next_bio,out,outl); | ||
| 129 | if (b->init) | ||
| 130 | { | ||
| 131 | if (ret > 0) | ||
| 132 | { | ||
| 133 | EVP_DigestUpdate(ctx,(unsigned char *)out, | ||
| 134 | (unsigned int)ret); | ||
| 135 | } | ||
| 136 | } | ||
| 137 | BIO_clear_retry_flags(b); | ||
| 138 | BIO_copy_next_retry(b); | ||
| 139 | return(ret); | ||
| 140 | } | ||
| 141 | |||
| 142 | static int md_write(BIO *b, const char *in, int inl) | ||
| 143 | { | ||
| 144 | int ret=0; | ||
| 145 | EVP_MD_CTX *ctx; | ||
| 146 | |||
| 147 | if ((in == NULL) || (inl <= 0)) return(0); | ||
| 148 | ctx=b->ptr; | ||
| 149 | |||
| 150 | if ((ctx != NULL) && (b->next_bio != NULL)) | ||
| 151 | ret=BIO_write(b->next_bio,in,inl); | ||
| 152 | if (b->init) | ||
| 153 | { | ||
| 154 | if (ret > 0) | ||
| 155 | { | ||
| 156 | EVP_DigestUpdate(ctx,(const unsigned char *)in, | ||
| 157 | (unsigned int)ret); | ||
| 158 | } | ||
| 159 | } | ||
| 160 | BIO_clear_retry_flags(b); | ||
| 161 | BIO_copy_next_retry(b); | ||
| 162 | return(ret); | ||
| 163 | } | ||
| 164 | |||
| 165 | static long md_ctrl(BIO *b, int cmd, long num, void *ptr) | ||
| 166 | { | ||
| 167 | EVP_MD_CTX *ctx,*dctx,**pctx; | ||
| 168 | const EVP_MD **ppmd; | ||
| 169 | EVP_MD *md; | ||
| 170 | long ret=1; | ||
| 171 | BIO *dbio; | ||
| 172 | |||
| 173 | ctx=b->ptr; | ||
| 174 | |||
| 175 | switch (cmd) | ||
| 176 | { | ||
| 177 | case BIO_CTRL_RESET: | ||
| 178 | if (b->init) | ||
| 179 | ret = EVP_DigestInit_ex(ctx,ctx->digest, NULL); | ||
| 180 | else | ||
| 181 | ret=0; | ||
| 182 | if (ret > 0) | ||
| 183 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 184 | break; | ||
| 185 | case BIO_C_GET_MD: | ||
| 186 | if (b->init) | ||
| 187 | { | ||
| 188 | ppmd=ptr; | ||
| 189 | *ppmd=ctx->digest; | ||
| 190 | } | ||
| 191 | else | ||
| 192 | ret=0; | ||
| 193 | break; | ||
| 194 | case BIO_C_GET_MD_CTX: | ||
| 195 | if (b->init) | ||
| 196 | { | ||
| 197 | pctx=ptr; | ||
| 198 | *pctx=ctx; | ||
| 199 | } | ||
| 200 | else | ||
| 201 | ret=0; | ||
| 202 | break; | ||
| 203 | case BIO_C_SET_MD_CTX: | ||
| 204 | if (b->init) | ||
| 205 | b->ptr=ptr; | ||
| 206 | else | ||
| 207 | ret=0; | ||
| 208 | break; | ||
| 209 | case BIO_C_DO_STATE_MACHINE: | ||
| 210 | BIO_clear_retry_flags(b); | ||
| 211 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 212 | BIO_copy_next_retry(b); | ||
| 213 | break; | ||
| 214 | |||
| 215 | case BIO_C_SET_MD: | ||
| 216 | md=ptr; | ||
| 217 | ret = EVP_DigestInit_ex(ctx,md, NULL); | ||
| 218 | if (ret > 0) | ||
| 219 | b->init=1; | ||
| 220 | break; | ||
| 221 | case BIO_CTRL_DUP: | ||
| 222 | dbio=ptr; | ||
| 223 | dctx=dbio->ptr; | ||
| 224 | EVP_MD_CTX_copy_ex(dctx,ctx); | ||
| 225 | b->init=1; | ||
| 226 | break; | ||
| 227 | default: | ||
| 228 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 229 | break; | ||
| 230 | } | ||
| 231 | return(ret); | ||
| 232 | } | ||
| 233 | |||
| 234 | static long md_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp) | ||
| 235 | { | ||
| 236 | long ret=1; | ||
| 237 | |||
| 238 | if (b->next_bio == NULL) return(0); | ||
| 239 | switch (cmd) | ||
| 240 | { | ||
| 241 | default: | ||
| 242 | ret=BIO_callback_ctrl(b->next_bio,cmd,fp); | ||
| 243 | break; | ||
| 244 | } | ||
| 245 | return(ret); | ||
| 246 | } | ||
| 247 | |||
| 248 | static int md_gets(BIO *bp, char *buf, int size) | ||
| 249 | { | ||
| 250 | EVP_MD_CTX *ctx; | ||
| 251 | unsigned int ret; | ||
| 252 | |||
| 253 | |||
| 254 | ctx=bp->ptr; | ||
| 255 | if (size < ctx->digest->md_size) | ||
| 256 | return(0); | ||
| 257 | EVP_DigestFinal_ex(ctx,(unsigned char *)buf,&ret); | ||
| 258 | return((int)ret); | ||
| 259 | } | ||
| 260 | |||
| 261 | /* | ||
| 262 | static int md_puts(bp,str) | ||
| 263 | BIO *bp; | ||
| 264 | char *str; | ||
| 265 | { | ||
| 266 | return(-1); | ||
| 267 | } | ||
| 268 | */ | ||
| 269 | |||
diff --git a/src/lib/libcrypto/evp/c_all.c b/src/lib/libcrypto/evp/c_all.c new file mode 100644 index 0000000000..a5da52e62d --- /dev/null +++ b/src/lib/libcrypto/evp/c_all.c | |||
| @@ -0,0 +1,90 @@ | |||
| 1 | /* crypto/evp/c_all.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/evp.h> | ||
| 62 | #ifndef OPENSSL_NO_ENGINE | ||
| 63 | #include <openssl/engine.h> | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #if 0 | ||
| 67 | #undef OpenSSL_add_all_algorithms | ||
| 68 | |||
| 69 | void OpenSSL_add_all_algorithms(void) | ||
| 70 | { | ||
| 71 | OPENSSL_add_all_algorithms_noconf(); | ||
| 72 | } | ||
| 73 | #endif | ||
| 74 | |||
| 75 | void OPENSSL_add_all_algorithms_noconf(void) | ||
| 76 | { | ||
| 77 | /* | ||
| 78 | * For the moment OPENSSL_cpuid_setup does something | ||
| 79 | * only on IA-32, but we reserve the option for all | ||
| 80 | * platforms... | ||
| 81 | */ | ||
| 82 | OPENSSL_cpuid_setup(); | ||
| 83 | OpenSSL_add_all_ciphers(); | ||
| 84 | OpenSSL_add_all_digests(); | ||
| 85 | #ifndef OPENSSL_NO_ENGINE | ||
| 86 | # if defined(__OpenBSD__) || defined(__FreeBSD__) | ||
| 87 | ENGINE_setup_bsd_cryptodev(); | ||
| 88 | # endif | ||
| 89 | #endif | ||
| 90 | } | ||
diff --git a/src/lib/libcrypto/evp/digest.c b/src/lib/libcrypto/evp/digest.c new file mode 100644 index 0000000000..762e6d3450 --- /dev/null +++ b/src/lib/libcrypto/evp/digest.c | |||
| @@ -0,0 +1,334 @@ | |||
| 1 | /* crypto/evp/digest.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | /* ==================================================================== | ||
| 59 | * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. | ||
| 60 | * | ||
| 61 | * Redistribution and use in source and binary forms, with or without | ||
| 62 | * modification, are permitted provided that the following conditions | ||
| 63 | * are met: | ||
| 64 | * | ||
| 65 | * 1. Redistributions of source code must retain the above copyright | ||
| 66 | * notice, this list of conditions and the following disclaimer. | ||
| 67 | * | ||
| 68 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 69 | * notice, this list of conditions and the following disclaimer in | ||
| 70 | * the documentation and/or other materials provided with the | ||
| 71 | * distribution. | ||
| 72 | * | ||
| 73 | * 3. All advertising materials mentioning features or use of this | ||
| 74 | * software must display the following acknowledgment: | ||
| 75 | * "This product includes software developed by the OpenSSL Project | ||
| 76 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 77 | * | ||
| 78 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 79 | * endorse or promote products derived from this software without | ||
| 80 | * prior written permission. For written permission, please contact | ||
| 81 | * openssl-core@openssl.org. | ||
| 82 | * | ||
| 83 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 84 | * nor may "OpenSSL" appear in their names without prior written | ||
| 85 | * permission of the OpenSSL Project. | ||
| 86 | * | ||
| 87 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 88 | * acknowledgment: | ||
| 89 | * "This product includes software developed by the OpenSSL Project | ||
| 90 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 91 | * | ||
| 92 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 93 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 94 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 95 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 96 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 97 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 98 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 99 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 100 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 101 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 102 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 103 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 104 | * ==================================================================== | ||
| 105 | * | ||
| 106 | * This product includes cryptographic software written by Eric Young | ||
| 107 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 108 | * Hudson (tjh@cryptsoft.com). | ||
| 109 | * | ||
| 110 | */ | ||
| 111 | |||
| 112 | #include <stdio.h> | ||
| 113 | #include "cryptlib.h" | ||
| 114 | #include <openssl/objects.h> | ||
| 115 | #include <openssl/evp.h> | ||
| 116 | #ifndef OPENSSL_NO_ENGINE | ||
| 117 | #include <openssl/engine.h> | ||
| 118 | #endif | ||
| 119 | |||
| 120 | void EVP_MD_CTX_init(EVP_MD_CTX *ctx) | ||
| 121 | { | ||
| 122 | memset(ctx,'\0',sizeof *ctx); | ||
| 123 | } | ||
| 124 | |||
| 125 | EVP_MD_CTX *EVP_MD_CTX_create(void) | ||
| 126 | { | ||
| 127 | EVP_MD_CTX *ctx=OPENSSL_malloc(sizeof *ctx); | ||
| 128 | |||
| 129 | EVP_MD_CTX_init(ctx); | ||
| 130 | |||
| 131 | return ctx; | ||
| 132 | } | ||
| 133 | |||
| 134 | int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) | ||
| 135 | { | ||
| 136 | EVP_MD_CTX_init(ctx); | ||
| 137 | return EVP_DigestInit_ex(ctx, type, NULL); | ||
| 138 | } | ||
| 139 | |||
| 140 | int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) | ||
| 141 | { | ||
| 142 | EVP_MD_CTX_clear_flags(ctx,EVP_MD_CTX_FLAG_CLEANED); | ||
| 143 | #ifndef OPENSSL_NO_ENGINE | ||
| 144 | /* Whether it's nice or not, "Inits" can be used on "Final"'d contexts | ||
| 145 | * so this context may already have an ENGINE! Try to avoid releasing | ||
| 146 | * the previous handle, re-querying for an ENGINE, and having a | ||
| 147 | * reinitialisation, when it may all be unecessary. */ | ||
| 148 | if (ctx->engine && ctx->digest && (!type || | ||
| 149 | (type && (type->type == ctx->digest->type)))) | ||
| 150 | goto skip_to_init; | ||
| 151 | if (type) | ||
| 152 | { | ||
| 153 | /* Ensure an ENGINE left lying around from last time is cleared | ||
| 154 | * (the previous check attempted to avoid this if the same | ||
| 155 | * ENGINE and EVP_MD could be used). */ | ||
| 156 | if(ctx->engine) | ||
| 157 | ENGINE_finish(ctx->engine); | ||
| 158 | if(impl) | ||
| 159 | { | ||
| 160 | if (!ENGINE_init(impl)) | ||
| 161 | { | ||
| 162 | EVPerr(EVP_F_EVP_DIGESTINIT_EX,EVP_R_INITIALIZATION_ERROR); | ||
| 163 | return 0; | ||
| 164 | } | ||
| 165 | } | ||
| 166 | else | ||
| 167 | /* Ask if an ENGINE is reserved for this job */ | ||
| 168 | impl = ENGINE_get_digest_engine(type->type); | ||
| 169 | if(impl) | ||
| 170 | { | ||
| 171 | /* There's an ENGINE for this job ... (apparently) */ | ||
| 172 | const EVP_MD *d = ENGINE_get_digest(impl, type->type); | ||
| 173 | if(!d) | ||
| 174 | { | ||
| 175 | /* Same comment from evp_enc.c */ | ||
| 176 | EVPerr(EVP_F_EVP_DIGESTINIT_EX,EVP_R_INITIALIZATION_ERROR); | ||
| 177 | return 0; | ||
| 178 | } | ||
| 179 | /* We'll use the ENGINE's private digest definition */ | ||
| 180 | type = d; | ||
| 181 | /* Store the ENGINE functional reference so we know | ||
| 182 | * 'type' came from an ENGINE and we need to release | ||
| 183 | * it when done. */ | ||
| 184 | ctx->engine = impl; | ||
| 185 | } | ||
| 186 | else | ||
| 187 | ctx->engine = NULL; | ||
| 188 | } | ||
| 189 | else | ||
| 190 | if(!ctx->digest) | ||
| 191 | { | ||
| 192 | EVPerr(EVP_F_EVP_DIGESTINIT_EX,EVP_R_NO_DIGEST_SET); | ||
| 193 | return 0; | ||
| 194 | } | ||
| 195 | #endif | ||
| 196 | if (ctx->digest != type) | ||
| 197 | { | ||
| 198 | if (ctx->digest && ctx->digest->ctx_size) | ||
| 199 | OPENSSL_free(ctx->md_data); | ||
| 200 | ctx->digest=type; | ||
| 201 | if (type->ctx_size) | ||
| 202 | ctx->md_data=OPENSSL_malloc(type->ctx_size); | ||
| 203 | } | ||
| 204 | #ifndef OPENSSL_NO_ENGINE | ||
| 205 | skip_to_init: | ||
| 206 | #endif | ||
| 207 | return ctx->digest->init(ctx); | ||
| 208 | } | ||
| 209 | |||
| 210 | int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, | ||
| 211 | size_t count) | ||
| 212 | { | ||
| 213 | return ctx->digest->update(ctx,data,count); | ||
| 214 | } | ||
| 215 | |||
| 216 | /* The caller can assume that this removes any secret data from the context */ | ||
| 217 | int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) | ||
| 218 | { | ||
| 219 | int ret; | ||
| 220 | ret = EVP_DigestFinal_ex(ctx, md, size); | ||
| 221 | EVP_MD_CTX_cleanup(ctx); | ||
| 222 | return ret; | ||
| 223 | } | ||
| 224 | |||
| 225 | /* The caller can assume that this removes any secret data from the context */ | ||
| 226 | int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) | ||
| 227 | { | ||
| 228 | int ret; | ||
| 229 | |||
| 230 | OPENSSL_assert(ctx->digest->md_size <= EVP_MAX_MD_SIZE); | ||
| 231 | ret=ctx->digest->final(ctx,md); | ||
| 232 | if (size != NULL) | ||
| 233 | *size=ctx->digest->md_size; | ||
| 234 | if (ctx->digest->cleanup) | ||
| 235 | { | ||
| 236 | ctx->digest->cleanup(ctx); | ||
| 237 | EVP_MD_CTX_set_flags(ctx,EVP_MD_CTX_FLAG_CLEANED); | ||
| 238 | } | ||
| 239 | memset(ctx->md_data,0,ctx->digest->ctx_size); | ||
| 240 | return ret; | ||
| 241 | } | ||
| 242 | |||
| 243 | int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in) | ||
| 244 | { | ||
| 245 | EVP_MD_CTX_init(out); | ||
| 246 | return EVP_MD_CTX_copy_ex(out, in); | ||
| 247 | } | ||
| 248 | |||
| 249 | int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in) | ||
| 250 | { | ||
| 251 | unsigned char *tmp_buf; | ||
| 252 | if ((in == NULL) || (in->digest == NULL)) | ||
| 253 | { | ||
| 254 | EVPerr(EVP_F_EVP_MD_CTX_COPY_EX,EVP_R_INPUT_NOT_INITIALIZED); | ||
| 255 | return 0; | ||
| 256 | } | ||
| 257 | #ifndef OPENSSL_NO_ENGINE | ||
| 258 | /* Make sure it's safe to copy a digest context using an ENGINE */ | ||
| 259 | if (in->engine && !ENGINE_init(in->engine)) | ||
| 260 | { | ||
| 261 | EVPerr(EVP_F_EVP_MD_CTX_COPY_EX,ERR_R_ENGINE_LIB); | ||
| 262 | return 0; | ||
| 263 | } | ||
| 264 | #endif | ||
| 265 | |||
| 266 | if (out->digest == in->digest) | ||
| 267 | { | ||
| 268 | tmp_buf = out->md_data; | ||
| 269 | EVP_MD_CTX_set_flags(out,EVP_MD_CTX_FLAG_REUSE); | ||
| 270 | } | ||
| 271 | else tmp_buf = NULL; | ||
| 272 | EVP_MD_CTX_cleanup(out); | ||
| 273 | memcpy(out,in,sizeof *out); | ||
| 274 | |||
| 275 | if (out->digest->ctx_size) | ||
| 276 | { | ||
| 277 | if (tmp_buf) out->md_data = tmp_buf; | ||
| 278 | else out->md_data=OPENSSL_malloc(out->digest->ctx_size); | ||
| 279 | memcpy(out->md_data,in->md_data,out->digest->ctx_size); | ||
| 280 | } | ||
| 281 | |||
| 282 | if (out->digest->copy) | ||
| 283 | return out->digest->copy(out,in); | ||
| 284 | |||
| 285 | return 1; | ||
| 286 | } | ||
| 287 | |||
| 288 | int EVP_Digest(const void *data, size_t count, | ||
| 289 | unsigned char *md, unsigned int *size, const EVP_MD *type, ENGINE *impl) | ||
| 290 | { | ||
| 291 | EVP_MD_CTX ctx; | ||
| 292 | int ret; | ||
| 293 | |||
| 294 | EVP_MD_CTX_init(&ctx); | ||
| 295 | EVP_MD_CTX_set_flags(&ctx,EVP_MD_CTX_FLAG_ONESHOT); | ||
| 296 | ret=EVP_DigestInit_ex(&ctx, type, impl) | ||
| 297 | && EVP_DigestUpdate(&ctx, data, count) | ||
| 298 | && EVP_DigestFinal_ex(&ctx, md, size); | ||
| 299 | EVP_MD_CTX_cleanup(&ctx); | ||
| 300 | |||
| 301 | return ret; | ||
| 302 | } | ||
| 303 | |||
| 304 | void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx) | ||
| 305 | { | ||
| 306 | EVP_MD_CTX_cleanup(ctx); | ||
| 307 | OPENSSL_free(ctx); | ||
| 308 | } | ||
| 309 | |||
| 310 | /* This call frees resources associated with the context */ | ||
| 311 | int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx) | ||
| 312 | { | ||
| 313 | /* Don't assume ctx->md_data was cleaned in EVP_Digest_Final, | ||
| 314 | * because sometimes only copies of the context are ever finalised. | ||
| 315 | */ | ||
| 316 | if (ctx->digest && ctx->digest->cleanup | ||
| 317 | && !EVP_MD_CTX_test_flags(ctx,EVP_MD_CTX_FLAG_CLEANED)) | ||
| 318 | ctx->digest->cleanup(ctx); | ||
| 319 | if (ctx->digest && ctx->digest->ctx_size && ctx->md_data | ||
| 320 | && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) | ||
| 321 | { | ||
| 322 | OPENSSL_cleanse(ctx->md_data,ctx->digest->ctx_size); | ||
| 323 | OPENSSL_free(ctx->md_data); | ||
| 324 | } | ||
| 325 | #ifndef OPENSSL_NO_ENGINE | ||
| 326 | if(ctx->engine) | ||
| 327 | /* The EVP_MD we used belongs to an ENGINE, release the | ||
| 328 | * functional reference we held for this reason. */ | ||
| 329 | ENGINE_finish(ctx->engine); | ||
| 330 | #endif | ||
| 331 | memset(ctx,'\0',sizeof *ctx); | ||
| 332 | |||
| 333 | return 1; | ||
| 334 | } | ||
diff --git a/src/lib/libcrypto/evp/e_acss.c b/src/lib/libcrypto/evp/e_acss.c new file mode 100644 index 0000000000..a16b85c627 --- /dev/null +++ b/src/lib/libcrypto/evp/e_acss.c | |||
| @@ -0,0 +1,85 @@ | |||
| 1 | /* $Id: e_acss.c,v 1.2 2004/02/13 10:05:44 hshoexer Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2004 The OpenBSD project | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef OPENSSL_NO_ACSS | ||
| 19 | |||
| 20 | #include "cryptlib.h" | ||
| 21 | #include <openssl/evp.h> | ||
| 22 | #include <openssl/objects.h> | ||
| 23 | #include "evp_locl.h" | ||
| 24 | #include <openssl/acss.h> | ||
| 25 | |||
| 26 | typedef struct { | ||
| 27 | ACSS_KEY ks; | ||
| 28 | } EVP_ACSS_KEY; | ||
| 29 | |||
| 30 | #define data(ctx) EVP_C_DATA(EVP_ACSS_KEY,ctx) | ||
| 31 | |||
| 32 | static int acss_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 33 | const unsigned char *iv, int enc); | ||
| 34 | static int acss_ciph(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 35 | const unsigned char *in, unsigned int inl); | ||
| 36 | static int acss_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); | ||
| 37 | static const EVP_CIPHER acss_cipher = { | ||
| 38 | NID_undef, | ||
| 39 | 1,5,0, | ||
| 40 | 0, | ||
| 41 | acss_init_key, | ||
| 42 | acss_ciph, | ||
| 43 | NULL, | ||
| 44 | sizeof(EVP_ACSS_KEY), | ||
| 45 | NULL, | ||
| 46 | NULL, | ||
| 47 | acss_ctrl, | ||
| 48 | NULL | ||
| 49 | }; | ||
| 50 | |||
| 51 | const | ||
| 52 | EVP_CIPHER *EVP_acss(void) | ||
| 53 | { | ||
| 54 | return(&acss_cipher); | ||
| 55 | } | ||
| 56 | |||
| 57 | static int | ||
| 58 | acss_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 59 | const unsigned char *iv, int enc) | ||
| 60 | { | ||
| 61 | acss_setkey(&data(ctx)->ks,key,enc,ACSS_MODE1); | ||
| 62 | return 1; | ||
| 63 | } | ||
| 64 | |||
| 65 | static int | ||
| 66 | acss_ciph(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, | ||
| 67 | unsigned int inl) | ||
| 68 | { | ||
| 69 | acss(&data(ctx)->ks,inl,in,out); | ||
| 70 | return 1; | ||
| 71 | } | ||
| 72 | |||
| 73 | static int | ||
| 74 | acss_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) | ||
| 75 | { | ||
| 76 | switch(type) { | ||
| 77 | case EVP_CTRL_SET_ACSS_MODE: | ||
| 78 | data(ctx)->ks.mode = arg; | ||
| 79 | return 1; | ||
| 80 | |||
| 81 | default: | ||
| 82 | return -1; | ||
| 83 | } | ||
| 84 | } | ||
| 85 | #endif | ||
diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c new file mode 100644 index 0000000000..bd6c0a3a62 --- /dev/null +++ b/src/lib/libcrypto/evp/e_aes.c | |||
| @@ -0,0 +1,120 @@ | |||
| 1 | /* ==================================================================== | ||
| 2 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. | ||
| 3 | * | ||
| 4 | * Redistribution and use in source and binary forms, with or without | ||
| 5 | * modification, are permitted provided that the following conditions | ||
| 6 | * are met: | ||
| 7 | * | ||
| 8 | * 1. Redistributions of source code must retain the above copyright | ||
| 9 | * notice, this list of conditions and the following disclaimer. | ||
| 10 | * | ||
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in | ||
| 13 | * the documentation and/or other materials provided with the | ||
| 14 | * distribution. | ||
| 15 | * | ||
| 16 | * 3. All advertising materials mentioning features or use of this | ||
| 17 | * software must display the following acknowledgment: | ||
| 18 | * "This product includes software developed by the OpenSSL Project | ||
| 19 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 20 | * | ||
| 21 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 22 | * endorse or promote products derived from this software without | ||
| 23 | * prior written permission. For written permission, please contact | ||
| 24 | * openssl-core@openssl.org. | ||
| 25 | * | ||
| 26 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 27 | * nor may "OpenSSL" appear in their names without prior written | ||
| 28 | * permission of the OpenSSL Project. | ||
| 29 | * | ||
| 30 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 31 | * acknowledgment: | ||
| 32 | * "This product includes software developed by the OpenSSL Project | ||
| 33 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 34 | * | ||
| 35 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 36 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 37 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 38 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 41 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 42 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 43 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 44 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 45 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 46 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 47 | * ==================================================================== | ||
| 48 | * | ||
| 49 | */ | ||
| 50 | |||
| 51 | #include <openssl/opensslconf.h> | ||
| 52 | #ifndef OPENSSL_NO_AES | ||
| 53 | #include <openssl/evp.h> | ||
| 54 | #include <openssl/err.h> | ||
| 55 | #include <string.h> | ||
| 56 | #include <assert.h> | ||
| 57 | #include <openssl/aes.h> | ||
| 58 | #include "evp_locl.h" | ||
| 59 | |||
| 60 | static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 61 | const unsigned char *iv, int enc); | ||
| 62 | |||
| 63 | typedef struct | ||
| 64 | { | ||
| 65 | AES_KEY ks; | ||
| 66 | } EVP_AES_KEY; | ||
| 67 | |||
| 68 | #define data(ctx) EVP_C_DATA(EVP_AES_KEY,ctx) | ||
| 69 | |||
| 70 | IMPLEMENT_BLOCK_CIPHER(aes_128, ks, AES, EVP_AES_KEY, | ||
| 71 | NID_aes_128, 16, 16, 16, 128, | ||
| 72 | 0, aes_init_key, NULL, | ||
| 73 | EVP_CIPHER_set_asn1_iv, | ||
| 74 | EVP_CIPHER_get_asn1_iv, | ||
| 75 | NULL) | ||
| 76 | IMPLEMENT_BLOCK_CIPHER(aes_192, ks, AES, EVP_AES_KEY, | ||
| 77 | NID_aes_192, 16, 24, 16, 128, | ||
| 78 | 0, aes_init_key, NULL, | ||
| 79 | EVP_CIPHER_set_asn1_iv, | ||
| 80 | EVP_CIPHER_get_asn1_iv, | ||
| 81 | NULL) | ||
| 82 | IMPLEMENT_BLOCK_CIPHER(aes_256, ks, AES, EVP_AES_KEY, | ||
| 83 | NID_aes_256, 16, 32, 16, 128, | ||
| 84 | 0, aes_init_key, NULL, | ||
| 85 | EVP_CIPHER_set_asn1_iv, | ||
| 86 | EVP_CIPHER_get_asn1_iv, | ||
| 87 | NULL) | ||
| 88 | |||
| 89 | #define IMPLEMENT_AES_CFBR(ksize,cbits) IMPLEMENT_CFBR(aes,AES,EVP_AES_KEY,ks,ksize,cbits,16) | ||
| 90 | |||
| 91 | IMPLEMENT_AES_CFBR(128,1) | ||
| 92 | IMPLEMENT_AES_CFBR(192,1) | ||
| 93 | IMPLEMENT_AES_CFBR(256,1) | ||
| 94 | |||
| 95 | IMPLEMENT_AES_CFBR(128,8) | ||
| 96 | IMPLEMENT_AES_CFBR(192,8) | ||
| 97 | IMPLEMENT_AES_CFBR(256,8) | ||
| 98 | |||
| 99 | static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 100 | const unsigned char *iv, int enc) | ||
| 101 | { | ||
| 102 | int ret; | ||
| 103 | |||
| 104 | if ((ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_CFB_MODE | ||
| 105 | || (ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_OFB_MODE | ||
| 106 | || enc) | ||
| 107 | ret=AES_set_encrypt_key(key, ctx->key_len * 8, ctx->cipher_data); | ||
| 108 | else | ||
| 109 | ret=AES_set_decrypt_key(key, ctx->key_len * 8, ctx->cipher_data); | ||
| 110 | |||
| 111 | if(ret < 0) | ||
| 112 | { | ||
| 113 | EVPerr(EVP_F_AES_INIT_KEY,EVP_R_AES_KEY_SETUP_FAILED); | ||
| 114 | return 0; | ||
| 115 | } | ||
| 116 | |||
| 117 | return 1; | ||
| 118 | } | ||
| 119 | |||
| 120 | #endif | ||
diff --git a/src/lib/libcrypto/evp/e_bf.c b/src/lib/libcrypto/evp/e_bf.c new file mode 100644 index 0000000000..cc224e5363 --- /dev/null +++ b/src/lib/libcrypto/evp/e_bf.c | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | /* crypto/evp/e_bf.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #ifndef OPENSSL_NO_BF | ||
| 62 | #include <openssl/evp.h> | ||
| 63 | #include "evp_locl.h" | ||
| 64 | #include <openssl/objects.h> | ||
| 65 | #include <openssl/blowfish.h> | ||
| 66 | |||
| 67 | static int bf_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 68 | const unsigned char *iv, int enc); | ||
| 69 | |||
| 70 | typedef struct | ||
| 71 | { | ||
| 72 | BF_KEY ks; | ||
| 73 | } EVP_BF_KEY; | ||
| 74 | |||
| 75 | #define data(ctx) EVP_C_DATA(EVP_BF_KEY,ctx) | ||
| 76 | |||
| 77 | IMPLEMENT_BLOCK_CIPHER(bf, ks, BF, EVP_BF_KEY, NID_bf, 8, 16, 8, 64, | ||
| 78 | EVP_CIPH_VARIABLE_LENGTH, bf_init_key, NULL, | ||
| 79 | EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL) | ||
| 80 | |||
| 81 | static int bf_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 82 | const unsigned char *iv, int enc) | ||
| 83 | { | ||
| 84 | BF_set_key(&data(ctx)->ks,EVP_CIPHER_CTX_key_length(ctx),key); | ||
| 85 | return 1; | ||
| 86 | } | ||
| 87 | |||
| 88 | #endif | ||
diff --git a/src/lib/libcrypto/evp/e_camellia.c b/src/lib/libcrypto/evp/e_camellia.c new file mode 100644 index 0000000000..a7b40d1c60 --- /dev/null +++ b/src/lib/libcrypto/evp/e_camellia.c | |||
| @@ -0,0 +1,131 @@ | |||
| 1 | /* crypto/evp/e_camellia.c -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 2006 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@openssl.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | * This product includes cryptographic software written by Eric Young | ||
| 51 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 52 | * Hudson (tjh@cryptsoft.com). | ||
| 53 | * | ||
| 54 | */ | ||
| 55 | |||
| 56 | #include <openssl/opensslconf.h> | ||
| 57 | #ifndef OPENSSL_NO_CAMELLIA | ||
| 58 | #include <openssl/evp.h> | ||
| 59 | #include <openssl/err.h> | ||
| 60 | #include <string.h> | ||
| 61 | #include <assert.h> | ||
| 62 | #include <openssl/camellia.h> | ||
| 63 | #include "evp_locl.h" | ||
| 64 | |||
| 65 | static int camellia_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 66 | const unsigned char *iv, int enc); | ||
| 67 | |||
| 68 | /* Camellia subkey Structure */ | ||
| 69 | typedef struct | ||
| 70 | { | ||
| 71 | CAMELLIA_KEY ks; | ||
| 72 | } EVP_CAMELLIA_KEY; | ||
| 73 | |||
| 74 | /* Attribute operation for Camellia */ | ||
| 75 | #define data(ctx) EVP_C_DATA(EVP_CAMELLIA_KEY,ctx) | ||
| 76 | |||
| 77 | IMPLEMENT_BLOCK_CIPHER(camellia_128, ks, Camellia, EVP_CAMELLIA_KEY, | ||
| 78 | NID_camellia_128, 16, 16, 16, 128, | ||
| 79 | 0, camellia_init_key, NULL, | ||
| 80 | EVP_CIPHER_set_asn1_iv, | ||
| 81 | EVP_CIPHER_get_asn1_iv, | ||
| 82 | NULL) | ||
| 83 | IMPLEMENT_BLOCK_CIPHER(camellia_192, ks, Camellia, EVP_CAMELLIA_KEY, | ||
| 84 | NID_camellia_192, 16, 24, 16, 128, | ||
| 85 | 0, camellia_init_key, NULL, | ||
| 86 | EVP_CIPHER_set_asn1_iv, | ||
| 87 | EVP_CIPHER_get_asn1_iv, | ||
| 88 | NULL) | ||
| 89 | IMPLEMENT_BLOCK_CIPHER(camellia_256, ks, Camellia, EVP_CAMELLIA_KEY, | ||
| 90 | NID_camellia_256, 16, 32, 16, 128, | ||
| 91 | 0, camellia_init_key, NULL, | ||
| 92 | EVP_CIPHER_set_asn1_iv, | ||
| 93 | EVP_CIPHER_get_asn1_iv, | ||
| 94 | NULL) | ||
| 95 | |||
| 96 | #define IMPLEMENT_CAMELLIA_CFBR(ksize,cbits) IMPLEMENT_CFBR(camellia,Camellia,EVP_CAMELLIA_KEY,ks,ksize,cbits,16) | ||
| 97 | |||
| 98 | IMPLEMENT_CAMELLIA_CFBR(128,1) | ||
| 99 | IMPLEMENT_CAMELLIA_CFBR(192,1) | ||
| 100 | IMPLEMENT_CAMELLIA_CFBR(256,1) | ||
| 101 | |||
| 102 | IMPLEMENT_CAMELLIA_CFBR(128,8) | ||
| 103 | IMPLEMENT_CAMELLIA_CFBR(192,8) | ||
| 104 | IMPLEMENT_CAMELLIA_CFBR(256,8) | ||
| 105 | |||
| 106 | |||
| 107 | |||
| 108 | /* The subkey for Camellia is generated. */ | ||
| 109 | static int camellia_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 110 | const unsigned char *iv, int enc) | ||
| 111 | { | ||
| 112 | int ret; | ||
| 113 | |||
| 114 | ret=Camellia_set_key(key, ctx->key_len * 8, ctx->cipher_data); | ||
| 115 | |||
| 116 | if(ret < 0) | ||
| 117 | { | ||
| 118 | EVPerr(EVP_F_CAMELLIA_INIT_KEY,EVP_R_CAMELLIA_KEY_SETUP_FAILED); | ||
| 119 | return 0; | ||
| 120 | } | ||
| 121 | |||
| 122 | return 1; | ||
| 123 | } | ||
| 124 | |||
| 125 | #else | ||
| 126 | |||
| 127 | # ifdef PEDANTIC | ||
| 128 | static void *dummy=&dummy; | ||
| 129 | # endif | ||
| 130 | |||
| 131 | #endif | ||
diff --git a/src/lib/libcrypto/evp/e_cast.c b/src/lib/libcrypto/evp/e_cast.c new file mode 100644 index 0000000000..d77bcd9298 --- /dev/null +++ b/src/lib/libcrypto/evp/e_cast.c | |||
| @@ -0,0 +1,90 @@ | |||
| 1 | /* crypto/evp/e_cast.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | |||
| 62 | #ifndef OPENSSL_NO_CAST | ||
| 63 | #include <openssl/evp.h> | ||
| 64 | #include <openssl/objects.h> | ||
| 65 | #include "evp_locl.h" | ||
| 66 | #include <openssl/cast.h> | ||
| 67 | |||
| 68 | static int cast_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 69 | const unsigned char *iv,int enc); | ||
| 70 | |||
| 71 | typedef struct | ||
| 72 | { | ||
| 73 | CAST_KEY ks; | ||
| 74 | } EVP_CAST_KEY; | ||
| 75 | |||
| 76 | #define data(ctx) EVP_C_DATA(EVP_CAST_KEY,ctx) | ||
| 77 | |||
| 78 | IMPLEMENT_BLOCK_CIPHER(cast5, ks, CAST, EVP_CAST_KEY, | ||
| 79 | NID_cast5, 8, CAST_KEY_LENGTH, 8, 64, | ||
| 80 | EVP_CIPH_VARIABLE_LENGTH, cast_init_key, NULL, | ||
| 81 | EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL) | ||
| 82 | |||
| 83 | static int cast_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 84 | const unsigned char *iv, int enc) | ||
| 85 | { | ||
| 86 | CAST_set_key(&data(ctx)->ks,EVP_CIPHER_CTX_key_length(ctx),key); | ||
| 87 | return 1; | ||
| 88 | } | ||
| 89 | |||
| 90 | #endif | ||
diff --git a/src/lib/libcrypto/evp/e_des.c b/src/lib/libcrypto/evp/e_des.c new file mode 100644 index 0000000000..856323648c --- /dev/null +++ b/src/lib/libcrypto/evp/e_des.c | |||
| @@ -0,0 +1,176 @@ | |||
| 1 | /* crypto/evp/e_des.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #ifndef OPENSSL_NO_DES | ||
| 62 | #include <openssl/evp.h> | ||
| 63 | #include <openssl/objects.h> | ||
| 64 | #include "evp_locl.h" | ||
| 65 | #include <openssl/des.h> | ||
| 66 | #include <openssl/rand.h> | ||
| 67 | |||
| 68 | static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 69 | const unsigned char *iv, int enc); | ||
| 70 | static int des_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr); | ||
| 71 | |||
| 72 | /* Because of various casts and different names can't use IMPLEMENT_BLOCK_CIPHER */ | ||
| 73 | |||
| 74 | static int des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 75 | const unsigned char *in, unsigned int inl) | ||
| 76 | { | ||
| 77 | BLOCK_CIPHER_ecb_loop() | ||
| 78 | DES_ecb_encrypt((DES_cblock *)(in + i), (DES_cblock *)(out + i), ctx->cipher_data, ctx->encrypt); | ||
| 79 | return 1; | ||
| 80 | } | ||
| 81 | |||
| 82 | static int des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 83 | const unsigned char *in, unsigned int inl) | ||
| 84 | { | ||
| 85 | DES_ofb64_encrypt(in, out, (long)inl, ctx->cipher_data, (DES_cblock *)ctx->iv, &ctx->num); | ||
| 86 | return 1; | ||
| 87 | } | ||
| 88 | |||
| 89 | static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 90 | const unsigned char *in, unsigned int inl) | ||
| 91 | { | ||
| 92 | DES_ncbc_encrypt(in, out, (long)inl, ctx->cipher_data, | ||
| 93 | (DES_cblock *)ctx->iv, ctx->encrypt); | ||
| 94 | return 1; | ||
| 95 | } | ||
| 96 | |||
| 97 | static int des_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 98 | const unsigned char *in, unsigned int inl) | ||
| 99 | { | ||
| 100 | DES_cfb64_encrypt(in, out, (long)inl, ctx->cipher_data, | ||
| 101 | (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt); | ||
| 102 | return 1; | ||
| 103 | } | ||
| 104 | |||
| 105 | /* Although we have a CFB-r implementation for DES, it doesn't pack the right | ||
| 106 | way, so wrap it here */ | ||
| 107 | static int des_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 108 | const unsigned char *in, unsigned int inl) | ||
| 109 | { | ||
| 110 | unsigned int n; | ||
| 111 | unsigned char c[1],d[1]; | ||
| 112 | |||
| 113 | for(n=0 ; n < inl ; ++n) | ||
| 114 | { | ||
| 115 | c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0; | ||
| 116 | DES_cfb_encrypt(c,d,1,1,ctx->cipher_data,(DES_cblock *)ctx->iv, | ||
| 117 | ctx->encrypt); | ||
| 118 | out[n/8]=(out[n/8]&~(0x80 >> (n%8)))|((d[0]&0x80) >> (n%8)); | ||
| 119 | } | ||
| 120 | return 1; | ||
| 121 | } | ||
| 122 | |||
| 123 | static int des_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 124 | const unsigned char *in, unsigned int inl) | ||
| 125 | { | ||
| 126 | DES_cfb_encrypt(in,out,8,inl,ctx->cipher_data,(DES_cblock *)ctx->iv, | ||
| 127 | ctx->encrypt); | ||
| 128 | return 1; | ||
| 129 | } | ||
| 130 | |||
| 131 | BLOCK_CIPHER_defs(des, DES_key_schedule, NID_des, 8, 8, 8, 64, | ||
| 132 | EVP_CIPH_RAND_KEY, des_init_key, NULL, | ||
| 133 | EVP_CIPHER_set_asn1_iv, | ||
| 134 | EVP_CIPHER_get_asn1_iv, | ||
| 135 | des_ctrl) | ||
| 136 | |||
| 137 | BLOCK_CIPHER_def_cfb(des,DES_key_schedule,NID_des,8,8,1, | ||
| 138 | EVP_CIPH_RAND_KEY, des_init_key,NULL, | ||
| 139 | EVP_CIPHER_set_asn1_iv, | ||
| 140 | EVP_CIPHER_get_asn1_iv,des_ctrl) | ||
| 141 | |||
| 142 | BLOCK_CIPHER_def_cfb(des,DES_key_schedule,NID_des,8,8,8, | ||
| 143 | EVP_CIPH_RAND_KEY,des_init_key,NULL, | ||
| 144 | EVP_CIPHER_set_asn1_iv, | ||
| 145 | EVP_CIPHER_get_asn1_iv,des_ctrl) | ||
| 146 | |||
| 147 | static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 148 | const unsigned char *iv, int enc) | ||
| 149 | { | ||
| 150 | DES_cblock *deskey = (DES_cblock *)key; | ||
| 151 | #ifdef EVP_CHECK_DES_KEY | ||
| 152 | if(DES_set_key_checked(deskey,ctx->cipher_data) != 0) | ||
| 153 | return 0; | ||
| 154 | #else | ||
| 155 | DES_set_key_unchecked(deskey,ctx->cipher_data); | ||
| 156 | #endif | ||
| 157 | return 1; | ||
| 158 | } | ||
| 159 | |||
| 160 | static int des_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) | ||
| 161 | { | ||
| 162 | |||
| 163 | switch(type) | ||
| 164 | { | ||
| 165 | case EVP_CTRL_RAND_KEY: | ||
| 166 | if (RAND_bytes(ptr, 8) <= 0) | ||
| 167 | return 0; | ||
| 168 | DES_set_odd_parity((DES_cblock *)ptr); | ||
| 169 | return 1; | ||
| 170 | |||
| 171 | default: | ||
| 172 | return -1; | ||
| 173 | } | ||
| 174 | } | ||
| 175 | |||
| 176 | #endif | ||
diff --git a/src/lib/libcrypto/evp/e_des3.c b/src/lib/libcrypto/evp/e_des3.c new file mode 100644 index 0000000000..ac148efab2 --- /dev/null +++ b/src/lib/libcrypto/evp/e_des3.c | |||
| @@ -0,0 +1,271 @@ | |||
| 1 | /* crypto/evp/e_des3.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #ifndef OPENSSL_NO_DES | ||
| 62 | #include <openssl/evp.h> | ||
| 63 | #include <openssl/objects.h> | ||
| 64 | #include "evp_locl.h" | ||
| 65 | #include <openssl/des.h> | ||
| 66 | #include <openssl/rand.h> | ||
| 67 | |||
| 68 | static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 69 | const unsigned char *iv,int enc); | ||
| 70 | |||
| 71 | static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 72 | const unsigned char *iv,int enc); | ||
| 73 | |||
| 74 | static int des3_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr); | ||
| 75 | |||
| 76 | typedef struct | ||
| 77 | { | ||
| 78 | DES_key_schedule ks1;/* key schedule */ | ||
| 79 | DES_key_schedule ks2;/* key schedule (for ede) */ | ||
| 80 | DES_key_schedule ks3;/* key schedule (for ede3) */ | ||
| 81 | } DES_EDE_KEY; | ||
| 82 | |||
| 83 | #define data(ctx) ((DES_EDE_KEY *)(ctx)->cipher_data) | ||
| 84 | |||
| 85 | /* Because of various casts and different args can't use IMPLEMENT_BLOCK_CIPHER */ | ||
| 86 | |||
| 87 | static int des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 88 | const unsigned char *in, unsigned int inl) | ||
| 89 | { | ||
| 90 | BLOCK_CIPHER_ecb_loop() | ||
| 91 | DES_ecb3_encrypt((const_DES_cblock *)(in + i), | ||
| 92 | (DES_cblock *)(out + i), | ||
| 93 | &data(ctx)->ks1, &data(ctx)->ks2, | ||
| 94 | &data(ctx)->ks3, | ||
| 95 | ctx->encrypt); | ||
| 96 | return 1; | ||
| 97 | } | ||
| 98 | |||
| 99 | static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 100 | const unsigned char *in, unsigned int inl) | ||
| 101 | { | ||
| 102 | DES_ede3_ofb64_encrypt(in, out, (long)inl, | ||
| 103 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, | ||
| 104 | (DES_cblock *)ctx->iv, &ctx->num); | ||
| 105 | return 1; | ||
| 106 | } | ||
| 107 | |||
| 108 | static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 109 | const unsigned char *in, unsigned int inl) | ||
| 110 | { | ||
| 111 | #ifdef KSSL_DEBUG | ||
| 112 | { | ||
| 113 | int i; | ||
| 114 | char *cp; | ||
| 115 | printf("des_ede_cbc_cipher(ctx=%lx, buflen=%d)\n", ctx, ctx->buf_len); | ||
| 116 | printf("\t iv= "); | ||
| 117 | for(i=0;i<8;i++) | ||
| 118 | printf("%02X",ctx->iv[i]); | ||
| 119 | printf("\n"); | ||
| 120 | } | ||
| 121 | #endif /* KSSL_DEBUG */ | ||
| 122 | DES_ede3_cbc_encrypt(in, out, (long)inl, | ||
| 123 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, | ||
| 124 | (DES_cblock *)ctx->iv, ctx->encrypt); | ||
| 125 | return 1; | ||
| 126 | } | ||
| 127 | |||
| 128 | static int des_ede_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 129 | const unsigned char *in, unsigned int inl) | ||
| 130 | { | ||
| 131 | DES_ede3_cfb64_encrypt(in, out, (long)inl, | ||
| 132 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, | ||
| 133 | (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt); | ||
| 134 | return 1; | ||
| 135 | } | ||
| 136 | |||
| 137 | /* Although we have a CFB-r implementation for 3-DES, it doesn't pack the right | ||
| 138 | way, so wrap it here */ | ||
| 139 | static int des_ede3_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 140 | const unsigned char *in, unsigned int inl) | ||
| 141 | { | ||
| 142 | unsigned int n; | ||
| 143 | unsigned char c[1],d[1]; | ||
| 144 | |||
| 145 | for(n=0 ; n < inl ; ++n) | ||
| 146 | { | ||
| 147 | c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0; | ||
| 148 | DES_ede3_cfb_encrypt(c,d,1,1, | ||
| 149 | &data(ctx)->ks1,&data(ctx)->ks2,&data(ctx)->ks3, | ||
| 150 | (DES_cblock *)ctx->iv,ctx->encrypt); | ||
| 151 | out[n/8]=(out[n/8]&~(0x80 >> (n%8)))|((d[0]&0x80) >> (n%8)); | ||
| 152 | } | ||
| 153 | |||
| 154 | return 1; | ||
| 155 | } | ||
| 156 | |||
| 157 | static int des_ede3_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 158 | const unsigned char *in, unsigned int inl) | ||
| 159 | { | ||
| 160 | DES_ede3_cfb_encrypt(in,out,8,inl, | ||
| 161 | &data(ctx)->ks1,&data(ctx)->ks2,&data(ctx)->ks3, | ||
| 162 | (DES_cblock *)ctx->iv,ctx->encrypt); | ||
| 163 | return 1; | ||
| 164 | } | ||
| 165 | |||
| 166 | BLOCK_CIPHER_defs(des_ede, DES_EDE_KEY, NID_des_ede, 8, 16, 8, 64, | ||
| 167 | EVP_CIPH_RAND_KEY, des_ede_init_key, NULL, | ||
| 168 | EVP_CIPHER_set_asn1_iv, | ||
| 169 | EVP_CIPHER_get_asn1_iv, | ||
| 170 | des3_ctrl) | ||
| 171 | |||
| 172 | #define des_ede3_cfb64_cipher des_ede_cfb64_cipher | ||
| 173 | #define des_ede3_ofb_cipher des_ede_ofb_cipher | ||
| 174 | #define des_ede3_cbc_cipher des_ede_cbc_cipher | ||
| 175 | #define des_ede3_ecb_cipher des_ede_ecb_cipher | ||
| 176 | |||
| 177 | BLOCK_CIPHER_defs(des_ede3, DES_EDE_KEY, NID_des_ede3, 8, 24, 8, 64, | ||
| 178 | EVP_CIPH_RAND_KEY, des_ede3_init_key, NULL, | ||
| 179 | EVP_CIPHER_set_asn1_iv, | ||
| 180 | EVP_CIPHER_get_asn1_iv, | ||
| 181 | des3_ctrl) | ||
| 182 | |||
| 183 | BLOCK_CIPHER_def_cfb(des_ede3,DES_EDE_KEY,NID_des_ede3,24,8,1, | ||
| 184 | EVP_CIPH_RAND_KEY, des_ede3_init_key,NULL, | ||
| 185 | EVP_CIPHER_set_asn1_iv, | ||
| 186 | EVP_CIPHER_get_asn1_iv, | ||
| 187 | des3_ctrl) | ||
| 188 | |||
| 189 | BLOCK_CIPHER_def_cfb(des_ede3,DES_EDE_KEY,NID_des_ede3,24,8,8, | ||
| 190 | EVP_CIPH_RAND_KEY, des_ede3_init_key,NULL, | ||
| 191 | EVP_CIPHER_set_asn1_iv, | ||
| 192 | EVP_CIPHER_get_asn1_iv, | ||
| 193 | des3_ctrl) | ||
| 194 | |||
| 195 | static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 196 | const unsigned char *iv, int enc) | ||
| 197 | { | ||
| 198 | DES_cblock *deskey = (DES_cblock *)key; | ||
| 199 | #ifdef EVP_CHECK_DES_KEY | ||
| 200 | if (DES_set_key_checked(&deskey[0],&data(ctx)->ks1) | ||
| 201 | !! DES_set_key_checked(&deskey[1],&data(ctx)->ks2)) | ||
| 202 | return 0; | ||
| 203 | #else | ||
| 204 | DES_set_key_unchecked(&deskey[0],&data(ctx)->ks1); | ||
| 205 | DES_set_key_unchecked(&deskey[1],&data(ctx)->ks2); | ||
| 206 | #endif | ||
| 207 | memcpy(&data(ctx)->ks3,&data(ctx)->ks1, | ||
| 208 | sizeof(data(ctx)->ks1)); | ||
| 209 | return 1; | ||
| 210 | } | ||
| 211 | |||
| 212 | static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 213 | const unsigned char *iv, int enc) | ||
| 214 | { | ||
| 215 | DES_cblock *deskey = (DES_cblock *)key; | ||
| 216 | #ifdef KSSL_DEBUG | ||
| 217 | { | ||
| 218 | int i; | ||
| 219 | printf("des_ede3_init_key(ctx=%lx)\n", ctx); | ||
| 220 | printf("\tKEY= "); | ||
| 221 | for(i=0;i<24;i++) printf("%02X",key[i]); printf("\n"); | ||
| 222 | printf("\t IV= "); | ||
| 223 | for(i=0;i<8;i++) printf("%02X",iv[i]); printf("\n"); | ||
| 224 | } | ||
| 225 | #endif /* KSSL_DEBUG */ | ||
| 226 | |||
| 227 | #ifdef EVP_CHECK_DES_KEY | ||
| 228 | if (DES_set_key_checked(&deskey[0],&data(ctx)->ks1) | ||
| 229 | || DES_set_key_checked(&deskey[1],&data(ctx)->ks2) | ||
| 230 | || DES_set_key_checked(&deskey[2],&data(ctx)->ks3)) | ||
| 231 | return 0; | ||
| 232 | #else | ||
| 233 | DES_set_key_unchecked(&deskey[0],&data(ctx)->ks1); | ||
| 234 | DES_set_key_unchecked(&deskey[1],&data(ctx)->ks2); | ||
| 235 | DES_set_key_unchecked(&deskey[2],&data(ctx)->ks3); | ||
| 236 | #endif | ||
| 237 | return 1; | ||
| 238 | } | ||
| 239 | |||
| 240 | static int des3_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) | ||
| 241 | { | ||
| 242 | |||
| 243 | DES_cblock *deskey = ptr; | ||
| 244 | |||
| 245 | switch(type) | ||
| 246 | { | ||
| 247 | case EVP_CTRL_RAND_KEY: | ||
| 248 | if (RAND_bytes(ptr, c->key_len) <= 0) | ||
| 249 | return 0; | ||
| 250 | DES_set_odd_parity(deskey); | ||
| 251 | if (c->key_len >= 16) | ||
| 252 | DES_set_odd_parity(deskey + 1); | ||
| 253 | if (c->key_len >= 24) | ||
| 254 | DES_set_odd_parity(deskey + 2); | ||
| 255 | return 1; | ||
| 256 | |||
| 257 | default: | ||
| 258 | return -1; | ||
| 259 | } | ||
| 260 | } | ||
| 261 | |||
| 262 | const EVP_CIPHER *EVP_des_ede(void) | ||
| 263 | { | ||
| 264 | return &des_ede_ecb; | ||
| 265 | } | ||
| 266 | |||
| 267 | const EVP_CIPHER *EVP_des_ede3(void) | ||
| 268 | { | ||
| 269 | return &des_ede3_ecb; | ||
| 270 | } | ||
| 271 | #endif | ||
diff --git a/src/lib/libcrypto/evp/e_idea.c b/src/lib/libcrypto/evp/e_idea.c new file mode 100644 index 0000000000..48c33a774a --- /dev/null +++ b/src/lib/libcrypto/evp/e_idea.c | |||
| @@ -0,0 +1,118 @@ | |||
| 1 | /* crypto/evp/e_idea.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | |||
| 62 | #ifndef OPENSSL_NO_IDEA | ||
| 63 | #include <openssl/evp.h> | ||
| 64 | #include <openssl/objects.h> | ||
| 65 | #include "evp_locl.h" | ||
| 66 | #include <openssl/idea.h> | ||
| 67 | |||
| 68 | static int idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 69 | const unsigned char *iv,int enc); | ||
| 70 | |||
| 71 | /* NB idea_ecb_encrypt doesn't take an 'encrypt' argument so we treat it as a special | ||
| 72 | * case | ||
| 73 | */ | ||
| 74 | |||
| 75 | static int idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 76 | const unsigned char *in, unsigned int inl) | ||
| 77 | { | ||
| 78 | BLOCK_CIPHER_ecb_loop() | ||
| 79 | idea_ecb_encrypt(in + i, out + i, ctx->cipher_data); | ||
| 80 | return 1; | ||
| 81 | } | ||
| 82 | |||
| 83 | /* Can't use IMPLEMENT_BLOCK_CIPHER because idea_ecb_encrypt is different */ | ||
| 84 | |||
| 85 | typedef struct | ||
| 86 | { | ||
| 87 | IDEA_KEY_SCHEDULE ks; | ||
| 88 | } EVP_IDEA_KEY; | ||
| 89 | |||
| 90 | BLOCK_CIPHER_func_cbc(idea, idea, EVP_IDEA_KEY, ks) | ||
| 91 | BLOCK_CIPHER_func_ofb(idea, idea, 64, EVP_IDEA_KEY, ks) | ||
| 92 | BLOCK_CIPHER_func_cfb(idea, idea, 64, EVP_IDEA_KEY, ks) | ||
| 93 | |||
| 94 | BLOCK_CIPHER_defs(idea, IDEA_KEY_SCHEDULE, NID_idea, 8, 16, 8, 64, | ||
| 95 | 0, idea_init_key, NULL, | ||
| 96 | EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL) | ||
| 97 | |||
| 98 | static int idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 99 | const unsigned char *iv, int enc) | ||
| 100 | { | ||
| 101 | if(!enc) { | ||
| 102 | if (EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_OFB_MODE) enc = 1; | ||
| 103 | else if (EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_CFB_MODE) enc = 1; | ||
| 104 | } | ||
| 105 | if (enc) idea_set_encrypt_key(key,ctx->cipher_data); | ||
| 106 | else | ||
| 107 | { | ||
| 108 | IDEA_KEY_SCHEDULE tmp; | ||
| 109 | |||
| 110 | idea_set_encrypt_key(key,&tmp); | ||
| 111 | idea_set_decrypt_key(&tmp,ctx->cipher_data); | ||
| 112 | OPENSSL_cleanse((unsigned char *)&tmp, | ||
| 113 | sizeof(IDEA_KEY_SCHEDULE)); | ||
| 114 | } | ||
| 115 | return 1; | ||
| 116 | } | ||
| 117 | |||
| 118 | #endif | ||
diff --git a/src/lib/libcrypto/evp/e_null.c b/src/lib/libcrypto/evp/e_null.c new file mode 100644 index 0000000000..5205259f18 --- /dev/null +++ b/src/lib/libcrypto/evp/e_null.c | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | /* crypto/evp/e_null.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/evp.h> | ||
| 62 | #include <openssl/objects.h> | ||
| 63 | |||
| 64 | static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 65 | const unsigned char *iv,int enc); | ||
| 66 | static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 67 | const unsigned char *in, unsigned int inl); | ||
| 68 | static const EVP_CIPHER n_cipher= | ||
| 69 | { | ||
| 70 | NID_undef, | ||
| 71 | 1,0,0, | ||
| 72 | 0, | ||
| 73 | null_init_key, | ||
| 74 | null_cipher, | ||
| 75 | NULL, | ||
| 76 | 0, | ||
| 77 | NULL, | ||
| 78 | NULL, | ||
| 79 | NULL, | ||
| 80 | NULL | ||
| 81 | }; | ||
| 82 | |||
| 83 | const EVP_CIPHER *EVP_enc_null(void) | ||
| 84 | { | ||
| 85 | return(&n_cipher); | ||
| 86 | } | ||
| 87 | |||
| 88 | static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 89 | const unsigned char *iv, int enc) | ||
| 90 | { | ||
| 91 | /* memset(&(ctx->c),0,sizeof(ctx->c));*/ | ||
| 92 | return 1; | ||
| 93 | } | ||
| 94 | |||
| 95 | static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 96 | const unsigned char *in, unsigned int inl) | ||
| 97 | { | ||
| 98 | if (in != out) | ||
| 99 | memcpy((char *)out,(const char *)in,(size_t)inl); | ||
| 100 | return 1; | ||
| 101 | } | ||
| 102 | |||
diff --git a/src/lib/libcrypto/evp/e_old.c b/src/lib/libcrypto/evp/e_old.c new file mode 100644 index 0000000000..1642af4869 --- /dev/null +++ b/src/lib/libcrypto/evp/e_old.c | |||
| @@ -0,0 +1,125 @@ | |||
| 1 | /* crypto/evp/e_old.c -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | ||
| 3 | * project 2004. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2004 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * openssl-core@openssl.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #ifdef OPENSSL_NO_DEPRECATED | ||
| 60 | static void *dummy = &dummy; | ||
| 61 | #else | ||
| 62 | |||
| 63 | #include <openssl/evp.h> | ||
| 64 | |||
| 65 | /* Define some deprecated functions, so older programs | ||
| 66 | don't crash and burn too quickly. On Windows and VMS, | ||
| 67 | these will never be used, since functions and variables | ||
| 68 | in shared libraries are selected by entry point location, | ||
| 69 | not by name. */ | ||
| 70 | |||
| 71 | #ifndef OPENSSL_NO_BF | ||
| 72 | #undef EVP_bf_cfb | ||
| 73 | const EVP_CIPHER *EVP_bf_cfb(void); | ||
| 74 | const EVP_CIPHER *EVP_bf_cfb(void) { return EVP_bf_cfb64(); } | ||
| 75 | #endif | ||
| 76 | |||
| 77 | #ifndef OPENSSL_NO_DES | ||
| 78 | #undef EVP_des_cfb | ||
| 79 | const EVP_CIPHER *EVP_des_cfb(void); | ||
| 80 | const EVP_CIPHER *EVP_des_cfb(void) { return EVP_des_cfb64(); } | ||
| 81 | #undef EVP_des_ede3_cfb | ||
| 82 | const EVP_CIPHER *EVP_des_ede3_cfb(void); | ||
| 83 | const EVP_CIPHER *EVP_des_ede3_cfb(void) { return EVP_des_ede3_cfb64(); } | ||
| 84 | #undef EVP_des_ede_cfb | ||
| 85 | const EVP_CIPHER *EVP_des_ede_cfb(void); | ||
| 86 | const EVP_CIPHER *EVP_des_ede_cfb(void) { return EVP_des_ede_cfb64(); } | ||
| 87 | #endif | ||
| 88 | |||
| 89 | #ifndef OPENSSL_NO_IDEA | ||
| 90 | #undef EVP_idea_cfb | ||
| 91 | const EVP_CIPHER *EVP_idea_cfb(void); | ||
| 92 | const EVP_CIPHER *EVP_idea_cfb(void) { return EVP_idea_cfb64(); } | ||
| 93 | #endif | ||
| 94 | |||
| 95 | #ifndef OPENSSL_NO_RC2 | ||
| 96 | #undef EVP_rc2_cfb | ||
| 97 | const EVP_CIPHER *EVP_rc2_cfb(void); | ||
| 98 | const EVP_CIPHER *EVP_rc2_cfb(void) { return EVP_rc2_cfb64(); } | ||
| 99 | #endif | ||
| 100 | |||
| 101 | #ifndef OPENSSL_NO_CAST | ||
| 102 | #undef EVP_cast5_cfb | ||
| 103 | const EVP_CIPHER *EVP_cast5_cfb(void); | ||
| 104 | const EVP_CIPHER *EVP_cast5_cfb(void) { return EVP_cast5_cfb64(); } | ||
| 105 | #endif | ||
| 106 | |||
| 107 | #ifndef OPENSSL_NO_RC5 | ||
| 108 | #undef EVP_rc5_32_12_16_cfb | ||
| 109 | const EVP_CIPHER *EVP_rc5_32_12_16_cfb(void); | ||
| 110 | const EVP_CIPHER *EVP_rc5_32_12_16_cfb(void) { return EVP_rc5_32_12_16_cfb64(); } | ||
| 111 | #endif | ||
| 112 | |||
| 113 | #ifndef OPENSSL_NO_AES | ||
| 114 | #undef EVP_aes_128_cfb | ||
| 115 | const EVP_CIPHER *EVP_aes_128_cfb(void); | ||
| 116 | const EVP_CIPHER *EVP_aes_128_cfb(void) { return EVP_aes_128_cfb128(); } | ||
| 117 | #undef EVP_aes_192_cfb | ||
| 118 | const EVP_CIPHER *EVP_aes_192_cfb(void); | ||
| 119 | const EVP_CIPHER *EVP_aes_192_cfb(void) { return EVP_aes_192_cfb128(); } | ||
| 120 | #undef EVP_aes_256_cfb | ||
| 121 | const EVP_CIPHER *EVP_aes_256_cfb(void); | ||
| 122 | const EVP_CIPHER *EVP_aes_256_cfb(void) { return EVP_aes_256_cfb128(); } | ||
| 123 | #endif | ||
| 124 | |||
| 125 | #endif | ||
diff --git a/src/lib/libcrypto/evp/e_rc2.c b/src/lib/libcrypto/evp/e_rc2.c new file mode 100644 index 0000000000..d37726ffae --- /dev/null +++ b/src/lib/libcrypto/evp/e_rc2.c | |||
| @@ -0,0 +1,232 @@ | |||
| 1 | /* crypto/evp/e_rc2.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | |||
| 62 | #ifndef OPENSSL_NO_RC2 | ||
| 63 | |||
| 64 | #include <openssl/evp.h> | ||
| 65 | #include <openssl/objects.h> | ||
| 66 | #include "evp_locl.h" | ||
| 67 | #include <openssl/rc2.h> | ||
| 68 | |||
| 69 | static int rc2_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 70 | const unsigned char *iv,int enc); | ||
| 71 | static int rc2_meth_to_magic(EVP_CIPHER_CTX *ctx); | ||
| 72 | static int rc2_magic_to_meth(int i); | ||
| 73 | static int rc2_set_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | ||
| 74 | static int rc2_get_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | ||
| 75 | static int rc2_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr); | ||
| 76 | |||
| 77 | typedef struct | ||
| 78 | { | ||
| 79 | int key_bits; /* effective key bits */ | ||
| 80 | RC2_KEY ks; /* key schedule */ | ||
| 81 | } EVP_RC2_KEY; | ||
| 82 | |||
| 83 | #define data(ctx) ((EVP_RC2_KEY *)(ctx)->cipher_data) | ||
| 84 | |||
| 85 | IMPLEMENT_BLOCK_CIPHER(rc2, ks, RC2, EVP_RC2_KEY, NID_rc2, | ||
| 86 | 8, | ||
| 87 | RC2_KEY_LENGTH, 8, 64, | ||
| 88 | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT, | ||
| 89 | rc2_init_key, NULL, | ||
| 90 | rc2_set_asn1_type_and_iv, rc2_get_asn1_type_and_iv, | ||
| 91 | rc2_ctrl) | ||
| 92 | |||
| 93 | #define RC2_40_MAGIC 0xa0 | ||
| 94 | #define RC2_64_MAGIC 0x78 | ||
| 95 | #define RC2_128_MAGIC 0x3a | ||
| 96 | |||
| 97 | static const EVP_CIPHER r2_64_cbc_cipher= | ||
| 98 | { | ||
| 99 | NID_rc2_64_cbc, | ||
| 100 | 8,8 /* 64 bit */,8, | ||
| 101 | EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT, | ||
| 102 | rc2_init_key, | ||
| 103 | rc2_cbc_cipher, | ||
| 104 | NULL, | ||
| 105 | sizeof(EVP_RC2_KEY), | ||
| 106 | rc2_set_asn1_type_and_iv, | ||
| 107 | rc2_get_asn1_type_and_iv, | ||
| 108 | rc2_ctrl, | ||
| 109 | NULL | ||
| 110 | }; | ||
| 111 | |||
| 112 | static const EVP_CIPHER r2_40_cbc_cipher= | ||
| 113 | { | ||
| 114 | NID_rc2_40_cbc, | ||
| 115 | 8,5 /* 40 bit */,8, | ||
| 116 | EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT, | ||
| 117 | rc2_init_key, | ||
| 118 | rc2_cbc_cipher, | ||
| 119 | NULL, | ||
| 120 | sizeof(EVP_RC2_KEY), | ||
| 121 | rc2_set_asn1_type_and_iv, | ||
| 122 | rc2_get_asn1_type_and_iv, | ||
| 123 | rc2_ctrl, | ||
| 124 | NULL | ||
| 125 | }; | ||
| 126 | |||
| 127 | const EVP_CIPHER *EVP_rc2_64_cbc(void) | ||
| 128 | { | ||
| 129 | return(&r2_64_cbc_cipher); | ||
| 130 | } | ||
| 131 | |||
| 132 | const EVP_CIPHER *EVP_rc2_40_cbc(void) | ||
| 133 | { | ||
| 134 | return(&r2_40_cbc_cipher); | ||
| 135 | } | ||
| 136 | |||
| 137 | static int rc2_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 138 | const unsigned char *iv, int enc) | ||
| 139 | { | ||
| 140 | RC2_set_key(&data(ctx)->ks,EVP_CIPHER_CTX_key_length(ctx), | ||
| 141 | key,data(ctx)->key_bits); | ||
| 142 | return 1; | ||
| 143 | } | ||
| 144 | |||
| 145 | static int rc2_meth_to_magic(EVP_CIPHER_CTX *e) | ||
| 146 | { | ||
| 147 | int i; | ||
| 148 | |||
| 149 | EVP_CIPHER_CTX_ctrl(e, EVP_CTRL_GET_RC2_KEY_BITS, 0, &i); | ||
| 150 | if (i == 128) return(RC2_128_MAGIC); | ||
| 151 | else if (i == 64) return(RC2_64_MAGIC); | ||
| 152 | else if (i == 40) return(RC2_40_MAGIC); | ||
| 153 | else return(0); | ||
| 154 | } | ||
| 155 | |||
| 156 | static int rc2_magic_to_meth(int i) | ||
| 157 | { | ||
| 158 | if (i == RC2_128_MAGIC) return 128; | ||
| 159 | else if (i == RC2_64_MAGIC) return 64; | ||
| 160 | else if (i == RC2_40_MAGIC) return 40; | ||
| 161 | else | ||
| 162 | { | ||
| 163 | EVPerr(EVP_F_RC2_MAGIC_TO_METH,EVP_R_UNSUPPORTED_KEY_SIZE); | ||
| 164 | return(0); | ||
| 165 | } | ||
| 166 | } | ||
| 167 | |||
| 168 | static int rc2_get_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) | ||
| 169 | { | ||
| 170 | long num=0; | ||
| 171 | int i=0; | ||
| 172 | int key_bits; | ||
| 173 | unsigned int l; | ||
| 174 | unsigned char iv[EVP_MAX_IV_LENGTH]; | ||
| 175 | |||
| 176 | if (type != NULL) | ||
| 177 | { | ||
| 178 | l=EVP_CIPHER_CTX_iv_length(c); | ||
| 179 | OPENSSL_assert(l <= sizeof(iv)); | ||
| 180 | i=ASN1_TYPE_get_int_octetstring(type,&num,iv,l); | ||
| 181 | if (i != (int)l) | ||
| 182 | return(-1); | ||
| 183 | key_bits =rc2_magic_to_meth((int)num); | ||
| 184 | if (!key_bits) | ||
| 185 | return(-1); | ||
| 186 | if(i > 0) EVP_CipherInit_ex(c, NULL, NULL, NULL, iv, -1); | ||
| 187 | EVP_CIPHER_CTX_ctrl(c, EVP_CTRL_SET_RC2_KEY_BITS, key_bits, NULL); | ||
| 188 | EVP_CIPHER_CTX_set_key_length(c, key_bits / 8); | ||
| 189 | } | ||
| 190 | return(i); | ||
| 191 | } | ||
| 192 | |||
| 193 | static int rc2_set_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) | ||
| 194 | { | ||
| 195 | long num; | ||
| 196 | int i=0,j; | ||
| 197 | |||
| 198 | if (type != NULL) | ||
| 199 | { | ||
| 200 | num=rc2_meth_to_magic(c); | ||
| 201 | j=EVP_CIPHER_CTX_iv_length(c); | ||
| 202 | i=ASN1_TYPE_set_int_octetstring(type,num,c->oiv,j); | ||
| 203 | } | ||
| 204 | return(i); | ||
| 205 | } | ||
| 206 | |||
| 207 | static int rc2_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) | ||
| 208 | { | ||
| 209 | switch(type) | ||
| 210 | { | ||
| 211 | case EVP_CTRL_INIT: | ||
| 212 | data(c)->key_bits = EVP_CIPHER_CTX_key_length(c) * 8; | ||
| 213 | return 1; | ||
| 214 | |||
| 215 | case EVP_CTRL_GET_RC2_KEY_BITS: | ||
| 216 | *(int *)ptr = data(c)->key_bits; | ||
| 217 | return 1; | ||
| 218 | |||
| 219 | case EVP_CTRL_SET_RC2_KEY_BITS: | ||
| 220 | if(arg > 0) | ||
| 221 | { | ||
| 222 | data(c)->key_bits = arg; | ||
| 223 | return 1; | ||
| 224 | } | ||
| 225 | return 0; | ||
| 226 | |||
| 227 | default: | ||
| 228 | return -1; | ||
| 229 | } | ||
| 230 | } | ||
| 231 | |||
| 232 | #endif | ||
diff --git a/src/lib/libcrypto/evp/e_rc4.c b/src/lib/libcrypto/evp/e_rc4.c new file mode 100644 index 0000000000..67af850bea --- /dev/null +++ b/src/lib/libcrypto/evp/e_rc4.c | |||
| @@ -0,0 +1,136 @@ | |||
| 1 | /* crypto/evp/e_rc4.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | |||
| 62 | #ifndef OPENSSL_NO_RC4 | ||
| 63 | |||
| 64 | #include <openssl/evp.h> | ||
| 65 | #include <openssl/objects.h> | ||
| 66 | #include <openssl/rc4.h> | ||
| 67 | |||
| 68 | /* FIXME: surely this is available elsewhere? */ | ||
| 69 | #define EVP_RC4_KEY_SIZE 16 | ||
| 70 | |||
| 71 | typedef struct | ||
| 72 | { | ||
| 73 | RC4_KEY ks; /* working key */ | ||
| 74 | } EVP_RC4_KEY; | ||
| 75 | |||
| 76 | #define data(ctx) ((EVP_RC4_KEY *)(ctx)->cipher_data) | ||
| 77 | |||
| 78 | static int rc4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 79 | const unsigned char *iv,int enc); | ||
| 80 | static int rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 81 | const unsigned char *in, unsigned int inl); | ||
| 82 | static const EVP_CIPHER r4_cipher= | ||
| 83 | { | ||
| 84 | NID_rc4, | ||
| 85 | 1,EVP_RC4_KEY_SIZE,0, | ||
| 86 | EVP_CIPH_VARIABLE_LENGTH, | ||
| 87 | rc4_init_key, | ||
| 88 | rc4_cipher, | ||
| 89 | NULL, | ||
| 90 | sizeof(EVP_RC4_KEY), | ||
| 91 | NULL, | ||
| 92 | NULL, | ||
| 93 | NULL, | ||
| 94 | NULL | ||
| 95 | }; | ||
| 96 | |||
| 97 | static const EVP_CIPHER r4_40_cipher= | ||
| 98 | { | ||
| 99 | NID_rc4_40, | ||
| 100 | 1,5 /* 40 bit */,0, | ||
| 101 | EVP_CIPH_VARIABLE_LENGTH, | ||
| 102 | rc4_init_key, | ||
| 103 | rc4_cipher, | ||
| 104 | NULL, | ||
| 105 | sizeof(EVP_RC4_KEY), | ||
| 106 | NULL, | ||
| 107 | NULL, | ||
| 108 | NULL, | ||
| 109 | NULL | ||
| 110 | }; | ||
| 111 | |||
| 112 | const EVP_CIPHER *EVP_rc4(void) | ||
| 113 | { | ||
| 114 | return(&r4_cipher); | ||
| 115 | } | ||
| 116 | |||
| 117 | const EVP_CIPHER *EVP_rc4_40(void) | ||
| 118 | { | ||
| 119 | return(&r4_40_cipher); | ||
| 120 | } | ||
| 121 | |||
| 122 | static int rc4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 123 | const unsigned char *iv, int enc) | ||
| 124 | { | ||
| 125 | RC4_set_key(&data(ctx)->ks,EVP_CIPHER_CTX_key_length(ctx), | ||
| 126 | key); | ||
| 127 | return 1; | ||
| 128 | } | ||
| 129 | |||
| 130 | static int rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 131 | const unsigned char *in, unsigned int inl) | ||
| 132 | { | ||
| 133 | RC4(&data(ctx)->ks,inl,in,out); | ||
| 134 | return 1; | ||
| 135 | } | ||
| 136 | #endif | ||
diff --git a/src/lib/libcrypto/evp/e_seed.c b/src/lib/libcrypto/evp/e_seed.c new file mode 100644 index 0000000000..8c1ec0d43a --- /dev/null +++ b/src/lib/libcrypto/evp/e_seed.c | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | /* crypto/evp/e_seed.c -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 2007 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@openssl.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | * This product includes cryptographic software written by Eric Young | ||
| 51 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 52 | * Hudson (tjh@cryptsoft.com). | ||
| 53 | * | ||
| 54 | */ | ||
| 55 | |||
| 56 | #include <openssl/opensslconf.h> | ||
| 57 | #include <openssl/evp.h> | ||
| 58 | #include <openssl/err.h> | ||
| 59 | #include <string.h> | ||
| 60 | #include <assert.h> | ||
| 61 | #ifndef OPENSSL_NO_SEED | ||
| 62 | #include <openssl/seed.h> | ||
| 63 | #include "evp_locl.h" | ||
| 64 | |||
| 65 | static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc); | ||
| 66 | |||
| 67 | typedef struct | ||
| 68 | { | ||
| 69 | SEED_KEY_SCHEDULE ks; | ||
| 70 | } EVP_SEED_KEY; | ||
| 71 | |||
| 72 | IMPLEMENT_BLOCK_CIPHER(seed, ks, SEED, EVP_SEED_KEY, NID_seed, | ||
| 73 | 16, 16, 16, 128, | ||
| 74 | 0, seed_init_key, 0, 0, 0, 0) | ||
| 75 | |||
| 76 | static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 77 | const unsigned char *iv, int enc) | ||
| 78 | { | ||
| 79 | SEED_set_key(key, ctx->cipher_data); | ||
| 80 | return 1; | ||
| 81 | } | ||
| 82 | |||
| 83 | #endif | ||
diff --git a/src/lib/libcrypto/evp/e_xcbc_d.c b/src/lib/libcrypto/evp/e_xcbc_d.c new file mode 100644 index 0000000000..8832da2433 --- /dev/null +++ b/src/lib/libcrypto/evp/e_xcbc_d.c | |||
| @@ -0,0 +1,125 @@ | |||
| 1 | /* crypto/evp/e_xcbc_d.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | |||
| 62 | #ifndef OPENSSL_NO_DES | ||
| 63 | |||
| 64 | #include <openssl/evp.h> | ||
| 65 | #include <openssl/objects.h> | ||
| 66 | #include <openssl/des.h> | ||
| 67 | |||
| 68 | static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 69 | const unsigned char *iv,int enc); | ||
| 70 | static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 71 | const unsigned char *in, unsigned int inl); | ||
| 72 | |||
| 73 | |||
| 74 | typedef struct | ||
| 75 | { | ||
| 76 | DES_key_schedule ks;/* key schedule */ | ||
| 77 | DES_cblock inw; | ||
| 78 | DES_cblock outw; | ||
| 79 | } DESX_CBC_KEY; | ||
| 80 | |||
| 81 | #define data(ctx) ((DESX_CBC_KEY *)(ctx)->cipher_data) | ||
| 82 | |||
| 83 | static const EVP_CIPHER d_xcbc_cipher= | ||
| 84 | { | ||
| 85 | NID_desx_cbc, | ||
| 86 | 8,24,8, | ||
| 87 | EVP_CIPH_CBC_MODE, | ||
| 88 | desx_cbc_init_key, | ||
| 89 | desx_cbc_cipher, | ||
| 90 | NULL, | ||
| 91 | sizeof(DESX_CBC_KEY), | ||
| 92 | EVP_CIPHER_set_asn1_iv, | ||
| 93 | EVP_CIPHER_get_asn1_iv, | ||
| 94 | NULL, | ||
| 95 | NULL | ||
| 96 | }; | ||
| 97 | |||
| 98 | const EVP_CIPHER *EVP_desx_cbc(void) | ||
| 99 | { | ||
| 100 | return(&d_xcbc_cipher); | ||
| 101 | } | ||
| 102 | |||
| 103 | static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 104 | const unsigned char *iv, int enc) | ||
| 105 | { | ||
| 106 | DES_cblock *deskey = (DES_cblock *)key; | ||
| 107 | |||
| 108 | DES_set_key_unchecked(deskey,&data(ctx)->ks); | ||
| 109 | memcpy(&data(ctx)->inw[0],&key[8],8); | ||
| 110 | memcpy(&data(ctx)->outw[0],&key[16],8); | ||
| 111 | |||
| 112 | return 1; | ||
| 113 | } | ||
| 114 | |||
| 115 | static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 116 | const unsigned char *in, unsigned int inl) | ||
| 117 | { | ||
| 118 | DES_xcbc_encrypt(in,out,inl,&data(ctx)->ks, | ||
| 119 | (DES_cblock *)&(ctx->iv[0]), | ||
| 120 | &data(ctx)->inw, | ||
| 121 | &data(ctx)->outw, | ||
| 122 | ctx->encrypt); | ||
| 123 | return 1; | ||
| 124 | } | ||
| 125 | #endif | ||
diff --git a/src/lib/libcrypto/evp/encode.c b/src/lib/libcrypto/evp/encode.c new file mode 100644 index 0000000000..5921f0d710 --- /dev/null +++ b/src/lib/libcrypto/evp/encode.c | |||
| @@ -0,0 +1,446 @@ | |||
| 1 | /* crypto/evp/encode.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/evp.h> | ||
| 62 | |||
| 63 | #ifndef CHARSET_EBCDIC | ||
| 64 | #define conv_bin2ascii(a) (data_bin2ascii[(a)&0x3f]) | ||
| 65 | #define conv_ascii2bin(a) (data_ascii2bin[(a)&0x7f]) | ||
| 66 | #else | ||
| 67 | /* We assume that PEM encoded files are EBCDIC files | ||
| 68 | * (i.e., printable text files). Convert them here while decoding. | ||
| 69 | * When encoding, output is EBCDIC (text) format again. | ||
| 70 | * (No need for conversion in the conv_bin2ascii macro, as the | ||
| 71 | * underlying textstring data_bin2ascii[] is already EBCDIC) | ||
| 72 | */ | ||
| 73 | #define conv_bin2ascii(a) (data_bin2ascii[(a)&0x3f]) | ||
| 74 | #define conv_ascii2bin(a) (data_ascii2bin[os_toascii[a]&0x7f]) | ||
| 75 | #endif | ||
| 76 | |||
| 77 | /* 64 char lines | ||
| 78 | * pad input with 0 | ||
| 79 | * left over chars are set to = | ||
| 80 | * 1 byte => xx== | ||
| 81 | * 2 bytes => xxx= | ||
| 82 | * 3 bytes => xxxx | ||
| 83 | */ | ||
| 84 | #define BIN_PER_LINE (64/4*3) | ||
| 85 | #define CHUNKS_PER_LINE (64/4) | ||
| 86 | #define CHAR_PER_LINE (64+1) | ||
| 87 | |||
| 88 | static unsigned char data_bin2ascii[65]="ABCDEFGHIJKLMNOPQRSTUVWXYZ\ | ||
| 89 | abcdefghijklmnopqrstuvwxyz0123456789+/"; | ||
| 90 | |||
| 91 | /* 0xF0 is a EOLN | ||
| 92 | * 0xF1 is ignore but next needs to be 0xF0 (for \r\n processing). | ||
| 93 | * 0xF2 is EOF | ||
| 94 | * 0xE0 is ignore at start of line. | ||
| 95 | * 0xFF is error | ||
| 96 | */ | ||
| 97 | |||
| 98 | #define B64_EOLN 0xF0 | ||
| 99 | #define B64_CR 0xF1 | ||
| 100 | #define B64_EOF 0xF2 | ||
| 101 | #define B64_WS 0xE0 | ||
| 102 | #define B64_ERROR 0xFF | ||
| 103 | #define B64_NOT_BASE64(a) (((a)|0x13) == 0xF3) | ||
| 104 | |||
| 105 | static unsigned char data_ascii2bin[128]={ | ||
| 106 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, | ||
| 107 | 0xFF,0xE0,0xF0,0xFF,0xFF,0xF1,0xFF,0xFF, | ||
| 108 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, | ||
| 109 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, | ||
| 110 | 0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, | ||
| 111 | 0xFF,0xFF,0xFF,0x3E,0xFF,0xF2,0xFF,0x3F, | ||
| 112 | 0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B, | ||
| 113 | 0x3C,0x3D,0xFF,0xFF,0xFF,0x00,0xFF,0xFF, | ||
| 114 | 0xFF,0x00,0x01,0x02,0x03,0x04,0x05,0x06, | ||
| 115 | 0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E, | ||
| 116 | 0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16, | ||
| 117 | 0x17,0x18,0x19,0xFF,0xFF,0xFF,0xFF,0xFF, | ||
| 118 | 0xFF,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20, | ||
| 119 | 0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28, | ||
| 120 | 0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30, | ||
| 121 | 0x31,0x32,0x33,0xFF,0xFF,0xFF,0xFF,0xFF, | ||
| 122 | }; | ||
| 123 | |||
| 124 | void EVP_EncodeInit(EVP_ENCODE_CTX *ctx) | ||
| 125 | { | ||
| 126 | ctx->length=48; | ||
| 127 | ctx->num=0; | ||
| 128 | ctx->line_num=0; | ||
| 129 | } | ||
| 130 | |||
| 131 | void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, | ||
| 132 | const unsigned char *in, int inl) | ||
| 133 | { | ||
| 134 | int i,j; | ||
| 135 | unsigned int total=0; | ||
| 136 | |||
| 137 | *outl=0; | ||
| 138 | if (inl == 0) return; | ||
| 139 | OPENSSL_assert(ctx->length <= (int)sizeof(ctx->enc_data)); | ||
| 140 | if ((ctx->num+inl) < ctx->length) | ||
| 141 | { | ||
| 142 | memcpy(&(ctx->enc_data[ctx->num]),in,inl); | ||
| 143 | ctx->num+=inl; | ||
| 144 | return; | ||
| 145 | } | ||
| 146 | if (ctx->num != 0) | ||
| 147 | { | ||
| 148 | i=ctx->length-ctx->num; | ||
| 149 | memcpy(&(ctx->enc_data[ctx->num]),in,i); | ||
| 150 | in+=i; | ||
| 151 | inl-=i; | ||
| 152 | j=EVP_EncodeBlock(out,ctx->enc_data,ctx->length); | ||
| 153 | ctx->num=0; | ||
| 154 | out+=j; | ||
| 155 | *(out++)='\n'; | ||
| 156 | *out='\0'; | ||
| 157 | total=j+1; | ||
| 158 | } | ||
| 159 | while (inl >= ctx->length) | ||
| 160 | { | ||
| 161 | j=EVP_EncodeBlock(out,in,ctx->length); | ||
| 162 | in+=ctx->length; | ||
| 163 | inl-=ctx->length; | ||
| 164 | out+=j; | ||
| 165 | *(out++)='\n'; | ||
| 166 | *out='\0'; | ||
| 167 | total+=j+1; | ||
| 168 | } | ||
| 169 | if (inl != 0) | ||
| 170 | memcpy(&(ctx->enc_data[0]),in,inl); | ||
| 171 | ctx->num=inl; | ||
| 172 | *outl=total; | ||
| 173 | } | ||
| 174 | |||
| 175 | void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl) | ||
| 176 | { | ||
| 177 | unsigned int ret=0; | ||
| 178 | |||
| 179 | if (ctx->num != 0) | ||
| 180 | { | ||
| 181 | ret=EVP_EncodeBlock(out,ctx->enc_data,ctx->num); | ||
| 182 | out[ret++]='\n'; | ||
| 183 | out[ret]='\0'; | ||
| 184 | ctx->num=0; | ||
| 185 | } | ||
| 186 | *outl=ret; | ||
| 187 | } | ||
| 188 | |||
| 189 | int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int dlen) | ||
| 190 | { | ||
| 191 | int i,ret=0; | ||
| 192 | unsigned long l; | ||
| 193 | |||
| 194 | for (i=dlen; i > 0; i-=3) | ||
| 195 | { | ||
| 196 | if (i >= 3) | ||
| 197 | { | ||
| 198 | l= (((unsigned long)f[0])<<16L)| | ||
| 199 | (((unsigned long)f[1])<< 8L)|f[2]; | ||
| 200 | *(t++)=conv_bin2ascii(l>>18L); | ||
| 201 | *(t++)=conv_bin2ascii(l>>12L); | ||
| 202 | *(t++)=conv_bin2ascii(l>> 6L); | ||
| 203 | *(t++)=conv_bin2ascii(l ); | ||
| 204 | } | ||
| 205 | else | ||
| 206 | { | ||
| 207 | l=((unsigned long)f[0])<<16L; | ||
| 208 | if (i == 2) l|=((unsigned long)f[1]<<8L); | ||
| 209 | |||
| 210 | *(t++)=conv_bin2ascii(l>>18L); | ||
| 211 | *(t++)=conv_bin2ascii(l>>12L); | ||
| 212 | *(t++)=(i == 1)?'=':conv_bin2ascii(l>> 6L); | ||
| 213 | *(t++)='='; | ||
| 214 | } | ||
| 215 | ret+=4; | ||
| 216 | f+=3; | ||
| 217 | } | ||
| 218 | |||
| 219 | *t='\0'; | ||
| 220 | return(ret); | ||
| 221 | } | ||
| 222 | |||
| 223 | void EVP_DecodeInit(EVP_ENCODE_CTX *ctx) | ||
| 224 | { | ||
| 225 | ctx->length=30; | ||
| 226 | ctx->num=0; | ||
| 227 | ctx->line_num=0; | ||
| 228 | ctx->expect_nl=0; | ||
| 229 | } | ||
| 230 | |||
| 231 | /* -1 for error | ||
| 232 | * 0 for last line | ||
| 233 | * 1 for full line | ||
| 234 | */ | ||
| 235 | int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, | ||
| 236 | const unsigned char *in, int inl) | ||
| 237 | { | ||
| 238 | int seof= -1,eof=0,rv= -1,ret=0,i,v,tmp,n,ln,tmp2,exp_nl; | ||
| 239 | unsigned char *d; | ||
| 240 | |||
| 241 | n=ctx->num; | ||
| 242 | d=ctx->enc_data; | ||
| 243 | ln=ctx->line_num; | ||
| 244 | exp_nl=ctx->expect_nl; | ||
| 245 | |||
| 246 | /* last line of input. */ | ||
| 247 | if ((inl == 0) || ((n == 0) && (conv_ascii2bin(in[0]) == B64_EOF))) | ||
| 248 | { rv=0; goto end; } | ||
| 249 | |||
| 250 | /* We parse the input data */ | ||
| 251 | for (i=0; i<inl; i++) | ||
| 252 | { | ||
| 253 | /* If the current line is > 80 characters, scream alot */ | ||
| 254 | if (ln >= 80) { rv= -1; goto end; } | ||
| 255 | |||
| 256 | /* Get char and put it into the buffer */ | ||
| 257 | tmp= *(in++); | ||
| 258 | v=conv_ascii2bin(tmp); | ||
| 259 | /* only save the good data :-) */ | ||
| 260 | if (!B64_NOT_BASE64(v)) | ||
| 261 | { | ||
| 262 | OPENSSL_assert(n < (int)sizeof(ctx->enc_data)); | ||
| 263 | d[n++]=tmp; | ||
| 264 | ln++; | ||
| 265 | } | ||
| 266 | else if (v == B64_ERROR) | ||
| 267 | { | ||
| 268 | rv= -1; | ||
| 269 | goto end; | ||
| 270 | } | ||
| 271 | |||
| 272 | /* have we seen a '=' which is 'definitly' the last | ||
| 273 | * input line. seof will point to the character that | ||
| 274 | * holds it. and eof will hold how many characters to | ||
| 275 | * chop off. */ | ||
| 276 | if (tmp == '=') | ||
| 277 | { | ||
| 278 | if (seof == -1) seof=n; | ||
| 279 | eof++; | ||
| 280 | } | ||
| 281 | |||
| 282 | if (v == B64_CR) | ||
| 283 | { | ||
| 284 | ln = 0; | ||
| 285 | if (exp_nl) | ||
| 286 | continue; | ||
| 287 | } | ||
| 288 | |||
| 289 | /* eoln */ | ||
| 290 | if (v == B64_EOLN) | ||
| 291 | { | ||
| 292 | ln=0; | ||
| 293 | if (exp_nl) | ||
| 294 | { | ||
| 295 | exp_nl=0; | ||
| 296 | continue; | ||
| 297 | } | ||
| 298 | } | ||
| 299 | exp_nl=0; | ||
| 300 | |||
| 301 | /* If we are at the end of input and it looks like a | ||
| 302 | * line, process it. */ | ||
| 303 | if (((i+1) == inl) && (((n&3) == 0) || eof)) | ||
| 304 | { | ||
| 305 | v=B64_EOF; | ||
| 306 | /* In case things were given us in really small | ||
| 307 | records (so two '=' were given in separate | ||
| 308 | updates), eof may contain the incorrect number | ||
| 309 | of ending bytes to skip, so let's redo the count */ | ||
| 310 | eof = 0; | ||
| 311 | if (d[n-1] == '=') eof++; | ||
| 312 | if (d[n-2] == '=') eof++; | ||
| 313 | /* There will never be more than two '=' */ | ||
| 314 | } | ||
| 315 | |||
| 316 | if ((v == B64_EOF && (n&3) == 0) || (n >= 64)) | ||
| 317 | { | ||
| 318 | /* This is needed to work correctly on 64 byte input | ||
| 319 | * lines. We process the line and then need to | ||
| 320 | * accept the '\n' */ | ||
| 321 | if ((v != B64_EOF) && (n >= 64)) exp_nl=1; | ||
| 322 | tmp2=v; | ||
| 323 | if (n > 0) | ||
| 324 | { | ||
| 325 | v=EVP_DecodeBlock(out,d,n); | ||
| 326 | n=0; | ||
| 327 | if (v < 0) { rv=0; goto end; } | ||
| 328 | ret+=(v-eof); | ||
| 329 | } | ||
| 330 | else | ||
| 331 | { | ||
| 332 | eof=1; | ||
| 333 | v=0; | ||
| 334 | } | ||
| 335 | |||
| 336 | /* This is the case where we have had a short | ||
| 337 | * but valid input line */ | ||
| 338 | if ((v < ctx->length) && eof) | ||
| 339 | { | ||
| 340 | rv=0; | ||
| 341 | goto end; | ||
| 342 | } | ||
| 343 | else | ||
| 344 | ctx->length=v; | ||
| 345 | |||
| 346 | if (seof >= 0) { rv=0; goto end; } | ||
| 347 | out+=v; | ||
| 348 | } | ||
| 349 | } | ||
| 350 | rv=1; | ||
| 351 | end: | ||
| 352 | *outl=ret; | ||
| 353 | ctx->num=n; | ||
| 354 | ctx->line_num=ln; | ||
| 355 | ctx->expect_nl=exp_nl; | ||
| 356 | return(rv); | ||
| 357 | } | ||
| 358 | |||
| 359 | int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n) | ||
| 360 | { | ||
| 361 | int i,ret=0,a,b,c,d; | ||
| 362 | unsigned long l; | ||
| 363 | |||
| 364 | /* trim white space from the start of the line. */ | ||
| 365 | while ((conv_ascii2bin(*f) == B64_WS) && (n > 0)) | ||
| 366 | { | ||
| 367 | f++; | ||
| 368 | n--; | ||
| 369 | } | ||
| 370 | |||
| 371 | /* strip off stuff at the end of the line | ||
| 372 | * ascii2bin values B64_WS, B64_EOLN, B64_EOLN and B64_EOF */ | ||
| 373 | while ((n > 3) && (B64_NOT_BASE64(conv_ascii2bin(f[n-1])))) | ||
| 374 | n--; | ||
| 375 | |||
| 376 | if (n%4 != 0) return(-1); | ||
| 377 | |||
| 378 | for (i=0; i<n; i+=4) | ||
| 379 | { | ||
| 380 | a=conv_ascii2bin(*(f++)); | ||
| 381 | b=conv_ascii2bin(*(f++)); | ||
| 382 | c=conv_ascii2bin(*(f++)); | ||
| 383 | d=conv_ascii2bin(*(f++)); | ||
| 384 | if ( (a & 0x80) || (b & 0x80) || | ||
| 385 | (c & 0x80) || (d & 0x80)) | ||
| 386 | return(-1); | ||
| 387 | l=( (((unsigned long)a)<<18L)| | ||
| 388 | (((unsigned long)b)<<12L)| | ||
| 389 | (((unsigned long)c)<< 6L)| | ||
| 390 | (((unsigned long)d) )); | ||
| 391 | *(t++)=(unsigned char)(l>>16L)&0xff; | ||
| 392 | *(t++)=(unsigned char)(l>> 8L)&0xff; | ||
| 393 | *(t++)=(unsigned char)(l )&0xff; | ||
| 394 | ret+=3; | ||
| 395 | } | ||
| 396 | return(ret); | ||
| 397 | } | ||
| 398 | |||
| 399 | int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl) | ||
| 400 | { | ||
| 401 | int i; | ||
| 402 | |||
| 403 | *outl=0; | ||
| 404 | if (ctx->num != 0) | ||
| 405 | { | ||
| 406 | i=EVP_DecodeBlock(out,ctx->enc_data,ctx->num); | ||
| 407 | if (i < 0) return(-1); | ||
| 408 | ctx->num=0; | ||
| 409 | *outl=i; | ||
| 410 | return(1); | ||
| 411 | } | ||
| 412 | else | ||
| 413 | return(1); | ||
| 414 | } | ||
| 415 | |||
| 416 | #ifdef undef | ||
| 417 | int EVP_DecodeValid(unsigned char *buf, int len) | ||
| 418 | { | ||
| 419 | int i,num=0,bad=0; | ||
| 420 | |||
| 421 | if (len == 0) return(-1); | ||
| 422 | while (conv_ascii2bin(*buf) == B64_WS) | ||
| 423 | { | ||
| 424 | buf++; | ||
| 425 | len--; | ||
| 426 | if (len == 0) return(-1); | ||
| 427 | } | ||
| 428 | |||
| 429 | for (i=len; i >= 4; i-=4) | ||
| 430 | { | ||
| 431 | if ( (conv_ascii2bin(buf[0]) >= 0x40) || | ||
| 432 | (conv_ascii2bin(buf[1]) >= 0x40) || | ||
| 433 | (conv_ascii2bin(buf[2]) >= 0x40) || | ||
| 434 | (conv_ascii2bin(buf[3]) >= 0x40)) | ||
| 435 | return(-1); | ||
| 436 | buf+=4; | ||
| 437 | num+=1+(buf[2] != '=')+(buf[3] != '='); | ||
| 438 | } | ||
| 439 | if ((i == 1) && (conv_ascii2bin(buf[0]) == B64_EOLN)) | ||
| 440 | return(num); | ||
| 441 | if ((i == 2) && (conv_ascii2bin(buf[0]) == B64_EOLN) && | ||
| 442 | (conv_ascii2bin(buf[0]) == B64_EOLN)) | ||
| 443 | return(num); | ||
| 444 | return(1); | ||
| 445 | } | ||
| 446 | #endif | ||
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h new file mode 100644 index 0000000000..1aa2d6fb35 --- /dev/null +++ b/src/lib/libcrypto/evp/evp.h | |||
| @@ -0,0 +1,985 @@ | |||
| 1 | /* crypto/evp/evp.h */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #ifndef HEADER_ENVELOPE_H | ||
| 60 | #define HEADER_ENVELOPE_H | ||
| 61 | |||
| 62 | #ifdef OPENSSL_ALGORITHM_DEFINES | ||
| 63 | # include <openssl/opensslconf.h> | ||
| 64 | #else | ||
| 65 | # define OPENSSL_ALGORITHM_DEFINES | ||
| 66 | # include <openssl/opensslconf.h> | ||
| 67 | # undef OPENSSL_ALGORITHM_DEFINES | ||
| 68 | #endif | ||
| 69 | |||
| 70 | #include <openssl/ossl_typ.h> | ||
| 71 | |||
| 72 | #include <openssl/symhacks.h> | ||
| 73 | |||
| 74 | #ifndef OPENSSL_NO_BIO | ||
| 75 | #include <openssl/bio.h> | ||
| 76 | #endif | ||
| 77 | |||
| 78 | /* | ||
| 79 | #define EVP_RC2_KEY_SIZE 16 | ||
| 80 | #define EVP_RC4_KEY_SIZE 16 | ||
| 81 | #define EVP_BLOWFISH_KEY_SIZE 16 | ||
| 82 | #define EVP_CAST5_KEY_SIZE 16 | ||
| 83 | #define EVP_RC5_32_12_16_KEY_SIZE 16 | ||
| 84 | */ | ||
| 85 | #define EVP_MAX_MD_SIZE 64 /* longest known is SHA512 */ | ||
| 86 | #define EVP_MAX_KEY_LENGTH 32 | ||
| 87 | #define EVP_MAX_IV_LENGTH 16 | ||
| 88 | #define EVP_MAX_BLOCK_LENGTH 32 | ||
| 89 | |||
| 90 | #define PKCS5_SALT_LEN 8 | ||
| 91 | /* Default PKCS#5 iteration count */ | ||
| 92 | #define PKCS5_DEFAULT_ITER 2048 | ||
| 93 | |||
| 94 | #include <openssl/objects.h> | ||
| 95 | |||
| 96 | #define EVP_PK_RSA 0x0001 | ||
| 97 | #define EVP_PK_DSA 0x0002 | ||
| 98 | #define EVP_PK_DH 0x0004 | ||
| 99 | #define EVP_PK_EC 0x0008 | ||
| 100 | #define EVP_PKT_SIGN 0x0010 | ||
| 101 | #define EVP_PKT_ENC 0x0020 | ||
| 102 | #define EVP_PKT_EXCH 0x0040 | ||
| 103 | #define EVP_PKS_RSA 0x0100 | ||
| 104 | #define EVP_PKS_DSA 0x0200 | ||
| 105 | #define EVP_PKS_EC 0x0400 | ||
| 106 | #define EVP_PKT_EXP 0x1000 /* <= 512 bit key */ | ||
| 107 | |||
| 108 | #define EVP_PKEY_NONE NID_undef | ||
| 109 | #define EVP_PKEY_RSA NID_rsaEncryption | ||
| 110 | #define EVP_PKEY_RSA2 NID_rsa | ||
| 111 | #define EVP_PKEY_DSA NID_dsa | ||
| 112 | #define EVP_PKEY_DSA1 NID_dsa_2 | ||
| 113 | #define EVP_PKEY_DSA2 NID_dsaWithSHA | ||
| 114 | #define EVP_PKEY_DSA3 NID_dsaWithSHA1 | ||
| 115 | #define EVP_PKEY_DSA4 NID_dsaWithSHA1_2 | ||
| 116 | #define EVP_PKEY_DH NID_dhKeyAgreement | ||
| 117 | #define EVP_PKEY_EC NID_X9_62_id_ecPublicKey | ||
| 118 | |||
| 119 | #ifdef __cplusplus | ||
| 120 | extern "C" { | ||
| 121 | #endif | ||
| 122 | |||
| 123 | /* Type needs to be a bit field | ||
| 124 | * Sub-type needs to be for variations on the method, as in, can it do | ||
| 125 | * arbitrary encryption.... */ | ||
| 126 | struct evp_pkey_st | ||
| 127 | { | ||
| 128 | int type; | ||
| 129 | int save_type; | ||
| 130 | int references; | ||
| 131 | union { | ||
| 132 | char *ptr; | ||
| 133 | #ifndef OPENSSL_NO_RSA | ||
| 134 | struct rsa_st *rsa; /* RSA */ | ||
| 135 | #endif | ||
| 136 | #ifndef OPENSSL_NO_DSA | ||
| 137 | struct dsa_st *dsa; /* DSA */ | ||
| 138 | #endif | ||
| 139 | #ifndef OPENSSL_NO_DH | ||
| 140 | struct dh_st *dh; /* DH */ | ||
| 141 | #endif | ||
| 142 | #ifndef OPENSSL_NO_EC | ||
| 143 | struct ec_key_st *ec; /* ECC */ | ||
| 144 | #endif | ||
| 145 | } pkey; | ||
| 146 | int save_parameters; | ||
| 147 | STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */ | ||
| 148 | } /* EVP_PKEY */; | ||
| 149 | |||
| 150 | #define EVP_PKEY_MO_SIGN 0x0001 | ||
| 151 | #define EVP_PKEY_MO_VERIFY 0x0002 | ||
| 152 | #define EVP_PKEY_MO_ENCRYPT 0x0004 | ||
| 153 | #define EVP_PKEY_MO_DECRYPT 0x0008 | ||
| 154 | |||
| 155 | #if 0 | ||
| 156 | /* This structure is required to tie the message digest and signing together. | ||
| 157 | * The lookup can be done by md/pkey_method, oid, oid/pkey_method, or | ||
| 158 | * oid, md and pkey. | ||
| 159 | * This is required because for various smart-card perform the digest and | ||
| 160 | * signing/verification on-board. To handle this case, the specific | ||
| 161 | * EVP_MD and EVP_PKEY_METHODs need to be closely associated. | ||
| 162 | * When a PKEY is created, it will have a EVP_PKEY_METHOD associated with it. | ||
| 163 | * This can either be software or a token to provide the required low level | ||
| 164 | * routines. | ||
| 165 | */ | ||
| 166 | typedef struct evp_pkey_md_st | ||
| 167 | { | ||
| 168 | int oid; | ||
| 169 | EVP_MD *md; | ||
| 170 | EVP_PKEY_METHOD *pkey; | ||
| 171 | } EVP_PKEY_MD; | ||
| 172 | |||
| 173 | #define EVP_rsa_md2() \ | ||
| 174 | EVP_PKEY_MD_add(NID_md2WithRSAEncryption,\ | ||
| 175 | EVP_rsa_pkcs1(),EVP_md2()) | ||
| 176 | #define EVP_rsa_md5() \ | ||
| 177 | EVP_PKEY_MD_add(NID_md5WithRSAEncryption,\ | ||
| 178 | EVP_rsa_pkcs1(),EVP_md5()) | ||
| 179 | #define EVP_rsa_sha0() \ | ||
| 180 | EVP_PKEY_MD_add(NID_shaWithRSAEncryption,\ | ||
| 181 | EVP_rsa_pkcs1(),EVP_sha()) | ||
| 182 | #define EVP_rsa_sha1() \ | ||
| 183 | EVP_PKEY_MD_add(NID_sha1WithRSAEncryption,\ | ||
| 184 | EVP_rsa_pkcs1(),EVP_sha1()) | ||
| 185 | #define EVP_rsa_ripemd160() \ | ||
| 186 | EVP_PKEY_MD_add(NID_ripemd160WithRSA,\ | ||
| 187 | EVP_rsa_pkcs1(),EVP_ripemd160()) | ||
| 188 | #define EVP_rsa_mdc2() \ | ||
| 189 | EVP_PKEY_MD_add(NID_mdc2WithRSA,\ | ||
| 190 | EVP_rsa_octet_string(),EVP_mdc2()) | ||
| 191 | #define EVP_dsa_sha() \ | ||
| 192 | EVP_PKEY_MD_add(NID_dsaWithSHA,\ | ||
| 193 | EVP_dsa(),EVP_sha()) | ||
| 194 | #define EVP_dsa_sha1() \ | ||
| 195 | EVP_PKEY_MD_add(NID_dsaWithSHA1,\ | ||
| 196 | EVP_dsa(),EVP_sha1()) | ||
| 197 | |||
| 198 | typedef struct evp_pkey_method_st | ||
| 199 | { | ||
| 200 | char *name; | ||
| 201 | int flags; | ||
| 202 | int type; /* RSA, DSA, an SSLeay specific constant */ | ||
| 203 | int oid; /* For the pub-key type */ | ||
| 204 | int encrypt_oid; /* pub/priv key encryption */ | ||
| 205 | |||
| 206 | int (*sign)(); | ||
| 207 | int (*verify)(); | ||
| 208 | struct { | ||
| 209 | int (*set)(); /* get and/or set the underlying type */ | ||
| 210 | int (*get)(); | ||
| 211 | int (*encrypt)(); | ||
| 212 | int (*decrypt)(); | ||
| 213 | int (*i2d)(); | ||
| 214 | int (*d2i)(); | ||
| 215 | int (*dup)(); | ||
| 216 | } pub,priv; | ||
| 217 | int (*set_asn1_parameters)(); | ||
| 218 | int (*get_asn1_parameters)(); | ||
| 219 | } EVP_PKEY_METHOD; | ||
| 220 | #endif | ||
| 221 | |||
| 222 | #ifndef EVP_MD | ||
| 223 | struct env_md_st | ||
| 224 | { | ||
| 225 | int type; | ||
| 226 | int pkey_type; | ||
| 227 | int md_size; | ||
| 228 | unsigned long flags; | ||
| 229 | int (*init)(EVP_MD_CTX *ctx); | ||
| 230 | int (*update)(EVP_MD_CTX *ctx,const void *data,size_t count); | ||
| 231 | int (*final)(EVP_MD_CTX *ctx,unsigned char *md); | ||
| 232 | int (*copy)(EVP_MD_CTX *to,const EVP_MD_CTX *from); | ||
| 233 | int (*cleanup)(EVP_MD_CTX *ctx); | ||
| 234 | |||
| 235 | /* FIXME: prototype these some day */ | ||
| 236 | int (*sign)(int type, const unsigned char *m, unsigned int m_length, | ||
| 237 | unsigned char *sigret, unsigned int *siglen, void *key); | ||
| 238 | int (*verify)(int type, const unsigned char *m, unsigned int m_length, | ||
| 239 | const unsigned char *sigbuf, unsigned int siglen, | ||
| 240 | void *key); | ||
| 241 | int required_pkey_type[5]; /*EVP_PKEY_xxx */ | ||
| 242 | int block_size; | ||
| 243 | int ctx_size; /* how big does the ctx->md_data need to be */ | ||
| 244 | } /* EVP_MD */; | ||
| 245 | |||
| 246 | typedef int evp_sign_method(int type,const unsigned char *m, | ||
| 247 | unsigned int m_length,unsigned char *sigret, | ||
| 248 | unsigned int *siglen, void *key); | ||
| 249 | typedef int evp_verify_method(int type,const unsigned char *m, | ||
| 250 | unsigned int m_length,const unsigned char *sigbuf, | ||
| 251 | unsigned int siglen, void *key); | ||
| 252 | |||
| 253 | #define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single | ||
| 254 | * block */ | ||
| 255 | |||
| 256 | #define EVP_PKEY_NULL_method NULL,NULL,{0,0,0,0} | ||
| 257 | |||
| 258 | #ifndef OPENSSL_NO_DSA | ||
| 259 | #define EVP_PKEY_DSA_method (evp_sign_method *)DSA_sign, \ | ||
| 260 | (evp_verify_method *)DSA_verify, \ | ||
| 261 | {EVP_PKEY_DSA,EVP_PKEY_DSA2,EVP_PKEY_DSA3, \ | ||
| 262 | EVP_PKEY_DSA4,0} | ||
| 263 | #else | ||
| 264 | #define EVP_PKEY_DSA_method EVP_PKEY_NULL_method | ||
| 265 | #endif | ||
| 266 | |||
| 267 | #ifndef OPENSSL_NO_ECDSA | ||
| 268 | #define EVP_PKEY_ECDSA_method (evp_sign_method *)ECDSA_sign, \ | ||
| 269 | (evp_verify_method *)ECDSA_verify, \ | ||
| 270 | {EVP_PKEY_EC,0,0,0} | ||
| 271 | #else | ||
| 272 | #define EVP_PKEY_ECDSA_method EVP_PKEY_NULL_method | ||
| 273 | #endif | ||
| 274 | |||
| 275 | #ifndef OPENSSL_NO_RSA | ||
| 276 | #define EVP_PKEY_RSA_method (evp_sign_method *)RSA_sign, \ | ||
| 277 | (evp_verify_method *)RSA_verify, \ | ||
| 278 | {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0} | ||
| 279 | #define EVP_PKEY_RSA_ASN1_OCTET_STRING_method \ | ||
| 280 | (evp_sign_method *)RSA_sign_ASN1_OCTET_STRING, \ | ||
| 281 | (evp_verify_method *)RSA_verify_ASN1_OCTET_STRING, \ | ||
| 282 | {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0} | ||
| 283 | #else | ||
| 284 | #define EVP_PKEY_RSA_method EVP_PKEY_NULL_method | ||
| 285 | #define EVP_PKEY_RSA_ASN1_OCTET_STRING_method EVP_PKEY_NULL_method | ||
| 286 | #endif | ||
| 287 | |||
| 288 | #endif /* !EVP_MD */ | ||
| 289 | |||
| 290 | struct env_md_ctx_st | ||
| 291 | { | ||
| 292 | const EVP_MD *digest; | ||
| 293 | ENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */ | ||
| 294 | unsigned long flags; | ||
| 295 | void *md_data; | ||
| 296 | } /* EVP_MD_CTX */; | ||
| 297 | |||
| 298 | /* values for EVP_MD_CTX flags */ | ||
| 299 | |||
| 300 | #define EVP_MD_CTX_FLAG_ONESHOT 0x0001 /* digest update will be called | ||
| 301 | * once only */ | ||
| 302 | #define EVP_MD_CTX_FLAG_CLEANED 0x0002 /* context has already been | ||
| 303 | * cleaned */ | ||
| 304 | #define EVP_MD_CTX_FLAG_REUSE 0x0004 /* Don't free up ctx->md_data | ||
| 305 | * in EVP_MD_CTX_cleanup */ | ||
| 306 | #define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW 0x0008 /* Allow use of non FIPS digest | ||
| 307 | * in FIPS mode */ | ||
| 308 | |||
| 309 | struct evp_cipher_st | ||
| 310 | { | ||
| 311 | int nid; | ||
| 312 | int block_size; | ||
| 313 | int key_len; /* Default value for variable length ciphers */ | ||
| 314 | int iv_len; | ||
| 315 | unsigned long flags; /* Various flags */ | ||
| 316 | int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 317 | const unsigned char *iv, int enc); /* init key */ | ||
| 318 | int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 319 | const unsigned char *in, unsigned int inl);/* encrypt/decrypt data */ | ||
| 320 | int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */ | ||
| 321 | int ctx_size; /* how big ctx->cipher_data needs to be */ | ||
| 322 | int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */ | ||
| 323 | int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */ | ||
| 324 | int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */ | ||
| 325 | void *app_data; /* Application data */ | ||
| 326 | } /* EVP_CIPHER */; | ||
| 327 | |||
| 328 | /* Values for cipher flags */ | ||
| 329 | |||
| 330 | /* Modes for ciphers */ | ||
| 331 | |||
| 332 | #define EVP_CIPH_STREAM_CIPHER 0x0 | ||
| 333 | #define EVP_CIPH_ECB_MODE 0x1 | ||
| 334 | #define EVP_CIPH_CBC_MODE 0x2 | ||
| 335 | #define EVP_CIPH_CFB_MODE 0x3 | ||
| 336 | #define EVP_CIPH_OFB_MODE 0x4 | ||
| 337 | #define EVP_CIPH_MODE 0x7 | ||
| 338 | /* Set if variable length cipher */ | ||
| 339 | #define EVP_CIPH_VARIABLE_LENGTH 0x8 | ||
| 340 | /* Set if the iv handling should be done by the cipher itself */ | ||
| 341 | #define EVP_CIPH_CUSTOM_IV 0x10 | ||
| 342 | /* Set if the cipher's init() function should be called if key is NULL */ | ||
| 343 | #define EVP_CIPH_ALWAYS_CALL_INIT 0x20 | ||
| 344 | /* Call ctrl() to init cipher parameters */ | ||
| 345 | #define EVP_CIPH_CTRL_INIT 0x40 | ||
| 346 | /* Don't use standard key length function */ | ||
| 347 | #define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 | ||
| 348 | /* Don't use standard block padding */ | ||
| 349 | #define EVP_CIPH_NO_PADDING 0x100 | ||
| 350 | /* cipher handles random key generation */ | ||
| 351 | #define EVP_CIPH_RAND_KEY 0x200 | ||
| 352 | |||
| 353 | /* ctrl() values */ | ||
| 354 | |||
| 355 | #define EVP_CTRL_INIT 0x0 | ||
| 356 | #define EVP_CTRL_SET_KEY_LENGTH 0x1 | ||
| 357 | #define EVP_CTRL_GET_RC2_KEY_BITS 0x2 | ||
| 358 | #define EVP_CTRL_SET_RC2_KEY_BITS 0x3 | ||
| 359 | #define EVP_CTRL_GET_RC5_ROUNDS 0x4 | ||
| 360 | #define EVP_CTRL_SET_RC5_ROUNDS 0x5 | ||
| 361 | #define EVP_CTRL_SET_ACSS_MODE 0x6 | ||
| 362 | #define EVP_CTRL_RAND_KEY 0x7 | ||
| 363 | |||
| 364 | typedef struct evp_cipher_info_st | ||
| 365 | { | ||
| 366 | const EVP_CIPHER *cipher; | ||
| 367 | unsigned char iv[EVP_MAX_IV_LENGTH]; | ||
| 368 | } EVP_CIPHER_INFO; | ||
| 369 | |||
| 370 | struct evp_cipher_ctx_st | ||
| 371 | { | ||
| 372 | const EVP_CIPHER *cipher; | ||
| 373 | ENGINE *engine; /* functional reference if 'cipher' is ENGINE-provided */ | ||
| 374 | int encrypt; /* encrypt or decrypt */ | ||
| 375 | int buf_len; /* number we have left */ | ||
| 376 | |||
| 377 | unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */ | ||
| 378 | unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */ | ||
| 379 | unsigned char buf[EVP_MAX_BLOCK_LENGTH];/* saved partial block */ | ||
| 380 | int num; /* used by cfb/ofb mode */ | ||
| 381 | |||
| 382 | void *app_data; /* application stuff */ | ||
| 383 | int key_len; /* May change for variable length cipher */ | ||
| 384 | unsigned long flags; /* Various flags */ | ||
| 385 | void *cipher_data; /* per EVP data */ | ||
| 386 | int final_used; | ||
| 387 | int block_mask; | ||
| 388 | unsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */ | ||
| 389 | } /* EVP_CIPHER_CTX */; | ||
| 390 | |||
| 391 | typedef struct evp_Encode_Ctx_st | ||
| 392 | { | ||
| 393 | int num; /* number saved in a partial encode/decode */ | ||
| 394 | int length; /* The length is either the output line length | ||
| 395 | * (in input bytes) or the shortest input line | ||
| 396 | * length that is ok. Once decoding begins, | ||
| 397 | * the length is adjusted up each time a longer | ||
| 398 | * line is decoded */ | ||
| 399 | unsigned char enc_data[80]; /* data to encode */ | ||
| 400 | int line_num; /* number read on current line */ | ||
| 401 | int expect_nl; | ||
| 402 | } EVP_ENCODE_CTX; | ||
| 403 | |||
| 404 | /* Password based encryption function */ | ||
| 405 | typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | ||
| 406 | ASN1_TYPE *param, const EVP_CIPHER *cipher, | ||
| 407 | const EVP_MD *md, int en_de); | ||
| 408 | |||
| 409 | #ifndef OPENSSL_NO_RSA | ||
| 410 | #define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ | ||
| 411 | (char *)(rsa)) | ||
| 412 | #endif | ||
| 413 | |||
| 414 | #ifndef OPENSSL_NO_DSA | ||
| 415 | #define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ | ||
| 416 | (char *)(dsa)) | ||
| 417 | #endif | ||
| 418 | |||
| 419 | #ifndef OPENSSL_NO_DH | ||
| 420 | #define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\ | ||
| 421 | (char *)(dh)) | ||
| 422 | #endif | ||
| 423 | |||
| 424 | #ifndef OPENSSL_NO_EC | ||
| 425 | #define EVP_PKEY_assign_EC_KEY(pkey,eckey) EVP_PKEY_assign((pkey),EVP_PKEY_EC,\ | ||
| 426 | (char *)(eckey)) | ||
| 427 | #endif | ||
| 428 | |||
| 429 | /* Add some extra combinations */ | ||
| 430 | #define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) | ||
| 431 | #define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a)) | ||
| 432 | #define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) | ||
| 433 | #define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) | ||
| 434 | |||
| 435 | int EVP_MD_type(const EVP_MD *md); | ||
| 436 | #define EVP_MD_nid(e) EVP_MD_type(e) | ||
| 437 | #define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) | ||
| 438 | int EVP_MD_pkey_type(const EVP_MD *md); | ||
| 439 | int EVP_MD_size(const EVP_MD *md); | ||
| 440 | int EVP_MD_block_size(const EVP_MD *md); | ||
| 441 | |||
| 442 | const EVP_MD * EVP_MD_CTX_md(const EVP_MD_CTX *ctx); | ||
| 443 | #define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e)) | ||
| 444 | #define EVP_MD_CTX_block_size(e) EVP_MD_block_size(EVP_MD_CTX_md(e)) | ||
| 445 | #define EVP_MD_CTX_type(e) EVP_MD_type(EVP_MD_CTX_md(e)) | ||
| 446 | |||
| 447 | int EVP_CIPHER_nid(const EVP_CIPHER *cipher); | ||
| 448 | #define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e)) | ||
| 449 | int EVP_CIPHER_block_size(const EVP_CIPHER *cipher); | ||
| 450 | int EVP_CIPHER_key_length(const EVP_CIPHER *cipher); | ||
| 451 | int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher); | ||
| 452 | unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher); | ||
| 453 | #define EVP_CIPHER_mode(e) (EVP_CIPHER_flags(e) & EVP_CIPH_MODE) | ||
| 454 | |||
| 455 | const EVP_CIPHER * EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx); | ||
| 456 | int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx); | ||
| 457 | int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx); | ||
| 458 | int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx); | ||
| 459 | int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx); | ||
| 460 | void * EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx); | ||
| 461 | void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data); | ||
| 462 | #define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) | ||
| 463 | unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx); | ||
| 464 | #define EVP_CIPHER_CTX_mode(e) (EVP_CIPHER_CTX_flags(e) & EVP_CIPH_MODE) | ||
| 465 | |||
| 466 | #define EVP_ENCODE_LENGTH(l) (((l+2)/3*4)+(l/48+1)*2+80) | ||
| 467 | #define EVP_DECODE_LENGTH(l) ((l+3)/4*3+80) | ||
| 468 | |||
| 469 | #define EVP_SignInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) | ||
| 470 | #define EVP_SignInit(a,b) EVP_DigestInit(a,b) | ||
| 471 | #define EVP_SignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) | ||
| 472 | #define EVP_VerifyInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) | ||
| 473 | #define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) | ||
| 474 | #define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) | ||
| 475 | #define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) | ||
| 476 | #define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) | ||
| 477 | |||
| 478 | #ifdef CONST_STRICT | ||
| 479 | void BIO_set_md(BIO *,const EVP_MD *md); | ||
| 480 | #else | ||
| 481 | # define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)md) | ||
| 482 | #endif | ||
| 483 | #define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)mdp) | ||
| 484 | #define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(char *)mdcp) | ||
| 485 | #define BIO_set_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_SET_MD_CTX,0,(char *)mdcp) | ||
| 486 | #define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) | ||
| 487 | #define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp) | ||
| 488 | |||
| 489 | int EVP_Cipher(EVP_CIPHER_CTX *c, | ||
| 490 | unsigned char *out, | ||
| 491 | const unsigned char *in, | ||
| 492 | unsigned int inl); | ||
| 493 | |||
| 494 | #define EVP_add_cipher_alias(n,alias) \ | ||
| 495 | OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) | ||
| 496 | #define EVP_add_digest_alias(n,alias) \ | ||
| 497 | OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n)) | ||
| 498 | #define EVP_delete_cipher_alias(alias) \ | ||
| 499 | OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS); | ||
| 500 | #define EVP_delete_digest_alias(alias) \ | ||
| 501 | OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); | ||
| 502 | |||
| 503 | void EVP_MD_CTX_init(EVP_MD_CTX *ctx); | ||
| 504 | int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx); | ||
| 505 | EVP_MD_CTX *EVP_MD_CTX_create(void); | ||
| 506 | void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx); | ||
| 507 | int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out,const EVP_MD_CTX *in); | ||
| 508 | void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags); | ||
| 509 | void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags); | ||
| 510 | int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx,int flags); | ||
| 511 | int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); | ||
| 512 | int EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d, | ||
| 513 | size_t cnt); | ||
| 514 | int EVP_DigestFinal_ex(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s); | ||
| 515 | int EVP_Digest(const void *data, size_t count, | ||
| 516 | unsigned char *md, unsigned int *size, const EVP_MD *type, ENGINE *impl); | ||
| 517 | |||
| 518 | int EVP_MD_CTX_copy(EVP_MD_CTX *out,const EVP_MD_CTX *in); | ||
| 519 | int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); | ||
| 520 | int EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s); | ||
| 521 | |||
| 522 | int EVP_read_pw_string(char *buf,int length,const char *prompt,int verify); | ||
| 523 | void EVP_set_pw_prompt(const char *prompt); | ||
| 524 | char * EVP_get_pw_prompt(void); | ||
| 525 | |||
| 526 | int EVP_BytesToKey(const EVP_CIPHER *type,const EVP_MD *md, | ||
| 527 | const unsigned char *salt, const unsigned char *data, | ||
| 528 | int datal, int count, unsigned char *key,unsigned char *iv); | ||
| 529 | |||
| 530 | int EVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, | ||
| 531 | const unsigned char *key, const unsigned char *iv); | ||
| 532 | int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl, | ||
| 533 | const unsigned char *key, const unsigned char *iv); | ||
| 534 | int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 535 | int *outl, const unsigned char *in, int inl); | ||
| 536 | int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); | ||
| 537 | int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); | ||
| 538 | |||
| 539 | int EVP_DecryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, | ||
| 540 | const unsigned char *key, const unsigned char *iv); | ||
| 541 | int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl, | ||
| 542 | const unsigned char *key, const unsigned char *iv); | ||
| 543 | int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 544 | int *outl, const unsigned char *in, int inl); | ||
| 545 | int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); | ||
| 546 | int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); | ||
| 547 | |||
| 548 | int EVP_CipherInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, | ||
| 549 | const unsigned char *key,const unsigned char *iv, | ||
| 550 | int enc); | ||
| 551 | int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl, | ||
| 552 | const unsigned char *key,const unsigned char *iv, | ||
| 553 | int enc); | ||
| 554 | int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 555 | int *outl, const unsigned char *in, int inl); | ||
| 556 | int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); | ||
| 557 | int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); | ||
| 558 | |||
| 559 | int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s, | ||
| 560 | EVP_PKEY *pkey); | ||
| 561 | |||
| 562 | int EVP_VerifyFinal(EVP_MD_CTX *ctx,const unsigned char *sigbuf, | ||
| 563 | unsigned int siglen,EVP_PKEY *pkey); | ||
| 564 | |||
| 565 | int EVP_OpenInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type, | ||
| 566 | const unsigned char *ek, int ekl, const unsigned char *iv, | ||
| 567 | EVP_PKEY *priv); | ||
| 568 | int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); | ||
| 569 | |||
| 570 | int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | ||
| 571 | unsigned char **ek, int *ekl, unsigned char *iv, | ||
| 572 | EVP_PKEY **pubk, int npubk); | ||
| 573 | int EVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl); | ||
| 574 | |||
| 575 | void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); | ||
| 576 | void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl, | ||
| 577 | const unsigned char *in,int inl); | ||
| 578 | void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl); | ||
| 579 | int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); | ||
| 580 | |||
| 581 | void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); | ||
| 582 | int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl, | ||
| 583 | const unsigned char *in, int inl); | ||
| 584 | int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned | ||
| 585 | char *out, int *outl); | ||
| 586 | int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); | ||
| 587 | |||
| 588 | void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); | ||
| 589 | int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); | ||
| 590 | EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void); | ||
| 591 | void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *a); | ||
| 592 | int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); | ||
| 593 | int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad); | ||
| 594 | int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); | ||
| 595 | int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key); | ||
| 596 | |||
| 597 | #ifndef OPENSSL_NO_BIO | ||
| 598 | BIO_METHOD *BIO_f_md(void); | ||
| 599 | BIO_METHOD *BIO_f_base64(void); | ||
| 600 | BIO_METHOD *BIO_f_cipher(void); | ||
| 601 | BIO_METHOD *BIO_f_reliable(void); | ||
| 602 | void BIO_set_cipher(BIO *b,const EVP_CIPHER *c,const unsigned char *k, | ||
| 603 | const unsigned char *i, int enc); | ||
| 604 | #endif | ||
| 605 | |||
| 606 | const EVP_MD *EVP_md_null(void); | ||
| 607 | #ifndef OPENSSL_NO_MD2 | ||
| 608 | const EVP_MD *EVP_md2(void); | ||
| 609 | #endif | ||
| 610 | #ifndef OPENSSL_NO_MD4 | ||
| 611 | const EVP_MD *EVP_md4(void); | ||
| 612 | #endif | ||
| 613 | #ifndef OPENSSL_NO_MD5 | ||
| 614 | const EVP_MD *EVP_md5(void); | ||
| 615 | #endif | ||
| 616 | #ifndef OPENSSL_NO_SHA | ||
| 617 | const EVP_MD *EVP_sha(void); | ||
| 618 | const EVP_MD *EVP_sha1(void); | ||
| 619 | const EVP_MD *EVP_dss(void); | ||
| 620 | const EVP_MD *EVP_dss1(void); | ||
| 621 | const EVP_MD *EVP_ecdsa(void); | ||
| 622 | #endif | ||
| 623 | #ifndef OPENSSL_NO_SHA256 | ||
| 624 | const EVP_MD *EVP_sha224(void); | ||
| 625 | const EVP_MD *EVP_sha256(void); | ||
| 626 | #endif | ||
| 627 | #ifndef OPENSSL_NO_SHA512 | ||
| 628 | const EVP_MD *EVP_sha384(void); | ||
| 629 | const EVP_MD *EVP_sha512(void); | ||
| 630 | #endif | ||
| 631 | #ifndef OPENSSL_NO_MDC2 | ||
| 632 | const EVP_MD *EVP_mdc2(void); | ||
| 633 | #endif | ||
| 634 | #ifndef OPENSSL_NO_RIPEMD | ||
| 635 | const EVP_MD *EVP_ripemd160(void); | ||
| 636 | #endif | ||
| 637 | const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ | ||
| 638 | #ifndef OPENSSL_NO_DES | ||
| 639 | const EVP_CIPHER *EVP_des_ecb(void); | ||
| 640 | const EVP_CIPHER *EVP_des_ede(void); | ||
| 641 | const EVP_CIPHER *EVP_des_ede3(void); | ||
| 642 | const EVP_CIPHER *EVP_des_ede_ecb(void); | ||
| 643 | const EVP_CIPHER *EVP_des_ede3_ecb(void); | ||
| 644 | const EVP_CIPHER *EVP_des_cfb64(void); | ||
| 645 | # define EVP_des_cfb EVP_des_cfb64 | ||
| 646 | const EVP_CIPHER *EVP_des_cfb1(void); | ||
| 647 | const EVP_CIPHER *EVP_des_cfb8(void); | ||
| 648 | const EVP_CIPHER *EVP_des_ede_cfb64(void); | ||
| 649 | # define EVP_des_ede_cfb EVP_des_ede_cfb64 | ||
| 650 | #if 0 | ||
| 651 | const EVP_CIPHER *EVP_des_ede_cfb1(void); | ||
| 652 | const EVP_CIPHER *EVP_des_ede_cfb8(void); | ||
| 653 | #endif | ||
| 654 | const EVP_CIPHER *EVP_des_ede3_cfb64(void); | ||
| 655 | # define EVP_des_ede3_cfb EVP_des_ede3_cfb64 | ||
| 656 | const EVP_CIPHER *EVP_des_ede3_cfb1(void); | ||
| 657 | const EVP_CIPHER *EVP_des_ede3_cfb8(void); | ||
| 658 | const EVP_CIPHER *EVP_des_ofb(void); | ||
| 659 | const EVP_CIPHER *EVP_des_ede_ofb(void); | ||
| 660 | const EVP_CIPHER *EVP_des_ede3_ofb(void); | ||
| 661 | const EVP_CIPHER *EVP_des_cbc(void); | ||
| 662 | const EVP_CIPHER *EVP_des_ede_cbc(void); | ||
| 663 | const EVP_CIPHER *EVP_des_ede3_cbc(void); | ||
| 664 | const EVP_CIPHER *EVP_desx_cbc(void); | ||
| 665 | /* This should now be supported through the dev_crypto ENGINE. But also, why are | ||
| 666 | * rc4 and md5 declarations made here inside a "NO_DES" precompiler branch? */ | ||
| 667 | #if 0 | ||
| 668 | # ifdef OPENSSL_OPENBSD_DEV_CRYPTO | ||
| 669 | const EVP_CIPHER *EVP_dev_crypto_des_ede3_cbc(void); | ||
| 670 | const EVP_CIPHER *EVP_dev_crypto_rc4(void); | ||
| 671 | const EVP_MD *EVP_dev_crypto_md5(void); | ||
| 672 | # endif | ||
| 673 | #endif | ||
| 674 | #endif | ||
| 675 | #ifndef OPENSSL_NO_RC4 | ||
| 676 | const EVP_CIPHER *EVP_rc4(void); | ||
| 677 | const EVP_CIPHER *EVP_rc4_40(void); | ||
| 678 | #endif | ||
| 679 | #ifndef OPENSSL_NO_IDEA | ||
| 680 | const EVP_CIPHER *EVP_idea_ecb(void); | ||
| 681 | const EVP_CIPHER *EVP_idea_cfb64(void); | ||
| 682 | # define EVP_idea_cfb EVP_idea_cfb64 | ||
| 683 | const EVP_CIPHER *EVP_idea_ofb(void); | ||
| 684 | const EVP_CIPHER *EVP_idea_cbc(void); | ||
| 685 | #endif | ||
| 686 | #ifndef OPENSSL_NO_RC2 | ||
| 687 | const EVP_CIPHER *EVP_rc2_ecb(void); | ||
| 688 | const EVP_CIPHER *EVP_rc2_cbc(void); | ||
| 689 | const EVP_CIPHER *EVP_rc2_40_cbc(void); | ||
| 690 | const EVP_CIPHER *EVP_rc2_64_cbc(void); | ||
| 691 | const EVP_CIPHER *EVP_rc2_cfb64(void); | ||
| 692 | # define EVP_rc2_cfb EVP_rc2_cfb64 | ||
| 693 | const EVP_CIPHER *EVP_rc2_ofb(void); | ||
| 694 | #endif | ||
| 695 | #ifndef OPENSSL_NO_BF | ||
| 696 | const EVP_CIPHER *EVP_bf_ecb(void); | ||
| 697 | const EVP_CIPHER *EVP_bf_cbc(void); | ||
| 698 | const EVP_CIPHER *EVP_bf_cfb64(void); | ||
| 699 | # define EVP_bf_cfb EVP_bf_cfb64 | ||
| 700 | const EVP_CIPHER *EVP_bf_ofb(void); | ||
| 701 | #endif | ||
| 702 | #ifndef OPENSSL_NO_CAST | ||
| 703 | const EVP_CIPHER *EVP_cast5_ecb(void); | ||
| 704 | const EVP_CIPHER *EVP_cast5_cbc(void); | ||
| 705 | const EVP_CIPHER *EVP_cast5_cfb64(void); | ||
| 706 | # define EVP_cast5_cfb EVP_cast5_cfb64 | ||
| 707 | const EVP_CIPHER *EVP_cast5_ofb(void); | ||
| 708 | #endif | ||
| 709 | #ifndef OPENSSL_NO_RC5 | ||
| 710 | const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); | ||
| 711 | const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); | ||
| 712 | const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void); | ||
| 713 | # define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64 | ||
| 714 | const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); | ||
| 715 | #endif | ||
| 716 | #ifndef OPENSSL_NO_AES | ||
| 717 | const EVP_CIPHER *EVP_aes_128_ecb(void); | ||
| 718 | const EVP_CIPHER *EVP_aes_128_cbc(void); | ||
| 719 | const EVP_CIPHER *EVP_aes_128_cfb1(void); | ||
| 720 | const EVP_CIPHER *EVP_aes_128_cfb8(void); | ||
| 721 | const EVP_CIPHER *EVP_aes_128_cfb128(void); | ||
| 722 | # define EVP_aes_128_cfb EVP_aes_128_cfb128 | ||
| 723 | const EVP_CIPHER *EVP_aes_128_ofb(void); | ||
| 724 | #if 0 | ||
| 725 | const EVP_CIPHER *EVP_aes_128_ctr(void); | ||
| 726 | #endif | ||
| 727 | const EVP_CIPHER *EVP_aes_192_ecb(void); | ||
| 728 | const EVP_CIPHER *EVP_aes_192_cbc(void); | ||
| 729 | const EVP_CIPHER *EVP_aes_192_cfb1(void); | ||
| 730 | const EVP_CIPHER *EVP_aes_192_cfb8(void); | ||
| 731 | const EVP_CIPHER *EVP_aes_192_cfb128(void); | ||
| 732 | # define EVP_aes_192_cfb EVP_aes_192_cfb128 | ||
| 733 | const EVP_CIPHER *EVP_aes_192_ofb(void); | ||
| 734 | #if 0 | ||
| 735 | const EVP_CIPHER *EVP_aes_192_ctr(void); | ||
| 736 | #endif | ||
| 737 | const EVP_CIPHER *EVP_aes_256_ecb(void); | ||
| 738 | const EVP_CIPHER *EVP_aes_256_cbc(void); | ||
| 739 | const EVP_CIPHER *EVP_aes_256_cfb1(void); | ||
| 740 | const EVP_CIPHER *EVP_aes_256_cfb8(void); | ||
| 741 | const EVP_CIPHER *EVP_aes_256_cfb128(void); | ||
| 742 | # define EVP_aes_256_cfb EVP_aes_256_cfb128 | ||
| 743 | const EVP_CIPHER *EVP_aes_256_ofb(void); | ||
| 744 | #if 0 | ||
| 745 | const EVP_CIPHER *EVP_aes_256_ctr(void); | ||
| 746 | #endif | ||
| 747 | #endif | ||
| 748 | #ifndef OPENSSL_NO_ACSS | ||
| 749 | const EVP_CIPHER *EVP_acss(void); | ||
| 750 | #endif | ||
| 751 | #ifndef OPENSSL_NO_CAMELLIA | ||
| 752 | const EVP_CIPHER *EVP_camellia_128_ecb(void); | ||
| 753 | const EVP_CIPHER *EVP_camellia_128_cbc(void); | ||
| 754 | const EVP_CIPHER *EVP_camellia_128_cfb1(void); | ||
| 755 | const EVP_CIPHER *EVP_camellia_128_cfb8(void); | ||
| 756 | const EVP_CIPHER *EVP_camellia_128_cfb128(void); | ||
| 757 | # define EVP_camellia_128_cfb EVP_camellia_128_cfb128 | ||
| 758 | const EVP_CIPHER *EVP_camellia_128_ofb(void); | ||
| 759 | const EVP_CIPHER *EVP_camellia_192_ecb(void); | ||
| 760 | const EVP_CIPHER *EVP_camellia_192_cbc(void); | ||
| 761 | const EVP_CIPHER *EVP_camellia_192_cfb1(void); | ||
| 762 | const EVP_CIPHER *EVP_camellia_192_cfb8(void); | ||
| 763 | const EVP_CIPHER *EVP_camellia_192_cfb128(void); | ||
| 764 | # define EVP_camellia_192_cfb EVP_camellia_192_cfb128 | ||
| 765 | const EVP_CIPHER *EVP_camellia_192_ofb(void); | ||
| 766 | const EVP_CIPHER *EVP_camellia_256_ecb(void); | ||
| 767 | const EVP_CIPHER *EVP_camellia_256_cbc(void); | ||
| 768 | const EVP_CIPHER *EVP_camellia_256_cfb1(void); | ||
| 769 | const EVP_CIPHER *EVP_camellia_256_cfb8(void); | ||
| 770 | const EVP_CIPHER *EVP_camellia_256_cfb128(void); | ||
| 771 | # define EVP_camellia_256_cfb EVP_camellia_256_cfb128 | ||
| 772 | const EVP_CIPHER *EVP_camellia_256_ofb(void); | ||
| 773 | #endif | ||
| 774 | |||
| 775 | #ifndef OPENSSL_NO_SEED | ||
| 776 | const EVP_CIPHER *EVP_seed_ecb(void); | ||
| 777 | const EVP_CIPHER *EVP_seed_cbc(void); | ||
| 778 | const EVP_CIPHER *EVP_seed_cfb128(void); | ||
| 779 | # define EVP_seed_cfb EVP_seed_cfb128 | ||
| 780 | const EVP_CIPHER *EVP_seed_ofb(void); | ||
| 781 | #endif | ||
| 782 | |||
| 783 | void OPENSSL_add_all_algorithms_noconf(void); | ||
| 784 | void OPENSSL_add_all_algorithms_conf(void); | ||
| 785 | |||
| 786 | #ifdef OPENSSL_LOAD_CONF | ||
| 787 | #define OpenSSL_add_all_algorithms() \ | ||
| 788 | OPENSSL_add_all_algorithms_conf() | ||
| 789 | #else | ||
| 790 | #define OpenSSL_add_all_algorithms() \ | ||
| 791 | OPENSSL_add_all_algorithms_noconf() | ||
| 792 | #endif | ||
| 793 | |||
| 794 | void OpenSSL_add_all_ciphers(void); | ||
| 795 | void OpenSSL_add_all_digests(void); | ||
| 796 | #define SSLeay_add_all_algorithms() OpenSSL_add_all_algorithms() | ||
| 797 | #define SSLeay_add_all_ciphers() OpenSSL_add_all_ciphers() | ||
| 798 | #define SSLeay_add_all_digests() OpenSSL_add_all_digests() | ||
| 799 | |||
| 800 | int EVP_add_cipher(const EVP_CIPHER *cipher); | ||
| 801 | int EVP_add_digest(const EVP_MD *digest); | ||
| 802 | |||
| 803 | const EVP_CIPHER *EVP_get_cipherbyname(const char *name); | ||
| 804 | const EVP_MD *EVP_get_digestbyname(const char *name); | ||
| 805 | void EVP_cleanup(void); | ||
| 806 | |||
| 807 | int EVP_PKEY_decrypt(unsigned char *dec_key, | ||
| 808 | const unsigned char *enc_key,int enc_key_len, | ||
| 809 | EVP_PKEY *private_key); | ||
| 810 | int EVP_PKEY_encrypt(unsigned char *enc_key, | ||
| 811 | const unsigned char *key,int key_len, | ||
| 812 | EVP_PKEY *pub_key); | ||
| 813 | int EVP_PKEY_type(int type); | ||
| 814 | int EVP_PKEY_bits(EVP_PKEY *pkey); | ||
| 815 | int EVP_PKEY_size(EVP_PKEY *pkey); | ||
| 816 | int EVP_PKEY_assign(EVP_PKEY *pkey,int type,char *key); | ||
| 817 | |||
| 818 | #ifndef OPENSSL_NO_RSA | ||
| 819 | struct rsa_st; | ||
| 820 | int EVP_PKEY_set1_RSA(EVP_PKEY *pkey,struct rsa_st *key); | ||
| 821 | struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); | ||
| 822 | #endif | ||
| 823 | #ifndef OPENSSL_NO_DSA | ||
| 824 | struct dsa_st; | ||
| 825 | int EVP_PKEY_set1_DSA(EVP_PKEY *pkey,struct dsa_st *key); | ||
| 826 | struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); | ||
| 827 | #endif | ||
| 828 | #ifndef OPENSSL_NO_DH | ||
| 829 | struct dh_st; | ||
| 830 | int EVP_PKEY_set1_DH(EVP_PKEY *pkey,struct dh_st *key); | ||
| 831 | struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); | ||
| 832 | #endif | ||
| 833 | #ifndef OPENSSL_NO_EC | ||
| 834 | struct ec_key_st; | ||
| 835 | int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey,struct ec_key_st *key); | ||
| 836 | struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); | ||
| 837 | #endif | ||
| 838 | |||
| 839 | EVP_PKEY * EVP_PKEY_new(void); | ||
| 840 | void EVP_PKEY_free(EVP_PKEY *pkey); | ||
| 841 | |||
| 842 | EVP_PKEY * d2i_PublicKey(int type,EVP_PKEY **a, const unsigned char **pp, | ||
| 843 | long length); | ||
| 844 | int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp); | ||
| 845 | |||
| 846 | EVP_PKEY * d2i_PrivateKey(int type,EVP_PKEY **a, const unsigned char **pp, | ||
| 847 | long length); | ||
| 848 | EVP_PKEY * d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, | ||
| 849 | long length); | ||
| 850 | int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp); | ||
| 851 | |||
| 852 | int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); | ||
| 853 | int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); | ||
| 854 | int EVP_PKEY_save_parameters(EVP_PKEY *pkey,int mode); | ||
| 855 | int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); | ||
| 856 | |||
| 857 | int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); | ||
| 858 | |||
| 859 | int EVP_CIPHER_type(const EVP_CIPHER *ctx); | ||
| 860 | |||
| 861 | /* calls methods */ | ||
| 862 | int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | ||
| 863 | int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | ||
| 864 | |||
| 865 | /* These are used by EVP_CIPHER methods */ | ||
| 866 | int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type); | ||
| 867 | int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type); | ||
| 868 | |||
| 869 | /* PKCS5 password based encryption */ | ||
| 870 | int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | ||
| 871 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, | ||
| 872 | int en_de); | ||
| 873 | int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, | ||
| 874 | const unsigned char *salt, int saltlen, int iter, | ||
| 875 | int keylen, unsigned char *out); | ||
| 876 | int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | ||
| 877 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, | ||
| 878 | int en_de); | ||
| 879 | |||
| 880 | void PKCS5_PBE_add(void); | ||
| 881 | |||
| 882 | int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen, | ||
| 883 | ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); | ||
| 884 | int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, | ||
| 885 | EVP_PBE_KEYGEN *keygen); | ||
| 886 | void EVP_PBE_cleanup(void); | ||
| 887 | |||
| 888 | /* BEGIN ERROR CODES */ | ||
| 889 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
| 890 | * made after this point may be overwritten when the script is next run. | ||
| 891 | */ | ||
| 892 | void ERR_load_EVP_strings(void); | ||
| 893 | |||
| 894 | /* Error codes for the EVP functions. */ | ||
| 895 | |||
| 896 | /* Function codes. */ | ||
| 897 | #define EVP_F_AES_INIT_KEY 133 | ||
| 898 | #define EVP_F_CAMELLIA_INIT_KEY 159 | ||
| 899 | #define EVP_F_D2I_PKEY 100 | ||
| 900 | #define EVP_F_DSAPKEY2PKCS8 134 | ||
| 901 | #define EVP_F_DSA_PKEY2PKCS8 135 | ||
| 902 | #define EVP_F_ECDSA_PKEY2PKCS8 129 | ||
| 903 | #define EVP_F_ECKEY_PKEY2PKCS8 132 | ||
| 904 | #define EVP_F_EVP_CIPHERINIT_EX 123 | ||
| 905 | #define EVP_F_EVP_CIPHER_CTX_CTRL 124 | ||
| 906 | #define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122 | ||
| 907 | #define EVP_F_EVP_DECRYPTFINAL_EX 101 | ||
| 908 | #define EVP_F_EVP_DIGESTINIT_EX 128 | ||
| 909 | #define EVP_F_EVP_ENCRYPTFINAL_EX 127 | ||
| 910 | #define EVP_F_EVP_MD_CTX_COPY_EX 110 | ||
| 911 | #define EVP_F_EVP_OPENINIT 102 | ||
| 912 | #define EVP_F_EVP_PBE_ALG_ADD 115 | ||
| 913 | #define EVP_F_EVP_PBE_CIPHERINIT 116 | ||
| 914 | #define EVP_F_EVP_PKCS82PKEY 111 | ||
| 915 | #define EVP_F_EVP_PKEY2PKCS8_BROKEN 113 | ||
| 916 | #define EVP_F_EVP_PKEY_COPY_PARAMETERS 103 | ||
| 917 | #define EVP_F_EVP_PKEY_DECRYPT 104 | ||
| 918 | #define EVP_F_EVP_PKEY_ENCRYPT 105 | ||
| 919 | #define EVP_F_EVP_PKEY_GET1_DH 119 | ||
| 920 | #define EVP_F_EVP_PKEY_GET1_DSA 120 | ||
| 921 | #define EVP_F_EVP_PKEY_GET1_ECDSA 130 | ||
| 922 | #define EVP_F_EVP_PKEY_GET1_EC_KEY 131 | ||
| 923 | #define EVP_F_EVP_PKEY_GET1_RSA 121 | ||
| 924 | #define EVP_F_EVP_PKEY_NEW 106 | ||
| 925 | #define EVP_F_EVP_RIJNDAEL 126 | ||
| 926 | #define EVP_F_EVP_SIGNFINAL 107 | ||
| 927 | #define EVP_F_EVP_VERIFYFINAL 108 | ||
| 928 | #define EVP_F_PKCS5_PBE_KEYIVGEN 117 | ||
| 929 | #define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118 | ||
| 930 | #define EVP_F_PKCS8_SET_BROKEN 112 | ||
| 931 | #define EVP_F_RC2_MAGIC_TO_METH 109 | ||
| 932 | #define EVP_F_RC5_CTRL 125 | ||
| 933 | |||
| 934 | /* Reason codes. */ | ||
| 935 | #define EVP_R_AES_KEY_SETUP_FAILED 143 | ||
| 936 | #define EVP_R_ASN1_LIB 140 | ||
| 937 | #define EVP_R_BAD_BLOCK_LENGTH 136 | ||
| 938 | #define EVP_R_BAD_DECRYPT 100 | ||
| 939 | #define EVP_R_BAD_KEY_LENGTH 137 | ||
| 940 | #define EVP_R_BN_DECODE_ERROR 112 | ||
| 941 | #define EVP_R_BN_PUBKEY_ERROR 113 | ||
| 942 | #define EVP_R_CAMELLIA_KEY_SETUP_FAILED 157 | ||
| 943 | #define EVP_R_CIPHER_PARAMETER_ERROR 122 | ||
| 944 | #define EVP_R_CTRL_NOT_IMPLEMENTED 132 | ||
| 945 | #define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133 | ||
| 946 | #define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138 | ||
| 947 | #define EVP_R_DECODE_ERROR 114 | ||
| 948 | #define EVP_R_DIFFERENT_KEY_TYPES 101 | ||
| 949 | #define EVP_R_ENCODE_ERROR 115 | ||
| 950 | #define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119 | ||
| 951 | #define EVP_R_EXPECTING_AN_RSA_KEY 127 | ||
| 952 | #define EVP_R_EXPECTING_A_DH_KEY 128 | ||
| 953 | #define EVP_R_EXPECTING_A_DSA_KEY 129 | ||
| 954 | #define EVP_R_EXPECTING_A_ECDSA_KEY 141 | ||
| 955 | #define EVP_R_EXPECTING_A_EC_KEY 142 | ||
| 956 | #define EVP_R_INITIALIZATION_ERROR 134 | ||
| 957 | #define EVP_R_INPUT_NOT_INITIALIZED 111 | ||
| 958 | #define EVP_R_INVALID_KEY_LENGTH 130 | ||
| 959 | #define EVP_R_IV_TOO_LARGE 102 | ||
| 960 | #define EVP_R_KEYGEN_FAILURE 120 | ||
| 961 | #define EVP_R_MISSING_PARAMETERS 103 | ||
| 962 | #define EVP_R_NO_CIPHER_SET 131 | ||
| 963 | #define EVP_R_NO_DIGEST_SET 139 | ||
| 964 | #define EVP_R_NO_DSA_PARAMETERS 116 | ||
| 965 | #define EVP_R_NO_SIGN_FUNCTION_CONFIGURED 104 | ||
| 966 | #define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105 | ||
| 967 | #define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE 117 | ||
| 968 | #define EVP_R_PUBLIC_KEY_NOT_RSA 106 | ||
| 969 | #define EVP_R_UNKNOWN_PBE_ALGORITHM 121 | ||
| 970 | #define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS 135 | ||
| 971 | #define EVP_R_UNSUPPORTED_CIPHER 107 | ||
| 972 | #define EVP_R_UNSUPPORTED_KEYLENGTH 123 | ||
| 973 | #define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 124 | ||
| 974 | #define EVP_R_UNSUPPORTED_KEY_SIZE 108 | ||
| 975 | #define EVP_R_UNSUPPORTED_PRF 125 | ||
| 976 | #define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM 118 | ||
| 977 | #define EVP_R_UNSUPPORTED_SALT_TYPE 126 | ||
| 978 | #define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109 | ||
| 979 | #define EVP_R_WRONG_PUBLIC_KEY_TYPE 110 | ||
| 980 | #define EVP_R_SEED_KEY_SETUP_FAILED 162 | ||
| 981 | |||
| 982 | #ifdef __cplusplus | ||
| 983 | } | ||
| 984 | #endif | ||
| 985 | #endif | ||
diff --git a/src/lib/libcrypto/evp/evp_acnf.c b/src/lib/libcrypto/evp/evp_acnf.c index 643a1864e8..ff3e311cc5 100644 --- a/src/lib/libcrypto/evp/evp_acnf.c +++ b/src/lib/libcrypto/evp/evp_acnf.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* evp_acnf.c */ | 1 | /* evp_acnf.c */ |
| 2 | /* Written by Stephen Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Stephen Henson (shenson@bigfoot.com) for the OpenSSL |
| 3 | * project 2001. | 3 | * project 2001. |
| 4 | */ | 4 | */ |
| 5 | /* ==================================================================== | 5 | /* ==================================================================== |
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c new file mode 100644 index 0000000000..6e582c458d --- /dev/null +++ b/src/lib/libcrypto/evp/evp_enc.c | |||
| @@ -0,0 +1,568 @@ | |||
| 1 | /* crypto/evp/evp_enc.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/evp.h> | ||
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/rand.h> | ||
| 64 | #ifndef OPENSSL_NO_ENGINE | ||
| 65 | #include <openssl/engine.h> | ||
| 66 | #endif | ||
| 67 | #include "evp_locl.h" | ||
| 68 | |||
| 69 | const char EVP_version[]="EVP" OPENSSL_VERSION_PTEXT; | ||
| 70 | |||
| 71 | void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx) | ||
| 72 | { | ||
| 73 | memset(ctx,0,sizeof(EVP_CIPHER_CTX)); | ||
| 74 | /* ctx->cipher=NULL; */ | ||
| 75 | } | ||
| 76 | |||
| 77 | EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void) | ||
| 78 | { | ||
| 79 | EVP_CIPHER_CTX *ctx=OPENSSL_malloc(sizeof *ctx); | ||
| 80 | if (ctx) | ||
| 81 | EVP_CIPHER_CTX_init(ctx); | ||
| 82 | return ctx; | ||
| 83 | } | ||
| 84 | |||
| 85 | int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, | ||
| 86 | const unsigned char *key, const unsigned char *iv, int enc) | ||
| 87 | { | ||
| 88 | if (cipher) | ||
| 89 | EVP_CIPHER_CTX_init(ctx); | ||
| 90 | return EVP_CipherInit_ex(ctx,cipher,NULL,key,iv,enc); | ||
| 91 | } | ||
| 92 | |||
| 93 | int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, | ||
| 94 | const unsigned char *key, const unsigned char *iv, int enc) | ||
| 95 | { | ||
| 96 | if (enc == -1) | ||
| 97 | enc = ctx->encrypt; | ||
| 98 | else | ||
| 99 | { | ||
| 100 | if (enc) | ||
| 101 | enc = 1; | ||
| 102 | ctx->encrypt = enc; | ||
| 103 | } | ||
| 104 | #ifndef OPENSSL_NO_ENGINE | ||
| 105 | /* Whether it's nice or not, "Inits" can be used on "Final"'d contexts | ||
| 106 | * so this context may already have an ENGINE! Try to avoid releasing | ||
| 107 | * the previous handle, re-querying for an ENGINE, and having a | ||
| 108 | * reinitialisation, when it may all be unecessary. */ | ||
| 109 | if (ctx->engine && ctx->cipher && (!cipher || | ||
| 110 | (cipher && (cipher->nid == ctx->cipher->nid)))) | ||
| 111 | goto skip_to_init; | ||
| 112 | #endif | ||
| 113 | if (cipher) | ||
| 114 | { | ||
| 115 | /* Ensure a context left lying around from last time is cleared | ||
| 116 | * (the previous check attempted to avoid this if the same | ||
| 117 | * ENGINE and EVP_CIPHER could be used). */ | ||
| 118 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 119 | |||
| 120 | /* Restore encrypt field: it is zeroed by cleanup */ | ||
| 121 | ctx->encrypt = enc; | ||
| 122 | #ifndef OPENSSL_NO_ENGINE | ||
| 123 | if(impl) | ||
| 124 | { | ||
| 125 | if (!ENGINE_init(impl)) | ||
| 126 | { | ||
| 127 | EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR); | ||
| 128 | return 0; | ||
| 129 | } | ||
| 130 | } | ||
| 131 | else | ||
| 132 | /* Ask if an ENGINE is reserved for this job */ | ||
| 133 | impl = ENGINE_get_cipher_engine(cipher->nid); | ||
| 134 | if(impl) | ||
| 135 | { | ||
| 136 | /* There's an ENGINE for this job ... (apparently) */ | ||
| 137 | const EVP_CIPHER *c = ENGINE_get_cipher(impl, cipher->nid); | ||
| 138 | if(!c) | ||
| 139 | { | ||
| 140 | /* One positive side-effect of US's export | ||
| 141 | * control history, is that we should at least | ||
| 142 | * be able to avoid using US mispellings of | ||
| 143 | * "initialisation"? */ | ||
| 144 | EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR); | ||
| 145 | return 0; | ||
| 146 | } | ||
| 147 | /* We'll use the ENGINE's private cipher definition */ | ||
| 148 | cipher = c; | ||
| 149 | /* Store the ENGINE functional reference so we know | ||
| 150 | * 'cipher' came from an ENGINE and we need to release | ||
| 151 | * it when done. */ | ||
| 152 | ctx->engine = impl; | ||
| 153 | } | ||
| 154 | else | ||
| 155 | ctx->engine = NULL; | ||
| 156 | #endif | ||
| 157 | |||
| 158 | ctx->cipher=cipher; | ||
| 159 | if (ctx->cipher->ctx_size) | ||
| 160 | { | ||
| 161 | ctx->cipher_data=OPENSSL_malloc(ctx->cipher->ctx_size); | ||
| 162 | if (!ctx->cipher_data) | ||
| 163 | { | ||
| 164 | EVPerr(EVP_F_EVP_CIPHERINIT_EX, ERR_R_MALLOC_FAILURE); | ||
| 165 | return 0; | ||
| 166 | } | ||
| 167 | } | ||
| 168 | else | ||
| 169 | { | ||
| 170 | ctx->cipher_data = NULL; | ||
| 171 | } | ||
| 172 | ctx->key_len = cipher->key_len; | ||
| 173 | ctx->flags = 0; | ||
| 174 | if(ctx->cipher->flags & EVP_CIPH_CTRL_INIT) | ||
| 175 | { | ||
| 176 | if(!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_INIT, 0, NULL)) | ||
| 177 | { | ||
| 178 | EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR); | ||
| 179 | return 0; | ||
| 180 | } | ||
| 181 | } | ||
| 182 | } | ||
| 183 | else if(!ctx->cipher) | ||
| 184 | { | ||
| 185 | EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_NO_CIPHER_SET); | ||
| 186 | return 0; | ||
| 187 | } | ||
| 188 | #ifndef OPENSSL_NO_ENGINE | ||
| 189 | skip_to_init: | ||
| 190 | #endif | ||
| 191 | /* we assume block size is a power of 2 in *cryptUpdate */ | ||
| 192 | OPENSSL_assert(ctx->cipher->block_size == 1 | ||
| 193 | || ctx->cipher->block_size == 8 | ||
| 194 | || ctx->cipher->block_size == 16); | ||
| 195 | |||
| 196 | if(!(EVP_CIPHER_CTX_flags(ctx) & EVP_CIPH_CUSTOM_IV)) { | ||
| 197 | switch(EVP_CIPHER_CTX_mode(ctx)) { | ||
| 198 | |||
| 199 | case EVP_CIPH_STREAM_CIPHER: | ||
| 200 | case EVP_CIPH_ECB_MODE: | ||
| 201 | break; | ||
| 202 | |||
| 203 | case EVP_CIPH_CFB_MODE: | ||
| 204 | case EVP_CIPH_OFB_MODE: | ||
| 205 | |||
| 206 | ctx->num = 0; | ||
| 207 | |||
| 208 | case EVP_CIPH_CBC_MODE: | ||
| 209 | |||
| 210 | OPENSSL_assert(EVP_CIPHER_CTX_iv_length(ctx) <= | ||
| 211 | (int)sizeof(ctx->iv)); | ||
| 212 | if(iv) memcpy(ctx->oiv, iv, EVP_CIPHER_CTX_iv_length(ctx)); | ||
| 213 | memcpy(ctx->iv, ctx->oiv, EVP_CIPHER_CTX_iv_length(ctx)); | ||
| 214 | break; | ||
| 215 | |||
| 216 | default: | ||
| 217 | return 0; | ||
| 218 | break; | ||
| 219 | } | ||
| 220 | } | ||
| 221 | |||
| 222 | if(key || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT)) { | ||
| 223 | if(!ctx->cipher->init(ctx,key,iv,enc)) return 0; | ||
| 224 | } | ||
| 225 | ctx->buf_len=0; | ||
| 226 | ctx->final_used=0; | ||
| 227 | ctx->block_mask=ctx->cipher->block_size-1; | ||
| 228 | return 1; | ||
| 229 | } | ||
| 230 | |||
| 231 | int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, | ||
| 232 | const unsigned char *in, int inl) | ||
| 233 | { | ||
| 234 | if (ctx->encrypt) | ||
| 235 | return EVP_EncryptUpdate(ctx,out,outl,in,inl); | ||
| 236 | else return EVP_DecryptUpdate(ctx,out,outl,in,inl); | ||
| 237 | } | ||
| 238 | |||
| 239 | int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | ||
| 240 | { | ||
| 241 | if (ctx->encrypt) | ||
| 242 | return EVP_EncryptFinal_ex(ctx,out,outl); | ||
| 243 | else return EVP_DecryptFinal_ex(ctx,out,outl); | ||
| 244 | } | ||
| 245 | |||
| 246 | int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | ||
| 247 | { | ||
| 248 | if (ctx->encrypt) | ||
| 249 | return EVP_EncryptFinal(ctx,out,outl); | ||
| 250 | else return EVP_DecryptFinal(ctx,out,outl); | ||
| 251 | } | ||
| 252 | |||
| 253 | int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, | ||
| 254 | const unsigned char *key, const unsigned char *iv) | ||
| 255 | { | ||
| 256 | return EVP_CipherInit(ctx, cipher, key, iv, 1); | ||
| 257 | } | ||
| 258 | |||
| 259 | int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl, | ||
| 260 | const unsigned char *key, const unsigned char *iv) | ||
| 261 | { | ||
| 262 | return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 1); | ||
| 263 | } | ||
| 264 | |||
| 265 | int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, | ||
| 266 | const unsigned char *key, const unsigned char *iv) | ||
| 267 | { | ||
| 268 | return EVP_CipherInit(ctx, cipher, key, iv, 0); | ||
| 269 | } | ||
| 270 | |||
| 271 | int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, | ||
| 272 | const unsigned char *key, const unsigned char *iv) | ||
| 273 | { | ||
| 274 | return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 0); | ||
| 275 | } | ||
| 276 | |||
| 277 | int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, | ||
| 278 | const unsigned char *in, int inl) | ||
| 279 | { | ||
| 280 | int i,j,bl; | ||
| 281 | |||
| 282 | if (inl <= 0) | ||
| 283 | { | ||
| 284 | *outl = 0; | ||
| 285 | return inl == 0; | ||
| 286 | } | ||
| 287 | |||
| 288 | if(ctx->buf_len == 0 && (inl&(ctx->block_mask)) == 0) | ||
| 289 | { | ||
| 290 | if(ctx->cipher->do_cipher(ctx,out,in,inl)) | ||
| 291 | { | ||
| 292 | *outl=inl; | ||
| 293 | return 1; | ||
| 294 | } | ||
| 295 | else | ||
| 296 | { | ||
| 297 | *outl=0; | ||
| 298 | return 0; | ||
| 299 | } | ||
| 300 | } | ||
| 301 | i=ctx->buf_len; | ||
| 302 | bl=ctx->cipher->block_size; | ||
| 303 | OPENSSL_assert(bl <= (int)sizeof(ctx->buf)); | ||
| 304 | if (i != 0) | ||
| 305 | { | ||
| 306 | if (i+inl < bl) | ||
| 307 | { | ||
| 308 | memcpy(&(ctx->buf[i]),in,inl); | ||
| 309 | ctx->buf_len+=inl; | ||
| 310 | *outl=0; | ||
| 311 | return 1; | ||
| 312 | } | ||
| 313 | else | ||
| 314 | { | ||
| 315 | j=bl-i; | ||
| 316 | memcpy(&(ctx->buf[i]),in,j); | ||
| 317 | if(!ctx->cipher->do_cipher(ctx,out,ctx->buf,bl)) return 0; | ||
| 318 | inl-=j; | ||
| 319 | in+=j; | ||
| 320 | out+=bl; | ||
| 321 | *outl=bl; | ||
| 322 | } | ||
| 323 | } | ||
| 324 | else | ||
| 325 | *outl = 0; | ||
| 326 | i=inl&(bl-1); | ||
| 327 | inl-=i; | ||
| 328 | if (inl > 0) | ||
| 329 | { | ||
| 330 | if(!ctx->cipher->do_cipher(ctx,out,in,inl)) return 0; | ||
| 331 | *outl+=inl; | ||
| 332 | } | ||
| 333 | |||
| 334 | if (i != 0) | ||
| 335 | memcpy(ctx->buf,&(in[inl]),i); | ||
| 336 | ctx->buf_len=i; | ||
| 337 | return 1; | ||
| 338 | } | ||
| 339 | |||
| 340 | int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | ||
| 341 | { | ||
| 342 | int ret; | ||
| 343 | ret = EVP_EncryptFinal_ex(ctx, out, outl); | ||
| 344 | return ret; | ||
| 345 | } | ||
| 346 | |||
| 347 | int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | ||
| 348 | { | ||
| 349 | int n,ret; | ||
| 350 | unsigned int i, b, bl; | ||
| 351 | |||
| 352 | b=ctx->cipher->block_size; | ||
| 353 | OPENSSL_assert(b <= sizeof ctx->buf); | ||
| 354 | if (b == 1) | ||
| 355 | { | ||
| 356 | *outl=0; | ||
| 357 | return 1; | ||
| 358 | } | ||
| 359 | bl=ctx->buf_len; | ||
| 360 | if (ctx->flags & EVP_CIPH_NO_PADDING) | ||
| 361 | { | ||
| 362 | if(bl) | ||
| 363 | { | ||
| 364 | EVPerr(EVP_F_EVP_ENCRYPTFINAL_EX,EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH); | ||
| 365 | return 0; | ||
| 366 | } | ||
| 367 | *outl = 0; | ||
| 368 | return 1; | ||
| 369 | } | ||
| 370 | |||
| 371 | n=b-bl; | ||
| 372 | for (i=bl; i<b; i++) | ||
| 373 | ctx->buf[i]=n; | ||
| 374 | ret=ctx->cipher->do_cipher(ctx,out,ctx->buf,b); | ||
| 375 | |||
| 376 | |||
| 377 | if(ret) | ||
| 378 | *outl=b; | ||
| 379 | |||
| 380 | return ret; | ||
| 381 | } | ||
| 382 | |||
| 383 | int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, | ||
| 384 | const unsigned char *in, int inl) | ||
| 385 | { | ||
| 386 | int fix_len; | ||
| 387 | unsigned int b; | ||
| 388 | |||
| 389 | if (inl <= 0) | ||
| 390 | { | ||
| 391 | *outl = 0; | ||
| 392 | return inl == 0; | ||
| 393 | } | ||
| 394 | |||
| 395 | if (ctx->flags & EVP_CIPH_NO_PADDING) | ||
| 396 | return EVP_EncryptUpdate(ctx, out, outl, in, inl); | ||
| 397 | |||
| 398 | b=ctx->cipher->block_size; | ||
| 399 | OPENSSL_assert(b <= sizeof ctx->final); | ||
| 400 | |||
| 401 | if(ctx->final_used) | ||
| 402 | { | ||
| 403 | memcpy(out,ctx->final,b); | ||
| 404 | out+=b; | ||
| 405 | fix_len = 1; | ||
| 406 | } | ||
| 407 | else | ||
| 408 | fix_len = 0; | ||
| 409 | |||
| 410 | |||
| 411 | if(!EVP_EncryptUpdate(ctx,out,outl,in,inl)) | ||
| 412 | return 0; | ||
| 413 | |||
| 414 | /* if we have 'decrypted' a multiple of block size, make sure | ||
| 415 | * we have a copy of this last block */ | ||
| 416 | if (b > 1 && !ctx->buf_len) | ||
| 417 | { | ||
| 418 | *outl-=b; | ||
| 419 | ctx->final_used=1; | ||
| 420 | memcpy(ctx->final,&out[*outl],b); | ||
| 421 | } | ||
| 422 | else | ||
| 423 | ctx->final_used = 0; | ||
| 424 | |||
| 425 | if (fix_len) | ||
| 426 | *outl += b; | ||
| 427 | |||
| 428 | return 1; | ||
| 429 | } | ||
| 430 | |||
| 431 | int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | ||
| 432 | { | ||
| 433 | int ret; | ||
| 434 | ret = EVP_DecryptFinal_ex(ctx, out, outl); | ||
| 435 | return ret; | ||
| 436 | } | ||
| 437 | |||
| 438 | int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | ||
| 439 | { | ||
| 440 | int i,n; | ||
| 441 | unsigned int b; | ||
| 442 | |||
| 443 | *outl=0; | ||
| 444 | b=ctx->cipher->block_size; | ||
| 445 | if (ctx->flags & EVP_CIPH_NO_PADDING) | ||
| 446 | { | ||
| 447 | if(ctx->buf_len) | ||
| 448 | { | ||
| 449 | EVPerr(EVP_F_EVP_DECRYPTFINAL_EX,EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH); | ||
| 450 | return 0; | ||
| 451 | } | ||
| 452 | *outl = 0; | ||
| 453 | return 1; | ||
| 454 | } | ||
| 455 | if (b > 1) | ||
| 456 | { | ||
| 457 | if (ctx->buf_len || !ctx->final_used) | ||
| 458 | { | ||
| 459 | EVPerr(EVP_F_EVP_DECRYPTFINAL_EX,EVP_R_WRONG_FINAL_BLOCK_LENGTH); | ||
| 460 | return(0); | ||
| 461 | } | ||
| 462 | OPENSSL_assert(b <= sizeof ctx->final); | ||
| 463 | n=ctx->final[b-1]; | ||
| 464 | if (n == 0 || n > (int)b) | ||
| 465 | { | ||
| 466 | EVPerr(EVP_F_EVP_DECRYPTFINAL_EX,EVP_R_BAD_DECRYPT); | ||
| 467 | return(0); | ||
| 468 | } | ||
| 469 | for (i=0; i<n; i++) | ||
| 470 | { | ||
| 471 | if (ctx->final[--b] != n) | ||
| 472 | { | ||
| 473 | EVPerr(EVP_F_EVP_DECRYPTFINAL_EX,EVP_R_BAD_DECRYPT); | ||
| 474 | return(0); | ||
| 475 | } | ||
| 476 | } | ||
| 477 | n=ctx->cipher->block_size-n; | ||
| 478 | for (i=0; i<n; i++) | ||
| 479 | out[i]=ctx->final[i]; | ||
| 480 | *outl=n; | ||
| 481 | } | ||
| 482 | else | ||
| 483 | *outl=0; | ||
| 484 | return(1); | ||
| 485 | } | ||
| 486 | |||
| 487 | void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx) | ||
| 488 | { | ||
| 489 | if (ctx) | ||
| 490 | { | ||
| 491 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 492 | OPENSSL_free(ctx); | ||
| 493 | } | ||
| 494 | } | ||
| 495 | |||
| 496 | int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) | ||
| 497 | { | ||
| 498 | if (c->cipher != NULL) | ||
| 499 | { | ||
| 500 | if(c->cipher->cleanup && !c->cipher->cleanup(c)) | ||
| 501 | return 0; | ||
| 502 | /* Cleanse cipher context data */ | ||
| 503 | if (c->cipher_data) | ||
| 504 | OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size); | ||
| 505 | } | ||
| 506 | if (c->cipher_data) | ||
| 507 | OPENSSL_free(c->cipher_data); | ||
| 508 | #ifndef OPENSSL_NO_ENGINE | ||
| 509 | if (c->engine) | ||
| 510 | /* The EVP_CIPHER we used belongs to an ENGINE, release the | ||
| 511 | * functional reference we held for this reason. */ | ||
| 512 | ENGINE_finish(c->engine); | ||
| 513 | #endif | ||
| 514 | memset(c,0,sizeof(EVP_CIPHER_CTX)); | ||
| 515 | return 1; | ||
| 516 | } | ||
| 517 | |||
| 518 | int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, int keylen) | ||
| 519 | { | ||
| 520 | if(c->cipher->flags & EVP_CIPH_CUSTOM_KEY_LENGTH) | ||
| 521 | return EVP_CIPHER_CTX_ctrl(c, EVP_CTRL_SET_KEY_LENGTH, keylen, NULL); | ||
| 522 | if(c->key_len == keylen) return 1; | ||
| 523 | if((keylen > 0) && (c->cipher->flags & EVP_CIPH_VARIABLE_LENGTH)) | ||
| 524 | { | ||
| 525 | c->key_len = keylen; | ||
| 526 | return 1; | ||
| 527 | } | ||
| 528 | EVPerr(EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH,EVP_R_INVALID_KEY_LENGTH); | ||
| 529 | return 0; | ||
| 530 | } | ||
| 531 | |||
| 532 | int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int pad) | ||
| 533 | { | ||
| 534 | if (pad) ctx->flags &= ~EVP_CIPH_NO_PADDING; | ||
| 535 | else ctx->flags |= EVP_CIPH_NO_PADDING; | ||
| 536 | return 1; | ||
| 537 | } | ||
| 538 | |||
| 539 | int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) | ||
| 540 | { | ||
| 541 | int ret; | ||
| 542 | if(!ctx->cipher) { | ||
| 543 | EVPerr(EVP_F_EVP_CIPHER_CTX_CTRL, EVP_R_NO_CIPHER_SET); | ||
| 544 | return 0; | ||
| 545 | } | ||
| 546 | |||
| 547 | if(!ctx->cipher->ctrl) { | ||
| 548 | EVPerr(EVP_F_EVP_CIPHER_CTX_CTRL, EVP_R_CTRL_NOT_IMPLEMENTED); | ||
| 549 | return 0; | ||
| 550 | } | ||
| 551 | |||
| 552 | ret = ctx->cipher->ctrl(ctx, type, arg, ptr); | ||
| 553 | if(ret == -1) { | ||
| 554 | EVPerr(EVP_F_EVP_CIPHER_CTX_CTRL, EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED); | ||
| 555 | return 0; | ||
| 556 | } | ||
| 557 | return ret; | ||
| 558 | } | ||
| 559 | |||
| 560 | int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key) | ||
| 561 | { | ||
| 562 | if (ctx->cipher->flags & EVP_CIPH_RAND_KEY) | ||
| 563 | return EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_RAND_KEY, 0, key); | ||
| 564 | if (RAND_bytes(key, ctx->key_len) <= 0) | ||
| 565 | return 0; | ||
| 566 | return 1; | ||
| 567 | } | ||
| 568 | |||
diff --git a/src/lib/libcrypto/evp/evp_err.c b/src/lib/libcrypto/evp/evp_err.c new file mode 100644 index 0000000000..e8c9e8de9c --- /dev/null +++ b/src/lib/libcrypto/evp/evp_err.c | |||
| @@ -0,0 +1,174 @@ | |||
| 1 | /* crypto/evp/evp_err.c */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@OpenSSL.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | * This product includes cryptographic software written by Eric Young | ||
| 51 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 52 | * Hudson (tjh@cryptsoft.com). | ||
| 53 | * | ||
| 54 | */ | ||
| 55 | |||
| 56 | /* NOTE: this file was auto generated by the mkerr.pl script: any changes | ||
| 57 | * made to it will be overwritten when the script next updates this file, | ||
| 58 | * only reason strings will be preserved. | ||
| 59 | */ | ||
| 60 | |||
| 61 | #include <stdio.h> | ||
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/evp.h> | ||
| 64 | |||
| 65 | /* BEGIN ERROR CODES */ | ||
| 66 | #ifndef OPENSSL_NO_ERR | ||
| 67 | |||
| 68 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_EVP,func,0) | ||
| 69 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_EVP,0,reason) | ||
| 70 | |||
| 71 | static ERR_STRING_DATA EVP_str_functs[]= | ||
| 72 | { | ||
| 73 | {ERR_FUNC(EVP_F_AES_INIT_KEY), "AES_INIT_KEY"}, | ||
| 74 | {ERR_FUNC(EVP_F_CAMELLIA_INIT_KEY), "CAMELLIA_INIT_KEY"}, | ||
| 75 | {ERR_FUNC(EVP_F_D2I_PKEY), "D2I_PKEY"}, | ||
| 76 | {ERR_FUNC(EVP_F_DSAPKEY2PKCS8), "DSAPKEY2PKCS8"}, | ||
| 77 | {ERR_FUNC(EVP_F_DSA_PKEY2PKCS8), "DSA_PKEY2PKCS8"}, | ||
| 78 | {ERR_FUNC(EVP_F_ECDSA_PKEY2PKCS8), "ECDSA_PKEY2PKCS8"}, | ||
| 79 | {ERR_FUNC(EVP_F_ECKEY_PKEY2PKCS8), "ECKEY_PKEY2PKCS8"}, | ||
| 80 | {ERR_FUNC(EVP_F_EVP_CIPHERINIT_EX), "EVP_CipherInit_ex"}, | ||
| 81 | {ERR_FUNC(EVP_F_EVP_CIPHER_CTX_CTRL), "EVP_CIPHER_CTX_ctrl"}, | ||
| 82 | {ERR_FUNC(EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH), "EVP_CIPHER_CTX_set_key_length"}, | ||
| 83 | {ERR_FUNC(EVP_F_EVP_DECRYPTFINAL_EX), "EVP_DecryptFinal_ex"}, | ||
| 84 | {ERR_FUNC(EVP_F_EVP_DIGESTINIT_EX), "EVP_DigestInit_ex"}, | ||
| 85 | {ERR_FUNC(EVP_F_EVP_ENCRYPTFINAL_EX), "EVP_EncryptFinal_ex"}, | ||
| 86 | {ERR_FUNC(EVP_F_EVP_MD_CTX_COPY_EX), "EVP_MD_CTX_copy_ex"}, | ||
| 87 | {ERR_FUNC(EVP_F_EVP_OPENINIT), "EVP_OpenInit"}, | ||
| 88 | {ERR_FUNC(EVP_F_EVP_PBE_ALG_ADD), "EVP_PBE_alg_add"}, | ||
| 89 | {ERR_FUNC(EVP_F_EVP_PBE_CIPHERINIT), "EVP_PBE_CipherInit"}, | ||
| 90 | {ERR_FUNC(EVP_F_EVP_PKCS82PKEY), "EVP_PKCS82PKEY"}, | ||
| 91 | {ERR_FUNC(EVP_F_EVP_PKEY2PKCS8_BROKEN), "EVP_PKEY2PKCS8_broken"}, | ||
| 92 | {ERR_FUNC(EVP_F_EVP_PKEY_COPY_PARAMETERS), "EVP_PKEY_copy_parameters"}, | ||
| 93 | {ERR_FUNC(EVP_F_EVP_PKEY_DECRYPT), "EVP_PKEY_decrypt"}, | ||
| 94 | {ERR_FUNC(EVP_F_EVP_PKEY_ENCRYPT), "EVP_PKEY_encrypt"}, | ||
| 95 | {ERR_FUNC(EVP_F_EVP_PKEY_GET1_DH), "EVP_PKEY_get1_DH"}, | ||
| 96 | {ERR_FUNC(EVP_F_EVP_PKEY_GET1_DSA), "EVP_PKEY_get1_DSA"}, | ||
| 97 | {ERR_FUNC(EVP_F_EVP_PKEY_GET1_ECDSA), "EVP_PKEY_GET1_ECDSA"}, | ||
| 98 | {ERR_FUNC(EVP_F_EVP_PKEY_GET1_EC_KEY), "EVP_PKEY_get1_EC_KEY"}, | ||
| 99 | {ERR_FUNC(EVP_F_EVP_PKEY_GET1_RSA), "EVP_PKEY_get1_RSA"}, | ||
| 100 | {ERR_FUNC(EVP_F_EVP_PKEY_NEW), "EVP_PKEY_new"}, | ||
| 101 | {ERR_FUNC(EVP_F_EVP_RIJNDAEL), "EVP_RIJNDAEL"}, | ||
| 102 | {ERR_FUNC(EVP_F_EVP_SIGNFINAL), "EVP_SignFinal"}, | ||
| 103 | {ERR_FUNC(EVP_F_EVP_VERIFYFINAL), "EVP_VerifyFinal"}, | ||
| 104 | {ERR_FUNC(EVP_F_PKCS5_PBE_KEYIVGEN), "PKCS5_PBE_keyivgen"}, | ||
| 105 | {ERR_FUNC(EVP_F_PKCS5_V2_PBE_KEYIVGEN), "PKCS5_v2_PBE_keyivgen"}, | ||
| 106 | {ERR_FUNC(EVP_F_PKCS8_SET_BROKEN), "PKCS8_set_broken"}, | ||
| 107 | {ERR_FUNC(EVP_F_RC2_MAGIC_TO_METH), "RC2_MAGIC_TO_METH"}, | ||
| 108 | {ERR_FUNC(EVP_F_RC5_CTRL), "RC5_CTRL"}, | ||
| 109 | {0,NULL} | ||
| 110 | }; | ||
| 111 | |||
| 112 | static ERR_STRING_DATA EVP_str_reasons[]= | ||
| 113 | { | ||
| 114 | {ERR_REASON(EVP_R_AES_KEY_SETUP_FAILED) ,"aes key setup failed"}, | ||
| 115 | {ERR_REASON(EVP_R_ASN1_LIB) ,"asn1 lib"}, | ||
| 116 | {ERR_REASON(EVP_R_BAD_BLOCK_LENGTH) ,"bad block length"}, | ||
| 117 | {ERR_REASON(EVP_R_BAD_DECRYPT) ,"bad decrypt"}, | ||
| 118 | {ERR_REASON(EVP_R_BAD_KEY_LENGTH) ,"bad key length"}, | ||
| 119 | {ERR_REASON(EVP_R_BN_DECODE_ERROR) ,"bn decode error"}, | ||
| 120 | {ERR_REASON(EVP_R_BN_PUBKEY_ERROR) ,"bn pubkey error"}, | ||
| 121 | {ERR_REASON(EVP_R_CAMELLIA_KEY_SETUP_FAILED),"camellia key setup failed"}, | ||
| 122 | {ERR_REASON(EVP_R_CIPHER_PARAMETER_ERROR),"cipher parameter error"}, | ||
| 123 | {ERR_REASON(EVP_R_CTRL_NOT_IMPLEMENTED) ,"ctrl not implemented"}, | ||
| 124 | {ERR_REASON(EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED),"ctrl operation not implemented"}, | ||
| 125 | {ERR_REASON(EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH),"data not multiple of block length"}, | ||
| 126 | {ERR_REASON(EVP_R_DECODE_ERROR) ,"decode error"}, | ||
| 127 | {ERR_REASON(EVP_R_DIFFERENT_KEY_TYPES) ,"different key types"}, | ||
| 128 | {ERR_REASON(EVP_R_ENCODE_ERROR) ,"encode error"}, | ||
| 129 | {ERR_REASON(EVP_R_EVP_PBE_CIPHERINIT_ERROR),"evp pbe cipherinit error"}, | ||
| 130 | {ERR_REASON(EVP_R_EXPECTING_AN_RSA_KEY) ,"expecting an rsa key"}, | ||
| 131 | {ERR_REASON(EVP_R_EXPECTING_A_DH_KEY) ,"expecting a dh key"}, | ||
| 132 | {ERR_REASON(EVP_R_EXPECTING_A_DSA_KEY) ,"expecting a dsa key"}, | ||
| 133 | {ERR_REASON(EVP_R_EXPECTING_A_ECDSA_KEY) ,"expecting a ecdsa key"}, | ||
| 134 | {ERR_REASON(EVP_R_EXPECTING_A_EC_KEY) ,"expecting a ec key"}, | ||
| 135 | {ERR_REASON(EVP_R_INITIALIZATION_ERROR) ,"initialization error"}, | ||
| 136 | {ERR_REASON(EVP_R_INPUT_NOT_INITIALIZED) ,"input not initialized"}, | ||
| 137 | {ERR_REASON(EVP_R_INVALID_KEY_LENGTH) ,"invalid key length"}, | ||
| 138 | {ERR_REASON(EVP_R_IV_TOO_LARGE) ,"iv too large"}, | ||
| 139 | {ERR_REASON(EVP_R_KEYGEN_FAILURE) ,"keygen failure"}, | ||
| 140 | {ERR_REASON(EVP_R_MISSING_PARAMETERS) ,"missing parameters"}, | ||
| 141 | {ERR_REASON(EVP_R_NO_CIPHER_SET) ,"no cipher set"}, | ||
| 142 | {ERR_REASON(EVP_R_NO_DIGEST_SET) ,"no digest set"}, | ||
| 143 | {ERR_REASON(EVP_R_NO_DSA_PARAMETERS) ,"no dsa parameters"}, | ||
| 144 | {ERR_REASON(EVP_R_NO_SIGN_FUNCTION_CONFIGURED),"no sign function configured"}, | ||
| 145 | {ERR_REASON(EVP_R_NO_VERIFY_FUNCTION_CONFIGURED),"no verify function configured"}, | ||
| 146 | {ERR_REASON(EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE),"pkcs8 unknown broken type"}, | ||
| 147 | {ERR_REASON(EVP_R_PUBLIC_KEY_NOT_RSA) ,"public key not rsa"}, | ||
| 148 | {ERR_REASON(EVP_R_UNKNOWN_PBE_ALGORITHM) ,"unknown pbe algorithm"}, | ||
| 149 | {ERR_REASON(EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS),"unsuported number of rounds"}, | ||
| 150 | {ERR_REASON(EVP_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"}, | ||
| 151 | {ERR_REASON(EVP_R_UNSUPPORTED_KEYLENGTH) ,"unsupported keylength"}, | ||
| 152 | {ERR_REASON(EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION),"unsupported key derivation function"}, | ||
| 153 | {ERR_REASON(EVP_R_UNSUPPORTED_KEY_SIZE) ,"unsupported key size"}, | ||
| 154 | {ERR_REASON(EVP_R_UNSUPPORTED_PRF) ,"unsupported prf"}, | ||
| 155 | {ERR_REASON(EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM),"unsupported private key algorithm"}, | ||
| 156 | {ERR_REASON(EVP_R_UNSUPPORTED_SALT_TYPE) ,"unsupported salt type"}, | ||
| 157 | {ERR_REASON(EVP_R_WRONG_FINAL_BLOCK_LENGTH),"wrong final block length"}, | ||
| 158 | {ERR_REASON(EVP_R_WRONG_PUBLIC_KEY_TYPE) ,"wrong public key type"}, | ||
| 159 | {0,NULL} | ||
| 160 | }; | ||
| 161 | |||
| 162 | #endif | ||
| 163 | |||
| 164 | void ERR_load_EVP_strings(void) | ||
| 165 | { | ||
| 166 | #ifndef OPENSSL_NO_ERR | ||
| 167 | |||
| 168 | if (ERR_func_error_string(EVP_str_functs[0].error) == NULL) | ||
| 169 | { | ||
| 170 | ERR_load_strings(0,EVP_str_functs); | ||
| 171 | ERR_load_strings(0,EVP_str_reasons); | ||
| 172 | } | ||
| 173 | #endif | ||
| 174 | } | ||
diff --git a/src/lib/libcrypto/evp/evp_key.c b/src/lib/libcrypto/evp/evp_key.c new file mode 100644 index 0000000000..361ea69ab6 --- /dev/null +++ b/src/lib/libcrypto/evp/evp_key.c | |||
| @@ -0,0 +1,175 @@ | |||
| 1 | /* crypto/evp/evp_key.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/x509.h> | ||
| 62 | #include <openssl/objects.h> | ||
| 63 | #include <openssl/evp.h> | ||
| 64 | #include <openssl/ui.h> | ||
| 65 | |||
| 66 | /* should be init to zeros. */ | ||
| 67 | static char prompt_string[80]; | ||
| 68 | |||
| 69 | void EVP_set_pw_prompt(const char *prompt) | ||
| 70 | { | ||
| 71 | if (prompt == NULL) | ||
| 72 | prompt_string[0]='\0'; | ||
| 73 | else | ||
| 74 | { | ||
| 75 | strncpy(prompt_string,prompt,79); | ||
| 76 | prompt_string[79]='\0'; | ||
| 77 | } | ||
| 78 | } | ||
| 79 | |||
| 80 | char *EVP_get_pw_prompt(void) | ||
| 81 | { | ||
| 82 | if (prompt_string[0] == '\0') | ||
| 83 | return(NULL); | ||
| 84 | else | ||
| 85 | return(prompt_string); | ||
| 86 | } | ||
| 87 | |||
| 88 | /* For historical reasons, the standard function for reading passwords is | ||
| 89 | * in the DES library -- if someone ever wants to disable DES, | ||
| 90 | * this function will fail */ | ||
| 91 | int EVP_read_pw_string(char *buf, int len, const char *prompt, int verify) | ||
| 92 | { | ||
| 93 | int ret; | ||
| 94 | char buff[BUFSIZ]; | ||
| 95 | UI *ui; | ||
| 96 | |||
| 97 | if ((prompt == NULL) && (prompt_string[0] != '\0')) | ||
| 98 | prompt=prompt_string; | ||
| 99 | ui = UI_new(); | ||
| 100 | UI_add_input_string(ui,prompt,0,buf,0,(len>=BUFSIZ)?BUFSIZ-1:len); | ||
| 101 | if (verify) | ||
| 102 | UI_add_verify_string(ui,prompt,0, | ||
| 103 | buff,0,(len>=BUFSIZ)?BUFSIZ-1:len,buf); | ||
| 104 | ret = UI_process(ui); | ||
| 105 | UI_free(ui); | ||
| 106 | OPENSSL_cleanse(buff,BUFSIZ); | ||
| 107 | return ret; | ||
| 108 | } | ||
| 109 | |||
| 110 | int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, | ||
| 111 | const unsigned char *salt, const unsigned char *data, int datal, | ||
| 112 | int count, unsigned char *key, unsigned char *iv) | ||
| 113 | { | ||
| 114 | EVP_MD_CTX c; | ||
| 115 | unsigned char md_buf[EVP_MAX_MD_SIZE]; | ||
| 116 | int niv,nkey,addmd=0; | ||
| 117 | unsigned int mds=0,i; | ||
| 118 | |||
| 119 | nkey=type->key_len; | ||
| 120 | niv=type->iv_len; | ||
| 121 | OPENSSL_assert(nkey <= EVP_MAX_KEY_LENGTH); | ||
| 122 | OPENSSL_assert(niv <= EVP_MAX_IV_LENGTH); | ||
| 123 | |||
| 124 | if (data == NULL) return(nkey); | ||
| 125 | |||
| 126 | EVP_MD_CTX_init(&c); | ||
| 127 | for (;;) | ||
| 128 | { | ||
| 129 | if (!EVP_DigestInit_ex(&c,md, NULL)) | ||
| 130 | return 0; | ||
| 131 | if (addmd++) | ||
| 132 | EVP_DigestUpdate(&c,&(md_buf[0]),mds); | ||
| 133 | EVP_DigestUpdate(&c,data,datal); | ||
| 134 | if (salt != NULL) | ||
| 135 | EVP_DigestUpdate(&c,salt,PKCS5_SALT_LEN); | ||
| 136 | EVP_DigestFinal_ex(&c,&(md_buf[0]),&mds); | ||
| 137 | |||
| 138 | for (i=1; i<(unsigned int)count; i++) | ||
| 139 | { | ||
| 140 | EVP_DigestInit_ex(&c,md, NULL); | ||
| 141 | EVP_DigestUpdate(&c,&(md_buf[0]),mds); | ||
| 142 | EVP_DigestFinal_ex(&c,&(md_buf[0]),&mds); | ||
| 143 | } | ||
| 144 | i=0; | ||
| 145 | if (nkey) | ||
| 146 | { | ||
| 147 | for (;;) | ||
| 148 | { | ||
| 149 | if (nkey == 0) break; | ||
| 150 | if (i == mds) break; | ||
| 151 | if (key != NULL) | ||
| 152 | *(key++)=md_buf[i]; | ||
| 153 | nkey--; | ||
| 154 | i++; | ||
| 155 | } | ||
| 156 | } | ||
| 157 | if (niv && (i != mds)) | ||
| 158 | { | ||
| 159 | for (;;) | ||
| 160 | { | ||
| 161 | if (niv == 0) break; | ||
| 162 | if (i == mds) break; | ||
| 163 | if (iv != NULL) | ||
| 164 | *(iv++)=md_buf[i]; | ||
| 165 | niv--; | ||
| 166 | i++; | ||
| 167 | } | ||
| 168 | } | ||
| 169 | if ((nkey == 0) && (niv == 0)) break; | ||
| 170 | } | ||
| 171 | EVP_MD_CTX_cleanup(&c); | ||
| 172 | OPENSSL_cleanse(&(md_buf[0]),EVP_MAX_MD_SIZE); | ||
| 173 | return(type->key_len); | ||
| 174 | } | ||
| 175 | |||
diff --git a/src/lib/libcrypto/evp/evp_lib.c b/src/lib/libcrypto/evp/evp_lib.c new file mode 100644 index 0000000000..edb28ef38e --- /dev/null +++ b/src/lib/libcrypto/evp/evp_lib.c | |||
| @@ -0,0 +1,279 @@ | |||
| 1 | /* crypto/evp/evp_lib.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/evp.h> | ||
| 62 | #include <openssl/objects.h> | ||
| 63 | |||
| 64 | int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type) | ||
| 65 | { | ||
| 66 | int ret; | ||
| 67 | |||
| 68 | if (c->cipher->set_asn1_parameters != NULL) | ||
| 69 | ret=c->cipher->set_asn1_parameters(c,type); | ||
| 70 | else | ||
| 71 | ret=-1; | ||
| 72 | return(ret); | ||
| 73 | } | ||
| 74 | |||
| 75 | int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type) | ||
| 76 | { | ||
| 77 | int ret; | ||
| 78 | |||
| 79 | if (c->cipher->get_asn1_parameters != NULL) | ||
| 80 | ret=c->cipher->get_asn1_parameters(c,type); | ||
| 81 | else | ||
| 82 | ret=-1; | ||
| 83 | return(ret); | ||
| 84 | } | ||
| 85 | |||
| 86 | int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) | ||
| 87 | { | ||
| 88 | int i=0; | ||
| 89 | unsigned int l; | ||
| 90 | |||
| 91 | if (type != NULL) | ||
| 92 | { | ||
| 93 | l=EVP_CIPHER_CTX_iv_length(c); | ||
| 94 | OPENSSL_assert(l <= sizeof(c->iv)); | ||
| 95 | i=ASN1_TYPE_get_octetstring(type,c->oiv,l); | ||
| 96 | if (i != (int)l) | ||
| 97 | return(-1); | ||
| 98 | else if (i > 0) | ||
| 99 | memcpy(c->iv,c->oiv,l); | ||
| 100 | } | ||
| 101 | return(i); | ||
| 102 | } | ||
| 103 | |||
| 104 | int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) | ||
| 105 | { | ||
| 106 | int i=0; | ||
| 107 | unsigned int j; | ||
| 108 | |||
| 109 | if (type != NULL) | ||
| 110 | { | ||
| 111 | j=EVP_CIPHER_CTX_iv_length(c); | ||
| 112 | OPENSSL_assert(j <= sizeof(c->iv)); | ||
| 113 | i=ASN1_TYPE_set_octetstring(type,c->oiv,j); | ||
| 114 | } | ||
| 115 | return(i); | ||
| 116 | } | ||
| 117 | |||
| 118 | /* Convert the various cipher NIDs and dummies to a proper OID NID */ | ||
| 119 | int EVP_CIPHER_type(const EVP_CIPHER *ctx) | ||
| 120 | { | ||
| 121 | int nid; | ||
| 122 | ASN1_OBJECT *otmp; | ||
| 123 | nid = EVP_CIPHER_nid(ctx); | ||
| 124 | |||
| 125 | switch(nid) { | ||
| 126 | |||
| 127 | case NID_rc2_cbc: | ||
| 128 | case NID_rc2_64_cbc: | ||
| 129 | case NID_rc2_40_cbc: | ||
| 130 | |||
| 131 | return NID_rc2_cbc; | ||
| 132 | |||
| 133 | case NID_rc4: | ||
| 134 | case NID_rc4_40: | ||
| 135 | |||
| 136 | return NID_rc4; | ||
| 137 | |||
| 138 | case NID_aes_128_cfb128: | ||
| 139 | case NID_aes_128_cfb8: | ||
| 140 | case NID_aes_128_cfb1: | ||
| 141 | |||
| 142 | return NID_aes_128_cfb128; | ||
| 143 | |||
| 144 | case NID_aes_192_cfb128: | ||
| 145 | case NID_aes_192_cfb8: | ||
| 146 | case NID_aes_192_cfb1: | ||
| 147 | |||
| 148 | return NID_aes_192_cfb128; | ||
| 149 | |||
| 150 | case NID_aes_256_cfb128: | ||
| 151 | case NID_aes_256_cfb8: | ||
| 152 | case NID_aes_256_cfb1: | ||
| 153 | |||
| 154 | return NID_aes_256_cfb128; | ||
| 155 | |||
| 156 | case NID_des_cfb64: | ||
| 157 | case NID_des_cfb8: | ||
| 158 | case NID_des_cfb1: | ||
| 159 | |||
| 160 | return NID_des_cfb64; | ||
| 161 | |||
| 162 | default: | ||
| 163 | /* Check it has an OID and it is valid */ | ||
| 164 | otmp = OBJ_nid2obj(nid); | ||
| 165 | if(!otmp || !otmp->data) nid = NID_undef; | ||
| 166 | ASN1_OBJECT_free(otmp); | ||
| 167 | return nid; | ||
| 168 | } | ||
| 169 | } | ||
| 170 | |||
| 171 | int EVP_CIPHER_block_size(const EVP_CIPHER *e) | ||
| 172 | { | ||
| 173 | return e->block_size; | ||
| 174 | } | ||
| 175 | |||
| 176 | int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx) | ||
| 177 | { | ||
| 178 | return ctx->cipher->block_size; | ||
| 179 | } | ||
| 180 | |||
| 181 | int EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) | ||
| 182 | { | ||
| 183 | return ctx->cipher->do_cipher(ctx,out,in,inl); | ||
| 184 | } | ||
| 185 | |||
| 186 | const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx) | ||
| 187 | { | ||
| 188 | return ctx->cipher; | ||
| 189 | } | ||
| 190 | |||
| 191 | unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher) | ||
| 192 | { | ||
| 193 | return cipher->flags; | ||
| 194 | } | ||
| 195 | |||
| 196 | unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx) | ||
| 197 | { | ||
| 198 | return ctx->cipher->flags; | ||
| 199 | } | ||
| 200 | |||
| 201 | void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx) | ||
| 202 | { | ||
| 203 | return ctx->app_data; | ||
| 204 | } | ||
| 205 | |||
| 206 | void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data) | ||
| 207 | { | ||
| 208 | ctx->app_data = data; | ||
| 209 | } | ||
| 210 | |||
| 211 | int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher) | ||
| 212 | { | ||
| 213 | return cipher->iv_len; | ||
| 214 | } | ||
| 215 | |||
| 216 | int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx) | ||
| 217 | { | ||
| 218 | return ctx->cipher->iv_len; | ||
| 219 | } | ||
| 220 | |||
| 221 | int EVP_CIPHER_key_length(const EVP_CIPHER *cipher) | ||
| 222 | { | ||
| 223 | return cipher->key_len; | ||
| 224 | } | ||
| 225 | |||
| 226 | int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx) | ||
| 227 | { | ||
| 228 | return ctx->key_len; | ||
| 229 | } | ||
| 230 | |||
| 231 | int EVP_CIPHER_nid(const EVP_CIPHER *cipher) | ||
| 232 | { | ||
| 233 | return cipher->nid; | ||
| 234 | } | ||
| 235 | |||
| 236 | int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx) | ||
| 237 | { | ||
| 238 | return ctx->cipher->nid; | ||
| 239 | } | ||
| 240 | |||
| 241 | int EVP_MD_block_size(const EVP_MD *md) | ||
| 242 | { | ||
| 243 | return md->block_size; | ||
| 244 | } | ||
| 245 | |||
| 246 | int EVP_MD_type(const EVP_MD *md) | ||
| 247 | { | ||
| 248 | return md->type; | ||
| 249 | } | ||
| 250 | |||
| 251 | int EVP_MD_pkey_type(const EVP_MD *md) | ||
| 252 | { | ||
| 253 | return md->pkey_type; | ||
| 254 | } | ||
| 255 | |||
| 256 | int EVP_MD_size(const EVP_MD *md) | ||
| 257 | { | ||
| 258 | return md->md_size; | ||
| 259 | } | ||
| 260 | |||
| 261 | const EVP_MD * EVP_MD_CTX_md(const EVP_MD_CTX *ctx) | ||
| 262 | { | ||
| 263 | return ctx->digest; | ||
| 264 | } | ||
| 265 | |||
| 266 | void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags) | ||
| 267 | { | ||
| 268 | ctx->flags |= flags; | ||
| 269 | } | ||
| 270 | |||
| 271 | void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags) | ||
| 272 | { | ||
| 273 | ctx->flags &= ~flags; | ||
| 274 | } | ||
| 275 | |||
| 276 | int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags) | ||
| 277 | { | ||
| 278 | return (ctx->flags & flags); | ||
| 279 | } | ||
diff --git a/src/lib/libcrypto/evp/evp_locl.h b/src/lib/libcrypto/evp/evp_locl.h new file mode 100644 index 0000000000..073b0adcff --- /dev/null +++ b/src/lib/libcrypto/evp/evp_locl.h | |||
| @@ -0,0 +1,236 @@ | |||
| 1 | /* evp_locl.h */ | ||
| 2 | /* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL | ||
| 3 | * project 2000. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* Macros to code block cipher wrappers */ | ||
| 60 | |||
| 61 | /* Wrapper functions for each cipher mode */ | ||
| 62 | |||
| 63 | #define BLOCK_CIPHER_ecb_loop() \ | ||
| 64 | unsigned int i, bl; \ | ||
| 65 | bl = ctx->cipher->block_size;\ | ||
| 66 | if(inl < bl) return 1;\ | ||
| 67 | inl -= bl; \ | ||
| 68 | for(i=0; i <= inl; i+=bl) | ||
| 69 | |||
| 70 | #define BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \ | ||
| 71 | static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \ | ||
| 72 | {\ | ||
| 73 | BLOCK_CIPHER_ecb_loop() \ | ||
| 74 | cprefix##_ecb_encrypt(in + i, out + i, &((kstruct *)ctx->cipher_data)->ksched, ctx->encrypt);\ | ||
| 75 | return 1;\ | ||
| 76 | } | ||
| 77 | |||
| 78 | #define BLOCK_CIPHER_func_ofb(cname, cprefix, cbits, kstruct, ksched) \ | ||
| 79 | static int cname##_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \ | ||
| 80 | {\ | ||
| 81 | cprefix##_ofb##cbits##_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num);\ | ||
| 82 | return 1;\ | ||
| 83 | } | ||
| 84 | |||
| 85 | #define BLOCK_CIPHER_func_cbc(cname, cprefix, kstruct, ksched) \ | ||
| 86 | static int cname##_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \ | ||
| 87 | {\ | ||
| 88 | cprefix##_cbc_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, ctx->encrypt);\ | ||
| 89 | return 1;\ | ||
| 90 | } | ||
| 91 | |||
| 92 | #define BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \ | ||
| 93 | static int cname##_cfb##cbits##_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \ | ||
| 94 | {\ | ||
| 95 | cprefix##_cfb##cbits##_encrypt(in, out, (long)(cbits==1?inl*8:inl), &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num, ctx->encrypt);\ | ||
| 96 | return 1;\ | ||
| 97 | } | ||
| 98 | |||
| 99 | #define BLOCK_CIPHER_all_funcs(cname, cprefix, cbits, kstruct, ksched) \ | ||
| 100 | BLOCK_CIPHER_func_cbc(cname, cprefix, kstruct, ksched) \ | ||
| 101 | BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \ | ||
| 102 | BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \ | ||
| 103 | BLOCK_CIPHER_func_ofb(cname, cprefix, cbits, kstruct, ksched) | ||
| 104 | |||
| 105 | #define BLOCK_CIPHER_def1(cname, nmode, mode, MODE, kstruct, nid, block_size, \ | ||
| 106 | key_len, iv_len, flags, init_key, cleanup, \ | ||
| 107 | set_asn1, get_asn1, ctrl) \ | ||
| 108 | static const EVP_CIPHER cname##_##mode = { \ | ||
| 109 | nid##_##nmode, block_size, key_len, iv_len, \ | ||
| 110 | flags | EVP_CIPH_##MODE##_MODE, \ | ||
| 111 | init_key, \ | ||
| 112 | cname##_##mode##_cipher, \ | ||
| 113 | cleanup, \ | ||
| 114 | sizeof(kstruct), \ | ||
| 115 | set_asn1, get_asn1,\ | ||
| 116 | ctrl, \ | ||
| 117 | NULL \ | ||
| 118 | }; \ | ||
| 119 | const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; } | ||
| 120 | |||
| 121 | #define BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, \ | ||
| 122 | iv_len, flags, init_key, cleanup, set_asn1, \ | ||
| 123 | get_asn1, ctrl) \ | ||
| 124 | BLOCK_CIPHER_def1(cname, cbc, cbc, CBC, kstruct, nid, block_size, key_len, \ | ||
| 125 | iv_len, flags, init_key, cleanup, set_asn1, get_asn1, ctrl) | ||
| 126 | |||
| 127 | #define BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, \ | ||
| 128 | iv_len, cbits, flags, init_key, cleanup, \ | ||
| 129 | set_asn1, get_asn1, ctrl) \ | ||
| 130 | BLOCK_CIPHER_def1(cname, cfb##cbits, cfb##cbits, CFB, kstruct, nid, 1, \ | ||
| 131 | key_len, iv_len, flags, init_key, cleanup, set_asn1, \ | ||
| 132 | get_asn1, ctrl) | ||
| 133 | |||
| 134 | #define BLOCK_CIPHER_def_ofb(cname, kstruct, nid, key_len, \ | ||
| 135 | iv_len, cbits, flags, init_key, cleanup, \ | ||
| 136 | set_asn1, get_asn1, ctrl) \ | ||
| 137 | BLOCK_CIPHER_def1(cname, ofb##cbits, ofb, OFB, kstruct, nid, 1, \ | ||
| 138 | key_len, iv_len, flags, init_key, cleanup, set_asn1, \ | ||
| 139 | get_asn1, ctrl) | ||
| 140 | |||
| 141 | #define BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, \ | ||
| 142 | iv_len, flags, init_key, cleanup, set_asn1, \ | ||
| 143 | get_asn1, ctrl) \ | ||
| 144 | BLOCK_CIPHER_def1(cname, ecb, ecb, ECB, kstruct, nid, block_size, key_len, \ | ||
| 145 | iv_len, flags, init_key, cleanup, set_asn1, get_asn1, ctrl) | ||
| 146 | |||
| 147 | #define BLOCK_CIPHER_defs(cname, kstruct, \ | ||
| 148 | nid, block_size, key_len, iv_len, cbits, flags, \ | ||
| 149 | init_key, cleanup, set_asn1, get_asn1, ctrl) \ | ||
| 150 | BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, iv_len, flags, \ | ||
| 151 | init_key, cleanup, set_asn1, get_asn1, ctrl) \ | ||
| 152 | BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, iv_len, cbits, \ | ||
| 153 | flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \ | ||
| 154 | BLOCK_CIPHER_def_ofb(cname, kstruct, nid, key_len, iv_len, cbits, \ | ||
| 155 | flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \ | ||
| 156 | BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, iv_len, flags, \ | ||
| 157 | init_key, cleanup, set_asn1, get_asn1, ctrl) | ||
| 158 | |||
| 159 | |||
| 160 | /* | ||
| 161 | #define BLOCK_CIPHER_defs(cname, kstruct, \ | ||
| 162 | nid, block_size, key_len, iv_len, flags,\ | ||
| 163 | init_key, cleanup, set_asn1, get_asn1, ctrl)\ | ||
| 164 | static const EVP_CIPHER cname##_cbc = {\ | ||
| 165 | nid##_cbc, block_size, key_len, iv_len, \ | ||
| 166 | flags | EVP_CIPH_CBC_MODE,\ | ||
| 167 | init_key,\ | ||
| 168 | cname##_cbc_cipher,\ | ||
| 169 | cleanup,\ | ||
| 170 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\ | ||
| 171 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\ | ||
| 172 | set_asn1, get_asn1,\ | ||
| 173 | ctrl, \ | ||
| 174 | NULL \ | ||
| 175 | };\ | ||
| 176 | const EVP_CIPHER *EVP_##cname##_cbc(void) { return &cname##_cbc; }\ | ||
| 177 | static const EVP_CIPHER cname##_cfb = {\ | ||
| 178 | nid##_cfb64, 1, key_len, iv_len, \ | ||
| 179 | flags | EVP_CIPH_CFB_MODE,\ | ||
| 180 | init_key,\ | ||
| 181 | cname##_cfb_cipher,\ | ||
| 182 | cleanup,\ | ||
| 183 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\ | ||
| 184 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\ | ||
| 185 | set_asn1, get_asn1,\ | ||
| 186 | ctrl,\ | ||
| 187 | NULL \ | ||
| 188 | };\ | ||
| 189 | const EVP_CIPHER *EVP_##cname##_cfb(void) { return &cname##_cfb; }\ | ||
| 190 | static const EVP_CIPHER cname##_ofb = {\ | ||
| 191 | nid##_ofb64, 1, key_len, iv_len, \ | ||
| 192 | flags | EVP_CIPH_OFB_MODE,\ | ||
| 193 | init_key,\ | ||
| 194 | cname##_ofb_cipher,\ | ||
| 195 | cleanup,\ | ||
| 196 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\ | ||
| 197 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\ | ||
| 198 | set_asn1, get_asn1,\ | ||
| 199 | ctrl,\ | ||
| 200 | NULL \ | ||
| 201 | };\ | ||
| 202 | const EVP_CIPHER *EVP_##cname##_ofb(void) { return &cname##_ofb; }\ | ||
| 203 | static const EVP_CIPHER cname##_ecb = {\ | ||
| 204 | nid##_ecb, block_size, key_len, iv_len, \ | ||
| 205 | flags | EVP_CIPH_ECB_MODE,\ | ||
| 206 | init_key,\ | ||
| 207 | cname##_ecb_cipher,\ | ||
| 208 | cleanup,\ | ||
| 209 | sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\ | ||
| 210 | sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\ | ||
| 211 | set_asn1, get_asn1,\ | ||
| 212 | ctrl,\ | ||
| 213 | NULL \ | ||
| 214 | };\ | ||
| 215 | const EVP_CIPHER *EVP_##cname##_ecb(void) { return &cname##_ecb; } | ||
| 216 | */ | ||
| 217 | |||
| 218 | #define IMPLEMENT_BLOCK_CIPHER(cname, ksched, cprefix, kstruct, nid, \ | ||
| 219 | block_size, key_len, iv_len, cbits, \ | ||
| 220 | flags, init_key, \ | ||
| 221 | cleanup, set_asn1, get_asn1, ctrl) \ | ||
| 222 | BLOCK_CIPHER_all_funcs(cname, cprefix, cbits, kstruct, ksched) \ | ||
| 223 | BLOCK_CIPHER_defs(cname, kstruct, nid, block_size, key_len, iv_len, \ | ||
| 224 | cbits, flags, init_key, cleanup, set_asn1, \ | ||
| 225 | get_asn1, ctrl) | ||
| 226 | |||
| 227 | #define EVP_C_DATA(kstruct, ctx) ((kstruct *)(ctx)->cipher_data) | ||
| 228 | |||
| 229 | #define IMPLEMENT_CFBR(cipher,cprefix,kstruct,ksched,keysize,cbits,iv_len) \ | ||
| 230 | BLOCK_CIPHER_func_cfb(cipher##_##keysize,cprefix,cbits,kstruct,ksched) \ | ||
| 231 | BLOCK_CIPHER_def_cfb(cipher##_##keysize,kstruct, \ | ||
| 232 | NID_##cipher##_##keysize, keysize/8, iv_len, cbits, \ | ||
| 233 | 0, cipher##_init_key, NULL, \ | ||
| 234 | EVP_CIPHER_set_asn1_iv, \ | ||
| 235 | EVP_CIPHER_get_asn1_iv, \ | ||
| 236 | NULL) | ||
diff --git a/src/lib/libcrypto/evp/evp_pbe.c b/src/lib/libcrypto/evp/evp_pbe.c new file mode 100644 index 0000000000..c26d2de0f3 --- /dev/null +++ b/src/lib/libcrypto/evp/evp_pbe.c | |||
| @@ -0,0 +1,137 @@ | |||
| 1 | /* evp_pbe.c */ | ||
| 2 | /* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL | ||
| 3 | * project 1999. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/evp.h> | ||
| 62 | #include <openssl/x509.h> | ||
| 63 | |||
| 64 | /* Password based encryption (PBE) functions */ | ||
| 65 | |||
| 66 | static STACK *pbe_algs; | ||
| 67 | |||
| 68 | /* Setup a cipher context from a PBE algorithm */ | ||
| 69 | |||
| 70 | typedef struct { | ||
| 71 | int pbe_nid; | ||
| 72 | const EVP_CIPHER *cipher; | ||
| 73 | const EVP_MD *md; | ||
| 74 | EVP_PBE_KEYGEN *keygen; | ||
| 75 | } EVP_PBE_CTL; | ||
| 76 | |||
| 77 | int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, | ||
| 78 | ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de) | ||
| 79 | { | ||
| 80 | |||
| 81 | EVP_PBE_CTL *pbetmp, pbelu; | ||
| 82 | int i; | ||
| 83 | pbelu.pbe_nid = OBJ_obj2nid(pbe_obj); | ||
| 84 | if (pbelu.pbe_nid != NID_undef) i = sk_find(pbe_algs, (char *)&pbelu); | ||
| 85 | else i = -1; | ||
| 86 | |||
| 87 | if (i == -1) { | ||
| 88 | char obj_tmp[80]; | ||
| 89 | EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_UNKNOWN_PBE_ALGORITHM); | ||
| 90 | if (!pbe_obj) BUF_strlcpy (obj_tmp, "NULL", sizeof obj_tmp); | ||
| 91 | else i2t_ASN1_OBJECT(obj_tmp, sizeof obj_tmp, pbe_obj); | ||
| 92 | ERR_add_error_data(2, "TYPE=", obj_tmp); | ||
| 93 | return 0; | ||
| 94 | } | ||
| 95 | if(!pass) passlen = 0; | ||
| 96 | else if (passlen == -1) passlen = strlen(pass); | ||
| 97 | pbetmp = (EVP_PBE_CTL *)sk_value (pbe_algs, i); | ||
| 98 | i = (*pbetmp->keygen)(ctx, pass, passlen, param, pbetmp->cipher, | ||
| 99 | pbetmp->md, en_de); | ||
| 100 | if (!i) { | ||
| 101 | EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_KEYGEN_FAILURE); | ||
| 102 | return 0; | ||
| 103 | } | ||
| 104 | return 1; | ||
| 105 | } | ||
| 106 | |||
| 107 | static int pbe_cmp(const char * const *a, const char * const *b) | ||
| 108 | { | ||
| 109 | const EVP_PBE_CTL * const *pbe1 = (const EVP_PBE_CTL * const *) a, | ||
| 110 | * const *pbe2 = (const EVP_PBE_CTL * const *)b; | ||
| 111 | return ((*pbe1)->pbe_nid - (*pbe2)->pbe_nid); | ||
| 112 | } | ||
| 113 | |||
| 114 | /* Add a PBE algorithm */ | ||
| 115 | |||
| 116 | int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, | ||
| 117 | EVP_PBE_KEYGEN *keygen) | ||
| 118 | { | ||
| 119 | EVP_PBE_CTL *pbe_tmp; | ||
| 120 | if (!pbe_algs) pbe_algs = sk_new(pbe_cmp); | ||
| 121 | if (!(pbe_tmp = (EVP_PBE_CTL*) OPENSSL_malloc (sizeof(EVP_PBE_CTL)))) { | ||
| 122 | EVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE); | ||
| 123 | return 0; | ||
| 124 | } | ||
| 125 | pbe_tmp->pbe_nid = nid; | ||
| 126 | pbe_tmp->cipher = cipher; | ||
| 127 | pbe_tmp->md = md; | ||
| 128 | pbe_tmp->keygen = keygen; | ||
| 129 | sk_push (pbe_algs, (char *)pbe_tmp); | ||
| 130 | return 1; | ||
| 131 | } | ||
| 132 | |||
| 133 | void EVP_PBE_cleanup(void) | ||
| 134 | { | ||
| 135 | sk_pop_free(pbe_algs, OPENSSL_freeFunc); | ||
| 136 | pbe_algs = NULL; | ||
| 137 | } | ||
diff --git a/src/lib/libcrypto/evp/evp_pkey.c b/src/lib/libcrypto/evp/evp_pkey.c new file mode 100644 index 0000000000..0147f3e02a --- /dev/null +++ b/src/lib/libcrypto/evp/evp_pkey.c | |||
| @@ -0,0 +1,794 @@ | |||
| 1 | /* evp_pkey.c */ | ||
| 2 | /* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL | ||
| 3 | * project 1999. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include "cryptlib.h" | ||
| 62 | #include <openssl/x509.h> | ||
| 63 | #include <openssl/rand.h> | ||
| 64 | #ifndef OPENSSL_NO_RSA | ||
| 65 | #include <openssl/rsa.h> | ||
| 66 | #endif | ||
| 67 | #ifndef OPENSSL_NO_DSA | ||
| 68 | #include <openssl/dsa.h> | ||
| 69 | #endif | ||
| 70 | #include <openssl/bn.h> | ||
| 71 | |||
| 72 | #ifndef OPENSSL_NO_DSA | ||
| 73 | static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8inf, EVP_PKEY *pkey); | ||
| 74 | #endif | ||
| 75 | #ifndef OPENSSL_NO_EC | ||
| 76 | static int eckey_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8inf, EVP_PKEY *pkey); | ||
| 77 | #endif | ||
| 78 | |||
| 79 | /* Extract a private key from a PKCS8 structure */ | ||
| 80 | |||
| 81 | EVP_PKEY *EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO *p8) | ||
| 82 | { | ||
| 83 | EVP_PKEY *pkey = NULL; | ||
| 84 | #ifndef OPENSSL_NO_RSA | ||
| 85 | RSA *rsa = NULL; | ||
| 86 | #endif | ||
| 87 | #ifndef OPENSSL_NO_DSA | ||
| 88 | DSA *dsa = NULL; | ||
| 89 | ASN1_TYPE *t1, *t2; | ||
| 90 | ASN1_INTEGER *privkey; | ||
| 91 | STACK_OF(ASN1_TYPE) *ndsa = NULL; | ||
| 92 | #endif | ||
| 93 | #ifndef OPENSSL_NO_EC | ||
| 94 | EC_KEY *eckey = NULL; | ||
| 95 | const unsigned char *p_tmp; | ||
| 96 | #endif | ||
| 97 | #if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_EC) | ||
| 98 | ASN1_TYPE *param = NULL; | ||
| 99 | BN_CTX *ctx = NULL; | ||
| 100 | int plen; | ||
| 101 | #endif | ||
| 102 | X509_ALGOR *a; | ||
| 103 | const unsigned char *p; | ||
| 104 | const unsigned char *cp; | ||
| 105 | int pkeylen; | ||
| 106 | int nid; | ||
| 107 | char obj_tmp[80]; | ||
| 108 | |||
| 109 | if(p8->pkey->type == V_ASN1_OCTET_STRING) { | ||
| 110 | p8->broken = PKCS8_OK; | ||
| 111 | p = p8->pkey->value.octet_string->data; | ||
| 112 | pkeylen = p8->pkey->value.octet_string->length; | ||
| 113 | } else { | ||
| 114 | p8->broken = PKCS8_NO_OCTET; | ||
| 115 | p = p8->pkey->value.sequence->data; | ||
| 116 | pkeylen = p8->pkey->value.sequence->length; | ||
| 117 | } | ||
| 118 | if (!(pkey = EVP_PKEY_new())) { | ||
| 119 | EVPerr(EVP_F_EVP_PKCS82PKEY,ERR_R_MALLOC_FAILURE); | ||
| 120 | return NULL; | ||
| 121 | } | ||
| 122 | a = p8->pkeyalg; | ||
| 123 | nid = OBJ_obj2nid(a->algorithm); | ||
| 124 | switch(nid) | ||
| 125 | { | ||
| 126 | #ifndef OPENSSL_NO_RSA | ||
| 127 | case NID_rsaEncryption: | ||
| 128 | cp = p; | ||
| 129 | if (!(rsa = d2i_RSAPrivateKey (NULL,&cp, pkeylen))) { | ||
| 130 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); | ||
| 131 | return NULL; | ||
| 132 | } | ||
| 133 | EVP_PKEY_assign_RSA (pkey, rsa); | ||
| 134 | break; | ||
| 135 | #endif | ||
| 136 | #ifndef OPENSSL_NO_DSA | ||
| 137 | case NID_dsa: | ||
| 138 | /* PKCS#8 DSA is weird: you just get a private key integer | ||
| 139 | * and parameters in the AlgorithmIdentifier the pubkey must | ||
| 140 | * be recalculated. | ||
| 141 | */ | ||
| 142 | |||
| 143 | /* Check for broken DSA PKCS#8, UGH! */ | ||
| 144 | if(*p == (V_ASN1_SEQUENCE|V_ASN1_CONSTRUCTED)) { | ||
| 145 | if(!(ndsa = ASN1_seq_unpack_ASN1_TYPE(p, pkeylen, | ||
| 146 | d2i_ASN1_TYPE, | ||
| 147 | ASN1_TYPE_free))) { | ||
| 148 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); | ||
| 149 | goto dsaerr; | ||
| 150 | } | ||
| 151 | if(sk_ASN1_TYPE_num(ndsa) != 2 ) { | ||
| 152 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); | ||
| 153 | goto dsaerr; | ||
| 154 | } | ||
| 155 | /* Handle Two broken types: | ||
| 156 | * SEQUENCE {parameters, priv_key} | ||
| 157 | * SEQUENCE {pub_key, priv_key} | ||
| 158 | */ | ||
| 159 | |||
| 160 | t1 = sk_ASN1_TYPE_value(ndsa, 0); | ||
| 161 | t2 = sk_ASN1_TYPE_value(ndsa, 1); | ||
| 162 | if(t1->type == V_ASN1_SEQUENCE) { | ||
| 163 | p8->broken = PKCS8_EMBEDDED_PARAM; | ||
| 164 | param = t1; | ||
| 165 | } else if(a->parameter->type == V_ASN1_SEQUENCE) { | ||
| 166 | p8->broken = PKCS8_NS_DB; | ||
| 167 | param = a->parameter; | ||
| 168 | } else { | ||
| 169 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); | ||
| 170 | goto dsaerr; | ||
| 171 | } | ||
| 172 | |||
| 173 | if(t2->type != V_ASN1_INTEGER) { | ||
| 174 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); | ||
| 175 | goto dsaerr; | ||
| 176 | } | ||
| 177 | privkey = t2->value.integer; | ||
| 178 | } else { | ||
| 179 | if (!(privkey=d2i_ASN1_INTEGER (NULL, &p, pkeylen))) { | ||
| 180 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); | ||
| 181 | goto dsaerr; | ||
| 182 | } | ||
| 183 | param = p8->pkeyalg->parameter; | ||
| 184 | } | ||
| 185 | if (!param || (param->type != V_ASN1_SEQUENCE)) { | ||
| 186 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); | ||
| 187 | goto dsaerr; | ||
| 188 | } | ||
| 189 | cp = p = param->value.sequence->data; | ||
| 190 | plen = param->value.sequence->length; | ||
| 191 | if (!(dsa = d2i_DSAparams (NULL, &cp, plen))) { | ||
| 192 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); | ||
| 193 | goto dsaerr; | ||
| 194 | } | ||
| 195 | /* We have parameters now set private key */ | ||
| 196 | if (!(dsa->priv_key = ASN1_INTEGER_to_BN(privkey, NULL))) { | ||
| 197 | EVPerr(EVP_F_EVP_PKCS82PKEY,EVP_R_BN_DECODE_ERROR); | ||
| 198 | goto dsaerr; | ||
| 199 | } | ||
| 200 | /* Calculate public key (ouch!) */ | ||
| 201 | if (!(dsa->pub_key = BN_new())) { | ||
| 202 | EVPerr(EVP_F_EVP_PKCS82PKEY,ERR_R_MALLOC_FAILURE); | ||
| 203 | goto dsaerr; | ||
| 204 | } | ||
| 205 | if (!(ctx = BN_CTX_new())) { | ||
| 206 | EVPerr(EVP_F_EVP_PKCS82PKEY,ERR_R_MALLOC_FAILURE); | ||
| 207 | goto dsaerr; | ||
| 208 | } | ||
| 209 | |||
| 210 | if (!BN_mod_exp(dsa->pub_key, dsa->g, | ||
| 211 | dsa->priv_key, dsa->p, ctx)) { | ||
| 212 | |||
| 213 | EVPerr(EVP_F_EVP_PKCS82PKEY,EVP_R_BN_PUBKEY_ERROR); | ||
| 214 | goto dsaerr; | ||
| 215 | } | ||
| 216 | |||
| 217 | EVP_PKEY_assign_DSA(pkey, dsa); | ||
| 218 | BN_CTX_free (ctx); | ||
| 219 | if(ndsa) sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | ||
| 220 | else ASN1_INTEGER_free(privkey); | ||
| 221 | break; | ||
| 222 | dsaerr: | ||
| 223 | BN_CTX_free (ctx); | ||
| 224 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | ||
| 225 | DSA_free(dsa); | ||
| 226 | EVP_PKEY_free(pkey); | ||
| 227 | return NULL; | ||
| 228 | break; | ||
| 229 | #endif | ||
| 230 | #ifndef OPENSSL_NO_EC | ||
| 231 | case NID_X9_62_id_ecPublicKey: | ||
| 232 | p_tmp = p; | ||
| 233 | /* extract the ec parameters */ | ||
| 234 | param = p8->pkeyalg->parameter; | ||
| 235 | |||
| 236 | if (!param || ((param->type != V_ASN1_SEQUENCE) && | ||
| 237 | (param->type != V_ASN1_OBJECT))) | ||
| 238 | { | ||
| 239 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); | ||
| 240 | goto ecerr; | ||
| 241 | } | ||
| 242 | |||
| 243 | if (param->type == V_ASN1_SEQUENCE) | ||
| 244 | { | ||
| 245 | cp = p = param->value.sequence->data; | ||
| 246 | plen = param->value.sequence->length; | ||
| 247 | |||
| 248 | if (!(eckey = d2i_ECParameters(NULL, &cp, plen))) | ||
| 249 | { | ||
| 250 | EVPerr(EVP_F_EVP_PKCS82PKEY, | ||
| 251 | EVP_R_DECODE_ERROR); | ||
| 252 | goto ecerr; | ||
| 253 | } | ||
| 254 | } | ||
| 255 | else | ||
| 256 | { | ||
| 257 | EC_GROUP *group; | ||
| 258 | cp = p = param->value.object->data; | ||
| 259 | plen = param->value.object->length; | ||
| 260 | |||
| 261 | /* type == V_ASN1_OBJECT => the parameters are given | ||
| 262 | * by an asn1 OID | ||
| 263 | */ | ||
| 264 | if ((eckey = EC_KEY_new()) == NULL) | ||
| 265 | { | ||
| 266 | EVPerr(EVP_F_EVP_PKCS82PKEY, | ||
| 267 | ERR_R_MALLOC_FAILURE); | ||
| 268 | goto ecerr; | ||
| 269 | } | ||
| 270 | group = EC_GROUP_new_by_curve_name(OBJ_obj2nid(a->parameter->value.object)); | ||
| 271 | if (group == NULL) | ||
| 272 | goto ecerr; | ||
| 273 | EC_GROUP_set_asn1_flag(group, OPENSSL_EC_NAMED_CURVE); | ||
| 274 | if (EC_KEY_set_group(eckey, group) == 0) | ||
| 275 | goto ecerr; | ||
| 276 | EC_GROUP_free(group); | ||
| 277 | } | ||
| 278 | |||
| 279 | /* We have parameters now set private key */ | ||
| 280 | if (!d2i_ECPrivateKey(&eckey, &p_tmp, pkeylen)) | ||
| 281 | { | ||
| 282 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); | ||
| 283 | goto ecerr; | ||
| 284 | } | ||
| 285 | |||
| 286 | /* calculate public key (if necessary) */ | ||
| 287 | if (EC_KEY_get0_public_key(eckey) == NULL) | ||
| 288 | { | ||
| 289 | const BIGNUM *priv_key; | ||
| 290 | const EC_GROUP *group; | ||
| 291 | EC_POINT *pub_key; | ||
| 292 | /* the public key was not included in the SEC1 private | ||
| 293 | * key => calculate the public key */ | ||
| 294 | group = EC_KEY_get0_group(eckey); | ||
| 295 | pub_key = EC_POINT_new(group); | ||
| 296 | if (pub_key == NULL) | ||
| 297 | { | ||
| 298 | EVPerr(EVP_F_EVP_PKCS82PKEY, ERR_R_EC_LIB); | ||
| 299 | goto ecerr; | ||
| 300 | } | ||
| 301 | if (!EC_POINT_copy(pub_key, EC_GROUP_get0_generator(group))) | ||
| 302 | { | ||
| 303 | EC_POINT_free(pub_key); | ||
| 304 | EVPerr(EVP_F_EVP_PKCS82PKEY, ERR_R_EC_LIB); | ||
| 305 | goto ecerr; | ||
| 306 | } | ||
| 307 | priv_key = EC_KEY_get0_private_key(eckey); | ||
| 308 | if (!EC_POINT_mul(group, pub_key, priv_key, NULL, NULL, ctx)) | ||
| 309 | { | ||
| 310 | EC_POINT_free(pub_key); | ||
| 311 | EVPerr(EVP_F_EVP_PKCS82PKEY, ERR_R_EC_LIB); | ||
| 312 | goto ecerr; | ||
| 313 | } | ||
| 314 | if (EC_KEY_set_public_key(eckey, pub_key) == 0) | ||
| 315 | { | ||
| 316 | EC_POINT_free(pub_key); | ||
| 317 | EVPerr(EVP_F_EVP_PKCS82PKEY, ERR_R_EC_LIB); | ||
| 318 | goto ecerr; | ||
| 319 | } | ||
| 320 | EC_POINT_free(pub_key); | ||
| 321 | } | ||
| 322 | |||
| 323 | EVP_PKEY_assign_EC_KEY(pkey, eckey); | ||
| 324 | if (ctx) | ||
| 325 | BN_CTX_free(ctx); | ||
| 326 | break; | ||
| 327 | ecerr: | ||
| 328 | if (ctx) | ||
| 329 | BN_CTX_free(ctx); | ||
| 330 | if (eckey) | ||
| 331 | EC_KEY_free(eckey); | ||
| 332 | if (pkey) | ||
| 333 | EVP_PKEY_free(pkey); | ||
| 334 | return NULL; | ||
| 335 | #endif | ||
| 336 | default: | ||
| 337 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM); | ||
| 338 | if (!a->algorithm) BUF_strlcpy (obj_tmp, "NULL", sizeof obj_tmp); | ||
| 339 | else i2t_ASN1_OBJECT(obj_tmp, 80, a->algorithm); | ||
| 340 | ERR_add_error_data(2, "TYPE=", obj_tmp); | ||
| 341 | EVP_PKEY_free (pkey); | ||
| 342 | return NULL; | ||
| 343 | } | ||
| 344 | return pkey; | ||
| 345 | } | ||
| 346 | |||
| 347 | PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey) | ||
| 348 | { | ||
| 349 | return EVP_PKEY2PKCS8_broken(pkey, PKCS8_OK); | ||
| 350 | } | ||
| 351 | |||
| 352 | /* Turn a private key into a PKCS8 structure */ | ||
| 353 | |||
| 354 | PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken) | ||
| 355 | { | ||
| 356 | PKCS8_PRIV_KEY_INFO *p8; | ||
| 357 | |||
| 358 | if (!(p8 = PKCS8_PRIV_KEY_INFO_new())) { | ||
| 359 | EVPerr(EVP_F_EVP_PKEY2PKCS8_BROKEN,ERR_R_MALLOC_FAILURE); | ||
| 360 | return NULL; | ||
| 361 | } | ||
| 362 | p8->broken = broken; | ||
| 363 | if (!ASN1_INTEGER_set(p8->version, 0)) { | ||
| 364 | EVPerr(EVP_F_EVP_PKEY2PKCS8_BROKEN,ERR_R_MALLOC_FAILURE); | ||
| 365 | PKCS8_PRIV_KEY_INFO_free (p8); | ||
| 366 | return NULL; | ||
| 367 | } | ||
| 368 | if (!(p8->pkeyalg->parameter = ASN1_TYPE_new ())) { | ||
| 369 | EVPerr(EVP_F_EVP_PKEY2PKCS8_BROKEN,ERR_R_MALLOC_FAILURE); | ||
| 370 | PKCS8_PRIV_KEY_INFO_free (p8); | ||
| 371 | return NULL; | ||
| 372 | } | ||
| 373 | p8->pkey->type = V_ASN1_OCTET_STRING; | ||
| 374 | switch (EVP_PKEY_type(pkey->type)) { | ||
| 375 | #ifndef OPENSSL_NO_RSA | ||
| 376 | case EVP_PKEY_RSA: | ||
| 377 | |||
| 378 | if(p8->broken == PKCS8_NO_OCTET) p8->pkey->type = V_ASN1_SEQUENCE; | ||
| 379 | |||
| 380 | p8->pkeyalg->algorithm = OBJ_nid2obj(NID_rsaEncryption); | ||
| 381 | p8->pkeyalg->parameter->type = V_ASN1_NULL; | ||
| 382 | if (!ASN1_pack_string_of (EVP_PKEY,pkey, i2d_PrivateKey, | ||
| 383 | &p8->pkey->value.octet_string)) { | ||
| 384 | EVPerr(EVP_F_EVP_PKEY2PKCS8_BROKEN,ERR_R_MALLOC_FAILURE); | ||
| 385 | PKCS8_PRIV_KEY_INFO_free (p8); | ||
| 386 | return NULL; | ||
| 387 | } | ||
| 388 | break; | ||
| 389 | #endif | ||
| 390 | #ifndef OPENSSL_NO_DSA | ||
| 391 | case EVP_PKEY_DSA: | ||
| 392 | if(!dsa_pkey2pkcs8(p8, pkey)) { | ||
| 393 | PKCS8_PRIV_KEY_INFO_free (p8); | ||
| 394 | return NULL; | ||
| 395 | } | ||
| 396 | |||
| 397 | break; | ||
| 398 | #endif | ||
| 399 | #ifndef OPENSSL_NO_EC | ||
| 400 | case EVP_PKEY_EC: | ||
| 401 | if (!eckey_pkey2pkcs8(p8, pkey)) | ||
| 402 | { | ||
| 403 | PKCS8_PRIV_KEY_INFO_free(p8); | ||
| 404 | return(NULL); | ||
| 405 | } | ||
| 406 | break; | ||
| 407 | #endif | ||
| 408 | default: | ||
| 409 | EVPerr(EVP_F_EVP_PKEY2PKCS8_BROKEN, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM); | ||
| 410 | PKCS8_PRIV_KEY_INFO_free (p8); | ||
| 411 | return NULL; | ||
| 412 | } | ||
| 413 | RAND_add(p8->pkey->value.octet_string->data, | ||
| 414 | p8->pkey->value.octet_string->length, 0.0); | ||
| 415 | return p8; | ||
| 416 | } | ||
| 417 | |||
| 418 | PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken) | ||
| 419 | { | ||
| 420 | switch (broken) { | ||
| 421 | |||
| 422 | case PKCS8_OK: | ||
| 423 | p8->broken = PKCS8_OK; | ||
| 424 | return p8; | ||
| 425 | break; | ||
| 426 | |||
| 427 | case PKCS8_NO_OCTET: | ||
| 428 | p8->broken = PKCS8_NO_OCTET; | ||
| 429 | p8->pkey->type = V_ASN1_SEQUENCE; | ||
| 430 | return p8; | ||
| 431 | break; | ||
| 432 | |||
| 433 | default: | ||
| 434 | EVPerr(EVP_F_PKCS8_SET_BROKEN,EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE); | ||
| 435 | return NULL; | ||
| 436 | } | ||
| 437 | } | ||
| 438 | |||
| 439 | #ifndef OPENSSL_NO_DSA | ||
| 440 | static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey) | ||
| 441 | { | ||
| 442 | ASN1_STRING *params = NULL; | ||
| 443 | ASN1_INTEGER *prkey = NULL; | ||
| 444 | ASN1_TYPE *ttmp = NULL; | ||
| 445 | STACK_OF(ASN1_TYPE) *ndsa = NULL; | ||
| 446 | unsigned char *p = NULL, *q; | ||
| 447 | int len; | ||
| 448 | |||
| 449 | p8->pkeyalg->algorithm = OBJ_nid2obj(NID_dsa); | ||
| 450 | len = i2d_DSAparams (pkey->pkey.dsa, NULL); | ||
| 451 | if (!(p = OPENSSL_malloc(len))) { | ||
| 452 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 453 | goto err; | ||
| 454 | } | ||
| 455 | q = p; | ||
| 456 | i2d_DSAparams (pkey->pkey.dsa, &q); | ||
| 457 | if (!(params = ASN1_STRING_new())) { | ||
| 458 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 459 | goto err; | ||
| 460 | } | ||
| 461 | if (!ASN1_STRING_set(params, p, len)) { | ||
| 462 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 463 | goto err; | ||
| 464 | } | ||
| 465 | OPENSSL_free(p); | ||
| 466 | p = NULL; | ||
| 467 | /* Get private key into integer */ | ||
| 468 | if (!(prkey = BN_to_ASN1_INTEGER (pkey->pkey.dsa->priv_key, NULL))) { | ||
| 469 | EVPerr(EVP_F_DSA_PKEY2PKCS8,EVP_R_ENCODE_ERROR); | ||
| 470 | goto err; | ||
| 471 | } | ||
| 472 | |||
| 473 | switch(p8->broken) { | ||
| 474 | |||
| 475 | case PKCS8_OK: | ||
| 476 | case PKCS8_NO_OCTET: | ||
| 477 | |||
| 478 | if (!ASN1_pack_string_of(ASN1_INTEGER,prkey, i2d_ASN1_INTEGER, | ||
| 479 | &p8->pkey->value.octet_string)) { | ||
| 480 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 481 | goto err; | ||
| 482 | } | ||
| 483 | |||
| 484 | M_ASN1_INTEGER_free (prkey); | ||
| 485 | prkey = NULL; | ||
| 486 | p8->pkeyalg->parameter->value.sequence = params; | ||
| 487 | params = NULL; | ||
| 488 | p8->pkeyalg->parameter->type = V_ASN1_SEQUENCE; | ||
| 489 | |||
| 490 | break; | ||
| 491 | |||
| 492 | case PKCS8_NS_DB: | ||
| 493 | |||
| 494 | p8->pkeyalg->parameter->value.sequence = params; | ||
| 495 | params = NULL; | ||
| 496 | p8->pkeyalg->parameter->type = V_ASN1_SEQUENCE; | ||
| 497 | if (!(ndsa = sk_ASN1_TYPE_new_null())) { | ||
| 498 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 499 | goto err; | ||
| 500 | } | ||
| 501 | if (!(ttmp = ASN1_TYPE_new())) { | ||
| 502 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 503 | goto err; | ||
| 504 | } | ||
| 505 | if (!(ttmp->value.integer = | ||
| 506 | BN_to_ASN1_INTEGER(pkey->pkey.dsa->pub_key, NULL))) { | ||
| 507 | EVPerr(EVP_F_DSA_PKEY2PKCS8,EVP_R_ENCODE_ERROR); | ||
| 508 | goto err; | ||
| 509 | } | ||
| 510 | ttmp->type = V_ASN1_INTEGER; | ||
| 511 | if (!sk_ASN1_TYPE_push(ndsa, ttmp)) { | ||
| 512 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 513 | goto err; | ||
| 514 | } | ||
| 515 | |||
| 516 | if (!(ttmp = ASN1_TYPE_new())) { | ||
| 517 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 518 | goto err; | ||
| 519 | } | ||
| 520 | ttmp->value.integer = prkey; | ||
| 521 | prkey = NULL; | ||
| 522 | ttmp->type = V_ASN1_INTEGER; | ||
| 523 | if (!sk_ASN1_TYPE_push(ndsa, ttmp)) { | ||
| 524 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 525 | goto err; | ||
| 526 | } | ||
| 527 | ttmp = NULL; | ||
| 528 | |||
| 529 | if (!(p8->pkey->value.octet_string = ASN1_OCTET_STRING_new())) { | ||
| 530 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 531 | goto err; | ||
| 532 | } | ||
| 533 | |||
| 534 | if (!ASN1_seq_pack_ASN1_TYPE(ndsa, i2d_ASN1_TYPE, | ||
| 535 | &p8->pkey->value.octet_string->data, | ||
| 536 | &p8->pkey->value.octet_string->length)) { | ||
| 537 | |||
| 538 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 539 | goto err; | ||
| 540 | } | ||
| 541 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | ||
| 542 | break; | ||
| 543 | |||
| 544 | case PKCS8_EMBEDDED_PARAM: | ||
| 545 | |||
| 546 | p8->pkeyalg->parameter->type = V_ASN1_NULL; | ||
| 547 | if (!(ndsa = sk_ASN1_TYPE_new_null())) { | ||
| 548 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 549 | goto err; | ||
| 550 | } | ||
| 551 | if (!(ttmp = ASN1_TYPE_new())) { | ||
| 552 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 553 | goto err; | ||
| 554 | } | ||
| 555 | ttmp->value.sequence = params; | ||
| 556 | params = NULL; | ||
| 557 | ttmp->type = V_ASN1_SEQUENCE; | ||
| 558 | if (!sk_ASN1_TYPE_push(ndsa, ttmp)) { | ||
| 559 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 560 | goto err; | ||
| 561 | } | ||
| 562 | |||
| 563 | if (!(ttmp = ASN1_TYPE_new())) { | ||
| 564 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 565 | goto err; | ||
| 566 | } | ||
| 567 | ttmp->value.integer = prkey; | ||
| 568 | prkey = NULL; | ||
| 569 | ttmp->type = V_ASN1_INTEGER; | ||
| 570 | if (!sk_ASN1_TYPE_push(ndsa, ttmp)) { | ||
| 571 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 572 | goto err; | ||
| 573 | } | ||
| 574 | ttmp = NULL; | ||
| 575 | |||
| 576 | if (!(p8->pkey->value.octet_string = ASN1_OCTET_STRING_new())) { | ||
| 577 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 578 | goto err; | ||
| 579 | } | ||
| 580 | |||
| 581 | if (!ASN1_seq_pack_ASN1_TYPE(ndsa, i2d_ASN1_TYPE, | ||
| 582 | &p8->pkey->value.octet_string->data, | ||
| 583 | &p8->pkey->value.octet_string->length)) { | ||
| 584 | |||
| 585 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 586 | goto err; | ||
| 587 | } | ||
| 588 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | ||
| 589 | break; | ||
| 590 | } | ||
| 591 | return 1; | ||
| 592 | err: | ||
| 593 | if (p != NULL) OPENSSL_free(p); | ||
| 594 | if (params != NULL) ASN1_STRING_free(params); | ||
| 595 | if (prkey != NULL) M_ASN1_INTEGER_free(prkey); | ||
| 596 | if (ttmp != NULL) ASN1_TYPE_free(ttmp); | ||
| 597 | if (ndsa != NULL) sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | ||
| 598 | return 0; | ||
| 599 | } | ||
| 600 | #endif | ||
| 601 | |||
| 602 | #ifndef OPENSSL_NO_EC | ||
| 603 | static int eckey_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey) | ||
| 604 | { | ||
| 605 | EC_KEY *ec_key; | ||
| 606 | const EC_GROUP *group; | ||
| 607 | unsigned char *p, *pp; | ||
| 608 | int nid, i, ret = 0; | ||
| 609 | unsigned int tmp_flags, old_flags; | ||
| 610 | |||
| 611 | ec_key = pkey->pkey.ec; | ||
| 612 | if (ec_key == NULL || (group = EC_KEY_get0_group(ec_key)) == NULL) | ||
| 613 | { | ||
| 614 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8, EVP_R_MISSING_PARAMETERS); | ||
| 615 | return 0; | ||
| 616 | } | ||
| 617 | |||
| 618 | /* set the ec parameters OID */ | ||
| 619 | if (p8->pkeyalg->algorithm) | ||
| 620 | ASN1_OBJECT_free(p8->pkeyalg->algorithm); | ||
| 621 | |||
| 622 | p8->pkeyalg->algorithm = OBJ_nid2obj(NID_X9_62_id_ecPublicKey); | ||
| 623 | |||
| 624 | /* set the ec parameters */ | ||
| 625 | |||
| 626 | if (p8->pkeyalg->parameter) | ||
| 627 | { | ||
| 628 | ASN1_TYPE_free(p8->pkeyalg->parameter); | ||
| 629 | p8->pkeyalg->parameter = NULL; | ||
| 630 | } | ||
| 631 | |||
| 632 | if ((p8->pkeyalg->parameter = ASN1_TYPE_new()) == NULL) | ||
| 633 | { | ||
| 634 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_MALLOC_FAILURE); | ||
| 635 | return 0; | ||
| 636 | } | ||
| 637 | |||
| 638 | if (EC_GROUP_get_asn1_flag(group) | ||
| 639 | && (nid = EC_GROUP_get_curve_name(group))) | ||
| 640 | { | ||
| 641 | /* we have a 'named curve' => just set the OID */ | ||
| 642 | p8->pkeyalg->parameter->type = V_ASN1_OBJECT; | ||
| 643 | p8->pkeyalg->parameter->value.object = OBJ_nid2obj(nid); | ||
| 644 | } | ||
| 645 | else /* explicit parameters */ | ||
| 646 | { | ||
| 647 | if ((i = i2d_ECParameters(ec_key, NULL)) == 0) | ||
| 648 | { | ||
| 649 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_EC_LIB); | ||
| 650 | return 0; | ||
| 651 | } | ||
| 652 | if ((p = (unsigned char *) OPENSSL_malloc(i)) == NULL) | ||
| 653 | { | ||
| 654 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_MALLOC_FAILURE); | ||
| 655 | return 0; | ||
| 656 | } | ||
| 657 | pp = p; | ||
| 658 | if (!i2d_ECParameters(ec_key, &pp)) | ||
| 659 | { | ||
| 660 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_EC_LIB); | ||
| 661 | OPENSSL_free(p); | ||
| 662 | return 0; | ||
| 663 | } | ||
| 664 | p8->pkeyalg->parameter->type = V_ASN1_SEQUENCE; | ||
| 665 | if ((p8->pkeyalg->parameter->value.sequence | ||
| 666 | = ASN1_STRING_new()) == NULL) | ||
| 667 | { | ||
| 668 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_ASN1_LIB); | ||
| 669 | OPENSSL_free(p); | ||
| 670 | return 0; | ||
| 671 | } | ||
| 672 | ASN1_STRING_set(p8->pkeyalg->parameter->value.sequence, p, i); | ||
| 673 | OPENSSL_free(p); | ||
| 674 | } | ||
| 675 | |||
| 676 | /* set the private key */ | ||
| 677 | |||
| 678 | /* do not include the parameters in the SEC1 private key | ||
| 679 | * see PKCS#11 12.11 */ | ||
| 680 | old_flags = EC_KEY_get_enc_flags(pkey->pkey.ec); | ||
| 681 | tmp_flags = old_flags | EC_PKEY_NO_PARAMETERS; | ||
| 682 | EC_KEY_set_enc_flags(pkey->pkey.ec, tmp_flags); | ||
| 683 | i = i2d_ECPrivateKey(pkey->pkey.ec, NULL); | ||
| 684 | if (!i) | ||
| 685 | { | ||
| 686 | EC_KEY_set_enc_flags(pkey->pkey.ec, old_flags); | ||
| 687 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_EC_LIB); | ||
| 688 | return 0; | ||
| 689 | } | ||
| 690 | p = (unsigned char *) OPENSSL_malloc(i); | ||
| 691 | if (!p) | ||
| 692 | { | ||
| 693 | EC_KEY_set_enc_flags(pkey->pkey.ec, old_flags); | ||
| 694 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_MALLOC_FAILURE); | ||
| 695 | return 0; | ||
| 696 | } | ||
| 697 | pp = p; | ||
| 698 | if (!i2d_ECPrivateKey(pkey->pkey.ec, &pp)) | ||
| 699 | { | ||
| 700 | EC_KEY_set_enc_flags(pkey->pkey.ec, old_flags); | ||
| 701 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_EC_LIB); | ||
| 702 | OPENSSL_free(p); | ||
| 703 | return 0; | ||
| 704 | } | ||
| 705 | /* restore old encoding flags */ | ||
| 706 | EC_KEY_set_enc_flags(pkey->pkey.ec, old_flags); | ||
| 707 | |||
| 708 | switch(p8->broken) { | ||
| 709 | |||
| 710 | case PKCS8_OK: | ||
| 711 | p8->pkey->value.octet_string = ASN1_OCTET_STRING_new(); | ||
| 712 | if (!p8->pkey->value.octet_string || | ||
| 713 | !M_ASN1_OCTET_STRING_set(p8->pkey->value.octet_string, | ||
| 714 | (const void *)p, i)) | ||
| 715 | |||
| 716 | { | ||
| 717 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_MALLOC_FAILURE); | ||
| 718 | } | ||
| 719 | else | ||
| 720 | ret = 1; | ||
| 721 | break; | ||
| 722 | case PKCS8_NO_OCTET: /* RSA specific */ | ||
| 723 | case PKCS8_NS_DB: /* DSA specific */ | ||
| 724 | case PKCS8_EMBEDDED_PARAM: /* DSA specific */ | ||
| 725 | default: | ||
| 726 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8,EVP_R_ENCODE_ERROR); | ||
| 727 | } | ||
| 728 | OPENSSL_cleanse(p, (size_t)i); | ||
| 729 | OPENSSL_free(p); | ||
| 730 | return ret; | ||
| 731 | } | ||
| 732 | #endif | ||
| 733 | |||
| 734 | /* EVP_PKEY attribute functions */ | ||
| 735 | |||
| 736 | int EVP_PKEY_get_attr_count(const EVP_PKEY *key) | ||
| 737 | { | ||
| 738 | return X509at_get_attr_count(key->attributes); | ||
| 739 | } | ||
| 740 | |||
| 741 | int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, | ||
| 742 | int lastpos) | ||
| 743 | { | ||
| 744 | return X509at_get_attr_by_NID(key->attributes, nid, lastpos); | ||
| 745 | } | ||
| 746 | |||
| 747 | int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, ASN1_OBJECT *obj, | ||
| 748 | int lastpos) | ||
| 749 | { | ||
| 750 | return X509at_get_attr_by_OBJ(key->attributes, obj, lastpos); | ||
| 751 | } | ||
| 752 | |||
| 753 | X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc) | ||
| 754 | { | ||
| 755 | return X509at_get_attr(key->attributes, loc); | ||
| 756 | } | ||
| 757 | |||
| 758 | X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc) | ||
| 759 | { | ||
| 760 | return X509at_delete_attr(key->attributes, loc); | ||
| 761 | } | ||
| 762 | |||
| 763 | int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr) | ||
| 764 | { | ||
| 765 | if(X509at_add1_attr(&key->attributes, attr)) return 1; | ||
| 766 | return 0; | ||
| 767 | } | ||
| 768 | |||
| 769 | int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key, | ||
| 770 | const ASN1_OBJECT *obj, int type, | ||
| 771 | const unsigned char *bytes, int len) | ||
| 772 | { | ||
| 773 | if(X509at_add1_attr_by_OBJ(&key->attributes, obj, | ||
| 774 | type, bytes, len)) return 1; | ||
| 775 | return 0; | ||
| 776 | } | ||
| 777 | |||
| 778 | int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key, | ||
| 779 | int nid, int type, | ||
| 780 | const unsigned char *bytes, int len) | ||
| 781 | { | ||
| 782 | if(X509at_add1_attr_by_NID(&key->attributes, nid, | ||
| 783 | type, bytes, len)) return 1; | ||
| 784 | return 0; | ||
| 785 | } | ||
| 786 | |||
| 787 | int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key, | ||
| 788 | const char *attrname, int type, | ||
| 789 | const unsigned char *bytes, int len) | ||
| 790 | { | ||
| 791 | if(X509at_add1_attr_by_txt(&key->attributes, attrname, | ||
| 792 | type, bytes, len)) return 1; | ||
| 793 | return 0; | ||
| 794 | } | ||
diff --git a/src/lib/libcrypto/evp/m_dss.c b/src/lib/libcrypto/evp/m_dss.c new file mode 100644 index 0000000000..a948c77fa4 --- /dev/null +++ b/src/lib/libcrypto/evp/m_dss.c | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | /* crypto/evp/m_dss.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/evp.h> | ||
| 62 | #include <openssl/objects.h> | ||
| 63 | #include <openssl/x509.h> | ||
| 64 | #ifndef OPENSSL_NO_DSA | ||
| 65 | #include <openssl/dsa.h> | ||
| 66 | #endif | ||
| 67 | |||
| 68 | #ifndef OPENSSL_NO_SHA | ||
| 69 | |||
| 70 | static int init(EVP_MD_CTX *ctx) | ||
| 71 | { return SHA1_Init(ctx->md_data); } | ||
| 72 | |||
| 73 | static int update(EVP_MD_CTX *ctx,const void *data,size_t count) | ||
| 74 | { return SHA1_Update(ctx->md_data,data,count); } | ||
| 75 | |||
| 76 | static int final(EVP_MD_CTX *ctx,unsigned char *md) | ||
| 77 | { return SHA1_Final(md,ctx->md_data); } | ||
| 78 | |||
| 79 | static const EVP_MD dsa_md= | ||
| 80 | { | ||
| 81 | NID_dsaWithSHA, | ||
| 82 | NID_dsaWithSHA, | ||
| 83 | SHA_DIGEST_LENGTH, | ||
| 84 | 0, | ||
| 85 | init, | ||
| 86 | update, | ||
| 87 | final, | ||
| 88 | NULL, | ||
| 89 | NULL, | ||
| 90 | EVP_PKEY_DSA_method, | ||
| 91 | SHA_CBLOCK, | ||
| 92 | sizeof(EVP_MD *)+sizeof(SHA_CTX), | ||
| 93 | }; | ||
| 94 | |||
| 95 | const EVP_MD *EVP_dss(void) | ||
| 96 | { | ||
| 97 | return(&dsa_md); | ||
| 98 | } | ||
| 99 | #endif | ||
diff --git a/src/lib/libcrypto/evp/m_dss1.c b/src/lib/libcrypto/evp/m_dss1.c new file mode 100644 index 0000000000..c12e13972b --- /dev/null +++ b/src/lib/libcrypto/evp/m_dss1.c | |||
| @@ -0,0 +1,100 @@ | |||
| 1 | /* crypto/evp/m_dss1.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | |||
| 62 | #ifndef OPENSSL_NO_SHA | ||
| 63 | |||
| 64 | #include <openssl/evp.h> | ||
| 65 | #include <openssl/objects.h> | ||
| 66 | #include <openssl/x509.h> | ||
| 67 | #ifndef OPENSSL_NO_DSA | ||
| 68 | #include <openssl/dsa.h> | ||
| 69 | #endif | ||
| 70 | |||
| 71 | static int init(EVP_MD_CTX *ctx) | ||
| 72 | { return SHA1_Init(ctx->md_data); } | ||
| 73 | |||
| 74 | static int update(EVP_MD_CTX *ctx,const void *data,size_t count) | ||
| 75 | { return SHA1_Update(ctx->md_data,data,count); } | ||
| 76 | |||
| 77 | static int final(EVP_MD_CTX *ctx,unsigned char *md) | ||
| 78 | { return SHA1_Final(md,ctx->md_data); } | ||
| 79 | |||
| 80 | static const EVP_MD dss1_md= | ||
| 81 | { | ||
| 82 | NID_dsa, | ||
| 83 | NID_dsaWithSHA1, | ||
| 84 | SHA_DIGEST_LENGTH, | ||
| 85 | 0, | ||
| 86 | init, | ||
| 87 | update, | ||
| 88 | final, | ||
| 89 | NULL, | ||
| 90 | NULL, | ||
| 91 | EVP_PKEY_DSA_method, | ||
| 92 | SHA_CBLOCK, | ||
| 93 | sizeof(EVP_MD *)+sizeof(SHA_CTX), | ||
| 94 | }; | ||
| 95 | |||
| 96 | const EVP_MD *EVP_dss1(void) | ||
| 97 | { | ||
| 98 | return(&dss1_md); | ||
| 99 | } | ||
| 100 | #endif | ||
diff --git a/src/lib/libcrypto/evp/m_ecdsa.c b/src/lib/libcrypto/evp/m_ecdsa.c new file mode 100644 index 0000000000..fad270faca --- /dev/null +++ b/src/lib/libcrypto/evp/m_ecdsa.c | |||
| @@ -0,0 +1,148 @@ | |||
| 1 | /* crypto/evp/m_ecdsa.c */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@openssl.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | * This product includes cryptographic software written by Eric Young | ||
| 51 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 52 | * Hudson (tjh@cryptsoft.com). | ||
| 53 | * | ||
| 54 | */ | ||
| 55 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 56 | * All rights reserved. | ||
| 57 | * | ||
| 58 | * This package is an SSL implementation written | ||
| 59 | * by Eric Young (eay@cryptsoft.com). | ||
| 60 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 61 | * | ||
| 62 | * This library is free for commercial and non-commercial use as long as | ||
| 63 | * the following conditions are aheared to. The following conditions | ||
| 64 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 65 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 66 | * included with this distribution is covered by the same copyright terms | ||
| 67 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 68 | * | ||
| 69 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 70 | * the code are not to be removed. | ||
| 71 | * If this package is used in a product, Eric Young should be given attribution | ||
| 72 | * as the author of the parts of the library used. | ||
| 73 | * This can be in the form of a textual message at program startup or | ||
| 74 | * in documentation (online or textual) provided with the package. | ||
| 75 | * | ||
| 76 | * Redistribution and use in source and binary forms, with or without | ||
| 77 | * modification, are permitted provided that the following conditions | ||
| 78 | * are met: | ||
| 79 | * 1. Redistributions of source code must retain the copyright | ||
| 80 | * notice, this list of conditions and the following disclaimer. | ||
| 81 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 82 | * notice, this list of conditions and the following disclaimer in the | ||
| 83 | * documentation and/or other materials provided with the distribution. | ||
| 84 | * 3. All advertising materials mentioning features or use of this software | ||
| 85 | * must display the following acknowledgement: | ||
| 86 | * "This product includes cryptographic software written by | ||
| 87 | * Eric Young (eay@cryptsoft.com)" | ||
| 88 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 89 | * being used are not cryptographic related :-). | ||
| 90 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 91 | * the apps directory (application code) you must include an acknowledgement: | ||
| 92 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 93 | * | ||
| 94 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 95 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 96 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 97 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 98 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 99 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 100 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 101 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 102 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 103 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 104 | * SUCH DAMAGE. | ||
| 105 | * | ||
| 106 | * The licence and distribution terms for any publically available version or | ||
| 107 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 108 | * copied and put under another distribution licence | ||
| 109 | * [including the GNU Public Licence.] | ||
| 110 | */ | ||
| 111 | |||
| 112 | #include <stdio.h> | ||
| 113 | #include "cryptlib.h" | ||
| 114 | #include <openssl/evp.h> | ||
| 115 | #include <openssl/objects.h> | ||
| 116 | #include <openssl/x509.h> | ||
| 117 | |||
| 118 | #ifndef OPENSSL_NO_SHA | ||
| 119 | static int init(EVP_MD_CTX *ctx) | ||
| 120 | { return SHA1_Init(ctx->md_data); } | ||
| 121 | |||
| 122 | static int update(EVP_MD_CTX *ctx,const void *data,size_t count) | ||
| 123 | { return SHA1_Update(ctx->md_data,data,count); } | ||
| 124 | |||
| 125 | static int final(EVP_MD_CTX *ctx,unsigned char *md) | ||
| 126 | { return SHA1_Final(md,ctx->md_data); } | ||
| 127 | |||
| 128 | static const EVP_MD ecdsa_md= | ||
| 129 | { | ||
| 130 | NID_ecdsa_with_SHA1, | ||
| 131 | NID_ecdsa_with_SHA1, | ||
| 132 | SHA_DIGEST_LENGTH, | ||
| 133 | 0, | ||
| 134 | init, | ||
| 135 | update, | ||
| 136 | final, | ||
| 137 | NULL, | ||
| 138 | NULL, | ||
| 139 | EVP_PKEY_ECDSA_method, | ||
| 140 | SHA_CBLOCK, | ||
| 141 | sizeof(EVP_MD *)+sizeof(SHA_CTX), | ||
| 142 | }; | ||
| 143 | |||
| 144 | const EVP_MD *EVP_ecdsa(void) | ||
| 145 | { | ||
| 146 | return(&ecdsa_md); | ||
| 147 | } | ||
| 148 | #endif | ||
diff --git a/src/lib/libcrypto/evp/m_md2.c b/src/lib/libcrypto/evp/m_md2.c index 8eee6236ba..5ce849f161 100644 --- a/src/lib/libcrypto/evp/m_md2.c +++ b/src/lib/libcrypto/evp/m_md2.c | |||
| @@ -58,7 +58,6 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include "evp_locl.h" | ||
| 62 | 61 | ||
| 63 | #ifndef OPENSSL_NO_MD2 | 62 | #ifndef OPENSSL_NO_MD2 |
| 64 | 63 | ||
diff --git a/src/lib/libcrypto/evp/m_md4.c b/src/lib/libcrypto/evp/m_md4.c new file mode 100644 index 0000000000..1e0b7c5b42 --- /dev/null +++ b/src/lib/libcrypto/evp/m_md4.c | |||
| @@ -0,0 +1,101 @@ | |||
| 1 | /* crypto/evp/m_md4.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | |||
| 62 | #ifndef OPENSSL_NO_MD4 | ||
| 63 | |||
| 64 | #include <openssl/evp.h> | ||
| 65 | #include <openssl/objects.h> | ||
| 66 | #include <openssl/x509.h> | ||
| 67 | #include <openssl/md4.h> | ||
| 68 | #ifndef OPENSSL_NO_RSA | ||
| 69 | #include <openssl/rsa.h> | ||
| 70 | #endif | ||
| 71 | |||
| 72 | static int init(EVP_MD_CTX *ctx) | ||
| 73 | { return MD4_Init(ctx->md_data); } | ||
| 74 | |||
| 75 | static int update(EVP_MD_CTX *ctx,const void *data,size_t count) | ||
| 76 | { return MD4_Update(ctx->md_data,data,count); } | ||
| 77 | |||
| 78 | static int final(EVP_MD_CTX *ctx,unsigned char *md) | ||
| 79 | { return MD4_Final(md,ctx->md_data); } | ||
| 80 | |||
| 81 | static const EVP_MD md4_md= | ||
| 82 | { | ||
| 83 | NID_md4, | ||
| 84 | NID_md4WithRSAEncryption, | ||
| 85 | MD4_DIGEST_LENGTH, | ||
| 86 | 0, | ||
| 87 | init, | ||
| 88 | update, | ||
| 89 | final, | ||
| 90 | NULL, | ||
| 91 | NULL, | ||
| 92 | EVP_PKEY_RSA_method, | ||
| 93 | MD4_CBLOCK, | ||
| 94 | sizeof(EVP_MD *)+sizeof(MD4_CTX), | ||
| 95 | }; | ||
| 96 | |||
| 97 | const EVP_MD *EVP_md4(void) | ||
| 98 | { | ||
| 99 | return(&md4_md); | ||
| 100 | } | ||
| 101 | #endif | ||
diff --git a/src/lib/libcrypto/evp/m_md5.c b/src/lib/libcrypto/evp/m_md5.c new file mode 100644 index 0000000000..63c142119e --- /dev/null +++ b/src/lib/libcrypto/evp/m_md5.c | |||
| @@ -0,0 +1,101 @@ | |||
| 1 | /* crypto/evp/m_md5.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | |||
| 62 | #ifndef OPENSSL_NO_MD5 | ||
| 63 | |||
| 64 | #include <openssl/evp.h> | ||
| 65 | #include <openssl/objects.h> | ||
| 66 | #include <openssl/x509.h> | ||
| 67 | #include <openssl/md5.h> | ||
| 68 | #ifndef OPENSSL_NO_RSA | ||
| 69 | #include <openssl/rsa.h> | ||
| 70 | #endif | ||
| 71 | |||
| 72 | static int init(EVP_MD_CTX *ctx) | ||
| 73 | { return MD5_Init(ctx->md_data); } | ||
| 74 | |||
| 75 | static int update(EVP_MD_CTX *ctx,const void *data,size_t count) | ||
| 76 | { return MD5_Update(ctx->md_data,data,count); } | ||
| 77 | |||
| 78 | static int final(EVP_MD_CTX *ctx,unsigned char *md) | ||
| 79 | { return MD5_Final(md,ctx->md_data); } | ||
| 80 | |||
| 81 | static const EVP_MD md5_md= | ||
| 82 | { | ||
| 83 | NID_md5, | ||
| 84 | NID_md5WithRSAEncryption, | ||
| 85 | MD5_DIGEST_LENGTH, | ||
| 86 | 0, | ||
| 87 | init, | ||
| 88 | update, | ||
| 89 | final, | ||
| 90 | NULL, | ||
| 91 | NULL, | ||
| 92 | EVP_PKEY_RSA_method, | ||
| 93 | MD5_CBLOCK, | ||
| 94 | sizeof(EVP_MD *)+sizeof(MD5_CTX), | ||
| 95 | }; | ||
| 96 | |||
| 97 | const EVP_MD *EVP_md5(void) | ||
| 98 | { | ||
| 99 | return(&md5_md); | ||
| 100 | } | ||
| 101 | #endif | ||
diff --git a/src/lib/libcrypto/evp/m_mdc2.c b/src/lib/libcrypto/evp/m_mdc2.c index 9f9bcf06ed..36c4e9b134 100644 --- a/src/lib/libcrypto/evp/m_mdc2.c +++ b/src/lib/libcrypto/evp/m_mdc2.c | |||
| @@ -58,7 +58,6 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include "evp_locl.h" | ||
| 62 | 61 | ||
| 63 | #ifndef OPENSSL_NO_MDC2 | 62 | #ifndef OPENSSL_NO_MDC2 |
| 64 | 63 | ||
diff --git a/src/lib/libcrypto/evp/m_null.c b/src/lib/libcrypto/evp/m_null.c new file mode 100644 index 0000000000..cb0721699d --- /dev/null +++ b/src/lib/libcrypto/evp/m_null.c | |||
| @@ -0,0 +1,95 @@ | |||
| 1 | /* crypto/evp/m_null.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/evp.h> | ||
| 62 | #include <openssl/objects.h> | ||
| 63 | #include <openssl/x509.h> | ||
| 64 | |||
| 65 | static int init(EVP_MD_CTX *ctx) | ||
| 66 | { return 1; } | ||
| 67 | |||
| 68 | static int update(EVP_MD_CTX *ctx,const void *data,size_t count) | ||
| 69 | { return 1; } | ||
| 70 | |||
| 71 | static int final(EVP_MD_CTX *ctx,unsigned char *md) | ||
| 72 | { return 1; } | ||
| 73 | |||
| 74 | static const EVP_MD null_md= | ||
| 75 | { | ||
| 76 | NID_undef, | ||
| 77 | NID_undef, | ||
| 78 | 0, | ||
| 79 | 0, | ||
| 80 | init, | ||
| 81 | update, | ||
| 82 | final, | ||
| 83 | NULL, | ||
| 84 | NULL, | ||
| 85 | EVP_PKEY_NULL_method, | ||
| 86 | 0, | ||
| 87 | sizeof(EVP_MD *), | ||
| 88 | }; | ||
| 89 | |||
| 90 | const EVP_MD *EVP_md_null(void) | ||
| 91 | { | ||
| 92 | return(&null_md); | ||
| 93 | } | ||
| 94 | |||
| 95 | |||
diff --git a/src/lib/libcrypto/evp/m_ripemd.c b/src/lib/libcrypto/evp/m_ripemd.c new file mode 100644 index 0000000000..a1d60ee78d --- /dev/null +++ b/src/lib/libcrypto/evp/m_ripemd.c | |||
| @@ -0,0 +1,101 @@ | |||
| 1 | /* crypto/evp/m_ripemd.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | |||
| 62 | #ifndef OPENSSL_NO_RIPEMD | ||
| 63 | |||
| 64 | #include <openssl/ripemd.h> | ||
| 65 | #include <openssl/evp.h> | ||
| 66 | #include <openssl/objects.h> | ||
| 67 | #include <openssl/x509.h> | ||
| 68 | #ifndef OPENSSL_NO_RSA | ||
| 69 | #include <openssl/rsa.h> | ||
| 70 | #endif | ||
| 71 | |||
| 72 | static int init(EVP_MD_CTX *ctx) | ||
| 73 | { return RIPEMD160_Init(ctx->md_data); } | ||
| 74 | |||
| 75 | static int update(EVP_MD_CTX *ctx,const void *data,size_t count) | ||
| 76 | { return RIPEMD160_Update(ctx->md_data,data,count); } | ||
| 77 | |||
| 78 | static int final(EVP_MD_CTX *ctx,unsigned char *md) | ||
| 79 | { return RIPEMD160_Final(md,ctx->md_data); } | ||
| 80 | |||
| 81 | static const EVP_MD ripemd160_md= | ||
| 82 | { | ||
| 83 | NID_ripemd160, | ||
| 84 | NID_ripemd160WithRSA, | ||
| 85 | RIPEMD160_DIGEST_LENGTH, | ||
| 86 | 0, | ||
| 87 | init, | ||
| 88 | update, | ||
| 89 | final, | ||
| 90 | NULL, | ||
| 91 | NULL, | ||
| 92 | EVP_PKEY_RSA_method, | ||
| 93 | RIPEMD160_CBLOCK, | ||
| 94 | sizeof(EVP_MD *)+sizeof(RIPEMD160_CTX), | ||
| 95 | }; | ||
| 96 | |||
| 97 | const EVP_MD *EVP_ripemd160(void) | ||
| 98 | { | ||
| 99 | return(&ripemd160_md); | ||
| 100 | } | ||
| 101 | #endif | ||
diff --git a/src/lib/libcrypto/evp/m_sha.c b/src/lib/libcrypto/evp/m_sha.c index 3f30dfc579..acccc8f92d 100644 --- a/src/lib/libcrypto/evp/m_sha.c +++ b/src/lib/libcrypto/evp/m_sha.c | |||
| @@ -58,7 +58,6 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include "evp_locl.h" | ||
| 62 | 61 | ||
| 63 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0) | 62 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0) |
| 64 | 63 | ||
diff --git a/src/lib/libcrypto/evp/m_sha1.c b/src/lib/libcrypto/evp/m_sha1.c new file mode 100644 index 0000000000..4679b1c463 --- /dev/null +++ b/src/lib/libcrypto/evp/m_sha1.c | |||
| @@ -0,0 +1,204 @@ | |||
| 1 | /* crypto/evp/m_sha1.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | |||
| 62 | #ifndef OPENSSL_NO_SHA | ||
| 63 | |||
| 64 | #include <openssl/evp.h> | ||
| 65 | #include <openssl/objects.h> | ||
| 66 | #include <openssl/x509.h> | ||
| 67 | #ifndef OPENSSL_NO_RSA | ||
| 68 | #include <openssl/rsa.h> | ||
| 69 | #endif | ||
| 70 | |||
| 71 | static int init(EVP_MD_CTX *ctx) | ||
| 72 | { return SHA1_Init(ctx->md_data); } | ||
| 73 | |||
| 74 | static int update(EVP_MD_CTX *ctx,const void *data,size_t count) | ||
| 75 | { return SHA1_Update(ctx->md_data,data,count); } | ||
| 76 | |||
| 77 | static int final(EVP_MD_CTX *ctx,unsigned char *md) | ||
| 78 | { return SHA1_Final(md,ctx->md_data); } | ||
| 79 | |||
| 80 | static const EVP_MD sha1_md= | ||
| 81 | { | ||
| 82 | NID_sha1, | ||
| 83 | NID_sha1WithRSAEncryption, | ||
| 84 | SHA_DIGEST_LENGTH, | ||
| 85 | 0, | ||
| 86 | init, | ||
| 87 | update, | ||
| 88 | final, | ||
| 89 | NULL, | ||
| 90 | NULL, | ||
| 91 | EVP_PKEY_RSA_method, | ||
| 92 | SHA_CBLOCK, | ||
| 93 | sizeof(EVP_MD *)+sizeof(SHA_CTX), | ||
| 94 | }; | ||
| 95 | |||
| 96 | const EVP_MD *EVP_sha1(void) | ||
| 97 | { | ||
| 98 | return(&sha1_md); | ||
| 99 | } | ||
| 100 | #endif | ||
| 101 | |||
| 102 | #ifndef OPENSSL_NO_SHA256 | ||
| 103 | static int init224(EVP_MD_CTX *ctx) | ||
| 104 | { return SHA224_Init(ctx->md_data); } | ||
| 105 | static int init256(EVP_MD_CTX *ctx) | ||
| 106 | { return SHA256_Init(ctx->md_data); } | ||
| 107 | /* | ||
| 108 | * Even though there're separate SHA224_[Update|Final], we call | ||
| 109 | * SHA256 functions even in SHA224 context. This is what happens | ||
| 110 | * there anyway, so we can spare few CPU cycles:-) | ||
| 111 | */ | ||
| 112 | static int update256(EVP_MD_CTX *ctx,const void *data,size_t count) | ||
| 113 | { return SHA256_Update(ctx->md_data,data,count); } | ||
| 114 | static int final256(EVP_MD_CTX *ctx,unsigned char *md) | ||
| 115 | { return SHA256_Final(md,ctx->md_data); } | ||
| 116 | |||
| 117 | static const EVP_MD sha224_md= | ||
| 118 | { | ||
| 119 | NID_sha224, | ||
| 120 | NID_sha224WithRSAEncryption, | ||
| 121 | SHA224_DIGEST_LENGTH, | ||
| 122 | 0, | ||
| 123 | init224, | ||
| 124 | update256, | ||
| 125 | final256, | ||
| 126 | NULL, | ||
| 127 | NULL, | ||
| 128 | EVP_PKEY_RSA_method, | ||
| 129 | SHA256_CBLOCK, | ||
| 130 | sizeof(EVP_MD *)+sizeof(SHA256_CTX), | ||
| 131 | }; | ||
| 132 | |||
| 133 | const EVP_MD *EVP_sha224(void) | ||
| 134 | { return(&sha224_md); } | ||
| 135 | |||
| 136 | static const EVP_MD sha256_md= | ||
| 137 | { | ||
| 138 | NID_sha256, | ||
| 139 | NID_sha256WithRSAEncryption, | ||
| 140 | SHA256_DIGEST_LENGTH, | ||
| 141 | 0, | ||
| 142 | init256, | ||
| 143 | update256, | ||
| 144 | final256, | ||
| 145 | NULL, | ||
| 146 | NULL, | ||
| 147 | EVP_PKEY_RSA_method, | ||
| 148 | SHA256_CBLOCK, | ||
| 149 | sizeof(EVP_MD *)+sizeof(SHA256_CTX), | ||
| 150 | }; | ||
| 151 | |||
| 152 | const EVP_MD *EVP_sha256(void) | ||
| 153 | { return(&sha256_md); } | ||
| 154 | #endif /* ifndef OPENSSL_NO_SHA256 */ | ||
| 155 | |||
| 156 | #ifndef OPENSSL_NO_SHA512 | ||
| 157 | static int init384(EVP_MD_CTX *ctx) | ||
| 158 | { return SHA384_Init(ctx->md_data); } | ||
| 159 | static int init512(EVP_MD_CTX *ctx) | ||
| 160 | { return SHA512_Init(ctx->md_data); } | ||
| 161 | /* See comment in SHA224/256 section */ | ||
| 162 | static int update512(EVP_MD_CTX *ctx,const void *data,size_t count) | ||
| 163 | { return SHA512_Update(ctx->md_data,data,count); } | ||
| 164 | static int final512(EVP_MD_CTX *ctx,unsigned char *md) | ||
| 165 | { return SHA512_Final(md,ctx->md_data); } | ||
| 166 | |||
| 167 | static const EVP_MD sha384_md= | ||
| 168 | { | ||
| 169 | NID_sha384, | ||
| 170 | NID_sha384WithRSAEncryption, | ||
| 171 | SHA384_DIGEST_LENGTH, | ||
| 172 | 0, | ||
| 173 | init384, | ||
| 174 | update512, | ||
| 175 | final512, | ||
| 176 | NULL, | ||
| 177 | NULL, | ||
| 178 | EVP_PKEY_RSA_method, | ||
| 179 | SHA512_CBLOCK, | ||
| 180 | sizeof(EVP_MD *)+sizeof(SHA512_CTX), | ||
| 181 | }; | ||
| 182 | |||
| 183 | const EVP_MD *EVP_sha384(void) | ||
| 184 | { return(&sha384_md); } | ||
| 185 | |||
| 186 | static const EVP_MD sha512_md= | ||
| 187 | { | ||
| 188 | NID_sha512, | ||
| 189 | NID_sha512WithRSAEncryption, | ||
| 190 | SHA512_DIGEST_LENGTH, | ||
| 191 | 0, | ||
| 192 | init512, | ||
| 193 | update512, | ||
| 194 | final512, | ||
| 195 | NULL, | ||
| 196 | NULL, | ||
| 197 | EVP_PKEY_RSA_method, | ||
| 198 | SHA512_CBLOCK, | ||
| 199 | sizeof(EVP_MD *)+sizeof(SHA512_CTX), | ||
| 200 | }; | ||
| 201 | |||
| 202 | const EVP_MD *EVP_sha512(void) | ||
| 203 | { return(&sha512_md); } | ||
| 204 | #endif /* ifndef OPENSSL_NO_SHA512 */ | ||
diff --git a/src/lib/libcrypto/evp/names.c b/src/lib/libcrypto/evp/names.c new file mode 100644 index 0000000000..88c1e780dd --- /dev/null +++ b/src/lib/libcrypto/evp/names.c | |||
| @@ -0,0 +1,123 @@ | |||
| 1 | /* crypto/evp/names.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/evp.h> | ||
| 62 | #include <openssl/objects.h> | ||
| 63 | #include <openssl/x509.h> | ||
| 64 | |||
| 65 | int EVP_add_cipher(const EVP_CIPHER *c) | ||
| 66 | { | ||
| 67 | int r; | ||
| 68 | |||
| 69 | r=OBJ_NAME_add(OBJ_nid2sn(c->nid),OBJ_NAME_TYPE_CIPHER_METH,(const char *)c); | ||
| 70 | if (r == 0) return(0); | ||
| 71 | r=OBJ_NAME_add(OBJ_nid2ln(c->nid),OBJ_NAME_TYPE_CIPHER_METH,(const char *)c); | ||
| 72 | return(r); | ||
| 73 | } | ||
| 74 | |||
| 75 | int EVP_add_digest(const EVP_MD *md) | ||
| 76 | { | ||
| 77 | int r; | ||
| 78 | const char *name; | ||
| 79 | |||
| 80 | name=OBJ_nid2sn(md->type); | ||
| 81 | r=OBJ_NAME_add(name,OBJ_NAME_TYPE_MD_METH,(const char *)md); | ||
| 82 | if (r == 0) return(0); | ||
| 83 | r=OBJ_NAME_add(OBJ_nid2ln(md->type),OBJ_NAME_TYPE_MD_METH,(const char *)md); | ||
| 84 | if (r == 0) return(0); | ||
| 85 | |||
| 86 | if (md->type != md->pkey_type) | ||
| 87 | { | ||
| 88 | r=OBJ_NAME_add(OBJ_nid2sn(md->pkey_type), | ||
| 89 | OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,name); | ||
| 90 | if (r == 0) return(0); | ||
| 91 | r=OBJ_NAME_add(OBJ_nid2ln(md->pkey_type), | ||
| 92 | OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,name); | ||
| 93 | } | ||
| 94 | return(r); | ||
| 95 | } | ||
| 96 | |||
| 97 | const EVP_CIPHER *EVP_get_cipherbyname(const char *name) | ||
| 98 | { | ||
| 99 | const EVP_CIPHER *cp; | ||
| 100 | |||
| 101 | cp=(const EVP_CIPHER *)OBJ_NAME_get(name,OBJ_NAME_TYPE_CIPHER_METH); | ||
| 102 | return(cp); | ||
| 103 | } | ||
| 104 | |||
| 105 | const EVP_MD *EVP_get_digestbyname(const char *name) | ||
| 106 | { | ||
| 107 | const EVP_MD *cp; | ||
| 108 | |||
| 109 | cp=(const EVP_MD *)OBJ_NAME_get(name,OBJ_NAME_TYPE_MD_METH); | ||
| 110 | return(cp); | ||
| 111 | } | ||
| 112 | |||
| 113 | void EVP_cleanup(void) | ||
| 114 | { | ||
| 115 | OBJ_NAME_cleanup(OBJ_NAME_TYPE_CIPHER_METH); | ||
| 116 | OBJ_NAME_cleanup(OBJ_NAME_TYPE_MD_METH); | ||
| 117 | /* The above calls will only clean out the contents of the name | ||
| 118 | hash table, but not the hash table itself. The following line | ||
| 119 | does that part. -- Richard Levitte */ | ||
| 120 | OBJ_NAME_cleanup(-1); | ||
| 121 | |||
| 122 | EVP_PBE_cleanup(); | ||
| 123 | } | ||
diff --git a/src/lib/libcrypto/evp/p5_crpt.c b/src/lib/libcrypto/evp/p5_crpt.c new file mode 100644 index 0000000000..48d50014a0 --- /dev/null +++ b/src/lib/libcrypto/evp/p5_crpt.c | |||
| @@ -0,0 +1,159 @@ | |||
| 1 | /* p5_crpt.c */ | ||
| 2 | /* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL | ||
| 3 | * project 1999. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include "cryptlib.h" | ||
| 62 | #include <openssl/x509.h> | ||
| 63 | #include <openssl/evp.h> | ||
| 64 | |||
| 65 | /* PKCS#5 v1.5 compatible PBE functions: see PKCS#5 v2.0 for more info. | ||
| 66 | */ | ||
| 67 | |||
| 68 | void PKCS5_PBE_add(void) | ||
| 69 | { | ||
| 70 | #ifndef OPENSSL_NO_DES | ||
| 71 | # ifndef OPENSSL_NO_MD5 | ||
| 72 | EVP_PBE_alg_add(NID_pbeWithMD5AndDES_CBC, EVP_des_cbc(), EVP_md5(), | ||
| 73 | PKCS5_PBE_keyivgen); | ||
| 74 | # endif | ||
| 75 | # ifndef OPENSSL_NO_MD2 | ||
| 76 | EVP_PBE_alg_add(NID_pbeWithMD2AndDES_CBC, EVP_des_cbc(), EVP_md2(), | ||
| 77 | PKCS5_PBE_keyivgen); | ||
| 78 | # endif | ||
| 79 | # ifndef OPENSSL_NO_SHA | ||
| 80 | EVP_PBE_alg_add(NID_pbeWithSHA1AndDES_CBC, EVP_des_cbc(), EVP_sha1(), | ||
| 81 | PKCS5_PBE_keyivgen); | ||
| 82 | # endif | ||
| 83 | #endif | ||
| 84 | #ifndef OPENSSL_NO_RC2 | ||
| 85 | # ifndef OPENSSL_NO_MD5 | ||
| 86 | EVP_PBE_alg_add(NID_pbeWithMD5AndRC2_CBC, EVP_rc2_64_cbc(), EVP_md5(), | ||
| 87 | PKCS5_PBE_keyivgen); | ||
| 88 | # endif | ||
| 89 | # ifndef OPENSSL_NO_MD2 | ||
| 90 | EVP_PBE_alg_add(NID_pbeWithMD2AndRC2_CBC, EVP_rc2_64_cbc(), EVP_md2(), | ||
| 91 | PKCS5_PBE_keyivgen); | ||
| 92 | # endif | ||
| 93 | # ifndef OPENSSL_NO_SHA | ||
| 94 | EVP_PBE_alg_add(NID_pbeWithSHA1AndRC2_CBC, EVP_rc2_64_cbc(), EVP_sha1(), | ||
| 95 | PKCS5_PBE_keyivgen); | ||
| 96 | # endif | ||
| 97 | #endif | ||
| 98 | #ifndef OPENSSL_NO_HMAC | ||
| 99 | EVP_PBE_alg_add(NID_pbes2, NULL, NULL, PKCS5_v2_PBE_keyivgen); | ||
| 100 | #endif | ||
| 101 | } | ||
| 102 | |||
| 103 | int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen, | ||
| 104 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, | ||
| 105 | int en_de) | ||
| 106 | { | ||
| 107 | EVP_MD_CTX ctx; | ||
| 108 | unsigned char md_tmp[EVP_MAX_MD_SIZE]; | ||
| 109 | unsigned char key[EVP_MAX_KEY_LENGTH], iv[EVP_MAX_IV_LENGTH]; | ||
| 110 | int i; | ||
| 111 | PBEPARAM *pbe; | ||
| 112 | int saltlen, iter; | ||
| 113 | unsigned char *salt; | ||
| 114 | const unsigned char *pbuf; | ||
| 115 | |||
| 116 | /* Extract useful info from parameter */ | ||
| 117 | if (param == NULL || param->type != V_ASN1_SEQUENCE || | ||
| 118 | param->value.sequence == NULL) { | ||
| 119 | EVPerr(EVP_F_PKCS5_PBE_KEYIVGEN,EVP_R_DECODE_ERROR); | ||
| 120 | return 0; | ||
| 121 | } | ||
| 122 | |||
| 123 | pbuf = param->value.sequence->data; | ||
| 124 | if (!(pbe = d2i_PBEPARAM(NULL, &pbuf, param->value.sequence->length))) { | ||
| 125 | EVPerr(EVP_F_PKCS5_PBE_KEYIVGEN,EVP_R_DECODE_ERROR); | ||
| 126 | return 0; | ||
| 127 | } | ||
| 128 | |||
| 129 | if (!pbe->iter) iter = 1; | ||
| 130 | else iter = ASN1_INTEGER_get (pbe->iter); | ||
| 131 | salt = pbe->salt->data; | ||
| 132 | saltlen = pbe->salt->length; | ||
| 133 | |||
| 134 | if(!pass) passlen = 0; | ||
| 135 | else if(passlen == -1) passlen = strlen(pass); | ||
| 136 | |||
| 137 | EVP_MD_CTX_init(&ctx); | ||
| 138 | EVP_DigestInit_ex(&ctx, md, NULL); | ||
| 139 | EVP_DigestUpdate(&ctx, pass, passlen); | ||
| 140 | EVP_DigestUpdate(&ctx, salt, saltlen); | ||
| 141 | PBEPARAM_free(pbe); | ||
| 142 | EVP_DigestFinal_ex(&ctx, md_tmp, NULL); | ||
| 143 | for (i = 1; i < iter; i++) { | ||
| 144 | EVP_DigestInit_ex(&ctx, md, NULL); | ||
| 145 | EVP_DigestUpdate(&ctx, md_tmp, EVP_MD_size(md)); | ||
| 146 | EVP_DigestFinal_ex (&ctx, md_tmp, NULL); | ||
| 147 | } | ||
| 148 | EVP_MD_CTX_cleanup(&ctx); | ||
| 149 | OPENSSL_assert(EVP_CIPHER_key_length(cipher) <= (int)sizeof(md_tmp)); | ||
| 150 | memcpy(key, md_tmp, EVP_CIPHER_key_length(cipher)); | ||
| 151 | OPENSSL_assert(EVP_CIPHER_iv_length(cipher) <= 16); | ||
| 152 | memcpy(iv, md_tmp + (16 - EVP_CIPHER_iv_length(cipher)), | ||
| 153 | EVP_CIPHER_iv_length(cipher)); | ||
| 154 | EVP_CipherInit_ex(cctx, cipher, NULL, key, iv, en_de); | ||
| 155 | OPENSSL_cleanse(md_tmp, EVP_MAX_MD_SIZE); | ||
| 156 | OPENSSL_cleanse(key, EVP_MAX_KEY_LENGTH); | ||
| 157 | OPENSSL_cleanse(iv, EVP_MAX_IV_LENGTH); | ||
| 158 | return 1; | ||
| 159 | } | ||
diff --git a/src/lib/libcrypto/evp/p5_crpt2.c b/src/lib/libcrypto/evp/p5_crpt2.c new file mode 100644 index 0000000000..c969d5a206 --- /dev/null +++ b/src/lib/libcrypto/evp/p5_crpt2.c | |||
| @@ -0,0 +1,263 @@ | |||
| 1 | /* p5_crpt2.c */ | ||
| 2 | /* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL | ||
| 3 | * project 1999. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | #include <stdio.h> | ||
| 59 | #include <stdlib.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #if !defined(OPENSSL_NO_HMAC) && !defined(OPENSSL_NO_SHA) | ||
| 62 | #include <openssl/x509.h> | ||
| 63 | #include <openssl/evp.h> | ||
| 64 | #include <openssl/hmac.h> | ||
| 65 | |||
| 66 | /* set this to print out info about the keygen algorithm */ | ||
| 67 | /* #define DEBUG_PKCS5V2 */ | ||
| 68 | |||
| 69 | #ifdef DEBUG_PKCS5V2 | ||
| 70 | static void h__dump (const unsigned char *p, int len); | ||
| 71 | #endif | ||
| 72 | |||
| 73 | /* This is an implementation of PKCS#5 v2.0 password based encryption key | ||
| 74 | * derivation function PBKDF2 using the only currently defined function HMAC | ||
| 75 | * with SHA1. Verified against test vectors posted by Peter Gutmann | ||
| 76 | * <pgut001@cs.auckland.ac.nz> to the PKCS-TNG <pkcs-tng@rsa.com> mailing list. | ||
| 77 | */ | ||
| 78 | |||
| 79 | int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, | ||
| 80 | const unsigned char *salt, int saltlen, int iter, | ||
| 81 | int keylen, unsigned char *out) | ||
| 82 | { | ||
| 83 | unsigned char digtmp[SHA_DIGEST_LENGTH], *p, itmp[4]; | ||
| 84 | int cplen, j, k, tkeylen; | ||
| 85 | unsigned long i = 1; | ||
| 86 | HMAC_CTX hctx; | ||
| 87 | |||
| 88 | HMAC_CTX_init(&hctx); | ||
| 89 | p = out; | ||
| 90 | tkeylen = keylen; | ||
| 91 | if(!pass) passlen = 0; | ||
| 92 | else if(passlen == -1) passlen = strlen(pass); | ||
| 93 | while(tkeylen) { | ||
| 94 | if(tkeylen > SHA_DIGEST_LENGTH) cplen = SHA_DIGEST_LENGTH; | ||
| 95 | else cplen = tkeylen; | ||
| 96 | /* We are unlikely to ever use more than 256 blocks (5120 bits!) | ||
| 97 | * but just in case... | ||
| 98 | */ | ||
| 99 | itmp[0] = (unsigned char)((i >> 24) & 0xff); | ||
| 100 | itmp[1] = (unsigned char)((i >> 16) & 0xff); | ||
| 101 | itmp[2] = (unsigned char)((i >> 8) & 0xff); | ||
| 102 | itmp[3] = (unsigned char)(i & 0xff); | ||
| 103 | HMAC_Init_ex(&hctx, pass, passlen, EVP_sha1(), NULL); | ||
| 104 | HMAC_Update(&hctx, salt, saltlen); | ||
| 105 | HMAC_Update(&hctx, itmp, 4); | ||
| 106 | HMAC_Final(&hctx, digtmp, NULL); | ||
| 107 | memcpy(p, digtmp, cplen); | ||
| 108 | for(j = 1; j < iter; j++) { | ||
| 109 | HMAC(EVP_sha1(), pass, passlen, | ||
| 110 | digtmp, SHA_DIGEST_LENGTH, digtmp, NULL); | ||
| 111 | for(k = 0; k < cplen; k++) p[k] ^= digtmp[k]; | ||
| 112 | } | ||
| 113 | tkeylen-= cplen; | ||
| 114 | i++; | ||
| 115 | p+= cplen; | ||
| 116 | } | ||
| 117 | HMAC_CTX_cleanup(&hctx); | ||
| 118 | #ifdef DEBUG_PKCS5V2 | ||
| 119 | fprintf(stderr, "Password:\n"); | ||
| 120 | h__dump (pass, passlen); | ||
| 121 | fprintf(stderr, "Salt:\n"); | ||
| 122 | h__dump (salt, saltlen); | ||
| 123 | fprintf(stderr, "Iteration count %d\n", iter); | ||
| 124 | fprintf(stderr, "Key:\n"); | ||
| 125 | h__dump (out, keylen); | ||
| 126 | #endif | ||
| 127 | return 1; | ||
| 128 | } | ||
| 129 | |||
| 130 | #ifdef DO_TEST | ||
| 131 | main() | ||
| 132 | { | ||
| 133 | unsigned char out[4]; | ||
| 134 | unsigned char salt[] = {0x12, 0x34, 0x56, 0x78}; | ||
| 135 | PKCS5_PBKDF2_HMAC_SHA1("password", -1, salt, 4, 5, 4, out); | ||
| 136 | fprintf(stderr, "Out %02X %02X %02X %02X\n", | ||
| 137 | out[0], out[1], out[2], out[3]); | ||
| 138 | } | ||
| 139 | |||
| 140 | #endif | ||
| 141 | |||
| 142 | /* Now the key derivation function itself. This is a bit evil because | ||
| 143 | * it has to check the ASN1 parameters are valid: and there are quite a | ||
| 144 | * few of them... | ||
| 145 | */ | ||
| 146 | |||
| 147 | int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | ||
| 148 | ASN1_TYPE *param, const EVP_CIPHER *c, const EVP_MD *md, | ||
| 149 | int en_de) | ||
| 150 | { | ||
| 151 | unsigned char *salt, key[EVP_MAX_KEY_LENGTH]; | ||
| 152 | const unsigned char *pbuf; | ||
| 153 | int saltlen, iter, plen; | ||
| 154 | unsigned int keylen; | ||
| 155 | PBE2PARAM *pbe2 = NULL; | ||
| 156 | const EVP_CIPHER *cipher; | ||
| 157 | PBKDF2PARAM *kdf = NULL; | ||
| 158 | |||
| 159 | if (param == NULL || param->type != V_ASN1_SEQUENCE || | ||
| 160 | param->value.sequence == NULL) { | ||
| 161 | EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,EVP_R_DECODE_ERROR); | ||
| 162 | return 0; | ||
| 163 | } | ||
| 164 | |||
| 165 | pbuf = param->value.sequence->data; | ||
| 166 | plen = param->value.sequence->length; | ||
| 167 | if(!(pbe2 = d2i_PBE2PARAM(NULL, &pbuf, plen))) { | ||
| 168 | EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,EVP_R_DECODE_ERROR); | ||
| 169 | return 0; | ||
| 170 | } | ||
| 171 | |||
| 172 | /* See if we recognise the key derivation function */ | ||
| 173 | |||
| 174 | if(OBJ_obj2nid(pbe2->keyfunc->algorithm) != NID_id_pbkdf2) { | ||
| 175 | EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, | ||
| 176 | EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION); | ||
| 177 | goto err; | ||
| 178 | } | ||
| 179 | |||
| 180 | /* lets see if we recognise the encryption algorithm. | ||
| 181 | */ | ||
| 182 | |||
| 183 | cipher = EVP_get_cipherbyname( | ||
| 184 | OBJ_nid2sn(OBJ_obj2nid(pbe2->encryption->algorithm))); | ||
| 185 | |||
| 186 | if(!cipher) { | ||
| 187 | EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, | ||
| 188 | EVP_R_UNSUPPORTED_CIPHER); | ||
| 189 | goto err; | ||
| 190 | } | ||
| 191 | |||
| 192 | /* Fixup cipher based on AlgorithmIdentifier */ | ||
| 193 | EVP_CipherInit_ex(ctx, cipher, NULL, NULL, NULL, en_de); | ||
| 194 | if(EVP_CIPHER_asn1_to_param(ctx, pbe2->encryption->parameter) < 0) { | ||
| 195 | EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, | ||
| 196 | EVP_R_CIPHER_PARAMETER_ERROR); | ||
| 197 | goto err; | ||
| 198 | } | ||
| 199 | keylen = EVP_CIPHER_CTX_key_length(ctx); | ||
| 200 | OPENSSL_assert(keylen <= sizeof key); | ||
| 201 | |||
| 202 | /* Now decode key derivation function */ | ||
| 203 | |||
| 204 | if(!pbe2->keyfunc->parameter || | ||
| 205 | (pbe2->keyfunc->parameter->type != V_ASN1_SEQUENCE)) | ||
| 206 | { | ||
| 207 | EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,EVP_R_DECODE_ERROR); | ||
| 208 | goto err; | ||
| 209 | } | ||
| 210 | |||
| 211 | pbuf = pbe2->keyfunc->parameter->value.sequence->data; | ||
| 212 | plen = pbe2->keyfunc->parameter->value.sequence->length; | ||
| 213 | if(!(kdf = d2i_PBKDF2PARAM(NULL, &pbuf, plen)) ) { | ||
| 214 | EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,EVP_R_DECODE_ERROR); | ||
| 215 | goto err; | ||
| 216 | } | ||
| 217 | |||
| 218 | PBE2PARAM_free(pbe2); | ||
| 219 | pbe2 = NULL; | ||
| 220 | |||
| 221 | /* Now check the parameters of the kdf */ | ||
| 222 | |||
| 223 | if(kdf->keylength && (ASN1_INTEGER_get(kdf->keylength) != (int)keylen)){ | ||
| 224 | EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, | ||
| 225 | EVP_R_UNSUPPORTED_KEYLENGTH); | ||
| 226 | goto err; | ||
| 227 | } | ||
| 228 | |||
| 229 | if(kdf->prf && (OBJ_obj2nid(kdf->prf->algorithm) != NID_hmacWithSHA1)) { | ||
| 230 | EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, EVP_R_UNSUPPORTED_PRF); | ||
| 231 | goto err; | ||
| 232 | } | ||
| 233 | |||
| 234 | if(kdf->salt->type != V_ASN1_OCTET_STRING) { | ||
| 235 | EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, | ||
| 236 | EVP_R_UNSUPPORTED_SALT_TYPE); | ||
| 237 | goto err; | ||
| 238 | } | ||
| 239 | |||
| 240 | /* it seems that its all OK */ | ||
| 241 | salt = kdf->salt->value.octet_string->data; | ||
| 242 | saltlen = kdf->salt->value.octet_string->length; | ||
| 243 | iter = ASN1_INTEGER_get(kdf->iter); | ||
| 244 | PKCS5_PBKDF2_HMAC_SHA1(pass, passlen, salt, saltlen, iter, keylen, key); | ||
| 245 | EVP_CipherInit_ex(ctx, NULL, NULL, key, NULL, en_de); | ||
| 246 | OPENSSL_cleanse(key, keylen); | ||
| 247 | PBKDF2PARAM_free(kdf); | ||
| 248 | return 1; | ||
| 249 | |||
| 250 | err: | ||
| 251 | PBE2PARAM_free(pbe2); | ||
| 252 | PBKDF2PARAM_free(kdf); | ||
| 253 | return 0; | ||
| 254 | } | ||
| 255 | |||
| 256 | #ifdef DEBUG_PKCS5V2 | ||
| 257 | static void h__dump (const unsigned char *p, int len) | ||
| 258 | { | ||
| 259 | for (; len --; p++) fprintf(stderr, "%02X ", *p); | ||
| 260 | fprintf(stderr, "\n"); | ||
| 261 | } | ||
| 262 | #endif | ||
| 263 | #endif | ||
diff --git a/src/lib/libcrypto/evp/p_dec.c b/src/lib/libcrypto/evp/p_dec.c new file mode 100644 index 0000000000..f64901f653 --- /dev/null +++ b/src/lib/libcrypto/evp/p_dec.c | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | /* crypto/evp/p_dec.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/rand.h> | ||
| 62 | #ifndef OPENSSL_NO_RSA | ||
| 63 | #include <openssl/rsa.h> | ||
| 64 | #endif | ||
| 65 | #include <openssl/evp.h> | ||
| 66 | #include <openssl/objects.h> | ||
| 67 | #include <openssl/x509.h> | ||
| 68 | |||
| 69 | int EVP_PKEY_decrypt(unsigned char *key, const unsigned char *ek, int ekl, | ||
| 70 | EVP_PKEY *priv) | ||
| 71 | { | ||
| 72 | int ret= -1; | ||
| 73 | |||
| 74 | #ifndef OPENSSL_NO_RSA | ||
| 75 | if (priv->type != EVP_PKEY_RSA) | ||
| 76 | { | ||
| 77 | #endif | ||
| 78 | EVPerr(EVP_F_EVP_PKEY_DECRYPT,EVP_R_PUBLIC_KEY_NOT_RSA); | ||
| 79 | #ifndef OPENSSL_NO_RSA | ||
| 80 | goto err; | ||
| 81 | } | ||
| 82 | |||
| 83 | ret=RSA_private_decrypt(ekl,ek,key,priv->pkey.rsa,RSA_PKCS1_PADDING); | ||
| 84 | err: | ||
| 85 | #endif | ||
| 86 | return(ret); | ||
| 87 | } | ||
diff --git a/src/lib/libcrypto/evp/p_enc.c b/src/lib/libcrypto/evp/p_enc.c new file mode 100644 index 0000000000..c2dfdc52ad --- /dev/null +++ b/src/lib/libcrypto/evp/p_enc.c | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | /* crypto/evp/p_enc.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/rand.h> | ||
| 62 | #ifndef OPENSSL_NO_RSA | ||
| 63 | #include <openssl/rsa.h> | ||
| 64 | #endif | ||
| 65 | #include <openssl/evp.h> | ||
| 66 | #include <openssl/objects.h> | ||
| 67 | #include <openssl/x509.h> | ||
| 68 | |||
| 69 | int EVP_PKEY_encrypt(unsigned char *ek, const unsigned char *key, int key_len, | ||
| 70 | EVP_PKEY *pubk) | ||
| 71 | { | ||
| 72 | int ret=0; | ||
| 73 | |||
| 74 | #ifndef OPENSSL_NO_RSA | ||
| 75 | if (pubk->type != EVP_PKEY_RSA) | ||
| 76 | { | ||
| 77 | #endif | ||
| 78 | EVPerr(EVP_F_EVP_PKEY_ENCRYPT,EVP_R_PUBLIC_KEY_NOT_RSA); | ||
| 79 | #ifndef OPENSSL_NO_RSA | ||
| 80 | goto err; | ||
| 81 | } | ||
| 82 | ret=RSA_public_encrypt(key_len,key,ek,pubk->pkey.rsa,RSA_PKCS1_PADDING); | ||
| 83 | err: | ||
| 84 | #endif | ||
| 85 | return(ret); | ||
| 86 | } | ||
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c new file mode 100644 index 0000000000..22155ecf62 --- /dev/null +++ b/src/lib/libcrypto/evp/p_lib.c | |||
| @@ -0,0 +1,502 @@ | |||
| 1 | /* crypto/evp/p_lib.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/bn.h> | ||
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/objects.h> | ||
| 64 | #include <openssl/evp.h> | ||
| 65 | #include <openssl/asn1_mac.h> | ||
| 66 | #include <openssl/x509.h> | ||
| 67 | #ifndef OPENSSL_NO_RSA | ||
| 68 | #include <openssl/rsa.h> | ||
| 69 | #endif | ||
| 70 | #ifndef OPENSSL_NO_DSA | ||
| 71 | #include <openssl/dsa.h> | ||
| 72 | #endif | ||
| 73 | #ifndef OPENSSL_NO_DH | ||
| 74 | #include <openssl/dh.h> | ||
| 75 | #endif | ||
| 76 | |||
| 77 | static void EVP_PKEY_free_it(EVP_PKEY *x); | ||
| 78 | |||
| 79 | int EVP_PKEY_bits(EVP_PKEY *pkey) | ||
| 80 | { | ||
| 81 | if (0) | ||
| 82 | return 0; | ||
| 83 | #ifndef OPENSSL_NO_RSA | ||
| 84 | else if (pkey->type == EVP_PKEY_RSA) | ||
| 85 | return(BN_num_bits(pkey->pkey.rsa->n)); | ||
| 86 | #endif | ||
| 87 | #ifndef OPENSSL_NO_DSA | ||
| 88 | else if (pkey->type == EVP_PKEY_DSA) | ||
| 89 | return(BN_num_bits(pkey->pkey.dsa->p)); | ||
| 90 | #endif | ||
| 91 | #ifndef OPENSSL_NO_EC | ||
| 92 | else if (pkey->type == EVP_PKEY_EC) | ||
| 93 | { | ||
| 94 | BIGNUM *order = BN_new(); | ||
| 95 | const EC_GROUP *group; | ||
| 96 | int ret; | ||
| 97 | |||
| 98 | if (!order) | ||
| 99 | { | ||
| 100 | ERR_clear_error(); | ||
| 101 | return 0; | ||
| 102 | } | ||
| 103 | group = EC_KEY_get0_group(pkey->pkey.ec); | ||
| 104 | if (!EC_GROUP_get_order(group, order, NULL)) | ||
| 105 | { | ||
| 106 | ERR_clear_error(); | ||
| 107 | return 0; | ||
| 108 | } | ||
| 109 | |||
| 110 | ret = BN_num_bits(order); | ||
| 111 | BN_free(order); | ||
| 112 | return ret; | ||
| 113 | } | ||
| 114 | #endif | ||
| 115 | return(0); | ||
| 116 | } | ||
| 117 | |||
| 118 | int EVP_PKEY_size(EVP_PKEY *pkey) | ||
| 119 | { | ||
| 120 | if (pkey == NULL) | ||
| 121 | return(0); | ||
| 122 | #ifndef OPENSSL_NO_RSA | ||
| 123 | if (pkey->type == EVP_PKEY_RSA) | ||
| 124 | return(RSA_size(pkey->pkey.rsa)); | ||
| 125 | else | ||
| 126 | #endif | ||
| 127 | #ifndef OPENSSL_NO_DSA | ||
| 128 | if (pkey->type == EVP_PKEY_DSA) | ||
| 129 | return(DSA_size(pkey->pkey.dsa)); | ||
| 130 | #endif | ||
| 131 | #ifndef OPENSSL_NO_ECDSA | ||
| 132 | if (pkey->type == EVP_PKEY_EC) | ||
| 133 | return(ECDSA_size(pkey->pkey.ec)); | ||
| 134 | #endif | ||
| 135 | |||
| 136 | return(0); | ||
| 137 | } | ||
| 138 | |||
| 139 | int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode) | ||
| 140 | { | ||
| 141 | #ifndef OPENSSL_NO_DSA | ||
| 142 | if (pkey->type == EVP_PKEY_DSA) | ||
| 143 | { | ||
| 144 | int ret=pkey->save_parameters; | ||
| 145 | |||
| 146 | if (mode >= 0) | ||
| 147 | pkey->save_parameters=mode; | ||
| 148 | return(ret); | ||
| 149 | } | ||
| 150 | #endif | ||
| 151 | #ifndef OPENSSL_NO_EC | ||
| 152 | if (pkey->type == EVP_PKEY_EC) | ||
| 153 | { | ||
| 154 | int ret = pkey->save_parameters; | ||
| 155 | |||
| 156 | if (mode >= 0) | ||
| 157 | pkey->save_parameters = mode; | ||
| 158 | return(ret); | ||
| 159 | } | ||
| 160 | #endif | ||
| 161 | return(0); | ||
| 162 | } | ||
| 163 | |||
| 164 | int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from) | ||
| 165 | { | ||
| 166 | if (to->type != from->type) | ||
| 167 | { | ||
| 168 | EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS,EVP_R_DIFFERENT_KEY_TYPES); | ||
| 169 | goto err; | ||
| 170 | } | ||
| 171 | |||
| 172 | if (EVP_PKEY_missing_parameters(from)) | ||
| 173 | { | ||
| 174 | EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS,EVP_R_MISSING_PARAMETERS); | ||
| 175 | goto err; | ||
| 176 | } | ||
| 177 | #ifndef OPENSSL_NO_DSA | ||
| 178 | if (to->type == EVP_PKEY_DSA) | ||
| 179 | { | ||
| 180 | BIGNUM *a; | ||
| 181 | |||
| 182 | if ((a=BN_dup(from->pkey.dsa->p)) == NULL) goto err; | ||
| 183 | if (to->pkey.dsa->p != NULL) BN_free(to->pkey.dsa->p); | ||
| 184 | to->pkey.dsa->p=a; | ||
| 185 | |||
| 186 | if ((a=BN_dup(from->pkey.dsa->q)) == NULL) goto err; | ||
| 187 | if (to->pkey.dsa->q != NULL) BN_free(to->pkey.dsa->q); | ||
| 188 | to->pkey.dsa->q=a; | ||
| 189 | |||
| 190 | if ((a=BN_dup(from->pkey.dsa->g)) == NULL) goto err; | ||
| 191 | if (to->pkey.dsa->g != NULL) BN_free(to->pkey.dsa->g); | ||
| 192 | to->pkey.dsa->g=a; | ||
| 193 | } | ||
| 194 | #endif | ||
| 195 | #ifndef OPENSSL_NO_EC | ||
| 196 | if (to->type == EVP_PKEY_EC) | ||
| 197 | { | ||
| 198 | EC_GROUP *group = EC_GROUP_dup(EC_KEY_get0_group(from->pkey.ec)); | ||
| 199 | if (group == NULL) | ||
| 200 | goto err; | ||
| 201 | if (EC_KEY_set_group(to->pkey.ec, group) == 0) | ||
| 202 | goto err; | ||
| 203 | EC_GROUP_free(group); | ||
| 204 | } | ||
| 205 | #endif | ||
| 206 | return(1); | ||
| 207 | err: | ||
| 208 | return(0); | ||
| 209 | } | ||
| 210 | |||
| 211 | int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey) | ||
| 212 | { | ||
| 213 | #ifndef OPENSSL_NO_DSA | ||
| 214 | if (pkey->type == EVP_PKEY_DSA) | ||
| 215 | { | ||
| 216 | DSA *dsa; | ||
| 217 | |||
| 218 | dsa=pkey->pkey.dsa; | ||
| 219 | if ((dsa->p == NULL) || (dsa->q == NULL) || (dsa->g == NULL)) | ||
| 220 | return(1); | ||
| 221 | } | ||
| 222 | #endif | ||
| 223 | #ifndef OPENSSL_NO_EC | ||
| 224 | if (pkey->type == EVP_PKEY_EC) | ||
| 225 | { | ||
| 226 | if (EC_KEY_get0_group(pkey->pkey.ec) == NULL) | ||
| 227 | return(1); | ||
| 228 | } | ||
| 229 | #endif | ||
| 230 | |||
| 231 | return(0); | ||
| 232 | } | ||
| 233 | |||
| 234 | int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b) | ||
| 235 | { | ||
| 236 | #ifndef OPENSSL_NO_DSA | ||
| 237 | if ((a->type == EVP_PKEY_DSA) && (b->type == EVP_PKEY_DSA)) | ||
| 238 | { | ||
| 239 | if ( BN_cmp(a->pkey.dsa->p,b->pkey.dsa->p) || | ||
| 240 | BN_cmp(a->pkey.dsa->q,b->pkey.dsa->q) || | ||
| 241 | BN_cmp(a->pkey.dsa->g,b->pkey.dsa->g)) | ||
| 242 | return(0); | ||
| 243 | else | ||
| 244 | return(1); | ||
| 245 | } | ||
| 246 | #endif | ||
| 247 | #ifndef OPENSSL_NO_EC | ||
| 248 | if (a->type == EVP_PKEY_EC && b->type == EVP_PKEY_EC) | ||
| 249 | { | ||
| 250 | const EC_GROUP *group_a = EC_KEY_get0_group(a->pkey.ec), | ||
| 251 | *group_b = EC_KEY_get0_group(b->pkey.ec); | ||
| 252 | if (EC_GROUP_cmp(group_a, group_b, NULL)) | ||
| 253 | return 0; | ||
| 254 | else | ||
| 255 | return 1; | ||
| 256 | } | ||
| 257 | #endif | ||
| 258 | return(-1); | ||
| 259 | } | ||
| 260 | |||
| 261 | int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b) | ||
| 262 | { | ||
| 263 | if (a->type != b->type) | ||
| 264 | return -1; | ||
| 265 | |||
| 266 | if (EVP_PKEY_cmp_parameters(a, b) == 0) | ||
| 267 | return 0; | ||
| 268 | |||
| 269 | switch (a->type) | ||
| 270 | { | ||
| 271 | #ifndef OPENSSL_NO_RSA | ||
| 272 | case EVP_PKEY_RSA: | ||
| 273 | if (BN_cmp(b->pkey.rsa->n,a->pkey.rsa->n) != 0 | ||
| 274 | || BN_cmp(b->pkey.rsa->e,a->pkey.rsa->e) != 0) | ||
| 275 | return 0; | ||
| 276 | break; | ||
| 277 | #endif | ||
| 278 | #ifndef OPENSSL_NO_DSA | ||
| 279 | case EVP_PKEY_DSA: | ||
| 280 | if (BN_cmp(b->pkey.dsa->pub_key,a->pkey.dsa->pub_key) != 0) | ||
| 281 | return 0; | ||
| 282 | break; | ||
| 283 | #endif | ||
| 284 | #ifndef OPENSSL_NO_EC | ||
| 285 | case EVP_PKEY_EC: | ||
| 286 | { | ||
| 287 | int r; | ||
| 288 | const EC_GROUP *group = EC_KEY_get0_group(b->pkey.ec); | ||
| 289 | const EC_POINT *pa = EC_KEY_get0_public_key(a->pkey.ec), | ||
| 290 | *pb = EC_KEY_get0_public_key(b->pkey.ec); | ||
| 291 | r = EC_POINT_cmp(group, pa, pb, NULL); | ||
| 292 | if (r != 0) | ||
| 293 | { | ||
| 294 | if (r == 1) | ||
| 295 | return 0; | ||
| 296 | else | ||
| 297 | return -2; | ||
| 298 | } | ||
| 299 | } | ||
| 300 | break; | ||
| 301 | #endif | ||
| 302 | #ifndef OPENSSL_NO_DH | ||
| 303 | case EVP_PKEY_DH: | ||
| 304 | return -2; | ||
| 305 | #endif | ||
| 306 | default: | ||
| 307 | return -2; | ||
| 308 | } | ||
| 309 | |||
| 310 | return 1; | ||
| 311 | } | ||
| 312 | |||
| 313 | EVP_PKEY *EVP_PKEY_new(void) | ||
| 314 | { | ||
| 315 | EVP_PKEY *ret; | ||
| 316 | |||
| 317 | ret=(EVP_PKEY *)OPENSSL_malloc(sizeof(EVP_PKEY)); | ||
| 318 | if (ret == NULL) | ||
| 319 | { | ||
| 320 | EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE); | ||
| 321 | return(NULL); | ||
| 322 | } | ||
| 323 | ret->type=EVP_PKEY_NONE; | ||
| 324 | ret->references=1; | ||
| 325 | ret->pkey.ptr=NULL; | ||
| 326 | ret->attributes=NULL; | ||
| 327 | ret->save_parameters=1; | ||
| 328 | return(ret); | ||
| 329 | } | ||
| 330 | |||
| 331 | int EVP_PKEY_assign(EVP_PKEY *pkey, int type, char *key) | ||
| 332 | { | ||
| 333 | if (pkey == NULL) return(0); | ||
| 334 | if (pkey->pkey.ptr != NULL) | ||
| 335 | EVP_PKEY_free_it(pkey); | ||
| 336 | pkey->type=EVP_PKEY_type(type); | ||
| 337 | pkey->save_type=type; | ||
| 338 | pkey->pkey.ptr=key; | ||
| 339 | return(key != NULL); | ||
| 340 | } | ||
| 341 | |||
| 342 | #ifndef OPENSSL_NO_RSA | ||
| 343 | int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key) | ||
| 344 | { | ||
| 345 | int ret = EVP_PKEY_assign_RSA(pkey, key); | ||
| 346 | if(ret) | ||
| 347 | RSA_up_ref(key); | ||
| 348 | return ret; | ||
| 349 | } | ||
| 350 | |||
| 351 | RSA *EVP_PKEY_get1_RSA(EVP_PKEY *pkey) | ||
| 352 | { | ||
| 353 | if(pkey->type != EVP_PKEY_RSA) { | ||
| 354 | EVPerr(EVP_F_EVP_PKEY_GET1_RSA, EVP_R_EXPECTING_AN_RSA_KEY); | ||
| 355 | return NULL; | ||
| 356 | } | ||
| 357 | RSA_up_ref(pkey->pkey.rsa); | ||
| 358 | return pkey->pkey.rsa; | ||
| 359 | } | ||
| 360 | #endif | ||
| 361 | |||
| 362 | #ifndef OPENSSL_NO_DSA | ||
| 363 | int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, DSA *key) | ||
| 364 | { | ||
| 365 | int ret = EVP_PKEY_assign_DSA(pkey, key); | ||
| 366 | if(ret) | ||
| 367 | DSA_up_ref(key); | ||
| 368 | return ret; | ||
| 369 | } | ||
| 370 | |||
| 371 | DSA *EVP_PKEY_get1_DSA(EVP_PKEY *pkey) | ||
| 372 | { | ||
| 373 | if(pkey->type != EVP_PKEY_DSA) { | ||
| 374 | EVPerr(EVP_F_EVP_PKEY_GET1_DSA, EVP_R_EXPECTING_A_DSA_KEY); | ||
| 375 | return NULL; | ||
| 376 | } | ||
| 377 | DSA_up_ref(pkey->pkey.dsa); | ||
| 378 | return pkey->pkey.dsa; | ||
| 379 | } | ||
| 380 | #endif | ||
| 381 | |||
| 382 | #ifndef OPENSSL_NO_EC | ||
| 383 | |||
| 384 | int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, EC_KEY *key) | ||
| 385 | { | ||
| 386 | int ret = EVP_PKEY_assign_EC_KEY(pkey,key); | ||
| 387 | if (ret) | ||
| 388 | EC_KEY_up_ref(key); | ||
| 389 | return ret; | ||
| 390 | } | ||
| 391 | |||
| 392 | EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey) | ||
| 393 | { | ||
| 394 | if (pkey->type != EVP_PKEY_EC) | ||
| 395 | { | ||
| 396 | EVPerr(EVP_F_EVP_PKEY_GET1_EC_KEY, EVP_R_EXPECTING_A_EC_KEY); | ||
| 397 | return NULL; | ||
| 398 | } | ||
| 399 | EC_KEY_up_ref(pkey->pkey.ec); | ||
| 400 | return pkey->pkey.ec; | ||
| 401 | } | ||
| 402 | #endif | ||
| 403 | |||
| 404 | |||
| 405 | #ifndef OPENSSL_NO_DH | ||
| 406 | |||
| 407 | int EVP_PKEY_set1_DH(EVP_PKEY *pkey, DH *key) | ||
| 408 | { | ||
| 409 | int ret = EVP_PKEY_assign_DH(pkey, key); | ||
| 410 | if(ret) | ||
| 411 | DH_up_ref(key); | ||
| 412 | return ret; | ||
| 413 | } | ||
| 414 | |||
| 415 | DH *EVP_PKEY_get1_DH(EVP_PKEY *pkey) | ||
| 416 | { | ||
| 417 | if(pkey->type != EVP_PKEY_DH) { | ||
| 418 | EVPerr(EVP_F_EVP_PKEY_GET1_DH, EVP_R_EXPECTING_A_DH_KEY); | ||
| 419 | return NULL; | ||
| 420 | } | ||
| 421 | DH_up_ref(pkey->pkey.dh); | ||
| 422 | return pkey->pkey.dh; | ||
| 423 | } | ||
| 424 | #endif | ||
| 425 | |||
| 426 | int EVP_PKEY_type(int type) | ||
| 427 | { | ||
| 428 | switch (type) | ||
| 429 | { | ||
| 430 | case EVP_PKEY_RSA: | ||
| 431 | case EVP_PKEY_RSA2: | ||
| 432 | return(EVP_PKEY_RSA); | ||
| 433 | case EVP_PKEY_DSA: | ||
| 434 | case EVP_PKEY_DSA1: | ||
| 435 | case EVP_PKEY_DSA2: | ||
| 436 | case EVP_PKEY_DSA3: | ||
| 437 | case EVP_PKEY_DSA4: | ||
| 438 | return(EVP_PKEY_DSA); | ||
| 439 | case EVP_PKEY_DH: | ||
| 440 | return(EVP_PKEY_DH); | ||
| 441 | case EVP_PKEY_EC: | ||
| 442 | return(EVP_PKEY_EC); | ||
| 443 | default: | ||
| 444 | return(NID_undef); | ||
| 445 | } | ||
| 446 | } | ||
| 447 | |||
| 448 | void EVP_PKEY_free(EVP_PKEY *x) | ||
| 449 | { | ||
| 450 | int i; | ||
| 451 | |||
| 452 | if (x == NULL) return; | ||
| 453 | |||
| 454 | i=CRYPTO_add(&x->references,-1,CRYPTO_LOCK_EVP_PKEY); | ||
| 455 | #ifdef REF_PRINT | ||
| 456 | REF_PRINT("EVP_PKEY",x); | ||
| 457 | #endif | ||
| 458 | if (i > 0) return; | ||
| 459 | #ifdef REF_CHECK | ||
| 460 | if (i < 0) | ||
| 461 | { | ||
| 462 | fprintf(stderr,"EVP_PKEY_free, bad reference count\n"); | ||
| 463 | abort(); | ||
| 464 | } | ||
| 465 | #endif | ||
| 466 | EVP_PKEY_free_it(x); | ||
| 467 | if (x->attributes) | ||
| 468 | sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free); | ||
| 469 | OPENSSL_free(x); | ||
| 470 | } | ||
| 471 | |||
| 472 | static void EVP_PKEY_free_it(EVP_PKEY *x) | ||
| 473 | { | ||
| 474 | switch (x->type) | ||
| 475 | { | ||
| 476 | #ifndef OPENSSL_NO_RSA | ||
| 477 | case EVP_PKEY_RSA: | ||
| 478 | case EVP_PKEY_RSA2: | ||
| 479 | RSA_free(x->pkey.rsa); | ||
| 480 | break; | ||
| 481 | #endif | ||
| 482 | #ifndef OPENSSL_NO_DSA | ||
| 483 | case EVP_PKEY_DSA: | ||
| 484 | case EVP_PKEY_DSA2: | ||
| 485 | case EVP_PKEY_DSA3: | ||
| 486 | case EVP_PKEY_DSA4: | ||
| 487 | DSA_free(x->pkey.dsa); | ||
| 488 | break; | ||
| 489 | #endif | ||
| 490 | #ifndef OPENSSL_NO_EC | ||
| 491 | case EVP_PKEY_EC: | ||
| 492 | EC_KEY_free(x->pkey.ec); | ||
| 493 | break; | ||
| 494 | #endif | ||
| 495 | #ifndef OPENSSL_NO_DH | ||
| 496 | case EVP_PKEY_DH: | ||
| 497 | DH_free(x->pkey.dh); | ||
| 498 | break; | ||
| 499 | #endif | ||
| 500 | } | ||
| 501 | } | ||
| 502 | |||
diff --git a/src/lib/libcrypto/evp/p_open.c b/src/lib/libcrypto/evp/p_open.c new file mode 100644 index 0000000000..9935206d0f --- /dev/null +++ b/src/lib/libcrypto/evp/p_open.c | |||
| @@ -0,0 +1,127 @@ | |||
| 1 | /* crypto/evp/p_open.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | |||
| 62 | #ifndef OPENSSL_NO_RSA | ||
| 63 | |||
| 64 | #include <openssl/evp.h> | ||
| 65 | #include <openssl/objects.h> | ||
| 66 | #include <openssl/x509.h> | ||
| 67 | #include <openssl/rsa.h> | ||
| 68 | |||
| 69 | int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | ||
| 70 | const unsigned char *ek, int ekl, const unsigned char *iv, | ||
| 71 | EVP_PKEY *priv) | ||
| 72 | { | ||
| 73 | unsigned char *key=NULL; | ||
| 74 | int i,size=0,ret=0; | ||
| 75 | |||
| 76 | if(type) { | ||
| 77 | EVP_CIPHER_CTX_init(ctx); | ||
| 78 | if(!EVP_DecryptInit_ex(ctx,type,NULL, NULL,NULL)) return 0; | ||
| 79 | } | ||
| 80 | |||
| 81 | if(!priv) return 1; | ||
| 82 | |||
| 83 | if (priv->type != EVP_PKEY_RSA) | ||
| 84 | { | ||
| 85 | EVPerr(EVP_F_EVP_OPENINIT,EVP_R_PUBLIC_KEY_NOT_RSA); | ||
| 86 | goto err; | ||
| 87 | } | ||
| 88 | |||
| 89 | size=RSA_size(priv->pkey.rsa); | ||
| 90 | key=(unsigned char *)OPENSSL_malloc(size+2); | ||
| 91 | if (key == NULL) | ||
| 92 | { | ||
| 93 | /* ERROR */ | ||
| 94 | EVPerr(EVP_F_EVP_OPENINIT,ERR_R_MALLOC_FAILURE); | ||
| 95 | goto err; | ||
| 96 | } | ||
| 97 | |||
| 98 | i=EVP_PKEY_decrypt(key,ek,ekl,priv); | ||
| 99 | if ((i <= 0) || !EVP_CIPHER_CTX_set_key_length(ctx, i)) | ||
| 100 | { | ||
| 101 | /* ERROR */ | ||
| 102 | goto err; | ||
| 103 | } | ||
| 104 | if(!EVP_DecryptInit_ex(ctx,NULL,NULL,key,iv)) goto err; | ||
| 105 | |||
| 106 | ret=1; | ||
| 107 | err: | ||
| 108 | if (key != NULL) OPENSSL_cleanse(key,size); | ||
| 109 | OPENSSL_free(key); | ||
| 110 | return(ret); | ||
| 111 | } | ||
| 112 | |||
| 113 | int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | ||
| 114 | { | ||
| 115 | int i; | ||
| 116 | |||
| 117 | i=EVP_DecryptFinal_ex(ctx,out,outl); | ||
| 118 | EVP_DecryptInit_ex(ctx,NULL,NULL,NULL,NULL); | ||
| 119 | return(i); | ||
| 120 | } | ||
| 121 | #else /* !OPENSSL_NO_RSA */ | ||
| 122 | |||
| 123 | # ifdef PEDANTIC | ||
| 124 | static void *dummy=&dummy; | ||
| 125 | # endif | ||
| 126 | |||
| 127 | #endif | ||
diff --git a/src/lib/libcrypto/evp/p_seal.c b/src/lib/libcrypto/evp/p_seal.c new file mode 100644 index 0000000000..8cc8fcb0bd --- /dev/null +++ b/src/lib/libcrypto/evp/p_seal.c | |||
| @@ -0,0 +1,115 @@ | |||
| 1 | /* crypto/evp/p_seal.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/rand.h> | ||
| 62 | #ifndef OPENSSL_NO_RSA | ||
| 63 | #include <openssl/rsa.h> | ||
| 64 | #endif | ||
| 65 | #include <openssl/evp.h> | ||
| 66 | #include <openssl/objects.h> | ||
| 67 | #include <openssl/x509.h> | ||
| 68 | |||
| 69 | int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char **ek, | ||
| 70 | int *ekl, unsigned char *iv, EVP_PKEY **pubk, int npubk) | ||
| 71 | { | ||
| 72 | unsigned char key[EVP_MAX_KEY_LENGTH]; | ||
| 73 | int i; | ||
| 74 | |||
| 75 | if(type) { | ||
| 76 | EVP_CIPHER_CTX_init(ctx); | ||
| 77 | if(!EVP_EncryptInit_ex(ctx,type,NULL,NULL,NULL)) return 0; | ||
| 78 | } | ||
| 79 | if ((npubk <= 0) || !pubk) | ||
| 80 | return 1; | ||
| 81 | if (EVP_CIPHER_CTX_rand_key(ctx, key) <= 0) | ||
| 82 | return 0; | ||
| 83 | if (EVP_CIPHER_CTX_iv_length(ctx)) | ||
| 84 | RAND_pseudo_bytes(iv,EVP_CIPHER_CTX_iv_length(ctx)); | ||
| 85 | |||
| 86 | if(!EVP_EncryptInit_ex(ctx,NULL,NULL,key,iv)) return 0; | ||
| 87 | |||
| 88 | for (i=0; i<npubk; i++) | ||
| 89 | { | ||
| 90 | ekl[i]=EVP_PKEY_encrypt(ek[i],key,EVP_CIPHER_CTX_key_length(ctx), | ||
| 91 | pubk[i]); | ||
| 92 | if (ekl[i] <= 0) return(-1); | ||
| 93 | } | ||
| 94 | return(npubk); | ||
| 95 | } | ||
| 96 | |||
| 97 | /* MACRO | ||
| 98 | void EVP_SealUpdate(ctx,out,outl,in,inl) | ||
| 99 | EVP_CIPHER_CTX *ctx; | ||
| 100 | unsigned char *out; | ||
| 101 | int *outl; | ||
| 102 | unsigned char *in; | ||
| 103 | int inl; | ||
| 104 | { | ||
| 105 | EVP_EncryptUpdate(ctx,out,outl,in,inl); | ||
| 106 | } | ||
| 107 | */ | ||
| 108 | |||
| 109 | int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | ||
| 110 | { | ||
| 111 | int i; | ||
| 112 | i = EVP_EncryptFinal_ex(ctx,out,outl); | ||
| 113 | EVP_EncryptInit_ex(ctx,NULL,NULL,NULL,NULL); | ||
| 114 | return i; | ||
| 115 | } | ||
diff --git a/src/lib/libcrypto/evp/p_sign.c b/src/lib/libcrypto/evp/p_sign.c new file mode 100644 index 0000000000..e4ae5906f5 --- /dev/null +++ b/src/lib/libcrypto/evp/p_sign.c | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | /* crypto/evp/p_sign.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/evp.h> | ||
| 62 | #include <openssl/objects.h> | ||
| 63 | #include <openssl/x509.h> | ||
| 64 | |||
| 65 | #ifdef undef | ||
| 66 | void EVP_SignInit(EVP_MD_CTX *ctx, EVP_MD *type) | ||
| 67 | { | ||
| 68 | EVP_DigestInit_ex(ctx,type); | ||
| 69 | } | ||
| 70 | |||
| 71 | void EVP_SignUpdate(EVP_MD_CTX *ctx, unsigned char *data, | ||
| 72 | unsigned int count) | ||
| 73 | { | ||
| 74 | EVP_DigestUpdate(ctx,data,count); | ||
| 75 | } | ||
| 76 | #endif | ||
| 77 | |||
| 78 | int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen, | ||
| 79 | EVP_PKEY *pkey) | ||
| 80 | { | ||
| 81 | unsigned char m[EVP_MAX_MD_SIZE]; | ||
| 82 | unsigned int m_len; | ||
| 83 | int i,ok=0,v; | ||
| 84 | MS_STATIC EVP_MD_CTX tmp_ctx; | ||
| 85 | |||
| 86 | *siglen=0; | ||
| 87 | EVP_MD_CTX_init(&tmp_ctx); | ||
| 88 | EVP_MD_CTX_copy_ex(&tmp_ctx,ctx); | ||
| 89 | EVP_DigestFinal_ex(&tmp_ctx,&(m[0]),&m_len); | ||
| 90 | EVP_MD_CTX_cleanup(&tmp_ctx); | ||
| 91 | for (i=0; i<4; i++) | ||
| 92 | { | ||
| 93 | v=ctx->digest->required_pkey_type[i]; | ||
| 94 | if (v == 0) break; | ||
| 95 | if (pkey->type == v) | ||
| 96 | { | ||
| 97 | ok=1; | ||
| 98 | break; | ||
| 99 | } | ||
| 100 | } | ||
| 101 | if (!ok) | ||
| 102 | { | ||
| 103 | EVPerr(EVP_F_EVP_SIGNFINAL,EVP_R_WRONG_PUBLIC_KEY_TYPE); | ||
| 104 | return(0); | ||
| 105 | } | ||
| 106 | if (ctx->digest->sign == NULL) | ||
| 107 | { | ||
| 108 | EVPerr(EVP_F_EVP_SIGNFINAL,EVP_R_NO_SIGN_FUNCTION_CONFIGURED); | ||
| 109 | return(0); | ||
| 110 | } | ||
| 111 | return(ctx->digest->sign(ctx->digest->type,m,m_len,sigret,siglen, | ||
| 112 | pkey->pkey.ptr)); | ||
| 113 | } | ||
| 114 | |||
diff --git a/src/lib/libcrypto/evp/p_verify.c b/src/lib/libcrypto/evp/p_verify.c new file mode 100644 index 0000000000..21a40a375e --- /dev/null +++ b/src/lib/libcrypto/evp/p_verify.c | |||
| @@ -0,0 +1,101 @@ | |||
| 1 | /* crypto/evp/p_verify.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/evp.h> | ||
| 62 | #include <openssl/objects.h> | ||
| 63 | #include <openssl/x509.h> | ||
| 64 | |||
| 65 | int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, | ||
| 66 | unsigned int siglen, EVP_PKEY *pkey) | ||
| 67 | { | ||
| 68 | unsigned char m[EVP_MAX_MD_SIZE]; | ||
| 69 | unsigned int m_len; | ||
| 70 | int i,ok=0,v; | ||
| 71 | MS_STATIC EVP_MD_CTX tmp_ctx; | ||
| 72 | |||
| 73 | for (i=0; i<4; i++) | ||
| 74 | { | ||
| 75 | v=ctx->digest->required_pkey_type[i]; | ||
| 76 | if (v == 0) break; | ||
| 77 | if (pkey->type == v) | ||
| 78 | { | ||
| 79 | ok=1; | ||
| 80 | break; | ||
| 81 | } | ||
| 82 | } | ||
| 83 | if (!ok) | ||
| 84 | { | ||
| 85 | EVPerr(EVP_F_EVP_VERIFYFINAL,EVP_R_WRONG_PUBLIC_KEY_TYPE); | ||
| 86 | return(-1); | ||
| 87 | } | ||
| 88 | EVP_MD_CTX_init(&tmp_ctx); | ||
| 89 | EVP_MD_CTX_copy_ex(&tmp_ctx,ctx); | ||
| 90 | EVP_DigestFinal_ex(&tmp_ctx,&(m[0]),&m_len); | ||
| 91 | EVP_MD_CTX_cleanup(&tmp_ctx); | ||
| 92 | if (ctx->digest->verify == NULL) | ||
| 93 | { | ||
| 94 | EVPerr(EVP_F_EVP_VERIFYFINAL,EVP_R_NO_VERIFY_FUNCTION_CONFIGURED); | ||
| 95 | return(0); | ||
| 96 | } | ||
| 97 | |||
| 98 | return(ctx->digest->verify(ctx->digest->type,m,m_len, | ||
| 99 | sigbuf,siglen,pkey->pkey.ptr)); | ||
| 100 | } | ||
| 101 | |||
