Skip to content

Commit 4d567d6

Browse files
author
gefeili
committed
Merge branch 'main' into pg-synchronize-bc_csharp
2 parents 7ef06d1 + fbfff8e commit 4d567d6

File tree

8 files changed

+108
-33
lines changed

8 files changed

+108
-33
lines changed

ci/check_java.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ export BC_JDK21=`openjdk_21`
1818
export JAVA_HOME=`openjdk_17`
1919
export PATH=$JAVA_HOME/bin:$PATH
2020

21+
# Checkstyle
2122
./gradlew check -x test;
2223

2324

24-
25+
# OSGI scanner only, no testing
26+
./gradlew clean build -x test
27+
./osgi_scan.sh
2528

docs/releasenotes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ <h3>2.3.5 Security Advisories.</h3>
9292
<li>CVE-2024-29857 - Importing an EC certificate with specially crafted F2m parameters can cause high CPU usage during parameter evaluation.</li>
9393
<li>CVE-2024-30171 - Possible timing based leakage in RSA based handshakes due to exception processing eliminated.</li>
9494
<li>CVE-2024-30172 - Crafted signature and public key can be used to trigger an infinite loop in the Ed25519 verification code.</li>
95-
<li>CVE-2024-301XX - When endpoint identification is enabled in the BCJSSE and an SSL socket is not created with an explicit hostname (as happens with HttpsURLConnection), hostname verification could be performed against a DNS-resolved IP address. This has been fixed.</li>
95+
<li>CVE-2024-34447 - When endpoint identification is enabled in the BCJSSE and an SSL socket is not created with an explicit hostname (as happens with HttpsURLConnection), hostname verification could be performed against a DNS-resolved IP address. This has been fixed.</li>
9696
</ul>
9797

9898
<a id="r1rv77"><h3>2.4.1 Version</h3></a>

osgi_scan.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if ! command -v osgiscanner &> /dev/null
5+
then
6+
echo "osgiscanner not on path"
7+
exit 1
8+
fi
9+
10+
export script_loc=$( cd -- "$( dirname -- "$0" )" &> /dev/null && pwd )
11+
cd $script_loc
12+
13+
export BCHOME=`pwd`
14+
15+
osgiscanner -f osgi_scan.xml

osgi_scan.xml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<osgiscanner>
3+
4+
5+
<prop load="gradle.properties"/>
6+
7+
<!-- Make bundle regular expression -->
8+
<prop name="bundle_ver" value="${version}" find="-SNAPSHOT" replace=".0.[0-9]+"/>
9+
<prop name="bundle_ver" value="^${bundle_ver}" find="\." replace="\\."/>
10+
11+
<!-- Make import range expression -->
12+
<prop name="import_low" value="${version}" find="-SNAPSHOT" replace=".0.[0-9]+"/>
13+
<prop name="import_low" value="${import_low}" find="\." replace="\\."/>
14+
<prop name="import_max" value="${maxVersion}" find="-SNAPSHOT" replace=".0.[0-9]+"/>
15+
<prop name="import_max" value="${import_max}" find="\." replace="\\."/>
16+
<prop name="import_range" value="^\[${import_low}\,${import_max}\)"/>
17+
18+
<jar file="${ENV.BCHOME}/libs/jakarta.activation-api-2.0.0.jar"/>
19+
<jar file="${ENV.BCHOME}/libs/jakarta.mail-2.0.1.jar"/>
20+
<jar file="${ENV.BCHOME}/core/build/libs/core-${version}.jar"/>
21+
<jar file="${ENV.BCHOME}/core/build/libs/core-${version}.jar"/>
22+
<jar file="${ENV.BCHOME}/jmail/build/libs/bcjmail-jdk18on-${version}.jar"/>
23+
<jar file="${ENV.BCHOME}/mls/build/libs/bcmls-jdk18on-${version}.jar"/>
24+
<jar file="${ENV.BCHOME}/pg/build/libs/bcpg-jdk18on-${version}.jar"/>
25+
<jar file="${ENV.BCHOME}/pkix/build/libs/bcpkix-jdk18on-${version}.jar"/>
26+
<jar file="${ENV.BCHOME}/prov/build/libs/bcprov-jdk18on-${version}.jar"/>
27+
<jar file="${ENV.BCHOME}/tls/build/libs/bctls-jdk18on-${version}.jar"/>
28+
<jar file="${ENV.BCHOME}/util/build/libs/bcutil-jdk18on-${version}.jar"/>
29+
30+
<bundle matches="^bcprov" version="${bundle_ver}">
31+
<ignore-package package="^mls_client"/>
32+
<ignore-package package="^org\.bouncycastle\.mls\.client"/>
33+
34+
<header key="Bundle-Version" matches="${bundle_ver}"/>
35+
36+
<header key="Export-Package" matches=".*" on-undefined="fail">
37+
<package matches="^org\.bouncycastle\.*" param="version" test="${bundle_ver}" on-match="pass"
38+
on-undefined="fail"/>
39+
</header>
40+
41+
</bundle>
42+
43+
44+
<bundle matches="^bc(jmail|mls|pg|pkix|tls|util)" version="${bundle_ver}">
45+
<ignore-package package="^mls_client"/>
46+
<ignore-package package="^org\.bouncycastle\.mls\.client"/>
47+
48+
<header key="Bundle-Version" matches="${bundle_ver}"/>
49+
50+
<header key="Export-Package" matches=".*" on-undefined="fail">
51+
<package matches="^org\.bouncycastle\.*" param="version" test="${bundle_ver}" on-match="pass"
52+
on-undefined="fail"/>
53+
</header>
54+
55+
<header key="Import-Package" matches=".*" on-undefined="fail">
56+
<package matches="^org\.bouncycastle\.*" param="version" test="${import_range}" on-match="pass"
57+
on-undefined="fail"/>
58+
</header>
59+
60+
61+
</bundle>
62+
63+
</osgiscanner>

