Remove parentheses of return.

Since return is inconsistent, I removed unnecessary parentheses and
unified them.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4541)
This commit is contained in:
KaoruToda 2017-10-17 23:04:09 +09:00 committed by Matt Caswell
parent 2139145b72
commit 26a7d938c9
220 changed files with 1449 additions and 1449 deletions

View File

@ -663,7 +663,7 @@ X509 *load_cert(const char *file, int format, const char *cert_descrip)
ERR_print_errors(bio_err);
}
BIO_free(cert);
return (x);
return x;
}
X509_CRL *load_crl(const char *infile, int format)
@ -697,7 +697,7 @@ X509_CRL *load_crl(const char *infile, int format)
end:
BIO_free(in);
return (x);
return x;
}
EVP_PKEY *load_key(const char *file, int format, int maybe_stdin,
@ -769,7 +769,7 @@ EVP_PKEY *load_key(const char *file, int format, int maybe_stdin,
BIO_printf(bio_err, "unable to load %s\n", key_descrip);
ERR_print_errors(bio_err);
}
return (pkey);
return pkey;
}
EVP_PKEY *load_pubkey(const char *file, int format, int maybe_stdin,
@ -855,7 +855,7 @@ EVP_PKEY *load_pubkey(const char *file, int format, int maybe_stdin,
BIO_free(key);
if (pkey == NULL)
BIO_printf(bio_err, "unable to load %s\n", key_descrip);
return (pkey);
return pkey;
}
static int load_certs_crls(const char *file, int format,
@ -1334,7 +1334,7 @@ static int index_serial_cmp(const OPENSSL_CSTRING *a,
for (aa = a[DB_serial]; *aa == '0'; aa++) ;
for (bb = b[DB_serial]; *bb == '0'; bb++) ;
return (strcmp(aa, bb));
return strcmp(aa, bb);
}
static int index_name_qual(char **a)
@ -1349,7 +1349,7 @@ static unsigned long index_name_hash(const OPENSSL_CSTRING *a)
int index_name_cmp(const OPENSSL_CSTRING *a, const OPENSSL_CSTRING *b)
{
return (strcmp(a[DB_name], b[DB_name]));
return strcmp(a[DB_name], b[DB_name]);
}
static IMPLEMENT_LHASH_HASH_FN(index_serial, OPENSSL_CSTRING)
@ -1400,7 +1400,7 @@ BIGNUM *load_serial(const char *serialfile, int create, ASN1_INTEGER **retai)
err:
BIO_free(in);
ASN1_INTEGER_free(ai);
return (ret);
return ret;
}
int save_serial(const char *serialfile, const char *suffix, const BIGNUM *serial,
@ -1450,7 +1450,7 @@ int save_serial(const char *serialfile, const char *suffix, const BIGNUM *serial
err:
BIO_free_all(out);
ASN1_INTEGER_free(ai);
return (ret);
return ret;
}
int rotate_serial(const char *serialfile, const char *new_suffix,
@ -2153,7 +2153,7 @@ double app_tminterval(int stop, int usertime)
ret = (__int64)(tmstop.QuadPart - tmstart.QuadPart) * 1e-7;
}
return (ret);
return ret;
}
#elif defined(OPENSSL_SYSTEM_VXWORKS)
# include <time.h>
@ -2189,7 +2189,7 @@ double app_tminterval(int stop, int usertime)
else
ret = (now - tmstart) / (double)sysClkRateGet();
# endif
return (ret);
return ret;
}
#elif defined(OPENSSL_SYSTEM_VMS)
@ -2223,7 +2223,7 @@ double app_tminterval(int stop, int usertime)
else
ret = (now - tmstart) / (double)(CLK_TCK);
return (ret);
return ret;
}
#elif defined(_SC_CLK_TCK) /* by means of unistd.h */
@ -2246,7 +2246,7 @@ double app_tminterval(int stop, int usertime)
ret = (now - tmstart) / (double)tck;
}
return (ret);
return ret;
}
#else
@ -2371,9 +2371,9 @@ int raw_read_stdin(void *buf, int siz)
{
DWORD n;
if (ReadFile(GetStdHandle(STD_INPUT_HANDLE), buf, siz, &n, NULL))
return (n);
return n;
else
return (-1);
return -1;
}
#elif defined(__VMS)
# include <sys/socket.h>
@ -2394,9 +2394,9 @@ int raw_write_stdout(const void *buf, int siz)
{
DWORD n;
if (WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), buf, siz, &n, NULL))
return (n);
return n;
else
return (-1);
return -1;
}
#else
int raw_write_stdout(const void *buf, int siz)

View File

@ -306,7 +306,7 @@ int asn1parse_main(int argc, char **argv)
OPENSSL_free(str);
ASN1_TYPE_free(at);
sk_OPENSSL_STRING_free(osk);
return (ret);
return ret;
}
static int do_generate(char *genstr, const char *genconf, BUF_MEM *buf)

View File

@ -1235,7 +1235,7 @@ end_of_options:
NCONF_free(conf);
NCONF_free(extconf);
release_engine(e);
return (ret);
return ret;
}
static char *lookup_conf(const CONF *conf, const char *section, const char *tag)
@ -1312,7 +1312,7 @@ static int certify(X509 **xret, const char *infile, EVP_PKEY *pkey, X509 *x509,
end:
X509_REQ_free(req);
BIO_free(in);
return (ok);
return ok;
}
static int certify_cert(X509 **xret, const char *infile, EVP_PKEY *pkey, X509 *x509,
@ -1365,7 +1365,7 @@ static int certify_cert(X509 **xret, const char *infile, EVP_PKEY *pkey, X509 *x
end:
X509_REQ_free(rreq);
X509_free(req);
return (ok);
return ok;
}
static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
@ -1866,7 +1866,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
X509_free(ret);
else
*xret = ret;
return (ok);
return ok;
}
static void write_new_certificate(BIO *bp, X509 *x, int output_der, int notext)
@ -2013,7 +2013,7 @@ static int certify_spkac(X509 **xret, const char *infile, EVP_PKEY *pkey,
NETSCAPE_SPKI_free(spki);
X509_NAME_ENTRY_free(ne);
return (ok);
return ok;
}
static int check_time_format(const char *str)
@ -2119,7 +2119,7 @@ static int do_revoke(X509 *x509, CA_DB *db, REVINFO_TYPE rev_type,
end:
for (i = 0; i < DB_NUMBER; i++)
OPENSSL_free(row[i]);
return (ok);
return ok;
}
static int get_certificate_status(const char *serial, CA_DB *db)
@ -2186,7 +2186,7 @@ static int get_certificate_status(const char *serial, CA_DB *db)
for (i = 0; i < DB_NUMBER; i++) {
OPENSSL_free(row[i]);
}
return (ok);
return ok;
}
static int do_updatedb(CA_DB *db)
@ -2244,7 +2244,7 @@ static int do_updatedb(CA_DB *db)
ASN1_UTCTIME_free(a_tm);
OPENSSL_free(a_tm_s);
return (cnt);
return cnt;
}
static const char *crl_reasons[] = {

View File

@ -1103,7 +1103,7 @@ int cms_main(int argc, char **argv)
BIO_free(indata);
BIO_free_all(out);
OPENSSL_free(passin);
return (ret);
return ret;
}
static int save_certs(char *signerfile, STACK_OF(X509) *signers)

View File

@ -337,5 +337,5 @@ int crl_main(int argc, char **argv)
X509_CRL_free(x);
X509_STORE_CTX_free(ctx);
X509_STORE_free(store);
return (ret);
return ret;
}

View File

@ -162,7 +162,7 @@ int crl2pkcs7_main(int argc, char **argv)
PKCS7_free(p7);
X509_CRL_free(crl);
return (ret);
return ret;
}
/*-
@ -212,5 +212,5 @@ static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile)
/* never need to OPENSSL_free x */
BIO_free(in);
sk_X509_INFO_free(sk);
return (ret);
return ret;
}

View File

@ -398,7 +398,7 @@ int dgst_main(int argc, char **argv)
OPENSSL_free(sigbuf);
BIO_free(bmd);
release_engine(e);
return (ret);
return ret;
}
int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,

View File

@ -364,7 +364,7 @@ int dhparam_main(int argc, char **argv)
BIO_free_all(out);
DH_free(dh);
release_engine(e);
return (ret);
return ret;
}
static int dh_cb(int p, int n, BN_GENCB *cb)

View File

@ -256,6 +256,6 @@ int dsa_main(int argc, char **argv)
release_engine(e);
OPENSSL_free(passin);
OPENSSL_free(passout);
return (ret);
return ret;
}
#endif

View File

@ -230,7 +230,7 @@ int dsaparam_main(int argc, char **argv)
BIO_free_all(out);
DSA_free(dsa);
release_engine(e);
return (ret);
return ret;
}
static int dsa_cb(int p, int n, BN_GENCB *cb)

View File

@ -277,6 +277,6 @@ int ec_main(int argc, char **argv)
release_engine(e);
OPENSSL_free(passin);
OPENSSL_free(passout);
return (ret);
return ret;
}
#endif

View File

@ -437,7 +437,7 @@ int ecparam_main(int argc, char **argv)
release_engine(e);
BIO_free(in);
BIO_free_all(out);
return (ret);
return ret;
}
#endif

View File

@ -483,6 +483,6 @@ int engine_main(int argc, char **argv)
sk_OPENSSL_STRING_free(pre_cmds);
sk_OPENSSL_STRING_free(post_cmds);
BIO_free_all(out);
return (ret);
return ret;
}
#endif

View File

@ -62,5 +62,5 @@ int errstr_main(int argc, char **argv)
}
}
end:
return (ret);
return ret;
}

View File

@ -133,6 +133,6 @@ int gendsa_main(int argc, char **argv)
DSA_free(dsa);
release_engine(e);
OPENSSL_free(passout);
return (ret);
return ret;
}
#endif

View File

@ -166,7 +166,7 @@ opthelp:
OPENSSL_free(passout);
if (ret != 0)
ERR_print_errors(bio_err);
return (ret);
return ret;
}
static int genrsa_cb(int p, int n, BN_GENCB *cb)

View File

@ -109,5 +109,5 @@ int nseq_main(int argc, char **argv)
BIO_free_all(out);
NETSCAPE_CERT_SEQUENCE_free(seq);
return (ret);
return ret;
}

View File

@ -747,7 +747,7 @@ redo_accept:
OPENSSL_free(tport);
OPENSSL_free(tpath);
return (ret);
return ret;
}
static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert,

View File

@ -534,7 +534,7 @@ static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
FUNCTION f, *fp;
if (argc <= 0 || argv[0] == NULL)
return (0);
return 0;
f.name = argv[0];
fp = lh_FUNCTION_retrieve(prog, &f);
if (fp == NULL) {
@ -549,7 +549,7 @@ static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
}
}
if (fp != NULL) {
return (fp->func(argc, argv));
return fp->func(argc, argv);
}
if ((strncmp(argv[0], "no-", 3)) == 0) {
/*
@ -559,7 +559,7 @@ static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
f.name = argv[0] + 3;
if (lh_FUNCTION_retrieve(prog, &f) == NULL) {
BIO_printf(bio_out, "%s\n", argv[0]);
return (0);
return 0;
}
BIO_printf(bio_out, "%s\n", argv[0] + 3);
return 1;
@ -790,7 +790,7 @@ static LHASH_OF(FUNCTION) *prog_init(void)
qsort(functions, i, sizeof(*functions), SortFnByName);
if ((ret = lh_FUNCTION_new(function_hash, function_cmp)) == NULL)
return (NULL);
return NULL;
for (f = functions; f->name != NULL; f++)
(void)lh_FUNCTION_insert(ret, f);

View File

@ -295,7 +295,7 @@ int passwd_main(int argc, char **argv)
OPENSSL_free(salt_malloc);
OPENSSL_free(passwd_malloc);
BIO_free(in);
return (ret);
return ret;
}
/*

View File

@ -193,5 +193,5 @@ int pkcs7_main(int argc, char **argv)
release_engine(e);
BIO_free(in);
BIO_free_all(out);
return (ret);
return ret;
}

View File

@ -128,5 +128,5 @@ int rand_main(int argc, char **argv)
ERR_print_errors(bio_err);
release_engine(e);
BIO_free_all(out);
return (ret);
return ret;
}

View File

@ -307,6 +307,6 @@ int rsa_main(int argc, char **argv)
RSA_free(rsa);
OPENSSL_free(passin);
OPENSSL_free(passout);
return (ret);
return ret;
}
#endif

View File

@ -100,7 +100,7 @@ int verify_callback(int ok, X509_STORE_CTX *ctx)
policies_print(ctx);
if (ok && !verify_args.quiet)
BIO_printf(bio_err, "verify return:%d\n", ok);
return (ok);
return ok;
}
int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file)
@ -111,7 +111,7 @@ int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file)
BIO_printf(bio_err, "unable to get certificate from '%s'\n",
cert_file);
ERR_print_errors(bio_err);
return (0);
return 0;
}
if (key_file == NULL)
key_file = cert_file;
@ -119,7 +119,7 @@ int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file)
BIO_printf(bio_err, "unable to get private key from '%s'\n",
key_file);
ERR_print_errors(bio_err);
return (0);
return 0;
}
/*
@ -134,7 +134,7 @@ int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file)
if (!SSL_CTX_check_private_key(ctx)) {
BIO_printf(bio_err,
"Private key does not match the certificate public key\n");
return (0);
return 0;
}
}
return 1;
@ -423,19 +423,19 @@ long bio_dump_callback(BIO *bio, int cmd, const char *argp,
out = (BIO *)BIO_get_callback_arg(bio);
if (out == NULL)
return (ret);
return ret;
if (cmd == (BIO_CB_READ | BIO_CB_RETURN)) {
BIO_printf(out, "read from %p [%p] (%lu bytes => %ld (0x%lX))\n",
(void *)bio, (void *)argp, (unsigned long)argi, ret, ret);
BIO_dump(out, argp, (int)ret);
return (ret);
return ret;
} else if (cmd == (BIO_CB_WRITE | BIO_CB_RETURN)) {
BIO_printf(out, "write to %p [%p] (%lu bytes => %ld (0x%lX))\n",
(void *)bio, (void *)argp, (unsigned long)argi, ret, ret);
BIO_dump(out, argp, (int)ret);
}
return (ret);
return ret;
}
void apps_ssl_info_callback(const SSL *s, int where, int ret)

View File

@ -3053,7 +3053,7 @@ int s_client_main(int argc, char **argv)
bio_c_out = NULL;
BIO_free(bio_c_msg);
bio_c_msg = NULL;
return (ret);
return ret;
}
static void print_stuff(BIO *bio, SSL *s, int full)

View File

@ -255,7 +255,7 @@ static int ssl_srp_server_param_cb(SSL *s, int *ad, void *arg)
if (p->login == NULL && p->user == NULL) {
p->login = SSL_get_srp_username(s);
BIO_printf(bio_err, "SRP username = \"%s\"\n", p->login);
return (-1);
return -1;
}
if (p->user == NULL) {
@ -355,9 +355,9 @@ static int ebcdic_read(BIO *b, char *out, int outl)
BIO *next = BIO_next(b);
if (out == NULL || outl == 0)
return (0);
return 0;
if (next == NULL)
return (0);
return 0;
ret = BIO_read(next, out, outl);
if (ret > 0)
@ -373,7 +373,7 @@ static int ebcdic_write(BIO *b, const char *in, int inl)
int num;
if ((in == NULL) || (inl <= 0))
return (0);
return 0;
if (next == NULL)
return 0;
@ -396,7 +396,7 @@ static int ebcdic_write(BIO *b, const char *in, int inl)
ret = BIO_write(next, wbuf->buff, inl);
return (ret);
return ret;
}
static long ebcdic_ctrl(BIO *b, int cmd, long num, void *ptr)
@ -405,7 +405,7 @@ static long ebcdic_ctrl(BIO *b, int cmd, long num, void *ptr)
BIO *next = BIO_next(b);
if (next == NULL)
return (0);
return 0;
switch (cmd) {
case BIO_CTRL_DUP:
ret = 0L;
@ -414,7 +414,7 @@ static long ebcdic_ctrl(BIO *b, int cmd, long num, void *ptr)
ret = BIO_ctrl(next, cmd, num, ptr);
break;
}
return (ret);
return ret;
}
static int ebcdic_gets(BIO *bp, char *buf, int size)
@ -2140,7 +2140,7 @@ int s_server_main(int argc, char *argv[])
#ifdef CHARSET_EBCDIC
BIO_meth_free(methods_ebcdic);
#endif
return (ret);
return ret;
}
static void print_stats(BIO *bio, SSL_CTX *ssl_ctx)
@ -2657,7 +2657,7 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
if (ret >= 0)
BIO_printf(bio_s_out, "ACCEPT\n");
(void)BIO_flush(bio_s_out);
return (ret);
return ret;
}
static void close_accept_socket(void)
@ -2772,7 +2772,7 @@ static int init_ssl_connection(SSL *con)
}
/* Always print any error messages */
ERR_print_errors(bio_err);
return (0);
return 0;
}
print_connection_info(con);
@ -2875,7 +2875,7 @@ static DH *load_dh_param(const char *dhfile)
ret = PEM_read_bio_DHparams(bio, NULL, NULL, NULL);
err:
BIO_free(bio);
return (ret);
return ret;
}
#endif
@ -3263,7 +3263,7 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
BIO_printf(bio_s_out, "ACCEPT\n");
OPENSSL_free(buf);
BIO_free_all(io);
return (ret);
return ret;
}
static int rev_body(int s, int stype, int prot, unsigned char *context)
@ -3416,7 +3416,7 @@ static int rev_body(int s, int stype, int prot, unsigned char *context)
OPENSSL_free(buf);
BIO_free_all(io);
return (ret);
return ret;
}
#define MAX_SESSION_ID_ATTEMPTS 10

