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