// This file is generated by cargo2android.py --run --device --dependencies --features alloc,default,dev_urandom_fallback,once_cell,std --tests --patch=patches/Android.bp.diff.
// Do not modify this file as changes will be overridden on upgrade.

package {
    default_applicable_licenses: ["external_rust_crates_ring_license"],
}

// Added automatically by a large-scale-change that took the approach of
// 'apply every license found to every target'. While this makes sure we respect
// every license restriction, it may not be entirely correct.
//
// e.g. GPL in an MIT project might only apply to the contrib/ directory.
//
// Please consider splitting the single license below into multiple licenses,
// taking care not to lose any license_kind information, and overriding the
// default license using the 'licenses: [...]' property on targets as needed.
//
// For unused files, consider creating a 'fileGroup' with "//visibility:private"
// to attach the license to, and including a comment whether the files may be
// used in the current project.
// See: http://go/android-license-faq
license {
    name: "external_rust_crates_ring_license",
    visibility: [":__subpackages__"],
    license_kinds: [
        "SPDX-license-identifier-BSD",
        "SPDX-license-identifier-ISC",
        "SPDX-license-identifier-MIT",
        "SPDX-license-identifier-OpenSSL",
        "legacy_unencumbered",
    ],
    license_text: [
        "LICENSE",
    ],
}

rust_library {
    name: "libring",
    // has rustc warnings
    host_supported: true,
    crate_name: "ring",
    srcs: ["src/lib.rs"],
    edition: "2018",
    features: [
        "alloc",
        "default",
        "dev_urandom_fallback",
        "once_cell",
        "std",
    ],
    rustlibs: [
        "liblibc",
        "libonce_cell",
        "libspin",
        "libuntrusted",
    ],
    static_libs: [
        "libring-core",
    ],
    apex_available: [
        "//apex_available:platform",
        "com.android.resolv",
    ],
    min_sdk_version: "29",
}

rust_defaults {
    name: "ring_defaults",
    crate_name: "ring",
    // has rustc warnings
    srcs: ["src/lib.rs"],
    test_suites: ["general-tests"],
    auto_gen_config: true,
    edition: "2018",
    features: [
        "alloc",
        "default",
        "dev_urandom_fallback",
        "once_cell",
        "std",
    ],
    rustlibs: [
        "liblibc",
        "libonce_cell",
        "libspin",
        "libuntrusted",
    ],
    static_libs: [
        "libring-core",
        "libring-test",
    ],
}

cc_library_static {
    name: "libring-core",
    host_supported: true,
    srcs: [
        "crypto/cpu-intel.c",
        "crypto/fipsmodule/aes/aes_nohw.c",
        "crypto/crypto.c",
        "crypto/poly1305/poly1305.c",
        "crypto/poly1305/poly1305_vec.c",
        "crypto/curve25519/curve25519.c",
        "crypto/fipsmodule/ec/ecp_nistz.c",
        "crypto/fipsmodule/ec/ecp_nistz256.c",
        "crypto/fipsmodule/ec/gfp_p256.c",
        "crypto/fipsmodule/ec/gfp_p384.c",
        "crypto/limbs/limbs.c",
        "crypto/mem.c",
        "crypto/fipsmodule/bn/montgomery.c",
        "crypto/fipsmodule/bn/montgomery_inv.c",
    ],

    arch: {
        arm: {
            srcs: [
                "crypto/poly1305/poly1305_arm.c",
                "crypto/poly1305/poly1305_arm_asm.S",
                "pregenerated/armv4-mont-linux32.S",
                "crypto/curve25519/asm/x25519-asm-arm.S",
                "pregenerated/sha256-armv4-linux32.S",
                "pregenerated/sha512-armv4-linux32.S",
                "pregenerated/ecp_nistz256-armv4-linux32.S",
                "pregenerated/aesv8-armx-linux32.S",
                "pregenerated/bsaes-armv7-linux32.S",
                "pregenerated/ghashv8-armx-linux32.S",
                "pregenerated/vpaes-armv7-linux32.S",
                "pregenerated/ghash-armv4-linux32.S",
                "pregenerated/chacha-armv4-linux32.S",
            ],
        },
        arm64: {
            srcs: [
                "pregenerated/aesv8-armx-linux64.S",
                "pregenerated/armv8-mont-linux64.S",
                "pregenerated/chacha-armv8-linux64.S",
                "pregenerated/ecp_nistz256-armv8-linux64.S",
                "pregenerated/ghash-neon-armv8-linux64.S",
                "pregenerated/ghashv8-armx-linux64.S",
                "pregenerated/sha256-armv8-linux64.S",
                "pregenerated/sha512-armv8-linux64.S",
                "pregenerated/vpaes-armv8-linux64.S",
            ],
        },
        x86: {
            srcs: [
                "pregenerated/aesni-x86-elf.S",
                "pregenerated/chacha-x86-elf.S",
                "pregenerated/ecp_nistz256-x86-elf.S",
                "pregenerated/ghash-x86-elf.S",
                "pregenerated/vpaes-x86-elf.S",
                "pregenerated/x86-mont-elf.S",
            ],
        },
        x86_64: {
            srcs: [
                "pregenerated/aesni-gcm-x86_64-elf.S",
                "pregenerated/aesni-x86_64-elf.S",
                "pregenerated/chacha-x86_64-elf.S",
                "pregenerated/ghash-x86_64-elf.S",
                "pregenerated/p256-x86_64-asm-elf.S",
                "pregenerated/sha256-x86_64-elf.S",
                "pregenerated/sha512-x86_64-elf.S",
                "pregenerated/vpaes-x86_64-elf.S",
                "pregenerated/x86_64-mont5-elf.S",
                "pregenerated/x86_64-mont-elf.S",
            ],
        },
    },

    cflags: [
        "-O3",
        "-Wno-error",
        "-fPIC",
        "-fdata-sections",
        "-ffunction-sections",
        "-fno-omit-frame-pointer",
        "-fno-strict-aliasing",
        "-fstack-protector",
        "-fvisibility=hidden",
        "-DNDEBUG",
    ],
    local_include_dirs: ["include"],
    apex_available: [
        "//apex_available:platform",
        "com.android.resolv",
    ],
    min_sdk_version: "29",
}

