mirror of https://github.com/openssl/openssl.git
				
				
				
			Allow 0 length plaintext and aad for aes-siv
Test vectors taken from wycheproof: https://github.com/C2SP/wycheproof/blob/master/testvectors/aes_siv_cmac_test.json Fixes #26580 Reviewed-by: Paul Dale <ppzgs1@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/26658)
This commit is contained in:
		
							parent
							
								
									20599e480f
								
							
						
					
					
						commit
						f11c10d83e
					
				|  | @ -291,7 +291,7 @@ int ossl_siv128_encrypt(SIV128_CONTEXT *ctx, | |||
|     if (!siv128_do_encrypt(ctx->cipher_ctx, out, in, len, &q)) | ||||
|         return 0; | ||||
|     ctx->final_ret = 0; | ||||
|     return len; | ||||
|     return 1; | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  | @ -327,7 +327,7 @@ int ossl_siv128_decrypt(SIV128_CONTEXT *ctx, | |||
|         return 0; | ||||
|     } | ||||
|     ctx->final_ret = 0; | ||||
|     return len; | ||||
|     return 1; | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  |  | |||
|  | @ -118,19 +118,10 @@ static int siv_cipher(void *vctx, unsigned char *out, size_t *outl, | |||
|     if (!ossl_prov_is_running()) | ||||
|         return 0; | ||||
| 
 | ||||
|     /* Ignore just empty encryption/decryption call and not AAD. */ | ||||
|     if (out != NULL) { | ||||
|         if (inl == 0) { | ||||
|             if (outl != NULL) | ||||
|                 *outl = 0; | ||||
|             return 1; | ||||
|         } | ||||
| 
 | ||||
|         if (outsize < inl) { | ||||
|     if (out != NULL && outsize < inl) { | ||||
|         ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL); | ||||
|         return 0; | ||||
|     } | ||||
|     } | ||||
| 
 | ||||
|     if (ctx->hw->cipher(ctx, out, in, inl) <= 0) | ||||
|         return 0; | ||||
|  |  | |||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
		Reference in New Issue