#include <string.h>
#include <stdlib.h>
+#include "../e_os.h"
+
#ifdef NO_BF
int main(int argc, char *argv[])
{
else
ret=test();
- exit(ret);
+ EXIT(ret);
return(0);
}
if (a == NULL) return;
if (a->d != NULL)
{
- memset(a->d,0,a->dmax*sizeof(a->d[0]));
+ OPENSSL_cleanse(a->d,a->dmax*sizeof(a->d[0]));
if (!(BN_get_flags(a,BN_FLG_STATIC_DATA)))
OPENSSL_free(a->d);
}
i=BN_get_flags(a,BN_FLG_MALLOCED);
- memset(a,0,sizeof(BIGNUM));
+ OPENSSL_cleanse(a,sizeof(BIGNUM));
if (i)
OPENSSL_free(a);
}
err:
if (buf != NULL)
{
- memset(buf,0,bytes);
+ OPENSSL_cleanse(buf,bytes);
OPENSSL_free(buf);
}
return(ret);
ctx=BN_CTX_new();
- if (ctx == NULL) exit(1);
+ if (ctx == NULL) EXIT(1);
out=BIO_new(BIO_s_file());
- if (out == NULL) exit(1);
+ if (out == NULL) EXIT(1);
if (outfile == NULL)
{
BIO_set_fp(out,stdout,BIO_NOCLOSE);
if (!BIO_write_filename(out,outfile))
{
perror(outfile);
- exit(1);
+ EXIT(1);
}
}
BIO_free(out);
/**/
- exit(0);
+ EXIT(0);
err:
BIO_puts(out,"1\n"); /* make sure the Perl script fed by bc notices
* the failure, see test_bn in test/Makefile.ssl*/
BIO_flush(out);
ERR_load_crypto_strings();
ERR_print_errors_fp(stderr);
- exit(1);
+ EXIT(1);
return(1);
}
while ((l=ERR_get_error()))
fprintf(stderr,"ERROR:%s\n",
ERR_error_string(l,NULL));
- exit(1);
+ EXIT(1);
}
if (bp != NULL)
{
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+
+#include "../e_os.h"
+
#include <openssl/bio.h>
#include <openssl/bn.h>
#include <openssl/rand.h>
ERR_load_BN_strings();
ctx=BN_CTX_new();
- if (ctx == NULL) exit(1);
+ if (ctx == NULL) EXIT(1);
r_mont=BN_new();
r_recp=BN_new();
r_simple=BN_new();
out=BIO_new(BIO_s_file());
- if (out == NULL) exit(1);
+ if (out == NULL) EXIT(1);
BIO_set_fp(out,stdout,BIO_NOCLOSE);
for (i=0; i<200; i++)
{
printf("BN_mod_exp_mont() problems\n");
ERR_print_errors(out);
- exit(1);
+ EXIT(1);
}
ret=BN_mod_exp_recp(r_recp,a,b,m,ctx);
{
printf("BN_mod_exp_recp() problems\n");
ERR_print_errors(out);
- exit(1);
+ EXIT(1);
}
ret=BN_mod_exp_simple(r_simple,a,b,m,ctx);
{
printf("BN_mod_exp_simple() problems\n");
ERR_print_errors(out);
- exit(1);
+ EXIT(1);
}
if (BN_cmp(r_simple, r_mont) == 0
printf("\nrecp ="); BN_print(out,r_recp);
printf("\nmont ="); BN_print(out,r_mont);
printf("\n");
- exit(1);
+ EXIT(1);
}
}
BN_free(r_mont);
CRYPTO_mem_leaks(out);
BIO_free(out);
printf(" done\n");
- exit(0);
+ EXIT(0);
err:
ERR_load_crypto_strings();
ERR_print_errors(out);
- exit(1);
+ EXIT(1);
return(1);
}
#include <string.h>
#include <stdlib.h>
+#include "../e_os.h"
+
#ifdef NO_CAST
int main(int argc, char *argv[])
{
}
#endif
- exit(err);
+ EXIT(err);
return(err);
}
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+
+#include "../e_os.h"
+
#ifdef WINDOWS
#include "../bio/bss_file.c"
#endif
RAND_seed(rnd_seed, sizeof rnd_seed);
out=BIO_new(BIO_s_file());
- if (out == NULL) exit(1);
+ if (out == NULL) EXIT(1);
BIO_set_fp(out,stdout,BIO_NOCLOSE);
a=DH_generate_parameters(64,DH_GENERATOR_5,cb,out);
if(b != NULL) DH_free(b);
if(a != NULL) DH_free(a);
BIO_free(out);
- exit(ret);
+ EXIT(ret);
return(ret);
}
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
+
+#include "../e_os.h"
+
#include <openssl/crypto.h>
#include <openssl/rand.h>
#include <openssl/bio.h>
BIO_free(bio_err);
bio_err = NULL;
}
- exit(!ret);
+ EXIT(!ret);
return(0);
}
+static int cb_exit(int ec)
+ {
+ EXIT(ec);
+ }
+
static void MS_CALLBACK dsa_cb(int p, int n, void *arg)
{
char c='*';
if (!ok && (p == 0) && (num > 1))
{
BIO_printf((BIO *)arg,"error in dsatest\n");
- exit(1);
+ cb_exit(1);
}
}
#endif
#include <string.h>
#include <stdlib.h>
+#include "../e_os.h"
+
#ifdef NO_HMAC
int main(int argc, char *argv[])
{
else
printf("test %d ok\n",i);
}
- exit(err);
+ EXIT(err);
return(0);
}
#include <string.h>
#include <stdlib.h>
+#include "../e_os.h"
+
#ifdef NO_IDEA
int main(int argc, char *argv[])
{
else
printf("ok\n");
- exit(err);
+ EXIT(err);
return(err);
}
t=(t+i)&0xff;
}
memcpy(sp1,state,16*sizeof(MD2_INT));
- memset(state,0,48*sizeof(MD2_INT));
+ OPENSSL_cleanse(state,48*sizeof(MD2_INT));
}
void MD2_Final(unsigned char *md, MD2_CTX *c)
}
#endif
MD2_Final(md,&c);
- memset(&c,0,sizeof(c)); /* Security consideration */
+ OPENSSL_cleanse(&c,sizeof(c)); /* Security consideration */
return(md);
}
#include <stdlib.h>
#include <string.h>
+#include "../e_os.h"
+
#ifdef NO_MD2
int main(int argc, char *argv[])
{
R++;
P++;
}
- exit(err);
+ EXIT(err);
return(0);
}
}
#endif
MD4_Final(md,&c);
- memset(&c,0,sizeof(c)); /* security consideration */
+ OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */
return(md);
}
#include <string.h>
#include <stdlib.h>
+#include "../e_os.h"
+
#ifdef NO_MD4
int main(int argc, char *argv[])
{
R++;
P++;
}
- exit(err);
+ EXIT(err);
return(0);
}
}
#endif
MD5_Final(md,&c);
- memset(&c,0,sizeof(c)); /* security consideration */
+ OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */
return(md);
}
#include <string.h>
#include <stdlib.h>
+#include "../e_os.h"
+
#ifdef NO_MD5
int main(int argc, char *argv[])
{
R++;
P++;
}
- exit(err);
+ EXIT(err);
return(0);
}
MDC2_Init(&c);
MDC2_Update(&c,d,n);
MDC2_Final(md,&c);
- memset(&c,0,sizeof(c)); /* security consideration */
+ OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */
return(md);
}
#include <stdlib.h>
#include <string.h>
+#include "../e_os.h"
+
#if defined(NO_DES) && !defined(NO_MDC2)
#define NO_MDC2
#endif
else
printf("pad2 - ok\n");
- exit(ret);
+ EXIT(ret);
return(ret);
}
#endif
* NOT taken from the BytesToKey function */
EVP_BytesToKey(enc,EVP_md5(),iv,kstr,klen,1,key,NULL);
- if (kstr == (unsigned char *)buf) memset(buf,0,PEM_BUFSIZE);
+ if (kstr == (unsigned char *)buf) OPENSSL_cleanse(buf,PEM_BUFSIZE);
buf[0]='\0';
PEM_proc_type(buf,PEM_TYPE_ENCRYPTED);
#include <stdlib.h>
#include <openssl/rand.h>
+#include "../e_os.h"
+
/* some FIPS 140-1 random number test */
/* some simple tests */
}
printf("test 4 done\n");
err=((err)?1:0);
- exit(err);
+ EXIT(err);
return(err);
}
#include <string.h>
#include <stdlib.h>
+#include "../e_os.h"
+
#ifdef NO_RC2
int main(int argc, char *argv[])
{
printf("ok\n");
#endif
- exit(err);
+ EXIT(err);
return(err);
}
#include <stdlib.h>
#include <string.h>
+#include "../e_os.h"
+
#ifdef NO_RC4
int main(int argc, char *argv[])
{
}
}
printf("done\n");
- exit(err);
+ EXIT(err);
return(0);
}
#endif
#include <string.h>
#include <stdlib.h>
+#include "../e_os.h"
+
#ifdef NO_RC5
int main(int argc, char *argv[])
{
}
if (err == 0) printf("cbc RC5 ok\n");
- exit(err);
+ EXIT(err);
return(err);
}
#include <string.h>
#include <stdlib.h>
+#include "../e_os.h"
+
#ifdef NO_RIPEMD
int main(int argc, char *argv[])
{
R++;
P++;
}
- exit(err);
+ EXIT(err);
return(0);
}
#include <string.h>
#include <stdlib.h>
+#include "../e_os.h"
+
#ifdef NO_SHA
int main(int argc, char *argv[])
{
}
else
printf("test 3 ok\n");
- exit(err);
+ EXIT(err);
return(0);
}
#include <string.h>
#include <stdlib.h>
+#include "../e_os.h"
+
#ifdef NO_SHA
int main(int argc, char *argv[])
{
}
else
printf("test 3 ok\n");
- exit(err);
+ EXIT(err);
return(0);
}
=head1 NAME
-RSA_print, RSA_print_fp, DHparams_print, DHparams_print_fp, DSA_print,
-DSA_print_fp, DHparams_print, DHparams_print_fp - print cryptographic
-parameters
+RSA_print, RSA_print_fp,
+DSAparams_print, DSAparams_print_fp, DSA_print, DSA_print_fp,
+DHparams_print, DHparams_print_fp - print cryptographic parameters
=head1 SYNOPSIS
# endif
# if defined(WIN16) && !defined(MONOLITH) && defined(SSLEAY) && defined(_WINEXITNOPERSIST)
-# define EXIT(n) { if (n == 0) _wsetexit(_WINEXITNOPERSIST); return(n); }
+# define EXIT(n) do { if (n == 0) _wsetexit(_WINEXITNOPERSIST); return(n); } while(0)
# else
-# define EXIT(n) return(n);
+# define EXIT(n) return(n)
# endif
# define LIST_SEPARATOR_CHAR ';'
# ifndef X_OK
# define LIST_SEPARATOR_CHAR ':'
# define NUL_DEV "/dev/null"
# ifndef MONOLITH
-# define EXIT(n) exit(n); return(n)
+# define EXIT(n) do { exit(n); return(n); } while(0)
# else
# define EXIT(n) return(n)
# endif
s->method->ssl3_enc->generate_master_secret(s,
s->session->master_key,
p,i);
- memset(p,0,i);
+ OPENSSL_cleanse(p,i);
}
else
#endif
"the test anyway (and\n-d to see what happens), "
"or add one of -ssl2, -ssl3, -tls1, -reuse\n"
"to avoid protocol mismatch.\n");
- exit(1);
+ EXIT(1);
}
if (print_time)
METH_init(top);
METH_control(tmp1,METH_CONTROL_DUMP,stdout);
METH_control(tmp2,METH_CONTROL_DUMP,stdout);
- exit(0);
+ EXIT(0);
err:
ERR_load_crypto_strings();
ERR_print_errors_fp(stderr);
- exit(1);
+ EXIT(1);
return(0);
}