From 2ba1db0362be2b6c867cb3be1ec7661b4f0f68b5 Mon Sep 17 00:00:00 2001 From: Alexander Iljin Date: Sun, 22 Mar 2020 17:37:07 +0100 Subject: [PATCH] sodium.ffi: fix the array parameters in the function declarations Add a couple of necessary constants. --- extra/sodium/ffi/ffi.factor | 69 ++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/extra/sodium/ffi/ffi.factor b/extra/sodium/ffi/ffi.factor index a5fc6dfc34..b9b704aaa5 100644 --- a/extra/sodium/ffi/ffi.factor +++ b/extra/sodium/ffi/ffi.factor @@ -20,7 +20,12 @@ FUNCTION: uint32_t randombytes_random ( ) FUNCTION: uint32_t randombytes_uniform ( uint32_t upper_bound ) FUNCTION: void randombytes_stir ( ) +! crypto_pwhash_argon2id_H +CONSTANT: crypto_pwhash_argon2id_STRBYTES 128 + ! crypto_pwhash_H +CONSTANT: crypto_pwhash_STRBYTES 128 + FUNCTION: int crypto_pwhash_alg_argon2i13 ( ) FUNCTION: int crypto_pwhash_alg_default ( ) FUNCTION: size_t crypto_pwhash_saltbytes ( ) @@ -38,11 +43,11 @@ FUNCTION: int crypto_pwhash ( uchar* salt, ulonglong opslimit, size_t memlimit, int alg ) FUNCTION: int crypto_pwhash_str ( - char* out[crypto_pwhash_STRBYTES], + char[crypto_pwhash_STRBYTES]* out, char* passwd, ulonglong passwdlen, ulonglong opslimit, size_t memlimit ) FUNCTION: int crypto_pwhash_str_verify ( - char* str[crypto_pwhash_STRBYTES], + char[crypto_pwhash_STRBYTES]* str, char* passwd, ulonglong passwdlen ) FUNCTION: char* crypto_pwhash_primitive ( ) @@ -133,7 +138,7 @@ FUNCTION: int crypto_secretbox_open_detached ( uchar* m, uchar* c, uchar* mac, ulonglong clen, uchar* n, uchar* k ) FUNCTION: void crypto_secretbox_keygen ( - uchar k[crypto_secretbox_keybytes] ) + uchar[crypto_secretbox_keybytes] k ) ! crypto_box_H FUNCTION: size_t crypto_box_seedbytes ( ) @@ -183,7 +188,7 @@ FUNCTION: int crypto_auth ( uchar* out, uchar* in, ulonglong inlen, uchar* k ) FUNCTION: int crypto_auth_verify ( uchar* h, uchar* in, ulonglong inlen, uchar* k ) -FUNCTION: void crypto_auth_keygen ( uchar k[crypto_auth_keybytes] ) +FUNCTION: void crypto_auth_keygen ( uchar[crypto_auth_keybytes] k ) ! crypto_hash_sha256_H CONSTANT: crypto_hash_sha256_BYTES 32 @@ -225,7 +230,7 @@ FUNCTION: int crypto_auth_hmacsha256_update ( FUNCTION: int crypto_auth_hmacsha256_final ( crypto_auth_hmacsha256_state* state, uchar* out ) FUNCTION: void crypto_auth_hmacsha256_keygen ( - uchar k[crypto_auth_hmacsha256_KEYBYTES] ) + uchar[crypto_auth_hmacsha256_KEYBYTES] k ) ! crypto_hash_sha512_H CONSTANT: crypto_hash_sha512_BYTES 64 @@ -268,7 +273,7 @@ FUNCTION: int crypto_auth_hmacsha512_update ( FUNCTION: int crypto_auth_hmacsha512_final ( crypto_auth_hmacsha512_state* state, uchar* out ) FUNCTION: void crypto_auth_hmacsha512_keygen ( - uchar k[crypto_auth_hmacsha512_KEYBYTES] ) + uchar[crypto_auth_hmacsha512_KEYBYTES] k ) ! crypto_auth_hmacsha512256_H CONSTANT: crypto_auth_hmacsha512256_BYTES 32 @@ -292,7 +297,7 @@ FUNCTION: int crypto_auth_hmacsha512256_update ( FUNCTION: int crypto_auth_hmacsha512256_final ( crypto_auth_hmacsha512256_state* state, uchar* out ) FUNCTION: void crypto_auth_hmacsha512256_keygen ( - uchar k[crypto_auth_hmacsha512256_KEYBYTES] ) + uchar[crypto_auth_hmacsha512256_KEYBYTES] k ) ! crypto_kdf_H FUNCTION: size_t crypto_kdf_bytes_min ( ) @@ -303,9 +308,9 @@ FUNCTION: char* crypto_kdf_primitive ( ) FUNCTION: int crypto_kdf_derive_from_key ( uchar* subkey, size_t subkey_len, uint64_t subkey_id, - char ctx[crypto_kdf_contextbytes], - uchar key[crypto_kdf_keybytes] ) -FUNCTION: void crypto_kdf_keygen ( uchar k[crypto_kdf_keybytes] ) + char[crypto_kdf_contextbytes] ctx, + uchar[crypto_kdf_keybytes] key ) +FUNCTION: void crypto_kdf_keygen ( uchar[crypto_kdf_keybytes] k ) ! crypto_kx_H FUNCTION: size_t crypto_kx_publickeybytes ( ) @@ -314,24 +319,24 @@ FUNCTION: size_t crypto_kx_seedbytes ( ) FUNCTION: size_t crypto_kx_sessionkeybytes ( ) FUNCTION: char* crypto_kx_primitive ( ) FUNCTION: int crypto_kx_seed_keypair ( - uchar pk[crypto_kx_publickeybytes], - uchar sk[crypto_kx_secretkeybytes], - uchar seed[crypto_kx_seedbytes] ) + uchar[crypto_kx_publickeybytes] pk, + uchar[crypto_kx_secretkeybytes] sk, + uchar[crypto_kx_seedbytes] seed ) FUNCTION: int crypto_kx_keypair ( - uchar pk[crypto_kx_publickeybytes], - uchar sk[crypto_kx_secretkeybytes] ) + uchar[crypto_kx_publickeybytes] pk, + uchar[crypto_kx_secretkeybytes] sk ) FUNCTION: int crypto_kx_client_session_keys ( - uchar rx[crypto_kx_sessionkeybytes], - uchar tx[crypto_kx_sessionkeybytes], - uchar client_pk[crypto_kx_publickeybytes], - uchar client_sk[crypto_kx_secretkeybytes], - uchar server_pk[crypto_kx_publickeybytes] ) + uchar[crypto_kx_sessionkeybytes] rx, + uchar[crypto_kx_sessionkeybytes] tx, + uchar[crypto_kx_publickeybytes] client_pk, + uchar[crypto_kx_secretkeybytes] client_sk, + uchar[crypto_kx_publickeybytes] server_pk ) FUNCTION: int crypto_kx_server_session_keys ( - uchar rx[crypto_kx_sessionkeybytes], - uchar tx[crypto_kx_sessionkeybytes], - uchar server_pk[crypto_kx_publickeybytes], - uchar server_sk[crypto_kx_secretkeybytes], - uchar client_pk[crypto_kx_publickeybytes] ) + uchar[crypto_kx_sessionkeybytes] rx, + uchar[crypto_kx_sessionkeybytes] tx, + uchar[crypto_kx_publickeybytes] server_pk, + uchar[crypto_kx_secretkeybytes] server_sk, + uchar[crypto_kx_publickeybytes] client_pk ) ! crypto_onetimeauth_H STRUCT: crypto_onetimeauth_state @@ -352,7 +357,7 @@ FUNCTION: int crypto_onetimeauth_update ( FUNCTION: int crypto_onetimeauth_final ( crypto_onetimeauth_state *state, uchar* out ) FUNCTION: void crypto_onetimeauth_keygen ( - uchar k[crypto_onetimeauth_keybytes] ) + uchar[crypto_onetimeauth_keybytes] k ) ! crypto_sign_H STRUCT: crypto_sign_state @@ -418,7 +423,7 @@ FUNCTION: int crypto_aead_xchacha20poly1305_ietf_decrypt_detached ( uchar* ad, ulonglong adlen, uchar* npub, uchar* k ) FUNCTION: void crypto_aead_xchacha20poly1305_ietf_keygen ( - uchar k[crypto_aead_xchacha20poly1305_ietf_keybytes] ) + uchar[crypto_aead_xchacha20poly1305_ietf_keybytes] k ) ! crypto_secretstream_xchacha20poly1305_H FUNCTION: size_t crypto_secretstream_xchacha20poly1305_abytes ( ) @@ -438,11 +443,11 @@ STRUCT: crypto_secretstream_xchacha20poly1305_state ; FUNCTION: size_t crypto_secretstream_xchacha20poly1305_statebytes ( ) FUNCTION: void crypto_secretstream_xchacha20poly1305_keygen ( - uchar k[crypto_secretstream_xchacha20poly1305_keybytes] ) + uchar[crypto_secretstream_xchacha20poly1305_keybytes] k ) FUNCTION: int crypto_secretstream_xchacha20poly1305_init_push ( crypto_secretstream_xchacha20poly1305_state* state, - uchar header[crypto_secretstream_xchacha20poly1305_headerbytes], - uchar k[crypto_secretstream_xchacha20poly1305_keybytes] ) + uchar[crypto_secretstream_xchacha20poly1305_headerbytes] header, + uchar[crypto_secretstream_xchacha20poly1305_keybytes] k ) FUNCTION: int crypto_secretstream_xchacha20poly1305_push ( crypto_secretstream_xchacha20poly1305_state* state, uchar* c, ulonglong* clen_p, @@ -450,8 +455,8 @@ FUNCTION: int crypto_secretstream_xchacha20poly1305_push ( uchar* ad, ulonglong adlen, uchar tag ) FUNCTION: int crypto_secretstream_xchacha20poly1305_init_pull ( crypto_secretstream_xchacha20poly1305_state* state, - uchar header[crypto_secretstream_xchacha20poly1305_headerbytes], - uchar k[crypto_secretstream_xchacha20poly1305_keybytes] ) + uchar[crypto_secretstream_xchacha20poly1305_headerbytes] header, + uchar[crypto_secretstream_xchacha20poly1305_keybytes] k ) FUNCTION: int crypto_secretstream_xchacha20poly1305_pull ( crypto_secretstream_xchacha20poly1305_state* state, uchar* m, ulonglong* mlen_p, uchar* tag_p,