@@ -652,21 +652,35 @@ void SSLFilter::Destroy() {
652652int SSLFilter::ProcessReadPlaintextBuffer (int start, int end) {
653653 int length = end - start;
654654 int bytes_processed = 0 ;
655+ if (SSL_LOG_DATA) {
656+ Syslog::Print (" Entering ProcessReadPlaintextBuffer with %d bytes\n " ,
657+ length);
658+ }
655659 if (length > 0 ) {
656660 bytes_processed = SSL_read (
657661 ssl_, reinterpret_cast <char *>((buffers_[kReadPlaintext ] + start)),
658662 length);
659663 if (bytes_processed < 0 ) {
660664 int error = SSL_get_error (ssl_, bytes_processed);
661- USE (error);
665+ if (SSL_LOG_DATA) {
666+ Syslog::Print (" SSL_read returned error %d\n " , error);
667+ }
662668 bytes_processed = 0 ;
663669 }
664670 }
671+ if (SSL_LOG_DATA) {
672+ Syslog::Print (" Leaving ProcessReadPlaintextBuffer read %d bytes\n " ,
673+ bytes_processed);
674+ }
665675 return bytes_processed;
666676}
667677
668678int SSLFilter::ProcessWritePlaintextBuffer (int start, int end) {
669679 int length = end - start;
680+ if (SSL_LOG_DATA) {
681+ Syslog::Print (" Entering ProcessWritePlaintextBuffer with %d bytes\n " ,
682+ length);
683+ }
670684 int bytes_processed =
671685 SSL_write (ssl_, buffers_[kWritePlaintext ] + start, length);
672686 if (bytes_processed < 0 ) {
@@ -675,49 +689,62 @@ int SSLFilter::ProcessWritePlaintextBuffer(int start, int end) {
675689 }
676690 return 0 ;
677691 }
692+ if (SSL_LOG_DATA) {
693+ Syslog::Print (" Leaving ProcessWritePlaintextBuffer wrote %d bytes\n " ,
694+ bytes_processed);
695+ }
678696 return bytes_processed;
679697}
680698
681699/* Read encrypted data from the circular buffer to the filter */
682700int SSLFilter::ProcessReadEncryptedBuffer (int start, int end) {
683701 int length = end - start;
684- if (SSL_LOG_DATA)
702+ if (SSL_LOG_DATA) {
685703 Syslog::Print (" Entering ProcessReadEncryptedBuffer with %d bytes\n " ,
686704 length);
705+ }
687706 int bytes_processed = 0 ;
688707 if (length > 0 ) {
689708 bytes_processed =
690709 BIO_write (socket_side_, buffers_[kReadEncrypted ] + start, length);
691710 if (bytes_processed <= 0 ) {
692711 bool retry = BIO_should_retry (socket_side_) != 0 ;
693712 if (!retry) {
694- if (SSL_LOG_DATA)
713+ if (SSL_LOG_DATA) {
695714 Syslog::Print (" BIO_write failed in ReadEncryptedBuffer\n " );
715+ }
696716 }
697717 bytes_processed = 0 ;
698718 }
699719 }
700- if (SSL_LOG_DATA)
701- Syslog::Print (" Leaving ProcessReadEncryptedBuffer wrote %d bytes\n " ,
720+ if (SSL_LOG_DATA) {
721+ Syslog::Print (" Leaving ProcessReadEncryptedBuffer read %d bytes\n " ,
702722 bytes_processed);
723+ }
703724 return bytes_processed;
704725}
705726
706727int SSLFilter::ProcessWriteEncryptedBuffer (int start, int end) {
707728 int length = end - start;
708729 int bytes_processed = 0 ;
730+ if (SSL_LOG_DATA) {
731+ Syslog::Print (" Entering ProcessWriteEncryptedBuffer with %d bytes\n " ,
732+ length);
733+ }
709734 if (length > 0 ) {
710735 bytes_processed =
711736 BIO_read (socket_side_, buffers_[kWriteEncrypted ] + start, length);
712737 if (bytes_processed < 0 ) {
713- if (SSL_LOG_DATA)
738+ if (SSL_LOG_DATA) {
714739 Syslog::Print (" WriteEncrypted BIO_read returned error %d\n " ,
715740 bytes_processed);
741+ }
716742 return 0 ;
717743 } else {
718- if (SSL_LOG_DATA)
744+ if (SSL_LOG_DATA) {
719745 Syslog::Print (" WriteEncrypted BIO_read wrote %d bytes\n " ,
720746 bytes_processed);
747+ }
721748 }
722749 }
723750 return bytes_processed;
0 commit comments