diff --git a/config.h.win32 b/config.h.win32 index ab3f7a9f06..007490bbab 100644 --- a/config.h.win32 +++ b/config.h.win32 @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: config.h.win32,v 1.11 2004/05/03 23:54:37 marka Exp $ */ +/* $Id: config.h.win32,v 1.12 2006/03/10 03:49:57 marka Exp $ */ /* * win32 configuration file @@ -104,6 +104,15 @@ /* Define if you have h_errno */ #define HAVE_H_ERRNO +/* Define if you have RSA_generate_key(). */ +#define HAVE_RSA_GENERATE_KEY + +/* Define if you have DSA_generate_parameters(). */ +#define HAVE_DSA_GENERATE_PARAMETERS + +/* Define if you have DH_generate_parameters(). */ +#define HAVE_DH_GENERATE_PARAMETERS + #define ISC_PLATFORM_NEEDSTRLCAT #define ISC_PLATFORM_NEEDSTRLCPY diff --git a/lib/dns/win32/libdns.def b/lib/dns/win32/libdns.def index 193d5543fd..fbdce93ec7 100644 --- a/lib/dns/win32/libdns.def +++ b/lib/dns/win32/libdns.def @@ -352,6 +352,7 @@ dns_peer_attach dns_peer_detach dns_peer_getbogus dns_peer_getkey +dns_peer_getmaxudp dns_peer_getprovideixfr dns_peer_getrequestixfr dns_peer_getsupportedns @@ -361,7 +362,10 @@ dns_peer_new dns_peer_setbogus dns_peer_setkey dns_peer_setkeybycharp +dns_peer_setmaxudp +dns_peer_setnotifysource dns_peer_setprovideixfr +dns_peer_setquerysource dns_peer_setrequestixfr dns_peer_setsupportedns dns_peer_settransferformat @@ -631,6 +635,7 @@ dns_zone_fulldumptostream dns_zone_getchecknames dns_zone_getclass dns_zone_getdb +dns_zone_getdbtype dns_zone_getfile dns_zone_getforwardacl dns_zone_getidlein @@ -780,6 +785,7 @@ dst_key_name dst_key_paramcompare dst_key_proto dst_key_secretsize +dst_key_setbits dst_key_sigsize dst_key_size dst_key_tobuffer diff --git a/lib/isc/sha2.c b/lib/isc/sha2.c index c05844f4ac..67fe3d0b09 100644 --- a/lib/isc/sha2.c +++ b/lib/isc/sha2.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sha2.c,v 1.8 2006/02/24 00:03:15 marka Exp $ */ +/* $Id: sha2.c,v 1.9 2006/03/10 03:49:57 marka Exp $ */ /* $FreeBSD: src/sys/crypto/sha2/sha2.c,v 1.2.2.2 2002/03/05 08:36:47 ume Exp $ */ /* $KAME: sha2.c,v 1.8 2001/11/08 01:07:52 itojun Exp $ */ @@ -136,6 +136,16 @@ tmp = (tmp >> 16) | (tmp << 16); \ (x) = ((tmp & 0xff00ff00UL) >> 8) | ((tmp & 0x00ff00ffUL) << 8); \ } +#ifdef WIN32 +#define REVERSE64(w,x) { \ + isc_uint64_t tmp = (w); \ + tmp = (tmp >> 32) | (tmp << 32); \ + tmp = ((tmp & 0xff00ff00ff00ff00UL) >> 8) | \ + ((tmp & 0x00ff00ff00ff00ffUL) << 8); \ + (x) = ((tmp & 0xffff0000ffff0000UL) >> 16) | \ + ((tmp & 0x0000ffff0000ffffUL) << 16); \ +} +#else #define REVERSE64(w,x) { \ isc_uint64_t tmp = (w); \ tmp = (tmp >> 32) | (tmp << 32); \ @@ -144,6 +154,7 @@ (x) = ((tmp & 0xffff0000ffff0000ULL) >> 16) | \ ((tmp & 0x0000ffff0000ffffULL) << 16); \ } +#endif #endif /* BYTE_ORDER == LITTLE_ENDIAN */ /* @@ -245,6 +256,75 @@ static const isc_uint32_t sha256_initial_hash_value[8] = { 0x5be0cd19UL }; +#ifdef WIN32 +/* Hash constant words K for SHA-384 and SHA-512: */ +static const isc_uint64_t K512[80] = { + 0x428a2f98d728ae22UL, 0x7137449123ef65cdUL, + 0xb5c0fbcfec4d3b2fUL, 0xe9b5dba58189dbbcUL, + 0x3956c25bf348b538UL, 0x59f111f1b605d019UL, + 0x923f82a4af194f9bUL, 0xab1c5ed5da6d8118UL, + 0xd807aa98a3030242UL, 0x12835b0145706fbeUL, + 0x243185be4ee4b28cUL, 0x550c7dc3d5ffb4e2UL, + 0x72be5d74f27b896fUL, 0x80deb1fe3b1696b1UL, + 0x9bdc06a725c71235UL, 0xc19bf174cf692694UL, + 0xe49b69c19ef14ad2UL, 0xefbe4786384f25e3UL, + 0x0fc19dc68b8cd5b5UL, 0x240ca1cc77ac9c65UL, + 0x2de92c6f592b0275UL, 0x4a7484aa6ea6e483UL, + 0x5cb0a9dcbd41fbd4UL, 0x76f988da831153b5UL, + 0x983e5152ee66dfabUL, 0xa831c66d2db43210UL, + 0xb00327c898fb213fUL, 0xbf597fc7beef0ee4UL, + 0xc6e00bf33da88fc2UL, 0xd5a79147930aa725UL, + 0x06ca6351e003826fUL, 0x142929670a0e6e70UL, + 0x27b70a8546d22ffcUL, 0x2e1b21385c26c926UL, + 0x4d2c6dfc5ac42aedUL, 0x53380d139d95b3dfUL, + 0x650a73548baf63deUL, 0x766a0abb3c77b2a8UL, + 0x81c2c92e47edaee6UL, 0x92722c851482353bUL, + 0xa2bfe8a14cf10364UL, 0xa81a664bbc423001UL, + 0xc24b8b70d0f89791UL, 0xc76c51a30654be30UL, + 0xd192e819d6ef5218UL, 0xd69906245565a910UL, + 0xf40e35855771202aUL, 0x106aa07032bbd1b8UL, + 0x19a4c116b8d2d0c8UL, 0x1e376c085141ab53UL, + 0x2748774cdf8eeb99UL, 0x34b0bcb5e19b48a8UL, + 0x391c0cb3c5c95a63UL, 0x4ed8aa4ae3418acbUL, + 0x5b9cca4f7763e373UL, 0x682e6ff3d6b2b8a3UL, + 0x748f82ee5defb2fcUL, 0x78a5636f43172f60UL, + 0x84c87814a1f0ab72UL, 0x8cc702081a6439ecUL, + 0x90befffa23631e28UL, 0xa4506cebde82bde9UL, + 0xbef9a3f7b2c67915UL, 0xc67178f2e372532bUL, + 0xca273eceea26619cUL, 0xd186b8c721c0c207UL, + 0xeada7dd6cde0eb1eUL, 0xf57d4f7fee6ed178UL, + 0x06f067aa72176fbaUL, 0x0a637dc5a2c898a6UL, + 0x113f9804bef90daeUL, 0x1b710b35131c471bUL, + 0x28db77f523047d84UL, 0x32caab7b40c72493UL, + 0x3c9ebe0a15c9bebcUL, 0x431d67c49c100d4cUL, + 0x4cc5d4becb3e42b6UL, 0x597f299cfc657e2aUL, + 0x5fcb6fab3ad6faecUL, 0x6c44198c4a475817UL +}; + +/* Initial hash value H for SHA-384: */ +static const isc_uint64_t sha384_initial_hash_value[8] = { + 0xcbbb9d5dc1059ed8UL, + 0x629a292a367cd507UL, + 0x9159015a3070dd17UL, + 0x152fecd8f70e5939UL, + 0x67332667ffc00b31UL, + 0x8eb44a8768581511UL, + 0xdb0c2e0d64f98fa7UL, + 0x47b5481dbefa4fa4UL +}; + +/* Initial hash value H for SHA-512: */ +static const isc_uint64_t sha512_initial_hash_value[8] = { + 0x6a09e667f3bcc908U, + 0xbb67ae8584caa73bUL, + 0x3c6ef372fe94f82bUL, + 0xa54ff53a5f1d36f1UL, + 0x510e527fade682d1UL, + 0x9b05688c2b3e6c1fUL, + 0x1f83d9abfb41bd6bUL, + 0x5be0cd19137e2179UL +}; +#else /* Hash constant words K for SHA-384 and SHA-512: */ static const isc_uint64_t K512[80] = { 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, @@ -312,6 +392,7 @@ static const isc_uint64_t sha512_initial_hash_value[8] = { 0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL }; +#endif /* * Constant used by SHA256/384/512_End() functions for converting the @@ -581,7 +662,8 @@ isc_sha256_update(isc_sha256_t *context, const isc_uint8_t *data, size_t len) { /* Sanity check: */ REQUIRE(context != (isc_sha256_t *)0 && data != (isc_uint8_t*)0); - usedspace = (context->bitcount >> 3) % ISC_SHA256_BLOCK_LENGTH; + usedspace = (unsigned int)((context->bitcount >> 3) % + ISC_SHA256_BLOCK_LENGTH); if (usedspace > 0) { /* Calculate how much free space is available in the buffer */ freespace = ISC_SHA256_BLOCK_LENGTH - usedspace; @@ -630,7 +712,8 @@ isc_sha256_final(isc_uint8_t digest[], isc_sha256_t *context) { /* If no digest buffer is passed, we don't bother doing this: */ if (digest != (isc_uint8_t*)0) { - usedspace = (context->bitcount >> 3) % ISC_SHA256_BLOCK_LENGTH; + usedspace = (unsigned int)((context->bitcount >> 3) % + ISC_SHA256_BLOCK_LENGTH); #if BYTE_ORDER == LITTLE_ENDIAN /* Convert FROM host byte order */ REVERSE64(context->bitcount,context->bitcount); @@ -918,7 +1001,8 @@ void isc_sha512_update(isc_sha512_t *context, const isc_uint8_t *data, size_t le /* Sanity check: */ REQUIRE(context != (isc_sha512_t *)0 && data != (isc_uint8_t*)0); - usedspace = (context->bitcount[0] >> 3) % ISC_SHA512_BLOCK_LENGTH; + usedspace = (unsigned int)((context->bitcount[0] >> 3) % + ISC_SHA512_BLOCK_LENGTH); if (usedspace > 0) { /* Calculate how much free space is available in the buffer */ freespace = ISC_SHA512_BLOCK_LENGTH - usedspace; @@ -960,7 +1044,8 @@ void isc_sha512_update(isc_sha512_t *context, const isc_uint8_t *data, size_t le void isc_sha512_last(isc_sha512_t *context) { unsigned int usedspace; - usedspace = (context->bitcount[0] >> 3) % ISC_SHA512_BLOCK_LENGTH; + usedspace = (unsigned int)((context->bitcount[0] >> 3) % + ISC_SHA512_BLOCK_LENGTH); #if BYTE_ORDER == LITTLE_ENDIAN /* Convert FROM host byte order */ REVERSE64(context->bitcount[0],context->bitcount[0]); diff --git a/lib/isc/win32/libisc.def b/lib/isc/win32/libisc.def index 85dea64c77..64026833aa 100644 --- a/lib/isc/win32/libisc.def +++ b/lib/isc/win32/libisc.def @@ -132,6 +132,32 @@ isc_hmacmd5_invalidate isc_hmacmd5_sign isc_hmacmd5_update isc_hmacmd5_verify +isc_hmacmd5_verify2 +isc_hmacsha1_init +isc_hmacsha1_invalidate +isc_hmacsha1_sign +isc_hmacsha1_update +isc_hmacsha1_verify +isc_hmacsha224_init +isc_hmacsha224_invalidate +isc_hmacsha224_sign +isc_hmacsha224_update +isc_hmacsha224_verify +isc_hmacsha256_init +isc_hmacsha256_invalidate +isc_hmacsha256_sign +isc_hmacsha256_update +isc_hmacsha256_verify +isc_hmacsha384_init +isc_hmacsha384_invalidate +isc_hmacsha384_sign +isc_hmacsha384_update +isc_hmacsha384_verify +isc_hmacsha512_init +isc_hmacsha512_invalidate +isc_hmacsha512_sign +isc_hmacsha512_update +isc_hmacsha512_verify isc_interfaceiter_create isc_interfaceiter_current isc_interfaceiter_destroy @@ -201,6 +227,7 @@ isc_md5_init isc_md5_invalidate isc_md5_update isc_mem_attach +isc_mem_checkdestroyed isc_mem_create isc_mem_create2 isc_mem_createx @@ -308,6 +335,18 @@ isc_sha1_final isc_sha1_init isc_sha1_invalidate isc_sha1_update +isc_sha224_final +isc_sha224_init +isc_sha224_update +isc_sha256_final +isc_sha256_init +isc_sha256_update +isc_sha384_final +isc_sha384_init +isc_sha384_update +isc_sha512_final +isc_sha512_init +isc_sha512_update isc_sockaddr_any isc_sockaddr_any6 isc_sockaddr_anyofpf @@ -428,6 +467,7 @@ isc_win32os_versioncheck openlog syslog + ; Exported Data EXPORTS diff --git a/lib/isc/win32/libisc.dsp b/lib/isc/win32/libisc.dsp index 163515420e..4da135e855 100644 --- a/lib/isc/win32/libisc.dsp +++ b/lib/isc/win32/libisc.dsp @@ -293,6 +293,10 @@ SOURCE=..\include\isc\hmacmd5.h # End Source File # Begin Source File +SOURCE=..\include\isc\hmacsha.h +# End Source File +# Begin Source File + SOURCE=.\include\isc\int.h # End Source File # Begin Source File @@ -453,6 +457,10 @@ SOURCE=..\include\isc\sha1.h # End Source File # Begin Source File +SOURCE=..\include\isc\sha2.h +# End Source File +# Begin Source File + SOURCE=..\include\isc\sockaddr.h # End Source File # Begin Source File @@ -589,6 +597,10 @@ SOURCE=..\hmacmd5.c # End Source File # Begin Source File +SOURCE=..\hmacsha.c +# End Source File +# Begin Source File + SOURCE=..\inet_aton.c # End Source File # Begin Source File @@ -685,6 +697,10 @@ SOURCE=..\sha1.c # End Source File # Begin Source File +SOURCE=..\sha2.c +# End Source File +# Begin Source File + SOURCE=..\sockaddr.c # End Source File # Begin Source File diff --git a/lib/isc/win32/libisc.mak b/lib/isc/win32/libisc.mak index 0f1ac8694a..ca241d7d83 100644 --- a/lib/isc/win32/libisc.mak +++ b/lib/isc/win32/libisc.mak @@ -58,6 +58,7 @@ CLEAN : -@erase "$(INTDIR)\heap.obj" -@erase "$(INTDIR)\hex.obj" -@erase "$(INTDIR)\hmacmd5.obj" + -@erase "$(INTDIR)\hmacsha.obj" -@erase "$(INTDIR)\inet_aton.obj" -@erase "$(INTDIR)\inet_ntop.obj" -@erase "$(INTDIR)\inet_pton.obj" @@ -90,6 +91,7 @@ CLEAN : -@erase "$(INTDIR)\rwlock.obj" -@erase "$(INTDIR)\serial.obj" -@erase "$(INTDIR)\sha1.obj" + -@erase "$(INTDIR)\sha2.obj" -@erase "$(INTDIR)\sockaddr.obj" -@erase "$(INTDIR)\socket.obj" -@erase "$(INTDIR)\stdio.obj" @@ -161,6 +163,7 @@ LINK32_OBJS= \ "$(INTDIR)\heap.obj" \ "$(INTDIR)\hex.obj" \ "$(INTDIR)\hmacmd5.obj" \ + "$(INTDIR)\hmacsha.obj" \ "$(INTDIR)\inet_aton.obj" \ "$(INTDIR)\inet_ntop.obj" \ "$(INTDIR)\inet_pton.obj" \ @@ -183,6 +186,7 @@ LINK32_OBJS= \ "$(INTDIR)\rwlock.obj" \ "$(INTDIR)\serial.obj" \ "$(INTDIR)\sha1.obj" \ + "$(INTDIR)\sha2.obj" \ "$(INTDIR)\sockaddr.obj" \ "$(INTDIR)\string.obj" \ "$(INTDIR)\symtab.obj" \ @@ -249,6 +253,8 @@ CLEAN : -@erase "$(INTDIR)\hex.sbr" -@erase "$(INTDIR)\hmacmd5.obj" -@erase "$(INTDIR)\hmacmd5.sbr" + -@erase "$(INTDIR)\hmacsha.obj" + -@erase "$(INTDIR)\hmacsha.sbr" -@erase "$(INTDIR)\inet_aton.obj" -@erase "$(INTDIR)\inet_aton.sbr" -@erase "$(INTDIR)\inet_ntop.obj" @@ -313,6 +319,8 @@ CLEAN : -@erase "$(INTDIR)\serial.sbr" -@erase "$(INTDIR)\sha1.obj" -@erase "$(INTDIR)\sha1.sbr" + -@erase "$(INTDIR)\sha2.obj" + -@erase "$(INTDIR)\sha2.sbr" -@erase "$(INTDIR)\sockaddr.obj" -@erase "$(INTDIR)\sockaddr.sbr" -@erase "$(INTDIR)\socket.obj" @@ -398,6 +406,7 @@ BSC32_SBRS= \ "$(INTDIR)\heap.sbr" \ "$(INTDIR)\hex.sbr" \ "$(INTDIR)\hmacmd5.sbr" \ + "$(INTDIR)\hmacsha.sbr" \ "$(INTDIR)\inet_aton.sbr" \ "$(INTDIR)\inet_ntop.sbr" \ "$(INTDIR)\inet_pton.sbr" \ @@ -420,6 +429,7 @@ BSC32_SBRS= \ "$(INTDIR)\rwlock.sbr" \ "$(INTDIR)\serial.sbr" \ "$(INTDIR)\sha1.sbr" \ + "$(INTDIR)\sha2.sbr" \ "$(INTDIR)\sockaddr.sbr" \ "$(INTDIR)\string.sbr" \ "$(INTDIR)\symtab.sbr" \ @@ -476,6 +486,7 @@ LINK32_OBJS= \ "$(INTDIR)\heap.obj" \ "$(INTDIR)\hex.obj" \ "$(INTDIR)\hmacmd5.obj" \ + "$(INTDIR)\hmacsha.obj" \ "$(INTDIR)\inet_aton.obj" \ "$(INTDIR)\inet_ntop.obj" \ "$(INTDIR)\inet_pton.obj" \ @@ -498,6 +509,7 @@ LINK32_OBJS= \ "$(INTDIR)\rwlock.obj" \ "$(INTDIR)\serial.obj" \ "$(INTDIR)\sha1.obj" \ + "$(INTDIR)\sha2.obj" \ "$(INTDIR)\sockaddr.obj" \ "$(INTDIR)\string.obj" \ "$(INTDIR)\symtab.obj" \ @@ -1169,6 +1181,24 @@ SOURCE=..\hmacmd5.c $(CPP) $(CPP_PROJ) $(SOURCE) +!ENDIF + +SOURCE=..\hmacsha.c + +!IF "$(CFG)" == "libisc - Win32 Release" + + +"$(INTDIR)\hmacsha.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libisc - Win32 Debug" + + +"$(INTDIR)\hmacsha.obj" "$(INTDIR)\hmacsha.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + !ENDIF SOURCE=..\inet_aton.c @@ -1601,6 +1631,24 @@ SOURCE=..\sha1.c $(CPP) $(CPP_PROJ) $(SOURCE) +!ENDIF + +SOURCE=..\sha2.c + +!IF "$(CFG)" == "libisc - Win32 Release" + + +"$(INTDIR)\sha2.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libisc - Win32 Debug" + + +"$(INTDIR)\sha2.obj" "$(INTDIR)\sha2.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + !ENDIF SOURCE=..\sockaddr.c