]>
Commit | Line | Data |
---|---|---|
6a41156c | 1 | /* |
33388b44 | 2 | * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved. |
6a41156c SL |
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 | ||
62c3fed0 P |
10 | /* |
11 | * RC5 low level APIs are deprecated for public use, but still ok for internal | |
12 | * use. | |
13 | */ | |
14 | #include "internal/deprecated.h" | |
15 | ||
6a41156c SL |
16 | #include "cipher_rc5.h" |
17 | ||
18 | static int cipher_hw_rc5_initkey(PROV_CIPHER_CTX *ctx, | |
19 | const unsigned char *key, size_t keylen) | |
20 | { | |
21 | PROV_RC5_CTX *rctx = (PROV_RC5_CTX *)ctx; | |
22 | ||
23 | return RC5_32_set_key(&rctx->ks.ks, keylen, key, rctx->rounds); | |
24 | } | |
25 | ||
26 | # define PROV_CIPHER_HW_rc5_mode(mode, UCMODE) \ | |
27 | IMPLEMENT_CIPHER_HW_##UCMODE(mode, rc5, PROV_RC5_CTX, RC5_32_KEY, \ | |
28 | RC5_32_##mode) \ | |
29 | static const PROV_CIPHER_HW rc5_##mode = { \ | |
30 | cipher_hw_rc5_initkey, \ | |
31 | cipher_hw_rc5_##mode##_cipher \ | |
32 | }; \ | |
33 | const PROV_CIPHER_HW *PROV_CIPHER_HW_rc5_##mode(size_t keybits) \ | |
34 | { \ | |
35 | return &rc5_##mode; \ | |
36 | } | |
37 | ||
38 | PROV_CIPHER_HW_rc5_mode(cbc, CBC) | |
39 | PROV_CIPHER_HW_rc5_mode(ecb, ECB) | |
40 | PROV_CIPHER_HW_rc5_mode(ofb64, OFB) | |
41 | PROV_CIPHER_HW_rc5_mode(cfb64, CFB) |