Changeset 159390 in webkit


Ignore:
Timestamp:
Nov 17, 2013 1:41:46 PM (10 years ago)
Author:
ap@apple.com
Message:

Use uint8_t vectors for WebCrypto data
https://bugs.webkit.org/show_bug.cgi?id=124466

Reviewed by Sam Weinig.

Source/WebCore:

Using Vector<char> for crypto key data is somewhat non-idiomatic, and it gets simply
dangerous for bignums, because signed arithmetic is not appropriate for bignum digits.

  • Modules/websockets/WebSocketHandshake.cpp:

(WebCore::generateSecWebSocketKey):
(WebCore::WebSocketHandshake::getExpectedWebSocketAccept):
No longer need to cast data to char* here.

  • bindings/js/JSCryptoKeySerializationJWK.cpp:
  • bindings/js/JSCryptoKeySerializationJWK.h:
  • crypto/CryptoDigest.h:
  • crypto/CryptoKey.h:
  • crypto/keys/CryptoKeyAES.cpp:
  • crypto/keys/CryptoKeyAES.h:
  • crypto/keys/CryptoKeyDataOctetSequence.h:
  • crypto/keys/CryptoKeyDataRSAComponents.cpp:
  • crypto/keys/CryptoKeyDataRSAComponents.h:
  • crypto/keys/CryptoKeyHMAC.cpp:
  • crypto/keys/CryptoKeyHMAC.h:
  • crypto/keys/CryptoKeyRSA.h:
  • crypto/keys/CryptoKeySerializationRaw.cpp:
  • crypto/keys/CryptoKeySerializationRaw.h:
  • crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
  • crypto/mac/CryptoAlgorithmHMACMac.cpp:
  • crypto/mac/CryptoDigestMac.cpp:
  • crypto/mac/CryptoKeyMac.cpp:
  • crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h:

Switched to Vector<uint8_t>.

  • crypto/mac/CryptoKeyRSAMac.cpp:

(WebCore::getPublicKeyComponents): Extracted from buildAlgorithmDescription() and simplified.
(WebCore::CryptoKeyRSA::create): Switched to Vector<uint8_t>.
(WebCore::CryptoKeyRSA::buildAlgorithmDescription): No longer need to copy data just
to change type from Vector<char> to Vector<unsigned char>.
(WebCore::bigIntegerToUInt32): Ditto. No longer need to cast types when dealing with the bignum.
(WebCore::CryptoKeyRSA::generatePair): Improved an error message a little.

  • fileapi/FileReaderLoader.cpp: (WebCore::FileReaderLoader::convertToDataURL):
  • inspector/DOMPatchSupport.cpp: (WebCore::DOMPatchSupport::createDigest):
  • inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::archive):
  • platform/graphics/cg/ImageBufferCG.cpp: (WebCore::CGImageToDataURL):

No longer need to cast data to char* here.

Source/WTF:

Binary data can be UTF-8, in which case "char*" is idiomatic, or it can be arbitrary
binary data, in which case "uint8_t*" is more common.

Changed encode functions that took "const char *" to "const void*", and decode
functions that took "Vector<char>&" now take an adapter class.

The adapter relies on Vector<char> and Vector<uint8_t> classes having an identical layout.

  • wtf/text/Base64.cpp:

(WTF::base64Encode):
(WTF::base64URLEncode):
(WTF::base64DecodeInternal):
(WTF::base64Decode):
(WTF::base64URLDecode):

  • wtf/text/Base64.h:

(WTF::SignedOrUnsignedCharVectorAdapter):
(WTF::ConstSignedOrUnsignedCharVectorAdapter):
(WTF::base64Encode):
(WTF::base64URLEncode):

