-/* $OpenBSD: ssl_clnt.c,v 1.31 2018/08/17 16:28:21 jsing Exp $ */
+/* $OpenBSD: ssl_clnt.c,v 1.32 2018/08/19 15:38:03 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
&hdata);
md = s->cert->key->digest;
if (hdatalen <= 0 ||
- !tls12_get_sigandhash_cbb(&cert_verify, pkey, md)) {
+ !tls12_get_hashandsig(&cert_verify, pkey, md)) {
SSLerror(s, ERR_R_INTERNAL_ERROR);
goto err;
}
-/* $OpenBSD: ssl_locl.h,v 1.206 2018/08/16 17:49:48 jsing Exp $ */
+/* $OpenBSD: ssl_locl.h,v 1.207 2018/08/19 15:38:03 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
#define tlsext_tick_md EVP_sha256
int tls1_process_ticket(SSL *s, const unsigned char *session_id, int len,
const unsigned char *limit, SSL_SESSION **ret);
-int tls12_get_sigandhash_cbb(CBB *cbb, const EVP_PKEY *pk,
- const EVP_MD *md);
-int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk,
- const EVP_MD *md);
+int tls12_get_hashid(const EVP_MD *md);
int tls12_get_sigid(const EVP_PKEY *pk);
+int tls12_get_hashandsig(CBB *cbb, const EVP_PKEY *pk, const EVP_MD *md);
const EVP_MD *tls12_get_hash(unsigned char hash_alg);
void ssl_clear_hash_ctx(EVP_MD_CTX **hash);
-/* $OpenBSD: ssl_srvr.c,v 1.40 2018/08/19 15:29:26 jsing Exp $ */
+/* $OpenBSD: ssl_srvr.c,v 1.41 2018/08/19 15:38:03 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
/* Send signature algorithm. */
if (SSL_USE_SIGALGS(s)) {
- if (!tls12_get_sigandhash_cbb(&server_kex, pkey,
- md)) {
+ if (!tls12_get_hashandsig(&server_kex, pkey, md)) {
/* Should never happen */
al = SSL_AD_INTERNAL_ERROR;
SSLerror(s, ERR_R_INTERNAL_ERROR);
-/* $OpenBSD: t1_lib.c,v 1.142 2018/08/16 17:49:48 jsing Exp $ */
+/* $OpenBSD: t1_lib.c,v 1.143 2018/08/19 15:38:03 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
}
int
-tls12_get_sigandhash_cbb(CBB *cbb, const EVP_PKEY *pk, const EVP_MD *md)
+tls12_get_hashid(const EVP_MD *md)
{
- unsigned char p[2];
+ if (md == NULL)
+ return -1;
- if (!tls12_get_sigandhash(p, pk, md))
- return 0;
+ return tls12_find_id(EVP_MD_type(md), tls12_md,
+ sizeof(tls12_md) / sizeof(tls12_lookup));
+}
- if (!CBB_add_u8(cbb, p[0]))
- return 0;
- if (!CBB_add_u8(cbb, p[1]))
- return 0;
+int
+tls12_get_sigid(const EVP_PKEY *pk)
+{
+ if (pk == NULL)
+ return -1;
- return 1;
+ return tls12_find_id(pk->type, tls12_sig,
+ sizeof(tls12_sig) / sizeof(tls12_lookup));
}
int
-tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk, const EVP_MD *md)
+tls12_get_hashandsig(CBB *cbb, const EVP_PKEY *pk, const EVP_MD *md)
{
- int sig_id, md_id;
+ int hash_id, sig_id;
- if (md == NULL)
+ if ((hash_id = tls12_get_hashid(md)) == -1)
return 0;
-
- md_id = tls12_find_id(EVP_MD_type(md), tls12_md,
- sizeof(tls12_md) / sizeof(tls12_lookup));
- if (md_id == -1)
+ if ((sig_id = tls12_get_sigid(pk)) == -1)
return 0;
- sig_id = tls12_get_sigid(pk);
- if (sig_id == -1)
+ if (!CBB_add_u8(cbb, hash_id))
+ return 0;
+ if (!CBB_add_u8(cbb, sig_id))
return 0;
-
- p[0] = (unsigned char)md_id;
- p[1] = (unsigned char)sig_id;
return 1;
}
-int
-tls12_get_sigid(const EVP_PKEY *pk)
-{
- return tls12_find_id(pk->type, tls12_sig,
- sizeof(tls12_sig) / sizeof(tls12_lookup));
-}
-
const EVP_MD *
tls12_get_hash(unsigned char hash_alg)
{