summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bio/bf_null.c
diff options
context:
space:
mode:
authormarkus <>2002-09-05 12:51:50 +0000
committermarkus <>2002-09-05 12:51:50 +0000
commit15b5d84f9da2ce4bfae8580e56e34a859f74ad71 (patch)
treebf939e82d7fd73cc8a01cf6959002209972091bc /src/lib/libcrypto/bio/bf_null.c
parent027351f729b9e837200dae6e1520cda6577ab930 (diff)
downloadopenbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.tar.gz
openbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.tar.bz2
openbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.zip
import openssl-0.9.7-beta1
Diffstat (limited to 'src/lib/libcrypto/bio/bf_null.c')
-rw-r--r--src/lib/libcrypto/bio/bf_null.c73
1 files changed, 30 insertions, 43 deletions
diff --git a/src/lib/libcrypto/bio/bf_null.c b/src/lib/libcrypto/bio/bf_null.c
index a47a65741a..c1bf39a904 100644
--- a/src/lib/libcrypto/bio/bf_null.c
+++ b/src/lib/libcrypto/bio/bf_null.c
@@ -59,30 +59,19 @@
59#include <stdio.h> 59#include <stdio.h>
60#include <errno.h> 60#include <errno.h>
61#include "cryptlib.h" 61#include "cryptlib.h"
62#include "bio.h" 62#include <openssl/bio.h>
63#include "evp.h"
64 63
65/* BIO_put and BIO_get both add to the digest, 64/* BIO_put and BIO_get both add to the digest,
66 * BIO_gets returns the digest */ 65 * BIO_gets returns the digest */
67 66
68#ifndef NOPROTO 67static int nullf_write(BIO *h, const char *buf, int num);
69static int nullf_write(BIO *h,char *buf,int num); 68static int nullf_read(BIO *h, char *buf, int size);
70static int nullf_read(BIO *h,char *buf,int size); 69static int nullf_puts(BIO *h, const char *str);
71static int nullf_puts(BIO *h,char *str); 70static int nullf_gets(BIO *h, char *str, int size);
72static int nullf_gets(BIO *h,char *str,int size); 71static long nullf_ctrl(BIO *h, int cmd, long arg1, void *arg2);
73static long nullf_ctrl(BIO *h,int cmd,long arg1,char *arg2);
74static int nullf_new(BIO *h); 72static int nullf_new(BIO *h);
75static int nullf_free(BIO *data); 73static int nullf_free(BIO *data);
76#else 74static long nullf_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
77static int nullf_write();
78static int nullf_read();
79static int nullf_puts();
80static int nullf_gets();
81static long nullf_ctrl();
82static int nullf_new();
83static int nullf_free();
84#endif
85
86static BIO_METHOD methods_nullf= 75static BIO_METHOD methods_nullf=
87 { 76 {
88 BIO_TYPE_NULL_FILTER, 77 BIO_TYPE_NULL_FILTER,
@@ -94,15 +83,15 @@ static BIO_METHOD methods_nullf=
94 nullf_ctrl, 83 nullf_ctrl,
95 nullf_new, 84 nullf_new,
96 nullf_free, 85 nullf_free,
86 nullf_callback_ctrl,
97 }; 87 };
98 88
99BIO_METHOD *BIO_f_null() 89BIO_METHOD *BIO_f_null(void)
100 { 90 {
101 return(&methods_nullf); 91 return(&methods_nullf);
102 } 92 }
103 93
104static int nullf_new(bi) 94static int nullf_new(BIO *bi)
105BIO *bi;
106 { 95 {
107 bi->init=1; 96 bi->init=1;
108 bi->ptr=NULL; 97 bi->ptr=NULL;
@@ -110,8 +99,7 @@ BIO *bi;
110 return(1); 99 return(1);
111 } 100 }
112 101
113static int nullf_free(a) 102static int nullf_free(BIO *a)
114BIO *a;
115 { 103 {
116 if (a == NULL) return(0); 104 if (a == NULL) return(0);
117/* a->ptr=NULL; 105/* a->ptr=NULL;
@@ -120,10 +108,7 @@ BIO *a;
120 return(1); 108 return(1);
121 } 109 }
122 110
123static int nullf_read(b,out,outl) 111static int nullf_read(BIO *b, char *out, int outl)
124BIO *b;
125char *out;
126int outl;
127 { 112 {
128 int ret=0; 113 int ret=0;
129 114
@@ -135,10 +120,7 @@ int outl;
135 return(ret); 120 return(ret);
136 } 121 }
137 122
138static int nullf_write(b,in,inl) 123static int nullf_write(BIO *b, const char *in, int inl)
139BIO *b;
140char *in;
141int inl;
142 { 124 {
143 int ret=0; 125 int ret=0;
144 126
@@ -150,11 +132,7 @@ int inl;
150 return(ret); 132 return(ret);
151 } 133 }
152 134
153static long nullf_ctrl(b,cmd,num,ptr) 135static long nullf_ctrl(BIO *b, int cmd, long num, void *ptr)
154BIO *b;
155int cmd;
156long num;
157char *ptr;
158 { 136 {
159 long ret; 137 long ret;
160 138
@@ -175,19 +153,28 @@ char *ptr;
175 return(ret); 153 return(ret);
176 } 154 }
177 155
178static int nullf_gets(bp,buf,size) 156static long nullf_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
179BIO *bp; 157 {
180char *buf; 158 long ret=1;
181int size; 159
160 if (b->next_bio == NULL) return(0);
161 switch (cmd)
162 {
163 default:
164 ret=BIO_callback_ctrl(b->next_bio,cmd,fp);
165 break;
166 }
167 return(ret);
168 }
169
170static int nullf_gets(BIO *bp, char *buf, int size)
182 { 171 {
183 if (bp->next_bio == NULL) return(0); 172 if (bp->next_bio == NULL) return(0);
184 return(BIO_gets(bp->next_bio,buf,size)); 173 return(BIO_gets(bp->next_bio,buf,size));
185 } 174 }
186 175
187 176
188static int nullf_puts(bp,str) 177static int nullf_puts(BIO *bp, const char *str)
189BIO *bp;
190char *str;
191 { 178 {
192 if (bp->next_bio == NULL) return(0); 179 if (bp->next_bio == NULL) return(0);
193 return(BIO_puts(bp->next_bio,str)); 180 return(BIO_puts(bp->next_bio,str));