2017-11-01 21:09:13 +07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
2011-09-27 12:23:50 +07:00
|
|
|
/*
|
|
|
|
* Crypto user configuration API.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 secunet Security Networks AG
|
|
|
|
* Copyright (C) 2011 Steffen Klassert <steffen.klassert@secunet.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
uapi: includes linux/types.h before exporting files
Some files will be exported after a following patch. 0-day tests report the
following warning/error:
./usr/include/linux/bcache.h:8: include of <linux/types.h> is preferred over <asm/types.h>
./usr/include/linux/bcache.h:11: found __[us]{8,16,32,64} type without #include <linux/types.h>
./usr/include/linux/qrtr.h:8: found __[us]{8,16,32,64} type without #include <linux/types.h>
./usr/include/linux/cryptouser.h:39: found __[us]{8,16,32,64} type without #include <linux/types.h>
./usr/include/linux/pr.h:14: found __[us]{8,16,32,64} type without #include <linux/types.h>
./usr/include/linux/btrfs_tree.h:337: found __[us]{8,16,32,64} type without #include <linux/types.h>
./usr/include/rdma/bnxt_re-abi.h:45: found __[us]{8,16,32,64} type without #include <linux/types.h>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-03-27 19:20:11 +07:00
|
|
|
#include <linux/types.h>
|
|
|
|
|
2011-09-27 12:23:50 +07:00
|
|
|
/* Netlink configuration messages. */
|
|
|
|
enum {
|
|
|
|
CRYPTO_MSG_BASE = 0x10,
|
|
|
|
CRYPTO_MSG_NEWALG = 0x10,
|
|
|
|
CRYPTO_MSG_DELALG,
|
|
|
|
CRYPTO_MSG_UPDATEALG,
|
|
|
|
CRYPTO_MSG_GETALG,
|
2015-06-21 18:11:45 +07:00
|
|
|
CRYPTO_MSG_DELRNG,
|
2018-09-19 17:10:54 +07:00
|
|
|
CRYPTO_MSG_GETSTAT,
|
2011-09-27 12:23:50 +07:00
|
|
|
__CRYPTO_MSG_MAX
|
|
|
|
};
|
|
|
|
#define CRYPTO_MSG_MAX (__CRYPTO_MSG_MAX - 1)
|
|
|
|
#define CRYPTO_NR_MSGTYPES (CRYPTO_MSG_MAX + 1 - CRYPTO_MSG_BASE)
|
|
|
|
|
2017-04-06 15:16:08 +07:00
|
|
|
#define CRYPTO_MAX_NAME 64
|
2011-09-27 12:23:50 +07:00
|
|
|
|
|
|
|
/* Netlink message attributes. */
|
|
|
|
enum crypto_attr_type_t {
|
|
|
|
CRYPTOCFGA_UNSPEC,
|
|
|
|
CRYPTOCFGA_PRIORITY_VAL, /* __u32 */
|
2011-09-27 12:25:05 +07:00
|
|
|
CRYPTOCFGA_REPORT_LARVAL, /* struct crypto_report_larval */
|
2011-09-27 12:26:10 +07:00
|
|
|
CRYPTOCFGA_REPORT_HASH, /* struct crypto_report_hash */
|
2011-09-27 12:41:54 +07:00
|
|
|
CRYPTOCFGA_REPORT_BLKCIPHER, /* struct crypto_report_blkcipher */
|
2011-09-27 12:44:27 +07:00
|
|
|
CRYPTOCFGA_REPORT_AEAD, /* struct crypto_report_aead */
|
2011-09-27 12:46:32 +07:00
|
|
|
CRYPTOCFGA_REPORT_COMPRESS, /* struct crypto_report_comp */
|
2011-09-27 12:47:11 +07:00
|
|
|
CRYPTOCFGA_REPORT_RNG, /* struct crypto_report_rng */
|
2011-09-27 12:48:01 +07:00
|
|
|
CRYPTOCFGA_REPORT_CIPHER, /* struct crypto_report_cipher */
|
2015-06-17 00:30:55 +07:00
|
|
|
CRYPTOCFGA_REPORT_AKCIPHER, /* struct crypto_report_akcipher */
|
2016-06-22 23:49:13 +07:00
|
|
|
CRYPTOCFGA_REPORT_KPP, /* struct crypto_report_kpp */
|
2016-10-21 19:19:47 +07:00
|
|
|
CRYPTOCFGA_REPORT_ACOMP, /* struct crypto_report_acomp */
|
2018-09-19 17:10:54 +07:00
|
|
|
CRYPTOCFGA_STAT_LARVAL, /* struct crypto_stat */
|
|
|
|
CRYPTOCFGA_STAT_HASH, /* struct crypto_stat */
|
|
|
|
CRYPTOCFGA_STAT_BLKCIPHER, /* struct crypto_stat */
|
|
|
|
CRYPTOCFGA_STAT_AEAD, /* struct crypto_stat */
|
|
|
|
CRYPTOCFGA_STAT_COMPRESS, /* struct crypto_stat */
|
|
|
|
CRYPTOCFGA_STAT_RNG, /* struct crypto_stat */
|
|
|
|
CRYPTOCFGA_STAT_CIPHER, /* struct crypto_stat */
|
|
|
|
CRYPTOCFGA_STAT_AKCIPHER, /* struct crypto_stat */
|
|
|
|
CRYPTOCFGA_STAT_KPP, /* struct crypto_stat */
|
|
|
|
CRYPTOCFGA_STAT_ACOMP, /* struct crypto_stat */
|
2011-09-27 12:23:50 +07:00
|
|
|
__CRYPTOCFGA_MAX
|
|
|
|
|
|
|
|
#define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1)
|
|
|
|
};
|
|
|
|
|
|
|
|
struct crypto_user_alg {
|
2017-04-06 15:16:08 +07:00
|
|
|
char cru_name[CRYPTO_MAX_NAME];
|
|
|
|
char cru_driver_name[CRYPTO_MAX_NAME];
|
|
|
|
char cru_module_name[CRYPTO_MAX_NAME];
|
2011-09-27 12:23:50 +07:00
|
|
|
__u32 cru_type;
|
|
|
|
__u32 cru_mask;
|
|
|
|
__u32 cru_refcnt;
|
|
|
|
__u32 cru_flags;
|
|
|
|
};
|
2011-09-27 12:25:05 +07:00
|
|
|
|
2018-11-29 21:42:19 +07:00
|
|
|
struct crypto_stat_aead {
|
2018-09-19 17:10:54 +07:00
|
|
|
char type[CRYPTO_MAX_NAME];
|
2018-11-29 21:42:19 +07:00
|
|
|
__u64 stat_encrypt_cnt;
|
|
|
|
__u64 stat_encrypt_tlen;
|
|
|
|
__u64 stat_decrypt_cnt;
|
|
|
|
__u64 stat_decrypt_tlen;
|
2018-11-29 21:42:25 +07:00
|
|
|
__u64 stat_err_cnt;
|
2018-11-29 21:42:19 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct crypto_stat_akcipher {
|
|
|
|
char type[CRYPTO_MAX_NAME];
|
|
|
|
__u64 stat_encrypt_cnt;
|
|
|
|
__u64 stat_encrypt_tlen;
|
|
|
|
__u64 stat_decrypt_cnt;
|
|
|
|
__u64 stat_decrypt_tlen;
|
|
|
|
__u64 stat_verify_cnt;
|
2018-11-29 21:42:18 +07:00
|
|
|
__u64 stat_sign_cnt;
|
2018-11-29 21:42:25 +07:00
|
|
|
__u64 stat_err_cnt;
|
2018-11-29 21:42:19 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct crypto_stat_cipher {
|
|
|
|
char type[CRYPTO_MAX_NAME];
|
|
|
|
__u64 stat_encrypt_cnt;
|
|
|
|
__u64 stat_encrypt_tlen;
|
|
|
|
__u64 stat_decrypt_cnt;
|
|
|
|
__u64 stat_decrypt_tlen;
|
2018-11-29 21:42:25 +07:00
|
|
|
__u64 stat_err_cnt;
|
2018-11-29 21:42:19 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct crypto_stat_compress {
|
|
|
|
char type[CRYPTO_MAX_NAME];
|
|
|
|
__u64 stat_compress_cnt;
|
|
|
|
__u64 stat_compress_tlen;
|
|
|
|
__u64 stat_decompress_cnt;
|
|
|
|
__u64 stat_decompress_tlen;
|
2018-11-29 21:42:25 +07:00
|
|
|
__u64 stat_err_cnt;
|
2018-11-29 21:42:19 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct crypto_stat_hash {
|
|
|
|
char type[CRYPTO_MAX_NAME];
|
|
|
|
__u64 stat_hash_cnt;
|
|
|
|
__u64 stat_hash_tlen;
|
2018-11-29 21:42:25 +07:00
|
|
|
__u64 stat_err_cnt;
|
2018-11-29 21:42:19 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct crypto_stat_kpp {
|
|
|
|
char type[CRYPTO_MAX_NAME];
|
|
|
|
__u64 stat_setsecret_cnt;
|
|
|
|
__u64 stat_generate_public_key_cnt;
|
|
|
|
__u64 stat_compute_shared_secret_cnt;
|
2018-11-29 21:42:25 +07:00
|
|
|
__u64 stat_err_cnt;
|
2018-11-29 21:42:19 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct crypto_stat_rng {
|
|
|
|
char type[CRYPTO_MAX_NAME];
|
|
|
|
__u64 stat_generate_cnt;
|
|
|
|
__u64 stat_generate_tlen;
|
|
|
|
__u64 stat_seed_cnt;
|
2018-11-29 21:42:25 +07:00
|
|
|
__u64 stat_err_cnt;
|
2018-11-29 21:42:19 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct crypto_stat_larval {
|
|
|
|
char type[CRYPTO_MAX_NAME];
|
2018-09-19 17:10:54 +07:00
|
|
|
};
|
|
|
|
|
2011-09-27 12:25:05 +07:00
|
|
|
struct crypto_report_larval {
|
|
|
|
char type[CRYPTO_MAX_NAME];
|
|
|
|
};
|
2011-09-27 12:26:10 +07:00
|
|
|
|
|
|
|
struct crypto_report_hash {
|
|
|
|
char type[CRYPTO_MAX_NAME];
|
|
|
|
unsigned int blocksize;
|
|
|
|
unsigned int digestsize;
|
|
|
|
};
|
2011-09-27 12:41:54 +07:00
|
|
|
|
2011-09-27 12:48:01 +07:00
|
|
|
struct crypto_report_cipher {
|
2017-04-06 15:16:08 +07:00
|
|
|
char type[CRYPTO_MAX_NAME];
|
2011-09-27 12:48:01 +07:00
|
|
|
unsigned int blocksize;
|
|
|
|
unsigned int min_keysize;
|
|
|
|
unsigned int max_keysize;
|
|
|
|
};
|
|
|
|
|
2011-09-27 12:41:54 +07:00
|
|
|
struct crypto_report_blkcipher {
|
|
|
|
char type[CRYPTO_MAX_NAME];
|
|
|
|
char geniv[CRYPTO_MAX_NAME];
|
|
|
|
unsigned int blocksize;
|
|
|
|
unsigned int min_keysize;
|
|
|
|
unsigned int max_keysize;
|
|
|
|
unsigned int ivsize;
|
|
|
|
};
|
2011-09-27 12:44:27 +07:00
|
|
|
|
|
|
|
struct crypto_report_aead {
|
|
|
|
char type[CRYPTO_MAX_NAME];
|
|
|
|
char geniv[CRYPTO_MAX_NAME];
|
|
|
|
unsigned int blocksize;
|
|
|
|
unsigned int maxauthsize;
|
|
|
|
unsigned int ivsize;
|
|
|
|
};
|
2011-09-27 12:46:32 +07:00
|
|
|
|
|
|
|
struct crypto_report_comp {
|
|
|
|
char type[CRYPTO_MAX_NAME];
|
|
|
|
};
|
2011-09-27 12:47:11 +07:00
|
|
|
|
|
|
|
struct crypto_report_rng {
|
|
|
|
char type[CRYPTO_MAX_NAME];
|
|
|
|
unsigned int seedsize;
|
|
|
|
};
|
2012-03-29 14:04:46 +07:00
|
|
|
|
2015-06-17 00:30:55 +07:00
|
|
|
struct crypto_report_akcipher {
|
|
|
|
char type[CRYPTO_MAX_NAME];
|
|
|
|
};
|
|
|
|
|
2016-06-22 23:49:13 +07:00
|
|
|
struct crypto_report_kpp {
|
|
|
|
char type[CRYPTO_MAX_NAME];
|
|
|
|
};
|
|
|
|
|
2016-10-21 19:19:47 +07:00
|
|
|
struct crypto_report_acomp {
|
|
|
|
char type[CRYPTO_MAX_NAME];
|
|
|
|
};
|
|
|
|
|
2012-03-29 14:04:46 +07:00
|
|
|
#define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
|
|
|
|
sizeof(struct crypto_report_blkcipher))
|