Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Quick & dirty crypto testing module.
0004  *
0005  * This will only exist until we have a better testing mechanism
0006  * (e.g. a char device).
0007  *
0008  * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
0009  * Copyright (c) 2002 Jean-Francois Dive <jef@linuxbe.org>
0010  * Copyright (c) 2007 Nokia Siemens Networks
0011  */
0012 #ifndef _CRYPTO_TCRYPT_H
0013 #define _CRYPTO_TCRYPT_H
0014 
0015 struct cipher_speed_template {
0016     const char *key;
0017     unsigned int klen;
0018 };
0019 
0020 struct aead_speed_template {
0021     const char *key;
0022     unsigned int klen;
0023 };
0024 
0025 struct hash_speed {
0026     unsigned int blen;  /* buffer length */
0027     unsigned int plen;  /* per-update length */
0028 };
0029 
0030 /*
0031  * DES test vectors.
0032  */
0033 #define DES3_SPEED_VECTORS  1
0034 
0035 static struct cipher_speed_template des3_speed_template[] = {
0036     {
0037         .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef"
0038               "\x55\x55\x55\x55\x55\x55\x55\x55"
0039               "\xfe\xdc\xba\x98\x76\x54\x32\x10",
0040         .klen   = 24,
0041     }
0042 };
0043 
0044 /*
0045  * Cipher speed tests
0046  */
0047 static u8 speed_template_8[] = {8, 0};
0048 static u8 speed_template_16[] = {16, 0};
0049 static u8 speed_template_24[] = {24, 0};
0050 static u8 speed_template_8_16[] = {8, 16, 0};
0051 static u8 speed_template_8_32[] = {8, 32, 0};
0052 static u8 speed_template_16_32[] = {16, 32, 0};
0053 static u8 speed_template_16_24_32[] = {16, 24, 32, 0};
0054 static u8 speed_template_20_28_36[] = {20, 28, 36, 0};
0055 static u8 speed_template_32_40_48[] = {32, 40, 48, 0};
0056 static u8 speed_template_32_48[] = {32, 48, 0};
0057 static u8 speed_template_32_48_64[] = {32, 48, 64, 0};
0058 static u8 speed_template_32_64[] = {32, 64, 0};
0059 static u8 speed_template_32[] = {32, 0};
0060 
0061 /*
0062  * AEAD speed tests
0063  */
0064 static u8 aead_speed_template_19[] = {19, 0};
0065 static u8 aead_speed_template_20[] = {20, 0};
0066 static u8 aead_speed_template_36[] = {36, 0};
0067 
0068 /*
0069  * Digest speed tests
0070  */
0071 static struct hash_speed generic_hash_speed_template[] = {
0072     { .blen = 16,   .plen = 16, },
0073     { .blen = 64,   .plen = 16, },
0074     { .blen = 64,   .plen = 64, },
0075     { .blen = 256,  .plen = 16, },
0076     { .blen = 256,  .plen = 64, },
0077     { .blen = 256,  .plen = 256, },
0078     { .blen = 1024, .plen = 16, },
0079     { .blen = 1024, .plen = 256, },
0080     { .blen = 1024, .plen = 1024, },
0081     { .blen = 2048, .plen = 16, },
0082     { .blen = 2048, .plen = 256, },
0083     { .blen = 2048, .plen = 1024, },
0084     { .blen = 2048, .plen = 2048, },
0085     { .blen = 4096, .plen = 16, },
0086     { .blen = 4096, .plen = 256, },
0087     { .blen = 4096, .plen = 1024, },
0088     { .blen = 4096, .plen = 4096, },
0089     { .blen = 8192, .plen = 16, },
0090     { .blen = 8192, .plen = 256, },
0091     { .blen = 8192, .plen = 1024, },
0092     { .blen = 8192, .plen = 4096, },
0093     { .blen = 8192, .plen = 8192, },
0094 
0095     /* End marker */
0096     {  .blen = 0,   .plen = 0, }
0097 };
0098 
0099 static struct hash_speed poly1305_speed_template[] = {
0100     { .blen = 96,   .plen = 16, },
0101     { .blen = 96,   .plen = 32, },
0102     { .blen = 96,   .plen = 96, },
0103     { .blen = 288,  .plen = 16, },
0104     { .blen = 288,  .plen = 32, },
0105     { .blen = 288,  .plen = 288, },
0106     { .blen = 1056, .plen = 32, },
0107     { .blen = 1056, .plen = 1056, },
0108     { .blen = 2080, .plen = 32, },
0109     { .blen = 2080, .plen = 2080, },
0110     { .blen = 4128, .plen = 4128, },
0111     { .blen = 8224, .plen = 8224, },
0112 
0113     /* End marker */
0114     {  .blen = 0,   .plen = 0, }
0115 };
0116 
0117 #endif  /* _CRYPTO_TCRYPT_H */