diff options
author | Bodo Möller <bodo@openssl.org> | 2002-08-07 10:49:54 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2002-08-07 10:49:54 +0000 |
commit | 14a7cfb32a0347a4bc620ae1b552b21c4c1e270b (patch) | |
tree | 13c4bcc3d58ba7db5e598cd668670873b51e8ce3 /crypto | |
parent | 7a8645d1716d7f84435b0f3d8d2fd122d6f75113 (diff) |
use a generic EC_KEY structure (EC keys are not ECDSA specific)
Submitted by: Nils Larsch
Diffstat (limited to 'crypto')
38 files changed, 1625 insertions, 1484 deletions
diff --git a/crypto/asn1/Makefile.ssl b/crypto/asn1/Makefile.ssl index 3c659ab87b..56699e57e6 100644 --- a/crypto/asn1/Makefile.ssl +++ b/crypto/asn1/Makefile.ssl @@ -439,19 +439,19 @@ d2i_pr.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h d2i_pr.o: ../../include/openssl/des.h ../../include/openssl/des_old.h d2i_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h d2i_pr.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h -d2i_pr.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h -d2i_pr.o: ../../include/openssl/evp.h ../../include/openssl/idea.h -d2i_pr.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h -d2i_pr.o: ../../include/openssl/md4.h ../../include/openssl/md5.h -d2i_pr.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h -d2i_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -d2i_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h -d2i_pr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h -d2i_pr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h -d2i_pr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h -d2i_pr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h -d2i_pr.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h -d2i_pr.o: ../../include/openssl/ui_compat.h ../cryptlib.h d2i_pr.c +d2i_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h +d2i_pr.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h +d2i_pr.o: ../../include/openssl/md2.h ../../include/openssl/md4.h +d2i_pr.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +d2i_pr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h +d2i_pr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +d2i_pr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h +d2i_pr.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +d2i_pr.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +d2i_pr.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +d2i_pr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h +d2i_pr.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h +d2i_pr.o: ../cryptlib.h d2i_pr.c d2i_pu.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h d2i_pu.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h d2i_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h @@ -459,19 +459,19 @@ d2i_pu.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h d2i_pu.o: ../../include/openssl/des.h ../../include/openssl/des_old.h d2i_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h d2i_pu.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h -d2i_pu.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h -d2i_pu.o: ../../include/openssl/evp.h ../../include/openssl/idea.h -d2i_pu.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h -d2i_pu.o: ../../include/openssl/md4.h ../../include/openssl/md5.h -d2i_pu.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h -d2i_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -d2i_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h -d2i_pu.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h -d2i_pu.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h -d2i_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h -d2i_pu.o: ../../include/openssl/sha.h ../../include/openssl/stack.h -d2i_pu.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h -d2i_pu.o: ../../include/openssl/ui_compat.h ../cryptlib.h d2i_pu.c +d2i_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h +d2i_pu.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h +d2i_pu.o: ../../include/openssl/md2.h ../../include/openssl/md4.h +d2i_pu.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +d2i_pu.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h +d2i_pu.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +d2i_pu.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h +d2i_pu.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +d2i_pu.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +d2i_pu.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +d2i_pu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h +d2i_pu.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h +d2i_pu.o: ../cryptlib.h d2i_pu.c evp_asn1.o: ../../e_os.h ../../include/openssl/asn1.h evp_asn1.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h evp_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h @@ -512,19 +512,19 @@ i2d_pr.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h i2d_pr.o: ../../include/openssl/des.h ../../include/openssl/des_old.h i2d_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h i2d_pr.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h -i2d_pr.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h -i2d_pr.o: ../../include/openssl/evp.h ../../include/openssl/idea.h -i2d_pr.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h -i2d_pr.o: ../../include/openssl/md4.h ../../include/openssl/md5.h -i2d_pr.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h -i2d_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -i2d_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h -i2d_pr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h -i2d_pr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h -i2d_pr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h -i2d_pr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h -i2d_pr.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h -i2d_pr.o: ../../include/openssl/ui_compat.h ../cryptlib.h i2d_pr.c +i2d_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h +i2d_pr.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h +i2d_pr.o: ../../include/openssl/md2.h ../../include/openssl/md4.h +i2d_pr.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +i2d_pr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h +i2d_pr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +i2d_pr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h +i2d_pr.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +i2d_pr.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +i2d_pr.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +i2d_pr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h +i2d_pr.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h +i2d_pr.o: ../cryptlib.h i2d_pr.c i2d_pu.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h i2d_pu.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h i2d_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h @@ -532,19 +532,19 @@ i2d_pu.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h i2d_pu.o: ../../include/openssl/des.h ../../include/openssl/des_old.h i2d_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h i2d_pu.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h -i2d_pu.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h -i2d_pu.o: ../../include/openssl/evp.h ../../include/openssl/idea.h -i2d_pu.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h -i2d_pu.o: ../../include/openssl/md4.h ../../include/openssl/md5.h -i2d_pu.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h -i2d_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -i2d_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h -i2d_pu.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h -i2d_pu.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h -i2d_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h -i2d_pu.o: ../../include/openssl/sha.h ../../include/openssl/stack.h -i2d_pu.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h -i2d_pu.o: ../../include/openssl/ui_compat.h ../cryptlib.h i2d_pu.c +i2d_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h +i2d_pu.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h +i2d_pu.o: ../../include/openssl/md2.h ../../include/openssl/md4.h +i2d_pu.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +i2d_pu.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h +i2d_pu.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +i2d_pu.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h +i2d_pu.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +i2d_pu.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +i2d_pu.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +i2d_pu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h +i2d_pu.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h +i2d_pu.o: ../cryptlib.h i2d_pu.c n_pkey.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h n_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/asn1t.h n_pkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h @@ -708,13 +708,13 @@ t_pkey.o: ../../e_os.h ../../include/openssl/asn1.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/obj_mac.h ../../include/openssl/objects.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_pkey.o: ../../include/openssl/ec.h ../../include/openssl/err.h +t_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h +t_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +t_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h +t_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +t_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h +t_pkey.o: ../cryptlib.h t_pkey.c t_req.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h t_req.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h t_req.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h diff --git a/crypto/asn1/asn1.h b/crypto/asn1/asn1.h index 303fe5da8b..1be3e02298 100644 --- a/crypto/asn1/asn1.h +++ b/crypto/asn1/asn1.h @@ -1010,6 +1010,7 @@ void ERR_load_ASN1_strings(void); #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_EC_PUBKEY 176 #define ASN1_F_I2D_NETSCAPE_RSA 162 #define ASN1_F_I2D_PRIVATEKEY 163 #define ASN1_F_I2D_PUBLICKEY 164 diff --git a/crypto/asn1/asn1_err.c b/crypto/asn1/asn1_err.c index dbb9753bb9..d64f987ac6 100644 --- a/crypto/asn1/asn1_err.c +++ b/crypto/asn1/asn1_err.c @@ -128,7 +128,8 @@ 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_ECDSA_PUBKEY,0), "I2D_ECDSA_PUBKEY"}, +{ERR_PACK(0,ASN1_F_I2D_EC_PUBKEY,0), "i2d_EC_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"}, diff --git a/crypto/asn1/d2i_pr.c b/crypto/asn1/d2i_pr.c index d56e5fdc6e..8d0dc27904 100644 --- a/crypto/asn1/d2i_pr.c +++ b/crypto/asn1/d2i_pr.c @@ -68,8 +68,8 @@ #ifndef OPENSSL_NO_DSA #include <openssl/dsa.h> #endif -#ifndef OPENSSL_NO_ECDSA -#include <openssl/ecdsa.h> +#ifndef OPENSSL_NO_EC +#include <openssl/ec.h> #endif EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, unsigned char **pp, @@ -111,9 +111,9 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, unsigned char **pp, } break; #endif -#ifndef OPENSSL_NO_ECDSA - case EVP_PKEY_ECDSA: - if ((ret->pkey.ecdsa = d2i_ECDSAPrivateKey(NULL, +#ifndef OPENSSL_NO_EC + case EVP_PKEY_EC: + if ((ret->pkey.eckey = d2i_ECPrivateKey(NULL, (const unsigned char **)pp, length)) == NULL) { ASN1err(ASN1_F_D2I_PRIVATEKEY, ERR_R_ASN1_LIB); @@ -154,7 +154,7 @@ EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, unsigned char **pp, if(sk_ASN1_TYPE_num(inkey) == 6) keytype = EVP_PKEY_DSA; else if (sk_ASN1_TYPE_num(inkey) == 4) - keytype = EVP_PKEY_ECDSA; + keytype = EVP_PKEY_EC; else keytype = EVP_PKEY_RSA; sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free); return d2i_PrivateKey(keytype, a, pp, length); diff --git a/crypto/asn1/d2i_pu.c b/crypto/asn1/d2i_pu.c index f66d72fd7b..cf97b83eac 100644 --- a/crypto/asn1/d2i_pu.c +++ b/crypto/asn1/d2i_pu.c @@ -68,8 +68,8 @@ #ifndef OPENSSL_NO_DSA #include <openssl/dsa.h> #endif -#ifndef OPENSSL_NO_ECDSA -#include <openssl/ecdsa.h> +#ifndef OPENSSL_NO_EC +#include <openssl/ec.h> #endif EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp, @@ -111,10 +111,11 @@ EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp, } break; #endif -#ifndef OPENSSL_NO_ECDSA - case EVP_PKEY_ECDSA: - if ((ret->pkey.ecdsa = ECDSAPublicKey_set_octet_string(&(ret->pkey.ecdsa), - (const unsigned char **)pp, length)) == NULL) +#ifndef OPENSSL_NO_EC + case EVP_PKEY_EC: + if ((ret->pkey.eckey = ECPublicKey_set_octet_string( + &(ret->pkey.eckey), (const unsigned char **)pp, + length)) == NULL) { ASN1err(ASN1_F_D2I_PUBLICKEY, ERR_R_ASN1_LIB); goto err; diff --git a/crypto/asn1/i2d_pr.c b/crypto/asn1/i2d_pr.c index a40c64d3f4..bbf2a0d2d6 100644 --- a/crypto/asn1/i2d_pr.c +++ b/crypto/asn1/i2d_pr.c @@ -67,8 +67,8 @@ #ifndef OPENSSL_NO_DSA #include <openssl/dsa.h> #endif -#ifndef OPENSSL_NO_ECDSA -#include <openssl/ecdsa.h> +#ifndef OPENSSL_NO_EC +#include <openssl/ec.h> #endif int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp) @@ -86,10 +86,10 @@ 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) +#ifndef OPENSSL_NO_EC + if (a->type == EVP_PKEY_EC) { - return(i2d_ECDSAPrivateKey(a->pkey.ecdsa, pp)); + return(i2d_ECPrivateKey(a->pkey.eckey, pp)); } #endif diff --git a/crypto/asn1/i2d_pu.c b/crypto/asn1/i2d_pu.c index 2fcc5554a7..85220b44d6 100644 --- a/crypto/asn1/i2d_pu.c +++ b/crypto/asn1/i2d_pu.c @@ -67,8 +67,8 @@ #ifndef OPENSSL_NO_DSA #include <openssl/dsa.h> #endif -#ifndef OPENSSL_NO_ECDSA -#include <openssl/ecdsa.h> +#ifndef OPENSSL_NO_EC +#include <openssl/ec.h> #endif int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp) @@ -83,9 +83,9 @@ int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp) case EVP_PKEY_DSA: return(i2d_DSAPublicKey(a->pkey.dsa,pp)); #endif -#ifndef OPENSSL_NO_ECDSA - case EVP_PKEY_ECDSA: - return(ECDSAPublicKey_get_octet_string(a->pkey.ecdsa, pp)); +#ifndef OPENSSL_NO_EC + case EVP_PKEY_EC: + return(ECPublicKey_get_octet_string(a->pkey.eckey, pp)); #endif default: ASN1err(ASN1_F_I2D_PUBLICKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE); diff --git a/crypto/asn1/t_pkey.c b/crypto/asn1/t_pkey.c index 652b26b7b0..fb01e38d79 100644 --- a/crypto/asn1/t_pkey.c +++ b/crypto/asn1/t_pkey.c @@ -70,8 +70,8 @@ #ifndef OPENSSL_NO_DSA #include <openssl/dsa.h> #endif -#ifndef OPENSSL_NO_ECDSA -#include <openssl/ecdsa.h> +#ifndef OPENSSL_NO_EC +#include <openssl/ec.h> #endif static int print(BIO *fp,const char *str,BIGNUM *num, @@ -257,6 +257,22 @@ int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off) BIO_free(b); return(ret); } + +int EC_KEY_print_fp(FILE *fp, const EC_KEY *x, int off) + { + BIO *b; + int ret; + + if ((b=BIO_new(BIO_s_file())) == NULL) + { + ECerr(EC_F_EC_KEY_PRINT_FP, ERR_R_BIO_LIB); + return(0); + } + BIO_set_fp(b, fp, BIO_NOCLOSE); + ret = EC_KEY_print(b, x, off); + BIO_free(b); + return(ret); + } #endif int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off) @@ -436,29 +452,8 @@ err: OPENSSL_free(buffer); return(ret); } -#endif /* OPENSSL_NO_EC */ - - -#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) +int EC_KEY_print(BIO *bp, const EC_KEY *x, int off) { char str[128]; unsigned char *buffer=NULL; @@ -474,7 +469,7 @@ int ECDSA_print(BIO *bp, const ECDSA *x, int off) } if ((pub_key = EC_POINT_point2bn(x->group, x->pub_key, - ECDSA_get_conversion_form(x), NULL, ctx)) == NULL) + x->conv_form, NULL, ctx)) == NULL) { reason = ERR_R_EC_LIB; goto err; @@ -516,7 +511,7 @@ int ECDSA_print(BIO *bp, const ECDSA *x, int off) ret=1; err: if (!ret) - ECDSAerr(ECDSA_F_ECDSA_PRINT, reason); + ECerr(EC_F_EC_KEY_PRINT, reason); if (pub_key) BN_free(pub_key); if (ctx) @@ -525,7 +520,7 @@ err: OPENSSL_free(buffer); return(ret); } -#endif +#endif /* OPENSSL_NO_EC */ static int print(BIO *bp, const char *number, BIGNUM *num, unsigned char *buf, int off) @@ -690,26 +685,26 @@ err: #endif /* !OPENSSL_NO_DSA */ -#ifndef OPENSSL_NO_ECDSA +#ifndef OPENSSL_NO_EC #ifndef OPENSSL_NO_FP_API -int ECDSAParameters_print_fp(FILE *fp, const ECDSA *x) +int ECParameters_print_fp(FILE *fp, const EC_KEY *x) { BIO *b; int ret; if ((b=BIO_new(BIO_s_file())) == NULL) - { - ECDSAerr(ECDSA_F_ECDSAPARAMETERS_PRINT_FP, ERR_R_BIO_LIB); + { + ECerr(EC_F_ECPARAMETERS_PRINT_FP, ERR_R_BIO_LIB); return(0); - } + } BIO_set_fp(b, fp, BIO_NOCLOSE); - ret = ECDSAParameters_print(b, x); + ret = ECParameters_print(b, x); BIO_free(b); return(ret); } #endif -int ECDSAParameters_print(BIO *bp, const ECDSA *x) +int ECParameters_print(BIO *bp, const EC_KEY *x) { int reason=ERR_R_EC_LIB, ret=0; BIGNUM *order=NULL; @@ -741,7 +736,7 @@ int ECDSAParameters_print(BIO *bp, const ECDSA *x) err: if (order) BN_free(order); - ECDSAerr(ECDSA_F_ECDSAPARAMETERS_PRINT, reason); + ECerr(EC_F_ECPARAMETERS_PRINT, reason); return(ret); } diff --git a/crypto/asn1/t_req.c b/crypto/asn1/t_req.c index bfa58cc967..7cf09a4646 100644 --- a/crypto/asn1/t_req.c +++ b/crypto/asn1/t_req.c @@ -134,11 +134,11 @@ int X509_REQ_print(BIO *bp, X509_REQ *x) } else #endif -#ifndef OPENSSL_NO_ECDSA - if (pkey != NULL && pkey->type == EVP_PKEY_ECDSA) +#ifndef OPENSSL_NO_EC + if (pkey != NULL && pkey->type == EVP_PKEY_EC) { - BIO_printf(bp, "%12sECDSA Public Key: \n",""); - ECDSA_print(bp, pkey->pkey.ecdsa, 16); + BIO_printf(bp, "%12sEC Public Key: \n",""); + EC_KEY_print(bp, pkey->pkey.eckey, 16); } else #endif diff --git a/crypto/asn1/t_spki.c b/crypto/asn1/t_spki.c index 86821119d8..499e12834a 100644 --- a/crypto/asn1/t_spki.c +++ b/crypto/asn1/t_spki.c @@ -93,11 +93,11 @@ int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki) } else #endif -#ifndef OPENSSL_NO_ECDSA - if (pkey->type == EVP_PKEY_ECDSA) +#ifndef OPENSSL_NO_EC + if (pkey->type == EVP_PKEY_EC) { - BIO_printf(out, " ECDSA Public Key:\n"); - ECDSA_print(out, pkey->pkey.ecdsa,2); + BIO_printf(out, " EC Public Key:\n"); + EC_KEY_print(out, pkey->pkey.eckey,2); } else #endif diff --git a/crypto/asn1/t_x509.c b/crypto/asn1/t_x509.c index ae6d5ce041..5074a74928 100644 --- a/crypto/asn1/t_x509.c +++ b/crypto/asn1/t_x509.c @@ -66,8 +66,8 @@ #ifndef OPENSSL_NO_DSA #include <openssl/dsa.h> #endif -#ifndef OPENSSL_NO_ECDSA -#include <openssl/ecdsa.h> +#ifndef OPENSSL_NO_EC +#include <openssl/ec.h> #endif #include <openssl/objects.h> #include <openssl/x509.h> @@ -232,11 +232,11 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) } else #endif -#ifndef OPENSSL_NO_ECDSA - if (pkey->type == EVP_PKEY_ECDSA) +#ifndef OPENSSL_NO_EC + if (pkey->type == EVP_PKEY_EC) { - BIO_printf(bp, "%12sECDSA Public Key:\n",""); - ECDSA_print(bp, pkey->pkey.ecdsa, 16); + BIO_printf(bp, "%12sEC Public Key:\n",""); + EC_KEY_print(bp, pkey->pkey.eckey, 16); } else #endif diff --git a/crypto/asn1/x_pubkey.c b/crypto/asn1/x_pubkey.c index 68ddeb43f2..c32a6eaa49 100644 --- a/crypto/asn1/x_pubkey.c +++ b/crypto/asn1/x_pubkey.c @@ -129,14 +129,14 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) OPENSSL_free(p); } #endif -#ifndef OPENSSL_NO_ECDSA - else if (pkey->type == EVP_PKEY_ECDSA) +#ifndef OPENSSL_NO_EC + else if (pkey->type == EVP_PKEY_EC) { int nid=0; unsigned char *pp; - ECDSA *ecdsa; + EC_KEY *eckey; - ecdsa = pkey->pkey.ecdsa; + eckey = pkey->pkey.eckey; ASN1_TYPE_free(a->parameter); if ((a->parameter = ASN1_TYPE_new()) == NULL) @@ -145,8 +145,8 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) goto err; } - if (EC_GROUP_get_asn1_flag(ecdsa->group) - && (nid = EC_GROUP_get_nid(ecdsa->group))) + if (EC_GROUP_get_asn1_flag(eckey->group) + && (nid = EC_GROUP_get_nid(eckey->group))) { /* just set the OID */ a->parameter->type = V_ASN1_OBJECT; @@ -154,9 +154,9 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) } else /* explicit parameters */ { - if ((i = i2d_ECDSAParameters(ecdsa, NULL)) == 0) + if ((i = i2d_ECParameters(eckey, NULL)) == 0) { - X509err(X509_F_X509_PUBKEY_SET, ERR_R_ECDSA_LIB); + X509err(X509_F_X509_PUBKEY_SET, ERR_R_EC_LIB); goto err; } if ((p = (unsigned char *) OPENSSL_malloc(i)) == NULL) @@ -165,9 +165,9 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) goto err; } pp = p; - if (!i2d_ECDSAParameters(ecdsa, &pp)) + if (!i2d_ECParameters(eckey, &pp)) { - X509err(X509_F_X509_PUBKEY_SET, ERR_R_ECDSA_LIB); + X509err(X509_F_X509_PUBKEY_SET, ERR_R_EC_LIB); OPENSSL_free(p); goto err; } @@ -277,24 +277,25 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) ret->save_parameters=1; } #endif -#ifndef OPENSSL_NO_ECDSA - else if (ret->type == EVP_PKEY_ECDSA) +#ifndef OPENSSL_NO_EC + else if (ret->type == EVP_PKEY_EC) { if (a->parameter && (a->parameter->type == V_ASN1_SEQUENCE)) { /* type == V_ASN1_SEQUENCE => we have explicit parameters * (e.g. parameters in the X9_62_EC_PARAMETERS-structure ) */ - if ((ret->pkey.ecdsa= ECDSA_new()) == NULL) + if ((ret->pkey.eckey= EC_KEY_new()) == NULL) { - X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE); + X509err(X509_F_X509_PUBKEY_GET, + ERR_R_MALLOC_FAILURE); goto err; } cp = p = a->parameter->value.sequence->data; j = a->parameter->value.sequence->length; - if (!d2i_ECDSAParameters(&ret->pkey.ecdsa, &cp, (long)j)) + if (!d2i_ECParameters(&ret->pkey.eckey, &cp, (long)j)) { - X509err(X509_F_X509_PUBKEY_GET, ERR_R_ECDSA_LIB); + X509err(X509_F_X509_PUBKEY_GET, ERR_R_EC_LIB); goto err; } } @@ -303,16 +304,16 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) /* type == V_ASN1_OBJECT => the parameters are given * by an asn1 OID */ - ECDSA *ecdsa; - if (ret->pkey.ecdsa == NULL) - ret->pkey.ecdsa = ECDSA_new(); - ecdsa = ret->pkey.ecdsa; - if (ecdsa->group) - EC_GROUP_free(ecdsa->group); - if ((ecdsa->group = EC_GROUP_new_by_name( + EC_KEY *eckey; + if (ret->pkey.eckey == NULL) + ret->pkey.eckey = EC_KEY_new(); + eckey = ret->pkey.eckey; + if (eckey->group) + EC_GROUP_free(eckey->group); + if ((eckey->group = EC_GROUP_new_by_nid( OBJ_obj2nid(a->parameter->value.object))) == NULL) goto err; - EC_GROUP_set_asn1_flag(ecdsa->group, + EC_GROUP_set_asn1_flag(eckey->group, OPENSSL_EC_NAMED_CURVE); } /* the case implicitlyCA is currently n |