]> git.meshlink.io Git - meshlink/blobdiff - src/sptps.c
Convert sizeof foo to sizeof(foo).
[meshlink] / src / sptps.c
index 258d8b880eafb9df458ff7b56b21dd342e2fe0a5..50958ec64737743329664d376c1ee009469532ee 100644 (file)
@@ -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;
 }