prepare temporary keys K1 and K2 */
| 583 | |
| 584 | /* prepare temporary keys K1 and K2 */ |
| 585 | static void prepare_key(unsigned char *k, unsigned char *l, int bl) |
| 586 | { |
| 587 | int i; |
| 588 | /* Shift block to left, including carry */ |
| 589 | for (i = 0; i < bl; i++) { |
| 590 | k[i] = l[i] << 1; |
| 591 | if (i < bl - 1 && l[i + 1] & 0x80) |
| 592 | k[i] |= 1; |
| 593 | } |
| 594 | /* If MSB set fixup with R */ |
| 595 | if (l[0] & 0x80) |
| 596 | k[bl - 1] ^= bl == 16 ? 0x87 : 0x1b; |
| 597 | } |
| 598 | |
| 599 | /* subkeys K1 and K2 generation for CMAC */ |
| 600 | static int |
no outgoing calls
no test coverage detected