ECDSA support
authorBodo Möller <bodo@openssl.org>
Wed, 13 Feb 2002 18:21:51 +0000 (18:21 +0000)
committerBodo Möller <bodo@openssl.org>
Wed, 13 Feb 2002 18:21:51 +0000 (18:21 +0000)
Submitted by: Nils Larsch <nla@trustcenter.de>

84 files changed:
CHANGES
Configure
Makefile.org
TABLE
apps/Makefile.ssl
apps/ca.c
apps/ecdsa.c [new file with mode: 0644]
apps/ecdsaparam.c [new file with mode: 0644]
apps/progs.h
apps/progs.pl
apps/req.c
apps/s_server.c
apps/x509.c
crypto/Makefile.ssl
crypto/asn1/Makefile.ssl
crypto/asn1/asn1.h
crypto/asn1/asn1_err.c
crypto/asn1/d2i_pr.c
crypto/asn1/d2i_pu.c
crypto/asn1/i2d_pr.c
crypto/asn1/i2d_pu.c
crypto/asn1/t_pkey.c
crypto/asn1/t_req.c
crypto/asn1/t_spki.c
crypto/asn1/t_x509.c
crypto/asn1/x_pubkey.c
crypto/conf/Makefile.ssl
crypto/dh/Makefile.ssl
crypto/dsa/Makefile.ssl
crypto/ec/ec_cvt.c
crypto/ec/ec_err.c
crypto/ec/ec_lib.c
crypto/ecdsa/.cvsignore [new file with mode: 0644]
crypto/ecdsa/Makefile.ssl [new file with mode: 0644]
crypto/ecdsa/ecdsa.h [new file with mode: 0644]
crypto/ecdsa/ecdsatest.c [new file with mode: 0644]
crypto/ecdsa/ecs_asn1.c [new file with mode: 0644]
crypto/ecdsa/ecs_err.c [new file with mode: 0644]
crypto/ecdsa/ecs_gen.c [new file with mode: 0644]
crypto/ecdsa/ecs_key.c [new file with mode: 0644]
crypto/ecdsa/ecs_lib.c [new file with mode: 0644]
crypto/ecdsa/ecs_locl.h [new file with mode: 0644]
crypto/ecdsa/ecs_ossl.c [new file with mode: 0644]
crypto/ecdsa/ecs_sign.c [new file with mode: 0644]
crypto/ecdsa/ecs_vrf.c [new file with mode: 0644]
crypto/engine/Makefile.ssl
crypto/engine/eng_int.h
crypto/engine/eng_list.c
crypto/engine/engine.h
crypto/engine/tb_ecdsa.c [new file with mode: 0644]
crypto/err/Makefile.ssl
crypto/err/err.h
crypto/err/openssl.ec
crypto/evp/Makefile.ssl
crypto/evp/c_alld.c
crypto/evp/evp.h
crypto/evp/evp_err.c
crypto/evp/evp_pkey.c
crypto/evp/m_ecdsa.c [new file with mode: 0644]
crypto/evp/p_lib.c
crypto/ocsp/Makefile.ssl
crypto/pem/Makefile.ssl
crypto/pem/pem.h
crypto/pem/pem_all.c
crypto/pem/pem_info.c
crypto/pem/pem_lib.c
crypto/pem/pem_pkey.c
crypto/pkcs12/Makefile.ssl
crypto/pkcs7/Makefile.ssl
crypto/pkcs7/pk7_doit.c
crypto/pkcs7/pk7_lib.c
crypto/rand/Makefile.ssl
crypto/rsa/Makefile.ssl
crypto/x509/Makefile.ssl
crypto/x509/x509.h
crypto/x509/x509_cmp.c
crypto/x509/x509type.c
crypto/x509/x_all.c
crypto/x509v3/Makefile.ssl
ssl/Makefile.ssl
test/Makefile.ssl
util/libeay.num
util/mkdef.pl
util/mkerr.pl

diff --git a/CHANGES b/CHANGES
index 12aeb9b..db1916c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,19 +2,45 @@
  OpenSSL CHANGES
  _______________
 
- Changes between 0.9.7 and 0.9.8  [xx XXX 2001]
-
-  *)
-
- Changes between 0.9.6 and 0.9.7  [xx XXX 2001]
+ Changes between 0.9.7 and 0.9.8  [xx XXX 2002]
+
+  *) Add ECDSA in new directory crypto/ecdsa/.
+
+     Add applications 'openssl ecdsaparam' and 'openssl ecdsa'
+     (these are variants of 'openssl dsaparam' and 'openssl dsa').
+
+     ECDSA support is also included in various other files across the
+     library.  Most notably,
+     - 'openssl req' now has a '-newkey ecdsa:file' option;
+     - EVP_PKCS82PKEY (crypto/evp/evp_pkey.c) now can handle ECDSA;
+     - X509_PUBKEY_get (crypto/asn1/x_pubkey.c) and
+       d2i_PublicKey (crypto/asn1/d2i_pu.c) have been modified to make
+       them suitable for ECDSA where domain parameters must be
+       extracted before the specific public key.
+     [Nils Larsch <nla@trustcenter.de]
+
+  *) Add reference counting for EC_GROUP objects.
+     [Nils Larsch <nla@trustcenter.de]
+
+  *) Include some named elliptic curves.  These can be obtained from
+     the new functions
+          EC_GROUP_new_by_nid()
+          EC_GROUP_new_by_name()
+     Also add a 'nid' field to EC_GROUP objects, which can be accessed
+     via
+         EC_GROUP_set_nid()
+         EC_GROUP_get_nid()
+     [Nils Larsch <nla@trustcenter.de, Bodo Moeller]
+ Changes between 0.9.6 and 0.9.7  [xx XXX 2002]
 
-     OpenSSL 0.9.6a/0.9.6b/0.9.6c (bugfix releases, 5 Apr 2001, 9 July 2001
-     and 21 Dec 2001) and OpenSSL 0.9.7 were developed in parallel, based
-     on OpenSSL 0.9.6.  
+     OpenSSL 0.9.6a/0.9.6b/0.9.6c/0.9.6d (bugfix releases, 5 Apr 2001,
+     9 July 2001, 21 Dec 2001 and xx XXX 2002) and OpenSSL 0.9.7 were
+     developed in parallel, based on OpenSSL 0.9.6.  
 
      Change log entries are tagged as follows:
-         -) applies to 0.9.6a/0.9.6b/0.9.6c only
-         *) applies to 0.9.6a/0.9.6b/0.9.6c and 0.9.7
+         -) applies to 0.9.6a ... 0.9.6d only
+         *) applies to 0.9.6a ... 0.9.6d and 0.9.7
          +) applies to 0.9.7 only
 
   *) Add information about CygWin32 1.3 and on, and preserve proper
index 3a421ab..1e82476 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -719,6 +719,14 @@ PROCESS_ARGS:
                                $depflags .= "-DOPENSSL_NO_MDC2 ";
                                $openssl_algorithm_defines .= "#define OPENSSL_NO_MDC2\n";
                                }
+                       if ($algo eq "EC" || $algo eq "SHA" || $algo eq "SHA1")
+                               {
+                               push @skip, "ecdsa";
+                               $options .= " no-ecdsa";
+                               $flags .= "-DOPENSSL_NO_ECDSA ";
+                               $depflags .= "-DOPENSSL_NO_ECDSA ";
+                               $openssl_algorithm_defines .= "#define OPENSSL_NO_ECDSA\n";
+                               }
                        if ($algo eq "MD5")
                                {
                                $no_md5 = 1;
index 89f2747..c05fa05 100644 (file)
@@ -166,7 +166,7 @@ SHLIBDIRS= crypto ssl
 SDIRS=  \
        md2 md4 md5 sha mdc2 hmac ripemd \
        des rc2 rc4 rc5 idea bf cast \
-       bn ec rsa dsa dh dso engine aes \
+       bn ec rsa dsa ecdsa dh dso engine aes \
        buffer bio stack lhash rand err objects \
        evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5
 
diff --git a/TABLE b/TABLE
index 1f80f7e..6cde82a 100644 (file)
--- a/TABLE
+++ b/TABLE
@@ -90,6 +90,30 @@ $rc4_obj      =
 $rmd160_obj   = 
 $rc5_obj      = 
 $dso_scheme   = win32
+$shared_target= cygwin-shared
+$shared_cflag = 
+$shared_ldflag = .dll
+$shared_extension = 
+$ranlib       = 
+
+*** CygWin32-pre1.3
+$cc           = gcc
+$cflags       = -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall
+$unistd       = 
+$thread_cflag = (unknown)
+$sys_id       = CYGWIN32
+$lflags       = 
+$bn_ops       = BN_LLONG DES_PTR DES_RISC1 DES_UNROLL RC4_INDEX MD2_INT
+$bn_obj       = 
+$des_obj      = 
+$bf_obj       = 
+$md5_obj      = 
+$sha1_obj     = 
+$cast_obj     = 
+$rc4_obj      = 
+$rmd160_obj   = 
+$rc5_obj      = 
+$dso_scheme   = win32
 $shared_target= 
 $shared_cflag = 
 $shared_ldflag = 
index 7a87483..4d7e0ba 100644 (file)
@@ -42,7 +42,7 @@ SCRIPTS=CA.sh CA.pl der_chop
 EXE= $(PROGRAM)$(EXE_EXT)
 
 E_EXE= verify asn1pars req dgst dh dhparam enc passwd gendh errstr \
-       ca crl rsa rsautl dsa dsaparam \
+       ca crl rsa rsautl dsa dsaparam ecdsa ecdsaparam\
        x509 genrsa gendsa s_server s_client speed \
        s_time version pkcs7 crl2pkcs7 sess_id ciphers nseq pkcs12 \
        pkcs8 spkac smime rand engine ocsp
@@ -58,14 +58,14 @@ RAND_SRC=app_rand.c
 
 E_OBJ= verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o errstr.o \
        ca.o pkcs7.o crl2p7.o crl.o \
-       rsa.o rsautl.o dsa.o dsaparam.o \
+       rsa.o rsautl.o dsa.o dsaparam.o ecdsa.o ecdsaparam.o\
        x509.o genrsa.o gendsa.o s_server.o s_client.o speed.o \
        s_time.o $(A_OBJ) $(S_OBJ) $(RAND_OBJ) version.o sess_id.o \
        ciphers.o nseq.o pkcs12.o pkcs8.o spkac.o smime.o rand.o engine.o ocsp.o
 
 E_SRC= verify.c asn1pars.c req.c dgst.c dh.c enc.c passwd.c gendh.c errstr.c ca.c \
        pkcs7.c crl2p7.c crl.c \
-       rsa.c rsautl.c dsa.c dsaparam.c \
+       rsa.c rsautl.c dsa.c dsaparam.c ecdsa.c ecdsaparam.c\
        x509.c genrsa.c gendsa.c s_server.c s_client.c speed.c \
        s_time.c $(A_SRC) $(S_SRC) $(RAND_SRC) version.c sess_id.c \
        ciphers.c nseq.c pkcs12.c pkcs8.c spkac.c smime.c rand.c engine.c ocsp.c
@@ -157,646 +157,736 @@ progs.h: progs.pl
 
 # DO NOT DELETE THIS LINE -- make depend depends on it.
 
-app_rand.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-app_rand.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-app_rand.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-app_rand.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-app_rand.o: ../include/openssl/e_os2.h ../include/openssl/evp.h
-app_rand.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-app_rand.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-app_rand.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-app_rand.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
-app_rand.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-app_rand.o: ../include/openssl/sha.h ../include/openssl/stack.h
-app_rand.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-app_rand.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h app_rand.c
-app_rand.o: apps.h
-apps.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-apps.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-apps.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-apps.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-apps.o: ../include/openssl/e_os2.h ../include/openssl/engine.h
-apps.o: ../include/openssl/err.h ../include/openssl/evp.h
-apps.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-apps.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-apps.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-apps.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-apps.o: ../include/openssl/pkcs12.h ../include/openssl/pkcs7.h
-apps.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-apps.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-apps.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-apps.o: ../include/openssl/txt_db.h ../include/openssl/ui.h
-apps.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-apps.o: ../include/openssl/x509v3.h apps.c apps.h
-asn1pars.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-asn1pars.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-asn1pars.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-asn1pars.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-asn1pars.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-asn1pars.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-asn1pars.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-asn1pars.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-asn1pars.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-asn1pars.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-asn1pars.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-asn1pars.o: ../include/openssl/sha.h ../include/openssl/stack.h
-asn1pars.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-asn1pars.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
-asn1pars.o: asn1pars.c
-ca.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ca.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ca.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-ca.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-ca.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-ca.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-ca.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-ca.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-ca.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-ca.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-ca.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
-ca.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-ca.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-ca.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-ca.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h ca.c
-ciphers.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ciphers.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ciphers.o: ../include/openssl/comp.h ../include/openssl/conf.h
-ciphers.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-ciphers.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
-ciphers.o: ../include/openssl/err.h ../include/openssl/evp.h
-ciphers.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
-ciphers.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-ciphers.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-ciphers.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-ciphers.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-ciphers.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-ciphers.o: ../include/openssl/sha.h ../include/openssl/ssl.h
-ciphers.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
-ciphers.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-ciphers.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-ciphers.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-ciphers.o: ../include/openssl/x509_vfy.h apps.h ciphers.c
-crl.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-crl.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-crl.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-crl.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-crl.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-crl.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-crl.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-crl.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-crl.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-crl.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-crl.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-crl.o: ../include/openssl/sha.h ../include/openssl/stack.h
-crl.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-crl.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-crl.o: ../include/openssl/x509v3.h apps.h crl.c
-crl2p7.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-crl2p7.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-crl2p7.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-crl2p7.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-crl2p7.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-crl2p7.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-crl2p7.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-crl2p7.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-crl2p7.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-crl2p7.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-crl2p7.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-crl2p7.o: ../include/openssl/sha.h ../include/openssl/stack.h
-crl2p7.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-crl2p7.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
-crl2p7.o: crl2p7.c
-dgst.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-dgst.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-dgst.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-dgst.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-dgst.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-dgst.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-dgst.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-dgst.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-dgst.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-dgst.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-dgst.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-dgst.o: ../include/openssl/sha.h ../include/openssl/stack.h
-dgst.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-dgst.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h dgst.c
-dh.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-dh.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-dh.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-dh.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-dh.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-dh.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-dh.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-dh.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-dh.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-dh.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-dh.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-dh.o: ../include/openssl/sha.h ../include/openssl/stack.h
-dh.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-dh.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h dh.c
-dsa.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-dsa.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-dsa.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-dsa.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-dsa.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-dsa.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-dsa.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-dsa.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-dsa.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-dsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-dsa.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-dsa.o: ../include/openssl/sha.h ../include/openssl/stack.h
-dsa.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-dsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h dsa.c
-dsaparam.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-dsaparam.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-dsaparam.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-dsaparam.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-dsaparam.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-dsaparam.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-dsaparam.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-dsaparam.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-dsaparam.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-dsaparam.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-dsaparam.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-dsaparam.o: ../include/openssl/sha.h ../include/openssl/stack.h
-dsaparam.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-dsaparam.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
-dsaparam.o: dsaparam.c
-enc.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-enc.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-enc.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-enc.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-enc.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-enc.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-enc.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-enc.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-enc.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-enc.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-enc.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-enc.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-enc.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-enc.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-enc.o: ../include/openssl/x509_vfy.h apps.h enc.c
-engine.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-engine.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-engine.o: ../include/openssl/comp.h ../include/openssl/conf.h
-engine.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-engine.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
-engine.o: ../include/openssl/engine.h ../include/openssl/err.h
-engine.o: ../include/openssl/evp.h ../include/openssl/kssl.h
-engine.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-engine.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-engine.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-engine.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-engine.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
-engine.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-engine.o: ../include/openssl/sha.h ../include/openssl/ssl.h
-engine.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
-engine.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-engine.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-engine.o: ../include/openssl/txt_db.h ../include/openssl/ui.h
-engine.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
-engine.o: engine.c
-errstr.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-errstr.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-errstr.o: ../include/openssl/comp.h ../include/openssl/conf.h
-errstr.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-errstr.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
-errstr.o: ../include/openssl/err.h ../include/openssl/evp.h
-errstr.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
-errstr.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-errstr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-errstr.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-errstr.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-errstr.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-errstr.o: ../include/openssl/sha.h ../include/openssl/ssl.h
-errstr.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
-errstr.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-errstr.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-errstr.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-errstr.o: ../include/openssl/x509_vfy.h apps.h errstr.c
-gendh.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-gendh.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-gendh.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-gendh.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-gendh.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-gendh.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-gendh.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-gendh.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-gendh.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-gendh.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-gendh.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-gendh.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-gendh.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-gendh.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-gendh.o: ../include/openssl/x509_vfy.h apps.h gendh.c
-gendsa.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-gendsa.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-gendsa.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-gendsa.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-gendsa.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-gendsa.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-gendsa.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-gendsa.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-gendsa.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-gendsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-gendsa.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-gendsa.o: ../include/openssl/sha.h ../include/openssl/stack.h
-gendsa.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-gendsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
-gendsa.o: gendsa.c
-genrsa.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-genrsa.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-genrsa.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-genrsa.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-genrsa.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-genrsa.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-genrsa.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-genrsa.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-genrsa.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-genrsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-genrsa.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-genrsa.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-genrsa.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-genrsa.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-genrsa.o: ../include/openssl/x509_vfy.h apps.h genrsa.c
-nseq.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-nseq.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-nseq.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-nseq.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-nseq.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-nseq.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-nseq.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-nseq.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-nseq.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-nseq.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-nseq.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-nseq.o: ../include/openssl/sha.h ../include/openssl/stack.h
-nseq.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-nseq.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h nseq.c
-ocsp.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ocsp.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ocsp.o: ../include/openssl/comp.h ../include/openssl/conf.h
-ocsp.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-ocsp.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
-ocsp.o: ../include/openssl/err.h ../include/openssl/evp.h
-ocsp.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
-ocsp.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-ocsp.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-ocsp.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-ocsp.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-ocsp.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
-ocsp.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-ocsp.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-ocsp.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
-ocsp.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-ocsp.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
-ocsp.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-ocsp.o: ../include/openssl/x509v3.h apps.h ocsp.c
-openssl.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-openssl.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-openssl.o: ../include/openssl/comp.h ../include/openssl/conf.h
-openssl.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-openssl.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
-openssl.o: ../include/openssl/engine.h ../include/openssl/err.h
-openssl.o: ../include/openssl/evp.h ../include/openssl/kssl.h
-openssl.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-openssl.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-openssl.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-openssl.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-openssl.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
-openssl.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-openssl.o: ../include/openssl/sha.h ../include/openssl/ssl.h
-openssl.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
-openssl.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-openssl.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-openssl.o: ../include/openssl/txt_db.h ../include/openssl/ui.h
-openssl.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
-openssl.o: openssl.c progs.h s_apps.h
-passwd.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-passwd.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-passwd.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-passwd.o: ../include/openssl/des_old.h ../include/openssl/dh.h
-passwd.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
-passwd.o: ../include/openssl/err.h ../include/openssl/evp.h
-passwd.o: ../include/openssl/lhash.h ../include/openssl/md5.h
-passwd.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-passwd.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-passwd.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
-passwd.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-passwd.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-passwd.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-passwd.o: ../include/openssl/txt_db.h ../include/openssl/ui.h
-passwd.o: ../include/openssl/ui_compat.h ../include/openssl/x509.h
-passwd.o: ../include/openssl/x509_vfy.h apps.h passwd.c
-pkcs12.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-pkcs12.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-pkcs12.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-pkcs12.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-pkcs12.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-pkcs12.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-pkcs12.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-pkcs12.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-pkcs12.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-pkcs12.o: ../include/openssl/pem2.h ../include/openssl/pkcs12.h
-pkcs12.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
-pkcs12.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-pkcs12.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-pkcs12.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-pkcs12.o: ../include/openssl/x509_vfy.h apps.h pkcs12.c
-pkcs7.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-pkcs7.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-pkcs7.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-pkcs7.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-pkcs7.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-pkcs7.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-pkcs7.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-pkcs7.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-pkcs7.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-pkcs7.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-pkcs7.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-pkcs7.o: ../include/openssl/sha.h ../include/openssl/stack.h
-pkcs7.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-pkcs7.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h pkcs7.c
-pkcs8.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-pkcs8.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-pkcs8.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-pkcs8.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-pkcs8.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-pkcs8.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-pkcs8.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-pkcs8.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-pkcs8.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-pkcs8.o: ../include/openssl/pem2.h ../include/openssl/pkcs12.h
-pkcs8.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
-pkcs8.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-pkcs8.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-pkcs8.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-pkcs8.o: ../include/openssl/x509_vfy.h apps.h pkcs8.c
-rand.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-rand.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-rand.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-rand.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-rand.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-rand.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-rand.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-rand.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-rand.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
-rand.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-rand.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-rand.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-rand.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-rand.o: ../include/openssl/x509_vfy.h apps.h rand.c
-req.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-req.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-req.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-req.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-req.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-req.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-req.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-req.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-req.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-req.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-req.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-req.o: ../include/openssl/sha.h ../include/openssl/stack.h
-req.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-req.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-req.o: ../include/openssl/x509v3.h apps.h req.c
-rsa.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-rsa.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-rsa.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-rsa.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-rsa.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-rsa.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-rsa.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-rsa.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-rsa.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-rsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-rsa.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-rsa.o: ../include/openssl/sha.h ../include/openssl/stack.h
-rsa.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-rsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h rsa.c
-rsautl.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-rsautl.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-rsautl.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-rsautl.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-rsautl.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-rsautl.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-rsautl.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-rsautl.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-rsautl.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-rsautl.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-rsautl.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-rsautl.o: ../include/openssl/sha.h ../include/openssl/stack.h
-rsautl.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-rsautl.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
-rsautl.o: rsautl.c
-s_cb.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s_cb.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s_cb.o: ../include/openssl/comp.h ../include/openssl/conf.h
-s_cb.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-s_cb.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
-s_cb.o: ../include/openssl/err.h ../include/openssl/evp.h
-s_cb.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
-s_cb.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-s_cb.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-s_cb.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-s_cb.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s_cb.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-s_cb.o: ../include/openssl/sha.h ../include/openssl/ssl.h
-s_cb.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
-s_cb.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-s_cb.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-s_cb.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-s_cb.o: ../include/openssl/x509_vfy.h apps.h s_apps.h s_cb.c
-s_client.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s_client.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s_client.o: ../include/openssl/comp.h ../include/openssl/conf.h
-s_client.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-s_client.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
-s_client.o: ../include/openssl/err.h ../include/openssl/evp.h
-s_client.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
-s_client.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-s_client.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-s_client.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-s_client.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s_client.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-s_client.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-s_client.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-s_client.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
-s_client.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-s_client.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
-s_client.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
-s_client.o: s_apps.h s_client.c
-s_server.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s_server.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s_server.o: ../include/openssl/comp.h ../include/openssl/conf.h
-s_server.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-s_server.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
-s_server.o: ../include/openssl/err.h ../include/openssl/evp.h
-s_server.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
-s_server.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-s_server.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-s_server.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-s_server.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s_server.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-s_server.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-s_server.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-s_server.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
-s_server.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-s_server.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
-s_server.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
-s_server.o: s_apps.h s_server.c
-s_socket.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s_socket.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s_socket.o: ../include/openssl/comp.h ../include/openssl/conf.h
-s_socket.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-s_socket.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
-s_socket.o: ../include/openssl/evp.h ../include/openssl/kssl.h
-s_socket.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-s_socket.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-s_socket.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-s_socket.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-s_socket.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
-s_socket.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-s_socket.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-s_socket.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
-s_socket.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-s_socket.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
-s_socket.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
-s_socket.o: s_apps.h s_socket.c
-s_time.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s_time.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s_time.o: ../include/openssl/comp.h ../include/openssl/conf.h
-s_time.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-s_time.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
-s_time.o: ../include/openssl/err.h ../include/openssl/evp.h
-s_time.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
-s_time.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-s_time.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-s_time.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-s_time.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s_time.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-s_time.o: ../include/openssl/sha.h ../include/openssl/ssl.h
-s_time.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
-s_time.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-s_time.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-s_time.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-s_time.o: ../include/openssl/x509_vfy.h apps.h s_apps.h s_time.c
-sess_id.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-sess_id.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-sess_id.o: ../include/openssl/comp.h ../include/openssl/conf.h
-sess_id.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-sess_id.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
-sess_id.o: ../include/openssl/err.h ../include/openssl/evp.h
-sess_id.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
-sess_id.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-sess_id.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-sess_id.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-sess_id.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-sess_id.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-sess_id.o: ../include/openssl/sha.h ../include/openssl/ssl.h
-sess_id.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
-sess_id.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-sess_id.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-sess_id.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
-sess_id.o: ../include/openssl/x509_vfy.h apps.h sess_id.c
-smime.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-smime.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-smime.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-smime.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-smime.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-smime.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-smime.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-smime.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-smime.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-smime.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-smime.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-smime.o: ../include/openssl/sha.h ../include/openssl/stack.h
-smime.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-smime.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h smime.c
+app_rand.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+app_rand.o: ../include/openssl/bio.h ../include/openssl/bn.h
+app_rand.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+app_rand.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+app_rand.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+app_rand.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+app_rand.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+app_rand.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+app_rand.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+app_rand.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+app_rand.o: ../include/openssl/rand.h ../include/openssl/rsa.h
+app_rand.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+app_rand.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+app_rand.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+app_rand.o: ../include/openssl/x509_vfy.h app_rand.c apps.h
+apps.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+apps.o: ../include/openssl/bio.h ../include/openssl/bn.h
+apps.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+apps.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+apps.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+apps.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+apps.o: ../include/openssl/engine.h ../include/openssl/err.h
+apps.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+apps.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+apps.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+apps.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+apps.o: ../include/openssl/pem2.h ../include/openssl/pkcs12.h
+apps.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
+apps.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+apps.o: ../include/openssl/sha.h ../include/openssl/stack.h
+apps.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
+apps.o: ../include/openssl/ui.h ../include/openssl/x509.h
+apps.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.c apps.h
+asn1pars.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+asn1pars.o: ../include/openssl/bio.h ../include/openssl/bn.h
+asn1pars.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+asn1pars.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+asn1pars.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+asn1pars.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+asn1pars.o: ../include/openssl/err.h ../include/openssl/evp.h
+asn1pars.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+asn1pars.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+asn1pars.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+asn1pars.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+asn1pars.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+asn1pars.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+asn1pars.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+asn1pars.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+asn1pars.o: ../include/openssl/x509_vfy.h apps.h asn1pars.c
+ca.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+ca.o: ../include/openssl/bio.h ../include/openssl/bn.h
+ca.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+ca.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+ca.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+ca.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+ca.o: ../include/openssl/err.h ../include/openssl/evp.h
+ca.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+ca.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+ca.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+ca.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+ca.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+ca.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+ca.o: ../include/openssl/sha.h ../include/openssl/stack.h
+ca.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
+ca.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+ca.o: ../include/openssl/x509v3.h apps.h ca.c
+ciphers.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+ciphers.o: ../include/openssl/bio.h ../include/openssl/bn.h
+ciphers.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ciphers.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+ciphers.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+ciphers.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+ciphers.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+ciphers.o: ../include/openssl/evp.h ../include/openssl/kssl.h
+ciphers.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+ciphers.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+ciphers.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+ciphers.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+ciphers.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+ciphers.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ciphers.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+ciphers.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
+ciphers.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+ciphers.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
+ciphers.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
+ciphers.o: ciphers.c
+crl.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+crl.o: ../include/openssl/bio.h ../include/openssl/bn.h
+crl.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+crl.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+crl.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+crl.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+crl.o: ../include/openssl/err.h ../include/openssl/evp.h
+crl.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+crl.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+crl.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+crl.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+crl.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+crl.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+crl.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+crl.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+crl.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h crl.c
+crl2p7.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+crl2p7.o: ../include/openssl/bio.h ../include/openssl/bn.h
+crl2p7.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+crl2p7.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+crl2p7.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+crl2p7.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+crl2p7.o: ../include/openssl/err.h ../include/openssl/evp.h
+crl2p7.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+crl2p7.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+crl2p7.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+crl2p7.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+crl2p7.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+crl2p7.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+crl2p7.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+crl2p7.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+crl2p7.o: ../include/openssl/x509_vfy.h apps.h crl2p7.c
+dgst.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+dgst.o: ../include/openssl/bio.h ../include/openssl/bn.h
+dgst.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+dgst.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+dgst.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+dgst.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+dgst.o: ../include/openssl/err.h ../include/openssl/evp.h
+dgst.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+dgst.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+dgst.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+dgst.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+dgst.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+dgst.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+dgst.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+dgst.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+dgst.o: ../include/openssl/x509_vfy.h apps.h dgst.c
+dh.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+dh.o: ../include/openssl/bio.h ../include/openssl/bn.h
+dh.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+dh.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+dh.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+dh.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+dh.o: ../include/openssl/err.h ../include/openssl/evp.h
+dh.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+dh.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+dh.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+dh.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+dh.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+dh.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+dh.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+dh.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+dh.o: ../include/openssl/x509_vfy.h apps.h dh.c
+dsa.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+dsa.o: ../include/openssl/bio.h ../include/openssl/bn.h
+dsa.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+dsa.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+dsa.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+dsa.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+dsa.o: ../include/openssl/err.h ../include/openssl/evp.h
+dsa.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+dsa.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+dsa.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+dsa.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+dsa.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+dsa.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+dsa.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+dsa.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+dsa.o: ../include/openssl/x509_vfy.h apps.h dsa.c
+dsaparam.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+dsaparam.o: ../include/openssl/bio.h ../include/openssl/bn.h
+dsaparam.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+dsaparam.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+dsaparam.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+dsaparam.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+dsaparam.o: ../include/openssl/err.h ../include/openssl/evp.h
+dsaparam.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+dsaparam.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+dsaparam.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+dsaparam.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+dsaparam.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+dsaparam.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+dsaparam.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+dsaparam.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+dsaparam.o: ../include/openssl/x509_vfy.h apps.h dsaparam.c
+ecdsa.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+ecdsa.o: ../include/openssl/bio.h ../include/openssl/bn.h
+ecdsa.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+ecdsa.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+ecdsa.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+ecdsa.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+ecdsa.o: ../include/openssl/err.h ../include/openssl/evp.h
+ecdsa.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+ecdsa.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+ecdsa.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+ecdsa.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+ecdsa.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+ecdsa.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ecdsa.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+ecdsa.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+ecdsa.o: ../include/openssl/x509_vfy.h apps.h ecdsa.c
+ecdsaparam.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+ecdsaparam.o: ../include/openssl/bio.h ../include/openssl/bn.h
+ecdsaparam.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+ecdsaparam.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+ecdsaparam.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+ecdsaparam.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+ecdsaparam.o: ../include/openssl/err.h ../include/openssl/evp.h
+ecdsaparam.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+ecdsaparam.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+ecdsaparam.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+ecdsaparam.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+ecdsaparam.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+ecdsaparam.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ecdsaparam.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+ecdsaparam.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+ecdsaparam.o: ../include/openssl/x509_vfy.h apps.h ecdsaparam.c
+enc.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+enc.o: ../include/openssl/bio.h ../include/openssl/bn.h
+enc.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+enc.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+enc.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+enc.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+enc.o: ../include/openssl/err.h ../include/openssl/evp.h
+enc.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+enc.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+enc.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+enc.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+enc.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
+enc.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+enc.o: ../include/openssl/sha.h ../include/openssl/stack.h
+enc.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
+enc.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h enc.c
+engine.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+engine.o: ../include/openssl/bio.h ../include/openssl/bn.h
+engine.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+engine.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+engine.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+engine.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+engine.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+engine.o: ../include/openssl/err.h ../include/openssl/evp.h
+engine.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
+engine.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+engine.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+engine.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+engine.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+engine.o: ../include/openssl/rand.h ../include/openssl/rsa.h
+engine.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+engine.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+engine.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
+engine.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+engine.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
+engine.o: ../include/openssl/ui.h ../include/openssl/x509.h
+engine.o: ../include/openssl/x509_vfy.h apps.h engine.c
+errstr.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+errstr.o: ../include/openssl/bio.h ../include/openssl/bn.h
+errstr.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+errstr.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+errstr.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+errstr.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+errstr.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+errstr.o: ../include/openssl/evp.h ../include/openssl/kssl.h
+errstr.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+errstr.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+errstr.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+errstr.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+errstr.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+errstr.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+errstr.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+errstr.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
+errstr.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+errstr.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
+errstr.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
+errstr.o: errstr.c
+gendh.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+gendh.o: ../include/openssl/bio.h ../include/openssl/bn.h
+gendh.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+gendh.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+gendh.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+gendh.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+gendh.o: ../include/openssl/err.h ../include/openssl/evp.h
+gendh.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+gendh.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+gendh.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+gendh.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+gendh.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
+gendh.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+gendh.o: ../include/openssl/sha.h ../include/openssl/stack.h
+gendh.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
+gendh.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h gendh.c
+gendsa.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+gendsa.o: ../include/openssl/bio.h ../include/openssl/bn.h
+gendsa.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+gendsa.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+gendsa.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+gendsa.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+gendsa.o: ../include/openssl/err.h ../include/openssl/evp.h
+gendsa.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+gendsa.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+gendsa.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+gendsa.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+gendsa.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+gendsa.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+gendsa.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+gendsa.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+gendsa.o: ../include/openssl/x509_vfy.h apps.h gendsa.c
+genrsa.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+genrsa.o: ../include/openssl/bio.h ../include/openssl/bn.h
+genrsa.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+genrsa.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+genrsa.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+genrsa.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+genrsa.o: ../include/openssl/err.h ../include/openssl/evp.h
+genrsa.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+genrsa.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+genrsa.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+genrsa.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+genrsa.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
+genrsa.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+genrsa.o: ../include/openssl/sha.h ../include/openssl/stack.h
+genrsa.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
+genrsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
+genrsa.o: genrsa.c
+nseq.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+nseq.o: ../include/openssl/bio.h ../include/openssl/bn.h
+nseq.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+nseq.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+nseq.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+nseq.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+nseq.o: ../include/openssl/err.h ../include/openssl/evp.h
+nseq.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+nseq.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+nseq.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+nseq.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+nseq.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+nseq.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+nseq.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+nseq.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+nseq.o: ../include/openssl/x509_vfy.h apps.h nseq.c
+ocsp.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+ocsp.o: ../include/openssl/bio.h ../include/openssl/bn.h
+ocsp.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ocsp.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+ocsp.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+ocsp.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+ocsp.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+ocsp.o: ../include/openssl/evp.h ../include/openssl/kssl.h
+ocsp.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+ocsp.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+ocsp.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+ocsp.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+ocsp.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+ocsp.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+ocsp.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+ocsp.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
+ocsp.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+ocsp.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+ocsp.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+ocsp.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h ocsp.c
+openssl.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+openssl.o: ../include/openssl/bio.h ../include/openssl/bn.h
+openssl.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+openssl.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+openssl.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+openssl.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+openssl.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+openssl.o: ../include/openssl/err.h ../include/openssl/evp.h
+openssl.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
+openssl.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+openssl.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+openssl.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+openssl.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+openssl.o: ../include/openssl/rand.h ../include/openssl/rsa.h
+openssl.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+openssl.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+openssl.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
+openssl.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+openssl.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
+openssl.o: ../include/openssl/ui.h ../include/openssl/x509.h
+openssl.o: ../include/openssl/x509_vfy.h apps.h openssl.c progs.h s_apps.h
+passwd.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+passwd.o: ../include/openssl/bio.h ../include/openssl/bn.h
+passwd.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+passwd.o: ../include/openssl/crypto.h ../include/openssl/des_old.h
+passwd.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+passwd.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+passwd.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+passwd.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+passwd.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h
+passwd.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+passwd.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+passwd.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
+passwd.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+passwd.o: ../include/openssl/sha.h ../include/openssl/stack.h
+passwd.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
+passwd.o: ../include/openssl/ui.h ../include/openssl/ui_compat.h
+passwd.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
+passwd.o: passwd.c
+pkcs12.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+pkcs12.o: ../include/openssl/bio.h ../include/openssl/bn.h
+pkcs12.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+pkcs12.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+pkcs12.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+pkcs12.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+pkcs12.o: ../include/openssl/err.h ../include/openssl/evp.h
+pkcs12.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+pkcs12.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+pkcs12.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+pkcs12.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+pkcs12.o: ../include/openssl/pkcs12.h ../include/openssl/pkcs7.h
+pkcs12.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+pkcs12.o: ../include/openssl/sha.h ../include/openssl/stack.h
+pkcs12.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
+pkcs12.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
+pkcs12.o: pkcs12.c
+pkcs7.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+pkcs7.o: ../include/openssl/bio.h ../include/openssl/bn.h
+pkcs7.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+pkcs7.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+pkcs7.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+pkcs7.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+pkcs7.o: ../include/openssl/err.h ../include/openssl/evp.h
+pkcs7.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+pkcs7.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+pkcs7.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+pkcs7.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+pkcs7.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+pkcs7.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+pkcs7.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+pkcs7.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+pkcs7.o: ../include/openssl/x509_vfy.h apps.h pkcs7.c
+pkcs8.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+pkcs8.o: ../include/openssl/bio.h ../include/openssl/bn.h
+pkcs8.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+pkcs8.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+pkcs8.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+pkcs8.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+pkcs8.o: ../include/openssl/err.h ../include/openssl/evp.h
+pkcs8.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+pkcs8.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+pkcs8.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+pkcs8.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+pkcs8.o: ../include/openssl/pkcs12.h ../include/openssl/pkcs7.h
+pkcs8.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+pkcs8.o: ../include/openssl/sha.h ../include/openssl/stack.h
+pkcs8.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
+pkcs8.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h pkcs8.c
+rand.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+rand.o: ../include/openssl/bio.h ../include/openssl/bn.h
+rand.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+rand.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+rand.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+rand.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+rand.o: ../include/openssl/err.h ../include/openssl/evp.h
+rand.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+rand.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+rand.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+rand.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
+rand.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+rand.o: ../include/openssl/sha.h ../include/openssl/stack.h
+rand.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
+rand.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h rand.c
+req.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+req.o: ../include/openssl/bio.h ../include/openssl/bn.h
+req.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+req.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+req.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+req.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+req.o: ../include/openssl/err.h ../include/openssl/evp.h
+req.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+req.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+req.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+req.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+req.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+req.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+req.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+req.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+req.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h req.c
+rsa.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+rsa.o: ../include/openssl/bio.h ../include/openssl/bn.h
+rsa.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+rsa.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+rsa.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+rsa.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+rsa.o: ../include/openssl/err.h ../include/openssl/evp.h
+rsa.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+rsa.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+rsa.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+rsa.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+rsa.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+rsa.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+rsa.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+rsa.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+rsa.o: ../include/openssl/x509_vfy.h apps.h rsa.c
+rsautl.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+rsautl.o: ../include/openssl/bio.h ../include/openssl/bn.h
+rsautl.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+rsautl.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+rsautl.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+rsautl.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+rsautl.o: ../include/openssl/err.h ../include/openssl/evp.h
+rsautl.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+rsautl.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+rsautl.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+rsautl.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+rsautl.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+rsautl.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+rsautl.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+rsautl.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+rsautl.o: ../include/openssl/x509_vfy.h apps.h rsautl.c
+s_cb.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+s_cb.o: ../include/openssl/bio.h ../include/openssl/bn.h
+s_cb.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s_cb.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+s_cb.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+s_cb.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+s_cb.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s_cb.o: ../include/openssl/evp.h ../include/openssl/kssl.h
+s_cb.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+s_cb.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+s_cb.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+s_cb.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+s_cb.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+s_cb.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s_cb.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+s_cb.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
+s_cb.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+s_cb.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
+s_cb.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h s_apps.h
+s_cb.o: s_cb.c
+s_client.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+s_client.o: ../include/openssl/bio.h ../include/openssl/bn.h
+s_client.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s_client.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+s_client.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+s_client.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+s_client.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s_client.o: ../include/openssl/evp.h ../include/openssl/kssl.h
+s_client.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+s_client.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+s_client.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+s_client.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+s_client.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
+s_client.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+s_client.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+s_client.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
+s_client.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+s_client.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+s_client.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+s_client.o: ../include/openssl/x509_vfy.h apps.h s_apps.h s_client.c
+s_server.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+s_server.o: ../include/openssl/bio.h ../include/openssl/bn.h
+s_server.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s_server.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+s_server.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+s_server.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+s_server.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s_server.o: ../include/openssl/evp.h ../include/openssl/kssl.h
+s_server.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+s_server.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+s_server.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+s_server.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+s_server.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
+s_server.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+s_server.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+s_server.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
+s_server.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+s_server.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+s_server.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+s_server.o: ../include/openssl/x509_vfy.h apps.h s_apps.h s_server.c
+s_socket.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+s_socket.o: ../include/openssl/bio.h ../include/openssl/bn.h
+s_socket.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s_socket.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+s_socket.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+s_socket.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+s_socket.o: ../include/openssl/ecdsa.h ../include/openssl/evp.h
+s_socket.o: ../include/openssl/kssl.h ../include/openssl/lhash.h
+s_socket.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+s_socket.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+s_socket.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+s_socket.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+s_socket.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+s_socket.o: ../include/openssl/sha.h ../include/openssl/ssl.h
+s_socket.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
+s_socket.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+s_socket.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+s_socket.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+s_socket.o: ../include/openssl/x509_vfy.h apps.h s_apps.h s_socket.c
+s_time.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+s_time.o: ../include/openssl/bio.h ../include/openssl/bn.h
+s_time.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s_time.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+s_time.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+s_time.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+s_time.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s_time.o: ../include/openssl/evp.h ../include/openssl/kssl.h
+s_time.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+s_time.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+s_time.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+s_time.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+s_time.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+s_time.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s_time.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+s_time.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
+s_time.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+s_time.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
+s_time.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
+s_time.o: s_apps.h s_time.c
+sess_id.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+sess_id.o: ../include/openssl/bio.h ../include/openssl/bn.h
+sess_id.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+sess_id.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+sess_id.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+sess_id.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+sess_id.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+sess_id.o: ../include/openssl/evp.h ../include/openssl/kssl.h
+sess_id.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+sess_id.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+sess_id.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+sess_id.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+sess_id.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+sess_id.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+sess_id.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+sess_id.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
+sess_id.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+sess_id.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
+sess_id.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
+sess_id.o: sess_id.c
+smime.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+smime.o: ../include/openssl/bio.h ../include/openssl/bn.h
+smime.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+smime.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+smime.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+smime.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+smime.o: ../include/openssl/err.h ../include/openssl/evp.h
+smime.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+smime.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+smime.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+smime.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+smime.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+smime.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+smime.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+smime.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+smime.o: ../include/openssl/x509_vfy.h apps.h smime.c
 speed.o: ../e_os.h ../include/openssl/aes.h ../include/openssl/asn1.h
-speed.o: ../include/openssl/bio.h ../include/openssl/blowfish.h
-speed.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-speed.o: ../include/openssl/cast.h ../include/openssl/conf.h
-speed.o: ../include/openssl/crypto.h ../include/openssl/des.h
-speed.o: ../include/openssl/des_old.h ../include/openssl/dh.h
-speed.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
-speed.o: ../include/openssl/err.h ../include/openssl/evp.h
-speed.o: ../include/openssl/hmac.h ../include/openssl/idea.h
-speed.o: ../include/openssl/lhash.h ../include/openssl/md2.h
-speed.o: ../include/openssl/md4.h ../include/openssl/md5.h
-speed.o: ../include/openssl/mdc2.h ../include/openssl/obj_mac.h
-speed.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-speed.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-speed.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
-speed.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
-speed.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
-speed.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-speed.o: ../include/openssl/sha.h ../include/openssl/stack.h
-speed.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-speed.o: ../include/openssl/ui.h ../include/openssl/ui_compat.h
-speed.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h speed.c
-speed.o: testdsa.h testrsa.h
-spkac.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-spkac.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-spkac.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-spkac.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-spkac.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-spkac.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-spkac.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-spkac.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-spkac.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-spkac.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-spkac.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-spkac.o: ../include/openssl/sha.h ../include/openssl/stack.h
-spkac.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-spkac.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h spkac.c
-verify.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-verify.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-verify.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-verify.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-verify.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-verify.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-verify.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-verify.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-verify.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-verify.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-verify.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-verify.o: ../include/openssl/sha.h ../include/openssl/stack.h
-verify.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-verify.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-verify.o: ../include/openssl/x509v3.h apps.h verify.c
-version.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-version.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
-version.o: ../include/openssl/buffer.h ../include/openssl/conf.h
-version.o: ../include/openssl/crypto.h ../include/openssl/des_old.h
-version.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-version.o: ../include/openssl/e_os2.h ../include/openssl/evp.h
-version.o: ../include/openssl/idea.h ../include/openssl/lhash.h
-version.o: ../include/openssl/md2.h ../include/openssl/obj_mac.h
-version.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-version.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-version.o: ../include/openssl/pkcs7.h ../include/openssl/rc4.h
-version.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-version.o: ../include/openssl/sha.h ../include/openssl/stack.h
-version.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-version.o: ../include/openssl/ui.h ../include/openssl/ui_compat.h
-version.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
-version.o: version.c
-x509.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-x509.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-x509.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-x509.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-x509.o: ../include/openssl/e_os2.h ../include/openssl/err.h
-x509.o: ../include/openssl/evp.h ../include/openssl/lhash.h
-x509.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-x509.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-x509.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-x509.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-x509.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-x509.o: ../include/openssl/sha.h ../include/openssl/stack.h
-x509.o: ../include/openssl/symhacks.h ../include/openssl/txt_db.h
-x509.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-x509.o: ../include/openssl/x509v3.h apps.h x509.c
+speed.o: ../include/openssl/asn1t.h ../include/openssl/bio.h
+speed.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
+speed.o: ../include/openssl/buffer.h ../include/openssl/cast.h
+speed.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+speed.o: ../include/openssl/des.h ../include/openssl/des_old.h
+speed.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+speed.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+speed.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+speed.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+speed.o: ../include/openssl/idea.h ../include/openssl/lhash.h
+speed.o: ../include/openssl/md2.h ../include/openssl/md4.h
+speed.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
+speed.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+speed.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+speed.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+speed.o: ../include/openssl/rand.h ../include/openssl/rc2.h
+speed.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
+speed.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
+speed.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+speed.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+speed.o: ../include/openssl/txt_db.h ../include/openssl/ui.h
+speed.o: ../include/openssl/ui_compat.h ../include/openssl/x509.h
+speed.o: ../include/openssl/x509_vfy.h apps.h speed.c testdsa.h testrsa.h
+spkac.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+spkac.o: ../include/openssl/bio.h ../include/openssl/bn.h
+spkac.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+spkac.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+spkac.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+spkac.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+spkac.o: ../include/openssl/err.h ../include/openssl/evp.h
+spkac.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+spkac.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+spkac.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+spkac.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+spkac.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+spkac.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+spkac.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+spkac.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+spkac.o: ../include/openssl/x509_vfy.h apps.h spkac.c
+verify.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+verify.o: ../include/openssl/bio.h ../include/openssl/bn.h
+verify.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+verify.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+verify.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+verify.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+verify.o: ../include/openssl/err.h ../include/openssl/evp.h
+verify.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+verify.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+verify.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+verify.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+verify.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+verify.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+verify.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+verify.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+verify.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
+verify.o: verify.c
+version.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+version.o: ../include/openssl/bio.h ../include/openssl/blowfish.h
+version.o: ../include/openssl/bn.h ../include/openssl/buffer.h
+version.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+version.o: ../include/openssl/des_old.h ../include/openssl/dh.h
+version.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+version.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+version.o: ../include/openssl/evp.h ../include/openssl/idea.h
+version.o: ../include/openssl/lhash.h ../include/openssl/md2.h
+version.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+version.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+version.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+version.o: ../include/openssl/rc4.h ../include/openssl/rsa.h
+version.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+version.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+version.o: ../include/openssl/txt_db.h ../include/openssl/ui.h
+version.o: ../include/openssl/ui_compat.h ../include/openssl/x509.h
+version.o: ../include/openssl/x509_vfy.h apps.h version.c
+x509.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
+x509.o: ../include/openssl/bio.h ../include/openssl/bn.h
+x509.o: ../include/openssl/buffer.h ../include/openssl/conf.h
+x509.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+x509.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
+x509.o: ../include/openssl/ec.h ../include/openssl/ecdsa.h
+x509.o: ../include/openssl/err.h ../include/openssl/evp.h
+x509.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+x509.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+x509.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+x509.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+x509.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
+x509.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+x509.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+x509.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+x509.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h x509.c
index 7a168aa..04246bb 100644 (file)
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -1501,6 +1501,11 @@ bad:
                        if (pkey->type == EVP_PKEY_DSA) 
                                dgst=EVP_dss1();
                        else
+#endif
+#ifndef OPENSSL_NO_ECDSA
+                       if (pkey->type == EVP_PKEY_ECDSA)
+                               dgst=EVP_ecdsa();
+                       else
 #endif
                                dgst=EVP_md5();
                        }
