OSStatus noErr check inconsistent

Hi, I have code that has been in production for over a year with no issues, encrypting a string and checking the OSStatus as follows.

Code Block
let blockSize = SecKeyGetBlockSize(publickeysi!)
var messageEncrypted = [UInt8](repeating: 0, count: blockSize)
var messageEncryptedSize = blockSize
let status: OSStatus = SecKeyEncrypt(publickeysi!, SecPadding.PKCS1, impressionString!, impressionString!.count, &messageEncrypted, &messageEncryptedSize)
if status != noErr {
    print("Encryption Error!") // iPhone12 gets here
}


The issue is that the latest devices seem to be returning status = noErr, whilst all previous devices have been fine. An iPhone 12 and Pro reliably return error, whilst iPhone 8, 8 Plus, XR all succeed with no error.

The output of method is still functional despite noErr, but it would be good to understand what may cause this inconsistent behaviour across devices.

Thanks

I think it's because now, noErr has turned into errSecSuccess.

OSStatus noErr check inconsistent
 
 
Q