diff options
| author | djm <> | 2005-04-29 05:37:34 +0000 |
|---|---|---|
| committer | djm <> | 2005-04-29 05:37:34 +0000 |
| commit | a95585a25ab25668b931a78b7543f707a3354db8 (patch) | |
| tree | f9e9febf7ac0c8f5d6df761fe70fd613aac06203 /src/lib/libcrypto/evp/bio_md.c | |
| parent | 58c08aa241f168c84ce7cc3052454ea59a44eada (diff) | |
| download | openbsd-a95585a25ab25668b931a78b7543f707a3354db8.tar.gz openbsd-a95585a25ab25668b931a78b7543f707a3354db8.tar.bz2 openbsd-a95585a25ab25668b931a78b7543f707a3354db8.zip | |
import of openssl-0.9.7g; tested on platforms from alpha to zaurus, ok deraadt@
Diffstat (limited to 'src/lib/libcrypto/evp/bio_md.c')
| -rw-r--r-- | src/lib/libcrypto/evp/bio_md.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/lib/libcrypto/evp/bio_md.c b/src/lib/libcrypto/evp/bio_md.c index c632dfb202..f4aa41ac4b 100644 --- a/src/lib/libcrypto/evp/bio_md.c +++ b/src/lib/libcrypto/evp/bio_md.c | |||
| @@ -176,10 +176,11 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 176 | { | 176 | { |
| 177 | case BIO_CTRL_RESET: | 177 | case BIO_CTRL_RESET: |
| 178 | if (b->init) | 178 | if (b->init) |
| 179 | EVP_DigestInit_ex(ctx,ctx->digest, NULL); | 179 | ret = EVP_DigestInit_ex(ctx,ctx->digest, NULL); |
| 180 | else | 180 | else |
| 181 | ret=0; | 181 | ret=0; |
| 182 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | 182 | if (ret > 0) |
| 183 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 183 | break; | 184 | break; |
| 184 | case BIO_C_GET_MD: | 185 | case BIO_C_GET_MD: |
| 185 | if (b->init) | 186 | if (b->init) |
| @@ -191,11 +192,12 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 191 | ret=0; | 192 | ret=0; |
| 192 | break; | 193 | break; |
| 193 | case BIO_C_GET_MD_CTX: | 194 | case BIO_C_GET_MD_CTX: |
| 195 | pctx=ptr; | ||
| 196 | *pctx=ctx; | ||
| 197 | break; | ||
| 198 | case BIO_C_SET_MD_CTX: | ||
| 194 | if (b->init) | 199 | if (b->init) |
| 195 | { | 200 | b->ptr=ptr; |
| 196 | pctx=ptr; | ||
| 197 | *pctx=ctx; | ||
| 198 | } | ||
| 199 | else | 201 | else |
| 200 | ret=0; | 202 | ret=0; |
| 201 | break; | 203 | break; |
| @@ -207,8 +209,9 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 207 | 209 | ||
| 208 | case BIO_C_SET_MD: | 210 | case BIO_C_SET_MD: |
| 209 | md=ptr; | 211 | md=ptr; |
| 210 | EVP_DigestInit_ex(ctx,md, NULL); | 212 | ret = EVP_DigestInit_ex(ctx,md, NULL); |
| 211 | b->init=1; | 213 | if (ret > 0) |
| 214 | b->init=1; | ||
| 212 | break; | 215 | break; |
| 213 | case BIO_CTRL_DUP: | 216 | case BIO_CTRL_DUP: |
| 214 | dbio=ptr; | 217 | dbio=ptr; |
