commit 206a9726b112d674b712949fadc653def57f427b Author: Nick Mathewson nickm@torproject.org Date: Wed Oct 26 11:06:45 2016 -0400
Regenerate trunnel code with trunnel 1.5 --- src/ext/trunnel/trunnel-impl.h | 3 +- src/ext/trunnel/trunnel.c | 2 +- src/ext/trunnel/trunnel.h | 2 +- src/trunnel/ed25519_cert.c | 58 +++++++++++- src/trunnel/ed25519_cert.h | 44 ++++++++- src/trunnel/link_handshake.c | 196 ++++++++++++++++++++++++++++++++++++++--- src/trunnel/link_handshake.h | 134 +++++++++++++++++++++++++--- src/trunnel/pwbox.c | 46 +++++++++- src/trunnel/pwbox.h | 32 ++++++- 9 files changed, 474 insertions(+), 43 deletions(-)
diff --git a/src/ext/trunnel/trunnel-impl.h b/src/ext/trunnel/trunnel-impl.h index 3ffde6e..0cbd4f5 100644 --- a/src/ext/trunnel/trunnel-impl.h +++ b/src/ext/trunnel/trunnel-impl.h @@ -1,4 +1,4 @@ -/* trunnel-impl.h -- copied from Trunnel v1.4.6 +/* trunnel-impl.h -- copied from Trunnel v1.5 * https://gitweb.torproject.org/trunnel.git * You probably shouldn't edit this file. */ @@ -17,6 +17,7 @@ #include "trunnel.h" #include <assert.h> #include <string.h> +#include <stdlib.h>
#if defined(_MSC_VER) && (_MSC_VER < 1600) #define uint8_t unsigned char diff --git a/src/ext/trunnel/trunnel.c b/src/ext/trunnel/trunnel.c index 3994422..f80a587 100644 --- a/src/ext/trunnel/trunnel.c +++ b/src/ext/trunnel/trunnel.c @@ -1,4 +1,4 @@ -/* trunnel.c -- copied from Trunnel v1.4.6 +/* trunnel.c -- copied from Trunnel v1.5 * https://gitweb.torproject.org/trunnel.git * You probably shouldn't edit this file. */ diff --git a/src/ext/trunnel/trunnel.h b/src/ext/trunnel/trunnel.h index 41068b8..afd404d 100644 --- a/src/ext/trunnel/trunnel.h +++ b/src/ext/trunnel/trunnel.h @@ -1,4 +1,4 @@ -/* trunnel.h -- copied from Trunnel v1.4.6 +/* trunnel.h -- copied from Trunnel v1.5 * https://gitweb.torproject.org/trunnel.git * You probably shouldn't edit this file. */ diff --git a/src/trunnel/ed25519_cert.c b/src/trunnel/ed25519_cert.c index 24988d5..a492ada 100644 --- a/src/trunnel/ed25519_cert.c +++ b/src/trunnel/ed25519_cert.c @@ -1,4 +1,4 @@ -/* ed25519_cert.c -- generated by Trunnel v1.4.6. +/* ed25519_cert.c -- generated by Trunnel v1.5. * https://gitweb.torproject.org/trunnel.git * You probably shouldn't edit this file. */ @@ -97,12 +97,17 @@ ed25519_cert_extension_getlen_un_signing_key(const ed25519_cert_extension_t *inp }
uint8_t -ed25519_cert_extension_get_un_signing_key(const ed25519_cert_extension_t *inp, size_t idx) +ed25519_cert_extension_get_un_signing_key(ed25519_cert_extension_t *inp, size_t idx) { trunnel_assert(idx < 32); return inp->un_signing_key[idx]; }
+uint8_t +ed25519_cert_extension_getconst_un_signing_key(const ed25519_cert_extension_t *inp, size_t idx) +{ + return ed25519_cert_extension_get_un_signing_key((ed25519_cert_extension_t*)inp, idx); +} int ed25519_cert_extension_set_un_signing_key(ed25519_cert_extension_t *inp, size_t idx, uint8_t elt) { @@ -116,6 +121,11 @@ ed25519_cert_extension_getarray_un_signing_key(ed25519_cert_extension_t *inp) { return inp->un_signing_key; } +const uint8_t * +ed25519_cert_extension_getconstarray_un_signing_key(const ed25519_cert_extension_t *inp) +{ + return (const uint8_t *)ed25519_cert_extension_getarray_un_signing_key((ed25519_cert_extension_t*)inp); +} size_t ed25519_cert_extension_getlen_un_unparsed(const ed25519_cert_extension_t *inp) { @@ -128,6 +138,11 @@ ed25519_cert_extension_get_un_unparsed(ed25519_cert_extension_t *inp, size_t idx return TRUNNEL_DYNARRAY_GET(&inp->un_unparsed, idx); }
+uint8_t +ed25519_cert_extension_getconst_un_unparsed(const ed25519_cert_extension_t *inp, size_t idx) +{ + return ed25519_cert_extension_get_un_unparsed((ed25519_cert_extension_t*)inp, idx); +} int ed25519_cert_extension_set_un_unparsed(ed25519_cert_extension_t *inp, size_t idx, uint8_t elt) { @@ -149,6 +164,11 @@ ed25519_cert_extension_getarray_un_unparsed(ed25519_cert_extension_t *inp) { return inp->un_unparsed.elts_; } +const uint8_t * +ed25519_cert_extension_getconstarray_un_unparsed(const ed25519_cert_extension_t *inp) +{ + return (const uint8_t *)ed25519_cert_extension_getarray_un_unparsed((ed25519_cert_extension_t*)inp); +} int ed25519_cert_extension_setlen_un_unparsed(ed25519_cert_extension_t *inp, size_t newlen) { @@ -502,12 +522,17 @@ ed25519_cert_getlen_certified_key(const ed25519_cert_t *inp) }
uint8_t -ed25519_cert_get_certified_key(const ed25519_cert_t *inp, size_t idx) +ed25519_cert_get_certified_key(ed25519_cert_t *inp, size_t idx) { trunnel_assert(idx < 32); return inp->certified_key[idx]; }
+uint8_t +ed25519_cert_getconst_certified_key(const ed25519_cert_t *inp, size_t idx) +{ + return ed25519_cert_get_certified_key((ed25519_cert_t*)inp, idx); +} int ed25519_cert_set_certified_key(ed25519_cert_t *inp, size_t idx, uint8_t elt) { @@ -521,6 +546,11 @@ ed25519_cert_getarray_certified_key(ed25519_cert_t *inp) { return inp->certified_key; } +const uint8_t * +ed25519_cert_getconstarray_certified_key(const ed25519_cert_t *inp) +{ + return (const uint8_t *)ed25519_cert_getarray_certified_key((ed25519_cert_t*)inp); +} uint8_t ed25519_cert_get_n_extensions(ed25519_cert_t *inp) { @@ -544,6 +574,11 @@ ed25519_cert_get_ext(ed25519_cert_t *inp, size_t idx) return TRUNNEL_DYNARRAY_GET(&inp->ext, idx); }
+ const struct ed25519_cert_extension_st * +ed25519_cert_getconst_ext(const ed25519_cert_t *inp, size_t idx) +{ + return ed25519_cert_get_ext((ed25519_cert_t*)inp, idx); +} int ed25519_cert_set_ext(ed25519_cert_t *inp, size_t idx, struct ed25519_cert_extension_st * elt) { @@ -577,6 +612,11 @@ ed25519_cert_getarray_ext(ed25519_cert_t *inp) { return inp->ext.elts_; } +const struct ed25519_cert_extension_st * const * +ed25519_cert_getconstarray_ext(const ed25519_cert_t *inp) +{ + return (const struct ed25519_cert_extension_st * const *)ed25519_cert_getarray_ext((ed25519_cert_t*)inp); +} int ed25519_cert_setlen_ext(ed25519_cert_t *inp, size_t newlen) { @@ -604,12 +644,17 @@ ed25519_cert_getlen_signature(const ed25519_cert_t *inp) }
uint8_t -ed25519_cert_get_signature(const ed25519_cert_t *inp, size_t idx) +ed25519_cert_get_signature(ed25519_cert_t *inp, size_t idx) { trunnel_assert(idx < 64); return inp->signature[idx]; }
+uint8_t +ed25519_cert_getconst_signature(const ed25519_cert_t *inp, size_t idx) +{ + return ed25519_cert_get_signature((ed25519_cert_t*)inp, idx); +} int ed25519_cert_set_signature(ed25519_cert_t *inp, size_t idx, uint8_t elt) { @@ -623,6 +668,11 @@ ed25519_cert_getarray_signature(ed25519_cert_t *inp) { return inp->signature; } +const uint8_t * +ed25519_cert_getconstarray_signature(const ed25519_cert_t *inp) +{ + return (const uint8_t *)ed25519_cert_getarray_signature((ed25519_cert_t*)inp); +} const char * ed25519_cert_check(const ed25519_cert_t *obj) { diff --git a/src/trunnel/ed25519_cert.h b/src/trunnel/ed25519_cert.h index 28f6fee..9804d84 100644 --- a/src/trunnel/ed25519_cert.h +++ b/src/trunnel/ed25519_cert.h @@ -1,4 +1,4 @@ -/* ed25519_cert.h -- generated by by Trunnel v1.4.6. +/* ed25519_cert.h -- generated by by Trunnel v1.5. * https://gitweb.torproject.org/trunnel.git * You probably shouldn't edit this file. */ @@ -105,7 +105,11 @@ size_t ed25519_cert_extension_getlen_un_signing_key(const ed25519_cert_extension /** Return the element at position 'idx' of the fixed array field * un_signing_key of the ed25519_cert_extension_t in 'inp'. */ -uint8_t ed25519_cert_extension_get_un_signing_key(const ed25519_cert_extension_t *inp, size_t idx); +uint8_t ed25519_cert_extension_get_un_signing_key(ed25519_cert_extension_t *inp, size_t idx); +/** As ed25519_cert_extension_get_un_signing_key, but take and return + * a const pointer + */ +uint8_t ed25519_cert_extension_getconst_un_signing_key(const ed25519_cert_extension_t *inp, size_t idx); /** Change the element at position 'idx' of the fixed array field * un_signing_key of the ed25519_cert_extension_t in 'inp', so that it * will hold the value 'elt'. @@ -115,6 +119,10 @@ int ed25519_cert_extension_set_un_signing_key(ed25519_cert_extension_t *inp, siz * 'inp'. */ uint8_t * ed25519_cert_extension_getarray_un_signing_key(ed25519_cert_extension_t *inp); +/** As ed25519_cert_extension_get_un_signing_key, but take and return + * a const pointer + */ +const uint8_t * ed25519_cert_extension_getconstarray_un_signing_key(const ed25519_cert_extension_t *inp); /** Return the length of the dynamic array holding the un_unparsed * field of the ed25519_cert_extension_t in 'inp'. */ @@ -123,6 +131,10 @@ size_t ed25519_cert_extension_getlen_un_unparsed(const ed25519_cert_extension_t * un_unparsed of the ed25519_cert_extension_t in 'inp'. */ uint8_t ed25519_cert_extension_get_un_unparsed(ed25519_cert_extension_t *inp, size_t idx); +/** As ed25519_cert_extension_get_un_unparsed, but take and return a + * const pointer + */ +uint8_t ed25519_cert_extension_getconst_un_unparsed(const ed25519_cert_extension_t *inp, size_t idx); /** Change the element at position 'idx' of the dynamic array field * un_unparsed of the ed25519_cert_extension_t in 'inp', so that it * will hold the value 'elt'. @@ -136,6 +148,10 @@ int ed25519_cert_extension_add_un_unparsed(ed25519_cert_extension_t *inp, uint8_ * 'inp'. */ uint8_t * ed25519_cert_extension_getarray_un_unparsed(ed25519_cert_extension_t *inp); +/** As ed25519_cert_extension_get_un_unparsed, but take and return a + * const pointer + */ +const uint8_t * ed25519_cert_extension_getconstarray_un_unparsed(const ed25519_cert_extension_t *inp); /** Change the length of the variable-length array field un_unparsed * of 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on * success; return -1 and set the error code on 'inp' on failure. @@ -219,7 +235,11 @@ size_t ed25519_cert_getlen_certified_key(const ed25519_cert_t *inp); /** Return the element at position 'idx' of the fixed array field * certified_key of the ed25519_cert_t in 'inp'. */ -uint8_t ed25519_cert_get_certified_key(const ed25519_cert_t *inp, size_t idx); +uint8_t ed25519_cert_get_certified_key(ed25519_cert_t *inp, size_t idx); +/** As ed25519_cert_get_certified_key, but take and return a const + * pointer + */ +uint8_t ed25519_cert_getconst_certified_key(const ed25519_cert_t *inp, size_t idx); /** Change the element at position 'idx' of the fixed array field * certified_key of the ed25519_cert_t in 'inp', so that it will hold * the value 'elt'. @@ -229,6 +249,10 @@ int ed25519_cert_set_certified_key(ed25519_cert_t *inp, size_t idx, uint8_t elt) * 'inp'. */ uint8_t * ed25519_cert_getarray_certified_key(ed25519_cert_t *inp); +/** As ed25519_cert_get_certified_key, but take and return a const + * pointer + */ +const uint8_t * ed25519_cert_getconstarray_certified_key(const ed25519_cert_t *inp); /** Return the value of the n_extensions field of the ed25519_cert_t * in 'inp' */ @@ -246,6 +270,9 @@ size_t ed25519_cert_getlen_ext(const ed25519_cert_t *inp); * ext of the ed25519_cert_t in 'inp'. */ struct ed25519_cert_extension_st * ed25519_cert_get_ext(ed25519_cert_t *inp, size_t idx); +/** As ed25519_cert_get_ext, but take and return a const pointer + */ + const struct ed25519_cert_extension_st * ed25519_cert_getconst_ext(const ed25519_cert_t *inp, size_t idx); /** Change the element at position 'idx' of the dynamic array field * ext of the ed25519_cert_t in 'inp', so that it will hold the value * 'elt'. Free the previous value, if any. @@ -261,6 +288,9 @@ int ed25519_cert_add_ext(ed25519_cert_t *inp, struct ed25519_cert_extension_st * /** Return a pointer to the variable-length array field ext of 'inp'. */ struct ed25519_cert_extension_st * * ed25519_cert_getarray_ext(ed25519_cert_t *inp); +/** As ed25519_cert_get_ext, but take and return a const pointer + */ +const struct ed25519_cert_extension_st * const * ed25519_cert_getconstarray_ext(const ed25519_cert_t *inp); /** Change the length of the variable-length array field ext of 'inp' * to 'newlen'.Fill extra elements with NULL; free removed elements. * Return 0 on success; return -1 and set the error code on 'inp' on @@ -274,7 +304,10 @@ size_t ed25519_cert_getlen_signature(const ed25519_cert_t *inp); /** Return the element at position 'idx' of the fixed array field * signature of the ed25519_cert_t in 'inp'. */ -uint8_t ed25519_cert_get_signature(const ed25519_cert_t *inp, size_t idx); +uint8_t ed25519_cert_get_signature(ed25519_cert_t *inp, size_t idx); +/** As ed25519_cert_get_signature, but take and return a const pointer + */ +uint8_t ed25519_cert_getconst_signature(const ed25519_cert_t *inp, size_t idx); /** Change the element at position 'idx' of the fixed array field * signature of the ed25519_cert_t in 'inp', so that it will hold the * value 'elt'. @@ -283,6 +316,9 @@ int ed25519_cert_set_signature(ed25519_cert_t *inp, size_t idx, uint8_t elt); /** Return a pointer to the 64-element array field signature of 'inp'. */ uint8_t * ed25519_cert_getarray_signature(ed25519_cert_t *inp); +/** As ed25519_cert_get_signature, but take and return a const pointer + */ +const uint8_t * ed25519_cert_getconstarray_signature(const ed25519_cert_t *inp);
#endif diff --git a/src/trunnel/link_handshake.c b/src/trunnel/link_handshake.c index c2717f3..a4b1fe0 100644 --- a/src/trunnel/link_handshake.c +++ b/src/trunnel/link_handshake.c @@ -1,4 +1,4 @@ -/* link_handshake.c -- generated by Trunnel v1.4.6. +/* link_handshake.c -- generated by Trunnel v1.5. * https://gitweb.torproject.org/trunnel.git * You probably shouldn't edit this file. */ @@ -64,12 +64,17 @@ auth_challenge_cell_getlen_challenge(const auth_challenge_cell_t *inp) }
uint8_t -auth_challenge_cell_get_challenge(const auth_challenge_cell_t *inp, size_t idx) +auth_challenge_cell_get_challenge(auth_challenge_cell_t *inp, size_t idx) { trunnel_assert(idx < 32); return inp->challenge[idx]; }
+uint8_t +auth_challenge_cell_getconst_challenge(const auth_challenge_cell_t *inp, size_t idx) +{ + return auth_challenge_cell_get_challenge((auth_challenge_cell_t*)inp, idx); +} int auth_challenge_cell_set_challenge(auth_challenge_cell_t *inp, size_t idx, uint8_t elt) { @@ -83,6 +88,11 @@ auth_challenge_cell_getarray_challenge(auth_challenge_cell_t *inp) { return inp->challenge; } +const uint8_t * +auth_challenge_cell_getconstarray_challenge(const auth_challenge_cell_t *inp) +{ + return (const uint8_t *)auth_challenge_cell_getarray_challenge((auth_challenge_cell_t*)inp); +} uint16_t auth_challenge_cell_get_n_methods(auth_challenge_cell_t *inp) { @@ -106,6 +116,11 @@ auth_challenge_cell_get_methods(auth_challenge_cell_t *inp, size_t idx) return TRUNNEL_DYNARRAY_GET(&inp->methods, idx); }
+uint16_t +auth_challenge_cell_getconst_methods(const auth_challenge_cell_t *inp, size_t idx) +{ + return auth_challenge_cell_get_methods((auth_challenge_cell_t*)inp, idx); +} int auth_challenge_cell_set_methods(auth_challenge_cell_t *inp, size_t idx, uint16_t elt) { @@ -131,6 +146,11 @@ auth_challenge_cell_getarray_methods(auth_challenge_cell_t *inp) { return inp->methods.elts_; } +const uint16_t * +auth_challenge_cell_getconstarray_methods(const auth_challenge_cell_t *inp) +{ + return (const uint16_t *)auth_challenge_cell_getarray_methods((auth_challenge_cell_t*)inp); +} int auth_challenge_cell_setlen_methods(auth_challenge_cell_t *inp, size_t newlen) { @@ -415,6 +435,11 @@ certs_cell_cert_get_body(certs_cell_cert_t *inp, size_t idx) return TRUNNEL_DYNARRAY_GET(&inp->body, idx); }
+uint8_t +certs_cell_cert_getconst_body(const certs_cell_cert_t *inp, size_t idx) +{ + return certs_cell_cert_get_body((certs_cell_cert_t*)inp, idx); +} int certs_cell_cert_set_body(certs_cell_cert_t *inp, size_t idx, uint8_t elt) { @@ -440,6 +465,11 @@ certs_cell_cert_getarray_body(certs_cell_cert_t *inp) { return inp->body.elts_; } +const uint8_t * +certs_cell_cert_getconstarray_body(const certs_cell_cert_t *inp) +{ + return (const uint8_t *)certs_cell_cert_getarray_body((certs_cell_cert_t*)inp); +} int certs_cell_cert_setlen_body(certs_cell_cert_t *inp, size_t newlen) { @@ -652,12 +682,17 @@ rsa_ed_crosscert_getlen_ed_key(const rsa_ed_crosscert_t *inp) }
uint8_t -rsa_ed_crosscert_get_ed_key(const rsa_ed_crosscert_t *inp, size_t idx) +rsa_ed_crosscert_get_ed_key(rsa_ed_crosscert_t *inp, size_t idx) { trunnel_assert(idx < 32); return inp->ed_key[idx]; }
+uint8_t +rsa_ed_crosscert_getconst_ed_key(const rsa_ed_crosscert_t *inp, size_t idx) +{ + return rsa_ed_crosscert_get_ed_key((rsa_ed_crosscert_t*)inp, idx); +} int rsa_ed_crosscert_set_ed_key(rsa_ed_crosscert_t *inp, size_t idx, uint8_t elt) { @@ -671,6 +706,11 @@ rsa_ed_crosscert_getarray_ed_key(rsa_ed_crosscert_t *inp) { return inp->ed_key; } +const uint8_t * +rsa_ed_crosscert_getconstarray_ed_key(const rsa_ed_crosscert_t *inp) +{ + return (const uint8_t *)rsa_ed_crosscert_getarray_ed_key((rsa_ed_crosscert_t*)inp); +} uint32_t rsa_ed_crosscert_get_expiration(rsa_ed_crosscert_t *inp) { @@ -710,6 +750,11 @@ rsa_ed_crosscert_get_sig(rsa_ed_crosscert_t *inp, size_t idx) return TRUNNEL_DYNARRAY_GET(&inp->sig, idx); }
+uint8_t +rsa_ed_crosscert_getconst_sig(const rsa_ed_crosscert_t *inp, size_t idx) +{ + return rsa_ed_crosscert_get_sig((rsa_ed_crosscert_t*)inp, idx); +} int rsa_ed_crosscert_set_sig(rsa_ed_crosscert_t *inp, size_t idx, uint8_t elt) { @@ -735,6 +780,11 @@ rsa_ed_crosscert_getarray_sig(rsa_ed_crosscert_t *inp) { return inp->sig.elts_; } +const uint8_t * +rsa_ed_crosscert_getconstarray_sig(const rsa_ed_crosscert_t *inp) +{ + return (const uint8_t *)rsa_ed_crosscert_getarray_sig((rsa_ed_crosscert_t*)inp); +} int rsa_ed_crosscert_setlen_sig(rsa_ed_crosscert_t *inp, size_t newlen) { @@ -964,12 +1014,17 @@ auth1_getlen_type(const auth1_t *inp) }
uint8_t -auth1_get_type(const auth1_t *inp, size_t idx) +auth1_get_type(auth1_t *inp, size_t idx) { trunnel_assert(idx < 8); return inp->type[idx]; }
+uint8_t +auth1_getconst_type(const auth1_t *inp, size_t idx) +{ + return auth1_get_type((auth1_t*)inp, idx); +} int auth1_set_type(auth1_t *inp, size_t idx, uint8_t elt) { @@ -983,6 +1038,11 @@ auth1_getarray_type(auth1_t *inp) { return inp->type; } +const uint8_t * +auth1_getconstarray_type(const auth1_t *inp) +{ + return (const uint8_t *)auth1_getarray_type((auth1_t*)inp); +} size_t auth1_getlen_cid(const auth1_t *inp) { @@ -990,12 +1050,17 @@ auth1_getlen_cid(const auth1_t *inp) }
uint8_t -auth1_get_cid(const auth1_t *inp, size_t idx) +auth1_get_cid(auth1_t *inp, size_t idx) { trunnel_assert(idx < 32); return inp->cid[idx]; }
+uint8_t +auth1_getconst_cid(const auth1_t *inp, size_t idx) +{ + return auth1_get_cid((auth1_t*)inp, idx); +} int auth1_set_cid(auth1_t *inp, size_t idx, uint8_t elt) { @@ -1009,6 +1074,11 @@ auth1_getarray_cid(auth1_t *inp) { return inp->cid; } +const uint8_t * +auth1_getconstarray_cid(const auth1_t *inp) +{ + return (const uint8_t *)auth1_getarray_cid((auth1_t*)inp); +} size_t auth1_getlen_sid(const auth1_t *inp) { @@ -1016,12 +1086,17 @@ auth1_getlen_sid(const auth1_t *inp) }
uint8_t -auth1_get_sid(const auth1_t *inp, size_t idx) +auth1_get_sid(auth1_t *inp, size_t idx) { trunnel_assert(idx < 32); return inp->sid[idx]; }
+uint8_t +auth1_getconst_sid(const auth1_t *inp, size_t idx) +{ + return auth1_get_sid((auth1_t*)inp, idx); +} int auth1_set_sid(auth1_t *inp, size_t idx, uint8_t elt) { @@ -1035,6 +1110,11 @@ auth1_getarray_sid(auth1_t *inp) { return inp->sid; } +const uint8_t * +auth1_getconstarray_sid(const auth1_t *inp) +{ + return (const uint8_t *)auth1_getarray_sid((auth1_t*)inp); +} size_t auth1_getlen_u1_cid_ed(const auth1_t *inp) { @@ -1042,12 +1122,17 @@ auth1_getlen_u1_cid_ed(const auth1_t *inp) }
uint8_t -auth1_get_u1_cid_ed(const auth1_t *inp, size_t idx) +auth1_get_u1_cid_ed(auth1_t *inp, size_t idx) { trunnel_assert(idx < 32); return inp->u1_cid_ed[idx]; }
+uint8_t +auth1_getconst_u1_cid_ed(const auth1_t *inp, size_t idx) +{ + return auth1_get_u1_cid_ed((auth1_t*)inp, idx); +} int auth1_set_u1_cid_ed(auth1_t *inp, size_t idx, uint8_t elt) { @@ -1061,6 +1146,11 @@ auth1_getarray_u1_cid_ed(auth1_t *inp) { return inp->u1_cid_ed; } +const uint8_t * +auth1_getconstarray_u1_cid_ed(const auth1_t *inp) +{ + return (const uint8_t *)auth1_getarray_u1_cid_ed((auth1_t*)inp); +} size_t auth1_getlen_u1_sid_ed(const auth1_t *inp) { @@ -1068,12 +1158,17 @@ auth1_getlen_u1_sid_ed(const auth1_t *inp) }
uint8_t -auth1_get_u1_sid_ed(const auth1_t *inp, size_t idx) +auth1_get_u1_sid_ed(auth1_t *inp, size_t idx) { trunnel_assert(idx < 32); return inp->u1_sid_ed[idx]; }
+uint8_t +auth1_getconst_u1_sid_ed(const auth1_t *inp, size_t idx) +{ + return auth1_get_u1_sid_ed((auth1_t*)inp, idx); +} int auth1_set_u1_sid_ed(auth1_t *inp, size_t idx, uint8_t elt) { @@ -1087,6 +1182,11 @@ auth1_getarray_u1_sid_ed(auth1_t *inp) { return inp->u1_sid_ed; } +const uint8_t * +auth1_getconstarray_u1_sid_ed(const auth1_t *inp) +{ + return (const uint8_t *)auth1_getarray_u1_sid_ed((auth1_t*)inp); +} size_t auth1_getlen_slog(const auth1_t *inp) { @@ -1094,12 +1194,17 @@ auth1_getlen_slog(const auth1_t *inp) }
uint8_t -auth1_get_slog(const auth1_t *inp, size_t idx) +auth1_get_slog(auth1_t *inp, size_t idx) { trunnel_assert(idx < 32); return inp->slog[idx]; }
+uint8_t +auth1_getconst_slog(const auth1_t *inp, size_t idx) +{ + return auth1_get_slog((auth1_t*)inp, idx); +} int auth1_set_slog(auth1_t *inp, size_t idx, uint8_t elt) { @@ -1113,6 +1218,11 @@ auth1_getarray_slog(auth1_t *inp) { return inp->slog; } +const uint8_t * +auth1_getconstarray_slog(const auth1_t *inp) +{ + return (const uint8_t *)auth1_getarray_slog((auth1_t*)inp); +} size_t auth1_getlen_clog(const auth1_t *inp) { @@ -1120,12 +1230,17 @@ auth1_getlen_clog(const auth1_t *inp) }
uint8_t -auth1_get_clog(const auth1_t *inp, size_t idx) +auth1_get_clog(auth1_t *inp, size_t idx) { trunnel_assert(idx < 32); return inp->clog[idx]; }
+uint8_t +auth1_getconst_clog(const auth1_t *inp, size_t idx) +{ + return auth1_get_clog((auth1_t*)inp, idx); +} int auth1_set_clog(auth1_t *inp, size_t idx, uint8_t elt) { @@ -1139,6 +1254,11 @@ auth1_getarray_clog(auth1_t *inp) { return inp->clog; } +const uint8_t * +auth1_getconstarray_clog(const auth1_t *inp) +{ + return (const uint8_t *)auth1_getarray_clog((auth1_t*)inp); +} size_t auth1_getlen_scert(const auth1_t *inp) { @@ -1146,12 +1266,17 @@ auth1_getlen_scert(const auth1_t *inp) }
uint8_t -auth1_get_scert(const auth1_t *inp, size_t idx) +auth1_get_scert(auth1_t *inp, size_t idx) { trunnel_assert(idx < 32); return inp->scert[idx]; }
+uint8_t +auth1_getconst_scert(const auth1_t *inp, size_t idx) +{ + return auth1_get_scert((auth1_t*)inp, idx); +} int auth1_set_scert(auth1_t *inp, size_t idx, uint8_t elt) { @@ -1165,6 +1290,11 @@ auth1_getarray_scert(auth1_t *inp) { return inp->scert; } +const uint8_t * +auth1_getconstarray_scert(const auth1_t *inp) +{ + return (const uint8_t *)auth1_getarray_scert((auth1_t*)inp); +} size_t auth1_getlen_tlssecrets(const auth1_t *inp) { @@ -1172,12 +1302,17 @@ auth1_getlen_tlssecrets(const auth1_t *inp) }
uint8_t -auth1_get_tlssecrets(const auth1_t *inp, size_t idx) +auth1_get_tlssecrets(auth1_t *inp, size_t idx) { trunnel_assert(idx < 32); return inp->tlssecrets[idx]; }
+uint8_t +auth1_getconst_tlssecrets(const auth1_t *inp, size_t idx) +{ + return auth1_get_tlssecrets((auth1_t*)inp, idx); +} int auth1_set_tlssecrets(auth1_t *inp, size_t idx, uint8_t elt) { @@ -1191,6 +1326,11 @@ auth1_getarray_tlssecrets(auth1_t *inp) { return inp->tlssecrets; } +const uint8_t * +auth1_getconstarray_tlssecrets(const auth1_t *inp) +{ + return (const uint8_t *)auth1_getarray_tlssecrets((auth1_t*)inp); +} const uint8_t * auth1_get_end_of_fixed_part(const auth1_t *inp) { @@ -1203,12 +1343,17 @@ auth1_getlen_rand(const auth1_t *inp) }
uint8_t -auth1_get_rand(const auth1_t *inp, size_t idx) +auth1_get_rand(auth1_t *inp, size_t idx) { trunnel_assert(idx < 24); return inp->rand[idx]; }
+uint8_t +auth1_getconst_rand(const auth1_t *inp, size_t idx) +{ + return auth1_get_rand((auth1_t*)inp, idx); +} int auth1_set_rand(auth1_t *inp, size_t idx, uint8_t elt) { @@ -1222,6 +1367,11 @@ auth1_getarray_rand(auth1_t *inp) { return inp->rand; } +const uint8_t * +auth1_getconstarray_rand(const auth1_t *inp) +{ + return (const uint8_t *)auth1_getarray_rand((auth1_t*)inp); +} const uint8_t * auth1_get_end_of_signed(const auth1_t *inp) { @@ -1239,6 +1389,11 @@ auth1_get_sig(auth1_t *inp, size_t idx) return TRUNNEL_DYNARRAY_GET(&inp->sig, idx); }
+uint8_t +auth1_getconst_sig(const auth1_t *inp, size_t idx) +{ + return auth1_get_sig((auth1_t*)inp, idx); +} int auth1_set_sig(auth1_t *inp, size_t idx, uint8_t elt) { @@ -1260,6 +1415,11 @@ auth1_getarray_sig(auth1_t *inp) { return inp->sig.elts_; } +const uint8_t * +auth1_getconstarray_sig(const auth1_t *inp) +{ + return (const uint8_t *)auth1_getarray_sig((auth1_t*)inp); +} int auth1_setlen_sig(auth1_t *inp, size_t newlen) { @@ -1669,6 +1829,11 @@ certs_cell_get_certs(certs_cell_t *inp, size_t idx) return TRUNNEL_DYNARRAY_GET(&inp->certs, idx); }
+ const struct certs_cell_cert_st * +certs_cell_getconst_certs(const certs_cell_t *inp, size_t idx) +{ + return certs_cell_get_certs((certs_cell_t*)inp, idx); +} int certs_cell_set_certs(certs_cell_t *inp, size_t idx, struct certs_cell_cert_st * elt) { @@ -1702,6 +1867,11 @@ certs_cell_getarray_certs(certs_cell_t *inp) { return inp->certs.elts_; } +const struct certs_cell_cert_st * const * +certs_cell_getconstarray_certs(const certs_cell_t *inp) +{ + return (const struct certs_cell_cert_st * const *)certs_cell_getarray_certs((certs_cell_t*)inp); +} int certs_cell_setlen_certs(certs_cell_t *inp, size_t newlen) { diff --git a/src/trunnel/link_handshake.h b/src/trunnel/link_handshake.h index 54611b9..0b2ad34 100644 --- a/src/trunnel/link_handshake.h +++ b/src/trunnel/link_handshake.h @@ -1,4 +1,4 @@ -/* link_handshake.h -- generated by by Trunnel v1.4.6. +/* link_handshake.h -- generated by by Trunnel v1.5. * https://gitweb.torproject.org/trunnel.git * You probably shouldn't edit this file. */ @@ -121,7 +121,11 @@ size_t auth_challenge_cell_getlen_challenge(const auth_challenge_cell_t *inp); /** Return the element at position 'idx' of the fixed array field * challenge of the auth_challenge_cell_t in 'inp'. */ -uint8_t auth_challenge_cell_get_challenge(const auth_challenge_cell_t *inp, size_t idx); +uint8_t auth_challenge_cell_get_challenge(auth_challenge_cell_t *inp, size_t idx); +/** As auth_challenge_cell_get_challenge, but take and return a const + * pointer + */ +uint8_t auth_challenge_cell_getconst_challenge(const auth_challenge_cell_t *inp, size_t idx); /** Change the element at position 'idx' of the fixed array field * challenge of the auth_challenge_cell_t in 'inp', so that it will * hold the value 'elt'. @@ -130,6 +134,10 @@ int auth_challenge_cell_set_challenge(auth_challenge_cell_t *inp, size_t idx, ui /** Return a pointer to the 32-element array field challenge of 'inp'. */ uint8_t * auth_challenge_cell_getarray_challenge(auth_challenge_cell_t *inp); +/** As auth_challenge_cell_get_challenge, but take and return a const + * pointer + */ +const uint8_t * auth_challenge_cell_getconstarray_challenge(const auth_challenge_cell_t *inp); /** Return the value of the n_methods field of the * auth_challenge_cell_t in 'inp' */ @@ -147,6 +155,10 @@ size_t auth_challenge_cell_getlen_methods(const auth_challenge_cell_t *inp); * methods of the auth_challenge_cell_t in 'inp'. */ uint16_t auth_challenge_cell_get_methods(auth_challenge_cell_t *inp, size_t idx); +/** As auth_challenge_cell_get_methods, but take and return a const + * pointer + */ +uint16_t auth_challenge_cell_getconst_methods(const auth_challenge_cell_t *inp, size_t idx); /** Change the element at position 'idx' of the dynamic array field * methods of the auth_challenge_cell_t in 'inp', so that it will hold * the value 'elt'. @@ -160,6 +172,10 @@ int auth_challenge_cell_add_methods(auth_challenge_cell_t *inp, uint16_t elt); * 'inp'. */ uint16_t * auth_challenge_cell_getarray_methods(auth_challenge_cell_t *inp); +/** As auth_challenge_cell_get_methods, but take and return a const + * pointer + */ +const uint16_t * auth_challenge_cell_getconstarray_methods(const auth_challenge_cell_t *inp); /** Change the length of the variable-length array field methods of * 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success; * return -1 and set the error code on 'inp' on failure. @@ -242,6 +258,9 @@ size_t certs_cell_cert_getlen_body(const certs_cell_cert_t *inp); * body of the certs_cell_cert_t in 'inp'. */ uint8_t certs_cell_cert_get_body(certs_cell_cert_t *inp, size_t idx); +/** As certs_cell_cert_get_body, but take and return a const pointer + */ +uint8_t certs_cell_cert_getconst_body(const certs_cell_cert_t *inp, size_t idx); /** Change the element at position 'idx' of the dynamic array field * body of the certs_cell_cert_t in 'inp', so that it will hold the * value 'elt'. @@ -254,6 +273,9 @@ int certs_cell_cert_add_body(certs_cell_cert_t *inp, uint8_t elt); /** Return a pointer to the variable-length array field body of 'inp'. */ uint8_t * certs_cell_cert_getarray_body(certs_cell_cert_t *inp); +/** As certs_cell_cert_get_body, but take and return a const pointer + */ +const uint8_t * certs_cell_cert_getconstarray_body(const certs_cell_cert_t *inp); /** Change the length of the variable-length array field body of 'inp' * to 'newlen'.Fill extra elements with 0. Return 0 on success; return * -1 and set the error code on 'inp' on failure. @@ -302,7 +324,11 @@ size_t rsa_ed_crosscert_getlen_ed_key(const rsa_ed_crosscert_t *inp); /** Return the element at position 'idx' of the fixed array field * ed_key of the rsa_ed_crosscert_t in 'inp'. */ -uint8_t rsa_ed_crosscert_get_ed_key(const rsa_ed_crosscert_t *inp, size_t idx); +uint8_t rsa_ed_crosscert_get_ed_key(rsa_ed_crosscert_t *inp, size_t idx); +/** As rsa_ed_crosscert_get_ed_key, but take and return a const + * pointer + */ +uint8_t rsa_ed_crosscert_getconst_ed_key(const rsa_ed_crosscert_t *inp, size_t idx); /** Change the element at position 'idx' of the fixed array field * ed_key of the rsa_ed_crosscert_t in 'inp', so that it will hold the * value 'elt'. @@ -311,6 +337,10 @@ int rsa_ed_crosscert_set_ed_key(rsa_ed_crosscert_t *inp, size_t idx, uint8_t elt /** Return a pointer to the 32-element array field ed_key of 'inp'. */ uint8_t * rsa_ed_crosscert_getarray_ed_key(rsa_ed_crosscert_t *inp); +/** As rsa_ed_crosscert_get_ed_key, but take and return a const + * pointer + */ +const uint8_t * rsa_ed_crosscert_getconstarray_ed_key(const rsa_ed_crosscert_t *inp); /** Return the value of the expiration field of the rsa_ed_crosscert_t * in 'inp' */ @@ -340,6 +370,9 @@ size_t rsa_ed_crosscert_getlen_sig(const rsa_ed_crosscert_t *inp); * sig of the rsa_ed_crosscert_t in 'inp'. */ uint8_t rsa_ed_crosscert_get_sig(rsa_ed_crosscert_t *inp, size_t idx); +/** As rsa_ed_crosscert_get_sig, but take and return a const pointer + */ +uint8_t rsa_ed_crosscert_getconst_sig(const rsa_ed_crosscert_t *inp, size_t idx); /** Change the element at position 'idx' of the dynamic array field * sig of the rsa_ed_crosscert_t in 'inp', so that it will hold the * value 'elt'. @@ -352,6 +385,9 @@ int rsa_ed_crosscert_add_sig(rsa_ed_crosscert_t *inp, uint8_t elt); /** Return a pointer to the variable-length array field sig of 'inp'. */ uint8_t * rsa_ed_crosscert_getarray_sig(rsa_ed_crosscert_t *inp); +/** As rsa_ed_crosscert_get_sig, but take and return a const pointer + */ +const uint8_t * rsa_ed_crosscert_getconstarray_sig(const rsa_ed_crosscert_t *inp); /** Change the length of the variable-length array field sig of 'inp' * to 'newlen'.Fill extra elements with 0. Return 0 on success; return * -1 and set the error code on 'inp' on failure. @@ -398,7 +434,10 @@ size_t auth1_getlen_type(const auth1_t *inp); /** Return the element at position 'idx' of the fixed array field type * of the auth1_t in 'inp'. */ -uint8_t auth1_get_type(const auth1_t *inp, size_t idx); +uint8_t auth1_get_type(auth1_t *inp, size_t idx); +/** As auth1_get_type, but take and return a const pointer + */ +uint8_t auth1_getconst_type(const auth1_t *inp, size_t idx); /** Change the element at position 'idx' of the fixed array field type * of the auth1_t in 'inp', so that it will hold the value 'elt'. */ @@ -406,6 +445,9 @@ int auth1_set_type(auth1_t *inp, size_t idx, uint8_t elt); /** Return a pointer to the 8-element array field type of 'inp'. */ uint8_t * auth1_getarray_type(auth1_t *inp); +/** As auth1_get_type, but take and return a const pointer + */ +const uint8_t * auth1_getconstarray_type(const auth1_t *inp); /** Return the (constant) length of the array holding the cid field of * the auth1_t in 'inp'. */ @@ -413,7 +455,10 @@ size_t auth1_getlen_cid(const auth1_t *inp); /** Return the element at position 'idx' of the fixed array field cid * of the auth1_t in 'inp'. */ -uint8_t auth1_get_cid(const auth1_t *inp, size_t idx); +uint8_t auth1_get_cid(auth1_t *inp, size_t idx); +/** As auth1_get_cid, but take and return a const pointer + */ +uint8_t auth1_getconst_cid(const auth1_t *inp, size_t idx); /** Change the element at position 'idx' of the fixed array field cid * of the auth1_t in 'inp', so that it will hold the value 'elt'. */ @@ -421,6 +466,9 @@ int auth1_set_cid(auth1_t *inp, size_t idx, uint8_t elt); /** Return a pointer to the 32-element array field cid of 'inp'. */ uint8_t * auth1_getarray_cid(auth1_t *inp); +/** As auth1_get_cid, but take and return a const pointer + */ +const uint8_t * auth1_getconstarray_cid(const auth1_t *inp); /** Return the (constant) length of the array holding the sid field of * the auth1_t in 'inp'. */ @@ -428,7 +476,10 @@ size_t auth1_getlen_sid(const auth1_t *inp); /** Return the element at position 'idx' of the fixed array field sid * of the auth1_t in 'inp'. */ -uint8_t auth1_get_sid(const auth1_t *inp, size_t idx); +uint8_t auth1_get_sid(auth1_t *inp, size_t idx); +/** As auth1_get_sid, but take and return a const pointer + */ +uint8_t auth1_getconst_sid(const auth1_t *inp, size_t idx); /** Change the element at position 'idx' of the fixed array field sid * of the auth1_t in 'inp', so that it will hold the value 'elt'. */ @@ -436,6 +487,9 @@ int auth1_set_sid(auth1_t *inp, size_t idx, uint8_t elt); /** Return a pointer to the 32-element array field sid of 'inp'. */ uint8_t * auth1_getarray_sid(auth1_t *inp); +/** As auth1_get_sid, but take and return a const pointer + */ +const uint8_t * auth1_getconstarray_sid(const auth1_t *inp); /** Return the (constant) length of the array holding the u1_cid_ed * field of the auth1_t in 'inp'. */ @@ -443,7 +497,10 @@ size_t auth1_getlen_u1_cid_ed(const auth1_t *inp); /** Return the element at position 'idx' of the fixed array field * u1_cid_ed of the auth1_t in 'inp'. */ -uint8_t auth1_get_u1_cid_ed(const auth1_t *inp, size_t idx); +uint8_t auth1_get_u1_cid_ed(auth1_t *inp, size_t idx); +/** As auth1_get_u1_cid_ed, but take and return a const pointer + */ +uint8_t auth1_getconst_u1_cid_ed(const auth1_t *inp, size_t idx); /** Change the element at position 'idx' of the fixed array field * u1_cid_ed of the auth1_t in 'inp', so that it will hold the value * 'elt'. @@ -452,6 +509,9 @@ int auth1_set_u1_cid_ed(auth1_t *inp, size_t idx, uint8_t elt); /** Return a pointer to the 32-element array field u1_cid_ed of 'inp'. */ uint8_t * auth1_getarray_u1_cid_ed(auth1_t *inp); +/** As auth1_get_u1_cid_ed, but take and return a const pointer + */ +const uint8_t * auth1_getconstarray_u1_cid_ed(const auth1_t *inp); /** Return the (constant) length of the array holding the u1_sid_ed * field of the auth1_t in 'inp'. */ @@ -459,7 +519,10 @@ size_t auth1_getlen_u1_sid_ed(const auth1_t *inp); /** Return the element at position 'idx' of the fixed array field * u1_sid_ed of the auth1_t in 'inp'. */ -uint8_t auth1_get_u1_sid_ed(const auth1_t *inp, size_t idx); +uint8_t auth1_get_u1_sid_ed(auth1_t *inp, size_t idx); +/** As auth1_get_u1_sid_ed, but take and return a const pointer + */ +uint8_t auth1_getconst_u1_sid_ed(const auth1_t *inp, size_t idx); /** Change the element at position 'idx' of the fixed array field * u1_sid_ed of the auth1_t in 'inp', so that it will hold the value * 'elt'. @@ -468,6 +531,9 @@ int auth1_set_u1_sid_ed(auth1_t *inp, size_t idx, uint8_t elt); /** Return a pointer to the 32-element array field u1_sid_ed of 'inp'. */ uint8_t * auth1_getarray_u1_sid_ed(auth1_t *inp); +/** As auth1_get_u1_sid_ed, but take and return a const pointer + */ +const uint8_t * auth1_getconstarray_u1_sid_ed(const auth1_t *inp); /** Return the (constant) length of the array holding the slog field * of the auth1_t in 'inp'. */ @@ -475,7 +541,10 @@ size_t auth1_getlen_slog(const auth1_t *inp); /** Return the element at position 'idx' of the fixed array field slog * of the auth1_t in 'inp'. */ -uint8_t auth1_get_slog(const auth1_t *inp, size_t idx); +uint8_t auth1_get_slog(auth1_t *inp, size_t idx); +/** As auth1_get_slog, but take and return a const pointer + */ +uint8_t auth1_getconst_slog(const auth1_t *inp, size_t idx); /** Change the element at position 'idx' of the fixed array field slog * of the auth1_t in 'inp', so that it will hold the value 'elt'. */ @@ -483,6 +552,9 @@ int auth1_set_slog(auth1_t *inp, size_t idx, uint8_t elt); /** Return a pointer to the 32-element array field slog of 'inp'. */ uint8_t * auth1_getarray_slog(auth1_t *inp); +/** As auth1_get_slog, but take and return a const pointer + */ +const uint8_t * auth1_getconstarray_slog(const auth1_t *inp); /** Return the (constant) length of the array holding the clog field * of the auth1_t in 'inp'. */ @@ -490,7 +562,10 @@ size_t auth1_getlen_clog(const auth1_t *inp); /** Return the element at position 'idx' of the fixed array field clog * of the auth1_t in 'inp'. */ -uint8_t auth1_get_clog(const auth1_t *inp, size_t idx); +uint8_t auth1_get_clog(auth1_t *inp, size_t idx); +/** As auth1_get_clog, but take and return a const pointer + */ +uint8_t auth1_getconst_clog(const auth1_t *inp, size_t idx); /** Change the element at position 'idx' of the fixed array field clog * of the auth1_t in 'inp', so that it will hold the value 'elt'. */ @@ -498,6 +573,9 @@ int auth1_set_clog(auth1_t *inp, size_t idx, uint8_t elt); /** Return a pointer to the 32-element array field clog of 'inp'. */ uint8_t * auth1_getarray_clog(auth1_t *inp); +/** As auth1_get_clog, but take and return a const pointer + */ +const uint8_t * auth1_getconstarray_clog(const auth1_t *inp); /** Return the (constant) length of the array holding the scert field * of the auth1_t in 'inp'. */ @@ -505,7 +583,10 @@ size_t auth1_getlen_scert(const auth1_t *inp); /** Return the element at position 'idx' of the fixed array field * scert of the auth1_t in 'inp'. */ -uint8_t auth1_get_scert(const auth1_t *inp, size_t idx); +uint8_t auth1_get_scert(auth1_t *inp, size_t idx); +/** As auth1_get_scert, but take and return a const pointer + */ +uint8_t auth1_getconst_scert(const auth1_t *inp, size_t idx); /** Change the element at position 'idx' of the fixed array field * scert of the auth1_t in 'inp', so that it will hold the value * 'elt'. @@ -514,6 +595,9 @@ int auth1_set_scert(auth1_t *inp, size_t idx, uint8_t elt); /** Return a pointer to the 32-element array field scert of 'inp'. */ uint8_t * auth1_getarray_scert(auth1_t *inp); +/** As auth1_get_scert, but take and return a const pointer + */ +const uint8_t * auth1_getconstarray_scert(const auth1_t *inp); /** Return the (constant) length of the array holding the tlssecrets * field of the auth1_t in 'inp'. */ @@ -521,7 +605,10 @@ size_t auth1_getlen_tlssecrets(const auth1_t *inp); /** Return the element at position 'idx' of the fixed array field * tlssecrets of the auth1_t in 'inp'. */ -uint8_t auth1_get_tlssecrets(const auth1_t *inp, size_t idx); +uint8_t auth1_get_tlssecrets(auth1_t *inp, size_t idx); +/** As auth1_get_tlssecrets, but take and return a const pointer + */ +uint8_t auth1_getconst_tlssecrets(const auth1_t *inp, size_t idx); /** Change the element at position 'idx' of the fixed array field * tlssecrets of the auth1_t in 'inp', so that it will hold the value * 'elt'. @@ -531,6 +618,9 @@ int auth1_set_tlssecrets(auth1_t *inp, size_t idx, uint8_t elt); * 'inp'. */ uint8_t * auth1_getarray_tlssecrets(auth1_t *inp); +/** As auth1_get_tlssecrets, but take and return a const pointer + */ +const uint8_t * auth1_getconstarray_tlssecrets(const auth1_t *inp); /** Return the position for end_of_fixed_part when we parsed this * object */ @@ -542,7 +632,10 @@ size_t auth1_getlen_rand(const auth1_t *inp); /** Return the element at position 'idx' of the fixed array field rand * of the auth1_t in 'inp'. */ -uint8_t auth1_get_rand(const auth1_t *inp, size_t idx); +uint8_t auth1_get_rand(auth1_t *inp, size_t idx); +/** As auth1_get_rand, but take and return a const pointer + */ +uint8_t auth1_getconst_rand(const auth1_t *inp, size_t idx); /** Change the element at position 'idx' of the fixed array field rand * of the auth1_t in 'inp', so that it will hold the value 'elt'. */ @@ -550,6 +643,9 @@ int auth1_set_rand(auth1_t *inp, size_t idx, uint8_t elt); /** Return a pointer to the 24-element array field rand of 'inp'. */ uint8_t * auth1_getarray_rand(auth1_t *inp); +/** As auth1_get_rand, but take and return a const pointer + */ +const uint8_t * auth1_getconstarray_rand(const auth1_t *inp); /** Return the position for end_of_signed when we parsed this object */ const uint8_t * auth1_get_end_of_signed(const auth1_t *inp); @@ -561,6 +657,9 @@ size_t auth1_getlen_sig(const auth1_t *inp); * sig of the auth1_t in 'inp'. */ uint8_t auth1_get_sig(auth1_t *inp, size_t idx); +/** As auth1_get_sig, but take and return a const pointer + */ +uint8_t auth1_getconst_sig(const auth1_t *inp, size_t idx); /** Change the element at position 'idx' of the dynamic array field * sig of the auth1_t in 'inp', so that it will hold the value 'elt'. */ @@ -572,6 +671,9 @@ int auth1_add_sig(auth1_t *inp, uint8_t elt); /** Return a pointer to the variable-length array field sig of 'inp'. */ uint8_t * auth1_getarray_sig(auth1_t *inp); +/** As auth1_get_sig, but take and return a const pointer + */ +const uint8_t * auth1_getconstarray_sig(const auth1_t *inp); /** Change the length of the variable-length array field sig of 'inp' * to 'newlen'.Fill extra elements with 0. Return 0 on success; return * -1 and set the error code on 'inp' on failure. @@ -627,6 +729,9 @@ size_t certs_cell_getlen_certs(const certs_cell_t *inp); * certs of the certs_cell_t in 'inp'. */ struct certs_cell_cert_st * certs_cell_get_certs(certs_cell_t *inp, size_t idx); +/** As certs_cell_get_certs, but take and return a const pointer + */ + const struct certs_cell_cert_st * certs_cell_getconst_certs(const certs_cell_t *inp, size_t idx); /** Change the element at position 'idx' of the dynamic array field * certs of the certs_cell_t in 'inp', so that it will hold the value * 'elt'. Free the previous value, if any. @@ -643,6 +748,9 @@ int certs_cell_add_certs(certs_cell_t *inp, struct certs_cell_cert_st * elt); * 'inp'. */ struct certs_cell_cert_st * * certs_cell_getarray_certs(certs_cell_t *inp); +/** As certs_cell_get_certs, but take and return a const pointer + */ +const struct certs_cell_cert_st * const * certs_cell_getconstarray_certs(const certs_cell_t *inp); /** Change the length of the variable-length array field certs of * 'inp' to 'newlen'.Fill extra elements with NULL; free removed * elements. Return 0 on success; return -1 and set the error code on diff --git a/src/trunnel/pwbox.c b/src/trunnel/pwbox.c index 62662a9..059fcfd 100644 --- a/src/trunnel/pwbox.c +++ b/src/trunnel/pwbox.c @@ -1,4 +1,4 @@ -/* pwbox.c -- generated by Trunnel v1.4.6. +/* pwbox.c -- generated by Trunnel v1.5. * https://gitweb.torproject.org/trunnel.git * You probably shouldn't edit this file. */ @@ -114,6 +114,11 @@ pwbox_encoded_get_skey_header(pwbox_encoded_t *inp, size_t idx) return TRUNNEL_DYNARRAY_GET(&inp->skey_header, idx); }
+uint8_t +pwbox_encoded_getconst_skey_header(const pwbox_encoded_t *inp, size_t idx) +{ + return pwbox_encoded_get_skey_header((pwbox_encoded_t*)inp, idx); +} int pwbox_encoded_set_skey_header(pwbox_encoded_t *inp, size_t idx, uint8_t elt) { @@ -139,6 +144,11 @@ pwbox_encoded_getarray_skey_header(pwbox_encoded_t *inp) { return inp->skey_header.elts_; } +const uint8_t * +pwbox_encoded_getconstarray_skey_header(const pwbox_encoded_t *inp) +{ + return (const uint8_t *)pwbox_encoded_getarray_skey_header((pwbox_encoded_t*)inp); +} int pwbox_encoded_setlen_skey_header(pwbox_encoded_t *inp, size_t newlen) { @@ -166,12 +176,17 @@ pwbox_encoded_getlen_iv(const pwbox_encoded_t *inp) }
uint8_t -pwbox_encoded_get_iv(const pwbox_encoded_t *inp, size_t idx) +pwbox_encoded_get_iv(pwbox_encoded_t *inp, size_t idx) { trunnel_assert(idx < 16); return inp->iv[idx]; }
+uint8_t +pwbox_encoded_getconst_iv(const pwbox_encoded_t *inp, size_t idx) +{ + return pwbox_encoded_get_iv((pwbox_encoded_t*)inp, idx); +} int pwbox_encoded_set_iv(pwbox_encoded_t *inp, size_t idx, uint8_t elt) { @@ -185,6 +200,11 @@ pwbox_encoded_getarray_iv(pwbox_encoded_t *inp) { return inp->iv; } +const uint8_t * +pwbox_encoded_getconstarray_iv(const pwbox_encoded_t *inp) +{ + return (const uint8_t *)pwbox_encoded_getarray_iv((pwbox_encoded_t*)inp); +} size_t pwbox_encoded_getlen_data(const pwbox_encoded_t *inp) { @@ -197,6 +217,11 @@ pwbox_encoded_get_data(pwbox_encoded_t *inp, size_t idx) return TRUNNEL_DYNARRAY_GET(&inp->data, idx); }
+uint8_t +pwbox_encoded_getconst_data(const pwbox_encoded_t *inp, size_t idx) +{ + return pwbox_encoded_get_data((pwbox_encoded_t*)inp, idx); +} int pwbox_encoded_set_data(pwbox_encoded_t *inp, size_t idx, uint8_t elt) { @@ -218,6 +243,11 @@ pwbox_encoded_getarray_data(pwbox_encoded_t *inp) { return inp->data.elts_; } +const uint8_t * +pwbox_encoded_getconstarray_data(const pwbox_encoded_t *inp) +{ + return (const uint8_t *)pwbox_encoded_getarray_data((pwbox_encoded_t*)inp); +} int pwbox_encoded_setlen_data(pwbox_encoded_t *inp, size_t newlen) { @@ -241,12 +271,17 @@ pwbox_encoded_getlen_hmac(const pwbox_encoded_t *inp) }
uint8_t -pwbox_encoded_get_hmac(const pwbox_encoded_t *inp, size_t idx) +pwbox_encoded_get_hmac(pwbox_encoded_t *inp, size_t idx) { trunnel_assert(idx < 32); return inp->hmac[idx]; }
+uint8_t +pwbox_encoded_getconst_hmac(const pwbox_encoded_t *inp, size_t idx) +{ + return pwbox_encoded_get_hmac((pwbox_encoded_t*)inp, idx); +} int pwbox_encoded_set_hmac(pwbox_encoded_t *inp, size_t idx, uint8_t elt) { @@ -260,6 +295,11 @@ pwbox_encoded_getarray_hmac(pwbox_encoded_t *inp) { return inp->hmac; } +const uint8_t * +pwbox_encoded_getconstarray_hmac(const pwbox_encoded_t *inp) +{ + return (const uint8_t *)pwbox_encoded_getarray_hmac((pwbox_encoded_t*)inp); +} const char * pwbox_encoded_check(const pwbox_encoded_t *obj) { diff --git a/src/trunnel/pwbox.h b/src/trunnel/pwbox.h index 77a813d..9376a7c 100644 --- a/src/trunnel/pwbox.h +++ b/src/trunnel/pwbox.h @@ -1,4 +1,4 @@ -/* pwbox.h -- generated by by Trunnel v1.4.6. +/* pwbox.h -- generated by by Trunnel v1.5. * https://gitweb.torproject.org/trunnel.git * You probably shouldn't edit this file. */ @@ -93,6 +93,10 @@ size_t pwbox_encoded_getlen_skey_header(const pwbox_encoded_t *inp); * skey_header of the pwbox_encoded_t in 'inp'. */ uint8_t pwbox_encoded_get_skey_header(pwbox_encoded_t *inp, size_t idx); +/** As pwbox_encoded_get_skey_header, but take and return a const + * pointer + */ +uint8_t pwbox_encoded_getconst_skey_header(const pwbox_encoded_t *inp, size_t idx); /** Change the element at position 'idx' of the dynamic array field * skey_header of the pwbox_encoded_t in 'inp', so that it will hold * the value 'elt'. @@ -106,6 +110,10 @@ int pwbox_encoded_add_skey_header(pwbox_encoded_t *inp, uint8_t elt); * 'inp'. */ uint8_t * pwbox_encoded_getarray_skey_header(pwbox_encoded_t *inp); +/** As pwbox_encoded_get_skey_header, but take and return a const + * pointer + */ +const uint8_t * pwbox_encoded_getconstarray_skey_header(const pwbox_encoded_t *inp); /** Change the length of the variable-length array field skey_header * of 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on * success; return -1 and set the error code on 'inp' on failure. @@ -118,7 +126,10 @@ size_t pwbox_encoded_getlen_iv(const pwbox_encoded_t *inp); /** Return the element at position 'idx' of the fixed array field iv * of the pwbox_encoded_t in 'inp'. */ -uint8_t pwbox_encoded_get_iv(const pwbox_encoded_t *inp, size_t idx); +uint8_t pwbox_encoded_get_iv(pwbox_encoded_t *inp, size_t idx); +/** As pwbox_encoded_get_iv, but take and return a const pointer + */ +uint8_t pwbox_encoded_getconst_iv(const pwbox_encoded_t *inp, size_t idx); /** Change the element at position 'idx' of the fixed array field iv * of the pwbox_encoded_t in 'inp', so that it will hold the value * 'elt'. @@ -127,6 +138,9 @@ int pwbox_encoded_set_iv(pwbox_encoded_t *inp, size_t idx, uint8_t elt); /** Return a pointer to the 16-element array field iv of 'inp'. */ uint8_t * pwbox_encoded_getarray_iv(pwbox_encoded_t *inp); +/** As pwbox_encoded_get_iv, but take and return a const pointer + */ +const uint8_t * pwbox_encoded_getconstarray_iv(const pwbox_encoded_t *inp); /** Return the length of the dynamic array holding the data field of * the pwbox_encoded_t in 'inp'. */ @@ -135,6 +149,9 @@ size_t pwbox_encoded_getlen_data(const pwbox_encoded_t *inp); * data of the pwbox_encoded_t in 'inp'. */ uint8_t pwbox_encoded_get_data(pwbox_encoded_t *inp, size_t idx); +/** As pwbox_encoded_get_data, but take and return a const pointer + */ +uint8_t pwbox_encoded_getconst_data(const pwbox_encoded_t *inp, size_t idx); /** Change the element at position 'idx' of the dynamic array field * data of the pwbox_encoded_t in 'inp', so that it will hold the * value 'elt'. @@ -147,6 +164,9 @@ int pwbox_encoded_add_data(pwbox_encoded_t *inp, uint8_t elt); /** Return a pointer to the variable-length array field data of 'inp'. */ uint8_t * pwbox_encoded_getarray_data(pwbox_encoded_t *inp); +/** As pwbox_encoded_get_data, but take and return a const pointer + */ +const uint8_t * pwbox_encoded_getconstarray_data(const pwbox_encoded_t *inp); /** Change the length of the variable-length array field data of 'inp' * to 'newlen'.Fill extra elements with 0. Return 0 on success; return * -1 and set the error code on 'inp' on failure. @@ -159,7 +179,10 @@ size_t pwbox_encoded_getlen_hmac(const pwbox_encoded_t *inp); /** Return the element at position 'idx' of the fixed array field hmac * of the pwbox_encoded_t in 'inp'. */ -uint8_t pwbox_encoded_get_hmac(const pwbox_encoded_t *inp, size_t idx); +uint8_t pwbox_encoded_get_hmac(pwbox_encoded_t *inp, size_t idx); +/** As pwbox_encoded_get_hmac, but take and return a const pointer + */ +uint8_t pwbox_encoded_getconst_hmac(const pwbox_encoded_t *inp, size_t idx); /** Change the element at position 'idx' of the fixed array field hmac * of the pwbox_encoded_t in 'inp', so that it will hold the value * 'elt'. @@ -168,6 +191,9 @@ int pwbox_encoded_set_hmac(pwbox_encoded_t *inp, size_t idx, uint8_t elt); /** Return a pointer to the 32-element array field hmac of 'inp'. */ uint8_t * pwbox_encoded_getarray_hmac(pwbox_encoded_t *inp); +/** As pwbox_encoded_get_hmac, but take and return a const pointer + */ +const uint8_t * pwbox_encoded_getconstarray_hmac(const pwbox_encoded_t *inp);
#endif