#include 赞 踩 Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。
ESP8266&&32 AES加密、解密 (ECB方式)_esp8266 加密解密
#include <stdio.h>
#include "esp_system.h"
#include "mbedtls/aes.h"
#include <stddef.h>
#include <stdint.h>
#include "config.h"
#include <string.h>
#include <stdio.h>
#include "esp_system.h"
void app_main(void)
{
int ret = 0, i, j, u, mode;
unsigned int keybits;
unsigned char key[16]="123456789012345";
unsigned char inbuf[16]="123456789012345";
unsigned char outbuf[16]={0};
unsigned char buf[16]={0};
const unsigned char *aes_tests;
mbedtls_aes_context ctx;
//memset(key,0,16);
mbedtls_aes_init(&ctx);
for(int loop=0;loop<16;loop++)
printf("%c",key[loop]);
keybits=128;
mode=1;
printf( " AES-ECB-%3d (%s):\r\n ", keybits,
( mode == MBEDTLS_AES_DECRYPT ) ? "dec" : "enc" );
//memset( buf, 0, 16 );
//ret = mbedtls_aes_setkey_dec( &ctx, key, keybits