aboutsummaryrefslogtreecommitdiff
path: root/components/service/secure_storage/backend/null_store/null_store.c
blob: 479c58a5254afcf070cef15dd7df06a0437305e8 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
 * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include "null_store.h"
#include <protocols/service/psa/packed-c/status.h>
#include <stddef.h>

static psa_status_t null_store_set(void *context,
                            uint32_t client_id,
                            uint64_t uid,
                            size_t data_length,
                            const void *p_data,
                            uint32_t create_flags)
{
    (void)context;
    (void)client_id;
    (void)uid;
    (void)data_length;
    (void)p_data;
    (void)create_flags;

    return PSA_ERROR_STORAGE_FAILURE;
}

static psa_status_t null_store_get(void *context,
                            uint32_t client_id,
                            uint64_t uid,
                            size_t data_offset,
                            size_t data_size,
                            void *p_data,
                            size_t *p_data_length)
{
    (void)context;
    (void)client_id;
    (void)uid;
    (void)data_offset;
    (void)data_size;
    (void)p_data;
    (void)p_data_length;

    return PSA_ERROR_STORAGE_FAILURE;
}

static psa_status_t null_store_get_info(void *context,
                            uint32_t client_id,
                            uint64_t uid,
                            struct psa_storage_info_t *p_info)
{
    (void)context;
    (void)client_id;
    (void)uid;
    (void)p_info;

    return PSA_ERROR_STORAGE_FAILURE;
}

static psa_status_t null_store_remove(void *context,
                                uint32_t client_id,
                                uint64_t uid)
{
    (void)context;
    (void)client_id;
    (void)uid;

    return PSA_ERROR_STORAGE_FAILURE;
}

static psa_status_t null_store_create(void *context,
                            uint32_t client_id,
                            uint64_t uid,
                            size_t capacity,
                            uint32_t create_flags)
{
    (void)context;
    (void)client_id;
    (void)uid;
    (void)capacity;
    (void)create_flags;

    return PSA_ERROR_STORAGE_FAILURE;
}

static psa_status_t null_store_set_extended(void *context,
                            uint32_t client_id,
                            uint64_t uid,
                            size_t data_offset,
                            size_t data_length,
                            const void *p_data)
{
    (void)context;
    (void)client_id;
    (void)uid;
    (void)data_offset;
    (void)data_length;
    (void)p_data;

    return PSA_ERROR_STORAGE_FAILURE;
}

static uint32_t null_store_get_support(void *context,
                            uint32_t client_id)
{
    (void)context;
    (void)client_id;

    return 0;
}


struct storage_backend *null_store_init(struct null_store *context)
{
    static const struct storage_backend_interface interface =
    {
        null_store_set,
        null_store_get,
        null_store_get_info,
        null_store_remove,
        null_store_create,
        null_store_set_extended,
        null_store_get_support
    };

    context->backend.context = context;
    context->backend.interface = &interface;

    return &context->backend;
}

void null_store_deinit(struct null_store *context)
{
    context->backend.context = NULL;
    context->backend.interface = NULL;
}