]> gitweb.factorcode.org Git - factor.git/commitdiff
sodium.ffi: add the scrypt functions
authorAlexander Iljin <ajsoft@yandex.ru>
Sun, 10 May 2020 23:00:43 +0000 (01:00 +0200)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 10 May 2020 23:31:37 +0000 (18:31 -0500)
extra/sodium/ffi/const/authors.txt [new file with mode: 0644]
extra/sodium/ffi/const/const.factor [new file with mode: 0644]
extra/sodium/ffi/const/size_max/authors.txt [new file with mode: 0644]
extra/sodium/ffi/const/size_max/size_max.factor [new file with mode: 0644]
extra/sodium/ffi/ffi.factor

diff --git a/extra/sodium/ffi/const/authors.txt b/extra/sodium/ffi/const/authors.txt
new file mode 100644 (file)
index 0000000..8e1955f
--- /dev/null
@@ -0,0 +1 @@
+Alexander Ilin
diff --git a/extra/sodium/ffi/const/const.factor b/extra/sodium/ffi/const/const.factor
new file mode 100644 (file)
index 0000000..c2a71bc
--- /dev/null
@@ -0,0 +1,7 @@
+! Copyright (C) 2020 Alexander Ilin.
+! See http://factorcode.org/license.txt for BSD license.
+USING: layouts literals math.bitwise math.order
+sodium.ffi.const.size_max ;
+IN: sodium.ffi.const
+
+CONSTANT: SODIUM_SIZE_MAX $[ SIZE_MAX 64 on-bits min ]
diff --git a/extra/sodium/ffi/const/size_max/authors.txt b/extra/sodium/ffi/const/size_max/authors.txt
new file mode 100644 (file)
index 0000000..8e1955f
--- /dev/null
@@ -0,0 +1 @@
+Alexander Ilin
diff --git a/extra/sodium/ffi/const/size_max/size_max.factor b/extra/sodium/ffi/const/size_max/size_max.factor
new file mode 100644 (file)
index 0000000..f5379e5
--- /dev/null
@@ -0,0 +1,6 @@
+! Copyright (C) 2020 Alexander Ilin.
+! See http://factorcode.org/license.txt for BSD license.
+USING: layouts literals math.bitwise ;
+IN: sodium.ffi.const.size_max
+
+CONSTANT: SIZE_MAX $[ cell-bits on-bits ]
index 40a2ec7306e660bd7307b08fdd333797d8ecc277..0aec267b439a4b84cb5c4367befd9850bb3f0f4c 100644 (file)
@@ -1,7 +1,8 @@
 ! Copyright (C) 2017, 2018, 2020 Alexander Ilin.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien alien.c-types alien.libraries alien.syntax
-classes.struct combinators system ;
+classes.struct combinators literals math.order
+sodium.ffi.const sodium.ffi.const.size_max system ;
 IN: sodium.ffi
 
 << "sodium" {
@@ -73,6 +74,64 @@ FUNCTION: int crypto_pwhash_argon2id_str_needs_rehash (
     char[crypto_pwhash_argon2id_STRBYTES] str,
     ulonglong opslimit, size_t memlimit )
 
+! crypto_pwhash_scryptsalsa208sha256_H
+CONSTANT: crypto_pwhash_scryptsalsa208sha256_BYTES_MIN 16
+CONSTANT: crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN 0
+CONSTANT: crypto_pwhash_scryptsalsa208sha256_BYTES_MAX $[ SODIUM_SIZE_MAX 0x1fffffffe0 min ]
+CONSTANT: crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX SODIUM_SIZE_MAX
+CONSTANT: crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX $[ SIZE_MAX 68719476736 min ]
+CONSTANT: crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE 16777216
+CONSTANT: crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN 16777216
+CONSTANT: crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE 1073741824
+CONSTANT: crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE 524288
+CONSTANT: crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX 4294967295
+CONSTANT: crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN 32768
+CONSTANT: crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE 33554432
+CONSTANT: crypto_pwhash_scryptsalsa208sha256_SALTBYTES 32
+CONSTANT: crypto_pwhash_scryptsalsa208sha256_STRBYTES 102
+CONSTANT: crypto_pwhash_scryptsalsa208sha256_STRPREFIX "$7$"
+
+FUNCTION: size_t crypto_pwhash_scryptsalsa208sha256_bytes_min ( )
+FUNCTION: size_t crypto_pwhash_scryptsalsa208sha256_bytes_max ( )
+FUNCTION: size_t crypto_pwhash_scryptsalsa208sha256_passwd_min ( )
+FUNCTION: size_t crypto_pwhash_scryptsalsa208sha256_passwd_max ( )
+FUNCTION: size_t crypto_pwhash_scryptsalsa208sha256_memlimit_interactive ( )
+FUNCTION: size_t crypto_pwhash_scryptsalsa208sha256_memlimit_max ( )
+FUNCTION: size_t crypto_pwhash_scryptsalsa208sha256_memlimit_min ( )
+FUNCTION: size_t crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive ( )
+FUNCTION: size_t crypto_pwhash_scryptsalsa208sha256_opslimit_interactive ( )
+FUNCTION: size_t crypto_pwhash_scryptsalsa208sha256_opslimit_max ( )
+FUNCTION: size_t crypto_pwhash_scryptsalsa208sha256_opslimit_min ( )
+FUNCTION: size_t crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive ( )
+FUNCTION: size_t crypto_pwhash_scryptsalsa208sha256_saltbytes ( )
+FUNCTION: size_t crypto_pwhash_scryptsalsa208sha256_strbytes ( )
+FUNCTION: char* crypto_pwhash_scryptsalsa208sha256_strprefix ( )
+
+FUNCTION: int crypto_pwhash_scryptsalsa208sha256 (
+    uchar* out, ulonglong outlen,
+    char* passwd, ulonglong passwdlen,
+    uchar* salt,
+    ulonglong opslimit, size_t memlimit )
+
+FUNCTION: int crypto_pwhash_scryptsalsa208sha256_str (
+    char[crypto_pwhash_scryptsalsa208sha256_STRBYTES] out,
+    char* passwd, ulonglong passwdlen,
+    ulonglong opslimit, size_t memlimit )
+
+FUNCTION: int crypto_pwhash_scryptsalsa208sha256_str_verify (
+    char[crypto_pwhash_scryptsalsa208sha256_STRBYTES] str,
+    char* passwd, ulonglong passwdlen )
+
+FUNCTION: int crypto_pwhash_scryptsalsa208sha256_ll (
+    uint8_t* passwd, size_t passwdlen,
+    uint8_t* salt, size_t saltlen,
+    uint64_t N, uint32_t r, uint32_t p,
+    uint8_t* buf, size_t buflen )
+
+FUNCTION: int crypto_pwhash_scryptsalsa208sha256_str_needs_rehash (
+    char[crypto_pwhash_scryptsalsa208sha256_STRBYTES] str,
+    ulonglong opslimit, size_t memlimit )
+
 ! crypto_pwhash_H
 CONSTANT: crypto_pwhash_STRBYTES 128