Git Product home page Git Product logo

tesla-ble's Issues

Support for mbedtls v2.x

I'm trying to use your library in ESPHome, unfortunately, the mbedtls version included in the Espressif Arduino framework (/data/cache/platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/mbedtls/mbedtls) seems to be 2.x, which is not compatible:

src/esphome/components/tesla_ble/client.cpp: In member function 'int TeslaBLE::Client::LoadPrivateKey(const uint8_t*, size_t)':
src/esphome/components/tesla_ble/client.cpp:92:65: error: too many arguments to function 'int mbedtls_pk_parse_key(mbedtls_pk_context*, const unsigned char*, size_t, const unsigned char*, size_t)'
       password, 0, mbedtls_ctr_drbg_random, &this->drbg_context_);
                                                                 ^
In file included from src/esphome/components/tesla_ble/client.h:10,
                 from src/esphome/components/tesla_ble/client.cpp:1:
/data/cache/platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/mbedtls/mbedtls/include/mbedtls/pk.h:712:5: note: declared here
 int mbedtls_pk_parse_key( mbedtls_pk_context *ctx,
     ^~~~~~~~~~~~~~~~~~~~
src/esphome/components/tesla_ble/client.cpp: In member function 'int TeslaBLE::Client::GeneratePublicKey()':
src/esphome/components/tesla_ble/client.cpp:131:51: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'private_grp'
       &mbedtls_pk_ec(this->private_key_context_)->private_grp,
                                                   ^~~~~~~~~~~
src/esphome/components/tesla_ble/client.cpp:132:51: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'private_Q'
       &mbedtls_pk_ec(this->private_key_context_)->private_Q,
                                                   ^~~~~~~~~
src/esphome/components/tesla_ble/client.cpp: In member function 'int TeslaBLE::Client::GenerateKeyId()':
src/esphome/components/tesla_ble/client.cpp:153:54: error: void value not ignored as it ought to be
   int return_code = mbedtls_sha1_starts(&sha1_context);
                                                      ^
src/esphome/components/tesla_ble/client.cpp:160:59: error: void value not ignored as it ought to be
                                     this->public_key_size_);
                                                           ^
src/esphome/components/tesla_ble/client.cpp:167:58: error: void value not ignored as it ought to be
   return_code = mbedtls_sha1_finish(&sha1_context, buffer);
                                                          ^
src/esphome/components/tesla_ble/client.cpp: In member function 'int TeslaBLE::Client::LoadTeslaKey(const uint8_t*, size_t)':
src/esphome/components/tesla_ble/client.cpp:193:62: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'private_grp'
   int return_code = mbedtls_ecp_group_load(&this->tesla_key_.private_grp,
                                                              ^~~~~~~~~~~
src/esphome/components/tesla_ble/client.cpp:201:25: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'private_grp'
       &this->tesla_key_.private_grp, &this->tesla_key_.private_Q,
                         ^~~~~~~~~~~
src/esphome/components/tesla_ble/client.cpp:201:56: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'private_Q'
       &this->tesla_key_.private_grp, &this->tesla_key_.private_Q,
                                                        ^~~~~~~~~
src/esphome/components/tesla_ble/client.cpp:241:50: error: void value not ignored as it ought to be
   return_code = mbedtls_sha1_starts(&sha1_context);
                                                  ^
src/esphome/components/tesla_ble/client.cpp:248:62: error: void value not ignored as it ought to be
                                     temp_shared_secret_length);
                                                              ^
src/esphome/components/tesla_ble/client.cpp:254:72: error: void value not ignored as it ought to be
   return_code = mbedtls_sha1_finish(&sha1_context, this->shared_secret_);
                                                                        ^
src/esphome/components/tesla_ble/client.cpp: In member function 'int TeslaBLE::Client::Encrypt(unsigned char*, size_t, unsigned char*, size_t, size_t*, unsigned char*)':
src/esphome/components/tesla_ble/client.cpp:297:49: error: too few arguments to function 'int mbedtls_gcm_starts(mbedtls_gcm_context*, int, const unsigned char*, size_t, const unsigned char*, size_t)'
                                    sizeof(nonce));
                                                 ^
In file included from src/esphome/components/tesla_ble/client.cpp:7:
/data/cache/platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/mbedtls/mbedtls/include/mbedtls/gcm.h:244:5: note: declared here
 int mbedtls_gcm_starts( mbedtls_gcm_context *ctx,
     ^~~~~~~~~~~~~~~~~~
src/esphome/components/tesla_ble/client.cpp:304:40: error: invalid conversion from 'unsigned char*' to 'size_t' {aka 'unsigned int'} [-fpermissive]
       mbedtls_gcm_update(&aes_context, input_buffer, input_buffer_length,
                                        ^~~~~~~~~~~~
src/esphome/components/tesla_ble/client.cpp:304:54: error: invalid conversion from 'size_t' {aka 'unsigned int'} to 'const unsigned char*' [-fpermissive]
       mbedtls_gcm_update(&aes_context, input_buffer, input_buffer_length,
                                                      ^~~~~~~~~~~~~~~~~~~
src/esphome/components/tesla_ble/client.cpp:305:76: error: too many arguments to function 'int mbedtls_gcm_update(mbedtls_gcm_context*, size_t, const unsigned char*, unsigned char*)'
                          output_buffer, output_buffer_length, output_length);
                                                                            ^
In file included from src/esphome/components/tesla_ble/client.cpp:7:
/data/cache/platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/mbedtls/mbedtls/include/mbedtls/gcm.h:276:5: note: declared here
 int mbedtls_gcm_update( mbedtls_gcm_context *ctx,
     ^~~~~~~~~~~~~~~~~~
src/esphome/components/tesla_ble/client.cpp:317:69: error: too many arguments to function 'int mbedtls_gcm_finish(mbedtls_gcm_context*, unsigned char*, size_t)'
                          &finish_buffer_length, signature_buffer, 16);
                                                                     ^
In file included from src/esphome/components/tesla_ble/client.cpp:7:
/data/cache/platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/mbedtls/mbedtls/include/mbedtls/gcm.h:297:5: note: declared here
 int mbedtls_gcm_finish( mbedtls_gcm_context *ctx,
     ^~~~~~~~~~~~~~~~~~
*** [.pioenvs/watchy-01/src/esphome/components/tesla_ble/client.cpp.o] Error 1

I quickly had a look at it, but some changes do not seem that trivial to me. Any chance you could make the library compatible with both versions (2.x and 3.x)? I doubt adding 3.x on top of 2.x in my work tree would do any good.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.