aboutsummaryrefslogtreecommitdiff
path: root/src/tpm/tpm.h
blob: 7531ae2889e98fa6db353714de11fe2d33a49978 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2026 Osmium Sorcerer
// SPDX-License-Identifier: MIT

#ifndef SOF_AO2CLIENT_TPM_TPM_H
#define SOF_AO2CLIENT_TPM_TPM_H

#include <stdint.h>
#include <stddef.h>

typedef enum {
    STKB_SUCCESS,
    STKB_ERROR,
    STKB_TPM_UNAVAILABLE,
    STKB_BAD_PIN,
    STKB_AUTH_FAILURE,
    STKB_LOCKOUT,
} stkb_rc;

typedef struct {
    const uint8_t *pin;
    size_t pin_len;
    const wchar_t *key_name;
} stkb_user_input;

stkb_rc tpm2_init(void);

stkb_rc tpm2_keygen(uint8_t *out_pub, uint8_t *out_buffer, size_t buffer_size,
                    size_t *written, stkb_user_input input);

stkb_rc tpm2_compute_ss(uint8_t *ss, const uint8_t *blob, size_t blob_len,
                        const uint8_t *pk, stkb_user_input input);

#endif /* SOF_AO2CLIENT_TPM_TPM_H */