make sure handshake complete before sending encrypted alert

pull/1/head
toddouska 2012-12-28 14:29:15 -08:00
parent 6d3728fe61
commit f073f49ead
1 changed files with 3 additions and 1 deletions

View File

@ -4548,7 +4548,9 @@ int SendAlert(CYASSL* ssl, int severity, int type)
input[0] = (byte)severity;
input[1] = (byte)type;
if (ssl->keys.encryptionOn)
/* only send encrypted alert if handshake actually complete, otherwise
other side may not be able to handle it */
if (ssl->keys.encryptionOn && ssl->options.handShakeState == HANDSHAKE_DONE)
sendSz = BuildMessage(ssl, output, input, ALERT_SIZE, alert);
else {
RecordLayerHeader *const rl = (RecordLayerHeader*)output;