From 253be06f0056244926192a5bb2d9e6f60d3e4a1d Mon Sep 17 00:00:00 2001 From: djm Date: Fri, 14 Sep 2018 04:17:44 +0000 Subject: [PATCH] garbage-collect moribund ssh_new_private() API. --- usr.bin/ssh/ssh-keygen.c | 6 +++--- usr.bin/ssh/sshkey.c | 23 ++++++----------------- usr.bin/ssh/sshkey.h | 3 +-- 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/usr.bin/ssh/ssh-keygen.c b/usr.bin/ssh/ssh-keygen.c index aee716ad798..81d12cc7489 100644 --- a/usr.bin/ssh/ssh-keygen.c +++ b/usr.bin/ssh/ssh-keygen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-keygen.c,v 1.321 2018/09/13 02:08:33 djm Exp $ */ +/* $OpenBSD: ssh-keygen.c,v 1.322 2018/09/14 04:17:44 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1994 Tatu Ylonen , Espoo, Finland @@ -480,8 +480,8 @@ do_convert_private_ssh2_from_blob(u_char *blob, u_int blen) free(type); return NULL; } - if ((key = sshkey_new_private(ktype)) == NULL) - fatal("sshkey_new_private failed"); + if ((key = sshkey_new(ktype)) == NULL) + fatal("sshkey_new failed"); free(type); switch (key->type) { diff --git a/usr.bin/ssh/sshkey.c b/usr.bin/ssh/sshkey.c index 0814c11a277..f7c09fbe100 100644 --- a/usr.bin/ssh/sshkey.c +++ b/usr.bin/ssh/sshkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshkey.c,v 1.69 2018/09/13 02:08:33 djm Exp $ */ +/* $OpenBSD: sshkey.c,v 1.70 2018/09/14 04:17:44 djm Exp $ */ /* * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. * Copyright (c) 2008 Alexander von Gernler. All rights reserved. @@ -527,17 +527,6 @@ sshkey_new(int type) return k; } -/* XXX garbage-collect this API */ -struct sshkey * -sshkey_new_private(int type) -{ - struct sshkey *k = sshkey_new(type); - - if (k == NULL) - return NULL; - return k; -} - void sshkey_free(struct sshkey *k) { @@ -2890,7 +2879,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp) switch (type) { #ifdef WITH_OPENSSL case KEY_DSA: - if ((k = sshkey_new_private(type)) == NULL) { + if ((k = sshkey_new(type)) == NULL) { r = SSH_ERR_ALLOC_FAIL; goto out; } @@ -2934,7 +2923,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp) dsa_priv_key = NULL; /* transferred */ break; case KEY_ECDSA: - if ((k = sshkey_new_private(type)) == NULL) { + if ((k = sshkey_new(type)) == NULL) { r = SSH_ERR_ALLOC_FAIL; goto out; } @@ -2983,7 +2972,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp) goto out; break; case KEY_RSA: - if ((k = sshkey_new_private(type)) == NULL) { + if ((k = sshkey_new(type)) == NULL) { r = SSH_ERR_ALLOC_FAIL; goto out; } @@ -3049,7 +3038,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp) break; #endif /* WITH_OPENSSL */ case KEY_ED25519: - if ((k = sshkey_new_private(type)) == NULL) { + if ((k = sshkey_new(type)) == NULL) { r = SSH_ERR_ALLOC_FAIL; goto out; } @@ -3079,7 +3068,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp) break; #ifdef WITH_XMSS case KEY_XMSS: - if ((k = sshkey_new_private(type)) == NULL) { + if ((k = sshkey_new(type)) == NULL) { r = SSH_ERR_ALLOC_FAIL; goto out; } diff --git a/usr.bin/ssh/sshkey.h b/usr.bin/ssh/sshkey.h index 8014716dd23..e5c13bdc513 100644 --- a/usr.bin/ssh/sshkey.h +++ b/usr.bin/ssh/sshkey.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sshkey.h,v 1.29 2018/09/13 02:08:33 djm Exp $ */ +/* $OpenBSD: sshkey.h,v 1.30 2018/09/14 04:17:44 djm Exp $ */ /* * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. @@ -122,7 +122,6 @@ struct sshkey { #define ED25519_PK_SZ crypto_sign_ed25519_PUBLICKEYBYTES struct sshkey *sshkey_new(int); -struct sshkey *sshkey_new_private(int); /* XXX garbage collect */ void sshkey_free(struct sshkey *); int sshkey_equal_public(const struct sshkey *, const struct sshkey *); -- 2.20.1