Skip to content

Replace "generator" with "key derivation" #113

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

Conversation

gilles-peskine-arm
Copy link
Collaborator

Generators are mostly about key derivation (currently: only about key derivation). "Generator" is not a commonly used term in cryptography. So favor "derivation" as terminology. Call a generator a key derivation operation structure, since it behaves like other multipart operation structures. Furthermore, the function names were not fully consistent; this PR makes them more consistent.

@gilles-peskine-arm gilles-peskine-arm added enhancement New feature or request needs: review The pull request is ready for review. This generally means that it has no known issues. api-spec Issue or PR about the PSA specifications labels May 16, 2019
@gilles-peskine-arm gilles-peskine-arm added this to the api-1.0-beta-3 milestone May 16, 2019
@gilles-peskine-arm gilles-peskine-arm changed the title Psa generator to derivation Replace "generator" with "key derivation" May 16, 2019
@gilles-peskine-arm gilles-peskine-arm force-pushed the psa-generator_to_derivation branch from 1b96587 to 0129a04 Compare May 16, 2019 16:40
Generators are mostly about key derivation (currently: only about key
derivation). "Generator" is not a commonly used term in cryptography.
So favor "derivation" as terminology. Call a generator a key
derivation operation structure, since it behaves like other multipart
operation structures. Furthermore, the function names are not fully
consistent.

In this commit, I rename the functions to consistently have the prefix
"psa_key_derivation_". I used the following command:

    perl -i -pe '%t = (
        psa_crypto_generator_t => "psa_key_derivation_operation_t",
        psa_crypto_generator_init => "psa_key_derivation_init",
        psa_key_derivation_setup => "psa_key_derivation_setup",
        psa_key_derivation_input_key => "psa_key_derivation_input_key",
        psa_key_derivation_input_bytes => "psa_key_derivation_input_bytes",
        psa_key_agreement => "psa_key_derivation_key_agreement",
        psa_set_generator_capacity => "psa_key_derivation_set_capacity",
        psa_get_generator_capacity => "psa_key_derivation_get_capacity",
        psa_generator_read => "psa_key_derivation_output_bytes",
        psa_generate_derived_key => "psa_key_derivation_output_key",
        psa_generator_abort => "psa_key_derivation_abort",
        PSA_CRYPTO_GENERATOR_INIT => "PSA_KEY_DERIVATION_OPERATION_INIT",
        PSA_GENERATOR_UNBRIDLED_CAPACITY => "PSA_KEY_DERIVATION_UNLIMITED_CAPACITY",
        ); s/\b(@{[join("|", keys %t)]})\b/$t{$1}/ge' $(git ls-files)
More consistent with the new function names.
    perl -pe 's/crypto_generator/key_derivation/gi' $(git ls-files)
    perl -pe 's/_generator/_key_derivation/gi' $(git ls-files)
Generators are mostly about key derivation (currently: only about key
derivation). "Generator" is not a commonly used term in cryptography.
So favor "derivation" as terminology.

This commit updates the function descriptions.
Generators are now key derivation operations.

Keep "random generator" intact.
After renaming several identifiers, re-wrap and re-indent some lines
to make the code prettier.
Present key derivation functions in a more logical order,
corresponding roughly to the order in which an application would call
them.
There is less of a risk of confusion with the KA+KDF function now.
There was some copypasta from the KA+KDF function's description.
@gilles-peskine-arm gilles-peskine-arm force-pushed the psa-generator_to_derivation branch from 0129a04 to 58fe9e8 Compare May 16, 2019 16:56
Copy link
Collaborator

@yanesca yanesca left a comment

Choose a reason for hiding this comment

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

./programs/psa/key_ladder_demo.c still has a variable with name generator. Other than that it looks good to me.

@gilles-peskine-arm
Copy link
Collaborator Author

programs/psa/key_ladder_demo.c also uses an obsolete function, which is a bigger problem. It'll have to be reworked as part of #37 .

@Patater
Copy link
Contributor

Patater commented May 16, 2019

CI failure is ABI job (known to fail until Mbed-TLS/mbedtls#2636 lands in the development branch) and USE_PSA_CRYPTO, which doesn't work on the API branch.

@Patater Patater merged commit eef988f into ARMmbed:psa-api-1.0-beta May 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-spec Issue or PR about the PSA specifications enhancement New feature or request needs: review The pull request is ready for review. This generally means that it has no known issues.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants