use XMEM{CMP, CPY, SET} macros instead of standard versions
This commit is contained in:
parent
b8bf2f13b8
commit
9782c09a3a
@ -33,7 +33,7 @@ int ccm_init(ccm_state *ccm, int cipher,
|
|||||||
LTC_ARGCHK(key != NULL);
|
LTC_ARGCHK(key != NULL);
|
||||||
LTC_ARGCHK(taglen != 0);
|
LTC_ARGCHK(taglen != 0);
|
||||||
|
|
||||||
memset(ccm, 0, sizeof(ccm_state));
|
XMEMSET(ccm, 0, sizeof(ccm_state));
|
||||||
|
|
||||||
/* check cipher input */
|
/* check cipher input */
|
||||||
if ((err = cipher_is_valid(cipher)) != CRYPT_OK) {
|
if ((err = cipher_is_valid(cipher)) != CRYPT_OK) {
|
||||||
|
@ -330,7 +330,7 @@ if (CTR == NULL) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// grab the CTR
|
// grab the CTR
|
||||||
memcpy(ctrcopy, ctr, 16);
|
XMEMCPY(ctrcopy, ctr, 16);
|
||||||
|
|
||||||
/* setup CTR for the TAG (zero the count) */
|
/* setup CTR for the TAG (zero the count) */
|
||||||
if (CTR == NULL) {
|
if (CTR == NULL) {
|
||||||
|
@ -386,7 +386,7 @@ int func_name (hash_state * md, const unsigned char *in, unsigned long inlen)
|
|||||||
inlen -= block_size; \
|
inlen -= block_size; \
|
||||||
} else { \
|
} else { \
|
||||||
n = MIN(inlen, (block_size - md-> state_var .curlen)); \
|
n = MIN(inlen, (block_size - md-> state_var .curlen)); \
|
||||||
memcpy(md-> state_var .buf + md-> state_var.curlen, in, (size_t)n); \
|
XMEMCPY(md-> state_var .buf + md-> state_var.curlen, in, (size_t)n); \
|
||||||
md-> state_var .curlen += n; \
|
md-> state_var .curlen += n; \
|
||||||
in += n; \
|
in += n; \
|
||||||
inlen -= n; \
|
inlen -= n; \
|
||||||
|
@ -27,10 +27,10 @@ int pk_get_oid(int pk, oid_st *st)
|
|||||||
{
|
{
|
||||||
switch (pk) {
|
switch (pk) {
|
||||||
case PKA_RSA:
|
case PKA_RSA:
|
||||||
memcpy(st, &rsa_oid, sizeof(*st));
|
XMEMCPY(st, &rsa_oid, sizeof(*st));
|
||||||
break;
|
break;
|
||||||
case PKA_DSA:
|
case PKA_DSA:
|
||||||
memcpy(st, &dsa_oid, sizeof(*st));
|
XMEMCPY(st, &dsa_oid, sizeof(*st));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return CRYPT_INVALID_ARG;
|
return CRYPT_INVALID_ARG;
|
||||||
|
@ -76,7 +76,7 @@ int der_decode_subject_public_key_info(const unsigned char *in, unsigned long in
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((alg_id[0].size != oid.OIDlen) ||
|
if ((alg_id[0].size != oid.OIDlen) ||
|
||||||
memcmp(oid.OID, alg_id[0].data, oid.OIDlen * sizeof(oid.OID[0]))) {
|
XMEMCMP(oid.OID, alg_id[0].data, oid.OIDlen * sizeof(oid.OID[0]))) {
|
||||||
/* OID mismatch */
|
/* OID mismatch */
|
||||||
err = CRYPT_PK_INVALID_TYPE;
|
err = CRYPT_PK_INVALID_TYPE;
|
||||||
goto LBL_ERR;
|
goto LBL_ERR;
|
||||||
@ -84,7 +84,7 @@ int der_decode_subject_public_key_info(const unsigned char *in, unsigned long in
|
|||||||
|
|
||||||
len = subject_pubkey[1].size/8;
|
len = subject_pubkey[1].size/8;
|
||||||
if (*public_key_len > len) {
|
if (*public_key_len > len) {
|
||||||
memcpy(public_key, subject_pubkey[1].data, len);
|
XMEMCPY(public_key, subject_pubkey[1].data, len);
|
||||||
*public_key_len = len;
|
*public_key_len = len;
|
||||||
} else {
|
} else {
|
||||||
*public_key_len = len;
|
*public_key_len = len;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user