openssl/crypto/evp/evp_utils.c
Shane Lontis 459b15d451 Add Common shared code needed to move aes ciphers to providers
Custom aes ciphers will be placed into multiple new files
(instead of the monolithic setup used in the e_aes.c legacy code)
so it makes sense to have a header for the platform specific
code that needs to be shared between files.
modes_lcl.h has also moved to modes_int.h to allow sharing with the
provider source.
Code that will be common to AEAD ciphers has also been added. These
will be used by seperate PR's for GCM, CCM & OCB.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9301)
2019-07-16 09:46:14 +10:00

48 lines
1.4 KiB
C

/*
* Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
*
* 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
*/
/* Internal EVP utility functions */
#include <openssl/core.h>
#include <openssl/evp.h>
#include <openssl/err.h>
#include <openssl/asn1.h> /* evp_locl.h needs it */
#include <openssl/safestack.h> /* evp_locl.h needs it */
#include "internal/evp_int.h" /* evp_locl.h needs it */
#include "evp_locl.h"
int evp_do_ciph_getparams(const EVP_CIPHER *ciph, OSSL_PARAM params[])
{
if (ciph->prov == NULL)
return -2;
if (ciph->get_params == NULL)
return -1;
return ciph->get_params(params);
}
int evp_do_ciph_ctx_getparams(const EVP_CIPHER *ciph, void *provctx,
OSSL_PARAM params[])
{
if (ciph->prov == NULL)
return -2;
if (ciph->ctx_get_params == NULL)
return -1;
return ciph->ctx_get_params(provctx, params);
}
int evp_do_ciph_ctx_setparams(const EVP_CIPHER *ciph, void *provctx,
OSSL_PARAM params[])
{
if (ciph->prov == NULL)
return -2;
if (ciph->ctx_set_params == NULL)
return -1;
return ciph->ctx_set_params(provctx, params);
}