aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2013-05-16 20:04:24 +0200
committerIngela Anderton Andin <[email protected]>2013-05-22 10:51:18 +0200
commit16d06da9fb425fe652f3826275f3f9bf87c881f0 (patch)
treed800970cb14e172725d52b50504652864ceef008
parent355e919653c8178b9144db9e0fa01c329e077de4 (diff)
downloadotp-16d06da9fb425fe652f3826275f3f9bf87c881f0.tar.gz
otp-16d06da9fb425fe652f3826275f3f9bf87c881f0.tar.bz2
otp-16d06da9fb425fe652f3826275f3f9bf87c881f0.zip
crypto,ssh, netconf, inets: binary_to_integer -> bytes_to_integer
-rw-r--r--lib/common_test/test/ct_netconfc_SUITE_data/netconfc1_SUITE.erl4
-rw-r--r--lib/crypto/doc/src/crypto.xml6
-rw-r--r--lib/crypto/src/crypto.erl4
-rw-r--r--lib/inets/test/erl_make_certs.erl8
-rw-r--r--lib/ssh/src/ssh_math.erl2
-rw-r--r--lib/ssh/src/ssh_transport.erl2
6 files changed, 11 insertions, 15 deletions
diff --git a/lib/common_test/test/ct_netconfc_SUITE_data/netconfc1_SUITE.erl b/lib/common_test/test/ct_netconfc_SUITE_data/netconfc1_SUITE.erl
index a3309b844d..0535eb924b 100644
--- a/lib/common_test/test/ct_netconfc_SUITE_data/netconfc1_SUITE.erl
+++ b/lib/common_test/test/ct_netconfc_SUITE_data/netconfc1_SUITE.erl
@@ -1072,7 +1072,7 @@ gen_dsa2(LSize, NSize) ->
Y = crypto:mod_pow(G, X, P), %% Calculate y = g^x mod p.
#'DSAPrivateKey'{version=0, p = P, q = Q,
- g = crypto:binary_to_integer(G), y = crypto:binary_to_integer(Y), x = X}
+ g = crypto:bytes_to_integer(G), y = crypto:bytes_to_integer(Y), x = X}
end.
%% See fips_186-3.pdf
@@ -1104,7 +1104,7 @@ is_prime(_, 0) -> true;
is_prime(Candidate, Test) ->
CoPrime = odd_rand(10000, Candidate),
Result = crypto:mod_pow(CoPrime, Candidate, Candidate) ,
- is_prime(CoPrime, crypto:binary_to_integer(Result), Candidate, Test).
+ is_prime(CoPrime, crypto:bytes_to_integer(Result), Candidate, Test).
is_prime(CoPrime, CoPrime, Candidate, Test) ->
is_prime(Candidate, Test-1);
diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml
index 227602072e..03a46c6e03 100644
--- a/lib/crypto/doc/src/crypto.xml
+++ b/lib/crypto/doc/src/crypto.xml
@@ -180,7 +180,7 @@
</func>
<func>
- <name>binary_to_integer(Bin) -> Integer </name>
+ <name>bytes_to_integer(Bin) -> Integer </name>
<fsummary>Convert binary representation, of an integer, to an Erlang integer.</fsummary>
<type>
<v>Bin = binary() - as returned by crypto functions</v>
@@ -568,7 +568,7 @@
</type>
<desc>
<p>Creates a digital signature.</p>
- <p>Algoritm <c>dss</c> can only be used together with digest type
+ <p>Algorithm <c>dss</c> can only be used together with digest type
<c>sha</c>.</p>
See also <seealso marker="public_key:public_key#sign/3">public_key:sign/3</seealso>
</desc>
@@ -697,7 +697,7 @@
</type>
<desc>
<p>Verifies a digital signature</p>
- <p>Algoritm <c>dss</c> can only be used together with digest type
+ <p>Algorithm <c>dss</c> can only be used together with digest type
<c>sha</c>.</p>
See also <seealso marker="public_key:public_key#sign/3">public_key:verify/3</seealso>
diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl
index ecb9f6a93e..c84d17346b 100644
--- a/lib/crypto/src/crypto.erl
+++ b/lib/crypto/src/crypto.erl
@@ -21,7 +21,7 @@
-module(crypto).
--export([start/0, stop/0, info_lib/0, supports/0, version/0, binary_to_integer/1]).
+-export([start/0, stop/0, info_lib/0, supports/0, version/0, bytes_to_integer/1]).
-export([hash/2, hash_init/1, hash_update/2, hash_final/1]).
-export([sign/4, verify/5]).
-export([generate_key/2, generate_key/3, compute_key/4]).
@@ -1618,7 +1618,7 @@ int_to_bin_neg(-1, Ds=[MSB|_]) when MSB >= 16#80 ->
int_to_bin_neg(X,Ds) ->
int_to_bin_neg(X bsr 8, [(X band 255)|Ds]).
-binary_to_integer(Bin) ->
+bytes_to_integer(Bin) ->
bin_to_int(Bin).
bin_to_int(Bin) when is_binary(Bin) ->
diff --git a/lib/inets/test/erl_make_certs.erl b/lib/inets/test/erl_make_certs.erl
index be1253bfb8..4ca2907a73 100644
--- a/lib/inets/test/erl_make_certs.erl
+++ b/lib/inets/test/erl_make_certs.erl
@@ -398,17 +398,13 @@ gen_dsa2(LSize, NSize) ->
Y = crypto:mod_pow(G, X, P), %% Calculate y = g^x mod p.
#'DSAPrivateKey'{version=0, p = P, q = Q,
- g = crypto:binary_to_integer(G), y = crypto:binary_to_integer(Y), x = X}
+ g = crypto:bytes_to_integer(G), y = crypto:bytes_to_integer(Y), x = X}
end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% EC key generation (OBS: for testing only)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-int2list(I) ->
- L = (length(integer_to_list(I, 16)) + 1) div 2,
- binary_to_list(<<I:(L*8)>>).
-
gen_ec2(CurveId) ->
{PrivKey, PubKey} = crypto:generate_key(ecdh, CurveId),
@@ -446,7 +442,7 @@ is_prime(_, 0) -> true;
is_prime(Candidate, Test) ->
CoPrime = odd_rand(10000, Candidate),
Result = crypto:mod_pow(CoPrime, Candidate, Candidate) ,
- is_prime(CoPrime, crypto:binary_to_integer(Result), Candidate, Test).
+ is_prime(CoPrime, crypto:bytes_to_integer(Result), Candidate, Test).
is_prime(CoPrime, CoPrime, Candidate, Test) ->
is_prime(Candidate, Test-1);
diff --git a/lib/ssh/src/ssh_math.erl b/lib/ssh/src/ssh_math.erl
index e05964daa1..569c1cb58d 100644
--- a/lib/ssh/src/ssh_math.erl
+++ b/lib/ssh/src/ssh_math.erl
@@ -33,7 +33,7 @@
%% calculate A^B mod M
ipow(A, B, M) when M > 0, B >= 0 ->
- crypto:binary_to_integer(crypto:mod_pow(A, B, M)).
+ crypto:bytes_to_integer(crypto:mod_pow(A, B, M)).
diff --git a/lib/ssh/src/ssh_transport.erl b/lib/ssh/src/ssh_transport.erl
index e3d1d3c8a0..beaffdc025 100644
--- a/lib/ssh/src/ssh_transport.erl
+++ b/lib/ssh/src/ssh_transport.erl
@@ -1047,7 +1047,7 @@ dh_group1() ->
dh_gen_key(G, P, _) ->
{Public, Private} = crypto:generate_key(dh, [P, G]),
- {crypto:binary_to_integer(Private), crypto:binary_to_integer(Public)}.
+ {crypto:bytes_to_integer(Private), crypto:bytes_to_integer(Public)}.
trim_tail(Str) ->
lists:reverse(trim_head(lists:reverse(Str))).