-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Make the fields of mbedtls_x509_crt_profile public #4671
Conversation
These fields are supposed to be manipulated directly, that's how people create custom profiles. Signed-off-by: Manuel Pégourié-Gonnard <[email protected]>
include/mbedtls/x509_crt.h
Outdated
* | ||
* 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion:
* add extra fields. | |
* add extra fields or reorder fields. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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]>
6588ccd
to
55a7fb8
Compare
* | ||
* 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. |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
CI is unhappy |
Signed-off-by: Manuel Pégourié-Gonnard <[email protected]>
f59e567
to
9d4c2c4
Compare
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. |
@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.) |
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