api: use uintptr_t for architecture specific handle sizes

This commit is contained in:
Dave Pate
2017-10-26 13:55:58 +02:00
committed by Trevor Bentley
parent a7eb0657f1
commit 999312e6b5
3 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -2,8 +2,6 @@
#ifdef _WINDOWS #ifdef _WINDOWS
#include <windows.h> #include <windows.h>
#include <wincrypt.h> #include <wincrypt.h>
#include <ntstatus.h>
#define WIN32_NO_STATUS
#include <bcrypt.h> #include <bcrypt.h>
#else #else
#include <openssl/des.h> #include <openssl/des.h>
@@ -23,6 +21,8 @@
#ifdef _WINDOWS #ifdef _WINDOWS
#define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
struct des_key { struct des_key {
HCRYPTPROV hProv; HCRYPTPROV hProv;
HCRYPTKEY hKey; HCRYPTKEY hKey;
+5 -5
View File
@@ -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) { int _ykpiv_set_length(unsigned char *buffer, size_t length) {
if(length < 0x80) { if(length < 0x80) {
*buffer++ = length; *buffer++ = (unsigned char)length;
return 1; return 1;
} else if(length < 0xff) { } else if(length < 0xff) {
*buffer++ = 0x81; *buffer++ = 0x81;
*buffer++ = length; *buffer++ = (unsigned char)length;
return 2; return 2;
} else { } else {
*buffer++ = 0x82; *buffer++ = 0x82;
*buffer++ = (length >> 8) & 0xff; *buffer++ = (length >> 8) & 0xff;
*buffer++ = length & 0xff; *buffer++ = (unsigned char)length & 0xff;
return 3; return 3;
} }
} }
@@ -244,7 +244,7 @@ ykpiv_rc _ykpiv_ensure_application_selected(ykpiv_state *state) {
return res; 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; ykpiv_rc res = YKPIV_OK;
if (NULL == state) { if (NULL == state) {
@@ -286,7 +286,7 @@ static ykpiv_rc _ykpiv_connect(ykpiv_state *state, uint64_t context, uint64_t ca
return res; 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); return _ykpiv_connect(state, context, card);
} }
+1 -1
View File
@@ -413,7 +413,7 @@ extern "C"
* *
* @return Error code * @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() * Variant of ykpiv_done() for external cards connected with ykpiv_connect_with_external_card()