From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753982AbcB2SWB (ORCPT ); Mon, 29 Feb 2016 13:22:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52417 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753840AbcB2SV7 (ORCPT ); Mon, 29 Feb 2016 13:21:59 -0500 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [RFC PATCH 3/7] KEYS: Add identifier pointers to public_key_signature struct From: David Howells To: keyrings@vger.kernel.org Cc: dhowells@redhat.com, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 29 Feb 2016 18:21:57 +0000 Message-ID: <20160229182157.27797.49359.stgit@warthog.procyon.org.uk> In-Reply-To: <20160229182136.27797.75917.stgit@warthog.procyon.org.uk> References: <20160229182136.27797.75917.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 29 Feb 2016 18:21:58 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add key identifier pointers to public_key_signature struct so that they can be used to retain the identifier of the key to be used to verify the signature in both PKCS#7 and X.509. Signed-off-by: David Howells --- crypto/asymmetric_keys/signature.c | 4 ++++ include/crypto/public_key.h | 1 + 2 files changed, 5 insertions(+) diff --git a/crypto/asymmetric_keys/signature.c b/crypto/asymmetric_keys/signature.c index 3beee3976ed5..11b7ba170904 100644 --- a/crypto/asymmetric_keys/signature.c +++ b/crypto/asymmetric_keys/signature.c @@ -24,7 +24,11 @@ */ void public_key_signature_free(struct public_key_signature *sig) { + int i; + if (sig) { + for (i = 0; i < ARRAY_SIZE(sig->auth_ids); i++) + kfree(sig->auth_ids[i]); kfree(sig->s); kfree(sig->digest); kfree(sig); diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h index 19f557ca50ba..2f5de5c1a3a0 100644 --- a/include/crypto/public_key.h +++ b/include/crypto/public_key.h @@ -47,6 +47,7 @@ extern void public_key_free(struct public_key *key); * Public key cryptography signature data */ struct public_key_signature { + struct asymmetric_key_id *auth_ids[2]; u8 *s; /* Signature */ u32 s_size; /* Number of bytes in signature */ u8 *digest;