Separate behaviour of out_uint8a and out_uint8p

Make them more match in_uint8a and in_uint8p in that one copies and
the other just gives you a pointer and it is up to the caller how
to fill it in. This can be useful when other APIs are used to
generate the data as it avoids a temporary buffer.
This commit is contained in:
Pierre Ossman 2019-04-10 16:29:35 +02:00
parent 6268b44f06
commit 75221eb3c5
14 changed files with 67 additions and 63 deletions

View File

@ -134,7 +134,7 @@ channel_send(STREAM s, VCHANNEL * channel)
s = sec_init(g_encryption ? SEC_ENCRYPT : 0, thislength + 8);
out_uint32_le(s, length);
out_uint32_le(s, flags);
out_uint8p(s, data, thislength);
out_uint8a(s, data, thislength);
s_mark_end(s);
sec_send_to_channel(s, g_encryption ? SEC_ENCRYPT : 0, channel->mcs_id);

View File

@ -48,7 +48,7 @@ cliprdr_send_packet(uint16 type, uint16 status, uint8 * data, uint32 length)
out_uint16_le(s, type);
out_uint16_le(s, status);
out_uint32_le(s, length);
out_uint8p(s, data, length);
out_uint8a(s, data, length);
out_uint32(s, 0); /* pad? */
s_mark_end(s);
channel_send(s, cliprdr_channel);

48
cssp.c
View File

