diff options
author | Werner Koch <[email protected]> | 2017-07-17 13:52:26 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2017-07-17 13:53:16 +0000 |
commit | a149afe338d61d86985c533cde5e7dbcd31e8698 (patch) | |
tree | c930065acfb8403fe8391dc0d93b866f599bc52e /sm/encrypt.c | |
parent | agent: New GETINFO sub-command jent_active. (diff) | |
download | gnupg-a149afe338d61d86985c533cde5e7dbcd31e8698.tar.gz gnupg-a149afe338d61d86985c533cde5e7dbcd31e8698.zip |
gpg,sm: Check compliance of the RNG.
* common/compliance.c (gnupg_rng_is_compliant): New.
* g10/call-agent.c (start_agent) [W32]: Check rng compliance.
* sm/call-agent.c (start_agent) [W32]: Ditto.
* g10/encrypt.c (encrypt_simple, encrypt_crypt): Check that the RNG is
compliant.
* sm/encrypt.c (gpgsm_encrypt): Ditto.
* g10/sign.c (do_sign): Ditto.
* sm/sign.c (gpgsm_sign): Ditto.
--
Under Windows we need to check that the Jitter RNG is active in de-vs
mode. Under Linux this is not necessary because /dev/random can be
scrutinized and is believed to provide enough entropy.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'sm/encrypt.c')
-rw-r--r-- | sm/encrypt.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sm/encrypt.c b/sm/encrypt.c index 9e3216a79..73519325e 100644 --- a/sm/encrypt.c +++ b/sm/encrypt.c @@ -420,6 +420,17 @@ gpgsm_encrypt (ctrl_t ctrl, certlist_t recplist, int data_fd, estream_t out_fp) goto leave; } + if (!gnupg_rng_is_compliant (opt.compliance)) + { + rc = gpg_error (GPG_ERR_FORBIDDEN); + log_error (_("%s is not compliant with %s mode\n"), + "RNG", + gnupg_compliance_option_string (opt.compliance)); + gpgsm_status_with_error (ctrl, STATUS_ERROR, + "random-compliance", rc); + goto leave; + } + /* Create a session key */ dek = xtrycalloc_secure (1, sizeof *dek); if (!dek) |