View File

@ -163,7 +163,7 @@ int sess_id_main(int argc, char **argv)
end:
BIO_free_all(out);
SSL_SESSION_free(x);
return (ret);
return ret;
}
static SSL_SESSION *load_sess_id(char *infile, int format)
@ -186,5 +186,5 @@ static SSL_SESSION *load_sess_id(char *infile, int format)
end:
BIO_free(in);
return (x);
return x;
}

View File

@ -609,7 +609,7 @@ int smime_main(int argc, char **argv)
BIO_free(indata);
BIO_free_all(out);
OPENSSL_free(passin);
return (ret);
return ret;
}
static int save_certs(char *signerfile, STACK_OF(X509) *signers)

View File

@ -2938,7 +2938,7 @@ int speed_main(int argc, char **argv)
}
OPENSSL_free(loopargs);
release_engine(e);
return (ret);
return ret;
}
static void print_message(const char *s, long num, int length)

View File

@ -197,5 +197,5 @@ int spkac_main(int argc, char **argv)
EVP_PKEY_free(pkey);
release_engine(e);
OPENSSL_free(passin);
return (ret);
return ret;
}

View File

@ -603,6 +603,6 @@ int srp_main(int argc, char **argv)
NCONF_free(conf);
free_index(db);
release_engine(e);
return (ret);
return ret;
}
#endif

View File

@ -320,7 +320,7 @@ int ts_main(int argc, char **argv)
X509_VERIFY_PARAM_free(vpm);
NCONF_free(conf);
OPENSSL_free(password);
return (ret);
return ret;
}
/*

View File

@ -313,5 +313,5 @@ static int cb(int ok, X509_STORE_CTX *ctx)
policies_print(ctx);
if (!v_verbose)
ERR_clear_error();
return (ok);
return ok;
}

View File

@ -188,5 +188,5 @@ opthelp:
}
ret = 0;
end:
return (ret);
return ret;
}

View File

@ -184,7 +184,7 @@ int TerminalSocket (int FunctionCode, int *ReturnSocket)
close (TerminalSocketPair[0]);
if (TerminalSocketPair[1])
close (TerminalSocketPair[1]);
return (TERM_SOCK_FAILURE);
return TERM_SOCK_FAILURE;
}
/*
@ -197,7 +197,7 @@ int TerminalSocket (int FunctionCode, int *ReturnSocket)
LogMessage ("TerminalSocket: SYS$ASSIGN () - %08X", status);
close (TerminalSocketPair[0]);
close (TerminalSocketPair[1]);
return (TERM_SOCK_FAILURE);
return TERM_SOCK_FAILURE;
}
/*
@ -216,7 +216,7 @@ int TerminalSocket (int FunctionCode, int *ReturnSocket)
LogMessage ("TerminalSocket: SYS$QIO () - %08X", status);
close (TerminalSocketPair[0]);
close (TerminalSocketPair[1]);
return (TERM_SOCK_FAILURE);
return TERM_SOCK_FAILURE;
}
/*
@ -234,7 +234,7 @@ int TerminalSocket (int FunctionCode, int *ReturnSocket)
LogMessage ("TerminalSocket: SYS$CANCEL () - %08X", status);
close (TerminalSocketPair[0]);
close (TerminalSocketPair[1]);
return (TERM_SOCK_FAILURE);
return TERM_SOCK_FAILURE;
}
/*
@ -245,7 +245,7 @@ int TerminalSocket (int FunctionCode, int *ReturnSocket)
LogMessage ("TerminalSocket: SYS$DASSGN () - %08X", status);
close (TerminalSocketPair[0]);
close (TerminalSocketPair[1]);
return (TERM_SOCK_FAILURE);
return TERM_SOCK_FAILURE;
}
/*
@ -265,14 +265,14 @@ int TerminalSocket (int FunctionCode, int *ReturnSocket)
** Invalid function code
*/
LogMessage ("TerminalSocket: Invalid Function Code - %d", FunctionCode);
return (TERM_SOCK_FAILURE);
return TERM_SOCK_FAILURE;
break;
}
/*
** Return success
*/
return (TERM_SOCK_SUCCESS);
return TERM_SOCK_SUCCESS;
}
@ -312,7 +312,7 @@ static int CreateSocketPair (int SocketFamily,
SockDesc1 = socket (SocketFamily, SocketType, 0);
if (SockDesc1 < 0) {
LogMessage ("CreateSocketPair: socket () - %d", errno);
return (-1);
return -1;
}
/*
@ -331,7 +331,7 @@ static int CreateSocketPair (int SocketFamily,
if (status < 0) {
LogMessage ("CreateSocketPair: bind () - %d", errno);
close (SockDesc1);
return (-1);
return -1;
}
/*
@ -341,7 +341,7 @@ static int CreateSocketPair (int SocketFamily,
if (status < 0) {
LogMessage ("CreateSocketPair: getsockname () - %d", errno);
close (SockDesc1);
return (-1);
return -1;
} else
LocalHostPort = sin.sin_port;
@ -360,7 +360,7 @@ static int CreateSocketPair (int SocketFamily,
if (! (status & 1)) {
LogMessage ("CreateSocketPair: SYS$BINTIM () - %08X", status);
close (SockDesc1);
return (-1);
return -1;
}
/*
@ -371,7 +371,7 @@ static int CreateSocketPair (int SocketFamily,
if (! (status & 1)) {
LogMessage ("CreateSocketPair: SYS$ASSIGN () - %08X", status);
close (SockDesc1);
return (-1);
return -1;
}
/*
@ -393,7 +393,7 @@ static int CreateSocketPair (int SocketFamily,
LogMessage ("CreateSocketPair: SYS$QIO () - %08X", status);
close (SockDesc1);
sys$dassgn (TcpDeviceChan);
return (-1);
return -1;
}
/*
@ -429,7 +429,7 @@ static int CreateSocketPair (int SocketFamily,
close (SockDesc1);
close (SockDesc2);
sys$dassgn (TcpDeviceChan);
return (-1);
return -1;
}
/*
@ -448,7 +448,7 @@ static int CreateSocketPair (int SocketFamily,
close (SockDesc1);
close (SockDesc2);
sys$dassgn (TcpDeviceChan);
return (-1);
return -1;
}
/*
@ -468,7 +468,7 @@ static int CreateSocketPair (int SocketFamily,
close (SockDesc1);
close (SockDesc2);
sys$dassgn (TcpDeviceChan);
return (-1);
return -1;
}
/*

View File

@ -61,7 +61,7 @@ int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
ret = 1 + len;
if (pp == NULL)
return (ret);
return ret;
p = *pp;
@ -73,7 +73,7 @@ int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
p[-1] &= (0xff << bits);
}
*pp = p;
return (ret);
return ret;
}
ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
@ -96,7 +96,7 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
if ((a == NULL) || ((*a) == NULL)) {
if ((ret = ASN1_BIT_STRING_new()) == NULL)
return (NULL);
return NULL;
} else
ret = (*a);
@ -132,12 +132,12 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
if (a != NULL)
(*a) = ret;
*pp = p;
return (ret);
return ret;
err:
ASN1err(ASN1_F_C2I_ASN1_BIT_STRING, i);
if ((a == NULL) || (*a != ret))
ASN1_BIT_STRING_free(ret);
return (NULL);
return NULL;
}
/*
@ -161,7 +161,7 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
if ((a->length < (w + 1)) || (a->data == NULL)) {
if (!value)
return (1); /* Don't need to set */
return 1; /* Don't need to set */
c = OPENSSL_clear_realloc(a->data, a->length, w + 1);
if (c == NULL) {
ASN1err(ASN1_F_ASN1_BIT_STRING_SET_BIT, ERR_R_MALLOC_FAILURE);

View File

@ -25,12 +25,12 @@ void *ASN1_d2i_fp(void *(*xnew) (void), d2i_of_void *d2i, FILE *in, void **x)
if ((b = BIO_new(BIO_s_file())) == NULL) {
ASN1err(ASN1_F_ASN1_D2I_FP, ERR_R_BUF_LIB);
return (NULL);
return NULL;
}
BIO_set_fp(b, in, BIO_NOCLOSE);
ret = ASN1_d2i_bio(xnew, d2i, b, x);
BIO_free(b);
return (ret);
return ret;
}
# endif
@ -49,7 +49,7 @@ void *ASN1_d2i_bio(void *(*xnew) (void), d2i_of_void *d2i, BIO *in, void **x)
ret = d2i(x, &p, len);
err:
BUF_MEM_free(b);
return (ret);
return ret;
}
#endif
@ -69,7 +69,7 @@ void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x)
ret = ASN1_item_d2i(x, &p, len, it);
err:
BUF_MEM_free(b);
return (ret);
return ret;
}
#ifndef OPENSSL_NO_STDIO
@ -80,12 +80,12 @@ void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x)
if ((b = BIO_new(BIO_s_file())) == NULL) {
ASN1err(ASN1_F_ASN1_ITEM_D2I_FP, ERR_R_BUF_LIB);
return (NULL);
return NULL;
}
BIO_set_fp(b, in, BIO_NOCLOSE);
ret = ASN1_item_d2i_bio(it, b, x);
BIO_free(b);
return (ret);
return ret;
}
#endif

View File

@ -29,7 +29,7 @@ int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data,
i = i2d(data, NULL);
if ((str = OPENSSL_malloc(i)) == NULL) {
ASN1err(ASN1_F_ASN1_DIGEST, ERR_R_MALLOC_FAILURE);
return (0);
return 0;
}
p = str;
i2d(data, &p);
@ -52,7 +52,7 @@ int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *asn,
i = ASN1_item_i2d(asn, &str, it);
if (!str)
return (0);
return 0;
if (!EVP_Digest(str, i, md, len, type, NULL)) {
OPENSSL_free(str);

View File

@ -21,20 +21,20 @@ void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x)
char *ret;
if (x == NULL)
return (NULL);
return NULL;
i = i2d(x, NULL);
b = OPENSSL_malloc(i + 10);
if (b == NULL) {
ASN1err(ASN1_F_ASN1_DUP, ERR_R_MALLOC_FAILURE);
return (NULL);
return NULL;
}
p = b;
i = i2d(x, &p);
p2 = b;
ret = d2i(NULL, &p2, i);
OPENSSL_free(b);
return (ret);
return ret;
}
#endif
@ -54,15 +54,15 @@ void *ASN1_item_dup(const ASN1_ITEM *it, void *x)
void *ret;
if (x == NULL)
return (NULL);
return NULL;
i = ASN1_item_i2d(x, &b, it);
if (b == NULL) {
ASN1err(ASN1_F_ASN1_ITEM_DUP, ERR_R_MALLOC_FAILURE);
return (NULL);
return NULL;
}
p = b;
ret = ASN1_item_d2i(NULL, &p, i, it);
OPENSSL_free(b);
return (ret);
return ret;
}

View File

@ -22,12 +22,12 @@ int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x)
if ((b = BIO_new(BIO_s_file())) == NULL) {
ASN1err(ASN1_F_ASN1_I2D_FP, ERR_R_BUF_LIB);
return (0);
return 0;
}
BIO_set_fp(b, out, BIO_NOCLOSE);
ret = ASN1_i2d_bio(i2d, b, x);
BIO_free(b);
return (ret);
return ret;
}
# endif
@ -41,7 +41,7 @@ int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x)
b = OPENSSL_malloc(n);
if (b == NULL) {
ASN1err(ASN1_F_ASN1_I2D_BIO, ERR_R_MALLOC_FAILURE);
return (0);
return 0;
}
p = (unsigned char *)b;
@ -59,7 +59,7 @@ int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x)
n -= i;
}
OPENSSL_free(b);
return (ret);
return ret;
}
#endif
@ -72,12 +72,12 @@ int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x)
if ((b = BIO_new(BIO_s_file())) == NULL) {
ASN1err(ASN1_F_ASN1_ITEM_I2D_FP, ERR_R_BUF_LIB);
return (0);
return 0;
}
BIO_set_fp(b, out, BIO_NOCLOSE);
ret = ASN1_item_i2d_bio(it, b, x);
BIO_free(b);
return (ret);
return ret;
}
#endif
@ -89,7 +89,7 @@ int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x)
n = ASN1_item_i2d(x, &b, it);
if (b == NULL) {
ASN1err(ASN1_F_ASN1_ITEM_I2D_BIO, ERR_R_MALLOC_FAILURE);
return (0);
return 0;
}
for (;;) {
@ -104,5 +104,5 @@ int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x)
n -= i;
}
OPENSSL_free(b);
return (ret);
return ret;
}

View File

