Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions docs/miracl-user-manual/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,52 @@
Installation
---

* [Quick Start](#quickstart)
* [Overview](#overview)
* [Optimising](#optimising)
* [Upgrading from Version 3](#upgrading)
* [Multi-Threaded Programming](#multi)
* [Constrained Environments](#contrained)

## Quick Start <a id="quickstart"></a>

A new build system has been implemented for use on multiple platforms, using
the [Meson Build System](https://github.com/mesonbuild/meson).

This system is set up to handle 64-bit Intel/AMD, 32-bit Intel/AMD, and 32-bit
ARM. If you are using a different platform, proceed to the
[Overview](#overview) for a manual build.

Further configurations to the build system may later allow an automated
platform detection, however, for the moment, this is hard-coded. If you are
building on or for a different platform, proceed to the overview for the
necessary build steps.

To build the system in a new sub-directory called 'build_here', execute:

```
meson build_here
ninja -C build_here
```

To install to the default location, you simply:

```
ninja -C build_here install
```

A different installation prefix may be specified using:

```
meson configure build_here --prefix=/a/better/place/to/be
```

To build the example applications:

```
meson configure build_here -Dexamples=true
```

## Overview <a id="overview"></a>

The MIRACL library has been successfully installed on a VAX11/780, on a variety of UNIX workstations (Sun, SPARC, Next, IBM RS/6000), on an IBM PC using the Microsoft C and C++ compilers, Borland’s Turbo C and Borland C++ compilers, the Watcom C compiler and the DJGPP GNU compiler; on ARM based computers, and on an Apple Macintosh. Recently it has been implemented on Itanium and AMD 64-bit processors.
Expand Down
32 changes: 32 additions & 0 deletions include/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
inc = include_directories('.')

if host_machine.cpu_family() == 'x86_64'
infile = files('mirdef.h64')
endif

if host_machine.cpu_family() == 'x86'
infile = files('mirdef.h32')
endif

if host_machine.cpu_family() == 'arm'
infile = files('mirdef.arm')
endif

install_data(infile, install_dir: get_option('includedir'), rename: 'mirdef.h')
mirdefh = custom_target('cpmirdef', output: 'mirdef.h', input: infile,
command: [cp, '@INPUT@', '@OUTPUT@' ])

install_headers([
'big.h',
'brick.h',
'crt.h',
'ebrick.h',
'ebrick2.h',
'ec2.h',
'ecn.h',
'ecnzzn.h',
'flash.h',
'floating.h',
'gf2m.h',
'miracl.h',
'zzn.h'])
30 changes: 0 additions & 30 deletions include/mirdef.h

This file was deleted.

9 changes: 9 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
project('miracl', 'c', 'cpp')

cp = find_program('cp')

subdir('include')
subdir('source')

pc = import('pkgconfig')
pc.generate(name: 'miracl', description: 'An infinite precision mathematics library.', libraries: [miracl])
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
option('examples', type : 'boolean', value : false)
4 changes: 2 additions & 2 deletions source/deciph.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int main()
do
{ /* get input file */
printf("file to be deciphered = ");
gets(ifname);
fgets(ifname, 13, 0);
} while (strlen(ifname)==0);
strip(ifname);
strcat(ifname,".key");
Expand All @@ -76,7 +76,7 @@ int main()
strip(ifname);
strcat(ifname,".blg");
printf("output filename = ");
gets(ofname);
fgets(ofname, 13, 0);
flo=FALSE;
if (strlen(ofname)>0)
{ /* set up output file */
Expand Down
4 changes: 2 additions & 2 deletions source/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ int main()
do
{ /* get input file */
printf("file to be decoded = ");
gets(ifname);
fgets(ifname, 13, 0);
} while (strlen(ifname)==0);
strip(ifname);
strcat(ifname,".rsa");
printf("output filename = ");
gets(ofname);
fgets(ofname, 13, 0);
flo=FALSE;
if (strlen(ofname)>0)
{ /* set up output file */
Expand Down
2 changes: 1 addition & 1 deletion source/dssign.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ int main()

/* calculate message digest */
printf("file to be signed = ");
gets(ifname);
fgets(ifname, 50, 0);
strcpy(ofname,ifname);
strip(ofname);
strcat(ofname,".dss");
Expand Down
2 changes: 1 addition & 1 deletion source/dssver.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ int main()
fclose(fp);
/* get message */
printf("signed file = ");
gets(ifname);
fgets(ifname, 50, 0);
strcpy(ofname,ifname);
strip(ofname);
strcat(ofname,".dss");
Expand Down
2 changes: 1 addition & 1 deletion source/ecsver.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ int main()

/* get message */
printf("signed file = ");
gets(ifname);
fgets(ifname, 50, 0);
strcpy(ofname,ifname);
strip(ofname);
strcat(ofname,".ecs");
Expand Down
2 changes: 1 addition & 1 deletion source/ecsver2.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ int main()

/* get message */
printf("signed file = ");
gets(ifname);
fgets(ifname, 50, 0);
strcpy(ofname,ifname);
strip(ofname);
strcat(ofname,".ecs");
Expand Down
4 changes: 2 additions & 2 deletions source/enciph.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ int main()
irand(seed);
bigrand(ke,x);
printf("file to be enciphered = ");
gets(ifname);
fgets(ifname, 13, 0);
fli=FALSE;
if (strlen(ifname)>0) fli=TRUE;
if (fli)
Expand All @@ -84,7 +84,7 @@ int main()
do
{
printf("output filename = ");
gets(ofname);
fgets(ofname, 13, 0);
} while (strlen(ofname)==0);
strip(ofname);
strcat(ofname,".blg");
Expand Down
4 changes: 2 additions & 2 deletions source/encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int main()
}
klen--;
printf("file to be encoded = ");
gets(ifname);
fgets(ifname, 13, 0);
fli=FALSE;
if (strlen(ifname)>0) fli=TRUE;
if (fli)
Expand All @@ -82,7 +82,7 @@ int main()
do
{
printf("output filename = ");
gets(ofname);
fgets(ofname, 13, 0);
} while (strlen(ofname)==0);
strip(ofname);
strcat(ofname,".rsa");
Expand Down
78 changes: 78 additions & 0 deletions source/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
if host_machine.cpu_family() == 'x86_64'
infile = files('mrmuldv.g64')
endif

if host_machine.cpu_family() == 'x86'
infile = files('mrmuldv.gcc')
endif

if infile.length() != 0
mrmuldvc = custom_target('mrmuldv.c', output: 'mrmuldv.c', input: infile,
command: [cp, '@INPUT@', '@OUTPUT@' ])
endif
if infile.length() == 0
mrmuldvc = []
endif

miracl = both_libraries('miracl', [ 'mrcore.c', 'mrarth0.c',
'mrarth1.c', 'mrarth2.c', 'mralloc.c',
'mrsmall.c', 'mrio1.c', 'mrio2.c',
'mrgcd.c', 'mrjack.c', 'mrxgcd.c',
'mrarth3.c', 'mrbits.c', 'mrrand.c',
'mrprime.c', 'mrcrt.c', 'mrscrt.c',
'mrmonty.c', 'mrpower.c', 'mrsroot.c',
'mrcurve.c', 'mrfast.c', 'mrshs.c',
'mrshs256.c', 'mrshs512.c', 'mrsha3.c',
'mrfpe.c', 'mraes.c', 'mrgcm.c',
'mrlucas.c', 'mrzzn2.c', 'mrzzn2b.c',
'mrzzn3.c', 'mrzzn4.c', 'mrecn2.c',
'mrstrong.c', 'mrbrick.c', 'mrebrick.c',
'mrec2m.c', 'mrgf2m.c','mrflash.c',
'mrfrnd.c', 'mrdouble.c', 'mrround.c',
'mrbuild.c', 'mrflsh1.c', 'mrpi.c',
'mrflsh2.c', 'mrflsh3.c', 'mrflsh4.c',
mrmuldvc, mirdefh
], include_directories: inc, install: true, install_dir : 'lib')

libm = meson.get_compiler('c').find_library('m')

if get_option('examples')
executable('hail', [ mirdefh, 'hail.c' ], include_directories: inc, link_with: miracl)
executable('palin', [ mirdefh, 'palin.c' ], include_directories: inc, link_with: miracl)
executable('mersenne', [ mirdefh, 'mersenne.c' ], include_directories: inc, link_with: miracl)
executable('brute', [ mirdefh, 'brute.c' ], include_directories: inc, link_with: miracl)
executable('brent', [ mirdefh, 'brent.c' ], include_directories: inc, link_with: miracl)
executable('pollard', [ mirdefh, 'pollard.c' ], include_directories: inc, link_with: miracl)
executable('williams', [ mirdefh, 'williams.c' ], include_directories: inc, link_with: miracl)
executable('lenstra', [ mirdefh, 'lenstra.c' ], include_directories: inc, link_with: miracl)
executable('qsieve', [ mirdefh, 'qsieve.c' ], include_directories: inc, link_with: miracl, dependencies: libm)
executable('factor', [ mirdefh, 'factor.c' ], include_directories: inc, link_with: miracl, dependencies: libm)
executable('kangaroo', [ mirdefh, 'kangaroo.c' ], include_directories: inc, link_with: miracl)
executable('genprime', [ mirdefh, 'genprime.c' ], include_directories: inc, link_with: miracl)
executable('index', [ mirdefh, 'index.c' ], include_directories: inc, link_with: miracl)
executable('pk-demo', [ mirdefh, 'pk-demo.c' ], include_directories: inc, link_with: miracl)
executable('bmark', [ mirdefh, 'bmark.c' ], include_directories: inc, link_with: miracl)
executable('imratio', [ mirdefh, 'imratio.c' ], include_directories: inc, link_with: miracl)
executable('genkey', [ mirdefh, 'genkey.c' ], include_directories: inc, link_with: miracl)
executable('encode', [ mirdefh, 'encode.c' ], include_directories: inc, link_with: miracl)
executable('decode', [ mirdefh, 'decode.c' ], include_directories: inc, link_with: miracl)
executable('enciph', [ mirdefh, 'enciph.c' ], include_directories: inc, link_with: miracl)
executable('deciph', [ mirdefh, 'deciph.c' ], include_directories: inc, link_with: miracl)
executable('dssetup', [ mirdefh, 'dssetup.c' ], include_directories: inc, link_with: miracl)
executable('limlee', [ mirdefh, 'limlee.c' ], include_directories: inc, link_with: miracl)
executable('dssgen', [ mirdefh, 'dssgen.c' ], include_directories: inc, link_with: miracl)
executable('dssign', [ mirdefh, 'dssign.c' ], include_directories: inc, link_with: miracl)
executable('dssver', [ mirdefh, 'dssver.c' ], include_directories: inc, link_with: miracl)
executable('ecsgen', [ mirdefh, 'ecsgen.c' ], include_directories: inc, link_with: miracl)
executable('ecsver', [ mirdefh, 'ecsver.c' ], include_directories: inc, link_with: miracl)
executable('ecsgen2', [ mirdefh, 'ecsgen2.c' ], include_directories: inc, link_with: miracl)
executable('ecsver2', [ mirdefh, 'ecsver2.c' ], include_directories: inc, link_with: miracl)
executable('brick', [ mirdefh, 'brick.c' ], include_directories: inc, link_with: miracl)
executable('ebrick', [ mirdefh, 'ebrick.c' ], include_directories: inc, link_with: miracl)
executable('ebrick2', [ mirdefh, 'ebrick2.c' ], include_directories: inc, link_with: miracl)
executable('identity', [ mirdefh, 'identity.c' ], include_directories: inc, link_with: miracl)
executable('roots', [ mirdefh, 'roots.c' ], include_directories: inc, link_with: miracl)
executable('hilbert', [ mirdefh, 'hilbert.c' ], include_directories: inc, link_with: miracl)
executable('sample', [ mirdefh, 'sample.c' ], include_directories: inc, link_with: miracl)
# executable('ratcalc', [ mirdefh, 'ratcalc.c' ], include_directories: inc, link_with: miracl)
endif
57 changes: 0 additions & 57 deletions source/mrmuldv.c

This file was deleted.