Windows: Build hcrypto shared library

Build a single afshcrypto.dll shared library on Windows.
There are no lwp vs pthread differences on Windows due to
the use of the Windows random data sources.

Change-Id: I02e4d7ee437440433a983f3eb361c78ac3cbbca6
Reviewed-on: http://gerrit.openafs.org/2964
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
This commit is contained in:
Jeffrey Altman 2010-10-11 15:11:52 -04:00 committed by Jeffrey Altman
parent 091b6e19d1
commit 7e0b9ba7fc
8 changed files with 237 additions and 2 deletions

View File

@ -89,7 +89,14 @@ util_headers:
$(NTMAKE_HEADERS)
$(CD) ..\..
pthread: util_headers
hcrypto_headers: util_headers
@echo ***** $@
$(DOCD) $(SRC)\crypto\hcrypto
$(CD) $(SRC)\crypto\hcrypto
$(NTMAKE_HEADERS)
$(CD) ..\..\..
pthread: hcrypto_headers
@echo ***** $@
$(DOCD) $(SRC)\WINNT\$@
$(CD) $(SRC)\WINNT\$@
@ -159,7 +166,14 @@ des: rxgen
$(NTMAKE)
$(CD) ..\..
rx: des
hcrypto: des
@echo ***** $@
$(DOCD) $(SRC)\crypto\hcrypto
$(CD) $(SRC)\crypto\hcrypto
$(NTMAKE)
$(CD) ..\..\..
rx: hcrypto
@echo ***** $@
$(DOCD) $(SRC)\$@
$(CD) $(SRC)\$@

View File

@ -83,6 +83,12 @@ idirs: doclink
! IF (!EXIST($(OJT)\config))
$(MKDIR) $(OJT)\config
! ENDIF
! IF (!EXIST($(OJT)\crypto))
$(MKDIR) $(OJT)\crypto
! ENDIF
! IF (!EXIST($(OJT)\crypto\hcrypto))
$(MKDIR) $(OJT)\crypto\hcrypto
! ENDIF
! IF (!EXIST($(OJT)\des))
$(MKDIR) $(OJT)\des
! ENDIF
@ -419,6 +425,9 @@ idirs: doclink
! IF (!EXIST($(DESTDIR)\include\des))
$(MKDIR) $(DESTDIR)\include\des
! ENDIF
! IF (!EXIST($(DESTDIR)\include\hcrypto))
$(MKDIR) $(DESTDIR)\include\hcrypto
! ENDIF
! IF (!EXIST($(DESTDIR)\include\rx))
$(MKDIR) $(DESTDIR)\include\rx
! ENDIF

View File

@ -1,2 +1,4 @@
/test_cipher
/libafshcrypto.exp
/des.h
/err.h

View File

