| OLD | NEW |
| 1 /* | 1 /* |
| 2 * math.c | 2 * math.c |
| 3 * | 3 * |
| 4 * crypto math operations and data types | 4 * crypto math operations and data types |
| 5 * | 5 * |
| 6 * David A. McGrew | 6 * David A. McGrew |
| 7 * Cisco Systems, Inc. | 7 * Cisco Systems, Inc. |
| 8 */ | 8 */ |
| 9 /* | 9 /* |
| 10 * | 10 * |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 35 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 36 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 36 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 37 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 37 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 40 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 40 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 41 * OF THE POSSIBILITY OF SUCH DAMAGE. | 41 * OF THE POSSIBILITY OF SUCH DAMAGE. |
| 42 * | 42 * |
| 43 */ | 43 */ |
| 44 | 44 |
| 45 #ifdef HAVE_CONFIG_H |
| 46 #include <config.h> |
| 47 #endif |
| 48 |
| 45 #include "crypto_math.h" | 49 #include "crypto_math.h" |
| 46 | 50 |
| 47 int | 51 int |
| 48 octet_weight[256] = { | 52 octet_weight[256] = { |
| 49 0, 1, 1, 2, 1, 2, 2, 3, | 53 0, 1, 1, 2, 1, 2, 2, 3, |
| 50 1, 2, 2, 3, 2, 3, 3, 4, | 54 1, 2, 2, 3, 2, 3, 3, 4, |
| 51 1, 2, 2, 3, 2, 3, 3, 4, | 55 1, 2, 2, 3, 2, 3, 3, 4, |
| 52 2, 3, 3, 4, 3, 4, 4, 5, | 56 2, 3, 3, 4, 3, 4, 4, 5, |
| 53 1, 2, 2, 3, 2, 3, 3, 4, | 57 1, 2, 2, 3, 2, 3, 3, 4, |
| 54 2, 3, 3, 4, 3, 4, 4, 5, | 58 2, 3, 3, 4, 3, 4, 4, 5, |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 | 628 |
| 625 void | 629 void |
| 626 v128_set_bit_to(v128_t *x, int i, int y){ | 630 v128_set_bit_to(v128_t *x, int i, int y){ |
| 627 _v128_set_bit_to(x, i, y); | 631 _v128_set_bit_to(x, i, y); |
| 628 } | 632 } |
| 629 | 633 |
| 630 | 634 |
| 631 #endif /* DATATYPES_USE_MACROS */ | 635 #endif /* DATATYPES_USE_MACROS */ |
| 632 | 636 |
| 633 | 637 |
| 634 static INLINE void | 638 static inline void |
| 635 v128_left_shift2(v128_t *x, int num_bits) { | 639 v128_left_shift2(v128_t *x, int num_bits) { |
| 636 int i; | 640 int i; |
| 637 int word_shift = num_bits >> 5; | 641 int word_shift = num_bits >> 5; |
| 638 int bit_shift = num_bits & 31; | 642 int bit_shift = num_bits & 31; |
| 639 | 643 |
| 640 for (i=0; i < (4-word_shift); i++) { | 644 for (i=0; i < (4-word_shift); i++) { |
| 641 x->v32[i] = x->v32[i+word_shift] << bit_shift; | 645 x->v32[i] = x->v32[i+word_shift] << bit_shift; |
| 642 } | 646 } |
| 643 | 647 |
| 644 for ( ; i < word_shift; i++) { | 648 for ( ; i < word_shift; i++) { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 return -1; | 797 return -1; |
| 794 return value + 24; | 798 return value + 24; |
| 795 } | 799 } |
| 796 | 800 |
| 797 /* high_bit not done yet */ | 801 /* high_bit not done yet */ |
| 798 | 802 |
| 799 | 803 |
| 800 | 804 |
| 801 | 805 |
| 802 | 806 |
| OLD | NEW |