auto-format by executing `make astyle`
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
diff --git a/bn_mp_rand.c b/bn_mp_rand.c
index f65d728..af017f2 100644
--- a/bn_mp_rand.c
+++ b/bn_mp_rand.c
@@ -22,7 +22,7 @@
#define MP_GEN_RANDOM_MAX 0xffffffffu
#define MP_GEN_RANDOM_SHIFT 32
-static int s_read_arc4random(mp_digit* p)
+static int s_read_arc4random(mp_digit *p)
{
mp_digit d = 0, msk = 0;
do {
@@ -40,11 +40,11 @@ static int s_read_arc4random(mp_digit* p)
#define MP_WIN_CSP
#ifndef _WIN32_WINNT
- #define _WIN32_WINNT 0x0400
+#define _WIN32_WINNT 0x0400
#endif
#ifdef _WIN32_WCE
- #define UNDER_CE
- #define ARM
+#define UNDER_CE
+#define ARM
#endif
#define WIN32_LEAN_AND_MEAN
@@ -59,20 +59,20 @@ static void s_cleanup_win_csp(void)
hProv = 0;
}
-static int s_read_win_csp(mp_digit* p)
+static int s_read_win_csp(mp_digit *p)
{
int ret = -1;
if (hProv == 0) {
if (!CryptAcquireContext(&hProv, NULL, MS_DEF_PROV, PROV_RSA_FULL,
(CRYPT_VERIFYCONTEXT | CRYPT_MACHINE_KEYSET)) &&
- !CryptAcquireContext (&hProv, NULL, MS_DEF_PROV, PROV_RSA_FULL,
+ !CryptAcquireContext(&hProv, NULL, MS_DEF_PROV, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT | CRYPT_MACHINE_KEYSET | CRYPT_NEWKEYSET)) {
hProv = 0;
return ret;
}
atexit(s_cleanup_win_csp);
}
- if (CryptGenRandom(hProv, sizeof(*p), (void*)p) == TRUE) {
+ if (CryptGenRandom(hProv, sizeof(*p), (void *)p) == TRUE) {
ret = MP_OKAY;
}
return ret;
@@ -85,12 +85,12 @@ static int s_read_win_csp(mp_digit* p)
#include <sys/random.h>
#include <errno.h>
-static int s_read_getrandom(mp_digit* p)
+static int s_read_getrandom(mp_digit *p)
{
int ret;
do {
ret = getrandom(p, sizeof(*p), 0);
- } while((ret == -1) && (errno == EINTR));
+ } while ((ret == -1) && (errno == EINTR));
if (ret == sizeof(*p)) return MP_OKAY;
return -1;
}
@@ -108,17 +108,17 @@ static int s_read_getrandom(mp_digit* p)
#include <errno.h>
#include <unistd.h>
-static int s_read_dev_urandom(mp_digit* p)
+static int s_read_dev_urandom(mp_digit *p)
{
ssize_t r;
int fd;
do {
fd = open(MP_DEV_URANDOM, O_RDONLY);
- } while((fd == -1) && (errno == EINTR));
+ } while ((fd == -1) && (errno == EINTR));
if (fd == -1) return -1;
do {
r = read(fd, p, sizeof(*p));
- } while((r == -1) && (errno == EINTR));
+ } while ((r == -1) && (errno == EINTR));
close(fd);
if (r != sizeof(*p)) return -1;
return MP_OKAY;
@@ -129,17 +129,17 @@ static int s_read_dev_urandom(mp_digit* p)
unsigned long (*ltm_rng)(unsigned char *out, unsigned long outlen, void (*callback)(void));
void (*ltm_rng_callback)(void);
-static int s_read_ltm_rng(mp_digit* p)
+static int s_read_ltm_rng(mp_digit *p)
{
unsigned long ret;
if (ltm_rng == NULL) return -1;
- ret = ltm_rng((void*)p, sizeof(*p), ltm_rng_callback);
+ ret = ltm_rng((void *)p, sizeof(*p), ltm_rng_callback);
if (ret != sizeof(*p)) return -1;
return MP_OKAY;
}
#endif
-static int s_rand_digit(mp_digit* p)
+static int s_rand_digit(mp_digit *p)
{
int ret = -1;
diff --git a/bn_mp_tc_div_2d.c b/bn_mp_tc_div_2d.c
index 3c617ef..ea190c3 100644
--- a/bn_mp_tc_div_2d.c
+++ b/bn_mp_tc_div_2d.c
@@ -16,18 +16,18 @@
/* two complement right shift */
int mp_tc_div_2d(const mp_int *a, int b, mp_int *c)
{
- int res;
- if (mp_isneg(a) == MP_NO) {
- return mp_div_2d(a, b, c, NULL);
- }
+ int res;
+ if (mp_isneg(a) == MP_NO) {
+ return mp_div_2d(a, b, c, NULL);
+ }
- res = mp_add_d(a, 1uL, c);
- if (res != MP_OKAY) {
- return res;
- }
+ res = mp_add_d(a, 1uL, c);
+ if (res != MP_OKAY) {
+ return res;
+ }
- res = mp_div_2d(c, b, c, NULL);
- return (res == MP_OKAY) ? mp_sub_d(c, 1uL, c) : res;
+ res = mp_div_2d(c, b, c, NULL);
+ return (res == MP_OKAY) ? mp_sub_d(c, 1uL, c) : res;
}
#endif
diff --git a/tommath.h b/tommath.h
index c048777..9cec473 100644
--- a/tommath.h
+++ b/tommath.h
@@ -38,10 +38,10 @@ extern "C" {
defined(__LP64__) || defined(_LP64) || defined(__64BIT__)
# if !(defined(MP_32BIT) || defined(MP_16BIT) || defined(MP_8BIT))
# if defined(__GNUC__)
- /* we support 128bit integers only via: __attribute__((mode(TI))) */
+/* we support 128bit integers only via: __attribute__((mode(TI))) */
# define MP_64BIT
# else
- /* otherwise we fall back to MP_32BIT even on 64bit platforms */
+/* otherwise we fall back to MP_32BIT even on 64bit platforms */
# define MP_32BIT
# endif
# endif