On Thu, Nov 25, 2010 at 01:37:10PM +0100, Dr. Stephen Henson wrote:
> Thanks, I'd missed that one. I've simulated the issue here and committed a
> slightly different patch which works for me:
>
> http://cvs.openssl.org/chngview?cn=20089
>
> Let me know of any problem.
I wroted and tested a patch logically equivalent to yours, just simplified
the code a bit more, but the behaviour is intended to be identical and the
comments a bit more verbose. This completely eliminated the handshake errors
that were previously consistently observed with a small fraction of SMTP
servers (EC support is not yet widely deployed). So either patch, or, in
any case, something functionally equivalent, should be included in 1.0.0c.
*** ssl/t1_lib.c Thu Nov 25 00:34:36 2010
--- ssl/t1_lib.c Thu Nov 25 14:43:31 2010
***************
*** 1452,1484 ****
int al = SSL_AD_UNRECOGNIZED_NAME;
#ifndef OPENSSL_NO_EC
! /* If we are client and using an elliptic curve cryptography cipher
suite, then server
! * must return a an EC point formats lists containing uncompressed.
*/
unsigned long alg_k = s->s3->tmp.new_cipher->algorithm_mkey;
unsigned long alg_a = s->s3->tmp.new_cipher->algorithm_auth;
! if ((s->tlsext_ecpointformatlist != NULL) &&
(s->tlsext_ecpointformatlist_length > 0) &&
! ((alg_k & (SSL_kEECDH|SSL_kECDHr|SSL_kECDHe)) || (alg_a &
SSL_aECDSA)))
{
- /* we are using an ECC cipher */
size_t i;
! unsigned char *list;
! int found_uncompressed = 0;
! if ((s->session->tlsext_ecpointformatlist == NULL) ||
(s->session->tlsext_ecpointformatlist_length == 0))
! {
!
SSLerr(SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT,SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST);
! return -1;
! }
! list = s->session->tlsext_ecpointformatlist;
! for (i = 0; i < s->session->tlsext_ecpointformatlist_length;
i++)
! {
if (*(list++) == TLSEXT_ECPOINTFORMAT_uncompressed)
- {
- found_uncompressed = 1;
break;
! }
! }
! if (!found_uncompressed)
{
SSLerr(SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT,SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST);
return -1;
--- 1452,1482 ----
int al = SSL_AD_UNRECOGNIZED_NAME;
#ifndef OPENSSL_NO_EC
! /*
! * http://tools.ietf.org/html/rfc4492#section-5.1.2
! *
! * If we are the client, and the server agreed to an EC cipher,
! * and the server *optionally* sent a list of EC point formats,
! * make sure that the list includes the required uncompressed format.
! * Since, if sent, the point format list MUST contain at least
! * the uncompressed format, it is invalid if the list is empty.
*/
unsigned long alg_k = s->s3->tmp.new_cipher->algorithm_mkey;
unsigned long alg_a = s->s3->tmp.new_cipher->algorithm_auth;
! if (s->tlsext_ecpointformatlist
! && (s->tlsext_ecpointformatlist_length > 0)
! && ((alg_k & (SSL_kEECDH|SSL_kECDHr|SSL_kECDHe))
! || (alg_a & SSL_aECDSA))
! && s->session->tlsext_ecpointformatlist != NULL)
{
size_t i;
! size_t nfmt = s->session->tlsext_ecpointformatlist_length;
! unsigned char *list = s->session->tlsext_ecpointformatlist;
!
! for (i = 0; i < nfmt; i++)
if (*(list++) == TLSEXT_ECPOINTFORMAT_uncompressed)
break;
! if (i >= nfmt)
{
SSLerr(SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT,SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST);
return -1;
--
Viktor.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]