void showversion(void)
{
char *verstr = dupstr(ver);
- verstr[0] = tolower(verstr[0]);
+ verstr[0] = tolower((unsigned char)verstr[0]);
printf("PuTTYgen %s\n", verstr);
sfree(verstr);
}
return TRUE;
}
-static char *blobfp(char *alg, int bits, char *blob, int bloblen)
+static char *blobfp(char *alg, int bits, unsigned char *blob, int bloblen)
{
char buffer[128];
unsigned char digest[16];
int sshver = 0;
struct ssh2_userkey *ssh2key = NULL;
struct RSAKey *ssh1key = NULL;
- char *ssh2blob = NULL, *ssh2alg = NULL;
+ unsigned char *ssh2blob = NULL;
+ char *ssh2alg = NULL;
const struct ssh_signkey *ssh2algf = NULL;
int ssh2bloblen;
char *passphrase = NULL;
random_ref();
entropy = get_random_data(bits / 8);
+ if (!entropy) {
+ fprintf(stderr, "puttygen: failed to collect entropy, "
+ "could not generate key\n");
+ return 1;
+ }
random_add_heavynoise(entropy, bits / 8);
memset(entropy, 0, bits/8);
sfree(entropy);
ssh1key = snew(struct RSAKey);
if (!load_encrypted) {
void *vblob;
- char *blob;
+ unsigned char *blob;
int n, l, bloblen;
ret = rsakey_pubblob(&infilename, &vblob, &bloblen,
&origcomment, &error);
- blob = (char *)vblob;
+ blob = (unsigned char *)vblob;
n = 4; /* skip modulus bits */
assert(ssh1key);
if (outfile)
- fp = f_open(outfilename, "w");
+ fp = f_open(outfilename, "w", FALSE);
else
fp = stdout;
dec1 = bignum_decimal(ssh1key->exponent);
*p++ = '\0';
if (outfile)
- fp = f_open(outfilename, "w");
+ fp = f_open(outfilename, "w", FALSE);
else
fp = stdout;
fprintf(fp, "%s\n", buffer);
}
if (outfile)
- fp = f_open(outfilename, "w");
+ fp = f_open(outfilename, "w", FALSE);
else
fp = stdout;
fprintf(fp, "%s\n", fingerprint);