File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
core/src/main/java/org/bouncycastle/pqc/crypto/mlkem Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -237,13 +237,14 @@ public byte[] toBytes()
237237 return r ;
238238 }
239239
240- public void fromBytes (byte [] inpBytes )
240+ public void fromBytes (byte [] inpBytes , int inOff )
241241 {
242242 for (int i = 0 ; i < MLKEMEngine .KyberN / 2 ; ++i )
243243 {
244- int a0 = inpBytes [3 * i + 0 ] & 0xFF ;
245- int a1 = inpBytes [3 * i + 1 ] & 0xFF ;
246- int a2 = inpBytes [3 * i + 2 ] & 0xFF ;
244+ int index = inOff + (3 * i );
245+ int a0 = inpBytes [index + 0 ] & 0xFF ;
246+ int a1 = inpBytes [index + 1 ] & 0xFF ;
247+ int a2 = inpBytes [index + 2 ] & 0xFF ;
247248 coeffs [2 * i + 0 ] = (short )(((a0 >> 0 ) | (a1 << 8 )) & 0xFFF );
248249 coeffs [2 * i + 1 ] = (short )(((a1 >> 4 ) | (a2 << 4 )) & 0xFFF );
249250 }
Original file line number Diff line number Diff line change 11package org .bouncycastle .pqc .crypto .mlkem ;
22
3- import org .bouncycastle .util .Arrays ;
4-
53class PolyVec
64{
75 Poly [] vec ;
@@ -242,7 +240,7 @@ public void fromBytes(byte[] inputBytes)
242240 {
243241 for (int i = 0 ; i < kyberK ; i ++)
244242 {
245- this .getVectorIndex (i ).fromBytes (Arrays . copyOfRange ( inputBytes , i * MLKEMEngine .KyberPolyBytes , ( i + 1 ) * MLKEMEngine . KyberPolyBytes ) );
243+ this .getVectorIndex (i ).fromBytes (inputBytes , i * MLKEMEngine .KyberPolyBytes );
246244 }
247245 }
248246
You can’t perform that action at this time.
0 commit comments