Avoid warnings. Fix fips_dssvs program.

This commit is contained in:
Dr. Stephen Henson 2007-06-22 12:17:52 +00:00
parent b2d65cbac7
commit ddb0cb5bfd
14 changed files with 81 additions and 70 deletions

View File

@ -157,7 +157,7 @@ my %table=(
"debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", "debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
"debug-bodo", "gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -march=i486 -pedantic -Wshadow -Wall::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", "debug-bodo", "gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -march=i486 -pedantic -Wshadow -Wall::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
"debug-ulf", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DBN_DEBUG_RAND -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations:::CYGWIN32:::${no_asm}:win32:cygwin-shared:::.dll", "debug-ulf", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DBN_DEBUG_RAND -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations:::CYGWIN32:::${no_asm}:win32:cygwin-shared:::.dll",
"debug-steve", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -g -march=i486 -pedantic -Wno-long-long -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared", "debug-steve", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -g -m32 -pedantic -Wno-long-long -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared",
"debug-steve-linux-pseudo64", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DOPENSSL_NO_ASM -g -mcpu=i486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:SIXTY_FOUR_BIT:${no_asm}:dlfcn:linux-shared", "debug-steve-linux-pseudo64", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DOPENSSL_NO_ASM -g -mcpu=i486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:SIXTY_FOUR_BIT:${no_asm}:dlfcn:linux-shared",
"debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",

View File

@ -1227,7 +1227,7 @@ static int send_ocsp_response(BIO *cbio, OCSP_RESPONSE *resp)
return 0; return 0;
BIO_printf(cbio, http_resp, i2d_OCSP_RESPONSE(resp, NULL)); BIO_printf(cbio, http_resp, i2d_OCSP_RESPONSE(resp, NULL));
i2d_OCSP_RESPONSE_bio(cbio, resp); i2d_OCSP_RESPONSE_bio(cbio, resp);
BIO_flush(cbio); (void)BIO_flush(cbio);
return 1; return 1;
} }

View File

@ -213,7 +213,7 @@ int MAIN(int argc, char **argv)
BIO_write(out, buf, chunk); BIO_write(out, buf, chunk);
num -= chunk; num -= chunk;
} }
BIO_flush(out); (void)BIO_flush(out);
app_RAND_write_file(NULL, bio_err); app_RAND_write_file(NULL, bio_err);
ret = 0; ret = 0;

View File

@ -573,5 +573,5 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *
BIO_printf(bio, " ..."); BIO_printf(bio, " ...");
BIO_printf(bio, "\n"); BIO_printf(bio, "\n");
} }
BIO_flush(bio); (void)BIO_flush(bio);
} }

View File

@ -668,7 +668,7 @@ re_start:
goto end; goto end;
} }
BIO_ctrl_set_connected(sbio, 1, &peer); (void)BIO_ctrl_set_connected(sbio, 1, &peer);
if ( enable_timeouts) if ( enable_timeouts)
{ {
@ -752,7 +752,7 @@ re_start:
while (mbuf_len>3 && mbuf[3]=='-'); while (mbuf_len>3 && mbuf[3]=='-');
/* STARTTLS command requires EHLO... */ /* STARTTLS command requires EHLO... */
BIO_printf(fbio,"EHLO openssl.client.net\r\n"); BIO_printf(fbio,"EHLO openssl.client.net\r\n");
BIO_flush(fbio); (void)BIO_flush(fbio);
/* wait for multi-line response to end EHLO SMTP response */ /* wait for multi-line response to end EHLO SMTP response */
do do
{ {
@ -761,7 +761,7 @@ re_start:
foundit=1; foundit=1;
} }
while (mbuf_len>3 && mbuf[3]=='-'); while (mbuf_len>3 && mbuf[3]=='-');
BIO_flush(fbio); (void)BIO_flush(fbio);
BIO_pop(fbio); BIO_pop(fbio);
BIO_free(fbio); BIO_free(fbio);
if (!foundit) if (!foundit)
@ -785,7 +785,7 @@ re_start:
BIO_gets(fbio,mbuf,BUFSIZZ); BIO_gets(fbio,mbuf,BUFSIZZ);
/* STARTTLS command requires CAPABILITY... */ /* STARTTLS command requires CAPABILITY... */
BIO_printf(fbio,". CAPABILITY\r\n"); BIO_printf(fbio,". CAPABILITY\r\n");
BIO_flush(fbio); (void)BIO_flush(fbio);
/* wait for multi-line CAPABILITY response */ /* wait for multi-line CAPABILITY response */
do do
{ {
@ -794,7 +794,7 @@ re_start:
foundit=1; foundit=1;
} }
while (mbuf_len>3 && mbuf[0]!='.'); while (mbuf_len>3 && mbuf[0]!='.');
BIO_flush(fbio); (void)BIO_flush(fbio);
BIO_pop(fbio); BIO_pop(fbio);
BIO_free(fbio); BIO_free(fbio);
if (!foundit) if (!foundit)
@ -814,7 +814,7 @@ re_start:
mbuf_len = BIO_gets(fbio,mbuf,BUFSIZZ); mbuf_len = BIO_gets(fbio,mbuf,BUFSIZZ);
} }
while (mbuf_len>3 && mbuf[3]=='-'); while (mbuf_len>3 && mbuf[3]=='-');
BIO_flush(fbio); (void)BIO_flush(fbio);
BIO_pop(fbio); BIO_pop(fbio);
BIO_free(fbio); BIO_free(fbio);
BIO_printf(sbio,"AUTH TLS\r\n"); BIO_printf(sbio,"AUTH TLS\r\n");
@ -1303,6 +1303,6 @@ static void print_stuff(BIO *bio, SSL *s, int full)
if (peer != NULL) if (peer != NULL)
X509_free(peer); X509_free(peer);
/* flush, or debugging output gets mixed with http response */ /* flush, or debugging output gets mixed with http response */
BIO_flush(bio); (void)BIO_flush(bio);
} }

