| /optee_os/core/drivers/crypto/crypto_api/cipher/ |
| H A D | cipher.c | 5 * Crypto Cipher interface implementation to enable HW driver. 30 * Free cipher context 36 struct crypto_cipher *cipher = to_cipher_ctx(ctx); in cipher_free_ctx() local 38 if (cipher->op && cipher->op->free_ctx) in cipher_free_ctx() 39 cipher->op->free_ctx(cipher->ctx); in cipher_free_ctx() 41 free(cipher); in cipher_free_ctx() 45 * Copy cipher context 61 * Initialization of the cipher operation 78 struct crypto_cipher *cipher = to_cipher_ctx(ctx); in cipher_init() local 88 if (cipher->op && cipher->op->init) { in cipher_init() [all …]
|
| /optee_os/lib/libmbedtls/mbedtls/include/mbedtls/ |
| H A D | cipher.h | 2 * \file cipher.h 4 * \brief This file contains an abstraction interface for use with the cipher 6 * the available cipher operations. 52 #define MBEDTLS_CIPHER_VARIABLE_IV_LEN 0x01 /**< Cipher accepts IVs of variable length. */ 53 #define MBEDTLS_CIPHER_VARIABLE_KEY_LEN 0x02 /**< Cipher accepts keys of variable length. */ 60 * \brief Supported cipher types. 67 MBEDTLS_CIPHER_ID_NONE = 0, /**< Placeholder to mark the end of cipher ID lists. */ 68 MBEDTLS_CIPHER_ID_NULL, /**< The identity cipher, treated as a stream cipher. */ 69 MBEDTLS_CIPHER_ID_AES, /**< The AES cipher. */ 70 MBEDTLS_CIPHER_ID_DES, /**< The DES cipher. \warning DES is considered weak. */ [all …]
|
| H A D | cmac.h | 6 * The Cipher-based Message Authentication Code (CMAC) Mode for 21 #include "mbedtls/cipher.h" 38 /** The longest block supported by the cipher module. 41 * For the maximum block size of a cipher supported by the CMAC module, 43 * For the maximum block size of a cipher supported by the cipher module, 49 * is sufficient for any cipher, but the name is defined in cmac.h for 77 * Must be called with an initialized cipher context. 79 * \param ctx The cipher context used for the CMAC operation, initialized 84 * \return A cipher-specific error code on failure. 92 * It must be called with an initialized cipher context. [all …]
|
| /optee_os/core/lib/libtomcrypt/src/mac/xcbc/ |
| H A D | xcbc_init.c | 14 @param cipher Index of cipher to use 19 int xcbc_init(xcbc_state *xcbc, int cipher, const unsigned char *key, unsigned long keylen) in xcbc_init() argument 29 if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { in xcbc_init() 34 if (cipher_descriptor[cipher]->block_length % sizeof(LTC_FAST_TYPE)) { in xcbc_init() 45 if (keylen < 2UL*cipher_descriptor[cipher]->block_length) { in xcbc_init() 49 k1 = keylen - 2*cipher_descriptor[cipher]->block_length; in xcbc_init() 51 XMEMCPY(xcbc->K[1], key+k1, cipher_descriptor[cipher]->block_length); in xcbc_init() 52 …XMEMCPY(xcbc->K[2], key+k1 + cipher_descriptor[cipher]->block_length, cipher_descriptor[cipher]->b… in xcbc_init() 55 k1 = cipher_descriptor[cipher]->block_length; in xcbc_init() 63 if ((err = cipher_descriptor[cipher]->setup(key, keylen, 0, skey)) != CRYPT_OK) { in xcbc_init() [all …]
|
| /optee_os/core/drivers/crypto/crypto_api/include/ |
| H A D | drvcrypt_cipher.h | 5 * Cipher interface calling the crypto driver. 14 * Cipher operation context 17 struct crypto_cipher_ctx cipher_ctx; /* Crypto cipher API context */ 18 void *ctx; /* Cipher context */ 23 * Cipher algorithm initialization data 34 * Cipher algorithm update data 40 struct drvcrypt_buf src; /* Buffer source (message or cipher) */ 41 struct drvcrypt_buf dst; /* Buffer dest (message or cipher) */ 45 * Crypto library cipher driver operations 52 /* Initialize the cipher operation */ [all …]
|
| /optee_os/core/lib/libtomcrypt/src/modes/f8/ |
| H A D | f8_start.c | 15 @param cipher The index of the cipher desired 21 @param num_rounds Number of rounds in the cipher desired (0 for default) 25 int f8_start( int cipher, const unsigned char *IV, in f8_start() argument 38 if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { in f8_start() 43 if (cipher_descriptor[cipher]->block_length % sizeof(LTC_FAST_TYPE)) { in f8_start() 50 f8->cipher = cipher; in f8_start() 51 f8->blocklen = cipher_descriptor[cipher]->block_length; in f8_start() 67 if ((err = cipher_descriptor[cipher]->setup(tkey, keylen, num_rounds, &f8->key)) != CRYPT_OK) { in f8_start() 72 if ((err = cipher_descriptor[f8->cipher]->ecb_encrypt(IV, f8->MIV, &f8->key)) != CRYPT_OK) { in f8_start() 73 cipher_descriptor[f8->cipher]->done(&f8->key); in f8_start() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/modes/ctr/ |
| H A D | ctr_start.c | 15 @param cipher The index of the cipher desired 19 @param num_rounds Number of rounds in the cipher desired (0 for default) 24 int ctr_start( int cipher, in ctr_start() argument 37 if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { in ctr_start() 42 ctr->ctrlen = (ctr_mode & 255) ? (ctr_mode & 255) : cipher_descriptor[cipher]->block_length; in ctr_start() 43 if (ctr->ctrlen > cipher_descriptor[cipher]->block_length) { in ctr_start() 48 ctr->ctrlen = cipher_descriptor[cipher]->block_length - ctr->ctrlen; in ctr_start() 51 /* setup cipher */ in ctr_start() 52 if ((err = cipher_descriptor[cipher]->setup(key, keylen, num_rounds, &ctr->key)) != CRYPT_OK) { in ctr_start() 57 ctr->blocklen = cipher_descriptor[cipher]->block_length; in ctr_start() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/modes/cfb/ |
| H A D | cfb_start.c | 15 @param cipher The index of the cipher desired 19 @param num_rounds Number of rounds in the cipher desired (0 for default) 23 int cfb_start(int cipher, const unsigned char *IV, const unsigned char *key, in cfb_start() argument 32 if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { in cfb_start() 38 cfb->cipher = cipher; in cfb_start() 39 cfb->blocklen = cipher_descriptor[cipher]->block_length; in cfb_start() 44 /* init the cipher */ in cfb_start() 45 if ((err = cipher_descriptor[cipher]->setup(key, keylen, num_rounds, &cfb->key)) != CRYPT_OK) { in cfb_start() 51 return cipher_descriptor[cfb->cipher]->ecb_encrypt(cfb->IV, cfb->IV, &cfb->key); in cfb_start()
|
| /optee_os/core/lib/libtomcrypt/src/mac/f9/ |
| H A D | f9_init.c | 14 @param cipher Index of cipher to use 19 int f9_init(f9_state *f9, int cipher, const unsigned char *key, unsigned long keylen) in f9_init() argument 27 if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { in f9_init() 32 if (cipher_descriptor[cipher]->block_length % sizeof(LTC_FAST_TYPE)) { in f9_init() 37 if ((err = cipher_descriptor[cipher]->setup(key, keylen, 0, &f9->key)) != CRYPT_OK) { in f9_init() 47 zeromem(f9->IV, cipher_descriptor[cipher]->block_length); in f9_init() 48 zeromem(f9->ACC, cipher_descriptor[cipher]->block_length); in f9_init() 49 f9->blocksize = cipher_descriptor[cipher]->block_length; in f9_init() 50 f9->cipher = cipher; in f9_init()
|
| H A D | f9_memory.c | 13 @param cipher Index of cipher to use 22 int f9_memory(int cipher, in f9_memory() argument 30 /* is the cipher valid? */ in f9_memory() 31 if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { in f9_memory() 36 if (cipher_descriptor[cipher]->f9_memory != NULL) { in f9_memory() 37 return cipher_descriptor[cipher]->f9_memory(key, keylen, in, inlen, out, outlen); in f9_memory() 45 if ((err = f9_init(f9, cipher, key, keylen)) != CRYPT_OK) { in f9_memory()
|
| /optee_os/lib/libmbedtls/mbedtls/library/ |
| H A D | psa_crypto_cipher.h | 2 * PSA cipher driver entry points and associated auxiliary functions 12 #include <mbedtls/cipher.h> 15 /** Get Mbed TLS cipher information given the cipher algorithm PSA identifier 16 * as well as the PSA type and size of the key to be used with the cipher 19 * \param[in] alg PSA cipher algorithm identifier 23 * \param[out] mode Mbed TLS cipher mode 24 * \param[out] cipher_id Mbed TLS cipher algorithm identifier 28 * \c PSA_ERROR_NOT_SUPPORTED is returned if the cipher algorithm is not 37 /** Get Mbed TLS cipher information given the cipher algorithm PSA identifier 38 * as well as the PSA type and size of the key to be used with the cipher [all …]
|
| /optee_os/core/lib/libtomcrypt/src/modes/cbc/ |
| H A D | cbc_start.c | 14 @param cipher The index of the cipher desired 18 @param num_rounds Number of rounds in the cipher desired (0 for default) 22 int cbc_start(int cipher, const unsigned char *IV, const unsigned char *key, in cbc_start() argument 32 if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { in cbc_start() 36 /* setup cipher */ in cbc_start() 37 if ((err = cipher_descriptor[cipher]->setup(key, keylen, num_rounds, &cbc->key)) != CRYPT_OK) { in cbc_start() 42 cbc->blocklen = cipher_descriptor[cipher]->block_length; in cbc_start() 43 cbc->cipher = cipher; in cbc_start()
|
| /optee_os/core/lib/libtomcrypt/src/modes/ofb/ |
| H A D | ofb_start.c | 15 @param cipher The index of the cipher desired 19 @param num_rounds Number of rounds in the cipher desired (0 for default) 23 int ofb_start(int cipher, const unsigned char *IV, const unsigned char *key, in ofb_start() argument 32 if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { in ofb_start() 37 ofb->cipher = cipher; in ofb_start() 38 ofb->blocklen = cipher_descriptor[cipher]->block_length; in ofb_start() 43 /* init the cipher */ in ofb_start() 45 return cipher_descriptor[cipher]->setup(key, keylen, num_rounds, &ofb->key); in ofb_start()
|
| /optee_os/core/lib/libtomcrypt/src/prngs/ |
| H A D | yarrow.c | 37 /* these are the default hash/cipher combo used */ in yarrow_start() 40 prng->u.yarrow.cipher = register_cipher(&rijndael_enc_desc); in yarrow_start() 42 prng->u.yarrow.cipher = register_cipher(&aes_enc_desc); in yarrow_start() 44 prng->u.yarrow.cipher = register_cipher(&rijndael_desc); in yarrow_start() 46 prng->u.yarrow.cipher = register_cipher(&aes_desc); in yarrow_start() 49 prng->u.yarrow.cipher = register_cipher(&blowfish_desc); in yarrow_start() 51 prng->u.yarrow.cipher = register_cipher(&twofish_desc); in yarrow_start() 53 prng->u.yarrow.cipher = register_cipher(&rc6_desc); in yarrow_start() 55 prng->u.yarrow.cipher = register_cipher(&rc5_desc); in yarrow_start() 57 prng->u.yarrow.cipher = register_cipher(&saferp_desc); in yarrow_start() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/modes/ecb/ |
| H A D | ecb_start.c | 15 @param cipher The index of the cipher desired 18 @param num_rounds Number of rounds in the cipher desired (0 for default) 22 int ecb_start(int cipher, const unsigned char *key, int keylen, int num_rounds, symmetric_ECB *ecb) in ecb_start() argument 28 if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { in ecb_start() 31 ecb->cipher = cipher; in ecb_start() 32 ecb->blocklen = cipher_descriptor[cipher]->block_length; in ecb_start() 33 return cipher_descriptor[cipher]->setup(key, keylen, num_rounds, &ecb->key); in ecb_start()
|
| H A D | ecb_encrypt.c | 16 @param len The number of octets to process (must be multiple of the cipher block size) 26 if ((err = cipher_is_valid(ecb->cipher)) != CRYPT_OK) { in ecb_encrypt() 29 if (len % cipher_descriptor[ecb->cipher]->block_length) { in ecb_encrypt() 34 if (cipher_descriptor[ecb->cipher]->accel_ecb_encrypt != NULL) { in ecb_encrypt() 35 …return cipher_descriptor[ecb->cipher]->accel_ecb_encrypt(pt, ct, len / cipher_descriptor[ecb->ciph… in ecb_encrypt() 38 if ((err = cipher_descriptor[ecb->cipher]->ecb_encrypt(pt, ct, &ecb->key)) != CRYPT_OK) { in ecb_encrypt() 41 pt += cipher_descriptor[ecb->cipher]->block_length; in ecb_encrypt() 42 ct += cipher_descriptor[ecb->cipher]->block_length; in ecb_encrypt() 43 len -= cipher_descriptor[ecb->cipher]->block_length; in ecb_encrypt()
|
| H A D | ecb_decrypt.c | 16 @param len The number of octets to process (must be multiple of the cipher block size) 26 if ((err = cipher_is_valid(ecb->cipher)) != CRYPT_OK) { in ecb_decrypt() 29 if (len % cipher_descriptor[ecb->cipher]->block_length) { in ecb_decrypt() 34 if (cipher_descriptor[ecb->cipher]->accel_ecb_decrypt != NULL) { in ecb_decrypt() 35 …return cipher_descriptor[ecb->cipher]->accel_ecb_decrypt(ct, pt, len / cipher_descriptor[ecb->ciph… in ecb_decrypt() 38 if ((err = cipher_descriptor[ecb->cipher]->ecb_decrypt(ct, pt, &ecb->key)) != CRYPT_OK) { in ecb_decrypt() 41 pt += cipher_descriptor[ecb->cipher]->block_length; in ecb_decrypt() 42 ct += cipher_descriptor[ecb->cipher]->block_length; in ecb_decrypt() 43 len -= cipher_descriptor[ecb->cipher]->block_length; in ecb_decrypt()
|
| /optee_os/core/lib/libtomcrypt/src/modes/xts/ |
| H A D | xts_init.c | 12 @param cipher The index of the cipher to use 16 @param num_rounds The number of rounds for the cipher (0 == default) 20 int xts_start(int cipher, const unsigned char *key1, const unsigned char *key2, unsigned long keyle… in xts_start() argument 31 if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { in xts_start() 35 if (cipher_descriptor[cipher]->block_length != 16) { in xts_start() 40 if ((err = cipher_descriptor[cipher]->setup(key1, keylen, num_rounds, &xts->key1)) != CRYPT_OK) { in xts_start() 43 if ((err = cipher_descriptor[cipher]->setup(key2, keylen, num_rounds, &xts->key2)) != CRYPT_OK) { in xts_start() 46 xts->cipher = cipher; in xts_start()
|
| /optee_os/core/lib/libtomcrypt/src/modes/lrw/ |
| H A D | lrw_start.c | 14 @param cipher The cipher desired, must be a 128-bit block cipher 16 @param key The cipher key 17 @param keylen The length of the cipher key in octets 19 @param num_rounds The number of rounds for the cipher (0 == default) 23 int lrw_start( int cipher, in lrw_start() argument 47 /* is cipher valid? */ in lrw_start() 48 if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { in lrw_start() 51 if (cipher_descriptor[cipher]->block_length != 16) { in lrw_start() 56 if ((err = cipher_descriptor[cipher]->setup(key, keylen, num_rounds, &lrw->key)) != CRYPT_OK) { in lrw_start() 59 lrw->cipher = cipher; in lrw_start()
|
| /optee_os/core/drivers/crypto/crypto_api/acipher/ |
| H A D | rsa.c | 108 const uint8_t *cipher, in crypto_acipher_rsanopad_decrypt() argument 116 if (!key || !msg || !cipher || !msg_len) { in crypto_acipher_rsanopad_decrypt() 119 "(cipher @0%p size %zu bytes)", in crypto_acipher_rsanopad_decrypt() 121 cipher, cipher_len); in crypto_acipher_rsanopad_decrypt() 134 rsa_data.cipher.data = (uint8_t *)cipher; in crypto_acipher_rsanopad_decrypt() 135 rsa_data.cipher.length = cipher_len; in crypto_acipher_rsanopad_decrypt() 149 uint8_t *cipher, size_t *cipher_len) in crypto_acipher_rsanopad_encrypt() argument 158 "(cipher @%p size %zu bytes)", in crypto_acipher_rsanopad_encrypt() 160 cipher, cipher_len ? *cipher_len : 0); in crypto_acipher_rsanopad_encrypt() 169 CRYPTO_TRACE("Cipher length (%zu) too short expected %zu bytes", in crypto_acipher_rsanopad_encrypt() [all …]
|
| /optee_os/core/drivers/crypto/versal/ |
| H A D | rsa.c | 34 struct versal_mbox_mem cipher = { }; in do_encrypt() local 50 rsa_data->cipher.data, in do_encrypt() 51 &rsa_data->cipher.length); in do_encrypt() 60 rsa_data->cipher.data, in do_encrypt() 61 &rsa_data->cipher.length); in do_encrypt() 66 rsa_data->cipher.data, in do_encrypt() 67 &rsa_data->cipher.length); in do_encrypt() 84 versal_mbox_alloc(rsa_data->cipher.length, NULL, &cipher); in do_encrypt() 93 arg.ibuf[1].mem = cipher; in do_encrypt() 108 rsa_data->cipher.length = rsa_data->key.n_size; in do_encrypt() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/encauth/ccm/ |
| H A D | ccm_init.c | 10 @param cipher The index of the cipher to use 13 @param ptlen The length of the plain/cipher text that will be processed 19 int ccm_init(ccm_state *ccm, int cipher, in ccm_init() argument 29 /* check cipher input */ in ccm_init() 30 if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { in ccm_init() 33 if (cipher_descriptor[cipher]->block_length != 16) { in ccm_init() 44 if ((err = cipher_descriptor[cipher]->setup(key, keylen, 0, &ccm->K)) != CRYPT_OK) { in ccm_init() 47 ccm->cipher = cipher; in ccm_init()
|
| /optee_os/core/lib/libtomcrypt/src/misc/crypt/ |
| H A D | crypt_register_cipher.c | 7 Register a cipher, Tom St Denis 11 Register a cipher with the descriptor table 12 @param cipher The cipher you wish to register 15 int register_cipher(const struct ltc_cipher_descriptor *cipher) in register_cipher() argument 19 LTC_ARGCHK(cipher != NULL); in register_cipher() 24 if (cipher_descriptor[x] != NULL && cipher_descriptor[x]->ID == cipher->ID) { in register_cipher() 33 cipher_descriptor[x] = cipher; in register_cipher()
|
| H A D | crypt_unregister_cipher.c | 7 Unregister a cipher, Tom St Denis 11 Unregister a cipher from the descriptor table 12 @param cipher The cipher descriptor to remove 15 int unregister_cipher(const struct ltc_cipher_descriptor *cipher) in unregister_cipher() argument 19 LTC_ARGCHK(cipher != NULL); in unregister_cipher() 24 if (cipher_descriptor[x] == cipher) { in unregister_cipher()
|
| /optee_os/core/lib/libtomcrypt/src/headers/ |
| H A D | tomcrypt_mac.h | 41 int omac_init(omac_state *omac, int cipher, const unsigned char *key, unsigned long keylen); 44 int omac_memory(int cipher, 48 int omac_memory_multi(int cipher, 53 int omac_file(int cipher, 69 symmetric_key key; /* scheduled key for cipher */ 71 int cipher_idx, /* cipher idx */ 76 int pmac_init(pmac_state *pmac, int cipher, const unsigned char *key, unsigned long keylen); 80 int pmac_memory(int cipher, 85 int pmac_memory_multi(int cipher, 91 int pmac_file(int cipher, [all …]
|