1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3 * Copyright 2012, 2014 SAP AG. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
2006 __ li (hex, 16);
2007 __ li (fifteen, 15);
2008 __ vspltisb (fSplt, 0x0f);
2009
2010 // load unaligned from[0-15] to vsRet
2011 __ lvx (vRet, from);
2012 __ lvx (vTmp1, fifteen, from);
2013 __ lvsl (fromPerm, from);
2014 __ vxor (fromPerm, fromPerm, fSplt);
2015 __ vperm (vRet, vRet, vTmp1, fromPerm);
2016
2017 // load keylen (44 or 52 or 60)
2018 __ lwz (keylen, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT), key);
2019
2020 // to load keys
2021 __ lvsr (keyPerm, key);
2022 __ vxor (vTmp2, vTmp2, vTmp2);
2023 __ vspltisb (vTmp2, -16);
2024 __ vrld (keyPerm, keyPerm, vTmp2);
2025 __ vrld (keyPerm, keyPerm, vTmp2);
2026 __ vsldoi (keyPerm, keyPerm, keyPerm, -8);
2027
2028 // load the 1st round key to vKey1
2029 __ li (keypos, 0);
2030 __ lvx (vKey1, keypos, key);
2031 __ addi (keypos, keypos, 16);
2032 __ lvx (vTmp1, keypos, key);
2033 __ vperm (vKey1, vTmp1, vKey1, keyPerm);
2034
2035 // 1st round
2036 __ vxor (vRet, vRet, vKey1);
2037
2038 // load the 2nd round key to vKey1
2039 __ addi (keypos, keypos, 16);
2040 __ lvx (vTmp2, keypos, key);
2041 __ vperm (vKey1, vTmp2, vTmp1, keyPerm);
2042
2043 // load the 3rd round key to vKey2
2044 __ addi (keypos, keypos, 16);
2045 __ lvx (vTmp1, keypos, key);
2046 __ vperm (vKey2, vTmp1, vTmp2, keyPerm);
2206 __ li (hex, 16);
2207 __ li (fifteen, 15);
2208 __ vspltisb (fSplt, 0x0f);
2209
2210 // load unaligned from[0-15] to vsRet
2211 __ lvx (vRet, from);
2212 __ lvx (vTmp1, fifteen, from);
2213 __ lvsl (fromPerm, from);
2214 __ vxor (fromPerm, fromPerm, fSplt);
2215 __ vperm (vRet, vRet, vTmp1, fromPerm); // align [and byte swap in LE]
2216
2217 // load keylen (44 or 52 or 60)
2218 __ lwz (keylen, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT), key);
2219
2220 // to load keys
2221 __ lvsr (keyPerm, key);
2222 __ vxor (vTmp2, vTmp2, vTmp2);
2223 __ vspltisb (vTmp2, -16);
2224 __ vrld (keyPerm, keyPerm, vTmp2);
2225 __ vrld (keyPerm, keyPerm, vTmp2);
2226 __ vsldoi (keyPerm, keyPerm, keyPerm, -8);
2227
2228 __ cmpwi (CCR0, keylen, 44);
2229 __ beq (CCR0, L_do44);
2230
2231 __ cmpwi (CCR0, keylen, 52);
2232 __ beq (CCR0, L_do52);
2233
2234 // load the 15th round key to vKey11
2235 __ li (keypos, 240);
2236 __ lvx (vTmp1, keypos, key);
2237 __ addi (keypos, keypos, -16);
2238 __ lvx (vTmp2, keypos, key);
2239 __ vperm (vKey1, vTmp1, vTmp2, keyPerm);
2240
2241 // load the 14th round key to vKey10
2242 __ addi (keypos, keypos, -16);
2243 __ lvx (vTmp1, keypos, key);
2244 __ vperm (vKey2, vTmp2, vTmp1, keyPerm);
2245
2246 // load the 13th round key to vKey10
|
1 /*
2 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012, 2018, SAP SE. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
2006 __ li (hex, 16);
2007 __ li (fifteen, 15);
2008 __ vspltisb (fSplt, 0x0f);
2009
2010 // load unaligned from[0-15] to vsRet
2011 __ lvx (vRet, from);
2012 __ lvx (vTmp1, fifteen, from);
2013 __ lvsl (fromPerm, from);
2014 __ vxor (fromPerm, fromPerm, fSplt);
2015 __ vperm (vRet, vRet, vTmp1, fromPerm);
2016
2017 // load keylen (44 or 52 or 60)
2018 __ lwz (keylen, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT), key);
2019
2020 // to load keys
2021 __ lvsr (keyPerm, key);
2022 __ vxor (vTmp2, vTmp2, vTmp2);
2023 __ vspltisb (vTmp2, -16);
2024 __ vrld (keyPerm, keyPerm, vTmp2);
2025 __ vrld (keyPerm, keyPerm, vTmp2);
2026 __ vsldoi (keyPerm, keyPerm, keyPerm, 8);
2027
2028 // load the 1st round key to vKey1
2029 __ li (keypos, 0);
2030 __ lvx (vKey1, keypos, key);
2031 __ addi (keypos, keypos, 16);
2032 __ lvx (vTmp1, keypos, key);
2033 __ vperm (vKey1, vTmp1, vKey1, keyPerm);
2034
2035 // 1st round
2036 __ vxor (vRet, vRet, vKey1);
2037
2038 // load the 2nd round key to vKey1
2039 __ addi (keypos, keypos, 16);
2040 __ lvx (vTmp2, keypos, key);
2041 __ vperm (vKey1, vTmp2, vTmp1, keyPerm);
2042
2043 // load the 3rd round key to vKey2
2044 __ addi (keypos, keypos, 16);
2045 __ lvx (vTmp1, keypos, key);
2046 __ vperm (vKey2, vTmp1, vTmp2, keyPerm);
2206 __ li (hex, 16);
2207 __ li (fifteen, 15);
2208 __ vspltisb (fSplt, 0x0f);
2209
2210 // load unaligned from[0-15] to vsRet
2211 __ lvx (vRet, from);
2212 __ lvx (vTmp1, fifteen, from);
2213 __ lvsl (fromPerm, from);
2214 __ vxor (fromPerm, fromPerm, fSplt);
2215 __ vperm (vRet, vRet, vTmp1, fromPerm); // align [and byte swap in LE]
2216
2217 // load keylen (44 or 52 or 60)
2218 __ lwz (keylen, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT), key);
2219
2220 // to load keys
2221 __ lvsr (keyPerm, key);
2222 __ vxor (vTmp2, vTmp2, vTmp2);
2223 __ vspltisb (vTmp2, -16);
2224 __ vrld (keyPerm, keyPerm, vTmp2);
2225 __ vrld (keyPerm, keyPerm, vTmp2);
2226 __ vsldoi (keyPerm, keyPerm, keyPerm, 8);
2227
2228 __ cmpwi (CCR0, keylen, 44);
2229 __ beq (CCR0, L_do44);
2230
2231 __ cmpwi (CCR0, keylen, 52);
2232 __ beq (CCR0, L_do52);
2233
2234 // load the 15th round key to vKey11
2235 __ li (keypos, 240);
2236 __ lvx (vTmp1, keypos, key);
2237 __ addi (keypos, keypos, -16);
2238 __ lvx (vTmp2, keypos, key);
2239 __ vperm (vKey1, vTmp1, vTmp2, keyPerm);
2240
2241 // load the 14th round key to vKey10
2242 __ addi (keypos, keypos, -16);
2243 __ lvx (vTmp1, keypos, key);
2244 __ vperm (vKey2, vTmp2, vTmp1, keyPerm);
2245
2246 // load the 13th round key to vKey10
|