nm-crypto-impl.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
  2. /*
  3. * Dan Williams <dcbw@redhat.com>
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the
  17. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18. * Boston, MA 02110-1301 USA.
  19. *
  20. * Copyright 2007 - 2018 Red Hat, Inc.
  21. */
  22. #ifndef __NM_CRYPTO_IMPL_H__
  23. #define __NM_CRYPTO_IMPL_H__
  24. #if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_PRIVATE)
  25. #error Cannot use this header.
  26. #endif
  27. #include "nm-crypto.h"
  28. gboolean _nm_crypto_init (GError **error);
  29. gboolean _nm_crypto_randomize (void *buffer, gsize buffer_len, GError **error);
  30. gboolean _nm_crypto_verify_x509 (const guint8 *data,
  31. gsize len,
  32. GError **error);
  33. gboolean _nm_crypto_verify_pkcs12 (const guint8 *data,
  34. gsize data_len,
  35. const char *password,
  36. GError **error);
  37. gboolean _nm_crypto_verify_pkcs8 (const guint8 *data,
  38. gsize data_len,
  39. gboolean is_encrypted,
  40. const char *password,
  41. GError **error);
  42. /*****************************************************************************/
  43. guint8 *_nmtst_crypto_encrypt (NMCryptoCipherType cipher,
  44. const guint8 *data,
  45. gsize data_len,
  46. const guint8 *iv,
  47. gsize iv_len,
  48. const guint8 *key,
  49. gsize key_len,
  50. gsize *out_len,
  51. GError **error);
  52. guint8 *_nmtst_crypto_decrypt (NMCryptoCipherType cipher,
  53. const guint8 *data,
  54. gsize data_len,
  55. const guint8 *iv,
  56. gsize iv_len,
  57. const guint8 *key,
  58. gsize key_len,
  59. gsize *out_len,
  60. GError **error);
  61. #endif /* __NM_CRYPTO_IMPL_H__ */