Home
last modified time | relevance | path

Searched full:key (Results 1 – 25 of 683) sorted by relevance

12345678910>>...28

/optee_os/core/drivers/crypto/caam/include/
H A Dcaam_key.h13 * CAAM Key types
16 CAAM_KEY_PLAIN_TEXT = 0, /* Plain text key or red key */
17 CAAM_KEY_BLACK_ECB, /* Black key AES-ECB encrypted */
18 CAAM_KEY_BLACK_CCM, /* Black key AES-CCM encrypted */
23 * CAAM key structure
26 struct caambuf buf; /* Key buffer */
27 enum caam_key_type key_type; /* CAAM Key type */
28 size_t sec_size; /* Security key size */
29 bool is_blob; /* Shows if the key is in blob format */
33 * Returns the default key type for CAAM key generation.
[all …]
/optee_os/core/drivers/crypto/caam/
H A Dcaam_key.c22 * CAAM Key magic number.
23 * When the first 32 bits of a key buffer are equal to this value, the buffer
24 * is a serialized CAAM key structure.
29 * Because the CAAM driver relies on this magic number to determine if the key
31 * key could feature the magic number. That's unlikely but still possible.
34 * security concerns. Forging and trying to make a plain text key look like a
35 * black key, won't do much. If the key is forged to look like an ECB Black
36 * key, the singing operation will output a corrupted result. If the key is
37 * forged to look like a CCM Black key, the import key will fail (because the
41 #define BLOB_BKEK_SIZE 32 /* Blob key encryption key size */
[all …]
/optee_os/lib/libmbedtls/mbedtls/library/
H A Dpsa_crypto_slot_management.h16 /** Range of volatile key identifiers.
19 * range of key identifiers are reserved for volatile key identifiers.
21 * If \c id is a a volatile key identifier, #PSA_KEY_ID_VOLATILE_MIN - \c id
22 * indicates the key slot containing the volatile key definition. See
26 /** The minimum value for a volatile key identifier.
30 /** The maximum value for a volatile key identifier.
39 /** Test whether a key identifier is a volatile key identifier.
41 * \param key_id Key identifier to test.
44 * The key identifier is a volatile key identifier.
46 * The key identifier is not a volatile key identifier.
[all …]
/optee_os/core/lib/libtomcrypt/src/pk/ecc/
H A Decc_set_curve_internal.c15 static void s_ecc_oid_lookup(ecc_key *key) in s_ecc_oid_lookup() argument
20 key->dp.oidlen = 0; in s_ecc_oid_lookup()
23 if (s_ecc_cmp_hex_bn(curve->prime, key->dp.prime, bn) != 1) continue; in s_ecc_oid_lookup()
24 if (s_ecc_cmp_hex_bn(curve->order, key->dp.order, bn) != 1) continue; in s_ecc_oid_lookup()
25 if (s_ecc_cmp_hex_bn(curve->A, key->dp.A, bn) != 1) continue; in s_ecc_oid_lookup()
26 if (s_ecc_cmp_hex_bn(curve->B, key->dp.B, bn) != 1) continue; in s_ecc_oid_lookup()
27 if (s_ecc_cmp_hex_bn(curve->Gx, key->dp.base.x, bn) != 1) continue; in s_ecc_oid_lookup()
28 if (s_ecc_cmp_hex_bn(curve->Gy, key->dp.base.y, bn) != 1) continue; in s_ecc_oid_lookup()
29 if (key->dp.cofactor != curve->cofactor) continue; in s_ecc_oid_lookup()
34 key->dp.oidlen = 16; /* size of key->dp.oid */ in s_ecc_oid_lookup()
[all …]
H A Decc_make_key.c14 Make a new ECC key
17 @param keysize The keysize for the new key (in octets from 20 to 65 bytes)
18 @param key [out] Destination of the newly created key
21 int ecc_make_key(prng_state *prng, int wprng, int keysize, ecc_key *key) in ecc_make_key() argument
25 if ((err = ecc_set_curve_by_size(keysize, key)) != CRYPT_OK) { return err; } in ecc_make_key()
26 if ((err = ecc_generate_key(prng, wprng, key)) != CRYPT_OK) { return err; } in ecc_make_key()
30 int ecc_make_key_ex(prng_state *prng, int wprng, ecc_key *key, const ltc_ecc_curve *cu) in ecc_make_key_ex() argument
33 if ((err = ecc_set_curve(cu, key)) != CRYPT_OK) { return err; } in ecc_make_key_ex()
34 if ((err = ecc_generate_key(prng, wprng, key)) != CRYPT_OK) { return err; } in ecc_make_key_ex()
38 int ecc_generate_key(prng_state *prng, int wprng, ecc_key *key) in ecc_generate_key() argument
[all …]
H A Decc_set_curve.c8 int ecc_set_curve(const ltc_ecc_curve *cu, ecc_key *key) in ecc_set_curve() argument
12 LTC_ARGCHK(key != NULL); in ecc_set_curve()
15 if ((err = mp_init_multi(&key->dp.prime, &key->dp.order, &key->dp.A, &key->dp.B, in ecc_set_curve()
16 &key->dp.base.x, &key->dp.base.y, &key->dp.base.z, in ecc_set_curve()
17 &key->pubkey.x, &key->pubkey.y, &key->pubkey.z, &key->k, in ecc_set_curve()
23 if ((err = mp_read_radix(key->dp.prime, cu->prime, 16)) != CRYPT_OK) { goto error; } in ecc_set_curve()
24 if ((err = mp_read_radix(key->dp.order, cu->order, 16)) != CRYPT_OK) { goto error; } in ecc_set_curve()
25 if ((err = mp_read_radix(key->dp.A, cu->A, 16)) != CRYPT_OK) { goto error; } in ecc_set_curve()
26 if ((err = mp_read_radix(key->dp.B, cu->B, 16)) != CRYPT_OK) { goto error; } in ecc_set_curve()
27 if ((err = mp_read_radix(key->dp.base.x, cu->Gx, 16)) != CRYPT_OK) { goto error; } in ecc_set_curve()
[all …]
H A Decc_set_key.c8 int ecc_set_key(const unsigned char *in, unsigned long inlen, int type, ecc_key *key) in ecc_set_key() argument
13 LTC_ARGCHK(key != NULL); in ecc_set_key()
17 prime = key->dp.prime; in ecc_set_key()
18 a = key->dp.A; in ecc_set_key()
19 b = key->dp.B; in ecc_set_key()
22 /* load private key */ in ecc_set_key()
23 if ((err = mp_read_unsigned_bin(key->k, (unsigned char *)in, inlen)) != CRYPT_OK) { in ecc_set_key()
26 if (mp_iszero(key->k) || (mp_cmp(key->k, key->dp.order) != LTC_MP_LT)) { in ecc_set_key()
30 /* compute public key */ in ecc_set_key()
31 …if ((err = ltc_mp.ecc_ptmul(key->k, &key->dp.base, &key->pubkey, a, prime, 1)) != CRYPT_OK) … in ecc_set_key()
[all …]
/optee_os/core/lib/libtomcrypt/src/pk/rsa/
H A Drsa_key.c7 Free an RSA key, Tom St Denis
8 Basic operations on an RSA key, Steffen Jaeckel
64 This shrinks the allocated memory of a RSA key
68 was once allocated when the key was created/populated.
74 @param key The RSA key to shrink
76 void rsa_shrink_key(rsa_key *key) in rsa_shrink_key() argument
78 LTC_ARGCHKVD(key != NULL); in rsa_shrink_key()
79 …s_mpi_shrink_multi(&key->e, &key->d, &key->N, &key->dQ, &key->dP, &key->qP, &key->p, &key->q, NULL… in rsa_shrink_key()
83 Init an RSA key
84 @param key The RSA key to free
[all …]
H A Drsa_set.c9 Import RSA key from raw numbers
15 @param d RSA's d (only private key, NULL for public key)
17 @param key [out] the destination for the imported key
23 rsa_key *key) in rsa_set_key() argument
27 LTC_ARGCHK(key != NULL); in rsa_set_key()
32 if ((err = rsa_init(key)) != CRYPT_OK) return err; in rsa_set_key()
34 …if ((err = mp_read_unsigned_bin(key->N , (unsigned char *)N , Nlen)) != CRYPT_OK) { goto LBL_ER… in rsa_set_key()
35 …if ((err = mp_read_unsigned_bin(key->e , (unsigned char *)e , elen)) != CRYPT_OK) { goto LBL_ER… in rsa_set_key()
37 …if ((err = mp_read_unsigned_bin(key->d , (unsigned char *)d , dlen)) != CRYPT_OK) { goto LBL_ERR; } in rsa_set_key()
38 key->type = PK_PRIVATE; in rsa_set_key()
[all …]
H A Drsa_import.c7 Import a PKCS RSA key, Tom St Denis
16 The `key` passed into this function has to be already initialized and will
21 @param key [out] Destination for newly imported key
24 int rsa_import_pkcs1(const unsigned char *in, unsigned long inlen, rsa_key *key) in rsa_import_pkcs1() argument
34 * so we try to decode as a public key in rsa_import_pkcs1()
37 LTC_ASN1_INTEGER, 1UL, key->N, in rsa_import_pkcs1()
38 LTC_ASN1_INTEGER, 1UL, key->e, in rsa_import_pkcs1()
40 key->type = PK_PUBLIC; in rsa_import_pkcs1()
49 /* it's a private key */ in rsa_import_pkcs1()
52 LTC_ASN1_INTEGER, 1UL, key->N, in rsa_import_pkcs1()
[all …]
H A Drsa_exptmod.c20 @param key The RSA key to use
25 const rsa_key *key) in rsa_exptmod() argument
37 LTC_ARGCHK(key != NULL); in rsa_exptmod()
39 /* is the key of the right type for the operation? */ in rsa_exptmod()
40 if (which == PK_PRIVATE && (key->type != PK_PRIVATE)) { in rsa_exptmod()
61 if (mp_cmp(key->N, tmp) == LTC_MP_LT) { in rsa_exptmod()
66 /* are we using the private exponent and is the key optimized? */ in rsa_exptmod()
70 err = mp_rand(rnd, mp_get_digit_count(key->N)); in rsa_exptmod()
76 err = mp_invmod(rnd, key->N, rndi); in rsa_exptmod()
82 err = mp_exptmod( rnd, key->e, key->N, rnd); in rsa_exptmod()
[all …]
/optee_os/core/lib/libtomcrypt/src/pk/dh/
H A Ddh_set.c9 Import DH key parts p and g from raw numbers
15 @param key [out] the destination for the imported key
20 dh_key *key) in dh_set_pg() argument
24 LTC_ARGCHK(key != NULL); in dh_set_pg()
29 if ((err = mp_init_multi(&key->x, &key->y, &key->base, &key->prime, LTC_NULL)) != CRYPT_OK) { in dh_set_pg()
33 …if ((err = mp_read_unsigned_bin(key->base, (unsigned char*)g, glen)) != CRYPT_OK) { goto LBL_E… in dh_set_pg()
34 …if ((err = mp_read_unsigned_bin(key->prime, (unsigned char*)p, plen)) != CRYPT_OK) { goto LBL_ERR… in dh_set_pg()
39 dh_free(key); in dh_set_pg()
44 Import DH key parts p and g from built-in DH groups
47 @param key [out] Where the newly created DH key will be stored
[all …]
H A Ddh_import.c9 Import a DH key from a binary packet
12 @param key [out] Where to import the key to
15 int dh_import(const unsigned char *in, unsigned long inlen, dh_key *key) in dh_import() argument
22 LTC_ARGCHK(key != NULL); in dh_import()
25 if ((err = mp_init_multi(&key->x, &key->y, &key->base, &key->prime, LTC_NULL)) != CRYPT_OK) { in dh_import()
29 /* find out what type of key it is */ in dh_import()
40 key->type = PK_PRIVATE; in dh_import()
44 LTC_ASN1_INTEGER, 1UL, key->prime, in dh_import()
45 LTC_ASN1_INTEGER, 1UL, key->base, in dh_import()
46 LTC_ASN1_INTEGER, 1UL, key->x, in dh_import()
[all …]
H A Ddh_make_key.c34 * Make a DH key [private key pair]
37 * @param keysize The key size (octets) desired of the private key
38 * @param q If not null, then the private key is in the range
40 * @param xbits If not 0, then the private key has 'xbits' bits
41 * @note The private key must always be less than p-1
42 * @param key [in/out] Where the newly created DH key will be stored
43 * g and p are provided as input in the key
49 int dh_make_key(prng_state *prng, int wprng, void *q, int xbits, dh_key *key) in dh_make_key() argument
52 int key_size = 0; /* max key size, in bytes */ in dh_make_key()
53 int key_size_p = 0; /* key size of p */ in dh_make_key()
[all …]
/optee_os/core/lib/libtomcrypt/src/pk/dsa/
H A Ddsa_set.c16 @param key [out] the destination for the imported key
22 dsa_key *key) in dsa_set_pqg() argument
29 LTC_ARGCHK(key != NULL); in dsa_set_pqg()
32 /* init key */ in dsa_set_pqg()
33 err = mp_init_multi(&key->p, &key->g, &key->q, &key->x, &key->y, LTC_NULL); in dsa_set_pqg()
36 … if ((err = mp_read_unsigned_bin(key->p, (unsigned char *)p , plen)) != CRYPT_OK) { goto LBL_ERR; } in dsa_set_pqg()
37 … if ((err = mp_read_unsigned_bin(key->g, (unsigned char *)g , glen)) != CRYPT_OK) { goto LBL_ERR; } in dsa_set_pqg()
38 … if ((err = mp_read_unsigned_bin(key->q, (unsigned char *)q , qlen)) != CRYPT_OK) { goto LBL_ERR; } in dsa_set_pqg()
40 key->qord = mp_unsigned_bin_size(key->q); in dsa_set_pqg()
43 … if ((err = dsa_int_validate_pqg(key, &stat)) != CRYPT_OK) { goto LBL_ERR; } in dsa_set_pqg()
[all …]
H A Ddsa_import.c7 DSA implementation, import a DSA key, Tom St Denis
13 Import a DSA key
16 @param key [out] Where to store the imported key
19 int dsa_import(const unsigned char *in, unsigned long inlen, dsa_key *key) in dsa_import() argument
27 LTC_ARGCHK(key != NULL); in dsa_import()
30 /* init key */ in dsa_import()
31 if (mp_init_multi(&key->p, &key->g, &key->q, &key->x, &key->y, LTC_NULL) != CRYPT_OK) { in dsa_import()
40 /* private key */ in dsa_import()
44 LTC_ASN1_INTEGER, 1UL, key->g, in dsa_import()
45 LTC_ASN1_INTEGER, 1UL, key->p, in dsa_import()
[all …]
H A Ddsa_verify_key.c7 DSA implementation, verify a key, Tom St Denis
13 Validate a DSA key
19 @param key The key to validate
23 int dsa_verify_key(const dsa_key *key, int *stat) in dsa_verify_key() argument
27 err = dsa_int_validate_primes(key, stat); in dsa_verify_key()
30 err = dsa_int_validate_pqg(key, stat); in dsa_verify_key()
33 return dsa_int_validate_xy(key, stat); in dsa_verify_key()
40 @param key The key to validate
44 int dsa_int_validate_pqg(const dsa_key *key, int *stat) in dsa_int_validate_pqg() argument
49 LTC_ARGCHK(key != NULL); in dsa_int_validate_pqg()
[all …]
H A Ddsa_export.c7 DSA implementation, export key, Tom St Denis
13 Export a DSA key to a binary packet
16 @param type The type of key to export (PK_PRIVATE or PK_PUBLIC)
17 @param key The key to export
20 int dsa_export(unsigned char *out, unsigned long *outlen, int type, const dsa_key *key) in dsa_export() argument
28 LTC_ARGCHK(key != NULL); in dsa_export()
33 if (type == PK_PRIVATE && key->type != PK_PRIVATE) { in dsa_export()
41 LTC_ASN1_INTEGER, 1UL, key->p, in dsa_export()
42 LTC_ASN1_INTEGER, 1UL, key->q, in dsa_export()
43 LTC_ASN1_INTEGER, 1UL, key->g, in dsa_export()
[all …]
/optee_os/core/drivers/crypto/crypto_api/acipher/
H A Drsa.c17 TEE_Result crypto_acipher_alloc_rsa_keypair(struct rsa_keypair *key, in crypto_acipher_alloc_rsa_keypair() argument
24 if (!key || !size_bits) { in crypto_acipher_alloc_rsa_keypair()
25 CRYPTO_TRACE("Parameters error (key @%p) (size %zu bits)", key, in crypto_acipher_alloc_rsa_keypair()
32 ret = rsa->alloc_keypair(key, size_bits); in crypto_acipher_alloc_rsa_keypair()
39 TEE_Result crypto_acipher_alloc_rsa_public_key(struct rsa_public_key *key, in crypto_acipher_alloc_rsa_public_key() argument
45 if (!key || !size_bits) { in crypto_acipher_alloc_rsa_public_key()
46 CRYPTO_TRACE("Parameters error (key @%p) (size %zu bits)", key, in crypto_acipher_alloc_rsa_public_key()
53 ret = rsa->alloc_publickey(key, size_bits); in crypto_acipher_alloc_rsa_public_key()
55 CRYPTO_TRACE("RSA Public Key (%zu bits) alloc ret = 0x%" PRIx32, in crypto_acipher_alloc_rsa_public_key()
60 void crypto_acipher_free_rsa_public_key(struct rsa_public_key *key) in crypto_acipher_free_rsa_public_key() argument
[all …]
H A Decc.c13 * Returns the key size in bytes for the given ECC curve
42 * Returns the key size in bits for the given ECC curve
103 * Free an ECC public key
105 * @key Public Key
107 static void ecc_free_public_key(struct ecc_public_key *key) in ecc_free_public_key() argument
111 if (key) { in ecc_free_public_key()
114 CRYPTO_TRACE("ECC Public Key free"); in ecc_free_public_key()
115 ecc->free_publickey(key); in ecc_free_public_key()
123 * @key Keypair
124 * @size_bits Key size in bits
[all …]
/optee_os/lib/libmbedtls/mbedtls/include/psa/
H A Dcrypto_types.h64 /** \defgroup crypto_types Key and algorithm types
68 /** \brief Encoding of a key type.
73 * \note Values of this type are encoded in the persistent key store.
85 * The curve identifier is required to create an ECC key using the
92 * \note Values of this type are encoded in the persistent key store.
104 * The group identifier is required to create a Diffie-Hellman key using the
111 * \note Values of this type are encoded in the persistent key store.
123 * For algorithms that can be applied to multiple key types, this type
124 * does not encode the key type. For example, for symmetric ciphers
129 * \note Values of this type are encoded in the persistent key store.
[all …]
/optee_os/core/drivers/crypto/versal/
H A Drsa.c31 struct rsa_public_key *p = rsa_data->key.key; in do_encrypt()
35 struct versal_mbox_mem key = { }; in do_encrypt() local
44 rsa_data->key.key, in do_encrypt()
54 rsa_data->key.key, in do_encrypt()
63 return sw_crypto_acipher_rsanopad_encrypt(rsa_data->key.key, in do_encrypt()
70 assert(rsa_data->key.n_size != 128); in do_encrypt()
77 versal_mbox_alloc(RSA_MAX_MOD_LEN + RSA_MAX_PUB_EXP_LEN, NULL, &key); in do_encrypt()
78 crypto_bignum_bn2bin_pad(rsa_data->key.n_size, p->n, key.buf); in do_encrypt()
80 p->e, (uint8_t *)key.buf + RSA_MAX_MOD_LEN); in do_encrypt()
88 cmd->key_len = rsa_data->key.n_size; in do_encrypt()
[all …]
/optee_os/core/drivers/crypto/caam/acipher/
H A Dcaam_dh.c34 struct caamkey x; /* Private key */
35 struct caambuf y; /* Public key */
41 * @key DH keypair
43 static void do_keypair_free(struct caam_dh_keypair *key) in do_keypair_free() argument
45 caam_free_buf(&key->g); in do_keypair_free()
46 caam_free_buf(&key->p); in do_keypair_free()
47 caam_key_free(&key->x); in do_keypair_free()
48 caam_free_buf(&key->y); in do_keypair_free()
52 * Convert Crypto DH Key p and g bignumbers to local buffers
56 * @inkey Input key in TEE Crypto format
[all …]
/optee_os/core/lib/libtomcrypt/src/pk/ec25519/
H A Dec25519_export.c7 Generic export of a Curve/Ed25519 key to a binary packet, Steffen Jaeckel
13 Generic export of a Curve/Ed25519 key to a binary packet
14 @param out [out] The destination for the key
15 @param outlen [in/out] The max size and resulting size of the Ed25519 key
16 @param type Which type of key (PK_PRIVATE, PK_PUBLIC|PK_STD or PK_PUBLIC)
17 @param key The key you wish to export
22 const curve25519_key *key) in ec25519_export() argument
33 LTC_ARGCHK(key != NULL); in ec25519_export()
39 if(key->type != PK_PRIVATE) return CRYPT_PK_INVALID_TYPE; in ec25519_export()
42 if ((err = pk_get_oid(key->algo, &OID)) != CRYPT_OK) { in ec25519_export()
[all …]
/optee_os/core/drivers/crypto/se050/core/
H A Drsa.c41 static bool rsa_keypair_has_crt(struct rsa_keypair *key) in rsa_keypair_has_crt() argument
43 if (key->p && crypto_bignum_num_bytes(key->p) && in rsa_keypair_has_crt()
44 key->q && crypto_bignum_num_bytes(key->q) && in rsa_keypair_has_crt()
45 key->qp && crypto_bignum_num_bytes(key->qp) && in rsa_keypair_has_crt()
46 key->dp && crypto_bignum_num_bytes(key->dp) && in rsa_keypair_has_crt()
47 key->dq && crypto_bignum_num_bytes(key->dq)) in rsa_keypair_has_crt()
53 static bool keypair_supported(struct rsa_keypair *key, sss_cipher_type_t ctype) in keypair_supported() argument
55 if (se050_rsa_keypair_from_nvm(key)) in keypair_supported()
59 return rsa_keypair_has_crt(key); in keypair_supported()
132 struct rsa_public_key *key) in se050_inject_public_key() argument
[all …]

12345678910>>...28