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
|
|
|
|
|
|
|
#include "ppport.h" |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
#include "tomcrypt.h" |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
MODULE = File::KDBX::XS PACKAGE = File::KDBX::XS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
PROTOTYPES: DISABLE |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
SV* |
14
|
|
|
|
|
|
|
CowREFCNT(SV* sv) |
15
|
|
|
|
|
|
|
CODE: |
16
|
|
|
|
|
|
|
#ifdef SV_COW_REFCNT_MAX |
17
|
0
|
0
|
|
|
|
|
if (SvIsCOW(sv)) XSRETURN_IV(0 < SvLEN(sv) ? CowREFCNT(sv) : 0); |
|
|
0
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#endif |
19
|
0
|
|
|
|
|
|
XSRETURN_UNDEF; |
20
|
|
|
|
|
|
|
OUTPUT: |
21
|
|
|
|
|
|
|
RETVAL |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
SV* |
24
|
|
|
|
|
|
|
kdf_aes_transform_half(const char* key, const char* seed, unsigned int rounds) |
25
|
|
|
|
|
|
|
CODE: |
26
|
|
|
|
|
|
|
symmetric_key skey; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
|
unsigned char work[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
29
|
1
|
|
|
|
|
|
Copy(seed, work, 1, work); |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
|
aes_setup(key, 32, 14, &skey); |
32
|
124
|
100
|
|
|
|
|
for (unsigned int i = 0; i < rounds; ++i) { |
33
|
123
|
|
|
|
|
|
aes_ecb_encrypt(work, work, &skey); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
|
SV* result = newSVpvn(work, sizeof(work)); |
37
|
|
|
|
|
|
|
|
38
|
1
|
|
|
|
|
|
Zero(&skey, 1, skey); |
39
|
1
|
|
|
|
|
|
Zero(work, 1, work); |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
|
RETVAL = result; |
42
|
|
|
|
|
|
|
OUTPUT: |
43
|
|
|
|
|
|
|
RETVAL |