Giter Site home page Giter Site logo

crypt-sodium's Introduction

Note: GitHub Repository is a mirror of

https://git.mg2.org/mikeyg/Crypt-Sodium

Crypt-Sodium version 0.12

Simple wrapper around NaCL functions as provided by libsodium. crypto_box, crypto_stream, crypto_hash, and crypto_sign are all present and accounted for. None of the specific implementations are exposed, only the default implementations are, so please refer to your version of libsodium's release notes if you need to know what implementation you are using.

An attempt to adhere to the API provided by libsodium (inspired by NaCL) is made, but is broken wherever an opportunity to be 'perlish' presented itself. Don't expect to have to pass in or keep track of ciphertext or message lengths. Should the convenience of the Perl API frustrate you, please note that the real versions of the corresponding functions are available with the real_ prefix. e.g. real_crypto_stream_xor()

A crude attempt to detect your version of libsodium using pkg-config and by inspecting canonical dirs is made. Falls back to the minimum level of support - 1.0.8. To troubleshoot feature detection run:

perl Makefile.PL verbose

INSTALLATION

To install this module type the following:

perl Makefile.PL
make
make test
make install

DEPENDENCIES

This module requires these other modules and libraries:

libsodium

COPYRIGHT AND LICENCE

Copyright (C) 2018 by Michael Gregorowicz

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.0 or, at your option, any later version of Perl 5 you may have available.

crypt-sodium's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

crypt-sodium's Issues

Make new functions version aware and support multiple libsodium versions

Version detection has already been implemented see c7ab096, just have to add newer functionality and make use of the Crypt_Sodium_XS_sufficient_libsodium_version guard function. Make sure this is done for the xchacha20poly1305 functions before closing #9

crypto_x features introduced in:

Base Support: 1.0.8
ARGON2: 1.0.9
aead_xchacha20poly1305: 1.0.12
Newest: 1.0.16

Allow build against 1.0.8

Tests segfault perl on various builds

Armbian (3.4.113-sun8i)

  • module compiled with: Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4
$ perl t/Crypt-Sodium.t
ok 1 - use Crypt::Sodium;
ok 2 - Testing roundtrip of crypto_stream_xor
ok 3 - Testing roundtrip of ''
Aborted

Arch Linux (4.4.39-1-ARCH)

  • module compiled with: gcc (GCC) 6.2.1 20160830
$ perl t/Crypt-Sodium.t
ok 1 - use Crypt::Sodium;
ok 2 - Testing roundtrip of crypto_stream_xor
ok 3 - Testing roundtrip of ''
ok 4 - Testing roundtrip of crypto_secretbox
ok 5 - Testing roundtrip of crypto_box
Segmentation fault (core dumped)

Is this library still maintained?

Hi @mgregoro, I'm currently trying to tidy up the bindings linked on the libsodium website. If this library is still maintained, then please let me know; otherwise, the link to this library will likely be removed from the bindings page to help users find up to date and maintained bindings.

Updating for newer libsodium ?

Hi,

Do you have any plans to update for newer versions of libsodium ? For example you don't appear to have implemented Argon2 based password hashing, looks like its still Scrypt based in your code ?

Build failing

FYI, build of current version (git 6116470) is failing (Ubuntu 16.04LTS)

$ perl Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Crypt::Sodium
Writing MYMETA.yml and MYMETA.json
foo@bar:~/test/Crypt-Sodium$ make
cp lib/Crypt/Sodium/GenericHash/State.pm blib/lib/Crypt/Sodium/GenericHash/State.pm
cp lib/Crypt/Sodium.pm blib/lib/Crypt/Sodium.pm
Running Mkbootstrap for Crypt::Sodium ()
chmod 644 "Sodium.bs"
"/usr/bin/perl" "/usr/share/perl/5.22/ExtUtils/xsubpp"  -typemap "/usr/share/perl/5.22/ExtUtils/typemap"  Sodium.xs > Sodium.xsc && mv Sodium.xsc Sodium.c
x86_64-linux-gnu-gcc -c  -I/usr/local/include -I. -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g   -DVERSION=\"0.12\" -DXS_VERSION=\"0.12\" -fPIC "-I/usr/lib/x86_64-linux-gnu/perl/5.22/CORE"  -Wno-pointer-sign Sodium.c
Sodium.xs: In function ‘XS_Crypt__Sodium_real_crypto_aead_xchacha20poly1305_ietf_keygen’:
Sodium.xs:940:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
         unsigned char k* = sodium_malloc(crypto_aead_xchacha20poly1305_ietf_KEYBYTES);
                        ^
Sodium.xs:940:26: error: expected expression before ‘=’ token
         unsigned char k* = sodium_malloc(crypto_aead_xchacha20poly1305_ietf_KEYBYTES);
                          ^
Sodium.xs:941:51: error: ‘k’ undeclared (first use in this function)
         crypto_aead_xchacha20poly1305_ietf_keygen(k);
                                                   ^
Sodium.xs:941:51: note: each undeclared identifier is reported only once for each function it appears in
Makefile:344: recipe for target 'Sodium.o' failed
make: *** [Sodium.o] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.