Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37861945
en ru br
ALT Linux repositórios
S:r31301-alt4

Group :: Desktop gráfico/GNUstep
RPM: gnustep-gscrypt

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

pax_global_header00006660000000000000000000000064122773566510014530gustar00rootroot0000000000000052 comment=a641ef84761a06fefb9ce2f08f4907bb8adf6489
gnustep-gscrypt-r31301/000075500000000000000000000000001227735665100150775ustar00rootroot00000000000000gnustep-gscrypt-r31301/.gear/000075500000000000000000000000001227735665100160735ustar00rootroot00000000000000gnustep-gscrypt-r31301/.gear/gscrypt.spec000064400000000000000000000033441227735665100204460ustar00rootroot00000000000000%set_verify_elf_method unresolved=strict

Name: gnustep-gscrypt
Version: r31301
Release: alt2.git20100910
Summary: GNUstep GSCrypt Library
License: GPLv3
Group: Graphical desktop/GNUstep
Url: https://github.com/gnustep/gnustep-gscrypt
Packager: Eugeny A. Rostovtsev (REAL) <real at altlinux.org>

# https://github.com/gnustep/gnustep-gscrypt.git
Source: %name-%version.tar

BuildPreReq: clang-devel gnustep-make-devel libgnustep-objc2-devel /proc
BuildPreReq: gnustep-gui-devel
BuildPreReq: libgmp-devel libgnutls-devel libgcrypt-devel
BuildPreReq: libxslt-devel libffi-devel libicu-devel zlib-devel
BuildPreReq: libpam0-devel

%description
GNUstep GSCrypt Library.

%package -n lib%name
Summary: GNUstep GSCrypt Library
Group: System/Libraries

%description -n lib%name
GNUstep GSCrypt Library.

%package -n lib%name-devel
Summary: Development files of GNUstep GSCrypt Library
Group: Development/Objective-C
Provides: %name-devel = %EVR
Requires: lib%name = %EVR

%description -n lib%name-devel
GNUstep GSCrypt Library.

This package contains development files of GNUstep GSCrypt Library.

%prep
%setup

mkdir gscrypt
cp *.h gscrypt/

%build
. %_datadir/GNUstep/Makefiles/GNUstep.sh

%make_build \
messages=yes \
debug=yes \
strip=no \
shared=yes \
CONFIG_SYSTEM_LIBS='-lpam -lgnustep-base -lobjc2'

%install
. %_datadir/GNUstep/Makefiles/GNUstep.sh

%makeinstall_std GNUSTEP_INSTALLATION_DOMAIN=SYSTEM

