projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make mkfiles.pl less tied to PuTTY in particular, by inventing new
[u/mdw/putty]
/
sshrsa.c
diff --git
a/sshrsa.c
b/sshrsa.c
index
5875508
..
f781736
100644
(file)
--- a/
sshrsa.c
+++ b/
sshrsa.c
@@
-629,6
+629,18
@@
static int rsa2_openssh_fmtkey(void *key, unsigned char *blob, int len)
return bloblen;
}
return bloblen;
}
+static int rsa2_pubkey_bits(void *blob, int len)
+{
+ struct RSAKey *rsa;
+ int ret;
+
+ rsa = rsa2_newkey((char *) blob, len);
+ ret = bignum_bitcount(rsa->modulus);
+ rsa2_freekey(rsa);
+
+ return ret;
+}
+
static char *rsa2_fingerprint(void *key)
{
struct RSAKey *rsa = (struct RSAKey *) key;
static char *rsa2_fingerprint(void *key)
{
struct RSAKey *rsa = (struct RSAKey *) key;
@@
-715,7
+727,7
@@
static int rsa2_verifysig(void *key, char *sig, int siglen,
ret = 1;
ret = 1;
- bytes =
bignum_bitcount(rsa->modulus
) / 8;
+ bytes =
(bignum_bitcount(rsa->modulus)+7
) / 8;
/* Top (partial) byte should be zero. */
if (bignum_byte(out, bytes - 1) != 0)
ret = 0;
/* Top (partial) byte should be zero. */
if (bignum_byte(out, bytes - 1) != 0)
ret = 0;
@@
-738,6
+750,7
@@
static int rsa2_verifysig(void *key, char *sig, int siglen,
if (bignum_byte(out, i) != hash[j])
ret = 0;
}
if (bignum_byte(out, i) != hash[j])
ret = 0;
}
+ freebn(out);
return ret;
}
return ret;
}
@@
-793,6
+806,7
@@
const struct ssh_signkey ssh_rsa = {
rsa2_createkey,
rsa2_openssh_createkey,
rsa2_openssh_fmtkey,
rsa2_createkey,
rsa2_openssh_createkey,
rsa2_openssh_fmtkey,
+ rsa2_pubkey_bits,
rsa2_fingerprint,
rsa2_verifysig,
rsa2_sign,
rsa2_fingerprint,
rsa2_verifysig,
rsa2_sign,