1e1051a39Sopenharmony_ci/* 2e1051a39Sopenharmony_ci * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved. 3e1051a39Sopenharmony_ci * 4e1051a39Sopenharmony_ci * Licensed under the Apache License 2.0 (the "License"). You may not use 5e1051a39Sopenharmony_ci * this file except in compliance with the License. You can obtain a copy 6e1051a39Sopenharmony_ci * in the file LICENSE in the source distribution or at 7e1051a39Sopenharmony_ci * https://www.openssl.org/source/license.html 8e1051a39Sopenharmony_ci */ 9e1051a39Sopenharmony_ci 10e1051a39Sopenharmony_ci/* 11e1051a39Sopenharmony_ci * CAST low level APIs are deprecated for public use, but still ok for 12e1051a39Sopenharmony_ci * internal use. 13e1051a39Sopenharmony_ci */ 14e1051a39Sopenharmony_ci#include "internal/deprecated.h" 15e1051a39Sopenharmony_ci 16e1051a39Sopenharmony_ci#include "cipher_cast.h" 17e1051a39Sopenharmony_ci 18e1051a39Sopenharmony_cistatic int cipher_hw_cast5_initkey(PROV_CIPHER_CTX *ctx, 19e1051a39Sopenharmony_ci const unsigned char *key, size_t keylen) 20e1051a39Sopenharmony_ci{ 21e1051a39Sopenharmony_ci PROV_CAST_CTX *bctx = (PROV_CAST_CTX *)ctx; 22e1051a39Sopenharmony_ci 23e1051a39Sopenharmony_ci CAST_set_key(&(bctx->ks.ks), keylen, key); 24e1051a39Sopenharmony_ci return 1; 25e1051a39Sopenharmony_ci} 26e1051a39Sopenharmony_ci 27e1051a39Sopenharmony_ci# define PROV_CIPHER_HW_cast_mode(mode, UCMODE) \ 28e1051a39Sopenharmony_ciIMPLEMENT_CIPHER_HW_##UCMODE(mode, cast5, PROV_CAST_CTX, CAST_KEY, \ 29e1051a39Sopenharmony_ci CAST_##mode) \ 30e1051a39Sopenharmony_cistatic const PROV_CIPHER_HW cast5_##mode = { \ 31e1051a39Sopenharmony_ci cipher_hw_cast5_initkey, \ 32e1051a39Sopenharmony_ci cipher_hw_cast5_##mode##_cipher \ 33e1051a39Sopenharmony_ci}; \ 34e1051a39Sopenharmony_ciconst PROV_CIPHER_HW *ossl_prov_cipher_hw_cast5_##mode(size_t keybits) \ 35e1051a39Sopenharmony_ci{ \ 36e1051a39Sopenharmony_ci return &cast5_##mode; \ 37e1051a39Sopenharmony_ci} 38e1051a39Sopenharmony_ci 39e1051a39Sopenharmony_ciPROV_CIPHER_HW_cast_mode(cbc, CBC) 40e1051a39Sopenharmony_ciPROV_CIPHER_HW_cast_mode(ecb, ECB) 41e1051a39Sopenharmony_ciPROV_CIPHER_HW_cast_mode(ofb64, OFB) 42e1051a39Sopenharmony_ciPROV_CIPHER_HW_cast_mode(cfb64, CFB) 43