s3_srvr.c (59191) | s3_srvr.c (68651) |
---|---|
1/* ssl/s3_srvr.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 139 unchanged lines hidden (view full) --- 148 case SSL_ST_ACCEPT: 149 case SSL_ST_BEFORE|SSL_ST_ACCEPT: 150 case SSL_ST_OK|SSL_ST_ACCEPT: 151 152 s->server=1; 153 if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_START,1); 154 155 if ((s->version>>8) != 3) | 1/* ssl/s3_srvr.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 139 unchanged lines hidden (view full) --- 148 case SSL_ST_ACCEPT: 149 case SSL_ST_BEFORE|SSL_ST_ACCEPT: 150 case SSL_ST_OK|SSL_ST_ACCEPT: 151 152 s->server=1; 153 if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_START,1); 154 155 if ((s->version>>8) != 3) |
156 abort(); | 156 { 157 SSLerr(SSL_F_SSL3_ACCEPT, SSL_R_INTERNAL_ERROR); 158 return -1; 159 } |
157 s->type=SSL_ST_ACCEPT; 158 159 if (s->init_buf == NULL) 160 { 161 if ((buf=BUF_MEM_new()) == NULL) 162 { 163 ret= -1; 164 goto end; --- 812 unchanged lines hidden (view full) --- 977 else 978#endif 979#ifndef NO_DH 980 if (type & SSL_kEDH) 981 { 982 dhp=cert->dh_tmp; 983 if ((dhp == NULL) && (s->cert->dh_tmp_cb != NULL)) 984 dhp=s->cert->dh_tmp_cb(s, | 160 s->type=SSL_ST_ACCEPT; 161 162 if (s->init_buf == NULL) 163 { 164 if ((buf=BUF_MEM_new()) == NULL) 165 { 166 ret= -1; 167 goto end; --- 812 unchanged lines hidden (view full) --- 980 else 981#endif 982#ifndef NO_DH 983 if (type & SSL_kEDH) 984 { 985 dhp=cert->dh_tmp; 986 if ((dhp == NULL) && (s->cert->dh_tmp_cb != NULL)) 987 dhp=s->cert->dh_tmp_cb(s, |
985 !SSL_C_IS_EXPORT(s->s3->tmp.new_cipher), | 988 SSL_C_IS_EXPORT(s->s3->tmp.new_cipher), |
986 SSL_C_EXPORT_PKEYLENGTH(s->s3->tmp.new_cipher)); 987 if (dhp == NULL) 988 { 989 al=SSL_AD_HANDSHAKE_FAILURE; 990 SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,SSL_R_MISSING_TMP_DH_KEY); 991 goto f_err; 992 } 993 --- 327 unchanged lines hidden (view full) --- 1321 1322 if (i != SSL_MAX_MASTER_KEY_LENGTH) 1323 { 1324 al=SSL_AD_DECODE_ERROR; 1325 SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_BAD_RSA_DECRYPT); 1326 goto f_err; 1327 } 1328 | 989 SSL_C_EXPORT_PKEYLENGTH(s->s3->tmp.new_cipher)); 990 if (dhp == NULL) 991 { 992 al=SSL_AD_HANDSHAKE_FAILURE; 993 SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,SSL_R_MISSING_TMP_DH_KEY); 994 goto f_err; 995 } 996 --- 327 unchanged lines hidden (view full) --- 1324 1325 if (i != SSL_MAX_MASTER_KEY_LENGTH) 1326 { 1327 al=SSL_AD_DECODE_ERROR; 1328 SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_BAD_RSA_DECRYPT); 1329 goto f_err; 1330 } 1331 |
1329 if ((p[0] != (s->client_version>>8)) || (p[1] != (s->client_version & 0xff))) | 1332 if (!((p[0] == (s->client_version>>8)) && (p[1] == (s->client_version & 0xff)))) |
1330 { | 1333 { |
1331 al=SSL_AD_DECODE_ERROR; 1332 SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_BAD_PROTOCOL_VERSION_NUMBER); 1333 goto f_err; | 1334 /* The premaster secret must contain the same version number as the 1335 * ClientHello to detect version rollback attacks (strangely, the 1336 * protocol does not offer such protection for DH ciphersuites). 1337 * However, buggy clients exist that send the negotiated protocol 1338 * version instead if the server does not support the requested 1339 * protocol version. 1340 * If SSL_OP_TLS_ROLLBACK_BUG is set, tolerate such clients. */ 1341 if (!((s->options & SSL_OP_TLS_ROLLBACK_BUG) && 1342 (p[0] == (s->version>>8)) && (p[1] == (s->version & 0xff)))) 1343 { 1344 al=SSL_AD_DECODE_ERROR; 1345 SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_BAD_PROTOCOL_VERSION_NUMBER); 1346 goto f_err; 1347 } |
1334 } 1335 1336 s->session->master_key_length= 1337 s->method->ssl3_enc->generate_master_secret(s, 1338 s->session->master_key, 1339 p,i); 1340 memset(p,0,i); 1341 } --- 399 unchanged lines hidden --- | 1348 } 1349 1350 s->session->master_key_length= 1351 s->method->ssl3_enc->generate_master_secret(s, 1352 s->session->master_key, 1353 p,i); 1354 memset(p,0,i); 1355 } --- 399 unchanged lines hidden --- |