summaryrefslogtreecommitdiffstats
path: root/crypto/bn
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/bn')
-rw-r--r--crypto/bn/asm/mips.pl2
-rw-r--r--crypto/bn/bn_conv.c5
-rw-r--r--crypto/bn/bn_lib.c5
-rw-r--r--crypto/bn/bn_mod.c3
-rw-r--r--crypto/bn/bn_nist.c4
5 files changed, 9 insertions, 10 deletions
diff --git a/crypto/bn/asm/mips.pl b/crypto/bn/asm/mips.pl
index 91b7aac6e7..98d2943160 100644
--- a/crypto/bn/asm/mips.pl
+++ b/crypto/bn/asm/mips.pl
@@ -802,7 +802,7 @@ $code.=<<___;
#if 0
/*
- * The bn_div_3_words entry point is re-used for constant-time interface.
+ * The bn_div_3_words entry point is reused for constant-time interface.
* Implementation is retained as historical reference.
*/
.align 5
diff --git a/crypto/bn/bn_conv.c b/crypto/bn/bn_conv.c
index 849440e71e..f8c2cd95ad 100644
--- a/crypto/bn/bn_conv.c
+++ b/crypto/bn/bn_conv.c
@@ -11,8 +11,6 @@
#include "crypto/ctype.h"
#include "bn_local.h"
-static const char Hex[] = "0123456789ABCDEF";
-
/* Must 'OPENSSL_free' the returned data */
char *BN_bn2hex(const BIGNUM *a)
{
@@ -33,8 +31,7 @@ char *BN_bn2hex(const BIGNUM *a)
/* strip leading zeros */
v = (int)((a->d[i] >> j) & 0xff);
if (z || v != 0) {
- *p++ = Hex[v >> 4];
- *p++ = Hex[v & 0x0f];
+ p += ossl_to_hex(p, v);
z = 1;
}
}
diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c
index cab87d9959..c46424c8ea 100644
--- a/crypto/bn/bn_lib.c
+++ b/crypto/bn/bn_lib.c
@@ -82,8 +82,9 @@ int BN_get_params(int which)
const BIGNUM *BN_value_one(void)
{
static const BN_ULONG data_one = 1L;
- static const BIGNUM const_one =
- { (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA };
+ static const BIGNUM const_one = {
+ (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA
+ };
return &const_one;
}
diff --git a/crypto/bn/bn_mod.c b/crypto/bn/bn_mod.c
index d7c2f4bd5b..4cb64b453b 100644
--- a/crypto/bn/bn_mod.c
+++ b/crypto/bn/bn_mod.c
@@ -8,6 +8,7 @@
*/
#include "internal/cryptlib.h"
+#include "internal/nelem.h"
#include "bn_local.h"
int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
@@ -61,7 +62,7 @@ int bn_mod_add_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
if (bn_wexpand(r, mtop) == NULL)
return 0;
- if (mtop > sizeof(storage) / sizeof(storage[0])) {
+ if (mtop > OSSL_NELEM(storage)) {
tp = OPENSSL_malloc(mtop * sizeof(BN_ULONG));
if (tp == NULL)
return 0;
diff --git a/crypto/bn/bn_nist.c b/crypto/bn/bn_nist.c
index bc864346fb..0d254736e0 100644
--- a/crypto/bn/bn_nist.c
+++ b/crypto/bn/bn_nist.c
@@ -84,8 +84,8 @@ static const BN_ULONG _nist_p_384_sqr[] = {
0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL
};
-static const BN_ULONG _nist_p_521[] =
- { 0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL,
+static const BN_ULONG _nist_p_521[] = {
+ 0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL,
0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL,
0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL,
0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL,