Windows doesn't have ssize_t, sadly. There's SSIZE_T, but defining an OPENSSL_SSIZE_T seems worse than just using an int. Change-Id: I09bb5aa03f96da78b619e551f92ed52ce24d9f3f Reviewed-on: https://boringssl-review.googlesource.com/1352 Reviewed-by: Adam Langley <agl@google.com>kris/onging/CECPQ3_patch15
@@ -4,7 +4,7 @@ if(APPLE) | |||
set(PERLASM_STYLE macosx) | |||
set(ASM_EXT S) | |||
enable_language(ASM) | |||
else(UNIX) | |||
elseif(UNIX) | |||
set(PERLASM_STYLE elf) | |||
set(ASM_EXT S) | |||
enable_language(ASM) | |||
@@ -587,6 +587,7 @@ ___ | |||
$code.=<<___; | |||
.align 16 | |||
.globl asm_AES_encrypt | |||
.type asm_AES_encrypt,\@function,3 | |||
.hidden asm_AES_encrypt | |||
asm_AES_encrypt: | |||
push %rbx | |||
@@ -1182,6 +1183,7 @@ ___ | |||
$code.=<<___; | |||
.align 16 | |||
.globl asm_AES_decrypt | |||
.type asm_AES_decrypt,\@function,3 | |||
.hidden asm_AES_decrypt | |||
asm_AES_decrypt: | |||
push %rbx | |||
@@ -1280,6 +1282,7 @@ ___ | |||
$code.=<<___; | |||
.align 16 | |||
.globl asm_AES_set_encrypt_key | |||
.type asm_AES_set_encrypt_key,\@function,3 | |||
asm_AES_set_encrypt_key: | |||
push %rbx | |||
push %rbp | |||
@@ -1544,6 +1547,7 @@ ___ | |||
$code.=<<___; | |||
.align 16 | |||
.globl asm_AES_set_decrypt_key | |||
.type asm_AES_set_decrypt_key,\@function,3 | |||
asm_AES_set_decrypt_key: | |||
push %rbx | |||
push %rbp | |||
@@ -1636,8 +1640,9 @@ my $mark="80+240(%rsp)"; # copy of aes_key->rounds | |||
$code.=<<___; | |||
.align 16 | |||
.extern OPENSSL_ia32cap_P | |||
.globl asm_AES_cbc_encrypt | |||
.type asm_AES_cbc_encrypt,\@function,6 | |||
.extern OPENSSL_ia32cap_P | |||
.hidden asm_AES_cbc_encrypt | |||
asm_AES_cbc_encrypt: | |||
cmp \$0,%rdx # check length | |||
@@ -2749,45 +2754,45 @@ cbc_se_handler: | |||
.section .pdata | |||
.align 4 | |||
.rva .LSEH_begin_AES_encrypt | |||
.rva .LSEH_end_AES_encrypt | |||
.rva .LSEH_info_AES_encrypt | |||
.rva .LSEH_begin_asm_AES_encrypt | |||
.rva .LSEH_end_asm_AES_encrypt | |||
.rva .LSEH_info_asm_AES_encrypt | |||
.rva .LSEH_begin_AES_decrypt | |||
.rva .LSEH_end_AES_decrypt | |||
.rva .LSEH_info_AES_decrypt | |||
.rva .LSEH_begin_asm_AES_decrypt | |||
.rva .LSEH_end_asm_AES_decrypt | |||
.rva .LSEH_info_asm_AES_decrypt | |||
.rva .LSEH_begin_AES_set_encrypt_key | |||
.rva .LSEH_end_AES_set_encrypt_key | |||
.rva .LSEH_info_AES_set_encrypt_key | |||
.rva .LSEH_begin_asm_AES_set_encrypt_key | |||
.rva .LSEH_end_asm_AES_set_encrypt_key | |||
.rva .LSEH_info_asm_AES_set_encrypt_key | |||
.rva .LSEH_begin_AES_set_decrypt_key | |||
.rva .LSEH_end_AES_set_decrypt_key | |||
.rva .LSEH_info_AES_set_decrypt_key | |||
.rva .LSEH_begin_asm_AES_set_decrypt_key | |||
.rva .LSEH_end_asm_AES_set_decrypt_key | |||
.rva .LSEH_info_asm_AES_set_decrypt_key | |||
.rva .LSEH_begin_AES_cbc_encrypt | |||
.rva .LSEH_end_AES_cbc_encrypt | |||
.rva .LSEH_info_AES_cbc_encrypt | |||
.rva .LSEH_begin_asm_AES_cbc_encrypt | |||
.rva .LSEH_end_asm_AES_cbc_encrypt | |||
.rva .LSEH_info_asm_AES_cbc_encrypt | |||
.section .xdata | |||
.align 8 | |||
.LSEH_info_AES_encrypt: | |||
.LSEH_info_asm_AES_encrypt: | |||
.byte 9,0,0,0 | |||
.rva block_se_handler | |||
.rva .Lenc_prologue,.Lenc_epilogue # HandlerData[] | |||
.LSEH_info_AES_decrypt: | |||
.LSEH_info_asm_AES_decrypt: | |||
.byte 9,0,0,0 | |||
.rva block_se_handler | |||
.rva .Ldec_prologue,.Ldec_epilogue # HandlerData[] | |||
.LSEH_info_AES_set_encrypt_key: | |||
.LSEH_info_asm_AES_set_encrypt_key: | |||
.byte 9,0,0,0 | |||
.rva key_se_handler | |||
.rva .Lenc_key_prologue,.Lenc_key_epilogue # HandlerData[] | |||
.LSEH_info_AES_set_decrypt_key: | |||
.LSEH_info_asm_AES_set_decrypt_key: | |||
.byte 9,0,0,0 | |||
.rva key_se_handler | |||
.rva .Ldec_key_prologue,.Ldec_key_epilogue # HandlerData[] | |||
.LSEH_info_AES_cbc_encrypt: | |||
.LSEH_info_asm_AES_cbc_encrypt: | |||
.byte 9,0,0,0 | |||
.rva cbc_se_handler | |||
___ | |||
@@ -57,6 +57,7 @@ | |||
#include <openssl/base64.h> | |||
#include <assert.h> | |||
#include <limits.h> | |||
static const unsigned char data_bin2ascii[65] = | |||
@@ -358,7 +359,7 @@ int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, uint8_t *out, int *outl) { | |||
} | |||
} | |||
ssize_t EVP_DecodeBlock(uint8_t *dst, const uint8_t *src, size_t src_len) { | |||
int EVP_DecodeBlock(uint8_t *dst, const uint8_t *src, size_t src_len) { | |||
int a, b, c, d; | |||
uint32_t l; | |||
size_t i, ret = 0; | |||
@@ -395,5 +396,9 @@ ssize_t EVP_DecodeBlock(uint8_t *dst, const uint8_t *src, size_t src_len) { | |||
ret += 3; | |||
} | |||
if (ret > INT_MAX) { | |||
return -1; | |||
} | |||
return ret; | |||
} |
@@ -68,6 +68,7 @@ typedef unsigned short u_short; | |||
#include <sys/socket.h> | |||
#else | |||
#include <WinSock2.h> | |||
#include <WS2tcpip.h> | |||
#endif | |||
#if defined(__cplusplus) | |||
@@ -147,7 +147,7 @@ int DH_generate_key(DH *dh) { | |||
return DH_default_method.generate_key(dh); | |||
} | |||
ssize_t DH_compute_key(unsigned char *out, const BIGNUM *peers_key, DH *dh) { | |||
int DH_compute_key(unsigned char *out, const BIGNUM *peers_key, DH *dh) { | |||
if (dh->meth->compute_key) { | |||
return dh->meth->compute_key(dh, out, peers_key); | |||
} | |||
@@ -252,7 +252,7 @@ err: | |||
return ok; | |||
} | |||
static ssize_t compute_key(DH *dh, unsigned char *out, const BIGNUM *pub_key) { | |||
static int compute_key(DH *dh, unsigned char *out, const BIGNUM *pub_key) { | |||
BN_CTX *ctx = NULL; | |||
BN_MONT_CTX *mont = NULL; | |||
BIGNUM *shared_key; | |||
@@ -64,6 +64,10 @@ | |||
#include <stdio.h> | |||
#include <string.h> | |||
#if defined(OPENSSL_WINDOWS) | |||
#include <Windows.h> | |||
#endif | |||
void *OPENSSL_realloc_clean(void *ptr, size_t old_size, size_t new_size) { | |||
void *ret = NULL; | |||
@@ -94,15 +98,15 @@ void *OPENSSL_realloc_clean(void *ptr, size_t old_size, size_t new_size) { | |||
} | |||
void OPENSSL_cleanse(void *ptr, size_t len) { | |||
memset(ptr, 0, len); | |||
#if defined(OPENSSL_WINDOWS) | |||
SecureZeroMemory(ptr, len); | |||
#else | |||
memset(ptr, 0, len); | |||
#if !defined(OPENSSL_NO_ASM) | |||
/* As best as we can tell, this is sufficient to break any optimisations that | |||
might try to eliminate "superfluous" memsets. If there's an easy way to | |||
detect memset_s, it would be better to use that. */ | |||
#if defined(OPENSSL_WINDOWS) | |||
__asm; | |||
#else | |||
__asm__ __volatile__("" : : "r"(ptr) : "memory"); | |||
#endif | |||
#endif /* !OPENSSL_NO_ASM */ | |||
@@ -155,7 +159,7 @@ size_t OPENSSL_strnlen(const char *s, size_t len) { | |||
#if defined(OPENSSL_WINDOWS) | |||
int OPENSSL_strcasecmp(const char *a, const char *b) { | |||
return _stricmp(a, b, n); | |||
return _stricmp(a, b); | |||
} | |||
int OPENSSL_strncasecmp(const char *a, const char *b, size_t n) { | |||
@@ -918,7 +918,13 @@ while($line=<>) { | |||
} | |||
@args = reverse(@args); | |||
undef $sz if ($nasm && $opcode->mnemonic() eq "lea"); | |||
printf "\t%s\t%s",$insn,join(",",map($_->out($sz),@args)); | |||
if ($insn eq "movq" && $#args == 1 && $args[0]->out($sz) eq "xmm0" && $args[1]->out($sz) eq "rax") { | |||
# I have no clue why MASM can't parse this instruction. | |||
printf "DB 66h, 48h, 0fh, 6eh, 0c0h"; | |||
} else { | |||
printf "\t%s\t%s",$insn,join(",",map($_->out($sz),@args)); | |||
} | |||
} | |||
} else { | |||
printf "\t%s",$opcode->out(); | |||
@@ -645,20 +645,20 @@ key_se_handler: | |||
.section .pdata | |||
.align 4 | |||
.rva .LSEH_begin_RC4 | |||
.rva .LSEH_end_RC4 | |||
.rva .LSEH_info_RC4 | |||
.rva .LSEH_begin_asm_RC4 | |||
.rva .LSEH_end_asm_RC4 | |||
.rva .LSEH_info_asm_RC4 | |||
.rva .LSEH_begin_RC4_set_key | |||
.rva .LSEH_end_RC4_set_key | |||
.rva .LSEH_info_RC4_set_key | |||
.rva .LSEH_begin_asm_RC4_set_key | |||
.rva .LSEH_end_asm_RC4_set_key | |||
.rva .LSEH_info_asm_RC4_set_key | |||
.section .xdata | |||
.align 8 | |||
.LSEH_info_RC4: | |||
.LSEH_info_asm_RC4: | |||
.byte 9,0,0,0 | |||
.rva stream_se_handler | |||
.LSEH_info_RC4_set_key: | |||
.LSEH_info_asm_RC4_set_key: | |||
.byte 9,0,0,0 | |||
.rva key_se_handler | |||
___ | |||
@@ -163,7 +163,7 @@ void CRYPTO_THREADID_current(CRYPTO_THREADID *id) { | |||
return; | |||
} | |||
#if defined(OPENSSL_SYS_WIN32) | |||
#if defined(OPENSSL_WINDOWS) | |||
CRYPTO_THREADID_set_numeric(id, (unsigned long)GetCurrentThreadId()); | |||
#else | |||
/* For everything else, default to using the address of 'errno' */ | |||
@@ -65,7 +65,7 @@ | |||
struct tm *OPENSSL_gmtime(const time_t *time, struct tm *result) { | |||
#if defined(OPENSSL_WINDOWS) | |||
if (_gmtime_s(result, time)) { | |||
if (gmtime_s(result, time)) { | |||
return NULL; | |||
} | |||
return result; | |||
@@ -89,7 +89,7 @@ | |||
#define OPENSSL_APPLE | |||
#endif | |||
#if defined(WIN32) | |||
#if defined(WIN32) || defined(_WIN32) | |||
#define OPENSSL_WINDOWS | |||
#endif | |||
@@ -134,9 +134,8 @@ OPENSSL_EXPORT int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, uint8_t *out, | |||
* | |||
* WARNING: EVP_DecodeBlock's return value does not take padding into | |||
* account. TODO(davidben): Possible or worth it to fix or add new API? */ | |||
OPENSSL_EXPORT ssize_t | |||
EVP_DecodeBlock(uint8_t *dst, const uint8_t *src, size_t src_len); | |||
OPENSSL_EXPORT int EVP_DecodeBlock(uint8_t *dst, const uint8_t *src, | |||
size_t src_len); | |||
struct evp_encode_ctx_st { | |||
unsigned num; /* number saved in a partial encode/decode */ | |||
@@ -127,8 +127,8 @@ OPENSSL_EXPORT int DH_generate_key(DH *dh); | |||
* writes it as a big-endian integer into |out|, which must have |DH_size| | |||
* bytes of space. It returns the number of bytes written, or a negative number | |||
* on error. */ | |||
OPENSSL_EXPORT ssize_t | |||
DH_compute_key(uint8_t *out, const BIGNUM *peers_key, DH *dh); | |||
OPENSSL_EXPORT int DH_compute_key(uint8_t *out, const BIGNUM *peers_key, | |||
DH *dh); | |||
/* Utility functions. */ | |||
@@ -217,8 +217,8 @@ struct dh_method { | |||
/* generate_parameters is called by |DH_generate_key|. */ | |||
int (*generate_key)(DH *dh); | |||
/* generate_parameters is called by |DH_compute_key|. */ | |||
ssize_t (*compute_key)(DH *dh, uint8_t *out, const BIGNUM *pub_key); | |||
/* compute_key is called by |DH_compute_key|. */ | |||
int (*compute_key)(DH *dh, uint8_t *out, const BIGNUM *pub_key); | |||
}; | |||
struct dh_st { | |||
@@ -53,30 +53,20 @@ | |||
* | |||
* This product includes cryptographic software written by Eric Young | |||
* (eay@cryptsoft.com). This product includes software written by Tim | |||
* Hudson (tjh@cryptsoft.com). | |||
* | |||
*/ | |||
* Hudson (tjh@cryptsoft.com). */ | |||
#ifndef HEADER_DTLS1_H | |||
#define HEADER_DTLS1_H | |||
#include <openssl/base.h> | |||
#include <openssl/buf.h> | |||
#include <openssl/pqueue.h> | |||
#if defined(OPENSSL_WINDOWS) | |||
/* Including winsock.h pollutes the namespace too much with defines for | |||
* X509_NAME etc. */ | |||
typedef struct timeval { | |||
long tv_sec; | |||
long tv_usec; | |||
} timeval; | |||
#else | |||
#include <sys/time.h> | |||
#endif | |||
#ifdef __cplusplus | |||
extern "C" { | |||
#endif | |||
#define DTLS1_VERSION 0xFEFF | |||
#define DTLS1_BAD_VER 0x0100 | |||
#define DTLS1_2_VERSION 0xFEFD | |||
@@ -108,6 +98,19 @@ extern "C" { | |||
#ifndef OPENSSL_NO_SSL_INTERN | |||
#if defined(OPENSSL_WINDOWS) | |||
/* Because of Windows header issues, we can't get the normal declaration of | |||
* timeval. */ | |||
typedef struct OPENSSL_timeval_st { | |||
long tv_sec; | |||
long tv_usec; | |||
} OPENSSL_timeval; | |||
#else | |||
#include <sys/time.h> | |||
typedef struct timeval OPENSSL_timeval; | |||
#endif | |||
typedef struct dtls1_bitmap_st | |||
{ | |||
unsigned long map; /* track 32 packets on 32-bit systems | |||
@@ -223,8 +226,10 @@ typedef struct dtls1_state_st | |||
struct dtls1_timeout_st timeout; | |||
/* Indicates when the last handshake msg or heartbeat sent will timeout */ | |||
struct timeval next_timeout; | |||
/* Indicates when the last handshake msg or heartbeat sent will | |||
* timeout. Because of header issues on Windows, this cannot actually | |||
* be a struct timeval. */ | |||
OPENSSL_timeval next_timeout; | |||
/* Timeout duration */ | |||
unsigned short timeout_duration; | |||
@@ -723,11 +723,7 @@ OPENSSL_EXPORT void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int v | |||
struct ssl_aead_ctx_st; | |||
typedef struct ssl_aead_ctx_st SSL_AEAD_CTX; | |||
#if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32) | |||
#define SSL_MAX_CERT_LIST_DEFAULT 1024*30 /* 30k max cert list :-) */ | |||
#else | |||
#define SSL_MAX_CERT_LIST_DEFAULT 1024*100 /* 100k max cert list :-) */ | |||
#endif | |||
#define SSL_MAX_CERT_LIST_DEFAULT 1024*100 /* 100k max cert list */ | |||
#define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024*20) | |||
@@ -86,13 +86,6 @@ extern "C" { | |||
#endif | |||
#ifdef OPENSSL_SYS_WIN32 | |||
/* Under Win32 these are defined in wincrypt.h */ | |||
#undef X509_NAME | |||
#undef X509_CERT_PAIR | |||
#undef X509_EXTENSIONS | |||
#endif | |||
#define X509_FILETYPE_PEM 1 | |||
#define X509_FILETYPE_ASN1 2 | |||
#define X509_FILETYPE_DEFAULT 3 | |||
@@ -62,6 +62,7 @@ | |||
#include <sys/timeb.h> | |||
#else | |||
#include <sys/socket.h> | |||
#include <sys/time.h> | |||
#endif | |||
#include <openssl/err.h> | |||
@@ -70,7 +71,8 @@ | |||
#include "ssl_locl.h" | |||
static void get_current_time(struct timeval *t); | |||
static void get_current_time(OPENSSL_timeval *t); | |||
static OPENSSL_timeval* dtls1_get_timeout(SSL *s, OPENSSL_timeval* timeleft); | |||
static void dtls1_set_handshake_header(SSL *s, int type, unsigned long len); | |||
static int dtls1_handshake_write(SSL *s); | |||
int dtls1_listen(SSL *s, struct sockaddr *client); | |||
@@ -291,7 +293,7 @@ long dtls1_ctrl(SSL *s, int cmd, long larg, void *parg) | |||
switch (cmd) | |||
{ | |||
case DTLS_CTRL_GET_TIMEOUT: | |||
if (dtls1_get_timeout(s, (struct timeval*) parg) != NULL) | |||
if (dtls1_get_timeout(s, (OPENSSL_timeval*) parg) != NULL) | |||
{ | |||
ret = 1; | |||
} | |||
@@ -339,16 +341,16 @@ void dtls1_start_timer(SSL *s) | |||
} | |||
/* Set timeout to current time */ | |||
get_current_time(&(s->d1->next_timeout)); | |||
get_current_time(&s->d1->next_timeout); | |||
/* Add duration to current time */ | |||
s->d1->next_timeout.tv_sec += s->d1->timeout_duration; | |||
BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT, 0, &(s->d1->next_timeout)); | |||
BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT, 0, &s->d1->next_timeout); | |||
} | |||
struct timeval* dtls1_get_timeout(SSL *s, struct timeval* timeleft) | |||
static OPENSSL_timeval* dtls1_get_timeout(SSL *s, OPENSSL_timeval* timeleft) | |||
{ | |||
struct timeval timenow; | |||
OPENSSL_timeval timenow; | |||
/* If no timeout is set, just return NULL */ | |||
if (s->d1->next_timeout.tv_sec == 0 && s->d1->next_timeout.tv_usec == 0) | |||
@@ -364,12 +366,12 @@ struct timeval* dtls1_get_timeout(SSL *s, struct timeval* timeleft) | |||
(s->d1->next_timeout.tv_sec == timenow.tv_sec && | |||
s->d1->next_timeout.tv_usec <= timenow.tv_usec)) | |||
{ | |||
memset(timeleft, 0, sizeof(struct timeval)); | |||
memset(timeleft, 0, sizeof(OPENSSL_timeval)); | |||
return timeleft; | |||
} | |||
/* Calculate time left until timer expires */ | |||
memcpy(timeleft, &(s->d1->next_timeout), sizeof(struct timeval)); | |||
memcpy(timeleft, &s->d1->next_timeout, sizeof(OPENSSL_timeval)); | |||
timeleft->tv_sec -= timenow.tv_sec; | |||
timeleft->tv_usec -= timenow.tv_usec; | |||
if (timeleft->tv_usec < 0) | |||
@@ -384,7 +386,7 @@ struct timeval* dtls1_get_timeout(SSL *s, struct timeval* timeleft) | |||
*/ | |||
if (timeleft->tv_sec == 0 && timeleft->tv_usec < 15000) | |||
{ | |||
memset(timeleft, 0, sizeof(struct timeval)); | |||
memset(timeleft, 0, sizeof(OPENSSL_timeval)); | |||
} | |||
@@ -393,7 +395,7 @@ struct timeval* dtls1_get_timeout(SSL *s, struct timeval* timeleft) | |||
int dtls1_is_timer_expired(SSL *s) | |||
{ | |||
struct timeval timeleft; | |||
OPENSSL_timeval timeleft; | |||
/* Get time left until timeout, return false if no timer running */ | |||
if (dtls1_get_timeout(s, &timeleft) == NULL) | |||
@@ -423,9 +425,9 @@ void dtls1_stop_timer(SSL *s) | |||
{ | |||
/* Reset everything */ | |||
memset(&(s->d1->timeout), 0, sizeof(struct dtls1_timeout_st)); | |||
memset(&(s->d1->next_timeout), 0, sizeof(struct timeval)); | |||
memset(&s->d1->next_timeout, 0, sizeof(OPENSSL_timeval)); | |||
s->d1->timeout_duration = 1; | |||
BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT, 0, &(s->d1->next_timeout)); | |||
BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT, 0, &s->d1->next_timeout); | |||
/* Clear retransmission buffer */ | |||
dtls1_clear_record_buffer(s); | |||
} | |||
@@ -473,13 +475,13 @@ int dtls1_handle_timeout(SSL *s) | |||
return dtls1_retransmit_buffered_messages(s); | |||
} | |||
static void get_current_time(struct timeval *t) | |||
static void get_current_time(OPENSSL_timeval *t) | |||
{ | |||
#ifdef OPENSSL_SYS_WIN32 | |||
struct _timeb tb; | |||
_ftime(&tb); | |||
t->tv_sec = (long)tb.time; | |||
t->tv_usec = (long)tb.millitm * 1000; | |||
#if defined(OPENSSL_WINDOWS) | |||
struct _timeb time; | |||
_ftime(&time); | |||
t->tv_sec = time.time; | |||
t->tv_usec = time.millitm * 1000; | |||
#else | |||
gettimeofday(t, NULL); | |||
#endif | |||
@@ -183,12 +183,6 @@ int ssl3_send_finished(SSL *s, int a, int b, const char *sender, int slen) | |||
s->s3->previous_server_finished_len=i; | |||
} | |||
#ifdef OPENSSL_SYS_WIN16 | |||
/* MSVC 1.5 does not clear the top bytes of the word unless | |||
* I do this. | |||
*/ | |||
l&=0xffff; | |||
#endif | |||
ssl_set_handshake_header(s, SSL3_MT_FINISHED, l); | |||
s->state=b; | |||
} | |||
@@ -1002,7 +1002,6 @@ void dtls1_get_message_header(unsigned char *data, struct hm_header_st *msg_hdr) | |||
void dtls1_get_ccs_header(unsigned char *data, struct ccs_header_st *ccs_hdr); | |||
void dtls1_reset_seq_numbers(SSL *s, int rw); | |||
long dtls1_default_timeout(void); | |||
struct timeval* dtls1_get_timeout(SSL *s, struct timeval* timeleft); | |||
int dtls1_check_timeout_num(SSL *s); | |||
int dtls1_handle_timeout(SSL *s); | |||
const SSL_CIPHER *dtls1_get_cipher(unsigned int u); | |||
@@ -1653,7 +1653,7 @@ unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *buf, unsigned c | |||
* returns: 1 on success. */ | |||
static int tls1_alpn_handle_client_hello(SSL *s, CBS *cbs, int *out_alert) | |||
{ | |||
CBS protocol_name_list; | |||
CBS protocol_name_list, protocol_name_list_copy; | |||
const unsigned char *selected; | |||
unsigned char selected_len; | |||
int r; | |||
@@ -1667,7 +1667,7 @@ static int tls1_alpn_handle_client_hello(SSL *s, CBS *cbs, int *out_alert) | |||
goto parse_error; | |||
/* Validate the protocol list. */ | |||
CBS protocol_name_list_copy = protocol_name_list; | |||
protocol_name_list_copy = protocol_name_list; | |||
while (CBS_len(&protocol_name_list_copy) > 0) | |||
{ | |||
CBS protocol_name; | |||
@@ -12,12 +12,17 @@ | |||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ | |||
#include <openssl/base.h> | |||
#if !defined(OPENSSL_WINDOWS) | |||
#include <arpa/inet.h> | |||
#include <netinet/in.h> | |||
#include <signal.h> | |||
#include <sys/socket.h> | |||
#include <sys/types.h> | |||
#include <unistd.h> | |||
#endif | |||
#include <sys/types.h> | |||
#include <openssl/bio.h> | |||
#include <openssl/bytestring.h> | |||
@@ -435,7 +440,9 @@ static int do_exchange(SSL_SESSION **out_session, | |||
int main(int argc, char **argv) { | |||
int is_server, resume; | |||
#if !defined(OPENSSL_WINDOWS) | |||
signal(SIGPIPE, SIG_IGN); | |||
#endif | |||
if (argc < 3) { | |||
return usage(argv[0]); | |||