/* RX SGL entry */ struct af_alg_rsgl { struct af_alg_sgl sgl; struct list_head list;
size_t sg_num_bytes; /* Bytes of data in that SGL */
};
/** * struct af_alg_async_req - definition of crypto request * @iocb: IOCB for AIO operations * @sk: Socket the request is associated with * @first_rsgl: First RX SG * @last_rsgl: Pointer to last RX SG * @rsgl_list: Track RX SGs * @tsgl: Private, per request TX SGL of buffers to process * @tsgl_entries: Number of entries in priv. TX SGL * @outlen: Number of output bytes generated by crypto op * @areqlen: Length of this data structure * @cra_u: Cipher request
*/ struct af_alg_async_req { struct kiocb *iocb; struct sock *sk;
union { struct aead_request aead_req; struct skcipher_request skcipher_req;
} cra_u;
/* req ctx trails this struct */
};
/** * struct af_alg_ctx - definition of the crypto context * * The crypto context tracks the input data during the lifetime of an AF_ALG * socket. * * @tsgl_list: Link to TX SGL * @iv: IV for cipher operation * @state: Existing state for continuing operation * @aead_assoclen: Length of AAD for AEAD cipher operations * @completion: Work queue for synchronous operation * @used: TX bytes sent to kernel. This variable is used to * ensure that user space cannot cause the kernel * to allocate too much memory in sendmsg operation. * @rcvused: Total RX bytes to be filled by kernel. This variable * is used to ensure user space cannot cause the kernel * to allocate too much memory in a recvmsg operation. * @more: More data to be expected from user space? * @merge: Shall new data from user space be merged into existing * SG? * @enc: Cryptographic operation to be performed when * recvmsg is invoked. * @write: True if we are in the middle of a write. * @init: True if metadata has been sent. * @len: Length of memory allocated for this data structure. * @inflight: Non-zero when AIO requests are in flight.
*/ struct af_alg_ctx { struct list_head tsgl_list;
void *iv; void *state;
size_t aead_assoclen;
struct crypto_wait wait;
size_t used;
atomic_t rcvused;
bool more:1,
merge:1,
enc:1,
write:1,
init:1;
unsignedint len;
unsignedint inflight;
};
int af_alg_register_type(conststruct af_alg_type *type); int af_alg_unregister_type(conststruct af_alg_type *type);
int af_alg_release(struct socket *sock); void af_alg_release_parent(struct sock *sk); int af_alg_accept(struct sock *sk, struct socket *newsock, struct proto_accept_arg *arg);
/** * Size of available buffer for sending data from user space to kernel. * * @sk socket of connection to user space * @return number of bytes still available
*/ staticinlineint af_alg_sndbuf(struct sock *sk)
{ struct alg_sock *ask = alg_sk(sk); struct af_alg_ctx *ctx = ask->private;
/** * Can the send buffer still be written to? * * @sk socket of connection to user space * @return true => writable, false => not writable
*/ staticinlinebool af_alg_writable(struct sock *sk)
{ return PAGE_SIZE <= af_alg_sndbuf(sk);
}
/** * Size of available buffer used by kernel for the RX user space operation. * * @sk socket of connection to user space * @return number of bytes still available
*/ staticinlineint af_alg_rcvbuf(struct sock *sk)
{ struct alg_sock *ask = alg_sk(sk); struct af_alg_ctx *ctx = ask->private;
/** * Can the RX buffer still be written to? * * @sk socket of connection to user space * @return true => writable, false => not writable
*/ staticinlinebool af_alg_readable(struct sock *sk)
{ return PAGE_SIZE <= af_alg_rcvbuf(sk);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.