[dev] How does one freeze funds, tokens or SOLs in a program?

Does Solana support that funds, tokens or SOLs) in a program be conditionally frozen? If so, how to implement it?