mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 11:17:29 +02:00
ED448: Fix out of bounds read in import public
Fix formatting
This commit is contained in:
@ -197,7 +197,7 @@ static int ed448_sign_msg(const byte* in, word32 inLen, byte* out,
|
|||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
ret = wc_Shake256_Update(&sha, &contextLen, sizeof(contextLen));
|
ret = wc_Shake256_Update(&sha, &contextLen, sizeof(contextLen));
|
||||||
}
|
}
|
||||||
if (ret == 0 && context != NULL) {
|
if ((ret == 0) && (context != NULL)) {
|
||||||
ret = wc_Shake256_Update(&sha, context, contextLen);
|
ret = wc_Shake256_Update(&sha, context, contextLen);
|
||||||
}
|
}
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
@ -230,7 +230,7 @@ static int ed448_sign_msg(const byte* in, word32 inLen, byte* out,
|
|||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
ret = wc_Shake256_Update(&sha, &contextLen, sizeof(contextLen));
|
ret = wc_Shake256_Update(&sha, &contextLen, sizeof(contextLen));
|
||||||
}
|
}
|
||||||
if (ret == 0 && context != NULL) {
|
if ((ret == 0) && (context != NULL)) {
|
||||||
ret = wc_Shake256_Update(&sha, context, contextLen);
|
ret = wc_Shake256_Update(&sha, context, contextLen);
|
||||||
}
|
}
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
@ -400,7 +400,7 @@ static int ed448_verify_msg(const byte* sig, word32 sigLen, const byte* msg,
|
|||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
ret = wc_Shake256_Update(&sha, &contextLen, sizeof(contextLen));
|
ret = wc_Shake256_Update(&sha, &contextLen, sizeof(contextLen));
|
||||||
}
|
}
|
||||||
if (ret == 0 && context != NULL) {
|
if ((ret == 0) && (context != NULL)) {
|
||||||
ret = wc_Shake256_Update(&sha, context, contextLen);
|
ret = wc_Shake256_Update(&sha, context, contextLen);
|
||||||
}
|
}
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
@ -615,6 +615,10 @@ int wc_ed448_import_public(const byte* in, word32 inLen, ed448_key* key)
|
|||||||
ret = BAD_FUNC_ARG;
|
ret = BAD_FUNC_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (inLen < ED448_PUB_KEY_SIZE) {
|
||||||
|
ret = BAD_FUNC_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
/* compressed prefix according to draft
|
/* compressed prefix according to draft
|
||||||
* https://tools.ietf.org/html/draft-ietf-openpgp-rfc4880bis-06 */
|
* https://tools.ietf.org/html/draft-ietf-openpgp-rfc4880bis-06 */
|
||||||
@ -699,7 +703,8 @@ int wc_ed448_import_private_key(const byte* priv, word32 privSz,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* key size check */
|
/* key size check */
|
||||||
if ((ret == 0) && (privSz < ED448_KEY_SIZE || pubSz < ED448_PUB_KEY_SIZE)) {
|
if ((ret == 0) && ((privSz < ED448_KEY_SIZE) ||
|
||||||
|
(pubSz < ED448_PUB_KEY_SIZE))) {
|
||||||
ret = BAD_FUNC_ARG;
|
ret = BAD_FUNC_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user