From: David Howells Subject: Re: [GIT PULL] Asymmetric keys and module signing Date: Tue, 25 Sep 2012 17:15:06 +0100 Message-ID: <8373.1348589706@warthog.procyon.org.uk> References: <5555.1348531649@warthog.procyon.org.uk> Cc: dhowells@redhat.com, herbert@gondor.hengli.com.au, rusty@rustcorp.com.au, pjones@redhat.com, jwboyer@redhat.com, linux-crypto@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, keyrings@linux-nfs.org To: "Kasatkin, Dmitry" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:64206 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758162Ab2IYQPR (ORCPT ); Tue, 25 Sep 2012 12:15:17 -0400 In-Reply-To: Sender: linux-crypto-owner@vger.kernel.org List-ID: Kasatkin, Dmitry wrote: > Just one question about key description... > request_asymmetric_key uses format for key description: ": ". > Preparsing code creates description from those values. > I see that key id is not 8 bytes anymore but full hash size of 20 bytes. Remember: This is for viewing via /proc/keys and KEYCTL_DESCRIBE as much as for matching. > For practical reasons for IMA it might be nice to save some space in > xattrs and use shorter key id/description. That's reasonable. > As I understand from implementation, if key name is provided with "keyctl > add", it will not be replaced with preparsed value. Correct. > And we can actually use any keyid we want? Yes. Note: The key type ->match() function is not required to limit itself to a direct strcmp(). It is at liberty to partially match the description or any other data attached to the key. Look at asymmetric_key_match() in crypto/asymmetric/asymmetric_type.c. If you do a search for: "id:" this will do a partial tail match on the key fingerprint: [root@andromeda ~]# keyctl padd asymmetric "" @s type_data.p[1]). The type match function can only take text strings as it has to be invoked from userspace. David