Thread (3 messages) 3 messages, 2 authors, 2010-12-13

Re: [PATCH] Add RNG support to AF_ALG

From: Miloslav Trmac <hidden>
Date: 2010-12-13 17:24:46

----- "Neil Horman" [off-list ref] wrote:
+static int rng_recvmsg(struct kiocb *unused, struct socket *sock,
+			struct msghdr *msg, size_t len, int flags)
+{
+	struct sock *sk = sock->sk;
+	struct alg_sock *ask = alg_sk(sk);
+	struct rng_ctx *ctx = ask->private;
+	int rc, i;
+	u8 *data = kzalloc(len, GFP_KERNEL);
There probably should be an upper limit on the allocation - perhaps just always allocate a single page.
+static void rng_release(void *private)
+{
+	struct rng_ctx *ctx = private;
+	crypto_free_rng(ctx->ctx);
+	kfree(ctx->seed);
Is a seed secret enough that it should be zeroed before freeing?  (Same in setkey, accept_parent).

     Mirek
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help