summaryrefslogtreecommitdiff
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
commit18f467573e22d9bb30ac7413d49a2c0390ab98bf (patch)
tree4d9839e79054c112a4a696dd530b7a1e9674d8e2 /crypto/asymmetric_keys/signature.c
parent71fa9da584f355f7089f91c27496f5b3ce5dcec2 (diff)
downloadlinux-crypto-18f467573e22d9bb30ac7413d49a2c0390ab98bf.tar.gz
linux-crypto-18f467573e22d9bb30ac7413d49a2c0390ab98bf.zip
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 004d5fc8..3beee397 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