@ -396,7 +396,7 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
if ((a == NULL) || ((*a) == NULL)) {
if ((ret = ASN1_INTEGER_new()) == NULL)
return (NULL);
return NULL;
ret->type = V_ASN1_INTEGER;
} else
ret = (*a);
@ -438,12 +438,12 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
if (a != NULL)
(*a) = ret;
*pp = p;
return (ret);
return ret;
err:
ASN1err(ASN1_F_D2I_ASN1_UINTEGER, i);
if ((a == NULL) || (*a != ret))
ASN1_INTEGER_free(ret);
return (NULL);
return NULL;
}
static ASN1_STRING *bn_to_asn1_string(const BIGNUM *bn, ASN1_STRING *ai,
@ -487,7 +487,7 @@ static ASN1_STRING *bn_to_asn1_string(const BIGNUM *bn, ASN1_STRING *ai,
err:
if (ret != ai)
ASN1_INTEGER_free(ret);
return (NULL);
return NULL;
}
static BIGNUM *asn1_string_to_bn(const ASN1_INTEGER *ai, BIGNUM *bn,

View File

@ -24,7 +24,7 @@ int i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp)
int objsize;
if ((a == NULL) || (a->data == NULL))
return (0);
return 0;
objsize = ASN1_object_size(0, a->length, V_ASN1_OBJECT);
if (pp == NULL || objsize == -1)
@ -36,7 +36,7 @@ int i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp)
p += a->length;
*pp = p;
return (objsize);
return objsize;
}
int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)
@ -49,7 +49,7 @@ int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)
BIGNUM *bl = NULL;
if (num == 0)
return (0);
return 0;
else if (num == -1)
num = strlen(buf);
@ -158,12 +158,12 @@ int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)
if (tmp != ftmp)
OPENSSL_free(tmp);
BN_free(bl);
return (len);
return len;
err:
if (tmp != ftmp)
OPENSSL_free(tmp);
BN_free(bl);
return (0);
return 0;
}
int i2t_ASN1_OBJECT(char *buf, int buf_len, const ASN1_OBJECT *a)
@ -177,7 +177,7 @@ int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a)
int i;
if ((a == NULL) || (a->data == NULL))
return (BIO_write(bp, "NULL", 4));
return BIO_write(bp, "NULL", 4);
i = i2t_ASN1_OBJECT(buf, sizeof buf, a);
if (i > (int)(sizeof(buf) - 1)) {
p = OPENSSL_malloc(i + 1);
@ -193,7 +193,7 @@ int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a)
BIO_write(bp, p, i);
if (p != buf)
OPENSSL_free(p);
return (i);
return i;
}
ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
@ -221,7 +221,7 @@ ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
return ret;
err:
ASN1err(ASN1_F_D2I_ASN1_OBJECT, i);
return (NULL);
return NULL;
}
ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
@ -281,7 +281,7 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
if ((a == NULL) || ((*a) == NULL) ||
!((*a)->flags & ASN1_OBJECT_FLAG_DYNAMIC)) {
if ((ret = ASN1_OBJECT_new()) == NULL)
return (NULL);
return NULL;
} else
ret = (*a);
@ -312,12 +312,12 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
if (a != NULL)
(*a) = ret;
*pp = p;
return (ret);
return ret;
err:
ASN1err(ASN1_F_C2I_ASN1_OBJECT, i);
if ((a == NULL) || (*a != ret))
ASN1_OBJECT_free(ret);
return (NULL);
return NULL;
}
ASN1_OBJECT *ASN1_OBJECT_new(void)
@ -327,10 +327,10 @@ ASN1_OBJECT *ASN1_OBJECT_new(void)
ret = OPENSSL_zalloc(sizeof(*ret));
if (ret == NULL) {
ASN1err(ASN1_F_ASN1_OBJECT_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
return NULL;
}
ret->flags = ASN1_OBJECT_FLAG_DYNAMIC;
return (ret);
return ret;
}
void ASN1_OBJECT_free(ASN1_OBJECT *a)
@ -367,5 +367,5 @@ ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len,
o.length = len;
o.flags = ASN1_OBJECT_FLAG_DYNAMIC | ASN1_OBJECT_FLAG_DYNAMIC_STRINGS |
ASN1_OBJECT_FLAG_DYNAMIC_DATA;
return (OBJ_dup(&o));
return OBJ_dup(&o);
}

View File

@ -21,7 +21,7 @@ int ASN1_PRINTABLE_type(const unsigned char *s, int len)
if (len <= 0)
len = -1;
if (s == NULL)
return (V_ASN1_PRINTABLESTRING);
return V_ASN1_PRINTABLESTRING;
while ((*s) && (len-- != 0)) {
c = *(s++);
@ -31,10 +31,10 @@ int ASN1_PRINTABLE_type(const unsigned char *s, int len)
t61 = 1;
}
if (t61)
return (V_ASN1_T61STRING);
return V_ASN1_T61STRING;
if (ia5)
return (V_ASN1_IA5STRING);
return (V_ASN1_PRINTABLESTRING);
return V_ASN1_IA5STRING;
return V_ASN1_PRINTABLESTRING;
}
int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s)
@ -43,9 +43,9 @@ int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s)
unsigned char *p;
if (s->type != V_ASN1_UNIVERSALSTRING)
return (0);
return 0;
if ((s->length % 4) != 0)
return (0);
return 0;
p = s->data;
for (i = 0; i < s->length; i += 4) {
if ((p[0] != '\0') || (p[1] != '\0') || (p[2] != '\0'))
@ -54,7 +54,7 @@ int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s)
p += 4;
}
if (i < s->length)
return (0);
return 0;
p = s->data;
for (i = 3; i < s->length; i += 4) {
*(p++) = s->data[i];
@ -72,7 +72,7 @@ int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v)
const char *p;
if (v == NULL)
return (0);
return 0;
n = 0;
p = (const char *)v->data;
for (i = 0; i < v->length; i++) {
@ -84,12 +84,12 @@ int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v)
n++;
if (n >= 80) {
if (BIO_write(bp, buf, n) <= 0)
return (0);
return 0;
n = 0;
}
}
if (n > 0)
if (BIO_write(bp, buf, n) <= 0)
return (0);
return 0;
return 1;
}

View File

@ -103,7 +103,7 @@ int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1, X509_ALGOR *algor2,
EVP_MD_CTX_free(ctx);
OPENSSL_clear_free((char *)buf_in, (unsigned int)inl);
OPENSSL_clear_free((char *)buf_out, outll);
return (outl);
return outl;
}
#endif
@ -225,5 +225,5 @@ int ASN1_item_sign_ctx(const ASN1_ITEM *it,
err:
OPENSSL_clear_free((char *)buf_in, (unsigned int)inl);
OPENSSL_clear_free((char *)buf_out, outll);
return (outl);
return outl;
}

View File

@ -16,9 +16,9 @@
int ASN1_TYPE_get(const ASN1_TYPE *a)
{
if ((a->value.ptr != NULL) || (a->type == V_ASN1_NULL))
return (a->type);
return a->type;
else
return (0);
return 0;
}
void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value)

View File

@ -76,7 +76,7 @@ int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *a, ASN1_BIT_STRING *signature,
ret = 1;
err:
EVP_MD_CTX_free(ctx);
return (ret);
return ret;
}
#endif

View File

@ -859,7 +859,7 @@ static int mime_hdr_cmp(const MIME_HEADER *const *a,
if (!(*a)->name || !(*b)->name)
return ! !(*a)->name - ! !(*b)->name;
return (strcmp((*a)->name, (*b)->name));
return strcmp((*a)->name, (*b)->name);
}
static int mime_param_cmp(const MIME_PARAM *const *a,
@ -867,7 +867,7 @@ static int mime_param_cmp(const MIME_PARAM *const *a,
{
if (!(*a)->param_name || !(*b)->param_name)
return ! !(*a)->param_name - ! !(*b)->param_name;
return (strcmp((*a)->param_name, (*b)->param_name));
return strcmp((*a)->param_name, (*b)->param_name);
}
/* Find a header with a given name (if possible) */

View File

@ -95,7 +95,7 @@ static const BIO_METHOD methods_asn1 = {
const BIO_METHOD *BIO_f_asn1(void)
{
return (&methods_asn1);
return &methods_asn1;
}
static int asn1_bio_new(BIO *b)

View File

@ -27,7 +27,7 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
if ((a == NULL) || (*a == NULL)) {
if ((ret = EVP_PKEY_new()) == NULL) {
ASN1err(ASN1_F_D2I_PRIVATEKEY, ERR_R_EVP_LIB);
return (NULL);
return NULL;
}
} else {
ret = *a;
@ -64,11 +64,11 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
*pp = p;
if (a != NULL)
(*a) = ret;
return (ret);
return ret;
err:
if (a == NULL || *a != ret)
EVP_PKEY_free(ret);
return (NULL);
return NULL;
}
/*

View File

@ -27,7 +27,7 @@ EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp,
if ((a == NULL) || (*a == NULL)) {
if ((ret = EVP_PKEY_new()) == NULL) {
ASN1err(ASN1_F_D2I_PUBLICKEY, ERR_R_EVP_LIB);
return (NULL);
return NULL;
}
} else
ret = *a;
@ -69,9 +69,9 @@ EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp,
}
if (a != NULL)
(*a) = ret;
return (ret);
return ret;
err:
if (a == NULL || *a != ret)
EVP_PKEY_free(ret);
return (NULL);
return NULL;
}

View File

@ -17,7 +17,7 @@ int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len)
ASN1_STRING *os;
if ((os = ASN1_OCTET_STRING_new()) == NULL)
return (0);
return 0;
if (!ASN1_OCTET_STRING_set(os, data, len)) {
ASN1_OCTET_STRING_free(os);
return 0;
@ -34,7 +34,7 @@ int ASN1_TYPE_get_octetstring(const ASN1_TYPE *a, unsigned char *data, int max_l
if ((a->type != V_ASN1_OCTET_STRING) || (a->value.octet_string == NULL)) {
ASN1err(ASN1_F_ASN1_TYPE_GET_OCTETSTRING, ASN1_R_DATA_IS_WRONG);
return (-1);
return -1;
}
p = ASN1_STRING_get0_data(a->value.octet_string);
ret = ASN1_STRING_length(a->value.octet_string);
@ -43,7 +43,7 @@ int ASN1_TYPE_get_octetstring(const ASN1_TYPE *a, unsigned char *data, int max_l
else
num = max_len;
memcpy(data, p, num);
return (ret);
return ret;
}
typedef struct {

View File

@ -20,7 +20,7 @@ int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a)
char buf[2];
if (a == NULL)
return (0);
return 0;
if (a->type & V_ASN1_NEG) {
if (BIO_write(bp, "-", 1) != 1)
@ -46,9 +46,9 @@ int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a)
n += 2;
}
}
return (n);
return n;
err:
return (-1);
return -1;
}
int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)

View File

@ -20,7 +20,7 @@ int i2a_ASN1_STRING(BIO *bp, const ASN1_STRING *a, int type)
char buf[2];
if (a == NULL)
return (0);
return 0;
if (a->length == 0) {
if (BIO_write(bp, "0", 1) != 1)
@ -40,9 +40,9 @@ int i2a_ASN1_STRING(BIO *bp, const ASN1_STRING *a, int type)
n += 2;
}
}
return (n);
return n;
err:
return (-1);
return -1;
}
int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)

View File

@ -19,7 +19,7 @@
const char *BF_options(void)
{
return ("blowfish(ptr)");
return "blowfish(ptr)";
}
void BF_ecb_encrypt(const unsigned char *in, unsigned char *out,

View File

@ -859,7 +859,7 @@ int BIO_printf(BIO *bio, const char *format, ...)
ret = BIO_vprintf(bio, format, args);
va_end(args);
return (ret);
return ret;
}
int BIO_vprintf(BIO *bio, const char *format, va_list args)
@ -886,7 +886,7 @@ int BIO_vprintf(BIO *bio, const char *format, va_list args)
} else {
ret = BIO_write(bio, hugebuf, (int)retlen);
}
return (ret);
return ret;
}
/*
@ -905,7 +905,7 @@ int BIO_snprintf(char *buf, size_t n, const char *format, ...)
ret = BIO_vsnprintf(buf, n, format, args);
va_end(args);
return (ret);
return ret;
}
int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)

View File

@ -66,7 +66,7 @@ int BIO_get_port(const char *str, unsigned short *port_ptr)
if (str == NULL) {
BIOerr(BIO_F_BIO_GET_PORT, BIO_R_NO_PORT_DEFINED);
return (0);
return 0;
}
if (BIO_sock_init() != 1)
@ -102,9 +102,9 @@ int BIO_sock_error(int sock)
*/
i = getsockopt(sock, SOL_SOCKET, SO_ERROR, (void *)&j, &size);
if (i < 0)
return (get_last_socket_error());
return get_last_socket_error();
else
return (j);
return j;
}
# if OPENSSL_API_COMPAT < 0x10100000L
@ -142,7 +142,7 @@ int BIO_sock_init(void)
err = WSAGetLastError();
SYSerr(SYS_F_WSASTARTUP, err);
BIOerr(BIO_F_BIO_SOCK_INIT, BIO_R_WSASTARTUP);
return (-1);
return -1;
}
}
# endif /* OPENSSL_SYS_WINDOWS */
@ -150,7 +150,7 @@ int BIO_sock_init(void)
extern int _watt_do_exit;
_watt_do_exit = 0; /* don't make sock_init() call exit() */
if (sock_init())
return (-1);
return -1;
# endif
return 1;
@ -201,7 +201,7 @@ int BIO_socket_ioctl(int fd, long type, void *arg)
# endif /* __DJGPP__ */
if (i < 0)
SYSerr(SYS_F_IOCTLSOCKET, get_last_socket_error());
return (i);
return i;
}
# if OPENSSL_API_COMPAT < 0x10100000L

View File

