-
Couldn't load subscription status.
- Fork 1.4k
doc: crypto: updates to crypto samples, part 3 #25240
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
base: main
Are you sure you want to change the base?
Conversation
CI InformationTo view the history of this post, click the 'edited' button above Inputs:Sources:sdk-nrf: PR head: 9172a0ce14f9fa49806a6b2472534d3db8617d06 more detailssdk-nrf:
Github labels
List of changed files detected by CI (38)Outputs:ToolchainVersion: cfa6b06338 Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped;
|
| - | :kconfig:option:`CONFIG_PSA_WANT_ALG_RSA_OAEP` | ||
| | :kconfig:option:`CONFIG_PSA_WANT_ALG_RSA_PKCS1V15_CRYPT` (does not support RSA key pair generation) | ||
| .. _crypto_supported_features_ecc_curve_types: |
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.
| .. _crypto_supported_features_ecc_curve_types: | |
| .. _ug_crypto_supported_features_ecc_curve_types: |
To fix the doc build failure
|
|
||
| 1. Initialization: | ||
|
|
||
| a. The PSA Crypto API is initialized using :c:func:`psa_crypto_init`. |
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.
| a. The PSA Crypto API is initialized using :c:func:`psa_crypto_init`. | |
| a. The PSA Crypto API is initialized using the :c:func:`psa_crypto_init` function. |
I'd suggest saying the ... function, at least for the first instance of a section or list.
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 is clear from the context: API, *_init.
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 is, but don't we usually use the phrase "... using the ... function" in most places?
samples/crypto/aes_cbc/prj.conf
Outdated
| CONFIG_NRF_SECURITY=y | ||
| CONFIG_MBEDTLS_PSA_CRYPTO_C=y | ||
|
|
||
| # Enable PSA Crypto APIs for the sample |
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.
These KConfigs specify cryptographic features needed by application rather that enable PSA Crypto API.
PSA API is enabled by CONFIG_MBEDTLS_PSA_CRYPTO_C
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.
Right, I actually edited this towards what you say here before I read your comment :)
Updated the documentation of crypto samples. Added sample output, cross-links to recently updated docs, more details in the overview sections. Edited sample.yaml for term and style consistency. Future PRs will edit remaining crypto samples. NCSDK-33435. Follow-up to nrfconnect#25032 and nrfconnect#25157. Signed-off-by: Grzegorz Ferenc <[email protected]>
5962a96 to
9172a0c
Compare
| CONFIG_NRF_SECURITY=y | ||
| CONFIG_MBEDTLS_PSA_CRYPTO_C=y | ||
|
|
||
| # Enable cryptographic features for compilation |
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.
| # Enable cryptographic features for compilation | |
| # Enable needed cryptographic features |
? at least "for compilation" to me is a bit off, of course you need to enable what you need to enable, and besides things might fail at runtime instead of build time so your compilation might succeed even with missing features
| 1. Initializes the Platform Security Architecture (PSA) API. | ||
| #. Goes through the steps for J-PAKE on server and client sides. | ||
| #. Verifies that the derived keys are the same. | ||
| * :kconfig:option:`CONFIG_PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY` - Used to enable support for ECC public key types from among the supported cryptographic operations for :ref:`ug_crypto_supported_features_key_types`. |
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.
From among the supported cryptographic operations? Maybe I'm just dumb but to me it's a bit weird.
| * :kconfig:option:`CONFIG_PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY` - Used to enable support for ECC public key types from among the supported cryptographic operations for :ref:`ug_crypto_supported_features_key_types`. | |
| * :kconfig:option:`CONFIG_PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY` - Used to enable support for ECC public key types among the supported cryptographic operations for :ref:`ug_crypto_supported_features_key_types`. |
| * :kconfig:option:`CONFIG_PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY` - Used to enable support for ECC public key types from among the supported cryptographic operations for :ref:`ug_crypto_supported_features_key_types`. | |
| * :kconfig:option:`CONFIG_PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY` - Used to enable support for ECC public key types in the supported cryptographic operations for :ref:`ug_crypto_supported_features_key_types`. |
| goto error; | ||
| } | ||
|
|
||
| LOG_INF("Shared secrets match successfully!"); |
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.
Match successfully? Just match, no? (Or "successfully matched"?)
| PSA_KEY_DERIVATION_OPERATION_INIT; | ||
|
|
||
| LOG_INF("Deriving a key using HKDF and SHA256..."); | ||
| LOG_INF("Deriving a key using the HKDF algorithm and SHA-256 hash algorithm..."); |
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's basically HKDF with SHA-256, repeating algorithm seems wrong
| LOG_INF("Deriving a key using the HKDF algorithm and SHA-256 hash algorithm..."); | |
| LOG_INF("Deriving a key using HKDF with SHA-256..."); |
| description: HMAC key derivation function example | ||
| name: HKDF example | ||
| description: | | ||
| This sample demonstrates HKDF key derivation using the HKDF algorithm. |
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.
| This sample demonstrates HKDF key derivation using the HKDF algorithm. | |
| This sample demonstrates key derivation using the HKDF algorithm. |
| This app provides an example of performing HMAC signing and verification | ||
| using the SHA256 hashing algorithm decryption using AES CBC mode | ||
| name: HMAC example | ||
| This sample demonstrates HMAC signing and verification using the HMAC algorithm using |
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.
repetition of "using"
| CONFIG_MBEDTLS_PSA_CRYPTO_C=y | ||
|
|
||
| # Using hardware crypto accelerator | ||
| # Enable using hardware crypto accelerator |
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.
| # Enable using hardware crypto accelerator | |
| # Enable hardware crypto accelerator |
| description: HMAC key derivation function example | ||
| name: PBKDF2 example | ||
| description: | | ||
| This sample demonstrates PBKDF2 key derivation using the PBKDF2 algorithm with HMAC-SHA-256. |
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.
PBKDF2 repetition
| CONFIG_PSA_WANT_ALG_CTR=y | ||
| CONFIG_PSA_WANT_GENERATE_RANDOM=y | ||
|
|
||
| # Enable persistent storage APIs |
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.
| # Enable persistent storage APIs | |
| # Enable persistent storage for PSA Crypto |
Updated the documentation of crypto samples.
Added sample output, cross-links to recently updated docs, more details in the overview sections.
Edited sample.yaml for term and style consistency. Future PRs will edit remaining crypto samples.
NCSDK-33435. Follow-up to #25032 and #25157.