servo: Merge #16761 - Use hash2 instead of deprecated hash (from Ksbugbee:master); r=jdm
authorKsbugbee <ksb30@me.com>
Mon, 08 May 2017 13:42:32 -0500
changeset 357160 e136ad1e555e7b62207dcdc380ba03bf4ac4716c
parent 357159 4601925d7000d91277cfd2b6fa61715447837457
child 357161 7843e62d91248c35b745217d87cd53674476693b
push id31783
push usercbook@mozilla.com
push dateTue, 09 May 2017 12:03:48 +0000
treeherdermozilla-central@b0ff0c5c0a35 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #16761 - Use hash2 instead of deprecated hash (from Ksbugbee:master); r=jdm <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 4e3544f05c161039b97fe4c20daca4a0baf372fe
servo/components/net/subresource_integrity.rs
--- a/servo/components/net/subresource_integrity.rs
+++ b/servo/components/net/subresource_integrity.rs
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use base64;
 use net_traits::response::{Response, ResponseBody, ResponseType};
-use openssl::hash::{MessageDigest, hash};
+use openssl::hash::{MessageDigest, hash2};
 use std::iter::Filter;
 use std::str::Split;
 use std::sync::MutexGuard;
 const SUPPORTED_ALGORITHM: &'static [&'static str] = &[
     "sha256",
     "sha384",
     "sha512",
 ];
@@ -114,17 +114,17 @@ pub fn get_strongest_metadata(integrity_
     result
 }
 
 /// https://w3c.github.io/webappsec-subresource-integrity/#apply-algorithm-to-response
 fn apply_algorithm_to_response(body: MutexGuard<ResponseBody>,
                                message_digest: MessageDigest)
                                -> String {
     if let ResponseBody::Done(ref vec) = *body {
-        let response_digest = hash(message_digest, vec).unwrap();
+        let response_digest = hash2(message_digest, vec).unwrap(); //Now hash2
         base64::encode(&response_digest)
     } else {
         unreachable!("Tried to calculate digest of incomplete response body")
     }
 }
 
 /// https://w3c.github.io/webappsec-subresource-integrity/#is-response-eligible
 fn is_eligible_for_integrity_validation(response: &Response) -> bool {