@ -41,7 +41,7 @@ static const BIO_METHOD methods_buffer = {
const BIO_METHOD *BIO_f_buffer(void)
{
return (&methods_buffer);
return &methods_buffer;
}
static int buffer_new(BIO *bi)
@ -49,19 +49,19 @@ static int buffer_new(BIO *bi)
BIO_F_BUFFER_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
if (ctx == NULL)
return (0);
return 0;
ctx->ibuf_size = DEFAULT_BUFFER_SIZE;
ctx->ibuf = OPENSSL_malloc(DEFAULT_BUFFER_SIZE);
if (ctx->ibuf == NULL) {
OPENSSL_free(ctx);
return (0);
return 0;
}
ctx->obuf_size = DEFAULT_BUFFER_SIZE;
ctx->obuf = OPENSSL_malloc(DEFAULT_BUFFER_SIZE);
if (ctx->obuf == NULL) {
OPENSSL_free(ctx->ibuf);
OPENSSL_free(ctx);
return (0);
return 0;
}
bi->init = 1;
@ -75,7 +75,7 @@ static int buffer_free(BIO *a)
BIO_F_BUFFER_CTX *b;
if (a == NULL)
return (0);
return 0;
b = (BIO_F_BUFFER_CTX *)a->ptr;
OPENSSL_free(b->ibuf);
OPENSSL_free(b->obuf);
@ -92,11 +92,11 @@ static int buffer_read(BIO *b, char *out, int outl)
BIO_F_BUFFER_CTX *ctx;
if (out == NULL)
return (0);
return 0;
ctx = (BIO_F_BUFFER_CTX *)b->ptr;
if ((ctx == NULL) || (b->next_bio == NULL))
return (0);
return 0;
num = 0;
BIO_clear_retry_flags(b);
@ -111,7 +111,7 @@ static int buffer_read(BIO *b, char *out, int outl)
ctx->ibuf_len -= i;
num += i;
if (outl == i)
return (num);
return num;
outl -= i;
out += i;
}
@ -130,11 +130,11 @@ static int buffer_read(BIO *b, char *out, int outl)
if (i < 0)
return ((num > 0) ? num : i);
if (i == 0)
return (num);
return num;
}
num += i;
if (outl == i)
return (num);
return num;
out += i;
outl -= i;
}
@ -148,7 +148,7 @@ static int buffer_read(BIO *b, char *out, int outl)
if (i < 0)
return ((num > 0) ? num : i);
if (i == 0)
return (num);
return num;
}
ctx->ibuf_off = 0;
ctx->ibuf_len = i;
@ -163,10 +163,10 @@ static int buffer_write(BIO *b, const char *in, int inl)
BIO_F_BUFFER_CTX *ctx;
if ((in == NULL) || (inl <= 0))
return (0);
return 0;
ctx = (BIO_F_BUFFER_CTX *)b->ptr;
if ((ctx == NULL) || (b->next_bio == NULL))
return (0);
return 0;
BIO_clear_retry_flags(b);
start:
@ -197,7 +197,7 @@ static int buffer_write(BIO *b, const char *in, int inl)
if (i < 0)
return ((num > 0) ? num : i);
if (i == 0)
return (num);
return num;
}
ctx->obuf_off += i;
ctx->obuf_len -= i;
@ -219,13 +219,13 @@ static int buffer_write(BIO *b, const char *in, int inl)
if (i < 0)
return ((num > 0) ? num : i);
if (i == 0)
return (num);
return num;
}
num += i;
in += i;
inl -= i;
if (inl == 0)
return (num);
return num;
}
/*
@ -252,7 +252,7 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr)
ctx->obuf_off = 0;
ctx->obuf_len = 0;
if (b->next_bio == NULL)
return (0);
return 0;
ret = BIO_ctrl(b->next_bio, cmd, num, ptr);
break;
case BIO_CTRL_EOF:
@ -275,7 +275,7 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr)
ret = (long)ctx->obuf_len;
if (ret == 0) {
if (b->next_bio == NULL)
return (0);
return 0;
ret = BIO_ctrl(b->next_bio, cmd, num, ptr);
}
break;
@ -283,7 +283,7 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr)
ret = (long)ctx->ibuf_len;
if (ret == 0) {
if (b->next_bio == NULL)
return (0);
return 0;
ret = BIO_ctrl(b->next_bio, cmd, num, ptr);
}
break;
@ -347,7 +347,7 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr)
break;
case BIO_C_DO_STATE_MACHINE:
if (b->next_bio == NULL)
return (0);
return 0;
BIO_clear_retry_flags(b);
ret = BIO_ctrl(b->next_bio, cmd, num, ptr);
BIO_copy_next_retry(b);
@ -355,7 +355,7 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr)
case BIO_CTRL_FLUSH:
if (b->next_bio == NULL)
return (0);
return 0;
if (ctx->obuf_len <= 0) {
ret = BIO_ctrl(b->next_bio, cmd, num, ptr);
break;
@ -368,7 +368,7 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr)
&(ctx->obuf[ctx->obuf_off]), ctx->obuf_len);
BIO_copy_next_retry(b);
if (r <= 0)
return ((long)r);
return (long)r;
ctx->obuf_off += r;
ctx->obuf_len -= r;
} else {
@ -398,14 +398,14 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr)
break;
default:
if (b->next_bio == NULL)
return (0);
return 0;
ret = BIO_ctrl(b->next_bio, cmd, num, ptr);
break;
}
return (ret);
return ret;
malloc_error:
BIOerr(BIO_F_BUFFER_CTRL, ERR_R_MALLOC_FAILURE);
return (0);
return 0;
}
static long buffer_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
@ -413,13 +413,13 @@ static long buffer_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
long ret = 1;
if (b->next_bio == NULL)
return (0);
return 0;
switch (cmd) {
default:
ret = BIO_callback_ctrl(b->next_bio, cmd, fp);
break;
}
return (ret);
return ret;
}
static int buffer_gets(BIO *b, char *buf, int size)
@ -450,7 +450,7 @@ static int buffer_gets(BIO *b, char *buf, int size)
ctx->ibuf_off += i;
if (flag || size == 0) {
*buf = '\0';
return (num);
return num;
}
} else { /* read another chunk */
@ -461,7 +461,7 @@ static int buffer_gets(BIO *b, char *buf, int size)
if (i < 0)
return ((num > 0) ? num : i);
if (i == 0)
return (num);
return num;
}
ctx->ibuf_len = i;
ctx->ibuf_off = 0;
@ -471,5 +471,5 @@ static int buffer_gets(BIO *b, char *buf, int size)
static int buffer_puts(BIO *b, const char *str)
{
return (buffer_write(b, str, strlen(str)));
return buffer_write(b, str, strlen(str));
}

View File

@ -46,7 +46,7 @@ static const BIO_METHOD methods_linebuffer = {
const BIO_METHOD *BIO_f_linebuffer(void)
{
return (&methods_linebuffer);
return &methods_linebuffer;
}
typedef struct bio_linebuffer_ctx_struct {
@ -61,11 +61,11 @@ static int linebuffer_new(BIO *bi)
ctx = OPENSSL_malloc(sizeof(*ctx));
if (ctx == NULL)
return (0);
return 0;
ctx->obuf = OPENSSL_malloc(DEFAULT_LINEBUFFER_SIZE);
if (ctx->obuf == NULL) {
OPENSSL_free(ctx);
return (0);
return 0;
}
ctx->obuf_size = DEFAULT_LINEBUFFER_SIZE;
ctx->obuf_len = 0;
@ -81,7 +81,7 @@ static int linebuffer_free(BIO *a)
BIO_LINEBUFFER_CTX *b;
if (a == NULL)
return (0);
return 0;
b = (BIO_LINEBUFFER_CTX *)a->ptr;
OPENSSL_free(b->obuf);
OPENSSL_free(a->ptr);
@ -96,13 +96,13 @@ static int linebuffer_read(BIO *b, char *out, int outl)
int ret = 0;
if (out == NULL)
return (0);
return 0;
if (b->next_bio == NULL)
return (0);
return 0;
ret = BIO_read(b->next_bio, out, outl);
BIO_clear_retry_flags(b);
BIO_copy_next_retry(b);
return (ret);
return ret;
}
static int linebuffer_write(BIO *b, const char *in, int inl)
@ -111,10 +111,10 @@ static int linebuffer_write(BIO *b, const char *in, int inl)
BIO_LINEBUFFER_CTX *ctx;
if ((in == NULL) || (inl <= 0))
return (0);
return 0;
ctx = (BIO_LINEBUFFER_CTX *)b->ptr;
if ((ctx == NULL) || (b->next_bio == NULL))
return (0);
return 0;
BIO_clear_retry_flags(b);
@ -160,7 +160,7 @@ static int linebuffer_write(BIO *b, const char *in, int inl)
if (i < 0)
return ((num > 0) ? num : i);
if (i == 0)
return (num);
return num;
}
if (i < ctx->obuf_len)
memmove(ctx->obuf, ctx->obuf + i, ctx->obuf_len - i);
@ -178,7 +178,7 @@ static int linebuffer_write(BIO *b, const char *in, int inl)
if (i < 0)
return ((num > 0) ? num : i);
if (i == 0)
return (num);
return num;
}
num += i;
in += i;
@ -214,7 +214,7 @@ static long linebuffer_ctrl(BIO *b, int cmd, long num, void *ptr)
case BIO_CTRL_RESET:
ctx->obuf_len = 0;
if (b->next_bio == NULL)
return (0);
return 0;
ret = BIO_ctrl(b->next_bio, cmd, num, ptr);
break;
case BIO_CTRL_INFO:
@ -224,7 +224,7 @@ static long linebuffer_ctrl(BIO *b, int cmd, long num, void *ptr)
ret = (long)ctx->obuf_len;
if (ret == 0) {
if (b->next_bio == NULL)
return (0);
return 0;
ret = BIO_ctrl(b->next_bio, cmd, num, ptr);
}
break;
@ -248,7 +248,7 @@ static long linebuffer_ctrl(BIO *b, int cmd, long num, void *ptr)
break;
case BIO_C_DO_STATE_MACHINE:
if (b->next_bio == NULL)
return (0);
return 0;
BIO_clear_retry_flags(b);
ret = BIO_ctrl(b->next_bio, cmd, num, ptr);
BIO_copy_next_retry(b);
@ -256,7 +256,7 @@ static long linebuffer_ctrl(BIO *b, int cmd, long num, void *ptr)
case BIO_CTRL_FLUSH:
if (b->next_bio == NULL)
return (0);
return 0;
if (ctx->obuf_len <= 0) {
ret = BIO_ctrl(b->next_bio, cmd, num, ptr);
break;
@ -268,7 +268,7 @@ static long linebuffer_ctrl(BIO *b, int cmd, long num, void *ptr)
r = BIO_write(b->next_bio, ctx->obuf, ctx->obuf_len);
BIO_copy_next_retry(b);
if (r <= 0)
return ((long)r);
return (long)r;
if (r < ctx->obuf_len)
memmove(ctx->obuf, ctx->obuf + r, ctx->obuf_len - r);
ctx->obuf_len -= r;
@ -286,14 +286,14 @@ static long linebuffer_ctrl(BIO *b, int cmd, long num, void *ptr)
break;
default:
if (b->next_bio == NULL)
return (0);
return 0;
ret = BIO_ctrl(b->next_bio, cmd, num, ptr);
break;
}
return (ret);
return ret;
malloc_error:
BIOerr(BIO_F_LINEBUFFER_CTRL, ERR_R_MALLOC_FAILURE);
return (0);
return 0;
}
static long linebuffer_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
@ -301,23 +301,23 @@ static long linebuffer_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
long ret = 1;
if (b->next_bio == NULL)
return (0);
return 0;
switch (cmd) {
default:
ret = BIO_callback_ctrl(b->next_bio, cmd, fp);
break;
}
return (ret);
return ret;
}
static int linebuffer_gets(BIO *b, char *buf, int size)
{
if (b->next_bio == NULL)
return (0);
return (BIO_gets(b->next_bio, buf, size));
return 0;
return BIO_gets(b->next_bio, buf, size);
}
static int linebuffer_puts(BIO *b, const char *str)
{
return (linebuffer_write(b, str, strlen(str)));
return linebuffer_write(b, str, strlen(str));
}

View File

@ -50,7 +50,7 @@ static const BIO_METHOD methods_nbiof = {
const BIO_METHOD *BIO_f_nbio_test(void)
{
return (&methods_nbiof);
return &methods_nbiof;
}
static int nbiof_new(BIO *bi)
@ -58,7 +58,7 @@ static int nbiof_new(BIO *bi)
NBIO_TEST *nt;
if ((nt = OPENSSL_zalloc(sizeof(*nt))) == NULL)
return (0);
return 0;
nt->lrn = -1;
nt->lwn = -1;
bi->ptr = (char *)nt;
@ -69,7 +69,7 @@ static int nbiof_new(BIO *bi)
static int nbiof_free(BIO *a)
{
if (a == NULL)
return (0);
return 0;
OPENSSL_free(a->ptr);
a->ptr = NULL;
a->init = 0;
@ -84,9 +84,9 @@ static int nbiof_read(BIO *b, char *out, int outl)
unsigned char n;
if (out == NULL)
return (0);
return 0;
if (b->next_bio == NULL)
return (0);
return 0;
BIO_clear_retry_flags(b);
if (RAND_bytes(&n, 1) <= 0)
@ -104,7 +104,7 @@ static int nbiof_read(BIO *b, char *out, int outl)
if (ret < 0)
BIO_copy_next_retry(b);
}
return (ret);
return ret;
}
static int nbiof_write(BIO *b, const char *in, int inl)
@ -115,9 +115,9 @@ static int nbiof_write(BIO *b, const char *in, int inl)
unsigned char n;
if ((in == NULL) || (inl <= 0))
return (0);
return 0;
if (b->next_bio == NULL)
return (0);
return 0;
nt = (NBIO_TEST *)b->ptr;
BIO_clear_retry_flags(b);
@ -144,7 +144,7 @@ static int nbiof_write(BIO *b, const char *in, int inl)
nt->lwn = inl;
}
}
return (ret);
return ret;
}
static long nbiof_ctrl(BIO *b, int cmd, long num, void *ptr)
@ -152,7 +152,7 @@ static long nbiof_ctrl(BIO *b, int cmd, long num, void *ptr)
long ret;
if (b->next_bio == NULL)
return (0);
return 0;
switch (cmd) {
case BIO_C_DO_STATE_MACHINE:
BIO_clear_retry_flags(b);
@ -166,7 +166,7 @@ static long nbiof_ctrl(BIO *b, int cmd, long num, void *ptr)
ret = BIO_ctrl(b->next_bio, cmd, num, ptr);
break;
}
return (ret);
return ret;
}
static long nbiof_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
@ -174,25 +174,25 @@ static long nbiof_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
long ret = 1;
if (b->next_bio == NULL)
return (0);
return 0;
switch (cmd) {
default:
ret = BIO_callback_ctrl(b->next_bio, cmd, fp);
break;
}
return (ret);
return ret;
}
static int nbiof_gets(BIO *bp, char *buf, int size)
{
if (bp->next_bio == NULL)
return (0);
return (BIO_gets(bp->next_bio, buf, size));
return 0;
return BIO_gets(bp->next_bio, buf, size);
}
static int nbiof_puts(BIO *bp, const char *str)
{
if (bp->next_bio == NULL)
return (0);
return (BIO_puts(bp->next_bio, str));
return 0;
return BIO_puts(bp->next_bio, str);
}

View File

