aboutsummaryrefslogtreecommitdiffstats
path: root/g10/packet-functions.h
blob: 0372f4ea6f28468fe5ad407e56a30360000d4a29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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*/