#include <openssl/ssl.h>
- int SSL_get_client_random(const SSL *ssl, unsigned char *out, int outlen);
- int SSL_get_server_random(const SSL *ssl, unsigned char *out, int outlen);
- int SSL_SESSION_get_master_key(const SSL_SESSION *session, unsigned char *out, int outlen);
+ int SSL_get_client_random(const SSL *ssl, unsigned char *out, size_t outlen);
+ int SSL_get_server_random(const SSL *ssl, unsigned char *out, size_t outlen);
+ int SSL_SESSION_get_master_key(const SSL_SESSION *session, unsigned char *out, size_t outlen);
=head1 DESCRIPTION
void SSL_set_verify_result(SSL *ssl, long v);
__owur long SSL_get_verify_result(const SSL *ssl);
-__owur int SSL_get_client_random(const SSL *ssl, unsigned char *out, int outlen);
-__owur int SSL_get_server_random(const SSL *ssl, unsigned char *out, int outlen);
-__owur int SSL_SESSION_get_master_key(const SSL_SESSION *ssl, unsigned char *out, int outlen);
+__owur int SSL_get_client_random(const SSL *ssl, unsigned char *out,
+ size_t outlen);
+__owur int SSL_get_server_random(const SSL *ssl, unsigned char *out,
+ size_t outlen);
+__owur int SSL_SESSION_get_master_key(const SSL_SESSION *ssl,
+ unsigned char *out, size_t outlen);
__owur int SSL_set_ex_data(SSL *ssl, int idx, void *data);
void *SSL_get_ex_data(const SSL *ssl, int idx);
return (ssl->verify_result);
}
-int SSL_get_client_random(const SSL *ssl, unsigned char *out, int outlen)
+int SSL_get_client_random(const SSL *ssl, unsigned char *out, size_t outlen)
{
- if (outlen < 0)
+ if (outlen == 0)
return sizeof(ssl->s3->client_random);
if (outlen > sizeof(ssl->s3->client_random))
outlen = sizeof(ssl->s3->client_random);
return (outlen);
}
-int SSL_get_server_random(const SSL *ssl, unsigned char *out, int outlen)
+int SSL_get_server_random(const SSL *ssl, unsigned char *out, size_t outlen)
{
- if (outlen < 0)
+ if (outlen == 0)
return sizeof(ssl->s3->server_random);
if (outlen > sizeof(ssl->s3->server_random))
outlen = sizeof(ssl->s3->server_random);
}
int SSL_SESSION_get_master_key(const SSL_SESSION *session,
- unsigned char *out, int outlen)
+ unsigned char *out, size_t outlen)
{
- if (outlen < 0)
+ if (outlen == 0)
return session->master_key_length;
- if (outlen > session->master_key_length)
+ if (session->master_key_length < 0) {
+ /* Should never happen */
+ return 0;
+ }
+ if (outlen > (size_t)session->master_key_length)
outlen = session->master_key_length;
memcpy(out, session->master_key, outlen);
return (outlen);