@ -43,7 +43,7 @@ static const BIO_METHOD methods_nullf = {
const BIO_METHOD *BIO_f_null(void)
{
return (&methods_nullf);
return &methods_nullf;
}
static int nullf_new(BIO *bi)
@ -57,7 +57,7 @@ static int nullf_new(BIO *bi)
static int nullf_free(BIO *a)
{
if (a == NULL)
return (0);
return 0;
/*-
a->ptr=NULL;
a->init=0;
@ -71,13 +71,13 @@ static int nullf_read(BIO *b, char *out, int outl)
int ret = 0;
if (out == NULL)
return (0);
return 0;
if (b->next_bio == NULL)
return (0);
return 0;
ret = BIO_read(b->next_bio, out, outl);
BIO_clear_retry_flags(b);
BIO_copy_next_retry(b);
return (ret);
return ret;
}
static int nullf_write(BIO *b, const char *in, int inl)
@ -85,13 +85,13 @@ static int nullf_write(BIO *b, const char *in, int inl)
int ret = 0;
if ((in == NULL) || (inl <= 0))
return (0);
return 0;
if (b->next_bio == NULL)
return (0);
return 0;
ret = BIO_write(b->next_bio, in, inl);
BIO_clear_retry_flags(b);
BIO_copy_next_retry(b);
return (ret);
return ret;
}
static long nullf_ctrl(BIO *b, int cmd, long num, void *ptr)
@ -99,7 +99,7 @@ static long nullf_ctrl(BIO *b, int cmd, long num, void *ptr)
long ret;
if (b->next_bio == NULL)
return (0);
return 0;
switch (cmd) {
case BIO_C_DO_STATE_MACHINE:
BIO_clear_retry_flags(b);
@ -112,7 +112,7 @@ static long nullf_ctrl(BIO *b, int cmd, long num, void *ptr)
default:
ret = BIO_ctrl(b->next_bio, cmd, num, ptr);
}
return (ret);
return ret;
}
static long nullf_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
@ -120,25 +120,25 @@ static long nullf_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
long ret = 1;
if (b->next_bio == NULL)
return (0);
return 0;
switch (cmd) {
default:
ret = BIO_callback_ctrl(b->next_bio, cmd, fp);
break;
}
return (ret);
return ret;
}
static int nullf_gets(BIO *bp, char *buf, int size)
{
if (bp->next_bio == NULL)
return (0);
return (BIO_gets(bp->next_bio, buf, size));
return 0;
return BIO_gets(bp->next_bio, buf, size);
}
static int nullf_puts(BIO *bp, const char *str)
{
if (bp->next_bio == NULL)
return (0);
return (BIO_puts(bp->next_bio, str));
return 0;
return BIO_puts(bp->next_bio, str);
}

View File

@ -75,7 +75,7 @@ BIO *BIO_new(const BIO_METHOD *method)
if (bio == NULL) {
BIOerr(BIO_F_BIO_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
return NULL;
}
bio->method = method;
@ -435,7 +435,7 @@ int BIO_gets(BIO *b, char *buf, int size)
if ((b == NULL) || (b->method == NULL) || (b->method->bgets == NULL)) {
BIOerr(BIO_F_BIO_GETS, BIO_R_UNSUPPORTED_METHOD);
return (-2);
return -2;
}
if (size < 0) {
@ -451,7 +451,7 @@ int BIO_gets(BIO *b, char *buf, int size)
if (!b->init) {
BIOerr(BIO_F_BIO_GETS, BIO_R_UNINITIALIZED);
return (-2);
return -2;
}
ret = b->method->bgets(b, buf, size);
@ -493,7 +493,7 @@ long BIO_int_ctrl(BIO *b, int cmd, long larg, int iarg)
int i;
i = iarg;
return (BIO_ctrl(b, cmd, larg, (char *)&i));
return BIO_ctrl(b, cmd, larg, (char *)&i);
}
void *BIO_ptr_ctrl(BIO *b, int cmd, long larg)
@ -501,9 +501,9 @@ void *BIO_ptr_ctrl(BIO *b, int cmd, long larg)
void *p = NULL;
if (BIO_ctrl(b, cmd, larg, (char *)&p) <= 0)
return (NULL);
return NULL;
else
return (p);
return p;
}
long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
@ -540,11 +540,11 @@ long BIO_callback_ctrl(BIO *b, int cmd,
long ret;
if (b == NULL)
return (0);
return 0;
if ((b->method == NULL) || (b->method->callback_ctrl == NULL)) {
BIOerr(BIO_F_BIO_CALLBACK_CTRL, BIO_R_UNSUPPORTED_METHOD);
return (-2);
return -2;
}
if (b->callback != NULL || b->callback_ex != NULL) {
@ -584,7 +584,7 @@ BIO *BIO_push(BIO *b, BIO *bio)
BIO *lb;
if (b == NULL)
return (bio);
return bio;
lb = b;
while (lb->next_bio != NULL)
lb = lb->next_bio;
@ -593,7 +593,7 @@ BIO *BIO_push(BIO *b, BIO *bio)
bio->prev_bio = lb;
/* called to do internal processing */
BIO_ctrl(b, BIO_CTRL_PUSH, 0, lb);
return (b);
return b;
}
/* Remove the first and return the rest */
@ -602,7 +602,7 @@ BIO *BIO_pop(BIO *b)
BIO *ret;
if (b == NULL)
return (NULL);
return NULL;
ret = b->next_bio;
BIO_ctrl(b, BIO_CTRL_POP, 0, b);
@ -614,7 +614,7 @@ BIO *BIO_pop(BIO *b)
b->next_bio = NULL;
b->prev_bio = NULL;
return (ret);
return ret;
}
BIO *BIO_get_retry_BIO(BIO *bio, int *reason)
@ -632,12 +632,12 @@ BIO *BIO_get_retry_BIO(BIO *bio, int *reason)
}
if (reason != NULL)
*reason = last->retry_reason;
return (last);
return last;
}
int BIO_get_retry_reason(BIO *bio)
{
return (bio->retry_reason);
return bio->retry_reason;
}
void BIO_set_retry_reason(BIO *bio, int reason)
@ -658,13 +658,13 @@ BIO *BIO_find_type(BIO *bio, int type)
if (!mask) {
if (mt & type)
return (bio);
return bio;
} else if (mt == type)
return (bio);
return bio;
}
bio = bio->next_bio;
} while (bio != NULL);
return (NULL);
return NULL;
}
BIO *BIO_next(BIO *b)
@ -732,11 +732,11 @@ BIO *BIO_dup_chain(BIO *in)
eoc = new_bio;
}
}
return (ret);
return ret;
err:
BIO_free_all(ret);
return (NULL);
return NULL;
}
void BIO_copy_next_retry(BIO *b)
@ -747,12 +747,12 @@ void BIO_copy_next_retry(BIO *b)
int BIO_set_ex_data(BIO *bio, int idx, void *data)
{
return (CRYPTO_set_ex_data(&(bio->ex_data), idx, data));
return CRYPTO_set_ex_data(&(bio->ex_data), idx, data);
}
void *BIO_get_ex_data(BIO *bio, int idx)
{
return (CRYPTO_get_ex_data(&(bio->ex_data), idx));
return CRYPTO_get_ex_data(&(bio->ex_data), idx);
}
uint64_t BIO_number_read(BIO *bio)

View File

@ -70,7 +70,7 @@ static const BIO_METHOD methods_acceptp = {
const BIO_METHOD *BIO_s_accept(void)
{
return (&methods_acceptp);
return &methods_acceptp;
}
static int acpt_new(BIO *bi)
@ -81,7 +81,7 @@ static int acpt_new(BIO *bi)
bi->num = (int)INVALID_SOCKET;
bi->flags = 0;
if ((ba = BIO_ACCEPT_new()) == NULL)
return (0);
return 0;
bi->ptr = (char *)ba;
ba->state = ACPT_S_BEFORE;
bi->shutdown = 1;
@ -93,10 +93,10 @@ static BIO_ACCEPT *BIO_ACCEPT_new(void)
BIO_ACCEPT *ret;
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
return (NULL);
return NULL;
ret->accept_family = BIO_FAMILY_IPANY;
ret->accept_sock = (int)INVALID_SOCKET;
return (ret);
return ret;
}
static void BIO_ACCEPT_free(BIO_ACCEPT *a)
@ -133,7 +133,7 @@ static int acpt_free(BIO *a)
BIO_ACCEPT *data;
if (a == NULL)
return (0);
return 0;
data = (BIO_ACCEPT *)a->ptr;
if (a->shutdown) {
@ -359,12 +359,12 @@ static int acpt_read(BIO *b, char *out, int outl)
while (b->next_bio == NULL) {
ret = acpt_state(b, data);
if (ret <= 0)
return (ret);
return ret;
}
ret = BIO_read(b->next_bio, out, outl);
BIO_copy_next_retry(b);
return (ret);
return ret;
}
static int acpt_write(BIO *b, const char *in, int inl)
@ -378,12 +378,12 @@ static int acpt_write(BIO *b, const char *in, int inl)
while (b->next_bio == NULL) {
ret = acpt_state(b, data);
if (ret <= 0)
return (ret);
return ret;
}
ret = BIO_write(b->next_bio, in, inl);
BIO_copy_next_retry(b);
return (ret);
return ret;
}
static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr)
@ -527,7 +527,7 @@ static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr)
ret = 0;
break;
}
return (ret);
return ret;
}
static int acpt_puts(BIO *bp, const char *str)
@ -536,7 +536,7 @@ static int acpt_puts(BIO *bp, const char *str)
n = strlen(str);
ret = acpt_write(bp, str, n);
return (ret);
return ret;
}
BIO *BIO_new_accept(const char *str)
@ -545,11 +545,11 @@ BIO *BIO_new_accept(const char *str)
ret = BIO_new(BIO_s_accept());
if (ret == NULL)
return (NULL);
return NULL;
if (BIO_set_accept_name(ret, str))
return (ret);
return ret;
BIO_free(ret);
return (NULL);
return NULL;
}
#endif

View File

@ -216,7 +216,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c)
if (cb != NULL)
ret = cb((BIO *)b, c->state, ret);
end:
return (ret);
return ret;
}
BIO_CONNECT *BIO_CONNECT_new(void)
@ -224,10 +224,10 @@ BIO_CONNECT *BIO_CONNECT_new(void)
BIO_CONNECT *ret;
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
return (NULL);
return NULL;
ret->state = BIO_CONN_S_BEFORE;
ret->connect_family = BIO_FAMILY_IPANY;
return (ret);
return ret;
}
void BIO_CONNECT_free(BIO_CONNECT *a)
@ -243,7 +243,7 @@ void BIO_CONNECT_free(BIO_CONNECT *a)
const BIO_METHOD *BIO_s_connect(void)
{
return (&methods_connectp);
return &methods_connectp;
}
static int conn_new(BIO *bi)
@ -252,7 +252,7 @@ static int conn_new(BIO *bi)
bi->num = (int)INVALID_SOCKET;
bi->flags = 0;
if ((bi->ptr = (char *)BIO_CONNECT_new()) == NULL)
return (0);
return 0;
else
return 1;
}
@ -276,7 +276,7 @@ static int conn_free(BIO *a)
BIO_CONNECT *data;
if (a == NULL)
return (0);
return 0;
data = (BIO_CONNECT *)a->ptr;
if (a->shutdown) {
@ -298,7 +298,7 @@ static int conn_read(BIO *b, char *out, int outl)
if (data->state != BIO_CONN_S_OK) {
ret = conn_state(b, data);
if (ret <= 0)
return (ret);
return ret;
}
if (out != NULL) {
@ -310,7 +310,7 @@ static int conn_read(BIO *b, char *out, int outl)
BIO_set_retry_read(b);
}
}
return (ret);
return ret;
}
static int conn_write(BIO *b, const char *in, int inl)
@ -322,7 +322,7 @@ static int conn_write(BIO *b, const char *in, int inl)
if (data->state != BIO_CONN_S_OK) {
ret = conn_state(b, data);
if (ret <= 0)
return (ret);
return ret;
}
clear_socket_error();
@ -332,7 +332,7 @@ static int conn_write(BIO *b, const char *in, int inl)
if (BIO_sock_should_retry(ret))
BIO_set_retry_write(b);
}
return (ret);
return ret;
}
static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
@ -492,7 +492,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
ret = 0;
break;
}
return (ret);
return ret;
}
static long conn_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
@ -513,7 +513,7 @@ static long conn_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
ret = 0;
break;
}
return (ret);
return ret;
}
static int conn_puts(BIO *bp, const char *str)
@ -522,7 +522,7 @@ static int conn_puts(BIO *bp, const char *str)
n = strlen(str);
ret = conn_write(bp, str, n);
return (ret);
return ret;
}
BIO *BIO_new_connect(const char *str)
@ -531,11 +531,11 @@ BIO *BIO_new_connect(const char *str)
ret = BIO_new(BIO_s_connect());
if (ret == NULL)
return (NULL);
return NULL;
if (BIO_set_conn_hostname(ret, str))
return (ret);
return ret;
BIO_free(ret);
return (NULL);
return NULL;
}
#endif

View File

