summaryrefslogtreecommitdiffstats
path: root/crypto/asymmetric_keys/signature.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2016-04-06 16:13:33 +0100
committerDavid Howells <dhowells@redhat.com>2016-04-06 16:13:33 +0100
commit3b764563177c1e435ef3e2608271c07955f73ea6 (patch)
tree6c2c109d6fdde374e9a514976f49e236f79459f4 /crypto/asymmetric_keys/signature.c
parent864e7a816a0646a6d9aecbd59a8e366c39b8ad2d (diff)
downloadop-kernel-dev-3b764563177c1e435ef3e2608271c07955f73ea6.zip
op-kernel-dev-3b764563177c1e435ef3e2608271c07955f73ea6.tar.gz
KEYS: Allow authentication data to be stored in an asymmetric key
Allow authentication data to be stored in an asymmetric key in the 4th element of the key payload and provide a way for it to be destroyed. For the public key subtype, this will be a public_key_signature struct. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'crypto/asymmetric_keys/signature.c')
-rw-r--r--crypto/asymmetric_keys/signature.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/crypto/asymmetric_keys/signature.c b/crypto/asymmetric_keys/signature.c
index 004d5fc..3beee39 100644
--- a/crypto/asymmetric_keys/signature.c
+++ b/crypto/asymmetric_keys/signature.c
@@ -15,9 +15,23 @@
#include <keys/asymmetric-subtype.h>
#include <linux/export.h>
#include <linux/err.h>
+#include <linux/slab.h>
#include <crypto/public_key.h>
#include "asymmetric_keys.h"
+/*
+ * Destroy a public key signature.
+ */
+void public_key_signature_free(struct public_key_signature *sig)
+{
+ if (sig) {
+ kfree(sig->s);
+ kfree(sig->digest);
+ kfree(sig);
+ }
+}
+EXPORT_SYMBOL_GPL(public_key_signature_free);
+
/**
* verify_signature - Initiate the use of an asymmetric key to verify a signature
* @key: The asymmetric key to verify against
OpenPOWER on IntegriCloud