Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /* keyctl kernel bits
0003  *
0004  * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
0005  * Written by David Howells (dhowells@redhat.com)
0006  */
0007 
0008 #ifndef __LINUX_KEYCTL_H
0009 #define __LINUX_KEYCTL_H
0010 
0011 #include <uapi/linux/keyctl.h>
0012 
0013 struct kernel_pkey_query {
0014     __u32       supported_ops;  /* Which ops are supported */
0015     __u32       key_size;   /* Size of the key in bits */
0016     __u16       max_data_size;  /* Maximum size of raw data to sign in bytes */
0017     __u16       max_sig_size;   /* Maximum size of signature in bytes */
0018     __u16       max_enc_size;   /* Maximum size of encrypted blob in bytes */
0019     __u16       max_dec_size;   /* Maximum size of decrypted blob in bytes */
0020 };
0021 
0022 enum kernel_pkey_operation {
0023     kernel_pkey_encrypt,
0024     kernel_pkey_decrypt,
0025     kernel_pkey_sign,
0026     kernel_pkey_verify,
0027 };
0028 
0029 struct kernel_pkey_params {
0030     struct key  *key;
0031     const char  *encoding;  /* Encoding (eg. "oaep" or "raw" for none) */
0032     const char  *hash_algo; /* Digest algorithm used (eg. "sha1") or NULL if N/A */
0033     char        *info;      /* Modified info string to be released later */
0034     __u32       in_len;     /* Input data size */
0035     union {
0036         __u32   out_len;    /* Output buffer size (enc/dec/sign) */
0037         __u32   in2_len;    /* 2nd input data size (verify) */
0038     };
0039     enum kernel_pkey_operation op : 8;
0040 };
0041 
0042 #endif /* __LINUX_KEYCTL_H */