@ -136,7 +136,7 @@ typedef struct bio_dgram_sctp_data_st {
const BIO_METHOD *BIO_s_datagram(void)
{
return (&methods_dgramp);
return &methods_dgramp;
}
BIO *BIO_new_dgram(int fd, int close_flag)
@ -145,9 +145,9 @@ BIO *BIO_new_dgram(int fd, int close_flag)
ret = BIO_new(BIO_s_datagram());
if (ret == NULL)
return (NULL);
return NULL;
BIO_set_fd(ret, fd, close_flag);
return (ret);
return ret;
}
static int dgram_new(BIO *bi)
@ -165,7 +165,7 @@ static int dgram_free(BIO *a)
bio_dgram_data *data;
if (a == NULL)
return (0);
return 0;
if (!dgram_clear(a))
return 0;
@ -178,7 +178,7 @@ static int dgram_free(BIO *a)
static int dgram_clear(BIO *a)
{
if (a == NULL)
return (0);
return 0;
if (a->shutdown) {
if (a->init) {
BIO_closesocket(a->num);
@ -325,7 +325,7 @@ static int dgram_read(BIO *b, char *out, int outl)
dgram_reset_rcv_timeout(b);
}
return (ret);
return ret;
}
static int dgram_write(BIO *b, const char *in, int inl)
@ -355,7 +355,7 @@ static int dgram_write(BIO *b, const char *in, int inl)
data->_errno = get_last_socket_error();
}
}
return (ret);
return ret;
}
static long dgram_get_mtu_overhead(bio_dgram_data *data)
@ -799,7 +799,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
ret = 0;
break;
}
return (ret);
return ret;
}
static int dgram_puts(BIO *bp, const char *str)
@ -808,13 +808,13 @@ static int dgram_puts(BIO *bp, const char *str)
n = strlen(str);
ret = dgram_write(bp, str, n);
return (ret);
return ret;
}
# ifndef OPENSSL_NO_SCTP
const BIO_METHOD *BIO_s_datagram_sctp(void)
{
return (&methods_dgramp_sctp);
return &methods_dgramp_sctp;
}
BIO *BIO_new_dgram_sctp(int fd, int close_flag)
@ -836,7 +836,7 @@ BIO *BIO_new_dgram_sctp(int fd, int close_flag)
bio = BIO_new(BIO_s_datagram_sctp());
if (bio == NULL)
return (NULL);
return NULL;
BIO_set_fd(bio, fd, close_flag);
/* Activate SCTP-AUTH for DATA and FORWARD-TSN chunks */
@ -848,7 +848,7 @@ BIO *BIO_new_dgram_sctp(int fd, int close_flag)
BIO_vfree(bio);
BIOerr(BIO_F_BIO_NEW_DGRAM_SCTP, ERR_R_SYS_LIB);
ERR_add_error_data(1, "Ensure SCTP AUTH chunks are enabled in kernel");
return (NULL);
return NULL;
}
auth.sauth_chunk = OPENSSL_SCTP_FORWARD_CUM_TSN_CHUNK_TYPE;
ret =
@ -858,7 +858,7 @@ BIO *BIO_new_dgram_sctp(int fd, int close_flag)
BIO_vfree(bio);
BIOerr(BIO_F_BIO_NEW_DGRAM_SCTP, ERR_R_SYS_LIB);
ERR_add_error_data(1, "Ensure SCTP AUTH chunks are enabled in kernel");
return (NULL);
return NULL;
}
/*
@ -871,14 +871,14 @@ BIO *BIO_new_dgram_sctp(int fd, int close_flag)
authchunks = OPENSSL_zalloc(sockopt_len);
if (authchunks == NULL) {
BIO_vfree(bio);
return (NULL);
return NULL;
}
ret = getsockopt(fd, IPPROTO_SCTP, SCTP_LOCAL_AUTH_CHUNKS, authchunks,
&sockopt_len);
if (ret < 0) {
OPENSSL_free(authchunks);
BIO_vfree(bio);
return (NULL);
return NULL;
}
for (p = (unsigned char *)authchunks->gauth_chunks;
@ -912,14 +912,14 @@ BIO *BIO_new_dgram_sctp(int fd, int close_flag)
sizeof(struct sctp_event));
if (ret < 0) {
BIO_vfree(bio);
return (NULL);
return NULL;
}
# else
sockopt_len = (socklen_t) sizeof(struct sctp_event_subscribe);
ret = getsockopt(fd, IPPROTO_SCTP, SCTP_EVENTS, &event, &sockopt_len);
if (ret < 0) {
BIO_vfree(bio);
return (NULL);
return NULL;
}
event.sctp_authentication_event = 1;
@ -929,7 +929,7 @@ BIO *BIO_new_dgram_sctp(int fd, int close_flag)
sizeof(struct sctp_event_subscribe));
if (ret < 0) {
BIO_vfree(bio);
return (NULL);
return NULL;
}
# endif
# endif
@ -943,10 +943,10 @@ BIO *BIO_new_dgram_sctp(int fd, int close_flag)
sizeof(optval));
if (ret < 0) {
BIO_vfree(bio);
return (NULL);
return NULL;
}
return (bio);
return bio;
}
int BIO_dgram_is_sctp(BIO *bio)
@ -977,7 +977,7 @@ static int dgram_sctp_free(BIO *a)
bio_dgram_sctp_data *data;
if (a == NULL)
return (0);
return 0;
if (!dgram_clear(a))
return 0;
@ -1222,7 +1222,7 @@ static int dgram_sctp_read(BIO *b, char *out, int outl)
data->peer_auth_tested = 1;
}
}
return (ret);
return ret;
}
/*
@ -1338,7 +1338,7 @@ static int dgram_sctp_write(BIO *b, const char *in, int inl)
data->_errno = get_last_socket_error();
}
}
return (ret);
return ret;
}
static long dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr)
@ -1573,7 +1573,7 @@ static long dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr)
ret = dgram_ctrl(b, cmd, num, ptr);
break;
}
return (ret);
return ret;
}
int BIO_dgram_sctp_notification_cb(BIO *b,
@ -1830,7 +1830,7 @@ static int dgram_sctp_puts(BIO *bp, const char *str)
n = strlen(str);
ret = dgram_sctp_write(bp, str, n);
return (ret);
return ret;
}
# endif
@ -1849,9 +1849,9 @@ static int BIO_dgram_should_retry(int i)
*/
# endif
return (BIO_dgram_non_fatal_error(err));
return BIO_dgram_non_fatal_error(err);
}
return (0);
return 0;
}
int BIO_dgram_non_fatal_error(int err)
@ -1899,7 +1899,7 @@ int BIO_dgram_non_fatal_error(int err)
default:
break;
}
return (0);
return 0;
}
static void get_current_time(struct timeval *t)

View File

@ -75,7 +75,7 @@ static const BIO_METHOD methods_fdp = {
const BIO_METHOD *BIO_s_fd(void)
{
return (&methods_fdp);
return &methods_fdp;
}
BIO *BIO_new_fd(int fd, int close_flag)
@ -83,9 +83,9 @@ BIO *BIO_new_fd(int fd, int close_flag)
BIO *ret;
ret = BIO_new(BIO_s_fd());
if (ret == NULL)
return (NULL);
return NULL;
BIO_set_fd(ret, fd, close_flag);
return (ret);
return ret;
}
static int fd_new(BIO *bi)
@ -100,7 +100,7 @@ static int fd_new(BIO *bi)
static int fd_free(BIO *a)
{
if (a == NULL)
return (0);
return 0;
if (a->shutdown) {
if (a->init) {
UP_close(a->num);
@ -124,7 +124,7 @@ static int fd_read(BIO *b, char *out, int outl)
BIO_set_retry_read(b);
}
}
return (ret);
return ret;
}
static int fd_write(BIO *b, const char *in, int inl)
@ -137,7 +137,7 @@ static int fd_write(BIO *b, const char *in, int inl)
if (BIO_fd_should_retry(ret))
BIO_set_retry_write(b);
}
return (ret);
return ret;
}
static long fd_ctrl(BIO *b, int cmd, long num, void *ptr)
@ -189,7 +189,7 @@ static long fd_ctrl(BIO *b, int cmd, long num, void *ptr)
ret = 0;
break;
}
return (ret);
return ret;
}
static int fd_puts(BIO *bp, const char *str)
@ -198,7 +198,7 @@ static int fd_puts(BIO *bp, const char *str)
n = strlen(str);
ret = fd_write(bp, str, n);
return (ret);
return ret;
}
static int fd_gets(BIO *bp, char *buf, int size)
@ -216,7 +216,7 @@ static int fd_gets(BIO *bp, char *buf, int size)
if (buf[0] != '\0')
ret = strlen(buf);
return (ret);
return ret;
}
int BIO_fd_should_retry(int i)
@ -226,9 +226,9 @@ int BIO_fd_should_retry(int i)
if ((i == 0) || (i == -1)) {
err = get_last_sys_error();
return (BIO_fd_non_fatal_error(err));
return BIO_fd_non_fatal_error(err);
}
return (0);
return 0;
}
int BIO_fd_non_fatal_error(int err)
@ -274,6 +274,6 @@ int BIO_fd_non_fatal_error(int err)
default:
break;
}
return (0);
return 0;
}
#endif

View File

@ -101,7 +101,7 @@ static const BIO_METHOD methods_slg = {
const BIO_METHOD *BIO_s_log(void)
{
return (&methods_slg);
return &methods_slg;
}
static int slg_new(BIO *bi)
@ -116,7 +116,7 @@ static int slg_new(BIO *bi)
static int slg_free(BIO *a)
{
if (a == NULL)
return (0);
return 0;
xcloselog(a);
return 1;
}
@ -196,7 +196,7 @@ static int slg_write(BIO *b, const char *in, int inl)
};
if ((buf = OPENSSL_malloc(inl + 1)) == NULL) {
return (0);
return 0;
}
strncpy(buf, in, inl);
buf[inl] = '\0';
@ -210,7 +210,7 @@ static int slg_write(BIO *b, const char *in, int inl)
xsyslog(b, priority, pp);
OPENSSL_free(buf);
return (ret);
return ret;
}
static long slg_ctrl(BIO *b, int cmd, long num, void *ptr)
@ -223,7 +223,7 @@ static long slg_ctrl(BIO *b, int cmd, long num, void *ptr)
default:
break;
}
return (0);
return 0;
}
static int slg_puts(BIO *bp, const char *str)
@ -232,7 +232,7 @@ static int slg_puts(BIO *bp, const char *str)
n = strlen(str);
ret = slg_write(bp, str, n);
return (ret);
return ret;
}
# if defined(OPENSSL_SYS_WIN32)

View File

@ -70,7 +70,7 @@ typedef struct bio_buf_mem_st {
const BIO_METHOD *BIO_s_mem(void)
{
return (&mem_method);
return &mem_method;
}
const BIO_METHOD *BIO_s_secmem(void)
@ -130,23 +130,23 @@ static int mem_init(BIO *bi, unsigned long flags)
static int mem_new(BIO *bi)
{
return (mem_init(bi, 0L));
return mem_init(bi, 0L);
}
static int secmem_new(BIO *bi)
{
return (mem_init(bi, BUF_MEM_FLAG_SECURE));
return mem_init(bi, BUF_MEM_FLAG_SECURE);
}
static int mem_free(BIO *a)
{
return (mem_buf_free(a, 1));
return mem_buf_free(a, 1);
}
static int mem_buf_free(BIO *a, int free_all)
{
if (a == NULL)
return (0);
return 0;
if (a->shutdown) {
if ((a->init) && (a->ptr != NULL)) {
BUF_MEM *b;
@ -182,7 +182,7 @@ static int mem_buf_sync(BIO *b)
bbm->readp->data = bbm->buf->data;
}
}
return (0);
return 0;
}
static int mem_read(BIO *b, char *out, int outl)
@ -202,7 +202,7 @@ static int mem_read(BIO *b, char *out, int outl)
if (ret != 0)
BIO_set_retry_read(b);
}
return (ret);
return ret;
}
static int mem_write(BIO *b, const char *in, int inl)
@ -228,7 +228,7 @@ static int mem_write(BIO *b, const char *in, int inl)
*bbm->readp = *bbm->buf;
ret = inl;
end:
return (ret);
return ret;
}
static long mem_ctrl(BIO *b, int cmd, long num, void *ptr)
@ -305,7 +305,7 @@ static long mem_ctrl(BIO *b, int cmd, long num, void *ptr)
ret = 0;
break;
}
return (ret);
return ret;
}
static int mem_gets(BIO *bp, char *buf, int size)
@ -341,7 +341,7 @@ static int mem_gets(BIO *bp, char *buf, int size)
if (i > 0)
buf[i] = '\0';
ret = i;
return (ret);
return ret;
}
static int mem_puts(BIO *bp, const char *str)
@ -351,5 +351,5 @@ static int mem_puts(BIO *bp, const char *str)
n = strlen(str);
ret = mem_write(bp, str, n);
/* memory semantics is that it will always work */
return (ret);
return ret;
}

View File

@ -38,7 +38,7 @@ static const BIO_METHOD null_method = {
const BIO_METHOD *BIO_s_null(void)
{
return (&null_method);
return &null_method;
}
static int null_new(BIO *bi)
@ -52,18 +52,18 @@ static int null_new(BIO *bi)
static int null_free(BIO *a)
{
if (a == NULL)
return (0);
return 0;
return 1;
}
static int null_read(BIO *b, char *out, int outl)
{
return (0);
return 0;
}
static int null_write(BIO *b, const char *in, int inl)
{
return (inl);
return inl;
}
static long null_ctrl(BIO *b, int cmd, long num, void *ptr)
@ -88,17 +88,17 @@ static long null_ctrl(BIO *b, int cmd, long num, void *ptr)
ret = 0;
break;
}
return (ret);
return ret;
}
static int null_gets(BIO *bp, char *buf, int size)
{
return (0);
return 0;
}
static int null_puts(BIO *bp, const char *str)
{
if (str == NULL)
return (0);
return (strlen(str));
return 0;
return strlen(str);
}

View File

@ -53,7 +53,7 @@ static const BIO_METHOD methods_sockp = {
const BIO_METHOD *BIO_s_socket(void)
{
return (&methods_sockp);
return &methods_sockp;
}
BIO *BIO_new_socket(int fd, int close_flag)
@ -62,9 +62,9 @@ BIO *BIO_new_socket(int fd, int close_flag)
ret = BIO_new(BIO_s_socket());
if (ret == NULL)
return (NULL);
return NULL;
BIO_set_fd(ret, fd, close_flag);
return (ret);
return ret;
}
static int sock_new(BIO *bi)
@ -79,7 +79,7 @@ static int sock_new(BIO *bi)
static int sock_free(BIO *a)
{
if (a == NULL)
return (0);
return 0;
if (a->shutdown) {
if (a->init) {
BIO_closesocket(a->num);
@ -103,7 +103,7 @@ static int sock_read(BIO *b, char *out, int outl)
BIO_set_retry_read(b);
}
}
return (ret);
return ret;
}
static int sock_write(BIO *b, const char *in, int inl)
@ -117,7 +117,7 @@ static int sock_write(BIO *b, const char *in, int inl)
if (BIO_sock_should_retry(ret))
BIO_set_retry_write(b);
}
return (ret);
return ret;
}
static long sock_ctrl(BIO *b, int cmd, long num, void *ptr)
@ -155,7 +155,7 @@ static long sock_ctrl(BIO *b, int cmd, long num, void *ptr)
ret = 0;
break;
}
return (ret);
return ret;
}
static int sock_puts(BIO *bp, const char *str)
@ -164,7 +164,7 @@ static int sock_puts(BIO *bp, const char *str)
n = strlen(str);
ret = sock_write(bp, str, n);
return (ret);
return ret;
}
int BIO_sock_should_retry(int i)
@ -174,9 +174,9 @@ int BIO_sock_should_retry(int i)
if ((i == 0) || (i == -1)) {
err = get_last_socket_error();
return (BIO_sock_non_fatal_error(err));
return BIO_sock_non_fatal_error(err);
}
return (0);
return 0;
}
int BIO_sock_non_fatal_error(int err)
@ -227,7 +227,7 @@ int BIO_sock_non_fatal_error(int err)
default:
break;
}
return (0);
return 0;
}
#endif /* #ifndef OPENSSL_NO_SOCK */

View File

@ -54,6 +54,6 @@ static const EVP_MD blake2b_md = {
const EVP_MD *EVP_blake2b512(void)
{
return (&blake2b_md);
return &blake2b_md;
}
#endif

View File

@ -54,6 +54,6 @@ static const EVP_MD blake2s_md = {
const EVP_MD *EVP_blake2s256(void)
{
return (&blake2s_md);
return &blake2s_md;
}
#endif

View File

@ -120,7 +120,7 @@ BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num,
BN_ULONG c1 = 0;
if (num <= 0)
return (c1);
return c1;
while (num & ~3) {
mul_add(rp[0], ap[0], w, c1);
@ -142,7 +142,7 @@ BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num,
return c1;
}
return (c1);
return c1;
}
BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w)
@ -150,7 +150,7 @@ BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w)
BN_ULONG c1 = 0;
if (num <= 0)
return (c1);
return c1;
while (num & ~3) {
mul(rp[0], ap[0], w, c1);
@ -170,7 +170,7 @@ BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w)
return c1;
mul(rp[2], ap[2], w, c1);
}
return (c1);
return c1;
}
void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, int n)
@ -268,7 +268,7 @@ BN_ULONG bn_sub_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
int c = 0;
if (n <= 0)
return ((BN_ULONG)0);
return (BN_ULONG)0;
for (;;) {
t1 = a[0];
@ -307,7 +307,7 @@ BN_ULONG bn_sub_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
b += 4;
r += 4;
}
return (c);
return c;
}
# endif

View File

