]> git.proxmox.com Git - mirror_kronosnet.git/commitdiff
[crypto] set default case for key_type and avoid build warnings
authorFabio M. Di Nitto <fdinitto@redhat.com>
Wed, 12 Jul 2017 06:58:40 +0000 (08:58 +0200)
committerFabio M. Di Nitto <fdinitto@redhat.com>
Wed, 12 Jul 2017 06:58:40 +0000 (08:58 +0200)
when key_type is unknown, gcc complains that cipher can be used
uninitialized.

add default case to catch wrong callers and avoid build warning

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
libknet/nsscrypto.c

index 89ac4daf5c1c421d50d9268cedba5a2ab204776c..6b77c9b907086123af58c12898ee8f20a218c19c 100644 (file)
@@ -185,6 +185,10 @@ static PK11SymKey *import_symmetric_key(knet_handle_t knet_h, enum sym_key_type
                        cipher = hash_to_nss[instance->crypto_hash_type];
                        operation = CKA_SIGN;
                        break;
+               default:
+                       log_err(knet_h, KNET_SUB_NSSCRYPTO, "Import symmetric key failed. Unknown keyimport request");
+                       goto exit_res_key;
+                       break;
        }
 
        slot = PK11_GetBestSlot(cipher, NULL);