summaryrefslogtreecommitdiff
path: root/plugins/MirOTR
diff options
context:
space:
mode:
authorRozhuk Ivan <rozhuk.im@gmail.com>2014-12-13 11:59:42 +0000
committerRozhuk Ivan <rozhuk.im@gmail.com>2014-12-13 11:59:42 +0000
commite3c1a6d3c8ca609923a87635d208472db2e384e6 (patch)
tree14cd1a354929e175f43fbd200fdd283a28e481e6 /plugins/MirOTR
parentb0dd8ba58e708865ef6e3ed6e596699fc64f4c2d (diff)
memmove -> memcpy in some cases, review req
git-svn-id: http://svn.miranda-ng.org/main/trunk@11367 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirOTR')
-rw-r--r--plugins/MirOTR/libotr-3.2.0/src/auth.c54
-rw-r--r--plugins/MirOTR/libotr-3.2.0/src/b64.c2
-rw-r--r--plugins/MirOTR/libotr-3.2.0/src/context.c4
-rw-r--r--plugins/MirOTR/libotr-3.2.0/src/dh.c4
-rw-r--r--plugins/MirOTR/libotr-3.2.0/src/proto.c20
5 files changed, 42 insertions, 42 deletions
diff --git a/plugins/MirOTR/libotr-3.2.0/src/auth.c b/plugins/MirOTR/libotr-3.2.0/src/auth.c
index de6964517f..978c986613 100644
--- a/plugins/MirOTR/libotr-3.2.0/src/auth.c
+++ b/plugins/MirOTR/libotr-3.2.0/src/auth.c
@@ -157,21 +157,21 @@ gcry_error_t otrl_auth_start_v2(OtrlAuthInfo *auth)
buf = bufp;
buflen = lenp;
- memmove(bufp, "\x00\x02\x02", 3); /* header */
+ memcpy(bufp, "\x00\x02\x02", 3); /* header */
debug_data("Header", bufp, 3);
bufp += 3; lenp -= 3;
/* Encrypted g^x */
write_int(auth->encgx_len);
debug_int("Enc gx len", bufp-4);
- memmove(bufp, auth->encgx, auth->encgx_len);
+ memcpy(bufp, auth->encgx, auth->encgx_len);
debug_data("Enc gx", bufp, auth->encgx_len);
bufp += auth->encgx_len; lenp -= auth->encgx_len;
/* Hashed g^x */
write_int(32);
debug_int("hashgx len", bufp-4);
- memmove(bufp, auth->hashgx, 32);
+ memcpy(bufp, auth->hashgx, 32);
debug_data("hashgx", bufp, 32);
bufp += 32; lenp -= 32;
@@ -211,7 +211,7 @@ static gcry_error_t create_key_message(OtrlAuthInfo *auth)
bufp = buf;
lenp = buflen;
- memmove(bufp, "\x00\x02\x0a", 3); /* header */
+ memcpy(bufp, "\x00\x02\x0a", 3); /* header */
debug_data("Header", bufp, 3);
bufp += 3; lenp -= 3;
@@ -263,14 +263,14 @@ gcry_error_t otrl_auth_handle_commit(OtrlAuthInfo *auth,
require_len(enclen);
encbuf = malloc(enclen);
if (encbuf == NULL && enclen > 0) goto memerr;
- memmove(encbuf, bufp, enclen);
+ memcpy(encbuf, bufp, enclen);
bufp += enclen; lenp -= enclen;
/* Hashed g^x */
read_int(hashlen);
if (hashlen != 32) goto invval;
require_len(32);
- memmove(hashbuf, bufp, 32);
+ memcpy(hashbuf, bufp, 32);
bufp += 32; lenp -= 32;
if (lenp != 0) goto invval;
@@ -289,7 +289,7 @@ gcry_error_t otrl_auth_handle_commit(OtrlAuthInfo *auth,
auth->encgx = encbuf;
encbuf = NULL;
auth->encgx_len = enclen;
- memmove(auth->hashgx, hashbuf, 32);
+ memcpy(auth->hashgx, hashbuf, 32);
/* Create a D-H Key Message */
err = create_key_message(auth);
@@ -314,7 +314,7 @@ gcry_error_t otrl_auth_handle_commit(OtrlAuthInfo *auth,
auth->encgx = encbuf;
encbuf = NULL;
auth->encgx_len = enclen;
- memmove(auth->hashgx, hashbuf, 32);
+ memcpy(auth->hashgx, hashbuf, 32);
/* Create a D-H Key Message */
err = create_key_message(auth);
@@ -329,7 +329,7 @@ gcry_error_t otrl_auth_handle_commit(OtrlAuthInfo *auth,
auth->encgx = encbuf;
encbuf = NULL;
auth->encgx_len = enclen;
- memmove(auth->hashgx, hashbuf, 32);
+ memcpy(auth->hashgx, hashbuf, 32);
break;
}
@@ -385,7 +385,7 @@ static gcry_error_t calculate_pubkey_auth(unsigned char **authbufp,
bufp[0] = ((privkey->pubkey_type) >> 8) & 0xff;
bufp[1] = (privkey->pubkey_type) & 0xff;
bufp += 2; lenp -= 2;
- memmove(bufp, privkey->pubkey_data, privkey->pubkey_datalen);
+ memcpy(bufp, privkey->pubkey_data, privkey->pubkey_datalen);
debug_data("Pubkey", bufp, privkey->pubkey_datalen);
bufp += privkey->pubkey_datalen; lenp -= privkey->pubkey_datalen;
write_int(keyid);
@@ -396,7 +396,7 @@ static gcry_error_t calculate_pubkey_auth(unsigned char **authbufp,
/* Do the MAC */
gcry_md_reset(mackey);
gcry_md_write(mackey, buf, totallen);
- memmove(macbuf, gcry_md_read(mackey, GCRY_MD_SHA256), 32);
+ memcpy(macbuf, gcry_md_read(mackey, GCRY_MD_SHA256), 32);
free(buf);
buf = NULL;
@@ -416,12 +416,12 @@ static gcry_error_t calculate_pubkey_auth(unsigned char **authbufp,
bufp[0] = ((privkey->pubkey_type) >> 8) & 0xff;
bufp[1] = (privkey->pubkey_type) & 0xff;
bufp += 2; lenp -= 2;
- memmove(bufp, privkey->pubkey_data, privkey->pubkey_datalen);
+ memcpy(bufp, privkey->pubkey_data, privkey->pubkey_datalen);
debug_data("Pubkey", bufp, privkey->pubkey_datalen);
bufp += privkey->pubkey_datalen; lenp -= privkey->pubkey_datalen;
write_int(keyid);
debug_int("Keyid", bufp-4);
- memmove(bufp, sigbuf, siglen);
+ memcpy(bufp, sigbuf, siglen);
debug_data("Signature", bufp, siglen);
bufp += siglen; lenp -= siglen;
free(sigbuf);
@@ -523,7 +523,7 @@ static gcry_error_t check_pubkey_auth(unsigned char fingerprintbufp[20],
bufp[0] = (pubkey_type >> 8) & 0xff;
bufp[1] = pubkey_type & 0xff;
bufp += 2; lenp -= 2;
- memmove(bufp, fingerprintstart, fingerprintend - fingerprintstart);
+ memcpy(bufp, fingerprintstart, fingerprintend - fingerprintstart);
debug_data("Pubkey", bufp, fingerprintend - fingerprintstart);
bufp += fingerprintend - fingerprintstart;
lenp -= fingerprintend - fingerprintstart;
@@ -535,7 +535,7 @@ static gcry_error_t check_pubkey_auth(unsigned char fingerprintbufp[20],
/* Do the MAC */
gcry_md_reset(mackey);
gcry_md_write(mackey, buf, totallen);
- memmove(macbuf, gcry_md_read(mackey, GCRY_MD_SHA256), 32);
+ memcpy(macbuf, gcry_md_read(mackey, GCRY_MD_SHA256), 32);
free(buf);
buf = NULL;
@@ -588,20 +588,20 @@ static gcry_error_t create_revealsig_message(OtrlAuthInfo *auth,
bufp = buf;
lenp = buflen;
- memmove(bufp, "\x00\x02\x11", 3); /* header */
+ memcpy(bufp, "\x00\x02\x11", 3); /* header */
debug_data("Header", bufp, 3);
bufp += 3; lenp -= 3;
/* r */
write_int(16);
- memmove(bufp, auth->r, 16);
+ memcpy(bufp, auth->r, 16);
debug_data("r", bufp, 16);
bufp += 16; lenp -= 16;
/* Encrypted authenticator */
startmac = bufp;
write_int(authlen);
- memmove(bufp, authbuf, authlen);
+ memcpy(bufp, authbuf, authlen);
debug_data("auth", bufp, authlen);
bufp += authlen; lenp -= authlen;
free(authbuf);
@@ -610,7 +610,7 @@ static gcry_error_t create_revealsig_message(OtrlAuthInfo *auth,
/* MAC it, but only take the first 20 bytes */
gcry_md_reset(auth->mac_m2);
gcry_md_write(auth->mac_m2, startmac, bufp - startmac);
- memmove(bufp, gcry_md_read(auth->mac_m2, GCRY_MD_SHA256), 20);
+ memcpy(bufp, gcry_md_read(auth->mac_m2, GCRY_MD_SHA256), 20);
debug_data("MAC", bufp, 20);
bufp += 20; lenp -= 20;
@@ -660,14 +660,14 @@ static gcry_error_t create_signature_message(OtrlAuthInfo *auth,
bufp = buf;
lenp = buflen;
- memmove(bufp, "\x00\x02\x12", 3); /* header */
+ memcpy(bufp, "\x00\x02\x12", 3); /* header */
debug_data("Header", bufp, 3);
bufp += 3; lenp -= 3;
/* Encrypted authenticator */
startmac = bufp;
write_int(authlen);
- memmove(bufp, authbuf, authlen);
+ memcpy(bufp, authbuf, authlen);
debug_data("auth", bufp, authlen);
bufp += authlen; lenp -= authlen;
free(authbuf);
@@ -676,7 +676,7 @@ static gcry_error_t create_signature_message(OtrlAuthInfo *auth,
/* MAC it, but only take the first 20 bytes */
gcry_md_reset(auth->mac_m2p);
gcry_md_write(auth->mac_m2p, startmac, bufp - startmac);
- memmove(bufp, gcry_md_read(auth->mac_m2p, GCRY_MD_SHA256), 20);
+ memcpy(bufp, gcry_md_read(auth->mac_m2p, GCRY_MD_SHA256), 20);
debug_data("MAC", bufp, 20);
bufp += 20; lenp -= 20;
@@ -825,7 +825,7 @@ gcry_error_t otrl_auth_handle_revealsig(OtrlAuthInfo *auth,
read_int(rlen);
if (rlen != 16) goto invval;
require_len(rlen);
- memmove(auth->r, bufp, rlen);
+ memcpy(auth->r, bufp, rlen);
bufp += rlen; lenp -= rlen;
/* auth */
@@ -1086,7 +1086,7 @@ static gcry_error_t create_v1_key_exchange_message(OtrlAuthInfo *auth,
bufp = buf;
lenp = totallen;
- memmove(bufp, "\x00\x01\x0a", 3); /* header */
+ memcpy(bufp, "\x00\x01\x0a", 3); /* header */
debug_data("Header", bufp, 3);
bufp += 3; lenp -= 3;
@@ -1094,7 +1094,7 @@ static gcry_error_t create_v1_key_exchange_message(OtrlAuthInfo *auth,
debug_data("Reply", bufp, 1);
bufp += 1; lenp -= 1;
- memmove(bufp, privkey->pubkey_data, privkey->pubkey_datalen);
+ memcpy(bufp, privkey->pubkey_data, privkey->pubkey_datalen);
debug_data("Pubkey", bufp, privkey->pubkey_datalen);
bufp += privkey->pubkey_datalen; lenp -= privkey->pubkey_datalen;
@@ -1110,7 +1110,7 @@ static gcry_error_t create_v1_key_exchange_message(OtrlAuthInfo *auth,
if (err) goto err;
if (siglen != 40) goto invval;
- memmove(bufp, sigbuf, 40);
+ memcpy(bufp, sigbuf, 40);
debug_data("Signature", bufp, 40);
bufp += 40; lenp -= 40;
free(sigbuf);
@@ -1265,7 +1265,7 @@ gcry_error_t otrl_auth_handle_v1_key_exchange(OtrlAuthInfo *auth,
gcry_mpi_release(auth->their_pub);
auth->their_pub = received_pub;
received_pub = NULL;
- memmove(auth->their_fingerprint, fingerprintbuf, 20);
+ memcpy(auth->their_fingerprint, fingerprintbuf, 20);
if (received_reply == 0x01) {
/* Don't send a reply to this. */
diff --git a/plugins/MirOTR/libotr-3.2.0/src/b64.c b/plugins/MirOTR/libotr-3.2.0/src/b64.c
index b8736daf26..222f56634c 100644
--- a/plugins/MirOTR/libotr-3.2.0/src/b64.c
+++ b/plugins/MirOTR/libotr-3.2.0/src/b64.c
@@ -202,7 +202,7 @@ char *otrl_base64_otr_encode(const unsigned char *buf, size_t buflen)
if (base64buf == NULL) {
return NULL;
}
- memmove(base64buf, "?OTR:", 5);
+ memcpy(base64buf, "?OTR:", 5);
otrl_base64_encode(base64buf+5, buf, buflen);
base64buf[5 + base64len] = '.';
base64buf[5 + base64len + 1] = '\0';
diff --git a/plugins/MirOTR/libotr-3.2.0/src/context.c b/plugins/MirOTR/libotr-3.2.0/src/context.c
index 8807b89145..d0d912f76a 100644
--- a/plugins/MirOTR/libotr-3.2.0/src/context.c
+++ b/plugins/MirOTR/libotr-3.2.0/src/context.c
@@ -157,7 +157,7 @@ Fingerprint *otrl_context_find_fingerprint(ConnContext *context,
assert(f != NULL);
f->fingerprint = malloc(20);
assert(f->fingerprint != NULL);
- memmove(f->fingerprint, fingerprint, 20);
+ memcpy(f->fingerprint, fingerprint, 20);
f->context = context;
f->trust = NULL;
f->next = context->fingerprint_root.next;
@@ -193,7 +193,7 @@ void otrl_context_set_preshared_secret(ConnContext *context,
if (secret_len) {
context->preshared_secret = malloc(secret_len);
if (context->preshared_secret) {
- memmove(context->preshared_secret, secret, secret_len);
+ memcpy(context->preshared_secret, secret, secret_len);
context->preshared_secret_len = secret_len;
}
}
diff --git a/plugins/MirOTR/libotr-3.2.0/src/dh.c b/plugins/MirOTR/libotr-3.2.0/src/dh.c
index 610c84e143..e23788dd08 100644
--- a/plugins/MirOTR/libotr-3.2.0/src/dh.c
+++ b/plugins/MirOTR/libotr-3.2.0/src/dh.c
@@ -273,7 +273,7 @@ gcry_error_t otrl_dh_compute_v2_auth_keys(const DH_keypair *our_dh,
}
sdata[0] = 0x00;
gcry_md_hash_buffer(GCRY_MD_SHA256, hashdata, sdata, slen+5);
- memmove(sessionid, hashdata, 8);
+ memcpy(sessionid, hashdata, 8);
*sessionidlenp = 8;
/* Calculate the encryption keys */
@@ -398,7 +398,7 @@ gcry_error_t otrl_dh_compute_v1_session_id(const DH_keypair *our_dh,
}
sdata[0] = 0x00;
gcry_md_hash_buffer(GCRY_MD_SHA1, hashdata, sdata, slen+5);
- memmove(sessionid, hashdata, 20);
+ memcpy(sessionid, hashdata, 20);
*sessionidlenp = 20;
/* Which half should be bold? */
diff --git a/plugins/MirOTR/libotr-3.2.0/src/proto.c b/plugins/MirOTR/libotr-3.2.0/src/proto.c
index 9f76455a9f..307ab047ff 100644
--- a/plugins/MirOTR/libotr-3.2.0/src/proto.c
+++ b/plugins/MirOTR/libotr-3.2.0/src/proto.c
@@ -417,9 +417,9 @@ gcry_error_t otrl_proto_create_data(char **encmessagep, ConnContext *context,
bufp = buf;
lenp = buflen;
if (version == 1) {
- memmove(bufp, "\x00\x01\x03", 3); /* header */
+ memcpy(bufp, "\x00\x01\x03", 3); /* header */
} else {
- memmove(bufp, "\x00\x02\x03", 3); /* header */
+ memcpy(bufp, "\x00\x02\x03", 3); /* header */
}
debug_data("Header", bufp, 3);
bufp += 3; lenp -= 3;
@@ -435,7 +435,7 @@ gcry_error_t otrl_proto_create_data(char **encmessagep, ConnContext *context,
write_mpi(context->our_dh_key.pub, pubkeylen, "Y"); /* Y */
otrl_dh_incctr(sess->sendctr);
- memmove(bufp, sess->sendctr, 8); /* Counter (top 8 bytes only) */
+ memcpy(bufp, sess->sendctr, 8); /* Counter (top 8 bytes only) */
debug_data("Counter", bufp, 8);
bufp += 8; lenp -= 8;
@@ -454,7 +454,7 @@ gcry_error_t otrl_proto_create_data(char **encmessagep, ConnContext *context,
gcry_md_reset(sess->sendmac);
gcry_md_write(sess->sendmac, buf, bufp-buf);
- memmove(bufp, gcry_md_read(sess->sendmac, GCRY_MD_SHA1), 20);
+ memcpy(bufp, gcry_md_read(sess->sendmac, GCRY_MD_SHA1), 20);
debug_data("MAC", bufp, 20);
bufp += 20; /* MAC */
lenp -= 20;
@@ -463,7 +463,7 @@ gcry_error_t otrl_proto_create_data(char **encmessagep, ConnContext *context,
debug_int("Revealed MAC length", bufp-4);
if (reveallen > 0) {
- memmove(bufp, context->saved_mac_keys, reveallen);
+ memcpy(bufp, context->saved_mac_keys, reveallen);
debug_data("Revealed MAC data", bufp, reveallen);
bufp += reveallen; lenp -= reveallen;
free(context->saved_mac_keys);
@@ -480,7 +480,7 @@ gcry_error_t otrl_proto_create_data(char **encmessagep, ConnContext *context,
err = gcry_error(GPG_ERR_ENOMEM);
goto err;
}
- memmove(base64buf, "?OTR:", 5);
+ memcpy(base64buf, "?OTR:", 5);
otrl_base64_encode(base64buf+5, buf, buflen);
base64buf[5 + base64len] = '.';
base64buf[5 + base64len + 1] = '\0';
@@ -636,7 +636,7 @@ gcry_error_t otrl_proto_accept_data(char **plaintextp, OtrlTLV **tlvsp,
read_int(recipient_keyid);
read_mpi(sender_next_y);
require_len(8);
- memmove(ctr, bufp, 8);
+ memcpy(ctr, bufp, 8);
bufp += 8; lenp -= 8;
read_int(datalen);
require_len(datalen);
@@ -645,12 +645,12 @@ gcry_error_t otrl_proto_accept_data(char **plaintextp, OtrlTLV **tlvsp,
err = gcry_error(GPG_ERR_ENOMEM);
goto err;
}
- memmove(data, bufp, datalen);
+ memcpy(data, bufp, datalen);
data[datalen] = '\0';
bufp += datalen; lenp -= datalen;
macend = bufp;
require_len(20);
- memmove(givenmac, bufp, 20);
+ memcpy(givenmac, bufp, 20);
bufp += 20; lenp -= 20;
read_int(reveallen);
require_len(reveallen);
@@ -698,7 +698,7 @@ gcry_error_t otrl_proto_accept_data(char **plaintextp, OtrlTLV **tlvsp,
}
/* Decrypt the message */
- memmove(sess->rcvctr, ctr, 8);
+ memcpy(sess->rcvctr, ctr, 8);
err = gcry_cipher_reset(sess->rcvenc);
if (err) goto err;
err = gcry_cipher_setctr(sess->rcvenc, sess->rcvctr, 16);