From: Denis Kenzior <denkenz@gmail.com>
To: ell@lists.01.org
Subject: Re: [PATCH 2/5] key: Make key/keychain revocation optional when freeing
Date: Mon, 24 Oct 2016 14:07:24 -0500 [thread overview]
Message-ID: <580E5BEC.3080305@gmail.com> (raw)
In-Reply-To: <5CE59FE0-3C49-4E4E-B175-D4A8DF4D32FF@holtmann.org>
[-- Attachment #1: Type: text/plain, Size: 1710 bytes --]
Hi Mat,
On 10/24/2016 01:55 PM, Marcel Holtmann wrote:
> Hi Mat,
>
>> Revoking keys (or keyrings) unlinks them any keyring. Sometimes it is
>> useful to let the kernel keep a key linked even if ELL isn't directly
>> keeping track of that key anymore - for example, a keyring of trusted
>> keys can be used for validation without keeping l_key objects around for
>> every single key in that keyring. The kernel will clean up the kernel
>> key objects when there are no more references to them whether or not we
>> explicitly revoke from userspace.
>> ---
>> ell/key.c | 14 ++++++++++----
>> ell/key.h | 4 ++--
>> ell/tls.c | 6 +++---
>> 3 files changed, 15 insertions(+), 9 deletions(-)
>>
>> diff --git a/ell/key.c b/ell/key.c
>> index 4cf2307..4225271 100644
>> --- a/ell/key.c
>> +++ b/ell/key.c
>> @@ -276,12 +276,15 @@ LIB_EXPORT struct l_key *l_key_new(enum l_key_type type, const void *payload,
>> return key;
>> }
>>
>> -LIB_EXPORT void l_key_free(struct l_key *key)
>> +LIB_EXPORT void l_key_free(struct l_key *key, bool revoke)
>> {
>
> I am not a huge fan of glueing on booleans to simple functions like l_key_free. They should be doing one thing and one thing only. Frankly later on nobody remembers what the difference between l_key_free(x, true) and l_key_free(x, false) was. It becomes to cumbersome to read and remember in application code.
>
> So why not use l_key_free(x) and then introduce l_key_revoke_and_free(x). Or just simply go with l_key_revoke(x) and have the API description be clear that it also frees the key.
>
+1. Although we do have precedent for this in l_string_free, but that
is mostly how GLib API was done.
Regards,
-Denis
next prev parent reply other threads:[~2016-10-24 19:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-24 18:44 [PATCH 1/5] util: Remove semicolons in single-statement macros Mat Martineau
2016-10-24 18:44 ` [PATCH 2/5] key: Make key/keychain revocation optional when freeing Mat Martineau
2016-10-24 18:47 ` Mat Martineau
2016-10-24 18:55 ` Marcel Holtmann
2016-10-24 19:07 ` Denis Kenzior [this message]
2016-10-24 20:34 ` Mat Martineau
2016-10-24 20:39 ` Marcel Holtmann
2016-10-24 20:45 ` Denis Kenzior
2016-10-24 18:44 ` [PATCH 3/5] unit: Update for new l_key_free/l_keyring_free revoke parameter Mat Martineau
2016-10-24 18:44 ` [PATCH 4/5] tls: Validate cert chain using l_keyring Mat Martineau
2016-10-24 18:44 ` [PATCH 5/5] unit: Fix memory leak in trust chain test Mat Martineau
2016-10-24 19:06 ` [PATCH 1/5] util: Remove semicolons in single-statement macros Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=580E5BEC.3080305@gmail.com \
--to=denkenz@gmail.com \
--cc=ell@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.