s2n_dhe.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  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. #include <openssl/dh.h>
  17. #include "stuffer/s2n_stuffer.h"
  18. #include "utils/s2n_blob.h"
  19. struct s2n_dh_params {
  20. DH *dh;
  21. };
  22. int s2n_pkcs3_to_dh_params(struct s2n_dh_params *dh_params, struct s2n_blob *pkcs3);
  23. int s2n_dh_p_g_Ys_to_dh_params(struct s2n_dh_params *server_dh_params, struct s2n_blob *p, struct s2n_blob *g, struct s2n_blob *ys);
  24. int s2n_dh_params_to_p_g_Ys(struct s2n_dh_params *server_dh_params, struct s2n_stuffer *out, struct s2n_blob *output);
  25. int s2n_dh_compute_shared_secret_as_server(struct s2n_dh_params *server_dh_params, struct s2n_stuffer *Yc_in, struct s2n_blob *shared_key);
  26. int s2n_dh_compute_shared_secret_as_client(struct s2n_dh_params *server_dh_params, struct s2n_stuffer *Yc_out, struct s2n_blob *shared_key);
  27. int s2n_dh_params_copy(struct s2n_dh_params *from, struct s2n_dh_params *to);
  28. int s2n_dh_params_check(struct s2n_dh_params *dh_params);
  29. int s2n_dh_generate_ephemeral_key(struct s2n_dh_params *dh_params);
  30. int s2n_dh_params_free(struct s2n_dh_params *dh_params);