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:
@@ -55,6 +55,9 @@
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_IO_H
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include "version.h"
|
||||
|
@@ -119,6 +119,10 @@ typedef des_key_schedule bit_64;
|
||||
extern int des_check_key; /* defaults to false */
|
||||
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
|
||||
* compiler has problems with the prototypes, make sure this line always
|
||||
* evaluates to true :-) */
|
||||
@@ -255,4 +259,9 @@ void des_generate_random_block();
|
||||
void des_rand_data();
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -72,9 +72,12 @@
|
||||
#define HEADER_DES_LOCL_H
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef MSDOS
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_IO_H
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include "des.h"
|
||||
|
||||
/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
@@ -101,7 +104,7 @@
|
||||
#undef NOPROTO
|
||||
#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>
|
||||
#endif
|
||||
|
||||
|
@@ -55,6 +55,10 @@
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_IO_H
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include "des.h"
|
||||
|
||||
/* tisk tisk - the test keys don't all have odd parity :-( */
|
||||
|
@@ -58,6 +58,8 @@ des_cblock key;
|
||||
seed=1;
|
||||
}
|
||||
|
||||
/* Old source */
|
||||
/*
|
||||
void des_random_key(ret)
|
||||
unsigned char *ret;
|
||||
{
|
||||
@@ -70,7 +72,7 @@ unsigned char *ret;
|
||||
DES_LONG t;
|
||||
int i;
|
||||
|
||||
#ifdef MSDOS
|
||||
#if defined(MSDOS) || defined(WIN32)
|
||||
pid=1;
|
||||
#else
|
||||
if (!pid) pid=getpid();
|
||||
@@ -105,3 +107,4 @@ unsigned char *ret;
|
||||
memset(ks,0,sizeof(ks));
|
||||
t=0;
|
||||
}
|
||||
*/
|
||||
|
@@ -51,10 +51,17 @@
|
||||
#include <string.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,
|
||||
* TERMIO, TERMIOS, VMS, MSDOS and SGTTY
|
||||
*/
|
||||
|
||||
/* Now there are also support for Windows95/NT inteface
|
||||
* d93-jka 960530
|
||||
*/
|
||||
#if defined(sgi) || defined(__sgi)
|
||||
#define TERMIOS
|
||||
#undef TERMIO
|
||||
@@ -65,7 +72,7 @@
|
||||
#define TERMIO
|
||||
#endif
|
||||
|
||||
#if !defined(TERMIO) && !defined(TERMIOS) && !defined(VMS) && !defined(MSDOS)
|
||||
#if !defined(TERMIO) && !defined(TERMIOS) && !defined(VMS) && !defined(MSDOS) && !defined(WIN32)
|
||||
#define SGTTY
|
||||
#endif
|
||||
|
||||
@@ -93,7 +100,7 @@
|
||||
#define TTY_set(tty,data) ioctl(tty,TIOCSETP,data)
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBC) && !defined(MSDOS)
|
||||
#if !defined(_LIBC) && !defined(MSDOS) && !defined(WIN32)
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
@@ -205,6 +212,9 @@ int size;
|
||||
char *prompt;
|
||||
int verify;
|
||||
{
|
||||
#ifdef WIN32 /* Visual C++ 4.0 (Windows95/NT) */
|
||||
return pwd_dialog(buf, size);
|
||||
#else /* !WIN32 */
|
||||
#ifdef VMS
|
||||
struct IOSB iosb;
|
||||
$DESCRIPTOR(terminal,"TT");
|
||||
@@ -321,8 +331,10 @@ error:
|
||||
status = SYS$DASSGN(channel);
|
||||
#endif
|
||||
return(!ok);
|
||||
#endif /* !WIN32 */
|
||||
}
|
||||
|
||||
#ifndef WIN32 /* Visual C++ 4.0 (Windows95/NT) */
|
||||
static void pushsig()
|
||||
{
|
||||
int i;
|
||||
@@ -348,6 +360,8 @@ int i;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* !WIN32 */
|
||||
|
||||
#ifdef MSDOS
|
||||
static int noecho_fgets(buf,size,tty)
|
||||
char *buf;
|
||||
|
@@ -6,10 +6,18 @@ RCSID("$Id$");
|
||||
#endif
|
||||
|
||||
#include <des.h>
|
||||
#include <des_locl.h>
|
||||
|
||||
#include <sys/bitypes.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_IO_H
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
@@ -102,6 +110,8 @@ static volatile unsigned char *gdata; /* Global data */
|
||||
static volatile int igdata; /* Index into global data */
|
||||
static int gsize;
|
||||
|
||||
#ifndef WIN32 /* Visual C++ 4.0 (Windows95/NT) */
|
||||
|
||||
static
|
||||
RETSIGTYPE
|
||||
sigALRM(int sig)
|
||||
@@ -112,9 +122,14 @@ sigALRM(int sig)
|
||||
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
|
||||
des_not_rand_data(unsigned char *data, int size)
|
||||
@@ -129,6 +144,8 @@ des_not_rand_data(unsigned char *data, int size)
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
#ifndef HAVE_SETITIMER
|
||||
void pacemaker(struct timeval *tv)
|
||||
{
|
||||
@@ -216,6 +233,13 @@ des_rand_data(unsigned char *data, int size)
|
||||
#endif
|
||||
sigaction(SIGALRM, &osa, 0);
|
||||
}
|
||||
#else
|
||||
void
|
||||
des_rand_data(unsigned char *p, int s)
|
||||
{
|
||||
return des_not_rand_data (p, s);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
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));
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Generate a "random" DES key.
|
||||
*/
|
||||
@@ -255,7 +278,6 @@ des_mem_rand8(unsigned char *data)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* In case the generator does not get initialized use this as fallback.
|
||||
|
@@ -52,7 +52,7 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifndef MSDOS
|
||||
#if !defined(MSDOS) && !defined(WIN32)
|
||||
#define TIMES
|
||||
#endif
|
||||
|
||||
@@ -178,6 +178,7 @@ int s;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
int main(argc,argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
@@ -313,3 +314,4 @@ char **argv;
|
||||
return(0);
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
|
Reference in New Issue
Block a user