2019-08-20 09:07:12 +10:00
|
|
|
/*
|
2021-02-18 14:57:13 +00:00
|
|
|
* Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
|
2019-08-20 09:07:12 +10: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
|
|
|
|
*/
|
|
|
|
|
2021-02-05 17:40:42 +01:00
|
|
|
#include <openssl/err.h>
|
|
|
|
#include <openssl/proverr.h>
|
2019-10-04 12:30:33 +02:00
|
|
|
#include "prov/digestcommon.h"
|
2019-08-20 09:07:12 +10:00
|
|
|
|
Fix external symbols in the provider digest implementations.
Partial fix for #12964
This adds ossl_ names for the following symbols:
blake2b512_init,blake2b_final,blake2b_init,blake2b_init_key,
blake2b_param_init,blake2b_param_set_digest_length,blake2b_param_set_key_length,
blake2b_param_set_personal,blake2b_param_set_salt,blake2b_update,
blake2s256_init,blake2s_final,blake2s_init,blake2s_init_key,
blake2s_param_init,blake2s_param_set_digest_length,blake2s_param_set_key_length,
blake2s_param_set_personal,blake2s_param_set_salt,blake2s_update,
digest_default_get_params,digest_default_gettable_params
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14211)
2021-02-17 19:56:35 +10:00
|
|
|
int ossl_digest_default_get_params(OSSL_PARAM params[], size_t blksz,
|
|
|
|
size_t paramsz, unsigned long flags)
|
2019-08-20 09:07:12 +10:00
|
|
|
{
|
|
|
|
OSSL_PARAM *p = NULL;
|
|
|
|
|
|
|
|
p = OSSL_PARAM_locate(params, OSSL_DIGEST_PARAM_BLOCK_SIZE);
|
2019-09-05 11:23:57 +10:00
|
|
|
if (p != NULL && !OSSL_PARAM_set_size_t(p, blksz)) {
|
2019-08-20 09:07:12 +10:00
|
|
|
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
p = OSSL_PARAM_locate(params, OSSL_DIGEST_PARAM_SIZE);
|
2019-09-05 11:23:57 +10:00
|
|
|
if (p != NULL && !OSSL_PARAM_set_size_t(p, paramsz)) {
|
2019-08-20 09:07:12 +10:00
|
|
|
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
|
|
|
|
return 0;
|
|
|
|
}
|
2020-12-17 16:42:05 +10:00
|
|
|
p = OSSL_PARAM_locate(params, OSSL_DIGEST_PARAM_XOF);
|
|
|
|
if (p != NULL
|
|
|
|
&& !OSSL_PARAM_set_int(p, (flags & PROV_DIGEST_FLAG_XOF) != 0)) {
|
|
|
|
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
p = OSSL_PARAM_locate(params, OSSL_DIGEST_PARAM_ALGID_ABSENT);
|
|
|
|
if (p != NULL
|
|
|
|
&& !OSSL_PARAM_set_int(p, (flags & PROV_DIGEST_FLAG_ALGID_ABSENT) != 0)) {
|
2019-08-20 09:07:12 +10:00
|
|
|
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const OSSL_PARAM digest_default_known_gettable_params[] = {
|
2019-09-05 11:23:57 +10:00
|
|
|
OSSL_PARAM_size_t(OSSL_DIGEST_PARAM_BLOCK_SIZE, NULL),
|
|
|
|
OSSL_PARAM_size_t(OSSL_DIGEST_PARAM_SIZE, NULL),
|
2020-12-17 16:42:05 +10:00
|
|
|
OSSL_PARAM_int(OSSL_DIGEST_PARAM_XOF, NULL),
|
|
|
|
OSSL_PARAM_int(OSSL_DIGEST_PARAM_ALGID_ABSENT, NULL),
|
2019-08-20 09:07:12 +10:00
|
|
|
OSSL_PARAM_END
|
|
|
|
};
|
Fix external symbols in the provider digest implementations.
Partial fix for #12964
This adds ossl_ names for the following symbols:
blake2b512_init,blake2b_final,blake2b_init,blake2b_init_key,
blake2b_param_init,blake2b_param_set_digest_length,blake2b_param_set_key_length,
blake2b_param_set_personal,blake2b_param_set_salt,blake2b_update,
blake2s256_init,blake2s_final,blake2s_init,blake2s_init_key,
blake2s_param_init,blake2s_param_set_digest_length,blake2s_param_set_key_length,
blake2s_param_set_personal,blake2s_param_set_salt,blake2s_update,
digest_default_get_params,digest_default_gettable_params
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14211)
2021-02-17 19:56:35 +10:00
|
|
|
const OSSL_PARAM *ossl_digest_default_gettable_params(void *provctx)
|
2019-08-20 09:07:12 +10:00
|
|
|
{
|
|
|
|
return digest_default_known_gettable_params;
|
|
|
|
}
|