From patchwork Sun Nov 16 02:26:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Mueller X-Patchwork-Id: 5312911 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9B1019F440 for ; Sun, 16 Nov 2014 02:50:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E2A32201ED for ; Sun, 16 Nov 2014 02:50:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E81C0201DD for ; Sun, 16 Nov 2014 02:50:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932197AbaKPCs0 (ORCPT ); Sat, 15 Nov 2014 21:48:26 -0500 Received: from mail.eperm.de ([89.247.134.16]:54581 "EHLO mail.eperm.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932182AbaKPCsV (ORCPT ); Sat, 15 Nov 2014 21:48:21 -0500 X-AuthUser: sm@eperm.de Received: from tachyon.chronox.de by mail.eperm.de with [XMail 1.27 ESMTP Server] id for from ; Sun, 16 Nov 2014 03:48:18 +0100 From: Stephan Mueller To: Herbert Xu Cc: Daniel Borkmann , quentin.gouchet@gmail.com, LKML , linux-crypto@vger.kernel.org, ABI/API Subject: [PATCH v2 06/10] crypto: AF_ALG: make setkey optional Date: Sun, 16 Nov 2014 03:26:58 +0100 Message-ID: <2196615.OgfUNzPKdf@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: <5365136.g8vbXlhRyC@tachyon.chronox.de> References: <5365136.g8vbXlhRyC@tachyon.chronox.de> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;