@@ -2270,6 +2275,16 @@ again2:
                EVP_PKEY_copy_parameters(pktmp,pkey);
        EVP_PKEY_free(pktmp);
 #endif
+#ifndef OPENSSL_NO_ECDSA
+       if (pkey->type == EVP_PKEY_ECDSA)
+               dgst = EVP_ecdsa();
+       pktmp = X509_get_pubkey(ret);
+       if (EVP_PKEY_missing_parameters(pktmp) &&
+               !EVP_PKEY_missing_parameters(pkey))
+               EVP_PKEY_copy_parameters(pktmp, pkey);
+       EVP_PKEY_free(pktmp);
+#endif
+
 
        if (!X509_sign(ret,pkey,dgst))
                goto err;
diff --git a/apps/ecdsa.c b/apps/ecdsa.c
new file mode 100644 (file)
index 0000000..e8aa746
--- /dev/null
@@ -0,0 +1,435 @@
+/* apps/ecdsa.c */
+/* ====================================================================
+ * Copyright (c) 1998-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
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ * 
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ * 
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from 
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ * 
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * 
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef OPENSSL_NO_ECDSA
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include "apps.h"
+#include <openssl/bio.h>
+#include <openssl/err.h>
+#include <openssl/ecdsa.h>
+#include <openssl/evp.h>
+#include <openssl/x509.h>
+#include <openssl/pem.h>
+
+#undef PROG
+#define PROG   ecdsa_main
+
+/* -inform arg - input format - default PEM (one of DER, NET or PEM)
+ * -outform arg - output format - default PEM
+ * -in arg     - input file - default stdin
+ * -out arg    - output file - default stdout
+ * -des                - encrypt output if PEM format with DES in cbc mode
+ * -des3       - encrypt output if PEM format
+ * -idea       - encrypt output if PEM format
+ * -text       - print a text version
+ * -pub                - print the ECDSA public key
+ * -compressed  - print the public key in compressed form ( default )   
+ * -hybrid     - print the public key in hybrid form
+ * -uncompressed - print the public key in uncompressed form
+ *               the last three options ( compressed, hybrid and uncompressed )
+ *               are only used if the "-pub" option is also selected.
+ *               For a precise description of the the meaning of compressed,
+ *               hybrid and uncompressed please refer to the X9.62 standart.
+ *               All three forms represents ways to express the ecdsa public
+ *               key ( a point on a elliptic curve ) as octet string. Let len be
+ *               the length ( in bytes ) of an element of the field over which
+ *               the curve is defined, then a compressed octet string has the form
+ *               0x02 + result of BN_bn2bin() of the x coordinate of the public key
+ */
+
+int MAIN(int, char **);
+
+int MAIN(int argc, char **argv)
+{
+       ENGINE  *e = NULL;
+       int     ret = 1;
+       ECDSA   *ecdsa = NULL;
+       int     i, badops = 0;
+       const EVP_CIPHER *enc = NULL;
+       BIO     *in = NULL, *out = NULL;
+       int     informat, outformat, text=0, noout=0;
+       int     pubin = 0, pubout = 0;
+       char    *infile, *outfile, *prog, *engine;
+       char    *passargin = NULL, *passargout = NULL;
+       char    *passin = NULL, *passout = NULL;
+       int     pub = 0, point_form = 0;
+       unsigned char *buffer = NULL;
+       unsigned int  buf_len = 0;
+       BIGNUM  *tmp_bn = NULL;
+
+       apps_startup();
+
+       if (bio_err == NULL)
+               if ((bio_err=BIO_new(BIO_s_file())) != NULL)
+                       BIO_set_fp(bio_err, stderr, BIO_NOCLOSE|BIO_FP_TEXT);
+
+       engine = NULL;
+       infile = NULL;
+       outfile = NULL;
+       informat = FORMAT_PEM;
+       outformat = FORMAT_PEM;
+
+       prog = argv[0];
+       argc--;
+       argv++;
+       while (argc >= 1)
+       {
+               if (strcmp(*argv,"-inform") == 0)
+               {
+                       if (--argc < 1) goto bad;
+                       informat=str2fmt(*(++argv));
+               }
+               else if (strcmp(*argv,"-outform") == 0)
+               {
+                       if (--argc < 1) goto bad;
+                       outformat=str2fmt(*(++argv));
+               }
+               else if (strcmp(*argv,"-in") == 0)
+               {
+                       if (--argc < 1) goto bad;
+                       infile= *(++argv);
+               }
+               else if (strcmp(*argv,"-out") == 0)
+               {
+                       if (--argc < 1) goto bad;
+                       outfile= *(++argv);
+               }
+               else if (strcmp(*argv,"-passin") == 0)
+               {
+                       if (--argc < 1) goto bad;
+                       passargin= *(++argv);
+               }
+               else if (strcmp(*argv,"-passout") == 0)
+               {
+                       if (--argc < 1) goto bad;
+                       passargout= *(++argv);
+               }
+               else if (strcmp(*argv, "-engine") == 0)
+               {
+                       if (--argc < 1) goto bad;
+                       engine= *(++argv);
+               }
+               else if (strcmp(*argv, "-noout") == 0)
+                       noout = 1;
+               else if (strcmp(*argv, "-text") == 0)
+                       text = 1;
+               else if (strcmp(*argv, "-pub") == 0)
+               {
+                       pub = 1;
+                       buffer = (*(argv+1));
+                       if (strcmp(buffer, "compressed") == 0)
+                               point_form = POINT_CONVERSION_COMPRESSED;
+                       else if (strcmp(buffer, "hybrid") == 0)
+                               point_form = POINT_CONVERSION_HYBRID;
+                       else if (strcmp(buffer, "uncompressed") == 0)
+                               point_form = POINT_CONVERSION_UNCOMPRESSED;
+                       if (point_form)
+                       {
+                               argc--;
+                               argv++;
+                       }
+               }
+               else if (strcmp(*argv, "-pubin") == 0)
+                       pubin=1;
+               else if (strcmp(*argv, "-pubout") == 0)
+                       pubout=1;
+               else if ((enc=EVP_get_cipherbyname(&(argv[0][1]))) == NULL)
+               {
+                       BIO_printf(bio_err,"unknown option %s\n",*argv);
+                       badops=1;
+                       break;
+               }
+               argc--;
+               argv++;
+       }
+
+       if (badops)
+       {
+bad:
+               BIO_printf(bio_err, "%s [options] <infile >outfile\n",prog);
+               BIO_printf(bio_err, "where options are\n");
+               BIO_printf(bio_err, " -inform arg     input format - DER or PEM\n");
+               BIO_printf(bio_err, " -outform arg    output format - DER or PEM\n");
+               BIO_printf(bio_err, " -in arg         input file\n");
+               BIO_printf(bio_err, " -passin arg     input file pass phrase source\n");
+               BIO_printf(bio_err, " -out arg        output file\n");
+               BIO_printf(bio_err, " -passout arg    output file pass phrase source\n");
+               BIO_printf(bio_err, " -engine e       use engine e, possibly a hardware device.\n");
+               BIO_printf(bio_err, " -des            encrypt PEM output with cbc des\n");
+               BIO_printf(bio_err, " -des3           encrypt PEM output with ede cbc des using 168 bit key\n");
+#ifndef OPENSSL_NO_IDEA
+               BIO_printf(bio_err, " -idea           encrypt PEM output with cbc idea\n");
+#endif
+               BIO_printf(bio_err, " -text           print the key in text\n");
+               BIO_printf(bio_err, " -noout          don't print key out\n");
+               BIO_printf(bio_err, " -pub [compressed | hybrid | uncompressed] \n");
+               BIO_printf(bio_err, "         compressed     print the public key in compressed form ( default )\n");   
+               BIO_printf(bio_err, "         hybrid         print the public key in hybrid form\n");
+               BIO_printf(bio_err, "         uncompressed   print the public key in uncompressed form\n");
+               goto end;
+       }
+
+       ERR_load_crypto_strings();
+
+        e = setup_engine(bio_err, engine, 0);
+
+       if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) 
+       {
+               BIO_printf(bio_err, "Error getting passwords\n");
+               goto end;
+       }
+
+       in = BIO_new(BIO_s_file());
+       out = BIO_new(BIO_s_file());
+       if ((in == NULL) || (out == NULL))
+       {
+               ERR_print_errors(bio_err);
+               goto end;
+       }
+
+       if (infile == NULL)
+               BIO_set_fp(in,stdin,BIO_NOCLOSE);
+       else
+       {
+               if (BIO_read_filename(in,infile) <= 0)
+               {
+                       perror(infile);
+                       goto end;
+               }
+       }
+
+       BIO_printf(bio_err,"read ECDSA key\n");
+       if (informat == FORMAT_ASN1) 
+       {
+               if (pubin) 
+                       ecdsa = d2i_ECDSA_PUBKEY_bio(in, NULL);
+               else 
+                       ecdsa = d2i_ECDSAPrivateKey_bio(in, NULL);
+       } else if (informat == FORMAT_PEM) 
+       {
+               if (pubin) 
+                       ecdsa = PEM_read_bio_ECDSA_PUBKEY(in, NULL, NULL, NULL);
+               else 
+                       ecdsa = PEM_read_bio_ECDSAPrivateKey(in, NULL, NULL, passin);
+       } else
+       {
+               BIO_printf(bio_err, "bad input format specified for key\n");
+               goto end;
+       }
+       if (ecdsa == NULL)
+       {
+               BIO_printf(bio_err,"unable to load Key\n");
+               ERR_print_errors(bio_err);
+               goto end;
+       }
+
+       if (outfile == NULL)
+       {
+               BIO_set_fp(out, stdout, BIO_NOCLOSE);
+#ifdef OPENSSL_SYS_VMS
+               {
+                       BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+                       out = BIO_push(tmpbio, out);
+               }
+#endif
+       }
+       else
+       {
+               if (BIO_write_filename(out, outfile) <= 0)
+               {
+                       perror(outfile);
+                       goto end;
+               }
+       }
+
+       if (text) 
+               if (!ECDSA_print(out, ecdsa, 0))
+               {
+                       perror(outfile);
+                       ERR_print_errors(bio_err);
+                       goto end;
+               }
+
+       if (pub)
+       {
+               fprintf(stdout, "Public Key (");
+               if (point_form == POINT_CONVERSION_COMPRESSED)
+                       fprintf(stdout, "COMPRESSED");
+               else if (point_form == POINT_CONVERSION_UNCOMPRESSED)
+                       fprintf(stdout, "UNCOMPRESSED");
+               else if (point_form == POINT_CONVERSION_HYBRID)
+                       fprintf(stdout, "HYBRID");
+               fprintf(stdout, ")=");
+               buf_len = EC_POINT_point2oct(ecdsa->group, EC_GROUP_get0_generator(ecdsa->group),
+                                            point_form, NULL, 0, NULL);
+               if (!buf_len)
+               {
+                       BIO_printf(bio_err,"invalid public key length\n");
+                       ERR_print_errors(bio_err);
+                       goto end;
+               }
+               if ((tmp_bn = BN_new()) == NULL ||
+                   (buffer = OPENSSL_malloc(buf_len)) == NULL) goto end;
+               if (!EC_POINT_point2oct(ecdsa->group, EC_GROUP_get0_generator(ecdsa->group),
+                                            point_form, buffer, buf_len, NULL) ||
+                   !BN_bin2bn(buffer, buf_len, tmp_bn))
+               {
+                       BIO_printf(bio_err,"can not encode public key\n");
+                       ERR_print_errors(bio_err);
+                       OPENSSL_free(buffer);
+                       goto end;
+               }
+               BN_print(out, tmp_bn);
+               fprintf(stdout,"\n");
+       }
+
+       if (noout) 
+               goto end;
+       BIO_printf(bio_err, "writing ECDSA key\n");
+       if (outformat == FORMAT_ASN1) 
+       {
+               if(pubin || pubout) 
+                       i = i2d_ECDSA_PUBKEY_bio(out, ecdsa);
+               else 
+                       i = i2d_ECDSAPrivateKey_bio(out, ecdsa);
+       } else if (outformat == FORMAT_PEM) 
+       {
+               if(pubin || pubout)
+                       i = PEM_write_bio_ECDSA_PUBKEY(out, ecdsa);
+               else 
+                       i = PEM_write_bio_ECDSAPrivateKey(out, ecdsa, enc,
+                                                       NULL, 0, NULL, passout);
+       } else 
+       {
+               BIO_printf(bio_err, "bad output format specified for outfile\n");
+               goto end;
+       }
+       if (!i)
+       {
+               BIO_printf(bio_err, "unable to write private key\n");
+               ERR_print_errors(bio_err);
+       }
+       else
+               ret=0;
+end:
+       if (in)         BIO_free(in);
+       if (out)        BIO_free_all(out);
+       if (ecdsa)      ECDSA_free(ecdsa);
+       if (tmp_bn)     BN_free(tmp_bn);
+       if (passin)     OPENSSL_free(passin);
+       if (passout)    OPENSSL_free(passout);
+       apps_shutdown();
+       EXIT(ret);
+}
+#endif
diff --git a/apps/ecdsaparam.c b/apps/ecdsaparam.c
new file mode 100644 (file)
index 0000000..ebb0d1e
--- /dev/null
@@ -0,0 +1,560 @@
+/* apps/ecdsaparam.c */
+/* ====================================================================
+ * Copyright (c) 1998-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
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ * 
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ * 
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from 
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ * 
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * 
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
+#ifndef OPENSSL_NO_ECDSA
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include "apps.h"
+#include <openssl/bio.h>
+#include <openssl/err.h>
+#include <openssl/bn.h>
+#include <openssl/ec.h>
+#include <openssl/ecdsa.h>
+#include <openssl/x509.h>
+#include <openssl/pem.h>
+
+#undef PROG
+#define PROG   ecdsaparam_main
+
+/* -inform arg         - input format - default PEM (DER or PEM)
+ * -outform arg        - output format - default PEM
+ * -in arg             - input file  - default stdin
+ * -out arg            - output file - default stdout
+ * -noout
+ * -text
+ * -C
+ * -noout
+ * -genkey             - generate a private public keypair based on the supplied curve
+ * -named_curve                - use the curve oid instead of the parameters
+ * -NIST_192           - use the NIST recommeded curve parameters over a 192 bit prime field
+ * -NIST_224           - use the NIST recommeded curve parameters over a 224 bit prime field
+ * -NIST_256           - use the NIST recommeded curve parameters over a 256 bit prime field
+ * -NIST_384           - use the NIST recommeded curve parameters over a 384 bit prime field
+ * -NIST_521           - use the NIST recommeded curve parameters over a 521 bit prime field
+ * -X9_62_192v1                - use the X9_62 192v1 example curve over a 192 bit prime field
+ * -X9_62_192v2                - use the X9_62 192v2 example curve over a 192 bit prime field
+ * -X9_62_192v3                - use the X9_62 192v3 example curve over a 192 bit prime field
+ * -X9_62_239v1                - use the X9_62 239v1 example curve over a 239 bit prime field
+ * -X9_62_239v2                - use the X9_62 239v2 example curve over a 239 bit prime field
+ * -X9_62_239v3                - use the X9_62 239v3 example curve over a 239 bit prime field
+ * -X9_62_256v1                - use the X9_62 239v1 example curve over a 256 bit prime field
+ */
+
+int MAIN(int, char **);
+
+int MAIN(int argc, char **argv)
+{
+       ENGINE  *e = NULL;
+       ECDSA   *ecdsa = NULL;
+       int     i, badops = 0, text = 0;
+       BIO     *in = NULL, *out = NULL;
+       int     informat, outformat, noout = 0, C = 0, ret = 1;
+       char    *infile, *outfile, *prog, *inrand = NULL;
+       int     genkey = 0;
+       int     need_rand = 0;
+       char    *engine=NULL;
+       int     curve_type = EC_GROUP_NO_CURVE;
+       int     named_curve = 0;
+       BIGNUM  *tmp_1 = NULL, *tmp_2 = NULL, *tmp_3 = NULL, *tmp_4 = NULL, *tmp_5 = NULL,
+               *tmp_6 = NULL, *tmp_7 = NULL;
+       BN_CTX  *ctx = NULL;
+       EC_POINT *point = NULL;
+
+       apps_startup();
+
+       if (bio_err == NULL)
+               if ((bio_err=BIO_new(BIO_s_file())) != NULL)
+                       BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
+
+       infile=NULL;
+       outfile=NULL;
+       informat=FORMAT_PEM;
+       outformat=FORMAT_PEM;
+
+       prog=argv[0];
+       argc--;
+       argv++;
+       while (argc >= 1)
+               {
+               if      (strcmp(*argv,"-inform") == 0)
+               {
+                       if (--argc < 1) goto bad;
+                       informat=str2fmt(*(++argv));
+               }
+               else if (strcmp(*argv,"-outform") == 0)
+               {
+                       if (--argc < 1) goto bad;
+                       outformat=str2fmt(*(++argv));
+               }
+               else if (strcmp(*argv,"-in") == 0)
+               {
+                       if (--argc < 1) goto bad;
+                       infile= *(++argv);
+               }
+               else if (strcmp(*argv,"-out") == 0)
+               {
+                       if (--argc < 1) goto bad;
+                       outfile= *(++argv);
+               }
+               else if(strcmp(*argv, "-engine") == 0)
+               {
+                       if (--argc < 1) goto bad;
+                       engine = *(++argv);
+               }
+               else if (strcmp(*argv,"-text") == 0)
+                       text = 1;
+               else if (strcmp(*argv,"-C") == 0)
+                       C = 1;
+               else if (strcmp(*argv,"-genkey") == 0)
+               {
+                       genkey = 1;
+                       need_rand = 1;
+               }
+               else if (strcmp(*argv,"-rand") == 0)
+               {
+                       if (--argc < 1) goto bad;
+                       inrand= *(++argv);
+                       need_rand=1;
+               }
+               else if (strcmp(*argv, "-named_curve") == 0)
+                       named_curve = 1;
+               else if (strcmp(*argv, "-NIST_192") == 0)
+                       curve_type = EC_GROUP_NIST_PRIME_192;
+               else if (strcmp(*argv, "-NIST_224") == 0)
+                       curve_type = EC_GROUP_NIST_PRIME_224;
+               else if (strcmp(*argv, "-NIST_256") == 0)
+                       curve_type = EC_GROUP_NIST_PRIME_256;
+               else if (strcmp(*argv, "-NIST_384") == 0)
+                       curve_type = EC_GROUP_NIST_PRIME_384;
+               else if (strcmp(*argv, "-NIST_521") == 0)
+                       curve_type = EC_GROUP_NIST_PRIME_521;
+               else if (strcmp(*argv, "-X9_62_192v1") == 0)
+                       curve_type = EC_GROUP_X9_62_PRIME_192V1;
+               else if (strcmp(*argv, "-X9_62_192v2") == 0)
+                       curve_type = EC_GROUP_X9_62_PRIME_192V2;
+               else if (strcmp(*argv, "-X9_62_192v3") == 0)
+                       curve_type = EC_GROUP_X9_62_PRIME_192V3;
+               else if (strcmp(*argv, "-X9_62_239v1") == 0)
+                       curve_type = EC_GROUP_X9_62_PRIME_239V1;
+               else if (strcmp(*argv, "-X9_62_239v2") == 0)
+                       curve_type = EC_GROUP_X9_62_PRIME_239V2;
+               else if (strcmp(*argv, "-X9_62_239v3") == 0)
+                       curve_type = EC_GROUP_X9_62_PRIME_239V3;
+               else if (strcmp(*argv, "-X9_62_256v1") == 0)
+                       curve_type = EC_GROUP_X9_62_PRIME_256V1;
+               else if (strcmp(*argv, "-noout") == 0)
+                       noout=1;
+               else
+               {
+                       BIO_printf(bio_err,"unknown option %s\n",*argv);
+                       badops=1;
+                       break;
+               }
+               argc--;
+               argv++;
+       }
+
+       if (badops)
+       {
+bad:
+               BIO_printf(bio_err,"%s [options] [bits] <infile >outfile\n",prog);
+               BIO_printf(bio_err,"where options are\n");
+               BIO_printf(bio_err," -inform arg   input format - DER or PEM\n");
+               BIO_printf(bio_err," -outform arg  output format - DER or PEM\n");
+               BIO_printf(bio_err," -in arg       input file\n");
+               BIO_printf(bio_err," -out arg      output file\n");
+               BIO_printf(bio_err," -text         print the key in text\n");
+               BIO_printf(bio_err," -C            Output C code\n");
+               BIO_printf(bio_err," -noout        no output\n");
+               BIO_printf(bio_err," -rand         files to use for random number input\n");
+               BIO_printf(bio_err," -engine e     use engine e, possibly a hardware device.\n");
+               BIO_printf(bio_err," -named_curve  use the curve oid instead of the parameters\n");
+               BIO_printf(bio_err," -NIST_192     use the NIST recommeded curve parameters over a 192 bit prime field\n");
+               BIO_printf(bio_err," -NIST_224     use the NIST recommeded curve parameters over a 224 bit prime field\n");
+               BIO_printf(bio_err," -NIST_256     use the NIST recommeded curve parameters over a 256 bit prime field\n");
+               BIO_printf(bio_err," -NIST_384     use the NIST recommeded curve parameters over a 384 bit prime field\n");
+               BIO_printf(bio_err," -NIST_521     use the NIST recommeded curve parameters over a 521 bit prime field\n");
+               BIO_printf(bio_err," -X9_62_192v1  use the X9_62 192v1 example curve over a 192 bit prime field\n");
+               BIO_printf(bio_err," -X9_62_192v2  use the X9_62 192v2 example curve over a 192 bit prime field\n");
+               BIO_printf(bio_err," -X9_62_192v3  use the X9_62 192v3 example curve over a 192 bit prime field\n");
+               BIO_printf(bio_err," -X9_62_239v1  use the X9_62 239v1 example curve over a 239 bit prime field\n");
+               BIO_printf(bio_err," -X9_62_239v2  use the X9_62 239v2 example curve over a 239 bit prime field\n");
+               BIO_printf(bio_err," -X9_62_239v3  use the X9_62 239v3 example curve over a 239 bit prime field\n");
+               BIO_printf(bio_err," -X9_62_256v1  use the X9_62 239v1 example curve over a 256 bit prime field\n");
+               goto end;
+       }
+
+       ERR_load_crypto_strings();
+
+       in=BIO_new(BIO_s_file());
+       out=BIO_new(BIO_s_file());
+       if ((in == NULL) || (out == NULL))
+       {
+               ERR_print_errors(bio_err);
+               goto end;
+       }
+
+       if (infile == NULL)
+               BIO_set_fp(in,stdin,BIO_NOCLOSE);
+       else
+       {
+               if (BIO_read_filename(in,infile) <= 0)
+               {
+                       perror(infile);
+                       goto end;
+               }
+       }
+       if (outfile == NULL)
+       {
+               BIO_set_fp(out,stdout,BIO_NOCLOSE);
+#ifdef OPENSSL_SYS_VMS
+               {
+               BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+               out = BIO_push(tmpbio, out);
+               }
+#endif
+       }
+       else
+       {
+               if (BIO_write_filename(out,outfile) <= 0)
+               {
+                       perror(outfile);
+                       goto end;
+               }
+       }
+
+        e = setup_engine(bio_err, engine, 0);
+
+       if (need_rand)
+       {
+               app_RAND_load_file(NULL, bio_err, (inrand != NULL));
+               if (inrand != NULL)
+                       BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
+                               app_RAND_load_files(inrand));
+       }
+
+       if (curve_type != EC_GROUP_NO_CURVE)
+       {
+               if ((ecdsa = ECDSA_new()) == NULL)
+                       goto end;
+               ecdsa->group = EC_GROUP_get_group_by_name(curve_type);
+               if (named_curve)
+                       ECDSA_set_parameter_flags(ecdsa, ECDSA_FLAG_NAMED_CURVE);
+       }
+       else if (informat == FORMAT_ASN1)
+               ecdsa = d2i_ECDSAParameters_bio(in,NULL);
+       else if (informat == FORMAT_PEM)
+               ecdsa = PEM_read_bio_ECDSAParameters(in, NULL, NULL, NULL);
+       else
+       {
+               BIO_printf(bio_err, "bad input format specified\n");
+               goto end;
+       }
+       if (ecdsa == NULL)
+       {
+               BIO_printf(bio_err, "unable to load ECDSA parameters\n");
+               ERR_print_errors(bio_err);
+               goto end;
+       }
+
+       if (text)
+       {
+               ECDSAParameters_print(out, ecdsa);
+       }
+       
+       if (C)
+       {       // TODO : characteristic two
+               int     l, len, bits_p, bits_a, bits_b, bits_x, bits_y, bits_o, bits_c;
+               unsigned char *data;
+               if ((tmp_1 = BN_new()) == NULL || (tmp_2 = BN_new()) == NULL ||
+                   (tmp_3 = BN_new()) == NULL || (tmp_4 = BN_new()) == NULL ||
+                   (tmp_5 = BN_new()) == NULL || (tmp_6 = BN_new()) == NULL ||
+                    (tmp_7 = BN_new()) == NULL || (ctx = BN_CTX_new()) == NULL)
+               {
+                       perror("OPENSSL_malloc");
+                       goto end;
+               }
+               if (!EC_GROUP_get_curve_GFp(ecdsa->group, tmp_1, tmp_2, tmp_3, ctx))
+                       goto end;
+               if ((point = EC_GROUP_get0_generator(ecdsa->group)) == NULL)
+                       goto end;
+               if (!EC_POINT_get_affine_coordinates_GFp(ecdsa->group, point, tmp_4, tmp_5, ctx))
+                       goto end;
+               if (!EC_GROUP_get_order(ecdsa->group, tmp_6, ctx))
+                       goto end;
+               if (!EC_GROUP_get_cofactor(ecdsa->group, tmp_7, ctx))
+                       goto end;
+               
+               len    = BN_num_bytes(tmp_1);
+               bits_p = BN_num_bits(tmp_1);
+               bits_a = BN_num_bits(tmp_2);
+               bits_b = BN_num_bits(tmp_3);
+               bits_x = BN_num_bits(tmp_4);
+               bits_y = BN_num_bits(tmp_5);
+               bits_o = BN_num_bits(tmp_6);
+               bits_c = BN_num_bits(tmp_7);
+               data=(unsigned char *)OPENSSL_malloc(len+20);
+               if (data == NULL)
+               {
+                       perror("OPENSSL_malloc");
+                       goto end;
+               }
+               l = BN_bn2bin(tmp_1, data);
+               printf("static unsigned char ecdsa%d_p[]={", bits_p);
+               for (i=0; i<l; i++)
+               {
+                       if ((i%12) == 0) printf("\n\t");
+                       printf("0x%02X,",data[i]);
+               }
+               printf("\n\t};\n");
+
+               l = BN_bn2bin(tmp_2, data);
+               printf("static unsigned char ecdsa%d_a[]={",bits_p);
+               for (i=0; i<l; i++)
+               {
+                       if ((i%12) == 0) printf("\n\t");
+                       printf("0x%02X,",data[i]);
+               }
+               printf("\n\t};\n");
+
+               l = BN_bn2bin(tmp_3, data);
+               printf("static unsigned char ecdsa%d_b[]={", bits_p);
+               for (i=0; i<l; i++)
+               {
+                       if ((i%12) == 0) printf("\n\t");
+                       printf("0x%02X,",data[i]);
+               }
+               printf("\n\t};\n\n");
+
+               l = BN_bn2bin(tmp_3, data);
+               printf("static unsigned char ecdsa%d_x[]={", bits_x);
+               for (i=0; i<l; i++)
+               {
+                       if ((i%12) == 0) printf("\n\t");
+                       printf("0x%02X,",data[i]);
+               }
+               printf("\n\t};\n\n");
+
+               l = BN_bn2bin(tmp_3, data);
+               printf("static unsigned char ecdsa%d_y[]={", bits_y);
+               for (i=0; i<l; i++)
+               {
+                       if ((i%12) == 0) printf("\n\t");
+                       printf("0x%02X,",data[i]);
+               }
+               printf("\n\t};\n\n");
+
+               l = BN_bn2bin(tmp_3, data);
+               printf("static unsigned char ecdsa%d_o[]={", bits_o);
+               for (i=0; i<l; i++)
+               {
+                       if ((i%12) == 0) printf("\n\t");
+                       printf("0x%02X,",data[i]);
+               }
+               printf("\n\t};\n\n");
+
+               l = BN_bn2bin(tmp_3, data);
+               printf("static unsigned char ecdsa%d_c[]={", bits_c);
+               for (i=0; i<l; i++)
+               {
+                       if ((i%12) == 0) printf("\n\t");
+                       printf("0x%02X,",data[i]);
+               }
+               printf("\n\t};\n\n");
+
+               printf("ECDSA *get_ecdsa%d()\n\t{\n",bits_p);
+               printf("\tint      ok=1;\n");
+               printf("\tECDSA    *ecdsa=NULL;\n");
+               printf("\tEC_POINT *point=NULL;\n");
+               printf("\tBIGNUM   *tmp_1=NULL,*tmp_2=NULL,*tmp_3=NULL;\n");
+               printf("\tBN_CTX   *ctx=NULL;\n\n");
+               printf("\tecdsa=ECDSA_new();\n");
+               printf("\ttmp_1=BN_new();\n");
+               printf("\ttmp_2=BN_new();\n");
+               printf("\ttmp_3=BN_new();\n");
+               printf("\tctx=BN_CTX_new();\n");
+               printf("\tif (!ecdsa || !tmp_1 || !tmp_2 || !tmp_3 || !ctx) ok=0;\n");
+               printf("\tif (ok && !ecdsa->group=EC_GROUP_new(EC_GFp_mont_method())) == NULL) ok=0;");
+               printf("\tif (ok && !BN_bin2bn(ecdsa%d_p,sizeof(ecdsa%d_p),tmp_1)) ok=0;\n", bits_p, bits_p);
+               printf("\tif (ok && !BN_bin2bn(ecdsa%d_a,sizeof(ecdsa%d_a),tmp_2)) ok=0;\n", bits_p, bits_p);
+               printf("\tif (ok && !BN_bin2bn(ecdsa%d_b,sizeof(ecdsa%d_b),tmp_3)) ok=0;\n", bits_p, bits_p);
+               printf("\tif (ok && !EC_GROUP_set_curve_GFp(ecdsa->group,tmp_1,tmp_2,tmp_3,ctx)) ok=0;\n");
+               printf("\tif (ok && !BN_bin2bn(ecdsa%d_x,sizeof(ecdsa%d_p),tmp_1)) ok=0;\n", bits_p, bits_p);
+               printf("\tif (ok && !BN_bin2bn(ecdsa%d_y,sizeof(ecdsa%d_a),tmp_2)) ok=0;\n", bits_p, bits_p);
+               printf("\tif (ok && (point = EC_POINT_new(ecdsa->group)) == NULL) ok=0;\n");
+               printf("\tif (ok && !EC_POINT_set_affine_coordinates_GFp(ecdsa->group,point,tmp_1,tmp_2,ctx)) ok=0:\n");
+               printf("\tif (ok && !BN_bin2bn(ecdsa%d_o,sizeof(ecdsa%d_b),tmp_1)) ok=0;\n", bits_p, bits_p);
+               printf("\tif (ok && !BN_bin2bn(ecdsa%d_c,sizeof(ecdsa%d_b),tmp_2)) ok=0;\n", bits_p, bits_p);
+               printf("\tif (ok && !EC_GROUP_set_generator(ecdsa->group,point,tmp_1,tmp_2)) ok=0;\n");
+               printf("\tif ((ecdsa->group == NULL) || (ecdsa->pub_key == NULL) || (ecdsa->priv_key == NULL))\n");
+               printf("\t\t{ ECDSA_free(ecdsa); return(NULL); }\n");
+               printf("\treturn(ecdsa);\n\t}\n");
+       }
+
+
+       if (!noout)
+       {
+               if (outformat == FORMAT_ASN1)
+                       i = i2d_ECDSAParameters_bio(out, ecdsa);
+               else if (outformat == FORMAT_PEM)
+                       i = PEM_write_bio_ECDSAParameters(out, ecdsa);
+               else    
+               {
+                       BIO_printf(bio_err,"bad output format specified for outfile\n");
+                       goto end;
+               }
+               if (!i)
+               {
+                       BIO_printf(bio_err, "unable to write ECDSA parameters\n");
+                       ERR_print_errors(bio_err);
+                       goto end;
+               }
+       }
+       if (genkey)
+       {
+               ECDSA *ecdsakey;
+
+               assert(need_rand);
+               if ((ecdsakey = ECDSAParameters_dup(ecdsa)) == NULL) goto end;
+               if (!ECDSA_generate_key(ecdsakey)) goto end;
+               if (outformat == FORMAT_ASN1)
+                       i = i2d_ECDSAPrivateKey_bio(out, ecdsakey);
+               else if (outformat == FORMAT_PEM)
+                       i = PEM_write_bio_ECDSAPrivateKey(out, ecdsakey, NULL, NULL, 0, NULL, NULL);
+               else    
+               {
+                       BIO_printf(bio_err, "bad output format specified for outfile\n");
+                       goto end;
+               }
+               ECDSA_free(ecdsakey);
+       }
+       if (need_rand)
+               app_RAND_write_file(NULL, bio_err);
+       ret=0;
+end:
+       if (in != NULL)         BIO_free(in);
+       if (out != NULL)        BIO_free_all(out);
+       if (ecdsa != NULL)      ECDSA_free(ecdsa);
+       if (tmp_1)              BN_free(tmp_1);
+       if (tmp_2)              BN_free(tmp_2);
+       if (tmp_3)              BN_free(tmp_3);
+       if (tmp_3)              BN_free(tmp_4);
+       if (tmp_3)              BN_free(tmp_5);
+       if (tmp_3)              BN_free(tmp_6);
+       if (tmp_3)              BN_free(tmp_7);
+       if (ctx)                BN_CTX_free(ctx);
+       apps_shutdown();
+       EXIT(ret);
+}
+#endif
index 752385d..ecc671b 100644 (file)
@@ -17,6 +17,8 @@ extern int rsa_main(int argc,char *argv[]);
 extern int rsautl_main(int argc,char *argv[]);
 extern int dsa_main(int argc,char *argv[]);
 extern int dsaparam_main(int argc,char *argv[]);
