]>
Commit | Line | Data |
---|---|---|
ee11118d | 1 | /* |
da1c088f | 2 | * Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved. |
ee11118d HZZ |
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 | /*- | |
11 | * RISC-V 64 ZKND ZKNE support for AES CCM. | |
12 | * This file is included by cipher_aes_ccm_hw.c | |
13 | */ | |
14 | ||
15 | static int ccm_rv64i_zknd_zkne_initkey(PROV_CCM_CTX *ctx, const unsigned char *key, | |
16 | size_t keylen) | |
17 | { | |
18 | PROV_AES_CCM_CTX *actx = (PROV_AES_CCM_CTX *)ctx; | |
19 | ||
20 | AES_HW_CCM_SET_KEY_FN(rv64i_zkne_set_encrypt_key, rv64i_zkne_encrypt, | |
21 | NULL, NULL); | |
22 | return 1; | |
23 | } | |
24 | ||
25 | static const PROV_CCM_HW rv64i_zknd_zkne_ccm = { | |
26 | ccm_rv64i_zknd_zkne_initkey, | |
27 | ossl_ccm_generic_setiv, | |
28 | ossl_ccm_generic_setaad, | |
29 | ossl_ccm_generic_auth_encrypt, | |
30 | ossl_ccm_generic_auth_decrypt, | |
31 | ossl_ccm_generic_gettag | |
32 | }; | |
33 | ||
34 | const PROV_CCM_HW *ossl_prov_aes_hw_ccm(size_t keybits) | |
35 | { | |
86c69fe8 | 36 | return RISCV_HAS_ZKND_AND_ZKNE() ? &rv64i_zknd_zkne_ccm : &aes_ccm; |
ee11118d | 37 | } |