Title: [195483] trunk/Source/WebCore
- Revision
- 195483
- Author
- [email protected]
- Date
- 2016-01-22 14:50:41 -0800 (Fri, 22 Jan 2016)
Log Message
Don't ignore the return value of CCRandomCopyBytes
https://bugs.webkit.org/show_bug.cgi?id=153369
<rdar://problem/22198376>
<rdar://problem/22198378>
Reviewed by Alexey Proskuryakov.
Tested by existing Crypto tests.
* crypto/mac/CryptoKeyMac.cpp:
(WebCore::CryptoKey::randomData): RELEASE_ASSERT if CCRandomCopyBytes ever returns
anything besides kCCSuccess.
* crypto/mac/SerializedCryptoKeyWrapMac.mm:
(WebCore::createAndStoreMasterKey): Ditto.
(WebCore::wrapSerializedCryptoKey): Ditto.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (195482 => 195483)
--- trunk/Source/WebCore/ChangeLog 2016-01-22 22:43:38 UTC (rev 195482)
+++ trunk/Source/WebCore/ChangeLog 2016-01-22 22:50:41 UTC (rev 195483)
@@ -1,3 +1,21 @@
+2016-01-22 Brent Fulgham <[email protected]>
+
+ Don't ignore the return value of CCRandomCopyBytes
+ https://bugs.webkit.org/show_bug.cgi?id=153369
+ <rdar://problem/22198376>
+ <rdar://problem/22198378>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Tested by existing Crypto tests.
+
+ * crypto/mac/CryptoKeyMac.cpp:
+ (WebCore::CryptoKey::randomData): RELEASE_ASSERT if CCRandomCopyBytes ever returns
+ anything besides kCCSuccess.
+ * crypto/mac/SerializedCryptoKeyWrapMac.mm:
+ (WebCore::createAndStoreMasterKey): Ditto.
+ (WebCore::wrapSerializedCryptoKey): Ditto.
+
2016-01-21 Sam Weinig <[email protected]>
Treat non-https actions on secure pages as mixed content
Modified: trunk/Source/WebCore/crypto/mac/CryptoKeyMac.cpp (195482 => 195483)
--- trunk/Source/WebCore/crypto/mac/CryptoKeyMac.cpp 2016-01-22 22:43:38 UTC (rev 195482)
+++ trunk/Source/WebCore/crypto/mac/CryptoKeyMac.cpp 2016-01-22 22:50:41 UTC (rev 195483)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -35,7 +35,8 @@
Vector<uint8_t> CryptoKey::randomData(size_t size)
{
Vector<uint8_t> result(size);
- CCRandomCopyBytes(kCCRandomDefault, result.data(), result.size());
+ int rc = CCRandomCopyBytes(kCCRandomDefault, result.data(), result.size());
+ RELEASE_ASSERT(rc == kCCSuccess);
return result;
}
Modified: trunk/Source/WebCore/crypto/mac/SerializedCryptoKeyWrapMac.mm (195482 => 195483)
--- trunk/Source/WebCore/crypto/mac/SerializedCryptoKeyWrapMac.mm 2016-01-22 22:43:38 UTC (rev 195482)
+++ trunk/Source/WebCore/crypto/mac/SerializedCryptoKeyWrapMac.mm 2016-01-22 22:50:41 UTC (rev 195483)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014, 2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -72,7 +72,8 @@
static bool createAndStoreMasterKey(Vector<uint8_t>& masterKeyData)
{
masterKeyData.resize(masterKeySizeInBytes);
- CCRandomCopyBytes(kCCRandomDefault, masterKeyData.data(), masterKeyData.size());
+ int rc = CCRandomCopyBytes(kCCRandomDefault, masterKeyData.data(), masterKeyData.size());
+ RELEASE_ASSERT(rc == kCCSuccess);
#if PLATFORM(IOS)
NSBundle *mainBundle = [NSBundle mainBundle];
@@ -171,7 +172,8 @@
bool wrapSerializedCryptoKey(const Vector<uint8_t>& masterKey, const Vector<uint8_t>& key, Vector<uint8_t>& result)
{
Vector<uint8_t> kek(16);
- CCRandomCopyBytes(kCCRandomDefault, kek.data(), kek.size());
+ int rc = CCRandomCopyBytes(kCCRandomDefault, kek.data(), kek.size());
+ RELEASE_ASSERT(rc == kCCSuccess);
Vector<uint8_t> wrappedKEK(CCSymmetricWrappedSize(kCCWRAPAES, kek.size()));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes