Lines Matching refs:cctx

512     EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX, ctx);  in aria_ccm_init_key()  local
520 &cctx->ks.ks); in aria_ccm_init_key()
521 CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, in aria_ccm_init_key()
522 &cctx->ks, (block128_f) ossl_aria_encrypt); in aria_ccm_init_key()
527 cctx->str = NULL; in aria_ccm_init_key()
528 cctx->key_set = 1; in aria_ccm_init_key()
531 memcpy(ctx->iv, iv, 15 - cctx->L); in aria_ccm_init_key()
532 cctx->iv_set = 1; in aria_ccm_init_key()
539 EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX, c); in aria_ccm_ctrl() local
543 cctx->key_set = 0; in aria_ccm_ctrl()
544 cctx->iv_set = 0; in aria_ccm_ctrl()
545 cctx->L = 8; in aria_ccm_ctrl()
546 cctx->M = 12; in aria_ccm_ctrl()
547 cctx->tag_set = 0; in aria_ccm_ctrl()
548 cctx->len_set = 0; in aria_ccm_ctrl()
549 cctx->tls_aad_len = -1; in aria_ccm_ctrl()
553 *(int *)ptr = 15 - cctx->L; in aria_ccm_ctrl()
561 cctx->tls_aad_len = arg; in aria_ccm_ctrl()
572 if (len < cctx->M) in aria_ccm_ctrl()
574 len -= cctx->M; in aria_ccm_ctrl()
580 return cctx->M; in aria_ccm_ctrl()
596 cctx->L = arg; in aria_ccm_ctrl()
604 cctx->tag_set = 1; in aria_ccm_ctrl()
607 cctx->M = arg; in aria_ccm_ctrl()
611 if (!EVP_CIPHER_CTX_is_encrypting(c) || !cctx->tag_set) in aria_ccm_ctrl()
613 if (!CRYPTO_ccm128_tag(&cctx->ccm, ptr, (size_t)arg)) in aria_ccm_ctrl()
615 cctx->tag_set = 0; in aria_ccm_ctrl()
616 cctx->iv_set = 0; in aria_ccm_ctrl()
617 cctx->len_set = 0; in aria_ccm_ctrl()
624 if (cctx->ccm.key) { in aria_ccm_ctrl()
625 if (cctx->ccm.key != &cctx->ks) in aria_ccm_ctrl()
640 EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX, ctx); in aria_ccm_tls_cipher() local
641 CCM128_CONTEXT *ccm = &cctx->ccm; in aria_ccm_tls_cipher()
644 if (out != in || len < (EVP_CCM_TLS_EXPLICIT_IV_LEN + (size_t)cctx->M)) in aria_ccm_tls_cipher()
654 len -= EVP_CCM_TLS_EXPLICIT_IV_LEN + cctx->M; in aria_ccm_tls_cipher()
655 if (CRYPTO_ccm128_setiv(ccm, ctx->iv, 15 - cctx->L, in aria_ccm_tls_cipher()
660 cctx->tls_aad_len); in aria_ccm_tls_cipher()
665 if (cctx->str ? CRYPTO_ccm128_encrypt_ccm64(ccm, in, out, len, cctx->str) in aria_ccm_tls_cipher()
668 if (!CRYPTO_ccm128_tag(ccm, out + len, cctx->M)) in aria_ccm_tls_cipher()
670 return len + EVP_CCM_TLS_EXPLICIT_IV_LEN + cctx->M; in aria_ccm_tls_cipher()
672 if (cctx->str ? !CRYPTO_ccm128_decrypt_ccm64(ccm, in, out, len, cctx->str) in aria_ccm_tls_cipher()
675 if (CRYPTO_ccm128_tag(ccm, tag, cctx->M)) { in aria_ccm_tls_cipher()
676 if (!CRYPTO_memcmp(tag, in + len, cctx->M)) in aria_ccm_tls_cipher()
688 EVP_ARIA_CCM_CTX *cctx = EVP_C_DATA(EVP_ARIA_CCM_CTX, ctx); in aria_ccm_cipher() local
689 CCM128_CONTEXT *ccm = &cctx->ccm; in aria_ccm_cipher()
692 if (!cctx->key_set) in aria_ccm_cipher()
695 if (cctx->tls_aad_len >= 0) in aria_ccm_cipher()
702 if (!cctx->iv_set) in aria_ccm_cipher()
707 if (CRYPTO_ccm128_setiv(ccm, ctx->iv, 15 - cctx->L, len)) in aria_ccm_cipher()
709 cctx->len_set = 1; in aria_ccm_cipher()
713 if (!cctx->len_set && len) in aria_ccm_cipher()
720 if (!EVP_CIPHER_CTX_is_encrypting(ctx) && !cctx->tag_set) in aria_ccm_cipher()
724 if (!cctx->len_set) { in aria_ccm_cipher()
725 if (CRYPTO_ccm128_setiv(ccm, ctx->iv, 15 - cctx->L, len)) in aria_ccm_cipher()
727 cctx->len_set = 1; in aria_ccm_cipher()
730 if (cctx->str ? CRYPTO_ccm128_encrypt_ccm64(ccm, in, out, len, cctx->str) in aria_ccm_cipher()
733 cctx->tag_set = 1; in aria_ccm_cipher()
737 if (cctx->str ? !CRYPTO_ccm128_decrypt_ccm64(ccm, in, out, len, in aria_ccm_cipher()
738 cctx->str) : in aria_ccm_cipher()
741 if (CRYPTO_ccm128_tag(ccm, tag, cctx->M)) { in aria_ccm_cipher()
743 cctx->M)) in aria_ccm_cipher()
749 cctx->iv_set = 0; in aria_ccm_cipher()
750 cctx->tag_set = 0; in aria_ccm_cipher()
751 cctx->len_set = 0; in aria_ccm_cipher()