#include "internal/sha.h"
static OSSL_OP_digest_ctx_set_params_fn sha1_set_params;
+static OSSL_OP_digest_settable_ctx_params_fn sha1_settable_params;
+
+static const OSSL_PARAM known_sha1_ctx_params[] = {
+ {OSSL_DIGEST_PARAM_SSL3_MS, OSSL_PARAM_OCTET_STRING, NULL, 0, 0},
+ OSSL_PARAM_END
+};
+
+static const OSSL_PARAM *sha1_settable_params(void)
+{
+ return known_sha1_ctx_params;
+}
/* Special set_params method for SSL3 */
static int sha1_set_params(void *vctx, const OSSL_PARAM params[])
SHA_CBLOCK, SHA_DIGEST_LENGTH,
EVP_MD_FLAG_DIGALGID_ABSENT,
SHA1_Init, SHA1_Update, SHA1_Final,
- sha1_set_params)
+ sha1_settable_params, sha1_set_params)
OSSL_FUNC_DIGEST_CONSTRUCT(sha224, SHA256_CTX,
SHA256_CBLOCK, SHA224_DIGEST_LENGTH,
static OSSL_OP_digest_final_fn keccak_final;
static OSSL_OP_digest_freectx_fn keccak_freectx;
static OSSL_OP_digest_dupctx_fn keccak_dupctx;
-static OSSL_OP_digest_ctx_set_params_fn shake_set_params;
+static OSSL_OP_digest_ctx_set_params_fn shake_ctx_set_params;
+static OSSL_OP_digest_settable_ctx_params_fn shake_settable_ctx_params;
static sha3_absorb_fn generic_sha3_absorb;
static sha3_final_fn generic_sha3_final;
}
#define OSSL_FUNC_SHA3_DIGEST(name, bitlen, blksize, dgstsize, flags, \
- stparams) \
+ stparamtypes, stparams) \
static OSSL_OP_digest_get_params_fn name##_get_params; \
+static OSSL_OP_digest_gettable_params_fn name##_gettable_params; \
+static const OSSL_PARAM known_##name##_gettable_params[] = { \
+ {OSSL_DIGEST_PARAM_BLOCK_SIZE, OSSL_PARAM_INTEGER, \
+ NULL, sizeof(int), 0}, \
+ {OSSL_DIGEST_PARAM_SIZE, OSSL_PARAM_INTEGER, NULL, sizeof(int), 0}, \
+ {OSSL_DIGEST_PARAM_FLAGS, OSSL_PARAM_INTEGER, \
+ NULL, sizeof(unsigned long), 0}, \
+ OSSL_PARAM_END \
+}; \
+static const OSSL_PARAM *name##_gettable_params(void) \
+{ \
+ return known_##name##_gettable_params; \
+} \
static int name##_get_params(OSSL_PARAM params[]) \
{ \
OSSL_PARAM *p = NULL; \
{ OSSL_FUNC_DIGEST_FREECTX, (void (*)(void))keccak_freectx }, \
{ OSSL_FUNC_DIGEST_DUPCTX, (void (*)(void))keccak_dupctx }, \
{ OSSL_FUNC_DIGEST_GET_PARAMS, (void (*)(void))name##_get_params }, \
+ { OSSL_FUNC_DIGEST_GETTABLE_PARAMS, \
+ (void (*)(void))name##_gettable_params }, \
{ OSSL_FUNC_DIGEST_CTX_SET_PARAMS, (void (*)(void))stparams }, \
+ { OSSL_FUNC_DIGEST_SETTABLE_CTX_PARAMS, \
+ (void (*)(void))stparamtypes }, \
OSSL_FUNC_DIGEST_CONSTRUCT_END
static void keccak_freectx(void *vctx)
return ret;
}
-static int shake_set_params(void *vctx, const OSSL_PARAM params[])
+static const OSSL_PARAM known_shake_settable_ctx_params[] = {
+ {OSSL_DIGEST_PARAM_SSL3_MS, OSSL_PARAM_OCTET_STRING, NULL, 0, 0},
+ OSSL_PARAM_END
+};
+
+static const OSSL_PARAM *shake_settable_ctx_params(void)
+{
+ return known_shake_settable_ctx_params;
+}
+
+static int shake_ctx_set_params(void *vctx, const OSSL_PARAM params[])
{
const OSSL_PARAM *p;
KECCAK1600_CTX *ctx = (KECCAK1600_CTX *)vctx;
SHA3_newctx(sha3, SHA3_##bitlen, sha3_##bitlen, bitlen, '\x06') \
OSSL_FUNC_SHA3_DIGEST(sha3_##bitlen, bitlen, \
SHA3_BLOCKSIZE(bitlen), SHA3_MDSIZE(bitlen), \
- EVP_MD_FLAG_DIGALGID_ABSENT, NULL)
+ EVP_MD_FLAG_DIGALGID_ABSENT, NULL, NULL)
#define SHAKE(bitlen) \
SHA3_newctx(shake, SHAKE_##bitlen, shake_##bitlen, bitlen, '\x1f') \
OSSL_FUNC_SHA3_DIGEST(shake_##bitlen, bitlen, \
SHA3_BLOCKSIZE(bitlen), SHA3_MDSIZE(bitlen), \
- EVP_MD_FLAG_XOF, shake_set_params)
+ EVP_MD_FLAG_XOF, \
+ shake_settable_ctx_params, shake_ctx_set_params)
#define KMAC(bitlen) \
KMAC_newctx(keccak_kmac_##bitlen, bitlen, '\x04') \
OSSL_FUNC_SHA3_DIGEST(keccak_kmac_##bitlen, bitlen, \
SHA3_BLOCKSIZE(bitlen), KMAC_MDSIZE(bitlen), \
- EVP_MD_FLAG_XOF, shake_set_params)
+ EVP_MD_FLAG_XOF, \
+ shake_settable_ctx_params, shake_ctx_set_params)
SHA3(224)
SHA3(256)
# define OSSL_FUNC_DIGEST_GET_PARAM(name, blksize, dgstsize, flags) \
static OSSL_OP_digest_get_params_fn name##_get_params; \
+static OSSL_OP_digest_gettable_params_fn name##_gettable_params; \
+static const OSSL_PARAM known_##name##_gettable_params[] = { \
+ {OSSL_DIGEST_PARAM_BLOCK_SIZE, OSSL_PARAM_INTEGER, \
+ NULL, sizeof(int), 0}, \
+ {OSSL_DIGEST_PARAM_SIZE, OSSL_PARAM_INTEGER, NULL, sizeof(int), 0}, \
+ {OSSL_DIGEST_PARAM_FLAGS, OSSL_PARAM_INTEGER, \
+ NULL, sizeof(unsigned long), 0}, \
+ OSSL_PARAM_END \
+}; \
+static const OSSL_PARAM *name##_gettable_params(void) \
+{ \
+ return known_##name##_gettable_params; \
+} \
static int name##_get_params(OSSL_PARAM params[]) \
{ \
OSSL_PARAM *p = NULL; \
{ OSSL_FUNC_DIGEST_FINAL, (void (*)(void))name##_wrapfinal }, \
{ OSSL_FUNC_DIGEST_FREECTX, (void (*)(void))name##_freectx }, \
{ OSSL_FUNC_DIGEST_DUPCTX, (void (*)(void))name##_dupctx }, \
- { OSSL_FUNC_DIGEST_GET_PARAMS, (void (*)(void))name##_get_params },
+ { OSSL_FUNC_DIGEST_GET_PARAMS, (void (*)(void))name##_get_params }, \
+ { OSSL_FUNC_DIGEST_GETTABLE_PARAMS, \
+ (void (*)(void))name##_gettable_params },
# define OSSL_FUNC_DIGEST_CONSTRUCT_END \
{ 0, NULL } \
# define OSSL_FUNC_DIGEST_CONSTRUCT_PARAMS(name, CTX, \
blksize, dgstsize, flags, \
- init, upd, fin, setparams) \
+ init, upd, fin, \
+ setparamtypes, setparams) \
OSSL_FUNC_DIGEST_CONSTRUCT_START(name, CTX, blksize, dgstsize, flags, \
init, upd, fin) \
+ { OSSL_FUNC_DIGEST_SETTABLE_CTX_PARAMS, \
+ (void (*)(void))setparamtypes }, \
{ OSSL_FUNC_DIGEST_CTX_SET_PARAMS, (void (*)(void))setparams }, \
OSSL_FUNC_DIGEST_CONSTRUCT_END
#include "internal/md5_sha1.h"
#include "internal/provider_algs.h"
-static OSSL_OP_digest_ctx_set_params_fn md5_sha1_set_params;
+static OSSL_OP_digest_ctx_set_params_fn md5_sha1_ctx_set_params;
+static OSSL_OP_digest_settable_ctx_params_fn md5_sha1_settable_ctx_params;
+
+static const OSSL_PARAM known_md5_sha1_settable_ctx_params[] = {
+ {OSSL_DIGEST_PARAM_SSL3_MS, OSSL_PARAM_OCTET_STRING, NULL, 0, 0},
+ OSSL_PARAM_END
+};
+
+static const OSSL_PARAM *md5_sha1_settable_ctx_params(void)
+{
+ return known_md5_sha1_settable_ctx_params;
+}
/* Special set_params method for SSL3 */
-static int md5_sha1_set_params(void *vctx, const OSSL_PARAM params[])
+static int md5_sha1_ctx_set_params(void *vctx, const OSSL_PARAM params[])
{
const OSSL_PARAM *p;
MD5_SHA1_CTX *ctx = (MD5_SHA1_CTX *)vctx;
OSSL_FUNC_DIGEST_CONSTRUCT_PARAMS(md5_sha1, MD5_SHA1_CTX,
MD5_SHA1_CBLOCK, MD5_SHA1_DIGEST_LENGTH, 0,
md5_sha1_init, md5_sha1_update, md5_sha1_final,
- md5_sha1_set_params)
+ md5_sha1_settable_ctx_params,
+ md5_sha1_ctx_set_params)
#include "internal/core_mkdigest.h"
#include "internal/provider_algs.h"
-static OSSL_OP_digest_ctx_set_params_fn mdc2_set_params;
+static OSSL_OP_digest_ctx_set_params_fn mdc2_ctx_set_params;
+static OSSL_OP_digest_settable_ctx_params_fn mdc2_settable_ctx_params;
-static int mdc2_set_params(void *vctx, const OSSL_PARAM params[])
+static const OSSL_PARAM known_mdc2_settable_ctx_params[] = {
+ {OSSL_DIGEST_PARAM_PAD_TYPE, OSSL_PARAM_INTEGER, NULL, sizeof(int), 0},
+ OSSL_PARAM_END
+};
+
+static const OSSL_PARAM *mdc2_settable_ctx_params(void)
+{
+ return known_mdc2_settable_ctx_params;
+}
+
+static int mdc2_ctx_set_params(void *vctx, const OSSL_PARAM params[])
{
const OSSL_PARAM *p;
MDC2_CTX *ctx = (MDC2_CTX *)vctx;
OSSL_FUNC_DIGEST_CONSTRUCT_PARAMS(mdc2, MDC2_CTX,
MDC2_BLOCK, MDC2_DIGEST_LENGTH, 0,
MDC2_Init, MDC2_Update, MDC2_Final,
- mdc2_set_params)
+ mdc2_settable_ctx_params, mdc2_ctx_set_params)