Skip to content

Commit fde6ef0

Browse files
author
gefeili
committed
Fix the bugs in OperatorBcTest
1 parent 4abf695 commit fde6ef0

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

pg/src/main/java/org/bouncycastle/openpgp/PGPSignature.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -455,19 +455,18 @@ else if (getKeyAlgorithm() == PublicKeyAlgorithmTags.EDDSA_LEGACY)
455455
{
456456
byte[] a = BigIntegers.asUnsignedByteArray(sigValues[0].getValue());
457457
byte[] b = BigIntegers.asUnsignedByteArray(sigValues[1].getValue());
458-
if (a.length + b.length == Ed25519.SIGNATURE_SIZE)
459-
{
460-
signature = new byte[Ed25519.SIGNATURE_SIZE];
461-
System.arraycopy(a, 0, signature, Ed25519.PUBLIC_KEY_SIZE - a.length, a.length);
462-
System.arraycopy(b, 0, signature, Ed25519.SIGNATURE_SIZE - b.length, b.length);
463-
}
464-
else
458+
if (a.length + b.length > Ed25519.SIGNATURE_SIZE)
465459
{
466460
signature = new byte[Ed448.SIGNATURE_SIZE];
467461
System.arraycopy(a, 0, signature, Ed448.PUBLIC_KEY_SIZE - a.length, a.length);
468462
System.arraycopy(b, 0, signature, Ed448.SIGNATURE_SIZE - b.length, b.length);
469463
}
470-
464+
else
465+
{
466+
signature = new byte[Ed25519.SIGNATURE_SIZE];
467+
System.arraycopy(a, 0, signature, Ed25519.PUBLIC_KEY_SIZE - a.length, a.length);
468+
System.arraycopy(b, 0, signature, Ed25519.SIGNATURE_SIZE - b.length, b.length);
469+
}
471470
}
472471
else
473472
{

0 commit comments

Comments
 (0)