]> Dogcows Code - chaz/p5-File-KDBX-XS/blob - XS.xs
make sure MakeMaker::Custom is listed as a prereq
[chaz/p5-File-KDBX-XS] / XS.xs
1 #define PERL_NO_GET_CONTEXT
2 #include "EXTERN.h"
3 #include "perl.h"
4 #include "XSUB.h"
5 #include "ppport.h"
6
7 #include "tomcrypt.h"
8
9 MODULE = File::KDBX::XS PACKAGE = File::KDBX::KDF::AES
10
11 SV*
12 _transform_half_xs(const char* key, const char* seed, unsigned int rounds)
13 CODE:
14 symmetric_key skey;
15
16 unsigned char work[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
17 Copy(seed, work, 1, work);
18
19 aes_setup(key, 32, 14, &skey);
20 for (unsigned int i = 0; i < rounds; ++i) {
21 aes_ecb_encrypt(work, work, &skey);
22 }
23
24 SV* result = newSVpvn(work, sizeof(work));
25
26 Zero(&skey, 1, skey);
27 Zero(work, 1, work);
28
29 RETVAL = result;
30 OUTPUT:
31 RETVAL
32
This page took 0.032297 seconds and 4 git commands to generate.