summaryrefslogtreecommitdiff
path: root/include/rollback.h
blob: e33403b330c8fe06e02be1ff6b821f4e8ff10bd2 (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
/* Copyright 2017 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef __CROS_EC_ROLLBACK_H
#define __CROS_EC_ROLLBACK_H

#define CROS_EC_ROLLBACK_COOKIE 0x0b112233

#ifndef __ASSEMBLER__

/**
 * Get minimum version set by rollback protection blocks.
 *
 * @return Minimum rollback version, 0 if neither block is initialized,
 * negative value on error.
 */
int rollback_get_minimum_version(void);

/**
 * Update rollback protection block to the version passed as parameter.
 *
 * @param next_min_version	Minimum version to write in rollback block.
 *
 * @return EC_SUCCESS on success, EC_ERROR_* on error.
 */
int rollback_update_version(int32_t next_min_version);

/**
 * Add entropy to the rollback block.
 *
 * @param data	Data to be added to rollback block secret (after hashing)
 * @param len	data length
 *
 * @return EC_SUCCESS on success, EC_ERROR_* on error.
 */
int rollback_add_entropy(uint8_t *data, unsigned int len);

/**
 * Lock rollback protection block, reboot if necessary.
 *
 * @return EC_SUCCESS if rollback was already protected.
 */
int rollback_lock(void);

#endif

#endif  /* __CROS_EC_ROLLBACK_H */