#include <yassl_imp.hpp>
Inheritance diagram for yaSSL::ClientHello:


Public Member Functions | |
| input_buffer & | set (input_buffer &in) |
| output_buffer & | get (output_buffer &out) const |
| HandShakeType | get_type () const |
| void | Process (input_buffer &, SSL &) |
| const opaque * | get_random () const |
| ClientHello () | |
| ClientHello (ProtocolVersion pv) | |
Private Member Functions | |
| ClientHello (const ClientHello &) | |
| ClientHello & | operator= (const ClientHello &) |
Private Attributes | |
| ProtocolVersion | client_version_ |
| Random | random_ |
| uint8 | id_len_ |
| opaque | session_id_ [ID_LEN] |
| uint16 | suite_len_ |
| opaque | cipher_suites_ [MAX_SUITE_SZ] |
| uint8 | comp_len_ |
| CompressionMethod | compression_methods_ |
Friends | |
| input_buffer & | operator>> (input_buffer &, ClientHello &) |
| output_buffer & | operator<< (output_buffer &, const ClientHello &) |
| void | buildClientHello (SSL &, ClientHello &, CompressionMethod) |
| void | ProcessOldClientHello (input_buffer &input, SSL &ssl) |
Definition at line 212 of file yassl_imp.hpp.
| yaSSL::ClientHello::ClientHello | ( | ) |
| yaSSL::ClientHello::ClientHello | ( | ProtocolVersion | pv | ) | [explicit] |
Definition at line 1453 of file yassl_imp.cpp.
References memset, yaSSL::RAN_LEN, and random_.
01454 : client_version_(pv) 01455 { 01456 memset(random_, 0, RAN_LEN); 01457 }
| yaSSL::ClientHello::ClientHello | ( | const ClientHello & | ) | [private] |
| output_buffer & yaSSL::ClientHello::get | ( | output_buffer & | out | ) | const [virtual] |
| const opaque * yaSSL::ClientHello::get_random | ( | ) | const |
Definition at line 1441 of file yassl_imp.cpp.
References random_.
01442 { 01443 return random_; 01444 }
| HandShakeType yaSSL::ClientHello::get_type | ( | ) | const [virtual] |
Implements yaSSL::HandShakeBase.
Definition at line 1435 of file yassl_imp.cpp.
References yaSSL::client_hello.
01436 { 01437 return client_hello; 01438 }
| ClientHello& yaSSL::ClientHello::operator= | ( | const ClientHello & | ) | [private] |
| void yaSSL::ClientHello::Process | ( | input_buffer & | , | |
| SSL & | ||||
| ) | [virtual] |
Implements yaSSL::HandShakeBase.
Definition at line 1385 of file yassl_imp.cpp.
References cipher_suites_, yaSSL::client_end, client_version_, yaSSL::clientHelloComplete, yaSSL::clientKeyExchangeComplete, yaSSL::SSL::deriveKeys(), yaSSL::SSL::deriveTLSKeys(), yaSSL::RandomPool::Fill(), yaSSL::Security::get_connection(), yaSSL::Security::get_parms(), yaSSL::Crypto::get_random(), yaSSL::SSL::getCrypto(), yaSSL::SSL_SESSION::GetSecret(), yaSSL::SSL::getSecurity(), yaSSL::GetSessions(), yaSSL::SSL_SESSION::GetSuite(), id_len_, yaSSL::SSL::isTLS(), yaSSL::Sessions::lookup(), yaSSL::SSL::matchSuite(), yaSSL::ProtocolVersion::minor_, yaSSL::RAN_LEN, random_, yaSSL::server_end, session_id_, yaSSL::SSL::set_masterSecret(), yaSSL::SSL::set_pending(), yaSSL::SSL::set_random(), yaSSL::Security::set_resuming(), yaSSL::SSL::set_session(), yaSSL::Parameters::SetSuites(), yaSSL::Parameters::suite_, yaSSL::SUITE_LEN, suite_len_, yaSSL::Log::Trace(), yaSSL::Connection::TurnOffTLS(), yaSSL::Security::use_connection(), yaSSL::Security::use_parms(), yaSSL::SSL::useLog(), yaSSL::SSL::useSecurity(), yaSSL::States::useServer(), yaSSL::SSL::useStates(), and yaSSL::Connection::version_.
Referenced by yaSSL::ProcessOldClientHello().
01386 { 01387 if (ssl.isTLS() && client_version_.minor_ == 0) { 01388 ssl.useSecurity().use_connection().TurnOffTLS(); 01389 ProtocolVersion pv = ssl.getSecurity().get_connection().version_; 01390 ssl.useSecurity().use_parms().SetSuites(pv); // reset w/ SSL suites 01391 } 01392 ssl.set_random(random_, client_end); 01393 01394 while (id_len_) { // trying to resume 01395 SSL_SESSION* session = GetSessions().lookup(session_id_); 01396 if (!session) { 01397 ssl.useLog().Trace("session lookup failed"); 01398 break; 01399 } 01400 ssl.set_session(session); 01401 ssl.useSecurity().set_resuming(true); 01402 ssl.matchSuite(session->GetSuite(), SUITE_LEN); 01403 ssl.set_pending(ssl.getSecurity().get_parms().suite_[1]); 01404 ssl.set_masterSecret(session->GetSecret()); 01405 01406 opaque serverRandom[RAN_LEN]; 01407 ssl.getCrypto().get_random().Fill(serverRandom, sizeof(serverRandom)); 01408 ssl.set_random(serverRandom, server_end); 01409 if (ssl.isTLS()) 01410 ssl.deriveTLSKeys(); 01411 else 01412 ssl.deriveKeys(); 01413 ssl.useStates().useServer() = clientKeyExchangeComplete; 01414 return; 01415 } 01416 ssl.matchSuite(cipher_suites_, suite_len_); 01417 ssl.set_pending(ssl.getSecurity().get_parms().suite_[1]); 01418 01419 ssl.useStates().useServer() = clientHelloComplete; 01420 }
Here is the call graph for this function:

Here is the caller graph for this function:

| input_buffer & yaSSL::ClientHello::set | ( | input_buffer & | in | ) | [virtual] |
| void buildClientHello | ( | SSL & | ssl, | |
| ClientHello & | hello, | |||
| CompressionMethod | compression = no_compression | |||
| ) | [friend] |
Definition at line 44 of file handshake.cpp.
00046 { 00047 ssl.getCrypto().get_random().Fill(hello.random_, RAN_LEN); 00048 if (ssl.getSecurity().get_resuming()) { 00049 hello.id_len_ = ID_LEN; 00050 memcpy(hello.session_id_, ssl.getSecurity().get_resume().GetID(), 00051 ID_LEN); 00052 } 00053 else 00054 hello.id_len_ = 0; 00055 hello.suite_len_ = ssl.getSecurity().get_parms().suites_size_; 00056 memcpy(hello.cipher_suites_, ssl.getSecurity().get_parms().suites_, 00057 hello.suite_len_); 00058 hello.comp_len_ = 1; 00059 hello.compression_methods_ = compression; 00060 00061 hello.set_length(sizeof(ProtocolVersion) + 00062 RAN_LEN + 00063 hello.id_len_ + sizeof(hello.id_len_) + 00064 hello.suite_len_ + sizeof(hello.suite_len_) + 00065 hello.comp_len_ + sizeof(hello.comp_len_)); 00066 }
| output_buffer& operator<< | ( | output_buffer & | output, | |
| const ClientHello & | hello | |||
| ) | [friend] |
Definition at line 1356 of file yassl_imp.cpp.
01357 { 01358 // Protocol 01359 output[AUTO] = hello.client_version_.major_; 01360 output[AUTO] = hello.client_version_.minor_; 01361 01362 // Random 01363 output.write(hello.random_, RAN_LEN); 01364 01365 // Session 01366 output[AUTO] = hello.id_len_; 01367 if (hello.id_len_) output.write(hello.session_id_, ID_LEN); 01368 01369 // Suites 01370 byte tmp[2]; 01371 c16toa(hello.suite_len_, tmp); 01372 output[AUTO] = tmp[0]; 01373 output[AUTO] = tmp[1]; 01374 output.write(hello.cipher_suites_, hello.suite_len_); 01375 01376 // Compression 01377 output[AUTO] = hello.comp_len_; 01378 output[AUTO] = hello.compression_methods_; 01379 01380 return output; 01381 }
| input_buffer& operator>> | ( | input_buffer & | input, | |
| ClientHello & | hello | |||
| ) | [friend] |
Definition at line 1326 of file yassl_imp.cpp.
01327 { 01328 // Protocol 01329 hello.client_version_.major_ = input[AUTO]; 01330 hello.client_version_.minor_ = input[AUTO]; 01331 01332 // Random 01333 input.read(hello.random_, RAN_LEN); 01334 01335 // Session 01336 hello.id_len_ = input[AUTO]; 01337 if (hello.id_len_) input.read(hello.session_id_, ID_LEN); 01338 01339 // Suites 01340 byte tmp[2]; 01341 tmp[0] = input[AUTO]; 01342 tmp[1] = input[AUTO]; 01343 ato16(tmp, hello.suite_len_); 01344 input.read(hello.cipher_suites_, hello.suite_len_); 01345 01346 // Compression 01347 hello.comp_len_ = input[AUTO]; 01348 while (hello.comp_len_--) // ignore for now 01349 hello.compression_methods_ = CompressionMethod(input[AUTO]); 01350 01351 return input; 01352 }
| void ProcessOldClientHello | ( | input_buffer & | input, | |
| SSL & | ssl | |||
| ) | [friend] |
Definition at line 458 of file handshake.cpp.
00459 { 00460 byte b0 = input[AUTO]; 00461 byte b1 = input[AUTO]; 00462 00463 uint16 sz = ((b0 & 0x7f) << 8) | b1; 00464 00465 if (sz > input.get_remaining()) { 00466 ssl.SetError(bad_input); 00467 return; 00468 } 00469 00470 // hashHandShake manually 00471 const opaque* buffer = input.get_buffer() + input.get_current(); 00472 ssl.useHashes().use_MD5().update(buffer, sz); 00473 ssl.useHashes().use_SHA().update(buffer, sz); 00474 00475 b1 = input[AUTO]; // does this value mean client_hello? 00476 00477 ClientHello ch; 00478 ch.client_version_.major_ = input[AUTO]; 00479 ch.client_version_.minor_ = input[AUTO]; 00480 00481 byte len[2]; 00482 00483 input.read(len, sizeof(len)); 00484 ato16(len, ch.suite_len_); 00485 00486 input.read(len, sizeof(len)); 00487 uint16 sessionLen; 00488 ato16(len, sessionLen); 00489 ch.id_len_ = sessionLen; 00490 00491 input.read(len, sizeof(len)); 00492 uint16 randomLen; 00493 ato16(len, randomLen); 00494 00495 int j = 0; 00496 for (uint16 i = 0; i < ch.suite_len_; i += 3) { 00497 byte first = input[AUTO]; 00498 if (first) // sslv2 type 00499 input.read(len, SUITE_LEN); // skip 00500 else { 00501 input.read(&ch.cipher_suites_[j], SUITE_LEN); 00502 j += SUITE_LEN; 00503 } 00504 } 00505 ch.suite_len_ = j; 00506 00507 if (ch.id_len_) 00508 input.read(ch.session_id_, ch.id_len_); 00509 00510 if (randomLen < RAN_LEN) 00511 memset(ch.random_, 0, RAN_LEN - randomLen); 00512 input.read(&ch.random_[RAN_LEN - randomLen], randomLen); 00513 00514 00515 ch.Process(input, ssl); 00516 }
opaque yaSSL::ClientHello::cipher_suites_[MAX_SUITE_SZ] [private] |
Definition at line 218 of file yassl_imp.hpp.
Referenced by yaSSL::buildClientHello(), yaSSL::operator<<(), yaSSL::operator>>(), Process(), and yaSSL::ProcessOldClientHello().
Definition at line 213 of file yassl_imp.hpp.
Referenced by yaSSL::operator<<(), yaSSL::operator>>(), Process(), and yaSSL::ProcessOldClientHello().
uint8 yaSSL::ClientHello::comp_len_ [private] |
Definition at line 219 of file yassl_imp.hpp.
Referenced by yaSSL::buildClientHello(), yaSSL::operator<<(), and yaSSL::operator>>().
Definition at line 220 of file yassl_imp.hpp.
Referenced by yaSSL::buildClientHello(), yaSSL::operator<<(), and yaSSL::operator>>().
uint8 yaSSL::ClientHello::id_len_ [private] |
Definition at line 215 of file yassl_imp.hpp.
Referenced by yaSSL::buildClientHello(), yaSSL::operator<<(), yaSSL::operator>>(), Process(), and yaSSL::ProcessOldClientHello().
Random yaSSL::ClientHello::random_ [private] |
Definition at line 214 of file yassl_imp.hpp.
Referenced by yaSSL::buildClientHello(), ClientHello(), get_random(), yaSSL::operator<<(), yaSSL::operator>>(), Process(), and yaSSL::ProcessOldClientHello().
opaque yaSSL::ClientHello::session_id_[ID_LEN] [private] |
Definition at line 216 of file yassl_imp.hpp.
Referenced by yaSSL::buildClientHello(), yaSSL::operator<<(), yaSSL::operator>>(), Process(), and yaSSL::ProcessOldClientHello().
uint16 yaSSL::ClientHello::suite_len_ [private] |
Definition at line 217 of file yassl_imp.hpp.
Referenced by yaSSL::buildClientHello(), yaSSL::operator<<(), yaSSL::operator>>(), Process(), and yaSSL::ProcessOldClientHello().
1.4.7

