Skip to content

Enable brainpool curves for TLS1.3 - #7485

Closed
bernd-edlinger wants to merge 1 commit into
openssl:masterfrom
bernd-edlinger:enable_brainpool_for_tls13
Closed

bernd-edlinger wants to merge 1 commit into
openssl:masterfrom
bernd-edlinger:enable_brainpool_for_tls13

Conversation

@bernd-edlinger

Copy link
Copy Markdown
Member

@bernd-edlinger bernd-edlinger added branch: master Applies to master branch branch: 1.1.1 Applies to OpenSSL_1_1_1-stable branch (EOL) labels Oct 24, 2018
@bernd-edlinger
bernd-edlinger force-pushed the enable_brainpool_for_tls13 branch from 851edca to 57c4ead Compare October 24, 2018 22:00
Comment thread ssl/ssl_locl.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we want to add defines for things like x25519 too, and then update eccurves_default[] to use the defines instead of just the numbers.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes. there are two code points for P-256 and P-384

include/openssl/tls1.h:# define TLSEXT_curve_P_256                              23
include/openssl/tls1.h:# define TLSEXT_curve_P_384                              24

I was unsure why those are in a public API. Those have to stay, but
I would replace them with internal TLSEXT_GROUPID defines as needed.
Should I do that in this PR?

Comment thread ssl/statem/statem_lib.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I really don't like this. I think you really should just add this like you would add a normal curve.

I also suggest that we add a minimum / maximum version for curves, I think that should simplify things.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The group IDs are a bit special, it worked right away when the signature code points are added.
But the supported groups extensions need to be different for TLS1.3 and TLS1.2,
although there is no difference, from the internal representation.
Of course I do not want to add a different NID for brainpool in TLS1.2 vs. 1.3 in the
set1_curves command.
So I add NID_brainpoolP384r1, and send effectively two code points, if
the client allows all tls versions.

@kroeckx

kroeckx commented Oct 25, 2018

Copy link
Copy Markdown
Member

tls1_set_groups() will need to be adjusted to support numbers >= 32.

@bernd-edlinger

Copy link
Copy Markdown
Member Author

I hope I can avoid that.
The idea is I add NID_brainpoolP384r1 to set_groups and that gets translated
to a TLS13 groupid and a TLS12 based on the enabled protocols.
I would not like to add NID_brainpoolP384r1_for_tls13 or something.

@kroeckx

kroeckx commented Oct 25, 2018

Copy link
Copy Markdown
Member

Oh, right, you want to avoid adding NIDs.

@bernd-edlinger

Copy link
Copy Markdown
Member Author

I just added a few macros to convert the group id in a cleaner way, untested so far.

@richsalz

Copy link
Copy Markdown
Contributor

Also, please note that the Brainpool curves are explicitly not in the recommended list. The registry requirement is just to have a specification. I think that adding support for this goes against the stated OpenSSL policy, but the OMC will have to decide.

@kroeckx

kroeckx commented Oct 25, 2018

Copy link
Copy Markdown
Member

They should not be enabled by default, which this PR doesn't do as far as I know. You could argue that since TLS 1.3 says it shouldn't be supported, that they should do more than just enable it, they should enable it for use in TLS 1.3. And if you want that, you would need the new NIDs.

@bernd-edlinger

Copy link
Copy Markdown
Member Author

It is definitely not intended to enable those curves by default.
The reason why I do this is as follows:
The OPC/UA Security Working Group https://opcfoundation.org/about/working-groups/
where I am a member of, is currently defining new OPC/UA ECC Security Profiles
using the following curves: nistP256, nistP384, X25519, X448, brainpoolP256r1, brainpoolP384r1.
Those profiles will require OPC/UA Servers to have certificates with those curves.
I just want to avoid to loose the ability to communicate using TLS in case such a certificate
is used.

@mattcaswell

Copy link
Copy Markdown
Member

There isn't (yet) an RFC for this. The codepoints are there, but the associated RFC isn't. It seems a bit premature to add this.

@kaduk

kaduk commented Oct 29, 2018

Copy link
Copy Markdown
Contributor

There isn't (yet) an RFC for this. The codepoints are there, but the associated RFC isn't. It seems a bit premature to add this.

The recent changes to TLS registries (e.g., RFC 8447) explicitly intended to admit the possibility for codepoint assignment for Internet-Drafts that do not become RFCs; I don't think there's a priori a reason to wait for RFC publication. The idea is that if the draft changes enough to not be interoperable then there would need to be new codepoints assigned.

@mattcaswell

Copy link
Copy Markdown
Member

The recent changes to TLS registries (e.g., RFC 8447) explicitly intended to admit the possibility for codepoint assignment for Internet-Drafts that do not become RFCs; I don't think there's a priori a reason to wait for RFC publication. The idea is that if the draft changes enough to not be interoperable then there would need to be new codepoints assigned.

I wasn't thinking so much about interoperability but more about OpenSSL policy, i.e. it is our policy to require that such things are standardised.

@bernd-edlinger

Copy link
Copy Markdown
Member Author

There is one thing that appears to be wrong. I mean
If I use a P-256 certificate, and start the server with -curves brainpoolP256r1 or any
other curve like -curves secp256k1 (not P-256)
and connect the client with the same curves, then this tls1.2 code point is advertised
by the client, and accepted by the server, but still tls1.3 is negotiated.
This PR does only fix the behaviour for brainpool, but not for the ~20 other curves
without code point assignments. Is this conforming to RFC 8446?

@kaduk

kaduk commented Nov 1, 2018

Copy link
Copy Markdown
Contributor

