aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/evp
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2002-02-13 18:21:51 +0000
committerBodo Möller <bodo@openssl.org>2002-02-13 18:21:51 +0000
commit4d94ae00d5614d64d4dd065860c4b00161a81f82 (patch)
treee993aa323ea753b3c0782439eb78f4f8c896a67e /crypto/evp
parent60d8bae30d1040a4f955e3247443b2dd4c674cde (diff)
downloadopenssl-4d94ae00d5614d64d4dd065860c4b00161a81f82.tar.gz
ECDSA support
Submitted by: Nils Larsch <nla@trustcenter.de>
Diffstat (limited to 'crypto/evp')
-rw-r--r--crypto/evp/Makefile.ssl283
-rw-r--r--crypto/evp/c_alld.c3
-rw-r--r--crypto/evp/evp.h29
-rw-r--r--crypto/evp/evp_err.c4
-rw-r--r--crypto/evp/evp_pkey.c411
-rw-r--r--crypto/evp/m_ecdsa.c95
-rw-r--r--crypto/evp/p_lib.c92
7 files changed, 743 insertions, 174 deletions
diff --git a/crypto/evp/Makefile.ssl b/crypto/evp/Makefile.ssl
index 9b5de1f590..e5ee36d3ef 100644
--- a/crypto/evp/Makefile.ssl
+++ b/crypto/evp/Makefile.ssl
@@ -29,7 +29,7 @@ LIBSRC= encode.c digest.c evp_enc.c evp_key.c \
e_rc4.c e_aes.c names.c \
e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \
m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c \
- m_dss.c m_dss1.c m_mdc2.c m_ripemd.c \
+ m_dss.c m_dss1.c m_mdc2.c m_ripemd.c m_ecdsa.c\
p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c \
bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c \
c_all.c c_allc.c c_alld.c evp_lib.c bio_ok.c \
@@ -40,7 +40,7 @@ LIBOBJ= encode.o digest.o evp_enc.o evp_key.o \
e_rc4.o e_aes.o names.o \
e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \
m_null.o m_md2.o m_md4.o m_md5.o m_sha.o m_sha1.o \
- m_dss.o m_dss1.o m_mdc2.o m_ripemd.o \
+ m_dss.o m_dss1.o m_mdc2.o m_ripemd.o m_ecdsa.o\
p_open.o p_seal.o p_sign.o p_verify.o p_lib.o p_enc.o p_dec.o \
bio_md.o bio_b64.o bio_enc.o evp_err.o e_null.o \
c_all.o c_allc.o c_alld.o evp_lib.o bio_ok.o \
@@ -148,10 +148,12 @@ c_all.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
c_all.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
c_all.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
c_all.o: ../../include/openssl/symhacks.h ../cryptlib.h c_all.c
-c_allc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+c_allc.o: ../../e_os.h ../../include/openssl/asn1.h
+c_allc.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
c_allc.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
c_allc.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
c_allc.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+c_allc.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
c_allc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
c_allc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
c_allc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -161,10 +163,12 @@ c_allc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
c_allc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
c_allc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
c_allc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_allc.c
-c_alld.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+c_alld.o: ../../e_os.h ../../include/openssl/asn1.h
+c_alld.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
c_alld.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
c_alld.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
c_alld.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+c_alld.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
c_alld.o: ../../include/openssl/err.h ../../include/openssl/evp.h
c_alld.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
c_alld.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -174,10 +178,12 @@ c_alld.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
c_alld.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
c_alld.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
c_alld.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_alld.c
-digest.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+digest.o: ../../e_os.h ../../include/openssl/asn1.h
+digest.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
digest.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
digest.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
digest.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+digest.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
digest.o: ../../include/openssl/engine.h ../../include/openssl/err.h
digest.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
@@ -308,18 +314,19 @@ encode.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
encode.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
encode.o: ../../include/openssl/symhacks.h ../cryptlib.h encode.c
evp_enc.o: ../../e_os.h ../../include/openssl/asn1.h
-evp_enc.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-evp_enc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-evp_enc.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-evp_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
-evp_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-evp_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-evp_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
-evp_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-evp_enc.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
-evp_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-evp_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
-evp_enc.o: ../cryptlib.h evp_enc.c evp_locl.h
+evp_enc.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+evp_enc.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+evp_enc.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+evp_enc.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+evp_enc.o: ../../include/openssl/engine.h ../../include/openssl/err.h
+evp_enc.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+evp_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+evp_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
+evp_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
+evp_enc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+evp_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+evp_enc.o: ../../include/openssl/ui.h ../cryptlib.h evp_enc.c evp_locl.h
evp_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
evp_err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
evp_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
@@ -330,19 +337,20 @@ evp_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
evp_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
evp_err.o: evp_err.c
evp_key.o: ../../e_os.h ../../include/openssl/asn1.h
-evp_key.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-evp_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-evp_key.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-evp_key.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-evp_key.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
-evp_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-evp_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
-evp_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-evp_key.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
-evp_key.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-evp_key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
-evp_key.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-evp_key.o: ../cryptlib.h evp_key.c
+evp_key.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+evp_key.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+evp_key.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+evp_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+evp_key.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+evp_key.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+evp_key.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+evp_key.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+evp_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+evp_key.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
+evp_key.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+evp_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+evp_key.o: ../../include/openssl/ui.h ../../include/openssl/x509.h
+evp_key.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_key.c
evp_lib.o: ../../e_os.h ../../include/openssl/asn1.h
evp_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
evp_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
@@ -354,36 +362,41 @@ evp_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
evp_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
evp_lib.o: ../cryptlib.h evp_lib.c
evp_pbe.o: ../../e_os.h ../../include/openssl/asn1.h
-evp_pbe.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-evp_pbe.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-evp_pbe.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-evp_pbe.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-evp_pbe.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
-evp_pbe.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-evp_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
-evp_pbe.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-evp_pbe.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
-evp_pbe.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-evp_pbe.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-evp_pbe.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_pbe.c
+evp_pbe.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+evp_pbe.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+evp_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+evp_pbe.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+evp_pbe.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+evp_pbe.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+evp_pbe.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+evp_pbe.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+evp_pbe.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+evp_pbe.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
+evp_pbe.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+evp_pbe.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+evp_pbe.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+evp_pbe.o: ../cryptlib.h evp_pbe.c
evp_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
-evp_pkey.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-evp_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-evp_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-evp_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-evp_pkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
-evp_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-evp_pkey.o: ../../include/openssl/opensslconf.h
+evp_pkey.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+evp_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+evp_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+evp_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+evp_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+evp_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+evp_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+evp_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
evp_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
evp_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
evp_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
evp_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
evp_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
evp_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_pkey.c
-m_dss.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+m_dss.o: ../../e_os.h ../../include/openssl/asn1.h
+m_dss.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
m_dss.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
m_dss.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
m_dss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+m_dss.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
m_dss.o: ../../include/openssl/err.h ../../include/openssl/evp.h
m_dss.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
m_dss.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -393,10 +406,12 @@ m_dss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
m_dss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
m_dss.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
m_dss.o: ../cryptlib.h m_dss.c
-m_dss1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+m_dss1.o: ../../e_os.h ../../include/openssl/asn1.h
+m_dss1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
m_dss1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
m_dss1.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
m_dss1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+m_dss1.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
m_dss1.o: ../../include/openssl/err.h ../../include/openssl/evp.h
m_dss1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
m_dss1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -406,10 +421,27 @@ m_dss1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
m_dss1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
m_dss1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
m_dss1.o: ../cryptlib.h m_dss1.c
-m_md2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+m_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h
+m_ecdsa.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+m_ecdsa.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+m_ecdsa.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+m_ecdsa.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+m_ecdsa.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+m_ecdsa.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+m_ecdsa.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+m_ecdsa.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+m_ecdsa.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+m_ecdsa.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
+m_ecdsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+m_ecdsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+m_ecdsa.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+m_ecdsa.o: ../cryptlib.h m_ecdsa.c
+m_md2.o: ../../e_os.h ../../include/openssl/asn1.h
+m_md2.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
m_md2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
m_md2.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
m_md2.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+m_md2.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
m_md2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
m_md2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
m_md2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
@@ -419,10 +451,12 @@ m_md2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
m_md2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
m_md2.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
m_md2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_md2.c
-m_md4.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+m_md4.o: ../../e_os.h ../../include/openssl/asn1.h
+m_md4.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
m_md4.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
m_md4.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
m_md4.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+m_md4.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
m_md4.o: ../../include/openssl/err.h ../../include/openssl/evp.h
m_md4.o: ../../include/openssl/lhash.h ../../include/openssl/md4.h
m_md4.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
@@ -432,10 +466,12 @@ m_md4.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
m_md4.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
m_md4.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
m_md4.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_md4.c
-m_md5.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+m_md5.o: ../../e_os.h ../../include/openssl/asn1.h
+m_md5.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
m_md5.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
m_md5.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
m_md5.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+m_md5.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
m_md5.o: ../../include/openssl/err.h ../../include/openssl/evp.h
m_md5.o: ../../include/openssl/lhash.h ../../include/openssl/md5.h
m_md5.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
@@ -445,11 +481,13 @@ m_md5.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
m_md5.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
m_md5.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
m_md5.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_md5.c
-m_mdc2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+m_mdc2.o: ../../e_os.h ../../include/openssl/asn1.h
+m_mdc2.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
m_mdc2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
m_mdc2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
m_mdc2.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
m_mdc2.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+m_mdc2.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
m_mdc2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
m_mdc2.o: ../../include/openssl/lhash.h ../../include/openssl/mdc2.h
m_mdc2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
@@ -460,10 +498,12 @@ m_mdc2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
m_mdc2.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
m_mdc2.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
m_mdc2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_mdc2.c
-m_null.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+m_null.o: ../../e_os.h ../../include/openssl/asn1.h
+m_null.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
m_null.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
m_null.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
m_null.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+m_null.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
m_null.o: ../../include/openssl/err.h ../../include/openssl/evp.h
m_null.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
m_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -474,23 +514,26 @@ m_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
m_null.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
m_null.o: ../cryptlib.h m_null.c
m_ripemd.o: ../../e_os.h ../../include/openssl/asn1.h
-m_ripemd.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-m_ripemd.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-m_ripemd.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-m_ripemd.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-m_ripemd.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
-m_ripemd.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-m_ripemd.o: ../../include/openssl/opensslconf.h
+m_ripemd.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+m_ripemd.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+m_ripemd.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+m_ripemd.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+m_ripemd.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+m_ripemd.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+m_ripemd.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+m_ripemd.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
m_ripemd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
m_ripemd.o: ../../include/openssl/pkcs7.h ../../include/openssl/ripemd.h
m_ripemd.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
m_ripemd.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
m_ripemd.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
m_ripemd.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_ripemd.c
-m_sha.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+m_sha.o: ../../e_os.h ../../include/openssl/asn1.h
+m_sha.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
m_sha.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
m_sha.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
m_sha.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+m_sha.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
m_sha.o: ../../include/openssl/err.h ../../include/openssl/evp.h
m_sha.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
m_sha.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -500,10 +543,12 @@ m_sha.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
m_sha.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
m_sha.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
m_sha.o: ../cryptlib.h m_sha.c
-m_sha1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+m_sha1.o: ../../e_os.h ../../include/openssl/asn1.h
+m_sha1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
m_sha1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
m_sha1.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
m_sha1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+m_sha1.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
m_sha1.o: ../../include/openssl/err.h ../../include/openssl/evp.h
m_sha1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
m_sha1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -513,10 +558,12 @@ m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
m_sha1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
m_sha1.o: ../cryptlib.h m_sha1.c
-names.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+names.o: ../../e_os.h ../../include/openssl/asn1.h
+names.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
names.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
names.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
names.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+names.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
names.o: ../../include/openssl/err.h ../../include/openssl/evp.h
names.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
names.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -527,36 +574,42 @@ names.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
names.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
names.o: ../cryptlib.h names.c
p5_crpt.o: ../../e_os.h ../../include/openssl/asn1.h
-p5_crpt.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-p5_crpt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-p5_crpt.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-p5_crpt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-p5_crpt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
-p5_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-p5_crpt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
-p5_crpt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-p5_crpt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
-p5_crpt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-p5_crpt.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-p5_crpt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p5_crpt.c
+p5_crpt.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+p5_crpt.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+p5_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+p5_crpt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+p5_crpt.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+p5_crpt.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+p5_crpt.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+p5_crpt.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+p5_crpt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+p5_crpt.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
+p5_crpt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+p5_crpt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+p5_crpt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+p5_crpt.o: ../cryptlib.h p5_crpt.c
p5_crpt2.o: ../../e_os.h ../../include/openssl/asn1.h
-p5_crpt2.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-p5_crpt2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-p5_crpt2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-p5_crpt2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-p5_crpt2.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h
-p5_crpt2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-p5_crpt2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+p5_crpt2.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+p5_crpt2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+p5_crpt2.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+p5_crpt2.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+p5_crpt2.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+p5_crpt2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+p5_crpt2.o: ../../include/openssl/hmac.h ../../include/openssl/lhash.h
+p5_crpt2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+p5_crpt2.o: ../../include/openssl/opensslconf.h
p5_crpt2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
p5_crpt2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
p5_crpt2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
p5_crpt2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
p5_crpt2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
p5_crpt2.o: ../cryptlib.h p5_crpt2.c
-p_dec.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+p_dec.o: ../../e_os.h ../../include/openssl/asn1.h
+p_dec.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
p_dec.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
p_dec.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
p_dec.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+p_dec.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
p_dec.o: ../../include/openssl/err.h ../../include/openssl/evp.h
p_dec.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
p_dec.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -566,10 +619,12 @@ p_dec.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
p_dec.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
p_dec.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
p_dec.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_dec.c
-p_enc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+p_enc.o: ../../e_os.h ../../include/openssl/asn1.h
+p_enc.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
p_enc.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
p_enc.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
p_enc.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+p_enc.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
p_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
p_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
p_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -580,23 +635,26 @@ p_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
p_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
p_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_enc.c
p_lib.o: ../../e_os.h ../../include/openssl/asn1.h
-p_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
-p_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-p_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
-p_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
-p_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-p_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-p_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
-p_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-p_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
-p_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-p_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-p_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-p_lib.o: ../cryptlib.h p_lib.c
-p_open.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+p_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/asn1t.h
+p_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+p_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+p_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
+p_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+p_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
+p_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+p_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+p_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
+p_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+p_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+p_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+p_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+p_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_lib.c
+p_open.o: ../../e_os.h ../../include/openssl/asn1.h
+p_open.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
p_open.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
p_open.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
p_open.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+p_open.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
p_open.o: ../../include/openssl/err.h ../../include/openssl/evp.h
p_open.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
p_open.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -606,10 +664,12 @@ p_open.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
p_open.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
p_open.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
p_open.o: ../cryptlib.h p_open.c
-p_seal.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+p_seal.o: ../../e_os.h ../../include/openssl/asn1.h
+p_seal.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
p_seal.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
p_seal.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
p_seal.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+p_seal.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
p_seal.o: ../../include/openssl/err.h ../../include/openssl/evp.h
p_seal.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
p_seal.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -619,10 +679,12 @@ p_seal.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
p_seal.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
p_seal.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
p_seal.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_seal.c
-p_sign.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+p_sign.o: ../../e_os.h ../../include/openssl/asn1.h
+p_sign.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
p_sign.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
p_sign.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
p_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+p_sign.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
p_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h
p_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
p_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -633,13 +695,14 @@ p_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
p_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
p_sign.o: ../cryptlib.h p_sign.c
p_verify.o: ../../e_os.h ../../include/openssl/asn1.h
-p_verify.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-p_verify.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-p_verify.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-p_verify.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-p_verify.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
-p_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-p_verify.o: ../../include/openssl/opensslconf.h
+p_verify.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+p_verify.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+p_verify.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+p_verify.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+p_verify.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+p_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+p_verify.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+p_verify.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
p_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
p_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
p_verify.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
diff --git a/crypto/evp/c_alld.c b/crypto/evp/c_alld.c
index be91cdb037..2334a28a5e 100644
--- a/crypto/evp/c_alld.c
+++ b/crypto/evp/c_alld.c
@@ -91,6 +91,9 @@ void OpenSSL_add_all_digests(void)
EVP_add_digest_alias(SN_dsaWithSHA1,"DSS1");
EVP_add_digest_alias(SN_dsaWithSHA1,"dss1");
#endif
+#ifndef OPENSSL_NO_ECDSA
+ EVP_add_digest(EVP_ecdsa());
+#endif
#endif
#if !defined(OPENSSL_NO_MDC2) && !defined(OPENSSL_NO_DES)
EVP_add_digest(EVP_mdc2());
diff --git a/crypto/evp/evp.h b/crypto/evp/evp.h
index beb2c9eb44..cc521feb63 100644
--- a/crypto/evp/evp.h
+++ b/crypto/evp/evp.h
@@ -94,11 +94,13 @@
#define EVP_PK_RSA 0x0001
#define EVP_PK_DSA 0x0002
#define EVP_PK_DH 0x0004
+#define EVP_PK_ECDSA 0x0008
#define EVP_PKT_SIGN 0x0010
#define EVP_PKT_ENC 0x0020
#define EVP_PKT_EXCH 0x0040
#define EVP_PKS_RSA 0x0100
#define EVP_PKS_DSA 0x0200
+#define EVP_PKS_ECDSA 0x0400
#define EVP_PKT_EXP 0x1000 /* <= 512 bit key */
#define EVP_PKEY_NONE NID_undef
@@ -110,6 +112,7 @@
#define EVP_PKEY_DSA3 NID_dsaWithSHA1
#define EVP_PKEY_DSA4 NID_dsaWithSHA1_2
#define EVP_PKEY_DH NID_dhKeyAgreement
+#define EVP_PKEY_ECDSA NID_X9_62_id_ecPublicKey
#ifdef __cplusplus
extern "C" {
@@ -134,6 +137,9 @@ struct evp_pkey_st
#ifndef OPENSSL_NO_DH
struct dh_st *dh; /* DH */
#endif
+#ifndef OPENSSL_NO_ECDSA
+ struct ecdsa_st *ecdsa; /* ECDSA */
+#endif
} pkey;
int save_parameters;
STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */
@@ -245,6 +251,13 @@ struct env_md_st
#define EVP_PKEY_DSA_method EVP_PKEY_NULL_method
#endif
+#ifndef OPENSSL_NO_ECDSA
+#define EVP_PKEY_ECDSA_method ECDSA_sign,ECDSA_verify, \
+ {EVP_PKEY_ECDSA,0,0,0}
+#else
+#define EVP_PKEY_ECDSA_method EVP_PKEY_NULL_method
+#endif
+
#ifndef OPENSSL_NO_RSA
#define EVP_PKEY_RSA_method RSA_sign,RSA_verify, \
{EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0}
@@ -385,6 +398,11 @@ typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
(char *)(dh))
#endif
+#ifndef OPENSSL_NO_ECDSA
+#define EVP_PKEY_assign_ECDSA(pkey,ecdsa) EVP_PKEY_assign((pkey),EVP_PKEY_ECDSA,\
+ (char *)(ecdsa))
+#endif
+
/* Add some extra combinations */
#define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a))
#define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a))
@@ -568,6 +586,7 @@ const EVP_MD *EVP_sha(void);
const EVP_MD *EVP_sha1(void);
const EVP_MD *EVP_dss(void);
const EVP_MD *EVP_dss1(void);
+const EVP_MD *EVP_ecdsa(void);
#endif
#ifndef OPENSSL_NO_MDC2
const EVP_MD *EVP_mdc2(void);
@@ -683,7 +702,11 @@ struct dh_st;
int EVP_PKEY_set1_DH(EVP_PKEY *pkey,struct dh_st *key);
struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey);
#endif
-
+#ifndef OPENSSL_NO_ECDSA
+struct ecdsa_st;
+int EVP_PKEY_set1_ECDSA(EVP_PKEY *pkey,struct ecdsa_st *key);
+struct ecdsa_st *EVP_PKEY_get1_ECDSA(EVP_PKEY *pkey);
+#endif
EVP_PKEY * EVP_PKEY_new(void);
void EVP_PKEY_free(EVP_PKEY *pkey);
@@ -741,6 +764,7 @@ void ERR_load_EVP_strings(void);
/* Function codes. */
#define EVP_F_D2I_PKEY 100
+#define EVP_F_ECDSA_PKEY2PKCS8 129
#define EVP_F_EVP_CIPHERINIT 123
#define EVP_F_EVP_CIPHER_CTX_CTRL 124
#define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122
@@ -759,6 +783,7 @@ void ERR_load_EVP_strings(void);
#define EVP_F_EVP_PKEY_ENCRYPT 105
#define EVP_F_EVP_PKEY_GET1_DH 119
#define EVP_F_EVP_PKEY_GET1_DSA 120
+#define EVP_F_EVP_PKEY_GET1_ECDSA 130
#define EVP_F_EVP_PKEY_GET1_RSA 121
#define EVP_F_EVP_PKEY_NEW 106
#define EVP_F_EVP_RIJNDAEL 126
@@ -770,6 +795,7 @@ void ERR_load_EVP_strings(void);
#define EVP_F_RC5_CTRL 125
/* Reason codes. */
+#define EVP_R_ASN1_LIB 140
#define EVP_R_BAD_BLOCK_LENGTH 136
#define EVP_R_BAD_DECRYPT 100
#define EVP_R_BAD_KEY_LENGTH 137
@@ -786,6 +812,7 @@ void ERR_load_EVP_strings(void);
#define EVP_R_EXPECTING_AN_RSA_KEY 127
#define EVP_R_EXPECTING_A_DH_KEY 128
#define EVP_R_EXPECTING_A_DSA_KEY 129
+#define EVP_R_EXPECTING_A_ECDSA_KEY 141
#define EVP_R_INITIALIZATION_ERROR 134
#define EVP_R_INPUT_NOT_INITIALIZED 111
#define EVP_R_INVALID_KEY_LENGTH 130
diff --git a/crypto/evp/evp_err.c b/crypto/evp/evp_err.c
index 3a23d21c21..e6c71d4e01 100644
--- a/crypto/evp/evp_err.c
+++ b/crypto/evp/evp_err.c
@@ -67,6 +67,7 @@
static ERR_STRING_DATA EVP_str_functs[]=
{
{ERR_PACK(0,EVP_F_D2I_PKEY,0), "D2I_PKEY"},
+{ERR_PACK(0,EVP_F_ECDSA_PKEY2PKCS8,0), "ECDSA_PKEY2PKCS8"},
{ERR_PACK(0,EVP_F_EVP_CIPHERINIT,0), "EVP_CipherInit"},
{ERR_PACK(0,EVP_F_EVP_CIPHER_CTX_CTRL,0), "EVP_CIPHER_CTX_ctrl"},
{ERR_PACK(0,EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH,0), "EVP_CIPHER_CTX_set_key_length"},
@@ -85,6 +86,7 @@ static ERR_STRING_DATA EVP_str_functs[]=
{ERR_PACK(0,EVP_F_EVP_PKEY_ENCRYPT,0), "EVP_PKEY_encrypt"},
{ERR_PACK(0,EVP_F_EVP_PKEY_GET1_DH,0), "EVP_PKEY_get1_DH"},
{ERR_PACK(0,EVP_F_EVP_PKEY_GET1_DSA,0), "EVP_PKEY_get1_DSA"},
+{ERR_PACK(0,EVP_F_EVP_PKEY_GET1_ECDSA,0), "EVP_PKEY_get1_ECDSA"},
{ERR_PACK(0,EVP_F_EVP_PKEY_GET1_RSA,0), "EVP_PKEY_get1_RSA"},
{ERR_PACK(0,EVP_F_EVP_PKEY_NEW,0), "EVP_PKEY_new"},
{ERR_PACK(0,EVP_F_EVP_RIJNDAEL,0), "EVP_RIJNDAEL"},
@@ -99,6 +101,7 @@ static ERR_STRING_DATA EVP_str_functs[]=
static ERR_STRING_DATA EVP_str_reasons[]=
{
+{EVP_R_ASN1_LIB ,"asn1 lib"},
{EVP_R_BAD_BLOCK_LENGTH ,"bad block length"},
{EVP_R_BAD_DECRYPT ,"bad decrypt"},
{EVP_R_BAD_KEY_LENGTH ,"bad key length"},
@@ -115,6 +118,7 @@ static ERR_STRING_DATA EVP_str_reasons[]=
{EVP_R_EXPECTING_AN_RSA_KEY ,"expecting an rsa key"},
{EVP_R_EXPECTING_A_DH_KEY ,"expecting a dh key"},
{EVP_R_EXPECTING_A_DSA_KEY ,"expecting a dsa key"},
+{EVP_R_EXPECTING_A_ECDSA_KEY ,"expecting a ecdsa key"},
{EVP_R_INITIALIZATION_ERROR ,"initialization error"},
{EVP_R_INPUT_NOT_INITIALIZED ,"input not initialized"},
{EVP_R_INVALID_KEY_LENGTH ,"invalid key length"},
diff --git a/crypto/evp/evp_pkey.c b/crypto/evp/evp_pkey.c
index a7c4e9fa7a..15d4d66721 100644
--- a/crypto/evp/evp_pkey.c
+++ b/crypto/evp/evp_pkey.c
@@ -3,7 +3,7 @@
* project 1999.
*/
/* ====================================================================
- * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -65,6 +65,9 @@
#ifndef OPENSSL_NO_DSA
static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8inf, EVP_PKEY *pkey);
#endif
+#ifndef OPENSSL_NO_ECDSA
+static int ecdsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8inf, EVP_PKEY *pkey);
+#endif
/* Extract a private key from a PKCS8 structure */
@@ -76,9 +79,14 @@ EVP_PKEY *EVP_PKCS82PKEY (PKCS8_PRIV_KEY_INFO *p8)
#endif
#ifndef OPENSSL_NO_DSA
DSA *dsa = NULL;
+#endif
+#ifndef OPENSSL_NO_ECDSA
+ ECDSA *ecdsa = NULL;
+#endif
+#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_ECDSA)
ASN1_INTEGER *privkey;
- ASN1_TYPE *t1, *t2, *param = NULL;
- STACK_OF(ASN1_TYPE) *ndsa = NULL;
+ ASN1_TYPE *t1, *t2, *param = NULL;
+ STACK_OF(ASN1_TYPE) *n_stack = NULL;
BN_CTX *ctx = NULL;
int plen;
#endif
@@ -88,6 +96,7 @@ EVP_PKEY *EVP_PKCS82PKEY (PKCS8_PRIV_KEY_INFO *p8)
const unsigned char *cp;
#endif
int pkeylen;
+ int nid;
char obj_tmp[80];
if(p8->pkey->type == V_ASN1_OCTET_STRING) {
@@ -104,7 +113,8 @@ EVP_PKEY *EVP_PKCS82PKEY (PKCS8_PRIV_KEY_INFO *p8)
return NULL;
}
a = p8->pkeyalg;
- switch (OBJ_obj2nid(a->algorithm))
+ nid = OBJ_obj2nid(a->algorithm);
+ switch(nid)
{
#ifndef OPENSSL_NO_RSA
case NID_rsaEncryption:
@@ -116,97 +126,162 @@ EVP_PKEY *EVP_PKCS82PKEY (PKCS8_PRIV_KEY_INFO *p8)
EVP_PKEY_assign_RSA (pkey, rsa);
break;
#endif
-#ifndef OPENSSL_NO_DSA
+#if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_ECDSA)
+ case NID_ecdsa_with_SHA1:
case NID_dsa:
- /* PKCS#8 DSA is weird: you just get a private key integer
+ /* PKCS#8 DSA/ECDSA is weird: you just get a private key integer
* and parameters in the AlgorithmIdentifier the pubkey must
* be recalculated.
*/
- /* Check for broken DSA PKCS#8, UGH! */
- if(*p == (V_ASN1_SEQUENCE|V_ASN1_CONSTRUCTED)) {
- if(!(ndsa = ASN1_seq_unpack_ASN1_TYPE(p, pkeylen,
+ /* Check for broken DSA/ECDSA PKCS#8, UGH! */
+ if(*p == (V_ASN1_SEQUENCE|V_ASN1_CONSTRUCTED))
+ {
+ if(!(n_stack = ASN1_seq_unpack_ASN1_TYPE(p, pkeylen,
d2i_ASN1_TYPE,
- ASN1_TYPE_free))) {
- EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
- goto dsaerr;
- }
- if(sk_ASN1_TYPE_num(ndsa) != 2 ) {
- EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
- goto dsaerr;
- }
+ ASN1_TYPE_free)))
+ {
+ EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
+ goto err;
+ }
+ if(sk_ASN1_TYPE_num(n_stack) != 2 )
+ {
+ EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
+ goto err;
+ }
/* Handle Two broken types:
* SEQUENCE {parameters, priv_key}
* SEQUENCE {pub_key, priv_key}
*/
- t1 = sk_ASN1_TYPE_value(ndsa, 0);
- t2 = sk_ASN1_TYPE_value(ndsa, 1);
- if(t1->type == V_ASN1_SEQUENCE) {
+ t1 = sk_ASN1_TYPE_value(n_stack, 0);
+ t2 = sk_ASN1_TYPE_value(n_stack, 1);
+ if(t1->type == V_ASN1_SEQUENCE)
+ {
p8->broken = PKCS8_EMBEDDED_PARAM;
param = t1;
- } else if(a->parameter->type == V_ASN1_SEQUENCE) {
+ }
+ else if(a->parameter->type == V_ASN1_SEQUENCE)
+ {
p8->broken = PKCS8_NS_DB;
param = a->parameter;
- } else {
+ }
+ else
+ {
EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
- goto dsaerr;
+ goto err;
}
if(t2->type != V_ASN1_INTEGER) {
EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
- goto dsaerr;
+ goto err;
}
privkey = t2->value.integer;
- } else {
- if (!(privkey=d2i_ASN1_INTEGER (NULL, &p, pkeylen))) {
+ }
+ else
+ {
+ if (!(privkey=d2i_ASN1_INTEGER (NULL, &p, pkeylen)))
+ {
EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
- goto dsaerr;
+ goto err;
}
param = p8->pkeyalg->parameter;
}
- if (!param || (param->type != V_ASN1_SEQUENCE)) {
+ if (!param || (param->type != V_ASN1_SEQUENCE))
+ {
EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
- goto dsaerr;
+ goto err;
}
cp = p = param->value.sequence->data;
plen = param->value.sequence->length;
- if (!(dsa = d2i_DSAparams (NULL, &cp, plen))) {
- EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
- goto dsaerr;
- }
- /* We have parameters now set private key */
- if (!(dsa->priv_key = ASN1_INTEGER_to_BN(privkey, NULL))) {
- EVPerr(EVP_F_EVP_PKCS82PKEY,EVP_R_BN_DECODE_ERROR);
- goto dsaerr;
- }
- /* Calculate public key (ouch!) */
- if (!(dsa->pub_key = BN_new())) {
+ if (!(ctx = BN_CTX_new()))
+ {
EVPerr(EVP_F_EVP_PKCS82PKEY,ERR_R_MALLOC_FAILURE);
- goto dsaerr;
+ goto err;
}
- if (!(ctx = BN_CTX_new())) {
- EVPerr(EVP_F_EVP_PKCS82PKEY,ERR_R_MALLOC_FAILURE);
- goto dsaerr;
- }
-
- if (!BN_mod_exp(dsa->pub_key, dsa->g,
- dsa->priv_key, dsa->p, ctx)) {
+ if (nid == NID_dsa)
+ {
+#ifndef OPENSSL_NO_DSA
+ if (!(dsa = d2i_DSAparams (NULL, &cp, plen)))
+ {
+ EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
+ goto err;
+ }
+ /* We have parameters now set private key */
+ if (!(dsa->priv_key = ASN1_INTEGER_to_BN(privkey, NULL)))
+ {
+ EVPerr(EVP_F_EVP_PKCS82PKEY,EVP_R_BN_DECODE_ERROR);
+ goto err;
+ }
+ /* Calculate public key (ouch!) */
+ if (!(dsa->pub_key = BN_new()))
+ {
+ EVPerr(EVP_F_EVP_PKCS82PKEY,ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ if (!BN_mod_exp(dsa->pub_key, dsa->g,
+ dsa->priv_key, dsa->p, ctx))
+ {
+ EVPerr(EVP_F_EVP_PKCS82PKEY,EVP_R_BN_PUBKEY_ERROR);
+ goto err;
+ }
+
+ EVP_PKEY_assign_DSA(pkey, dsa);
+ BN_CTX_free(ctx);
+ if(n_stack) sk_ASN1_TYPE_pop_free(n_stack, ASN1_TYPE_free);
+ else ASN1_INTEGER_free(privkey);
+#else
+ EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM);
+ goto err;
+#endif
+ }
+ else /* nid == NID_ecdsa_with_SHA1 */
+ {
+#ifndef OPENSSL_NO_ECDSA
+ if ((ecdsa = d2i_ECDSAParameters(NULL, &cp, plen)) == NULL)
+ {
+ EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
+ goto err;
+ }
+ if ((ecdsa->priv_key = ASN1_INTEGER_to_BN(privkey, NULL)) == NULL)
+ {
+ EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
+ goto err;
+ }
+ if ((ecdsa->pub_key = EC_POINT_new(ecdsa->group)) == NULL)
+ {
+ EVPerr(EVP_F_EVP_PKCS82PKEY, ERR_R_EC_LIB);
+ goto err;
+ }
+ if (!EC_POINT_copy(ecdsa->pub_key, EC_GROUP_get0_generator(ecdsa->group)))
+ {
+ EVPerr(EVP_F_EVP_PKCS82PKEY, ERR_R_EC_LIB);
+ goto err;
+ }
+ if (!EC_POINT_mul(ecdsa->group, ecdsa->pub_key, ecdsa->priv_key,
+ NULL, NULL, ctx))
+ {
+ EVPerr(EVP_F_EVP_PKCS82PKEY, ERR_R_EC_LIB);
+ goto err;
+ }
- EVPerr(EVP_F_EVP_PKCS82PKEY,EVP_R_BN_PUBKEY_ERROR);
- goto dsaerr;
+ EVP_PKEY_assign_ECDSA(pkey, ecdsa);
+ BN_CTX_free(ctx);
+ if (n_stack) sk_ASN1_TYPE_pop_free(n_stack, ASN1_TYPE_free);
+ else
+ ASN1_INTEGER_free(privkey);
+#else
+ EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM);
+ goto err;
+#endif
}
-
- EVP_PKEY_assign_DSA(pkey, dsa);
- BN_CTX_free (ctx);
- if(ndsa) sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free);
- else ASN1_INTEGER_free(privkey);
break;
- dsaerr:
- BN_CTX_free (ctx);
- sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free);
- DSA_free(dsa);
- EVP_PKEY_free(pkey);
+err:
+ if (ctx) BN_CTX_free(ctx);
+ sk_ASN1_TYPE_pop_free(n_stack, ASN1_TYPE_free);
+ if (dsa) DSA_free(dsa);
+ if (ecdsa) ECDSA_free(ecdsa);
+ if (pkey) EVP_PKEY_free(pkey);
return NULL;
break;
#endif
@@ -269,6 +344,15 @@ PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken)
break;
#endif
+#ifndef OPENSSL_NO_ECDSA
+ case EVP_PKEY_ECDSA:
+ if (!ecdsa_pkey2pkcs8(p8, pkey))
+ {
+ PKCS8_PRIV_KEY_INFO_free(p8);
+ return(NULL);
+ }
+ break;
+#endif
default:
EVPerr(EVP_F_EVP_PKEY2PKCS8, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM);
PKCS8_PRIV_KEY_INFO_free (p8);
@@ -412,3 +496,210 @@ static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey)
return 1;
}
#endif
+
+#ifndef OPENSSL_NO_ECDSA
+static int ecdsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey)
+{
+ ASN1_STRING *params=NULL;
+ ASN1_INTEGER *prkey=NULL;
+ ASN1_TYPE *ttmp=NULL;
+ STACK_OF(ASN1_TYPE) *necdsa=NULL;
+ unsigned char *p=NULL, *q=NULL;
+ int len=0;
+ EC_POINT *point=NULL;
+
+ if (pkey->pkey.ecdsa == NULL || pkey->pkey.ecdsa->group == NULL)
+ {
+ EVPerr(EVP_F_ECDSA_PKEY2PKCS8, EVP_R_MISSING_PARAMETERS);
+ return 0;
+ }
+ p8->pkeyalg->algorithm = OBJ_nid2obj(NID_ecdsa_with_SHA1);
+ len = i2d_ECDSAParameters(pkey->pkey.ecdsa, NULL);
+ if ((p = OPENSSL_malloc(len)) == NULL)
+ {
+ EVPerr(EVP_F_ECDSA_PKEY2PKCS8, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ q = p;
+ if (!i2d_ECDSAParameters(pkey->pkey.ecdsa, &q))
+ {
+ EVPerr(EVP_F_ECDSA_PKEY2PKCS8, ERR_R_ECDSA_LIB);
+ OPENSSL_free(p);
+ return 0;
+ }
+ if ((params = ASN1_STRING_new()) == NULL)
+ {
+ EVPerr(EVP_F_ECDSA_PKEY2PKCS8, ERR_R_MALLOC_FAILURE);
+ OPENSSL_free(p);
+ return 0;
+
+ }
+ if (!ASN1_STRING_set(params, p, len))
+ {
+ EVPerr(EVP_F_ECDSA_PKEY2PKCS8, ERR_R_ASN1_LIB);
+ OPENSSL_free(p);
+ return 0;
+ }
+ OPENSSL_free(p);
+ if ((prkey = BN_to_ASN1_INTEGER(pkey->pkey.ecdsa->priv_key, NULL)) == NULL)
+ {
+ EVPerr(EVP_F_ECDSA_PKEY2PKCS8, ERR_R_ASN1_LIB);
+ return 0;
+ }
+
+ switch(p8->broken) {
+
+ case PKCS8_OK:
+ case PKCS8_NO_OCTET:
+
+ if (!ASN1_pack_string((char *)prkey, i2d_ASN1_INTEGER,
+ &p8->pkey->value.octet_string))
+ {
+ EVPerr(EVP_F_ECDSA_PKEY2PKCS8, ERR_R_MALLOC_FAILURE);
+ M_ASN1_INTEGER_free(prkey);
+ return 0;
+ }
+
+ ASN1_INTEGER_free(prkey);
+ p8->pkeyalg->parameter->value.sequence = params;
+ p8->pkeyalg->parameter->type = V_ASN1_SEQUENCE;
+
+ break;
+
+ case PKCS8_NS_DB:
+
+ p8->pkeyalg->parameter->value.sequence = params;
+ p8->pkeyalg->parameter->type = V_ASN1_SEQUENCE;
+ necdsa = sk_ASN1_TYPE_new_null();
+ if (necdsa == NULL || (ttmp = ASN1_TYPE_new()) == NULL)
+ {
+ EVPerr(EVP_F_ECDSA_PKEY2PKCS8, ERR_R_MALLOC_FAILURE);
+ sk_ASN1_TYPE_pop_free(necdsa, ASN1_TYPE_free);
+ return 0;
+ }
+
+ if ((point = EC_GROUP_get0_generator(pkey->pkey.ecdsa->group)) == NULL)
+ {
+ EVPerr(EVP_F_ECDSA_PKEY2PKCS8, ERR_R_EC_LIB);
+ return 0;
+ }
+ len = EC_POINT_point2oct(pkey->pkey.ecdsa->group, point, POINT_CONVERSION_COMPRESSED,
+ NULL, 0, NULL);
+ p = OPENSSL_malloc(len);
+ if (!len || !p || !EC_POINT_point2oct(pkey->pkey.ecdsa->group, point,
+ POINT_CONVERSION_COMPRESSED, p, len, NULL))
+ {
+ EVPerr(EVP_F_ECDSA_PKEY2PKCS8, ERR_R_EC_LIB);
+ OPENSSL_free(p);
+ return 0;
+ }
+ if ((ttmp->value.octet_string = ASN1_OCTET_STRING_new()) == NULL)
+ {
+ EVPerr(EVP_F_ECDSA_PKEY2PKCS8, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ if (!ASN1_OCTET_STRING_set(ttmp->value.octet_string, p, len))
+ {
+ EVPerr(EVP_F_ECDSA_PKEY2PKCS8, EVP_R_ASN1_LIB);
+ return 0;
+ }
+ OPENSSL_free(p);
+
+ ttmp->type = V_ASN1_OCTET_STRING;
+ if (!sk_ASN1_TYPE_push(necdsa, ttmp))
+ {
+ sk_ASN1_TYPE_pop_free(necdsa, ASN1_TYPE_free);
+ ASN1_INTEGER_free(prkey);
+ return 0;
+ }
+
+ if ((ttmp = ASN1_TYPE_new()) == NULL)
+ {
+ EVPerr(EVP_F_ECDSA_PKEY2PKCS8, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ ttmp->value.integer = prkey;
+ ttmp->type = V_ASN1_INTEGER;
+ if (!sk_ASN1_TYPE_push(necdsa, ttmp))
+ {
+ sk_ASN1_TYPE_pop_free(necdsa, ASN1_TYPE_free);
+ ASN1_INTEGER_free(prkey);
+ return 0;
+ }
+
+ if ((p8->pkey->value.octet_string = ASN1_OCTET_STRING_new()) == NULL)
+ {
+ EVPerr(EVP_F_ECDSA_PKEY2PKCS8, ERR_R_MALLOC_FAILURE);
+ sk_ASN1_TYPE_pop_free(necdsa, ASN1_TYPE_free);
+ return 0;
+ }
+
+ if (!ASN1_seq_pack_ASN1_TYPE(necdsa, i2d_ASN1_TYPE,
+ &p8->pkey->value.octet_string->data,
+ &p8->pkey->value.octet_string->length))
+ {
+
+ EVPerr(EVP_F_ECDSA_PKEY2PKCS8, ERR_R_MALLOC_FAILURE);
+ sk_ASN1_TYPE_pop_free(necdsa, ASN1_TYPE_free);
+ return 0;
+ }
+ sk_ASN1_TYPE_pop_free(necdsa, ASN1_TYPE_free);
+ break;
+
+ case PKCS8_EMBEDDED_PARAM:
+
+ p8->pkeyalg->parameter->type = V_ASN1_NULL;
+ necdsa = sk_ASN1_TYPE_new_null();
+ if ((ttmp = ASN1_TYPE_new()) == NULL)
+ {
+ EVPerr(EVP_F_ECDSA_PKEY2PKCS8, ERR_R_MALLOC_FAILURE);
+ sk_ASN1_TYPE_pop_free(necdsa, ASN1_TYPE_free);
+ ASN1_INTEGER_free(prkey);
+ return 0;
+ }
+ ttmp->value.sequence = params;
+ ttmp->type = V_ASN1_SEQUENCE;
+ if (!sk_ASN1_TYPE_push(necdsa, ttmp))
+ {
+ sk_ASN1_TYPE_pop_free(necdsa, ASN1_TYPE_free);
+ ASN1_INTEGER_free(prkey);
+ return 0;
+ }
+
+ if ((ttmp = ASN1_TYPE_new()) == NULL)
+ {
+ EVPerr(EVP_F_ECDSA_PKEY2PKCS8, ERR_R_MALLOC_FAILURE);
+ sk_ASN1_TYPE_pop_free(necdsa, ASN1_TYPE_free);
+ ASN1_INTEGER_free(prkey);
+ return 0;
+ }
+ ttmp->value.integer = prkey;
+ ttmp->type = V_ASN1_INTEGER;
+ if (!sk_ASN1_TYPE_push(necdsa, ttmp))
+ {
+ sk_ASN1_TYPE_pop_free(necdsa, ASN1_TYPE_free);
+ ASN1_INTEGER_free(prkey);
+ return 0;
+ }
+
+ if ((p8->pkey->value.octet_string = ASN1_OCTET_STRING_new()) == NULL)
+ {
+ EVPerr(EVP_F_ECDSA_PKEY2PKCS8, ERR_R_MALLOC_FAILURE);
+ sk_ASN1_TYPE_pop_free(necdsa, ASN1_TYPE_free);
+ return 0;
+ }
+
+ if (!ASN1_seq_pack_ASN1_TYPE(necdsa, i2d_ASN1_TYPE,
+ &p8->pkey->value.octet_string->data,
+ &p8->pkey->value.octet_string->length))
+ {
+ EVPerr(EVP_F_ECDSA_PKEY2PKCS8, ERR_R_MALLOC_FAILURE);
+ sk_ASN1_TYPE_pop_free(necdsa, ASN1_TYPE_free);
+ return 0;
+ }
+ sk_ASN1_TYPE_pop_free(necdsa, ASN1_TYPE_free);
+ break;
+ }
+ return 1;
+}
+#endif
diff --git a/crypto/evp/m_ecdsa.c b/crypto/evp/m_ecdsa.c
new file mode 100644
index 0000000000..4e8b010709
--- /dev/null
+++ b/crypto/evp/m_ecdsa.c
@@ -0,0 +1,95 @@
+/* crypto/evp/m_ecdsa.c */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to. The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * "This product includes cryptographic software written by
+ * Eric Young (eay@cryptsoft.com)"
+ * The word 'cryptographic' can be left out if the rouines from the library
+ * being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ * the apps directory (application code) you must include an acknowledgement:
+ * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed. i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#include <stdio.h>
+#include "cryptlib.h"
+#include <openssl/evp.h>
+#include <openssl/objects.h>
+#include <openssl/x509.h>
+
+#ifndef OPENSSL_NO_SHA
+static int init(EVP_MD_CTX *ctx)
+ { return SHA1_Init(ctx->md_data); }
+
+static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
+ { return SHA1_Update(ctx->md_data,data,count); }
+
+static int final(EVP_MD_CTX *ctx,unsigned char *md)
+ { return SHA1_Final(md,ctx->md_data); }
+
+static const EVP_MD ecdsa_md=
+ {
+ NID_ecdsa_with_SHA1,
+ NID_ecdsa_with_SHA1,
+ SHA_DIGEST_LENGTH,
+ 0,
+ init,
+ update,
+ final,
+ NULL,
+ NULL,
+ EVP_PKEY_ECDSA_method,
+ SHA_CBLOCK,
+ sizeof(EVP_MD *)+sizeof(SHA_CTX),
+ };
+
+const EVP_MD *EVP_ecdsa(void)
+ {
+ return(&ecdsa_md);
+ }
+#endif
diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c
index 215b94292a..fcb5711753 100644
--- a/crypto/evp/p_lib.c
+++ b/crypto/evp/p_lib.c
@@ -58,6 +58,8 @@
#include <stdio.h>
#include "cryptlib.h"
+#include <openssl/bn.h>
+#include <openssl/err.h>
#include <openssl/objects.h>
#include <openssl/evp.h>
#include <openssl/asn1_mac.h>
@@ -67,15 +69,38 @@ static void EVP_PKEY_free_it(EVP_PKEY *x);
int EVP_PKEY_bits(EVP_PKEY *pkey)
{
+ if (0)
+ return 0;
#ifndef OPENSSL_NO_RSA
- if (pkey->type == EVP_PKEY_RSA)
+ else if (pkey->type == EVP_PKEY_RSA)
return(BN_num_bits(pkey->pkey.rsa->n));
- else
#endif
#ifndef OPENSSL_NO_DSA
- if (pkey->type == EVP_PKEY_DSA)
+ else if (pkey->type == EVP_PKEY_DSA)
return(BN_num_bits(pkey->pkey.dsa->p));
#endif
+#ifndef OPENSSL_NO_ECDSA
+ else if (pkey->type == EVP_PKEY_ECDSA)
+ {
+ BIGNUM *order = BN_new();
+ int ret;
+
+ if (!order)
+ {
+ ERR_clear_error();
+ return 0;
+ }
+ if (!EC_GROUP_get_order(pkey->pkey.ecdsa->group, order, NULL))
+ {
+ ERR_clear_error();
+ return 0;
+ }
+
+ ret = BN_num_bits(order);
+ BN_free(order);
+ return ret;
+ }
+#endif
return(0);
}
@@ -92,6 +117,11 @@ int EVP_PKEY_size(EVP_PKEY *pkey)
if (pkey->type == EVP_PKEY_DSA)
return(DSA_size(pkey->pkey.dsa));
#endif
+#ifndef OPENSSL_NO_ECDSA
+ if (pkey->type == EVP_PKEY_ECDSA)
+ return(ECDSA_size(pkey->pkey.ecdsa));
+#endif
+
return(0);
}
@@ -107,6 +137,16 @@ int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode)
return(ret);
}
#endif
+#ifndef OPENSSL_NO_ECDSA
+ if (pkey->type == EVP_PKEY_ECDSA)
+ {
+ int ret = pkey->save_parameters;
+
+ if (mode >= 0)
+ pkey->save_parameters = mode;
+ return(ret);
+ }
+#endif
return(0);
}
@@ -141,6 +181,15 @@ int EVP_PKEY_copy_parameters(EVP_PKEY *to, EVP_PKEY *from)
to->pkey.dsa->g=a;
}
#endif
+#ifndef OPENSSL_NO_ECDSA
+ if (to->type == EVP_PKEY_ECDSA)
+ {
+ if (to->pkey.ecdsa->group != NULL)
+ EC_GROUP_free(to->pkey.ecdsa->group);
+ if ((to->pkey.ecdsa->group = EC_GROUP_new(EC_GROUP_method_of(from->pkey.ecdsa->group))) == NULL) goto err;
+ if (!EC_GROUP_copy(to->pkey.ecdsa->group,from->pkey.ecdsa->group)) goto err;
+ }
+#endif
return(1);
err:
return(0);
@@ -158,6 +207,14 @@ int EVP_PKEY_missing_parameters(EVP_PKEY *pkey)
return(1);
}
#endif
+#ifndef OPENSSL_NO_ECDSA
+ if (pkey->type == EVP_PKEY_ECDSA)
+ {
+ if (pkey->pkey.ecdsa->group == NULL)
+ return(1);
+ }
+#endif
+
return(0);
}
@@ -246,6 +303,28 @@ DSA *EVP_PKEY_get1_DSA(EVP_PKEY *pkey)
}
#endif
+#ifndef OPENSSL_NO_ECDSA
+
+int EVP_PKEY_set1_ECDSA(EVP_PKEY *pkey, ECDSA *key)
+{
+ int ret = EVP_PKEY_assign_ECDSA(pkey,key);
+ if (ret) CRYPTO_add(&key->references, 1,CRYPTO_LOCK_ECDSA);
+ return ret;
+}
+
+ECDSA *EVP_PKEY_get1_ECDSA(EVP_PKEY *pkey)
+{
+ if (pkey->type != EVP_PKEY_ECDSA)
+ {
+ EVPerr(EVP_F_EVP_PKEY_GET1_ECDSA, EVP_R_EXPECTING_A_ECDSA_KEY);
+ return NULL;
+ }
+ CRYPTO_add(&pkey->pkey.ecdsa->references, 1, CRYPTO_LOCK_ECDSA);
+ return pkey->pkey.ecdsa;
+}
+#endif
+
+
#ifndef OPENSSL_NO_DH
int EVP_PKEY_set1_DH(EVP_PKEY *pkey, DH *key)
@@ -282,6 +361,8 @@ int EVP_PKEY_type(int type)
return(EVP_PKEY_DSA);
case EVP_PKEY_DH:
return(EVP_PKEY_DH);
+ case EVP_PKEY_ECDSA:
+ return(EVP_PKEY_ECDSA);
default:
return(NID_undef);
}
@@ -327,6 +408,11 @@ static void EVP_PKEY_free_it(EVP_PKEY *x)
DSA_free(x->pkey.dsa);
break;
#endif
+#ifndef OPENSSL_NO_ECDSA
+ case EVP_PKEY_ECDSA:
+ ECDSA_free(x->pkey.ecdsa);
+ break;
+#endif
#ifndef OPENSSL_NO_DH
case EVP_PKEY_DH:
DH_free(x->pkey.dh);