pkix/src/main/java/org/bouncycastle/openssl/PEMParser.java

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import java.util.Set;
1111
import java.util.StringTokenizer;
1212

13-
import org.bouncycastle.asn1.ASN1InputStream;
13+
import org.bouncycastle.asn1.ASN1BitString;
1414
import org.bouncycastle.asn1.ASN1Integer;
1515
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
1616
import org.bouncycastle.asn1.ASN1Primitive;
@@ -110,22 +110,19 @@ public Object readObject()
110110
throws IOException
111111
{
112112
PemObject obj = readPemObject();
113+
if (obj == null)
114+
{
115+
return null;
116+
}
113117

114-
if (obj != null)
118+
String type = obj.getType();
119+
Object pemObjectParser = parsers.get(type);
120+
if (pemObjectParser == null)
115121
{
116-
String type = obj.getType();
117-
Object pemObjectParser = parsers.get(type);
118-
if (pemObjectParser != null)
119-
{
120-
return ((PemObjectParser)pemObjectParser).parseObject(obj);
121-
}
122-
else
123-
{
124-
throw new IOException("unrecognised object: " + type);
125-
}
122+
throw new IOException("unrecognised object: " + type);
126123
}
127124

128-
return null;
125+
return ((PemObjectParser)pemObjectParser).parseObject(obj);
129126
}
130127