cc_library_static {
    name: "libring-test",
    host_supported: true,
    srcs: [
        "crypto/constant_time_test.c",
    ],
    local_include_dirs: ["include"],
}

rust_test_host {
    name: "ring_host_test_src_lib",
    defaults: ["ring_defaults"],
    test_options: {
        unit_test: true,
    },
}

rust_test {
    name: "ring_device_test_src_lib",
    defaults: ["ring_defaults"],
}

rust_defaults {
    name: "ring_defaults_ring",
    crate_name: "ring",
    test_suites: ["general-tests"],
    auto_gen_config: true,
    edition: "2018",
    features: [
        "alloc",
        "default",
        "dev_urandom_fallback",
        "once_cell",
        "std",
    ],
    rustlibs: [
        "liblibc",
        "libonce_cell",
        "libring",
        "libspin",
        "libuntrusted",
    ],
}

rust_test_host {
    name: "ring_host_test_tests_aead_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/aead_tests.rs"],
    test_options: {
        unit_test: true,
    },
}

rust_test {
    name: "ring_device_test_tests_aead_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/aead_tests.rs"],
}

rust_test_host {
    name: "ring_host_test_tests_agreement_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/agreement_tests.rs"],
    test_options: {
        unit_test: true,
    },
}

rust_test {
    name: "ring_device_test_tests_agreement_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/agreement_tests.rs"],
}

rust_test_host {
    name: "ring_host_test_tests_constant_time_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/constant_time_tests.rs"],
    test_options: {
        unit_test: true,
    },
}

rust_test {
    name: "ring_device_test_tests_constant_time_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/constant_time_tests.rs"],
}

rust_test_host {
    name: "ring_host_test_tests_digest_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/digest_tests.rs"],
    test_options: {
        unit_test: true,
    },
}

rust_test {
    name: "ring_device_test_tests_digest_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/digest_tests.rs"],
}

rust_test_host {
    name: "ring_host_test_tests_ecdsa_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/ecdsa_tests.rs"],
    test_options: {
        unit_test: true,
    },
}

rust_test {
    name: "ring_device_test_tests_ecdsa_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/ecdsa_tests.rs"],
}

rust_test_host {
    name: "ring_host_test_tests_ed25519_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/ed25519_tests.rs"],
    test_options: {
        unit_test: true,
    },
}

rust_test {
    name: "ring_device_test_tests_ed25519_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/ed25519_tests.rs"],
}

rust_test_host {
    name: "ring_host_test_tests_hkdf_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/hkdf_tests.rs"],
    test_options: {
        unit_test: true,
    },
}

rust_test {
    name: "ring_device_test_tests_hkdf_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/hkdf_tests.rs"],
}

rust_test_host {
    name: "ring_host_test_tests_hmac_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/hmac_tests.rs"],
    test_options: {
        unit_test: true,
    },
}

rust_test {
    name: "ring_device_test_tests_hmac_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/hmac_tests.rs"],
}

rust_test_host {
    name: "ring_host_test_tests_pbkdf2_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/pbkdf2_tests.rs"],
    test_options: {
        unit_test: true,
    },
}

rust_test {
    name: "ring_device_test_tests_pbkdf2_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/pbkdf2_tests.rs"],
}

rust_test_host {
    name: "ring_host_test_tests_quic_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/quic_tests.rs"],
    test_options: {
        unit_test: true,
    },
}

rust_test {
    name: "ring_device_test_tests_quic_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/quic_tests.rs"],
}

rust_test_host {
    name: "ring_host_test_tests_rand_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/rand_tests.rs"],
    test_options: {
        unit_test: true,
    },
}

rust_test {
    name: "ring_device_test_tests_rand_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/rand_tests.rs"],
}

rust_test_host {
    name: "ring_host_test_tests_rsa_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/rsa_tests.rs"],
    test_options: {
        unit_test: true,
    },
}

rust_test {
    name: "ring_device_test_tests_rsa_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/rsa_tests.rs"],
}

rust_test_host {
    name: "ring_host_test_tests_signature_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/signature_tests.rs"],
    test_options: {
        unit_test: true,
    },
}

rust_test {
    name: "ring_device_test_tests_signature_tests",
    defaults: ["ring_defaults_ring"],
    // has rustc warnings
    srcs: ["tests/signature_tests.rs"],
}

// dependent_library ["feature_list"]
//   cc-1.0.67
//   libc-0.2.93
//   once_cell-1.7.2 "alloc,race,std"
//   spin-0.5.2
//   untrusted-0.7.1