diff options
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/algapi.c | 2 | ||||
-rw-r--r-- | crypto/internal.h | 2 | ||||
-rw-r--r-- | crypto/pcrypt.c | 11 | ||||
-rw-r--r-- | crypto/tcrypt.c | 7 | ||||
-rw-r--r-- | crypto/tcrypt.h | 29 | ||||
-rw-r--r-- | crypto/testmgr.h | 64 | ||||
-rw-r--r-- | crypto/vmac.c | 75 |
7 files changed, 138 insertions, 52 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c index 76fae27ed01c..c3cf1a69a47a 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c | |||
@@ -544,7 +544,7 @@ int crypto_init_spawn2(struct crypto_spawn *spawn, struct crypto_alg *alg, | |||
544 | { | 544 | { |
545 | int err = -EINVAL; | 545 | int err = -EINVAL; |
546 | 546 | ||
547 | if (frontend && (alg->cra_flags ^ frontend->type) & frontend->maskset) | 547 | if ((alg->cra_flags ^ frontend->type) & frontend->maskset) |
548 | goto out; | 548 | goto out; |
549 | 549 | ||
550 | spawn->frontend = frontend; | 550 | spawn->frontend = frontend; |
diff --git a/crypto/internal.h b/crypto/internal.h index 2d226362e594..d4384b08ab29 100644 --- a/crypto/internal.h +++ b/crypto/internal.h | |||
@@ -6,7 +6,7 @@ | |||
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
8 | * under the terms of the GNU General Public License as published by the Free | 8 | * under the terms of the GNU General Public License as published by the Free |
9 | * Software Foundation; either version 2 of the License, or (at your option) | 9 | * Software Foundation; either version 2 of the License, or (at your option) |
10 | * any later version. | 10 | * any later version. |
11 | * | 11 | * |
12 | */ | 12 | */ |
diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c index 80201241b698..247178cb98ec 100644 --- a/crypto/pcrypt.c +++ b/crypto/pcrypt.c | |||
@@ -315,16 +315,13 @@ out_free_inst: | |||
315 | goto out; | 315 | goto out; |
316 | } | 316 | } |
317 | 317 | ||
318 | static struct crypto_instance *pcrypt_alloc_aead(struct rtattr **tb) | 318 | static struct crypto_instance *pcrypt_alloc_aead(struct rtattr **tb, |
319 | u32 type, u32 mask) | ||
319 | { | 320 | { |
320 | struct crypto_instance *inst; | 321 | struct crypto_instance *inst; |
321 | struct crypto_alg *alg; | 322 | struct crypto_alg *alg; |
322 | struct crypto_attr_type *algt; | ||
323 | |||
324 | algt = crypto_get_attr_type(tb); | ||
325 | 323 | ||
326 | alg = crypto_get_attr_alg(tb, algt->type, | 324 | alg = crypto_get_attr_alg(tb, type, (mask & CRYPTO_ALG_TYPE_MASK)); |
327 | (algt->mask & CRYPTO_ALG_TYPE_MASK)); | ||
328 | if (IS_ERR(alg)) | 325 | if (IS_ERR(alg)) |
329 | return ERR_CAST(alg); | 326 | return ERR_CAST(alg); |
330 | 327 | ||
@@ -365,7 +362,7 @@ static struct crypto_instance *pcrypt_alloc(struct rtattr **tb) | |||
365 | 362 | ||
366 | switch (algt->type & algt->mask & CRYPTO_ALG_TYPE_MASK) { | 363 | switch (algt->type & algt->mask & CRYPTO_ALG_TYPE_MASK) { |
367 | case CRYPTO_ALG_TYPE_AEAD: | 364 | case CRYPTO_ALG_TYPE_AEAD: |
368 | return pcrypt_alloc_aead(tb); | 365 | return pcrypt_alloc_aead(tb, algt->type, algt->mask); |
369 | } | 366 | } |
370 | 367 | ||
371 | return ERR_PTR(-EINVAL); | 368 | return ERR_PTR(-EINVAL); |
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index a35159947a26..ea610ad45aa1 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c | |||
@@ -437,6 +437,9 @@ static void test_hash_speed(const char *algo, unsigned int sec, | |||
437 | goto out; | 437 | goto out; |
438 | } | 438 | } |
439 | 439 | ||
440 | if (speed[i].klen) | ||
441 | crypto_hash_setkey(tfm, tvmem[0], speed[i].klen); | ||
442 | |||
440 | printk(KERN_INFO "test%3u " | 443 | printk(KERN_INFO "test%3u " |
441 | "(%5u byte blocks,%5u bytes per update,%4u updates): ", | 444 | "(%5u byte blocks,%5u bytes per update,%4u updates): ", |
442 | i, speed[i].blen, speed[i].plen, speed[i].blen / speed[i].plen); | 445 | i, speed[i].blen, speed[i].plen, speed[i].blen / speed[i].plen); |
@@ -881,6 +884,10 @@ static int do_test(int m) | |||
881 | test_hash_speed("rmd320", sec, generic_hash_speed_template); | 884 | test_hash_speed("rmd320", sec, generic_hash_speed_template); |
882 | if (mode > 300 && mode < 400) break; | 885 | if (mode > 300 && mode < 400) break; |
883 | 886 | ||
887 | case 318: | ||
888 | test_hash_speed("ghash-generic", sec, hash_speed_template_16); | ||
889 | if (mode > 300 && mode < 400) break; | ||
890 | |||
884 | case 399: | 891 | case 399: |
885 | break; | 892 | break; |
886 | 893 | ||
diff --git a/crypto/tcrypt.h b/crypto/tcrypt.h index 966bbfaf95b1..10cb925132c9 100644 --- a/crypto/tcrypt.h +++ b/crypto/tcrypt.h | |||
@@ -25,6 +25,7 @@ struct cipher_speed_template { | |||
25 | struct hash_speed { | 25 | struct hash_speed { |
26 | unsigned int blen; /* buffer length */ | 26 | unsigned int blen; /* buffer length */ |
27 | unsigned int plen; /* per-update length */ | 27 | unsigned int plen; /* per-update length */ |
28 | unsigned int klen; /* key length */ | ||
28 | }; | 29 | }; |
29 | 30 | ||
30 | /* | 31 | /* |
@@ -83,4 +84,32 @@ static struct hash_speed generic_hash_speed_template[] = { | |||
83 | { .blen = 0, .plen = 0, } | 84 | { .blen = 0, .plen = 0, } |
84 | }; | 85 | }; |
85 | 86 | ||
87 | static 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 | |||
86 | #endif /* _CRYPTO_TCRYPT_H */ | 115 | #endif /* _CRYPTO_TCRYPT_H */ |
diff --git a/crypto/testmgr.h b/crypto/testmgr.h index fb765173d41c..74e35377fd30 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h | |||
@@ -1669,17 +1669,73 @@ static struct hash_testvec aes_xcbc128_tv_template[] = { | |||
1669 | } | 1669 | } |
1670 | }; | 1670 | }; |
1671 | 1671 | ||
1672 | #define VMAC_AES_TEST_VECTORS 1 | 1672 | #define VMAC_AES_TEST_VECTORS 8 |
1673 | static char vmac_string[128] = {'\x01', '\x01', '\x01', '\x01', | 1673 | static char vmac_string1[128] = {'\x01', '\x01', '\x01', '\x01', |
1674 | '\x02', '\x03', '\x02', '\x02', | 1674 | '\x02', '\x03', '\x02', '\x02', |
1675 | '\x02', '\x04', '\x01', '\x07', | 1675 | '\x02', '\x04', '\x01', '\x07', |
1676 | '\x04', '\x01', '\x04', '\x03',}; | 1676 | '\x04', '\x01', '\x04', '\x03',}; |
1677 | static char vmac_string2[128] = {'a', 'b', 'c',}; | ||
1678 | static char vmac_string3[128] = {'a', 'b', 'c', 'a', 'b', 'c', | ||
1679 | 'a', 'b', 'c', 'a', 'b', 'c', | ||
1680 | 'a', 'b', 'c', 'a', 'b', 'c', | ||
1681 | 'a', 'b', 'c', 'a', 'b', 'c', | ||
1682 | 'a', 'b', 'c', 'a', 'b', 'c', | ||
1683 | 'a', 'b', 'c', 'a', 'b', 'c', | ||
1684 | 'a', 'b', 'c', 'a', 'b', 'c', | ||
1685 | 'a', 'b', 'c', 'a', 'b', 'c', | ||
1686 | }; | ||
1687 | |||
1677 | static struct hash_testvec aes_vmac128_tv_template[] = { | 1688 | static struct hash_testvec aes_vmac128_tv_template[] = { |
1678 | { | 1689 | { |
1690 | .key = "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
1691 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", | ||
1692 | .plaintext = NULL, | ||
1693 | .digest = "\x07\x58\x80\x35\x77\xa4\x7b\x54", | ||
1694 | .psize = 0, | ||
1695 | .ksize = 16, | ||
1696 | }, { | ||
1697 | .key = "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
1698 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", | ||
1699 | .plaintext = vmac_string1, | ||
1700 | .digest = "\xce\xf5\x3c\xd3\xae\x68\x8c\xa1", | ||
1701 | .psize = 128, | ||
1702 | .ksize = 16, | ||
1703 | }, { | ||
1704 | .key = "\x00\x01\x02\x03\x04\x05\x06\x07" | ||
1705 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", | ||
1706 | .plaintext = vmac_string2, | ||
1707 | .digest = "\xc9\x27\xb0\x73\x81\xbd\x14\x2d", | ||
1708 | .psize = 128, | ||
1709 | .ksize = 16, | ||
1710 | }, { | ||
1679 | .key = "\x00\x01\x02\x03\x04\x05\x06\x07" | 1711 | .key = "\x00\x01\x02\x03\x04\x05\x06\x07" |
1680 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", | 1712 | "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", |
1681 | .plaintext = vmac_string, | 1713 | .plaintext = vmac_string3, |
1682 | .digest = "\xcb\xd7\x8a\xfd\xb7\x33\x79\xe7", | 1714 | .digest = "\x8d\x1a\x95\x8c\x98\x47\x0b\x19", |
1715 | .psize = 128, | ||
1716 | .ksize = 16, | ||
1717 | }, { | ||
1718 | .key = "abcdefghijklmnop", | ||
1719 | .plaintext = NULL, | ||
1720 | .digest = "\x3b\x89\xa1\x26\x9e\x55\x8f\x84", | ||
1721 | .psize = 0, | ||
1722 | .ksize = 16, | ||
1723 | }, { | ||
1724 | .key = "abcdefghijklmnop", | ||
1725 | .plaintext = vmac_string1, | ||
1726 | .digest = "\xab\x5e\xab\xb0\xf6\x8d\x74\xc2", | ||
1727 | .psize = 128, | ||
1728 | .ksize = 16, | ||
1729 | }, { | ||
1730 | .key = "abcdefghijklmnop", | ||
1731 | .plaintext = vmac_string2, | ||
1732 | .digest = "\x11\x15\x68\x42\x3d\x7b\x09\xdf", | ||
1733 | .psize = 128, | ||
1734 | .ksize = 16, | ||
1735 | }, { | ||
1736 | .key = "abcdefghijklmnop", | ||
1737 | .plaintext = vmac_string3, | ||
1738 | .digest = "\x8b\x32\x8f\xe1\xed\x8f\xfa\xd4", | ||
1683 | .psize = 128, | 1739 | .psize = 128, |
1684 | .ksize = 16, | 1740 | .ksize = 16, |
1685 | }, | 1741 | }, |
diff --git a/crypto/vmac.c b/crypto/vmac.c index 0a9468e575de..0999274a27ac 100644 --- a/crypto/vmac.c +++ b/crypto/vmac.c | |||
@@ -43,6 +43,8 @@ const u64 m63 = UINT64_C(0x7fffffffffffffff); /* 63-bit mask */ | |||
43 | const u64 m64 = UINT64_C(0xffffffffffffffff); /* 64-bit mask */ | 43 | const u64 m64 = UINT64_C(0xffffffffffffffff); /* 64-bit mask */ |
44 | const u64 mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */ | 44 | const u64 mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */ |
45 | 45 | ||
46 | #define pe64_to_cpup le64_to_cpup /* Prefer little endian */ | ||
47 | |||
46 | #ifdef __LITTLE_ENDIAN | 48 | #ifdef __LITTLE_ENDIAN |
47 | #define INDEX_HIGH 1 | 49 | #define INDEX_HIGH 1 |
48 | #define INDEX_LOW 0 | 50 | #define INDEX_LOW 0 |
@@ -110,8 +112,8 @@ const u64 mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */ | |||
110 | int i; u64 th, tl; \ | 112 | int i; u64 th, tl; \ |
111 | rh = rl = 0; \ | 113 | rh = rl = 0; \ |
112 | for (i = 0; i < nw; i += 2) { \ | 114 | for (i = 0; i < nw; i += 2) { \ |
113 | MUL64(th, tl, le64_to_cpup((mp)+i)+(kp)[i], \ | 115 | MUL64(th, tl, pe64_to_cpup((mp)+i)+(kp)[i], \ |
114 | le64_to_cpup((mp)+i+1)+(kp)[i+1]); \ | 116 | pe64_to_cpup((mp)+i+1)+(kp)[i+1]); \ |
115 | ADD128(rh, rl, th, tl); \ | 117 | ADD128(rh, rl, th, tl); \ |
116 | } \ | 118 | } \ |
117 | } while (0) | 119 | } while (0) |
@@ -121,11 +123,11 @@ const u64 mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */ | |||
121 | int i; u64 th, tl; \ | 123 | int i; u64 th, tl; \ |
122 | rh1 = rl1 = rh = rl = 0; \ | 124 | rh1 = rl1 = rh = rl = 0; \ |
123 | for (i = 0; i < nw; i += 2) { \ | 125 | for (i = 0; i < nw; i += 2) { \ |
124 | MUL64(th, tl, le64_to_cpup((mp)+i)+(kp)[i], \ | 126 | MUL64(th, tl, pe64_to_cpup((mp)+i)+(kp)[i], \ |
125 | le64_to_cpup((mp)+i+1)+(kp)[i+1]); \ | 127 | pe64_to_cpup((mp)+i+1)+(kp)[i+1]); \ |
126 | ADD128(rh, rl, th, tl); \ | 128 | ADD128(rh, rl, th, tl); \ |
127 | MUL64(th, tl, le64_to_cpup((mp)+i)+(kp)[i+2], \ | 129 | MUL64(th, tl, pe64_to_cpup((mp)+i)+(kp)[i+2], \ |
128 | le64_to_cpup((mp)+i+1)+(kp)[i+3]); \ | 130 | pe64_to_cpup((mp)+i+1)+(kp)[i+3]); \ |
129 | ADD128(rh1, rl1, th, tl); \ | 131 | ADD128(rh1, rl1, th, tl); \ |
130 | } \ | 132 | } \ |
131 | } while (0) | 133 | } while (0) |
@@ -136,17 +138,17 @@ const u64 mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */ | |||
136 | int i; u64 th, tl; \ | 138 | int i; u64 th, tl; \ |
137 | rh = rl = 0; \ | 139 | rh = rl = 0; \ |
138 | for (i = 0; i < nw; i += 8) { \ | 140 | for (i = 0; i < nw; i += 8) { \ |
139 | MUL64(th, tl, le64_to_cpup((mp)+i)+(kp)[i], \ | 141 | MUL64(th, tl, pe64_to_cpup((mp)+i)+(kp)[i], \ |
140 | le64_to_cpup((mp)+i+1)+(kp)[i+1]); \ | 142 | pe64_to_cpup((mp)+i+1)+(kp)[i+1]); \ |
141 | ADD128(rh, rl, th, tl); \ | 143 | ADD128(rh, rl, th, tl); \ |
142 | MUL64(th, tl, le64_to_cpup((mp)+i+2)+(kp)[i+2], \ | 144 | MUL64(th, tl, pe64_to_cpup((mp)+i+2)+(kp)[i+2], \ |
143 | le64_to_cpup((mp)+i+3)+(kp)[i+3]); \ | 145 | pe64_to_cpup((mp)+i+3)+(kp)[i+3]); \ |
144 | ADD128(rh, rl, th, tl); \ | 146 | ADD128(rh, rl, th, tl); \ |
145 | MUL64(th, tl, le64_to_cpup((mp)+i+4)+(kp)[i+4], \ | 147 | MUL64(th, tl, pe64_to_cpup((mp)+i+4)+(kp)[i+4], \ |
146 | le64_to_cpup((mp)+i+5)+(kp)[i+5]); \ | 148 | pe64_to_cpup((mp)+i+5)+(kp)[i+5]); \ |
147 | ADD128(rh, rl, th, tl); \ | 149 | ADD128(rh, rl, th, tl); \ |
148 | MUL64(th, tl, le64_to_cpup((mp)+i+6)+(kp)[i+6], \ | 150 | MUL64(th, tl, pe64_to_cpup((mp)+i+6)+(kp)[i+6], \ |
149 | le64_to_cpup((mp)+i+7)+(kp)[i+7]); \ | 151 | pe64_to_cpup((mp)+i+7)+(kp)[i+7]); \ |
150 | ADD128(rh, rl, th, tl); \ | 152 | ADD128(rh, rl, th, tl); \ |
151 | } \ | 153 | } \ |
152 | } while (0) | 154 | } while (0) |
@@ -156,29 +158,29 @@ const u64 mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */ | |||
156 | int i; u64 th, tl; \ | 158 | int i; u64 th, tl; \ |
157 | rh1 = rl1 = rh = rl = 0; \ | 159 | rh1 = rl1 = rh = rl = 0; \ |
158 | for (i = 0; i < nw; i += 8) { \ | 160 | for (i = 0; i < nw; i += 8) { \ |
159 | MUL64(th, tl, le64_to_cpup((mp)+i)+(kp)[i], \ | 161 | MUL64(th, tl, pe64_to_cpup((mp)+i)+(kp)[i], \ |
160 | le64_to_cpup((mp)+i+1)+(kp)[i+1]); \ | 162 | pe64_to_cpup((mp)+i+1)+(kp)[i+1]); \ |
161 | ADD128(rh, rl, th, tl); \ | 163 | ADD128(rh, rl, th, tl); \ |
162 | MUL64(th, tl, le64_to_cpup((mp)+i)+(kp)[i+2], \ | 164 | MUL64(th, tl, pe64_to_cpup((mp)+i)+(kp)[i+2], \ |
163 | le64_to_cpup((mp)+i+1)+(kp)[i+3]); \ | 165 | pe64_to_cpup((mp)+i+1)+(kp)[i+3]); \ |
164 | ADD128(rh1, rl1, th, tl); \ | 166 | ADD128(rh1, rl1, th, tl); \ |
165 | MUL64(th, tl, le64_to_cpup((mp)+i+2)+(kp)[i+2], \ | 167 | MUL64(th, tl, pe64_to_cpup((mp)+i+2)+(kp)[i+2], \ |
166 | le64_to_cpup((mp)+i+3)+(kp)[i+3]); \ | 168 | pe64_to_cpup((mp)+i+3)+(kp)[i+3]); \ |
167 | ADD128(rh, rl, th, tl); \ | 169 | ADD128(rh, rl, th, tl); \ |
168 | MUL64(th, tl, le64_to_cpup((mp)+i+2)+(kp)[i+4], \ | 170 | MUL64(th, tl, pe64_to_cpup((mp)+i+2)+(kp)[i+4], \ |
169 | le64_to_cpup((mp)+i+3)+(kp)[i+5]); \ | 171 | pe64_to_cpup((mp)+i+3)+(kp)[i+5]); \ |
170 | ADD128(rh1, rl1, th, tl); \ | 172 | ADD128(rh1, rl1, th, tl); \ |
171 | MUL64(th, tl, le64_to_cpup((mp)+i+4)+(kp)[i+4], \ | 173 | MUL64(th, tl, pe64_to_cpup((mp)+i+4)+(kp)[i+4], \ |
172 | le64_to_cpup((mp)+i+5)+(kp)[i+5]); \ | 174 | pe64_to_cpup((mp)+i+5)+(kp)[i+5]); \ |
173 | ADD128(rh, rl, th, tl); \ | 175 | ADD128(rh, rl, th, tl); \ |
174 | MUL64(th, tl, le64_to_cpup((mp)+i+4)+(kp)[i+6], \ | 176 | MUL64(th, tl, pe64_to_cpup((mp)+i+4)+(kp)[i+6], \ |
175 | le64_to_cpup((mp)+i+5)+(kp)[i+7]); \ | 177 | pe64_to_cpup((mp)+i+5)+(kp)[i+7]); \ |
176 | ADD128(rh1, rl1, th, tl); \ | 178 | ADD128(rh1, rl1, th, tl); \ |
177 | MUL64(th, tl, le64_to_cpup((mp)+i+6)+(kp)[i+6], \ | 179 | MUL64(th, tl, pe64_to_cpup((mp)+i+6)+(kp)[i+6], \ |
178 | le64_to_cpup((mp)+i+7)+(kp)[i+7]); \ | 180 | pe64_to_cpup((mp)+i+7)+(kp)[i+7]); \ |
179 | ADD128(rh, rl, th, tl); \ | 181 | ADD128(rh, rl, th, tl); \ |
180 | MUL64(th, tl, le64_to_cpup((mp)+i+6)+(kp)[i+8], \ | 182 | MUL64(th, tl, pe64_to_cpup((mp)+i+6)+(kp)[i+8], \ |
181 | le64_to_cpup((mp)+i+7)+(kp)[i+9]); \ | 183 | pe64_to_cpup((mp)+i+7)+(kp)[i+9]); \ |
182 | ADD128(rh1, rl1, th, tl); \ | 184 | ADD128(rh1, rl1, th, tl); \ |
183 | } \ | 185 | } \ |
184 | } while (0) | 186 | } while (0) |
@@ -216,8 +218,8 @@ const u64 mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */ | |||
216 | int i; \ | 218 | int i; \ |
217 | rh = rl = t = 0; \ | 219 | rh = rl = t = 0; \ |
218 | for (i = 0; i < nw; i += 2) { \ | 220 | for (i = 0; i < nw; i += 2) { \ |
219 | t1 = le64_to_cpup(mp+i) + kp[i]; \ | 221 | t1 = pe64_to_cpup(mp+i) + kp[i]; \ |
220 | t2 = le64_to_cpup(mp+i+1) + kp[i+1]; \ | 222 | t2 = pe64_to_cpup(mp+i+1) + kp[i+1]; \ |
221 | m2 = MUL32(t1 >> 32, t2); \ | 223 | m2 = MUL32(t1 >> 32, t2); \ |
222 | m1 = MUL32(t1, t2 >> 32); \ | 224 | m1 = MUL32(t1, t2 >> 32); \ |
223 | ADD128(rh, rl, MUL32(t1 >> 32, t2 >> 32), \ | 225 | ADD128(rh, rl, MUL32(t1 >> 32, t2 >> 32), \ |
@@ -322,8 +324,7 @@ static void vhash_abort(struct vmac_ctx *ctx) | |||
322 | ctx->first_block_processed = 0; | 324 | ctx->first_block_processed = 0; |
323 | } | 325 | } |
324 | 326 | ||
325 | static u64 l3hash(u64 p1, u64 p2, | 327 | static u64 l3hash(u64 p1, u64 p2, u64 k1, u64 k2, u64 len) |
326 | u64 k1, u64 k2, u64 len) | ||
327 | { | 328 | { |
328 | u64 rh, rl, t, z = 0; | 329 | u64 rh, rl, t, z = 0; |
329 | 330 | ||
@@ -474,7 +475,7 @@ static u64 vmac(unsigned char m[], unsigned int mbytes, | |||
474 | } | 475 | } |
475 | p = be64_to_cpup(out_p + i); | 476 | p = be64_to_cpup(out_p + i); |
476 | h = vhash(m, mbytes, (u64 *)0, &ctx->__vmac_ctx); | 477 | h = vhash(m, mbytes, (u64 *)0, &ctx->__vmac_ctx); |
477 | return p + h; | 478 | return le64_to_cpu(p + h); |
478 | } | 479 | } |
479 | 480 | ||
480 | static int vmac_set_key(unsigned char user_key[], struct vmac_ctx_t *ctx) | 481 | static int vmac_set_key(unsigned char user_key[], struct vmac_ctx_t *ctx) |
@@ -549,10 +550,6 @@ static int vmac_setkey(struct crypto_shash *parent, | |||
549 | 550 | ||
550 | static int vmac_init(struct shash_desc *pdesc) | 551 | static int vmac_init(struct shash_desc *pdesc) |
551 | { | 552 | { |
552 | struct crypto_shash *parent = pdesc->tfm; | ||
553 | struct vmac_ctx_t *ctx = crypto_shash_ctx(parent); | ||
554 | |||
555 | memset(&ctx->__vmac_ctx, 0, sizeof(struct vmac_ctx)); | ||
556 | return 0; | 553 | return 0; |
557 | } | 554 | } |
558 | 555 | ||