Unverified Commit bb9f2dc1 authored by Petros Angelatos's avatar Petros Angelatos Committed by GitHub
Browse files

Use md5 implementation of RustCrypto organization (#1404)

parent f4a053be
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -28,3 +28,21 @@ author = "alonlud"
 references = ["smithy-rs#1390"]
 meta = { "breaking" = false, "tada" = true, "bug" = false }
 author = "Velfi"

[[smithy-rs]]
message = "Add ability to specify a different rust crate name than the one derived from the package name"
references = ["smithy-rs#1404"]
meta = { "breaking" = false, "tada" = false, "bug" = false }
author = "petrosagg"

[[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"
+5 −5
Original line number Diff line number Diff line
@@ -115,8 +115,7 @@ class InlineDependency(
    }
}

fun CargoDependency.asType(): RuntimeType =
    RuntimeType(null, dependency = this, namespace = this.name.replace("-", "_"))
fun CargoDependency.asType(): RuntimeType = RuntimeType(null, dependency = this, namespace = rustName)

data class Feature(val name: String, val default: Boolean, val deps: List<String>)

@@ -128,7 +127,8 @@ data class CargoDependency(
    private val location: DependencyLocation,
    val scope: DependencyScope = DependencyScope.Compile,
    val optional: Boolean = false,
    val features: Set<String> = emptySet()
    val features: Set<String> = emptySet(),
    val rustName: String = name.replace("-", "_")
) : RustDependency(name) {
    val key: Triple<String, DependencyLocation, DependencyScope> get() = Triple(name, location, scope)

@@ -143,7 +143,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.rustName)

    fun toMap(): Map<String, Any> {
        val attribs = mutableMapOf<String, Any>()
@@ -199,7 +199,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"), rustName = "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"))
+1 −1
Original line number Diff line number Diff line
@@ -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")