diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2018-08-16 17:49:49 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2018-08-16 17:49:49 +0000 |
commit | a68a8a0850a6bedde87bf85ca3779b3f3736df5f (patch) | |
tree | 309a4f386726ea25fa7cec4f0aac67bb30212be5 /lib/libssl/t1_lib.c | |
parent | 0963a4a5f74a5d3b6dc5c7df7a7912e5ec2b3724 (diff) |
Convert ssl3_send_server_key_exchange() to CBB.
ok inoguchi@ tb@
Diffstat (limited to 'lib/libssl/t1_lib.c')
-rw-r--r-- | lib/libssl/t1_lib.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/libssl/t1_lib.c b/lib/libssl/t1_lib.c index d92fd70f5b2..7f166942f79 100644 --- a/lib/libssl/t1_lib.c +++ b/lib/libssl/t1_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: t1_lib.c,v 1.141 2018/02/08 11:30:30 jsing Exp $ */ +/* $OpenBSD: t1_lib.c,v 1.142 2018/08/16 17:49:48 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1116,20 +1116,41 @@ tls12_find_id(int nid, tls12_lookup *table, size_t tlen) } int +tls12_get_sigandhash_cbb(CBB *cbb, const EVP_PKEY *pk, const EVP_MD *md) +{ + unsigned char p[2]; + + if (!tls12_get_sigandhash(p, pk, md)) + return 0; + + if (!CBB_add_u8(cbb, p[0])) + return 0; + if (!CBB_add_u8(cbb, p[1])) + return 0; + + return 1; +} + +int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk, const EVP_MD *md) { int sig_id, md_id; - if (!md) + + if (md == NULL) return 0; + md_id = tls12_find_id(EVP_MD_type(md), tls12_md, sizeof(tls12_md) / sizeof(tls12_lookup)); if (md_id == -1) return 0; + sig_id = tls12_get_sigid(pk); if (sig_id == -1) return 0; + p[0] = (unsigned char)md_id; p[1] = (unsigned char)sig_id; + return 1; } |