diff options
Diffstat (limited to 'g10/packet-functions.h')
-rw-r--r-- | g10/packet-functions.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/g10/packet-functions.h b/g10/packet-functions.h new file mode 100644 index 000000000..0372f4ea6 --- /dev/null +++ b/g10/packet-functions.h @@ -0,0 +1,49 @@ +/* packet-functions.h - Accessor functions for in-core representations. + * Copyright (C) 2017 g10 Code GmbH + * + * This file is part of GnuPG. + * + * GnuPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * GnuPG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <https://www.gnu.org/licenses/>. + */ + +#ifndef G10_PACKET_FUNCTIONS_H +#define G10_PACKET_FUNCTIONS_H + +#include "../common/logging.h" + +static inline u32 +kb_pk_set_expiredate (PKT_public_key *pk, u32 value) +{ + pk->expiredate = value; + pk->flags.valid_expiredate = 1; + return value; +} + +static inline void +kb_pk_invalidate_expiredate (PKT_public_key *pk) +{ + pk->expiredate = 0; + pk->flags.valid_expiredate = 0; +} + +static inline int +kb_pk_valid_expiredate (PKT_public_key *pk) +{ + return pk->flags.valid_expiredate; +} + +#define kb_pk_expiredate(PK) \ + (log_assert ((PK)->flags.valid_expiredate), (PK)->expiredate) + +#endif /*G10_PACKET_FUNCTIONS_H*/ |