Home
last modified time | relevance | path

Searched refs:ctx (Results 1 – 25 of 30) sorted by relevance

12

/mcuboot-3.6.0/boot/bootutil/include/bootutil/crypto/
Decdh_p256.h38 static inline void bootutil_ecdh_p256_init(bootutil_ecdh_p256_context *ctx) in bootutil_ecdh_p256_init() argument
40 (void)ctx; in bootutil_ecdh_p256_init()
43 static inline void bootutil_ecdh_p256_drop(bootutil_ecdh_p256_context *ctx) in bootutil_ecdh_p256_drop() argument
45 (void)ctx; in bootutil_ecdh_p256_drop()
48 static inline int bootutil_ecdh_p256_shared_secret(bootutil_ecdh_p256_context *ctx, const uint8_t *… in bootutil_ecdh_p256_shared_secret() argument
51 (void)ctx; in bootutil_ecdh_p256_shared_secret()
84 static inline void bootutil_ecdh_p256_init(bootutil_ecdh_p256_context *ctx) in bootutil_ecdh_p256_init() argument
86 mbedtls_mpi_init(&ctx->z); in bootutil_ecdh_p256_init()
87 mbedtls_mpi_init(&ctx->d); in bootutil_ecdh_p256_init()
89 mbedtls_ecp_group_init(&ctx->grp); in bootutil_ecdh_p256_init()
[all …]
Dsha.h82 static inline int bootutil_sha_init(bootutil_sha_context *ctx) in bootutil_sha_init() argument
84 *ctx = psa_hash_operation_init(); in bootutil_sha_init()
86 psa_status_t status = psa_hash_setup(ctx, PSA_ALG_SHA_384); in bootutil_sha_init()
88 psa_status_t status = psa_hash_setup(ctx, PSA_ALG_SHA_256); in bootutil_sha_init()
93 static inline int bootutil_sha_drop(bootutil_sha_context *ctx) in bootutil_sha_drop() argument
95 return (int)psa_hash_abort(ctx); in bootutil_sha_drop()
98 static inline int bootutil_sha_update(bootutil_sha_context *ctx, in bootutil_sha_update() argument
102 return (int)psa_hash_update(ctx, data, data_len); in bootutil_sha_update()
105 static inline int bootutil_sha_finish(bootutil_sha_context *ctx, in bootutil_sha_finish() argument
111 return (int)psa_hash_finish(ctx, output, PSA_HASH_LENGTH(PSA_ALG_SHA_384), &hash_length); in bootutil_sha_finish()
[all …]
Drsa.h72 static inline void bootutil_rsa_init(bootutil_rsa_context *ctx) in bootutil_rsa_init() argument
74 ctx->key_id = PSA_KEY_ID_NULL; in bootutil_rsa_init()
77 static inline void bootutil_rsa_drop(bootutil_rsa_context *ctx) in bootutil_rsa_drop() argument
79 if (ctx->key_id != PSA_KEY_ID_NULL) { in bootutil_rsa_drop()
80 (void)psa_destroy_key(ctx->key_id); in bootutil_rsa_drop()
86 bootutil_rsa_context *ctx, in bootutil_rsa_oaep_decrypt() argument
98 status = psa_get_key_attributes(ctx->key_id, &key_attr); in bootutil_rsa_oaep_decrypt()
107 status = psa_asymmetric_decrypt(ctx->key_id, PSA_ALG_RSA_OAEP(PSA_ALG_SHA_256), in bootutil_rsa_oaep_decrypt()
119 bootutil_rsa_parse_private_key(bootutil_rsa_context *ctx, uint8_t **p, uint8_t *end) in bootutil_rsa_parse_private_key() argument
129 status = psa_import_key(&key_attributes, *p, (end - *p), &ctx->key_id); in bootutil_rsa_parse_private_key()
[all …]
Dhmac_sha256.h42 static inline void bootutil_hmac_sha256_init(bootutil_hmac_sha256_context *ctx) in bootutil_hmac_sha256_init() argument
44 (void)ctx; in bootutil_hmac_sha256_init()
47 static inline void bootutil_hmac_sha256_drop(bootutil_hmac_sha256_context *ctx) in bootutil_hmac_sha256_drop() argument
49 (void)ctx; in bootutil_hmac_sha256_drop()
52 static inline int bootutil_hmac_sha256_set_key(bootutil_hmac_sha256_context *ctx, const uint8_t *ke… in bootutil_hmac_sha256_set_key() argument
55 rc = tc_hmac_set_key(ctx, key, key_size); in bootutil_hmac_sha256_set_key()
59 rc = tc_hmac_init(ctx); in bootutil_hmac_sha256_set_key()
66 static inline int bootutil_hmac_sha256_update(bootutil_hmac_sha256_context *ctx, const void *data, … in bootutil_hmac_sha256_update() argument
69 rc = tc_hmac_update(ctx, data, data_length); in bootutil_hmac_sha256_update()
76 static inline int bootutil_hmac_sha256_finish(bootutil_hmac_sha256_context *ctx, uint8_t *tag, unsi… in bootutil_hmac_sha256_finish() argument
[all …]
Daes_ctr.h49 static inline void bootutil_aes_ctr_init(bootutil_aes_ctr_context *ctx) in bootutil_aes_ctr_init() argument
51 (void)mbedtls_aes_init(ctx); in bootutil_aes_ctr_init()
54 static inline void bootutil_aes_ctr_drop(bootutil_aes_ctr_context *ctx) in bootutil_aes_ctr_drop() argument
58 (void)ctx; in bootutil_aes_ctr_drop()
61 static inline int bootutil_aes_ctr_set_key(bootutil_aes_ctr_context *ctx, const uint8_t *k) in bootutil_aes_ctr_set_key() argument
63 return mbedtls_aes_setkey_enc(ctx, k, BOOTUTIL_CRYPTO_AES_CTR_KEY_SIZE * 8); in bootutil_aes_ctr_set_key()
66 static inline int bootutil_aes_ctr_encrypt(bootutil_aes_ctr_context *ctx, uint8_t *counter, const u… in bootutil_aes_ctr_encrypt() argument
69 return mbedtls_aes_crypt_ctr(ctx, mlen, &blk_off, counter, stream_block, m, c); in bootutil_aes_ctr_encrypt()
72 static inline int bootutil_aes_ctr_decrypt(bootutil_aes_ctr_context *ctx, uint8_t *counter, const u… in bootutil_aes_ctr_decrypt() argument
75 return mbedtls_aes_crypt_ctr(ctx, clen, &blk_off, counter, stream_block, c, m); in bootutil_aes_ctr_decrypt()
[all …]
Decdsa.h184 static inline void bootutil_ecdsa_init(bootutil_ecdsa_context *ctx) in bootutil_ecdsa_init() argument
186 (void)ctx; in bootutil_ecdsa_init()
189 static inline void bootutil_ecdsa_drop(bootutil_ecdsa_context *ctx) in bootutil_ecdsa_drop() argument
191 (void)ctx; in bootutil_ecdsa_drop()
194 static inline int bootutil_ecdsa_verify(bootutil_ecdsa_context *ctx, in bootutil_ecdsa_verify() argument
200 (void)ctx; in bootutil_ecdsa_verify()
224 static inline int bootutil_ecdsa_parse_public_key(bootutil_ecdsa_context *ctx, in bootutil_ecdsa_parse_public_key() argument
227 (void)ctx; in bootutil_ecdsa_parse_public_key()
234 static inline void bootutil_ecdsa_init(bootutil_ecdsa_context *ctx) in bootutil_ecdsa_init() argument
236 (void)ctx; in bootutil_ecdsa_init()
[all …]
Daes_kw.h41 static inline void bootutil_aes_kw_init(bootutil_aes_kw_context *ctx) in bootutil_aes_kw_init() argument
43 (void)mbedtls_nist_kw_init(ctx); in bootutil_aes_kw_init()
46 static inline void bootutil_aes_kw_drop(bootutil_aes_kw_context *ctx) in bootutil_aes_kw_drop() argument
50 (void)ctx; in bootutil_aes_kw_drop()
53 static inline int bootutil_aes_kw_set_unwrap_key(bootutil_aes_kw_context *ctx, const uint8_t *k, ui… in bootutil_aes_kw_set_unwrap_key() argument
55 return mbedtls_nist_kw_setkey(ctx, MBEDTLS_CIPHER_ID_AES, k, klen * 8, 0); in bootutil_aes_kw_set_unwrap_key()
58 static inline int bootutil_aes_kw_unwrap(bootutil_aes_kw_context *ctx, const uint8_t *wrapped_key, … in bootutil_aes_kw_unwrap() argument
61 …return mbedtls_nist_kw_unwrap(ctx, MBEDTLS_KW_MODE_KW, wrapped_key, wrapped_key_len, key, &olen, k… in bootutil_aes_kw_unwrap()
67 static inline void bootutil_aes_kw_init(bootutil_aes_kw_context *ctx) in bootutil_aes_kw_init() argument
69 (void)ctx; in bootutil_aes_kw_init()
[all …]
Decdh_x25519.h29 static inline void bootutil_ecdh_x25519_init(bootutil_ecdh_x25519_context *ctx) in bootutil_ecdh_x25519_init() argument
31 (void)ctx; in bootutil_ecdh_x25519_init()
34 static inline void bootutil_ecdh_x25519_drop(bootutil_ecdh_x25519_context *ctx) in bootutil_ecdh_x25519_drop() argument
36 (void)ctx; in bootutil_ecdh_x25519_drop()
39 static inline int bootutil_ecdh_x25519_shared_secret(bootutil_ecdh_x25519_context *ctx, const uint8… in bootutil_ecdh_x25519_shared_secret() argument
42 (void)ctx; in bootutil_ecdh_x25519_shared_secret()
/mcuboot-3.6.0/ext/tinycrypt/lib/source/
Dhmac.c52 int tc_hmac_set_key(TCHmacState_t ctx, const uint8_t *key, in tc_hmac_set_key() argument
57 if (ctx == (TCHmacState_t) 0 || in tc_hmac_set_key()
82 rekey(ctx->key, key, key_size); in tc_hmac_set_key()
84 (void)tc_sha256_init(&ctx->hash_state); in tc_hmac_set_key()
85 (void)tc_sha256_update(&ctx->hash_state, key, key_size); in tc_hmac_set_key()
86 (void)tc_sha256_final(&ctx->key[TC_SHA256_DIGEST_SIZE], in tc_hmac_set_key()
87 &ctx->hash_state); in tc_hmac_set_key()
88 rekey(ctx->key, in tc_hmac_set_key()
89 &ctx->key[TC_SHA256_DIGEST_SIZE], in tc_hmac_set_key()
96 int tc_hmac_init(TCHmacState_t ctx) in tc_hmac_init() argument
[all …]
Dctr_prng.c74 static void tc_ctr_prng_update(TCCtrPrng_t * const ctx, uint8_t const * const providedData) in tc_ctr_prng_update() argument
76 if (0 != ctx) { in tc_ctr_prng_update()
87 arrInc(ctx->V, sizeof ctx->V); in tc_ctr_prng_update()
93 (void)tc_aes_encrypt(output_block, ctx->V, &ctx->key); in tc_ctr_prng_update()
110 (void)tc_aes128_set_encrypt_key(&ctx->key, temp); in tc_ctr_prng_update()
113 memcpy(ctx->V, &(temp[TC_AES_KEY_SIZE]), TC_AES_BLOCK_SIZE); in tc_ctr_prng_update()
117 int tc_ctr_prng_init(TCCtrPrng_t * const ctx, in tc_ctr_prng_init() argument
140 if ((0 != ctx) && (0 != entropy) && (entropyLen >= sizeof seed_material)) { in tc_ctr_prng_init()
148 (void)tc_aes128_set_encrypt_key(&ctx->key, zeroArr); in tc_ctr_prng_init()
151 memset(ctx->V, 0x00, sizeof ctx->V); in tc_ctr_prng_init()
[all …]
/mcuboot-3.6.0/ext/mbedtls-asn1/include/mbedtls/
Dpk.h230 typedef int (*mbedtls_pk_rsa_alt_decrypt_func)( void *ctx, size_t *olen,
233 typedef int (*mbedtls_pk_rsa_alt_sign_func)( void *ctx,
237 typedef size_t (*mbedtls_pk_rsa_alt_key_len_func)( void *ctx );
255 void mbedtls_pk_init( mbedtls_pk_context *ctx );
268 void mbedtls_pk_free( mbedtls_pk_context *ctx );
277 void mbedtls_pk_restart_init( mbedtls_pk_restart_ctx *ctx );
285 void mbedtls_pk_restart_free( mbedtls_pk_restart_ctx *ctx );
303 int mbedtls_pk_setup( mbedtls_pk_context *ctx, const mbedtls_pk_info_t *info );
334 int mbedtls_pk_setup_opaque( mbedtls_pk_context *ctx,
354 int mbedtls_pk_setup_rsa_alt( mbedtls_pk_context *ctx, void * key,
[all …]
Drsa.h137 void mbedtls_rsa_init( mbedtls_rsa_context *ctx );
173 int mbedtls_rsa_set_padding( mbedtls_rsa_context *ctx, int padding,
205 int mbedtls_rsa_import( mbedtls_rsa_context *ctx,
244 int mbedtls_rsa_import_raw( mbedtls_rsa_context *ctx,
283 int mbedtls_rsa_complete( mbedtls_rsa_context *ctx );
325 int mbedtls_rsa_export( const mbedtls_rsa_context *ctx,
376 int mbedtls_rsa_export_raw( const mbedtls_rsa_context *ctx,
402 int mbedtls_rsa_export_crt( const mbedtls_rsa_context *ctx,
413 size_t mbedtls_rsa_get_len( const mbedtls_rsa_context *ctx );
433 int mbedtls_rsa_gen_key( mbedtls_rsa_context *ctx,
[all …]
Dmd.h143 void mbedtls_md_init( mbedtls_md_context_t *ctx );
158 void mbedtls_md_free( mbedtls_md_context_t *ctx );
180 int mbedtls_md_setup( mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info, int hmac );
250 int mbedtls_md_starts( mbedtls_md_context_t *ctx );
268 int mbedtls_md_update( mbedtls_md_context_t *ctx, const unsigned char *input, size_t ilen );
288 int mbedtls_md_finish( mbedtls_md_context_t *ctx, unsigned char *output );
351 int mbedtls_md_hmac_starts( mbedtls_md_context_t *ctx, const unsigned char *key,
373 int mbedtls_md_hmac_update( mbedtls_md_context_t *ctx, const unsigned char *input,
394 int mbedtls_md_hmac_finish( mbedtls_md_context_t *ctx, unsigned char *output);
411 int mbedtls_md_hmac_reset( mbedtls_md_context_t *ctx );
[all …]
Decdsa.h307 int mbedtls_ecdsa_write_signature( mbedtls_ecdsa_context *ctx,
354 int mbedtls_ecdsa_write_signature_restartable( mbedtls_ecdsa_context *ctx,
389 int mbedtls_ecdsa_read_signature( mbedtls_ecdsa_context *ctx,
424 int mbedtls_ecdsa_read_signature_restartable( mbedtls_ecdsa_context *ctx,
445 int mbedtls_ecdsa_genkey( mbedtls_ecdsa_context *ctx, mbedtls_ecp_group_id gid,
463 int mbedtls_ecdsa_from_keypair( mbedtls_ecdsa_context *ctx,
472 void mbedtls_ecdsa_init( mbedtls_ecdsa_context *ctx );
481 void mbedtls_ecdsa_free( mbedtls_ecdsa_context *ctx );
490 void mbedtls_ecdsa_restart_init( mbedtls_ecdsa_restart_ctx *ctx );
499 void mbedtls_ecdsa_restart_free( mbedtls_ecdsa_restart_ctx *ctx );
/mcuboot-3.6.0/ext/tinycrypt/tests/
Dtest_ctr_prng.c273 TCCtrPrng_t ctx; in executePRNG_TestVector() local
290 (void)tc_ctr_prng_init(&ctx, entropy, entropylen, personalization, plen); in executePRNG_TestVector()
292 (void)tc_ctr_prng_generate(&ctx, additional_input1, additionallen1, output, expectedlen); in executePRNG_TestVector()
293 (void)tc_ctr_prng_generate(&ctx, additional_input2, additionallen2, output, expectedlen); in executePRNG_TestVector()
319 TCCtrPrng_t ctx; in test_reseed() local
323 (void)tc_ctr_prng_init(&ctx, entropy, sizeof entropy, 0, 0U); in test_reseed()
326 ctx.reseedCount = 0x1000000000000ULL; in test_reseed()
328 ret = tc_ctr_prng_generate(&ctx, 0, 0, output, sizeof output); in test_reseed()
335 ret = tc_ctr_prng_generate(&ctx, 0, 0, output, sizeof output); in test_reseed()
344 ret = tc_ctr_prng_reseed(&ctx, entropy, sizeof entropy, additional_input, sizeof additional_input); in test_reseed()
[all …]
/mcuboot-3.6.0/sim/mcuboot-sys/src/
Dapi.rs170 THREAD_CTX.with(|ctx| { in set_flash()
171 ctx.borrow_mut().flash_params.insert(dev_id, FlashParamsStruct { in set_flash()
177 ctx.borrow_mut().flash_map.insert( in set_flash()
184 THREAD_CTX.with(|ctx| { in clear_flash()
185 ctx.borrow_mut().flash_map.remove(&dev_id); in clear_flash()
193 THREAD_CTX.with(|ctx| { in sim_get_flash_areas()
194 ctx.borrow().flash_areas.ptr in sim_get_flash_areas()
200 THREAD_CTX.with(|ctx| { in sim_set_flash_areas()
201 ctx.borrow_mut().flash_areas.ptr = areas; in sim_set_flash_areas()
207 THREAD_CTX.with(|ctx| { in sim_reset_flash_areas()
[all …]
/mcuboot-3.6.0/boot/bootutil/src/
Dimage_rsa.c89 bootutil_sha_context ctx; in pss_mgf1() local
96 bootutil_sha_init(&ctx); in pss_mgf1()
97 bootutil_sha_update(&ctx, hash, PSS_HLEN); in pss_mgf1()
98 bootutil_sha_update(&ctx, counter, 4); in pss_mgf1()
99 bootutil_sha_finish(&ctx, htmp); in pss_mgf1()
112 bootutil_sha_drop(&ctx); in pss_mgf1()
121 bootutil_cmp_rsasig(bootutil_rsa_context *ctx, uint8_t *hash, uint32_t hlen, in bootutil_cmp_rsasig() argument
142 if (bootutil_rsa_public(ctx, sig, em)) { in bootutil_cmp_rsasig()
242 bootutil_cmp_rsasig(bootutil_rsa_context *ctx, uint8_t *hash, uint32_t hlen, in bootutil_cmp_rsasig() argument
249 rc = bootutil_rsassa_pss_verify(ctx, hash, hlen, sig, slen); in bootutil_cmp_rsasig()
[all …]
Dimage_ecdsa.c43 bootutil_ecdsa_context ctx; in bootutil_verify_sig() local
50 bootutil_ecdsa_init(&ctx); in bootutil_verify_sig()
52 rc = bootutil_ecdsa_parse_public_key(&ctx, &pubkey, end); in bootutil_verify_sig()
57 rc = bootutil_ecdsa_verify(&ctx, pubkey, end-pubkey, hash, hlen, sig, slen); in bootutil_verify_sig()
64 bootutil_ecdsa_drop(&ctx); in bootutil_verify_sig()
/mcuboot-3.6.0/ext/nrf/
Dcc310_glue.h45 static inline void cc310_sha256_init(nrf_cc310_bl_hash_context_sha256_t *ctx);
47 void cc310_sha256_update(nrf_cc310_bl_hash_context_sha256_t *ctx,
62 static inline void cc310_sha256_init(nrf_cc310_bl_hash_context_sha256_t * ctx) in cc310_sha256_init() argument
66 nrf_cc310_bl_hash_sha256_init(ctx); in cc310_sha256_init()
69 static inline void cc310_sha256_finalize(nrf_cc310_bl_hash_context_sha256_t *ctx, in cc310_sha256_finalize() argument
72 nrf_cc310_bl_hash_sha256_finalize(ctx, in cc310_sha256_finalize()
Dcc310_glue.c37 void cc310_sha256_update(nrf_cc310_bl_hash_context_sha256_t *ctx, in cc310_sha256_update() argument
50 nrf_cc310_bl_hash_sha256_update(ctx, stack_buffer, block_len); in cc310_sha256_update()
52 nrf_cc310_bl_hash_sha256_update(ctx, data, data_len); in cc310_sha256_update()
62 nrf_cc310_bl_ecdsa_verify_context_secp256r1_t ctx; in cc310_ecdsa_verify_secp256r1() local
65 rc = nrf_cc310_bl_ecdsa_verify_secp256r1(&ctx, in cc310_ecdsa_verify_secp256r1()
/mcuboot-3.6.0/ext/tinycrypt/lib/include/tinycrypt/
Dhmac.h92 int tc_hmac_set_key(TCHmacState_t ctx, const uint8_t *key,
102 int tc_hmac_init(TCHmacState_t ctx);
114 int tc_hmac_update(TCHmacState_t ctx, const void *data,
133 int tc_hmac_final(uint8_t *tag, unsigned int taglen, TCHmacState_t ctx);
Dctr_prng.h101 int tc_ctr_prng_init(TCCtrPrng_t * const ctx,
126 int tc_ctr_prng_reseed(TCCtrPrng_t * const ctx,
148 int tc_ctr_prng_generate(TCCtrPrng_t * const ctx,
160 void tc_ctr_prng_uninstantiate(TCCtrPrng_t * const ctx);
/mcuboot-3.6.0/sim/mcuboot-sys/csupport/
Drun.c38 extern void sim_set_context(struct sim_context *ctx);
59 parse_pubkey(mbedtls_rsa_context *ctx, uint8_t **p, uint8_t *end) in parse_pubkey() argument
95 if (mbedtls_asn1_get_mpi(p, end, &ctx->MBEDTLS_CONTEXT_MEMBER(N)) != 0) { in parse_pubkey()
99 if (mbedtls_asn1_get_mpi(p, end, &ctx->MBEDTLS_CONTEXT_MEMBER(E)) != 0) { in parse_pubkey()
103 ctx->MBEDTLS_CONTEXT_MEMBER(len) = mbedtls_mpi_size(&ctx->MBEDTLS_CONTEXT_MEMBER(N)); in parse_pubkey()
109 if (mbedtls_rsa_check_pubkey(ctx) != 0) { in parse_pubkey()
138 mbedtls_rsa_context ctx; in rsa_oaep_encrypt_() local
146 mbedtls_rsa_init(&ctx); in rsa_oaep_encrypt_()
147 mbedtls_rsa_set_padding(&ctx, MBEDTLS_RSA_PKCS_V21, MBEDTLS_MD_SHA256); in rsa_oaep_encrypt_()
149 mbedtls_rsa_init(&ctx, MBEDTLS_RSA_PKCS_V21, MBEDTLS_MD_SHA256); in rsa_oaep_encrypt_()
[all …]
/mcuboot-3.6.0/scripts/imgtool/
Dmain.py248 def validate_version(ctx, param, value): argument
256 def validate_security_counter(ctx, param, value): argument
270 def validate_header_size(ctx, param, value): argument
278 def get_dependencies(ctx, param, value): argument
304 def convert(self, value, param, ctx): argument
310 % value, param, ctx)
492 def list_commands(self, ctx): argument
497 def get_command(self, ctx, cmd_name): argument
498 rv = click.Group.get_command(self, ctx, cmd_name)
502 return click.Group.get_command(self, ctx, self._aliases[cmd_name])
/mcuboot-3.6.0/ext/mbedtls-asn1/src/
Dasn1parse.c253 int (*cb)( void *ctx, int tag, in mbedtls_asn1_traverse_sequence_of() argument
255 void *ctx ) in mbedtls_asn1_traverse_sequence_of()
284 ret = cb( ctx, tag, *p, len ); in mbedtls_asn1_traverse_sequence_of()
335 static int asn1_get_sequence_of_cb( void *ctx, in asn1_get_sequence_of_cb() argument
341 (asn1_get_sequence_of_cb_ctx_t *) ctx; in asn1_get_sequence_of_cb()

12