hw/misc: implement ESP32-C3 AES

Co-authored-by: Harshal Patil <harshal.patil@espressif.com>
This commit is contained in:
Omar Chebib
2023-05-12 10:56:39 +08:00
committed by Ivan Grokhotkov
parent 78702e57a0
commit 9385e8de91
3 changed files with 56 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
/*
* ESP32C3 AES emulation
*
* Copyright (c) 2023 Espressif Systems (Shanghai) Co. Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 or
* (at your option) any later version.
*/
#include "qemu/osdep.h"
#include "hw/misc/esp32c3_aes.h"
static const TypeInfo esp32c3_aes_info = {
.name = TYPE_ESP32C3_AES,
.parent = TYPE_ESP_AES,
.instance_size = sizeof(ESP32C3AesState),
.class_size = sizeof(ESP32C3AesClass)
};
static void esp32c3_aes_register_types(void)
{
type_register_static(&esp32c3_aes_info);
}
type_init(esp32c3_aes_register_types)
+4
View File
@@ -161,6 +161,10 @@ if gcrypt.found()
system_ss.add(when: [gcrypt, 'CONFIG_XTENSA_ESP32'], if_true: files(
'esp32_rsa.c',
))
system_ss.add(when: [gcrypt, 'CONFIG_RISCV_ESP32C3'], if_true: files(
'esp_aes.c',
'esp32c3_aes.c',
))
endif
system_ss.add(when: 'CONFIG_GRLIB', if_true: files('grlib_ahb_apb_pnp.c'))
+27
View File
@@ -0,0 +1,27 @@
/*
* ESP32-C3 AES emulation
*
* Copyright (c) 2023 Espressif Systems (Shanghai) Co. Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 or
* (at your option) any later version.
*/
#pragma once
#include "hw/misc/esp_aes.h"
#define TYPE_ESP32C3_AES "misc.esp32c3.aes"
#define ESP32C3_AES(obj) OBJECT_CHECK(ESP32C3AesState, (obj), TYPE_ESP32C3_AES)
#define ESP32C3_AES_GET_CLASS(obj) OBJECT_GET_CLASS(ESP32C3AesClass, obj, TYPE_ESP32C3_AES)
#define ESP32C3_AES_CLASS(klass) OBJECT_CLASS_CHECK(ESP32C3AesClass, klass, TYPE_ESP32C3_AES)
typedef struct ESP32C3AesState {
ESPAesState parent;
} ESP32C3AesState;
typedef struct ESP32C3AesClass {
ESPAesClass parent_class;
} ESP32C3AesClass;