int i2o_ECPublicKey()

in source/ec_override.c [236:256]


int i2o_ECPublicKey(const EC_KEY *key, unsigned char **out) {
    assert(ec_key_is_valid(key));
    assert(out);           // Assuming that it's always called in ESDK with non-NULL out
    assert(*out == NULL);  // Assuming that it's always called with NULL *out, so buffer needs to be allocated

    if (!key) return 0;

    int buf_len;
    __CPROVER_assume(0 < buf_len);
    *out = malloc(buf_len);

    if (*out == NULL) {
        int error_code;
        __CPROVER_assume(error_code <= 0);
        return error_code;  // Retuns 0 or negative value on error
    }

    // Should *out be incremented?

    return buf_len;
}