summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2009-09-06 15:49:46 +0000
committerDr. Stephen Henson <steve@openssl.org>2009-09-06 15:49:46 +0000
commitf4274da164c44699f980f5c897bc7f7727233337 (patch)
tree958dd498eb89320cbe94d0424c5b865d4009bcd9 /crypto
parent07a9d1a2c2b735cbc327065000b545deb5e136cf (diff)
PR: 1644
Submitted by: steve@openssl.org Fix to make DHparams_dup() et al work in C++. For 1.0 fix the final argument to ASN1_dup() so it is void *. Replace some *_dup macros with functions.
Diffstat (limited to 'crypto')
-rw-r--r--crypto/asn1/a_dup.c2
-rw-r--r--crypto/asn1/asn1.h2
-rw-r--r--crypto/dh/dh.h3
-rw-r--r--crypto/dh/dh_asn1.c5
-rw-r--r--crypto/dsa/dsa.h2
-rw-r--r--crypto/dsa/dsa_asn1.c5
6 files changed, 15 insertions, 4 deletions
diff --git a/crypto/asn1/a_dup.c b/crypto/asn1/a_dup.c
index 199d50f521..d98992548a 100644
--- a/crypto/asn1/a_dup.c
+++ b/crypto/asn1/a_dup.c
@@ -62,7 +62,7 @@
#ifndef NO_OLD_ASN1
-void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x)
+void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x)
{
unsigned char *b,*p;
const unsigned char *p2;
diff --git a/crypto/asn1/asn1.h b/crypto/asn1/asn1.h
index dfc6790ef6..f7718b5a94 100644
--- a/crypto/asn1/asn1.h
+++ b/crypto/asn1/asn1.h
@@ -952,7 +952,7 @@ int ASN1_put_eoc(unsigned char **pp);
int ASN1_object_size(int constructed, int length, int tag);
/* Used to implement other functions */
-void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x);
+void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x);
#define ASN1_dup_of(type,i2d,d2i,x) \
((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \
diff --git a/crypto/dh/dh.h b/crypto/dh/dh.h
index b0332f2c0c..849309a489 100644
--- a/crypto/dh/dh.h
+++ b/crypto/dh/dh.h
@@ -157,7 +157,6 @@ struct dh_st
this for backward compatibility: */
#define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME
-#define DHparams_dup(x) ASN1_dup_of_const(DH,i2d_DHparams,d2i_DHparams,x)
#define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \
(char *(*)())d2i_DHparams,(fp),(unsigned char **)(x))
#define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \
@@ -165,6 +164,8 @@ struct dh_st
#define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x)
#define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x)
+DH *DHparams_dup(DH *);
+
const DH_METHOD *DH_OpenSSL(void);
void DH_set_default_method(const DH_METHOD *meth);
diff --git a/crypto/dh/dh_asn1.c b/crypto/dh/dh_asn1.c
index a02b560572..0b4357d605 100644
--- a/crypto/dh/dh_asn1.c
+++ b/crypto/dh/dh_asn1.c
@@ -86,3 +86,8 @@ ASN1_SEQUENCE_cb(DHparams, dh_cb) = {
} ASN1_SEQUENCE_END_cb(DH, DHparams)
IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DH, DHparams, DHparams)
+
+DH *DHparams_dup(DH *dh)
+ {
+ return ASN1_item_dup(ASN1_ITEM_rptr(DHparams), dh);
+ }
diff --git a/crypto/dsa/dsa.h b/crypto/dsa/dsa.h
index 7e6d84a37e..ac50a5c846 100644
--- a/crypto/dsa/dsa.h
+++ b/crypto/dsa/dsa.h
@@ -165,7 +165,6 @@ struct dsa_st
ENGINE *engine;
};
-#define DSAparams_dup(x) ASN1_dup_of_const(DSA,i2d_DSAparams,d2i_DSAparams,x)
#define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \
(char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x))
#define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \
@@ -174,6 +173,7 @@ struct dsa_st
#define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x)
+DSA *DSAparams_dup(DSA *x);
DSA_SIG * DSA_SIG_new(void);
void DSA_SIG_free(DSA_SIG *a);
int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp);
diff --git a/crypto/dsa/dsa_asn1.c b/crypto/dsa/dsa_asn1.c
index 8277a74be2..c37460b2d6 100644
--- a/crypto/dsa/dsa_asn1.c
+++ b/crypto/dsa/dsa_asn1.c
@@ -143,3 +143,8 @@ ASN1_CHOICE_cb(DSAPublicKey, dsa_cb) = {
} ASN1_CHOICE_END_cb(DSA, DSAPublicKey, write_params)
IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DSA, DSAPublicKey, DSAPublicKey)
+
+DSA *DSAparams_dup(DSA *dsa)
+ {
+ return ASN1_item_dup(ASN1_ITEM_rptr(DSAparams), dsa);
+ }