Sound Open Firmware
Loading...
Searching...
No Matches
auth_api_iface.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 *
3 * Copyright(c) 2022 Intel Corporation. All rights reserved.
4 *
5 * Author: Jaroslaw Stelter <jaroslaw.stelter@intel.com>
6 * Pawel Dobrowolski <pawelx.dobrowolski@intel.com>
7 */
8#ifndef __AUTH_API_IFACE_H__
9#define __AUTH_API_IFACE_H__
10
11#include <auth/intel_status_logger_iface.h>
12#include <stdint.h>
13#include <stddef.h>
14
15#define AUTH_API_VERSION_MAJOR (2)
16#define AUTH_API_VERSION_MINOR (0)
17#define AUTH_API_VERSION_PATCH (0)
18
19#define AUTH_SCRATCH_BUFF_SZ (0xA000) // 40kB
20
21/*
22 * Return codes supported by authentication engine:
23 * ADSP_AUTH_IMAGE_UNTRUSTED = 9040,
24 * ADSP_AUTH_CANNOT_ALLOCATE_SCRATCH_BUFF = 9041,
25 * ADSP_AUTH_INVALID_AUTH_API_CTX_PTR = 9042,
26 * ADSP_AUTH_SVN_VERIFICATION_FAIL = 9043,
27 * ADSP_AUTH_IFWI_PARTITION_FAIL = 9044,
28 * ADSP_AUTH_VERIFY_IMAGE_TYPE_FAIL = 9045,
29 * ADSP_AUTH_UNSUPPORTED_VERSION = 9046,
30 * ADSP_AUTH_INCOMPATIBLE_MANIFEST_VERSION = 9047,
31 */
32
34 uint8_t patch;
35 uint8_t minor;
36 uint8_t major;
37 uint8_t rsvd;
39
45
51
57
58struct auth_api_ctx;
59
61 /* Interface to return authentication API version.
62 * Return value: version number represented by auth_api_version_num structure.
63 */
64 struct auth_api_version_num (*version)();
65};
66
67struct auth_api {
68 /* Interface to initialize authentication API and context.
69 * Parameters:
70 * ctx - pointer to the context instance of type auth_api_ctx.
71 * scratch_buff - pointer to scratch buffer.
72 * Scratch buffer must be located in L2 Local Memory (SHA Engine limitation).
73 * Caller is responsible to power up necessary L2 Local Memory banks.
74 * Address alignment must correspond to SHA384_IO_BUF_ALIGNMENT.
75 * scratch_buff_size – size must be the same as AUTH_SCRATCH_BUFF_SZ.
76 * Return value:
77 * ADSP_SUCCESS - successful initialization.
78 */
79 int (*init)(struct auth_api_ctx *ctx, void *scratch_buff, size_t scratch_buff_size,
80 enum auth_image_type image_type);
81
82 /* Interface to cleanup authentication API.
83 * Parameters:
84 * ctx - pointer to the context instance of type AuthApiCtx.
85 */
86 void (*cleanup)(struct auth_api_ctx *ctx);
87
88 /* Interface for initiating signed FW image (async) authentication process.
89 * Parameters:
90 * ctx - pointer to the context instance of type AuthApiCtx.
91 * chunk - pointer to the chunk of signed FW image.
92 * chunk_size - chunk size in bytes.
93 * phase - authentication phase.
94 * Must corresponds to one of the AuthPhase values.
95 * In case of one time FW authentication, where signed FW image size must be
96 * less or equal to scratch_buff_size, the caller must pass AUTH_PHASE_LAST.
97 * Return value: ADSP_SUCCESS when authentication process has been initiated
98 * successfully, or one of ADSP_FLV_* error codes in case of failure.
99 */
100 int (*init_auth_proc)(struct auth_api_ctx *ctx, const void *chunk, size_t chunk_size,
101 enum auth_phase phase);
102
103 /* Interface to return if authentication process is busy.
104 * Parameters:
105 * ctx - pointer to the context instance of type AuthApiCtx.
106 * This function can be used for authentication process synchronization.
107 * Return value: true if authentication process is busy.
108 */
109 bool (*busy)(struct auth_api_ctx *ctx);
110
111 /* Interface to return authentication result
112 * Parameters:
113 * ctx - pointer to the context instance of type AuthApiCtx.
114 * Return value:
115 * AUTH_NOT_COMPLETED - authentication is not completed,
116 * AUTH_IMAGE_TRUSTED - authentication completed and signed FW image is
117 * trusted,
118 * AUTH_IMAGE_UNTRUSTED - authentication completed, but signed FW image is
119 * untrusted.
120 */
121 enum auth_result (*result)(struct auth_api_ctx *ctx);
122
123 /* Interface to register status/error code logger.
124 * Parameters:
125 * ctx - pointer to the context instance of type AuthApiCtx.
126 * sts_logger - pointer to status logger.
127 * Return value: ADSP_SUCCESS when logger has been registered successfully.
128 */
130 struct status_logger_ctx *status_logger);
131
132 /* Interface to unregister status/error code logger.
133 * Parameters:
134 * ctx - pointer to the context instance of type AuthApiCtx.
135 */
137};
138
148
149#endif /* __SOF_LIB_MANAGER_H__ */
auth_phase
Definition auth_api_iface.h:40
@ AUTH_PHASE_MID
Definition auth_api_iface.h:42
@ AUTH_PHASE_FIRST
Definition auth_api_iface.h:41
@ AUTH_PHASE_LAST
Definition auth_api_iface.h:43
enum auth_phase __aligned
auth_result
Definition auth_api_iface.h:46
@ AUTH_IMAGE_UNTRUSTED
Definition auth_api_iface.h:49
@ AUTH_NOT_COMPLETED
Definition auth_api_iface.h:47
@ AUTH_IMAGE_TRUSTED
Definition auth_api_iface.h:48
auth_image_type
Definition auth_api_iface.h:52
@ IMG_TYPE_ROM_EXT
Definition auth_api_iface.h:53
@ IMG_TYPE_MAIN_FW
Definition auth_api_iface.h:54
@ IMG_TYPE_LIB
Definition auth_api_iface.h:55
#define __packed
Definition ext_manifest.h:43
Definition auth_api_iface.h:139
enum auth_image_type image_type
Definition auth_api_iface.h:145
enum auth_result result
Definition auth_api_iface.h:143
void * scratch_buff
Definition auth_api_iface.h:141
struct auth_api_version * version_api
Definition auth_api_iface.h:140
struct auth_api * auth_api
Definition auth_api_iface.h:144
size_t scratch_buff_size
Definition auth_api_iface.h:142
struct status_logger_ctx * status_logger
Definition auth_api_iface.h:146
Definition auth_api_iface.h:33
uint8_t minor
Definition auth_api_iface.h:35
uint8_t rsvd
Definition auth_api_iface.h:37
uint8_t patch
Definition auth_api_iface.h:34
uint8_t major
Definition auth_api_iface.h:36
Definition auth_api_iface.h:60
struct auth_api_version_num(* version)()
Definition auth_api_iface.h:64
Definition auth_api_iface.h:67
enum auth_result(* result)(struct auth_api_ctx *ctx)
Definition auth_api_iface.h:121
int(* init)(struct auth_api_ctx *ctx, void *scratch_buff, size_t scratch_buff_size, enum auth_image_type image_type)
Definition auth_api_iface.h:79
void(* unregister_status_logger)(struct auth_api_ctx *ctx)
Definition auth_api_iface.h:136
int(* register_status_logger)(struct auth_api_ctx *ctx, struct status_logger_ctx *status_logger)
Definition auth_api_iface.h:129
void(* cleanup)(struct auth_api_ctx *ctx)
Definition auth_api_iface.h:86
bool(* busy)(struct auth_api_ctx *ctx)
Definition auth_api_iface.h:109
int(* init_auth_proc)(struct auth_api_ctx *ctx, const void *chunk, size_t chunk_size, enum auth_phase phase)
Definition auth_api_iface.h:100