add ssl23_peek
[openssl.git] / ssl / ssl_lib.c
index 1edb279dc8605e4eedf533a3c22ab14bc26ef858..9a593ed2a5fe1a755ea2fbca45598fd4b749cbc3 100644 (file)
@@ -784,6 +784,12 @@ int SSL_read(SSL *s,char *buf,int num)
 
 int SSL_peek(SSL *s,char *buf,int num)
        {
+       if (s->handshake_func == 0)
+               {
+               SSLerr(SSL_F_SSL_READ, SSL_R_UNINITIALIZED);
+               return -1;
+               }
+
        if (s->shutdown & SSL_RECEIVED_SHUTDOWN)
                {
                return(0);