Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fastpbkdf2: init at version 1.0.0 #33155

Merged
merged 3 commits into from Dec 30, 2017
Merged

fastpbkdf2: init at version 1.0.0 #33155

merged 3 commits into from Dec 30, 2017

Conversation

ledif
Copy link
Contributor

@ledif ledif commented Dec 29, 2017

Motivation for this change

New package for fastpbkdf2, which is a fast PBKDF2-HMAC-{SHA1,SHA256,SHA512} implementation in C.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

meta = with stdenv.lib; {
description = "A fast PBKDF2-HMAC-{SHA1,SHA256,SHA512} implementation in C";
homepage = https://github.com/ctz/fastpbkdf2;
licenses = licenses.cc0;
Copy link
Member

@lukateras lukateras Dec 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't evaluate. It should be license = licenses.cc0;

name = "fastpbkdf2-1.0.0";

src = fetchurl {
url = https://github.com/ctz/fastpbkdf2/archive/v1.0.0.tar.gz;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be ref archive, these are not deterministic (because compression is not deterministic). Hash will change after a while. Use fetchFromGitHub instead.

buildInputs = [ openssl ];

preBuild = ''
makeFlagsArray=(CFLAGS="-std=c99 -O3 -g")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-O3 doesn't seem to be particularly safe for general use.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are many packages that have -O3 in their CFLAGS, but I agree that it may not be portable across different platforms. Do you know of a more portable way to enable optimization in the build?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find a better mechanism in Nixpkgs, so nevermind. I thought -O2 might be better, but on a general note it would be better if optimization flags were set somewhere else and not in the derivation.


installPhase = ''
mkdir -p $out/{lib,include/fastpbkdf2}
cp *.a $out/lib
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do they only ship static libraries? If there is some way to tweak build system to emit dynamic libraries (I think in case of macOS it's dylibs), it would be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This package only has a static library, and I do not know of a way to make it generate a shared library without patching the Makefile.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, OK!

@lukateras
Copy link
Member

@GrahamcOfBorg build fastpbkdf2

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success for system: x86_64-darwin

ar: creating archive libfastpbkdf2.a
clang -std=c99 -O3 -g   -c -o bench.o bench.c
clang   bench.o fastpbkdf2.o  -lcrypto -o bench
clang -std=c99 -O3 -g   -c -o benchmulti.o benchmulti.c
clang   benchmulti.o fastpbkdf2.o  -lcrypto -o benchmulti
installing
post-installation fixup
stripping (with flags -S) in /nix/store/l9lmjv27hsbyd4cilb9fcgasmf0b10gb-fastpbkdf2-1.0.0/lib 
patching script interpreter paths in /nix/store/l9lmjv27hsbyd4cilb9fcgasmf0b10gb-fastpbkdf2-1.0.0
/nix/store/l9lmjv27hsbyd4cilb9fcgasmf0b10gb-fastpbkdf2-1.0.0

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success for system: aarch64-linux

gcc   bench.o fastpbkdf2.o  -lcrypto -o bench
gcc -std=c99 -O3 -g   -c -o benchmulti.o benchmulti.c
gcc   benchmulti.o fastpbkdf2.o  -lcrypto -o benchmulti
installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/vb5mpsfyph2slfsq8r5kknpphiqb3sy2-fastpbkdf2-1.0.0
stripping (with flags -S) in /nix/store/vb5mpsfyph2slfsq8r5kknpphiqb3sy2-fastpbkdf2-1.0.0/lib
patching script interpreter paths in /nix/store/vb5mpsfyph2slfsq8r5kknpphiqb3sy2-fastpbkdf2-1.0.0
checking for references to /build in /nix/store/vb5mpsfyph2slfsq8r5kknpphiqb3sy2-fastpbkdf2-1.0.0...
/nix/store/vb5mpsfyph2slfsq8r5kknpphiqb3sy2-fastpbkdf2-1.0.0

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success for system: x86_64-linux

gcc   bench.o fastpbkdf2.o  -lcrypto -o bench
gcc -std=c99 -O3 -g   -c -o benchmulti.o benchmulti.c
gcc   benchmulti.o fastpbkdf2.o  -lcrypto -o benchmulti
installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/76h51rrcqasg3cjxg9lafs745b92vfr7-fastpbkdf2-1.0.0
stripping (with flags -S) in /nix/store/76h51rrcqasg3cjxg9lafs745b92vfr7-fastpbkdf2-1.0.0/lib 
patching script interpreter paths in /nix/store/76h51rrcqasg3cjxg9lafs745b92vfr7-fastpbkdf2-1.0.0
checking for references to /tmp/nix-build-fastpbkdf2-1.0.0.drv-0 in /nix/store/76h51rrcqasg3cjxg9lafs745b92vfr7-fastpbkdf2-1.0.0...
/nix/store/76h51rrcqasg3cjxg9lafs745b92vfr7-fastpbkdf2-1.0.0

@lukateras
Copy link
Member

@GrahamcOfBorg eval
@GrahamcOfBorg build fastpbkdf2

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success for system: x86_64-darwin

ar: creating archive libfastpbkdf2.a
clang -std=c99 -O3 -g   -c -o bench.o bench.c
clang   bench.o fastpbkdf2.o  -lcrypto -o bench
clang -std=c99 -O3 -g   -c -o benchmulti.o benchmulti.c
clang   benchmulti.o fastpbkdf2.o  -lcrypto -o benchmulti
installing
post-installation fixup
stripping (with flags -S) in /nix/store/nbv2c5v8jdii9xrbc7jjxhjbrmxb9j9h-fastpbkdf2-1.0.0/lib 
patching script interpreter paths in /nix/store/nbv2c5v8jdii9xrbc7jjxhjbrmxb9j9h-fastpbkdf2-1.0.0
/nix/store/nbv2c5v8jdii9xrbc7jjxhjbrmxb9j9h-fastpbkdf2-1.0.0

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success for system: aarch64-linux

gcc   bench.o fastpbkdf2.o  -lcrypto -o bench
gcc -std=c99 -O3 -g   -c -o benchmulti.o benchmulti.c
gcc   benchmulti.o fastpbkdf2.o  -lcrypto -o benchmulti
installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/ciwvibjpc1aq19g48wbb195ns4khqdqp-fastpbkdf2-1.0.0
stripping (with flags -S) in /nix/store/ciwvibjpc1aq19g48wbb195ns4khqdqp-fastpbkdf2-1.0.0/lib
patching script interpreter paths in /nix/store/ciwvibjpc1aq19g48wbb195ns4khqdqp-fastpbkdf2-1.0.0
checking for references to /build in /nix/store/ciwvibjpc1aq19g48wbb195ns4khqdqp-fastpbkdf2-1.0.0...
/nix/store/ciwvibjpc1aq19g48wbb195ns4khqdqp-fastpbkdf2-1.0.0

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success for system: x86_64-linux

gcc   bench.o fastpbkdf2.o  -lcrypto -o bench
gcc -std=c99 -O3 -g   -c -o benchmulti.o benchmulti.c
gcc   benchmulti.o fastpbkdf2.o  -lcrypto -o benchmulti
installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/1kbzhnzzf6wrh5zhxh6h9i6skzrfpj1s-fastpbkdf2-1.0.0
stripping (with flags -S) in /nix/store/1kbzhnzzf6wrh5zhxh6h9i6skzrfpj1s-fastpbkdf2-1.0.0/lib 
patching script interpreter paths in /nix/store/1kbzhnzzf6wrh5zhxh6h9i6skzrfpj1s-fastpbkdf2-1.0.0
checking for references to /tmp/nix-build-fastpbkdf2-1.0.0.drv-0 in /nix/store/1kbzhnzzf6wrh5zhxh6h9i6skzrfpj1s-fastpbkdf2-1.0.0...
/nix/store/1kbzhnzzf6wrh5zhxh6h9i6skzrfpj1s-fastpbkdf2-1.0.0

@lukateras lukateras merged commit 6a6e34b into NixOS:master Dec 30, 2017
@lukateras
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants