Lines Matching refs:ret
55 int ret;
63 ret = crypto_shash_digest(&sdesc->shash, data, datalen, digest);
65 return ret;
75 int ret;
83 ret = crypto_shash_setkey(hmacalg, key, keylen);
84 if (ret < 0)
86 ret = crypto_shash_init(&sdesc->shash);
87 if (ret < 0)
97 ret = -EINVAL;
100 ret = crypto_shash_update(&sdesc->shash, data, dlen);
101 if (ret < 0)
105 if (!ret)
106 ret = crypto_shash_final(&sdesc->shash, digest);
109 return ret;
124 int ret;
137 ret = crypto_shash_init(&sdesc->shash);
138 if (ret < 0)
147 ret = -EINVAL;
150 ret = crypto_shash_update(&sdesc->shash, data, dlen);
151 if (ret < 0)
155 if (!ret)
156 ret = crypto_shash_final(&sdesc->shash, paramdigest);
157 if (!ret)
158 ret = TSS_rawhmac(digest, key, keylen, SHA1_DIGEST_SIZE,
163 return ret;
189 int ret;
211 ret = crypto_shash_init(&sdesc->shash);
212 if (ret < 0)
214 ret = crypto_shash_update(&sdesc->shash, (const u8 *)&result,
216 if (ret < 0)
218 ret = crypto_shash_update(&sdesc->shash, (const u8 *)&ordinal,
220 if (ret < 0)
228 ret = crypto_shash_update(&sdesc->shash, buffer + dpos, dlen);
229 if (ret < 0)
233 if (!ret)
234 ret = crypto_shash_final(&sdesc->shash, paramdigest);
235 if (ret < 0)
238 ret = TSS_rawhmac(testhmac, key, keylen, SHA1_DIGEST_SIZE, paramdigest,
241 if (ret < 0)
245 ret = -EINVAL;
248 return ret;
280 int ret;
304 ret = crypto_shash_init(&sdesc->shash);
305 if (ret < 0)
307 ret = crypto_shash_update(&sdesc->shash, (const u8 *)&result,
309 if (ret < 0)
311 ret = crypto_shash_update(&sdesc->shash, (const u8 *)&ordinal,
313 if (ret < 0)
322 ret = crypto_shash_update(&sdesc->shash, buffer + dpos, dlen);
323 if (ret < 0)
327 if (!ret)
328 ret = crypto_shash_final(&sdesc->shash, paramdigest);
329 if (ret < 0)
332 ret = TSS_rawhmac(testhmac1, key1, keylen1, SHA1_DIGEST_SIZE,
335 if (ret < 0)
338 ret = -EINVAL;
341 ret = TSS_rawhmac(testhmac2, key2, keylen2, SHA1_DIGEST_SIZE,
344 if (ret < 0)
347 ret = -EINVAL;
350 return ret;
396 int ret;
398 ret = tpm_get_random(chip, ononce, TPM_NONCE_SIZE);
399 if (ret < 0)
400 return ret;
402 if (ret != TPM_NONCE_SIZE)
410 ret = trusted_tpm_send(tb->data, MAX_BUF_SIZE);
411 if (ret < 0)
412 return ret;
428 int ret;
434 ret = trusted_tpm_send(tb->data, MAX_BUF_SIZE);
435 if (ret < 0)
436 return ret;
473 int ret;
482 ret = osap(tb, &sess, keyauth, keytype, keyhandle);
483 if (ret < 0)
490 ret = TSS_sha1(td->xorwork, SHA1_DIGEST_SIZE * 2, td->xorhash);
491 if (ret < 0)
494 ret = tpm_get_random(chip, td->nonceodd, TPM_NONCE_SIZE);
495 if (ret < 0)
498 if (ret != TPM_NONCE_SIZE) {
499 ret = -EIO;
515 ret = TSS_authhmac(td->pubauth, sess.secret, SHA1_DIGEST_SIZE,
523 ret = TSS_authhmac(td->pubauth, sess.secret, SHA1_DIGEST_SIZE,
530 if (ret < 0)
546 ret = trusted_tpm_send(tb->data, MAX_BUF_SIZE);
547 if (ret < 0)
558 ret = TSS_checkhmac1(tb->data, ordinal, td->nonceodd, sess.secret,
563 if (!ret) {
569 return ret;
590 int ret;
593 ret = oiap(tb, &authhandle1, enonce1);
594 if (ret < 0) {
595 pr_info("oiap failed (%d)\n", ret);
596 return ret;
598 ret = oiap(tb, &authhandle2, enonce2);
599 if (ret < 0) {
600 pr_info("oiap failed (%d)\n", ret);
601 return ret;
605 ret = tpm_get_random(chip, nonceodd, TPM_NONCE_SIZE);
606 if (ret < 0)
607 return ret;
609 if (ret != TPM_NONCE_SIZE) {
610 pr_info("tpm_get_random failed (%d)\n", ret);
613 ret = TSS_authhmac(authdata1, keyauth, TPM_NONCE_SIZE,
616 if (ret < 0)
617 return ret;
618 ret = TSS_authhmac(authdata2, blobauth, TPM_NONCE_SIZE,
621 if (ret < 0)
622 return ret;
637 ret = trusted_tpm_send(tb->data, MAX_BUF_SIZE);
638 if (ret < 0) {
639 pr_info("authhmac failed (%d)\n", ret);
640 return ret;
644 ret = TSS_checkhmac2(tb->data, ordinal, nonceodd,
650 if (ret < 0) {
651 pr_info("TSS_checkhmac2 failed (%d)\n", ret);
652 return ret;
665 int ret;
667 ret = tpm_buf_init(&tb, 0, 0);
668 if (ret)
669 return ret;
674 ret = tpm_seal(&tb, o->keytype, o->keyhandle, o->keyauth,
677 if (ret < 0)
678 pr_info("srkseal failed (%d)\n", ret);
681 return ret;
691 int ret;
693 ret = tpm_buf_init(&tb, 0, 0);
694 if (ret)
695 return ret;
697 ret = tpm_unseal(&tb, o->keyhandle, o->keyauth, p->blob, p->blob_len,
699 if (ret < 0)
700 pr_info("srkunseal failed (%d)\n", ret);
706 return ret;
891 int ret = 0;
902 ret = getoptions(datablob, p, options);
903 if (ret < 0)
908 ret = -EINVAL;
913 ret = tpm2_seal_trusted(chip, p, options);
915 ret = key_seal(p, options);
916 if (ret < 0) {
917 pr_info("key_seal failed (%d)\n", ret);
922 ret = pcrlock(options->pcrlock);
923 if (ret < 0) {
924 pr_info("pcrlock failed (%d)\n", ret);
930 return ret;
936 int ret = 0;
947 ret = getoptions(datablob, p, options);
948 if (ret < 0)
953 ret = -EINVAL;
958 ret = tpm2_unseal_trusted(chip, p, options);
960 ret = key_unseal(p, options);
961 if (ret < 0)
962 pr_info("key_unseal failed (%d)\n", ret);
965 ret = pcrlock(options->pcrlock);
966 if (ret < 0) {
967 pr_info("pcrlock failed (%d)\n", ret);
973 return ret;
991 int ret;
1004 ret = PTR_ERR(hashalg);
1012 return ret;
1032 int ret;
1038 ret = init_digests();
1039 if (ret < 0)
1041 ret = trusted_shash_alloc();
1042 if (ret < 0)
1044 ret = register_key_type(&key_type_trusted);
1045 if (ret < 0)
1054 return ret;