Skip to content

Comments

Fix ec point formats#2153

Closed
mattcaswell wants to merge 5 commits intoopenssl:masterfrom
mattcaswell:fix-ec-point-formats
Closed

Fix ec point formats#2153
mattcaswell wants to merge 5 commits intoopenssl:masterfrom
mattcaswell:fix-ec-point-formats

Conversation

@mattcaswell
Copy link
Member

Checklist
  • tests are added or updated
  • CLA is signed
Description of change

Fix the EC point formats extension. This should be sent in the ServerHello if an EC based ciphersuite is
negotiated (<= TLS1.2). The relevant flag to do this was missed off in the recent extensions refactor. This bug should have been caught by 70-test_sslmessages but that test never tries an EC ciphersuite, so we also update the test to do that.

Fixes #2133

This should be sent in the ServerHello if a EC based ciphersuite is
negotiated. The relevant flag to do this was missed off in the recent
extensions refactor.

Fixes GitHub Issue openssl#2133
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this match the name in ssl.h?

Copy link
Member Author

@mattcaswell mattcaswell Dec 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of the other constants in this file match the equivalents in the C. To me this is a fairly intuitive name (it more or less matches the OpenSSL "string" name of the ciphersuite (except "_" not "-" and a "CIPHER_" prefix)).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class or self? is this line needed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class. $ciphersuite is a class variable (i.e. a module global variable), not an instance variable. It's the same as is_tls13 about 10 lines up.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should wrap this with a diabled("ec") check...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2154 I disable the whole test for no-ec. I think its better than adding lots of complexity to the test to deal with this option.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a whole lot of complexity, here's how you do it:

    (disabled("ec") ? () :
     [TLSProxy::Message::MT_SERVER_KEY_EXCHANGE,
         checkhandshake::EC_HANDSHAKE]),

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On, reflection I think you are right, and your suggested approach is easier than I thought. I have done the above and also moved the commits from #2154 into this one as they are too closely related to deal with them separately.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and this too

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't actually necessary because we skip the test that uses this information anyway.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okie

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrap this with:

SKIP: {
    skip "No EC support in this OpenSSL build", 1 if disabled("ec");

    # original code here

}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@FdaSilvaYY
Copy link
Contributor

FYI, the no-ec option is broken.
Some missing #if guards in the new extension-handling code.

@mattcaswell
Copy link
Member Author

FYI, the no-ec option is broken.
Some missing #if guards in the new extension-handling code.

Yeah, I know. I'm working on it.

…pect

The previous commit fixed a bug where the EC point formats extensions did
not appear in the ServerHello. This should have been caught by
70-test_sslmessages but that test never tries an EC ciphersuite. This
updates the test to do that.
Previously we were omitting the extension information from ext_defs if
the association no- option was defined. This doesn't work because the
indexes into the table are no longer valid.
The CT tests in test_sslmessages require EC to be available, therefore
we must skip these if no-ec
@mattcaswell mattcaswell mentioned this pull request Dec 29, 2016
2 tasks
@mattcaswell
Copy link
Member Author

Fixed issues above. New commits added taken from #2154. Also added a new commit to deal with a hang in test_sslmessages when using no-ec. This is because the ct tests in that file require ec to be available, so I just disabled those in the event of no-ec.

(disabled("ec") ? () :
[TLSProxy::Message::MT_CLIENT_HELLO,
TLSProxy::Message::EXT_EC_POINT_FORMATS,
checkhandshake::DEFAULT_EXTENSIONS]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side comment: that can be written like this as well:

    (disabled("ec") ? () :
                      ([TLSProxy::Message::MT_CLIENT_HELLO,
                        TLSProxy::Message::EXT_SUPPORTED_GROUPS,
                        checkhandshake::DEFAULT_EXTENSIONS],
                       [TLSProxy::Message::MT_CLIENT_HELLO,
                        TLSProxy::Message::EXT_EC_POINT_FORMATS,
                        checkhandshake::DEFAULT_EXTENSIONS])),

This is because lists of this kind are flattened in Perl. Also, I'm not 100% sure the outer parens are strictly needed.

But, this is a preference and your choice to make.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I did think about doing it that way, but made a deliberate decision not to. Either way is valid, but supported_groups may include non ec groups in the not too distant future if we implement support for DHE groups, so I decided to have separate expressions for them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool.

SKIP: {
skip "No EC support in this OpenSSL build", 1 if disabled("ec");
$proxy->clear();
$proxy->clientflags("-no_tls1_3");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that flag strictly necessary? I would prefer if it's avoided as much as possible. My experience with sslvertol has shown that it's not as necessary as it was once...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is very much necessary. Without it TLSv1.3 would be negotiated and then the connection would fail due to a "no shared cipher". WRT sslvertol, I think you have a misunderstanding and I will comment on the relevant PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okie.

levitte pushed a commit that referenced this pull request Dec 29, 2016
This should be sent in the ServerHello if a EC based ciphersuite is
negotiated. The relevant flag to do this was missed off in the recent
extensions refactor.

Fixes GitHub Issue #2133

Reviewed-by: Richard Levitte <[email protected]>
(Merged from #2153)
levitte pushed a commit that referenced this pull request Dec 29, 2016
…pect

The previous commit fixed a bug where the EC point formats extensions did
not appear in the ServerHello. This should have been caught by
70-test_sslmessages but that test never tries an EC ciphersuite. This
updates the test to do that.

Reviewed-by: Richard Levitte <[email protected]>
(Merged from #2153)
levitte pushed a commit that referenced this pull request Dec 29, 2016
Previously we were omitting the extension information from ext_defs if
the association no- option was defined. This doesn't work because the
indexes into the table are no longer valid.

Reviewed-by: Richard Levitte <[email protected]>
(Merged from #2153)
levitte pushed a commit that referenced this pull request Dec 29, 2016
Reviewed-by: Richard Levitte <[email protected]>
(Merged from #2153)
levitte pushed a commit that referenced this pull request Dec 29, 2016
The CT tests in test_sslmessages require EC to be available, therefore
we must skip these if no-ec

Reviewed-by: Richard Levitte <[email protected]>
(Merged from #2153)
@mattcaswell
Copy link
Member Author

Pushed. Thanks.

yan12125 added a commit to yan12125/python3-android that referenced this pull request Dec 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

branch: master Applies to master branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: "bad extension" when connecting to httpbin.org:443

4 participants