summaryrefslogtreecommitdiffstats
path: root/crypto/pem
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/pem
parent3e84b6e15fe6a580177b9e242c66e1d1ab6c2164 (diff)
New utility pkeyparam. Enhance and bugfix algorithm specific parameter
functions to support it.
Diffstat (limited to 'crypto/pem')
-rw-r--r--crypto/pem/pem.h3
-rw-r--r--crypto/pem/pem_lib.c14
-rw-r--r--crypto/pem/pem_pkey.c6
3 files changed, 20 insertions, 3 deletions
diff --git a/crypto/pem/pem.h b/crypto/pem/pem.h
index b273007c0e..e4c91adf58 100644
--- a/crypto/pem/pem.h
+++ b/crypto/pem/pem.h
@@ -673,6 +673,9 @@ EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, vo
int PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc,
char *kstr,int klen, pem_password_cb *cd, void *u);
+EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x);
+int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x);
+
#endif /* SSLEAY_MACROS */
diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c
index 22793fada0..9631ee2d5d 100644
--- a/crypto/pem/pem_lib.c
+++ b/crypto/pem/pem_lib.c
@@ -204,6 +204,20 @@ static int check_pem(const char *nm, const char *name)
return 0;
}
+ if(!strcmp(name,PEM_STRING_PARAMETERS))
+ {
+ int slen;
+ const EVP_PKEY_ASN1_METHOD *ameth;
+ slen = pem_check_suffix(nm, "PARAMETERS");
+ if (slen > 0)
+ {
+ ameth = EVP_PKEY_asn1_find_str(nm, slen);
+ if (ameth && ameth->param_decode)
+ return 1;
+ }
+ return 0;
+ }
+
/* Permit older strings */
if(!strcmp(nm,PEM_STRING_X509_OLD) &&
diff --git a/crypto/pem/pem_pkey.c b/crypto/pem/pem_pkey.c
index b9067e0745..7747a057f4 100644
--- a/crypto/pem/pem_pkey.c
+++ b/crypto/pem/pem_pkey.c
@@ -149,7 +149,7 @@ int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
pem_str,bp,(char *)x,enc,kstr,klen,cb,u);
}
-EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u)
+EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x)
{
char *nm=NULL;
const unsigned char *p=NULL;
@@ -159,7 +159,7 @@ EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, vo
EVP_PKEY *ret=NULL;
if (!PEM_bytes_read_bio(&data, &len, &nm, PEM_STRING_PARAMETERS,
- bp, cb, u))
+ bp, 0, NULL))
return NULL;
p = data;
@@ -192,7 +192,7 @@ err:
return(ret);
}
-int PEM_write_bio_Paramters(BIO *bp, EVP_PKEY *x)
+int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x)
{
char pem_str[80];
if (!x->ameth || !x->ameth->param_encode)