| OLD | NEW |
| 1 /* | 1 /* |
| 2 * ***** BEGIN LICENSE BLOCK ***** | 2 * ***** BEGIN LICENSE BLOCK ***** |
| 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 4 * | 4 * |
| 5 * The contents of this file are subject to the Mozilla Public License Version | 5 * The contents of this file are subject to the Mozilla Public License Version |
| 6 * 1.1 (the "License"); you may not use this file except in compliance with | 6 * 1.1 (the "License"); you may not use this file except in compliance with |
| 7 * the License. You may obtain a copy of the License at | 7 * the License. You may obtain a copy of the License at |
| 8 * http://www.mozilla.org/MPL/ | 8 * http://www.mozilla.org/MPL/ |
| 9 * | 9 * |
| 10 * Software distributed under the License is distributed on an "AS IS" basis, | 10 * Software distributed under the License is distributed on an "AS IS" basis, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 #ifndef _MP_GF2M_PRIV_H_ | 40 #ifndef _MP_GF2M_PRIV_H_ |
| 41 #define _MP_GF2M_PRIV_H_ | 41 #define _MP_GF2M_PRIV_H_ |
| 42 | 42 |
| 43 #include "mpi-priv.h" | 43 #include "mpi-priv.h" |
| 44 | 44 |
| 45 extern const mp_digit mp_gf2m_sqr_tb[16]; | 45 extern const mp_digit mp_gf2m_sqr_tb[16]; |
| 46 | 46 |
| 47 #if defined(MP_USE_UINT_DIGIT) | 47 #if defined(MP_USE_UINT_DIGIT) |
| 48 #define MP_DIGIT_BITS 32 | 48 #define MP_DIGIT_BITS 32 |
| 49 /* enable fast divide and mod operations on MP_DIGIT_BITS */ |
| 50 #define MP_DIGIT_BITS_LOG_2 5 |
| 51 #define MP_DIGIT_BITS_MASK 0x1f |
| 49 #else | 52 #else |
| 50 #define MP_DIGIT_BITS 64 | 53 #define MP_DIGIT_BITS 64 |
| 54 /* enable fast divide and mod operations on MP_DIGIT_BITS */ |
| 55 #define MP_DIGIT_BITS_LOG_2 6 |
| 56 #define MP_DIGIT_BITS_MASK 0x3f |
| 51 #endif | 57 #endif |
| 52 | 58 |
| 53 /* Platform-specific macros for fast binary polynomial squaring. */ | 59 /* Platform-specific macros for fast binary polynomial squaring. */ |
| 54 #if MP_DIGIT_BITS == 32 | 60 #if MP_DIGIT_BITS == 32 |
| 55 #define gf2m_SQR1(w) \ | 61 #define gf2m_SQR1(w) \ |
| 56 mp_gf2m_sqr_tb[(w) >> 28 & 0xF] << 24 | mp_gf2m_sqr_tb[(w) >> 24 & 0xF] << 1
6 | \ | 62 mp_gf2m_sqr_tb[(w) >> 28 & 0xF] << 24 | mp_gf2m_sqr_tb[(w) >> 24 & 0xF] << 1
6 | \ |
| 57 mp_gf2m_sqr_tb[(w) >> 20 & 0xF] << 8 | mp_gf2m_sqr_tb[(w) >> 16 & 0xF] | 63 mp_gf2m_sqr_tb[(w) >> 20 & 0xF] << 8 | mp_gf2m_sqr_tb[(w) >> 16 & 0xF] |
| 58 #define gf2m_SQR0(w) \ | 64 #define gf2m_SQR0(w) \ |
| 59 mp_gf2m_sqr_tb[(w) >> 12 & 0xF] << 24 | mp_gf2m_sqr_tb[(w) >> 8 & 0xF] << 1
6 | \ | 65 mp_gf2m_sqr_tb[(w) >> 12 & 0xF] << 24 | mp_gf2m_sqr_tb[(w) >> 8 & 0xF] << 1
6 | \ |
| 60 mp_gf2m_sqr_tb[(w) >> 4 & 0xF] << 8 | mp_gf2m_sqr_tb[(w) & 0xF] | 66 mp_gf2m_sqr_tb[(w) >> 4 & 0xF] << 8 | mp_gf2m_sqr_tb[(w) & 0xF] |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 99 |
| 94 /* Compute xor-multiply of two binary polynomials (a3, a2, a1, a0) x (b3, b2, b
1, b0) | 100 /* Compute xor-multiply of two binary polynomials (a3, a2, a1, a0) x (b3, b2, b
1, b0) |
| 95 * result is a binary polynomial in 8 mp_digits r[8]. | 101 * result is a binary polynomial in 8 mp_digits r[8]. |
| 96 * The caller MUST ensure that r has the right amount of space allocated. | 102 * The caller MUST ensure that r has the right amount of space allocated. |
| 97 */ | 103 */ |
| 98 void s_bmul_4x4(mp_digit *r, const mp_digit a3, const mp_digit a2, const mp_digi
t a1, | 104 void s_bmul_4x4(mp_digit *r, const mp_digit a3, const mp_digit a2, const mp_digi
t a1, |
| 99 const mp_digit a0, const mp_digit b3, const mp_digit b2, const mp_digit
b1, | 105 const mp_digit a0, const mp_digit b3, const mp_digit b2, const mp_digit
b1, |
| 100 const mp_digit b0); | 106 const mp_digit b0); |
| 101 | 107 |
| 102 #endif /* _MP_GF2M_PRIV_H_ */ | 108 #endif /* _MP_GF2M_PRIV_H_ */ |
| OLD | NEW |