EVP_PKEY_copy_parameters.pod 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. =pod
  2. =head1 NAME
  3. EVP_PKEY_missing_parameters, EVP_PKEY_copy_parameters, EVP_PKEY_parameters_eq,
  4. EVP_PKEY_cmp_parameters, EVP_PKEY_eq,
  5. EVP_PKEY_cmp - public key parameter and comparison functions
  6. =head1 SYNOPSIS
  7. #include <openssl/evp.h>
  8. int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey);
  9. int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from);
  10. int EVP_PKEY_parameters_eq(const EVP_PKEY *a, const EVP_PKEY *b);
  11. int EVP_PKEY_eq(const EVP_PKEY *a, const EVP_PKEY *b);
  12. The following functions have been deprecated since OpenSSL 3.0, and can be
  13. hidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value,
  14. see L<openssl_user_macros(7)>:
  15. int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b);
  16. int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b);
  17. =head1 DESCRIPTION
  18. The function EVP_PKEY_missing_parameters() returns 1 if the public key
  19. parameters of B<pkey> are missing and 0 if they are present or the algorithm
  20. doesn't use parameters.
  21. The function EVP_PKEY_copy_parameters() copies the parameters from key
  22. B<from> to key B<to>. An error is returned if the parameters are missing in
  23. B<from> or present in both B<from> and B<to> and mismatch. If the parameters
  24. in B<from> and B<to> are both present and match this function has no effect.
  25. The function EVP_PKEY_parameters_eq() checks the parameters of keys
  26. B<a> and B<b> for equality.
  27. The function EVP_PKEY_eq() checks the keys B<a> and B<b> for equality,
  28. including their parameters if they are available.
  29. =head1 NOTES
  30. The main purpose of the functions EVP_PKEY_missing_parameters() and
  31. EVP_PKEY_copy_parameters() is to handle public keys in certificates where the
  32. parameters are sometimes omitted from a public key if they are inherited from
  33. the CA that signed it.
  34. The deprecated functions EVP_PKEY_cmp() and EVP_PKEY_cmp_parameters() differ in
  35. their return values compared to other _cmp() functions. They are aliases for
  36. EVP_PKEY_eq() and EVP_PKEY_parameters_eq().
  37. The function EVP_PKEY_cmp() previously only checked the key parameters
  38. (if there are any) and the public key, assuming that there always was
  39. a public key and that private key equality could be derived from that.
  40. Because it's no longer assumed that the private key in an L<EVP_PKEY(3)> is
  41. always accompanied by a public key, the comparison can not rely on public
  42. key comparison alone.
  43. Instead, EVP_PKEY_eq() (and therefore also EVP_PKEY_cmp()) now compares:
  44. =over 4
  45. =item 1.
  46. the key parameters (if there are any)
  47. =item 2.
  48. the public keys or the private keys of the two B<EVP_PKEY>s, depending on
  49. what they both contain.
  50. =back
  51. =begin comment
  52. Exactly what is compared is ultimately at the discretion of the provider
  53. that holds the key, as they will compare what makes sense to them that fits
  54. the selector bits they are passed.
  55. =end comment
  56. =head1 RETURN VALUES
  57. The function EVP_PKEY_missing_parameters() returns 1 if the public key
  58. parameters of B<pkey> are missing and 0 if they are present or the algorithm
  59. doesn't use parameters.
  60. These functions EVP_PKEY_copy_parameters() returns 1 for success and 0 for
  61. failure.
  62. The functions EVP_PKEY_cmp_parameters(), EVP_PKEY_parameters_eq(),
  63. EVP_PKEY_cmp() and EVP_PKEY_eq() return 1 if their
  64. inputs match, 0 if they don't match, -1 if the key types are different and
  65. -2 if the operation is not supported.
  66. =head1 SEE ALSO
  67. L<EVP_PKEY_CTX_new(3)>,
  68. L<EVP_PKEY_keygen(3)>
  69. =head1 HISTORY
  70. The EVP_PKEY_cmp() and EVP_PKEY_cmp_parameters() functions were deprecated in
  71. OpenSSL 3.0.
  72. The EVP_PKEY_eq() and EVP_PKEY_parameters_eq() were added in OpenSSL 3.0 to
  73. replace EVP_PKEY_cmp() and EVP_PKEY_cmp_parameters().
  74. =head1 COPYRIGHT
  75. Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.
  76. Licensed under the Apache License 2.0 (the "License"). You may not use
  77. this file except in compliance with the License. You can obtain a copy
  78. in the file LICENSE in the source distribution or at
  79. L<https://www.openssl.org/source/license.html>.
  80. =cut