Lines Matching refs:to

21to design security into both hardware and firmware consistently. Part of the API provided by PSA i…
44 **Prerequisites to building the library with the provided makefiles:**
47 * Python 2 or Python 3 (either works) to generate the test code.
48 * Perl to run the tests.
50 If you have a C compiler such as GCC or Clang, just run `make` in the top-level directory to build …
52 …rent compiler, set the `CC` variable to the name or path of the compiler and linker (default: `cc`…
56 … makefiles pass options to the compiler that assume a GCC-like command line syntax. To use a diffe…
58 …you are cross-compiling, copy the test executable from the `tests` directory to the target machine.
66 To use a key for cryptography operations in Mbed Crypto, you need to first
70 **Prerequisites to importing keys:**
71 * Initialize the library with a successful call to `psa_crypto_init()`.
73 This example shows how to import a key:
87 printf("Failed to initialize PSA Crypto\n");
100 printf("Failed to import key\n");
119 **Prerequisites to performing asymmetric signature operations:**
120 * Initialize the library with a successful call to `psa_crypto_init()`.
122 * Usage flag `PSA_KEY_USAGE_SIGN_HASH` to allow signing.
123 * Usage flag `PSA_KEY_USAGE_VERIFY_HASH` to allow signature verification.
124 * Algorithm set to the desired signature algorithm.
126 This example shows how to sign a hash that has already been calculated:
146 printf("Failed to initialize PSA Crypto\n");
159 printf("Failed to import key\n");
169 printf("Failed to sign\n");
189 **Prerequisites to working with the symmetric cipher API:**
190 * Initialize the library with a successful call to `psa_crypto_init()`.
191 …'s usage flags must include `PSA_KEY_USAGE_ENCRYPT` to allow encryption or `PSA_KEY_USAGE_DECRYPT`…
194 1. Allocate an operation (`psa_cipher_operation_t`) structure to pass to the cipher functions.
195 1. Initialize the operation structure to zero or to `PSA_CIPHER_OPERATION_INIT`.
196 1. Call `psa_cipher_encrypt_setup()` to specify the algorithm and the key to be used.
197 1. Call either `psa_cipher_generate_iv()` or `psa_cipher_set_iv()` to generate or set the initializ…
198 1. Call `psa_cipher_update()` with the message to encrypt. You may call this function multiple time…
199 1. Call `psa_cipher_finish()` to end the operation and output the encrypted message.
201 This example shows how to encrypt data using an AES (Advanced Encryption Standard) key in CBC (Ciph…
226 printf("Failed to initialize PSA Crypto\n");
237 printf("Failed to import a key\n");
245 printf("Failed to begin cipher operation\n");
250 printf("Failed to generate IV\n");
256 printf("Failed to update cipher operation\n");
262 printf("Failed to finish cipher operation\n");
278 1. Allocate an operation (`psa_cipher_operation_t`) structure to pass to the cipher functions.
279 1. Initialize the operation structure to zero or to `PSA_CIPHER_OPERATION_INIT`.
280 1. Call `psa_cipher_decrypt_setup()` to specify the algorithm and the key to be used.
282 1. Call `psa_cipher_update()` with the message to encrypt. You may call this function multiple time…
283 1. Call `psa_cipher_finish()` to end the operation and output the decrypted message.
285 This example shows how to decrypt encrypted data using an AES key in CBC mode with no padding
310 printf("Failed to initialize PSA Crypto\n");
321 printf("Failed to import a key\n");
329 printf("Failed to begin cipher operation\n");
334 printf("Failed to set IV\n");
340 printf("Failed to update cipher operation\n");
346 printf("Failed to finish cipher operation\n");
363 After you've initialized the operation structure with a successful call to `psa_cipher_encrypt_setu…
365 The call to `psa_cipher_abort()` frees any resources associated with the operation, except for the …
368 * A call to `psa_cipher_generate_iv()`, `psa_cipher_set_iv()` or `psa_cipher_update()` fails (retur…
369 * A call to `psa_cipher_finish()` succeeds or fails.
371 After an implicit or explicit call to `psa_cipher_abort()`, the operation structure is invalidated;…
373 …t for any operation that is initialized successfully (by a successful call to `psa_cipher_encrypt_…
375 Making multiple sequential calls to `psa_cipher_abort()` on an operation that is terminated (either…
382 **Prerequisites to working with the hash APIs:**
383 * Initialize the library with a successful call to `psa_crypto_init()`.
386 1. Allocate an operation structure (`psa_hash_operation_t`) to pass to the hash functions.
387 1. Initialize the operation structure to zero or to `PSA_HASH_OPERATION_INIT`.
388 1. Call `psa_hash_setup()` to specify the hash algorithm.
389 1. Call `psa_hash_update()` with the message to encrypt. You may call this function multiple times,…
390 1. Call `psa_hash_finish()` to calculate the hash, or `psa_hash_verify()` to compare the computed h…
392 This example shows how to calculate the SHA-256 hash of a message:
407 printf("Failed to initialize PSA Crypto\n");
414 printf("Failed to begin hash operation\n");
419 printf("Failed to update hash operation\n");
425 printf("Failed to finish hash operation\n");
437 This example shows how to verify the SHA-256 hash of a message:
456 printf("Failed to initialize PSA Crypto\n");
463 printf("Failed to begin hash operation\n");
468 printf("Failed to update hash operation\n");
473 printf("Failed to verify hash\n");
489 …ter a successful call to `psa_hash_setup()`, you can terminate the operation at any time by callin…
492 1. A call to `psa_hash_update()` fails (returning any status other than `PSA_SUCCESS`).
493 1. A call to `psa_hash_finish()` succeeds or fails.
494 1. A call to `psa_hash_verify()` succeeds or fails.
496 After an implicit or explicit call to `psa_hash_abort()`, the operation structure is invalidated; i…
498 …t for any operation that is initialized successfully (by a successful call to `psa_hash_setup()`) .
500 Making multiple sequential calls to `psa_hash_abort()` on an operation that has already been termin…
506 **Prerequisites to generating random data:**
507 * Initialize the library with a successful call to `psa_crypto_init()`.
511 This example shows how to generate ten bytes of random data by calling `psa_generate_random()`:
522 printf("Failed to initialize PSA Crypto\n");
528 printf("Failed to generate a random value\n");
541 existing ones. The key derivation API has functions to take inputs, including
542 other keys and data, and functions to generate outputs, such as new keys or
546 …a. Then, use the key derivation context to either read derived data to a buffer or send derived da…
549 information about which inputs to pass when, and when you can obtain which outputs.
551 **Prerequisites to working with the key derivation APIs:**
552 * Initialize the library with a successful call to `psa_crypto_init()`.
555 * Key type set to `PSA_KEY_TYPE_DERIVE`.
556 * Algorithm set to a key derivation algorithm
604 printf("Failed to initialize PSA Crypto\n");
615 printf("Failed to import a key\n");
623 printf("Failed to begin key derivation\n");
628 printf("Failed to set capacity\n");
635 printf("Failed to input salt (extract)\n");
642 printf("Failed to input key (extract)\n");
649 printf("Failed to input info (expand)\n");
659 printf("Failed to derive key\n");
678 Mbed Crypto provides a simple way to authenticate and encrypt with associated data (AEAD), supporti…
680 **Prerequisites to working with the AEAD cipher APIs:**
681 * Initialize the library with a successful call to `psa_crypto_init()`.
684 This example shows how to authenticate and encrypt a message:
713 printf("Failed to initialize PSA Crypto\n");
740 printf("Failed to authenticate and encrypt\n");
755 This example shows how to authenticate and decrypt a message:
784 printf("Failed to initialize PSA Crypto\n");
802 printf("Failed to import a key\n");
815 printf("Failed to authenticate and decrypt %ld\n", status);
832 Mbed Crypto provides a simple way to generate a key or key pair.
834 **Prerequisites to using key generation and export APIs:**
835 * Initialize the library with a successful call to `psa_crypto_init()`.
840 …`PSA_ALG_DETERMINISTIC_ECDSA(PSA_ALG_SHA_256)`). You only want to export the public key, not the k…
859 printf("Failed to initialize PSA Crypto\n");
872 printf("Failed to generate key\n");
880 printf("Failed to export public key %ld\n", status);