mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 18:57:27 +02:00
Sniffer Watch Mode
Add some tests for the Watch mode that will also work with static ECDH.
This commit is contained in:
@ -172,20 +172,43 @@ static char* iptos(unsigned int addr)
|
|||||||
|
|
||||||
#ifdef WOLFSSL_SNIFFER_WATCH
|
#ifdef WOLFSSL_SNIFFER_WATCH
|
||||||
|
|
||||||
|
const byte rsaHash[] = {
|
||||||
|
0xD1, 0xB6, 0x12, 0xAD, 0xB6, 0x50, 0x7B, 0x59,
|
||||||
|
0x97, 0x83, 0x6B, 0xCB, 0x35, 0xF5, 0xB8, 0x67,
|
||||||
|
0xEB, 0x83, 0x75, 0x40, 0x1B, 0x42, 0x61, 0xF1,
|
||||||
|
0x03, 0x72, 0xDC, 0x09, 0x0D, 0x60, 0x83, 0x15
|
||||||
|
};
|
||||||
|
|
||||||
|
const byte eccHash[] = {
|
||||||
|
0xDA, 0x08, 0x6D, 0xB5, 0x0B, 0xC4, 0x9F, 0x8A,
|
||||||
|
0x9E, 0x61, 0x9E, 0x87, 0x57, 0x5F, 0x00, 0xAA,
|
||||||
|
0x76, 0xE5, 0x1C, 0x9C, 0x74, 0x2A, 0x19, 0xBE,
|
||||||
|
0x22, 0xAE, 0x25, 0x3F, 0xA8, 0xAF, 0x8E, 0x7F
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static int myWatchCb(void* vSniffer,
|
static int myWatchCb(void* vSniffer,
|
||||||
const unsigned char* certHash, unsigned int certHashSz,
|
const unsigned char* certHash, unsigned int certHashSz,
|
||||||
const unsigned char* cert, unsigned int certSz,
|
const unsigned char* cert, unsigned int certSz,
|
||||||
void* ctx, char* error)
|
void* ctx, char* error)
|
||||||
{
|
{
|
||||||
(void)certHash;
|
const char* certName = NULL;
|
||||||
(void)certHashSz;
|
|
||||||
(void)cert;
|
(void)cert;
|
||||||
(void)certSz;
|
(void)certSz;
|
||||||
(void)ctx;
|
(void)ctx;
|
||||||
|
|
||||||
return ssl_SetWatchKey(vSniffer,
|
if (certHashSz == sizeof(rsaHash) &&
|
||||||
"../../certs/server-key.pem",
|
memcmp(certHash, rsaHash, certHashSz) == 0)
|
||||||
FILETYPE_PEM, NULL, error);
|
certName = "../../certs/server-key.pem";
|
||||||
|
if (certHashSz == sizeof(eccHash) &&
|
||||||
|
memcmp(certHash, eccHash, certHashSz) == 0)
|
||||||
|
certName = "../../certs/ecc-key.pem";
|
||||||
|
|
||||||
|
if (certName == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return ssl_SetWatchKey(vSniffer, certName, FILETYPE_PEM, NULL, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user