]> git.karo-electronics.de Git - karo-tx-linux.git/commit
X.509: Implement simple static OID registry
authorDavid Howells <dhowells@redhat.com>
Fri, 21 Sep 2012 22:30:46 +0000 (23:30 +0100)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 28 Sep 2012 05:14:53 +0000 (14:44 +0930)
commit98ad56fc46ec36246953293c3bbe5c17df16a566
treea1e8138b209179ce5790d24feba5d888693edfab
parenta94275f24f30c4e9acabf853aa016232c507c75e
X.509: Implement simple static OID registry

Implement a simple static OID registry that allows the mapping of an encoded
OID to an enum value for ease of use.

The OID registry index enum appears in the:

linux/oid_registry.h

header file.  A script generates the registry from lines in the header file
that look like:

<sp*>OID_foo,<sp*>/*<sp*>1.2.3.4<sp*>*/

The actual OID is taken to be represented by the numbers with interpolated
dots in the comment.

All other lines in the header are ignored.

The registry is queries by calling:

OID look_up_oid(const void *data, size_t datasize);

This returns a number from the registry enum representing the OID if found or
OID__NR if not.

Signed-off-by: David Howells <dhowells@redhat.com>
include/linux/oid_registry.h [new file with mode: 0644]
lib/.gitignore
lib/Kconfig
lib/Makefile
lib/build_OID_registry [new file with mode: 0755]
lib/oid_registry.c [new file with mode: 0644]