- struct krb5_enctype *ke = &enctypes[enctype];
- struct crypto_hash *tfm;
- rawobj_t hdr;
- __u32 code = GSS_S_FAILURE;
- int rc;
-
- if (!(tfm = crypto_alloc_hash(ke->ke_hash_name, 0, 0))) {
- CERROR("failed to alloc TFM: %s\n", ke->ke_hash_name);
- return GSS_S_FAILURE;
- }
+ struct krb5_enctype *ke = &enctypes[enctype];
+ struct cfs_crypto_hash_desc *desc = NULL;
+ enum cfs_crypto_hash_alg hash_algo;
+ rawobj_t hdr;
+ int rc;
+
+ hash_algo = cfs_crypto_hash_alg(ke->ke_hash_name);
+
+ /* For the cbc(des) case we want md5 instead of hmac(md5) */
+ if (strcmp(ke->ke_enc_name, "cbc(des)"))
+ desc = cfs_crypto_hash_init(hash_algo, kb->kb_key.data,
+ kb->kb_key.len);
+ else
+ desc = cfs_crypto_hash_init(hash_algo, NULL, 0);
+ if (IS_ERR(desc)) {
+ rc = PTR_ERR(desc);
+ CERROR("failed to alloc hash %s : rc = %d\n",
+ ke->ke_hash_name, rc);
+ goto out_no_hash;
+ }