Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/src/fabric/fab_hmac.h # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / src / fabric / fab_hmac.h` 45 lines ยท 1971 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 /* 18 * fab_hmac.h -- HMAC-SHA256 (RFC 2104) over omega's sha256.c. Used only by the 19 * loopback authenticator (fab_loopback.h), the F5-0 stand-in for a real 20 * per-machine signature. Checked against RFC 4231 in tests/fabric. 21 */ 22 #ifndef FAB_HMAC_H 23 #define FAB_HMAC_H 24 25 /* Lane 32: test-build only. The production program (docs/r16-production-entry-point.md) 26 * never compiles this; the build refuses it without -DAIEN_TEST_BUILD=1. */ 27 #ifndef AIEN_TEST_BUILD 28 #error "fab_hmac.h (HMAC stand-in for a real per-machine signature) is test and simulation only: build with -DAIEN_TEST_BUILD=1, never in the production program" 29 #endif 30 31 #include 32 #include 33 34 int fab_hmac_sha256(const uint8_t *key, size_t key_len, const uint8_t *msg, size_t msg_len, 35 uint8_t out[32]); 36 /* Constant-time compare of n bytes: 1 when equal. */ 37 int fab_ct_equal(const uint8_t *a, const uint8_t *b, size_t n); 38 39 /* Stand-in 64-byte signature (Fabric FAB_SIG_BYTES) from one 32-byte key: 40 * out[0..32] = HMAC(key, msg), out[32..64] = HMAC(k2, msg) with 41 * k2 = HMAC(key, "AFAB stand-in sig64 half 2"). Every byte depends on key and 42 * msg; a verifier recomputes and compares all 64. Not a real signature. */ 43 int fab_hmac_sig64(const uint8_t key[32], const uint8_t *msg, size_t msg_len, uint8_t out[64]); 44 45 #endif