Skip to content

Commit

Permalink
corrected code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
falko-strenzke committed Jun 14, 2023
1 parent 30b4688 commit 8342963
Show file tree
Hide file tree
Showing 167 changed files with 3,648 additions and 3,045 deletions.
18 changes: 9 additions & 9 deletions include/rekey/rnp_key_store.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ typedef std::unordered_map<pgp_fingerprint_t, std::list<pgp_key_t>::iterator> pg
typedef struct rnp_key_store_t {
std::string path;
pgp_key_store_format_t format;
rnp::SecurityContext & secctx;
rnp::SecurityContext &secctx;
bool disable_validation =
false; /* do not automatically validate keys, added to this key store */

Expand All @@ -76,8 +76,8 @@ typedef struct rnp_key_store_t {
rnp_key_store_t(rnp::SecurityContext &ctx)
: path(""), format(PGP_KEY_STORE_UNKNOWN), secctx(ctx){};
rnp_key_store_t(pgp_key_store_format_t format,
const std::string & path,
rnp::SecurityContext & ctx);
const std::string &path,
rnp::SecurityContext &ctx);
/* make sure we use only empty constructor */
rnp_key_store_t(rnp_key_store_t &&src) = delete;
rnp_key_store_t &operator=(rnp_key_store_t &&) = delete;
Expand Down Expand Up @@ -120,8 +120,8 @@ pgp_key_t *rnp_key_store_import_key(rnp_key_store_t *,
*/
pgp_key_t *rnp_key_store_get_signer_key(rnp_key_store_t *store, const pgp_signature_t *sig);

pgp_sig_import_status_t rnp_key_store_import_key_signature(rnp_key_store_t * keyring,
pgp_key_t * key,
pgp_sig_import_status_t rnp_key_store_import_key_signature(rnp_key_store_t *keyring,
pgp_key_t *key,
const pgp_signature_t *sig);

/**
Expand All @@ -132,8 +132,8 @@ pgp_sig_import_status_t rnp_key_store_import_key_signature(rnp_key_store_t *
* @param status signature import status will be put here, if not NULL.
* @return pointer to the key to which this signature belongs (or NULL if key was not found)
*/
pgp_key_t *rnp_key_store_import_signature(rnp_key_store_t * keyring,
const pgp_signature_t * sig,
pgp_key_t *rnp_key_store_import_signature(rnp_key_store_t *keyring,
const pgp_signature_t *sig,
pgp_sig_import_status_t *status);

bool rnp_key_store_remove_key(rnp_key_store_t *, const pgp_key_t *, bool);
Expand All @@ -142,8 +142,8 @@ bool rnp_key_store_get_key_grip(const pgp_key_material_t *, pgp_key_grip_t &grip

const pgp_key_t *rnp_key_store_get_key_by_fpr(const rnp_key_store_t *,
const pgp_fingerprint_t &fpr);
pgp_key_t * rnp_key_store_get_key_by_fpr(rnp_key_store_t *, const pgp_fingerprint_t &fpr);
pgp_key_t * rnp_key_store_get_primary_key(rnp_key_store_t *, const pgp_key_t *);
pgp_key_t *rnp_key_store_get_key_by_fpr(rnp_key_store_t *, const pgp_fingerprint_t &fpr);
pgp_key_t *rnp_key_store_get_primary_key(rnp_key_store_t *, const pgp_key_t *);
pgp_key_t *rnp_key_store_search(rnp_key_store_t *, const pgp_key_search_t *, pgp_key_t *);

#endif /* KEY_STORE_H_ */
87 changes: 46 additions & 41 deletions include/repgp/repgp_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@
/* Size of the fingerprint */
#define PGP_FINGERPRINT_V4_SIZE 20
#if defined(ENABLE_CRYPTO_REFRESH)
#define PGP_FINGERPRINT_V6_SIZE 32
#define PGP_MAX_FINGERPRINT_SIZE PGP_FINGERPRINT_V6_SIZE
#define PGP_FINGERPRINT_V6_SIZE 32
#define PGP_MAX_FINGERPRINT_SIZE PGP_FINGERPRINT_V6_SIZE
#else
#define PGP_MAX_FINGERPRINT_SIZE PGP_FINGERPRINT_V4_SIZE
#define PGP_MAX_FINGERPRINT_SIZE PGP_FINGERPRINT_V4_SIZE
#endif
#define PGP_MAX_FINGERPRINT_HEX_SIZE (PGP_MAX_FINGERPRINT_SIZE * 2) + 1

Expand All @@ -116,20 +116,19 @@

/* V6 Signature Salt */
#if defined(ENABLE_CRYPTO_REFRESH)
#define PGP_MAX_SALT_SIZE_V6_SIG 32
#define PGP_MAX_SALT_SIZE_V6_SIG 32
#endif

/* size of length for hashed/unhashed subpacket data*/
#define PGP_SIG_HASHED_AREA_SIZE_OCTETS_V4 2

#if defined(ENABLE_CRYPTO_REFRESH)
#define PGP_SIG_HASHED_AREA_SIZE_OCTETS_V6 4
#define PGP_MAX_SIG_HASHED_AREA_SIZE_OCTETS PGP_SIG_HASHED_AREA_SIZE_OCTETS_V6
#define PGP_SIG_HASHED_AREA_SIZE_OCTETS_V6 4
#define PGP_MAX_SIG_HASHED_AREA_SIZE_OCTETS PGP_SIG_HASHED_AREA_SIZE_OCTETS_V6
#else
#define PGP_MAX_SIG_HASHED_AREA_SIZE_OCTETS PGP_SIG_HASHED_AREA_SIZE_OCTETS_V4
#define PGP_MAX_SIG_HASHED_AREA_SIZE_OCTETS PGP_SIG_HASHED_AREA_SIZE_OCTETS_V4
#endif


/** Old Packet Format Lengths.
* Defines the meanings of the 2 bits for length type in the
* old packet format.
Expand Down Expand Up @@ -237,22 +236,31 @@ typedef enum : uint8_t {

#if defined(ENABLE_PQC)
/* PQC-ECC composite */
PGP_PKA_KYBER768_X25519 = 29, /* Kyber768 + X25519 from draft-wussler-openpgp-pqc-01 */
//PGP_PKA_KYBER1024_X448 = 30, /* Kyer1024 + X448 from draft-wussler-openpgp-pqc-01 */
PGP_PKA_KYBER768_P256 = 31, /* Kyber768 + NIST P-256 from draft-wussler-openpgp-pqc-01 */
PGP_PKA_KYBER1024_P384 = 32, /* Kyber1024 + NIST P-384 from draft-wussler-openpgp-pqc-01 */
PGP_PKA_KYBER768_BP256 = 33, /* Kyber768 + Brainpool P256r1 from draft-wussler-openpgp-pqc-01 */
PGP_PKA_KYBER1024_BP384 = 34, /* Kyber1024 + Brainpool P384r1 from draft-wussler-openpgp-pqc-01 */

PGP_PKA_DILITHIUM3_ED25519 = 35, /* Dilithium 3 + Ed25519 from draft-wussler-openpgp-pqc-01 */
//PGP_PKA_DILITHIUM5_ED448 = 36, /* Dilithium 5 + Ed448 from draft-wussler-openpgp-pqc-01 */
PGP_PKA_DILITHIUM3_P256 = 37, /* Dilithium 3 + ECDSA-NIST-P-256 from draft-wussler-openpgp-pqc-01 */
PGP_PKA_DILITHIUM5_P384 = 38, /* Dilithium 5 + ECDSA-NIST-P-384 from draft-wussler-openpgp-pqc-00*/
PGP_PKA_DILITHIUM3_BP256 = 39, /* Dilithium 3 + ECDSA-brainpoolP256r1 from draft-wussler-openpgp-pqc-01 */
PGP_PKA_DILITHIUM5_BP384 = 40, /* Dilithium 5 + ECDSA-brainpoolP384r1 from draft-wussler-openpgp-pqc-01 */
PGP_PKA_KYBER768_X25519 = 29, /* Kyber768 + X25519 from draft-wussler-openpgp-pqc-01 */
// PGP_PKA_KYBER1024_X448 = 30, /* Kyer1024 + X448 from
// draft-wussler-openpgp-pqc-01 */
PGP_PKA_KYBER768_P256 = 31, /* Kyber768 + NIST P-256 from draft-wussler-openpgp-pqc-01 */
PGP_PKA_KYBER1024_P384 = 32, /* Kyber1024 + NIST P-384 from draft-wussler-openpgp-pqc-01 */
PGP_PKA_KYBER768_BP256 =
33, /* Kyber768 + Brainpool P256r1 from draft-wussler-openpgp-pqc-01 */
PGP_PKA_KYBER1024_BP384 =
34, /* Kyber1024 + Brainpool P384r1 from draft-wussler-openpgp-pqc-01 */

PGP_PKA_DILITHIUM3_ED25519 =
35, /* Dilithium 3 + Ed25519 from draft-wussler-openpgp-pqc-01 */
// PGP_PKA_DILITHIUM5_ED448 = 36, /* Dilithium 5 + Ed448 from
// draft-wussler-openpgp-pqc-01 */
PGP_PKA_DILITHIUM3_P256 =
37, /* Dilithium 3 + ECDSA-NIST-P-256 from draft-wussler-openpgp-pqc-01 */
PGP_PKA_DILITHIUM5_P384 =
38, /* Dilithium 5 + ECDSA-NIST-P-384 from draft-wussler-openpgp-pqc-00*/
PGP_PKA_DILITHIUM3_BP256 =
39, /* Dilithium 3 + ECDSA-brainpoolP256r1 from draft-wussler-openpgp-pqc-01 */
PGP_PKA_DILITHIUM5_BP384 =
40, /* Dilithium 5 + ECDSA-brainpoolP384r1 from draft-wussler-openpgp-pqc-01 */
#endif

PGP_PKA_SM2 = 99, /* SM2 encryption/signature schemes */
PGP_PKA_SM2 = 99, /* SM2 encryption/signature schemes */
PGP_PKA_PRIVATE00 = 100, /* Private/Experimental Algorithm */
PGP_PKA_PRIVATE01 = 101, /* Private/Experimental Algorithm */
PGP_PKA_PRIVATE02 = 102, /* Private/Experimental Algorithm */
Expand Down Expand Up @@ -313,7 +321,7 @@ typedef enum {
PGP_SA_CAMELLIA_192 = 12, /* Camellia with 192-bit key */
PGP_SA_CAMELLIA_256 = 13, /* Camellia with 256-bit key */

PGP_SA_SM4 = 105, /* RNP extension - SM4 */
PGP_SA_SM4 = 105, /* RNP extension - SM4 */
PGP_SA_UNKNOWN = 255
} pgp_symm_alg_t;

Expand Down Expand Up @@ -372,26 +380,26 @@ typedef enum : uint8_t {
PGP_SIG_TEXT = 0x01, /* Signature of a canonical text document */
PGP_SIG_STANDALONE = 0x02, /* Standalone signature */

PGP_CERT_GENERIC = 0x10, /* Generic certification of a User ID and
* Public Key packet */
PGP_CERT_PERSONA = 0x11, /* Persona certification of a User ID and
* Public Key packet */
PGP_CERT_CASUAL = 0x12, /* Casual certification of a User ID and
* Public Key packet */
PGP_CERT_POSITIVE = 0x13, /* Positive certification of a
* User ID and Public Key packet */
PGP_CERT_GENERIC = 0x10, /* Generic certification of a User ID and
* Public Key packet */
PGP_CERT_PERSONA = 0x11, /* Persona certification of a User ID and
* Public Key packet */
PGP_CERT_CASUAL = 0x12, /* Casual certification of a User ID and
* Public Key packet */
PGP_CERT_POSITIVE = 0x13, /* Positive certification of a
* User ID and Public Key packet */

PGP_SIG_SUBKEY = 0x18, /* Subkey Binding Signature */
PGP_SIG_PRIMARY = 0x19, /* Primary Key Binding Signature */
PGP_SIG_DIRECT = 0x1f, /* Signature directly on a key */
PGP_SIG_SUBKEY = 0x18, /* Subkey Binding Signature */
PGP_SIG_PRIMARY = 0x19, /* Primary Key Binding Signature */
PGP_SIG_DIRECT = 0x1f, /* Signature directly on a key */

PGP_SIG_REV_KEY = 0x20, /* Key revocation signature */
PGP_SIG_REV_SUBKEY = 0x28, /* Subkey revocation signature */
PGP_SIG_REV_CERT = 0x30, /* Certification revocation signature */

PGP_SIG_TIMESTAMP = 0x40, /* Timestamp signature */
PGP_SIG_TIMESTAMP = 0x40, /* Timestamp signature */

PGP_SIG_3RD_PARTY = 0x50 /* Third-Party Confirmation signature */
PGP_SIG_3RD_PARTY = 0x50 /* Third-Party Confirmation signature */
} pgp_sig_type_t;

/** Signature Subpacket Type
Expand Down Expand Up @@ -440,7 +448,7 @@ typedef enum {
/* PGP_SIG_SUBPKT_INTENDED_RECIPIENT_FINGERPRINT = 35, */
PGP_SIG_SUBPKT_PREFERRED_AEAD_CIPHERSUITES = 39,
#endif
PGP_SIG_SUBPKT_PRIVATE_100 = 100, /* private/experimental subpackets */
PGP_SIG_SUBPKT_PRIVATE_100 = 100, /* private/experimental subpackets */
PGP_SIG_SUBPKT_PRIVATE_101 = 101,
PGP_SIG_SUBPKT_PRIVATE_102 = 102,
PGP_SIG_SUBPKT_PRIVATE_103 = 103,
Expand Down Expand Up @@ -495,10 +503,7 @@ typedef enum {
PGP_PKSK_V6 = 6
#endif
} pgp_pkesk_version_t;
typedef enum {
PGP_SE_IP_DATA_V1 = 1,
PGP_SE_IP_DATA_V2 = 2
} pgp_seipd_version_t;
typedef enum { PGP_SE_IP_DATA_V1 = 1, PGP_SE_IP_DATA_V2 = 2 } pgp_seipd_version_t;

/** Version.
* OpenPGP has two different protocol versions: version 3 and version 4.
Expand Down
Loading

0 comments on commit 8342963

Please sign in to comment.