Update of /cvsroot/dcplusplus/dcplusplus/yassl/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25210/yassl/src Modified Files: buffer.cpp yassl_imp.cpp handshake.cpp ssl.cpp socket_wrapper.cpp cert_wrapper.cpp crypto_wrapper.cpp yassl_int.cpp Log Message: yassl update, installer fix Index: cert_wrapper.cpp =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/yassl/src/cert_wrapper.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cert_wrapper.cpp 27 Nov 2005 19:23:07 -0000 1.1 --- cert_wrapper.cpp 19 Feb 2006 16:51:08 -0000 1.2 *************** *** 40,44 **** ! x509::x509(uint sz) : length_(sz), buffer_(new opaque[sz]) { } --- 40,44 ---- ! x509::x509(uint sz) : length_(sz), buffer_(NEW_YS opaque[sz]) { } *************** *** 52,56 **** x509::x509(const x509& that) : length_(that.length_), ! buffer_(new opaque[length_]) { memcpy(buffer_, that.buffer_, length_); --- 52,56 ---- x509::x509(const x509& that) : length_(that.length_), ! buffer_(NEW_YS opaque[length_]) { memcpy(buffer_, that.buffer_, length_); *************** *** 93,97 **** //CertManager CertManager::CertManager() ! : peerX509_(0), verifyPeer_(false), failNoCert_(false), sendVerify_(false) {} --- 93,98 ---- //CertManager CertManager::CertManager() ! : peerX509_(0), verifyPeer_(false), verifyNone_(false), failNoCert_(false), ! sendVerify_(false) {} *************** *** 115,118 **** --- 116,125 ---- + bool CertManager::verifyNone() const + { + return verifyNone_; + } + + bool CertManager::failNoCert() const { *************** *** 133,136 **** --- 140,149 ---- + void CertManager::setVerifyNone() + { + verifyNone_ = true; + } + + void CertManager::setFailNoCert() { *************** *** 154,158 **** { if (x) ! list_.push_back(new x509(*x)); } --- 167,171 ---- { if (x) ! list_.push_back(NEW_YS x509(*x)); } *************** *** 162,171 **** { TaoCrypt::Source source(x->get_buffer(), x->get_length()); ! TaoCrypt::CertDecoder cert(source, true, &signers_, TaoCrypt::CertDecoder::CA); if (!cert.GetError().What()) { const TaoCrypt::PublicKey& key = cert.GetPublicKey(); ! signers_.push_back(new TaoCrypt::Signer(key.GetKey(), key.size(), cert.GetCommonName(), cert.GetHash())); } --- 175,184 ---- { TaoCrypt::Source source(x->get_buffer(), x->get_length()); ! TaoCrypt::CertDecoder cert(source, true, &signers_, verifyNone_, TaoCrypt::CertDecoder::CA); if (!cert.GetError().What()) { const TaoCrypt::PublicKey& key = cert.GetPublicKey(); ! signers_.push_back(NEW_YS TaoCrypt::Signer(key.GetKey(), key.size(), cert.GetCommonName(), cert.GetHash())); } *************** *** 230,234 **** while ( count > 1 ) { TaoCrypt::Source source((*last)->get_buffer(), (*last)->get_length()); ! TaoCrypt::CertDecoder cert(source, true, &signers_); if (int err = cert.GetError().What()) --- 243,247 ---- while ( count > 1 ) { TaoCrypt::Source source((*last)->get_buffer(), (*last)->get_length()); ! TaoCrypt::CertDecoder cert(source, true, &signers_, verifyNone_); if (int err = cert.GetError().What()) *************** *** 236,240 **** const TaoCrypt::PublicKey& key = cert.GetPublicKey(); ! signers_.push_back(new TaoCrypt::Signer(key.GetKey(), key.size(), cert.GetCommonName(), cert.GetHash())); --last; --- 249,253 ---- const TaoCrypt::PublicKey& key = cert.GetPublicKey(); ! signers_.push_back(NEW_YS TaoCrypt::Signer(key.GetKey(), key.size(), cert.GetCommonName(), cert.GetHash())); --last; *************** *** 245,249 **** // peer's is at the front TaoCrypt::Source source((*last)->get_buffer(), (*last)->get_length()); ! TaoCrypt::CertDecoder cert(source, true, &signers_); if (int err = cert.GetError().What()) --- 258,262 ---- // peer's is at the front TaoCrypt::Source source((*last)->get_buffer(), (*last)->get_length()); ! TaoCrypt::CertDecoder cert(source, true, &signers_, verifyNone_); if (int err = cert.GetError().What()) *************** *** 261,265 **** int iSz = cert.GetIssuer() ? strlen(cert.GetIssuer()) + 1 : 0; int sSz = cert.GetCommonName() ? strlen(cert.GetCommonName()) + 1 : 0; ! peerX509_ = new X509(cert.GetIssuer(), iSz, cert.GetCommonName(), sSz); } --- 274,278 ---- int iSz = cert.GetIssuer() ? strlen(cert.GetIssuer()) + 1 : 0; int sSz = cert.GetCommonName() ? strlen(cert.GetCommonName()) + 1 : 0; ! peerX509_ = NEW_YS X509(cert.GetIssuer(), iSz, cert.GetCommonName(), sSz); } Index: ssl.cpp =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/yassl/src/ssl.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ssl.cpp 27 Nov 2005 19:23:07 -0000 1.1 --- ssl.cpp 19 Feb 2006 16:51:08 -0000 1.2 *************** *** 30,34 **** - /* see man pages for function descriptions */ --- 30,33 ---- *************** *** 39,42 **** --- 38,49 ---- #include <stdio.h> + #ifdef _WIN32 + #include <windows.h> // FindFirstFile etc.. + #else + #include <sys/types.h> // file helper + #include <sys/stat.h> // stat + #include <dirent.h> // opendir + #endif + namespace yaSSL { *************** *** 53,57 **** SSL_METHOD* SSLv3_server_method() { ! return new SSL_METHOD(server_end, ProtocolVersion(3,0)); } --- 60,64 ---- SSL_METHOD* SSLv3_server_method() { ! return NEW_YS SSL_METHOD(server_end, ProtocolVersion(3,0)); } *************** *** 59,63 **** SSL_METHOD* SSLv3_client_method() { ! return new SSL_METHOD(client_end, ProtocolVersion(3,0)); } --- 66,70 ---- SSL_METHOD* SSLv3_client_method() { ! return NEW_YS SSL_METHOD(client_end, ProtocolVersion(3,0)); } *************** *** 65,69 **** SSL_METHOD* TLSv1_server_method() { ! return new SSL_METHOD(server_end, ProtocolVersion(3,1)); } --- 72,76 ---- SSL_METHOD* TLSv1_server_method() { ! return NEW_YS SSL_METHOD(server_end, ProtocolVersion(3,1)); } *************** *** 71,75 **** SSL_METHOD* TLSv1_client_method() { ! return new SSL_METHOD(client_end, ProtocolVersion(3,1)); } --- 78,82 ---- SSL_METHOD* TLSv1_client_method() { ! return NEW_YS SSL_METHOD(client_end, ProtocolVersion(3,1)); } *************** *** 84,88 **** SSL_CTX* SSL_CTX_new(SSL_METHOD* method) { ! return new SSL_CTX(method); } --- 91,95 ---- SSL_CTX* SSL_CTX_new(SSL_METHOD* method) { ! return NEW_YS SSL_CTX(method); } *************** *** 96,100 **** SSL* SSL_new(SSL_CTX* ctx) { ! return new SSL(ctx); } --- 103,107 ---- SSL* SSL_new(SSL_CTX* ctx) { ! return NEW_YS SSL(ctx); } *************** *** 459,463 **** long sz = ftell(input); rewind(input); ! x = new x509(sz); // takes ownership size_t bytes = fread(x->use_buffer(), sz, 1, input); if (bytes != 1) { --- 466,470 ---- long sz = ftell(input); rewind(input); ! x = NEW_YS x509(sz); // takes ownership size_t bytes = fread(x->use_buffer(), sz, 1, input); if (bytes != 1) { *************** *** 496,499 **** --- 503,509 ---- ctx->setVerifyPeer(); + if (mode == SSL_VERIFY_NONE) + ctx->setVerifyNone(); + if (mode & SSL_VERIFY_FAIL_IF_NO_PEER_CERT) ctx->setFailNoCert(); *************** *** 502,509 **** int SSL_CTX_load_verify_locations(SSL_CTX* ctx, const char* file, ! const char* /*path*/) { ! // just files for now ! return read_file(ctx, file, SSL_FILETYPE_PEM, CA); } --- 512,574 ---- int SSL_CTX_load_verify_locations(SSL_CTX* ctx, const char* file, ! const char* path) { ! int ret = SSL_SUCCESS; ! const int HALF_PATH = 128; ! ! if (file) ret = read_file(ctx, file, SSL_FILETYPE_PEM, CA); ! ! if (ret == SSL_SUCCESS && path) { ! // call read_file for each reqular file in path ! #ifdef _WIN32 ! ! WIN32_FIND_DATA FindFileData; ! HANDLE hFind; ! ! char name[MAX_PATH + 1]; // directory specification ! strncpy(name, path, MAX_PATH - 3); ! strncat(name, "\\*", 3); ! ! hFind = FindFirstFile(name, &FindFileData); ! if (hFind == INVALID_HANDLE_VALUE) return SSL_BAD_PATH; ! ! do { ! if (FindFileData.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY) { ! strncpy(name, path, MAX_PATH - 2 - HALF_PATH); ! strncat(name, "\\", 2); ! strncat(name, FindFileData.cFileName, HALF_PATH); ! ret = read_file(ctx, name, SSL_FILETYPE_PEM, CA); ! } ! } while (ret == SSL_SUCCESS && FindNextFile(hFind, &FindFileData)); ! ! FindClose(hFind); ! ! #else // _WIN32 ! ! const int MAX_PATH = 260; ! ! DIR* dir = opendir(path); ! if (!dir) return SSL_BAD_PATH; ! ! struct dirent* entry; ! struct stat buf; ! char name[MAX_PATH + 1]; ! ! while (ret == SSL_SUCCESS && (entry = readdir(dir))) { ! strncpy(name, path, MAX_PATH - 1 - HALF_PATH); ! strncat(name, "/", 1); ! strncat(name, entry->d_name, HALF_PATH); ! if (stat(name, &buf) < 0) return SSL_BAD_STAT; ! ! if (S_ISREG(buf.st_mode)) ! ret = read_file(ctx, name, SSL_FILETYPE_PEM, CA); ! } ! ! closedir(dir); ! ! #endif ! } ! ! return ret; } *************** *** 654,658 **** DH* DH_new(void) { ! DH* dh = new DH; if (dh) dh->p = dh->g = 0; --- 719,723 ---- DH* DH_new(void) { ! DH* dh = NEW_YS DH; if (dh) dh->p = dh->g = 0; *************** *** 679,683 **** if (!retVal) { created = true; ! bn.reset(new BIGNUM); retVal = bn.get(); } --- 744,748 ---- if (!retVal) { created = true; ! bn.reset(NEW_YS BIGNUM); retVal = bn.get(); } *************** *** 730,734 **** { // TODO: FIX add to some list for destruction ! return new MD5; } --- 795,799 ---- { // TODO: FIX add to some list for destruction ! return NEW_YS MD5; } *************** *** 737,741 **** { // TODO: FIX add to some list for destruction ! return new DES_EDE; } --- 802,806 ---- { // TODO: FIX add to some list for destruction ! return NEW_YS DES_EDE; } Index: buffer.cpp =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/yassl/src/buffer.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** buffer.cpp 27 Nov 2005 19:23:07 -0000 1.1 --- buffer.cpp 19 Feb 2006 16:51:08 -0000 1.2 *************** *** 65,69 **** input_buffer::input_buffer(uint s) ! : size_(0), current_(0), buffer_(new byte[s]), end_(buffer_ + s) {} --- 65,69 ---- input_buffer::input_buffer(uint s) ! : size_(0), current_(0), buffer_(NEW_YS byte[s]), end_(buffer_ + s) {} *************** *** 71,75 **** // with assign input_buffer::input_buffer(uint s, const byte* t, uint len) ! : size_(0), current_(0), buffer_(new byte[s]), end_(buffer_ + s) { assign(t, len); --- 71,75 ---- // with assign input_buffer::input_buffer(uint s, const byte* t, uint len) ! : size_(0), current_(0), buffer_(NEW_YS byte[s]), end_(buffer_ + s) { assign(t, len); *************** *** 87,91 **** { assert(!buffer_); // find realloc error ! buffer_ = new byte[s]; end_ = buffer_ + s; } --- 87,91 ---- { assert(!buffer_); // find realloc error ! buffer_ = NEW_YS byte[s]; end_ = buffer_ + s; } *************** *** 99,103 **** ! // after a raw write user can set new size // if you know the size before the write use assign() void input_buffer::add_size(uint i) --- 99,103 ---- ! // after a raw write user can set NEW_YS size // if you know the size before the write use assign() void input_buffer::add_size(uint i) *************** *** 201,205 **** // with allocate output_buffer::output_buffer(uint s) ! : current_(0), buffer_(new byte[s]), end_(buffer_ + s) {} --- 201,205 ---- // with allocate output_buffer::output_buffer(uint s) ! : current_(0), buffer_(NEW_YS byte[s]), end_(buffer_ + s) {} *************** *** 207,211 **** // with assign output_buffer::output_buffer(uint s, const byte* t, uint len) ! : current_(0), buffer_(new byte[s]), end_(buffer_+ s) { write(t, len); --- 207,211 ---- // with assign output_buffer::output_buffer(uint s, const byte* t, uint len) ! : current_(0), buffer_(NEW_YS byte[s]), end_(buffer_+ s) { write(t, len); *************** *** 242,246 **** { assert(!buffer_); // find realloc error ! buffer_ = new byte[s]; end_ = buffer_ + s; } --- 242,246 ---- { assert(!buffer_); // find realloc error ! buffer_ = NEW_YS byte[s]; end_ = buffer_ + s; } Index: yassl_int.cpp =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/yassl/src/yassl_int.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** yassl_int.cpp 27 Nov 2005 19:23:08 -0000 1.1 --- yassl_int.cpp 19 Feb 2006 16:51:08 -0000 1.2 *************** *** 32,69 **** - void* operator new(size_t sz, yaSSL::new_t) - { #ifdef YASSL_PURE_C - void* ptr = malloc(sz ? sz : 1); - if (!ptr) abort(); ! return ptr; ! #else ! return ::operator new(sz); ! #endif ! } - void operator delete(void* ptr, yaSSL::new_t) - { - #ifdef YASSL_PURE_C - if (ptr) free(ptr); - #else - ::operator delete(ptr); - #endif - } - void* operator new[](size_t sz, yaSSL::new_t nt) - { - return ::operator new(sz, nt); - } - void operator delete[](void* ptr, yaSSL::new_t nt) - { - ::operator delete(ptr, nt); - } --- 32,70 ---- #ifdef YASSL_PURE_C ! void* operator new(size_t sz, yaSSL::new_t) ! { ! void* ptr = malloc(sz ? sz : 1); ! if (!ptr) abort(); + return ptr; + } + void operator delete(void* ptr, yaSSL::new_t) + { + if (ptr) free(ptr); + } + void* operator new[](size_t sz, yaSSL::new_t nt) + { + return ::operator new(sz, nt); + } + void operator delete[](void* ptr, yaSSL::new_t nt) + { + ::operator delete(ptr, nt); + } + + namespace yaSSL { + + new_t ys; // for yaSSL library new + + } + + #endif // YASSL_PURE_C *************** *** 73,77 **** using mySTL::min; - new_t ys; // for yaSSL library new --- 74,77 ---- *************** *** 287,290 **** --- 287,292 ---- if (ctx->getMethod()->verifyPeer()) cm.setVerifyPeer(); + if (ctx->getMethod()->verifyNone()) + cm.setVerifyNone(); if (ctx->getMethod()->failNoCert()) cm.setFailNoCert(); *************** *** 322,327 **** parms.iv_size_ = AES_BLOCK_SZ; parms.cipher_type_ = block; ! crypto_.setDigest(new SHA); ! crypto_.setCipher(new AES(AES_256_KEY_SZ)); strncpy(parms.cipher_name_, cipher_names[TLS_RSA_WITH_AES_256_CBC_SHA], MAX_SUITE_NAME); --- 324,329 ---- parms.iv_size_ = AES_BLOCK_SZ; parms.cipher_type_ = block; ! crypto_.setDigest(NEW_YS SHA); ! crypto_.setCipher(NEW_YS AES(AES_256_KEY_SZ)); strncpy(parms.cipher_name_, cipher_names[TLS_RSA_WITH_AES_256_CBC_SHA], MAX_SUITE_NAME); *************** *** 336,341 **** parms.iv_size_ = AES_BLOCK_SZ; parms.cipher_type_ = block; ! crypto_.setDigest(new SHA); ! crypto_.setCipher(new AES); strncpy(parms.cipher_name_, cipher_names[TLS_RSA_WITH_AES_128_CBC_SHA], MAX_SUITE_NAME); --- 338,343 ---- parms.iv_size_ = AES_BLOCK_SZ; parms.cipher_type_ = block; ! crypto_.setDigest(NEW_YS SHA); ! crypto_.setCipher(NEW_YS AES); strncpy(parms.cipher_name_, cipher_names[TLS_RSA_WITH_AES_128_CBC_SHA], MAX_SUITE_NAME); *************** *** 350,355 **** parms.iv_size_ = DES_IV_SZ; parms.cipher_type_ = block; ! crypto_.setDigest(new SHA); ! crypto_.setCipher(new DES_EDE); strncpy(parms.cipher_name_, cipher_names[SSL_RSA_WITH_3DES_EDE_CBC_SHA] , MAX_SUITE_NAME); --- 352,357 ---- parms.iv_size_ = DES_IV_SZ; parms.cipher_type_ = block; ! crypto_.setDigest(NEW_YS SHA); ! crypto_.setCipher(NEW_YS DES_EDE); strncpy(parms.cipher_name_, cipher_names[SSL_RSA_WITH_3DES_EDE_CBC_SHA] , MAX_SUITE_NAME); *************** *** 364,369 **** parms.iv_size_ = DES_IV_SZ; parms.cipher_type_ = block; ! crypto_.setDigest(new SHA); ! crypto_.setCipher(new DES); strncpy(parms.cipher_name_, cipher_names[SSL_RSA_WITH_DES_CBC_SHA], MAX_SUITE_NAME); --- 366,371 ---- parms.iv_size_ = DES_IV_SZ; parms.cipher_type_ = block; ! crypto_.setDigest(NEW_YS SHA); ! crypto_.setCipher(NEW_YS DES); strncpy(parms.cipher_name_, cipher_names[SSL_RSA_WITH_DES_CBC_SHA], MAX_SUITE_NAME); *************** *** 378,383 **** parms.iv_size_ = 0; parms.cipher_type_ = stream; ! crypto_.setDigest(new SHA); ! crypto_.setCipher(new RC4); strncpy(parms.cipher_name_, cipher_names[SSL_RSA_WITH_RC4_128_SHA], MAX_SUITE_NAME); --- 380,385 ---- parms.iv_size_ = 0; parms.cipher_type_ = stream; ! crypto_.setDigest(NEW_YS SHA); ! crypto_.setCipher(NEW_YS RC4); strncpy(parms.cipher_name_, cipher_names[SSL_RSA_WITH_RC4_128_SHA], MAX_SUITE_NAME); *************** *** 392,397 **** parms.iv_size_ = 0; parms.cipher_type_ = stream; ! crypto_.setDigest(new MD5); ! crypto_.setCipher(new RC4); strncpy(parms.cipher_name_, cipher_names[SSL_RSA_WITH_RC4_128_MD5], MAX_SUITE_NAME); --- 394,399 ---- parms.iv_size_ = 0; parms.cipher_type_ = stream; ! crypto_.setDigest(NEW_YS MD5); ! crypto_.setCipher(NEW_YS RC4); strncpy(parms.cipher_name_, cipher_names[SSL_RSA_WITH_RC4_128_MD5], MAX_SUITE_NAME); *************** *** 408,413 **** parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(new SHA); ! crypto_.setCipher(new DES); strncpy(parms.cipher_name_, cipher_names[SSL_DHE_RSA_WITH_DES_CBC_SHA], MAX_SUITE_NAME); --- 410,415 ---- parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(NEW_YS SHA); ! crypto_.setCipher(NEW_YS DES); strncpy(parms.cipher_name_, cipher_names[SSL_DHE_RSA_WITH_DES_CBC_SHA], MAX_SUITE_NAME); *************** *** 424,429 **** parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(new SHA); ! crypto_.setCipher(new DES_EDE); strncpy(parms.cipher_name_, cipher_names[SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA], MAX_SUITE_NAME); --- 426,431 ---- parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(NEW_YS SHA); ! crypto_.setCipher(NEW_YS DES_EDE); strncpy(parms.cipher_name_, cipher_names[SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA], MAX_SUITE_NAME); *************** *** 440,445 **** parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(new SHA); ! crypto_.setCipher(new AES(AES_256_KEY_SZ)); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_RSA_WITH_AES_256_CBC_SHA], MAX_SUITE_NAME); --- 442,447 ---- parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(NEW_YS SHA); ! crypto_.setCipher(NEW_YS AES(AES_256_KEY_SZ)); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_RSA_WITH_AES_256_CBC_SHA], MAX_SUITE_NAME); *************** *** 456,461 **** parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(new SHA); ! crypto_.setCipher(new AES); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_RSA_WITH_AES_128_CBC_SHA], MAX_SUITE_NAME); --- 458,463 ---- parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(NEW_YS SHA); ! crypto_.setCipher(NEW_YS AES); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_RSA_WITH_AES_128_CBC_SHA], MAX_SUITE_NAME); *************** *** 472,477 **** parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(new SHA); ! crypto_.setCipher(new DES); strncpy(parms.cipher_name_, cipher_names[SSL_DHE_DSS_WITH_DES_CBC_SHA], MAX_SUITE_NAME); --- 474,479 ---- parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(NEW_YS SHA); ! crypto_.setCipher(NEW_YS DES); strncpy(parms.cipher_name_, cipher_names[SSL_DHE_DSS_WITH_DES_CBC_SHA], MAX_SUITE_NAME); *************** *** 488,493 **** parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(new SHA); ! crypto_.setCipher(new DES_EDE); strncpy(parms.cipher_name_, cipher_names[SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA], MAX_SUITE_NAME); --- 490,495 ---- parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(NEW_YS SHA); ! crypto_.setCipher(NEW_YS DES_EDE); strncpy(parms.cipher_name_, cipher_names[SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA], MAX_SUITE_NAME); *************** *** 504,509 **** parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(new SHA); ! crypto_.setCipher(new AES(AES_256_KEY_SZ)); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_DSS_WITH_AES_256_CBC_SHA], MAX_SUITE_NAME); --- 506,511 ---- parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(NEW_YS SHA); ! crypto_.setCipher(NEW_YS AES(AES_256_KEY_SZ)); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_DSS_WITH_AES_256_CBC_SHA], MAX_SUITE_NAME); *************** *** 520,525 **** parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(new SHA); ! crypto_.setCipher(new AES); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_DSS_WITH_AES_128_CBC_SHA], MAX_SUITE_NAME); --- 522,527 ---- parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(NEW_YS SHA); ! crypto_.setCipher(NEW_YS AES); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_DSS_WITH_AES_128_CBC_SHA], MAX_SUITE_NAME); *************** *** 534,539 **** parms.iv_size_ = AES_BLOCK_SZ; parms.cipher_type_ = block; ! crypto_.setDigest(new RMD); ! crypto_.setCipher(new AES(AES_256_KEY_SZ)); strncpy(parms.cipher_name_, cipher_names[TLS_RSA_WITH_AES_256_CBC_RMD160], MAX_SUITE_NAME); --- 536,541 ---- parms.iv_size_ = AES_BLOCK_SZ; parms.cipher_type_ = block; ! crypto_.setDigest(NEW_YS RMD); ! crypto_.setCipher(NEW_YS AES(AES_256_KEY_SZ)); strncpy(parms.cipher_name_, cipher_names[TLS_RSA_WITH_AES_256_CBC_RMD160], MAX_SUITE_NAME); *************** *** 548,553 **** parms.iv_size_ = AES_BLOCK_SZ; parms.cipher_type_ = block; ! crypto_.setDigest(new RMD); ! crypto_.setCipher(new AES); strncpy(parms.cipher_name_, cipher_names[TLS_RSA_WITH_AES_128_CBC_RMD160], MAX_SUITE_NAME); --- 550,555 ---- parms.iv_size_ = AES_BLOCK_SZ; parms.cipher_type_ = block; ! crypto_.setDigest(NEW_YS RMD); ! crypto_.setCipher(NEW_YS AES); strncpy(parms.cipher_name_, cipher_names[TLS_RSA_WITH_AES_128_CBC_RMD160], MAX_SUITE_NAME); *************** *** 562,567 **** parms.iv_size_ = DES_IV_SZ; parms.cipher_type_ = block; ! crypto_.setDigest(new RMD); ! crypto_.setCipher(new DES_EDE); strncpy(parms.cipher_name_, cipher_names[TLS_RSA_WITH_3DES_EDE_CBC_RMD160], MAX_SUITE_NAME); --- 564,569 ---- parms.iv_size_ = DES_IV_SZ; parms.cipher_type_ = block; ! crypto_.setDigest(NEW_YS RMD); ! crypto_.setCipher(NEW_YS DES_EDE); strncpy(parms.cipher_name_, cipher_names[TLS_RSA_WITH_3DES_EDE_CBC_RMD160], MAX_SUITE_NAME); *************** *** 578,583 **** parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(new RMD); ! crypto_.setCipher(new DES_EDE); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_RSA_WITH_3DES_EDE_CBC_RMD160], --- 580,585 ---- parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(NEW_YS RMD); ! crypto_.setCipher(NEW_YS DES_EDE); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_RSA_WITH_3DES_EDE_CBC_RMD160], *************** *** 595,600 **** parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(new RMD); ! crypto_.setCipher(new AES(AES_256_KEY_SZ)); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_RSA_WITH_AES_256_CBC_RMD160], --- 597,602 ---- parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(NEW_YS RMD); ! crypto_.setCipher(NEW_YS AES(AES_256_KEY_SZ)); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_RSA_WITH_AES_256_CBC_RMD160], *************** *** 612,617 **** parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(new RMD); ! crypto_.setCipher(new AES); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_RSA_WITH_AES_128_CBC_RMD160], --- 614,619 ---- parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(NEW_YS RMD); ! crypto_.setCipher(NEW_YS AES); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_RSA_WITH_AES_128_CBC_RMD160], *************** *** 629,634 **** parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(new RMD); ! crypto_.setCipher(new DES_EDE); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_DSS_WITH_3DES_EDE_CBC_RMD160], --- 631,636 ---- parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(NEW_YS RMD); ! crypto_.setCipher(NEW_YS DES_EDE); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_DSS_WITH_3DES_EDE_CBC_RMD160], *************** *** 646,651 **** parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(new RMD); ! crypto_.setCipher(new AES(AES_256_KEY_SZ)); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_DSS_WITH_AES_256_CBC_RMD160], --- 648,653 ---- parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(NEW_YS RMD); ! crypto_.setCipher(NEW_YS AES(AES_256_KEY_SZ)); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_DSS_WITH_AES_256_CBC_RMD160], *************** *** 663,668 **** parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(new RMD); ! crypto_.setCipher(new AES); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_DSS_WITH_AES_128_CBC_RMD160], --- 665,670 ---- parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph ! crypto_.setDigest(NEW_YS RMD); ! crypto_.setCipher(NEW_YS AES); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_DSS_WITH_AES_128_CBC_RMD160], *************** *** 1384,1388 **** { Lock guard(mutex_); ! list_.push_back(new SSL_SESSION(ssl, random_)); } --- 1386,1390 ---- { Lock guard(mutex_); ! list_.push_back(NEW_YS SSL_SESSION(ssl, random_)); } *************** *** 1451,1455 **** SSL_METHOD::SSL_METHOD(ConnectionEnd ce, ProtocolVersion pv) ! : version_(pv), side_(ce), verifyPeer_(false), failNoCert_(false) {} --- 1453,1458 ---- SSL_METHOD::SSL_METHOD(ConnectionEnd ce, ProtocolVersion pv) ! : version_(pv), side_(ce), verifyPeer_(false), verifyNone_(false), ! failNoCert_(false) {} *************** *** 1473,1476 **** --- 1476,1485 ---- + void SSL_METHOD::setVerifyNone() + { + verifyNone_ = true; + } + + void SSL_METHOD::setFailNoCert() { *************** *** 1485,1488 **** --- 1494,1503 ---- + bool SSL_METHOD::verifyNone() const + { + return verifyNone_; + } + + bool SSL_METHOD::failNoCert() const { *************** *** 1561,1564 **** --- 1576,1585 ---- + void SSL_CTX::setVerifyNone() + { + method_->setVerifyNone(); + } + + void SSL_CTX::setFailNoCert() { *************** *** 1783,1787 **** { if (dh.set_) ! dh_ = new DiffieHellman(dh.p_, dh.g_, random_); } --- 1804,1808 ---- { if (dh.set_) ! dh_ = NEW_YS DiffieHellman(dh.p_, dh.g_, random_); } *************** *** 1950,1954 **** { if (sz) { ! name_ = new char[sz]; memcpy(name_, n, sz); } --- 1971,1975 ---- { if (sz) { ! name_ = NEW_YS char[sz]; memcpy(name_, n, sz); } Index: socket_wrapper.cpp =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/yassl/src/socket_wrapper.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** socket_wrapper.cpp 3 Dec 2005 00:18:08 -0000 1.2 --- socket_wrapper.cpp 19 Feb 2006 16:51:08 -0000 1.3 *************** *** 47,53 **** --- 47,55 ---- const int SOCKET_EINVAL = WSAEINVAL; const int SOCKET_EWOULDBLOCK = WSAEWOULDBLOCK; + const int SOCKET_EAGAIN = WSAEWOULDBLOCK; #else const int SOCKET_EINVAL = EINVAL; const int SOCKET_EWOULDBLOCK = EWOULDBLOCK; + const int SOCKET_EAGAIN = EAGAIN; #endif // _WIN32 *************** *** 123,147 **** int recvd = ::recv(socket_, reinterpret_cast<char *>(buf), sz, flags); ! if (recvd == -1) { ! #ifdef _WIN32 ! if(WSAGetLastError() == WSAEWOULDBLOCK) ! #else ! if(errno == EAGAIN) ! #endif ! return 0; ! else ! return (uint)-1; ! } else if(recvd == 0) { ! return (uint)-1; ! } return recvd; } ! // wait if blocking for input, or error bool Socket::wait() const { byte b; ! return receive(&b, 1, MSG_PEEK) != (uint)-1; } --- 125,146 ---- int recvd = ::recv(socket_, reinterpret_cast<char *>(buf), sz, flags); ! // idea to seperate error from would block by arn...@gm... ! if (recvd == -1) { ! if (get_lastError() == SOCKET_EWOULDBLOCK || ! get_lastError() == SOCKET_EAGAIN) ! return 0; ! } ! else if (recvd == 0) ! return static_cast<uint>(-1); ! return recvd; } ! // wait if blocking for input, return false for error bool Socket::wait() const { byte b; ! return receive(&b, 1, MSG_PEEK) != static_cast<uint>(-1); } Index: handshake.cpp =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/yassl/src/handshake.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** handshake.cpp 3 Dec 2005 00:18:08 -0000 1.2 --- handshake.cpp 19 Feb 2006 16:51:08 -0000 1.3 *************** *** 25,28 **** --- 25,30 ---- */ + + #include "runtime.hpp" #include "handshake.hpp" *************** *** 363,369 **** if (hash == md5) ! hmac.reset(new HMAC_MD5(secret.get_buffer(), secret.get_size())); else ! hmac.reset(new HMAC_SHA(secret.get_buffer(), secret.get_size())); // A0 = seed hmac->get_digest(previous, seed.get_buffer(), seed.get_size());// A1 --- 365,371 ---- if (hash == md5) ! hmac.reset(NEW_YS HMAC_MD5(secret.get_buffer(), secret.get_size())); else ! hmac.reset(NEW_YS HMAC_SHA(secret.get_buffer(), secret.get_size())); // A0 = seed hmac->get_digest(previous, seed.get_buffer(), seed.get_size());// A1 *************** *** 583,591 **** if (algo == sha) ! hmac.reset(new HMAC_SHA(ssl.get_macSecret(verify), SHA_LEN)); else if (algo == rmd) ! hmac.reset(new HMAC_RMD(ssl.get_macSecret(verify), RMD_LEN)); else ! hmac.reset(new HMAC_MD5(ssl.get_macSecret(verify), MD5_LEN)); hmac->update(seq, SEQ_SZ); // seq_num --- 585,593 ---- if (algo == sha) ! hmac.reset(NEW_YS HMAC_SHA(ssl.get_macSecret(verify), SHA_LEN)); else if (algo == rmd) ! hmac.reset(NEW_YS HMAC_RMD(ssl.get_macSecret(verify), RMD_LEN)); else ! hmac.reset(NEW_YS HMAC_MD5(ssl.get_macSecret(verify), MD5_LEN)); hmac->update(seq, SEQ_SZ); // seq_num *************** *** 655,665 **** DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered) { ! // wait for input if blocking ! if(!ssl.getSocket().wait()) { ! ssl.SetError(receive_error); ! return buffered; ! } uint ready = ssl.getSocket().get_ready(); ! if (!ready) return buffered; // add buffered data if its there --- 657,667 ---- DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered) { ! // wait for input if blocking ! if (!ssl.getSocket().wait()) { ! ssl.SetError(receive_error); ! return buffered = null_buffer; ! } uint ready = ssl.getSocket().get_ready(); ! if (!ready) return buffered; // add buffered data if its there *************** *** 671,675 **** } ! // add new data uint read = ssl.getSocket().receive(buffer.get_buffer() + buffSz, ready); buffer.add_size(read); --- 673,677 ---- } ! // add NEW_YS data uint read = ssl.getSocket().receive(buffer.get_buffer() + buffSz, ready); buffer.add_size(read); *************** *** 692,696 **** if (hdr.length_ > buffer.get_remaining()) { uint sz = buffer.get_remaining() + RECORD_HEADER; ! buffered.reset(new input_buffer(sz, buffer.get_buffer() + buffer.get_current() - RECORD_HEADER, sz)); break; --- 694,698 ---- if (hdr.length_ > buffer.get_remaining()) { uint sz = buffer.get_remaining() + RECORD_HEADER; ! buffered.reset(NEW_YS input_buffer(sz, buffer.get_buffer() + buffer.get_current() - RECORD_HEADER, sz)); break; *************** *** 728,731 **** --- 730,734 ---- else break; + if (ssl.GetError()) return; } } *************** *** 765,769 **** RecordLayerHeader rlHeader; HandShakeHeader hsHeader; ! mySTL::auto_ptr<output_buffer> out(new output_buffer, ysDelete); buildHeaders(ssl, hsHeader, rlHeader, ck); buildOutput(*out.get(), rlHeader, hsHeader, ck); --- 768,772 ---- RecordLayerHeader rlHeader; HandShakeHeader hsHeader; ! mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer, ysDelete); buildHeaders(ssl, hsHeader, rlHeader, ck); buildOutput(*out.get(), rlHeader, hsHeader, ck); *************** *** 786,790 **** RecordLayerHeader rlHeader; HandShakeHeader hsHeader; ! mySTL::auto_ptr<output_buffer> out(new output_buffer, ysDelete); buildHeaders(ssl, hsHeader, rlHeader, sk); buildOutput(*out.get(), rlHeader, hsHeader, sk); --- 789,793 ---- RecordLayerHeader rlHeader; HandShakeHeader hsHeader; ! mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer, ysDelete); buildHeaders(ssl, hsHeader, rlHeader, sk); buildOutput(*out.get(), rlHeader, hsHeader, sk); *************** *** 811,815 **** RecordLayerHeader rlHeader; buildHeader(ssl, rlHeader, ccs); ! mySTL::auto_ptr<output_buffer> out(new output_buffer, ysDelete); buildOutput(*out.get(), rlHeader, ccs); --- 814,818 ---- RecordLayerHeader rlHeader; buildHeader(ssl, rlHeader, ccs); ! mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer, ysDelete); buildOutput(*out.get(), rlHeader, ccs); *************** *** 828,832 **** Finished fin; buildFinished(ssl, fin, side == client_end ? client : server); ! mySTL::auto_ptr<output_buffer> out(new output_buffer, ysDelete); cipherFinished(ssl, fin, *out.get()); // hashes handshake --- 831,835 ---- Finished fin; buildFinished(ssl, fin, side == client_end ? client : server); ! mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer, ysDelete); cipherFinished(ssl, fin, *out.get()); // hashes handshake *************** *** 912,916 **** RecordLayerHeader rlHeader; HandShakeHeader hsHeader; ! mySTL::auto_ptr<output_buffer> out(new output_buffer, ysDelete); buildServerHello(ssl, sh); --- 915,919 ---- RecordLayerHeader rlHeader; HandShakeHeader hsHeader; ! mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer, ysDelete); buildServerHello(ssl, sh); *************** *** 935,939 **** RecordLayerHeader rlHeader; HandShakeHeader hsHeader; ! mySTL::auto_ptr<output_buffer> out(new output_buffer, ysDelete); buildHeaders(ssl, hsHeader, rlHeader, shd); --- 938,942 ---- RecordLayerHeader rlHeader; HandShakeHeader hsHeader; ! mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer, ysDelete); buildHeaders(ssl, hsHeader, rlHeader, shd); *************** *** 956,960 **** RecordLayerHeader rlHeader; HandShakeHeader hsHeader; ! mySTL::auto_ptr<output_buffer> out(new output_buffer, ysDelete); buildHeaders(ssl, hsHeader, rlHeader, cert); --- 959,963 ---- RecordLayerHeader rlHeader; HandShakeHeader hsHeader; ! mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer, ysDelete); buildHeaders(ssl, hsHeader, rlHeader, cert); *************** *** 978,982 **** RecordLayerHeader rlHeader; HandShakeHeader hsHeader; ! mySTL::auto_ptr<output_buffer> out(new output_buffer, ysDelete); buildHeaders(ssl, hsHeader, rlHeader, request); --- 981,985 ---- RecordLayerHeader rlHeader; HandShakeHeader hsHeader; ! mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer, ysDelete); buildHeaders(ssl, hsHeader, rlHeader, request); *************** *** 1000,1004 **** RecordLayerHeader rlHeader; HandShakeHeader hsHeader; ! mySTL::auto_ptr<output_buffer> out(new output_buffer, ysDelete); buildHeaders(ssl, hsHeader, rlHeader, verify); --- 1003,1007 ---- RecordLayerHeader rlHeader; HandShakeHeader hsHeader; ! mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer, ysDelete); buildHeaders(ssl, hsHeader, rlHeader, verify); Index: crypto_wrapper.cpp =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/yassl/src/crypto_wrapper.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** crypto_wrapper.cpp 27 Nov 2005 19:23:08 -0000 1.1 --- crypto_wrapper.cpp 19 Feb 2006 16:51:08 -0000 1.2 *************** *** 59,63 **** ! MD5::MD5() : pimpl_(new MD5Impl) {} --- 59,63 ---- ! MD5::MD5() : pimpl_(NEW_YS MD5Impl) {} *************** *** 65,69 **** ! MD5::MD5(const MD5& that) : Digest(), pimpl_(new MD5Impl(that.pimpl_->md5_)) {} --- 65,69 ---- ! MD5::MD5(const MD5& that) : Digest(), pimpl_(NEW_YS MD5Impl(that.pimpl_->md5_)) {} *************** *** 117,121 **** ! SHA::SHA() : pimpl_(new SHAImpl) {} --- 117,121 ---- ! SHA::SHA() : pimpl_(NEW_YS SHAImpl) {} *************** *** 123,127 **** ! SHA::SHA(const SHA& that) : Digest(), pimpl_(new SHAImpl(that.pimpl_->sha_)) {} SHA& SHA::operator=(const SHA& that) --- 123,127 ---- ! SHA::SHA(const SHA& that) : Digest(), pimpl_(NEW_YS SHAImpl(that.pimpl_->sha_)) {} SHA& SHA::operator=(const SHA& that) *************** *** 174,178 **** ! RMD::RMD() : pimpl_(new RMDImpl) {} --- 174,178 ---- ! RMD::RMD() : pimpl_(NEW_YS RMDImpl) {} *************** *** 180,184 **** ! RMD::RMD(const RMD& that) : Digest(), pimpl_(new RMDImpl(that.pimpl_->rmd_)) {} RMD& RMD::operator=(const RMD& that) --- 180,184 ---- ! RMD::RMD(const RMD& that) : Digest(), pimpl_(NEW_YS RMDImpl(that.pimpl_->rmd_)) {} RMD& RMD::operator=(const RMD& that) *************** *** 231,235 **** HMAC_MD5::HMAC_MD5(const byte* secret, unsigned int len) ! : pimpl_(new HMAC_MD5Impl) { pimpl_->mac_.SetKey(secret, len); --- 231,235 ---- HMAC_MD5::HMAC_MD5(const byte* secret, unsigned int len) ! : pimpl_(NEW_YS HMAC_MD5Impl) { pimpl_->mac_.SetKey(secret, len); *************** *** 281,285 **** HMAC_SHA::HMAC_SHA(const byte* secret, unsigned int len) ! : pimpl_(new HMAC_SHAImpl) { pimpl_->mac_.SetKey(secret, len); --- 281,285 ---- HMAC_SHA::HMAC_SHA(const byte* secret, unsigned int len) ! : pimpl_(NEW_YS HMAC_SHAImpl) { pimpl_->mac_.SetKey(secret, len); *************** *** 332,336 **** HMAC_RMD::HMAC_RMD(const byte* secret, unsigned int len) ! : pimpl_(new HMAC_RMDImpl) { pimpl_->mac_.SetKey(secret, len); --- 332,336 ---- HMAC_RMD::HMAC_RMD(const byte* secret, unsigned int len) ! : pimpl_(NEW_YS HMAC_RMDImpl) { pimpl_->mac_.SetKey(secret, len); *************** *** 380,384 **** ! DES::DES() : pimpl_(new DESImpl) {} DES::~DES() { ysDelete(pimpl_); } --- 380,384 ---- ! DES::DES() : pimpl_(NEW_YS DESImpl) {} DES::~DES() { ysDelete(pimpl_); } *************** *** 416,420 **** ! DES_EDE::DES_EDE() : pimpl_(new DES_EDEImpl) {} DES_EDE::~DES_EDE() { ysDelete(pimpl_); } --- 416,420 ---- ! DES_EDE::DES_EDE() : pimpl_(NEW_YS DES_EDEImpl) {} DES_EDE::~DES_EDE() { ysDelete(pimpl_); } *************** *** 454,458 **** ! RC4::RC4() : pimpl_(new RC4Impl) {} RC4::~RC4() { ysDelete(pimpl_); } --- 454,458 ---- ! RC4::RC4() : pimpl_(NEW_YS RC4Impl) {} RC4::~RC4() { ysDelete(pimpl_); } *************** *** 496,500 **** ! AES::AES(unsigned int ks) : pimpl_(new AESImpl(ks)) {} AES::~AES() { ysDelete(pimpl_); } --- 496,500 ---- ! AES::AES(unsigned int ks) : pimpl_(NEW_YS AESImpl(ks)) {} AES::~AES() { ysDelete(pimpl_); } *************** *** 537,541 **** }; ! RandomPool::RandomPool() : pimpl_(new RandomImpl) {} RandomPool::~RandomPool() { ysDelete(pimpl_); } --- 537,541 ---- }; ! RandomPool::RandomPool() : pimpl_(NEW_YS RandomImpl) {} RandomPool::~RandomPool() { ysDelete(pimpl_); } *************** *** 581,585 **** // Set public or private key DSS::DSS(const byte* key, unsigned int sz, bool publicKey) ! : pimpl_(new DSSImpl) { if (publicKey) --- 581,585 ---- // Set public or private key DSS::DSS(const byte* key, unsigned int sz, bool publicKey) ! : pimpl_(NEW_YS DSSImpl) { if (publicKey) *************** *** 652,656 **** // Set public or private key RSA::RSA(const byte* key, unsigned int sz, bool publicKey) ! : pimpl_(new RSAImpl) { if (publicKey) --- 652,656 ---- // Set public or private key RSA::RSA(const byte* key, unsigned int sz, bool publicKey) ! : pimpl_(NEW_YS RSAImpl) { if (publicKey) *************** *** 724,728 **** }; ! Integer::Integer() : pimpl_(new IntegerImpl) {} Integer::~Integer() { ysDelete(pimpl_); } --- 724,728 ---- }; ! Integer::Integer() : pimpl_(NEW_YS IntegerImpl) {} Integer::~Integer() { ysDelete(pimpl_); } *************** *** 730,734 **** ! Integer::Integer(const Integer& other) : pimpl_(new IntegerImpl(other.pimpl_->int_)) {} --- 730,734 ---- ! Integer::Integer(const Integer& other) : pimpl_(NEW_YS IntegerImpl(other.pimpl_->int_)) {} *************** *** 774,780 **** void AllocKeys(unsigned int pubSz, unsigned int privSz, unsigned int agrSz) { ! publicKey_ = new byte[pubSz]; ! privateKey_ = new byte[privSz]; ! agreedKey_ = new byte[agrSz]; } }; --- 774,780 ---- void AllocKeys(unsigned int pubSz, unsigned int privSz, unsigned int agrSz) { ! publicKey_ = NEW_YS byte[pubSz]; ! privateKey_ = NEW_YS byte[privSz]; ! agreedKey_ = NEW_YS byte[agrSz]; } }; *************** *** 785,789 **** // server Side DH, server's view DiffieHellman::DiffieHellman(const char* file, const RandomPool& random) ! : pimpl_(new DHImpl(random.pimpl_->RNG_)) { using namespace TaoCrypt; --- 785,789 ---- // server Side DH, server's view DiffieHellman::DiffieHellman(const char* file, const RandomPool& random) ! : pimpl_(NEW_YS DHImpl(random.pimpl_->RNG_)) { using namespace TaoCrypt; *************** *** 809,818 **** unsigned int gSz, const byte* pub, unsigned int pubSz, const RandomPool& random) ! : pimpl_(new DHImpl(random.pimpl_->RNG_)) { using TaoCrypt::Integer; pimpl_->dh_.Initialize(Integer(p, pSz).Ref(), Integer(g, gSz).Ref()); ! pimpl_->publicKey_ = new opaque[pubSz]; memcpy(pimpl_->publicKey_, pub, pubSz); } --- 809,818 ---- unsigned int gSz, const byte* pub, unsigned int pubSz, const RandomPool& random) ! : pimpl_(NEW_YS DHImpl(random.pimpl_->RNG_)) { using TaoCrypt::Integer; pimpl_->dh_.Initialize(Integer(p, pSz).Ref(), Integer(g, gSz).Ref()); ! pimpl_->publicKey_ = NEW_YS opaque[pubSz]; memcpy(pimpl_->publicKey_, pub, pubSz); } *************** *** 822,826 **** DiffieHellman::DiffieHellman(const Integer& p, const Integer& g, const RandomPool& random) ! : pimpl_(new DHImpl(random.pimpl_->RNG_)) { using TaoCrypt::Integer; --- 822,826 ---- DiffieHellman::DiffieHellman(const Integer& p, const Integer& g, const RandomPool& random) ! : pimpl_(NEW_YS DHImpl(random.pimpl_->RNG_)) { using TaoCrypt::Integer; *************** *** 840,844 **** // Client side and view, use server that for p and g DiffieHellman::DiffieHellman(const DiffieHellman& that) ! : pimpl_(new DHImpl(*that.pimpl_)) { pimpl_->dh_.GenerateKeyPair(pimpl_->ranPool_, pimpl_->privateKey_, --- 840,844 ---- // Client side and view, use server that for p and g DiffieHellman::DiffieHellman(const DiffieHellman& that) ! : pimpl_(NEW_YS DHImpl(*that.pimpl_)) { pimpl_->dh_.GenerateKeyPair(pimpl_->ranPool_, pimpl_->privateKey_, *************** *** 961,965 **** uint sz = der.size(); ! mySTL::auto_ptr<x509> x(new x509(sz), ysDelete); memcpy(x->use_buffer(), der.get_buffer(), sz); --- 961,965 ---- uint sz = der.size(); ! mySTL::auto_ptr<x509> x(NEW_YS x509(sz), ysDelete); memcpy(x->use_buffer(), der.get_buffer(), sz); Index: yassl_imp.cpp =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/yassl/src/yassl_imp.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** yassl_imp.cpp 27 Nov 2005 19:23:07 -0000 1.1 --- yassl_imp.cpp 19 Feb 2006 16:51:08 -0000 1.2 *************** *** 135,142 **** if (ssl.getSecurity().get_parms().sig_algo_ == rsa_sa_algo) ! auth.reset(new RSA(cert.get_privateKey(), cert.get_privateKeyLength(), false)); else { ! auth.reset(new DSS(cert.get_privateKey(), cert.get_privateKeyLength(), false)); sigSz += DSS_ENCODED_EXTRA; --- 135,142 ---- if (ssl.getSecurity().get_parms().sig_algo_ == rsa_sa_algo) ! auth.reset(NEW_YS RSA(cert.get_privateKey(), cert.get_privateKeyLength(), false)); else { ! auth.reset(NEW_YS DSS(cert.get_privateKey(), cert.get_privateKeyLength(), false)); sigSz += DSS_ENCODED_EXTRA; *************** *** 169,173 **** MD5 md5; SHA sha; ! signature_ = new byte[sigSz]; const Connection& conn = ssl.getSecurity().get_connection(); --- 169,173 ---- MD5 md5; SHA sha; ! signature_ = NEW_YS byte[sigSz]; const Connection& conn = ssl.getSecurity().get_connection(); *************** *** 200,204 **** // key message ! keyMessage_ = new opaque[length_]; memcpy(keyMessage_, tmp.get_buffer(), tmp.get_size()); } --- 200,204 ---- // key message ! keyMessage_ = NEW_YS opaque[length_]; memcpy(keyMessage_, tmp.get_buffer(), tmp.get_size()); } *************** *** 254,258 **** { length_ = sz; ! secret_ = new opaque[sz]; } --- 254,258 ---- { length_ = sz; ! secret_ = NEW_YS opaque[sz]; } *************** *** 304,308 **** { length_ = sz + (offset ? KEY_OFFSET : 0); ! Yc_ = new opaque[length_]; } --- 304,308 ---- { length_ = sz + (offset ? KEY_OFFSET : 0); ! Yc_ = NEW_YS opaque[length_]; } *************** *** 349,353 **** ato16(tmp, length); ! signature_ = new byte[length]; input.read(signature_, length); --- 349,353 ---- ato16(tmp, length); ! signature_ = NEW_YS byte[length]; input.read(signature_, length); *************** *** 387,391 **** // save input ! ssl.useCrypto().SetDH(new DiffieHellman(parms_.get_p(), parms_.get_pSize(), parms_.get_g(), parms_.get_gSize(), parms_.get_pub(), parms_.get_pubSize(), --- 387,391 ---- // save input ! ssl.useCrypto().SetDH(NEW_YS DiffieHellman(parms_.get_p(), parms_.get_pSize(), parms_.get_g(), parms_.get_gSize(), parms_.get_pub(), parms_.get_pubSize(), *************** *** 929,933 **** if (dataSz) { input_buffer* data; ! ssl.addData(data = new input_buffer(dataSz)); input.read(data->get_buffer(), dataSz); data->add_size(dataSz); --- 929,933 ---- if (dataSz) { input_buffer* data; ! ssl.addData(data = NEW_YS input_buffer(dataSz)); input.read(data->get_buffer(), dataSz); data->add_size(dataSz); *************** *** 1026,1030 **** x509* myCert; ! cm.AddPeerCert(myCert = new x509(cert_sz)); input.read(myCert->use_buffer(), myCert->get_length()); --- 1026,1030 ---- x509* myCert; ! cm.AddPeerCert(myCert = NEW_YS x509(cert_sz)); input.read(myCert->use_buffer(), myCert->get_length()); *************** *** 1112,1116 **** opaque* ServerDHParams::alloc_p(int sz) { ! p_ = new opaque[pSz_ = sz]; return p_; } --- 1112,1116 ---- opaque* ServerDHParams::alloc_p(int sz) { ! p_ = NEW_YS opaque[pSz_ = sz]; return p_; } *************** *** 1119,1123 **** opaque* ServerDHParams::alloc_g(int sz) { ! g_ = new opaque[gSz_ = sz]; return g_; } --- 1119,1123 ---- opaque* ServerDHParams::alloc_g(int sz) { ! g_ = NEW_YS opaque[gSz_ = sz]; return g_; } *************** *** 1126,1130 **** opaque* ServerDHParams::alloc_pub(int sz) { ! Ys_ = new opaque[pubSz_ = sz]; return Ys_; } --- 1126,1130 ---- opaque* ServerDHParams::alloc_pub(int sz) { ! Ys_ = NEW_YS opaque[pubSz_ = sz]; return Ys_; } *************** *** 1538,1542 **** int sz = REQUEST_HEADER + MIN_DIS_SIZE; DistinguishedName dn; ! certificate_authorities_.push_back(dn = new byte[sz]); opaque tmp[REQUEST_HEADER]; --- 1538,1542 ---- int sz = REQUEST_HEADER + MIN_DIS_SIZE; DistinguishedName dn; ! certificate_authorities_.push_back(dn = NEW_YS byte[sz]); opaque tmp[REQUEST_HEADER]; *************** *** 1585,1589 **** DistinguishedName dn; ! request.certificate_authorities_.push_back(dn = new byte[REQUEST_HEADER + dnSz]); memcpy(dn, tmp, REQUEST_HEADER); --- 1585,1589 ---- DistinguishedName dn; ! request.certificate_authorities_.push_back(dn = NEW_YS byte[REQUEST_HEADER + dnSz]); memcpy(dn, tmp, REQUEST_HEADER); *************** *** 1631,1635 **** void CertificateRequest::Process(input_buffer&, SSL& ssl) { ! ssl.useCrypto().use_certManager().setSendVerify(); } --- 1631,1636 ---- void CertificateRequest::Process(input_buffer&, SSL& ssl) { ! if (ssl.useCrypto().use_certManager().get_cert()) ! ssl.useCrypto().use_certManager().setSendVerify(); } *************** *** 1666,1670 **** sz = rsa.get_cipherLength() + VERIFY_HEADER; ! sig.reset(new byte[sz]); c16toa(sz - VERIFY_HEADER, len); --- 1667,1671 ---- sz = rsa.get_cipherLength() + VERIFY_HEADER; ! sig.reset(NEW_YS byte[sz]); c16toa(sz - VERIFY_HEADER, len); *************** *** 1677,1681 **** sz = DSS_SIG_SZ + DSS_ENCODED_EXTRA + VERIFY_HEADER; ! sig.reset(new byte[sz]); c16toa(sz - VERIFY_HEADER, len); --- 1678,1682 ---- sz = DSS_SIG_SZ + DSS_ENCODED_EXTRA + VERIFY_HEADER; ! sig.reset(NEW_YS byte[sz]); c16toa(sz - VERIFY_HEADER, len); *************** *** 1715,1719 **** request.set_length(sz); ! request.signature_ = new byte[sz]; input.read(request.signature_, sz); --- 1716,1720 ---- request.set_length(sz); ! request.signature_ = NEW_YS byte[sz]; input.read(request.signature_, sz); *************** *** 1976,1980 **** void Connection::AllocPreSecret(uint sz) { ! pre_master_secret_ = new opaque[pre_secret_len_ = sz]; } --- 1977,1981 ---- void Connection::AllocPreSecret(uint sz) { ! pre_master_secret_ = NEW_YS opaque[pre_secret_len_ = sz]; } *************** *** 2012,2044 **** // Create functions for message factory ! Message* CreateCipherSpec() { return new ChangeCipherSpec; } ! Message* CreateAlert() { return new Alert; } ! Message* CreateHandShake() { return new HandShakeHeader; } ! Message* CreateData() { return new Data; } // Create functions for handshake factory ! HandShakeBase* CreateHelloRequest() { return new HelloRequest; } ! HandShakeBase* CreateClientHello() { return new ClientHello; } ! HandShakeBase* CreateServerHello() { return new ServerHello; } ! HandShakeBase* CreateCertificate() { return new Certificate; } ! HandShakeBase* CreateServerKeyExchange() { return new ServerKeyExchange;} ! HandShakeBase* CreateCertificateRequest() { return new CertificateRequest; } ! HandShakeBase* CreateServerHelloDone() { return new ServerHelloDone; } ! HandShakeBase* CreateCertificateVerify() { return new CertificateVerify;} ! HandShakeBase* CreateClientKeyExchange() { return new ClientKeyExchange;} ! HandShakeBase* CreateFinished() { return new Finished; } // Create functions for server key exchange factory ! ServerKeyBase* CreateRSAServerKEA() { return new RSA_Server; } ! ServerKeyBase* CreateDHServerKEA() { return new DH_Server; } ! ServerKeyBase* CreateFortezzaServerKEA() { return new Fortezza_Server; } // Create functions for client key exchange factory ! ClientKeyBase* CreateRSAClient() { return new EncryptedPreMasterSecret; } ! ClientKeyBase* CreateDHClient() { return new ClientDiffieHellmanPublic; } ! ClientKeyBase* CreateFortezzaClient() { return new FortezzaKeys; } --- 2013,2045 ---- // Create functions for message factory ! Message* CreateCipherSpec() { return NEW_YS ChangeCipherSpec; } ! Message* CreateAlert() { return NEW_YS Alert; } ! Message* CreateHandShake() { return NEW_YS HandShakeHeader; } ! Message* CreateData() { return NEW_YS Data; } // Create functions for handshake factory ! HandShakeBase* CreateHelloRequest() { return NEW_YS HelloRequest; } ! HandShakeBase* CreateClientHello() { return NEW_YS ClientHello; } ! HandShakeBase* CreateServerHello() { return NEW_YS ServerHello; } ! HandShakeBase* CreateCertificate() { return NEW_YS Certificate; } ! HandShakeBase* CreateServerKeyExchange() { return NEW_YS ServerKeyExchange;} ! HandShakeBase* CreateCertificateRequest() { return NEW_YS CertificateRequest; } ! HandShakeBase* CreateServerHelloDone() { return NEW_YS ServerHelloDone; } ! HandShakeBase* CreateCertificateVerify() { return NEW_YS CertificateVerify;} ! HandShakeBase* CreateClientKeyExchange() { return NEW_YS ClientKeyExchange;} ! HandShakeBase* CreateFinished() { return NEW_YS Finished; } // Create functions for server ... [truncated message content] |