Skip to content

Commit a18e904

Browse files
committedJun 8, 2022
8285591: [11] add signum checks in DSA.java engineVerify
Reviewed-by: sgehwolf, mbalao Backport-of: bf3438c5dc993b96d089cabb5318bfc64a6904a3
1 parent 95962f1 commit a18e904

File tree

1 file changed

+3
-2
lines changed
  • jdk/src/share/classes/sun/security/provider

1 file changed

+3
-2
lines changed
 

‎jdk/src/share/classes/sun/security/provider/DSA.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -299,7 +299,8 @@ protected boolean engineVerify(byte[] signature, int offset, int length)
299299
s = new BigInteger(1, s.toByteArray());
300300
}
301301

302-
if ((r.compareTo(presetQ) == -1) && (s.compareTo(presetQ) == -1)) {
302+
if ((r.compareTo(presetQ) == -1) && (s.compareTo(presetQ) == -1)
303+
&& r.signum() > 0 && s.signum() > 0) {
303304
BigInteger w = generateW(presetP, presetQ, presetG, s);
304305
BigInteger v = generateV(presetY, presetP, presetQ, presetG, w, r);
305306
return v.equals(r);

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Jun 8, 2022

@openjdk-notifier[bot]
Please sign in to comment.