Minor: memcpy -> MEMCPY / SMEMCPY

This commit is contained in:
Dirk Ziegelmeier
2016-08-30 21:51:05 +02:00
parent a08ed9148d
commit 9078f31544
8 changed files with 26 additions and 26 deletions

View File

@@ -1067,7 +1067,7 @@ snmp_prepare_outbound_frame(struct snmp_request *request)
/* msgAuthoritativeEngineID */
snmpv3_get_engine_id(&id, &request->msg_authoritative_engine_id_len);
memcpy(request->msg_authoritative_engine_id, id, request->msg_authoritative_engine_id_len);
MEMCPY(request->msg_authoritative_engine_id, id, request->msg_authoritative_engine_id_len);
SNMP_ASN1_SET_TLV_PARAMS(tlv, SNMP_ASN1_TYPE_OCTET_STRING, 0, request->msg_authoritative_engine_id_len);
OF_BUILD_EXEC(snmp_ans1_enc_tlv(pbuf_stream, &tlv));
OF_BUILD_EXEC(snmp_asn1_enc_raw(pbuf_stream, request->msg_authoritative_engine_id, request->msg_authoritative_engine_id_len));
@@ -1142,7 +1142,7 @@ snmp_prepare_outbound_frame(struct snmp_request *request)
/* contextEngineID */
snmpv3_get_engine_id(&id, &request->context_engine_id_len);
memcpy(request->context_engine_id, id, request->context_engine_id_len);
MEMCPY(request->context_engine_id, id, request->context_engine_id_len);
SNMP_ASN1_SET_TLV_PARAMS(tlv, SNMP_ASN1_TYPE_OCTET_STRING, 0, request->context_engine_id_len);
OF_BUILD_EXEC(snmp_ans1_enc_tlv(pbuf_stream, &tlv));
OF_BUILD_EXEC(snmp_asn1_enc_raw(pbuf_stream, request->context_engine_id, request->context_engine_id_len));
@@ -1519,7 +1519,7 @@ snmp_complete_outbound_frame(struct snmp_request *request)
request->outbound_pbuf, 0, request->outbound_pbuf->tot_len));
OF_BUILD_EXEC(snmpv3_auth(&request->outbound_pbuf_stream, frame_size + outbound_padding, key, algo, hmac));
memcpy(request->msg_authentication_parameters, hmac, SNMP_V3_MAX_AUTH_PARAM_LENGTH);
MEMCPY(request->msg_authentication_parameters, hmac, SNMP_V3_MAX_AUTH_PARAM_LENGTH);
OF_BUILD_EXEC(snmp_pbuf_stream_init(&request->outbound_pbuf_stream,
request->outbound_pbuf, 0, request->outbound_pbuf->tot_len));
OF_BUILD_EXEC(snmp_pbuf_stream_seek_abs(&request->outbound_pbuf_stream,

View File

@@ -114,8 +114,8 @@ snmpv3_build_priv_param(u8_t* priv_param)
priv2 = LWIP_RAND();
}
memcpy(&priv_param[0], &priv1, sizeof(priv1));
memcpy(&priv_param[4], &priv2, sizeof(priv2));
SMEMCPY(&priv_param[0], &priv1, sizeof(priv1));
SMEMCPY(&priv_param[4], &priv2, sizeof(priv2));
/* Emulate 64bit increment */
priv1++;
@@ -125,8 +125,8 @@ snmpv3_build_priv_param(u8_t* priv_param)
#else /* Based on RFC3414 */
static u32_t ctr;
u32_t boots = LWIP_SNMPV3_GET_ENGINE_BOOTS();
memcpy(&priv_param[0], &boots, 4);
memcpy(&priv_param[4], &ctr, 4);
SMEMCPY(&priv_param[0], &boots, 4);
SMEMCPY(&priv_param[4], &ctr, 4);
ctr++;
#endif
return ERR_OK;

View File

@@ -192,7 +192,7 @@ snmpv3_crypt(struct snmp_pbuf_stream* stream, u16_t length,
iv_local[4 + 1] = (engine_time >> 16) & 0xFF;
iv_local[4 + 2] = (engine_time >> 8) & 0xFF;
iv_local[4 + 3] = (engine_time >> 0) & 0xFF;
memcpy(iv_local + 8, priv_param, 8);
SMEMCPY(iv_local + 8, priv_param, 8);
if(mbedtls_cipher_set_iv(&ctx, iv_local, LWIP_ARRAYSIZE(iv_local)) != 0) {
goto error;
}
@@ -263,9 +263,9 @@ snmpv3_password_to_key_md5(
/* May want to ensure that engineLength <= 32, */
/* otherwise need to use a buffer larger than 64 */
/*****************************************************/
memcpy(password_buf, key, 16);
memcpy(password_buf + 16, engineID, engineLength);
memcpy(password_buf + 16 + engineLength, key, 16);
SMEMCPY(password_buf, key, 16);
MEMCPY(password_buf + 16, engineID, engineLength);
SMEMCPY(password_buf + 16 + engineLength, key, 16);
mbedtls_md5_starts(&MD);
mbedtls_md5_update(&MD, password_buf, 32 + engineLength);
@@ -316,9 +316,9 @@ snmpv3_password_to_key_sha(
/* May want to ensure that engineLength <= 32, */
/* otherwise need to use a buffer larger than 72 */
/*****************************************************/
memcpy(password_buf, key, 20);
memcpy(password_buf + 20, engineID, engineLength);
memcpy(password_buf + 20 + engineLength, key, 20);
SMEMCPY(password_buf, key, 20);
MEMCPY(password_buf + 20, engineID, engineLength);
SMEMCPY(password_buf + 20 + engineLength, key, 20);
mbedtls_sha1_starts(&SH);
mbedtls_sha1_update(&SH, password_buf, 40 + engineLength);