summaryrefslogtreecommitdiff
path: root/usr/src/common/openssl/ssl/s2_srvr.c
diff options
context:
space:
mode:
authorjp161948 <none@none>2006-06-07 08:35:00 -0700
committerjp161948 <none@none>2006-06-07 08:35:00 -0700
commit9dc0df1bac950d6e491f9a7c7e4888f2b301cb15 (patch)
tree2ed1d4361a92a097c6017adc4ee6c6c5f541bfeb /usr/src/common/openssl/ssl/s2_srvr.c
parentf136dc05547d5c8bf0829a1439b3e4caadef85a0 (diff)
downloadillumos-joyent-9dc0df1bac950d6e491f9a7c7e4888f2b301cb15.tar.gz
PSARC/2006/019 OpenSSL upgrade to 0.9.8a
6352999 upgrade OpenSSL to 0.9.8a --HG-- rename : usr/src/common/openssl/crypto/asn1/f.c => deleted_files/usr/src/common/openssl/crypto/asn1/f.c rename : usr/src/common/openssl/crypto/asn1/x_cinf.c => deleted_files/usr/src/common/openssl/crypto/asn1/x_cinf.c rename : usr/src/common/openssl/crypto/ec/ecp_recp.c => deleted_files/usr/src/common/openssl/crypto/ec/ecp_recp.c rename : usr/src/common/openssl/crypto/engine/hw.ec => deleted_files/usr/src/common/openssl/crypto/engine/hw.ec rename : usr/src/common/openssl/crypto/engine/hw_4758_cca.c => deleted_files/usr/src/common/openssl/crypto/engine/hw_4758_cca.c rename : usr/src/common/openssl/crypto/engine/hw_4758_cca_err.c => deleted_files/usr/src/common/openssl/crypto/engine/hw_4758_cca_err.c rename : usr/src/common/openssl/crypto/engine/hw_4758_cca_err.h => deleted_files/usr/src/common/openssl/crypto/engine/hw_4758_cca_err.h rename : usr/src/common/openssl/crypto/engine/hw_aep.c => deleted_files/usr/src/common/openssl/crypto/engine/hw_aep.c rename : usr/src/common/openssl/crypto/engine/hw_aep_err.c => deleted_files/usr/src/common/openssl/crypto/engine/hw_aep_err.c rename : usr/src/common/openssl/crypto/engine/hw_aep_err.h => deleted_files/usr/src/common/openssl/crypto/engine/hw_aep_err.h rename : usr/src/common/openssl/crypto/engine/hw_atalla.c => deleted_files/usr/src/common/openssl/crypto/engine/hw_atalla.c rename : usr/src/common/openssl/crypto/engine/hw_atalla_err.c => deleted_files/usr/src/common/openssl/crypto/engine/hw_atalla_err.c rename : usr/src/common/openssl/crypto/engine/hw_atalla_err.h => deleted_files/usr/src/common/openssl/crypto/engine/hw_atalla_err.h rename : usr/src/common/openssl/crypto/engine/hw_cryptodev.c => deleted_files/usr/src/common/openssl/crypto/engine/hw_cryptodev.c rename : usr/src/common/openssl/crypto/engine/hw_cswift.c => deleted_files/usr/src/common/openssl/crypto/engine/hw_cswift.c rename : usr/src/common/openssl/crypto/engine/hw_cswift_err.c => deleted_files/usr/src/common/openssl/crypto/engine/hw_cswift_err.c rename : usr/src/common/openssl/crypto/engine/hw_cswift_err.h => deleted_files/usr/src/common/openssl/crypto/engine/hw_cswift_err.h rename : usr/src/common/openssl/crypto/engine/hw_ncipher.c => deleted_files/usr/src/common/openssl/crypto/engine/hw_ncipher.c rename : usr/src/common/openssl/crypto/engine/hw_ncipher_err.c => deleted_files/usr/src/common/openssl/crypto/engine/hw_ncipher_err.c rename : usr/src/common/openssl/crypto/engine/hw_ncipher_err.h => deleted_files/usr/src/common/openssl/crypto/engine/hw_ncipher_err.h rename : usr/src/common/openssl/crypto/engine/hw_nuron.c => deleted_files/usr/src/common/openssl/crypto/engine/hw_nuron.c rename : usr/src/common/openssl/crypto/engine/hw_nuron_err.c => deleted_files/usr/src/common/openssl/crypto/engine/hw_nuron_err.c rename : usr/src/common/openssl/crypto/engine/hw_nuron_err.h => deleted_files/usr/src/common/openssl/crypto/engine/hw_nuron_err.h rename : usr/src/common/openssl/crypto/engine/hw_sureware.c => deleted_files/usr/src/common/openssl/crypto/engine/hw_sureware.c rename : usr/src/common/openssl/crypto/engine/hw_sureware_err.c => deleted_files/usr/src/common/openssl/crypto/engine/hw_sureware_err.c rename : usr/src/common/openssl/crypto/engine/hw_sureware_err.h => deleted_files/usr/src/common/openssl/crypto/engine/hw_sureware_err.h rename : usr/src/common/openssl/crypto/engine/hw_ubsec.c => deleted_files/usr/src/common/openssl/crypto/engine/hw_ubsec.c rename : usr/src/common/openssl/crypto/engine/hw_ubsec_err.c => deleted_files/usr/src/common/openssl/crypto/engine/hw_ubsec_err.c rename : usr/src/common/openssl/crypto/engine/hw_ubsec_err.h => deleted_files/usr/src/common/openssl/crypto/engine/hw_ubsec_err.h rename : usr/src/common/openssl/crypto/engine/vendor_defns/aep.h => deleted_files/usr/src/common/openssl/crypto/engine/vendor_defns/aep.h rename : usr/src/common/openssl/crypto/engine/vendor_defns/atalla.h => deleted_files/usr/src/common/openssl/crypto/engine/vendor_defns/atalla.h rename : usr/src/common/openssl/crypto/engine/vendor_defns/cswift.h => deleted_files/usr/src/common/openssl/crypto/engine/vendor_defns/cswift.h rename : usr/src/common/openssl/crypto/engine/vendor_defns/hw_4758_cca.h => deleted_files/usr/src/common/openssl/crypto/engine/vendor_defns/hw_4758_cca.h rename : usr/src/common/openssl/crypto/engine/vendor_defns/hw_ubsec.h => deleted_files/usr/src/common/openssl/crypto/engine/vendor_defns/hw_ubsec.h rename : usr/src/common/openssl/crypto/engine/vendor_defns/hwcryptohook.h => deleted_files/usr/src/common/openssl/crypto/engine/vendor_defns/hwcryptohook.h rename : usr/src/common/openssl/crypto/engine/vendor_defns/sureware.h => deleted_files/usr/src/common/openssl/crypto/engine/vendor_defns/sureware.h
Diffstat (limited to 'usr/src/common/openssl/ssl/s2_srvr.c')
-rw-r--r--usr/src/common/openssl/ssl/s2_srvr.c43
1 files changed, 15 insertions, 28 deletions
diff --git a/usr/src/common/openssl/ssl/s2_srvr.c b/usr/src/common/openssl/ssl/s2_srvr.c
index 5da2a54af3..247cc89155 100644
--- a/usr/src/common/openssl/ssl/s2_srvr.c
+++ b/usr/src/common/openssl/ssl/s2_srvr.c
@@ -137,28 +137,10 @@ static SSL_METHOD *ssl2_get_server_method(int ver)
return(NULL);
}
-SSL_METHOD *SSLv2_server_method(void)
- {
- static int init=1;
- static SSL_METHOD SSLv2_server_data;
-
- if (init)
- {
- CRYPTO_w_lock(CRYPTO_LOCK_SSL_METHOD);
-
- if (init)
- {
- memcpy((char *)&SSLv2_server_data,(char *)sslv2_base_method(),
- sizeof(SSL_METHOD));
- SSLv2_server_data.ssl_accept=ssl2_accept;
- SSLv2_server_data.get_ssl_method=ssl2_get_server_method;
- init=0;
- }
-
- CRYPTO_w_unlock(CRYPTO_LOCK_SSL_METHOD);
- }
- return(&SSLv2_server_data);
- }
+IMPLEMENT_ssl2_meth_func(SSLv2_server_method,
+ ssl2_accept,
+ ssl_undefined_function,
+ ssl2_get_server_method)
int ssl2_accept(SSL *s)
{
@@ -498,7 +480,8 @@ static int get_client_master_key(SSL *s)
i=ek;
else
i=EVP_CIPHER_key_length(c);
- RAND_pseudo_bytes(p,i);
+ if (RAND_pseudo_bytes(p,i) <= 0)
+ return 0;
}
#else
if (i < 0)
@@ -796,7 +779,7 @@ static int server_hello(SSL *s)
/* lets send out the ciphers we like in the
* prefered order */
sk= s->session->ciphers;
- n=ssl_cipher_list_to_bytes(s,s->session->ciphers,d);
+ n=ssl_cipher_list_to_bytes(s,s->session->ciphers,d,0);
d+=n;
s2n(n,p); /* add cipher length */
}
@@ -804,7 +787,8 @@ static int server_hello(SSL *s)
/* make and send conn_id */
s2n(SSL2_CONNECTION_ID_LENGTH,p); /* add conn_id length */
s->s2->conn_id_length=SSL2_CONNECTION_ID_LENGTH;
- RAND_pseudo_bytes(s->s2->conn_id,(int)s->s2->conn_id_length);
+ if (RAND_pseudo_bytes(s->s2->conn_id,(int)s->s2->conn_id_length) <= 0)
+ return -1;
memcpy(d,s->s2->conn_id,SSL2_CONNECTION_ID_LENGTH);
d+=SSL2_CONNECTION_ID_LENGTH;
@@ -936,6 +920,7 @@ static int server_finish(SSL *s)
/* send the request and check the response */
static int request_certificate(SSL *s)
{
+ const unsigned char *cp;
unsigned char *p,*p2,*buf2;
unsigned char *ccd;
int i,j,ctype,ret= -1;
@@ -949,7 +934,8 @@ static int request_certificate(SSL *s)
p=(unsigned char *)s->init_buf->data;
*(p++)=SSL2_MT_REQUEST_CERTIFICATE;
*(p++)=SSL2_AT_MD5_WITH_RSA_ENCRYPTION;
- RAND_pseudo_bytes(ccd,SSL2_MIN_CERT_CHALLENGE_LENGTH);
+ if (RAND_pseudo_bytes(ccd,SSL2_MIN_CERT_CHALLENGE_LENGTH) <= 0)
+ return -1;
memcpy(p,ccd,SSL2_MIN_CERT_CHALLENGE_LENGTH);
s->state=SSL2_ST_SEND_REQUEST_CERTIFICATE_B;
@@ -1052,7 +1038,8 @@ static int request_certificate(SSL *s)
s->msg_callback(0, s->version, 0, p, len, s, s->msg_callback_arg); /* CLIENT-CERTIFICATE */
p += 6;
- x509=(X509 *)d2i_X509(NULL,&p,(long)s->s2->tmp.clen);
+ cp = p;
+ x509=(X509 *)d2i_X509(NULL,&cp,(long)s->s2->tmp.clen);
if (x509 == NULL)
{
SSLerr(SSL_F_REQUEST_CERTIFICATE,ERR_R_X509_LIB);
@@ -1092,7 +1079,7 @@ static int request_certificate(SSL *s)
pkey=X509_get_pubkey(x509);
if (pkey == NULL) goto end;
- i=EVP_VerifyFinal(&ctx,p,s->s2->tmp.rlen,pkey);
+ i=EVP_VerifyFinal(&ctx,cp,s->s2->tmp.rlen,pkey);
EVP_PKEY_free(pkey);
EVP_MD_CTX_cleanup(&ctx);