commit
b2af02a783
@ -166,7 +166,7 @@ int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
#ifndef NO_SESSION_CACHE
|
||||
int benchResume = resumeSession && loops == 0;
|
||||
#endif
|
||||
double start = current_time(), avg;
|
||||
double start = current_time(1), avg;
|
||||
|
||||
for (i = 0; i < times; i++) {
|
||||
SOCKET_T sockfd;
|
||||
@ -195,7 +195,7 @@ int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
wolfSSL_free(ssl);
|
||||
CloseSocket(sockfd);
|
||||
}
|
||||
avg = current_time() - start;
|
||||
avg = current_time(0) - start;
|
||||
avg /= times;
|
||||
avg *= 1000; /* milliseconds */
|
||||
#ifndef NO_SESSION_CACHE
|
||||
@ -217,7 +217,7 @@ int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
WOLFSSL* ssl;
|
||||
int ret;
|
||||
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
ssl = wolfSSL_new(ctx);
|
||||
if (ssl == NULL)
|
||||
err_sys("unable to get SSL object");
|
||||
@ -230,7 +230,7 @@ int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
char *tx_buffer, *rx_buffer;
|
||||
|
||||
/* Record connection time */
|
||||
conn_time = current_time() - start;
|
||||
conn_time = current_time(0) - start;
|
||||
|
||||
/* Allocate TX/RX buffers */
|
||||
tx_buffer = (char*)malloc(TEST_BUFFER_SIZE);
|
||||
@ -259,18 +259,18 @@ int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
len = min(TEST_BUFFER_SIZE, throughput - xfer_bytes);
|
||||
|
||||
/* Perform TX */
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
if (wolfSSL_write(ssl, tx_buffer, len) != len) {
|
||||
int writeErr = wolfSSL_get_error(ssl, 0);
|
||||
printf("wolfSSL_write error %d!\n", writeErr);
|
||||
err_sys("wolfSSL_write failed");
|
||||
}
|
||||
tx_time += current_time() - start;
|
||||
tx_time += current_time(0) - start;
|
||||
|
||||
/* Perform RX */
|
||||
select_ret = tcp_select(sockfd, 1); /* Timeout=1 second */
|
||||
if (select_ret == TEST_RECV_READY) {
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
rx_pos = 0;
|
||||
while(rx_pos < len) {
|
||||
ret = wolfSSL_read(ssl, &rx_buffer[rx_pos], len - rx_pos);
|
||||
@ -285,7 +285,7 @@ int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
rx_pos += ret;
|
||||
}
|
||||
}
|
||||
rx_time += current_time() - start;
|
||||
rx_time += current_time(0) - start;
|
||||
}
|
||||
|
||||
/* Compare TX and RX buffers */
|
||||
|
@ -139,7 +139,7 @@ int ServerEchoData(SSL* ssl, int clientfd, int echoData, int throughput)
|
||||
int len = min(TEST_BUFFER_SIZE, throughput - xfer_bytes);
|
||||
int rx_pos = 0;
|
||||
if(throughput) {
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
}
|
||||
while(rx_pos < len) {
|
||||
ret = SSL_read(ssl, &buffer[rx_pos], len - rx_pos);
|
||||
@ -155,14 +155,14 @@ int ServerEchoData(SSL* ssl, int clientfd, int echoData, int throughput)
|
||||
}
|
||||
}
|
||||
if(throughput) {
|
||||
rx_time += current_time() - start;
|
||||
start = current_time();
|
||||
rx_time += current_time(0) - start;
|
||||
start = current_time(1);
|
||||
}
|
||||
if (SSL_write(ssl, buffer, len) != len) {
|
||||
err_sys("SSL_write failed");
|
||||
}
|
||||
if(throughput) {
|
||||
tx_time += current_time() - start;
|
||||
tx_time += current_time(0) - start;
|
||||
}
|
||||
|
||||
xfer_bytes += len;
|
||||
|
@ -15434,16 +15434,12 @@ int wolfSSL_EC_GROUP_get_degree(const WOLFSSL_EC_GROUP *group)
|
||||
switch(group->curve_nid) {
|
||||
case NID_X9_62_prime256v1:
|
||||
return 256;
|
||||
break;
|
||||
case NID_secp384r1:
|
||||
return 384;
|
||||
break;
|
||||
case NID_secp521r1:
|
||||
return 521;
|
||||
break;
|
||||
default :
|
||||
return SSL_FAILURE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2080,7 +2080,7 @@ int poly1305_test(void)
|
||||
byte tag[16];
|
||||
Poly1305 enc;
|
||||
|
||||
const byte msg[] =
|
||||
static const byte msg[] =
|
||||
{
|
||||
0x43,0x72,0x79,0x70,0x74,0x6f,0x67,0x72,
|
||||
0x61,0x70,0x68,0x69,0x63,0x20,0x46,0x6f,
|
||||
@ -2089,13 +2089,13 @@ int poly1305_test(void)
|
||||
0x75,0x70
|
||||
};
|
||||
|
||||
const byte msg2[] =
|
||||
static const byte msg2[] =
|
||||
{
|
||||
0x48,0x65,0x6c,0x6c,0x6f,0x20,0x77,0x6f,0x72,
|
||||
0x6c,0x64,0x21
|
||||
};
|
||||
|
||||
const byte msg3[] =
|
||||
static const byte msg3[] =
|
||||
{
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
@ -2103,7 +2103,7 @@ int poly1305_test(void)
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
};
|
||||
|
||||
const byte msg4[] =
|
||||
static const byte msg4[] =
|
||||
{
|
||||
0xd3,0x1a,0x8d,0x34,0x64,0x8e,0x60,0xdb,
|
||||
0x7b,0x86,0xaf,0xbc,0x53,0xef,0x7e,0xc2,
|
||||
@ -2128,46 +2128,46 @@ int poly1305_test(void)
|
||||
0xc4,0xc5,0xc6,0xc7
|
||||
};
|
||||
|
||||
const byte correct[] =
|
||||
static const byte correct[] =
|
||||
{
|
||||
0xa8,0x06,0x1d,0xc1,0x30,0x51,0x36,0xc6,
|
||||
0xc2,0x2b,0x8b,0xaf,0x0c,0x01,0x27,0xa9
|
||||
|
||||
};
|
||||
|
||||
const byte correct2[] =
|
||||
static const byte correct2[] =
|
||||
{
|
||||
0xa6,0xf7,0x45,0x00,0x8f,0x81,0xc9,0x16,
|
||||
0xa2,0x0d,0xcc,0x74,0xee,0xf2,0xb2,0xf0
|
||||
};
|
||||
|
||||
const byte correct3[] =
|
||||
static const byte correct3[] =
|
||||
{
|
||||
0x49,0xec,0x78,0x09,0x0e,0x48,0x1e,0xc6,
|
||||
0xc2,0x6b,0x33,0xb9,0x1c,0xcc,0x03,0x07
|
||||
};
|
||||
|
||||
const byte correct4[] =
|
||||
static const byte correct4[] =
|
||||
{
|
||||
0x1a,0xe1,0x0b,0x59,0x4f,0x09,0xe2,0x6a,
|
||||
0x7e,0x90,0x2e,0xcb,0xd0,0x60,0x06,0x91
|
||||
};
|
||||
|
||||
const byte key[] = {
|
||||
static const byte key[] = {
|
||||
0x85,0xd6,0xbe,0x78,0x57,0x55,0x6d,0x33,
|
||||
0x7f,0x44,0x52,0xfe,0x42,0xd5,0x06,0xa8,
|
||||
0x01,0x03,0x80,0x8a,0xfb,0x0d,0xb2,0xfd,
|
||||
0x4a,0xbf,0xf6,0xaf,0x41,0x49,0xf5,0x1b
|
||||
};
|
||||
|
||||
const byte key2[] = {
|
||||
static const byte key2[] = {
|
||||
0x74,0x68,0x69,0x73,0x20,0x69,0x73,0x20,
|
||||
0x33,0x32,0x2d,0x62,0x79,0x74,0x65,0x20,
|
||||
0x6b,0x65,0x79,0x20,0x66,0x6f,0x72,0x20,
|
||||
0x50,0x6f,0x6c,0x79,0x31,0x33,0x30,0x35
|
||||
};
|
||||
|
||||
const byte key4[] = {
|
||||
static const byte key4[] = {
|
||||
0x7b,0xac,0x2b,0x25,0x2d,0xb4,0x47,0xaf,
|
||||
0x09,0xb6,0x7a,0x55,0xa4,0xe9,0x55,0x84,
|
||||
0x0a,0xe1,0xd6,0x73,0x10,0x75,0xd9,0xeb,
|
||||
|
@ -1007,14 +1007,16 @@ static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity,
|
||||
#if !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_KEIL_TCP_NET)
|
||||
#include <sys/time.h>
|
||||
|
||||
static INLINE double current_time(void)
|
||||
static INLINE double current_time(int reset)
|
||||
{
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, 0);
|
||||
|
||||
(void)reset;
|
||||
|
||||
return (double)tv.tv_sec + (double)tv.tv_usec / 1000000;
|
||||
}
|
||||
|
||||
#else
|
||||
extern double current_time(int reset);
|
||||
#endif
|
||||
#endif /* USE_WINDOWS_API */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user