@@ -300,35 +300,37 @@ static PerContext createPerContext(boolean isFipsContext, JcaTlsCrypto crypto,
300300 return new PerContext (index , candidatesClient , candidatesServer );
301301 }
302302
303- static String [] getJcaSignatureAlgorithms (Collection <SignatureSchemeInfo > infos )
303+ private static String [] getJcaSignatureAlgorithms (Collection <SignatureSchemeInfo > infos )
304304 {
305305 if (null == infos )
306306 {
307307 return TlsUtils .EMPTY_STRINGS ;
308308 }
309309
310- ArrayList <String > result = new ArrayList <String >();
310+ String [] result = new String [infos .size ()];
311+ int resultPos = 0 ;
311312 for (SignatureSchemeInfo info : infos )
312313 {
313314 // TODO The two kinds of PSS signature scheme can give duplicates here
314- result . add ( info .getJcaSignatureAlgorithm () );
315+ result [ resultPos ++] = info .getJcaSignatureAlgorithm ();
315316 }
316- return result . toArray ( TlsUtils . EMPTY_STRINGS ) ;
317+ return result ;
317318 }
318319
319- static String [] getJcaSignatureAlgorithmsBC (Collection <SignatureSchemeInfo > infos )
320+ private static String [] getJcaSignatureAlgorithmsBC (Collection <SignatureSchemeInfo > infos )
320321 {
321322 if (null == infos )
322323 {
323324 return TlsUtils .EMPTY_STRINGS ;
324325 }
325326
326- ArrayList <String > result = new ArrayList <String >();
327+ String [] result = new String [infos .size ()];
328+ int resultPos = 0 ;
327329 for (SignatureSchemeInfo info : infos )
328330 {
329- result . add ( info .getJcaSignatureAlgorithmBC () );
331+ result [ resultPos ++] = info .getJcaSignatureAlgorithmBC ();
330332 }
331- return result . toArray ( TlsUtils . EMPTY_STRINGS ) ;
333+ return result ;
332334 }
333335
334336 static SignatureAndHashAlgorithm getSignatureAndHashAlgorithm (int signatureScheme )
@@ -341,7 +343,8 @@ static SignatureAndHashAlgorithm getSignatureAndHashAlgorithm(int signatureSchem
341343 return SignatureScheme .getSignatureAndHashAlgorithm (signatureScheme );
342344 }
343345
344- static Vector <SignatureAndHashAlgorithm > getSignatureAndHashAlgorithms (List <SignatureSchemeInfo > signatureSchemeInfos )
346+ private static Vector <SignatureAndHashAlgorithm > getSignatureAndHashAlgorithms (
347+ Collection <SignatureSchemeInfo > signatureSchemeInfos )
345348 {
346349 // TODO[tls13] Actually should return empty for empty?
347350 if (null == signatureSchemeInfos || signatureSchemeInfos .isEmpty ())
0 commit comments