Back to home page

LXR

 
 

    


0001 /*
0002  * Quick & dirty crypto testing module.
0003  *
0004  * This will only exist until we have a better testing mechanism
0005  * (e.g. a char device).
0006  *
0007  * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
0008  * Copyright (c) 2002 Jean-Francois Dive <jef@linuxbe.org>
0009  * Copyright (c) 2007 Nokia Siemens Networks
0010  *
0011  * This program is free software; you can redistribute it and/or modify it
0012  * under the terms of the GNU General Public License as published by the Free
0013  * Software Foundation; either version 2 of the License, or (at your option)
0014  * any later version.
0015  *
0016  */
0017 #ifndef _CRYPTO_TCRYPT_H
0018 #define _CRYPTO_TCRYPT_H
0019 
0020 struct cipher_speed_template {
0021     const char *key;
0022     unsigned int klen;
0023 };
0024 
0025 struct aead_speed_template {
0026     const char *key;
0027     unsigned int klen;
0028 };
0029 
0030 struct hash_speed {
0031     unsigned int blen;  /* buffer length */
0032     unsigned int plen;  /* per-update length */
0033     unsigned int klen;  /* key length */
0034 };
0035 
0036 /*
0037  * DES test vectors.
0038  */
0039 #define DES3_SPEED_VECTORS  1
0040 
0041 static struct cipher_speed_template des3_speed_template[] = {
0042     {
0043         .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef"
0044               "\x55\x55\x55\x55\x55\x55\x55\x55"
0045               "\xfe\xdc\xba\x98\x76\x54\x32\x10",
0046         .klen   = 24,
0047     }
0048 };
0049 
0050 /*
0051  * Cipher speed tests
0052  */
0053 static u8 speed_template_8[] = {8, 0};
0054 static u8 speed_template_24[] = {24, 0};
0055 static u8 speed_template_8_16[] = {8, 16, 0};
0056 static u8 speed_template_8_32[] = {8, 32, 0};
0057 static u8 speed_template_16_32[] = {16, 32, 0};
0058 static u8 speed_template_16_24_32[] = {16, 24, 32, 0};
0059 static u8 speed_template_20_28_36[] = {20, 28, 36, 0};
0060 static u8 speed_template_32_40_48[] = {32, 40, 48, 0};
0061 static u8 speed_template_32_48[] = {32, 48, 0};
0062 static u8 speed_template_32_48_64[] = {32, 48, 64, 0};
0063 static u8 speed_template_32_64[] = {32, 64, 0};
0064 static u8 speed_template_32[] = {32, 0};
0065 
0066 /*
0067  * AEAD speed tests
0068  */
0069 static u8 aead_speed_template_19[] = {19, 0};
0070 static u8 aead_speed_template_20[] = {20, 0};
0071 static u8 aead_speed_template_36[] = {36, 0};
0072 
0073 /*
0074  * Digest speed tests
0075  */
0076 static struct hash_speed generic_hash_speed_template[] = {
0077     { .blen = 16,   .plen = 16, },
0078     { .blen = 64,   .plen = 16, },
0079     { .blen = 64,   .plen = 64, },
0080     { .blen = 256,  .plen = 16, },
0081     { .blen = 256,  .plen = 64, },
0082     { .blen = 256,  .plen = 256, },
0083     { .blen = 1024, .plen = 16, },
0084     { .blen = 1024, .plen = 256, },
0085     { .blen = 1024, .plen = 1024, },
0086     { .blen = 2048, .plen = 16, },
0087     { .blen = 2048, .plen = 256, },
0088     { .blen = 2048, .plen = 1024, },
0089     { .blen = 2048, .plen = 2048, },
0090     { .blen = 4096, .plen = 16, },
0091     { .blen = 4096, .plen = 256, },
0092     { .blen = 4096, .plen = 1024, },
0093     { .blen = 4096, .plen = 4096, },
0094     { .blen = 8192, .plen = 16, },
0095     { .blen = 8192, .plen = 256, },
0096     { .blen = 8192, .plen = 1024, },
0097     { .blen = 8192, .plen = 4096, },
0098     { .blen = 8192, .plen = 8192, },
0099 
0100     /* End marker */
0101     {  .blen = 0,   .plen = 0, }
0102 };
0103 
0104 static struct hash_speed hash_speed_template_16[] = {
0105     { .blen = 16,   .plen = 16, .klen = 16, },
0106     { .blen = 64,   .plen = 16, .klen = 16, },
0107     { .blen = 64,   .plen = 64, .klen = 16, },
0108     { .blen = 256,  .plen = 16, .klen = 16, },
0109     { .blen = 256,  .plen = 64, .klen = 16, },
0110     { .blen = 256,  .plen = 256,    .klen = 16, },
0111     { .blen = 1024, .plen = 16, .klen = 16, },
0112     { .blen = 1024, .plen = 256,    .klen = 16, },
0113     { .blen = 1024, .plen = 1024,   .klen = 16, },
0114     { .blen = 2048, .plen = 16, .klen = 16, },
0115     { .blen = 2048, .plen = 256,    .klen = 16, },
0116     { .blen = 2048, .plen = 1024,   .klen = 16, },
0117     { .blen = 2048, .plen = 2048,   .klen = 16, },
0118     { .blen = 4096, .plen = 16, .klen = 16, },
0119     { .blen = 4096, .plen = 256,    .klen = 16, },
0120     { .blen = 4096, .plen = 1024,   .klen = 16, },
0121     { .blen = 4096, .plen = 4096,   .klen = 16, },
0122     { .blen = 8192, .plen = 16, .klen = 16, },
0123     { .blen = 8192, .plen = 256,    .klen = 16, },
0124     { .blen = 8192, .plen = 1024,   .klen = 16, },
0125     { .blen = 8192, .plen = 4096,   .klen = 16, },
0126     { .blen = 8192, .plen = 8192,   .klen = 16, },
0127 
0128     /* End marker */
0129     {  .blen = 0,   .plen = 0,  .klen = 0, }
0130 };
0131 
0132 static struct hash_speed poly1305_speed_template[] = {
0133     { .blen = 96,   .plen = 16, },
0134     { .blen = 96,   .plen = 32, },
0135     { .blen = 96,   .plen = 96, },
0136     { .blen = 288,  .plen = 16, },
0137     { .blen = 288,  .plen = 32, },
0138     { .blen = 288,  .plen = 288, },
0139     { .blen = 1056, .plen = 32, },
0140     { .blen = 1056, .plen = 1056, },
0141     { .blen = 2080, .plen = 32, },
0142     { .blen = 2080, .plen = 2080, },
0143     { .blen = 4128, .plen = 4128, },
0144     { .blen = 8224, .plen = 8224, },
0145 
0146     /* End marker */
0147     {  .blen = 0,   .plen = 0, }
0148 };
0149 
0150 #endif  /* _CRYPTO_TCRYPT_H */