rxkad: Remove DES include from header file
[openafs.git] / src / rxkad / ticket.c
index 0b6628c..e543bbc 100644 (file)
@@ -1,47 +1,26 @@
 /*
  * Copyright 2000, International Business Machines Corporation and others.
  * All Rights Reserved.
- * 
+ *
  * This software has been released under the terms of the IBM Public
  * License.  For details, see the LICENSE file in the top-level source
  * directory or online at http://www.openafs.org/dl/license10.html
  */
 
 #include <afsconfig.h>
-#if defined(UKERNEL)
-#include "afs/param.h"
-#else
 #include <afs/param.h>
-#endif
-
-#include <stdio.h>
-
-#if defined(UKERNEL)
-#include "afs/sysincludes.h"
-#include "afsincludes.h"
-#include "afs/stds.h"
-#include "rx/xdr.h"
-#include "rx/rx.h"
-#include "rxkad/lifetimes.h"
-#include "des.h"
-#include "des/des_prototypes.h"
-#include "rx/rxkad.h"
-#else /* defined(UKERNEL) */
 #include <afs/stds.h>
-#include <sys/types.h>
-#ifdef AFS_NT40_ENV
-#include <winsock2.h>
-#else
-#include <netinet/in.h>
-#endif
-#include <string.h>
-#include <des.h>
-#include <des_prototypes.h>
+
+#include <roken.h>
+
+#include <hcrypto/des.h>
+
 #include <rx/xdr.h>
 #include <rx/rx.h>
+
 #include "lifetimes.h"
 #include "rxkad.h"
-#endif /* defined(UKERNEL) */
+#include "rxkad_convert.h"
 
 /* This union is used to insure we allocate enough space for a key
  * schedule even if we are linked against a library that uses OpenSSL's
@@ -49,7 +28,7 @@
  * application uses both rxkad and openssl.
  */
 union Key_schedule_safe {
-    Key_schedule schedule;
+    DES_key_schedule schedule;
     struct {
        union {
            char cblock[8];
@@ -117,7 +96,7 @@ int
 tkt_DecodeTicket(char *asecret, afs_int32 ticketLen,
                 struct ktc_encryptionKey *key, char *name, char *inst,
                 char *cell, struct ktc_encryptionKey *sessionKey, afs_int32 * host,
-                afs_int32 * start, afs_int32 * end)
+                afs_uint32 * start, afs_uint32 * end)
 {
     char clear_ticket[MAXKTCTICKETLEN];
     char *ticket;
@@ -131,11 +110,11 @@ tkt_DecodeTicket(char *asecret, afs_int32 ticketLen,
        ((ticketLen) % 8 != 0)) /* enc. part must be (0 mod 8) bytes */
        return RXKADBADTICKET;
 
-    if (key_sched(ktc_to_cblock(key), schedule.schedule))
+    if (DES_key_sched(ktc_to_cblock(key), &schedule.schedule))
        return RXKADBADKEY;
 
     ticket = clear_ticket;
-    pcbc_encrypt(asecret, ticket, ticketLen, schedule.schedule, ktc_to_cblockptr(key), DECRYPT);
+    DES_pcbc_encrypt(asecret, ticket, ticketLen, &schedule.schedule, ktc_to_cblockptr(key), DECRYPT);
 
     code =
        decode_athena_ticket(ticket, ticketLen, name, inst, cell, host,
@@ -229,11 +208,12 @@ tkt_MakeTicket(char *ticket, int *ticketLen, struct ktc_encryptionKey *key,
        return -1;
 
     /* encrypt ticket */
-    if ((code = key_sched(ktc_to_cblock(key), schedule.schedule))) {
+    if ((code = DES_key_sched(ktc_to_cblock(key), &schedule.schedule))) {
        printf("In tkt_MakeTicket: key_sched returned %d\n", code);
        return RXKADBADKEY;
     }
-    pcbc_encrypt(ticket, ticket, *ticketLen, schedule.schedule, ktc_to_cblockptr(key), ENCRYPT);
+    DES_pcbc_encrypt(ticket, ticket, *ticketLen, &schedule.schedule,
+                    ktc_to_cblockptr(key), ENCRYPT);
     return 0;
 }