forked from micropython/micropython
    
        
        - 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.3k
ssl: work on anything implementing the socket protocol #8954
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
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            15 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      7e7918e
              
                socketpool: alphabetize dict names
              
              
                jepler 0c1db5e
              
                socketpool: add `type` property to Socket objects
              
              
                jepler 5973c4a
              
                socketpool: factor out constants
              
              
                jepler c793a02
              
                ssl: work on anything implementing the socket protocol
              
              
                jepler 40cc500
              
                wiznet w5500: improve pin naming & enable ssl
              
              
                jepler b330989
              
                sslsocket: Simplify handling the timeout value
              
              
                jepler f960c5b
              
                SSLSocket: propagate any exception from socket.settimeout directly
              
              
                jepler 8c5d9d2
              
                ssl: make bind & listen into void functions (they throw exceptions)
              
              
                jepler 14a1972
              
                Fix return value of accept()
              
              
                jepler e5f0579
              
                SSLSocket: implement setsockopt (untested)
              
              
                jepler 2f04028
              
                Merge remote-tracking branch 'origin/main' into ssl-anything
              
              
                jepler 2f53c6e
              
                ssl: Swallow errors during socket.close()
              
              
                jepler 93490c3
              
                Don't close an SSL socket twice
              
              
                jepler 879f241
              
                Disable some things for the ssl enhancements to fit
              
              
                jepler a93cbb2
              
                Merge remote-tracking branch 'origin/main' into ssl-anything
              
              
                jepler File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -9,3 +9,4 @@ CHIP_FAMILY = rp2 | |
| EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" | ||
|  | ||
| CIRCUITPY__EVE = 1 | ||
| CIRCUITPY_SSL = 1 | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /* | ||
| * This file is part of the MicroPython project, http://micropython.org/ | ||
| * | ||
| * The MIT License (MIT) | ||
| * | ||
| * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal | ||
| * in the Software without restriction, including without limitation the rights | ||
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| * copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in | ||
| * all copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| * THE SOFTWARE. | ||
| */ | ||
|  | ||
| #pragma once | ||
|  | ||
| // Note: This file must be designed so it be included by ssl | ||
| // whether or not CIRCUITPY_SOCKETPOOL is set. | ||
| // | ||
| typedef enum { | ||
| SOCKETPOOL_SOCK_STREAM = 1, | ||
| SOCKETPOOL_SOCK_DGRAM = 2, | ||
| SOCKETPOOL_SOCK_RAW = 3 | ||
| } socketpool_socketpool_sock_t; | ||
|  | ||
| typedef enum { | ||
| SOCKETPOOL_AF_INET = 2, | ||
| SOCKETPOOL_AF_INET6 = 10 | ||
| } socketpool_socketpool_addressfamily_t; | ||
|  | ||
| typedef enum { | ||
| SOCKETPOOL_IPPROTO_IP = 0, | ||
| SOCKETPOOL_IPPROTO_ICMP = 1, | ||
| SOCKETPOOL_IPPROTO_TCP = 6, | ||
| SOCKETPOOL_IPPROTO_UDP = 17, | ||
| SOCKETPOOL_IPPROTO_IPV6 = 41, | ||
| SOCKETPOOL_IPPROTO_RAW = 255, | ||
| } socketpool_socketpool_ipproto_t; | ||
|  | ||
| typedef enum { | ||
| SOCKETPOOL_TCP_NODELAY = 1, | ||
| } socketpool_socketpool_tcpopt_t; | ||
|  | ||
| typedef enum { | ||
| SOCKETPOOL_SOL_SOCKET = 0xfff, | ||
| } socketpool_socketpool_optlevel_t; | ||
|  | ||
| typedef enum { | ||
| SOCKETPOOL_SO_REUSEADDR = 0x0004, | ||
| } socketpool_socketpool_socketopt_t; | ||
|  | ||
| typedef enum { | ||
| SOCKETPOOL_IP_MULTICAST_TTL = 5, | ||
| } socketpool_socketpool_ipopt_t; | ||
|  | ||
| typedef enum { | ||
| SOCKETPOOL_EAI_NONAME = -2, | ||
| } socketpool_eai_t; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enable SSL also on wiznet_w5100s_evb_pico? I could do this in a separate PR if desired.