mirror of
https://github.com/openssl/openssl.git
synced 2024-11-28 04:25:31 +08:00
Fix error codes for memory-saving patch.
Also, get rid of compile-time switch OPENSSL_NO_RELEASE_BUFFERS because it was rather pointless (the new behavior has to be explicitly requested by setting SSL_MODE_RELEASE_BUFFERS anyway).
This commit is contained in:
parent
3e727a3b37
commit
474b3b1cc8
@ -591,7 +591,7 @@ int ssl_verify_alarm_type(long type)
|
||||
return(al);
|
||||
}
|
||||
|
||||
#if !defined(OPENSSL_NO_BUF_FREELISTS) && !defined(OPENSSL_NO_RELEASE_BUFFERS)
|
||||
#ifndef OPENSSL_NO_BUF_FREELISTS
|
||||
/* On some platforms, malloc() performance is bad enough that you can't just
|
||||
* free() and malloc() buffers all the time, so we need to use freelists from
|
||||
* unused buffers. Currently, each freelist holds memory chunks of only a
|
||||
@ -698,7 +698,7 @@ int ssl3_setup_read_buffer(SSL *s)
|
||||
return 1;
|
||||
|
||||
err:
|
||||
SSLerr(SSL_F_SSL3_SETUP_BUFFERS,ERR_R_MALLOC_FAILURE);
|
||||
SSLerr(SSL_F_SSL3_SETUP_READ_BUFFER,ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -733,7 +733,7 @@ int ssl3_setup_write_buffer(SSL *s)
|
||||
return 1;
|
||||
|
||||
err:
|
||||
SSLerr(SSL_F_SSL3_SETUP_BUFFERS,ERR_R_MALLOC_FAILURE);
|
||||
SSLerr(SSL_F_SSL3_SETUP_WRITE_BUFFER,ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
12
ssl/s3_pkt.c
12
ssl/s3_pkt.c
@ -238,11 +238,9 @@ int ssl3_read_n(SSL *s, int n, int max, int extend)
|
||||
if (i <= 0)
|
||||
{
|
||||
rb->left = left;
|
||||
#ifndef OPENSSL_NO_RELEASE_BUFFERS
|
||||
if (len+left == 0 &&
|
||||
(s->mode & SSL_MODE_RELEASE_BUFFERS))
|
||||
if (s->mode & SSL_MODE_RELEASE_BUFFERS)
|
||||
if (len+left == 0)
|
||||
ssl3_release_read_buffer(s);
|
||||
#endif
|
||||
return(i);
|
||||
}
|
||||
left+=i;
|
||||
@ -825,10 +823,8 @@ int ssl3_write_pending(SSL *s, int type, const unsigned char *buf,
|
||||
{
|
||||
wb->left=0;
|
||||
wb->offset+=i;
|
||||
#ifndef OPENSSL_NO_RELEASE_BUFFERS
|
||||
if (s->mode & SSL_MODE_RELEASE_BUFFERS)
|
||||
ssl3_release_write_buffer(s);
|
||||
#endif
|
||||
s->rwstate=SSL_NOTHING;
|
||||
return(s->s3->wpend_ret);
|
||||
}
|
||||
@ -983,10 +979,8 @@ start:
|
||||
{
|
||||
s->rstate=SSL_ST_READ_HEADER;
|
||||
rr->off=0;
|
||||
#ifndef OPENSSL_NO_RELEASE_BUFFERS
|
||||
if ((s->mode & SSL_MODE_RELEASE_BUFFERS))
|
||||
if (s->mode & SSL_MODE_RELEASE_BUFFERS)
|
||||
ssl3_release_read_buffer(s);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return(n);
|
||||
|
@ -840,7 +840,7 @@ struct ssl_ctx_st
|
||||
unsigned char *psk, unsigned int max_psk_len);
|
||||
#endif
|
||||
|
||||
#if !defined(OPENSSL_NO_BUF_FREELISTS) || !defined(OPENSSL_NO_RELEASE_BUFFERS)
|
||||
#ifndef OPENSSL_NO_BUF_FREELISTS
|
||||
#define SSL_MAX_BUF_FREELIST_LEN_DEFAULT 32
|
||||
unsigned int freelist_max_len;
|
||||
struct ssl3_buf_freelist_st *wbuf_freelist;
|
||||
@ -1851,8 +1851,9 @@ void ERR_load_SSL_strings(void);
|
||||
#define SSL_F_SSL3_SEND_SERVER_CERTIFICATE 154
|
||||
#define SSL_F_SSL3_SEND_SERVER_HELLO 242
|
||||
#define SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE 155
|
||||
#define SSL_F_SSL3_SETUP_BUFFERS 156
|
||||
#define SSL_F_SSL3_SETUP_KEY_BLOCK 157
|
||||
#define SSL_F_SSL3_SETUP_READ_BUFFER 156
|
||||
#define SSL_F_SSL3_SETUP_WRITE_BUFFER 291
|
||||
#define SSL_F_SSL3_WRITE_BYTES 158
|
||||
#define SSL_F_SSL3_WRITE_PENDING 159
|
||||
#define SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT 277
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* ssl/ssl_err.c */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
|
||||
* Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -167,8 +167,9 @@ static ERR_STRING_DATA SSL_str_functs[]=
|
||||
{ERR_FUNC(SSL_F_SSL3_SEND_SERVER_CERTIFICATE), "SSL3_SEND_SERVER_CERTIFICATE"},
|
||||
{ERR_FUNC(SSL_F_SSL3_SEND_SERVER_HELLO), "SSL3_SEND_SERVER_HELLO"},
|
||||
{ERR_FUNC(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE), "SSL3_SEND_SERVER_KEY_EXCHANGE"},
|
||||
{ERR_FUNC(SSL_F_SSL3_SETUP_BUFFERS), "SSL3_SETUP_BUFFERS"},
|
||||
{ERR_FUNC(SSL_F_SSL3_SETUP_KEY_BLOCK), "SSL3_SETUP_KEY_BLOCK"},
|
||||
{ERR_FUNC(SSL_F_SSL3_SETUP_READ_BUFFER), "SSL3_SETUP_READ_BUFFER"},
|
||||
{ERR_FUNC(SSL_F_SSL3_SETUP_WRITE_BUFFER), "SSL3_SETUP_WRITE_BUFFER"},
|
||||
{ERR_FUNC(SSL_F_SSL3_WRITE_BYTES), "SSL3_WRITE_BYTES"},
|
||||
{ERR_FUNC(SSL_F_SSL3_WRITE_PENDING), "SSL3_WRITE_PENDING"},
|
||||
{ERR_FUNC(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT), "SSL_ADD_CLIENTHELLO_TLSEXT"},
|
||||
|
@ -1581,7 +1581,7 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth)
|
||||
ret->psk_client_callback=NULL;
|
||||
ret->psk_server_callback=NULL;
|
||||
#endif
|
||||
#if !defined(OPENSSL_NO_BUF_FREELISTS) && !defined(OPENSSL_NO_RELEASE_BUFFERS)
|
||||
#ifndef OPENSSL_NO_BUF_FREELISTS
|
||||
ret->freelist_max_len = SSL_MAX_BUF_FREELIST_LEN_DEFAULT;
|
||||
ret->rbuf_freelist = OPENSSL_malloc(sizeof(SSL3_BUF_FREELIST));
|
||||
if (!ret->rbuf_freelist)
|
||||
@ -1633,7 +1633,7 @@ static void SSL_COMP_free(SSL_COMP *comp)
|
||||
{ OPENSSL_free(comp); }
|
||||
#endif
|
||||
|
||||
#if !defined(OPENSSL_NO_BUF_FREELISTS) && !defined(OPENSSL_NO_RELEASE_BUFFERS)
|
||||
#ifndef OPENSSL_NO_BUF_FREELISTS
|
||||
static void
|
||||
ssl_buf_freelist_free(SSL3_BUF_FREELIST *list)
|
||||
{
|
||||
@ -1714,7 +1714,7 @@ void SSL_CTX_free(SSL_CTX *a)
|
||||
ENGINE_finish(a->client_cert_engine);
|
||||
#endif
|
||||
|
||||
#if !defined(OPENSSL_NO_BUF_FREELISTS) && !defined(OPENSSL_NO_RELEASE_BUFFERS)
|
||||
#ifndef OPENSSL_NO_BUF_FREELISTS
|
||||
if (a->wbuf_freelist)
|
||||
ssl_buf_freelist_free(a->wbuf_freelist);
|
||||
if (a->rbuf_freelist)
|
||||
|
@ -561,7 +561,7 @@ typedef struct ssl3_comp_st
|
||||
COMP_METHOD *method; /* The method :-) */
|
||||
} SSL3_COMP;
|
||||
|
||||
#if !defined(OPENSSL_NO_BUF_FREELISTS) && !defined(OPENSSL_NO_RELEASE_BUFFERS)
|
||||
#ifndef OPENSSL_NO_BUF_FREELISTS
|
||||
typedef struct ssl3_buf_freelist_st
|
||||
{
|
||||
size_t chunklen;
|
||||
|
Loading…
Reference in New Issue
Block a user