always use GNUNET_memcpy
This commit is contained in:
parent
3ebd0a70b2
commit
c014acf3c4
@ -172,9 +172,9 @@ coin_history_index (const struct TALER_CoinSpendPublicKeyP *coin_pub)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
memcpy (&i,
|
||||
coin_pub,
|
||||
sizeof (i));
|
||||
GNUNET_memcpy (&i,
|
||||
coin_pub,
|
||||
sizeof (i));
|
||||
return i % MAX_COIN_HISTORIES;
|
||||
}
|
||||
|
||||
|
@ -674,12 +674,12 @@ hash_rc (const char *receiver_account,
|
||||
size_t slen = strlen (receiver_account);
|
||||
char buf[sizeof (struct TALER_WireTransferIdentifierRawP) + slen];
|
||||
|
||||
memcpy (buf,
|
||||
wtid,
|
||||
sizeof (*wtid));
|
||||
memcpy (&buf[sizeof (*wtid)],
|
||||
receiver_account,
|
||||
slen);
|
||||
GNUNET_memcpy (buf,
|
||||
wtid,
|
||||
sizeof (*wtid));
|
||||
GNUNET_memcpy (&buf[sizeof (*wtid)],
|
||||
receiver_account,
|
||||
slen);
|
||||
GNUNET_CRYPTO_hash (buf,
|
||||
sizeof (buf),
|
||||
key);
|
||||
@ -1504,9 +1504,9 @@ history_debit_cb (void *cls,
|
||||
roi->details.execution_date = dd->execution_date;
|
||||
roi->details.wtid = dd->wtid;
|
||||
roi->details.credit_account_uri = (const char *) &roi[1];
|
||||
memcpy (&roi[1],
|
||||
dd->credit_account_uri,
|
||||
slen);
|
||||
GNUNET_memcpy (&roi[1],
|
||||
dd->credit_account_uri,
|
||||
slen);
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_CONTAINER_multihashmap_put (out_map,
|
||||
&roi->subject_hash,
|
||||
@ -1678,9 +1678,9 @@ reserve_in_cb (void *cls,
|
||||
rii->details.execution_date = execution_date;
|
||||
rii->details.reserve_pub = *reserve_pub;
|
||||
rii->details.debit_account_uri = (const char *) &rii[1];
|
||||
memcpy (&rii[1],
|
||||
sender_account_details,
|
||||
slen);
|
||||
GNUNET_memcpy (&rii[1],
|
||||
sender_account_details,
|
||||
slen);
|
||||
GNUNET_CRYPTO_hash (&wire_reference,
|
||||
sizeof (uint64_t),
|
||||
&rii->row_off_hash);
|
||||
|
@ -99,12 +99,12 @@ TALER_BANK_prepare_transfer (
|
||||
wp->account_len = htonl ((uint32_t) d_len);
|
||||
wp->exchange_url_len = htonl ((uint32_t) u_len);
|
||||
end = (char *) &wp[1];
|
||||
memcpy (end,
|
||||
destination_account_payto_uri,
|
||||
d_len);
|
||||
memcpy (end + d_len,
|
||||
exchange_base_url,
|
||||
u_len);
|
||||
GNUNET_memcpy (end,
|
||||
destination_account_payto_uri,
|
||||
d_len);
|
||||
GNUNET_memcpy (end + d_len,
|
||||
exchange_base_url,
|
||||
u_len);
|
||||
*buf = (char *) wp;
|
||||
}
|
||||
|
||||
|
@ -1389,9 +1389,9 @@ make_transfer (
|
||||
if (NULL != timestamp)
|
||||
*timestamp = t->date;
|
||||
t->type = T_DEBIT;
|
||||
memcpy (t->subject.debit.exchange_base_url,
|
||||
exchange_base_url,
|
||||
url_len);
|
||||
GNUNET_memcpy (t->subject.debit.exchange_base_url,
|
||||
exchange_base_url,
|
||||
url_len);
|
||||
t->subject.debit.wtid = *subject;
|
||||
if (NULL == request_uid)
|
||||
GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_NONCE,
|
||||
|
@ -312,10 +312,10 @@ expired_reserve_cb (void *cls,
|
||||
memset (&wtid,
|
||||
0,
|
||||
sizeof (wtid));
|
||||
memcpy (&wtid,
|
||||
reserve_pub,
|
||||
GNUNET_MIN (sizeof (wtid),
|
||||
sizeof (*reserve_pub)));
|
||||
GNUNET_memcpy (&wtid,
|
||||
reserve_pub,
|
||||
GNUNET_MIN (sizeof (wtid),
|
||||
sizeof (*reserve_pub)));
|
||||
qs = db_plugin->insert_reserve_closed (db_plugin->cls,
|
||||
reserve_pub,
|
||||
now,
|
||||
|
@ -932,9 +932,9 @@ proceed_with_handler (struct TEH_RequestContext *rc,
|
||||
|
||||
/* Parse command-line arguments */
|
||||
/* make a copy of 'url' because 'strtok_r()' will modify */
|
||||
memcpy (d,
|
||||
url,
|
||||
ulen);
|
||||
GNUNET_memcpy (d,
|
||||
url,
|
||||
ulen);
|
||||
i = 0;
|
||||
args[i++] = strtok_r (d, "/", &sp);
|
||||
while ( (NULL != args[i - 1]) &&
|
||||
|
@ -563,9 +563,9 @@ wire_prepare_cb (void *cls,
|
||||
}
|
||||
wpd = GNUNET_malloc (sizeof (struct WirePrepareData)
|
||||
+ buf_size);
|
||||
memcpy (&wpd[1],
|
||||
buf,
|
||||
buf_size);
|
||||
GNUNET_memcpy (&wpd[1],
|
||||
buf,
|
||||
buf_size);
|
||||
wpd->buf_size = buf_size;
|
||||
wpd->row_id = rowid;
|
||||
GNUNET_CONTAINER_DLL_insert (wpd_head,
|
||||
|
@ -169,9 +169,9 @@ bem_insert (struct GNUNET_PQ_Context *conn,
|
||||
GNUNET_CRYPTO_hash (&b,
|
||||
sizeof (b),
|
||||
&hc);
|
||||
memcpy (&ihc,
|
||||
&hc,
|
||||
sizeof (ihc));
|
||||
GNUNET_memcpy (&ihc,
|
||||
&hc,
|
||||
sizeof (ihc));
|
||||
{
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
GNUNET_PQ_query_param_auto_from_type (&hc),
|
||||
@ -265,9 +265,9 @@ bem_select (struct GNUNET_PQ_Context *conn,
|
||||
GNUNET_CRYPTO_hash (&b,
|
||||
sizeof (b),
|
||||
&hc);
|
||||
memcpy (&ihc,
|
||||
&hc,
|
||||
sizeof (ihc));
|
||||
GNUNET_memcpy (&ihc,
|
||||
&hc,
|
||||
sizeof (ihc));
|
||||
{
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
GNUNET_PQ_query_param_uint32 (&ihc),
|
||||
|
@ -1118,9 +1118,9 @@ lrbt_cb_table_refresh_transfer_keys (void *cls,
|
||||
ctx->error = true;
|
||||
return;
|
||||
}
|
||||
memcpy (&td.details.refresh_transfer_keys.tprivs[0],
|
||||
tpriv,
|
||||
tpriv_size);
|
||||
GNUNET_memcpy (&td.details.refresh_transfer_keys.tprivs[0],
|
||||
tpriv,
|
||||
tpriv_size);
|
||||
ctx->cb (ctx->cb_cls,
|
||||
&td);
|
||||
GNUNET_PQ_cleanup_result (rs);
|
||||
|
@ -990,9 +990,9 @@ proceed_with_handler (struct TEKT_RequestContext *rc,
|
||||
|
||||
/* Parse command-line arguments */
|
||||
/* make a copy of 'url' because 'strtok_r()' will modify */
|
||||
memcpy (d,
|
||||
url,
|
||||
ulen);
|
||||
GNUNET_memcpy (d,
|
||||
url,
|
||||
ulen);
|
||||
i = 0;
|
||||
args[i++] = strtok_r (d, "/", &sp);
|
||||
while ( (NULL != args[i - 1]) &&
|
||||
|
@ -202,21 +202,21 @@ qconv_denom_pub (void *cls,
|
||||
}
|
||||
len = tlen + sizeof (be);
|
||||
buf = GNUNET_malloc (len);
|
||||
memcpy (buf,
|
||||
be,
|
||||
sizeof (be));
|
||||
GNUNET_memcpy (buf,
|
||||
be,
|
||||
sizeof (be));
|
||||
switch (denom_pub->cipher)
|
||||
{
|
||||
case TALER_DENOMINATION_RSA:
|
||||
memcpy (&buf[sizeof (be)],
|
||||
tbuf,
|
||||
tlen);
|
||||
GNUNET_memcpy (&buf[sizeof (be)],
|
||||
tbuf,
|
||||
tlen);
|
||||
GNUNET_free (tbuf);
|
||||
break;
|
||||
case TALER_DENOMINATION_CS:
|
||||
memcpy (&buf[sizeof (be)],
|
||||
&denom_pub->details.cs_public_key,
|
||||
tlen);
|
||||
GNUNET_memcpy (&buf[sizeof (be)],
|
||||
&denom_pub->details.cs_public_key,
|
||||
tlen);
|
||||
break;
|
||||
default:
|
||||
GNUNET_assert (0);
|
||||
@ -298,21 +298,21 @@ qconv_denom_sig (void *cls,
|
||||
}
|
||||
len = tlen + sizeof (be);
|
||||
buf = GNUNET_malloc (len);
|
||||
memcpy (buf,
|
||||
&be,
|
||||
sizeof (be));
|
||||
GNUNET_memcpy (buf,
|
||||
&be,
|
||||
sizeof (be));
|
||||
switch (denom_sig->cipher)
|
||||
{
|
||||
case TALER_DENOMINATION_RSA:
|
||||
memcpy (&buf[sizeof (be)],
|
||||
tbuf,
|
||||
tlen);
|
||||
GNUNET_memcpy (&buf[sizeof (be)],
|
||||
tbuf,
|
||||
tlen);
|
||||
GNUNET_free (tbuf);
|
||||
break;
|
||||
case TALER_DENOMINATION_CS:
|
||||
memcpy (&buf[sizeof (be)],
|
||||
&denom_sig->details.cs_signature,
|
||||
tlen);
|
||||
GNUNET_memcpy (&buf[sizeof (be)],
|
||||
&denom_sig->details.cs_signature,
|
||||
tlen);
|
||||
break;
|
||||
default:
|
||||
GNUNET_assert (0);
|
||||
@ -394,21 +394,21 @@ qconv_blinded_denom_sig (void *cls,
|
||||
}
|
||||
len = tlen + sizeof (be);
|
||||
buf = GNUNET_malloc (len);
|
||||
memcpy (buf,
|
||||
&be,
|
||||
sizeof (be));
|
||||
GNUNET_memcpy (buf,
|
||||
&be,
|
||||
sizeof (be));
|
||||
switch (denom_sig->cipher)
|
||||
{
|
||||
case TALER_DENOMINATION_RSA:
|
||||
memcpy (&buf[sizeof (be)],
|
||||
tbuf,
|
||||
tlen);
|
||||
GNUNET_memcpy (&buf[sizeof (be)],
|
||||
tbuf,
|
||||
tlen);
|
||||
GNUNET_free (tbuf);
|
||||
break;
|
||||
case TALER_DENOMINATION_CS:
|
||||
memcpy (&buf[sizeof (be)],
|
||||
&denom_sig->details.blinded_cs_answer,
|
||||
tlen);
|
||||
GNUNET_memcpy (&buf[sizeof (be)],
|
||||
&denom_sig->details.blinded_cs_answer,
|
||||
tlen);
|
||||
break;
|
||||
default:
|
||||
GNUNET_assert (0);
|
||||
@ -487,20 +487,20 @@ qconv_blinded_planchet (void *cls,
|
||||
}
|
||||
len = tlen + sizeof (be);
|
||||
buf = GNUNET_malloc (len);
|
||||
memcpy (buf,
|
||||
&be,
|
||||
sizeof (be));
|
||||
GNUNET_memcpy (buf,
|
||||
&be,
|
||||
sizeof (be));
|
||||
switch (bp->cipher)
|
||||
{
|
||||
case TALER_DENOMINATION_RSA:
|
||||
memcpy (&buf[sizeof (be)],
|
||||
bp->details.rsa_blinded_planchet.blinded_msg,
|
||||
tlen);
|
||||
GNUNET_memcpy (&buf[sizeof (be)],
|
||||
bp->details.rsa_blinded_planchet.blinded_msg,
|
||||
tlen);
|
||||
break;
|
||||
case TALER_DENOMINATION_CS:
|
||||
memcpy (&buf[sizeof (be)],
|
||||
&bp->details.cs_blinded_planchet,
|
||||
tlen);
|
||||
GNUNET_memcpy (&buf[sizeof (be)],
|
||||
&bp->details.cs_blinded_planchet,
|
||||
tlen);
|
||||
break;
|
||||
default:
|
||||
GNUNET_assert (0);
|
||||
@ -578,17 +578,17 @@ qconv_exchange_withdraw_values (void *cls,
|
||||
}
|
||||
len = tlen + sizeof (be);
|
||||
buf = GNUNET_malloc (len);
|
||||
memcpy (buf,
|
||||
&be,
|
||||
sizeof (be));
|
||||
GNUNET_memcpy (buf,
|
||||
&be,
|
||||
sizeof (be));
|
||||
switch (alg_values->cipher)
|
||||
{
|
||||
case TALER_DENOMINATION_RSA:
|
||||
break;
|
||||
case TALER_DENOMINATION_CS:
|
||||
memcpy (&buf[sizeof (be)],
|
||||
&alg_values->details.cs_values,
|
||||
tlen);
|
||||
GNUNET_memcpy (&buf[sizeof (be)],
|
||||
&alg_values->details.cs_values,
|
||||
tlen);
|
||||
break;
|
||||
default:
|
||||
GNUNET_assert (0);
|
||||
|
@ -113,9 +113,9 @@ extract_amount_nbo_helper (PGresult *result,
|
||||
}
|
||||
len = GNUNET_MIN (TALER_CURRENCY_LEN - 1,
|
||||
strlen (currency));
|
||||
memcpy (r_amount_nbo->currency,
|
||||
currency,
|
||||
len);
|
||||
GNUNET_memcpy (r_amount_nbo->currency,
|
||||
currency,
|
||||
len);
|
||||
return GNUNET_OK;
|
||||
}
|
||||
|
||||
@ -420,9 +420,9 @@ extract_denom_pub (void *cls,
|
||||
GNUNET_break (0);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
memcpy (be,
|
||||
res,
|
||||
sizeof (be));
|
||||
GNUNET_memcpy (be,
|
||||
res,
|
||||
sizeof (be));
|
||||
res += sizeof (be);
|
||||
len -= sizeof (be);
|
||||
pk->cipher = ntohl (be[0]);
|
||||
@ -445,9 +445,9 @@ extract_denom_pub (void *cls,
|
||||
GNUNET_break (0);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
memcpy (&pk->details.cs_public_key,
|
||||
res,
|
||||
len);
|
||||
GNUNET_memcpy (&pk->details.cs_public_key,
|
||||
res,
|
||||
len);
|
||||
return GNUNET_OK;
|
||||
default:
|
||||
GNUNET_break (0);
|
||||
@ -543,9 +543,9 @@ extract_denom_sig (void *cls,
|
||||
GNUNET_break (0);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
memcpy (&be,
|
||||
res,
|
||||
sizeof (be));
|
||||
GNUNET_memcpy (&be,
|
||||
res,
|
||||
sizeof (be));
|
||||
if (0x00 != ntohl (be[1]))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
@ -572,9 +572,9 @@ extract_denom_sig (void *cls,
|
||||
GNUNET_break (0);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
memcpy (&sig->details.cs_signature,
|
||||
res,
|
||||
len);
|
||||
GNUNET_memcpy (&sig->details.cs_signature,
|
||||
res,
|
||||
len);
|
||||
return GNUNET_OK;
|
||||
default:
|
||||
GNUNET_break (0);
|
||||
@ -670,9 +670,9 @@ extract_blinded_denom_sig (void *cls,
|
||||
GNUNET_break (0);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
memcpy (&be,
|
||||
res,
|
||||
sizeof (be));
|
||||
GNUNET_memcpy (&be,
|
||||
res,
|
||||
sizeof (be));
|
||||
if (0x01 != ntohl (be[1])) /* magic marker: blinded */
|
||||
{
|
||||
GNUNET_break (0);
|
||||
@ -699,9 +699,9 @@ extract_blinded_denom_sig (void *cls,
|
||||
GNUNET_break (0);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
memcpy (&sig->details.blinded_cs_answer,
|
||||
res,
|
||||
len);
|
||||
GNUNET_memcpy (&sig->details.blinded_cs_answer,
|
||||
res,
|
||||
len);
|
||||
return GNUNET_OK;
|
||||
default:
|
||||
GNUNET_break (0);
|
||||
@ -798,9 +798,9 @@ extract_blinded_planchet (void *cls,
|
||||
GNUNET_break (0);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
memcpy (&be,
|
||||
res,
|
||||
sizeof (be));
|
||||
GNUNET_memcpy (&be,
|
||||
res,
|
||||
sizeof (be));
|
||||
if (0x0100 != ntohl (be[1])) /* magic marker: blinded */
|
||||
{
|
||||
GNUNET_break (0);
|
||||
@ -824,9 +824,9 @@ extract_blinded_planchet (void *cls,
|
||||
GNUNET_break (0);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
memcpy (&bp->details.cs_blinded_planchet,
|
||||
res,
|
||||
len);
|
||||
GNUNET_memcpy (&bp->details.cs_blinded_planchet,
|
||||
res,
|
||||
len);
|
||||
return GNUNET_OK;
|
||||
default:
|
||||
GNUNET_break (0);
|
||||
@ -923,9 +923,9 @@ extract_exchange_withdraw_values (void *cls,
|
||||
GNUNET_break (0);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
memcpy (&be,
|
||||
res,
|
||||
sizeof (be));
|
||||
GNUNET_memcpy (&be,
|
||||
res,
|
||||
sizeof (be));
|
||||
if (0x010000 != ntohl (be[1])) /* magic marker: EWV */
|
||||
{
|
||||
GNUNET_break (0);
|
||||
@ -949,9 +949,9 @@ extract_exchange_withdraw_values (void *cls,
|
||||
GNUNET_break (0);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
memcpy (&alg_values->details.cs_values,
|
||||
res,
|
||||
len);
|
||||
GNUNET_memcpy (&alg_values->details.cs_values,
|
||||
res,
|
||||
len);
|
||||
return GNUNET_OK;
|
||||
default:
|
||||
GNUNET_break (0);
|
||||
|
@ -297,7 +297,7 @@ static int process(const char *template, struct iwrap *iwrap, FILE *file, const
|
||||
#endif
|
||||
if (len > MUSTACH_MAX_LENGTH)
|
||||
return MUSTACH_ERROR_TAG_TOO_LONG;
|
||||
memcpy(name, beg, len);
|
||||
GNUNET_memcpy(name, beg, len);
|
||||
name[len] = 0;
|
||||
break;
|
||||
}
|
||||
@ -317,7 +317,7 @@ static int process(const char *template, struct iwrap *iwrap, FILE *file, const
|
||||
return MUSTACH_ERROR_BAD_SEPARATORS;
|
||||
oplen = l;
|
||||
tmp = alloca(oplen + 1);
|
||||
memcpy(tmp, beg, oplen);
|
||||
GNUNET_memcpy(tmp, beg, oplen);
|
||||
tmp[oplen] = 0;
|
||||
opstr = tmp;
|
||||
while (l < len && isspace(beg[l])) l++;
|
||||
@ -325,7 +325,7 @@ static int process(const char *template, struct iwrap *iwrap, FILE *file, const
|
||||
return MUSTACH_ERROR_BAD_SEPARATORS;
|
||||
cllen = len - l;
|
||||
tmp = alloca(cllen + 1);
|
||||
memcpy(tmp, beg + l, cllen);
|
||||
GNUNET_memcpy(tmp, beg + l, cllen);
|
||||
tmp[cllen] = 0;
|
||||
clstr = tmp;
|
||||
break;
|
||||
|
@ -85,9 +85,9 @@ run (void *cls,
|
||||
memset (&wtid,
|
||||
0x5a,
|
||||
sizeof (wtid));
|
||||
memcpy (&exchange_auth_twisted,
|
||||
&bc.exchange_auth,
|
||||
sizeof (struct TALER_BANK_AuthenticationData));
|
||||
GNUNET_memcpy (&exchange_auth_twisted,
|
||||
&bc.exchange_auth,
|
||||
sizeof (struct TALER_BANK_AuthenticationData));
|
||||
if (with_fakebank)
|
||||
exchange_auth_twisted.wire_gateway_url =
|
||||
"http://localhost:8888/2/";
|
||||
|
@ -150,9 +150,9 @@ TALER_TESTING_cmd_batch (const char *label,
|
||||
|
||||
bs->batch = GNUNET_new_array (i + 1,
|
||||
struct TALER_TESTING_Command);
|
||||
memcpy (bs->batch,
|
||||
batch,
|
||||
sizeof (struct TALER_TESTING_Command) * i);
|
||||
GNUNET_memcpy (bs->batch,
|
||||
batch,
|
||||
sizeof (struct TALER_TESTING_Command) * i);
|
||||
{
|
||||
struct TALER_TESTING_Command cmd = {
|
||||
.cls = bs,
|
||||
|
@ -452,9 +452,9 @@ TALER_TESTING_run2 (struct TALER_TESTING_Interpreter *is,
|
||||
is->commands = GNUNET_malloc_large ( (i + 1)
|
||||
* sizeof (struct TALER_TESTING_Command));
|
||||
GNUNET_assert (NULL != is->commands);
|
||||
memcpy (is->commands,
|
||||
commands,
|
||||
sizeof (struct TALER_TESTING_Command) * i);
|
||||
GNUNET_memcpy (is->commands,
|
||||
commands,
|
||||
sizeof (struct TALER_TESTING_Command) * i);
|
||||
is->timeout_task = GNUNET_SCHEDULER_add_delayed (
|
||||
timeout,
|
||||
&do_timeout,
|
||||
|
@ -72,9 +72,9 @@ TALER_string_to_amount (const char *str,
|
||||
}
|
||||
|
||||
GNUNET_assert (TALER_CURRENCY_LEN > (colon - str));
|
||||
memcpy (amount->currency,
|
||||
str,
|
||||
colon - str);
|
||||
GNUNET_memcpy (amount->currency,
|
||||
str,
|
||||
colon - str);
|
||||
/* 0-terminate *and* normalize buffer by setting everything to '\0' */
|
||||
memset (&amount->currency [colon - str],
|
||||
0,
|
||||
@ -193,9 +193,9 @@ TALER_amount_hton (struct TALER_AmountNBO *res,
|
||||
TALER_amount_is_valid (d));
|
||||
res->value = GNUNET_htonll (d->value);
|
||||
res->fraction = htonl (d->fraction);
|
||||
memcpy (res->currency,
|
||||
d->currency,
|
||||
TALER_CURRENCY_LEN);
|
||||
GNUNET_memcpy (res->currency,
|
||||
d->currency,
|
||||
TALER_CURRENCY_LEN);
|
||||
}
|
||||
|
||||
|
||||
@ -205,9 +205,9 @@ TALER_amount_ntoh (struct TALER_Amount *res,
|
||||
{
|
||||
res->value = GNUNET_ntohll (dn->value);
|
||||
res->fraction = ntohl (dn->fraction);
|
||||
memcpy (res->currency,
|
||||
dn->currency,
|
||||
TALER_CURRENCY_LEN);
|
||||
GNUNET_memcpy (res->currency,
|
||||
dn->currency,
|
||||
TALER_CURRENCY_LEN);
|
||||
GNUNET_assert (GNUNET_YES ==
|
||||
TALER_amount_is_valid (res));
|
||||
}
|
||||
@ -225,9 +225,9 @@ TALER_amount_set_zero (const char *cur,
|
||||
memset (amount,
|
||||
0,
|
||||
sizeof (struct TALER_Amount));
|
||||
memcpy (amount->currency,
|
||||
cur,
|
||||
slen);
|
||||
GNUNET_memcpy (amount->currency,
|
||||
cur,
|
||||
slen);
|
||||
return GNUNET_OK;
|
||||
}
|
||||
|
||||
@ -680,9 +680,9 @@ TALER_amount_multiply (struct TALER_Amount *result,
|
||||
if (GNUNET_SYSERR ==
|
||||
TALER_amount_normalize (&in))
|
||||
return TALER_AAR_INVALID_NORMALIZATION_FAILED;
|
||||
memcpy (result->currency,
|
||||
amount->currency,
|
||||
TALER_CURRENCY_LEN);
|
||||
GNUNET_memcpy (result->currency,
|
||||
amount->currency,
|
||||
TALER_CURRENCY_LEN);
|
||||
if ( (0 == factor) ||
|
||||
( (0 == in.value) &&
|
||||
(0 == in.fraction) ) )
|
||||
|
@ -90,9 +90,9 @@ compute_totp (struct GNUNET_TIME_Timestamp ts,
|
||||
mc = gcry_md_read (md,
|
||||
GCRY_MD_SHA1);
|
||||
GNUNET_assert (NULL != mc);
|
||||
memcpy (hmac,
|
||||
mc,
|
||||
sizeof (hmac));
|
||||
GNUNET_memcpy (hmac,
|
||||
mc,
|
||||
sizeof (hmac));
|
||||
gcry_md_close (md);
|
||||
}
|
||||
|
||||
|
@ -131,9 +131,9 @@ blob_encrypt (const struct NonceP *nonce,
|
||||
+ data_size;
|
||||
*res_size = ciphertext_size;
|
||||
*res = GNUNET_malloc (ciphertext_size);
|
||||
memcpy (*res,
|
||||
nonce,
|
||||
crypto_secretbox_NONCEBYTES);
|
||||
GNUNET_memcpy (*res,
|
||||
nonce,
|
||||
crypto_secretbox_NONCEBYTES);
|
||||
GNUNET_assert (0 ==
|
||||
crypto_secretbox_easy (*res + crypto_secretbox_NONCEBYTES,
|
||||
data,
|
||||
@ -274,9 +274,9 @@ TALER_CRYPTO_contract_encrypt_for_merge (
|
||||
hdr->header.ctype = htonl (TALER_EXCHANGE_CONTRACT_PAYMENT_OFFER);
|
||||
hdr->header.clen = htonl ((uint32_t) clen);
|
||||
hdr->merge_priv = *merge_priv;
|
||||
memcpy (&hdr[1],
|
||||
xbuf,
|
||||
cbuf_size);
|
||||
GNUNET_memcpy (&hdr[1],
|
||||
xbuf,
|
||||
cbuf_size);
|
||||
GNUNET_free (xbuf);
|
||||
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
|
||||
&nonce,
|
||||
@ -423,9 +423,9 @@ TALER_CRYPTO_contract_encrypt_for_deposit (
|
||||
hdr = GNUNET_malloc (sizeof (*hdr) + cbuf_size);
|
||||
hdr->ctype = htonl (TALER_EXCHANGE_CONTRACT_PAYMENT_REQUEST);
|
||||
hdr->clen = htonl ((uint32_t) clen);
|
||||
memcpy (&hdr[1],
|
||||
xbuf,
|
||||
cbuf_size);
|
||||
GNUNET_memcpy (&hdr[1],
|
||||
xbuf,
|
||||
cbuf_size);
|
||||
GNUNET_free (xbuf);
|
||||
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
|
||||
&nonce,
|
||||
@ -441,12 +441,12 @@ TALER_CRYPTO_contract_encrypt_for_deposit (
|
||||
GNUNET_free (hdr);
|
||||
/* prepend purse_pub */
|
||||
*econtract = GNUNET_malloc (xecontract_size + sizeof (*purse_pub));
|
||||
memcpy (*econtract,
|
||||
purse_pub,
|
||||
sizeof (*purse_pub));
|
||||
memcpy (sizeof (*purse_pub) + *econtract,
|
||||
xecontract,
|
||||
xecontract_size);
|
||||
GNUNET_memcpy (*econtract,
|
||||
purse_pub,
|
||||
sizeof (*purse_pub));
|
||||
GNUNET_memcpy (sizeof (*purse_pub) + *econtract,
|
||||
xecontract,
|
||||
xecontract_size);
|
||||
*econtract_size = xecontract_size + sizeof (*purse_pub);
|
||||
GNUNET_free (xecontract);
|
||||
}
|
||||
@ -573,9 +573,9 @@ TALER_CRYPTO_kyc_attributes_encrypt (
|
||||
cbuf_size = compressBound (clen);
|
||||
xbuf = GNUNET_malloc (cbuf_size + sizeof (uint32_t));
|
||||
belen = htonl ((uint32_t) clen);
|
||||
memcpy (xbuf,
|
||||
&belen,
|
||||
sizeof (belen));
|
||||
GNUNET_memcpy (xbuf,
|
||||
&belen,
|
||||
sizeof (belen));
|
||||
ret = compress (xbuf + 4,
|
||||
&cbuf_size,
|
||||
(const Bytef *) cstr,
|
||||
@ -623,9 +623,9 @@ TALER_CRYPTO_kyc_attributes_decrypt (
|
||||
GNUNET_break_op (0);
|
||||
return NULL;
|
||||
}
|
||||
memcpy (&belen,
|
||||
xhdr,
|
||||
sizeof (belen));
|
||||
GNUNET_memcpy (&belen,
|
||||
xhdr,
|
||||
sizeof (belen));
|
||||
clen = ntohl (belen);
|
||||
if (clen >= GNUNET_MAX_MALLOC_CHECKED)
|
||||
{
|
||||
|
@ -357,9 +357,9 @@ TALER_CRYPTO_helper_esign_sign_ (
|
||||
sr->header.size = htons (sizeof (buf));
|
||||
sr->header.type = htons (TALER_HELPER_EDDSA_MT_REQ_SIGN);
|
||||
sr->reserved = htonl (0);
|
||||
memcpy (&sr->purpose,
|
||||
purpose,
|
||||
purpose_size);
|
||||
GNUNET_memcpy (&sr->purpose,
|
||||
purpose,
|
||||
purpose_size);
|
||||
if (GNUNET_OK !=
|
||||
TALER_crypto_helper_send_all (esh->sock,
|
||||
buf,
|
||||
|
@ -417,9 +417,9 @@ TALER_CRYPTO_helper_rsa_sign (
|
||||
sr->header.type = htons (TALER_HELPER_RSA_MT_REQ_SIGN);
|
||||
sr->reserved = htonl (0);
|
||||
sr->h_rsa = *rsr->h_rsa;
|
||||
memcpy (&sr[1],
|
||||
rsr->msg,
|
||||
rsr->msg_size);
|
||||
GNUNET_memcpy (&sr[1],
|
||||
rsr->msg,
|
||||
rsr->msg_size);
|
||||
if (GNUNET_OK !=
|
||||
TALER_crypto_helper_send_all (dh->sock,
|
||||
buf,
|
||||
@ -655,9 +655,9 @@ TALER_CRYPTO_helper_rsa_batch_sign (
|
||||
sr->header.size = htons (sizeof (*sr) + rsr->msg_size);
|
||||
sr->reserved = htonl (0);
|
||||
sr->h_rsa = *rsr->h_rsa;
|
||||
memcpy (&sr[1],
|
||||
rsr->msg,
|
||||
rsr->msg_size);
|
||||
GNUNET_memcpy (&sr[1],
|
||||
rsr->msg,
|
||||
rsr->msg_size);
|
||||
wbuf += sizeof (*sr) + rsr->msg_size;
|
||||
}
|
||||
GNUNET_assert (wbuf == &obuf[mlen]);
|
||||
|
@ -1177,10 +1177,10 @@ TALER_exchange_online_denomination_expired_sign (
|
||||
};
|
||||
|
||||
/* strncpy would create a compiler warning */
|
||||
memcpy (dua.operation,
|
||||
op,
|
||||
GNUNET_MIN (sizeof (dua.operation),
|
||||
strlen (op)));
|
||||
GNUNET_memcpy (dua.operation,
|
||||
op,
|
||||
GNUNET_MIN (sizeof (dua.operation),
|
||||
strlen (op)));
|
||||
return scb (&dua.purpose,
|
||||
pub,
|
||||
sig);
|
||||
@ -1204,10 +1204,10 @@ TALER_exchange_online_denomination_expired_verify (
|
||||
};
|
||||
|
||||
/* strncpy would create a compiler warning */
|
||||
memcpy (dua.operation,
|
||||
op,
|
||||
GNUNET_MIN (sizeof (dua.operation),
|
||||
strlen (op)));
|
||||
GNUNET_memcpy (dua.operation,
|
||||
op,
|
||||
GNUNET_MIN (sizeof (dua.operation),
|
||||
strlen (op)));
|
||||
return
|
||||
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_AFFIRM_DENOM_EXPIRED,
|
||||
&dua,
|
||||
|
@ -233,9 +233,9 @@ TALER_iban_validate (const char *iban)
|
||||
return GNUNET_strdup ("IBAN number too short to be valid");
|
||||
if (len > 34)
|
||||
return GNUNET_strdup ("IBAN number too long to be valid");
|
||||
memcpy (cc, iban, 2);
|
||||
memcpy (ibancpy, iban + 4, len - 4);
|
||||
memcpy (ibancpy + len - 4, iban, 4);
|
||||
GNUNET_memcpy (cc, iban, 2);
|
||||
GNUNET_memcpy (ibancpy, iban + 4, len - 4);
|
||||
GNUNET_memcpy (ibancpy + len - 4, iban, 4);
|
||||
ibancpy[len] = '\0';
|
||||
cc_entry.code = cc;
|
||||
cc_entry.english = NULL;
|
||||
|
@ -267,9 +267,9 @@ TALER_payto_hash (const char *payto,
|
||||
&sha512);
|
||||
GNUNET_static_assert (sizeof (sha512) > sizeof (*h_payto));
|
||||
/* truncate */
|
||||
memcpy (h_payto,
|
||||
&sha512,
|
||||
sizeof (*h_payto));
|
||||
GNUNET_memcpy (h_payto,
|
||||
&sha512,
|
||||
sizeof (*h_payto));
|
||||
}
|
||||
|
||||
|
||||
|
@ -423,9 +423,9 @@ generate_response (struct DenominationKey *dk)
|
||||
&an->secm_sig);
|
||||
an->secm_pub = TES_smpub;
|
||||
p = (void *) &an[1];
|
||||
memcpy (p,
|
||||
denom->section,
|
||||
nlen);
|
||||
GNUNET_memcpy (p,
|
||||
denom->section,
|
||||
nlen);
|
||||
dk->an = an;
|
||||
}
|
||||
|
||||
@ -1373,9 +1373,9 @@ cs_client_init (struct TES_Client *client)
|
||||
NULL != dk;
|
||||
dk = dk->next)
|
||||
{
|
||||
memcpy (&buf[obs],
|
||||
dk->an,
|
||||
ntohs (dk->an->header.size));
|
||||
GNUNET_memcpy (&buf[obs],
|
||||
dk->an,
|
||||
ntohs (dk->an->header.size));
|
||||
obs += ntohs (dk->an->header.size);
|
||||
}
|
||||
}
|
||||
@ -1472,18 +1472,18 @@ cs_update_client_keys (struct TES_Client *client)
|
||||
.h_cs = key->h_cs
|
||||
};
|
||||
|
||||
memcpy (&buf[obs],
|
||||
&pn,
|
||||
sizeof (pn));
|
||||
GNUNET_memcpy (&buf[obs],
|
||||
&pn,
|
||||
sizeof (pn));
|
||||
GNUNET_assert (obs + sizeof (pn)
|
||||
> obs);
|
||||
obs += sizeof (pn);
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy (&buf[obs],
|
||||
key->an,
|
||||
ntohs (key->an->header.size));
|
||||
GNUNET_memcpy (&buf[obs],
|
||||
key->an,
|
||||
ntohs (key->an->header.size));
|
||||
GNUNET_assert (obs + ntohs (key->an->header.size)
|
||||
> obs);
|
||||
obs += ntohs (key->an->header.size);
|
||||
|
@ -826,9 +826,9 @@ parse_key (const char *filename,
|
||||
filename);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
memcpy (&priv,
|
||||
buf,
|
||||
buf_size);
|
||||
GNUNET_memcpy (&priv,
|
||||
buf,
|
||||
buf_size);
|
||||
|
||||
{
|
||||
struct GNUNET_CRYPTO_EddsaPublicKey pub;
|
||||
|
@ -394,13 +394,13 @@ generate_response (struct DenominationKey *dk)
|
||||
&an->secm_sig);
|
||||
an->secm_pub = TES_smpub;
|
||||
p = (void *) &an[1];
|
||||
memcpy (p,
|
||||
buf,
|
||||
buf_len);
|
||||
GNUNET_memcpy (p,
|
||||
buf,
|
||||
buf_len);
|
||||
GNUNET_free (buf);
|
||||
memcpy (p + buf_len,
|
||||
denom->section,
|
||||
nlen);
|
||||
GNUNET_memcpy (p + buf_len,
|
||||
denom->section,
|
||||
nlen);
|
||||
dk->an = an;
|
||||
}
|
||||
|
||||
@ -524,9 +524,9 @@ send_signature (struct TES_Client *client,
|
||||
sr = GNUNET_malloc (tsize);
|
||||
sr->header.size = htons (tsize);
|
||||
sr->header.type = htons (TALER_HELPER_RSA_MT_RES_SIGNATURE);
|
||||
memcpy (&sr[1],
|
||||
buf,
|
||||
buf_size);
|
||||
GNUNET_memcpy (&sr[1],
|
||||
buf,
|
||||
buf_size);
|
||||
GNUNET_free (buf);
|
||||
ret = TES_transmit (client->csock,
|
||||
&sr->header);
|
||||
@ -1111,9 +1111,9 @@ rsa_client_init (struct TES_Client *client)
|
||||
NULL != dk;
|
||||
dk = dk->next)
|
||||
{
|
||||
memcpy (&buf[obs],
|
||||
dk->an,
|
||||
ntohs (dk->an->header.size));
|
||||
GNUNET_memcpy (&buf[obs],
|
||||
dk->an,
|
||||
ntohs (dk->an->header.size));
|
||||
GNUNET_assert (obs + ntohs (dk->an->header.size)
|
||||
> obs);
|
||||
obs += ntohs (dk->an->header.size);
|
||||
@ -1212,18 +1212,18 @@ rsa_update_client_keys (struct TES_Client *client)
|
||||
.h_rsa = key->h_rsa
|
||||
};
|
||||
|
||||
memcpy (&buf[obs],
|
||||
&pn,
|
||||
sizeof (pn));
|
||||
GNUNET_memcpy (&buf[obs],
|
||||
&pn,
|
||||
sizeof (pn));
|
||||
GNUNET_assert (obs + sizeof (pn)
|
||||
> obs);
|
||||
obs += sizeof (pn);
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy (&buf[obs],
|
||||
key->an,
|
||||
ntohs (key->an->header.size));
|
||||
GNUNET_memcpy (&buf[obs],
|
||||
key->an,
|
||||
ntohs (key->an->header.size));
|
||||
GNUNET_assert (obs + ntohs (key->an->header.size)
|
||||
> obs);
|
||||
obs += ntohs (key->an->header.size);
|
||||
|
@ -41,9 +41,9 @@ TALER_b2s (const void *buf,
|
||||
&hc);
|
||||
tmp = GNUNET_STRINGS_data_to_string_alloc (&hc,
|
||||
sizeof (hc));
|
||||
memcpy (ret,
|
||||
tmp,
|
||||
8);
|
||||
GNUNET_memcpy (ret,
|
||||
tmp,
|
||||
8);
|
||||
GNUNET_free (tmp);
|
||||
ret[8] = '\0';
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user