Lines Matching refs:buf
171 unsigned char buf[1024]; in do_handshake() local
172 memset(buf, 0, 1024); in do_handshake()
185 mbedtls_strerror( ret, (char *) buf, 1024 ); in do_handshake()
187 mbedtls_printf( " failed\n ! mbedtls_ssl_handshake returned %d: %s\n\n", ret, buf ); in do_handshake()
215 mbedtls_x509_crt_info( (char *) buf, sizeof( buf ) - 1, " ", in do_handshake()
217 mbedtls_printf( "%s\n", buf ); in do_handshake()
222 static int write_ssl_data( mbedtls_ssl_context *ssl, unsigned char *buf, size_t len ) in write_ssl_data() argument
226 mbedtls_printf("\n%s", buf); in write_ssl_data()
227 while( len && ( ret = mbedtls_ssl_write( ssl, buf, len ) ) <= 0 ) in write_ssl_data()
239 static int write_ssl_and_get_response( mbedtls_ssl_context *ssl, unsigned char *buf, size_t len ) in write_ssl_and_get_response() argument
246 mbedtls_printf("\n%s", buf); in write_ssl_and_get_response()
247 while( len && ( ret = mbedtls_ssl_write( ssl, buf, len ) ) <= 0 ) in write_ssl_and_get_response()
297 static int write_and_get_response( mbedtls_net_context *sock_fd, unsigned char *buf, size_t len ) in write_and_get_response() argument
304 mbedtls_printf("\n%s", buf); in write_and_get_response()
305 if( len && ( ret = mbedtls_net_send( sock_fd, buf, len ) ) <= 0 ) in write_and_get_response()
351 unsigned char buf[1024]; in main() local
376 memset( &buf, 0, sizeof( buf ) ); in main()
636 ret = write_ssl_and_get_response( &ssl, buf, 0 ); in main()
649 len = sprintf( (char *) buf, "EHLO %s\r\n", hostname ); in main()
650 ret = write_ssl_and_get_response( &ssl, buf, len ); in main()
662 ret = write_and_get_response( &server_fd, buf, 0 ); in main()
675 len = sprintf( (char *) buf, "EHLO %s\r\n", hostname ); in main()
676 ret = write_and_get_response( &server_fd, buf, len ); in main()
689 len = sprintf( (char *) buf, "STARTTLS\r\n" ); in main()
690 ret = write_and_get_response( &server_fd, buf, len ); in main()
709 len = sprintf( (char *) buf, "AUTH LOGIN\r\n" ); in main()
710 ret = write_ssl_and_get_response( &ssl, buf, len ); in main()
729 len = sprintf( (char *) buf, "%s\r\n", base ); in main()
730 ret = write_ssl_and_get_response( &ssl, buf, len ); in main()
749 len = sprintf( (char *) buf, "%s\r\n", base ); in main()
750 ret = write_ssl_and_get_response( &ssl, buf, len ); in main()
764 len = sprintf( (char *) buf, "MAIL FROM:<%s>\r\n", opt.mail_from ); in main()
765 ret = write_ssl_and_get_response( &ssl, buf, len ); in main()
777 len = sprintf( (char *) buf, "RCPT TO:<%s>\r\n", opt.mail_to ); in main()
778 ret = write_ssl_and_get_response( &ssl, buf, len ); in main()
790 len = sprintf( (char *) buf, "DATA\r\n" ); in main()
791 ret = write_ssl_and_get_response( &ssl, buf, len ); in main()
803 len = sprintf( (char *) buf, "From: %s\r\nSubject: mbed TLS Test mail\r\n\r\n" in main()
808 ret = write_ssl_data( &ssl, buf, len ); in main()
810 len = sprintf( (char *) buf, "\r\n.\r\n"); in main()
811 ret = write_ssl_and_get_response( &ssl, buf, len ); in main()