Skip to content

Commit 47569a2

Browse files
committed
8295919: java.security.MessageDigest.isEqual does not adhere to @implNote
Reviewed-by: mullan
1 parent 5a6aa56 commit 47569a2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/java.base/share/classes/java/security/MessageDigest.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2023, 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
@@ -457,10 +457,12 @@ public String toString() {
457457
* the same length and all bytes at corresponding positions are equal.
458458
*
459459
* @implNote
460-
* All bytes in {@code digesta} are examined to determine equality.
461-
* The calculation time depends only on the length of {@code digesta}.
462-
* It does not depend on the length of {@code digestb} or the contents
463-
* of {@code digesta} and {@code digestb}.
460+
* All bytes in {@code digesta} are examined to determine equality, unless
461+
* {@code digestb} is {@code null} or has a length of zero bytes. If
462+
* {@code digestb} is not {@code null} and does not have a length of zero
463+
* bytes, then the calculation time depends only on the length of
464+
* {@code digesta}. It does not depend on the length of {@code digestb} or
465+
* the contents of {@code digesta} and {@code digestb}.
464466
*
465467
* @param digesta one of the digests to compare.
466468
*

0 commit comments

Comments
 (0)