BSD 3-Clause "New" or "Revised" License

项目介绍

dalek-cryptography/subtle 是一个托管在 GitHub 上的开源项目,主要使用 Rust 编写,采用 BSD 3-Clause "New" or "Revised" License 许可证,目前获得 312 个 Star、80 次 Fork。

仓库全名
dalek-cryptography/subtle
开源许可证
BSD 3-Clause "New" or "Revised" License
Star 数
312
Fork 数
80
未关闭 Issue
14

README 摘要

Pure-Rust traits and utilities for constant-time cryptographic implementations. It consists of a Choice type, and a collection of traits using Choice instead of bool which are intended to execute in constant-time. The Choice type is a wrapper around a u8 that holds a 0 or 1. This crate represents a “best-effort” attempt, since side-channels are ultimately a property of a deployed cryptographic system including the…

完整内容见 GitHub 原始 README 或本页 。

常见问题

subtle 用什么语言开发?

主要使用 Rust 编写,采用 BSD 3-Clause "New" or "Revised" License 许可证,目前有 312 个 Star。

subtle 可以免费商用吗?

仓库采用 BSD 3-Clause "New" or "Revised" License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 subtle 的源码?

可以直接克隆仓库:git clone https://github.com/dalek-cryptography/subtle.git,默认分支为 main;安装与运行步骤见仓库 README。

subtle 最近还在维护吗?

仓库最近一次更新为 2024年8月4日,当前有 14 个未关闭 Issue;Star 数为 312,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

Pure-Rust traits and utilities for constant-time cryptographic implementations.

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
488
价值分
212
活跃状态
活跃

语言占比

Rust

README

subtle

Pure-Rust traits and utilities for constant-time cryptographic implementations.

It consists of a Choice type, and a collection of traits using Choice instead of bool which are intended to execute in constant-time. The Choice type is a wrapper around a u8 that holds a 0 or 1.

subtle = "2.6"

This crate represents a “best-effort” attempt, since side-channels are ultimately a property of a deployed cryptographic system including the hardware it runs on, not just of software.

The traits are implemented using bitwise operations, and should execute in constant time provided that a) the bitwise operations are constant-time and b) the bitwise operations are not recognized as a conditional assignment and optimized back into a branch.

For a compiler to recognize that bitwise operations represent a conditional assignment, it needs to know that the value used to generate the bitmasks is really a boolean i1 rather than an i8 byte value. In an attempt to prevent this refinement, the crate tries to hide the value of a Choice’s inner u8 by passing it through a volatile read. For more information, see the About section below.

Rust versions from 1.51 or higher have const generics support. You may enable const-generics feautre to have subtle traits implemented for arrays [T; N].

Versions prior to 2.2 recommended use of the nightly feature to enable an optimization barrier; this is not required in versions 2.2 and above.

Note: the subtle crate contains debug_asserts to check invariants during debug builds. These invariant checks involve secret-dependent branches, and are not present when compiled in release mode. This crate is intended to be used in release mode.

Documentation

Documentation is available here.

Minimum Supported Rust Version

Rust 1.41 or higher.

Minimum supported Rust version can be changed in the future, but it will be done with a minor version bump.

About

This library aims to be the Rust equivalent of Go’s crypto/subtle module.

Old versions of the optimization barrier in impl From<u8> for Choice were based on Tim Maclean’s work on rust-timing-shield, which attempts to provide a more comprehensive approach for preventing software side-channels in Rust code. From version 2.2, it was based on Diane Hosfelt and Amber Sprenkels’ work on “Secret Types in Rust”.

subtle is authored by isis agora lovecruft and Henry de Valence.

Warning

This code is a low-level library, intended for specific use-cases implementing cryptographic protocols. It represents a best-effort attempt to protect against some software side-channels. Because side-channel resistance is not a property of software alone, but of software together with hardware, any such effort is fundamentally limited.

USE AT YOUR OWN RISK

评论

暂无评论