fix item 9 from report by Ivan Fratric of the Google Security Team
This commit is contained in:
parent
86ebc48032
commit
717f3adb47
@ -1126,6 +1126,9 @@ int DhKeyDecode(const byte* input, word32* inOutIdx, DhKey* key, word32 inSz)
|
|||||||
|
|
||||||
int DhSetKey(DhKey* key, const byte* p, word32 pSz, const byte* g, word32 gSz)
|
int DhSetKey(DhKey* key, const byte* p, word32 pSz, const byte* g, word32 gSz)
|
||||||
{
|
{
|
||||||
|
if (key == NULL || p == NULL || g == NULL || pSz == 0 || gSz == 0)
|
||||||
|
return BAD_FUNC_ARG;
|
||||||
|
|
||||||
/* may have leading 0 */
|
/* may have leading 0 */
|
||||||
if (p[0] == 0) {
|
if (p[0] == 0) {
|
||||||
pSz--; p++;
|
pSz--; p++;
|
||||||
@ -5470,6 +5473,9 @@ int EccPrivateKeyDecode(const byte* input, word32* inOutIdx, ecc_key* key,
|
|||||||
byte priv[ECC_MAXSIZE];
|
byte priv[ECC_MAXSIZE];
|
||||||
byte pub[ECC_MAXSIZE * 2 + 1]; /* public key has two parts plus header */
|
byte pub[ECC_MAXSIZE * 2 + 1]; /* public key has two parts plus header */
|
||||||
|
|
||||||
|
if (input == NULL || inOutIdx == NULL || key == NULL || inSz == 0)
|
||||||
|
return BAD_FUNC_ARG;
|
||||||
|
|
||||||
if (GetSequence(input, inOutIdx, &length, inSz) < 0)
|
if (GetSequence(input, inOutIdx, &length, inSz) < 0)
|
||||||
return ASN_PARSE_E;
|
return ASN_PARSE_E;
|
||||||
|
|
||||||
|
@ -10733,6 +10733,12 @@ static void PickHashSigAlgo(CYASSL* ssl,
|
|||||||
(void)input;
|
(void)input;
|
||||||
(void)size;
|
(void)size;
|
||||||
|
|
||||||
|
if (ssl->options.side != CYASSL_SERVER_END) {
|
||||||
|
CYASSL_MSG("Client received client keyexchange, attack?");
|
||||||
|
CYASSL_ERROR(ssl->error = SIDE_ERROR);
|
||||||
|
return SSL_FATAL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if (ssl->options.clientState < CLIENT_HELLO_COMPLETE) {
|
if (ssl->options.clientState < CLIENT_HELLO_COMPLETE) {
|
||||||
CYASSL_MSG("Client sending keyexchange at wrong time");
|
CYASSL_MSG("Client sending keyexchange at wrong time");
|
||||||
SendAlert(ssl, alert_fatal, unexpected_message);
|
SendAlert(ssl, alert_fatal, unexpected_message);
|
||||||
|
Loading…
Reference in New Issue
Block a user