Skip to content

Commit 7a01744

Browse files
authored
Merge pull request #378 from night1rider/KDF-missing-aes-init
Fix missing AES initialization in krb5 kdf
2 parents c58b251 + 2a71e28 commit 7a01744

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/wp_krb5kdf.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ static int wp_kdf_krb5kdf_derive(wp_Krb5kdfCtx* ctx, unsigned char* key,
446446
size_t osize = 0;
447447
size_t cipherLen = 0;
448448
int rc;
449-
Aes aes;
449+
Aes aes = {0};
450450
byte block[AES_BLOCK_SIZE];
451451
byte cipherBlock[AES_BLOCK_SIZE];
452452
byte *plain = NULL;
@@ -457,6 +457,13 @@ static int wp_kdf_krb5kdf_derive(wp_Krb5kdfCtx* ctx, unsigned char* key,
457457
if (!wolfssl_prov_is_running()) {
458458
ok = 0;
459459
}
460+
if (ok) {
461+
rc = wc_AesInit(&aes, NULL, INVALID_DEVID);
462+
if (rc != 0) {
463+
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_LEVEL_DEBUG, "wc_AesInit", rc);
464+
ok = 0;
465+
}
466+
}
460467
if (ok && (!wp_kdf_krb5kdf_set_ctx_params(ctx, params))) {
461468
ok = 0;
462469
}

0 commit comments

Comments
 (0)