@ -0,0 +1,131 @@
# Copyright 2010, Your File System Inc
# All rights reserved
#
# This software has been released under the terms of the BSD License
# For details, see the LICENSE file in the top level source directory
RELDIR=crypto\hcrypto
!include ..\..\config\NTMakefile.$(SYS_NAME)
!include ..\..\config\NTMakefile.version
AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) -I$(SRC)\external\heimdal\hcrypto -DHAVE_CONFIG_H=1
ROKEN = $(SRC)\external\heimdal\roken
HCRYPTO = $(SRC)\external\heimdal\hcrypto
INCFILEDIR = $(DESTDIR)\include\hcrypto
INCFILES = \
$(INCFILEDIR)\engine.h \
$(INCFILEDIR)\err.h
HCRYPTO_INCFILES = \
$(INCFILEDIR)\aes.h \
$(INCFILEDIR)\des.h \
$(INCFILEDIR)\evp.h \
$(INCFILEDIR)\evp-hcrypto.h \
$(INCFILEDIR)\evp-cc.h \
$(INCFILEDIR)\hmac.h \
$(INCFILEDIR)\md2.h \
$(INCFILEDIR)\md4.h \
$(INCFILEDIR)\md5.h \
$(INCFILEDIR)\rand.h \
$(INCFILEDIR)\rc2.h \
$(INCFILEDIR)\rc4.h \
$(INCFILEDIR)\sha.h \
$(INCFILEDIR)\ui.h
LIBFILE = $(DESTDIR)\lib\afshcrypto.dll
# Object files by category.
LOCAL_OBJS = \
$(OUT)\engine.obj
HCRYPTO_OBJS = $(OUT)\aes.obj \
$(OUT)\camellia.obj \
$(OUT)\camellia-ntt.obj \
$(OUT)\des.obj \
$(OUT)\evp.obj \
$(OUT)\evp-hcrypto.obj \
$(OUT)\evp-cc.obj \
$(OUT)\hmac.obj \
$(OUT)\md2.obj \
$(OUT)\md4.obj \
$(OUT)\md5.obj \
$(OUT)\pkcs5.obj \
$(OUT)\rand.obj \
$(OUT)\rand-w32.obj \
$(OUT)\rc2.obj \
$(OUT)\rc4.obj \
$(OUT)\rijndael-alg-fst.obj \
$(OUT)\rnd_keys.obj \
$(OUT)\sha.obj \
$(OUT)\sha256.obj \
$(OUT)\sha512.obj \
$(OUT)\ui.obj \
$(OUT)\validate.obj
ROKEN_OBJS = \
$(OUT)\cloexec.obj \
$(OUT)\ct.obj \
$(OUT)\err.obj \
$(OUT)\errx.obj \
$(OUT)\getprogname.obj \
$(OUT)\issuid.obj \
$(OUT)\verr.obj \
$(OUT)\verrx.obj \
$(OUT)\vwarn.obj \
$(OUT)\vwarnx.obj \
$(OUT)\warn.obj \
$(OUT)\warnerr.obj \
$(OUT)\warnx.obj
# This is a horrible hack that is required to get
# around the fact that the OpenAFS build system copies
# its own des.h into the top-level OpenAFS include
# directory. When the OpenAFS des implementation is
# removed, this hack can be removed as well
des.h: $(HCRYPTO)\des.h
$(COPY) $** $@
$(ROKEN_OBJS):$(ROKEN)\$$(@B).c
$(C2OBJ) $** -I$(ROKEN)
$(HCRYPTO_OBJS):$(HCRYPTO)\$$(@B).c
$(C2OBJ) $** -I$(HCRYPTO)
$(HCRYPTO_INCFILES):$(HCRYPTO)\$$(@B).h
$(COPY) $** $(INCFILEDIR)
$(INCFILES):$$(@B).h
$(COPY) $** $(INCFILEDIR)
err.h: $(ROKEN)\err.hin
$(COPY) $** $@
!if !defined(NMAKE)
NTMAKE = nmake /nologo /f ntmakefile
!endif
DLLLIBS = \
# $(DESTDIR)\lib\afs\afsreg.lib
$(LIBFILE): $(LOCAL_OBJS) $(HCRYPTO_OBJS) $(ROKEN_OBJS) $(DLLLIBS)
$(DLLCONLINK) /DEF:afshcrypto.def shell32.lib
$(_VC_MANIFEST_EMBED_DLL)
$(DLLPREP)
$(CODESIGN_USERLAND)
$(SYMSTORE_IMPORT)
$(MAKECYGLIB) --input-def afshcrypto.def
# Definitions for generating versioninfo resources
$(OUT)\afshcrypto.res: AFS_component_version_number.h
install_headers: $(INCFILES) $(HCRYPTO_INCFILES)
install: install_headers des.h $(LIBFILE)
clean::
$(DEL) $(INCFILES)
$(DEL) err.h des.h
$(DEL) $(LIBFILE) $(DESTDIR)\lib\afshcrypto.lib $(DESTDIR)\lib\afshcrypto.exp

View File

@ -0,0 +1,17 @@
EXPORTS
hc_DES_cbc_encrypt @1
hc_DES_cbc_cksum @2
hc_DES_ecb_encrypt @3
hc_DES_init_random_number_generator @4
hc_DES_key_sched @5
hc_DES_new_random_key @6
hc_DES_pcbc_encrypt @7
hc_DES_set_odd_parity @8
hc_DES_string_to_key @9
hc_MD4_Final @10
hc_MD4_Init @11
hc_MD4_Update @12
hc_MD5_Final @13
hc_MD5_Init @14
hc_MD5_Update @15
hc_UI_UTIL_read_pw_string @16

View File

@ -0,0 +1,18 @@
/*
* 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
*/
/* Define VERSIONINFO resource */
#define AFS_VERINFO_FILE_DESCRIPTION "AFS Heimdal Crypto DLL"
#define AFS_VERINFO_DLL
#define AFS_VERINFO_NAME "afshcrypto"
#define AFS_VERINFO_FILENAME "afshcrypto.dll"
#include "AFS_component_version_number.h"
#include "..\config\NTVersioninfo.rc"

View File

@ -62,3 +62,4 @@
# define inline __inline __attribute__((always_inline))
#endif
#include "roken.h"

View File

@ -1,3 +1,44 @@
#ifndef OPENAFS_ROKEN_H
#define OPENAFS_ROKEN_H
#ifdef AFS_NT40_ENV
#include <windows.h>
#ifdef _MSC_VER
/* Declarations for Microsoft Visual C runtime in Windows */
#include <process.h>
#include <io.h>
#ifndef __BITS_TYPES_DEFINED__
#define __BITS_TYPES_DEFINED__
typedef __int8 int8_t;
typedef __int16 int16_t;
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
typedef uint8_t u_int8_t;
typedef uint16_t u_int16_t;
typedef uint32_t u_int32_t;
typedef uint64_t u_int64_t;
#endif /* __BITS_TYPES_DEFINED__ */
#ifndef HAVE_SSIZE_T
#ifdef _WIN64
typedef __int64 ssize_t;
#else
typedef int ssize_t;
#endif
#endif
#endif /* _MSC_VER */
#endif /* AFS_NT40_ENV */
#define rk_UNCONST(x) ((void *)(uintptr_t)(const void *)(x))
#ifndef min
@ -53,3 +94,5 @@ ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL
#ifndef HAVE_GETPROGNAME
ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL getprogname(void);
#endif
#endif /* OPENAFS_ROKEN_H */