_mm_loadiwkey in core::arch::x86 - Rust
Description: Load internal wrapping key (IWKey). The 32-bit unsigned integer `control` specifies IWKey’s KeySource and whether backing up the key is permitted. IWKey’s 256-bit encryption key is loaded from `key_lo` and `key_hi`.

## _mm_loadiwkey

# Function _mm_loadiwkey

1.89.0 · Source

    pub unsafe fn _mm_loadiwkey(
        control: u32,
        integrity_key: __m128i,
        key_lo: __m128i,
        key_hi: __m128i,
    )

Available on x86 and target feature `kl` only.
Expand description

Load internal wrapping key (IWKey). The 32-bit unsigned integer `control` specifies IWKey’s KeySource and whether backing up the key is permitted. IWKey’s 256-bit encryption key is loaded from `key_lo` and `key_hi`.

- `control[0]`: NoBackup bit. If set, the IWKey cannot be backed up.
- `control[1:4]`: KeySource bits. These bits specify the encoding method of the IWKey. The only allowed values are `0` (AES GCM SIV wrapping algorithm with the specified key) and `1` (AES GCM SIV wrapping algorithm with random keys enforced by hardware). After calling `_mm_loadiwkey` with KeySource set to `1`, software must check `ZF` to ensure that the key was loaded successfully. Using any other value may result in a General Protection Exception.
- `control[5:31]`: Reserved for future use, must be set to `0`.

Note that setting the NoBackup bit and using the KeySource value `1` requires hardware support. These permissions can be found by calling `__cpuid(0x19)` and checking the `ECX[0:1]` bits. Failing to follow these restrictions may result in a General Protection Exception.

Intel’s documentation