%files -n lib%name
%doc ChangeLog
%_libdir/*.so.*

%files -n lib%name-devel
%_includedir/*
%_libdir/*.so

%changelog
* Fri Feb 14 2014 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> r31301-alt2.git20100910
- Built with clang

* Sat Jan 25 2014 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> r31301-alt1.git20100910
- Initial build for Sisyphus

gnustep-gscrypt-r31301/.gear/rules000064400000000000000000000001141227735665100171440ustar00rootroot00000000000000spec: .gear/gscrypt.spec
tar: . name=@name@-@version@ base=@name@-@version@
gnustep-gscrypt-r31301/ChangeLog000064400000000000000000000014741227735665100166570ustar00rootroot000000000000002007-02-18 Nicola Pero <nicola.pero@meta-innovation.com>

* Makefile.preamble (ADDITIONAL_LIB_DIRS): Removed obscure (and
obsolete) -L$(GNUSTEP_SYSTEM_ROOT)/lib flag.
(ADDITIONAL_LDFLAGS): Removed ifeq which would do the same thing
in both cases.

2006-10-09 Nicola Pero <nicola.pero@meta-innovation.com>

* GNUmakefile: Do not set GNUSTEP_INSTALLATION_DIR
and GNUSTEP_MAKEFILES.

2003-01-19 Manuel Guesdon <mguesdon@orange-concept.com>

* GSCryptBase.m: Fixed Bug in HexStringToData

2002-11-25 Richard Frith-Macdonald <rfm@gnu.org>

Remove reference to obsolete extensions library

2000-04-01 Manuel Guesdon <mguesdon@orange-concept.com>

* Added GSPam.h/m: PAM Support
* GNUmakefile: Added GSPam
* Makefile.pramble: Added -lpam

2000-03-31 Manuel Guesdon <mguesdon@orange-concept.com>

* Initial Version
gnustep-gscrypt-r31301/GNUmakefile000064400000000000000000000042521227735665100171540ustar00rootroot00000000000000# GNUmakefila
#
# Copyright (C) 2000 Free Software Foundation, Inc.
#
# Written by: Manuel Guesdon <mguesdon@orange-concept.com>
#
# This file is part of the GNUstep GSCrypt Library.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

ifeq ($(GNUSTEP_MAKEFILES),)
GNUSTEP_MAKEFILES := $(shell gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null)
ifeq ($(GNUSTEP_MAKEFILES),)
$(warning )
$(warning Unable to obtain GNUSTEP_MAKEFILES setting from gnustep-config!)
$(warning Perhaps gnustep-make is not properly installed,)
$(warning so gnustep-config is not in your PATH.)
$(warning )
$(warning Your PATH is currently $(PATH))
$(warning )
endif
endif

ifeq ($(GNUSTEP_MAKEFILES),)
$(error You need to set GNUSTEP_MAKEFILES before compiling!)
endif

include $(GNUSTEP_MAKEFILES)/common.make


#include ../../Version
#include ../../config.mak

srcdir = .
PACKAGE_NAME = gscrypt

# The library to be compiled
LIBRARY_NAME=libgscrypt

# The Objective-C source files to be compiled
libgscrypt_OBJC_FILES = \
GSCryptBase.m \
GSMD5.m \
GSRC4.m \
GSPam.m \

libgscrypt_HEADER_FILES = \
GSCryptCommon.h \
GSCryptBase.h \
GSMD5.h \
GSRC4.h \
GSPam.h \


SRCS = $(LIBRARY_NAME:=.m)

HDRS = $(LIBRARY_NAME:=.h)

libgscrypt_HEADER_FILES_DIR = .
libgscrypt_HEADER_FILES_INSTALL_DIR = /$(GNUSTEP_FND_DIR)/gscrypt

#DIST_FILES = $(SRCS) $(HDRS) GNUmakefile Makefile.postamble Makefile.preamble

-include Makefile.preamble

-include GNUmakefile.local

include $(GNUSTEP_MAKEFILES)/library.make

-include Makefile.postamble
gnustep-gscrypt-r31301/GSCryptBase.h000064400000000000000000000073761227735665100174130ustar00rootroot00000000000000/* GSCryptBase.h - GSCrypt
Copyright (C) 2000 Free Software Foundation, Inc.

Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Mar 2000

This file is part of the GNUstep GSCrypt Library.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

// $Id$

#ifndef _GSCryptBase_h__
#define _GSCryptBase_h__

#include <gscrypt/GSCryptCommon.h>

//====================================================================
@protocol GSCryptBlockTransforming
-(NSData*)processBlock:(NSData*)blockData_;
-(UINT)blockSize;
@end

//====================================================================
@interface NSObject (GSBlockTransform) //<GSCryptBlockTransforming>
-(NSData*)processBufferForBlock:(NSData*)dataIn_;
@end

//====================================================================
@protocol GSCrypting
-(id)initWithKey:(NSData*)key;
+(UINT)keyMinSize;
+(UINT)keyMaxSize;
+(UINT)blockSize;
-(NSData*)crypt:(NSData*)dataIn_;
-(NSData*)decrypt:(NSData*)dataIn_;
@end

//====================================================================
@interface NSObject (GSCrypt) //<GSCrypting>
+(UINT)calculDstSizeWithSrcSize:(UINT)sourceSize_
blockSize:(UINT)blockSize_;
+(UINT)dstSizeWithSrcSize:(UINT)sourceSize_;
@end

//====================================================================
@interface GSHashObject: NSObject
{
// protected
NSData* digest;
BOOL done;
}
-(void)updateWithData:(NSData*)data_; //subClassResponsability
-(void)updateWithString:(NSString*)string_
usingEncoding:(NSStringEncoding)encoding_;
-(UINT)digestSize;
+(UINT)digestSize; //subClassResponsability
-(NSData*)digest;
-(void)calculateDigest;
+(NSData*)digestOfData:(NSData*)data_;
+(NSData*)digestOfString:(NSString*)string_
usingEncoding:(NSStringEncoding)encoding_;
@end

//====================================================================
@protocol GSByteStreaming
-(BYTE)streamByte;
@end

//====================================================================
@interface NSObject (GSRandomNbGen) //<GSByteStreaming>
// calls -streamByte and returns the parity of the byte
-(int)bit;
// get a random 32 bit word in the range min to max, inclusive
-(UINT32)longBetween:(UINT32)min_
and:(UINT32)max_;
-(UINT16)shortBetween:(UINT16)min_
and:(UINT16)max_;
// calls -streamByte length_ times
-(NSData*)blockOfLength:(UINT16)length_;
@end

//====================================================================
@protocol GSStreamCyphering
-(BYTE)cypherByte:(BYTE)input_;
@end

//====================================================================
@interface NSObject (GSStreamCypher) //<GSStreamCyphering>
-(NSData*)cypherBuffer:(NSData*)data_;
@end

//====================================================================
UINT16 BytePrecision(UINT32 value);
UINT16 BitPrecision(UINT32 value);
UINT32 CropValueToBitsNb(UINT32 value,UINT16 bitsNb);

void Swap_(void* a,int sizeOfa,void* b,int sizeOfb);

#define Swap(a,b); Swap_((void*)&a,sizeof(a),(void*)&b,sizeof(b));


#ifdef DEBUG
BOOL TestEndianess();
#endif

NSString* DataToHexString(NSData* data);
NSData* HexStringToData(NSString* _string);

#endif //_GSCryptBase_h__
gnustep-gscrypt-r31301/GSCryptBase.m000064400000000000000000000240531227735665100174070ustar00rootroot00000000000000/* GSCryptBase.m - GSCrypt

Copyright (C) 2000-2003 Free Software Foundation, Inc.

Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Mar 2000

This file is part of the GNUstep GSCrypt Library.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

static const char rcsId[]="$Id$";

#include <gscrypt/GSCryptBase.h>

//====================================================================
@implementation NSObject (GSBlockTransform)// <GSCryptBlockTransforming>
//--------------------------------------------------------------------
-(NSData*)processBufferForBlock:(NSData*)dataIn_
{
NSMutableData* dataOut=[NSMutableData data];
UINT blockSize=[(NSObject<GSCryptBlockTransforming>*)self blockSize];
UINT dataInSize=[dataIn_ length];
UINT blockNb= dataInSize/blockSize;
UINT modSize= dataInSize%blockSize;
UINT blockN = blockNb;
IMP impAppendData=OBJ_METHOD_FOR_SEL(dataOut,appendData:);
IMP impProcessBlock=OBJ_METHOD_FOR_SEL((NSObject<GSCryptBlockTransforming>*)self,processBlock:);
IMP impSubdataWithRange=OBJ_METHOD_FOR_SEL(dataIn_,impSubdataWithRange:);
for(blockN=0;blockN<blockNb;blockN++)
impAppendData(dataOut,@selector(appendData:),
impProcessBlock(self,@selector(processBlock:),
impSubdataWithRange(dataIn_,@selector(subdataWithRange:),
NSMakeRange(blockN*blockSize,blockSize))));
if (modSize>0)
{
NSMutableData* dataInTmp=[[impSubdataWithRange(dataIn_,@selector(subdataWithRange:),
NSMakeRange(blockNb*blockSize,modSize)) mutableCopy] autorelease];
[dataInTmp increaseLengthBy:blockSize-modSize];
impAppendData(dataOut,@selector(appendData:),
impProcessBlock(self,@selector(processBlock:),
dataInTmp));
};
return [NSData dataWithData:dataOut];
};
@end

//====================================================================
@implementation NSObject (GSCrypt) //<GSCrypt>

//--------------------------------------------------------------------
+(UINT)calculDstSizeWithSrcSize:(UINT)sourceSize_
blockSize:(UINT)blockSize_
{
if ((sourceSize_%blockSize_)!=0)
sourceSize_=((sourceSize_/blockSize_)+1)*blockSize_;
return sourceSize_;
};

//--------------------------------------------------------------------
+(UINT)dstSizeWithSrcSize:(UINT)sourceSize_
{
return [self calculDstSizeWithSrcSize:sourceSize_
blockSize:[self blockSize]];
};

@end

//====================================================================
@implementation GSHashObject

//--------------------------------------------------------------------
-(void)updateWithData:(NSData*)data_
{
[self subclassResponsibility:_cmd];
};

//--------------------------------------------------------------------
-(void)updateWithString:(NSString*)string_
usingEncoding:(NSStringEncoding)encoding_
{
[self updateWithData:[string_ dataUsingEncoding:encoding_]];
};

//--------------------------------------------------------------------
-(UINT)digestSize
{
return [[self class] digestSize];
};
//--------------------------------------------------------------------
+(UINT)digestSize
{
return (UINT)[self subclassResponsibility:_cmd];
};

//--------------------------------------------------------------------
-(NSData*)digest
{
if (!done)
[self calculateDigest];
NSAssert(done,@"Not caclulated");
return [[digest copy] autorelease];
};

//--------------------------------------------------------------------
-(void)calculateDigest
{
NSAssert(!done,@"Already caclulated");
done=YES;
};

//--------------------------------------------------------------------
+(NSData*)digestOfData:(NSData*)data_
{
NSData* _digest=nil;
GSHashObject* hashObject=[self new];
[hashObject updateWithData:data_];
_digest=[hashObject digest];
DESTROY(hashObject);
return _digest;
};

//--------------------------------------------------------------------
+(NSData*)digestOfString:(NSString*)string_
usingEncoding:(NSStringEncoding)encoding_
{
return [self digestOfData:[string_ dataUsingEncoding:encoding_]];
};

@end

#ifdef DEBUG
BOOL TestEndianess()
{
BOOL fOk;
/*
#ifdef __BIG_ENDIAN
#ifdef __LITTLE_ENDIAN
#pragma message ("Error: __BIG_ENDIAN && __LITTLE_ENDIAN defined !!!")
#endif
#else
#ifndef __LITTLE_ENDIAN
#pragma message ("Error: __BIG_ENDIAN && __LITTLE_ENDIAN not defined !!!")
#endif
#endif
*/
NSLog(@"Testing Endianess...");
if (*(UINT32 *)"\x01\x00\x00\x00" == 1L)
{
#ifdef __LITTLE_ENDIAN
NSLog(@"PASSED: ");
fOk = YES;
#else
NSCAssert(NO,"FAILED");
fOk = NO;
#endif
NSLog(@"Your machine is little endian.");
}
else
if (*(UINT32*)"\x01\x00\x00\x00" == 0x01000000L)
{
#ifndef __LITTLE_ENDIAN
NSLog(@"PASSED: ");
fOk = YES;
#else
NSCAssert(NO,@"Endianess Test Failed");
NSLog(@"FAILED: ");
fOk = NO;
#endif
NSLog(@"Your machine is big endian.");
}
else
{
NSCAssert(NO,@"Endianess Test Failed");
NSLog(@"FAILED: Your machine is neither big endian nor little endian.");
fOk = NO;
};
return fOk;
};
#endif

//====================================================================
@implementation NSObject (GSRandomNbGen) //<GSRandomNbGenerating>
// calls -byte and returns the parity of the random BYTE
-(int)bit
{
int n = 0;
int x = [(NSObject<GSByteStreaming>*)self streamByte];
if (x)
do
n++;
while (0 != (x = x&(x-1)));
return (n % 2);
};

//---------------------------------------------------------------------
// get a random 32 bit word in the range min to max, inclusive
-(UINT32)longBetween:(UINT32)min_
and:(UINT32)max_
{
UINT32 range = max_-min_;
const UINT16 maxBytes = BytePrecision(range);
const UINT16 maxBits = BitPrecision(range);
UINT32 value=0;
do
{
int i;
value = 0;
for (i=0; i<maxBytes; i++)
value = (value << 8) | [(NSObject<GSByteStreaming>*)self streamByte];
value = CropValueToBitsNb(value, maxBits);
} while (value > range);
return value+min_;
};

