aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public_key/test
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2017-03-13 12:20:40 +0100
committerHans Nilsson <[email protected]>2017-03-13 12:20:40 +0100
commit47e46069d01960b74cefeba648e98e6afbb79e59 (patch)
tree30edfafd54887a3ebb5eb814c298d91bcc89c7f7 /lib/public_key/test
parentee1ad99648316f4dc15d872804dfa52990e0240f (diff)
parent72e126aa74b9632068d11f14f423b044a345f03f (diff)
downloadotp-47e46069d01960b74cefeba648e98e6afbb79e59.tar.gz
otp-47e46069d01960b74cefeba648e98e6afbb79e59.tar.bz2
otp-47e46069d01960b74cefeba648e98e6afbb79e59.zip
Merge branch 'wiml/crypto/rsa-generate-key/ERL-165/PR-1299/OTP-14140'
Diffstat (limited to 'lib/public_key/test')
-rw-r--r--lib/public_key/test/erl_make_certs.erl16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/public_key/test/erl_make_certs.erl b/lib/public_key/test/erl_make_certs.erl
index 3dab70784c..00be7dd5b3 100644
--- a/lib/public_key/test/erl_make_certs.erl
+++ b/lib/public_key/test/erl_make_certs.erl
@@ -346,10 +346,24 @@ make_key(ec, _Opts) ->
%% RSA key generation (OBS: for testing only)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+gen_rsa2(Size) ->
+ try
+ %% The numbers 2048,17 is choosen to not cause the cryptolib on
+ %% FIPS-enabled test machines be mad at us.
+ public_key:generate_key({rsa, 2048, 17})
+ of
+ {_Public, Private} -> Private
+ catch
+ error:notsup ->
+ %% Disabled dirty_schedulers => crypto:generate_key not working
+ weak_gen_rsa2(Size)
+ end.
+
+
-define(SMALL_PRIMES, [65537,97,89,83,79,73,71,67,61,59,53,
47,43,41,37,31,29,23,19,17,13,11,7,5,3]).
-gen_rsa2(Size) ->
+weak_gen_rsa2(Size) ->
P = prime(Size),
Q = prime(Size),
N = P*Q,