Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing return after completion in PIV signWithKeyInSlot #140

Open
samngms opened this issue Dec 11, 2023 · 1 comment
Open

Missing return after completion in PIV signWithKeyInSlot #140

samngms opened this issue Dec 11, 2023 · 1 comment

Comments

@samngms
Copy link
Contributor

samngms commented Dec 11, 2023

Whenever there is an error in signWithKeyInSlot, there will also be an "Illegal callback invocation from native module. This callback type only permits a single invocation from native code.", after investigation there is a missing "return" in the code.

- (void)signWithKeyInSlot:(YKFPIVSlot)slot type:(YKFPIVKeyType)keyType algorithm:(SecKeyAlgorithm)algorithm message:(nonnull NSData *)message completion:(nonnull YKFPIVSessionSignCompletionBlock)completion {
    NSError *padError = nil;
    NSData *payload = [YKFPIVPadding padData:message keyType:keyType algorithm:algorithm error:&padError];
    if (padError != nil) {
        completion(nil, padError);
        return; <--- missing this line
    }
    return [self usePrivateKeyInSlot:slot type:keyType message:payload exponentiation:false completion:^(NSData * _Nullable data, NSError * _Nullable error) {
        completion(data, error);
    }];
}
@samngms
Copy link
Contributor Author

samngms commented Dec 11, 2023

#141 is the fix, just add one line of the code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant