/*************************************************************************** * Copyright (c) 2003-2010, Broadcom Corporation * All Rights Reserved * Confidential Property of Broadcom Corporation * * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. * * $brcm_Workfile: $ * $brcm_Revision: $ * $brcm_Date: $ * * Module Description: Stage 1 C entry point. * * Revision History: * * $brcm_Log: $ * * ***************************************************************************/ /* copy memory block from word aligned src to word aligned destination with word aligned size. All pointer and size must be 4 bytes aligned */ extern void aligned_copy(void * src, void * dst, unsigned int n); extern unsigned int _stage2_start; extern unsigned int _stage2_size; extern unsigned int __start_s2; extern unsigned int key1[]; #define KSEG0_KSEG1(x) ((0x20000000) | (unsigned long)(x)) #if defined(RSA_BITS) #define SIGNATURE_SIZE (RSA_BITS/8) #else #define SIGNATURE_SIZE 0x80 #endif unsigned int stage2_signature[SIGNATURE_SIZE/4]; unsigned int key1_copy[SIGNATURE_SIZE/4]; #define XPT_OTP_MC1_BASE 0xb053802c void print_string(void) { /* New B0 scramble function needs print_string to compile */ } /* write character on serial port */ extern void _writeasm(int c); int signature_check(unsigned long in, unsigned long size, unsigned long signature, unsigned long public_key); void stage1_main(void) { void * stage2_signature_address; int rc; stage2_signature_address = (void*)((unsigned int)&_stage2_start + (unsigned int)&_stage2_size); /* we must validate key1 somehow. */ aligned_copy(stage2_signature_address, stage2_signature, SIGNATURE_SIZE); aligned_copy(key1, key1_copy, SIGNATURE_SIZE); rc = signature_check(KSEG0_KSEG1(&__start_s2), (unsigned long)&_stage2_size, (unsigned long)stage2_signature, (unsigned long)key1_copy); if(0 != rc){ /* signature is invalid */ _writeasm('-'); /* halt if bootloader verification is enabled */ if((*(unsigned int*)XPT_OTP_MC1_BASE) & 4) __asm__("wait"); } /* exit back to assembly and start stage two execution */ } #include "signature.c" /* Please do not remove! */ /* Local Variables: */ /* mode: C */ /* indent-tabs-mode: nil */ /* End: */