Lines Matching defs:actx
78 static int afalg_create_sk(afalg_ctx *actx, const char *ciphertype,
427 static ossl_inline int afalg_set_key(afalg_ctx *actx, const unsigned char *key,
431 ret = setsockopt(actx->bfd, SOL_ALG, ALG_SET_KEY, key, klen);
440 static int afalg_create_sk(afalg_ctx *actx, const char *ciphertype,
446 actx->bfd = actx->sfd = -1;
453 actx->bfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
454 if (actx->bfd == -1) {
460 r = bind(actx->bfd, (struct sockaddr *)&sa, sizeof(sa));
467 actx->sfd = accept(actx->bfd, NULL, 0);
468 if (actx->sfd < 0) {
477 if (actx->bfd >= 0)
478 close(actx->bfd);
479 if (actx->sfd >= 0)
480 close(actx->sfd);
481 actx->bfd = actx->sfd = -1;
485 static int afalg_start_cipher_sk(afalg_ctx *actx, const unsigned char *in,
530 sbytes = sendmsg(actx->sfd, &msg, 0);
541 ret = vmsplice(actx->zc_pipe[1], &iov, 1, SPLICE_F_GIFT);
547 ret = splice(actx->zc_pipe[0], NULL, actx->sfd, NULL, inl, 0);
557 sbytes = sendmsg(actx->sfd, &msg, 0);
579 afalg_ctx *actx;
592 actx = EVP_CIPHER_CTX_get_cipher_data(ctx);
593 if (actx == NULL) {
618 ret = afalg_create_sk(actx, "skcipher", ciphername);
624 ret = afalg_set_key(actx, key, len);
629 if (afalg_init_aio(&actx->aio) == 0)
633 pipe(actx->zc_pipe);
636 actx->init_done = MAGIC_INIT_NUM;
641 close(actx->sfd);
642 close(actx->bfd);
649 afalg_ctx *actx;
659 actx = (afalg_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx);
660 if (actx == NULL || actx->init_done != MAGIC_INIT_NUM) {
675 ret = afalg_start_cipher_sk(actx, (unsigned char *)in, inl,
683 ret = afalg_fin_cipher_aio(&actx->aio, actx->sfd, out, inl);
699 afalg_ctx *actx;
707 actx = (afalg_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx);
708 if (actx == NULL || actx->init_done != MAGIC_INIT_NUM)
711 close(actx->sfd);
712 close(actx->bfd);
714 close(actx->zc_pipe[0]);
715 close(actx->zc_pipe[1]);
718 if (actx->aio.mode == MODE_SYNC)
719 close(actx->aio.efd);
720 io_destroy(actx->aio.aio_ctx);