1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 03:22:48 -05:00

Added a command-line key generation tool. Currently builds and runs

on Linux, but the (very few) platform-specific bits are already
abstracted out of the main code, so it should port to other
platforms with a minimum of fuss.

[originally from svn r3762]
This commit is contained in:
Simon Tatham
2004-01-22 19:15:32 +00:00
parent 7b140b2fe7
commit 2d1287b9ca
10 changed files with 1040 additions and 12 deletions

View File

@ -1,4 +1,4 @@
Makefile.gtk Makefile
local
plink pterm putty puttytel psftp pscp
plink pterm putty puttytel psftp pscp puttygen
*.log

View File

@ -313,3 +313,8 @@ void frontend_keypress(void *handle)
*/
return;
}
int is_interactive(void)
{
return isatty(0);
}

36
unix/uxgen.c Normal file
View File

@ -0,0 +1,36 @@
/*
* uxgen.c: Unix implementation of get_heavy_noise() from cmdgen.c.
*/
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include "putty.h"
char *get_random_data(int len)
{
char *buf = snewn(len, char);
int fd;
int ngot, ret;
fd = open("/dev/random", O_RDONLY);
if (fd < 0) {
sfree(buf);
perror("puttygen: unable to open /dev/random");
return NULL;
}
ngot = 0;
while (ngot < len) {
ret = read(fd, buf+ngot, len-ngot);
if (ret < 0) {
close(fd);
perror("puttygen: unable to read /dev/random");
return NULL;
}
ngot += ret;
}
return buf;
}