[ Assignment | GNU MP | Dmalloc | Libdcrypt ]
In this lab, you will make sure that you can compile and link against the libraries that you will be using in the other programming assignments for the Foundations of Cryptography class. The GNU MP and the Dmalloc libraries are already installed on the Linux lab machines in Burchard 127, which are also accessible via ssh under the DNS-round-robin name linux-lab.cs.stevens.edu. (If you do not yet have an account on these machines, let me know as soon as possible). The Libdcrypt library is set up under my account at /home/nicolosi/cs579/devel/.
lab0.tar.gz as follows:
% gzip -dc lab0.tar.gz | tar xf - % cd lab0 % gmake/ gcc -g -O2 -ansi -Wall -Wsign-compare -Wchar-subscripts -Werror-I. -I/usr/inclu de/ -I/home/nicolosi/cs579/devel/include/ -c tst_sha1.c gcc -g -O2 -ansi -Wall -Wsign-compare -Wchar-subscripts -Werror-o tst_sha1 tst_ sha1.o -L. -L/usr/lib/ -L/home/nicolosi/cs579/devel/lib/-ldcrypt -ldmalloc -l gmp %
% ./tst_sha1
SHA1 (./tst_sha1) = 69cfd14a9e4276efcd592d1832cb8bd32f765848
%
The rest of this page describes how to install these libraries on other machines, in case you also wanted to work on the assignments outside the Linux lab.
You must have the GNU Multiple Precision arithmetic library installed
on you machine. The gmp library provides support for big
integers and many number-theoretics functions, which are needed for
the implementation of most cryptographic primitives.
Before proceeding with the instructions below to install
gmp, check if it's already installed on your machine:
% ls /lib/libgmp* /usr/lib/libgmp* /usr/share/lib/libgmp* /usr/local/lib/libgmp* /usr/local/share/lib/libgmp*
If you get a match, gmp is already installed on your
machine, so you can move on to install
dmalloc.
Otherwise, install gmp as follows.
gmp library from ftp://ftp.gnu.org/gnu/gmp/gmp-4.1.4.tar.gz.
gmp as follows:
% gzip -dc gmp-4.1.4.tar.gz | tar xf - % cd gmp-4.1.4 % ./configure ... % gmake ... % % gmake check ... %
You might also want to install the dmalloc library, which helps you keep track of the memory you allocate.
First, check if the dmalloc library is already installed
on your machine:
% ls /lib/libdmalloc* /usr/lib/libdmalloc* /usr/share/lib/libdmalloc* /usr/local/lib/libdmalloc* /usr/local/share/lib/libdmalloc*
If you get a match, dmalloc is already installed on your
machine, so you can move on to install
dcrypt.
Otherwise, install gmp as follows.
dmalloc from http://dmalloc.com/releases/dmalloc-5.5.2.tgz.
dmalloc as follows.
% gzip -dc dmalloc-5.5.2.tgz | tar xf - % cd dmalloc-5.5.2 % ./configure ... % gmake ... %
Finally, you should install dcrypt, the simple crypto
library that you will use for the lab assignments.
dcrypt from libdcrypt-0.4.tar.gz.
dcrypt as follows.
% gzip -dc libdcrypt-0.4.tar.gz | tar xf - % cd libdcrypt-0.4 % ./configure --with-dmalloc checking for a BSD-compatible install... /usr/bin/install -c ... config.status: creating Makefile config.status: creating config.h config.status: executing default-1 commands % gmake gcc -DHAVE_CONFIG_H -I. -I. -I. -I/usr/local/include -I/usr/local/include -g -O2 -ansi -Wall -Wsign-compare -Wchar-subscripts -Werror -c dcconf.c ... gcc -g -O2 -ansi -Wall -Wsign-compare -Wchar-subscripts -Werror -o tst tst.o ./ libdcrypt.a -L/usr/local/lib -lgmp -ldmalloc -Wl,-rpath,/usr/local/lib -Wl,-rpat h,/usr/local/lib % % gmake check ... %