Commit b959d36b authored by unknown's avatar unknown
Browse files

Import from yaSSL

Fixes for HPUX etc. 
Don't define exceptions operator new on hpux as the linker will look for the function


extra/yassl/examples/echoserver/echoserver.cpp:
  Import patch yassl.diff
extra/yassl/include/openssl/ssl.h:
  Import patch yassl.diff
extra/yassl/include/socket_wrapper.hpp:
  Import patch yassl.diff
extra/yassl/src/handshake.cpp:
  Import patch yassl.diff
extra/yassl/src/socket_wrapper.cpp:
  Import patch yassl.diff
extra/yassl/src/ssl.cpp:
  Import patch yassl.diff
extra/yassl/src/template_instnt.cpp:
  Import patch yassl.diff
extra/yassl/src/timer.cpp:
  Import patch yassl.diff
extra/yassl/src/yassl_error.cpp:
  Import patch yassl.diff
extra/yassl/src/yassl_int.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/block.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/md4.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/include/runtime.hpp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/md4.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/src/template_instnt.cpp:
  Import patch yassl.diff
extra/yassl/taocrypt/taocrypt.dsp:
  Import patch yassl.diff
extra/yassl/taocrypt/test/test.cpp:
  Import patch yassl.diff
extra/yassl/testsuite/test.hpp:
  Import patch yassl.diff
extra/yassl/mySTL/stdexcept.hpp:
  Don't define exceptions operator new on hpux as the linker will look for the function
extra/yassl/taocrypt/src/Makefile.am:
  Add md4.cpp to Makefile.am
parent 07188950
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -65,7 +65,8 @@ THREAD_RETURN YASSL_API echoserver_test(void* args)
    while (!shutdown) {
        sockaddr_in client;
        socklen_t   client_len = sizeof(client);
        int         clientfd = accept(sockfd, (sockaddr*)&client, &client_len);
        int         clientfd = accept(sockfd, (sockaddr*)&client,
                                      (ACCEPT_THIRD_T)&client_len);
        if (clientfd == -1) err_sys("tcp accept failed");

        SSL* ssl = SSL_new(ctx);
+2 −1
Original line number Diff line number Diff line
@@ -273,6 +273,7 @@ int SSL_pending(SSL*);


enum { /* ssl Constants */
    SSL_WOULD_BLOCK     = -8,
    SSL_BAD_STAT        = -7,
    SSL_BAD_PATH        = -6,
    SSL_BAD_FILETYPE    = -5,
@@ -494,7 +495,7 @@ ASN1_TIME* X509_get_notAfter(X509* x);


typedef struct MD4_CTX {
    void* ptr;
    int buffer[32];      /* big enough to hold, check size in Init */
} MD4_CTX;

void MD4_Init(MD4_CTX*);
+4 −2
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ typedef unsigned char byte;
// Wraps Windows Sockets and BSD Sockets
class Socket {
    socket_t socket_;                    // underlying socket descriptor
    bool     wouldBlock_;                // for non-blocking data
public:
    explicit Socket(socket_t s = INVALID_SOCKET);
    ~Socket();
@@ -75,9 +76,10 @@ public:
    socket_t get_fd()    const;

    uint send(const byte* buf, unsigned int len, int flags = 0) const;
    uint receive(byte* buf, unsigned int len, int flags = 0)    const;
    uint receive(byte* buf, unsigned int len, int flags = 0);

    bool wait() const;
    bool wait();
    bool WouldBlock() const;

    void closeSocket();
    void shutDown(int how = SD_SEND);
+2 −0
Original line number Diff line number Diff line
@@ -46,8 +46,10 @@ public:
    // for compiler generated call, never used
    static void operator delete(void*) { assert(0); }
private:
#if defined(__hpux)
    // don't allow dynamic creation of exceptions
    static void* operator new(size_t);
#endif
};


+13 −2
Original line number Diff line number Diff line
@@ -656,7 +656,7 @@ mySTL::auto_ptr<input_buffer>
DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
{
    // wait for input if blocking
    if (!ssl.getSocket().wait()) {
    if (!ssl.useSocket().wait()) {
      ssl.SetError(receive_error);
        buffered.reset(0);
        return buffered;
@@ -673,7 +673,7 @@ DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
    }

    // add new data
    uint read  = ssl.getSocket().receive(buffer.get_buffer() + buffSz, ready);
    uint read  = ssl.useSocket().receive(buffer.get_buffer() + buffSz, ready);
    buffer.add_size(read);
    uint offset = 0;
    const MessageFactory& mf = ssl.getFactory().getMessage();
@@ -858,6 +858,9 @@ void sendFinished(SSL& ssl, ConnectionEnd side, BufferOutput buffer)
// send data
int sendData(SSL& ssl, const void* buffer, int sz)
{
    if (ssl.GetError() == YasslError(SSL_ERROR_WANT_READ))
        ssl.SetError(no_error);

    ssl.verfiyHandShakeComplete();
    if (ssl.GetError()) return 0;
    int sent = 0;
@@ -893,6 +896,9 @@ int sendAlert(SSL& ssl, const Alert& alert)
// process input data
int receiveData(SSL& ssl, Data& data)
{
    if (ssl.GetError() == YasslError(SSL_ERROR_WANT_READ))
        ssl.SetError(no_error);

    ssl.verfiyHandShakeComplete();
    if (ssl.GetError()) return 0;

@@ -902,6 +908,11 @@ int receiveData(SSL& ssl, Data& data)
    ssl.useLog().ShowData(data.get_length());

    if (ssl.GetError()) return 0;

    if (data.get_length() == 0 && ssl.getSocket().WouldBlock()) {
        ssl.SetError(YasslError(SSL_ERROR_WANT_READ));
        return SSL_WOULD_BLOCK;
    }
    return data.get_length(); 
}

Loading