mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-10-31 03:30:35 -04:00 
			
		
		
		
	Minor improvements
This commit is contained in:
		
							parent
							
								
									2b2f898cbd
								
							
						
					
					
						commit
						e58d38c66f
					
				| @ -1167,26 +1167,26 @@ int mbedtls_rsa_rsassa_pss_sign( mbedtls_rsa_context *ctx, | |||||||
|  * |  * | ||||||
|  * Parameters: |  * Parameters: | ||||||
|  * - md_alg:  Identifies the hash algorithm used to generate the given hash; |  * - md_alg:  Identifies the hash algorithm used to generate the given hash; | ||||||
|  *            MBEDTLS_MD_NONE if raw data are signed. |  *            MBEDTLS_MD_NONE if raw data is signed. | ||||||
|  * - hashlen: Length of hash in case hashlen is MBEDTLS_MD_NONE. |  * - hashlen: Length of hash in case hashlen is MBEDTLS_MD_NONE. | ||||||
|  * - hash:    Buffer containing the hashed message. |  * - hash:    Buffer containing the hashed message or the raw data. | ||||||
|  * - sig_len: Length of the encoded message. |  * - dst_len: Length of the encoded message. | ||||||
|  * - dst:     Buffer to hold the encoded message. |  * - dst:     Buffer to hold the encoded message. | ||||||
|  * |  * | ||||||
|  * Assumptions: |  * Assumptions: | ||||||
|  * - hash has size hashlen if md_alg == MBEDTLS_MD_NONE. |  * - hash has size hashlen if md_alg == MBEDTLS_MD_NONE. | ||||||
|  * - hash has size corresponding to md_alg if md_alg != MBEDTLS_MD_NONE. |  * - hash has size corresponding to md_alg if md_alg != MBEDTLS_MD_NONE. | ||||||
|  * - dst points to a buffer of size at least sig_len. |  * - dst points to a buffer of size at least dst_len. | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| static int rsa_rsassa_pkcs1_v15_encode( mbedtls_md_type_t md_alg, | static int rsa_rsassa_pkcs1_v15_encode( mbedtls_md_type_t md_alg, | ||||||
|                                         unsigned int hashlen, |                                         unsigned int hashlen, | ||||||
|                                         const unsigned char *hash, |                                         const unsigned char *hash, | ||||||
|                                         size_t sig_len, |                                         size_t dst_len, | ||||||
|                                         unsigned char *dst ) |                                         unsigned char *dst ) | ||||||
| { | { | ||||||
|     size_t oid_size  = 0; |     size_t oid_size  = 0; | ||||||
|     size_t nb_pad    = sig_len; |     size_t nb_pad    = dst_len; | ||||||
|     unsigned char *p = dst; |     unsigned char *p = dst; | ||||||
|     const char *oid  = NULL; |     const char *oid  = NULL; | ||||||
| 
 | 
 | ||||||
| @ -1282,9 +1282,9 @@ static int rsa_rsassa_pkcs1_v15_encode( mbedtls_md_type_t md_alg, | |||||||
| 
 | 
 | ||||||
|     /* Just a sanity-check, should be automatic
 |     /* Just a sanity-check, should be automatic
 | ||||||
|      * after the initial bounds check. */ |      * after the initial bounds check. */ | ||||||
|     if( p != dst + sig_len ) |     if( p != dst + dst_len ) | ||||||
|     { |     { | ||||||
|         mbedtls_zeroize( dst, sig_len ); |         mbedtls_zeroize( dst, dst_len ); | ||||||
|         return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA ); |         return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA ); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Hanno Becker
						Hanno Becker