aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Hogan <[email protected]>2019-01-07 19:19:47 -0800
committerDoug Hogan <[email protected]>2019-01-08 01:11:59 -0800
commit2451a8156b3e612ecdd95aa25c1d0c3d894a682b (patch)
tree62174d15ef9997310d13d3147a5a1158942ea386
parent5d74968a66fa50d5f813ece1e52b7f4fa1c29765 (diff)
downloadotp-2451a8156b3e612ecdd95aa25c1d0c3d894a682b.tar.gz
otp-2451a8156b3e612ecdd95aa25c1d0c3d894a682b.tar.bz2
otp-2451a8156b3e612ecdd95aa25c1d0c3d894a682b.zip
Convert put_int32 to put_uint32
-rw-r--r--lib/crypto/c_src/bn.c2
-rw-r--r--lib/crypto/c_src/dh.c4
-rw-r--r--lib/crypto/c_src/openssl_config.h10
-rw-r--r--lib/crypto/c_src/rand.c2
4 files changed, 9 insertions, 9 deletions
diff --git a/lib/crypto/c_src/bn.c b/lib/crypto/c_src/bn.c
index ef69c84679..d884a75f80 100644
--- a/lib/crypto/c_src/bn.c
+++ b/lib/crypto/c_src/bn.c
@@ -133,7 +133,7 @@ ERL_NIF_TERM mod_exp_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
goto err;
if (bin_hdr) {
- put_int32(ptr, extra_byte + (unsigned int)dlen);
+ put_uint32(ptr, extra_byte + (unsigned int)dlen);
ptr[4] = 0; /* extra zeroed byte to ensure a positive mpint */
ptr += bin_hdr + extra_byte;
}
diff --git a/lib/crypto/c_src/dh.c b/lib/crypto/c_src/dh.c
index e3b5b11e9c..bb87080d7b 100644
--- a/lib/crypto/c_src/dh.c
+++ b/lib/crypto/c_src/dh.c
@@ -140,10 +140,10 @@ ERL_NIF_TERM dh_generate_key_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM ar
goto err;
if (mpint) {
- put_int32(pub_ptr, pub_len);
+ put_uint32(pub_ptr, (unsigned int)pub_len);
pub_ptr += 4;
- put_int32(prv_ptr, prv_len);
+ put_uint32(prv_ptr, (unsigned int)prv_len);
prv_ptr += 4;
}
diff --git a/lib/crypto/c_src/openssl_config.h b/lib/crypto/c_src/openssl_config.h
index 7ea8c320ae..65290cdfdf 100644
--- a/lib/crypto/c_src/openssl_config.h
+++ b/lib/crypto/c_src/openssl_config.h
@@ -296,11 +296,11 @@
(((unsigned char*) (s))[2] << 8) | \
(((unsigned char*) (s))[3]))
-#define put_int32(s,i) \
-{ (s)[0] = (char)(((i) >> 24) & 0xff);\
- (s)[1] = (char)(((i) >> 16) & 0xff);\
- (s)[2] = (char)(((i) >> 8) & 0xff);\
- (s)[3] = (char)((i) & 0xff);\
+#define put_uint32(s,i) \
+{ (s)[0] = (unsigned char)(((i) >> 24) & 0xff);\
+ (s)[1] = (unsigned char)(((i) >> 16) & 0xff);\
+ (s)[2] = (unsigned char)(((i) >> 8) & 0xff);\
+ (s)[3] = (unsigned char)((i) & 0xff);\
}
/* This shall correspond to the similar macro in crypto.erl */
diff --git a/lib/crypto/c_src/rand.c b/lib/crypto/c_src/rand.c
index 12e0a53493..cf793a7aac 100644
--- a/lib/crypto/c_src/rand.c
+++ b/lib/crypto/c_src/rand.c
@@ -111,7 +111,7 @@ ERL_NIF_TERM rand_uniform_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[
if ((data = enif_make_new_binary(env, (size_t)dlen+4, &ret)) == NULL)
goto err;
- put_int32(data, dlen);
+ put_uint32(data, (unsigned int)dlen);
BN_bn2bin(bn_rand, data+4);
ERL_VALGRIND_MAKE_MEM_DEFINED(data+4, dlen);
goto done;