s2n_internal.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License").
  5. * You may not use this file except in compliance with the License.
  6. * A copy of the License is located at
  7. *
  8. * http://aws.amazon.com/apache2.0
  9. *
  10. * or in the "license" file accompanying this file. This file is distributed
  11. * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  12. * express or implied. See the License for the specific language governing
  13. * permissions and limitations under the License.
  14. */
  15. #pragma once
  16. #if ((__GNUC__ >= 4) || defined(__clang__)) && defined(S2N_EXPORTS)
  17. #define S2N_PRIVATE_API __attribute__((visibility("default")))
  18. #else
  19. #define S2N_PRIVATE_API
  20. #endif /* __GNUC__ >= 4 || defined(__clang__) */
  21. #include <stdint.h>
  22. /*
  23. * Internal APIs.
  24. *
  25. * These APIs change the behavior of S2N in potentially dangerous ways and should only be
  26. * used for testing purposes. All Internal APIs are subject to change without notice.
  27. */
  28. struct s2n_config;
  29. struct s2n_connection;
  30. /*
  31. * Gets the config set on the connection.
  32. *
  33. * This function will return a pointer to the config set by `s2n_connection_set_config`.
  34. * It will return NULL prior to `s2n_connection_set_config` being called and a config
  35. * being set by the application.
  36. *
  37. * Caution: A config can be associated with multiple connections and should not be
  38. * modified after it has been built. Doing so is undefined behavior.
  39. */
  40. S2N_PRIVATE_API int s2n_connection_get_config(struct s2n_connection *conn, struct s2n_config **config);
  41. /*
  42. * Sets a certificate chain on the config.
  43. *
  44. * It does NOT set a private key, so the connection will need to be configured to
  45. * [offload private key operations](https://github.com/aws/s2n-tls/blob/main/docs/USAGE-GUIDE.md#offloading-asynchronous-private-key-operations).
  46. */
  47. S2N_PRIVATE_API int s2n_config_add_cert_chain(struct s2n_config *config,
  48. uint8_t *cert_chain_pem, uint32_t cert_chain_pem_size);