OSSL_PARAM_DUP(3SSL)

πŸ“¦
version 4.0.3 Β· 2 versions
, in ubuntu stonking

πŸ’– OSSL_PARAM_DUP(3SSL) πŸ’–

okay bestie, listen β€” this is the OSSL_PARAM array copy functions page, from the OpenSSL girlies ✨ (that's the 3SSL manual name, in case the vibe check needed a label πŸŽ€). It's the OSSL_PARAM_dup, OSSL_PARAM_merge, OSSL_PARAM_free, OSSL_PARAM_clear_free squad. Let's get into it πŸ’…


🌸 NAME 🌸

OSSL_PARAM_dup, OSSL_PARAM_merge, OSSL_PARAM_free, OSSL_PARAM_clear_free β€” the OSSL_PARAM array copy functions πŸ¦‹


✨ SYNOPSIS ✨

#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);
void OSSL_PARAM_clear_free(OSSL_PARAM *params);

πŸ’œ DESCRIPTION πŸ’œ

So algorithm parameters can be exported/imported from/to providers using arrays of OSSL_PARAM(3) β€” that's just the whole thing, no cap. And the following utility functions let those parameters get duplicated and merged with other OSSL_PARAM(3), to assist in this process 🫢

  • OSSL_PARAM_dup() β€” duplicates the parameter array params. This function does a deep copy of the data. like truly a whole cloned situation, every byte copied down πŸ’–
  • 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. This function does a shallow copy of the parameters. Either params or params1 may be NULL. 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 😭
bestie, read that last sentence again. if there's duplicate keys and multiple entries with that same key, the merge behaviour is unpredictable. chaotic. not the cute kind of chaotic. πŸ™ˆ
  • OSSL_PARAM_free() β€” frees the parameter array params that was created using OSSL_PARAM_dup(), OSSL_PARAM_merge() or OSSL_PARAM_BLD_to_param(). If the argument to OSSL_PARAM_free() is NULL, nothing is done. so it just respectfully minds its business ✨
  • OSSL_PARAM_clear_free() β€” performs the same function as OSSL_PARAM_free() but additionally calls OPENSSL_cleanse() on the contents copied in. 🧼
Note: only params built via the OSSL_PARAM_dup() or OSSL_PARAM_BLD_to_param() functions will be effectively cleared β€” parameters built any other way will still be freed but no cleanse operation will be performed. so like, the lil wipe-down only happens for those two build paths, everyone else just gets yeeted πŸ’€

🌈 RETURN VALUES 🌈

  • The functions OSSL_PARAM_dup() and OSSL_PARAM_merge() return a newly allocated OSSL_PARAM(3) array, or NULL if there was an error.
  • If both parameters are NULL then NULL is returned. 😭

πŸ¦‹ SEE ALSO πŸ¦‹

OSSL_PARAM(3), OSSL_PARAM_BLD(3)


πŸ‘‘ HISTORY πŸ‘‘

  • The OSSL_PARAM_dup, OSSL_PARAM_merge and OSSL_PARAM_free functions were added in OpenSSL 3.0.
  • OSSL_PARAM_clear_free was added in OpenSSL 4.0.0. the new girl on the block fr fr ✨

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, we ate and left no crumbs πŸ’… this lil masterpiece is from OpenSSL 4.0.3, dated 2026-09-29, and it lives in the OSSL_PARAM_DUP(3SSL) manual. go forth and deep-copy responsibly 🫢🌸✨

πŸ“¦ where this page comes from