Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

fix potential overflow #2

Merged
merged 2 commits into from
Feb 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.11'
ext.kotlin_version = '1.3.61'
repositories {
jcenter()
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
5 changes: 4 additions & 1 deletion knacl/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
apply plugin: "kotlin"
apply plugin: "maven"

compileKotlin.kotlinOptions.jvmTarget = "1.8"
compileTestKotlin.kotlinOptions.jvmTarget = "1.8"

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
testImplementation "junit:junit:4.12"
}
4 changes: 3 additions & 1 deletion knacl/src/main/kotlin/me/uport/knacl/NaClLowLevel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import java.security.SecureRandom
import kotlin.experimental.and
import kotlin.experimental.or
import kotlin.experimental.xor
import kotlin.math.floor
import kotlin.math.roundToLong

/**
* This is a port of the TweetNaCl library
Expand Down Expand Up @@ -817,7 +819,7 @@ internal object NaClLowLevel {
carry = 0
for (j in (i - 32) until (i - 12)) {
x[j] += carry - 16 * x[i] * L[j - (i - 32)]
carry = (x[j] + 128) shr 8
carry = floor((x[j].toDouble() + 128.0) / 256.0).roundToLong()
x[j] -= carry shl 8
}
///XXX: check index arithmetic
Expand Down