2 * Copyright (C) 2016 The Android Open Source Project
4 * SPDX-License-Identifier: (MIT or BSD-3-Clause)
7 /* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
8 * Use of this source code is governed by a BSD-style license that can be
9 * found in the LICENSE file.
12 #ifdef AVB_INSIDE_LIBAVB_H
13 #error "You can't include avb_rsa.h in the public header libavb.h."
16 #ifndef AVB_COMPILATION
17 #error "Never include this file, it may only be used from internal avb code."
27 #include "avb_crypto.h"
28 #include "avb_sysdeps.h"
30 /* Using the key given by |key|, verify a RSA signature |sig| of
31 * length |sig_num_bytes| against an expected |hash| of length
32 * |hash_num_bytes|. The padding to expect must be passed in using
33 * |padding| of length |padding_num_bytes|.
35 * The data in |key| must match the format defined in
36 * |AvbRSAPublicKeyHeader|, including the two large numbers
37 * following. The |key_num_bytes| must be the size of the entire
40 * Returns false if verification fails, true otherwise.
42 bool avb_rsa_verify(const uint8_t* key,
47 size_t hash_num_bytes,
48 const uint8_t* padding,
49 size_t padding_num_bytes) AVB_ATTR_WARN_UNUSED_RESULT;
55 #endif /* AVB_RSA_H_ */