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 ...)
This commit is contained in:
Bodo Möller 1999-05-14 11:52:49 +00:00
parent e6d0b6eca3
commit 3ae76679c7
6 changed files with 79 additions and 73 deletions

View File

@ -317,9 +317,13 @@ typedef struct pem_ctx_st
#endif #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_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher);
int PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len, int PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len,
int (*callback)()); pem_password_cb *);
#ifdef HEADER_BIO_H #ifdef HEADER_BIO_H
int PEM_read_bio(BIO *bp, char **name, char **header, 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, int PEM_write_bio(BIO *bp,const char *name,char *hdr,unsigned char *data,
long len); long len);
char * PEM_ASN1_read_bio(char *(*d2i)(),const char *name,BIO *bp,char **x, 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, int PEM_ASN1_write_bio(int (*i2d)(),const char *name,BIO *bp,char *x,
const EVP_CIPHER *enc,unsigned char *kstr,int klen, const EVP_CIPHER *enc,unsigned char *kstr,int klen,
int (*callback)()); pem_password_cb *);
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 *);
int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc, 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 #endif
#ifndef WIN16 #ifndef WIN16
@ -341,11 +345,12 @@ int PEM_read(FILE *fp, char **name, char **header,
unsigned char **data,long *len); unsigned char **data,long *len);
int PEM_write(FILE *fp,char *name,char *hdr,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, 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, int PEM_ASN1_write(int (*i2d)(),const char *name,FILE *fp,char *x,
const EVP_CIPHER *enc,unsigned char *kstr,int klen, const EVP_CIPHER *enc,unsigned char *kstr,int klen,
int (*callback)()); pem_password_cb *);
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 *);
#endif #endif
int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, 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 #endif
#ifndef WIN16 #ifndef WIN16
X509 *PEM_read_X509(FILE *fp,X509 **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,int (*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,int (*cb)()); X509_CRL *PEM_read_X509_CRL(FILE *fp,X509_CRL **x, pem_password_cb *);
#ifndef NO_RSA #ifndef NO_RSA
RSA *PEM_read_RSAPrivateKey(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,int (*cb)()); RSA *PEM_read_RSAPublicKey(FILE *fp,RSA **x, pem_password_cb *);
#endif #endif
#ifndef NO_DSA #ifndef NO_DSA
DSA *PEM_read_DSAPrivateKey(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,int (*cb)()); DSA *PEM_read_DSAparams(FILE *fp,DSA **x, pem_password_cb *);
#endif #endif
#ifndef NO_DH #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 #endif
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 *);
PKCS7 *PEM_read_PKCS7(FILE *fp,PKCS7 **x,int (*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,int (*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(FILE *fp,X509 *x);
int PEM_write_X509_REQ(FILE *fp,X509_REQ *x); int PEM_write_X509_REQ(FILE *fp,X509_REQ *x);
int PEM_write_X509_CRL(FILE *fp,X509_CRL *x); int PEM_write_X509_CRL(FILE *fp,X509_CRL *x);
#ifndef NO_RSA #ifndef NO_RSA
int PEM_write_RSAPrivateKey(FILE *fp,RSA *x,EVP_CIPHER *enc,unsigned char *kstr, 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); int PEM_write_RSAPublicKey(FILE *fp,RSA *x);
#endif #endif
#ifndef NO_DSA #ifndef NO_DSA
int PEM_write_DSAPrivateKey(FILE *fp,DSA *x,const EVP_CIPHER *enc, int PEM_write_DSAPrivateKey(FILE *fp,DSA *x,const EVP_CIPHER *enc,
unsigned char *kstr, unsigned char *kstr,
int klen,int (*cb)()); int klen, pem_password_cb *);
#endif #endif
int PEM_write_PrivateKey(FILE *fp,EVP_PKEY *x,EVP_CIPHER *enc, 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); int PEM_write_PKCS7(FILE *fp,PKCS7 *x);
#ifndef NO_DH #ifndef NO_DH
int PEM_write_DHparams(FILE *fp,DH *x); 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 #endif
#ifdef HEADER_BIO_H #ifdef HEADER_BIO_H
X509 *PEM_read_bio_X509(BIO *bp,X509 **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,int (*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,int (*cb)()); X509_CRL *PEM_read_bio_X509_CRL(BIO *bp,X509_CRL **x, pem_password_cb *);
#ifndef NO_RSA #ifndef NO_RSA
RSA *PEM_read_bio_RSAPrivateKey(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,int (*cb)()); RSA *PEM_read_bio_RSAPublicKey(BIO *bp,RSA **x, pem_password_cb *);
#endif #endif
#ifndef NO_DSA #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 #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 *);
PKCS7 *PEM_read_bio_PKCS7(BIO *bp,PKCS7 **x,int (*cb)()); PKCS7 *PEM_read_bio_PKCS7(BIO *bp,PKCS7 **x, pem_password_cb *);
#ifndef NO_DH #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 #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 #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 #endif
int PEM_write_bio_X509(BIO *bp,X509 *x); 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_REQ(BIO *bp,X509_REQ *x);
int PEM_write_bio_X509_CRL(BIO *bp,X509_CRL *x); int PEM_write_bio_X509_CRL(BIO *bp,X509_CRL *x);
#ifndef NO_RSA #ifndef NO_RSA
int PEM_write_bio_RSAPrivateKey(BIO *fp,RSA *x,const EVP_CIPHER *enc, 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); int PEM_write_bio_RSAPublicKey(BIO *fp,RSA *x);
#endif #endif
#ifndef NO_DSA #ifndef NO_DSA
int PEM_write_bio_DSAPrivateKey(BIO *fp,DSA *x,const EVP_CIPHER *enc, 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 #endif
int PEM_write_bio_PrivateKey(BIO *fp,EVP_PKEY *x,EVP_CIPHER *enc, 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); int PEM_write_bio_PKCS7(BIO *bp,PKCS7 *x);
#ifndef NO_DH #ifndef NO_DH
int PEM_write_bio_DHparams(BIO *bp,DH *x); int PEM_write_bio_DHparams(BIO *bp,DH *x);

View File

@ -67,14 +67,14 @@
#ifndef NO_FP_API #ifndef NO_FP_API
/* The X509 functions */ /* 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, return((X509 *)PEM_ASN1_read((char *(*)())d2i_X509,
PEM_STRING_X509,fp,(char **)x,cb)); PEM_STRING_X509,fp,(char **)x,cb));
} }
#endif #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, return((X509 *)PEM_ASN1_read_bio((char *(*)())d2i_X509,
PEM_STRING_X509,bp,(char **)x,cb)); PEM_STRING_X509,bp,(char **)x,cb));
@ -96,14 +96,14 @@ int PEM_write_bio_X509(BIO *bp, X509 *x)
#ifndef NO_FP_API #ifndef NO_FP_API
/* The X509_REQ functions */ /* 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, return((X509_REQ *)PEM_ASN1_read((char *(*)())d2i_X509_REQ,
PEM_STRING_X509_REQ,fp,(char **)x,cb)); PEM_STRING_X509_REQ,fp,(char **)x,cb));
} }
#endif #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, return((X509_REQ *)PEM_ASN1_read_bio((char *(*)())d2i_X509_REQ,
PEM_STRING_X509_REQ,bp,(char **)x,cb)); 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 #ifndef NO_FP_API
/* The X509_CRL functions */ /* 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, return((X509_CRL *)PEM_ASN1_read((char *(*)())d2i_X509_CRL,
PEM_STRING_X509_CRL,fp,(char **)x,cb)); PEM_STRING_X509_CRL,fp,(char **)x,cb));
} }
#endif #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, return((X509_CRL *)PEM_ASN1_read_bio((char *(*)())d2i_X509_CRL,
PEM_STRING_X509_CRL,bp,(char **)x,cb)); 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_RSA
#ifndef NO_FP_API #ifndef NO_FP_API
/* The RSAPrivateKey functions */ /* 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, return((RSA *)PEM_ASN1_read((char *(*)())d2i_RSAPrivateKey,
PEM_STRING_RSA,fp,(char **)x,cb)); 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, return((RSA *)PEM_ASN1_read((char *(*)())d2i_RSAPublicKey,
PEM_STRING_RSA_PUBLIC,fp,(char **)x,cb)); PEM_STRING_RSA_PUBLIC,fp,(char **)x,cb));
} }
#endif #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, return((RSA *)PEM_ASN1_read_bio((char *(*)())d2i_RSAPrivateKey,
PEM_STRING_RSA,bp,(char **)x,cb)); 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, return((RSA *)PEM_ASN1_read_bio((char *(*)())d2i_RSAPublicKey,
PEM_STRING_RSA_PUBLIC,bp,(char **)x,cb)); 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 #ifndef NO_FP_API
int PEM_write_RSAPrivateKey(FILE *fp, RSA *x, EVP_CIPHER *enc, 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, return(PEM_ASN1_write((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,fp,
(char *)x,enc,kstr,klen,cb)); (char *)x,enc,kstr,klen,cb));
@ -197,7 +197,7 @@ int PEM_write_RSAPublicKey(FILE *fp, RSA *x)
#endif #endif
int PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, const EVP_CIPHER *enc, 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, return(PEM_ASN1_write_bio((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,
bp,(char *)x,enc,kstr,klen,cb)); 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_DSA
#ifndef NO_FP_API #ifndef NO_FP_API
/* The DSAPrivateKey functions */ /* 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, return((DSA *)PEM_ASN1_read((char *(*)())d2i_DSAPrivateKey,
PEM_STRING_DSA,fp,(char **)x,cb)); PEM_STRING_DSA,fp,(char **)x,cb));
} }
#endif #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, return((DSA *)PEM_ASN1_read_bio((char *(*)())d2i_DSAPrivateKey,
PEM_STRING_DSA,bp,(char **)x,cb)); 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 #ifndef NO_FP_API
int PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc, 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, return(PEM_ASN1_write((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,fp,
(char *)x,enc,kstr,klen,cb)); (char *)x,enc,kstr,klen,cb));
@ -237,7 +237,7 @@ int PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc,
#endif #endif
int PEM_write_bio_DSAPrivateKey(BIO *bp, DSA *x, const EVP_CIPHER *enc, 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, return(PEM_ASN1_write_bio((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,
bp,(char *)x,enc,kstr,klen,cb)); 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 #ifndef NO_FP_API
/* The PrivateKey functions */ /* 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, return((EVP_PKEY *)PEM_ASN1_read((char *(*)())d2i_PrivateKey,
PEM_STRING_EVP_PKEY,fp,(char **)x,cb)); PEM_STRING_EVP_PKEY,fp,(char **)x,cb));
} }
#endif #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, return((EVP_PKEY *)PEM_ASN1_read_bio((char *(*)())d2i_PrivateKey,
PEM_STRING_EVP_PKEY,bp,(char **)x,cb)); 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 #ifndef NO_FP_API
int PEM_write_PrivateKey(FILE *fp, EVP_PKEY *x, EVP_CIPHER *enc, 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, return(PEM_ASN1_write((int (*)())i2d_PrivateKey,
((x->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA), ((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 #endif
int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, EVP_CIPHER *enc, 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, return(PEM_ASN1_write_bio((int (*)())i2d_PrivateKey,
((x->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA), ((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 #ifndef NO_FP_API
/* The PKCS7 functions */ /* 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, return((PKCS7 *)PEM_ASN1_read((char *(*)())d2i_PKCS7,
PEM_STRING_PKCS7,fp,(char **)x,cb)); PEM_STRING_PKCS7,fp,(char **)x,cb));
} }
#endif #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, return((PKCS7 *)PEM_ASN1_read_bio((char *(*)())d2i_PKCS7,
PEM_STRING_PKCS7,bp,(char **)x,cb)); 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_DH
#ifndef NO_FP_API #ifndef NO_FP_API
/* The DHparams functions */ /* 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, return((DH *)PEM_ASN1_read((char *(*)())d2i_DHparams,
PEM_STRING_DHPARAMS,fp,(char **)x,cb)); PEM_STRING_DHPARAMS,fp,(char **)x,cb));
} }
#endif #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, return((DH *)PEM_ASN1_read_bio((char *(*)())d2i_DHparams,
PEM_STRING_DHPARAMS,bp,(char **)x,cb)); 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_DSA
#ifndef NO_FP_API #ifndef NO_FP_API
/* The DSAparams functions */ /* 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, return((DSA *)PEM_ASN1_read((char *(*)())d2i_DSAparams,
PEM_STRING_DSAPARAMS,fp,(char **)x,cb)); PEM_STRING_DSAPARAMS,fp,(char **)x,cb));
} }
#endif #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, return((DSA *)PEM_ASN1_read_bio((char *(*)())d2i_DSAparams,
PEM_STRING_DSAPARAMS,bp,(char **)x,cb)); PEM_STRING_DSAPARAMS,bp,(char **)x,cb));
@ -372,7 +372,7 @@ int PEM_write_bio_DSAparams(BIO *bp, DSA *x)
#ifndef NO_FP_API #ifndef NO_FP_API
NETSCAPE_CERT_SEQUENCE *PEM_read_NETSCAPE_CERT_SEQUENCE(FILE *fp, 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 *) return((NETSCAPE_CERT_SEQUENCE *)
PEM_ASN1_read((char *(*)())d2i_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 #endif
NETSCAPE_CERT_SEQUENCE *PEM_read_bio_NETSCAPE_CERT_SEQUENCE(BIO *bp, 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 *) return((NETSCAPE_CERT_SEQUENCE *)
PEM_ASN1_read_bio((char *(*)())d2i_NETSCAPE_CERT_SEQUENCE, PEM_ASN1_read_bio((char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,

View File

@ -65,7 +65,7 @@
#include <openssl/pem.h> #include <openssl/pem.h>
#ifndef NO_FP_API #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; BIO *b;
STACK_OF(X509_INFO) *ret; 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 #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; X509_INFO *xi=NULL;
char *name=NULL,*header=NULL,**pp; char *name=NULL,*header=NULL,**pp;
@ -266,7 +266,7 @@ err:
/* A TJH addition */ /* A TJH addition */
int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, 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; EVP_CIPHER_CTX ctx;
int i,ret=0; int i,ret=0;

View File

@ -149,7 +149,7 @@ void PEM_dek_info(char *buf, const char *type, int len, char *str)
#ifndef NO_FP_API #ifndef NO_FP_API
char *PEM_ASN1_read(char *(*d2i)(), const char *name, FILE *fp, char **x, char *PEM_ASN1_read(char *(*d2i)(), const char *name, FILE *fp, char **x,
int (*cb)()) pem_password_cb *cb)
{ {
BIO *b; BIO *b;
char *ret; char *ret;
@ -167,7 +167,7 @@ char *PEM_ASN1_read(char *(*d2i)(), const char *name, FILE *fp, char **x,
#endif #endif
char *PEM_ASN1_read_bio(char *(*d2i)(), const char *name, BIO *bp, char **x, char *PEM_ASN1_read_bio(char *(*d2i)(), const char *name, BIO *bp, char **x,
int (*cb)()) pem_password_cb *cb)
{ {
EVP_CIPHER_INFO cipher; EVP_CIPHER_INFO cipher;
char *nm=NULL,*header=NULL; 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, int PEM_ASN1_write_bio(int (*i2d)(), const char *name, BIO *bp, char *x,
const EVP_CIPHER *enc, unsigned char *kstr, int klen, const EVP_CIPHER *enc, unsigned char *kstr, int klen,
int (*callback)()) pem_password_cb *callback)
{ {
EVP_CIPHER_CTX ctx; EVP_CIPHER_CTX ctx;
int dsize=0,i,j,ret=0; int dsize=0,i,j,ret=0;

View File

@ -148,6 +148,7 @@ extern "C" {
#include <openssl/lhash.h> #include <openssl/lhash.h>
#include <openssl/buffer.h> #include <openssl/buffer.h>
#include <openssl/bio.h> #include <openssl/bio.h>
#include <openssl/pem.h>
#include <openssl/x509.h> #include <openssl/x509.h>
#define SSL_FILETYPE_ASN1 X509_FILETYPE_ASN1 #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); /**/ int (*default_verify_callback)(int ok,X509_STORE_CTX *ctx);
/* Default password callback. */ /* Default password callback. */
/**/ int (*default_passwd_callback)(); /**/ pem_password_cb *default_passwd_callback;
/* get client cert callback */ /* get client cert callback */
/**/ int (*client_cert_cb)(/* SSL *ssl, X509 **x509, EVP_PKEY **pkey */); /**/ 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(SSL_CTX *ctx, X509 *x);
int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, unsigned char *d); 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_CTX_check_private_key(SSL_CTX *ctx);
int SSL_check_private_key(SSL *ctx); int SSL_check_private_key(SSL *ctx);

View File

@ -1115,7 +1115,7 @@ void SSL_CTX_free(SSL_CTX *a)
Free((char *)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; ctx->default_passwd_callback=cb;
} }