Package list libcryptx-perl / b9f5900
ltc update Karel Miko 3 years ago
1 changed file(s) with 6 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
114114 key = XMALLOC(u * c);
115115 I = XMALLOC(Plen + Slen);
116116 if (key == NULL || I == NULL) goto DONE;
117 zeromem(key, u * c);
117118
118119 for (i = 0; i < v; i++) D[i] = purpose; /* D - diversifier */
119120 for (i = 0; i < Slen; i++) I[i] = salt[i % saltlen];
228229 pad = dec_data[enc_size-1];
229230 if (pad < 1 || pad > blklen) goto LBL_ERROR;
230231 *dec_size = enc_size - pad;
231 return CRYPT_OK;
232 err = CRYPT_OK;
233 goto LBL_DONE;
232234 }
233235
234236 LBL_ERROR:
237 err = CRYPT_INVALID_ARG;
238 LBL_DONE:
235239 zeromem(key_iv, sizeof(key_iv));
236240 if (pw) { zeromem(pw, pwlen); XFREE(pw); }
237 return CRYPT_INVALID_ARG;
241 return err;
238242 }
239243
240244 static int _pbes2_pbkdf2_decrypt(const unsigned char *enc_data, unsigned long enc_size,
569573 /* load private key value 'k' */
570574 len = lpri->size;
571575 if ((err = der_decode_sequence_flexi(lpri->data, &len, &p)) == CRYPT_OK) {
572 err = CRYPT_INVALID_PACKET;
573576 if (p->type == LTC_ASN1_SEQUENCE &&
574577 p->child && p->child->type == LTC_ASN1_INTEGER &&
575578 p->child->next && p->child->next->type == LTC_ASN1_OCTET_STRING) {