Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update certs-from-mozilla.py #7578

Merged
merged 7 commits into from
Sep 7, 2020
Merged

Update certs-from-mozilla.py #7578

merged 7 commits into from
Sep 7, 2020

Conversation

gnorbsl
Copy link
Contributor

@gnorbsl gnorbsl commented Sep 4, 2020

Check if ar exists, if not tell the user what to get to prevent issue #7300 also dynamically get certs instead of hardcoded row item #7573 (comment)

Check if ar exists, if not tell the user what to get to prevent issue esp8266#7300 also dynamically get certs instead of hardcoded row item esp8266#7573 (comment)
@d-a-v
Copy link
Collaborator

d-a-v commented Sep 4, 2020

Thanks !
Our ar does not come from espressif but rather from the script tools/get.py which reads its sources from package/package_esp8266com_index.template.json.

@gnorbsl
Copy link
Contributor Author

gnorbsl commented Sep 4, 2020

@d-a-v So assuming someone is a new user that just wants to make SSL requests with this. How does he find ar or get.py?

Is there any documentation that I can link to that shows the user how to get ar?

I assume ar is /Java/hardware/tools/avr/bin/avr-ar?

@d-a-v
Copy link
Collaborator

d-a-v commented Sep 4, 2020

Is there any documentation that I can link to that shows the user how to get ar?

There are three ways to install:

  • arduino ide: toolchain is automatically downloaded to tools/xtensa-lx106-elf/
  • git: documentation asks user to run cd tools; python get.py. It will download the right toolchain to the same place
  • platformio: we don't document it (pio has it own documentation)

I assume ar is /Java/hardware/tools/avr/bin/avr-ar?

You are running Arduino IDE on macOS. That one is not the good one.
You should have: Java/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/xtensa-lx106-elf/bin/ar and Java/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar.
That is the automatic installation mentioned above.

But documentation should refer to a relative path like (arduino-installation-path)/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar or (esp8266-arduino-core-root-path)/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar.

@gnorbsl
Copy link
Contributor Author

gnorbsl commented Sep 4, 2020

@d-a-v Thank you,

can I just link your comment in the python script so users that stumble over this issue can see what to do?

@d-a-v
Copy link
Collaborator

d-a-v commented Sep 4, 2020

Not this comment's URL. That would be sufficient :

(esp8266-arduino-core-root-path)/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar

changed comment for missing ar exception
@gnorbsl
Copy link
Contributor Author

gnorbsl commented Sep 4, 2020

I added your path. But since I don't have this path and didn't use this repo to begin with with my esp8266 I'm not sure how useful this path is for anyone that stumbles over this. I assume most people that download the certs are coming here from 3rd party sites.

@d-a-v
Copy link
Collaborator

d-a-v commented Sep 4, 2020

You do have it.
Is it not /Application/Arduino/whatever/Java/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar ?

@d-a-v
Copy link
Collaborator

d-a-v commented Sep 4, 2020

@earlephilhower Do we really need xtensa's ar ? Any version of ar seems to be sufficient.

Anyway, we know for sure that we always have this one (esp8266-arduino-core)/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/xtensa-lx106-elf/bin/ar because it is shipped with the necessary toolchain.
Other versions may work but are not be always available on every setup (AVR's ar not with PIO, linux's ar now with bare windows)

@gnorbsl
Copy link
Contributor Author

gnorbsl commented Sep 4, 2020

I don't have Arduino in Application since I never moved it there. All I have in the Arduino package contents is a folder named arduino and tools, both have an avr folder inside.

"we" excludes myself then I guess. If others have the path then thats fine. I just got ar from somewhere else and ran the script inside the folder with ar and that fixed it.

@JiriBilek
Copy link
Contributor

I suggest you to test the existence of openssl as well.

@d-a-v
Copy link
Collaborator

d-a-v commented Sep 4, 2020

I think we should update the path with this one because it is always present in a working setup (the current one is .../xtensa-lx106-elf-ar, but the script uses ar) :

(esp8266-arduino-core)/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/xtensa-lx106-elf/bin/ar

@JiriBilek that's right

if which('ar') is None and not os.path.isfile('./ar') and not os.path.isfile('./ar.exe'):
    raise Exception("You need the program 'ar' from xtensa-lx106-elf found here: (esp8266-arduino-core)/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/xtensa-lx106-elf/bin/ar")
if which('openssl') is None and not os.path.isfile('./openssl') and not os.path.isfile('./openssl.exe'):
    raise Exception("You need to have openssl in PATH, installable from https://www.openssl.org/")

@gnorbsl
Copy link
Contributor Author

gnorbsl commented Sep 7, 2020

changed path and added openssl check @d-a-v

added linebreak for comment
@d-a-v
Copy link
Collaborator

d-a-v commented Sep 7, 2020

Thanks for making this script more generic !

@d-a-v d-a-v merged commit 88be34e into esp8266:master Sep 7, 2020
@gnorbsl gnorbsl deleted the patch-3 branch September 7, 2020 14:45
davisonja added a commit to davisonja/Arduino that referenced this pull request Sep 10, 2020
* master: (299 commits)
  Fix error message typo (esp8266#7581)
  Update certs-from-mozilla.py (esp8266#7578)
  Update DigestAuthorization.ino (Simple example update) (esp8266#7579)
  Fix gzip+signed OTA error (esp8266#7577)
  Properly replace toolchain in PlatformIO CI script (esp8266#7580)
  Update certs-from-mozilla.py (esp8266#7573)
  Fixup weird combination of oneline/multi line comments (esp8266#7566)
  Reduce codesize of setOutputPower (esp8266#7572)
  Fix typos in tests
  Force gcc inlining, use same style for getCycleCount as for getCpuFreqMHz.
  Even more concise #if form.
  Inline, fewer LOC, remove redundant definition in cpp.
  Netump Initial commit (esp8266#7527)
  Delete owner field (esp8266#7563)
  Avoid float-double-conversion (esp8266#7559)
  Use direct member initialization instead of ctr initialisation (esp8266#7556)
  Add CI test for eboot build (esp8266#7546)
  getCpuFreqMHz(): fix when F_CPU is not defined (esp8266#7554)
  emulation-on-host makefile update, allowing to pass more options (esp8266#7552)
  add sdk options to "generic esp8285 module" (esp8266#7550)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants