Svyatoslav Ryhel | c14b207 | 2023-02-14 19:35:36 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * Copyright (c) 2011 The Chromium OS Authors. |
| 4 | * (C) Copyright 2010 - 2011 NVIDIA Corporation <www.nvidia.com> |
| 5 | */ |
| 6 | |
| 7 | #ifndef _CRYPTO_H_ |
| 8 | #define _CRYPTO_H_ |
| 9 | |
| 10 | /** |
| 11 | * Sign a block of data |
| 12 | * |
| 13 | * \param source Source data |
| 14 | * \param length Size of source data |
| 15 | * \param signature Destination address for signature, AES_KEY_LENGTH bytes |
| 16 | */ |
| 17 | int sign_data_block(u8 *source, unsigned int length, u8 *signature); |
| 18 | |
| 19 | /** |
| 20 | * Sign an encrypted block of data |
| 21 | * |
| 22 | * \param source Source data |
| 23 | * \param length Size of source data |
| 24 | * \param signature Destination address for signature, AES_KEY_LENGTH bytes |
| 25 | * \param key AES128 encryption key |
| 26 | */ |
| 27 | int sign_enc_data_block(u8 *source, unsigned int length, u8 *signature, u8 *key); |
| 28 | |
| 29 | /** |
| 30 | * Encrypt a block of data |
| 31 | * |
| 32 | * \param source Source data |
| 33 | * \param length Size of source data |
| 34 | * \param key AES128 encryption key |
| 35 | */ |
| 36 | int encrypt_data_block(u8 *source, unsigned int length, u8 *key); |
| 37 | |
| 38 | /** |
| 39 | * Decrypt a block of data |
| 40 | * |
| 41 | * \param source Source data |
| 42 | * \param length Size of source data |
| 43 | * \param key AES128 encryption key |
| 44 | */ |
| 45 | int decrypt_data_block(u8 *source, unsigned int length, u8 *key); |
| 46 | |
| 47 | #endif /* #ifndef _CRYPTO_H_ */ |