On Sat, 2006-07-29 at 18:43 +0200, Mark Wielaard wrote:
> On Sat, 2006-07-29 at 17:52 +0200, Mark Wielaard wrote:
> > > And the mauve test that should now pass with the patch is
> > > java.security.Engine.getInstance testAlgorithmCase
> > 
> > It did pass before your patch (because the canonicalization was done in
> > the Provider first) but no regressions, and this way is indeed nicer.
> 
> However, it does cause a regression with some other mauve test:
> FAIL: gnu.java.security.jce.TestOfProvider
>   line 150: getInstance(SHA-256PRNG): java.security.NoSuchAlgorithmException: 
> too many aliases [1] -- forced fail
> 
> This seems to be caused because your patch doesn't seem to handle
> aliases pointing to themselves. And the Gnu provider does that. I am not
> sure why the provider puts in aliases to itself, but the old code
> handled this case. Could you take a look?

The attached patch, already committed, fixes this problem. There should
be no other tests regressions from this patch.

The issues was that my previous patch did not take into consideration
self referencing aliases. So it was entering an infinite loop of finding
the alias, and then searching for the alias, which was always itself.
The attach patch safety ignores these types of alias.

I have no idea why we have self referencing aliases as it's completely
redundant, but the logic can now handle them.

Thanks,

Matt Wringe


Changelog:

2006-07-30  Matt Wringe  <[EMAIL PROTECTED]>

        * gnu/java/security/Engine.java 
        (getInstance): Ignore self referencing aliases.
Index: Engine.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/java/security/Engine.java,v
retrieving revision 1.4
diff -u -r1.4 Engine.java
--- Engine.java	28 Jul 2006 18:48:36 -0000	1.4
+++ Engine.java	30 Jul 2006 20:27:18 -0000
@@ -166,13 +166,16 @@
           {
 
             alias = (String) provider.getProperty(key);
-            algorithm = alias;
-            if (count++ > MAX_ALIASES)
-              throw new NoSuchAlgorithmException("too many aliases");
-
-            // need to reset enumeration to now look for the alias
-            enumer = provider.propertyNames();
-
+            
+            if (! algorithm.equalsIgnoreCase(alias)) // does not refer to itself
+              {
+                algorithm = alias;
+                if (count++ > MAX_ALIASES)
+                  throw new NoSuchAlgorithmException("too many aliases");
+                
+                // need to reset enumeration to now look for the alias
+                enumer = provider.propertyNames();
+              }
           }
       }
     

Reply via email to