use same parameter name as in the prototype
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
diff --git a/bn_mp_from_sbin.c b/bn_mp_from_sbin.c
index 780639a..20e4597 100644
--- a/bn_mp_from_sbin.c
+++ b/bn_mp_from_sbin.c
@@ -4,17 +4,17 @@
/* SPDX-License-Identifier: Unlicense */
/* read signed bin, big endian, first byte is 0==positive or 1==negative */
-mp_err mp_from_sbin(mp_int *a, const unsigned char *b, size_t c)
+mp_err mp_from_sbin(mp_int *a, const unsigned char *buf, size_t size)
{
mp_err err;
/* read magnitude */
- if ((err = mp_from_ubin(a, b + 1, c - 1u)) != MP_OKAY) {
+ if ((err = mp_from_ubin(a, buf + 1, size - 1u)) != MP_OKAY) {
return err;
}
/* first byte is 0 for positive, non-zero for negative */
- if (b[0] == (unsigned char)0) {
+ if (buf[0] == (unsigned char)0) {
a->sign = MP_ZPOS;
} else {
a->sign = MP_NEG;
diff --git a/bn_mp_from_ubin.c b/bn_mp_from_ubin.c
index 78a4cf1..7f73cbc 100644
--- a/bn_mp_from_ubin.c
+++ b/bn_mp_from_ubin.c
@@ -4,7 +4,7 @@
/* SPDX-License-Identifier: Unlicense */
/* reads a unsigned char array, assumes the msb is stored first [big endian] */
-mp_err mp_from_ubin(mp_int *a, const unsigned char *b, size_t size)
+mp_err mp_from_ubin(mp_int *a, const unsigned char *buf, size_t size)
{
mp_err err;
@@ -25,11 +25,11 @@ mp_err mp_from_ubin(mp_int *a, const unsigned char *b, size_t size)
}
#ifndef MP_8BIT
- a->dp[0] |= *b++;
+ a->dp[0] |= *buf++;
a->used += 1;
#else
- a->dp[0] = (*b & MP_MASK);
- a->dp[1] |= ((*b++ >> 7) & 1u);
+ a->dp[0] = (*buf & MP_MASK);
+ a->dp[1] |= ((*buf++ >> 7) & 1u);
a->used += 2;
#endif
}
diff --git a/bn_mp_to_sbin.c b/bn_mp_to_sbin.c
index b736f98..e28dcce 100644
--- a/bn_mp_to_sbin.c
+++ b/bn_mp_to_sbin.c
@@ -4,20 +4,20 @@
/* SPDX-License-Identifier: Unlicense */
/* store in signed [big endian] format */
-mp_err mp_to_sbin(const mp_int *a, unsigned char *b, size_t maxlen, size_t *written)
+mp_err mp_to_sbin(const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written)
{
mp_err err;
if (maxlen == 0u) {
return MP_VAL;
}
- if ((err = mp_to_ubin(a, b + 1, maxlen - 1u, written)) != MP_OKAY) {
+ if ((err = mp_to_ubin(a, buf + 1, maxlen - 1u, written)) != MP_OKAY) {
return err;
}
if (written != NULL) {
(*written)++;
}
- b[0] = (a->sign == MP_ZPOS) ? (unsigned char)0 : (unsigned char)1;
+ buf[0] = (a->sign == MP_ZPOS) ? (unsigned char)0 : (unsigned char)1;
return MP_OKAY;
}
#endif
diff --git a/bn_mp_to_ubin.c b/bn_mp_to_ubin.c
index 80c14ab..a6ded96 100644
--- a/bn_mp_to_ubin.c
+++ b/bn_mp_to_ubin.c
@@ -4,13 +4,13 @@
/* SPDX-License-Identifier: Unlicense */
/* store in unsigned [big endian] format */
-mp_err mp_to_ubin(const mp_int *a, unsigned char *b, size_t maxlen, size_t *written)
+mp_err mp_to_ubin(const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written)
{
size_t x;
mp_err err;
mp_int t;
- if (b == NULL) {
+ if (buf == NULL) {
return MP_MEM;
}
@@ -30,15 +30,15 @@ mp_err mp_to_ubin(const mp_int *a, unsigned char *b, size_t maxlen, size_t *writ
}
maxlen--;
#ifndef MP_8BIT
- b[x++] = (unsigned char)(t.dp[0] & 255u);
+ buf[x++] = (unsigned char)(t.dp[0] & 255u);
#else
- b[x++] = (unsigned char)(t.dp[0] | ((t.dp[1] & 1u) << 7));
+ buf[x++] = (unsigned char)(t.dp[0] | ((t.dp[1] & 1u) << 7));
#endif
if ((err = mp_div_2d(&t, 8, &t, NULL)) != MP_OKAY) {
goto LBL_ERR;
}
}
- s_mp_reverse(b, x);
+ s_mp_reverse(buf, x);
err = MP_OKAY;
if (written != NULL) {