From 46b4183155a0033f6703a0b4482d279f60b4689c Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Thu, 16 Nov 2017 16:20:34 +0000 Subject: [PATCH] Remove some more unneeded code Reviewed-by: Bernd Edlinger (Merged from https://github.com/openssl/openssl/pull/5105) --- crypto/ec/curve448/constant_time.h | 114 ----------------------------- crypto/ec/curve448/point_448.h | 11 +-- 2 files changed, 1 insertion(+), 124 deletions(-) diff --git a/crypto/ec/curve448/constant_time.h b/crypto/ec/curve448/constant_time.h index 025ffe1729..41cd404d3c 100644 --- a/crypto/ec/curve448/constant_time.h +++ b/crypto/ec/curve448/constant_time.h @@ -181,120 +181,6 @@ constant_time_lookup ( } } -/** - * @brief Constant-time equivalent of memcpy(table + elem_bytes*idx, in, elem_bytes); - * - * The table must be at least as aligned as elem_bytes. The input must be word aligned, - * and if the output size is vector aligned it must also be vector aligned. - * - * The table and input must not alias. - */ -static __inline__ void -__attribute__((unused,always_inline)) -constant_time_insert ( - void *__restrict__ table_, - const void *in_, - word_t elem_bytes, - word_t n_table, - word_t idx -) { - big_register_t big_one = br_set_to_mask(1), big_i = br_set_to_mask(idx); - - /* Can't do pointer arithmetic on void* */ - const unsigned char *in = (const unsigned char *)in_; - unsigned char *table = (unsigned char *)table_; - word_t j,k; - - for (j=0; junaligned - = ( ((unaligned_br_t*)(&table[k+j*elem_bytes]))->unaligned & ~br_mask ) - | ( ((const unaligned_br_t *)(in+k))->unaligned & br_mask ); - } else { - /* aligned */ - *(big_register_t*)(&table[k+j*elem_bytes]) - = ( *(big_register_t*)(&table[k+j*elem_bytes]) & ~br_mask ) - | ( *(const big_register_t *)(in+k) & br_mask ); - } - } - - word_t mask = word_is_zero(idx^j); - if (elem_bytes % sizeof(big_register_t) >= sizeof(word_t)) { - for (; k<=elem_bytes-sizeof(word_t); k+=sizeof(word_t)) { - if (elem_bytes % sizeof(word_t)) { - /* output unaligned, input aligned */ - ((unaligned_word_t*)(&table[k+j*elem_bytes]))->unaligned - = ( ((unaligned_word_t*)(&table[k+j*elem_bytes]))->unaligned & ~mask ) - | ( *(const word_t *)(in+k) & mask ); - } else { - /* aligned */ - *(word_t*)(&table[k+j*elem_bytes]) - = ( *(word_t*)(&table[k+j*elem_bytes]) & ~mask ) - | ( *(const word_t *)(in+k) & mask ); - } - } - } - - if (elem_bytes % sizeof(word_t)) { - for (; kunaligned = br_mask & ((const unaligned_br_t*)(&b[k]))->unaligned; - } else { - /* aligned */ - *(big_register_t *)(a+k) = br_mask & *(const big_register_t*)(&b[k]); - } - } - - if (elem_bytes % sizeof(big_register_t) >= sizeof(word_t)) { - for (; k<=elem_bytes-sizeof(word_t); k+=sizeof(word_t)) { - if (elem_bytes % sizeof(word_t)) { - /* unaligned */ - ((unaligned_word_t*)(&a[k]))->unaligned = mask & ((const unaligned_word_t*)(&b[k]))->unaligned; - } else { - /* aligned */ - *(word_t *)(a+k) = mask & *(const word_t*)(&b[k]); - } - } - } - - if (elem_bytes % sizeof(word_t)) { - for (; k