krb5_k_make_checksum will use the mandatory checksum type if 0 is
[krb5.git] / src / lib / crypto / krb / make_checksum_iov.c
index dcffa489c730c81d055705e562728fb3e816ae8f..a7a3cb3ddfd028fdc43b2d748e4da680c11f57bf 100644 (file)
@@ -42,6 +42,12 @@ krb5_k_make_checksum_iov(krb5_context context,
     krb5_crypto_iov *checksum;
     const struct krb5_cksumtypes *ctp;
 
+    if (cksumtype == 0) {
+        ret = krb5int_c_mandatory_cksumtype(context, key->keyblock.enctype,
+                                            &cksumtype);
+        if (ret != 0)
+            return ret;
+    }
     ctp = find_cksumtype(cksumtype);
     if (ctp == NULL)
         return KRB5_BAD_ENCTYPE;