#include <crypto/hash_info.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/parser.h>
#include <linux/string.h>
#include <linux/err.h>
#include <keys/trusted-type.h>
#include <linux/key-type.h>
#include <linux/crypto.h>
#include <crypto/hash.h>
#include <crypto/sha1.h>
#include <linux/tpm.h>
#include <linux/tpm_command.h>
#include <keys/trusted_tpm.h>
static const char hmac_alg[] = …;
static const char hash_alg[] = …;
static struct tpm_chip *chip;
static struct tpm_digest *digests;
struct sdesc { … };
static struct crypto_shash *hashalg;
static struct crypto_shash *hmacalg;
static struct sdesc *init_sdesc(struct crypto_shash *alg)
{ … }
static int TSS_sha1(const unsigned char *data, unsigned int datalen,
unsigned char *digest)
{ … }
static int TSS_rawhmac(unsigned char *digest, const unsigned char *key,
unsigned int keylen, ...)
{ … }
int TSS_authhmac(unsigned char *digest, const unsigned char *key,
unsigned int keylen, unsigned char *h1,
unsigned char *h2, unsigned int h3, ...)
{ … }
EXPORT_SYMBOL_GPL(…);
int TSS_checkhmac1(unsigned char *buffer,
const uint32_t command,
const unsigned char *ononce,
const unsigned char *key,
unsigned int keylen, ...)
{ … }
EXPORT_SYMBOL_GPL(…);
static int TSS_checkhmac2(unsigned char *buffer,
const uint32_t command,
const unsigned char *ononce,
const unsigned char *key1,
unsigned int keylen1,
const unsigned char *key2,
unsigned int keylen2, ...)
{ … }
int trusted_tpm_send(unsigned char *cmd, size_t buflen)
{ … }
EXPORT_SYMBOL_GPL(…);
static int pcrlock(const int pcrnum)
{ … }
static int osap(struct tpm_buf *tb, struct osapsess *s,
const unsigned char *key, uint16_t type, uint32_t handle)
{ … }
int oiap(struct tpm_buf *tb, uint32_t *handle, unsigned char *nonce)
{ … }
EXPORT_SYMBOL_GPL(…);
struct tpm_digests { … };
static int tpm_seal(struct tpm_buf *tb, uint16_t keytype,
uint32_t keyhandle, const unsigned char *keyauth,
const unsigned char *data, uint32_t datalen,
unsigned char *blob, uint32_t *bloblen,
const unsigned char *blobauth,
const unsigned char *pcrinfo, uint32_t pcrinfosize)
{ … }
static int tpm_unseal(struct tpm_buf *tb,
uint32_t keyhandle, const unsigned char *keyauth,
const unsigned char *blob, int bloblen,
const unsigned char *blobauth,
unsigned char *data, unsigned int *datalen)
{ … }
static int key_seal(struct trusted_key_payload *p,
struct trusted_key_options *o)
{ … }
static int key_unseal(struct trusted_key_payload *p,
struct trusted_key_options *o)
{ … }
enum { … };
static const match_table_t key_tokens = …;
static int getoptions(char *c, struct trusted_key_payload *pay,
struct trusted_key_options *opt)
{ … }
static struct trusted_key_options *trusted_options_alloc(void)
{ … }
static int trusted_tpm_seal(struct trusted_key_payload *p, char *datablob)
{ … }
static int trusted_tpm_unseal(struct trusted_key_payload *p, char *datablob)
{ … }
static int trusted_tpm_get_random(unsigned char *key, size_t key_len)
{ … }
static void trusted_shash_release(void)
{ … }
static int __init trusted_shash_alloc(void)
{ … }
static int __init init_digests(void)
{ … }
static int __init trusted_tpm_init(void)
{ … }
static void trusted_tpm_exit(void)
{ … }
struct trusted_key_ops trusted_key_tpm_ops = …;