jdk/src/share/classes/sun/security/rsa/RSAPadding.java
changeset 19436 cfc7d402795c
parent 5506 202f599c92aa
child 22309 1990211a42e5
--- a/jdk/src/share/classes/sun/security/rsa/RSAPadding.java	Tue Aug 06 14:26:34 2013 +0100
+++ b/jdk/src/share/classes/sun/security/rsa/RSAPadding.java	Wed Aug 14 10:50:52 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -458,7 +458,7 @@
     private void mgf1(byte[] seed, int seedOfs, int seedLen,
             byte[] out, int outOfs, int maskLen)  throws BadPaddingException {
         byte[] C = new byte[4]; // 32 bit counter
-        byte[] digest = new byte[20]; // 20 bytes is length of SHA-1 digest
+        byte[] digest = new byte[mgfMd.getDigestLength()];
         while (maskLen > 0) {
             mgfMd.update(seed, seedOfs, seedLen);
             mgfMd.update(C);