Skip to content

Commit

Permalink
Merge pull request #665 from libtom/pr/fix-anon-union
Browse files Browse the repository at this point in the history
avoid using anonymous union (issue #662)
  • Loading branch information
sjaeckel authored Sep 1, 2024
2 parents ab16280 + d85a4e0 commit fc6b420
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/headers/tomcrypt_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ struct get_char {
FILE *f;
#endif /* LTC_NO_FILE */
struct bufp buf;
};
} data;
struct str unget_buf;
char unget_buf_[LTC_PEM_DECODE_BUFSZ];
};
Expand Down
4 changes: 2 additions & 2 deletions src/misc/pem/pem_pkcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ int pem_decode_pkcs_filehandle(FILE *f, ltc_pka_key *k, const password_ctx *pw_c
LTC_ARGCHK(f != NULL);
LTC_ARGCHK(k != NULL);
{
struct get_char g = { .get = pem_get_char_from_file, .f = f };
struct get_char g = { .get = pem_get_char_from_file, .data.f = f };
return s_decode(&g, k, pw_ctx);
}
}
Expand All @@ -284,7 +284,7 @@ int pem_decode_pkcs(const void *buf, unsigned long len, ltc_pka_key *k, const pa
LTC_ARGCHK(len != 0);
LTC_ARGCHK(k != NULL);
{
struct get_char g = { .get = pem_get_char_from_buf, SET_BUFP(.buf, buf, len) };
struct get_char g = { .get = pem_get_char_from_buf, SET_BUFP(.data.buf, buf, len) };
return s_decode(&g, k, pw_ctx);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/misc/pem/pem_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ extern const unsigned long pem_dek_infos_num;
#ifndef LTC_NO_FILE
int pem_get_char_from_file(struct get_char *g)
{
return getc(g->f);
return getc(g->data.f);
}
#endif /* LTC_NO_FILE */

int pem_get_char_from_buf(struct get_char *g)
{
int ret;
if (g->buf.work == g->buf.end) {
if (g->data.buf.work == g->data.buf.end) {
return -1;
}
ret = *g->buf.work;
g->buf.work++;
ret = *g->data.buf.work;
g->data.buf.work++;
return ret;
}

Expand Down
4 changes: 2 additions & 2 deletions src/misc/pem/pem_ssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ int pem_decode_openssh_filehandle(FILE *f, ltc_pka_key *k, const password_ctx *p
LTC_ARGCHK(f != NULL);
LTC_ARGCHK(k != NULL);
{
struct get_char g = { .get = pem_get_char_from_file, .f = f };
struct get_char g = { .get = pem_get_char_from_file, .data.f = f };
return s_decode_openssh(&g, k, pw_ctx);
}
}
Expand Down Expand Up @@ -839,7 +839,7 @@ int pem_decode_openssh(const void *buf, unsigned long len, ltc_pka_key *k, const
LTC_ARGCHK(len != 0);
LTC_ARGCHK(k != NULL);
{
struct get_char g = { .get = pem_get_char_from_buf, SET_BUFP(.buf, buf, len) };
struct get_char g = { .get = pem_get_char_from_buf, SET_BUFP(.data.buf, buf, len) };
return s_decode_openssh(&g, k, pw_ctx);
}
}
Expand Down

0 comments on commit fc6b420

Please sign in to comment.