Lines Matching +full:rs +full:-

1 // SPDX-License-Identifier: GPL-2.0-or-later
65 static const u8 rs[256] = { variable
360 /* S-box lookup tables */
598 * the 4 interleaved tables correspond to four 7-bit subsets of C_i or D_i.
601 * or D_i in bits 7-1 (bit 0 being the least significant).
619 * alternating zero-one patterns in the C and D registers after Permuted
634 pe[15 * 2 + 0] = DES_PC2(a, b, c, d); d = rs[d]; in des_ekey()
635 pe[14 * 2 + 0] = DES_PC2(d, a, b, c); c = rs[c]; b = rs[b]; in des_ekey()
636 pe[13 * 2 + 0] = DES_PC2(b, c, d, a); a = rs[a]; d = rs[d]; in des_ekey()
637 pe[12 * 2 + 0] = DES_PC2(d, a, b, c); c = rs[c]; b = rs[b]; in des_ekey()
638 pe[11 * 2 + 0] = DES_PC2(b, c, d, a); a = rs[a]; d = rs[d]; in des_ekey()
639 pe[10 * 2 + 0] = DES_PC2(d, a, b, c); c = rs[c]; b = rs[b]; in des_ekey()
640 pe[ 9 * 2 + 0] = DES_PC2(b, c, d, a); a = rs[a]; d = rs[d]; in des_ekey()
641 pe[ 8 * 2 + 0] = DES_PC2(d, a, b, c); c = rs[c]; in des_ekey()
642 pe[ 7 * 2 + 0] = DES_PC2(c, d, a, b); b = rs[b]; a = rs[a]; in des_ekey()
643 pe[ 6 * 2 + 0] = DES_PC2(a, b, c, d); d = rs[d]; c = rs[c]; in des_ekey()
644 pe[ 5 * 2 + 0] = DES_PC2(c, d, a, b); b = rs[b]; a = rs[a]; in des_ekey()
645 pe[ 4 * 2 + 0] = DES_PC2(a, b, c, d); d = rs[d]; c = rs[c]; in des_ekey()
646 pe[ 3 * 2 + 0] = DES_PC2(c, d, a, b); b = rs[b]; a = rs[a]; in des_ekey()
647 pe[ 2 * 2 + 0] = DES_PC2(a, b, c, d); d = rs[d]; c = rs[c]; in des_ekey()
648 pe[ 1 * 2 + 0] = DES_PC2(c, d, a, b); b = rs[b]; in des_ekey()
652 w = (a ^ c) | (b ^ d) | (rs[a] ^ c) | (b ^ rs[d]); in des_ekey()
663 w |= (a ^ c) | (b ^ d) | (rs[a] ^ c) | (b ^ rs[d]); in des_ekey()
665 pe[15 * 2 + 1] = DES_PC2(a, b, c, d); d = rs[d]; in des_ekey()
666 pe[14 * 2 + 1] = DES_PC2(d, a, b, c); c = rs[c]; b = rs[b]; in des_ekey()
667 pe[13 * 2 + 1] = DES_PC2(b, c, d, a); a = rs[a]; d = rs[d]; in des_ekey()
668 pe[12 * 2 + 1] = DES_PC2(d, a, b, c); c = rs[c]; b = rs[b]; in des_ekey()
669 pe[11 * 2 + 1] = DES_PC2(b, c, d, a); a = rs[a]; d = rs[d]; in des_ekey()
670 pe[10 * 2 + 1] = DES_PC2(d, a, b, c); c = rs[c]; b = rs[b]; in des_ekey()
671 pe[ 9 * 2 + 1] = DES_PC2(b, c, d, a); a = rs[a]; d = rs[d]; in des_ekey()
672 pe[ 8 * 2 + 1] = DES_PC2(d, a, b, c); c = rs[c]; in des_ekey()
673 pe[ 7 * 2 + 1] = DES_PC2(c, d, a, b); b = rs[b]; a = rs[a]; in des_ekey()
674 pe[ 6 * 2 + 1] = DES_PC2(a, b, c, d); d = rs[d]; c = rs[c]; in des_ekey()
675 pe[ 5 * 2 + 1] = DES_PC2(c, d, a, b); b = rs[b]; a = rs[a]; in des_ekey()
676 pe[ 4 * 2 + 1] = DES_PC2(a, b, c, d); d = rs[d]; c = rs[c]; in des_ekey()
677 pe[ 3 * 2 + 1] = DES_PC2(c, d, a, b); b = rs[b]; a = rs[a]; in des_ekey()
678 pe[ 2 * 2 + 1] = DES_PC2(a, b, c, d); d = rs[d]; c = rs[c]; in des_ekey()
679 pe[ 1 * 2 + 1] = DES_PC2(c, d, a, b); b = rs[b]; in des_ekey()
682 /* Fixup: 2413 5768 -> 1357 2468 */ in des_ekey()
702 return -EINVAL; in des_expand_key()
704 return des_ekey(ctx->expkey, key) ? 0 : -ENOKEY; in des_expand_key()
725 pe[ 0 * 2] = DES_PC2(a, b, c, d); d = rs[d]; in dkey()
726 pe[ 1 * 2] = DES_PC2(d, a, b, c); c = rs[c]; b = rs[b]; in dkey()
727 pe[ 2 * 2] = DES_PC2(b, c, d, a); a = rs[a]; d = rs[d]; in dkey()
728 pe[ 3 * 2] = DES_PC2(d, a, b, c); c = rs[c]; b = rs[b]; in dkey()
729 pe[ 4 * 2] = DES_PC2(b, c, d, a); a = rs[a]; d = rs[d]; in dkey()
730 pe[ 5 * 2] = DES_PC2(d, a, b, c); c = rs[c]; b = rs[b]; in dkey()
731 pe[ 6 * 2] = DES_PC2(b, c, d, a); a = rs[a]; d = rs[d]; in dkey()
732 pe[ 7 * 2] = DES_PC2(d, a, b, c); c = rs[c]; in dkey()
733 pe[ 8 * 2] = DES_PC2(c, d, a, b); b = rs[b]; a = rs[a]; in dkey()
734 pe[ 9 * 2] = DES_PC2(a, b, c, d); d = rs[d]; c = rs[c]; in dkey()
735 pe[10 * 2] = DES_PC2(c, d, a, b); b = rs[b]; a = rs[a]; in dkey()
736 pe[11 * 2] = DES_PC2(a, b, c, d); d = rs[d]; c = rs[c]; in dkey()
737 pe[12 * 2] = DES_PC2(c, d, a, b); b = rs[b]; a = rs[a]; in dkey()
738 pe[13 * 2] = DES_PC2(a, b, c, d); d = rs[d]; c = rs[c]; in dkey()
739 pe[14 * 2] = DES_PC2(c, d, a, b); b = rs[b]; in dkey()
750 pe[ 0 * 2 + 1] = DES_PC2(a, b, c, d); d = rs[d]; in dkey()
751 pe[ 1 * 2 + 1] = DES_PC2(d, a, b, c); c = rs[c]; b = rs[b]; in dkey()
752 pe[ 2 * 2 + 1] = DES_PC2(b, c, d, a); a = rs[a]; d = rs[d]; in dkey()
753 pe[ 3 * 2 + 1] = DES_PC2(d, a, b, c); c = rs[c]; b = rs[b]; in dkey()
754 pe[ 4 * 2 + 1] = DES_PC2(b, c, d, a); a = rs[a]; d = rs[d]; in dkey()
755 pe[ 5 * 2 + 1] = DES_PC2(d, a, b, c); c = rs[c]; b = rs[b]; in dkey()
756 pe[ 6 * 2 + 1] = DES_PC2(b, c, d, a); a = rs[a]; d = rs[d]; in dkey()
757 pe[ 7 * 2 + 1] = DES_PC2(d, a, b, c); c = rs[c]; in dkey()
758 pe[ 8 * 2 + 1] = DES_PC2(c, d, a, b); b = rs[b]; a = rs[a]; in dkey()
759 pe[ 9 * 2 + 1] = DES_PC2(a, b, c, d); d = rs[d]; c = rs[c]; in dkey()
760 pe[10 * 2 + 1] = DES_PC2(c, d, a, b); b = rs[b]; a = rs[a]; in dkey()
761 pe[11 * 2 + 1] = DES_PC2(a, b, c, d); d = rs[d]; c = rs[c]; in dkey()
762 pe[12 * 2 + 1] = DES_PC2(c, d, a, b); b = rs[b]; a = rs[a]; in dkey()
763 pe[13 * 2 + 1] = DES_PC2(a, b, c, d); d = rs[d]; c = rs[c]; in dkey()
764 pe[14 * 2 + 1] = DES_PC2(c, d, a, b); b = rs[b]; in dkey()
767 /* Fixup: 2413 5768 -> 1357 2468 */ in dkey()
783 const u32 *K = ctx->expkey; in des_encrypt()
804 const u32 *K = ctx->expkey + DES_EXPKEY_WORDS - 2; in des_decrypt()
813 ROUND(L, R, A, B, K, -2); in des_decrypt()
814 ROUND(R, L, A, B, K, -2); in des_decrypt()
826 u32 *pe = ctx->expkey; in des3_ede_expand_key()
830 return -EINVAL; in des3_ede_expand_key()
833 if (err && err != -ENOKEY) in des3_ede_expand_key()
846 const u32 *K = dctx->expkey; in des3_ede_encrypt()
875 const u32 *K = dctx->expkey + DES3_EDE_EXPKEY_WORDS - 2; in des3_ede_decrypt()
884 ROUND(L, R, A, B, K, -2); in des3_ede_decrypt()
885 ROUND(R, L, A, B, K, -2); in des3_ede_decrypt()
888 ROUND(R, L, A, B, K, -2); in des3_ede_decrypt()
889 ROUND(L, R, A, B, K, -2); in des3_ede_decrypt()
892 ROUND(L, R, A, B, K, -2); in des3_ede_decrypt()
893 ROUND(R, L, A, B, K, -2); in des3_ede_decrypt()