• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Microsoft Reference Implementation for TPM 2.0
2  *
3  *  The copyright in this software is being made available under the BSD License,
4  *  included below. This software may be subject to other third party and
5  *  contributor rights, including patent rights, and no such rights are granted
6  *  under this license.
7  *
8  *  Copyright (c) Microsoft Corporation
9  *
10  *  All rights reserved.
11  *
12  *  BSD License
13  *
14  *  Redistribution and use in source and binary forms, with or without modification,
15  *  are permitted provided that the following conditions are met:
16  *
17  *  Redistributions of source code must retain the above copyright notice, this list
18  *  of conditions and the following disclaimer.
19  *
20  *  Redistributions in binary form must reproduce the above copyright notice, this
21  *  list of conditions and the following disclaimer in the documentation and/or
22  *  other materials provided with the distribution.
23  *
24  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS""
25  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27  *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
28  *  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29  *  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
31  *  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 /*(Auto-generated)
36  *  Created by TpmPrototypes; Version 3.0 July 18, 2017
37  *  Date: Nov 14, 2019  Time: 05:57:02PM
38  */
39 
40 #ifndef    _X509_SPT_FP_H_
41 #define    _X509_SPT_FP_H_
42 
43 //*** X509FindExtensionByOID()
44 // This will search a list of X509 extensions to find an extension with the
45 // requested OID. If the extension is found, the output context ('ctx') is set up
46 // to point to the OID in the extension.
47 //  Return Type: BOOL
48 //      TRUE(1)         success
49 //      FALSE(0)        failure (could be catastrophic)
50 BOOL
51 X509FindExtensionByOID(
52     ASN1UnmarshalContext    *ctxIn,         // IN: the context to search
53     ASN1UnmarshalContext    *ctx,           // OUT: the extension context
54     const BYTE              *OID            // IN: oid to search for
55 );
56 
57 //*** X509GetExtensionBits()
58 // This function will extract a bit field from an extension. If the extension doesn't
59 // contain a bit string, it will fail.
60 // Return Type: BOOL
61 //  TRUE(1)         success
62 //  FALSE(0)        failure
63 UINT32
64 X509GetExtensionBits(
65     ASN1UnmarshalContext            *ctx,
66     UINT32                          *value
67 );
68 
69 //***X509ProcessExtensions()
70 // This function is used to process the TPMA_OBJECT and KeyUsage extensions. It is not
71 // in the CertifyX509.c code because it makes the code harder to follow.
72 // Return Type: TPM_RC
73 //      TPM_RCS_ATTRIBUTES      the attributes of object are not consistent with
74 //                              the extension setting
75 //      TPM_RC_VALUE            problem parsing the extensions
76 TPM_RC
77 X509ProcessExtensions(
78     OBJECT              *object,        // IN: The object with the attributes to
79                                         //      check
80     stringRef           *extension      // IN: The start and length of the extensions
81 );
82 
83 //*** X509AddSigningAlgorithm()
84 // This creates the singing algorithm data.
85 // Return Type: INT16
86 //  > 0                 number of octets added
87 // <= 0                 failure
88 INT16
89 X509AddSigningAlgorithm(
90     ASN1MarshalContext  *ctx,
91     OBJECT              *signKey,
92     TPMT_SIG_SCHEME     *scheme
93 );
94 
95 //*** X509AddPublicKey()
96 // This function will add the publicKey description to the DER data. If fillPtr is
97 // NULL, then no data is transferred and this function will indicate if the TPM
98 // has the values for DER-encoding of the public key.
99 //  Return Type: INT16
100 //      > 0         number of octets added
101 //      == 0        failure
102 INT16
103 X509AddPublicKey(
104     ASN1MarshalContext  *ctx,
105     OBJECT              *object
106 );
107 
108 //*** X509PushAlgorithmIdentifierSequence()
109 // The function adds the algorithm identifier sequence.
110 //  Return Type: INT16
111 //      > 0         number of bytes added
112 //     == 0         failure
113 INT16
114 X509PushAlgorithmIdentifierSequence(
115     ASN1MarshalContext          *ctx,
116     const BYTE                  *OID
117 );
118 
119 #endif  // _X509_SPT_FP_H_
120