summaryrefslogtreecommitdiffstats
path: root/crypto/dsa
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2006-03-28 14:35:32 +0000
committerDr. Stephen Henson <steve@openssl.org>2006-03-28 14:35:32 +0000
commit3e4585c8fd0b23f884d775462736502599146af6 (patch)
tree27b73970dedcc4215d6f7c4def10ee3990674143 /crypto/dsa
parent3e84b6e15fe6a580177b9e242c66e1d1ab6c2164 (diff)
New utility pkeyparam. Enhance and bugfix algorithm specific parameter
functions to support it.
Diffstat (limited to 'crypto/dsa')
-rw-r--r--crypto/dsa/dsa.h1
-rw-r--r--crypto/dsa/dsa_ameth.c20
-rw-r--r--crypto/dsa/dsa_err.c1
3 files changed, 21 insertions, 1 deletions
diff --git a/crypto/dsa/dsa.h b/crypto/dsa/dsa.h
index 5ee83e33ba..502b4896a3 100644
--- a/crypto/dsa/dsa.h
+++ b/crypto/dsa/dsa.h
@@ -260,6 +260,7 @@ void ERR_load_DSA_strings(void);
#define DSA_F_DSA_DO_SIGN 112
#define DSA_F_DSA_DO_VERIFY 113
#define DSA_F_DSA_NEW_METHOD 103
+#define DSA_F_DSA_PARAM_DECODE 119
#define DSA_F_DSA_PRINT 104
#define DSA_F_DSA_PRINT_FP 105
#define DSA_F_DSA_PRIV_DECODE 115
diff --git a/crypto/dsa/dsa_ameth.c b/crypto/dsa/dsa_ameth.c
index 31982242e2..9d55665c4a 100644
--- a/crypto/dsa/dsa_ameth.c
+++ b/crypto/dsa/dsa_ameth.c
@@ -473,6 +473,23 @@ err:
return(ret);
}
+static int dsa_param_decode(EVP_PKEY *pkey,
+ const unsigned char **pder, int derlen)
+ {
+ DSA *dsa;
+ if (!(dsa = d2i_DSAparams(NULL, pder, derlen)))
+ {
+ DSAerr(DSA_F_DSA_PARAM_DECODE, ERR_R_DSA_LIB);
+ return 0;
+ }
+ EVP_PKEY_assign_DSA(pkey, dsa);
+ return 1;
+ }
+
+static int dsa_param_encode(const EVP_PKEY *pkey, unsigned char **pder)
+ {
+ return i2d_DSAparams(pkey->pkey.dsa, pder);
+ }
static int dsa_param_print(BIO *bp, const EVP_PKEY *pkey, int indent,
ASN1_PCTX *ctx)
@@ -560,7 +577,8 @@ const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[] =
int_dsa_size,
dsa_bits,
- 0,0,
+ dsa_param_decode,
+ dsa_param_encode,
dsa_missing_parameters,
dsa_copy_parameters,
dsa_cmp_parameters,
diff --git a/crypto/dsa/dsa_err.c b/crypto/dsa/dsa_err.c
index 920cabf282..492c8fa3d0 100644
--- a/crypto/dsa/dsa_err.c
+++ b/crypto/dsa/dsa_err.c
@@ -76,6 +76,7 @@ static ERR_STRING_DATA DSA_str_functs[]=
{ERR_FUNC(DSA_F_DSA_DO_SIGN), "DSA_do_sign"},
{ERR_FUNC(DSA_F_DSA_DO_VERIFY), "DSA_do_verify"},
{ERR_FUNC(DSA_F_DSA_NEW_METHOD), "DSA_new_method"},
+{ERR_FUNC(DSA_F_DSA_PARAM_DECODE), "DSA_PARAM_DECODE"},
{ERR_FUNC(DSA_F_DSA_PRINT), "DSA_print"},
{ERR_FUNC(DSA_F_DSA_PRINT_FP), "DSA_print_fp"},
{ERR_FUNC(DSA_F_DSA_PRIV_DECODE), "DSA_PRIV_DECODE"},