summaryrefslogtreecommitdiffhomepage
path: root/tunnel/src/main/java/com/wireguard/crypto
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-03-09 12:01:52 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2020-03-09 12:19:15 -0600
commit8e8643122eb5783d4412c8a81fb03cc789c3f77c (patch)
tree43cc7ea98c33115a7b3bc062104deeb75c580f19 /tunnel/src/main/java/com/wireguard/crypto
parentc00a0b12e4bf353a20a520c59961b21374050089 (diff)
global: get rid of nonnull gradle hack
Hacking things up via gradle is not right, and package-info.java poses problems with two modules, so instead we just apply it manually to every class. Remember to add this to new classes! Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'tunnel/src/main/java/com/wireguard/crypto')
-rw-r--r--tunnel/src/main/java/com/wireguard/crypto/Curve25519.java3
-rw-r--r--tunnel/src/main/java/com/wireguard/crypto/Key.java3
-rw-r--r--tunnel/src/main/java/com/wireguard/crypto/KeyFormatException.java3
-rw-r--r--tunnel/src/main/java/com/wireguard/crypto/KeyPair.java3
4 files changed, 12 insertions, 0 deletions
diff --git a/tunnel/src/main/java/com/wireguard/crypto/Curve25519.java b/tunnel/src/main/java/com/wireguard/crypto/Curve25519.java
index 5622fc5f..7628c566 100644
--- a/tunnel/src/main/java/com/wireguard/crypto/Curve25519.java
+++ b/tunnel/src/main/java/com/wireguard/crypto/Curve25519.java
@@ -6,6 +6,8 @@
package com.wireguard.crypto;
+import com.wireguard.util.NonNullForAll;
+
import androidx.annotation.Nullable;
import java.util.Arrays;
@@ -25,6 +27,7 @@ import java.util.Arrays;
* References: http://cr.yp.to/ecdh.html, RFC 7748
*/
@SuppressWarnings({"MagicNumber", "NonConstantFieldWithUpperCaseName", "SuspiciousNameCombination"})
+@NonNullForAll
public final class Curve25519 {
// Numbers modulo 2^255 - 19 are broken up into ten 26-bit words.
private static final int NUM_LIMBS_255BIT = 10;
diff --git a/tunnel/src/main/java/com/wireguard/crypto/Key.java b/tunnel/src/main/java/com/wireguard/crypto/Key.java
index 6648a5f3..e46150bd 100644
--- a/tunnel/src/main/java/com/wireguard/crypto/Key.java
+++ b/tunnel/src/main/java/com/wireguard/crypto/Key.java
@@ -5,6 +5,8 @@
package com.wireguard.crypto;
+import com.wireguard.util.NonNullForAll;
+
import com.wireguard.crypto.KeyFormatException.Type;
import java.security.MessageDigest;
@@ -18,6 +20,7 @@ import java.util.Arrays;
* Instances of this class are immutable.
*/
@SuppressWarnings("MagicNumber")
+@NonNullForAll
public final class Key {
private final byte[] key;
diff --git a/tunnel/src/main/java/com/wireguard/crypto/KeyFormatException.java b/tunnel/src/main/java/com/wireguard/crypto/KeyFormatException.java
index 5818b4d4..8608fc36 100644
--- a/tunnel/src/main/java/com/wireguard/crypto/KeyFormatException.java
+++ b/tunnel/src/main/java/com/wireguard/crypto/KeyFormatException.java
@@ -5,11 +5,14 @@
package com.wireguard.crypto;
+import com.wireguard.util.NonNullForAll;
+
/**
* An exception thrown when attempting to parse an invalid key (too short, too long, or byte
* data inappropriate for the format). The format being parsed can be accessed with the
* {@link #getFormat} method.
*/
+@NonNullForAll
public final class KeyFormatException extends Exception {
private final Key.Format format;
private final Type type;
diff --git a/tunnel/src/main/java/com/wireguard/crypto/KeyPair.java b/tunnel/src/main/java/com/wireguard/crypto/KeyPair.java
index f8238e91..22c21734 100644
--- a/tunnel/src/main/java/com/wireguard/crypto/KeyPair.java
+++ b/tunnel/src/main/java/com/wireguard/crypto/KeyPair.java
@@ -5,11 +5,14 @@
package com.wireguard.crypto;
+import com.wireguard.util.NonNullForAll;
+
/**
* Represents a Curve25519 key pair as used by WireGuard.
* <p>
* Instances of this class are immutable.
*/
+@NonNullForAll
public class KeyPair {
private final Key privateKey;
private final Key publicKey;