//---------------------------------------------------------------------
-(UINT16)shortBetween:(UINT16)min_
and:(UINT16)max_
{
return (UINT16)[self longBetween:min_
and:max_];
};

//---------------------------------------------------------------------
// calls -streamByte length_ times
-(NSData*)blockOfLength:(UINT16)length_
{
NSMutableData* data=[NSMutableData dataWithLength:length_];
BYTE* dataBytes=(BYTE*)[data mutableBytes];
IMP impStreamByte=OBJ_METHOD_FOR_SEL(self,streamByte);
while (length_--)
*dataBytes++ = (BYTE)(impStreamByte((NSObject<GSByteStreaming>*)self,@selector(streamByte)));
return [NSData dataWithData:data];
};
@end

//====================================================================
@implementation NSObject (GSStreamCypher) //<GSStreamCyphering>
-(NSData*)cypherBuffer:(NSData*)data_
{
unsigned int dataLength=[data_ length];
const BYTE* inDataBytes=(BYTE*)[data_ bytes];
NSMutableData* data=[NSMutableData dataWithLength:dataLength];
BYTE* outDataBytes=(BYTE*)[data mutableBytes];
IMP impCypherByte=OBJ_METHOD_FOR_SEL(self,cypherByte:);
while(dataLength--)
*outDataBytes++ = (BYTE)(impCypherByte((NSObject<GSStreamCyphering>*)self,@selector(cypherByte:),*inDataBytes++));
return [NSData dataWithData:data];
};
@end

//--------------------------------------------------------------------
UINT16 BytePrecision(UINT32 value)
{
UINT16 i=0;
for (i=sizeof(value);i;--i)
if (value >> (i-1)*8)
break;
return i;
};

//--------------------------------------------------------------------
UINT16 BitPrecision(UINT32 value)
{
UINT16 i=0;
for (i=8*sizeof(value);i;i--)
if (value >> (i-1))
break;
return i;
};

//--------------------------------------------------------------------
UINT32 CropValueToBitsNb(UINT32 value,UINT16 bitsNb)
{
return (value & ((1L << bitsNb) - 1));
};

void Swap_(void* a,int sizeOfa,void* b,int sizeOfb)
{
BYTE temp[sizeOfa];
NSCAssert2(sizeOfa==sizeOfb,@"Different Size: %d %d",sizeOfa,sizeOfb);
memcpy(temp,a,sizeOfa);
memcpy(a,b,sizeOfa);
memcpy(b,temp,sizeOfa);
};

//--------------------------------------------------------------------
NSString* DataToHexString(NSData* data)
{
unsigned int size=[data length];
if (size)
{
const unsigned char* pData=(const unsigned char*)[data bytes];
if (pData)
{
NSMutableString* string=[[NSMutableString new] autorelease];
int i=0;
for(i=0;i<size;i++)
{
[string appendFormat:@"%02x",(unsigned int)pData[i]];
};
return string;
};
};
return nil;
};

//--------------------------------------------------------------------
NSData* HexStringToData(NSString* _string)
{
int size=[_string length];
if (size>0)
{
const char* pString=(const char*)[[_string uppercaseString]cString];
if (pString)
{
NSMutableData* data=[NSMutableData dataWithLength:size/2];
unsigned char* pData=(unsigned char*)[data bytes];
int i=0;
for(i=0;i<size/2;i++)
{
if (pString[i*2]>='0' && pString[i*2]<='9')
pData[i]=(pString[i*2]-'0') << 4;
else if (pString[i*2]>='A' && pString[i*2]<='F')
pData[i]=(pString[i*2]-'A'+10) << 4;
else
{
NSCAssert(NO,@"Bad hex String");
};
if (pString[i*2+1]>='0' && pString[i*2+1]<='9')
pData[i]=pData[i]|(pString[i*2+1]-'0');
else if (pString[i*2+1]>='A' && pString[i*2+1]<='F')
pData[i]=pData[i]|(pString[i*2+1]-'A'+10);
else
{
NSCAssert(NO,@"Bad hex String");
};
};
return data;
};
};
return nil;
};


