OSSL_PARAM_DUP(3ossl)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

✨ OSSL_PARAM_DUP πŸ’… (that's the 3ossl manual page bestie, from the OpenSSL fam)

okay so picture this: you've got OSSL_PARAM_dup, OSSL_PARAM_merge, and OSSL_PARAM_free β€” the whole OSSL_PARAM array copy squad β€” and they are literally the friend group that handles duplicating and merging your param arrays for you. no cap. let's get into it 🫢


🌸 SYNOPSIS 🌸

like, here's the receipt, verbatim:

#include <openssl/params.h>

OSSL_PARAM *OSSL_PARAM_dup(const OSSL_PARAM *params);
OSSL_PARAM *OSSL_PARAM_merge(const OSSL_PARAM *params, const OSSL_PARAM *params1);
void OSSL_PARAM_free(OSSL_PARAM *params);

πŸ’– DESCRIPTION πŸ’–

so algorithm parameters can be exported/imported from/to providers using arrays of OSSL_PARAM(3). and the following utility functions let you duplicate and merge those parameters with other OSSL_PARAM(3) arrays to help you out with that whole process. it's giving "helper functions that ate" ✨

  • OSSL_PARAM_dup() β€” duplicates the parameter array params. and bestie, this one does a deep copy of the data. like, truly its own independent copy, none of that shared-reference nonsense πŸ‘‘
  • OSSL_PARAM_merge() β€” merges the parameter arrays params and params1 into a new parameter array. if params and params1 contain values with the same 'key', then the value from params1 will replace the param value (so params1 wins the argument, iconic behavior honestly πŸ’…). heads up though: this function does a shallow copy of the parameters. also, either params or params1 may be NULL. and ⚠️ the behaviour of the merge is unpredictable if params and params1 contain the same key, and there are multiple entries within either array that have the same key. so like... don't do that, fr fr 😭
  • OSSL_PARAM_free() β€” frees the parameter array params that was created using OSSL_PARAM_dup(), OSSL_PARAM_merge() or OSSL_PARAM_BLD_to_param(). and if the argument to OSSL_PARAM_free() is NULL, nothing is done β€” no drama, no crash, it just vibes πŸ¦‹

πŸŽ€ RETURN VALUES πŸŽ€

  • OSSL_PARAM_dup() and OSSL_PARAM_merge() return a newly allocated OSSL_PARAM(3) array, or NULL if there was an error. and if both parameters are NULL then NULL is returned. that's the whole story, periodt πŸ’€

🌈 SEE ALSO 🌈

OSSL_PARAM(3), OSSL_PARAM_BLD(3) β€” go read those too, iykyk πŸ“š


⭐ HISTORY ⭐

the functions were added in OpenSSL 3.0. so they're not ancient relics, they're relatively fresh πŸ‘‘


Copyright 2021-2024 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 🧚 signing off from version 3.5.6, dated 2026-04-07, on the OSSL_PARAM_DUP(3ossl) manual page β€” stay slay, stay copied-deep, mwah πŸ’‹πŸŒΈ

πŸ“¦ where this page comes from