Skip to content

Commit 2960351

Browse files
committed
Update LICENSE
1 parent fafe580 commit 2960351

File tree

9 files changed

+32
-7
lines changed

9 files changed

+32
-7
lines changed

LICENSE

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
Copyright (c) 2021 Kenta Ida (fuga@fugafuga.org)
2-
3-
The original license is below:
42
Copyright (c) 2021 Daniel Hope (www.floorsense.nz)
53
All rights reserved.
64

src/WireGuard.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* WireGuard implementation for ESP32 Arduino by Kenta Ida (fuga@fugafuga.org)
3+
* SPDX-License-Identifier: BSD-3-Clause
4+
*/
15
#include "WireGuard.hpp"
26

37
#include "freertos/FreeRTOS.h"
@@ -89,6 +93,7 @@ void WireGuard::begin(const IPAddress& localIP, const char* privateKey, const ch
8993
// Start outbound connection to peer
9094
ESP_LOGI(TAG, "connecting wireguard...");
9195
wireguardif_connect(wg_netif, wireguard_peer_index);
96+
// Set default interface to WG device.
9297
netif_set_default(wg_netif);
9398
}
9499
}

src/WireGuard.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* WireGuard implementation for ESP32 Arduino by Kenta Ida (fuga@fugafuga.org)
3+
* SPDX-License-Identifier: BSD-3-Clause
4+
*/
15
#pragma once
26
#include <IPAddress.h>
37

src/wireguard-platform.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* WireGuard implementation for ESP32 Arduino by Kenta Ida (fuga@fugafuga.org)
3+
* SPDX-License-Identifier: BSD-3-Clause
4+
*/
5+
16
#include "wireguard-platform.h"
27

38
#include <stdlib.h>
@@ -7,8 +12,6 @@
712
#include "mbedtls/ctr_drbg.h"
813
#include "esp_system.h"
914

10-
// This file contains a sample Wireguard platform integration
11-
1215
static struct mbedtls_ctr_drbg_context random_context;
1316
static struct mbedtls_entropy_context entropy_context;
1417

@@ -39,13 +42,14 @@ void wireguard_tai64n_now(uint8_t *output) {
3942
// See https://cr.yp.to/libtai/tai64.html
4043
// 64 bit seconds from 1970 = 8 bytes
4144
// 32 bit nano seconds from current second
42-
45+
46+
// Get timestamp. Note that the timestamp must be synced by NTP,
47+
// or at least preserved in NVS, not to go back after reset.
48+
// Otherwise, the WireGuard remote peer rejects handshake.
4349
struct timeval tv;
4450
gettimeofday(&tv, NULL);
4551
uint64_t millis = (tv.tv_sec * 1000LL + (tv.tv_usec / 1000LL));
4652

47-
// uint64_t millis = sys_now();
48-
4953
// Split into seconds offset + nanos
5054
uint64_t seconds = 0x400000000000000aULL + (millis / 1000);
5155
uint32_t nanos = (millis % 1000) * 1000;

src/wireguard-platform.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
/*
2+
* Ported to ESP32 Arduino by Kenta Ida (fuga@fugafuga.org)
3+
* The original license is below:
4+
*
25
* Copyright (c) 2021 Daniel Hope (www.floorsense.nz)
36
* All rights reserved.
47
*

src/wireguard.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
/*
2+
* Ported to ESP32 Arduino by Kenta Ida (fuga@fugafuga.org)
3+
* The original license is below:
4+
*
25
* Copyright (c) 2021 Daniel Hope (www.floorsense.nz)
36
* All rights reserved.
47
*

src/wireguard.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/*
2+
* Ported to ESP32 Arduino by Kenta Ida (fuga@fugafuga.org)
3+
* The original license is below:
24
* Copyright (c) 2021 Daniel Hope (www.floorsense.nz)
35
* All rights reserved.
46
*

src/wireguardif.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
/*
2+
* Ported to ESP32 Arduino by Kenta Ida (fuga@fugafuga.org)
3+
* The original license is below:
4+
*
25
* Copyright (c) 2021 Daniel Hope (www.floorsense.nz)
36
* All rights reserved.
47
*

src/wireguardif.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
/*
2+
* Ported to ESP32 Arduino by Kenta Ida (fuga@fugafuga.org)
3+
* The original license is below:
4+
*
25
* Copyright (c) 2021 Daniel Hope (www.floorsense.nz)
36
* All rights reserved.
47
*

0 commit comments

Comments
 (0)