gnustep-gscrypt-r31301/GSCryptCommon.h000064400000000000000000000031601227735665100177540ustar00rootroot00000000000000/* GSCryptCommon.h - GSCrypt
Copyright (C) 2000 Free Software Foundation, Inc.

Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Mar 2000

This file is part of the GNUstep GSCrypt Library.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

// $Id$

#ifndef _GSCryptCommon_h__
#define _GSCryptCommon_h__

#include <Foundation/NSObject.h>
#include <Foundation/NSValue.h>
#include <Foundation/NSString.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSException.h>
#include <Foundation/NSData.h>
#include <Foundation/NSDebug.h>

#ifndef BYTE_DEFINED
typedef unsigned char BYTE;
#define BYTE_DEFINED
#endif
#ifndef UINTs_DEFINED
typedef unsigned int UINT;
typedef unsigned char UINT8;
typedef unsigned short UINT16;
typedef unsigned int UINT32;
#define UINTs_DEFINED
#endif
#include <gscrypt/GSCryptBase.h>

#define OBJ_METHOD_FOR_SEL(_obj, _sel) [(NSObject*)_obj methodForSelector:@selector(_sel)]

#endif // _GSCryptCommon_h__
gnustep-gscrypt-r31301/GSMD5.h000064400000000000000000000024761227735665100161000ustar00rootroot00000000000000/* GSMD5.h - GSCrypt: Class GSMD5
Copyright (C) 2000 Free Software Foundation, Inc.

Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Mar 2000

This file is part of the GNUstep GSCrypt Library.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

// $Id$

#ifndef _GSMD5_h__
#define _GSMD5_h__

#include <gscrypt/GSCryptCommon.h>

@interface GSMD5: GSHashObject
{
// protected:
UINT32 ctxBuf[4];
UINT32 ctxBits[2];
BYTE ctxIn[64];
}
-(id)init;
-(void)updateWithData:(NSData*)data_;
-(void)calculateDigest;
+(UINT)digestSize;

//Non Public
-(void)transform;

#ifdef DEBUG
+(BOOL)debugTest;
#endif
@end

#endif // _GSMD5_h__
gnustep-gscrypt-r31301/GSMD5.m000064400000000000000000000260751227735665100161060ustar00rootroot00000000000000/* GSMD5.m - GSCrypt: Class GSMD5
Copyright (C) 2000 Free Software Foundation, Inc.

Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Mar 2000

This file is part of the GNUstep GSCrypt Library.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

// $Id$

#include <gscrypt/GSMD5.h>
#define MD5__DIGEST_SIZE 16
//--------------------------------------------------------------------
#ifdef __LITTLE_ENDIAN
#define MD5_ByteReverse(buff,size) {} // Nothing
#else
void MD5_ByteReverse(BYTE* buff,UINT16 size); // size in Machine Word
{
if (size>0)
{
UINT32 dwTemp;
do
{
dwTemp = (UINT32) ( ((unsigned)buff[3] << 8 | buff[2]) << 16 )
| ( (unsigned)buff[1] << 8 | buff[0] );
*(UINT32*)buff = dwTemp;
buff+=4;
} while (--size);
};
};
#endif //__LITTLE_ENDIAN


@implementation GSMD5

//---------------------------------------------------------------------------------------
// Start MD5 accumulation. Set bit count to 0 and buffer to mysterious initialization constants.
-(id)init
{
if ((self=[super init]))
{
ctxBuf[0] = 0x67452301;
ctxBuf[1] = 0xefcdab89;
ctxBuf[2] = 0x98badcfe;
ctxBuf[3] = 0x10325476;

ctxBits[0] = 0;
ctxBits[1] = 0;

memset(ctxIn,0,64);
};
return self;
};

//--------------------------------------------------------------------

// Update context to reflect the concatenation of another buffer full of bytes.
-(void)updateWithData:(NSData*)data_
{
UINT dataSize=0;
const BYTE* dataBytes=NULL;
UINT32 temp=0;
IMP impTransform=OBJ_METHOD_FOR_SEL(self,transform);
NSAssert(!done,@"Already Calculated");
dataSize=[data_ length];
dataBytes=[data_ bytes];
// Update bitcount
temp=ctxBits[0];
ctxBits[0] = temp + ((UINT32) dataSize << 3);
if (ctxBits[0]<temp)
ctxBits[1]++; // Carry from low to high
ctxBits[1] += dataSize >> 29;
temp = (temp >> 3) & 0x3f; // Bytes already in shsInfo->data
// Handle any leading odd-sized chunks
if (temp)
{
BYTE* buff =(BYTE*)ctxIn+temp;
temp = 64 - temp;
if (dataSize < temp)
{
memcpy(buff,dataBytes,dataSize);
return;
};
memcpy(buff,dataBytes,temp);
MD5_ByteReverse(ctxIn,16);
impTransform(self,@selector(transform));
dataBytes+=temp;
dataSize-=temp;
};
// Process data in 64-byte chunks
while (dataSize >= 64)
{
memcpy(ctxIn,dataBytes,64);
MD5_ByteReverse(ctxIn, 16);
impTransform(self,@selector(transform));
dataBytes += 64;
dataSize -= 64;
};

// Handle any remaining bytes of data.
memcpy(ctxIn,dataBytes,dataSize);
};

//--------------------------------------------------------------------

// Final wrapup - pad to 64-byte boundary with the bit pattern 1 0* (64-bit count of bits processed, MSB-first)
-(void)calculateDigest
{
UINT16 count=0;
BYTE* buff=NULL;
NSData* _digest=nil;
[super calculateDigest];
count=(UINT16)((ctxBits[0] >> 3) & 0x3F); // Compute number of bytes mod 64
// Set the first char of padding to 0x80. This is safe since there is always at least one byte free
buff=ctxIn + count;
*buff++ = 0x80;
count = 64 - 1 - count; // Bytes of padding needed to make 64 bytes

// Pad out to 56 mod 64
if (count<8)
{
// Two lots of padding: Pad the first block to 64 bytes
memset(buff, 0, count);
MD5_ByteReverse(ctxIn, 16);
[self transform];
// Now fill the next block with 56 bytes
memset(ctxIn, 0, 56);
}
else
{
memset(buff, 0, count - 8); // Pad block to 56 bytes
};
MD5_ByteReverse(ctxIn, 14);

// Append length in bits and transform
((UINT32 *)ctxIn)[14] = ctxBits[0];
((UINT32 *)ctxIn)[15] = ctxBits[1];

[self transform];
MD5_ByteReverse((BYTE*)ctxBuf, 4);
_digest=[NSData dataWithBytes:ctxBuf
length:[self digestSize]];
ASSIGN(digest,_digest);
};

//--------------------------------------------------------------------
// The four core functions - CMD5_F1 is optimized somewhat
// #define CMD5_F1(x, y, z) (x & y | ~x & z)
#define CMD5_F1(x, y, z) (z ^ (x & (y ^ z)))
#define CMD5_F2(x, y, z) CMD5_F1(z, x, y)
#define CMD5_F3(x, y, z) (x ^ y ^ z)
#define CMD5_F4(x, y, z) (y ^ (x | ~z))

// This is the central step in the MD5 algorithm.
#define CMD5_STEP(f, w, x, y, z, data, s) ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )

// The core of the MD5 algorithm, this alters an existing MD5 hash to reflect the addition of 16 longwords of new data.
// Update blocks the data and converts bytes into longwords for this routine.
-(void)transform
{
UINT32* dwCtxIn=(UINT32*)ctxIn;
UINT32 a = ctxBuf[0];
UINT32 b = ctxBuf[1];
UINT32 c = ctxBuf[2];
UINT32 d = ctxBuf[3];

CMD5_STEP(CMD5_F1, a, b, c, d, dwCtxIn[0] + 0xd76aa478, 7);
CMD5_STEP(CMD5_F1, d, a, b, c, dwCtxIn[1] + 0xe8c7b756, 12);
CMD5_STEP(CMD5_F1, c, d, a, b, dwCtxIn[2] + 0x242070db, 17);
CMD5_STEP(CMD5_F1, b, c, d, a, dwCtxIn[3] + 0xc1bdceee, 22);
CMD5_STEP(CMD5_F1, a, b, c, d, dwCtxIn[4] + 0xf57c0faf, 7);
CMD5_STEP(CMD5_F1, d, a, b, c, dwCtxIn[5] + 0x4787c62a, 12);
CMD5_STEP(CMD5_F1, c, d, a, b, dwCtxIn[6] + 0xa8304613, 17);
CMD5_STEP(CMD5_F1, b, c, d, a, dwCtxIn[7] + 0xfd469501, 22);
CMD5_STEP(CMD5_F1, a, b, c, d, dwCtxIn[8] + 0x698098d8, 7);
CMD5_STEP(CMD5_F1, d, a, b, c, dwCtxIn[9] + 0x8b44f7af, 12);
CMD5_STEP(CMD5_F1, c, d, a, b, dwCtxIn[10] + 0xffff5bb1, 17);
CMD5_STEP(CMD5_F1, b, c, d, a, dwCtxIn[11] + 0x895cd7be, 22);
CMD5_STEP(CMD5_F1, a, b, c, d, dwCtxIn[12] + 0x6b901122, 7);
CMD5_STEP(CMD5_F1, d, a, b, c, dwCtxIn[13] + 0xfd987193, 12);
CMD5_STEP(CMD5_F1, c, d, a, b, dwCtxIn[14] + 0xa679438e, 17);
CMD5_STEP(CMD5_F1, b, c, d, a, dwCtxIn[15] + 0x49b40821, 22);

CMD5_STEP(CMD5_F2, a, b, c, d, dwCtxIn[1] + 0xf61e2562, 5);
CMD5_STEP(CMD5_F2, d, a, b, c, dwCtxIn[6] + 0xc040b340, 9);
CMD5_STEP(CMD5_F2, c, d, a, b, dwCtxIn[11] + 0x265e5a51, 14);
CMD5_STEP(CMD5_F2, b, c, d, a, dwCtxIn[0] + 0xe9b6c7aa, 20);
CMD5_STEP(CMD5_F2, a, b, c, d, dwCtxIn[5] + 0xd62f105d, 5);
CMD5_STEP(CMD5_F2, d, a, b, c, dwCtxIn[10] + 0x02441453, 9);
CMD5_STEP(CMD5_F2, c, d, a, b, dwCtxIn[15] + 0xd8a1e681, 14);
CMD5_STEP(CMD5_F2, b, c, d, a, dwCtxIn[4] + 0xe7d3fbc8, 20);
CMD5_STEP(CMD5_F2, a, b, c, d, dwCtxIn[9] + 0x21e1cde6, 5);
CMD5_STEP(CMD5_F2, d, a, b, c, dwCtxIn[14] + 0xc33707d6, 9);
CMD5_STEP(CMD5_F2, c, d, a, b, dwCtxIn[3] + 0xf4d50d87, 14);
CMD5_STEP(CMD5_F2, b, c, d, a, dwCtxIn[8] + 0x455a14ed, 20);
CMD5_STEP(CMD5_F2, a, b, c, d, dwCtxIn[13] + 0xa9e3e905, 5);
CMD5_STEP(CMD5_F2, d, a, b, c, dwCtxIn[2] + 0xfcefa3f8, 9);
CMD5_STEP(CMD5_F2, c, d, a, b, dwCtxIn[7] + 0x676f02d9, 14);
CMD5_STEP(CMD5_F2, b, c, d, a, dwCtxIn[12] + 0x8d2a4c8a, 20);

CMD5_STEP(CMD5_F3, a, b, c, d, dwCtxIn[5] + 0xfffa3942, 4);
CMD5_STEP(CMD5_F3, d, a, b, c, dwCtxIn[8] + 0x8771f681, 11);
CMD5_STEP(CMD5_F3, c, d, a, b, dwCtxIn[11] + 0x6d9d6122, 16);
CMD5_STEP(CMD5_F3, b, c, d, a, dwCtxIn[14] + 0xfde5380c, 23);
CMD5_STEP(CMD5_F3, a, b, c, d, dwCtxIn[1] + 0xa4beea44, 4);
CMD5_STEP(CMD5_F3, d, a, b, c, dwCtxIn[4] + 0x4bdecfa9, 11);
CMD5_STEP(CMD5_F3, c, d, a, b, dwCtxIn[7] + 0xf6bb4b60, 16);
CMD5_STEP(CMD5_F3, b, c, d, a, dwCtxIn[10] + 0xbebfbc70, 23);
CMD5_STEP(CMD5_F3, a, b, c, d, dwCtxIn[13] + 0x289b7ec6, 4);
CMD5_STEP(CMD5_F3, d, a, b, c, dwCtxIn[0] + 0xeaa127fa, 11);
CMD5_STEP(CMD5_F3, c, d, a, b, dwCtxIn[3] + 0xd4ef3085, 16);
CMD5_STEP(CMD5_F3, b, c, d, a, dwCtxIn[6] + 0x04881d05, 23);
CMD5_STEP(CMD5_F3, a, b, c, d, dwCtxIn[9] + 0xd9d4d039, 4);
CMD5_STEP(CMD5_F3, d, a, b, c, dwCtxIn[12] + 0xe6db99e5, 11);
CMD5_STEP(CMD5_F3, c, d, a, b, dwCtxIn[15] + 0x1fa27cf8, 16);
CMD5_STEP(CMD5_F3, b, c, d, a, dwCtxIn[2] + 0xc4ac5665, 23);

CMD5_STEP(CMD5_F4, a, b, c, d, dwCtxIn[0] + 0xf4292244, 6);
CMD5_STEP(CMD5_F4, d, a, b, c, dwCtxIn[7] + 0x432aff97, 10);
CMD5_STEP(CMD5_F4, c, d, a, b, dwCtxIn[14] + 0xab9423a7, 15);
CMD5_STEP(CMD5_F4, b, c, d, a, dwCtxIn[5] + 0xfc93a039, 21);
CMD5_STEP(CMD5_F4, a, b, c, d, dwCtxIn[12] + 0x655b59c3, 6);
CMD5_STEP(CMD5_F4, d, a, b, c, dwCtxIn[3] + 0x8f0ccc92, 10);
CMD5_STEP(CMD5_F4, c, d, a, b, dwCtxIn[10] + 0xffeff47d, 15);
CMD5_STEP(CMD5_F4, b, c, d, a, dwCtxIn[1] + 0x85845dd1, 21);
CMD5_STEP(CMD5_F4, a, b, c, d, dwCtxIn[8] + 0x6fa87e4f, 6);
CMD5_STEP(CMD5_F4, d, a, b, c, dwCtxIn[15] + 0xfe2ce6e0, 10);
CMD5_STEP(CMD5_F4, c, d, a, b, dwCtxIn[6] + 0xa3014314, 15);
CMD5_STEP(CMD5_F4, b, c, d, a, dwCtxIn[13] + 0x4e0811a1, 21);
CMD5_STEP(CMD5_F4, a, b, c, d, dwCtxIn[4] + 0xf7537e82, 6);
CMD5_STEP(CMD5_F4, d, a, b, c, dwCtxIn[11] + 0xbd3af235, 10);
CMD5_STEP(CMD5_F4, c, d, a, b, dwCtxIn[2] + 0x2ad7d2bb, 15);
CMD5_STEP(CMD5_F4, b, c, d, a, dwCtxIn[9] + 0xeb86d391, 21);

ctxBuf[0] += a;
ctxBuf[1] += b;
ctxBuf[2] += c;
ctxBuf[3] += d;
};

//--------------------------------------------------------------------

+(UINT)digestSize
{
return MD5__DIGEST_SIZE;
};

#ifdef DEBUG
//--------------------------------------------------------------------
+(BOOL)debugTest
{
BOOL ok=YES;
GSMD5* md5=nil;
NSArray* tests=[NSArray arrayWithObjects:@"",
@"a",
@"abc",
@"message digest",
@"abcdefghijklmnopqrstuvwxyz",
@"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
@"12345678901234567890123456789012345678901234567890123456789012345678901234567890",
nil];
NSArray* results=[NSArray arrayWithObjects:@"D41D8CD98F00B204E9800998ECF8427E", // ""
@"0CC175B9C0F1B6A831C399E269772661", // "a"
@"900150983CD24FB0D6963F7D28E17F72", // "abc"
@"F96B697D7CB7938D525A2F31AAF161D0", // "message digest"
@"C3FCD3D76192E4007DFB496CCA67E13B", // "abcdefghijklmnopqrstuvwxyz"
@"D174AB98D277D9F5A5611C2C9F419D9F", // "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
@"57EDF4A22BE3C955AC49DA2E2107B67A", // "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
nil];
NSString* result=nil;
int i=0;
NSLog(@"MD5 Test...");
TestEndianess();
for(i=0;i<[tests count];i++)
{
BOOL failed=NO;
md5=[[GSMD5 new]autorelease];
[md5 updateWithString:[tests objectAtIndex:i]
usingEncoding:NSASCIIStringEncoding];
result=[DataToHexString([md5 digest])uppercaseString];
failed=![result isEqualToString:[results objectAtIndex:i]];
if (failed)
{
NSLog(@"i=%d result=%@ instead of %@",i,result,[results objectAtIndex:i]);
}
else
{
NSLog(@"MD5 Test %d PASSED",i);
};
};
NSLog(@"MD5 Tests %s",(ok ? "PASSED" : "FAILED"));
NSAssert(ok,@"MD5 Tests Failed");
return ok;
};
#endif

@end
gnustep-gscrypt-r31301/GSPam.h000064400000000000000000000046311227735665100162230ustar00rootroot00000000000000/* GSPam.h - GSCrypt: Class GSPam
Copyright (C) 2000 Free Software Foundation, Inc.

Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Feb 2000

This file is part of the GNUstep GSCrypt Library.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

//$Id$

#ifndef _GSPam_h__
#define _GSPam_h__

#include <security/pam_appl.h>
#include <security/pam_misc.h>
#include <gscrypt/GSCryptCommon.h>


//====================================================================
@interface GSPam: NSObject
{
pam_handle_t* _pamHandle;
struct pam_conv _pamConv;
int _lastStatus;
NSString* _lastErrorMessage;
NSString* _serviceName;
NSString* _user;
NSString* _password;
};

+(id)pam;
+(id)pamWithServiceName:(NSString*)serviceName;
+(id)pamWithServiceName:(NSString*)serviceName
user:(NSString*)user
password:(NSString*)password;
-(id)init;
-(id)initWithServiceName:(NSString*)serviceName;
-(id)initWithServiceName:(NSString*)serviceName
user:(NSString*)user
password:(NSString*)password;
-(void)dealloc;
-(void)assignLastErrorMessage;
-(int)processMessages:(const struct pam_message**)messages
withMessagesNb:(int)numMessages
withResponse:(struct pam_response*)responses;
-(void)setServiceName:(NSString*)serviceName;
-(void)setUser:(NSString*)user;
-(void)setPassword:(NSString*)password;
-(NSString*)serviceName;
-(NSString*)user;
-(NSString*)password;
-(int)status;
-(NSString*)errorMessage;
-(BOOL)start;
-(BOOL)end;
-(BOOL)endWithStatus:(int)status;
-(BOOL)authenticateWithFlag:(int)flag
silent:(BOOL)silentFlag;
-(BOOL)accountManagementWithFlag:(int)flag
silent:(BOOL)silentFlag;
-(BOOL)openSessionSilently:(BOOL)silentFlag;
-(BOOL)closeSessionSilently:(BOOL)silentFlag;

@end


#endif //_GSPam_h__
gnustep-gscrypt-r31301/GSPam.m000064400000000000000000000224751227735665100162360ustar00rootroot00000000000000/* GSPam.m - GSCrypt: Class GSPam
Copyright (C) 2000 Free Software Foundation, Inc.

Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Feb 2000

This file is part of the GNUstep GSCrypt Library.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

//$Id$

#include <gscrypt/GSPam.h>

//====================================================================
static int pam_exchange(int num_msg,
const struct pam_message **msg,
struct pam_response **resp,
void *appdata_ptr)
{
int retStatus=PAM_SUCCESS;
struct pam_response* response=NULL;
response = malloc(sizeof(struct pam_response)*num_msg);
if(response == (struct pam_response *)0)
retStatus=PAM_CONV_ERR;
else
{
int i=0;
memset((void*)response,0,sizeof(struct pam_response)*num_msg);
for(i=0;i<num_msg;i++)
{
NSDebugFLog(@"PAM Message #%d: %d",i,msg[i]->msg_style);
response[i].resp_retcode = PAM_SUCCESS;
switch(msg[i]->msg_style)
{
case PAM_PROMPT_ECHO_ON:
case PAM_PROMPT_ECHO_OFF:
case PAM_TEXT_INFO:
case PAM_ERROR_MSG:
//Handled by object !
break;
case PAM_BINARY_PROMPT:
// Must be an error of some sort...
free(response);
retStatus=PAM_CONV_ERR;
NSCAssert(NO,@"Unattended PAM message Style PAM_BINARY_PROMPT");
break;
default:
// Must be an error of some sort...
free(response);
retStatus=PAM_CONV_ERR;
NSCAssert1(NO,@"Unattended PAM message Style %d",msg[i]->msg_style);
break;
};
};
*resp=response;
retStatus=[((GSPam*)appdata_ptr) processMessages:msg
withMessagesNb:num_msg
withResponse:response];
};
return retStatus;
};


//====================================================================
@implementation GSPam

//--------------------------------------------------------------------
+(id)pam
{
return [[self new]autorelease];
};

//--------------------------------------------------------------------
+(id)pamWithServiceName:(NSString*)serviceName
{
return [[[self alloc]initWithServiceName:serviceName]
autorelease];
};

//--------------------------------------------------------------------
+(id)pamWithServiceName:(NSString*)serviceName
user:(NSString*)user
password:(NSString*)password
{
return [[[self alloc]initWithServiceName:serviceName
user:user
password:password]
autorelease];
};

//--------------------------------------------------------------------
-(id)init
{
if ((self=[super init]))
{
memset(&_pamConv,0,sizeof(_pamConv));
_pamConv.conv=&pam_exchange;
_pamConv.appdata_ptr=(void*)self;
};
return self;
};

//--------------------------------------------------------------------
-(id)initWithServiceName:(NSString*)serviceName
{
if ((self=[self init]))
{
[self setServiceName:serviceName];
};
return self;
};

//--------------------------------------------------------------------
-(id)initWithServiceName:(NSString*)serviceName
user:(NSString*)user
password:(NSString*)password
{
if ((self=[self initWithServiceName:serviceName]))
{
[self setUser:user];
[self setPassword:password];
};
return self;
};

//--------------------------------------------------------------------
-(void)dealloc
{
// GSWLogC("Dealloc GSPam");
[self endWithStatus:-1];
DESTROY(_serviceName);
DESTROY(_user);
DESTROY(_password);
DESTROY(_lastErrorMessage);
// GSWLogC("Dealloc GSPam Super");
[super dealloc];
// GSWLogC("End Dealloc GSPam");
};

//--------------------------------------------------------------------
-(void)assignLastErrorMessage
{
DESTROY(_lastErrorMessage);
if (_lastStatus!=PAM_SUCCESS)
{
ASSIGN(_lastErrorMessage,[NSString stringWithCString:pam_strerror(_pamHandle,_lastStatus)]);
};
};

//--------------------------------------------------------------------
-(int)processMessages:(const struct pam_message**)messages
withMessagesNb:(int)numMessages
withResponse:(struct pam_response*)responses
{
int retStatus=PAM_SUCCESS;
int i=0;
for(i=0;i<numMessages;i++)
{
responses[i].resp_retcode=PAM_SUCCESS;
switch(messages[i]->msg_style)
{
case PAM_PROMPT_ECHO_ON:
NSDebugMLog(@"PAM Message #%d: PAM_PROMPT_ECHO_ON return: %@",i,[self user]);
responses[i].resp=strdup([[self user] cString]);
NSDebugMLog(@"==>%s",responses[i]);
// PAM frees resp
break;
case PAM_PROMPT_ECHO_OFF:
NSDebugMLog(@"PAM Message #%d: PAM_PROMPT_ECHO_OFF return: %@",i,[self password]);
responses[i].resp=strdup([[self password] cString]);
NSDebugMLog(@"==>%s",responses[i]);
// PAM frees resp
break;
case PAM_TEXT_INFO:
case PAM_ERROR_MSG:
NSLog(@"PAM Ignore Message: %s",messages[i]->msg);
// ignore it, but pam still wants a NULL response...
responses[i].resp = NULL;
NSDebugMLog(@"==>%s",responses[i]);
break;
default:
NSAssert1(NO,@"Unknown PAM message Style: %d",(int)messages[i]->msg_style);
retStatus=PAM_CONV_ERR;
break;
};
};
return retStatus;
};

//--------------------------------------------------------------------
-(void)setServiceName:(NSString*)serviceName
{
ASSIGN(_serviceName,serviceName);
};

//--------------------------------------------------------------------
-(void)setUser:(NSString*)user
{
ASSIGN(_user,user);
};

//--------------------------------------------------------------------
-(void)setPassword:(NSString*)password
{
ASSIGN(_password,password);
};

//--------------------------------------------------------------------
-(NSString*)serviceName
{
return _serviceName;
};

//--------------------------------------------------------------------
-(NSString*)user
{
return _user;
};

//--------------------------------------------------------------------
-(NSString*)password
{
return _password;
};

//--------------------------------------------------------------------
-(int)status
{
return _lastStatus;
};

//--------------------------------------------------------------------
-(NSString*)errorMessage
{
return _lastErrorMessage;
};

//--------------------------------------------------------------------
-(BOOL)start
{
_lastStatus=PAM_SUCCESS;
if (_pamHandle)
{
[self endWithStatus:-1];
};
NSLog(@"PAM start: serviceName: [%@] user: [%@]",[self serviceName],[self user]);
_lastStatus=pam_start([[self serviceName] cString],
[[self user] cString],
&_pamConv,
&_pamHandle);
[self assignLastErrorMessage];
return (_lastStatus==PAM_SUCCESS);
};

//--------------------------------------------------------------------
-(BOOL)end
{
return [self endWithStatus:PAM_SUCCESS];
}

//--------------------------------------------------------------------
-(BOOL)endWithStatus:(int)status
{
_lastStatus=PAM_SUCCESS;
if (_pamHandle)
{
_lastStatus=pam_end(_pamHandle,status);
_pamHandle=NULL;
};
[self assignLastErrorMessage];
return (_lastStatus==PAM_SUCCESS);
};

//--------------------------------------------------------------------
/*
PAM_DISALLOW_NULL_AUTHTOK
Instruct the authentication modules to return PAM_AUTH_ERR if the user does not have a registered authorization token---it is set to NULL in the system database.
*/
-(BOOL)authenticateWithFlag:(int)flag
silent:(BOOL)silentFlag
{
_lastStatus=PAM_SUCCESS;
if (silentFlag)
flag|=PAM_SILENT;
NSLog(@"PAM pam_authenticate: serviceName: [%@] user: [%@] lastStatus=%d",
[self serviceName],
[self user],
_lastStatus);
_lastStatus=pam_authenticate(_pamHandle,flag);
NSLog(@"PAM pam_authenticate: lastStatus=%d",
_lastStatus);
[self assignLastErrorMessage];
return (_lastStatus==PAM_SUCCESS);

};


