@@ -88,11 +88,6 @@ public static class KangarooParameters
8888 */
8989 private byte [] thePersonal ;
9090
91- /**
92- * The maximum xofLen.
93- */
94- private long theMaxXofLen ;
95-
9691 /**
9792 * Obtain the personalisation.
9893 *
@@ -103,16 +98,6 @@ public byte[] getPersonalisation()
10398 return Arrays .clone (thePersonal );
10499 }
105100
106- /**
107- * Obtain the maximum output length.
108- *
109- * @return the output length
110- */
111- public long getMaxOutputLength ()
112- {
113- return theMaxXofLen ;
114- }
115-
116101 /**
117102 * Parameter Builder.
118103 */
@@ -123,11 +108,6 @@ public static class Builder
123108 */
124109 private byte [] thePersonal ;
125110
126- /**
127- * The maximum xofLen.
128- */
129- private long theMaxXofLen ;
130-
131111 /**
132112 * Set the personalisation.
133113 *
@@ -140,18 +120,6 @@ public Builder setPersonalisation(final byte[] pPersonal)
140120 return this ;
141121 }
142122
143- /**
144- * Set the maximum output length. (-1=unlimited)
145- *
146- * @param pMaxOutLen the maximum output length
147- * @return the Builder
148- */
149- public Builder setMaxOutputLen (final long pMaxOutLen )
150- {
151- theMaxXofLen = pMaxOutLen ;
152- return this ;
153- }
154-
155123 /**
156124 * Build the parameters.
157125 *
@@ -162,12 +130,11 @@ public KangarooParameters build()
162130 /* Create params */
163131 final KangarooParameters myParams = new KangarooParameters ();
164132
165- /* Record personalisation and xof length */
133+ /* Record personalisation */
166134 if (thePersonal != null )
167135 {
168136 myParams .thePersonal = thePersonal ;
169137 }
170- myParams .theMaxXofLen = theMaxXofLen ;
171138
172139 /* Return the parameters */
173140 return myParams ;
@@ -231,16 +198,6 @@ abstract static class KangarooBase
231198 */
232199 private byte [] thePersonal ;
233200
234- /**
235- * The XofLen.
236- */
237- private long theXofLen ;
238-
239- /**
240- * The XofRemaining.
241- */
242- private long theXofRemaining ;
243-
244201 /**
245202 * Are we squeezing?.
246203 */
@@ -271,8 +228,6 @@ abstract static class KangarooBase
271228 theTree = new KangarooSponge (pStrength , pRounds );
272229 theLeaf = new KangarooSponge (pStrength , pRounds );
273230 theChainLen = pStrength >> 2 ;
274- theXofLen = pLength ;
275- theXofRemaining = -1L ;
276231
277232 /* Build personalisation */
278233 buildPersonal (null );
@@ -301,7 +256,7 @@ public int getByteLength()
301256
302257 public int getDigestSize ()
303258 {
304- return theXofLen == 0 ? theChainLen >> 1 : ( int ) theXofLen ;
259+ return theChainLen >> 1 ;
305260 }
306261
307262 /**
@@ -314,14 +269,6 @@ public void init(final KangarooParameters pParams)
314269 /* Build the new personalisation */
315270 buildPersonal (pParams .getPersonalisation ());
316271
317- /* Reject a negative Xof length */
318- final long myXofLen = pParams .getMaxOutputLength ();
319- if (myXofLen < -1 )
320- {
321- throw new IllegalArgumentException ("Invalid output length" );
322- }
323- theXofLen = myXofLen ;
324-
325272 /* Reset everything */
326273 reset ();
327274 }
@@ -342,12 +289,6 @@ public void update(final byte[] pIn,
342289 public int doFinal (final byte [] pOut ,
343290 final int pOutOffset )
344291 {
345- /* Check for defined output length */
346- if (getDigestSize () == -1 )
347- {
348- throw new IllegalStateException ("No defined output length" );
349- }
350-
351292 /* finalise the digest */
352293 return doFinal (pOut , pOutOffset , getDigestSize ());
353294 }
@@ -380,11 +321,10 @@ public int doOutput(final byte[] pOut,
380321 switchToSqueezing ();
381322 }
382323
383- /* Reject if there is insufficient Xof remaining */
384- if (pOutLen < 0
385- || (theXofRemaining > 0 && pOutLen > theXofRemaining ))
324+ /* Reject if length is invalid */
325+ if (pOutLen < 0 )
386326 {
387- throw new IllegalArgumentException ("Insufficient bytes remaining " );
327+ throw new IllegalArgumentException ("Invalid output length " );
388328 }
389329
390330 /* Squeeze out the data and return the length */
@@ -455,7 +395,6 @@ public void reset()
455395 theLeaf .initSponge ();
456396 theCurrNode = 0 ;
457397 theProcessed = 0 ;
458- theXofRemaining = -1L ;
459398 squeezing = false ;
460399 }
461400
@@ -513,22 +452,6 @@ private void switchToSqueezing()
513452 {
514453 switchFinal ();
515454 }
516-
517- /* If we have a null Xof */
518- if (theXofLen == 0 )
519- {
520- /* Calculate the number of bytes available */
521- theXofRemaining = getDigestSize ();
522-
523- /* Else we are handling a normal Xof */
524- }
525- else
526- {
527- /* Calculate the number of bytes available */
528- theXofRemaining = theXofLen == -1
529- ? -2
530- : theXofLen ;
531- }
532455 }
533456
534457 /**
0 commit comments