pubkey-internal.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* pubkey-internal.h - Internal defs for pubkey.c
  2. * Copyright (C) 2013 g10 code GmbH
  3. *
  4. * This file is part of Libgcrypt.
  5. *
  6. * Libgcrypt is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as
  8. * published by the Free Software Foundation; either version 2.1 of
  9. * the License, or (at your option) any later version.
  10. *
  11. * Libgcrypt is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this program; if not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef GCRY_PUBKEY_INTERNAL_H
  20. #define GCRY_PUBKEY_INTERNAL_H
  21. /*-- pubkey-util.c --*/
  22. gpg_err_code_t _gcry_pk_util_parse_flaglist (gcry_sexp_t list,
  23. int *r_flags,
  24. enum pk_encoding *r_encoding);
  25. gpg_err_code_t _gcry_pk_util_get_nbits (gcry_sexp_t list,
  26. unsigned int *r_nbits);
  27. gpg_err_code_t _gcry_pk_util_get_rsa_use_e (gcry_sexp_t list,
  28. unsigned long *r_e);
  29. gpg_err_code_t _gcry_pk_util_preparse_sigval (gcry_sexp_t s_sig,
  30. const char **algo_names,
  31. gcry_sexp_t *r_parms,
  32. int *r_eccflags);
  33. gpg_err_code_t _gcry_pk_util_preparse_encval (gcry_sexp_t sexp,
  34. const char **algo_names,
  35. gcry_sexp_t *r_parms,
  36. struct pk_encoding_ctx *ctx);
  37. void _gcry_pk_util_init_encoding_ctx (struct pk_encoding_ctx *ctx,
  38. enum pk_operation op,
  39. unsigned int nbits);
  40. void _gcry_pk_util_free_encoding_ctx (struct pk_encoding_ctx *ctx);
  41. gcry_err_code_t _gcry_pk_util_data_to_mpi (gcry_sexp_t input,
  42. gcry_mpi_t *ret_mpi,
  43. struct pk_encoding_ctx *ctx);
  44. /*-- rsa-common.c --*/
  45. gpg_err_code_t
  46. _gcry_rsa_pkcs1_encode_for_enc (gcry_mpi_t *r_result, unsigned int nbits,
  47. const unsigned char *value, size_t valuelen,
  48. const unsigned char *random_override,
  49. size_t random_override_len);
  50. gpg_err_code_t
  51. _gcry_rsa_pkcs1_decode_for_enc (unsigned char **r_result, size_t *r_resultlen,
  52. unsigned int nbits, gcry_mpi_t value);
  53. gpg_err_code_t
  54. _gcry_rsa_pkcs1_encode_raw_for_sig (gcry_mpi_t *r_result, unsigned int nbits,
  55. const unsigned char *value, size_t valuelen);
  56. gpg_err_code_t
  57. _gcry_rsa_pkcs1_encode_for_sig (gcry_mpi_t *r_result, unsigned int nbits,
  58. const unsigned char *value, size_t valuelen,
  59. int algo);
  60. gpg_err_code_t
  61. _gcry_rsa_oaep_encode (gcry_mpi_t *r_result, unsigned int nbits, int algo,
  62. const unsigned char *value, size_t valuelen,
  63. const unsigned char *label, size_t labellen,
  64. const void *random_override, size_t random_override_len);
  65. gpg_err_code_t
  66. _gcry_rsa_oaep_decode (unsigned char **r_result, size_t *r_resultlen,
  67. unsigned int nbits, int algo,
  68. gcry_mpi_t value,
  69. const unsigned char *label, size_t labellen);
  70. gpg_err_code_t
  71. _gcry_rsa_pss_encode (gcry_mpi_t *r_result, unsigned int nbits, int algo,
  72. int hashed_already, int saltlen,
  73. const unsigned char *value, size_t valuelen,
  74. const void *random_override);
  75. gpg_err_code_t
  76. _gcry_rsa_pss_verify (gcry_mpi_t value, int hashed_already, gcry_mpi_t encoded,
  77. unsigned int nbits, int algo, size_t saltlen);
  78. /*-- dsa-common.c --*/
  79. void _gcry_dsa_modify_k (gcry_mpi_t k, gcry_mpi_t q, int qbits);
  80. gcry_mpi_t _gcry_dsa_gen_k (gcry_mpi_t q, int security_level);
  81. gpg_err_code_t _gcry_dsa_gen_rfc6979_k (gcry_mpi_t *r_k,
  82. gcry_mpi_t dsa_q, gcry_mpi_t dsa_x,
  83. const unsigned char *h1,
  84. unsigned int h1len,
  85. int halgo,
  86. unsigned int extraloops);
  87. gpg_err_code_t _gcry_dsa_compute_hash (gcry_mpi_t *r_hash, gcry_mpi_t input,
  88. int hashalgo);
  89. gpg_err_code_t _gcry_dsa_normalize_hash (gcry_mpi_t input,
  90. gcry_mpi_t *out,
  91. unsigned int qbits);
  92. /*-- ecc.c --*/
  93. gpg_err_code_t _gcry_pk_ecc_get_sexp (gcry_sexp_t *r_sexp, int mode,
  94. mpi_ec_t ec);
  95. #endif /*GCRY_PUBKEY_INTERNAL_H*/