summaryrefslogtreecommitdiff
path: root/src/lib/libssl/src/crypto/evp/bio_md.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/src/crypto/evp/bio_md.c')
-rw-r--r--src/lib/libssl/src/crypto/evp/bio_md.c48
1 files changed, 11 insertions, 37 deletions
diff --git a/src/lib/libssl/src/crypto/evp/bio_md.c b/src/lib/libssl/src/crypto/evp/bio_md.c
index fa5fdc055b..317167f9c4 100644
--- a/src/lib/libssl/src/crypto/evp/bio_md.c
+++ b/src/lib/libssl/src/crypto/evp/bio_md.c
@@ -59,13 +59,12 @@
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 "buffer.h" 62#include <openssl/buffer.h>
63#include "evp.h" 63#include <openssl/evp.h>
64 64
65/* BIO_put and BIO_get both add to the digest, 65/* BIO_put and BIO_get both add to the digest,
66 * BIO_gets returns the digest */ 66 * BIO_gets returns the digest */
67 67
68#ifndef NOPROTO
69static int md_write(BIO *h,char *buf,int num); 68static int md_write(BIO *h,char *buf,int num);
70static int md_read(BIO *h,char *buf,int size); 69static int md_read(BIO *h,char *buf,int size);
71/*static int md_puts(BIO *h,char *str); */ 70/*static int md_puts(BIO *h,char *str); */
@@ -73,16 +72,6 @@ static int md_gets(BIO *h,char *str,int size);
73static long md_ctrl(BIO *h,int cmd,long arg1,char *arg2); 72static long md_ctrl(BIO *h,int cmd,long arg1,char *arg2);
74static int md_new(BIO *h); 73static int md_new(BIO *h);
75static int md_free(BIO *data); 74static int md_free(BIO *data);
76#else
77static int md_write();
78static int md_read();
79/*static int md_puts(); */
80static int md_gets();
81static long md_ctrl();
82static int md_new();
83static int md_free();
84#endif
85
86static BIO_METHOD methods_md= 75static BIO_METHOD methods_md=
87 { 76 {
88 BIO_TYPE_MD,"message digest", 77 BIO_TYPE_MD,"message digest",
@@ -95,13 +84,12 @@ static BIO_METHOD methods_md=
95 md_free, 84 md_free,
96 }; 85 };
97 86
98BIO_METHOD *BIO_f_md() 87BIO_METHOD *BIO_f_md(void)
99 { 88 {
100 return(&methods_md); 89 return(&methods_md);
101 } 90 }
102 91
103static int md_new(bi) 92static int md_new(BIO *bi)
104BIO *bi;
105 { 93 {
106 EVP_MD_CTX *ctx; 94 EVP_MD_CTX *ctx;
107 95
@@ -114,8 +102,7 @@ BIO *bi;
114 return(1); 102 return(1);
115 } 103 }
116 104
117static int md_free(a) 105static int md_free(BIO *a)
118BIO *a;
119 { 106 {
120 if (a == NULL) return(0); 107 if (a == NULL) return(0);
121 Free(a->ptr); 108 Free(a->ptr);
@@ -125,10 +112,7 @@ BIO *a;
125 return(1); 112 return(1);
126 } 113 }
127 114
128static int md_read(b,out,outl) 115static int md_read(BIO *b, char *out, int outl)
129BIO *b;
130char *out;
131int outl;
132 { 116 {
133 int ret=0; 117 int ret=0;
134 EVP_MD_CTX *ctx; 118 EVP_MD_CTX *ctx;
@@ -152,10 +136,7 @@ int outl;
152 return(ret); 136 return(ret);
153 } 137 }
154 138
155static int md_write(b,in,inl) 139static int md_write(BIO *b, char *in, int inl)
156BIO *b;
157char *in;
158int inl;
159 { 140 {
160 int ret=0; 141 int ret=0;
161 EVP_MD_CTX *ctx; 142 EVP_MD_CTX *ctx;
@@ -178,14 +159,10 @@ int inl;
178 return(ret); 159 return(ret);
179 } 160 }
180 161
181static long md_ctrl(b,cmd,num,ptr) 162static long md_ctrl(BIO *b, int cmd, long num, char *ptr)
182BIO *b;
183int cmd;
184long num;
185char *ptr;
186 { 163 {
187 EVP_MD_CTX *ctx,*dctx,**pctx; 164 EVP_MD_CTX *ctx,*dctx,**pctx;
188 EVP_MD **ppmd; 165 const EVP_MD **ppmd;
189 EVP_MD *md; 166 EVP_MD *md;
190 long ret=1; 167 long ret=1;
191 BIO *dbio; 168 BIO *dbio;
@@ -204,7 +181,7 @@ char *ptr;
204 case BIO_C_GET_MD: 181 case BIO_C_GET_MD:
205 if (b->init) 182 if (b->init)
206 { 183 {
207 ppmd=(EVP_MD **)ptr; 184 ppmd=(const EVP_MD **)ptr;
208 *ppmd=ctx->digest; 185 *ppmd=ctx->digest;
209 } 186 }
210 else 187 else
@@ -243,10 +220,7 @@ char *ptr;
243 return(ret); 220 return(ret);
244 } 221 }
245 222
246static int md_gets(bp,buf,size) 223static int md_gets(BIO *bp, char *buf, int size)
247BIO *bp;
248char *buf;
249int size;
250 { 224 {
251 EVP_MD_CTX *ctx; 225 EVP_MD_CTX *ctx;
252 unsigned int ret; 226 unsigned int ret;