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


Public Member Functions | |
| Data () | |
| Data (uint16 len, opaque *b) | |
| Data (uint16 len, const opaque *w) | |
| input_buffer & | set (input_buffer &in) |
| output_buffer & | get (output_buffer &out) const |
| ContentType | get_type () const |
| uint16 | get_length () const |
| const opaque * | get_buffer () const |
| void | set_length (uint16 l) |
| opaque * | set_buffer () |
| void | Process (input_buffer &, SSL &) |
Private Member Functions | |
| Data (const Data &) | |
| Data & | operator= (const Data &) |
Private Attributes | |
| uint16 | length_ |
| opaque * | buffer_ |
| const opaque * | write_buffer_ |
Friends | |
| output_buffer & | operator<< (output_buffer &, const Data &) |
Definition at line 125 of file yassl_imp.hpp.
| yaSSL::Data::Data | ( | ) |
Definition at line 870 of file yassl_imp.cpp.
00871 : length_(0), buffer_(0), write_buffer_(0) 00872 {}
Definition at line 875 of file yassl_imp.cpp.
00876 : length_(len), buffer_(b), write_buffer_(0) 00877 {}
Definition at line 880 of file yassl_imp.cpp.
00881 : length_(len), buffer_(0), write_buffer_(w) 00882 {}
| yaSSL::Data::Data | ( | const Data & | ) | [private] |
| output_buffer & yaSSL::Data::get | ( | output_buffer & | out | ) | const [virtual] |
| const opaque * yaSSL::Data::get_buffer | ( | ) | const |
Definition at line 908 of file yassl_imp.cpp.
References write_buffer_.
00909 { 00910 return write_buffer_; 00911 }
| uint16 yaSSL::Data::get_length | ( | ) | const [virtual] |
Implements yaSSL::Message.
Definition at line 902 of file yassl_imp.cpp.
References length_.
00903 { 00904 return length_; 00905 }
| ContentType yaSSL::Data::get_type | ( | ) | const [virtual] |
Implements yaSSL::Message.
Definition at line 896 of file yassl_imp.cpp.
References yaSSL::application_data.
00897 { 00898 return application_data; 00899 }
| void yaSSL::Data::Process | ( | input_buffer & | , | |
| SSL & | ||||
| ) | [virtual] |
Implements yaSSL::Message.
Definition at line 934 of file yassl_imp.cpp.
References yaSSL::SSL::addData(), yaSSL::application_data, yaSSL::AUTO, yaSSL::block, yaSSL::Parameters::cipher_type_, data, yaSSL::Parameters::encrypt_size_, mySTL::fill(), yaSSL::input_buffer::get_buffer(), yaSSL::input_buffer::get_current(), yaSSL::Crypto::get_digest(), yaSSL::Digest::get_digestSize(), yaSSL::Security::get_parms(), yaSSL::SSL::get_SEQIncrement(), yaSSL::SSL::getCrypto(), yaSSL::SSL::getSecurity(), yaSSL::hmac(), yaSSL::SSL::isTLS(), memcmp(), NEW_YS, TaoCrypt::pad, yaSSL::input_buffer::read(), yaSSL::SSL::SetError(), yaSSL::SHA_LEN, yaSSL::TLS_hmac(), and yaSSL::verify_error.
00935 { 00936 int msgSz = ssl.getSecurity().get_parms().encrypt_size_; 00937 int pad = 0, padByte = 0; 00938 if (ssl.getSecurity().get_parms().cipher_type_ == block) { 00939 pad = *(input.get_buffer() + input.get_current() + msgSz - 1); 00940 padByte = 1; 00941 } 00942 int digestSz = ssl.getCrypto().get_digest().get_digestSize(); 00943 int dataSz = msgSz - digestSz - pad - padByte; 00944 opaque verify[SHA_LEN]; 00945 00946 // read data 00947 if (dataSz) { 00948 input_buffer* data; 00949 ssl.addData(data = NEW_YS input_buffer(dataSz)); 00950 input.read(data->get_buffer(), dataSz); 00951 data->add_size(dataSz); 00952 00953 if (ssl.isTLS()) 00954 TLS_hmac(ssl, verify, data->get_buffer(), dataSz, application_data, 00955 true); 00956 else 00957 hmac(ssl, verify, data->get_buffer(), dataSz, application_data, 00958 true); 00959 } 00960 00961 // read mac and fill 00962 opaque mac[SHA_LEN]; 00963 opaque fill; 00964 input.read(mac, digestSz); 00965 for (int i = 0; i < pad; i++) 00966 fill = input[AUTO]; 00967 if (padByte) 00968 fill = input[AUTO]; 00969 00970 // verify 00971 if (dataSz) { 00972 if (memcmp(mac, verify, digestSz)) { 00973 ssl.SetError(verify_error); 00974 return; 00975 } 00976 } 00977 else 00978 ssl.get_SEQIncrement(true); // even though no data, increment verify 00979 }
Here is the call graph for this function:

| input_buffer & yaSSL::Data::set | ( | input_buffer & | in | ) | [virtual] |
| opaque * yaSSL::Data::set_buffer | ( | ) |
Definition at line 919 of file yassl_imp.cpp.
References buffer_.
00920 { 00921 return buffer_; 00922 }
| void yaSSL::Data::set_length | ( | uint16 | l | ) |
| output_buffer& operator<< | ( | output_buffer & | output, | |
| const Data & | data | |||
| ) | [friend] |
Definition at line 926 of file yassl_imp.cpp.
00927 { 00928 output.write(data.write_buffer_, data.length_); 00929 return output; 00930 }
opaque* yaSSL::Data::buffer_ [private] |
uint16 yaSSL::Data::length_ [private] |
const opaque* yaSSL::Data::write_buffer_ [private] |
1.4.7