+extern int ecdsa_main(int argc,char *argv[]);
+extern int ecdsaparam_main(int argc,char *argv[]);
 extern int x509_main(int argc,char *argv[]);
 extern int genrsa_main(int argc,char *argv[]);
 extern int gendsa_main(int argc,char *argv[]);
@@ -78,6 +80,12 @@ FUNCTION functions[] = {
 #endif
 #ifndef OPENSSL_NO_DSA
        {FUNC_TYPE_GENERAL,"dsaparam",dsaparam_main},
+#endif
+#ifndef OPENSSL_NO_ECDSA
+       {FUNC_TYPE_GENERAL,"ecdsa",ecdsa_main},
+#endif
+#ifndef OPENSSL_NO_ECDSA
+       {FUNC_TYPE_GENERAL,"ecdsaparam",ecdsaparam_main},
 #endif
        {FUNC_TYPE_GENERAL,"x509",x509_main},
 #ifndef OPENSSL_NO_RSA
index d6a40ed..7672d07 100644 (file)
@@ -33,6 +33,8 @@ foreach (@ARGV)
                { print "#ifndef OPENSSL_NO_RSA\n${str}#endif\n";  }
        elsif ( ($_ =~ /^dsa$/) || ($_ =~ /^gendsa$/) || ($_ =~ /^dsaparam$/))
                { print "#ifndef OPENSSL_NO_DSA\n${str}#endif\n"; }
+       elsif ( ($_ =~ /^ecdsa$/) || ($_ =~ /^ecdsaparam$/))
+               { print "#ifndef OPENSSL_NO_ECDSA\n${str}#endif\n";}
        elsif ( ($_ =~ /^dh$/) || ($_ =~ /^gendh$/) || ($_ =~ /^dhparam$/))
                { print "#ifndef OPENSSL_NO_DH\n${str}#endif\n"; }
        elsif ( ($_ =~ /^pkcs12$/))
index c406b64..27a7bba 100644 (file)
@@ -142,6 +142,7 @@ static int batch=0;
 #define TYPE_RSA       1
 #define TYPE_DSA       2
 #define TYPE_DH                3
+#define TYPE_ECDSA     4
 
 int MAIN(int, char **);
 
@@ -150,6 +151,9 @@ int MAIN(int argc, char **argv)
        ENGINE *e = NULL;
 #ifndef OPENSSL_NO_DSA
        DSA *dsa_params=NULL;
+#endif
+#ifndef OPENSSL_NO_ECDSA
+       ECDSA *ecdsa_params = NULL;
 #endif
        unsigned long nmflag = 0;
        int ex=1,x509=0,days=30;
@@ -317,11 +321,63 @@ int MAIN(int argc, char **argv)
                                                }
                                        }
                                BIO_free(in);
-                               newkey=BN_num_bits(dsa_params->p);
                                in=NULL;
+                               newkey=BN_num_bits(dsa_params->p);
                                }
                        else 
 #endif
+#ifndef OPENSSL_NO_ECDSA
+                               if (strncmp("ecdsa:",p,4) == 0)
+                               {
+                               X509 *xtmp=NULL;
+                               EVP_PKEY *dtmp;
+
+                               pkey_type=TYPE_ECDSA;
+                               p+=6;
+                               if ((in=BIO_new_file(p,"r")) == NULL)
+                                       {
+                                       perror(p);
+                                       goto end;
+                                       }
+                               if ((ecdsa_params = PEM_read_bio_ECDSAParameters(in, NULL, NULL, NULL)) == NULL)
+                                       {
+                                       ERR_clear_error();
+                                       (void)BIO_reset(in);
+                                       if ((xtmp=PEM_read_bio_X509(in,NULL,NULL,NULL)) == NULL)
+                                               {       
+                                               BIO_printf(bio_err,"unable to load ECDSA parameters from file\n");
+                                               goto end;
+                                               }
+
+                                       dtmp=X509_get_pubkey(xtmp);
+                                       if (dtmp->type == EVP_PKEY_ECDSA)
+                                               ecdsa_params = ECDSAParameters_dup(dtmp->pkey.ecdsa);
+                                       EVP_PKEY_free(dtmp);
+                                       X509_free(xtmp);
+                                       if (ecdsa_params == NULL)
+                                               {
+                                               BIO_printf(bio_err,"Certificate does not contain ECDSA parameters\n");
+                                               goto end;
+                                               }
+                                       }
+
+                               BIO_free(in);
+                               in=NULL;
+                               
+                               {
+                               BIGNUM *order = BN_new();
+                               
+                               if (!order)
+                                       goto end;
+                               if (!EC_GROUP_get_order(ecdsa_params->group, order, NULL))
+                                       goto end;
+                               newkey = BN_num_bits(order);
+                               BN_free(order);
+                               }
+
+                               }
+                       else
+#endif
 #ifndef OPENSSL_NO_DH
                                if (strncmp("dh:",p,4) == 0)
                                {
@@ -433,6 +489,7 @@ bad:
                BIO_printf(bio_err,"                the random number generator\n");
                BIO_printf(bio_err," -newkey rsa:bits generate a new RSA key of 'bits' in size\n");
                BIO_printf(bio_err," -newkey dsa:file generate a new DSA key, parameters taken from CA in 'file'\n");
+               BIO_printf(bio_err," -newkey ecdsa:file generate a new ECDSA key, parameters taken from CA in 'file'\n");
                BIO_printf(bio_err," -[digest]      Digest to sign with (md5, sha1, md2, mdc2, md4)\n");
                BIO_printf(bio_err," -config file   request template file.\n");
                BIO_printf(bio_err," -subj arg      set or modify request subject\n");
@@ -626,7 +683,7 @@ bad:
                           message */
                        goto end;
                        }
-               if (EVP_PKEY_type(pkey->type) == EVP_PKEY_DSA)
+               if (EVP_PKEY_type(pkey->type) == EVP_PKEY_DSA || EVP_PKEY_type(pkey->type) == EVP_PKEY_ECDSA)
                        {
                        char *randfile = NCONF_get_string(req_conf,SECTION,"RANDFILE");
                        if (randfile == NULL)
@@ -650,14 +707,15 @@ bad:
                                newkey=DEFAULT_KEY_LENGTH;
                        }
 
-               if (newkey < MIN_KEY_LENGTH)
+               if (newkey < MIN_KEY_LENGTH && (pkey_type == TYPE_RSA || pkey_type == TYPE_DSA))
+               /* TODO: appropriate minimal keylength for the different algorithm (esp. ECDSA) */
                        {
                        BIO_printf(bio_err,"private key length is too short,\n");
                        BIO_printf(bio_err,"it needs to be at least %d bits, not %d\n",MIN_KEY_LENGTH,newkey);
                        goto end;
                        }
                BIO_printf(bio_err,"Generating a %d bit %s private key\n",
-                       newkey,(pkey_type == TYPE_RSA)?"RSA":"DSA");
+                       newkey,(pkey_type == TYPE_RSA)?"RSA":(pkey_type == TYPE_DSA)?"DSA":"ECDSA");
 
                if ((pkey=EVP_PKEY_new()) == NULL) goto end;
 
@@ -679,6 +737,14 @@ bad:
                        dsa_params=NULL;
                        }
 #endif
+#ifndef OPENSSL_NO_ECDSA
+                       if (pkey_type == TYPE_ECDSA)
+                       {
+                       if (!ECDSA_generate_key(ecdsa_params)) goto end;
+                       if (!EVP_PKEY_assign_ECDSA(pkey, ecdsa_params)) goto end;
+                       ecdsa_params = NULL;
+                       }
+#endif
 
                app_RAND_write_file(randfile, bio_err);
 
@@ -784,6 +850,10 @@ loop:
 #ifndef OPENSSL_NO_DSA
                if (pkey->type == EVP_PKEY_DSA)
                        digest=EVP_dss1();
+#endif
+#ifndef OPENSSL_NO_ECDSA
+               if (pkey->type == EVP_PKEY_ECDSA)
+                       digest=EVP_ecdsa();
 #endif
                if (req == NULL)
                        {
@@ -1064,6 +1134,9 @@ end:
        OBJ_cleanup();
 #ifndef OPENSSL_NO_DSA
        if (dsa_params != NULL) DSA_free(dsa_params);
+#endif
+#ifndef OPENSSL_NO_ECDSA
+       if (ecdsa_params != NULL) ECDSA_free(ecdsa_params);
 #endif
        apps_shutdown();
        EXIT(ex);
index 618cb8d..078e220 100644 (file)
@@ -702,7 +702,7 @@ bad:
                        }
                }
 
