Import latest version of yaSSL

parent 09a36146
This diff is collapsed.
......@@ -626,6 +626,7 @@ struct Connection {
bool send_server_key_; // server key exchange?
bool master_clean_; // master secret clean?
bool TLS_; // TLSv1 or greater
bool sessionID_Set_; // do we have a session
ProtocolVersion version_;
RandomPool& random_;
......
......@@ -1172,7 +1172,8 @@ input_buffer& operator>>(input_buffer& input, ServerHello& hello)
// Session
hello.id_len_ = input[AUTO];
input.read(hello.session_id_, ID_LEN);
if (hello.id_len_)
input.read(hello.session_id_, hello.id_len_);
// Suites
hello.cipher_suite_[0] = input[AUTO];
......@@ -1215,7 +1216,10 @@ void ServerHello::Process(input_buffer&, SSL& ssl)
{
ssl.set_pending(cipher_suite_[1]);
ssl.set_random(random_, server_end);
if (id_len_)
ssl.set_sessionID(session_id_);
else
ssl.useSecurity().use_connection().sessionID_Set_ = false;
if (ssl.getSecurity().get_resuming())
if (memcmp(session_id_, ssl.getSecurity().get_resume().GetID(),
......
......@@ -709,6 +709,7 @@ void SSL::set_masterSecret(const opaque* sec)
void SSL::set_sessionID(const opaque* sessionID)
{
memcpy(secure_.use_connection().sessionID_, sessionID, ID_LEN);
secure_.use_connection().sessionID_Set_ = true;
}
......@@ -1423,8 +1424,10 @@ typedef Mutex::Lock Lock;
void Sessions::add(const SSL& ssl)
{
if (ssl.getSecurity().get_connection().sessionID_Set_) {
Lock guard(mutex_);
list_.push_back(NEW_YS SSL_SESSION(ssl, random_));
}
}
......
......@@ -103,7 +103,7 @@ enum Constants
MAX_ALGO_SIZE = 9,
MAX_DIGEST_SZ = 25, // SHA + enum(Bit or Octet) + length(4)
DSA_SIG_SZ = 40,
NAME_MAX = 512 // max total of all included names
ASN_NAME_MAX = 512 // max total of all included names
};
......@@ -216,7 +216,7 @@ enum { SHA_SIZE = 20 };
// A Signing Authority
class Signer {
PublicKey key_;
char name_[NAME_MAX];
char name_[ASN_NAME_MAX];
byte hash_[SHA_SIZE];
public:
Signer(const byte* k, word32 kSz, const char* n, const byte* h);
......@@ -270,8 +270,8 @@ private:
byte subjectHash_[SHA_SIZE]; // hash of all Names
byte issuerHash_[SHA_SIZE]; // hash of all Names
byte* signature_;
char issuer_[NAME_MAX]; // Names
char subject_[NAME_MAX]; // Names
char issuer_[ASN_NAME_MAX]; // Names
char subject_[ASN_NAME_MAX]; // Names
char beforeDate_[MAX_DATE_SZ]; // valid before date
char afterDate_[MAX_DATE_SZ]; // valid after date
bool verify_; // Default to yes, but could be off
......
......@@ -665,7 +665,7 @@ void CertDecoder::GetName(NameType nt)
SHA sha;
word32 length = GetSequence(); // length of all distinguished names
assert (length < NAME_MAX);
assert (length < ASN_NAME_MAX);
length += source_.get_index();
char* ptr = (nt == ISSUER) ? issuer_ : subject_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment