Lines Matching refs:actx
74 static int afalg_create_sk(afalg_ctx *actx, const char *ciphertype,
348 static ossl_inline int afalg_set_key(afalg_ctx *actx, const unsigned char *key,
352 ret = setsockopt(actx->bfd, SOL_ALG, ALG_SET_KEY, key, klen);
361 static int afalg_create_sk(afalg_ctx *actx, const char *ciphertype,
367 actx->bfd = actx->sfd = -1;
374 actx->bfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
375 if (actx->bfd == -1) {
381 r = bind(actx->bfd, (struct sockaddr *)&sa, sizeof(sa));
388 actx->sfd = accept(actx->bfd, NULL, 0);
389 if (actx->sfd < 0) {
398 if (actx->bfd >= 0)
399 close(actx->bfd);
400 if (actx->sfd >= 0)
401 close(actx->sfd);
402 actx->bfd = actx->sfd = -1;
406 static int afalg_start_cipher_sk(afalg_ctx *actx, const unsigned char *in,
450 sbytes = sendmsg(actx->sfd, &msg, 0);
461 ret = vmsplice(actx->zc_pipe[1], &iov, 1, SPLICE_F_GIFT);
467 ret = splice(actx->zc_pipe[0], NULL, actx->sfd, NULL, inl, 0);
477 sbytes = sendmsg(actx->sfd, &msg, 0);
499 afalg_ctx *actx;
512 actx = EVP_CIPHER_CTX_get_cipher_data(ctx);
513 if (actx == NULL) {
538 ret = afalg_create_sk(actx, "skcipher", ciphername);
543 ret = afalg_set_key(actx, key, EVP_CIPHER_CTX_key_length(ctx));
548 if (afalg_init_aio(&actx->aio) == 0)
552 pipe(actx->zc_pipe);
555 actx->init_done = MAGIC_INIT_NUM;
560 close(actx->sfd);
561 close(actx->bfd);
568 afalg_ctx *actx;
578 actx = (afalg_ctx *) EVP_CIPHER_CTX_get_cipher_data(ctx);
579 if (actx == NULL || actx->init_done != MAGIC_INIT_NUM) {
594 ret = afalg_start_cipher_sk(actx, (unsigned char *)in, inl,
602 ret = afalg_fin_cipher_aio(&actx->aio, actx->sfd, out, inl);
618 afalg_ctx *actx;
626 actx = (afalg_ctx *) EVP_CIPHER_CTX_get_cipher_data(ctx);
627 if (actx == NULL || actx->init_done != MAGIC_INIT_NUM)
630 close(actx->sfd);
631 close(actx->bfd);
633 close(actx->zc_pipe[0]);
634 close(actx->zc_pipe[1]);
637 if (actx->aio.mode == MODE_SYNC)
638 close(actx->aio.efd);
639 io_destroy(actx->aio.aio_ctx);