File Coverage

Scrypt.xs
Criterion Covered Total %
statement 6 6 100.0
branch 2 2 100.0
condition n/a
subroutine n/a
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             #define PERL_NO_GET_CONTEXT
2             #include "EXTERN.h"
3             #include "perl.h"
4             #include "XSUB.h"
5              
6             #include "ppport.h"
7              
8             #include
9              
10             MODULE = Authen::Passphrase::Scrypt PACKAGE = Authen::Passphrase::Scrypt
11              
12             PROTOTYPES: DISABLE
13              
14             SV*
15             crypto_scrypt(const uint8_t *passwd, size_t length(passwd), \
16             const uint8_t *salt, size_t length(salt), \
17             uint64_t N, uint32_t r, uint32_t p, size_t buflen)
18             CODE:
19             uint8_t *buf;
20             int err;
21 10           Newx(buf, buflen, uint8_t);
22 10           err = crypto_scrypt(passwd, XSauto_length_of_passwd, salt, XSauto_length_of_salt, N, r, p, buf, buflen);
23 10 100         if(err < 0)
24 1           croak("Error in crypto_scrypt");
25 9           RETVAL = newSVpvn((const char* const)buf, buflen);
26 9           Safefree(buf);
27             OUTPUT:
28             RETVAL