From 5afefef798b5007ad65696c1900e204e03b6a701 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 9 Jan 2019 21:59:19 +0000 Subject: [PATCH] testcrypt: remove underscores from value-type names. The type names 'val_foo' used in testcrypt.h work on a system where a further underscore suffix is treated as a qualifier indicating something about how the C version of the API represents that type. (For example, plain 'val_string' means a strbuf, but if I write 'val_string_asciz' or 'val_string_ptrlen' in testcrypt.h it will cause the wrapper for that function to pass a char * or a ptrlen derived from that strbuf.) But I forgot about this when I named the type val_ssh2_cipher (and ditto ssh1), with the effect that the testcrypt system has considered them all along to really be called 'ssh2' and 'ssh1', and the 'cipher' to be some irrelevant API-adaptor suffix. This hasn't caused a bug because I didn't have any other type called val_ssh2_something. But it was a latent one. Now renamed sensibly! --- testcrypt.c | 6 +++--- testcrypt.h | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/testcrypt.c b/testcrypt.c index c5aa12cb..aa144334 100644 --- a/testcrypt.c +++ b/testcrypt.c @@ -71,8 +71,8 @@ int random_byte(void) X(epoint, EdwardsPoint *, ecc_edwards_point_free(v)) \ X(hash, ssh_hash *, ssh_hash_free(v)) \ X(key, ssh_key *, ssh_key_free(v)) \ - X(ssh1_cipher, ssh1_cipher *, ssh1_cipher_free(v)) \ - X(ssh2_cipher, ssh2_cipher *, ssh2_cipher_free(v)) \ + X(ssh1cipher, ssh1_cipher *, ssh1_cipher_free(v)) \ + X(ssh2cipher, ssh2_cipher *, ssh2_cipher_free(v)) \ X(mac, ssh2_mac *, ssh2_mac_free(v)) \ X(dh, dh_ctx *, dh_cleanup(v)) \ X(ecdh, ecdh_key *, ssh_ecdhkex_freekey(v)) \ @@ -812,7 +812,7 @@ VALUE_TYPES(VALTYPE_TYPEDEF) return NULL; \ return unwrap_value_##type(lookup_value(word))->vu_##type; \ } -OPTIONAL_PTR_FUNC(ssh2_cipher) +OPTIONAL_PTR_FUNC(ssh2cipher) OPTIONAL_PTR_FUNC(mpint) typedef uintmax_t TD_uint; diff --git a/testcrypt.h b/testcrypt.h index 50908f95..74220e61 100644 --- a/testcrypt.h +++ b/testcrypt.h @@ -125,7 +125,7 @@ FUNC(void, ssh_hash_update, val_hash, val_string_ptrlen) * to ssh2_mac_new. Also, again, I've invented an ssh2_mac_update so * you can put data into the MAC. */ -FUNC(val_mac, ssh2_mac_new, macalg, opt_val_ssh2_cipher) +FUNC(val_mac, ssh2_mac_new, macalg, opt_val_ssh2cipher) FUNC(void, ssh2_mac_setkey, val_mac, val_string_ptrlen) FUNC(void, ssh2_mac_start, val_mac) FUNC(void, ssh2_mac_update, val_mac, val_string_ptrlen) @@ -154,21 +154,21 @@ FUNC(uint, ssh_key_public_bits, keyalg, val_string_ptrlen) * functions are wrapped to replace them with a pair that take one * string and return a separate string. */ -FUNC(val_ssh1_cipher, ssh1_cipher_new, ssh1_cipheralg) -FUNC(void, ssh1_cipher_sesskey, val_ssh1_cipher, val_string_ptrlen) -FUNC(val_string, ssh1_cipher_encrypt, val_ssh1_cipher, val_string_ptrlen) -FUNC(val_string, ssh1_cipher_decrypt, val_ssh1_cipher, val_string_ptrlen) +FUNC(val_ssh1cipher, ssh1_cipher_new, ssh1_cipheralg) +FUNC(void, ssh1_cipher_sesskey, val_ssh1cipher, val_string_ptrlen) +FUNC(val_string, ssh1_cipher_encrypt, val_ssh1cipher, val_string_ptrlen) +FUNC(val_string, ssh1_cipher_decrypt, val_ssh1cipher, val_string_ptrlen) /* * The ssh2_cipher abstraction, with similar modifications. */ -FUNC(val_ssh2_cipher, ssh2_cipher_new, ssh2_cipheralg) -FUNC(void, ssh2_cipher_setiv, val_ssh2_cipher, val_string_ptrlen) -FUNC(void, ssh2_cipher_setkey, val_ssh2_cipher, val_string_ptrlen) -FUNC(val_string, ssh2_cipher_encrypt, val_ssh2_cipher, val_string_ptrlen) -FUNC(val_string, ssh2_cipher_decrypt, val_ssh2_cipher, val_string_ptrlen) -FUNC(val_string, ssh2_cipher_encrypt_length, val_ssh2_cipher, val_string_ptrlen, uint) -FUNC(val_string, ssh2_cipher_decrypt_length, val_ssh2_cipher, val_string_ptrlen, uint) +FUNC(val_ssh2cipher, ssh2_cipher_new, ssh2_cipheralg) +FUNC(void, ssh2_cipher_setiv, val_ssh2cipher, val_string_ptrlen) +FUNC(void, ssh2_cipher_setkey, val_ssh2cipher, val_string_ptrlen) +FUNC(val_string, ssh2_cipher_encrypt, val_ssh2cipher, val_string_ptrlen) +FUNC(val_string, ssh2_cipher_decrypt, val_ssh2cipher, val_string_ptrlen) +FUNC(val_string, ssh2_cipher_encrypt_length, val_ssh2cipher, val_string_ptrlen, uint) +FUNC(val_string, ssh2_cipher_decrypt_length, val_ssh2cipher, val_string_ptrlen, uint) /* * Integer Diffie-Hellman.