Loading extra/yassl/include/buffer.hpp +2 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #define yaSSL_BUFFER_HPP #include <assert.h> // assert #include "yassl_types.hpp" // ysDelete #include "yassl_error.hpp" // Error #include "memory.hpp" // mySTL::auto_ptr #include "algorithm.hpp" // mySTL::swap Loading Loading @@ -183,7 +184,7 @@ inline void checked_delete(T* p) { typedef char complete_type[sizeof(T) ? 1 : -1]; (void)sizeof(complete_type); delete p; ysDelete(p); } Loading extra/yassl/include/crypto_wrapper.hpp +3 −3 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ namespace yaSSL { // Digest policy should implement a get_digest, update, and get sizes for pad and // digest struct Digest { struct Digest : public virtual_base { virtual void get_digest(byte*) = 0; virtual void get_digest(byte*, const byte*, unsigned int) = 0; virtual void update(const byte*, unsigned int) = 0; Loading Loading @@ -178,7 +178,7 @@ private: // BulkCipher policy should implement encrypt, decrypt, get block size, // and set keys for encrypt and decrypt struct BulkCipher { struct BulkCipher : public virtual_base { virtual void encrypt(byte*, const byte*, unsigned int) = 0; virtual void decrypt(byte*, const byte*, unsigned int) = 0; virtual void set_encryptKey(const byte*, const byte* = 0) = 0; Loading Loading @@ -308,7 +308,7 @@ private: // Authentication policy should implement sign, and verify struct Auth { struct Auth : public virtual_base { virtual void sign(byte*, const byte*, unsigned int, const RandomPool&) = 0; virtual bool verify(const byte*, unsigned int, const byte*, unsigned int) = 0; Loading extra/yassl/include/socket_wrapper.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ class Socket { socket_t socket_; // underlying socket descriptor public: explicit Socket(socket_t s = INVALID_SOCKET); virtual ~Socket(); ~Socket(); void set_fd(socket_t s); uint get_ready() const; Loading extra/yassl/include/yassl_imp.hpp +5 −5 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ struct RecordLayerHeader { // base for all messages struct Message { struct Message : public virtual_base { virtual input_buffer& set(input_buffer&) =0; virtual output_buffer& get(output_buffer&) const =0; Loading Loading @@ -175,7 +175,7 @@ private: // Base Class for all handshake messages class HandShakeBase { class HandShakeBase : public virtual_base { int length_; public: int get_length() const; Loading Loading @@ -327,7 +327,7 @@ private: }; struct ServerKeyBase { struct ServerKeyBase : public virtual_base { virtual ~ServerKeyBase() {} virtual void build(SSL&) {} virtual void read(SSL&, input_buffer&) {} Loading @@ -342,7 +342,7 @@ struct Fortezza_Server : public ServerKeyBase { }; struct SignatureBase { struct SignatureBase : public virtual_base { virtual ~SignatureBase() {} }; Loading Loading @@ -461,7 +461,7 @@ struct PreMasterSecret { }; struct ClientKeyBase { struct ClientKeyBase : public virtual_base { virtual ~ClientKeyBase() {} virtual void build(SSL&) {} virtual void read(SSL&, input_buffer&) {} Loading extra/yassl/include/yassl_types.hpp +45 −0 Original line number Diff line number Diff line Loading @@ -28,10 +28,55 @@ #define yaSSL_TYPES_HPP #include <stddef.h> #include <assert.h> #include "type_traits.hpp" namespace yaSSL { // library allocation struct new_t {}; // yaSSL New type extern new_t ys; // pass in parameter } // namespace yaSSL void* operator new (size_t, yaSSL::new_t); void* operator new[](size_t, yaSSL::new_t); void operator delete (void*, yaSSL::new_t); void operator delete[](void*, yaSSL::new_t); namespace yaSSL { template<typename T> void ysDelete(T* ptr) { if (ptr) ptr->~T(); ::operator delete(ptr, yaSSL::ys); } template<typename T> void ysArrayDelete(T* ptr) { // can't do array placement destruction since not tracking size in // allocation, only allow builtins to use array placement since they // don't need destructors called typedef char builtin[TaoCrypt::IsFundamentalType<T>::Yes ? 1 : -1]; (void)sizeof(builtin); ::operator delete[](ptr, yaSSL::ys); } // to resolve compiler generated operator delete on base classes with // virtual destructors, make sure doesn't get called class virtual_base { public: static void operator delete(void*) { assert(0); } }; typedef unsigned char uint8; typedef unsigned short uint16; Loading Loading
extra/yassl/include/buffer.hpp +2 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #define yaSSL_BUFFER_HPP #include <assert.h> // assert #include "yassl_types.hpp" // ysDelete #include "yassl_error.hpp" // Error #include "memory.hpp" // mySTL::auto_ptr #include "algorithm.hpp" // mySTL::swap Loading Loading @@ -183,7 +184,7 @@ inline void checked_delete(T* p) { typedef char complete_type[sizeof(T) ? 1 : -1]; (void)sizeof(complete_type); delete p; ysDelete(p); } Loading
extra/yassl/include/crypto_wrapper.hpp +3 −3 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ namespace yaSSL { // Digest policy should implement a get_digest, update, and get sizes for pad and // digest struct Digest { struct Digest : public virtual_base { virtual void get_digest(byte*) = 0; virtual void get_digest(byte*, const byte*, unsigned int) = 0; virtual void update(const byte*, unsigned int) = 0; Loading Loading @@ -178,7 +178,7 @@ private: // BulkCipher policy should implement encrypt, decrypt, get block size, // and set keys for encrypt and decrypt struct BulkCipher { struct BulkCipher : public virtual_base { virtual void encrypt(byte*, const byte*, unsigned int) = 0; virtual void decrypt(byte*, const byte*, unsigned int) = 0; virtual void set_encryptKey(const byte*, const byte* = 0) = 0; Loading Loading @@ -308,7 +308,7 @@ private: // Authentication policy should implement sign, and verify struct Auth { struct Auth : public virtual_base { virtual void sign(byte*, const byte*, unsigned int, const RandomPool&) = 0; virtual bool verify(const byte*, unsigned int, const byte*, unsigned int) = 0; Loading
extra/yassl/include/socket_wrapper.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ class Socket { socket_t socket_; // underlying socket descriptor public: explicit Socket(socket_t s = INVALID_SOCKET); virtual ~Socket(); ~Socket(); void set_fd(socket_t s); uint get_ready() const; Loading
extra/yassl/include/yassl_imp.hpp +5 −5 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ struct RecordLayerHeader { // base for all messages struct Message { struct Message : public virtual_base { virtual input_buffer& set(input_buffer&) =0; virtual output_buffer& get(output_buffer&) const =0; Loading Loading @@ -175,7 +175,7 @@ private: // Base Class for all handshake messages class HandShakeBase { class HandShakeBase : public virtual_base { int length_; public: int get_length() const; Loading Loading @@ -327,7 +327,7 @@ private: }; struct ServerKeyBase { struct ServerKeyBase : public virtual_base { virtual ~ServerKeyBase() {} virtual void build(SSL&) {} virtual void read(SSL&, input_buffer&) {} Loading @@ -342,7 +342,7 @@ struct Fortezza_Server : public ServerKeyBase { }; struct SignatureBase { struct SignatureBase : public virtual_base { virtual ~SignatureBase() {} }; Loading Loading @@ -461,7 +461,7 @@ struct PreMasterSecret { }; struct ClientKeyBase { struct ClientKeyBase : public virtual_base { virtual ~ClientKeyBase() {} virtual void build(SSL&) {} virtual void read(SSL&, input_buffer&) {} Loading
extra/yassl/include/yassl_types.hpp +45 −0 Original line number Diff line number Diff line Loading @@ -28,10 +28,55 @@ #define yaSSL_TYPES_HPP #include <stddef.h> #include <assert.h> #include "type_traits.hpp" namespace yaSSL { // library allocation struct new_t {}; // yaSSL New type extern new_t ys; // pass in parameter } // namespace yaSSL void* operator new (size_t, yaSSL::new_t); void* operator new[](size_t, yaSSL::new_t); void operator delete (void*, yaSSL::new_t); void operator delete[](void*, yaSSL::new_t); namespace yaSSL { template<typename T> void ysDelete(T* ptr) { if (ptr) ptr->~T(); ::operator delete(ptr, yaSSL::ys); } template<typename T> void ysArrayDelete(T* ptr) { // can't do array placement destruction since not tracking size in // allocation, only allow builtins to use array placement since they // don't need destructors called typedef char builtin[TaoCrypt::IsFundamentalType<T>::Yes ? 1 : -1]; (void)sizeof(builtin); ::operator delete[](ptr, yaSSL::ys); } // to resolve compiler generated operator delete on base classes with // virtual destructors, make sure doesn't get called class virtual_base { public: static void operator delete(void*) { assert(0); } }; typedef unsigned char uint8; typedef unsigned short uint16; Loading