This is an automated email from the ASF dual-hosted git repository. sandreoli pushed a commit to branch issue61 in repository https://gitbox.apache.org/repos/asf/incubator-milagro-crypto-c.git
commit 3aad5d82e2819200f13e6047b90b1274b6c8a5d7 Author: samuele-andreoli <[email protected]> AuthorDate: Mon Jan 6 12:35:31 2020 +0000 run code format --- benchmark/benchtest_paillier.c.in | 10 +++++----- include/paillier.h | 10 ++++++---- src/ff.c.in | 3 ++- src/paillier.c | 4 ++-- test/test_paillier_keygen.c | 2 +- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/benchmark/benchtest_paillier.c.in b/benchmark/benchtest_paillier.c.in index a3c4a24..765e8eb 100644 --- a/benchmark/benchtest_paillier.c.in +++ b/benchmark/benchtest_paillier.c.in @@ -64,7 +64,7 @@ static void print_platform_info() { #if defined(__linux__) printf("Target platform:\tLinux "); - + #if defined(__x86_64__) printf("(64-bit)\n"); #else @@ -89,9 +89,9 @@ static void print_platform_info() static void print_paillier_configuration() { - printf("Project Version:\t@BUILD_VERSION@\n"); + printf("Project Version:\t@BUILD_VERSION@\n"); printf("CFLAGS:\t\t\t@CMAKE_C_FLAGS@\n"); - printf("Build type:\t\t@CMAKE_BUILD_TYPE@\n"); + printf("Build type:\t\t@CMAKE_BUILD_TYPE@\n"); printf("AMCL Version:\t\t@AMCL_VERSION_MAJOR@.@AMCL_VERSION_MINOR@.@AMCL_VERSION_PATCH@\n"); printf("AMCL Detected OS:\t@OS@\n"); printf("AMCL CHUNK:\t\t%d\n", CHUNK); @@ -176,7 +176,7 @@ int paillier(csprng *RNG) printf("Timing info\n"); printf("===========\n"); - + // Generating public/private key pair iterations=0; start=clock(); @@ -265,7 +265,7 @@ int paillier(csprng *RNG) printf("Size info\n"); printf("=========\n"); - + printf("public key n\t%d bytes\n", FS_2048); printf("public key g\t%d bytes\n", FS_2048); printf("secret key lp\t%d bytes\n", HFS_2048); diff --git a/include/paillier.h b/include/paillier.h index f1c57e3..ce6e2cc 100644 --- a/include/paillier.h +++ b/include/paillier.h @@ -41,17 +41,19 @@ under the License. /*! * \brief Paillier Public Key */ -typedef struct{ +typedef struct +{ BIG_512_60 n[FFLEN_4096]; /**< Paillier Modulus - \f$ n = pq \f$ */ BIG_512_60 g[FFLEN_4096]; /**< Public Base - \f$ g = n+1 \f$ */ BIG_512_60 n2[FFLEN_4096]; /**< Precomputed \f$ n^2 \f$ */ -}PAILLIER_public_key; +} PAILLIER_public_key; /*! * \brief Paillier Private Key */ -typedef struct{ +typedef struct +{ BIG_1024_58 p[HFLEN_2048]; /**< Secret Prime */ BIG_1024_58 q[HFLEN_2048]; /**< Secret Prime */ @@ -66,7 +68,7 @@ typedef struct{ BIG_1024_58 mp[HFLEN_2048]; /**< Precomputed \f$ L(g^{lp} \pmod{p^2})^{-1} \f$ */ BIG_1024_58 mq[HFLEN_2048]; /**< Precomputed \f$ L(g^{lq} \pmod{q^2})^{-1} \f$ */ -}PAILLIER_private_key; +} PAILLIER_private_key; /*! \brief Generate the key pair * diff --git a/src/ff.c.in b/src/ff.c.in index dbec31f..e1eada0 100644 --- a/src/ff.c.in +++ b/src/ff.c.in @@ -825,7 +825,8 @@ void FF_WWW_skspow(BIG_XXX r[],BIG_XXX x[],BIG_XXX e,BIG_XXX p[],int n) } /* r=x^e*y^f mod p - side channel resistant */ -void FF_WWW_skpow2(BIG_XXX r[],BIG_XXX x[], BIG_XXX e[], BIG_XXX y[], BIG_XXX f[], BIG_XXX p[], int n, int en) { +void FF_WWW_skpow2(BIG_XXX r[],BIG_XXX x[], BIG_XXX e[], BIG_XXX y[], BIG_XXX f[], BIG_XXX p[], int n, int en) +{ int i,eb,fb; #ifndef C99 BIG_XXX xn[FFLEN_WWW],yn[FFLEN_WWW],xy[FFLEN_WWW],w[FFLEN_WWW],ND[FFLEN_WWW]; diff --git a/src/paillier.c b/src/paillier.c index 047fc87..7eb7ef0 100644 --- a/src/paillier.c +++ b/src/paillier.c @@ -27,7 +27,7 @@ under the License. #include "ff_2048.h" #include "paillier.h" -// generate a Paillier key pair +// generate a Paillier key pair void PAILLIER_KEY_PAIR(csprng *RNG, octet *P, octet* Q, PAILLIER_public_key *PUB, PAILLIER_private_key *PRIV) { char oct[FS_2048]; @@ -251,7 +251,7 @@ void PAILLIER_DECRYPT(PAILLIER_private_key *PRIV, octet* CT, octet* PT) FF_2048_zero(dws, 2 * FFLEN_2048); } -// Homomorphic addition of plaintexts +// Homomorphic addition of plaintexts void PAILLIER_ADD(PAILLIER_public_key *PUB, octet* CT1, octet* CT2, octet* CT) { // ciphertext diff --git a/test/test_paillier_keygen.c b/test/test_paillier_keygen.c index 0b65b2a..a7f8689 100644 --- a/test/test_paillier_keygen.c +++ b/test/test_paillier_keygen.c @@ -117,7 +117,7 @@ int main(int argc, char** argv) octet PGOLDEN = {0,sizeof(pgolden),pgolden}; const char* Pline = "P = "; - char qgolden[HFS_2048]={0}; + char qgolden[HFS_2048]= {0}; octet QGOLDEN = {0,sizeof(qgolden),qgolden}; const char* Qline = "Q = ";
