aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/tcrypt.h
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-08-21 08:04:03 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2006-09-20 21:41:03 -0400
commitc907ee76d8456fe1d98f40b5febfc7802a73b784 (patch)
treeba7abea258fd89c2873fbac40b1d5928b4a99f5b /crypto/tcrypt.h
parentee7564166da9e218c3f605ee78ff16599d4d5a05 (diff)
[CRYPTO] tcrypt: Use test_hash for crc32c
Now that crc32c has been fixed to conform with standard digest semantics, we can use test_hash for it. I've turned the last test into a chunky test. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/tcrypt.h')
-rw-r--r--crypto/tcrypt.h179
1 files changed, 178 insertions, 1 deletions
diff --git a/crypto/tcrypt.h b/crypto/tcrypt.h
index 1fac5602f63..408d5aad586 100644
--- a/crypto/tcrypt.h
+++ b/crypto/tcrypt.h
@@ -28,7 +28,7 @@
28struct hash_testvec { 28struct hash_testvec {
29 /* only used with keyed hash algorithms */ 29 /* only used with keyed hash algorithms */
30 char key[128] __attribute__ ((__aligned__(4))); 30 char key[128] __attribute__ ((__aligned__(4)));
31 char plaintext[128]; 31 char plaintext[240];
32 char digest[MAX_DIGEST_SIZE]; 32 char digest[MAX_DIGEST_SIZE];
33 unsigned char tap[MAX_TAP]; 33 unsigned char tap[MAX_TAP];
34 unsigned char psize; 34 unsigned char psize;
@@ -2897,6 +2897,183 @@ static struct hash_testvec michael_mic_tv_template[] = {
2897}; 2897};
2898 2898
2899/* 2899/*
2900 * CRC32C test vectors
2901 */
2902#define CRC32C_TEST_VECTORS 14
2903
2904static struct hash_testvec crc32c_tv_template[] = {
2905 {
2906 .psize = 0,
2907 .digest = { 0x00, 0x00, 0x00, 0x00 }
2908 },
2909 {
2910 .key = { 0x87, 0xa9, 0xcb, 0xed },
2911 .ksize = 4,
2912 .psize = 0,
2913 .digest = { 0x78, 0x56, 0x34, 0x12 },
2914 },
2915 {
2916 .key = { 0xff, 0xff, 0xff, 0xff },
2917 .ksize = 4,
2918 .plaintext = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
2919 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
2920 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
2921 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
2922 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28 },
2923 .psize = 40,
2924 .digest = { 0x7f, 0x15, 0x2c, 0x0e }
2925 },
2926 {
2927 .key = { 0xff, 0xff, 0xff, 0xff },
2928 .ksize = 4,
2929 .plaintext = { 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
2930 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
2931 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40,
2932 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
2933 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50 },
2934 .psize = 40,
2935 .digest = { 0xf6, 0xeb, 0x80, 0xe9 }
2936 },
2937 {
2938 .key = { 0xff, 0xff, 0xff, 0xff },
2939 .ksize = 4,
2940 .plaintext = { 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
2941 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60,
2942 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
2943 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
2944 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78 },
2945 .psize = 40,
2946 .digest = { 0xed, 0xbd, 0x74, 0xde }
2947 },
2948 {
2949 .key = { 0xff, 0xff, 0xff, 0xff },
2950 .ksize = 4,
2951 .plaintext = { 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80,
2952 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88,
2953 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90,
2954 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
2955 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0 },
2956 .psize = 40,
2957 .digest = { 0x62, 0xc8, 0x79, 0xd5 }
2958 },
2959 {
2960 .key = { 0xff, 0xff, 0xff, 0xff },
2961 .ksize = 4,
2962 .plaintext = { 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8,
2963 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0,
2964 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8,
2965 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0,
2966 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8 },
2967 .psize = 40,
2968 .digest = { 0xd0, 0x9a, 0x97, 0xba }
2969 },
2970 {
2971 .key = { 0xff, 0xff, 0xff, 0xff },
2972 .ksize = 4,
2973 .plaintext = { 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
2974 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8,
2975 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0,
2976 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8,
2977 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0 },
2978 .psize = 40,
2979 .digest = { 0x13, 0xd9, 0x29, 0x2b }
2980 },
2981 {
2982 .key = { 0x80, 0xea, 0xd3, 0xf1 },
2983 .ksize = 4,
2984 .plaintext = { 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
2985 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
2986 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40,
2987 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
2988 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50 },
2989 .psize = 40,
2990 .digest = { 0x0c, 0xb5, 0xe2, 0xa2 }
2991 },
2992 {
2993 .key = { 0xf3, 0x4a, 0x1d, 0x5d },
2994 .ksize = 4,
2995 .plaintext = { 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
2996 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60,
2997 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
2998 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
2999 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78 },
3000 .psize = 40,
3001 .digest = { 0xd1, 0x7f, 0xfb, 0xa6 }
3002 },
3003 {
3004 .key = { 0x2e, 0x80, 0x04, 0x59 },
3005 .ksize = 4,
3006 .plaintext = { 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80,
3007 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88,
3008 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90,
3009 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
3010 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0 },
3011 .psize = 40,
3012 .digest = { 0x59, 0x33, 0xe6, 0x7a }
3013 },
3014 {
3015 .key = { 0xa6, 0xcc, 0x19, 0x85 },
3016 .ksize = 4,
3017 .plaintext = { 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8,
3018 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0,
3019 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8,
3020 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0,
3021 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8 },
3022 .psize = 40,
3023 .digest = { 0xbe, 0x03, 0x01, 0xd2 }
3024 },
3025 {
3026 .key = { 0x41, 0xfc, 0xfe, 0x2d },
3027 .ksize = 4,
3028 .plaintext = { 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
3029 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8,
3030 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0,
3031 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8,
3032 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0 },
3033 .psize = 40,
3034 .digest = { 0x75, 0xd3, 0xc5, 0x24 }
3035 },
3036 {
3037 .key = { 0xff, 0xff, 0xff, 0xff },
3038 .ksize = 4,
3039 .plaintext = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
3040 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
3041 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
3042 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
3043 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
3044 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
3045 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
3046 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40,
3047 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
3048 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
3049 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
3050 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60,
3051 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
3052 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
3053 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
3054 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80,
3055 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88,
3056 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90,
3057 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
3058 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0,
3059 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8,
3060 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0,
3061 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8,
3062 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0,
3063 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8,
3064 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
3065 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8,
3066 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0,
3067 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8,
3068 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0 },
3069 .psize = 240,
3070 .digest = { 0x75, 0xd3, 0xc5, 0x24 },
3071 .np = 2,
3072 .tap = { 31, 209 }
3073 },
3074};
3075
3076/*
2900 * Cipher speed tests 3077 * Cipher speed tests
2901 */ 3078 */
2902static struct cipher_speed aes_speed_template[] = { 3079static struct cipher_speed aes_speed_template[] = {