Lines Matching +full:software +full:- +full:initiated
2 * algif_rng: User-space interface for random number generators
4 * This file provides the user-space API for random number generators.
18 * products derived from this software without specific prior
25 * the restrictions contained in a BSD-style copyright.)
27 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
37 * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
51 MODULE_DESCRIPTION("User-space interface for random number generators");
68 kfree_sensitive(ctx->addtl); in rng_reset_addtl()
69 ctx->addtl = NULL; in rng_reset_addtl()
70 ctx->addtl_len = 0; in rng_reset_addtl()
110 struct sock *sk = sock->sk; in rng_recvmsg()
112 struct rng_ctx *ctx = ask->private; in rng_recvmsg()
114 return _rng_recvmsg(ctx->drng, msg, len, NULL, 0); in rng_recvmsg()
120 struct sock *sk = sock->sk; in rng_test_recvmsg()
122 struct rng_ctx *ctx = ask->private; in rng_test_recvmsg()
125 lock_sock(sock->sk); in rng_test_recvmsg()
126 ret = _rng_recvmsg(ctx->drng, msg, len, ctx->addtl, ctx->addtl_len); in rng_test_recvmsg()
128 release_sock(sock->sk); in rng_test_recvmsg()
136 struct alg_sock *ask = alg_sk(sock->sk); in rng_test_sendmsg()
137 struct rng_ctx *ctx = ask->private; in rng_test_sendmsg()
139 lock_sock(sock->sk); in rng_test_sendmsg()
141 err = -EMSGSIZE; in rng_test_sendmsg()
146 ctx->addtl = kmalloc(len, GFP_KERNEL); in rng_test_sendmsg()
147 if (!ctx->addtl) { in rng_test_sendmsg()
148 err = -ENOMEM; in rng_test_sendmsg()
152 err = memcpy_from_msg(ctx->addtl, msg, len); in rng_test_sendmsg()
157 ctx->addtl_len = len; in rng_test_sendmsg()
160 release_sock(sock->sk); in rng_test_sendmsg()
207 return ERR_PTR(-ENOMEM); in rng_bind()
215 pctx->drng = rng; in rng_bind()
225 crypto_free_rng(pctx->drng); in rng_release()
226 kfree_sensitive(pctx->entropy); in rng_release()
233 struct rng_ctx *ctx = ask->private; in rng_sock_destruct()
236 sock_kfree_s(sk, ctx, ctx->len); in rng_sock_destruct()
249 return -ENOMEM; in rng_accept_parent()
251 ctx->len = len; in rng_accept_parent()
252 ctx->addtl = NULL; in rng_accept_parent()
253 ctx->addtl_len = 0; in rng_accept_parent()
256 * No seeding done at that point -- if multiple accepts are in rng_accept_parent()
261 ctx->drng = pctx->drng; in rng_accept_parent()
262 ask->private = ctx; in rng_accept_parent()
263 sk->sk_destruct = rng_sock_destruct; in rng_accept_parent()
266 * Non NULL pctx->entropy means that CAVP test has been initiated on in rng_accept_parent()
269 if (IS_ENABLED(CONFIG_CRYPTO_USER_API_RNG_CAVP) && pctx->entropy) in rng_accept_parent()
270 sk->sk_socket->ops = &algif_rng_test_ops; in rng_accept_parent()
282 return crypto_rng_reset(pctx->drng, seed, seedlen); in rng_setkey()
292 return -EACCES; in rng_setentropy()
294 if (pctx->entropy) in rng_setentropy()
295 return -EINVAL; in rng_setentropy()
298 return -EMSGSIZE; in rng_setentropy()
306 crypto_rng_alg(pctx->drng)->set_ent(pctx->drng, kentropy, len); in rng_setentropy()
311 pctx->entropy = kentropy; in rng_setentropy()