From patchwork Wed Nov 16 22:37:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 9433077 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4811860755 for ; Wed, 16 Nov 2016 22:38:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 396FC28EA8 for ; Wed, 16 Nov 2016 22:38:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E33C28EEA; Wed, 16 Nov 2016 22:38:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3487F290A2 for ; Wed, 16 Nov 2016 22:38:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424389AbcKPWiS (ORCPT ); Wed, 16 Nov 2016 17:38:18 -0500 Received: from mga14.intel.com ([192.55.52.115]:48432 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424391AbcKPWiM (ORCPT ); Wed, 16 Nov 2016 17:38:12 -0500 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 16 Nov 2016 14:38:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,650,1473145200"; d="scan'208";a="5260889" Received: from mjmartin-nuc01.wa.intel.com ([10.232.97.135]) by orsmga002.jf.intel.com with ESMTP; 16 Nov 2016 14:38:09 -0800 From: Mat Martineau To: keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, dhowells@redhat.com Cc: Mat Martineau , zohar@linux.vnet.ibm.com Subject: [PATCH v9 04/11] KEYS: Add a key restriction struct Date: Wed, 16 Nov 2016 14:37:59 -0800 Message-Id: <20161116223806.14601-5-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161116223806.14601-1-mathew.j.martineau@linux.intel.com> References: <20161116223806.14601-1-mathew.j.martineau@linux.intel.com> Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Key link restrictions require restriction-specific data as well as a restriction-specific function pointer. As a first step toward replacing the restrict_link pointer in struct key, define a more general key_restriction structure that captures the function and data, as well as a data freeing function. Signed-off-by: Mat Martineau --- include/linux/key.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/key.h b/include/linux/key.h index 7efb8a9..768d189 100644 --- a/include/linux/key.h +++ b/include/linux/key.h @@ -131,6 +131,12 @@ typedef int (*restrict_link_func_t)(struct key *dest_keyring, const union key_payload *payload, void *data); +struct key_restriction { + restrict_link_func_t check; + void (*free_data)(void *data); + void *data; +}; + /*****************************************************************************/ /* * authentication token / access credential / keyring