| /webstack/webstack/branches/CoolStack12Rtm/src/db-4.5.20/test/ |
| test042.tcl | 48 set eflag "-cdb -cdb_alldb" 50 set eflag "-cdb" 52 puts "Test042: CDB Test ($eflag) $method $nentries" 79 set env [eval {berkdb_env -create} $eflag -home $testdir] 97 -create -cachesize {0 1048576 1}} $eflag -home $testdir]
|
| /webstack/webstack/branches/CoolStack12Rtm/src/freetds-0.64/src/apps/ |
| freebcp.h | 54 int eflag; member in struct:pd 68 int Eflag;
|
| /webstack/webstack/branches/CoolStack12Rtm/src/mysql-5.0.45/bdb/test/ |
| test042.tcl | 48 set eflag "-cdb -cdb_alldb" 50 set eflag "-cdb" 52 puts "Test042: CDB Test ($eflag) $method $nentries" 79 set env [eval {berkdb_env -create} $eflag -home $testdir] 96 set env [eval {berkdb_env -create} $eflag -home $testdir]
|
| /webstack/webstack/trunk/src/db-4.5.20/test/ |
| test042.tcl | 48 set eflag "-cdb -cdb_alldb" 50 set eflag "-cdb" 52 puts "Test042: CDB Test ($eflag) $method $nentries" 79 set env [eval {berkdb_env -create} $eflag -home $testdir] 97 -create -cachesize {0 1048576 1}} $eflag -home $testdir]
|
| /webstack/webstack/trunk/src/freetds-0.64/src/apps/ |
| freebcp.h | 54 int eflag; member in struct:pd 68 int Eflag;
|
| /webstack/webstack/trunk/src/mysql-5.0.33.32bit/bdb/test/ |
| test042.tcl | 48 set eflag "-cdb -cdb_alldb" 50 set eflag "-cdb" 52 puts "Test042: CDB Test ($eflag) $method $nentries" 79 set env [eval {berkdb_env -create} $eflag -home $testdir] 96 set env [eval {berkdb_env -create} $eflag -home $testdir]
|
| /webstack/webstack/trunk/src/mysql-5.0.33.64bit/bdb/test/ |
| test042.tcl | 48 set eflag "-cdb -cdb_alldb" 50 set eflag "-cdb" 52 puts "Test042: CDB Test ($eflag) $method $nentries" 79 set env [eval {berkdb_env -create} $eflag -home $testdir] 96 set env [eval {berkdb_env -create} $eflag -home $testdir]
|
| /webstack/webstack/trunk/src/mysql-5.0.45/bdb/test/ |
| test042.tcl | 48 set eflag "-cdb -cdb_alldb" 50 set eflag "-cdb" 52 puts "Test042: CDB Test ($eflag) $method $nentries" 79 set env [eval {berkdb_env -create} $eflag -home $testdir] 96 set env [eval {berkdb_env -create} $eflag -home $testdir]
|
| /webstack/webstack/trunk/src/php-5.2.0/main/ |
| snprintf.h | 109 extern char * ap_php_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag, char *buf);
|
| snprintf.c | 299 char * ap_php_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag, char *buf) 338 if (!eflag && (r2 * -1) < ndigits) { 346 if (eflag == 0) 378 if (eflag == 0) {
|
| /webstack/webstack/branches/CoolStack12Rtm/src/cyrus-sasl-2.1.22/mac/libdes/src/ |
| des.c | 134 /* crypto/des/des.c */
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@mincom.oz.au).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@mincom.oz.au).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young (eay@mincom.oz.au)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_IO_H
#include <io.h>
#endif
#include <time.h>
#include "des_ver.h"
#ifdef VMS
#include <types.h>
#include <stat.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include "des.h"
#ifndef HAVE_RANDOM
#define random rand
#define srandom(s) srand(s)
#endif
#ifndef NOPROTO
void usage(void);
void doencryption(void);
int uufwrite(unsigned char *data, int size, unsigned int num, FILE *fp);
void uufwriteEnd(FILE *fp);
int uufread(unsigned char *out,int size,unsigned int num,FILE *fp);
int uuencode(unsigned char *in,int num,unsigned char *out);
int uudecode(unsigned char *in,int num,unsigned char *out);
#else
void usage();
void doencryption();
int uufwrite();
void uufwriteEnd();
int uufread();
int uuencode();
int uudecode();
#endif
#ifdef VMS
#define EXIT(a) exit(a&0x10000000)
#else
#define EXIT(a) exit(a)
#endif
#define BUFSIZE (8*1024)
#define VERIFY 1
#define KEYSIZ 8
#define KEYSIZB 1024 /* should hit tty line limit first :-) */
char key[KEYSIZB+1];
int do_encrypt,longk=0;
FILE *DES_IN,*DES_OUT,*CKSUM_OUT;
char uuname[200];
unsigned char uubuf[50];
int uubufnum=0;
#define INUUBUFN (45*100)
#define OUTUUBUF (65*100)
unsigned char b[OUTUUBUF];
unsigned char bb[300];
des_cblock cksum={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
char cksumname[200]="";
int vflag,cflag,eflag,dflag,kflag,bflag,fflag,sflag,uflag,flag3,hflag,error;
int main(argc, argv)
int argc;
char **argv;
{
int i;
struct stat ins,outs;
char *p;
char *in=NULL,*out=NULL;
vflag=cflag=eflag=dflag=kflag=hflag=bflag=fflag=sflag=uflag=flag3=0;
error=0;
memset(key,0,sizeof(key));
for (i=1; i<argc; i++)
{
p=argv[i];
if ((p[0] == '-') && (p[1] != '\0'))
{
p++;
while (*p)
{
switch (*(p++))
{
case '3':
flag3=1;
longk=1;
break;
case 'c':
cflag=1;
strncpy(cksumname,p,200);
p+=strlen(cksumname);
break;
case 'C':
cflag=1;
longk=1;
strncpy(cksumname,p,200);
p+=strlen(cksumname);
break;
case 'e':
eflag=1;
break;
case 'v':
vflag=1;
break;
case 'E':
eflag=1;
longk=1;
break;
case 'd':
dflag=1;
break;
case 'D':
dflag=1;
longk=1;
break;
case 'b':
bflag=1;
break;
case 'f':
fflag=1;
break;
case 's':
sflag=1;
break;
case 'u':
uflag=1;
strncpy(uuname,p,200);
p+=strlen(uuname);
break;
case 'h':
hflag=1;
break;
case 'k':
kflag=1;
if ((i+1) == argc)
{
fputs("must have a key with the -k option\n",stderr);
error=1;
}
else
{
int j;
i++;
strncpy(key,argv[i],KEYSIZB);
for (j=strlen(argv[i])-1; j>=0; j--)
argv[i][j]='\0';
}
break;
default:
fprintf(stderr,"'%c' unknown flag\n",p[-1]);
error=1;
break;
}
}
}
else
{
if (in == NULL)
in=argv[i];
else if (out == NULL)
out=argv[i];
else
error=1;
}
}
if (error) usage();
/* We either
* do checksum or
* do encrypt or
* do decrypt or
* do decrypt then ckecksum or
* do checksum then encrypt
*/
if (((eflag+dflag) == 1) || cflag)
{
if (eflag) do_encrypt=DES_ENCRYPT;
if (dflag) do_encrypt=DES_DECRYPT;
}
else
{
if (vflag)
{
#ifndef _Windows
fprintf(stderr,"des(1) built with %s\n",libdes_version);
#endif
EXIT(1);
}
else usage();
}
#ifndef _Windows
if (vflag) fprintf(stderr,"des(1) built with %s\n",libdes_version);
#endif
if ( (in != NULL) &&
(out != NULL) &&
#ifndef MSDOS
(stat(in,&ins) != -1) &&
(stat(out,&outs) != -1) &&
(ins.st_dev == outs.st_dev) &&
(ins.st_ino == outs.st_ino))
#else /* MSDOS */
(strcmp(in,out) == 0))
#endif
{
fputs("input and output file are the same\n",stderr);
EXIT(3);
}
if (!kflag)
if (des_read_pw_string(key,KEYSIZB+1,"Enter key:",eflag?VERIFY:0))
{
fputs("password error\n",stderr);
EXIT(2);
}
if (in == NULL)
DES_IN=stdin;
else if ((DES_IN=fopen(in,"r")) == NULL)
{
perror("opening input file");
EXIT(4);
}
CKSUM_OUT=stdout;
if (out == NULL)
{
DES_OUT=stdout;
CKSUM_OUT=stderr;
}
else if ((DES_OUT=fopen(out,"w")) == NULL)
{
perror("opening output file");
EXIT(5);
}
#ifdef MSDOS
/* This should set the file to binary mode. */
{
#include <fcntl.h>
if (!(uflag && dflag))
setmode(fileno(DES_IN),O_BINARY);
if (!(uflag && eflag))
setmode(fileno(DES_OUT),O_BINARY);
}
#endif
doencryption();
fclose(DES_IN);
fclose(DES_OUT);
EXIT(0);
}
void usage()
{
char **u;
static const char *Usage[]={
"des <options> [input-file [output-file]]",
"options:",
"-v : des(1) version number",
"-e : encrypt using sunOS compatible user key to DES key conversion.",
"-E : encrypt ",
"-d : decrypt using sunOS compatible user key to DES key conversion.",
"-D : decrypt ",
"-c[ckname] : generate a cbc_cksum using sunOS compatible user key to",
" DES key conversion and output to ckname (stdout default,",
" stderr if data being output on stdout). The checksum is",
" generated before encryption and after decryption if used",
" in conjunction with -[eEdD].",
"-C[ckname] : generate a cbc_cksum as for -c but compatible with -[ED].",
"-k key : use key 'key'",
"-h : the key that is entered will be a hexidecimal number",
" that is used directly as the des key",
"-u[uuname] : input file is uudecoded if -[dD] or output uuencoded data if -[eE]",
" (uuname is the filename to put in the uuencode header).",
"-b : encrypt using DES in ecb encryption mode, the defaut is cbc mode.",
"-3 : encrypt using tripple DES encryption. This uses 2 keys",
" generated from the input key. If the input key is less",
" than 8 characters long, this is equivelent to normal",
" encryption. Default is tripple cbc, -b makes it tripple ecb.",
NULL
};
for (u=(char **)Usage; *u; u++)
{
fputs(*u,stderr);
fputc('\n',stderr);
}
EXIT(1);
}
void doencryption()
{
#ifdef _LIBC
extern int srandom();
extern int random();
extern unsigned long time();
#endif
register int i;
des_key_schedule ks,ks2;
unsigned char iv[8],iv2[8];
char *p;
int num=0,j,k,l,rem,ll,len,last,ex=0;
des_cblock kk,k2;
FILE *O;
int Exit=0;
#ifndef MSDOS
static unsigned char buf[BUFSIZE+8],obuf[BUFSIZE+8];
#else
static unsigned char *buf=NULL,*obuf=NULL;
if (buf == NULL)
{
if ( (( buf=(unsigned char *)Malloc(BUFSIZE+8)) == NULL) ||
((obuf=(unsigned char *)Malloc(BUFSIZE+8)) == NULL))
{
fputs("Not enough memory\n",stderr);
Exit=10;
goto problems;
}
}
#endif
if (hflag)
{
j=(flag3?16:8);
p=key;
for (i=0; i<j; i++)
{
k=0;
if ((*p <= '9') && (*p >= '0'))
k=(*p-'0')<<4;
else if ((*p <= 'f') && (*p >= 'a'))
k=(*p-'a'+10)<<4;
else if ((*p <= 'F') && (*p >= 'A'))
k=(*p-'A'+10)<<4;
else
{
fputs("Bad hex key\n",stderr);
Exit=9;
goto problems;
}
p++;
if ((*p <= '9') && (*p >= '0'))
k|=(*p-'0');
else if ((*p <= 'f') && (*p >= 'a'))
k|=(*p-'a'+10);
else if ((*p <= 'F') && (*p >= 'A'))
k|=(*p-'A'+10);
else
{
fputs("Bad hex key\n",stderr);
Exit=9;
goto problems;
}
p++;
if (i < 8)
kk[i]=k;
else
k2[i-8]=k;
}
des_set_key((C_Block *)k2,ks2);
memset(k2,0,sizeof(k2));
}
else if (longk || flag3)
{
if (flag3)
{
des_string_to_2keys(key,(C_Block *)kk,(C_Block *)k2);
des_set_key((C_Block *)k2,ks2);
memset(k2,0,sizeof(k2));
}
else
des_string_to_key(key,(C_Block *)kk);
}
else
for (i=0; i<KEYSIZ; i++)
{
l=0;
k=key[i];
for (j=0; j<8; j++)
{
if (k&1) l++;
k>>=1;
}
if (l & 1)
kk[i]=key[i]&0x7f;
else
kk[i]=key[i]|0x80;
}
des_set_key((C_Block *)kk,ks);
memset(key,0,sizeof(key));
memset(kk,0,sizeof(kk));
/* woops - A bug that does not showup under unix :-( */
memset(iv,0,sizeof(iv));
memset(iv2,0,sizeof(iv2));
l=1;
rem=0;
/* first read */
if (eflag || (!dflag && cflag))
{
for (;;)
{
num=l=fread(&(buf[rem]),1,BUFSIZE,DES_IN);
l+=rem;
num+=rem;
if (l < 0)
{
perror("read error");
Exit=6;
goto problems;
}
rem=l%8;
len=l-rem;
if (feof(DES_IN))
{
srandom((unsigned int)time(NULL));
for (i=7-rem; i>0; i--)
buf[l++]=random()&0xff;
buf[l++]=rem;
ex=1;
len+=rem;
}
else
l-=rem;
if (cflag)
{
des_cbc_cksum((C_Block *)buf,(C_Block *)cksum,
(long)len,ks,(C_Block *)cksum);
if (!eflag)
{
if (feof(DES_IN)) break;
else continue;
}
}
if (bflag && !flag3)
(…) 1 \/* crypto\/des\/des.c *\/ variable [all...] |
| /webstack/webstack/trunk/src/cyrus-sasl-2.1.22/mac/libdes/src/ |
| des.c | 134 /* crypto/des/des.c */
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@mincom.oz.au).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@mincom.oz.au).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young (eay@mincom.oz.au)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_IO_H
#include <io.h>
#endif
#include <time.h>
#include "des_ver.h"
#ifdef VMS
#include <types.h>
#include <stat.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include "des.h"
#ifndef HAVE_RANDOM
#define random rand
#define srandom(s) srand(s)
#endif
#ifndef NOPROTO
void usage(void);
void doencryption(void);
int uufwrite(unsigned char *data, int size, unsigned int num, FILE *fp);
void uufwriteEnd(FILE *fp);
int uufread(unsigned char *out,int size,unsigned int num,FILE *fp);
int uuencode(unsigned char *in,int num,unsigned char *out);
int uudecode(unsigned char *in,int num,unsigned char *out);
#else
void usage();
void doencryption();
int uufwrite();
void uufwriteEnd();
int uufread();
int uuencode();
int uudecode();
#endif
#ifdef VMS
#define EXIT(a) exit(a&0x10000000)
#else
#define EXIT(a) exit(a)
#endif
#define BUFSIZE (8*1024)
#define VERIFY 1
#define KEYSIZ 8
#define KEYSIZB 1024 /* should hit tty line limit first :-) */
char key[KEYSIZB+1];
int do_encrypt,longk=0;
FILE *DES_IN,*DES_OUT,*CKSUM_OUT;
char uuname[200];
unsigned char uubuf[50];
int uubufnum=0;
#define INUUBUFN (45*100)
#define OUTUUBUF (65*100)
unsigned char b[OUTUUBUF];
unsigned char bb[300];
des_cblock cksum={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
char cksumname[200]="";
int vflag,cflag,eflag,dflag,kflag,bflag,fflag,sflag,uflag,flag3,hflag,error;
int main(argc, argv)
int argc;
char **argv;
{
int i;
struct stat ins,outs;
char *p;
char *in=NULL,*out=NULL;
vflag=cflag=eflag=dflag=kflag=hflag=bflag=fflag=sflag=uflag=flag3=0;
error=0;
memset(key,0,sizeof(key));
for (i=1; i<argc; i++)
{
p=argv[i];
if ((p[0] == '-') && (p[1] != '\0'))
{
p++;
while (*p)
{
switch (*(p++))
{
case '3':
flag3=1;
longk=1;
break;
case 'c':
cflag=1;
strncpy(cksumname,p,200);
p+=strlen(cksumname);
break;
case 'C':
cflag=1;
longk=1;
strncpy(cksumname,p,200);
p+=strlen(cksumname);
break;
case 'e':
eflag=1;
break;
case 'v':
vflag=1;
break;
case 'E':
eflag=1;
longk=1;
break;
case 'd':
dflag=1;
break;
case 'D':
dflag=1;
longk=1;
break;
case 'b':
bflag=1;
break;
case 'f':
fflag=1;
break;
case 's':
sflag=1;
break;
case 'u':
uflag=1;
strncpy(uuname,p,200);
p+=strlen(uuname);
break;
case 'h':
hflag=1;
break;
case 'k':
kflag=1;
if ((i+1) == argc)
{
fputs("must have a key with the -k option\n",stderr);
error=1;
}
else
{
int j;
i++;
strncpy(key,argv[i],KEYSIZB);
for (j=strlen(argv[i])-1; j>=0; j--)
argv[i][j]='\0';
}
break;
default:
fprintf(stderr,"'%c' unknown flag\n",p[-1]);
error=1;
break;
}
}
}
else
{
if (in == NULL)
in=argv[i];
else if (out == NULL)
out=argv[i];
else
error=1;
}
}
if (error) usage();
/* We either
* do checksum or
* do encrypt or
* do decrypt or
* do decrypt then ckecksum or
* do checksum then encrypt
*/
if (((eflag+dflag) == 1) || cflag)
{
if (eflag) do_encrypt=DES_ENCRYPT;
if (dflag) do_encrypt=DES_DECRYPT;
}
else
{
if (vflag)
{
#ifndef _Windows
fprintf(stderr,"des(1) built with %s\n",libdes_version);
#endif
EXIT(1);
}
else usage();
}
#ifndef _Windows
if (vflag) fprintf(stderr,"des(1) built with %s\n",libdes_version);
#endif
if ( (in != NULL) &&
(out != NULL) &&
#ifndef MSDOS
(stat(in,&ins) != -1) &&
(stat(out,&outs) != -1) &&
(ins.st_dev == outs.st_dev) &&
(ins.st_ino == outs.st_ino))
#else /* MSDOS */
(strcmp(in,out) == 0))
#endif
{
fputs("input and output file are the same\n",stderr);
EXIT(3);
}
if (!kflag)
if (des_read_pw_string(key,KEYSIZB+1,"Enter key:",eflag?VERIFY:0))
{
fputs("password error\n",stderr);
EXIT(2);
}
if (in == NULL)
DES_IN=stdin;
else if ((DES_IN=fopen(in,"r")) == NULL)
{
perror("opening input file");
EXIT(4);
}
CKSUM_OUT=stdout;
if (out == NULL)
{
DES_OUT=stdout;
CKSUM_OUT=stderr;
}
else if ((DES_OUT=fopen(out,"w")) == NULL)
{
perror("opening output file");
EXIT(5);
}
#ifdef MSDOS
/* This should set the file to binary mode. */
{
#include <fcntl.h>
if (!(uflag && dflag))
setmode(fileno(DES_IN),O_BINARY);
if (!(uflag && eflag))
setmode(fileno(DES_OUT),O_BINARY);
}
#endif
doencryption();
fclose(DES_IN);
fclose(DES_OUT);
EXIT(0);
}
void usage()
{
char **u;
static const char *Usage[]={
"des <options> [input-file [output-file]]",
"options:",
"-v : des(1) version number",
"-e : encrypt using sunOS compatible user key to DES key conversion.",
"-E : encrypt ",
"-d : decrypt using sunOS compatible user key to DES key conversion.",
"-D : decrypt ",
"-c[ckname] : generate a cbc_cksum using sunOS compatible user key to",
" DES key conversion and output to ckname (stdout default,",
" stderr if data being output on stdout). The checksum is",
" generated before encryption and after decryption if used",
" in conjunction with -[eEdD].",
"-C[ckname] : generate a cbc_cksum as for -c but compatible with -[ED].",
"-k key : use key 'key'",
"-h : the key that is entered will be a hexidecimal number",
" that is used directly as the des key",
"-u[uuname] : input file is uudecoded if -[dD] or output uuencoded data if -[eE]",
" (uuname is the filename to put in the uuencode header).",
"-b : encrypt using DES in ecb encryption mode, the defaut is cbc mode.",
"-3 : encrypt using tripple DES encryption. This uses 2 keys",
" generated from the input key. If the input key is less",
" than 8 characters long, this is equivelent to normal",
" encryption. Default is tripple cbc, -b makes it tripple ecb.",
NULL
};
for (u=(char **)Usage; *u; u++)
{
fputs(*u,stderr);
fputc('\n',stderr);
}
EXIT(1);
}
void doencryption()
{
#ifdef _LIBC
extern int srandom();
extern int random();
extern unsigned long time();
#endif
register int i;
des_key_schedule ks,ks2;
unsigned char iv[8],iv2[8];
char *p;
int num=0,j,k,l,rem,ll,len,last,ex=0;
des_cblock kk,k2;
FILE *O;
int Exit=0;
#ifndef MSDOS
static unsigned char buf[BUFSIZE+8],obuf[BUFSIZE+8];
#else
static unsigned char *buf=NULL,*obuf=NULL;
if (buf == NULL)
{
if ( (( buf=(unsigned char *)Malloc(BUFSIZE+8)) == NULL) ||
((obuf=(unsigned char *)Malloc(BUFSIZE+8)) == NULL))
{
fputs("Not enough memory\n",stderr);
Exit=10;
goto problems;
}
}
#endif
if (hflag)
{
j=(flag3?16:8);
p=key;
for (i=0; i<j; i++)
{
k=0;
if ((*p <= '9') && (*p >= '0'))
k=(*p-'0')<<4;
else if ((*p <= 'f') && (*p >= 'a'))
k=(*p-'a'+10)<<4;
else if ((*p <= 'F') && (*p >= 'A'))
k=(*p-'A'+10)<<4;
else
{
fputs("Bad hex key\n",stderr);
Exit=9;
goto problems;
}
p++;
if ((*p <= '9') && (*p >= '0'))
k|=(*p-'0');
else if ((*p <= 'f') && (*p >= 'a'))
k|=(*p-'a'+10);
else if ((*p <= 'F') && (*p >= 'A'))
k|=(*p-'A'+10);
else
{
fputs("Bad hex key\n",stderr);
Exit=9;
goto problems;
}
p++;
if (i < 8)
kk[i]=k;
else
k2[i-8]=k;
}
des_set_key((C_Block *)k2,ks2);
memset(k2,0,sizeof(k2));
}
else if (longk || flag3)
{
if (flag3)
{
des_string_to_2keys(key,(C_Block *)kk,(C_Block *)k2);
des_set_key((C_Block *)k2,ks2);
memset(k2,0,sizeof(k2));
}
else
des_string_to_key(key,(C_Block *)kk);
}
else
for (i=0; i<KEYSIZ; i++)
{
l=0;
k=key[i];
for (j=0; j<8; j++)
{
if (k&1) l++;
k>>=1;
}
if (l & 1)
kk[i]=key[i]&0x7f;
else
kk[i]=key[i]|0x80;
}
des_set_key((C_Block *)kk,ks);
memset(key,0,sizeof(key));
memset(kk,0,sizeof(kk));
/* woops - A bug that does not showup under unix :-( */
memset(iv,0,sizeof(iv));
memset(iv2,0,sizeof(iv2));
l=1;
rem=0;
/* first read */
if (eflag || (!dflag && cflag))
{
for (;;)
{
num=l=fread(&(buf[rem]),1,BUFSIZE,DES_IN);
l+=rem;
num+=rem;
if (l < 0)
{
perror("read error");
Exit=6;
goto problems;
}
rem=l%8;
len=l-rem;
if (feof(DES_IN))
{
srandom((unsigned int)time(NULL));
for (i=7-rem; i>0; i--)
buf[l++]=random()&0xff;
buf[l++]=rem;
ex=1;
len+=rem;
}
else
l-=rem;
if (cflag)
{
des_cbc_cksum((C_Block *)buf,(C_Block *)cksum,
(long)len,ks,(C_Block *)cksum);
if (!eflag)
{
if (feof(DES_IN)) break;
else continue;
}
}
if (bflag && !flag3)
(…) 1 \/* crypto\/des\/des.c *\/ variable [all...] |
| /webstack/mod_sed/ |
| libsed.h | 86 int eflag; member in struct:sed_commands_s
|
| sed0.c | 104 commands->eflag = 1; 110 commands->eflag = 0; 724 if(commands->eflag) { 725 if(commands->eflag > 0) { 726 commands->eflag = -1;
|
| /webstack/webserver/src/server/libsed/ |
| libsed.h | 122 int eflag; member in struct:sed_commands_s
|
| sed0.c | 149 commands->eflag = 1; 153 commands->eflag = 0; 750 if(commands->eflag) { 751 if(commands->eflag > 0) { 752 commands->eflag = -1;
|
| /webstack/webstack/trunk/src/php-5.2.0/ext/standard/ |
| formatted_print.c | 65 static char *php_convert_to_decimal(double arg, int ndigits, int *decpt, int *sign, int eflag) 106 if (!eflag && (r2 * -1) < ndigits) { 114 if (eflag == 0) 146 if (eflag == 0) {
|
| /webstack/webstack/branches/CoolStack12Rtm/src/suhosin-0.9.16/ |
| compat_snprintf.c | 295 ap_php_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag, char *buf) 332 if (!eflag && (r2 * -1) < ndigits) { 340 if (eflag == 0) 372 if (eflag == 0) {
|
| /webstack/webstack/trunk/src/suhosin-0.9.16/ |
| compat_snprintf.c | 295 ap_php_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag, char *buf) 332 if (!eflag && (r2 * -1) < ndigits) { 340 if (eflag == 0) 372 if (eflag == 0) {
|
| /webstack/webstack/branches/CoolStack12Rtm/src/squid-2.6.16/lib/ |
| snprintf.c | 95 ap_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag) 132 if (eflag == 0) 157 if (eflag == 0) {
|
| /webstack/webstack/trunk/src/squid/lib/ |
| snprintf.c | 95 ap_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag) 132 if (eflag == 0) 157 if (eflag == 0) {
|
| /webstack/webstack/trunk/src/squid-2.6.16/lib/ |
| snprintf.c | 95 ap_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag) 132 if (eflag == 0) 157 if (eflag == 0) {
|
| /webstack/webstack/branches/CoolStack12Rtm/src/httpd-2.2.6/srclib/apr/strings/ |
| apr_snprintf.c | 97 int eflag, char *buf) 134 if (eflag == 0) 160 if (eflag == 0) { [all...] |
| /webstack/webstack/branches/CoolStack12Rtm/src/tomcat-connectors-1.2.25/native/common/ |
| ap_snprintf.c | 99 static char *ap_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag, char *buf) 136 if (eflag == 0) 161 if (eflag == 0) { [all...] |
| /webstack/webstack/trunk/src/httpd-2.2.3/srclib/apr/strings/ |
| apr_snprintf.c | 97 int eflag, char *buf) 134 if (eflag == 0) 160 if (eflag == 0) { [all...] |