Skip to content

Commit 0f3d308

Browse files
committed
cppcheck: fix redundant check on ret==0
1 parent 307e41d commit 0f3d308

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/wh_she_crypto.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ int wh_She_GenerateLoadableKey(uint8_t keyId,
135135
ret = wh_AesMp16(kdfInput,
136136
WH_SHE_KEY_SZ + sizeof(_SHE_KEY_UPDATE_ENC_C), tmpKey);
137137

138-
/* Build M1 and cleartext M2 */
138+
/* Build M1 and cleartext M2, then encrypt M2 with K1 */
139139
if (ret == 0) {
140140
/* Build M1: set UID, key id and authId */
141141
memcpy(messageOne, uid, WH_SHE_UID_SZ);
@@ -149,9 +149,8 @@ int wh_She_GenerateLoadableKey(uint8_t keyId,
149149
(count << WH_SHE_M2_COUNT_SHIFT) |
150150
(flags << WH_SHE_M2_FLAGS_SHIFT) );
151151
memcpy(messageTwo + WH_SHE_M2_KEY_OFFSET, key, WH_SHE_KEY_SZ);
152-
}
153-
/* encrypt M2 with K1 */
154-
if (ret == 0) {
152+
153+
/* encrypt M2 with K1 */
155154
ret = wc_AesInit(aes, NULL, INVALID_DEVID);
156155
if (ret == 0) {
157156
ret = wc_AesSetKey(aes, tmpKey, WH_SHE_KEY_SZ, NULL,

0 commit comments

Comments
 (0)