Share via


_mm_aesdeclast_si128

Microsoft Specific

Emits the Advanced Encryption Standard (AES) instruction aesdeclast. This instruction performs the final round of AES decryption.

__m128i _mm_aesdeclast_si128 (
   __m128i v,
   __m128i rkey
);

Parameters

Parameter

Description

[in] v

The state parameter that contains the data for the instruction to decrypt.

[in] rkey

The round key that this instruction uses to decrypt the data from v.

Return value

The decrypted data for v.

Requirements

Intrinsic

Architecture

_mm_aesdeclast_si128

x86, x64

Header file <wmmintrin.h>

Remarks

This instruction decrypts data by using an Equivalent Inverse Cipher with a 128 bit key. AES decryption requires 10 iterations of decryption and uses a cipher key that consists of 128 bits. The final iteration must be performed by this instruction. The previous nine iterations use _mm_aesdec_si128.

To perform the last round of encryption and be compliant with the AES, use _mm_aesenclast_si128.

Example

#include <wmmintrin.h>
#include <stdio.h>

int main()
{
    __m128i a;
    __m128i res;
    __m128i key;

    a.m128i_u64[1] = 0x8899AABBCCDDEEFF;
    a.m128i_u64[0] = 0x0123456789ABCDEF;
    key.m128i_u64[1] = 0x0022446688AACCEE;
    key.m128i_u64[0] = 0x1133557799BBDDFF;

    res = _mm_aesdeclast_si128( a, key );

    printf_s("Original data: 0x%016I64x%016I64x\n",
        a.m128i_u64[1], a.m128i_u64[0]);
    printf_s("Decoded data: 0x%016I64x%016I64x\n",
        res.m128i_u64[1], res.m128i_u64[0]);

    return 0;
}
Original data: 0x8899aabbccddeeff0123456789abcdef
Decoded data: 0xf210dd981fa4a49336cad57d9072bf9e

See Also

Reference

Compiler Intrinsics

_mm_aesdec_si128

_mm_aesenclast_si128

AES Intrinsics