[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ace09744-e6c9-32da-27d8-accadd5d0252@linux.ibm.com>
Date: Mon, 1 Feb 2021 08:02:21 -0500
From: Stefan Berger <stefanb@...ux.ibm.com>
To: Tianjia Zhang <tianjia.zhang@...ux.alibaba.com>,
keyrings@...r.kernel.org, linux-crypto@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, patrick@...terwijk.org,
linux-integrity@...r.kernel.org,
David Howells <dhowells@...hat.com>
Subject: Re: [PATCH v6 2/4] x509: Detect sm2 keys by their parameters OID
On 2/1/21 5:39 AM, Tianjia Zhang wrote:
>
>> index f7ad43f28579..508e0b34b5f0 100644
>> --- a/lib/oid_registry.c
>> +++ b/lib/oid_registry.c
>> @@ -11,6 +11,7 @@
>> #include <linux/kernel.h>
>> #include <linux/errno.h>
>> #include <linux/bug.h>
>> +#include <linux/asn1.h>
>> #include "oid_registry_data.c"
>> MODULE_DESCRIPTION("OID Registry");
>> @@ -92,6 +93,18 @@ enum OID look_up_OID(const void *data, size_t
>> datasize)
>> }
>> EXPORT_SYMBOL_GPL(look_up_OID);
>> +int parse_OID(const void *data, size_t datasize, enum OID *oid)
>> +{
>> + const unsigned char *v = data;
>> +
>> + if (datasize < 2 || v[0] != ASN1_OID || v[1] != datasize - 2)
>> + return -EBADMSG;
>> +
>> + *oid = look_up_OID(data + 2, datasize - 2);
>> + return 0;
>> +}
>> +EXPORT_SYMBOL_GPL(parse_OID);
>> +
>> /*
>> * sprint_OID - Print an Object Identifier into a buffer
>> * @data: The encoded OID to print
>>
>
> Great job, I'm just curious why we need to add a new function, this
> seems unnecessary, if possible, please add
Thanks. I call this function in two places now. I thought it was 'worth it'.
>
> Reviewed-by: Tianjia Zhang <tianjia.zhang@...ux.alibaba.com>
>
> Best regards,
> Tianjia
Powered by blists - more mailing lists