kdf.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the OpenSSL license (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. #ifndef HEADER_KDF_H
  10. # define HEADER_KDF_H
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. # define EVP_PKEY_CTRL_TLS_MD (EVP_PKEY_ALG_CTRL)
  15. # define EVP_PKEY_CTRL_TLS_SECRET (EVP_PKEY_ALG_CTRL + 1)
  16. # define EVP_PKEY_CTRL_TLS_SEED (EVP_PKEY_ALG_CTRL + 2)
  17. # define EVP_PKEY_CTRL_HKDF_MD (EVP_PKEY_ALG_CTRL + 3)
  18. # define EVP_PKEY_CTRL_HKDF_SALT (EVP_PKEY_ALG_CTRL + 4)
  19. # define EVP_PKEY_CTRL_HKDF_KEY (EVP_PKEY_ALG_CTRL + 5)
  20. # define EVP_PKEY_CTRL_HKDF_INFO (EVP_PKEY_ALG_CTRL + 6)
  21. # define EVP_PKEY_CTX_set_tls1_prf_md(pctx, md) \
  22. EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
  23. EVP_PKEY_CTRL_TLS_MD, 0, (void *)md)
  24. # define EVP_PKEY_CTX_set1_tls1_prf_secret(pctx, sec, seclen) \
  25. EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
  26. EVP_PKEY_CTRL_TLS_SECRET, seclen, (void *)sec)
  27. # define EVP_PKEY_CTX_add1_tls1_prf_seed(pctx, seed, seedlen) \
  28. EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
  29. EVP_PKEY_CTRL_TLS_SEED, seedlen, (void *)seed)
  30. # define EVP_PKEY_CTX_set_hkdf_md(pctx, md) \
  31. EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
  32. EVP_PKEY_CTRL_HKDF_MD, 0, (void *)md)
  33. # define EVP_PKEY_CTX_set1_hkdf_salt(pctx, salt, saltlen) \
  34. EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
  35. EVP_PKEY_CTRL_HKDF_SALT, saltlen, (void *)salt)
  36. # define EVP_PKEY_CTX_set1_hkdf_key(pctx, key, keylen) \
  37. EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
  38. EVP_PKEY_CTRL_HKDF_KEY, keylen, (void *)key)
  39. # define EVP_PKEY_CTX_add1_hkdf_info(pctx, info, infolen) \
  40. EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
  41. EVP_PKEY_CTRL_HKDF_INFO, infolen, (void *)info)
  42. /* BEGIN ERROR CODES */
  43. /*
  44. * The following lines are auto generated by the script mkerr.pl. Any changes
  45. * made after this point may be overwritten when the script is next run.
  46. */
  47. int ERR_load_KDF_strings(void);
  48. /* Error codes for the KDF functions. */
  49. /* Function codes. */
  50. # define KDF_F_PKEY_TLS1_PRF_CTRL_STR 100
  51. # define KDF_F_PKEY_TLS1_PRF_DERIVE 101
  52. /* Reason codes. */
  53. # define KDF_R_INVALID_DIGEST 100
  54. # define KDF_R_MISSING_PARAMETER 101
  55. # define KDF_R_VALUE_MISSING 102
  56. # ifdef __cplusplus
  57. }
  58. # endif
  59. #endif