]> Dogcows Code - chaz/p5-File-KDBX-XS/blob - XS.xs
251f26996f858a4a64a516ee4f01bba40c83fb19
[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 PROTOTYPES: DISABLE
12
13 SV*
14 _transform_half_xs(const char* key, const char* seed, unsigned int rounds)
15 CODE:
16 symmetric_key skey;
17
18 unsigned char work[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
19 Copy(seed, work, 1, work);
20
21 aes_setup(key, 32, 14, &skey);
22 for (unsigned int i = 0; i < rounds; ++i) {
23 aes_ecb_encrypt(work, work, &skey);
24 }
25
26 SV* result = newSVpvn(work, sizeof(work));
27
28 Zero(&skey, 1, skey);
29 Zero(work, 1, work);
30
31 RETVAL = result;
32 OUTPUT:
33 RETVAL
34
This page took 0.033283 seconds and 3 git commands to generate.