rxkad: Remove DES include from header file
[openafs.git] / src / rxkad / ticket5.c
index 9b4300c..f0e830c 100644 (file)
@@ -2,22 +2,22 @@
  * Copyright (c) 1995, 1996, 1997, 2002 Kungliga Tekniska Högskolan
  * (Royal Institute of Technology, Stockholm, Sweden).
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
- * 
+ *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 
+ *
  * 3. Neither the name of the Institute nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -38,7 +38,7 @@
  *   require a specific license from the United States Government.
  *   It is the responsibility of any person or organization contemplating
  *   export to obtain such a license before exporting.
- * 
+ *
  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
  * distribute this software and its documentation for any purpose and
  * without fee is hereby granted, provided that the above copyright
  */
 
 #include <afsconfig.h>
-#if defined(UKERNEL)
-#include "../afs/param.h"
-#else
 #include <afs/param.h>
-#endif
+#include <afs/stds.h>
 
+#include <roken.h>
 
-#if defined(UKERNEL)
-#include "../afs/sysincludes.h"
-#include "../afs/afsincludes.h"
-#include "../afs/stds.h"
-#include "../rx/xdr.h"
-#include "../rx/rx.h"
-#include "../afs/lifetimes.h"
-#include "../afs/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>
+#ifdef IGNORE_SOME_GCC_WARNINGS
+# pragma GCC diagnostic warning "-Wimplicit-function-declaration"
 #endif
-#include <string.h>
+
 #include <rx/xdr.h>
 #include <rx/rx.h>
+
+#include <hcrypto/md4.h>
+#include <hcrypto/md5.h>
+#include <hcrypto/des.h>
+
 #include "lifetimes.h"
 #include "rxkad.h"
-#endif /* defined(UKERNEL) */
+#include "rxkad_convert.h"
 
 #include "v5gen-rewrite.h"
-#include "asn1-common.h"
-#include "der.h"
 #include "v5gen.h"
+#include "der.h"
 #include "v5der.c"
 #include "v5gen.c"
-#include "md4.h"
-#include "md5.h"
 
 /*
  * Principal conversion Taken from src/lib/krb5/krb/conv_princ from MIT Kerberos.  If you
  * bug with MIT by sending mail to krb5-bugs@mit.edu.
  */
 
-extern afs_int32 des_cbc_encrypt(void * in, void * out,
-                                 register afs_int32 length,
-                                 des_key_schedule key, des_cblock *iv,
-                                 int encrypt);
-extern int des_key_sched(register des_cblock k, des_key_schedule schedule);
-
 struct krb_convert {
     char *v4_str;
     char *v5_str;
@@ -197,7 +178,7 @@ tkt_DecodeTicket5(char *ticket, afs_int32 ticket_len,
                  int (*get_key) (void *, int, struct ktc_encryptionKey *),
                  char *get_key_rock, int serv_kvno, char *name, char *inst,
                  char *cell, struct ktc_encryptionKey *session_key, afs_int32 * host,
-                 afs_int32 * start, afs_int32 * end, afs_int32 disableCheckdot)
+                 afs_uint32 * start, afs_uint32 * end, afs_int32 disableCheckdot)
 {
     char plain[MAXKRB5TICKETLEN];
     struct ktc_encryptionKey serv_key;
@@ -218,19 +199,19 @@ tkt_DecodeTicket5(char *ticket, afs_int32 ticket_len,
        return RXKADBADTICKET;  /* no ticket */
 
     if (serv_kvno == RXKAD_TKT_TYPE_KERBEROS_V5) {
-       code = decode_Ticket(ticket, ticket_len, &t5, &siz);
+       code = decode_Ticket((unsigned char *)ticket, ticket_len, &t5, &siz);
        if (code != 0)
            goto cleanup;
 
        if (t5.tkt_vno != 5)
            goto bad_ticket;
     } else {
-       code = decode_EncryptedData(ticket, ticket_len, &t5.enc_part, &siz);
+       code = decode_EncryptedData((unsigned char *)ticket, ticket_len, &t5.enc_part, &siz);
        if (code != 0)
            goto cleanup;
     }
 
-    /* If kvno is null, it's probably not included because it was kvno==0 
+    /* If kvno is null, it's probably not included because it was kvno==0
      * in the ticket */
     if (t5.enc_part.kvno == NULL) {
        v5_serv_kvno = 0;
@@ -266,7 +247,7 @@ tkt_DecodeTicket5(char *ticket, afs_int32 ticket_len,
        goto bad_ticket;
 
     /* Decode ticket */
-    code = decode_EncTicketPart(plain, plainsiz, &decr_part, &siz);
+    code = decode_EncTicketPart((unsigned char *)plain, plainsiz, &decr_part, &siz);
     if (code != 0)
        goto bad_ticket;
 
@@ -315,7 +296,7 @@ tkt_DecodeTicket5(char *ticket, afs_int32 ticket_len,
     }
 
     if (!disableCheckdot) {
-        /* 
+        /*
          * If the first part of the name_string contains a dot, punt since
          * then we can't see the diffrence between the kerberos 5
          * principals foo.root and foo/root later in the fileserver.
@@ -442,15 +423,15 @@ krb5_des_decrypt(struct ktc_encryptionKey *key, int etype, void *in,
 {
     int (*cksum_func) (void *, size_t, void *, size_t,
                       struct ktc_encryptionKey *);
-    des_cblock ivec;
-    des_key_schedule s;
+    DES_cblock ivec;
+    DES_key_schedule s;
     char cksum[24];
     size_t cksumsz;
     int ret = 1;               /* failure */
 
     cksum_func = NULL;
 
-    des_key_sched(ktc_to_cblock(key), (struct des_ks_struct *)&s);
+    DES_key_sched(ktc_to_cblock(key), &s);
 
 #define CONFOUNDERSZ 8
 
@@ -474,7 +455,7 @@ krb5_des_decrypt(struct ktc_encryptionKey *key, int etype, void *in,
        abort();
     }
 
-    des_cbc_encrypt(in, out, insz, s, &ivec, 0);
+    DES_cbc_encrypt(in, out, insz, &s, &ivec, 0);
 
     memcpy(cksum, (char *)out + CONFOUNDERSZ, cksumsz);
     memset((char *)out + CONFOUNDERSZ, 0, cksumsz);