It's more elegant to reinterpret_cast the return value in crt->ExportChallenge. That gives ExportChallenge and ExportPublicKey the same return type which is nice from an API perspective. As a general observation, unchecked casts at call sites are a great way to hide bugs when the return type changes.