int pwbox_encoded_add_data(pwbox_encoded_t *inp, uint8_t elt) { TRUNNEL_DYNARRAY_ADD(uint8_t, &inp->data, elt, {}); return 0; trunnel_alloc_failed: TRUNNEL_SET_ERROR_CODE(inp); return -1; }
int trn_cell_rendezvous1_add_handshake_info(trn_cell_rendezvous1_t *inp, uint8_t elt) { TRUNNEL_DYNARRAY_ADD(uint8_t, &inp->handshake_info, elt, {}); return 0; trunnel_alloc_failed: TRUNNEL_SET_ERROR_CODE(inp); return -1; }
int trn_cell_introduce1_add_encrypted(trn_cell_introduce1_t *inp, uint8_t elt) { TRUNNEL_DYNARRAY_ADD(uint8_t, &inp->encrypted, elt, {}); return 0; trunnel_alloc_failed: TRUNNEL_SET_ERROR_CODE(inp); return -1; }
int auth1_add_sig(auth1_t *inp, uint8_t elt) { TRUNNEL_DYNARRAY_ADD(uint8_t, &inp->sig, elt, {}); return 0; trunnel_alloc_failed: TRUNNEL_SET_ERROR_CODE(inp); return -1; }
int ed25519_cert_extension_add_un_unparsed(ed25519_cert_extension_t *inp, uint8_t elt) { TRUNNEL_DYNARRAY_ADD(uint8_t, &inp->un_unparsed, elt, {}); return 0; trunnel_alloc_failed: TRUNNEL_SET_ERROR_CODE(inp); return -1; }
int pwbox_encoded_set_fixedbytes1(pwbox_encoded_t *inp, uint32_t val) { if (! ((val == PWBOX0_CONST1))) { TRUNNEL_SET_ERROR_CODE(inp); return -1; } inp->fixedbytes1 = val; return 0; }
int ed25519_cert_set_version(ed25519_cert_t *inp, uint8_t val) { if (! ((val == 1))) { TRUNNEL_SET_ERROR_CODE(inp); return -1; } inp->version = val; return 0; }
int trn_cell_introduce_encrypted_set_onion_key_type(trn_cell_introduce_encrypted_t *inp, uint8_t val) { if (! ((val == 1))) { TRUNNEL_SET_ERROR_CODE(inp); return -1; } inp->onion_key_type = val; return 0; }
int trn_cell_introduce1_set_auth_key_type(trn_cell_introduce1_t *inp, uint8_t val) { if (! ((val == 0 || val == 1 || val == 2))) { TRUNNEL_SET_ERROR_CODE(inp); return -1; } inp->auth_key_type = val; return 0; }
int trn_cell_introduce_ack_set_status(trn_cell_introduce_ack_t *inp, uint16_t val) { if (! ((val == 0 || val == 1 || val == 2))) { TRUNNEL_SET_ERROR_CODE(inp); return -1; } inp->status = val; return 0; }
int pwbox_encoded_add_skey_header(pwbox_encoded_t *inp, uint8_t elt) { #if SIZE_MAX >= UINT8_MAX if (inp->skey_header.n_ == UINT8_MAX) goto trunnel_alloc_failed; #endif TRUNNEL_DYNARRAY_ADD(uint8_t, &inp->skey_header, elt, {}); return 0; trunnel_alloc_failed: TRUNNEL_SET_ERROR_CODE(inp); return -1; }
int rsa_ed_crosscert_add_sig(rsa_ed_crosscert_t *inp, uint8_t elt) { #if SIZE_MAX >= UINT8_MAX if (inp->sig.n_ == UINT8_MAX) goto trunnel_alloc_failed; #endif TRUNNEL_DYNARRAY_ADD(uint8_t, &inp->sig, elt, {}); return 0; trunnel_alloc_failed: TRUNNEL_SET_ERROR_CODE(inp); return -1; }
int certs_cell_cert_add_body(certs_cell_cert_t *inp, uint8_t elt) { #if SIZE_MAX >= UINT16_MAX if (inp->body.n_ == UINT16_MAX) goto trunnel_alloc_failed; #endif TRUNNEL_DYNARRAY_ADD(uint8_t, &inp->body, elt, {}); return 0; trunnel_alloc_failed: TRUNNEL_SET_ERROR_CODE(inp); return -1; }
int trn_cell_introduce_encrypted_add_onion_key(trn_cell_introduce_encrypted_t *inp, uint8_t elt) { #if SIZE_MAX >= UINT16_MAX if (inp->onion_key.n_ == UINT16_MAX) goto trunnel_alloc_failed; #endif TRUNNEL_DYNARRAY_ADD(uint8_t, &inp->onion_key, elt, {}); return 0; trunnel_alloc_failed: TRUNNEL_SET_ERROR_CODE(inp); return -1; }
int auth_challenge_cell_add_methods(auth_challenge_cell_t *inp, uint16_t elt) { #if SIZE_MAX >= UINT16_MAX if (inp->methods.n_ == UINT16_MAX) goto trunnel_alloc_failed; #endif TRUNNEL_DYNARRAY_ADD(uint16_t, &inp->methods, elt, {}); return 0; trunnel_alloc_failed: TRUNNEL_SET_ERROR_CODE(inp); return -1; }
int auth1_setlen_sig(auth1_t *inp, size_t newlen) { uint8_t *newptr; newptr = trunnel_dynarray_setlen(&inp->sig.allocated_, &inp->sig.n_, inp->sig.elts_, newlen, sizeof(inp->sig.elts_[0]), (trunnel_free_fn_t) NULL, &inp->trunnel_error_code_); if (newptr == NULL) goto trunnel_alloc_failed; inp->sig.elts_ = newptr; return 0; trunnel_alloc_failed: TRUNNEL_SET_ERROR_CODE(inp); return -1; }
int trn_cell_introduce1_setlen_encrypted(trn_cell_introduce1_t *inp, size_t newlen) { uint8_t *newptr; newptr = trunnel_dynarray_setlen(&inp->encrypted.allocated_, &inp->encrypted.n_, inp->encrypted.elts_, newlen, sizeof(inp->encrypted.elts_[0]), (trunnel_free_fn_t) NULL, &inp->trunnel_error_code_); if (newlen != 0 && newptr == NULL) goto trunnel_alloc_failed; inp->encrypted.elts_ = newptr; return 0; trunnel_alloc_failed: TRUNNEL_SET_ERROR_CODE(inp); return -1; }
int ed25519_cert_extension_setlen_un_unparsed(ed25519_cert_extension_t *inp, size_t newlen) { uint8_t *newptr; newptr = trunnel_dynarray_setlen(&inp->un_unparsed.allocated_, &inp->un_unparsed.n_, inp->un_unparsed.elts_, newlen, sizeof(inp->un_unparsed.elts_[0]), (trunnel_free_fn_t) NULL, &inp->trunnel_error_code_); if (newptr == NULL) goto trunnel_alloc_failed; inp->un_unparsed.elts_ = newptr; return 0; trunnel_alloc_failed: TRUNNEL_SET_ERROR_CODE(inp); return -1; }
int trn_cell_rendezvous1_setlen_handshake_info(trn_cell_rendezvous1_t *inp, size_t newlen) { uint8_t *newptr; newptr = trunnel_dynarray_setlen(&inp->handshake_info.allocated_, &inp->handshake_info.n_, inp->handshake_info.elts_, newlen, sizeof(inp->handshake_info.elts_[0]), (trunnel_free_fn_t) NULL, &inp->trunnel_error_code_); if (newlen != 0 && newptr == NULL) goto trunnel_alloc_failed; inp->handshake_info.elts_ = newptr; return 0; trunnel_alloc_failed: TRUNNEL_SET_ERROR_CODE(inp); return -1; }
int rsa_ed_crosscert_setlen_sig(rsa_ed_crosscert_t *inp, size_t newlen) { uint8_t *newptr; #if UINT8_MAX < SIZE_MAX if (newlen > UINT8_MAX) goto trunnel_alloc_failed; #endif newptr = trunnel_dynarray_setlen(&inp->sig.allocated_, &inp->sig.n_, inp->sig.elts_, newlen, sizeof(inp->sig.elts_[0]), (trunnel_free_fn_t) NULL, &inp->trunnel_error_code_); if (newptr == NULL) goto trunnel_alloc_failed; inp->sig.elts_ = newptr; return 0; trunnel_alloc_failed: TRUNNEL_SET_ERROR_CODE(inp); return -1; }
int trn_cell_introduce_encrypted_setlen_onion_key(trn_cell_introduce_encrypted_t *inp, size_t newlen) { uint8_t *newptr; #if UINT16_MAX < SIZE_MAX if (newlen > UINT16_MAX) goto trunnel_alloc_failed; #endif newptr = trunnel_dynarray_setlen(&inp->onion_key.allocated_, &inp->onion_key.n_, inp->onion_key.elts_, newlen, sizeof(inp->onion_key.elts_[0]), (trunnel_free_fn_t) NULL, &inp->trunnel_error_code_); if (newlen != 0 && newptr == NULL) goto trunnel_alloc_failed; inp->onion_key.elts_ = newptr; return 0; trunnel_alloc_failed: TRUNNEL_SET_ERROR_CODE(inp); return -1; }
int auth_challenge_cell_setlen_methods(auth_challenge_cell_t *inp, size_t newlen) { uint16_t *newptr; #if UINT16_MAX < SIZE_MAX if (newlen > UINT16_MAX) goto trunnel_alloc_failed; #endif newptr = trunnel_dynarray_setlen(&inp->methods.allocated_, &inp->methods.n_, inp->methods.elts_, newlen, sizeof(inp->methods.elts_[0]), (trunnel_free_fn_t) NULL, &inp->trunnel_error_code_); if (newptr == NULL) goto trunnel_alloc_failed; inp->methods.elts_ = newptr; return 0; trunnel_alloc_failed: TRUNNEL_SET_ERROR_CODE(inp); return -1; }