Skip to content

Bug/openssl pointers #18

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Removed commented lines
  • Loading branch information
olivierbrand committed Feb 6, 2023
commit df3bd93c8e0a6c7d6e5039bf2b75497a8cc84444
Original file line number Diff line number Diff line change
Expand Up @@ -424,34 +424,27 @@ fileprivate struct ReceiptParser {
return purchase
}

func DecodeASN1Integer(startOfInt intPointer: inout UnsafePointer<UInt8>?, length: Int) -> Int? {
// These will be set by ASN1_get_object
var type = Int32(0)
var xclass = Int32(0)
var intLength = 0

let ptrBackup = intPointer
ASN1_get_object(&intPointer, &intLength, &type, &xclass, length)

guard type == V_ASN1_INTEGER else {
return nil
}

// let integer = c2i_ASN1_INTEGER(nil, &intPointer, intLength)
// let result = ASN1_INTEGER_get(integer)
// ASN1_INTEGER_free(integer)
// return result

intPointer = ptrBackup

let integer = d2i_ASN1_UINTEGER(nil, &intPointer, length)
let result = ASN1_INTEGER_get(integer)
ASN1_INTEGER_free(integer)
return result


func DecodeASN1Integer(startOfInt intPointer: inout UnsafePointer<UInt8>?, length: Int) -> Int? {
// These will be set by ASN1_get_object
var type = Int32(0)
var xclass = Int32(0)
var intLength = 0

let ptrBackup = intPointer
ASN1_get_object(&intPointer, &intLength, &type, &xclass, length)

guard type == V_ASN1_INTEGER else {
return nil
}

intPointer = ptrBackup

let integer = d2i_ASN1_UINTEGER(nil, &intPointer, length)
let result = ASN1_INTEGER_get(integer)
ASN1_INTEGER_free(integer)
return result
}

func DecodeASN1String(startOfString stringPointer: inout UnsafePointer<UInt8>?, length: Int) -> String? {
// These will be set by ASN1_get_object
var type = Int32(0)
Expand Down