Skip to content

Commit

Permalink
Use md5 implementation of RustCrypto organization
Browse files Browse the repository at this point in the history
Signed-off-by: Petros Angelatos <[email protected]>
  • Loading branch information
petrosagg committed May 24, 2022
1 parent f4a053b commit 45010fa
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.next.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,15 @@ author = "alonlud"
references = ["smithy-rs#1390"]
meta = { "breaking" = false, "tada" = true, "bug" = false }
author = "Velfi"

[[smithy-rs]]
message = "Switch to [RustCrypto](https://github.com/RustCrypto)'s implementation of MD5."
references = ["smithy-rs#1404"]
meta = { "breaking" = false, "tada" = false, "bug" = false }
author = "petrosagg"

[[aws-sdk-rust]]
message = "Switch to [RustCrypto](https://github.com/RustCrypto)'s implementation of MD5."
references = ["smithy-rs#1404"]
meta = { "breaking" = false, "tada" = false, "bug" = false }
author = "petrosagg"
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ data class CargoDependency(
val scope: DependencyScope = DependencyScope.Compile,
val optional: Boolean = false,
val features: Set<String> = emptySet()
val crateName: String = name.replace("-", "_")
) : RustDependency(name) {
val key: Triple<String, DependencyLocation, DependencyScope> get() = Triple(name, location, scope)

Expand All @@ -143,7 +144,7 @@ data class CargoDependency(
is Local -> "local"
}

fun rustName(name: String): RuntimeType = RuntimeType(name, this, this.name.replace("-", "_"))
fun rustName(name: String): RuntimeType = RuntimeType(name, this, this.crateName)

fun toMap(): Map<String, Any> {
val attribs = mutableMapOf<String, Any>()
Expand Down Expand Up @@ -199,7 +200,7 @@ data class CargoDependency(
val Hyper: CargoDependency = CargoDependency("hyper", CratesIo("0.14"))
val HyperWithStream: CargoDependency = Hyper.withFeature("stream")
val LazyStatic: CargoDependency = CargoDependency("lazy_static", CratesIo("1.4"))
val Md5: CargoDependency = CargoDependency("md5", CratesIo("0.7"))
val Md5: CargoDependency = CargoDependency("md-5", CratesIo("0.10"), crateName = "md5")
val PercentEncoding: CargoDependency = CargoDependency("percent-encoding", CratesIo("2"))
val PrettyAssertions: CargoDependency = CargoDependency("pretty_assertions", CratesIo("1"), scope = DependencyScope.Dev)
val Regex: CargoDependency = CargoDependency("regex", CratesIo("1"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class HttpChecksumRequiredGenerator(
.body()
.bytes()
.expect("checksum can only be computed for non-streaming operations");
let checksum = #{md5}::compute(data);
let checksum = <#{md5}::Md5 as #{md5}::Digest>::digest(data);
req.headers_mut().insert(
#{http}::header::HeaderName::from_static("content-md5"),
#{base64_encode}(&checksum[..]).parse().expect("checksum is valid header value")
Expand Down

0 comments on commit 45010fa

Please sign in to comment.