mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
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 <wk@gnupg.org>
This commit is contained in:
parent
bbbd0db34b
commit
a149afe338
8 changed files with 131 additions and 0 deletions
|
@ -171,6 +171,25 @@ start_agent (ctrl_t ctrl)
|
|||
str_pinentry_mode (opt.pinentry_mode),
|
||||
gpg_strerror (rc));
|
||||
}
|
||||
|
||||
/* In DE_VS mode under Windows we require that the JENT RNG
|
||||
* is active. */
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
if (!rc && opt.compliance == CO_DE_VS)
|
||||
{
|
||||
if (assuan_transact (agent_ctx, "GETINFO jent_active",
|
||||
NULL, NULL, NULL, NULL, NULL, NULL))
|
||||
{
|
||||
rc = gpg_error (GPG_ERR_FORBIDDEN);
|
||||
log_error (_("%s is not compliant with %s mode\n"),
|
||||
GPG_AGENT_NAME,
|
||||
gnupg_compliance_option_string (opt.compliance));
|
||||
gpgsm_status_with_error (ctrl, STATUS_ERROR,
|
||||
"random-compliance", rc);
|
||||
}
|
||||
}
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
11
sm/encrypt.c
11
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)
|
||||
|
|
11
sm/sign.c
11
sm/sign.c
|
@ -339,6 +339,17 @@ gpgsm_sign (ctrl_t ctrl, certlist_t signerlist,
|
|||
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;
|
||||
}
|
||||
|
||||
ctrl->pem_name = "SIGNED MESSAGE";
|
||||
rc = gnupg_ksba_create_writer
|
||||
(&b64writer, ((ctrl->create_pem? GNUPG_KSBA_IO_PEM : 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue