CMS_FINAL(3ossl)
π CMS_FINAL(3ossl) β like, the whole finalise-a-CMS_ContentInfo-structure situation π
okay bestie, so this is a page from the 3ossl manual set, and it's literally about wrapping up a CMS_ContentInfo structure so it's all done and pretty. stay with me, it's gonna slay.
β¨ SYNOPSIS β¨
#include <openssl/cms.h>
int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, unsigned int flags);
int CMS_final_digest(CMS_ContentInfo *cms, const unsigned char *md,
unsigned int mdlen, BIO *dcont, unsigned int flags);
two functions, same energy, slightly different vibes. let's get into it π«Ά
πΈ DESCRIPTION πΈ
CMS_final() π§
so this one finalises the structure cms. its whole purpose, its main character moment, is to do any operations necessary on cms β digest computation, for example β and then set the appropriate fields. periodt. π
- the
dataparameter contains the content to be processed - the
dcontparameter contains aBIOto write content to after processing β but heads up, this is only used with detached data, and it will usually be set toNULLπ
CMS_final_digest() π₯
this one finalises the structure cms using a pre-computed digest, rather than computing the digest from the original data. it's giving "i already did the work, bestie" β¨
β NOTES β
these functions will normally be called when the CMS_PARTIAL flag is used π
they should only be used when streaming is not performed, because the streaming I/O functions perform finalisation operations internally. so like, don't double up, that's not the vibe π
now, to sign a pre-computed digest: CMS_sign(3) or CMS_sign_ex() is called with the data parameter set to NULL before the CMS structure is finalised with the digest provided to CMS_final_digest() in binary form.
β οΈ ngl, real talk: when signing a pre-computed digest, the security relies on the digest and its computation from the original message being trusted. this is the important part, don't skip it fr fr π
π¦ RETURN VALUES π¦
CMS_final()andCMS_final_digest()return1for success- or
0for failure π
that's it, that's the whole vibe check.
π SEE ALSO π
go read those too, iykyk π
π HISTORY π
CMS_final_digest() was added in OpenSSL 3.2. iconic behaviour tbh π
π COPYRIGHT π
Copyright 2008-2022 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>.
and that's the page, bestie! π this lil rewrite is from the OpenSSL 3.5.0 manual, dated 2026-09-25 β so go forth, finalise responsibly, and remember: CMS_final said what it said πΈπ
β¨
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms