]> git.ipfire.org Git - thirdparty/openssl.git/blame - providers/implementations/ciphers/cipher_camellia.c
Update copyright year
[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"
e1178600 20
e1178600
SL
21static OSSL_OP_cipher_freectx_fn camellia_freectx;
22static OSSL_OP_cipher_dupctx_fn camellia_dupctx;
23
24static void camellia_freectx(void *vctx)
25{
26 PROV_CAMELLIA_CTX *ctx = (PROV_CAMELLIA_CTX *)vctx;
27
28 OPENSSL_clear_free(ctx, sizeof(*ctx));
29}
30
31static void *camellia_dupctx(void *ctx)
32{
33 PROV_CAMELLIA_CTX *in = (PROV_CAMELLIA_CTX *)ctx;
34 PROV_CAMELLIA_CTX *ret = OPENSSL_malloc(sizeof(*ret));
35
36 if (ret == NULL) {
37 ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
38 return NULL;
39 }
f75abcc0 40 in->base.hw->copyctx(&ret->base, &in->base);
e1178600
SL
41
42 return ret;
43}
44
45/* camellia256ecb_functions */
46IMPLEMENT_generic_cipher(camellia, CAMELLIA, ecb, ECB, 0, 256, 128, 0, block)
47/* camellia192ecb_functions */
48IMPLEMENT_generic_cipher(camellia, CAMELLIA, ecb, ECB, 0, 192, 128, 0, block)
49/* camellia128ecb_functions */
50IMPLEMENT_generic_cipher(camellia, CAMELLIA, ecb, ECB, 0, 128, 128, 0, block)
51/* camellia256cbc_functions */
52IMPLEMENT_generic_cipher(camellia, CAMELLIA, cbc, CBC, 0, 256, 128, 128, block)
53/* camellia192cbc_functions */
54IMPLEMENT_generic_cipher(camellia, CAMELLIA, cbc, CBC, 0, 192, 128, 128, block)
55/* camellia128cbc_functions */
56IMPLEMENT_generic_cipher(camellia, CAMELLIA, cbc, CBC, 0, 128, 128, 128, block)
57/* camellia256ofb_functions */
58IMPLEMENT_generic_cipher(camellia, CAMELLIA, ofb, OFB, 0, 256, 8, 128, stream)
59/* camellia192ofb_functions */
60IMPLEMENT_generic_cipher(camellia, CAMELLIA, ofb, OFB, 0, 192, 8, 128, stream)
61/* camellia128ofb_functions */
62IMPLEMENT_generic_cipher(camellia, CAMELLIA, ofb, OFB, 0, 128, 8, 128, stream)
63/* camellia256cfb_functions */
64IMPLEMENT_generic_cipher(camellia, CAMELLIA, cfb, CFB, 0, 256, 8, 128, stream)
65/* camellia192cfb_functions */
66IMPLEMENT_generic_cipher(camellia, CAMELLIA, cfb, CFB, 0, 192, 8, 128, stream)
67/* camellia128cfb_functions */
68IMPLEMENT_generic_cipher(camellia, CAMELLIA, cfb, CFB, 0, 128, 8, 128, stream)
69/* camellia256cfb1_functions */
70IMPLEMENT_generic_cipher(camellia, CAMELLIA, cfb1, CFB, 0, 256, 8, 128, stream)
71/* camellia192cfb1_functions */
72IMPLEMENT_generic_cipher(camellia, CAMELLIA, cfb1, CFB, 0, 192, 8, 128, stream)
73/* camellia128cfb1_functions */
74IMPLEMENT_generic_cipher(camellia, CAMELLIA, cfb1, CFB, 0, 128, 8, 128, stream)
75/* camellia256cfb8_functions */
76IMPLEMENT_generic_cipher(camellia, CAMELLIA, cfb8, CFB, 0, 256, 8, 128, stream)
77/* camellia192cfb8_functions */
78IMPLEMENT_generic_cipher(camellia, CAMELLIA, cfb8, CFB, 0, 192, 8, 128, stream)
79/* camellia128cfb8_functions */
80IMPLEMENT_generic_cipher(camellia, CAMELLIA, cfb8, CFB, 0, 128, 8, 128, stream)
81/* camellia256ctr_functions */
82IMPLEMENT_generic_cipher(camellia, CAMELLIA, ctr, CTR, 0, 256, 8, 128, stream)
83/* camellia192ctr_functions */
84IMPLEMENT_generic_cipher(camellia, CAMELLIA, ctr, CTR, 0, 192, 8, 128, stream)
85/* camellia128ctr_functions */
86IMPLEMENT_generic_cipher(camellia, CAMELLIA, ctr, CTR, 0, 128, 8, 128, stream)
87