Commit 443aa6a
committed
ASN: improve handling of ASN.1 parsing/encoding
ToTraditionalInline_ex2 original ASN code:
- Now return 0 when no OCTECT_STRING data found.
- Change callers to accept 0 as a valid returnb value.
SizeASN_Items:
- Change encoded size to word32 as won't be negative.
- Change callers to supply a pointer to a word32 instead of integer.
Fix casting due to change of parameter type.
ASN_LEN_ENC_LEN: Function to calculate the length of the encoded ASN.1
length.
GetLength_ex:
- Change minLen to word32
- Change length to word32 and change negative check appropriately for
different type.
GetASNHeader_ex:
- If not checking lengths in GetLength_ex, check it here.
DecodeObjectId:
- Ensure no overflow in calculation.
_RsaPrivateKeyDecode (original)
- Clear RSA integers on failure (will be done in free anyway).
wc_CreatePKCS8Key (original):
- safe check of overflow.
DecryptContent (templare):
- Parse will fail if OID not recognized, and recognized OIDs are 9/10
bytes long - but check idx is 9/10 anyway so we know we can read 2 end
bytes of data.
wc_RsaPublicKeyDecode_ex (original):
- Fix calculation of seqEndIdx and use it to bound modulus and
exponent.
DecodePolicyOID
- enusre inSz is not too long.
- Ensure no overflow in calculation.
SetOidValue (orginal):
- Safe check of inSz and oidSz.
SetAltNames (original):
- Improve length checks
FlattenAltNames:
- Check for overflow.
- Better length check.
ParseCRL_CertList (original):
- overflow check1 parent a631611 commit 443aa6a
4 files changed
Lines changed: 251 additions & 186 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1829 | 1829 | | |
1830 | 1830 | | |
1831 | 1831 | | |
1832 | | - | |
| 1832 | + | |
1833 | 1833 | | |
1834 | 1834 | | |
1835 | 1835 | | |
| |||
12452 | 12452 | | |
12453 | 12453 | | |
12454 | 12454 | | |
12455 | | - | |
| 12455 | + | |
12456 | 12456 | | |
12457 | 12457 | | |
12458 | 12458 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8654 | 8654 | | |
8655 | 8655 | | |
8656 | 8656 | | |
8657 | | - | |
| 8657 | + | |
8658 | 8658 | | |
8659 | 8659 | | |
8660 | 8660 | | |
| |||
0 commit comments