Browse Source

Change functions to ANSI C.

master
Ulf Möller 24 years ago
parent
commit
6b691a5c85
491 changed files with 2835 additions and 7416 deletions
  1. +3
    -0
      CHANGES
  2. +7
    -24
      apps/apps.c
  3. +1
    -3
      apps/asn1pars.c
  4. +32
    -104
      apps/ca.c
  5. +1
    -3
      apps/ciphers.c
  6. +2
    -6
      apps/crl.c
  7. +2
    -6
      apps/crl2p7.c
  8. +2
    -7
      apps/dgst.c
  9. +1
    -3
      apps/dh.c
  10. +1
    -3
      apps/dsa.c
  11. +2
    -7
      apps/dsaparam.c
  12. +2
    -7
      apps/enc.c
  13. +1
    -3
      apps/errstr.c
  14. +3
    -9
      apps/gendh.c
  15. +2
    -5
      apps/gendsa.c
  16. +3
    -9
      apps/genrsa.c
  17. +2
    -6
      apps/nseq.c
  18. +6
    -14
      apps/openssl.c
  19. +1
    -3
      apps/pem_mail.c
  20. +13
    -41
      apps/pkcs12.c
  21. +1
    -3
      apps/pkcs7.c
  22. +10
    -36
      apps/req.c
  23. +1
    -3
      apps/rsa.c
  24. +5
    -18
      apps/s_cb.c
  25. +3
    -8
      apps/s_client.c
  26. +12
    -28
      apps/s_server.c
  27. +18
    -55
      apps/s_socket.c
  28. +6
    -14
      apps/s_time.c
  29. +2
    -4
      apps/sc.c
  30. +2
    -6
      apps/sess_id.c
  31. +6
    -17
      apps/speed.c
  32. +3
    -9
      apps/verify.c
  33. +1
    -3
      apps/version.c
  34. +8
    -27
      apps/x509.c
  35. +5
    -14
      crypto/asn1/a_bitstr.c
  36. +3
    -7
      crypto/asn1/a_bmp.c
  37. +2
    -7
      crypto/asn1/a_bool.c
  38. +6
    -19
      crypto/asn1/a_bytes.c
  39. +4
    -10
      crypto/asn1/a_d2i_fp.c
  40. +2
    -6
      crypto/asn1/a_digest.c
  41. +1
    -4
      crypto/asn1/a_dup.c
  42. +7
    -18
      crypto/asn1/a_enum.c
  43. +7
    -15
      crypto/asn1/a_gentm.c
  44. +5
    -10
      crypto/asn1/a_hdr.c
  45. +2
    -8
      crypto/asn1/a_i2d_fp.c
  46. +7
    -18
      crypto/asn1/a_int.c
  47. +2
    -2
      crypto/asn1/a_meth.c
  48. +10
    -27
      crypto/asn1/a_object.c
  49. +3
    -7
      crypto/asn1/a_octet.c
  50. +20
    -42
      crypto/asn1/a_print.c
  51. +5
    -16
      crypto/asn1/a_set.c
  52. +3
    -8
      crypto/asn1/a_sign.c
  53. +3
    -10
      crypto/asn1/a_time.c
  54. +7
    -18
      crypto/asn1/a_type.c
  55. +6
    -15
      crypto/asn1/a_utctm.c
  56. +3
    -7
      crypto/asn1/a_utf8.c
  57. +2
    -6
      crypto/asn1/a_verify.c
  58. +3
    -7
      crypto/asn1/a_vis.c
  59. +1
    -1
      crypto/asn1/asn1_err.c
  60. +17
    -48
      crypto/asn1/asn1_lib.c
  61. +5
    -18
      crypto/asn1/asn1_par.c
  62. +6
    -17
      crypto/asn1/asn_pack.c
  63. +1
    -4
      crypto/asn1/d2i_dhp.c
  64. +1
    -4
      crypto/asn1/d2i_dsap.c
  65. +2
    -5
      crypto/asn1/d2i_pr.c
  66. +2
    -5
      crypto/asn1/d2i_pu.c
  67. +2
    -5
      crypto/asn1/d2i_r_pr.c
  68. +1
    -4
      crypto/asn1/d2i_r_pu.c
  69. +1
    -4
      crypto/asn1/d2i_s_pr.c
  70. +1
    -4
      crypto/asn1/d2i_s_pu.c
  71. +9
    -18
      crypto/asn1/evp_asn1.c
  72. +2
    -8
      crypto/asn1/f_enum.c
  73. +2
    -8
      crypto/asn1/f_int.c
  74. +2
    -9
      crypto/asn1/f_string.c
  75. +1
    -3
      crypto/asn1/i2d_dhp.c
  76. +1
    -3
      crypto/asn1/i2d_dsap.c
  77. +1
    -3
      crypto/asn1/i2d_pr.c
  78. +1
    -3
      crypto/asn1/i2d_pu.c
  79. +1
    -3
      crypto/asn1/i2d_r_pr.c
  80. +1
    -3
      crypto/asn1/i2d_r_pu.c
  81. +1
    -3
      crypto/asn1/i2d_s_pr.c
  82. +1
    -3
      crypto/asn1/i2d_s_pu.c
  83. +9
    -24
      crypto/asn1/n_pkey.c
  84. +5
    -10
      crypto/asn1/nsseq.c
  85. +6
    -15
      crypto/asn1/p5_pbe.c
  86. +9
    -20
      crypto/asn1/p5_pbev2.c
  87. +5
    -10
      crypto/asn1/p7_dgst.c
  88. +5
    -10
      crypto/asn1/p7_enc.c
  89. +5
    -10
      crypto/asn1/p7_enc_c.c
  90. +5
    -10
      crypto/asn1/p7_evp.c
  91. +5
    -10
      crypto/asn1/p7_i_s.c
  92. +5
    -12
      crypto/asn1/p7_lib.c
  93. +5
    -10
      crypto/asn1/p7_recip.c
  94. +5
    -10
      crypto/asn1/p7_s_e.c
  95. +5
    -10
      crypto/asn1/p7_signd.c
  96. +5
    -10
      crypto/asn1/p7_signi.c
  97. +5
    -10
      crypto/asn1/p8_pkey.c
  98. +4
    -10
      crypto/asn1/pkcs8.c
  99. +3
    -9
      crypto/asn1/t_crl.c
  100. +10
    -34
      crypto/asn1/t_pkey.c