Location:
trunk/Source
Files:
32 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r159377 r159390  
     12013-11-16  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Use uint8_t vectors for WebCrypto data
     4        https://bugs.webkit.org/show_bug.cgi?id=124466
     5
     6        Reviewed by Sam Weinig.
     7
     8        Binary data can be UTF-8, in which case "char*" is idiomatic, or it can be arbitrary
     9        binary data, in which case "uint8_t*" is more common.
     10
     11        Changed encode functions that took "const char *" to "const void*", and decode
     12        functions that took "Vector<char>&" now take an adapter class.
     13
     14        The adapter relies on Vector<char> and Vector<uint8_t> classes having an identical layout.
     15
     16        * wtf/text/Base64.cpp:
     17        (WTF::base64Encode):
     18        (WTF::base64URLEncode):
     19        (WTF::base64DecodeInternal):
     20        (WTF::base64Decode):
     21        (WTF::base64URLDecode):
     22        * wtf/text/Base64.h:
     23        (WTF::SignedOrUnsignedCharVectorAdapter):
     24        (WTF::ConstSignedOrUnsignedCharVectorAdapter):
     25        (WTF::base64Encode):
     26        (WTF::base64URLEncode):
     27
    1282013-11-15  Alexey Proskuryakov  <ap@apple.com>
    229
  • trunk/Source/WTF/wtf/text/Base64.cpp

    r159377 r159390  
    158158}
    159159
    160 String base64Encode(const char* data, unsigned length, Base64EncodePolicy policy)
     160String base64Encode(const void* data, unsigned length, Base64EncodePolicy policy)
    161161{
    162162    Vector<char> result;
    163     base64EncodeInternal(data, length, result, policy, base64EncMap);
     163    base64EncodeInternal(static_cast<const char*>(data), length, result, policy, base64EncMap);
    164164    return String(result.data(), result.size());
    165165}
    166166
    167 void base64Encode(const char* data, unsigned len, Vector<char>& out, Base64EncodePolicy policy)
    168 {
    169     base64EncodeInternal(data, len, out, policy, base64EncMap);
    170 }
    171 
    172 String base64URLEncode(const char* data, unsigned length)
     167void base64Encode(const void* data, unsigned len, Vector<char>& out, Base64EncodePolicy policy)
     168{
     169    base64EncodeInternal(static_cast<const char*>(data), len, out, policy, base64EncMap);
     170}
     171
     172String base64URLEncode(const void* data, unsigned length)
    173173{
    174174    Vector<char> result;
    175     base64EncodeInternal(data, length, result, Base64URLPolicy, base64URLEncMap);
     175    base64EncodeInternal(static_cast<const char*>(data), length, result, Base64URLPolicy, base64URLEncMap);
    176176    return String(result.data(), result.size());
    177177}
    178178
    179 void base64URLEncode(const char* data, unsigned len, Vector<char>& out)
    180 {
    181     base64EncodeInternal(data, len, out, Base64URLPolicy, base64URLEncMap);
     179void base64URLEncode(const void* data, unsigned len, Vector<char>& out)
     180{
     181    base64EncodeInternal(static_cast<const char*>(data), len, out, Base64URLPolicy, base64URLEncMap);
    182182}
    183183
     
    202202                return false;
    203203        } else {
     204            ASSERT(static_cast<size_t>(ch) < 128);
    204205            char decodedCharacter = decodeMap[ch];
    205206            if (decodedCharacter != nonAlphabet) {
     
    249250}
    250251
    251 bool base64Decode(const String& in, Vector<char>& out, Base64DecodePolicy policy)
     252bool base64Decode(const String& in, SignedOrUnsignedCharVectorAdapter out, Base64DecodePolicy policy)
    252253{
    253254    return base64DecodeInternal<UChar>(in.characters(), in.length(), out, policy, base64DecMap);
    254255}
    255256
    256 bool base64Decode(const Vector<char>& in, Vector<char>& out, Base64DecodePolicy policy)
     257bool base64Decode(const Vector<char>& in, SignedOrUnsignedCharVectorAdapter out, Base64DecodePolicy policy)
    257258{
    258259    out.clear();
     
    265266}
    266267
    267 bool base64Decode(const char* data, unsigned len, Vector<char>& out, Base64DecodePolicy policy)
     268bool base64Decode(const char* data, unsigned len, SignedOrUnsignedCharVectorAdapter out, Base64DecodePolicy policy)
    268269{
    269270    return base64DecodeInternal<char>(data, len, out, policy, base64DecMap);
    270271}
    271272
    272 bool base64URLDecode(const String& in, Vector<char>& out)
     273bool base64URLDecode(const String& in, SignedOrUnsignedCharVectorAdapter out)
    273274{
    274275    return base64DecodeInternal<UChar>(in.characters(), in.length(), out, Base64FailOnInvalidCharacter, base64URLDecMap);
    275276}
    276277
    277 bool base64URLDecode(const Vector<char>& in, Vector<char>& out)
     278bool base64URLDecode(const Vector<char>& in, SignedOrUnsignedCharVectorAdapter out)
    278279{
    279280    out.clear();
     
    286287}
    287288
    288 bool base64URLDecode(const char* data, unsigned len, Vector<char>& out)
     289bool base64URLDecode(const char* data, unsigned len, SignedOrUnsignedCharVectorAdapter out)
    289290{
    290291    return base64DecodeInternal<char>(data, len, out, Base64FailOnInvalidCharacter, base64URLDecMap);
  • trunk/Source/WTF/wtf/text/Base64.h

    r159377 r159390  
    22 * Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
    33 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
     4 * Copyright (C) 2013 Apple Inc. All rights reserved.
    45 *
    56 * Redistribution and use in source and binary forms, with or without
     
    4748};
    4849
    49 WTF_EXPORT_PRIVATE void base64Encode(const char*, unsigned, Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs);
    50 WTF_EXPORT_PRIVATE void base64Encode(const Vector<char>&, Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs);
     50class SignedOrUnsignedCharVectorAdapter {
     51public:
     52    SignedOrUnsignedCharVectorAdapter(Vector<char>& vector) { m_vector.c = &vector; }
     53    SignedOrUnsignedCharVectorAdapter(Vector<uint8_t>& vector) { m_vector.u = &vector; }
     54
     55    operator Vector<char>&() { return *m_vector.c; }
     56    void clear() { m_vector.c->clear(); }
     57
     58private:
     59    union {
     60        Vector<char>* c;
     61        Vector<uint8_t>* u;
     62    } m_vector;
     63};
     64
     65class ConstSignedOrUnsignedCharVectorAdapter {
     66public:
     67    ConstSignedOrUnsignedCharVectorAdapter(const Vector<char>& vector) { m_vector.c = &vector; }
     68    ConstSignedOrUnsignedCharVectorAdapter(const Vector<uint8_t>& vector) { m_vector.u = &vector; }
     69
     70    operator const Vector<char>&() { return *m_vector.c; }
     71    const char* data() const { return m_vector.c->data(); }
     72    size_t size() const { return m_vector.c->size(); }
     73
     74private:
     75    union {
     76        const Vector<char>* c;
     77        const Vector<uint8_t>* u;
     78    } m_vector;
     79};
     80
     81WTF_EXPORT_PRIVATE void base64Encode(const void*, unsigned, Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs);
     82WTF_EXPORT_PRIVATE void base64Encode(ConstSignedOrUnsignedCharVectorAdapter, Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs);
    5183WTF_EXPORT_PRIVATE void base64Encode(const CString&, Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs);
    52 WTF_EXPORT_PRIVATE String base64Encode(const char*, unsigned, Base64EncodePolicy = Base64DoNotInsertLFs);
    53 WTF_EXPORT_PRIVATE String base64Encode(const Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs);
     84WTF_EXPORT_PRIVATE String base64Encode(const void*, unsigned, Base64EncodePolicy = Base64DoNotInsertLFs);
     85WTF_EXPORT_PRIVATE String base64Encode(ConstSignedOrUnsignedCharVectorAdapter, Base64EncodePolicy = Base64DoNotInsertLFs);
    5486WTF_EXPORT_PRIVATE String base64Encode(const CString&, Base64EncodePolicy = Base64DoNotInsertLFs);
    5587
    56 WTF_EXPORT_PRIVATE bool base64Decode(const String&, Vector<char>&, Base64DecodePolicy = Base64FailOnInvalidCharacter);
    57 WTF_EXPORT_PRIVATE bool base64Decode(const Vector<char>&, Vector<char>&, Base64DecodePolicy = Base64FailOnInvalidCharacter);
    58 WTF_EXPORT_PRIVATE bool base64Decode(const char*, unsigned, Vector<char>&, Base64DecodePolicy = Base64FailOnInvalidCharacter);
     88WTF_EXPORT_PRIVATE bool base64Decode(const String&, SignedOrUnsignedCharVectorAdapter, Base64DecodePolicy = Base64FailOnInvalidCharacter);
     89WTF_EXPORT_PRIVATE bool base64Decode(const Vector<char>&, SignedOrUnsignedCharVectorAdapter, Base64DecodePolicy = Base64FailOnInvalidCharacter);
     90WTF_EXPORT_PRIVATE bool base64Decode(const char*, unsigned, SignedOrUnsignedCharVectorAdapter, Base64DecodePolicy = Base64FailOnInvalidCharacter);
    5991
    60 inline void base64Encode(const Vector<char>& in, Vector<char>& out, Base64EncodePolicy policy)
     92inline void base64Encode(ConstSignedOrUnsignedCharVectorAdapter in, Vector<char>& out, Base64EncodePolicy policy)
    6193{
    6294    base64Encode(in.data(), in.size(), out, policy);
     
    68100}
    69101
    70 inline String base64Encode(const Vector<char>& in, Base64EncodePolicy policy)
     102inline String base64Encode(ConstSignedOrUnsignedCharVectorAdapter in, Base64EncodePolicy policy)
    71103{
    72104    return base64Encode(in.data(), in.size(), policy);
     
    83115// ======================================================================================
    84116
    85 WTF_EXPORT_PRIVATE void base64URLEncode(const char*, unsigned, Vector<char>&);
    86 WTF_EXPORT_PRIVATE void base64URLEncode(const Vector<char>&, Vector<char>&);
     117WTF_EXPORT_PRIVATE void base64URLEncode(const void*, unsigned, Vector<char>&);
     118WTF_EXPORT_PRIVATE void base64URLEncode(ConstSignedOrUnsignedCharVectorAdapter, Vector<char>&);
    87119WTF_EXPORT_PRIVATE void base64URLEncode(const CString&, Vector<char>&);
    88 WTF_EXPORT_PRIVATE String base64URLEncode(const char*, unsigned);
    89 WTF_EXPORT_PRIVATE String base64URLEncode(const Vector<char>&);
     120WTF_EXPORT_PRIVATE String base64URLEncode(const void*, unsigned);
     121WTF_EXPORT_PRIVATE String base64URLEncode(ConstSignedOrUnsignedCharVectorAdapter);
    90122WTF_EXPORT_PRIVATE String base64URLEncode(const CString&);
    91123
    92 WTF_EXPORT_PRIVATE bool base64URLDecode(const String&, Vector<char>&);
    93 WTF_EXPORT_PRIVATE bool base64URLDecode(const Vector<char>&, Vector<char>&);
    94 WTF_EXPORT_PRIVATE bool base64URLDecode(const char*, unsigned, Vector<char>&);
     124WTF_EXPORT_PRIVATE bool base64URLDecode(const String&, SignedOrUnsignedCharVectorAdapter);
     125WTF_EXPORT_PRIVATE bool base64URLDecode(const Vector<char>&, SignedOrUnsignedCharVectorAdapter);
     126WTF_EXPORT_PRIVATE bool base64URLDecode(const char*, unsigned, SignedOrUnsignedCharVectorAdapter);
    95127
    96 inline void base64URLEncode(const Vector<char>& in, Vector<char>& out)
     128inline void base64URLEncode(ConstSignedOrUnsignedCharVectorAdapter in, Vector<char>& out)
    97129{
    98130    base64URLEncode(in.data(), in.size(), out);
     
    104136}
    105137
    106 inline String base64URLEncode(const Vector<char>& in)
     138inline String base64URLEncode(ConstSignedOrUnsignedCharVectorAdapter in)
    107139{
    108140    return base64URLEncode(in.data(), in.size());
  • trunk/Source/WebCore/ChangeLog

    r159389 r159390  
     12013-11-16  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Use uint8_t vectors for WebCrypto data
     4        https://bugs.webkit.org/show_bug.cgi?id=124466
     5
     6        Reviewed by Sam Weinig.
     7
     8        Using Vector<char> for crypto key data is somewhat non-idiomatic, and it gets simply
     9        dangerous for bignums, because signed arithmetic is not appropriate for bignum digits.
     10
     11        * Modules/websockets/WebSocketHandshake.cpp:
     12        (WebCore::generateSecWebSocketKey):
     13        (WebCore::WebSocketHandshake::getExpectedWebSocketAccept):
     14        No longer need to cast data to char* here.
     15
     16        * bindings/js/JSCryptoKeySerializationJWK.cpp:
     17        * bindings/js/JSCryptoKeySerializationJWK.h:
     18        * crypto/CryptoDigest.h:
     19        * crypto/CryptoKey.h:
     20        * crypto/keys/CryptoKeyAES.cpp:
     21        * crypto/keys/CryptoKeyAES.h:
     22        * crypto/keys/CryptoKeyDataOctetSequence.h:
     23        * crypto/keys/CryptoKeyDataRSAComponents.cpp:
     24        * crypto/keys/CryptoKeyDataRSAComponents.h:
     25        * crypto/keys/CryptoKeyHMAC.cpp:
     26        * crypto/keys/CryptoKeyHMAC.h:
     27        * crypto/keys/CryptoKeyRSA.h:
     28        * crypto/keys/CryptoKeySerializationRaw.cpp:
     29        * crypto/keys/CryptoKeySerializationRaw.h:
     30        * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
     31        * crypto/mac/CryptoAlgorithmHMACMac.cpp:
     32        * crypto/mac/CryptoDigestMac.cpp:
     33        * crypto/mac/CryptoKeyMac.cpp:
     34        * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h:
     35        Switched to Vector<uint8_t>.
     36
     37        * crypto/mac/CryptoKeyRSAMac.cpp:
     38        (WebCore::getPublicKeyComponents): Extracted from buildAlgorithmDescription() and simplified.
     39        (WebCore::CryptoKeyRSA::create): Switched to Vector<uint8_t>.
     40        (WebCore::CryptoKeyRSA::buildAlgorithmDescription): No longer need to copy data just
     41        to change type from Vector<char> to Vector<unsigned char>.
     42        (WebCore::bigIntegerToUInt32): Ditto. No longer need to cast types when dealing with the bignum.
     43        (WebCore::CryptoKeyRSA::generatePair): Improved an error message a little.
     44
     45        * fileapi/FileReaderLoader.cpp: (WebCore::FileReaderLoader::convertToDataURL):
     46        * inspector/DOMPatchSupport.cpp: (WebCore::DOMPatchSupport::createDigest):
     47        * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::archive):
     48        * platform/graphics/cg/ImageBufferCG.cpp: (WebCore::CGImageToDataURL):
     49        No longer need to cast data to char* here.
     50
    1512013-11-17  Antti Koivisto  <antti@apple.com>
    252
  • trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp

    r156600 r159390  
    104104    unsigned char key[nonceSize];
    105105    cryptographicallyRandomValues(key, nonceSize);
    106     return base64Encode(reinterpret_cast<char*>(key), nonceSize);
     106    return base64Encode(key, nonceSize);
    107107}
    108108
     
    117117    Vector<uint8_t, sha1HashSize> hash;
    118118    sha1.computeHash(hash);
    119     return base64Encode(reinterpret_cast<const char*>(hash.data()), sha1HashSize);
     119    return base64Encode(hash.data(), sha1HashSize);
    120120}
    121121
  • trunk/Source/WebCore/bindings/js/JSCryptoKeySerializationJWK.cpp

    r159377 r159390  
    110110}
    111111
    112 static bool getBigIntegerVectorFromJSON(ExecState* exec, JSObject* json, const char* key, Vector<char>& result)
     112static bool getBigIntegerVectorFromJSON(ExecState* exec, JSObject* json, const char* key, Vector<uint8_t>& result)
    113113{
    114114    String base64urlEncodedNumber;
     
    290290    }
    291291
    292     Vector<char> octetSequence;
     292    Vector<uint8_t> octetSequence;
    293293    if (!base64URLDecode(keyBase64URL, octetSequence)) {
    294294        throwTypeError(m_exec, "Cannot decode base64url key data in JWK");
     
    306306std::unique_ptr<CryptoKeyData> JSCryptoKeySerializationJWK::keyDataRSAComponents() const
    307307{
    308     Vector<char> modulus;
    309     Vector<char> exponent;
    310     Vector<char> privateExponent;
     308    Vector<uint8_t> modulus;
     309    Vector<uint8_t> exponent;
     310    Vector<uint8_t> privateExponent;
    311311
    312312    if (!getBigIntegerVectorFromJSON(m_exec, m_json.get(), "n", modulus)) {
     
    417417}
    418418
    419 void JSCryptoKeySerializationJWK::buildJSONForOctetSequence(ExecState* exec, const Vector<char>& keyData, JSObject* result)
     419void JSCryptoKeySerializationJWK::buildJSONForOctetSequence(ExecState* exec, const Vector<uint8_t>& keyData, JSObject* result)
    420420{
    421421    addToJSON(exec, result, "kty", "oct");
  • trunk/Source/WebCore/bindings/js/JSCryptoKeySerializationJWK.h

    r159377 r159390  
    6666    virtual std::unique_ptr<CryptoKeyData> keyData() const OVERRIDE;
    6767
    68     static void buildJSONForOctetSequence(JSC::ExecState*, const Vector<char>&, JSC::JSObject* result);
     68    static void buildJSONForOctetSequence(JSC::ExecState*, const Vector<uint8_t>&, JSC::JSObject* result);
    6969    static void addJWKAlgorithmToJSON(JSC::ExecState*, JSC::JSObject*, const CryptoKey& key);
    7070    static void addJWKUseToJSON(JSC::ExecState*, JSC::JSObject*, CryptoKeyUsage);
  • trunk/Source/WebCore/crypto/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp

    r159379 r159390  
    114114    digest->addBytes(data.first, data.second);
    115115
    116     Vector<unsigned char> digestData = digest->computeHash();
     116    Vector<uint8_t> digestData = digest->computeHash();
    117117
    118     Vector<unsigned char> signature(512);
     118    Vector<uint8_t> signature(512);
    119119    size_t signatureSize = signature.size();
    120120
     
    153153    digest->addBytes(data.first, data.second);
    154154
    155     Vector<unsigned char> digestData = digest->computeHash();
     155    Vector<uint8_t> digestData = digest->computeHash();
    156156
    157157    CCCryptorStatus status = CCRSACryptorVerify(rsaKey.platformKey(), ccPKCS1Padding, digestData.data(), digestData.size(), digestAlgorithm, 0, signature.first, signature.second);
  • trunk/Source/WebCore/crypto/CryptoDigest.h

    r159292 r159390  
    4444
    4545    void addBytes(const void* input, size_t length);
    46     Vector<unsigned char> computeHash();
     46    Vector<uint8_t> computeHash();
    4747
    4848private:
  • trunk/Source/WebCore/crypto/CryptoKey.cpp

    r158582 r159390  
    9090
    9191#if !PLATFORM(MAC)
    92 Vector<char> CryptoKey::randomData(size_t size)
     92Vector<uint8_t> CryptoKey::randomData(size_t size)
    9393{
    94     Vector<char> result(size);
     94    Vector<uint8_t> result(size);
    9595    cryptographicallyRandomValues(result.data(), result.size());
    9696    return result;
  • trunk/Source/WebCore/crypto/CryptoKey.h

    r159377 r159390  
    6565    virtual std::unique_ptr<CryptoKeyData> exportData() const = 0;
    6666
    67     static Vector<char> randomData(size_t);
     67    static Vector<uint8_t> randomData(size_t);
    6868
    6969private:
  • trunk/Source/WebCore/crypto/keys/CryptoKeyAES.cpp

    r159310 r159390  
    3636namespace WebCore {
    3737
    38 CryptoKeyAES::CryptoKeyAES(CryptoAlgorithmIdentifier algorithm, const Vector<char>& key, bool extractable, CryptoKeyUsage usage)
     38CryptoKeyAES::CryptoKeyAES(CryptoAlgorithmIdentifier algorithm, const Vector<uint8_t>& key, bool extractable, CryptoKeyUsage usage)
    3939    : CryptoKey(algorithm, CryptoKeyType::Secret, extractable, usage)
    4040    , m_key(key)
  • trunk/Source/WebCore/crypto/keys/CryptoKeyAES.h

    r159310 r159390  
    3737class CryptoKeyAES FINAL : public CryptoKey {
    3838public:
    39     static PassRefPtr<CryptoKeyAES> create(CryptoAlgorithmIdentifier algorithm, const Vector<char>& key, bool extractable, CryptoKeyUsage usage)
     39    static PassRefPtr<CryptoKeyAES> create(CryptoAlgorithmIdentifier algorithm, const Vector<uint8_t>& key, bool extractable, CryptoKeyUsage usage)
    4040    {
    4141        return adoptRef(new CryptoKeyAES(algorithm, key, extractable, usage));
     
    4747    virtual CryptoKeyClass keyClass() const OVERRIDE { return CryptoKeyClass::AES; }
    4848
    49     const Vector<char>& key() const { return m_key; }
     49    const Vector<uint8_t>& key() const { return m_key; }
    5050
    5151private:
    52     CryptoKeyAES(CryptoAlgorithmIdentifier, const Vector<char>& key, bool extractable, CryptoKeyUsage);
     52    CryptoKeyAES(CryptoAlgorithmIdentifier, const Vector<uint8_t>& key, bool extractable, CryptoKeyUsage);
    5353
    5454    virtual void buildAlgorithmDescription(CryptoAlgorithmDescriptionBuilder&) const OVERRIDE;
    5555    virtual std::unique_ptr<CryptoKeyData> exportData() const OVERRIDE;
    5656
    57     Vector<char> m_key;
     57    Vector<uint8_t> m_key;
    5858};
    5959
  • trunk/Source/WebCore/crypto/keys/CryptoKeyDataOctetSequence.cpp

    r158943 r159390  
    3131namespace WebCore {
    3232
    33 CryptoKeyDataOctetSequence::CryptoKeyDataOctetSequence(const Vector<char>& data)
     33CryptoKeyDataOctetSequence::CryptoKeyDataOctetSequence(const Vector<uint8_t>& data)
    3434    : CryptoKeyData(CryptoKeyData::Format::OctetSequence)
    3535    , m_keyData(data)
  • trunk/Source/WebCore/crypto/keys/CryptoKeyDataOctetSequence.h

    r159213 r159390  
    3636class CryptoKeyDataOctetSequence FINAL : public CryptoKeyData {
    3737public:
    38     static std::unique_ptr<CryptoKeyDataOctetSequence> create(const Vector<char>& keyData)
     38    static std::unique_ptr<CryptoKeyDataOctetSequence> create(const Vector<uint8_t>& keyData)
    3939    {
    4040        return std::unique_ptr<CryptoKeyDataOctetSequence>(new CryptoKeyDataOctetSequence(keyData));
     
    4242    virtual ~CryptoKeyDataOctetSequence();
    4343
    44     const Vector<char>& octetSequence() const { return m_keyData; }
     44    const Vector<uint8_t>& octetSequence() const { return m_keyData; }
    4545
    4646private:
    47     CryptoKeyDataOctetSequence(const Vector<char>&);
     47    CryptoKeyDataOctetSequence(const Vector<uint8_t>&);
    4848
    49     Vector<char> m_keyData;
     49    Vector<uint8_t> m_keyData;
    5050};
    5151
  • trunk/Source/WebCore/crypto/keys/CryptoKeyDataRSAComponents.cpp

    r159180 r159390  
    3131namespace WebCore {
    3232
    33 CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents(const Vector<char>& modulus, const Vector<char>& exponent)
     33CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents(const Vector<uint8_t>& modulus, const Vector<uint8_t>& exponent)
    3434    : CryptoKeyData(CryptoKeyData::Format::RSAComponents)
    3535    , m_type(Type::Public)
     
    3939}
    4040
    41 CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents(const Vector<char>& modulus, const Vector<char>& exponent, const Vector<char>& privateExponent)
     41CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents(const Vector<uint8_t>& modulus, const Vector<uint8_t>& exponent, const Vector<uint8_t>& privateExponent)
    4242    : CryptoKeyData(CryptoKeyData::Format::RSAComponents)
    4343    , m_type(Type::Private)
     
    4949}
    5050
    51 CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents(const Vector<char>& modulus, const Vector<char>& exponent, const Vector<char>& privateExponent, const PrimeInfo& firstPrimeInfo, const PrimeInfo& secondPrimeInfo, const Vector<PrimeInfo>& otherPrimeInfos)
     51CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents(const Vector<uint8_t>& modulus, const Vector<uint8_t>& exponent, const Vector<uint8_t>& privateExponent, const PrimeInfo& firstPrimeInfo, const PrimeInfo& secondPrimeInfo, const Vector<PrimeInfo>& otherPrimeInfos)
    5252    : CryptoKeyData(CryptoKeyData::Format::RSAComponents)
    5353    , m_type(Type::Private)
  • trunk/Source/WebCore/crypto/keys/CryptoKeyDataRSAComponents.h

    r159213 r159390  
    4242
    4343    struct PrimeInfo {
    44         Vector<char> primeFactor;
    45         Vector<char> factorCRTExponent;
    46         Vector<char> factorCRTCoefficient;
     44        Vector<uint8_t> primeFactor;
     45        Vector<uint8_t> factorCRTExponent;
     46        Vector<uint8_t> factorCRTCoefficient;
    4747    };
    4848
    49     static std::unique_ptr<CryptoKeyDataRSAComponents> createPublic(const Vector<char>& modulus, const Vector<char>& exponent)
     49    static std::unique_ptr<CryptoKeyDataRSAComponents> createPublic(const Vector<uint8_t>& modulus, const Vector<uint8_t>& exponent)
    5050    {
    5151        return std::unique_ptr<CryptoKeyDataRSAComponents>(new CryptoKeyDataRSAComponents(modulus, exponent));
    5252    }
    5353
    54     static std::unique_ptr<CryptoKeyDataRSAComponents> createPrivate(const Vector<char>& modulus, const Vector<char>& exponent, const Vector<char>& privateExponent)
     54    static std::unique_ptr<CryptoKeyDataRSAComponents> createPrivate(const Vector<uint8_t>& modulus, const Vector<uint8_t>& exponent, const Vector<uint8_t>& privateExponent)
    5555    {
    5656        return std::unique_ptr<CryptoKeyDataRSAComponents>(new CryptoKeyDataRSAComponents(modulus, exponent, privateExponent));
    5757    }
    5858
    59     static std::unique_ptr<CryptoKeyDataRSAComponents> createPrivateWithAdditionalData(const Vector<char>& modulus, const Vector<char>& exponent, const Vector<char>& privateExponent, const PrimeInfo& firstPrimeInfo, const PrimeInfo& secondPrimeInfo, const Vector<PrimeInfo>& otherPrimeInfos)
     59    static std::unique_ptr<CryptoKeyDataRSAComponents> createPrivateWithAdditionalData(const Vector<uint8_t>& modulus, const Vector<uint8_t>& exponent, const Vector<uint8_t>& privateExponent, const PrimeInfo& firstPrimeInfo, const PrimeInfo& secondPrimeInfo, const Vector<PrimeInfo>& otherPrimeInfos)
    6060    {
    6161        return std::unique_ptr<CryptoKeyDataRSAComponents>(new CryptoKeyDataRSAComponents(modulus, exponent, privateExponent, firstPrimeInfo, secondPrimeInfo, otherPrimeInfos));
     
    6767
    6868    // Private and public keys.
    69     const Vector<char>& modulus() const { return m_modulus; }
    70     const Vector<char>& exponent() const { return m_exponent; }
     69    const Vector<uint8_t>& modulus() const { return m_modulus; }
     70    const Vector<uint8_t>& exponent() const { return m_exponent; }
    7171
    7272    // Only private keys.
    73     const Vector<char>& privateExponent() const { return m_privateExponent; }
     73    const Vector<uint8_t>& privateExponent() const { return m_privateExponent; }
    7474    bool hasAdditionalPrivateKeyParameters() const { return m_hasAdditionalPrivateKeyParameters; }
    7575    const PrimeInfo& firstPrimeInfo() const { return m_firstPrimeInfo; }
     
    7878
    7979private:
    80     CryptoKeyDataRSAComponents(const Vector<char>& modulus, const Vector<char>& exponent);
    81     CryptoKeyDataRSAComponents(const Vector<char>& modulus, const Vector<char>& exponent, const Vector<char>& privateExponent);
    82     CryptoKeyDataRSAComponents(const Vector<char>& modulus, const Vector<char>& exponent, const Vector<char>& privateExponent, const PrimeInfo& firstPrimeInfo, const PrimeInfo& secondPrimeInfo, const Vector<PrimeInfo>& otherPrimeInfos);
     80    CryptoKeyDataRSAComponents(const Vector<uint8_t>& modulus, const Vector<uint8_t>& exponent);
     81    CryptoKeyDataRSAComponents(const Vector<uint8_t>& modulus, const Vector<uint8_t>& exponent, const Vector<uint8_t>& privateExponent);
     82    CryptoKeyDataRSAComponents(const Vector<uint8_t>& modulus, const Vector<uint8_t>& exponent, const Vector<uint8_t>& privateExponent, const PrimeInfo& firstPrimeInfo, const PrimeInfo& secondPrimeInfo, const Vector<PrimeInfo>& otherPrimeInfos);
    8383
    8484    Type m_type;
    8585
    8686    // Private and public keys.
    87     Vector<char> m_modulus;
    88     Vector<char> m_exponent;
     87    Vector<uint8_t> m_modulus;
     88    Vector<uint8_t> m_exponent;
    8989
    9090    // Only private keys.
    91     Vector<char> m_privateExponent;
     91    Vector<uint8_t> m_privateExponent;
    9292    bool m_hasAdditionalPrivateKeyParameters;
    9393    PrimeInfo m_firstPrimeInfo;
  • trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp

    r159310 r159390  
    3636namespace WebCore {
    3737
    38 CryptoKeyHMAC::CryptoKeyHMAC(const Vector<char>& key, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsage usage)
     38CryptoKeyHMAC::CryptoKeyHMAC(const Vector<uint8_t>& key, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsage usage)
    3939    : CryptoKey(CryptoAlgorithmIdentifier::HMAC, CryptoKeyType::Secret, extractable, usage)
    4040    , m_hash(hash)
  • trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.h

    r159377 r159390  
    3636class CryptoKeyHMAC FINAL : public CryptoKey {
    3737public:
    38     static PassRefPtr<CryptoKeyHMAC> create(const Vector<char>& key, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsage usage)
     38    static PassRefPtr<CryptoKeyHMAC> create(const Vector<uint8_t>& key, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsage usage)
    3939    {
    4040        return adoptRef(new CryptoKeyHMAC(key, hash, extractable, usage));
     
    4747    virtual CryptoKeyClass keyClass() const OVERRIDE { return CryptoKeyClass::HMAC; }
    4848
    49     const Vector<char>& key() const { return m_key; }
     49    const Vector<uint8_t>& key() const { return m_key; }
    5050
    5151    CryptoAlgorithmIdentifier hashAlgorithmIdentifier() const { return m_hash; }
    5252
    5353private:
    54     CryptoKeyHMAC(const Vector<char>& key, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsage);
     54    CryptoKeyHMAC(const Vector<uint8_t>& key, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsage);
    5555
    5656    virtual void buildAlgorithmDescription(CryptoAlgorithmDescriptionBuilder&) const OVERRIDE;
     
    5858
    5959    CryptoAlgorithmIdentifier m_hash;
    60     Vector<char> m_key;
     60    Vector<uint8_t> m_key;
    6161};
    6262
  • trunk/Source/WebCore/crypto/keys/CryptoKeyRSA.h

    r159310 r159390  
    5353    void restrictToHash(CryptoAlgorithmIdentifier);
    5454
    55     static void generatePair(CryptoAlgorithmIdentifier, unsigned modulusLength, const Vector<char>& publicExponent, bool extractable, CryptoKeyUsage, std::unique_ptr<PromiseWrapper>);
     55    static void generatePair(CryptoAlgorithmIdentifier, unsigned modulusLength, const Vector<uint8_t>& publicExponent, bool extractable, CryptoKeyUsage, std::unique_ptr<PromiseWrapper>);
    5656
    5757    virtual CryptoKeyClass keyClass() const OVERRIDE { return CryptoKeyClass::RSA; }
  • trunk/Source/WebCore/crypto/keys/CryptoKeySerializationRaw.cpp

    r159377 r159390  
    6262}
    6363
    64 bool CryptoKeySerializationRaw::serialize(const CryptoKey& key, Vector<unsigned char>& result)
     64bool CryptoKeySerializationRaw::serialize(const CryptoKey& key, Vector<uint8_t>& result)
    6565{
    6666    std::unique_ptr<CryptoKeyData> keyData = key.exportData();
  • trunk/Source/WebCore/crypto/keys/CryptoKeySerializationRaw.h

    r159377 r159390  
    4747    virtual ~CryptoKeySerializationRaw();
    4848
    49     static bool serialize(const CryptoKey&, Vector<unsigned char>&);
     49    static bool serialize(const CryptoKey&, Vector<uint8_t>&);
    5050
    5151private:
     
    5959    virtual std::unique_ptr<CryptoKeyData> keyData() const OVERRIDE;
    6060
    61     Vector<char> m_data;
     61    Vector<uint8_t> m_data;
    6262};
    6363
  • trunk/Source/WebCore/crypto/mac/CryptoAlgorithmAES_CBCMac.cpp

    r159379 r159390  
    5959    }
    6060
    61     Vector<unsigned char> result(CCCryptorGetOutputLength(cryptor, data.second, true));
     61    Vector<uint8_t> result(CCCryptorGetOutputLength(cryptor, data.second, true));
    6262
    6363    size_t bytesWritten;
     
    6868    }
    6969
    70     unsigned char* p = result.data() + bytesWritten;
     70    uint8_t* p = result.data() + bytesWritten;
    7171    status = CCCryptorFinal(cryptor, p, result.end() - p, &bytesWritten);
    7272    p += bytesWritten;
  • trunk/Source/WebCore/crypto/mac/CryptoAlgorithmHMACMac.cpp

    r159380 r159390  
    6060}
    6161
    62 static Vector<unsigned char> calculateSignature(CCHmacAlgorithm algorithm, const Vector<char>& key, const CryptoOperationData& data)
     62static Vector<uint8_t> calculateSignature(CCHmacAlgorithm algorithm, const Vector<uint8_t>& key, const CryptoOperationData& data)
    6363{
    6464    size_t digestLength;
     
    8181    default:
    8282        ASSERT_NOT_REACHED();
    83         return Vector<unsigned char>();
     83        return Vector<uint8_t>();
    8484    }
    8585
    86     Vector<unsigned char> result(digestLength);
    87     const char* keyData = key.data() ? key.data() : ""; // <rdar://problem/15467425> HMAC crashes when key pointer is null.
     86    Vector<uint8_t> result(digestLength);
     87    const void* keyData = key.data() ? key.data() : reinterpret_cast<const uint8_t*>(""); // <rdar://problem/15467425> HMAC crashes when key pointer is null.
    8888    CCHmac(algorithm, keyData, key.size(), data.first, data.second, result.data());
    8989    return result;
     
    106106    }
    107107
    108     Vector<unsigned char> signature = calculateSignature(algorithm, hmacKey.key(), data);
     108    Vector<uint8_t> signature = calculateSignature(algorithm, hmacKey.key(), data);
    109109
    110110    promise->fulfill(signature);
     
    127127    }
    128128
    129     Vector<unsigned char> signature = calculateSignature(algorithm, hmacKey.key(), data);
     129    Vector<uint8_t> signature = calculateSignature(algorithm, hmacKey.key(), data);
    130130
    131131    bool result = signature.size() == expectedSignature.second && !memcmp(signature.data(), expectedSignature.first, signature.size());
  • trunk/Source/WebCore/crypto/mac/CryptoDigestMac.cpp

    r159292 r159390  
    157157}
    158158
    159 Vector<unsigned char> CryptoDigest::computeHash()
     159Vector<uint8_t> CryptoDigest::computeHash()
    160160{
    161     Vector<unsigned char> result;
     161    Vector<uint8_t> result;
    162162    switch (m_context->algorithm) {
    163163    case CryptoAlgorithmIdentifier::SHA_1:
  • trunk/Source/WebCore/crypto/mac/CryptoKeyMac.cpp

    r158945 r159390  
    4141namespace WebCore {
    4242
    43 Vector<char> CryptoKey::randomData(size_t size)
     43Vector<uint8_t> CryptoKey::randomData(size_t size)
    4444{
    45     Vector<char> result(size);
     45    Vector<uint8_t> result(size);
    4646    CCRandomCopyBytes(kCCRandomDefault, result.data(), result.size());
    4747    return result;
  • trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp

    r159310 r159390  
    5959namespace WebCore {
    6060
     61static CCCryptorStatus getPublicKeyComponents(CCRSACryptorRef rsaKey, Vector<uint8_t>& modulus, Vector<uint8_t>& publicExponent)
     62{
     63    ASSERT(CCRSAGetKeyType(rsaKey) == ccRSAKeyPublic);
     64
     65    modulus.resize(16384);
     66    size_t modulusLength = modulus.size();
     67    publicExponent.resize(16384);
     68    size_t exponentLength = publicExponent.size();
     69    CCCryptorStatus status = CCRSAGetKeyComponents(rsaKey, modulus.data(), &modulusLength, publicExponent.data(), &exponentLength, 0, 0, 0, 0);
     70    if (status)
     71        return status;
     72
     73    modulus.shrink(modulusLength);
     74    publicExponent.shrink(exponentLength);
     75    return status;
     76}
     77
    6178CryptoKeyRSA::CryptoKeyRSA(CryptoAlgorithmIdentifier identifier, CryptoKeyType type, PlatformRSAKey platformKey, bool extractable, CryptoKeyUsage usage)
    6279    : CryptoKey(identifier, type, extractable, usage)
     
    6986{
    7087    if (keyData.type() == CryptoKeyDataRSAComponents::Type::Private && !keyData.hasAdditionalPrivateKeyParameters()) {
     88        // <rdar://problem/15452324> tracks adding support.
    7189        WTFLogAlways("Private keys without additional data are not supported");
    7290        return nullptr;
     
    113131    CCRSACryptorRef publicKey = platformKeyIsPublic ? m_platformKey : CCRSACryptorGetPublicKeyFromPrivateKey(m_platformKey);
    114132
    115     uint8_t modulus[16384];
    116     size_t modulusLength = sizeof(modulus);
    117     uint8_t publicExponent[16384];
    118     size_t exponentLength = sizeof(16384);
    119     uint8_t p[16384];
    120     size_t pLength = sizeof(p);
    121     uint8_t q[16384];
    122     size_t qLength = sizeof(q);
    123     CCCryptorStatus status = CCRSAGetKeyComponents(publicKey, modulus, &modulusLength, publicExponent, &exponentLength, p, &pLength, q, &qLength);
     133    Vector<uint8_t> modulus;
     134    Vector<uint8_t> publicExponent;
     135    CCCryptorStatus status = getPublicKeyComponents(publicKey, modulus, publicExponent);
    124136    if (!platformKeyIsPublic) {
    125137        // CCRSACryptorGetPublicKeyFromPrivateKey has "Get" in the name, but its result needs to be released (see <rdar://problem/15449697>).
     
    131143    }
    132144
    133     builder.add("modulusLength", modulusLength * 8);
    134 
    135     Vector<unsigned char> publicExponentVector;
    136     publicExponentVector.append(publicExponent, exponentLength);
    137     builder.add("publicExponent", publicExponentVector);
     145    builder.add("modulusLength", modulus.size() * 8);
     146    builder.add("publicExponent", publicExponent);
    138147
    139148    if (m_restrictedToSpecificHash) {
     
    151160}
    152161
    153 static bool bigIntegerToUInt32(const Vector<char>& bigInteger, uint32_t& result)
     162static bool bigIntegerToUInt32(const Vector<uint8_t>& bigInteger, uint32_t& result)
    154163{
    155164    result = 0;
     
    161170    for (size_t i = bigInteger.size() > 4 ? bigInteger.size() - 4 : 0; i < bigInteger.size(); ++i) {
    162171        result <<= 8;
    163         result += static_cast<unsigned char>(bigInteger[i]);
     172        result += bigInteger[i];
    164173    }
    165174    return true;
    166175}
    167176
    168 void CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier algorithm, unsigned modulusLength, const Vector<char>& publicExponent, bool extractable, CryptoKeyUsage usage, std::unique_ptr<PromiseWrapper> promise)
     177void CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier algorithm, unsigned modulusLength, const Vector<uint8_t>& publicExponent, bool extractable, CryptoKeyUsage usage, std::unique_ptr<PromiseWrapper> promise)
    169178{
    170179    uint32_t e;
    171180    if (!bigIntegerToUInt32(publicExponent, e)) {
    172181        // Adding support is tracked as <rdar://problem/15444034>.
    173         WTFLogAlways("Public exponent is too big, not supported by CommonCrypto");
     182        WTFLogAlways("Public exponent is too big, not supported");
    174183        promise->reject(nullptr);
    175184        return;
  • trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h

    r159379 r159390  
    3939    unsigned modulusLength;
    4040    // The RSA public exponent, encoded as BigInteger.
    41     Vector<char> publicExponent;
     41    Vector<uint8_t> publicExponent;
    4242
    4343    virtual Class parametersClass() const OVERRIDE { return Class::RsaKeyGenParams; }
  • trunk/Source/WebCore/fileapi/FileReaderLoader.cpp

    r158956 r159390  
    342342
    343343    Vector<char> out;
    344     base64Encode(static_cast<const char*>(m_rawData->data()), m_bytesLoaded, out);
     344    base64Encode(m_rawData->data(), m_bytesLoaded, out);
    345345    out.append('\0');
    346346    builder.append(out.data());
  • trunk/Source/WebCore/inspector/DOMPatchSupport.cpp

    r157971 r159390  
    443443            Vector<uint8_t, 20> attrsHash;
    444444            attrsSHA1.computeHash(attrsHash);
    445             digest->m_attrsSHA1 = base64Encode(reinterpret_cast<const char*>(attrsHash.data()), 10);
     445            digest->m_attrsSHA1 = base64Encode(attrsHash.data(), 10);
    446446            addStringToSHA1(sha1, digest->m_attrsSHA1);
    447447        }
     
    450450    Vector<uint8_t, 20> hash;
    451451    sha1.computeHash(hash);
    452     digest->m_sha1 = base64Encode(reinterpret_cast<const char*>(hash.data()), 10);
     452    digest->m_sha1 = base64Encode(hash.data(), 10);
    453453    if (unusedNodesMap)
    454454        unusedNodesMap->add(digest->m_sha1, digest);
  • trunk/Source/WebCore/inspector/InspectorPageAgent.cpp

    r159268 r159390  
    12851285
    12861286    RetainPtr<CFDataRef> buffer = archive->rawDataRepresentation();
    1287     *data = base64Encode(reinterpret_cast<const char*>(CFDataGetBytePtr(buffer.get())), CFDataGetLength(buffer.get()));
     1287    *data = base64Encode(CFDataGetBytePtr(buffer.get()), CFDataGetLength(buffer.get()));
    12881288#else
    12891289    UNUSED_PARAM(data);
  • trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp

    r159027 r159390  
    411411
    412412    Vector<char> base64Data;
    413     base64Encode(reinterpret_cast<const char*>(CFDataGetBytePtr(data.get())), CFDataGetLength(data.get()), base64Data);
     413    base64Encode(CFDataGetBytePtr(data.get()), CFDataGetLength(data.get()), base64Data);
    414414
    415415    return "data:" + mimeType + ";base64," + base64Data;
Note: See TracChangeset for help on using the changeset viewer.