From 4e44a1414bcdae81305f98d7789fdad00a0bc94d Mon Sep 17 00:00:00 2001 From: Ingela Anderton Andin Date: Mon, 20 Mar 2017 15:41:06 +0100 Subject: crypto: Deprecate crypto:rand_uniform/2 as it is not cryptographically strong rand module should be used if not cryptographically strong is required. If cryptographically strong is required, new cryptographically strong functions should be added to crypto. --- lib/crypto/src/crypto.erl | 2 ++ lib/stdlib/src/otp_internal.erl | 5 +++++ 2 files changed, 7 insertions(+) (limited to 'lib') diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl index 631af62615..ce8add6559 100644 --- a/lib/crypto/src/crypto.erl +++ b/lib/crypto/src/crypto.erl @@ -40,6 +40,8 @@ -export([ec_curve/1, ec_curves/0]). -export([rand_seed/1]). +-deprecated({rand_uniform, 2, next_major_release}). + %% This should correspond to the similar macro in crypto.c -define(MAX_BYTES_TO_NIF, 20000). %% Current value is: erlang:system_info(context_reductions) * 10 diff --git a/lib/stdlib/src/otp_internal.erl b/lib/stdlib/src/otp_internal.erl index fda7a2cd8a..e141da52d9 100644 --- a/lib/stdlib/src/otp_internal.erl +++ b/lib/stdlib/src/otp_internal.erl @@ -55,6 +55,11 @@ obsolete_1(erlang, now, 0) -> obsolete_1(calendar, local_time_to_universal_time, 1) -> {deprecated, {calendar, local_time_to_universal_time_dst, 1}}; +%% *** CRYPTO added in OTP 20 *** + +obsolete_1(crypto, rand_uniform, 2) -> + {deprecated, {rand, uniform, 1}}; + %% *** CRYPTO added in OTP 19 *** obsolete_1(crypto, rand_bytes, 1) -> -- cgit v1.2.3