mirror of
https://github.com/open-quantum-safe/liboqs.git
synced 2025-10-08 00:03:38 -04:00
Removed extern keyword from functions that are directly included in source file.
This commit is contained in:
parent
f8f28c981d
commit
36d0868a8b
@ -4,14 +4,16 @@
|
||||
* Abstract: modular arithmetic optimized for x64 platforms for P503
|
||||
*********************************************************************************************/
|
||||
|
||||
/* OQS note: not needed since this file is #included in another source file
|
||||
#include "../P503_internal.h"
|
||||
|
||||
// Global constants
|
||||
extern const uint64_t p503[NWORDS_FIELD];
|
||||
extern const uint64_t p503p1[NWORDS_FIELD];
|
||||
extern const uint64_t p503x2[NWORDS_FIELD];
|
||||
*/
|
||||
|
||||
__inline void oqs_kex_sidh_msr_fpadd503(const digit_t *a, const digit_t *b, digit_t *c) { // Modular addition, c = a+b mod p503.
|
||||
__inline void fpadd503(const digit_t *a, const digit_t *b, digit_t *c) { // Modular addition, c = a+b mod p503.
|
||||
// Inputs: a, b in [0, 2*p503-1]
|
||||
// Output: c in [0, 2*p503-1]
|
||||
|
||||
@ -41,7 +43,7 @@ __inline void oqs_kex_sidh_msr_fpadd503(const digit_t *a, const digit_t *b, digi
|
||||
#endif
|
||||
}
|
||||
|
||||
__inline void oqs_kex_sidh_msr_fpsub503(const digit_t *a, const digit_t *b, digit_t *c) { // Modular subtraction, c = a-b mod p503.
|
||||
__inline void fpsub503(const digit_t *a, const digit_t *b, digit_t *c) { // Modular subtraction, c = a-b mod p503.
|
||||
// Inputs: a, b in [0, 2*p503-1]
|
||||
// Output: c in [0, 2*p503-1]
|
||||
|
||||
@ -66,7 +68,7 @@ __inline void oqs_kex_sidh_msr_fpsub503(const digit_t *a, const digit_t *b, digi
|
||||
#endif
|
||||
}
|
||||
|
||||
__inline void oqs_kex_sidh_msr_fpneg503(digit_t *a) { // Modular negation, a = -a mod p503.
|
||||
__inline void fpneg503(digit_t *a) { // Modular negation, a = -a mod p503.
|
||||
// Input/output: a in [0, 2*p503-1]
|
||||
unsigned int i, borrow = 0;
|
||||
|
||||
|
@ -4,12 +4,14 @@
|
||||
* Abstract: portable modular arithmetic for P503
|
||||
*********************************************************************************************/
|
||||
|
||||
/* OQS note: not needed since this file is #included in another source file
|
||||
#include "../P503_internal.h"
|
||||
|
||||
// Global constants
|
||||
extern const uint64_t p503[NWORDS_FIELD];
|
||||
extern const uint64_t p503p1[NWORDS_FIELD];
|
||||
extern const uint64_t p503x2[NWORDS_FIELD];
|
||||
*/
|
||||
|
||||
void mp_add503_asm(const digit_t *a, const digit_t *b, digit_t *c) { // Multiprecision addition, c = a+b, where lng(a) = lng(b) = nwords. Returns the carry bit.
|
||||
unsigned int i, carry = 0;
|
||||
@ -37,7 +39,7 @@ digit_t mp_sub503x2_asm(const digit_t *a, const digit_t *b, digit_t *c) { // Mul
|
||||
return (0 - (digit_t) borrow);
|
||||
}
|
||||
|
||||
__inline void oqs_kex_sidh_msr_fpadd503(const digit_t *a, const digit_t *b, digit_t *c) { // Modular addition, c = a+b mod p503.
|
||||
__inline void fpadd503(const digit_t *a, const digit_t *b, digit_t *c) { // Modular addition, c = a+b mod p503.
|
||||
// Inputs: a, b in [0, 2*p503-1]
|
||||
// Output: c in [0, 2*p503-1]
|
||||
unsigned int i, carry = 0;
|
||||
@ -59,7 +61,7 @@ __inline void oqs_kex_sidh_msr_fpadd503(const digit_t *a, const digit_t *b, digi
|
||||
}
|
||||
}
|
||||
|
||||
__inline void oqs_kex_sidh_msr_fpsub503(const digit_t *a, const digit_t *b, digit_t *c) { // Modular subtraction, c = a-b mod p503.
|
||||
__inline void fpsub503(const digit_t *a, const digit_t *b, digit_t *c) { // Modular subtraction, c = a-b mod p503.
|
||||
// Inputs: a, b in [0, 2*p503-1]
|
||||
// Output: c in [0, 2*p503-1]
|
||||
unsigned int i, borrow = 0;
|
||||
@ -76,7 +78,7 @@ __inline void oqs_kex_sidh_msr_fpsub503(const digit_t *a, const digit_t *b, digi
|
||||
}
|
||||
}
|
||||
|
||||
__inline void oqs_kex_sidh_msr_fpneg503(digit_t *a) { // Modular negation, a = -a mod p503.
|
||||
__inline void fpneg503(digit_t *a) { // Modular negation, a = -a mod p503.
|
||||
// Input/output: a in [0, 2*p503-1]
|
||||
unsigned int i, borrow = 0;
|
||||
|
||||
|
@ -83,9 +83,9 @@ static const unsigned int strat_Bob[MAX_Bob - 1] = {
|
||||
// Setting up macro defines and including GF(p), GF(p^2), curve, isogeny and kex functions
|
||||
#define fpcopy fpcopy503
|
||||
#define fpzero fpzero503
|
||||
#define fpadd oqs_kex_sidh_msr_fpadd503
|
||||
#define fpsub oqs_kex_sidh_msr_fpsub503
|
||||
#define fpneg oqs_kex_sidh_msr_fpneg503
|
||||
#define fpadd fpadd503
|
||||
#define fpsub fpsub503
|
||||
#define fpneg fpneg503
|
||||
#define fpdiv2 fpdiv2_503
|
||||
#define fpcorrection fpcorrection503
|
||||
#define fpmul_mont fpmul503_mont
|
||||
@ -95,8 +95,8 @@ static const unsigned int strat_Bob[MAX_Bob - 1] = {
|
||||
#define fpinv_mont_bingcd fpinv503_mont_bingcd
|
||||
#define fp2copy fp2copy503
|
||||
#define fp2zero fp2zero503
|
||||
#define fp2add oqs_kex_sidh_msr_fp2add503
|
||||
#define fp2sub oqs_kex_sidh_msr_fp2sub503
|
||||
#define fp2add fp2add503
|
||||
#define fp2sub fp2sub503
|
||||
#define fp2neg fp2neg503
|
||||
#define fp2div2 fp2div2_503
|
||||
#define fp2correction fp2correction503
|
||||
|
@ -115,15 +115,15 @@ static void fpzero503(digit_t *a);
|
||||
static bool fpequal503_non_constant_time(const digit_t *a, const digit_t *b);
|
||||
|
||||
// Modular addition, c = a+b mod p503
|
||||
extern void fpadd503(const digit_t *a, const digit_t *b, digit_t *c);
|
||||
static void fpadd503(const digit_t *a, const digit_t *b, digit_t *c);
|
||||
extern void fpadd503_asm(const digit_t *a, const digit_t *b, digit_t *c);
|
||||
|
||||
// Modular subtraction, c = a-b mod p503
|
||||
extern void fpsub503(const digit_t *a, const digit_t *b, digit_t *c);
|
||||
static void fpsub503(const digit_t *a, const digit_t *b, digit_t *c);
|
||||
extern void fpsub503_asm(const digit_t *a, const digit_t *b, digit_t *c);
|
||||
|
||||
// Modular negation, a = -a mod p503
|
||||
extern void fpneg503(digit_t *a);
|
||||
static void fpneg503(digit_t *a);
|
||||
|
||||
// Modular division by two, c = a/2 mod p503.
|
||||
static void fpdiv2_503(const digit_t *a, digit_t *c);
|
||||
@ -169,10 +169,10 @@ static void fp2zero503(f2elm_t a);
|
||||
static void fp2neg503(f2elm_t a);
|
||||
|
||||
// GF(p503^2) addition, c = a+b in GF(p503^2)
|
||||
extern void fp2add503(const f2elm_t a, const f2elm_t b, f2elm_t c);
|
||||
static void fp2add503(const f2elm_t a, const f2elm_t b, f2elm_t c);
|
||||
|
||||
// GF(p503^2) subtraction, c = a-b in GF(p503^2)
|
||||
extern void fp2sub503(const f2elm_t a, const f2elm_t b, f2elm_t c);
|
||||
static void fp2sub503(const f2elm_t a, const f2elm_t b, f2elm_t c);
|
||||
|
||||
// GF(p503^2) division by two, c = a/2 in GF(p503^2)
|
||||
static void fp2div2_503(const f2elm_t a, f2elm_t c);
|
||||
|
@ -4,14 +4,16 @@
|
||||
* Abstract: portable modular arithmetic for P503
|
||||
*********************************************************************************************/
|
||||
|
||||
/* OQS note: not needed since this file is #included in another source file
|
||||
#include "../P503_internal.h"
|
||||
|
||||
// Global constants
|
||||
extern const uint64_t p503[NWORDS_FIELD];
|
||||
extern const uint64_t p503p1[NWORDS_FIELD];
|
||||
extern const uint64_t p503x2[NWORDS_FIELD];
|
||||
*/
|
||||
|
||||
__inline void oqs_kex_sidh_msr_fpadd503(const digit_t *a, const digit_t *b, digit_t *c) { // Modular addition, c = a+b mod p503.
|
||||
__inline void fpadd503(const digit_t *a, const digit_t *b, digit_t *c) { // Modular addition, c = a+b mod p503.
|
||||
// Inputs: a, b in [0, 2*p503-1]
|
||||
// Output: c in [0, 2*p503-1]
|
||||
unsigned int i, carry = 0;
|
||||
@ -33,7 +35,7 @@ __inline void oqs_kex_sidh_msr_fpadd503(const digit_t *a, const digit_t *b, digi
|
||||
}
|
||||
}
|
||||
|
||||
__inline void oqs_kex_sidh_msr_fpsub503(const digit_t *a, const digit_t *b, digit_t *c) { // Modular subtraction, c = a-b mod p503.
|
||||
__inline void fpsub503(const digit_t *a, const digit_t *b, digit_t *c) { // Modular subtraction, c = a-b mod p503.
|
||||
// Inputs: a, b in [0, 2*p503-1]
|
||||
// Output: c in [0, 2*p503-1]
|
||||
unsigned int i, borrow = 0;
|
||||
@ -50,7 +52,7 @@ __inline void oqs_kex_sidh_msr_fpsub503(const digit_t *a, const digit_t *b, digi
|
||||
}
|
||||
}
|
||||
|
||||
__inline void oqs_kex_sidh_msr_fpneg503(digit_t *a) { // Modular negation, a = -a mod p503.
|
||||
__inline void fpneg503(digit_t *a) { // Modular negation, a = -a mod p503.
|
||||
// Input/output: a in [0, 2*p503-1]
|
||||
unsigned int i, borrow = 0;
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
* Abstract: modular arithmetic optimized for x64 platforms for P751
|
||||
*********************************************************************************************/
|
||||
|
||||
/* OQS note: not needed since this file is #included in another source file
|
||||
#include "../P751_internal.h"
|
||||
|
||||
|
||||
@ -11,9 +12,9 @@
|
||||
extern const uint64_t p751[NWORDS_FIELD];
|
||||
extern const uint64_t p751p1[NWORDS_FIELD];
|
||||
extern const uint64_t p751x2[NWORDS_FIELD];
|
||||
*/
|
||||
|
||||
|
||||
__inline void oqs_kex_sidh_msr_fpadd751(const digit_t* a, const digit_t* b, digit_t* c)
|
||||
__inline void fpadd751(const digit_t* a, const digit_t* b, digit_t* c)
|
||||
{ // Modular addition, c = a+b mod p751.
|
||||
// Inputs: a, b in [0, 2*p751-1]
|
||||
// Output: c in [0, 2*p751-1]
|
||||
@ -45,7 +46,7 @@ __inline void oqs_kex_sidh_msr_fpadd751(const digit_t* a, const digit_t* b, digi
|
||||
}
|
||||
|
||||
|
||||
__inline void oqs_kex_sidh_msr_fpsub751(const digit_t* a, const digit_t* b, digit_t* c)
|
||||
__inline void fpsub751(const digit_t* a, const digit_t* b, digit_t* c)
|
||||
{ // Modular subtraction, c = a-b mod p751.
|
||||
// Inputs: a, b in [0, 2*p751-1]
|
||||
// Output: c in [0, 2*p751-1]
|
||||
@ -72,7 +73,7 @@ __inline void oqs_kex_sidh_msr_fpsub751(const digit_t* a, const digit_t* b, digi
|
||||
}
|
||||
|
||||
|
||||
__inline void oqs_kex_sidh_msr_fpneg751(digit_t* a)
|
||||
__inline void fpneg751(digit_t* a)
|
||||
{ // Modular negation, a = -a mod p751.
|
||||
// Input/output: a in [0, 2*p751-1]
|
||||
unsigned int i, borrow = 0;
|
||||
|
@ -13,14 +13,15 @@
|
||||
*
|
||||
*********************************************************************************************/
|
||||
|
||||
/* OQS note: not needed since this file is #included in another source file
|
||||
#include "../P751_internal.h"
|
||||
|
||||
// Global constants
|
||||
extern const uint64_t p751[NWORDS_FIELD];
|
||||
extern const uint64_t p751x2[NWORDS_FIELD];
|
||||
*/
|
||||
|
||||
|
||||
__inline void oqs_kex_sidh_msr_fpadd751(const digit_t* a, const digit_t* b, digit_t* c)
|
||||
__inline void fpadd751(const digit_t* a, const digit_t* b, digit_t* c)
|
||||
{ // Modular addition, c = a+b mod p751.
|
||||
// Inputs: a, b in [0, 2*p751-1]
|
||||
// Output: c in [0, 2*p751-1]
|
||||
@ -29,7 +30,7 @@ __inline void oqs_kex_sidh_msr_fpadd751(const digit_t* a, const digit_t* b, digi
|
||||
}
|
||||
|
||||
|
||||
__inline void oqs_kex_sidh_msr_fpsub751(const digit_t* a, const digit_t* b, digit_t* c)
|
||||
__inline void fpsub751(const digit_t* a, const digit_t* b, digit_t* c)
|
||||
{ // Modular subtraction, c = a-b mod p751.
|
||||
// Inputs: a, b in [0, 2*p751-1]
|
||||
// Output: c in [0, 2*p751-1]
|
||||
@ -38,7 +39,7 @@ __inline void oqs_kex_sidh_msr_fpsub751(const digit_t* a, const digit_t* b, digi
|
||||
}
|
||||
|
||||
|
||||
__inline void oqs_kex_sidh_msr_fpneg751(digit_t* a)
|
||||
__inline void fpneg751(digit_t* a)
|
||||
{ // Modular negation, a = -a mod p751.
|
||||
// Input/output: a in [0, 2*p751-1]
|
||||
unsigned int i, borrow = 0;
|
||||
|
@ -88,9 +88,9 @@ static const unsigned int strat_Bob[MAX_Bob - 1] = {
|
||||
// Setting up macro defines and including GF(p), GF(p^2), curve, isogeny and kex functions
|
||||
#define fpcopy fpcopy751
|
||||
#define fpzero fpzero751
|
||||
#define fpadd oqs_kex_sidh_msr_fpadd751
|
||||
#define fpsub oqs_kex_sidh_msr_fpsub751
|
||||
#define fpneg oqs_kex_sidh_msr_fpneg751
|
||||
#define fpadd fpadd751
|
||||
#define fpsub fpsub751
|
||||
#define fpneg fpneg751
|
||||
#define fpdiv2 fpdiv2_751
|
||||
#define fpcorrection fpcorrection751
|
||||
#define fpmul_mont fpmul751_mont
|
||||
@ -100,8 +100,8 @@ static const unsigned int strat_Bob[MAX_Bob - 1] = {
|
||||
#define fpinv_mont_bingcd fpinv751_mont_bingcd
|
||||
#define fp2copy fp2copy751
|
||||
#define fp2zero fp2zero751
|
||||
#define fp2add oqs_kex_sidh_msr_fp2add751
|
||||
#define fp2sub oqs_kex_sidh_msr_fp2sub751
|
||||
#define fp2add fp2add751
|
||||
#define fp2sub fp2sub751
|
||||
#define fp2neg fp2neg751
|
||||
#define fp2div2 fp2div2_751
|
||||
#define fp2correction fp2correction751
|
||||
|
@ -116,15 +116,15 @@ static void fpzero751(digit_t* a);
|
||||
static bool fpequal751_non_constant_time(const digit_t* a, const digit_t* b);
|
||||
|
||||
// Modular addition, c = a+b mod p751
|
||||
extern void fpadd751(const digit_t* a, const digit_t* b, digit_t* c);
|
||||
static void fpadd751(const digit_t* a, const digit_t* b, digit_t* c);
|
||||
extern void fpadd751_asm(const digit_t* a, const digit_t* b, digit_t* c);
|
||||
|
||||
// Modular subtraction, c = a-b mod p751
|
||||
extern void fpsub751(const digit_t* a, const digit_t* b, digit_t* c);
|
||||
static void fpsub751(const digit_t* a, const digit_t* b, digit_t* c);
|
||||
extern void fpsub751_asm(const digit_t* a, const digit_t* b, digit_t* c);
|
||||
|
||||
// Modular negation, a = -a mod p751
|
||||
extern void fpneg751(digit_t* a);
|
||||
static void fpneg751(digit_t* a);
|
||||
|
||||
// Modular division by two, c = a/2 mod p751.
|
||||
static void fpdiv2_751(const digit_t* a, digit_t* c);
|
||||
@ -170,10 +170,10 @@ static void fp2zero751(f2elm_t a);
|
||||
static void fp2neg751(f2elm_t a);
|
||||
|
||||
// GF(p751^2) addition, c = a+b in GF(p751^2)
|
||||
extern void fp2add751(const f2elm_t a, const f2elm_t b, f2elm_t c);
|
||||
static void fp2add751(const f2elm_t a, const f2elm_t b, f2elm_t c);
|
||||
|
||||
// GF(p751^2) subtraction, c = a-b in GF(p751^2)
|
||||
extern void fp2sub751(const f2elm_t a, const f2elm_t b, f2elm_t c);
|
||||
static void fp2sub751(const f2elm_t a, const f2elm_t b, f2elm_t c);
|
||||
|
||||
// GF(p751^2) division by two, c = a/2 in GF(p751^2)
|
||||
static void fp2div2_751(const f2elm_t a, f2elm_t c);
|
||||
|
@ -4,14 +4,15 @@
|
||||
* Abstract: portable modular arithmetic for P751
|
||||
*********************************************************************************************/
|
||||
|
||||
/* OQS note: not needed since this file is #included in another source file
|
||||
#include "../P751_internal.h"
|
||||
|
||||
// Global constants
|
||||
extern const uint64_t p751[NWORDS_FIELD];
|
||||
extern const uint64_t p751p1[NWORDS_FIELD];
|
||||
extern const uint64_t p751x2[NWORDS_FIELD];
|
||||
|
||||
__inline void oqs_kex_sidh_msr_fpadd751(const digit_t *a, const digit_t *b, digit_t *c) { // Modular addition, c = a+b mod p751.
|
||||
*/
|
||||
__inline void fpadd751(const digit_t *a, const digit_t *b, digit_t *c) { // Modular addition, c = a+b mod p751.
|
||||
// Inputs: a, b in [0, 2*p751-1]
|
||||
// Output: c in [0, 2*p751-1]
|
||||
unsigned int i, carry = 0;
|
||||
@ -33,7 +34,7 @@ __inline void oqs_kex_sidh_msr_fpadd751(const digit_t *a, const digit_t *b, digi
|
||||
}
|
||||
}
|
||||
|
||||
__inline void oqs_kex_sidh_msr_fpsub751(const digit_t *a, const digit_t *b, digit_t *c) { // Modular subtraction, c = a-b mod p751.
|
||||
__inline void fpsub751(const digit_t *a, const digit_t *b, digit_t *c) { // Modular subtraction, c = a-b mod p751.
|
||||
// Inputs: a, b in [0, 2*p751-1]
|
||||
// Output: c in [0, 2*p751-1]
|
||||
unsigned int i, borrow = 0;
|
||||
@ -50,7 +51,7 @@ __inline void oqs_kex_sidh_msr_fpsub751(const digit_t *a, const digit_t *b, digi
|
||||
}
|
||||
}
|
||||
|
||||
__inline void oqs_kex_sidh_msr_fpneg751(digit_t *a) { // Modular negation, a = -a mod p751.
|
||||
__inline void fpneg751(digit_t *a) { // Modular negation, a = -a mod p751.
|
||||
// Input/output: a in [0, 2*p751-1]
|
||||
unsigned int i, borrow = 0;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user