Skip to content

Missing return after completion in PIV signWithKeyInSlot #140

@samngms

Description

@samngms

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);
    }];
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions