Merge pull request 'fix compilation warnings' (#67) from fix_compilation_warnings into master

Reviewed-on: http://13.234.246.121:3000/Neominds/ossl35vx69/pulls/67
This commit is contained in:
2026-07-30 20:43:45 +05:30
committed by neelimap
parent 212a16f58f
commit bd330e941f
19 changed files with 153 additions and 68 deletions
@@ -50,7 +50,6 @@ extern "C" {
#define size_t Ip_size_t
#define time_t Ip_time_t
#define FILE IP_FILE
#define NULL IP_NULL
#endif
/*
+24
View File
@@ -0,0 +1,24 @@
/* vxtss.h - VxWorks Thread-Specific Storage header */
#ifndef __VX_TSS_H__
#define __VX_TSS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <openssl/crypto.h>
typedef void (*tss_dtor_t)(void*);
void call_once(CRYPTO_ONCE *once_control, void (*init_routine)(void));
int tss_create(tss_t *key, tss_dtor_t destructor);
void *tss_get(tss_t key);
int tss_set(tss_t key, void *val);
void tss_delete(tss_t key);
#ifdef __cplusplus
}
#endif
#endif /* __VX_TSS_H__ */
@@ -21,8 +21,8 @@
#include <openssl/hmac.h>
#include <ctype.h>
#undef BUFSIZE
#define BUFSIZE 1024*8
#undef OSSL_DGST_BUFSIZE
#define OSSL_DGST_BUFSIZE 1024*8
static int do_fp_oneshot_sign(BIO *out, EVP_MD_CTX *ctx, BIO *in, int sep, int binout,
EVP_PKEY *key, unsigned char *sigin, int siglen,
@@ -119,7 +119,7 @@ int dgst_main(int argc, char **argv)
reset_unknown();
buf = app_malloc(BUFSIZE, "I/O buffer");
buf = app_malloc(OSSL_DGST_BUFSIZE, "I/O buffer");
md = (EVP_MD *)EVP_get_digestbyname(argv[0]);
if (md != NULL)
digestname = argv[0];
@@ -488,7 +488,7 @@ int dgst_main(int argc, char **argv)
end:
if (ret != EXIT_SUCCESS)
ERR_print_errors(bio_err);
OPENSSL_clear_free(buf, BUFSIZE);
OPENSSL_clear_free(buf, OSSL_DGST_BUFSIZE);
BIO_free(in);
OPENSSL_free(passin);
BIO_free_all(out);
@@ -625,12 +625,12 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, int xoflen
const char *sig_name, const char *md_name,
const char *file)
{
size_t len = BUFSIZE;
size_t len = OSSL_DGST_BUFSIZE;
int i, ret = EXIT_FAILURE;
unsigned char *allocated_buf = NULL;
while (BIO_pending(bp) || !BIO_eof(bp)) {
i = BIO_read(bp, (char *)buf, BUFSIZE);
i = BIO_read(bp, (char *)buf, OSSL_DGST_BUFSIZE);
if (i < 0) {
BIO_printf(bio_err, "Read error in %s\n", file);
goto end;
@@ -656,7 +656,7 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, int xoflen
BIO_printf(bio_err, "Error getting maximum length of signed data\n");
goto end;
}
if (tmplen > BUFSIZE) {
if (tmplen > OSSL_DGST_BUFSIZE) {
len = tmplen;
allocated_buf = app_malloc(len, "Signature buffer");
buf = allocated_buf;
@@ -669,7 +669,7 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, int xoflen
EVP_MD_CTX *ctx;
len = xoflen;
if (len > BUFSIZE) {
if (len > OSSL_DGST_BUFSIZE) {
allocated_buf = app_malloc(len, "Digest buffer");
buf = allocated_buf;
}
@@ -681,7 +681,7 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, int xoflen
goto end;
}
} else {
len = BIO_gets(bp, (char *)buf, BUFSIZE);
len = BIO_gets(bp, (char *)buf, OSSL_DGST_BUFSIZE);
if ((int)len < 0)
goto end;
}
@@ -18,7 +18,7 @@
#include "apps.h"
#include "progs.h"
#define BUFSIZE 4096
#define OSSL_FIPS_BUFSIZE 4096
/* Configuration file values */
#define VERSION_KEY "version"
@@ -272,7 +272,7 @@ static int do_mac(EVP_MAC_CTX *ctx, unsigned char *tmp, BIO *in,
goto err;
if (EVP_MAC_CTX_get_mac_size(ctx) > outsz)
goto end;
while ((i = BIO_read(in, (char *)tmp, BUFSIZE)) != 0) {
while ((i = BIO_read(in, (char *)tmp, OSSL_FIPS_BUFSIZE)) != 0) {
if (i < 0 || !EVP_MAC_update(ctx, tmp, i))
goto err;
}
@@ -808,7 +808,7 @@ int fipsinstall_main(int argc, char **argv)
goto end;
}
read_buffer = app_malloc(BUFSIZE, "I/O buffer");
read_buffer = app_malloc(OSSL_FIPS_BUFSIZE, "I/O buffer");
if (read_buffer == NULL)
goto end;
@@ -17,8 +17,8 @@
#include <openssl/params.h>
#include <openssl/core_names.h>
#undef BUFSIZE
#define BUFSIZE 1024*8
#undef OSSL_MAC_BUFSIZE
#define OSSL_MAC_BUFSIZE 1024*8
typedef enum OPTION_choice {
OPT_COMMON,
@@ -91,7 +91,7 @@ int mac_main(int argc, char **argv)
OSSL_PARAM *params = NULL;
prog = opt_init(argc, argv, mac_options);
buf = app_malloc(BUFSIZE, "I/O buffer");
buf = app_malloc(OSSL_MAC_BUFSIZE, "I/O buffer");
while ((o = opt_next()) != OPT_EOF) {
switch (o) {
default:
@@ -183,7 +183,7 @@ opthelp:
}
while (BIO_pending(in) || !BIO_eof(in)) {
i = BIO_read(in, (char *)buf, BUFSIZE);
i = BIO_read(in, (char *)buf, OSSL_MAC_BUFSIZE);
if (i < 0) {
BIO_printf(bio_err, "Read Error in '%s'\n", infile);
ERR_print_errors(bio_err);
@@ -201,12 +201,12 @@ opthelp:
BIO_printf(bio_err, "EVP_MAC_final failed\n");
goto err;
}
if (len > BUFSIZE) {
if (len > OSSL_MAC_BUFSIZE) {
BIO_printf(bio_err, "output len is too large\n");
goto err;
}
if (!EVP_MAC_final(ctx, buf, &len, BUFSIZE)) {
if (!EVP_MAC_final(ctx, buf, &len, OSSL_MAC_BUFSIZE)) {
BIO_printf(bio_err, "EVP_MAC_final failed\n");
goto err;
}
@@ -224,7 +224,7 @@ opthelp:
err:
if (ret != 0)
ERR_print_errors(bio_err);
OPENSSL_clear_free(buf, BUFSIZE);
OPENSSL_clear_free(buf, OSSL_MAC_BUFSIZE);
OPENSSL_free(cipher);
OPENSSL_free(digest);
sk_OPENSSL_STRING_free(opts);
@@ -25,16 +25,16 @@
# if defined(__GNUC__) || defined(__clang__)
# define INLINE_UNUSED __inline__ __attribute__((__unused__,__always_inline__))
# define RESTRICT __restrict__
# define ALIGNED __attribute__((__aligned__(16)))
# define OSSL_ALIGNED __attribute__((__aligned__(16)))
# else
# define INLINE_UNUSED ossl_inline
# define RESTRICT
# define ALIGNED
# define OSSL_ALIGNED
# endif
typedef struct gf_s {
word_t limb[NLIMBS];
} ALIGNED gf_s, gf[1];
} OSSL_ALIGNED gf_s, gf[1];
/* RFC 7748 support */
# define X_PUBLIC_BYTES X_SER_BYTES
@@ -42,6 +42,7 @@
#include "ipcrypto_config.h"
#include <openssl/crypto.h>
#include <vxtss_symlist.h>
#include <taskHookLib.h>
#endif
static int stopped = 0;
@@ -1194,7 +1194,7 @@ int RAND_poll(void)
for (i=0;i<10;i++)
{
if (randPseudoBytes(tmp, sizeof(tmp)) == OK)
if (randPseudoBytes((unsigned char *)tmp, sizeof(tmp)) == OK)
(void)RAND_add(tmp, sizeof(tmp), sizeof(tmp));
else
return 0;
@@ -13,6 +13,7 @@
#include <vxWorks.h>
#include <private/semLibP.h>
#include <openssl/crypto.h>
#include <vxtss.h>
#if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) && defined(OPENSSL_SYS_VXWORKS)
@@ -14,15 +14,15 @@
#include <openssl/buffer.h>
#include <openssl/txt_db.h>
#undef BUFSIZE
#define BUFSIZE 512
#undef OSSL_TXT_DB_BUFSIZE
#define OSSL_TXT_DB_BUFSIZE 512
TXT_DB *TXT_DB_read(BIO *in, int num)
{
TXT_DB *ret = NULL;
int esc = 0;
int i, add, n;
int size = BUFSIZE;
int size = OSSL_TXT_DB_BUFSIZE;
int offset = 0;
char *p, *f;
OPENSSL_STRING *pp;
@@ -54,7 +54,7 @@ TXT_DB *TXT_DB_read(BIO *in, int num)
offset = 0;
for (;;) {
if (offset != 0) {
size += BUFSIZE;
size += OSSL_TXT_DB_BUFSIZE;
if (!BUF_MEM_grow_clean(buf, size))
goto err;
}
@@ -22,7 +22,7 @@
extern const OSSL_DISPATCH ossl_template_asym_kem_functions[];
#define BUFSIZE 1000
#define OSSL_KEM_BUFSIZE 1000
#if defined(NDEBUG) || defined(OPENSSL_NO_STDIO)
static void debug_print(char *fmt, ...)
{
@@ -31,11 +31,11 @@ static void debug_print(char *fmt, ...)
#else
static void debug_print(char *fmt, ...)
{
char out[BUFSIZE];
char out[OSSL_KEM_BUFSIZE];
va_list argptr;
va_start(argptr, fmt);
vsnprintf(out, BUFSIZE, fmt, argptr);
vsnprintf(out, OSSL_KEM_BUFSIZE, fmt, argptr);
va_end(argptr);
if (getenv("TEMPLATEKEM"))
fprintf(stderr, "TEMPLATE_KEM: %s", out);
@@ -24,7 +24,7 @@
extern const OSSL_DISPATCH ossl_template_keymgmt_functions[];
#define BUFSIZE 1000
#define OSSL_KMGMT_BUFSIZE 1000
#if defined(NDEBUG) || defined(OPENSSL_NO_STDIO)
static void debug_print(char *fmt, ...)
{
@@ -32,11 +32,11 @@ static void debug_print(char *fmt, ...)
#else
static void debug_print(char *fmt, ...)
{
char out[BUFSIZE];
char out[OSSL_KMGMT_BUFSIZE];
va_list argptr;
va_start(argptr, fmt);
vsnprintf(out, BUFSIZE, fmt, argptr);
vsnprintf(out, OSSL_KMGMT_BUFSIZE, fmt, argptr);
va_end(argptr);
if (getenv("TEMPLATEKM"))
fprintf(stderr, "TEMPLATE_KM: %s", out);
@@ -0,0 +1,51 @@
#ifndef __IPCOM_PORTING_H__
#define __IPCOM_PORTING_H__
IP_PUBLIC Ip_err ipcom_mutex_create (Ipcom_mutex *mutex);
#if defined(IPCOM_USE_DMALLOC) && defined(IP_PORT_UNIX)
IP_PUBLIC Ip_err ipcom_dmutex_create(Ipcom_mutex *mutex, const char *file, const char *function, Ip_u32 line);
#define ipcom_mutex_create(m) ipcom_dmutex_create(m,__FILE__, __FUNCTION__, __LINE__)
#endif
IP_PUBLIC Ip_err ipcom_mutex_delete (Ipcom_mutex *mutex);
IP_FASTTEXT IP_PUBLIC void ipcom_mutex_unlock (Ipcom_mutex mutex);
IP_FASTTEXT IP_PUBLIC void ipcom_mutex_lock (Ipcom_mutex mutex);
IP_PUBLIC void ipcom_proc_init (void);
IP_PUBLIC unsigned int ipcom_sleep (unsigned int seconds);
#if !defined(IP_PORT_INTEGRITY) || !defined(INT_178B)
IP_PUBLIC void ipcom_proc_exit (void);
#endif
IP_PUBLIC void ipcom_proc_attr_init (Ipcom_proc_attr *attr);
IP_PUBLIC Ip_err ipcom_proc_acreate (const char *name,
#ifdef IP_PORT_LKM
int (*entry)(void* data),
#else
void (*entry)(void),
#endif
const Ipcom_proc_attr *attr,
Ip_pid_t *pidp);
IP_PUBLIC Ip_s32 ipcom_random_seed_state(void);
#ifndef IP_PORT_LKM
#if (!defined(IPCOM_KERNEL) && defined(IPCOM_USRLIB)) || defined(IPCOM_USE_REMOTE_RANDOM)
#define ipcom_random ipcom_random_usr
#endif
#endif
#if defined(IPCOM_RANDOM) && IPCOM_RANDOM != 1
#define ipcom_random IPCOM_RANDOM
#endif
#if (defined(IPCOM_RANDOM) && IPCOM_RANDOM == 1) || defined(IPCOM_USE_CLIB_PROTO)
IP_PUBLIC Ip_u32 ipcom_random(void);
#endif
#endif /* __IPCOM_PORTING_H__ */
@@ -37,7 +37,6 @@
****************************************************************************
*/
/*
****************************************************************************
* 5 DEFINES
@@ -76,6 +75,10 @@ typedef struct _AES_CMAC_CONTEXT
****************************************************************************
*/
int aesCmacBlock(AES_CMAC_CTX *, Ip_u8 *, int, Ip_u8 *, int, Ip_u8 *,int *);
int aesCmacInit(AES_CMAC_CTX *, Ip_u8 *, int);
int aesCmacFinal(AES_CMAC_CTX *, Ip_u8 *, int, Ip_u8*, int*);
/*
****************************************************************************
@@ -38,6 +38,7 @@ modification history
25aug14,ljl Complete openssl layer and cleanup crypto/ssl, US44321
*/
#include <stdlib.h>
#include <ipcom_type.h>
#include <ipcom_cstyle.h>
#include <ipcom_clib.h>
@@ -54,7 +55,7 @@ ipcrypto_key_fingerprint_bubblebabble(UINT8* dgst_raw, unsigned int dgst_raw_len
char *retval;
rounds = (dgst_raw_len / 2) + 1;
retval = ipcom_malloc(sizeof(char) * (rounds*6));
retval = (char *)ipcom_malloc(sizeof(char) * (rounds*6));
if (retval==NULL)
{
IP_PANIC();
@@ -26,6 +26,7 @@
* 3 INCLUDE FILES
****************************************************************************
*/
#include <string.h>
#include <ipcom_type.h>
#include <ipcom_cstyle.h>
#include <ipcom_clib.h>
@@ -43,11 +43,13 @@
#include <openssl/crypto.h>
#include <openssl/err.h>
#include <openssl/rand.h>
#include <openssl/engine.h>
#include "ipcrypto_start.h"
#include "ipcrypto.h"
#include "ipcrypto_util.h"
#include "ipcrypto_config.h"
#include "ipcom_porting.h"
/*
****************************************************************************
@@ -285,7 +287,9 @@ ipcrypto_create(void)
#ifdef IPCOM_USE_DMALLOC
ret = CRYPTO_set_mem_ex_functions(ipcrypto_dmalloc, ipcrypto_drealloc, ipcom_dfree);
#else
ret = CRYPTO_set_mem_functions(ipcom_malloc, ipcom_realloc, ipcom_free);
ret = CRYPTO_set_mem_functions((CRYPTO_malloc_fn)ipcom_malloc, \
(CRYPTO_realloc_fn)ipcom_realloc, \
(CRYPTO_free_fn)ipcom_free);
#endif
(void) ret;
@@ -112,19 +112,19 @@ ipssl_setup_ssl_ctx(SSL_CTX** ssl_ctx, const char* cert_file, const char* key_fi
*ssl_ctx = SSL_CTX_new(ssl_method);
if(!*ssl_ctx)
{
(void)ipcom_fprintf(ip_stderr, "SSL_CTX_new() failed"IP_LF);
(void)ipcom_fprintf((FILE *)ip_stderr, "SSL_CTX_new() failed"IP_LF);
return IPCOM_ERR_FAILED;
}
if(!cert_file || !key_file)
return IPCOM_SUCCESS;
if(SSL_CTX_use_certificate_chain_file(*ssl_ctx, cert_file) != 1)
{
(void)ipcom_fprintf(ip_stderr, "Failed to load cert file, %s"IP_LF, cert_file);
(void)ipcom_fprintf((FILE *)ip_stderr, "Failed to load cert file, %s"IP_LF, cert_file);
return IPCOM_ERR_FAILED;
}
if(SSL_CTX_use_PrivateKey_file(*ssl_ctx,key_file, SSL_FILETYPE_PEM) != 1)
{
(void)ipcom_fprintf(ip_stderr, "Failed to load key file, %s"IP_LF, key_file);
(void)ipcom_fprintf((FILE *)ip_stderr, "Failed to load key file, %s"IP_LF, key_file);
return IPCOM_ERR_FAILED;
}
@@ -321,7 +321,7 @@ ipssl_cmd_ssl_clt(int argc, char** argv)
}
if(!cmd_args.addr)
{
(void)ipcom_fprintf(ip_stderr, "No addr specified. Use -a"IP_LF);
(void)ipcom_fprintf((FILE *)ip_stderr, "No addr specified. Use -a"IP_LF);
return IPCOM_ERR_FAILED;
}
@@ -331,14 +331,14 @@ ipssl_cmd_ssl_clt(int argc, char** argv)
{
if(!SSL_CTX_set_cipher_list(ssl_ctx,cmd_args.ciphers))
{
(void)ipcom_fprintf(ip_stderr, "Failed to set cipher : %s"IP_LF, cmd_args.ciphers);
(void)ipcom_fprintf((FILE *)ip_stderr, "Failed to set cipher : %s"IP_LF, cmd_args.ciphers);
goto cleanup;
}
}
ipcom_memset(&addr, 0, sizeof(addr));
if(ipcom_getaddrinfo(cmd_args.addr, NULL, NULL, &addrinfo) != IPCOM_SUCCESS)
{
(void)ipcom_fprintf(ip_stderr, "bad addr argument: %s"IP_LF, cmd_args.addr);
(void)ipcom_fprintf((FILE *)ip_stderr, "bad addr argument: %s"IP_LF, cmd_args.addr);
goto cleanup;
}
ipcom_memcpy(&addr.sa, addrinfo->ai_addr, addrinfo->ai_addrlen);
@@ -347,20 +347,20 @@ ipssl_cmd_ssl_clt(int argc, char** argv)
sock = socket(addrinfo->ai_family, SOCK_STREAM, 0);
if(sock == IP_INVALID_SOCKET)
{
(void)ipcom_fprintf(ip_stderr, "socket() failed: errno=%d"IP_LF, ipcom_errno);
(void)ipcom_fprintf((FILE *)ip_stderr, "socket() failed: errno=%d"IP_LF, ipcom_errno);
goto cleanup;
}
if(connect(sock, &addr.sa, IPCOM_SA_LEN_GET(&addr.sa)) != IPCOM_SUCCESS)
{
(void)ipcom_fprintf(ip_stderr, "connect() failed: errno=%d"IP_LF, ipcom_errno);
(void)ipcom_fprintf((FILE *)ip_stderr, "connect() failed: errno=%d"IP_LF, ipcom_errno);
goto cleanup;
}
ssl = SSL_new(ssl_ctx);
if(!ssl)
{
(void)ipcom_fprintf(ip_stderr, "SSL_new() failed"IP_LF);
(void)ipcom_fprintf((FILE *)ip_stderr, "SSL_new() failed"IP_LF);
goto cleanup;
}
@@ -368,14 +368,14 @@ ipssl_cmd_ssl_clt(int argc, char** argv)
SSL_set_connect_state(ssl);
if(SSL_do_handshake(ssl) != 1)
{
(void)ipcom_fprintf(ip_stderr, "SSL_do_handshake() failed"IP_LF);
(void)ipcom_fprintf((FILE *)ip_stderr, "SSL_do_handshake() failed"IP_LF);
goto cleanup;
}
buf = ipcom_malloc((size_t) (cmd_args.l));
if(!buf)
{
(void)ipcom_fprintf(ip_stderr, "Out of memory"IP_LF);
(void)ipcom_fprintf((FILE *)ip_stderr, "Out of memory"IP_LF);
goto cleanup;
}
@@ -388,7 +388,7 @@ ipssl_cmd_ssl_clt(int argc, char** argv)
goto cleanup;
}
}
ipcom_microtime(&start_time);
ipcom_microtime((struct Ip_timeval *)&start_time);
for(i=0;cmd_args.t>0 || (cmd_args.n>0 && i<cmd_args.n);i++)
{
@@ -398,7 +398,7 @@ ipssl_cmd_ssl_clt(int argc, char** argv)
if (ipcom_errno == IP_ERRNO_EINTR)
break;
(void)ipcom_fprintf(ip_stderr, "SSL_write() failed, i=%d"IP_LF, i);
(void)ipcom_fprintf((FILE *)ip_stderr, "SSL_write() failed, i=%d"IP_LF, i);
goto cleanup;
}
if(cmd_args.echo_data)
@@ -408,24 +408,24 @@ ipssl_cmd_ssl_clt(int argc, char** argv)
{
if (ipcom_errno == IP_ERRNO_EINTR)
break;
(void)ipcom_fprintf(ip_stderr, "SSL_read() failed, i=%d"IP_LF, i);
(void)ipcom_fprintf((FILE *)ip_stderr, "SSL_read() failed, i=%d"IP_LF, i);
goto cleanup;
}
}
}
ipcom_microtime(&stop_time);
ipcom_microtime((struct Ip_timeval *)&stop_time);
msec = ipssl_get_elapsed_msecs(&start_time, &stop_time);
if (msec > 0 && i > 0)
{
if(cmd_args.echo_data)
{
(void)ipcom_fprintf(ip_stderr, "Echoed %d pkt/sec, %d Kbytes/sec (%d bytes (%d*%d) in %d msecs),"IP_LF,
(void)ipcom_fprintf((FILE *)ip_stderr, "Echoed %d pkt/sec, %d Kbytes/sec (%d bytes (%d*%d) in %d msecs),"IP_LF,
i*1000/msec, cmd_args.l*i/msec*1000/1024,
cmd_args.l*i, cmd_args.l, i, msec);
}
else
{
(void)ipcom_fprintf(ip_stderr, "Wrote %d pkt/sec, %d Kbytes/sec (%d bytes (%d*%d) in %d msecs),"IP_LF,
(void)ipcom_fprintf((FILE *)ip_stderr, "Wrote %d pkt/sec, %d Kbytes/sec (%d bytes (%d*%d) in %d msecs),"IP_LF,
i*1000/msec, cmd_args.l*i/msec*1000/1024,
cmd_args.l*i, cmd_args.l, i, msec);
}
@@ -487,7 +487,7 @@ ipssl_cmd_ssl_srv(int argc, char** argv)
}
if(!cmd_args.key_file || !cmd_args.cert_file)
{
(void)ipcom_fprintf(ip_stderr, "Key and certificate files must be specified"IP_LF);
(void)ipcom_fprintf((FILE *)ip_stderr, "Key and certificate files must be specified"IP_LF);
goto cleanup;
}
if(ipssl_setup_ssl_ctx(&ssl_ctx, cmd_args.cert_file, cmd_args.key_file, SSLv23_server_method()) != IPCOM_SUCCESS)
@@ -506,51 +506,51 @@ ipssl_cmd_ssl_srv(int argc, char** argv)
sock = socket(addr.sa.sa_family, SOCK_STREAM, 0);
if(sock == IP_INVALID_SOCKET)
{
(void)ipcom_fprintf(ip_stderr, "socket() failed: errno=%d"IP_LF, ipcom_errno);
(void)ipcom_fprintf((FILE *)ip_stderr, "socket() failed: errno=%d"IP_LF, ipcom_errno);
goto cleanup;
}
if( setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*) &on, sizeof(on)) )
{
(void)ipcom_fprintf(ip_stderr, "setsockopt(SO_REUSEADDR) failed, error=%d", ipcom_errno);
(void)ipcom_fprintf((FILE *)ip_stderr, "setsockopt(SO_REUSEADDR) failed, error=%d", ipcom_errno);
goto cleanup;
}
if(bind(sock, &addr.sa, IPCOM_SA_LEN_GET(&addr.sa)) != IPCOM_SUCCESS)
{
(void)ipcom_fprintf(ip_stderr, "bind() failed: errno=%d"IP_LF, ipcom_errno);
(void)ipcom_fprintf((FILE *)ip_stderr, "bind() failed: errno=%d"IP_LF, ipcom_errno);
goto cleanup;
}
if(listen(sock, 5) != IPCOM_SUCCESS)
{
(void)ipcom_fprintf(ip_stderr, "listen() failed: errno=%d"IP_LF, ipcom_errno);
(void)ipcom_fprintf((FILE *)ip_stderr, "listen() failed: errno=%d"IP_LF, ipcom_errno);
goto cleanup;
}
ssl = SSL_new(ssl_ctx);
if(!ssl)
{
(void)ipcom_fprintf(ip_stderr, "SSL_new() failed"IP_LF);
(void)ipcom_fprintf((FILE *)ip_stderr, "SSL_new() failed"IP_LF);
goto cleanup;
}
(void)ipcom_fprintf(ip_stderr, "accept:"IP_LF);
(void)ipcom_fprintf((FILE *)ip_stderr, "accept:"IP_LF);
sock2 = accept(sock, NULL, NULL);
buf = ipcom_malloc(IPSSL_CMD_BUF_SIZE);
if(!buf)
{
(void)ipcom_fprintf(ip_stderr, "Out of memory"IP_LF);
(void)ipcom_fprintf((FILE *)ip_stderr, "Out of memory"IP_LF);
goto cleanup;
}
if(sock2 == IP_INVALID_SOCKET)
{
(void)ipcom_fprintf(ip_stderr, "accept() failed, errno=%d"IP_LF, ipcom_errno);
(void)ipcom_fprintf((FILE *)ip_stderr, "accept() failed, errno=%d"IP_LF, ipcom_errno);
goto cleanup;
}
SSL_set_accept_state(ssl);
SSL_set_fd(ssl, sock2);
if(SSL_do_handshake(ssl) != 1)
{
(void)ipcom_fprintf(ip_stderr, "SSL_do_handshake() failed"IP_LF);
(void)ipcom_fprintf((FILE *)ip_stderr, "SSL_do_handshake() failed"IP_LF);
goto cleanup;
}
@@ -563,14 +563,14 @@ ipssl_cmd_ssl_srv(int argc, char** argv)
if(ret_val < 0)
{
(void)ipcom_fprintf(ip_stderr, "SSL_read() failed, i=%d, errno=%d"IP_LF, i, ipcom_errno);
(void)ipcom_fprintf((FILE *)ip_stderr, "SSL_read() failed, i=%d, errno=%d"IP_LF, i, ipcom_errno);
goto cleanup;
}
if(cmd_args.echo_data)
{
if(SSL_write(ssl, buf, ret_val) != ret_val)
{
(void)ipcom_fprintf(ip_stderr, "SSL_write() failed, i=%d"IP_LF, i);
(void)ipcom_fprintf((FILE *)ip_stderr, "SSL_write() failed, i=%d"IP_LF, i);
goto cleanup;
}
}
@@ -51,7 +51,7 @@ static int vxRandLibSeed(const void *buf, int num)
{
fill_random_bytes ((uint8_t *)buf, num);
srand (buf);
srand ((unsigned int)buf);
return OK;
}
@@ -70,7 +70,7 @@ static void vxRandLibCleanup(void)
static int vxRandLibAdd(const void *buf, int num, double entropy)
{
fill_random_bytes ((uint8_t *)buf, num);
srand (buf);
srand ((unsigned int)buf);
return OK;
}