2019-09-18 13:57:08 +08:00
|
|
|
/*
|
2020-04-23 20:55:52 +08:00
|
|
|
* Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
|
2019-09-18 13:57:08 +08:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
|
|
|
*/
|
|
|
|
|
2020-01-13 11:02:45 +08:00
|
|
|
/*
|
|
|
|
* IDEA low level APIs are deprecated for public use, but still ok for internal
|
|
|
|
* use where we're using them to implement the higher level EVP interface, as is
|
|
|
|
* the case here.
|
|
|
|
*/
|
|
|
|
#include "internal/deprecated.h"
|
|
|
|
|
2019-09-18 13:57:08 +08:00
|
|
|
/* Dispatch functions for Idea cipher modes ecb, cbc, ofb, cfb */
|
|
|
|
|
|
|
|
#include "cipher_idea.h"
|
2019-10-04 21:20:48 +08:00
|
|
|
#include "prov/implementations.h"
|
2020-09-08 10:56:34 +08:00
|
|
|
#include "prov/providercommon.h"
|
2019-09-18 13:57:08 +08:00
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
static OSSL_FUNC_cipher_freectx_fn idea_freectx;
|
|
|
|
static OSSL_FUNC_cipher_dupctx_fn idea_dupctx;
|
2019-09-18 13:57:08 +08:00
|
|
|
|
|
|
|
static void idea_freectx(void *vctx)
|
|
|
|
{
|
|
|
|
PROV_IDEA_CTX *ctx = (PROV_IDEA_CTX *)vctx;
|
|
|
|
|
2020-09-29 15:40:26 +08:00
|
|
|
ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx);
|
2019-09-18 13:57:08 +08:00
|
|
|
OPENSSL_clear_free(ctx, sizeof(*ctx));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *idea_dupctx(void *ctx)
|
|
|
|
{
|
|
|
|
PROV_IDEA_CTX *in = (PROV_IDEA_CTX *)ctx;
|
2020-09-08 10:56:34 +08:00
|
|
|
PROV_IDEA_CTX *ret;
|
2019-09-18 13:57:08 +08:00
|
|
|
|
2020-09-08 10:56:34 +08:00
|
|
|
if (!ossl_prov_is_running())
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
ret = OPENSSL_malloc(sizeof(*ret));
|
2022-09-29 19:57:34 +08:00
|
|
|
if (ret == NULL)
|
2019-09-18 13:57:08 +08:00
|
|
|
return NULL;
|
|
|
|
*ret = *in;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2020-09-28 10:28:29 +08:00
|
|
|
/* ossl_idea128ecb_functions */
|
2019-09-18 13:57:08 +08:00
|
|
|
IMPLEMENT_generic_cipher(idea, IDEA, ecb, ECB, 0, 128, 64, 0, block)
|
2020-09-28 10:28:29 +08:00
|
|
|
/* ossl_idea128cbc_functions */
|
2019-09-18 13:57:08 +08:00
|
|
|
IMPLEMENT_generic_cipher(idea, IDEA, cbc, CBC, 0, 128, 64, 64, block)
|
2020-09-28 10:28:29 +08:00
|
|
|
/* ossl_idea128ofb64_functions */
|
2019-09-18 13:57:08 +08:00
|
|
|
IMPLEMENT_generic_cipher(idea, IDEA, ofb64, OFB, 0, 128, 8, 64, stream)
|
2020-09-28 10:28:29 +08:00
|
|
|
/* ossl_idea128cfb64_functions */
|
2019-09-18 13:57:08 +08:00
|
|
|
IMPLEMENT_generic_cipher(idea, IDEA, cfb64, CFB, 0, 128, 8, 64, stream)
|