static void rsa2_freekey(void *key); /* forward reference */
-static void *rsa2_newkey(const char *data, int len)
+static void *rsa2_newkey(const struct ssh_signkey *self,
+ const char *data, int len)
{
const char *p;
int slen;
return blob;
}
-static void *rsa2_createkey(const unsigned char *pub_blob, int pub_len,
+static void *rsa2_createkey(const struct ssh_signkey *self,
+ const unsigned char *pub_blob, int pub_len,
const unsigned char *priv_blob, int priv_len)
{
struct RSAKey *rsa;
const char *pb = (const char *) priv_blob;
- rsa = rsa2_newkey((char *) pub_blob, pub_len);
+ rsa = rsa2_newkey(self, (char *) pub_blob, pub_len);
rsa->private_exponent = getmp(&pb, &priv_len);
rsa->p = getmp(&pb, &priv_len);
rsa->q = getmp(&pb, &priv_len);
return rsa;
}
-static void *rsa2_openssh_createkey(const unsigned char **blob, int *len)
+static void *rsa2_openssh_createkey(const struct ssh_signkey *self,
+ const unsigned char **blob, int *len)
{
const char **b = (const char **) blob;
struct RSAKey *rsa;
return bloblen;
}
-static int rsa2_pubkey_bits(const void *blob, int len)
+static int rsa2_pubkey_bits(const struct ssh_signkey *self,
+ const void *blob, int len)
{
struct RSAKey *rsa;
int ret;
- rsa = rsa2_newkey((const char *) blob, len);
+ rsa = rsa2_newkey(self, (const char *) blob, len);
+ if (!rsa)
+ return -1;
ret = bignum_bitcount(rsa->modulus);
rsa2_freekey(rsa);
rsa2_verifysig,
rsa2_sign,
"ssh-rsa",
- "rsa2"
+ "rsa2",
+ NULL,
};
void *ssh_rsakex_newkey(char *data, int len)
{
- return rsa2_newkey(data, len);
+ return rsa2_newkey(&ssh_rsa, data, len);
}
void ssh_rsakex_freekey(void *key)
}
static const struct ssh_kex ssh_rsa_kex_sha1 = {
- "rsa1024-sha1", NULL, KEXTYPE_RSA, NULL, NULL, 0, 0, &ssh_sha1
+ "rsa1024-sha1", NULL, KEXTYPE_RSA, &ssh_sha1, NULL,
};
static const struct ssh_kex ssh_rsa_kex_sha256 = {
- "rsa2048-sha256", NULL, KEXTYPE_RSA, NULL, NULL, 0, 0, &ssh_sha256
+ "rsa2048-sha256", NULL, KEXTYPE_RSA, &ssh_sha256, NULL,
};
static const struct ssh_kex *const rsa_kex_list[] = {