diff options
author | Richard Levitte <levitte@openssl.org> | 2019-12-03 19:41:05 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-12-11 12:55:48 +0100 |
commit | 68a51d59a29796803af3b6e7f0142feca2622c9e (patch) | |
tree | 1c67dea0b89826473f0cfe64ea548019ffec35c0 /providers/implementations/digests/digestcommon.c | |
parent | 436c21a0fd317cb929fb00eefb1ac84e90676097 (diff) |
Move providers/common/{ciphers,digests}/* to providers/implementations
The idea to have all these things in providers/common was viable as
long as the implementations was spread around their main providers.
This is, however, no longer the case, so we move the common blocks
closer to the source that use them.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10564)
Diffstat (limited to 'providers/implementations/digests/digestcommon.c')
-rw-r--r-- | providers/implementations/digests/digestcommon.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/providers/implementations/digests/digestcommon.c b/providers/implementations/digests/digestcommon.c new file mode 100644 index 0000000000..9d30b2be2c --- /dev/null +++ b/providers/implementations/digests/digestcommon.c @@ -0,0 +1,46 @@ +/* + * 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 + */ + +#include "openssl/err.h" +#include "prov/digestcommon.h" +#include "prov/providercommonerr.h" + +int digest_default_get_params(OSSL_PARAM params[], size_t blksz, size_t paramsz, + unsigned long flags) +{ + OSSL_PARAM *p = NULL; + + p = OSSL_PARAM_locate(params, OSSL_DIGEST_PARAM_BLOCK_SIZE); + if (p != NULL && !OSSL_PARAM_set_size_t(p, blksz)) { + ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER); + return 0; + } + p = OSSL_PARAM_locate(params, OSSL_DIGEST_PARAM_SIZE); + if (p != NULL && !OSSL_PARAM_set_size_t(p, paramsz)) { + ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER); + return 0; + } + p = OSSL_PARAM_locate(params, OSSL_DIGEST_PARAM_FLAGS); + if (p != NULL && !OSSL_PARAM_set_ulong(p, flags)) { + ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER); + return 0; + } + return 1; +} + +static const OSSL_PARAM digest_default_known_gettable_params[] = { + OSSL_PARAM_size_t(OSSL_DIGEST_PARAM_BLOCK_SIZE, NULL), + OSSL_PARAM_size_t(OSSL_DIGEST_PARAM_SIZE, NULL), + OSSL_PARAM_ulong(OSSL_DIGEST_PARAM_FLAGS, NULL), + OSSL_PARAM_END +}; +const OSSL_PARAM *digest_default_gettable_params(void) +{ + return digest_default_known_gettable_params; +} |