Commit c9685a78 authored by Robert Golebiowski's avatar Robert Golebiowski

Bug #20168526 YASSL: CORRUPT SSL-KEY CRASHES CLIENT

Affects at least 5.6 and 5.7. In customer case, the "client" happened to
be a replication slave, therefore his server crashed.

Bug-fix:
The bug was in yassl. Todd Ouska has provided us with the patch.

(cherry picked from commit 42ffa91aad898b02f0793b669ffd04f5c178ce39)
parent bf681d6b
......@@ -12,6 +12,10 @@ before calling SSL_new();
*** end Note ***
yaSSL Patch notes, version 2.3.7b (3/18/2015)
This release of yaSSL fixes a potential crash with corrupted private keys.
Also detects bad keys earlier for user.
yaSSL Release notes, version 2.3.7 (12/10/2014)
This release of yaSSL fixes the potential to process duplicate handshake
messages by explicitly marking/checking received handshake messages.
......
......@@ -35,7 +35,7 @@
#include "rsa.h"
#define YASSL_VERSION "2.3.7"
#define YASSL_VERSION "2.3.7b"
#if defined(__cplusplus)
......
......@@ -37,6 +37,8 @@
#include "file.hpp" // for TaoCrypt Source
#include "coding.hpp" // HexDecoder
#include "helpers.hpp" // for placement new hack
#include "rsa.hpp" // for TaoCrypt RSA key decode
#include "dsa.hpp" // for TaoCrypt DSA key decode
#include <stdio.h>
#ifdef _WIN32
......@@ -54,6 +56,8 @@ namespace yaSSL {
int read_file(SSL_CTX* ctx, const char* file, int format, CertType type)
{
int ret = SSL_SUCCESS;
if (format != SSL_FILETYPE_ASN1 && format != SSL_FILETYPE_PEM)
return SSL_BAD_FILETYPE;
......@@ -141,8 +145,31 @@ int read_file(SSL_CTX* ctx, const char* file, int format, CertType type)
}
}
}
if (type == PrivateKey && ctx->privateKey_) {
// see if key is valid early
TaoCrypt::Source rsaSource(ctx->privateKey_->get_buffer(),
ctx->privateKey_->get_length());
TaoCrypt::RSA_PrivateKey rsaKey;
rsaKey.Initialize(rsaSource);
if (rsaSource.GetError().What()) {
// rsa failed see if DSA works
TaoCrypt::Source dsaSource(ctx->privateKey_->get_buffer(),
ctx->privateKey_->get_length());
TaoCrypt::DSA_PrivateKey dsaKey;
dsaKey.Initialize(dsaSource);
if (rsaSource.GetError().What()) {
// neither worked
ret = SSL_FAILURE;
}
}
}
fclose(input);
return SSL_SUCCESS;
return ret;
}
......
......@@ -140,6 +140,10 @@ word32 RSA_BlockType2::UnPad(const byte *pkcsBlock, unsigned int pkcsBlockLen,
void RSA_BlockType1::Pad(const byte* input, word32 inputLen, byte* pkcsBlock,
word32 pkcsBlockLen, RandomNumberGenerator&) const
{
// sanity checks
if (input == NULL || pkcsBlock == NULL)
return;
// convert from bit length to byte length
if (pkcsBlockLen % 8 != 0)
{
......
......@@ -4,6 +4,7 @@
#
no_pid=-1
server_pid=$no_pid
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment