EVP_R_CIPHER_PARAMETER_ERROR:122:cipher parameter error
EVP_R_COMMAND_NOT_SUPPORTED:147:command not supported
EVP_R_CONFLICTING_ALGORITHM_NAME:201:conflicting algorithm name
+EVP_R_CONTEXT_FINALIZED:239:context finalized
EVP_R_COPY_ERROR:173:copy error
EVP_R_CTRL_NOT_IMPLEMENTED:132:ctrl not implemented
EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED:133:ctrl operation not implemented
return ctx->digest->dsqueeze(ctx->algctx, md, &size, size);
}
+int EVP_MD_CTX_serialize(EVP_MD_CTX *ctx, unsigned char *out, size_t *outlen)
+{
+ if (ctx->digest == NULL) {
+ ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_NULL_ALGORITHM);
+ return 0;
+ }
+
+ if (ctx->digest->prov == NULL) {
+ ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_OPERATION);
+ return 0;
+ }
+
+ if (ctx->digest->serialize == NULL) {
+ ERR_raise(ERR_LIB_EVP, EVP_R_METHOD_NOT_SUPPORTED);
+ return 0;
+ }
+
+ if (ossl_unlikely((ctx->flags & EVP_MD_CTX_FLAG_FINALISED) != 0)) {
+ ERR_raise(ERR_LIB_EVP, EVP_R_CONTEXT_FINALIZED);
+ return 0;
+ }
+
+ return ctx->digest->serialize(ctx->algctx, out, outlen);
+}
+
+int EVP_MD_CTX_deserialize(EVP_MD_CTX *ctx, const unsigned char *in,
+ size_t inlen)
+{
+ if (ctx->digest == NULL) {
+ ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_NULL_ALGORITHM);
+ return 0;
+ }
+
+ if (ctx->digest->prov == NULL) {
+ ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_OPERATION);
+ return 0;
+ }
+
+ if (ctx->digest->deserialize == NULL) {
+ ERR_raise(ERR_LIB_EVP, EVP_R_METHOD_NOT_SUPPORTED);
+ return 0;
+ }
+
+ if (ossl_unlikely((ctx->flags & EVP_MD_CTX_FLAG_FINALISED) != 0)) {
+ ERR_raise(ERR_LIB_EVP, EVP_R_CONTEXT_FINALIZED);
+ return 0;
+ }
+
+ return ctx->digest->deserialize(ctx->algctx, in, inlen);
+}
+
EVP_MD_CTX *EVP_MD_CTX_dup(const EVP_MD_CTX *in)
{
EVP_MD_CTX *out = EVP_MD_CTX_new();
if (md->copyctx == NULL)
md->copyctx = OSSL_FUNC_digest_copyctx(fns);
break;
+ case OSSL_FUNC_DIGEST_SERIALIZE:
+ if (md->serialize == NULL)
+ md->serialize = OSSL_FUNC_digest_serialize(fns);
+ break;
+ case OSSL_FUNC_DIGEST_DESERIALIZE:
+ if (md->deserialize == NULL)
+ md->deserialize = OSSL_FUNC_digest_deserialize(fns);
+ break;
}
}
if ((fncnt != 0 && fncnt != 5 && fncnt != 6)
"command not supported" },
{ ERR_PACK(ERR_LIB_EVP, 0, EVP_R_CONFLICTING_ALGORITHM_NAME),
"conflicting algorithm name" },
+ { ERR_PACK(ERR_LIB_EVP, 0, EVP_R_CONTEXT_FINALIZED), "context finalized" },
{ ERR_PACK(ERR_LIB_EVP, 0, EVP_R_COPY_ERROR), "copy error" },
{ ERR_PACK(ERR_LIB_EVP, 0, EVP_R_CTRL_NOT_IMPLEMENTED),
"ctrl not implemented" },
OSSL_FUNC_digest_gettable_params_fn *gettable_params;
OSSL_FUNC_digest_settable_ctx_params_fn *settable_ctx_params;
OSSL_FUNC_digest_gettable_ctx_params_fn *gettable_ctx_params;
+ OSSL_FUNC_digest_serialize_fn *serialize;
+ OSSL_FUNC_digest_deserialize_fn *deserialize;
} /* EVP_MD */;
/*
* Generated by util/mkerr.pl DO NOT EDIT
- * Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2025 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
#define OSSL_FUNC_DIGEST_GETTABLE_CTX_PARAMS 13
#define OSSL_FUNC_DIGEST_SQUEEZE 14
#define OSSL_FUNC_DIGEST_COPYCTX 15
+#define OSSL_FUNC_DIGEST_SERIALIZE 16
+#define OSSL_FUNC_DIGEST_DESERIALIZE 17
OSSL_CORE_MAKE_FUNC(void *, digest_newctx, (void *provctx))
OSSL_CORE_MAKE_FUNC(int, digest_init, (void *dctx, const OSSL_PARAM params[]))
(void *dctx, void *provctx))
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, digest_gettable_ctx_params,
(void *dctx, void *provctx))
+OSSL_CORE_MAKE_FUNC(int, digest_serialize,
+ (void *dctx, unsigned char *out, size_t *outl))
+OSSL_CORE_MAKE_FUNC(int, digest_deserialize,
+ (void *dctx, const unsigned char *in, size_t inl))
/* Symmetric Ciphers */
size_t outlen);
__owur int EVP_DigestSqueeze(EVP_MD_CTX *ctx, unsigned char *out,
size_t outlen);
+__owur int EVP_MD_CTX_serialize(EVP_MD_CTX *ctx, unsigned char *out,
+ size_t *outlen);
+__owur int EVP_MD_CTX_deserialize(EVP_MD_CTX *ctx, const unsigned char *in,
+ size_t inlen);
__owur EVP_MD *EVP_MD_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
const char *properties);
#define EVP_R_CIPHER_PARAMETER_ERROR 122
#define EVP_R_COMMAND_NOT_SUPPORTED 147
#define EVP_R_CONFLICTING_ALGORITHM_NAME 201
+#define EVP_R_CONTEXT_FINALIZED 239
#define EVP_R_COPY_ERROR 173
#define EVP_R_CTRL_NOT_IMPLEMENTED 132
#define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133
CMS_dataFinal_ex ? 4_0_0 EXIST::FUNCTION:CMS
CMS_SignerInfo_verify_ex ? 4_0_0 EXIST::FUNCTION:CMS
EVP_SIGNATURE_has_message_update ? 4_0_0 EXIST::FUNCTION:
+EVP_MD_CTX_serialize ? 4_0_0 EXIST::FUNCTION:
+EVP_MD_CTX_deserialize ? 4_0_0 EXIST::FUNCTION: