mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 01:02:24 +00:00
testcrypt.h: invent FUNC_WRAPPED.
FUNC_WRAPPED is an alternative keyword to FUNC which you can use to introduce a function specification in testcrypt.h, indicating that the function is _not_ the one of the same name used in the main PuTTY code, but instead a wrapper on it in testcrypt.c whose API was reworked to be more friendly to translation into Python. There are a lot of those wrappers already, and previously they passed without comment in testcrypt.h, and were put into service by #defining over the top of each name before expanding the marshalling functions. Now, all those #defines are gone, because the use of FUNC_WRAPPED in testcrypt.h is enough to clue in the marshalling wrapper to be generated with a call to foo_wrapper() instead of foo(). Mostly the purpose of this is to make testcrypt.h a bit more self-documenting: if you see FUNC_WRAPPED, you know not to be confused by the Python and C function definitions totally failing to match.
This commit is contained in:
parent
3743859f97
commit
3153f3ef39
@ -327,7 +327,8 @@ def _parse_testcrypt_header(tokens):
|
||||
return tok
|
||||
|
||||
while True:
|
||||
tok = expect("FUNC", "at start of function specification", eof_ok=True)
|
||||
tok = expect({"FUNC", "FUNC_WRAPPED"},
|
||||
"at start of function specification", eof_ok=True)
|
||||
if tok is None:
|
||||
break
|
||||
|
||||
|
71
testcrypt.c
71
testcrypt.c
@ -880,13 +880,11 @@ mp_int *monty_identity_wrapper(MontyContext *mc)
|
||||
{
|
||||
return mp_copy(monty_identity(mc));
|
||||
}
|
||||
#define monty_identity monty_identity_wrapper
|
||||
|
||||
mp_int *monty_modulus_wrapper(MontyContext *mc)
|
||||
{
|
||||
return mp_copy(monty_modulus(mc));
|
||||
}
|
||||
#define monty_modulus monty_modulus_wrapper
|
||||
|
||||
strbuf *ssh_hash_digest_wrapper(ssh_hash *h)
|
||||
{
|
||||
@ -895,8 +893,6 @@ strbuf *ssh_hash_digest_wrapper(ssh_hash *h)
|
||||
ssh_hash_digest(h, p);
|
||||
return sb;
|
||||
}
|
||||
#undef ssh_hash_digest
|
||||
#define ssh_hash_digest ssh_hash_digest_wrapper
|
||||
|
||||
strbuf *ssh_hash_final_wrapper(ssh_hash *h)
|
||||
{
|
||||
@ -905,8 +901,6 @@ strbuf *ssh_hash_final_wrapper(ssh_hash *h)
|
||||
ssh_hash_final(h, p);
|
||||
return sb;
|
||||
}
|
||||
#undef ssh_hash_final
|
||||
#define ssh_hash_final ssh_hash_final_wrapper
|
||||
|
||||
void ssh_cipher_setiv_wrapper(ssh_cipher *c, ptrlen iv)
|
||||
{
|
||||
@ -915,8 +909,6 @@ void ssh_cipher_setiv_wrapper(ssh_cipher *c, ptrlen iv)
|
||||
ssh_cipher_alg(c)->blksize);
|
||||
ssh_cipher_setiv(c, iv.ptr);
|
||||
}
|
||||
#undef ssh_cipher_setiv
|
||||
#define ssh_cipher_setiv ssh_cipher_setiv_wrapper
|
||||
|
||||
void ssh_cipher_setkey_wrapper(ssh_cipher *c, ptrlen key)
|
||||
{
|
||||
@ -925,8 +917,6 @@ void ssh_cipher_setkey_wrapper(ssh_cipher *c, ptrlen key)
|
||||
ssh_cipher_alg(c)->padded_keybytes);
|
||||
ssh_cipher_setkey(c, key.ptr);
|
||||
}
|
||||
#undef ssh_cipher_setkey
|
||||
#define ssh_cipher_setkey ssh_cipher_setkey_wrapper
|
||||
|
||||
strbuf *ssh_cipher_encrypt_wrapper(ssh_cipher *c, ptrlen input)
|
||||
{
|
||||
@ -938,8 +928,6 @@ strbuf *ssh_cipher_encrypt_wrapper(ssh_cipher *c, ptrlen input)
|
||||
ssh_cipher_encrypt(c, sb->u, sb->len);
|
||||
return sb;
|
||||
}
|
||||
#undef ssh_cipher_encrypt
|
||||
#define ssh_cipher_encrypt ssh_cipher_encrypt_wrapper
|
||||
|
||||
strbuf *ssh_cipher_decrypt_wrapper(ssh_cipher *c, ptrlen input)
|
||||
{
|
||||
@ -951,8 +939,6 @@ strbuf *ssh_cipher_decrypt_wrapper(ssh_cipher *c, ptrlen input)
|
||||
ssh_cipher_decrypt(c, sb->u, sb->len);
|
||||
return sb;
|
||||
}
|
||||
#undef ssh_cipher_decrypt
|
||||
#define ssh_cipher_decrypt ssh_cipher_decrypt_wrapper
|
||||
|
||||
strbuf *ssh_cipher_encrypt_length_wrapper(ssh_cipher *c, ptrlen input,
|
||||
unsigned long seq)
|
||||
@ -964,8 +950,6 @@ strbuf *ssh_cipher_encrypt_length_wrapper(ssh_cipher *c, ptrlen input,
|
||||
ssh_cipher_encrypt_length(c, sb->u, sb->len, seq);
|
||||
return sb;
|
||||
}
|
||||
#undef ssh_cipher_encrypt_length
|
||||
#define ssh_cipher_encrypt_length ssh_cipher_encrypt_length_wrapper
|
||||
|
||||
strbuf *ssh_cipher_decrypt_length_wrapper(ssh_cipher *c, ptrlen input,
|
||||
unsigned long seq)
|
||||
@ -977,8 +961,6 @@ strbuf *ssh_cipher_decrypt_length_wrapper(ssh_cipher *c, ptrlen input,
|
||||
ssh_cipher_decrypt_length(c, sb->u, sb->len, seq);
|
||||
return sb;
|
||||
}
|
||||
#undef ssh_cipher_decrypt_length
|
||||
#define ssh_cipher_decrypt_length ssh_cipher_decrypt_length_wrapper
|
||||
|
||||
strbuf *ssh2_mac_genresult_wrapper(ssh2_mac *m)
|
||||
{
|
||||
@ -987,14 +969,11 @@ strbuf *ssh2_mac_genresult_wrapper(ssh2_mac *m)
|
||||
ssh2_mac_genresult(m, u);
|
||||
return sb;
|
||||
}
|
||||
#undef ssh2_mac_genresult
|
||||
#define ssh2_mac_genresult ssh2_mac_genresult_wrapper
|
||||
|
||||
bool dh_validate_f_wrapper(dh_ctx *dh, mp_int *f)
|
||||
{
|
||||
return dh_validate_f(dh, f) == NULL;
|
||||
}
|
||||
#define dh_validate_f dh_validate_f_wrapper
|
||||
|
||||
void ssh_hash_update(ssh_hash *h, ptrlen pl)
|
||||
{
|
||||
@ -1026,7 +1005,6 @@ strbuf *rsa_ssh1_encrypt_wrapper(ptrlen input, RSAKey *key)
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
#define rsa_ssh1_encrypt rsa_ssh1_encrypt_wrapper
|
||||
|
||||
strbuf *rsa_ssh1_decrypt_pkcs1_wrapper(mp_int *input, RSAKey *key)
|
||||
{
|
||||
@ -1036,7 +1014,6 @@ strbuf *rsa_ssh1_decrypt_pkcs1_wrapper(mp_int *input, RSAKey *key)
|
||||
strbuf_clear(sb);
|
||||
return sb;
|
||||
}
|
||||
#define rsa_ssh1_decrypt_pkcs1 rsa_ssh1_decrypt_pkcs1_wrapper
|
||||
|
||||
strbuf *des_encrypt_xdmauth_wrapper(ptrlen key, ptrlen data)
|
||||
{
|
||||
@ -1049,7 +1026,6 @@ strbuf *des_encrypt_xdmauth_wrapper(ptrlen key, ptrlen data)
|
||||
des_encrypt_xdmauth(key.ptr, sb->u, sb->len);
|
||||
return sb;
|
||||
}
|
||||
#define des_encrypt_xdmauth des_encrypt_xdmauth_wrapper
|
||||
|
||||
strbuf *des_decrypt_xdmauth_wrapper(ptrlen key, ptrlen data)
|
||||
{
|
||||
@ -1062,7 +1038,6 @@ strbuf *des_decrypt_xdmauth_wrapper(ptrlen key, ptrlen data)
|
||||
des_decrypt_xdmauth(key.ptr, sb->u, sb->len);
|
||||
return sb;
|
||||
}
|
||||
#define des_decrypt_xdmauth des_decrypt_xdmauth_wrapper
|
||||
|
||||
strbuf *des3_encrypt_pubkey_wrapper(ptrlen key, ptrlen data)
|
||||
{
|
||||
@ -1075,7 +1050,6 @@ strbuf *des3_encrypt_pubkey_wrapper(ptrlen key, ptrlen data)
|
||||
des3_encrypt_pubkey(key.ptr, sb->u, sb->len);
|
||||
return sb;
|
||||
}
|
||||
#define des3_encrypt_pubkey des3_encrypt_pubkey_wrapper
|
||||
|
||||
strbuf *des3_decrypt_pubkey_wrapper(ptrlen key, ptrlen data)
|
||||
{
|
||||
@ -1088,7 +1062,6 @@ strbuf *des3_decrypt_pubkey_wrapper(ptrlen key, ptrlen data)
|
||||
des3_decrypt_pubkey(key.ptr, sb->u, sb->len);
|
||||
return sb;
|
||||
}
|
||||
#define des3_decrypt_pubkey des3_decrypt_pubkey_wrapper
|
||||
|
||||
strbuf *des3_encrypt_pubkey_ossh_wrapper(ptrlen key, ptrlen iv, ptrlen data)
|
||||
{
|
||||
@ -1103,7 +1076,6 @@ strbuf *des3_encrypt_pubkey_ossh_wrapper(ptrlen key, ptrlen iv, ptrlen data)
|
||||
des3_encrypt_pubkey_ossh(key.ptr, iv.ptr, sb->u, sb->len);
|
||||
return sb;
|
||||
}
|
||||
#define des3_encrypt_pubkey_ossh des3_encrypt_pubkey_ossh_wrapper
|
||||
|
||||
strbuf *des3_decrypt_pubkey_ossh_wrapper(ptrlen key, ptrlen iv, ptrlen data)
|
||||
{
|
||||
@ -1118,7 +1090,6 @@ strbuf *des3_decrypt_pubkey_ossh_wrapper(ptrlen key, ptrlen iv, ptrlen data)
|
||||
des3_decrypt_pubkey_ossh(key.ptr, iv.ptr, sb->u, sb->len);
|
||||
return sb;
|
||||
}
|
||||
#define des3_decrypt_pubkey_ossh des3_decrypt_pubkey_ossh_wrapper
|
||||
|
||||
strbuf *aes256_encrypt_pubkey_wrapper(ptrlen key, ptrlen iv, ptrlen data)
|
||||
{
|
||||
@ -1133,7 +1104,6 @@ strbuf *aes256_encrypt_pubkey_wrapper(ptrlen key, ptrlen iv, ptrlen data)
|
||||
aes256_encrypt_pubkey(key.ptr, iv.ptr, sb->u, sb->len);
|
||||
return sb;
|
||||
}
|
||||
#define aes256_encrypt_pubkey aes256_encrypt_pubkey_wrapper
|
||||
|
||||
strbuf *aes256_decrypt_pubkey_wrapper(ptrlen key, ptrlen iv, ptrlen data)
|
||||
{
|
||||
@ -1148,7 +1118,6 @@ strbuf *aes256_decrypt_pubkey_wrapper(ptrlen key, ptrlen iv, ptrlen data)
|
||||
aes256_decrypt_pubkey(key.ptr, iv.ptr, sb->u, sb->len);
|
||||
return sb;
|
||||
}
|
||||
#define aes256_decrypt_pubkey aes256_decrypt_pubkey_wrapper
|
||||
|
||||
strbuf *prng_read_wrapper(prng *pr, size_t size)
|
||||
{
|
||||
@ -1156,7 +1125,6 @@ strbuf *prng_read_wrapper(prng *pr, size_t size)
|
||||
prng_read(pr, strbuf_append(sb, size), size);
|
||||
return sb;
|
||||
}
|
||||
#define prng_read prng_read_wrapper
|
||||
|
||||
void prng_seed_update(prng *pr, ptrlen data)
|
||||
{
|
||||
@ -1192,7 +1160,6 @@ ssh_key *ppk_load_s_wrapper(BinarySource *src, char **comment,
|
||||
sfree(uk);
|
||||
return toret;
|
||||
}
|
||||
#define ppk_load_s ppk_load_s_wrapper
|
||||
|
||||
int rsa1_load_s_wrapper(BinarySource *src, RSAKey *rsa, char **comment,
|
||||
const char *passphrase, const char **errorstr)
|
||||
@ -1202,7 +1169,6 @@ int rsa1_load_s_wrapper(BinarySource *src, RSAKey *rsa, char **comment,
|
||||
rsa->comment = NULL;
|
||||
return toret;
|
||||
}
|
||||
#define rsa1_load_s rsa1_load_s_wrapper
|
||||
|
||||
strbuf *ppk_save_sb_wrapper(
|
||||
ssh_key *key, const char *comment, const char *passphrase,
|
||||
@ -1229,7 +1195,6 @@ strbuf *ppk_save_sb_wrapper(
|
||||
sfree(uk.comment);
|
||||
return toret;
|
||||
}
|
||||
#define ppk_save_sb ppk_save_sb_wrapper
|
||||
|
||||
strbuf *rsa1_save_sb_wrapper(RSAKey *key, const char *comment,
|
||||
const char *passphrase)
|
||||
@ -1240,7 +1205,6 @@ strbuf *rsa1_save_sb_wrapper(RSAKey *key, const char *comment,
|
||||
key->comment = NULL;
|
||||
return toret;
|
||||
}
|
||||
#define rsa1_save_sb rsa1_save_sb_wrapper
|
||||
|
||||
#define return_void(out, expression) (expression)
|
||||
|
||||
@ -1251,7 +1215,6 @@ mp_int *primegen_generate_wrapper(
|
||||
{
|
||||
return primegen_generate(ctx, pcs, &null_progress);
|
||||
}
|
||||
#define primegen_generate primegen_generate_wrapper
|
||||
|
||||
RSAKey *rsa1_generate(int bits, bool strong, PrimeGenerationContext *pgc)
|
||||
{
|
||||
@ -1266,7 +1229,6 @@ ssh_key *rsa_generate_wrapper(int bits, bool strong,
|
||||
{
|
||||
return &rsa1_generate(bits, strong, pgc)->sshk;
|
||||
}
|
||||
#define rsa_generate rsa_generate_wrapper
|
||||
|
||||
ssh_key *dsa_generate_wrapper(int bits, PrimeGenerationContext *pgc)
|
||||
{
|
||||
@ -1274,7 +1236,6 @@ ssh_key *dsa_generate_wrapper(int bits, PrimeGenerationContext *pgc)
|
||||
dsa_generate(dsakey, bits, pgc, &null_progress);
|
||||
return &dsakey->sshk;
|
||||
}
|
||||
#define dsa_generate dsa_generate_wrapper
|
||||
|
||||
ssh_key *ecdsa_generate_wrapper(int bits)
|
||||
{
|
||||
@ -1285,7 +1246,6 @@ ssh_key *ecdsa_generate_wrapper(int bits)
|
||||
}
|
||||
return &ek->sshk;
|
||||
}
|
||||
#define ecdsa_generate ecdsa_generate_wrapper
|
||||
|
||||
ssh_key *eddsa_generate_wrapper(int bits)
|
||||
{
|
||||
@ -1296,7 +1256,6 @@ ssh_key *eddsa_generate_wrapper(int bits)
|
||||
}
|
||||
return &ek->sshk;
|
||||
}
|
||||
#define eddsa_generate eddsa_generate_wrapper
|
||||
|
||||
size_t key_components_count(key_components *kc) { return kc->ncomponents; }
|
||||
const char *key_components_nth_name(key_components *kc, size_t n)
|
||||
@ -1322,7 +1281,6 @@ PockleStatus pockle_add_prime_wrapper(Pockle *pockle, mp_int *p,
|
||||
{
|
||||
return pockle_add_prime(pockle, p, mpl.integers, mpl.n, witness);
|
||||
}
|
||||
#define pockle_add_prime pockle_add_prime_wrapper
|
||||
|
||||
strbuf *argon2_wrapper(Argon2Flavour flavour, uint32_t mem, uint32_t passes,
|
||||
uint32_t parallel, uint32_t taglen,
|
||||
@ -1332,7 +1290,6 @@ strbuf *argon2_wrapper(Argon2Flavour flavour, uint32_t mem, uint32_t passes,
|
||||
argon2(flavour, mem, passes, parallel, taglen, P, S, K, X, out);
|
||||
return out;
|
||||
}
|
||||
#define argon2 argon2_wrapper
|
||||
|
||||
strbuf *get_implementations_commasep(ptrlen alg)
|
||||
{
|
||||
@ -1590,20 +1547,25 @@ typedef HttpDigestHash TD_httpdigesthash;
|
||||
|
||||
#define DEPARENTHESISE(...) __VA_ARGS__
|
||||
|
||||
#define FUNC(outtype, fname, args) \
|
||||
FUNC_INNER(outtype, fname, fname, args)
|
||||
#define FUNC_WRAPPED(outtype, fname, args) \
|
||||
FUNC_INNER(outtype, fname, fname##_wrapper, args)
|
||||
|
||||
#define ARG(type, arg) _predummy_##arg; TD_##type arg; int _postdummy_##arg
|
||||
#define VOID _voiddummy
|
||||
#define FUNC(outtype, fname, args) \
|
||||
typedef struct ARGS_##fname { \
|
||||
int DEPARENTHESISE args; \
|
||||
#define FUNC_INNER(outtype, fname, realname, args) \
|
||||
typedef struct ARGS_##fname { \
|
||||
int DEPARENTHESISE args; \
|
||||
} ARGS_##fname;
|
||||
#include "testcrypt.h"
|
||||
#undef FUNC
|
||||
#undef FUNC_INNER
|
||||
#undef ARG
|
||||
#undef VOID
|
||||
|
||||
#define ARG(type, arg) _args.arg = get_##type(_in)
|
||||
#define VOID ((void)0)
|
||||
#define FUNC(outtype, fname, args) \
|
||||
#define FUNC_INNER(outtype, fname, realname, args) \
|
||||
static inline ARGS_##fname get_args_##fname(BinarySource *_in) { \
|
||||
ARGS_##fname _args; \
|
||||
memset(&_args, 0, sizeof(_args)); \
|
||||
@ -1611,20 +1573,20 @@ typedef HttpDigestHash TD_httpdigesthash;
|
||||
return _args; \
|
||||
}
|
||||
#include "testcrypt.h"
|
||||
#undef FUNC
|
||||
#undef FUNC_INNER
|
||||
#undef ARG
|
||||
#undef VOID
|
||||
|
||||
#define ARG(type, arg) _args.arg
|
||||
#define VOID
|
||||
#define FUNC(outtype, fname, args) \
|
||||
#define FUNC_INNER(outtype, fname, realname, args) \
|
||||
static void handle_##fname(BinarySource *_in, strbuf *_out) { \
|
||||
ARGS_##fname _args = get_args_##fname(_in); \
|
||||
(void)_args; /* suppress warning if no actual arguments */ \
|
||||
return_##outtype(_out, fname args); \
|
||||
return_##outtype(_out, realname args); \
|
||||
}
|
||||
#include "testcrypt.h"
|
||||
#undef FUNC
|
||||
#undef FUNC_INNER
|
||||
#undef ARG
|
||||
|
||||
static void process_line(BinarySource *in, strbuf *out)
|
||||
@ -1647,12 +1609,13 @@ static void process_line(BinarySource *in, strbuf *out)
|
||||
DISPATCH_COMMAND(mp_dump);
|
||||
#undef DISPATCH_COMMAND
|
||||
|
||||
#define FUNC(outtype, fname, args) DISPATCH_INTERNAL(#fname,handle_##fname);
|
||||
#define FUNC_INNER(outtype, fname, realname, args) \
|
||||
DISPATCH_INTERNAL(#fname,handle_##fname);
|
||||
#define ARG1(type, arg)
|
||||
#define ARGN(type, arg)
|
||||
#define VOID
|
||||
#include "testcrypt.h"
|
||||
#undef FUNC
|
||||
#undef FUNC_INNER
|
||||
#undef ARG
|
||||
#undef VOID
|
||||
|
||||
|
74
testcrypt.h
74
testcrypt.h
@ -60,6 +60,12 @@
|
||||
* enumeration types (e.g. argon2flavour, rsaorder) or pointers to
|
||||
* const vtables of one kind or another (e.g. keyalg, hashalg,
|
||||
* primegenpolicy).
|
||||
*
|
||||
* If a function definition begins with FUNC_WRAPPED rather than FUNC,
|
||||
* it means that the underlying C function has a suffix "_wrapper",
|
||||
* e.g. ssh_cipher_setiv_wrapper(). Those wrappers are defined in
|
||||
* testcrypt.c itself, and change the API or semantics in a way that
|
||||
* makes the function more Python-friendly.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -127,8 +133,8 @@ FUNC(val_modsqrt, modsqrt_new, (ARG(val_mpint, p), ARG(val_mpint, any_nonsquare_
|
||||
/* The modsqrt functions' 'success' pointer becomes a second return value */
|
||||
FUNC(val_mpint, mp_modsqrt, (ARG(val_modsqrt, sc), ARG(val_mpint, x), ARG(out_uint, success)))
|
||||
FUNC(val_monty, monty_new, (ARG(val_mpint, modulus)))
|
||||
FUNC(val_mpint, monty_modulus, (ARG(val_monty, mc)))
|
||||
FUNC(val_mpint, monty_identity, (ARG(val_monty, mc)))
|
||||
FUNC_WRAPPED(val_mpint, monty_modulus, (ARG(val_monty, mc)))
|
||||
FUNC_WRAPPED(val_mpint, monty_identity, (ARG(val_monty, mc)))
|
||||
FUNC(void, monty_import_into, (ARG(val_monty, mc), ARG(val_mpint, r), ARG(val_mpint, x)))
|
||||
FUNC(val_mpint, monty_import, (ARG(val_monty, mc), ARG(val_mpint, x)))
|
||||
FUNC(void, monty_export_into, (ARG(val_monty, mc), ARG(val_mpint, r), ARG(val_mpint, x)))
|
||||
@ -196,8 +202,8 @@ FUNC(void, ecc_edwards_get_affine, (ARG(val_epoint, wp), ARG(out_val_mpint, x),
|
||||
FUNC(opt_val_hash, ssh_hash_new, (ARG(hashalg, alg)))
|
||||
FUNC(void, ssh_hash_reset, (ARG(val_hash, h)))
|
||||
FUNC(val_hash, ssh_hash_copy, (ARG(val_hash, orig)))
|
||||
FUNC(val_string, ssh_hash_digest, (ARG(val_hash, h)))
|
||||
FUNC(val_string, ssh_hash_final, (ARG(consumed_val_hash, h)))
|
||||
FUNC_WRAPPED(val_string, ssh_hash_digest, (ARG(val_hash, h)))
|
||||
FUNC_WRAPPED(val_string, ssh_hash_final, (ARG(consumed_val_hash, h)))
|
||||
FUNC(void, ssh_hash_update, (ARG(val_hash, h), ARG(val_string_ptrlen, pl)))
|
||||
|
||||
FUNC(opt_val_hash, blake2b_new_general, (ARG(uint, hashlen)))
|
||||
@ -211,7 +217,7 @@ FUNC(val_mac, ssh2_mac_new, (ARG(macalg, alg), ARG(opt_val_cipher, cipher)))
|
||||
FUNC(void, ssh2_mac_setkey, (ARG(val_mac, m), ARG(val_string_ptrlen, key)))
|
||||
FUNC(void, ssh2_mac_start, (ARG(val_mac, m)))
|
||||
FUNC(void, ssh2_mac_update, (ARG(val_mac, m), ARG(val_string_ptrlen, pl)))
|
||||
FUNC(val_string, ssh2_mac_genresult, (ARG(val_mac, m)))
|
||||
FUNC_WRAPPED(val_string, ssh2_mac_genresult, (ARG(val_mac, m)))
|
||||
FUNC(val_string_asciz_const, ssh2_mac_text_name, (ARG(val_mac, m)))
|
||||
|
||||
/*
|
||||
@ -248,12 +254,12 @@ FUNC(opt_val_mpint, key_components_nth_mp, (ARG(val_keycomponents, kc), ARG(uint
|
||||
* string and return a separate string.
|
||||
*/
|
||||
FUNC(opt_val_cipher, ssh_cipher_new, (ARG(cipheralg, alg)))
|
||||
FUNC(void, ssh_cipher_setiv, (ARG(val_cipher, c), ARG(val_string_ptrlen, iv)))
|
||||
FUNC(void, ssh_cipher_setkey, (ARG(val_cipher, c), ARG(val_string_ptrlen, key)))
|
||||
FUNC(val_string, ssh_cipher_encrypt, (ARG(val_cipher, c), ARG(val_string_ptrlen, blk)))
|
||||
FUNC(val_string, ssh_cipher_decrypt, (ARG(val_cipher, c), ARG(val_string_ptrlen, blk)))
|
||||
FUNC(val_string, ssh_cipher_encrypt_length, (ARG(val_cipher, c), ARG(val_string_ptrlen, blk), ARG(uint, seq)))
|
||||
FUNC(val_string, ssh_cipher_decrypt_length, (ARG(val_cipher, c), ARG(val_string_ptrlen, blk), ARG(uint, seq)))
|
||||
FUNC_WRAPPED(void, ssh_cipher_setiv, (ARG(val_cipher, c), ARG(val_string_ptrlen, iv)))
|
||||
FUNC_WRAPPED(void, ssh_cipher_setkey, (ARG(val_cipher, c), ARG(val_string_ptrlen, key)))
|
||||
FUNC_WRAPPED(val_string, ssh_cipher_encrypt, (ARG(val_cipher, c), ARG(val_string_ptrlen, blk)))
|
||||
FUNC_WRAPPED(val_string, ssh_cipher_decrypt, (ARG(val_cipher, c), ARG(val_string_ptrlen, blk)))
|
||||
FUNC_WRAPPED(val_string, ssh_cipher_encrypt_length, (ARG(val_cipher, c), ARG(val_string_ptrlen, blk), ARG(uint, seq)))
|
||||
FUNC_WRAPPED(val_string, ssh_cipher_decrypt_length, (ARG(val_cipher, c), ARG(val_string_ptrlen, blk), ARG(uint, seq)))
|
||||
|
||||
/*
|
||||
* Integer Diffie-Hellman.
|
||||
@ -262,7 +268,7 @@ FUNC(val_dh, dh_setup_group, (ARG(dh_group, kex)))
|
||||
FUNC(val_dh, dh_setup_gex, (ARG(val_mpint, pval), ARG(val_mpint, gval)))
|
||||
FUNC(uint, dh_modulus_bit_size, (ARG(val_dh, ctx)))
|
||||
FUNC(val_mpint, dh_create_e, (ARG(val_dh, ctx), ARG(uint, nbits)))
|
||||
FUNC(boolean, dh_validate_f, (ARG(val_dh, ctx), ARG(val_mpint, f)))
|
||||
FUNC_WRAPPED(boolean, dh_validate_f, (ARG(val_dh, ctx), ARG(val_mpint, f)))
|
||||
FUNC(val_mpint, dh_find_K, (ARG(val_dh, ctx), ARG(val_mpint, f)))
|
||||
|
||||
/*
|
||||
@ -291,9 +297,9 @@ FUNC(val_rsakex, get_rsa_ssh1_priv_agent, (ARG(val_string_binarysource, src)))
|
||||
FUNC(val_rsa, rsa_new, (VOID))
|
||||
FUNC(void, get_rsa_ssh1_pub, (ARG(val_string_binarysource, src), ARG(val_rsa, key), ARG(rsaorder, order)))
|
||||
FUNC(void, get_rsa_ssh1_priv, (ARG(val_string_binarysource, src), ARG(val_rsa, key)))
|
||||
FUNC(opt_val_string, rsa_ssh1_encrypt, (ARG(val_string_ptrlen, data), ARG(val_rsa, key)))
|
||||
FUNC_WRAPPED(opt_val_string, rsa_ssh1_encrypt, (ARG(val_string_ptrlen, data), ARG(val_rsa, key)))
|
||||
FUNC(val_mpint, rsa_ssh1_decrypt, (ARG(val_mpint, input), ARG(val_rsa, key)))
|
||||
FUNC(val_string, rsa_ssh1_decrypt_pkcs1, (ARG(val_mpint, input), ARG(val_rsa, key)))
|
||||
FUNC_WRAPPED(val_string, rsa_ssh1_decrypt_pkcs1, (ARG(val_mpint, input), ARG(val_rsa, key)))
|
||||
FUNC(val_string_asciz, rsastr_fmt, (ARG(val_rsa, key)))
|
||||
FUNC(val_string_asciz, rsa_ssh1_fingerprint, (ARG(val_rsa, key)))
|
||||
FUNC(void, rsa_ssh1_public_blob, (ARG(out_val_string_binarysink, bs), ARG(val_rsa, key), ARG(rsaorder, order)))
|
||||
@ -309,7 +315,7 @@ FUNC(val_prng, prng_new, (ARG(hashalg, hashalg)))
|
||||
FUNC(void, prng_seed_begin, (ARG(val_prng, p)))
|
||||
FUNC(void, prng_seed_update, (ARG(val_prng, pr), ARG(val_string_ptrlen, data)))
|
||||
FUNC(void, prng_seed_finish, (ARG(val_prng, p)))
|
||||
FUNC(val_string, prng_read, (ARG(val_prng, p), ARG(uint, size)))
|
||||
FUNC_WRAPPED(val_string, prng_read, (ARG(val_prng, p), ARG(uint, size)))
|
||||
FUNC(void, prng_add_entropy, (ARG(val_prng, p), ARG(uint, source_id), ARG(val_string_ptrlen, data)))
|
||||
|
||||
/*
|
||||
@ -320,29 +326,29 @@ FUNC(boolean, ppk_encrypted_s, (ARG(val_string_binarysource, src), ARG(out_opt_v
|
||||
FUNC(boolean, rsa1_encrypted_s, (ARG(val_string_binarysource, src), ARG(out_opt_val_string_asciz, comment)))
|
||||
FUNC(boolean, ppk_loadpub_s, (ARG(val_string_binarysource, src), ARG(out_opt_val_string_asciz, algorithm), ARG(out_val_string_binarysink, bs), ARG(out_opt_val_string_asciz, commentptr), ARG(out_opt_val_string_asciz_const, errorstr)))
|
||||
FUNC(int, rsa1_loadpub_s, (ARG(val_string_binarysource, src), ARG(out_val_string_binarysink, bs), ARG(out_opt_val_string_asciz, commentptr), ARG(out_opt_val_string_asciz_const, errorstr)))
|
||||
FUNC(opt_val_key, ppk_load_s, (ARG(val_string_binarysource, src), ARG(out_opt_val_string_asciz, comment), ARG(opt_val_string_asciz, passphrase), ARG(out_opt_val_string_asciz_const, errorstr)))
|
||||
FUNC(int, rsa1_load_s, (ARG(val_string_binarysource, src), ARG(val_rsa, key), ARG(out_opt_val_string_asciz, comment), ARG(opt_val_string_asciz, passphrase), ARG(out_opt_val_string_asciz_const, errorstr)))
|
||||
FUNC(val_string, ppk_save_sb, (ARG(val_key, key), ARG(opt_val_string_asciz, comment), ARG(opt_val_string_asciz, passphrase), ARG(uint, fmt_version), ARG(argon2flavour, flavour), ARG(uint, mem), ARG(uint, passes), ARG(uint, parallel)))
|
||||
FUNC(val_string, rsa1_save_sb, (ARG(val_rsa, key), ARG(opt_val_string_asciz, comment), ARG(opt_val_string_asciz, passphrase)))
|
||||
FUNC_WRAPPED(opt_val_key, ppk_load_s, (ARG(val_string_binarysource, src), ARG(out_opt_val_string_asciz, comment), ARG(opt_val_string_asciz, passphrase), ARG(out_opt_val_string_asciz_const, errorstr)))
|
||||
FUNC_WRAPPED(int, rsa1_load_s, (ARG(val_string_binarysource, src), ARG(val_rsa, key), ARG(out_opt_val_string_asciz, comment), ARG(opt_val_string_asciz, passphrase), ARG(out_opt_val_string_asciz_const, errorstr)))
|
||||
FUNC_WRAPPED(val_string, ppk_save_sb, (ARG(val_key, key), ARG(opt_val_string_asciz, comment), ARG(opt_val_string_asciz, passphrase), ARG(uint, fmt_version), ARG(argon2flavour, flavour), ARG(uint, mem), ARG(uint, passes), ARG(uint, parallel)))
|
||||
FUNC_WRAPPED(val_string, rsa1_save_sb, (ARG(val_rsa, key), ARG(opt_val_string_asciz, comment), ARG(opt_val_string_asciz, passphrase)))
|
||||
|
||||
FUNC(val_string_asciz, ssh2_fingerprint_blob, (ARG(val_string_ptrlen, blob), ARG(fptype, fptype)))
|
||||
|
||||
/*
|
||||
* Password hashing.
|
||||
*/
|
||||
FUNC(val_string, argon2, (ARG(argon2flavour, flavour), ARG(uint, mem), ARG(uint, passes), ARG(uint, parallel), ARG(uint, taglen), ARG(val_string_ptrlen, P), ARG(val_string_ptrlen, S), ARG(val_string_ptrlen, K), ARG(val_string_ptrlen, X)))
|
||||
FUNC_WRAPPED(val_string, argon2, (ARG(argon2flavour, flavour), ARG(uint, mem), ARG(uint, passes), ARG(uint, parallel), ARG(uint, taglen), ARG(val_string_ptrlen, P), ARG(val_string_ptrlen, S), ARG(val_string_ptrlen, K), ARG(val_string_ptrlen, X)))
|
||||
FUNC(val_string, argon2_long_hash, (ARG(uint, length), ARG(val_string_ptrlen, data)))
|
||||
|
||||
/*
|
||||
* Key generation functions.
|
||||
*/
|
||||
FUNC(val_key, rsa_generate, (ARG(uint, bits), ARG(boolean, strong), ARG(val_pgc, pgc)))
|
||||
FUNC(val_key, dsa_generate, (ARG(uint, bits), ARG(val_pgc, pgc)))
|
||||
FUNC(opt_val_key, ecdsa_generate, (ARG(uint, bits)))
|
||||
FUNC(opt_val_key, eddsa_generate, (ARG(uint, bits)))
|
||||
FUNC_WRAPPED(val_key, rsa_generate, (ARG(uint, bits), ARG(boolean, strong), ARG(val_pgc, pgc)))
|
||||
FUNC_WRAPPED(val_key, dsa_generate, (ARG(uint, bits), ARG(val_pgc, pgc)))
|
||||
FUNC_WRAPPED(opt_val_key, ecdsa_generate, (ARG(uint, bits)))
|
||||
FUNC_WRAPPED(opt_val_key, eddsa_generate, (ARG(uint, bits)))
|
||||
FUNC(val_rsa, rsa1_generate, (ARG(uint, bits), ARG(boolean, strong), ARG(val_pgc, pgc)))
|
||||
FUNC(val_pgc, primegen_new_context, (ARG(primegenpolicy, policy)))
|
||||
FUNC(opt_val_mpint, primegen_generate, (ARG(val_pgc, ctx), ARG(consumed_val_pcs, pcs)))
|
||||
FUNC_WRAPPED(opt_val_mpint, primegen_generate, (ARG(val_pgc, ctx), ARG(consumed_val_pcs, pcs)))
|
||||
FUNC(val_string, primegen_mpu_certificate, (ARG(val_pgc, ctx), ARG(val_mpint, p)))
|
||||
FUNC(val_pcs, pcs_new, (ARG(uint, bits)))
|
||||
FUNC(val_pcs, pcs_new_with_firstbits, (ARG(uint, bits), ARG(uint, first), ARG(uint, nfirst)))
|
||||
@ -359,7 +365,7 @@ FUNC(val_pockle, pockle_new, (VOID))
|
||||
FUNC(uint, pockle_mark, (ARG(val_pockle, pockle)))
|
||||
FUNC(void, pockle_release, (ARG(val_pockle, pockle), ARG(uint, mark)))
|
||||
FUNC(pocklestatus, pockle_add_small_prime, (ARG(val_pockle, pockle), ARG(val_mpint, p)))
|
||||
FUNC(pocklestatus, pockle_add_prime, (ARG(val_pockle, pockle), ARG(val_mpint, p), ARG(mpint_list, factors), ARG(val_mpint, witness)))
|
||||
FUNC_WRAPPED(pocklestatus, pockle_add_prime, (ARG(val_pockle, pockle), ARG(val_mpint, p), ARG(mpint_list, factors), ARG(val_mpint, witness)))
|
||||
FUNC(val_string, pockle_mpu, (ARG(val_pockle, pockle), ARG(val_mpint, p)))
|
||||
FUNC(val_millerrabin, miller_rabin_new, (ARG(val_mpint, p)))
|
||||
FUNC(mr_result, miller_rabin_test, (ARG(val_millerrabin, mr), ARG(val_mpint, w)))
|
||||
@ -369,14 +375,14 @@ FUNC(mr_result, miller_rabin_test, (ARG(val_millerrabin, mr), ARG(val_mpint, w))
|
||||
*/
|
||||
FUNC(val_wpoint, ecdsa_public, (ARG(val_mpint, private_key), ARG(keyalg, alg)))
|
||||
FUNC(val_epoint, eddsa_public, (ARG(val_mpint, private_key), ARG(keyalg, alg)))
|
||||
FUNC(val_string, des_encrypt_xdmauth, (ARG(val_string_ptrlen, key), ARG(val_string_ptrlen, blk)))
|
||||
FUNC(val_string, des_decrypt_xdmauth, (ARG(val_string_ptrlen, key), ARG(val_string_ptrlen, blk)))
|
||||
FUNC(val_string, des3_encrypt_pubkey, (ARG(val_string_ptrlen, key), ARG(val_string_ptrlen, blk)))
|
||||
FUNC(val_string, des3_decrypt_pubkey, (ARG(val_string_ptrlen, key), ARG(val_string_ptrlen, blk)))
|
||||
FUNC(val_string, des3_encrypt_pubkey_ossh, (ARG(val_string_ptrlen, key), ARG(val_string_ptrlen, iv), ARG(val_string_ptrlen, blk)))
|
||||
FUNC(val_string, des3_decrypt_pubkey_ossh, (ARG(val_string_ptrlen, key), ARG(val_string_ptrlen, iv), ARG(val_string_ptrlen, blk)))
|
||||
FUNC(val_string, aes256_encrypt_pubkey, (ARG(val_string_ptrlen, key), ARG(val_string_ptrlen, iv), ARG(val_string_ptrlen, blk)))
|
||||
FUNC(val_string, aes256_decrypt_pubkey, (ARG(val_string_ptrlen, key), ARG(val_string_ptrlen, iv), ARG(val_string_ptrlen, blk)))
|
||||
FUNC_WRAPPED(val_string, des_encrypt_xdmauth, (ARG(val_string_ptrlen, key), ARG(val_string_ptrlen, blk)))
|
||||
FUNC_WRAPPED(val_string, des_decrypt_xdmauth, (ARG(val_string_ptrlen, key), ARG(val_string_ptrlen, blk)))
|
||||
FUNC_WRAPPED(val_string, des3_encrypt_pubkey, (ARG(val_string_ptrlen, key), ARG(val_string_ptrlen, blk)))
|
||||
FUNC_WRAPPED(val_string, des3_decrypt_pubkey, (ARG(val_string_ptrlen, key), ARG(val_string_ptrlen, blk)))
|
||||
FUNC_WRAPPED(val_string, des3_encrypt_pubkey_ossh, (ARG(val_string_ptrlen, key), ARG(val_string_ptrlen, iv), ARG(val_string_ptrlen, blk)))
|
||||
FUNC_WRAPPED(val_string, des3_decrypt_pubkey_ossh, (ARG(val_string_ptrlen, key), ARG(val_string_ptrlen, iv), ARG(val_string_ptrlen, blk)))
|
||||
FUNC_WRAPPED(val_string, aes256_encrypt_pubkey, (ARG(val_string_ptrlen, key), ARG(val_string_ptrlen, iv), ARG(val_string_ptrlen, blk)))
|
||||
FUNC_WRAPPED(val_string, aes256_decrypt_pubkey, (ARG(val_string_ptrlen, key), ARG(val_string_ptrlen, iv), ARG(val_string_ptrlen, blk)))
|
||||
FUNC(uint, crc32_rfc1662, (ARG(val_string_ptrlen, data)))
|
||||
FUNC(uint, crc32_ssh1, (ARG(val_string_ptrlen, data)))
|
||||
FUNC(uint, crc32_update, (ARG(uint, crc_input), ARG(val_string_ptrlen, data)))
|
||||
|
Loading…
Reference in New Issue
Block a user