Blame openssl-1.1.0-bio-fd-preserve-nl.patch

Paolo Bonzini 7ae6f1
diff --git a/CryptoPkg/Library/OpensslLib/openssl/crypto/bio/bss_fd.c b/CryptoPkg/Library/OpensslLib/openssl/crypto/bio/bss_fd.c
Paolo Bonzini 7ae6f1
index 2bd3517..a886655 100644
Paolo Bonzini 7ae6f1
--- a/CryptoPkg/Library/OpensslLib/openssl/crypto/bio/bss_fd.c
Paolo Bonzini 7ae6f1
+++ b/CryptoPkg/Library/OpensslLib/openssl/crypto/bio/bss_fd.c
Paolo Bonzini 7ae6f1
@@ -204,8 +204,10 @@ static int fd_gets(BIO *bp, char *buf, int size)
Paolo Bonzini 91c79a
     char *ptr = buf;
Paolo Bonzini 91c79a
     char *end = buf + size - 1;
Paolo Bonzini 91c79a
 
Paolo Bonzini 91c79a
-    while ((ptr < end) && (fd_read(bp, ptr, 1) > 0) && (ptr[0] != '\n'))
Paolo Bonzini 91c79a
-        ptr++;
Paolo Bonzini 91c79a
+    while (ptr < end && fd_read(bp, ptr, 1) > 0) {
Paolo Bonzini 91c79a
+        if (*ptr++ == '\n')
Paolo Bonzini 91c79a
+           break;
Paolo Bonzini 91c79a
+    }
Paolo Bonzini 91c79a
 
Paolo Bonzini 91c79a
     ptr[0] = '\0';
Paolo Bonzini 91c79a
 
Paolo Bonzini 7ae6f1
diff --git a/CryptoPkg/Library/OpensslLib/openssl/doc/crypto/BIO_read.pod b/CryptoPkg/Library/OpensslLib/openssl/doc/crypto/BIO_read.pod
Paolo Bonzini 7ae6f1
index 45871c1..fe70e9f 100644
Paolo Bonzini 7ae6f1
--- a/CryptoPkg/Library/OpensslLib/openssl/doc/crypto/BIO_read.pod
Paolo Bonzini 7ae6f1
+++ b/CryptoPkg/Library/OpensslLib/openssl/doc/crypto/BIO_read.pod
Paolo Bonzini 7ae6f1
@@ -23,7 +23,8 @@ in B<buf>. Usually this operation will attempt to read a line of data
Paolo Bonzini 91c79a
 from the BIO of maximum length B<len-1>. There are exceptions to this,
Paolo Bonzini 91c79a
 however; for example, BIO_gets() on a digest BIO will calculate and
Paolo Bonzini 91c79a
 return the digest and other BIOs may not support BIO_gets() at all.
Paolo Bonzini 91c79a
-The returned string is always NUL-terminated.
Paolo Bonzini 91c79a
+The returned string is always NUL-terminated and the '\n' is preserved
Paolo Bonzini 91c79a
+if present in the input data.
Paolo Bonzini 91c79a
 
Paolo Bonzini 91c79a
 BIO_write() attempts to write B<len> bytes from B<buf> to BIO B.
Paolo Bonzini 91c79a
 
Paolo Bonzini 7ae6f1
-- 
Paolo Bonzini 7ae6f1
2.17.0
Paolo Bonzini 7ae6f1