Make number of key slots externally configurable #9
No reviewers
Labels
No labels
api-spec
bug
CLA requested
CLA valid
compliance
DO NOT MERGE
duplicate
enhancement
feature branch
good first issue
HEADER FORMATTING ISSUE
help wanted
Information
invalid
Jira status: AWAITING REVIEW
Jira status: CLOSED
Jira status: DONE
Jira status: IN PROGRESS
Jira status: IN REVIEW
Jira status: OPEN
Jira status: REOPENED
Jira status: RESOLVED
mirrored
mirror internally
needs: backports
needs: ci
needs: design review
needs: preceding PR
needs: review
needs: work
notabug
open for community contribution
Product Backlog
question
ready for merge
security
stale
type: bug
type: enhancement
type: question
web pages
wontfix
writing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-ARMmbed/mbed-crypto!9
Loading…
Reference in a new issue
No description provided.
Delete branch "add_external_slot_count_config"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
changes to make number of key slots externally configurable
changed define name from PSA_KEY_SLOT_COUNT to MBEDTLS_PSA_KEY_SLOT_COUNT
moved define to crypto_extra.h and made it possible to externally override
depends on fixes from (and is rebased on) : https://github.com/ARMmbed/mbed-crypto/pull/8
@ -121,6 +121,15 @@ psa_status_t mbedtls_psa_inject_entropy(const unsigned char *seed,size_t seed_size);not needed if above accepted
@ -124,0 +126,4 @@* Note: this configuration flag is an implementation detail that may change* or be removed in future versions */#if !defined(MBEDTLS_PSA_KEY_SLOT_COUNT)#define MBEDTLS_PSA_KEY_SLOT_COUNT 32i understand this is the naming convention for external define.
but still mbedtls has nothing to do with psa key slots number.
can we not have the mbedtls prefix? have some other?
why not leave it PSA_KEY_SLOT_COUNT?
@ -121,6 +121,15 @@ psa_status_t mbedtls_psa_inject_entropy(const unsigned char *seed,size_t seed_size);I was told the preffernce was for positive ifdef checks as opposed to negative ones.
I agree that the negative route is shorter. I don't mind changing if this doesn't present a problem.
see above
@ -124,0 +126,4 @@* Note: this configuration flag is an implementation detail that may change* or be removed in future versions */#if !defined(MBEDTLS_PSA_KEY_SLOT_COUNT)#define MBEDTLS_PSA_KEY_SLOT_COUNT 32I asked @gilles-peskine-arm and @Patater on their inputs on this and this is the name @gilles-peskine-arm requested.
Unless there's a good reason not to put
MBEDTLS_PSA_KEY_SLOT_COUNTinconfig.h, please do that.@ -121,6 +121,15 @@ psa_status_t mbedtls_psa_inject_entropy(const unsigned char *seed,size_t seed_size);Please avoid
#ifdef !xxxif there's an#else. If there's no#else, just write the condition you need. In all cases the preference is for the simplest way to write the code.@ -124,0 +126,4 @@* Note: this configuration flag is an implementation detail that may change* or be removed in future versions */#if !defined(MBEDTLS_PSA_KEY_SLOT_COUNT)#define MBEDTLS_PSA_KEY_SLOT_COUNT 32We currently have two prefixes:
PSA_xxxandMBEDTLS_xxx(and the lowercase versions). To avoid confusion, for the time being, please reservePSA_xxxorpsa_xxxnames in public headers for official parts of the PSA API, and useMBEDTLS_xxxormbedtls_xxxfor implementation-specific names. I expect that we'll change the conventions at some point, but not before we've finished splitting Mbed Crypto from Mbed TLS and released PSA Crypto as a specification separate from its reference implementation.Since this is a build-time configuration option, I think it should be in
include/mbedtls/config.h. See that file for other similar options (near the end, after the boolean options).@ -124,0 +126,4 @@* Note: this configuration flag is an implementation detail that may change* or be removed in future versions */#if !defined(MBEDTLS_PSA_KEY_SLOT_COUNT)#define MBEDTLS_PSA_KEY_SLOT_COUNT 32Hi @gilles-peskine-arm,
regarding adding this flag to config.h, you wrote in the email chain:
"I'm not keen on adding it to mbedtls/config.h because it isn't necessarily something that we'll maintain backward compatibility with. "
This is the reason it was left out, I can add it now if you prefer
@ -121,6 +121,15 @@ psa_status_t mbedtls_psa_inject_entropy(const unsigned char *seed,size_t seed_size);great, thanks @gilles-peskine-arm, will fix this to the simpler version
@ -124,0 +126,4 @@* Note: this configuration flag is an implementation detail that may change* or be removed in future versions */#if !defined(MBEDTLS_PSA_KEY_SLOT_COUNT)#define MBEDTLS_PSA_KEY_SLOT_COUNT 32Hmm, yes, that is a good point, we aren't going to promise backward compatibility for this, so it shouldn't be in
config.h, or at least not until we revise (and document!) our backward compatibility rules. So please keep it incrypto_extra.h, and add a comment that states that this is an implementation detail that may change or be removed in future versions. By default we do promise to maintain backward compatibility with things defined incrypto_extra.h.@ -121,6 +121,15 @@ psa_status_t mbedtls_psa_inject_entropy(const unsigned char *seed,size_t seed_size);fixed
@ -121,6 +121,15 @@ psa_status_t mbedtls_psa_inject_entropy(const unsigned char *seed,size_t seed_size);fixed
@ -124,0 +126,4 @@* Note: this configuration flag is an implementation detail that may change* or be removed in future versions */#if !defined(MBEDTLS_PSA_KEY_SLOT_COUNT)#define MBEDTLS_PSA_KEY_SLOT_COUNT 32sure, comment added
@ -124,0 +126,4 @@* Note: this configuration flag is an implementation detail that may change* or be removed in future versions */#if !defined(MBEDTLS_PSA_KEY_SLOT_COUNT)#define MBEDTLS_PSA_KEY_SLOT_COUNT 32We do have precedents for defining options in
config.hthat we don't intend to preserve backward compatibility for:MBEDTLS_PSA_HAS_ITS_IO,MBEDTLS_PSA_CRYPTO_SPM, the PSA storage modules. We intend to preserve the functionality, but not necessarily the configuration interface.@Patater What's your opinion on this?
@ -124,0 +126,4 @@* Note: this configuration flag is an implementation detail that may change* or be removed in future versions */#if !defined(MBEDTLS_PSA_KEY_SLOT_COUNT)#define MBEDTLS_PSA_KEY_SLOT_COUNT 32More generally, in Mbed Crypto, we don't intend to preserve compatibility with
MBEDTLS_xxxAPIs in the long term. So I think my view of backward compatibility is behind the times and the configuration option should go inconfig.h.@ -124,0 +126,4 @@* Note: this configuration flag is an implementation detail that may change* or be removed in future versions */#if !defined(MBEDTLS_PSA_KEY_SLOT_COUNT)#define MBEDTLS_PSA_KEY_SLOT_COUNT 32@gilles-peskine-arm and @Patater , what is the final ruling on this? (add to config.h or not)
@ -124,0 +126,4 @@* Note: this configuration flag is an implementation detail that may change* or be removed in future versions */#if !defined(MBEDTLS_PSA_KEY_SLOT_COUNT)#define MBEDTLS_PSA_KEY_SLOT_COUNT 32slot count is public define now, so it can be PSA_xxx ...
@ -124,0 +126,4 @@* Note: this configuration flag is an implementation detail that may change* or be removed in future versions */#if !defined(MBEDTLS_PSA_KEY_SLOT_COUNT)#define MBEDTLS_PSA_KEY_SLOT_COUNT 32how about default number of 16 or 20?
cc @gilles-peskine-arm
@ -124,0 +126,4 @@* Note: this configuration flag is an implementation detail that may change* or be removed in future versions */#if !defined(MBEDTLS_PSA_KEY_SLOT_COUNT)#define MBEDTLS_PSA_KEY_SLOT_COUNT 32I think @gilles-peskine-arm said that PSA_XXX is only for public PSA API and this is not as it is a configuration for MbedCrypto that other implementations do not currently have to support.
@ -124,0 +126,4 @@* Note: this configuration flag is an implementation detail that may change* or be removed in future versions */#if !defined(MBEDTLS_PSA_KEY_SLOT_COUNT)#define MBEDTLS_PSA_KEY_SLOT_COUNT 32as was mentioned in the email discussion, we need to see some testing on real world use (e.g. mbed client usage) to decide on a new default value. So for now I've left the default as it is. If we can decide on a new value I will set it.
Closing as stale. The check-names updates have been merged already. The benefit of moving the number of slots configuration option from one impelentation-specifc header to another is of questionable benefit. Better to move into config.h if we want this user configurable.
Pull request closed