GMSSRootCalc treeToConstruct = new GMSSRootCalc(this.heightOfTrees[h], this.K[h], this.digestProvider); treeToConstruct.initialize(nextStack); treeToConstruct.initializeTreehashSeed(seed, count); seedForTreehashIndex *= 2; count++; treeToConstruct.update(ots.getPublicKey()); if (treeToConstruct.wasFinished())
GMSSRootCalc tree = new GMSSRootCalc(this.heightOfTrees[h], this.K[h], digestProvider); try System.arraycopy(tree.getAuthPath()[i], 0, currentAuthPaths[h][i], 0, mdLength); currentRetain[h] = tree.getRetain(); currentTreehash[h] = tree.getTreehash(); System.arraycopy(tree.getRoot(), 0, currentRoots[h], 0, mdLength); System.arraycopy(tree.getAuthPath()[i], 0, nextAuthPaths[h][i], 0, mdLength); nextRetain[h] = tree.getRetain(); nextTreehash[h] = tree.getTreehash(); System.arraycopy(tree.getRoot(), 0, nextRoots[h], 0, mdLength);
/** * @return a human readable version of the structure */ public String toString() { String out = ""; int tailLength; if (tailStack == null) { tailLength = 0; } else { tailLength = tailStack.size(); } for (int i = 0; i < 8 + heightOfTree + tailLength; i++) { out = out + getStatInt()[i] + " "; } for (int i = 0; i < 1 + heightOfTree + tailLength; i++) { out = out + new String(Hex.encode(getStatByte()[i])) + " "; } out = out + " " + digestProvider.get().getDigestSize(); return out; } }
/** * updates the root with one leaf and stores needed values in retain, * treehash or authpath. Additionally counts the seeds used. This method is * used when performing the updates for TREE++. * * @param seed the initial seed for treehash: seedNext * @param leaf the height of the treehash */ public void update(byte[] seed, byte[] leaf) { if (this.heightOfNextSeed < (this.heightOfTree - this.K) && this.indexForNextSeed - 2 == index[0]) { this.initializeTreehashSeed(seed, this.heightOfNextSeed); this.heightOfNextSeed++; this.indexForNextSeed *= 2; } // now call the simple update this.update(leaf); }
int heightOfTree = nextNextRoot[i].getStatInt()[0]; int tailLength = nextNextRoot[i].getStatInt()[7]; nextNextRoot[i].getStatByte()[0])); for (int j = 0; j < heightOfTree; j++) .getStatByte()[1 + j])); .getStatByte()[1 + heightOfTree + j])); seqOfnnRInts.add(new ASN1Integer(nextNextRoot[i].getStatInt()[1])); seqOfnnRInts.add(new ASN1Integer(nextNextRoot[i].getStatInt()[2])); seqOfnnRInts.add(new ASN1Integer(nextNextRoot[i].getStatInt()[3])); seqOfnnRInts.add(new ASN1Integer(nextNextRoot[i].getStatInt()[4])); seqOfnnRInts.add(new ASN1Integer(nextNextRoot[i].getStatInt()[5])); seqOfnnRInts.add(new ASN1Integer(nextNextRoot[i].getStatInt()[6])); seqOfnnRInts.add(new ASN1Integer(tailLength)); for (int j = 0; j < heightOfTree; j++) nextNextRoot[i].getStatInt()[8 + j])); seqOfnnRInts.add(new ASN1Integer(nextNextRoot[i].getStatInt()[8 + heightOfTree + j])); if (nextNextRoot[i].getTreehash() != null) for (int j = 0; j < nextNextRoot[i].getTreehash().length; j++) tailLength = nextNextRoot[i].getTreehash()[j].getStatInt()[1];
this.nextNextRoot[layer - 1].initialize(new Vector());
for (int i = 0; i < numLayer - 1; i++) this.nextNextRoot[i] = new GMSSRootCalc( this.heightOfTrees[i + 1], this.K[i + 1], this.digestProvider);
int heightOfTree = nextNextRoot[i].getStatInt()[0]; int tailLength = nextNextRoot[i].getStatInt()[7]; nextNextRoot[i].getStatByte()[0])); for (int j = 0; j < heightOfTree; j++) .getStatByte()[1 + j])); .getStatByte()[1 + heightOfTree + j])); seqOfnnRInts.add(new ASN1Integer(nextNextRoot[i].getStatInt()[1])); seqOfnnRInts.add(new ASN1Integer(nextNextRoot[i].getStatInt()[2])); seqOfnnRInts.add(new ASN1Integer(nextNextRoot[i].getStatInt()[3])); seqOfnnRInts.add(new ASN1Integer(nextNextRoot[i].getStatInt()[4])); seqOfnnRInts.add(new ASN1Integer(nextNextRoot[i].getStatInt()[5])); seqOfnnRInts.add(new ASN1Integer(nextNextRoot[i].getStatInt()[6])); seqOfnnRInts.add(new ASN1Integer(tailLength)); for (int j = 0; j < heightOfTree; j++) nextNextRoot[i].getStatInt()[8 + j])); seqOfnnRInts.add(new ASN1Integer(nextNextRoot[i].getStatInt()[8 + heightOfTree + j])); if (nextNextRoot[i].getTreehash() != null) for (int j = 0; j < nextNextRoot[i].getTreehash().length; j++) tailLength = nextNextRoot[i].getTreehash()[j].getStatInt()[1];
/** * updates the root with one leaf and stores needed values in retain, * treehash or authpath. Additionally counts the seeds used. This method is * used when performing the updates for TREE++. * * @param seed the initial seed for treehash: seedNext * @param leaf the height of the treehash */ public void update(byte[] seed, byte[] leaf) { if (this.heightOfNextSeed < (this.heightOfTree - this.K) && this.indexForNextSeed - 2 == index[0]) { this.initializeTreehashSeed(seed, this.heightOfNextSeed); this.heightOfNextSeed++; this.indexForNextSeed *= 2; } // now call the simple update this.update(leaf); }
this.nextNextRoot[layer - 1].initialize(new Vector());
for (int i = 0; i < numLayer - 1; i++) this.nextNextRoot[i] = new GMSSRootCalc( this.heightOfTrees[i + 1], this.K[i + 1], this.digestProvider);
GMSSRootCalc treeToConstruct = new GMSSRootCalc(this.heightOfTrees[h], this.K[h], this.digestProvider); treeToConstruct.initialize(nextStack); treeToConstruct.initializeTreehashSeed(seed, count); seedForTreehashIndex *= 2; count++; treeToConstruct.update(ots.getPublicKey()); if (treeToConstruct.wasFinished())
System.arraycopy(tree.getAuthPath()[i], 0, currentAuthPaths[h][i], 0, mdLength); currentRetain[h] = tree.getRetain(); currentTreehash[h] = tree.getTreehash(); System.arraycopy(tree.getRoot(), 0, currentRoots[h], 0, mdLength); System.arraycopy(tree.getAuthPath()[i], 0, nextAuthPaths[h][i], 0, mdLength); nextRetain[h] = tree.getRetain(); nextTreehash[h] = tree.getTreehash(); System.arraycopy(tree.getRoot(), 0, nextRoots[h], 0, mdLength);
/** * @return a human readable version of the structure */ public String toString() { String out = ""; int tailLength; if (tailStack == null) { tailLength = 0; } else { tailLength = tailStack.size(); } for (int i = 0; i < 8 + heightOfTree + tailLength; i++) { out = out + getStatInt()[i] + " "; } for (int i = 0; i < 1 + heightOfTree + tailLength; i++) { out = out + new String(Hex.encode(getStatByte()[i])) + " "; } out = out + " " + digestProvider.get().getDigestSize(); return out; } }
GMSSRootCalc treeToConstruct = new GMSSRootCalc(this.heightOfTrees[h], this.K[h], digestProvider); treeToConstruct.initialize(currentStack); treeToConstruct.update(help); treeToConstruct.initializeTreehashSeed(seed, count); seedForTreehashIndex *= 2; count++; treeToConstruct.update(ots.getPublicKey()); if (treeToConstruct.wasFinished())
.getTreehash()[i]; System.arraycopy(nextNextRoot[layer - 1].getAuthPath()[i], 0, nextAuthPaths[layer - 1][i], 0, mdLength); .getRetain()[i]; .getStack(); .getRoot();
GMSSRootCalc treeToConstruct = new GMSSRootCalc(this.heightOfTrees[h], this.K[h], digestProvider); treeToConstruct.initialize(currentStack); treeToConstruct.update(help); treeToConstruct.initializeTreehashSeed(seed, count); seedForTreehashIndex *= 2; count++; treeToConstruct.update(ots.getPublicKey()); if (treeToConstruct.wasFinished())
.getTreehash()[i]; System.arraycopy(nextNextRoot[layer - 1].getAuthPath()[i], 0, nextAuthPaths[layer - 1][i], 0, mdLength); .getRetain()[i]; .getStack(); .getRoot();