[openssl/openssl] b3504b: Add AES implementation in generic riscv64 asm

pauli noreply at reply.github.openssl.org
Thu May 19 06:33:26 UTC 2022


  Branch: refs/heads/master
  Home:   https://github.openssl.org/openssl/openssl
  Commit: b3504b600c028a00f36cdbfedc928a48df9818ff
      https://github.openssl.org/openssl/openssl/commit/b3504b600c028a00f36cdbfedc928a48df9818ff
  Author: Henry Brausen <henry.brausen at vrull.eu>
  Date:   2022-05-19 (Thu, 19 May 2022)

  Changed paths:
    A crypto/aes/asm/aes-riscv64.pl
    M crypto/aes/build.info

  Log Message:
  -----------
  Add AES implementation in generic riscv64 asm

This implementation is based on the four-table approach, along the same
lines as the non-constant-time implementation in aes_core.c The
implementation is in perlasm.

Utility functions are defined to automatically stack/unstack registers
as needed for prologues and epilogues. See riscv-elf-psabi-doc at
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/ for ABI details.

Reviewed-by: Philipp Tomsich <philipp.tomsich at vrull.eu>
Signed-off-by: Henry Brausen <henry.brausen at vrull.eu>

Reviewed-by: Tomas Mraz <tomas at openssl.org>
Reviewed-by: Paul Dale <pauli at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17640)


  Commit: 360f6dcc5aa1a86ec3ff9a94612b88e3d960ee2e
      https://github.openssl.org/openssl/openssl/commit/360f6dcc5aa1a86ec3ff9a94612b88e3d960ee2e
  Author: Henry Brausen <henry.brausen at vrull.eu>
  Date:   2022-05-19 (Thu, 19 May 2022)

  Changed paths:
    M crypto/build.info
    A crypto/riscv64cpuid.pl
    A crypto/riscvcap.c
    M doc/man7/openssl-env.pod
    A include/crypto/riscv_arch.def
    A include/crypto/riscv_arch.h

  Log Message:
  -----------
  Add basic RISC-V cpuid and OPENSSL_riscvcap

RISC-V cpuid implementation allows bitmanip extensions Zb[abcs] to
be enabled at runtime using OPENSSL_riscvcap environment variable.

For example, to specify 64-bit RISC-V with the G,C,Zba,Zbb,Zbc
extensions, one could write: OPENSSL_riscvcap="rv64gc_zba_zbb_zbc"

Architecture string parsing is still very primitive, but can be
expanded in the future. Currently, only bitmanip extensions Zba, Zbb,
Zbc and Zbs are supported.

Includes implementation of constant-time CRYPTO_memcmp in riscv64 asm,
as well as OPENSSL_cleanse. Assembly implementations are written using
perlasm.

Reviewed-by: Philipp Tomsich <philipp.tomsich at vrull.eu>
Signed-off-by: Henry Brausen <henry.brausen at vrull.eu>

Reviewed-by: Tomas Mraz <tomas at openssl.org>
Reviewed-by: Paul Dale <pauli at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17640)


  Commit: 999376dcf33986c468361ede16fa9de409dc4e2e
      https://github.openssl.org/openssl/openssl/commit/999376dcf33986c468361ede16fa9de409dc4e2e
  Author: Henry Brausen <henry.brausen at vrull.eu>
  Date:   2022-05-19 (Thu, 19 May 2022)

  Changed paths:
    A crypto/modes/asm/ghash-riscv64.pl
    M crypto/modes/build.info
    M crypto/modes/gcm128.c

  Log Message:
  -----------
  Add clmul-based gmult for riscv64 with Zbb, Zbc

ghash-riscv64.pl implements 128-bit galois field multiplication for
use in the GCM mode using RISC-V carryless multiplication primitives.

The clmul-accelerated routine can be selected by setting the Zbb and
Zbc bits of the OPENSSL_riscvcap environment variable at runtime.

Reviewed-by: Philipp Tomsich <philipp.tomsich at vrull.eu>
Signed-off-by: Henry Brausen <henry.brausen at vrull.eu>

Reviewed-by: Tomas Mraz <tomas at openssl.org>
Reviewed-by: Paul Dale <pauli at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17640)


  Commit: e4fd3fc379d76d9cd33ea6699268485606447737
      https://github.openssl.org/openssl/openssl/commit/e4fd3fc379d76d9cd33ea6699268485606447737
  Author: Henry Brausen <henry.brausen at vrull.eu>
  Date:   2022-05-19 (Thu, 19 May 2022)

  Changed paths:
    M include/crypto/modes.h

  Log Message:
  -----------
  Add BSWAP4/BSWAP8 routines for riscv64 with Zbb

These routines make use of the rev8 instruction in the Zbb extension
to accelerate byte-swapping when OpenSSL is built specifically for
a machine that supports Zbb.

Reviewed-by: Philipp Tomsich <philipp.tomsich at vrull.eu>
Signed-off-by: Henry Brausen <henry.brausen at vrull.eu>

Reviewed-by: Tomas Mraz <tomas at openssl.org>
Reviewed-by: Paul Dale <pauli at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17640)


Compare: https://github.openssl.org/openssl/openssl/compare/ec26144288fd...e4fd3fc379d7


More information about the openssl-commits mailing list