diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h index 1cdb7ad3..81741162 100644 --- a/include/openssl/ssl.h +++ b/include/openssl/ssl.h @@ -2702,13 +2702,6 @@ OPENSSL_EXPORT void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(const SSL *ssl, * for the peer, but |SSL_read| will require the handshake to be completed. */ OPENSSL_EXPORT int SSL_in_false_start(const SSL *s); -/* Obtain latest Finished message - * -- that we sent (SSL_get_finished) - * -- that we expected from peer (SSL_get_peer_finished). - * Returns length (0 == no Finished so far), copies up to 'count' bytes. */ -OPENSSL_EXPORT size_t SSL_get_finished(const SSL *s, void *buf, size_t count); -OPENSSL_EXPORT size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count); - #define d2i_SSL_SESSION_bio(bp, s_id) \ ASN1_d2i_bio_of(SSL_SESSION, SSL_SESSION_new, d2i_SSL_SESSION, bp, s_id) #define i2d_SSL_SESSION_bio(bp, s_id) \ @@ -3120,6 +3113,21 @@ OPENSSL_EXPORT int SSL_want(const SSL *ssl); #define SSL_want_private_key_operation(ssl) \ (SSL_want(ssl) == SSL_PRIVATE_KEY_OPERATION) + /* SSL_get_finished writes up to |count| bytes of the Finished message sent by + * |ssl| to |buf|. It returns the total untruncated length or zero if none has + * been sent yet. + * + * Use |SSL_get_tls_unique| instead. */ +OPENSSL_EXPORT size_t SSL_get_finished(const SSL *ssl, void *buf, size_t count); + + /* SSL_get_peer_finished writes up to |count| bytes of the Finished message + * received from |ssl|'s peer to |buf|. It returns the total untruncated length + * or zero if none has been received yet. + * + * Use |SSL_get_tls_unique| instead. */ +OPENSSL_EXPORT size_t SSL_get_peer_finished(const SSL *ssl, void *buf, + size_t count); + /* Private structures. * diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 4218deeb..57a76faf 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -1163,31 +1163,29 @@ err: return ret; } -/* return length of latest Finished message we sent, copy to 'buf' */ -size_t SSL_get_finished(const SSL *s, void *buf, size_t count) { +size_t SSL_get_finished(const SSL *ssl, void *buf, size_t count) { size_t ret = 0; - if (s->s3 != NULL) { - ret = s->s3->tmp.finish_md_len; + if (ssl->s3 != NULL) { + ret = ssl->s3->tmp.finish_md_len; if (count > ret) { count = ret; } - memcpy(buf, s->s3->tmp.finish_md, count); + memcpy(buf, ssl->s3->tmp.finish_md, count); } return ret; } -/* return length of latest Finished message we expected, copy to 'buf' */ -size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count) { +size_t SSL_get_peer_finished(const SSL *ssl, void *buf, size_t count) { size_t ret = 0; - if (s->s3 != NULL) { - ret = s->s3->tmp.peer_finish_md_len; + if (ssl->s3 != NULL) { + ret = ssl->s3->tmp.peer_finish_md_len; if (count > ret) { count = ret; } - memcpy(buf, s->s3->tmp.peer_finish_md, count); + memcpy(buf, ssl->s3->tmp.peer_finish_md, count); } return ret;