//--------------------------------------------------------------------
/*
PAM_DISALLOW_NULL_AUTHTOK
Instruct the authentication modules to return PAM_AUTH_ERR if the user does not have a registered authorization token---it is set to NULL in the system database.
*/
-(BOOL)accountManagementWithFlag:(int)flag
silent:(BOOL)silentFlag
{
_lastStatus=PAM_SUCCESS;
if (silentFlag)
flag|=PAM_SILENT;
_lastStatus=pam_acct_mgmt(_pamHandle,flag);
[self assignLastErrorMessage];
return (_lastStatus==PAM_SUCCESS);

};

//--------------------------------------------------------------------
-(BOOL)openSessionSilently:(BOOL)silentFlag
{
int flag=0;
_lastStatus=PAM_SUCCESS;
if (silentFlag)
flag|=PAM_SILENT;
_lastStatus=pam_open_session(_pamHandle,flag);
[self assignLastErrorMessage];
return (_lastStatus==PAM_SUCCESS);

};

//--------------------------------------------------------------------
-(BOOL)closeSessionSilently:(BOOL)silentFlag
{
int flag=0;
_lastStatus=PAM_SUCCESS;
if (silentFlag)
flag|=PAM_SILENT;
_lastStatus=pam_close_session(_pamHandle,flag);
[self assignLastErrorMessage];
return (_lastStatus==PAM_SUCCESS);
};

