Branch data Line data Source code
1 : : // $Id:$
2 : :
3 : : #include "SSL-binpac.h"
4 : : #include "TCP_Reassembler.h"
5 : : #include "util.h"
6 : :
7 : :
8 : : bool SSL_Analyzer_binpac::warnings_generated = false;
9 : :
10 : 0 : SSL_Analyzer_binpac::SSL_Analyzer_binpac(Connection* c)
11 : 0 : : TCP_ApplicationAnalyzer(AnalyzerTag::SSL_BINPAC, c)
12 : : {
13 : 0 : ssl = new binpac::SSL::SSLAnalyzer;
14 : 0 : ssl->set_bro_analyzer(this);
15 : :
16 : 0 : records = new binpac::SSLRecordLayer::SSLRecordLayerAnalyzer;
17 : 0 : records->set_ssl_analyzer(ssl);
18 : :
19 [ # # # # ]: 0 : if ( ! warnings_generated )
20 : 0 : generate_warnings();
21 : 0 : }
22 : :
23 : 0 : SSL_Analyzer_binpac::~SSL_Analyzer_binpac()
24 : : {
25 [ # # ][ # # ]: 0 : delete records;
[ # # ]
26 [ # # ][ # # ]: 0 : delete ssl;
[ # # ]
27 [ # # ][ # # ]: 0 : }
[ # # ]
28 : :
29 : 0 : void SSL_Analyzer_binpac::Done()
30 : : {
31 : 0 : TCP_ApplicationAnalyzer::Done();
32 : :
33 : 0 : records->FlowEOF(true);
34 : 0 : records->FlowEOF(false);
35 : 0 : }
36 : :
37 : 0 : void SSL_Analyzer_binpac::EndpointEOF(TCP_Reassembler* endp)
38 : : {
39 : 0 : TCP_ApplicationAnalyzer::EndpointEOF(endp);
40 : 0 : records->FlowEOF(endp->IsOrig());
41 : 0 : ssl->FlowEOF(endp->IsOrig());
42 : 0 : }
43 : :
44 : 0 : void SSL_Analyzer_binpac::DeliverStream(int len, const u_char* data, bool orig)
45 : : {
46 : 0 : TCP_ApplicationAnalyzer::DeliverStream(len, data, orig);
47 : :
48 [ # # ]: 0 : assert(TCP());
49 : :
50 [ # # ]: 0 : if ( TCP()->IsPartial() )
51 : 0 : return;
52 : :
53 : 0 : records->NewData(orig, data, data + len);
54 : : }
55 : :
56 : 0 : void SSL_Analyzer_binpac::Undelivered(int seq, int len, bool orig)
57 : : {
58 : 0 : TCP_ApplicationAnalyzer::Undelivered(seq, len, orig);
59 : 0 : records->NewGap(orig, len);
60 : 0 : }
61 : :
62 : 0 : void SSL_Analyzer_binpac::warn_(const char* msg)
63 : : {
64 : 0 : warn("SSL_Analyzer_binpac: ", msg);
65 : 0 : }
66 : :
67 : 0 : void SSL_Analyzer_binpac::generate_warnings()
68 : : {
69 [ # # ]: 0 : if ( ssl_store_certificates )
70 : 0 : warn_("storage of certificates (ssl_store_certificates) not supported");
71 [ # # ]: 0 : if ( ssl_store_key_material )
72 : 0 : warn_("storage of key material (ssl_store_key_material) not supported");
73 : :
74 : 0 : warnings_generated = true;
75 [ + - ][ + - ]: 6 : }
|