hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/include/crypto/public_key.h
....@@ -1,18 +1,18 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /* Asymmetric public-key algorithm definitions
23 *
3
- * See Documentation/crypto/asymmetric-keys.txt
4
+ * See Documentation/crypto/asymmetric-keys.rst
45 *
56 * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
67 * Written by David Howells (dhowells@redhat.com)
7
- *
8
- * This program is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU General Public Licence
10
- * as published by the Free Software Foundation; either version
11
- * 2 of the Licence, or (at your option) any later version.
128 */
139
1410 #ifndef _LINUX_PUBLIC_KEY_H
1511 #define _LINUX_PUBLIC_KEY_H
12
+
13
+#include <linux/keyctl.h>
14
+#include <linux/oid_registry.h>
15
+#include <crypto/akcipher.h>
1616
1717 /*
1818 * Cryptographic data for the public-key subtype of the asymmetric key type.
....@@ -23,6 +23,10 @@
2323 struct public_key {
2424 void *key;
2525 u32 keylen;
26
+ enum OID algo;
27
+ void *params;
28
+ u32 paramlen;
29
+ bool key_is_private;
2630 const char *id_type;
2731 const char *pkey_algo;
2832 };
....@@ -35,11 +39,14 @@
3539 struct public_key_signature {
3640 struct asymmetric_key_id *auth_ids[2];
3741 u8 *s; /* Signature */
38
- u8 *digest;
3942 u32 s_size; /* Number of bytes in signature */
40
- u32 digest_size; /* Number of bytes in digest */
43
+ u8 *digest;
44
+ u8 digest_size; /* Number of bytes in digest */
4145 const char *pkey_algo;
4246 const char *hash_algo;
47
+ const char *encoding;
48
+ const void *data;
49
+ unsigned int data_size;
4350 };
4451
4552 extern void public_key_signature_free(struct public_key_signature *sig);
....@@ -65,8 +72,14 @@
6572 const union key_payload *payload,
6673 struct key *trusted);
6774
68
-extern int verify_signature(const struct key *key,
69
- const struct public_key_signature *sig);
75
+extern int query_asymmetric_key(const struct kernel_pkey_params *,
76
+ struct kernel_pkey_query *);
77
+
78
+extern int encrypt_blob(struct kernel_pkey_params *, const void *, void *);
79
+extern int decrypt_blob(struct kernel_pkey_params *, const void *, void *);
80
+extern int create_signature(struct kernel_pkey_params *, const void *, void *);
81
+extern int verify_signature(const struct key *,
82
+ const struct public_key_signature *);
7083
7184 int public_key_verify_signature(const struct public_key *pkey,
7285 const struct public_key_signature *sig);