From: Todd O. <to...@us...> - 2014-12-10 19:18:29
|
Update of /cvsroot/yassl/yassl/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv8346/src Modified Files: yassl_imp.cpp yassl_int.cpp Log Message: 2.3.7 explicitly check duplicate recvd messages Index: yassl_imp.cpp =================================================================== RCS file: /cvsroot/yassl/yassl/src/yassl_imp.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** yassl_imp.cpp 25 Nov 2014 22:15:59 -0000 1.31 --- yassl_imp.cpp 10 Dec 2014 19:18:26 -0000 1.32 *************** *** 883,886 **** --- 883,892 ---- } + // detect duplicate change_cipher + if (ssl.getSecurity().get_parms().pending_ == false) { + ssl.order_error(); + return; + } + ssl.useSecurity().use_parms().pending_ = false; if (ssl.getSecurity().get_resuming()) { Index: yassl_int.cpp =================================================================== RCS file: /cvsroot/yassl/yassl/src/yassl_int.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** yassl_int.cpp 18 Sep 2014 15:17:22 -0000 1.37 --- yassl_int.cpp 10 Dec 2014 19:18:26 -0000 1.38 *************** *** 264,267 **** --- 264,338 ---- + // mark message recvd, check for duplicates, return 0 on success + int States::SetMessageRecvd(HandShakeType hst) + { + switch (hst) { + case hello_request: + break; // could send more than one + + case client_hello: + if (recvdMessages_.gotClientHello_) + return -1; + recvdMessages_.gotClientHello_ = 1; + break; + + case server_hello: + if (recvdMessages_.gotServerHello_) + return -1; + recvdMessages_.gotServerHello_ = 1; + break; + + case certificate: + if (recvdMessages_.gotCert_) + return -1; + recvdMessages_.gotCert_ = 1; + break; + + case server_key_exchange: + if (recvdMessages_.gotServerKeyExchange_) + return -1; + recvdMessages_.gotServerKeyExchange_ = 1; + break; + + case certificate_request: + if (recvdMessages_.gotCertRequest_) + return -1; + recvdMessages_.gotCertRequest_ = 1; + break; + + case server_hello_done: + if (recvdMessages_.gotServerHelloDone_) + return -1; + recvdMessages_.gotServerHelloDone_ = 1; + break; + + case certificate_verify: + if (recvdMessages_.gotCertVerify_) + return -1; + recvdMessages_.gotCertVerify_ = 1; + break; + + case client_key_exchange: + if (recvdMessages_.gotClientKeyExchange_) + return -1; + recvdMessages_.gotClientKeyExchange_ = 1; + break; + + case finished: + if (recvdMessages_.gotFinished_) + return -1; + recvdMessages_.gotFinished_ = 1; + break; + + + default: + return -1; + + } + + return 0; + } + + sslFactory::sslFactory() : messageFactory_(InitMessageFactory), *************** *** 1208,1211 **** --- 1279,1287 ---- } + if (states_.SetMessageRecvd(hsHeader.get_handshakeType()) != 0) { + order_error(); + return; + } + if (secure_.get_parms().entity_ == client_end) verifyClientState(hsHeader.get_handshakeType()); |