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

image.py: Error on sign a firmware #182

Closed
miyatsu opened this issue Jan 16, 2018 · 4 comments
Closed

image.py: Error on sign a firmware #182

miyatsu opened this issue Jan 16, 2018 · 4 comments

Comments

@miyatsu
Copy link
Contributor

miyatsu commented Jan 16, 2018

Use tag v1.1.0, when I sign a firmware using the root-*.pem key provide by this repo, got some error message.
mcuboot is at the root dir of zephyr, and run this script at dir zephyr/sample/http_client

#!/bin/bash

mcuboot_path="../../../mcuboot";
firmware_path="build/stm32f4_explo/zephyr";
firmware_version=1

output_file_name="${firmware_path}/http_v${firmware_version}_debug.bin";

./${mcuboot_path}/scripts/imgtool.py sign \
	--key ${mcuboot_path}/root-ec-p256.pem \
	--header-size 0x200 \
	--align 8 \
	--version ${firmware_version} \
	--included-header \
	${firmware_path}/zephyr.bin ${firmware_path}/http_v0.0.1_debug.bin

I got error message below:

Traceback (most recent call last):
  File "./../../../mcuboot/scripts/imgtool.py", line 145, in <module>
    args()
  File "./../../../mcuboot/scripts/imgtool.py", line 142, in args
    subcmds[args.subcmd](args)
  File "./../../../mcuboot/scripts/imgtool.py", line 84, in do_sign
    key = load_key(args) if args.key else None
  File "./../../../mcuboot/scripts/imgtool.py", line 62, in load_key
    key = keys.load(args.key)
  File "/home/${user_name}/project/zephyr/mcuboot/scripts/imgtool/keys/__init__.py", line 66, in load
    if pk.key_size != 256:
AttributeError: '_EllipticCurvePrivateKey' object has no attribute 'key_size'
@utzig
Copy link
Member

utzig commented Jan 16, 2018

Hmmm, I am not able to reproduce the error locally but seems related to dependencies. Please paste the output of pip show cryptography here.

@miyatsu
Copy link
Contributor Author

miyatsu commented Jan 16, 2018

The output of pip show cryptography get nothing.
When I checkout to tag v1.0, and run the same .sh, every thing is fine.
I will try this on other machine.

@utzig
Copy link
Member

utzig commented Jan 16, 2018

Recently imgtool.py has moved to depending only on cryptography instead of a bunch of different python crypto libraries. Strangely you don't get import errors, but try again after installing cryptography (pip install cryptography with or without sudo depending on your setup).

@miyatsu miyatsu closed this as completed Feb 2, 2018
@miyatsu
Copy link
Contributor Author

miyatsu commented Feb 6, 2018

Fixed after #199 , commit id f242901

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

No branches or pull requests

2 participants