~ubuntu-branches/ubuntu/oneiric/openssl/oneiric-security

« back to all changes in this revision

Viewing changes to ssl/d1_lib.c

  • Committer: Package Import Robot
  • Author(s): Steve Beattie
  • Date: 2011-09-14 22:06:03 UTC
  • mfrom: (11.1.23 sid)
  • Revision ID: package-import@ubuntu.com-20110914220603-tsuxw8z3kt4lx9oc
Tags: 1.0.0e-2ubuntu1
* Resynchronise with Debian, fixes CVE-2011-1945, CVE-2011-3207 and
  CVE-2011-3210 (LP: #850608). Remaining changes:
  - debian/libssl1.0.0.postinst:
    + Display a system restart required notification bubble on libssl1.0.0
      upgrade.
    + Use a different priority for libssl1.0.0/restart-services depending
      on whether a desktop, or server dist-upgrade is being performed.
  - debian/{libssl1.0.0-udeb.dirs, control, rules}: Create
    libssl1.0.0-udeb, for the benefit of wget-udeb (no wget-udeb package
    in Debian).
  - debian/{libcrypto1.0.0-udeb.dirs, libssl1.0.0.dirs, libssl1.0.0.files,
    rules}: Move runtime libraries to /lib, for the benefit of
    wpasupplicant.
  - debian/patches/aesni.patch: Backport Intel AES-NI support, now from
    http://rt.openssl.org/Ticket/Display.html?id=2065 rather than the
    0.9.8 variant.
  - debian/patches/Bsymbolic-functions.patch: Link using
    -Bsymbolic-functions.
  - debian/patches/perlpath-quilt.patch: Don't change perl #! paths under
    .pc.
  - debian/rules:
    + Don't run 'make test' when cross-building.
    + Use host compiler when cross-building.  Patch from Neil Williams.
    + Don't build for processors no longer supported: i486, i586 (on
      i386), v8 (on sparc).
    + Fix Makefile to properly clean up libs/ dirs in clean target.
    + Replace duplicate files in the doc directory with symlinks.
* debian/libssl1.0.0.postinst: only display restart notification on
  servers (LP: #244250)

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
        return(1);
130
130
        }
131
131
 
132
 
void dtls1_free(SSL *s)
 
132
static void dtls1_clear_queues(SSL *s)
133
133
        {
134
134
    pitem *item = NULL;
135
135
    hm_fragment *frag = NULL;
136
 
 
137
 
        ssl3_free(s);
 
136
        DTLS1_RECORD_DATA *rdata;
138
137
 
139
138
    while( (item = pqueue_pop(s->d1->unprocessed_rcds.q)) != NULL)
140
139
        {
 
140
                rdata = (DTLS1_RECORD_DATA *) item->data;
 
141
                if (rdata->rbuf.buf)
 
142
                        {
 
143
                        OPENSSL_free(rdata->rbuf.buf);
 
144
                        }
141
145
        OPENSSL_free(item->data);
142
146
        pitem_free(item);
143
147
        }
144
 
    pqueue_free(s->d1->unprocessed_rcds.q);
145
148
 
146
149
    while( (item = pqueue_pop(s->d1->processed_rcds.q)) != NULL)
147
150
        {
 
151
                rdata = (DTLS1_RECORD_DATA *) item->data;
 
152
                if (rdata->rbuf.buf)
 
153
                        {
 
154
                        OPENSSL_free(rdata->rbuf.buf);
 
155
                        }
148
156
        OPENSSL_free(item->data);
149
157
        pitem_free(item);
150
158
        }
151
 
    pqueue_free(s->d1->processed_rcds.q);
152
159
 
153
160
    while( (item = pqueue_pop(s->d1->buffered_messages)) != NULL)
154
161
        {
157
164
        OPENSSL_free(frag);
158
165
        pitem_free(item);
159
166
        }
160
 
    pqueue_free(s->d1->buffered_messages);
161
167
 
162
168
    while ( (item = pqueue_pop(s->d1->sent_messages)) != NULL)
163
169
        {
166
172
        OPENSSL_free(frag);
167
173
        pitem_free(item);
168
174
        }
169
 
        pqueue_free(s->d1->sent_messages);
170
175
 
171
176
        while ( (item = pqueue_pop(s->d1->buffered_app_data.q)) != NULL)
172
177
                {
175
180
                OPENSSL_free(frag);
176
181
                pitem_free(item);
177
182
                }
 
183
        }
 
184
 
 
185
void dtls1_free(SSL *s)
 
186
        {
 
187
        ssl3_free(s);
 
188
 
 
189
        dtls1_clear_queues(s);
 
190
 
 
191
    pqueue_free(s->d1->unprocessed_rcds.q);
 
192
    pqueue_free(s->d1->processed_rcds.q);
 
193
    pqueue_free(s->d1->buffered_messages);
 
194
        pqueue_free(s->d1->sent_messages);
178
195
        pqueue_free(s->d1->buffered_app_data.q);
179
196
 
180
197
        OPENSSL_free(s->d1);
182
199
 
183
200
void dtls1_clear(SSL *s)
184
201
        {
 
202
    pqueue unprocessed_rcds;
 
203
    pqueue processed_rcds;
 
204
    pqueue buffered_messages;
 
205
        pqueue sent_messages;
 
206
        pqueue buffered_app_data;
 
207
        
 
208
        if (s->d1)
 
209
                {
 
210
                unprocessed_rcds = s->d1->unprocessed_rcds.q;
 
211
                processed_rcds = s->d1->processed_rcds.q;
 
212
                buffered_messages = s->d1->buffered_messages;
 
213
                sent_messages = s->d1->sent_messages;
 
214
                buffered_app_data = s->d1->buffered_app_data.q;
 
215
 
 
216
                dtls1_clear_queues(s);
 
217
 
 
218
                memset(s->d1, 0, sizeof(*(s->d1)));
 
219
 
 
220
                if (s->server)
 
221
                        {
 
222
                        s->d1->cookie_len = sizeof(s->d1->cookie);
 
223
                        }
 
224
 
 
225
                s->d1->unprocessed_rcds.q = unprocessed_rcds;
 
226
                s->d1->processed_rcds.q = processed_rcds;
 
227
                s->d1->buffered_messages = buffered_messages;
 
228
                s->d1->sent_messages = sent_messages;
 
229
                s->d1->buffered_app_data.q = buffered_app_data;
 
230
                }
 
231
 
185
232
        ssl3_clear(s);
186
233
        if (s->options & SSL_OP_CISCO_ANYCONNECT)
187
234
                s->version=DTLS1_BAD_VER;
330
377
        memset(&(s->d1->next_timeout), 0, sizeof(struct timeval));
331
378
        s->d1->timeout_duration = 1;
332
379
        BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT, 0, &(s->d1->next_timeout));
 
380
        /* Clear retransmission buffer */
 
381
        dtls1_clear_record_buffer(s);
333
382
        }
334
383
 
335
384
int dtls1_handle_timeout(SSL *s)
349
398
                {
350
399
                /* fail the connection, enough alerts have been sent */
351
400
                SSLerr(SSL_F_DTLS1_HANDLE_TIMEOUT,SSL_R_READ_TIMEOUT_EXPIRED);
352
 
                return 0;
 
401
                return -1;
353
402
                }
354
403
 
355
404
        state->timeout.read_timeouts++;