alopresto commented on a change in pull request #3844: NIFI-1474 Added
validation for p in scrypt
URL: https://github.com/apache/nifi/pull/3844#discussion_r339188444
##########
File path:
nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/util/crypto/ScryptCipherProvider.java
##########
@@ -78,6 +79,17 @@ public ScryptCipherProvider(int n, int r, int p) {
if (p < DEFAULT_P) {
logger.warn("The provided parallelization factor {} is below the
recommended minimum {}", p, DEFAULT_P);
}
+
+ if (!isPValid(r, p)) {
+ logger.warn("Based on the provided block size {}, the provided
parallelization factor {} is out of bounds", r, p);
+ throw new IllegalArgumentException("Invalid p value exceeds p
boundary");
+ }
+ }
+
+ public static boolean isPValid(int r, int p) {
Review comment:
Please add a Javadoc comment for this public method.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services