View File

@ -184,120 +184,120 @@ int main(int argc, char *argv[])
message(out,"BN_add"); message(out,"BN_add");
if (!test_add(out)) goto err; if (!test_add(out)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_sub"); message(out,"BN_sub");
if (!test_sub(out)) goto err; if (!test_sub(out)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_lshift1"); message(out,"BN_lshift1");
if (!test_lshift1(out)) goto err; if (!test_lshift1(out)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_lshift (fixed)"); message(out,"BN_lshift (fixed)");
if (!test_lshift(out,ctx,BN_bin2bn(lst,sizeof(lst)-1,NULL))) if (!test_lshift(out,ctx,BN_bin2bn(lst,sizeof(lst)-1,NULL)))
goto err; goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_lshift"); message(out,"BN_lshift");
if (!test_lshift(out,ctx,NULL)) goto err; if (!test_lshift(out,ctx,NULL)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_rshift1"); message(out,"BN_rshift1");
if (!test_rshift1(out)) goto err; if (!test_rshift1(out)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_rshift"); message(out,"BN_rshift");
if (!test_rshift(out,ctx)) goto err; if (!test_rshift(out,ctx)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_sqr"); message(out,"BN_sqr");
if (!test_sqr(out,ctx)) goto err; if (!test_sqr(out,ctx)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_mul"); message(out,"BN_mul");
if (!test_mul(out)) goto err; if (!test_mul(out)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_div"); message(out,"BN_div");
if (!test_div(out,ctx)) goto err; if (!test_div(out,ctx)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_div_word"); message(out,"BN_div_word");
if (!test_div_word(out)) goto err; if (!test_div_word(out)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_div_recp"); message(out,"BN_div_recp");
if (!test_div_recp(out,ctx)) goto err; if (!test_div_recp(out,ctx)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_mod"); message(out,"BN_mod");
if (!test_mod(out,ctx)) goto err; if (!test_mod(out,ctx)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_mod_mul"); message(out,"BN_mod_mul");
if (!test_mod_mul(out,ctx)) goto err; if (!test_mod_mul(out,ctx)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_mont"); message(out,"BN_mont");
if (!test_mont(out,ctx)) goto err; if (!test_mont(out,ctx)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_mod_exp"); message(out,"BN_mod_exp");
if (!test_mod_exp(out,ctx)) goto err; if (!test_mod_exp(out,ctx)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_mod_exp_mont_consttime"); message(out,"BN_mod_exp_mont_consttime");
if (!test_mod_exp_mont_consttime(out,ctx)) goto err; if (!test_mod_exp_mont_consttime(out,ctx)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_exp"); message(out,"BN_exp");
if (!test_exp(out,ctx)) goto err; if (!test_exp(out,ctx)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_kronecker"); message(out,"BN_kronecker");
if (!test_kron(out,ctx)) goto err; if (!test_kron(out,ctx)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_mod_sqrt"); message(out,"BN_mod_sqrt");
if (!test_sqrt(out,ctx)) goto err; if (!test_sqrt(out,ctx)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_GF2m_add"); message(out,"BN_GF2m_add");
if (!test_gf2m_add(out)) goto err; if (!test_gf2m_add(out)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_GF2m_mod"); message(out,"BN_GF2m_mod");
if (!test_gf2m_mod(out)) goto err; if (!test_gf2m_mod(out)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_GF2m_mod_mul"); message(out,"BN_GF2m_mod_mul");
if (!test_gf2m_mod_mul(out,ctx)) goto err; if (!test_gf2m_mod_mul(out,ctx)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_GF2m_mod_sqr"); message(out,"BN_GF2m_mod_sqr");
if (!test_gf2m_mod_sqr(out,ctx)) goto err; if (!test_gf2m_mod_sqr(out,ctx)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_GF2m_mod_inv"); message(out,"BN_GF2m_mod_inv");
if (!test_gf2m_mod_inv(out,ctx)) goto err; if (!test_gf2m_mod_inv(out,ctx)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_GF2m_mod_div"); message(out,"BN_GF2m_mod_div");
if (!test_gf2m_mod_div(out,ctx)) goto err; if (!test_gf2m_mod_div(out,ctx)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_GF2m_mod_exp"); message(out,"BN_GF2m_mod_exp");
if (!test_gf2m_mod_exp(out,ctx)) goto err; if (!test_gf2m_mod_exp(out,ctx)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_GF2m_mod_sqrt"); message(out,"BN_GF2m_mod_sqrt");
if (!test_gf2m_mod_sqrt(out,ctx)) goto err; if (!test_gf2m_mod_sqrt(out,ctx)) goto err;
BIO_flush(out); (void)BIO_flush(out);
message(out,"BN_GF2m_mod_solve_quad"); message(out,"BN_GF2m_mod_solve_quad");
if (!test_gf2m_mod_solve_quad(out,ctx)) goto err; if (!test_gf2m_mod_solve_quad(out,ctx)) goto err;
BIO_flush(out); (void)BIO_flush(out);
BN_CTX_free(ctx); BN_CTX_free(ctx);
BIO_free(out); BIO_free(out);
@ -307,7 +307,7 @@ int main(int argc, char *argv[])
err: err:
BIO_puts(out,"1\n"); /* make sure the Perl script fed by bc notices BIO_puts(out,"1\n"); /* make sure the Perl script fed by bc notices
* the failure, see test_bn in test/Makefile.ssl*/ * the failure, see test_bn in test/Makefile.ssl*/
BIO_flush(out); (void)BIO_flush(out);
ERR_load_crypto_strings(); ERR_load_crypto_strings();
ERR_print_errors_fp(stderr); ERR_print_errors_fp(stderr);
EXIT(1); EXIT(1);

View File

@ -148,7 +148,7 @@ static int test_ecdh_curve(int nid, const char *text, BN_CTX *ctx, BIO *out)
#ifdef NOISY #ifdef NOISY
BIO_puts(out,"\n"); BIO_puts(out,"\n");
#else #else
BIO_flush(out); (void)BIO_flush(out);
#endif #endif
if (!EC_KEY_generate_key(a)) goto err; if (!EC_KEY_generate_key(a)) goto err;
@ -173,7 +173,7 @@ static int test_ecdh_curve(int nid, const char *text, BN_CTX *ctx, BIO *out)
BIO_puts(out,"\n"); BIO_puts(out,"\n");
#else #else
BIO_printf(out," ."); BIO_printf(out," .");
BIO_flush(out); (void)BIO_flush(out);
#endif #endif
if (!EC_KEY_generate_key(b)) goto err; if (!EC_KEY_generate_key(b)) goto err;
@ -199,7 +199,7 @@ static int test_ecdh_curve(int nid, const char *text, BN_CTX *ctx, BIO *out)
BIO_puts(out,"\n"); BIO_puts(out,"\n");
#else #else
BIO_printf(out,"."); BIO_printf(out,".");
BIO_flush(out); (void)BIO_flush(out);
#endif #endif
alen=KDF1_SHA1_len; alen=KDF1_SHA1_len;
@ -216,7 +216,7 @@ static int test_ecdh_curve(int nid, const char *text, BN_CTX *ctx, BIO *out)
BIO_puts(out,"\n"); BIO_puts(out,"\n");
#else #else
BIO_printf(out,"."); BIO_printf(out,".");
BIO_flush(out); (void)BIO_flush(out);
#endif #endif
blen=KDF1_SHA1_len; blen=KDF1_SHA1_len;
@ -233,7 +233,7 @@ static int test_ecdh_curve(int nid, const char *text, BN_CTX *ctx, BIO *out)
BIO_puts(out,"\n"); BIO_puts(out,"\n");
#else #else
BIO_printf(out,"."); BIO_printf(out,".");
BIO_flush(out); (void)BIO_flush(out);
#endif #endif
if ((aout < 4) || (bout != aout) || (memcmp(abuf,bbuf,aout) != 0)) if ((aout < 4) || (bout != aout) || (memcmp(abuf,bbuf,aout) != 0))

View File

@ -203,13 +203,13 @@ int x9_62_test_internal(BIO *out, int nid, const char *r_in, const char *s_in)
if (!EC_KEY_generate_key(key)) if (!EC_KEY_generate_key(key))
goto x962_int_err; goto x962_int_err;
BIO_printf(out, "."); BIO_printf(out, ".");
BIO_flush(out); (void)BIO_flush(out);
/* create the signature */ /* create the signature */
signature = ECDSA_do_sign(digest, 20, key); signature = ECDSA_do_sign(digest, 20, key);
if (signature == NULL) if (signature == NULL)
goto x962_int_err; goto x962_int_err;
BIO_printf(out, "."); BIO_printf(out, ".");
BIO_flush(out); (void)BIO_flush(out);
/* compare the created signature with the expected signature */ /* compare the created signature with the expected signature */
if ((r = BN_new()) == NULL || (s = BN_new()) == NULL) if ((r = BN_new()) == NULL || (s = BN_new()) == NULL)
goto x962_int_err; goto x962_int_err;
@ -219,12 +219,12 @@ int x9_62_test_internal(BIO *out, int nid, const char *r_in, const char *s_in)
if (BN_cmp(signature->r ,r) || BN_cmp(signature->s, s)) if (BN_cmp(signature->r ,r) || BN_cmp(signature->s, s))
goto x962_int_err; goto x962_int_err;
BIO_printf(out, "."); BIO_printf(out, ".");
BIO_flush(out); (void)BIO_flush(out);
/* verify the signature */ /* verify the signature */
if (ECDSA_do_verify(digest, 20, signature, key) != 1) if (ECDSA_do_verify(digest, 20, signature, key) != 1)
goto x962_int_err; goto x962_int_err;
BIO_printf(out, "."); BIO_printf(out, ".");
BIO_flush(out); (void)BIO_flush(out);
BIO_printf(out, " ok\n"); BIO_printf(out, " ok\n");
ret = 1; ret = 1;
@ -369,7 +369,7 @@ int test_builtin(BIO *out)
} }
BIO_printf(out, "."); BIO_printf(out, ".");
BIO_flush(out); (void)BIO_flush(out);
/* check key */ /* check key */
if (!EC_KEY_check_key(eckey)) if (!EC_KEY_check_key(eckey))
{ {
@ -377,7 +377,7 @@ int test_builtin(BIO *out)
goto builtin_err; goto builtin_err;
} }
BIO_printf(out, "."); BIO_printf(out, ".");
BIO_flush(out); (void)BIO_flush(out);
/* create signature */ /* create signature */
sig_len = ECDSA_size(eckey); sig_len = ECDSA_size(eckey);
if ((signature = OPENSSL_malloc(sig_len)) == NULL) if ((signature = OPENSSL_malloc(sig_len)) == NULL)
@ -388,7 +388,7 @@ int test_builtin(BIO *out)
goto builtin_err; goto builtin_err;
} }
BIO_printf(out, "."); BIO_printf(out, ".");
BIO_flush(out); (void)BIO_flush(out);
/* verify signature */ /* verify signature */
if (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) != 1) if (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) != 1)
{ {
@ -396,7 +396,7 @@ int test_builtin(BIO *out)
goto builtin_err; goto builtin_err;
} }
BIO_printf(out, "."); BIO_printf(out, ".");
BIO_flush(out); (void)BIO_flush(out);
/* verify signature with the wrong key */ /* verify signature with the wrong key */
if (ECDSA_verify(0, digest, 20, signature, sig_len, if (ECDSA_verify(0, digest, 20, signature, sig_len,
wrong_eckey) == 1) wrong_eckey) == 1)
@ -405,7 +405,7 @@ int test_builtin(BIO *out)
goto builtin_err; goto builtin_err;
} }
BIO_printf(out, "."); BIO_printf(out, ".");
BIO_flush(out); (void)BIO_flush(out);
/* wrong digest */ /* wrong digest */
if (ECDSA_verify(0, wrong_digest, 20, signature, sig_len, if (ECDSA_verify(0, wrong_digest, 20, signature, sig_len,
eckey) == 1) eckey) == 1)
@ -414,7 +414,7 @@ int test_builtin(BIO *out)
goto builtin_err; goto builtin_err;
} }
BIO_printf(out, "."); BIO_printf(out, ".");
BIO_flush(out); (void)BIO_flush(out);
/* modify a single byte of the signature */ /* modify a single byte of the signature */
offset = signature[10] % sig_len; offset = signature[10] % sig_len;
dirt = signature[11]; dirt = signature[11];
@ -425,7 +425,7 @@ int test_builtin(BIO *out)
goto builtin_err; goto builtin_err;
} }
BIO_printf(out, "."); BIO_printf(out, ".");
BIO_flush(out); (void)BIO_flush(out);
BIO_printf(out, " ok\n"); BIO_printf(out, " ok\n");
/* cleanup */ /* cleanup */

View File

@ -121,7 +121,7 @@ static int B64_write_PKCS7(BIO *bio, PKCS7 *p7)
} }
bio = BIO_push(b64, bio); bio = BIO_push(b64, bio);
i2d_PKCS7_bio(bio, p7); i2d_PKCS7_bio(bio, p7);
BIO_flush(bio); (void)BIO_flush(bio);
bio = BIO_pop(bio); bio = BIO_pop(bio);
BIO_free(b64); BIO_free(b64);
return 1; return 1;
@ -138,7 +138,7 @@ static PKCS7 *B64_read_PKCS7(BIO *bio)
bio = BIO_push(b64, bio); bio = BIO_push(b64, bio);
if(!(p7 = d2i_PKCS7_bio(bio, NULL))) if(!(p7 = d2i_PKCS7_bio(bio, NULL)))
PKCS7err(PKCS7_F_B64_READ_PKCS7,PKCS7_R_DECODE_ERROR); PKCS7err(PKCS7_F_B64_READ_PKCS7,PKCS7_R_DECODE_ERROR);
BIO_flush(bio); (void)BIO_flush(bio);
bio = BIO_pop(bio); bio = BIO_pop(bio);
BIO_free(b64); BIO_free(b64);
return p7; return p7;

View File

@ -426,7 +426,7 @@ PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher,
SMIME_crlf_copy(in, p7bio, flags); SMIME_crlf_copy(in, p7bio, flags);
BIO_flush(p7bio); (void)BIO_flush(p7bio);
if (!PKCS7_dataFinal(p7,p7bio)) { if (!PKCS7_dataFinal(p7,p7bio)) {
PKCS7err(PKCS7_F_PKCS7_ENCRYPT,PKCS7_R_PKCS7_DATAFINAL_ERROR); PKCS7err(PKCS7_F_PKCS7_ENCRYPT,PKCS7_R_PKCS7_DATAFINAL_ERROR);

View File

@ -59,7 +59,7 @@
#include <string.h> #include <string.h>
#include <openssl/dsa.h> #include <openssl/dsa.h>
/* Minimal FIPS versions of FIPS_rsa_new() and FIPS_rsa_free: to /* Minimal FIPS versions of FIPS_dsa_new() and FIPS_dsa_free: to
* reduce external dependencies. * reduce external dependencies.
*/ */
@ -71,7 +71,7 @@ DSA *FIPS_dsa_new(void)
return NULL; return NULL;
memset(ret, 0, sizeof(DSA)); memset(ret, 0, sizeof(DSA));
ret->meth = DSA_OpenSSL(); ret->meth = DSA_OpenSSL();
if (ret->meth->finish) if (ret->meth->init)
ret->meth->init(ret); ret->meth->init(ret);
return ret; return ret;
} }

View File

@ -94,7 +94,8 @@ void pqg()
unsigned long h; unsigned long h;
dsa = FIPS_dsa_new(); dsa = FIPS_dsa_new();
DSA_generate_parameters_ex(dsa, nmod,seed,0,&counter,&h,NULL); if (!DSA_generate_parameters_ex(dsa, nmod,seed,0,&counter,&h,NULL))
do_print_errors();
pbn("P",dsa->p); pbn("P",dsa->p);
pbn("Q",dsa->q); pbn("Q",dsa->q);
pbn("G",dsa->g); pbn("G",dsa->g);
@ -132,7 +133,8 @@ void keypair()
printf("[mod = %d]\n\n",nmod); printf("[mod = %d]\n\n",nmod);
dsa = FIPS_dsa_new(); dsa = FIPS_dsa_new();
DSA_generate_parameters_ex(dsa, nmod,NULL,0,NULL,NULL,NULL); if (!DSA_generate_parameters_ex(dsa, nmod,NULL,0,NULL,NULL,NULL))
do_print_errors();
pbn("P",dsa->p); pbn("P",dsa->p);
pbn("Q",dsa->q); pbn("Q",dsa->q);
pbn("G",dsa->g); pbn("G",dsa->g);
@ -140,7 +142,9 @@ void keypair()
while(n--) while(n--)
{ {
DSA_generate_key(dsa); if (!DSA_generate_key(dsa))
do_print_errors();
pbn("X",dsa->priv_key); pbn("X",dsa->priv_key);
pbn("Y",dsa->pub_key); pbn("Y",dsa->pub_key);
@ -169,9 +173,11 @@ void siggen()
{ {
nmod=atoi(value); nmod=atoi(value);
printf("[mod = %d]\n\n",nmod); printf("[mod = %d]\n\n",nmod);
if (dsa)
FIPS_dsa_free(dsa);
dsa = FIPS_dsa_new(); dsa = FIPS_dsa_new();
DSA_generate_parameters_ex(dsa, nmod,NULL,0,NULL,NULL,NULL); if (!DSA_generate_parameters_ex(dsa, nmod,NULL,0,NULL,NULL,NULL))
do_print_errors();
pbn("P",dsa->p); pbn("P",dsa->p);
pbn("Q",dsa->q); pbn("Q",dsa->q);
pbn("G",dsa->g); pbn("G",dsa->g);
@ -191,7 +197,8 @@ void siggen()
n=hex2bin(value,msg); n=hex2bin(value,msg);
pv("Msg",msg,n); pv("Msg",msg,n);
DSA_generate_key(dsa); if (!DSA_generate_key(dsa))
do_print_errors();
pk.type = EVP_PKEY_DSA; pk.type = EVP_PKEY_DSA;
pk.pkey.dsa = dsa; pk.pkey.dsa = dsa;
pbn("Y",dsa->pub_key); pbn("Y",dsa->pub_key);
@ -206,10 +213,12 @@ void siggen()
pbn("R",sig->r); pbn("R",sig->r);
pbn("S",sig->s); pbn("S",sig->s);
putc('\n',stdout); putc('\n',stdout);
DSA_SIG_free(sig);
EVP_MD_CTX_cleanup(&mctx); EVP_MD_CTX_cleanup(&mctx);
FIPS_dsa_free(dsa);
} }
} }
if (dsa)
FIPS_dsa_free(dsa);
} }
void sigver() void sigver()

View File

@ -80,6 +80,8 @@ RSA *FIPS_rsa_new(void)
void FIPS_rsa_free(RSA *r) void FIPS_rsa_free(RSA *r)
{ {
if (!r)
return;
if (r->meth->finish) if (r->meth->finish)
r->meth->finish(r); r->meth->finish(r);
if (r->n != NULL) BN_clear_free(r->n); if (r->n != NULL) BN_clear_free(r->n);

View File

@ -1142,7 +1142,7 @@ dtls1_retransmit_message(SSL *s, unsigned short seq, unsigned long frag_off,
SSL3_RT_CHANGE_CIPHER_SPEC : SSL3_RT_HANDSHAKE); SSL3_RT_CHANGE_CIPHER_SPEC : SSL3_RT_HANDSHAKE);
s->d1->retransmitting = 0; s->d1->retransmitting = 0;
BIO_flush(SSL_get_wbio(s)); (void)BIO_flush(SSL_get_wbio(s));
return ret; return ret;
} }