crpytocb: support SHA224 under WOLF_CRYPTO_CB_ONLY_SHA256#10500
Open
rizlik wants to merge 1 commit into
Open
Conversation
Comment on lines
+2397
to
+2437
| #ifdef WOLF_CRYPTO_CB_ONLY_SHA256 | ||
|
|
||
| int wc_Sha224Update(wc_Sha224* sha224, const byte* data, word32 len) | ||
| { | ||
| if (sha224 == NULL) | ||
| return BAD_FUNC_ARG; | ||
| if (data == NULL && len == 0) | ||
| return 0; | ||
| if (data == NULL) | ||
| return BAD_FUNC_ARG; | ||
|
|
||
| #ifndef WOLF_CRYPTO_CB_FIND | ||
| if (sha224->devId != INVALID_DEVID) | ||
| #endif | ||
| { | ||
| int ret = wc_CryptoCb_Sha224Hash(sha224, data, len, NULL); | ||
| if (ret != WC_NO_ERR_TRACE(CRYPTOCB_UNAVAILABLE)) | ||
| return ret; | ||
| } | ||
|
|
||
| return NO_VALID_DEVID; | ||
| } | ||
|
|
||
| int wc_Sha224Final(wc_Sha224* sha224, byte* hash) | ||
| { | ||
| int ret; | ||
|
|
||
| if (sha224 == NULL || hash == NULL) | ||
| return BAD_FUNC_ARG; | ||
|
|
||
| #ifndef WOLF_CRYPTO_CB_FIND | ||
| if (sha224->devId != INVALID_DEVID) | ||
| #endif | ||
| { | ||
| ret = wc_CryptoCb_Sha224Hash(sha224, NULL, 0, hash); | ||
| if (ret != WC_NO_ERR_TRACE(CRYPTOCB_UNAVAILABLE)) | ||
| return ret; | ||
| } | ||
|
|
||
| return NO_VALID_DEVID; | ||
| } |
Comment on lines
+72309
to
+72319
| /* set devId to invalid, so software is used */ | ||
| info->hash.sha224->devId = INVALID_DEVID; | ||
| #if defined(WOLF_CRYPTO_CB_ONLY_SHA256) | ||
| #ifdef DEBUG_WOLFSSL | ||
| printf("CryptoDevCb: exampleVar %d\n", myCtx->exampleVar); | ||
| #endif | ||
| if (myCtx->exampleVar == 99) { | ||
| info->hash.sha224->devId = devIdArg; | ||
| return 0; | ||
| } | ||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.