consts: Whittle down to the essentials

This factors the junk drawer of constants into the relevant files.

There are still a few "global" ones left but they can be addressed in a
followup commit.
This commit is contained in:
Tony Arcieri
2019-12-08 08:39:21 -08:00
parent 4dfac56753
commit 104020d518
12 changed files with 102 additions and 111 deletions
+6 -1
View File
@@ -55,6 +55,11 @@ const OID_EC_PUBLIC_KEY: &str = "1.2.840.10045.2.1";
const OID_NIST_P256: &str = "1.2.840.10045.3.1.7";
const OID_NIST_P384: &str = "1.3.132.0.34";
#[allow(dead_code)]
const CERTINFO_UNCOMPRESSED: u8 = 0;
#[cfg(feature = "untested")]
const CERTINFO_GZIP: u8 = 1;
/// Information about a public key within a [`Certificate`].
#[derive(Clone, Eq, PartialEq)]
pub enum PublicKeyInfo {
@@ -273,7 +278,7 @@ pub(crate) fn write_certificate(
// write compression info and LRC trailer
buf[offset] = TAG_CERT_COMPRESS;
buf[offset + 1] = 0x01;
buf[offset + 2] = if certinfo == YKPIV_CERTINFO_GZIP {
buf[offset + 2] = if certinfo == CERTINFO_GZIP {
0x01
} else {
0x00