diff options
author | djm@openbsd.org <djm@openbsd.org> | 2018-09-14 04:17:44 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2018-09-14 14:19:06 +1000 |
commit | 6da046f9c3374ce7e269ded15d8ff8bc45017301 (patch) | |
tree | ccad16fa508f4881970e7102c897d60f6e235b8f | |
parent | 1f24ac5fc05252ceb1c1d0e8cab6a283b883c780 (diff) |
upstream: garbage-collect moribund ssh_new_private() API.
OpenBSD-Commit-ID: 7c05bf13b094093dfa01848a9306c82eb6e95f6c
-rw-r--r-- | ssh-keygen.c | 6 | ||||
-rw-r--r-- | sshkey.c | 23 | ||||
-rw-r--r-- | sshkey.h | 3 |
3 files changed, 10 insertions, 22 deletions
diff --git a/ssh-keygen.c b/ssh-keygen.c index a70fd1f88..46b3af5a8 100644 --- a/ssh-keygen.c +++ b/ssh-keygen.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-keygen.c,v 1.320 2018/09/12 01:21:34 djm Exp $ */ | 1 | /* $OpenBSD: ssh-keygen.c,v 1.322 2018/09/14 04:17:44 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -491,8 +491,8 @@ do_convert_private_ssh2_from_blob(u_char *blob, u_int blen) | |||
491 | free(type); | 491 | free(type); |
492 | return NULL; | 492 | return NULL; |
493 | } | 493 | } |
494 | if ((key = sshkey_new_private(ktype)) == NULL) | 494 | if ((key = sshkey_new(ktype)) == NULL) |
495 | fatal("sshkey_new_private failed"); | 495 | fatal("sshkey_new failed"); |
496 | free(type); | 496 | free(type); |
497 | 497 | ||
498 | switch (key->type) { | 498 | switch (key->type) { |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshkey.c,v 1.68 2018/09/12 01:32:54 djm Exp $ */ | 1 | /* $OpenBSD: sshkey.c,v 1.70 2018/09/14 04:17:44 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2008 Alexander von Gernler. All rights reserved. | 4 | * Copyright (c) 2008 Alexander von Gernler. All rights reserved. |
@@ -557,17 +557,6 @@ sshkey_new(int type) | |||
557 | return k; | 557 | return k; |
558 | } | 558 | } |
559 | 559 | ||
560 | /* XXX garbage-collect this API */ | ||
561 | struct sshkey * | ||
562 | sshkey_new_private(int type) | ||
563 | { | ||
564 | struct sshkey *k = sshkey_new(type); | ||
565 | |||
566 | if (k == NULL) | ||
567 | return NULL; | ||
568 | return k; | ||
569 | } | ||
570 | |||
571 | void | 560 | void |
572 | sshkey_free(struct sshkey *k) | 561 | sshkey_free(struct sshkey *k) |
573 | { | 562 | { |
@@ -2952,7 +2941,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp) | |||
2952 | switch (type) { | 2941 | switch (type) { |
2953 | #ifdef WITH_OPENSSL | 2942 | #ifdef WITH_OPENSSL |
2954 | case KEY_DSA: | 2943 | case KEY_DSA: |
2955 | if ((k = sshkey_new_private(type)) == NULL) { | 2944 | if ((k = sshkey_new(type)) == NULL) { |
2956 | r = SSH_ERR_ALLOC_FAIL; | 2945 | r = SSH_ERR_ALLOC_FAIL; |
2957 | goto out; | 2946 | goto out; |
2958 | } | 2947 | } |
@@ -2997,7 +2986,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp) | |||
2997 | break; | 2986 | break; |
2998 | # ifdef OPENSSL_HAS_ECC | 2987 | # ifdef OPENSSL_HAS_ECC |
2999 | case KEY_ECDSA: | 2988 | case KEY_ECDSA: |
3000 | if ((k = sshkey_new_private(type)) == NULL) { | 2989 | if ((k = sshkey_new(type)) == NULL) { |
3001 | r = SSH_ERR_ALLOC_FAIL; | 2990 | r = SSH_ERR_ALLOC_FAIL; |
3002 | goto out; | 2991 | goto out; |
3003 | } | 2992 | } |
@@ -3047,7 +3036,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp) | |||
3047 | break; | 3036 | break; |
3048 | # endif /* OPENSSL_HAS_ECC */ | 3037 | # endif /* OPENSSL_HAS_ECC */ |
3049 | case KEY_RSA: | 3038 | case KEY_RSA: |
3050 | if ((k = sshkey_new_private(type)) == NULL) { | 3039 | if ((k = sshkey_new(type)) == NULL) { |
3051 | r = SSH_ERR_ALLOC_FAIL; | 3040 | r = SSH_ERR_ALLOC_FAIL; |
3052 | goto out; | 3041 | goto out; |
3053 | } | 3042 | } |
@@ -3113,7 +3102,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp) | |||
3113 | break; | 3102 | break; |
3114 | #endif /* WITH_OPENSSL */ | 3103 | #endif /* WITH_OPENSSL */ |
3115 | case KEY_ED25519: | 3104 | case KEY_ED25519: |
3116 | if ((k = sshkey_new_private(type)) == NULL) { | 3105 | if ((k = sshkey_new(type)) == NULL) { |
3117 | r = SSH_ERR_ALLOC_FAIL; | 3106 | r = SSH_ERR_ALLOC_FAIL; |
3118 | goto out; | 3107 | goto out; |
3119 | } | 3108 | } |
@@ -3143,7 +3132,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp) | |||
3143 | break; | 3132 | break; |
3144 | #ifdef WITH_XMSS | 3133 | #ifdef WITH_XMSS |
3145 | case KEY_XMSS: | 3134 | case KEY_XMSS: |
3146 | if ((k = sshkey_new_private(type)) == NULL) { | 3135 | if ((k = sshkey_new(type)) == NULL) { |
3147 | r = SSH_ERR_ALLOC_FAIL; | 3136 | r = SSH_ERR_ALLOC_FAIL; |
3148 | goto out; | 3137 | goto out; |
3149 | } | 3138 | } |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshkey.h,v 1.28 2018/09/12 01:32:54 djm Exp $ */ | 1 | /* $OpenBSD: sshkey.h,v 1.30 2018/09/14 04:17:44 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. |
@@ -128,7 +128,6 @@ struct sshkey { | |||
128 | #define ED25519_PK_SZ crypto_sign_ed25519_PUBLICKEYBYTES | 128 | #define ED25519_PK_SZ crypto_sign_ed25519_PUBLICKEYBYTES |
129 | 129 | ||
130 | struct sshkey *sshkey_new(int); | 130 | struct sshkey *sshkey_new(int); |
131 | struct sshkey *sshkey_new_private(int); /* XXX garbage collect */ | ||
132 | void sshkey_free(struct sshkey *); | 131 | void sshkey_free(struct sshkey *); |
133 | int sshkey_equal_public(const struct sshkey *, | 132 | int sshkey_equal_public(const struct sshkey *, |
134 | const struct sshkey *); | 133 | const struct sshkey *); |