Skip to content

Vartime methods should return Option instead of CtOption #1046

@tarcieri

Description

@tarcieri

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions