Lei He | 4c5e512 | 2022-05-25 17:01:14 +0800 | [diff] [blame] | 1 | /* |
| 2 | * QEMU Crypto RSA key parser |
| 3 | * |
| 4 | * Copyright (c) 2022 Bytedance |
| 5 | * Author: lei he <helei.sig11@bytedance.com> |
| 6 | * |
| 7 | * This library is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Lesser General Public |
| 9 | * License as published by the Free Software Foundation; either |
| 10 | * version 2.1 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public |
| 18 | * License along with this library; if not, see <http://www.gnu.org/licenses/>. |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | #include "rsakey.h" |
| 23 | |
| 24 | void qcrypto_akcipher_rsakey_free(QCryptoAkCipherRSAKey *rsa_key) |
| 25 | { |
| 26 | if (!rsa_key) { |
| 27 | return; |
| 28 | } |
| 29 | g_free(rsa_key->n.data); |
| 30 | g_free(rsa_key->e.data); |
| 31 | g_free(rsa_key->d.data); |
| 32 | g_free(rsa_key->p.data); |
| 33 | g_free(rsa_key->q.data); |
| 34 | g_free(rsa_key->dp.data); |
| 35 | g_free(rsa_key->dq.data); |
| 36 | g_free(rsa_key->u.data); |
| 37 | g_free(rsa_key); |
| 38 | } |
| 39 | |
| 40 | #if defined(CONFIG_NETTLE) && defined(CONFIG_HOGWEED) |
| 41 | #include "rsakey-nettle.c.inc" |
| 42 | #else |
| 43 | #include "rsakey-builtin.c.inc" |
| 44 | #endif |