@@ -1239,17 +1239,6 @@ private static int leafSignatureType(HSSPrivateKeyParameters key, byte[] hssSign
12391239 return Pack .bigEndianToInt (hssSignature , hssSignature .length - h * m - 4 );
12401240 }
12411241
1242- /**
1243- * Wrapping an LMS key as a single level HSS key keeps the key it was given, rather than
1244- * regenerating it. resetKeyToIndex compares each level's q against the value derived from the
1245- * HSS index, and an intermediate level reads one past that value because it has already post
1246- * incremented past the leaf it signed - but the last level reads the derived value itself, and
1247- * when the hierarchy has one level the root is the last level. Applying the intermediate rule
1248- * there made the comparison always fail, so every wrap rebuilt the whole Merkle tree: this is
1249- * what BCLMSPrivateKey does for every LMS key pair the JCE produces, so the tree was built
1250- * twice - once to get the public key, once here - and the node cache the first build filled
1251- * was discarded with it.
1252- */
12531242 /**
12541243 * The lower half of a hierarchy repositions within its own tree - identifier and seed
12551244 * unchanged, only q moves - so resetKeyToIndex must share the tree the component key already
@@ -1299,6 +1288,17 @@ public void testBottomLevelRepositionKeepsTheTree()
12991288 verifier .verifySignature (msg , sig ));
13001289 }
13011290
1291+ /**
1292+ * Wrapping an LMS key as a single level HSS key keeps the key it was given, rather than
1293+ * regenerating it. resetKeyToIndex compares each level's q against the value derived from the
1294+ * HSS index, and an intermediate level reads one past that value because it has already post
1295+ * incremented past the leaf it signed - but the last level reads the derived value itself, and
1296+ * when the hierarchy has one level the root is the last level. Applying the intermediate rule
1297+ * there made the comparison always fail, so every wrap rebuilt the whole Merkle tree: this is
1298+ * what BCLMSPrivateKey does for every LMS key pair the JCE produces, so the tree was built
1299+ * twice - once to get the public key, once here - and the node cache the first build filled
1300+ * was discarded with it.
1301+ */
13021302 public void testSingleLevelWrapKeepsTheKey ()
13031303 throws Exception
13041304 {
0 commit comments