~ubuntu-branches/ubuntu/utopic/suricata/utopic

« back to all changes in this revision

Viewing changes to src/app-layer-ssl.h

  • Committer: Package Import Robot
  • Author(s): Pierre Chifflier
  • Date: 2012-07-22 22:27:36 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20120722222736-s2bcw3ruzenagjam
Tags: 1.3-1
* Imported Upstream version 1.3
* Add build-dependency on libnss3-dev and libnspr4-dev
* Bump Standards Version to 3.9.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2007-2010 Open Information Security Foundation
 
1
/* Copyright (C) 2007-2012 Open Information Security Foundation
2
2
 *
3
3
 * You can copy, redistribute or modify this Program under the terms of
4
4
 * the GNU General Public License version 2 as published by the Free
19
19
 * \file
20
20
 *
21
21
 * \author Anoop Saldanha <anoopsaldanha@gmail.com>
 
22
 * \author Pierre Chifflier <pierre.chifflier@ssi.gouv.fr>
22
23
 *
23
24
 */
24
25
 
25
26
#ifndef __APP_LAYER_SSL_H__
26
27
#define __APP_LAYER_SSL_H__
27
28
 
 
29
#include "decode-events.h"
 
30
 
 
31
enum {
 
32
    /* TLS protocol messages */
 
33
    TLS_DECODER_EVENT_INVALID_SSLV2_HEADER,
 
34
    TLS_DECODER_EVENT_INVALID_TLS_HEADER,
 
35
    TLS_DECODER_EVENT_INVALID_RECORD_TYPE,
 
36
    TLS_DECODER_EVENT_INVALID_HANDSHAKE_MESSAGE,
 
37
    /* Certificates decoding messages */
 
38
    TLS_DECODER_EVENT_INVALID_CERTIFICATE,
 
39
    TLS_DECODER_EVENT_CERTIFICATE_MISSING_ELEMENT,
 
40
    TLS_DECODER_EVENT_CERTIFICATE_UNKNOWN_ELEMENT,
 
41
    TLS_DECODER_EVENT_CERTIFICATE_INVALID_LENGTH,
 
42
    TLS_DECODER_EVENT_CERTIFICATE_INVALID_STRING,
 
43
    TLS_DECODER_EVENT_ERROR_MSG_ENCOUNTERED,
 
44
};
 
45
 
28
46
/* Flag to indicate that server will now on send encrypted msgs */
29
47
#define SSL_AL_FLAG_SERVER_CHANGE_CIPHER_SPEC   0x0001
30
48
/* Flag to indicate that client will now on send encrypted msgs */
58
76
    TLS_VERSION_12 = 0x0303,
59
77
};
60
78
 
61
 
/**
62
 
 * \brief SSLv[2.0|3.[0|1|2|3]] state structure.
63
 
 *
64
 
 *        Structure to store the SSL state values.
65
 
 */
66
 
typedef struct SSLState_ {
 
79
typedef struct SSLStateConnp_ {
67
80
    /* record length */
68
81
    uint32_t record_length;
69
82
    /* record length's length for SSLv2 */
70
83
    uint32_t record_lengths_length;
71
84
 
72
 
    /* holds some state flags we need */
73
 
    uint32_t flags;
74
 
 
75
 
    uint16_t client_version;
76
 
    uint16_t server_version;
77
 
    uint8_t client_content_type;
78
 
    uint8_t server_content_type;
79
 
 
80
 
    /* dummy var.  You can replace this if you want to */
81
 
    uint8_t pad0;
82
 
 
83
 
    uint8_t cur_content_type;
 
85
    /* offset of the beginning of the current message (including header) */
 
86
    uint32_t message_start;
 
87
    uint32_t message_length;
 
88
 
 
89
    uint16_t version;
 
90
    uint8_t content_type;
 
91
 
 
92
    uint8_t handshake_type;
84
93
    uint32_t handshake_length;
85
 
    uint16_t handshake_client_hello_ssl_version;
86
 
    uint16_t handshake_server_hello_ssl_version;
 
94
 
87
95
    /* the no of bytes processed in the currently parsed record */
88
96
    uint16_t bytes_processed;
89
97
 
90
 
    uint16_t cur_ssl_version;
91
 
    uint8_t handshake_type;
92
 
 
93
98
    /* sslv2 client hello session id length */
94
99
    uint16_t session_id_length;
 
100
 
 
101
    char *cert0_subject;
 
102
    char *cert0_issuerdn;
 
103
 
 
104
    /* buffer for the tls record.
 
105
     * We use a malloced buffer, if the record is fragmented */
 
106
    uint8_t *trec;
 
107
    uint16_t trec_len;
 
108
    uint16_t trec_pos;
 
109
} SSLStateConnp;
 
110
 
 
111
/**
 
112
 * \brief SSLv[2.0|3.[0|1|2|3]] state structure.
 
113
 *
 
114
 *        Structure to store the SSL state values.
 
115
 */
 
116
typedef struct SSLState_ {
 
117
    Flow *f;
 
118
 
 
119
    /* holds some state flags we need */
 
120
    uint32_t flags;
 
121
 
 
122
    SSLStateConnp *curr_connp;
 
123
 
 
124
    SSLStateConnp client_connp;
 
125
    SSLStateConnp server_connp;
95
126
} SSLState;
96
127
 
97
128
void RegisterSSLParsers(void);