gecko-dev/security
Cykesiopka 7995951109 Bug 1338897 - Avoid using NSS Base64 functions in PSM. r=keeler
The NSS Base64 functions are less safe and convenient to use than the XPCOM ones.
They're also an unnecessary dependency on NSS.

The NSS Base64 functions behave slightly differently than the XPCOM ones:
1. ATOB_ConvertAsciiToItem() / NSSBase64_DecodeBuffer() silently ignore invalid
   characters like CRLF, space and so on. Base64Decode() will return an error
   if these characters are encountered.
2. BTOA_DataToAscii() will produce output that has CRLF inserted every 64
   characters. Base64Encode() doesn't do this.

For the reasons listed below, no unexpected compatibility issues should arise:
1. AppSignatureVerification.cpp already filters out CRLF and spaces for Manifest
   and Signature values before decoding.
2. ExtendedValidation.cpp is only given what should be valid hard-coded input to
   decode.
3. ContentSignatureVerifier.cpp already splits on CRLF for when it needs to
   decode PEM certs. Spaces shouldn't be likely.
   For Content-Signature header verification, examination of real input to a
   running instance of Firefox suggests CRLF and spaces will not be present in
   the header to decode.
4. nsCryptoHash.cpp encode is affected, but we actually don't want the CRLF
   behaviour.
5. nsDataSignatureVerifier.cpp decode is affected, but we add whitespace
   stripping to maintain backwards compatibility.
6. nsKeygenHandler.cpp encode is affected, but the previous CRLF behaviour was
   arguably a bug, since neither WHATWG or W3C specs specified this.

MozReview-Commit-ID: IWMFxqVZMeX

--HG--
extra : rebase_source : 4863b2e5eabef0555e8e1ebe39216d0d9393f3e9
2017-03-17 23:31:40 +08:00
..
apps Bug 1338897 - Avoid using NSS Base64 functions in PSM. r=keeler 2017-03-17 23:31:40 +08:00
certverifier Bug 1338897 - Avoid using NSS Base64 functions in PSM. r=keeler 2017-03-17 23:31:40 +08:00
manager Bug 1338897 - Avoid using NSS Base64 functions in PSM. r=keeler 2017-03-17 23:31:40 +08:00
nss Bug 1345368 - land NSS 37ccb22f8e51, r=me 2017-03-17 06:01:56 +01:00
pkix bug 1339921 - disable clang's shadowed field warning in a mozilla::pkix gtest class r=Cykesiopka,dholbert 2017-03-14 15:58:04 -07:00
sandbox Bug 1340351 - Allow sandboxed content process on macOS to access fonts synced by Adobe Creative Cloud. r=haik 2017-03-16 22:26:43 +00:00
generate_certdata.py bug 1295937 - build NSS using gyp files. r=glandium 2016-11-09 12:37:09 -05:00
generate_mapfile.py Bug 1320690 - Re-enable bundled NSS on BSDs. r=ted 2016-11-28 14:33:36 +00:00
moz.build Bug 1344829 - add BUG_COMPONENT to security/* files. r=keeler 2017-03-09 05:33:30 -05:00
nss.symbols Bug 1338897 - Avoid using NSS Base64 functions in PSM. r=keeler 2017-03-17 23:31:40 +08:00