diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libssl/bs_cbs.c | 9 | ||||
| -rw-r--r-- | src/lib/libssl/bytestring.h | 8 | ||||
| -rw-r--r-- | src/lib/libssl/src/ssl/bs_cbs.c | 9 | ||||
| -rw-r--r-- | src/lib/libssl/src/ssl/bytestring.h | 8 |
4 files changed, 30 insertions, 4 deletions
diff --git a/src/lib/libssl/bs_cbs.c b/src/lib/libssl/bs_cbs.c index 1b513c9a0e..1368fe0fd7 100644 --- a/src/lib/libssl/bs_cbs.c +++ b/src/lib/libssl/bs_cbs.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bs_cbs.c,v 1.10 2015/06/16 06:11:39 doug Exp $ */ | 1 | /* $OpenBSD: bs_cbs.c,v 1.11 2015/06/17 07:00:22 doug Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014, Google Inc. | 3 | * Copyright (c) 2014, Google Inc. |
| 4 | * | 4 | * |
| @@ -28,6 +28,7 @@ void | |||
| 28 | CBS_init(CBS *cbs, const uint8_t *data, size_t len) | 28 | CBS_init(CBS *cbs, const uint8_t *data, size_t len) |
| 29 | { | 29 | { |
| 30 | cbs->data = data; | 30 | cbs->data = data; |
| 31 | cbs->initial_len = len; | ||
| 31 | cbs->len = len; | 32 | cbs->len = len; |
| 32 | } | 33 | } |
| 33 | 34 | ||
| @@ -43,6 +44,12 @@ cbs_get(CBS *cbs, const uint8_t **p, size_t n) | |||
| 43 | return 1; | 44 | return 1; |
| 44 | } | 45 | } |
| 45 | 46 | ||
| 47 | size_t | ||
| 48 | CBS_offset(const CBS *cbs) | ||
| 49 | { | ||
| 50 | return cbs->initial_len - cbs->len; | ||
| 51 | } | ||
| 52 | |||
| 46 | int | 53 | int |
| 47 | CBS_skip(CBS *cbs, size_t len) | 54 | CBS_skip(CBS *cbs, size_t len) |
| 48 | { | 55 | { |
diff --git a/src/lib/libssl/bytestring.h b/src/lib/libssl/bytestring.h index 07be6ddd50..80ca00d77a 100644 --- a/src/lib/libssl/bytestring.h +++ b/src/lib/libssl/bytestring.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bytestring.h,v 1.9 2015/06/16 06:37:58 doug Exp $ */ | 1 | /* $OpenBSD: bytestring.h,v 1.10 2015/06/17 07:00:22 doug Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014, Google Inc. | 3 | * Copyright (c) 2014, Google Inc. |
| 4 | * | 4 | * |
| @@ -40,6 +40,7 @@ extern "C" { | |||
| 40 | /* CRYPTO ByteString */ | 40 | /* CRYPTO ByteString */ |
| 41 | typedef struct cbs_st { | 41 | typedef struct cbs_st { |
| 42 | const uint8_t *data; | 42 | const uint8_t *data; |
| 43 | size_t initial_len; | ||
| 43 | size_t len; | 44 | size_t len; |
| 44 | } CBS; | 45 | } CBS; |
| 45 | 46 | ||
| @@ -66,6 +67,11 @@ const uint8_t *CBS_data(const CBS *cbs); | |||
| 66 | size_t CBS_len(const CBS *cbs); | 67 | size_t CBS_len(const CBS *cbs); |
| 67 | 68 | ||
| 68 | /* | 69 | /* |
| 70 | * CBS_offset returns the current offset into the original data of |cbs|. | ||
| 71 | */ | ||
| 72 | size_t CBS_offset(const CBS *cbs); | ||
| 73 | |||
| 74 | /* | ||
| 69 | * CBS_stow copies the current contents of |cbs| into |*out_ptr| and | 75 | * CBS_stow copies the current contents of |cbs| into |*out_ptr| and |
| 70 | * |*out_len|. If |*out_ptr| is not NULL, the contents are freed with | 76 | * |*out_len|. If |*out_ptr| is not NULL, the contents are freed with |
| 71 | * free. It returns one on success and zero on allocation failure. On | 77 | * free. It returns one on success and zero on allocation failure. On |
diff --git a/src/lib/libssl/src/ssl/bs_cbs.c b/src/lib/libssl/src/ssl/bs_cbs.c index 1b513c9a0e..1368fe0fd7 100644 --- a/src/lib/libssl/src/ssl/bs_cbs.c +++ b/src/lib/libssl/src/ssl/bs_cbs.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bs_cbs.c,v 1.10 2015/06/16 06:11:39 doug Exp $ */ | 1 | /* $OpenBSD: bs_cbs.c,v 1.11 2015/06/17 07:00:22 doug Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014, Google Inc. | 3 | * Copyright (c) 2014, Google Inc. |
| 4 | * | 4 | * |
| @@ -28,6 +28,7 @@ void | |||
| 28 | CBS_init(CBS *cbs, const uint8_t *data, size_t len) | 28 | CBS_init(CBS *cbs, const uint8_t *data, size_t len) |
| 29 | { | 29 | { |
| 30 | cbs->data = data; | 30 | cbs->data = data; |
| 31 | cbs->initial_len = len; | ||
| 31 | cbs->len = len; | 32 | cbs->len = len; |
| 32 | } | 33 | } |
| 33 | 34 | ||
| @@ -43,6 +44,12 @@ cbs_get(CBS *cbs, const uint8_t **p, size_t n) | |||
| 43 | return 1; | 44 | return 1; |
| 44 | } | 45 | } |
| 45 | 46 | ||
| 47 | size_t | ||
| 48 | CBS_offset(const CBS *cbs) | ||
| 49 | { | ||
| 50 | return cbs->initial_len - cbs->len; | ||
| 51 | } | ||
| 52 | |||
| 46 | int | 53 | int |
| 47 | CBS_skip(CBS *cbs, size_t len) | 54 | CBS_skip(CBS *cbs, size_t len) |
| 48 | { | 55 | { |
diff --git a/src/lib/libssl/src/ssl/bytestring.h b/src/lib/libssl/src/ssl/bytestring.h index 07be6ddd50..80ca00d77a 100644 --- a/src/lib/libssl/src/ssl/bytestring.h +++ b/src/lib/libssl/src/ssl/bytestring.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bytestring.h,v 1.9 2015/06/16 06:37:58 doug Exp $ */ | 1 | /* $OpenBSD: bytestring.h,v 1.10 2015/06/17 07:00:22 doug Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014, Google Inc. | 3 | * Copyright (c) 2014, Google Inc. |
| 4 | * | 4 | * |
| @@ -40,6 +40,7 @@ extern "C" { | |||
| 40 | /* CRYPTO ByteString */ | 40 | /* CRYPTO ByteString */ |
| 41 | typedef struct cbs_st { | 41 | typedef struct cbs_st { |
| 42 | const uint8_t *data; | 42 | const uint8_t *data; |
| 43 | size_t initial_len; | ||
| 43 | size_t len; | 44 | size_t len; |
| 44 | } CBS; | 45 | } CBS; |
| 45 | 46 | ||
| @@ -66,6 +67,11 @@ const uint8_t *CBS_data(const CBS *cbs); | |||
| 66 | size_t CBS_len(const CBS *cbs); | 67 | size_t CBS_len(const CBS *cbs); |
| 67 | 68 | ||
| 68 | /* | 69 | /* |
| 70 | * CBS_offset returns the current offset into the original data of |cbs|. | ||
| 71 | */ | ||
| 72 | size_t CBS_offset(const CBS *cbs); | ||
| 73 | |||
| 74 | /* | ||
| 69 | * CBS_stow copies the current contents of |cbs| into |*out_ptr| and | 75 | * CBS_stow copies the current contents of |cbs| into |*out_ptr| and |
| 70 | * |*out_len|. If |*out_ptr| is not NULL, the contents are freed with | 76 | * |*out_len|. If |*out_ptr| is not NULL, the contents are freed with |
| 71 | * free. It returns one on success and zero on allocation failure. On | 77 | * free. It returns one on success and zero on allocation failure. On |
