Selaa lähdekoodia

[crypto] Rename KEY= to PRIVKEY= and "key" to "privkey"

The setting name "key" conflicts with the setting name "key" already
in use by the 802.11 code.  Resolve the conflict by renaming the newer
setting to "privkey".

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 12 vuotta sitten
vanhempi
commit
4fa1a2b4fe
2 muutettua tiedostoa jossa 21 lisäystä ja 18 poistoa
  1. 18
    15
      src/Makefile.housekeeping
  2. 3
    3
      src/crypto/clientcert.c

+ 18
- 15
src/Makefile.housekeeping Näytä tiedosto

@@ -608,36 +608,39 @@ CFLAGS_clientcert += $(if $(CERT),-DCERTIFICATE="\"$(CERT_INC)\"")
608 608
 
609 609
 # (Single-element) list of client private keys
610 610
 #
611
-KEY_LIST := $(BIN)/.private_key.list
612
-ifeq ($(wildcard $(KEY_LIST)),)
613
-KEY_OLD := <invalid>
611
+ifdef KEY
612
+PRIVKEY	:= $(KEY) # Maintain backwards compatibility
613
+endif
614
+PRIVKEY_LIST := $(BIN)/.private_key.list
615
+ifeq ($(wildcard $(PRIVKEY_LIST)),)
616
+PRIVKEY_OLD := <invalid>
614 617
 else
615
-KEY_OLD := $(shell cat $(KEY_LIST))
618
+PRIVKEY_OLD := $(shell cat $(PRIVKEY_LIST))
616 619
 endif
617
-ifneq ($(KEY_OLD),$(KEY))
618
-$(shell $(ECHO) "$(KEY)" > $(KEY_LIST))
620
+ifneq ($(PRIVKEY_OLD),$(PRIVKEY))
621
+$(shell $(ECHO) "$(PRIVKEY)" > $(PRIVKEY_LIST))
619 622
 endif
620 623
 
621
-$(KEY_LIST) :
624
+$(PRIVKEY_LIST) :
622 625
 
623
-VERYCLEANUP += $(KEY_LIST)
626
+VERYCLEANUP += $(PRIVKEY_LIST)
624 627
 
625 628
 # Embedded client private key
626 629
 #
627
-KEY_INC := $(BIN)/.private_key.der
630
+PRIVKEY_INC := $(BIN)/.private_key.der
628 631
 
629
-ifdef KEY
630
-$(KEY_INC) : $(KEY) $(KEY_LIST)
632
+ifdef PRIVKEY
633
+$(PRIVKEY_INC) : $(PRIVKEY) $(PRIVKEY_LIST)
631 634
 	$(Q)$(OPENSSL) rsa -in $< -outform DER -out $@
632 635
 
633
-clientcert_DEPS += $(KEY_INC)
636
+clientcert_DEPS += $(PRIVKEY_INC)
634 637
 endif
635 638
 
636
-CLEANUP += $(KEY_INC)
639
+CLEANUP += $(PRIVKEY_INC)
637 640
 
638
-clientcert_DEPS += $(KEY_LIST)
641
+clientcert_DEPS += $(PRIVKEY_LIST)
639 642
 
640
-CFLAGS_clientcert += $(if $(KEY),-DPRIVATE_KEY="\"$(KEY_INC)\"")
643
+CFLAGS_clientcert += $(if $(PRIVKEY),-DPRIVATE_KEY="\"$(PRIVKEY_INC)\"")
641 644
 
642 645
 # These files use .incbin inline assembly to include a binary file.
643 646
 # Unfortunately ccache does not detect this dependency and caches

+ 3
- 3
src/crypto/clientcert.c Näytä tiedosto

@@ -99,8 +99,8 @@ static struct setting cert_setting __setting ( SETTING_CRYPTO ) = {
99 99
 };
100 100
 
101 101
 /** Client private key setting */
102
-static struct setting key_setting __setting ( SETTING_CRYPTO ) = {
103
-	.name = "key",
102
+static struct setting privkey_setting __setting ( SETTING_CRYPTO ) = {
103
+	.name = "privkey",
104 104
 	.description = "Client private key",
105 105
 	.tag = DHCP_EB_KEY,
106 106
 	.type = &setting_type_hex,
@@ -146,7 +146,7 @@ static int clientcert_apply_settings ( void ) {
146 146
 
147 147
 		/* Fetch new client private key, if any */
148 148
 		free ( key );
149
-		len = fetch_setting_copy ( NULL, &key_setting, &key );
149
+		len = fetch_setting_copy ( NULL, &privkey_setting, &key );
150 150
 		if ( len < 0 ) {
151 151
 			rc = len;
152 152
 			DBGC ( &client_certificate, "CLIENTCERT cannot fetch "

Loading…
Peruuta
Tallenna