+ 3
- 0
CHANGES View File

@ -5,6 +5,9 @@
Changes between 0.9.2b and 0.9.3
*) Change functions to ANSI C.
[Ulf Möller]
*) Fix typos in error codes.
[Martin Kraemer <Martin.Kraemer@MchP.Siemens.De>, Ulf Möller]


+ 7
- 24
apps/apps.c View File

@ -76,10 +76,7 @@ int app_init();
#endif
#ifdef undef /* never finished - probably never will be :-) */
int args_from_file(file,argc,argv)
char *file;
int *argc;
char **argv[];
int args_from_file(char *file, int *argc, char **argv[])
{
FILE *fp;
int num,i;
@ -157,8 +154,7 @@ char **argv[];
}
#endif
int str2fmt(s)
char *s;
int str2fmt(char *s)
{
if ((*s == 'D') || (*s == 'd'))
return(FORMAT_ASN1);
@ -173,10 +169,7 @@ char *s;
}
#if defined(MSDOS) || defined(WIN32) || defined(WIN16)
void program_name(in,out,size)
char *in;
char *out;
int size;
void program_name(char *in, char *out, int size)
{
int i,n;
char *p=NULL;
@ -213,10 +206,7 @@ int size;
out[n]='\0';
}
#else
void program_name(in,out,size)
char *in;
char *out;
int size;
void program_name(char *in, char *out, int size)
{
char *p;
@ -231,9 +221,7 @@ int size;
#endif
#ifdef WIN32
int WIN32_rename(from,to)
char *from;
char *to;
int WIN32_rename(char *from, char *to)
{
int ret;
@ -242,11 +230,7 @@ char *to;
}
#endif
int chopup_args(arg,buf,argc,argv)
ARGS *arg;
char *buf;
int *argc;
char **argv[];
int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[])
{
int num,len,i;
char *p;
@ -312,8 +296,7 @@ char **argv[];
}
#ifndef APP_INIT
int app_init(mesgwin)
long mesgwin;
int app_init(long mesgwin)
{
return(1);
}


+ 1
- 3
apps/asn1pars.c View File

