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