Reputation: 1269
I'm compiling OpenSSL 1.1.0h on MacOS and I'm running into a problem where the function int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp)
is not defined in any of the include files. Grep-ing the OpenSSL source I see that the function is defined in asn1_locl.h, and a_int.c files but its not being exposed in the compiled libraries public interface.
Basically I'm playing around with some Apple In App Purchase receipt validation examples and they all assume this function is being defined in asn1.h. i2c_ASN1_INTEGER is used for /* Convert ASN1 INTEGER content octets to ASN1_INTEGER structure */
.
I'm using the following commands to compile the library:
./Configure darwin64-x86_64-cc
make depend
make
When I build OpenSSL 1.0.2o using this process the function is defined in asn1.h as expected...
Upvotes: 2
Views: 555
Reputation: 2419
For the case of Apple receipt parsing, since we're not using with large integers (such as BIGNUM), here's a little function that can parse the integer to a long long.
long long longLongFromASN1Content(const uint8_t *ptr, int length) {
assert(length <= sizeof(long long));
long long v = 0;
for (int i = 0; i< length; i++) {
if (i > 0) v <<= 8;
v |= ptr[i];
}
return v;
}
Upvotes: 1
Reputation: 1
Grep-ing the OpenSSL source I see that the function is defined in asn1_locl.h, and a_int.c files but its not being exposed in the compiled libraries public interface.
There were significant changes to OpenSSL in version 1.1.0, directly removing significant functionality from the public interface:
This page discusses the API changes for OpenSSL version 1.1. The overall goal of the API changes is to make many data structures opaque to applications. Data hiding provides a number of benefits:
- Fields can be changed without breaking binary compatibility
- Applications are more robust and can be more assured about correctness
- It helps determine which (new) accessors and settors, for example, are needed
Applications which support both OpenSSL 1.0.2 (and below) and OpenSSL 1.1.0 (and above) should visit the section Compatibility Layer below. The Compatibility Layer provides OpenSSL 1.1.0 functions, like RSA_get0_key, to OpenSSL 1.0.2 clients. The source code is available for download below
If you find your library or program used to work with OpenSSL 1.0.2 but no longer works with OpenSSL 1.1.0, then please add details to discussion below at Things that no longer work.
Regarding
they all assume this function is being defined in asn1.h
I'd go so far as to say that is not a good assumption for OpenSSL v1.1.0.
Upvotes: 1