Home
last modified time | relevance | path

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

12345678

/mbedtls-latest/library/
Decdh.c30 const mbedtls_ecdh_context *ctx) in mbedtls_ecdh_grp_id() argument
33 return ctx->grp.id; in mbedtls_ecdh_grp_id()
35 return ctx->grp_id; in mbedtls_ecdh_grp_id()
134 static void ecdh_init_internal(mbedtls_ecdh_context_mbed *ctx) in ecdh_init_internal() argument
136 mbedtls_ecp_group_init(&ctx->grp); in ecdh_init_internal()
137 mbedtls_mpi_init(&ctx->d); in ecdh_init_internal()
138 mbedtls_ecp_point_init(&ctx->Q); in ecdh_init_internal()
139 mbedtls_ecp_point_init(&ctx->Qp); in ecdh_init_internal()
140 mbedtls_mpi_init(&ctx->z); in ecdh_init_internal()
143 mbedtls_ecp_restart_init(&ctx->rs); in ecdh_init_internal()
[all …]
Dccm.c47 void mbedtls_ccm_init(mbedtls_ccm_context *ctx) in mbedtls_ccm_init() argument
49 memset(ctx, 0, sizeof(mbedtls_ccm_context)); in mbedtls_ccm_init()
52 int mbedtls_ccm_setkey(mbedtls_ccm_context *ctx, in mbedtls_ccm_setkey() argument
60 mbedtls_block_cipher_free(&ctx->block_cipher_ctx); in mbedtls_ccm_setkey()
62 if ((ret = mbedtls_block_cipher_setup(&ctx->block_cipher_ctx, cipher)) != 0) { in mbedtls_ccm_setkey()
66 if ((ret = mbedtls_block_cipher_setkey(&ctx->block_cipher_ctx, key, keybits)) != 0) { in mbedtls_ccm_setkey()
82 mbedtls_cipher_free(&ctx->cipher_ctx); in mbedtls_ccm_setkey()
84 if ((ret = mbedtls_cipher_setup(&ctx->cipher_ctx, cipher_info)) != 0) { in mbedtls_ccm_setkey()
88 if ((ret = mbedtls_cipher_setkey(&ctx->cipher_ctx, key, keybits, in mbedtls_ccm_setkey()
100 void mbedtls_ccm_free(mbedtls_ccm_context *ctx) in mbedtls_ccm_free() argument
[all …]
Dcipher.c201 void mbedtls_cipher_init(mbedtls_cipher_context_t *ctx) in mbedtls_cipher_init() argument
203 memset(ctx, 0, sizeof(mbedtls_cipher_context_t)); in mbedtls_cipher_init()
206 void mbedtls_cipher_free(mbedtls_cipher_context_t *ctx) in mbedtls_cipher_free() argument
208 if (ctx == NULL) { in mbedtls_cipher_free()
213 if (ctx->psa_enabled == 1) { in mbedtls_cipher_free()
214 if (ctx->cipher_ctx != NULL) { in mbedtls_cipher_free()
216 (mbedtls_cipher_context_psa *) ctx->cipher_ctx; in mbedtls_cipher_free()
226 mbedtls_platform_zeroize(ctx, sizeof(mbedtls_cipher_context_t)); in mbedtls_cipher_free()
232 if (ctx->cmac_ctx) { in mbedtls_cipher_free()
233 mbedtls_zeroize_and_free(ctx->cmac_ctx, in mbedtls_cipher_free()
[all …]
Ddhm.c98 void mbedtls_dhm_init(mbedtls_dhm_context *ctx) in mbedtls_dhm_init() argument
100 memset(ctx, 0, sizeof(mbedtls_dhm_context)); in mbedtls_dhm_init()
103 size_t mbedtls_dhm_get_bitlen(const mbedtls_dhm_context *ctx) in mbedtls_dhm_get_bitlen() argument
105 return mbedtls_mpi_bitlen(&ctx->P); in mbedtls_dhm_get_bitlen()
108 size_t mbedtls_dhm_get_len(const mbedtls_dhm_context *ctx) in mbedtls_dhm_get_len() argument
110 return mbedtls_mpi_size(&ctx->P); in mbedtls_dhm_get_len()
113 int mbedtls_dhm_get_value(const mbedtls_dhm_context *ctx, in mbedtls_dhm_get_value() argument
120 src = &ctx->P; in mbedtls_dhm_get_value()
123 src = &ctx->G; in mbedtls_dhm_get_value()
126 src = &ctx->X; in mbedtls_dhm_get_value()
[all …]
Dgcm.c53 void mbedtls_gcm_init(mbedtls_gcm_context *ctx) in mbedtls_gcm_init() argument
55 memset(ctx, 0, sizeof(mbedtls_gcm_context)); in mbedtls_gcm_init()
58 static inline void gcm_set_acceleration(mbedtls_gcm_context *ctx) in gcm_set_acceleration() argument
61 ctx->acceleration = MBEDTLS_GCM_ACC_LARGETABLE; in gcm_set_acceleration()
63 ctx->acceleration = MBEDTLS_GCM_ACC_SMALLTABLE; in gcm_set_acceleration()
69 ctx->acceleration = MBEDTLS_GCM_ACC_AESNI; in gcm_set_acceleration()
75 ctx->acceleration = MBEDTLS_GCM_ACC_AESCE; in gcm_set_acceleration()
99 static int gcm_gen_table(mbedtls_gcm_context *ctx) in gcm_gen_table() argument
106 ret = mbedtls_block_cipher_encrypt(&ctx->block_cipher_ctx, h, h); in gcm_gen_table()
109 ret = mbedtls_cipher_update(&ctx->cipher_ctx, h, 16, h, &olen); in gcm_gen_table()
[all …]
Dhmac_drbg.c33 void mbedtls_hmac_drbg_init(mbedtls_hmac_drbg_context *ctx) in mbedtls_hmac_drbg_init() argument
35 memset(ctx, 0, sizeof(mbedtls_hmac_drbg_context)); in mbedtls_hmac_drbg_init()
37 ctx->reseed_interval = MBEDTLS_HMAC_DRBG_RESEED_INTERVAL; in mbedtls_hmac_drbg_init()
43 int mbedtls_hmac_drbg_update(mbedtls_hmac_drbg_context *ctx, in mbedtls_hmac_drbg_update() argument
47 size_t md_len = mbedtls_md_get_size(ctx->md_ctx.md_info); in mbedtls_hmac_drbg_update()
55 if ((ret = mbedtls_md_hmac_reset(&ctx->md_ctx)) != 0) { in mbedtls_hmac_drbg_update()
58 if ((ret = mbedtls_md_hmac_update(&ctx->md_ctx, in mbedtls_hmac_drbg_update()
59 ctx->V, md_len)) != 0) { in mbedtls_hmac_drbg_update()
62 if ((ret = mbedtls_md_hmac_update(&ctx->md_ctx, in mbedtls_hmac_drbg_update()
67 if ((ret = mbedtls_md_hmac_update(&ctx->md_ctx, in mbedtls_hmac_drbg_update()
[all …]
Dlms.c225 void mbedtls_lms_public_init(mbedtls_lms_public_t *ctx) in mbedtls_lms_public_init() argument
227 memset(ctx, 0, sizeof(*ctx)); in mbedtls_lms_public_init()
230 void mbedtls_lms_public_free(mbedtls_lms_public_t *ctx) in mbedtls_lms_public_free() argument
232 if (ctx == NULL) { in mbedtls_lms_public_free()
236 mbedtls_platform_zeroize(ctx, sizeof(*ctx)); in mbedtls_lms_public_free()
239 int mbedtls_lms_import_public_key(mbedtls_lms_public_t *ctx, in mbedtls_lms_import_public_key() argument
249 ctx->params.type = type; in mbedtls_lms_import_public_key()
251 if (key_size != MBEDTLS_LMS_PUBLIC_KEY_LEN(ctx->params.type)) { in mbedtls_lms_import_public_key()
260 ctx->params.otstype = otstype; in mbedtls_lms_import_public_key()
262 memcpy(ctx->params.I_key_identifier, in mbedtls_lms_import_public_key()
[all …]
Dmd.c255 void mbedtls_md_init(mbedtls_md_context_t *ctx) in mbedtls_md_init() argument
258 memset(ctx, 0, sizeof(mbedtls_md_context_t)); in mbedtls_md_init()
261 void mbedtls_md_free(mbedtls_md_context_t *ctx) in mbedtls_md_free() argument
263 if (ctx == NULL || ctx->md_info == NULL) { in mbedtls_md_free()
267 if (ctx->md_ctx != NULL) { in mbedtls_md_free()
269 if (ctx->engine == MBEDTLS_MD_ENGINE_PSA) { in mbedtls_md_free()
270 psa_hash_abort(ctx->md_ctx); in mbedtls_md_free()
273 switch (ctx->md_info->type) { in mbedtls_md_free()
276 mbedtls_md5_free(ctx->md_ctx); in mbedtls_md_free()
281 mbedtls_ripemd160_free(ctx->md_ctx); in mbedtls_md_free()
[all …]
Drsa.c572 int mbedtls_rsa_import(mbedtls_rsa_context *ctx, in mbedtls_rsa_import() argument
579 if ((N != NULL && (ret = mbedtls_mpi_copy(&ctx->N, N)) != 0) || in mbedtls_rsa_import()
580 (P != NULL && (ret = mbedtls_mpi_copy(&ctx->P, P)) != 0) || in mbedtls_rsa_import()
581 (Q != NULL && (ret = mbedtls_mpi_copy(&ctx->Q, Q)) != 0) || in mbedtls_rsa_import()
582 (D != NULL && (ret = mbedtls_mpi_copy(&ctx->D, D)) != 0) || in mbedtls_rsa_import()
583 (E != NULL && (ret = mbedtls_mpi_copy(&ctx->E, E)) != 0)) { in mbedtls_rsa_import()
588 ctx->len = mbedtls_mpi_size(&ctx->N); in mbedtls_rsa_import()
594 int mbedtls_rsa_import_raw(mbedtls_rsa_context *ctx, in mbedtls_rsa_import_raw() argument
604 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->N, N, N_len)); in mbedtls_rsa_import_raw()
605 ctx->len = mbedtls_mpi_size(&ctx->N); in mbedtls_rsa_import_raw()
[all …]
Dchachapoly.c34 static int chachapoly_pad_aad(mbedtls_chachapoly_context *ctx) in chachapoly_pad_aad() argument
36 uint32_t partial_block_len = (uint32_t) (ctx->aad_len % 16U); in chachapoly_pad_aad()
45 return mbedtls_poly1305_update(&ctx->poly1305_ctx, in chachapoly_pad_aad()
55 static int chachapoly_pad_ciphertext(mbedtls_chachapoly_context *ctx) in chachapoly_pad_ciphertext() argument
57 uint32_t partial_block_len = (uint32_t) (ctx->ciphertext_len % 16U); in chachapoly_pad_ciphertext()
65 return mbedtls_poly1305_update(&ctx->poly1305_ctx, in chachapoly_pad_ciphertext()
70 void mbedtls_chachapoly_init(mbedtls_chachapoly_context *ctx) in mbedtls_chachapoly_init() argument
72 mbedtls_chacha20_init(&ctx->chacha20_ctx); in mbedtls_chachapoly_init()
73 mbedtls_poly1305_init(&ctx->poly1305_ctx); in mbedtls_chachapoly_init()
74 ctx->aad_len = 0U; in mbedtls_chachapoly_init()
[all …]
Dentropy.c27 void mbedtls_entropy_init(mbedtls_entropy_context *ctx) in mbedtls_entropy_init() argument
29 ctx->source_count = 0; in mbedtls_entropy_init()
30 memset(ctx->source, 0, sizeof(ctx->source)); in mbedtls_entropy_init()
33 mbedtls_mutex_init(&ctx->mutex); in mbedtls_entropy_init()
36 ctx->accumulator_started = 0; in mbedtls_entropy_init()
37 mbedtls_md_init(&ctx->accumulator); in mbedtls_entropy_init()
44 mbedtls_entropy_add_source(ctx, mbedtls_platform_entropy_poll, NULL, in mbedtls_entropy_init()
49 mbedtls_entropy_add_source(ctx, mbedtls_hardware_poll, NULL, in mbedtls_entropy_init()
54 mbedtls_entropy_add_source(ctx, mbedtls_nv_seed_poll, NULL, in mbedtls_entropy_init()
57 ctx->initial_entropy_run = 0; in mbedtls_entropy_init()
[all …]
Dctr_drbg.c73 void mbedtls_ctr_drbg_init(mbedtls_ctr_drbg_context *ctx) in mbedtls_ctr_drbg_init() argument
75 memset(ctx, 0, sizeof(mbedtls_ctr_drbg_context)); in mbedtls_ctr_drbg_init()
77 ctx->psa_ctx.key_id = MBEDTLS_SVC_KEY_ID_INIT; in mbedtls_ctr_drbg_init()
78 ctx->psa_ctx.operation = psa_cipher_operation_init(); in mbedtls_ctr_drbg_init()
80 mbedtls_aes_init(&ctx->aes_ctx); in mbedtls_ctr_drbg_init()
84 ctx->reseed_counter = -1; in mbedtls_ctr_drbg_init()
86 ctx->reseed_interval = MBEDTLS_CTR_DRBG_RESEED_INTERVAL; in mbedtls_ctr_drbg_init()
93 void mbedtls_ctr_drbg_free(mbedtls_ctr_drbg_context *ctx) in mbedtls_ctr_drbg_free() argument
95 if (ctx == NULL) { in mbedtls_ctr_drbg_free()
101 if (ctx->f_entropy != NULL) { in mbedtls_ctr_drbg_free()
[all …]
Dpoly1305.c64 static void poly1305_process(mbedtls_poly1305_context *ctx, in poly1305_process() argument
76 r0 = ctx->r[0]; in poly1305_process()
77 r1 = ctx->r[1]; in poly1305_process()
78 r2 = ctx->r[2]; in poly1305_process()
79 r3 = ctx->r[3]; in poly1305_process()
85 acc0 = ctx->acc[0]; in poly1305_process()
86 acc1 = ctx->acc[1]; in poly1305_process()
87 acc2 = ctx->acc[2]; in poly1305_process()
88 acc3 = ctx->acc[3]; in poly1305_process()
89 acc4 = ctx->acc[4]; in poly1305_process()
[all …]
Dssl_ticket.c36 void mbedtls_ssl_ticket_init(mbedtls_ssl_ticket_context *ctx) in mbedtls_ssl_ticket_init() argument
38 memset(ctx, 0, sizeof(mbedtls_ssl_ticket_context)); in mbedtls_ssl_ticket_init()
41 mbedtls_mutex_init(&ctx->mutex); in mbedtls_ssl_ticket_init()
64 static int ssl_ticket_gen_key(mbedtls_ssl_ticket_context *ctx, in ssl_ticket_gen_key() argument
69 mbedtls_ssl_ticket_key *key = ctx->keys + index; 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()
87 if ((ret = ctx->f_rng(ctx->p_rng, buf, sizeof(buf))) != 0) { in ssl_ticket_gen_key()
104 ret = mbedtls_cipher_setkey(&key->ctx, buf, in ssl_ticket_gen_key()
105 mbedtls_cipher_get_key_bitlen(&key->ctx), in ssl_ticket_gen_key()
[all …]
Dblock_cipher.c52 void mbedtls_block_cipher_free(mbedtls_block_cipher_context_t *ctx) in mbedtls_block_cipher_free() argument
54 if (ctx == NULL) { in mbedtls_block_cipher_free()
59 if (ctx->engine == MBEDTLS_BLOCK_CIPHER_ENGINE_PSA) { in mbedtls_block_cipher_free()
60 psa_destroy_key(ctx->psa_key_id); in mbedtls_block_cipher_free()
64 switch (ctx->id) { in mbedtls_block_cipher_free()
67 mbedtls_aes_free(&ctx->ctx.aes); in mbedtls_block_cipher_free()
72 mbedtls_aria_free(&ctx->ctx.aria); in mbedtls_block_cipher_free()
77 mbedtls_camellia_free(&ctx->ctx.camellia); in mbedtls_block_cipher_free()
83 ctx->id = MBEDTLS_BLOCK_CIPHER_ID_NONE; in mbedtls_block_cipher_free()
86 int mbedtls_block_cipher_setup(mbedtls_block_cipher_context_t *ctx, in mbedtls_block_cipher_setup() argument
[all …]
Dcipher_wrap.c123 void *ctx = mbedtls_calloc(1, sizeof(mbedtls_gcm_context)); in gcm_ctx_alloc() local
125 if (ctx != NULL) { in gcm_ctx_alloc()
126 mbedtls_gcm_init((mbedtls_gcm_context *) ctx); in gcm_ctx_alloc()
129 return ctx; in gcm_ctx_alloc()
132 static void gcm_ctx_free(void *ctx) in gcm_ctx_free() argument
134 mbedtls_gcm_free(ctx); in gcm_ctx_free()
135 mbedtls_free(ctx); in gcm_ctx_free()
145 void *ctx = mbedtls_calloc(1, sizeof(mbedtls_ccm_context)); in ccm_ctx_alloc() local
147 if (ctx != NULL) { in ccm_ctx_alloc()
148 mbedtls_ccm_init((mbedtls_ccm_context *) ctx); in ccm_ctx_alloc()
[all …]
Dpsa_crypto_hash.c32 mbedtls_md5_free(&operation->ctx.md5); in mbedtls_psa_hash_abort()
37 mbedtls_ripemd160_free(&operation->ctx.ripemd160); in mbedtls_psa_hash_abort()
42 mbedtls_sha1_free(&operation->ctx.sha1); in mbedtls_psa_hash_abort()
47 mbedtls_sha256_free(&operation->ctx.sha256); in mbedtls_psa_hash_abort()
52 mbedtls_sha256_free(&operation->ctx.sha256); in mbedtls_psa_hash_abort()
57 mbedtls_sha512_free(&operation->ctx.sha512); in mbedtls_psa_hash_abort()
62 mbedtls_sha512_free(&operation->ctx.sha512); in mbedtls_psa_hash_abort()
81 mbedtls_sha3_free(&operation->ctx.sha3); in mbedtls_psa_hash_abort()
105 mbedtls_md5_init(&operation->ctx.md5); in mbedtls_psa_hash_setup()
106 ret = mbedtls_md5_starts(&operation->ctx.md5); in mbedtls_psa_hash_setup()
[all …]
Dpk.c41 void mbedtls_pk_init(mbedtls_pk_context *ctx) in mbedtls_pk_init() argument
43 ctx->pk_info = NULL; in mbedtls_pk_init()
44 ctx->pk_ctx = NULL; in mbedtls_pk_init()
46 ctx->priv_id = MBEDTLS_SVC_KEY_ID_INIT; in mbedtls_pk_init()
49 memset(ctx->pub_raw, 0, sizeof(ctx->pub_raw)); in mbedtls_pk_init()
50 ctx->pub_raw_len = 0; in mbedtls_pk_init()
51 ctx->ec_family = 0; in mbedtls_pk_init()
52 ctx->ec_bits = 0; in mbedtls_pk_init()
59 void mbedtls_pk_free(mbedtls_pk_context *ctx) in mbedtls_pk_free() argument
61 if (ctx == NULL) { in mbedtls_pk_free()
[all …]
Dchacha20.c143 void mbedtls_chacha20_init(mbedtls_chacha20_context *ctx) in mbedtls_chacha20_init() argument
145 mbedtls_platform_zeroize(ctx->state, sizeof(ctx->state)); in mbedtls_chacha20_init()
146 mbedtls_platform_zeroize(ctx->keystream8, sizeof(ctx->keystream8)); in mbedtls_chacha20_init()
149 ctx->keystream_bytes_used = CHACHA20_BLOCK_SIZE_BYTES; in mbedtls_chacha20_init()
152 void mbedtls_chacha20_free(mbedtls_chacha20_context *ctx) in mbedtls_chacha20_free() argument
154 if (ctx != NULL) { in mbedtls_chacha20_free()
155 mbedtls_platform_zeroize(ctx, sizeof(mbedtls_chacha20_context)); in mbedtls_chacha20_free()
159 int mbedtls_chacha20_setkey(mbedtls_chacha20_context *ctx, in mbedtls_chacha20_setkey() argument
163 ctx->state[0] = 0x61707865; in mbedtls_chacha20_setkey()
164 ctx->state[1] = 0x3320646e; in mbedtls_chacha20_setkey()
[all …]
Decjpake.c33 #define ID_MINE (ecjpake_id[ctx->role])
34 #define ID_PEER (ecjpake_id[1 - ctx->role])
50 void mbedtls_ecjpake_init(mbedtls_ecjpake_context *ctx) in mbedtls_ecjpake_init() argument
52 ctx->md_type = MBEDTLS_MD_NONE; in mbedtls_ecjpake_init()
53 mbedtls_ecp_group_init(&ctx->grp); in mbedtls_ecjpake_init()
54 ctx->point_format = MBEDTLS_ECP_PF_UNCOMPRESSED; in mbedtls_ecjpake_init()
56 mbedtls_ecp_point_init(&ctx->Xm1); in mbedtls_ecjpake_init()
57 mbedtls_ecp_point_init(&ctx->Xm2); in mbedtls_ecjpake_init()
58 mbedtls_ecp_point_init(&ctx->Xp1); in mbedtls_ecjpake_init()
59 mbedtls_ecp_point_init(&ctx->Xp2); in mbedtls_ecjpake_init()
[all …]
Dx509write_crt.c40 void mbedtls_x509write_crt_init(mbedtls_x509write_cert *ctx) in mbedtls_x509write_crt_init() argument
42 memset(ctx, 0, sizeof(mbedtls_x509write_cert)); in mbedtls_x509write_crt_init()
44 ctx->version = MBEDTLS_X509_CRT_VERSION_3; in mbedtls_x509write_crt_init()
47 void mbedtls_x509write_crt_free(mbedtls_x509write_cert *ctx) in mbedtls_x509write_crt_free() argument
49 if (ctx == NULL) { in mbedtls_x509write_crt_free()
53 mbedtls_asn1_free_named_data_list(&ctx->subject); in mbedtls_x509write_crt_free()
54 mbedtls_asn1_free_named_data_list(&ctx->issuer); in mbedtls_x509write_crt_free()
55 mbedtls_asn1_free_named_data_list(&ctx->extensions); in mbedtls_x509write_crt_free()
57 mbedtls_platform_zeroize(ctx, sizeof(mbedtls_x509write_cert)); in mbedtls_x509write_crt_free()
60 void mbedtls_x509write_crt_set_version(mbedtls_x509write_cert *ctx, in mbedtls_x509write_crt_set_version() argument
[all …]
Dlmots.c383 void mbedtls_lmots_public_init(mbedtls_lmots_public_t *ctx) in mbedtls_lmots_public_init() argument
385 memset(ctx, 0, sizeof(*ctx)); in mbedtls_lmots_public_init()
388 void mbedtls_lmots_public_free(mbedtls_lmots_public_t *ctx) in mbedtls_lmots_public_free() argument
390 if (ctx == NULL) { in mbedtls_lmots_public_free()
394 mbedtls_platform_zeroize(ctx, sizeof(*ctx)); in mbedtls_lmots_public_free()
397 int mbedtls_lmots_import_public_key(mbedtls_lmots_public_t *ctx, in mbedtls_lmots_import_public_key() argument
404 ctx->params.type = (mbedtls_lmots_algorithm_type_t) in mbedtls_lmots_import_public_key()
407 if (key_len != MBEDTLS_LMOTS_PUBLIC_KEY_LEN(ctx->params.type)) { in mbedtls_lmots_import_public_key()
411 memcpy(ctx->params.I_key_identifier, in mbedtls_lmots_import_public_key()
415 memcpy(ctx->params.q_leaf_identifier, in mbedtls_lmots_import_public_key()
[all …]
/mbedtls-latest/tests/suites/
Dtest_suite_gcm.function7 static int check_multipart(mbedtls_gcm_context *ctx,
28 TEST_EQUAL(0, mbedtls_gcm_starts(ctx, mode,
30 TEST_EQUAL(0, mbedtls_gcm_update_ad(ctx, add->x, n1_add));
31 TEST_EQUAL(0, mbedtls_gcm_update_ad(ctx, add->x + n1_add, n2_add));
38 TEST_EQUAL(0, mbedtls_gcm_update(ctx, input->x, n1, output, n1, &olen));
46 TEST_EQUAL(0, mbedtls_gcm_update(ctx, input->x + n1, n2, output, n2, &olen));
53 TEST_EQUAL(0, mbedtls_gcm_finish(ctx, NULL, 0, &olen, output, tag->len));
65 static void check_cipher_with_empty_ad(mbedtls_gcm_context *ctx,
80 TEST_EQUAL(0, mbedtls_gcm_starts(ctx, mode,
84 TEST_EQUAL(0, mbedtls_gcm_update_ad(ctx, NULL, 0));
[all …]
Dtest_suite_ccm.function7 static int check_multipart(mbedtls_ccm_context *ctx,
27 TEST_EQUAL(0, mbedtls_ccm_starts(ctx, mode, iv->x, iv->len));
28 TEST_EQUAL(0, mbedtls_ccm_set_lengths(ctx, add->len, input->len, tag->len));
29 TEST_EQUAL(0, mbedtls_ccm_update_ad(ctx, add->x, n1_add));
30 TEST_EQUAL(0, mbedtls_ccm_update_ad(ctx, add->x + n1_add, n2_add));
37 TEST_EQUAL(0, mbedtls_ccm_update(ctx, input->x, n1, output, n1, &olen));
45 TEST_EQUAL(0, mbedtls_ccm_update(ctx, input->x + n1, n2, output, n2, &olen));
52 TEST_EQUAL(0, mbedtls_ccm_finish(ctx, output, tag->len));
81 mbedtls_ccm_context ctx;
86 mbedtls_ccm_init(&ctx);
[all …]
Dtest_suite_rsa.function15 mbedtls_rsa_context ctx;
21 mbedtls_rsa_init(&ctx);
23 TEST_EQUAL(mbedtls_rsa_set_padding(&ctx,
28 TEST_EQUAL(mbedtls_rsa_set_padding(&ctx,
33 TEST_EQUAL(mbedtls_rsa_pkcs1_sign(&ctx, NULL,
39 TEST_EQUAL(mbedtls_rsa_pkcs1_sign(&ctx, NULL,
45 TEST_EQUAL(mbedtls_rsa_pkcs1_verify(&ctx, MBEDTLS_MD_NONE,
50 TEST_EQUAL(mbedtls_rsa_pkcs1_verify(&ctx, MBEDTLS_MD_SHA256,
56 TEST_EQUAL(mbedtls_rsa_set_padding(&ctx,
63 TEST_EQUAL(mbedtls_rsa_rsassa_pkcs1_v15_sign(&ctx, NULL,
[all …]

12345678