mirror of
https://github.com/codex-storage/constantine.git
synced 2025-02-04 06:53:23 +00:00
a2a2495351
* Github Action CI (without GMP) * Deactivate MacOS, spurious failures: https://github.com/actions/virtual-environments/issues/841 * force install with nimble * Add badge * Don"t include Nim 1.2.x https://github.com/mratsim/constantine/pull/20#issuecomment-646327952 * Action branch mistake * Add back OSX? https://github.com/actions/virtual-environments/issues/841, https://github.com/actions/virtual-environments/issues/969 * fix MacOS target * comment out RDTSC on i386 * Add initialization canaries * Add more verbose output to debug windows failures * spurious windows i386 test * For now only activate Linux and mac * missed include
32 lines
1.1 KiB
Nim
32 lines
1.1 KiB
Nim
# Constantine
|
|
# Copyright (c) 2018-2019 Status Research & Development GmbH
|
|
# Copyright (c) 2020-Present Mamy André-Ratsimbazafy
|
|
# Licensed and distributed under either of
|
|
# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT).
|
|
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
|
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
|
|
|
import
|
|
../../constantine/arithmetic/bigints,
|
|
../../constantine/config/[common, curves],
|
|
../../constantine/elliptic/[ec_weierstrass_affine, ec_weierstrass_projective]
|
|
|
|
# Canaries
|
|
# --------------------------------------------------------------
|
|
#
|
|
# This file initializes a type with canary
|
|
# to detect initialization bugs that are silent
|
|
# when initialized from zero.
|
|
|
|
when sizeof(SecretWord) == 8:
|
|
const Canary = SecretWord(0xAAFACADEAAFACADE'u64)
|
|
else:
|
|
const Canary = SecretWord(0xAAFACADE'u32)
|
|
|
|
func canary*(T: typedesc): T =
|
|
when T is BigInt:
|
|
for i in 0 ..< result.limbs.len:
|
|
result.limbs[0] = Canary
|
|
else:
|
|
{.error: "Not implemented".}
|