-#if !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_DSA)
+#if !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_ECDSA)
        if (nocert)
 #endif
                {
index b2ea09d..a56f037 100644 (file)
@@ -866,6 +866,10 @@ bad:
                                if (Upkey->type == EVP_PKEY_DSA)
                                        digest=EVP_dss1();
 #endif
+#ifndef OPENSSL_NO_ECDSA
+                               if (Upkey->type == EVP_PKEY_ECDSA)
+                                       digest=EVP_ecdsa();
+#endif
 
                                assert(need_rand);
                                if (!sign(x,Upkey,days,clrext,digest,
@@ -885,6 +889,10 @@ bad:
                                if (CApkey->type == EVP_PKEY_DSA)
                                        digest=EVP_dss1();
 #endif
+#ifndef OPENSSL_NO_ECDSA
+                               if (CApkey->type == EVP_PKEY_ECDSA)
+                                       digest = EVP_ecdsa();
+#endif
                                
                                assert(need_rand);
                                if (!x509_certify(ctx,CAfile,digest,x,xca,
@@ -914,6 +922,8 @@ bad:
 
                                if (pk->type == EVP_PKEY_DSA)
                                        digest=EVP_dss1();
+                               else if (pk->type == EVP_PKEY_ECDSA)
+                                       digest=EVP_ecdsa();
 
                                rq=X509_to_X509_REQ(x,pk,digest);
                                EVP_PKEY_free(pk);
index bb2a20e..15bf58c 100644 (file)
@@ -28,7 +28,7 @@ LIBS=
 
 SDIRS= md2 md5 sha mdc2 hmac ripemd \
        des rc2 rc4 rc5 idea bf cast \
-       bn ec rsa dsa dh dso engine aes \
+       bn ec rsa dsa ecdsa dh dso engine aes \
        buffer bio stack lhash rand err objects \
        evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5
 
index 09d4cb4..267d4a1 100644 (file)
@@ -145,13 +145,14 @@ a_d2i_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 a_d2i_fp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 a_d2i_fp.o: ../../include/openssl/symhacks.h ../cryptlib.h a_d2i_fp.c
 a_digest.o: ../../e_os.h ../../include/openssl/asn1.h
-a_digest.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-a_digest.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-a_digest.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-a_digest.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-a_digest.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
-a_digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-a_digest.o: ../../include/openssl/opensslconf.h
+a_digest.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+a_digest.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+a_digest.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+a_digest.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+a_digest.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+a_digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+a_digest.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+a_digest.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 a_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 a_digest.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
 a_digest.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
@@ -257,10 +258,12 @@ a_set.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 a_set.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
 a_set.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 a_set.o: ../cryptlib.h a_set.c
-a_sign.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+a_sign.o: ../../e_os.h ../../include/openssl/asn1.h
+a_sign.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 a_sign.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 a_sign.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 a_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+a_sign.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 a_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 a_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 a_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -270,18 +273,20 @@ a_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 a_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 a_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 a_sign.o: ../cryptlib.h a_sign.c
-a_strex.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-a_strex.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-a_strex.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
-a_strex.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
-a_strex.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
-a_strex.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-a_strex.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
-a_strex.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-a_strex.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
-a_strex.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-a_strex.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-a_strex.o: ../../include/openssl/x509_vfy.h a_strex.c charmap.h
+a_strex.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
+a_strex.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+a_strex.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+a_strex.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
+a_strex.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+a_strex.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
+a_strex.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+a_strex.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+a_strex.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+a_strex.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
+a_strex.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+a_strex.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+a_strex.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+a_strex.o: a_strex.c charmap.h
 a_strnid.o: ../../e_os.h ../../include/openssl/asn1.h
 a_strnid.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
 a_strnid.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
@@ -326,13 +331,14 @@ a_utf8.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
 a_utf8.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 a_utf8.o: ../cryptlib.h a_utf8.c
 a_verify.o: ../../e_os.h ../../include/openssl/asn1.h
-a_verify.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-a_verify.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-a_verify.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-a_verify.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-a_verify.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
-a_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-a_verify.o: ../../include/openssl/opensslconf.h
+a_verify.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+a_verify.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+a_verify.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+a_verify.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+a_verify.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+a_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+a_verify.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+a_verify.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 a_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 a_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
 a_verify.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
@@ -364,14 +370,15 @@ asn1_par.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 asn1_par.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 asn1_par.o: ../../include/openssl/symhacks.h ../cryptlib.h asn1_par.c
 asn_moid.o: ../../e_os.h ../../include/openssl/asn1.h
-asn_moid.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-asn_moid.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
-asn_moid.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
-asn_moid.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
-asn_moid.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-asn_moid.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
-asn_moid.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-asn_moid.o: ../../include/openssl/opensslconf.h
+asn_moid.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+asn_moid.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+asn_moid.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+asn_moid.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
+asn_moid.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
+asn_moid.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+asn_moid.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+asn_moid.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+asn_moid.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 asn_moid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 asn_moid.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
 asn_moid.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
@@ -386,10 +393,12 @@ asn_pack.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
 asn_pack.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 asn_pack.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 asn_pack.o: ../../include/openssl/symhacks.h ../cryptlib.h asn_pack.c
-d2i_pr.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+d2i_pr.o: ../../e_os.h ../../include/openssl/asn1.h
+d2i_pr.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 d2i_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 d2i_pr.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 d2i_pr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+d2i_pr.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 d2i_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 d2i_pr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 d2i_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -397,10 +406,12 @@ d2i_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 d2i_pr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
 d2i_pr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 d2i_pr.o: ../cryptlib.h d2i_pr.c
-d2i_pu.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+d2i_pu.o: ../../e_os.h ../../include/openssl/asn1.h
+d2i_pu.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 d2i_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 d2i_pu.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 d2i_pu.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+d2i_pu.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 d2i_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 d2i_pu.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 d2i_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -441,10 +452,12 @@ f_string.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
 f_string.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 f_string.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 f_string.o: ../../include/openssl/symhacks.h ../cryptlib.h f_string.c
-i2d_pr.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+i2d_pr.o: ../../e_os.h ../../include/openssl/asn1.h
+i2d_pr.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 i2d_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 i2d_pr.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 i2d_pr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+i2d_pr.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 i2d_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 i2d_pr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 i2d_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -452,10 +465,12 @@ i2d_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 i2d_pr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
 i2d_pr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 i2d_pr.o: ../cryptlib.h i2d_pr.c
-i2d_pu.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+i2d_pu.o: ../../e_os.h ../../include/openssl/asn1.h
+i2d_pu.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 i2d_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 i2d_pu.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 i2d_pu.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+i2d_pu.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 i2d_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 i2d_pu.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 i2d_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -468,7 +483,8 @@ n_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/asn1t.h
 n_pkey.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
 n_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 n_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-n_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
+n_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+n_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
 n_pkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 n_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 n_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
@@ -481,7 +497,8 @@ nsseq.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
 nsseq.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
 nsseq.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 nsseq.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-nsseq.o: ../../include/openssl/e_os2.h ../../include/openssl/evp.h
+nsseq.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+nsseq.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
 nsseq.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 nsseq.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 nsseq.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
@@ -494,6 +511,7 @@ p5_pbe.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 p5_pbe.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 p5_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 p5_pbe.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+p5_pbe.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 p5_pbe.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 p5_pbe.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 p5_pbe.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -508,6 +526,7 @@ p5_pbev2.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 p5_pbev2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 p5_pbev2.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 p5_pbev2.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+p5_pbev2.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 p5_pbev2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 p5_pbev2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 p5_pbev2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -522,6 +541,7 @@ p8_pkey.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 p8_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 p8_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 p8_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+p8_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 p8_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 p8_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 p8_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -532,24 +552,28 @@ p8_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 p8_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 p8_pkey.o: ../cryptlib.h p8_pkey.c
 t_bitst.o: ../../e_os.h ../../include/openssl/asn1.h
-t_bitst.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-t_bitst.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
-t_bitst.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
-t_bitst.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
-t_bitst.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-t_bitst.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-t_bitst.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
-t_bitst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-t_bitst.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
-t_bitst.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-t_bitst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-t_bitst.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-t_bitst.o: ../../include/openssl/x509v3.h ../cryptlib.h t_bitst.c
-t_crl.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+t_bitst.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+t_bitst.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+t_bitst.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+t_bitst.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
+t_bitst.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+t_bitst.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
+t_bitst.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+t_bitst.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+t_bitst.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
+t_bitst.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+t_bitst.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+t_bitst.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+t_bitst.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+t_bitst.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+t_bitst.o: ../cryptlib.h t_bitst.c
+t_crl.o: ../../e_os.h ../../include/openssl/asn1.h
+t_crl.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 t_crl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 t_crl.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
 t_crl.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-t_crl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
+t_crl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+t_crl.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
 t_crl.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 t_crl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 t_crl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
@@ -559,20 +583,24 @@ t_crl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 t_crl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 t_crl.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
 t_crl.o: ../cryptlib.h t_crl.c
-t_pkey.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+t_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
+t_pkey.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 t_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 t_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 t_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+t_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 t_pkey.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
 t_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 t_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa.h
 t_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 t_pkey.o: ../../include/openssl/symhacks.h ../cryptlib.h t_pkey.c
-t_req.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+t_req.o: ../../e_os.h ../../include/openssl/asn1.h
+t_req.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 t_req.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 t_req.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
 t_req.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-t_req.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
+t_req.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+t_req.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
 t_req.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 t_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 t_req.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
@@ -582,10 +610,12 @@ t_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 t_req.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 t_req.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
 t_req.o: ../cryptlib.h t_req.c
-t_spki.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+t_spki.o: ../../e_os.h ../../include/openssl/asn1.h
+t_spki.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 t_spki.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 t_spki.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 t_spki.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+t_spki.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 t_spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 t_spki.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 t_spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -595,11 +625,13 @@ t_spki.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 t_spki.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 t_spki.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 t_spki.o: ../cryptlib.h t_spki.c
-t_x509.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+t_x509.o: ../../e_os.h ../../include/openssl/asn1.h
+t_x509.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 t_x509.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 t_x509.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
 t_x509.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-t_x509.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
+t_x509.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+t_x509.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
 t_x509.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 t_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 t_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
@@ -610,18 +642,20 @@ t_x509.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 t_x509.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
 t_x509.o: ../cryptlib.h t_x509.c
 t_x509a.o: ../../e_os.h ../../include/openssl/asn1.h
-t_x509a.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-t_x509a.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-t_x509a.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-t_x509a.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-t_x509a.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
-t_x509a.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-t_x509a.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
-t_x509a.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
-t_x509a.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
-t_x509a.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-t_x509a.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
-t_x509a.o: ../../include/openssl/x509_vfy.h ../cryptlib.h t_x509a.c
+t_x509a.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+t_x509a.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+t_x509a.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+t_x509a.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+t_x509a.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+t_x509a.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+t_x509a.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+t_x509a.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+t_x509a.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+t_x509a.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
+t_x509a.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+t_x509a.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+t_x509a.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+t_x509a.o: ../cryptlib.h t_x509a.c
 tasn_dec.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
 tasn_dec.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
 tasn_dec.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
@@ -676,7 +710,8 @@ x_algor.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
 x_algor.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
 x_algor.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 x_algor.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-x_algor.o: ../../include/openssl/e_os2.h ../../include/openssl/evp.h
+x_algor.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+x_algor.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
 x_algor.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 x_algor.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 x_algor.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
@@ -690,6 +725,7 @@ x_attrib.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 x_attrib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 x_attrib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 x_attrib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+x_attrib.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 x_attrib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 x_attrib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 x_attrib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -713,6 +749,7 @@ x_crl.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 x_crl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 x_crl.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 x_crl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+x_crl.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 x_crl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 x_crl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 x_crl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -726,7 +763,8 @@ x_exten.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
 x_exten.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
 x_exten.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 x_exten.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-x_exten.o: ../../include/openssl/e_os2.h ../../include/openssl/evp.h
+x_exten.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+x_exten.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
 x_exten.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 x_exten.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 x_exten.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
@@ -735,10 +773,12 @@ x_exten.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 x_exten.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 x_exten.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 x_exten.o: x_exten.c
-x_info.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+x_info.o: ../../e_os.h ../../include/openssl/asn1.h
+x_info.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 x_info.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 x_info.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 x_info.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+x_info.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 x_info.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 x_info.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 x_info.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -762,6 +802,7 @@ x_name.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 x_name.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 x_name.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 x_name.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+x_name.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 x_name.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 x_name.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 x_name.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -772,24 +813,26 @@ x_name.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 x_name.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 x_name.o: ../cryptlib.h x_name.c
 x_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
-x_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
-x_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-x_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
-x_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
-x_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-x_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-x_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
-x_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-x_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
-x_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-x_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-x_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-x_pkey.o: ../cryptlib.h x_pkey.c
+x_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/asn1t.h
+x_pkey.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+x_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+x_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
+x_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+x_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
+x_pkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+x_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+x_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
+x_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
+x_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+x_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+x_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
+x_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_pkey.c
 x_pubkey.o: ../../e_os.h ../../include/openssl/asn1.h
 x_pubkey.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 x_pubkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 x_pubkey.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 x_pubkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+x_pubkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 x_pubkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 x_pubkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 x_pubkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -804,6 +847,7 @@ x_req.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 x_req.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 x_req.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 x_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+x_req.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 x_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 x_req.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 x_req.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -818,6 +862,7 @@ x_sig.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 x_sig.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 x_sig.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 x_sig.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+x_sig.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 x_sig.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 x_sig.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 x_sig.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -832,6 +877,7 @@ x_spki.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 x_spki.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 x_spki.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 x_spki.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+x_spki.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 x_spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 x_spki.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 x_spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -846,6 +892,7 @@ x_val.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 x_val.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 x_val.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 x_val.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+x_val.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 x_val.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 x_val.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 x_val.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
@@ -860,7 +907,8 @@ x_x509.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 x_x509.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 x_x509.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
 x_x509.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-x_x509.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
+x_x509.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+x_x509.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
 x_x509.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 x_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 x_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
@@ -875,6 +923,7 @@ x_x509a.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 x_x509a.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 x_x509a.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 x_x509a.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+x_x509a.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 x_x509a.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 x_x509a.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 x_x509a.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
index d8474dc..8370635 100644 (file)
@@ -1006,6 +1006,7 @@ void ERR_load_ASN1_strings(void);
 #define ASN1_F_D2I_X509_PKEY                            159
 #define ASN1_F_I2D_ASN1_TIME                            160
 #define ASN1_F_I2D_DSA_PUBKEY                           161
+#define ASN1_F_I2D_ECDSA_PUBKEY                                 174
 #define ASN1_F_I2D_NETSCAPE_RSA                                 162
 #define ASN1_F_I2D_PRIVATEKEY                           163
 #define ASN1_F_I2D_PUBLICKEY                            164
index 591f55d..dd8fb34 100644 (file)
@@ -128,6 +128,7 @@ static ERR_STRING_DATA ASN1_str_functs[]=
 {ERR_PACK(0,ASN1_F_D2I_X509_PKEY,0),   "d2i_X509_PKEY"},
 {ERR_PACK(0,ASN1_F_I2D_ASN1_TIME,0),   "I2D_ASN1_TIME"},
 {ERR_PACK(0,ASN1_F_I2D_DSA_PUBKEY,0),  "i2d_DSA_PUBKEY"},
+{ERR_PACK(0,ASN1_F_I2D_ECDSA_PUBKEY,0),        "i2d_ECDSA_PUBKEY"},
 {ERR_PACK(0,ASN1_F_I2D_NETSCAPE_RSA,0),        "i2d_Netscape_RSA"},
 {ERR_PACK(0,ASN1_F_I2D_PRIVATEKEY,0),  "i2d_PrivateKey"},
 {ERR_PACK(0,ASN1_F_I2D_PUBLICKEY,0),   "i2d_PublicKey"},
index 2e7d96a..d56e5fd 100644 (file)
@@ -68,6 +68,9 @@
 #ifndef OPENSSL_NO_DSA
 #include <openssl/dsa.h>
 #endif
+#ifndef OPENSSL_NO_ECDSA
+#include <openssl/ecdsa.h>
+#endif
 
 EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, unsigned char **pp,
             long length)
@@ -107,6 +110,16 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, unsigned char **pp,
                        goto err;
                        }
                break;
+#endif
+#ifndef OPENSSL_NO_ECDSA
+       case EVP_PKEY_ECDSA:
+               if ((ret->pkey.ecdsa = d2i_ECDSAPrivateKey(NULL, 
+                       (const unsigned char **)pp, length)) == NULL)
+                       {
+                       ASN1err(ASN1_F_D2I_PRIVATEKEY, ERR_R_ASN1_LIB);
+                       goto err;
+                       }
+               break;
 #endif
        default:
                ASN1err(ASN1_F_D2I_PRIVATEKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
@@ -138,7 +151,10 @@ EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, unsigned char **pp,
        /* Since we only need to discern "traditional format" RSA and DSA
         * keys we can just count the elements.
          */
-       if(sk_ASN1_TYPE_num(inkey) == 6) keytype = EVP_PKEY_DSA;
+       if(sk_ASN1_TYPE_num(inkey) == 6) 
+               keytype = EVP_PKEY_DSA;
+       else if (sk_ASN1_TYPE_num(inkey) == 4)
+               keytype = EVP_PKEY_ECDSA;
        else keytype = EVP_PKEY_RSA;
        sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free);
        return d2i_PrivateKey(keytype, a, pp, length);
index 71f2eb3..81b5d0f 100644 (file)
@@ -68,6 +68,9 @@
 #ifndef OPENSSL_NO_DSA
 #include <openssl/dsa.h>
 #endif
+#ifndef OPENSSL_NO_ECDSA
+#include <openssl/ecdsa.h>
+#endif
 
 EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp,
             long length)
@@ -100,13 +103,23 @@ EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp,
 #endif
 #ifndef OPENSSL_NO_DSA
        case EVP_PKEY_DSA:
-               if ((ret->pkey.dsa=d2i_DSAPublicKey(NULL,
+               if ((ret->pkey.dsa=d2i_DSAPublicKey(&(ret->pkey.dsa),
                        (const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */
                        {
                        ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB);
                        goto err;
                        }
                break;
+#endif
+#ifndef OPENSSL_NO_ECDSA
+       case EVP_PKEY_ECDSA:
+               if ((ret->pkey.ecdsa = d2i_ECDSAPublicKey(&(ret->pkey.ecdsa), 
+                       (const unsigned char **)pp, length)) == NULL)
+                       {
+                       ASN1err(ASN1_F_D2I_PUBLICKEY, ERR_R_ASN1_LIB);
+                       goto err;
+                       }
+       break;
 #endif
        default:
                ASN1err(ASN1_F_D2I_PUBLICKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
index 1e951ae..a40c64d 100644 (file)
@@ -67,6 +67,9 @@
 #ifndef OPENSSL_NO_DSA
 #include <openssl/dsa.h>
 #endif
+#ifndef OPENSSL_NO_ECDSA
+#include <openssl/ecdsa.h>
+#endif
 
 int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp)
        {
@@ -83,6 +86,12 @@ int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp)
                return(i2d_DSAPrivateKey(a->pkey.dsa,pp));
                }
 #endif
+#ifndef OPENSSL_NO_ECDSA
+       if (a->type == EVP_PKEY_ECDSA)
+               {
+               return(i2d_ECDSAPrivateKey(a->pkey.ecdsa, pp));
+               }
+#endif
 
        ASN1err(ASN1_F_I2D_PRIVATEKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
        return(-1);
index 013d19b..2607734 100644 (file)
@@ -67,6 +67,9 @@
 #ifndef OPENSSL_NO_DSA
 #include <openssl/dsa.h>
 #endif
+#ifndef OPENSSL_NO_ECDSA
+#include <openssl/ecdsa.h>
+#endif
 
 int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp)
        {
@@ -79,6 +82,10 @@ int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp)
 #ifndef OPENSSL_NO_DSA
        case EVP_PKEY_DSA:
                return(i2d_DSAPublicKey(a->pkey.dsa,pp));
+#endif
+#ifndef OPENSSL_NO_ECDSA
+       case EVP_PKEY_ECDSA:
+               return(i2d_ECDSAPublicKey(a->pkey.ecdsa, pp));
 #endif
        default:
                ASN1err(ASN1_F_I2D_PUBLICKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
index 8060115..ff64445 100644 (file)
 #ifndef OPENSSL_NO_DSA
 #include <openssl/dsa.h>
 #endif
+#ifndef OPENSSL_NO_ECDSA
+#include <openssl/ecdsa.h>
+#endif
 
 static int print(BIO *fp,const char *str,BIGNUM *num,
                unsigned char *buf,int off);
 #ifndef OPENSSL_NO_RSA
 #ifndef OPENSSL_NO_FP_API
 int RSA_print_fp(FILE *fp, const RSA *x, int off)
-        {
-        BIO *b;
-        int ret;
+       {
+       BIO *b;
+       int ret;
 
-        if ((b=BIO_new(BIO_s_file())) == NULL)
+       if ((b=BIO_new(BIO_s_file())) == NULL)
                {
                RSAerr(RSA_F_RSA_PRINT_FP,ERR_R_BUF_LIB);
-                return(0);
+               return(0);
                }
-        BIO_set_fp(b,fp,BIO_NOCLOSE);
-        ret=RSA_print(b,x,off);
-        BIO_free(b);
-        return(ret);
-        }
+       BIO_set_fp(b,fp,BIO_NOCLOSE);
+       ret=RSA_print(b,x,off);
+       BIO_free(b);
+       return(ret);
+       }
 #endif
 
 int RSA_print(BIO *bp, const RSA *x, int off)
@@ -209,6 +212,139 @@ err:
        }
 #endif /* !OPENSSL_NO_DSA */
 
+#ifndef OPENSSL_NO_ECDSA
+#ifndef OPENSSL_NO_FP_API
+int ECDSA_print_fp(FILE *fp, const ECDSA *x, int off)
+{
+       BIO *b;
+       int ret;
+       if ((b=BIO_new(BIO_s_file())) == NULL)
+       {
+               ECDSAerr(ECDSA_F_ECDSA_PRINT_FP, ERR_R_BIO_LIB);
+               return(0);
+       }
+       BIO_set_fp(b, fp, BIO_NOCLOSE);
+       ret = ECDSA_print(b, x, off);
+       BIO_free(b);
+       return(ret);
+}
+#endif
+
+int ECDSA_print(BIO *bp, const ECDSA *x, int off)
+       {
+       char str[128];
+       unsigned char *buffer=NULL;
+       int     i, buf_len=0, ret=0, reason=ERR_R_BIO_LIB;
+       BIGNUM  *tmp_1=NULL, *tmp_2=NULL, *tmp_3=NULL,
+               *tmp_4=NULL, *tmp_5=NULL;
+       BN_CTX  *ctx=NULL;
+       EC_POINT *point=NULL;
+       /* TODO: fields other than prime fields */
+       
+       if (!x || !x->group)
+               {
+               reason = ECDSA_R_MISSING_PARAMETERS;
+               goto err;
+               }
+       if ((tmp_1 = BN_new()) == NULL || (tmp_2 = BN_new()) == NULL ||
+               (tmp_3 = BN_new()) == NULL || (ctx = BN_CTX_new()) == NULL)
+               {
+               reason = ERR_R_MALLOC_FAILURE;
+               goto err;
+               }
+       if (!EC_GROUP_get_curve_GFp(x->group, tmp_1, tmp_2, tmp_3, ctx))
+               {
+               reason = ERR_R_EC_LIB;
+               goto err;
+               }
+       if ((point = EC_GROUP_get0_generator(x->group)) == NULL)
+               {
+               reason = ERR_R_EC_LIB;
+               goto err;
+               }
+       if ((buf_len = EC_POINT_point2oct(x->group, point, POINT_CONVERSION_COMPRESSED, NULL, 0, ctx)) == 0)
+               {
+               reason = ECDSA_R_UNEXPECTED_PARAMETER_LENGTH;
+               goto err;
+               }
+       if ((buffer = OPENSSL_malloc(buf_len)) == NULL)
+               {
+               reason = ERR_R_MALLOC_FAILURE;
+               goto err;
+               }
+       if (!EC_POINT_point2oct(x->group, point, POINT_CONVERSION_COMPRESSED, 
+                               buffer, buf_len, ctx)) goto err;
+       if ((tmp_4 = BN_bin2bn(buffer, buf_len, NULL)) == NULL)
+               {
+               reason = ERR_R_BN_LIB;
+               goto err;
+               }
+       if ((i = EC_POINT_point2oct(x->group, x->pub_key, POINT_CONVERSION_COMPRESSED, NULL, 0, ctx)) == 0)
+               {
+               reason = ECDSA_R_UNEXPECTED_PARAMETER_LENGTH;
+               goto err;
+               }
+       if (i > buf_len && (buffer = OPENSSL_realloc(buffer, i)) == NULL)
+               {
+               reason = ERR_R_MALLOC_FAILURE;
+               buf_len = i;
+               goto err;
+               }
+       if (!EC_POINT_point2oct(x->group, x->pub_key, POINT_CONVERSION_COMPRESSED, 
+                               buffer, buf_len, ctx))
+               {
+               reason = ERR_R_EC_LIB;
+               goto err;
+               }
+       if ((tmp_5 = BN_bin2bn(buffer, buf_len, NULL)) == NULL)
+               {
+               reason = ERR_R_BN_LIB;
+               goto err;
+               }
+       if (tmp_1 != NULL)
+               i = BN_num_bytes(tmp_1)*2;
+       else
+               i=256;
+       if ((i + 10) > buf_len && (buffer = OPENSSL_realloc(buffer, i+10)) == NULL)
+               {
+               reason = ERR_R_MALLOC_FAILURE;
+               buf_len = i;
+               goto err;
+               }
+       if (off)
+               {
+               if (off > 128) off=128;
+               memset(str,' ',off);
+               }
+       if (x->priv_key != NULL)
+               {
+               if (off && (BIO_write(bp, str, off) <= 0)) goto err;
+               if (BIO_printf(bp, "Private-Key: (%d bit)\n", BN_num_bits(tmp_1)) <= 0) goto err;
+               }
+  
+       if ((x->priv_key != NULL) && !print(bp, "priv:", x->priv_key, buffer, off)) goto err;
+       if ((tmp_5 != NULL) && !print(bp, "pub: ", tmp_5, buffer, off)) goto err;
+       if ((tmp_1 != NULL) && !print(bp, "P:   ", tmp_1, buffer, off)) goto err;
+       if ((tmp_2 != NULL) && !print(bp, "A:   ", tmp_2, buffer, off)) goto err;
+       if ((tmp_3 != NULL) && !print(bp, "B:   ", tmp_3, buffer, off)) goto err;
+       if ((tmp_4 != NULL) && !print(bp, "Gen: ", tmp_4, buffer, off)) goto err;
+       ret=1;
+err:
+       if (!ret)
+               ECDSAerr(ECDSA_F_ECDSA_PRINT, reason);
+       if (tmp_1) BN_free(tmp_1);
+       if (tmp_2) BN_free(tmp_2);
+       if (tmp_3) BN_free(tmp_3);
+       if (tmp_4) BN_free(tmp_4);
+       if (tmp_5) BN_free(tmp_5);
+       if (ctx)   BN_CTX_free(ctx);
+       if (buffer != NULL) OPENSSL_free(buffer);
+       return(ret);
+       }
+#endif
+
 static int print(BIO *bp, const char *number, BIGNUM *num, unsigned char *buf,
             int off)
        {
@@ -262,20 +398,20 @@ static int print(BIO *bp, const char *number, BIGNUM *num, unsigned char *buf,
 #ifndef OPENSSL_NO_DH
 #ifndef OPENSSL_NO_FP_API
 int DHparams_print_fp(FILE *fp, const DH *x)
-        {
-        BIO *b;
-        int ret;
+       {
+       BIO *b;
+       int ret;
 
-        if ((b=BIO_new(BIO_s_file())) == NULL)
+       if ((b=BIO_new(BIO_s_file())) == NULL)
                {
                DHerr(DH_F_DHPARAMS_PRINT_FP,ERR_R_BUF_LIB);
-                return(0);
+               return(0);
                }
-        BIO_set_fp(b,fp,BIO_NOCLOSE);
-        ret=DHparams_print(b, x);
-        BIO_free(b);
-        return(ret);
-        }
+       BIO_set_fp(b,fp,BIO_NOCLOSE);
+       ret=DHparams_print(b, x);
+       BIO_free(b);
+       return(ret);
+       }
 #endif
 
 int DHparams_print(BIO *bp, const DH *x)
@@ -315,20 +451,20 @@ err:
 #ifndef OPENSSL_NO_DSA
 #ifndef OPENSSL_NO_FP_API
 int DSAparams_print_fp(FILE *fp, const DSA *x)
-        {
-        BIO *b;
-        int ret;
+       {
+       BIO *b;
+       int ret;
 
-        if ((b=BIO_new(BIO_s_file())) == NULL)
+       if ((b=BIO_new(BIO_s_file())) == NULL)
                {
                DSAerr(DSA_F_DSAPARAMS_PRINT_FP,ERR_R_BUF_LIB);
-                return(0);
+               return(0);
                }
-        BIO_set_fp(b,fp,BIO_NOCLOSE);
-        ret=DSAparams_print(b, x);
-        BIO_free(b);
-        return(ret);
-        }
+       BIO_set_fp(b,fp,BIO_NOCLOSE);
+       ret=DSAparams_print(b, x);
+       BIO_free(b);
+       return(ret);
+       }
 #endif
 
 int DSAparams_print(BIO *bp, const DSA *x)
@@ -359,3 +495,87 @@ err:
 
 #endif /* !OPENSSL_NO_DSA */
 
+#ifndef OPENSSL_NO_ECDSA
+#ifndef OPENSSL_NO_FP_API
+int ECDSAParameters_print_fp(FILE *fp, const ECDSA *x)
+       {
+       BIO *b;
+       int ret;
+       if ((b=BIO_new(BIO_s_file())) == NULL)
+       {
+               ECDSAerr(ECDSA_F_ECDSAPARAMETERS_PRINT_FP, ERR_R_BIO_LIB);
+               return(0);
+       }
+       BIO_set_fp(b, fp, BIO_NOCLOSE);
+       ret = ECDSAParameters_print(b, x);
+       BIO_free(b);
+       return(ret);
+       }
+#endif
+
+int ECDSAParameters_print(BIO *bp, const ECDSA *x)
+       {
+       unsigned char *buffer=NULL;
+       int     buf_len;
+       int     reason=ERR_R_EC_LIB, i, ret=0;
+       BIGNUM  *tmp_1=NULL, *tmp_2=NULL, *tmp_3=NULL, *tmp_4=NULL;
+       BN_CTX  *ctx=NULL;
+       EC_POINT *point=NULL;
+       /* TODO: fields other than prime fields */
+       if (!x || !x->group)
+       {
+               reason = ECDSA_R_MISSING_PARAMETERS;
+               goto err;
+       }
+       if ((tmp_1 = BN_new()) == NULL || (tmp_2 = BN_new()) == NULL ||
+          (tmp_3 = BN_new()) == NULL || (ctx = BN_CTX_new()) == NULL)
+       {
+               reason = ERR_R_MALLOC_FAILURE;
+               goto err;
+       }
+       if (!EC_GROUP_get_curve_GFp(x->group, tmp_1, tmp_2, tmp_3, ctx)) goto err;
+       if ((point = EC_GROUP_get0_generator(x->group)) == NULL) goto err;
+       buf_len = EC_POINT_point2oct(x->group, point, POINT_CONVERSION_COMPRESSED, NULL, 0, ctx);
+       if (!buf_len || (buffer = OPENSSL_malloc(buf_len)) == NULL)
+       {
+               reason = ERR_R_MALLOC_FAILURE;
+               goto err;
+       }
+       if (!EC_POINT_point2oct(x->group, point, POINT_CONVERSION_COMPRESSED, buffer, buf_len, ctx))
+       {
+               reason = ERR_R_EC_LIB;
+               goto err;
+       }
+       if ((tmp_4 = BN_bin2bn(buffer, buf_len, NULL)) == NULL)
+       {
+               reason = ERR_R_BN_LIB;
+               goto err;
+       }
+  
+       i = BN_num_bits(tmp_1) + 10;
+       if (i > buf_len && (buffer = OPENSSL_realloc(buffer, i)) == NULL)
+       {
+               reason=ERR_R_MALLOC_FAILURE;
+               goto err;
+       }
+       if (BIO_printf(bp, "ECDSA-Parameters: (%d bit)\n", BN_num_bits(tmp_1)) <= 0) goto err;
+       if (!print(bp, "Prime p:", tmp_1, buffer, 4)) goto err;
+       if (!print(bp, "Curve a:", tmp_2, buffer, 4)) goto err;
+       if (!print(bp, "Curve b:", tmp_3, buffer, 4)) goto err;
+       if (!print(bp, "Generator ( compressed ) :", tmp_4, buffer, 4)) goto err; 
+       ret=1;
+err:
+       if (tmp_1)  BN_free(tmp_1);
+       if (tmp_2)  BN_free(tmp_2);
+       if (tmp_3)  BN_free(tmp_3);
+       if (tmp_4)  BN_free(tmp_4);
+       if (ctx)    BN_CTX_free(ctx);
+       if (buffer) OPENSSL_free(buffer);
+       ECDSAerr(ECDSA_F_ECDSAPARAMETERS_PRINT, reason);
+       return(ret);
+       }
+  
+#endif
index 848c29a..bfa58cc 100644 (file)
@@ -134,6 +134,15 @@ int X509_REQ_print(BIO *bp, X509_REQ *x)
                }
        else
 #endif
+#ifndef OPENSSL_NO_ECDSA
+               if (pkey != NULL && pkey->type == EVP_PKEY_ECDSA)
+               {
+                       BIO_printf(bp, "%12sECDSA Public Key: \n","");
+                       ECDSA_print(bp, pkey->pkey.ecdsa, 16);
+               }
+       else
+#endif
+
                BIO_printf(bp,"%12sUnknown Public Key:\n","");
 
        if (pkey != NULL)
index 5abfbc8..8682111 100644 (file)
@@ -93,6 +93,15 @@ int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki)
                }
                else
 #endif
+#ifndef OPENSSL_NO_ECDSA
+               if (pkey->type == EVP_PKEY_ECDSA)
+               {
+                       BIO_printf(out, "  ECDSA Public Key:\n");
+                       ECDSA_print(out, pkey->pkey.ecdsa,2);
+               }
+               else
+#endif
+
                        BIO_printf(out,"  Unknown Public Key:\n");
                EVP_PKEY_free(pkey);
        }
index 5de4833..ae6d5ce 100644 (file)
@@ -66,6 +66,9 @@
 #ifndef OPENSSL_NO_DSA
 #include <openssl/dsa.h>
 #endif
+#ifndef OPENSSL_NO_ECDSA
+#include <openssl/ecdsa.h>
+#endif
 #include <openssl/objects.h>
 #include <openssl/x509.h>
 #include <openssl/x509v3.h>
@@ -228,6 +231,14 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
                        DSA_print(bp,pkey->pkey.dsa,16);
                        }
                else
+#endif
+#ifndef OPENSSL_NO_ECDSA
+               if (pkey->type == EVP_PKEY_ECDSA)
+                       {
+                       BIO_printf(bp, "%12sECDSA Public Key:\n","");
+                       ECDSA_print(bp, pkey->pkey.ecdsa, 16);
+                       }
+               else
 #endif
                        BIO_printf(bp,"%12sUnknown Public Key:\n","");
 
index 5563029..227b0ce 100644 (file)
 
 /* Minor tweak to operation: free up EVP_PKEY */
 static int pubkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
-{
-       if(operation == ASN1_OP_FREE_POST) {
+       {
+       if (operation == ASN1_OP_FREE_POST)
+               {
                X509_PUBKEY *pubkey = (X509_PUBKEY *)*pval;
                EVP_PKEY_free(pubkey->pkey);
-       }
+               }
        return 1;
-}
+       }
 
 ASN1_SEQUENCE_cb(X509_PUBKEY, pubkey_cb) = {
        ASN1_SIMPLE(X509_PUBKEY, algor, X509_ALGOR),
@@ -108,13 +109,12 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
                        a->parameter->type=V_ASN1_NULL;
                        }
                }
-       else
 #ifndef OPENSSL_NO_DSA
-               if (pkey->type == EVP_PKEY_DSA)
+       else if (pkey->type == EVP_PKEY_DSA)
                {
                unsigned char *pp;
                DSA *dsa;
-
+               
                dsa=pkey->pkey.dsa;
                dsa->write_params=0;
                ASN1_TYPE_free(a->parameter);
@@ -128,8 +128,51 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
                ASN1_STRING_set(a->parameter->value.sequence,p,i);
                OPENSSL_free(p);
                }
-       else
 #endif
+#ifndef OPENSSL_NO_ECDSA
+       else if (pkey->type == EVP_PKEY_ECDSA)
+               {
+               unsigned char *pp;
+               ECDSA *ecdsa;
+               
+               ecdsa = pkey->pkey.ecdsa;
+               ecdsa->write_params=0;
+               ASN1_TYPE_free(a->parameter);
+               if ((i = i2d_ECDSAParameters(ecdsa, NULL)) == 0)
+                       {
+                       X509err(X509_F_X509_PUBKEY_SET, ERR_R_ECDSA_LIB);
+                       goto err;
+                       }
+               if ((p = (unsigned char *) OPENSSL_malloc(i)) == NULL)
+                       {
+                       X509err(X509_F_X509_PUBKEY_SET, ERR_R_MALLOC_FAILURE);
+                       goto err;
+                       }       
+               pp = p;
+               if (!i2d_ECDSAParameters(ecdsa, &pp))
+                       {
+                       X509err(X509_F_X509_PUBKEY_SET, ERR_R_ECDSA_LIB);
+                       OPENSSL_free(p);
+                       goto err;
+                       }
+               if ((a->parameter = ASN1_TYPE_new()) == NULL)
+                       {
+                       X509err(X509_F_X509_PUBKEY_SET, ERR_R_ASN1_LIB);
+                       OPENSSL_free(p);
+                       goto err;
+                       }
+               a->parameter->type = V_ASN1_SEQUENCE;
+               if ((a->parameter->value.sequence = ASN1_STRING_new()) == NULL)
+                       {
+                       X509err(X509_F_X509_PUBKEY_SET, ERR_R_ASN1_LIB);
+                       OPENSSL_free(p);
+                       goto err;
+                       }
+               ASN1_STRING_set(a->parameter->value.sequence, p, i);
+               OPENSSL_free(p);
+               }
+#endif
+       else if (1)
                {
                X509err(X509_F_X509_PUBKEY_SET,X509_R_UNSUPPORTED_ALGORITHM);
                goto err;
@@ -177,40 +220,79 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
        if (key == NULL) goto err;
 
        if (key->pkey != NULL)
-           {
-           CRYPTO_add(&key->pkey->references,1,CRYPTO_LOCK_EVP_PKEY);
-           return(key->pkey);
-           }
+               {
+               CRYPTO_add(&key->pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
+               return(key->pkey);
+               }
 
        if (key->public_key == NULL) goto err;
 
        type=OBJ_obj2nid(key->algor->algorithm);
-       p=key->public_key->data;
-        j=key->public_key->length;
-        if ((ret=d2i_PublicKey(type,NULL,&p,(long)j)) == NULL)
+       if ((ret = EVP_PKEY_new()) == NULL)
                {
-               X509err(X509_F_X509_PUBKEY_GET,X509_R_ERR_ASN1_LIB);
+               X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);
                goto err;
                }
-       ret->save_parameters=0;
+       ret->type = EVP_PKEY_type(type);
 
-#ifndef OPENSSL_NO_DSA
+       /* the parameters must be extracted before the public key (ECDSA!) */
+       
        a=key->algor;
-       if (ret->type == EVP_PKEY_DSA)
+
+       if (0)
+               ;
+#ifndef OPENSSL_NO_DSA
+       else if (ret->type == EVP_PKEY_DSA)
                {
                if (a->parameter && (a->parameter->type == V_ASN1_SEQUENCE))
                        {
+                       if ((ret->pkey.dsa = DSA_new()) == NULL)
+                               {
+                               X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);
+                               goto err;
+                               }
                        ret->pkey.dsa->write_params=0;
                        cp=p=a->parameter->value.sequence->data;
                        j=a->parameter->value.sequence->length;
-                       if (!d2i_DSAparams(&ret->pkey.dsa,&cp,(long)j))
+                       if (!d2i_DSAparams(&ret->pkey.dsa, &cp, (long)j))
                                goto err;
                        }
                ret->save_parameters=1;
                }
 #endif
-       key->pkey=ret;
-       CRYPTO_add(&ret->references,1,CRYPTO_LOCK_EVP_PKEY);
+#ifndef OPENSSL_NO_ECDSA
+       else if (ret->type == EVP_PKEY_ECDSA)
+               {
+               if (a->parameter && (a->parameter->type == V_ASN1_SEQUENCE))
+                       {
+                       if ((ret->pkey.ecdsa= ECDSA_new()) == NULL)
+                               {
+                               X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);
+                               goto err;
+                               }
+                       ret->pkey.ecdsa->write_params = 0;
+                       cp = p = a->parameter->value.sequence->data;
+                       j = a->parameter->value.sequence->length;
+                       if (!d2i_ECDSAParameters(&ret->pkey.ecdsa, &cp, (long)j))
+                               {
+                               X509err(X509_F_X509_PUBKEY_GET, ERR_R_ECDSA_LIB);
+                               goto err;
+                               }
+                       }
+               ret->save_parameters = 1;
+               }
+#endif
+
+       p=key->public_key->data;
+        j=key->public_key->length;
+        if ((ret = d2i_PublicKey(type, &ret, &p, (long)j)) == NULL)
+               {
+               X509err(X509_F_X509_PUBKEY_GET, X509_R_ERR_ASN1_LIB);
+               goto err;
+               }
+
+       key->pkey = ret;
+       CRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY);
        return(ret);
 err:
        if (ret != NULL)
@@ -224,7 +306,7 @@ err:
 
 EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, unsigned char **pp,
             long length)
