j = put_cb ? put_cb(c,p) : ssl_put_cipher_by_char(s,c,p);
p+=j;
}
- /* If p == q, no ciphers and caller indicates an error, otherwise
- * add MCSV
+ /* If p == q, no ciphers and caller indicates an error. Otherwise
+ * add SCSV if not renegotiating.
*/
- if (p != q)
+ if (p != q && !s->new_session)
{
- static SSL_CIPHER msvc =
+ static SSL_CIPHER scsv =
{
- 0, NULL, SSL3_CK_MCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ 0, NULL, SSL3_CK_SCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
- j = put_cb ? put_cb(&msvc,p) : ssl_put_cipher_by_char(s,&msvc,p);
+ j = put_cb ? put_cb(&scsv,p) : ssl_put_cipher_by_char(s,&scsv,p);
p+=j;
#ifdef OPENSSL_RI_DEBUG
- fprintf(stderr, "MCSV sent by client\n");
+ fprintf(stderr, "SCSV sent by client\n");
#endif
}
for (i=0; i<num; i+=n)
{
- /* Check for MCSV */
+ /* Check for SCSV */
if (s->s3 && (n != 3 || !p[0]) &&
- (p[n-2] == ((SSL3_CK_MCSV >> 8) & 0xff)) &&
- (p[n-1] == (SSL3_CK_MCSV & 0xff)))
+ (p[n-2] == ((SSL3_CK_SCSV >> 8) & 0xff)) &&
+ (p[n-1] == (SSL3_CK_SCSV & 0xff)))
{
+ /* SCSV fatal if renegotiating */
+ if (s->new_session)
+ {
+ SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING);
+ ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_HANDSHAKE_FAILURE);
+ goto err;
+ }
s->s3->send_connection_binding = 1;
p += n;
#ifdef OPENSSL_RI_DEBUG
- fprintf(stderr, "MCSV received by server\n");
+ fprintf(stderr, "SCSV received by server\n");
#endif
continue;
}
/* Default is to connect to non-RI servers. When RI is more widely
* deployed might change this.
*/
- ret->options = SSL_OP_LEGACY_SERVER_CONNECT;
+ ret->options |= SSL_OP_LEGACY_SERVER_CONNECT;
return(ret);
err:
/* THIS NEEDS CLEANING UP */
X509 *ssl_get_server_send_cert(SSL *s)
{
- unsigned long alg_k,alg_a,mask_k,mask_a;
+ unsigned long alg_k,alg_a;
CERT *c;
- int i,is_export;
+ int i;
c=s->cert;
ssl_set_cert_masks(c, s->s3->tmp.new_cipher);
- is_export=SSL_C_IS_EXPORT(s->s3->tmp.new_cipher);
- if (is_export)
- {
- mask_k = c->export_mask_k;
- mask_a = c->export_mask_a;
- }
- else
- {
- mask_k = c->mask_k;
- mask_a = c->mask_a;
- }
alg_k = s->s3->tmp.new_cipher->algorithm_mkey;
alg_a = s->s3->tmp.new_cipher->algorithm_auth;
const char *SSL_get_version(const SSL *s)
{
- if (s->version == TLS1_VERSION)
- return("TLSv1");
+ if (s->version == TLS1_1_VERSION)
+ return("TLSv1.1");
+ else if (s->version == SSL3_VERSION)
+ return("SSLv3");
else if (s->version == SSL3_VERSION)
return("SSLv3");
else if (s->version == SSL2_VERSION)