mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
gpg: --gen-random code cleanup by using es_set_binary.
* g10/gpg.c (main): Replace setmode by es_set_binary and use only when needed. -- It is better to use our es_set_binary than to use a Windows specific method which still worked but is fragile because estream might be changed. We now set binary only when needed. Note that it does not harm to call es_set_binary more often than needed.
This commit is contained in:
parent
3ab6538433
commit
f118e3b101
@ -2707,7 +2707,7 @@ merge_selfsigs_main (ctrl_t ctrl, kbnode_t keyblock, int *r_revoked,
|
|||||||
* and there was no way to change it, so we start with the one
|
* and there was no way to change it, so we start with the one
|
||||||
* from the key packet. We do not support v3 keys anymore but
|
* from the key packet. We do not support v3 keys anymore but
|
||||||
* we keep the code in case a future key versions introduces a
|
* we keep the code in case a future key versions introduces a
|
||||||
* hadr expire time again. */
|
* hard expire time again. */
|
||||||
key_expire = pk->max_expiredate;
|
key_expire = pk->max_expiredate;
|
||||||
key_expire_seen = 1;
|
key_expire_seen = 1;
|
||||||
}
|
}
|
||||||
|
@ -5057,9 +5057,6 @@ main (int argc, char **argv)
|
|||||||
size_t nn;
|
size_t nn;
|
||||||
|
|
||||||
p = gcry_random_bytes (n, level);
|
p = gcry_random_bytes (n, level);
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
|
||||||
setmode ( fileno(stdout), O_BINARY );
|
|
||||||
#endif
|
|
||||||
if (hexhack)
|
if (hexhack)
|
||||||
{
|
{
|
||||||
for (nn = 0; nn < n; nn++)
|
for (nn = 0; nn < n; nn++)
|
||||||
@ -5077,6 +5074,7 @@ main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
es_set_binary (es_stdout);
|
||||||
es_fwrite( p, n, 1, es_stdout );
|
es_fwrite( p, n, 1, es_stdout );
|
||||||
}
|
}
|
||||||
xfree(p);
|
xfree(p);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user