Using enums for fixed values looks cleaner. Also I am planning to use
version field in more places in next patch. So use enums intead of
numbers like 1 and 2.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
DIGEST_ALGO_MAX
};
+enum digsig_version {
+ DIGSIG_VERSION_1 = 1,
+ DIGSIG_VERSION_2
+};
+
struct pubkey_hdr {
uint8_t version; /* key format version */
uint32_t timestamp; /* key made, always 0 for now */
return -1;
/* now create a new hash */
- hdr->version = 1;
+ hdr->version = (uint8_t) DIGSIG_VERSION_1;
hdr->timestamp = time(NULL);
hdr->algo = PUBKEY_ALGO_RSA;
hashalgo_idx = get_hash_algo_v1(hashalgo);
if (!key)
return -1;
- hdr->version = 2;
+ hdr->version = (uint8_t) DIGSIG_VERSION_2;
hdr->hash_algo = get_hash_algo(algo);
calc_keyid_v2(&hdr->keyid, name, key);