1 // SPDX-License-Identifier: CDDL-1.0 2 /* 3 * CDDL HEADER START 4 * 5 * The contents of this file are subject to the terms of the 6 * Common Development and Distribution License (the "License"). 7 * You may not use this file except in compliance with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or https://opensource.org/licenses/CDDL-1.0. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 24 */ 25 26 #if defined(__x86_64) 27 28 #include <sys/simd.h> 29 #include <aes/aes_impl.h> 30 31 /* 32 * Expand the 32-bit AES cipher key array into the encryption and decryption 33 * key schedules. 34 * 35 * Parameters: 36 * key AES key schedule to be initialized 37 * keyarr32 User key 38 * keyBits AES key size (128, 192, or 256 bits) 39 */ 40 static void 41 aes_x86_64_generate(aes_key_t *key, const uint32_t *keyarr32, int keybits) 42 { 43 key->nr = rijndael_key_setup_enc_amd64(&(key->encr_ks.ks32[0]), 44 keyarr32, keybits); 45 key->nr = rijndael_key_setup_dec_amd64(&(key->decr_ks.ks32[0]), 46 keyarr32, keybits); 47 } 48 49 static boolean_t 50 aes_x86_64_will_work(void) 51 { 52 return (B_TRUE); 53 } 54 55 const aes_impl_ops_t aes_x86_64_impl = { 56 .generate = &aes_x86_64_generate, 57 .encrypt = &aes_encrypt_amd64, 58 .decrypt = &aes_decrypt_amd64, 59 .is_supported = &aes_x86_64_will_work, 60 .needs_byteswap = B_FALSE, 61 .name = "x86_64" 62 }; 63 64 #endif /* defined(__x86_64) */ 65