safe.h(3)

📦
version 2.2.0 · 2 versions
, in fedora 44

🎀 safe.h(3) — Library Functions Manual 🎀

okay bestie, listen up, because this page is about safe.h and it's entirely about making your crypto code behave ✨the same way every single time✨, no matter what secrets you feed it. it's giving constant-time main character energy and honestly? obsessed. 🫶


💖 NAME 💖

safe.h — Регулярные вычисления ("regular computations", for my non-Russian girlies 💅). the whole vibe is: same work, same time, every run.


🌸 SYNOPSIS 🌸

🧚 Макросы (Macros) 🧚

#define FAST(f)
  • FAST(f) — the name of the accelerated edition of function f. like the fast, unregular, spicy twin 🏃♀️💨

🔥 Подробное описание 🔥 (Detailed description)

okay so here's the tea 🍓: if cryptographic programs have conditional branches, and the conditions of those branches are determined by the data being processed (but not by its dimensions), then those programs are vulnerable to attacks based on timing or power measurements. literally just by watching how long you take. 😭

and even if there are no conditional branches at all, fluctuations in execution time can still get induced by all the different delays when loading data out of arrays, because of the cache logic of modern processors. it's giving... sneaky, lowkey invisible, highkey real. 👀

Regular computations are "uniform" computations — always the exact same ones when processing different data of certain dimensions. periodt.

Comments about regularity get dropped inside the \safe environment. in that environment you write down the sources of irregularity and the reasons why regularity can't be maintained / isn't worth maintaining:

  • conditional branches (the conditions are determined by the input data);
  • a loop with a variable number of steps (the loop's exit condition is determined by the input data);
  • irregular composition blocks (for example, called functions);
  • the data being processed cannot be secret;
  • the logic of the function contradicts regularity (for example, the function computes characteristics of the data).

Function f() can be presented in two editions: regular, and accelerated-irregular. the name of the accelerated edition is FAST(f).

the regular and the accelerated editions of a function have the same interface and do not differ in stack depth (see stack.h).

for analyzing performance drops in ordinary (single-edition) functions, there's the SAFE_FAST directive. when the directive is on, the accelerated editions of code fragments get used; when it's off, the regular ones do. this directive is gonna be supported all the way until the regularization of bee2 is finished. 🫡

🚨 Предупреждения (Warnings) 🚨

the SAFE_FAST directive is used exclusively for research. it must not be enabled in a normal program build. bestie, this is a lab-only thing, do not ship it, i am begging 🙏

🙈 Прим. (Notes) 🙈

  • string lengths and array dimensions are not considered critical data.
  • fluctuations when loading data from arrays are not, as of yet, considered factors of irregularity.
  • debug versions are irregular by definition. 💀

💜 Автор (Автор / Author) 💜

automatically created by Doxygen for Библиотека Bee2 from the source text. not me being generated 🙈✨


and that's the whole page, bestie! 🌈 this lil diva lives in Библиотека Bee2, dated Вс 25 Янв 2026 00:00:00, and yes, the page itself is literally safe.h(3). mwah 💋 go write some regular code, you ate 👑🦋

📦 where this page comes from