merged in code from d93-jka for WIN32

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@829 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1996-10-05 00:49:37 +00:00
parent db1fc7ff8b
commit e7f718fc47
8 changed files with 70 additions and 10 deletions

View File

@@ -55,6 +55,9 @@
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef HAVE_IO_H
#include <io.h>
#endif
#include <time.h> #include <time.h>
#include "version.h" #include "version.h"

View File

@@ -119,6 +119,10 @@ typedef des_key_schedule bit_64;
extern int des_check_key; /* defaults to false */ extern int des_check_key; /* defaults to false */
extern int des_rw_mode; /* defaults to DES_PCBC_MODE */ extern int des_rw_mode; /* defaults to DES_PCBC_MODE */
#ifdef cplusplus
extern "C" {
#endif
/* The next line is used to disable full ANSI prototypes, if your /* The next line is used to disable full ANSI prototypes, if your
* compiler has problems with the prototypes, make sure this line always * compiler has problems with the prototypes, make sure this line always
* evaluates to true :-) */ * evaluates to true :-) */
@@ -255,4 +259,9 @@ void des_generate_random_block();
void des_rand_data(); void des_rand_data();
#endif #endif
#ifdef cplusplus
}
#endif
#endif #endif

View File

@@ -72,9 +72,12 @@
#define HEADER_DES_LOCL_H #define HEADER_DES_LOCL_H
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#ifndef MSDOS #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef HAVE_IO_H
#include <io.h>
#endif
#include "des.h" #include "des.h"
/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
@@ -101,7 +104,7 @@
#undef NOPROTO #undef NOPROTO
#endif #endif
#if defined(__STDC__) || defined(VMS) || defined(M_XENIX) || defined(MSDOS) #if defined(__STDC__) || defined(VMS) || defined(M_XENIX) || defined(MSDOS) || defined(WIN32)
#include <string.h> #include <string.h>
#endif #endif

View File

@@ -55,6 +55,10 @@
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef HAVE_IO_H
#include <io.h>
#endif
#include "des.h" #include "des.h"
/* tisk tisk - the test keys don't all have odd parity :-( */ /* tisk tisk - the test keys don't all have odd parity :-( */

View File

@@ -58,6 +58,8 @@ des_cblock key;
seed=1; seed=1;
} }
/* Old source */
/*
void des_random_key(ret) void des_random_key(ret)
unsigned char *ret; unsigned char *ret;
{ {
@@ -70,7 +72,7 @@ unsigned char *ret;
DES_LONG t; DES_LONG t;
int i; int i;
#ifdef MSDOS #if defined(MSDOS) || defined(WIN32)
pid=1; pid=1;
#else #else
if (!pid) pid=getpid(); if (!pid) pid=getpid();
@@ -105,3 +107,4 @@ unsigned char *ret;
memset(ks,0,sizeof(ks)); memset(ks,0,sizeof(ks));
t=0; t=0;
} }
*/

View File

@@ -51,10 +51,17 @@
#include <string.h> #include <string.h>
#include <setjmp.h> #include <setjmp.h>
#ifdef WIN32 /* Visual C++ 4.0 (Windows95/NT) */
#include "winlocl/passwd_dlg.h"
#endif /* WIN32 */
/* There are 5 types of terminal interface supported, /* There are 5 types of terminal interface supported,
* TERMIO, TERMIOS, VMS, MSDOS and SGTTY * TERMIO, TERMIOS, VMS, MSDOS and SGTTY
*/ */
/* Now there are also support for Windows95/NT inteface
* d93-jka 960530
*/
#if defined(sgi) || defined(__sgi) #if defined(sgi) || defined(__sgi)
#define TERMIOS #define TERMIOS
#undef TERMIO #undef TERMIO
@@ -65,7 +72,7 @@
#define TERMIO #define TERMIO
#endif #endif
#if !defined(TERMIO) && !defined(TERMIOS) && !defined(VMS) && !defined(MSDOS) #if !defined(TERMIO) && !defined(TERMIOS) && !defined(VMS) && !defined(MSDOS) && !defined(WIN32)
#define SGTTY #define SGTTY
#endif #endif
@@ -93,7 +100,7 @@
#define TTY_set(tty,data) ioctl(tty,TIOCSETP,data) #define TTY_set(tty,data) ioctl(tty,TIOCSETP,data)
#endif #endif
#if !defined(_LIBC) && !defined(MSDOS) #if !defined(_LIBC) && !defined(MSDOS) && !defined(WIN32)
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif #endif
@@ -205,6 +212,9 @@ int size;
char *prompt; char *prompt;
int verify; int verify;
{ {
#ifdef WIN32 /* Visual C++ 4.0 (Windows95/NT) */
return pwd_dialog(buf, size);
#else /* !WIN32 */
#ifdef VMS #ifdef VMS
struct IOSB iosb; struct IOSB iosb;
$DESCRIPTOR(terminal,"TT"); $DESCRIPTOR(terminal,"TT");
@@ -321,8 +331,10 @@ error:
status = SYS$DASSGN(channel); status = SYS$DASSGN(channel);
#endif #endif
return(!ok); return(!ok);
#endif /* !WIN32 */
} }
#ifndef WIN32 /* Visual C++ 4.0 (Windows95/NT) */
static void pushsig() static void pushsig()
{ {
int i; int i;
@@ -348,6 +360,8 @@ int i;
#endif #endif
} }
#endif /* !WIN32 */
#ifdef MSDOS #ifdef MSDOS
static int noecho_fgets(buf,size,tty) static int noecho_fgets(buf,size,tty)
char *buf; char *buf;

