cloud9_root/src/cloud9/lib/Core/CacheDriver.cpp
// check for byte-level information leak from path constraints (miss-sequence-based observers)
check for byte-level information leak from path constraints (miss-sequence-based observers)
check for byte - level information leak from path constraints ( miss - sequence - based observers )
void CacheDriver::checkForByteLeakSeqFromPathConstraints(ExecutionState& state, TimingSolver* solver) {
	fprintf(stdout, "\n\n#### Now checking information leak through path constraints and miss sequence ####\n\n");
	fflush(stdout);
	std::map< std::pair<unsigned long, bool>, ref<Expr> >::iterator it;
	state.constraints().clean();
	for (it = missSeqToState.begin(); it != missSeqToState.end(); it++) {
		if ((*it).first.second) {
			std::pair<unsigned long, bool> test((*it).first.first, false);
			if (!missSeqToState.count(test)) {
				fprintf(stdout, "\n\n##### NO information leak detected for access %lu\n\n", (*it).first.first);
				fflush(stdout);
				continue;
			}
		} else {
			std::pair<unsigned long, bool> test((*it).first.first, true);
			if (!missSeqToState.count(test)) {
				fprintf(stdout, "\n\n##### NO information leak detected for access %lu\n\n", (*it).first.first);
				fflush(stdout);
				continue;
			}
		}
		ExecutionState cState(state);
		cState.addConstraint((*it).second);
		for (int nbyte = 0; nbyte < SIZE_OF_SECRET; nbyte++) {
			fprintf(stdout, "\n\n###### checking potential information leak via byte %d, access %lu\n\n", nbyte, (*it).first.first);
			bool leak = false;
			for (int value = 0x00; value <= 0xFF; value++) {
				ref<Expr> byteCnstr = constrainOneByte(cState, nbyte, value);
				int nsolutionD = CacheChannel::solveAllConstraints(cState, solver, byteCnstr, 1);
				if (1 != nsolutionD) {
					fprintf(stdout, "\n\n##### (**) information leak detected in byte %d, access %lu\n", nbyte, (*it).first.first);
					leak = true;
				}
			}
			if (leak == false) {
				fprintf(stdout, "\n\n##### NO information leak found via byte %d, access %lu\n", nbyte, (*it).first.first);
			}
		}
	}
}
void CacheDriver :: checkForByteLeakSeqFromPathConstraints ( ExecutionState & state , TimingSolver * solver ) { fprintf ( stdout , " \n \n \n \n " ) ; fflush ( stdout ) ; std :: map < std :: pair < unsigned long , bool > , ref < Expr > > :: iterator it ; state . constraints ( ) . clean ( ) ; for ( it = missSeqToState . begin ( ) ; it != missSeqToState . end ( ) ; it ++ ) { if ( ( * it ) . first . second ) { std :: pair < unsigned long , bool > test ( ( * it ) . first . first , false ) ; if ( ! missSeqToState . count ( test ) ) { fprintf ( stdout , " \n \n \n \n " , ( * it ) . first . first ) ; fflush ( stdout ) ; continue ; } } else { std :: pair < unsigned long , bool > test ( ( * it ) . first . first , true ) ; if ( ! missSeqToState . count ( test ) ) { fprintf ( stdout , " \n \n \n \n " , ( * it ) . first . first ) ; fflush ( stdout ) ; continue ; } } ExecutionState cState ( state ) ; cState . addConstraint ( ( * it ) . second ) ; for ( int nbyte = 0 ; nbyte < SIZE_OF_SECRET ; nbyte ++ ) { fprintf ( stdout , " \n \n \n \n " , nbyte , ( * it ) . first . first ) ; bool leak = false ; for ( int value = 0x00 ; value <= 0xFF ; value ++ ) { ref < Expr > byteCnstr = constrainOneByte ( cState , nbyte , value ) ; int nsolutionD = CacheChannel :: solveAllConstraints ( cState , solver , byteCnstr , 1 ) ; if ( 1 != nsolutionD ) { fprintf ( stdout , " \n \n \n " , nbyte , ( * it ) . first . first ) ; leak = true ; } } if ( leak == false ) { fprintf ( stdout , " \n \n \n " , nbyte , ( * it ) . first . first ) ; } } } }
check for byte-level information leak from path constraints (miss-sequence-based observers)
check for byte - level information leak from path constraints ( miss - sequence - based observers )
/* clean the initial constraints */ /* iterate over all possible observations */ /* check initial constraints (fast path) */ /* create initial state vector for the respective observation */ /* check whether the solution is different for different value of each byte (total 256*16 calls) */