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/asn1/t_pkey.c | |
parent | 7a8645d1716d7f84435b0f3d8d2fd122d6f75113 (diff) | |
download | openssl-14a7cfb32a0347a4bc620ae1b552b21c4c1e270b.tar.gz |
use a generic EC_KEY structure (EC keys are not ECDSA specific)
Submitted by: Nils Larsch
Diffstat (limited to 'crypto/asn1/t_pkey.c')
-rw-r--r-- | crypto/asn1/t_pkey.c | 65 |
1 files changed, 30 insertions, 35 deletions
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); } |