After years of doing engine swaps in CA, here is what I know. These are the most restrictive rules I've dealt with. The EPA rules basically go like this:
1- the engine you use must be same year or newer. This is a VERY grey area. For instance, if you want to swap a chevy V8 into your 97 chevy V6 pickup, you could use a 1975 shortblock, as long as you have all the smog equipment and EFI from a 97 truck. Technically, its not legal, but they have no reasonable means to check that.
2- the engine must be from the same class of vehicle. Again, a very grey area. You can't use a truck engine in a car and vice versa. The reason is, truck engines don't conform to the same emissions regulations as cars. As you can imagine, though, they don't really check. If you want to re-power your Mustang 5.0, you can sneak by with a 302 from a truck... as long as the emissions equipment is from a car.
3- Optional engines don't require any recertification. For instance, if you have a V6 mustang and want to drop in a same-year V8, no worries. The mustang was available with both engines, and both engines fell under the same emissions requirements for any given model year. There are some caveats to that.... The "same year or newer" still applies. If you have a 92 Mustang 5.0L and want to swap in a 99 4.6L, it is qualified as an "engine change." and your 92 'stang now MUST conform 99 emissions rules since the 4.6L wasn't an option in 92.
4- Cross-branding follows the same guidelines. You can put a 99 Viper V10 in your 99 Camry, as long as you carry over the Viper's emissions control equipment. I spent hours on the phone with a CA referee discussing a Viper swap into a 96 Caprice. The letter of the law requires everything to be from the Viper, including air filter, exhaust tubing up to the last O2 sensor, evap canister, all 4 factory cats, etc. The referee was understanding and pragmatic. He basically said that as long as all of those systems are fully functional AND pass the sniffer, he would issue a sticker. They know that using everything from the Viper is not possible. They also know that 99% of the techs couldn't identify a Viper air filter anyway. They won't open the hood and fail you for a K&N intake.
OBD-2 swaps are easier than you think (in some ways). OBD2 is mostly universal. The communication protocols were at least standardized into 5 different languages regardless of make or model. Smog tests can include any of the following: visual, plug-in, and sniffer. As long as you've done it right, the plug-in and sniffer are a breeze. The visual can be trouble if you have a tech who knows anything.
Think of it this way... The law is written so that anything that would cause a check engine light is illegal. For instance, I'm putting a T56 manual in my 96 Impala SS. The computer would set multiple codes since it is programmed to control an automatic that isn't there. I can simply re-flash the computer with information from a 96 camaro manual and it won't throw codes.
Tell us more about your swap ideas and we can help a bit more.