Lines Matching defs:actx

77 static int afalg_create_sk(afalg_ctx *actx, const char *ciphertype,
405 static ossl_inline int afalg_set_key(afalg_ctx *actx, const unsigned char *key,
409 ret = setsockopt(actx->bfd, SOL_ALG, ALG_SET_KEY, key, klen);
418 static int afalg_create_sk(afalg_ctx *actx, const char *ciphertype,
424 actx->bfd = actx->sfd = -1;
431 actx->bfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
432 if (actx->bfd == -1) {
438 r = bind(actx->bfd, (struct sockaddr *)&sa, sizeof(sa));
445 actx->sfd = accept(actx->bfd, NULL, 0);
446 if (actx->sfd < 0) {
455 if (actx->bfd >= 0)
456 close(actx->bfd);
457 if (actx->sfd >= 0)
458 close(actx->sfd);
459 actx->bfd = actx->sfd = -1;
463 static int afalg_start_cipher_sk(afalg_ctx *actx, const unsigned char *in,
508 sbytes = sendmsg(actx->sfd, &msg, 0);
519 ret = vmsplice(actx->zc_pipe[1], &iov, 1, SPLICE_F_GIFT);
525 ret = splice(actx->zc_pipe[0], NULL, actx->sfd, NULL, inl, 0);
535 sbytes = sendmsg(actx->sfd, &msg, 0);
557 afalg_ctx *actx;
570 actx = EVP_CIPHER_CTX_get_cipher_data(ctx);
571 if (actx == NULL) {
596 ret = afalg_create_sk(actx, "skcipher", ciphername);
602 ret = afalg_set_key(actx, key, len);
607 if (afalg_init_aio(&actx->aio) == 0)
611 pipe(actx->zc_pipe);
614 actx->init_done = MAGIC_INIT_NUM;
619 close(actx->sfd);
620 close(actx->bfd);
627 afalg_ctx *actx;
637 actx = (afalg_ctx *) EVP_CIPHER_CTX_get_cipher_data(ctx);
638 if (actx == NULL || actx->init_done != MAGIC_INIT_NUM) {
653 ret = afalg_start_cipher_sk(actx, (unsigned char *)in, inl,
661 ret = afalg_fin_cipher_aio(&actx->aio, actx->sfd, out, inl);
677 afalg_ctx *actx;
685 actx = (afalg_ctx *) EVP_CIPHER_CTX_get_cipher_data(ctx);
686 if (actx == NULL || actx->init_done != MAGIC_INIT_NUM)
689 close(actx->sfd);
690 close(actx->bfd);
692 close(actx->zc_pipe[0]);
693 close(actx->zc_pipe[1]);
696 if (actx->aio.mode == MODE_SYNC)
697 close(actx->aio.efd);
698 io_destroy(actx->aio.aio_ctx);