/mbedtls-3.7.0/library/ |
D | ssl_ticket.c | 69 mbedtls_ssl_ticket_key *key = ctx->keys + index; in ssl_ticket_gen_key() local 76 key->generation_time = mbedtls_time(NULL); in ssl_ticket_gen_key() 81 key->lifetime = ctx->ticket_lifetime; in ssl_ticket_gen_key() 83 if ((ret = ctx->f_rng(ctx->p_rng, key->name, sizeof(key->name))) != 0) { in ssl_ticket_gen_key() 94 psa_set_key_algorithm(&attributes, key->alg); in ssl_ticket_gen_key() 95 psa_set_key_type(&attributes, key->key_type); in ssl_ticket_gen_key() 96 psa_set_key_bits(&attributes, key->key_bits); in ssl_ticket_gen_key() 100 PSA_BITS_TO_BYTES(key->key_bits), in ssl_ticket_gen_key() 101 &key->key)); in ssl_ticket_gen_key() 104 ret = mbedtls_cipher_setkey(&key->ctx, buf, in ssl_ticket_gen_key() [all …]
|
D | pkwrite.c | 412 const mbedtls_pk_context *key) in mbedtls_pk_write_pubkey() argument 418 if (mbedtls_pk_get_type(key) == MBEDTLS_PK_RSA) { in mbedtls_pk_write_pubkey() 419 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_rsa_write_pubkey(mbedtls_pk_rsa(*key), start, p)); in mbedtls_pk_write_pubkey() 423 if (mbedtls_pk_get_type(key) == MBEDTLS_PK_ECKEY) { in mbedtls_pk_write_pubkey() 424 MBEDTLS_ASN1_CHK_ADD(len, pk_write_ec_pubkey(p, start, key)); in mbedtls_pk_write_pubkey() 428 if (mbedtls_pk_get_type(key) == MBEDTLS_PK_OPAQUE) { in mbedtls_pk_write_pubkey() 429 MBEDTLS_ASN1_CHK_ADD(len, pk_write_opaque_pubkey(p, start, key)); in mbedtls_pk_write_pubkey() 437 int mbedtls_pk_write_pubkey_der(const mbedtls_pk_context *key, unsigned char *buf, size_t size) in mbedtls_pk_write_pubkey_der() argument 452 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_pk_write_pubkey(&c, buf, key)); in mbedtls_pk_write_pubkey_der() 469 pk_type = pk_get_type_ext(key); in mbedtls_pk_write_pubkey_der() [all …]
|
D | des.c | 312 void mbedtls_des_key_set_parity(unsigned char key[MBEDTLS_DES_KEY_SIZE]) in mbedtls_des_key_set_parity() 317 key[i] = odd_parity_table[key[i] / 2]; in mbedtls_des_key_set_parity() 324 int mbedtls_des_key_check_key_parity(const unsigned char key[MBEDTLS_DES_KEY_SIZE]) in mbedtls_des_key_check_key_parity() 329 if (key[i] != odd_parity_table[key[i] / 2]) { in mbedtls_des_key_check_key_parity() 381 int mbedtls_des_key_check_weak(const unsigned char key[MBEDTLS_DES_KEY_SIZE]) in mbedtls_des_key_check_weak() 386 if (memcmp(weak_key_table[i], key, MBEDTLS_DES_KEY_SIZE) == 0) { in mbedtls_des_key_check_weak() 395 void mbedtls_des_setkey(uint32_t SK[32], const unsigned char key[MBEDTLS_DES_KEY_SIZE]) in mbedtls_des_setkey() 400 X = MBEDTLS_GET_UINT32_BE(key, 0); in mbedtls_des_setkey() 401 Y = MBEDTLS_GET_UINT32_BE(key, 4); in mbedtls_des_setkey() 464 int mbedtls_des_setkey_enc(mbedtls_des_context *ctx, const unsigned char key[MBEDTLS_DES_KEY_SIZE]) in mbedtls_des_setkey_enc() [all …]
|
/mbedtls-3.7.0/tests/suites/ |
D | test_suite_pkwrite.data | 1 Public key write check RSA 5 Public key write check RSA (DER) 9 Public key write check RSA 4096 13 Public key write check RSA 4096 (DER) 17 Public key write check EC 192 bits 21 Public key write check EC 192 bits (DER) 25 Public key write check EC 521 bits 29 Public key write check EC 521 bits (DER) 33 Public key write check EC Brainpool 512 bits 37 Public key write check EC Brainpool 512 bits (DER) [all …]
|
D | test_suite_psa_crypto_persistent_key.data | 2 # stored, this may indicate that the key store is changing in a 6 Format for storage: RSA private key 9 Format for storage: AES-128 key 12 Parse storage: RSA private key 15 Parse storage: AES-128 key 33 Parse storage: truncated key 37 Save maximum-size persistent raw key 41 Save larger than maximum-size persistent raw key 44 Persistent key destroy 48 Persistent key destroy after restart [all …]
|
D | test_suite_nist_kw.function | 21 unsigned char key[16]; 30 memset(key, 0, sizeof(key)); 40 key, sizeof(key) * 8, 51 key, sizeof(key) * 8, 75 key, sizeof(key) * 8, 93 key, sizeof(key) * 8, 129 unsigned char key[32]; 134 memset(key, 0x2A, sizeof(key)); 135 TEST_ASSERT((unsigned) key_size <= 8 * sizeof(key)); 137 ret = mbedtls_nist_kw_setkey(&ctx, cipher_id, key, key_size, is_wrap); [all …]
|
D | test_suite_x509write.data | 3 x509_csr_check:"data_files/server1.key":"data_files/server1.req.sha1":MBEDTLS_MD_SHA1:0:0:0:0:0 7 x509_csr_check:"data_files/server1.key":"data_files/server1.req.sha224":MBEDTLS_MD_SHA224:0:0:0:0:0 11 x509_csr_check:"data_files/server1.key":"data_files/server1.req.sha256":MBEDTLS_MD_SHA256:0:0:0:0:0 15 x509_csr_check:"data_files/server1.key":"data_files/server1.req.sha384":MBEDTLS_MD_SHA384:0:0:0:0:0 19 x509_csr_check:"data_files/server1.key":"data_files/server1.req.sha512":MBEDTLS_MD_SHA512:0:0:0:0:0 23 x509_csr_check:"data_files/server1.key":"data_files/server1.req.md5":MBEDTLS_MD_MD5:0:0:0:0:0 27 x509_csr_check:"data_files/server1.key":"data_files/server1.req.key_usage":MBEDTLS_MD_SHA1:MBEDTLS_… 31 x509_csr_check_opaque:"data_files/server1.key":MBEDTLS_MD_SHA1:MBEDTLS_X509_KU_DIGITAL_SIGNATURE | … 35 x509_csr_check:"data_files/server1.key":"data_files/server1.req.key_usage_empty":MBEDTLS_MD_SHA1:0:… 39 x509_csr_check:"data_files/server1.key":"data_files/server1.req.cert_type":MBEDTLS_MD_SHA1:0:0:MBED… [all …]
|
D | test_suite_psa_crypto.data | 55 PSA import AES: bad key size 59 PSA import/export RSA public key: good, 1024-bit 63 PSA import/export RSA public key: good, larger buffer (+1 byte) 67 PSA import/export RSA public key: good, larger buffer (*2-1) 71 PSA import/export RSA public key: good, larger buffer (*2) 75 PSA import/export RSA public key: good, larger buffer (*2+1) 79 PSA import/export RSA public key: export buffer too small 111 PSA import/export RSA public key: good, 1024-bit, opaque 115 PSA import/export RSA public key: good, larger buffer (+1 byte), opaque 119 PSA import/export RSA public key: good, larger buffer (*2-1), opaque [all …]
|
D | test_suite_psa_crypto_se_driver_hal_mocks.data | 13 SE key importing mock test 16 SE key importing mock test: max key bits 19 SE key importing mock test: more than max key bits 22 SE key importing mock test: alloc failed 25 SE key importing mock test: import failed 28 SE key exporting mock test 31 SE key exporting mock test: export failed 34 SE public key exporting mock test 37 SE public key exporting mock test: export failed 40 SE key generating mock test [all …]
|
D | test_suite_lmots.data | 2 # This test uses a fixed message, and then generates a private key, signs the 7 # This test uses a fixed message, and then generates a private key, signs the 12 # This test uses a NULL zero-length message, and then generates a private key, 20 # key is stored in data_files/lms_hsslms_sha256_m32_h5_lmots_sha256_n32_w8_prv. 21 # This test uses the same OTS key as the LMS hsslms interop test 1 (leaf 0 of 22 # the LMS key), and the same message. 24 # To produce another signature with this message and key (note that the actual 45 # key is stored in data_files/lms_hsslms_sha256_m32_h5_lmots_sha256_n32_w8_prv. 46 # This test uses the same OTS key as the LMS hsslms interop test 2 (leaf 1 of 47 # the LMS key), and the same message. [all …]
|
D | test_suite_psa_crypto_slot_management.function | 8 /**< Close key(s) */ 11 /**< Destroy key(s) */ 14 /**< Purge key(s) */ 20 /**< Close key(s) then terminate and re-initialize */ 23 /**< Destroy key(s) then terminate and re-initialize */ 26 /**< Purge key(s) then terminate and re-initialize */ 43 /** Apply \p invalidate_method to invalidate the specified key: 47 mbedtls_svc_key_id_t key) 50 /* Closing the key invalidate only volatile keys, not persistent ones. */ 53 PSA_ASSERT(psa_close_key(key)); [all …]
|
D | test_suite_lms.data | 2 # This test uses a fixed message, and then generates a private key, signs the 7 # This test uses a NULL zero-length message, and then generates a private key, 13 # limited amount of available test vectors for LMS. The private key is stored in 15 # uses leaf key 0, so must be the first signature generated by the key if the 18 # word at the start of the key/sig. We strip these 4 bytes from the signature 19 # and the public key before including them in a the test data. 21 # To produce another signature with this message and key (note that the actual 39 # The signature uses leaf key 1, so must be the second signature generated by 40 # the key if the signature is to be reproduced. 42 # To produce another signature with this message and key (note that the actual [all …]
|
D | test_suite_psa_crypto.function | 46 mbedtls_svc_key_id_t key, 56 PSA_ASSERT(psa_pake_set_password_key(operation, key)); 142 * Or, for a public key, the same structure with only 185 mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT; 191 PSA_ASSERT(psa_import_key(&attributes, key_bytes, key_length, &key)); 193 *status = psa_mac_sign_setup(operation, key, alg); 199 TEST_EQUAL(psa_mac_sign_setup(operation, key, alg), *status); 202 psa_destroy_key(key); 206 psa_destroy_key(key); 217 mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT; [all …]
|
D | test_suite_rsa.data | 37 # Bad padding after performing the public key operation 279 RSA Check empty private key 282 RSA Check Private key #1 (Correct) 285 RSA Check Private key #2 (No P) 288 RSA Check Private key #3 (No Q) 291 RSA Check Private key #4 (No N) 294 RSA Check Private key #5 (No E) 297 RSA Check Private key #6 (No D) 300 RSA Check Private key #7 (No DP) 304 RSA Check Private key #8 (No DQ) [all …]
|
D | test_suite_ccm.function | 6 * The context must have been set up with the key. */ 82 unsigned char key[32]; 88 memset(key, 0x2A, sizeof(key)); 89 TEST_ASSERT((unsigned) key_size <= 8 * sizeof(key)); 91 ret = mbedtls_ccm_setkey(&ctx, cipher_id, key, key_size); 104 unsigned char key[16]; 116 memset(key, 0, sizeof(key)); 123 key, 8 * sizeof(key)) == 0); 149 unsigned char key[16]; 160 memset(key, 0, sizeof(key)); [all …]
|
/mbedtls-3.7.0/docs/architecture/ |
D | mbed-crypto-storage-specification.md | 28 * [Persistent transparent keys](#key-file-format-for-0.1.0) designated by a [slot number](#key-name… 35 We do not make any promises regarding key storage, or regarding the nonvolatile random seed file on… 39 …key is stored in a dedicated file whose name is constructed from the key identifier. The way in wh… 41 The valid values for a key identifier are the range from 1 to 0xfffeffff. This limitation on the ra… 53 The layout of a key file is: 60 * key material length (4 bytes) 61 * key material: output of `psa_export_key` 75 … 1 through 0xfffeffff: [content](#key-file-format-for-0.1.0) of the [key whose identifier is the f… 83 …time configuration value `CRYPTO_STORAGE_FILE_LOCATION` allows storing the key files in a director… 86 …ATION "psa_key_slot_%lu", key_id)` [content](#key-file-format-for-0.1.0) of the [key whose identif… [all …]
|
D | psa-storage-resilience.md | 5 …key store. It is possible to create a persistent key and read it back later. This must work even i… 19 …key creation function in the PSA Crypto API reports to the application that a key has been created… 34 …key, all key management operations (creation or destruction) on persistent keys rely on a single c… 38 * [Key management for stateful secure element keys](#designing-key-management-for-secure-element-ke… 44 ## Designing key management for secure element keys 46 …key” to mean a key stored in a stateful secure element, i.e. a secure element that stores keys. Th… 50 **Assumption: driver calls for key management in stateful secure elements are atomic and committing… 56 For a secure element key, key management requires a commitment on both sites. For example, consider… 58 1. The core sends a request to the secure element to create a key. 59 2. The secure element modifies its key store to create the key. [all …]
|
/mbedtls-3.7.0/include/psa/ |
D | crypto.h | 134 mbedtls_svc_key_id_t key); 378 psa_status_t psa_get_key_attributes(mbedtls_svc_key_id_t key, 422 psa_status_t psa_purge_key(mbedtls_svc_key_id_t key); 567 psa_status_t psa_destroy_key(mbedtls_svc_key_id_t key); 649 mbedtls_svc_key_id_t *key); 741 psa_status_t psa_export_key(mbedtls_svc_key_id_t key, 816 psa_status_t psa_export_public_key(mbedtls_svc_key_id_t key, 1211 psa_status_t psa_mac_compute(mbedtls_svc_key_id_t key, 1252 psa_status_t psa_mac_verify(mbedtls_svc_key_id_t key, 1359 mbedtls_svc_key_id_t key, [all …]
|
/mbedtls-3.7.0/tests/src/ |
D | psa_exercise_key.c | 41 static int check_key_attributes_sanity(mbedtls_svc_key_id_t key, in check_key_attributes_sanity() argument 50 psa_status_t status = psa_get_key_attributes(key, &attributes); in check_key_attributes_sanity() 120 static int exercise_mac_key(mbedtls_svc_key_id_t key, in exercise_mac_key() argument 136 status = psa_mac_sign_setup(&operation, key, alg); in exercise_mac_key() 155 status = psa_mac_verify_setup(&operation, key, alg); in exercise_mac_key() 175 static int exercise_cipher_key(mbedtls_svc_key_id_t key, in exercise_cipher_key() argument 192 PSA_ASSERT(psa_get_key_attributes(key, &attributes)); in exercise_cipher_key() 197 status = psa_cipher_encrypt_setup(&operation, key, alg); in exercise_cipher_key() 225 status = psa_cipher_decrypt_setup(&operation, key, alg); in exercise_cipher_key() 263 static int exercise_aead_key(mbedtls_svc_key_id_t key, in exercise_aead_key() argument [all …]
|
/mbedtls-3.7.0/docs/proposed/ |
D | psa-driver-interface.md | 16 … of a **core** and zero or more **drivers**. The core handles key management, enforces key usage p… 24 …lable for a particular combination of parameters (cryptographic algorithm, key type and size, etc.… 25 …oked for the specific [key location](#lifetimes-and-locations) that the driver is registered for: … 35 …ap keys with a built-in keys but not store user keys; and cryptoprocessors that store key material. 82 …atory for opaque drivers): information about the [representation of keys](#key-format-for-opaque-d… 90 … certain class of cryptographic mechanisms. The capability specifies which key types and algorithm… 96 …key type specification](#key-type-specifications). If specified, the core will invoke this capabil… 97 … involving a key with one of the specified key sizes. If omitted, the core will invoke this capabi… 111 * If the mechanism involves a key: 112 …* either the key is transparent (its location is `PSA_KEY_LOCATION_LOCAL_STORAGE`) and the driver … [all …]
|
/mbedtls-3.7.0/docs/ |
D | psa-transition.md | 35 * Mbed TLS legacy APIs require key material to be present in the application memory. The PSA Crypto… 80 Apart from keys, as described in “[Key management](#key-management)” below, APIs that need to prese… 88 …key take a parameter of type [`psa_key_id_t`](https://mbed-tls.readthedocs.io/projects/api/en/deve… 90 To use a key: 92 …key object with a key creation function. The two most common ones are [`psa_import_key`](https://m… 93 2. Use the key as desired, passing the key identifier obtained during the key creation. 94 3. Finally destroy the key object with [`psa_destroy_key`](https://mbed-tls.readthedocs.io/projects… 96 …key management](#cipher-key-management)”, “[MAC key management](#mac-key-management)”, “[Key lifec… 98 …key material, call [`psa_export_key`](https://mbed-tls.readthedocs.io/projects/api/en/development/… 100 Note that a key consumes a key store entry, which is distinct from heap memory, until it is destroy… [all …]
|
/mbedtls-3.7.0/docs/architecture/psa-migration/ |
D | psa-legacy-bridges.md | 61 * Creating a key with the legacy API and consuming it in the PSA API. 62 * Creating a key with the PSA API and consuming it in the legacy API. 94 Hashes are often used as building blocks for other mechanisms (HMAC, signatures, key derivation, et… 118 The legacy API only has generic support for two key types: RSA and ECC, via the pk module. ECC keys… 120 An RSA or ECC key can potentially be used for different algorithms in the scope of the pk module: 123 * ECC: ECDSA signature (randomized or deterministic), ECDH key agreement (via `mbedtls_pk_ec`). 127 …re does not seem to be a need to convert between legacy and PSA asymmetric key types on their own.… 139 * Simultaneously supporting **a key type and an algorithm**. 145 #### Using a legacy key pair or public key with PSA 147 …rios where an application has a legacy key pair or public key (`mbedtls_pk_context`) and needs to … [all …]
|
/mbedtls-3.7.0/tests/data_files/ |
D | Makefile | 40 test_ca_key_file_rsa = test-ca.key 41 test_ca_key_file_rsa_unenc = test-ca_unenc.key 62 test-ca.key.der: $(test_ca_key_file_rsa) 64 all_final += test-ca.key.der 91 …$(OPENSSL) req -x509 -new -nodes -key $(test_ca_key_file_rsa) -passin "pass:$(test_ca_pwd_rsa)" -s… 95 …$(OPENSSL) req -x509 -new -nodes -key $(test_ca_key_file_rsa) -passin "pass:$(test_ca_pwd_rsa)" -s… 99 …$(OPENSSL) req -x509 -new -nodes -key $(test_ca_key_file_rsa) -passin "pass:$(test_ca_pwd_rsa)" -s… 102 test_ca_key_file_rsa_alt = test-ca-alt.key 105 …al 17 -config $(test_ca_config_file) -extensions dns_alt_names -days 3650 -key rsa_pkcs1_1024_clea… 124 …$(OPENSSL) req -new -subj '/CN=etcd' -config $(test_ca_config_file) -key rsa_pkcs1_1024_clear.pem … [all …]
|
/mbedtls-3.7.0/programs/psa/ |
D | key_ladder_demo.sh | 10 create a master key, derive a key from it and use that derived key to 18 if [ -e master.key ]; then 23 "$program" generate master=master.key 29 "$program" wrap master=master.key label=hello label=world \ 34 "$program" unwrap master=master.key label=hello label=world \ 41 …"$program" unwrap master=master.key input=hello_world.wrap output=hellow_orld.txt label=hellow lab… 45 "$program" save master=master.key label=hello \ 46 input=hello_world.wrap output=hello.key 48 "$program" unwrap master=hello.key label=world \
|
/mbedtls-3.7.0/programs/pkey/ |
D | key_app_writer.c | 92 static int write_public_key(mbedtls_pk_context *key, const char *output_file) in write_public_key() argument 104 if ((ret = mbedtls_pk_write_pubkey_pem(key, output_buf, 16000)) != 0) { in write_public_key() 112 if ((ret = mbedtls_pk_write_pubkey_der(key, output_buf, 16000)) < 0) { in write_public_key() 134 static int write_private_key(mbedtls_pk_context *key, const char *output_file) in write_private_key() argument 146 if ((ret = mbedtls_pk_write_key_pem(key, output_buf, 16000)) != 0) { in write_private_key() 154 if ((ret = mbedtls_pk_write_key_der(key, output_buf, 16000)) < 0) { in write_private_key() 255 mbedtls_pk_context key; in main() local 266 mbedtls_pk_init(&key); in main() 366 ret = mbedtls_pk_parse_keyfile(&key, opt.filename, NULL, in main() 382 if (mbedtls_pk_get_type(&key) == MBEDTLS_PK_RSA) { in main() [all …]
|