I think the behavior you describe of negotiation 1.3 with a curve that is not defined for use in 1.3, is nonconformant to the spec.

@bernd-edlinger
bernd-edlinger force-pushed the enable_brainpool_for_tls13 branch from d1a71d3 to 267ac20 Compare November 3, 2018 12:24
@bernd-edlinger
bernd-edlinger force-pushed the enable_brainpool_for_tls13 branch from 267ac20 to cf4dcb9 Compare April 10, 2020 17:47
@bernd-edlinger bernd-edlinger removed the branch: master Applies to master branch label Apr 10, 2020
@bernd-edlinger
bernd-edlinger changed the base branch from master to OpenSSL_1_1_1-stable April 10, 2020 17:50
@bernd-edlinger bernd-edlinger mentioned this pull request May 9, 2020
1 of 2 tasks
@bernd-edlinger

Copy link
Copy Markdown
Member Author

rebased to master

@bernd-edlinger
bernd-edlinger force-pushed the enable_brainpool_for_tls13 branch from cf4dcb9 to 66858cd Compare October 23, 2021 19:22
@bernd-edlinger
bernd-edlinger changed the base branch from OpenSSL_1_1_1-stable to master October 23, 2021 19:31
@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/otc but the last update was 30 days ago

@paulidale paulidale left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM for master, although I'm not too conversant with this part of the code.

I'm not sure this is good for 3.0. @openssl/otc ?

@paulidale paulidale added approval: done This pull request has the required number of approvals and removed approval: otc review pending labels Nov 25, 2021
@mspncp

mspncp commented Nov 25, 2021

Copy link
Copy Markdown
Contributor

I'm not sure this is good for 3.0. @openssl/otc ?

I would consider it a new feature, not eligible for 3.0.

@t8m

t8m commented Nov 25, 2021

Copy link
Copy Markdown
Member

I do not see how this could be a bug fix. Clearly it is a new feature.

@beldmit

beldmit commented Nov 25, 2021

Copy link
Copy Markdown
Member

+1 @t8m

@paulidale paulidale removed the branch: 3.0 Applies to openssl-3.0 branch (EOL) label Nov 26, 2021
@paulidale

Copy link
Copy Markdown
Contributor

Dropping 3.0 tag.

@paulidale paulidale closed this Nov 26, 2021
@paulidale paulidale reopened this Nov 26, 2021
@openssl-machine

Copy link
Copy Markdown
Collaborator

24 hours has passed since 'approval: done' was set, but as this PR has been updated in that time the label 'approval: ready to merge' is not being automatically set. Please review the updates and set the label manually.

@bernd-edlinger

bernd-edlinger commented Nov 26, 2021 •

Copy link
Copy Markdown
Member Author

Merged to master as 0a10825.
Thanks!

@Basskrapfen

Basskrapfen commented Dec 2, 2022 •

Copy link
Copy Markdown

Hi, we were hoping this change would be part of OpenSSL 3.1.x.
Is it still possible to integrate it in OpenSSL 3.1.x?

Thanks a lot!

@bernd-edlinger any chance of integrating it into OpenSSL 3.1.x?

@t8m

t8m commented Dec 2, 2022

Copy link
Copy Markdown
Member

This was severally changed in the master branch so it is kind of non-trivial to backport to 3.1.

@Basskrapfen

Copy link
Copy Markdown

In case we would provide a backport to 3.1, would it be possible to merge this change into the 3.1 branch?

@t8m

t8m commented Dec 2, 2022

Copy link
Copy Markdown
Member

It would be considered based on the invasiveness of the change. If the patch appears soon though as the beta release which must be feature complete is now planned to be released in two or three weeks.

@Basskrapfen

Copy link
Copy Markdown

Thanks a lot, we will have a look how a backport could look like and how invasive it is.

@Basskrapfen

Copy link
Copy Markdown

Hi @t8m, I've tried and I think I'm able to apply the original patch in 3.1.x branch without many conflicts. If I insert the patch at the beginning of the 3.1.x branch history and reapply all changes from then, there is only one small conflict. I will try to create a clean pull request beginning of next week.

@t8m

t8m commented Dec 8, 2022

Copy link
Copy Markdown
Member

The problem is the original patch is not acceptable. It was later severally redone by @mattcaswell.
See:
16f0e91
c9ee6e3
3f76339

@t8m

t8m commented Dec 8, 2022

Copy link
Copy Markdown
Member

All these have to be backported.

@t8m

t8m commented Dec 8, 2022 •

Copy link
Copy Markdown
Member

There is also a problem that OpenSSL 3.1 beta1 is currently scheduled for Thursday next week. Which would close the opportunity to add this support - actually it would have to be merged on Monday at the latest. I am afraid that is not doable.

Of course the schedule for 3.1 beta is not definite, it might be delayed if OTC (on Tuesday) decides so.

@Basskrapfen

Copy link
Copy Markdown

There is also a problem that OpenSSL 3.1 beta1 is currently scheduled for Thursday next week. Which would close the opportunity to add this support - actually it would have to be merged on Monday at the latest. I am afraid that is not doable.

Of course the schedule for 3.1 beta is not definite, it might be delayed if OTC (on Tuesday) decides so.

Hi @t8m, the backport of all the patches was quite straight forward. We were able to apply them without many changes.
I've created a new pull request which is waiting for approval for the test. The final patch is luckily not very large. Please have a look, we would be very happy if it could make it into openssl-3.1.

If anything is missing, please let me know.

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval: done This pull request has the required number of approvals branch: master Applies to master branch severity: fips change The pull request changes FIPS provider sources triaged: feature The issue/pr requests/adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.