add cryptlib, update VC6 and VC7 projects

This commit is contained in:
Chris Danford
2004-02-14 09:53:07 +00:00
parent 15c5d3eb26
commit c1daa4ca1b
6 changed files with 159 additions and 26 deletions
+62
View File
@@ -0,0 +1,62 @@
#include "sha.h"
#include "files.h"
#include "hex.h"
#include "channels.h"
#include "rsa.h"
#include "md5.h"
#include <memory>
/* Pull in crypt library here. */
#ifdef _XBOX
// FIXME
#elif defined _WINDOWS
#ifdef DEBUG
#pragma comment(lib, "crypto51/cryptlibd.lib")
#else
#pragma comment(lib, "crypto51/cryptlib.lib")
#endif
#endif
using namespace CryptoPP;
using namespace std;
void RSASignFile(const char *privFilename, const char *messageFilename, const char *signatureFilename)
{
FileSource privFile(privFilename, true, new HexDecoder);
RSASSA_PKCS1v15_SHA_Signer priv(privFile);
// RSASSA_PKCS1v15_SHA_Signer ignores the rng. Use a real RNG for other signature schemes!
FileSource f(messageFilename, true, new SignerFilter(NullRNG(), priv, new HexEncoder(new FileSink(signatureFilename))));
}
bool RSAVerifyFile(const char *pubFilename, const char *messageFilename, const char *signatureFilename)
{
FileSource pubFile(pubFilename, true, new HexDecoder);
RSASSA_PKCS1v15_SHA_Verifier pub(pubFile);
FileSource signatureFile(signatureFilename, true, new HexDecoder);
if (signatureFile.MaxRetrievable() != pub.SignatureLength())
return false;
SecByteBlock signature(pub.SignatureLength());
signatureFile.Get(signature, signature.size());
VerifierFilter *verifierFilter = new VerifierFilter(pub);
verifierFilter->Put(signature, pub.SignatureLength());
FileSource f(messageFilename, true, verifierFilter);
return verifierFilter->GetLastResult();
}
void DigestFile(const char *filename)
{
MD5 md5;
HashFilter md5Filter(md5);
auto_ptr<ChannelSwitch> channelSwitch(new ChannelSwitch);
channelSwitch->AddDefaultRoute(md5Filter);
FileSource(filename, true, channelSwitch.release());
HexEncoder encoder(new FileSink(cout), false);
cout << "\nMD5: ";
md5Filter.TransferTo(encoder);
}
+6
View File
@@ -0,0 +1,6 @@
#ifndef CryptHelpers_H
#define CryptHelpers_H
#endif
+51 -24
View File
@@ -1,5 +1,5 @@
# Microsoft Developer Studio Project File - Name="StepMania" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# Microsoft Developer Studio Generated Build File, Format Version 60000
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
@@ -45,7 +45,7 @@ CFG=StepMania - Win32 Release
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /MD /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "DEBUG" /Fr /YX"global.h" /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.6\include" /I "SDL_image-1.2" /I "SDL_net-1.2.5\include" /I "vorbis" /I "libjpeg" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "DEBUG" /FR /YX"global.h" /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.6\include" /I "SDL_image-1.2" /I "SDL_net-1.2.5\include" /I "vorbis" /I "libjpeg" /I "crypto51" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "DEBUG" /FR /YX"global.h" /FD /c
MTL=midl.exe
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
@@ -58,11 +58,11 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 $(intdir)\verstub.obj kernel32.lib shell32.lib user32.lib gdi32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe"
# SUBTRACT BASE LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
# ADD LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /map /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"../Program/StepMania-debug.exe"
# ADD LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /map /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"../../itg/Program/StepMania-debug.exe"
# SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
# Begin Special Build Tool
IntDir=.\../Debug6
TargetDir=\temp\stepmania\Program
TargetDir=\stepmania\itg\Program
TargetName=StepMania-debug
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
@@ -99,6 +99,10 @@ XBCP=xbecopy.exe
# ADD BASE XBCP /NOLOGO
# ADD XBCP /NOLOGO
# Begin Special Build Tool
IntDir=.\../Debug_Xbox
TargetDir=\stepmania\stepmania
TargetName=default
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool
@@ -135,7 +139,7 @@ LINK32=link.exe
# SUBTRACT LINK32 /verbose /pdb:none /debug
# Begin Special Build Tool
IntDir=.\../Release6
TargetDir=\temp\stepmania\Program
TargetDir=\stepmania\stepmania\Program
TargetName=StepMania
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
@@ -174,6 +178,10 @@ XBCP=xbecopy.exe
# ADD BASE XBCP /NOLOGO
# ADD XBCP /NOLOGO
# Begin Special Build Tool
IntDir=.\../Release_Xbox
TargetDir=\stepmania\stepmania
TargetName=default
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool
@@ -1161,6 +1169,25 @@ SOURCE=.\Course.h
# End Source File
# Begin Source File
SOURCE=.\CryptHelpers.cpp
!IF "$(CFG)" == "StepMania - Win32 Debug"
!ELSEIF "$(CFG)" == "StepMania - Xbox Debug"
!ELSEIF "$(CFG)" == "StepMania - Win32 Release"
!ELSEIF "$(CFG)" == "StepMania - Xbox Release"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\CryptHelpers.h
# End Source File
# Begin Source File
SOURCE=.\Font.cpp
!IF "$(CFG)" == "StepMania - Win32 Debug"
@@ -3177,6 +3204,25 @@ SOURCE=.\BGAnimationLayer.h
# End Source File
# Begin Source File
SOURCE=.\ConditionalBGA.cpp
!IF "$(CFG)" == "StepMania - Win32 Debug"
!ELSEIF "$(CFG)" == "StepMania - Xbox Debug"
!ELSEIF "$(CFG)" == "StepMania - Win32 Release"
!ELSEIF "$(CFG)" == "StepMania - Xbox Release"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\ConditionalBGA.h
# End Source File
# Begin Source File
SOURCE=.\DifficultyIcon.cpp
!IF "$(CFG)" == "StepMania - Win32 Debug"
@@ -6055,25 +6101,6 @@ SOURCE=.\UnlockSystem.h
# End Group
# Begin Source File
SOURCE=.\ConditionalBGA.cpp
!IF "$(CFG)" == "StepMania - Win32 Debug"
!ELSEIF "$(CFG)" == "StepMania - Xbox Debug"
!ELSEIF "$(CFG)" == "StepMania - Win32 Release"
!ELSEIF "$(CFG)" == "StepMania - Xbox Release"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\ConditionalBGA.h
# End Source File
# Begin Source File
SOURCE=.\cursor1.cur
# End Source File
# Begin Source File
+15
View File
@@ -9,6 +9,21 @@ Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name cryptlib
End Project Dependency
}}}
###############################################################################
Project: "cryptlib"=.\crypto51\cryptlib.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
+18 -1
View File
@@ -1,18 +1,35 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StepMania", "StepMania.vcproj", "{670745A6-106B-420D-A2A9-D4F89A23986E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cryptlib", "crypto51\cryptlib.vcproj", "{E34673D6-55FA-45C9-933A-FDD68CCD785F}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
ConfigName.1 = FIPS 140 Debug
ConfigName.2 = FIPS 140 Release
ConfigName.3 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
{670745A6-106B-420D-A2A9-D4F89A23986E}.0 = {E34673D6-55FA-45C9-933A-FDD68CCD785F}
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{670745A6-106B-420D-A2A9-D4F89A23986E}.Debug.ActiveCfg = Debug|Win32
{670745A6-106B-420D-A2A9-D4F89A23986E}.Debug.Build.0 = Debug|Win32
{670745A6-106B-420D-A2A9-D4F89A23986E}.FIPS 140 Debug.ActiveCfg = Debug|Win32
{670745A6-106B-420D-A2A9-D4F89A23986E}.FIPS 140 Debug.Build.0 = Debug|Win32
{670745A6-106B-420D-A2A9-D4F89A23986E}.FIPS 140 Release.ActiveCfg = Release|Win32
{670745A6-106B-420D-A2A9-D4F89A23986E}.FIPS 140 Release.Build.0 = Release|Win32
{670745A6-106B-420D-A2A9-D4F89A23986E}.Release.ActiveCfg = Release|Win32
{670745A6-106B-420D-A2A9-D4F89A23986E}.Release.Build.0 = Release|Win32
{E34673D6-55FA-45C9-933A-FDD68CCD785F}.Debug.ActiveCfg = Debug|Win32
{E34673D6-55FA-45C9-933A-FDD68CCD785F}.Debug.Build.0 = Debug|Win32
{E34673D6-55FA-45C9-933A-FDD68CCD785F}.FIPS 140 Debug.ActiveCfg = FIPS 140 Debug|Win32
{E34673D6-55FA-45C9-933A-FDD68CCD785F}.FIPS 140 Debug.Build.0 = FIPS 140 Debug|Win32
{E34673D6-55FA-45C9-933A-FDD68CCD785F}.FIPS 140 Release.ActiveCfg = FIPS 140 Release|Win32
{E34673D6-55FA-45C9-933A-FDD68CCD785F}.FIPS 140 Release.Build.0 = FIPS 140 Release|Win32
{E34673D6-55FA-45C9-933A-FDD68CCD785F}.Release.ActiveCfg = Release|Win32
{E34673D6-55FA-45C9-933A-FDD68CCD785F}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
DPBuild = 5
+7 -1
View File
@@ -99,7 +99,7 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
FavorSizeOrSpeed="2"
OptimizeForProcessor="2"
OptimizeForWindowsApplication="TRUE"
AdditionalIncludeDirectories=".,SDL-1.2.6/include,SDL_image-1.2,vorbis,libjpeg"
AdditionalIncludeDirectories=".,SDL-1.2.6/include,SDL_image-1.2,vorbis,libjpeg,crypto51"
PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS,RELEASE"
StringPooling="TRUE"
MinimalRebuild="FALSE"
@@ -554,6 +554,12 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File
RelativePath="Course.h">
</File>
<File
RelativePath="CryptHelpers.cpp">
</File>
<File
RelativePath="CryptHelpers.h">
</File>
<File
RelativePath=".\Font.cpp">
</File>