jdk/src/share/classes/sun/security/rsa/RSAPadding.java
changeset 19436 cfc7d402795c
parent 5506 202f599c92aa
child 22309 1990211a42e5
equal deleted inserted replaced
19435:9d7530ff42cb 19436:cfc7d402795c
     1 /*
     1 /*
     2  * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2013 Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   456      * out[] starting at outOfs;
   456      * out[] starting at outOfs;
   457      */
   457      */
   458     private void mgf1(byte[] seed, int seedOfs, int seedLen,
   458     private void mgf1(byte[] seed, int seedOfs, int seedLen,
   459             byte[] out, int outOfs, int maskLen)  throws BadPaddingException {
   459             byte[] out, int outOfs, int maskLen)  throws BadPaddingException {
   460         byte[] C = new byte[4]; // 32 bit counter
   460         byte[] C = new byte[4]; // 32 bit counter
   461         byte[] digest = new byte[20]; // 20 bytes is length of SHA-1 digest
   461         byte[] digest = new byte[mgfMd.getDigestLength()];
   462         while (maskLen > 0) {
   462         while (maskLen > 0) {
   463             mgfMd.update(seed, seedOfs, seedLen);
   463             mgfMd.update(seed, seedOfs, seedLen);
   464             mgfMd.update(C);
   464             mgfMd.update(C);
   465             try {
   465             try {
   466                 mgfMd.digest(digest, 0, digest.length);
   466                 mgfMd.digest(digest, 0, digest.length);