diff --git a/lib/internal.c b/lib/internal.c index 6251924..e8942b3 100644 --- a/lib/internal.c +++ b/lib/internal.c @@ -2,8 +2,6 @@ #ifdef _WINDOWS #include #include -#include -#define WIN32_NO_STATUS #include #else #include @@ -23,6 +21,8 @@ #ifdef _WINDOWS +#define STATUS_SUCCESS ((NTSTATUS)0x00000000L) + struct des_key { HCRYPTPROV hProv; HCRYPTKEY hKey; diff --git a/lib/ykpiv.c b/lib/ykpiv.c index 01723f9..50c7340 100644 --- a/lib/ykpiv.c +++ b/lib/ykpiv.c @@ -97,16 +97,16 @@ static void dump_hex(const unsigned char *buf, unsigned int len) { int _ykpiv_set_length(unsigned char *buffer, size_t length) { if(length < 0x80) { - *buffer++ = length; + *buffer++ = (unsigned char)length; return 1; } else if(length < 0xff) { *buffer++ = 0x81; - *buffer++ = length; + *buffer++ = (unsigned char)length; return 2; } else { *buffer++ = 0x82; *buffer++ = (length >> 8) & 0xff; - *buffer++ = length & 0xff; + *buffer++ = (unsigned char)length & 0xff; return 3; } } @@ -244,7 +244,7 @@ ykpiv_rc _ykpiv_ensure_application_selected(ykpiv_state *state) { return res; } -static ykpiv_rc _ykpiv_connect(ykpiv_state *state, uint64_t context, uint64_t card) { +static ykpiv_rc _ykpiv_connect(ykpiv_state *state, uintptr_t context, uintptr_t card) { ykpiv_rc res = YKPIV_OK; if (NULL == state) { @@ -286,7 +286,7 @@ static ykpiv_rc _ykpiv_connect(ykpiv_state *state, uint64_t context, uint64_t ca return res; } -ykpiv_rc ykpiv_connect_with_external_card(ykpiv_state *state, uint64_t context, uint64_t card) { +ykpiv_rc ykpiv_connect_with_external_card(ykpiv_state *state, uintptr_t context, uintptr_t card) { return _ykpiv_connect(state, context, card); } diff --git a/lib/ykpiv.h b/lib/ykpiv.h index f41367b..142b24f 100644 --- a/lib/ykpiv.h +++ b/lib/ykpiv.h @@ -413,7 +413,7 @@ extern "C" * * @return Error code */ - ykpiv_rc ykpiv_connect_with_external_card(ykpiv_state *state, uint64_t context, uint64_t card); + ykpiv_rc ykpiv_connect_with_external_card(ykpiv_state *state, uintptr_t context, uintptr_t card); /** * Variant of ykpiv_done() for external cards connected with ykpiv_connect_with_external_card()