diff options
author | jsing <> | 2014-04-15 16:37:22 +0000 |
---|---|---|
committer | jsing <> | 2014-04-15 16:37:22 +0000 |
commit | bb63ff2d125e51688213d0af9e4f785cf3865063 (patch) | |
tree | 41dd30d546977ed0c409d7de59564fa1a2e3b100 /src/lib/libcrypto/bio/bf_null.c | |
parent | 90b03b7785bece7b16c6a38b7db633fcfdd9ecf4 (diff) | |
download | openbsd-bb63ff2d125e51688213d0af9e4f785cf3865063.tar.gz openbsd-bb63ff2d125e51688213d0af9e4f785cf3865063.tar.bz2 openbsd-bb63ff2d125e51688213d0af9e4f785cf3865063.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/libcrypto/bio/bf_null.c')
-rw-r--r-- | src/lib/libcrypto/bio/bf_null.c | 167 |
1 files changed, 90 insertions, 77 deletions
diff --git a/src/lib/libcrypto/bio/bf_null.c b/src/lib/libcrypto/bio/bf_null.c index c1bf39a904..354731c0c7 100644 --- a/src/lib/libcrypto/bio/bf_null.c +++ b/src/lib/libcrypto/bio/bf_null.c | |||
@@ -72,8 +72,8 @@ static long nullf_ctrl(BIO *h, int cmd, long arg1, void *arg2); | |||
72 | static int nullf_new(BIO *h); | 72 | static int nullf_new(BIO *h); |
73 | static int nullf_free(BIO *data); | 73 | static int nullf_free(BIO *data); |
74 | static long nullf_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp); | 74 | static long nullf_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp); |
75 | static BIO_METHOD methods_nullf= | 75 | |
76 | { | 76 | static BIO_METHOD methods_nullf = { |
77 | BIO_TYPE_NULL_FILTER, | 77 | BIO_TYPE_NULL_FILTER, |
78 | "NULL filter", | 78 | "NULL filter", |
79 | nullf_write, | 79 | nullf_write, |
@@ -84,100 +84,113 @@ static BIO_METHOD methods_nullf= | |||
84 | nullf_new, | 84 | nullf_new, |
85 | nullf_free, | 85 | nullf_free, |
86 | nullf_callback_ctrl, | 86 | nullf_callback_ctrl, |
87 | }; | 87 | }; |
88 | 88 | ||
89 | BIO_METHOD *BIO_f_null(void) | 89 | BIO_METHOD |
90 | { | 90 | *BIO_f_null(void) |
91 | return(&methods_nullf); | 91 | { |
92 | } | 92 | return (&methods_nullf); |
93 | 93 | } | |
94 | static int nullf_new(BIO *bi) | 94 | |
95 | { | 95 | static int |
96 | bi->init=1; | 96 | nullf_new(BIO *bi) |
97 | bi->ptr=NULL; | 97 | { |
98 | bi->flags=0; | 98 | bi->init = 1; |
99 | return(1); | 99 | bi->ptr = NULL; |
100 | } | 100 | bi->flags = 0; |
101 | 101 | return (1); | |
102 | static int nullf_free(BIO *a) | 102 | } |
103 | { | 103 | |
104 | if (a == NULL) return(0); | 104 | static int |
105 | nullf_free(BIO *a) | ||
106 | { | ||
107 | if (a == NULL) | ||
108 | return (0); | ||
105 | /* a->ptr=NULL; | 109 | /* a->ptr=NULL; |
106 | a->init=0; | 110 | a->init=0; |
107 | a->flags=0;*/ | 111 | a->flags=0;*/ |
108 | return(1); | 112 | return (1); |
109 | } | 113 | } |
110 | 114 | ||
111 | static int nullf_read(BIO *b, char *out, int outl) | 115 | static int |
112 | { | 116 | nullf_read(BIO *b, char *out, int outl) |
113 | int ret=0; | 117 | { |
114 | 118 | int ret = 0; | |
115 | if (out == NULL) return(0); | 119 | |
116 | if (b->next_bio == NULL) return(0); | 120 | if (out == NULL) |
117 | ret=BIO_read(b->next_bio,out,outl); | 121 | return (0); |
122 | if (b->next_bio == NULL) | ||
123 | return (0); | ||
124 | ret = BIO_read(b->next_bio, out, outl); | ||
118 | BIO_clear_retry_flags(b); | 125 | BIO_clear_retry_flags(b); |
119 | BIO_copy_next_retry(b); | 126 | BIO_copy_next_retry(b); |
120 | return(ret); | 127 | return (ret); |
121 | } | 128 | } |
122 | 129 | ||
123 | static int nullf_write(BIO *b, const char *in, int inl) | 130 | static int |
124 | { | 131 | nullf_write(BIO *b, const char *in, int inl) |
125 | int ret=0; | 132 | { |
126 | 133 | int ret = 0; | |
127 | if ((in == NULL) || (inl <= 0)) return(0); | 134 | |
128 | if (b->next_bio == NULL) return(0); | 135 | if ((in == NULL) || (inl <= 0)) |
129 | ret=BIO_write(b->next_bio,in,inl); | 136 | return (0); |
137 | if (b->next_bio == NULL) | ||
138 | return (0); | ||
139 | ret = BIO_write(b->next_bio, in, inl); | ||
130 | BIO_clear_retry_flags(b); | 140 | BIO_clear_retry_flags(b); |
131 | BIO_copy_next_retry(b); | 141 | BIO_copy_next_retry(b); |
132 | return(ret); | 142 | return (ret); |
133 | } | 143 | } |
134 | 144 | ||
135 | static long nullf_ctrl(BIO *b, int cmd, long num, void *ptr) | 145 | static long |
136 | { | 146 | nullf_ctrl(BIO *b, int cmd, long num, void *ptr) |
147 | { | ||
137 | long ret; | 148 | long ret; |
138 | 149 | ||
139 | if (b->next_bio == NULL) return(0); | 150 | if (b->next_bio == NULL) |
140 | switch(cmd) | 151 | return (0); |
141 | { | 152 | switch (cmd) { |
142 | case BIO_C_DO_STATE_MACHINE: | 153 | case BIO_C_DO_STATE_MACHINE: |
143 | BIO_clear_retry_flags(b); | 154 | BIO_clear_retry_flags(b); |
144 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | 155 | ret = BIO_ctrl(b->next_bio, cmd, num, ptr); |
145 | BIO_copy_next_retry(b); | 156 | BIO_copy_next_retry(b); |
146 | break; | 157 | break; |
147 | case BIO_CTRL_DUP: | 158 | case BIO_CTRL_DUP: |
148 | ret=0L; | 159 | ret = 0L; |
149 | break; | 160 | break; |
150 | default: | 161 | default: |
151 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | 162 | ret = BIO_ctrl(b->next_bio, cmd, num, ptr); |
152 | } | ||
153 | return(ret); | ||
154 | } | 163 | } |
164 | return (ret); | ||
165 | } | ||
155 | 166 | ||
156 | static long nullf_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp) | 167 | static long |
157 | { | 168 | nullf_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp) |
158 | long ret=1; | 169 | { |
170 | long ret = 1; | ||
159 | 171 | ||
160 | if (b->next_bio == NULL) return(0); | 172 | if (b->next_bio == NULL) |
161 | switch (cmd) | 173 | return (0); |
162 | { | 174 | switch (cmd) { |
163 | default: | 175 | default: |
164 | ret=BIO_callback_ctrl(b->next_bio,cmd,fp); | 176 | ret = BIO_callback_ctrl(b->next_bio, cmd, fp); |
165 | break; | 177 | break; |
166 | } | ||
167 | return(ret); | ||
168 | } | 178 | } |
169 | 179 | return (ret); | |
170 | static int nullf_gets(BIO *bp, char *buf, int size) | 180 | } |
171 | { | 181 | |
172 | if (bp->next_bio == NULL) return(0); | 182 | static int |
173 | return(BIO_gets(bp->next_bio,buf,size)); | 183 | nullf_gets(BIO *bp, char *buf, int size) |
174 | } | 184 | { |
175 | 185 | if (bp->next_bio == NULL) | |
176 | 186 | return (0); | |
177 | static int nullf_puts(BIO *bp, const char *str) | 187 | return (BIO_gets(bp->next_bio, buf, size)); |
178 | { | 188 | } |
179 | if (bp->next_bio == NULL) return(0); | 189 | |
180 | return(BIO_puts(bp->next_bio,str)); | 190 | static int |
181 | } | 191 | nullf_puts(BIO *bp, const char *str) |
182 | 192 | { | |
183 | 193 | if (bp->next_bio == NULL) | |
194 | return (0); | ||
195 | return (BIO_puts(bp->next_bio, str)); | ||
196 | } | ||