Comments (4)
Hi @kenyiesnc
You are absolutely correct! The passed in key size should be used when setting the AES key. I've also updated the README to be more clear that the key size is in bits.
from wolfssl-examples.
Ran into errors when I pass in key size in bits... it seems like wc_AesSetKey requires key size to be passed in bytes? https://github.com/wolfSSL/wolfssl/blob/aa8e5a29d45f9327029311bfb1b8994feaa62368/wolfcrypt/src/aes.c#L90
from wolfssl-examples.
The wc_AesSetKey
API does take size in bytes. The example passes in size in bits. I modified the example to convert the size in the SizeCheck
function:
int SizeCheck(int *size)
{
int ret = 0;
/* Use key size values (size/8) */
if (*size == 128) {
*size = AES_128_KEY_SIZE;
}
else if (*size == 192) {
*size = AES_192_KEY_SIZE;
}
else if (*size == 256) {
*size = AES_256_KEY_SIZE;
}
else {
/* if the entered size does not match acceptable size */
printf("Invalid AES key size\n");
ret = -1080;
}
return ret;
}
from wolfssl-examples.
Ok thanks for confirming. I was using the example code as basis for code in my program.
from wolfssl-examples.
Related Issues (20)
- Failed to connect to server when query data from etherscan with client example in SGX_Linux. HOT 1
- Windows SGX example build fails with LNK2019 HOT 4
- Thread leack detected in one of the examples HOT 1
- BTLE example error HOT 28
- ERROR: Failed to connect to wolfSSL HOT 1
- Camellia example HOT 2
- wc_ChaCha_Setkey return -173 despite following example HOT 1
- README.md typo HOT 3
- does wolfssl support tls connection establishment with client-secret-based and server-cert-based authentication? Thx HOT 5
- failed to build tls-sock-client HOT 3
- -lsgx_tstdcxx is deprecated
- Build error after make command HOT 4
- Error: failed to load certificates HOT 5
- Generation of sphincs certificates HOT 2
- Espressif idf refuses to clean shared VisualGDB build directory
- Some TLS certificates expired HOT 2
- Update Espressif examples to use new "no setup" CMakeFiles.txt
- Unable to verify a certificate chain using certverify.c in certmangaer directory HOT 4
- Problem receiving messages on the dtls threaded server HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wolfssl-examples.