Skip to content

Commit 33e767a

Browse files
committedMar 17, 2015
sniffer should fail a session missing a RSA key
1 parent db51c88 commit 33e767a

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed
 

‎cyassl/sniffer_error.rc

+1
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,6 @@ STRINGTABLE
8888
71, "Decrypt Keys Not Set Up"
8989
72, "Late Key Load Error"
9090
73, "Got Certificate Status msg"
91+
74, "RSA Key Missing Error"
9192
}
9293

‎src/sniffer.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ static const char* const msgTable[] =
237237
/* 71 */
238238
"Decrypt Keys Not Set Up",
239239
"Late Key Load Error",
240-
"Got Certificate Status msg"
240+
"Got Certificate Status msg",
241+
"RSA Key Missing Error"
241242
};
242243

243244

@@ -1287,6 +1288,12 @@ static int ProcessClientKeyExchange(const byte* input, int* sslBytes,
12871288
RsaKey key;
12881289
int ret;
12891290

1291+
if (session->sslServer->buffers.key.buffer == NULL ||
1292+
session->sslServer->buffers.key.length == 0) {
1293+
1294+
SetError(RSA_KEY_MISSING_STR, error, session, FATAL_ERROR_STATE);
1295+
return -1;
1296+
}
12901297
ret = wc_InitRsaKey(&key, 0);
12911298
if (ret == 0)
12921299
ret = wc_RsaPrivateKeyDecode(session->sslServer->buffers.key.buffer,

‎wolfssl/sniffer_error.h

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
#define DECRYPT_KEYS_NOT_SETUP 71
107107
#define CLIENT_HELLO_LATE_KEY_STR 72
108108
#define GOT_CERT_STATUS_STR 73
109+
#define RSA_KEY_MISSING_STR 74
109110
/* !!!! also add to msgTable in sniffer.c and .rc file !!!! */
110111

111112

‎wolfssl/sniffer_error.rc

+1
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,6 @@ STRINGTABLE
8888
71, "Decrypt Keys Not Set Up"
8989
72, "Late Key Load Error"
9090
73, "Got Certificate Status msg"
91+
74, "RSA Key Missing Error"
9192
}
9293

0 commit comments

Comments
 (0)
Please sign in to comment.