WIP
Change-Id: Ib4714d94fbda9f604683ad4c64dcb222714f4a85
This commit is contained in:
parent
4d03fe12e5
commit
29e9ce00cb
10
third_party/sike/fpx.c
vendored
10
third_party/sike/fpx.c
vendored
@ -163,9 +163,9 @@ inline static void mp_addfast(const felm_t a, const felm_t b, felm_t c)
|
||||
|
||||
// Multiprecision subtraction, c = a-b, where lng(a) = lng(b) = 2*NWORDS_FIELD.
|
||||
// If c < 0 then returns mask = 0xFF..F, else mask = 0x00..0
|
||||
inline static crypto_word_t mp_subfast(const felm_t a, const felm_t b, felm_t c) {
|
||||
inline static crypto_word_t mp_subfast(const dfelm_t a, const dfelm_t b, dfelm_t c) {
|
||||
#if defined(OPENSSL_NO_ASM)
|
||||
return (0 - (crypto_word_t)mp_sub(a, b, c, 2*NWORDS_FIELD));
|
||||
return (0 - (crypto_word_t)mp_sub((felm_t)a, (felm_t)b, (felm_t)c, 2*NWORDS_FIELD));
|
||||
#else
|
||||
return sike_mpsubx2_asm(a, b, c);
|
||||
#endif
|
||||
@ -173,10 +173,10 @@ inline static crypto_word_t mp_subfast(const felm_t a, const felm_t b, felm_t c)
|
||||
|
||||
// Multiprecision subtraction, c = c-a-b, where lng(a) = lng(b) = 2*NWORDS_FIELD.
|
||||
// Inputs should be s.t. c > a and c > b
|
||||
inline static void mp_dblsubfast(const felm_t a, const felm_t b, felm_t c) {
|
||||
inline static void mp_dblsubfast(const dfelm_t a, const dfelm_t b, dfelm_t c) {
|
||||
#if defined(OPENSSL_NO_ASM)
|
||||
mp_sub(c, a, c, 2*NWORDS_FIELD);
|
||||
mp_sub(c, b, c, 2*NWORDS_FIELD);
|
||||
mp_sub((felm_t)c, (felm_t)a, (felm_t)c, 2*NWORDS_FIELD);
|
||||
mp_sub((felm_t)c, (felm_t)b, (felm_t)c, 2*NWORDS_FIELD);
|
||||
#else
|
||||
sike_mpdblsubx2_asm(a, b, c);
|
||||
#endif
|
||||
|
2
third_party/sike/fpx.h
vendored
2
third_party/sike/fpx.h
vendored
@ -22,7 +22,7 @@ void sike_fprdc(const dfelm_t a, felm_t c);
|
||||
// Double 2x503-bit multiprecision subtraction, c = c-a-b
|
||||
void sike_mpdblsubx2_asm(const felm_t a, const felm_t b, felm_t c);
|
||||
// Multiprecision subtraction, c = a-b
|
||||
crypto_word_t sike_mpsubx2_asm(const felm_t a, const felm_t b, felm_t c);
|
||||
crypto_word_t sike_mpsubx2_asm(const dfelm_t a, const dfelm_t b, dfelm_t c);
|
||||
// 503-bit multiprecision addition, c = a+b
|
||||
void sike_mpadd_asm(const felm_t a, const felm_t b, felm_t c);
|
||||
// Modular negation, a = -a mod p503.
|
||||
|
5
third_party/sike/sike_test.cc
vendored
5
third_party/sike/sike_test.cc
vendored
@ -196,12 +196,13 @@ TEST(SIKE, Negative) {
|
||||
#if defined(SUPPORTS_ABI_TEST) && defined(OPENSSL_X86_64)
|
||||
TEST(SIKE, ABI) {
|
||||
felm_t a, b, c;
|
||||
dfelm_t d;
|
||||
dfelm_t d, e, f;
|
||||
CHECK_ABI(sike_fpadd, a, b, c);
|
||||
CHECK_ABI(sike_fpsub, a, b, c);
|
||||
CHECK_ABI(sike_mpmul, a, b, d);
|
||||
CHECK_ABI(sike_fprdc, d, a);
|
||||
CHECK_ABI(sike_mpadd_asm, a, b, c);
|
||||
CHECK_ABI(sike_mpsubx2_asm, a, b, c);
|
||||
CHECK_ABI(sike_mpsubx2_asm, d, e, f);
|
||||
CHECK_ABI(sike_mpdblsubx2_asm, d, e, f);
|
||||
}
|
||||
#endif // SUPPORTS_ABI_TEST && X86_64
|
||||
|
Loading…
Reference in New Issue
Block a user