The Hedera services codebase is officially open source and can be found in the official GitHub repository: https://github.com/hashgraph/hedera-services.
You can read more about the open sourcing of Hedera services in this blog posting: https://www.hedera.com/blog/all-our-services-are-belong-to-you
The hashgraph algorithm source code has been audited by multiple code audit firms and the results of these audits will be made available with open review, expected in Q4 2020. Open review ensures the source code is made available for anyone to read, recompile, and verify that it is correct. For more information regarding open review of the hashgraph source code, please read the Hedera whitepaper.