File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 135135kf = open (key_file , "rb" )
136136wolfboot_key_buffer = kf .read (4096 )
137137wolfboot_key_buffer_len = len (wolfboot_key_buffer )
138- if wolfboot_key_buffer_len == 64 :
139- if (sign == 'ecc256' ):
140- print ("Error: key size does not match the cipher selected " )
138+ if wolfboot_key_buffer_len == 32 :
139+ if (sign != 'ed25519' and not manual_sign and not sha_only ):
140+ print ("Error: key too short for cipher" )
141141 sys .exit (1 )
142- if sign == 'auto' :
142+ elif sign == 'auto' and ( manual_sign or sha_only ) :
143143 sign = 'ed25519'
144- print ("'ed25519' key autodetected." )
144+ print ("'ed25519' public key autodetected." )
145+ elif wolfboot_key_buffer_len == 64 :
146+ if (sign == 'ecc256' ):
147+ if not manual_sign and not sha_only :
148+ print ("Error: key size does not match the cipher selected" )
149+ sys .exit (1 )
150+ else :
151+ print ("Ecc256 public key detected" )
152+ if sign == 'auto' :
153+ if (manual_sign or sha_only ):
154+ sign = 'ecc256'
155+ print ("'ecc256' public key autodetected." )
156+ else :
157+ sign = 'ed25519'
158+ print ("'ed25519' key autodetected." )
145159elif wolfboot_key_buffer_len == 96 :
146160 if (sign == 'ed25519' ):
147161 print ("Error: key size does not match the cipher selected" )
You can’t perform that action at this time.
0 commit comments