diff options
Diffstat (limited to 'src/lib/libcrypto/ct/ct_local.h')
| -rw-r--r-- | src/lib/libcrypto/ct/ct_local.h | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/src/lib/libcrypto/ct/ct_local.h b/src/lib/libcrypto/ct/ct_local.h index 14d1e5d7e9..109d50255b 100644 --- a/src/lib/libcrypto/ct/ct_local.h +++ b/src/lib/libcrypto/ct/ct_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ct_local.h,v 1.4 2021/12/05 09:37:46 tb Exp $ */ | 1 | /* $OpenBSD: ct_local.h,v 1.5 2021/12/18 15:59:50 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. | 3 | * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. |
| 4 | * | 4 | * |
| @@ -9,26 +9,24 @@ | |||
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #include <stddef.h> | 11 | #include <stddef.h> |
| 12 | |||
| 12 | #include <openssl/ct.h> | 13 | #include <openssl/ct.h> |
| 13 | #include <openssl/evp.h> | 14 | #include <openssl/evp.h> |
| 14 | #include <openssl/x509.h> | 15 | #include <openssl/x509.h> |
| 15 | #include <openssl/x509v3.h> | 16 | #include <openssl/x509v3.h> |
| 16 | #include <openssl/safestack.h> | 17 | #include <openssl/safestack.h> |
| 17 | 18 | ||
| 18 | /* | 19 | /* Number of bytes in an SCT v1 LogID - see RFC 6962 section 3.2. */ |
| 19 | * From RFC6962: opaque SerializedSCT<1..2^16-1>; struct { SerializedSCT | 20 | #define CT_V1_LOG_ID_LEN 32 |
| 20 | * sct_list <1..2^16-1>; } SignedCertificateTimestampList; | 21 | |
| 21 | */ | 22 | /* Maximum size of an SCT - see RFC 6962 section 3.3. */ |
| 22 | #define MAX_SCT_SIZE 65535 | 23 | #define MAX_SCT_SIZE 65535 |
| 23 | #define MAX_SCT_LIST_SIZE MAX_SCT_SIZE | 24 | #define MAX_SCT_LIST_SIZE MAX_SCT_SIZE |
| 24 | 25 | ||
| 25 | /* | 26 | /* |
| 26 | * Macros to read and write integers in network-byte order. | 27 | * Macros to write integers in network-byte order. |
| 27 | */ | 28 | */ |
| 28 | 29 | ||
| 29 | #define n2s(c,s) ((s=(((unsigned int)((c)[0]))<< 8)| \ | ||
| 30 | (((unsigned int)((c)[1])) )),c+=2) | ||
| 31 | |||
| 32 | #define s2n(s,c) ((c[0]=(unsigned char)(((s)>> 8)&0xff), \ | 30 | #define s2n(s,c) ((c[0]=(unsigned char)(((s)>> 8)&0xff), \ |
| 33 | c[1]=(unsigned char)(((s) )&0xff)),c+=2) | 31 | c[1]=(unsigned char)(((s) )&0xff)),c+=2) |
| 34 | 32 | ||
| @@ -36,15 +34,6 @@ | |||
| 36 | c[1]=(unsigned char)(((l)>> 8)&0xff), \ | 34 | c[1]=(unsigned char)(((l)>> 8)&0xff), \ |
| 37 | c[2]=(unsigned char)(((l) )&0xff)),c+=3) | 35 | c[2]=(unsigned char)(((l) )&0xff)),c+=3) |
| 38 | 36 | ||
| 39 | #define n2l8(c,l) (l =((uint64_t)(*((c)++)))<<56, \ | ||
| 40 | l|=((uint64_t)(*((c)++)))<<48, \ | ||
| 41 | l|=((uint64_t)(*((c)++)))<<40, \ | ||
| 42 | l|=((uint64_t)(*((c)++)))<<32, \ | ||
| 43 | l|=((uint64_t)(*((c)++)))<<24, \ | ||
| 44 | l|=((uint64_t)(*((c)++)))<<16, \ | ||
| 45 | l|=((uint64_t)(*((c)++)))<< 8, \ | ||
| 46 | l|=((uint64_t)(*((c)++)))) | ||
| 47 | |||
| 48 | #define l2n8(l,c) (*((c)++)=(unsigned char)(((l)>>56)&0xff), \ | 37 | #define l2n8(l,c) (*((c)++)=(unsigned char)(((l)>>56)&0xff), \ |
| 49 | *((c)++)=(unsigned char)(((l)>>48)&0xff), \ | 38 | *((c)++)=(unsigned char)(((l)>>48)&0xff), \ |
| 50 | *((c)++)=(unsigned char)(((l)>>40)&0xff), \ | 39 | *((c)++)=(unsigned char)(((l)>>40)&0xff), \ |
