construct salt and password buffers for PBE correctly

git-svn-id: svn://10.0.0.236/trunk@107778 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ian.mcgreer%sun.com
2001-11-09 22:51:42 +00:00
parent c41f9aa079
commit a508954d9b

View File

@@ -470,15 +470,19 @@ nsspkcs5_PKCS12PBE(const SECHashObject *hashObject,
PORT_Memset(D.data, (char)bitGenPurpose, D.len);
if (SLen) {
PORT_Memcpy(S, salt->data, salt->len);
if (salt->len != SLen) {
PORT_Memcpy(S+salt->len, salt->data, SLen-(salt->len));
unsigned int z = 0;
while (z < SLen) {
int amount = (z + salt->len > SLen) ? SLen - z : salt->len;
PORT_Memcpy(S, salt->data, amount);
z += salt->len;
}
}
if (PLen) {
PORT_Memcpy(P, salt->data, salt->len);
if (salt->len != PLen) {
PORT_Memcpy(P+salt->len, salt->data, PLen-salt->len);
unsigned int z = 0;
while (z < PLen) {
int amount = (z + pwitem->len > PLen) ? PLen - z : pwitem->len;
PORT_Memcpy(P, pwitem->data, amount);
z += pwitem->len;
}
}