@ -21,7 +21,7 @@ BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num,
assert(num >= 0);
if (num <= 0)
return (c1);
return c1;
# ifndef OPENSSL_SMALL_FOOTPRINT
while (num & ~3) {
@ -41,7 +41,7 @@ BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num,
num--;
}
return (c1);
return c1;
}
BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w)
@ -50,7 +50,7 @@ BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w)
assert(num >= 0);
if (num <= 0)
return (c1);
return c1;
# ifndef OPENSSL_SMALL_FOOTPRINT
while (num & ~3) {
@ -69,7 +69,7 @@ BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w)
rp++;
num--;
}
return (c1);
return c1;
}
void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, int n)
@ -108,7 +108,7 @@ BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num,
assert(num >= 0);
if (num <= 0)
return ((BN_ULONG)0);
return (BN_ULONG)0;
bl = LBITS(w);
bh = HBITS(w);
@ -130,7 +130,7 @@ BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num,
rp++;
num--;
}
return (c);
return c;
}
BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w)
@ -140,7 +140,7 @@ BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w)
assert(num >= 0);
if (num <= 0)
return ((BN_ULONG)0);
return (BN_ULONG)0;
bl = LBITS(w);
bh = HBITS(w);
@ -162,7 +162,7 @@ BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w)
rp++;
num--;
}
return (carry);
return carry;
}
void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, int n)
@ -210,7 +210,7 @@ BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
int i, count = 2;
if (d == 0)
return (BN_MASK2);
return BN_MASK2;
i = BN_num_bits_word(d);
assert((i == BN_BITS2) || (h <= (BN_ULONG)1 << i));
@ -264,7 +264,7 @@ BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
l = (l & BN_MASK2l) << BN_BITS4;
}
ret |= q;
return (ret);
return ret;
}
#endif /* !defined(BN_LLONG) && defined(BN_DIV2W) */
@ -276,7 +276,7 @@ BN_ULONG bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
assert(n >= 0);
if (n <= 0)
return ((BN_ULONG)0);
return (BN_ULONG)0;
# ifndef OPENSSL_SMALL_FOOTPRINT
while (n & ~3) {
@ -307,7 +307,7 @@ BN_ULONG bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
r++;
n--;
}
return ((BN_ULONG)ll);
return (BN_ULONG)ll;
}
#else /* !BN_LLONG */
BN_ULONG bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
@ -317,7 +317,7 @@ BN_ULONG bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
assert(n >= 0);
if (n <= 0)
return ((BN_ULONG)0);
return (BN_ULONG)0;
c = 0;
# ifndef OPENSSL_SMALL_FOOTPRINT
@ -364,7 +364,7 @@ BN_ULONG bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
r++;
n--;
}
return ((BN_ULONG)c);
return (BN_ULONG)c;
}
#endif /* !BN_LLONG */
@ -376,7 +376,7 @@ BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
assert(n >= 0);
if (n <= 0)
return ((BN_ULONG)0);
return (BN_ULONG)0;
#ifndef OPENSSL_SMALL_FOOTPRINT
while (n & ~3) {
@ -417,7 +417,7 @@ BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
r++;
n--;
}
return (c);
return c;
}
#if defined(BN_MUL_COMBA) && !defined(OPENSSL_SMALL_FOOTPRINT)

View File

@ -119,7 +119,7 @@ int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx)
err:
if (b->counter == BN_BLINDING_COUNTER)
b->counter = 0;
return (ret);
return ret;
}
int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx)
@ -135,14 +135,14 @@ int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx)
if ((b->A == NULL) || (b->Ai == NULL)) {
BNerr(BN_F_BN_BLINDING_CONVERT_EX, BN_R_NOT_INITIALIZED);
return (0);
return 0;
}
if (b->counter == -1)
/* Fresh blinding, doesn't need updating. */
b->counter = 0;
else if (!BN_BLINDING_update(b, ctx))
return (0);
return 0;
if (r != NULL) {
if (!BN_copy(r, b->Ai))
@ -172,13 +172,13 @@ int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b,
else {
if (b->Ai == NULL) {
BNerr(BN_F_BN_BLINDING_INVERT_EX, BN_R_NOT_INITIALIZED);
return (0);
return 0;
}
ret = BN_mod_mul(n, n, b->Ai, b->mod, ctx);
}
bn_check_top(n);
return (ret);
return ret;
}
int BN_BLINDING_is_current_thread(BN_BLINDING *b)

View File

@ -24,13 +24,13 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
bn_check_top(d);
if (BN_is_zero(d)) {
BNerr(BN_F_BN_DIV, BN_R_DIV_BY_ZERO);
return (0);
return 0;
}
if (BN_ucmp(m, d) < 0) {
if (rem != NULL) {
if (BN_copy(rem, m) == NULL)
return (0);
return 0;
}
if (dv != NULL)
BN_zero(dv);
@ -81,7 +81,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
ret = 1;
end:
BN_CTX_end(ctx);
return (ret);
return ret;
}
#else
@ -174,13 +174,13 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
if (BN_is_zero(divisor)) {
BNerr(BN_F_BN_DIV, BN_R_DIV_BY_ZERO);
return (0);
return 0;
}
if (!no_branch && BN_ucmp(num, divisor) < 0) {
if (rm != NULL) {
if (BN_copy(rm, num) == NULL)
return (0);
return 0;
}
if (dv != NULL)
BN_zero(dv);
@ -412,6 +412,6 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
err:
bn_check_top(rm);
BN_CTX_end(ctx);
return (0);
return 0;
}
#endif

View File

@ -155,7 +155,7 @@ int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
#endif
bn_check_top(r);
return (ret);
return ret;
}
int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
@ -290,7 +290,7 @@ int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
BN_CTX_end(ctx);
BN_RECP_CTX_free(&recp);
bn_check_top(r);
return (ret);
return ret;
}
int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
@ -316,7 +316,7 @@ int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
if (!BN_is_odd(m)) {
BNerr(BN_F_BN_MOD_EXP_MONT, BN_R_CALLED_WITH_EVEN_MODULUS);
return (0);
return 0;
}
bits = BN_num_bits(p);
if (bits == 0) {
@ -470,7 +470,7 @@ int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
BN_MONT_CTX_free(mont);
BN_CTX_end(ctx);
bn_check_top(rr);
return (ret);
return ret;
}
#if defined(SPARC_T4_MONT)
@ -618,7 +618,7 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
if (!BN_is_odd(m)) {
BNerr(BN_F_BN_MOD_EXP_MONT_CONSTTIME, BN_R_CALLED_WITH_EVEN_MODULUS);
return (0);
return 0;
}
top = m->top;
@ -1089,7 +1089,7 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
OPENSSL_free(powerbufFree);
}
BN_CTX_end(ctx);
return (ret);
return ret;
}
int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p,
@ -1130,7 +1130,7 @@ int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p,
if (!BN_is_odd(m)) {
BNerr(BN_F_BN_MOD_EXP_MONT_WORD, BN_R_CALLED_WITH_EVEN_MODULUS);
return (0);
return 0;
}
if (m->top == 1)
a %= m->d[0]; /* make sure that 'a' is reduced */
@ -1236,7 +1236,7 @@ int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p,
BN_MONT_CTX_free(mont);
BN_CTX_end(ctx);
bn_check_top(rr);
return (ret);
return ret;
}
/* The old fallback, simple version :-) */
@ -1357,5 +1357,5 @@ int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
err:
BN_CTX_end(ctx);
bn_check_top(r);
return (ret);
return ret;
}

View File

@ -34,7 +34,7 @@ int BN_mod_exp2_mont(BIGNUM *rr, const BIGNUM *a1, const BIGNUM *p1,
if (!(m->d[0] & 1)) {
BNerr(BN_F_BN_MOD_EXP2_MONT, BN_R_CALLED_WITH_EVEN_MODULUS);
return (0);
return 0;
}
bits1 = BN_num_bits(p1);
bits2 = BN_num_bits(p2);
@ -197,5 +197,5 @@ int BN_mod_exp2_mont(BIGNUM *rr, const BIGNUM *a1, const BIGNUM *p1,
BN_MONT_CTX_free(mont);
BN_CTX_end(ctx);
bn_check_top(rr);
return (ret);
return ret;
}

View File

@ -48,7 +48,7 @@ int BN_gcd(BIGNUM *r, const BIGNUM *in_a, const BIGNUM *in_b, BN_CTX *ctx)
err:
BN_CTX_end(ctx);
bn_check_top(r);
return (ret);
return ret;
}
static BIGNUM *euclid(BIGNUM *a, BIGNUM *b)
@ -111,9 +111,9 @@ static BIGNUM *euclid(BIGNUM *a, BIGNUM *b)
goto err;
}
bn_check_top(a);
return (a);
return a;
err:
return (NULL);
return NULL;
}
/* solves ax == 1 (mod n) */
@ -441,7 +441,7 @@ BIGNUM *int_bn_mod_inverse(BIGNUM *in,
BN_free(R);
BN_CTX_end(ctx);
bn_check_top(ret);
return (ret);
return ret;
}
/*
@ -612,5 +612,5 @@ static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
BN_free(R);
BN_CTX_end(ctx);
bn_check_top(ret);
return (ret);
return ret;
}

View File

@ -904,7 +904,7 @@ int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
bn_check_top(b);
if (BN_is_zero(b))
return (BN_one(r));
return BN_one(r);
if (BN_abs_is_word(b, 1))
return (BN_copy(r, a) != NULL);

View File

@ -65,15 +65,15 @@ void BN_set_params(int mult, int high, int low, int mont)
int BN_get_params(int which)
{
if (which == 0)
return (bn_limit_bits);
return bn_limit_bits;
else if (which == 1)
return (bn_limit_bits_high);
return bn_limit_bits_high;
else if (which == 2)
return (bn_limit_bits_low);
return bn_limit_bits_low;
else if (which == 3)
return (bn_limit_bits_mont);
return bn_limit_bits_mont;
else
return (0);
return 0;
}
#endif
@ -83,7 +83,7 @@ const BIGNUM *BN_value_one(void)
static const BIGNUM const_one =
{ (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA };
return (&const_one);
return &const_one;
}
int BN_num_bits_word(BN_ULONG l)
@ -215,11 +215,11 @@ BIGNUM *BN_new(void)
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
return NULL;
}
ret->flags = BN_FLG_MALLOCED;
bn_check_top(ret);
return (ret);
return ret;
}
BIGNUM *BN_secure_new(void)
@ -227,7 +227,7 @@ BIGNUM *BN_new(void)
BIGNUM *ret = BN_new();
if (ret != NULL)
ret->flags |= BN_FLG_SECURE;
return (ret);
return ret;
}
/* This is used by bn_expand2() */
@ -244,7 +244,7 @@ static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
}
if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return (NULL);
return NULL;
}
if (BN_get_flags(b, BN_FLG_SECURE))
a = OPENSSL_secure_zalloc(words * sizeof(*a));
@ -252,7 +252,7 @@ static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
a = OPENSSL_zalloc(words * sizeof(*a));
if (a == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return (NULL);
return NULL;
}
assert(b->top <= words);
@ -388,7 +388,7 @@ int BN_set_word(BIGNUM *a, BN_ULONG w)
{
bn_check_top(a);
if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
return (0);
return 0;
a->neg = 0;
a->d[0] = w;
a->top = (w ? 1 : 0);
@ -406,7 +406,7 @@ BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
if (ret == NULL)
ret = bn = BN_new();
if (ret == NULL)
return (NULL);
return NULL;
bn_check_top(ret);
/* Skip leading zero's. */
for ( ; len > 0 && *s == 0; s++, len--)
@ -414,7 +414,7 @@ BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
n = len;
if (n == 0) {
ret->top = 0;
return (ret);
return ret;
}
i = ((n - 1) / BN_BYTES) + 1;
m = ((n - 1) % (BN_BYTES));
@ -438,7 +438,7 @@ BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
* bit set (-ve number)
*/
bn_correct_top(ret);
return (ret);
return ret;
}
/* ignore negative */
@ -487,7 +487,7 @@ BIGNUM *BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret)
if (ret == NULL)
ret = bn = BN_new();
if (ret == NULL)
return (NULL);
return NULL;
bn_check_top(ret);
s += len;
/* Skip trailing zeroes. */
@ -554,7 +554,7 @@ int BN_ucmp(const BIGNUM *a, const BIGNUM *b)
i = a->top - b->top;
if (i != 0)
return (i);
return i;
ap = a->d;
bp = b->d;
for (i = a->top - 1; i >= 0; i--) {
@ -563,7 +563,7 @@ int BN_ucmp(const BIGNUM *a, const BIGNUM *b)
if (t1 != t2)
return ((t1 > t2) ? 1 : -1);
}
return (0);
return 0;
}
int BN_cmp(const BIGNUM *a, const BIGNUM *b)
@ -574,11 +574,11 @@ int BN_cmp(const BIGNUM *a, const BIGNUM *b)
if ((a == NULL) || (b == NULL)) {
if (a != NULL)
return (-1);
return -1;
else if (b != NULL)
return 1;
else
return (0);
return 0;
}
bn_check_top(a);
@ -586,7 +586,7 @@ int BN_cmp(const BIGNUM *a, const BIGNUM *b)
if (a->neg != b->neg) {
if (a->neg)
return (-1);
return -1;
else
return 1;
}
@ -599,18 +599,18 @@ int BN_cmp(const BIGNUM *a, const BIGNUM *b)
}
if (a->top > b->top)
return (gt);
return gt;
if (a->top < b->top)
return (lt);
return lt;
for (i = a->top - 1; i >= 0; i--) {
t1 = a->d[i];
t2 = b->d[i];
if (t1 > t2)
return (gt);
return gt;
if (t1 < t2)
return (lt);
return lt;
}
return (0);
return 0;
}
int BN_set_bit(BIGNUM *a, int n)
@ -624,7 +624,7 @@ int BN_set_bit(BIGNUM *a, int n)
j = n % BN_BITS2;
if (a->top <= i) {
if (bn_wexpand(a, i + 1) == NULL)
return (0);
return 0;
for (k = a->top; k < i + 1; k++)
a->d[k] = 0;
a->top = i + 1;
@ -646,7 +646,7 @@ int BN_clear_bit(BIGNUM *a, int n)
i = n / BN_BITS2;
j = n % BN_BITS2;
if (a->top <= i)
return (0);
return 0;
a->d[i] &= (~(((BN_ULONG)1) << j));
bn_correct_top(a);
@ -712,7 +712,7 @@ int bn_cmp_words(const BN_ULONG *a, const BN_ULONG *b, int n)
if (aa != bb)
return ((aa > bb) ? 1 : -1);
}
return (0);
return 0;
}
/*
@ -889,7 +889,7 @@ BN_GENCB *BN_GENCB_new(void)
if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) {
BNerr(BN_F_BN_GENCB_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
return NULL;
}
return ret;

View File

@ -96,7 +96,7 @@ int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
ret = 1;
err:
BN_CTX_end(ctx);
return (ret);
return ret;
}
int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx)

View File

@ -33,7 +33,7 @@ int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
if (num > 1 && a->top == num && b->top == num) {
if (bn_wexpand(r, num) == NULL)
return (0);
return 0;
if (bn_mul_mont(r->d, a->d, b->d, mont->N.d, mont->n0, num)) {
r->neg = a->neg ^ b->neg;
r->top = num;
@ -68,7 +68,7 @@ int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
ret = 1;
err:
BN_CTX_end(ctx);
return (ret);
return ret;
}
#ifdef MONT_WORD
@ -87,7 +87,7 @@ static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont)
max = (2 * nl); /* carry is stored separately */
if (bn_wexpand(r, max) == NULL)
return (0);
return 0;
r->neg ^= n->neg;
np = n->d;
@ -110,7 +110,7 @@ static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont)
}
if (bn_wexpand(ret, nl) == NULL)
return (0);
return 0;
ret->top = nl;
ret->neg = r->neg;
@ -207,7 +207,7 @@ int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont,
err:
BN_CTX_end(ctx);
#endif /* MONT_WORD */
return (retn);
return retn;
}
BN_MONT_CTX *BN_MONT_CTX_new(void)
@ -215,11 +215,11 @@ BN_MONT_CTX *BN_MONT_CTX_new(void)
BN_MONT_CTX *ret;
if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
return (NULL);
return NULL;
BN_MONT_CTX_init(ret);
ret->flags = BN_FLG_MALLOCED;
return (ret);
return ret;
}
void BN_MONT_CTX_init(BN_MONT_CTX *ctx)
@ -384,7 +384,7 @@ int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from)
{
if (to == from)
return (to);
return to;
if (!BN_copy(&(to->RR), &(from->RR)))
return NULL;
@ -395,7 +395,7 @@ BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from)
to->ri = from->ri;
to->n0[0] = from->n0[0];
to->n0[1] = from->n0[1];
return (to);
return to;
}
BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock,

