sm3_riscv.c 963 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. #include <stdlib.h>
  10. #include <string.h>
  11. #include <openssl/opensslconf.h>
  12. #include "internal/sm3.h"
  13. #include "crypto/riscv_arch.h"
  14. #include <stdio.h>
  15. void ossl_hwsm3_block_data_order_zvksh(SM3_CTX *c, const void *p, size_t num);
  16. void ossl_sm3_block_data_order(SM3_CTX *c, const void *p, size_t num);
  17. void ossl_hwsm3_block_data_order(SM3_CTX *c, const void *p, size_t num);
  18. void ossl_hwsm3_block_data_order(SM3_CTX *c, const void *p, size_t num)
  19. {
  20. if (RISCV_HAS_ZVKB_AND_ZVKSH() && riscv_vlen() >= 128) {
  21. ossl_hwsm3_block_data_order_zvksh(c, p, num);
  22. } else {
  23. ossl_sm3_block_data_order(c, p, num);
  24. }
  25. }