Rate This Document
Findability
Accuracy
Completeness
Readability

SHA256 Optimization

Principles

Crypto instructions are added to the Armv8 instruction set, including hardware acceleration instructions related to the AES encryption/decryption algorithms, SHA1, and SHA256. This greatly improves the computing performance. Instructions for SHA256 optimization lists the instructions used for SHA256 optimization.

Table 1 Instructions for SHA256 optimization

Instruction

Function

Example

SHA256H

SHA256 hash update (part 1)

SHA256H q0, q1, v2.4s

SHA256H2

SHA256 hash update (part 2)

SHA256H2 q0, q1, v2.4s

SHA256SU0

SHA256 schedule update 0

SHA256SU0 v0.4s, v1.4s

SHA256SU1

SHA256 schedule update 1

SHA256SU1 v0.4s, v1.4s, v2.4s

Modification Method

Replace the original implementation with the sha256_aarch64.S file, and add the Kunpeng function sha256_compress to the call position in the sha256.c file.

For details, see the Huawei Kunpeng forum at:

https://bbs.huaweicloud.com/forum/thread-138517-1-1.html