modified: pixi.toml
[GalaxyCodeBases.git] / etc / Windows / vlmcsd_old_vancepym / crypto.h
blob54cbde194271caf36b392a6922bd2789d9d64a6b
1 #ifndef __crypto_h
2 #define __crypto_h
4 #ifndef CONFIG
5 #define CONFIG "config.h"
6 #endif // CONFIG
7 #include CONFIG
9 #include "types.h"
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include <errno.h>
14 #include "endian.h"
15 #include <stdint.h>
17 //#define AES_ROUNDS (10)
18 #define AES_KEY_BYTES (16) // 128 Bits
19 #define AES_BLOCK_BYTES (16)
20 #define AES_BLOCK_WORDS (AES_BLOCK_BYTES / sizeof(DWORD))
21 #define AES_KEY_DWORDS (AES_KEY_BYTES / sizeof(DWORD))
22 //#define V4_ROUNDS (11)
23 #define V4_KEY_BYTES (20) // 160 Bits
25 #define ROR32(v, n) ( (v) << (32 - n) | (v) >> n )
27 void XorBlock(const BYTE *const in, const BYTE *out);
29 void AesCmacV4(BYTE *data, size_t len, BYTE *hash);
31 extern const BYTE AesKeyV5[];
32 extern const BYTE AesKeyV6[];
34 typedef struct {
35 DWORD Key[48]; // Supports a maximum of 160 key bits!
36 uint_fast8_t rounds;
37 } AesCtx;
39 void AesInitKey(AesCtx *Ctx, const BYTE *Key, int_fast8_t IsV6, int AesKeyBytes);
40 void AesEncryptBlock(const AesCtx *const Ctx, BYTE *block);
41 void AesDecryptBlock(const AesCtx *const Ctx, BYTE *block);
42 void AesEncryptCbc(const AesCtx *const Ctx, BYTE *iv, BYTE *data, size_t *len);
43 void AesDecryptCbc(const AesCtx *const Ctx, BYTE *iv, BYTE *data, size_t len);
44 void MixColumnsR(BYTE *restrict state);
46 #if defined(_CRYPTO_OPENSSL)
47 #include "crypto_openssl.h"
49 #elif defined(_CRYPTO_POLARSSL)
50 #include "crypto_polarssl.h"
52 #elif defined(_CRYPTO_WINDOWS)
53 #include "crypto_windows.h"
55 #else
56 #include "crypto_internal.h"
58 #endif
59 #endif // __crypto_h