From 3ae76679c7aeebd455173bb65b720b97c3261a79 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bodo=20M=C3=B6ller?= Date: Fri, 14 May 1999 11:52:49 +0000 Subject: [PATCH] Introduce and use function typedef pem_password_cb so that we don't call those functions without having a parameter list declaration. (There are various similar cases left ...) --- crypto/pem/pem.h | 77 +++++++++++++++++++++++-------------------- crypto/pem/pem_all.c | 56 +++++++++++++++---------------- crypto/pem/pem_info.c | 6 ++-- crypto/pem/pem_lib.c | 6 ++-- ssl/ssl.h | 5 +-- ssl/ssl_lib.c | 2 +- 6 files changed, 79 insertions(+), 73 deletions(-) diff --git a/crypto/pem/pem.h b/crypto/pem/pem.h index effba048ec..9434dfdbd9 100644 --- a/crypto/pem/pem.h +++ b/crypto/pem/pem.h @@ -317,9 +317,13 @@ typedef struct pem_ctx_st #endif +typedef int pem_password_cb(char *buf, int size, int rwflag); +/* "size" should be size_t, obviously, but it was always used + * without a parameter list declaration, which makes it "int" */ + int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); int PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len, - int (*callback)()); + pem_password_cb *); #ifdef HEADER_BIO_H int PEM_read_bio(BIO *bp, char **name, char **header, @@ -327,13 +331,13 @@ int PEM_read_bio(BIO *bp, char **name, char **header, int PEM_write_bio(BIO *bp,const char *name,char *hdr,unsigned char *data, long len); char * PEM_ASN1_read_bio(char *(*d2i)(),const char *name,BIO *bp,char **x, - int (*cb)()); + pem_password_cb *); int PEM_ASN1_write_bio(int (*i2d)(),const char *name,BIO *bp,char *x, const EVP_CIPHER *enc,unsigned char *kstr,int klen, - int (*callback)()); -STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, int (*cb)()); + pem_password_cb *); +STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *); int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc, - unsigned char *kstr, int klen, int (*cb)()); + unsigned char *kstr, int klen, pem_password_cb *); #endif #ifndef WIN16 @@ -341,11 +345,12 @@ int PEM_read(FILE *fp, char **name, char **header, unsigned char **data,long *len); int PEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len); char * PEM_ASN1_read(char *(*d2i)(),const char *name,FILE *fp,char **x, - int (*cb)()); + pem_password_cb *); int PEM_ASN1_write(int (*i2d)(),const char *name,FILE *fp,char *x, const EVP_CIPHER *enc,unsigned char *kstr,int klen, - int (*callback)()); -STACK_OF(X509_INFO) * PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, int (*cb)()); + pem_password_cb *); +STACK_OF(X509_INFO) * PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, + pem_password_cb *); #endif int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, @@ -379,38 +384,38 @@ void PEM_dek_info(char *buf, const char *type, int len, char *str); #endif #ifndef WIN16 -X509 *PEM_read_X509(FILE *fp,X509 **x,int (*cb)()); -X509_REQ *PEM_read_X509_REQ(FILE *fp,X509_REQ **x,int (*cb)()); -X509_CRL *PEM_read_X509_CRL(FILE *fp,X509_CRL **x,int (*cb)()); +X509 *PEM_read_X509(FILE *fp,X509 **x, pem_password_cb *); +X509_REQ *PEM_read_X509_REQ(FILE *fp,X509_REQ **x, pem_password_cb *); +X509_CRL *PEM_read_X509_CRL(FILE *fp,X509_CRL **x, pem_password_cb *); #ifndef NO_RSA -RSA *PEM_read_RSAPrivateKey(FILE *fp,RSA **x,int (*cb)()); -RSA *PEM_read_RSAPublicKey(FILE *fp,RSA **x,int (*cb)()); +RSA *PEM_read_RSAPrivateKey(FILE *fp,RSA **x, pem_password_cb *); +RSA *PEM_read_RSAPublicKey(FILE *fp,RSA **x, pem_password_cb *); #endif #ifndef NO_DSA -DSA *PEM_read_DSAPrivateKey(FILE *fp,DSA **x,int (*cb)()); -DSA *PEM_read_DSAparams(FILE *fp,DSA **x,int (*cb)()); +DSA *PEM_read_DSAPrivateKey(FILE *fp,DSA **x, pem_password_cb *); +DSA *PEM_read_DSAparams(FILE *fp,DSA **x, pem_password_cb *); #endif #ifndef NO_DH -DH *PEM_read_DHparams(FILE *fp,DH **x,int (*cb)()); +DH *PEM_read_DHparams(FILE *fp,DH **x, pem_password_cb *); #endif -EVP_PKEY *PEM_read_PrivateKey(FILE *fp,EVP_PKEY **x,int (*cb)()); -PKCS7 *PEM_read_PKCS7(FILE *fp,PKCS7 **x,int (*cb)()); -NETSCAPE_CERT_SEQUENCE *PEM_read_NETSCAPE_CERT_SEQUENCE(FILE *fp,NETSCAPE_CERT_SEQUENCE **x,int (*cb)()); +EVP_PKEY *PEM_read_PrivateKey(FILE *fp,EVP_PKEY **x, pem_password_cb *); +PKCS7 *PEM_read_PKCS7(FILE *fp,PKCS7 **x, pem_password_cb *); +NETSCAPE_CERT_SEQUENCE *PEM_read_NETSCAPE_CERT_SEQUENCE(FILE *fp,NETSCAPE_CERT_SEQUENCE **x, pem_password_cb *); int PEM_write_X509(FILE *fp,X509 *x); int PEM_write_X509_REQ(FILE *fp,X509_REQ *x); int PEM_write_X509_CRL(FILE *fp,X509_CRL *x); #ifndef NO_RSA int PEM_write_RSAPrivateKey(FILE *fp,RSA *x,EVP_CIPHER *enc,unsigned char *kstr, - int klen,int (*cb)()); + int klen, pem_password_cb *); int PEM_write_RSAPublicKey(FILE *fp,RSA *x); #endif #ifndef NO_DSA int PEM_write_DSAPrivateKey(FILE *fp,DSA *x,const EVP_CIPHER *enc, unsigned char *kstr, - int klen,int (*cb)()); + int klen, pem_password_cb *); #endif int PEM_write_PrivateKey(FILE *fp,EVP_PKEY *x,EVP_CIPHER *enc, - unsigned char *kstr,int klen,int (*cb)()); + unsigned char *kstr,int klen, pem_password_cb *); int PEM_write_PKCS7(FILE *fp,PKCS7 *x); #ifndef NO_DH int PEM_write_DHparams(FILE *fp,DH *x); @@ -422,39 +427,39 @@ int PEM_write_NETSCAPE_CERT_SEQUENCE(FILE *fp,NETSCAPE_CERT_SEQUENCE *x); #endif #ifdef HEADER_BIO_H -X509 *PEM_read_bio_X509(BIO *bp,X509 **x,int (*cb)()); -X509_REQ *PEM_read_bio_X509_REQ(BIO *bp,X509_REQ **x,int (*cb)()); -X509_CRL *PEM_read_bio_X509_CRL(BIO *bp,X509_CRL **x,int (*cb)()); +X509 *PEM_read_bio_X509(BIO *bp,X509 **x, pem_password_cb *); +X509_REQ *PEM_read_bio_X509_REQ(BIO *bp,X509_REQ **x, pem_password_cb *); +X509_CRL *PEM_read_bio_X509_CRL(BIO *bp,X509_CRL **x, pem_password_cb *); #ifndef NO_RSA -RSA *PEM_read_bio_RSAPrivateKey(BIO *bp,RSA **x,int (*cb)()); -RSA *PEM_read_bio_RSAPublicKey(BIO *bp,RSA **x,int (*cb)()); +RSA *PEM_read_bio_RSAPrivateKey(BIO *bp,RSA **x, pem_password_cb *); +RSA *PEM_read_bio_RSAPublicKey(BIO *bp,RSA **x, pem_password_cb *); #endif #ifndef NO_DSA -DSA *PEM_read_bio_DSAPrivateKey(BIO *bp,DSA **x,int (*cb)()); +DSA *PEM_read_bio_DSAPrivateKey(BIO *bp,DSA **x, pem_password_cb *); #endif -EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp,EVP_PKEY **x,int (*cb)()); -PKCS7 *PEM_read_bio_PKCS7(BIO *bp,PKCS7 **x,int (*cb)()); +EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp,EVP_PKEY **x, pem_password_cb *); +PKCS7 *PEM_read_bio_PKCS7(BIO *bp,PKCS7 **x, pem_password_cb *); #ifndef NO_DH -DH *PEM_read_bio_DHparams(BIO *bp,DH **x,int (*cb)()); +DH *PEM_read_bio_DHparams(BIO *bp,DH **x, pem_password_cb *); #endif -NETSCAPE_CERT_SEQUENCE *PEM_read_bio_NETSCAPE_CERT_SEQUENCE(BIO *bp,NETSCAPE_CERT_SEQUENCE **x,int (*cb)()); +NETSCAPE_CERT_SEQUENCE *PEM_read_bio_NETSCAPE_CERT_SEQUENCE(BIO *bp,NETSCAPE_CERT_SEQUENCE **x, pem_password_cb *); #ifndef NO_DSA -DSA *PEM_read_bio_DSAparams(BIO *bp,DSA **x,int (*cb)()); +DSA *PEM_read_bio_DSAparams(BIO *bp,DSA **x, pem_password_cb *); #endif int PEM_write_bio_X509(BIO *bp,X509 *x); int PEM_write_bio_X509_REQ(BIO *bp,X509_REQ *x); int PEM_write_bio_X509_CRL(BIO *bp,X509_CRL *x); #ifndef NO_RSA int PEM_write_bio_RSAPrivateKey(BIO *fp,RSA *x,const EVP_CIPHER *enc, - unsigned char *kstr,int klen,int (*cb)()); + unsigned char *kstr,int klen, pem_password_cb *); int PEM_write_bio_RSAPublicKey(BIO *fp,RSA *x); #endif #ifndef NO_DSA int PEM_write_bio_DSAPrivateKey(BIO *fp,DSA *x,const EVP_CIPHER *enc, - unsigned char *kstr,int klen,int (*cb)()); + unsigned char *kstr,int klen, pem_password_cb *); #endif int PEM_write_bio_PrivateKey(BIO *fp,EVP_PKEY *x,EVP_CIPHER *enc, - unsigned char *kstr,int klen,int (*cb)()); + unsigned char *kstr,int klen, pem_password_cb *); int PEM_write_bio_PKCS7(BIO *bp,PKCS7 *x); #ifndef NO_DH int PEM_write_bio_DHparams(BIO *bp,DH *x); diff --git a/crypto/pem/pem_all.c b/crypto/pem/pem_all.c index 740f6b5722..0775155fb0 100644 --- a/crypto/pem/pem_all.c +++ b/crypto/pem/pem_all.c @@ -67,14 +67,14 @@ #ifndef NO_FP_API /* The X509 functions */ -X509 *PEM_read_X509(FILE *fp, X509 **x, int (*cb)()) +X509 *PEM_read_X509(FILE *fp, X509 **x, pem_password_cb *cb) { return((X509 *)PEM_ASN1_read((char *(*)())d2i_X509, PEM_STRING_X509,fp,(char **)x,cb)); } #endif -X509 *PEM_read_bio_X509(BIO *bp, X509 **x, int (*cb)()) +X509 *PEM_read_bio_X509(BIO *bp, X509 **x, pem_password_cb *cb) { return((X509 *)PEM_ASN1_read_bio((char *(*)())d2i_X509, PEM_STRING_X509,bp,(char **)x,cb)); @@ -96,14 +96,14 @@ int PEM_write_bio_X509(BIO *bp, X509 *x) #ifndef NO_FP_API /* The X509_REQ functions */ -X509_REQ *PEM_read_X509_REQ(FILE *fp, X509_REQ **x, int (*cb)()) +X509_REQ *PEM_read_X509_REQ(FILE *fp, X509_REQ **x, pem_password_cb *cb) { return((X509_REQ *)PEM_ASN1_read((char *(*)())d2i_X509_REQ, PEM_STRING_X509_REQ,fp,(char **)x,cb)); } #endif -X509_REQ *PEM_read_bio_X509_REQ(BIO *bp, X509_REQ **x, int (*cb)()) +X509_REQ *PEM_read_bio_X509_REQ(BIO *bp, X509_REQ **x, pem_password_cb *cb) { return((X509_REQ *)PEM_ASN1_read_bio((char *(*)())d2i_X509_REQ, PEM_STRING_X509_REQ,bp,(char **)x,cb)); @@ -125,14 +125,14 @@ int PEM_write_bio_X509_REQ(BIO *bp, X509_REQ *x) #ifndef NO_FP_API /* The X509_CRL functions */ -X509_CRL *PEM_read_X509_CRL(FILE *fp, X509_CRL **x, int (*cb)()) +X509_CRL *PEM_read_X509_CRL(FILE *fp, X509_CRL **x, pem_password_cb *cb) { return((X509_CRL *)PEM_ASN1_read((char *(*)())d2i_X509_CRL, PEM_STRING_X509_CRL,fp,(char **)x,cb)); } #endif -X509_CRL *PEM_read_bio_X509_CRL(BIO *bp, X509_CRL **x, int (*cb)()) +X509_CRL *PEM_read_bio_X509_CRL(BIO *bp, X509_CRL **x, pem_password_cb *cb) { return((X509_CRL *)PEM_ASN1_read_bio((char *(*)())d2i_X509_CRL, PEM_STRING_X509_CRL,bp,(char **)x,cb)); @@ -155,26 +155,26 @@ int PEM_write_bio_X509_CRL(BIO *bp, X509_CRL *x) #ifndef NO_RSA #ifndef NO_FP_API /* The RSAPrivateKey functions */ -RSA *PEM_read_RSAPrivateKey(FILE *fp, RSA **x, int (*cb)()) +RSA *PEM_read_RSAPrivateKey(FILE *fp, RSA **x, pem_password_cb *cb) { return((RSA *)PEM_ASN1_read((char *(*)())d2i_RSAPrivateKey, PEM_STRING_RSA,fp,(char **)x,cb)); } -RSA *PEM_read_RSAPublicKey(FILE *fp, RSA **x, int (*cb)()) +RSA *PEM_read_RSAPublicKey(FILE *fp, RSA **x, pem_password_cb *cb) { return((RSA *)PEM_ASN1_read((char *(*)())d2i_RSAPublicKey, PEM_STRING_RSA_PUBLIC,fp,(char **)x,cb)); } #endif -RSA *PEM_read_bio_RSAPrivateKey(BIO *bp, RSA **x, int (*cb)()) +RSA *PEM_read_bio_RSAPrivateKey(BIO *bp, RSA **x, pem_password_cb *cb) { return((RSA *)PEM_ASN1_read_bio((char *(*)())d2i_RSAPrivateKey, PEM_STRING_RSA,bp,(char **)x,cb)); } -RSA *PEM_read_bio_RSAPublicKey(BIO *bp, RSA **x, int (*cb)()) +RSA *PEM_read_bio_RSAPublicKey(BIO *bp, RSA **x, pem_password_cb *cb) { return((RSA *)PEM_ASN1_read_bio((char *(*)())d2i_RSAPublicKey, PEM_STRING_RSA_PUBLIC,bp,(char **)x,cb)); @@ -182,7 +182,7 @@ RSA *PEM_read_bio_RSAPublicKey(BIO *bp, RSA **x, int (*cb)()) #ifndef NO_FP_API int PEM_write_RSAPrivateKey(FILE *fp, RSA *x, EVP_CIPHER *enc, - unsigned char *kstr, int klen, int (*cb)()) + unsigned char *kstr, int klen, pem_password_cb *cb) { return(PEM_ASN1_write((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,fp, (char *)x,enc,kstr,klen,cb)); @@ -197,7 +197,7 @@ int PEM_write_RSAPublicKey(FILE *fp, RSA *x) #endif int PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, const EVP_CIPHER *enc, - unsigned char *kstr, int klen, int (*cb)()) + unsigned char *kstr, int klen, pem_password_cb *cb) { return(PEM_ASN1_write_bio((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA, bp,(char *)x,enc,kstr,klen,cb)); @@ -214,14 +214,14 @@ int PEM_write_bio_RSAPublicKey(BIO *bp, RSA *x) #ifndef NO_DSA #ifndef NO_FP_API /* The DSAPrivateKey functions */ -DSA *PEM_read_DSAPrivateKey(FILE *fp, DSA **x, int (*cb)()) +DSA *PEM_read_DSAPrivateKey(FILE *fp, DSA **x, pem_password_cb *cb) { return((DSA *)PEM_ASN1_read((char *(*)())d2i_DSAPrivateKey, PEM_STRING_DSA,fp,(char **)x,cb)); } #endif -DSA *PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **x, int (*cb)()) +DSA *PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **x, pem_password_cb *cb) { return((DSA *)PEM_ASN1_read_bio((char *(*)())d2i_DSAPrivateKey, PEM_STRING_DSA,bp,(char **)x,cb)); @@ -229,7 +229,7 @@ DSA *PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **x, int (*cb)()) #ifndef NO_FP_API int PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc, - unsigned char *kstr, int klen, int (*cb)()) + unsigned char *kstr, int klen, pem_password_cb *cb) { return(PEM_ASN1_write((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,fp, (char *)x,enc,kstr,klen,cb)); @@ -237,7 +237,7 @@ int PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc, #endif int PEM_write_bio_DSAPrivateKey(BIO *bp, DSA *x, const EVP_CIPHER *enc, - unsigned char *kstr, int klen, int (*cb)()) + unsigned char *kstr, int klen, pem_password_cb *cb) { return(PEM_ASN1_write_bio((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA, bp,(char *)x,enc,kstr,klen,cb)); @@ -246,14 +246,14 @@ int PEM_write_bio_DSAPrivateKey(BIO *bp, DSA *x, const EVP_CIPHER *enc, #ifndef NO_FP_API /* The PrivateKey functions */ -EVP_PKEY *PEM_read_PrivateKey(FILE *fp, EVP_PKEY **x, int (*cb)()) +EVP_PKEY *PEM_read_PrivateKey(FILE *fp, EVP_PKEY **x, pem_password_cb *cb) { return((EVP_PKEY *)PEM_ASN1_read((char *(*)())d2i_PrivateKey, PEM_STRING_EVP_PKEY,fp,(char **)x,cb)); } #endif -EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, int (*cb)()) +EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb) { return((EVP_PKEY *)PEM_ASN1_read_bio((char *(*)())d2i_PrivateKey, PEM_STRING_EVP_PKEY,bp,(char **)x,cb)); @@ -261,7 +261,7 @@ EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, int (*cb)()) #ifndef NO_FP_API int PEM_write_PrivateKey(FILE *fp, EVP_PKEY *x, EVP_CIPHER *enc, - unsigned char *kstr, int klen, int (*cb)()) + unsigned char *kstr, int klen, pem_password_cb *cb) { return(PEM_ASN1_write((int (*)())i2d_PrivateKey, ((x->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA), @@ -270,7 +270,7 @@ int PEM_write_PrivateKey(FILE *fp, EVP_PKEY *x, EVP_CIPHER *enc, #endif int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, EVP_CIPHER *enc, - unsigned char *kstr, int klen, int (*cb)()) + unsigned char *kstr, int klen, pem_password_cb *cb) { return(PEM_ASN1_write_bio((int (*)())i2d_PrivateKey, ((x->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA), @@ -279,14 +279,14 @@ int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, EVP_CIPHER *enc, #ifndef NO_FP_API /* The PKCS7 functions */ -PKCS7 *PEM_read_PKCS7(FILE *fp, PKCS7 **x, int (*cb)()) +PKCS7 *PEM_read_PKCS7(FILE *fp, PKCS7 **x, pem_password_cb *cb) { return((PKCS7 *)PEM_ASN1_read((char *(*)())d2i_PKCS7, PEM_STRING_PKCS7,fp,(char **)x,cb)); } #endif -PKCS7 *PEM_read_bio_PKCS7(BIO *bp, PKCS7 **x, int (*cb)()) +PKCS7 *PEM_read_bio_PKCS7(BIO *bp, PKCS7 **x, pem_password_cb *cb) { return((PKCS7 *)PEM_ASN1_read_bio((char *(*)())d2i_PKCS7, PEM_STRING_PKCS7,bp,(char **)x,cb)); @@ -309,14 +309,14 @@ int PEM_write_bio_PKCS7(BIO *bp, PKCS7 *x) #ifndef NO_DH #ifndef NO_FP_API /* The DHparams functions */ -DH *PEM_read_DHparams(FILE *fp, DH **x, int (*cb)()) +DH *PEM_read_DHparams(FILE *fp, DH **x, pem_password_cb *cb) { return((DH *)PEM_ASN1_read((char *(*)())d2i_DHparams, PEM_STRING_DHPARAMS,fp,(char **)x,cb)); } #endif -DH *PEM_read_bio_DHparams(BIO *bp, DH **x, int (*cb)()) +DH *PEM_read_bio_DHparams(BIO *bp, DH **x, pem_password_cb *cb) { return((DH *)PEM_ASN1_read_bio((char *(*)())d2i_DHparams, PEM_STRING_DHPARAMS,bp,(char **)x,cb)); @@ -340,14 +340,14 @@ int PEM_write_bio_DHparams(BIO *bp, DH *x) #ifndef NO_DSA #ifndef NO_FP_API /* The DSAparams functions */ -DSA *PEM_read_DSAparams(FILE *fp, DSA **x, int (*cb)()) +DSA *PEM_read_DSAparams(FILE *fp, DSA **x, pem_password_cb *cb) { return((DSA *)PEM_ASN1_read((char *(*)())d2i_DSAparams, PEM_STRING_DSAPARAMS,fp,(char **)x,cb)); } #endif -DSA *PEM_read_bio_DSAparams(BIO *bp, DSA **x, int (*cb)()) +DSA *PEM_read_bio_DSAparams(BIO *bp, DSA **x, pem_password_cb *cb) { return((DSA *)PEM_ASN1_read_bio((char *(*)())d2i_DSAparams, PEM_STRING_DSAPARAMS,bp,(char **)x,cb)); @@ -372,7 +372,7 @@ int PEM_write_bio_DSAparams(BIO *bp, DSA *x) #ifndef NO_FP_API NETSCAPE_CERT_SEQUENCE *PEM_read_NETSCAPE_CERT_SEQUENCE(FILE *fp, - NETSCAPE_CERT_SEQUENCE **x, int (*cb)()) + NETSCAPE_CERT_SEQUENCE **x, pem_password_cb *cb) { return((NETSCAPE_CERT_SEQUENCE *) PEM_ASN1_read((char *(*)())d2i_NETSCAPE_CERT_SEQUENCE, @@ -381,7 +381,7 @@ NETSCAPE_CERT_SEQUENCE *PEM_read_NETSCAPE_CERT_SEQUENCE(FILE *fp, #endif NETSCAPE_CERT_SEQUENCE *PEM_read_bio_NETSCAPE_CERT_SEQUENCE(BIO *bp, - NETSCAPE_CERT_SEQUENCE **x, int (*cb)()) + NETSCAPE_CERT_SEQUENCE **x, pem_password_cb *cb) { return((NETSCAPE_CERT_SEQUENCE *) PEM_ASN1_read_bio((char *(*)())d2i_NETSCAPE_CERT_SEQUENCE, diff --git a/crypto/pem/pem_info.c b/crypto/pem/pem_info.c index 7f74bac351..0c2af93360 100644 --- a/crypto/pem/pem_info.c +++ b/crypto/pem/pem_info.c @@ -65,7 +65,7 @@ #include #ifndef NO_FP_API -STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, int (*cb)()) +STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb) { BIO *b; STACK_OF(X509_INFO) *ret; @@ -82,7 +82,7 @@ STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, int ( } #endif -STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, int (*cb)()) +STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb) { X509_INFO *xi=NULL; char *name=NULL,*header=NULL,**pp; @@ -266,7 +266,7 @@ err: /* A TJH addition */ int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, - unsigned char *kstr, int klen, int (*cb)()) + unsigned char *kstr, int klen, pem_password_cb *cb) { EVP_CIPHER_CTX ctx; int i,ret=0; diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c index 6d63ccd10e..916e9a8132 100644 --- a/crypto/pem/pem_lib.c +++ b/crypto/pem/pem_lib.c @@ -149,7 +149,7 @@ void PEM_dek_info(char *buf, const char *type, int len, char *str) #ifndef NO_FP_API char *PEM_ASN1_read(char *(*d2i)(), const char *name, FILE *fp, char **x, - int (*cb)()) + pem_password_cb *cb) { BIO *b; char *ret; @@ -167,7 +167,7 @@ char *PEM_ASN1_read(char *(*d2i)(), const char *name, FILE *fp, char **x, #endif char *PEM_ASN1_read_bio(char *(*d2i)(), const char *name, BIO *bp, char **x, - int (*cb)()) + pem_password_cb *cb) { EVP_CIPHER_INFO cipher; char *nm=NULL,*header=NULL; @@ -236,7 +236,7 @@ int PEM_ASN1_write(int (*i2d)(), const char *name, FILE *fp, char *x, int PEM_ASN1_write_bio(int (*i2d)(), const char *name, BIO *bp, char *x, const EVP_CIPHER *enc, unsigned char *kstr, int klen, - int (*callback)()) + pem_password_cb *callback) { EVP_CIPHER_CTX ctx; int dsize=0,i,j,ret=0; diff --git a/ssl/ssl.h b/ssl/ssl.h index 3d05809150..1df253cd28 100644 --- a/ssl/ssl.h +++ b/ssl/ssl.h @@ -148,6 +148,7 @@ extern "C" { #include #include #include +#include #include #define SSL_FILETYPE_ASN1 X509_FILETYPE_ASN1 @@ -402,7 +403,7 @@ struct ssl_ctx_st /**/ int (*default_verify_callback)(int ok,X509_STORE_CTX *ctx); /* Default password callback. */ -/**/ int (*default_passwd_callback)(); +/**/ pem_password_cb *default_passwd_callback; /* get client cert callback */ /**/ int (*client_cert_cb)(/* SSL *ssl, X509 **x509, EVP_PKEY **pkey */); @@ -954,7 +955,7 @@ int SSL_CTX_use_PrivateKey_ASN1(int pk,SSL_CTX *ctx, int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x); int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, unsigned char *d); -void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx,int (*cb)()); +void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *); int SSL_CTX_check_private_key(SSL_CTX *ctx); int SSL_check_private_key(SSL *ctx); diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 666dba54cf..09c837cc97 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -1115,7 +1115,7 @@ void SSL_CTX_free(SSL_CTX *a) Free((char *)a); } -void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx,int (*cb)()) +void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb) { ctx->default_passwd_callback=cb; } -- 2.25.1