secur32: Avoid size_t and fix some printf formats.
This commit is contained in:
parent
f35d52e20e
commit
52fa3bf42d
|
@ -496,7 +496,7 @@ static void schan_resize_current_buffer(const struct schan_buffers *s, SIZE_T mi
|
|||
b->pvBuffer = new_data;
|
||||
}
|
||||
|
||||
static char *schan_get_buffer(const struct schan_transport *t, struct schan_buffers *s, size_t *count)
|
||||
static char *schan_get_buffer(const struct schan_transport *t, struct schan_buffers *s, SIZE_T *count)
|
||||
{
|
||||
SIZE_T max_count;
|
||||
PSecBuffer buffer;
|
||||
|
@ -566,9 +566,9 @@ static char *schan_get_buffer(const struct schan_transport *t, struct schan_buff
|
|||
int schan_pull(struct schan_transport *t, void *buff, size_t *buff_len)
|
||||
{
|
||||
char *b;
|
||||
size_t local_len = *buff_len;
|
||||
SIZE_T local_len = *buff_len;
|
||||
|
||||
TRACE("Pull %zu bytes\n", local_len);
|
||||
TRACE("Pull %lu bytes\n", local_len);
|
||||
|
||||
*buff_len = 0;
|
||||
|
||||
|
@ -586,7 +586,7 @@ int schan_pull(struct schan_transport *t, void *buff, size_t *buff_len)
|
|||
memcpy(buff, b, local_len);
|
||||
t->in.offset += local_len;
|
||||
|
||||
TRACE("Read %zu bytes\n", local_len);
|
||||
TRACE("Read %lu bytes\n", local_len);
|
||||
|
||||
*buff_len = local_len;
|
||||
return 0;
|
||||
|
@ -612,9 +612,9 @@ int schan_pull(struct schan_transport *t, void *buff, size_t *buff_len)
|
|||
int schan_push(struct schan_transport *t, const void *buff, size_t *buff_len)
|
||||
{
|
||||
char *b;
|
||||
size_t local_len = *buff_len;
|
||||
SIZE_T local_len = *buff_len;
|
||||
|
||||
TRACE("Push %zu bytes\n", local_len);
|
||||
TRACE("Push %lu bytes\n", local_len);
|
||||
|
||||
*buff_len = 0;
|
||||
|
||||
|
@ -625,7 +625,7 @@ int schan_push(struct schan_transport *t, const void *buff, size_t *buff_len)
|
|||
memcpy(b, buff, local_len);
|
||||
t->out.offset += local_len;
|
||||
|
||||
TRACE("Wrote %zu bytes\n", local_len);
|
||||
TRACE("Wrote %lu bytes\n", local_len);
|
||||
|
||||
*buff_len = local_len;
|
||||
return 0;
|
||||
|
@ -819,10 +819,10 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW(
|
|||
if (status == SEC_E_OK)
|
||||
{
|
||||
SecPkgContext_StreamSizes *stream_sizes = buffer;
|
||||
size_t mac_size = info.dwHashStrength;
|
||||
SIZE_T mac_size = info.dwHashStrength;
|
||||
unsigned int block_size = schan_imp_get_session_cipher_block_size(ctx->session);
|
||||
|
||||
TRACE("Using %zu mac bytes, block size %u\n", mac_size, block_size);
|
||||
TRACE("Using %lu mac bytes, block size %u\n", mac_size, block_size);
|
||||
|
||||
/* These are defined by the TLS RFC */
|
||||
stream_sizes->cbHeader = 5;
|
||||
|
@ -926,7 +926,7 @@ static SECURITY_STATUS SEC_ENTRY schan_EncryptMessage(PCtxtHandle context_handle
|
|||
SecBuffer *buffer;
|
||||
SIZE_T data_size;
|
||||
char *data;
|
||||
ssize_t sent = 0;
|
||||
SSIZE_T sent = 0;
|
||||
int idx;
|
||||
|
||||
TRACE("context_handle %p, quality %d, message %p, message_seq_no %d\n",
|
||||
|
@ -959,7 +959,7 @@ static SECURITY_STATUS SEC_ENTRY schan_EncryptMessage(PCtxtHandle context_handle
|
|||
|
||||
while (sent < data_size)
|
||||
{
|
||||
size_t length = data_size - sent;
|
||||
SIZE_T length = data_size - sent;
|
||||
SECURITY_STATUS status = schan_imp_send(ctx->session, data + sent, &length);
|
||||
if (status == SEC_I_CONTINUE_NEEDED)
|
||||
break;
|
||||
|
@ -973,7 +973,7 @@ static SECURITY_STATUS SEC_ENTRY schan_EncryptMessage(PCtxtHandle context_handle
|
|||
sent += length;
|
||||
}
|
||||
|
||||
TRACE("Sent %zd bytes\n", sent);
|
||||
TRACE("Sent %ld bytes\n", sent);
|
||||
|
||||
b = &transport.out;
|
||||
b->desc->pBuffers[b->current_buffer_idx].cbBuffer = b->offset;
|
||||
|
@ -1055,7 +1055,7 @@ static SECURITY_STATUS SEC_ENTRY schan_DecryptMessage(PCtxtHandle context_handle
|
|||
SIZE_T data_size;
|
||||
char *data;
|
||||
unsigned expected_size;
|
||||
ssize_t received = 0;
|
||||
SSIZE_T received = 0;
|
||||
int idx;
|
||||
unsigned char *buf_ptr;
|
||||
|
||||
|
@ -1101,7 +1101,7 @@ static SECURITY_STATUS SEC_ENTRY schan_DecryptMessage(PCtxtHandle context_handle
|
|||
|
||||
while (received < data_size)
|
||||
{
|
||||
size_t length = data_size - received;
|
||||
SIZE_T length = data_size - received;
|
||||
SECURITY_STATUS status = schan_imp_recv(ctx->session, data + received, &length);
|
||||
if (status == SEC_I_CONTINUE_NEEDED)
|
||||
{
|
||||
|
@ -1125,7 +1125,7 @@ static SECURITY_STATUS SEC_ENTRY schan_DecryptMessage(PCtxtHandle context_handle
|
|||
received += length;
|
||||
}
|
||||
|
||||
TRACE("Received %zd bytes\n", received);
|
||||
TRACE("Received %ld bytes\n", received);
|
||||
|
||||
memcpy(buf_ptr + 5, data, received);
|
||||
HeapFree(GetProcessHeap(), 0, data);
|
||||
|
|
|
@ -331,7 +331,7 @@ SECURITY_STATUS schan_imp_get_session_peer_certificate(schan_imp_session session
|
|||
}
|
||||
|
||||
SECURITY_STATUS schan_imp_send(schan_imp_session session, const void *buffer,
|
||||
size_t *length)
|
||||
SIZE_T *length)
|
||||
{
|
||||
gnutls_session_t s = (gnutls_session_t)session;
|
||||
ssize_t ret = pgnutls_record_send(s, buffer, *length);
|
||||
|
@ -349,7 +349,7 @@ SECURITY_STATUS schan_imp_send(schan_imp_session session, const void *buffer,
|
|||
}
|
||||
|
||||
SECURITY_STATUS schan_imp_recv(schan_imp_session session, void *buffer,
|
||||
size_t *length)
|
||||
SIZE_T *length)
|
||||
{
|
||||
gnutls_session_t s = (gnutls_session_t)session;
|
||||
ssize_t ret = pgnutls_record_recv(s, buffer, *length);
|
||||
|
|
|
@ -378,15 +378,14 @@ static ALG_ID schan_get_kx_algid(const struct cipher_suite* c)
|
|||
* other error code for failure.
|
||||
*/
|
||||
static OSStatus schan_pull_adapter(SSLConnectionRef transport, void *buff,
|
||||
size_t *buff_len)
|
||||
SIZE_T *buff_len)
|
||||
{
|
||||
struct mac_session *s = (struct mac_session*)transport;
|
||||
size_t requested = *buff_len;
|
||||
int status;
|
||||
OSStatus ret;
|
||||
|
||||
TRACE("(%p/%p, %p, %p/%lu)\n", s, s->transport, buff, buff_len,
|
||||
(unsigned long)*buff_len);
|
||||
TRACE("(%p/%p, %p, %p/%lu)\n", s, s->transport, buff, buff_len, *buff_len);
|
||||
|
||||
status = schan_pull(s->transport, buff, buff_len);
|
||||
if (status == 0)
|
||||
|
@ -398,12 +397,12 @@ static OSStatus schan_pull_adapter(SSLConnectionRef transport, void *buff,
|
|||
}
|
||||
else if (*buff_len < requested)
|
||||
{
|
||||
TRACE("Pulled %lu bytes before would block\n", (unsigned long)*buff_len);
|
||||
TRACE("Pulled %lu bytes before would block\n", *buff_len);
|
||||
ret = errSSLWouldBlock;
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE("Pulled %lu bytes\n", (unsigned long)*buff_len);
|
||||
TRACE("Pulled %lu bytes\n", *buff_len);
|
||||
ret = noErr;
|
||||
}
|
||||
}
|
||||
|
@ -439,19 +438,18 @@ static OSStatus schan_pull_adapter(SSLConnectionRef transport, void *buff,
|
|||
* other error code for failure.
|
||||
*/
|
||||
static OSStatus schan_push_adapter(SSLConnectionRef transport, const void *buff,
|
||||
size_t *buff_len)
|
||||
SIZE_T *buff_len)
|
||||
{
|
||||
struct mac_session *s = (struct mac_session*)transport;
|
||||
int status;
|
||||
OSStatus ret;
|
||||
|
||||
TRACE("(%p/%p, %p, %p/%lu)\n", s, s->transport, buff, buff_len,
|
||||
(unsigned long)*buff_len);
|
||||
TRACE("(%p/%p, %p, %p/%lu)\n", s, s->transport, buff, buff_len, *buff_len);
|
||||
|
||||
status = schan_push(s->transport, buff, buff_len);
|
||||
if (status == 0)
|
||||
{
|
||||
TRACE("Pushed %lu bytes\n", (unsigned long)*buff_len);
|
||||
TRACE("Pushed %lu bytes\n", *buff_len);
|
||||
ret = noErr;
|
||||
}
|
||||
else if (status == EAGAIN)
|
||||
|
@ -707,16 +705,16 @@ SECURITY_STATUS schan_imp_get_session_peer_certificate(schan_imp_session session
|
|||
}
|
||||
|
||||
SECURITY_STATUS schan_imp_send(schan_imp_session session, const void *buffer,
|
||||
size_t *length)
|
||||
SIZE_T *length)
|
||||
{
|
||||
struct mac_session* s = (struct mac_session*)session;
|
||||
OSStatus status;
|
||||
|
||||
TRACE("(%p/%p, %p, %p/%lu)\n", s, s->context, buffer, length, (unsigned long)*length);
|
||||
TRACE("(%p/%p, %p, %p/%lu)\n", s, s->context, buffer, length, *length);
|
||||
|
||||
status = SSLWrite(s->context, buffer, *length, length);
|
||||
if (status == noErr)
|
||||
TRACE("Wrote %lu bytes\n", (unsigned long)*length);
|
||||
TRACE("Wrote %lu bytes\n", *length);
|
||||
else if (status == errSSLWouldBlock)
|
||||
{
|
||||
if (!*length)
|
||||
|
@ -725,7 +723,7 @@ SECURITY_STATUS schan_imp_send(schan_imp_session session, const void *buffer,
|
|||
return SEC_I_CONTINUE_NEEDED;
|
||||
}
|
||||
else
|
||||
TRACE("Wrote %lu bytes before would block\n", (unsigned long)*length);
|
||||
TRACE("Wrote %lu bytes before would block\n", *length);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -737,16 +735,16 @@ SECURITY_STATUS schan_imp_send(schan_imp_session session, const void *buffer,
|
|||
}
|
||||
|
||||
SECURITY_STATUS schan_imp_recv(schan_imp_session session, void *buffer,
|
||||
size_t *length)
|
||||
SIZE_T *length)
|
||||
{
|
||||
struct mac_session* s = (struct mac_session*)session;
|
||||
OSStatus status;
|
||||
|
||||
TRACE("(%p/%p, %p, %p/%lu)\n", s, s->context, buffer, length, (unsigned long)*length);
|
||||
TRACE("(%p/%p, %p, %p/%lu)\n", s, s->context, buffer, length, *length);
|
||||
|
||||
status = SSLRead(s->context, buffer, *length, length);
|
||||
if (status == noErr)
|
||||
TRACE("Read %lu bytes\n", (unsigned long)*length);
|
||||
TRACE("Read %lu bytes\n", *length);
|
||||
else if (status == errSSLWouldBlock)
|
||||
{
|
||||
if (!*length)
|
||||
|
@ -755,7 +753,7 @@ SECURITY_STATUS schan_imp_recv(schan_imp_session session, void *buffer,
|
|||
return SEC_I_CONTINUE_NEEDED;
|
||||
}
|
||||
else
|
||||
TRACE("Read %lu bytes before would block\n", (unsigned long)*length);
|
||||
TRACE("Read %lu bytes before would block\n", *length);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -201,9 +201,9 @@ extern SECURITY_STATUS schan_imp_get_connection_info(schan_imp_session session,
|
|||
extern SECURITY_STATUS schan_imp_get_session_peer_certificate(schan_imp_session session,
|
||||
PCCERT_CONTEXT *cert) DECLSPEC_HIDDEN;
|
||||
extern SECURITY_STATUS schan_imp_send(schan_imp_session session, const void *buffer,
|
||||
size_t *length) DECLSPEC_HIDDEN;
|
||||
SIZE_T *length) DECLSPEC_HIDDEN;
|
||||
extern SECURITY_STATUS schan_imp_recv(schan_imp_session session, void *buffer,
|
||||
size_t *length) DECLSPEC_HIDDEN;
|
||||
SIZE_T *length) DECLSPEC_HIDDEN;
|
||||
extern BOOL schan_imp_allocate_certificate_credentials(schan_imp_certificate_credentials *c) DECLSPEC_HIDDEN;
|
||||
extern void schan_imp_free_certificate_credentials(schan_imp_certificate_credentials c) DECLSPEC_HIDDEN;
|
||||
extern BOOL schan_imp_init(void) DECLSPEC_HIDDEN;
|
||||
|
|
Loading…
Reference in New Issue