Debian Codegraph @

debian/rust-vendor/openssl-src/openssl/crypto/sm3/sm3_riscv.c

raw
1 /*
2 * Copyright 2023-2025 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
10 #include <stdlib.h>
11 #include <string.h>
12
13 #include <openssl/opensslconf.h>
14 #include "internal/sm3.h"
15 #include "crypto/riscv_arch.h"
16 #include <stdio.h>
17
18 void ossl_hwsm3_block_data_order_zvksh(SM3_CTX *c, const void *p, size_t num);
19 void ossl_sm3_block_data_order(SM3_CTX *c, const void *p, size_t num);
20 void ossl_sm3_block_data_order_zbb(SM3_CTX *c, const void *p, size_t num);
21 void ossl_hwsm3_block_data_order(SM3_CTX *c, const void *p, size_t num);
22
23 void ossl_hwsm3_block_data_order(SM3_CTX *c, const void *p, size_t num)
24 {
25 if (RISCV_HAS_ZVKB_AND_ZVKSH() && riscv_vlen() >= 128) {
26 ossl_hwsm3_block_data_order_zvksh(c, p, num);
27 } else if (RISCV_HAS_ZBB()) {
28 ossl_sm3_block_data_order_zbb(c, p, num);
29 } else {
30 ossl_sm3_block_data_order(c, p, num);
31 }
32 }