mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 15:47:51 +02:00
Move hash algorithms that rely on fcl-base
(cherry picked from commit 82fdbbbbdc
)
This commit is contained in:
parent
f6e7ee1212
commit
ebe6affcf6
3268
packages/fcl-hash/Makefile
Normal file
3268
packages/fcl-hash/Makefile
Normal file
File diff suppressed because it is too large
Load Diff
128
packages/fcl-hash/Makefile.fpc
Normal file
128
packages/fcl-hash/Makefile.fpc
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
#
|
||||||
|
# Makefile.fpc for running fpmake
|
||||||
|
#
|
||||||
|
|
||||||
|
[package]
|
||||||
|
name=fcl-hash
|
||||||
|
version=3.3.1
|
||||||
|
|
||||||
|
[require]
|
||||||
|
packages=rtl fcl-base rtl-extra rtl-objpas
|
||||||
|
|
||||||
|
[install]
|
||||||
|
fpcpackage=y
|
||||||
|
|
||||||
|
[default]
|
||||||
|
fpcdir=../..
|
||||||
|
|
||||||
|
[prerules]
|
||||||
|
FPMAKE_BIN_CLEAN=$(wildcard ./fpmake$(SRCEXEEXT))
|
||||||
|
ifdef OS_TARGET
|
||||||
|
FPC_TARGETOPT+=--os=$(OS_TARGET)
|
||||||
|
endif
|
||||||
|
ifdef CPU_TARGET
|
||||||
|
FPC_TARGETOPT+=--cpu=$(CPU_TARGET)
|
||||||
|
endif
|
||||||
|
LOCALFPMAKE=./fpmake$(SRCEXEEXT)
|
||||||
|
# Adding a dependency on fpmkunit is not possbile due to an infinite loop. So
|
||||||
|
# the fpmkunit-searchpath is added here:
|
||||||
|
PACKAGEDIR_FPMKUNIT:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fpmkunit/Makefile.fpc,$(PACKAGESDIR))))))
|
||||||
|
ifneq ($(PACKAGEDIR_FPMKUNIT),)
|
||||||
|
ifneq ($(wildcard $(PACKAGEDIR_FPMKUNIT)/units_bs/$(SOURCESUFFIX)),)
|
||||||
|
UNITDIR_FPMAKE_FPMKUNIT=$(PACKAGEDIR_FPMKUNIT)/units_bs/$(SOURCESUFFIX)
|
||||||
|
else
|
||||||
|
UNITDIR_FPMAKE_FPMKUNIT=$(PACKAGEDIR_FPMKUNIT)
|
||||||
|
endif
|
||||||
|
ifdef CHECKDEPEND
|
||||||
|
$(PACKAGEDIR_FPMKUNIT)/$(FPCMADE):
|
||||||
|
$(MAKE) -C $(PACKAGEDIR_FPMKUNIT) $(FPCMADE)
|
||||||
|
override ALLDEPENDENCIES+=$(PACKAGEDIR_FPMKUNIT)/$(FPCMADE)
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
PACKAGEDIR_FPMKUNIT=
|
||||||
|
UNITDIR_FPMKUNIT:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fpmkunit/Package.fpc,$(UNITSDIR)))))
|
||||||
|
ifneq ($(UNITDIR_FPMKUNIT),)
|
||||||
|
UNITDIR_FPMKUNIT:=$(firstword $(UNITDIR_FPMKUNIT))
|
||||||
|
else
|
||||||
|
UNITDIR_FPMKUNIT=
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifdef UNITDIR_FPMAKE_FPMKUNIT
|
||||||
|
override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_FPMKUNIT)
|
||||||
|
endif
|
||||||
|
|
||||||
|
[rules]
|
||||||
|
# Do not pass the Makefile's unit and binary target locations. Fpmake uses it's own.
|
||||||
|
override FPCOPT:=$(filter-out -FU%,$(FPCOPT))
|
||||||
|
override FPCOPT:=$(filter-out -FE%,$(FPCOPT))
|
||||||
|
# Do not pass the package-unitdirectories. Fpmake adds those and this way they don't apear in the .fpm
|
||||||
|
override FPCOPT:=$(filter-out $(addprefix -Fu,$(COMPILER_UNITDIR)),$(FPCOPT))# Compose general fpmake-parameters
|
||||||
|
# Compose general fpmake-parameters
|
||||||
|
ifdef FPMAKEOPT
|
||||||
|
FPMAKE_OPT+=$(FPMAKEOPT)
|
||||||
|
endif
|
||||||
|
FPMAKE_OPT+=--localunitdir=../..
|
||||||
|
FPMAKE_OPT+=--globalunitdir=..
|
||||||
|
FPMAKE_OPT+=$(FPC_TARGETOPT)
|
||||||
|
FPMAKE_OPT+=$(addprefix -o ,$(FPCOPT))
|
||||||
|
FPMAKE_OPT+=--compiler=$(FPC)
|
||||||
|
FPMAKE_OPT+=-bu
|
||||||
|
.NOTPARALLEL:
|
||||||
|
|
||||||
|
fpmake$(SRCEXEEXT): fpmake.pp
|
||||||
|
$(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
|
||||||
|
all: fpmake$(SRCEXEEXT)
|
||||||
|
$(LOCALFPMAKE) compile $(FPMAKE_OPT)
|
||||||
|
smart: fpmake$(SRCEXEEXT)
|
||||||
|
$(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -XX -o -CX
|
||||||
|
release: fpmake$(SRCEXEEXT)
|
||||||
|
$(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dRELEASE
|
||||||
|
debug: fpmake$(SRCEXEEXT)
|
||||||
|
$(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dDEBUG
|
||||||
|
# If no fpmake exists and (dist)clean is called, do not try to build fpmake, it will
|
||||||
|
# most often fail because the dependencies are cleared.
|
||||||
|
# In case of a clean, simply do nothing
|
||||||
|
ifeq ($(FPMAKE_BIN_CLEAN),)
|
||||||
|
clean:
|
||||||
|
else
|
||||||
|
clean:
|
||||||
|
$(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT)
|
||||||
|
endif
|
||||||
|
# In case of a distclean, perform an 'old'-style distclean. This to avoid problems
|
||||||
|
# when the package is compiled using fpcmake prior to running this clean using fpmake
|
||||||
|
ifeq ($(FPMAKE_BIN_CLEAN),)
|
||||||
|
distclean: $(addsuffix _distclean,$(TARGET_DIRS)) fpc_cleanall
|
||||||
|
else
|
||||||
|
distclean:
|
||||||
|
ifdef inUnix
|
||||||
|
{ $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT); if [ $$? != "0" ]; then { echo Something wrong with fpmake exectable. Remove the executable and call make recursively to recover.; $(DEL) $(FPMAKE_BIN_CLEAN); $(MAKE) fpc_cleanall; }; fi; }
|
||||||
|
else
|
||||||
|
$(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT)
|
||||||
|
endif
|
||||||
|
-$(DEL) $(LOCALFPMAKE)
|
||||||
|
endif
|
||||||
|
cleanall: distclean
|
||||||
|
install: fpmake$(SRCEXEEXT)
|
||||||
|
ifdef UNIXHier
|
||||||
|
$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR)
|
||||||
|
else
|
||||||
|
$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --baseinstalldir=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR)
|
||||||
|
endif
|
||||||
|
# distinstall also installs the example-sources and omits the location of the source-
|
||||||
|
# files from the fpunits.cfg files.
|
||||||
|
distinstall: fpmake$(SRCEXEEXT)
|
||||||
|
ifdef UNIXHier
|
||||||
|
$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR) -ie -fsp 0
|
||||||
|
else
|
||||||
|
$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --baseinstalldir=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR) -ie -fsp 0
|
||||||
|
endif
|
||||||
|
zipinstall: fpmake$(SRCEXEEXT)
|
||||||
|
$(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX)
|
||||||
|
zipdistinstall: fpmake$(SRCEXEEXT)
|
||||||
|
$(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) -ie -fsp 0
|
||||||
|
zipsourceinstall: fpmake$(SRCEXEEXT)
|
||||||
|
ifdef UNIXHier
|
||||||
|
$(LOCALFPMAKE) archive $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) --prefix=share/src/fpc-\$$\(PACKAGEVERSION\)/$(INSTALL_FPCSUBDIR)/\$$\(PACKAGEDIRECTORY\)
|
||||||
|
else
|
||||||
|
$(LOCALFPMAKE) archive $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) --prefix=source\\$(INSTALL_FPCSUBDIR)\\\$$\(PACKAGEDIRECTORY\)
|
||||||
|
endif
|
58
packages/fcl-hash/fpmake.pp
Normal file
58
packages/fcl-hash/fpmake.pp
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
{$ifndef ALLPACKAGES}
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
program fpmake;
|
||||||
|
|
||||||
|
uses fpmkunit;
|
||||||
|
|
||||||
|
Var
|
||||||
|
P : TPackage;
|
||||||
|
T : TTarget;
|
||||||
|
begin
|
||||||
|
With Installer do
|
||||||
|
begin
|
||||||
|
{$endif ALLPACKAGES}
|
||||||
|
P:=AddPackage('fcl-hash');
|
||||||
|
|
||||||
|
{$ifdef ALLPACKAGES}
|
||||||
|
P.Directory:=ADirectory;
|
||||||
|
{$endif ALLPACKAGES}
|
||||||
|
|
||||||
|
P.Author := 'Free Pascal development team';
|
||||||
|
P.License := 'LGPL with modification, ';
|
||||||
|
P.HomepageURL := 'www.freepascal.org';
|
||||||
|
P.Email := '';
|
||||||
|
P.Description := 'Several hash and cryptography algorithms requiring classes.';
|
||||||
|
P.NeedLibC:= false;
|
||||||
|
P.OSes:=P.OSes-[embedded,win16,macosclassic,palmos,zxspectrum,msxdos,amstradcpc,sinclairql,msdos];
|
||||||
|
if Defaults.CPU=jvm then
|
||||||
|
P.OSes := P.OSes - [java,android];
|
||||||
|
|
||||||
|
P.Dependencies.Add('rtl-objpas');
|
||||||
|
P.Dependencies.Add('rtl-extra');
|
||||||
|
|
||||||
|
P.Version:='3.3.1';
|
||||||
|
T:=P.Targets.AddUnit('src/ecc.pp');
|
||||||
|
T:=P.Targets.AddUnit('src/hashutils.pp');
|
||||||
|
T.Dependencies.AddUnit('ecc');
|
||||||
|
T:=P.Targets.AddUnit('src/sha256.pp');
|
||||||
|
T.Dependencies.AddUnit('hashutils');
|
||||||
|
T:=P.Targets.AddUnit('src/sha512.pp');
|
||||||
|
T.Dependencies.AddUnit('hashutils');
|
||||||
|
T:=P.Targets.AddUnit('src/asn.pp');
|
||||||
|
T.Dependencies.AddUnit('hashutils');
|
||||||
|
T:=P.Targets.AddUnit('src/pem.pp');
|
||||||
|
T.Dependencies.AddUnit('hashutils');
|
||||||
|
T.Dependencies.AddUnit('asn');
|
||||||
|
T:=P.Targets.AddUnit('src/ecdsa.pp');
|
||||||
|
T.Dependencies.AddUnit('hashutils');
|
||||||
|
T.Dependencies.AddUnit('ecc');
|
||||||
|
T.Dependencies.AddUnit('sha256');
|
||||||
|
T:=P.Targets.AddUnit('src/onetimepass.pp');
|
||||||
|
|
||||||
|
T:=P.Targets.AddExampleunit('examples/demosha256.pp');
|
||||||
|
// md5.ref
|
||||||
|
{$ifndef ALLPACKAGES}
|
||||||
|
Run;
|
||||||
|
end;
|
||||||
|
end.
|
||||||
|
{$endif ALLPACKAGES}
|
@ -1,11 +1,11 @@
|
|||||||
{ %CONFIGFILE=fpcunit-console-defaults.ini testdefaults.ini }
|
{ %CONFIGFILE=fpcunit-console-defaults.ini testdefaults.ini }
|
||||||
|
|
||||||
program tests;
|
program testhash;
|
||||||
|
|
||||||
{$mode objfpc}
|
{$mode objfpc}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
consoletestrunner, UTestsHMAC, utestsha256, utestonetimepass, sha512, utestsha512, asn, ecc, pem, utestpem, ecdsa;
|
consoletestrunner, utestsha256, utestonetimepass, utestsha512, utestpem;
|
||||||
|
|
||||||
var
|
var
|
||||||
Application: TTestRunner;
|
Application: TTestRunner;
|
@ -51,7 +51,7 @@ type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
pem, ecdsa, basenenc, rsa;
|
pem, ecdsa, basenenc;
|
||||||
|
|
||||||
{ TTestECDSASHA256 }
|
{ TTestECDSASHA256 }
|
||||||
|
|
@ -19,6 +19,7 @@
|
|||||||
add_fcl_db(ADirectory+IncludeTrailingPathDelimiter('fcl-db'));
|
add_fcl_db(ADirectory+IncludeTrailingPathDelimiter('fcl-db'));
|
||||||
add_fcl_extra(ADirectory+IncludeTrailingPathDelimiter('fcl-extra'));
|
add_fcl_extra(ADirectory+IncludeTrailingPathDelimiter('fcl-extra'));
|
||||||
add_fcl_fpcunit(ADirectory+IncludeTrailingPathDelimiter('fcl-fpcunit'));
|
add_fcl_fpcunit(ADirectory+IncludeTrailingPathDelimiter('fcl-fpcunit'));
|
||||||
|
add_fcl_hash(ADirectory+IncludeTrailingPathDelimiter('fcl-hash'));
|
||||||
add_fcl_image(ADirectory+IncludeTrailingPathDelimiter('fcl-image'));
|
add_fcl_image(ADirectory+IncludeTrailingPathDelimiter('fcl-image'));
|
||||||
add_fcl_js(ADirectory+IncludeTrailingPathDelimiter('fcl-js'));
|
add_fcl_js(ADirectory+IncludeTrailingPathDelimiter('fcl-js'));
|
||||||
add_fcl_json(ADirectory+IncludeTrailingPathDelimiter('fcl-json'));
|
add_fcl_json(ADirectory+IncludeTrailingPathDelimiter('fcl-json'));
|
||||||
|
@ -110,6 +110,12 @@ begin
|
|||||||
{$include fcl-extra/fpmake.pp}
|
{$include fcl-extra/fpmake.pp}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure add_fcl_hash(const ADirectory: string);
|
||||||
|
begin
|
||||||
|
with Installer do
|
||||||
|
{$include fcl-hash/fpmake.pp}
|
||||||
|
end;
|
||||||
|
|
||||||
procedure add_fcl_fpcunit(const ADirectory: string);
|
procedure add_fcl_fpcunit(const ADirectory: string);
|
||||||
begin
|
begin
|
||||||
with Installer do
|
with Installer do
|
||||||
|
Loading…
Reference in New Issue
Block a user