summaryrefslogtreecommitdiff
path: root/curve.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2018-03-06 18:44:11 +0100
committerTobias Klauser <tklauser@distanz.ch>2018-03-06 18:44:11 +0100
commit2af099cae27fef1a57aa25d48fc915d619ea216d (patch)
treeff661aad6ab62c6db94b68a3eacba930ffb87881 /curve.c
parent18f5d4dde7ef18efa0489f2007f5ebeed89975ea (diff)
all: drop fmem{cpy,set}
There is no need to explicity use the builtins. According to [1], GCC will recognize mem{cpy,set} as built-in functions, unless the corresponding -fno-builtin-* option is specified (which is not the case for netsniff-ng). [1] https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'curve.c')
-rw-r--r--curve.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/curve.c b/curve.c
index 319991b..75354ab 100644
--- a/curve.c
+++ b/curve.c
@@ -79,8 +79,8 @@ void curve25519_proto_init(struct curve25519_proto *proto,
unsigned char secretkey_own[crypto_box_sec_key_size];
unsigned char publickey_own[crypto_box_pub_key_size];
- fmemset(secretkey_own, 0, sizeof(secretkey_own));
- fmemset(publickey_own, 0, sizeof(publickey_own));
+ memset(secretkey_own, 0, sizeof(secretkey_own));
+ memset(publickey_own, 0, sizeof(publickey_own));
if (unlikely(!pubkey_remote || len != sizeof(publickey_own)))
panic("Invalid argument on curve25519_proto_init!\n");
@@ -96,8 +96,8 @@ void curve25519_proto_init(struct curve25519_proto *proto,
crypto_box_beforenm(proto->key, pubkey_remote, secretkey_own);
- fmemset(proto->enonce, 0, sizeof(proto->enonce));
- fmemset(proto->dnonce, 0, sizeof(proto->dnonce));
+ memset(proto->enonce, 0, sizeof(proto->enonce));
+ memset(proto->dnonce, 0, sizeof(proto->dnonce));
xmemset(secretkey_own, 0, sizeof(secretkey_own));
xmemset(publickey_own, 0, sizeof(publickey_own));
@@ -121,7 +121,7 @@ ssize_t curve25519_encode(struct curve25519_struct *curve,
taia_now(&packet_taia);
taia_pack(NONCE_EDN_OFFSET(proto->enonce), &packet_taia);
- fmemset(curve->enc, 0, curve->enc_size);
+ memset(curve->enc, 0, curve->enc_size);
ret = crypto_box_afternm(curve->enc, plaintext, size,
proto->enonce, proto->key);
if (unlikely(ret)) {
@@ -129,7 +129,7 @@ ssize_t curve25519_encode(struct curve25519_struct *curve,
goto out;
}
- fmemcpy(NONCE_PKT_OFFSET(curve->enc),
+ memcpy(NONCE_PKT_OFFSET(curve->enc),
NONCE_EDN_OFFSET(proto->enonce), NONCE_LENGTH);
for (i = 0; i < NONCE_RND_LENGTH; ++i)
curve->enc[i] = (uint8_t) secrand();
@@ -167,9 +167,9 @@ ssize_t curve25519_decode(struct curve25519_struct *curve,
goto out;
}
- fmemcpy(NONCE_EDN_OFFSET(proto->dnonce),
+ memcpy(NONCE_EDN_OFFSET(proto->dnonce),
NONCE_PKT_OFFSET(ciphertext), NONCE_LENGTH);
- fmemset(curve->dec, 0, curve->dec_size);
+ memset(curve->dec, 0, curve->dec_size);
ret = crypto_box_open_afternm(curve->dec, ciphertext, size,
proto->dnonce, proto->key);