aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public_key/test/erl_make_certs.erl
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2017-03-08 15:32:45 +0100
committerHans Nilsson <[email protected]>2017-03-09 16:15:42 +0100
commitbdda89d1fc42853d3c438f4055740c75153f7db7 (patch)
treeb28200fb23ea531b531917dbc03ab72a9725bf6a /lib/public_key/test/erl_make_certs.erl
parentbde627c1b34a19f36b7de777608119ff4a554cfa (diff)
downloadotp-bdda89d1fc42853d3c438f4055740c75153f7db7.tar.gz
otp-bdda89d1fc42853d3c438f4055740c75153f7db7.tar.bz2
otp-bdda89d1fc42853d3c438f4055740c75153f7db7.zip
public_key: Make test suites use the new RSA key generation function
Diffstat (limited to 'lib/public_key/test/erl_make_certs.erl')
-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,