From: Rudolf Polzer Date: Mon, 5 Jul 2010 13:49:36 +0000 (+0200) Subject: allow reading/writing the camouflage X-Git-Tag: xonotic-v0.1.0preview~38^2~17 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=aecc5704d2dc61be172f516dbc3a01c5553fedc8;p=xonotic%2Fd0_blind_id.git allow reading/writing the camouflage --- diff --git a/d0_blind_id.c b/d0_blind_id.c index 9faab7c..7c1f010 100644 --- a/d0_blind_id.c +++ b/d0_blind_id.c @@ -470,6 +470,40 @@ fail: return 0; } +WARN_UNUSED_RESULT BOOL d0_blind_id_read_private_id_request_camouflage(d0_blind_id_t *ctx, const char *inbuf, size_t inbuflen) +{ + d0_iobuf_t *in = NULL; + + REPLACING(rsa_blind_signature_camouflage); + + in = d0_iobuf_open_read(inbuf, inbuflen); + + CHECK_ASSIGN(ctx->rsa_blind_signature_camouflage, d0_iobuf_read_bignum(in, ctx->rsa_blind_signature_camouflage)); + + return d0_iobuf_close(in, NULL); + +fail: + d0_iobuf_close(in, NULL); + return 0; +} + +WARN_UNUSED_RESULT BOOL d0_blind_id_write_private_id_request_camouflage(d0_blind_id_t *ctx, char *outbuf, size_t *outbuflen) +{ + d0_iobuf_t *out = NULL; + + USING(rsa_blind_signature_camouflage); + + out = d0_iobuf_open_write(outbuf, *outbuflen); + + CHECK(d0_iobuf_write_bignum(out, ctx->rsa_blind_signature_camouflage)); + + return d0_iobuf_close(out, outbuflen); + +fail: + d0_iobuf_close(out, outbuflen); + return 0; +} + WARN_UNUSED_RESULT BOOL d0_blind_id_read_private_id(d0_blind_id_t *ctx, const char *inbuf, size_t inbuflen) { d0_iobuf_t *in = NULL; diff --git a/d0_blind_id.h b/d0_blind_id.h index 5260aca..511ea82 100644 --- a/d0_blind_id.h +++ b/d0_blind_id.h @@ -18,10 +18,12 @@ EXPORT WARN_UNUSED_RESULT BOOL d0_blind_id_fingerprint64_public_key(d0_blind_id_ EXPORT WARN_UNUSED_RESULT BOOL d0_blind_id_generate_private_id_modulus(d0_blind_id_t *ctx); EXPORT WARN_UNUSED_RESULT BOOL d0_blind_id_read_private_id_modulus(d0_blind_id_t *ctx, const char *inbuf, size_t inbuflen); EXPORT WARN_UNUSED_RESULT BOOL d0_blind_id_write_private_id_modulus(d0_blind_id_t *ctx, char *outbuf, size_t *outbuflen); -EXPORT WARN_UNUSED_RESULT BOOL d0_blind_id_generate_private_id_start(d0_blind_id_t *ctx); // generates a modulus if necessary +EXPORT WARN_UNUSED_RESULT BOOL d0_blind_id_generate_private_id_start(d0_blind_id_t *ctx); EXPORT WARN_UNUSED_RESULT BOOL d0_blind_id_generate_private_id_request(d0_blind_id_t *ctx, char *outbuf, size_t *outbuflen); EXPORT WARN_UNUSED_RESULT BOOL d0_blind_id_answer_private_id_request(d0_blind_id_t *ctx, const char *inbuf, size_t inbuflen, char *outbuf, size_t *outbuflen); EXPORT WARN_UNUSED_RESULT BOOL d0_blind_id_finish_private_id_request(d0_blind_id_t *ctx, const char *inbuf, size_t inbuflen); +EXPORT WARN_UNUSED_RESULT BOOL d0_blind_id_read_private_id_request_camouflage(d0_blind_id_t *ctx, const char *inbuf, size_t inbuflen); +EXPORT WARN_UNUSED_RESULT BOOL d0_blind_id_write_private_id_request_camouflage(d0_blind_id_t *ctx, char *outbuf, size_t *outbuflen); EXPORT WARN_UNUSED_RESULT BOOL d0_blind_id_read_private_id(d0_blind_id_t *ctx, const char *inbuf, size_t inbuflen); EXPORT WARN_UNUSED_RESULT BOOL d0_blind_id_read_public_id(d0_blind_id_t *ctx, const char *inbuf, size_t inbuflen); EXPORT WARN_UNUSED_RESULT BOOL d0_blind_id_write_private_id(d0_blind_id_t *ctx, char *outbuf, size_t *outbuflen);