mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 12:14:38 +02:00
better error output for temp keys or compression on sniffer
This commit is contained in:
@@ -98,6 +98,7 @@
|
|||||||
#define BAD_INPUT_STR 64
|
#define BAD_INPUT_STR 64
|
||||||
#define BAD_DECRYPT_TYPE 65
|
#define BAD_DECRYPT_TYPE 65
|
||||||
#define BAD_FINISHED_MSG 66
|
#define BAD_FINISHED_MSG 66
|
||||||
|
#define BAD_COMPRESSION_STR 67
|
||||||
|
|
||||||
/* !!!! also add to msgTable in sniffer.c and .rc file !!!! */
|
/* !!!! also add to msgTable in sniffer.c and .rc file !!!! */
|
||||||
|
|
||||||
|
@@ -80,5 +80,6 @@ STRINGTABLE
|
|||||||
65, "Bad Decrypt Type"
|
65, "Bad Decrypt Type"
|
||||||
|
|
||||||
66, "Bad Finished Message Processing"
|
66, "Bad Finished Message Processing"
|
||||||
|
67, "Bad Compression Type"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -128,6 +128,11 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
|||||||
load_buffer(ctx, svrKey, CYASSL_KEY);
|
load_buffer(ctx, svrKey, CYASSL_KEY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(CYASSL_SNIFFER) && !defined(HAVE_NTRU) && !defined(HAVE_ECC)
|
||||||
|
/* don't use EDH, can't sniff tmp keys */
|
||||||
|
CyaSSL_CTX_set_cipher_list(ctx, "AES256-SHA");
|
||||||
|
#endif
|
||||||
|
|
||||||
SignalReady(args);
|
SignalReady(args);
|
||||||
|
|
||||||
while (!shutdown) {
|
while (!shutdown) {
|
||||||
|
@@ -146,6 +146,11 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
|||||||
load_buffer(ctx, svrKey, CYASSL_KEY);
|
load_buffer(ctx, svrKey, CYASSL_KEY);
|
||||||
#endif /* NO_FILESYSTEM */
|
#endif /* NO_FILESYSTEM */
|
||||||
|
|
||||||
|
#if defined(CYASSL_SNIFFER) && !defined(HAVE_NTRU) && !defined(HAVE_ECC)
|
||||||
|
/* don't use EDH, can't sniff tmp keys */
|
||||||
|
SSL_CTX_set_cipher_list(ctx, "AES256-SHA");
|
||||||
|
#endif
|
||||||
|
|
||||||
ssl = SSL_new(ctx);
|
ssl = SSL_new(ctx);
|
||||||
#ifdef HAVE_CRL
|
#ifdef HAVE_CRL
|
||||||
CyaSSL_EnableCRL(ssl, 0);
|
CyaSSL_EnableCRL(ssl, 0);
|
||||||
|
@@ -216,7 +216,8 @@ static const char* const msgTable[] =
|
|||||||
"Bad Decrypt Type",
|
"Bad Decrypt Type",
|
||||||
|
|
||||||
/* 66 */
|
/* 66 */
|
||||||
"Bad Finished Message Processing"
|
"Bad Finished Message Processing",
|
||||||
|
"Bad Compression Type"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1173,12 +1174,22 @@ static int ProcessServerHello(const byte* input, int* sslBytes,
|
|||||||
input += b;
|
input += b;
|
||||||
*sslBytes -= b;
|
*sslBytes -= b;
|
||||||
|
|
||||||
|
/* cipher suite */
|
||||||
(void)*input++; /* eat first byte, always 0 */
|
(void)*input++; /* eat first byte, always 0 */
|
||||||
b = *input++;
|
b = *input++;
|
||||||
session->sslServer->options.cipherSuite = b;
|
session->sslServer->options.cipherSuite = b;
|
||||||
session->sslClient->options.cipherSuite = b;
|
session->sslClient->options.cipherSuite = b;
|
||||||
*sslBytes -= SUITE_LEN;
|
*sslBytes -= SUITE_LEN;
|
||||||
|
|
||||||
|
/* compression */
|
||||||
|
b = *input++;
|
||||||
|
*sslBytes -= ENUM_LEN;
|
||||||
|
|
||||||
|
if (b) {
|
||||||
|
SetError(BAD_COMPRESSION_STR, error, session, FATAL_ERROR_STATE);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (session->sslServer->options.haveSessionId &&
|
if (session->sslServer->options.haveSessionId &&
|
||||||
XMEMCMP(session->sslServer->arrays.sessionID,
|
XMEMCMP(session->sslServer->arrays.sessionID,
|
||||||
session->sslClient->arrays.sessionID, ID_LEN) == 0)
|
session->sslClient->arrays.sessionID, ID_LEN) == 0)
|
||||||
@@ -1466,6 +1477,9 @@ static int DoHandShake(const byte* input, int* sslBytes,
|
|||||||
break;
|
break;
|
||||||
case server_key_exchange:
|
case server_key_exchange:
|
||||||
Trace(GOT_SERVER_KEY_EX_STR);
|
Trace(GOT_SERVER_KEY_EX_STR);
|
||||||
|
/* can't know temp key passively */
|
||||||
|
SetError(BAD_CIPHER_SPEC_STR, error, session, FATAL_ERROR_STATE);
|
||||||
|
ret = -1;
|
||||||
break;
|
break;
|
||||||
case certificate:
|
case certificate:
|
||||||
Trace(GOT_CERT_STR);
|
Trace(GOT_CERT_STR);
|
||||||
|
@@ -63,7 +63,7 @@ typedef unsigned char byte;
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
ETHER_IF_FRAME_LEN = 14, /* ethernet interface frame length */
|
ETHER_IF_FRAME_LEN = 14, /* ethernet interface frame length */
|
||||||
LOCAL_IF_FRAME_LEN = 4, /* localhost interface frame length */
|
NULL_IF_FRAME_LEN = 4, /* no link interface frame length */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -241,8 +241,8 @@ int main(int argc, char** argv)
|
|||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
err_sys(err);
|
err_sys(err);
|
||||||
|
|
||||||
if (pcap_datalink(pcap) == 0)
|
if (pcap_datalink(pcap) == DLT_NULL)
|
||||||
frame = LOCAL_IF_FRAME_LEN;
|
frame = NULL_IF_FRAME_LEN;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
struct pcap_pkthdr header;
|
struct pcap_pkthdr header;
|
||||||
|
Reference in New Issue
Block a user