1 /* 2 * Copyright (C) 2014-2021 Cisco and/or its affiliates. All rights reserved. 3 * Copyright (C) 2013-2013 Sourcefire, Inc. 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License Version 2 as 7 * published by the Free Software Foundation. You may not use, modify or 8 * distribute this program under any other version of the GNU General 9 * Public License. 10 * 11 * This program 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 General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 */ 20 21 /* 22 * File: ssl_include.h 23 * Author: Bhagyashree Bantwal <bbantwal@cisco.com> 24 * Brief: Header file with all includes required by SSL 25 */ 26 27 #ifndef SSL_INCLUDE_H 28 #define SSL_INCLUDE_H 29 30 /******************INCLUDES************************/ 31 32 #include <stdio.h> 33 #include <stdint.h> 34 #include <syslog.h> 35 #include <string.h> 36 #ifndef WIN32 37 #include <strings.h> 38 #include <sys/time.h> 39 #include <stdbool.h> 40 #else 41 #include "sf_types.h" 42 #endif 43 #include <stdlib.h> 44 #include <ctype.h> 45 #include "ssl.h" 46 #include "sfcommon.h" 47 #include "profiler.h" 48 #include "sfPolicy.h" 49 #include "sfPolicyUserData.h" 50 #include "sf_snort_plugin_api.h" 51 #include "snort_debug.h" 52 #include "preprocids.h" 53 #include "sf_preproc_info.h" 54 #include "sf_snort_packet.h" 55 56 typedef void (*PP_Set_Flow_Id_Callback_Func) (void *app_data, uint32_t flow_context); 57 58 typedef struct _ssl_callback_interface 59 { 60 61 int (*policy_initialize)(void *, bool); 62 void (*policy_free)(void **, bool); 63 void (*session_initialize)(SFSnortPacket* p, void *app_data, PP_Set_Flow_Id_Callback_Func pp_callback); 64 void (*session_free)(uint32_t fid); 65 bool (*is_session_ssl)(SFSnortPacket* p); 66 int (*get_ssl_flow_flags)(SFSnortPacket* p, void *sd, uint32_t *ssn_flags); 67 void (*register_ha_funcs)(void); 68 bool (*reload_mem_adjust_available)(void); 69 void (*register_reload_mem_adjust)(struct _SnortConfig *sc, void *reload_config); 70 } ssl_callback_interface_t; 71 72 73 extern bool IsTlsClientHello(const uint8_t *ptr, const uint8_t *end); 74 extern bool IsTlsServerHello(const uint8_t *ptr, const uint8_t *end); 75 extern bool IsSSL(const uint8_t *ptr, int len, int pkt_flags); 76 77 #endif 78