EVP_PKEY_CTX_GET_ALGOR(3ossl)

πŸ’– NAME πŸ’–

EVP_CIPHER_CTX_get_algor, EVP_CIPHER_CTX_get_algor_params, EVP_CIPHER_CTX_set_algor_params, EVP_PKEY_CTX_get_algor, EVP_PKEY_CTX_get_algor_params, EVP_PKEY_CTX_set_algor_params β€” bestie, these are the little messengers that pass an AlgorithmIdentifier and its params back and forth between you and the algorithm implementations πŸ’…βœ¨


πŸ¦‹ SYNOPSIS πŸ¦‹

int EVP_TYPE_CTX_get_algor(EVP_TYPE_CTX *ctx, X509_ALGOR **alg);
int EVP_TYPE_CTX_get_algor_params(EVP_TYPE_CTX *ctx, X509_ALGOR *alg);
int EVP_TYPE_CTX_set_algor_params(EVP_TYPE_CTX *ctx, const X509_ALGOR *alg);

🌸 DESCRIPTION 🌸

okay so first thing, real quick β€” in this description and in the "SYNOPSIS" above, TYPE is just a placeholder for any EVP operation type. like, whichever one you're actually using, that's what goes there 🫢

  • EVP_TYPE_CTX_get_algor() β€” this one tries to pull a whole entire complete AlgorithmIdentifier out of the EVP_TYPE implementation, and it populates *alg with it. If alg is NULL, calling this function is basically a vibe check: it just tells you whether calling this function is supported at all by the EVP_TYPE implementation. And if *alg is NULL, space gets allocated automatically and assigned to *alg. free real estate, we love to see it ✨
  • EVP_TYPE_CTX_get_algor_params() β€” this one goes for just the parameters part of an AlgorithmIdentifier from the EVP_TYPE implementation, and populates alg->parameters with it. If alg is NULL, again it's the support-check move: it tells you whether calling this function is supported at all by the EVP_TYPE implementation. If alg->parameters is NULL, space will be allocated automatically and assigned to alg->parameters. But if alg->parameters is not NULL, its previous contents will be overwritten with the retrieved AlgorithmIdentifier parameters. Beware! 😭 your old data is literally gone, no cap.
  • EVP_TYPE_CTX_set_algor_params() β€” the giving one πŸŽ€ it attempts to pass alg->parameters to the EVP_TYPE implementation. And yes, if alg is NULL, calling this function serves to see if calling this function is supported at all by the EVP_TYPE implementation. same energy every time, iconic.

πŸ’€ RETURN VALUES πŸ’€

All of these functions return 1 for success, and 0 or a negative number if an error occurs. And specifically: -2 gets returned when the function isn't supported by the EVP_TYPE implementation. so if you see a -2, that's not a you problem, that's a "this implementation doesn't do that" problem πŸ™ˆ


⭐ HISTORY ⭐

These functions were added in OpenSSL 3.4. newer than new πŸ‘‘


Copyright 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 πŸ§šπŸ’œ this was OpenSSL 3.5.9, dated 2026-09-29, and the manual page is EVP_PKEY_CTX_GET_ALGOR(3ossl). go forth and pass those AlgorithmIdentifiers around responsibly, mwah πŸ’‹πŸ“

πŸ“¦ where this page comes from