PlatformECKey should use a std::unique_ptr
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Jan 2019 20:30:10 +0000 (20:30 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Jan 2019 20:30:10 +0000 (20:30 +0000)
commitda9714304a3861bf05172281ec8ecaf3d9e5d2b4
tree16b9b4072777001e3b65af5449fed83eef7c0690
parent9fb221ecd20a0bbe77fbc8ab0bfd2318be122368
PlatformECKey should use a std::unique_ptr
<https://webkit.org/b/193170>

Reviewed by Brent Fulgham.

Broadly:
- Switch from using raw pointers to using std::unique_ptr<> to
  hold PlatformECKey.
- Introduce PlatformECKeyContainer type to handle different
  std::unique_ptr<> types on each platform.
- Get rid of custom CryptoKeyEC destructors since the
  std::unique_ptr<> handles that with a Deleter.
- Initialize stack variables to nullptr.

* crypto/gcrypt/CryptoKeyECGCrypt.cpp:
(WebCore::CryptoKeyEC::keySizeInBits const):
(WebCore::CryptoKeyEC::platformGeneratePair):
(WebCore::CryptoKeyEC::platformImportRaw):
(WebCore::CryptoKeyEC::platformImportJWKPublic):
(WebCore::CryptoKeyEC::platformImportJWKPrivate):
(WebCore::CryptoKeyEC::platformImportSpki):
(WebCore::CryptoKeyEC::platformImportPkcs8):
(WebCore::CryptoKeyEC::platformExportRaw const):
(WebCore::CryptoKeyEC::platformAddFieldElements const):
(WebCore::CryptoKeyEC::platformExportSpki const):
(WebCore::CryptoKeyEC::platformExportPkcs8 const):
(WebCore::CryptoKeyEC::~CryptoKeyEC): Deleted.
* crypto/keys/CryptoKeyEC.cpp:
(WebCore::CryptoKeyEC::CryptoKeyEC):
* crypto/keys/CryptoKeyEC.h:
(WebCore::CCECCryptorRefDeleter::operator() const):
* crypto/mac/CryptoKeyECMac.cpp:
(WebCore::CryptoKeyEC::keySizeInBits const):
(WebCore::CryptoKeyEC::platformGeneratePair):
(WebCore::CryptoKeyEC::platformImportRaw):
(WebCore::CryptoKeyEC::platformExportRaw const):
(WebCore::CryptoKeyEC::platformImportJWKPublic):
(WebCore::CryptoKeyEC::platformImportJWKPrivate):
(WebCore::CryptoKeyEC::platformAddFieldElements const):
(WebCore::CryptoKeyEC::platformImportSpki):
(WebCore::CryptoKeyEC::platformExportSpki const):
(WebCore::CryptoKeyEC::platformImportPkcs8):
(WebCore::CryptoKeyEC::platformExportPkcs8 const):
(WebCore::CryptoKeyEC::~CryptoKeyEC): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239692 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/crypto/gcrypt/CryptoKeyECGCrypt.cpp
Source/WebCore/crypto/keys/CryptoKeyEC.cpp
Source/WebCore/crypto/keys/CryptoKeyEC.h
Source/WebCore/crypto/mac/CryptoKeyECMac.cpp