Ensure that CBB is |CBB_zero|ed before possibly calling |CBB_cleanup|.

Change-Id: Ic1f58f87c67104c8a51af59086a1bb1e5ccb0e5b
Reviewed-on: https://boringssl-review.googlesource.com/13084
Reviewed-by: Adam Langley <alangley@gmail.com>
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: Adam Langley <alangley@gmail.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
Adam Langley 2017-01-10 16:42:25 -08:00 committed by CQ bot account: commit-bot@chromium.org
parent 4fae069c00
commit 2a25aae0f5

View File

@ -89,6 +89,9 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
return NULL;
}
CBB cbb;
CBB_zero(&cbb);
/* Generate a random PBKDF2 salt if necessary. This will be parsed back out of
* the serialized |X509_ALGOR|. */
X509_ALGOR *ret = NULL;
@ -109,7 +112,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
}
/* See RFC 2898, appendix A. */
CBB cbb, algorithm, param, kdf, kdf_param, salt_cbb, cipher_cbb, iv_cbb;
CBB algorithm, param, kdf, kdf_param, salt_cbb, cipher_cbb, iv_cbb;
if (!CBB_init(&cbb, 16) ||
!CBB_add_asn1(&cbb, &algorithm, CBS_ASN1_SEQUENCE) ||
!OBJ_nid2cbb(&algorithm, NID_pbes2) ||