1 From 36a03132634a17c667c0fac0a8e1519b3d1b71c6 Mon Sep 17 00:00:00 2001
2 From: Matt Johnston <matt@ucc.asn.au>
3 Date: Mon, 28 Nov 2022 21:12:23 +0800
4 Subject: Add #if DROPBEAR_RSA guards
6 Fixes building with DROPBEAR_RSA disabled.
11 sysoptions.h | 5 +----
12 3 files changed, 10 insertions(+), 5 deletions(-)
16 @@ -120,6 +120,7 @@ enum signkey_type signkey_type_from_name
17 /* Special case for rsa-sha2-256. This could be generalised if more
18 signature names are added that aren't 1-1 with public key names */
19 const char* signature_name_from_type(enum signature_type type, unsigned int *namelen) {
21 #if DROPBEAR_RSA_SHA256
22 if (type == DROPBEAR_SIGNATURE_RSA_SHA256) {
24 @@ -136,11 +137,13 @@ const char* signature_name_from_type(enu
25 return SSH_SIGNKEY_RSA;
28 +#endif /* DROPBEAR_RSA */
29 return signkey_name_from_type((enum signkey_type)type, namelen);
32 /* Returns DROPBEAR_SIGNATURE_NONE if none match */
33 enum signature_type signature_type_from_name(const char* name, unsigned int namelen) {
35 #if DROPBEAR_RSA_SHA256
36 if (namelen == strlen(SSH_SIGNATURE_RSA_SHA256)
37 && memcmp(name, SSH_SIGNATURE_RSA_SHA256, namelen) == 0) {
38 @@ -153,10 +156,11 @@ enum signature_type signature_type_from_
39 return DROPBEAR_SIGNATURE_RSA_SHA1;
42 +#endif /* DROPBEAR_RSA */
43 return (enum signature_type)signkey_type_from_name(name, namelen);
46 -/* Returns the signature type from a key type. Must not be called
47 +/* Returns the signature type from a key type. Must not be called
49 enum signature_type signature_type_from_signkey(enum signkey_type keytype) {
51 @@ -167,6 +171,7 @@ enum signature_type signature_type_from_
54 enum signkey_type signkey_type_from_signature(enum signature_type sigtype) {
56 #if DROPBEAR_RSA_SHA256
57 if (sigtype == DROPBEAR_SIGNATURE_RSA_SHA256) {
58 return DROPBEAR_SIGNKEY_RSA;
59 @@ -177,6 +182,7 @@ enum signkey_type signkey_type_from_sign
60 return DROPBEAR_SIGNKEY_RSA;
63 +#endif /* DROPBEAR_RSA */
64 assert((int)sigtype < (int)DROPBEAR_SIGNKEY_NUM_NAMED);
65 return (enum signkey_type)sigtype;
69 @@ -79,12 +79,14 @@ enum signature_type {
70 DROPBEAR_SIGNATURE_SK_ED25519 = DROPBEAR_SIGNKEY_SK_ED25519,
75 DROPBEAR_SIGNATURE_RSA_SHA1 = 100, /* ssh-rsa signature (sha1) */
77 #if DROPBEAR_RSA_SHA256
78 DROPBEAR_SIGNATURE_RSA_SHA256 = 101, /* rsa-sha2-256 signature. has a ssh-rsa key */
80 +#endif /* DROPBEAR_RSA */
81 DROPBEAR_SIGNATURE_NONE = DROPBEAR_SIGNKEY_NONE,
88 /* Debian doesn't define this in system headers */
89 #if !defined(LTM_DESC) && (DROPBEAR_ECC)
94 #define DROPBEAR_ECC_256 (DROPBEAR_ECC)
96 * signing operations slightly slower. */
97 #define DROPBEAR_RSA_BLINDING 1
99 -#ifndef DROPBEAR_RSA_SHA1
100 -#define DROPBEAR_RSA_SHA1 DROPBEAR_RSA
102 #ifndef DROPBEAR_RSA_SHA256
103 #define DROPBEAR_RSA_SHA256 DROPBEAR_RSA