Linux Audio

Check our new training course

Loading...
v5.9
  1/* SPDX-License-Identifier: GPL-2.0-or-later */
  2/*
  3 * Quick & dirty crypto testing module.
  4 *
  5 * This will only exist until we have a better testing mechanism
  6 * (e.g. a char device).
  7 *
  8 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
  9 * Copyright (c) 2002 Jean-Francois Dive <jef@linuxbe.org>
 10 * Copyright (c) 2007 Nokia Siemens Networks
 
 
 
 
 
 
 11 */
 12#ifndef _CRYPTO_TCRYPT_H
 13#define _CRYPTO_TCRYPT_H
 14
 15struct cipher_speed_template {
 16	const char *key;
 17	unsigned int klen;
 18};
 19
 20struct aead_speed_template {
 21	const char *key;
 22	unsigned int klen;
 23};
 24
 25struct hash_speed {
 26	unsigned int blen;	/* buffer length */
 27	unsigned int plen;	/* per-update length */
 28	unsigned int klen;	/* key length */
 29};
 30
 31/*
 32 * DES test vectors.
 33 */
 34#define DES3_SPEED_VECTORS	1
 35
 36static struct cipher_speed_template des3_speed_template[] = {
 37	{
 38		.key	= "\x01\x23\x45\x67\x89\xab\xcd\xef"
 39			  "\x55\x55\x55\x55\x55\x55\x55\x55"
 40			  "\xfe\xdc\xba\x98\x76\x54\x32\x10",
 41		.klen	= 24,
 42	}
 43};
 44
 45/*
 46 * Cipher speed tests
 47 */
 48static u8 speed_template_8[] = {8, 0};
 49static u8 speed_template_16[] = {16, 0};
 50static u8 speed_template_24[] = {24, 0};
 51static u8 speed_template_8_16[] = {8, 16, 0};
 52static u8 speed_template_8_32[] = {8, 32, 0};
 53static u8 speed_template_16_32[] = {16, 32, 0};
 54static u8 speed_template_16_24_32[] = {16, 24, 32, 0};
 55static u8 speed_template_20_28_36[] = {20, 28, 36, 0};
 56static u8 speed_template_32_40_48[] = {32, 40, 48, 0};
 57static u8 speed_template_32_48[] = {32, 48, 0};
 58static u8 speed_template_32_48_64[] = {32, 48, 64, 0};
 59static u8 speed_template_32_64[] = {32, 64, 0};
 60static u8 speed_template_32[] = {32, 0};
 61
 62/*
 63 * AEAD speed tests
 64 */
 65static u8 aead_speed_template_19[] = {19, 0};
 66static u8 aead_speed_template_20[] = {20, 0};
 67static u8 aead_speed_template_36[] = {36, 0};
 68
 69/*
 70 * Digest speed tests
 71 */
 72static struct hash_speed generic_hash_speed_template[] = {
 73	{ .blen = 16,	.plen = 16, },
 74	{ .blen = 64,	.plen = 16, },
 75	{ .blen = 64,	.plen = 64, },
 76	{ .blen = 256,	.plen = 16, },
 77	{ .blen = 256,	.plen = 64, },
 78	{ .blen = 256,	.plen = 256, },
 79	{ .blen = 1024,	.plen = 16, },
 80	{ .blen = 1024,	.plen = 256, },
 81	{ .blen = 1024,	.plen = 1024, },
 82	{ .blen = 2048,	.plen = 16, },
 83	{ .blen = 2048,	.plen = 256, },
 84	{ .blen = 2048,	.plen = 1024, },
 85	{ .blen = 2048,	.plen = 2048, },
 86	{ .blen = 4096,	.plen = 16, },
 87	{ .blen = 4096,	.plen = 256, },
 88	{ .blen = 4096,	.plen = 1024, },
 89	{ .blen = 4096,	.plen = 4096, },
 90	{ .blen = 8192,	.plen = 16, },
 91	{ .blen = 8192,	.plen = 256, },
 92	{ .blen = 8192,	.plen = 1024, },
 93	{ .blen = 8192,	.plen = 4096, },
 94	{ .blen = 8192,	.plen = 8192, },
 95
 96	/* End marker */
 97	{  .blen = 0,	.plen = 0, }
 98};
 99