-{
+       {
        X509_PUBKEY *xpk;
        EVP_PKEY *pktmp;
        xpk = d2i_X509_PUBKEY(NULL, pp, length);
@@ -232,15 +314,16 @@ EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, unsigned char **pp,
        pktmp = X509_PUBKEY_get(xpk);
        X509_PUBKEY_free(xpk);
        if(!pktmp) return NULL;
-       if(a) {
+       if(a)
+               {
                EVP_PKEY_free(*a);
                *a = pktmp;
-       }
+               }
        return pktmp;
-}
+       }
 
 int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp)
-{
+       {
        X509_PUBKEY *xpk=NULL;
        int ret;
        if(!a) return 0;
@@ -248,7 +331,7 @@ int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp)
        ret = i2d_X509_PUBKEY(xpk, pp);
        X509_PUBKEY_free(xpk);
        return ret;
-}
+       }
 
 /* The following are equivalents but which return RSA and DSA
  * keys
@@ -256,75 +339,117 @@ int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp)
 #ifndef OPENSSL_NO_RSA
 RSA *d2i_RSA_PUBKEY(RSA **a, unsigned char **pp,
             long length)
-{
+       {
        EVP_PKEY *pkey;
        RSA *key;
        unsigned char *q;
        q = *pp;
        pkey = d2i_PUBKEY(NULL, &q, length);
-       if(!pkey) return NULL;
+       if (!pkey) return NULL;
        key = EVP_PKEY_get1_RSA(pkey);
        EVP_PKEY_free(pkey);
-       if(!key) return NULL;
+       if (!key) return NULL;
        *pp = q;
-       if(a) {
+       if (a)
+               {
                RSA_free(*a);
                *a = key;
-       }
+               }
        return key;
-}
+       }
 
 int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp)
-{
+       {
        EVP_PKEY *pktmp;
        int ret;
-       if(!a) return 0;
+       if (!a) return 0;
        pktmp = EVP_PKEY_new();
-       if(!pktmp) {
+       if (!pktmp)
+               {
                ASN1err(ASN1_F_I2D_RSA_PUBKEY, ERR_R_MALLOC_FAILURE);
                return 0;
-       }
+               }
        EVP_PKEY_set1_RSA(pktmp, a);
        ret = i2d_PUBKEY(pktmp, pp);
        EVP_PKEY_free(pktmp);
        return ret;
-}
+       }
 #endif
 
 #ifndef OPENSSL_NO_DSA
 DSA *d2i_DSA_PUBKEY(DSA **a, unsigned char **pp,
             long length)
-{
+       {
        EVP_PKEY *pkey;
        DSA *key;
        unsigned char *q;
        q = *pp;
        pkey = d2i_PUBKEY(NULL, &q, length);
-       if(!pkey) return NULL;
+       if (!pkey) return NULL;
        key = EVP_PKEY_get1_DSA(pkey);
        EVP_PKEY_free(pkey);
-       if(!key) return NULL;
+       if (!key) return NULL;
        *pp = q;
-       if(a) {
+       if (a)
+               {
                DSA_free(*a);
                *a = key;
-       }
+               }
        return key;
-}
+       }
 
 int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp)
-{
+       {
        EVP_PKEY *pktmp;
        int ret;
        if(!a) return 0;
        pktmp = EVP_PKEY_new();
-       if(!pktmp) {
+       if(!pktmp)
+               {
                ASN1err(ASN1_F_I2D_DSA_PUBKEY, ERR_R_MALLOC_FAILURE);
                return 0;
-       }
+               }
        EVP_PKEY_set1_DSA(pktmp, a);
        ret = i2d_PUBKEY(pktmp, pp);
        EVP_PKEY_free(pktmp);
        return ret;
-}
+       }
+#endif
+
+#ifndef OPENSSL_NO_ECDSA
+ECDSA *d2i_ECDSA_PUBKEY(ECDSA **a, unsigned char **pp, long length)
+       {
+       EVP_PKEY *pkey;
+       ECDSA *key;
+       unsigned char *q;
+       q = *pp;
+       pkey = d2i_PUBKEY(NULL, &q, length);
+       if (!pkey) return(NULL);
+       key = EVP_PKEY_get1_ECDSA(pkey);
+       EVP_PKEY_free(pkey);
+       if (!key)  return(NULL);
+       *pp = q;
+       if (a)
+               {
+               ECDSA_free(*a);
+               *a = key;
+               }
+       return(key);
+       }
+
+int i2d_ECDSA_PUBKEY(ECDSA *a, unsigned char **pp)
+       {
+       EVP_PKEY *pktmp;
+       int ret;
+       if (!a) return(0);
+       if ((pktmp = EVP_PKEY_new()) == NULL)
+               {
+               ASN1err(ASN1_F_I2D_ECDSA_PUBKEY, ERR_R_MALLOC_FAILURE);
+               return(0);
+               }
+       EVP_PKEY_set1_ECDSA(pktmp, a);
+       ret = i2d_PUBKEY(pktmp, pp);
+       EVP_PKEY_free(pktmp);
+       return(ret);
+       }
 #endif
index 554d032..81cbbc0 100644 (file)
@@ -110,14 +110,15 @@ conf_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
 conf_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 conf_lib.o: conf_lib.c
 conf_mall.o: ../../e_os.h ../../include/openssl/asn1.h
-conf_mall.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-conf_mall.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
-conf_mall.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
-conf_mall.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
-conf_mall.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
-conf_mall.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-conf_mall.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-conf_mall.o: ../../include/openssl/objects.h
+conf_mall.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+conf_mall.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+conf_mall.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+conf_mall.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
+conf_mall.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
+conf_mall.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+conf_mall.o: ../../include/openssl/engine.h ../../include/openssl/err.h
+conf_mall.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+conf_mall.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 conf_mall.o: ../../include/openssl/opensslconf.h
 conf_mall.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 conf_mall.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
@@ -127,14 +128,15 @@ conf_mall.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
 conf_mall.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 conf_mall.o: ../cryptlib.h conf_mall.c
 conf_mod.o: ../../e_os.h ../../include/openssl/asn1.h
-conf_mod.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-conf_mod.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
-conf_mod.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
-conf_mod.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
-conf_mod.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
-conf_mod.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
-conf_mod.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-conf_mod.o: ../../include/openssl/opensslconf.h
+conf_mod.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+conf_mod.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+conf_mod.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
+conf_mod.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
+conf_mod.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
+conf_mod.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+conf_mod.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+conf_mod.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+conf_mod.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 conf_mod.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 conf_mod.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
 conf_mod.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
index 9dddf8d..16a09d7 100644 (file)
@@ -112,10 +112,12 @@ dh_gen.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 dh_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
 dh_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 dh_gen.o: ../cryptlib.h dh_gen.c
-dh_key.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+dh_key.o: ../../e_os.h ../../include/openssl/asn1.h
+dh_key.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 dh_key.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 dh_key.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 dh_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+dh_key.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 dh_key.o: ../../include/openssl/engine.h ../../include/openssl/err.h
 dh_key.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
 dh_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
@@ -123,10 +125,12 @@ dh_key.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
 dh_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 dh_key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
 dh_key.o: ../cryptlib.h dh_key.c
-dh_lib.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+dh_lib.o: ../../e_os.h ../../include/openssl/asn1.h
+dh_lib.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 dh_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 dh_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 dh_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+dh_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
 dh_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h
 dh_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
 dh_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
index e780ee4..2680a10 100644 (file)
@@ -121,49 +121,54 @@ dsa_key.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
 dsa_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 dsa_key.o: ../cryptlib.h dsa_key.c
 dsa_lib.o: ../../e_os.h ../../include/openssl/asn1.h
-dsa_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-dsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-dsa_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-dsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
-dsa_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
-dsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
-dsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
-dsa_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
-dsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-dsa_lib.o: ../../include/openssl/ui.h ../cryptlib.h dsa_lib.c
+dsa_lib.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+dsa_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+dsa_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+dsa_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+dsa_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+dsa_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h
+dsa_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
+dsa_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+dsa_lib.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
+dsa_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+dsa_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
+dsa_lib.o: ../cryptlib.h dsa_lib.c
 dsa_ossl.o: ../../e_os.h ../../include/openssl/asn1.h
-dsa_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-dsa_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-dsa_ossl.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-dsa_ossl.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
-dsa_ossl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
-dsa_ossl.o: ../../include/openssl/opensslconf.h
+dsa_ossl.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+dsa_ossl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+dsa_ossl.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+dsa_ossl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+dsa_ossl.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+dsa_ossl.o: ../../include/openssl/engine.h ../../include/openssl/err.h
+dsa_ossl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
 dsa_ossl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 dsa_ossl.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
 dsa_ossl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 dsa_ossl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
 dsa_ossl.o: ../cryptlib.h dsa_ossl.c
 dsa_sign.o: ../../e_os.h ../../include/openssl/asn1.h
-dsa_sign.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
-dsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-dsa_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-dsa_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
-dsa_sign.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
-dsa_sign.o: ../../include/openssl/opensslconf.h
+dsa_sign.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+dsa_sign.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+dsa_sign.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+dsa_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+dsa_sign.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+dsa_sign.o: ../../include/openssl/engine.h ../../include/openssl/err.h
+dsa_sign.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
 dsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 dsa_sign.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
 dsa_sign.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 dsa_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
 dsa_sign.o: ../cryptlib.h dsa_sign.c
 dsa_vrf.o: ../../e_os.h ../../include/openssl/asn1.h
-dsa_vrf.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
-dsa_vrf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-dsa_vrf.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
-dsa_vrf.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
-dsa_vrf.o: ../../include/openssl/engine.h ../../include/openssl/err.h
-dsa_vrf.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
-dsa_vrf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
-dsa_vrf.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
-dsa_vrf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-dsa_vrf.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
-dsa_vrf.o: ../cryptlib.h dsa_vrf.c
+dsa_vrf.o: ../../include/openssl/asn1_mac.h ../../include/openssl/asn1t.h
+dsa_vrf.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+dsa_vrf.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+dsa_vrf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
+dsa_vrf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+dsa_vrf.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
+dsa_vrf.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
+dsa_vrf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
+dsa_vrf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
+dsa_vrf.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+dsa_vrf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+dsa_vrf.o: ../../include/openssl/ui.h ../cryptlib.h dsa_vrf.c
index 45b0ec3..3daeb19 100644 (file)
@@ -1,6 +1,6 @@
 /* crypto/ec/ec_cvt.c */
 /* ====================================================================
- * Copyright (c) 1998-2001 The OpenSSL Project.  All rights reserved.
+ * Copyright (c) 1998-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
index 9862050..2199d92 100644 (file)
@@ -1,6 +1,6 @@
 /* crypto/ec/ec_err.c */
 /* ====================================================================
- * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
+ * Copyright (c) 2001 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
index 5cbc687..2b1e491 100644 (file)
@@ -1,6 +1,6 @@
 /* crypto/ec/ec_lib.c */
 /* ====================================================================
- * Copyright (c) 1998-2001 The OpenSSL Project.  All rights reserved.
+ * Copyright (c) 1998-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
diff --git a/crypto/ecdsa/.cvsignore b/crypto/ecdsa/.cvsignore
new file mode 100644 (file)
index 0000000..c6d03a9
--- /dev/null
@@ -0,0 +1,2 @@
+lib
+Makefile.save
diff --git a/crypto/ecdsa/Makefile.ssl b/crypto/ecdsa/Makefile.ssl
new file mode 100644 (file)
index 0000000..d0166d0
--- /dev/null
@@ -0,0 +1,174 @@
+#
+# crypto/ecdsa/Makefile
+#
+
+DIR=   ecdsa
+TOP=   ../..
+CC=    cc
+INCLUDES= -I.. -I$(TOP) -I../../include
+CFLAG=-g -Wall
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
+INSTALLTOP=/usr/local/ssl
+MAKE=          make -f Makefile.ssl
+MAKEDEPPROG=   makedepend
+MAKEDEPEND=    $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
+MAKEFILE=      Makefile.ssl
+AR=            ar r
+
+CFLAGS= $(INCLUDES) $(CFLAG)
+
+GENERAL=Makefile
+TEST=ecdsatest.c
+APPS=
+
+LIB=$(TOP)/libcrypto.a
+LIBSRC=        ecs_lib.c ecs_gen.c ecs_asn1.c ecs_ossl.c ecs_sign.c ecs_vrf.c \
+       ecs_key.c ecs_err.c 
+
+LIBOBJ=        ecs_lib.o ecs_gen.o ecs_asn1.o ecs_ossl.o ecs_sign.o ecs_vrf.o \
+       ecs_key.o ecs_err.o 
+
+SRC= $(LIBSRC)
+
+EXHEADER= ecdsa.h
+HEADER=        ecs_locl.h $(EXHEADER)
+
+ALL=    $(GENERAL) $(SRC) $(HEADER)
+
+top:
+       (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
+
+all:   lib
+
+lib:   $(LIBOBJ)
+       $(AR) $(LIB) $(LIBOBJ)
+       $(RANLIB) $(LIB) || echo Never mind.
+       @touch lib
+
+files:
+       $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
+
+links:
+       @$(TOP)/util/point.sh Makefile.ssl Makefile
+       @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
+       @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
+       @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
+
+install:
+       @for i in $(EXHEADER) ; \
+       do  \
+       (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+       chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
+       done;
+
+tags:
+       ctags $(SRC)
+
+tests:
+
+lint:
+       lint -DLINT $(INCLUDES) $(SRC)>fluff
+
+depend:
+       $(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
+
+dclean:
+       $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
+       mv -f Makefile.new $(MAKEFILE)
+
+clean:
+       rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+ecs_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
+ecs_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+ecs_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+ecs_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+ecs_asn1.o: ../../include/openssl/ec.h ../../include/openssl/err.h
+ecs_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+ecs_asn1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+ecs_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+ecs_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+ecs_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h ecdsa.h ecs_asn1.c
+ecs_asn1.o: ecs_locl.h
+ecs_err.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
+ecs_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+ecs_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+ecs_err.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+ecs_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
+ecs_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
+ecs_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
+ecs_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+ecs_err.o: ecs_err.c
+ecs_gen.o: ../../e_os.h ../../include/openssl/asn1.h
+ecs_gen.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+ecs_gen.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+ecs_gen.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+ecs_gen.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+ecs_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+ecs_gen.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+ecs_gen.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+ecs_gen.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+ecs_gen.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
+ecs_gen.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+ecs_gen.o: ../../include/openssl/symhacks.h ../cryptlib.h ecs_gen.c
+ecs_key.o: ../../e_os.h ../../include/openssl/asn1.h
+ecs_key.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+ecs_key.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+ecs_key.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+ecs_key.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+ecs_key.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
+ecs_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
+ecs_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
+ecs_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+ecs_key.o: ../cryptlib.h ecs_key.c
+ecs_lib.o: ../../e_os.h ../../include/openssl/asn1.h
+ecs_lib.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+ecs_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+ecs_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+ecs_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+ecs_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+ecs_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h
+ecs_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
+ecs_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+ecs_lib.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
+ecs_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+ecs_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
+ecs_lib.o: ../cryptlib.h ecdsa.h ecs_lib.c ecs_locl.h
+ecs_ossl.o: ../../e_os.h ../../include/openssl/asn1.h
+ecs_ossl.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+ecs_ossl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+ecs_ossl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+ecs_ossl.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+ecs_ossl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
+ecs_ossl.o: ../../include/openssl/opensslconf.h
+ecs_ossl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+ecs_ossl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+ecs_ossl.o: ../../include/openssl/symhacks.h ../cryptlib.h ecs_ossl.c
+ecs_sign.o: ../../e_os.h ../../include/openssl/asn1.h
+ecs_sign.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
+ecs_sign.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
+ecs_sign.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+ecs_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+ecs_sign.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+ecs_sign.o: ../../include/openssl/engine.h ../../include/openssl/err.h
+ecs_sign.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
+ecs_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+ecs_sign.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
+ecs_sign.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+ecs_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
+ecs_sign.o: ../cryptlib.h ecs_sign.c
+ecs_vrf.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
+ecs_vrf.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+ecs_vrf.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+ecs_vrf.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
+ecs_vrf.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
+ecs_vrf.o: ../../include/openssl/engine.h ../../include/openssl/err.h
+ecs_vrf.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
+ecs_vrf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+ecs_vrf.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
+ecs_vrf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+ecs_vrf.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
+ecs_vrf.o: ecs_vrf.c
diff --git a/crypto/ecdsa/ecdsa.h b/crypto/ecdsa/ecdsa.h
new file mode 100644 (file)
index 0000000..ca1ca64
--- /dev/null
@@ -0,0 +1,266 @@
+/* crypto/ecdsa/ecdsa.h */
+/* ====================================================================
+ * Copyright (c) 2000-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
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+#ifndef HEADER_ECDSA_H
+#define HEADER_ECDSA_H
+
+#ifdef OPENSSL_NO_ECDSA
+#error ECDSA is disabled.
+#endif
+
+#ifndef OPENSSL_NO_BIO
+#include <openssl/bio.h>
+#endif
+#include <openssl/bn.h>
+#include <openssl/ec.h>
+#include <openssl/crypto.h>
+#include <openssl/ossl_typ.h>
+#include <openssl/asn1.h>
+#include <openssl/asn1t.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct ecdsa_st ECDSA;
+
+typedef struct ECDSA_SIG_st
+{
+       BIGNUM *r;
+       BIGNUM *s;
+} ECDSA_SIG;
+
+typedef struct ecdsa_method 
+{
+       const char *name;
+       ECDSA_SIG *(*ecdsa_do_sign)(const unsigned char *dgst, int dgst_len, ECDSA *ecdsa);
+       int (*ecdsa_sign_setup)(ECDSA *ecdsa, BN_CTX *ctx, BIGNUM **kinv, BIGNUM **r);
+       int (*ecdsa_do_verify)(const unsigned char *dgst, int dgst_len, ECDSA_SIG *sig, ECDSA *ecdsa);
+       int (*init)(ECDSA *ecdsa);
+       int (*finish)(ECDSA *ecdsa);
+       int flags;
+       char *app_data;
+} ECDSA_METHOD;
+
+#define ECDSA_FLAG_NAMED_CURVE 1
+#define ECDSA_FLAG_IMPLICITLYCA        2
+
+struct ecdsa_st
+{
+       int version;
+       int write_params;
+
+       EC_GROUP *group;
+
+       EC_POINT *pub_key;
+       BIGNUM   *priv_key;
+
+       BIGNUM   *kinv; /* signing pre-calc */
+       BIGNUM   *r;    /* signing pre-calc */
+
+       unsigned char *seed;    /* seed for curve generation */
+       unsigned int  seed_len; 
+
+       int     parameter_flags;
+
+       int     references;
+       int     flags;
+       CRYPTO_EX_DATA ex_data;
+       const ECDSA_METHOD *meth;
+       struct engine_st *engine;
+};
+
+ECDSA_SIG *ECDSA_SIG_new(void);
+void     ECDSA_SIG_free(ECDSA_SIG *a);
+int      i2d_ECDSA_SIG(const ECDSA_SIG *a, unsigned char **pp);
+ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **v, const unsigned char **pp, long length);
+
+ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst, const int dgst_len, ECDSA *ecdsa);
+int      ECDSA_do_verify(const unsigned char *dgst, const int dgst_len, ECDSA_SIG *sig, ECDSA* ecdsa);
+int      ECDSA_generate_key(ECDSA *ecdsa);
+int      ECDSA_check_key(ECDSA *ecdsa);
+
+const ECDSA_METHOD *ECDSA_OpenSSL(void);
+
+void     ECDSA_set_default_method(const ECDSA_METHOD *);
+const ECDSA_METHOD *ECDSA_get_default_openssl_method(void);
+int      ECDSA_set_method(ECDSA *, const ECDSA_METHOD *);
+
+ECDSA    *ECDSA_new();
+ECDSA    *ECDSA_new_method(ENGINE *engine);
+int      ECDSA_size(const ECDSA *);
+int      ECDSA_sign_setup(ECDSA *ecdsa, BN_CTX *ctx, BIGNUM **kinv, BIGNUM **rp);
+int      ECDSA_sign(int type, const unsigned char *dgst, int dgst_len, unsigned char *sig, 
+                    unsigned int *siglen, ECDSA *ecdsa);
+int      ECDSA_verify(int type, const unsigned char *dgst, int dgst_len, const unsigned char *sig,
+                      const int sig_len, ECDSA *ecdsa);
+int      ECDSA_up_ref(ECDSA *ecdsa);
+void     ECDSA_free(ECDSA *a);
+int      ECDSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
+                                CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+int      ECDSA_set_ex_data(ECDSA *d, int idx, void *arg);
+void     *ECDSA_get_ex_data(ECDSA *d, int idx);
+
+#ifndef OPENSSL_NO_BIO
+int    ECDSAParameters_print(BIO *bp, const ECDSA *x);
+int    ECDSA_print(BIO *bp, const ECDSA *x, int off);
+#endif
+#ifndef OPENSSL_NO_FP_API
+int    ECDSAParameters_print_fp(FILE *fp, const ECDSA *x);
+int    ECDSA_print_fp(FILE *fp, const ECDSA *x, int off);
+#endif 
+
+void   ECDSA_set_parameter_flags(ECDSA *, int);
+int    ECDSA_get_parameter_flags(const ECDSA*);
+
+/* the basic de- and encode functions ( see ecs_asn1.c ) */
+ECDSA   *d2i_ECDSAParameters(ECDSA **a, const unsigned char **in, long len);
+int     i2d_ECDSAParameters(ECDSA *a, unsigned char **out);
+
+ECDSA   *d2i_ECDSAPrivateKey(ECDSA **a, const unsigned char **in, long len);
+int     i2d_ECDSAPrivateKey(ECDSA *a, unsigned char **out);
+
+ECDSA   *d2i_ECDSAPublicKey(ECDSA **a, const unsigned char **in, long len);
+int     i2d_ECDSAPublicKey(ECDSA *a, unsigned char **out);
+
+
+#define ECDSAParameters_dup(x) (ECDSA *)ASN1_dup((int (*)())i2d_ECDSAParameters, \
+               (char *(*)())d2i_ECDSAParameters,(char *)(x))
+#define d2i_ECDSAParameters_fp(fp,x) (ECDSA *)ASN1_d2i_fp((char *(*)())ECDSA_new, \
+               (char *(*)())d2i_ECDSAParameters,(fp),(unsigned char **)(x))
+#define i2d_ECDSAParameters_fp(fp,x) ASN1_i2d_fp(i2d_ECDSAParameters,(fp), \
+               (unsigned char *)(x))
+#define d2i_ECDSAParameters_bio(bp,x) (ECDSA *)ASN1_d2i_bio((char *(*)())ECDSA_new, \
+               (char *(*)())d2i_ECDSAParameters,(bp),(unsigned char **)(x))
+#define i2d_ECDSAParameters_bio(bp,x) ASN1_i2d_bio(i2d_ECDSAParameters,(bp), \
+               (unsigned char *)(x))
+
+/* BEGIN ERROR CODES */
+/* The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+
+/* Error codes for the ECDSA functions. */
+
+/* Function codes. */
+#define ECDSA_F_D2I_ECDSAPARAMETERS                     100
+#define ECDSA_F_D2I_ECDSAPRIVATEKEY                     101
+#define ECDSA_F_ECDSAPARAMETERS_PRINT                   102
+#define ECDSA_F_ECDSAPARAMETERS_PRINT_FP                103
+#define ECDSA_F_ECDSA_DO_SIGN                           104
+#define ECDSA_F_ECDSA_DO_VERIFY                                 105
+#define ECDSA_F_ECDSA_GENERATE_KEY                      106
+#define ECDSA_F_ECDSA_GET                               107
+#define ECDSA_F_ECDSA_GET_CURVE_NID                     120
+#define ECDSA_F_ECDSA_GET_ECDSA                                 121
+#define ECDSA_F_ECDSA_GET_EC_PARAMETERS                         122
+#define ECDSA_F_ECDSA_GET_X9_62_CURVE                   108
+#define ECDSA_F_ECDSA_GET_X9_62_EC_PARAMETERS           109
+#define ECDSA_F_ECDSA_GET_X9_62_FIELDID                         110
+#define ECDSA_F_ECDSA_NEW                               111
+#define ECDSA_F_ECDSA_PRINT                             112
+#define ECDSA_F_ECDSA_PRINT_FP                          113
+#define ECDSA_F_ECDSA_SET_GROUP_P                       114
+#define ECDSA_F_ECDSA_SET_PRIME_GROUP                   123
+#define ECDSA_F_ECDSA_SIGN_SETUP                        115
+#define ECDSA_F_I2D_ECDSAPARAMETERS                     116
+#define ECDSA_F_I2D_ECDSAPRIVATEKEY                     117
+#define ECDSA_F_I2D_ECDSAPUBLICKEY                      118
+#define ECDSA_F_SIG_CB                                  119
+
+/* Reason codes. */
+#define ECDSA_R_BAD_SIGNATURE                           100
+#define ECDSA_R_CAN_NOT_GET_GENERATOR                   101
+#define ECDSA_R_D2I_ECDSAPRIVATEKEY_MISSING_PRIVATE_KEY         102
+#define ECDSA_R_D2I_ECDSA_PRIVATEKEY_FAILURE            103
+#define ECDSA_R_D2I_EC_PARAMETERS_FAILURE               133
+#define ECDSA_R_D2I_X9_62_EC_PARAMETERS_FAILURE                 104
+#define ECDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE             105
+#define ECDSA_R_ECDSAPRIVATEKEY_NEW_FAILURE             106
+#define ECDSA_R_ECDSA_F_ECDSA_NEW                       107
+#define ECDSA_R_ECDSA_GET_EC_PARAMETERS_FAILURE                 134
+#define ECDSA_R_ECDSA_GET_FAILURE                       108
+#define ECDSA_R_ECDSA_GET_X9_62_CURVE_FAILURE           109
+#define ECDSA_R_ECDSA_GET_X9_62_EC_PARAMETERS_FAILURE   110
+#define ECDSA_R_ECDSA_GET_X9_62_FIELDID_FAILURE                 111
+#define ECDSA_R_ECDSA_NEW_FAILURE                       112
+#define ECDSA_R_ECDSA_R_D2I_EC_PARAMETERS_FAILURE       135
+#define ECDSA_R_ECDSA_R_D2I_X9_62_EC_PARAMETERS_FAILURE         113
+#define ECDSA_R_ECPARAMETERS2ECDSA_FAILURE              138
+#define ECDSA_R_EC_GROUP_NID2CURVE_FAILURE              136
+#define ECDSA_R_ERR_EC_LIB                              114
+#define ECDSA_R_I2D_ECDSA_PRIVATEKEY                    115
+#define ECDSA_R_I2D_ECDSA_PUBLICKEY                     116
+#define ECDSA_R_MISSING_PARAMETERS                      117
+#define ECDSA_R_NOT_SUPPORTED                           118
+#define ECDSA_R_NO_CURVE_PARAMETER_A_SPECIFIED          119
+#define ECDSA_R_NO_CURVE_PARAMETER_B_SPECIFIED          120
+#define ECDSA_R_NO_CURVE_SPECIFIED                      121
+#define ECDSA_R_NO_FIELD_SPECIFIED                      122
+#define ECDSA_R_PRIME_MISSING                           123
+#define ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED                 124
+#define ECDSA_R_SIGNATURE_MALLOC_FAILED                         125
+#define ECDSA_R_UNEXPECTED_ASN1_TYPE                    126
+#define ECDSA_R_UNEXPECTED_PARAMETER                    127
+#define ECDSA_R_UNEXPECTED_PARAMETER_LENGTH             128
+#define ECDSA_R_UNEXPECTED_VERSION_NUMER                129
+#define ECDSA_R_UNKNOWN_PARAMETERS_TYPE                         137
+#define ECDSA_R_WRONG_FIELD_IDENTIFIER                  130
+#define ECDSA_R_X9_62_CURVE_NEW_FAILURE                         131
+#define ECDSA_R_X9_62_EC_PARAMETERS_NEW_FAILURE                 132
+
+#ifdef  __cplusplus
+}
+#endif
+#endif
diff --git a/crypto/ecdsa/ecdsatest.c b/crypto/ecdsa/ecdsatest.c
new file mode 100644 (file)
index 0000000..1f2cef0
--- /dev/null
@@ -0,0 +1,692 @@
+/* crypto/ecdsa/ecdsatest.c */
+/* ====================================================================
+ * Copyright (c) 2000-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
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <openssl/crypto.h>
+#include <openssl/bio.h>
+#include <openssl/evp.h>
+#include <openssl/x509.h>
+#include <openssl/ecdsa.h>
+#include <openssl/engine.h>
+#include <openssl/err.h>
+
+#ifdef CLOCKS_PER_SEC
+       /* "To determine the time in seconds, the value returned
+        * by the clock function should be divided by the value
+        * of the macro CLOCKS_PER_SEC."
+        *                                       -- ISO/IEC 9899 */
+#      define UNIT "s"
+#else
+       /* "`CLOCKS_PER_SEC' undeclared (first use this function)"
+        *                            -- cc on NeXTstep/OpenStep */
+#      define UNIT "units"
+#      define CLOCKS_PER_SEC 1
+#endif
+
+#ifdef OPENSSL_NO_ECDSA
+int main(int argc, char * argv[]) { puts("Elliptic curves are disabled."); return 0; }
+#else
+
+static BIO *bio_err=NULL;
+static const char rnd_seed[] = "string to make the random number generator think it has entropy";
+
+#define        ECDSA_NIST_TESTS        10
+ECDSA_SIG*     signatures[ECDSA_NIST_TESTS];
+unsigned char  digest[ECDSA_NIST_TESTS][20];
+
+void clear_ecdsa(ECDSA *ecdsa)
+{
+       if (!ecdsa)
+               return;
+       if (ecdsa->group)
+       {
+               EC_GROUP_free(ecdsa->group);
+               ecdsa->group = NULL;
+       }
+       if (ecdsa->pub_key)
+       {
+               EC_POINT_free(ecdsa->pub_key);
+               ecdsa->pub_key = NULL;
+       }
+       if (ecdsa->priv_key)
+       {
+               BN_free(ecdsa->priv_key);
+               ecdsa->priv_key = NULL;
+       }
+}
+
+int set_p192_param(ECDSA *ecdsa)
+{
+       BN_CTX   *ctx=NULL;
+       int      ret=0;
+
+       if (!ecdsa)
+               return 0;
+       if ((ctx = BN_CTX_new()) == NULL) goto err;
+       clear_ecdsa(ecdsa);
+       
+       if ((ecdsa->group = EC_GROUP_get_group_by_name(EC_GROUP_X9_62_PRIME_192V1)) == NULL)
+       {
+               BIO_printf(bio_err,"ECDSA_SET_GROUP_P_192_V1() failed \n");
+               goto err;
+       }
+       if ((ecdsa->pub_key = EC_POINT_new(ecdsa->group)) == NULL)
+       {
+               BIO_printf(bio_err,"EC_POINT_new failed \n");
+               goto err;
+       }
+
+       if (!BN_dec2bn(&(ecdsa->priv_key), "651056770906015076056810763456358567190100156695615665659"))        goto err;
+       if (!EC_POINT_mul(ecdsa->group,ecdsa->pub_key,ecdsa->priv_key,NULL,NULL,ctx))
+       {
+               BIO_printf(bio_err,"EC_POINT_mul() failed \n");
+               goto err;
+       }
+       ret = 1;
+
+err :  if (ctx)        BN_CTX_free(ctx);
+       return ret;
+}
+
+int set_p239_param(ECDSA *ecdsa)
+{
+       BN_CTX   *ctx=NULL;
+       int      ret=0;
+
+       if (!ecdsa)
+               return 0;
+       if ((ctx = BN_CTX_new()) == NULL) goto err;
+       clear_ecdsa(ecdsa);
+       
+       if ((ecdsa->group = EC_GROUP_get_group_by_name(EC_GROUP_X9_62_PRIME_239V1)) == NULL)
+       {
+               BIO_printf(bio_err,"ECDSA_SET_GROUP_P_239_V1() failed \n");
+               goto err;
+       }
+       if ((ecdsa->pub_key = EC_POINT_new(ecdsa->group)) == NULL)
+       {
+               BIO_printf(bio_err,"EC_POINT_new failed \n");
+               goto err;
+       }
+
+       if (!BN_dec2bn(&(ecdsa->priv_key), "876300101507107567501066130761671078357010671067781776716671676178726717")) goto err;
+       if (!EC_POINT_mul(ecdsa->group,ecdsa->pub_key,ecdsa->priv_key,NULL,NULL,ctx))
+       {
+               BIO_printf(bio_err,"EC_POINT_mul() failed \n");
+               goto err;
+       }
+       ret = 1;
+
+err :  if (ctx)        BN_CTX_free(ctx);
+       return ret;
+}
+
+int test_sig_vrf(ECDSA *ecdsa, const unsigned char* dgst)
+{
+        int       ret=0,type=0;
+        unsigned char *buffer=NULL;
+        unsigned int  buf_len;
+        clock_t  time;
+        if (!ecdsa || !ecdsa->group || !ecdsa->pub_key || !ecdsa->priv_key)
+                return 0;
+        if ((buf_len = ECDSA_size(ecdsa)) == 0)
+        {
+                BIO_printf(bio_err, "ECDSA_size() == 0 \n");
+                goto err;
+        }
+        if ((buffer = OPENSSL_malloc(buf_len)) == NULL)
+                goto err;
+        time = clock();
+        if (!ECDSA_sign(type, dgst , 20, buffer, &buf_len, ecdsa))
+        {
+                BIO_printf(bio_err, "ECDSA_sign() FAILED \n");
+                goto err;
+        }
+        time = clock() - time;
+        BIO_printf(bio_err, " [ ECDSA_sign() %.2f"UNIT, (double)time/(CLOCKS_PER_SEC));
+        time = clock();
+        ret = ECDSA_verify(type, dgst, 20, buffer, buf_len, ecdsa);
+        if (ret != 1)
+        {
+                BIO_printf(bio_err, "ECDSA_verify() FAILED \n");
+                goto err;
+        }
+        time = clock() - time;
+        BIO_printf(bio_err, " and ECDSA_verify() %.2f"UNIT" ] ", (double)time/(CLOCKS_PER_SEC));
+err:    OPENSSL_free(buffer);
+        return(ret == 1);
+}
+
+int test_x962_sig_vrf(ECDSA *ecdsa, const unsigned char *dgst,
+                           const char *k_in, const char *r_in, const char *s_in)
+{
+        int       ret=0;
+        ECDSA_SIG *sig=NULL;
+        EC_POINT  *point=NULL;
+        BIGNUM    *r=NULL,*s=NULL,*k=NULL,*x=NULL,*y=NULL,*m=NULL,*ord=NULL;
+        BN_CTX    *ctx=NULL;
+        char      *tmp_char=NULL;
+        if (!ecdsa || !ecdsa->group || !ecdsa->pub_key || !ecdsa->priv_key)
+                return 0;
+        if ((point = EC_POINT_new(ecdsa->group)) == NULL) goto err;
+        if ((r = BN_new()) == NULL || (s = BN_new()) == NULL || (k = BN_new()) == NULL ||
+            (x = BN_new()) == NULL || (y = BN_new()) == NULL || (m = BN_new()) == NULL ||
+            (ord = BN_new()) == NULL) goto err;
+        if ((ctx = BN_CTX_new()) == NULL) goto err;
+        if (!BN_bin2bn(dgst, 20, m)) goto err;
+        if (!BN_dec2bn(&k, k_in)) goto err;
+        if (!EC_POINT_mul(ecdsa->group, point, k, NULL, NULL, ctx)) goto err;
+        if (!EC_POINT_get_affine_coordinates_GFp(ecdsa->group, point, x, y, ctx)) goto err;
+        if (!EC_GROUP_get_order(ecdsa->group, ord, ctx)) goto err;
+        if ((ecdsa->r = BN_dup(x)) == NULL) goto err;
+        if ((ecdsa->kinv = BN_mod_inverse(NULL, k, ord, ctx)) == NULL) goto err;
+        if ((sig = ECDSA_do_sign(dgst, 20, ecdsa)) == NULL)
+        {
+                BIO_printf(bio_err,"ECDSA_do_sign() failed \n");
+                goto err;
+        }
+        if (!BN_dec2bn(&r, r_in)) goto err;
+        if (!BN_dec2bn(&s, s_in)) goto err;
+        if (BN_cmp(sig->r,r) != 0 || BN_cmp(sig->s,s) != 0)
+        {
+                tmp_char = OPENSSL_malloc(128);
+                if (tmp_char == NULL) goto err;
+                tmp_char = BN_bn2dec(sig->r);
+                BIO_printf(bio_err,"unexpected signature \n");
+                BIO_printf(bio_err,"sig->r = %s\n",tmp_char);
+                tmp_char = BN_bn2dec(sig->s);
+                BIO_printf(bio_err,"sig->s = %s\n",tmp_char);
+                goto err;
+        }
+               ret = ECDSA_do_verify(dgst, 20, sig, ecdsa);
+        if (ret != 1)
+        {
+                BIO_printf(bio_err,"ECDSA_do_verify : signature verification failed \n");
+                goto err;
+        }
+        ret = 1;
+err :   if (r)    BN_free(r);
+        if (s)    BN_free(s);
+        if (k)    BN_free(k);
+        if (x)    BN_free(x);
+        if (y)    BN_free(y);
+       if (m)    BN_free(m);
+        if (ord)  BN_free(ord);
+        if (sig)  ECDSA_SIG_free(sig);
+        if (ctx)  BN_CTX_free(ctx);
+        if (point) EC_POINT_free(point);
+        if (tmp_char) OPENSSL_free(tmp_char);
+        return(ret == 1);
+}
+
+int ecdsa_cmp(const ECDSA *a, const ECDSA *b)
+{
+       int     ret=1;
+       BN_CTX  *ctx=NULL;
+       BIGNUM  *tmp_a1=NULL, *tmp_a2=NULL, *tmp_a3=NULL;
+       BIGNUM  *tmp_b1=NULL, *tmp_b2=NULL, *tmp_b3=NULL;
+
+       if ((ctx = BN_CTX_new()) == NULL) return 1;
+       if ((tmp_a1 = BN_new()) == NULL || (tmp_a2 = BN_new()) == NULL || (tmp_a3 = BN_new()) == NULL) goto err;
+       if ((tmp_b1 = BN_new()) == NULL || (tmp_b2 = BN_new()) == NULL || (tmp_b3 = BN_new()) == NULL) goto err;
+
+       if (a->pub_key && b->pub_key)
+               if (EC_POINT_cmp(a->group, a->pub_key, b->pub_key, ctx) != 0) goto err;
+       if (a->priv_key && b->priv_key)
+               if (BN_cmp(a->priv_key, b->priv_key) != 0) goto err;
+       if (!EC_GROUP_get_curve_GFp(a->group, tmp_a1, tmp_a2, tmp_a3, ctx)) goto err;
+       if (!EC_GROUP_get_curve_GFp(a->group, tmp_b1, tmp_b2, tmp_b3, ctx)) goto err;
+       if (BN_cmp(tmp_a1, tmp_b1) != 0) goto err;
+       if (BN_cmp(tmp_a2, tmp_b2) != 0) goto err;
+       if (BN_cmp(tmp_a3, tmp_b3) != 0) goto err;
+
+       ret = 0;
+err:   if (tmp_a1) BN_free(tmp_a1);
+       if (tmp_a2) BN_free(tmp_a2);
+       if (tmp_a3) BN_free(tmp_a3);
+       if (tmp_b1) BN_free(tmp_b1);
+       if (tmp_b2) BN_free(tmp_b2);
+       if (tmp_b3) BN_free(tmp_b3);
+       if (ctx) BN_CTX_free(ctx);
+       return(ret);
+}
+
+int main(void)
+{
+       ECDSA           *ecdsa=NULL, *ret_ecdsa=NULL;
+       BIGNUM          *d=NULL;
+       X509_PUBKEY     *x509_pubkey=NULL;
+       PKCS8_PRIV_KEY_INFO *pkcs8=NULL;
+       EVP_PKEY        *pkey=NULL, *ret_pkey=NULL;
+       int             dgst_len=0;
+       unsigned char   *dgst=NULL;
+       int             ret = 0, i=0;
+       clock_t         time;
+       unsigned char   *buffer=NULL;
+       unsigned char   *pp;
+       long            buf_len=0;
+       double          time_d;
+       EVP_MD_CTX      *md_ctx=NULL;
+       
+
+       RAND_seed(rnd_seed, sizeof(rnd_seed));
+
+       if (bio_err == NULL)
+               bio_err=BIO_new_fp(stderr, BIO_NOCLOSE);
+
+       CRYPTO_malloc_debug_init();
+       CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
+       CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
+
+       ERR_load_crypto_strings();
+
+       if ((ecdsa = ECDSA_new()) == NULL)   goto err;
+
+       set_p192_param(ecdsa);
+       ECDSA_print(bio_err, ecdsa, 0);
+
+       /* en- decode tests */
+
+       /* i2d_ - d2i_ECDSAParameters() */
+       BIO_printf(bio_err, "\nTesting i2d_ - d2i_ECDSAParameters \n");
+       buf_len = i2d_ECDSAParameters(ecdsa, NULL);
+       if (!buf_len || (buffer = OPENSSL_malloc(buf_len)) == NULL) goto err;
+       pp = buffer;
+       if (!i2d_ECDSAParameters(ecdsa, &pp)) goto err;
+       pp = buffer;
+       if ((ret_ecdsa = d2i_ECDSAParameters(&ret_ecdsa, (const unsigned char **)&pp, 
+                       buf_len)) == NULL) goto err;
+       ECDSAParameters_print(bio_err, ret_ecdsa);
+       if (ecdsa_cmp(ecdsa, ret_ecdsa)) goto err;
+       OPENSSL_free(buffer);
+       buffer = NULL;
+       ECDSA_free(ret_ecdsa);
+       ret_ecdsa = NULL;
+
+       /* i2d_ - d2i_ECDSAPrivateKey() */
+       BIO_printf(bio_err, "\nTesting i2d_ - d2i_ECDSAPrivateKey \n");
+       buf_len = i2d_ECDSAPrivateKey(ecdsa, NULL);
+       if (!buf_len || (buffer = OPENSSL_malloc(buf_len)) == NULL) goto err;
+       pp = buffer;
+       if (!i2d_ECDSAPrivateKey(ecdsa, &pp)) goto err;
+       pp = buffer;
+       if ((ret_ecdsa = d2i_ECDSAPrivateKey(&ret_ecdsa, (const unsigned char**)&pp, 
+                       buf_len)) == NULL) goto err;
+       ECDSA_print(bio_err, ret_ecdsa, 0);
+       if (ecdsa_cmp(ecdsa, ret_ecdsa)) goto err;
+       ECDSA_free(ret_ecdsa);
+       ret_ecdsa = NULL;
+       OPENSSL_free(buffer);
+       buffer = NULL;
+
+       /* i2d_ - d2i_ECDSAPublicKey() */
+
+       BIO_printf(bio_err, "\nTesting i2d_ - d2i_ECDSAPublicKey \n");
+       buf_len = i2d_ECDSAPublicKey(ecdsa, NULL);
+       if (!buf_len || (buffer = OPENSSL_malloc(buf_len)) == NULL) goto err;
+       pp = buffer;
+       if (!i2d_ECDSAPublicKey(ecdsa, &pp)) goto err;
+       pp = buffer;
+       if ((ret_ecdsa = d2i_ECDSAPublicKey(&ret_ecdsa , (const unsigned char**)&pp, 
+                       buf_len)) == NULL) goto err;
+       ECDSA_print(bio_err, ret_ecdsa, 0);
+       if (ecdsa_cmp(ecdsa, ret_ecdsa)) goto err;
+       OPENSSL_free(buffer);
+       buffer = NULL;
+       ECDSA_free(ret_ecdsa);
+       ret_ecdsa = NULL;       
+       
+       /* X509_PUBKEY_set() &  X509_PUBKEY_get() */    
+
+       BIO_printf(bio_err, "\nTesting X509_PUBKEY_{get,set}            : ");
+       if ((pkey = EVP_PKEY_new()) == NULL) goto err;
+       EVP_PKEY_assign_ECDSA(pkey, ecdsa);
+       if ((x509_pubkey = X509_PUBKEY_new()) == NULL) goto err;
+       if (!X509_PUBKEY_set(&x509_pubkey, pkey)) goto err;
+
+       if ((ret_pkey = X509_PUBKEY_get(x509_pubkey)) == NULL) goto err;
+       ret_ecdsa = EVP_PKEY_get1_ECDSA(ret_pkey);
+       EVP_PKEY_free(ret_pkey);
+       ret_pkey = NULL;
+
+       if (ecdsa_cmp(ecdsa, ret_ecdsa)) 
+       {
+               BIO_printf(bio_err, "TEST FAILED \n");
+               goto err;
+       }
+       else BIO_printf(bio_err, "TEST OK \n");
+       X509_PUBKEY_free(x509_pubkey);
+       x509_pubkey = NULL;
+       ECDSA_free(ret_ecdsa);
+       ret_ecdsa = NULL;
+
+       /* Testing PKCS8_PRIV_KEY_INFO <-> EVP_PKEY */
+       BIO_printf(bio_err, "Testing PKCS8_PRIV_KEY_INFO <-> EVP_PKEY : \n");
+       BIO_printf(bio_err, "PKCS8_OK              : ");
+       if ((pkcs8 = EVP_PKEY2PKCS8_broken(pkey, PKCS8_OK)) == NULL) goto err;
+       if ((ret_pkey = EVP_PKCS82PKEY(pkcs8)) == NULL) goto err;
+       ret_ecdsa = EVP_PKEY_get1_ECDSA(ret_pkey);
+       if (ecdsa_cmp(ecdsa, ret_ecdsa))
+       {
+               BIO_printf(bio_err, "TEST FAILED \n");
+               goto err;
+       }
+       else BIO_printf(bio_err, "TEST OK \n");
+       EVP_PKEY_free(ret_pkey);
+       ret_pkey = NULL;
+       ECDSA_free(ret_ecdsa);
+       ret_ecdsa = NULL;
+       PKCS8_PRIV_KEY_INFO_free(pkcs8);
+       BIO_printf(bio_err, "PKCS8_NO_OCTET        : ");
+        if ((pkcs8 = EVP_PKEY2PKCS8_broken(pkey, PKCS8_NO_OCTET)) == NULL) goto err;
+        if ((ret_pkey = EVP_PKCS82PKEY(pkcs8)) == NULL) goto err;
+        ret_ecdsa = EVP_PKEY_get1_ECDSA(ret_pkey);
+        if (ecdsa_cmp(ecdsa, ret_ecdsa))
+        {
+                BIO_printf(bio_err, "TEST FAILED \n");
+                goto err;
+        }
+        else BIO_printf(bio_err, "TEST OK \n");
+        EVP_PKEY_free(ret_pkey);
+        ret_pkey = NULL;
+        ECDSA_free(ret_ecdsa);
+        ret_ecdsa = NULL;
+       PKCS8_PRIV_KEY_INFO_free(pkcs8);
+       BIO_printf(bio_err, "PKCS8_EMBEDDED_PARAM  : ");
+        if ((pkcs8 = EVP_PKEY2PKCS8_broken(pkey, PKCS8_EMBEDDED_PARAM)) == NULL) goto err;
+        if ((ret_pkey = EVP_PKCS82PKEY(pkcs8)) == NULL) goto err;
+        ret_ecdsa = EVP_PKEY_get1_ECDSA(ret_pkey);
+        if (ecdsa_cmp(ecdsa, ret_ecdsa))
+        {
+                BIO_printf(bio_err, "TEST FAILED \n");
+                goto err;
+        }
+        else BIO_printf(bio_err, "TEST OK \n");
+        EVP_PKEY_free(ret_pkey);
+        ret_pkey = NULL;
+        ECDSA_free(ret_ecdsa);
+        ret_ecdsa = NULL;
+       PKCS8_PRIV_KEY_INFO_free(pkcs8);
+        BIO_printf(bio_err, "PKCS8_NS_DB           : ");
+        if ((pkcs8 = EVP_PKEY2PKCS8_broken(pkey, PKCS8_NS_DB)) == NULL) goto err;
+        if ((ret_pkey = EVP_PKCS82PKEY(pkcs8)) == NULL) goto err;
+        ret_ecdsa = EVP_PKEY_get1_ECDSA(ret_pkey);
+        if (ecdsa_cmp(ecdsa, ret_ecdsa))
+        {
+                BIO_printf(bio_err, "TEST FAILED \n");
+                goto err;
+        }
+        else BIO_printf(bio_err, "TEST OK \n");
+        EVP_PKEY_free(ret_pkey);
+        ret_pkey = NULL;
+        ECDSA_free(ret_ecdsa);
+        ret_ecdsa = NULL;
+       EVP_PKEY_free(pkey);
+       pkey  = NULL;
+       ecdsa = NULL;
+       PKCS8_PRIV_KEY_INFO_free(pkcs8);
+       pkcs8 = NULL;
+
+       /* sign and verify tests */
+       if ((d = BN_new()) == NULL) goto err;
+        if (!BN_dec2bn(&d, "968236873715988614170569073515315707566766479517")) goto err;
+        dgst_len = BN_num_bytes(d);
+       if ((dgst = OPENSSL_malloc(dgst_len)) == NULL) goto err;
+        if (!BN_bn2bin(d, dgst)) goto err;
+
+        BIO_printf(bio_err, "Performing tests based on examples H.3.1 and H.3.2 of X9.62 \n");
+        BIO_printf(bio_err, "PRIME_192_V1 : ");
+       if ((ecdsa = ECDSA_new()) == NULL) goto err;
+        if (!set_p192_param(ecdsa)) goto err;
+        if (!test_x962_sig_vrf(ecdsa, dgst, "6140507067065001063065065565667405560006161556565665656654",
+                               "3342403536405981729393488334694600415596881826869351677613",
+                               "5735822328888155254683894997897571951568553642892029982342"))
+                goto err;
+        else
+                BIO_printf(bio_err, "OK\n");
+        BIO_printf(bio_err, "PRIME_239_V1 : ");
+        if (!set_p239_param(ecdsa))
+                goto err;
+        if (!test_x962_sig_vrf(ecdsa, dgst, "700000017569056646655505781757157107570501575775705779575555657156756655",
+                               "308636143175167811492622547300668018854959378758531778147462058306432176",
+                               "323813553209797357708078776831250505931891051755007842781978505179448783"))
+                goto err;
+        else
+                BIO_printf(bio_err, "OK\n");
+
+       ECDSA_free(ecdsa);
+       ecdsa = NULL;
+       OPENSSL_free(dgst);
+       dgst = NULL;
+
+
+       /* NIST PRIME CURVES TESTS */
+       /* EC_GROUP_NIST_PRIME_192 */
+       for (i=0; i<ECDSA_NIST_TESTS; i++)
+               if (!RAND_bytes(digest[i], 20)) goto err;       
+
+       BIO_printf(bio_err, "\nTesting sign & verify with NIST Prime-Curve P-192 : \n");
+       ECDSA_free(ecdsa);
+       if ((ecdsa = ECDSA_new()) == NULL) goto err;
+       if ((ecdsa->group = EC_GROUP_get_group_by_name(EC_GROUP_NIST_PRIME_192)) == NULL) goto err;
+       if (!ECDSA_generate_key(ecdsa)) goto err;
+        time = clock();
+        for (i=0; i<ECDSA_NIST_TESTS; i++)
+                if ((signatures[i] = ECDSA_do_sign(digest[i], 20, ecdsa)) == NULL) goto err;
+        time = clock() - time;
+       time_d = (double)time / CLOCKS_PER_SEC;
+        BIO_printf(bio_err, "%d x ECDSA_do_sign()   in %.2f"UNIT" => average time for ECDSA_do_sign()   %.4f"UNIT"\n"
+               , ECDSA_NIST_TESTS, time_d, time_d / ECDSA_NIST_TESTS);
+       time = clock();
+       for (i=0; i<ECDSA_NIST_TESTS; i++)
+               if (!ECDSA_do_verify(digest[i], 20, signatures[i], ecdsa)) goto err;
+       time = clock() - time;
+       time_d = (double)time / CLOCKS_PER_SEC;
+       BIO_printf(bio_err, "%d x ECDSA_do_verify() in %.2f"UNIT" => average time for ECDSA_do_verify() %.4f"UNIT"\n"
+                , ECDSA_NIST_TESTS, time_d, time_d/ECDSA_NIST_TESTS);
+       for (i=0; i<ECDSA_NIST_TESTS; i++)
+       {
+               ECDSA_SIG_free(signatures[i]);
+               signatures[i] = NULL;
+       }
+
+       /* EC_GROUP_NIST_PRIME_224 */
+       BIO_printf(bio_err, "Testing sign & verify with NIST Prime-Curve P-224 : \n");
+        ECDSA_free(ecdsa);
+        if ((ecdsa = ECDSA_new()) == NULL) goto err;
+        if ((ecdsa->group = EC_GROUP_get_group_by_name(EC_GROUP_NIST_PRIME_224)) == NULL) goto err;
+        if (!ECDSA_generate_key(ecdsa)) goto err;
+        time = clock();
+        for (i=0; i<ECDSA_NIST_TESTS; i++)
+                if ((signatures[i] = ECDSA_do_sign(digest[i], 20, ecdsa)) == NULL) goto err;
+        time = clock() - time;
+        time_d = (double)time / CLOCKS_PER_SEC;
+        BIO_printf(bio_err, "%d x ECDSA_do_sign()   in %.2f"UNIT" => average time for ECDSA_do_sign()   %.4f"UNIT"\n"
+                , ECDSA_NIST_TESTS, time_d, time_d / ECDSA_NIST_TESTS);
+        time = clock();
+        for (i=0; i<ECDSA_NIST_TESTS; i++)
+                if (!ECDSA_do_verify(digest[i], 20, signatures[i], ecdsa)) goto err;
+        time = clock() - time;
+        time_d = (double)time / CLOCKS_PER_SEC;
+        BIO_printf(bio_err, "%d x ECDSA_do_verify() in %.2f"UNIT" => average time for ECDSA_do_verify() %.4f"UNIT"\n"
+                , ECDSA_NIST_TESTS, time_d, time_d/ECDSA_NIST_TESTS);
+       for (i=0; i<ECDSA_NIST_TESTS; i++)
+       {
+               ECDSA_SIG_free(signatures[i]);
+               signatures[i] = NULL;
+       }
+
+       /* EC_GROUP_NIST_PRIME_256 */
+        BIO_printf(bio_err, "Testing sign & verify with NIST Prime-Curve P-256 : \n");
+        ECDSA_free(ecdsa);
+        if ((ecdsa = ECDSA_new()) == NULL) goto err;
+        if ((ecdsa->group = EC_GROUP_get_group_by_name(EC_GROUP_NIST_PRIME_256)) == NULL) goto err;
+        if (!ECDSA_generate_key(ecdsa)) goto err;
+        time = clock();
+        for (i=0; i<ECDSA_NIST_TESTS; i++)
+                if ((signatures[i] = ECDSA_do_sign(digest[i], 20, ecdsa)) == NULL) goto err;
+        time = clock() - time;
+        time_d = (double)time / CLOCKS_PER_SEC;
+        BIO_printf(bio_err, "%d x ECDSA_do_sign()   in %.2f"UNIT" => average time for ECDSA_do_sign()   %.4f"UNIT"\n"
+                , ECDSA_NIST_TESTS, time_d, time_d / ECDSA_NIST_TESTS);
+        time = clock();
+        for (i=0; i<ECDSA_NIST_TESTS; i++)
+                if (!ECDSA_do_verify(digest[i], 20, signatures[i], ecdsa)) goto err;
+        time = clock() - time;
+        time_d = (double)time / CLOCKS_PER_SEC;
+        BIO_printf(bio_err, "%d x ECDSA_do_verify() in %.2f"UNIT" => average time for ECDSA_do_verify() %.4f"UNIT"\n"
+                , ECDSA_NIST_TESTS, time_d, time_d/ECDSA_NIST_TESTS);
+       for (i=0; i<ECDSA_NIST_TESTS; i++)
+       {
+               ECDSA_SIG_free(signatures[i]);
+               signatures[i] = NULL;
+       }
+
+       /* EC_GROUP_NIST_PRIME_384 */
+        BIO_printf(bio_err, "Testing sign & verify with NIST Prime-Curve P-384 : \n");
+        ECDSA_free(ecdsa);
+        if ((ecdsa = ECDSA_new()) == NULL) goto err;
+        if ((ecdsa->group = EC_GROUP_get_group_by_name(EC_GROUP_NIST_PRIME_384)) == NULL) goto err;
+        if (!ECDSA_generate_key(ecdsa)) goto err;
+        time = clock();
+        for (i=0; i<ECDSA_NIST_TESTS; i++)
+                if ((signatures[i] = ECDSA_do_sign(digest[i], 20, ecdsa)) == NULL) goto err;
+        time = clock() - time;
+        time_d = (double)time / CLOCKS_PER_SEC;
+        BIO_printf(bio_err, "%d x ECDSA_do_sign()   in %.2f"UNIT" => average time for ECDSA_do_sign()   %.4f"UNIT"\n"
+                , ECDSA_NIST_TESTS, time_d, time_d / ECDSA_NIST_TESTS);
+        time = clock();
+        for (i=0; i<ECDSA_NIST_TESTS; i++)
+                if (!ECDSA_do_verify(digest[i], 20, signatures[i], ecdsa)) goto err;
+        time = clock() - time;
+        time_d = (double)time / CLOCKS_PER_SEC;
+        BIO_printf(bio_err, "%d x ECDSA_do_verify() in %.2f"UNIT" => average time for ECDSA_do_verify() %.4f"UNIT"\n"
+                , ECDSA_NIST_TESTS, time_d, time_d/ECDSA_NIST_TESTS);
+       for (i=0; i<ECDSA_NIST_TESTS; i++)
+       {
+               ECDSA_SIG_free(signatures[i]);
+               signatures[i] = NULL;
+       }
+
+       /* EC_GROUP_NIST_PRIME_521 */
+        BIO_printf(bio_err, "Testing sign & verify with NIST Prime-Curve P-521 : \n");
+        ECDSA_free(ecdsa);
+        if ((ecdsa = ECDSA_new()) == NULL) goto err;
+        if ((ecdsa->group = EC_GROUP_get_group_by_name(EC_GROUP_NIST_PRIME_521)) == NULL) goto err;
+        if (!ECDSA_generate_key(ecdsa)) goto err;
+        time = clock();
+        for (i=0; i<ECDSA_NIST_TESTS; i++)
+                if ((signatures[i] = ECDSA_do_sign(digest[i], 20, ecdsa)) == NULL) goto err;
+        time = clock() - time;
+        time_d = (double)time / CLOCKS_PER_SEC;
+        BIO_printf(bio_err, "%d x ECDSA_do_sign()   in %.2f"UNIT" => average time for ECDSA_do_sign()   %.4f"UNIT"\n"
+                , ECDSA_NIST_TESTS, time_d, time_d / ECDSA_NIST_TESTS);
+        time = clock();
+        for (i=0; i<ECDSA_NIST_TESTS; i++)
+                if (!ECDSA_do_verify(digest[i], 20, signatures[i], ecdsa)) goto err;
+        time = clock() - time;
+        time_d = (double)time / CLOCKS_PER_SEC;
+        BIO_printf(bio_err, "%d x ECDSA_do_verify() in %.2f"UNIT" => average time for ECDSA_do_verify() %.4f"UNIT"\n"
+                , ECDSA_NIST_TESTS, time_d, time_d/ECDSA_NIST_TESTS);
+       ECDSA_free(ecdsa);
+       ecdsa = NULL;
+       for (i=0; i<ECDSA_NIST_TESTS; i++)
+       {
+               ECDSA_SIG_free(signatures[i]);
+               signatures[i] = NULL;
+       }
+
+       OPENSSL_free(buffer);
+       buffer = NULL;
+       EVP_PKEY_free(pkey);
+       pkey = NULL;
+       ecdsa = NULL;
+       
+       ret = 1;
+err:   if (!ret)       
+               BIO_printf(bio_err, "TEST FAILED \n");
+       else 
+               BIO_printf(bio_err, "TEST PASSED \n");
+       if (!ret)
+               ERR_print_errors(bio_err);
+       if (ecdsa)      ECDSA_free(ecdsa);
+       if (d)          BN_free(d);
+       if (dgst)       OPENSSL_free(dgst);
+       if (md_ctx)     EVP_MD_CTX_destroy(md_ctx);
+       CRYPTO_cleanup_all_ex_data();
+       ERR_remove_state(0);
+       ERR_free_strings();
+       CRYPTO_mem_leaks(bio_err);
+       if (bio_err != NULL)
+       {
+               BIO_free(bio_err);
+               bio_err = NULL;
+       }
+       return(0);
+}      
+
+#endif
diff --git a/crypto/ecdsa/ecs_asn1.c b/crypto/ecdsa/ecs_asn1.c
new file mode 100644 (file)
index 0000000..3a5baf0
--- /dev/null
@@ -0,0 +1,723 @@
+/* crypto/ecdsa/ecs_asn1.c */
+/* ====================================================================
+ * Copyright (c) 2000-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
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+#include "cryptlib.h"
+#include "ecs_locl.h"
+#include <openssl/asn1.h>
+#include <openssl/asn1t.h>
+#include <openssl/objects.h>
+
+static point_conversion_form_t POINT_CONVERSION_FORM = POINT_CONVERSION_COMPRESSED;
+
+/* Override the default new methods */
+static int sig_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
+{
+       if(operation == ASN1_OP_NEW_PRE) {
+               ECDSA_SIG *sig;
+               sig = OPENSSL_malloc(sizeof(ECDSA_SIG));
+               if (sig == NULL)
+               {
+                       ECDSAerr(ECDSA_F_SIG_CB, ERR_R_MALLOC_FAILURE);
+                       return 0;
+               }
+               sig->r = NULL;
+               sig->s = NULL;
+               *pval = (ASN1_VALUE *)sig;
+               return 2;
+       }
+       return 1;
+}
+
+ASN1_SEQUENCE_cb(ECDSA_SIG, sig_cb) = {
+       ASN1_SIMPLE(ECDSA_SIG, r, CBIGNUM),
+       ASN1_SIMPLE(ECDSA_SIG, s, CBIGNUM)
+} ASN1_SEQUENCE_END_cb(ECDSA_SIG, ECDSA_SIG)
+
+IMPLEMENT_ASN1_FUNCTIONS_const(ECDSA_SIG)
+
+ASN1_SEQUENCE(X9_62_FIELDID) = {
+       ASN1_SIMPLE(X9_62_FIELDID, fieldType, ASN1_OBJECT),
+       ASN1_SIMPLE(X9_62_FIELDID, parameters, ASN1_ANY)
+} ASN1_SEQUENCE_END(X9_62_FIELDID)
+
+IMPLEMENT_ASN1_FUNCTIONS_const(X9_62_FIELDID)
+
+ASN1_SEQUENCE(X9_62_CURVE) = {
+       ASN1_SIMPLE(X9_62_CURVE, a, ASN1_OCTET_STRING),
+       ASN1_SIMPLE(X9_62_CURVE, b, ASN1_OCTET_STRING),
+       ASN1_OPT(X9_62_CURVE, seed, ASN1_BIT_STRING)
+} ASN1_SEQUENCE_END(X9_62_CURVE)
+
+IMPLEMENT_ASN1_FUNCTIONS_const(X9_62_CURVE)
+
+ASN1_SEQUENCE(X9_62_EC_PARAMETERS) = {
+       ASN1_OPT(X9_62_EC_PARAMETERS, version, ASN1_INTEGER),
+       ASN1_SIMPLE(X9_62_EC_PARAMETERS, fieldID, X9_62_FIELDID),
+       ASN1_SIMPLE(X9_62_EC_PARAMETERS, curve, X9_62_CURVE),
+       ASN1_SIMPLE(X9_62_EC_PARAMETERS, base, ASN1_OCTET_STRING),
+       ASN1_SIMPLE(X9_62_EC_PARAMETERS, order, ASN1_INTEGER),
+       ASN1_SIMPLE(X9_62_EC_PARAMETERS, cofactor, ASN1_INTEGER)
+} ASN1_SEQUENCE_END(X9_62_EC_PARAMETERS)
+
+IMPLEMENT_ASN1_FUNCTIONS_const(X9_62_EC_PARAMETERS)
+
+ASN1_CHOICE(EC_PARAMETERS) = {
+       ASN1_SIMPLE(EC_PARAMETERS, value.named_curve, ASN1_OBJECT),
+       ASN1_SIMPLE(EC_PARAMETERS, value.parameters, X9_62_EC_PARAMETERS),
+       ASN1_SIMPLE(EC_PARAMETERS, value.implicitlyCA, ASN1_NULL)
+} ASN1_CHOICE_END(EC_PARAMETERS)
+
+IMPLEMENT_ASN1_FUNCTIONS_const(EC_PARAMETERS);
+             
+ASN1_SEQUENCE(ECDSAPrivateKey) = {
+       ASN1_SIMPLE(ECDSAPrivateKey, version, LONG),
+       ASN1_SIMPLE(ECDSAPrivateKey, parameters, EC_PARAMETERS),
+       ASN1_SIMPLE(ECDSAPrivateKey, pub_key, ASN1_OCTET_STRING),
+       ASN1_SIMPLE(ECDSAPrivateKey, priv_key, BIGNUM)
+} ASN1_SEQUENCE_END(ECDSAPrivateKey)
+
+IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(ECDSAPrivateKey, ECDSAPrivateKey, ECDSAPrivateKey)
+IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(ECDSAPrivateKey, ECDSAPrivateKey, ecdsaPrivateKey)
+
+ASN1_SEQUENCE(ecdsa_pub_internal) = {
+       ASN1_SIMPLE(ECDSAPrivateKey, pub_key, ASN1_OCTET_STRING),
+       ASN1_SIMPLE(ECDSAPrivateKey, parameters, EC_PARAMETERS),
+} ASN1_SEQUENCE_END_name(ECDSAPrivateKey, ecdsa_pub_internal)
+
+ASN1_CHOICE(ECDSAPublicKey) = {
+       ASN1_SIMPLE(ECDSAPrivateKey, pub_key, ASN1_OCTET_STRING),
+       ASN1_EX_COMBINE(0, 0, ecdsa_pub_internal)
+} ASN1_CHOICE_END_selector(ECDSAPrivateKey, ECDSAPublicKey, write_params)
+
+IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(ECDSAPrivateKey, ECDSAPublicKey, ecdsaPublicKey)
+
+
+X9_62_FIELDID  *ECDSA_get_X9_62_FIELDID(const ECDSA *ecdsa, X9_62_FIELDID *field)
+{
+       /* TODO : characteristic two */
+       int     ok=0, reason=ERR_R_ASN1_LIB;
+       X9_62_FIELDID *ret=NULL;
+       BIGNUM  *tmp=NULL;
+       
+       if (!ecdsa || !ecdsa->group)
+               OPENSSL_ECDSA_ABORT(ECDSA_R_MISSING_PARAMETERS)
+       if (field == NULL)
+       {
+               if ((ret = X9_62_FIELDID_new()) == NULL) return NULL;
+       }
+       else
+       {       
+               ret = field;
+               if (ret->fieldType != NULL)     ASN1_OBJECT_free(ret->fieldType);
+               if (ret->parameters != NULL)    ASN1_TYPE_free(ret->parameters);
+       }
+       if ((tmp = BN_new()) == NULL) 
+               OPENSSL_ECDSA_ABORT(ERR_R_BN_LIB)
+       if ((ret->fieldType = OBJ_nid2obj(NID_X9_62_prime_field)) == NULL)
+               OPENSSL_ECDSA_ABORT(ERR_R_OBJ_LIB)
+       if ((ret->parameters = ASN1_TYPE_new()) == NULL) goto err;
+       ret->parameters->type = V_ASN1_INTEGER;
+       if (!EC_GROUP_get_curve_GFp(ecdsa->group, tmp, NULL, NULL, NULL))
+               OPENSSL_ECDSA_ABORT(ERR_R_EC_LIB)
+       if ((ret->parameters->value.integer = BN_to_ASN1_INTEGER(tmp, NULL)) == NULL) goto err;
+       ok = 1;
+err :  if (!ok)
+       {
+               if (ret && !field) X9_62_FIELDID_free(ret);
+               ret = NULL;
+               ECDSAerr(ECDSA_F_ECDSA_GET_X9_62_FIELDID, reason);
+       }
+       if (tmp) BN_free(tmp);
+       return(ret);
+}
+
+X9_62_CURVE   *ECDSA_get_X9_62_CURVE(const ECDSA *ecdsa, X9_62_CURVE *curve)
+{
+       int     ok=0, reason=ERR_R_BN_LIB, len1=0, len2=0;
+       X9_62_CURVE *ret=NULL;
+       BIGNUM      *tmp1=NULL, *tmp2=NULL;
+       unsigned char *buffer=NULL;
+
+       if (!ecdsa || !ecdsa->group)
+               OPENSSL_ECDSA_ABORT(ECDSA_R_MISSING_PARAMETERS)
+       if ((tmp1 = BN_new()) == NULL || (tmp2 = BN_new()) == NULL) goto err;
+       if (curve == NULL)
+       {
+               if ((ret = X9_62_CURVE_new()) == NULL)
+                       OPENSSL_ECDSA_ABORT(ECDSA_R_X9_62_CURVE_NEW_FAILURE)
+       }
+       else
+       {
+               ret = curve;
+               if (ret->a)     ASN1_OCTET_STRING_free(ret->a);
+               if (ret->b)     ASN1_OCTET_STRING_free(ret->b);
+               if (ret->seed)  ASN1_BIT_STRING_free(ret->seed);
+       }
+       if (!EC_GROUP_get_curve_GFp(ecdsa->group, NULL, tmp1, tmp2, NULL))
+               OPENSSL_ECDSA_ABORT(ERR_R_EC_LIB)
+
+       if ((len1 = BN_num_bytes(tmp1)) == 0)
+               OPENSSL_ECDSA_ABORT(ECDSA_R_UNEXPECTED_PARAMETER_LENGTH)
+       if ((buffer = OPENSSL_malloc(len1)) == NULL)
+               OPENSSL_ECDSA_ABORT(ERR_R_MALLOC_FAILURE)
+       if ((len1 = BN_bn2bin(tmp1, buffer)) == 0) goto err;
+       if ((ret->a = M_ASN1_OCTET_STRING_new()) == NULL)
+               OPENSSL_ECDSA_ABORT(ERR_R_ASN1_LIB)
+       if (!M_ASN1_OCTET_STRING_set(ret->a, buffer, len1))
+               OPENSSL_ECDSA_ABORT(ERR_R_ASN1_LIB)
+
+       if ((len2 = BN_num_bytes(tmp2)) == 0)
+               OPENSSL_ECDSA_ABORT(ECDSA_R_UNEXPECTED_PARAMETER_LENGTH)
+       if (len1 < len2)
+       {
+               OPENSSL_free(buffer);
+               if ((buffer = OPENSSL_malloc(len2)) == NULL)
+                       OPENSSL_ECDSA_ABORT(ERR_R_MALLOC_FAILURE)
+       }
+       if ((len2 = BN_bn2bin(tmp2, buffer)) == 0) goto err;
+       if ((ret->b = M_ASN1_OCTET_STRING_new()) == NULL)
+               OPENSSL_ECDSA_ABORT(ERR_R_ASN1_LIB)
+       if (!M_ASN1_OCTET_STRING_set(ret->b, buffer, len2))
+               OPENSSL_ECDSA_ABORT(ERR_R_ASN1_LIB)
+
+       if (ecdsa->seed)
+       {       
+               if ((ret->seed = ASN1_BIT_STRING_new()) == NULL) goto err;
+               if (!ASN1_BIT_STRING_set(ret->seed, ecdsa->seed, (int)ecdsa->seed_len))
+                       OPENSSL_ECDSA_ABORT(ERR_R_ASN1_LIB)
+       }
+       else
+               ret->seed = NULL;
+
+       ok = 1;
+err :  if (!ok)
+       {
+               if (ret && !curve) X9_62_CURVE_free(ret);
+               ret = NULL;
+               ECDSAerr(ECDSA_F_ECDSA_GET_X9_62_CURVE, reason);
+       }
+       if (buffer) OPENSSL_free(buffer);
+       if (tmp1)   BN_free(tmp1);
+       if (tmp2)   BN_free(tmp2);
+       return(ret);
+}
+
+X9_62_EC_PARAMETERS *ECDSA_get_X9_62_EC_PARAMETERS(const ECDSA *ecdsa, X9_62_EC_PARAMETERS *param)
+{
+       int     ok=0, reason=ERR_R_ASN1_LIB;
+       size_t  len=0;
+       X9_62_EC_PARAMETERS *ret=NULL;
+       BIGNUM        *tmp=NULL;
+       unsigned char *buffer=NULL;
+       EC_POINT      *point=NULL;
+
+       if (!ecdsa || !ecdsa->group)
+               OPENSSL_ECDSA_ABORT(ECDSA_R_MISSING_PARAMETERS)
+       if ((tmp = BN_new()) == NULL)
+               OPENSSL_ECDSA_ABORT(ERR_R_BN_LIB)
+       if (param == NULL)
+       {
+               if ((ret = X9_62_EC_PARAMETERS_new()) == NULL)
+                       OPENSSL_ECDSA_ABORT(ECDSA_R_X9_62_EC_PARAMETERS_NEW_FAILURE)
+       }
+       else
+               ret = param;
+       if (ecdsa->version == 1)
+               ret->version = NULL;
+       else
+       {
+               if (ret->version == NULL && (ret->version = ASN1_INTEGER_new()) == NULL)
+                       OPENSSL_ECDSA_ABORT(ERR_R_MALLOC_FAILURE)
+               if (!ASN1_INTEGER_set(ret->version, (long)ecdsa->version)) goto err;
+       }
+       if ((ret->fieldID = ECDSA_get_X9_62_FIELDID(ecdsa, ret->fieldID)) == NULL)
+               OPENSSL_ECDSA_ABORT(ECDSA_R_ECDSA_GET_X9_62_FIELDID_FAILURE)
+       if ((ret->curve = ECDSA_get_X9_62_CURVE(ecdsa, ret->curve)) == NULL)
+               OPENSSL_ECDSA_ABORT(ECDSA_R_ECDSA_GET_X9_62_CURVE_FAILURE)
+       if ((point = EC_GROUP_get0_generator(ecdsa->group)) == NULL)
+               OPENSSL_ECDSA_ABORT(ECDSA_R_CAN_NOT_GET_GENERATOR)
+       if (!(len = EC_POINT_point2oct(ecdsa->group, point, POINT_CONVERSION_COMPRESSED, NULL, len, NULL)))
+               OPENSSL_ECDSA_ABORT(ECDSA_R_UNEXPECTED_PARAMETER_LENGTH)
+       if ((buffer = OPENSSL_malloc(len)) == NULL)
+               OPENSSL_ECDSA_ABORT(ERR_R_MALLOC_FAILURE)
+       if (!EC_POINT_point2oct(ecdsa->group, point, POINT_CONVERSION_COMPRESSED, buffer, len, NULL)) 
+               OPENSSL_ECDSA_ABORT(ERR_R_EC_LIB)
+       if (ret->base == NULL && (ret->base = ASN1_OCTET_STRING_new()) == NULL)
+               OPENSSL_ECDSA_ABORT(ERR_R_MALLOC_FAILURE)
+       if (!ASN1_OCTET_STRING_set(ret->base, buffer, len)) goto err;
+       if (!EC_GROUP_get_order(ecdsa->group, tmp, NULL))
+               OPENSSL_ECDSA_ABORT(ERR_R_EC_LIB)
+       if ((ret->order = BN_to_ASN1_INTEGER(tmp, ret->order)) == NULL) goto err;
+       if (!EC_GROUP_get_cofactor(ecdsa->group, tmp, NULL))
+               OPENSSL_ECDSA_ABORT(ERR_R_EC_LIB)
+       if ((ret->cofactor = BN_to_ASN1_INTEGER(tmp, ret->cofactor)) == NULL) goto err;
+       ok = 1;
+
+err :  if(!ok)
+       {
+               ECDSAerr(ECDSA_F_ECDSA_GET_X9_62_EC_PARAMETERS, reason);
+               if (ret && !param) X9_62_EC_PARAMETERS_free(ret);
+               ret = NULL;
+       }
+       if (tmp)    BN_free(tmp);
+       if (buffer) OPENSSL_free(buffer);
+       return(ret);
+}
+
+EC_PARAMETERS *ECDSA_get_EC_PARAMETERS(const ECDSA *ecdsa, EC_PARAMETERS *params)
+{
+       int ok = 1;
+       int tmp = 0;
+       EC_PARAMETERS *ret = params;
+       if (ret == NULL)
+               if ((ret = EC_PARAMETERS_new()) == NULL)
+               {
+                       ECDSAerr(ECDSA_F_ECDSA_GET_EC_PARAMETERS, ERR_R_MALLOC_FAILURE);
+                       return NULL;
+               }
+       if (ecdsa == NULL)
+       {       /* missing parameter */
+               ECDSAerr(ECDSA_F_ECDSA_GET_EC_PARAMETERS, ECDSA_R_MISSING_PARAMETERS);
+               EC_PARAMETERS_free(params);
+               return NULL;
+       }
+       if (ecdsa->parameter_flags & ECDSA_FLAG_NAMED_CURVE)
+       {       /* use a named curve */
+               tmp = EC_GROUP_get_nid(ecdsa->group);
+               if (tmp)
+               {
+                       ret->type = 0;
+                       if ((ret->value.named_curve = OBJ_nid2obj(tmp)) == NULL)
+                               ok = 0;
+               }
+               else
+               {
+                       /* use the x9_64 ec_parameters structure */
+                       ret->type = 1;
+                       if ((ret->value.parameters = ECDSA_get_X9_62_EC_PARAMETERS(ecdsa, NULL)) == NULL)
+                               ok = 0;
+               }
+       }
+       else if (ecdsa->parameter_flags & ECDSA_FLAG_IMPLICITLYCA)
+       {       /* use implicitlyCA */
+               ret->type = 2;
+               if ((ret->value.implicitlyCA = ASN1_NULL_new()) == NULL)
+                       ok = 0;
+       }
+       else
+       {       /* use the x9_64 ec_parameters structure */
+               ret->type = 1;
+               if ((ret->value.parameters = ECDSA_get_X9_62_EC_PARAMETERS(ecdsa, NULL)) == NULL)
+                       ok = 0;
+       }
+       if (!ok)
+       {
+               EC_PARAMETERS_free(ret);
+               return NULL;
+       }
+               return ret;
+}
+
+ECDSA         *ECDSA_x9_62parameters2ecdsa(const X9_62_EC_PARAMETERS *params, ECDSA *ecdsa)
+{
+       int       ok=0, reason=ERR_R_EC_LIB, tmp;
+       ECDSA     *ret=NULL;
+       EC_METHOD *meth=NULL;
+       BIGNUM    *tmp_1=NULL, *tmp_2=NULL, *tmp_3=NULL;
+       EC_POINT  *point=NULL;
+
+       if (!params) 
+               OPENSSL_ECDSA_ABORT(ECDSA_R_MISSING_PARAMETERS)
+       if (ecdsa == NULL)
+       {
+               if ((ret = ECDSA_new()) == NULL) 
+                       OPENSSL_ECDSA_ABORT(ECDSA_R_ECDSA_NEW_FAILURE)
+       }
+       else
+       {
+               if (ecdsa->group)       EC_GROUP_free(ecdsa->group);
+               if (ecdsa->pub_key)     EC_POINT_free(ecdsa->pub_key);
+               ecdsa->pub_key = NULL;
+               if (ecdsa->priv_key)    BN_clear_free(ecdsa->priv_key);
+               ecdsa->priv_key = NULL;
+               if (ecdsa->seed)        OPENSSL_free(ecdsa->seed);
+               ecdsa->seed = NULL;
+               if (ecdsa->kinv)        
+               {
+                       BN_clear_free(ecdsa->kinv);
+                       ecdsa->kinv = NULL;
+               }
+               if (ecdsa->r)
+               {
+                       BN_clear_free(ecdsa->r);
+                       ecdsa->r = NULL;
+               }
+               ret = ecdsa;
+       }
+       /* TODO : characteristic two */
+       if (!params->fieldID || !params->fieldID->fieldType || !params->fieldID->parameters)
+               OPENSSL_ECDSA_ABORT(ECDSA_R_NO_FIELD_SPECIFIED)
+       tmp = OBJ_obj2nid(params->fieldID->fieldType); 
+       if (tmp == NID_X9_62_characteristic_two_field)
+       {
+               OPENSSL_ECDSA_ABORT(ECDSA_R_NOT_SUPPORTED)
+       }
+       else if (tmp == NID_X9_62_prime_field)
+       {
+               /* TODO : optimal method for the curve */
+               (const EC_METHOD *)meth = EC_GFp_mont_method();
+               if ((ret->group = EC_GROUP_new(meth)) == NULL) goto err;
+               if (params->fieldID->parameters->type != V_ASN1_INTEGER)
+                       OPENSSL_ECDSA_ABORT(ECDSA_R_UNEXPECTED_ASN1_TYPE)
+               if (!params->fieldID->parameters->value.integer)
+                       OPENSSL_ECDSA_ABORT(ECDSA_R_PRIME_MISSING)
+               if ((tmp_1 = ASN1_INTEGER_to_BN(params->fieldID->parameters->value.integer, NULL)) == NULL)
+                       OPENSSL_ECDSA_ABORT(ERR_R_ASN1_LIB)
+               if (!params->curve)
+                       OPENSSL_ECDSA_ABORT(ECDSA_R_NO_CURVE_SPECIFIED)
+               if (!params->curve->a || !params->curve->a->data)
+                       OPENSSL_ECDSA_ABORT(ECDSA_R_NO_CURVE_PARAMETER_A_SPECIFIED)
+               if ((tmp_2 = BN_bin2bn(params->curve->a->data, params->curve->a->length, NULL)) == NULL)
+                       OPENSSL_ECDSA_ABORT(ERR_R_BN_LIB)
+               if (!params->curve->b || !params->curve->b->data)
+                       OPENSSL_ECDSA_ABORT(ECDSA_R_NO_CURVE_PARAMETER_B_SPECIFIED)
+               if ((tmp_3 = BN_bin2bn(params->curve->b->data, params->curve->b->length, NULL)) == NULL)
+                       OPENSSL_ECDSA_ABORT(ERR_R_BN_LIB)
+               if (!EC_GROUP_set_curve_GFp(ret->group, tmp_1, tmp_2, tmp_3, NULL)) goto err;
+               if ((point = EC_POINT_new(ret->group)) == NULL) goto err;
+       }
+       else OPENSSL_ECDSA_ABORT(ECDSA_R_WRONG_FIELD_IDENTIFIER)
+       if (params->curve->seed != NULL && params->curve->seed->data > 0)
+       {
+               if (ret->seed != NULL)
+                       OPENSSL_free(ret->seed);
+               if ((ret->seed = OPENSSL_malloc(params->curve->seed->length)) == NULL)
+                       OPENSSL_ECDSA_ABORT(ERR_R_MALLOC_FAILURE)
+               memcpy(ret->seed, params->curve->seed->data, params->curve->seed->length);
+               ret->seed_len = params->curve->seed->length;
+       }
+       if (params->version)
+       {
+               if ((ret->version = (int)ASN1_INTEGER_get(params->version)) < 0)
+                       OPENSSL_ECDSA_ABORT(ECDSA_R_UNEXPECTED_VERSION_NUMER)
+       }
+       else
+               ret->version  = 1;
+       if (params->order && params->cofactor && params->base && params->base->data)
+       {
+               if ((tmp_1 = ASN1_INTEGER_to_BN(params->order, tmp_1)) == NULL)
+                       OPENSSL_ECDSA_ABORT(ERR_R_ASN1_LIB)
+               if ((tmp_2 = ASN1_INTEGER_to_BN(params->cofactor, tmp_2)) == NULL)
+                       OPENSSL_ECDSA_ABORT(ERR_R_ASN1_LIB)
+               if (!EC_POINT_oct2point(ret->group, point, params->base->data, 
+                               params->base->length, NULL)) goto err;
+               if (!EC_GROUP_set_generator(ret->group, point, tmp_1, tmp_2)) goto err;
+       }
+       ok = 1;
+
+err:   if (!ok)
+       {
+               ECDSAerr(ECDSA_F_ECDSA_GET, reason);
+               if (ret && !ecdsa) ECDSA_free(ret);
+               ret = NULL;
+       }
+       if (tmp_1)      BN_free(tmp_1);
+       if (tmp_2)      BN_free(tmp_2);
+       if (tmp_3)      BN_free(tmp_3);
+       if (point)      EC_POINT_free(point);
+       return(ret);
+}
+
+ECDSA *ECDSA_ecparameters2ecdsa(const EC_PARAMETERS *params, ECDSA *ecdsa)
+{
+       ECDSA *ret = ecdsa;
+       int tmp = 0;
+       if (ret == NULL)
+               if ((ret = ECDSA_new()) == NULL)
+               {
+                       ECDSAerr(ECDSA_F_ECDSA_GET_ECDSA, ERR_R_MALLOC_FAILURE);
+                       return NULL;
+               }
+       if (params == NULL)
+       {
+               ECDSAerr(ECDSA_F_ECDSA_GET_ECDSA, ECDSA_R_MISSING_PARAMETERS);
+               ECDSA_free(ret);
+               return NULL;
+       }
+       if (params->type == 0)
+       {
+               if (ret->group)
+                       EC_GROUP_free(ret->group);
+               tmp = OBJ_obj2nid(params->value.named_curve);
+               ret->parameter_flags |= ECDSA_FLAG_NAMED_CURVE;
+               if ((ret->group = EC_GROUP_get_group_by_name(tmp)) == NULL)
+               {
+                       ECDSAerr(ECDSA_F_ECDSA_GET_ECDSA, ECDSA_R_EC_GROUP_NID2CURVE_FAILURE);
+                       ECDSA_free(ret);
+                       return NULL;
+               }
+       }
+       else if (params->type == 1)
+       {
+               ret = ECDSA_x9_62parameters2ecdsa(params->value.parameters, ret);
+       }
+       else if (params->type == 2)
+       {
+               if (ret->group)
+                       EC_GROUP_free(ret->group);
+               ret->group = NULL;
+               ret->parameter_flags |= ECDSA_FLAG_IMPLICITLYCA;                
+       }
+       else
+       {
+               ECDSAerr(ECDSA_F_ECDSA_GET_ECDSA, ECDSA_R_UNKNOWN_PARAMETERS_TYPE);
+               ECDSA_free(ret);
+               ret = NULL;
+       }
+       return ret;
+}
+
+ECDSA  *d2i_ECDSAParameters(ECDSA **a, const unsigned char **in, long len)
+{
+       ECDSA           *ecdsa = (a && *a)? *a : NULL;
+       EC_PARAMETERS   *params = NULL;
+
+       if ((params = d2i_EC_PARAMETERS(NULL, in, len)) == NULL)
+       {
+               ECDSAerr(ECDSA_F_D2I_ECDSAPARAMETERS, ECDSA_R_D2I_EC_PARAMETERS_FAILURE);
+               EC_PARAMETERS_free(params);
+               return NULL;
+       }
+       if ((ecdsa = ECDSA_ecparameters2ecdsa(params, ecdsa)) == NULL)
+       {
+               ECDSAerr(ECDSA_F_D2I_ECDSAPARAMETERS, ECDSA_R_ECPARAMETERS2ECDSA_FAILURE);
+               return NULL; 
+       }
+       EC_PARAMETERS_free(params);
+       return(ecdsa);  
+}
+
+int    i2d_ECDSAParameters(ECDSA *a, unsigned char **out)
+{
+       int             ret=0;
+       EC_PARAMETERS   *tmp = ECDSA_get_EC_PARAMETERS(a, NULL);
+       if (tmp == NULL)
+       {
+               ECDSAerr(ECDSA_F_I2D_ECDSAPARAMETERS, ECDSA_R_ECDSA_GET_EC_PARAMETERS_FAILURE);
+               return 0;
+       }
+       if ((ret = i2d_EC_PARAMETERS(tmp, out)) == 0)
+       {
+               ECDSAerr(ECDSA_F_I2D_ECDSAPARAMETERS, ECDSA_R_ECDSA_R_D2I_EC_PARAMETERS_FAILURE);
+               EC_PARAMETERS_free(tmp);
+               return 0;
+       }       
+       EC_PARAMETERS_free(tmp);
+       return(ret);
+}
+
+ECDSA  *d2i_ECDSAPrivateKey(ECDSA **a, const unsigned char **in, long len)
+{
+       int reason=ERR_R_BN_LIB, ok=0;
+       ECDSA *ret=NULL;
+       ECDSAPrivateKey *priv_key=NULL;
+
+       if ((priv_key = ECDSAPrivateKey_new()) == NULL)
+               OPENSSL_ECDSA_ABORT(ECDSA_R_ECDSAPRIVATEKEY_NEW_FAILURE)
+       if ((priv_key = d2i_ecdsaPrivateKey(&priv_key, in, len)) == NULL)
+               OPENSSL_ECDSA_ABORT(ECDSA_R_D2I_ECDSA_PRIVATEKEY_FAILURE)
+       if ((ret = ECDSA_ecparameters2ecdsa(priv_key->parameters, NULL)) == NULL)
+               OPENSSL_ECDSA_ABORT(ECDSA_R_ECDSA_GET_FAILURE)
+       ret->version = priv_key->version;
+       ret->write_params = priv_key->write_params;
+       if (priv_key->priv_key)
+       {
+               if ((ret->priv_key = BN_dup(priv_key->priv_key)) == NULL)
+                       OPENSSL_ECDSA_ABORT(ERR_R_BN_LIB)
+       }
+       else
+               OPENSSL_ECDSA_ABORT(ECDSA_R_D2I_ECDSAPRIVATEKEY_MISSING_PRIVATE_KEY)
+       if ((ret->pub_key = EC_POINT_new(ret->group)) == NULL)
+               OPENSSL_ECDSA_ABORT(ERR_R_EC_LIB)
+       if (!EC_POINT_oct2point(ret->group, ret->pub_key, priv_key->pub_key->data, priv_key->pub_key->length, NULL))
+               OPENSSL_ECDSA_ABORT(ERR_R_EC_LIB)
+       ok = 1;
+err :  if (!ok)
+       {
+               if (ret) ECDSA_free(ret);
+               ret = NULL;
+               ECDSAerr(ECDSA_F_D2I_ECDSAPRIVATEKEY, reason);
+       }
+       if (priv_key)   ECDSAPrivateKey_free(priv_key);
+       return(ret);
+}
+
+int    i2d_ECDSAPrivateKey(ECDSA *a, unsigned char **out)
+{
+       int ret=0, ok=0, reason=ERR_R_EC_LIB;
+       unsigned char   *buffer=NULL;
+       size_t          buf_len=0;
+       ECDSAPrivateKey *priv_key=NULL;
+
+       if (a == NULL || a->group == NULL)
+               OPENSSL_ECDSA_ABORT(ECDSA_R_MISSING_PARAMETERS)
+       if ((priv_key = ECDSAPrivateKey_new()) == NULL)
+               OPENSSL_ECDSA_ABORT(ECDSA_R_ECDSAPRIVATEKEY_NEW_FAILURE)
+       if ((priv_key->parameters = ECDSA_get_EC_PARAMETERS(a, priv_key->parameters)) == NULL)
+               OPENSSL_ECDSA_ABORT(ECDSA_R_ECDSA_GET_X9_62_EC_PARAMETERS_FAILURE)
+       priv_key->version      = a->version;
+       if (BN_copy(priv_key->priv_key, a->priv_key) == NULL)
+               OPENSSL_ECDSA_ABORT(ERR_R_BN_LIB)
+       buf_len = EC_POINT_point2oct(a->group, a->pub_key, POINT_CONVERSION_COMPRESSED, NULL, 0, NULL);
+       if ((buffer = OPENSSL_malloc(buf_len)) == NULL)
+               OPENSSL_ECDSA_ABORT(ERR_R_MALLOC_FAILURE)
+       if (!EC_POINT_point2oct(a->group, a->pub_key, POINT_CONVERSION_COMPRESSED,
+                               buffer, buf_len, NULL)) goto err;
+       if (!M_ASN1_OCTET_STRING_set(priv_key->pub_key, buffer, buf_len))
+               OPENSSL_ECDSA_ABORT(ERR_R_ASN1_LIB)
+       if ((ret = i2d_ecdsaPrivateKey(priv_key, out)) == 0)
+               OPENSSL_ECDSA_ABORT(ECDSA_R_I2D_ECDSA_PRIVATEKEY)
+       ok=1;
+       
+err:   if (!ok)
+               ECDSAerr(ECDSA_F_I2D_ECDSAPRIVATEKEY, reason);
+       if (buffer)   OPENSSL_free(buffer);
+       if (priv_key) ECDSAPrivateKey_free(priv_key);   
+       return(ok?ret:0);
+}
+
+
+ECDSA  *d2i_ECDSAPublicKey(ECDSA **a, const unsigned char **in, long len)
+{
+       int reason=ERR_R_BN_LIB, ok=0, ecdsa_new=1;
+       ECDSA *ret=NULL;
+       ECDSAPrivateKey *priv_key=NULL;
+
+       if (a && *a)
+       {
+               ecdsa_new = 0;
+               ret = *a;
+       }
+       else if ((ret = ECDSA_new()) == NULL)
+               OPENSSL_ECDSA_ABORT(ERR_R_MALLOC_FAILURE); 
+       if ((priv_key = ECDSAPrivateKey_new()) == NULL)
+               OPENSSL_ECDSA_ABORT(ECDSA_R_ECDSAPRIVATEKEY_NEW_FAILURE)
+       if ((priv_key = d2i_ecdsaPublicKey(&priv_key, in, len)) == NULL)
+               OPENSSL_ECDSA_ABORT(ECDSA_R_D2I_ECDSA_PRIVATEKEY_FAILURE)
+       if (priv_key->write_params == 0)
+       {
+               if (ecdsa_new || !ret->group)
+                       OPENSSL_ECDSA_ABORT(ECDSA_R_MISSING_PARAMETERS)
+               if (ret->pub_key == NULL && (ret->pub_key = EC_POINT_new(ret->group)) == NULL)
+                       OPENSSL_ECDSA_ABORT(ERR_R_MALLOC_FAILURE)
+               if (!EC_POINT_oct2point(ret->group, ret->pub_key, priv_key->pub_key->data,
+                                       priv_key->pub_key->length, NULL))
+                       OPENSSL_ECDSA_ABORT(ERR_R_EC_LIB)
+       }
+       else if (priv_key->write_params == 1)
+       {
+               if ((ret = ECDSA_ecparameters2ecdsa(priv_key->parameters, ret)) == NULL)
+                       OPENSSL_ECDSA_ABORT(ECDSA_R_ECDSA_GET_FAILURE)
+               if (ret->pub_key == NULL && (ret->pub_key = EC_POINT_new(ret->group)) == NULL)
+                       OPENSSL_ECDSA_ABORT(ERR_R_EC_LIB)
+               if (!EC_POINT_oct2point(ret->group, ret->pub_key, priv_key->pub_key->data, 
+                               priv_key->pub_key->length, NULL))
+                       OPENSSL_ECDSA_ABORT(ERR_R_EC_LIB)
+       }
+       else    OPENSSL_ECDSA_ABORT(ECDSA_R_UNEXPECTED_PARAMETER)
+       ret->write_params = 1;
+       ok = 1;
+err :  if (!ok)
+       {
+               if (ret && ecdsa_new) ECDSA_free(ret);
+               ret = NULL;
+               ECDSAerr(ECDSA_F_D2I_ECDSAPRIVATEKEY, reason);
+       }
+       if (priv_key)   ECDSAPrivateKey_free(priv_key);
+       return(ret);
+}
+
+int    i2d_ECDSAPublicKey(ECDSA *a, unsigned char **out)
+{
+        int    ret=0, reason=ERR_R_EC_LIB, ok=0;
+        unsigned char   *buffer=NULL;
+        size_t          buf_len=0;
+        ECDSAPrivateKey *priv_key=NULL;
+
+        if (a == NULL) 
+               OPENSSL_ECDSA_ABORT(ECDSA_R_MISSING_PARAMETERS)
+        if ((priv_key = ECDSAPrivateKey_new()) == NULL) 
+               OPENSSL_ECDSA_ABORT(ECDSA_R_ECDSAPRIVATEKEY_NEW_FAILURE)
+        if ((priv_key->parameters = ECDSA_get_EC_PARAMETERS(a, priv_key->parameters)) == NULL)
+               OPENSSL_ECDSA_ABORT(ECDSA_R_ECDSA_GET_X9_62_EC_PARAMETERS_FAILURE)
+        priv_key->version = a->version;
+        priv_key->write_params = a->write_params;
+        buf_len = EC_POINT_point2oct(a->group, a->pub_key, POINT_CONVERSION_FORM, NULL, 0, NULL);
+        if (!buf_len || (buffer = OPENSSL_malloc(buf_len)) == NULL)
+               OPENSSL_ECDSA_ABORT(ERR_R_MALLOC_FAILURE)
+        if (!EC_POINT_point2oct(a->group, a->pub_key, POINT_CONVERSION_FORM,
+                               buffer, buf_len, NULL)) goto err;
+        if (!M_ASN1_OCTET_STRING_set(priv_key->pub_key, buffer, buf_len))
+               OPENSSL_ECDSA_ABORT(ERR_R_ASN1_LIB)
+        if ((ret = i2d_ecdsaPublicKey(priv_key, out)) == 0)
+               OPENSSL_ECDSA_ABORT(ECDSA_R_I2D_ECDSA_PUBLICKEY)
+       ok = 1;
+
+err:    if (!ok)
+               ECDSAerr(ECDSA_F_I2D_ECDSAPUBLICKEY, reason);
+       if (buffer)   OPENSSL_free(buffer);
+        if (priv_key) ECDSAPrivateKey_free(priv_key);
+        return(ok?ret:0);
+}
diff --git a/crypto/ecdsa/ecs_err.c b/crypto/ecdsa/ecs_err.c
new file mode 100644 (file)
index 0000000..f788dc9
--- /dev/null
@@ -0,0 +1,155 @@
+/* crypto/ecdsa/ecs_err.c */
+/* ====================================================================
+ * Copyright (c) 1998-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
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+/* NOTE: this file was auto generated by the mkerr.pl script: any changes
+ * made to it will be overwritten when the script next updates this file,
+ * only reason strings will be preserved.
+ */
+
+#include <stdio.h>
+#include <openssl/err.h>
+#include <openssl/ecdsa.h>
+
+/* BEGIN ERROR CODES */
+#ifndef OPENSSL_NO_ERR
+static ERR_STRING_DATA ECDSA_str_functs[]=
+       {
+{ERR_PACK(0,ECDSA_F_D2I_ECDSAPARAMETERS,0),    "d2i_ECDSAParameters"},
+{ERR_PACK(0,ECDSA_F_D2I_ECDSAPRIVATEKEY,0),    "d2i_ECDSAPrivateKey"},
+{ERR_PACK(0,ECDSA_F_ECDSAPARAMETERS_PRINT,0),  "ECDSAParameters_print"},
+{ERR_PACK(0,ECDSA_F_ECDSAPARAMETERS_PRINT_FP,0),       "ECDSAParameters_print_fp"},
+{ERR_PACK(0,ECDSA_F_ECDSA_DO_SIGN,0),  "ECDSA_do_sign"},
+{ERR_PACK(0,ECDSA_F_ECDSA_DO_VERIFY,0),        "ECDSA_do_verify"},
+{ERR_PACK(0,ECDSA_F_ECDSA_GENERATE_KEY,0),     "ECDSA_generate_key"},
+{ERR_PACK(0,ECDSA_F_ECDSA_GET,0),      "ECDSA_GET"},
+{ERR_PACK(0,ECDSA_F_ECDSA_GET_CURVE_NID,0),    "ECDSA_GET_CURVE_NID"},
+{ERR_PACK(0,ECDSA_F_ECDSA_GET_ECDSA,0),        "ECDSA_GET_ECDSA"},
+{ERR_PACK(0,ECDSA_F_ECDSA_GET_EC_PARAMETERS,0),        "ECDSA_get_EC_PARAMETERS"},
+{ERR_PACK(0,ECDSA_F_ECDSA_GET_X9_62_CURVE,0),  "ECDSA_get_X9_62_CURVE"},
+{ERR_PACK(0,ECDSA_F_ECDSA_GET_X9_62_EC_PARAMETERS,0),  "ECDSA_get_X9_62_EC_PARAMETERS"},
+{ERR_PACK(0,ECDSA_F_ECDSA_GET_X9_62_FIELDID,0),        "ECDSA_get_X9_62_FIELDID"},
+{ERR_PACK(0,ECDSA_F_ECDSA_NEW,0),      "ECDSA_NEW"},
+{ERR_PACK(0,ECDSA_F_ECDSA_PRINT,0),    "ECDSA_print"},
+{ERR_PACK(0,ECDSA_F_ECDSA_PRINT_FP,0), "ECDSA_print_fp"},
+{ERR_PACK(0,ECDSA_F_ECDSA_SET_GROUP_P,0),      "ECDSA_set_group_p"},
+{ERR_PACK(0,ECDSA_F_ECDSA_SET_PRIME_GROUP,0),  "ECDSA_SET_PRIME_GROUP"},
+{ERR_PACK(0,ECDSA_F_ECDSA_SIGN_SETUP,0),       "ECDSA_sign_setup"},
+{ERR_PACK(0,ECDSA_F_I2D_ECDSAPARAMETERS,0),    "i2d_ECDSAParameters"},
+{ERR_PACK(0,ECDSA_F_I2D_ECDSAPRIVATEKEY,0),    "i2d_ECDSAPrivateKey"},
+{ERR_PACK(0,ECDSA_F_I2D_ECDSAPUBLICKEY,0),     "i2d_ECDSAPublicKey"},
+{ERR_PACK(0,ECDSA_F_SIG_CB,0), "SIG_CB"},
+{0,NULL}
+       };
+
+static ERR_STRING_DATA ECDSA_str_reasons[]=
+       {
+{ECDSA_R_BAD_SIGNATURE                   ,"bad signature"},
+{ECDSA_R_CAN_NOT_GET_GENERATOR           ,"can not get generator"},
+{ECDSA_R_D2I_ECDSAPRIVATEKEY_MISSING_PRIVATE_KEY,"d2i ecdsaprivatekey missing private key"},
+{ECDSA_R_D2I_ECDSA_PRIVATEKEY_FAILURE    ,"d2i ecdsa privatekey failure"},
+{ECDSA_R_D2I_EC_PARAMETERS_FAILURE       ,"d2i ec parameters failure"},
+{ECDSA_R_D2I_X9_62_EC_PARAMETERS_FAILURE ,"d2i x9 62 ec parameters failure"},
+{ECDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE     ,"data too large for key size"},
+{ECDSA_R_ECDSAPRIVATEKEY_NEW_FAILURE     ,"ecdsaprivatekey new failure"},
+{ECDSA_R_ECDSA_F_ECDSA_NEW               ,"ecdsa f ecdsa new"},
+{ECDSA_R_ECDSA_GET_EC_PARAMETERS_FAILURE ,"ecdsa get ec parameters failure"},
+{ECDSA_R_ECDSA_GET_FAILURE               ,"ecdsa get failure"},
+{ECDSA_R_ECDSA_GET_X9_62_CURVE_FAILURE   ,"ecdsa get x9 62 curve failure"},
+{ECDSA_R_ECDSA_GET_X9_62_EC_PARAMETERS_FAILURE,"ecdsa get x9 62 ec parameters failure"},
+{ECDSA_R_ECDSA_GET_X9_62_FIELDID_FAILURE ,"ecdsa get x9 62 fieldid failure"},
+{ECDSA_R_ECDSA_NEW_FAILURE               ,"ecdsa new failure"},
+{ECDSA_R_ECDSA_R_D2I_EC_PARAMETERS_FAILURE,"ecdsa r d2i ec parameters failure"},
+{ECDSA_R_ECDSA_R_D2I_X9_62_EC_PARAMETERS_FAILURE,"ecdsa r d2i x9 62 ec parameters failure"},
+{ECDSA_R_ECPARAMETERS2ECDSA_FAILURE      ,"ecparameters2ecdsa failure"},
+{ECDSA_R_EC_GROUP_NID2CURVE_FAILURE      ,"ec group nid2curve failure"},
+{ECDSA_R_ERR_EC_LIB                      ,"err ec lib"},
+{ECDSA_R_I2D_ECDSA_PRIVATEKEY            ,"i2d ecdsa privatekey"},
+{ECDSA_R_I2D_ECDSA_PUBLICKEY             ,"i2d ecdsa publickey"},
+{ECDSA_R_MISSING_PARAMETERS              ,"missing parameters"},
+{ECDSA_R_NOT_SUPPORTED                   ,"not supported"},
+{ECDSA_R_NO_CURVE_PARAMETER_A_SPECIFIED  ,"no curve parameter a specified"},
+{ECDSA_R_NO_CURVE_PARAMETER_B_SPECIFIED  ,"no curve parameter b specified"},
+{ECDSA_R_NO_CURVE_SPECIFIED              ,"no curve specified"},
+{ECDSA_R_NO_FIELD_SPECIFIED              ,"no field specified"},
+{ECDSA_R_PRIME_MISSING                   ,"prime missing"},
+{ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED ,"random number generation failed"},
+{ECDSA_R_SIGNATURE_MALLOC_FAILED         ,"signature malloc failed"},
+{ECDSA_R_UNEXPECTED_ASN1_TYPE            ,"unexpected asn1 type"},
+{ECDSA_R_UNEXPECTED_PARAMETER            ,"unexpected parameter"},
+{ECDSA_R_UNEXPECTED_PARAMETER_LENGTH     ,"unexpected parameter length"},
+{ECDSA_R_UNEXPECTED_VERSION_NUMER        ,"unexpected version numer"},
+{ECDSA_R_UNKNOWN_PARAMETERS_TYPE         ,"unknown parameters type"},
+{ECDSA_R_WRONG_FIELD_IDENTIFIER          ,"wrong field identifier"},
+{ECDSA_R_X9_62_CURVE_NEW_FAILURE         ,"x9 62 curve new failure"},
+{ECDSA_R_X9_62_EC_PARAMETERS_NEW_FAILURE ,"x9 62 ec parameters new failure"},
+{0,NULL}
+       };
+
+#endif
+
+void ERR_load_ECDSA_strings(void)
+       {
+       static int init=1;
+
+       if (init)
+               {
+               init=0;
+#ifndef OPENSSL_NO_ERR
+               ERR_load_strings(ERR_LIB_ECDSA,ECDSA_str_functs);
+               ERR_load_strings(ERR_LIB_ECDSA,ECDSA_str_reasons);
+#endif
+
+               }
+       }
diff --git a/crypto/ecdsa/ecs_gen.c b/crypto/ecdsa/ecs_gen.c
new file mode 100644 (file)
index 0000000..0e2ade7
--- /dev/null
@@ -0,0 +1,133 @@
+/* crypto/ecdsa/ecs_gen.c */
+/* ====================================================================
+ * Copyright (c) 1998-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
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+/* 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 <time.h>
+#include "cryptlib.h"
+#include <openssl/evp.h>
+#include <openssl/bn.h>
+#include <openssl/ecdsa.h>
+#include <openssl/rand.h>
+#include <openssl/sha.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ECDSA *ECDSA_generate_parameters(int bits,
+               unsigned char *seed_in, int seed_len,
+               int *counter_ret, unsigned long *h_ret,
+               void (*callback)(int, int, void *),
+               void *cb_arg)
+       {
+               return NULL;
+       }
+#ifdef  __cplusplus
+}
+#endif
diff --git a/crypto/ecdsa/ecs_key.c b/crypto/ecdsa/ecs_key.c
new file mode 100644 (file)
index 0000000..44a3f2b
--- /dev/null
@@ -0,0 +1,143 @@
+/* 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 "cryptlib.h"
+#include <openssl/ecdsa.h>
+
+int ECDSA_generate_key(ECDSA *ecdsa)
+{      
+       int ok=0;
+       BN_CTX *ctx=NULL;
+       BIGNUM *priv_key=NULL,*order=NULL;
+       EC_POINT *pub_key=NULL;
+
+       if (!ecdsa || !ecdsa->group)
+       {
+               ECDSAerr(ECDSA_F_ECDSA_GENERATE_KEY,ECDSA_R_MISSING_PARAMETERS);
+               return 0;
+       }
+
+       if ((order = BN_new()) == NULL) goto err;
+       if ((ctx = BN_CTX_new()) == NULL) goto err;
+
+       if (ecdsa->priv_key == NULL)
+       {
+               if ((priv_key = BN_new()) == NULL) goto err;
+       }
+       else
+               priv_key = ecdsa->priv_key;
+
+       if (!EC_GROUP_get_order(ecdsa->group, order, ctx)) goto err;
+       do
+               if (!BN_rand_range(priv_key, order)) goto err;
+       while (BN_is_zero(priv_key));
+
+       if (ecdsa->pub_key == NULL)
+       {
+               if ((pub_key = EC_POINT_new(ecdsa->group)) == NULL) goto err;
+       }
+       else
+               pub_key = ecdsa->pub_key;
+
+       if (!EC_POINT_copy(pub_key, EC_GROUP_get0_generator(ecdsa->group))) goto err;
+       if (!EC_POINT_mul(ecdsa->group, pub_key, priv_key, NULL, NULL, ctx)) goto err;
+
+       ecdsa->priv_key = priv_key;
+       ecdsa->pub_key  = pub_key;
+       ok=1;
+err:   if (order)      BN_free(order);
+       if ((pub_key  != NULL) && (ecdsa->pub_key  == NULL)) EC_POINT_free(pub_key);
+       if ((priv_key != NULL) && (ecdsa->priv_key == NULL)) BN_free(priv_key);
+       if (ctx != NULL) BN_CTX_free(ctx);
+       return(ok);
+}
+
+int ECDSA_check_key(ECDSA *ecdsa)
+{
+       int ok=0;
+       BN_CTX *ctx=NULL;
+       BIGNUM *order=NULL;
+       EC_POINT *point=NULL;
+
+       if (!ecdsa || !ecdsa->group || !ecdsa->pub_key)
+               return 0;
+       
+       if ((ctx = BN_CTX_new()) == NULL) goto err;
+       if ((order = BN_new()) == NULL) goto err;
+       if ((point = EC_POINT_new(ecdsa->group)) == NULL) goto err;
+
+       /* testing whether pub_key is a valid point on the elliptic curve */
+       if (!EC_POINT_is_on_curve(ecdsa->group,ecdsa->pub_key,ctx)) goto err;
+       /* testing whether pub_key * order is the point at infinity */
+       if (!EC_GROUP_get_order(ecdsa->group,order,ctx)) goto err;
+       if (!EC_POINT_copy(point,ecdsa->pub_key)) goto err;
+       if (!EC_POINT_mul(ecdsa->group,point,order,NULL,NULL,ctx)) goto err;
+       if (!EC_POINT_is_at_infinity(ecdsa->group,point)) goto err;
+       /* in case the priv_key is present : check if generator * priv_key == pub_key */
+       if (ecdsa->priv_key)
+       {
+               if (BN_cmp(ecdsa->priv_key,order) >= 0) goto err;
+               if (!EC_POINT_copy(point,EC_GROUP_get0_generator(ecdsa->group))) goto err;
+               if (!EC_POINT_mul(ecdsa->group,point,ecdsa->priv_key,NULL,NULL,ctx)) goto err;
+               if (EC_POINT_cmp(ecdsa->group,point,ecdsa->pub_key,ctx) != 0) goto err;
+       }
+       ok = 1;
+err:
+       if (ctx   != NULL) BN_CTX_free(ctx);
+       if (order != NULL) BN_free(order);
+       if (point != NULL) EC_POINT_free(point);
+       return(ok);
+}
diff --git a/crypto/ecdsa/ecs_lib.c b/crypto/ecdsa/ecs_lib.c
new file mode 100644 (file)
index 0000000..b161b6c
--- /dev/null
@@ -0,0 +1,312 @@
+/* crypto/ecdsa/ecs_lib.c */
+/* ====================================================================
+ * Copyright (c) 1998-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
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+/* 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 "cryptlib.h"
+#include "ecs_locl.h"
+#include <openssl/engine.h>
+
+const char *ECDSA_version="ECDSA" OPENSSL_VERSION_PTEXT;
+
+static const ECDSA_METHOD *default_ECDSA_method = NULL;
+
+void ECDSA_set_default_method(const ECDSA_METHOD *meth)
+{
+       default_ECDSA_method = meth;
+}
+
+const ECDSA_METHOD *ECDSA_get_default_method(void)
+{
+       if(!default_ECDSA_method) 
+               default_ECDSA_method = ECDSA_OpenSSL();
+       return default_ECDSA_method;
+}
+
+ECDSA *ECDSA_new(void)
+{
+       return ECDSA_new_method(NULL);
+}
+
+int ECDSA_set_method(ECDSA *ecdsa, const ECDSA_METHOD *meth)
+{
+        const ECDSA_METHOD *mtmp;
+        mtmp = ecdsa->meth;
+        if (mtmp->finish) mtmp->finish(ecdsa);
+       if (ecdsa->engine)
+       {
+               ENGINE_finish(ecdsa->engine);
+               ecdsa->engine = NULL;
+       }
+        ecdsa->meth = meth;
+        if (meth->init) meth->init(ecdsa);
+        return 1;
+}
+
+ECDSA *ECDSA_new_method(ENGINE *engine)
+{
+       ECDSA *ret;
+
+       ret=(ECDSA *)OPENSSL_malloc(sizeof(ECDSA));
+       if (ret == NULL)
+       {
+               ECDSAerr(ECDSA_F_ECDSA_NEW,ERR_R_MALLOC_FAILURE);
+               return(NULL);
+       }
+
+       ret->meth = ECDSA_get_default_method();
+       ret->engine = engine;
+       if (!ret->engine)
+               ret->engine = ENGINE_get_default_ECDSA();
+       if (ret->engine)
+       {
+               ret->meth = ENGINE_get_ECDSA(ret->engine);
+               if (!ret->meth)
+               {
+                       ECDSAerr(ECDSA_R_ECDSA_F_ECDSA_NEW, ERR_R_ENGINE_LIB);
+                       ENGINE_finish(ret->engine);
+                       OPENSSL_free(ret);
+                       return NULL;
+               }
+       }
+
+       ret->version = 1;
+       ret->write_params=1;
+       ret->group = NULL;
+
+       ret->pub_key = NULL;
+       ret->priv_key = NULL;
+
+       ret->kinv = NULL;
+       ret->r = NULL;
+
+       ret->seed = NULL;
+       ret->seed_len = 0;
+
+       ret->parameter_flags = 0;
+
+       ret->references = 1;
+       ret->flags = ret->meth->flags;
+       CRYPTO_new_ex_data(CRYPTO_EX_INDEX_ECDSA, ret, &ret->ex_data);
+       if ((ret->meth->init != NULL) && !ret->meth->init(ret))
+       {
+               CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDSA, ret, &ret->ex_data);
+               OPENSSL_free(ret);
+               ret=NULL;
+       }
+       
+       return(ret);
+}
+
+void ECDSA_free(ECDSA *r)
+{
+       int i;
+
+       if (r == NULL) return;
+
+       i=CRYPTO_add(&r->references,-1,CRYPTO_LOCK_ECDSA);
+#ifdef REF_PRINT
+       REF_PRINT("ECDSA",r);
+#endif
+       if (i > 0) return;
+#ifdef REF_CHECK
+       if (i < 0)
+       {
+               fprintf(stderr,"ECDSA_free, bad reference count\n");
+               abort();
+       }
+#endif
+
+       if (r->meth->finish)
+               r->meth->finish(r);
+       if (r->engine)
+               ENGINE_finish(r->engine);
+
+       CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDSA, r, &r->ex_data);
+
+       if (r->group    != NULL) EC_GROUP_free(r->group);
+       if (r->pub_key  != NULL) EC_POINT_free(r->pub_key);
+       if (r->priv_key != NULL) BN_clear_free(r->priv_key);
+       if (r->kinv != NULL) BN_clear_free(r->kinv);
+       if (r->r    != NULL) BN_clear_free(r->r);
+       if (r->seed != NULL) OPENSSL_free(r->seed);
+       OPENSSL_free(r);
+}
+
+int ECDSA_size(const ECDSA *r)
+{
+       int ret,i;
+       ASN1_INTEGER bs;
+       BIGNUM  *order=NULL;
+       unsigned char buf[4];
+
+       if (r == NULL || r->group == NULL)
+               return 0;
+       if ((order = BN_new()) == NULL) return 0;
+       if (!EC_GROUP_get_order(r->group,order,NULL))
+       {
+               BN_clear_free(order);
+               return 0;
+       } 
+       i=BN_num_bits(order);
+       bs.length=(i+7)/8;
+       bs.data=buf;
+       bs.type=V_ASN1_INTEGER;
+       /* If the top bit is set the asn1 encoding is 1 larger. */
+       buf[0]=0xff;    
+
+       i=i2d_ASN1_INTEGER(&bs,NULL);
+       i+=i; /* r and s */
+       ret=ASN1_object_size(1,i,V_ASN1_SEQUENCE);
+       BN_clear_free(order);
+       return(ret);
+}
+
+int ECDSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
+            CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
+{
+       return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_ECDSA, argl, argp,
+                               new_func, dup_func, free_func);
+}
+
+int ECDSA_set_ex_data(ECDSA *d, int idx, void *arg)
+{
+       return(CRYPTO_set_ex_data(&d->ex_data,idx,arg));
+}
+
+void *ECDSA_get_ex_data(ECDSA *d, int idx)
+{
+       return(CRYPTO_get_ex_data(&d->ex_data,idx));
+}
+
+int ECDSA_up_ref(ECDSA *ecdsa)
+{
+       int i = CRYPTO_add(&ecdsa->references, 1, CRYPTO_LOCK_ECDSA);
+#ifdef REF_PRINT
+       REF_PRINT("ECDSA",r);
+#endif 
+#ifdef REF_CHECK
+       if (i < 2)
+       {
+               fprintf(stderr, "ECDSA_up_ref, bad reference count\n");
+                abort();
+        }
+#endif
+        return ((i > 1) ? 1 : 0);
+}
+        
+void ECDSA_set_parameter_flags(ECDSA *ecdsa, int flag)
+{
+       ecdsa->parameter_flags = flag;
+}
+
+int ECDSA_get_parameter_flags(const ECDSA *ecdsa)
+{
+       return ecdsa->parameter_flags;
+}
diff --git a/crypto/ecdsa/ecs_locl.h b/crypto/ecdsa/ecs_locl.h
new file mode 100644 (file)
index 0000000..61b6366
--- /dev/null
@@ -0,0 +1,118 @@
+/* crypto/ecdsa/ecs_locl.h */
+/* ====================================================================
+ * Copyright (c) 1998-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
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+#include "ecdsa.h"
+
+#ifndef HEADER_ECS_LOCL_H
+#define HEADER_ECS_LOCL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define OPENSSL_ECDSA_ABORT(r) { reason = (r); goto err; }
+
+/* some structures needed for the asn1 encoding */
+typedef struct x9_62_fieldid_st {
+        ASN1_OBJECT *fieldType;
+        ASN1_TYPE   *parameters;
+        } X9_62_FIELDID;
+
+typedef struct x9_62_curve_st {
+        ASN1_OCTET_STRING *a;
+        ASN1_OCTET_STRING *b;
+        ASN1_BIT_STRING   *seed;
+        } X9_62_CURVE;
+
+typedef struct x9_62_ec_parameters {
+        ASN1_INTEGER      *version;
+        X9_62_FIELDID     *fieldID;
+        X9_62_CURVE       *curve;
+        ASN1_OCTET_STRING *base;
+        ASN1_INTEGER      *order;
+        ASN1_INTEGER      *cofactor;
+        } X9_62_EC_PARAMETERS;
+
+typedef struct ec_parameters {
+       int     type;
+       union {
+               ASN1_OBJECT         *named_curve;
+               X9_62_EC_PARAMETERS *parameters;
+               ASN1_NULL           *implicitlyCA;
+       } value;
+       } EC_PARAMETERS;
+
+typedef struct ecdsa_priv_key_st {
+        int               version;
+        int               write_params;
+        EC_PARAMETERS    *parameters;
+       ASN1_OBJECT       *named_curve;
+        ASN1_OCTET_STRING *pub_key;
+        BIGNUM            *priv_key;
+        } ECDSAPrivateKey;
+
+
+X9_62_FIELDID *ECDSA_get_X9_62_FIELDID(const ECDSA *ecdsa, X9_62_FIELDID *field);
+X9_62_CURVE   *ECDSA_get_X9_62_CURVE(const ECDSA *ecdsa, X9_62_CURVE *curve);
+X9_62_EC_PARAMETERS *ECDSA_get_X9_62_EC_PARAMETERS(const ECDSA *ecdsa, X9_62_EC_PARAMETERS *params);
+EC_PARAMETERS *ECDSA_get_EC_PARAMETERS(const ECDSA *ecdsa, EC_PARAMETERS *params);
+
+ECDSA  *ECDSA_x9_62parameters2ecdsa(const X9_62_EC_PARAMETERS *params, ECDSA *ecdsa);
+ECDSA  *ECDSA_ecparameters2ecdsa(const EC_PARAMETERS *params, ECDSA *ecdsa);
+
+#ifdef  __cplusplus
+}
+#endif
+#endif
diff --git a/crypto/ecdsa/ecs_ossl.c b/crypto/ecdsa/ecs_ossl.c
new file mode 100644 (file)
index 0000000..5a36707
--- /dev/null
@@ -0,0 +1,381 @@
+/* crypto/ecdsa/ecs_ossl.c */
+/* ====================================================================
+ * Copyright (c) 1998-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
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+/* 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 "cryptlib.h"
+#include <openssl/ecdsa.h>
+
+/* TODO : general case */
+#define        EC_POINT_get_affine_coordinates EC_POINT_get_affine_coordinates_GFp
+
+static ECDSA_SIG *ecdsa_do_sign(const unsigned char *dgst, int dlen, ECDSA *ecdsa);
+static int ecdsa_sign_setup(ECDSA *ecdsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp);
+static int ecdsa_do_verify(const unsigned char *dgst, int dgst_len, ECDSA_SIG *sig,
+                          ECDSA *ecdsa);
+
+static ECDSA_METHOD openssl_ecdsa_meth = {
+"OpenSSL ECDSA method",
+ecdsa_do_sign,
+ecdsa_sign_setup,
+ecdsa_do_verify,
+0,
+NULL
+};
+
+const ECDSA_METHOD *ECDSA_OpenSSL(void)
+{
+       return &openssl_ecdsa_meth;
+}
+
+static int ecdsa_sign_setup(ECDSA *ecdsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
+{
+       BN_CTX   *ctx = NULL;
+       BIGNUM   k,*kinv=NULL,*r=NULL,*order=NULL,*X=NULL;
+       EC_POINT *tmp_point=NULL;
+       int      ret = 0,reason = ERR_R_BN_LIB;
+       if (!ecdsa  || !ecdsa->group || !ecdsa->pub_key || !ecdsa->priv_key)
+       {
+               reason = ECDSA_R_MISSING_PARAMETERS;
+               return 0;
+       }
+       if (ctx_in == NULL) 
+       {
+               if ((ctx=BN_CTX_new()) == NULL) goto err;
+       }
+       else
+               ctx=ctx_in;
+
+       if ((r = BN_new()) == NULL) goto err;
+       if ((order = BN_new()) == NULL) goto err;
+       if ((X = BN_new()) == NULL) goto err;
+       if ((tmp_point = EC_POINT_new(ecdsa->group)) == NULL)
+       {
+               reason = ERR_R_EC_LIB;
+               goto err;
+       }
+       if (!EC_POINT_copy(tmp_point,EC_GROUP_get0_generator(ecdsa->group)))
+       {
+               reason = ERR_R_EC_LIB;
+               goto err;
+       }
+       if (!EC_GROUP_get_order(ecdsa->group,order,ctx))
+       {
+               reason = ERR_R_EC_LIB;
+               goto err;
+       }
+       
+       do
+       {
+               /* get random k */      
+               BN_init(&k);
+               do
+                       if (!BN_rand_range(&k,order))
+                       {
+                               reason = ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED;
+                               goto err;
+                       }
+               while (BN_is_zero(&k));
+
+               /* compute r the x-coordinate of generator * k */
+               if (!EC_POINT_mul(ecdsa->group,tmp_point,&k,NULL,NULL,ctx) 
+                   || !EC_POINT_get_affine_coordinates(ecdsa->group,tmp_point,X,NULL,ctx))
+               {
+                       reason = ERR_R_EC_LIB;
+                       goto err;
+               }
+               if (!BN_nnmod(r,X,order,ctx)) goto err;
+       }
+       while (BN_is_zero(r));
+
+       /* compute the inverse of k */
+       if ((kinv = BN_mod_inverse(NULL,&k,order,ctx)) == NULL) goto err;
+
+       if (*rp == NULL)
+               BN_clear_free(*rp);
+       *rp = r;
+       if (*kinvp == NULL) 
+               BN_clear_free(*kinvp);
+       *kinvp = kinv;
+       kinv = NULL;
+       ret = 1;
+err:
+       if (!ret)
+       {
+               ECDSAerr(ECDSA_F_ECDSA_SIGN_SETUP,reason);
+               if (kinv != NULL) BN_clear_free(kinv);
+               if (r != NULL) BN_clear_free(r);
+       }
+       if (ctx_in == NULL) 
+               BN_CTX_free(ctx);
+       if (kinv != NULL)
+               BN_clear_free(kinv);
+       if (order != NULL)
+               BN_clear_free(order);
+       if (tmp_point != NULL) 
+               EC_POINT_free(tmp_point);
+       if (X)  BN_clear_free(X);
+       BN_clear_free(&k);
+       return(ret);
+}
+
+
+static ECDSA_SIG *ecdsa_do_sign(const unsigned char *dgst, int dgst_len, ECDSA *ecdsa)
+{
+       BIGNUM *kinv=NULL,*r=NULL,*s=NULL,*m=NULL,*tmp=NULL,*order=NULL;
+       BIGNUM xr;
+       BN_CTX *ctx=NULL;
+       int reason=ERR_R_BN_LIB;
+       ECDSA_SIG *ret=NULL;
+
+       if (!ecdsa || !ecdsa->group || !ecdsa->pub_key || !ecdsa->priv_key)
+       {
+               reason = ECDSA_R_MISSING_PARAMETERS;
+               goto err;
+       }
+       BN_init(&xr);
+
+       if ((ctx = BN_CTX_new()) == NULL) goto err;
+       if ((order = BN_new()) == NULL) goto err;
+       if ((tmp = BN_new()) == NULL) goto err;
+       if ((m = BN_new()) == NULL) goto err;
+       if ((s = BN_new()) == NULL) goto err;
+
+       if (!EC_GROUP_get_order(ecdsa->group,order,ctx))
+       {
+               reason = ECDSA_R_ERR_EC_LIB;
+               goto err;
+       }
+       if (dgst_len > BN_num_bytes(order))
+       {
+               reason = ECDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE;
+               goto err;
+       }
+
+       if (BN_bin2bn(dgst,dgst_len,m) == NULL) goto err;
+       do
+       {
+               if ((ecdsa->kinv == NULL) || (ecdsa->r == NULL))
+               {
+                       if (!ECDSA_sign_setup(ecdsa,ctx,&kinv,&r)) goto err;
+               }
+               else
+               {
+                       kinv = ecdsa->kinv;
+                       ecdsa->kinv = NULL;
+                       r = ecdsa->r;
+                       ecdsa->r = NULL;
+               }
+
+               if (!BN_mod_mul(tmp,ecdsa->priv_key,r,order,ctx)) goto err;
+               if (!BN_add(s,tmp,m)) goto err;
+               if (BN_cmp(s,order) > 0)
+                       BN_sub(s,s,order);
+               if (!BN_mod_mul(s,s,kinv,order,ctx)) goto err;
+       }
+       while (BN_is_zero(s));
+
+       if ((ret = ECDSA_SIG_new()) == NULL)
+       {
+               reason = ECDSA_R_SIGNATURE_MALLOC_FAILED;
+               goto err;
+       }
+       ret->r = r;
+       ret->s = s;
+       
+err:
+       if (!ret)
+               {
+               ECDSAerr(ECDSA_F_ECDSA_DO_SIGN,reason);
+               BN_free(r);
+               BN_free(s);
+               }
+       if (ctx   != NULL) BN_CTX_free(ctx);
+       if (m     != NULL) BN_clear_free(m);
+       if (tmp   != NULL) BN_clear_free(tmp);
+       if (order != NULL) BN_clear_free(order);
+       if (kinv  != NULL) BN_clear_free(kinv);
+       return(ret);
+}
+
+static int ecdsa_do_verify(const unsigned char *dgst, int dgst_len, ECDSA_SIG *sig,
+                          ECDSA *ecdsa)
+{
+       BN_CTX *ctx;
+       BIGNUM *order=NULL,*u1=NULL,*u2=NULL,*m=NULL,*X=NULL;
+       EC_POINT *point=NULL;
+       int ret = -1,reason = ERR_R_BN_LIB;
+       if (!ecdsa || !ecdsa->group || !ecdsa->pub_key || !sig)
+       {
+               reason = ECDSA_R_MISSING_PARAMETERS;
+               return -1;
+       }
+
+       if ((ctx = BN_CTX_new()) == NULL) goto err;
+       if ((order = BN_new()) == NULL) goto err;
+       if ((u1 = BN_new()) == NULL) goto err;
+       if ((u2 = BN_new()) == NULL) goto err;
+       if ((m  = BN_new()) == NULL) goto err;
+       if ((X  = BN_new()) == NULL) goto err;
+       if (!EC_GROUP_get_order(ecdsa->group,order,ctx)) goto err;
+
+       if (BN_is_zero(sig->r) || sig->r->neg || BN_ucmp(sig->r, order) >= 0)
+       {
+               reason = ECDSA_R_BAD_SIGNATURE;
+               ret = 0;
+               goto err;
+       }
+       if (BN_is_zero(sig->s) || sig->s->neg || BN_ucmp(sig->s, order) >= 0)
+       {
+               reason = ECDSA_R_BAD_SIGNATURE;
+               ret = 0;
+               goto err;
+       }
+
+       /* calculate tmp1 = inv(S) mod order */
+       if ((BN_mod_inverse(u2,sig->s,order,ctx)) == NULL) goto err;
+       /* digest -> m */
+       if (BN_bin2bn(dgst,dgst_len,m) == NULL) goto err;
+       /* u1 = m * tmp mod order */
+       if (!BN_mod_mul(u1,m,u2,order,ctx)) goto err;
+       /* u2 = r * w mod q */
+       if (!BN_mod_mul(u2,sig->r,u2,order,ctx)) goto err;
+
+       if ((point = EC_POINT_new(ecdsa->group)) == NULL)
+       {
+               reason = ERR_R_EC_LIB;
+               goto err;
+       }
+       if (!EC_POINT_copy(point,EC_GROUP_get0_generator(ecdsa->group)))
+       {
+               reason = ERR_R_EC_LIB;
+               goto err;
+       }
+       if (!EC_POINT_mul(ecdsa->group,point,u1,ecdsa->pub_key,u2,ctx)
+           || !EC_POINT_get_affine_coordinates(ecdsa->group,point,X,NULL,ctx))
+       {
+               reason = ERR_R_EC_LIB;
+               goto err;
+       }
+       if (!BN_nnmod(u1,X,order,ctx)) goto err;
+
+       /*  is now in u1.  If the signature is correct, it will be
+        * equal to R. */
+       ret = (BN_ucmp(u1,sig->r) == 0);
+
+       err:
+       if (ret != 1) ECDSAerr(ECDSA_F_ECDSA_DO_VERIFY,reason);
+       if (ctx != NULL) BN_CTX_free(ctx);
+       if (u1  != NULL) BN_clear_free(u1);
+       if (u2  != NULL) BN_clear_free(u2);
+       if (m   != NULL) BN_clear_free(m);
+       if (X   != NULL) BN_clear_free(X);
+       if (order != NULL) BN_clear_free(order);
+       if (point != NULL) EC_POINT_free(point);
+       return(ret);
+}
diff --git a/crypto/ecdsa/ecs_sign.c b/crypto/ecdsa/ecs_sign.c
new file mode 100644 (file)
index 0000000..eb18685
--- /dev/null
@@ -0,0 +1,138 @@
+/* crypto/ecdsa/ecdsa_sign.c */
+/* ====================================================================
+ * Copyright (c) 1998-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
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written