From 3cce789304852cbe11281ff8243d3f5fafc98e68 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 23 Feb 2017 11:22:00 +0100 Subject: [PATCH] Indent --- test/default/scalarmult.c | 39 ++++++++++++++++++++------------------ test/default/scalarmult2.c | 14 ++++++++------ test/default/scalarmult5.c | 23 ++++++++++++---------- test/default/scalarmult6.c | 27 ++++++++++++++------------ test/default/scalarmult7.c | 19 +++++++++---------- 5 files changed, 66 insertions(+), 56 deletions(-) diff --git a/test/default/scalarmult.c b/test/default/scalarmult.c index 063dd5d2..3dfb2e83 100644 --- a/test/default/scalarmult.c +++ b/test/default/scalarmult.c @@ -2,32 +2,35 @@ #define TEST_NAME "scalarmult" #include "cmptest.h" -static const unsigned char alicesk[crypto_scalarmult_BYTES] - = { 0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5, 0x7d, 0x3c, 0x16, 0xc1, - 0x72, 0x51, 0xb2, 0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb, 0xc0, - 0x99, 0x2a, 0xb1, 0x77, 0xfb, 0xa5, 0x1d, 0xb9, 0x2c, 0x2a }; +static const unsigned char alicesk[crypto_scalarmult_BYTES] = { + 0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5, 0x7d, 0x3c, 0x16, 0xc1, + 0x72, 0x51, 0xb2, 0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb, 0xc0, + 0x99, 0x2a, 0xb1, 0x77, 0xfb, 0xa5, 0x1d, 0xb9, 0x2c, 0x2a +}; -static const unsigned char bobsk[crypto_scalarmult_BYTES] - = { 0x5d, 0xab, 0x08, 0x7e, 0x62, 0x4a, 0x8a, 0x4b, 0x79, 0xe1, 0x7f, - 0x8b, 0x83, 0x80, 0x0e, 0xe6, 0x6f, 0x3b, 0xb1, 0x29, 0x26, 0x18, - 0xb6, 0xfd, 0x1c, 0x2f, 0x8b, 0x27, 0xff, 0x88, 0xe0, 0xeb }; +static const unsigned char bobsk[crypto_scalarmult_BYTES] = { + 0x5d, 0xab, 0x08, 0x7e, 0x62, 0x4a, 0x8a, 0x4b, 0x79, 0xe1, 0x7f, + 0x8b, 0x83, 0x80, 0x0e, 0xe6, 0x6f, 0x3b, 0xb1, 0x29, 0x26, 0x18, + 0xb6, 0xfd, 0x1c, 0x2f, 0x8b, 0x27, 0xff, 0x88, 0xe0, 0xeb +}; -static const unsigned char small_order_p[crypto_scalarmult_BYTES] - = { 0xe0, 0xeb, 0x7a, 0x7c, 0x3b, 0x41, 0xb8, 0xae, 0x16, 0x56, 0xe3, - 0xfa, 0xf1, 0x9f, 0xc4, 0x6a, 0xda, 0x09, 0x8d, 0xeb, 0x9c, 0x32, - 0xb1, 0xfd, 0x86, 0x62, 0x05, 0x16, 0x5f, 0x49, 0xb8, 0x00 }; +static const unsigned char small_order_p[crypto_scalarmult_BYTES] = { + 0xe0, 0xeb, 0x7a, 0x7c, 0x3b, 0x41, 0xb8, 0xae, 0x16, 0x56, 0xe3, + 0xfa, 0xf1, 0x9f, 0xc4, 0x6a, 0xda, 0x09, 0x8d, 0xeb, 0x9c, 0x32, + 0xb1, 0xfd, 0x86, 0x62, 0x05, 0x16, 0x5f, 0x49, 0xb8, 0x00 +}; static char hex[crypto_scalarmult_BYTES * 2 + 1]; -int main(void) +int +main(void) { unsigned char *alicepk = (unsigned char *) sodium_malloc(crypto_scalarmult_BYTES); unsigned char *bobpk = (unsigned char *) sodium_malloc(crypto_scalarmult_BYTES); - unsigned char *k = - (unsigned char *) sodium_malloc(crypto_scalarmult_BYTES); - int ret; + unsigned char *k = (unsigned char *) sodium_malloc(crypto_scalarmult_BYTES); + int ret; assert(alicepk != NULL && bobpk != NULL && k != NULL); @@ -62,8 +65,8 @@ int main(void) assert(crypto_scalarmult_scalarbytes() > 0U); assert(strcmp(crypto_scalarmult_primitive(), "curve25519") == 0); assert(crypto_scalarmult_bytes() == crypto_scalarmult_curve25519_bytes()); - assert(crypto_scalarmult_scalarbytes() - == crypto_scalarmult_curve25519_scalarbytes()); + assert(crypto_scalarmult_scalarbytes() == + crypto_scalarmult_curve25519_scalarbytes()); assert(crypto_scalarmult_bytes() == crypto_scalarmult_scalarbytes()); return 0; diff --git a/test/default/scalarmult2.c b/test/default/scalarmult2.c index 43bd6ab4..58776cf5 100644 --- a/test/default/scalarmult2.c +++ b/test/default/scalarmult2.c @@ -2,14 +2,16 @@ #define TEST_NAME "scalarmult2" #include "cmptest.h" -static unsigned char bobsk[32] - = { 0x5d, 0xab, 0x08, 0x7e, 0x62, 0x4a, 0x8a, 0x4b, 0x79, 0xe1, 0x7f, - 0x8b, 0x83, 0x80, 0x0e, 0xe6, 0x6f, 0x3b, 0xb1, 0x29, 0x26, 0x18, - 0xb6, 0xfd, 0x1c, 0x2f, 0x8b, 0x27, 0xff, 0x88, 0xe0, 0xeb }; +static unsigned char bobsk[32] = { 0x5d, 0xab, 0x08, 0x7e, 0x62, 0x4a, 0x8a, + 0x4b, 0x79, 0xe1, 0x7f, 0x8b, 0x83, 0x80, + 0x0e, 0xe6, 0x6f, 0x3b, 0xb1, 0x29, 0x26, + 0x18, 0xb6, 0xfd, 0x1c, 0x2f, 0x8b, 0x27, + 0xff, 0x88, 0xe0, 0xeb }; static unsigned char bobpk[32]; -int main(void) +int +main(void) { int i; @@ -21,7 +23,7 @@ int main(void) } else { printf(" "); } - printf("0x%02x", (unsigned int)bobpk[i]); + printf("0x%02x", (unsigned int) bobpk[i]); if (i % 8 == 7) { printf("\n"); } diff --git a/test/default/scalarmult5.c b/test/default/scalarmult5.c index 2bc06d19..f92aa408 100644 --- a/test/default/scalarmult5.c +++ b/test/default/scalarmult5.c @@ -2,19 +2,22 @@ #define TEST_NAME "scalarmult5" #include "cmptest.h" -static unsigned char alicesk[32] - = { 0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5, 0x7d, 0x3c, 0x16, 0xc1, - 0x72, 0x51, 0xb2, 0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb, 0xc0, - 0x99, 0x2a, 0xb1, 0x77, 0xfb, 0xa5, 0x1d, 0xb9, 0x2c, 0x2a }; +static unsigned char alicesk[32] = { 0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5, + 0x7d, 0x3c, 0x16, 0xc1, 0x72, 0x51, 0xb2, + 0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb, + 0xc0, 0x99, 0x2a, 0xb1, 0x77, 0xfb, 0xa5, + 0x1d, 0xb9, 0x2c, 0x2a }; -static unsigned char bobpk[32] - = { 0xde, 0x9e, 0xdb, 0x7d, 0x7b, 0x7d, 0xc1, 0xb4, 0xd3, 0x5b, 0x61, - 0xc2, 0xec, 0xe4, 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b, 0x78, - 0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, 0x6f, 0x88, 0x2b, 0x4f }; +static unsigned char bobpk[32] = { 0xde, 0x9e, 0xdb, 0x7d, 0x7b, 0x7d, 0xc1, + 0xb4, 0xd3, 0x5b, 0x61, 0xc2, 0xec, 0xe4, + 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b, + 0x78, 0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, + 0x6f, 0x88, 0x2b, 0x4f }; static unsigned char k[32]; -int main(void) +int +main(void) { int i; int ret; @@ -28,7 +31,7 @@ int main(void) } else { printf(" "); } - printf("0x%02x", (unsigned int)k[i]); + printf("0x%02x", (unsigned int) k[i]); if (i % 8 == 7) { printf("\n"); } diff --git a/test/default/scalarmult6.c b/test/default/scalarmult6.c index 6b9bd6ac..f8f07842 100644 --- a/test/default/scalarmult6.c +++ b/test/default/scalarmult6.c @@ -2,17 +2,20 @@ #define TEST_NAME "scalarmult6" #include "cmptest.h" -static unsigned char bobsk_[crypto_scalarmult_SCALARBYTES] - = { 0x5d, 0xab, 0x08, 0x7e, 0x62, 0x4a, 0x8a, 0x4b, 0x79, 0xe1, 0x7f, - 0x8b, 0x83, 0x80, 0x0e, 0xe6, 0x6f, 0x3b, 0xb1, 0x29, 0x26, 0x18, - 0xb6, 0xfd, 0x1c, 0x2f, 0x8b, 0x27, 0xff, 0x88, 0xe0, 0xeb }; +static unsigned char bobsk_[crypto_scalarmult_SCALARBYTES] = { + 0x5d, 0xab, 0x08, 0x7e, 0x62, 0x4a, 0x8a, 0x4b, 0x79, 0xe1, 0x7f, + 0x8b, 0x83, 0x80, 0x0e, 0xe6, 0x6f, 0x3b, 0xb1, 0x29, 0x26, 0x18, + 0xb6, 0xfd, 0x1c, 0x2f, 0x8b, 0x27, 0xff, 0x88, 0xe0, 0xeb +}; -static unsigned char alicepk_[crypto_scalarmult_SCALARBYTES] - = { 0x85, 0x20, 0xf0, 0x09, 0x89, 0x30, 0xa7, 0x54, 0x74, 0x8b, 0x7d, - 0xdc, 0xb4, 0x3e, 0xf7, 0x5a, 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38, - 0x1a, 0xf4, 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0x6a }; +static unsigned char alicepk_[crypto_scalarmult_SCALARBYTES] = { + 0x85, 0x20, 0xf0, 0x09, 0x89, 0x30, 0xa7, 0x54, 0x74, 0x8b, 0x7d, + 0xdc, 0xb4, 0x3e, 0xf7, 0x5a, 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38, + 0x1a, 0xf4, 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0x6a +}; -int main(void) +int +main(void) { unsigned char *k; unsigned char *bobsk; @@ -20,8 +23,8 @@ int main(void) int i; int ret; - k = (unsigned char *) sodium_malloc(crypto_scalarmult_BYTES); - bobsk = (unsigned char *) sodium_malloc(crypto_scalarmult_SCALARBYTES); + k = (unsigned char *) sodium_malloc(crypto_scalarmult_BYTES); + bobsk = (unsigned char *) sodium_malloc(crypto_scalarmult_SCALARBYTES); alicepk = (unsigned char *) sodium_malloc(crypto_scalarmult_SCALARBYTES); assert(k != NULL && bobsk != NULL && alicepk != NULL); @@ -40,7 +43,7 @@ int main(void) } else { printf(" "); } - printf("0x%02x", (unsigned int)k[i]); + printf("0x%02x", (unsigned int) k[i]); if (i % 8 == 7) { printf("\n"); } diff --git a/test/default/scalarmult7.c b/test/default/scalarmult7.c index 8e1770cd..54f64c26 100644 --- a/test/default/scalarmult7.c +++ b/test/default/scalarmult7.c @@ -3,29 +3,28 @@ #include "cmptest.h" static unsigned char p1[32] = { - 0x72, 0x20, 0xf0, 0x09, 0x89, 0x30, 0xa7, 0x54, - 0x74, 0x8b, 0x7d, 0xdc, 0xb4, 0x3e, 0xf7, 0x5a, - 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38, 0x1a, 0xf4, - 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0xea + 0x72, 0x20, 0xf0, 0x09, 0x89, 0x30, 0xa7, 0x54, 0x74, 0x8b, 0x7d, + 0xdc, 0xb4, 0x3e, 0xf7, 0x5a, 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38, + 0x1a, 0xf4, 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0xea }; static unsigned char p2[32] = { - 0x85, 0x20, 0xf0, 0x09, 0x89, 0x30, 0xa7, 0x54, - 0x74, 0x8b, 0x7d, 0xdc, 0xb4, 0x3e, 0xf7, 0x5a, - 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38, 0x1a, 0xf4, - 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0x6a + 0x85, 0x20, 0xf0, 0x09, 0x89, 0x30, 0xa7, 0x54, 0x74, 0x8b, 0x7d, + 0xdc, 0xb4, 0x3e, 0xf7, 0x5a, 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38, + 0x1a, 0xf4, 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0x6a }; static unsigned char scalar[32]; static unsigned char out1[32]; static unsigned char out2[32]; -int main(void) +int +main(void) { int ret; scalar[0] = 1U; - ret = crypto_scalarmult_curve25519(out1, scalar, p1); + ret = crypto_scalarmult_curve25519(out1, scalar, p1); assert(ret == 0); ret = crypto_scalarmult_curve25519(out2, scalar, p2); assert(ret == 0);