Topic: Bug in ssl.c for RSA private key handling in ProcessBuffer()?
Hi All,
We have been using the SSL functionality of wolfSSL embedded SSL and everything until works fine. We are using wolfssl-2.6.0.
In ssl.c in the method ProcessBuffer() for private key handling, starting from line number 1425:
if (type == PRIVATEKEY_TYPE && format != SSL_FILETYPE_RAW) {
#ifndef NO_RSA
if (!eccKey) {
/* make sure RSA key can be used */
RsaKey key;
word32 idx = 0;
InitRsaKey(&key, 0);
if (RsaPrivateKeyDecode(der.buffer,&idx,&key,der.length) != 0) {
...
}
This block tries to construct a RsaKey from a encoded key in DER format to make sure that the encoded key can be used later. As I understand, RsaPrivateKeyDecode() is used to decode a key in DER format into RsaKey. Then line 1425 shall be
if (type == PRIVATEKEY_TYPE && format == SSL_FILETYPE_RAW)
instead of
if (type == PRIVATEKEY_TYPE && format != SSL_FILETYPE_RAW)
Is it correct what I understand?
Thanks, Yun