View File

@@ -6,10 +6,18 @@ RCSID("$Id$");
#endif #endif
#include <des.h> #include <des.h>
#include <des_locl.h>
#include <sys/bitypes.h> #include <sys/bitypes.h>
#include <sys/time.h> #include <sys/time.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif
#ifdef HAVE_IO_H
#include <io.h>
#endif
#include <signal.h> #include <signal.h>
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
@@ -102,6 +110,8 @@ static volatile unsigned char *gdata; /* Global data */
static volatile int igdata; /* Index into global data */ static volatile int igdata; /* Index into global data */
static int gsize; static int gsize;
#ifndef WIN32 /* Visual C++ 4.0 (Windows95/NT) */
static static
RETSIGTYPE RETSIGTYPE
sigALRM(int sig) sigALRM(int sig)
@@ -112,9 +122,14 @@ sigALRM(int sig)
SIGRETURN(0); SIGRETURN(0);
} }
#ifdef HAVE_RANDOM #endif
/* XXX this is a quick hack, should be fixed */ #if !defined(HAVE_RANDOM) && defined(HAVE_RAND)
#define srandom srand
#define random rand
#endif
#ifdef HAVE_RANDOM
void void
des_not_rand_data(unsigned char *data, int size) des_not_rand_data(unsigned char *data, int size)
@@ -129,6 +144,8 @@ des_not_rand_data(unsigned char *data, int size)
#endif #endif
#ifndef WIN32
#ifndef HAVE_SETITIMER #ifndef HAVE_SETITIMER
void pacemaker(struct timeval *tv) void pacemaker(struct timeval *tv)
{ {
@@ -216,6 +233,13 @@ des_rand_data(unsigned char *data, int size)
#endif #endif
sigaction(SIGALRM, &osa, 0); sigaction(SIGALRM, &osa, 0);
} }
#else
void
des_rand_data(unsigned char *p, int s)
{
return des_not_rand_data (p, s);
}
#endif
void void
des_generate_random_block(des_cblock *block) des_generate_random_block(des_cblock *block)
@@ -223,7 +247,6 @@ des_generate_random_block(des_cblock *block)
des_rand_data((unsigned char *)block, sizeof(*block)); des_rand_data((unsigned char *)block, sizeof(*block));
} }
#if 0
/* /*
* Generate a "random" DES key. * Generate a "random" DES key.
*/ */
@@ -255,7 +278,6 @@ des_mem_rand8(unsigned char *data)
{ {
return 1; return 1;
} }
#endif
/* /*
* In case the generator does not get initialized use this as fallback. * In case the generator does not get initialized use this as fallback.

View File

@@ -52,7 +52,7 @@
#include <config.h> #include <config.h>
#endif #endif
#ifndef MSDOS #if !defined(MSDOS) && !defined(WIN32)
#define TIMES #define TIMES
#endif #endif
@@ -178,6 +178,7 @@ int s;
#endif #endif
} }
/*
int main(argc,argv) int main(argc,argv)
int argc; int argc;
char **argv; char **argv;
@@ -313,3 +314,4 @@ char **argv;
return(0); return(0);
#endif #endif
} }
*/