Home | History | Annotate | Download | only in ssl

Lines Matching refs:SSL

59  * This package is an SSL implementation written
61 * The implementation was written so as to conform with Netscapes SSL.
66 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
112 #include <openssl/ssl.h>
129 int dtls1_get_record(SSL *ssl) {
131 switch (ssl->s3->recv_shutdown) {
135 OPENSSL_PUT_ERROR(SSL, SSL_R_PROTOCOL_IS_SHUTDOWN);
142 if (ssl_read_buffer_len(ssl) == 0) {
143 int read_ret = ssl_read_buffer_extend_to(ssl, 0 /* unused */);
144 if (read_ret < 0 && dtls1_is_timer_expired(ssl)) {
150 int timeout_ret = DTLSv1_handle_timeout(ssl);
160 assert(ssl_read_buffer_len(ssl) > 0);
166 dtls_open_record(ssl, &type, &body, &consumed, &alert,
167 ssl_read_buffer(ssl), ssl_read_buffer_len(ssl));
168 ssl_read_buffer_consume(ssl, consumed);
176 OPENSSL_PUT_ERROR(SSL, ERR_R_OVERFLOW);
180 SSL3_RECORD *rr = &ssl->s3->rrec;
197 ssl3_send_alert(ssl, SSL3_AL_FATAL, alert);
202 OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
206 int dtls1_read_app_data(SSL *ssl, int *out_got_handshake, uint8_t *buf, int len,
208 assert(!SSL_in_init(ssl));
211 SSL3_RECORD *rr = &ssl->s3->rrec;
215 int ret = dtls1_get_record(ssl);
229 ssl3_send_alert(ssl, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);
230 OPENSSL_PUT_ERROR(SSL, SSL_R_BAD_HANDSHAKE_RECORD);
235 msg_hdr.seq == ssl->d1->handshake_read_seq - 1) {
240 if (dtls1_check_timeout_num(ssl) < 0) {
244 dtls1_retransmit_outgoing_messages(ssl);
256 ssl3_send_alert(ssl, SSL3_AL_FATAL, SSL_AD_UNEXPECTED_MESSAGE);
257 OPENSSL_PUT_ERROR(SSL, SSL_R_UNEXPECTED_RECORD);
282 ssl_read_buffer_discard(ssl);
289 int dtls1_read_change_cipher_spec(SSL *ssl) {
290 SSL3_RECORD *rr = &ssl->s3->rrec;
294 int ret = dtls1_get_record(ssl);
310 ssl3_send_alert(ssl, SSL3_AL_FATAL, SSL_AD_UNEXPECTED_MESSAGE);
311 OPENSSL_PUT_ERROR(SSL, SSL_R_UNEXPECTED_RECORD);
316 OPENSSL_PUT_ERROR(SSL, SSL_R_BAD_CHANGE_CIPHER_SPEC);
317 ssl3_send_alert(ssl, SSL3_AL_FATAL, SSL_AD_ILLEGAL_PARAMETER);
321 ssl_do_msg_callback(ssl, 0 /* read */, SSL3_RT_CHANGE_CIPHER_SPEC, rr->data,
325 ssl_read_buffer_discard(ssl);
329 void dtls1_read_close_notify(SSL *ssl) {
334 if (ssl->s3->recv_shutdown == ssl_shutdown_none) {
335 ssl->s3->recv_shutdown = ssl_shutdown_close_notify;
339 int dtls1_write_app_data(SSL *ssl, int *out_needs_handshake, const uint8_t *buf,
341 assert(!SSL_in_init(ssl));
345 OPENSSL_PUT_ERROR(SSL, SSL_R_DTLS_MESSAGE_TOO_BIG);
350 OPENSSL_PUT_ERROR(SSL, SSL_R_BAD_LENGTH);
358 int ret = dtls1_write_record(ssl, SSL3_RT_APPLICATION_DATA, buf, (size_t)len,
366 int dtls1_write_record(SSL *ssl, int type, const uint8_t *buf, size_t len,
372 assert(!ssl_write_buffer_is_pending(ssl));
375 OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
379 size_t max_out = len + SSL_max_seal_overhead(ssl);
382 if (!ssl_write_buffer_init(ssl, &out, max_out) ||
383 !dtls_seal_record(ssl, out, &ciphertext_len, max_out, type, buf, len,
385 ssl_write_buffer_clear(ssl);
388 ssl_write_buffer_set_len(ssl, ciphertext_len);
390 int ret = ssl_write_buffer_flush(ssl);
397 int dtls1_dispatch_alert(SSL *ssl) {
398 int ret = dtls1_write_record(ssl, SSL3_RT_ALERT, &ssl->s3->send_alert[0], 2,
403 ssl->s3->alert_dispatch = 0;
406 if (ssl->s3->send_alert[0] == SSL3_AL_FATAL) {
407 BIO_flush(ssl->wbio);
410 ssl_do_msg_callback(ssl, 1 /* write */, SSL3_RT_ALERT, ssl->s3->send_alert,
413 int alert = (ssl->s3->send_alert[0] << 8) | ssl->s3->send_alert[1];
414 ssl_do_info_callback(ssl, SSL_CB_WRITE_ALERT, alert);