diff options
| author | jsing <> | 2015-09-12 19:45:16 +0000 |
|---|---|---|
| committer | jsing <> | 2015-09-12 19:45:16 +0000 |
| commit | b954557fa19488dbfb1b2a641b808d7554d1f845 (patch) | |
| tree | 502b924f80d5379a0c5ff0fdb93aa9d94bba0e45 /src/lib/libssl/ssl_lib.c | |
| parent | 4ba4f1781a267e49f79cabb109294a61d12f84a0 (diff) | |
| download | openbsd-b954557fa19488dbfb1b2a641b808d7554d1f845.tar.gz openbsd-b954557fa19488dbfb1b2a641b808d7554d1f845.tar.bz2 openbsd-b954557fa19488dbfb1b2a641b808d7554d1f845.zip | |
Unwrap a bunch of lines.
Diffstat (limited to 'src/lib/libssl/ssl_lib.c')
| -rw-r--r-- | src/lib/libssl/ssl_lib.c | 56 |
1 files changed, 19 insertions, 37 deletions
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c index 660ff99e27..b772f5f810 100644 --- a/src/lib/libssl/ssl_lib.c +++ b/src/lib/libssl/ssl_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_lib.c,v 1.111 2015/09/12 16:10:07 doug Exp $ */ | 1 | /* $OpenBSD: ssl_lib.c,v 1.112 2015/09/12 19:45:16 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -266,13 +266,11 @@ SSL_new(SSL_CTX *ctx) | |||
| 266 | SSL *s; | 266 | SSL *s; |
| 267 | 267 | ||
| 268 | if (ctx == NULL) { | 268 | if (ctx == NULL) { |
| 269 | SSLerr(SSL_F_SSL_NEW, | 269 | SSLerr(SSL_F_SSL_NEW, SSL_R_NULL_SSL_CTX); |
| 270 | SSL_R_NULL_SSL_CTX); | ||
| 271 | return (NULL); | 270 | return (NULL); |
| 272 | } | 271 | } |
| 273 | if (ctx->method == NULL) { | 272 | if (ctx->method == NULL) { |
| 274 | SSLerr(SSL_F_SSL_NEW, | 273 | SSLerr(SSL_F_SSL_NEW, SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION); |
| 275 | SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION); | ||
| 276 | return (NULL); | 274 | return (NULL); |
| 277 | } | 275 | } |
| 278 | 276 | ||
| @@ -370,8 +368,7 @@ err: | |||
| 370 | SSL_CTX_free(s->ctx); /* decrement reference count */ | 368 | SSL_CTX_free(s->ctx); /* decrement reference count */ |
| 371 | free(s); | 369 | free(s); |
| 372 | } | 370 | } |
| 373 | SSLerr(SSL_F_SSL_NEW, | 371 | SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE); |
| 374 | ERR_R_MALLOC_FAILURE); | ||
| 375 | return (NULL); | 372 | return (NULL); |
| 376 | } | 373 | } |
| 377 | 374 | ||
| @@ -640,8 +637,7 @@ SSL_set_fd(SSL *s, int fd) | |||
| 640 | bio = BIO_new(BIO_s_socket()); | 637 | bio = BIO_new(BIO_s_socket()); |
| 641 | 638 | ||
| 642 | if (bio == NULL) { | 639 | if (bio == NULL) { |
| 643 | SSLerr(SSL_F_SSL_SET_FD, | 640 | SSLerr(SSL_F_SSL_SET_FD, ERR_R_BUF_LIB); |
| 644 | ERR_R_BUF_LIB); | ||
| 645 | goto err; | 641 | goto err; |
| 646 | } | 642 | } |
| 647 | BIO_set_fd(bio, fd, BIO_NOCLOSE); | 643 | BIO_set_fd(bio, fd, BIO_NOCLOSE); |
| @@ -662,8 +658,7 @@ SSL_set_wfd(SSL *s, int fd) | |||
| 662 | bio = BIO_new(BIO_s_socket()); | 658 | bio = BIO_new(BIO_s_socket()); |
| 663 | 659 | ||
| 664 | if (bio == NULL) { | 660 | if (bio == NULL) { |
| 665 | SSLerr(SSL_F_SSL_SET_WFD, | 661 | SSLerr(SSL_F_SSL_SET_WFD, ERR_R_BUF_LIB); |
| 666 | ERR_R_BUF_LIB); | ||
| 667 | goto err; | 662 | goto err; |
| 668 | } | 663 | } |
| 669 | BIO_set_fd(bio, fd, BIO_NOCLOSE); | 664 | BIO_set_fd(bio, fd, BIO_NOCLOSE); |
| @@ -686,8 +681,7 @@ SSL_set_rfd(SSL *s, int fd) | |||
| 686 | bio = BIO_new(BIO_s_socket()); | 681 | bio = BIO_new(BIO_s_socket()); |
| 687 | 682 | ||
| 688 | if (bio == NULL) { | 683 | if (bio == NULL) { |
| 689 | SSLerr(SSL_F_SSL_SET_RFD, | 684 | SSLerr(SSL_F_SSL_SET_RFD, ERR_R_BUF_LIB); |
| 690 | ERR_R_BUF_LIB); | ||
| 691 | goto err; | 685 | goto err; |
| 692 | } | 686 | } |
| 693 | BIO_set_fd(bio, fd, BIO_NOCLOSE); | 687 | BIO_set_fd(bio, fd, BIO_NOCLOSE); |
| @@ -952,8 +946,7 @@ int | |||
| 952 | SSL_read(SSL *s, void *buf, int num) | 946 | SSL_read(SSL *s, void *buf, int num) |
| 953 | { | 947 | { |
| 954 | if (s->handshake_func == NULL) { | 948 | if (s->handshake_func == NULL) { |
| 955 | SSLerr(SSL_F_SSL_READ, | 949 | SSLerr(SSL_F_SSL_READ, SSL_R_UNINITIALIZED); |
| 956 | SSL_R_UNINITIALIZED); | ||
| 957 | return (-1); | 950 | return (-1); |
| 958 | } | 951 | } |
| 959 | 952 | ||
| @@ -968,8 +961,7 @@ int | |||
| 968 | SSL_peek(SSL *s, void *buf, int num) | 961 | SSL_peek(SSL *s, void *buf, int num) |
| 969 | { | 962 | { |
| 970 | if (s->handshake_func == NULL) { | 963 | if (s->handshake_func == NULL) { |
| 971 | SSLerr(SSL_F_SSL_PEEK, | 964 | SSLerr(SSL_F_SSL_PEEK, SSL_R_UNINITIALIZED); |
| 972 | SSL_R_UNINITIALIZED); | ||
| 973 | return (-1); | 965 | return (-1); |
| 974 | } | 966 | } |
| 975 | 967 | ||
| @@ -983,15 +975,13 @@ int | |||
| 983 | SSL_write(SSL *s, const void *buf, int num) | 975 | SSL_write(SSL *s, const void *buf, int num) |
| 984 | { | 976 | { |
| 985 | if (s->handshake_func == NULL) { | 977 | if (s->handshake_func == NULL) { |
| 986 | SSLerr(SSL_F_SSL_WRITE, | 978 | SSLerr(SSL_F_SSL_WRITE, SSL_R_UNINITIALIZED); |
| 987 | SSL_R_UNINITIALIZED); | ||
| 988 | return (-1); | 979 | return (-1); |
| 989 | } | 980 | } |
| 990 | 981 | ||
| 991 | if (s->shutdown & SSL_SENT_SHUTDOWN) { | 982 | if (s->shutdown & SSL_SENT_SHUTDOWN) { |
| 992 | s->rwstate = SSL_NOTHING; | 983 | s->rwstate = SSL_NOTHING; |
| 993 | SSLerr(SSL_F_SSL_WRITE, | 984 | SSLerr(SSL_F_SSL_WRITE, SSL_R_PROTOCOL_IS_SHUTDOWN); |
| 994 | SSL_R_PROTOCOL_IS_SHUTDOWN); | ||
| 995 | return (-1); | 985 | return (-1); |
| 996 | } | 986 | } |
| 997 | return (s->method->ssl_write(s, buf, num)); | 987 | return (s->method->ssl_write(s, buf, num)); |
| @@ -1008,8 +998,7 @@ SSL_shutdown(SSL *s) | |||
| 1008 | */ | 998 | */ |
| 1009 | 999 | ||
| 1010 | if (s->handshake_func == NULL) { | 1000 | if (s->handshake_func == NULL) { |
| 1011 | SSLerr(SSL_F_SSL_SHUTDOWN, | 1001 | SSLerr(SSL_F_SSL_SHUTDOWN, SSL_R_UNINITIALIZED); |
| 1012 | SSL_R_UNINITIALIZED); | ||
| 1013 | return (-1); | 1002 | return (-1); |
| 1014 | } | 1003 | } |
| 1015 | 1004 | ||
| @@ -1319,8 +1308,7 @@ SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) | |||
| 1319 | if (sk == NULL) | 1308 | if (sk == NULL) |
| 1320 | return (0); | 1309 | return (0); |
| 1321 | else if (sk_SSL_CIPHER_num(sk) == 0) { | 1310 | else if (sk_SSL_CIPHER_num(sk) == 0) { |
| 1322 | SSLerr(SSL_F_SSL_CTX_SET_CIPHER_LIST, | 1311 | SSLerr(SSL_F_SSL_CTX_SET_CIPHER_LIST, SSL_R_NO_CIPHER_MATCH); |
| 1323 | SSL_R_NO_CIPHER_MATCH); | ||
| 1324 | return (0); | 1312 | return (0); |
| 1325 | } | 1313 | } |
| 1326 | return (1); | 1314 | return (1); |
| @@ -1338,8 +1326,7 @@ SSL_set_cipher_list(SSL *s, const char *str) | |||
| 1338 | if (sk == NULL) | 1326 | if (sk == NULL) |
| 1339 | return (0); | 1327 | return (0); |
| 1340 | else if (sk_SSL_CIPHER_num(sk) == 0) { | 1328 | else if (sk_SSL_CIPHER_num(sk) == 0) { |
| 1341 | SSLerr(SSL_F_SSL_SET_CIPHER_LIST, | 1329 | SSLerr(SSL_F_SSL_SET_CIPHER_LIST, SSL_R_NO_CIPHER_MATCH); |
| 1342 | SSL_R_NO_CIPHER_MATCH); | ||
| 1343 | return (0); | 1330 | return (0); |
| 1344 | } | 1331 | } |
| 1345 | return (1); | 1332 | return (1); |
| @@ -1784,8 +1771,7 @@ SSL_CTX_new(const SSL_METHOD *meth) | |||
| 1784 | SSL_CTX *ret = NULL; | 1771 | SSL_CTX *ret = NULL; |
| 1785 | 1772 | ||
| 1786 | if (meth == NULL) { | 1773 | if (meth == NULL) { |
| 1787 | SSLerr(SSL_F_SSL_CTX_NEW, | 1774 | SSLerr(SSL_F_SSL_CTX_NEW, SSL_R_NULL_SSL_METHOD_PASSED); |
| 1788 | SSL_R_NULL_SSL_METHOD_PASSED); | ||
| 1789 | return (NULL); | 1775 | return (NULL); |
| 1790 | } | 1776 | } |
| 1791 | 1777 | ||
| @@ -1851,8 +1837,7 @@ SSL_CTX_new(const SSL_METHOD *meth) | |||
| 1851 | &ret->cipher_list_by_id, SSL_DEFAULT_CIPHER_LIST); | 1837 | &ret->cipher_list_by_id, SSL_DEFAULT_CIPHER_LIST); |
| 1852 | if (ret->cipher_list == NULL || | 1838 | if (ret->cipher_list == NULL || |
| 1853 | sk_SSL_CIPHER_num(ret->cipher_list) <= 0) { | 1839 | sk_SSL_CIPHER_num(ret->cipher_list) <= 0) { |
| 1854 | SSLerr(SSL_F_SSL_CTX_NEW, | 1840 | SSLerr(SSL_F_SSL_CTX_NEW, SSL_R_LIBRARY_HAS_NO_CIPHERS); |
| 1855 | SSL_R_LIBRARY_HAS_NO_CIPHERS); | ||
| 1856 | goto err2; | 1841 | goto err2; |
| 1857 | } | 1842 | } |
| 1858 | 1843 | ||
| @@ -1924,8 +1909,7 @@ SSL_CTX_new(const SSL_METHOD *meth) | |||
| 1924 | 1909 | ||
| 1925 | return (ret); | 1910 | return (ret); |
| 1926 | err: | 1911 | err: |
| 1927 | SSLerr(SSL_F_SSL_CTX_NEW, | 1912 | SSLerr(SSL_F_SSL_CTX_NEW, ERR_R_MALLOC_FAILURE); |
| 1928 | ERR_R_MALLOC_FAILURE); | ||
| 1929 | err2: | 1913 | err2: |
| 1930 | SSL_CTX_free(ret); | 1914 | SSL_CTX_free(ret); |
| 1931 | return (NULL); | 1915 | return (NULL); |
| @@ -2463,8 +2447,7 @@ SSL_do_handshake(SSL *s) | |||
| 2463 | int ret = 1; | 2447 | int ret = 1; |
| 2464 | 2448 | ||
| 2465 | if (s->handshake_func == NULL) { | 2449 | if (s->handshake_func == NULL) { |
| 2466 | SSLerr(SSL_F_SSL_DO_HANDSHAKE, | 2450 | SSLerr(SSL_F_SSL_DO_HANDSHAKE, SSL_R_CONNECTION_TYPE_NOT_SET); |
| 2467 | SSL_R_CONNECTION_TYPE_NOT_SET); | ||
| 2468 | return (-1); | 2451 | return (-1); |
| 2469 | } | 2452 | } |
| 2470 | 2453 | ||
| @@ -2790,8 +2773,7 @@ ssl_init_wbio_buffer(SSL *s, int push) | |||
| 2790 | (void)BIO_reset(bbio); | 2773 | (void)BIO_reset(bbio); |
| 2791 | /* if (!BIO_set_write_buffer_size(bbio,16*1024)) */ | 2774 | /* if (!BIO_set_write_buffer_size(bbio,16*1024)) */ |
| 2792 | if (!BIO_set_read_buffer_size(bbio, 1)) { | 2775 | if (!BIO_set_read_buffer_size(bbio, 1)) { |
| 2793 | SSLerr(SSL_F_SSL_INIT_WBIO_BUFFER, | 2776 | SSLerr(SSL_F_SSL_INIT_WBIO_BUFFER, ERR_R_BUF_LIB); |
| 2794 | ERR_R_BUF_LIB); | ||
| 2795 | return (0); | 2777 | return (0); |
| 2796 | } | 2778 | } |
| 2797 | if (push) { | 2779 | if (push) { |
