/*
* Copyright (C) 2019 Sean Parkinson, wolfSSL Inc.
+ * Copyright (C) 2021 Andreas Steffen, strongSec GmbH
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* wolfSSL cipher
*/
union {
-#if !defined(NO_AES) && (!defined(NO_AES_CBC) || defined(WOLFSSL_AES_COUNTER))
+#if !defined(NO_AES) && (!defined(NO_AES_CBC) || defined(HAVE_AES_ECB) || defined(WOLFSSL_AES_COUNTER))
Aes aes;
#endif
#ifdef HAVE_CAMELLIA
success = (ret == 0);
break;
#endif
+#if !defined(NO_AES) && defined(HAVE_AES_ECB)
+ case ENCR_AES_ECB:
+ ret = wc_AesSetKey(&this->cipher.aes, this->key.ptr, this->key.len,
+ iv.ptr, AES_DECRYPTION);
+ if (ret == 0)
+ {
+ ret = wc_AesEcbDecrypt(&this->cipher.aes, out, data.ptr,
+ data.len);
+ }
+ success = (ret == 0);
+ break;
+ #endif
#if !defined(NO_AES) && defined(WOLFSSL_AES_COUNTER)
case ENCR_AES_CTR:
if (out == data.ptr)
success = (ret == 0);
break;
#endif
+#if !defined(NO_AES) && defined(HAVE_AES_ECB)
+ case ENCR_AES_ECB:
+ ret = wc_AesSetKey(&this->cipher.aes, this->key.ptr, this->key.len,
+ iv.ptr, AES_ENCRYPTION);
+ if (ret == 0)
+ {
+ ret = wc_AesEcbEncrypt(&this->cipher.aes, out, data.ptr,
+ data.len);
+ }
+ success = (ret == 0);
+ break;
+#endif
#if !defined(NO_AES) && defined(WOLFSSL_AES_COUNTER)
case ENCR_AES_CTR:
if (out == data.ptr)
wc_AesFree(&this->cipher.aes);
break;
#endif
+#if !defined(NO_AES) && defined(HAVE_AES_ECB)
+ case ENCR_AES_ECB:
+ wc_AesFree(&this->cipher.aes);
+ break;
+#endif
#if !defined(NO_AES) && defined(WOLFSSL_AES_COUNTER)
case ENCR_AES_CTR:
wc_AesFree(&this->cipher.aes);
}
break;
#endif
+#if !defined(NO_AES) && defined(HAVE_AES_ECB)
+ case ENCR_AES_ECB:
+ switch (key_size)
+ {
+ case 0:
+ key_size = 16;
+ /* fall-through */
+ case 16:
+ case 24:
+ case 32:
+ block_size = AES_BLOCK_SIZE;
+ iv_size = AES_IV_SIZE;
+ break;
+ default:
+ return NULL;
+ }
+ break;
+#endif
#if !defined(NO_AES) && defined(WOLFSSL_AES_COUNTER)
case ENCR_AES_CTR:
switch (key_size)
ret = wc_AesInit(&this->cipher.aes, NULL, INVALID_DEVID);
break;
#endif
+#if !defined(NO_AES) && defined(HAVE_AES_ECB)
+ case ENCR_AES_ECB:
+ ret = wc_AesInit(&this->cipher.aes, NULL, INVALID_DEVID);
+ break;
+#endif
#if !defined(NO_AES) && defined(WOLFSSL_AES_COUNTER)
case ENCR_AES_CTR:
ret = wc_AesInit(&this->cipher.aes, NULL, INVALID_DEVID);
PLUGIN_PROVIDE(CRYPTER, ENCR_AES_CBC, 24),
PLUGIN_PROVIDE(CRYPTER, ENCR_AES_CBC, 32),
#endif
+#if !defined(NO_AES) && defined(HAVE_AES_ECB)
+ PLUGIN_PROVIDE(CRYPTER, ENCR_AES_ECB, 16),
+ PLUGIN_PROVIDE(CRYPTER, ENCR_AES_ECB, 24),
+ PLUGIN_PROVIDE(CRYPTER, ENCR_AES_ECB, 32),
+#endif
#ifdef HAVE_CAMELLIA
PLUGIN_PROVIDE(CRYPTER, ENCR_CAMELLIA_CBC, 16),
PLUGIN_PROVIDE(CRYPTER, ENCR_CAMELLIA_CBC, 24),