mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-10-30 19:20:40 -04:00 
			
		
		
		
	Allow configuring own CID fields through mbedtls_ssl_get_peer_cid()
This commit is contained in:
		
							parent
							
								
									2f28c1031f
								
							
						
					
					
						commit
						ca092246a7
					
				| @ -121,18 +121,33 @@ static void ssl_update_in_pointers( mbedtls_ssl_context *ssl, | |||||||
| #if defined(MBEDTLS_SSL_CID) | #if defined(MBEDTLS_SSL_CID) | ||||||
| /* Top-level Connection ID API */ | /* Top-level Connection ID API */ | ||||||
| 
 | 
 | ||||||
| /* WARNING: This implementation is a stub and doesn't do anything!
 | /* WARNING: The CID feature isn't fully implemented yet
 | ||||||
|  *          It is included solely to allow review and coding against |  *          and will not be used. */ | ||||||
|  *          the new Connection CID API. */ |  | ||||||
| int mbedtls_ssl_set_cid( mbedtls_ssl_context *ssl, | int mbedtls_ssl_set_cid( mbedtls_ssl_context *ssl, | ||||||
|                          int enable, |                          int enable, | ||||||
|                          unsigned char const *own_cid, |                          unsigned char const *own_cid, | ||||||
|                          size_t own_cid_len ) |                          size_t own_cid_len ) | ||||||
| { | { | ||||||
|     ((void) ssl); |     ssl->negotiate_cid = enable; | ||||||
|     ((void) enable); |     if( enable == MBEDTLS_SSL_CID_DISABLED ) | ||||||
|     ((void) own_cid); |     { | ||||||
|     ((void) own_cid_len); |         MBEDTLS_SSL_DEBUG_MSG( 3, ( "Disable use of CID extension." ) ); | ||||||
|  |         return( 0 ); | ||||||
|  |     } | ||||||
|  |     MBEDTLS_SSL_DEBUG_MSG( 3, ( "Enable use of CID extension." ) ); | ||||||
|  | 
 | ||||||
|  |     if( own_cid_len > MBEDTLS_SSL_CID_IN_LEN_MAX ) | ||||||
|  |     { | ||||||
|  |         MBEDTLS_SSL_DEBUG_MSG( 3, ( "CID too large: Maximum %u, actual %u", | ||||||
|  |                                     (unsigned) MBEDTLS_SSL_CID_IN_LEN_MAX, | ||||||
|  |                                     (unsigned) own_cid_len ) ); | ||||||
|  |         return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     memcpy( ssl->own_cid, own_cid, own_cid_len ); | ||||||
|  |     ssl->own_cid_len = own_cid_len; | ||||||
|  | 
 | ||||||
|  |     MBEDTLS_SSL_DEBUG_BUF( 3, "Own CID", own_cid, own_cid_len ); | ||||||
|     return( 0 ); |     return( 0 ); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Hanno Becker
						Hanno Becker