Home | History | Annotate | Download | only in tpm2
      1 /*############################################################################
      2 # Copyright 2017 Intel Corporation
      3 #
      4 # Licensed under the Apache License, Version 2.0 (the "License");
      5 # you may not use this file except in compliance with the License.
      6 # You may obtain a copy of the License at
      7 #
      8 #     http://www.apache.org/licenses/LICENSE-2.0
      9 #
     10 # Unless required by applicable law or agreed to in writing, software
     11 # distributed under the License is distributed on an "AS IS" BASIS,
     12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 # See the License for the specific language governing permissions and
     14 # limitations under the License.
     15 ############################################################################*/
     16 /// SDK TPM Commit API.
     17 /*! \file */
     18 
     19 #ifndef EPID_MEMBER_TPM2_COMMIT_H_
     20 #define EPID_MEMBER_TPM2_COMMIT_H_
     21 
     22 #include <stddef.h>
     23 
     24 #include "epid/common/errors.h"
     25 #include "epid/common/stdtypes.h"
     26 
     27 /// \cond
     28 typedef struct Tpm2Ctx Tpm2Ctx;
     29 typedef struct FfElement FfElement;
     30 typedef struct EcPoint EcPoint;
     31 /// \endcond
     32 
     33 /*!
     34 \addtogroup Tpm2Module tpm2
     35 \ingroup EpidMemberModule
     36 @{
     37 */
     38 
     39 /// Performs TPM2_Commit TPM operation.
     40 /*!
     41 Generates random r and compute K, L and E points.
     42 
     43 \param[in] ctx
     44 The TPM context.
     45 \param[in] p1
     46 A point P1 on G1 curve.
     47 \param[in] s2
     48 Octet array used to derive x-coordinate of a point P2.
     49 \param[in] s2_len
     50 Length of s2 buffer.
     51 \param[in] y2
     52 y coordinate of the point associated with s2.
     53 \param[out] k
     54 Result of G1.exp(P2, private key f).
     55 \param[out] l
     56 Result of G1.exp(P2, random r).
     57 \param[out] e
     58 Result of G1.exp(P1, random r).
     59 \param[out] counter
     60 A value associated with the random r. Should be initialized with zero.
     61 
     62 \returns ::EpidStatus
     63 
     64 \see Tpm2CreateContext
     65 */
     66 EpidStatus Tpm2Commit(Tpm2Ctx* ctx, EcPoint const* p1, void const* s2,
     67                       size_t s2_len, FfElement const* y2, EcPoint* k,
     68                       EcPoint* l, EcPoint* e, uint16_t* counter);
     69 
     70 /*! @} */
     71 
     72 #endif  // EPID_MEMBER_TPM2_COMMIT_H_
     73