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/des/enc_writ.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/des/enc_writ.c')
| -rw-r--r-- | Cryptlib/OpenSSL/crypto/des/enc_writ.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/Cryptlib/OpenSSL/crypto/des/enc_writ.c b/Cryptlib/OpenSSL/crypto/des/enc_writ.c index f9437ebb..bfaabde5 100644 --- a/Cryptlib/OpenSSL/crypto/des/enc_writ.c +++ b/Cryptlib/OpenSSL/crypto/des/enc_writ.c @@ -80,10 +80,13 @@ int DES_enc_write(int fd, const void *_buf, int len, DES_key_schedule *sched, DES_cblock *iv) { -#ifdef _LIBC +#if defined(OPENSSL_NO_POSIX_IO) + return (-1); +#else +# ifdef _LIBC extern unsigned long time(); extern int write(); -#endif +# endif const unsigned char *buf = _buf; long rnum; int i, j, k, outnum; @@ -93,6 +96,9 @@ int DES_enc_write(int fd, const void *_buf, int len, const unsigned char *cp; static int start = 1; + if (len < 0) + return -1; + if (outbuf == NULL) { outbuf = OPENSSL_malloc(BSIZE + HDRSIZE); if (outbuf == NULL) @@ -129,7 +135,9 @@ int DES_enc_write(int fd, const void *_buf, int len, if (len < 8) { cp = shortbuf; memcpy(shortbuf, buf, len); - RAND_pseudo_bytes(shortbuf + len, 8 - len); + if (RAND_pseudo_bytes(shortbuf + len, 8 - len) < 0) { + return -1; + } rnum = 8; } else { cp = buf; @@ -150,17 +158,17 @@ int DES_enc_write(int fd, const void *_buf, int len, /* * eay 26/08/92 I was not doing writing from where we got up to. */ -#ifndef _WIN32 +# ifndef _WIN32 i = write(fd, (void *)&(outbuf[j]), outnum - j); -#else +# else i = _write(fd, (void *)&(outbuf[j]), outnum - j); -#endif +# endif if (i == -1) { -#ifdef EINTR +# ifdef EINTR if (errno == EINTR) i = 0; else -#endif +# endif /* * This is really a bad error - very bad It will stuff-up * both ends. @@ -170,4 +178,5 @@ int DES_enc_write(int fd, const void *_buf, int len, } return (len); +#endif /* OPENSSL_NO_POSIX_IO */ } |
