]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
do the old protocol compatibly: don't pass an ivec to the underlying
authorMarc Horowitz <marc@mit.edu>
Tue, 27 Oct 1998 08:08:29 +0000 (08:08 +0000)
committerMarc Horowitz <marc@mit.edu>
Tue, 27 Oct 1998 08:08:29 +0000 (08:08 +0000)
encryption functions if the enctype is similar to DES.

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/marc-3des@10995 dc483132-0cff-0310-8789-dd5450dbe970

src/appl/bsd/kcmd.c

index 8cbaccad502cd6a990b56a735e1d454031a46344..5b448c8567fbfbfed6b5cd783b69537a945a6e39 100644 (file)
@@ -723,6 +723,7 @@ void rcmd_stream_init_krb5(in_keyblock, encrypt_flag, lencheck)
 {
     krb5_error_code status;
     size_t blocksize;
+    krb5_boolean similar;
 
     if (!encrypt_flag) {
        rcmd_stream_init_normal();
@@ -736,6 +737,18 @@ void rcmd_stream_init_krb5(in_keyblock, encrypt_flag, lencheck)
     input = v5_des_read;
     output = v5_des_write;
 
+    if (status = krb5_c_enctype_compare(bsd_context, ENCTYPE_DES_CBC_CRC,
+                                       keyblock->enctype,
+                                       &similar)) {
+       /* XXX what do I do? */
+       abort();
+    }
+
+    if (similar) {
+       encivec.length = 0;
+       return;
+    }
+
     if (status = krb5_c_block_size(bsd_context, keyblock->enctype,
                                   &blocksize)) {
        /* XXX what do I do? */
@@ -866,7 +879,8 @@ static int v5_des_read(fd, buf, len)
     plain.data = storage;
 
     /* decrypt info */
-    if (krb5_c_decrypt(bsd_context, keyblock, KCMD_KEYUSAGE, &encivec,
+    if (krb5_c_decrypt(bsd_context, keyblock, KCMD_KEYUSAGE,
+                      encivec.length?&encivec:0,
                       &cipher, &plain)) {
        /* probably out of sync */
        errno = EIO;
@@ -905,7 +919,8 @@ static int v5_des_write(fd, buf, len)
     cipher.ciphertext.length = sizeof(des_outpkt)-4;
     cipher.ciphertext.data = desoutbuf.data;
 
-    if (krb5_c_encrypt(bsd_context, keyblock, KCMD_KEYUSAGE, &encivec,
+    if (krb5_c_encrypt(bsd_context, keyblock, KCMD_KEYUSAGE,
+                      encivec.length?&encivec:0,
                       &plain, &cipher)) {
        errno = EIO;
        return(-1);