@end
gnustep-gscrypt-r31301/GSRC4.h000064400000000000000000000031251227735665100160730ustar00rootroot00000000000000/* GSRC4.h - GSCrypt: Class GSRC4
Copyright (C) 2000 Free Software Foundation, Inc.

Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Mar 2000

This file is part of the GNUstep GSCrypt Library.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

// $Id$

#ifndef _GSRC4_h__
#define _GSRC4_h__

#include <gscrypt/GSCryptCommon.h>

@interface GSRC4: NSObject<GSCrypting,GSByteStreaming,GSStreamCyphering>
{
// protected:
NSMutableData* state;
BYTE x;
BYTE y;
BOOL m_fInit;
};
+(id)rc4WithKey:(NSData*)key;
-(id)init;
-(id)initWithKey:(NSData*)key;//GSCrypting
-(BYTE)streamByte; //GSByteStreaming
-(BYTE)cypherByte:(BYTE)input_;//GSStreamCyphering
-(NSData*)crypt:(NSData*)dataIn_;//GSCrypting
-(NSData*)decrypt:(NSData*)dataIn_;//GSCrypting
+(UINT)keyMinSize;//GSCrypting
+(UINT)keyMaxSize;//GSCrypting
+(UINT)blockSize;//GSCrypting
#ifdef DEBUG
+(BOOL)debugTest;
#endif
@end

#endif // _GSRC4_h__
gnustep-gscrypt-r31301/GSRC4.m000064400000000000000000000272231227735665100161050ustar00rootroot00000000000000/* GSRC4.m - GSCrypt: Class GSRC4
Copyright (C) 2000 Free Software Foundation, Inc.

Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Mar 2000

This file is part of the GNUstep GSCrypt Library.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

// $Id$

#include <gscrypt/GSRC4.h>

@implementation GSRC4

//--------------------------------------------------------------------
+(id)rc4WithKey:(NSData*)key
{
return [[[self alloc]initWithKey:key]autorelease];
};

//--------------------------------------------------------------------
-(id)init
{
if ((self=[super init]))
{
};
return self;
};

//--------------------------------------------------------------------
-(id)initWithKey:(NSData*)key
{
NSAssert([key length]>0,@"No Key or empty key");
if ((self=[self init]))
{
BYTE* stateBytes=NULL;
UINT16 counter=0;
short keyLength=[key length];
const BYTE* keyBytes=[key bytes];
BYTE index1 = 0;
BYTE index2 = 0;
ASSIGN(state,[NSMutableData dataWithLength:256]);
stateBytes=[state mutableBytes];
NSLog(@"Key Length=%d",keyLength);
for (counter=0;counter<256;counter++)
stateBytes[counter]=(BYTE)counter;
x = 0;
y = 0;

for (counter=0;counter<256;counter++)
{
NSAssert(index1<keyLength,@"Pb");
index2 = (keyBytes[index1]+stateBytes[counter]+index2);
NSAssert(index2<256,@"Pb");
Swap(stateBytes[counter],stateBytes[index2]);
index1 =(index1+1)%keyLength;
};
};
return self;
};

//--------------------------------------------------------------------
-(BYTE)streamByte //GSByteStreaming
{
BYTE* stateBytes=[state mutableBytes];
NSAssert(state,@"Not initialized");
x++;
y+=stateBytes[x];
Swap(stateBytes[x],stateBytes[y]);
return (stateBytes[(stateBytes[x]+stateBytes[y])&255]);
};

//--------------------------------------------------------------------
-(BYTE)cypherByte:(BYTE)input_//GSStreamCyphering
{
return (input_^[self streamByte]);
};

//--------------------------------------------------------------------
-(NSData*)crypt:(NSData*)dataIn_
{
return [self cypherBuffer:dataIn_];
};

//--------------------------------------------------------------------
-(NSData*)decrypt:(NSData*)dataIn_//GSCrypting
{
return [self cypherBuffer:dataIn_];
};

//--------------------------------------------------------------------
+(UINT)keyMinSize //GSCrypting
{
return 1;
};

//--------------------------------------------------------------------
+(UINT)keyMaxSize //GSCrypting
{
return 256;
};

//--------------------------------------------------------------------
+(UINT)blockSize //GSCrypting
{
return 1;
};


#ifdef DEBUG
//--------------------------------------------------------------------
+(BOOL)debugTest
{
BOOL ok=YES;
BYTE keyBytes0[]={0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef};
BYTE keyBytes1[]={0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef};
BYTE keyBytes2[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
BYTE keyBytes3[]={0xef,0x01,0x23,0x45};
BYTE keyBytes4[]={ 0x01,0x23,0x45,0x67,0x89,0xab, 0xcd,0xef};
NSData* keyData[5]= { [NSData dataWithBytes:keyBytes0
length:sizeof(keyBytes0)],
[NSData dataWithBytes:keyBytes1
length:sizeof(keyBytes1)],
[NSData dataWithBytes:keyBytes2
length:sizeof(keyBytes2)],
[NSData dataWithBytes:keyBytes3
length:sizeof(keyBytes3)],
[NSData dataWithBytes:keyBytes4
length:sizeof(keyBytes4)]};
BYTE inputBytes0[]={0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef};
BYTE inputBytes1[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
BYTE inputBytes2[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
BYTE inputBytes3[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
BYTE inputBytes4[]={
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01};
NSData* inputData[5]= { [NSData dataWithBytes:inputBytes0
length:sizeof(inputBytes0)],
[NSData dataWithBytes:inputBytes1
length:sizeof(inputBytes1)],
[NSData dataWithBytes:inputBytes2
length:sizeof(inputBytes2)],
[NSData dataWithBytes:inputBytes3
length:sizeof(inputBytes3)],
[NSData dataWithBytes:inputBytes4
length:sizeof(inputBytes4)]};
BYTE outputBytes0[]= {0x75,0xb7,0x87,0x80,0x99,0xe0,0xc5,0x96};
BYTE outputBytes1[]= {0x74,0x94,0xc2,0xe7,0x10,0x4b,0x08,0x79};
BYTE outputBytes2[]= {0xde,0x18,0x89,0x41,0xa3,0x37,0x5d,0x3a};
BYTE outputBytes3[]= {0xd6,0xa1,0x41,0xa7,0xec,0x3c,0x38,0xdf,0xbd,0x61};
BYTE outputBytes4[]= {
0x75,0x95,0xc3,0xe6,0x11,0x4a,0x09,0x78,0x0c,0x4a,0xd4,
0x52,0x33,0x8e,0x1f,0xfd,0x9a,0x1b,0xe9,0x49,0x8f,
0x81,0x3d,0x76,0x53,0x34,0x49,0xb6,0x77,0x8d,0xca,
0xd8,0xc7,0x8a,0x8d,0x2b,0xa9,0xac,0x66,0x08,0x5d,
0x0e,0x53,0xd5,0x9c,0x26,0xc2,0xd1,0xc4,0x90,0xc1,
0xeb,0xbe,0x0c,0xe6,0x6d,0x1b,0x6b,0x1b,0x13,0xb6,
0xb9,0x19,0xb8,0x47,0xc2,0x5a,0x91,0x44,0x7a,0x95,
0xe7,0x5e,0x4e,0xf1,0x67,0x79,0xcd,0xe8,0xbf,0x0a,
0x95,0x85,0x0e,0x32,0xaf,0x96,0x89,0x44,0x4f,0xd3,
0x77,0x10,0x8f,0x98,0xfd,0xcb,0xd4,0xe7,0x26,0x56,
0x75,0x00,0x99,0x0b,0xcc,0x7e,0x0c,0xa3,0xc4,0xaa,
0xa3,0x04,0xa3,0x87,0xd2,0x0f,0x3b,0x8f,0xbb,0xcd,
0x42,0xa1,0xbd,0x31,0x1d,0x7a,0x43,0x03,0xdd,0xa5,
0xab,0x07,0x88,0x96,0xae,0x80,0xc1,0x8b,0x0a,0xf6,
0x6d,0xff,0x31,0x96,0x16,0xeb,0x78,0x4e,0x49,0x5a,
0xd2,0xce,0x90,0xd7,0xf7,0x72,0xa8,0x17,0x47,0xb6,
0x5f,0x62,0x09,0x3b,0x1e,0x0d,0xb9,0xe5,0xba,0x53,
0x2f,0xaf,0xec,0x47,0x50,0x83,0x23,0xe6,0x71,0x32,
0x7d,0xf9,0x44,0x44,0x32,0xcb,0x73,0x67,0xce,0xc8,
0x2f,0x5d,0x44,0xc0,0xd0,0x0b,0x67,0xd6,0x50,0xa0,
0x75,0xcd,0x4b,0x70,0xde,0xdd,0x77,0xeb,0x9b,0x10,
0x23,0x1b,0x6b,0x5b,0x74,0x13,0x47,0x39,0x6d,0x62,
0x89,0x74,0x21,0xd4,0x3d,0xf9,0xb4,0x2e,0x44,0x6e,
0x35,0x8e,0x9c,0x11,0xa9,0xb2,0x18,0x4e,0xcb,0xef,
0x0c,0xd8,0xe7,0xa8,0x77,0xef,0x96,0x8f,0x13,0x90,
0xec,0x9b,0x3d,0x35,0xa5,0x58,0x5c,0xb0,0x09,0x29,
0x0e,0x2f,0xcd,0xe7,0xb5,0xec,0x66,0xd9,0x08,0x4b,
0xe4,0x40,0x55,0xa6,0x19,0xd9,0xdd,0x7f,0xc3,0x16,
0x6f,0x94,0x87,0xf7,0xcb,0x27,0x29,0x12,0x42,0x64,
0x45,0x99,0x85,0x14,0xc1,0x5d,0x53,0xa1,0x8c,0x86,
0x4c,0xe3,0xa2,0xb7,0x55,0x57,0x93,0x98,0x81,0x26,
0x52,0x0e,0xac,0xf2,0xe3,0x06,0x6e,0x23,0x0c,0x91,
0xbe,0xe4,0xdd,0x53,0x04,0xf5,0xfd,0x04,0x05,0xb3,
0x5b,0xd9,0x9c,0x73,0x13,0x5d,0x3d,0x9b,0xc3,0x35,
0xee,0x04,0x9e,0xf6,0x9b,0x38,0x67,0xbf,0x2d,0x7b,
0xd1,0xea,0xa5,0x95,0xd8,0xbf,0xc0,0x06,0x6f,0xf8,
0xd3,0x15,0x09,0xeb,0x0c,0x6c,0xaa,0x00,0x6c,0x80,
0x7a,0x62,0x3e,0xf8,0x4c,0x3d,0x33,0xc1,0x95,0xd2,
0x3e,0xe3,0x20,0xc4,0x0d,0xe0,0x55,0x81,0x57,0xc8,
0x22,0xd4,0xb8,0xc5,0x69,0xd8,0x49,0xae,0xd5,0x9d,
0x4e,0x0f,0xd7,0xf3,0x79,0x58,0x6b,0x4b,0x7f,0xf6,
0x84,0xed,0x6a,0x18,0x9f,0x74,0x86,0xd4,0x9b,0x9c,
0x4b,0xad,0x9b,0xa2,0x4b,0x96,0xab,0xf9,0x24,0x37,
0x2c,0x8a,0x8f,0xff,0xb1,0x0d,0x55,0x35,0x49,0x00,
0xa7,0x7a,0x3d,0xb5,0xf2,0x05,0xe1,0xb9,0x9f,0xcd,
0x86,0x60,0x86,0x3a,0x15,0x9a,0xd4,0xab,0xe4,0x0f,
0xa4,0x89,0x34,0x16,0x3d,0xdd,0xe5,0x42,0xa6,0x58,
0x55,0x40,0xfd,0x68,0x3c,0xbf,0xd8,0xc0,0x0f,0x12,
0x12,0x9a,0x28,0x4d,0xea,0xcc,0x4c,0xde,0xfe,0x58,
0xbe,0x71,0x37,0x54,0x1c,0x04,0x71,0x26,0xc8,0xd4,
0x9e,0x27,0x55,0xab,0x18,0x1a,0xb7,0xe9,0x40,0xb0,
0xc0};
NSData* outputData[5]= { [NSData dataWithBytes:outputBytes0
length:sizeof(outputBytes0)],
[NSData dataWithBytes:outputBytes1
length:sizeof(outputBytes1)],
[NSData dataWithBytes:outputBytes2
length:sizeof(outputBytes2)],
[NSData dataWithBytes:outputBytes3
length:sizeof(outputBytes3)],
[NSData dataWithBytes:outputBytes4
length:sizeof(outputBytes4)]};
BOOL fail=NO;
int i;
NSLog(@"RC4 Test...");
TestEndianess();
for(i=0;i<5;i++)
{
GSRC4* rc4=[GSRC4 rc4WithKey:keyData[i]];
NSData* in=inputData[i];
NSData* out=outputData[i];
NSData* resultOutput=[rc4 crypt:in];
NSString* outString=[DataToHexString(out)uppercaseString];
NSString* resultOutputString=[DataToHexString(resultOutput)uppercaseString];
fail=![resultOutput isEqualToData:out];
if (fail)
{
NSLog(@"RC4 Test %d FAILED: result=%@ len=%d instead of %@ len=%d",
i,
resultOutputString,
[resultOutput length],
outString,
[out length]);
ok=NO;
}
else
{
NSLog(@"RC4 Test %d PASSED",i);
};
};
NSLog(@"RC4 Tests %s",(ok ? "PASSED" : "FAILED"));
NSAssert(ok,@"RC4 Tests Failed");
return ok;
};
#endif

@end
gnustep-gscrypt-r31301/Makefile.postamble000064400000000000000000000036661227735665100205370ustar00rootroot00000000000000# Makefile.postamble
#
# Copyright (C) 2000 Free Software Foundation, Inc.
#
# Written by: Manuel Guesdon <mguesdon@orange-concept.com>
# Date: Mar 2000
#
# This file is part of the GNUstep GSCrypt Library.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

# ====================================================================
# Project specific makefile rules
#
# Uncomment the targets you want.
# The double colons (::) are important, do not make them single colons
# otherwise the normal makefile rules will not be performed.
# ====================================================================


# Things to do before compiling
# before-all::

# Things to do after compiling
# after-all::

# Things to do before installing
# before-install::

# Things to do after installing
# after-install::

# Things to do before uninstalling
# before-uninstall::

# Things to do after uninstalling
# after-uninstall::

# Things to do before cleaning
# before-clean::

# Things to do after cleaning
# after-clean::

# Things to do before distcleaning
# before-distclean::

# Things to do after distcleaning
# after-distclean::

# Things to do before checking
# before-check::

# Things to do after checking
# after-check::

regenerate:

copy-dist: $(DIST_FILES)
gnustep-gscrypt-r31301/Makefile.preamble000064400000000000000000000036401227735665100203300ustar00rootroot00000000000000# Makefile.preamble
#
# Copyright (C) 2000 Free Software Foundation, Inc.
#
# Written by: Manuel Guesdon <mguesdon@orange-concept.com>
# Date: Mar 2000
#
# This file is part of the GNUstep GSCrypt Library.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# ====================================================================
# Project specific makefile variables, and additional
#
# Do not put any Makefile rules in this file, instead they should
# be put into Makefile.postamble.
# ====================================================================

#
# Flags dealing with compiling and linking
#

# Additional flags to pass to the preprocessor
ADDITIONAL_CPPFLAGS =

# Additional flags to pass to the Objective-C compiler
ADDITIONAL_OBJCFLAGS =

# Additional flags to pass to the C compiler
ADDITIONAL_CFLAGS =

# Additional include directories the compiler should search
ADDITIONAL_INCLUDE_DIRS = -I../

# Additional LDFLAGS to pass to the linker
ADDITIONAL_LDFLAGS = -lpam

# Additional library directories the linker should search
ADDITIONAL_LIB_DIRS = -L../src/$(GNUSTEP_OBJ_DIR)

#
# Flags dealing with installing and uninstalling
#

# Additional directories to be created during installation
ADDITIONAL_INSTALL_DIRS =

 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009