OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | 4 |
5 /* This implementation of poly1305 is by Andrew Moon | 5 /* This implementation of poly1305 is by Andrew Moon |
6 * (https://github.com/floodyberry/poly1305-donna) and released as public | 6 * (https://github.com/floodyberry/poly1305-donna) and released as public |
7 * domain. It implements SIMD vectorization based on the algorithm described in | 7 * domain. It implements SIMD vectorization based on the algorithm described in |
8 * http://cr.yp.to/papers.html#neoncrypto. Unrolled to 2 powers, i.e. 64 byte | 8 * http://cr.yp.to/papers.html#neoncrypto. Unrolled to 2 powers, i.e. 64 byte |
9 * block size. */ | 9 * block size. */ |
10 | 10 |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 /* pad */ | 614 /* pad */ |
615 t0 = ((uint64_t)p->R23.d[3] << 32) | (uint64_t)p->R23.d[1]; | 615 t0 = ((uint64_t)p->R23.d[3] << 32) | (uint64_t)p->R23.d[1]; |
616 t1 = ((uint64_t)p->R24.d[3] << 32) | (uint64_t)p->R24.d[1]; | 616 t1 = ((uint64_t)p->R24.d[3] << 32) | (uint64_t)p->R24.d[1]; |
617 h0 += (t0 & 0xfffffffffff) ; c = (h0 >> 44); h0 &= 0xfffffffffff; t0
= shr128_pair(t1, t0, 44); | 617 h0 += (t0 & 0xfffffffffff) ; c = (h0 >> 44); h0 &= 0xfffffffffff; t0
= shr128_pair(t1, t0, 44); |
618 h1 += (t0 & 0xfffffffffff) + c; c = (h1 >> 44); h1 &= 0xfffffffffff; t1
= (t1 >> 24); | 618 h1 += (t0 & 0xfffffffffff) + c; c = (h1 >> 44); h1 &= 0xfffffffffff; t1
= (t1 >> 24); |
619 h2 += (t1 ) + c; | 619 h2 += (t1 ) + c; |
620 | 620 |
621 U64TO8_LE(mac + 0, ((h0 ) | (h1 << 44))); | 621 U64TO8_LE(mac + 0, ((h0 ) | (h1 << 44))); |
622 U64TO8_LE(mac + 8, ((h1 >> 20) | (h2 << 24))); | 622 U64TO8_LE(mac + 8, ((h1 >> 20) | (h2 << 24))); |
623 } | 623 } |
OLD | NEW |