Cycically extract a word of key material @param data the string to extract the data from @param offp a "pointer" (as a one-entry array) to the current offset into data @param signp a "pointer" (as a one-entry array) to the cumulative flag for non-benign sign extension @return correct and buggy next
(byte data[], int offp[], int signp[])
| 517 | * @return correct and buggy next word of material from data as int[2] |
| 518 | */ |
| 519 | private static int[] streamtowords(byte data[], int offp[], int signp[]) { |
| 520 | int i; |
| 521 | int words[] = { 0, 0 }; |
| 522 | int off = offp[0]; |
| 523 | int sign = signp[0]; |
| 524 | |
| 525 | for (i = 0; i < 4; i++) { |
| 526 | words[0] = (words[0] << 8) | (data[off] & 0xff); |
| 527 | words[1] = (words[1] << 8) | (int) data[off]; // sign extension bug |
| 528 | if (i > 0) sign |= words[1] & 0x80; |
| 529 | off = (off + 1) % data.length; |
| 530 | } |
| 531 | |
| 532 | offp[0] = off; |
| 533 | signp[0] = sign; |
| 534 | return words; |
| 535 | } |
| 536 | |
| 537 | /** |
| 538 | * Cycically extract a word of key material |
no outgoing calls
no test coverage detected