Skip to content

Commit

Permalink
Merge pull request #13 from h2o/master
Browse files Browse the repository at this point in the history
Aligning with H2O
  • Loading branch information
huitema authored Nov 28, 2017
2 parents b83cae9 + b8020b7 commit d54b1c5
Show file tree
Hide file tree
Showing 5 changed files with 388 additions and 289 deletions.
5 changes: 5 additions & 0 deletions include/picotls.h
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,11 @@ int ptls_hkdf_extract(ptls_hash_algorithm_t *hash, void *output, ptls_iovec_t sa
*
*/
int ptls_hkdf_expand(ptls_hash_algorithm_t *hash, void *output, size_t outlen, ptls_iovec_t prk, ptls_iovec_t info);
/**
*
*/
int ptls_hkdf_expand_label(ptls_hash_algorithm_t *algo, void *output, size_t outlen, ptls_iovec_t secret, const char *label,
ptls_iovec_t hash_value);
/**
* instantiates an AEAD cipher given a secret, which is expanded using hkdf to a set of key and iv
* @param aead
Expand Down
10 changes: 7 additions & 3 deletions lib/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@
#include "picotls.h"
#include "picotls/openssl.h"

#define OPENSSL_1_0_API (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER))
#if (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER))
#define OPENSSL_1_0_API 1
#else
#define OPENSSL_1_0_API 0
#endif

#if OPENSSL_1_0_API

Expand Down Expand Up @@ -901,7 +905,7 @@ int ptls_openssl_encrypt_ticket(ptls_buffer_t *buf, ptls_iovec_t src,
goto Exit;
}
dst += clen;
if (!EVP_EncryptFinal(cctx, dst, &clen)) {
if (!EVP_EncryptFinal_ex(cctx, dst, &clen)) {
ret = PTLS_ERROR_LIBRARY;
goto Exit;
}
Expand Down Expand Up @@ -980,7 +984,7 @@ int ptls_openssl_decrypt_ticket(ptls_buffer_t *buf, ptls_iovec_t src,
goto Exit;
}
buf->off += clen;
if (!EVP_DecryptFinal(cctx, buf->base + buf->off, &clen)) {
if (!EVP_DecryptFinal_ex(cctx, buf->base + buf->off, &clen)) {
ret = PTLS_ERROR_LIBRARY;
goto Exit;
}
Expand Down
Loading

0 comments on commit d54b1c5

Please sign in to comment.