Package list libcryptx-perl / da808b4
libtomcrypt update Karel Miko 2 years ago
3 changed file(s) with 14 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
8383 int pbes2_extract(const ltc_asn1_list *s, pbes_arg *res)
8484 {
8585 unsigned long klen;
86 ltc_asn1_list *lkdf, *lenc, *loptseq, *lhmac;
86 ltc_asn1_list *lkdf, *lenc, *loptseq, *liter, *lhmac;
8787 int err;
8888
8989 LTC_ARGCHK(s != NULL);
108108 * 21:d=4 hl=2 l= 9 prim: OBJECT :PBKDF2 (== *lkdf)
109109 * 32:d=4 hl=2 l= 28 cons: SEQUENCE
110110 * 34:d=5 hl=2 l= 8 prim: OCTET STRING [HEX DUMP]:28BA4ABF6AA76A3D (== res->salt)
111 * 44:d=5 hl=2 l= 2 prim: INTEGER :0800 (== res->iterations)
111 * 44:d=5 hl=2 l= 2 prim: INTEGER :0800 (== res->iterations, *liter)
112112 * 48:d=5 hl=2 l= 12 cons: SEQUENCE (== *loptseq - this sequence is optional, may be missing)
113113 * 50:d=6 hl=2 l= 8 prim: OBJECT :hmacWithSHA256 (== *lhmac)
114114 * 60:d=6 hl=2 l= 0 prim: NULL
128128 return CRYPT_INVALID_PACKET;
129129 }
130130
131 loptseq = lkdf->next->child->next->next;
131 liter = lkdf->next->child->next;
132 loptseq = liter->next;
132133 res->salt = lkdf->next->child;
133 res->iterations = mp_get_int(lkdf->next->child->next->data);
134 res->iterations = mp_get_int(liter->data);
135
136 /* There's an optional INTEGER keyLength after the iterations, skip that if it's there.
137 * c.f. RFC 2898 A.2 PBKDF2 */
138 if(LTC_ASN1_IS_TYPE(loptseq, LTC_ASN1_INTEGER)) {
139 loptseq = loptseq->next;
140 }
134141
135142 /* this sequence is optional */
136143 lhmac = NULL;
7575 }
7676 else if (sigformat == LTC_ECCSIG_RFC7518) {
7777 /* RFC7518 format - raw (r,s) */
78 i = mp_unsigned_bin_size(key->dp.order);
79 if (siglen != (2*i)) {
78 if ((siglen % 2) == 1) {
8079 err = CRYPT_INVALID_PACKET;
8180 goto error;
8281 }
82 i = siglen / 2;
8383 if ((err = mp_read_unsigned_bin(r, (unsigned char *)sig, i)) != CRYPT_OK) { goto error; }
8484 if ((err = mp_read_unsigned_bin(s, (unsigned char *)sig+i, i)) != CRYPT_OK) { goto error; }
8585 }
44 use File::Slurper qw(read_text write_text);
55 use FindBin;
66
7 my $ltc_branch = "pr/pkcs8-improved";
7 my $ltc_branch = "develop";
88 my $ltm_branch = "no-stdint-h";
99 my $tmpdir = "/tmp/libtom.git.checkout.$$";
1010