Skip to content

ssl/crypto uses two allocation idioms for the same job #108

Description

@SeanTAllen

ssl/crypto allocates its output buffers two ways.

@pony_alloc(@pony_ctx(), size) then from_cpointer, nine sites:

  • ssl/crypto/hash_fn.pony: the eight hash primitives (MD4 through SHA512), each with Array[U8].from_cpointer.
  • ssl/crypto/digest.pony: final(), with String.from_cpointer.

Array[U8].init(0, size), three sites:

  • ssl/crypto/rand_bytes.pony
  • ssl/crypto/hmac_sha256.pony
  • ssl/crypto/pbkdf2_sha256.pony

Both allocate a fixed-size buffer for OpenSSL to write into. #77 removed a comment that claimed the two differ for the garbage collector; they do not. It left unifying them as a separate question. This is that question.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions