diff options
author | Gloria Wang <gwang@google.com> | 2011-08-04 14:47:43 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-08-04 14:47:43 -0700 |
commit | e3c56d16412882e2dac697fbe6fa9852ee4dee31 (patch) | |
tree | 59ecf59e6635c9820f9ce60b553034406251d644 /drm/libdrmframework/plugins/forward-lock/internal-format/converter/FwdLockConv.c | |
parent | 1de2393648b9fe43977ef88b72489fec05d629a9 (diff) | |
parent | 90855078eb989944bca1824058d7231cd68e5021 (diff) | |
download | frameworks_av-e3c56d16412882e2dac697fbe6fa9852ee4dee31.zip frameworks_av-e3c56d16412882e2dac697fbe6fa9852ee4dee31.tar.gz frameworks_av-e3c56d16412882e2dac697fbe6fa9852ee4dee31.tar.bz2 |
am 8a6fb50d: am 4e197ea8: am e15a73ee: Merge "Bug fixes in OMA DRM v1 Forward Lock Agent"
* commit '8a6fb50d69ec40a413b117bc9145a97ec427852f':
Bug fixes in OMA DRM v1 Forward Lock Agent
Diffstat (limited to 'drm/libdrmframework/plugins/forward-lock/internal-format/converter/FwdLockConv.c')
-rw-r--r-- | drm/libdrmframework/plugins/forward-lock/internal-format/converter/FwdLockConv.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/drm/libdrmframework/plugins/forward-lock/internal-format/converter/FwdLockConv.c b/drm/libdrmframework/plugins/forward-lock/internal-format/converter/FwdLockConv.c index 14ea9e9..299116d 100644 --- a/drm/libdrmframework/plugins/forward-lock/internal-format/converter/FwdLockConv.c +++ b/drm/libdrmframework/plugins/forward-lock/internal-format/converter/FwdLockConv.c @@ -275,17 +275,18 @@ static int FwdLockConv_DeriveKeys(FwdLockConv_Session_t *pSession) { } /** - * Checks whether a given character is valid in a boundary. Note that the boundary may contain - * leading and internal spaces. + * Checks whether a given character is valid in a boundary. Allows some non-standard characters that + * are invalid according to RFC 2046 but nevertheless used by one vendor's DRM packager. Note that + * the boundary may contain leading and internal spaces. * * @param[in] ch The character to check. * * @return A Boolean value indicating whether the given character is valid in a boundary. */ static int FwdLockConv_IsBoundaryChar(int ch) { - return isalnum(ch) || ch == '\'' || - ch == '(' || ch == ')' || ch == '+' || ch == '_' || ch == ',' || ch == '-' || - ch == '.' || ch == '/' || ch == ':' || ch == '=' || ch == '?' || ch == ' '; + return isalnum(ch) || ch == '\'' || ch == '(' || ch == ')' || ch == '+' || ch == '_' || + ch == ',' || ch == '-' || ch == '.' || ch == '/' || ch == ':' || ch == '=' || + ch == '?' || ch == ' ' || ch == '%' || ch == '[' || ch == '&' || ch == '*' || ch == '^'; } /** @@ -1085,6 +1086,13 @@ static FwdLockConv_Status_t FwdLockConv_PushChar(FwdLockConv_Session_t *pSession status = FwdLockConv_MatchBinaryEncodedData(pSession, ch, pOutput); break; case FwdLockConv_ParserState_WantsBase64EncodedData: + if (ch == '\n' && pSession->scannerState != FwdLockConv_ScannerState_WantsLF) { + // Repair base64-encoded data that doesn't have carriage returns in its line breaks. + status = FwdLockConv_MatchBase64EncodedData(pSession, '\r', pOutput); + if (status != FwdLockConv_Status_OK) { + break; + } + } status = FwdLockConv_MatchBase64EncodedData(pSession, ch, pOutput); break; case FwdLockConv_ParserState_Done: @@ -1199,7 +1207,7 @@ FwdLockConv_Status_t FwdLockConv_CloseSession(int sessionId, FwdLockConv_Output_ status = FwdLockConv_Status_SyntaxError; } else { // Finalize the data signature. - size_t signatureSize; + unsigned int signatureSize = SHA1_HASH_SIZE; HMAC_Final(&pSession->signingContext, pOutput->fromCloseSession.signatures, &signatureSize); if (signatureSize != SHA1_HASH_SIZE) { @@ -1214,9 +1222,9 @@ FwdLockConv_Status_t FwdLockConv_CloseSession(int sessionId, FwdLockConv_Output_ HMAC_Update(&pSession->signingContext, pSession->pEncryptedSessionKey, pSession->encryptedSessionKeyLength); HMAC_Update(&pSession->signingContext, pOutput->fromCloseSession.signatures, - signatureSize); - HMAC_Final(&pSession->signingContext, &pOutput->fromCloseSession. - signatures[signatureSize], &signatureSize); + SHA1_HASH_SIZE); + HMAC_Final(&pSession->signingContext, + &pOutput->fromCloseSession.signatures[SHA1_HASH_SIZE], &signatureSize); if (signatureSize != SHA1_HASH_SIZE) { status = FwdLockConv_Status_ProgramError; } else { |