View | Details | Raw Unified | Return to bug 2472 | Differences between
and this patch

Collapse All | Expand All

(-)a/sshkey.c (+39 lines)
Lines 306-311 sshkey_is_cert(const struct sshkey *k) Link Here
306
	return sshkey_type_is_cert(k->type);
306
	return sshkey_type_is_cert(k->type);
307
}
307
}
308
308
309
int
310
sshkey_is_private(const struct sshkey *k)
311
{
312
	switch (k->type) {
313
#ifdef WITH_OPENSSL
314
	case KEY_RSA1:
315
	case KEY_RSA:
316
	case KEY_RSA_CERT:
317
		if (k->rsa && k->rsa->d && k->rsa->q && k->rsa->p &&
318
			k->rsa->iqmp &&
319
			!BN_is_zero(k->rsa->d) &&
320
			!BN_is_zero(k->rsa->q) &&
321
			!BN_is_zero(k->rsa->p) &&
322
			!BN_is_zero(k->rsa->iqmp))
323
				return 1;
324
		break;
325
	case KEY_DSA:
326
	case KEY_DSA_CERT:
327
		if (k->dsa && k->dsa->priv_key)
328
			return 1;
329
		break;
330
	case KEY_ECDSA:
331
	case KEY_ECDSA_CERT:
332
		if (k->ecdsa && EC_KEY_get0_private_key(k->ecdsa))
333
			return 1;
334
		break;
335
#endif /* WITH_OPENSSL */
336
	case KEY_ED25519:
337
	case KEY_ED25519_CERT:
338
		if (k->ed25519_sk)
339
			return 1;
340
		break;
341
	case KEY_UNSPEC:
342
		break;
343
	}
344
345
	return 0;
346
}
347
309
/* Return the cert-less equivalent to a certified key type */
348
/* Return the cert-less equivalent to a certified key type */
310
int
349
int
311
sshkey_type_plain(int type)
350
sshkey_type_plain(int type)
(-)a/sshkey.h (-1 / +1 lines)
Lines 133-138 int sshkey_generate(int type, u_int bits, struct sshkey **keyp); Link Here
133
int		 sshkey_from_private(const struct sshkey *, struct sshkey **);
133
int		 sshkey_from_private(const struct sshkey *, struct sshkey **);
134
int	 sshkey_type_from_name(const char *);
134
int	 sshkey_type_from_name(const char *);
135
int	 sshkey_is_cert(const struct sshkey *);
135
int	 sshkey_is_cert(const struct sshkey *);
136
int	 sshkey_is_private(const struct sshkey *);
136
int	 sshkey_type_is_cert(int);
137
int	 sshkey_type_is_cert(int);
137
int	 sshkey_type_plain(int);
138
int	 sshkey_type_plain(int);
138
int	 sshkey_to_certified(struct sshkey *);
139
int	 sshkey_to_certified(struct sshkey *);
139
- 

Return to bug 2472