X509_ALGOR_DUP(3SSL)
π X509_ALGOR_DUP β AlgorithmIdentifier functions π
okay bestie, gather round, because today we're talking about AlgorithmIdentifier and the little squad of functions that handle it β this is X509_ALGOR_dup, X509_ALGOR_set0, X509_ALGOR_get0, X509_ALGOR_set_md, X509_ALGOR_cmp, and X509_ALGOR_copy, all hanging out in the OpenSSL 3SSL manual section. no cap, they're lowkey the glue holding your cert algorithms together. π
β¨ 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);
int 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 them. so organized. so iconic. π
πΈ DESCRIPTION πΈ
X509_ALGOR_dup() β hands you back a copy of alg. that's it, that's the whole vibe. dupe it and go. π¦
X509_ALGOR_set0() β sets the algorithm OID of alg to aobj, and sets the associated parameter type to ptype with value pval. if ptype is V_ASN1_UNDEF, the parameter is justβ¦ omitted, gone, not invited to the party. otherwise ptype and pval mean exactly the same thing as the type and value parameters to ASN1_TYPE_set().
β οΈ okay this part matters, bestie: all the supplied parameters are used internally, so you must NOT free them after this call succeeds. if it doesn't succeed, ownership stays with you (the caller) and alg remains untouched. no take-backs, no double-freeing, we do not do that here. π
X509_ALGOR_get0() β the inverse of X509_ALGOR_set0(), like a little mirror πͺ. it returns the algorithm OID in *paobj, and the associated parameter in *pptype and *ppval, pulled from the AlgorithmIdentifier alg.
X509_ALGOR_set_md() β sets the AlgorithmIdentifier alg to the appropriate values for the message digest md. match made in heaven fr fr. π
X509_ALGOR_cmp() β compares a and b. returns 0 if they have identical encodings, and nonzero otherwise. simple. clean. no drama.
X509_ALGOR_copy() β copies the source values into the dest structs, making a duplicate of each (and freeing anything pointed to from within *dest). it's giving responsible clean-up energy. β¨
π«Ά RETURN VALUES π«Ά
X509_ALGOR_dup()β returns a validX509_ALGORstructure, orNULLif an error occurred. πX509_ALGOR_set0(),X509_ALGOR_set_md(), andX509_ALGOR_copy()β return1on success or0on error.X509_ALGOR_get0()β returns no values. it just be filling in your pointers like that. πX509_ALGOR_cmp()β returns0if the two parameters have identical encodings, and nonzero otherwise.
β HISTORY β
X509_ALGOR_copy()was added in OpenSSL1.1.1e.X509_ALGOR_set_md()returns a value since OpenSSL4.0.
π COPYRIGHT π
Copyright 2002-2026 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 whole page, bestie β this was OpenSSL 4.0.3, dated 2026-09-29, from the X509_ALGOR_DUP(3SSL) manual. go forth and algorithm-identify responsibly. mwah πβ¨π§
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms