Skip to content

Commit 52f636f

Browse files
committed
Fix calling conversions for windows x86
There was a bad assumption of calling conversions. Bad usage for WINAPI where it was not applicable to functions. This went mostly unnoticed due to only affecting windows x86. Windows x64 does not suffer this issue.
1 parent 30a11ab commit 52f636f

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

haccrypto/_crypto.cpp

+9-10
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ typedef HMODULE DYHandle;
2828
#include <dlfcn.h>
2929
#define __ldl__ 1
3030
typedef void* DYHandle;
31-
#define WINAPI
3231
#endif
3332

3433
typedef uint8_t u8;
@@ -251,15 +250,15 @@ class Buffer {
251250
}
252251
};
253252

254-
void *(WINAPI *EVP_CIPHER_CTX_new)() = NULL;
255-
void *(WINAPI *EVP_aes_128_ecb)() = NULL;
256-
int (WINAPI *EVP_CipherInit_ex)(void*, void*, void*, const void*, void*, int) = NULL;
257-
int (WINAPI *EVP_CIPHER_CTX_key_length)(void*) = NULL;
258-
void (WINAPI *EVP_CIPHER_CTX_set_padding)(void*, int) = NULL;
259-
int (WINAPI *EVP_CipherUpdate)(void*, void*, int*, const void*, int) = NULL;
260-
int (WINAPI *EVP_CipherFinal_ex)(void*, void*, int*) = NULL;
261-
void (WINAPI *EVP_CIPHER_CTX_free)(void*) = NULL;
262-
unsigned long (WINAPI *OpenSSL_version_num)() = NULL;
253+
void *(*EVP_CIPHER_CTX_new)() = NULL;
254+
void *(*EVP_aes_128_ecb)() = NULL;
255+
int (*EVP_CipherInit_ex)(void*, void*, void*, const void*, void*, int) = NULL;
256+
int (*EVP_CIPHER_CTX_key_length)(void*) = NULL;
257+
void (*EVP_CIPHER_CTX_set_padding)(void*, int) = NULL;
258+
int (*EVP_CipherUpdate)(void*, void*, int*, const void*, int) = NULL;
259+
int (*EVP_CipherFinal_ex)(void*, void*, int*) = NULL;
260+
void (*EVP_CIPHER_CTX_free)(void*) = NULL;
261+
unsigned long (*OpenSSL_version_num)() = NULL;
263262

264263
static DynamicHelper lcrypto;
265264
static bool lib_to_load = true;

setup.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
setup(
1919
name='haccrypto',
20-
version='0.1.0',
20+
version='0.1.1',
2121
packages=find_packages(),
2222
url='https://github.com/luigoalma/haccrypto',
2323
license='MIT',
@@ -33,6 +33,7 @@
3333
'Programming Language :: Python :: 3.6',
3434
'Programming Language :: Python :: 3.7',
3535
'Programming Language :: Python :: 3.8',
36+
'Programming Language :: Python :: 3.9',
3637
],
3738
ext_modules=[Extension('haccrypto._crypto', sources=['haccrypto/_crypto.cpp', 'haccrypto/aes.cpp'],
3839
extra_compile_args=['/Ox' if sys.platform == 'win32' else '-O3',

0 commit comments

Comments
 (0)