Skip to content

Add Debian-style Data Directory patch #82

@noloader

Description

@noloader

Distro maintainers currently have it rough. They install cryptest.exe into /usr/bin, TestVectors and TestData into /usr/share, and everything breaks because the library presumes a location relative to cryptest.exe.

We have a DataDir patch, but its a bit complicated. Its probably more complicated than needed. It also requires a user to make PREFIX=..., which is unusual in the Crypto++ build procedure workflows.

The distros currently use a Debian patch provided. Whenever we add a new set of test vectors, the distros must apply their patch or endure breaking when a new data set is added, like those for HKDF.

The Debian patch has two parts. First, it adds a macro prefix to the relevant files. For example, the following change is made:

- FileSource keys("TestData/rsa512a.dat", true, new HexDecoder);
+ FileSource keys(PACKAGE_DATA_DIR "TestData/rsa512a.dat", true, new HexDecoder);

Then, the distros build with:

CXXFLAGS = $(CXXFLAGS) -DPACKAGE_DATA_DIR='"/usr/share/crypto++/"'

I had the opportunity to speak with two of our package maintainers, László (Debian) and Morten (Fedora). We have hashed out the following changes:

// config.h
#ifndef CRYPTOPP_DATA_DIR
#  define CRYPTOPP_DATA_DIR "./"
#endif

Then, we will apply the changes following Debian's lead with:

- FileSource keys("TestData/rsa512a.dat", true, new HexDecoder);
+ FileSource keys(CRYPTOPP_DATA_DIR "TestData/rsa512a.dat", true, new HexDecoder);

The changes above will preserve exiting behavior, and allow distros to continue modifying it as required.

In the future, when we add files, they will always have the prefix applied, so the distros won't need to manage it.


The discussion is available at Debian-style Data Directory patch.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions