interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / om / sha256 / om2-evidence / s4 / omega_api.h.generated

62 lines · 1967 bytes Raw Blame History
1/* Generated by omega-bridge src/native.om: the C API of the ABI v2 units in libomega_native
2 * (docs/NATIVE-ABI.md, ABI v2). Each function calls omega2_<name> and calls abort() on a nonzero status.
3 * Regenerate it; do not edit it. */
4#ifndef OMEGA_API_H
5#define OMEGA_API_H
6#include <stddef.h>
7#include <stdint.h>
8#include <stdlib.h>
9#include "omega_native.h"
10#ifdef __cplusplus
11#define OMBR_ASSERT static_assert
12extern "C" {
13#else
14#define OMBR_ASSERT _Static_assert
15#endif
16#define SHA256_DIGEST_SIZE 32
17#define SHA256_BLOCK_SIZE 64
18typedef struct {
19 uint32_t state[8];
20 uint64_t count;
21 uint8_t buf[64];
22} sha256_ctx;
23OMBR_ASSERT(sizeof(sha256_ctx) == 104, "layout shactx size");
24OMBR_ASSERT(offsetof(sha256_ctx, state) == 0, "layout shactx field state");
25OMBR_ASSERT(offsetof(sha256_ctx, count) == 32, "layout shactx field count");
26OMBR_ASSERT(offsetof(sha256_ctx, buf) == 40, "layout shactx field buf");
27/* export fn sha256_init c edit shactx to void */
28static inline void sha256_init(sha256_ctx *o_c)
29{
30 uint64_t r = 0;
31 if (omega2_sha256_init(&r, (uint8_t *)o_c) != OMEGA_OK)
32 abort();
33 (void)r;
34}
35/* export fn sha256_update c edit shactx d view uchar * to void */
36static inline void sha256_update(sha256_ctx *o_c, const uint8_t *o_d, size_t o_d_len)
37{
38 uint64_t r = 0;
39 if (omega2_sha256_update(&r, (uint8_t *)o_c, o_d, o_d_len) != OMEGA_OK)
40 abort();
41 (void)r;
42}
43/* export fn sha256_final c edit shactx o out uchar 32 to void */
44static inline void sha256_final(sha256_ctx *o_c, uint8_t o_o[32])
45{
46 uint64_t r = 0;
47 if (omega2_sha256_final(&r, (uint8_t *)o_c, o_o) != OMEGA_OK)
48 abort();
49 (void)r;
50}
51/* export fn sha256_hash d view uchar * o out uchar 32 to void */
52static inline void sha256_hash(const uint8_t *o_d, size_t o_d_len, uint8_t o_o[32])
53{
54 uint64_t r = 0;
55 if (omega2_sha256_hash(&r, o_d, o_d_len, o_o) != OMEGA_OK)
56 abort();
57 (void)r;
58}
59#ifdef __cplusplus
60}
61#endif
62#endif