Index: sw/release/Makefile =================================================================== RCS file: /home/routefree/ng/depot/sw/release/Makefile,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -r1.2 -r1.2.20.1 3c3 < SUBDIRS = flash sdk --- > SUBDIRS = flash sdk rm Index: sw/rvl/boot/compat/Makefile =================================================================== RCS file: /home/routefree/ng/depot/sw/rvl/boot/compat/Makefile,v retrieving revision 1.13 retrieving revision 1.13.8.2 diff -r1.13 -r1.13.8.2 4c4 < TARGETS = boot1_compat.img bc.bwf mios.bwf boot1_compat_prod.img mios.img bc.wad mios.wad bc_prod_dev.bwf --- > TARGETS = boot1_compat.img bc.bwf mios.bwf boot1_compat_prod.img mios.img bc.wad mios.wad bc_prod_dev.bwf boot1_compat.elf boot1_compat_prod.elf 18,21c18,23 < LCDEFS += -DBOOT1_DISABLE_DCACHE < LCDEFS += -DBOOT1_DISABLE_EFUSE < LCDEFS += -DBOOT1_DISABLE_EEPROM < LLDLIBS += -lsys -lcsl -lioslibc #-lee --- > > LLDLIBS += -lsys -lioslibc > #Don't link -lee if EEPROM is disabled > DEVEL_LIBS = -lcsl_dev > PROD_LIBS = -lcsl -lee > 47c49 < $(CC) -c -DRVL_DEVEL_PKI $(CFLAGS) -o $@ $^ --- > $(CC) -c -DRVL_DEVEL_PKI -DBOOT1_DISABLE_EEPROM $(CFLAGS) -o $@ $^ 50c52 < $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS) --- > $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(DEVEL_LIBS) $(LDLIBS) 75c77 < $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS) --- > $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(PROD_LIBS) $(LDLIBS) 92,93c94,95 < $(ROOT)/usr/bin/x86/tmd -O -C 1 -T 0x$(bc_titid) -n $^ -c 0x$(bc_cid) -m $(bc_minor) -i 0 -t 1 -b 0 -P c -k aeskey -s $(ROOT)/usr/etc/pki_data/cp_ppki.cert -D $(ROOT)/usr/etc/pki_data/cp_dpki.rsa < $(ROOT)/usr/bin/x86/ticket -O -t 0x$(bc_tikid) -T 0x$(bc_titid) -K $(bc_titid).titleKey -P c -X $(ROOT)/usr/etc/pki_data/xs_ppki.cert -x $(ROOT)/usr/etc/pki_data/xs_dpki.rsa -S $(ROOT)/usr/etc/pki_data/xs_dpki.eccPubKey --- > $(HOSTBINDIR)/tmd -O -C 1 -T 0x$(bc_titid) -n $^ -c 0x$(bc_cid) -m $(bc_minor) -i 0 -t 1 -b 0 -P c -k aeskey -s $(ROOT)/usr/etc/pki_data/cp_ppki.cert -D $(ROOT)/usr/etc/pki_data/cp_dpki.rsa > $(HOSTBINDIR)/ticket -O -t 0x$(bc_tikid) -T 0x$(bc_titid) -K $(bc_titid).titleKey -P c -X $(ROOT)/usr/etc/pki_data/xs_ppki.cert -x $(ROOT)/usr/etc/pki_data/xs_dpki.rsa -S $(ROOT)/usr/etc/pki_data/xs_dpki.eccPubKey 123,124c125,126 < $(ROOT)/usr/bin/x86/tmd -O -C 1 -T 0x$(mios_titid) -n $^ -c 0x$(mios_cid) -m $(mios_minor) -i 0 -t 1 -b 0 -P c -k aeskey -s $(ROOT)/usr/etc/pki_data/cp_ppki.cert -D $(ROOT)/usr/etc/pki_data/cp_dpki.rsa < $(ROOT)/usr/bin/x86/ticket -O -t 0x$(mios_tikid) -T 0x$(mios_titid) -K $(mios_titid).titleKey -P c -X $(ROOT)/usr/etc/pki_data/xs_ppki.cert -x $(ROOT)/usr/etc/pki_data/xs_dpki.rsa -S $(ROOT)/usr/etc/pki_data/xs_dpki.eccPubKey --- > $(HOSTBINDIR)/tmd -O -C 1 -T 0x$(mios_titid) -n $^ -c 0x$(mios_cid) -m $(mios_minor) -i 0 -t 1 -b 0 -P c -k aeskey -s $(ROOT)/usr/etc/pki_data/cp_ppki.cert -D $(ROOT)/usr/etc/pki_data/cp_dpki.rsa > $(HOSTBINDIR)/ticket -O -t 0x$(mios_tikid) -T 0x$(mios_titid) -K $(mios_titid).titleKey -P c -X $(ROOT)/usr/etc/pki_data/xs_ppki.cert -x $(ROOT)/usr/etc/pki_data/xs_dpki.rsa -S $(ROOT)/usr/etc/pki_data/xs_dpki.eccPubKey Index: sw/rvl/boot/compat/load_boot2.c =================================================================== RCS file: /home/routefree/ng/depot/sw/rvl/boot/compat/load_boot2.c,v retrieving revision 1.3 retrieving revision 1.3.12.1 diff -r1.3 -r1.3.12.1 51a52 > #define NAPA_BUFFER_SIZE (16*1024) 68a70,77 > /* > * String limiting for cert names; > * each piece is a two-char name followed by 8 digits; > * we build up ROOT plus up to 3 pieces, for a total of 4; > * sizeof(IOSCName) is 64, divide by 4 is 16 for each piece; > */ > #define SIZE_LIMCNAME (sizeof(IOSCName) / 4) > 167c176 < * a reason code alternating with zero. --- > * a reason code alternating with its bitwise NOT. 175c184 < outputLed(0); --- > outputLed(~reason); 217a227,230 > if (base & (ALIGN_SZ - 1)) { > rc = REASON_HASH; > goto runHashAsync_out; > } 308,310d320 < < < 568a579 > * - Assert that all header values do not point outside the flash block 571c582,586 < (wadHdr->hdrSize > FL_PAGE_SIZE) || --- > (wadHdr->certSize != (sizeof(IOSCRsa4096RsaCert) > + (2 * sizeof(IOSCRsa2048RsaCert)))) || > (wadHdr->ticketSize != sizeof(ESTicket)) || > (wadHdr->tmdSize != (sizeof(IOSCSigRsa2048) > + sizeof(ESTitleMetaHeader) + sizeof(ESContentMeta))) || 575c590 < // printf("load wad header failed: BAD HEADER\n"); --- > // printf("load wad header failed: BAD HEADER\n"); 604c619 < verifySig(void *p, IOSCName *issuer, void *pubKey, CSLOSRsaExponent *exp, --- > verifySig( u32 base, void *p, IOSCName *issuer, void *pubKey, CSLOSRsaExponent *exp, 608c623,624 < u32 base, hashSize, ctx; --- > void *bp; > u32 hashSize, ctx; 616a633,649 > /* memcpy() could be abused for attacks if not checked; > * some of the wad header sizes have been checked to stay within the > * flash block, but some are combined, so we need to check p again; > * assert that copied size fits into 32k NAPA_BUFFER_2 > */ > bp = (void *)base; > rc = REASON_BADHEADER; > if (p < bp) { > goto verifySig_out; /* obvious violation */ > } > if (p > (bp + FL_BLOCK_SIZE)) { > goto verifySig_out; /* something is outside flash block */ > } > if (size >= NAPA_BUFFER_SIZE) { > goto verifySig_out; /* size too big */ > } > 652a686,691 > /* hashSize could still be bad if corrupted size is passed in > * it is unsigned, so can't be < 0, but roll over > */ > if (hashSize >= NAPA_BUFFER_SIZE) { > goto verifySig_out; > } 750,754d788 < #ifndef BOOT1_DISABLE_EFUSE < u32 i; < #endif < < /* TODO: Enable eFuse and EEPROM */ 784c818 < strncpy(issuerName, ES_ROOT_NAME, sizeof (IOSCName)); --- > strncpy(issuerName, ES_ROOT_NAME, SIZE_LIMCNAME); 787c821 < rc = verifySig(caCert, &issuerName, pubKey4096, exp, TYPE_CERT4096, --- > rc = verifySig(base, caCert, &issuerName, pubKey4096, exp, TYPE_CERT4096, 801,802c835,836 < strncat(issuerName, "-", sizeof (IOSCName)); < strncat(issuerName, *entityName, sizeof (IOSCName)); --- > strncat(issuerName, "-", 2); > strncat(issuerName, *entityName, SIZE_LIMCNAME); 805c839 < rc = verifySig(cpCert, &issuerName, pubKey2048, exp, TYPE_CERT2048, --- > rc = verifySig(base, cpCert, &issuerName, pubKey2048, exp, TYPE_CERT2048, 822,823c856,857 < strncat(issuerName, "-", sizeof (IOSCName)); < strncat(issuerName, *entityName, sizeof (IOSCName)); --- > strncat(issuerName, "-", 2); > strncat(issuerName, *entityName, SIZE_LIMCNAME); 826c860 < rc = verifySig(tmd, &issuerName, pubKey2048, exp, TYPE_TMD, --- > rc = verifySig(base, tmd, &issuerName, pubKey2048, exp, TYPE_TMD, 840c874 < rc = verifySig(xsCert, &issuerName, pubKey2048, exp, TYPE_CERT2048, --- > rc = verifySig(base, xsCert, &issuerName, pubKey2048, exp, TYPE_CERT2048, 853,854c887,888 < strncat(issuerName, "-", sizeof (IOSCName)); < strncat(issuerName, *entityName, sizeof (IOSCName)); --- > strncat(issuerName, "-", 2); > strncat(issuerName, *entityName, SIZE_LIMCNAME); 857c891 < rc = verifySig(ticket, &issuerName, pubKey2048, exp, TYPE_TICKET, --- > rc = verifySig(base, ticket, &issuerName, pubKey2048, exp, TYPE_TICKET, 863c897 < #ifdef BOOT1_DISABLE_EFUSE --- > /* Efuse use always disabled */ 865,879d898 < #else < /* Read the common key from eFuse */ < readEfuse(NV_RVL_COMMON_AES_KEY_OFF / sizeof (u32), (u8 *) commonKey, < NV_RVL_COMMON_AES_KEY_SIZE); < < /* If the common key is not programmed, use the default key */ < for (i = 0; i < NV_RVL_COMMON_AES_KEY_SIZE; i++) { < if (commonKey[i] != 0) { < break; < } < } < if (i == NV_RVL_COMMON_AES_KEY_SIZE) { < memcpy(commonKey, commonAesKey, sizeof (CSLOSAesKey)); < } < #endif 906a926,927 > #ifdef BOOT1_DISABLE_EEPROM > printf("boot2 version not checked. EEPROM use disabled\n"); 907a929,932 > #else > ver = EE_GetOsVersion(); > printf("boot2 version read from EEPROM: %d\n", ver); > #endif 910a936 > printf("boot1_compat failed: bad boot2 version\n"); 912a939 > printf("boot1_compat boot2 version check passed\n"); 929d955 < 1142c1168 < static void --- > void 1189c1215,1216 < /* setupEfuse ? */ --- > #ifndef BOOT1_DISABLE_EEPROM > /* GPIO for EEPROM access */ 1190a1218,1219 > EE_GPIOSetup(); > #endif 1195d1223 < // printf("load block map done\n"); 1211d1238 < // printf("skip bad blocks done\n"); 1215d1241 < // printf("load wad header failed: rc = 0x%x (%d)\n", rc, rc); 1218d1243 < // printf("load wad header done\n"); 1223d1247 < // printf("verify bundle failed: rc = %d\n", rc); 1226d1249 < // printf("verify bundle done\n"); 1237d1259 < // printf("loadboot2: base = 0x%x skipBytes = 0x%x\n", base, skipBytes); 1241d1262 < // printf("---- loadBoot2 dir: %u base: 0x%x returns \n", dir, base); Index: sw/rvl/include/iop.h =================================================================== RCS file: /home/routefree/ng/depot/sw/rvl/include/iop.h,v retrieving revision 1.31 retrieving revision 1.31.8.1 diff -r1.31 -r1.31.8.1 323a324,326 > > #define NAPA_BASE 0x00000000 > #define NAPA_SIZE 0x01800000 Index: sw/rvl/os/ios/Makefile =================================================================== RCS file: /home/routefree/ng/depot/sw/rvl/os/ios/Makefile,v retrieving revision 1.41 retrieving revision 1.41.8.4 diff -r1.41 -r1.41.8.4 12a13 > OS_CSL = ios_csl.elf 13a15 > OS_REAL_CSL = ios_real_csl.elf 24c26,27 < $(OS_SKIPEF) $(PROD_OS_REAL) $(PROD_BOOT2_OS_REAL) --- > $(OS_SKIPEF) $(PROD_OS_REAL) $(PROD_BOOT2_OS_REAL) \ > $(OS_CSL) $(OS_REAL_CSL) 104a108,123 > # keyglobals > keyglobals.o: $(BSL_LIB) > $(AR) x $(BSL_LIB) $@ > > # cslrsa_dev.o - Development version for CSL_VerifyRsaSig() > cslrsa_dev.o: $(CSL_DEV_LIB) > $(AR) x $(CSL_DEV_LIB) $@ > rm -f crypto_tmp/cslrsa*.o > mv $@ crypto_tmp/. > > # cslrsa.o - Production version for CSL_VerifyRsaSig() > cslrsa.o: $(CSL_LIB) > $(AR) x $(CSL_LIB) $@ > rm -f crypto_tmp/cslrsa*.o > mv $@ crypto_tmp/. > 124,125c143,145 < BSL_LIB =$(ROOT)/usr/lib/rvl/libcsl.a < CSL_LIB = $(ROOT)/usr/lib/rvl/libbsl.a --- > BSL_LIB = $(ROOT)/usr/lib/rvl/libbsl.a > CSL_LIB =$(ROOT)/usr/lib/rvl/libcsl.a > CSL_DEV_LIB =$(ROOT)/usr/lib/rvl/libcsl_dev.a 141a162 > rm crypto_tmp/keyglobals.o 143a165 > rm crypto_tmp/cslrsa.o 178,179c200,201 < CRYPTO_OBJS = init.o initc_crypto.o swi_crypto.o thread_crypto.o version.o root_devel.o nvram.o $(OBJECTS) < $(OS_CRYPTO): $(CRYPTO_LINKER_FILE) crypto_objs shell_objs $(CRYPTO_OBJS) --- > CRYPTO_OBJS = init.o initc_crypto.o swi_crypto.o thread_crypto.o version.o root_devel.o nvram.o keyglobals.o $(OBJECTS) > $(OS_CRYPTO): $(CRYPTO_LINKER_FILE) crypto_objs cslrsa_dev.o shell_objs $(CRYPTO_OBJS) 184a207,210 > # Real image with crypto, cslrsa and shell > $(OS_CSL): $(CRYPTO_LINKER_FILE) crypto_objs cslrsa.o shell_objs $(CRYPTO_OBJS) > $(CC) $(CFLAGS) -o $(OS_CSL) $(CRYPTO_OBJS) crypto_tmp/*.o shell_tmp/*.o $(LDFLAGS) $(LDLIBS) -T $(CRYPTO_LINKER_FILE) > 196,197c222,223 < REAL_OBJS = init.o initc_crypto.o swi_crypto.o thread_real.o version.o root_devel.o nvram.o $(OBJECTS) < $(OS_REAL): $(CRYPTO_LINKER_FILE) crypto_objs $(REAL_OBJS) --- > REAL_OBJS = init.o initc_crypto.o swi_crypto.o thread_real.o version.o root_devel.o nvram.o keyglobals.o $(OBJECTS) > $(OS_REAL): $(CRYPTO_LINKER_FILE) crypto_objs cslrsa_dev.o $(REAL_OBJS) 199a226,229 > # Real image with crypto, cslrsa and no shell > $(OS_REAL_CSL): $(CRYPTO_LINKER_FILE) crypto_objs cslrsa.o $(REAL_OBJS) > $(CC) $(CFLAGS) -o $(OS_REAL_CSL) $(REAL_OBJS) crypto_tmp/*.o $(LDFLAGS) $(LDLIBS) -T $(CRYPTO_LINKER_FILE) > 201,202c231,232 < SKIPEF_OBJS = init.o initc_crypto.o swi_crypto.o thread_real.o version.o root_prod.o nvram_skipef.o $(OBJECTS) < $(OS_SKIPEF): $(CRYPTO_LINKER_FILE) crypto_objs $(SKIPEF_OBJS) --- > SKIPEF_OBJS = init.o initc_crypto.o swi_crypto.o thread_real.o version.o root_prod.o nvram_skipef.o keyglobals.o $(OBJECTS) > $(OS_SKIPEF): $(CRYPTO_LINKER_FILE) crypto_objs cslrsa.o $(SKIPEF_OBJS) 206,207c236,237 < BOOT2_REAL_OBJS = init.o initc_crypto.o swi_crypto.o thread_real.o version_boot2.o root_devel.o nvram.o $(OBJECTS) < $(BOOT2_OS_REAL): crypto_objs $(BOOT2_REAL_OBJS) --- > BOOT2_REAL_OBJS = init.o initc_crypto.o swi_crypto.o thread_real.o version_boot2.o root_devel.o nvram.o keyglobals.o $(OBJECTS) > $(BOOT2_OS_REAL): crypto_objs cslrsa.o $(BOOT2_REAL_OBJS) 211,212c241,242 < PROD_REAL_OBJS = init.o initc_crypto.o swi_crypto.o thread_real.o version.o root_prod.o nvram_prod.o $(OBJECTS) < $(PROD_OS_REAL): $(CRYPTO_LINKER_FILE) crypto_objs $(PROD_REAL_OBJS) --- > PROD_REAL_OBJS = init.o initc_crypto.o swi_crypto.o thread_real.o version.o root_prod.o nvram_prod.o keyglobals.o $(OBJECTS) > $(PROD_OS_REAL): $(CRYPTO_LINKER_FILE) crypto_objs cslrsa.o $(PROD_REAL_OBJS) 216,217c246,247 < PROD_BOOT2_REAL_OBJS = init.o initc_crypto.o swi_crypto.o thread_real.o version_boot2.o root_prod.o nvram_prod.o $(OBJECTS) < $(PROD_BOOT2_OS_REAL): crypto_objs $(PROD_BOOT2_REAL_OBJS) --- > PROD_BOOT2_REAL_OBJS = init.o initc_crypto.o swi_crypto.o thread_real.o version_boot2.o root_prod.o nvram_prod.o keyglobals.o $(OBJECTS) > $(PROD_BOOT2_OS_REAL): crypto_objs cslrsa.o $(PROD_BOOT2_REAL_OBJS) Index: sw/rvl/os/ios/nvram.c =================================================================== RCS file: /home/routefree/ng/depot/sw/rvl/os/ios/nvram.c,v retrieving revision 1.13 retrieving revision 1.13.16.1 diff -r1.13 -r1.13.16.1 256,257c256,264 < readEfuse(NV_RVL_DEVICE_ECDH_KEY_OFF / sizeof (u32), deviceEcdhKey, < NV_RVL_DEVICE_ECDH_KEY_SIZE); --- > /* ** WARNING ** > * This is the correct line of code to read the device key: > * readEfuse(NV_RVL_DEVICE_ECDH_KEY_OFF / sizeof (u32), deviceEcdhKey, > * NV_RVL_DEVICE_ECDH_KEY_SIZE); > * It is being replaced with device id (a public quantity) > * so the key is not exposed in certain IOS. > */ > readEfuse(NV_RVL_DEVICE_ID_OFF / sizeof (u32), deviceEcdhKey, > NV_RVL_DEVICE_ID_SIZE); Index: sw/server/rsync.libs =================================================================== RCS file: /home/routefree/ng/depot/sw/server/rsync.libs,v retrieving revision 1.4 retrieving revision 1.4.18.1 diff -r1.4 -r1.4.18.1 2a3 > libcsl_dev.a