Skip to content

Possible Linking Issue #5

@knightcode

Description

@knightcode

Trying to build a method in objc to do HKDF:

@import OpenSSL;

BOOL hkdf(unsigned char* input,
          int inputLen,
          char* salt,
          int saltLen,
          char* label,
          int labelLen,
          unsigned char* output,
          size_t outlen,
          NSError*__autoreleasing * error) {

  EVP_PKEY_CTX *pctx;
  pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, NULL);
  int ret_val;
  if ((ret_val = EVP_PKEY_derive_init(pctx)) <= 0) {
    ERR_print_errors_fp(stderr);
    buildError(error, [[NSString alloc] initWithFormat:@"Failed initializing HKDF algorithm: %i", ret_val]);
    return false;
  }
  ...
}

But this is failing at execution time at the _init call, and the ERR_print_errors_fp() call is printing this:

5435106712:error:06000080:public key routines:OPENSSL_internal:UNSUPPORTED_ALGORITHM:../../../../src/third_party/boringssl/src/crypto/evp/evp_ctx.c:100:algorithm 1036
5435106712:error:0600007d:public key routines:OPENSSL_internal:OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE:../../../../src/third_party/boringssl/src/crypto/evp/evp_ctx.c:329:

I'm concerned about the file paths printed in the errors that suggest BoringSSL is somehow interfering here, i.e. it's version of the API is getting linked to my project instead of the framework's, and it doesn't implement the HKDF alg. If that's the case, is there a way to fix it?

Xcode: 14.0.1
OpenSSL: 1.1.1q

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