sniffer should fail a session missing a RSA key

This commit is contained in:
John Safranek
2015-03-16 18:13:51 -07:00
parent db51c88e25
commit 33e767a1b4
4 changed files with 11 additions and 1 deletions

View File

@ -88,5 +88,6 @@ STRINGTABLE
71, "Decrypt Keys Not Set Up" 71, "Decrypt Keys Not Set Up"
72, "Late Key Load Error" 72, "Late Key Load Error"
73, "Got Certificate Status msg" 73, "Got Certificate Status msg"
74, "RSA Key Missing Error"
} }

View File

@ -237,7 +237,8 @@ static const char* const msgTable[] =
/* 71 */ /* 71 */
"Decrypt Keys Not Set Up", "Decrypt Keys Not Set Up",
"Late Key Load Error", "Late Key Load Error",
"Got Certificate Status msg" "Got Certificate Status msg",
"RSA Key Missing Error"
}; };
@ -1287,6 +1288,12 @@ static int ProcessClientKeyExchange(const byte* input, int* sslBytes,
RsaKey key; RsaKey key;
int ret; int ret;
if (session->sslServer->buffers.key.buffer == NULL ||
session->sslServer->buffers.key.length == 0) {
SetError(RSA_KEY_MISSING_STR, error, session, FATAL_ERROR_STATE);
return -1;
}
ret = wc_InitRsaKey(&key, 0); ret = wc_InitRsaKey(&key, 0);
if (ret == 0) if (ret == 0)
ret = wc_RsaPrivateKeyDecode(session->sslServer->buffers.key.buffer, ret = wc_RsaPrivateKeyDecode(session->sslServer->buffers.key.buffer,

View File

@ -106,6 +106,7 @@
#define DECRYPT_KEYS_NOT_SETUP 71 #define DECRYPT_KEYS_NOT_SETUP 71
#define CLIENT_HELLO_LATE_KEY_STR 72 #define CLIENT_HELLO_LATE_KEY_STR 72
#define GOT_CERT_STATUS_STR 73 #define GOT_CERT_STATUS_STR 73
#define RSA_KEY_MISSING_STR 74
/* !!!! also add to msgTable in sniffer.c and .rc file !!!! */ /* !!!! also add to msgTable in sniffer.c and .rc file !!!! */

View File

@ -88,5 +88,6 @@ STRINGTABLE
71, "Decrypt Keys Not Set Up" 71, "Decrypt Keys Not Set Up"
72, "Late Key Load Error" 72, "Late Key Load Error"
73, "Got Certificate Status msg" 73, "Got Certificate Status msg"
74, "RSA Key Missing Error"
} }