Use convenience function to checksum
That coreboot uses the IP checksum is an artifact, not a deliberate requirement to be compatible with the Internet Protocole suite. Use a wrapper to abstract the computation of coreboot's checksum. Change-Id: I6491b9ba5efb9ffe5cb12a6172653a6ac80a1370 Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com> Reviewed-on: http://review.coreboot.org/497 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
This commit is contained in:
		
				
					committed by
					
						
						Patrick Georgi
					
				
			
			
				
	
			
			
			
						parent
						
							46404d75e4
						
					
				
				
					commit
					fe2f6b075e
				
			@@ -17,8 +17,8 @@
 | 
			
		||||
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <coreboot_tables.h>
 | 
			
		||||
#include "coreinfo.h"
 | 
			
		||||
#include <coreboot_tables.h>
 | 
			
		||||
 | 
			
		||||
#ifdef CONFIG_MODULE_COREBOOT
 | 
			
		||||
 | 
			
		||||
@@ -189,10 +189,10 @@ static int parse_header(void *addr, int len)
 | 
			
		||||
 | 
			
		||||
	/* FIXME: Check the checksum. */
 | 
			
		||||
 | 
			
		||||
	if (ipchksum((uint16_t *) header, sizeof(*header)))
 | 
			
		||||
	if (cb_checksum(header, sizeof(*header)))
 | 
			
		||||
		return -1;
 | 
			
		||||
 | 
			
		||||
	if (ipchksum((uint16_t *) (ptr + sizeof(*header)), header->table_bytes)
 | 
			
		||||
	if (cb_checksum((ptr + sizeof(*header)), header->table_bytes)
 | 
			
		||||
	    != header->table_checksum)
 | 
			
		||||
		return -1;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user