Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the fields of mbedtls_x509_crt_profile public #4671

Merged
merged 3 commits into from
Jun 23, 2021

Conversation

mpg
Copy link
Contributor

@mpg mpg commented Jun 17, 2021

These fields are supposed to be manipulated directly, that's how people
create custom profiles.

Evidence: we recommend direct manipulation of those fields right in the migration guide

Fixes #4603

These fields are supposed to be manipulated directly, that's how people
create custom profiles.

Signed-off-by: Manuel Pégourié-Gonnard <[email protected]>
@mpg mpg added bug needs-review Every commit must be reviewed by at least two team members, mbedtls-3 needs-reviewer This PR needs someone to pick it up for review labels Jun 17, 2021
@mpg mpg self-assigned this Jun 17, 2021
*
* The fields of this structure are part of the public APi and can be
* manipulated directly by applications. Future versions of the library may
* add extra fields.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion:

Suggested change
* add extra fields.
* add extra fields or reorder fields.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, I'm not completely sure about this. Do we want to support applications that initialize with profile = {a, b, c} and are content with keeping whatever 0 means for the other fields? Or should applications only ever start with a built-in profile to get “sensible” values for new fields?

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's start with saying we may reorder fields, and we can lift this self-imposed restriction later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should document whether applications are are expected to always start from a built-in profile and modify it, or if they can also start with the all-0 profile - that is, is and when we add fields, do we commit to the value 0 for the new field to always mean the same behavior as before that field was added?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think given that we define mbedtls_x509_crt_profile_default it seems not particularly useful to support starting from the all-0 profile? +1 for documenting this expectation though.

Copy link
Contributor

Choose a reason for hiding this comment

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

it seems not particularly useful to support starting from the all-0 profile

It would make sense to start from an all-is-forbidden rather than from a sensible-default profile if you want to have precise control over what to allow. Unfortunately, all-zero isn't the ideal all-is-forbidden profile: it does mean all is forbidden, but if you start allowing RSA by adding it to allowed_pks, you'll allow RSA keys of any size — a better all-is-forbidden profile would have rsa_min_bitlen == impossibly_high.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I pushed something which I think clarifies expectations and supports the use case Gilles was mentioning.

Signed-off-by: Manuel Pégourié-Gonnard <[email protected]>
@mpg mpg force-pushed the x509-crt-profile-public branch 2 times, most recently from 6588ccd to 55a7fb8 Compare June 17, 2021 08:44
*
* The fields of this structure are part of the public API and can be
* manipulated directly by applications. Future versions of the library may
* add extra fields or reorder existing fields.
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, we may want to change field types either. Not very likely, but suppose we decide to add a 33rd curve before Mbed TLS 4.0 comes out...

@daverodgman daverodgman self-requested a review June 17, 2021 12:58
daverodgman
daverodgman previously approved these changes Jun 17, 2021
Copy link
Contributor

@daverodgman daverodgman left a comment

Choose a reason for hiding this comment

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

LGTM

@mpg mpg added needs-work and removed needs-review Every commit must be reviewed by at least two team members, needs-reviewer This PR needs someone to pick it up for review labels Jun 17, 2021
@mpg mpg dismissed stale reviews from daverodgman and gilles-peskine-arm via f59e567 June 18, 2021 07:49
daverodgman
daverodgman previously approved these changes Jun 18, 2021
@mpg mpg added needs-review Every commit must be reviewed by at least two team members, and removed needs-work labels Jun 18, 2021
@mpg mpg requested a review from gilles-peskine-arm June 18, 2021 10:33
@gilles-peskine-arm
Copy link
Contributor

CI is unhappy

@gilles-peskine-arm gilles-peskine-arm added needs-ci Needs to pass CI tests needs-work and removed needs-review Every commit must be reviewed by at least two team members, labels Jun 18, 2021
Signed-off-by: Manuel Pégourié-Gonnard <[email protected]>
@mpg
Copy link
Contributor Author

mpg commented Jun 18, 2021

CI is unhappy

Aw sorry, that's embarrassing, the code I pushed wasn't even syntactically correct. I re-enabled my pre-push hook in an attempt to only push slightly less embarrassing mistakes in the future.

@gilles-peskine-arm gilles-peskine-arm added needs-review Every commit must be reviewed by at least two team members, and removed needs-ci Needs to pass CI tests needs-work labels Jun 18, 2021
@mpg mpg requested a review from daverodgman June 18, 2021 16:35
@mpg
Copy link
Contributor Author

mpg commented Jun 22, 2021

@daverodgman There has been changes since your previous approval, can you re-review? (I forgot to mention this yesterday, but this is also something we really want in 3.0.)

@mpg mpg added this to the 3.0 milestone Jun 23, 2021
@daverodgman daverodgman removed the needs-review Every commit must be reviewed by at least two team members, label Jun 23, 2021
@daverodgman daverodgman merged commit cb17fc3 into Mbed-TLS:development Jun 23, 2021
@mpg mpg deleted the x509-crt-profile-public branch July 1, 2021 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document some structure fields as public
3 participants