Skip to content

extmod/modssl_mbedtls: Add SSLContext methods. - #11888

Closed
Carglglz wants to merge 1 commit into
micropython:masterfrom
Carglglz:sslcontext
Closed

Carglglz wants to merge 1 commit into
micropython:masterfrom
Carglglz:sslcontext

Conversation

@Carglglz

@Carglglz Carglglz commented Jun 27, 2023 •

Copy link
Copy Markdown
Contributor

This commit adds a # MICROPY_SSL_MBEDTLS_EXTRAS macro that enables:

  1. Methods to SSLContext class that match CPython signature:
  • SSLContext.load_cert_chain(certfile, keyfile=)
  • SSLContext.load_verify_locations(cadata=)
  • SSLContext.get_ciphers() --> ["CIPHERSUITE"]
  • SSLContext.set_ciphers(["CIPHERSUITE"])
  1. sslsocket.cipher() to get current ciphersuite and protocol
    version.

  2. ssl.MBEDTLS_VERSION string constant

  3. Tests in net_inet and multi_net

@github-actions

github-actions Bot commented Jun 27, 2023 •

Copy link
Copy Markdown

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64: +18520 +2.319% standard[incl +672(data)]
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% PICO
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS

@codecov

codecov Bot commented Jun 27, 2023 •

Copy link
Copy Markdown

Codecov Report

Merging #11888 (5c2a1f2) into master (8851800) will increase coverage by 0.02%.
The diff coverage is 98.48%.

❗ Current head 5c2a1f2 differs from pull request most recent head 606b0ba. Consider uploading reports for the commit 606b0ba to get more accurate results

@@            Coverage Diff             @@
##           master   #11888      +/-   ##
==========================================
+ Coverage   98.38%   98.41%   +0.02%     
==========================================
  Files         158      158              
  Lines       20898    20962      +64     
==========================================
+ Hits        20561    20629      +68     
+ Misses        337      333       -4     
Files Changed Coverage Δ
ports/unix/mpconfigport.h 100.00% <ø> (ø)
extmod/modssl_mbedtls.c 95.13% <98.48%> (+3.24%) ⬆️

... and 2 files with indirect coverage changes

@Carglglz

Carglglz commented Jul 13, 2023 •

Copy link
Copy Markdown
Contributor Author

Note that I've only enabled the extra methods in unix port, and I use the macro # MICROPY_SSL_MBEDTLS_EXTRAS so one can choose to enable these methods at port or board level adding the macro at mpconfigport.h or mpconfigboard.h

Also note that AFAIK without these extra methods, the implementation of SSLContext at #11862 is incomplete, i.e. only allows client mode and without server verification.

This commit adds a `# MICROPY_SSL_MBEDTLS_EXTRAS` macro that enables:

1) Methods to SSLContext class that match CPython signature:

	- `SSLContext.load_cert_chain(certfile, keyfile=)`
	- `SSLContext.load_verify_locations(cadata=)`
	- `SSLContext.get_ciphers()` --> ["CIPHERSUITE"]
	- `SSLContext.set_ciphers(["CIPHERSUITE"])`

2) `sslsocket.cipher()` to get current ciphersuite and protocol
   version.

3) `ssl.MBEDTLS_VERSION` string constant

4) Tests in `net_inet` and `multi_net`

Signed-off-by: Carlos Gil <[email protected]>
@Carglglz

Copy link
Copy Markdown
Contributor Author

Follow in #13098

@Carglglz Carglglz closed this Nov 30, 2023
@Carglglz
Carglglz deleted the sslcontext branch January 21, 2024 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extmod Relates to extmod/ directory in source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants