From 1e858293d3aea047953edef626b8b3e36feca814 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Thu, 5 Apr 2012 15:58:11 -0400 Subject: [PATCH] rxkad: Move conversion functions to own file Move the various key conversion functions into thir own header file, rather than rxkad_prototypes.h. This means we can isolate the dependency on the hcrypto DES headers (which we don't install) Change-Id: I8efcbf97b6794d9573f35eec9d4a32e9ff4cf352 Reviewed-on: http://gerrit.openafs.org/7067 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/kauth/admin_tools.c | 1 + src/kauth/authclient.c | 1 + src/kauth/client.c | 2 ++ src/kauth/kaprocs.c | 1 + src/kauth/kautils.c | 1 + src/kauth/kpasswd.c | 1 + src/kauth/krb_udp.c | 1 + src/kauth/rebuild.c | 1 + src/kauth/user.c | 2 +- src/rxkad/Makefile.in | 6 +++++- src/rxkad/NTMakefile | 3 ++- src/rxkad/rxkad_convert.h | 46 ++++++++++++++++++++++++++++++++++++++++++++ src/rxkad/rxkad_prototypes.h | 33 ------------------------------- src/rxkad/ticket.c | 1 + src/rxkad/ticket5.c | 1 + 15 files changed, 65 insertions(+), 36 deletions(-) create mode 100644 src/rxkad/rxkad_convert.h diff --git a/src/kauth/admin_tools.c b/src/kauth/admin_tools.c index 71b2b4c..98579ed 100644 --- a/src/kauth/admin_tools.c +++ b/src/kauth/admin_tools.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #define UBIK_LEGACY_CALLITER 1 #include diff --git a/src/kauth/authclient.c b/src/kauth/authclient.c index 652996c..c3d400c 100644 --- a/src/kauth/authclient.c +++ b/src/kauth/authclient.c @@ -27,6 +27,7 @@ #include #include +#include #include #include #include diff --git a/src/kauth/client.c b/src/kauth/client.c index 4bc8a92..8c8b36f 100644 --- a/src/kauth/client.c +++ b/src/kauth/client.c @@ -17,6 +17,8 @@ #include #include +#include + #include #include #include diff --git a/src/kauth/kaprocs.c b/src/kauth/kaprocs.c index 7a93753..9e9f02c 100644 --- a/src/kauth/kaprocs.c +++ b/src/kauth/kaprocs.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include diff --git a/src/kauth/kautils.c b/src/kauth/kautils.c index b17b1e2..33116a6 100644 --- a/src/kauth/kautils.c +++ b/src/kauth/kautils.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "kauth.h" #include "kautils.h" diff --git a/src/kauth/kpasswd.c b/src/kauth/kpasswd.c index 0ea5915..eb2a9f6 100644 --- a/src/kauth/kpasswd.c +++ b/src/kauth/kpasswd.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include diff --git a/src/kauth/krb_udp.c b/src/kauth/krb_udp.c index c59fbce..5e5402c 100644 --- a/src/kauth/krb_udp.c +++ b/src/kauth/krb_udp.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include diff --git a/src/kauth/rebuild.c b/src/kauth/rebuild.c index 6794d9d..d52f572 100644 --- a/src/kauth/rebuild.c +++ b/src/kauth/rebuild.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include "kauth.h" diff --git a/src/kauth/user.c b/src/kauth/user.c index af509fe..49ef3bc 100644 --- a/src/kauth/user.c +++ b/src/kauth/user.c @@ -35,7 +35,7 @@ #include #include #include /* max ticket lifetime */ - +#include #include "kauth.h" #include "kautils.h" diff --git a/src/rxkad/Makefile.in b/src/rxkad/Makefile.in index 78c941e..9e5d317 100644 --- a/src/rxkad/Makefile.in +++ b/src/rxkad/Makefile.in @@ -13,7 +13,7 @@ include @TOP_OBJDIR@/src/config/Makefile.lwp INCLS=${TOP_INCDIR}/rx/rx.h ${TOP_INCDIR}/rx/xdr.h \ - ${TOP_INCDIR}/rx/fcrypt.h \ + ${TOP_INCDIR}/rx/fcrypt.h rxkad_convert.h \ rxkad.h rxkad_prototypes.h fcrypt.h v5gen.h OBJS=rxkad_client.o rxkad_server.o rxkad_common.o rxkad_errs.o \ @@ -37,6 +37,7 @@ generated: \ depinstall: \ ${TOP_INCDIR}/rx/rxkad.h \ ${TOP_INCDIR}/rx/rxkad_prototypes.h \ + ${TOP_INCDIR}/rx/rxkad_convert.h \ ${TOP_INCDIR}/rx/fcrypt.h \ ${TOP_INCDIR}/rx/rxkad_stats.h @@ -55,6 +56,9 @@ ${TOP_INCDIR}/rx/rxkad_prototypes.h: rxkad_prototypes.h ${TOP_INCDIR}/rx/rxkad_stats.h: stats.h ${INSTALL_DATA} $? $@ +${TOP_INCDIR}/rx/rxkad_convert.h: rxkad_convert.h + ${INSTALL_DATA} $? $@ + # # Build targets # diff --git a/src/rxkad/NTMakefile b/src/rxkad/NTMakefile index d8c4951..9b1f0b0 100644 --- a/src/rxkad/NTMakefile +++ b/src/rxkad/NTMakefile @@ -15,7 +15,8 @@ INCFILES =\ $(INCFILEDIR)\rxkad_prototypes.h \ $(INCFILEDIR)\asn1_err.h \ $(INCFILEDIR)\v5gen.h \ - $(INCFILEDIR)\rxkad.h + $(INCFILEDIR)\rxkad.h \ + $(INCFILEDIR)\rxkad_convert.h # build afsrxkad.lib LIBOBJS =\ diff --git a/src/rxkad/rxkad_convert.h b/src/rxkad/rxkad_convert.h new file mode 100644 index 0000000..8fba9bf --- /dev/null +++ b/src/rxkad/rxkad_convert.h @@ -0,0 +1,46 @@ + +/* Conversion functions to go between the various different key types used + * by rxkad and supporting libraries + */ + +#ifndef OPENAFS_RXKAD_CONVERT_H +#define OPENAFS_RXKAD_CONVERT_H 1 + +#include + +struct ktc_encryptionKey; + +static_inline DES_cblock * +ktc_to_cblock(struct ktc_encryptionKey *key) { + return (DES_cblock *)key; +} + +static_inline char * +ktc_to_charptr(struct ktc_encryptionKey *key) { + return (char *)key; +} + + +static_inline DES_cblock * +ktc_to_cblockptr(struct ktc_encryptionKey *key) { + return (DES_cblock *)key; +} + +#if 0 +static_inline unsigned char * +cblockptr_to_cblock(DES_cblock *key) { + return (unsigned char *)key; +} +#endif + +static_inline DES_cblock * +charptr_to_cblock(char *key) { + return (DES_cblock *)key; +} + +static_inline DES_cblock * +charptr_to_cblockptr(char *key) { + return (DES_cblock *)key; +} + +#endif diff --git a/src/rxkad/rxkad_prototypes.h b/src/rxkad/rxkad_prototypes.h index be03608..0f935e7 100644 --- a/src/rxkad/rxkad_prototypes.h +++ b/src/rxkad/rxkad_prototypes.h @@ -158,37 +158,4 @@ extern int tkt_DecodeTicket5(char *ticket, afs_int32 ticket_len, afs_int32 * host, afs_uint32 * start, afs_uint32 * end, afs_int32 disableDotCheck); -static_inline DES_cblock * -ktc_to_cblock(struct ktc_encryptionKey *key) { - return (DES_cblock *)key; -} - -static_inline char * -ktc_to_charptr(struct ktc_encryptionKey *key) { - return (char *)key; -} - - -static_inline DES_cblock * -ktc_to_cblockptr(struct ktc_encryptionKey *key) { - return (DES_cblock *)key; -} - -#if 0 -static_inline unsigned char * -cblockptr_to_cblock(DES_cblock *key) { - return (unsigned char *)key; -} -#endif - -static_inline DES_cblock * -charptr_to_cblock(char *key) { - return (DES_cblock *)key; -} - -static_inline DES_cblock * -charptr_to_cblockptr(char *key) { - return (DES_cblock *)key; -} - #endif diff --git a/src/rxkad/ticket.c b/src/rxkad/ticket.c index d733ac1..52d65fa 100644 --- a/src/rxkad/ticket.c +++ b/src/rxkad/ticket.c @@ -18,6 +18,7 @@ #include "lifetimes.h" #include "rxkad.h" +#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 diff --git a/src/rxkad/ticket5.c b/src/rxkad/ticket5.c index a709d5d..2ab58df 100644 --- a/src/rxkad/ticket5.c +++ b/src/rxkad/ticket5.c @@ -72,6 +72,7 @@ #include "lifetimes.h" #include "rxkad.h" +#include "rxkad_convert.h" #include "v5gen-rewrite.h" #include "v5gen.h" -- 1.9.4