Skip to content

[API Proposal]: Arm64: FEAT_SM4 #98696

@a74nh

Description

@a74nh

FEAT_SM4 provides instruction to accelerate the SM4 encryption algorithm, the standard Chinese encryption
algorithm. This set of instructions is described as the SM4 instructions.

The SM4 algorithm is 128-bit wide block cipher. The SM4E instruction accelerates a single round of encryption or decryption, and the SM4EKEY instruction accelerates a single
round of key generation:

namespace System.Runtime.Intrinsics.Arm;

/// VectorT Summary
public abstract partial class Sm4 : AdvSimd /// Feature: FEAT_SM4
{

  public static unsafe Vector128<uint> Sm4Encode(Vector128<uint> a, Vector128<uint> b); // SM4E

  public static unsafe Vector128<uint> Sm4KeyUpdate(Vector128<uint> a, Vector128<uint> b); // SM4EKEY

  /// total method signatures: 2

}

SM4 Encode takes input data as a 128-bit vector from the first source SIMD&FP register, and four iterations of the round key held as the elements of the 128-bit vector in the second source SIMD&FP register. It encrypts the data by four rounds, in accordance with the SM4 standard, returning the 128-bit result to the destination SIMD&FP register.

SM4 Key takes an input as a 128-bit vector from the first source SIMD&FP register and a 128-bit constant from the second SIMD&FP register. It derives four iterations of the output key, in accordance with the SM4 standard, returning the 128-bit result to the destination SIMD&FP register.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions