2 Commits
Author SHA1 Message Date
LeoVasanko 9583a1f9a8 Fix cdef size_t size on Win64 (LLP64), require 64-bit builds
release / build-wheels (linux, bash) (push) Successful in 1m12s
release / build-wheels (windows, cmd) (push) Failing after 1m16s
release / build-wheels (macos, bash) (push) Successful in 1m21s
release / publish-pypi (push) Skipped
The generated cdef typedef'd size_t as unsigned long: 8 bytes on LP64
but only 4 on 64-bit Windows, where C's size_t is 8. cffi's import-time
struct layout verification then failed (aegis_raf_scratch.len: cdef
says 4, C compiler says 8). cffi pre-defines size_t/uint8_t with the
correct platform sizes, so don't typedef them.

Also hard-fail 32-bit build attempts in setup.py; 32-bit platforms are
no longer supported.
2026-10-04 17:32:52 +00:00
LeoVasanko c3c4d66ea8 README 2026-10-04 17:31:11 +00:00
4 changed files with 12 additions and 10 deletions

No files matched your search

+4 -4
View File
@@ -123,12 +123,12 @@ Constants (per module): NAME, KEYBYTES, NONCEBYTES, MACBYTES, MACBYTES_LONG, RAT
- nonce_increment(nonce)
- wipe(buffer)
### CSPRNG (aeg.random)
### Random Generator (CSPRNG)
Seeded once from the OS, then a deterministic AEGIS keystream: each call increments the nonce, so no output block ever repeats. random_key() and random_nonce() draw from it.
Seeded once from the OS with random key and nonce, then a cryptographically secure AEGIS keystream: each call increments the nonce, so no output block ever repeats. `random_key()` and `random_nonce()` draw from it. The into variant can directly fill Numpy integer arrays and other structures that support Buffer API, making it far faster than any alternatives (e.g. Numpy's own random module).
- ciph.random() -> per-thread aeg.random.Random singleton for the cipher module
- rng.bytes(n) -> bytearray, rng.into(buf), rng(n)
- random().bytes(n) -> bytearray
- random().into(buffer) -> None
### Random-access encrypted files (aeg.raf)
+5
View File
@@ -9,6 +9,11 @@ from setuptools import setup
ROOT = Path(__file__).parent.resolve()
if sys.maxsize <= 2**32:
raise RuntimeError(
"aeg does not support 32-bit platforms; build with a 64-bit Python"
)
libaegis_static = ROOT / "libaegis/zig-out/lib" / (
"aegis.lib" if sys.platform == "win32" else "libaegis.a"
)
-3
View File
@@ -1,8 +1,5 @@
/* This file is generated with tools/generate.py. Do not edit. */
typedef unsigned char uint8_t;
typedef unsigned long size_t;
/* aegis.h */
int aegis_init(void);
int aegis_verify_16(const uint8_t *x, const uint8_t *y);
+3 -3
View File
@@ -74,12 +74,12 @@ def format_declaration(decl: str, max_width: int = 100) -> str:
def generate_cdef(include_dir: pathlib.Path) -> str:
# cffi pre-defines uint8_t, size_t, etc. with the correct platform sizes.
# Do not typedef them here: "unsigned long" matches size_t on LP64 but is
# 4 bytes vs 8 on Win64 (LLP64), breaking struct layout verification.
lines = [
"/* This file is generated with tools/generate.py. Do not edit. */",
"",
"typedef unsigned char uint8_t;",
"typedef unsigned long size_t;",
"",
]
headers = [