On the Mac, SecStaticCode and SecCode provide code signing and verification functionality. Specifically, SecCodeCopySelf() and SecCodeCheckValidityWithErrors() would be used to check the code signing of the current application.
Note that an application that has been modified and resigned (with the same certificate or any other) is effectively impossible to detect, since anyone capable of modifying the application and resigning it can stub out or otherwise defeat your verification code. The functions named above are, at best, a keep-honest-people-honest solution.
On iOS, Apple's official position is that you shouldn't attempt to do jailbreak detection or similar, and should trust the OS to get it right. Since you cannot run dynamically loaded code or read the binary data of other applications, it is not very useful to be able to verify code signing on that platform. (Whether or not Apple's official position is useful to you is another discussion entirely.)