0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef _DIGSIG_H
0012 #define _DIGSIG_H
0013
0014 #include <linux/key.h>
0015
0016 enum pubkey_algo {
0017 PUBKEY_ALGO_RSA,
0018 PUBKEY_ALGO_MAX,
0019 };
0020
0021 enum digest_algo {
0022 DIGEST_ALGO_SHA1,
0023 DIGEST_ALGO_SHA256,
0024 DIGEST_ALGO_MAX
0025 };
0026
0027 struct pubkey_hdr {
0028 uint8_t version;
0029 uint32_t timestamp;
0030 uint8_t algo;
0031 uint8_t nmpi;
0032 char mpi[];
0033 } __packed;
0034
0035 struct signature_hdr {
0036 uint8_t version;
0037 uint32_t timestamp;
0038 uint8_t algo;
0039 uint8_t hash;
0040 uint8_t keyid[8];
0041 uint8_t nmpi;
0042 char mpi[];
0043 } __packed;
0044
0045 #if defined(CONFIG_SIGNATURE) || defined(CONFIG_SIGNATURE_MODULE)
0046
0047 int digsig_verify(struct key *keyring, const char *sig, int siglen,
0048 const char *digest, int digestlen);
0049
0050 #else
0051
0052 static inline int digsig_verify(struct key *keyring, const char *sig,
0053 int siglen, const char *digest, int digestlen)
0054 {
0055 return -EOPNOTSUPP;
0056 }
0057
0058 #endif
0059
0060 #endif