# Copyright (C) 2022-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

base_path = "//base/security/crypto_framework"
framework_path = "//base/security/crypto_framework/frameworks"
plugin_path = "//base/security/crypto_framework/plugin"

declare_args() {
  crypto_framework_api_metrics_enable = true
  if (defined(global_parts_info) &&
      !defined(global_parts_info.hiviewdfx_api_metrics)) {
    crypto_framework_api_metrics_enable = false
  }
}

framework_inc_path = [
  "${base_path}/interfaces/inner_api/algorithm_parameter",
  "${base_path}/interfaces/inner_api/common",
  "${base_path}/interfaces/inner_api/crypto_operation",
  "${base_path}/interfaces/inner_api/key",
  "${base_path}/common/inc",
  "${plugin_path}/openssl_plugin/common/inc",
  "${plugin_path}/openssl_plugin/crypto_operation/kdf/inc",
  "${plugin_path}/openssl_plugin/crypto_operation/key_agreement/inc",
  "${plugin_path}/openssl_plugin/crypto_operation/kem/inc",
  "${plugin_path}/openssl_plugin/crypto_operation/signature/inc",
  "${plugin_path}/openssl_plugin/crypto_operation/cipher/inc",
  "${plugin_path}/openssl_plugin/key/sym_key_generator/inc",
  "${plugin_path}/openssl_plugin/key/asy_key_generator/inc",
  "${plugin_path}/openssl_plugin/crypto_operation/hmac/inc",
  "${plugin_path}/openssl_plugin/crypto_operation/md/inc",
  "${plugin_path}/openssl_plugin/crypto_operation/rand/inc",
  "${framework_path}/api_metrics/js/include",
  "${framework_path}/spi",
]

framework_cipher_files = [ "${framework_path}/crypto_operation/cipher.c" ]

framework_signature_files = [ "${framework_path}/crypto_operation/signature.c" ]

framework_key_agreement_files =
    [ "${framework_path}/crypto_operation/key_agreement.c" ]

framework_kem_files = [ "${framework_path}/crypto_operation/kem.c" ]

framework_key_files = [
  "${framework_path}/key/asy_key_generator.c",
  "${framework_path}/key/dh_key_util.c",
  "${framework_path}/key/ecc_key_util.c",
  "${framework_path}/key/key_utils.c",
  "${framework_path}/key/sym_key_generator.c",
]

framework_mac_files = [ "${framework_path}/crypto_operation/mac.c" ]

framework_rand_files = [ "${framework_path}/crypto_operation/rand.c" ]

framework_md_files = [ "${framework_path}/crypto_operation/md.c" ]

framework_kdf_files = [ "${framework_path}/crypto_operation/kdf.c" ]

framework_err_files = [ "${framework_path}/crypto_operation/crypto_operation_err.c" ]

framework_sm2_crypto_util_files = [
  "${framework_path}/crypto_operation/sm2_crypto_util.c",
  "${framework_path}/crypto_operation/sm2_ec_signature_data.c",
]

framework_files =
    framework_key_agreement_files + framework_signature_files +
    framework_kem_files + framework_cipher_files + framework_key_files +
    framework_mac_files +
    framework_rand_files + framework_md_files + framework_kdf_files +
    framework_sm2_crypto_util_files + framework_err_files

framework_inc_lite_path = [
  "${base_path}/interfaces/inner_api/algorithm_parameter",
  "${base_path}/interfaces/inner_api/common",
  "${base_path}/interfaces/inner_api/crypto_operation",
  "${base_path}/interfaces/inner_api/key",
  "${base_path}/common/inc",
  "${plugin_path}/mbedtls_plugin/common",
  "${plugin_path}/mbedtls_plugin/md/inc",
  "${plugin_path}/mbedtls_plugin/rand/inc",
  "${framework_path}/spi",
]

framework_lite_files = framework_rand_files + framework_md_files