From patchwork Tue Nov 29 00:44:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 9450805 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 8917A600CB for ; Tue, 29 Nov 2016 00:44:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FB8B275A2 for ; Tue, 29 Nov 2016 00:44:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73AED27D64; Tue, 29 Nov 2016 00:44:41 +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 16A56275A2 for ; Tue, 29 Nov 2016 00:44:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754993AbcK2Aoj (ORCPT ); Mon, 28 Nov 2016 19:44:39 -0500 Received: from mga09.intel.com ([134.134.136.24]:25146 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754516AbcK2Aoh (ORCPT ); Mon, 28 Nov 2016 19:44:37 -0500 Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP; 28 Nov 2016 16:44:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,565,1473145200"; d="scan'208";a="35292279" Received: from mjmartin-nuc01.wa.intel.com ([10.232.97.135]) by orsmga004.jf.intel.com with ESMTP; 28 Nov 2016 16:44:35 -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 v10 04/11] KEYS: Add a key restriction struct Date: Mon, 28 Nov 2016 16:44:25 -0800 Message-Id: <20161129004432.17926-5-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161129004432.17926-1-mathew.j.martineau@linux.intel.com> References: <20161129004432.17926-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 c4016bc..b22fcef 100644 --- a/include/linux/key.h +++ b/include/linux/key.h @@ -131,6 +131,12 @@ typedef int (*key_restrict_link_func_t)(struct key *dest_keyring, const union key_payload *payload, void *data); +struct key_restriction { + key_restrict_link_func_t check; + void (*free_data)(void *data); + void *data; +}; + /*****************************************************************************/ /* * authentication token / access credential / keyring