m/n/core/identity: prevent crash when verifying nil CA certs

We have some 'ca == nil means do not verify' logic around in our
codebase, and this prevents programming errors from panicking.

Change-Id: I047a06984dd40d709294edaf5d658c61667cb954
Reviewed-on: https://review.monogon.dev/c/monogon/+/1423
Reviewed-by: Leopold Schabel <leo@monogon.tech>
Tested-by: Jenkins CI
diff --git a/metropolis/node/core/identity/certificates.go b/metropolis/node/core/identity/certificates.go
index c15f913..a8f2e7b 100644
--- a/metropolis/node/core/identity/certificates.go
+++ b/metropolis/node/core/identity/certificates.go
@@ -67,6 +67,9 @@
 // It does _not_ ensure that the certificate is the local node's CA, and should
 // not be used for security checks, just for data validation checks.
 func VerifyCAInsecure(ca *x509.Certificate) error {
+	if ca == nil {
+		return fmt.Errorf("ca must be set")
+	}
 	// Ensure ca certificate uses ED25519 keypair.
 	if _, ok := ca.PublicKey.(ed25519.PublicKey); !ok {
 		return fmt.Errorf("not issued for ed25519 keypair")