Improving/simplifying `cfg` attributes for target features

未關閉
#18 4 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
25/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
rust
領域
build-system

研究方向

Start by reading the existing cfg attributes described in the issue and the build scripts that could propagate a global attribute across the RustCrypto crates. The issue offers alternative naming schemes but does not settle the design or identify specific files. Done means choosing and implementing a consistent way to select backends and enable target architecture support across crates.

由索引模型根據 Issue 內容生成。

描述

After many issues using crate features for controlling usage of target features, we've largely migrated to using cfg attributes instead.

Here are some of the cfg attributes we've defined:

  • aes_force_soft: use the software AES backend
  • aes_armv8: enable ARMv8 AES intrinsics (nightly-only)
  • chacha20_force_avx2: force the use of the AVX2 backend for ChaCha20
  • chacha20_force_sse2: force the use of the SSE2 backend for ChaCha20
  • chacha20_force_soft: force the use of the software-only backend for ChaCha20
  • polyval_force_soft: use the software POLYVAL backend
  • polyval_armv8: enable ARMv8 PMULL intrinsics (nightly-only)

First off, these all are selecting one of many options and are mutually exclusive at a crate level. cfg attributes make that possible in ways crate features don.t Alternatively we could have:

  • aes_backend="armv8", aes_backend="soft"
  • chacha20_backend="avx2", chacha20_backend="sse2", chacha20_backend="soft",
  • polyval_backend="armv8", polyval_backend="soft"

This would both be consistent across crates and simplify the logic in regard to conflicting attributes.

However, it would also be nice to have some way of enabling e.g. ARMv8 support without having to know about every subcomponent crate and whether or not it has ARMv8-specific features.

For example, right now to have fully hardware accelerated AES-GCM on ARMv8, an aes-gcm crate user needs to enable the aes_armv8 and polyval_armv8 cfg attributes.

It would be nice if there were a single cfg attribute that could be used to enable this across the whole project, e.g.

rustcrypto_target_arch="armv8"

To make this a bit easier to implement, we can continue to use the crate-specific attributes as the canonical cfg attributes, and use a build script to propagate the "global" cfg attributes.

主要語言
沒有語言資料
星號
13
分支
4
平均合併
41 分鐘
30 天內合併 PR
1

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

RustCrypto/meta 的其他 Issue

查看 RustCrypto/meta 的全部 Issue

相似的 Issue

更多 Build System Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。