X509_ALGOR_DUP(3ossl)
π X509_ALGOR_DUP π
okay bestie, so this is a page from the OpenSSL manuals, and it's all about the AlgorithmIdentifier functions β X509_ALGOR_dup, X509_ALGOR_set0, X509_ALGOR_get0, X509_ALGOR_set_md, X509_ALGOR_cmp, and X509_ALGOR_copy. yes the name is giving "six functions in one trenchcoat" but that's literally how OpenSSL do it. π«Ά
β¨ SYNOPSIS β¨
#include <openssl/x509.h>
X509_ALGOR *X509_ALGOR_dup(X509_ALGOR *alg);
int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval);
void X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype,
const void **ppval, const X509_ALGOR *alg);
void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md);
int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b);
int X509_ALGOR_copy(X509_ALGOR *dest, const X509_ALGOR *src);
like look at that lineup. six icons. no notes. π
π¦ DESCRIPTION π¦
X509_ALGOR_dup()β hands you back a copy of alg. that's it, that's the whole job, and she does it flawlessly.X509_ALGOR_set0()β sets the algorithm OID of alg to aobj, and sets the associated parameter type to ptype with value pval. if ptype isV_ASN1_UNDEF, then the parameter is justβ¦ omitted, gone, not invited. otherwise ptype and pval mean exactly the same thing as the type and value parameters toASN1_TYPE_set(). and now the important part bestie:
π¨ all the supplied parameters are used internally, so you must NOT free them after this call succeeded. otherwise, ownership stays with you (the caller) and alg is left completely untouched. so like, either it takes the whole thing or it takes nothing. no in-between, no half-committed situationships. π
X509_ALGOR_get0()β the inverse ofX509_ALGOR_set0(), the two of them are literally mirror selfies. it returns the algorithm OID in*paobj, and the associated parameter in*pptypeand*ppval, pulled from the AlgorithmIdentifier alg.X509_ALGOR_set_md()β sets the AlgorithmIdentifier alg to the appropriate values for the message digest md. she's the matchmaker fr fr. πX509_ALGOR_cmp()β compares a and b, and returns0if they have identical encodings, nonzero otherwise. it's a vibe check on the encoding level, not a personality test.X509_ALGOR_copy()β copies the source values into the dest structs, making a duplicate of each one. and yes, it also frees anything pointed to from within*dest, so it's a clean overwrite, not a messy pile-up. β¨
π RETURN VALUES π
X509_ALGOR_dup()β returns a validX509_ALGORstructure, orNULLif an error occurred. π (that NULL is the "we need to talk" text of return values)X509_ALGOR_set0()andX509_ALGOR_copy()β return1on success, or0on error.X509_ALGOR_get0()andX509_ALGOR_set_md()β return no values at all. they simply do the thing and leave. main character energy. πX509_ALGOR_cmp()β returns0if the two parameters have identical encodings, and nonzero otherwise.
πΈ HISTORY πΈ
so X509_ALGOR_copy() is the baby of the group β she was added in 1.1.1e. the others were already out here thriving before her. β
π COPYRIGHT π
Copyright 2002-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>.
okay and that's the whole page, periodt π this was X509_ALGOR_DUP from the OpenSSL 3ossl manual set, dated 2026-09-29, version 3.5.9 β take care of her, she's iconic ππ¦β¨
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms