X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fsptps.c;fp=src%2Fsptps.c;h=50958ec64737743329664d376c1ee009469532ee;hb=76c7550c8ab0e9c0ee14a9c396baa008cfb9bc42;hp=258d8b880eafb9df458ff7b56b21dd342e2fe0a5;hpb=3c56342ef05b0f81bcd9feba5d86e2bff8a0cb94;p=meshlink diff --git a/src/sptps.c b/src/sptps.c index 258d8b88..50958ec6 100644 --- a/src/sptps.c +++ b/src/sptps.c @@ -177,11 +177,11 @@ static bool send_sig(sptps_t *s) { memcpy(msg + 1 + 2 * (33 + keylen), s->label, s->labellen); // Sign the result. - if(!ecdsa_sign(s->mykey, msg, sizeof msg, sig)) + if(!ecdsa_sign(s->mykey, msg, sizeof(msg), sig)) return error(s, EINVAL, "Failed to sign SIG record"); // Send the SIG exchange record. - return send_record_priv(s, SPTPS_HANDSHAKE, sig, sizeof sig); + return send_record_priv(s, SPTPS_HANDSHAKE, sig, sizeof(sig)); } // Generate key material from the shared secret created from the ECDHE key exchange. @@ -283,7 +283,7 @@ static bool receive_sig(sptps_t *s, const char *data, uint16_t len) { memcpy(msg + 1 + 2 * (33 + keylen), s->label, s->labellen); // Verify signature. - if(!ecdsa_verify(s->hiskey, msg, sizeof msg, data)) + if(!ecdsa_verify(s->hiskey, msg, sizeof(msg), data)) return error(s, EIO, "Failed to verify SIG record"); // Compute shared secret. @@ -293,7 +293,7 @@ static bool receive_sig(sptps_t *s, const char *data, uint16_t len) { s->ecdh = NULL; // Generate key material from shared secret. - if(!generate_key_material(s, shared, sizeof shared)) + if(!generate_key_material(s, shared, sizeof(shared))) return false; free(s->mykex); @@ -567,7 +567,7 @@ bool sptps_start(sptps_t *s, void *handle, bool initiator, bool datagram, ecdsa_ return error(s, EINVAL, "Invalid argument to sptps_start()"); // Initialise struct sptps - memset(s, 0, sizeof *s); + memset(s, 0, sizeof(*s)); s->handle = handle; s->initiator = initiator; @@ -616,6 +616,6 @@ bool sptps_stop(sptps_t *s) { free(s->key); free(s->label); free(s->late); - memset(s, 0, sizeof *s); + memset(s, 0, sizeof(*s)); return true; }