mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-07-15 08:32:42 +08:00
NEW VERSION: 1.1.0
1. Add pwm support; 2. Add c++ support; Please update to the latest folder "ld". 3. Add rand in libminic; 4. Add new reset reason REASON_EXT_SYS_RST in rst_reason; 5. Update the complied script ‘gen_misc.sh(bat)’, use the new boot and remove the old one; 6. Update folder "tools", and support CRC check of bin files; Please update to the latest folder "tools". 7. Optimize the process procedure of Wi-Fi event; 8. Fix bugs in printf when its runs out of memory; 9. Fix bugs in malloc when CACHE is disabled; 10.Fix exception and WDT reset bugs when CACHE is disabled; 11.Fix some Wi-Fi connection bugs; 12.Fix some Wi-Fi scan bugs; 13.Tune API "wifi_station_get_connect_status" for more accurate WiFi positioning; 14.Porting the optimization of non-OS SDK to RTOS SDK; 15.Fix other minor bugs.
This commit is contained in:
@ -26,6 +26,7 @@ import os
|
||||
import re
|
||||
import binascii
|
||||
import struct
|
||||
import zlib
|
||||
|
||||
|
||||
TEXT_ADDRESS = 0x40100000
|
||||
@ -93,8 +94,25 @@ def combine_bin(file_name,dest_file_name,start_offset_addr,need_chk):
|
||||
else:
|
||||
print '!!!Open %s fail!!!'%(file_name)
|
||||
|
||||
|
||||
def getFileCRC(_path):
|
||||
try:
|
||||
blocksize = 1024 * 64
|
||||
f = open(_path,"rb")
|
||||
str = f.read(blocksize)
|
||||
crc = 0
|
||||
while(len(str) != 0):
|
||||
crc = binascii.crc32(str, crc)
|
||||
str = f.read(blocksize)
|
||||
f.close()
|
||||
except:
|
||||
print 'get file crc error!'
|
||||
return 0
|
||||
return crc
|
||||
|
||||
def gen_appbin():
|
||||
global chk_sum
|
||||
global crc_sum
|
||||
global blocks
|
||||
if len(sys.argv) != 6:
|
||||
print 'Usage: gen_appbin.py eagle.app.out boot_mode flash_mode flash_clk_div flash_size_map'
|
||||
@ -239,7 +257,14 @@ def gen_appbin():
|
||||
else :
|
||||
print '!!!Open %s fail!!!'%(flash_bin_name)
|
||||
sys.exit(0)
|
||||
|
||||
if boot_mode == '1' or boot_mode == '2':
|
||||
all_bin_crc = getFileCRC(flash_bin_name)
|
||||
if all_bin_crc < 0:
|
||||
all_bin_crc = abs(all_bin_crc) - 1
|
||||
else :
|
||||
all_bin_crc = abs(all_bin_crc) + 1
|
||||
print "bin crc: %x"%all_bin_crc
|
||||
write_file(flash_bin_name,chr((all_bin_crc & 0x000000FF))+chr((all_bin_crc & 0x0000FF00) >> 8)+chr((all_bin_crc & 0x00FF0000) >> 16)+chr((all_bin_crc & 0xFF000000) >> 24))
|
||||
cmd = 'rm eagle.app.sym'
|
||||
os.system(cmd)
|
||||
|
||||
|
42
tools/make_cert.py
Normal file
42
tools/make_cert.py
Normal file
@ -0,0 +1,42 @@
|
||||
import os
|
||||
|
||||
|
||||
class Cert(object):
|
||||
def __init__(self, name, buff):
|
||||
self.name = name
|
||||
self.len = len(buff)
|
||||
self.buff = buff
|
||||
pass
|
||||
|
||||
def __str__(self):
|
||||
out_str = ['\0']*32
|
||||
for i in range(len(self.name)):
|
||||
out_str[i] = self.name[i]
|
||||
out_str = "".join(out_str)
|
||||
out_str += str(chr(self.len & 0xFF))
|
||||
out_str += str(chr((self.len & 0xFF00) >> 8))
|
||||
out_str += self.buff
|
||||
return out_str
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
cert_list = []
|
||||
file_list = os.listdir(os.getcwd())
|
||||
cert_file_list = []
|
||||
for _file in file_list:
|
||||
pos = _file.find(".cer")
|
||||
if pos != -1:
|
||||
cert_file_list.append(_file[:pos])
|
||||
|
||||
for cert_file in cert_file_list:
|
||||
with open(cert_file+".cer", 'rb') as f:
|
||||
buff = f.read()
|
||||
cert_list.append(Cert(cert_file, buff))
|
||||
with open('esp_ca_cert.bin', 'wb+') as f:
|
||||
for _cert in cert_list:
|
||||
f.write("%s" % _cert)
|
||||
pass
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -1,11 +1,92 @@
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the axTLS project nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# Generate the certificates and keys for testing.
|
||||
#
|
||||
|
||||
PROJECT_NAME="TLS Project"
|
||||
|
||||
# Generate the openssl configuration files.
|
||||
cat > ca_cert.conf << EOF
|
||||
[ req ]
|
||||
distinguished_name = req_distinguished_name
|
||||
prompt = no
|
||||
|
||||
[ req_distinguished_name ]
|
||||
O = $PROJECT_NAME Dodgy Certificate Authority
|
||||
EOF
|
||||
|
||||
cat > certs.conf << EOF
|
||||
[ req ]
|
||||
distinguished_name = req_distinguished_name
|
||||
prompt = no
|
||||
|
||||
[ req_distinguished_name ]
|
||||
O = $PROJECT_NAME
|
||||
CN = 127.0.0.1
|
||||
EOF
|
||||
|
||||
cat > device_cert.conf << EOF
|
||||
[ req ]
|
||||
distinguished_name = req_distinguished_name
|
||||
prompt = no
|
||||
|
||||
[ req_distinguished_name ]
|
||||
O = $PROJECT_NAME Device Certificate
|
||||
EOF
|
||||
|
||||
# private key generation
|
||||
openssl genrsa -out TLS.ca_key.pem 1024
|
||||
openssl genrsa -out TLS.key_1024.pem 1024
|
||||
|
||||
# convert private keys into DER format
|
||||
openssl rsa -in TLS.key_1024.pem -out TLS.key_1024 -outform DER
|
||||
|
||||
# cert requests
|
||||
openssl req -out TLS.ca_x509.req -key TLS.ca_key.pem -new \
|
||||
-config ./ca_cert.conf
|
||||
openssl req -out TLS.x509_1024.req -key TLS.key_1024.pem -new \
|
||||
-config ./certs.conf
|
||||
|
||||
# generate the actual certs.
|
||||
openssl x509 -req -in TLS.ca_x509.req -out TLS.ca_x509.pem \
|
||||
-sha1 -days 5000 -signkey TLS.ca_key.pem
|
||||
openssl x509 -req -in TLS.x509_1024.req -out TLS.x509_1024.pem \
|
||||
-sha1 -CAcreateserial -days 5000 \
|
||||
-CA TLS.ca_x509.pem -CAkey TLS.ca_key.pem
|
||||
|
||||
# some cleanup
|
||||
rm TLS*.req
|
||||
rm *.conf
|
||||
|
||||
openssl x509 -in TLS.ca_x509.pem -outform DER -out TLS.ca_x509.cer
|
||||
openssl x509 -in TLS.x509_1024.pem -outform DER -out TLS.x509_1024.cer
|
||||
|
||||
#
|
||||
# Generate the certificates and keys for encrypt.
|
||||
#
|
||||
|
||||
# set default cert for use in the client
|
||||
xxd -i client.cer | sed -e \
|
||||
"s/client_cer/default_certificate/" > cert.h
|
||||
xxd -i TLS.x509_1024.cer | sed -e \
|
||||
"s/TLS_x509_1024_cer/default_certificate/" > cert.h
|
||||
# set default key for use in the server
|
||||
xxd -i server.key_1024 | sed -e \
|
||||
"s/server_key_1024/default_private_key/" > private_key.h
|
||||
xxd -i TLS.key_1024 | sed -e \
|
||||
"s/TLS_key_1024/default_private_key/" > private_key.h
|
||||
|
Reference in New Issue
Block a user