statement
stringlengths
1
746
proof
stringlengths
0
19.5k
type
stringclasses
7 values
symbolic_name
stringlengths
1
36
library
stringclasses
13 values
filename
stringclasses
70 values
imports
listlengths
0
23
deps
listlengths
0
14
docstring
stringclasses
1 value
source_url
stringclasses
1 value
commit
stringclasses
1 value
AES256
= 8 /** * Element of an AES key schedule for use in a particular round */
type
AES256
lib
lib/SuiteB.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
AESRoundKey
= [4][32] /** * Expanded encryption key schedule for AES */
type
AESRoundKey
lib
lib/SuiteB.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
AESEncryptKeySchedule k
= { aesEncInitialKey : AESRoundKey , aesEncRoundKeys : [k+5]AESRoundKey , aesEncFinalKey : AESRoundKey } /** * Expanded decryption key schedule for AES */
type
AESEncryptKeySchedule
lib
lib/SuiteB.cry
[]
[ "AESRoundKey" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
AESDecryptKeySchedule k
= { aesDecInitialKey : AESRoundKey , aesDecRoundKeys : [k+5]AESRoundKey , aesDecFinalKey : AESRoundKey } /** * Encryption key expansion for AES-128. * See FIPS 197, section 5.2. */
type
AESDecryptKeySchedule
lib
lib/SuiteB.cry
[]
[ "AESRoundKey" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
sha2_block_size w
= 16 * w
type
sha2_block_size
lib
lib/SuiteB.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
sha2_num_blocks w L
= (L+1+2*w) /^ sha2_block_size w
type
sha2_num_blocks
lib
lib/SuiteB.cry
[]
[ "sha2_block_size" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
sha2_padded_size w L
= sha2_num_blocks w L * sha2_block_size w
type
sha2_padded_size
lib
lib/SuiteB.cry
[]
[ "sha2_block_size", "sha2_num_blocks" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
processSHA2_224 : {n} (fin n) => [n][16][32] -> [7][32] /** * Apply the SHA256 hash algorithm to a sequence of SHA256-size blocks, * which are assumed to already be correctly padded. */
primitive
processSHA2_224
lib
lib/SuiteB.cry
[]
[ "fin" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
processSHA2_256 : {n} (fin n) => [n][16][32] -> [8][32] /** * Apply the SHA384 hash algorithm to a sequence of SHA512-size blocks, * which are assumed to already be correctly padded. */
primitive
processSHA2_256
lib
lib/SuiteB.cry
[]
[ "fin" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
processSHA2_384 : {n} (fin n) => [n][16][64] -> [6][64] /** * Apply the SHA512 hash algorithm to a sequence of SHA512-size blocks, * which are assumed to already be correctly padded. */
primitive
processSHA2_384
lib
lib/SuiteB.cry
[]
[ "fin" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
processSHA2_512 : {n} (fin n) => [n][16][64] -> [8][64]
primitive
processSHA2_512
lib
lib/SuiteB.cry
[]
[ "fin" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
aes128EncryptSchedule : [128] -> AESEncryptKeySchedule AES128
aes128EncryptSchedule = aesExpandEncryptSchedule /** * Decryption key expansion for AES-128, for use in the "equivalent inverse cypher". * See FIPS 197, sections 5.2 and 5.3.5. */
function
aes128EncryptSchedule
lib
lib/SuiteB.cry
[]
[ "AES128", "AESEncryptKeySchedule" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
aes128DecryptSchedule : [128] -> AESDecryptKeySchedule AES128
aes128DecryptSchedule = aesExpandDecryptSchedule /** * Encryption and decryption key schedules for AES-128. * If you will need both schedules, it is slightly more efficient * to call this function than to compute the two schedules separately. * See FIPS 197, sections 5.2 and 5.3.5. */
function
aes128DecryptSchedule
lib
lib/SuiteB.cry
[]
[ "AES128", "AESDecryptKeySchedule" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
aes128Schedules : [128] -> (AESEncryptKeySchedule AES128, AESDecryptKeySchedule AES128)
aes128Schedules = aesExpandSchedules /** * Encryption key expansion for AES-192. * See FIPS 197, section 5.2. */
function
aes128Schedules
lib
lib/SuiteB.cry
[]
[ "AES128", "AESDecryptKeySchedule", "AESEncryptKeySchedule" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
aes192EncryptSchedule : [192] -> AESEncryptKeySchedule AES192
aes192EncryptSchedule = aesExpandEncryptSchedule /** * Decryption key expansion for AES-192, for use in the "equivalent inverse cypher". * See FIPS 197, sections 5.2 and 5.3.5. */
function
aes192EncryptSchedule
lib
lib/SuiteB.cry
[]
[ "AES192", "AESEncryptKeySchedule" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
aes192DecryptSchedule : [192] -> AESDecryptKeySchedule AES192
aes192DecryptSchedule = aesExpandDecryptSchedule /** * Encryption and decryption key schedules for AES-192. * If you will need both schedules, it is slightly more efficient * to call this function than to compute the two schedules separately. * See FIPS 197, sections 5.2 and 5.3.5. */
function
aes192DecryptSchedule
lib
lib/SuiteB.cry
[]
[ "AES192", "AESDecryptKeySchedule" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
aes192Schedules : [192] -> (AESEncryptKeySchedule AES192, AESDecryptKeySchedule AES192)
aes192Schedules = aesExpandSchedules /** * Encryption key expansion for AES-256. * See FIPS 197, section 5.2 */
function
aes192Schedules
lib
lib/SuiteB.cry
[]
[ "AES192", "AESDecryptKeySchedule", "AESEncryptKeySchedule" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
aes256EncryptSchedule : [256] -> AESEncryptKeySchedule AES256
aes256EncryptSchedule = aesExpandEncryptSchedule /** * Decryption key expansion for AES-256, for use in the "equivalent inverse cypher". * See FIPS 197, sections 5.2 and 5.3.5. */
function
aes256EncryptSchedule
lib
lib/SuiteB.cry
[]
[ "AES256", "AESEncryptKeySchedule" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
aes256DecryptSchedule : [256] -> AESDecryptKeySchedule AES256
aes256DecryptSchedule = aesExpandDecryptSchedule /** * Encryption and decryption key schedules for AES-256. * If you will need both schedules, it is slightly more efficient * to call this function than to compute the two schedules separately. * See FIPS 197, sections 5.2 and 5.3.5. */
function
aes256DecryptSchedule
lib
lib/SuiteB.cry
[]
[ "AES256", "AESDecryptKeySchedule" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
aes256Schedules : [256] -> (AESEncryptKeySchedule AES256, AESDecryptKeySchedule AES256)
aes256Schedules = aesExpandSchedules /** * AES block encryption algorithm. * See FIPS 197, section 5.1. */
function
aes256Schedules
lib
lib/SuiteB.cry
[]
[ "AES256", "AESDecryptKeySchedule", "AESEncryptKeySchedule" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
aesEncryptBlock : {k} (fin k) => AESEncryptKeySchedule k -> [128] -> [128]
aesEncryptBlock schedule plaintext = rnf (join final) where final = (AESEncFinalRound (rds!0)) ^ schedule.aesEncFinalKey rds = [ schedule.aesEncInitialKey ^ split plaintext ] # [ AESEncRound r ^ rdk | rdk <- schedule.aesEncRoundKeys | r <- rds ] /** * AES block decryption algo...
function
aesEncryptBlock
lib
lib/SuiteB.cry
[]
[ "AESEncryptKeySchedule", "fin", "join", "rnf", "split" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
aesDecryptBlock : {k} (fin k) => AESDecryptKeySchedule k -> [128] -> [128]
aesDecryptBlock schedule cyphertext = rnf (join final) where final = (AESDecFinalRound (rds!0)) ^ schedule.aesDecFinalKey rds = [ split cyphertext ^ schedule.aesDecInitialKey ] # [ AESDecRound r ^ rdk | rdk <- schedule.aesDecRoundKeys | r <- rds ]
function
aesDecryptBlock
lib
lib/SuiteB.cry
[]
[ "AESDecryptKeySchedule", "fin", "join", "rnf", "split" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
sha224 : {L} (fin L) => [L] -> [224]
sha224 msg = join (processSHA2_224 (sha2blocks`{32} msg)) /** * The SHA-256 secure hash algorithm. See FIPS 180-4, section 6.2.2. */
function
sha224
lib
lib/SuiteB.cry
[]
[ "fin", "join", "processSHA2_224" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
sha256 : {L} (fin L) => [L] -> [256]
sha256 msg = join (processSHA2_256 (sha2blocks`{32} msg)) /** * The SHA-384 secure hash algorithm. See FIPS 180-4, section 6.5. */
function
sha256
lib
lib/SuiteB.cry
[]
[ "fin", "join", "processSHA2_256" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
sha384 : {L} (fin L) => [L] -> [384]
sha384 msg = join (processSHA2_384 (sha2blocks`{64} msg)) /** * The SHA-512 secure hash algorithm. See FIPS 180-4, section 6.4. */
function
sha384
lib
lib/SuiteB.cry
[]
[ "fin", "join", "processSHA2_384" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
sha512 : {L} (fin L) => [L] -> [512]
sha512 msg = join (processSHA2_512 (sha2blocks`{64} msg))
function
sha512
lib
lib/SuiteB.cry
[]
[ "fin", "join", "processSHA2_512" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
sha2pad : {w, L} (fin w, fin L, w >= 1) => [L] -> [sha2_padded_size w L]
sha2pad M = rnf (M # 0b1 # zero # ((fromInteger `L) : [2*w]))
function
sha2pad
lib
lib/SuiteB.cry
[]
[ ">=", "fin", "fromInteger", "rnf", "zero" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
sha2blocks : {w, L} (fin w, fin L, w >= 1) => [L] -> [sha2_num_blocks w L][16][w]
sha2blocks msg = [ split x | x <- split (sha2pad`{w} msg) ] /** * Apply the SHA224 hash algorithm to a sequence of SHA256-size blocks, * which are assumed to already be correctly padded. */
function
sha2blocks
lib
lib/SuiteB.cry
[]
[ ">=", "fin", "split" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
pmult : {u, v} (fin u, fin v) => [1 + u] -> [1 + v] -> [1 + u + v]
pmult x y = last zs where zs = [0] # [ (z << 1) ^ (if yi then 0 # x else 0) | yi <- y | z <- zs ] /** * Performs division of polynomials over GF(2). * Reference implementation. */
function
pmult
lib.Cryptol
lib/Cryptol/Reference.cry
[]
[ "<<", "fin", "last" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
pdiv : {u, v} (fin u, fin v) => [u] -> [v] -> [u]
pdiv x y = [ z ! degree | z <- zs ] where degree : [width v] degree = last (ds : [1 + v]_) where ds = [0/0] # [if yi then i else d | yi <- reverse y | i <- [0..v] | d <- ds ] reduce : [v] -> [v] reduce u = if u ! degree then u ^ y else u zs : [u][v] zs = [ tail (reduce z # [xi]) | z <-...
function
pdiv
lib.Cryptol
lib/Cryptol/Reference.cry
[]
[ "fin", "last", "reverse", "tail" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
pmod : {u, v} (fin u, fin v) => [u] -> [1 + v] -> [v]
pmod x y = if y == 0 then 0/0 else last zs where degree : [width v] degree = last (ds : [2 + v]_) where ds = [0/0] # [if yi then i else d | yi <- reverse y | i <- [0..v] | d <- ds ] reduce : [1 + v] -> [1 + v] reduce u = if u ! degree then u ^ y else u powers : [inf][1 + v] powers = [r...
function
pmod
lib.Cryptol
lib/Cryptol/Reference.cry
[]
[ "<<", "==", "fin", "last", "reverse", "tail" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
foldl : {n, a, b} (fin n) => (a -> b -> a) -> a -> [n]b -> a
foldl f z bs = last (scanl f z bs) /** * Scan left is like a foldl that also emits the intermediate values. * * Reference implementation. */
function
foldl
lib.Cryptol
lib/Cryptol/Reference.cry
[]
[ "fin", "last", "scanl" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
scanl : {n, a, b} (a -> b -> a) -> a -> [n]b -> [1+n]a
scanl f z bs = as where as = [z] # [ f a b | a <- as | b <- bs ] /** * Map a function iteratively over a seed value, producing an infinite * list of successive function applications. * * Reference implementation. */
function
scanl
lib.Cryptol
lib/Cryptol/Reference.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
iterate : {a} (a -> a) -> a -> [inf]a
iterate f z = xs where xs = [z] # [ f x | x <- xs ]
function
iterate
lib.Cryptol
lib/Cryptol/Reference.cry
[]
[ "xs" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
N
= { unN : [8] }
newtype
N
rust.cry-ffi
rust/cry-ffi/Example.cry
[ "Float" ]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
foreign abstract test_bool : Bit -> Bit
function
foreign
rust.cry-ffi
rust/cry-ffi/Example.cry
[ "Float" ]
[ "Bit" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb