.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
---|
1 | 2 | /* Asymmetric public-key algorithm definitions |
---|
2 | 3 | * |
---|
3 | | - * See Documentation/crypto/asymmetric-keys.txt |
---|
| 4 | + * See Documentation/crypto/asymmetric-keys.rst |
---|
4 | 5 | * |
---|
5 | 6 | * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved. |
---|
6 | 7 | * 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. |
---|
12 | 8 | */ |
---|
13 | 9 | |
---|
14 | 10 | #ifndef _LINUX_PUBLIC_KEY_H |
---|
15 | 11 | #define _LINUX_PUBLIC_KEY_H |
---|
| 12 | + |
---|
| 13 | +#include <linux/keyctl.h> |
---|
| 14 | +#include <linux/oid_registry.h> |
---|
| 15 | +#include <crypto/akcipher.h> |
---|
16 | 16 | |
---|
17 | 17 | /* |
---|
18 | 18 | * Cryptographic data for the public-key subtype of the asymmetric key type. |
---|
.. | .. |
---|
23 | 23 | struct public_key { |
---|
24 | 24 | void *key; |
---|
25 | 25 | u32 keylen; |
---|
| 26 | + enum OID algo; |
---|
| 27 | + void *params; |
---|
| 28 | + u32 paramlen; |
---|
| 29 | + bool key_is_private; |
---|
26 | 30 | const char *id_type; |
---|
27 | 31 | const char *pkey_algo; |
---|
28 | 32 | }; |
---|
.. | .. |
---|
35 | 39 | struct public_key_signature { |
---|
36 | 40 | struct asymmetric_key_id *auth_ids[2]; |
---|
37 | 41 | u8 *s; /* Signature */ |
---|
38 | | - u8 *digest; |
---|
39 | 42 | 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 */ |
---|
41 | 45 | const char *pkey_algo; |
---|
42 | 46 | const char *hash_algo; |
---|
| 47 | + const char *encoding; |
---|
| 48 | + const void *data; |
---|
| 49 | + unsigned int data_size; |
---|
43 | 50 | }; |
---|
44 | 51 | |
---|
45 | 52 | extern void public_key_signature_free(struct public_key_signature *sig); |
---|
.. | .. |
---|
65 | 72 | const union key_payload *payload, |
---|
66 | 73 | struct key *trusted); |
---|
67 | 74 | |
---|
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 *); |
---|
70 | 83 | |
---|
71 | 84 | int public_key_verify_signature(const struct public_key *pkey, |
---|
72 | 85 | const struct public_key_signature *sig); |
---|