INNER CODE UNIT · C

msg_signed_len

jedisct1/libsodium-php · libsodium.c:1428

    msg_signed_len = msg_len + crypto_sign_BYTES;
    msg_signed = zend_string_checked_alloc((size_t) msg_signed_len, 0);
    if (crypto_sign((unsigned char *) ZSTR_VAL(msg_signed),
                    &msg_signed_real_len, msg,
                    (unsigned long long) msg_len, secretkey) != 0) {
        zend_string_free(msg_signed);
        zend_throw_exception(sodium_exception_ce, "internal error", 0);
        return;
    }
    if (msg_signed_real_len >= SIZE_MAX || msg_signed_real_len > msg_signed_len) {
        zend_string_free(msg_signed);
        zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
        return;
    }
    PHP_SODIUM_ZSTR_TRUNCATE(msg_signed, (size_t) msg_signed_real_len);

    RETURN_STR(msg_signed);
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…