Support VC-WIN32

This commit is contained in:
Zhi Guan
2016-07-04 13:03:03 +02:00
parent f881784b73
commit 09f054b2f2
109 changed files with 16877 additions and 200 deletions

View File

@@ -78,9 +78,9 @@ clean:
kdf_x9_63.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
kdf_x9_63.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
kdf_x9_63.o: ../../include/openssl/evp.h ../../include/openssl/obj_mac.h
kdf_x9_63.o: ../../include/openssl/objects.h
kdf_x9_63.o: ../../include/openssl/evp.h ../../include/openssl/kdf.h
kdf_x9_63.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
kdf_x9_63.o: ../../include/openssl/opensslconf.h
kdf_x9_63.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
kdf_x9_63.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
kdf_x9_63.o: ../../include/openssl/symhacks.h kdf.h kdf_x9_63.c
kdf_x9_63.o: ../../include/openssl/symhacks.h kdf_x9_63.c

86
crypto/kdf/Makefile.save Normal file
View File

@@ -0,0 +1,86 @@
#
# crypto/kdf/Makefile
#
DIR= kdf
TOP= ../..
CC= cc
INCLUDES= -I.. -I$(TOP) -I../../include
CFLAG=-g -Wall
MAKEFILE= Makefile
AR= ar r
CFLAGS= $(INCLUDES) $(CFLAG)
GENERAL=Makefile
TEST=kdftest.c
APPS=
LIB=$(TOP)/libcrypto.a
LIBSRC= kdf_x9_63.c
LIBOBJ= kdf_x9_63.o
SRC= $(LIBSRC)
EXHEADER= kdf.h
HEADER= $(EXHEADER)
ALL= $(GENERAL) $(SRC) $(HEADER)
top:
(cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
all: lib
lib: $(LIBOBJ)
$(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
files:
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
links:
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
install:
@[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
@headerlist="$(EXHEADER)"; for i in $$headerlist; \
do \
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
done;
tags:
ctags $(SRC)
tests:
lint:
lint -DLINT $(INCLUDES) $(SRC)>fluff
update: depend
depend:
@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
dclean:
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
mv -f Makefile.new $(MAKEFILE)
clean:
rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it.
kdf_x9_63.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
kdf_x9_63.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
kdf_x9_63.o: ../../include/openssl/evp.h ../../include/openssl/obj_mac.h
kdf_x9_63.o: ../../include/openssl/objects.h
kdf_x9_63.o: ../../include/openssl/opensslconf.h
kdf_x9_63.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
kdf_x9_63.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
kdf_x9_63.o: ../../include/openssl/symhacks.h kdf.h kdf_x9_63.c

View File

@@ -52,8 +52,7 @@
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include "kdf.h"
#include <openssl/kdf.h>
#ifdef CPU_BIGENDIAN
#define cpu_to_be16(v) (v)
@@ -71,6 +70,7 @@ static void *x963_kdf(const EVP_MD *md, const void *in, size_t inlen,
uint32_t counter_be;
unsigned char dgst[EVP_MAX_MD_SIZE];
unsigned int dgstlen;
unsigned char *pout = out;
size_t rlen = *outlen;
size_t len;
@@ -86,9 +86,9 @@ static void *x963_kdf(const EVP_MD *md, const void *in, size_t inlen,
EVP_DigestFinal(&ctx, dgst, &dgstlen);
len = dgstlen <= rlen ? dgstlen : rlen;
memcpy(out, dgst, len);
memcpy(pout, dgst, len);
rlen -= len;
out += len;
pout += len;
}
EVP_MD_CTX_cleanup(&ctx);
@@ -122,7 +122,7 @@ static void *x963_sha224kdf(const void *in, size_t inlen,
static void *x963_sha256kdf(const void *in, size_t inlen,
void *out, size_t *outlen)
{
return x963_kdf(EVP_sha256(), in, inlen, out, *outlen);
return x963_kdf(EVP_sha256(), in, inlen, out, outlen);
}
static void *x963_sha384kdf(const void *in, size_t inlen,