Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[cascardo/linux.git] / crypto / asymmetric_keys / signature.c
index 004d5fc..11b7ba1 100644 (file)
 #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)
+{
+       int i;
+
+       if (sig) {
+               for (i = 0; i < ARRAY_SIZE(sig->auth_ids); i++)
+                       kfree(sig->auth_ids[i]);
+               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