src/java.base/share/classes/sun/security/ssl/HKDF.java
branchJDK-8145252-TLS13-branch
changeset 56637 d66751750b72
parent 56542 56aaa6cb3693
child 56648 88da002507ab
equal deleted inserted replaced
56636:ef5c16991f27 56637:d66751750b72
   139         byte[] kdfOutput;
   139         byte[] kdfOutput;
   140 
   140 
   141         // Calculate the number of rounds of HMAC that are needed to
   141         // Calculate the number of rounds of HMAC that are needed to
   142         // meet the requested data.  Then set up the buffers we will need.
   142         // meet the requested data.  Then set up the buffers we will need.
   143         Objects.requireNonNull(pseudoRandKey, "A null PRK is not allowed.");
   143         Objects.requireNonNull(pseudoRandKey, "A null PRK is not allowed.");
       
   144 
       
   145         // Output from the expand operation must be <= 255 * hmac length
       
   146         if (outLen > 255 * hmacLen) {
       
   147             throw new IllegalArgumentException("Requested output length " +
       
   148                     "exceeds maximum length allowed for HKDF expansion");
       
   149         }
   144         hmacObj.init(pseudoRandKey);
   150         hmacObj.init(pseudoRandKey);
   145         if (info == null) {
   151         if (info == null) {
   146             info = new byte[0];
   152             info = new byte[0];
   147         }
   153         }
   148         int rounds = (outLen + hmacLen - 1) / hmacLen;
   154         int rounds = (outLen + hmacLen - 1) / hmacLen;