Repository Public
1/**2 * =============================================================================3 * SP BOUCHER | SOFTWARE & RESEARCH4 * ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project : QYVORA8 * File : Sources/QyvoraCSupport/include/qycsupport.h9 * Module : Qyvora CSupport10 * Repository : https://git.spboucher.ai/qyvora11 * Project Website : Not specified12 * Created : 2026-12-0413 * Last Modified : 2026-12-0414 *15 * Author : Simon-Pierre Boucher16 * Position : Professor of Finance17 * Institution : Université du Québec en Outaouais (UQO)18 * Organization : SP Boucher19 * Website : https://spboucher.ai20 * Git : https://git.spboucher.ai21 *22 * Preferred Contact: contact@spboucher.ai23 * Development : dev@spboucher.ai24 * Support : support@spboucher.ai25 * Security/Admin : admin@spboucher.ai26 *27 * Copyright (c) 202628 * Simon-Pierre Boucher29 * All rights reserved where applicable. This file is governed by the30 * applicable project license, copyright notices and relevant law.31 * Existing third-party rights and notices remain unaffected.32 *33 * License : None specified (no license file in this repository)34 *35 * Do not embed credentials, private keys, access tokens,36 * certificates or confidential personal information.37 *38 * =============================================================================39 * END OF SP BOUCHER SOURCE HEADER40 * =============================================================================41 */4243#ifndef QYCSUPPORT_H44#define QYCSUPPORT_H4546/*47 * The only C of the engine: access to the processor's data-independent-timing flag (PSTATE.DIT), which48 * Swift cannot read or write. No dependency, no state besides the cached capability.49 *50 * On ARM64 the duration of some instructions (multiplications, among others) is guaranteed not to depend51 * on their operands only while DIT is set. The system libraries set it around their own cryptography; the52 * engine does the same around its operations on secrets (QYV-CRY-004, QYV-AUD-003).53 */5455/* 1 when the processor implements FEAT_DIT (every Apple silicon Mac and iPhone since A12), else 0. */56int qy_dit_supported(void);5758/* 1 when the flag is set on the calling thread, else 0 (always 0 without FEAT_DIT). */59int qy_dit_enabled(void);6061/*62 * Sets the flag on the calling thread. Returns 0 when this call set it (the caller restores it with63 * qy_dit_restore), 1 when there is nothing to restore: the flag was already set (nested use) or the64 * processor has no such flag.65 */66int qy_dit_enable(void);6768/* Clears the flag when `previous` is 0 (the value returned by the matching qy_dit_enable); otherwise nothing. */69void qy_dit_restore(int previous);7071#endif72