diff options
author | pixel <pixel> | 2007-07-05 18:05:43 +0000 |
---|---|---|
committer | pixel <pixel> | 2007-07-05 18:05:43 +0000 |
commit | e12fcb08a14de1f5738e0162bba50cdbf87dee47 (patch) | |
tree | 48ed11b4e908a1760d0bd0ddce96c05d2a896e13 /MPQCryptography.h |
First import...
Diffstat (limited to 'MPQCryptography.h')
-rw-r--r-- | MPQCryptography.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/MPQCryptography.h b/MPQCryptography.h new file mode 100644 index 0000000..e8af48e --- /dev/null +++ b/MPQCryptography.h @@ -0,0 +1,48 @@ +/* + * MPQCryptography.h + * MPQKit + * + * Created by Jean-Francois Roy on Sat Oct 05 2002. + * Copyright (c) 2002-2007 MacStorm. All rights reserved. + * + */ + +#include <stdbool.h> +#include <stdint.h> +#include <openssl/rsa.h> + +#if defined(__cplusplus) +extern "C" { +#endif + +#if !defined(__MPQLIB_WEAK_SIGNATURE_SIZE) +#define __MPQLIB_WEAK_SIGNATURE_SIZE 64 +#endif + +#if !defined(__MPQLIB_STRONG_SIGNATURE_SIZE) +#define __MPQLIB_STRONG_SIGNATURE_SIZE 256 +#endif + + void __mpqlib_init_cryptography(void); + + const uint32_t *__mpqlib_get_cryptography_table(void); + + void __mpqlib_encrypt(char *data, uint32_t length, uint32_t key, + bool disable_input_swapping); + void __mpqlib_decrypt(char *data, uint32_t length, uint32_t key, + bool disable_output_swapping); + + uint32_t __mpqlib_hash_cstring(const char *string, uint32_t type); + uint32_t __mpqlib_hash_data(const char *data, uint32_t length, uint32_t type); + +#define __MPQLIB_CRC_INIT 0x1 +#define __MPQLIB_CRC_UPDATE 0x2 +#define __MPQLIB_CRC_FINALIZE 0x4 + void __mpqlib_crc32(const unsigned char *buffer, uint32_t length, uint32_t * crc, uint32_t flags); + + int __mpqlib_verify_weak_signature(RSA * public_key, const unsigned char *signature, const unsigned char *digest); + int __mpqlib_verify_strong_signature(RSA * public_key, const unsigned char *signature, const unsigned char *digest); + +#if defined(__cplusplus) +} +#endif |