Merge remote-tracking branch 'selinux/next'
[deliverable/linux.git] / include / crypto / public_key.h
CommitLineData
a9681bf3
DH
1/* Asymmetric public-key algorithm definitions
2 *
3 * See Documentation/crypto/asymmetric-keys.txt
4 *
5 * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
6 * 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 */
13
14#ifndef _LINUX_PUBLIC_KEY_H
15#define _LINUX_PUBLIC_KEY_H
16
d9af2063
DH
17#include <linux/keyctl.h>
18
a9681bf3
DH
19/*
20 * Cryptographic data for the public-key subtype of the asymmetric key type.
21 *
22 * Note that this may include private part of the key as well as the public
23 * part.
24 */
25struct public_key {
db6c43bd
TS
26 void *key;
27 u32 keylen;
b19b107b 28 bool key_is_private;
4e8ae72a
DH
29 const char *id_type;
30 const char *pkey_algo;
a9681bf3
DH
31};
32
3b764563 33extern void public_key_free(struct public_key *key);
a9681bf3
DH
34
35/*
36 * Public key cryptography signature data
37 */
38struct public_key_signature {
a022ec02 39 struct asymmetric_key_id *auth_ids[2];
db6c43bd
TS
40 u8 *s; /* Signature */
41 u32 s_size; /* Number of bytes in signature */
a9681bf3 42 u8 *digest;
d846e78e 43 u8 digest_size; /* Number of bytes in digest */
4e8ae72a
DH
44 const char *pkey_algo;
45 const char *hash_algo;
d9af2063 46 const char *encoding;
a9681bf3
DH
47};
48
3b764563
DH
49extern void public_key_signature_free(struct public_key_signature *sig);
50
db6c43bd 51extern struct asymmetric_key_subtype public_key_subtype;
3b764563 52
4ae71c1d 53struct key;
a511e1af
DH
54struct key_type;
55union key_payload;
56
57extern int restrict_link_by_signature(struct key *trust_keyring,
58 const struct key_type *type,
59 const union key_payload *payload);
60
d9af2063
DH
61extern int query_asymmetric_key(const struct kernel_pkey_params *,
62 struct kernel_pkey_query *);
63
64extern int encrypt_blob(struct kernel_pkey_params *, const void *, void *);
65extern int decrypt_blob(struct kernel_pkey_params *, const void *, void *);
66extern int create_signature(struct kernel_pkey_params *, const void *, void *);
67extern int verify_signature(const struct key *,
68 const struct public_key_signature *);
4ae71c1d 69
db6c43bd
TS
70int public_key_verify_signature(const struct public_key *pkey,
71 const struct public_key_signature *sig);
72
a9681bf3 73#endif /* _LINUX_PUBLIC_KEY_H */
This page took 0.139823 seconds and 5 git commands to generate.