ITADN

Vartime methods should return `Option` instead of `CtOption`

#1046Opentarcieri 创建于 2025-12-27
T
tarciericommented
We have several methods that are advertised as variable-time which are returning `CtOption` instead of `Option`. This is a bit suboptimal: `CtOption` eagerly evaluates its combinators, whereas `Option` uses lazy evaluation. It would generally be more efficient to use `Option`. Perhaps a reason why this was the case originally was trouble converting from `ConstCtOption` to `Option` inside a `const fn` in the past, but there's now `ctutils::CtOption::into_option_copied` which can be used as a `const fn`, in cases where there's some shared code between the constant-time and non-constant-time versions of a function. cc @andrewwhitehead @fjarri
2 条评论