Index: wp-admin/includes/file.php
===================================================================
--- wp-admin/includes/file.php	(revision 19953)
+++ wp-admin/includes/file.php	(working copy)
@@ -492,9 +492,11 @@
  *
  * @param string $url the URL of the file to download
  * @param int $timeout The timeout for the request to download the file default 300 seconds
- * @return mixed WP_Error on failure, string Filename on success.
+ * @param bool $verify Whether to attempt download verification using the Content-MD5 header if it exists
+ * @param bool $full_response Whether to return the full response instead of just the filename
+ * @return mixed WP_Error on failure, string Filename or HTTP API response array on success.
  */
-function download_url( $url, $timeout = 300 ) {
+function download_url( $url, $timeout = 300, $verify = true, $full_response = false ) {
 	//WARNING: The file is not automatically deleted, The script must unlink() the file.
 	if ( ! $url )
 		return new WP_Error('http_no_url', __('Invalid URL Provided.'));
@@ -515,7 +517,18 @@
 		return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ) );
 	}
 
-	return $tmpfname;
+	$content_md5 = wp_remote_retrieve_header( $response, 'content-md5' );
+
+	if ( ! empty( $content_md5 ) && $verify ) {
+		$md5_file = md5_file( $response['filename'] );
+		if ( $md5_file != $content_md5 )
+			return new WP_Error( 'download_verification_failed', sprintf( __( 'The checksum of the download (%1$s) does not match the provided checksum value (%2$s).' ), $md5_file, $content_md5 ) );
+	}
+
+	if ( $full_response )
+		return $response;
+	else
+		return $tmpfname;
 }
 
 /**
Index: wp-admin/includes/class-wp-upgrader.php
===================================================================
--- wp-admin/includes/class-wp-upgrader.php	(revision 19953)
+++ wp-admin/includes/class-wp-upgrader.php	(working copy)
@@ -115,7 +115,7 @@
 
 		$this->skin->feedback('downloading_package', $package);
 
-		$download_file = download_url($package);
+		$download_file = download_url($package, 300, true);
 
 		if ( is_wp_error($download_file) )
 			return new WP_Error('download_failed', $this->strings['download_failed'], $download_file->get_error_message());
