Skip to content

Commit cd6c832

Browse files
Upgrade: trilead-ssh2 version to 217.371.vc1d30dc5a_b_32 (microsoft#15300)
1 parent c4b715b commit cd6c832

17 files changed

Lines changed: 1032 additions & 21 deletions

LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSES-AND-NOTICES/SPECS/data/licenses.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2587,6 +2587,7 @@
25872587
"cpulimit",
25882588
"cri-o",
25892589
"ecj",
2590+
"ed25519-java",
25902591
"fillup",
25912592
"flux",
25922593
"gd",
@@ -2609,6 +2610,7 @@
26092610
"javacc",
26102611
"javacc-bootstrap",
26112612
"javassist",
2613+
"jbcrypt",
26122614
"jboss-interceptors-1.2-api",
26132615
"jdepend",
26142616
"jflex",
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
From c5629faa3e1880cc71da506263f224bc818fe827 Mon Sep 17 00:00:00 2001
2+
From: Jack Grigg <thestr4d@gmail.com>
3+
Date: Sun, 27 Jan 2019 23:27:00 +0000
4+
Subject: [PATCH 1/2] EdDSAEngine.initVerify(): Handle any non-EdDSAPublicKey
5+
X.509-encoded pubkey
6+
7+
sun.security.x509.X509Key is a JDK-internal API, and should not be used
8+
directly. Instead of looking for an instance of that class, we check the
9+
primary encoding format of the PublicKey, and proceed if it is "X.509".
10+
---
11+
src/net/i2p/crypto/eddsa/EdDSAEngine.java | 3 +--
12+
1 file changed, 1 insertion(+), 2 deletions(-)
13+
14+
diff --git a/src/net/i2p/crypto/eddsa/EdDSAEngine.java b/src/net/i2p/crypto/eddsa/EdDSAEngine.java
15+
index 1f0ba6d..6b25410 100644
16+
--- a/src/net/i2p/crypto/eddsa/EdDSAEngine.java
17+
+++ b/src/net/i2p/crypto/eddsa/EdDSAEngine.java
18+
@@ -29,7 +29,6 @@ import java.util.Arrays;
19+
import net.i2p.crypto.eddsa.math.Curve;
20+
import net.i2p.crypto.eddsa.math.GroupElement;
21+
import net.i2p.crypto.eddsa.math.ScalarOps;
22+
-import sun.security.x509.X509Key;
23+
24+
/**
25+
* Signing and verification for EdDSA.
26+
@@ -157,7 +156,7 @@ public final class EdDSAEngine extends Signature {
27+
}
28+
} else if (!key.getParams().getHashAlgorithm().equals(digest.getAlgorithm()))
29+
throw new InvalidKeyException("Key hash algorithm does not match chosen digest");
30+
- } else if (publicKey instanceof X509Key) {
31+
+ } else if (publicKey.getFormat().equals("X.509")) {
32+
// X509Certificate will sometimes contain an X509Key rather than the EdDSAPublicKey itself; the contained
33+
// key is valid but needs to be instanced as an EdDSAPublicKey before it can be used.
34+
EdDSAPublicKey parsedPublicKey;
35+
--
36+
2.33.1
37+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
From 1ea7fb5ed949d8a458fda40b186868b7cffbb271 Mon Sep 17 00:00:00 2001
2+
From: Mat Booth <mat.booth@gmail.com>
3+
Date: Wed, 1 Dec 2021 09:35:10 +0000
4+
Subject: [PATCH 2/2] Disable test that relies on internal sun JDK classes
5+
6+
---
7+
test/net/i2p/crypto/eddsa/EdDSAEngineTest.java | 18 ------------------
8+
1 file changed, 18 deletions(-)
9+
10+
diff --git a/test/net/i2p/crypto/eddsa/EdDSAEngineTest.java b/test/net/i2p/crypto/eddsa/EdDSAEngineTest.java
11+
index 2ed793b..adc46fd 100644
12+
--- a/test/net/i2p/crypto/eddsa/EdDSAEngineTest.java
13+
+++ b/test/net/i2p/crypto/eddsa/EdDSAEngineTest.java
14+
@@ -31,8 +31,6 @@ import net.i2p.crypto.eddsa.spec.EdDSAPublicKeySpec;
15+
import org.junit.Rule;
16+
import org.junit.Test;
17+
import org.junit.rules.ExpectedException;
18+
-import sun.security.util.DerValue;
19+
-import sun.security.x509.X509Key;
20+
21+
/**
22+
* @author str4d
23+
@@ -217,20 +215,4 @@ public class EdDSAEngineTest {
24+
assertThat("verifyOneShot() failed", sgr.verifyOneShot(TEST_MSG, TEST_MSG_SIG), is(true));
25+
}
26+
27+
- @Test
28+
- public void testVerifyX509PublicKeyInfo() throws Exception {
29+
- EdDSAParameterSpec spec = EdDSANamedCurveTable.getByName("Ed25519");
30+
- Signature sgr = new EdDSAEngine(MessageDigest.getInstance(spec.getHashAlgorithm()));
31+
- for (Ed25519TestVectors.TestTuple testCase : Ed25519TestVectors.testCases) {
32+
- EdDSAPublicKeySpec pubKey = new EdDSAPublicKeySpec(testCase.pk, spec);
33+
- PublicKey vKey = new EdDSAPublicKey(pubKey);
34+
- PublicKey x509Key = X509Key.parse(new DerValue(vKey.getEncoded()));
35+
- sgr.initVerify(x509Key);
36+
-
37+
- sgr.update(testCase.message);
38+
-
39+
- assertThat("Test case " + testCase.caseNum + " failed",
40+
- sgr.verify(testCase.sig), is(true));
41+
- }
42+
- }
43+
}
44+
--
45+
2.33.1
46+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
--- ed25519-java-0.3.0/src/net/i2p/crypto/eddsa/EdDSAEngine.java 2025-03-14 14:47:43.404137953 +0100
2+
+++ ed25519-java-0.3.0/src/net/i2p/crypto/eddsa/EdDSAEngine.java 2025-03-14 14:50:31.859888550 +0100
3+
@@ -12,6 +12,7 @@
4+
package net.i2p.crypto.eddsa;
5+
6+
import java.io.ByteArrayOutputStream;
7+
+import java.math.BigInteger;
8+
import java.nio.ByteBuffer;
9+
import java.security.InvalidAlgorithmParameterException;
10+
import java.security.InvalidKeyException;
11+
@@ -29,6 +30,7 @@
12+
import net.i2p.crypto.eddsa.math.Curve;
13+
import net.i2p.crypto.eddsa.math.GroupElement;
14+
import net.i2p.crypto.eddsa.math.ScalarOps;
15+
+import net.i2p.crypto.eddsa.math.bigint.BigIntegerLittleEndianEncoding;
16+
17+
/**
18+
* Signing and verification for EdDSA.
19+
@@ -69,6 +71,8 @@
20+
public final class EdDSAEngine extends Signature {
21+
public static final String SIGNATURE_ALGORITHM = "NONEwithEdDSA";
22+
23+
+ private static final BigInteger ORDER = new BigInteger("2").pow(252).add(new BigInteger("27742317777372353535851937790883648493"));
24+
+
25+
private MessageDigest digest;
26+
private ByteArrayOutputStream baos;
27+
private EdDSAKey key;
28+
@@ -306,6 +310,11 @@
29+
h = key.getParams().getScalarOps().reduce(h);
30+
31+
byte[] Sbyte = Arrays.copyOfRange(sigBytes, b/8, b/4);
32+
+ // RFC 8032
33+
+ BigInteger Sbigint = (new BigIntegerLittleEndianEncoding()).toBigInteger(Sbyte);
34+
+ if (Sbigint.compareTo(ORDER) >= 0)
35+
+ return false;
36+
+
37+
// R = SB - H(Rbar,Abar,M)A
38+
GroupElement R = key.getParams().getB().doubleScalarMultiplyVariableTime(
39+
((EdDSAPublicKey) key).getNegativeA(), h, Sbyte);

0 commit comments

Comments
 (0)