@ -38,7 +38,7 @@ ber_wrap_hdr_data(int tagval, STREAM in)
out = s_alloc(size);
ber_out_header(out, tagval, s_length(in));
out_uint8p(out, in->data, s_length(in));
out_uint8a(out, in->data, s_length(in));
s_mark_end(out);
return out;
@ -170,7 +170,7 @@ cssp_gss_wrap(gss_ctx_id_t ctx, STREAM in, STREAM out)
// write enc data to out stream
out->data = out->p = xmalloc(outbuf.length);
out->size = outbuf.length;
out_uint8p(out, outbuf.value, outbuf.length);
out_uint8a(out, outbuf.value, outbuf.length);
s_mark_end(out);
gss_release_buffer(&minor_status, &outbuf);
@ -201,7 +201,7 @@ cssp_gss_unwrap(gss_ctx_id_t ctx, STREAM in, STREAM out)
out->data = out->p = xmalloc(outbuf.length);
out->size = outbuf.length;
out_uint8p(out, outbuf.value, outbuf.length);
out_uint8a(out, outbuf.value, outbuf.length);
s_mark_end(out);
gss_release_buffer(&minor_status, &outbuf);
@ -229,7 +229,7 @@ cssp_encode_tspasswordcreds(char *username, char *password, char *domain)
h2 = ber_wrap_hdr_data(BER_TAG_OCTET_STRING, &tmp);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 0, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
out_uint8a(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h2);
s_free(h1);
@ -242,7 +242,7 @@ cssp_encode_tspasswordcreds(char *username, char *password, char *domain)
h2 = ber_wrap_hdr_data(BER_TAG_OCTET_STRING, &tmp);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 1, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
out_uint8a(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h2);
s_free(h1);
@ -254,7 +254,7 @@ cssp_encode_tspasswordcreds(char *username, char *password, char *domain)
h2 = ber_wrap_hdr_data(BER_TAG_OCTET_STRING, &tmp);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 2, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
out_uint8a(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h2);
s_free(h1);
@ -290,7 +290,7 @@ cssp_encode_tscspdatadetail(unsigned char keyspec, char *card, char *reader, cha
h2 = ber_wrap_hdr_data(BER_TAG_INTEGER, &tmp);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 0, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
out_uint8a(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h2);
s_free(h1);
@ -304,7 +304,7 @@ cssp_encode_tscspdatadetail(unsigned char keyspec, char *card, char *reader, cha
h2 = ber_wrap_hdr_data(BER_TAG_OCTET_STRING, &tmp);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 1, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
out_uint8a(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h2);
s_free(h1);
@ -319,7 +319,7 @@ cssp_encode_tscspdatadetail(unsigned char keyspec, char *card, char *reader, cha
h2 = ber_wrap_hdr_data(BER_TAG_OCTET_STRING, &tmp);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 2, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
out_uint8a(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h2);
s_free(h1);
@ -334,7 +334,7 @@ cssp_encode_tscspdatadetail(unsigned char keyspec, char *card, char *reader, cha
h2 = ber_wrap_hdr_data(BER_TAG_OCTET_STRING, &tmp);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 3, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
out_uint8a(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h2);
s_free(h1);
@ -349,7 +349,7 @@ cssp_encode_tscspdatadetail(unsigned char keyspec, char *card, char *reader, cha
h2 = ber_wrap_hdr_data(BER_TAG_OCTET_STRING, &tmp);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 4, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
out_uint8a(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h2);
s_free(h1);
@ -382,7 +382,7 @@ cssp_encode_tssmartcardcreds(char *username, char *password, char *domain)
h2 = ber_wrap_hdr_data(BER_TAG_OCTET_STRING, &tmp);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 0, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
out_uint8a(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h2);
s_free(h1);
@ -392,7 +392,7 @@ cssp_encode_tssmartcardcreds(char *username, char *password, char *domain)
g_sc_container_name, g_sc_csp_name);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 1, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
out_uint8a(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h2);
s_free(h1);
@ -406,7 +406,7 @@ cssp_encode_tssmartcardcreds(char *username, char *password, char *domain)
h2 = ber_wrap_hdr_data(BER_TAG_OCTET_STRING, &tmp);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 2, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
out_uint8a(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h2);
s_free(h1);
@ -421,7 +421,7 @@ cssp_encode_tssmartcardcreds(char *username, char *password, char *domain)
h2 = ber_wrap_hdr_data(BER_TAG_OCTET_STRING, &tmp);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 3, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
out_uint8a(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h2);
s_free(h1);
@ -462,7 +462,7 @@ cssp_encode_tscredentials(char *username, char *password, char *domain)
h2 = ber_wrap_hdr_data(BER_TAG_INTEGER, &tmp);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 0, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
out_uint8a(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h2);
s_free(h1);
@ -480,7 +480,7 @@ cssp_encode_tscredentials(char *username, char *password, char *domain)
h2 = ber_wrap_hdr_data(BER_TAG_OCTET_STRING, h3);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 1, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
out_uint8a(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h3);
s_free(h2);
@ -516,7 +516,7 @@ cssp_send_tsrequest(STREAM token, STREAM auth, STREAM pubkey)
h2 = ber_wrap_hdr_data(BER_TAG_INTEGER, &tmp);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 0, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
out_uint8a(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h2);
s_free(h1);
@ -530,7 +530,7 @@ cssp_send_tsrequest(STREAM token, STREAM auth, STREAM pubkey)
h2 = ber_wrap_hdr_data(BER_TAG_SEQUENCE | BER_TAG_CONSTRUCTED, h3);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 1, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
out_uint8a(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h5);
s_free(h4);
@ -546,7 +546,7 @@ cssp_send_tsrequest(STREAM token, STREAM auth, STREAM pubkey)
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 2, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
out_uint8a(&message, h1->data, s_length(h1));
s_free(h2);
s_free(h1);
@ -559,7 +559,7 @@ cssp_send_tsrequest(STREAM token, STREAM auth, STREAM pubkey)
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 3, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
out_uint8a(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h2);
s_free(h1);
@ -570,7 +570,7 @@ cssp_send_tsrequest(STREAM token, STREAM auth, STREAM pubkey)
// Todo: can h1 be send directly instead of tcp_init() approach
h1 = ber_wrap_hdr_data(BER_TAG_SEQUENCE | BER_TAG_CONSTRUCTED, &message);
s = tcp_init(s_length(h1));
out_uint8p(s, h1->data, s_length(h1));
out_uint8a(s, h1->data, s_length(h1));
s_mark_end(s);
s_free(h1);
@ -664,7 +664,7 @@ cssp_read_tsrequest(STREAM token, STREAM pubkey)
s_realloc(token, length);
s_reset(token);
out_uint8p(token, s->p, length);
out_uint8a(token, s->p, length);
s_mark_end(token);
}
@ -785,7 +785,7 @@ cssp_connect(char *server, char *user, char *domain, char *password, STREAM s)
s_realloc(&token, output_tok.length);
s_reset(&token);
out_uint8p(&token, output_tok.value, output_tok.length);
out_uint8a(&token, output_tok.value, output_tok.length);
s_mark_end(&token);
if (!cssp_send_tsrequest(&token, NULL, NULL))

4
iso.c
View File

@ -78,8 +78,8 @@ iso_send_connection_request(char *username, uint32 neg_proto)
out_uint16(s, 0); /* src_ref */
out_uint8(s, 0); /* class */
out_uint8p(s, "Cookie: mstshash=", strlen("Cookie: mstshash="));
out_uint8p(s, username, strlen(username));
out_uint8a(s, "Cookie: mstshash=", strlen("Cookie: mstshash="));
out_uint8a(s, username, strlen(username));
out_uint8(s, 0x0d); /* cookie termination string: CR+LF */
out_uint8(s, 0x0a);

View File

@ -79,21 +79,21 @@ licence_info(uint8 * client_random, uint8 * rsa_data,
out_uint16(s, 0);
out_uint16_le(s, 0x0201);
out_uint8p(s, client_random, SEC_RANDOM_SIZE);
out_uint8a(s, client_random, SEC_RANDOM_SIZE);
out_uint16_le(s, 2);
out_uint16_le(s, (SEC_MODULUS_SIZE + SEC_PADDING_SIZE));
out_uint8p(s, rsa_data, SEC_MODULUS_SIZE);
out_uint8a(s, rsa_data, SEC_MODULUS_SIZE);
out_uint8s(s, SEC_PADDING_SIZE);
out_uint16_le(s, 1);
out_uint16_le(s, licence_size);
out_uint8p(s, licence_data, licence_size);
out_uint8a(s, licence_data, licence_size);
out_uint16_le(s, 1);
out_uint16_le(s, LICENCE_HWID_SIZE);
out_uint8p(s, hwid, LICENCE_HWID_SIZE);
out_uint8a(s, hwid, LICENCE_HWID_SIZE);
out_uint8p(s, signature, LICENCE_SIGNATURE_SIZE);
out_uint8a(s, signature, LICENCE_SIGNATURE_SIZE);
s_mark_end(s);
sec_send(s, sec_flags);
@ -120,21 +120,21 @@ licence_send_new_licence_request(uint8 * client_random, uint8 * rsa_data, char *
out_uint16(s, 0);
out_uint16_le(s, 0xff01);
out_uint8p(s, client_random, SEC_RANDOM_SIZE);
out_uint8a(s, client_random, SEC_RANDOM_SIZE);
out_uint16_le(s, 2);
out_uint16_le(s, (SEC_MODULUS_SIZE + SEC_PADDING_SIZE));
out_uint8p(s, rsa_data, SEC_MODULUS_SIZE);
out_uint8a(s, rsa_data, SEC_MODULUS_SIZE);
out_uint8s(s, SEC_PADDING_SIZE);
/* Username LICENSE_BINARY_BLOB */
out_uint16_le(s, BB_CLIENT_USER_NAME_BLOB);
out_uint16_le(s, userlen);
out_uint8p(s, user, userlen);
out_uint8a(s, user, userlen);
/* Machinename LICENSE_BINARY_BLOB */
out_uint16_le(s, BB_CLIENT_MACHINE_NAME_BLOB);
out_uint16_le(s, hostlen);
out_uint8p(s, host, hostlen);
out_uint8a(s, host, hostlen);
s_mark_end(s);
sec_send(s, sec_flags);
@ -204,13 +204,13 @@ licence_send_platform_challenge_response(uint8 * token, uint8 * crypt_hwid, uint
out_uint16_le(s, 1);
out_uint16_le(s, LICENCE_TOKEN_SIZE);
out_uint8p(s, token, LICENCE_TOKEN_SIZE);
out_uint8a(s, token, LICENCE_TOKEN_SIZE);
out_uint16_le(s, 1);
out_uint16_le(s, LICENCE_HWID_SIZE);
out_uint8p(s, crypt_hwid, LICENCE_HWID_SIZE);
out_uint8a(s, crypt_hwid, LICENCE_HWID_SIZE);
out_uint8p(s, signature, LICENCE_SIGNATURE_SIZE);
out_uint8a(s, signature, LICENCE_SIGNATURE_SIZE);
s_mark_end(s);
sec_send(s, sec_flags);

View File

@ -163,6 +163,6 @@ lspci_send(const char *output)
len = strlen(output);
s = channel_init(lspci_channel, len);
out_uint8p(s, output, len) s_mark_end(s);
out_uint8a(s, output, len) s_mark_end(s);
channel_send(s, lspci_channel);
}

2
mcs.c
View File

@ -82,7 +82,7 @@ mcs_send_connect_initial(STREAM mcs_data)
mcs_out_domain_params(s, 0xffff, 0xfc17, 0xffff, 0xffff); /* max params */
ber_out_header(s, BER_TAG_OCTET_STRING, datalen);
out_uint8p(s, mcs_data->data, datalen);
out_uint8a(s, mcs_data->data, datalen);
s_mark_end(s);
iso_send(s);

6
rdp.c
View File

@ -469,7 +469,7 @@ rdp_send_client_info_pdu(uint32 flags, char *domain, char *user,
if (g_redirect == True && 0 < g_redirect_cookie_len)
{
out_uint8p(s, g_redirect_cookie, g_redirect_cookie_len);
out_uint8a(s, g_redirect_cookie, g_redirect_cookie_len);
}
else
{
@ -792,7 +792,7 @@ rdp_out_ts_order_capabilityset(STREAM s)
out_uint16_le(s, 1); /* maximumOrderLevel (ignored, should be 1) */
out_uint16_le(s, 0); /* numberFonts (ignored, should be 0) */
out_uint16_le(s, orderflags); /* orderFlags */
out_uint8p(s, order_caps, 32); /* orderSupport */
out_uint8a(s, order_caps, 32); /* orderSupport */
out_uint16_le(s, 0); /* textFlags (ignored) */
out_uint16_le(s, 0); /* orderSupportExFlags */
out_uint32_le(s, 0); /* pad4OctetsB */
@ -1096,7 +1096,7 @@ rdp_send_confirm_active(void)
out_uint16_le(s, sizeof(RDP_SOURCE));
out_uint16_le(s, caplen);
out_uint8p(s, RDP_SOURCE, sizeof(RDP_SOURCE));
out_uint8a(s, RDP_SOURCE, sizeof(RDP_SOURCE));
out_uint16_le(s, 17); /* num_caps */
out_uint8s(s, 2); /* pad */

2
rdp5.c
View File

@ -140,7 +140,7 @@ process_ts_fp_updates(STREAM s)
s_reset(assembled[code]);
}
out_uint8p(assembled[code], ts->p, length);
out_uint8a(assembled[code], ts->p, length);
if (frag == FASTPATH_FRAGMENT_LAST)
{

View File

@ -300,7 +300,7 @@ rdpdr_send_client_device_list_announce(void)
{
out_uint32_le(s, g_rdpdr_device[i].device_type);
out_uint32_le(s, i); /* RDP Device ID */
out_uint8p(s, g_rdpdr_device[i].name, 8); /* preferredDosName, limited to 8 characters */
out_uint8a(s, g_rdpdr_device[i].name, 8); /* preferredDosName, limited to 8 characters */
switch (g_rdpdr_device[i].device_type)
{
case DEVICE_TYPE_DISK:
@ -314,7 +314,7 @@ rdpdr_send_client_device_list_announce(void)
disklen = strlen(diskinfo->name) + 1;
out_uint32_le(s, disklen); /* DeviceDataLength */
out_uint8p(s, diskinfo->name, disklen); /* DeviceData */
out_uint8a(s, diskinfo->name, disklen); /* DeviceData */
break;
case DEVICE_TYPE_PRINTER:
@ -385,7 +385,7 @@ rdpdr_send_completion(uint32 device, uint32 id, uint32 status, uint32 result, ui
out_uint32_le(s, status);
out_uint32_le(s, result);
if (length)
out_uint8p(s, buffer, length);
out_uint8a(s, buffer, length);
s_mark_end(s);
logger(Protocol, Debug, "rdpdr_send_completion()");

18
scard.c
View File

@ -548,7 +548,7 @@ outBufferFinishWithLimit(STREAM out, char *buffer, unsigned int length, unsigned
{
if (header < length)
length = header;
out_uint8p(out, buffer, length);
out_uint8a(out, buffer, length);
outRepos(out, length);
}
}
@ -624,11 +624,11 @@ outString(STREAM out, char *source, RD_BOOL wide)
buffer[2 * i] = reader[i];
buffer[2 * i + 1] = '\0';
}
out_uint8p(out, buffer, 2 * dataLength);
out_uint8a(out, buffer, 2 * dataLength);
}
else
{
out_uint8p(out, reader, dataLength);
out_uint8a(out, reader, dataLength);
}
SC_xfreeallmemory(&lcHandle);
@ -1255,7 +1255,7 @@ TS_SCardGetStatusChange(STREAM in, STREAM out, RD_BOOL wide)
cur->dwEventState = swap32(cur->dwEventState);
cur->cbAtr = swap32(cur->cbAtr);
out_uint8p(out, (void *) ((unsigned char **) cur + 2),
out_uint8a(out, (void *) ((unsigned char **) cur + 2),
sizeof(SERVER_SCARD_READERSTATE_A) - 2 * sizeof(unsigned char *));
}
outForceAlignment(out, 8);
@ -1419,7 +1419,7 @@ TS_SCardLocateCardsByATR(STREAM in, STREAM out, RD_BOOL wide)
rsCur->dwEventState = swap32(rsCur->dwEventState);
rsCur->cbAtr = swap32(rsCur->cbAtr);
out_uint8p(out, (void *) ((unsigned char **) rsCur + 2),
out_uint8a(out, (void *) ((unsigned char **) rsCur + 2),
sizeof(SCARD_READERSTATE) - 2 * sizeof(unsigned char *));
}
@ -1795,7 +1795,7 @@ TS_SCardStatus(STREAM in, STREAM out, RD_BOOL wide)
out_uint32_le(out, 0x00020000);
out_uint32_le(out, dwState);
out_uint32_le(out, dwProtocol);
out_uint8p(out, atr, dwAtrLen);
out_uint8a(out, atr, dwAtrLen);
if (dwAtrLen < 32)
{
out_uint8s(out, 32 - dwAtrLen);
@ -1901,7 +1901,7 @@ TS_SCardState(STREAM in, STREAM out)
out_uint32_le(out, dwAtrLen);
out_uint32_le(out, 0x00000001);
out_uint32_le(out, dwAtrLen);
out_uint8p(out, atr, dwAtrLen);
out_uint8a(out, atr, dwAtrLen);
outRepos(out, dwAtrLen);
}
outForceAlignment(out, 8);
@ -2038,7 +2038,7 @@ TS_SCardGetAttrib(STREAM in, STREAM out)
}
else
{
out_uint8p(out, pbAttr, dwAttrLen);
out_uint8a(out, pbAttr, dwAttrLen);
}
outRepos(out, dwAttrLen);
out_uint32_le(out, 0x00000000);
@ -2236,7 +2236,7 @@ TS_SCardControl(STREAM in, STREAM out)
out_uint32_le(out, nBytesReturned);
if (nBytesReturned > 0)
{
out_uint8p(out, pOutBuffer, nBytesReturned);
out_uint8a(out, pOutBuffer, nBytesReturned);
outRepos(out, nBytesReturned);
}

View File

@ -440,7 +440,7 @@ seamless_send(const char *command, const char *format, ...)
len++;
s = channel_init(seamless_channel, len);
out_uint8p(s, buf, len) s_mark_end(s);
out_uint8a(s, buf, len) s_mark_end(s);
logger(Core, Debug, "seamless_send(), sending '%s'", buf);

View File

@ -384,7 +384,7 @@ sec_establish_key(void)
s = sec_init(flags, length + 4);
out_uint32_le(s, length);
out_uint8p(s, g_sec_crypted_random, g_server_public_key_len);
out_uint8a(s, g_sec_crypted_random, g_server_public_key_len);
out_uint8s(s, SEC_PADDING_SIZE);
s_mark_end(s);

View File

@ -127,14 +127,18 @@ size_t in_ansi_string(STREAM s, char *string, size_t len);
#endif
#define in_uint8(s,v) { s_assert_r(s, 1); v = *((s)->p++); }
/* Return a pointer in v to manually read n bytes from STREAM s */
#define in_uint8p(s,v,n) { s_assert_r(s, n); v = (s)->p; (s)->p += n; }
/* Copy n bytes from STREAM s in to array v */
#define in_uint8a(s,v,n) { s_assert_r(s, n); memcpy(v,(s)->p,n); (s)->p += n; }
#define in_uint8s(s,n) { s_assert_r(s, n); (s)->p += n; }
#define out_uint8(s,v) { s_assert_w(s, 1); *((s)->p++) = v; }
#define out_uint8p(s,v,n) { s_assert_w(s, n); memcpy((s)->p,v,n); (s)->p += n; }
#define out_uint8a(s,v,n) out_uint8p(s,v,n);
/* Return a pointer in v to manually fill in n bytes in STREAM s */
#define out_uint8p(s,v,n) { s_assert_w(s, n); v = (s)->p; (s)->p += n; }
/* Copy n bytes from array v in to STREAM s */
#define out_uint8a(s,v,n) { s_assert_w(s, n); memcpy((s)->p,v,n); (s)->p += n; }
#define out_uint8s(s,n) { s_assert_w(s, n); memset((s)->p,0,n); (s)->p += n; }
#define out_stream(s, v) out_uint8p(s, (v)->data, s_length((v)))
#define out_stream(s, v) out_uint8a(s, (v)->data, s_length((v)))
#define next_be(s,v) { s_assert_r(s, 1); v = ((v) << 8) + *((s)->p++); }