From 4eb1b87ed11e14d911f1f10b264df68ccea06571 Mon Sep 17 00:00:00 2001
From: akwizgran <akwizgran@users.sourceforge.net>
Date: Sun, 5 Jan 2014 22:31:35 +0000
Subject: [PATCH] Fixed a moronic arithmetic mistake that was causing key
 parsing errors.

---
 briar-core/src/net/sf/briar/crypto/Sec1KeyParser.java  | 2 +-
 briar-core/src/net/sf/briar/crypto/Sec1PrivateKey.java | 2 +-
 briar-core/src/net/sf/briar/crypto/Sec1PublicKey.java  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/briar-core/src/net/sf/briar/crypto/Sec1KeyParser.java b/briar-core/src/net/sf/briar/crypto/Sec1KeyParser.java
index 4ac67760bc..5aa7faff06 100644
--- a/briar-core/src/net/sf/briar/crypto/Sec1KeyParser.java
+++ b/briar-core/src/net/sf/briar/crypto/Sec1KeyParser.java
@@ -28,7 +28,7 @@ class Sec1KeyParser implements KeyParser {
 		this.params = params;
 		this.modulus = modulus;
 		this.keyBits = keyBits;
-		bytesPerInt = keyBits + 7 / 8;
+		bytesPerInt = (keyBits + 7) / 8;
 		publicKeyBytes = 1 + 2 * bytesPerInt;
 		privateKeyBytes = bytesPerInt;
 	}
diff --git a/briar-core/src/net/sf/briar/crypto/Sec1PrivateKey.java b/briar-core/src/net/sf/briar/crypto/Sec1PrivateKey.java
index e6a0fc0f6e..4779140637 100644
--- a/briar-core/src/net/sf/briar/crypto/Sec1PrivateKey.java
+++ b/briar-core/src/net/sf/briar/crypto/Sec1PrivateKey.java
@@ -11,7 +11,7 @@ class Sec1PrivateKey implements PrivateKey {
 
 	Sec1PrivateKey(ECPrivateKeyParameters key, int keyBits) {
 		this.key = key;
-		bytesPerInt = keyBits + 7 / 8;
+		bytesPerInt = (keyBits + 7) / 8;
 	}
 
 	public byte[] getEncoded() {
diff --git a/briar-core/src/net/sf/briar/crypto/Sec1PublicKey.java b/briar-core/src/net/sf/briar/crypto/Sec1PublicKey.java
index a51ded2693..3c6eae0598 100644
--- a/briar-core/src/net/sf/briar/crypto/Sec1PublicKey.java
+++ b/briar-core/src/net/sf/briar/crypto/Sec1PublicKey.java
@@ -16,7 +16,7 @@ class Sec1PublicKey implements PublicKey {
 
 	Sec1PublicKey(ECPublicKeyParameters key, int keyBits) {
 		this.key = key;
-		bytesPerInt = keyBits + 7 / 8;
+		bytesPerInt = (keyBits + 7) / 8;
 		publicKeyBytes = 1 + 2 * bytesPerInt;
 	}
 
-- 
GitLab