X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=ssl%2Ft1_lib.c;h=eea78029da4ae7ccddb26152a1b1f6ffd1426783;hp=696998fe5eab030382a435f4a17713b126e14c32;hb=418a18a2deddc0b0d6181de0008219c899ca6ddf;hpb=b2b3024e0eef58589f7a49ebd48da98d4564a348 diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c index 696998fe5e..eea78029da 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c @@ -1209,7 +1209,7 @@ int ssl_add_clienthello_tlsext(SSL *s, WPACKET *pkt, int *al) idlen = i2d_OCSP_RESPID(id, NULL); if (idlen <= 0 /* Sub-packet for an individual id */ - || !WPACKET_sub_allocate_bytes_u8(pkt, idlen, &idbytes) + || !WPACKET_sub_allocate_bytes_u16(pkt, idlen, &idbytes) || i2d_OCSP_RESPID(id, &idbytes) != idlen) { SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return 0; @@ -3119,7 +3119,32 @@ static int tls12_find_nid(int id, const tls12_lookup *table, size_t tlen) return NID_undef; } -int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk, const EVP_MD *md) +int tls12_get_sigandhash(WPACKET *pkt, const EVP_PKEY *pk, const EVP_MD *md) +{ + int sig_id, md_id; + + if (md == NULL) + return 0; + md_id = tls12_find_id(EVP_MD_type(md), tls12_md, OSSL_NELEM(tls12_md)); + if (md_id == -1) + return 0; + sig_id = tls12_get_sigid(pk); + if (sig_id == -1) + return 0; + if (!WPACKET_put_bytes(pkt, md_id, 1) || !WPACKET_put_bytes(pkt, sig_id, 1)) + return 0; + + return 1; +} + +/* + * Old version of the tls12_get_sigandhash function used by code that has not + * yet been converted to WPACKET yet. It will be deleted once WPACKET conversion + * is complete. + * TODO - DELETE ME + */ +int tls12_get_sigandhash_old(unsigned char *p, const EVP_PKEY *pk, + const EVP_MD *md) { int sig_id, md_id; if (!md)