Fix assertion failure in Unix PuTTYgen exports.

The assertions I added to sshrand.c in r9930 are now justified,
because they were failing when cmdgen was used to convert a key into
either foreign private key file format - both the export functions
require random_byte() for one reason or another, and random_ref()
hadn't been called first.

[originally from svn r10117]
[r9930 == 33f485c1c3]
This commit is contained in:
Simon Tatham 2014-01-16 19:16:19 +00:00
Родитель bd119b1fba
Коммит 041bc37dbc
1 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@ -1034,6 +1034,8 @@ int main(int argc, char **argv)
case SSHCOM: case SSHCOM:
assert(sshver == 2); assert(sshver == 2);
assert(ssh2key); assert(ssh2key);
random_ref(); /* both foreign key types require randomness,
* for IV or padding */
ret = export_ssh2(outfilename, outtype, ssh2key, passphrase); ret = export_ssh2(outfilename, outtype, ssh2key, passphrase);
if (!ret) { if (!ret) {
fprintf(stderr, "puttygen: unable to export key\n"); fprintf(stderr, "puttygen: unable to export key\n");