Lines Matching defs:aes_ctx
176 aes_ctx_t aes_ctx;
182 memset(&aes_ctx, 0, sizeof (aes_ctx_t));
189 ret = aes_common_init_ctx(&aes_ctx, template, mechanism, key,
196 length_needed = plaintext->cd_length + aes_ctx.ac_mac_len;
199 length_needed = plaintext->cd_length + aes_ctx.ac_tag_len;
220 ret = crypto_update_iov(&aes_ctx, plaintext, ciphertext,
224 ret = crypto_update_uio(&aes_ctx, plaintext, ciphertext,
233 ret = ccm_encrypt_final((ccm_ctx_t *)&aes_ctx,
238 ASSERT(aes_ctx.ac_remainder_len == 0);
240 ret = gcm_encrypt_final((gcm_ctx_t *)&aes_ctx,
245 ASSERT(aes_ctx.ac_remainder_len == 0);
247 ASSERT(aes_ctx.ac_remainder_len == 0);
260 if (aes_ctx.ac_flags & PROVIDER_OWNS_KEY_SCHEDULE) {
261 memset(aes_ctx.ac_keysched, 0, aes_ctx.ac_keysched_len);
262 kmem_free(aes_ctx.ac_keysched, aes_ctx.ac_keysched_len);
264 if (aes_ctx.ac_flags & GCM_MODE) {
265 gcm_clear_ctx((gcm_ctx_t *)&aes_ctx);
275 aes_ctx_t aes_ctx;
281 memset(&aes_ctx, 0, sizeof (aes_ctx_t));
288 ret = aes_common_init_ctx(&aes_ctx, template, mechanism, key,
295 length_needed = aes_ctx.ac_data_len;
298 length_needed = ciphertext->cd_length - aes_ctx.ac_tag_len;
319 ret = crypto_update_iov(&aes_ctx, ciphertext, plaintext,
323 ret = crypto_update_uio(&aes_ctx, ciphertext, plaintext,
332 ASSERT(aes_ctx.ac_processed_data_len
333 == aes_ctx.ac_data_len);
334 ASSERT(aes_ctx.ac_processed_mac_len
335 == aes_ctx.ac_mac_len);
336 ret = ccm_decrypt_final((ccm_ctx_t *)&aes_ctx,
339 ASSERT(aes_ctx.ac_remainder_len == 0);
348 ret = gcm_decrypt_final((gcm_ctx_t *)&aes_ctx,
351 ASSERT(aes_ctx.ac_remainder_len == 0);
367 if (aes_ctx.ac_flags & PROVIDER_OWNS_KEY_SCHEDULE) {
368 memset(aes_ctx.ac_keysched, 0, aes_ctx.ac_keysched_len);
369 kmem_free(aes_ctx.ac_keysched, aes_ctx.ac_keysched_len);
372 if (aes_ctx.ac_flags & CCM_MODE) {
373 if (aes_ctx.ac_pt_buf != NULL) {
374 vmem_free(aes_ctx.ac_pt_buf, aes_ctx.ac_data_len);
376 } else if (aes_ctx.ac_flags & GCM_MODE) {
377 gcm_clear_ctx((gcm_ctx_t *)&aes_ctx);
422 aes_ctx_t *aes_ctx = ctx->cc_provider_private;
424 if (aes_ctx != NULL) {
425 if (aes_ctx->ac_flags & PROVIDER_OWNS_KEY_SCHEDULE) {
426 ASSERT(aes_ctx->ac_keysched_len != 0);
427 memset(aes_ctx->ac_keysched, 0,
428 aes_ctx->ac_keysched_len);
429 kmem_free(aes_ctx->ac_keysched,
430 aes_ctx->ac_keysched_len);
432 crypto_free_mode_ctx(aes_ctx);
441 aes_common_init_ctx(aes_ctx_t *aes_ctx, crypto_spi_ctx_template_t *template,
461 aes_ctx->ac_flags |= PROVIDER_OWNS_KEY_SCHEDULE;
462 aes_ctx->ac_keysched_len = size;
466 aes_ctx->ac_keysched = keysched;
474 rv = ccm_init_ctx((ccm_ctx_t *)aes_ctx, mechanism->cm_param,
483 rv = gcm_init_ctx((gcm_ctx_t *)aes_ctx, mechanism->cm_param,
490 if (aes_ctx->ac_flags & PROVIDER_OWNS_KEY_SCHEDULE) {