interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / native / sig / sig_internal.h

43 lines · 1857 bytes Raw Blame History
1/* SPDX-License-Identifier: Apache-2.0
2 * Copyright 2026 Drake Stapleton (AIEN / aien-dev)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/* Internal hooks for the test. Not public API. */
18#ifndef AIENOS_SIG_INTERNAL_H
19#define AIENOS_SIG_INTERNAL_H
20
21#include <stddef.h>
22#include <stdint.h>
23
24/* Optimization barrier: the compiler must treat v as unknown, so a mask
25 * cannot be turned back into a branch. */
26#define AIENOS_SIG_BARRIER(v) __asm__ volatile("" : "+r"(v))
27
28void aienos_sig_wipe(void *p, size_t n);
29int aienos_sig_ct_equal(const uint8_t *a, const uint8_t *b, size_t n);
30
31/* out = in mod L (in: 64 bytes little endian). */
32void aienos_sig_sc_reduce(uint8_t out[32], const uint8_t in[64]);
33/* out = (a * b + c) mod L (all little endian, a, b, c < 2^256). */
34void aienos_sig_sc_muladd(uint8_t out[32], const uint8_t a[32], const uint8_t b[32],
35 const uint8_t c[32]);
36/* out = encode([s]B), s any 32-byte little-endian scalar. */
37void aienos_sig_basemult(uint8_t out[32], const uint8_t s[32]);
38/* Decode a point. Returns -1 if decoding is refused, -2 if it decoded to a
39 * point that is not on the curve (must never happen), else 0 and writes
40 * the re-encoding to out and whether the point has small order to *small. */
41int aienos_sig_decode_check(uint8_t out[32], int *small, const uint8_t in[32]);
42
43#endif