params.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. #include <stddef.h>
  10. #include <openssl/params.h>
  11. /*
  12. * Extract the parameter into an allocated buffer.
  13. * Any existing allocation in *out is cleared and freed.
  14. *
  15. * Returns 1 on success, 0 on failure and -1 if there are no matching params.
  16. *
  17. * *out and *out_len are guaranteed to be untouched if this function
  18. * doesn't return success.
  19. */
  20. int ossl_param_get1_octet_string(const OSSL_PARAM *params, const char *name,
  21. unsigned char **out, size_t *out_len);
  22. /*
  23. * Concatenate all of the matching params together.
  24. * *out will point to an allocated buffer on successful return.
  25. * Any existing allocation in *out is cleared and freed.
  26. *
  27. * Passing 0 for maxsize means unlimited size output.
  28. *
  29. * Returns 1 on success, 0 on failure and -1 if there are no matching params.
  30. *
  31. * *out and *out_len are guaranteed to be untouched if this function
  32. * doesn't return success.
  33. */
  34. int ossl_param_get1_concat_octet_string(const OSSL_PARAM *params, const char *name,
  35. unsigned char **out, size_t *out_len,
  36. size_t maxsize);