View File

@ -606,7 +606,7 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
err:
bn_check_top(r);
BN_CTX_end(ctx);
return (ret);
return ret;
}
void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb)

View File

@ -241,7 +241,7 @@ int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
}
BN_MONT_CTX_free(mont);
return (ret);
return ret;
}
static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1,
@ -280,7 +280,7 @@ static int probable_prime(BIGNUM *rnd, int bits, prime_t *mods)
again:
if (!BN_priv_rand(rnd, bits, BN_RAND_TOP_TWO, BN_RAND_BOTTOM_ODD))
return (0);
return 0;
/* we now have a random number 'rnd' to test. */
for (i = 1; i < NUMPRIMES; i++) {
BN_ULONG mod = BN_mod_word(rnd, (BN_ULONG)primes[i]);
@ -346,7 +346,7 @@ static int probable_prime(BIGNUM *rnd, int bits, prime_t *mods)
}
}
if (!BN_add_word(rnd, delta))
return (0);
return 0;
if (BN_num_bits(rnd) != bits)
goto again;
bn_check_top(rnd);
@ -399,7 +399,7 @@ int bn_probable_prime_dh(BIGNUM *rnd, int bits,
err:
BN_CTX_end(ctx);
bn_check_top(rnd);
return (ret);
return ret;
}
static int probable_prime_dh_safe(BIGNUM *p, int bits, const BIGNUM *padd,
@ -466,5 +466,5 @@ static int probable_prime_dh_safe(BIGNUM *p, int bits, const BIGNUM *padd,
err:
BN_CTX_end(ctx);
bn_check_top(p);
return (ret);
return ret;
}

View File

@ -87,7 +87,7 @@ static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom)
err:
OPENSSL_clear_free(buf, bytes);
bn_check_top(rnd);
return (ret);
return ret;
toosmall:
BNerr(BN_F_BNRAND, BN_R_BITS_TOO_SMALL);

View File

@ -22,12 +22,12 @@ BN_RECP_CTX *BN_RECP_CTX_new(void)
BN_RECP_CTX *ret;
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
return (NULL);
return NULL;
bn_init(&(ret->N));
bn_init(&(ret->Nr));
ret->flags = BN_FLG_MALLOCED;
return (ret);
return ret;
}
void BN_RECP_CTX_free(BN_RECP_CTX *recp)
@ -77,7 +77,7 @@ int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y,
err:
BN_CTX_end(ctx);
bn_check_top(r);
return (ret);
return ret;
}
int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
@ -161,7 +161,7 @@ int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
BN_CTX_end(ctx);
bn_check_top(dv);
bn_check_top(rem);
return (ret);
return ret;
}
/*
@ -189,5 +189,5 @@ int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx)
err:
bn_check_top(r);
BN_CTX_end(ctx);
return (ret);
return ret;
}

View File

@ -21,11 +21,11 @@ int BN_lshift1(BIGNUM *r, const BIGNUM *a)
if (r != a) {
r->neg = a->neg;
if (bn_wexpand(r, a->top + 1) == NULL)
return (0);
return 0;
r->top = a->top;
} else {
if (bn_wexpand(r, a->top + 1) == NULL)
return (0);
return 0;
}
ap = a->d;
rp = r->d;
@ -60,7 +60,7 @@ int BN_rshift1(BIGNUM *r, const BIGNUM *a)
j = i - (ap[i - 1] == 1);
if (a != r) {
if (bn_wexpand(r, j) == NULL)
return (0);
return 0;
r->neg = a->neg;
}
rp = r->d;
@ -96,7 +96,7 @@ int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
nw = n / BN_BITS2;
if (bn_wexpand(r, a->top + nw + 1) == NULL)
return (0);
return 0;
r->neg = a->neg;
lb = n % BN_BITS2;
rb = BN_BITS2 - lb;
@ -143,7 +143,7 @@ int BN_rshift(BIGNUM *r, const BIGNUM *a, int n)
i = (BN_num_bits(a) - n + (BN_BITS2 - 1)) / BN_BITS2;
if (r != a) {
if (bn_wexpand(r, i) == NULL)
return (0);
return 0;
r->neg = a->neg;
} else {
if (n == 0)

View File

@ -98,7 +98,7 @@ int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
bn_check_top(rr);
bn_check_top(tmp);
BN_CTX_end(ctx);
return (ret);
return ret;
}
/* tmp must have 2*n words */

View File

@ -39,7 +39,7 @@ BIGNUM *BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
}
BNerr(BN_F_BN_MOD_SQRT, BN_R_P_IS_NOT_PRIME);
return (NULL);
return NULL;
}
if (BN_is_zero(a) || BN_is_one(a)) {

View File

@ -55,7 +55,7 @@ BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w)
(BN_ULLONG) w);
#endif
}
return ((BN_ULONG)ret);
return (BN_ULONG)ret;
}
BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w)
@ -92,7 +92,7 @@ BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w)
if (!a->top)
a->neg = 0; /* don't allow negative zero */
bn_check_top(a);
return (ret);
return ret;
}
int BN_add_word(BIGNUM *a, BN_ULONG w)
@ -115,7 +115,7 @@ int BN_add_word(BIGNUM *a, BN_ULONG w)
i = BN_sub_word(a, w);
if (!BN_is_zero(a))
a->neg = !(a->neg);
return (i);
return i;
}
for (i = 0; w != 0 && i < a->top; i++) {
a->d[i] = l = (a->d[i] + w) & BN_MASK2;
@ -153,7 +153,7 @@ int BN_sub_word(BIGNUM *a, BN_ULONG w)
a->neg = 0;
i = BN_add_word(a, w);
a->neg = 1;
return (i);
return i;
}
if ((a->top == 1) && (a->d[0] < w)) {
@ -191,7 +191,7 @@ int BN_mul_word(BIGNUM *a, BN_ULONG w)
ll = bn_mul_words(a->d, a->d, a->top, w);
if (ll) {
if (bn_wexpand(a, a->top + 1) == NULL)
return (0);
return 0;
a->d[a->top++] = ll;
}
}

View File

@ -25,7 +25,7 @@ BUF_MEM *BUF_MEM_new_ex(unsigned long flags)
ret = BUF_MEM_new();
if (ret != NULL)
ret->flags = flags;
return (ret);
return ret;
}
BUF_MEM *BUF_MEM_new(void)
@ -35,9 +35,9 @@ BUF_MEM *BUF_MEM_new(void)
ret = OPENSSL_zalloc(sizeof(*ret));
if (ret == NULL) {
BUFerr(BUF_F_BUF_MEM_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
return NULL;
}
return (ret);
return ret;
}
void BUF_MEM_free(BUF_MEM *a)
@ -68,7 +68,7 @@ static char *sec_alloc_realloc(BUF_MEM *str, size_t len)
str->data = NULL;
}
}
return (ret);
return ret;
}
size_t BUF_MEM_grow(BUF_MEM *str, size_t len)
@ -78,13 +78,13 @@ size_t BUF_MEM_grow(BUF_MEM *str, size_t len)
if (str->length >= len) {
str->length = len;
return (len);
return len;
}
if (str->max >= len) {
if (str->data != NULL)
memset(&str->data[str->length], 0, len - str->length);
str->length = len;
return (len);
return len;
}
/* This limit is sufficient to ensure (len+3)/3*4 < 2**31 */
if (len > LIMIT_BEFORE_EXPANSION) {
@ -105,7 +105,7 @@ size_t BUF_MEM_grow(BUF_MEM *str, size_t len)
memset(&str->data[str->length], 0, len - str->length);
str->length = len;
}
return (len);
return len;
}
size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
@ -117,12 +117,12 @@ size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
if (str->data != NULL)
memset(&str->data[len], 0, str->length - len);
str->length = len;
return (len);
return len;
}
if (str->max >= len) {
memset(&str->data[str->length], 0, len - str->length);
str->length = len;
return (len);
return len;
}
/* This limit is sufficient to ensure (len+3)/3*4 < 2**31 */
if (len > LIMIT_BEFORE_EXPANSION) {
@ -143,7 +143,7 @@ size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
memset(&str->data[str->length], 0, len - str->length);
str->length = len;
}
return (len);
return len;
}
void BUF_reverse(unsigned char *out, const unsigned char *in, size_t size)

View File

@ -256,7 +256,7 @@ COMP_METHOD *COMP_zlib(void)
meth = &zlib_stateful_method;
#endif
return (meth);
return meth;
}
void comp_zlib_cleanup_int(void)

View File

@ -19,13 +19,13 @@ COMP_CTX *COMP_CTX_new(COMP_METHOD *meth)
COMP_CTX *ret;
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
return (NULL);
return NULL;
ret->meth = meth;
if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
OPENSSL_free(ret);
ret = NULL;
}
return (ret);
return ret;
}
const COMP_METHOD *COMP_CTX_get_method(const COMP_CTX *ctx)
@ -59,14 +59,14 @@ int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
{
int ret;
if (ctx->meth->compress == NULL) {
return (-1);
return -1;
}
ret = ctx->meth->compress(ctx, out, olen, in, ilen);
if (ret > 0) {
ctx->compress_in += ilen;
ctx->compress_out += ret;
}
return (ret);
return ret;
}
int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
@ -75,14 +75,14 @@ int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
int ret;
if (ctx->meth->expand == NULL) {
return (-1);
return -1;
}
ret = ctx->meth->expand(ctx, out, olen, in, ilen);
if (ret > 0) {
ctx->expand_in += ilen;
ctx->expand_out += ret;
}
return (ret);
return ret;
}
int COMP_CTX_get_type(const COMP_CTX* comp)

View File

@ -24,11 +24,11 @@ CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section)
CONF_VALUE *v, vv;
if ((conf == NULL) || (section == NULL))
return (NULL);
return NULL;
vv.name = NULL;
vv.section = (char *)section;
v = lh_CONF_VALUE_retrieve(conf->data, &vv);
return (v);
return v;
}
/* Up until OpenSSL 0.9.5a, this was CONF_get_section */
@ -41,7 +41,7 @@ STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf,
if (v != NULL)
return ((STACK_OF(CONF_VALUE) *)v->value);
else
return (NULL);
return NULL;
}
int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value)
@ -73,29 +73,29 @@ char *_CONF_get_string(const CONF *conf, const char *section,
char *p;
if (name == NULL)
return (NULL);
return NULL;
if (conf != NULL) {
if (section != NULL) {
vv.name = (char *)name;
vv.section = (char *)section;
v = lh_CONF_VALUE_retrieve(conf->data, &vv);
if (v != NULL)
return (v->value);
return v->value;
if (strcmp(section, "ENV") == 0) {
p = getenv(name);
if (p != NULL)
return (p);
return p;
}
}
vv.section = "default";
vv.name = (char *)name;
v = lh_CONF_VALUE_retrieve(conf->data, &vv);
if (v != NULL)
return (v->value);
return v->value;
else
return (NULL);
return NULL;
} else
return (getenv(name));
return getenv(name);
}
static unsigned long conf_value_hash(const CONF_VALUE *v)
@ -110,14 +110,14 @@ static int conf_value_cmp(const CONF_VALUE *a, const CONF_VALUE *b)
if (a->section != b->section) {
i = strcmp(a->section, b->section);
if (i)
return (i);
return i;
}
if ((a->name != NULL) && (b->name != NULL)) {
i = strcmp(a->name, b->name);
return (i);
return i;
} else if (a->name == b->name)
return (0);
return 0;
else
return ((a->name == NULL) ? -1 : 1);
}

View File

@ -186,7 +186,7 @@ CONF *NCONF_new(CONF_METHOD *meth)
ret = meth->create(meth);
if (ret == NULL) {
CONFerr(CONF_F_NCONF_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
return NULL;
}
return ret;

View File

@ -23,26 +23,26 @@ const char *OpenSSL_version(int t)
if (t == OPENSSL_BUILT_ON) {
#ifdef DATE
# ifdef OPENSSL_USE_BUILD_DATE
return (DATE);
return DATE;
# else
return ("built on: reproducible build, date unspecified");
return "built on: reproducible build, date unspecified";
# endif
#else
return ("built on: date not available");
return "built on: date not available";
#endif
}
if (t == OPENSSL_CFLAGS) {
#ifdef CFLAGS
return (CFLAGS);
return CFLAGS;
#else
return ("compiler: information not available");
return "compiler: information not available";
#endif
}
if (t == OPENSSL_PLATFORM) {
#ifdef PLATFORM
return (PLATFORM);
return PLATFORM;
#else
return ("platform: information not available");
return "platform: information not available";
#endif
}
if (t == OPENSSL_DIR) {
@ -59,5 +59,5 @@ const char *OpenSSL_version(int t)
return "ENGINESDIR: N/A";
#endif
}
return ("not available");
return "not available";
}

View File

@ -49,5 +49,5 @@ DES_LONG DES_cbc_cksum(const unsigned char *in, DES_cblock *output,
| ((tout1 >> 8L) & 0x0000FF00)
| ((tout1 << 8L) & 0x00FF0000)
| ((tout1 << 24L) & 0xFF000000);
return (tout1);
return tout1;
}

View File

@ -60,7 +60,7 @@ char *DES_crypt(const char *buf, const char *salt)
static char buff[14];
#ifndef CHARSET_EBCDIC
return (DES_fcrypt(buf, salt, buff));
return DES_fcrypt(buf, salt, buff);
#else
char e_salt[2 + 1];
char e_buf[32 + 1]; /* replace 32 by 8 ? */
@ -145,5 +145,5 @@ char *DES_fcrypt(const char *buf, const char *salt, char *ret)
ret[i] = cov_2char[c];
}
ret[13] = '\0';
return (ret);
return ret;
}

View File

@ -72,5 +72,5 @@ DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[],
*lp++ = z1;
}
}
return (z0);
return z0;
}

View File

@ -14,7 +14,7 @@ int DES_random_key(DES_cblock *ret)
{
do {
if (RAND_bytes((unsigned char *)ret, sizeof(DES_cblock)) != 1)
return (0);
return 0;
} while (DES_is_weak_key(ret));
DES_set_odd_parity(ret);
return 1;

Some files were not shown because too many files have changed in this diff Show More