@ -80,9 +80,7 @@
#undef PROG
#define PROG asn1parse_main
int MAIN(argc, argv)
int argc;
char **argv;
int MAIN(int argc, char **argv)
{
int i,badops=0,offset=0,ret=1,j;
unsigned int length=0;


+ 32
- 104
apps/ca.c View File

@ -215,9 +215,7 @@ static char *section=NULL;
static int preserve=0;
static int msie_hack=0;
int MAIN(argc, argv)
int argc;
char **argv;
int MAIN(int argc, char **argv)
{
int total=0;
int total_done=0;
@ -1179,16 +1177,12 @@ err:
EXIT(ret);
}
static void lookup_fail(name,tag)
char *name;
char *tag;
static void lookup_fail(char *name, char *tag)
{
BIO_printf(bio_err,"variable lookup failed for %s::%s\n",name,tag);
}
static int MS_CALLBACK key_callback(buf,len,verify)
char *buf;
int len,verify;
static int MS_CALLBACK key_callback(char *buf, int len, int verify)
{
int i;
@ -1199,8 +1193,7 @@ int len,verify;
return(i);
}
static unsigned long index_serial_hash(a)
char **a;
static unsigned long index_serial_hash(char **a)
{
char *n;
@ -1209,9 +1202,7 @@ char **a;
return(lh_strhash(n));
}
static int index_serial_cmp(a,b)
char **a;
char **b;
static int index_serial_cmp(char **a, char **b)
{
char *aa,*bb;
@ -1220,21 +1211,17 @@ char **b;
return(strcmp(aa,bb));
}
static unsigned long index_name_hash(a)
char **a;
static unsigned long index_name_hash(char **a)
{ return(lh_strhash(a[DB_name])); }
static int index_name_qual(a)
char **a;
static int index_name_qual(char **a)
{ return(a[0][0] == 'V'); }
static int index_name_cmp(a,b)
char **a;
char **b;
{ return(strcmp(a[DB_name],b[DB_name])); }
static int index_name_cmp(char **a, char **b)
{ return(strcmp(a[DB_name],
b[DB_name])); }
static BIGNUM *load_serial(serialfile)
char *serialfile;
static BIGNUM *load_serial(char *serialfile)
{
BIO *in=NULL;
BIGNUM *ret=NULL;
@ -1272,9 +1259,7 @@ err:
return(ret);
}
static int save_serial(serialfile,serial)
char *serialfile;
BIGNUM *serial;
static int save_serial(char *serialfile, BIGNUM *serial)
{
BIO *out;
int ret=0;
@ -1306,22 +1291,10 @@ err:
return(ret);
}
static int certify(xret,infile,pkey,x509,dgst,policy,db,serial,startdate,days,
batch,ext_sect,lconf,verbose)
X509 **xret;
char *infile;
EVP_PKEY *pkey;
X509 *x509;
const EVP_MD *dgst;
STACK *policy;
TXT_DB *db;
BIGNUM *serial;
char *startdate;
int days;
int batch;
char *ext_sect;
LHASH *lconf;
int verbose;
static int certify(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
const EVP_MD *dgst, STACK *policy, TXT_DB *db, BIGNUM *serial,
char *startdate, int days, int batch, char *ext_sect, LHASH *lconf,
int verbose)
{
X509_REQ *req=NULL;
BIO *in=NULL;
@ -1377,22 +1350,11 @@ err:
return(ok);
}
static int certify_cert(xret,infile,pkey,x509,dgst,policy,db,serial,startdate,
days,batch,ext_sect,lconf,verbose)
X509 **xret;
char *infile;
EVP_PKEY *pkey;
X509 *x509;
const EVP_MD *dgst;
STACK *policy;
TXT_DB *db;
BIGNUM *serial;
char *startdate;
int days;
int batch;
char *ext_sect;
LHASH *lconf;
int verbose;
static int certify_cert(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
const EVP_MD *dgst, STACK *policy, TXT_DB *db, BIGNUM *serial,
char *startdate, int days, int batch, char *ext_sect, LHASH *lconf,
int verbose)
{
X509 *req=NULL;
X509_REQ *rreq=NULL;
@ -1452,22 +1414,9 @@ err:
return(ok);
}
static int do_body(xret,pkey,x509,dgst,policy,db,serial,startdate,days,
batch,verbose,req,ext_sect,lconf)
X509 **xret;
EVP_PKEY *pkey;
X509 *x509;
const EVP_MD *dgst;
STACK *policy;
TXT_DB *db;
BIGNUM *serial;
char *startdate;
int days;
int batch;
int verbose;
X509_REQ *req;
char *ext_sect;
LHASH *lconf;
static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
STACK *policy, TXT_DB *db, BIGNUM *serial, char *startdate, int days,
int batch, int verbose, X509_REQ *req, char *ext_sect, LHASH *lconf)
{
X509_NAME *name=NULL,*CAname=NULL,*subject=NULL;
ASN1_UTCTIME *tm,*tmptm;
@ -1895,10 +1844,7 @@ err:
return(ok);
}
static void write_new_certificate(bp,x, output_der)
BIO *bp;
X509 *x;
int output_der;
static void write_new_certificate(BIO *bp, X509 *x, int output_der)
{
char *f;
char buf[256];
@ -1924,21 +1870,9 @@ int output_der;
BIO_puts(bp,"\n");
}
static int certify_spkac(xret,infile,pkey,x509,dgst,policy,db,serial,
startdate,days,ext_sect,lconf,verbose)
X509 **xret;
char *infile;
EVP_PKEY *pkey;
X509 *x509;
const EVP_MD *dgst;
STACK *policy;
TXT_DB *db;
BIGNUM *serial;
char *startdate;
int days;
char *ext_sect;
LHASH *lconf;
int verbose;
static int certify_spkac(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
const EVP_MD *dgst, STACK *policy, TXT_DB *db, BIGNUM *serial,
char *startdate, int days, char *ext_sect, LHASH *lconf, int verbose)
{
STACK *sk=NULL;
LHASH *parms=NULL;
@ -2094,9 +2028,7 @@ err:
return(ok);
}
static int fix_data(nid,type)
int nid;
int *type;
static int fix_data(int nid, int *type)
{
if (nid == NID_pkcs9_emailAddress)
*type=V_ASN1_IA5STRING;
@ -2111,8 +2043,7 @@ int *type;
return(1);
}
static int check_time_format(str)
char *str;
static int check_time_format(char *str)
{
ASN1_UTCTIME tm;
@ -2122,8 +2053,7 @@ char *str;
return(ASN1_UTCTIME_check(&tm));
}
static int add_oid_section(hconf)
LHASH *hconf;
static int add_oid_section(LHASH *hconf)
{
char *p;
STACK *sktmp;
@ -2145,9 +2075,7 @@ LHASH *hconf;
return 1;
}
static int do_revoke(x509,db)
X509 *x509;
TXT_DB *db;
static int do_revoke(X509 *x509, TXT_DB *db)
{
ASN1_UTCTIME *tm=NULL;
char *row[DB_NUMBER],**rrow,**irow;


+ 1
- 3
apps/ciphers.c View File

@ -77,9 +77,7 @@ static char *ciphers_usage[]={
NULL
};
int MAIN(argc, argv)
int argc;
char **argv;
int MAIN(int argc, char **argv)
{
int ret=1,i;
int verbose=0;


+ 2
- 6
apps/crl.c View File

@ -96,9 +96,7 @@ static X509_CRL *load_crl();
static BIO *bio_out=NULL;
int MAIN(argc, argv)
int argc;
char **argv;
int MAIN(int argc, char **argv)
{
X509_CRL *x=NULL;
int ret=1,i,num,badops=0;
@ -262,9 +260,7 @@ end:
EXIT(ret);
}
static X509_CRL *load_crl(infile, format)
char *infile;
int format;
static X509_CRL *load_crl(char *infile, int format)
{
X509_CRL *x=NULL;
BIO *in=NULL;


+ 2
- 6
apps/crl2p7.c View File

@ -87,9 +87,7 @@ static int add_certs_from_file();
* -out arg - output file - default stdout
*/
int MAIN(argc, argv)
int argc;
char **argv;
int MAIN(int argc, char **argv)
{
int i,badops=0;
BIO *in=NULL,*out=NULL;
@ -288,9 +286,7 @@ end:
* number of certs added if successful, -1 if not.
*----------------------------------------------------------------------
*/
static int add_certs_from_file(stack,certfile)
STACK_OF(X509) *stack;
char *certfile;
static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile)
{
struct stat st;
BIO *in=NULL;


+ 2
- 7
apps/dgst.c View File

@ -79,9 +79,7 @@ void do_fp(unsigned char *buf,BIO *f,int sep);
void do_fp();
#endif
int MAIN(argc,argv)
int argc;
char **argv;
int MAIN(int argc, char **argv)
{
unsigned char *buf=NULL;
int i,err=0;
@ -203,10 +201,7 @@ end:
EXIT(err);
}
void do_fp(buf,bp,sep)
unsigned char *buf;
BIO *bp;
int sep;
void do_fp(unsigned char *buf, BIO *bp, int sep)
{
int len;
int i;


+ 1
- 3
apps/dh.c View File

@ -81,9 +81,7 @@
* -C
*/
int MAIN(argc, argv)
int argc;
char **argv;
int MAIN(int argc, char **argv)
{
DH *dh=NULL;
int i,badops=0,text=0;


+ 1
- 3
apps/dsa.c View File

@ -82,9 +82,7 @@
* -modulus - print the DSA public key
*/
int MAIN(argc, argv)
int argc;
char **argv;
int MAIN(int argc, char **argv)
{
int ret=1;
DSA *dsa=NULL;


+ 2
- 7
apps/dsaparam.c View File

@ -89,9 +89,7 @@ static void MS_CALLBACK dsa_cb(int p, int n, char *arg);
static void MS_CALLBACK dsa_cb();
#endif
int MAIN(argc, argv)
int argc;
char **argv;
int MAIN(int argc, char **argv)
{
DSA *dsa=NULL;
int i,badops=0,text=0;
@ -342,10 +340,7 @@ end:
EXIT(ret);
}
static void MS_CALLBACK dsa_cb(p, n, arg)
int p;
int n;
char *arg;
static void MS_CALLBACK dsa_cb(int p, int n, char *arg)
{
char c='*';


+ 2
- 7
apps/enc.c View File

@ -84,9 +84,7 @@ int set_hex();
#define BSIZE (8*1024)
#define PROG enc_main
int MAIN(argc,argv)
int argc;
char **argv;
int MAIN(int argc, char **argv)
{
char *strbuf=NULL;
unsigned char *buff=NULL,*bufsize=NULL;
@ -521,10 +519,7 @@ end:
EXIT(ret);
}
int set_hex(in,out,size)
char *in;
unsigned char *out;
int size;
int set_hex(char *in, unsigned char *out, int size)
{
int i,n;
unsigned char j;


+ 1
- 3
apps/errstr.c View File

@ -68,9 +68,7 @@
#undef PROG
#define PROG errstr_main
int MAIN(argc, argv)
int argc;
char **argv;
int MAIN(int argc, char **argv)
{
int i,ret=0;
char buf[256];


+ 3
- 9
apps/gendh.c View File

@ -81,9 +81,7 @@ static void MS_CALLBACK dh_cb();
static long dh_load_rand();
#endif
int MAIN(argc, argv)
int argc;
char **argv;
int MAIN(int argc, char **argv)
{
char buffer[200];
DH *dh=NULL;
@ -191,10 +189,7 @@ end:
EXIT(ret);
}
static void MS_CALLBACK dh_cb(p,n,arg)
int p;
int n;
char *arg;
static void MS_CALLBACK dh_cb(int p, int n, char *arg)
{
char c='*';
@ -209,8 +204,7 @@ char *arg;
#endif
}
static long dh_load_rand(name)
char *name;
static long dh_load_rand(char *name)
{
char *p,*n;
int last;


+ 2
- 5
apps/gendsa.c View File

@ -79,9 +79,7 @@ static long dsa_load_rand(char *names);
static long dsa_load_rand();
#endif
int MAIN(argc, argv)
int argc;
char **argv;
int MAIN(int argc, char **argv)
{
char buffer[200];
DSA *dsa=NULL;
@ -214,8 +212,7 @@ end:
EXIT(ret);
}
static long dsa_load_rand(name)
char *name;
static long dsa_load_rand(char *name)
{
char *p,*n;
int last;


+ 3
- 9
apps/genrsa.c View File

@ -82,9 +82,7 @@ static void MS_CALLBACK genrsa_cb();
static long gr_load_rand();
#endif
int MAIN(argc, argv)
int argc;
char **argv;
int MAIN(int argc, char **argv)
{
int ret=1;
char buffer[200];
@ -234,10 +232,7 @@ err:
EXIT(ret);
}
static void MS_CALLBACK genrsa_cb(p, n, arg)
int p;
int n;
char *arg;
static void MS_CALLBACK genrsa_cb(int p, int n, char *arg)
{
char c='*';
@ -252,8 +247,7 @@ char *arg;
#endif
}
static long gr_load_rand(name)
char *name;
static long gr_load_rand(char *name)
{
char *p,*n;
int last;


+ 2
- 6
apps/nseq.c View File

@ -70,9 +70,7 @@ static int dump_cert_text(BIO *out, X509 *x);
static int dump_cert_text();
#endif
int MAIN(argc, argv)
int argc;
char **argv;
int MAIN(int argc, char **argv)
{
char **args, *infile = NULL, *outfile = NULL;
BIO *in = NULL, *out = NULL;
@ -163,9 +161,7 @@ end:
EXIT(ret);
}
static int dump_cert_text(out, x)
BIO *out;
X509 *x;
static int dump_cert_text(BIO *out, X509 *x)
{
char buf[256];
X509_NAME_oneline(X509_get_subject_name(x),buf,256);


+ 6
- 14
apps/openssl.c View File

@ -99,8 +99,7 @@ LHASH *config=NULL;
char *default_config_file=NULL;
#ifdef DEBUG
static void sig_stop(i)
int i;
static void sig_stop(int i)
{
char *a=NULL;
@ -113,9 +112,7 @@ int i;
BIO *bio_err=NULL;
#endif
int main(Argc,Argv)
int Argc;
char *Argv[];
int main(int Argc, char *Argv[])
{
ARGS arg;
#define PROG_NAME_SIZE 16
@ -258,10 +255,7 @@ end:
#define LIST_MESSAGE_DIGEST_COMMANDS "list-message-digest-commands"
#define LIST_CIPHER_COMMANDS "list-cipher-commands"
static int do_cmd(prog,argc,argv)
LHASH *prog;
int argc;
char *argv[];
static int do_cmd(LHASH *prog, int argc, char *argv[])
{
FUNCTION f,*fp;
int i,ret=1,tp,nl;
@ -354,7 +348,7 @@ static int SortFnByName(const void *_f1,const void *_f2)
return strcmp(f1->name,f2->name);
}
static LHASH *prog_init()
static LHASH *prog_init(void)
{
LHASH *ret;
FUNCTION *f;
@ -372,14 +366,12 @@ static LHASH *prog_init()
return(ret);
}
static int MS_CALLBACK cmp(a,b)
FUNCTION *a,*b;
static int MS_CALLBACK cmp(FUNCTION *a, FUNCTION *b)
{
return(strncmp(a->name,b->name,8));
}
static unsigned long MS_CALLBACK hash(a)
FUNCTION *a;
static unsigned long MS_CALLBACK hash(FUNCTION *a)
{
return(lh_strhash(a->name));
}


+ 1
- 3
apps/pem_mail.c View File

@ -87,9 +87,7 @@ typedef struct lines_St
struct lines_st *next;
} LINES;
int main(argc, argv)
int argc;
char **argv;
int main(int argc, char **argv)
{
FILE *in;
RSA *rsa=NULL;


+ 13
- 41
apps/pkcs12.c View File

@ -96,9 +96,7 @@ int alg_print();
int cert_load();
#endif
int MAIN(argc, argv)
int argc;
char **argv;
int MAIN(int argc, char **argv)
{
char *infile=NULL, *outfile=NULL, *keyname = NULL;
char *certfile=NULL;
@ -440,9 +438,7 @@ if (export_cert) {
EXIT(ret);
}
int dump_cert_text (out, x)
BIO *out;
X509 *x;
int dump_cert_text (BIO *out, X509 *x)
{
char buf[256];
X509_NAME_oneline(X509_get_subject_name(x),buf,256);
@ -456,12 +452,8 @@ X509 *x;
return 0;
}
int dump_certs_keys_p12 (out, p12, pass, passlen, options)
BIO *out;
PKCS12 *p12;
unsigned char *pass;
int passlen;
int options;
int dump_certs_keys_p12 (BIO *out, PKCS12 *p12, unsigned char *pass,
int passlen, int options)
{
STACK *asafes, *bags;
int i, bagnid;
@ -493,12 +485,8 @@ int options;
return 1;
}
int dump_certs_pkeys_bags (out, bags, pass, passlen, options)
BIO *out;
STACK *bags;
unsigned char *pass;
int passlen;
int options;
int dump_certs_pkeys_bags (BIO *out, STACK *bags, unsigned char *pass,
int passlen, int options)
{
int i;
for (i = 0; i < sk_num (bags); i++) {
@ -509,12 +497,8 @@ int options;
return 1;
}
int dump_certs_pkeys_bag (out, bag, pass, passlen, options)
BIO *out;
PKCS12_SAFEBAG *bag;
unsigned char *pass;
int passlen;
int options;
int dump_certs_pkeys_bag (BIO *out, PKCS12_SAFEBAG *bag, unsigned char *pass,
int passlen, int options)
{
EVP_PKEY *pkey;
PKCS8_PRIV_KEY_INFO *p8;
@ -584,9 +568,7 @@ int options;
/* Hope this is OK .... */
int get_cert_chain (cert, chain)
X509 *cert;
STACK **chain;
int get_cert_chain (X509 *cert, STACK **chain)
{
X509_STORE *store;
X509_STORE_CTX store_ctx;
@ -614,9 +596,7 @@ err:
return i;
}
int alg_print (x, alg)
BIO *x;
X509_ALGOR *alg;
int alg_print (BIO *x, X509_ALGOR *alg)
{
PBEPARAM *pbe;
unsigned char *p;
@ -630,9 +610,7 @@ X509_ALGOR *alg;
/* Load all certificates from a given file */
int cert_load(in, sk)
BIO *in;
STACK *sk;
int cert_load(BIO *in, STACK *sk)
{
int ret;
X509 *cert;
@ -647,10 +625,7 @@ STACK *sk;
/* Generalised attribute print: handle PKCS#8 and bag attributes */
int print_attribs (out, attrlst, name)
BIO *out;
STACK *attrlst;
char *name;
int print_attribs (BIO *out, STACK *attrlst, char *name)
{
X509_ATTRIBUTE *attr;
ASN1_TYPE *av;
@ -705,10 +680,7 @@ char *name;
return 1;
}
void hex_prin(out, buf, len)
BIO *out;
unsigned char *buf;
int len;
void hex_prin(BIO *out, unsigned char *buf, int len)
{
int i;
for (i = 0; i < len; i++) BIO_printf (out, "%02X ", buf[i]);


+ 1
- 3
apps/pkcs7.c View File

@ -81,9 +81,7 @@
* -print_certs
*/
int MAIN(argc, argv)
int argc;
char **argv;
int MAIN(int argc, char **argv)
{
PKCS7 *p7=NULL;
int i,badops=0;


+ 10
- 36
apps/req.c View File

@ -137,9 +137,7 @@ static LHASH *req_conf=NULL;
#define TYPE_DSA 2
#define TYPE_DH 3
int MAIN(argc, argv)
int argc;
char **argv;
int MAIN(int argc, char **argv)
{
#ifndef NO_DSA
DSA *dsa_params=NULL;
@ -825,10 +823,7 @@ end:
EXIT(ex);
}
static int make_REQ(req,pkey,attribs)
X509_REQ *req;
EVP_PKEY *pkey;
int attribs;
static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, int attribs)
{
int ret=0,i;
unsigned char *p,*q;
@ -984,14 +979,8 @@ err:
return(ret);
}
static int add_DN_object(n,text,def,value,nid,min,max)
X509_NAME *n;
char *text;
char *def;
char *value;
int nid;
int min;
int max;
static int add_DN_object(X509_NAME *n, char *text, char *def, char *value,
int nid, int min, int max)
{
int i,j,ret=0;
X509_NAME_ENTRY *ne=NULL;
@ -1044,14 +1033,8 @@ err:
return(ret);
}
static int add_attribute_object(n,text,def,value,nid,min,max)
STACK *n;
char *text;
char *def;
char *value;
int nid;
int min;
int max;
static int add_attribute_object(STACK *n, char *text, char *def, char *value,
int nid, int min, int max)
{
int i,z;
X509_ATTRIBUTE *xa=NULL;
@ -1135,10 +1118,7 @@ err:
return(0);
}
static void MS_CALLBACK req_cb(p,n,arg)
int p;
int n;
char *arg;
static void MS_CALLBACK req_cb(int p, int n, char *arg)
{
char c='*';
@ -1153,10 +1133,7 @@ char *arg;
#endif
}
static int req_fix_data(nid,type,len,min,max)
int nid;
int *type;
int len,min,max;
static int req_fix_data(int nid, int *type, int len, int min, int max)
{
if (nid == NID_pkcs9_emailAddress)
*type=V_ASN1_IA5STRING;
@ -1189,9 +1166,7 @@ int len,min,max;
}
/* Check if the end of a string matches 'end' */
static int check_end(str, end)
char *str;
char *end;
static int check_end(char *str, char *end)
{
int elen, slen;
char *tmp;
@ -1202,8 +1177,7 @@ char *end;
return strcmp(tmp, end);
}
static int add_oid_section(conf)
LHASH *conf;
static int add_oid_section(LHASH *conf)
{
char *p;
STACK *sktmp;


+ 1
- 3
apps/rsa.c View File

@ -82,9 +82,7 @@
* -modulus - print the RSA key modulus
*/
int MAIN(argc, argv)
int argc;
char **argv;
int MAIN(int argc, char **argv)
{
int ret=1;
RSA *rsa=NULL;


+ 5
- 18
apps/s_cb.c View File

@ -71,9 +71,7 @@
int verify_depth=0;
int verify_error=X509_V_OK;
int MS_CALLBACK verify_callback(ok, ctx)
int ok;
X509_STORE_CTX *ctx;
int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx)
{
char buf[256];
X509 *err_cert;
@ -123,10 +121,7 @@ X509_STORE_CTX *ctx;
return(ok);
}
int set_cert_stuff(ctx, cert_file, key_file)
SSL_CTX *ctx;
char *cert_file;
char *key_file;
int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file)
{
if (cert_file != NULL)
{
@ -181,13 +176,8 @@ char *key_file;
return(1);
}
long MS_CALLBACK bio_dump_cb(bio,cmd,argp,argi,argl,ret)
BIO *bio;
int cmd;
const char *argp;
int argi;
long argl;
long ret;
long MS_CALLBACK bio_dump_cb(BIO *bio, int cmd, const char *argp, int argi,
long argl, long ret)
{
BIO *out;
@ -210,10 +200,7 @@ long ret;
return(ret);
}
void MS_CALLBACK apps_ssl_info_callback(s,where,ret)
SSL *s;
int where;
int ret;
void MS_CALLBACK apps_ssl_info_callback(SSL *s, int where, int ret)
{
char *str;
int w;


+ 3
- 8
apps/s_client.c View File

@ -103,7 +103,7 @@ static void print_stuff();
static BIO *bio_c_out=NULL;
static int c_quiet=0;
static void sc_usage()
static void sc_usage(void)
{
BIO_printf(bio_err,"usage: s_client args\n");
BIO_printf(bio_err,"\n");
@ -137,9 +137,7 @@ static void sc_usage()
}
int MAIN(argc, argv)
int argc;
char **argv;
int MAIN(int argc, char **argv)
{
int off=0;
SSL *con=NULL,*con2=NULL;
@ -657,10 +655,7 @@ end:
}
static void print_stuff(bio,s,full)
BIO *bio;
SSL *s;
int full;
static void print_stuff(BIO *bio, SSL *s, int full)
{
X509 *peer=NULL;
char *p;


+ 12
- 28
apps/s_server.c View File

@ -120,7 +120,7 @@ static unsigned char dh512_g[]={
0x02,
};
static DH *get_dh512()
static DH *get_dh512(void)
{
DH *dh=NULL;
@ -164,7 +164,7 @@ static int s_debug=0;
static int s_quiet=0;
#if 0
static void s_server_init()
static void s_server_init(void)
{
cipher=NULL;
s_server_verify=SSL_VERIFY_NONE;
@ -185,7 +185,7 @@ static void s_server_init()
}
#endif
static void sv_usage()
static void sv_usage(void)
{
BIO_printf(bio_err,"usage: s_server [args ...]\n");
BIO_printf(bio_err,"\n");
@ -226,9 +226,7 @@ static int local_argc=0;
static char **local_argv;
static int hack=0;
int MAIN(argc, argv)
int argc;
char *argv[];
int MAIN(int argc, char *argv[])
{
short port=PORT;
char *CApath=NULL,*CAfile=NULL;
@ -533,9 +531,7 @@ end:
EXIT(ret);
}
static void print_stats(bio,ssl_ctx)
BIO *bio;
SSL_CTX *ssl_ctx;
static void print_stats(BIO *bio, SSL_CTX *ssl_ctx)
{
BIO_printf(bio,"%4ld items in the session cache\n",
SSL_CTX_sess_number(ssl_ctx));
@ -560,10 +556,7 @@ SSL_CTX *ssl_ctx;
SSL_CTX_sess_get_cache_size(ssl_ctx));
}
static int sv_body(hostname, s, context)
char *hostname;
int s;
char *context;
static int sv_body(char *hostname, int s, char *context)
{
char *buf=NULL;
fd_set readfds;
@ -779,7 +772,7 @@ err:
return(ret);
}
static void close_accept_socket()
static void close_accept_socket(void)
{
BIO_printf(bio_err,"shutdown accept socket\n");
if (accept_socket >= 0)
@ -788,8 +781,7 @@ static void close_accept_socket()
}
}
static int init_ssl_connection(con)
SSL *con;
static int init_ssl_connection(SSL *con)
{
int i;
const char *str;
@ -844,7 +836,7 @@ SSL *con;
}
#ifndef NO_DH
static DH *load_dh_param()
static DH *load_dh_param(void)
{
DH *ret=NULL;
BIO *bio;
@ -859,9 +851,7 @@ err:
#endif
#if 0
static int load_CA(ctx,file)
SSL_CTX *ctx;
char *file;
static int load_CA(SSL_CTX *ctx, char *file)
{
FILE *in;
X509 *x=NULL;
@ -881,10 +871,7 @@ char *file;
}
#endif
static int www_body(hostname, s, context)
char *hostname;
int s;
char *context;
static int www_body(char *hostname, int s, char *context)
{
char *buf=NULL;
int ret=1;
@ -1226,10 +1213,7 @@ err:
return(ret);
}
static RSA MS_CALLBACK *tmp_rsa_cb(s,export,keylength)
SSL *s;
int export;
int keylength;
static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int export, int keylength)
{
static RSA *rsa_tmp=NULL;


+ 18
- 55
apps/s_socket.c View File

@ -93,11 +93,8 @@ static FARPROC lpTopWndProc=NULL;
static FARPROC lpTopHookProc=NULL;
extern HINSTANCE _hInstance; /* nice global CRT provides */
static LONG FAR PASCAL topHookProc(hwnd,message,wParam,lParam)
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
static LONG FAR PASCAL topHookProc(HWND hwnd, UINT message, WPARAM wParam,
LPARAM lParam)
{
if (hwnd == topWnd)
{
@ -122,7 +119,7 @@ static BOOL CALLBACK enumproc(HWND hwnd,LPARAM lParam)
#endif /* WIN32 */
#endif /* WINDOWS */
void sock_cleanup()
void sock_cleanup(void)
{
#ifdef WINDOWS
if (wsa_init_done)
@ -134,7 +131,7 @@ void sock_cleanup()
#endif
}
int sock_init()
int sock_init(void)
{
#ifdef WINDOWS
if (!wsa_init_done)
@ -165,10 +162,7 @@ int sock_init()
return(1);
}
int init_client(sock, host, port)
int *sock;
char *host;
int port;
int init_client(int *sock, char *host, int port)
{
unsigned char ip[4];
short p=0;
@ -181,10 +175,7 @@ int port;
return(init_client_ip(sock,ip,port));
}
int init_client_ip(sock, ip, port)
int *sock;
unsigned char ip[4];
int port;
int init_client_ip(int *sock, unsigned char ip[4], int port)
{
unsigned long addr;
struct sockaddr_in them;
@ -215,8 +206,7 @@ int port;
return(1);
}
int nbio_sock_error(sock)
int sock;
int nbio_sock_error(int sock)
{
int j,i,size;
@ -228,10 +218,7 @@ int sock;
return(j);
}
int nbio_init_client_ip(sock, ip, port)
int *sock;
unsigned char ip[4];
int port;
int nbio_init_client_ip(int *sock, unsigned char ip[4], int port)
{
unsigned long addr;
struct sockaddr_in them;
@ -280,11 +267,7 @@ int port;
return(1);
}
int do_server(port, ret, cb, context)
int port;
int *ret;
int (*cb)();
char *context;
int do_server(int port, int *ret, int (*cb)(), char *context)
{
int sock;
char *name;
@ -316,10 +299,7 @@ char *context;
}
}
int init_server_long(sock, port, ip)
int *sock;
int port;
char *ip;
int init_server_long(int *sock, int port, char *ip)
{
int ret=0;
struct sockaddr_in server;
@ -369,17 +349,12 @@ err:
return(ret);
}
int init_server(sock,port)
int *sock;
int port;
int init_server(int *sock, int port)
{
return(init_server_long(sock, port, NULL));
}
int do_accept(acc_sock, sock, host)
int acc_sock;
int *sock;
char **host;
int do_accept(int acc_sock, int *sock, char **host)
{
int ret,i;
struct hostent *h1,*h2;
@ -465,11 +440,8 @@ end:
return(1);
}
int extract_host_port(str,host_ptr,ip,port_ptr)
char *str;
char **host_ptr;
unsigned char *ip;