100static struct hash_speed hash_speed_template_16[] = {
101	{ .blen = 16,	.plen = 16,	.klen = 16, },
102	{ .blen = 64,	.plen = 16,	.klen = 16, },
103	{ .blen = 64,	.plen = 64,	.klen = 16, },
104	{ .blen = 256,	.plen = 16,	.klen = 16, },
105	{ .blen = 256,	.plen = 64,	.klen = 16, },
106	{ .blen = 256,	.plen = 256,	.klen = 16, },
107	{ .blen = 1024,	.plen = 16,	.klen = 16, },
108	{ .blen = 1024,	.plen = 256,	.klen = 16, },
109	{ .blen = 1024,	.plen = 1024,	.klen = 16, },
110	{ .blen = 2048,	.plen = 16,	.klen = 16, },
111	{ .blen = 2048,	.plen = 256,	.klen = 16, },
112	{ .blen = 2048,	.plen = 1024,	.klen = 16, },
113	{ .blen = 2048,	.plen = 2048,	.klen = 16, },
114	{ .blen = 4096,	.plen = 16,	.klen = 16, },
115	{ .blen = 4096,	.plen = 256,	.klen = 16, },
116	{ .blen = 4096,	.plen = 1024,	.klen = 16, },
117	{ .blen = 4096,	.plen = 4096,	.klen = 16, },
118	{ .blen = 8192,	.plen = 16,	.klen = 16, },
119	{ .blen = 8192,	.plen = 256,	.klen = 16, },
120	{ .blen = 8192,	.plen = 1024,	.klen = 16, },
121	{ .blen = 8192,	.plen = 4096,	.klen = 16, },
122	{ .blen = 8192,	.plen = 8192,	.klen = 16, },
123
124	/* End marker */
125	{  .blen = 0,	.plen = 0,	.klen = 0, }
126};
127
128static struct hash_speed poly1305_speed_template[] = {
129	{ .blen = 96,	.plen = 16, },
130	{ .blen = 96,	.plen = 32, },
131	{ .blen = 96,	.plen = 96, },
132	{ .blen = 288,	.plen = 16, },
133	{ .blen = 288,	.plen = 32, },
134	{ .blen = 288,	.plen = 288, },
135	{ .blen = 1056,	.plen = 32, },
136	{ .blen = 1056,	.plen = 1056, },
137	{ .blen = 2080,	.plen = 32, },
138	{ .blen = 2080,	.plen = 2080, },
139	{ .blen = 4128,	.plen = 4128, },
140	{ .blen = 8224,	.plen = 8224, },
141
142	/* End marker */
143	{  .blen = 0,	.plen = 0, }
144};
145
146#endif	/* _CRYPTO_TCRYPT_H */
v3.1
 
  1/*
  2 * Quick & dirty crypto testing module.
  3 *
  4 * This will only exist until we have a better testing mechanism
  5 * (e.g. a char device).
  6 *
  7 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
  8 * Copyright (c) 2002 Jean-Francois Dive <jef@linuxbe.org>
  9 * Copyright (c) 2007 Nokia Siemens Networks
 10 *
 11 * This program is free software; you can redistribute it and/or modify it
 12 * under the terms of the GNU General Public License as published by the Free
 13 * Software Foundation; either version 2 of the License, or (at your option)
 14 * any later version.
 15 *
 16 */
 17#ifndef _CRYPTO_TCRYPT_H
 18#define _CRYPTO_TCRYPT_H
 19
 20struct cipher_speed_template {
 21	const char *key;
 22	unsigned int klen;
 23};
 24
 
 
 
 
 
 25struct hash_speed {
 26	unsigned int blen;	/* buffer length */
 27	unsigned int plen;	/* per-update length */
 28	unsigned int klen;	/* key length */
 29};
 30
 31/*
 32 * DES test vectors.
 33 */
 34#define DES3_SPEED_VECTORS	1
 35
 36static struct cipher_speed_template des3_speed_template[] = {
 37	{
 38		.key	= "\x01\x23\x45\x67\x89\xab\xcd\xef"
 39			  "\x55\x55\x55\x55\x55\x55\x55\x55"
 40			  "\xfe\xdc\xba\x98\x76\x54\x32\x10",
 41		.klen	= 24,
 42	}
 43};
 44
 45/*
 46 * Cipher speed tests
 47 */
 48static u8 speed_template_8[] = {8, 0};
 
 49static u8 speed_template_24[] = {24, 0};
 
 50static u8 speed_template_8_32[] = {8, 32, 0};
 51static u8 speed_template_16_32[] = {16, 32, 0};
 52static u8 speed_template_16_24_32[] = {16, 24, 32, 0};
 
 53static u8 speed_template_32_40_48[] = {32, 40, 48, 0};
 
 54static u8 speed_template_32_48_64[] = {32, 48, 64, 0};
 
 
 
 
 
 
 
 
 
 55
 56/*
 57 * Digest speed tests
 58 */
 59static struct hash_speed generic_hash_speed_template[] = {
 60	{ .blen = 16,	.plen = 16, },
 61	{ .blen = 64,	.plen = 16, },
 62	{ .blen = 64,	.plen = 64, },
 63	{ .blen = 256,	.plen = 16, },
 64	{ .blen = 256,	.plen = 64, },
 65	{ .blen = 256,	.plen = 256, },
 66	{ .blen = 1024,	.plen = 16, },
 67	{ .blen = 1024,	.plen = 256, },
 68	{ .blen = 1024,	.plen = 1024, },
 69	{ .blen = 2048,	.plen = 16, },
 70	{ .blen = 2048,	.plen = 256, },
 71	{ .blen = 2048,	.plen = 1024, },
 72	{ .blen = 2048,	.plen = 2048, },
 73	{ .blen = 4096,	.plen = 16, },
 74	{ .blen = 4096,	.plen = 256, },
 75	{ .blen = 4096,	.plen = 1024, },
 76	{ .blen = 4096,	.plen = 4096, },
 77	{ .blen = 8192,	.plen = 16, },
 78	{ .blen = 8192,	.plen = 256, },
 79	{ .blen = 8192,	.plen = 1024, },
 80	{ .blen = 8192,	.plen = 4096, },
 81	{ .blen = 8192,	.plen = 8192, },
 82
 83	/* End marker */
 84	{  .blen = 0,	.plen = 0, }
 85};
 86
 87static struct hash_speed hash_speed_template_16[] = {
 88	{ .blen = 16,	.plen = 16,	.klen = 16, },
 89	{ .blen = 64,	.plen = 16,	.klen = 16, },
 90	{ .blen = 64,	.plen = 64,	.klen = 16, },
 91	{ .blen = 256,	.plen = 16,	.klen = 16, },
 92	{ .blen = 256,	.plen = 64,	.klen = 16, },
 93	{ .blen = 256,	.plen = 256,	.klen = 16, },
 94	{ .blen = 1024,	.plen = 16,	.klen = 16, },
 95	{ .blen = 1024,	.plen = 256,	.klen = 16, },
 96	{ .blen = 1024,	.plen = 1024,	.klen = 16, },
 97	{ .blen = 2048,	.plen = 16,	.klen = 16, },
 98	{ .blen = 2048,	.plen = 256,	.klen = 16, },
 99	{ .blen = 2048,	.plen = 1024,	.klen = 16, },
100	{ .blen = 2048,	.plen = 2048,	.klen = 16, },
101	{ .blen = 4096,	.plen = 16,	.klen = 16, },
102	{ .blen = 4096,	.plen = 256,	.klen = 16, },
103	{ .blen = 4096,	.plen = 1024,	.klen = 16, },
104	{ .blen = 4096,	.plen = 4096,	.klen = 16, },
105	{ .blen = 8192,	.plen = 16,	.klen = 16, },
106	{ .blen = 8192,	.plen = 256,	.klen = 16, },
107	{ .blen = 8192,	.plen = 1024,	.klen = 16, },
108	{ .blen = 8192,	.plen = 4096,	.klen = 16, },
109	{ .blen = 8192,	.plen = 8192,	.klen = 16, },
110
111	/* End marker */
112	{  .blen = 0,	.plen = 0,	.klen = 0, }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113};
114
115#endif	/* _CRYPTO_TCRYPT_H */