snmp_openssl.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Header file for the OpenSSL Wrapper
  3. */
  4. #ifndef SNMP_OPENSSL_H
  5. #define SNMP_OPENSSL_H
  6. #ifdef NETSNMP_USE_OPENSSL
  7. #include <openssl/dh.h>
  8. #include <openssl/ssl.h>
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. struct netsnmp_cert_map_s;
  13. NETSNMP_IMPORT
  14. void netsnmp_init_openssl(void);
  15. /*
  16. * cert fields
  17. */
  18. void netsnmp_openssl_cert_dump_names(X509 *ocert);
  19. void netsnmp_openssl_cert_dump_extensions(X509 *ocert);
  20. char *netsnmp_openssl_cert_get_commonName(X509 *, char **buf, int *len);
  21. char *netsnmp_openssl_cert_get_subjectName(X509 *, char **buf, int *len);
  22. char *netsnmp_openssl_cert_get_fingerprint(X509 *ocert, int alg);
  23. int netsnmp_openssl_cert_get_hash_type(X509 *ocert);
  24. int netsnmp_openssl_cert_issued_by(X509 *issuer, X509 *cert);
  25. char *netsnmp_openssl_extract_secname(struct netsnmp_cert_map_s *cert_map,
  26. struct netsnmp_cert_map_s *peer_cert);
  27. char *netsnmp_openssl_cert_get_subjectAltName(X509 *, char **buf, int *len);
  28. /*
  29. * ssl cert chains
  30. */
  31. netsnmp_container *netsnmp_openssl_get_cert_chain(SSL *ssl);
  32. /*
  33. * misc
  34. */
  35. void netsnmp_openssl_err_log(const char *prefix);
  36. void netsnmp_openssl_null_checks(SSL *ssl, int *nullAuth, int *nullCipher);
  37. /*
  38. * backports
  39. */
  40. #ifndef HAVE_DH_SET0_PQG
  41. NETSNMP_IMPORT
  42. int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
  43. #endif
  44. #ifndef HAVE_DH_GET0_PQG
  45. NETSNMP_IMPORT
  46. void DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q,
  47. const BIGNUM **g);
  48. #endif
  49. #ifndef HAVE_DH_GET0_KEY
  50. NETSNMP_IMPORT
  51. void DH_get0_key(const DH *dh, const BIGNUM **pub_key,
  52. const BIGNUM **priv_key);
  53. #endif
  54. #ifndef HAVE_ASN1_STRING_GET0_DATA
  55. NETSNMP_IMPORT
  56. const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x);
  57. #endif
  58. #ifndef HAVE_X509_NAME_ENTRY_GET_OBJECT
  59. NETSNMP_IMPORT
  60. ASN1_OBJECT *X509_NAME_ENTRY_get_object(const X509_NAME_ENTRY *ne);
  61. #endif
  62. #ifndef HAVE_X509_NAME_ENTRY_GET_DATA
  63. NETSNMP_IMPORT
  64. ASN1_STRING *X509_NAME_ENTRY_get_data(const X509_NAME_ENTRY *ne);
  65. #endif
  66. #ifndef HAVE_X509_GET_SIGNATURE_NID
  67. NETSNMP_IMPORT
  68. int X509_get_signature_nid(const X509 *req);
  69. #endif
  70. #ifndef HAVE_TLS_METHOD
  71. NETSNMP_IMPORT
  72. const SSL_METHOD *TLS_method(void);
  73. #endif
  74. #ifndef HAVE_DTLS_METHOD
  75. NETSNMP_IMPORT
  76. const SSL_METHOD *DTLS_method(void);
  77. #endif
  78. #endif
  79. #ifdef __cplusplus
  80. }
  81. #endif
  82. #endif /* SNMP_OPENSSL_H */