v5 key fingerprints are SHA256 based. We have fallbacks for MD5 + SHA1
when libnettle is not present, but there's no intent to provide a SHA256
fallback, and we're close to the point where support for building
without libnettle will be removed entirely.
onak_status_t get_fingerprint(struct openpgp_packet *packet,
struct openpgp_fingerprint *fingerprint)
{
+#ifdef HAVE_NETTLE
struct sha256_ctx sha2_ctx;
+#endif
struct sha1_ctx sha_ctx;
struct md5_ctx md5_context;
unsigned char c;
sha1_digest(&sha_ctx, fingerprint->length, fingerprint->fp);
break;
+#ifdef HAVE_NETTLE
case 5:
sha256_init(&sha2_ctx);
/* RFC4880bis 12.2 */
sha256_digest(&sha2_ctx, fingerprint->length, fingerprint->fp);
break;
+#endif
default:
return ONAK_E_UNKNOWN_VER;
}