Commit 52fa3bf4 authored by Alexandre Julliard's avatar Alexandre Julliard

secur32: Avoid size_t and fix some printf formats.

parent f35d52e2
...@@ -496,7 +496,7 @@ static void schan_resize_current_buffer(const struct schan_buffers *s, SIZE_T mi ...@@ -496,7 +496,7 @@ static void schan_resize_current_buffer(const struct schan_buffers *s, SIZE_T mi
b->pvBuffer = new_data; 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; SIZE_T max_count;
PSecBuffer buffer; PSecBuffer buffer;
...@@ -566,9 +566,9 @@ static char *schan_get_buffer(const struct schan_transport *t, struct schan_buff ...@@ -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) int schan_pull(struct schan_transport *t, void *buff, size_t *buff_len)
{ {
char *b; 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; *buff_len = 0;
...@@ -586,7 +586,7 @@ int schan_pull(struct schan_transport *t, void *buff, size_t *buff_len) ...@@ -586,7 +586,7 @@ int schan_pull(struct schan_transport *t, void *buff, size_t *buff_len)
memcpy(buff, b, local_len); memcpy(buff, b, local_len);
t->in.offset += 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; *buff_len = local_len;
return 0; return 0;
...@@ -612,9 +612,9 @@ int schan_pull(struct schan_transport *t, void *buff, size_t *buff_len) ...@@ -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) int schan_push(struct schan_transport *t, const void *buff, size_t *buff_len)
{ {
char *b; 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; *buff_len = 0;
...@@ -625,7 +625,7 @@ int schan_push(struct schan_transport *t, const void *buff, size_t *buff_len) ...@@ -625,7 +625,7 @@ int schan_push(struct schan_transport *t, const void *buff, size_t *buff_len)
memcpy(b, buff, local_len); memcpy(b, buff, local_len);
t->out.offset += 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; *buff_len = local_len;
return 0; return 0;
...@@ -819,10 +819,10 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW( ...@@ -819,10 +819,10 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW(
if (status == SEC_E_OK) if (status == SEC_E_OK)
{ {
SecPkgContext_StreamSizes *stream_sizes = buffer; 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); 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 */ /* These are defined by the TLS RFC */
stream_sizes->cbHeader = 5; stream_sizes->cbHeader = 5;
...@@ -926,7 +926,7 @@ static SECURITY_STATUS SEC_ENTRY schan_EncryptMessage(PCtxtHandle context_handle ...@@ -926,7 +926,7 @@ static SECURITY_STATUS SEC_ENTRY schan_EncryptMessage(PCtxtHandle context_handle
SecBuffer *buffer; SecBuffer *buffer;
SIZE_T data_size; SIZE_T data_size;
char *data; char *data;
ssize_t sent = 0; SSIZE_T sent = 0;
int idx; int idx;
TRACE("context_handle %p, quality %d, message %p, message_seq_no %d\n", 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 ...@@ -959,7 +959,7 @@ static SECURITY_STATUS SEC_ENTRY schan_EncryptMessage(PCtxtHandle context_handle
while (sent < data_size) 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); SECURITY_STATUS status = schan_imp_send(ctx->session, data + sent, &length);
if (status == SEC_I_CONTINUE_NEEDED) if (status == SEC_I_CONTINUE_NEEDED)
break; break;
...@@ -973,7 +973,7 @@ static SECURITY_STATUS SEC_ENTRY schan_EncryptMessage(PCtxtHandle context_handle ...@@ -973,7 +973,7 @@ static SECURITY_STATUS SEC_ENTRY schan_EncryptMessage(PCtxtHandle context_handle
sent += length; sent += length;
} }
TRACE("Sent %zd bytes\n", sent); TRACE("Sent %ld bytes\n", sent);
b = &transport.out; b = &transport.out;
b->desc->pBuffers[b->current_buffer_idx].cbBuffer = b->offset; b->desc->pBuffers[b->current_buffer_idx].cbBuffer = b->offset;
...@@ -1055,7 +1055,7 @@ static SECURITY_STATUS SEC_ENTRY schan_DecryptMessage(PCtxtHandle context_handle ...@@ -1055,7 +1055,7 @@ static SECURITY_STATUS SEC_ENTRY schan_DecryptMessage(PCtxtHandle context_handle
SIZE_T data_size; SIZE_T data_size;
char *data; char *data;
unsigned expected_size; unsigned expected_size;
ssize_t received = 0; SSIZE_T received = 0;
int idx; int idx;
unsigned char *buf_ptr; unsigned char *buf_ptr;
...@@ -1101,7 +1101,7 @@ static SECURITY_STATUS SEC_ENTRY schan_DecryptMessage(PCtxtHandle context_handle ...@@ -1101,7 +1101,7 @@ static SECURITY_STATUS SEC_ENTRY schan_DecryptMessage(PCtxtHandle context_handle
while (received < data_size) 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); SECURITY_STATUS status = schan_imp_recv(ctx->session, data + received, &length);
if (status == SEC_I_CONTINUE_NEEDED) if (status == SEC_I_CONTINUE_NEEDED)
{ {
...@@ -1125,7 +1125,7 @@ static SECURITY_STATUS SEC_ENTRY schan_DecryptMessage(PCtxtHandle context_handle ...@@ -1125,7 +1125,7 @@ static SECURITY_STATUS SEC_ENTRY schan_DecryptMessage(PCtxtHandle context_handle
received += length; received += length;
} }
TRACE("Received %zd bytes\n", received); TRACE("Received %ld bytes\n", received);
memcpy(buf_ptr + 5, data, received); memcpy(buf_ptr + 5, data, received);
HeapFree(GetProcessHeap(), 0, data); HeapFree(GetProcessHeap(), 0, data);
......
...@@ -331,7 +331,7 @@ SECURITY_STATUS schan_imp_get_session_peer_certificate(schan_imp_session session ...@@ -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, 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; gnutls_session_t s = (gnutls_session_t)session;
ssize_t ret = pgnutls_record_send(s, buffer, *length); 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, ...@@ -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, 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; gnutls_session_t s = (gnutls_session_t)session;
ssize_t ret = pgnutls_record_recv(s, buffer, *length); 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) ...@@ -378,15 +378,14 @@ static ALG_ID schan_get_kx_algid(const struct cipher_suite* c)
* other error code for failure. * other error code for failure.
*/ */
static OSStatus schan_pull_adapter(SSLConnectionRef transport, void *buff, 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; struct mac_session *s = (struct mac_session*)transport;
size_t requested = *buff_len; size_t requested = *buff_len;
int status; int status;
OSStatus ret; OSStatus ret;
TRACE("(%p/%p, %p, %p/%lu)\n", s, s->transport, buff, buff_len, TRACE("(%p/%p, %p, %p/%lu)\n", s, s->transport, buff, buff_len, *buff_len);
(unsigned long)*buff_len);
status = schan_pull(s->transport, buff, buff_len); status = schan_pull(s->transport, buff, buff_len);
if (status == 0) if (status == 0)
...@@ -398,12 +397,12 @@ static OSStatus schan_pull_adapter(SSLConnectionRef transport, void *buff, ...@@ -398,12 +397,12 @@ static OSStatus schan_pull_adapter(SSLConnectionRef transport, void *buff,
} }
else if (*buff_len < requested) 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; ret = errSSLWouldBlock;
} }
else else
{ {
TRACE("Pulled %lu bytes\n", (unsigned long)*buff_len); TRACE("Pulled %lu bytes\n", *buff_len);
ret = noErr; ret = noErr;
} }
} }
...@@ -439,19 +438,18 @@ static OSStatus schan_pull_adapter(SSLConnectionRef transport, void *buff, ...@@ -439,19 +438,18 @@ static OSStatus schan_pull_adapter(SSLConnectionRef transport, void *buff,
* other error code for failure. * other error code for failure.
*/ */
static OSStatus schan_push_adapter(SSLConnectionRef transport, const void *buff, 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; struct mac_session *s = (struct mac_session*)transport;
int status; int status;
OSStatus ret; OSStatus ret;
TRACE("(%p/%p, %p, %p/%lu)\n", s, s->transport, buff, buff_len, TRACE("(%p/%p, %p, %p/%lu)\n", s, s->transport, buff, buff_len, *buff_len);
(unsigned long)*buff_len);
status = schan_push(s->transport, buff, buff_len); status = schan_push(s->transport, buff, buff_len);
if (status == 0) if (status == 0)
{ {
TRACE("Pushed %lu bytes\n", (unsigned long)*buff_len); TRACE("Pushed %lu bytes\n", *buff_len);
ret = noErr; ret = noErr;
} }
else if (status == EAGAIN) else if (status == EAGAIN)
...@@ -707,16 +705,16 @@ SECURITY_STATUS schan_imp_get_session_peer_certificate(schan_imp_session session ...@@ -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, 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; struct mac_session* s = (struct mac_session*)session;
OSStatus status; 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); status = SSLWrite(s->context, buffer, *length, length);
if (status == noErr) if (status == noErr)
TRACE("Wrote %lu bytes\n", (unsigned long)*length); TRACE("Wrote %lu bytes\n", *length);
else if (status == errSSLWouldBlock) else if (status == errSSLWouldBlock)
{ {
if (!*length) if (!*length)
...@@ -725,7 +723,7 @@ SECURITY_STATUS schan_imp_send(schan_imp_session session, const void *buffer, ...@@ -725,7 +723,7 @@ SECURITY_STATUS schan_imp_send(schan_imp_session session, const void *buffer,
return SEC_I_CONTINUE_NEEDED; return SEC_I_CONTINUE_NEEDED;
} }
else else
TRACE("Wrote %lu bytes before would block\n", (unsigned long)*length); TRACE("Wrote %lu bytes before would block\n", *length);
} }
else else
{ {
...@@ -737,16 +735,16 @@ SECURITY_STATUS schan_imp_send(schan_imp_session session, const void *buffer, ...@@ -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, 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; struct mac_session* s = (struct mac_session*)session;
OSStatus status; 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); status = SSLRead(s->context, buffer, *length, length);
if (status == noErr) if (status == noErr)
TRACE("Read %lu bytes\n", (unsigned long)*length); TRACE("Read %lu bytes\n", *length);
else if (status == errSSLWouldBlock) else if (status == errSSLWouldBlock)
{ {
if (!*length) if (!*length)
...@@ -755,7 +753,7 @@ SECURITY_STATUS schan_imp_recv(schan_imp_session session, void *buffer, ...@@ -755,7 +753,7 @@ SECURITY_STATUS schan_imp_recv(schan_imp_session session, void *buffer,
return SEC_I_CONTINUE_NEEDED; return SEC_I_CONTINUE_NEEDED;
} }
else else
TRACE("Read %lu bytes before would block\n", (unsigned long)*length); TRACE("Read %lu bytes before would block\n", *length);
} }
else else
{ {
......
...@@ -201,9 +201,9 @@ extern SECURITY_STATUS schan_imp_get_connection_info(schan_imp_session session, ...@@ -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, extern SECURITY_STATUS schan_imp_get_session_peer_certificate(schan_imp_session session,
PCCERT_CONTEXT *cert) DECLSPEC_HIDDEN; PCCERT_CONTEXT *cert) DECLSPEC_HIDDEN;
extern SECURITY_STATUS schan_imp_send(schan_imp_session session, const void *buffer, 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, 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 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 void schan_imp_free_certificate_credentials(schan_imp_certificate_credentials c) DECLSPEC_HIDDEN;
extern BOOL schan_imp_init(void) DECLSPEC_HIDDEN; extern BOOL schan_imp_init(void) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment