From 7ddae03f397649b6a16db51c00f6bafd91fe335f Mon Sep 17 00:00:00 2001 From: Johan Danielsson Date: Sat, 8 Jul 2000 14:52:54 +0000 Subject: [PATCH] (read_master_encryptionkey): handle old keytype based files, and convert the key to cfb64 git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8602 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/hdb/mkey.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/hdb/mkey.c b/lib/hdb/mkey.c index bc388a8b8..42b0709d9 100644 --- a/lib/hdb/mkey.c +++ b/lib/hdb/mkey.c @@ -203,8 +203,16 @@ read_master_encryptionkey(krb5_context context, const char *filename, memset(buf, 0, sizeof(buf)); if(ret) return ret; + + /* Originally, the keytype was just that, and later it got changed + to des-cbc-md5, but we always used des in cfb64 mode. This + should cover all cases, but will break if someone has hacked + this code to really use des-cbc-md5 -- but then that's not my + problem. */ + if(key.keytype == KEYTYPE_DES || key.keytype == ETYPE_DES_CBC_MD5) + key.keytype = ETYPE_DES_CFB64_NONE; - ret = hdb_process_master_key(context, 0, &key, ETYPE_DES_CFB64_NONE, mkey); + ret = hdb_process_master_key(context, 0, &key, 0, mkey); return ret; }