summaryrefslogtreecommitdiff
path: root/src/lib/libssl/s23_pkt.c
diff options
context:
space:
mode:
authorjsing <>2014-04-14 15:15:33 +0000
committerjsing <>2014-04-14 15:15:33 +0000
commit30f92658fa4e1357cfcee9c077a21e928970d290 (patch)
tree225d880512d3748d996f5d84d5d01521efe52b02 /src/lib/libssl/s23_pkt.c
parent6c233db50b8fc1d31e373868a83572c35271ca51 (diff)
downloadopenbsd-30f92658fa4e1357cfcee9c077a21e928970d290.tar.gz
openbsd-30f92658fa4e1357cfcee9c077a21e928970d290.tar.bz2
openbsd-30f92658fa4e1357cfcee9c077a21e928970d290.zip
First pass at applying KNF to the OpenSSL code, which almost makes it
readable. This pass is whitespace only and can readily be verified using tr and md5.
Diffstat (limited to 'src/lib/libssl/s23_pkt.c')
-rw-r--r--src/lib/libssl/s23_pkt.c74
1 files changed, 36 insertions, 38 deletions
diff --git a/src/lib/libssl/s23_pkt.c b/src/lib/libssl/s23_pkt.c
index eba8d9d8fc..28d07a2212 100644
--- a/src/lib/libssl/s23_pkt.c
+++ b/src/lib/libssl/s23_pkt.c
@@ -62,55 +62,53 @@
62#include <openssl/evp.h> 62#include <openssl/evp.h>
63#include <openssl/buffer.h> 63#include <openssl/buffer.h>
64 64
65int ssl23_write_bytes(SSL *s) 65int
66 { 66ssl23_write_bytes(SSL *s)
67 int i,num,tot; 67{
68 int i, num, tot;
68 char *buf; 69 char *buf;
69 70
70 buf=s->init_buf->data; 71 buf = s->init_buf->data;
71 tot=s->init_off; 72 tot = s->init_off;
72 num=s->init_num; 73 num = s->init_num;
73 for (;;) 74 for (;;) {
74 { 75 s->rwstate = SSL_WRITING;
75 s->rwstate=SSL_WRITING; 76 i = BIO_write(s->wbio, &(buf[tot]), num);
76 i=BIO_write(s->wbio,&(buf[tot]),num); 77 if (i <= 0) {
77 if (i <= 0) 78 s->init_off = tot;
78 { 79 s->init_num = num;
79 s->init_off=tot; 80 return (i);
80 s->init_num=num;
81 return(i);
82 }
83 s->rwstate=SSL_NOTHING;
84 if (i == num) return(tot+i);
85
86 num-=i;
87 tot+=i;
88 } 81 }
82 s->rwstate = SSL_NOTHING;
83 if (i == num)
84 return (tot + i);
85
86 num -= i;
87 tot += i;
89 } 88 }
89}
90 90
91/* return regularly only when we have read (at least) 'n' bytes */ 91/* return regularly only when we have read (at least) 'n' bytes */
92int ssl23_read_bytes(SSL *s, int n) 92int
93 { 93ssl23_read_bytes(SSL *s, int n)
94{
94 unsigned char *p; 95 unsigned char *p;
95 int j; 96 int j;
96 97
97 if (s->packet_length < (unsigned int)n) 98 if (s->packet_length < (unsigned int)n) {
98 { 99 p = s->packet;
99 p=s->packet;
100 100
101 for (;;) 101 for (;;) {
102 { 102 s->rwstate = SSL_READING;
103 s->rwstate=SSL_READING; 103 j = BIO_read(s->rbio,(char *)&(p[s->packet_length]),
104 j=BIO_read(s->rbio,(char *)&(p[s->packet_length]), 104 n - s->packet_length);
105 n-s->packet_length);
106 if (j <= 0) 105 if (j <= 0)
107 return(j); 106 return (j);
108 s->rwstate=SSL_NOTHING; 107 s->rwstate = SSL_NOTHING;
109 s->packet_length+=j; 108 s->packet_length += j;
110 if (s->packet_length >= (unsigned int)n) 109 if (s->packet_length >= (unsigned int)n)
111 return(s->packet_length); 110 return (s->packet_length);
112 }
113 } 111 }
114 return(n);
115 } 112 }
116 113 return (n);
114}