mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-29 18:11:05 +00:00
Handle UPDATE_EXTRA_CMD_PAIR_CHALLENGE command, where the
lid sends a random x25519 public key, and nonce, and the base
replies with its own (stable) x25519 public key, and computes
a shared secret using its private key to verify its identity.
BRANCH=none
BUG=b:38486828
TEST=Flash hammer, ./usb_updater2 -c always reports the same
device public key, and authenticator is correct.
Change-Id: Ida60ffa7476794ee92669951c740dbe35950fb9c
Reviewed-on: https://chromium-review.googlesource.com/532475
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
35 lines
1.1 KiB
C
35 lines
1.1 KiB
C
/* Copyright (c) 2013 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.
|
|
*/
|
|
|
|
/* Handy clever tricks */
|
|
|
|
#ifndef __CROS_EC_COMPILE_TIME_MACROS_H
|
|
#define __CROS_EC_COMPILE_TIME_MACROS_H
|
|
|
|
/* Test an important condition at compile time, not run time */
|
|
#define _BA1_(cond, line) \
|
|
extern int __build_assertion_ ## line[1 - 2*!(cond)] \
|
|
__attribute__ ((unused))
|
|
#define _BA0_(c, x) _BA1_(c, x)
|
|
#define BUILD_ASSERT(cond) _BA0_(cond, __LINE__)
|
|
|
|
/* Number of elements in an array */
|
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
|
|
|
/* Make for loops that iterate over pointers to array entries more readable */
|
|
#define ARRAY_BEGIN(array) (array)
|
|
#define ARRAY_END(array) ((array) + ARRAY_SIZE(array))
|
|
|
|
/* Just in case - http://gcc.gnu.org/onlinedocs/gcc/Offsetof.html */
|
|
#ifndef offsetof
|
|
#define offsetof(type, member) __builtin_offsetof(type, member)
|
|
#endif
|
|
|
|
#define member_size(type, member) sizeof(((type *)0)->member)
|
|
|
|
#define __visible __attribute__((externally_visible))
|
|
|
|
#endif /* __CROS_EC_COMPILE_TIME_MACROS_H */
|