Changed time_t timestamp type to uint32_t

time_t is actually long and is different on 32 and 64 bit architectures.
Format of the signatures should not depend on the architecture and should
be the same. Changed timestamp to uint32_t like in GPG.

Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@intel.com>
This commit is contained in:
Dmitry Kasatkin 2012-02-02 10:12:34 +02:00
parent ff071501d0
commit aa2f6e9b63

View File

@ -108,7 +108,7 @@ enum digest_algo {
struct pubkey_hdr {
uint8_t version; /* key format version */
time_t timestamp; /* key made, always 0 for now */
uint32_t timestamp; /* key made, always 0 for now */
uint8_t algo;
uint8_t nmpi;
char mpi[0];
@ -116,7 +116,7 @@ struct pubkey_hdr {
struct signature_hdr {
uint8_t version; /* signature format version */
time_t timestamp; /* signature made */
uint32_t timestamp; /* signature made */
uint8_t algo;
uint8_t hash;
uint8_t keyid[8];
@ -336,7 +336,7 @@ static int sign_hash(const unsigned char *hash, int size, const char *keyfile, u
/* now create a new hash */
hdr->version = 1;
time(&hdr->timestamp);
hdr->timestamp = time(NULL);
hdr->algo = PUBKEY_ALGO_RSA;
hdr->hash = DIGEST_ALGO_SHA1;