components/mbedtls: modify hardware encryption feature

rename "flag" and "keybites" in aes file,
rename "xxx_starts" and add license in sha file.
This commit is contained in:
liuhan
2016-08-31 11:43:48 +08:00
committed by Wu Jian Gang
parent 2d80fada70
commit 1900c50d3b
7 changed files with 36 additions and 27 deletions

View File

@@ -77,9 +77,9 @@ int esp_aes_setkey_enc( AES_CTX *ctx, const unsigned char *key,
break;
default : return( ERR_AES_INVALID_KEY_LENGTH );
}
if (ctx->enc.flag == false){
ctx->enc.flag = true;
ctx->enc.keybites = keybits;
if (ctx->enc.keyflag == false){
ctx->enc.keyflag = true;
ctx->enc.keybits = keybits;
memset(ctx->enc.key, 0, sizeof(ctx->enc.key));
memcpy(ctx->enc.key, key, keybyte);
} else {
@@ -108,9 +108,9 @@ int esp_aes_setkey_dec( AES_CTX *ctx, const unsigned char *key,
break;
default : return( ERR_AES_INVALID_KEY_LENGTH );
}
if (ctx->dec.flag == false){
ctx->dec.flag = true;
ctx->dec.keybites = keybits;
if (ctx->dec.keyflag == false){
ctx->dec.keyflag = true;
ctx->dec.keybits = keybits;
memset(ctx->dec.key, 0, sizeof(ctx->dec.key));
memcpy(ctx->dec.key, key, keybyte);
} else {
@@ -123,9 +123,9 @@ int esp_aes_setkey_dec( AES_CTX *ctx, const unsigned char *key,
static void esp_aes_process_enable(AES_CTX *ctx, int mode)
{
if( mode == AES_ENCRYPT ){
esp_aes_setkey_enc(ctx, ctx->enc.key, ctx->enc.keybites);
esp_aes_setkey_enc(ctx, ctx->enc.key, ctx->enc.keybits);
}else{
esp_aes_setkey_dec(ctx, ctx->dec.key, ctx->dec.keybites);
esp_aes_setkey_dec(ctx, ctx->dec.key, ctx->dec.keybits);
}
return;
}