-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Labels
Area: docArea: DocumentationArea: DocumentationType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)The issue reports a bug / The PR fixes a bug (including spelling errors)
Description
Description
There is one parenthesis too many in the documentation of sys/psa_crypto.
RIOT/sys/psa_crypto/doc.md at line 104:
89 | After setting the attributes, an exiting key can be imported:
90 | ```c
91 | uint8_t aes_key[] = { ... };
92 | psa_key_id_t key_id = 0; // Will be set by PSA Crypto
93 | psa_status_t status = psa_import_key(&attributes, aes_key, sizeof(aes_key), &key_id);
94 | ```
95 | The PSA Crypto implementation will assign an identifier to the key and return it
96 | via the `key_id` parameter. This identifier can then be used for operations with this
97 | specific key.
98 | ```c
99 | uint8_t PLAINTEXT[] = { ... };
100 | // Buffer sizes can be calculated with macros
101 | size_t output_buf_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(PSA_KEY_TYPE_AES, PSA_ALG_CBC_NO_PADDING,sizeof(PLAINTEXT));
102 | uint8_t output_buffer[output_buf_size];
103 |
104 | status = psa_cipher_encrypt(key_id, PSA_ALG_CBC_NO_PADDING, PLAINTEXT, sizeof(PLAINTEXT),output_buffer, sizeof(output_buffer), &output_length));
105 | ```
Expected results
89 | After setting the attributes, an exiting key can be imported:
90 | ```c
91 | uint8_t aes_key[] = { ... };
92 | psa_key_id_t key_id = 0; // Will be set by PSA Crypto
93 | psa_status_t status = psa_import_key(&attributes, aes_key, sizeof(aes_key), &key_id);
94 | ```
95 | The PSA Crypto implementation will assign an identifier to the key and return it
96 | via the `key_id` parameter. This identifier can then be used for operations with this
97 | specific key.
98 | ```c
99 | uint8_t PLAINTEXT[] = { ... };
100 | // Buffer sizes can be calculated with macros
101 | size_t output_buf_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(PSA_KEY_TYPE_AES, PSA_ALG_CBC_NO_PADDING,sizeof(PLAINTEXT));
102 | uint8_t output_buffer[output_buf_size];
103 |
104 | status = psa_cipher_encrypt(key_id, PSA_ALG_CBC_NO_PADDING, PLAINTEXT, sizeof(PLAINTEXT),output_buffer, sizeof(output_buffer), &output_length);
105 | ```
Metadata
Metadata
Assignees
Labels
Area: docArea: DocumentationArea: DocumentationType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)The issue reports a bug / The PR fixes a bug (including spelling errors)