----- Original Message ----- > Now that TicketInfo can contain a plain text ticket, having rsa_ or > encrypted_ as prefix to most members is not correct. > --- > server/reds-private.h | 9 ++++++--- > server/reds.c | 11 ++++++----- > 2 files changed, 12 insertions(+), 8 deletions(-) > > diff --git a/server/reds-private.h b/server/reds-private.h > index 93a883a..c3f83c5 100644 > --- a/server/reds-private.h > +++ b/server/reds-private.h > @@ -16,10 +16,13 @@ typedef struct TicketAuthentication { > > typedef struct TicketInfo { > SpiceTicketEncryption encryption_type; > - RSA *rsa; > - int rsa_size; > + int size; "size", looks very generic, easy to confuse. It seems to represent the size of TicketInfo.ticket.encrypted_data. I wonder if the rest of renaming is really helping here... I think I would only rename rsa_size -> encrypted_size... > BIGNUM *bn; > - SpiceLinkEncryptedTicket encrypted_ticket; > + RSA *rsa; > + /* Contrary to what the type name implies, this can also contain an > + * unencrypted ticket > + */ > + SpiceLinkEncryptedTicket ticket; > } TicketInfo; > > typedef struct MonitorMode { > diff --git a/server/reds.c b/server/reds.c > index ff16df9..ba2a606 100644 > --- a/server/reds.c > +++ b/server/reds.c > @@ -1352,7 +1352,7 @@ static int reds_generate_ticket_pubkey(RedLinkInfo > *link, SpiceLinkReply *ack) > ERR_error_string(ERR_get_error(), NULL)); > goto end; > } > - link->tiTicketing.rsa_size = RSA_size(link->tiTicketing.rsa); > + link->tiTicketing.size = RSA_size(link->tiTicketing.rsa); > > i2d_RSA_PUBKEY_bio(bio, link->tiTicketing.rsa); > BIO_get_mem_ptr(bio, &bmBuf); > @@ -1404,6 +1404,7 @@ static int reds_send_link_ack(RedLinkInfo *link) > ack.num_channel_caps = channel_caps->num_caps; > header.size += (ack.num_common_caps + ack.num_channel_caps) * > sizeof(uint32_t); > ack.caps_offset = sizeof(SpiceLinkReply); > + > link->tiTicketing.encryption_type = SPICE_TICKET_ENCRYPTION_RSA; > if (!reds_generate_ticket_pubkey(link, &ack)) > goto end; > @@ -1857,8 +1858,8 @@ static char *reds_get_ticket(RedLinkInfo *link) > } > > password = g_malloc0(RSA_size(link->tiTicketing.rsa) + 1); > - password_size = RSA_private_decrypt(link->tiTicketing.rsa_size, > - > link->tiTicketing.encrypted_ticket.encrypted_data, > + password_size = RSA_private_decrypt(link->tiTicketing.size, > + > link->tiTicketing.ticket.encrypted_data, > (unsigned char *)password, > link->tiTicketing.rsa, > RSA_PKCS1_OAEP_PADDING); > @@ -1918,8 +1919,8 @@ static void reds_get_spice_ticket(RedLinkInfo *link) > { > AsyncRead *obj = &link->async_read; > > - obj->now = (uint8_t > *)&link->tiTicketing.encrypted_ticket.encrypted_data; > - obj->end = obj->now + link->tiTicketing.rsa_size; > + obj->now = (uint8_t *)&link->tiTicketing.ticket.encrypted_data; > + obj->end = obj->now + link->tiTicketing.size; > obj->done = reds_handle_ticket; > async_read_handler(0, 0, &link->async_read); > } > -- > 1.8.5.3 > > _______________________________________________ > Spice-devel mailing list > Spice-devel@xxxxxxxxxxxxxxxxxxxxx > http://lists.freedesktop.org/mailman/listinfo/spice-devel > _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel