diff options
| author | Gary Ching-Pang Lin <glin@suse.com> | 2015-07-28 11:46:38 -0400 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2015-07-28 11:46:38 -0400 |
| commit | 5ce38c90cf43ee79cd999716ea83a5a44eeb819e (patch) | |
| tree | 2fb3d9dd667c772fae5f87fa61e1501cf12da0ce /Cryptlib/OpenSSL/crypto/evp/bio_md.c | |
| parent | 69ba24ff72921ecabbb47178de40dc5a79350040 (diff) | |
| download | efi-boot-shim-5ce38c90cf43ee79cd999716ea83a5a44eeb819e.tar.gz efi-boot-shim-5ce38c90cf43ee79cd999716ea83a5a44eeb819e.zip | |
Update openssl to 1.0.2d
Also update Cryptlib to edk2 r17731
Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
Diffstat (limited to 'Cryptlib/OpenSSL/crypto/evp/bio_md.c')
| -rw-r--r-- | Cryptlib/OpenSSL/crypto/evp/bio_md.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/Cryptlib/OpenSSL/crypto/evp/bio_md.c b/Cryptlib/OpenSSL/crypto/evp/bio_md.c index 9f0024b9..f0b0c0c0 100644 --- a/Cryptlib/OpenSSL/crypto/evp/bio_md.c +++ b/Cryptlib/OpenSSL/crypto/evp/bio_md.c @@ -134,7 +134,9 @@ static int md_read(BIO *b, char *out, int outl) ret = BIO_read(b->next_bio, out, outl); if (b->init) { if (ret > 0) { - EVP_DigestUpdate(ctx, (unsigned char *)out, (unsigned int)ret); + if (EVP_DigestUpdate(ctx, (unsigned char *)out, + (unsigned int)ret) <= 0) + return (-1); } } BIO_clear_retry_flags(b); @@ -155,12 +157,17 @@ static int md_write(BIO *b, const char *in, int inl) ret = BIO_write(b->next_bio, in, inl); if (b->init) { if (ret > 0) { - EVP_DigestUpdate(ctx, (const unsigned char *)in, - (unsigned int)ret); + if (!EVP_DigestUpdate(ctx, (const unsigned char *)in, + (unsigned int)ret)) { + BIO_clear_retry_flags(b); + return 0; + } } } - BIO_clear_retry_flags(b); - BIO_copy_next_retry(b); + if (b->next_bio != NULL) { + BIO_clear_retry_flags(b); + BIO_copy_next_retry(b); + } return (ret); } @@ -193,6 +200,7 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr) case BIO_C_GET_MD_CTX: pctx = ptr; *pctx = ctx; + b->init = 1; break; case BIO_C_SET_MD_CTX: if (b->init) @@ -215,7 +223,8 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr) case BIO_CTRL_DUP: dbio = ptr; dctx = dbio->ptr; - EVP_MD_CTX_copy_ex(dctx, ctx); + if (!EVP_MD_CTX_copy_ex(dctx, ctx)) + return 0; b->init = 1; break; default: @@ -247,7 +256,9 @@ static int md_gets(BIO *bp, char *buf, int size) ctx = bp->ptr; if (size < ctx->digest->md_size) return (0); - EVP_DigestFinal_ex(ctx, (unsigned char *)buf, &ret); + if (EVP_DigestFinal_ex(ctx, (unsigned char *)buf, &ret) <= 0) + return -1; + return ((int)ret); } |
