Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\keys\trusted-keys\trusted_tpm1.c Create Date:2022-07-28 18:31:06
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:an have zero or more token= options

Proto:static int getoptions(char *c, struct trusted_key_payload *pay, struct trusted_key_options *opt)

Type:int

Parameter:

TypeParameterName
char *c
struct trusted_key_payload *pay
struct trusted_key_options *opt
735  p = c
740  token_mask = 0
745  tpm2 = tpm_is_tpm2(chip)
746  If tpm2 < 0 Then Return tpm2
749  hash = If tpm2 Then HASH_ALGO_SHA256 Else HASH_ALGO_SHA1
751  When p = strsep - Split a string into tokens*@s: The string to be searched*@ct: The characters to search for* strsep() updates @s to point after the token, ready for the next call.* It returns empty tokens, too, behaving exactly like the libc function cycle
752  If p == '\0' || p == ' ' || p == '\t' Then Continue
754  token = match_token(p, key_tokens, args)
755  If st_and_set_bit - Set a bit and return its old value*@nr: Bit to set*@addr: Address to count from* This is an atomic fully-ordered operation (implied full memory barrier). Then Return -EINVAL
759  Case token == Opt_pcrinfo
761  If pcrinfo_len > MAX_PCRINFO_SIZE Then Return -EINVAL
765  If res < 0 Then Return -EINVAL
767  Break
768  Case token == Opt_keyhandle
770  If res < 0 Then Return -EINVAL
773  keyhandle = handle
774  Break
775  Case token == Opt_keyauth
780  If res < 0 Then Return -EINVAL
782  Break
783  Case token == Opt_blobauth
788  If res < 0 Then Return -EINVAL
790  Break
791  Case token == Opt_migratable
792  If from == '0' Then migratable = 0
794  Else Return -EINVAL
796  Break
797  Case token == Opt_pcrlock
799  If res < 0 Then Return -EINVAL
801  pcrlock = lock
802  Break
803  Case token == Opt_hash
806  When i < HASH_ALGO__LAST cycle
807  If Not strcmp(from, hash_algo_name[i]) Then
808  hash = i
809  Break
812  If i == HASH_ALGO__LAST Then Return -EINVAL
814  If Not tpm2 && i != HASH_ALGO_SHA1 Then
815  pr_info("trusted_key: TPM 1.x only supports SHA-1.\n")
816  Return -EINVAL
818  Break
819  Case token == Opt_policydigest
825  If res < 0 Then Return -EINVAL
828  Break
829  Case token == Opt_policyhandle
830  If Not tpm2 Then Return -EINVAL
833  If res < 0 Then Return -EINVAL
836  Break
837  Default
838  Return -EINVAL
841  Return 0
Caller
NameDescribe
datablob_parsedatablob_parse - parse the keyctl data and fill in the* payload and options structures* On success returns 0, otherwise -EINVAL.