/* Compute the client-side signature. This is invoked only when a signature-based client authentication was selected. The computed signature is in the pad; its length (in bytes) is returned. On error, 0 is returned.  */
static size_t make_client_sign(br_ssl_client_context *ctx)
/* Compute the client-side signature. This is invoked only when a signature-based client authentication was selected. The computed signature is in the pad; its length (in bytes) is returned. On error, 0 is returned.  */
static size_t make_client_sign(br_ssl_client_context *ctx)
{
	size_t hv_len;
	if (ctx->hash_id) {
		hv_len = br_multihash_out(&ctx->eng.mhash,
			ctx->hash_id, ctx->eng.pad);
	} else {
		br_multihash_out(&ctx->eng.mhash,
			br_md5_ID, ctx->eng.pad);
		br_multihash_out(&ctx->eng.mhash,
			br_sha1_ID, ctx->eng.pad + 16);
		hv_len = 36;
	}
	return (*ctx->client_auth_vtable)->do_sign(
		ctx->client_auth_vtable, ctx->hash_id, hv_len,
		ctx->eng.pad, sizeof ctx->eng.pad);
}