Skip to content

Commit fc6b420

Browse files
authored
Merge pull request #665 from libtom/pr/fix-anon-union
avoid using anonymous union (issue #662)
2 parents ab16280 + d85a4e0 commit fc6b420

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/headers/tomcrypt_private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ struct get_char {
347347
FILE *f;
348348
#endif /* LTC_NO_FILE */
349349
struct bufp buf;
350-
};
350+
} data;
351351
struct str unget_buf;
352352
char unget_buf_[LTC_PEM_DECODE_BUFSZ];
353353
};

src/misc/pem/pem_pkcs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ int pem_decode_pkcs_filehandle(FILE *f, ltc_pka_key *k, const password_ctx *pw_c
272272
LTC_ARGCHK(f != NULL);
273273
LTC_ARGCHK(k != NULL);
274274
{
275-
struct get_char g = { .get = pem_get_char_from_file, .f = f };
275+
struct get_char g = { .get = pem_get_char_from_file, .data.f = f };
276276
return s_decode(&g, k, pw_ctx);
277277
}
278278
}
@@ -284,7 +284,7 @@ int pem_decode_pkcs(const void *buf, unsigned long len, ltc_pka_key *k, const pa
284284
LTC_ARGCHK(len != 0);
285285
LTC_ARGCHK(k != NULL);
286286
{
287-
struct get_char g = { .get = pem_get_char_from_buf, SET_BUFP(.buf, buf, len) };
287+
struct get_char g = { .get = pem_get_char_from_buf, SET_BUFP(.data.buf, buf, len) };
288288
return s_decode(&g, k, pw_ctx);
289289
}
290290
}

src/misc/pem/pem_read.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ extern const unsigned long pem_dek_infos_num;
2020
#ifndef LTC_NO_FILE
2121
int pem_get_char_from_file(struct get_char *g)
2222
{
23-
return getc(g->f);
23+
return getc(g->data.f);
2424
}
2525
#endif /* LTC_NO_FILE */
2626

2727
int pem_get_char_from_buf(struct get_char *g)
2828
{
2929
int ret;
30-
if (g->buf.work == g->buf.end) {
30+
if (g->data.buf.work == g->data.buf.end) {
3131
return -1;
3232
}
33-
ret = *g->buf.work;
34-
g->buf.work++;
33+
ret = *g->data.buf.work;
34+
g->data.buf.work++;
3535
return ret;
3636
}
3737

src/misc/pem/pem_ssh.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ int pem_decode_openssh_filehandle(FILE *f, ltc_pka_key *k, const password_ctx *p
801801
LTC_ARGCHK(f != NULL);
802802
LTC_ARGCHK(k != NULL);
803803
{
804-
struct get_char g = { .get = pem_get_char_from_file, .f = f };
804+
struct get_char g = { .get = pem_get_char_from_file, .data.f = f };
805805
return s_decode_openssh(&g, k, pw_ctx);
806806
}
807807
}
@@ -839,7 +839,7 @@ int pem_decode_openssh(const void *buf, unsigned long len, ltc_pka_key *k, const
839839
LTC_ARGCHK(len != 0);
840840
LTC_ARGCHK(k != NULL);
841841
{
842-
struct get_char g = { .get = pem_get_char_from_buf, SET_BUFP(.buf, buf, len) };
842+
struct get_char g = { .get = pem_get_char_from_buf, SET_BUFP(.data.buf, buf, len) };
843843
return s_decode_openssh(&g, k, pw_ctx);
844844
}
845845
}

0 commit comments

Comments
 (0)