Skip to content

Commit ffd0073

Browse files
committed
Refactoring in xmss_sign
1 parent b8091c2 commit ffd0073

File tree

2 files changed

+6
-6
lines changed
  • core/src/main/java/org/bouncycastle/pqc/crypto

2 files changed

+6
-6
lines changed

core/src/main/java/org/bouncycastle/pqc/crypto/slhdsa/HT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ SIG_XMSS xmss_sign(byte[] M, byte[] skSeed, int idx, byte[] pkSeed, ADRS paramAd
132132
// build authentication path
133133
for (int j = 0; j < engine.H_PRIME; j++)
134134
{
135-
int k = (idx / (1 << j)) ^ 1;
136-
AUTH[j] = treehash(skSeed, k * (1 << j), j, pkSeed, adrs);
135+
int k = (idx >>> j) ^ 1;
136+
AUTH[j] = treehash(skSeed, k << j, j, pkSeed, adrs);
137137
}
138138
adrs = new ADRS(paramAdrs);
139-
adrs.setType(ADRS.WOTS_PK);
139+
adrs.setType(ADRS.WOTS_HASH);
140140
adrs.setKeyPairAddress(idx);
141141

142142
byte[] sig = wots.sign(M, skSeed, pkSeed, adrs);

core/src/main/java/org/bouncycastle/pqc/crypto/sphincsplus/HT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ SIG_XMSS xmss_sign(byte[] M, byte[] skSeed, int idx, byte[] pkSeed, ADRS paramAd
132132
// build authentication path
133133
for (int j = 0; j < engine.H_PRIME; j++)
134134
{
135-
int k = (idx / (1 << j)) ^ 1;
136-
AUTH[j] = treehash(skSeed, k * (1 << j), j, pkSeed, adrs);
135+
int k = (idx >>> j) ^ 1;
136+
AUTH[j] = treehash(skSeed, k << j, j, pkSeed, adrs);
137137
}
138138
adrs = new ADRS(paramAdrs);
139-
adrs.setType(ADRS.WOTS_PK);
139+
adrs.setType(ADRS.WOTS_HASH);
140140
adrs.setKeyPairAddress(idx);
141141

142142
byte[] sig = wots.sign(M, skSeed, pkSeed, adrs);

0 commit comments

Comments
 (0)