]> git.ipfire.org Git - thirdparty/openssl.git/blame - providers/implementations/ciphers/cipher_camellia.c
prov: prefix all exposed 'cipher' symbols with ossl_
[thirdparty/openssl.git] / providers / implementations / ciphers / cipher_camellia.c
CommitLineData
e1178600 1/*
33388b44 2 * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
e1178600
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
291850b4
MC
10/*
11 * Camellia low level APIs are deprecated for public use, but still ok for
12 * internal use.
13 */
14#include "internal/deprecated.h"
15
e1178600
SL
16/* Dispatch functions for CAMELLIA cipher modes ecb, cbc, ofb, cfb, ctr */
17
4a42e264 18#include "cipher_camellia.h"
af3e7e1b 19#include "prov/implementations.h"
f99d3eed 20#include "prov/providercommon.h"
e1178600 21
363b1e5d
DMSP
22static OSSL_FUNC_cipher_freectx_fn camellia_freectx;
23static OSSL_FUNC_cipher_dupctx_fn camellia_dupctx;
e1178600
SL
24
25static void camellia_freectx(void *vctx)
26{
27 PROV_CAMELLIA_CTX *ctx = (PROV_CAMELLIA_CTX *)vctx;
28
592dcfd3 29 ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx);
e1178600
SL
30 OPENSSL_clear_free(ctx, sizeof(*ctx));
31}
32
33static void *camellia_dupctx(void *ctx)
34{
35 PROV_CAMELLIA_CTX *in = (PROV_CAMELLIA_CTX *)ctx;
f99d3eed 36 PROV_CAMELLIA_CTX *ret;
e1178600 37
f99d3eed
P
38 if (!ossl_prov_is_running())
39 return NULL;
40
41 ret = OPENSSL_malloc(sizeof(*ret));
e1178600
SL
42 if (ret == NULL) {
43 ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
44 return NULL;
45 }
f75abcc0 46 in->base.hw->copyctx(&ret->base, &in->base);
e1178600
SL
47
48 return ret;
49}
50
1be63951 51/* ossl_camellia256ecb_functions */
e1178600 52IMPLEMENT_generic_cipher(camellia, CAMELLIA, ecb, ECB, 0, 256, 128, 0, block)
1be63951 53/* ossl_camellia192ecb_functions */
e1178600 54IMPLEMENT_generic_cipher(camellia, CAMELLIA, ecb, ECB, 0, 192, 128, 0, block)
1be63951 55/* ossl_camellia128ecb_functions */
e1178600 56IMPLEMENT_generic_cipher(camellia, CAMELLIA, ecb, ECB, 0, 128, 128, 0, block)
1be63951 57/* ossl_camellia256cbc_functions */
e1178600 58IMPLEMENT_generic_cipher(camellia, CAMELLIA, cbc, CBC, 0, 256, 128, 128, block)
1be63951 59/* ossl_camellia192cbc_functions */
e1178600 60IMPLEMENT_generic_cipher(camellia, CAMELLIA, cbc, CBC, 0, 192, 128, 128, block)
1be63951 61/* ossl_camellia128cbc_functions */
e1178600 62IMPLEMENT_generic_cipher(camellia, CAMELLIA, cbc, CBC, 0, 128, 128, 128, block)
1be63951 63/* ossl_camellia256ofb_functions */
e1178600 64IMPLEMENT_generic_cipher(camellia, CAMELLIA, ofb, OFB, 0, 256, 8, 128, stream)
1be63951 65/* ossl_camellia192ofb_functions */
e1178600 66IMPLEMENT_generic_cipher(camellia, CAMELLIA, ofb, OFB, 0, 192, 8, 128, stream)
1be63951 67/* ossl_camellia128ofb_functions */
e1178600 68IMPLEMENT_generic_cipher(camellia, CAMELLIA, ofb, OFB, 0, 128, 8, 128, stream)
1be63951 69/* ossl_camellia256cfb_functions */
e1178600 70IMPLEMENT_generic_cipher(camellia, CAMELLIA, cfb, CFB, 0, 256, 8, 128, stream)
1be63951 71/* ossl_camellia192cfb_functions */
e1178600 72IMPLEMENT_generic_cipher(camellia, CAMELLIA, cfb, CFB, 0, 192, 8, 128, stream)
1be63951 73/* ossl_camellia128cfb_functions */
e1178600 74IMPLEMENT_generic_cipher(camellia, CAMELLIA, cfb, CFB, 0, 128, 8, 128, stream)
1be63951 75/* ossl_camellia256cfb1_functions */
e1178600 76IMPLEMENT_generic_cipher(camellia, CAMELLIA, cfb1, CFB, 0, 256, 8, 128, stream)
1be63951 77/* ossl_camellia192cfb1_functions */
e1178600 78IMPLEMENT_generic_cipher(camellia, CAMELLIA, cfb1, CFB, 0, 192, 8, 128, stream)
1be63951 79/* ossl_camellia128cfb1_functions */
e1178600 80IMPLEMENT_generic_cipher(camellia, CAMELLIA, cfb1, CFB, 0, 128, 8, 128, stream)
1be63951 81/* ossl_camellia256cfb8_functions */
e1178600 82IMPLEMENT_generic_cipher(camellia, CAMELLIA, cfb8, CFB, 0, 256, 8, 128, stream)
1be63951 83/* ossl_camellia192cfb8_functions */
e1178600 84IMPLEMENT_generic_cipher(camellia, CAMELLIA, cfb8, CFB, 0, 192, 8, 128, stream)
1be63951 85/* ossl_camellia128cfb8_functions */
e1178600 86IMPLEMENT_generic_cipher(camellia, CAMELLIA, cfb8, CFB, 0, 128, 8, 128, stream)
1be63951 87/* ossl_camellia256ctr_functions */
e1178600 88IMPLEMENT_generic_cipher(camellia, CAMELLIA, ctr, CTR, 0, 256, 8, 128, stream)
1be63951 89/* ossl_camellia192ctr_functions */
e1178600 90IMPLEMENT_generic_cipher(camellia, CAMELLIA, ctr, CTR, 0, 192, 8, 128, stream)
1be63951 91/* ossl_camellia128ctr_functions */
e1178600
SL
92IMPLEMENT_generic_cipher(camellia, CAMELLIA, ctr, CTR, 0, 128, 8, 128, stream)
93