131128
/**
@@ -268,16 +265,14 @@ public PEMKeyPair parse(byte[] encoding)
268265
pKey.getParametersObject());
269266
PrivateKeyInfo privInfo = new PrivateKeyInfo(algId, pKey);
270267

271-
if (pKey.getPublicKey() != null)
268+
ASN1BitString publicKey = pKey.getPublicKey();
269+
SubjectPublicKeyInfo pubInfo = null;
270+
if (publicKey != null)
272271
{
273-
SubjectPublicKeyInfo pubInfo = new SubjectPublicKeyInfo(algId, pKey.getPublicKey().getBytes());
274-
275-
return new PEMKeyPair(pubInfo, privInfo);
276-
}
277-
else
278-
{
279-
return new PEMKeyPair(null, privInfo);
272+
pubInfo = new SubjectPublicKeyInfo(algId, publicKey.getBytes());
280273
}
274+
275+
return new PEMKeyPair(pubInfo, privInfo);
281276
}
282277
catch (IOException e)
283278
{
@@ -353,9 +348,10 @@ public Object parseObject(PemObject obj)
353348
{
354349
try
355350
{
351+
AlgorithmIdentifier algId = new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, DERNull.INSTANCE);
356352
RSAPublicKey rsaPubStructure = RSAPublicKey.getInstance(obj.getContent());
357353

358-
return new SubjectPublicKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, DERNull.INSTANCE), rsaPubStructure);
354+
return new SubjectPublicKeyInfo(algId, rsaPubStructure);
359355
}
360356
catch (IOException e)
361357
{
@@ -475,9 +471,7 @@ public Object parseObject(PemObject obj)
475471
{
476472
try
477473
{
478-
ASN1InputStream aIn = new ASN1InputStream(obj.getContent());
479-
480-
return ContentInfo.getInstance(aIn.readObject());
474+
return ContentInfo.getInstance(obj.getContent());
481475
}
482476
catch (Exception e)
483477
{
@@ -508,7 +502,7 @@ public Object parseObject(PemObject obj)
508502

509503
if (param instanceof ASN1ObjectIdentifier)
510504
{
511-
return ASN1Primitive.fromByteArray(obj.getContent());
505+
return param;
512506
}
513507
else if (param instanceof ASN1Sequence)
514508
{

pkix/src/main/java/org/bouncycastle/pkcs/PKCS10CertificationRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ private static ASN1Encodable getSingleValue(Attribute at)
8080
}
8181

8282
/**
83-
* Create a PKCS10CertificationRequestHolder from an underlying ASN.1 structure.
83+
* Create a PKCS10CertificationRequest from an underlying ASN.1 structure.
8484
*
8585
* @param certificationRequest the underlying ASN.1 structure representing a request.
8686
*/
@@ -134,7 +134,7 @@ public PKCS10CertificationRequest(CertificationRequest certificationRequest)
134134
}
135135

136136
/**
137-
* Create a PKCS10CertificationRequestHolder from the passed in bytes.
137+
* Create a PKCS10CertificationRequest from the passed in bytes.
138138
*
139139
* @param encoded BER/DER encoding of the CertificationRequest structure.
140140
* @throws IOException in the event of corrupted data, or an incorrect structure.

pkix/src/test/java/org/bouncycastle/openssl/test/ParserTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ public void performTest()
301301
{
302302
if (privInfo instanceof PrivateKeyInfo)
303303
{
304-
privKey = (RSAPrivateCrtKey)converter.getPrivateKey(PrivateKeyInfo.getInstance(privInfo));
304+
privKey = (RSAPrivateCrtKey)converter.getPrivateKey((PrivateKeyInfo)privInfo);
305305
}
306306
else
307307
{

prov/src/main/java/org/bouncycastle/pqc/jcajce/spec/SPHINCSPlusParameterSpec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public class SPHINCSPlusParameterSpec
2121
public static final SPHINCSPlusParameterSpec sha2_256f_robust = new SPHINCSPlusParameterSpec("sha2-256f-robust");
2222
public static final SPHINCSPlusParameterSpec sha2_256s_robust = new SPHINCSPlusParameterSpec("sha2-256s-robust");
2323

24-
public static final SPHINCSPlusParameterSpec sha2_128f = new SPHINCSPlusParameterSpec("sha2-128s");
25-
public static final SPHINCSPlusParameterSpec sha2_128s = new SPHINCSPlusParameterSpec("sha2-128f");
24+
public static final SPHINCSPlusParameterSpec sha2_128f = new SPHINCSPlusParameterSpec("sha2-128f");
25+
public static final SPHINCSPlusParameterSpec sha2_128s = new SPHINCSPlusParameterSpec("sha2-128s");
2626

2727
public static final SPHINCSPlusParameterSpec sha2_192f = new SPHINCSPlusParameterSpec("sha2-192f");
2828
public static final SPHINCSPlusParameterSpec sha2_192s = new SPHINCSPlusParameterSpec("sha2-192s");

0 commit comments

Comments
 (0)