Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752042AbaKLHJ3 (ORCPT ); Wed, 12 Nov 2014 02:09:29 -0500 Received: from mail.eperm.de ([89.247.134.16]:54485 "EHLO mail.eperm.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751930AbaKLHJZ (ORCPT ); Wed, 12 Nov 2014 02:09:25 -0500 X-AuthUser: sm@eperm.de From: Stephan Mueller To: Herbert Xu Cc: ABI/API , linux-crypto@vger.kernel.org, LKML Subject: [PATCH 6/8] crypto: AF_ALG: make setkey optional Date: Wed, 12 Nov 2014 08:05:11 +0100 Message-ID: <8532179.q3pCnHKv8n@tachyon.chronox.de> User-Agent: KMail/4.14.2 (Linux/3.17.2-300.fc21.x86_64; KDE/4.14.2; x86_64; ; ) In-Reply-To: <4738444.A2vZX1nNCo@tachyon.chronox.de> References: <4738444.A2vZX1nNCo@tachyon.chronox.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current AF_ALG implementation requires that a userspace interface implementation must provide a callback for setkey. Such a call is not appliable to random number generators. To prepare AF_ALG for the addition of a random number generator user space interface, this function callback invocation is made optional. Signed-off-by: Stephan Mueller --- crypto/af_alg.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crypto/af_alg.c b/crypto/af_alg.c index 635140b..47a199c 100644 --- a/crypto/af_alg.c +++ b/crypto/af_alg.c @@ -177,6 +177,9 @@ static int alg_setkey(struct sock *sk, char __user *ukey, u8 *key; int err; + if (!type->setkey) + return -EOPNOTSUPP; + key = sock_kmalloc(sk, keylen, GFP_KERNEL); if (!key) return -ENOMEM; -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/