函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:security\keys\trusted-keys\trusted_tpm1.c Create Date:2022-07-27 20:05:00
首页 Copyright©Brick

678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
/*
 * Have the TPM unseal(decrypt) the symmetric key
 */
static int key_unseal(struct trusted_key_payload *p,
              struct trusted_key_options *o)
{
    struct tpm_buf tb;
    int ret;
 
    ret = tpm_buf_init(&tb, 0, 0);
    if (ret)
        return ret;
 
    ret = tpm_unseal(&tb, o->keyhandle, o->keyauth, p->blob, p->blob_len,
             o->blobauth, p->key, &p->key_len);
    if (ret < 0)
        pr_info("trusted_key: srkunseal failed (%d)\n", ret);
    else
        /* pull migratable flag out of sealed key */
        p->migratable = p->key[--p->key_len];
 
    tpm_buf_destroy(&tb);
    return ret;
}