commit 204b83336bd39b073da7ac23ad93d1077fa706d6 parent 9ebd663749f477eb62e3baebafaaa739163c57a8 Author: t3sserakt <t3ss@posteo.de> Date: Tue, 29 Jul 2025 19:16:13 +0200 Curl and wolfssl as shared libraries. Diffstat:
159 files changed, 65751 insertions(+), 0 deletions(-)
diff --git a/android_studio/distribution/libcurl/lib/arm64-v8a/libcurl.so b/android_studio/distribution/libcurl/lib/arm64-v8a/libcurl.so Binary files differ. diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/callbacks.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/callbacks.h @@ -0,0 +1,93 @@ +/* callbacks.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + +#ifndef WOLFSSL_CALLBACKS_H +#define WOLFSSL_CALLBACKS_H + +#include <wolfssl/wolfcrypt/wc_port.h> + +#ifdef __cplusplus + extern "C" { +#endif + + +enum { /* CALLBACK CONSTANTS */ + MAX_PACKETNAME_SZ = 24, + MAX_CIPHERNAME_SZ = 24, + MAX_TIMEOUT_NAME_SZ = 24, + MAX_PACKETS_HANDSHAKE = 14, /* 12 for client auth plus 2 alerts */ + MAX_VALUE_SZ = 128 /* all handshake packets but Cert should + fit here */ +}; + +struct WOLFSSL; + +typedef struct handShakeInfo_st { + struct WOLFSSL* ssl; + char cipherName[MAX_CIPHERNAME_SZ + 1]; /* negotiated cipher */ + char packetNames[MAX_PACKETS_HANDSHAKE][MAX_PACKETNAME_SZ + 1]; + /* SSL packet names */ + int numberPackets; /* actual # of packets */ + int negotiationError; /* cipher/parameter err */ +} HandShakeInfo; + + +#if defined(HAVE_SYS_TIME_H) && !defined(NO_TIMEVAL) + typedef struct timeval WOLFSSL_TIMEVAL; +#else /* HAVE_SYS_TIME_H */ + /* Define the timeval explicitly. */ + typedef struct { + long tv_sec; /* Seconds. */ + long tv_usec; /* Microseconds. */ + } WOLFSSL_TIMEVAL; +#endif /* HAVE_SYS_TIME_H */ +#if !defined(NO_OLD_TIMEVAL_NAME) + #define Timeval WOLFSSL_TIMEVAL +#endif + +typedef struct packetInfo_st { + char packetName[MAX_PACKETNAME_SZ + 1]; /* SSL packet name */ + WOLFSSL_TIMEVAL timestamp; /* when it occurred */ + unsigned char value[MAX_VALUE_SZ]; /* if fits, it's here */ + unsigned char* bufferValue; /* otherwise here (non 0) */ + int valueSz; /* sz of value or buffer */ +} PacketInfo; + + +typedef struct timeoutInfo_st { + char timeoutName[MAX_TIMEOUT_NAME_SZ + 1]; /* timeout Name */ + int flags; /* for future use */ + int numberPackets; /* actual # of packets */ + PacketInfo packets[MAX_PACKETS_HANDSHAKE]; /* list of all packets */ + WOLFSSL_TIMEVAL timeoutValue; /* timer that caused it */ +} TimeoutInfo; + + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + + +#endif /* WOLFSSL_CALLBACKS_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/certs_test.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/certs_test.h @@ -0,0 +1,7073 @@ +/* certs_test.h */ +/* This file was generated using: ./gencertbuf.pl */ + +#ifndef WOLFSSL_CERTS_TEST_H +#define WOLFSSL_CERTS_TEST_H + +#ifdef USE_CERT_BUFFERS_1024 + +/* ./certs/1024/client-key.der, 1024-bit */ +static const unsigned char client_key_der_1024[] = +{ + 0x30, 0x82, 0x02, 0x5C, 0x02, 0x01, 0x00, 0x02, 0x81, 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x19, 0x55, + 0x30, 0xBA, 0xB7, 0x48, 0x8C, 0x48, 0x14, 0x0E, 0xF4, 0x9F, + 0x7E, 0x77, 0x97, 0x43, 0xE1, 0xB4, 0x19, 0x35, 0x31, 0x23, + 0x75, 0x9C, 0x3B, 0x44, 0xAD, 0x69, 0x12, 0x56, 0xEE, 0x00, + 0x61, 0x64, 0x16, 0x66, 0xD3, 0x7C, 0x74, 0x2B, 0x15, 0xB4, + 0xA2, 0xFE, 0xBF, 0x08, 0x6B, 0x1A, 0x5D, 0x3F, 0x90, 0x12, + 0xB1, 0x05, 0x86, 0x31, 0x29, 0xDB, 0xD9, 0xE2 +}; +static const int sizeof_client_key_der_1024 = sizeof(client_key_der_1024); + +/* ./certs/1024/client-keyPub.der, 1024-bit */ +static const unsigned char client_keypub_der_1024[] = +{ + 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, + 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, + 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xBC, + 0x73, 0x0E, 0xA8, 0x49, 0xF3, 0x74, 0xA2, 0xA9, 0xEF, 0x18, + 0xA5, 0xDA, 0x55, 0x99, 0x21, 0xF9, 0xC8, 0xEC, 0xB3, 0x6D, + 0x48, 0xE5, 0x35, 0x35, 0x75, 0x77, 0x37, 0xEC, 0xD1, 0x61, + 0x90, 0x5F, 0x3E, 0xD9, 0xE4, 0xD5, 0xDF, 0x94, 0xCA, 0xC1, + 0xA9, 0xD7, 0x19, 0xDA, 0x86, 0xC9, 0xE8, 0x4D, 0xC4, 0x61, + 0x36, 0x82, 0xFE, 0xAB, 0xAD, 0x7E, 0x77, 0x25, 0xBB, 0x8D, + 0x11, 0xA5, 0xBC, 0x62, 0x3A, 0xA8, 0x38, 0xCC, 0x39, 0xA2, + 0x04, 0x66, 0xB4, 0xF7, 0xF7, 0xF3, 0xAA, 0xDA, 0x4D, 0x02, + 0x0E, 0xBB, 0x5E, 0x8D, 0x69, 0x48, 0xDC, 0x77, 0xC9, 0x28, + 0x0E, 0x22, 0xE9, 0x6B, 0xA4, 0x26, 0xBA, 0x4C, 0xE8, 0xC1, + 0xFD, 0x4A, 0x6F, 0x2B, 0x1F, 0xEF, 0x8A, 0xAE, 0xF6, 0x90, + 0x62, 0xE5, 0x64, 0x1E, 0xEB, 0x2B, 0x3C, 0x67, 0xC8, 0xDC, + 0x27, 0x00, 0xF6, 0x91, 0x68, 0x65, 0xA9, 0x02, 0x03, 0x01, + 0x00, 0x01 +}; +static const int sizeof_client_keypub_der_1024 = sizeof(client_keypub_der_1024); + +/* ./certs/1024/client-cert.der, 1024-bit */ +static const unsigned char client_cert_der_1024[] = +{ + 0x30, 0x82, 0x04, 0x18, 0x30, 0x82, 0x03, 0x81, 0xA0, 0x03, + 0x02, 0x01, 0x02, 0x02, 0x14, 0x09, 0x1D, 0x03, 0x41, 0x8B, + 0x92, 0xBD, 0x2A, 0x2A, 0x1C, 0x77, 0xE0, 0x13, 0xA8, 0x3D, + 0xF0, 0x33, 0xDA, 0x7F, 0x72, 0x30, 0x0D, 0x06, 0x09, 0x2A, + 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, + 0x30, 0x81, 0x9E, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, + 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, + 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, + 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, + 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, + 0x61, 0x6E, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, + 0x0A, 0x0C, 0x0C, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, + 0x5F, 0x31, 0x30, 0x32, 0x34, 0x31, 0x19, 0x30, 0x17, 0x06, + 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x10, 0x50, 0x72, 0x6F, 0x67, + 0x72, 0x61, 0x6D, 0x6D, 0x69, 0x6E, 0x67, 0x2D, 0x31, 0x30, + 0x32, 0x34, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, + 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, + 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, + 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, + 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x32, 0x34, 0x31, 0x32, 0x31, + 0x38, 0x32, 0x31, 0x32, 0x35, 0x32, 0x39, 0x5A, 0x17, 0x0D, + 0x32, 0x37, 0x30, 0x39, 0x31, 0x34, 0x32, 0x31, 0x32, 0x35, + 0x32, 0x39, 0x5A, 0x30, 0x81, 0x9E, 0x31, 0x0B, 0x30, 0x09, + 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, + 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, + 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, + 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, + 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x15, 0x30, 0x13, 0x06, + 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x0C, 0x77, 0x6F, 0x6C, 0x66, + 0x53, 0x53, 0x4C, 0x5F, 0x31, 0x30, 0x32, 0x34, 0x31, 0x19, + 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x10, 0x50, + 0x72, 0x6F, 0x67, 0x72, 0x61, 0x6D, 0x6D, 0x69, 0x6E, 0x67, + 0x2D, 0x31, 0x30, 0x32, 0x34, 0x31, 0x18, 0x30, 0x16, 0x06, + 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, + 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, + 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, + 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, + 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, + 0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, + 0x81, 0x81, 0x00, 0xBC, 0x73, 0x0E, 0xA8, 0x49, 0xF3, 0x74, + 0xA2, 0xA9, 0xEF, 0x18, 0xA5, 0xDA, 0x55, 0x99, 0x21, 0xF9, + 0xC8, 0xEC, 0xB3, 0x6D, 0x48, 0xE5, 0x35, 0x35, 0x75, 0x77, + 0x37, 0xEC, 0xD1, 0x61, 0x90, 0x5F, 0x3E, 0xD9, 0xE4, 0xD5, + 0xDF, 0x94, 0xCA, 0xC1, 0xA9, 0xD7, 0x19, 0xDA, 0x86, 0xC9, + 0xE8, 0x4D, 0xC4, 0x61, 0x36, 0x82, 0xFE, 0xAB, 0xAD, 0x7E, + 0x77, 0x25, 0xBB, 0x8D, 0x11, 0xA5, 0xBC, 0x62, 0x3A, 0xA8, + 0x38, 0xCC, 0x39, 0xA2, 0x04, 0x66, 0xB4, 0xF7, 0xF7, 0xF3, + 0xAA, 0xDA, 0x4D, 0x02, 0x0E, 0xBB, 0x5E, 0x8D, 0x69, 0x48, + 0xDC, 0x77, 0xC9, 0x28, 0x0E, 0x22, 0xE9, 0x6B, 0xA4, 0x26, + 0xBA, 0x4C, 0xE8, 0xC1, 0xFD, 0x4A, 0x6F, 0x2B, 0x1F, 0xEF, + 0x8A, 0xAE, 0xF6, 0x90, 0x62, 0xE5, 0x64, 0x1E, 0xEB, 0x2B, + 0x3C, 0x67, 0xC8, 0xDC, 0x27, 0x00, 0xF6, 0x91, 0x68, 0x65, + 0xA9, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x82, 0x01, 0x4F, + 0x30, 0x82, 0x01, 0x4B, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, + 0x0E, 0x04, 0x16, 0x04, 0x14, 0x81, 0x69, 0x0F, 0xF8, 0xDF, + 0xDD, 0xCF, 0x34, 0x29, 0xD5, 0x67, 0x75, 0x71, 0x85, 0xC7, + 0x75, 0x10, 0x69, 0x59, 0xEC, 0x30, 0x81, 0xDE, 0x06, 0x03, + 0x55, 0x1D, 0x23, 0x04, 0x81, 0xD6, 0x30, 0x81, 0xD3, 0x80, + 0x14, 0x81, 0x69, 0x0F, 0xF8, 0xDF, 0xDD, 0xCF, 0x34, 0x29, + 0xD5, 0x67, 0x75, 0x71, 0x85, 0xC7, 0x75, 0x10, 0x69, 0x59, + 0xEC, 0xA1, 0x81, 0xA4, 0xA4, 0x81, 0xA1, 0x30, 0x81, 0x9E, + 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, + 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, + 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, + 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, + 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, + 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x0C, + 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x5F, 0x31, 0x30, + 0x32, 0x34, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, + 0x0B, 0x0C, 0x10, 0x50, 0x72, 0x6F, 0x67, 0x72, 0x61, 0x6D, + 0x6D, 0x69, 0x6E, 0x67, 0x2D, 0x31, 0x30, 0x32, 0x34, 0x31, + 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, + 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, + 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, + 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, + 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, + 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82, 0x14, + 0x09, 0x1D, 0x03, 0x41, 0x8B, 0x92, 0xBD, 0x2A, 0x2A, 0x1C, + 0x77, 0xE0, 0x13, 0xA8, 0x3D, 0xF0, 0x33, 0xDA, 0x7F, 0x72, + 0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30, + 0x03, 0x01, 0x01, 0xFF, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x1D, + 0x11, 0x04, 0x15, 0x30, 0x13, 0x82, 0x0B, 0x65, 0x78, 0x61, + 0x6D, 0x70, 0x6C, 0x65, 0x2E, 0x63, 0x6F, 0x6D, 0x87, 0x04, + 0x7F, 0x00, 0x00, 0x01, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, + 0x25, 0x04, 0x16, 0x30, 0x14, 0x06, 0x08, 0x2B, 0x06, 0x01, + 0x05, 0x05, 0x07, 0x03, 0x01, 0x06, 0x08, 0x2B, 0x06, 0x01, + 0x05, 0x05, 0x07, 0x03, 0x02, 0x30, 0x0D, 0x06, 0x09, 0x2A, + 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, + 0x03, 0x81, 0x81, 0x00, 0x9A, 0x1C, 0x8F, 0xC4, 0xBD, 0x54, + 0xDA, 0x63, 0xA7, 0xF8, 0xBA, 0x39, 0xB6, 0x64, 0x60, 0x9D, + 0xBA, 0xA5, 0xFC, 0x43, 0xF5, 0x57, 0x28, 0x31, 0x43, 0x09, + 0x4C, 0x03, 0x4C, 0xB8, 0xC3, 0x49, 0x2B, 0x4E, 0xBF, 0xF2, + 0x9B, 0x13, 0x4E, 0x37, 0x1E, 0xA1, 0x57, 0xC6, 0x0C, 0x7B, + 0x2C, 0x25, 0x19, 0x37, 0x9F, 0x06, 0x53, 0xEF, 0x8D, 0xD1, + 0xBA, 0xC0, 0x73, 0x6E, 0x7F, 0xC2, 0x0B, 0x46, 0x5F, 0x9B, + 0x56, 0xBB, 0x59, 0x19, 0x5C, 0xC9, 0xEE, 0xEA, 0x02, 0xDA, + 0x03, 0x2C, 0xFB, 0x29, 0xB6, 0x07, 0xDD, 0x55, 0xB7, 0xE9, + 0xCE, 0x60, 0x47, 0xE0, 0x6B, 0x44, 0x5A, 0x61, 0x74, 0x5C, + 0x96, 0xF6, 0x30, 0xD8, 0x1B, 0xA4, 0x15, 0x5E, 0x06, 0xC5, + 0x73, 0x4B, 0x8A, 0x4D, 0x94, 0x23, 0x13, 0x1B, 0x3F, 0xDB, + 0x67, 0xCA, 0xA7, 0xA6, 0x41, 0xC5, 0x28, 0x0F, 0xFD, 0x2E, + 0x0E, 0xF0 +}; +static const int sizeof_client_cert_der_1024 = sizeof(client_cert_der_1024); + +/* ./certs/1024/dh1024.der, 1024-bit */ +static const unsigned char dh_key_der_1024[] = +{ + 0x30, 0x81, 0x87, 0x02, 0x81, 0x81, 0x00, 0xA4, 0xD2, 0xB8, + 0x6E, 0x78, 0xF5, 0xD9, 0xED, 0x2D, 0x7C, 0xDD, 0xB6, 0x16, + 0x86, 0x5A, 0x4B, 0x05, 0x76, 0x90, 0xDD, 0x66, 0x61, 0xB9, + 0x6D, 0x52, 0xA7, 0x1C, 0xAF, 0x62, 0xC6, 0x69, 0x47, 0x7B, + 0x39, 0xF2, 0xFB, 0x94, 0xEC, 0xBC, 0x79, 0xFF, 0x24, 0x5E, + 0xEF, 0x79, 0xBB, 0x59, 0xB2, 0xFC, 0xCA, 0x07, 0xD6, 0xF4, + 0xE9, 0x34, 0xF7, 0xE8, 0x38, 0xE7, 0xD7, 0x33, 0x44, 0x1D, + 0xA3, 0x64, 0x76, 0x1A, 0x84, 0x97, 0x54, 0x74, 0x40, 0x84, + 0x1F, 0x15, 0xFE, 0x7C, 0x25, 0x2A, 0x2B, 0x25, 0xFD, 0x9E, + 0xC1, 0x89, 0x33, 0x8C, 0x39, 0x25, 0x2B, 0x40, 0xE6, 0xCD, + 0xF8, 0xA8, 0xA1, 0x8A, 0x53, 0xC6, 0x47, 0xB2, 0xA0, 0xD7, + 0x8F, 0xEB, 0x2E, 0x60, 0x0A, 0x0D, 0x4B, 0xF8, 0xB4, 0x94, + 0x8C, 0x63, 0x0A, 0xAD, 0xC7, 0x10, 0xEA, 0xC7, 0xA1, 0xB9, + 0x9D, 0xF2, 0xA8, 0x37, 0x73, 0x02, 0x01, 0x02 +}; +static const int sizeof_dh_key_der_1024 = sizeof(dh_key_der_1024); + +/* ./certs/1024/dsa1024.der, 1024-bit */ +static const unsigned char dsa_key_der_1024[] = +{ + 0x30, 0x82, 0x01, 0xBC, 0x02, 0x01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 0x7B, 0x90, 0x63, 0x2B, + 0x90, 0x22, 0xC5, 0x18, 0x05, 0x80, 0x53, 0xAF, 0x83, 0x1F, + 0x54, 0xE2, 0xB0, 0xA2, 0x0B, 0x5A, 0x92, 0x24, 0xE1, 0x62, + 0x28, 0x3F, 0xB7, 0xCA, 0xB9, 0x89, 0xD6, 0xA0, 0xB7, 0xAD, + 0xAE, 0x05, 0xE1, 0xC1, 0x59, 0x40, 0xED, 0x4A, 0x1B, 0x68, + 0xA7, 0x7B, 0xFB, 0xC3, 0x20, 0x81, 0xEF, 0x4B, 0xF3, 0x69, + 0x91, 0xB0, 0xCE, 0x3A, 0xB0, 0x38, 0x02, 0x14, 0x25, 0x38, + 0x3B, 0xA1, 0x19, 0x75, 0xDF, 0x9B, 0xF5, 0x72, 0x53, 0x4F, + 0x39, 0xE1, 0x1C, 0xEC, 0x13, 0x84, 0x82, 0x18 +}; +static const int sizeof_dsa_key_der_1024 = sizeof(dsa_key_der_1024); + +/* ./certs/1024/rsa1024.der, 1024-bit */ +static const unsigned char rsa_key_der_1024[] = +{ + 0x30, 0x82, 0x02, 0x5D, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, + 0x00, 0xBE, 0x70, 0x70, 0xB8, 0x04, 0x18, 0xE5, 0x28, 0xFE, + 0x66, 0xD8, 0x90, 0x88, 0xE0, 0xF1, 0xB7, 0xC3, 0xD0, 0xD2, + 0x3E, 0xE6, 0x4B, 0x94, 0x74, 0xB0, 0xFF, 0xB0, 0xF7, 0x63, + 0xA5, 0xAB, 0x7E, 0xAF, 0xB6, 0x2B, 0xB7, 0x38, 0x16, 0x1A, + 0x50, 0xBF, 0xF1, 0xCA, 0x87, 0x3A, 0xD5, 0xB0, 0xDA, 0xF8, + 0x43, 0x7A, 0x15, 0xB9, 0x7E, 0xEA, 0x2A, 0x80, 0xD2, 0x51, + 0xB0, 0x35, 0xAF, 0x07, 0xF3, 0xF2, 0x5D, 0x24, 0x3A, 0x4B, + 0x87, 0x56, 0x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15, 0x3A, 0x3E, 0x7F, 0x2F, 0x32, 0xAB, + 0xCB, 0x6B, 0x4A, 0xB7, 0xC8, 0xB7, 0x41, 0x3B, 0x92, 0x43, + 0x78, 0x46, 0x17, 0x51, 0x86, 0xC9, 0xFC, 0xEB, 0x8B, 0x8F, + 0x41, 0xCA, 0x08, 0x9B, 0xBF, 0x02, 0x41, 0x00, 0xAD, 0x9B, + 0x89, 0xB6, 0xF2, 0x8C, 0x70, 0xDA, 0xE4, 0x10, 0x04, 0x6B, + 0x11, 0x92, 0xAF, 0x5A, 0xCA, 0x08, 0x25, 0xBF, 0x60, 0x07, + 0x11, 0x1D, 0x68, 0x7F, 0x5A, 0x1F, 0x55, 0x28, 0x74, 0x0B, + 0x21, 0x8D, 0x21, 0x0D, 0x6A, 0x6A, 0xFB, 0xD9, 0xB5, 0x4A, + 0x7F, 0x47, 0xF7, 0xD0, 0xB6, 0xC6, 0x41, 0x02, 0x97, 0x07, + 0x49, 0x93, 0x1A, 0x9B, 0x33, 0x68, 0xB3, 0xA2, 0x61, 0x32, + 0xA5, 0x89, 0x02, 0x41, 0x00, 0x8F, 0xEF, 0xAD, 0xB5, 0xB0, + 0xB0, 0x7E, 0x86, 0x03, 0x43, 0x93, 0x6E, 0xDD, 0x3C, 0x2D, + 0x9B, 0x6A, 0x55, 0xFF, 0x6F, 0x3E, 0x70, 0x2A, 0xD4, 0xBF, + 0x1F, 0x8C, 0x93, 0x60, 0x9E, 0x6D, 0x2F, 0x18, 0x6C, 0x11, + 0x36, 0x98, 0x3F, 0x10, 0x78, 0xE8, 0x3E, 0x8F, 0xFE, 0x55, + 0xB9, 0x9E, 0xD5, 0x5B, 0x2E, 0x87, 0x1C, 0x58, 0xD0, 0x37, + 0x89, 0x96, 0xEC, 0x48, 0x54, 0xF5, 0x9F, 0x0F, 0xB3 +}; +static const int sizeof_rsa_key_der_1024 = sizeof(rsa_key_der_1024); + +/* ./certs/1024/ca-key.der, 1024-bit */ +static const unsigned char ca_key_der_1024[] = +{ + 0x30, 0x82, 0x02, 0x5E, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, + 0x00, 0xCD, 0xAC, 0xDD, 0x47, 0xEC, 0xBE, 0xB7, 0x24, 0xC3, + 0x63, 0x1B, 0x54, 0x98, 0x79, 0xE1, 0xC7, 0x31, 0x16, 0x59, + 0xD6, 0x9D, 0x77, 0x9D, 0x8D, 0xE2, 0x8B, 0xED, 0x04, 0x17, + 0xB2, 0xC6, 0xEB, 0xE4, 0x9B, 0x91, 0xBE, 0x31, 0x50, 0x62, + 0x97, 0x58, 0xB5, 0x7F, 0x29, 0xDE, 0xB3, 0x71, 0x24, 0x0B, + 0xBF, 0x97, 0x09, 0x7F, 0x26, 0xDC, 0x2D, 0xEC, 0xA8, 0x2E, + 0xB2, 0x64, 0x2B, 0x7A, 0x2B, 0x35, 0x19, 0x2D, 0xA2, 0x80, + 0xCB, 0x99, 0xFD, 0x94, 0x71, 0x1B, 0x23, 0x8D, 0x54, 0xDB, + 0x2E, 0x62, 0x8D, 0x81, 0x08, 0x2D, 0xF4, 0x24, 0x72, 0x27, + 0x6C, 0xF9, 0xC9, 0x8E, 0xDB, 0x4C, 0x75, 0xBA, 0x9B, 0x01, + 0xF8, 0x3F, 0x18, 0xF4, 0xE6, 0x7F, 0xFB, 0x57, 0x94, 0x92, + 0xCC, 0x88, 0xC4, 0xB4, 0x00, 0xC2, 0xAA, 0xD4, 0xE5, 0x88, + 0x18, 0xB3, 0x11, 0x2F, 0x73, 0xC0, 0xD6, 0x29, 0x09, 0x02, + 0x03, 0x01, 0x00, 0x01, 0x02, 0x81, 0x80, 0x52, 0x35, 0x3D, + 0x01, 0x29, 0xA4, 0x95, 0x29, 0x71, 0x9B, 0x64, 0x6A, 0x2C, + 0xC3, 0xD2, 0xB5, 0xBE, 0x6E, 0x13, 0x9C, 0x8F, 0xB6, 0x26, + 0xD8, 0x76, 0x6B, 0xBD, 0x61, 0xBC, 0x63, 0x2D, 0xD5, 0x4D, + 0xB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0x6F, 0x90, 0x09, 0x02, 0x41, 0x00, 0x91, 0xE4, 0x2E, 0xCA, + 0x8C, 0x0A, 0x69, 0x2F, 0x62, 0xE2, 0x62, 0x3B, 0xA5, 0x8D, + 0x5A, 0x2C, 0x56, 0x3E, 0x7F, 0x67, 0x42, 0x92, 0x12, 0x92, + 0x5F, 0xF3, 0x97, 0xDD, 0xE1, 0xA9, 0x7F, 0xAD, 0x2E, 0x2D, + 0xF4, 0x4A, 0x57, 0xB3, 0x7A, 0x10, 0xBD, 0xD7, 0xE4, 0xEC, + 0x6A, 0x08, 0x21, 0xE9, 0xF2, 0x46, 0x49, 0xD2, 0x69, 0x47, + 0x8A, 0x20, 0x4B, 0xF2, 0xB1, 0x52, 0x83, 0xAB, 0x6F, 0x10 + +}; +static const int sizeof_ca_key_der_1024 = sizeof(ca_key_der_1024); + +/* ./certs/1024/ca-cert.der, 1024-bit */ +static const unsigned char ca_cert_der_1024[] = +{ + 0x30, 0x82, 0x04, 0x09, 0x30, 0x82, 0x03, 0x72, 0xA0, 0x03, + 0x02, 0x01, 0x02, 0x02, 0x14, 0x59, 0x52, 0x6B, 0x92, 0x1A, + 0x25, 0x8F, 0x1B, 0xEE, 0x4C, 0x51, 0x9C, 0x47, 0x2F, 0xFF, + 0xFF, 0x9D, 0x43, 0x29, 0x47, 0x30, 0x0D, 0x06, 0x09, 0x2A, + 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, + 0x30, 0x81, 0x99, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, + 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, + 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, + 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, + 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, + 0x61, 0x6E, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, + 0x0A, 0x0C, 0x08, 0x53, 0x61, 0x77, 0x74, 0x6F, 0x6F, 0x74, + 0x68, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x0B, + 0x0C, 0x0F, 0x43, 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, + 0x6E, 0x67, 0x5F, 0x31, 0x30, 0x32, 0x34, 0x31, 0x18, 0x30, + 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, + 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, + 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, + 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, + 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, + 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x1E, 0x17, 0x0D, + 0x32, 0x34, 0x31, 0x32, 0x31, 0x38, 0x32, 0x31, 0x32, 0x35, + 0x32, 0x39, 0x5A, 0x17, 0x0D, 0x32, 0x37, 0x30, 0x39, 0x31, + 0x34, 0x32, 0x31, 0x32, 0x35, 0x32, 0x39, 0x5A, 0x30, 0x81, + 0x99, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, + 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, + 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, + 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, + 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, + 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, + 0x08, 0x53, 0x61, 0x77, 0x74, 0x6F, 0x6F, 0x74, 0x68, 0x31, + 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0F, + 0x43, 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, 0x6E, 0x67, + 0x5F, 0x31, 0x30, 0x32, 0x34, 0x31, 0x18, 0x30, 0x16, 0x06, + 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, + 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, + 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, + 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, + 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, + 0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, + 0x81, 0x81, 0x00, 0xCD, 0xAC, 0xDD, 0x47, 0xEC, 0xBE, 0xB7, + 0x24, 0xC3, 0x63, 0x1B, 0x54, 0x98, 0x79, 0xE1, 0xC7, 0x31, + 0x16, 0x59, 0xD6, 0x9D, 0x77, 0x9D, 0x8D, 0xE2, 0x8B, 0xED, + 0x04, 0x17, 0xB2, 0xC6, 0xEB, 0xE4, 0x9B, 0x91, 0xBE, 0x31, + 0x50, 0x62, 0x97, 0x58, 0xB5, 0x7F, 0x29, 0xDE, 0xB3, 0x71, + 0x24, 0x0B, 0xBF, 0x97, 0x09, 0x7F, 0x26, 0xDC, 0x2D, 0xEC, + 0xA8, 0x2E, 0xB2, 0x64, 0x2B, 0x7A, 0x2B, 0x35, 0x19, 0x2D, + 0xA2, 0x80, 0xCB, 0x99, 0xFD, 0x94, 0x71, 0x1B, 0x23, 0x8D, + 0x54, 0xDB, 0x2E, 0x62, 0x8D, 0x81, 0x08, 0x2D, 0xF4, 0x24, + 0x72, 0x27, 0x6C, 0xF9, 0xC9, 0x8E, 0xDB, 0x4C, 0x75, 0xBA, + 0x9B, 0x01, 0xF8, 0x3F, 0x18, 0xF4, 0xE6, 0x7F, 0xFB, 0x57, + 0x94, 0x92, 0xCC, 0x88, 0xC4, 0xB4, 0x00, 0xC2, 0xAA, 0xD4, + 0xE5, 0x88, 0x18, 0xB3, 0x11, 0x2F, 0x73, 0xC0, 0xD6, 0x29, + 0x09, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x82, 0x01, 0x4A, + 0x30, 0x82, 0x01, 0x46, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, + 0x0E, 0x04, 0x16, 0x04, 0x14, 0xD3, 0x22, 0x8F, 0x28, 0x2C, + 0xE0, 0x05, 0xEE, 0xD3, 0xED, 0xC3, 0x71, 0x3D, 0xC9, 0xB2, + 0x36, 0x3A, 0x1D, 0xBF, 0xA8, 0x30, 0x81, 0xD9, 0x06, 0x03, + 0x55, 0x1D, 0x23, 0x04, 0x81, 0xD1, 0x30, 0x81, 0xCE, 0x80, + 0x14, 0xD3, 0x22, 0x8F, 0x28, 0x2C, 0xE0, 0x05, 0xEE, 0xD3, + 0xED, 0xC3, 0x71, 0x3D, 0xC9, 0xB2, 0x36, 0x3A, 0x1D, 0xBF, + 0xA8, 0xA1, 0x81, 0x9F, 0xA4, 0x81, 0x9C, 0x30, 0x81, 0x99, + 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, + 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, + 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, + 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, + 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, + 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x08, + 0x53, 0x61, 0x77, 0x74, 0x6F, 0x6F, 0x74, 0x68, 0x31, 0x18, + 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0F, 0x43, + 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, 0x6E, 0x67, 0x5F, + 0x31, 0x30, 0x32, 0x34, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, + 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, + 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, + 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, + 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, + 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, + 0x63, 0x6F, 0x6D, 0x82, 0x14, 0x59, 0x52, 0x6B, 0x92, 0x1A, + 0x25, 0x8F, 0x1B, 0xEE, 0x4C, 0x51, 0x9C, 0x47, 0x2F, 0xFF, + 0xFF, 0x9D, 0x43, 0x29, 0x47, 0x30, 0x0C, 0x06, 0x03, 0x55, + 0x1D, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xFF, 0x30, + 0x1C, 0x06, 0x03, 0x55, 0x1D, 0x11, 0x04, 0x15, 0x30, 0x13, + 0x82, 0x0B, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2E, + 0x63, 0x6F, 0x6D, 0x87, 0x04, 0x7F, 0x00, 0x00, 0x01, 0x30, + 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04, 0x16, 0x30, 0x14, + 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01, + 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x02, + 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, + 0x01, 0x01, 0x0B, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x09, + 0xC6, 0xDA, 0xFE, 0x2A, 0x45, 0x83, 0x9E, 0x8B, 0x66, 0xCF, + 0x63, 0x1F, 0x11, 0xCB, 0xD9, 0xB4, 0xEB, 0xB0, 0x97, 0x3D, + 0x33, 0xD4, 0xB9, 0x27, 0x56, 0x46, 0x14, 0x3C, 0xFE, 0x2B, + 0xB2, 0x36, 0x6E, 0x38, 0x7F, 0x08, 0xF5, 0x37, 0x3C, 0xF2, + 0xA2, 0x6A, 0x8A, 0xC7, 0xA0, 0xBE, 0x0F, 0xAC, 0xDD, 0xF4, + 0xF0, 0x97, 0xB3, 0x03, 0xA6, 0x70, 0x48, 0x44, 0xFC, 0xEF, + 0xEF, 0x7A, 0xC6, 0x1A, 0x8D, 0x3F, 0x19, 0xF6, 0x71, 0x92, + 0x7E, 0x3A, 0x00, 0x95, 0xF2, 0xB6, 0x57, 0x40, 0x77, 0xC2, + 0x80, 0x4E, 0x61, 0xF2, 0x71, 0x56, 0x22, 0xA0, 0x1E, 0xA9, + 0xDD, 0x5C, 0x54, 0x80, 0xAD, 0xE4, 0x27, 0xF2, 0x17, 0x20, + 0x9B, 0x5B, 0x89, 0x30, 0x6E, 0x6A, 0x31, 0x2A, 0x4E, 0x43, + 0x52, 0xF8, 0x8A, 0x51, 0xB7, 0xED, 0x3A, 0xAA, 0x78, 0x41, + 0x90, 0x95, 0xE8, 0x40, 0x2E, 0x66, 0xFC +}; +static const int sizeof_ca_cert_der_1024 = sizeof(ca_cert_der_1024); + +/* ./certs/1024/server-key.der, 1024-bit */ +static const unsigned char server_key_der_1024[] = +{ + 0x30, 0x82, 0x02, 0x5D, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, + 0x00, 0xAA, 0x3E, 0xA5, 0x9C, 0xD3, 0x17, 0x49, 0x65, 0x43, + 0xDE, 0xD0, 0xF3, 0x4B, 0x1C, 0xDB, 0x49, 0x0C, 0xFC, 0x7A, + 0x65, 0x05, 0x6D, 0xDE, 0x6A, 0xC4, 0xE4, 0x73, 0x2C, 0x8A, + 0x96, 0x82, 0x8F, 0x23, 0xA5, 0x06, 0x71, 0x1C, 0x06, 0x3E, + 0x2F, 0x92, 0x8D, 0x0B, 0x29, 0x34, 0x45, 0x59, 0xE9, 0xA9, + 0xBC, 0x61, 0xD7, 0x24, 0x37, 0x5D, 0xB5, 0xC4, 0x37, 0x8D, + 0xBA, 0x67, 0xB2, 0xEF, 0x03, 0x27, 0xFA, 0xC1, 0xB4, 0xCD, + 0x6B, 0x00, 0x66, 0xB4, 0xD6, 0x73, 0x70, 0x1F, 0x08, 0x3A, + 0xCC, 0x77, 0xAD, 0xE9, 0xF9, 0x34, 0xD4, 0xF3, 0xA0, 0x2D, + 0xA9, 0xE7, 0x58, 0xA9, 0xC0, 0x61, 0x84, 0xB6, 0xEC, 0x3D, + 0x0A, 0xAD, 0xFD, 0x5C, 0x86, 0x73, 0xAA, 0x6B, 0x47, 0xD8, + 0x8B, 0x2E, 0x58, 0x4B, 0x69, 0x12, 0x82, 0x26, 0x55, 0xE6, + 0x14, 0xBF, 0x55, 0x70, 0x88, 0xFE, 0xF9, 0x75, 0xE1, 0x02, + 0x03, 0x01, 0x00, 0x01, 0x02, 0x81, 0x80, 0x0A, 0x4C, 0xC1, + 0xFE, 0x4B, 0xF3, 0x23, 0xB8, 0xA1, 0xB3, 0x90, 0x56, 0xB7, + 0x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, + 0x28, 0x7C, 0x94, 0xD4, 0x60, 0x42, 0xAB, 0x38, 0x6B, 0x1A, + 0x2E, 0xC4, 0xC3, 0x49, 0x0B, 0xE6, 0x8A, 0xDD, 0xC5, 0xD0, + 0xB4, 0x51, 0x02, 0x41, 0x00, 0xA9, 0x8B, 0xA7, 0xA9, 0xEE, + 0xAE, 0xBB, 0x17, 0xCB, 0x72, 0xF2, 0x50, 0x22, 0x9D, 0xB3, + 0xDF, 0xE0, 0x40, 0x37, 0x08, 0xD5, 0x7F, 0x19, 0x58, 0x80, + 0x70, 0x79, 0x69, 0x99, 0xDF, 0x62, 0x0D, 0x21, 0xAB, 0xDD, + 0xB2, 0xCE, 0x68, 0xB3, 0x9F, 0x87, 0xAF, 0x55, 0xF4, 0xAA, + 0xE1, 0x00, 0x72, 0xBE, 0x6E, 0xC3, 0x94, 0x49, 0xDC, 0xBB, + 0x8E, 0x1A, 0x78, 0xE5, 0x49, 0x1F, 0x55, 0x41, 0xA1 +}; +static const int sizeof_server_key_der_1024 = sizeof(server_key_der_1024); + +/* ./certs/1024/server-cert.der, 1024-bit */ +static const unsigned char server_cert_der_1024[] = +{ + 0x30, 0x82, 0x03, 0xF2, 0x30, 0x82, 0x03, 0x5B, 0xA0, 0x03, + 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x30, 0x0D, 0x06, 0x09, + 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, + 0x00, 0x30, 0x81, 0x99, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, + 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, + 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, + 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, + 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, + 0x6D, 0x61, 0x6E, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, + 0x04, 0x0A, 0x0C, 0x08, 0x53, 0x61, 0x77, 0x74, 0x6F, 0x6F, + 0x74, 0x68, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, + 0x0B, 0x0C, 0x0F, 0x43, 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74, + 0x69, 0x6E, 0x67, 0x5F, 0x31, 0x30, 0x32, 0x34, 0x31, 0x18, + 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, + 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, + 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, + 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, + 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, + 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x1E, 0x17, + 0x0D, 0x32, 0x34, 0x31, 0x32, 0x31, 0x38, 0x32, 0x31, 0x32, + 0x35, 0x33, 0x30, 0x5A, 0x17, 0x0D, 0x32, 0x37, 0x30, 0x39, + 0x31, 0x34, 0x32, 0x31, 0x32, 0x35, 0x33, 0x30, 0x5A, 0x30, + 0x81, 0x95, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, + 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, + 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, + 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, + 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, + 0x6E, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x0A, + 0x0C, 0x07, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x31, + 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0C, + 0x53, 0x75, 0x70, 0x70, 0x6F, 0x72, 0x74, 0x5F, 0x31, 0x30, + 0x32, 0x34, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, + 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, + 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, + 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, + 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, + 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, + 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, + 0xAA, 0x3E, 0xA5, 0x9C, 0xD3, 0x17, 0x49, 0x65, 0x43, 0xDE, + 0xD0, 0xF3, 0x4B, 0x1C, 0xDB, 0x49, 0x0C, 0xFC, 0x7A, 0x65, + 0x05, 0x6D, 0xDE, 0x6A, 0xC4, 0xE4, 0x73, 0x2C, 0x8A, 0x96, + 0x82, 0x8F, 0x23, 0xA5, 0x06, 0x71, 0x1C, 0x06, 0x3E, 0x2F, + 0x92, 0x8D, 0x0B, 0x29, 0x34, 0x45, 0x59, 0xE9, 0xA9, 0xBC, + 0x61, 0xD7, 0x24, 0x37, 0x5D, 0xB5, 0xC4, 0x37, 0x8D, 0xBA, + 0x67, 0xB2, 0xEF, 0x03, 0x27, 0xFA, 0xC1, 0xB4, 0xCD, 0x6B, + 0x00, 0x66, 0xB4, 0xD6, 0x73, 0x70, 0x1F, 0x08, 0x3A, 0xCC, + 0x77, 0xAD, 0xE9, 0xF9, 0x34, 0xD4, 0xF3, 0xA0, 0x2D, 0xA9, + 0xE7, 0x58, 0xA9, 0xC0, 0x61, 0x84, 0xB6, 0xEC, 0x3D, 0x0A, + 0xAD, 0xFD, 0x5C, 0x86, 0x73, 0xAA, 0x6B, 0x47, 0xD8, 0x8B, + 0x2E, 0x58, 0x4B, 0x69, 0x12, 0x82, 0x26, 0x55, 0xE6, 0x14, + 0xBF, 0x55, 0x70, 0x88, 0xFE, 0xF9, 0x75, 0xE1, 0x02, 0x03, + 0x01, 0x00, 0x01, 0xA3, 0x82, 0x01, 0x4A, 0x30, 0x82, 0x01, + 0x46, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, + 0x04, 0x14, 0xD9, 0x3C, 0x35, 0xEA, 0x74, 0x0E, 0x23, 0xBE, + 0x9C, 0xFC, 0xFA, 0x29, 0x90, 0x09, 0xC1, 0xE7, 0x84, 0x16, + 0x9F, 0x7C, 0x30, 0x81, 0xD9, 0x06, 0x03, 0x55, 0x1D, 0x23, + 0x04, 0x81, 0xD1, 0x30, 0x81, 0xCE, 0x80, 0x14, 0xD3, 0x22, + 0x8F, 0x28, 0x2C, 0xE0, 0x05, 0xEE, 0xD3, 0xED, 0xC3, 0x71, + 0x3D, 0xC9, 0xB2, 0x36, 0x3A, 0x1D, 0xBF, 0xA8, 0xA1, 0x81, + 0x9F, 0xA4, 0x81, 0x9C, 0x30, 0x81, 0x99, 0x31, 0x0B, 0x30, + 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, + 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, + 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, + 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, + 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x11, 0x30, 0x0F, + 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x08, 0x53, 0x61, 0x77, + 0x74, 0x6F, 0x6F, 0x74, 0x68, 0x31, 0x18, 0x30, 0x16, 0x06, + 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0F, 0x43, 0x6F, 0x6E, 0x73, + 0x75, 0x6C, 0x74, 0x69, 0x6E, 0x67, 0x5F, 0x31, 0x30, 0x32, + 0x34, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, + 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, + 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, + 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, + 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, + 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, + 0x82, 0x14, 0x59, 0x52, 0x6B, 0x92, 0x1A, 0x25, 0x8F, 0x1B, + 0xEE, 0x4C, 0x51, 0x9C, 0x47, 0x2F, 0xFF, 0xFF, 0x9D, 0x43, + 0x29, 0x47, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, + 0x05, 0x30, 0x03, 0x01, 0x01, 0xFF, 0x30, 0x1C, 0x06, 0x03, + 0x55, 0x1D, 0x11, 0x04, 0x15, 0x30, 0x13, 0x82, 0x0B, 0x65, + 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2E, 0x63, 0x6F, 0x6D, + 0x87, 0x04, 0x7F, 0x00, 0x00, 0x01, 0x30, 0x1D, 0x06, 0x03, + 0x55, 0x1D, 0x25, 0x04, 0x16, 0x30, 0x14, 0x06, 0x08, 0x2B, + 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01, 0x06, 0x08, 0x2B, + 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x02, 0x30, 0x0D, 0x06, + 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, + 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x94, 0x67, 0x03, 0x63, + 0x2A, 0x3E, 0xE4, 0x56, 0xA5, 0x9F, 0x84, 0x89, 0x68, 0x8C, + 0xED, 0xEF, 0xA4, 0xFE, 0x1F, 0xDC, 0x03, 0x04, 0x1E, 0xD0, + 0x87, 0x90, 0x14, 0x7C, 0x82, 0x3F, 0x36, 0xA8, 0x7C, 0x14, + 0x64, 0xAB, 0x88, 0xD4, 0x9D, 0x81, 0xE8, 0xF6, 0xA7, 0xEC, + 0x12, 0x51, 0xEA, 0x25, 0xFD, 0xA4, 0xD1, 0x9C, 0x9B, 0x71, + 0x3D, 0xC8, 0xD0, 0xB3, 0xD2, 0x6D, 0xEB, 0x56, 0x11, 0x66, + 0x05, 0x4E, 0x92, 0x27, 0x0A, 0x76, 0x8C, 0x3A, 0x8B, 0xBD, + 0xE2, 0x46, 0xF5, 0x7B, 0x8E, 0xFF, 0x03, 0xF3, 0x89, 0x92, + 0xDC, 0x9B, 0x46, 0x79, 0xF4, 0xB8, 0x95, 0x7D, 0xB6, 0x29, + 0x79, 0xF3, 0x55, 0xC8, 0x70, 0xDE, 0xF7, 0x9F, 0x59, 0xE1, + 0xE2, 0x8D, 0xA7, 0x73, 0x1F, 0x97, 0x1C, 0x52, 0x64, 0x48, + 0x77, 0xCF, 0x6D, 0xA0, 0x27, 0xAD, 0xC0, 0x16, 0x56, 0x55, + 0x46, 0xB2, 0xBF, 0xF1 +}; +static const int sizeof_server_cert_der_1024 = sizeof(server_cert_der_1024); + +#endif /* USE_CERT_BUFFERS_1024 */ + +#ifdef USE_CERT_BUFFERS_2048 + +/* ./certs/client-key.der, 2048-bit */ +static const unsigned char client_key_der_2048[] = +{ + 0x30, 0x82, 0x04, 0xA4, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, + 0x01, 0x00, 0xC3, 0x03, 0xD1, 0x2B, 0xFE, 0x39, 0xA4, 0x32, + 0x45, 0x3B, 0x53, 0xC8, 0x84, 0x2B, 0x2A, 0x7C, 0x74, 0x9A, + 0xBD, 0xAA, 0x2A, 0x52, 0x07, 0x47, 0xD6, 0xA6, 0x36, 0xB2, + 0x07, 0x32, 0x8E, 0xD0, 0xBA, 0x69, 0x7B, 0xC6, 0xC3, 0x44, + 0x9E, 0xD4, 0x81, 0x48, 0xFD, 0x2D, 0x68, 0xA2, 0x8B, 0x67, + 0xBB, 0xA1, 0x75, 0xC8, 0x36, 0x2C, 0x4A, 0xD2, 0x1B, 0xF7, + 0x8B, 0xBA, 0xCF, 0x0D, 0xF9, 0xEF, 0xEC, 0xF1, 0x81, 0x1E, + 0x7B, 0x9B, 0x03, 0x47, 0x9A, 0xBF, 0x65, 0xCC, 0x7F, 0x65, + 0x24, 0x69, 0xA6, 0xE8, 0x14, 0x89, 0x5B, 0xE4, 0x34, 0xF7, + 0xC5, 0xB0, 0x14, 0x93, 0xF5, 0x67, 0x7B, 0x3A, 0x7A, 0x78, + 0xE1, 0x01, 0x56, 0x56, 0x91, 0xA6, 0x13, 0x42, 0x8D, 0xD2, + 0x3C, 0x40, 0x9C, 0x4C, 0xEF, 0xD1, 0x86, 0xDF, 0x37, 0x51, + 0x1B, 0x0C, 0xA1, 0x3B, 0xF5, 0xF1, 0xA3, 0x4A, 0x35, 0xE4, + 0xE1, 0xCE, 0x96, 0xDF, 0x1B, 0x7E, 0xBF, 0x4E, 0x97, 0xD0, + 0x10, 0xE8, 0xA8, 0x08, 0x30, 0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42, 0x68, 0x24, 0x10, 0x45, 0xD4, 0x50, + 0xE4, 0x17, 0x39, 0x48, 0xD0, 0x35, 0x8B, 0x94, 0x6D, 0x11, + 0xDE, 0x8F, 0xCA, 0x59, 0x02, 0x81, 0x81, 0x00, 0xEA, 0x24, + 0xA7, 0xF9, 0x69, 0x33, 0xE9, 0x71, 0xDC, 0x52, 0x7D, 0x88, + 0x21, 0x28, 0x2F, 0x49, 0xDE, 0xBA, 0x72, 0x16, 0xE9, 0xCC, + 0x47, 0x7A, 0x88, 0x0D, 0x94, 0x57, 0x84, 0x58, 0x16, 0x3A, + 0x81, 0xB0, 0x3F, 0xA2, 0xCF, 0xA6, 0x6C, 0x1E, 0xB0, 0x06, + 0x29, 0x00, 0x8F, 0xE7, 0x77, 0x76, 0xAC, 0xDB, 0xCA, 0xC7, + 0xD9, 0x5E, 0x9B, 0x3F, 0x26, 0x90, 0x52, 0xAE, 0xFC, 0x38, + 0x90, 0x00, 0x14, 0xBB, 0xB4, 0x0F, 0x58, 0x94, 0xE7, 0x2F, + 0x6A, 0x7E, 0x1C, 0x4F, 0x41, 0x21, 0xD4, 0x31, 0x59, 0x1F, + 0x4E, 0x8A, 0x1A, 0x8D, 0xA7, 0x57, 0x6C, 0x22, 0xD8, 0xE5, + 0xF4, 0x7E, 0x32, 0xA6, 0x10, 0xCB, 0x64, 0xA5, 0x55, 0x03, + 0x87, 0xA6, 0x27, 0x05, 0x8C, 0xC3, 0xD7, 0xB6, 0x27, 0xB2, + 0x4D, 0xBA, 0x30, 0xDA, 0x47, 0x8F, 0x54, 0xD3, 0x3D, 0x8B, + 0x84, 0x8D, 0x94, 0x98, 0x58, 0xA5, 0x02, 0x81, 0x81, 0x00, + 0xD5, 0x38, 0x1B, 0xC3, 0x8F, 0xC5, 0x93, 0x0C, 0x47, 0x0B, + 0x6F, 0x35, 0x92, 0xC5, 0xB0, 0x8D, 0x46, 0xC8, 0x92, 0x18, + 0x8F, 0xF5, 0x80, 0x0A, 0xF7, 0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9, 0x03, 0x7B, 0x9E, 0xE3, 0x60, 0x01, 0xFC, + 0x2F, 0x02, 0x81, 0x80, 0x11, 0xD0, 0x4B, 0xCF, 0x1B, 0x67, + 0xB9, 0x9F, 0x10, 0x75, 0x47, 0x86, 0x65, 0xAE, 0x31, 0xC2, + 0xC6, 0x30, 0xAC, 0x59, 0x06, 0x50, 0xD9, 0x0F, 0xB5, 0x70, + 0x06, 0xF7, 0xF0, 0xD3, 0xC8, 0x62, 0x7C, 0xA8, 0xDA, 0x6E, + 0xF6, 0x21, 0x3F, 0xD3, 0x7F, 0x5F, 0xEA, 0x8A, 0xAB, 0x3F, + 0xD9, 0x2A, 0x5E, 0xF3, 0x51, 0xD2, 0xC2, 0x30, 0x37, 0xE3, + 0x2D, 0xA3, 0x75, 0x0D, 0x1E, 0x4D, 0x21, 0x34, 0xD5, 0x57, + 0x70, 0x5C, 0x89, 0xBF, 0x72, 0xEC, 0x4A, 0x6E, 0x68, 0xD5, + 0xCD, 0x18, 0x74, 0x33, 0x4E, 0x8C, 0x3A, 0x45, 0x8F, 0xE6, + 0x96, 0x40, 0xEB, 0x63, 0xF9, 0x19, 0x86, 0x3A, 0x51, 0xDD, + 0x89, 0x4B, 0xB0, 0xF3, 0xF9, 0x9F, 0x5D, 0x28, 0x95, 0x38, + 0xBE, 0x35, 0xAB, 0xCA, 0x5C, 0xE7, 0x93, 0x53, 0x34, 0xA1, + 0x45, 0x5D, 0x13, 0x39, 0x65, 0x42, 0x46, 0xA1, 0x9F, 0xCD, + 0xF5, 0xBF +}; +static const int sizeof_client_key_der_2048 = sizeof(client_key_der_2048); + +/* ./certs/client-keyPub.der, 2048-bit */ +static const unsigned char client_keypub_der_2048[] = +{ + 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, + 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, + 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x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0xB0, 0xCE, + 0xEF, 0x19, 0xCD, 0xAE, 0xFF, 0x78, 0x6C, 0x7B, 0xC0, 0x12, + 0x03, 0xD4, 0x4E, 0x72, 0x0D, 0x50, 0x6D, 0x3B, 0xA3, 0x3B, + 0xA3, 0x99, 0x5E, 0x9D, 0xC8, 0xD9, 0x0C, 0x85, 0xB3, 0xD9, + 0x8A, 0xD9, 0x54, 0x26, 0xDB, 0x6D, 0xFA, 0xAC, 0xBB, 0xFF, + 0x25, 0x4C, 0xC4, 0xD1, 0x79, 0xF4, 0x71, 0xD3, 0x86, 0x40, + 0x18, 0x13, 0xB0, 0x63, 0xB5, 0x72, 0x4E, 0x30, 0xC4, 0x97, + 0x84, 0x86, 0x2D, 0x56, 0x2F, 0xD7, 0x15, 0xF7, 0x7F, 0xC0, + 0xAE, 0xF5, 0xFC, 0x5B, 0xE5, 0xFB, 0xA1, 0xBA, 0xD3, 0x02, + 0x03, 0x01, 0x00, 0x01 +}; +static const int sizeof_client_keypub_der_2048 = sizeof(client_keypub_der_2048); + +/* ./certs/client-cert.der, 2048-bit */ +static const unsigned char client_cert_der_2048[] = +{ + 0x30, 0x82, 0x05, 0x1D, 0x30, 0x82, 0x04, 0x05, 0xA0, 0x03, + 0x02, 0x01, 0x02, 0x02, 0x14, 0x4F, 0x0D, 0x8C, 0xC5, 0xFA, + 0xEE, 0xA2, 0x9B, 0xB7, 0x35, 0x9E, 0xE9, 0x4A, 0x17, 0x99, + 0xF0, 0xCC, 0x23, 0xF2, 0xEC, 0x30, 0x0D, 0x06, 0x09, 0x2A, + 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, + 0x30, 0x81, 0x9E, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, + 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, + 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, + 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, + 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, + 0x61, 0x6E, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, + 0x0A, 0x0C, 0x0C, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, + 0x5F, 0x32, 0x30, 0x34, 0x38, 0x31, 0x19, 0x30, 0x17, 0x06, + 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x10, 0x50, 0x72, 0x6F, 0x67, + 0x72, 0x61, 0x6D, 0x6D, 0x69, 0x6E, 0x67, 0x2D, 0x32, 0x30, + 0x34, 0x38, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, + 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, + 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, + 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, + 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x32, 0x34, 0x31, 0x32, 0x31, + 0x38, 0x32, 0x31, 0x32, 0x35, 0x32, 0x39, 0x5A, 0x17, 0x0D, + 0x32, 0x37, 0x30, 0x39, 0x31, 0x34, 0x32, 0x31, 0x32, 0x35, + 0x32, 0x39, 0x5A, 0x30, 0x81, 0x9E, 0x31, 0x0B, 0x30, 0x09, + 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, + 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, + 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, + 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, + 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x15, 0x30, 0x13, 0x06, + 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x0C, 0x77, 0x6F, 0x6C, 0x66, + 0x53, 0x53, 0x4C, 0x5F, 0x32, 0x30, 0x34, 0x38, 0x31, 0x19, + 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x10, 0x50, + 0x72, 0x6F, 0x67, 0x72, 0x61, 0x6D, 0x6D, 0x69, 0x6E, 0x67, + 0x2D, 0x32, 0x30, 0x34, 0x38, 0x31, 0x18, 0x30, 0x16, 0x06, + 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, + 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, + 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, + 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, + 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, + 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, + 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xC3, 0x03, 0xD1, + 0x2B, 0xFE, 0x39, 0xA4, 0x32, 0x45, 0x3B, 0x53, 0xC8, 0x84, + 0x2B, 0x2A, 0x7C, 0x74, 0x9A, 0xBD, 0xAA, 0x2A, 0x52, 0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 0xD9, + 0x0C, 0x85, 0xB3, 0xD9, 0x8A, 0xD9, 0x54, 0x26, 0xDB, 0x6D, + 0xFA, 0xAC, 0xBB, 0xFF, 0x25, 0x4C, 0xC4, 0xD1, 0x79, 0xF4, + 0x71, 0xD3, 0x86, 0x40, 0x18, 0x13, 0xB0, 0x63, 0xB5, 0x72, + 0x4E, 0x30, 0xC4, 0x97, 0x84, 0x86, 0x2D, 0x56, 0x2F, 0xD7, + 0x15, 0xF7, 0x7F, 0xC0, 0xAE, 0xF5, 0xFC, 0x5B, 0xE5, 0xFB, + 0xA1, 0xBA, 0xD3, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x82, + 0x01, 0x4F, 0x30, 0x82, 0x01, 0x4B, 0x30, 0x1D, 0x06, 0x03, + 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x33, 0xD8, 0x45, + 0x66, 0xD7, 0x68, 0x87, 0x18, 0x7E, 0x54, 0x0D, 0x70, 0x27, + 0x91, 0xC7, 0x26, 0xD7, 0x85, 0x65, 0xC0, 0x30, 0x81, 0xDE, + 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x81, 0xD6, 0x30, 0x81, + 0xD3, 0x80, 0x14, 0x33, 0xD8, 0x45, 0x66, 0xD7, 0x68, 0x87, + 0x18, 0x7E, 0x54, 0x0D, 0x70, 0x27, 0x91, 0xC7, 0x26, 0xD7, + 0x85, 0x65, 0xC0, 0xA1, 0x81, 0xA4, 0xA4, 0x81, 0xA1, 0x30, + 0x81, 0x9E, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, + 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, + 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, + 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, + 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, + 0x6E, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0A, + 0x0C, 0x0C, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x5F, + 0x32, 0x30, 0x34, 0x38, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, + 0x55, 0x04, 0x0B, 0x0C, 0x10, 0x50, 0x72, 0x6F, 0x67, 0x72, + 0x61, 0x6D, 0x6D, 0x69, 0x6E, 0x67, 0x2D, 0x32, 0x30, 0x34, + 0x38, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, + 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, + 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, + 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, + 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, + 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, + 0x82, 0x14, 0x4F, 0x0D, 0x8C, 0xC5, 0xFA, 0xEE, 0xA2, 0x9B, + 0xB7, 0x35, 0x9E, 0xE9, 0x4A, 0x17, 0x99, 0xF0, 0xCC, 0x23, + 0xF2, 0xEC, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, + 0x05, 0x30, 0x03, 0x01, 0x01, 0xFF, 0x30, 0x1C, 0x06, 0x03, + 0x55, 0x1D, 0x11, 0x04, 0x15, 0x30, 0x13, 0x82, 0x0B, 0x65, + 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2E, 0x63, 0x6F, 0x6D, + 0x87, 0x04, 0x7F, 0x00, 0x00, 0x01, 0x30, 0x1D, 0x06, 0x03, + 0x55, 0x1D, 0x25, 0x04, 0x16, 0x30, 0x14, 0x06, 0x08, 0x2B, + 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01, 0x06, 0x08, 0x2B, + 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x02, 0x30, 0x0D, 0x06, + 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, + 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x46, 0xAB, 0xE4, + 0x6D, 0xAE, 0x49, 0x5B, 0x6A, 0x0B, 0xA9, 0x87, 0xE1, 0x95, + 0x32, 0xA6, 0xD7, 0xAE, 0xDE, 0x28, 0xDC, 0xC7, 0x99, 0x68, + 0xE2, 0x5F, 0xC9, 0x5A, 0x4C, 0x64, 0xB8, 0xF5, 0x28, 0x42, + 0x5A, 0xE8, 0x5C, 0x59, 0x32, 0xFE, 0xD0, 0x1F, 0x0B, 0x55, + 0x89, 0xDB, 0x67, 0xE7, 0x78, 0xF3, 0x70, 0xCF, 0x18, 0x51, + 0x57, 0x8B, 0xF3, 0x2B, 0xA4, 0x66, 0x0B, 0xF6, 0x03, 0x6E, + 0x11, 0xAC, 0x83, 0x52, 0x16, 0x7E, 0xA2, 0x7C, 0x36, 0x77, + 0xF6, 0xBB, 0x13, 0x19, 0x40, 0x2C, 0xB8, 0x8C, 0xCA, 0xD6, + 0x7E, 0x79, 0x7D, 0xF4, 0x14, 0x8D, 0xB5, 0xA4, 0x09, 0xF6, + 0x2D, 0x4C, 0xE7, 0xF9, 0xB8, 0x25, 0x41, 0x15, 0x78, 0xF4, + 0xCA, 0x80, 0x41, 0xEA, 0x3A, 0x05, 0x08, 0xF6, 0xB5, 0x5B, + 0xA1, 0x3B, 0x5B, 0x48, 0xA8, 0x4B, 0x8C, 0x19, 0x8D, 0x6C, + 0x87, 0x31, 0x76, 0x74, 0x02, 0x16, 0x8B, 0xDD, 0x7F, 0xD1, + 0x11, 0x62, 0x27, 0x42, 0x39, 0xE0, 0x9A, 0x63, 0x26, 0x31, + 0x19, 0xCE, 0x3D, 0x41, 0xD5, 0x24, 0x47, 0x32, 0x0F, 0x76, + 0xD6, 0x41, 0x37, 0x44, 0xAD, 0x73, 0xF1, 0xB8, 0xEC, 0x2B, + 0x6E, 0x9C, 0x4F, 0x84, 0xC4, 0x4E, 0xD7, 0x92, 0x10, 0x7E, + 0x23, 0x32, 0xA0, 0x75, 0x6A, 0xE7, 0xFE, 0x55, 0x95, 0x9F, + 0x0A, 0xAD, 0xDF, 0xF9, 0x2A, 0xA2, 0x1A, 0x59, 0xD5, 0x82, + 0x63, 0xD6, 0x5D, 0x7D, 0x79, 0xF4, 0xA7, 0x2D, 0xDC, 0x8C, + 0x04, 0xCD, 0x98, 0xB0, 0x42, 0x0E, 0x84, 0xFA, 0x86, 0x50, + 0x10, 0x61, 0xAC, 0x73, 0xCD, 0x79, 0x45, 0x30, 0xE8, 0x42, + 0xA1, 0x6A, 0xF6, 0x77, 0x55, 0xEC, 0x07, 0xDB, 0x52, 0x29, + 0xCA, 0x7A, 0xC8, 0xA2, 0xDA, 0xE9, 0xF5, 0x98, 0x33, 0x6A, + 0xE8, 0xBC, 0x89, 0xED, 0x01, 0xE2, 0xFE, 0x44, 0x86, 0x86, + 0x80, 0x39, 0xEC +}; +static const int sizeof_client_cert_der_2048 = sizeof(client_cert_der_2048); + +/* ./certs/dh2048.der, 2048-bit */ +static const unsigned char dh_key_der_2048[] = +{ + 0x30, 0x82, 0x01, 0x08, 0x02, 0x82, 0x01, 0x01, 0x00, 0xB0, + 0xA1, 0x08, 0x06, 0x9C, 0x08, 0x13, 0xBA, 0x59, 0x06, 0x3C, + 0xBC, 0x30, 0xD5, 0xF5, 0x00, 0xC1, 0x4F, 0x44, 0xA7, 0xD6, + 0xEF, 0x4A, 0xC6, 0x25, 0x27, 0x1C, 0xE8, 0xD2, 0x96, 0x53, + 0x0A, 0x5C, 0x91, 0xDD, 0xA2, 0xC2, 0x94, 0x84, 0xBF, 0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x29, 0xBF, + 0x68, 0x1F, 0x08, 0x4B, 0x63, 0x86, 0x2F, 0x5C, 0x6B, 0xD6, + 0xB6, 0x06, 0x65, 0xF7, 0xA6, 0xDC, 0x00, 0x67, 0x6B, 0xBB, + 0xC3, 0xA9, 0x41, 0x83, 0xFB, 0xC7, 0xFA, 0xC8, 0xE2, 0x1E, + 0x7E, 0xAF, 0x00, 0x3F, 0x93, 0x02, 0x01, 0x02 +}; +static const int sizeof_dh_key_der_2048 = sizeof(dh_key_der_2048); + +/* ./certs/dh-pubkey-2048.der, 2048-bit */ +static const unsigned char dh_pub_key_der_2048[] = +{ + 0x30, 0x82, 0x02, 0x24, 0x30, 0x82, 0x01, 0x17, 0x06, 0x09, + 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x03, 0x01, 0x30, + 0x82, 0x01, 0x08, 0x02, 0x82, 0x01, 0x01, 0x00, 0xD3, 0xB2, + 0x99, 0x84, 0x5C, 0x0A, 0x4C, 0xE7, 0x37, 0xCC, 0xFC, 0x18, + 0x37, 0x01, 0x2F, 0x5D, 0xC1, 0x4C, 0xF4, 0x5C, 0xC9, 0x82, + 0x8D, 0xB7, 0xF3, 0xD4, 0xA9, 0x8A, 0x9D, 0x34, 0xD7, 0x76, + 0x57, 0xE5, 0xE5, 0xC3, 0xE5, 0x16, 0x85, 0xCA, 0x4D, 0xD6, + 0x5B, 0xC1, 0xF8, 0xCF, 0x89, 0x26, 0xD0, 0x38, 0x8A, 0xEE, + 0xF3, 0xCD, 0x33, 0xE5, 0x56, 0xBB, 0x90, 0x83, 0x9F, 0x97, + 0x8E, 0x71, 0xFB, 0x27, 0xE4, 0x35, 0x15, 0x45, 0x86, 0x09, + 0x71, 0xA8, 0x9A, 0xB9, 0x3E, 0x0F, 0x51, 0x8A, 0xC2, 0x75, + 0x51, 0x23, 0x12, 0xFB, 0x94, 0x31, 0x44, 0xBF, 0xCE, 0xF6, + 0xED, 0xA6, 0x3A, 0xB7, 0x92, 0xC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x51, 0x17, 0xF0, 0xC5, + 0x6D, 0x3C, 0x3D, 0x6D, 0x0A, 0x8B, 0xDB, 0xEF, 0x02, 0xD8, + 0xC3, 0xCB, 0xCA, 0x21, 0xCA, 0xD6, 0x9C, 0x18, 0x9E, 0x92, + 0xBE, 0x6E, 0xE2, 0x16, 0x5E, 0x89, 0x9B, 0xAD, 0xD4, 0x04, + 0x5A, 0x24, 0x5A, 0x3F, 0x7C, 0x12, 0xAC, 0xB4, 0x71, 0x51, + 0x25, 0x58, 0x74, 0xE4, 0xB2, 0xD4, 0x45, 0xFC, 0x5F, 0xCD, + 0x81, 0x8F, 0xE7, 0x96, 0x18, 0xD9, 0xE0, 0x97, 0x08, 0x45, + 0x36, 0xC3 +}; +static const int sizeof_dh_pub_key_der_2048 = sizeof(dh_pub_key_der_2048); + +/* ./certs/statickeys/dh-ffdhe2048.der, 2048-bit */ +static const unsigned char dh_ffdhe_statickey_der_2048[] = +{ + 0x30, 0x82, 0x01, 0x3F, 0x02, 0x01, 0x00, 0x30, 0x82, 0x01, + 0x17, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, + 0x03, 0x01, 0x30, 0x82, 0x01, 0x08, 0x02, 0x82, 0x01, 0x01, + 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAD, + 0xF8, 0x54, 0x58, 0xA2, 0xBB, 0x4A, 0x9A, 0xAF, 0xDC, 0x56, + 0x20, 0x27, 0x3D, 0x3C, 0xF1, 0xD8, 0xB9, 0xC5, 0x83, 0xCE, + 0x2D, 0x36, 0x95, 0xA9, 0xE1, 0x36, 0x41, 0x14, 0x64, 0x33, + 0xFB, 0xCC, 0x93, 0x9D, 0xCE, 0x24, 0x9B, 0x3E, 0xF9, 0x7D, + 0x2F, 0xE3, 0x63, 0x63, 0x0C, 0x75, 0xD8, 0xF6, 0x81, 0xB2, + 0x02, 0xAE, 0xC4, 0x61, 0x7A, 0xD3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 0x38, 0x61, 0x28, 0x5C, 0x97, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x02, 0x01, 0x02, + 0x04, 0x1F, 0x02, 0x1D, 0x5C, 0xFB, 0x86, 0xF7, 0xFA, 0x51, + 0x02, 0x79, 0x71, 0x9E, 0xC0, 0x29, 0x98, 0x03, 0xCF, 0x3E, + 0x65, 0x46, 0xF6, 0x34, 0xB8, 0xB0, 0xC1, 0x55, 0x3A, 0xF7, + 0xC8, 0x43, 0xB8 +}; +static const int sizeof_dh_ffdhe_statickey_der_2048 = sizeof(dh_ffdhe_statickey_der_2048); + +/* ./certs/statickeys/dh-ffdhe2048-pub.der, 2048-bit */ +static const unsigned char dh_ffdhe_pub_statickey_der_2048[] = +{ + 0x30, 0x82, 0x02, 0x24, 0x30, 0x82, 0x01, 0x17, 0x06, 0x09, + 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x03, 0x01, 0x30, + 0x82, 0x01, 0x08, 0x02, 0x82, 0x01, 0x01, 0x00, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAD, 0xF8, 0x54, 0x58, + 0xA2, 0xBB, 0x4A, 0x9A, 0xAF, 0xDC, 0x56, 0x20, 0x27, 0x3D, + 0x3C, 0xF1, 0xD8, 0xB9, 0xC5, 0x83, 0xCE, 0x2D, 0x36, 0x95, + 0xA9, 0xE1, 0x36, 0x41, 0x14, 0x64, 0x33, 0xFB, 0xCC, 0x93, + 0x9D, 0xCE, 0x24, 0x9B, 0x3E, 0xF9, 0x7D, 0x2F, 0xE3, 0x63, + 0x63, 0x0C, 0x75, 0xD8, 0xF6, 0x81, 0xB2, 0x02, 0xAE, 0xC4, + 0x61, 0x7A, 0xD3, 0xDF, 0x1E, 0xD5, 0xD5, 0xFD, 0x65, 0x61, + 0x24, 0x33, 0xF5, 0x1F, 0x5F, 0x06, 0x6E, 0xD0, 0x85, 0x63, + 0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0x71, + 0xB4, 0x19, 0xBE, 0x33, 0xBD, 0xCF, 0xF3, 0x15, 0x63, 0x06, + 0x37, 0x5C, 0xA1, 0x9D, 0xC0, 0xE7, 0xA7, 0x8B, 0xD3, 0xA2, + 0x6B, 0x3F, 0xF1, 0x42, 0xC8, 0x36, 0x6B, 0x0A, 0x43, 0x8B, + 0xE9, 0xD0, 0x8C, 0xCD, 0x0F, 0x31, 0xCD, 0x22, 0xE7, 0x39, + 0xC8, 0x8D, 0xEB, 0x5D, 0x91, 0x8B, 0x06, 0x6E, 0x1F, 0x07, + 0xDB, 0xAB, 0x2B, 0x4F, 0x85, 0xF8, 0xBB, 0x55, 0xE3, 0xBD, + 0x70, 0x51, 0x5C, 0x73, 0x66, 0x5D, 0xD1, 0xB6, 0xF8, 0x44, + 0x10, 0xE0, 0xF2, 0x09, 0x1C, 0x6D, 0x02, 0x5D, 0xFC, 0x7A, + 0x08, 0x82 +}; +static const int sizeof_dh_ffdhe_pub_statickey_der_2048 = sizeof(dh_ffdhe_pub_statickey_der_2048); + +/* ./certs/dsa-pubkey-2048.der, 2048-bit */ +static const unsigned char dsa_pub_key_der_2048[] = +{ + 0x30, 0x82, 0x03, 0x47, 0x30, 0x82, 0x02, 0x39, 0x06, 0x07, + 0x2A, 0x86, 0x48, 0xCE, 0x38, 0x04, 0x01, 0x30, 0x82, 0x02, + 0x2C, 0x02, 0x82, 0x01, 0x01, 0x00, 0xEB, 0x7E, 0x2C, 0x97, + 0x36, 0x67, 0x0E, 0x73, 0x9A, 0xAC, 0xFD, 0xB1, 0x19, 0x03, + 0x52, 0x61, 0x25, 0x12, 0xB2, 0x37, 0x3D, 0xEA, 0xCA, 0x80, + 0x07, 0x5D, 0x2D, 0x33, 0xA2, 0x4E, 0x6B, 0xB7, 0x62, 0xF8, + 0x87, 0x4D, 0x4B, 0x20, 0xDA, 0xEA, 0x6A, 0x96, 0x13, 0xB7, + 0xB9, 0x49, 0xC0, 0x86, 0x14, 0x71, 0xCD, 0x8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, 0x77, + 0xDB, 0x4A, 0x20, 0xC5, 0x51, 0x75, 0xD8, 0xB1, 0x1B, 0xDF, + 0x91, 0x7F, 0xFC, 0x74, 0xBA, 0x9D, 0xD1, 0xFA, 0x8D, 0xBD, + 0x59, 0xFD, 0x02, 0x21, 0x00, 0xFA, 0xF7, 0x62, 0x9A, 0x62, + 0x19, 0x64, 0x6D, 0xC1, 0xF3, 0xC0, 0x9B, 0xAC, 0x90, 0x28, + 0xEA, 0xA1, 0x83, 0xF9, 0xC8, 0xED, 0x31, 0xEE, 0x33, 0x1D, + 0x35, 0x22, 0x00, 0x2B, 0x12, 0x84, 0xFF, 0x02, 0x82, 0x01, + 0x00, 0x73, 0xC9, 0xED, 0x1F, 0xBC, 0xC7, 0xC4, 0xEF, 0x46, + 0x03, 0xD1, 0x72, 0xC3, 0xE5, 0x29, 0xB0, 0x9A, 0x95, 0x13, + 0x5B, 0x4E, 0x59, 0x57, 0x0F, 0x80, 0xEB, 0x74, 0x87, 0x11, + 0x1B, 0xC8, 0x11, 0xB6, 0x97, 0x4C, 0x48, 0x50, 0x3A, 0xB8, + 0x2C, 0x28, 0xF3, 0xB0, 0x9C, 0x7C, 0x3D, 0xFF, 0x8B, 0x43, + 0x43, 0x30, 0x85, 0x5F, 0x97, 0xD2, 0x68, 0x85, 0x35, 0x2E, + 0xD4, 0x61, 0xF6, 0x3E, 0x05, 0xEC, 0xCD, 0x60, 0x13, 0xE2, + 0x16, 0x02, 0x7C, 0x8B, 0x21, 0xCE, 0x36, 0x71, 0xC4, 0xED, + 0x0B, 0x47, 0x76, 0x83, 0x23, 0x2F, 0x98, 0xA4, 0x84, 0x98, + 0x9C, 0xFB, 0xD0, 0xA8, 0xD9, 0xB9, 0xE3, 0xD7, 0x32, 0xD9, + 0xB5, 0x9E, 0x82, 0x93, 0xD0, 0x55, 0x74, 0x5F, 0xDA, 0x87, + 0x91, 0x90, 0x0F, 0x85, 0x74, 0x1A, 0x32, 0x76, 0x4F, 0xCC, + 0x2A, 0x18, 0x11, 0x5B, 0xB4, 0x78, 0x93, 0xB6, 0xE5, 0xF0, + 0xC6, 0x71, 0xE8, 0xD7, 0x31, 0x19, 0x91, 0x27, 0x71, 0x5A, + 0x02, 0x1A, 0x1A, 0x3A, 0x55, 0x95, 0xFF, 0xF8, 0xED, 0xD3, + 0xE1, 0xAE, 0x8A, 0x1D, 0xFF, 0x53, 0x63, 0x79, 0x13, 0xA1, + 0xAD, 0x0A, 0x68, 0x67, 0x43, 0xB2, 0x5B, 0xD5, 0x36, 0xD4, + 0x84, 0xD0, 0xCD, 0x34, 0x82, 0x84, 0xA4, 0x89, 0xAE, 0xA1, + 0x66, 0x57, 0x89, 0x6F, 0xDC, 0x0C, 0x3B, 0x48, 0x14, 0x7C, + 0xCC, 0x63, 0x7C, 0x83, 0x93, 0x55, 0x7D, 0xB4, 0xF3, 0x34, + 0x66, 0x72, 0x85, 0xF5, 0x8D, 0xEF, 0x90, 0x1A, 0x66, 0xF8, + 0x3B, 0xC6, 0xA4, 0x59, 0xB8, 0x25, 0x4E, 0x5D, 0x84, 0xED, + 0x7C, 0x1C, 0xDD, 0x35, 0xA6, 0xBA, 0xED, 0x3B, 0xD6, 0x49, + 0xE6, 0x5A, 0xD1, 0xF8, 0xEA, 0x96, 0x75, 0x92, 0xCF, 0x05, + 0x52, 0x05, 0x3D, 0x78, 0x09, 0xCF, 0xCD, 0xE2, 0x1A, 0x99, + 0xEB, 0x5E, 0xFA, 0x27, 0x73, 0x89, 0x15, 0x03, 0x82, 0x01, + 0x06, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00, 0xC2, 0x35, 0x2D, + 0xEC, 0x83, 0x83, 0x6C, 0x73, 0x13, 0x9E, 0x52, 0x7C, 0x74, + 0xC8, 0x7B, 0xEE, 0xDF, 0x39, 0xC0, 0x33, 0xCD, 0x9F, 0xB2, + 0x22, 0x64, 0x9F, 0xC5, 0xE9, 0xFF, 0xF7, 0x09, 0x47, 0x79, + 0x13, 0x96, 0x77,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59, 0x6E, 0xA0, 0xC1, 0x6F, 0x99, + 0x4F, 0x28, 0xFA, 0xA6, 0x0B, 0x5C, 0x16, 0xEE, 0xB0, 0x98, + 0x8A, 0x06, 0x4A, 0xB0, 0x02, 0x2A, 0x6D, 0xCC, 0xE2, 0xC8, + 0x11, 0xF9, 0x1B, 0xF1, 0x3C, 0x68, 0xDF, 0xC2, 0xF4, 0x98, + 0x5F, 0x6C, 0xC8 +}; +static const int sizeof_dsa_pub_key_der_2048 = sizeof(dsa_pub_key_der_2048); + +/* ./certs/dsa2048.der, 2048-bit */ +static const unsigned char dsa_key_der_2048[] = +{ + 0x30, 0x82, 0x03, 0x3F, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, + 0x01, 0x00, 0xCC, 0x8E, 0xC9, 0xA0, 0xD5, 0x9A, 0x27, 0x1C, + 0xDA, 0x52, 0xDF, 0xC7, 0xC0, 0xE6, 0x06, 0xA4, 0x3E, 0x8A, + 0x66, 0x49, 0xD0, 0x59, 0x33, 0x51, 0x69, 0xC4, 0x9C, 0x5E, + 0x64, 0x85, 0xC7, 0xF1, 0xAB, 0xD5, 0xD9, 0x62, 0xAC, 0xFD, + 0xA1, 0xE0, 0x1B, 0x57, 0xFF, 0x96, 0xEF, 0x0C, 0x9F, 0xC8, + 0x44, 0x87, 0xEB, 0x5C, 0x91, 0xD0, 0x46, 0x42, 0x09, 0x50, + 0x6A, 0x23, 0xCB, 0x89, 0x6F, 0x55, 0xE9, 0x6A, 0x11, 0xA9, + 0xA8, 0x32, 0xAB, 0x33, 0x0D, 0x51, 0xB5, 0x79, 0x51, 0xB4, + 0xAB, 0xA2, 0x25, 0x11, 0x8D, 0xE5, 0x24, 0xBE, 0xD8, 0xF1, + 0x9D, 0x4E, 0x12, 0x6F, 0xAC, 0x44, 0x54, 0x80, 0xA9, 0xB4, + 0x81, 0x68, 0x4E, 0x44, 0x0E, 0xB8, 0x39, 0xF3, 0xBE, 0x83, + 0x08, 0x74, 0xA2, 0xC6, 0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xA2, 0x3A, 0x6C, 0x61, 0x84, 0xBF, + 0x68, 0xD4, 0xEA, 0x9B, 0xC5, 0x29, 0x48, 0x60, 0x15, 0x10, + 0x35, 0x2C, 0x44, 0x1D, 0xB5, 0x9A, 0xEE, 0xAC, 0xC1, 0x68, + 0xE8, 0x47, 0xB7, 0x41, 0x34, 0x39, 0x9A, 0xF8, 0xA5, 0x20, + 0xE9, 0x24, 0xC4, 0x2C, 0x58, 0x3F, 0x4C, 0x41, 0x30, 0x3A, + 0x14, 0x6E, 0x8D, 0xEA, 0xAD, 0xBA, 0x9B, 0x43, 0xD3, 0x98, + 0x2F, 0x83, 0xD8, 0x14, 0x67, 0xE8, 0xF8, 0xD5, 0x4F, 0xAC, + 0xE0, 0x3B, 0xBF, 0xA7, 0x54, 0x16, 0x5E, 0x49, 0x64, 0x26, + 0x54, 0xA4, 0x6B, 0x69, 0x7C, 0xBA, 0x8A, 0x83, 0xD9, 0x2E, + 0x65, 0x0A, 0xA2, 0x27, 0xEF, 0x99, 0x99, 0x08, 0xD7, 0xB5, + 0x9F, 0xA0, 0x01, 0xEF, 0x7E, 0x17, 0xBF, 0x83, 0x6B, 0x2E, + 0xDD, 0xC0, 0x39, 0x38, 0x23, 0x68, 0xB4, 0x76, 0x6B, 0xE5, + 0xCA, 0xF7, 0x7C, 0xEE, 0xC0, 0x52, 0xE2, 0xDD, 0xAD, 0x59, + 0x3A, 0x42, 0x06, 0x45, 0xB0, 0xC7, 0xC1, 0x77, 0x05, 0xB2, + 0x0C, 0x32, 0x40, 0x46, 0xAA, 0xDA, 0x79, 0x77, 0x04, 0x71, + 0xDF, 0x7A, 0x02, 0x15, 0x00, 0x98, 0xEE, 0xB9, 0x51, 0x37, + 0x3E, 0x75, 0x13, 0x13, 0x06, 0x8F, 0x94, 0xD3, 0xE6, 0xE9, + 0x00, 0xCB, 0x62, 0x6D, 0x9A +}; +static const int sizeof_dsa_key_der_2048 = sizeof(dsa_key_der_2048); + +/* ./certs/rsa2048.der, 2048-bit */ +static const unsigned char rsa_key_der_2048[] = +{ + 0x30, 0x82, 0x04, 0xA3, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, + 0x01, 0x00, 0xE9, 0x8A, 0x5D, 0x15, 0xA4, 0xD4, 0x34, 0xB9, + 0x59, 0xA2, 0xDA, 0xAF, 0x74, 0xC8, 0xC9, 0x03, 0x26, 0x38, + 0xFA, 0x48, 0xFC, 0x4D, 0x30, 0x6E, 0xEA, 0x76, 0x89, 0xCE, + 0x4F, 0xF6, 0x87, 0xDE, 0x32, 0x3A, 0x46, 0x6E, 0x38, 0x12, + 0x58, 0x37, 0x22, 0x0D, 0x80, 0xAC, 0x2D, 0xAF, 0x2F, 0x12, + 0x3E, 0x62, 0x73, 0x60, 0x66, 0x68, 0x90, 0xB2, 0x6F, 0x47, + 0x17, 0x04, 0x2B, 0xCA, 0xB7, 0x26, 0xB7, 0x10, 0xC2, 0x13, + 0xF9, 0x7A, 0x62, 0x0A, 0x93, 0x32, 0x90, 0x42, 0x0D, 0x16, + 0x2E, 0xFA, 0xD7, 0x29, 0xD7, 0x9F, 0x54, 0xE4, 0xFC, 0x65, + 0x74, 0xF8, 0xF6, 0x43, 0x6B, 0x4E, 0x9E, 0x34, 0x7F, 0xCB, + 0x6B, 0x1C, 0x1A, 0xDE, 0x82, 0x81, 0xBF, 0x08, 0x5D, 0x3F, + 0xC0, 0xB6, 0xB1, 0xA8, 0xA5, 0x9C, 0x81, 0x70, 0xA7, 0x4E, + 0x32, 0x87, 0x15, 0x1C, 0x78, 0x0E, 0xF0, 0x18, 0xFE, 0xEB, + 0x4B, 0x37, 0x2B, 0xE9, 0xE1, 0xF7, 0xFA, 0x51, 0xC6, 0x58, + 0xB9, 0xD8, 0x06, 0x03, 0xED, 0xC0, 0x03, 0x18, 0x55, 0x8B, + 0x98, 0xFE, 0xB1, 0xF6, 0xD0, 0x3D, 0xFA, 0x63, 0xC0, 0x38, + 0x19, 0xC7, 0x00, 0xEF, 0x4D, 0x99,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xC4, 0xEA, 0xD4, 0xBA, 0x0D, 0xA4, 0x9E, + 0xB3, 0x6E, 0xDE, 0x1A, 0x7A, 0xF8, 0x89, 0x88, 0xEF, 0x36, + 0x3C, 0x11, 0xBC, 0x83, 0xE8, 0x30, 0x6C, 0x81, 0x7C, 0x47, + 0xF3, 0x4D, 0xCA, 0xEA, 0x56, 0x01, 0x62, 0x55, 0x2E, 0x4B, + 0x89, 0xA9, 0xBD, 0x6F, 0x01, 0xF6, 0x74, 0x02, 0xAA, 0xE3, + 0x84, 0x66, 0x06, 0x95, 0x34, 0xA1, 0xE2, 0xCA, 0x65, 0xFE, + 0xA3, 0x2D, 0x43, 0x97, 0x95, 0x6C, 0x6F, 0xD5, 0xB4, 0x38, + 0xF6, 0xF9, 0x95, 0x30, 0xFA, 0xF8, 0x9C, 0x25, 0x2B, 0xB6, + 0x14, 0x51, 0xCC, 0x2E, 0xB3, 0x5B, 0xD6, 0xDC, 0x1A, 0xEC, + 0x2D, 0x09, 0x5B, 0x3F, 0x3A, 0xD0, 0xB8, 0x4E, 0x27, 0x1F, + 0xDC, 0x2A, 0xEE, 0xAC, 0xA9, 0x59, 0x5D, 0x07, 0x63, 0x11, + 0x83, 0x0B, 0xD4, 0x74, 0x80, 0xB6, 0x7D, 0x62, 0x45, 0xBF, + 0x56 +}; +static const int sizeof_rsa_key_der_2048 = sizeof(rsa_key_der_2048); + +/* ./certs/ca-key.der, 2048-bit */ +static const unsigned char ca_key_der_2048[] = +{ + 0x30, 0x82, 0x04, 0xA4, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, + 0x01, 0x00, 0xBF, 0x0C, 0xCA, 0x2D, 0x14, 0xB2, 0x1E, 0x84, + 0x42, 0x5B, 0xCD, 0x38, 0x1F, 0x4A, 0xF2, 0x4D, 0x75, 0x10, + 0xF1, 0xB6, 0x35, 0x9F, 0xDF, 0xCA, 0x7D, 0x03, 0x98, 0xD3, + 0xAC, 0xDE, 0x03, 0x66, 0xEE, 0x2A, 0x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 0x27, 0x61, + 0xBE, 0x57, 0x45, 0xDD, 0xB7, 0x45, 0x17, 0x24, 0xF5, 0x23, + 0xE4, 0x38, 0x0E, 0x91, 0x27, 0xEE, 0xE3, 0x20, 0xD8, 0x14, + 0xC8, 0x94, 0x47, 0x77, 0x40, 0x77, 0x45, 0x18, 0x9E, 0x0D, + 0xCE, 0x79, 0x3F, 0x57, 0x31, 0x56, 0x09, 0x49, 0x67, 0xBE, + 0x94, 0x58, 0x4F, 0xF6, 0xC4, 0xAB, 0xE2, 0x89, 0xE3, 0xE3, + 0x8A, 0xC0, 0x05, 0x55, 0x2C, 0x24, 0xC0, 0x4A, 0x97, 0x04, + 0x27, 0x9A +}; +static const int sizeof_ca_key_der_2048 = sizeof(ca_key_der_2048); + +/* ./certs/ca-cert.der, 2048-bit */ +static const unsigned char ca_cert_der_2048[] = +{ + 0x30, 0x82, 0x04, 0xFF, 0x30, 0x82, 0x03, 0xE7, 0xA0, 0x03, + 0x02, 0x01, 0x02, 0x02, 0x14, 0x6B, 0x9B, 0x70, 0xC6, 0xF1, + 0xA3, 0x94, 0x65, 0x19, 0xA1, 0x08, 0x58, 0xEF, 0xA7, 0x8D, + 0x2B, 0x7A, 0x83, 0xC1, 0xDA, 0x30, 0x0D, 0x06, 0x09, 0x2A, + 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, + 0x30, 0x81, 0x94, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, + 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, + 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, + 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, + 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, + 0x61, 0x6E, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, + 0x0A, 0x0C, 0x08, 0x53, 0x61, 0x77, 0x74, 0x6F, 0x6F, 0x74, + 0x68, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0B, + 0x0C, 0x0A, 0x43, 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, + 0x6E, 0x67, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, + 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, + 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, + 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, + 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x32, 0x34, 0x31, 0x32, 0x31, + 0x38, 0x32, 0x31, 0x32, 0x35, 0x32, 0x39, 0x5A, 0x17, 0x0D, + 0x32, 0x37, 0x30, 0x39, 0x31, 0x34, 0x32, 0x31, 0x32, 0x35, + 0x32, 0x39, 0x5A, 0x30, 0x81, 0x94, 0x31, 0x0B, 0x30, 0x09, + 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, + 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, + 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, + 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, + 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x11, 0x30, 0x0F, 0x06, + 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x08, 0x53, 0x61, 0x77, 0x74, + 0x6F, 0x6F, 0x74, 0x68, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, + 0x55, 0x04, 0x0B, 0x0C, 0x0A, 0x43, 0x6F, 0x6E, 0x73, 0x75, + 0x6C, 0x74, 0x69, 0x6E, 0x67, 0x31, 0x18, 0x30, 0x16, 0x06, + 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, + 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, + 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, + 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, + 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, + 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, + 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xBF, 0x0C, 0xCA, + 0x2D, 0x14, 0xB2, 0x1E, 0x84, 0x42, 0x5B, 0xCD, 0x38, 0x1F, + 0x4A, 0xF2, 0x4D, 0x75, 0x10, 0xF1, 0xB6, 0x35, 0x9F, 0xDF, + 0xCA, 0x7D, 0x03, 0x98, 0xD3, 0xAC, 0xDE, 0x03, 0x66, 0xEE, + 0x2A, 0xF1, 0xD8, 0xB0, 0x7D, 0x6E, 0x07, 0x54, 0x0B, 0x10, + 0x98, 0x21, 0x4D, 0x80, 0xCB, 0x12, 0x20, 0xE7, 0xCC, 0x4F, + 0xDE, 0x45, 0x7D, 0xC9, 0x72, 0x77, 0x32, 0xEA, 0xCA, 0x90, + 0xBB, 0x69, 0x52, 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x0B, 0xEC, 0xD8, 0x28, 0xB3, 0x4B, 0xBD, + 0xED, 0x36, 0x79, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x82, + 0x01, 0x45, 0x30, 0x82, 0x01, 0x41, 0x30, 0x1D, 0x06, 0x03, + 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x27, 0x8E, 0x67, + 0x11, 0x74, 0xC3, 0x26, 0x1D, 0x3F, 0xED, 0x33, 0x63, 0xB3, + 0xA4, 0xD8, 0x1D, 0x30, 0xE5, 0xE8, 0xD5, 0x30, 0x81, 0xD4, + 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x81, 0xCC, 0x30, 0x81, + 0xC9, 0x80, 0x14, 0x27, 0x8E, 0x67, 0x11, 0x74, 0xC3, 0x26, + 0x1D, 0x3F, 0xED, 0x33, 0x63, 0xB3, 0xA4, 0xD8, 0x1D, 0x30, + 0xE5, 0xE8, 0xD5, 0xA1, 0x81, 0x9A, 0xA4, 0x81, 0x97, 0x30, + 0x81, 0x94, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, + 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, + 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, + 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, + 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, + 0x6E, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x0A, + 0x0C, 0x08, 0x53, 0x61, 0x77, 0x74, 0x6F, 0x6F, 0x74, 0x68, + 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, + 0x0A, 0x43, 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, 0x6E, + 0x67, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, + 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, + 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, + 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, + 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, + 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, + 0x82, 0x14, 0x6B, 0x9B, 0x70, 0xC6, 0xF1, 0xA3, 0x94, 0x65, + 0x19, 0xA1, 0x08, 0x58, 0xEF, 0xA7, 0x8D, 0x2B, 0x7A, 0x83, + 0xC1, 0xDA, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, + 0x05, 0x30, 0x03, 0x01, 0x01, 0xFF, 0x30, 0x1C, 0x06, 0x03, + 0x55, 0x1D, 0x11, 0x04, 0x15, 0x30, 0x13, 0x82, 0x0B, 0x65, + 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2E, 0x63, 0x6F, 0x6D, + 0x87, 0x04, 0x7F, 0x00, 0x00, 0x01, 0x30, 0x1D, 0x06, 0x03, + 0x55, 0x1D, 0x25, 0x04, 0x16, 0x30, 0x14, 0x06, 0x08, 0x2B, + 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01, 0x06, 0x08, 0x2B, + 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x02, 0x30, 0x0D, 0x06, + 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, + 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x77, 0x3B, 0x3D, + 0x66, 0x74, 0xBC, 0x97, 0xFE, 0x40, 0x16, 0xE6, 0xBA, 0xA5, +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0xBC, 0xFF, + 0xA0, 0x7C, 0x94, 0x3B, 0x7D, 0x86, 0x42, 0xAF, 0x3D, 0x83, + 0x31, 0xEE, 0x2A, 0x3B, 0x7B, 0xF0, 0x2C, 0x9E, 0x6F, 0xE9, + 0xC4, 0x07, 0x81, 0x24, 0xDA, 0x05, 0x70, 0x4D, 0xDD, 0x09, + 0xAE, 0x9E, 0x72, 0xB8, 0x21, 0x0E, 0x8C, 0xB2, 0xAB, 0xAA, + 0x4C, 0x49, 0x10, 0xF7, 0x76, 0xF9, 0xB5, 0x0D, 0x6C, 0x20, + 0xD3, 0xDF, 0x7A, 0x06, 0x32, 0x8D, 0x29, 0x1F, 0x28, 0x1D, + 0x8D, 0x26, 0x33 +}; +static const int sizeof_ca_cert_der_2048 = sizeof(ca_cert_der_2048); + +/* ./certs/ca-cert-chain.der, 2048-bit */ +static const unsigned char ca_cert_chain_der[] = +{ + 0x30, 0x82, 0x03, 0xFA, 0x30, 0x82, 0x03, 0x63, 0xA0, 0x03, + 0x02, 0x01, 0x02, 0x02, 0x14, 0x22, 0x3E, 0x28, 0x4D, 0xF0, + 0xF6, 0xC5, 0x97, 0x06, 0xB3, 0xAD, 0x8A, 0x59, 0x4D, 0xA0, + 0x87, 0x3F, 0xB3, 0xCE, 0x8C, 0x30, 0x0D, 0x06, 0x09, 0x2A, + 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, + 0x30, 0x81, 0x94, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, + 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, + 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, + 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, + 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, + 0x61, 0x6E, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, + 0x0A, 0x0C, 0x08, 0x53, 0x61, 0x77, 0x74, 0x6F, 0x6F, 0x74, + 0x68, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0B, + 0x0C, 0x0A, 0x43, 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, + 0x6E, 0x67, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, + 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, + 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, + 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, + 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x32, 0x34, 0x31, 0x32, 0x31, + 0x38, 0x32, 0x31, 0x32, 0x35, 0x32, 0x39, 0x5A, 0x17, 0x0D, + 0x32, 0x37, 0x30, 0x39, 0x31, 0x34, 0x32, 0x31, 0x32, 0x35, + 0x32, 0x39, 0x5A, 0x30, 0x81, 0x94, 0x31, 0x0B, 0x30, 0x09, + 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, + 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, + 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, + 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, + 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x11, 0x30, 0x0F, 0x06, + 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x08, 0x53, 0x61, 0x77, 0x74, + 0x6F, 0x6F, 0x74, 0x68, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, + 0x55, 0x04, 0x0B, 0x0C, 0x0A, 0x43, 0x6F, 0x6E, 0x73, 0x75, + 0x6C, 0x74, 0x69, 0x6E, 0x67, 0x31, 0x18, 0x30, 0x16, 0x06, + 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, + 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, + 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, + 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, + 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, + 0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, + 0x81, 0x81, 0x00, 0xCD, 0xAC, 0xDD, 0x47, 0xEC, 0xBE, 0xB7, + 0x24, 0xC3, 0x63, 0x1B, 0x54, 0x98, 0x79, 0xE1, 0xC7, 0x31, + 0x16, 0x59, 0xD6, 0x9D, 0x77, 0x9D, 0x8D, 0xE2, 0x8B, 0xED, + 0x04, 0x17, 0xB2, 0xC6, 0xEB, 0xE4, 0x9B, 0x91, 0xBE, 0x31, + 0x50, 0x62, 0x97, 0x58, 0xB5, 0x7F, 0x29, 0xDE, 0xB3, 0x71, + 0x24, 0x0B, 0xBF, 0x97, 0x09, 0x7F, 0x26, 0xDC, 0x2D, 0xEC, + 0xA8, 0x2E, 0xB2, 0x64, 0x2B, 0x7A, 0x2B, 0x35, 0x19, 0x2D, + 0xA2, 0x80, 0xCB, 0x99, 0xFD, 0x94, 0x71, 0x1B, 0x23, 0x8D, + 0x54, 0xDB, 0x2E, 0x62, 0x8D, 0x81, 0x08, 0x2D, 0xF4, 0x24, + 0x72, 0x27, 0x6C, 0xF9, 0xC9, 0x8E, 0xDB, 0x4C, 0x75, 0xBA, + 0x9B, 0x01, 0xF8, 0x3F, 0x18, 0xF4, 0xE6, 0x7F, 0xFB, 0x57, + 0x94, 0x92, 0xCC, 0x88, 0xC4, 0xB4, 0x00, 0xC2, 0xAA, 0xD4, + 0xE5, 0x88, 0x18, 0xB3, 0x11, 0x2F, 0x73, 0xC0, 0xD6, 0x29, + 0x09, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x82, 0x01, 0x45, + 0x30, 0x82, 0x01, 0x41, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, + 0x0E, 0x04, 0x16, 0x04, 0x14, 0xD3, 0x22, 0x8F, 0x28, 0x2C, + 0xE0, 0x05, 0xEE, 0xD3, 0xED, 0xC3, 0x71, 0x3D, 0xC9, 0xB2, + 0x36, 0x3A, 0x1D, 0xBF, 0xA8, 0x30, 0x81, 0xD4, 0x06, 0x03, + 0x55, 0x1D, 0x23, 0x04, 0x81, 0xCC, 0x30, 0x81, 0xC9, 0x80, + 0x14, 0xD3, 0x22, 0x8F, 0x28, 0x2C, 0xE0, 0x05, 0xEE, 0xD3, + 0xED, 0xC3, 0x71, 0x3D, 0xC9, 0xB2, 0x36, 0x3A, 0x1D, 0xBF, + 0xA8, 0xA1, 0x81, 0x9A, 0xA4, 0x81, 0x97, 0x30, 0x81, 0x94, + 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, + 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, + 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, + 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, + 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, + 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x08, + 0x53, 0x61, 0x77, 0x74, 0x6F, 0x6F, 0x74, 0x68, 0x31, 0x13, + 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0A, 0x43, + 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, 0x6E, 0x67, 0x31, + 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, + 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, + 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, + 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, + 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, + 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82, 0x14, + 0x22, 0x3E, 0x28, 0x4D, 0xF0, 0xF6, 0xC5, 0x97, 0x06, 0xB3, + 0xAD, 0x8A, 0x59, 0x4D, 0xA0, 0x87, 0x3F, 0xB3, 0xCE, 0x8C, + 0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30, + 0x03, 0x01, 0x01, 0xFF, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x1D, + 0x11, 0x04, 0x15, 0x30, 0x13, 0x82, 0x0B, 0x65, 0x78, 0x61, + 0x6D, 0x70, 0x6C, 0x65, 0x2E, 0x63, 0x6F, 0x6D, 0x87, 0x04, + 0x7F, 0x00, 0x00, 0x01, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, + 0x25, 0x04, 0x16, 0x30, 0x14, 0x06, 0x08, 0x2B, 0x06, 0x01, + 0x05, 0x05, 0x07, 0x03, 0x01, 0x06, 0x08, 0x2B, 0x06, 0x01, + 0x05, 0x05, 0x07, 0x03, 0x02, 0x30, 0x0D, 0x06, 0x09, 0x2A, + 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, + 0x03, 0x81, 0x81, 0x00, 0x4E, 0x35, 0x89, 0x4C, 0x99, 0xC8, + 0x51, 0x46, 0x5B, 0x86, 0x21, 0xF3, 0x92, 0x13, 0x2D, 0x0E, + 0x73, 0x78, 0x85, 0xBC, 0x81, 0xBB, 0xD1, 0x4B, 0xC3, 0x1B, + 0x65, 0xB5, 0x39, 0x71, 0xA7, 0x04, 0x39, 0x8D, 0x57, 0x20, + 0x02, 0xA0, 0x33, 0x8C, 0xFF, 0xD5, 0xFC, 0x2E, 0x94, 0x56, + 0x48, 0xFC, 0x08, 0x4A, 0x37, 0x19, 0x98, 0x81, 0xAF, 0x51, + 0x3F, 0xB7, 0x91, 0x0A, 0x86, 0x4E, 0x97, 0xE2, 0x39, 0x92, + 0xF5, 0x3E, 0x99, 0xB2, 0x88, 0x1B, 0xAA, 0x97, 0x95, 0x77, + 0x2E, 0xDA, 0x41, 0x11, 0xD7, 0x8F, 0x74, 0x9D, 0x34, 0xD0, + 0x70, 0xCA, 0x37, 0xAA, 0xF7, 0xD7, 0x39, 0xD6, 0xA8, 0x48, + 0x34, 0x06, 0x3A, 0x6A, 0xDA, 0xDE, 0x8A, 0x1D, 0x3C, 0x41, + 0x56, 0xA3, 0x4E, 0xAE, 0x9F, 0x50, 0xB4, 0x8E, 0x10, 0x39, + 0xD9, 0xA2, 0x38, 0xD0, 0x22, 0x04, 0xCA, 0x31, 0x1C, 0xAC, + 0x3C, 0xF2 +}; +static const int sizeof_ca_cert_chain_der = sizeof(ca_cert_chain_der); + +/* ./certs/server-key.der, 2048-bit */ +static const unsigned char server_key_der_2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B4, 0xF2, 0x1C, 0xAC, + 0x6B, 0xE9, 0x0C, 0x56, 0x36, 0xB7, 0x4E, 0x72, 0x96, 0xD5, + 0xE5, 0x8A, 0xD2, 0xE2, 0xFF, 0xF1, 0xF1, 0x18, 0x13, 0x3D, + 0x86, 0x09, 0xB8, 0xD8, 0x76, 0xA7, 0xC9, 0x1C, 0x71, 0x52, + 0x94, 0x30, 0x43, 0xE0, 0xF1, 0x78, 0x74, 0xFD, 0x61, 0x1B, + 0x4C, 0x09, 0xCC, 0xE6, 0x68, 0x2A, 0x71, 0xAD, 0x1C, 0xDF, + 0x43, 0xBC, 0x56, 0xDB, 0xA5, 0xA4, 0xBE, 0x35, 0x70, 0xA4, + 0x5E, 0xCF, 0x4F, 0xFC, 0x00, 0x55, 0x99, 0x3A, 0x3D, 0x23, + 0xCF, 0x67, 0x5A, 0xF5, 0x22, 0xF8, 0xB5, 0x29, 0xD0, 0x44, + 0x11, 0xEB, 0x35, 0x2E, 0x46, 0xBE, 0xFD, 0x8E, 0x18, 0xB2, + 0x5F, 0xA8, 0xBF, 0x19, 0x32, 0xA1, 0xF5, 0xDC, 0x03, 0xE6, + 0x7C, 0x9A, 0x1F, 0x0C, 0x7C, 0xA9, 0xB0, 0x0E, 0x21, 0x37, + 0x3B, 0xF1, 0xB0 +}; +static const int sizeof_server_key_der_2048 = sizeof(server_key_der_2048); + +/* ./certs/server-cert.der, 2048-bit */ +static const unsigned char server_cert_der_2048[] = +{ + 0x30, 0x82, 0x04, 0xE8, 0x30, 0x82, 0x03, 0xD0, 0xA0, 0x03, + 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x30, 0x0D, 0x06, 0x09, + 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, + 0x00, 0x30, 0x81, 0x94, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, + 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, + 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, + 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, + 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, + 0x6D, 0x61, 0x6E, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, + 0x04, 0x0A, 0x0C, 0x08, 0x53, 0x61, 0x77, 0x74, 0x6F, 0x6F, + 0x74, 0x68, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, + 0x0B, 0x0C, 0x0A, 0x43, 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74, + 0x69, 0x6E, 0x67, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, + 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, + 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, + 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, + 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, + 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, + 0x6F, 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x32, 0x34, 0x31, 0x32, + 0x31, 0x38, 0x32, 0x31, 0x32, 0x35, 0x33, 0x30, 0x5A, 0x17, + 0x0D, 0x32, 0x37, 0x30, 0x39, 0x31, 0x34, 0x32, 0x31, 0x32, + 0x35, 0x33, 0x30, 0x5A, 0x30, 0x81, 0x90, 0x31, 0x0B, 0x30, + 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, + 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, + 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, + 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, + 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x10, 0x30, 0x0E, + 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x07, 0x77, 0x6F, 0x6C, + 0x66, 0x53, 0x53, 0x4C, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, + 0x55, 0x04, 0x0B, 0x0C, 0x07, 0x53, 0x75, 0x70, 0x70, 0x6F, + 0x72, 0x74, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, + 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, + 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, + 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, + 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, + 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, + 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, + 0x82, 0x01, 0x01, 0x00, 0xC0, 0x95, 0x08, 0xE1, 0x57, 0x41, + 0xF2, 0x71, 0x6D, 0xB7, 0xD2, 0x45, 0x41, 0x27, 0x01, 0x65, + 0xC6, 0x45, 0xAE, 0xF2, 0xBC, 0x24, 0x30, 0xB8, 0x95, 0xCE, + 0x2F, 0x4E, 0xD6, 0xF6, 0x1C, 0x88, 0xBC, 0x7C, 0x9F,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 0xE2, 0x5D, + 0x25, 0xC9, 0x6A, 0x0D, 0xC3, 0x39, 0x60, 0xA4, 0xB4, 0xB0, + 0x69, 0x42, 0x42, 0x09, 0xE9, 0xD8, 0x08, 0xBC, 0x33, 0x20, + 0xB3, 0x58, 0x22, 0xA7, 0xAA, 0xEB, 0xC4, 0xE1, 0xE6, 0x61, + 0x83, 0xC5, 0xD2, 0x96, 0xDF, 0xD9, 0xD0, 0x4F, 0xAD, 0xD7, + 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x82, 0x01, 0x45, 0x30, + 0x82, 0x01, 0x41, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, + 0x04, 0x16, 0x04, 0x14, 0xB3, 0x11, 0x32, 0xC9, 0x92, 0x98, + 0x84, 0xE2, 0xC9, 0xF8, 0xD0, 0x3B, 0x6E, 0x03, 0x42, 0xCA, + 0x1F, 0x0E, 0x8E, 0x3C, 0x30, 0x81, 0xD4, 0x06, 0x03, 0x55, + 0x1D, 0x23, 0x04, 0x81, 0xCC, 0x30, 0x81, 0xC9, 0x80, 0x14, + 0x27, 0x8E, 0x67, 0x11, 0x74, 0xC3, 0x26, 0x1D, 0x3F, 0xED, + 0x33, 0x63, 0xB3, 0xA4, 0xD8, 0x1D, 0x30, 0xE5, 0xE8, 0xD5, + 0xA1, 0x81, 0x9A, 0xA4, 0x81, 0x97, 0x30, 0x81, 0x94, 0x31, + 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, + 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, + 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, + 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, + 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x11, + 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x08, 0x53, + 0x61, 0x77, 0x74, 0x6F, 0x6F, 0x74, 0x68, 0x31, 0x13, 0x30, + 0x11, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0A, 0x43, 0x6F, + 0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, 0x6E, 0x67, 0x31, 0x18, + 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, + 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, + 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, + 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, + 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, + 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82, 0x14, 0x6B, + 0x9B, 0x70, 0xC6, 0xF1, 0xA3, 0x94, 0x65, 0x19, 0xA1, 0x08, + 0x58, 0xEF, 0xA7, 0x8D, 0x2B, 0x7A, 0x83, 0xC1, 0xDA, 0x30, + 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30, 0x03, + 0x01, 0x01, 0xFF, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x1D, 0x11, + 0x04, 0x15, 0x30, 0x13, 0x82, 0x0B, 0x65, 0x78, 0x61, 0x6D, + 0x70, 0x6C, 0x65, 0x2E, 0x63, 0x6F, 0x6D, 0x87, 0x04, 0x7F, + 0x00, 0x00, 0x01, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x25, + 0x04, 0x16, 0x30, 0x14, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, + 0x05, 0x07, 0x03, 0x01, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, + 0x05, 0x07, 0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6, 0x3D, 0x81, 0xD9, 0x01, 0xA7, 0x8A, 0x79, + 0xAB, 0x3C, 0xCE, 0xE5, 0xB6, 0xC3, 0x1B, 0xEF, 0x7D, 0x5E, + 0x37, 0x7B, 0x37, 0x7C, 0x91, 0x89, 0x59, 0x11, 0x21, 0x11, + 0x7C, 0x05, 0x80, 0xE1, 0xA8, 0xD6, 0xF9, 0x35, 0xDA, 0x1B, + 0x86, 0x06, 0x5A, 0x32, 0x67, 0x6C, 0xA9, 0x2B, 0xE0, 0x31, + 0x7B, 0x89, 0x53, 0x37, 0x42, 0xAF, 0x34, 0xA4, 0x53, 0xD2, + 0x7C, 0x91, 0x50, 0x63, 0x3A, 0x8E, 0x4A, 0x1F, 0xA3, 0x90, + 0x4E, 0x7C, 0x41, 0x59, 0x1D, 0xEB, 0x7B, 0xA2, 0x14, 0x87, + 0xBA, 0x76, 0x36, 0xA4, 0x77, 0x46, 0x34, 0xF2, 0x55, 0x50, + 0xF0, 0x24, 0x9F, 0x83, 0x83, 0xDA, 0xA6, 0xAA, 0x3C, 0xC8 + +}; +static const int sizeof_server_cert_der_2048 = sizeof(server_cert_der_2048); + +#endif /* USE_CERT_BUFFERS_2048 */ + +#ifdef USE_CERT_BUFFERS_3072 + +/* ./certs/dh3072.der, 3072-bit */ +static const unsigned char dh_key_der_3072[] = +{ + 0x30, 0x82, 0x01, 0x88, 0x02, 0x82, 0x01, 0x81, 0x00, 0x89, + 0x1B, 0x75, 0x3F, 0x84, 0xB6, 0x11, 0xED, 0x21, 0xF1, 0x08, + 0x0F, 0xB8, 0x06, 0xC9, 0xA3, 0xC9, 0x41, 0xDB, 0x5A, 0xC8, + 0xF8, 0x82, 0x73, 0x0F, 0xEB, 0x89, 0x1E, 0x54, 0x18, 0xBE, + 0xE6, 0x48, 0x41, 0x9E, 0xFA, 0xC2, 0x0C, 0x50, 0x67, 0xC3, + 0x5D, 0xB5, 0xF5, 0x0F, 0x23, 0x6A, 0x43, 0x33, 0x91, 0xD9, + 0x40, 0xF3, 0x66, 0xC6, 0x99, 0xFF, 0x97, 0xB6, 0x7B, 0xAF, + 0x27, 0x72, 0x3B, 0x9F, 0x7E, 0x58, 0x18, 0x14, 0x9F, 0x91, + 0x6E, 0x2B, 0x11, 0xC1, 0x57, 0x49, 0x27, 0x36, 0x78, 0xE1, + 0x09, 0x68, 0x9C, 0x05, 0x5A, 0xAC, 0xE6, 0x00, 0x38, 0xBE, + 0x95, 0x74, 0x81, 0x53, 0x28, 0xF0, 0xAD, 0xDF, 0xB5, 0x87, + 0x1C, 0x72, 0x17, 0x4E, 0xEC, 0x00, 0x91, 0x22, 0xAA, 0xE4, + 0x88, 0xD7, 0xF5, 0x3D, 0x1F, 0x03, 0x13, 0x2D, 0x1C, 0xFB, + 0xDE, 0x59, 0x68, 0xAD, 0xE0, 0x17, 0xA1, 0xEE, 0x8D, 0xCC, + 0xBF, 0xFE, 0xCF, 0x24, 0x42, 0xED, 0x26, 0xDD, 0x29, 0xD0, + 0x4E, 0x62, 0x3C, 0x85, 0x36, 0x1B, 0x5F, 0x6A, 0x47, 0x88, + 0x21, 0xE5, 0x1B, 0x85, 0x0A, 0x2C, 0xE9, 0x2F, 0xE0, 0x20, + 0xFC, 0x1D, 0xCD, 0x55, 0x66, 0xF5, 0xAC, 0x32, 0x00, 0x8E, + 0xA3, 0xE9, 0xED, 0xFB, 0x35, 0xA7, 0xE6, 0x76, 0x53, 0x42, + 0xC6, 0x77, 0x77, 0xAB, 0x90, 0x99, 0x7C, 0xC2, 0xEC, 0xC9, + 0x18, 0x4A, 0x3C, 0xF4, 0x11, 0x75, 0x27, 0x83, 0xBD, 0x9E, + 0xC2, 0x8F, 0x23, 0xAB, 0x52, 0x46, 0xE2, 0x52, 0x5D, 0x9A, + 0x04, 0xC3, 0x15, 0x1F, 0x69, 0x9C, 0x72, 0x69, 0x59, 0x52, + 0xD4, 0x69, 0x3D, 0x19, 0x77, 0x36, 0x25, 0xAF, 0x07, 0x71, + 0x82, 0xDE, 0xB7, 0x24, 0x60, 0x82, 0x6A, 0x72, 0xBB, 0xED, + 0xB6, 0x76, 0xAE, 0x7E, 0xBC, 0x7D, 0x2F, 0x73, 0x4B, 0x04, + 0x16, 0xD5, 0xA4, 0xF3, 0x03, 0x26, 0xFB, 0xF3, 0xCD, 0x7B, + 0x77, 0x7E, 0x7C, 0x8D, 0x65, 0xAE, 0xA5, 0xDC, 0x6C, 0xE3, + 0x70, 0xD2, 0x29, 0x6B, 0xF2, 0xEB, 0x76, 0xC9, 0xE5, 0x46, + 0x18, 0x12, 0x57, 0xB0, 0x55, 0xA5, 0x7C, 0xCD, 0x41, 0x93, + 0x26, 0x99, 0xF7, 0xA5, 0xC5, 0x34, 0xBE, 0x59, 0x79, 0xDE, + 0x0A, 0x57, 0x5F, 0x21, 0xF8, 0x98, 0x52, 0xF0, 0x2F, 0x7B, + 0x57, 0xB6, 0x9D, 0xFC, 0x40, 0xA6, 0x55, 0xFB, 0xAF, 0xD9, + 0x16, 0x9B, 0x20, 0x4F, 0xA8, 0xA3, 0x0B, 0x04, 0x48, 0xE3, + 0x77, 0x22, 0xC4, 0xCC, 0x57, 0x14, 0x33, 0xA2, 0xF0, 0x9A, + 0xE3, 0x12, 0xBD, 0xFF, 0x72, 0x8B, 0xEE, 0x52, 0xF3, 0xC9, + 0x59, 0xC2, 0xA2, 0x6B, 0xA5, 0x75, 0x48, 0x51, 0x82, 0x0E, + 0x7A, 0xFF, 0xFE, 0x41, 0xCD, 0x7C, 0x63, 0xD2, 0x53, 0xA8, + 0x11, 0x03, 0xB9, 0x03, 0x07, 0xFE, 0x66, 0x38, 0x5F, 0xA2, + 0x3E, 0x9C, 0x1B, 0x02, 0x01, 0x02 +}; +static const int sizeof_dh_key_der_3072 = sizeof(dh_key_der_3072); + +/* ./certs/dsa3072.der, 3072-bit */ +static const unsigned char dsa_key_der_3072[] = +{ + 0x30, 0x82, 0x04, 0xD7, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, + 0x81, 0x00, 0x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10, + 0x14, 0x36, 0xDF, 0xED, 0x66, 0x02, 0x03, 0x4A, 0x42, 0x70, + 0x71, 0x22, 0xAD, 0xE7, 0x53, 0x91, 0xF4, 0x40, 0x8F, 0x72, + 0x7E, 0x54, 0xA0, 0x5D, 0x58, 0x93, 0xD6, 0xF6, 0xBC, 0x87, + 0x1A, 0x68, 0x0F, 0xAB, 0x94, 0x20, 0x70, 0xC2, 0x11, 0xA1, + 0x14, 0xBC, 0x06, 0xA8, 0x44, 0xB9, 0x1F, 0x04, 0x49, 0x7E, + 0xB3, 0x9A, 0x53, 0x46, 0x05, 0x75, 0x5D, 0x29, 0x77, 0x28, + 0xA9, 0xB1, 0xDC, 0xF1, 0x0D, 0x8A, 0x1C, 0x5E, 0xCD, 0xD7, + 0x4C, 0x16, 0x6F, 0x88, 0xBF, 0xB3, 0x34, 0xE2, 0xAD, 0x9A, + 0xC4, 0x89, 0xE2, 0x2E, 0x5C, 0x20, 0xE1, 0x5F, 0x39, 0xBF, + 0xB7, 0x45, 0xD3, 0x0F, 0x98, 0xB0, 0xD8, 0xC9, 0x18, 0x91, + 0x17, 0x25, 0xBC, 0x53, 0x62, 0xFF, 0x27, 0x85, 0xBD, 0xE2, + 0xE3, 0x9C, 0xA8, 0x06, 0x7A, 0x54, 0xEA, 0xFD, 0xEA, 0x02, + 0x20, 0x4C, 0xAC, 0x69, 0x62, 0x08, 0xE5, 0xCD, 0x14, 0xC8, + 0x2D, 0x4E, 0xDF, 0x1F, 0x60, 0x1D, 0x93, 0x44, 0x86, 0x5D, + 0x73, 0x99, 0x40, 0x1B, 0xDC, 0xA9, 0xBA, 0xC4, 0x1B, 0x12, + 0x6C, 0xFF, 0x53 +}; +static const int sizeof_dsa_key_der_3072 = sizeof(dsa_key_der_3072); + +/* ./certs/rsa3072.der, 3072-bit */ +static const unsigned char rsa_key_der_3072[] = +{ + 0x30, 0x82, 0x06, 0xE4, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, + 0x81, 0x00, 0xB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xA2, 0x3B, 0x70, 0x31, 0x91, 0x68, 0xB9, 0xBF, + 0xE0, 0xA1, 0x39, 0x80, 0xFE, 0x47, 0x99, 0x56, 0x6D, 0x76, + 0x90, 0x17, 0xF5, 0x67, 0x41, 0x44, 0x27, 0x10, 0x07, 0x98, + 0x4D, 0x4C, 0x53, 0xD4, 0x15, 0xDC, 0x0A, 0x2F, 0xE0, 0x83, + 0x28, 0x22, 0x8D, 0x61, 0x3B, 0xE4, 0x8E, 0xE5, 0xE7, 0x24, + 0x98, 0x19, 0xA8, 0xA3, 0xED, 0x70, 0x59, 0x06, 0x86, 0x76, + 0xC2, 0x4B, 0xCB, 0x17, 0xC5, 0x77, 0x12, 0x07, 0xB8, 0xAB, + 0x1A, 0x91, 0xFC, 0x72, 0x8E, 0xB7, 0xB1, 0xE6, 0x74, 0xDD, + 0x3D, 0x92, 0xA7, 0xDE, 0x6C, 0x6E, 0xCB, 0x50, 0x44, 0x2F, + 0xAC, 0x99, 0xF7, 0x36, 0x4D, 0x62, 0xC7, 0xAC, 0xCE, 0x7D, + 0x26, 0xC9, 0xD2, 0x4E, 0x49, 0xD7, 0x8E, 0x66, 0x6C, 0xC1, + 0x53, 0xDF, 0x31, 0xAB, 0x25, 0x35, 0xCA, 0xD6, 0xC4, 0xA3, + 0xA6, 0x9F, 0x7E, 0x3D, 0x2D, 0x1A, 0x44, 0x31, 0x3D, 0x81, + 0x91, 0xB8, 0x36, 0x08, 0x27, 0x42, 0x9E, 0x08 +}; +static const int sizeof_rsa_key_der_3072 = sizeof(rsa_key_der_3072); + +/* ./certs/3072/client-key.der, 3072-bit */ +static const unsigned char client_key_der_3072[] = +{ + 0x30, 0x82, 0x06, 0xFE, 0x02, 0x01, 0x00, 0x30, 0x0D, 0x06, + 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, + 0x05, 0x00, 0x04, 0x82, 0x06, 0xE8, 0x30, 0x82, 0x06, 0xE4, + 0x02, 0x01, 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BD, 0xAF, + 0x69, 0x37, 0xFE, 0x41, 0xB5, 0x53, 0xB3, 0xB2, 0xC0, 0xB1, + 0x80, 0x34, 0xE6, 0xE1, 0x7B, 0xAE, 0x67, 0xC7, 0xF3, 0x57, + 0xFE, 0x12, 0xBC, 0x78, 0xAA, 0x75, 0x0D, 0xAC, 0x79, 0x90, + 0x14, 0x49, 0xFE, 0x6B, 0x51, 0xE3, 0xE4, 0x46, 0xB2, 0x10, + 0x4D, 0x05, 0x6A, 0x12, 0x80, 0x2A, 0x8F, 0x39, 0x42, 0x0E, + 0x3B, 0x24, 0x2B, 0x50, 0x5D, 0xF3, 0xA7, 0x7F, 0x2F, 0x82, + 0x89, 0x87, 0x9F, 0xF8, 0x7B, 0x1E, 0x05, 0x6E, 0x75, 0x83, + 0x04, 0x35, 0x66, 0x4A, 0x06, 0x57, 0x39, 0xAB, 0x21, 0x0B, + 0x94, 0x41, 0x6A, 0x2A, 0xC7, 0xDE, 0x98, 0x45, 0x8F, 0x96, + 0x1C, 0xF2, 0xD8, 0xFB, 0x9C, 0x10, 0x8E, 0x41, 0x7A, 0xDD, + 0xDD, 0x1D, 0xEF, 0xA5, 0x67, 0xEC, 0xFE, 0xA3, 0x2D, 0xA9, + 0xFD, 0xF3, 0xEE, 0x35, 0xF4, 0xA7, 0xBC, 0xF9, 0x71, 0xCC, + 0xB9, 0xC0, 0x5F, 0x58, 0x5B, 0xBD, 0x1A, 0x9E, 0xC7, 0x08, + 0x67, 0x7C, 0xC7, 0x51, 0x5B, 0xBE, 0xE3, 0xF8, 0xBE, 0x1E, + 0xC7, 0xD2, 0x28, 0x97 +}; +static const int sizeof_client_key_der_3072 = sizeof(client_key_der_3072); + +/* ./certs/3072/client-keyPub.der, 3072-bit */ +static const unsigned char client_keypub_der_3072[] = +{ + 0x30, 0x82, 0x01, 0xA2, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, + 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, + 0x82, 0x01, 0x8F, 0x00, 0x30, 0x82, 0x01, 0x8A, 0x02, 0x82, + 0x01, 0x81, 0x00, 0xAC, 0x39, 0x50, 0x68, 0x8F, 0x78, 0xF8, + 0x10, 0x9B, 0x68, 0x96, 0xD3, 0xE1, 0x9C, 0x56, 0x68, 0x5A, + 0x41, 0x62, 0xE3, 0xB3, 0x41, 0xB0, 0x55, 0x80, 0x17, 0xB0, + 0x88, 0x16, 0x9B, 0xE0, 0x97, 0x74, 0x5F, 0x42, 0x79, 0x73, + 0x42, 0xDF, 0x93, 0xF3, 0xAA, 0x9D, 0xEE, 0x2D, 0x6F, 0xAA, + 0xBC, 0x27, 0x90, 0x84, 0xC0, 0x5D, 0xC7, 0xEC, 0x49, 0xEA, + 0x5C, 0x66, 0x1D, 0x70, 0x9C, 0x53, 0x5C, 0xBA, 0xA1, 0xB3, + 0x58, 0xC9, 0x3E, 0x8E, 0x9B, 0x72, 0x3D, 0x6E, 0x02, 0x02, + 0x00, 0x9C, 0x65, 0x56, 0x82, 0xA3, 0x22, 0xB4, 0x08, 0x5F, + 0x2A, 0xEF, 0xDF, 0x9A, 0xD0, 0xE7, 0x31, 0x59, 0x26, 0x5B, + 0x0B, 0x1C, 0x63, 0x61, 0xFF, 0xD5, 0x69, 0x32, 0x19, 0x06, + 0x7E, 0x0F, 0x40, 0x3C, 0x7A, 0x1E, 0xC8, 0xFC, 0x58, 0x6C, + 0x64, 0xAE, 0x10, 0x3D, 0xA8, 0x23, 0xFF, 0x8E, 0x1A, 0xCA, + 0x6A, 0x82, 0xE2, 0xF9, 0x01, 0x64, 0x2C, 0x97, 0xA0, 0x1A, + 0x89, 0xA0, 0x74, 0xD3, 0xB6, 0x05, 0x11, 0xF2, 0x62, 0x06, + 0x48, 0x2A, 0xF7, 0x66, 0xCE, 0xC1, 0x85, 0xE1, 0xD2, 0x27, + 0xEA, 0xCA, 0x12, 0xA5, 0x91, 0x97, 0x3E, 0xFC, 0x94, 0x06, + 0x59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, 0xE7, + 0x6F, 0x7F, 0x91, 0xE5, 0x0E, 0xC6, 0x08, 0x49, 0xDE, 0xEA, + 0x13, 0x58, 0x72, 0xA0, 0xAA, 0x3A, 0xF9, 0x36, 0x03, 0x45, + 0x57, 0x5E, 0x87, 0xD2, 0x73, 0x65, 0xC4, 0x8C, 0xA3, 0xEE, + 0xC9, 0xD6, 0x73, 0x7C, 0x96, 0x41, 0x93, 0x02, 0x03, 0x01, + 0x00, 0x01 +}; +static const int sizeof_client_keypub_der_3072 = sizeof(client_keypub_der_3072); + +/* ./certs/3072/client-cert.der, 3072-bit */ +static const unsigned char client_cert_der_3072[] = +{ + 0x30, 0x82, 0x06, 0x1D, 0x30, 0x82, 0x04, 0x85, 0xA0, 0x03, + 0x02, 0x01, 0x02, 0x02, 0x14, 0x1E, 0xD5, 0xB7, 0x66, 0x40, + 0x3A, 0xE9, 0x9B, 0xDD, 0x58, 0xE4, 0xE4, 0x9A, 0xC0, 0xDA, + 0x1E, 0xD7, 0xB9, 0x5A, 0x1F, 0x30, 0x0D, 0x06, 0x09, 0x2A, + 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, + 0x30, 0x81, 0x9E, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, + 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, + 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, + 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, + 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, + 0x61, 0x6E, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, + 0x0A, 0x0C, 0x0C, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, + 0x5F, 0x33, 0x30, 0x37, 0x32, 0x31, 0x19, 0x30, 0x17, 0x06, + 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x10, 0x50, 0x72, 0x6F, 0x67, + 0x72, 0x61, 0x6D, 0x6D, 0x69, 0x6E, 0x67, 0x2D, 0x33, 0x30, + 0x37, 0x32, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, + 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, + 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, + 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, + 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x32, 0x34, 0x31, 0x32, 0x31, + 0x38, 0x32, 0x31, 0x32, 0x35, 0x32, 0x39, 0x5A, 0x17, 0x0D, + 0x32, 0x37, 0x30, 0x39, 0x31, 0x34, 0x32, 0x31, 0x32, 0x35, + 0x32, 0x39, 0x5A, 0x30, 0x81, 0x9E, 0x31, 0x0B, 0x30, 0x09, + 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, + 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, + 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, + 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, + 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x15, 0x30, 0x13, 0x06, + 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x0C, 0x77, 0x6F, 0x6C, 0x66, + 0x53, 0x53, 0x4C, 0x5F, 0x33, 0x30, 0x37, 0x32, 0x31, 0x19, + 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x10, 0x50, + 0x72, 0x6F, 0x67, 0x72, 0x61, 0x6D, 0x6D, 0x69, 0x6E, 0x67, + 0x2D, 0x33, 0x30, 0x37, 0x32, 0x31, 0x18, 0x30, 0x16, 0x06, + 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, + 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, + 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, + 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x82, 0x01, 0xA2, 0x30, 0x0D, + 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, + 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x8F, 0x00, 0x30, 0x82, + 0x01, 0x8A, 0x02, 0x82, 0x01, 0x81, 0x00, 0xAC, 0x39, 0x50, + 0x68, 0x8F, 0x78, 0xF8, 0x10, 0x9B, 0x68, 0x96, 0xD3, 0xE1, + 0x9C, 0x56, 0x68, 0x5A, 0x41, 0x62, 0xE3, 0xB3, 0x41, 0xB0, + 0x55, 0x80, 0x17, 0xB0, 0x88, 0x16, 0x9B, 0xE0, 0x97, 0x74, + 0x5F, 0x42, 0x79, 0x73, 0x42, 0xDF, 0x93, 0xF3, 0xAA, 0x9D, + 0xEE, 0x2D, 0x6F, 0xAA, 0xBC, 0x27, 0x90, 0x84, 0xC0, 0x5D, + 0xC7, 0xEC, 0x49, 0xEA, 0x5C, 0x66, 0x1D, 0x70, 0x9C, 0x53, + 0x5C, 0xBA, 0xA1, 0x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xA3, 0xA8, 0x30, 0x81, 0xDE, 0x06, 0x03, + 0x55, 0x1D, 0x23, 0x04, 0x81, 0xD6, 0x30, 0x81, 0xD3, 0x80, + 0x14, 0x3D, 0xD1, 0x84, 0xC2, 0xAF, 0xB0, 0x20, 0x49, 0xBC, + 0x74, 0x87, 0x41, 0x38, 0xAB, 0xBA, 0xD2, 0xD4, 0x0C, 0xA3, + 0xA8, 0xA1, 0x81, 0xA4, 0xA4, 0x81, 0xA1, 0x30, 0x81, 0x9E, + 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, + 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, + 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, + 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, + 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, + 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x0C, + 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x5F, 0x33, 0x30, + 0x37, 0x32, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, + 0x0B, 0x0C, 0x10, 0x50, 0x72, 0x6F, 0x67, 0x72, 0x61, 0x6D, + 0x6D, 0x69, 0x6E, 0x67, 0x2D, 0x33, 0x30, 0x37, 0x32, 0x31, + 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, + 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, + 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, + 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, + 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, + 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82, 0x14, + 0x1E, 0xD5, 0xB7, 0x66, 0x40, 0x3A, 0xE9, 0x9B, 0xDD, 0x58, + 0xE4, 0xE4, 0x9A, 0xC0, 0xDA, 0x1E, 0xD7, 0xB9, 0x5A, 0x1F, + 0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30, + 0x03, 0x01, 0x01, 0xFF, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x1D, + 0x11, 0x04, 0x15, 0x30, 0x13, 0x82, 0x0B, 0x65, 0x78, 0x61, + 0x6D, 0x70, 0x6C, 0x65, 0x2E, 0x63, 0x6F, 0x6D, 0x87, 0x04, + 0x7F, 0x00, 0x00, 0x01, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, + 0x25, 0x04, 0x16, 0x30, 0x14, 0x06, 0x08, 0x2B, 0x06, 0x01, + 0x05, 0x05, 0x07, 0x03, 0x01, 0x06, 0x08, 0x2B, 0x06, 0x01, + 0x05, 0x05, 0x07, 0x03, 0x02, 0x30, 0x0D, 0x06, 0x09, 0x2A, + 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, + 0x03, 0x82, 0x01, 0x81, 0x00, 0x5E, 0xB0, 0xED, 0x38, 0x36, + 0xB8, 0xF7, 0xE4, 0x0C, 0xB0, 0xC3, 0x6A, 0xBB, 0x7A, 0xB9, + 0x61, 0x05, 0x9D, 0xB9, 0x82, 0x12, 0x2D, 0x9C, 0x9E, 0x91, + 0x7B, 0xEC, 0xD0, 0x9B, 0x81, 0xCA, 0x51, 0xE8, 0xD4, 0x55, + 0x2D, 0x1A, 0xFF, 0x88, 0x5A, 0xC3, 0xE1, 0xD8, 0x82, 0x17, + 0xC5, 0x4A, 0x7A, 0xD4, 0x17, 0xC8, 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 0xE2, 0xF4, 0xB6, 0xE7, + 0x85, 0x16, 0x77, 0x3D, 0x69, 0xBB, 0x42, 0x6C, 0xA5, 0x83, + 0x45, 0x9F, 0x53, 0xC4, 0x43, 0x78, 0x17, 0x43, 0xBD, 0x27, + 0xC0, 0x6E, 0x4B, 0x40, 0x0F, 0x64, 0x0B, 0xAC, 0x38, 0x1E, + 0x09, 0x6D, 0x62, 0x5A, 0x54, 0x8A, 0x2C, 0x96, 0x99, 0x23, + 0xDB, 0xF5, 0x4B, 0x4A, 0xAA, 0x69, 0xBE, 0x6E, 0x8A, 0x9A, + 0x3E, 0xD5, 0xE6, 0xA3, 0xA9, 0xA9, 0xE9, 0xE8, 0xA9, 0x28, + 0x28, 0x3B, 0xF9, 0x9D, 0xD9, 0x5F, 0xE3, 0xCB, 0x2B, 0x2B, + 0x38, 0xBA, 0xF1, 0xBC, 0x45, 0xD8, 0x4A, 0x5A, 0xB1, 0xB3, + 0x8A, 0x48, 0x64, 0x78, 0x33, 0x21, 0x55, 0xCD, 0x04, 0x14, + 0xE7, 0x7B, 0x73, 0xC2, 0xB6, 0xF2, 0xDE, 0x81, 0x01, 0xD8, + 0x8D, 0xC6, 0xCF, 0xF2, 0x85, 0x0F, 0x32, 0x72, 0x0F, 0x6C, + 0x60, 0xBE, 0xF5, 0x31, 0x75, 0x39, 0x4B, 0xE3, 0xAE, 0xED, + 0x0C, 0x1E, 0x15, 0x83, 0xAC, 0xF9, 0x4C, 0x86, 0xCF, 0xDF, + 0x54, 0xB0, 0x7C, 0x6F, 0xF5, 0xDE, 0x26, 0x66, 0xC0, 0xBA, + 0x85, 0x38, 0xD0, 0x25, 0xFE, 0xB9, 0xBF, 0x12, 0x98 +}; +static const int sizeof_client_cert_der_3072 = sizeof(client_cert_der_3072); + +#endif /* USE_CERT_BUFFERS_3072 */ + +#ifdef USE_CERT_BUFFERS_4096 + +/* ./certs/4096/client-key.der, 4096-bit */ +static const unsigned char client_key_der_4096[] = +{ + 0x30, 0x82, 0x09, 0x42, 0x02, 0x01, 0x00, 0x30, 0x0D, 0x06, + 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, + 0x05, 0x00, 0x04, 0x82, 0x09, 0x2C, 0x30, 0x82, 0x09, 0x28, + 0x02, 0x01, 0x00, 0x02, 0x82, 0x02, 0x01, 0x00, 0xF5, 0xD0, + 0x31, 0xE4, 0x71, 0x59, 0x58, 0xB3, 0x07, 0x50, 0xDD, 0x16, + 0x79, 0xFC, 0xC6, 0x95, 0x50, 0xFC, 0x46, 0x0E, 0x57, 0x12, + 0x86, 0x71, 0x8D, 0xE3, 0x9B, 0x4A, 0x33, 0xEA, 0x4F, 0xD9, + 0x17, 0x13, 0x6D, 0x48, 0x69, 0xDF, 0x59, 0x11, 0x08, 0x02, + 0x9D, 0xAF, 0x2B, 0xC7, 0x30, 0xBE, 0x0C, 0xDC, 0x87, 0xD4, + 0x5A, 0x12, 0x09, 0x23, 0x5D, 0xE1, 0x76, 0x5A, 0x62, 0x37, + 0x46, 0x74, 0xEF, 0x03, 0x05, 0xBB, 0x1E, 0x6D, 0x29, 0x75, + 0x6C, 0x2E, 0x9D, 0x87, 0x0D, 0x8F, 0x87, 0xCB, 0x14, 0x95, + 0x9B, 0xBE, 0x17, 0x6B, 0x51, 0xD1, 0x4C, 0xDA, 0xD7, 0x91, + 0x66, 0xC5, 0x36, 0xEB, 0xE0, 0x07, 0x1A, 0x76, 0x4D, 0xB0, + 0xFB, 0xC1, 0xF5, 0x5E, 0x05, 0xDB, 0xBA, 0xCB, 0x25, 0xD9, + 0x99, 0x13, 0x1C, 0xC0, 0x35, 0xDC, 0x40, 0xE9, 0x36, 0xCD, + 0xC4, 0xD5, 0x7A, 0x41, 0x70, 0x0F, 0x36, 0xEB, 0xA5, 0x4E, + 0x17, 0x05, 0xD5, 0x75, 0x1B, 0x64, 0x62, 0x7A, 0x3F, 0x0D, + 0x28, 0x48, 0x6A, 0xE3, 0xAC, 0x9C,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 0x67, 0xE8, 0x0E, 0xD1, 0x44, 0x75, 0x80, 0x1D, + 0x0A, 0x21, 0x8F, 0x95, 0x76, 0xB0, 0xFC, 0x19, 0x3C, 0xFF, + 0x92, 0xEA, 0x01, 0x45, 0x89, 0xD1, 0x4E, 0xFE, 0x4D, 0x2B, + 0x4B, 0x18, 0xE6, 0xCE +}; +static const int sizeof_client_key_der_4096 = sizeof(client_key_der_4096); + +/* ./certs/4096/client-keyPub.der, 4096-bit */ +static const unsigned char client_keypub_der_4096[] = +{ + 0x30, 0x82, 0x02, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, + 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, + 0x82, 0x02, 0x0F, 0x00, 0x30, 0x82, 0x02, 0x0A, 0x02, 0x82, + 0x02, 0x01, 0x00, 0xF5, 0xD0, 0x31, 0xE4, 0x71, 0x59, 0x58, + 0xB3, 0x07, 0x50, 0xDD, 0x16, 0x79, 0xFC, 0xC6, 0x95, 0x50, + 0xFC, 0x46, 0x0E, 0x57, 0x12, 0x86, 0x71, 0x8D, 0xE3, 0x9B, + 0x4A, 0x33, 0xEA, 0x4F, 0xD9, 0x17, 0x13, 0x6D, 0x48, 0x69, + 0xDF, 0x59, 0x11, 0x08, 0x02, 0x9D, 0xAF, 0x2B, 0xC7, 0x30, + 0xBE, 0x0C, 0xDC, 0x87, 0xD4, 0x5A, 0x12, 0x09, 0x23, 0x5D, + 0xE1, 0x76, 0x5A, 0x62, 0x37, 0x46, 0x74, 0xEF, 0x03, 0x05, + 0xBB, 0x1E, 0x6D, 0x29, 0x75, 0x6C, 0x2E, 0x9D, 0x87, 0x0D, + 0x8F, 0x87, 0xCB, 0x14, 0x95, 0x9B, 0xBE, 0x17, 0x6B, 0x51, + 0xD1, 0x4C, 0xDA, 0xD7, 0x91, 0x66, 0xC5, 0x36, 0xEB, 0xE0, + 0x07, 0x1A, 0x76, 0x4D, 0xB0, 0xFB,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0xB5, 0x7B, 0x6E, 0xD6, 0x0C, + 0x4E, 0x89, 0x01, 0x56, 0x70, 0xBB, 0xAE, 0xDE, 0xE9, 0x99, + 0x5E, 0xD1, 0xB9, 0x3A, 0xB7, 0x6C, 0x17, 0xB6, 0x03, 0xA9, + 0x08, 0xDD, 0x9C, 0xF4, 0x14, 0xC9, 0xC9, 0x59, 0x39, 0x72, + 0xD4, 0x7E, 0x02, 0x37, 0x31, 0xCD, 0x0E, 0xA7, 0x3D, 0xF8, + 0xF2, 0xCF, 0x6B, 0x15, 0xAB, 0x02, 0x03, 0x01, 0x00, 0x01 + +}; +static const int sizeof_client_keypub_der_4096 = sizeof(client_keypub_der_4096); + +/* ./certs/4096/client-cert.der, 4096-bit */ +static const unsigned char client_cert_der_4096[] = +{ + 0x30, 0x82, 0x07, 0x1D, 0x30, 0x82, 0x05, 0x05, 0xA0, 0x03, + 0x02, 0x01, 0x02, 0x02, 0x14, 0x12, 0x66, 0xC3, 0xA2, 0x08, + 0x5C, 0xF7, 0xD0, 0x6E, 0xE9, 0xA8, 0x82, 0xA2, 0xAB, 0x9C, + 0x0F, 0x76, 0x9E, 0x96, 0xF4, 0x30, 0x0D, 0x06, 0x09, 0x2A, + 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, + 0x30, 0x81, 0x9E, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, + 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, + 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, + 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, + 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, + 0x61, 0x6E, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, + 0x0A, 0x0C, 0x0C, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, + 0x5F, 0x34, 0x30, 0x39, 0x36, 0x31, 0x19, 0x30, 0x17, 0x06, + 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x10, 0x50, 0x72, 0x6F, 0x67, + 0x72, 0x61, 0x6D, 0x6D, 0x69, 0x6E, 0x67, 0x2D, 0x34, 0x30, + 0x39, 0x36, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, + 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, + 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, + 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, + 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x32, 0x34, 0x31, 0x32, 0x31, + 0x38, 0x32, 0x31, 0x32, 0x35, 0x32, 0x39, 0x5A, 0x17, 0x0D, + 0x32, 0x37, 0x30, 0x39, 0x31, 0x34, 0x32, 0x31, 0x32, 0x35, + 0x32, 0x39, 0x5A, 0x30, 0x81, 0x9E, 0x31, 0x0B, 0x30, 0x09, + 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, + 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, + 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, + 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, + 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x15, 0x30, 0x13, 0x06, + 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x0C, 0x77, 0x6F, 0x6C, 0x66, + 0x53, 0x53, 0x4C, 0x5F, 0x34, 0x30, 0x39, 0x36, 0x31, 0x19, + 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x10, 0x50, + 0x72, 0x6F, 0x67, 0x72, 0x61, 0x6D, 0x6D, 0x69, 0x6E, 0x67, + 0x2D, 0x34, 0x30, 0x39, 0x36, 0x31, 0x18, 0x30, 0x16, 0x06, + 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, + 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, + 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, + 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x82, 0x02, 0x22, 0x30, 0x0D, + 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, + 0x01, 0x05, 0x00, 0x03, 0x82, 0x02, 0x0F, 0x00, 0x30, 0x82, + 0x02, 0x0A, 0x02, 0x82, 0x02, 0x01, 0x00, 0xF5, 0xD0, 0x31, + 0xE4, 0x71, 0x59, 0x58, 0xB3, 0x07, 0x50, 0xDD, 0x16, 0x79, + 0xFC, 0xC6, 0x95, 0x50, 0xFC, 0x46, 0x0E, 0x57, 0x12, 0x86, + 0x71, 0x8D, 0xE3, 0x9B, 0x4A, 0x33, 0xEA, 0x4F, 0xD9, 0x17, + 0x13, 0x6D, 0x48, 0x69, 0xDF, 0x59, 0x11, 0x08, 0x02, 0x9D, + 0xAF, 0x2B, 0xC7, 0x30, 0xBE, 0x0C, 0xDC, 0x87, 0xD4, 0x5A, + 0x12, 0x09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xA4, 0x81, 0xA1, 0x30, 0x81, 0x9E, 0x31, 0x0B, + 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, + 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, + 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, + 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, + 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x15, 0x30, + 0x13, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x0C, 0x77, 0x6F, + 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x5F, 0x34, 0x30, 0x39, 0x36, + 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, + 0x10, 0x50, 0x72, 0x6F, 0x67, 0x72, 0x61, 0x6D, 0x6D, 0x69, + 0x6E, 0x67, 0x2D, 0x34, 0x30, 0x39, 0x36, 0x31, 0x18, 0x30, + 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, + 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, + 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, + 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, + 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, + 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82, 0x14, 0x12, 0x66, + 0xC3, 0xA2, 0x08, 0x5C, 0xF7, 0xD0, 0x6E, 0xE9, 0xA8, 0x82, + 0xA2, 0xAB, 0x9C, 0x0F, 0x76, 0x9E, 0x96, 0xF4, 0x30, 0x0C, + 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, + 0x01, 0xFF, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x1D, 0x11, 0x04, + 0x15, 0x30, 0x13, 0x82, 0x0B, 0x65, 0x78, 0x61, 0x6D, 0x70, + 0x6C, 0x65, 0x2E, 0x63, 0x6F, 0x6D, 0x87, 0x04, 0x7F, 0x00, + 0x00, 0x01, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04, + 0x16, 0x30, 0x14, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, + 0x07, 0x03, 0x01, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, + 0x07, 0x03, 0x02, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, + 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x03, 0x82, + 0x02, 0x01, 0x00, 0xB0, 0x00, 0x28, 0x7B, 0xC8, 0x3F, 0xAE, + 0x93, 0xF5, 0x16, 0x87, 0x30, 0xD6, 0x07, 0x2B, 0x71, 0x16, + 0x34, 0x1E, 0x5C, 0x48, 0x0F, 0x4A, 0xE7, 0x50, 0x07, 0x9D, + 0xF4, 0x75, 0x5B, 0x90, 0x53, 0x72, 0x87, 0x2A, 0xBB, 0xEF, + 0x04, 0xBC, 0x52, 0xD2, 0xBF, 0xFF, 0x27, 0x58, 0x2F, 0x5C, + 0xAF, 0xBE, 0xF3, 0xF6, 0x00, 0xA2, 0x37, 0x8B, 0xEC, 0x2C, + 0xD7, 0xB7, 0xE7, 0xBB, 0x3B, 0xCA, 0x6F, 0x9D, 0x42, 0xB7, + 0x00, 0xB8, 0xC2, 0xA2, 0x8E, 0x8E, 0xE4, 0x57, 0xFD, 0x83, + 0x4B, 0xB8, 0x47, 0xAA, 0xA1, 0x28, 0xAC, 0xBD, 0xC1, 0x59, + 0x04, 0x90, 0x17, 0x40, 0x40, 0x35,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 0x95, 0xC7, 0x31, 0x97, 0x13, + 0x49, 0xED, 0xAA, 0x9E, 0x9C, 0xFD, 0x66, 0x04, 0x79, 0xD2, + 0x24, 0x4D, 0x64, 0x8D, 0x3F, 0xCD, 0x94, 0xB0, 0x05, 0x0A, + 0x30, 0x3B, 0x1C, 0x96, 0xE7, 0x79, 0x00, 0x03, 0x47, 0x55, + 0x34, 0x51, 0x1F, 0x46, 0x3A, 0x24, 0x47, 0xE6, 0xDD, 0x78, + 0x89, 0x18, 0x29, 0x32, 0xC5, 0xAD, 0xFB, 0x9C, 0xF7, 0x26, + 0xAC, 0x56, 0x3E, 0xF7, 0x73 +}; +static const int sizeof_client_cert_der_4096 = sizeof(client_cert_der_4096); + +/* ./certs/dh4096.der, 4096-bit */ +static const unsigned char dh_key_der_4096[] = +{ + 0x30, 0x82, 0x02, 0x08, 0x02, 0x82, 0x02, 0x01, 0x00, 0xE9, + 0x0E, 0x3E, 0x79, 0x4F, 0xC9, 0xB2, 0xA0, 0xB1, 0xDB, 0x2F, + 0x1E, 0x24, 0x21, 0x90, 0x5C, 0x50, 0xA4, 0x34, 0xDB, 0x99, + 0x90, 0xAC, 0xF7, 0xBF, 0x2F, 0x01, 0x4B, 0xAC, 0x87, 0x70, + 0xBA, 0xEC, 0xD1, 0x64, 0xDE, 0x04, 0xCA, 0xFC, 0xF9, 0x51, + 0x69, 0x1E, 0xB7, 0x99, 0xE2, 0xB4, 0x0D, 0xDB, 0x5D, 0x78, + 0x38, 0x38, 0x41, 0x05, 0xE8, 0x67, 0x48, 0x65, 0x54, 0x71, + 0xCC, 0xC9, 0xAA, 0x95, 0x1E, 0xD4, 0xBF, 0xBC, 0xCA, 0x5D, + 0xC2, 0x9C, 0x9E, 0x7E, 0x5E, 0x94, 0x5B, 0x2F, 0x60, 0x72, + 0xED, 0xEB, 0x54, 0x0C, 0x48, 0x2B, 0x21, 0x74, 0x4D, 0x37, + 0x04, 0x5A, 0x2F, 0x8B, 0x24, 0x4A, 0xDB,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 0xF5, 0xAF, 0x9B, 0x37, 0x7D, + 0xE5, 0xE0, 0x56, 0xE9, 0xEE, 0x00, 0x58, 0x25, 0x16, 0x23, + 0xC3, 0x8E, 0xF0, 0xB9, 0xE2, 0x98, 0x5D, 0xF2, 0x4F, 0x5C, + 0xC3, 0x27, 0x2A, 0x67, 0x7D, 0x43, 0xF6, 0x36, 0x76, 0xD4, + 0x2C, 0x7E, 0x16, 0x80, 0xCB, 0xF1, 0x07, 0xDC, 0xB9, 0xF5, + 0xF3, 0x56, 0xBD, 0xF0, 0xFC, 0x00, 0x78, 0x00, 0x56, 0xB4, + 0x3B, 0x02, 0x01, 0x02 +}; +static const int sizeof_dh_key_der_4096 = sizeof(dh_key_der_4096); + +#endif /* USE_CERT_BUFFERS_4096 */ + +#if defined(HAVE_FALCON) + +/* certs/falcon/bench_falcon_level1_key.der */ +static const unsigned char bench_falcon_level1_key[] = +{ + 0x30, 0x82, 0x08, 0x96, 0x02, 0x01, 0x00, 0x30, 0x07, 0x06, + 0x05, 0x2B, 0xCE, 0x0F, 0x03, 0x01, 0x04, 0x82, 0x08, 0x86, + 0x04, 0x82, 0x08, 0x82, 0x59, 0xFC, 0x32, 0x7D, 0x04, 0x41, + 0x01, 0xEC, 0x41, 0x7B, 0x04, 0x1F, 0x7F, 0xFC, 0x30, 0xBF, + 0x08, 0x80, 0x41, 0x10, 0x3F, 0x81, 0xFB, 0xFF, 0xC6, 0x07, + 0xCF, 0xC6, 0x0C, 0x11, 0x79, 0xFC, 0x2F, 0xC1, 0xFB, 0xFF, + 0x40, 0x1F, 0xA1, 0x3F, 0x0B, 0xF1, 0xC3, 0x0F, 0xB0, 0x43, + 0xFC, 0x61, 0x40, 0x0C, 0x1E, 0xFE, 0x08, 0x5E, 0xBE, 0x00, + 0x41, 0x3D, 0x13, 0xA0, 0xC0, 0xDB, 0xCF, 0x80, 0xF0, 0x20, + 0x80, 0x1C, 0x5F, 0x07, 0x07, 0xBF, 0xC3, 0x18, 0x5E, 0x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49, 0xA0, 0x1D, 0x76, 0x9F, 0x54, 0x49, 0x5E, + 0x42, 0x90, 0x1A, 0xE4, 0x2B, 0xF0, 0x36, 0xF6, 0xB7, 0x38, + 0x9A, 0xD3, 0xBB, 0x08, 0xFA, 0x96, 0xC9, 0xE8, 0xEF, 0x7E, + 0x79, 0xE9, 0xDE, 0xA5, 0xA6, 0x97, 0x15, 0x9E, 0xEA, 0xB4, + 0x8B, 0xC8, 0xA1, 0xB7, 0x50, 0x78, 0x04, 0x00, 0xFC, 0x13, + 0xF0, 0x96, 0xCC, 0x45, 0xC8, 0x74, 0x2B, 0xCA, 0x98, 0x7E, + 0x6C, 0x91, 0x22, 0x0B, 0x49, 0x07, 0xB6, 0xE0, 0x44, 0xD8, + 0x44, 0x4A, 0x0E, 0x65, 0x3F, 0x45, 0x90, 0x95, 0x59, 0x72, + 0xCD, 0xB3, 0xE7, 0x56, 0x65, 0x23, 0xB0, 0x9D, 0x13, 0x66, + 0x13, 0xCC, 0xB9, 0x96, 0xB9, 0xAD, 0x2B, 0x15, 0x48, 0xB3, + 0x84, 0xC2, 0x9D, 0xC3, 0xC8, 0x8C, 0x41, 0x32, 0xBE, 0x1A, + 0x98, 0xAE, 0xD8, 0x66, 0x5B, 0xA6, 0x4A, 0xA8, 0x75, 0xCC, + 0x58, 0x63, 0x34, 0xD6, 0x23, 0xDF, 0xA3, 0x72, 0x07, 0xA2, + 0x7B, 0xD5, 0x81, 0x14, 0xDB, 0x56, 0xF4, 0x07, 0x22, 0x0E, + 0x2C, 0x03, 0x9A, 0xB8, 0x48, 0x58, 0xB2, 0xE8, 0x21, 0x55, + 0x14, 0x2A, 0xA3, 0x45, 0x89, 0xCD, 0x29, 0x76, 0x3F, 0x0A, + 0x54, 0x60, 0x06, 0x94, 0x82, 0x53, 0x49, 0x5C, 0x92, 0x2E, + 0x0E, 0x7C, 0x10, 0x97, 0x35, 0x25, 0x22, 0xA7, 0x28, 0x24, + 0x30, 0x68, 0x2F, 0x46, 0x78, 0xD6, 0x55, 0xCA, 0xE3, 0x88, + 0x56, 0x94, 0x78, 0x4D, 0x66, 0x26, 0xD7, 0x9F, 0x7A, 0x36, + 0x23, 0x77, 0x35, 0xB0, 0x00, 0x25, 0xB0, 0x41, 0x67, 0x82, + 0xCC, 0x61, 0x3D, 0x26, 0x46, 0xC7, 0xB6, 0x95, 0xA5, 0x1F, + 0x49, 0x13, 0xB9, 0x7A, 0x91, 0x82, 0x99, 0x06, 0xAE, 0x01, + 0x45, 0xAE, 0x53, 0x1B, 0xE6, 0x51, 0x34, 0x96, 0x81, 0x62, + 0x06, 0xA9, 0x0E, 0x46, 0xB8, 0x18, 0x1E, 0xAF, 0x24, 0x54, + 0x89, 0x80, 0xE3, 0xD2, 0x11, 0x8D, 0xB7, 0x80, 0x31, 0x21, + 0xEF, 0x81, 0x9D, 0x22, 0x08, 0xE5, 0x0E, 0x3E, 0x9A, 0x8C, + 0xA4, 0xBA, 0xAB, 0x1A, 0xC9, 0x75, 0xD1, 0x6B, 0x16, 0x37, + 0x5B, 0x36, 0x12, 0x34, 0x06, 0xA6, 0xD7, 0x4B, 0x82, 0x35, + 0xC9, 0x64, 0xC3, 0x66, 0x4E, 0x66, 0x0F, 0x62, 0xA5, 0x2B, + 0x71, 0x8A, 0x23, 0x0A, 0xD1, 0x06, 0x94, 0xE1, 0x44, 0x8E, + 0x59, 0x41, 0x41, 0x09, 0xC9, 0x4D, 0xB7, 0x1D, 0xEE, 0x2E, + 0xB7, 0x35, 0x01, 0x89, 0x6B, 0xF4, 0xE2, 0xB1, 0xE7, 0x94, + 0xD3, 0x30, 0x34, 0xB8, 0x36, 0xA4, 0x59, 0xBE, 0x0E, 0xC9, + 0x49, 0x34, 0x70, 0x55, 0xDB, 0x87, 0x46, 0x2F, 0x68, 0xED, + 0x59, 0xB3, 0x7F, 0x2E, 0x0B, 0x8B, 0x90, 0x1F, 0x51, 0x3D, + 0x3E, 0xC2, 0xB5, 0x13, 0xCE, 0xAE, 0x6C, 0x56, 0x0D, 0x4A, + 0xAB, 0x99, 0x8B, 0x89, 0xEC, 0xBE, 0xCA, 0x02, 0x47, 0x6C, + 0xA8, 0x31, 0xEC, 0x98, 0xAA, 0xC1, 0xE1, 0x36, 0x22, 0x2E, + 0x81, 0xB0, 0xA2, 0xD2, 0x27, 0x49, 0xCF, 0x60, 0x9E, 0x8C, + 0xC3, 0xA0, 0x6E, 0x98, 0x8A, 0xF7, 0x2C, 0x36, 0x3B, 0x7E, + 0x25, 0x90, 0xD6, 0xC2, 0x70, 0x0C, 0xF5, 0xEC, 0x07, 0xA5, + 0xAE, 0x55, 0x64, 0x04, 0x03, 0xC3, 0x80, 0x55, 0x3C, 0x37, + 0x3E, 0xD1, 0x83, 0x7C, 0x2F, 0x11, 0x4C, 0xDE, 0xB8, 0x44, + 0xCA, 0x0F, 0xBF, 0x7B, 0x82, 0x2B, 0xB5, 0xD3, 0x10, 0x66, + 0x86, 0x8E, 0x39, 0xF6, 0x33, 0x9D, 0x0D, 0x70, 0xB0, 0x02, + 0x50, 0xC5, 0x0F, 0x27, 0x35, 0x2C, 0xEF, 0x53, 0x4E, 0x13, + 0x58, 0xB8, 0xA8, 0xC0, 0x4A, 0x95, 0x61, 0xFB, 0x48, 0x05, + 0xCB, 0xC9, 0x40, 0xD2, 0x3A, 0xBE, 0xA9, 0xB7, 0x78, 0x76, + 0x9F, 0x1E +}; +static const int sizeof_bench_falcon_level1_key = sizeof(bench_falcon_level1_key); + +/* certs/falcon/bench_falcon_level5_key.der */ +static const unsigned char bench_falcon_level5_key[] = +{ + 0x30, 0x82, 0x10, 0x16, 0x02, 0x01, 0x00, 0x30, 0x07, 0x06, + 0x05, 0x2B, 0xCE, 0x0F, 0x03, 0x04, 0x04, 0x82, 0x10, 0x06, + 0x04, 0x82, 0x10, 0x02, 0x5A, 0xDF, 0x13, 0xB0, 0x70, 0x81, + 0x21, 0x02, 0x3D, 0x7F, 0xFF, 0xD0, 0x47, 0xFE, 0x0F, 0xC2, + 0xE6, 0xC5, 0xFF, 0x9F, 0xDB, 0xF0, 0x0D, 0xE0, 0xFC, 0x43, + 0x07, 0xFE, 0x01, 0x80, 0x20, 0x00, 0xC3, 0xD0, 0x74, 0x3F, + 0x07, 0x41, 0xFF, 0xF7, 0x81, 0xEF, 0xFF, 0xF1, 0x10, 0x04, + 0x10, 0x4C, 0x32, 0x7C, 0x42, 0x30, 0x08, 0x42, 0x70, 0x45, + 0xFF, 0x3F, 0xCF, 0x07, 0x60, 0x00, 0x82, 0x00, 0x84, 0x01, + 0x20, 0x04, 0x00, 0x7B, 0xC0, 0x18, 0x42, 0x11, 0x00, 0x22, + 0x17, 0x46, 0x00, 0x70, 0x43, 0xDF, 0x82, 0x10, 0x0B, 0xDA, + 0x17, 0x01, 0xE0, 0x0B, 0xFF, 0xF7, 0xBD, 0xE0, 0x7C, 0x1E, + 0xF7, 0x7E, 0x40, 0x78, 0x1E, 0x17, 0xC5, 0xD0, 0x18, 0x3D, + 0x19, 0x3E, 0x31, 0x68, 0x3F, 0xF8, 0x87, 0xCF, 0xF8, 0x9F, + 0x37, 0x7F, 0xE0, 0x7B, 0xC0, 0xF1, 0x40, 0x1F, 0x04, 0x5F, + 0x08, 0x42, 0x2E, 0x03, 0xA5, 0xD8, 0x06, 0x52, 0xF0, 0x24, + 0x00, 0x01, 0xEF, 0xE8, 0x42, 0xE9, 0xBD, 0xF2, 0x9B, 0xBA, + 0x16, 0xFD, 0xCF, 0x83, 0x81, 0x08, 0x3F, 0xFE, 0x88, 0x40, + 0x01, 0xB0, 0x12, 0x8B, 0xA1, 0x10, 0xBD, 0xF1, 0x7C, 0x1F, + 0x18, 0x47, 0xC0, 0x13, 0xC1, 0xF7, 0x84, 0x00, 0x03, 0x5F, + 0xF8, 0x46, 0x21, 0xF8, 0x1D, 0x17, 0x80, 0x0F, 0x8B, 0xC0, + 0x0E, 0xC3, 0xEE, 0x87, 0xBE, 0xF0, 0xF4, 0x01, 0xEC, 0x1D, + 0xF7, 0xC6, 0x11,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 0xEC, 0xD8, 0x04, 0x00, 0xA8, 0x86, 0x61, 0x00, 0x1F, 0x6E, + 0x5C, 0x9E, 0xDA, 0x61, 0x68, 0x87, 0x5F, 0xB1, 0x22, 0x49, + 0x7B, 0x17, 0x67, 0x7E, 0x51, 0x4A, 0xE1, 0x05, 0x1B, 0x31, + 0x39, 0xDD, 0x75, 0x42, 0x4C, 0xE1, 0x10, 0xBB, 0xB8, 0x08, + 0xA8, 0x0C, 0x90, 0xC3, 0x59, 0x90, 0xE2, 0x99, 0x83, 0x65, + 0xBC, 0x5D, 0xC4, 0x90, 0x87, 0x8B, 0xE4, 0xF3, 0x32, 0x39, + 0x9D, 0x46, 0xFF, 0x24, 0x60, 0x1F, 0x32, 0x49, 0xA9, 0x57, + 0x97, 0xF7, 0x8C, 0x59, 0x3E, 0x70, 0x09, 0x93, 0x4A, 0x0C, + 0xFC, 0x32, 0x51, 0x86, 0x41, 0x65, 0x04, 0x4D, 0xF7, 0x02, + 0xB2, 0x6A, 0xB1, 0xAA, 0x18, 0x6B, 0xA2, 0x05, 0xE9, 0xD7, + 0x59, 0xC2, 0x93, 0x51, 0x57, 0xC8, 0x42, 0x9A, 0x74, 0xBA, + 0x98, 0x51, 0x9E, 0xB9, 0xA7, 0x41, 0x81, 0x71, 0x54, 0x45, + 0x51, 0xBE, 0xC5, 0x72, 0x02, 0xEB, 0xA8, 0x97, 0x5B, 0x4E, + 0x25, 0xD0, 0x40, 0xD1, 0x45, 0x7D, 0x30, 0xBF, 0x44, 0xBE, + 0x1C, 0xE1, 0x4C, 0x9C, 0xDA, 0xA3, 0x54, 0xEC, 0xFF, 0x46, + 0x26, 0xE9, 0x97, 0x63, 0x82, 0x4F, 0xA6, 0x9A, 0xA0, 0xF3, + 0x89, 0x83, 0x8E, 0x49, 0xAE, 0x21, 0xF4, 0x5C, 0x6E, 0x0D, + 0x89, 0x08, 0xCA, 0x34, 0xCC, 0xC2, 0xC3, 0x47, 0x8C, 0xDC, + 0xC5, 0x9D,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0xE5, 0xAA, 0xA8, 0xD7, 0x02, 0x17, 0x27, 0x94, 0xF8, 0xF1, + 0x54, 0x0A, 0xA2, 0x47, 0x3C, 0xE7, 0xA6, 0xA5, 0x00, 0x31, + 0x81, 0xA1, 0xE3, 0x86, 0xEF, 0x56, 0xE3, 0x36, 0x2C, 0x1F, + 0x86, 0xED, 0xD3, 0x6D, 0x05, 0xBA, 0x36, 0xF1, 0xF0, 0x2E, + 0x84, 0x9A, 0xFA, 0xA7, 0x09, 0x59, 0x14, 0x2B, 0x0A, 0xFC, + 0xC0, 0x16, 0x3E, 0xAA, 0x13, 0xAF, 0x25, 0x02, 0x4A, 0x97, + 0xD0, 0xAD, 0x7E, 0x2D, 0xC2, 0x4A, 0xFD, 0x1F, 0x2B, 0x4D, + 0x46, 0x60, 0x42, 0xB1, 0xAE, 0x12, 0x32, 0x5E, 0x23, 0x19, + 0x47, 0x4B, 0x23, 0x7C, 0x1A, 0xA2, 0xC6, 0x4F, 0x03, 0xBE, + 0x47, 0x95, 0x97, 0x86, 0xFF, 0x0E, 0xCC, 0x40, 0xB0, 0xCA, + 0x45, 0xE5, 0x14, 0x93, 0xA1, 0xD0, 0xC1, 0x37, 0xEE, 0x1E, + 0x13, 0x69, 0xB9, 0x8D, 0xE1, 0x86, 0xCC, 0xDD, 0x0D, 0xC2, + 0xED, 0xD3, 0x59, 0x13, 0x9D, 0xB5, 0xD0, 0x50, 0x68, 0x1A, + 0xA5, 0xA6 +}; +static const int sizeof_bench_falcon_level5_key = sizeof(bench_falcon_level5_key); + +#endif /* HAVE_FALCON */ + +#if defined(HAVE_DILITHIUM) +#ifndef WOLFSSL_DILITHIUM_NO_SIGN + +/* raw private key without ASN1 syntax from + * ./certs/dilithium/bench_dilithium_level2_key.der */ +static const unsigned char bench_dilithium_level2_key[] = { + 0xea, 0x05, 0x24, 0x0d, 0x80, 0x72, 0x25, 0x55, 0xf4, 0x5b, + 0xc2, 0x13, 0x8b, 0x87, 0x5d, 0x31, 0x99, 0x2f, 0x1d, 0xa9, + 0x41, 0x09, 0x05, 0x76, 0xa7, 0xb7, 0x5e, 0x8c, 0x44, 0xe2, + 0x64, 0x79, 0xd8, 0x79, 0x4c, 0xee, 0x92, 0x2b, 0x37, 0xab, + 0xb1, 0x16, 0x65, 0x72, 0xc3, 0x49, 0xc2, 0xec, 0xfd, 0x9a, + 0xe6, 0x2d, 0x1e, 0x5b, 0xe3, 0x04, 0x96, 0x16, 0xad, 0x97, + 0x5d, 0xac, 0xf2, 0xcc, 0x62, 0x2e, 0x34, 0x5d, 0x67, 0x19, + 0x47, 0xee, 0x0f, 0x8b, 0x97, 0x60, 0xb4, 0x0b, 0xeb, 0x6a, + 0x7a, 0x75, 0x14, 0x27, 0x00, 0x39, 0xd6, 0x60, 0xce, 0x39, + 0x6e, 0x69, 0x46, 0xe1, 0x0d, 0xf9, 0xa6, 0xfa, 0x8c, 0xcf, + 0x65, 0x50, 0x59, 0x1d, 0xb0, 0x26, 0xc2, 0xe2, 0xf1, 0xb9, + 0xcd, 0x09, 0x60, 0xcc, 0xbb, 0x57, 0xd6, 0xac, 0xcc, 0xf9, + 0x58, 0x73, 0xa8, 0x81, 0x61, 0x2f, 0xd2, 0xa4, 0x5b, 0x98, + 0x0d, 0x12, 0x88, 0x51, 0x63, 0x38, 0x6e, 0xa2, 0x46, 0x64, + 0x52, 0xc0, 0x71, 0xc1, 0x42, 0x68, 0xd8, 0x42, 0x32, 0x5c, + 0xb4, 0x44, 0x08, 0x95, 0x48, 0xa2, 0x46, 0x6c, 0x0b, 0x10, + 0x09, 0xc8, 0x24, 0x4d, 0x18, 0x37, 0x4c, 0x4c, 0x82, 0x05, + 0x02, 0x22, 0x10, 0x4a, 0x86, 0x30, 0x03, 0x03, 0x11, 0x44, + 0x22, 0x62, 0x01, 0xa9, 0x51, 0x13, 0x02, 0x2c, 0x19, 0x85, + 0x65, 0x51, 0x14, 0x01, 0x9c, 0xb2, 0x81, 0x0a, 0x49, 0x52, + 0xa2, 0xb2, 0x4c, 0x98, 0x34, 0x01, 0x0a, 0x07, 0x06, 0x58, + 0xb2, 0x69, 0x51, 0x24, 0x2d, 0x59, 0x12, 0x52, 0xe0, 0xb4, + 0x04, 0x14, 0x40, 0x29, 0xa2, 0xb0, 0x31, 0x54, 0xc0, 0x40, + 0x63, 0x00, 0x69, 0x18, 0x47, 0x85, 0xc8, 0x30, 0x81, 0x0b, + 0x15, 0x0a, 0xd8, 0xa0, 0x0c, 0x5c, 0x20, 0x4a, 0x11, 0x38, + 0x64, 0x04, 0x94, 0x84, 0xd3, 0x24, 0x72, 0x58, 0x38, 0x28, + 0x18, 0x37, 0x6d, 0x94, 0xc0, 0x4d, 0xa0, 0xa6, 0x0c, 0x9a, + 0x82, 0x31, 0xc2, 0x40, 0x48, 0xda, 0x46, 0x85, 0x03, 0x00, + 0x05, 0xd8, 0x02, 0x4d, 0x0b, 0x85, 0x40, 0xe2, 0x32, 0x86, + 0x4c, 0xa0, 0x65, 0x8a, 0x36, 0x65, 0x42, 0x18, 0x6e, 0x60, + 0x36, 0x0d, 0x40, 0xc0, 0x01, 0x5a, 0x44, 0x42, 0xc4, 0xa4, + 0x0d, 0xd4, 0x88, 0x8d, 0x88, 0x22, 0x52, 0x00, 0xc0, 0x0c, + 0x5b, 0x36, 0x90, 0x09, 0x20, 0x22, 0x08, 0x03, 0x12, 0x90, + 0x12, 0x42, 0x04, 0x20, 0x29, 0x8c, 0x48, 0x6d, 0x20, 0x32, + 0x08, 0x94, 0x88, 0x6c, 0x10, 0x87, 0x21, 0xc1, 0x44, 0x02, + 0x52, 0x40, 0x12, 0xdb, 0xc8, 0x24, 0x14, 0x09, 0x2c, 0x93, + 0x40, 0x09, 0x64, 0xc8, 0x4c, 0x08, 0x48, 0x70, 0xa1, 0x10, + 0x81, 0x4a, 0x80, 0x8c, 0x20, 0x03, 0x31, 0x18, 0xb3, 0x80, + 0xd3, 0x82, 0x25, 0x4c, 0x94, 0x8c, 0x1c, 0x93, 0x89, 0x1a, + 0x91, 0x51, 0xd1, 0xb6, 0x68, 0x43, 0x14, 0x25, 0x84, 0x48, + 0x61, 0x82, 0x40, 0x24, 0xdb, 0x22, 0x4d, 0x63, 0x16, 0x66, + 0x62, 0x90, 0x50, 0xa1, 0x18, 0x86, 0x49, 0x28, 0x25, 0xa0, + 0x10, 0x68, 0x8c, 0x04, 0x00, 0x08, 0x32, 0x4e, 0x22, 0x43, + 0x31, 0x42, 0x96, 0x28, 0x11, 0x23, 0x89, 0xd2, 0xc4, 0x6d, + 0x11, 0x82, 0x8d, 0x8a, 0xa8, 0x90, 0xd2, 0x06, 0x29, 0x80, + 0x82, 0x89, 0x00, 0xa8, 0x41, 0x00, 0x13, 0x6a, 0x12, 0xa8, + 0x04, 0x83, 0xc2, 0x51, 0x13, 0x09, 0x08, 0x62, 0xb4, 0x8d, + 0x94, 0xc2, 0x44, 0x5a, 0xb4, 0x08, 0x0a, 0x10, 0x48, 0xa1, + 0x28, 0x20, 0x1b, 0xb7, 0x64, 0x60, 0x24, 0x25, 0x48, 0xc0, + 0x00, 0x0a, 0x10, 0x09, 0x64, 0xb8, 0x88, 0xcb, 0x44, 0x64, + 0x54, 0x90, 0x05, 0xd2, 0xb8, 0x21, 0x49, 0x28, 0x28, 0x49, + 0x42, 0x0d, 0x63, 0xa0, 0x65, 0xcb, 0x90, 0x30, 0x51, 0x82, + 0x8d, 0x5c, 0xc6, 0x0c, 0x51, 0x06, 0x6a, 0x1a, 0x27, 0x22, + 0x01, 0xa8, 0x24, 0x61, 0xb2, 0x84, 0x23, 0x40, 0x86, 0xa3, + 0xb4, 0x48, 0x19, 0x28, 0x0c, 0x14, 0x06, 0x2e, 0xe2, 0x02, + 0x0d, 0xc4, 0x90, 0x09, 0x08, 0x06, 0x66, 0x9b, 0xc8, 0x10, + 0x5c, 0x46, 0x21, 0xca, 0xa8, 0x30, 0x83, 0x20, 0x89, 0x03, + 0x83, 0x6c, 0xa1, 0x46, 0x8c, 0x90, 0x14, 0x4c, 0x99, 0x02, + 0x81, 0x53, 0x02, 0x10, 0x8b, 0x48, 0x91, 0xe4, 0x40, 0x4a, + 0x22, 0xb1, 0x88, 0xc1, 0x06, 0x0e, 0xc3, 0xa8, 0x08, 0xc8, + 0x46, 0x92, 0x03, 0xb5, 0x4c, 0x23, 0x03, 0x0c, 0xa4, 0x06, + 0x2e, 0xdc, 0x92, 0x81, 0x0c, 0x45, 0x22, 0x40, 0x34, 0x91, + 0x90, 0x96, 0x48, 0x81, 0x82, 0x31, 0xcb, 0x16, 0x72, 0x49, + 0xc8, 0x29, 0x44, 0x86, 0x90, 0x60, 0x22, 0x4e, 0x42, 0x42, + 0x09, 0x4b, 0x82, 0x20, 0x0a, 0xb2, 0x64, 0x20, 0x86, 0x70, + 0x1a, 0xc0, 0x00, 0x1c, 0x41, 0x49, 0x89, 0x84, 0x05, 0x0c, + 0x36, 0x49, 0x19, 0x99, 0x6d, 0x00, 0x08, 0x50, 0x23, 0x96, + 0x6c, 0xe0, 0x44, 0x08, 0x98, 0x24, 0x2c, 0x0a, 0x23, 0x20, + 0x12, 0x04, 0x31, 0xc9, 0x06, 0x32, 0x14, 0x01, 0x41, 0x08, + 0x37, 0x08, 0x58, 0x00, 0x0c, 0x19, 0x04, 0x29, 0x90, 0x18, + 0x05, 0xe1, 0x88, 0x44, 0xc2, 0x20, 0x6c, 0xd1, 0x46, 0x64, + 0xd9, 0x26, 0x62, 0x09, 0x88, 0x68, 0x02, 0x29, 0x29, 0xe1, + 0x18, 0x65, 0x98, 0x04, 0x24, 0xe4, 0x34, 0x0c, 0x12, 0x85, + 0x2d, 0x20, 0x14, 0x06, 0x24, 0x15, 0x82, 0x89, 0x08, 0x91, + 0x60, 0x84, 0x28, 0x24, 0x34, 0x41, 0x1b, 0x49, 0x22, 0xd3, + 0x96, 0x64, 0x1b, 0x86, 0x4c, 0x0c, 0xb9, 0x20, 0x20, 0x39, + 0x04, 0x04, 0x34, 0x6d, 0xc1, 0x28, 0x32, 0x08, 0x14, 0x44, + 0x81, 0x18, 0x2e, 0xda, 0x38, 0x41, 0x63, 0x18, 0x26, 0xd8, + 0x48, 0x26, 0x12, 0x20, 0x21, 0x09, 0xc5, 0x25, 0x92, 0x42, + 0x0c, 0x88, 0x04, 0x64, 0x11, 0x43, 0x8a, 0x19, 0x92, 0x60, + 0x5c, 0xc6, 0x31, 0xa1, 0x24, 0x6a, 0xd8, 0xb6, 0x49, 0x1b, + 0x81, 0x90, 0xe2, 0x32, 0x4e, 0x62, 0x44, 0x21, 0x80, 0xb8, + 0x10, 0x4b, 0x90, 0x49, 0x5c, 0x06, 0x09, 0x48, 0x20, 0x49, + 0xa2, 0x92, 0x71, 0x5c, 0x48, 0x02, 0xc8, 0x08, 0x81, 0xa4, + 0x32, 0x66, 0xc9, 0x30, 0x11, 0xca, 0x92, 0x91, 0xc0, 0x00, + 0x41, 0x44, 0x98, 0x4d, 0x98, 0x12, 0x4e, 0x92, 0x46, 0x8e, + 0x49, 0xb8, 0x64, 0xdc, 0x18, 0x50, 0x51, 0xb4, 0x48, 0x08, + 0x47, 0x24, 0x08, 0x46, 0x32, 0x1b, 0x23, 0x00, 0x09, 0xb8, + 0x04, 0x0a, 0x44, 0x0c, 0x0b, 0xc7, 0x8d, 0x19, 0xa4, 0x09, + 0x11, 0x30, 0x41, 0xe3, 0x24, 0x45, 0x89, 0x1f, 0x65, 0x54, + 0xf6, 0x38, 0x04, 0x37, 0xcc, 0x89, 0xc3, 0xc5, 0xdc, 0x43, + 0xd9, 0x13, 0x56, 0x06, 0x05, 0x50, 0x29, 0x4e, 0x0f, 0xa5, + 0x5c, 0x5d, 0xd7, 0x82, 0xa1, 0x63, 0x59, 0x0d, 0x3e, 0x5b, + 0x00, 0xe6, 0x0e, 0xd8, 0x1c, 0xc7, 0xaf, 0xc0, 0x48, 0xb6, + 0x07, 0x5c, 0x65, 0x00, 0x89, 0xb3, 0x09, 0xbc, 0x4a, 0xaa, + 0xa6, 0x72, 0xbe, 0x6b, 0x9a, 0xb3, 0x5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94, 0xdf, + 0xcf, 0xd7, 0xac, 0xdf, 0x47, 0x0b, 0x38, 0xe0, 0xa5, 0xf8, + 0xc3, 0xd2, 0xc3, 0xfb, 0x0f, 0x98, 0x00, 0x2b, 0x17, 0x3c, + 0x44, 0x70, 0x36, 0x47, 0x27, 0x89, 0x41, 0xcb, 0x87, 0x5a, + 0xa4, 0x2c, 0x57, 0x6d, 0x8c, 0xcb, 0xc0, 0x7d, 0x6b, 0xf5, + 0xa1, 0x17, 0x39, 0x4a, 0xb5, 0xac, 0xc6, 0x41, 0x90, 0x66, + 0x85, 0xc4, 0x4b, 0x18, 0xc6, 0xe6, 0x09, 0x6d, 0x6e, 0xbb, + 0x7f, 0x72, 0x96, 0xd3, 0x21, 0x5a, 0x96, 0xaf, 0x9e, 0xb6, + 0x0b, 0x3f, 0xe8, 0x83, 0xe5, 0x53, 0x11, 0x81, 0xc6, 0xab, + 0x40, 0xa9, 0x09, 0xb6, 0x74, 0x5e, 0xe1, 0xc3, 0x82, 0x1e, + 0xda, 0x2f, 0x24, 0xe0, 0x94, 0x8f, 0x07, 0xb7, 0x9b, 0xc6, + 0x50, 0xef, 0x3a, 0x79, 0x89, 0x4d, 0x6f, 0x16, 0x33, 0x04, + 0x24, 0x7e, 0x4a, 0xab, 0x5d, 0x03, 0x29, 0xad, 0xba, 0xa3, + 0x6c, 0xe2, 0x05, 0xab, 0x4d, 0x69, 0xb6, 0x61, 0x39, 0x9d, + 0xc3, 0x53, 0x11, 0xc0, 0xe3, 0xaa, 0x2e, 0xdc, 0x74, 0x09, + 0xbd, 0x19, 0xb5, 0xbb, 0x51, 0x1e, 0x77, 0x3e, 0xce, 0x64, + 0x13, 0xeb, 0x74, 0x03, 0xb7, 0x49, 0x99, 0xb0, 0x71, 0x99, + 0xe6, 0x17, 0x3c, 0x80, 0xe6, 0xb5, 0x51, 0xe9, 0xb3, 0xe4, + 0x2b, 0xaa, 0x52, 0x15, 0x99, 0x4e, 0x46, 0x6d, 0x67, 0x8e, +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 0x31, 0x00, 0x97, 0x73, 0x9b, 0x3c, 0x26, 0xf8, 0x42, + 0xd0, 0xd4, 0x41, 0x1b, 0x9f, 0x7e, 0x43, 0x4b, 0x0b, 0x08, + 0xd7, 0xa0, 0xa8, 0x32, 0x34, 0x0a, 0xc9, 0xef, 0xb8, 0xeb, + 0xe7, 0x64, 0x3b, 0x40, 0x88, 0xe0, 0x60, 0x59, 0x07, 0xef, + 0xb9, 0x5f, 0x71, 0x92, 0x90, 0xa4, 0x5f, 0x34, 0x38, 0x93, + 0x92, 0x43, 0x87, 0xaf, 0xdd, 0x87, 0x63, 0x8c, 0x1d, 0xe5, + 0x86, 0x9e, 0xe6, 0xde, 0x94, 0xdd, 0x33, 0x5d, 0x95, 0x64, + 0xd8, 0xc4, 0x8a, 0x3c, 0xe7, 0x4b, 0xd6, 0x3f, 0xc5, 0x69, + 0x6a, 0xa8, 0x7f, 0x0f, 0x93, 0x77, 0x02, 0x46, 0x66, 0xa5, + 0xa0, 0x60, 0x8b, 0xec, 0xb1, 0xa2, 0xfc, 0x2a, 0x09, 0xb8, + 0x08, 0x1c, 0x05, 0x6b, 0x78, 0xb7, 0x7a, 0xe5, 0x60, 0xa4, + 0xaf, 0x3a, 0x9d, 0xaa, 0xf5, 0x22, 0x9b, 0x5e, 0xef, 0xc3, + 0x46, 0xed, 0x67, 0xd0, 0x8b, 0xda, 0xb4, 0xa3, 0x34, 0x32, + 0x20, 0x9d, 0x88, 0x7e, 0x43, 0x42, 0x6f, 0x02, 0xf8, 0x48, + 0x9b, 0xc5, 0x02, 0xad, 0xaa, 0xa9, 0xee, 0x19, 0x1b, 0xde, + 0x02, 0x83, 0x81, 0x10, 0xa6, 0x79, 0x4e, 0xad, 0x15, 0xf7, + 0x3e, 0x4e, 0x1e, 0x72, 0xfe, 0x52, 0x49, 0x24, 0xce, 0x82, + 0x31, 0x59, 0x72, 0xae, 0xd5, 0x34, 0x50, 0x87, 0x8b, 0xe3, + 0x8e, 0xec, 0x61, 0x35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 0xda, 0x12, 0x5f, 0xf7, 0x9e, + 0x47, 0x1a, 0xf7, 0x73, 0x40, 0x67, 0xc2, 0x61, 0x07, 0x33, + 0x16, 0x78, 0x60, 0x05, 0x85, 0x5c, 0x2f, 0x2b, 0xbf, 0x2c, + 0x7a, 0x39, 0xc6, 0xed, 0xcb, 0x43, 0x66, 0x27, 0x93, 0xcd, + 0x92, 0x8d, 0x62, 0x8c, 0xaa, 0x61, 0x1c, 0x9c, 0x4c, 0x90, + 0xba, 0xba, 0x4b, 0xc1, 0xf1, 0x22, 0xde, 0xe0, 0xf9, 0x3e, + 0x04, 0xb9, 0x56, 0xa3, 0x1c, 0xe8, 0xda, 0xd6, 0x09, 0x4a, + 0x7d, 0x89, 0xbc, 0xf4, 0xe8, 0x4d, 0xa1, 0xe8, 0x34, 0x90, + 0xa5, 0x31, 0x3a, 0xec, 0x56, 0xc5, 0xd2, 0x92, 0x0b, 0xe9, + 0x58, 0xbb, 0xb2, 0x84, 0x9b, 0xa9, 0x1d, 0x19, 0xdb, 0x7a, + 0x02, 0x75, 0x79, 0x16, 0x35, 0xee, 0x3a, 0x3f, 0x4e, 0x5e, + 0x11, 0x90, 0x04, 0x03, 0xce, 0x8b, 0xa0, 0xd8, 0xc1, 0xee, + 0x52, 0x33, 0x6e, 0xd2, 0x6e, 0x06, 0x5c, 0x99, 0x24, 0x6f, + 0x16, 0xd9, 0x90, 0x28, 0xe5, 0x2d, 0x91, 0x6f, 0x1a, 0x57, + 0xf0, 0x4c, 0x7c, 0x3f, 0x7b, 0xd7, 0x30, 0xed, 0x6d, 0x21, + 0xb7, 0xf8, 0xed, 0xf3, 0x34, 0x89, 0xfa, 0xf0, 0x51, 0x6f, + 0x99, 0xa0, 0x5e, 0xf8, 0x74, 0xc7, 0x4f, 0xb5, 0x59, 0x52, + 0xbe, 0x45, 0xac, 0x3f, 0x34, 0x51, 0x87, 0x6e, 0x84, 0xea, + 0xb0, 0x40, 0xe1, 0x84, 0x16, 0x66, 0x30, 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x11, 0x83, + 0x64, 0xc0, 0x39, 0xe5, 0xb0, 0x8f, 0x32, 0xf4, 0x01, 0x6a, + 0x2a, 0x11, 0x8e, 0xdd, 0x03, 0x81, 0x39, 0xe7, 0x70, 0x16, + 0x2f, 0x0e, 0x24, 0xa9, 0x12, 0x0b, 0xdb, 0xa8, 0x6c, 0xb3, + 0xf3, 0x74, 0x95, 0xca, 0x64, 0x1d, 0xee, 0x25, 0xc5, 0x27, + 0xed, 0x0f, 0x82, 0xb5, 0x7a, 0x62, 0x27, 0xb2, 0x87, 0x53, + 0x11, 0x39, 0x5e, 0xb8, 0x11, 0xca, 0x25, 0xe8, 0x17, 0x46, + 0xd3, 0x0f, 0x5d, 0x70, 0x68, 0xe1, 0x5f, 0xd1, 0xab, 0x65, + 0xe5, 0x42, 0x87, 0x1e, 0x96, 0xaf, 0x13, 0x0c, 0x9b, 0x15, + 0x75, 0x14, 0x31, 0x75, 0xcc, 0x15, 0xbf, 0x2c, 0x74, 0xab, + 0xc9, 0x9c, 0xda, 0x62, 0x1d, 0xeb, 0x19, 0x81, 0x67, 0x5e, + 0xcd, 0x54, 0x87, 0x07, 0x67, 0xba, 0xe3, 0xf6, 0x03, 0xbe, + 0x6d, 0x64, 0x2d, 0xbc, 0xec, 0x54, 0x13, 0x12, 0x5b, 0x44, + 0x90, 0x95, 0x86, 0x77, 0x8c, 0x59, 0xbd, 0x8e, 0xba, 0xb1, + 0x12, 0xea, 0xc1, 0x94, 0x37, 0xa0, 0x11, 0xff, 0xb2, 0xa4, + 0xc3, 0x61, 0xf2, 0xa3, 0x49, 0xbe, 0xe7, 0xb6, 0x96, 0x2f, +}; +static const int sizeof_bench_dilithium_level2_key = sizeof(bench_dilithium_level2_key); + +#endif /* !WOLFSSL_DILITHIUM_NO_SIGN */ + +#ifndef WOLFSSL_DILITHIUM_NO_VERIFY + +/* raw public key without ASN1 syntax from + * ./certs/dilithium/bench_dilithium_level2_key.der */ +static const unsigned char bench_dilithium_level2_pubkey[] = { + 0xea, 0x05, 0x24, 0x0d, 0x80, 0x72, 0x25, 0x55, 0xf4, 0x5b, + 0xc2, 0x13, 0x8b, 0x87, 0x5d, 0x31, 0x99, 0x2f, 0x1d, 0xa9, + 0x41, 0x09, 0x05, 0x76, 0xa7, 0xb7, 0x5e, 0x8c, 0x44, 0xe2, + 0x64, 0x79, 0xa0, 0xec, 0x1f, 0x24, 0xb6, 0xc8, 0x05, 0x5b, + 0xc1, 0x18, 0xb0, 0xb7, 0xcf, 0x8c, 0x60, 0x67, 0x6b, 0x81, + 0x44, 0x27, 0xb6, 0x0e, 0xfd, 0x9b, 0xc3, 0xcb, 0x52, 0x31, + 0xfa, 0xc9, 0x34, 0x8d, 0x22, 0x1e, 0x07, 0x9d, 0x96, 0x6a, + 0x63, 0x83, 0x5c, 0xd7, 0x83, 0x2d, 0x7f, 0x48, 0x64, 0x79, + 0xca, 0xb4, 0x9f, 0xa2, 0x02, 0xb7, 0x86, 0x1d, 0x0e, 0xc7, + 0xf9, 0x6c, 0x07, 0xc0, 0x35, 0x6a, 0x34, 0x79, 0x7c, 0xb8, + 0x0f, 0xed, 0x98, 0x50, 0xfb, 0x51, 0xe0, 0x36, 0x44, 0x4c, + 0xc6, 0x35, 0xa2, 0xbb, 0x55, 0xb0, 0x5c, 0x39, 0x08, 0x02, + 0x20, 0x35, 0x5c, 0x56, 0x6d, 0x2e, 0xb9, 0xef, 0x21, 0x26, + 0x87, 0x87, 0x85, 0x8a, 0x32, 0xb5, 0xa7, 0x68, 0x70, 0x3a, + 0xfd, 0x0d, 0x21, 0x48, 0x91, 0xa3, 0x29, 0xc1, 0x2a, 0x38, + 0xe5, 0x26, 0x31, 0x1f, 0x42, 0xde, 0x0b, 0x25, 0xff, 0x1d, + 0x6b, 0xb4, 0xe0, 0x5d, 0x2d, 0xcf, 0x44, 0xd5, 0x7d, 0xc4, + 0xf6, 0x95, 0xf2, 0x06, 0x4f, 0x83, 0x88, 0x9d, 0x1e, 0xeb, + 0x1c, 0x09,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xed, 0xe6, 0x51, 0xb1, 0xf2, 0xad, 0x7e, 0x51, + 0x78, 0x14, 0x2b, 0x19, 0xae, 0x64, 0x72, 0x0f, 0xd8, 0x18, + 0x79, 0x8e, 0x66, 0x88, 0xd3, 0xa4, 0xa3, 0xc3, 0x76, 0x21, + 0xcb, 0xe4, 0x79, 0x5e, 0x95, 0x74, 0xe3, 0x31, 0x18, 0x79, + 0xed, 0xc7, 0xe7, 0xfb, 0x86, 0x48, 0x1b, 0x7b, 0x75, 0x5b, + 0x7f, 0x7c, 0x82, 0xc5, 0xab, 0x11, 0xb4, 0x5d, 0x59, 0x6f, + 0x78, 0xb2, 0xa5, 0x39, 0xc6, 0x63, 0x38, 0x6c, 0xeb, 0x50, + 0x06, 0x14, 0x76, 0xf0, 0xe8, 0xfb, 0x11, 0x95, 0x1f, 0x9d, + 0x9c, 0xa6, 0xe1, 0xe2, 0x0d, 0xa3, 0x66, 0xfc, 0x20, 0x83, + 0x50, 0x0e, 0x53, 0x75, 0xb5, 0x12, 0xf4, 0xdf, 0x31, 0x46, + 0x83, 0xac, 0x5b, 0xf3, 0x99, 0xa6, 0xd1, 0x7b, 0x2b, 0xc5, + 0xdc, 0x71, 0x07, 0x27, 0x33, 0x35, 0x34, 0xf5, 0x30, 0x19, + 0xc1, 0x3b, 0xba, 0x8a, 0xaf, 0x7e, 0x49, 0x93, 0x48, 0x5b, + 0x38, 0xc0, 0xbc, 0x2e, 0xc7, 0x59, 0x1b, 0xd9, 0xf5, 0xcc, + 0x86, 0xf5, 0x7b, 0x4d, 0xd7, 0x39, 0xa7, 0xa2, 0x56, 0x20, + 0x48, 0x98, 0x7d, 0x4f, 0x75, 0x56, 0x9b, 0xb8, 0x95, 0x45, + 0x17, 0xf3, 0x86, 0x3d, 0x97, 0x0a, 0x49, 0x1b, 0xca, 0xff, + 0x20, 0xc0, 0x24, 0x2c, 0x51, 0xc2, 0x0a, 0x3c, 0xbf, 0x07, + 0x60, 0x1c, 0x88, 0x85, 0x9b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7a, 0xe4, 0x36, 0x1d, + 0x04, 0x27, 0x4c, 0xe5, 0xbd, 0x75, 0x24, 0xf7, 0xbd, 0xb6, + 0x6a, 0x68, 0x4e, 0x2c, 0x1b, 0x56, 0x3e, 0x60, 0xa4, 0x42, + 0xca, 0x7a, 0x54, 0xe5, 0x06, 0xe3, 0xda, 0x05, 0xf7, 0x77, + 0x36, 0x8b, 0x81, 0x26, 0x99, 0x92, 0x42, 0xda, 0x45, 0xb1, + 0xfe, 0x4b, +}; +static const int sizeof_bench_dilithium_level2_pubkey = + sizeof(bench_dilithium_level2_pubkey); + +#endif /* !WOLFSSL_DILITHIUM_NO_VERIFY */ + +#ifndef WOLFSSL_DILITHIUM_NO_SIGN + +/* raw private key without ASN1 syntax from + * ./certs/dilithium/bench_dilithium_level3_key.der */ +static const unsigned char bench_dilithium_level3_key[] = { + 0x15, 0xc9, 0xe5, 0x53, 0x2f, 0xd8, 0x1f, 0xb4, 0xa3, 0x9f, + 0xae, 0xad, 0xb3, 0x10, 0xd0, 0x72, 0x69, 0xd3, 0x02, 0xf3, + 0xdf, 0x67, 0x5a, 0x31, 0x52, 0x19, 0xca, 0x39, 0x27, 0x77, + 0x61, 0x6d, 0x72, 0xdd, 0x85, 0x06, 0xf6, 0x94, 0x0a, 0x57, + 0x52, 0xcd, 0xac, 0x83, 0x4a, 0xe5, 0xbe, 0xa4, 0x30, 0x79, + 0x9e, 0xc6, 0xd6, 0x04, 0xc8, 0x73, 0xdc, 0x5e, 0x41, 0x75, + 0x2f, 0xac, 0x76, 0x57, 0x03, 0x08, 0x46, 0xcb, 0xaf, 0x4c, + 0x6a, 0x4f, 0x20, 0x18, 0xb3, 0x2e, 0x11, 0x54, 0xb5, 0x94, + 0xe6, 0x6f, 0x76, 0xf6, 0xb9, 0x73, 0x9a, 0x07, 0x73, 0xe8, + 0x90, 0xd1, 0x04, 0xda, 0xc5, 0x97, 0xb9, 0x52, 0x51, 0xc8, + 0xc9, 0xcc, 0x87, 0x29, 0xa1, 0xde, 0x79, 0x9b, 0xf8, 0x7f, + 0x80, 0x3f, 0xfd, 0xb3, 0x24, 0xa5, 0xba, 0xf5, 0xd6, 0xd4, + 0x07, 0xbd, 0xa7, 0x1b, 0xd0, 0xe1, 0xd0, 0x43, 0x14, 0x52, + 0x27, 0x03, 0x33, 0x76, 0x00, 0x67, 0x30, 0x23, 0x76, 0x34, + 0x72, 0x02, 0x41, 0x62, 0x12, 0x43, 0x86, 0x30, 0x18, 0x28, + 0x46, 0x27, 0x45, 0x20, 0x88, 0x33, 0x54, 0x10, 0x03, 0x81, + 0x44, 0x50, 0x06, 0x44, 0x56, 0x30, 0x37, 0x38, 0x38, 0x46, + 0x03, 0x85, 0x01, 0x86, 0x43, 0x80, 0x78, 0x28, 0x83, 0x55, + 0x37, 0x44, 0x80, 0x12, 0x17, 0x51, 0x78, 0x46, 0x22, 0x01, + 0x53, 0x54, 0x63, 0x87, 0x77, 0x38, 0x11, 0x81, 0x43, 0x30, + 0x15, 0x47, 0x66, 0x11, 0x40, 0x65, 0x70, 0x56, 0x62, 0x28, + 0x21, 0x65, 0x30, 0x45, 0x63, 0x53, 0x31, 0x80, 0x81, 0x71, + 0x23, 0x62, 0x85, 0x03, 0x07, 0x56, 0x16, 0x28, 0x18, 0x35, + 0x07, 0x38, 0x60, 0x68, 0x17, 0x30, 0x15, 0x20, 0x04, 0x13, + 0x13, 0x61, 0x51, 0x58, 0x00, 0x37, 0x51, 0x58, 0x14, 0x06, + 0x12, 0x55, 0x13, 0x46, 0x76, 0x05, 0x51, 0x87, 0x32, 0x62, + 0x50, 0x41, 0x88, 0x24, 0x50, 0x31, 0x65, 0x36, 0x31, 0x02, + 0x75, 0x35, 0x78, 0x27, 0x36, 0x08, 0x01, 0x77, 0x22, 0x77, + 0x30, 0x80, 0x11, 0x21, 0x28, 0x26, 0x68, 0x27, 0x13, 0x70, + 0x50, 0x44, 0x88, 0x20, 0x50, 0x67, 0x65, 0x74, 0x17, 0x46, + 0x50, 0x16, 0x42, 0x75, 0x35, 0x12, 0x60, 0x12, 0x17, 0x13, + 0x36, 0x72, 0x04, 0x77, 0x07, 0x55, 0x20, 0x27, 0x15, 0x02, + 0x25, 0x12, 0x57, 0x71, 0x37, 0x45, 0x43, 0x34, 0x40, 0x31, + 0x78, 0x50, 0x31, 0x28, 0x17, 0x84, 0x87, 0x43, 0x25, 0x75, + 0x58, 0x05, 0x61, 0x56, 0x41, 0x44, 0x57, 0x67, 0x85, 0x54, + 0x00, 0x88, 0x88, 0x50, 0x68, 0x11, 0x14, 0x42, 0x08, 0x74, + 0x73, 0x00, 0x38, 0x08, 0x45, 0x28, 0x62, 0x43, 0x36, 0x20, + 0x30, 0x10, 0x87, 0x83, 0x67, 0x62, 0x02, 0x48, 0x46, 0x50, + 0x08, 0x08, 0x41, 0x43, 0x78, 0x22, 0x65, 0x87, 0x43, 0x84, + 0x25, 0x36, 0x58, 0x64, 0x30, 0x10, 0x20, 0x68, 0x82, 0x47, + 0x60, 0x31, 0x76, 0x68, 0x74, 0x68, 0x75, 0x61, 0x16, 0x26, + 0x82, 0x50, 0x32, 0x61, 0x41, 0x22, 0x38, 0x20, 0x86, 0x75, + 0x74, 0x00, 0x77, 0x12, 0x81, 0x35, 0x51, 0x78, 0x88, 0x64, + 0x82, 0x00, 0x41, 0x55, 0x62, 0x87, 0x51, 0x41, 0x74, 0x51, + 0x53, 0x27, 0x33, 0x84, 0x68, 0x86, 0x57, 0x60, 0x44, 0x30, + 0x22, 0x32, 0x10, 0x52, 0x22, 0x83, 0x48, 0x53, 0x66, 0x74, + 0x14, 0x52, 0x32, 0x71, 0x41, 0x08, 0x83, 0x67, 0x41, 0x38, + 0x46, 0x80, 0x88, 0x14, 0x84, 0x30, 0x85, 0x35, 0x46, 0x20, + 0x54, 0x84, 0x56, 0x84, 0x54, 0x82, 0x14, 0x11, 0x52, 0x07, + 0x86, 0x46, 0x05, 0x82, 0x26, 0x85, 0x75, 0x07, 0x88, 0x75, + 0x51, 0x17, 0x54, 0x32, 0x68, 0x66, 0x08, 0x23, 0x66, 0x06, + 0x42, 0x28, 0x00, 0x84, 0x27, 0x27, 0x43, 0x47, 0x12, 0x27, + 0x13, 0x15, 0x17, 0x74, 0x85, 0x14, 0x12, 0x62, 0x06, 0x47, + 0x17, 0x60, 0x00, 0x10, 0x85, 0x16, 0x55, 0x64, 0x46, 0x62, + 0x77, 0x05, 0x51, 0x23, 0x52, 0x37, 0x51, 0x78, 0x35, 0x66, + 0x14, 0x15, 0x78, 0x40, 0x16, 0x54, 0x67, 0x30, 0x61, 0x24, + 0x26, 0x86, 0x56, 0x83, 0x62, 0x78, 0x88, 0x83, 0x50, 0x06, + 0x13, 0x21, 0x33, 0x73, 0x16, 0x44, 0x86, 0x77, 0x65, 0x28, + 0x12, 0x40, 0x62, 0x54, 0x55, 0x84, 0x00, 0x11, 0x77, 0x38, + 0x71, 0x51, 0x38, 0x32, 0x33, 0x67, 0x15, 0x77, 0x24, 0x33, + 0x44, 0x11, 0x05, 0x65, 0x13, 0x03, 0x72, 0x63, 0x81, 0x58, + 0x08, 0x03, 0x34, 0x23, 0x61, 0x00, 0x02, 0x63, 0x86, 0x40, + 0x03, 0x71, 0x34, 0x27, 0x45, 0x10, 0x34, 0x26, 0x83, 0x28, + 0x31, 0x35, 0x26, 0x05, 0x58, 0x41, 0x11, 0x10, 0x65, 0x35, + 0x22, 0x42, 0x28, 0x88, 0x46, 0x06, 0x57, 0x33, 0x88, 0x46, + 0x04, 0x86, 0x88, 0x88, 0x51, 0x74, 0x82, 0x27, 0x58, 0x14, + 0x11, 0x08, 0x13, 0x16, 0x61, 0x16, 0x14, 0x44, 0x83, 0x85, + 0x71, 0x44, 0x55, 0x82, 0x16, 0x62, 0x85, 0x05, 0x43, 0x41, + 0x73, 0x53, 0x60, 0x01, 0x80, 0x68, 0x33, 0x13, 0x43, 0x44, + 0x73, 0x36, 0x65, 0x35, 0x22, 0x26, 0x13, 0x31, 0x36, 0x83, + 0x30, 0x27, 0x15, 0x11, 0x54, 0x53, 0x24, 0x84, 0x75, 0x24, + 0x72, 0x78, 0x34, 0x24, 0x35, 0x80, 0x06, 0x38, 0x88, 0x11, + 0x41, 0x01, 0x34, 0x87, 0x77, 0x20, 0x14, 0x50, 0x55, 0x12, + 0x17, 0x48, 0x87, 0x74, 0x58, 0x42, 0x31, 0x46, 0x36, 0x37, + 0x26, 0x50, 0x04, 0x75, 0x77, 0x15, 0x41, 0x53, 0x04, 0x04, + 0x26, 0x61, 0x65, 0x87, 0x55, 0x56, 0x07, 0x81, 0x28, 0x21, + 0x41, 0x61, 0x41, 0x50, 0x17, 0x47, 0x25, 0x50, 0x20, 0x83, + 0x46, 0x87, 0x18, 0x45, 0x40, 0x21, 0x06, 0x08, 0x12, 0x25, + 0x71, 0x13, 0x35, 0x55, 0x54, 0x61, 0x00, 0x52, 0x74, 0x78, + 0x13, 0x84, 0x55, 0x40, 0x14, 0x40, 0x78, 0x12, 0x88, 0x43, + 0x33, 0x24, 0x66, 0x88, 0x22, 0x44, 0x15, 0x37, 0x81, 0x27, + 0x84, 0x18, 0x28, 0x11, 0x58, 0x51, 0x71, 0x21, 0x02, 0x83, + 0x70, 0x48, 0x32, 0x46, 0x00, 0x70, 0x17, 0x30, 0x63, 0x21, + 0x46, 0x60, 0x50, 0x72, 0x77, 0x45, 0x83, 0x75, 0x26, 0x31, + 0x47, 0x34, 0x47, 0x84, 0x87, 0x63, 0x22, 0x83, 0x21, 0x10, + 0x21, 0x51, 0x47, 0x46, 0x31, 0x06, 0x57, 0x82, 0x65, 0x24, + 0x61, 0x66, 0x24, 0x68, 0x14, 0x03, 0x43, 0x41, 0x04, 0x14, + 0x47, 0x61, 0x57, 0x87, 0x43, 0x83, 0x43, 0x25, 0x87, 0x36, + 0x72, 0x51, 0x38, 0x51, 0x54, 0x54, 0x84, 0x40, 0x15, 0x30, + 0x35, 0x34, 0x43, 0x61, 0x63, 0x42, 0x77, 0x31, 0x42, 0x06, + 0x61, 0x03, 0x01, 0x41, 0x08, 0x84, 0x02, 0x65, 0x04, 0x72, + 0x32, 0x00, 0x21, 0x10, 0x54, 0x73, 0x04, 0x42, 0x48, 0x11, + 0x74, 0x18, 0x63, 0x73, 0x28, 0x61, 0x36, 0x80, 0x20, 0x86, + 0x24, 0x42, 0x16, 0x11, 0x71, 0x83, 0x78, 0x38, 0x82, 0x47, + 0x67, 0x18, 0x56, 0x86, 0x85, 0x66, 0x18, 0x24, 0x50, 0x74, + 0x72, 0x02, 0x66, 0x83, 0x63, 0x08, 0x25, 0x32, 0x15, 0x78, + 0x33, 0x08, 0x34, 0x44, 0x08, 0x28, 0x10, 0x25, 0x40, 0x11, + 0x04, 0x76, 0x60, 0x16, 0x65, 0x16, 0x13, 0x30, 0x53, 0x14, + 0x77, 0x06, 0x06, 0x88, 0x64, 0x47, 0x08, 0x23, 0x11, 0x56, + 0x46, 0x61, 0x48, 0x64, 0x73, 0x66, 0x07, 0x65, 0x41, 0x24, + 0x67, 0x45, 0x42, 0x18, 0x62, 0x01, 0x70, 0x88, 0x03, 0x77, + 0x22, 0x85, 0x77, 0x02, 0x85, 0x03, 0x65, 0x15, 0x57, 0x51, + 0x28, 0x72, 0x53, 0x32, 0x05, 0x58, 0x84, 0x54, 0x03, 0x81, + 0x63, 0x23, 0x38, 0x27, 0x01, 0x85, 0x61, 0x12, 0x28, 0x62, + 0x22, 0x67, 0x56, 0x66, 0x63, 0x08, 0x74, 0x63, 0x21, 0x01, + 0x46, 0x10, 0x08, 0x18, 0x07, 0x86, 0x47, 0x70, 0x50, 0x25, + 0x45, 0x06, 0x55, 0x88, 0x46, 0x11, 0x23, 0x84, 0x70, 0x02, + 0x24, 0x88, 0x52, 0x60, 0x12, 0x72, 0x63, 0x05, 0x81, 0x21, + 0x26, 0x07, 0x64, 0x03, 0x56, 0x48, 0x27, 0x04, 0x38, 0x86, + 0x25, 0x65, 0x21, 0x25, 0x77, 0x21, 0x62, 0x28, 0x82, 0x71, + 0x85, 0x73, 0x78, 0x24, 0x78, 0x51, 0x61, 0x02, 0x81, 0x14, + 0x67, 0x61, 0x08, 0x88, 0x31, 0x77, 0x06, 0x24, 0x45, 0x13, + 0x67, 0x67, 0x54, 0x67, 0x00, 0x12, 0x62, 0x54, 0x11, 0x27, + 0x51, 0x48, 0x07, 0x33, 0x01, 0x24, 0x04, 0x64, 0x11, 0x83, + 0x18, 0x52, 0x55, 0x23, 0x24, 0x58, 0x53, 0x78, 0x30, 0x43, + 0x31, 0x76, 0x62, 0x01, 0x08, 0x73, 0x21, 0x32, 0x12, 0x78, + 0x22, 0x68, 0x33, 0x45, 0x33, 0x73, 0x02, 0x74, 0x21, 0x81, + 0x02, 0x16, 0x54, 0x31, 0x55, 0x76, 0x25, 0x76, 0x41, 0x36, + 0x75, 0x22, 0x78, 0x16, 0x60, 0x48, 0x58, 0x28, 0x83, 0x50, + 0x88, 0x66, 0x72, 0x70, 0x21, 0x21, 0x24, 0x16, 0x62, 0x57, + 0x20, 0x13, 0x80, 0x61, 0x15, 0x45, 0x42, 0x86, 0x00, 0x25, + 0x77, 0x58, 0x84, 0x01, 0x66, 0x16, 0x46, 0x56, 0x68, 0x57, + 0x12, 0x20, 0x75, 0x60, 0x41, 0x85, 0x02, 0x88, 0x12, 0x68, + 0x20, 0x02, 0x41, 0x18, 0x87, 0x13, 0x17, 0x33, 0x74, 0x11, + 0x08, 0x37, 0x47, 0x08, 0x31, 0x67, 0x08, 0x50, 0x61, 0x54, + 0x56, 0x71, 0x63, 0x26, 0x85, 0x22, 0x07, 0x87, 0x71, 0x28, + 0x20, 0x47, 0x48, 0x66, 0x54, 0x38, 0x03, 0x41, 0x38, 0x21, + 0x70, 0x50, 0x66, 0x53, 0x56, 0x70, 0x74, 0x55, 0x70, 0x28, + 0x52, 0x01, 0x42, 0x65, 0x53, 0x73, 0x32, 0x33, 0x67, 0x42, + 0x67, 0x85, 0x18, 0x45, 0x12, 0x37, 0x58, 0x82, 0x13, 0x73, + 0x78, 0x77, 0x03, 0x42, 0x04, 0x65, 0x55, 0x66, 0x07, 0x25, + 0x07, 0x37, 0x40, 0x78, 0x66, 0x71, 0x11, 0x21, 0x43, 0x25, + 0x87, 0x40, 0x58, 0x63, 0x33, 0x43, 0x52, 0x10, 0x31, 0x53, + 0x56, 0x48, 0x05, 0x55, 0x77, 0x77, 0x26, 0x87, 0x28, 0x43, + 0x61, 0x46, 0x11, 0x76, 0x82, 0x50, 0x42, 0x04, 0x32, 0x88, + 0x18, 0x66, 0x16, 0x36, 0x64, 0x41, 0x38, 0x17, 0x55, 0x43, + 0x06, 0x25, 0x80, 0x27, 0x21, 0x16, 0x81, 0x22, 0x64, 0x60, + 0x38, 0x16, 0x82, 0x40, 0x72, 0x34, 0x73, 0x52, 0x61, 0x85, + 0x11, 0x16, 0x00, 0x25, 0x03, 0x30, 0x06, 0x80, 0x21, 0x56, + 0x64, 0x52, 0x23, 0x26, 0x37, 0x75, 0x73, 0x65, 0x53, 0x27, + 0x37, 0x47, 0x56, 0x76, 0x80, 0x38, 0x53, 0x62, 0x14, 0x24, + 0x64, 0x03, 0x66, 0x21, 0x72, 0x16, 0x36, 0x34, 0x11, 0x65, + 0x61, 0x62, 0x86, 0x02, 0x83, 0x27, 0x80, 0x82, 0x70, 0x72, + 0x52, 0x60, 0x20, 0x87, 0x58, 0x58, 0x14, 0x38, 0x47, 0x03, + 0x10, 0x72, 0x60, 0x48, 0x02, 0x01, 0x17, 0x21, 0x61, 0x62, + 0x38, 0x64, 0x27, 0x53, 0x57, 0x13, 0x68, 0x18, 0x26, 0x62, + 0x43, 0x42, 0x21, 0x85, 0x70, 0x23, 0x58, 0x13, 0x72, 0x04, + 0x04, 0x08, 0x05, 0x82, 0x26, 0x18, 0x82, 0x47, 0x87, 0x71, + 0x32, 0x28, 0x68, 0x25, 0x87, 0x24, 0x06, 0x74, 0x41, 0x44, + 0x08, 0x64, 0x68, 0x30, 0x24, 0x44, 0x21, 0x73, 0x03, 0x45, + 0x70, 0x41, 0x06, 0x78, 0x38, 0x33, 0x88, 0x13, 0x31, 0x14, + 0x18, 0x17, 0x45, 0x06, 0x26, 0x67, 0x66, 0x73, 0x82, 0x56, + 0x66, 0x88, 0x70, 0x22, 0x55, 0x47, 0x27, 0x50, 0x86, 0x55, + 0x53, 0x00, 0x28, 0x55, 0x40, 0x62, 0xe9, 0x37, 0x65, 0xe1, + 0x30, 0x48, 0x6b, 0x35, 0x76, 0x96, 0x05, 0x21, 0xce, 0xed, + 0x46, 0xae, 0x7e, 0x6d, 0xc9, 0xf1, 0xc9, 0xb3, 0x7a, 0xa7, + 0xde, 0xa7, 0x62, 0x18, 0x11, 0xc0, 0xd8, 0xd0, 0x17, 0x0f, + 0x38, 0xaf, 0x0e, 0x3d, 0xaf, 0xe6, 0x63, 0xb0, 0xc4, 0x68, + 0x4e, 0x29, 0xa4, 0xf4, 0x20, 0x22, 0xbc, 0x82, 0x15, 0x1d, + 0x08, 0x39, 0x18, 0xfe, 0x69, 0x55, 0x06, 0x3d, 0xf4, 0xa3, + 0xe7, 0x29, 0x23, 0xa4, 0xd9, 0xa4, 0x22, 0x06, 0x2d, 0x5f, + 0x22, 0xb3, 0x9b, 0x1c, 0xb6, 0x3e, 0xf3, 0xf4, 0x8a, 0xb3, + 0x35, 0x18, 0x4c, 0x1f, 0xaf, 0xd4, 0xcf, 0x5b, 0x9b, 0xa7, + 0xf8, 0xd2, 0x86, 0x71, 0x8e, 0x64, 0x96, 0xd1, 0x6e, 0xad, + 0xd2, 0x7e, 0x16, 0x5b, 0x38, 0x91, 0x0e, 0x40, 0xaa, 0x07, + 0x6a, 0x63, 0x2a, 0xc0, 0x5b, 0x14, 0x79, 0x52, 0xcb, 0x23, + 0x6e, 0x76, 0x95, 0xd0, 0x90, 0x6c, 0x18, 0xe7, 0x89, 0xee, + 0xb9, 0x7f, 0x33, 0x08, 0x35, 0x8f, 0xa3, 0xaa, 0xaa, 0x10, + 0x2f, 0x8b, 0xc9, 0x6c, 0x1d, 0x95, 0xb5, 0xb8, 0x54, 0x0d, + 0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xa4, 0x5c, 0x23, 0xaa, 0x85, 0xc9, 0x9a, 0xbd, 0x71, 0x49, + 0x11, 0x30, 0x8b, 0x81, 0xa1, 0xdd, 0xf8, 0xb8, 0x74, 0x91, + 0xe7, 0xf7, 0x82, 0x42, 0x70, 0x22, 0x95, 0xf0, 0xcc, 0x9f, + 0x02, 0x33, 0x0f, 0x08, 0x3b, 0x04, 0x31, 0xd7, 0x4f, 0x86, + 0x78, 0x49, 0xb9, 0x90, 0xf5, 0x8f, 0xec, 0x12, 0x84, 0x52, + 0x03, 0x1f, 0x64, 0x5e, 0xf0, 0x2a, 0xeb, 0x87, 0xa5, 0xec, + 0x95, 0x25, 0x64, 0x25, 0x49, 0x3b, 0x3c, 0x30, 0xed, 0x3b, + 0xe9, 0x36, 0xfd, 0xae, 0xa6, 0x26, 0xd3, 0x45, 0xbc, 0x1b, + 0x78, 0x5f, 0xce, 0x27, 0x45, 0x1c, 0xd5, 0xf9, 0xa7, 0xda, + 0x62, 0xe6, 0x7e, 0xd3, 0xbb, 0xd8, 0x0a, 0xfd, 0xf5, 0xa5, + 0x31, 0x09, 0x6e, 0x40, 0xe8, 0xcf, 0xc1, 0x42, 0x8e, 0x2e, + 0x75, 0x65, 0xaa, 0x91, 0x6f, 0xc7, 0x75, 0x3a, 0x1e, 0x40, + 0x99, 0x71, 0x5e, 0x00, 0xae, 0x07, 0xad, 0x43, 0x49, 0xdd, + 0x6d, 0x36, 0xe3, 0xa8, 0xdf, 0x2c, 0x39, 0xa2, 0x57, 0xd7, + 0x93, 0xa1, 0x16, 0x80, 0x89, 0xa6, 0x56, 0x69, 0x75, 0xea, + 0xb8, 0xb2, 0x43, 0x0c, 0xdf, 0x46, 0x05, 0x9a, 0x39, 0x08, + 0x3b, 0xb6, 0x76, 0xe3, 0x5b, 0x98, 0x5b, 0x48, 0xc0, 0x11, + 0x14, 0x6f, 0xcd, 0xb7, 0xaa, 0x08, 0x1e, 0x53, 0x9b, 0x94, + 0x9d, 0xa2, 0xe6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, 0x73, 0xa0, 0x37, + 0x67, 0xbb, 0x8b, 0xc3, 0xfc, 0xac, 0x6e, 0x6c, 0x0e, 0x5d, + 0x44, 0xb0, 0x9d, 0xf8, 0xae, 0x17, 0x9b, 0xf9, 0xcb, 0xe8, + 0xfe, 0xc1, 0x7b, 0x78, 0x16, 0xf6, 0x74, 0x04, 0x7d, 0x38, + 0x17, 0x36, 0x09, 0xe3, 0x73, 0xa1, 0x76, 0x78, 0x7c, 0x14, + 0xb3, 0x83, 0x91, 0x59, 0x27, 0xea, 0x8c, 0x69, 0xe6, 0xa5, + 0x21, 0xcd, 0x78, 0xc7, 0x26, 0xa2, 0xfb, 0xd4, 0xf3, 0xaf, + 0x3f, 0xcf, 0x51, 0x10, 0xcc, 0x4b, 0xdd, 0x14, 0xf4, 0xf3, + 0xb8, 0xea, 0x07, 0xa7, 0x76, 0xe7, 0xbe, 0xec, 0x01, 0xb5, + 0x1e, 0xdc, 0xc3, 0x55, 0x19, 0xb1, 0x16, 0x3f, 0xfe, 0xd4, + 0x15, 0x49, 0xaf, 0x04, 0x9d, 0x38, 0xdd, 0x86, 0x53, 0x2a, + 0x80, 0x62, 0x42, 0xb7, 0x98, 0x42, 0x38, 0xaf, 0x9d, 0x87, + 0xe2, 0x3f, 0xea, 0x7e, 0x0a, 0x35, 0xb8, 0xee, 0xa5, 0x48, + 0x09, 0x08, 0xc5, 0x0d, 0xae, 0x01, 0xd5, 0xec, 0x43, 0x29, + 0x3b, 0xfb, 0x78, 0xc4, 0x96, 0x01, 0x1c, 0x21, 0xf2, 0xc9, + 0x44, 0x68, 0x24, 0x66, 0x86, 0x96, 0xb8, 0xc8, 0xe9, 0xd0, + 0x38, 0x0e, 0x96, 0x4d, 0xcc, 0x45, 0xab, 0xe1, 0xca, 0x50, + 0x10, 0x20, 0x01, 0xbe, 0x89, 0xc0, 0x43, 0x84, 0xd8, 0x38, + 0x52, 0xc0, 0xaf, 0x4d, 0x6b, 0x99, 0x0b, 0xc0, 0xc2, 0x99, + 0x07, 0xc6, 0x78, 0xa8, 0xf7, 0x32, 0x84, 0x86, 0xc5, 0x1a, + 0x95, 0x81, 0xa6, 0x6a, 0x05, 0xa7, 0x9d, 0x81, 0x0e, 0x32, + 0x18, 0x11, 0x4a, 0x0f, 0xfc, 0x17, 0x9e, 0xf7, 0xbf, 0x54, + 0x82, 0xed, 0xba, 0x6f, 0xbd, 0x41, 0xc1, 0xca, 0x55, 0x6c, + 0xff, 0x32, 0x6b, 0xa2, 0x59, 0xae, 0xae, 0x92, 0xc1, 0xb5, + 0xa6, 0xfc, 0xaf, 0x09, 0x48, 0x57, 0xd6, 0xee, 0x38, 0x99, + 0xb4, 0xe3, 0x8f, 0xb7, 0xfc, 0x6a, 0x0a, 0x3b, 0x08, 0xe1, + 0x81, 0x46, 0x11, 0xeb, 0x4a, 0x98, 0x43, 0x16, 0x16, 0x1f, + 0x68, 0xdb, 0xb9, 0x71, 0x19, 0xfe, 0x8b, 0xe6, 0xb7, 0x8b, + 0xc1, 0x3b, 0x90, 0xc5, 0x89, 0x1d, 0xca, 0xd9, 0x19, 0x6c, + 0xe8, 0x01, 0xf4, 0x19, 0x50, 0x3e, 0x93, 0x84, 0xbf, 0xaa, + 0x9a, 0x3d, 0x20, 0x4c, 0x4e, 0x79, 0x83, 0xec, 0x46, 0x83, + 0x09, 0x00, 0xc3, 0x8a, 0xad, 0xd5, 0x2b, 0x08, 0xd1, 0x47, + 0xac, 0x96, 0x0e, 0x34, 0xf0, 0x89, 0x1a, 0x0f, 0xf2, 0x51, + 0x8d, 0x2c, 0xb5, 0xf2, 0xfe, 0x8c, 0xdc, 0xed, 0x41, 0x51, + 0x8c, 0x71, 0x12, 0x05, 0xec, 0x68, 0x21, 0x86, 0x94, 0xf4, + 0xfb, 0xfc, 0xaa, 0xc7, 0xc7, 0xbb, 0x74, 0xa2, 0x8b, 0x76, + 0x62, 0x1c, 0x64, 0x11, 0xa0, 0xd0, 0x5f, 0x46, 0x64, 0xd4, + 0x47, 0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, 0xce, 0x89, 0x67, 0xfc, 0x1c, 0x28, + 0xab, 0x11, 0x5a, 0x84, 0x23, 0x7c, 0x91, 0xac, 0x6b, 0x48, + 0x9c, 0x39, 0x14, 0xa3, 0xac, 0xc6, 0x30, 0xbc, 0x1e, 0x0c, + 0xd3, 0x34, 0x19, 0xa9, 0x2b, 0xe7, 0xa4, 0xf8, 0xc1, 0xf0, + 0x3c, 0x60, 0xa2, 0xf7, 0x51, 0x86, 0xcf, 0x42, 0xad, 0x34, + 0x81, 0xa6, 0x93, 0x0b, 0x88, 0x4c, 0xbf, 0xd2, 0x4f, 0xe0, + 0xdb, 0xb2, 0x1d, 0x6d, 0xb2, 0x5c, 0xac, 0xd8, 0x64, 0x85, + 0xc3, 0x35, 0x6e, 0x5d, 0xaf, 0x63, 0x3e, 0x47, 0xb7, 0x5d, + 0x39, 0x21, 0x36, 0xa6, 0xd4, 0xef, 0x9e, 0x1c, 0x1f, 0xd6, + 0xa4, 0xe0, 0xe4, 0x22, 0x75, 0x1e, 0xeb, 0x15, 0xb4, 0xee, + 0x43, 0x37, 0x06, 0xf9, 0x77, 0xbf, 0x68, 0x9b, 0x9a, 0x7f, + 0x38, 0x30, 0x87, 0xde, 0x0c, 0x6a, 0x39, 0x41, 0xe1, 0xed, + 0xf4, 0x18, 0x6e, 0x29, 0x44, 0xf0, 0xfc, 0xb6, 0x09, 0x5b, + 0xb3, 0x30, 0xc9, 0x0a, 0x8c, 0x41, 0x6f, 0x1e, 0x95, 0xbe, + 0x93, 0x3c, 0x11, 0x9b, 0x24, 0xf7, 0x57, 0xb8, 0xc5, 0x9b, + 0x08, 0xaa, 0xcd, 0x24, 0x86, 0x98, 0x59, 0x0f, 0xc6, 0x0e, + 0xd2, 0x71, 0xb2, 0x5e, 0xae, 0x72, 0xc9, 0x69, 0x3b, 0x80, + 0xc2, 0x27, +}; +static const int sizeof_bench_dilithium_level3_key = sizeof(bench_dilithium_level3_key); + +#endif /* !WOLFSSL_DILITHIUM_NO_SIGN */ + +#ifndef WOLFSSL_DILITHIUM_NO_VERIFY + +/* raw public key without ASN1 syntax from + * ./certs/dilithium/bench_dilithium_level3_key.der */ +static const unsigned char bench_dilithium_level3_pubkey[] = { + 0x15, 0xc9, 0xe5, 0x53, 0x2f, 0xd8, 0x1f, 0xb4, 0xa3, 0x9f, + 0xae, 0xad, 0xb3, 0x10, 0xd0, 0x72, 0x69, 0xd3, 0x02, 0xf3, + 0xdf, 0x67, 0x5a, 0x31, 0x52, 0x19, 0xca, 0x39, 0x27, 0x77, + 0x61, 0x6d, 0x0f, 0xc1, 0x33, 0x26, 0x09, 0xf0, 0xf9, 0x4d, + 0x12, 0x7a, 0xef, 0xf7, 0x21, 0x26, 0x2c, 0xe0, 0xe2, 0x92, + 0x1f, 0x9d, 0xd1, 0xaa, 0xaf, 0x08, 0x14, 0xf2, 0xaa, 0x24, + 0x99, 0x0f, 0x20, 0x57, 0x35, 0x04, 0x32, 0x96, 0x8e, 0x6e, + 0x10, 0x64, 0xe3, 0xe3, 0x57, 0x26, 0x33, 0x32, 0x7b, 0xe4, + 0x18, 0x41, 0x77, 0xd3, 0x24, 0x63, 0x3d, 0x11, 0xea, 0xdc, + 0xbe, 0x59, 0xff, 0x8d, 0xc2, 0xe4, 0xc7, 0x04, 0xf3, 0xd4, + 0xe0, 0x1d, 0x5e, 0x09, 0x46, 0xbf, 0x02, 0x05, 0xc7, 0xa6, + 0xb7, 0x82, 0x40, 0x1f, 0x55, 0xe9, 0x77, 0x82, 0xc0, 0xcc, + 0x86, 0x99, 0x19, 0x99, 0xa2, 0xc9, 0x1b, 0x4f, 0xdd, 0x49, + 0x4c, 0x78, 0x0a, 0x58, 0xb8, 0xf0, 0x23, 0xac, 0x1a, 0x71, + 0x57, 0x6d, 0xd6, 0x3a, 0x3a, 0x6f, 0x93, 0xb3, 0x2b, 0x09, + 0xbe, 0xec, 0x7b, 0x5b, 0xf7, 0x3a, 0xed, 0xf9, 0xd0, 0xb1, + 0xfe, 0x9f, 0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 0x8a, 0x0e, 0x34, 0xf6, 0x3f, 0x5c, + 0xef, 0x0e, 0xcc, 0x52, 0x38, 0x2d, 0x7b, 0xc2, 0x1b, 0x69, + 0x9f, 0xe5, 0xed, 0x14, 0xb0, 0x91, 0x0b, 0xe9, 0x4d, 0x34, + 0xd5, 0xaa, 0xd4, 0xd2, 0x46, 0x39, 0x45, 0x7e, 0x85, 0x2f, + 0xdb, 0x89, 0xf4, 0xff, 0x05, 0x74, 0x51, 0xba, 0xdd, 0xee, + 0xf6, 0xc2, 0xc1, 0x0a, 0x8f, 0xd9, 0xeb, 0xc7, 0x61, 0x30, + 0x8f, 0x86, 0x8b, 0x1f, 0x82, 0xc1, 0x22, 0xfd, 0x83, 0xf4, + 0x5d, 0xc5, 0x94, 0xf5, 0xd7, 0x17, 0xc7, 0x7b, 0x71, 0xf5, + 0x5e, 0x15, 0x49, 0x70, 0xb2, 0x57, 0xa0, 0xc0, 0x57, 0x63, + 0x53, 0x35, 0xb6, 0x52, 0x20, 0x7b, 0x83, 0xd4, 0x57, 0x63, + 0x25, 0x8e, 0x83, 0xb3, 0x8e, 0x26, 0x1f, 0x09, 0xde, 0x14, + 0xd6, 0xa6, 0xfc, 0xe5, 0x93, 0x3c, 0x88, 0x8e, 0xf5, 0x10, + 0x57, 0xb9, 0xc9, 0x9b, 0xff, 0x72, 0x9d, 0x3d, 0x3f, 0x97, + 0xd9, 0x3c, 0x20, 0xe2, 0x57, 0xfd, 0x2a, 0x5c, 0x17, 0x12, + 0xe6, 0x08, 0xaf, 0xe4, 0x26, 0x96, 0xb9, 0x6d, 0xc3, 0xac, + 0x22, 0xf3, 0x8b, 0x89, 0xde, 0xc7, 0x8a, 0x93, 0x06, 0xf7, + 0x1d, 0x08, 0x21, 0x36, 0x16, 0x74, 0x2b, 0x97, 0x23, 0xe4, + 0x79, 0x31, 0x08, 0x23, 0x62, 0x30, 0x67, 0xe2, 0xed, 0x30, + 0x9b, 0x0c, 0xf9, 0x08, 0x7a, 0x29,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 0x48, 0x24, + 0x7c, 0xea, 0xa1, 0x75, 0x27, 0xe5, 0xf4, 0x70, 0xeb, 0x3b, + 0xc7, 0x26, 0x37, 0x04, 0xff, 0x8a, 0x7a, 0xd0, 0xc2, 0xb7, + 0x84, 0xb7, 0x29, 0xfb, 0x0e, 0xa3, 0xa8, 0x71, 0xcd, 0x58, + 0x06, 0x36, 0xe2, 0xf2, 0x77, 0xcc, 0x0f, 0x78, 0x08, 0x2b, + 0xbb, 0xe3, 0x53, 0x05, 0x71, 0xdc, 0x6c, 0x37, 0x32, 0x91, + 0x46, 0x42, 0x4f, 0x21, 0xe0, 0x34, 0xad, 0x3f, 0x30, 0x5a, + 0xc7, 0x0d, 0x17, 0x19, 0x39, 0x31, 0x58, 0x69, 0x3c, 0x8c, + 0xbe, 0xe7, 0xa6, 0x3b, 0xad, 0xfb, 0x46, 0x89, 0x06, 0xc1, + 0x8c, 0x16, 0x9a, 0x06, 0x3a, 0xd0, 0x7e, 0xd6, 0xb0, 0x7b, + 0x7d, 0xf8, 0x91, 0x7c, 0xfa, 0xd9, 0x66, 0x39, 0xfa, 0xbc, + 0x57, 0xa7, 0x78, 0x8b, 0x36, 0x78, 0xc0, 0x1c, 0x0e, 0x23, + 0x05, 0x0e, 0x04, 0x61, 0x16, 0x34, 0xf9, 0xc6, 0x63, 0x58, + 0xdf, 0xf4, 0x52, 0xce, 0xd0, 0x0f, 0x0c, 0xec, 0xb1, 0x82, + 0xf4, 0x72, 0x73, 0x72, 0x3f, 0x02, 0xbe, 0xe3, 0x9c, 0x63, + 0x73, 0xc8, 0x21, 0x65, 0xba, 0x57, 0x52, 0xa9, 0x19, 0xac, + 0x68, 0x50, 0xbd, 0x2d, 0x72, 0x5b, 0x93, 0x0f, 0x1c, 0x81, + 0x77, 0xd7, 0x2e, 0xc3, 0x93, 0x52, 0x6e, 0xdc, 0x79, 0x52, + 0x9f, 0xe3, 0xde, 0xe1, 0xba, 0x58, 0x55, 0xab, 0x8a, 0xf2, + 0x35, 0x6a, 0xcf, 0x94, 0x1f, 0x17, 0xa4, 0x23, 0x2e, 0x8e, + 0x18, 0x21, 0xbe, 0x14, 0xfa, 0xe7, 0x59, 0xc5, 0x44, 0x34, + 0xce, 0x03, 0xf4, 0xb7, 0x75, 0xd3, 0x51, 0x55, 0xdf, 0xff, + 0xcf, 0x4f, 0x44, 0xee, 0x13, 0x9b, 0xcb, 0x12, 0xae, 0xe5, + 0x5b, 0x44, 0x65, 0x28, 0xcb, 0x6a, 0x9c, 0x24, 0x1d, 0xea, + 0x2d, 0x5e, 0xa5, 0xc3, 0x78, 0xad, 0xed, 0x0c, 0x05, 0xa6, + 0xaf, 0x95, 0x04, 0xd2, 0xb5, 0x91, 0x0e, 0xa0, 0x06, 0x77, + 0xc5, 0x82, 0xf6, 0xdd, 0x72, 0x83, 0x04, 0xcc, 0xb0, 0xab, + 0x7a, 0xf0, 0xb4, 0x4d, 0x36, 0x71, 0x72, 0x1a, 0x9a, 0x0d, + 0xcd, 0xa3, 0x11, 0xa8, 0x0d, 0x7d, 0x49, 0xce, 0x9c, 0x09, + 0x1d, 0x08, 0xa4, 0x39, 0x2e, 0x03, 0xdf, 0x3a, 0xc8, 0xfe, + 0x6a, 0x2b, 0x0b, 0x07, 0x80, 0x55, 0x8a, 0xa8, 0xe6, 0x0e, + 0xc9, 0x7e, 0x83, 0xce, 0x3a, 0x98, 0x98, 0x4e, 0x3e, 0x08, + 0x20, 0x8f, 0x10, 0xfc, 0xc1, 0xc4, 0xcf, 0x37, 0x8d, 0x69, + 0xd8, 0x57, 0x9d, 0x48, 0x80, 0x6a, 0xef, 0x0c, 0xdd, 0x27, + 0x99, 0xf9, 0xe7, 0xd0, 0xd2, 0x36, 0xd8, 0xed, 0x41, 0x14, + 0x1b, 0x10, +}; +static const int sizeof_bench_dilithium_level3_pubkey = + sizeof(bench_dilithium_level3_pubkey); + +#endif /* !WOLFSSL_DILITHIUM_NO_VERIFY */ + +#ifndef WOLFSSL_DILITHIUM_NO_SIGN + +/* raw private key without ASN1 syntax from + * ./certs/dilithium/bench_dilithium_level5_key.der */ +static const unsigned char bench_dilithium_level5_key[] = { + 0xef, 0x49, 0x79, 0x47, 0x15, 0xc4, 0x8a, 0xa9, 0x74, 0x2a, + 0xf0, 0x36, 0x94, 0x5c, 0x91, 0x1c, 0x5d, 0xff, 0x2c, 0x83, + 0xf2, 0x8b, 0x04, 0xfc, 0x5d, 0x64, 0xbd, 0x49, 0x73, 0xcd, + 0xcc, 0x99, 0xfd, 0x0f, 0x8f, 0x6e, 0xad, 0x75, 0x9b, 0xc9, + 0xb1, 0xb9, 0x90, 0x93, 0xbf, 0xce, 0x02, 0x2d, 0x12, 0x0c, + 0x54, 0x2e, 0xe2, 0x3e, 0x52, 0xff, 0xe0, 0x7a, 0xca, 0x2d, + 0x81, 0x84, 0xea, 0x16, 0x1f, 0x10, 0xc4, 0xc9, 0xde, 0xcd, + 0xf6, 0xbd, 0x60, 0xc9, 0xb3, 0xd0, 0x0f, 0x57, 0xeb, 0x71, + 0x78, 0x9b, 0xb5, 0x72, 0x2a, 0x65, 0x11, 0x14, 0xff, 0x63, + 0x8d, 0x38, 0xcf, 0xa4, 0xf4, 0xad, 0xd0, 0x68, 0x84, 0x97, + 0xfe, 0xd3, 0x91, 0xa0, 0xe4, 0xc3, 0x74, 0xcf, 0x20, 0x87, + 0x89, 0x84, 0x1f, 0x75, 0x91, 0xe3, 0xb3, 0x47, 0x8b, 0xfe, + 0x76, 0xb7, 0x2d, 0x30, 0x89, 0x02, 0x04, 0xc9, 0x93, 0xa8, + 0x31, 0xd3, 0x84, 0x2d, 0xe4, 0x26, 0x12, 0xdb, 0x94, 0x08, + 0x12, 0x45, 0x45, 0xca, 0x44, 0x89, 0x52, 0xc4, 0x28, 0x41, + 0x46, 0x01, 0x1c, 0x93, 0x20, 0x8b, 0x40, 0x6d, 0x09, 0x36, + 0x65, 0x4c, 0xa2, 0x40, 0x62, 0xb8, 0x2c, 0x1b, 0x00, 0x20, + 0x61, 0x42, 0x8c, 0x24, 0xa7, 0x10, 0x19, 0x27, 0x25, 0x22, + 0x14, 0x31, 0x13, 0x33, 0x46, 0x0c, 0x22, 0x22, 0x18, 0xa7, + 0x91, 0x0c, 0x24, 0x61, 0xd9, 0x32, 0x46, 0xc8, 0x96, 0x49, + 0x5c, 0x90, 0x89, 0x9b, 0x84, 0x01, 0x5c, 0x08, 0x42, 0x64, + 0x84, 0x85, 0x0c, 0x42, 0x21, 0x20, 0x48, 0x21, 0x92, 0x00, + 0x28, 0x83, 0x20, 0x4c, 0x08, 0xc7, 0x51, 0x99, 0x06, 0x66, + 0x01, 0x18, 0x51, 0x13, 0x48, 0x0a, 0x0b, 0x42, 0x90, 0x4c, + 0x14, 0x08, 0x83, 0x14, 0x6d, 0x10, 0x10, 0x91, 0xe2, 0xc4, + 0x8d, 0xe1, 0x12, 0x11, 0x10, 0x40, 0x29, 0x99, 0x92, 0x30, + 0x12, 0x39, 0x6c, 0x91, 0x86, 0x68, 0x08, 0x83, 0x0c, 0x54, + 0x80, 0x80, 0xa2, 0x08, 0x52, 0x09, 0x30, 0x71, 0x0c, 0x10, + 0x04, 0x53, 0x00, 0x65, 0x91, 0x12, 0x2d, 0x0c, 0xa2, 0x8c, + 0x18, 0x14, 0x45, 0xd8, 0x14, 0x06, 0xe4, 0x36, 0x72, 0x93, + 0x10, 0x68, 0x09, 0xc2, 0x08, 0x51, 0x14, 0x8c, 0x13, 0x39, + 0x11, 0xd8, 0x44, 0x02, 0x18, 0x39, 0x29, 0x98, 0x16, 0x71, + 0x82, 0x40, 0x70, 0x01, 0x10, 0x8c, 0x1a, 0x30, 0x08, 0x02, + 0x03, 0x41, 0x5a, 0x00, 0x40, 0xa4, 0x16, 0x90, 0x20, 0x26, + 0x32, 0x00, 0x49, 0x61, 0x20, 0x20, 0x0c, 0x1a, 0xb0, 0x10, + 0x63, 0x10, 0x11, 0x58, 0x30, 0x0d, 0x59, 0x80, 0x68, 0x90, + 0x46, 0x2a, 0x91, 0xa8, 0x71, 0x98, 0x20, 0x40, 0x21, 0x83, + 0x6c, 0xc0, 0x48, 0x0d, 0x8b, 0x90, 0x11, 0x08, 0x09, 0x31, + 0x8c, 0x00, 0x12, 0x10, 0x14, 0x6e, 0xc2, 0x06, 0x32, 0x1a, + 0x26, 0x10, 0x0a, 0x91, 0x44, 0x08, 0x99, 0x8d, 0x60, 0x86, + 0x28, 0x11, 0x20, 0x6d, 0xa3, 0x12, 0x81, 0x8b, 0xc6, 0x51, + 0xcb, 0xa0, 0x61, 0x09, 0x97, 0x61, 0x48, 0xb6, 0x0d, 0x21, + 0x49, 0x51, 0x08, 0x13, 0x0c, 0x0a, 0x34, 0x86, 0x49, 0x80, + 0x65, 0x14, 0x39, 0x04, 0x21, 0x01, 0x81, 0x9a, 0xb8, 0x4d, + 0x04, 0x41, 0x48, 0x03, 0x92, 0x81, 0x62, 0x14, 0x6c, 0x10, + 0x16, 0x11, 0xe2, 0xa2, 0x49, 0xe3, 0x30, 0x65, 0x04, 0x93, + 0x8d, 0x1c, 0x33, 0x70, 0x1b, 0x15, 0x50, 0xe4, 0x38, 0x80, + 0x21, 0x37, 0x06, 0x20, 0xc6, 0x24, 0xc8, 0x22, 0x88, 0x4a, + 0x44, 0x80, 0x14, 0x43, 0x88, 0x54, 0x44, 0x42, 0x11, 0x49, + 0x41, 0x19, 0xb9, 0x2d, 0xcc, 0x04, 0x0d, 0x19, 0xc1, 0x65, + 0x5b, 0xa0, 0x11, 0x94, 0x00, 0x84, 0xe4, 0xb6, 0x41, 0xc2, + 0x18, 0x72, 0x5c, 0x02, 0x69, 0x11, 0x85, 0x24, 0x13, 0x35, + 0x00, 0x62, 0x34, 0x04, 0x58, 0x40, 0x21, 0x00, 0xc4, 0x28, + 0x0c, 0x17, 0x30, 0x10, 0x47, 0x60, 0x4b, 0xc2, 0x61, 0x9c, + 0x80, 0x2c, 0x20, 0x94, 0x31, 0x58, 0x92, 0x09, 0xcc, 0x00, + 0x02, 0x42, 0x94, 0x69, 0x99, 0x28, 0x06, 0x98, 0x02, 0x52, + 0x90, 0x32, 0x6e, 0x8a, 0x18, 0x2e, 0x54, 0x94, 0x81, 0x03, + 0xc6, 0x89, 0x03, 0xa1, 0x84, 0x48, 0x82, 0x48, 0x52, 0xc4, + 0x00, 0x91, 0x30, 0x24, 0x20, 0x12, 0x0d, 0x83, 0x80, 0x05, + 0x92, 0x48, 0x61, 0x98, 0x46, 0x92, 0xe1, 0xa6, 0x25, 0x20, + 0x93, 0x4d, 0x1c, 0x37, 0x2c, 0x9b, 0x94, 0x8d, 0xc8, 0x88, + 0x80, 0xa2, 0x18, 0x72, 0x0c, 0x09, 0x70, 0x81, 0x36, 0x90, + 0x24, 0x45, 0x69, 0x53, 0x36, 0x6c, 0xd2, 0x20, 0x51, 0x23, + 0xc1, 0x8c, 0x62, 0xb0, 0x70, 0x11, 0xb2, 0x70, 0xcb, 0x84, + 0x69, 0x4b, 0x32, 0x89, 0x01, 0x21, 0x81, 0x02, 0x38, 0x66, + 0xa3, 0x26, 0x12, 0x24, 0xa3, 0x30, 0x22, 0x24, 0x84, 0x18, + 0xb9, 0x84, 0x40, 0x16, 0x50, 0x22, 0x44, 0x31, 0x1b, 0x13, + 0x8d, 0x53, 0x02, 0x89, 0x4a, 0x22, 0x10, 0x53, 0x18, 0x01, + 0x58, 0x30, 0x2d, 0x00, 0x05, 0x08, 0x13, 0x80, 0x84, 0xc2, + 0x22, 0x0e, 0x88, 0x26, 0x2a, 0x04, 0xc4, 0x4c, 0x19, 0x43, + 0x01, 0xc8, 0x38, 0x4c, 0xd1, 0xb2, 0x90, 0x13, 0x29, 0x10, + 0x12, 0x48, 0x22, 0x01, 0xa8, 0x51, 0xd1, 0x92, 0x40, 0x11, + 0x27, 0x62, 0x10, 0x01, 0x0c, 0x0c, 0xc6, 0x28, 0xe3, 0x46, + 0x60, 0x24, 0x01, 0x8d, 0x14, 0xb6, 0x10, 0x50, 0xb6, 0x25, + 0x44, 0x38, 0x40, 0x44, 0xc2, 0x0c, 0x19, 0xc0, 0x64, 0x9c, + 0x44, 0x02, 0x21, 0x25, 0x65, 0x02, 0x23, 0x86, 0x1a, 0x12, + 0x70, 0x51, 0x24, 0x91, 0x09, 0x08, 0x44, 0x09, 0x35, 0x66, + 0x91, 0x04, 0x12, 0x43, 0x42, 0x8d, 0x22, 0xa0, 0x70, 0x14, + 0x91, 0x25, 0xa0, 0x00, 0x80, 0xe4, 0x00, 0x90, 0x44, 0xb2, + 0x61, 0x14, 0x20, 0x6e, 0xca, 0x14, 0x0d, 0x23, 0x85, 0x68, + 0xda, 0x40, 0x92, 0x0b, 0xb1, 0x20, 0x92, 0x04, 0x46, 0xc0, + 0x08, 0x8a, 0x40, 0xc4, 0x4d, 0x0c, 0x17, 0x45, 0xd3, 0x18, + 0x52, 0x1b, 0x46, 0x24, 0xc2, 0x24, 0x71, 0x83, 0x10, 0x80, + 0xc8, 0x82, 0x68, 0xc2, 0x96, 0x81, 0x0a, 0x01, 0x92, 0x60, + 0xb4, 0x84, 0x09, 0xc6, 0x00, 0x04, 0x37, 0x90, 0x0b, 0xa0, + 0x28, 0x12, 0x27, 0x09, 0x94, 0x80, 0x50, 0xd8, 0x04, 0x86, + 0x08, 0x13, 0x8a, 0x4a, 0x06, 0x89, 0x9b, 0xc4, 0x60, 0xe3, + 0xa2, 0x20, 0xe0, 0x38, 0x21, 0x22, 0xb4, 0x68, 0x0a, 0xa1, + 0x0c, 0x01, 0x24, 0x32, 0x4c, 0x48, 0x30, 0xa2, 0x80, 0x8d, + 0x58, 0x44, 0x10, 0xc8, 0x94, 0x6d, 0x21, 0xc3, 0x61, 0xcb, + 0x98, 0x24, 0xdc, 0x38, 0x11, 0xc9, 0x18, 0x11, 0x20, 0x01, + 0x50, 0x1c, 0x34, 0x8d, 0x02, 0x03, 0x09, 0x0a, 0x40, 0x61, + 0xd4, 0xb8, 0x84, 0x9c, 0xc2, 0x09, 0x04, 0xb1, 0x89, 0x83, + 0x86, 0x84, 0x19, 0x83, 0x0c, 0x5a, 0x86, 0x89, 0x10, 0x21, + 0x0d, 0xd1, 0xc2, 0x80, 0x18, 0x29, 0x2a, 0x0c, 0x01, 0x50, + 0x89, 0x88, 0x48, 0x03, 0xa7, 0x85, 0x21, 0x92, 0x64, 0xc4, + 0x16, 0x81, 0x94, 0x06, 0x6c, 0x53, 0x26, 0x12, 0x90, 0xb6, + 0x21, 0x0b, 0xa8, 0x64, 0x43, 0x96, 0x84, 0x41, 0x88, 0x70, + 0xe3, 0xa6, 0x44, 0x12, 0xc0, 0x09, 0x01, 0xc7, 0x60, 0xc3, + 0x20, 0x42, 0xc3, 0x40, 0x68, 0x10, 0xa6, 0x51, 0xa4, 0xa0, + 0x71, 0x54, 0x98, 0x04, 0x88, 0xb2, 0x00, 0x54, 0x18, 0x6a, + 0x48, 0x98, 0x20, 0x21, 0xb2, 0x8d, 0x82, 0x20, 0x81, 0x99, + 0x16, 0x81, 0x0a, 0xc5, 0x88, 0x0a, 0x23, 0x11, 0x8a, 0x16, + 0x44, 0x24, 0xc9, 0x29, 0x59, 0x08, 0x91, 0x1c, 0x29, 0x05, + 0x14, 0xc9, 0x44, 0xe3, 0x20, 0x10, 0x1b, 0xa1, 0x64, 0x82, + 0xa2, 0x90, 0x00, 0x00, 0x82, 0x98, 0xb2, 0x85, 0xc8, 0x04, + 0x28, 0xc8, 0xb2, 0x65, 0xc9, 0xc6, 0x88, 0xcc, 0x08, 0x91, + 0x84, 0x08, 0x30, 0x94, 0x94, 0x8d, 0xc0, 0x18, 0x46, 0x82, + 0x36, 0x4c, 0x83, 0x10, 0x72, 0x23, 0xb1, 0x88, 0x81, 0x20, + 0x8e, 0x19, 0x03, 0x8a, 0x94, 0x46, 0x22, 0x21, 0x35, 0x8e, + 0x04, 0xc0, 0x88, 0x5b, 0xb6, 0x09, 0x0a, 0x18, 0x44, 0x21, + 0x90, 0x65, 0x03, 0xb2, 0x21, 0xc4, 0x10, 0x50, 0xc1, 0x80, + 0x0c, 0x09, 0x40, 0x49, 0xe4, 0xa8, 0x8c, 0xa4, 0x36, 0x61, + 0x59, 0x12, 0x86, 0x20, 0x08, 0x2d, 0x10, 0x19, 0x85, 0xe4, + 0x34, 0x60, 0xc4, 0xb6, 0x60, 0x00, 0x18, 0x06, 0x8c, 0xb8, + 0x45, 0x19, 0x13, 0x4a, 0x53, 0xc4, 0x40, 0xc9, 0x38, 0x71, + 0xd9, 0x48, 0x10, 0x59, 0x08, 0x02, 0x02, 0x10, 0x69, 0x53, + 0x28, 0x80, 0x22, 0x81, 0x4c, 0xc9, 0x16, 0x26, 0xa1, 0x48, + 0x64, 0x19, 0x21, 0x11, 0x1c, 0x37, 0x88, 0x4b, 0x94, 0x2c, + 0x48, 0xc8, 0x6c, 0x63, 0x88, 0x65, 0x81, 0x40, 0x61, 0xa1, + 0x44, 0x31, 0x82, 0x18, 0x08, 0x80, 0x00, 0x26, 0x50, 0x14, + 0x49, 0xa1, 0x32, 0x50, 0x02, 0xc8, 0x45, 0x0c, 0x07, 0x24, + 0x13, 0x01, 0x6d, 0x0a, 0xb3, 0x90, 0x64, 0x30, 0x85, 0x21, + 0x09, 0x61, 0x44, 0x44, 0x72, 0x08, 0x32, 0x06, 0xe1, 0xa2, + 0x21, 0xdb, 0xa4, 0x09, 0x5a, 0xb4, 0x71, 0x43, 0xb2, 0x09, + 0x82, 0xc4, 0x64, 0x88, 0xa0, 0x91, 0xca, 0x14, 0x90, 0xa4, + 0xa8, 0x41, 0xc1, 0x38, 0x85, 0x12, 0x32, 0x60, 0x1a, 0x11, + 0x72, 0x53, 0x32, 0x2c, 0xe3, 0x08, 0x4d, 0x24, 0xc6, 0x28, + 0x0a, 0x03, 0x8c, 0x88, 0x06, 0x05, 0xa0, 0xa8, 0x05, 0x84, + 0xa2, 0x4c, 0x80, 0x40, 0x62, 0xda, 0x24, 0x81, 0x9a, 0x16, + 0x91, 0x24, 0x81, 0x04, 0xa4, 0x46, 0x51, 0xc2, 0xa8, 0x25, + 0x20, 0x28, 0x42, 0x13, 0x46, 0x2c, 0x63, 0x42, 0x72, 0x03, + 0x88, 0x28, 0xa3, 0x22, 0x24, 0x1a, 0x02, 0x26, 0x42, 0xa2, + 0x11, 0x11, 0xb0, 0x51, 0x92, 0xb4, 0x6c, 0xe2, 0x32, 0x85, + 0x10, 0xc2, 0x41, 0xc1, 0x40, 0x46, 0x4c, 0x26, 0x01, 0x1c, + 0x35, 0x02, 0x0c, 0x14, 0x0c, 0x18, 0x81, 0x00, 0x10, 0x26, + 0x02, 0xc8, 0x32, 0x8c, 0xe4, 0x02, 0x68, 0xcc, 0x14, 0x2e, + 0x89, 0x38, 0x60, 0x10, 0x12, 0x24, 0x93, 0x42, 0x65, 0xe3, + 0x24, 0x29, 0x08, 0x80, 0x41, 0x09, 0x29, 0x46, 0x5b, 0x26, + 0x49, 0x5b, 0x30, 0x80, 0x03, 0xc1, 0x2c, 0x04, 0x09, 0x82, + 0x4c, 0x48, 0x2d, 0x1c, 0x36, 0x4d, 0xdb, 0x02, 0x86, 0x21, + 0xb5, 0x51, 0x81, 0x80, 0x2d, 0xcb, 0x20, 0x81, 0x5b, 0x34, + 0x41, 0x89, 0x36, 0x48, 0x44, 0xa0, 0x05, 0x59, 0xb6, 0x64, + 0x12, 0x45, 0x21, 0x20, 0x31, 0x51, 0x0a, 0xc3, 0x8c, 0x14, + 0x48, 0x71, 0x18, 0x35, 0x24, 0x20, 0x45, 0x05, 0x88, 0x20, + 0x09, 0x08, 0xb1, 0x29, 0x18, 0xa0, 0x09, 0x4a, 0x00, 0x8a, + 0xe2, 0xb8, 0x45, 0x02, 0x27, 0x89, 0xd8, 0x10, 0x25, 0x51, + 0x82, 0x8c, 0x13, 0x92, 0x30, 0x1c, 0x24, 0x8e, 0x1c, 0x93, + 0x4d, 0xa3, 0x48, 0x51, 0x93, 0xa8, 0x69, 0xe2, 0x04, 0x89, + 0x13, 0x13, 0x61, 0xcb, 0x98, 0x8c, 0x09, 0x21, 0x62, 0x4b, + 0x14, 0x4e, 0x11, 0xa3, 0x09, 0x98, 0x40, 0x42, 0x91, 0x12, + 0x08, 0x80, 0x84, 0x2d, 0xc0, 0x12, 0x60, 0x03, 0xa4, 0x29, + 0x18, 0x80, 0x01, 0x94, 0x44, 0x8a, 0x12, 0x11, 0x72, 0xc4, + 0x22, 0x32, 0x9a, 0x46, 0x88, 0x1b, 0x16, 0x4d, 0x4b, 0x08, + 0x11, 0x02, 0x48, 0x45, 0x81, 0xa4, 0x64, 0xe1, 0x88, 0x0c, + 0x63, 0x10, 0x70, 0x48, 0x98, 0x05, 0x9b, 0xb8, 0x84, 0x03, + 0x14, 0x05, 0x44, 0x86, 0x0c, 0x20, 0x11, 0x68, 0xbe, 0x71, + 0x83, 0xc2, 0x69, 0xde, 0x49, 0xad, 0xb4, 0xdb, 0x93, 0xcb, + 0x20, 0x2b, 0xbd, 0x95, 0x97, 0x57, 0x7e, 0xcb, 0xbc, 0x73, + 0xb6, 0x3d, 0x16, 0x4a, 0x0e, 0xe4, 0x9c, 0x81, 0xb1, 0x5d, + 0x27, 0x64, 0xa2, 0x14, 0x12, 0x1b, 0x8e, 0xd0, 0xd8, 0x38, + 0xf6, 0xc7, 0xbb, 0x9f, 0x77, 0x3c, 0x62, 0x04, 0x92, 0xe1, + 0x97, 0xaf, 0x24, 0xa7, 0xf9, 0xf0, 0x8d, 0x3a, 0xbf, 0x5d, + 0xab, 0x5c, 0x97, 0x0f, 0xfc, 0x35, 0xbc, 0x62, 0xd8, 0x42, + 0xfd, 0xc7, 0x8b, 0xf7, 0x80, 0xd1, 0x38, 0x68, 0x14, 0x5e, + 0x4f, 0x99, 0x31, 0xc7, 0xaf, 0xbd, 0x27, 0xce, 0x1c, 0x5b, + 0x09, 0x1b, 0xcf, 0xbb, 0xfb, 0xf9, 0xf4, 0x90, 0x4c, 0xc1, + 0xa2, 0x12, 0xf9, 0xd0, 0xa5, 0x2c, 0xfd, 0x7b, 0x55, 0xb0, + 0xb1, 0xc6, 0x42, 0xe6, 0xeb, 0x10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f, 0x4d, + 0x3c, 0x98, 0xba, 0xd7, 0x98, 0x99, 0xa7, 0x22, 0x14, 0xd7, + 0x94, 0xb5, 0xb8, 0xa4, 0x52, 0x31, 0xa7, 0xa1, 0xa4, 0x28, + 0xee, 0x31, 0xb5, 0xd0, 0xc1, 0x07, 0x05, 0x16, 0x1d, 0x53, + 0x45, 0x62, 0x23, 0x05, 0x44, 0xb6, 0x4f, 0x92, 0x03, 0x53, + 0x9a, 0x71, 0x56, 0xae, 0x16, 0x81, 0xb4, 0xc9, 0x98, 0xf4, + 0x7f, 0x11, 0x37, 0xc2, 0xc8, 0xf2, 0xe4, 0x48, 0xe3, 0xcc, + 0xf1, 0xe3, 0x3d, 0x8e, 0x13, 0x5b, 0x25, 0xad, 0xce, 0x6f, + 0xed, 0x60, 0x4f, 0x7d, 0x51, 0xe1, 0xd0, 0x74, 0xf4, 0xed, + 0xf3, 0x84, 0xa6, 0x0e, 0xba, 0xb4, 0x8e, 0x5a, 0xb9, 0x12, + 0x70, 0x43, 0x4c, 0xb5, 0xa5, 0x1e, 0x86, 0xa5, 0xe3, 0x4d, + 0x76, 0x95, 0xce, 0x2c, 0x53, 0x3a, 0x4e, 0x3f, 0x47, 0x73, + 0x85, 0x88, 0xd9, 0x39, 0x21, 0x83, 0x24, 0x68, 0x6a, 0x1e, + 0x77, 0xdf, 0x59, 0xc5, 0x1b, 0xe2, 0xb1, 0x47, 0x9d, 0xee, + 0x45, 0x1e, 0xc6, 0xd4, 0x43, 0xe2, 0xc7, 0x1c, 0x98, 0x84, + 0xe0, 0x39, 0xe9, 0x9f, 0xa0, 0xa2, 0x24, 0x4a, 0x88, 0x46, + 0xf3, 0x50, 0x52, 0xb5, 0xae, 0x37, 0x5c, 0xa1, 0x7d, 0xad, + 0x7c, 0x30, 0x3e, 0xcd, 0x80, 0x1c, 0xac, 0xf4, 0xe6, 0xb5, + 0x9f, 0x22, 0xb6, 0xfb, 0x0e, 0x6d, 0x80, 0x10, 0xf7, 0x3f, + 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0x04, 0x05, 0x02, 0x5a, + 0x16, 0x67, 0x5a, 0xc5, 0xea, 0xac, 0x25, 0x61, 0xd4, 0xa4, + 0xe7, 0xbe, 0x13, 0x95, 0xbd, 0x03, 0xb4, 0x26, 0xe3, 0xbf, + 0x7e, 0xe5, 0x0b, 0x34, 0xeb, 0x59, 0x5d, 0xd7, 0xdb, 0x1e, + 0x07, 0xfc, 0x63, 0xab, 0xbb, 0xc6, 0x7a, 0x51, 0x50, 0x59, + 0x13, 0x4b, 0x27, 0x88, 0x98, 0xdc, 0x01, 0x37, 0xeb, 0x58, + 0x75, 0xde, 0x5a, 0xa4, 0x6b, 0xdd, 0xba, 0x01, 0x40, 0xf7, + 0x1c, 0x0a, 0xf3, 0x02, 0x3d, 0x54, 0x64, 0xf2, 0x85, 0x43, + 0x90, 0xc0, 0x69, 0x18, 0x94, 0x95, 0x6e, 0x57, 0x14, 0xda, + 0x27, 0x0a, 0x42, 0xb2, 0x5a, 0x78, 0xe4, 0xf1, 0x45, 0x85, + 0x54, 0xec, 0x44, 0xa0, 0xcb, 0xf4, 0xd1, 0x3a, 0x85, 0x74, + 0x0f, 0x04, 0x67, 0xf4, 0x42, 0x01, 0xc4, 0x04, 0x66, 0x48, + 0x6c, 0xbe, 0x84, 0x38, 0x6e, 0xda, 0x23, 0xd0, 0xd1, 0x26, + 0x94, 0x11, 0x65, 0x2e, 0xc6, 0xd8, 0x6e, 0x25, 0x17, 0x43, + 0x9f, 0x55, 0x2d, 0x1d, 0x55, 0xa9, 0xdd, 0x3b, 0xc7, 0x09, + 0xde, 0x26, 0x64, 0xd4, 0x85, 0x21, 0x15, 0x0d, 0x4a, 0x45, + 0x4d, 0xba, 0x13, 0x9e, 0x3b, 0x5e, 0xc2, 0xf7, 0xc1, 0x34, + 0xc5, 0x74, 0xd4, 0x95, 0x19, 0x3d, 0x69, 0x9c, 0xae, 0xef, + 0x13, 0x95, 0x2c, 0x77, 0xdd, 0x64, 0x2c, 0x12, 0x31, 0x7d, + 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, 0x5a, 0x4f, 0x5c, 0x89, 0x26, 0xb6, + 0x6c, 0xde, 0x0d, 0x15, 0x31, 0xec, 0x7e, 0x13, 0xf2, 0x99, + 0x74, 0x40, 0x3c, 0xe1, 0xea, 0xa0, 0xc9, 0x99, 0x0a, 0x4b, + 0x17, 0x74, 0xff, 0x47, 0x15, 0x76, 0x5e, 0x44, 0xa2, 0x1c, + 0x93, 0xd3, 0xe6, 0xa2, 0x82, 0x0f, 0x7f, 0x55, 0xa8, 0xf3, + 0x79, 0xc3, 0xa8, 0x9f, 0x37, 0x2b, 0x97, 0x7e, 0x90, 0x71, + 0xfc, 0xa7, 0xff, 0xc6, 0xc7, 0x93, 0x5c, 0xc9, 0xed, 0x20, + 0x60, 0xbd, 0x5c, 0x36, 0x05, 0x55, 0x51, 0x55, 0x51, 0x15, + 0x36, 0x01, 0x17, 0xa9, 0x56, 0x27, 0x44, 0x66, 0xc9, 0x3a, + 0xb9, 0xbb, 0xee, 0x04, 0xb6, 0x2a, 0xfd, 0x10, 0x9a, 0x46, + 0xdd, 0x5d, 0x6d, 0xad, 0x21, 0x86, 0x6d, 0x62, 0x8a, 0x4a, + 0xbc, 0x73, 0xf0, 0x9d, 0x93, 0x0d, 0xf1, 0x62, 0xfa, 0x58, + 0x64, 0x37, 0x4f, 0x0b, 0xa3, 0xa1, 0x52, 0xce, 0x03, 0xce, + 0x0f, 0x77, 0x29, 0xad, 0x47, 0x38, 0xca, 0xbc, 0x61, 0xe6, + 0xad, 0xe4, 0x8b, 0xf1, 0x82, 0xa8, 0xd5, 0xe3, 0x8c, 0xd3, + 0xa0, 0xc4, 0xc0, 0x5e, 0x3b, 0xa1, 0x66, 0x2a, 0x6e, 0x88, + 0x24, 0x56, 0xe4, 0x84, 0x0a, 0x36, 0x72, 0xf3, 0x5c, 0x11, + 0xd9, 0x66, 0xd8, 0x45, 0x5c, 0x83, 0x9e, 0x1c, 0x8c, 0xc6, + 0xf6, 0x6e, 0x6a, 0xb1, 0x52, 0xed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0xe2, 0xee, 0x73, + 0x39, 0x66, 0xd1, 0x51, 0x87, 0xac, 0x90, 0x9b, 0x2c, 0x6d, + 0x8d, 0xd5, 0x75, 0x3f, 0xc6, 0xf1, 0x8f, 0xdf, 0xdb, 0x45, + 0x38, 0xf8, 0xd6, 0x7e, 0xc7, 0x7c, 0x44, 0x08, 0x4a, 0x14, + 0xa0, 0x84, 0x7c, 0x8b, 0x88, 0x40, 0x93, 0x89, 0xae, 0x2c, + 0x20, 0x07, 0x80, 0xec, 0xce, 0x4c, 0x2c, 0x4e, 0x49, 0x79, + 0x53, 0xe7, 0xde, 0xa2, 0x9e, 0x67, 0x21, 0x53, 0x7c, 0x85, + 0xe7, 0x6f, 0xbd, 0x93, 0xab, 0x63, 0xba, 0xf0, 0xbd, 0xea, + 0x39, 0x16, 0x47, 0xbf, 0xe6, 0x0c, 0xcb, 0x63, 0xc7, 0xc5, + 0xf1, 0xdc, 0x5a, 0x52, 0xcd, 0x4c, 0x53, 0x8b, 0x7e, 0xb1, + 0xc3, 0x4e, 0xe7, 0x61, 0x25, 0x01, 0xec, 0xae, 0x06, 0x74, + 0x9f, 0xbc, 0xbb, 0x2a, 0x47, 0x46, 0xe8, 0xae, 0xf2, 0xab, + 0x15, 0xed, 0xa6, 0x86, 0x8f, 0x2f, 0xe5, 0x67, 0x0f, 0xdd, + 0xbf, 0x70, 0x53, 0xaa, 0x9b, 0x74, +}; +static const int sizeof_bench_dilithium_level5_key = sizeof(bench_dilithium_level5_key); + +#endif /* !WOLFSSL_DILITHIUM_NO_SIGN */ + +#ifndef WOLFSSL_DILITHIUM_NO_VERIFY + +/* raw public key without ASN1 syntax from + * ./certs/dilithium/bench_dilithium_level5_key.der */ +static const unsigned char bench_dilithium_level5_pubkey[] = { + 0xef, 0x49, 0x79, 0x47, 0x15, 0xc4, 0x8a, 0xa9, 0x74, 0x2a, + 0xf0, 0x36, 0x94, 0x5c, 0x91, 0x1c, 0x5d, 0xff, 0x2c, 0x83, + 0xf2, 0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0c, 0x0b, 0xc8, 0x52, 0xe5, 0x04, 0x02, 0x9a, + 0x00, 0x7e, 0xec, 0x7e, 0x94, 0xaa, 0xef, 0x2d, 0x7f, 0xb6, + 0x2e, 0x7c, 0xb0, 0x73, 0xa2, 0x20, 0xc0, 0x07, 0x30, 0x41, + 0x50, 0x20, 0x14, 0x18, 0x21, 0x5e, 0x2a, 0x6f, 0x70, 0x21, + 0xd6, 0x97, 0x13, 0xb9, 0xc1, 0x9e, 0x90, 0x67, 0xcc, 0x55, + 0x8a, 0xec, 0xec, 0x0a, 0x1e, 0x90, 0xdc, 0x3f, 0xb0, 0x4d, + 0xd1, 0x18, 0xea, 0x4f, 0xcb, 0x5d, 0x15, 0x4c, 0xb8, 0x35, + 0x9b, 0x34, 0x24, 0x30, 0x06, 0x53, 0x17, 0xf0, 0xbe, 0x27, + 0x36, 0xb3, 0x04, 0x6a, 0xbd, 0xbf, 0xa7, 0x39, 0xee, 0xa9, + 0x8f, 0x0e, 0x98, 0xc5, 0xf5, 0x9f, 0x46, 0x25, 0x93, 0xc9, + 0xf2, 0xf6, 0x2b, 0x8e, 0x92, 0x06, 0x01, 0x3d, 0x81, 0x18, + 0xf2, 0xec, 0xf1, 0x05, 0x4c, 0xad, 0x4b, 0xcb, 0x98, 0xa4, + 0xb5, 0x61, 0x20, 0xda, 0x81, 0xa1, 0xfb, 0x92, 0x4c, 0xaf, + 0x87, 0x6f, 0x6e, 0xd2, 0x57, 0xec, 0xcd, 0x94, 0xb3, 0x79, + 0xbf, 0x59, 0x88, 0x17, 0x81, 0xce, 0x8a, 0x57, 0xce, 0x57, + 0xae, 0x3e, 0x82, 0x81, 0x2f, 0x83, 0x61, 0xd8, 0xf9, 0x68, + 0x21, 0xe7, 0x72, 0x5b, 0xd6, 0x80, 0x55, 0x68, 0x5d, 0x67, + 0x15, 0x0c, 0x8b, 0xdc, 0x4f, 0xc3, 0x89, 0x36, 0x3c, 0xac, + 0xaf, 0x16, 0x5e, 0x1c, 0xfa, 0x68, 0x74, 0x6a, 0xab, 0x68, + 0xd8, 0x59, 0x96, 0x2d, 0x33, 0x62, 0xe4, 0xbd, 0xb3, 0xb7, + 0x4d, 0x88, 0x35, 0xb8, 0xed, 0xb2, 0x16, 0x85, 0x97, 0x08, + 0x71, 0x71, 0x39, 0x7e, 0x0c, 0x53, 0x16, 0xda, 0x38, 0xe5, + 0x28, 0x09, 0x9c, 0xd9, 0x46, 0xec, 0x68, 0xda, 0x8d, 0xd0, + 0xad, 0xb2, 0x79, 0x28, 0x3b, 0x1e, 0x12, 0xc9, 0xdf, 0xa9, + 0x6d, 0x3d, 0x29, 0x99, 0x2f, 0x53, 0xc2, 0xd0, 0xf9, 0x88, + 0x26, 0x94, 0x47, 0xaf, 0xf6, 0x96, 0xf3, 0xe1, 0x11, 0xa6, + 0x82, 0x3d, 0x43, 0x3f, 0x1f, 0xbc, 0xf6, 0x98, 0xbe, 0xff, + 0x06, 0x86, 0x61, 0x27, 0xdc, 0x91, 0x54, 0xd4, 0xfc, 0x68, + 0x83, 0xe8, 0x35, 0x3e, 0xee, 0x94, 0x59, 0x28, 0x2f, 0xde, + 0xdd, 0x03, 0x60, 0x66, 0xc1, 0x49, 0x57, 0xdd, 0xbc, 0xd5, + 0x0a, 0x67, 0x34, 0xf1, 0xa6, 0x0a, 0x57, 0x94, 0x65, 0x02, + 0x2c, 0x52, 0x43, 0x70, 0x3b, 0xc1, 0x9a, 0xff, 0xda, 0x6f, + 0xb9, 0x54, 0x47, 0x01, 0xda, 0x27, 0xe4, 0x48, 0x4a, 0x90, + 0x9f, 0xb5, 0xc3, 0xee, 0x0e, 0x09, 0x57, 0xfe, 0x48, 0x51, + 0x08, 0x34, 0x5e, 0x8f, 0x16, 0xc9, 0x0b, 0x74, 0xd9, 0x7d, + 0x22, 0x3f, 0xd6, 0xb7, 0x5d, 0xd6, 0x76, 0x00, 0x8d, 0x4e, + 0x78, 0x73, 0x86, 0xd6, 0xdb, 0x2a, 0x65, 0xab, 0xdf, 0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x35, 0x7a, 0x27, 0x7e, 0xfe, 0xf1, 0x6f, 0x59, 0x27, 0x35, + 0x73, 0xce, 0x74, 0xaa, 0xb4, 0x72, 0x82, 0xa8, 0xe2, 0x81, + 0x7a, 0x6b, 0xca, 0x33, 0xa5, 0xda, 0xa2, 0x63, 0xca, 0x2e, + 0x90, 0x03, 0x32, 0xec, 0x63, 0xdb, 0x52, 0x7b, 0x16, 0xfc, + 0x01, 0x2d, 0x30, 0x12, 0x1e, 0xf9, 0xa3, 0x72, 0x21, 0x3c, + 0x75, 0x0c, 0x61, 0x9c, 0x7e, 0x73, 0x04, 0x71, 0x41, 0x45, + 0x5d, 0x7f, 0x49, 0x1c, 0x09, 0x08, 0xa4, 0xec, 0x2f, 0xfd, + 0xc4, 0xfb, 0x59, 0x6a, 0x27, 0x7a, 0xd4, 0xfc, 0x5f, 0x20, + 0x04, 0x34, 0x7d, 0x08, 0xed, 0x82, 0x5a, 0x90, 0xe1, 0xab, + 0xfd, 0x35, 0x3a, 0x8d, 0xbb, 0x0a, 0x9d, 0x73, 0xff, 0x69, + 0xe5, 0xe9, 0x09, 0x55, 0x14, 0xd9, 0x7b, 0x6f, 0x0d, 0x99, + 0xd2, 0x7e, 0x71, 0xf8, 0x4f, 0x72, 0x2f, 0xbb, 0xc6, 0xc4, + 0x36, 0xc9, 0x01, 0xd3, 0x9b, 0x94, 0xab, 0x41, 0x0f, 0x4a, + 0x61, 0x5c, 0x68, 0xe5, 0xd7, 0x0d, 0x94, 0xaa, 0xee, 0xba, + 0x95, 0xcb, 0x8c, 0x0e, 0x85, 0x3a, 0x02, 0x6b, 0x95, 0x50, + 0xfd, 0x02, 0xfd, 0xa4, 0x58, 0x29, 0x78, 0x4f, 0xd0, 0xae, + 0x66, 0xd6, 0x5c, 0xe7, 0x45, 0xfe, 0x98, 0xb0, 0xa3, 0xe2, + 0x87, 0xc0, 0xd2, 0x81, 0x08, 0xf1, 0xf1, 0xe7, 0xda, 0x62, + 0x9e, 0xa0, 0x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a, 0x5d, 0x24, 0xdc, 0xe1, 0x55, 0x72, + 0xcf, 0xce, 0x3e, 0xc8, 0xd0, 0x57, 0x8a, 0x82, 0x5e, 0x78, + 0x2b, 0x80, 0xc5, 0xb9, 0x09, 0x46, 0xf8, 0x90, 0x39, 0x52, + 0xa9, 0xce, 0x3f, 0x3d, 0x41, 0x3b, 0x28, 0x45, 0xa3, 0xb3, + 0x21, 0xc2, 0xcd, 0x14, 0x49, 0x41, 0x6c, 0x38, 0xda, 0x1b, + 0x5f, 0x16, 0x49, 0xf9, 0x65, 0x00, 0x4e, 0xb4, 0x20, 0x55, + 0x70, 0xe8, 0x58, 0x1a, 0x18, 0xbf, 0x41, 0xef, 0x31, 0xb1, + 0xe7, 0x8d, 0x89, 0xc1, 0x48, 0xe8, 0xf5, 0x57, 0x35, 0xfa, + 0xc1, 0x79, 0xee, 0x2c, 0xe8, 0x7d, 0xb6, 0x03, 0xcc, 0x66, + 0x09, 0x6f, 0x52, 0x84, 0x0a, 0x34, 0x18, 0x2c, 0x01, 0x45, + 0x81, 0x00, 0xe5, 0x5e, 0x8d, 0xae, 0x1c, 0x96, 0x8b, 0x45, + 0x73, 0x00, 0x0a, 0xb5, 0xcf, 0x8d, 0x0e, 0x35, 0x5d, 0x1a, + 0x0e, 0xbf, 0x64, 0x9a, 0x52, 0x20, 0x48, 0xc6, 0xb9, 0x40, + 0xd3, 0x2c, 0x52, 0xca, 0x93, 0xcf, 0xbb, 0x94, 0x06, 0xf3, + 0x97, 0xee, 0xcc, 0x5d, 0xa3, 0xea, 0xf8, 0x5a, 0x39, 0x77, + 0x34, 0xd7, 0xf6, 0x4e, 0xbe, 0x8a, 0x07, 0x5f, 0x51, 0x53, + 0xc5, 0x1b, 0x8c, 0x47, 0x8f, 0x34, 0x0e, 0x60, 0x0a, 0x90, + 0xe2, 0xda, 0x7b, 0xef, 0xd6, 0xf5, 0x5d, 0xe5, 0x32, 0x37, + 0x75, 0x99, 0x81, 0x4a, 0x2a, 0x78, 0x71, 0xdc, 0xf4, 0xe5, + 0xca, 0xd8, 0x6b, 0x3b, 0x90, 0x68, 0x2e, 0x93, 0xc5, 0x10, + 0x42, 0x5d, 0x38, 0x90, 0x32, 0x46, 0xea, 0x87, 0xe0, 0xbc, + 0xb8, 0x9a, 0x18, 0x20, 0x68, 0x85, 0x6d, 0x9b, 0xc9, 0x8f, + 0x9b, 0xd2, 0xbe, 0x15, 0x12, 0x68, 0xd0, 0xb0, 0x16, 0x5f, + 0xe2, 0x69, 0x1d, 0x04, 0x00, 0xfc, 0x63, 0x33, 0xcd, 0x1f, + 0x89, 0xcd, 0x52, 0xff, 0xec, 0x19, 0x69, 0x74, 0xa3, 0xce, + 0x4d, 0xab, 0x93, 0xe4, 0xc6, 0x13, 0x56, 0x27, 0xc9, 0x25, + 0x5a, 0x01, 0xb2, 0x36, 0x8b, 0x61, 0xe5, 0x8b, 0x98, 0xac, + 0xe4, 0x2a, 0xb6, 0x40, 0x9f, 0x42, 0xe4, 0x1b, 0x52, 0xf7, + 0xfd, 0xd8, 0x30, 0x07, 0x33, 0xf9, 0x47, 0xcb, 0x3c, 0xad, + 0x12, 0xc1, 0xcc, 0x29, 0x62, 0x49, 0x04, 0x0c, 0x23, 0x97, + 0x5a, 0xa4, 0x84, 0x67, 0xde, 0x5a, 0xe5, 0x36, 0xd2, 0x88, + 0xf1, 0xd4, 0xeb, 0x13, 0x81, 0x54, 0x51, 0x11, 0xe3, 0xba, + 0xbc, 0xee, 0xdd, 0x6c, 0xcd, 0xe6, 0xb4, 0xa1, 0x8b, 0x0b, + 0x66, 0xfb, 0x8e, 0x50, 0xa0, 0xda, 0x69, 0x8d, 0xcc, 0x2d, + 0xe4, 0x2c, 0xc4, 0x37, 0xdf, 0x61, 0xc0, 0x03, 0xbd, 0x8b, + 0x28, 0xca, 0xd2, 0x8c, 0x1c, 0xf1, 0xa4, 0x26, 0x69, 0xe5, + 0xcf, 0x45, 0xdb, 0x5a, 0x47, 0x79, 0xed, 0x9f, 0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, 0x14, 0xcd, + 0x26, 0x71, 0xb1, 0xe7, 0xaa, 0x14, 0xa7, 0x46, 0x93, 0xd3, + 0x5c, 0x8c, 0x1a, 0x91, 0x77, 0x46, 0x2e, 0x15, 0xaa, 0x9e, + 0xf7, 0x2b, 0x79, 0x41, 0x76, 0xf7, 0x22, 0x53, 0x7d, 0x51, + 0xdb, 0x98, 0x3d, 0x5b, 0x78, 0x5f, 0xc3, 0xc9, 0x29, 0xa3, + 0xff, 0x75, 0x82, 0x06, 0x9a, 0x16, 0x5e, 0xa4, 0x79, 0x0d, + 0xd1, 0x6d, 0x08, 0xff, 0x43, 0xef, 0x9c, 0xf3, 0x1b, 0x7a, + 0x3f, 0x34, 0xbe, 0x19, 0x15, 0x06, 0x33, 0xdb, 0xa5, 0x71, + 0xcb, 0x5f, 0x6b, 0x8d, 0xbd, 0x5b, 0x32, 0x91, 0xb2, 0x37, + 0x3d, 0xb4, 0x40, 0x9e, 0x02, 0x9b, 0xb7, 0x68, 0x20, 0x58, + 0x5c, 0xab, 0xcb, 0xc8, 0x23, 0x2d, 0x77, 0xcc, 0x0b, 0xf6, + 0x78, 0x6b, 0x80, 0x06, 0x91, 0xa9, 0xfd, 0x7e, 0xfa, 0x25, + 0x98, 0x9f, 0xcc, 0x79, 0x0a, 0x1a, 0x54, 0x83, 0xac, 0x64, + 0x16, 0x90, 0xe5, 0xd9, 0xa7, 0xd7, 0x1b, 0x86, 0x0d, 0xe6, + 0xe6, 0x22, 0x2b, 0x1f, 0x44, 0x49, 0x98, 0x9c, 0x51, 0x6f, + 0xcf, 0x58, 0x4a, 0xfa, 0xfa, 0x84, 0x12, 0xa5, 0x10, 0xf4, + 0xca, 0xf0, 0x98, 0x2b, 0xc9, 0x03, 0x71, 0x37, 0xe7, 0xdc, + 0xc2, 0xb1, 0x4e, 0x64, 0xde, 0x4f, 0x46, 0x0d, 0x6b, 0x25, + 0x88, 0x5d, 0xd6, 0xff, 0x23, 0x46, 0x57, 0x36, 0x14, 0x18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+ 0xe7, 0x56, 0xa8, 0xb4, 0x93, 0x3c, 0xd5, 0x98, 0x9f, 0x61, + 0x2e, 0xfa, 0xcb, 0x5f, 0x5b, 0xd8, 0x09, 0x83, 0xe9, 0x40, + 0xe9, 0x0e, 0x42, 0xdd, 0x17, 0xd7, 0x6e, 0x19, 0x8d, 0x95, + 0x0a, 0x93, +}; +static const int sizeof_bench_dilithium_level5_pubkey = + sizeof(bench_dilithium_level5_pubkey); + +#endif /* !WOLFSSL_DILITHIUM_NO_VERIFY */ + +#endif /* HAVE_DILITHIUM */ + +#if defined(HAVE_SPHINCS) + +/* certs/sphincs/bench_sphincs_fast_level1_key.der */ +static const unsigned char bench_sphincs_fast_level1_key[] = +{ + 0x30, 0x71, 0x02, 0x01, 0x00, 0x30, 0x08, 0x06, 0x06, 0x2B, + 0xCE, 0x0F, 0x06, 0x07, 0x0D, 0x04, 0x62, 0x04, 0x60, 0xD8, + 0xC4, 0x6E, 0x8D, 0x3B, 0xB7, 0xE7, 0x48, 0x8D, 0x6F, 0x0C, + 0x3D, 0xDF, 0xAB, 0x79, 0xB6, 0x62, 0xAE, 0x89, 0x19, 0x6F, + 0x5E, 0xF9, 0xD3, 0x3A, 0x69, 0xBA, 0xFF, 0x4C, 0x46, 0xDE, + 0xAA, 0x7C, 0x40, 0x79, 0x8C, 0xE1, 0xE5, 0x30, 0xE6, 0xDF, + 0x4E, 0x23, 0x5E, 0x14, 0xDB, 0x0A, 0x48, 0x4E, 0xF6, 0x57, + 0xCE, 0x45, 0x8F, 0x8B, 0x1D, 0x68, 0x63, 0xAA, 0x24, 0xA4, + 0xE1, 0x0D, 0xFB, 0x7C, 0x40, 0x79, 0x8C, 0xE1, 0xE5, 0x30, + 0xE6, 0xDF, 0x4E, 0x23, 0x5E, 0x14, 0xDB, 0x0A, 0x48, 0x4E, + 0xF6, 0x57, 0xCE, 0x45, 0x8F, 0x8B, 0x1D, 0x68, 0x63, 0xAA, + 0x24, 0xA4, 0xE1, 0x0D, 0xFB +}; +static const int sizeof_bench_sphincs_fast_level1_key = sizeof(bench_sphincs_fast_level1_key); + +/* certs/sphincs/bench_sphincs_fast_level3_key.der */ +static const unsigned char bench_sphincs_fast_level3_key[] = +{ + 0x30, 0x81, 0xA3, 0x02, 0x01, 0x00, 0x30, 0x08, 0x06, 0x06, + 0x2B, 0xCE, 0x0F, 0x06, 0x08, 0x0A, 0x04, 0x81, 0x93, 0x04, + 0x81, 0x90, 0xB2, 0x3A, 0x67, 0xA6, 0x4B, 0x8E, 0xB9, 0xEF, + 0xAD, 0x99, 0xE4, 0x3D, 0x65, 0xE8, 0xEE, 0xCF, 0xAC, 0xCF, + 0x2F, 0xDE, 0xBC, 0x11, 0x67, 0x8D, 0x8F, 0x8D, 0x3E, 0x99, + 0x31, 0x67, 0xED, 0x31, 0x6A, 0x05, 0x47, 0xC1, 0xDA, 0xC5, + 0x14, 0x17, 0xA1, 0x93, 0x83, 0x44, 0x58, 0x09, 0x80, 0x3A, + 0x47, 0x67, 0x42, 0x6D, 0x4C, 0xB7, 0xC8, 0x7D, 0x37, 0xF3, + 0x90, 0xF7, 0x46, 0x92, 0xB6, 0x26, 0xF7, 0x4E, 0x0D, 0x8D, + 0xB8, 0xCA, 0x8B, 0xA8, 0x20, 0x5D, 0x67, 0x85, 0xD2, 0x83, + 0x2C, 0x2A, 0x38, 0x1F, 0x57, 0x89, 0x76, 0x8C, 0x6D, 0x88, + 0xCE, 0x18, 0x4F, 0xA7, 0x88, 0x48, 0x7C, 0x0D, 0x47, 0x67, + 0x42, 0x6D, 0x4C, 0xB7, 0xC8, 0x7D, 0x37, 0xF3, 0x90, 0xF7, + 0x46, 0x92, 0xB6, 0x26, 0xF7, 0x4E, 0x0D, 0x8D, 0xB8, 0xCA, + 0x8B, 0xA8, 0x20, 0x5D, 0x67, 0x85, 0xD2, 0x83, 0x2C, 0x2A, + 0x38, 0x1F, 0x57, 0x89, 0x76, 0x8C, 0x6D, 0x88, 0xCE, 0x18, + 0x4F, 0xA7, 0x88, 0x48, 0x7C, 0x0D +}; +static const int sizeof_bench_sphincs_fast_level3_key = sizeof(bench_sphincs_fast_level3_key); + +/* certs/sphincs/bench_sphincs_fast_level5_key.der */ +static const unsigned char bench_sphincs_fast_level5_key[] = +{ + 0x30, 0x81, 0xD3, 0x02, 0x01, 0x00, 0x30, 0x08, 0x06, 0x06, + 0x2B, 0xCE, 0x0F, 0x06, 0x09, 0x0A, 0x04, 0x81, 0xC3, 0x04, + 0x81, 0xC0, 0xAB, 0xD3, 0xFD, 0x3B, 0x17, 0x00, 0xCD, 0xD5, + 0xB2, 0xEE, 0xD2, 0x36, 0xE5, 0xF7, 0x1D, 0xDC, 0xC8, 0x42, + 0xDB, 0x53, 0x6A, 0x8A, 0x0D, 0x6D, 0xD2, 0x3C, 0x1C, 0x7C, + 0x98, 0x4D, 0x73, 0xC8, 0xAB, 0x2E, 0xAA, 0x7A, 0xC0, 0x26, + 0xC4, 0x0D, 0x7E, 0xB4, 0xD3, 0xBB, 0x13, 0xF4, 0x6E, 0xFE, + 0x0E, 0xA5, 0xA4, 0x58, 0x57, 0xA2, 0xDD, 0x99, 0x62, 0xB9, + 0xBA, 0xC2, 0x5B, 0x26, 0xED, 0x6E, 0x99, 0xFA, 0x11, 0x0E, + 0xCF, 0x33, 0x54, 0x85, 0x56, 0x0C, 0xEB, 0x2A, 0xB0, 0xAA, + 0xEB, 0x74, 0x14, 0x89, 0x1A, 0xB9, 0x38, 0xF5, 0x29, 0x66, + 0x28, 0x28, 0x17, 0xF5, 0x72, 0x42, 0xEE, 0xC0, 0x14, 0x59, + 0xA0, 0x72, 0x9B, 0x9B, 0x1E, 0x7F, 0x70, 0x70, 0xBB, 0x89, + 0x0C, 0x7E, 0x87, 0x8B, 0x83, 0x80, 0x2B, 0x66, 0x58, 0x64, + 0x1D, 0x94, 0xAF, 0x58, 0xB5, 0x23, 0x2C, 0xA1, 0xE9, 0x95, + 0x99, 0xFA, 0x11, 0x0E, 0xCF, 0x33, 0x54, 0x85, 0x56, 0x0C, + 0xEB, 0x2A, 0xB0, 0xAA, 0xEB, 0x74, 0x14, 0x89, 0x1A, 0xB9, + 0x38, 0xF5, 0x29, 0x66, 0x28, 0x28, 0x17, 0xF5, 0x72, 0x42, + 0xEE, 0xC0, 0x14, 0x59, 0xA0, 0x72, 0x9B, 0x9B, 0x1E, 0x7F, + 0x70, 0x70, 0xBB, 0x89, 0x0C, 0x7E, 0x87, 0x8B, 0x83, 0x80, + 0x2B, 0x66, 0x58, 0x64, 0x1D, 0x94, 0xAF, 0x58, 0xB5, 0x23, + 0x2C, 0xA1, 0xE9, 0x95 +}; +static const int sizeof_bench_sphincs_fast_level5_key = sizeof(bench_sphincs_fast_level5_key); + +/* certs/sphincs/bench_sphincs_small_level1_key.der */ +static const unsigned char bench_sphincs_small_level1_key[] = +{ + 0x30, 0x71, 0x02, 0x01, 0x00, 0x30, 0x08, 0x06, 0x06, 0x2B, + 0xCE, 0x0F, 0x06, 0x07, 0x10, 0x04, 0x62, 0x04, 0x60, 0xFF, + 0x26, 0x56, 0x65, 0xAC, 0x6C, 0x0B, 0x72, 0x2D, 0x8D, 0xB8, + 0x29, 0x4A, 0x15, 0x7E, 0xEF, 0x55, 0xFD, 0xBE, 0xF4, 0xC0, + 0xE6, 0x6F, 0x2B, 0x7A, 0x97, 0x60, 0x51, 0x1C, 0xCB, 0x82, + 0x43, 0x44, 0xDE, 0x14, 0x3D, 0x4F, 0xE7, 0x3C, 0x1C, 0xB3, + 0xBB, 0x9F, 0xE8, 0x9F, 0x8F, 0xA4, 0xAD, 0xB9, 0x52, 0xC1, + 0x31, 0xF7, 0xC1, 0x86, 0x7E, 0x73, 0xFB, 0x9E, 0x72, 0x57, + 0x8A, 0xD7, 0x44, 0x44, 0xDE, 0x14, 0x3D, 0x4F, 0xE7, 0x3C, + 0x1C, 0xB3, 0xBB, 0x9F, 0xE8, 0x9F, 0x8F, 0xA4, 0xAD, 0xB9, + 0x52, 0xC1, 0x31, 0xF7, 0xC1, 0x86, 0x7E, 0x73, 0xFB, 0x9E, + 0x72, 0x57, 0x8A, 0xD7, 0x44 +}; +static const int sizeof_bench_sphincs_small_level1_key = sizeof(bench_sphincs_small_level1_key); + +/* certs/sphincs/bench_sphincs_small_level3_key.der */ +static const unsigned char bench_sphincs_small_level3_key[] = +{ + 0x30, 0x81, 0xA3, 0x02, 0x01, 0x00, 0x30, 0x08, 0x06, 0x06, + 0x2B, 0xCE, 0x0F, 0x06, 0x08, 0x0C, 0x04, 0x81, 0x93, 0x04, + 0x81, 0x90, 0x59, 0xC1, 0x44, 0x8A, 0x5F, 0xF3, 0xF1, 0xB3, + 0xB8, 0xFF, 0x98, 0x7F, 0x86, 0x4A, 0x4C, 0x19, 0xFC, 0x51, + 0xB8, 0x12, 0x87, 0x9C, 0x52, 0xD6, 0x7F, 0xD6, 0xB0, 0xA9, + 0xF7, 0xED, 0x44, 0x26, 0xAF, 0xC2, 0xCE, 0x47, 0xD9, 0xE3, + 0x95, 0x1A, 0xE6, 0x11, 0xC1, 0x37, 0x67, 0xA5, 0x89, 0xDD, + 0x37, 0x6A, 0xE9, 0xC3, 0x8C, 0x9B, 0x3E, 0xBA, 0xB1, 0x76, + 0x4A, 0x5A, 0xEE, 0xCD, 0x96, 0x66, 0xF2, 0x53, 0xDA, 0x8C, + 0x89, 0x69, 0xBF, 0xBF, 0xF9, 0xA5, 0xBC, 0x7D, 0x80, 0xA8, + 0x97, 0x63, 0x90, 0x55, 0x58, 0x6C, 0x0A, 0x52, 0x61, 0x0B, + 0xF3, 0xBC, 0xE1, 0x1F, 0xB4, 0xA6, 0x5F, 0x9F, 0x37, 0x6A, + 0xE9, 0xC3, 0x8C, 0x9B, 0x3E, 0xBA, 0xB1, 0x76, 0x4A, 0x5A, + 0xEE, 0xCD, 0x96, 0x66, 0xF2, 0x53, 0xDA, 0x8C, 0x89, 0x69, + 0xBF, 0xBF, 0xF9, 0xA5, 0xBC, 0x7D, 0x80, 0xA8, 0x97, 0x63, + 0x90, 0x55, 0x58, 0x6C, 0x0A, 0x52, 0x61, 0x0B, 0xF3, 0xBC, + 0xE1, 0x1F, 0xB4, 0xA6, 0x5F, 0x9F +}; +static const int sizeof_bench_sphincs_small_level3_key = sizeof(bench_sphincs_small_level3_key); + +/* certs/sphincs/bench_sphincs_small_level5_key.der */ +static const unsigned char bench_sphincs_small_level5_key[] = +{ + 0x30, 0x81, 0xD3, 0x02, 0x01, 0x00, 0x30, 0x08, 0x06, 0x06, + 0x2B, 0xCE, 0x0F, 0x06, 0x09, 0x0C, 0x04, 0x81, 0xC3, 0x04, + 0x81, 0xC0, 0x53, 0xE5, 0x25, 0x41, 0x1C, 0xCB, 0x8F, 0xAF, + 0x83, 0xBE, 0x64, 0x43, 0x70, 0x4E, 0x1D, 0x86, 0xF8, 0xFA, + 0xEA, 0x65, 0x9B, 0x45, 0xBC, 0xF1, 0x79, 0x57, 0x87, 0x51, + 0x2F, 0x6D, 0x50, 0xB8, 0x0D, 0x9A, 0x9F, 0x8C, 0xE8, 0x9B, + 0xE8, 0xFA, 0x1E, 0xF0, 0xA1, 0x98, 0xCA, 0x8B, 0x34, 0xD4, + 0x71, 0x53, 0xF0, 0xA7, 0x1D, 0xD6, 0x0D, 0xDF, 0x63, 0x61, + 0xA7, 0x12, 0x80, 0x64, 0xF7, 0x73, 0x14, 0x03, 0xD4, 0x54, + 0x01, 0x9D, 0x9D, 0x5D, 0x42, 0xC1, 0x2B, 0x91, 0xC3, 0xA2, + 0xD3, 0x12, 0x67, 0x35, 0x3B, 0xD7, 0x67, 0x31, 0xD5, 0xDC, + 0xDF, 0x4C, 0x4C, 0xAA, 0x45, 0xA8, 0x5D, 0x1E, 0xFB, 0x9E, + 0x34, 0x5D, 0x4B, 0x83, 0x77, 0xBF, 0x52, 0x8A, 0xDB, 0x67, + 0x7A, 0x52, 0xA4, 0x02, 0x29, 0xEB, 0x34, 0x9A, 0x4E, 0x86, + 0x25, 0x66, 0xFF, 0xA0, 0x79, 0x47, 0xBE, 0x94, 0xC2, 0x69, + 0x14, 0x03, 0xD4, 0x54, 0x01, 0x9D, 0x9D, 0x5D, 0x42, 0xC1, + 0x2B, 0x91, 0xC3, 0xA2, 0xD3, 0x12, 0x67, 0x35, 0x3B, 0xD7, + 0x67, 0x31, 0xD5, 0xDC, 0xDF, 0x4C, 0x4C, 0xAA, 0x45, 0xA8, + 0x5D, 0x1E, 0xFB, 0x9E, 0x34, 0x5D, 0x4B, 0x83, 0x77, 0xBF, + 0x52, 0x8A, 0xDB, 0x67, 0x7A, 0x52, 0xA4, 0x02, 0x29, 0xEB, + 0x34, 0x9A, 0x4E, 0x86, 0x25, 0x66, 0xFF, 0xA0, 0x79, 0x47, + 0xBE, 0x94, 0xC2, 0x69 +}; +static const int sizeof_bench_sphincs_small_level5_key = sizeof(bench_sphincs_small_level5_key); + +#endif /* HAVE_SPHINCS */ + +#if defined(HAVE_ECC) && defined(USE_CERT_BUFFERS_256) + +/* ./certs/ecc-client-key.der, ECC */ +static const unsigned char ecc_clikey_der_256[] = +{ + 0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0xF8, 0xCF, 0x92, + 0x6B, 0xBD, 0x1E, 0x28, 0xF1, 0xA8, 0xAB, 0xA1, 0x23, 0x4F, + 0x32, 0x74, 0x18, 0x88, 0x50, 0xAD, 0x7E, 0xC7, 0xEC, 0x92, + 0xF8, 0x8F, 0x97, 0x4D, 0xAF, 0x56, 0x89, 0x65, 0xC7, 0xA0, + 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, + 0x07, 0xA1, 0x44, 0x03, 0x42, 0x00, 0x04, 0x55, 0xBF, 0xF4, + 0x0F, 0x44, 0x50, 0x9A, 0x3D, 0xCE, 0x9B, 0xB7, 0xF0, 0xC5, + 0x4D, 0xF5, 0x70, 0x7B, 0xD4, 0xEC, 0x24, 0x8E, 0x19, 0x80, + 0xEC, 0x5A, 0x4C, 0xA2, 0x24, 0x03, 0x62, 0x2C, 0x9B, 0xDA, + 0xEF, 0xA2, 0x35, 0x12, 0x43, 0x84, 0x76, 0x16, 0xC6, 0x56, + 0x95, 0x06, 0xCC, 0x01, 0xA9, 0xBD, 0xF6, 0x75, 0x1A, 0x42, + 0xF7, 0xBD, 0xA9, 0xB2, 0x36, 0x22, 0x5F, 0xC7, 0x5D, 0x7F, + 0xB4 +}; +static const int sizeof_ecc_clikey_der_256 = sizeof(ecc_clikey_der_256); + +/* ./certs/ecc-client-keyPub.der, ECC */ +static const unsigned char ecc_clikeypub_der_256[] = +{ + 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, + 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, + 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x55, 0xBF, 0xF4, + 0x0F, 0x44, 0x50, 0x9A, 0x3D, 0xCE, 0x9B, 0xB7, 0xF0, 0xC5, + 0x4D, 0xF5, 0x70, 0x7B, 0xD4, 0xEC, 0x24, 0x8E, 0x19, 0x80, + 0xEC, 0x5A, 0x4C, 0xA2, 0x24, 0x03, 0x62, 0x2C, 0x9B, 0xDA, + 0xEF, 0xA2, 0x35, 0x12, 0x43, 0x84, 0x76, 0x16, 0xC6, 0x56, + 0x95, 0x06, 0xCC, 0x01, 0xA9, 0xBD, 0xF6, 0x75, 0x1A, 0x42, + 0xF7, 0xBD, 0xA9, 0xB2, 0x36, 0x22, 0x5F, 0xC7, 0x5D, 0x7F, + 0xB4 +}; +static const int sizeof_ecc_clikeypub_der_256 = sizeof(ecc_clikeypub_der_256); + +/* ./certs/client-ecc-cert.der, ECC */ +static const unsigned char cliecc_cert_der_256[] = +{ + 0x30, 0x82, 0x03, 0x5E, 0x30, 0x82, 0x03, 0x04, 0xA0, 0x03, + 0x02, 0x01, 0x02, 0x02, 0x14, 0x75, 0x99, 0xDB, 0x38, 0xED, + 0x32, 0xB1, 0xC2, 0xD1, 0x2C, 0x5E, 0x6F, 0x6F, 0x9D, 0x47, + 0x17, 0x58, 0xDD, 0xEE, 0x26, 0x30, 0x0A, 0x06, 0x08, 0x2A, + 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x81, 0x8D, + 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, + 0x02, 0x55, 0x53, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x03, 0x55, + 0x04, 0x08, 0x0C, 0x06, 0x4F, 0x72, 0x65, 0x67, 0x6F, 0x6E, + 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, + 0x05, 0x53, 0x61, 0x6C, 0x65, 0x6D, 0x31, 0x13, 0x30, 0x11, + 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x0A, 0x43, 0x6C, 0x69, + 0x65, 0x6E, 0x74, 0x20, 0x45, 0x43, 0x43, 0x31, 0x0D, 0x30, + 0x0B, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x04, 0x46, 0x61, + 0x73, 0x74, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, + 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, + 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, + 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, + 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x32, 0x34, 0x31, 0x32, 0x31, + 0x38, 0x32, 0x31, 0x32, 0x35, 0x33, 0x30, 0x5A, 0x17, 0x0D, + 0x32, 0x37, 0x30, 0x39, 0x31, 0x34, 0x32, 0x31, 0x32, 0x35, + 0x33, 0x30, 0x5A, 0x30, 0x81, 0x8D, 0x31, 0x0B, 0x30, 0x09, + 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, + 0x0F, 0x30, 0x0D, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x06, + 0x4F, 0x72, 0x65, 0x67, 0x6F, 0x6E, 0x31, 0x0E, 0x30, 0x0C, + 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x05, 0x53, 0x61, 0x6C, + 0x65, 0x6D, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, + 0x0A, 0x0C, 0x0A, 0x43, 0x6C, 0x69, 0x65, 0x6E, 0x74, 0x20, + 0x45, 0x43, 0x43, 0x31, 0x0D, 0x30, 0x0B, 0x06, 0x03, 0x55, + 0x04, 0x0B, 0x0C, 0x04, 0x46, 0x61, 0x73, 0x74, 0x31, 0x18, + 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, + 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, + 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, + 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, + 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, + 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x59, 0x30, + 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, + 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, + 0x03, 0x42, 0x00, 0x04, 0x55, 0xBF, 0xF4, 0x0F, 0x44, 0x50, + 0x9A, 0x3D, 0xCE, 0x9B, 0xB7, 0xF0, 0xC5, 0x4D, 0xF5, 0x70, + 0x7B, 0xD4, 0xEC, 0x24, 0x8E, 0x19, 0x80, 0xEC, 0x5A, 0x4C, + 0xA2, 0x24, 0x03, 0x62, 0x2C, 0x9B, 0xDA, 0xEF, 0xA2, 0x35, + 0x12, 0x43, 0x84, 0x76, 0x16, 0xC6, 0x56, 0x95, 0x06, 0xCC, + 0x01, 0xA9, 0xBD, 0xF6, 0x75, 0x1A, 0x42, 0xF7, 0xBD, 0xA9, + 0xB2, 0x36, 0x22, 0x5F, 0xC7, 0x5D, 0x7F, 0xB4, 0xA3, 0x82, + 0x01, 0x3E, 0x30, 0x82, 0x01, 0x3A, 0x30, 0x1D, 0x06, 0x03, + 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0xEB, 0xD4, 0x4B, + 0x59, 0x6B, 0x95, 0x61, 0x3F, 0x51, 0x57, 0xB6, 0x04, 0x4D, + 0x89, 0x41, 0x88, 0x44, 0x5C, 0xAB, 0xF2, 0x30, 0x81, 0xCD, + 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x81, 0xC5, 0x30, 0x81, + 0xC2, 0x80, 0x14, 0xEB, 0xD4, 0x4B, 0x59, 0x6B, 0x95, 0x61, + 0x3F, 0x51, 0x57, 0xB6, 0x04, 0x4D, 0x89, 0x41, 0x88, 0x44, + 0x5C, 0xAB, 0xF2, 0xA1, 0x81, 0x93, 0xA4, 0x81, 0x90, 0x30, + 0x81, 0x8D, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, + 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0F, 0x30, 0x0D, 0x06, + 0x03, 0x55, 0x04, 0x08, 0x0C, 0x06, 0x4F, 0x72, 0x65, 0x67, + 0x6F, 0x6E, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, + 0x07, 0x0C, 0x05, 0x53, 0x61, 0x6C, 0x65, 0x6D, 0x31, 0x13, + 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x0A, 0x43, + 0x6C, 0x69, 0x65, 0x6E, 0x74, 0x20, 0x45, 0x43, 0x43, 0x31, + 0x0D, 0x30, 0x0B, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x04, + 0x46, 0x61, 0x73, 0x74, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, + 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, + 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, + 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, + 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, + 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, + 0x63, 0x6F, 0x6D, 0x82, 0x14, 0x75, 0x99, 0xDB, 0x38, 0xED, + 0x32, 0xB1, 0xC2, 0xD1, 0x2C, 0x5E, 0x6F, 0x6F, 0x9D, 0x47, + 0x17, 0x58, 0xDD, 0xEE, 0x26, 0x30, 0x0C, 0x06, 0x03, 0x55, + 0x1D, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xFF, 0x30, + 0x1C, 0x06, 0x03, 0x55, 0x1D, 0x11, 0x04, 0x15, 0x30, 0x13, + 0x82, 0x0B, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2E, + 0x63, 0x6F, 0x6D, 0x87, 0x04, 0x7F, 0x00, 0x00, 0x01, 0x30, + 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04, 0x16, 0x30, 0x14, + 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01, + 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x02, + 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, + 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x20, 0x03, + 0x69, 0x31, 0x45, 0x6F, 0x01, 0x88, 0x6B, 0x63, 0xC6, 0x1C, + 0xEB, 0x39, 0xE4, 0x9A, 0xA8, 0xE2, 0xE0, 0x34, 0xAC, 0xAC, + 0xE6, 0xA1, 0xD6, 0xFE, 0xCE, 0x85, 0x98, 0x1E, 0xB0, 0x0D, + 0xA9, 0x02, 0x21, 0x00, 0xA3, 0xDD, 0x84, 0x5D, 0x08, 0x28, + 0x4B, 0x8B, 0x58, 0xFB, 0x0D, 0x33, 0xDB, 0x02, 0xEA, 0xC8, + 0x0C, 0xDA, 0x34, 0x0B, 0x4E, 0x83, 0xA2, 0x10, 0x67, 0x99, + 0x19, 0x1C, 0x93, 0x91, 0xC8, 0xC7 +}; +static const int sizeof_cliecc_cert_der_256 = sizeof(cliecc_cert_der_256); + +/* ./certs/ecc-key.der, ECC */ +static const unsigned char ecc_key_der_256[] = +{ + 0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0x45, 0xB6, 0x69, + 0x02, 0x73, 0x9C, 0x6C, 0x85, 0xA1, 0x38, 0x5B, 0x72, 0xE8, + 0xE8, 0xC7, 0xAC, 0xC4, 0x03, 0x8D, 0x53, 0x35, 0x04, 0xFA, + 0x6C, 0x28, 0xDC, 0x34, 0x8D, 0xE1, 0xA8, 0x09, 0x8C, 0xA0, + 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, + 0x07, 0xA1, 0x44, 0x03, 0x42, 0x00, 0x04, 0xBB, 0x33, 0xAC, + 0x4C, 0x27, 0x50, 0x4A, 0xC6, 0x4A, 0xA5, 0x04, 0xC3, 0x3C, + 0xDE, 0x9F, 0x36, 0xDB, 0x72, 0x2D, 0xCE, 0x94, 0xEA, 0x2B, + 0xFA, 0xCB, 0x20, 0x09, 0x39, 0x2C, 0x16, 0xE8, 0x61, 0x02, + 0xE9, 0xAF, 0x4D, 0xD3, 0x02, 0x93, 0x9A, 0x31, 0x5B, 0x97, + 0x92, 0x21, 0x7F, 0xF0, 0xCF, 0x18, 0xDA, 0x91, 0x11, 0x02, + 0x34, 0x86, 0xE8, 0x20, 0x58, 0x33, 0x0B, 0x80, 0x34, 0x89, + 0xD8 +}; +static const int sizeof_ecc_key_der_256 = sizeof(ecc_key_der_256); + +/* ./certs/ecc-keyPub.der, ECC */ +static const unsigned char ecc_key_pub_der_256[] = +{ + 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, + 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, + 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xBB, 0x33, 0xAC, + 0x4C, 0x27, 0x50, 0x4A, 0xC6, 0x4A, 0xA5, 0x04, 0xC3, 0x3C, + 0xDE, 0x9F, 0x36, 0xDB, 0x72, 0x2D, 0xCE, 0x94, 0xEA, 0x2B, + 0xFA, 0xCB, 0x20, 0x09, 0x39, 0x2C, 0x16, 0xE8, 0x61, 0x02, + 0xE9, 0xAF, 0x4D, 0xD3, 0x02, 0x93, 0x9A, 0x31, 0x5B, 0x97, + 0x92, 0x21, 0x7F, 0xF0, 0xCF, 0x18, 0xDA, 0x91, 0x11, 0x02, + 0x34, 0x86, 0xE8, 0x20, 0x58, 0x33, 0x0B, 0x80, 0x34, 0x89, + 0xD8 +}; +static const int sizeof_ecc_key_pub_der_256 = sizeof(ecc_key_pub_der_256); + +/* ./certs/statickeys/ecc-secp256r1.der, ECC */ +static const unsigned char ecc_secp_r1_statickey_der_256[] = +{ + 0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0xD3, 0x6B, 0xC6, + 0x68, 0x76, 0xDE, 0xD8, 0x97, 0x95, 0xF6, 0xD9, 0x8E, 0x2F, + 0x41, 0x73, 0x53, 0xF8, 0x03, 0x57, 0xED, 0x90, 0x80, 0x19, + 0xEB, 0xAA, 0x4A, 0x91, 0x8A, 0x8F, 0x31, 0x63, 0x45, 0xA0, + 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, + 0x07, 0xA1, 0x44, 0x03, 0x42, 0x00, 0x04, 0x58, 0xA0, 0x80, + 0x7C, 0x51, 0xEC, 0xDD, 0x41, 0x5F, 0x93, 0xA8, 0x7A, 0x60, + 0x47, 0x47, 0xE9, 0xCF, 0x5A, 0x40, 0xE4, 0xDD, 0x37, 0xEC, + 0xCA, 0xA7, 0x10, 0x1C, 0x43, 0xDA, 0xE8, 0x73, 0x8C, 0x28, + 0xF5, 0xC9, 0xEC, 0x1A, 0x33, 0x0B, 0x26, 0x2E, 0x97, 0x80, + 0x2E, 0xE0, 0xB8, 0x01, 0x91, 0x16, 0xB4, 0xCC, 0x02, 0x18, + 0xB5, 0x1D, 0xCC, 0xBA, 0x3C, 0xED, 0x04, 0xC9, 0xA8, 0x92, + 0x37 +}; +static const int sizeof_ecc_secp_r1_statickey_der_256 = sizeof(ecc_secp_r1_statickey_der_256); + +/* ./certs/server-ecc-comp.der, ECC */ +static const unsigned char serv_ecc_comp_der_256[] = +{ + 0x30, 0x82, 0x03, 0x77, 0x30, 0x82, 0x03, 0x1D, 0xA0, 0x03, + 0x02, 0x01, 0x02, 0x02, 0x14, 0x0C, 0x33, 0x75, 0x68, 0xFF, + 0x2E, 0x13, 0x4A, 0x2A, 0x30, 0x56, 0xB4, 0xA8, 0x79, 0x14, + 0xE2, 0xC4, 0xCA, 0x61, 0x54, 0x30, 0x0A, 0x06, 0x08, 0x2A, + 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x81, 0xA0, + 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, + 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, + 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, + 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, + 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, + 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x0F, + 0x45, 0x6C, 0x6C, 0x69, 0x70, 0x74, 0x69, 0x63, 0x20, 0x2D, + 0x20, 0x63, 0x6F, 0x6D, 0x70, 0x31, 0x18, 0x30, 0x16, 0x06, + 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0F, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x20, 0x45, 0x43, 0x43, 0x2D, 0x63, 0x6F, 0x6D, + 0x70, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, + 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, + 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, + 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, + 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, + 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, + 0x30, 0x1E, 0x17, 0x0D, 0x32, 0x34, 0x31, 0x32, 0x31, 0x38, + 0x32, 0x31, 0x32, 0x35, 0x33, 0x30, 0x5A, 0x17, 0x0D, 0x32, + 0x37, 0x30, 0x39, 0x31, 0x34, 0x32, 0x31, 0x32, 0x35, 0x33, + 0x30, 0x5A, 0x30, 0x81, 0xA0, 0x31, 0x0B, 0x30, 0x09, 0x06, + 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, + 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, + 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, + 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, + 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, + 0x55, 0x04, 0x0A, 0x0C, 0x0F, 0x45, 0x6C, 0x6C, 0x69, 0x70, + 0x74, 0x69, 0x63, 0x20, 0x2D, 0x20, 0x63, 0x6F, 0x6D, 0x70, + 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, + 0x0F, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x45, 0x43, + 0x43, 0x2D, 0x63, 0x6F, 0x6D, 0x70, 0x31, 0x18, 0x30, 0x16, + 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, + 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, + 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, + 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, + 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, + 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x39, 0x30, 0x13, 0x06, + 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, + 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x22, + 0x00, 0x02, 0xBB, 0x33, 0xAC, 0x4C, 0x27, 0x50, 0x4A, 0xC6, + 0x4A, 0xA5, 0x04, 0xC3, 0x3C, 0xDE, 0x9F, 0x36, 0xDB, 0x72, + 0x2D, 0xCE, 0x94, 0xEA, 0x2B, 0xFA, 0xCB, 0x20, 0x09, 0x39, + 0x2C, 0x16, 0xE8, 0x61, 0xA3, 0x82, 0x01, 0x51, 0x30, 0x82, + 0x01, 0x4D, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, + 0x16, 0x04, 0x14, 0x8C, 0x38, 0x3A, 0x6B, 0xB8, 0x24, 0xB7, + 0xDF, 0x6E, 0xF4, 0x59, 0xAC, 0x56, 0x4E, 0xAA, 0xE2, 0x58, + 0xA6, 0x5A, 0x18, 0x30, 0x81, 0xE0, 0x06, 0x03, 0x55, 0x1D, + 0x23, 0x04, 0x81, 0xD8, 0x30, 0x81, 0xD5, 0x80, 0x14, 0x8C, + 0x38, 0x3A, 0x6B, 0xB8, 0x24, 0xB7, 0xDF, 0x6E, 0xF4, 0x59, + 0xAC, 0x56, 0x4E, 0xAA, 0xE2, 0x58, 0xA6, 0x5A, 0x18, 0xA1, + 0x81, 0xA6, 0xA4, 0x81, 0xA3, 0x30, 0x81, 0xA0, 0x31, 0x0B, + 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, + 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, + 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, + 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, + 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x18, 0x30, + 0x16, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x0F, 0x45, 0x6C, + 0x6C, 0x69, 0x70, 0x74, 0x69, 0x63, 0x20, 0x2D, 0x20, 0x63, + 0x6F, 0x6D, 0x70, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, + 0x04, 0x0B, 0x0C, 0x0F, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x20, 0x45, 0x43, 0x43, 0x2D, 0x63, 0x6F, 0x6D, 0x70, 0x31, + 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, + 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, + 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, + 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, + 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, + 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82, 0x14, + 0x0C, 0x33, 0x75, 0x68, 0xFF, 0x2E, 0x13, 0x4A, 0x2A, 0x30, + 0x56, 0xB4, 0xA8, 0x79, 0x14, 0xE2, 0xC4, 0xCA, 0x61, 0x54, + 0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30, + 0x03, 0x01, 0x01, 0xFF, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x1D, + 0x11, 0x04, 0x15, 0x30, 0x13, 0x82, 0x0B, 0x65, 0x78, 0x61, + 0x6D, 0x70, 0x6C, 0x65, 0x2E, 0x63, 0x6F, 0x6D, 0x87, 0x04, + 0x7F, 0x00, 0x00, 0x01, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, + 0x25, 0x04, 0x16, 0x30, 0x14, 0x06, 0x08, 0x2B, 0x06, 0x01, + 0x05, 0x05, 0x07, 0x03, 0x01, 0x06, 0x08, 0x2B, 0x06, 0x01, + 0x05, 0x05, 0x07, 0x03, 0x02, 0x30, 0x0A, 0x06, 0x08, 0x2A, + 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, + 0x30, 0x45, 0x02, 0x20, 0x23, 0xD1, 0xF6, 0x8F, 0xD4, 0x29, + 0x83, 0x27, 0x8F, 0x4A, 0x8E, 0x49, 0x44, 0x49, 0x32, 0x1C, + 0x12, 0xE4, 0xC1, 0x33, 0xB1, 0x97, 0x2B, 0x31, 0xCD, 0x62, + 0x47, 0xCB, 0xB6, 0xD0, 0xEB, 0x4D, 0x02, 0x21, 0x00, 0xE0, + 0x6E, 0xDC, 0x48, 0x70, 0xAA, 0x10, 0xB2, 0x74, 0xD1, 0x88, + 0xDA, 0xF1, 0x3F, 0xD9, 0xD7, 0xE9, 0xE4, 0x88, 0xE5, 0x91, + 0x00, 0x03, 0xC1, 0x0C, 0x1F, 0x54, 0xA0, 0xCA, 0x4D, 0x99, + 0x6A +}; +static const int sizeof_serv_ecc_comp_der_256 = sizeof(serv_ecc_comp_der_256); + +/* ./certs/server-ecc-rsa.der, ECC */ +static const unsigned char serv_ecc_rsa_der_256[] = +{ + 0x30, 0x82, 0x04, 0x2A, 0x30, 0x82, 0x03, 0x12, 0xA0, 0x03, + 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x30, 0x0D, 0x06, 0x09, + 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, + 0x00, 0x30, 0x81, 0x94, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, + 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, + 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, + 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, + 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, + 0x6D, 0x61, 0x6E, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, + 0x04, 0x0A, 0x0C, 0x08, 0x53, 0x61, 0x77, 0x74, 0x6F, 0x6F, + 0x74, 0x68, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, + 0x0B, 0x0C, 0x0A, 0x43, 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74, + 0x69, 0x6E, 0x67, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, + 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, + 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, + 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, + 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, + 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, + 0x6F, 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x32, 0x34, 0x31, 0x32, + 0x31, 0x38, 0x32, 0x31, 0x32, 0x35, 0x33, 0x30, 0x5A, 0x17, + 0x0D, 0x32, 0x37, 0x30, 0x39, 0x31, 0x34, 0x32, 0x31, 0x32, + 0x35, 0x33, 0x30, 0x5A, 0x30, 0x81, 0x9D, 0x31, 0x0B, 0x30, + 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, + 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, + 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, + 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, + 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x1A, 0x30, 0x18, + 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x11, 0x45, 0x6C, 0x6C, + 0x69, 0x70, 0x74, 0x69, 0x63, 0x20, 0x2D, 0x20, 0x52, 0x53, + 0x41, 0x73, 0x69, 0x67, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, + 0x55, 0x04, 0x0B, 0x0C, 0x0A, 0x45, 0x43, 0x43, 0x2D, 0x52, + 0x53, 0x41, 0x73, 0x69, 0x67, 0x31, 0x18, 0x30, 0x16, 0x06, + 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, + 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, + 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, + 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, + 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, + 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, + 0x04, 0xBB, 0x33, 0xAC, 0x4C, 0x27, 0x50, 0x4A, 0xC6, 0x4A, + 0xA5, 0x04, 0xC3, 0x3C, 0xDE, 0x9F, 0x36, 0xDB, 0x72, 0x2D, + 0xCE, 0x94, 0xEA, 0x2B, 0xFA, 0xCB, 0x20, 0x09, 0x39, 0x2C, + 0x16, 0xE8, 0x61, 0x02, 0xE9, 0xAF, 0x4D, 0xD3, 0x02, 0x93, + 0x9A, 0x31, 0x5B, 0x97, 0x92, 0x21, 0x7F, 0xF0, 0xCF, 0x18, + 0xDA, 0x91, 0x11, 0x02, 0x34, 0x86, 0xE8, 0x20, 0x58, 0x33, + 0x0B, 0x80, 0x34, 0x89, 0xD8, 0xA3, 0x82, 0x01, 0x45, 0x30, + 0x82, 0x01, 0x41, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, + 0x04, 0x16, 0x04, 0x14, 0x5D, 0x5D, 0x26, 0xEF, 0xAC, 0x7E, + 0x36, 0xF9, 0x9B, 0x76, 0x15, 0x2B, 0x4A, 0x25, 0x02, 0x23, + 0xEF, 0xB2, 0x89, 0x30, 0x30, 0x81, 0xD4, 0x06, 0x03, 0x55, + 0x1D, 0x23, 0x04, 0x81, 0xCC, 0x30, 0x81, 0xC9, 0x80, 0x14, + 0x27, 0x8E, 0x67, 0x11, 0x74, 0xC3, 0x26, 0x1D, 0x3F, 0xED, + 0x33, 0x63, 0xB3, 0xA4, 0xD8, 0x1D, 0x30, 0xE5, 0xE8, 0xD5, + 0xA1, 0x81, 0x9A, 0xA4, 0x81, 0x97, 0x30, 0x81, 0x94, 0x31, + 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, + 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, + 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, + 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, + 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x11, + 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x08, 0x53, + 0x61, 0x77, 0x74, 0x6F, 0x6F, 0x74, 0x68, 0x31, 0x13, 0x30, + 0x11, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0A, 0x43, 0x6F, + 0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, 0x6E, 0x67, 0x31, 0x18, + 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, + 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, + 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, + 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, + 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, + 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82, 0x14, 0x6B, + 0x9B, 0x70, 0xC6, 0xF1, 0xA3, 0x94, 0x65, 0x19, 0xA1, 0x08, + 0x58, 0xEF, 0xA7, 0x8D, 0x2B, 0x7A, 0x83, 0xC1, 0xDA, 0x30, + 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30, 0x03, + 0x01, 0x01, 0xFF, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x1D, 0x11, + 0x04, 0x15, 0x30, 0x13, 0x82, 0x0B, 0x65, 0x78, 0x61, 0x6D, + 0x70, 0x6C, 0x65, 0x2E, 0x63, 0x6F, 0x6D, 0x87, 0x04, 0x7F, + 0x00, 0x00, 0x01, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x25, + 0x04, 0x16, 0x30, 0x14, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, + 0x05, 0x07, 0x03, 0x01, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, + 0x05, 0x07, 0x03, 0x02, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, + 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x03, + 0x82, 0x01, 0x01, 0x00, 0x38, 0xE8, 0x66, 0xC3, 0x74, 0xE0, + 0x5C, 0x59, 0xA9, 0x12, 0x46, 0xAD, 0x84, 0xE3, 0xB3, 0xFA, + 0x3E, 0x68, 0x90, 0xD0, 0x06, 0xA4, 0x2C, 0xAB, 0xF7, 0xB3, + 0xB9, 0x7C, 0x89, 0x62, 0xFB, 0x88, 0xEB, 0x88, 0x04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D3, 0xFC, 0xCE, + 0x8F, 0x2C, 0x38, 0x5B, 0x38, 0xE7, 0xB2, 0xD0, 0x71, 0x9F, + 0x3F, 0xDE, 0x4E, 0x08, 0x03, 0xF9, 0x11, 0x58, 0x7C, 0x46, + 0x04, 0x0A, 0x73, 0x28, 0x68, 0xB8, 0x17, 0x17, 0x02, 0x45, + 0x9C, 0x65, 0x96, 0x1A, 0xB3, 0x98, 0x4D, 0x3B, 0xFB, 0xC7 + +}; +static const int sizeof_serv_ecc_rsa_der_256 = sizeof(serv_ecc_rsa_der_256); + +/* ./certs/server-ecc.der, ECC */ +static const unsigned char serv_ecc_der_256[] = +{ + 0x30, 0x82, 0x02, 0xA2, 0x30, 0x82, 0x02, 0x48, 0xA0, 0x03, + 0x02, 0x01, 0x02, 0x02, 0x01, 0x03, 0x30, 0x0A, 0x06, 0x08, + 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x81, + 0x97, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, + 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, + 0x55, 0x04, 0x08, 0x0C, 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, + 0x6E, 0x67, 0x74, 0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E, 0x06, + 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x53, 0x65, 0x61, 0x74, + 0x74, 0x6C, 0x65, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, + 0x04, 0x0A, 0x0C, 0x07, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, + 0x4C, 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x0B, + 0x0C, 0x0B, 0x44, 0x65, 0x76, 0x65, 0x6C, 0x6F, 0x70, 0x6D, + 0x65, 0x6E, 0x74, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, + 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, + 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, + 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, + 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, + 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, + 0x6F, 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x32, 0x34, 0x31, 0x32, + 0x31, 0x38, 0x32, 0x31, 0x32, 0x35, 0x33, 0x30, 0x5A, 0x17, + 0x0D, 0x32, 0x37, 0x30, 0x39, 0x31, 0x34, 0x32, 0x31, 0x32, + 0x35, 0x33, 0x30, 0x5A, 0x30, 0x81, 0x90, 0x31, 0x0B, 0x30, + 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, + 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, + 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74, 0x6F, + 0x6E, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, + 0x0C, 0x07, 0x53, 0x65, 0x61, 0x74, 0x74, 0x6C, 0x65, 0x31, + 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x08, + 0x45, 0x6C, 0x6C, 0x69, 0x70, 0x74, 0x69, 0x63, 0x31, 0x0C, + 0x30, 0x0A, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x03, 0x45, + 0x43, 0x43, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, + 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, + 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, + 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, + 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, + 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, + 0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xBB, 0x33, + 0xAC, 0x4C, 0x27, 0x50, 0x4A, 0xC6, 0x4A, 0xA5, 0x04, 0xC3, + 0x3C, 0xDE, 0x9F, 0x36, 0xDB, 0x72, 0x2D, 0xCE, 0x94, 0xEA, + 0x2B, 0xFA, 0xCB, 0x20, 0x09, 0x39, 0x2C, 0x16, 0xE8, 0x61, + 0x02, 0xE9, 0xAF, 0x4D, 0xD3, 0x02, 0x93, 0x9A, 0x31, 0x5B, + 0x97, 0x92, 0x21, 0x7F, 0xF0, 0xCF, 0x18, 0xDA, 0x91, 0x11, + 0x02, 0x34, 0x86, 0xE8, 0x20, 0x58, 0x33, 0x0B, 0x80, 0x34, + 0x89, 0xD8, 0xA3, 0x81, 0x89, 0x30, 0x81, 0x86, 0x30, 0x1D, + 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x5D, + 0x5D, 0x26, 0xEF, 0xAC, 0x7E, 0x36, 0xF9, 0x9B, 0x76, 0x15, + 0x2B, 0x4A, 0x25, 0x02, 0x23, 0xEF, 0xB2, 0x89, 0x30, 0x30, + 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, + 0x80, 0x14, 0x56, 0x8E, 0x9A, 0xC3, 0xF0, 0x42, 0xDE, 0x18, + 0xB9, 0x45, 0x55, 0x6E, 0xF9, 0x93, 0xCF, 0xEA, 0xC3, 0xF3, + 0xA5, 0x21, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x01, + 0x01, 0xFF, 0x04, 0x02, 0x30, 0x00, 0x30, 0x0E, 0x06, 0x03, + 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, + 0x03, 0xA8, 0x30, 0x13, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04, + 0x0C, 0x30, 0x0A, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, + 0x07, 0x03, 0x01, 0x30, 0x11, 0x06, 0x09, 0x60, 0x86, 0x48, + 0x01, 0x86, 0xF8, 0x42, 0x01, 0x01, 0x04, 0x04, 0x03, 0x02, + 0x06, 0x40, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, + 0x3D, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, + 0x21, 0x00, 0x8B, 0x82, 0xA5, 0xD2, 0xF6, 0xCA, 0x84, 0xBA, + 0xAD, 0x2D, 0xDE, 0x36, 0xE9, 0x2A, 0x4D, 0xEE, 0x4B, 0x20, + 0x46, 0xBA, 0xAB, 0x4E, 0xD0, 0x10, 0x6E, 0xEB, 0x30, 0xB6, + 0x7E, 0xD8, 0xAF, 0x8C, 0x02, 0x20, 0x06, 0x74, 0x40, 0x6A, + 0xA9, 0x31, 0x54, 0xFE, 0x20, 0x9D, 0xC6, 0x6D, 0x2B, 0xDF, + 0x1D, 0xAA, 0x63, 0xDA, 0xFC, 0x97, 0x50, 0x87, 0x92, 0x69, + 0xEE, 0x63, 0x57, 0xB6, 0xEC, 0xE2, 0xE9, 0xFA +}; +static const int sizeof_serv_ecc_der_256 = sizeof(serv_ecc_der_256); + +/* ./certs/ca-ecc-key.der, ECC */ +static const unsigned char ca_ecc_key_der_256[] = +{ + 0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0x02, 0xE1, 0x33, + 0x98, 0x77, 0x97, 0xAC, 0x4A, 0x59, 0x6D, 0x28, 0x9B, 0x6E, + 0xA0, 0x93, 0x9B, 0x07, 0x71, 0x8B, 0x4D, 0x60, 0x63, 0x85, + 0x99, 0xE6, 0xBB, 0x16, 0x70, 0xE9, 0x0A, 0xF6, 0x80, 0xA0, + 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, + 0x07, 0xA1, 0x44, 0x03, 0x42, 0x00, 0x04, 0x02, 0xD3, 0xD9, + 0x6E, 0xD6, 0x01, 0x8E, 0x45, 0xC8, 0xB9, 0x90, 0x31, 0xE5, + 0xC0, 0x4C, 0xE3, 0x9E, 0xAD, 0x29, 0x38, 0x98, 0xBA, 0x10, + 0xD6, 0xE9, 0x09, 0x2A, 0x80, 0xA9, 0x2E, 0x17, 0x2A, 0xB9, + 0x8A, 0xBF, 0x33, 0x83, 0x46, 0xE3, 0x95, 0x0B, 0xE4, 0x77, + 0x40, 0xB5, 0x3B, 0x43, 0x45, 0x33, 0x0F, 0x61, 0x53, 0x7C, + 0x37, 0x44, 0xC1, 0xCB, 0xFC, 0x80, 0xCA, 0xE8, 0x43, 0xEA, + 0xA7 +}; +static const int sizeof_ca_ecc_key_der_256 = sizeof(ca_ecc_key_der_256); + +/* ./certs/ca-ecc-cert.der, ECC */ +static const unsigned char ca_ecc_cert_der_256[] = +{ + 0x30, 0x82, 0x02, 0x95, 0x30, 0x82, 0x02, 0x3B, 0xA0, 0x03, + 0x02, 0x01, 0x02, 0x02, 0x14, 0x30, 0xB9, 0x30, 0x50, 0xF8, + 0x1A, 0x0D, 0xFF, 0xAD, 0x68, 0xD1, 0x6D, 0xE8, 0xA3, 0x6B, + 0x58, 0x23, 0x33, 0x7A, 0x84, 0x30, 0x0A, 0x06, 0x08, 0x2A, + 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x81, 0x97, + 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, + 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, + 0x04, 0x08, 0x0C, 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, + 0x67, 0x74, 0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, + 0x55, 0x04, 0x07, 0x0C, 0x07, 0x53, 0x65, 0x61, 0x74, 0x74, + 0x6C, 0x65, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, + 0x0A, 0x0C, 0x07, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, + 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, + 0x0B, 0x44, 0x65, 0x76, 0x65, 0x6C, 0x6F, 0x70, 0x6D, 0x65, + 0x6E, 0x74, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, + 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, + 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, + 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, + 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x32, 0x34, 0x31, 0x32, 0x31, + 0x38, 0x32, 0x31, 0x32, 0x35, 0x32, 0x39, 0x5A, 0x17, 0x0D, + 0x32, 0x37, 0x30, 0x39, 0x31, 0x34, 0x32, 0x31, 0x32, 0x35, + 0x32, 0x39, 0x5A, 0x30, 0x81, 0x97, 0x31, 0x0B, 0x30, 0x09, + 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, + 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x0A, + 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74, 0x6F, 0x6E, + 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, + 0x07, 0x53, 0x65, 0x61, 0x74, 0x74, 0x6C, 0x65, 0x31, 0x10, + 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x07, 0x77, + 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x31, 0x14, 0x30, 0x12, + 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0B, 0x44, 0x65, 0x76, + 0x65, 0x6C, 0x6F, 0x70, 0x6D, 0x65, 0x6E, 0x74, 0x31, 0x18, + 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, + 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, + 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, + 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, + 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, + 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x59, 0x30, + 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, + 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, + 0x03, 0x42, 0x00, 0x04, 0x02, 0xD3, 0xD9, 0x6E, 0xD6, 0x01, + 0x8E, 0x45, 0xC8, 0xB9, 0x90, 0x31, 0xE5, 0xC0, 0x4C, 0xE3, + 0x9E, 0xAD, 0x29, 0x38, 0x98, 0xBA, 0x10, 0xD6, 0xE9, 0x09, + 0x2A, 0x80, 0xA9, 0x2E, 0x17, 0x2A, 0xB9, 0x8A, 0xBF, 0x33, + 0x83, 0x46, 0xE3, 0x95, 0x0B, 0xE4, 0x77, 0x40, 0xB5, 0x3B, + 0x43, 0x45, 0x33, 0x0F, 0x61, 0x53, 0x7C, 0x37, 0x44, 0xC1, + 0xCB, 0xFC, 0x80, 0xCA, 0xE8, 0x43, 0xEA, 0xA7, 0xA3, 0x63, + 0x30, 0x61, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, + 0x16, 0x04, 0x14, 0x56, 0x8E, 0x9A, 0xC3, 0xF0, 0x42, 0xDE, + 0x18, 0xB9, 0x45, 0x55, 0x6E, 0xF9, 0x93, 0xCF, 0xEA, 0xC3, + 0xF3, 0xA5, 0x21, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, + 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x56, 0x8E, 0x9A, 0xC3, + 0xF0, 0x42, 0xDE, 0x18, 0xB9, 0x45, 0x55, 0x6E, 0xF9, 0x93, + 0xCF, 0xEA, 0xC3, 0xF3, 0xA5, 0x21, 0x30, 0x0F, 0x06, 0x03, + 0x55, 0x1D, 0x13, 0x01, 0x01, 0xFF, 0x04, 0x05, 0x30, 0x03, + 0x01, 0x01, 0xFF, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, + 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x01, 0x86, 0x30, + 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, + 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x21, 0x00, 0x88, + 0xCC, 0x7F, 0x00, 0xF5, 0xA9, 0x4E, 0xC0, 0x69, 0x6E, 0x36, + 0x39, 0x24, 0x8F, 0x83, 0x45, 0x4D, 0xFA, 0xD0, 0x39, 0x14, + 0xB8, 0xC8, 0x7F, 0x95, 0x51, 0xF2, 0xC5, 0x98, 0xC0, 0xB7, + 0xE2, 0x02, 0x20, 0x2A, 0x93, 0x61, 0xB0, 0x06, 0xDE, 0xEB, + 0xDA, 0xFD, 0xAF, 0x6B, 0x39, 0xBF, 0x88, 0x17, 0xF1, 0xBA, + 0x2A, 0x7D, 0x59, 0xA8, 0xDE, 0xE7, 0x0A, 0x11, 0x83, 0x4F, + 0x92, 0x77, 0x8D, 0x92, 0x3B +}; +static const int sizeof_ca_ecc_cert_der_256 = sizeof(ca_ecc_cert_der_256); + +/* ./certs/ca-ecc384-key.der, ECC */ +static const unsigned char ca_ecc_key_der_384[] = +{ + 0x30, 0x81, 0xA4, 0x02, 0x01, 0x01, 0x04, 0x30, 0x7B, 0x16, + 0xE3, 0xD6, 0xD2, 0x81, 0x94, 0x6C, 0x8A, 0xDD, 0xA8, 0x78, + 0xEE, 0xC7, 0x7E, 0xB3, 0xC5, 0xD1, 0xDB, 0x2E, 0xF3, 0xED, + 0x0E, 0x48, 0x85, 0xB1, 0xF2, 0xE1, 0x7A, 0x39, 0x56, 0xC0, + 0xF1, 0x62, 0x12, 0x0F, 0x35, 0xB7, 0x39, 0xBC, 0x9C, 0x25, + 0xC0, 0x76, 0xEB, 0xFE, 0x55, 0x70, 0xA0, 0x07, 0x06, 0x05, + 0x2B, 0x81, 0x04, 0x00, 0x22, 0xA1, 0x64, 0x03, 0x62, 0x00, + 0x04, 0xEE, 0x82, 0xD4, 0x39, 0x9A, 0xB1, 0x27, 0x82, 0xF4, + 0xD7, 0xEA, 0xC6, 0xBC, 0x03, 0x1D, 0x4D, 0x83, 0x61, 0xF4, + 0x03, 0xAE, 0x7E, 0xBD, 0xD8, 0x5A, 0xA5, 0xB9, 0xF0, 0x8E, + 0xA2, 0xA5, 0xDA, 0xCE, 0x87, 0x3B, 0x5A, 0xAB, 0x44, 0x16, + 0x9C, 0xF5, 0x9F, 0x62, 0xDD, 0xF6, 0x20, 0xCD, 0x9C, 0x76, + 0x3C, 0x40, 0xB1, 0x3F, 0x97, 0x17, 0xDF, 0x59, 0xF6, 0xCD, + 0xDE, 0xCD, 0x46, 0x35, 0xC0, 0xED, 0x5E, 0x2E, 0x48, 0xB6, + 0x66, 0x91, 0x71, 0x74, 0xB7, 0x0C, 0x3F, 0xB9, 0x9A, 0xB7, + 0x83, 0xBD, 0x93, 0x3F, 0x5F, 0x50, 0x2D, 0x70, 0x3F, 0xDE, + 0x35, 0x25, 0xE1, 0x90, 0x3B, 0x86, 0xE0 +}; +static const int sizeof_ca_ecc_key_der_384 = sizeof(ca_ecc_key_der_384); + +/* ./certs/ca-ecc384-cert.der, ECC */ +static const unsigned char ca_ecc_cert_der_384[] = +{ + 0x30, 0x82, 0x02, 0xD2, 0x30, 0x82, 0x02, 0x58, 0xA0, 0x03, + 0x02, 0x01, 0x02, 0x02, 0x14, 0x4E, 0x08, 0x67, 0x9D, 0x29, + 0x61, 0x47, 0x3E, 0x2A, 0x23, 0x82, 0xCD, 0xCF, 0xCB, 0x53, + 0x2A, 0xB8, 0x02, 0x22, 0x57, 0x30, 0x0A, 0x06, 0x08, 0x2A, + 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x03, 0x30, 0x81, 0x97, + 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, + 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, + 0x04, 0x08, 0x0C, 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, + 0x67, 0x74, 0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, + 0x55, 0x04, 0x07, 0x0C, 0x07, 0x53, 0x65, 0x61, 0x74, 0x74, + 0x6C, 0x65, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, + 0x0A, 0x0C, 0x07, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, + 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, + 0x0B, 0x44, 0x65, 0x76, 0x65, 0x6C, 0x6F, 0x70, 0x6D, 0x65, + 0x6E, 0x74, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, + 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, + 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, + 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, + 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x32, 0x34, 0x31, 0x32, 0x31, + 0x38, 0x32, 0x31, 0x32, 0x35, 0x32, 0x39, 0x5A, 0x17, 0x0D, + 0x32, 0x37, 0x30, 0x39, 0x31, 0x34, 0x32, 0x31, 0x32, 0x35, + 0x32, 0x39, 0x5A, 0x30, 0x81, 0x97, 0x31, 0x0B, 0x30, 0x09, + 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, + 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x0A, + 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74, 0x6F, 0x6E, + 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, + 0x07, 0x53, 0x65, 0x61, 0x74, 0x74, 0x6C, 0x65, 0x31, 0x10, + 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x07, 0x77, + 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x31, 0x14, 0x30, 0x12, + 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0B, 0x44, 0x65, 0x76, + 0x65, 0x6C, 0x6F, 0x70, 0x6D, 0x65, 0x6E, 0x74, 0x31, 0x18, + 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, + 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, + 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, + 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, + 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, + 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x76, 0x30, + 0x10, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, + 0x06, 0x05, 0x2B, 0x81, 0x04, 0x00, 0x22, 0x03, 0x62, 0x00, + 0x04, 0xEE, 0x82, 0xD4, 0x39, 0x9A, 0xB1, 0x27, 0x82, 0xF4, + 0xD7, 0xEA, 0xC6, 0xBC, 0x03, 0x1D, 0x4D, 0x83, 0x61, 0xF4, + 0x03, 0xAE, 0x7E, 0xBD, 0xD8, 0x5A, 0xA5, 0xB9, 0xF0, 0x8E, + 0xA2, 0xA5, 0xDA, 0xCE, 0x87, 0x3B, 0x5A, 0xAB, 0x44, 0x16, + 0x9C, 0xF5, 0x9F, 0x62, 0xDD, 0xF6, 0x20, 0xCD, 0x9C, 0x76, + 0x3C, 0x40, 0xB1, 0x3F, 0x97, 0x17, 0xDF, 0x59, 0xF6, 0xCD, + 0xDE, 0xCD, 0x46, 0x35, 0xC0, 0xED, 0x5E, 0x2E, 0x48, 0xB6, + 0x66, 0x91, 0x71, 0x74, 0xB7, 0x0C, 0x3F, 0xB9, 0x9A, 0xB7, + 0x83, 0xBD, 0x93, 0x3F, 0x5F, 0x50, 0x2D, 0x70, 0x3F, 0xDE, + 0x35, 0x25, 0xE1, 0x90, 0x3B, 0x86, 0xE0, 0xA3, 0x63, 0x30, + 0x61, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, + 0x04, 0x14, 0xAB, 0xE0, 0xC3, 0x26, 0x4C, 0x18, 0xD4, 0x72, + 0xBB, 0xD2, 0x84, 0x8C, 0x9C, 0x0A, 0x05, 0x92, 0x80, 0x12, + 0x53, 0x52, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, + 0x18, 0x30, 0x16, 0x80, 0x14, 0xAB, 0xE0, 0xC3, 0x26, 0x4C, + 0x18, 0xD4, 0x72, 0xBB, 0xD2, 0x84, 0x8C, 0x9C, 0x0A, 0x05, + 0x92, 0x80, 0x12, 0x53, 0x52, 0x30, 0x0F, 0x06, 0x03, 0x55, + 0x1D, 0x13, 0x01, 0x01, 0xFF, 0x04, 0x05, 0x30, 0x03, 0x01, + 0x01, 0xFF, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, + 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x01, 0x86, 0x30, 0x0A, + 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x03, + 0x03, 0x68, 0x00, 0x30, 0x65, 0x02, 0x30, 0x1D, 0x3F, 0x92, + 0x02, 0xB2, 0x46, 0x54, 0xEE, 0x9E, 0x0D, 0x90, 0x03, 0x73, + 0x6A, 0xAB, 0x04, 0x5A, 0x41, 0xFE, 0xF4, 0x1B, 0xFD, 0xD6, + 0x99, 0xCC, 0x7A, 0x6C, 0xFD, 0x52, 0xDA, 0x2E, 0x4E, 0x78, + 0xFE, 0xEF, 0x79, 0x74, 0x12, 0x5E, 0x04, 0x9D, 0x2C, 0xE4, + 0xE7, 0x1A, 0x4D, 0xD3, 0x1E, 0x02, 0x31, 0x00, 0xB7, 0x34, + 0xE8, 0x4C, 0x69, 0x70, 0xDB, 0xFD, 0x1A, 0x48, 0xC5, 0xDC, + 0x8E, 0xEF, 0x15, 0xCA, 0x13, 0xEE, 0xF8, 0x4F, 0x27, 0x5F, + 0xD2, 0x3A, 0x6A, 0x06, 0x7D, 0xF3, 0x32, 0xA7, 0x75, 0x97, + 0x27, 0x6D, 0x60, 0xED, 0xA2, 0x9F, 0x9F, 0x7E, 0x66, 0x43, + 0xF9, 0x15, 0x1D, 0x65, 0x5D, 0x49 +}; +static const int sizeof_ca_ecc_cert_der_384 = sizeof(ca_ecc_cert_der_384); + +#endif /* HAVE_ECC && USE_CERT_BUFFERS_256 */ + +/* dh1024 p */ +static const unsigned char dh_p[] = +{ + 0xE6, 0x96, 0x9D, 0x3D, 0x49, 0x5B, 0xE3, 0x2C, 0x7C, 0xF1, 0x80, 0xC3, + 0xBD, 0xD4, 0x79, 0x8E, 0x91, 0xB7, 0x81, 0x82, 0x51, 0xBB, 0x05, 0x5E, + 0x2A, 0x20, 0x64, 0x90, 0x4A, 0x79, 0xA7, 0x70, 0xFA, 0x15, 0xA2, 0x59, + 0xCB, 0xD5, 0x23, 0xA6, 0xA6, 0xEF, 0x09, 0xC4, 0x30, 0x48, 0xD5, 0xA2, + 0x2F, 0x97, 0x1F, 0x3C, 0x20, 0x12, 0x9B, 0x48, 0x00, 0x0E, 0x6E, 0xDD, + 0x06, 0x1C, 0xBC, 0x05, 0x3E, 0x37, 0x1D, 0x79, 0x4E, 0x53, 0x27, 0xDF, + 0x61, 0x1E, 0xBB, 0xBE, 0x1B, 0xAC, 0x9B, 0x5C, 0x60, 0x44, 0xCF, 0x02, + 0x3D, 0x76, 0xE0, 0x5E, 0xEA, 0x9B, 0xAD, 0x99, 0x1B, 0x13, 0xA6, 0x3C, + 0x97, 0x4E, 0x9E, 0xF1, 0x83, 0x9E, 0xB5, 0xDB, 0x12, 0x51, 0x36, 0xF7, + 0x26, 0x2E, 0x56, 0xA8, 0x87, 0x15, 0x38, 0xDF, 0xD8, 0x23, 0xC6, 0x50, + 0x50, 0x85, 0xE2, 0x1F, 0x0D, 0xD5, 0xC8, 0x6B, +}; + +/* dh1024 g */ +static const unsigned char dh_g[] = +{ + 0x02, +}; + +#if defined(NO_ASN) && defined(WOLFSSL_SP_MATH) +/* dh2048 p */ +static const unsigned char dh2048_p[] = +{ + 0xb0, 0xa1, 0x08, 0x06, 0x9c, 0x08, 0x13, 0xba, 0x59, 0x06, 0x3c, 0xbc, + 0x30, 0xd5, 0xf5, 0x00, 0xc1, 0x4f, 0x44, 0xa7, 0xd6, 0xef, 0x4a, 0xc6, + 0x25, 0x27, 0x1c, 0xe8, 0xd2, 0x96, 0x53, 0x0a, 0x5c, 0x91, 0xdd, 0xa2, + 0xc2, 0x94, 0x84, 0xbf, 0x7d, 0xb2, 0x44, 0x9f, 0x9b, 0xd2, 0xc1, 0x8a, + 0xc5, 0xbe, 0x72, 0x5c, 0xa7, 0xe7, 0x91, 0xe6, 0xd4, 0x9f, 0x73, 0x07, + 0x85, 0x5b, 0x66, 0x48, 0xc7, 0x70, 0xfa, 0xb4, 0xee, 0x02, 0xc9, 0x3d, + 0x9a, 0x4a, 0xda, 0x3d, 0xc1, 0x46, 0x3e, 0x19, 0x69, 0xd1, 0x17, 0x46, + 0x07, 0xa3, 0x4d, 0x9f, 0x2b, 0x96, 0x17, 0x39, 0x6d, 0x30, 0x8d, 0x2a, + 0xf3, 0x94, 0xd3, 0x75, 0xcf, 0xa0, 0x75, 0xe6, 0xf2, 0x92, 0x1f, 0x1a, + 0x70, 0x05, 0xaa, 0x04, 0x83, 0x57, 0x30, 0xfb, 0xda, 0x76, 0x93, 0x38, + 0x50, 0xe8, 0x27, 0xfd, 0x63, 0xee, 0x3c, 0xe5, 0xb7, 0xc8, 0x09, 0xae, + 0x6f, 0x50, 0x35, 0x8e, 0x84, 0xce, 0x4a, 0x00, 0xe9, 0x12, 0x7e, 0x5a, + 0x31, 0xd7, 0x33, 0xfc, 0x21, 0x13, 0x76, 0xcc, 0x16, 0x30, 0xdb, 0x0c, + 0xfc, 0xc5, 0x62, 0xa7, 0x35, 0xb8, 0xef, 0xb7, 0xb0, 0xac, 0xc0, 0x36, + 0xf6, 0xd9, 0xc9, 0x46, 0x48, 0xf9, 0x40, 0x90, 0x00, 0x2b, 0x1b, 0xaa, + 0x6c, 0xe3, 0x1a, 0xc3, 0x0b, 0x03, 0x9e, 0x1b, 0xc2, 0x46, 0xe4, 0x48, + 0x4e, 0x22, 0x73, 0x6f, 0xc3, 0x5f, 0xd4, 0x9a, 0xd6, 0x30, 0x07, 0x48, + 0xd6, 0x8c, 0x90, 0xab, 0xd4, 0xf6, 0xf1, 0xe3, 0x48, 0xd3, 0x58, 0x4b, + 0xa6, 0xb9, 0xcd, 0x29, 0xbf, 0x68, 0x1f, 0x08, 0x4b, 0x63, 0x86, 0x2f, + 0x5c, 0x6b, 0xd6, 0xb6, 0x06, 0x65, 0xf7, 0xa6, 0xdc, 0x00, 0x67, 0x6b, + 0xbb, 0xc3, 0xa9, 0x41, 0x83, 0xfb, 0xc7, 0xfa, 0xc8, 0xe2, 0x1e, 0x7e, + 0xaf, 0x00, 0x3f, 0x93 +}; + +/* dh2048 g */ +static const unsigned char dh2048_g[] = +{ + 0x02, +}; +#endif + +#if defined(HAVE_ED25519) + +/* ./certs/ed25519/server-ed25519.der, ED25519 */ +static const unsigned char server_ed25519_cert[] = +{ + 0x30, 0x82, 0x02, 0xA7, 0x30, 0x82, 0x02, 0x59, 0xA0, 0x03, + 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x30, 0x05, 0x06, 0x03, + 0x2B, 0x65, 0x70, 0x30, 0x81, 0xB4, 0x31, 0x0B, 0x30, 0x09, + 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, + 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, + 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, + 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, + 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x18, 0x30, 0x16, 0x06, + 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x0F, 0x77, 0x6F, 0x6C, 0x66, + 0x53, 0x53, 0x4C, 0x5F, 0x65, 0x64, 0x32, 0x35, 0x35, 0x31, + 0x39, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0B, + 0x0C, 0x0A, 0x43, 0x41, 0x2D, 0x65, 0x64, 0x32, 0x35, 0x35, + 0x31, 0x39, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, + 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, + 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, + 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, + 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x31, 0x17, 0x30, 0x15, 0x06, 0x0A, 0x09, 0x92, 0x26, + 0x89, 0x93, 0xF2, 0x2C, 0x64, 0x01, 0x01, 0x0C, 0x07, 0x77, + 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x30, 0x1E, 0x17, 0x0D, + 0x32, 0x34, 0x31, 0x32, 0x31, 0x38, 0x32, 0x31, 0x32, 0x35, + 0x33, 0x30, 0x5A, 0x17, 0x0D, 0x32, 0x37, 0x30, 0x39, 0x31, + 0x34, 0x32, 0x31, 0x32, 0x35, 0x33, 0x30, 0x5A, 0x30, 0x81, + 0xB8, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, + 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, + 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, + 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, + 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, + 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, + 0x0F, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x5F, 0x65, + 0x64, 0x32, 0x35, 0x35, 0x31, 0x39, 0x31, 0x17, 0x30, 0x15, + 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0E, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x2D, 0x65, 0x64, 0x32, 0x35, 0x35, 0x31, + 0x39, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, + 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, + 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, + 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, + 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, + 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, + 0x31, 0x17, 0x30, 0x15, 0x06, 0x0A, 0x09, 0x92, 0x26, 0x89, + 0x93, 0xF2, 0x2C, 0x64, 0x01, 0x01, 0x0C, 0x07, 0x77, 0x6F, + 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x30, 0x2A, 0x30, 0x05, 0x06, + 0x03, 0x2B, 0x65, 0x70, 0x03, 0x21, 0x00, 0x23, 0xAA, 0x4D, + 0x60, 0x50, 0xE0, 0x13, 0xD3, 0x3A, 0xED, 0xAB, 0xF6, 0xA9, + 0xCC, 0x4A, 0xFE, 0xD7, 0x4D, 0x2F, 0xD2, 0x5B, 0x1A, 0x10, + 0x05, 0xEF, 0x5A, 0x41, 0x25, 0xCE, 0x1B, 0x53, 0x78, 0xA3, + 0x81, 0x89, 0x30, 0x81, 0x86, 0x30, 0x1D, 0x06, 0x03, 0x55, + 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0xA3, 0x29, 0x81, 0xE7, + 0x90, 0x6F, 0xB9, 0x60, 0xF8, 0xAF, 0xCC, 0x15, 0x7A, 0xAE, + 0xD7, 0xA1, 0xF4, 0xB4, 0x86, 0xBA, 0x30, 0x1F, 0x06, 0x03, + 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x74, + 0xD5, 0x38, 0x19, 0x5E, 0x83, 0xB9, 0x03, 0xF8, 0x01, 0x8A, + 0x35, 0x35, 0xBB, 0x89, 0x4C, 0x49, 0xB4, 0x23, 0xE9, 0x30, + 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x01, 0x01, 0xFF, 0x04, + 0x02, 0x30, 0x00, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, + 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x03, 0xA8, 0x30, + 0x13, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04, 0x0C, 0x30, 0x0A, + 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01, + 0x30, 0x11, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x86, 0xF8, + 0x42, 0x01, 0x01, 0x04, 0x04, 0x03, 0x02, 0x06, 0x40, 0x30, + 0x05, 0x06, 0x03, 0x2B, 0x65, 0x70, 0x03, 0x41, 0x00, 0x04, + 0x19, 0x32, 0xE4, 0x24, 0xE5, 0xDF, 0x5A, 0xA4, 0x19, 0xC4, + 0x31, 0x15, 0x81, 0x05, 0x4C, 0x45, 0x0A, 0x40, 0x4A, 0x5D, + 0x6A, 0x8B, 0x0A, 0x77, 0x02, 0xFE, 0x48, 0x82, 0xD2, 0x83, + 0x8D, 0xDE, 0x42, 0xB8, 0xCF, 0x02, 0xDC, 0x64, 0x2C, 0xBD, + 0x8C, 0x9D, 0x22, 0x16, 0xD8, 0x7A, 0x23, 0x65, 0x5D, 0xB0, + 0x25, 0x92, 0xAC, 0xA8, 0x6C, 0xDE, 0xDF, 0x1D, 0xEB, 0x64, + 0xE4, 0x8A, 0x06 +}; +static const int sizeof_server_ed25519_cert = sizeof(server_ed25519_cert); + +/* ./certs/ed25519/server-ed25519-key.der, ED25519 */ +static const unsigned char server_ed25519_key[] = +{ + 0x30, 0x2A, 0x30, 0x05, 0x06, 0x03, 0x2B, 0x65, 0x70, 0x03, + 0x21, 0x00, 0x23, 0xAA, 0x4D, 0x60, 0x50, 0xE0, 0x13, 0xD3, + 0x3A, 0xED, 0xAB, 0xF6, 0xA9, 0xCC, 0x4A, 0xFE, 0xD7, 0x4D, + 0x2F, 0xD2, 0x5B, 0x1A, 0x10, 0x05, 0xEF, 0x5A, 0x41, 0x25, + 0xCE, 0x1B, 0x53, 0x78 +}; +static const int sizeof_server_ed25519_key = sizeof(server_ed25519_key); + +/* ./certs/ed25519/ca-ed25519.der, ED25519 */ +static const unsigned char ca_ed25519_cert[] = +{ + 0x30, 0x82, 0x02, 0x65, 0x30, 0x82, 0x02, 0x17, 0xA0, 0x03, + 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x30, 0x05, 0x06, 0x03, + 0x2B, 0x65, 0x70, 0x30, 0x81, 0x9D, 0x31, 0x0B, 0x30, 0x09, + 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, + 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, + 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, + 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, + 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x18, 0x30, 0x16, 0x06, + 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x0F, 0x77, 0x6F, 0x6C, 0x66, + 0x53, 0x53, 0x4C, 0x5F, 0x45, 0x64, 0x32, 0x35, 0x35, 0x31, + 0x39, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0B, + 0x0C, 0x0C, 0x52, 0x6F, 0x6F, 0x74, 0x2D, 0x45, 0x64, 0x32, + 0x35, 0x35, 0x31, 0x39, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, + 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, + 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, + 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, + 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, + 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, + 0x63, 0x6F, 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x32, 0x34, 0x31, + 0x32, 0x31, 0x38, 0x32, 0x31, 0x32, 0x35, 0x33, 0x30, 0x5A, + 0x17, 0x0D, 0x32, 0x37, 0x30, 0x39, 0x31, 0x34, 0x32, 0x31, + 0x32, 0x35, 0x33, 0x30, 0x5A, 0x30, 0x81, 0xB4, 0x31, 0x0B, + 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, + 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, + 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, + 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, + 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x18, 0x30, + 0x16, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x0F, 0x77, 0x6F, + 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x5F, 0x65, 0x64, 0x32, 0x35, + 0x35, 0x31, 0x39, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, + 0x04, 0x0B, 0x0C, 0x0A, 0x43, 0x41, 0x2D, 0x65, 0x64, 0x32, + 0x35, 0x35, 0x31, 0x39, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, + 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, + 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, + 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, + 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, + 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, + 0x63, 0x6F, 0x6D, 0x31, 0x17, 0x30, 0x15, 0x06, 0x0A, 0x09, + 0x92, 0x26, 0x89, 0x93, 0xF2, 0x2C, 0x64, 0x01, 0x01, 0x0C, + 0x07, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x30, 0x2A, + 0x30, 0x05, 0x06, 0x03, 0x2B, 0x65, 0x70, 0x03, 0x21, 0x00, + 0x42, 0x3B, 0x7A, 0xF9, 0x82, 0xCF, 0xF9, 0xDF, 0x19, 0xDD, + 0xF3, 0xF0, 0x32, 0x29, 0x6D, 0xFA, 0xFD, 0x76, 0x4F, 0x68, + 0xC2, 0xC2, 0xE0, 0x6C, 0x47, 0xAE, 0xC2, 0x55, 0x68, 0xAC, + 0x0D, 0x4D, 0xA3, 0x63, 0x30, 0x61, 0x30, 0x1D, 0x06, 0x03, + 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x74, 0xD5, 0x38, + 0x19, 0x5E, 0x83, 0xB9, 0x03, 0xF8, 0x01, 0x8A, 0x35, 0x35, + 0xBB, 0x89, 0x4C, 0x49, 0xB4, 0x23, 0xE9, 0x30, 0x1F, 0x06, + 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, + 0xFA, 0xBA, 0x5B, 0x76, 0x1D, 0xF1, 0x1D, 0x1D, 0x4D, 0x74, + 0x48, 0xD8, 0x98, 0x3B, 0x56, 0xEF, 0xB3, 0x14, 0xF3, 0xDE, + 0x30, 0x0F, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x01, 0x01, 0xFF, + 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xFF, 0x30, 0x0E, 0x06, + 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, + 0x02, 0x01, 0x86, 0x30, 0x05, 0x06, 0x03, 0x2B, 0x65, 0x70, + 0x03, 0x41, 0x00, 0x44, 0xEB, 0x38, 0xC6, 0x27, 0xD4, 0x70, + 0x42, 0x3F, 0x9B, 0xA0, 0xD7, 0x90, 0x96, 0xD6, 0x6E, 0x42, + 0x38, 0x5B, 0x38, 0x38, 0x9F, 0x21, 0xCA, 0xB0, 0xFA, 0x5E, + 0x7C, 0x17, 0xB4, 0x32, 0x5C, 0xB3, 0x08, 0xA2, 0x65, 0x50, + 0xD7, 0x65, 0x6B, 0xF8, 0xA9, 0xEF, 0x0D, 0xD1, 0x54, 0x2D, + 0x4D, 0xB6, 0x0F, 0x42, 0x9E, 0x51, 0xF7, 0xDB, 0xA7, 0xBF, + 0x16, 0x23, 0xC4, 0xBD, 0x7D, 0xC9, 0x03 +}; +static const int sizeof_ca_ed25519_cert = sizeof(ca_ed25519_cert); + +/* ./certs/ed25519/client-ed25519.der, ED25519 */ +static const unsigned char client_ed25519_cert[] = +{ + 0x30, 0x82, 0x03, 0x9F, 0x30, 0x82, 0x03, 0x51, 0xA0, 0x03, + 0x02, 0x01, 0x02, 0x02, 0x14, 0x33, 0x8B, 0x57, 0xD5, 0x8E, + 0x84, 0x67, 0x6A, 0xE1, 0xED, 0xF2, 0xB9, 0x11, 0x16, 0x5E, + 0x12, 0xE5, 0x0C, 0x78, 0x8A, 0x30, 0x05, 0x06, 0x03, 0x2B, + 0x65, 0x70, 0x30, 0x81, 0xB8, 0x31, 0x0B, 0x30, 0x09, 0x06, + 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, + 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, + 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, + 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, + 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, + 0x55, 0x04, 0x0A, 0x0C, 0x0F, 0x77, 0x6F, 0x6C, 0x66, 0x53, + 0x53, 0x4C, 0x5F, 0x65, 0x64, 0x32, 0x35, 0x35, 0x31, 0x39, + 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, + 0x0E, 0x43, 0x6C, 0x69, 0x65, 0x6E, 0x74, 0x2D, 0x65, 0x64, + 0x32, 0x35, 0x35, 0x31, 0x39, 0x31, 0x18, 0x30, 0x16, 0x06, + 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, + 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, + 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, + 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, + 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, + 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x17, 0x30, 0x15, 0x06, 0x0A, + 0x09, 0x92, 0x26, 0x89, 0x93, 0xF2, 0x2C, 0x64, 0x01, 0x01, + 0x0C, 0x07, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x30, + 0x1E, 0x17, 0x0D, 0x32, 0x34, 0x31, 0x32, 0x31, 0x38, 0x32, + 0x31, 0x32, 0x35, 0x33, 0x30, 0x5A, 0x17, 0x0D, 0x32, 0x37, + 0x30, 0x39, 0x31, 0x34, 0x32, 0x31, 0x32, 0x35, 0x33, 0x30, + 0x5A, 0x30, 0x81, 0xB8, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, + 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, + 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, + 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, + 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, + 0x6D, 0x61, 0x6E, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, + 0x04, 0x0A, 0x0C, 0x0F, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, + 0x4C, 0x5F, 0x65, 0x64, 0x32, 0x35, 0x35, 0x31, 0x39, 0x31, + 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0E, + 0x43, 0x6C, 0x69, 0x65, 0x6E, 0x74, 0x2D, 0x65, 0x64, 0x32, + 0x35, 0x35, 0x31, 0x39, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, + 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, + 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, + 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, + 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, + 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, + 0x63, 0x6F, 0x6D, 0x31, 0x17, 0x30, 0x15, 0x06, 0x0A, 0x09, + 0x92, 0x26, 0x89, 0x93, 0xF2, 0x2C, 0x64, 0x01, 0x01, 0x0C, + 0x07, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, 0x30, 0x2A, + 0x30, 0x05, 0x06, 0x03, 0x2B, 0x65, 0x70, 0x03, 0x21, 0x00, + 0xE6, 0x57, 0x5B, 0x13, 0x1B, 0xC7, 0x51, 0x14, 0x6B, 0xED, + 0x3B, 0xF5, 0xD1, 0xFA, 0xAB, 0x9E, 0x6C, 0xB6, 0xEB, 0x02, + 0x09, 0xA3, 0x99, 0xF5, 0x6E, 0xBF, 0x9D, 0x3C, 0xFE, 0x54, + 0x39, 0xE6, 0xA3, 0x82, 0x01, 0x69, 0x30, 0x82, 0x01, 0x65, + 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, + 0x14, 0xFE, 0x41, 0x5E, 0x3E, 0x81, 0xE2, 0x2E, 0x46, 0xB3, + 0x3E, 0x47, 0x89, 0x90, 0xD4, 0xC2, 0xB4, 0x8E, 0x11, 0xD6, + 0x8A, 0x30, 0x81, 0xF8, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, + 0x81, 0xF0, 0x30, 0x81, 0xED, 0x80, 0x14, 0xFE, 0x41, 0x5E, + 0x3E, 0x81, 0xE2, 0x2E, 0x46, 0xB3, 0x3E, 0x47, 0x89, 0x90, + 0xD4, 0xC2, 0xB4, 0x8E, 0x11, 0xD6, 0x8A, 0xA1, 0x81, 0xBE, + 0xA4, 0x81, 0xBB, 0x30, 0x81, 0xB8, 0x31, 0x0B, 0x30, 0x09, + 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, + 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, + 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, + 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42, 0x6F, + 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x18, 0x30, 0x16, 0x06, + 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x0F, 0x77, 0x6F, 0x6C, 0x66, + 0x53, 0x53, 0x4C, 0x5F, 0x65, 0x64, 0x32, 0x35, 0x35, 0x31, + 0x39, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x0B, + 0x0C, 0x0E, 0x43, 0x6C, 0x69, 0x65, 0x6E, 0x74, 0x2D, 0x65, + 0x64, 0x32, 0x35, 0x35, 0x31, 0x39, 0x31, 0x18, 0x30, 0x16, + 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77, + 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, + 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, + 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, + 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, + 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x17, 0x30, 0x15, 0x06, + 0x0A, 0x09, 0x92, 0x26, 0x89, 0x93, 0xF2, 0x2C, 0x64, 0x01, + 0x01, 0x0C, 0x07, 0x77, 0x6F, 0x6C, 0x66, 0x53, 0x53, 0x4C, + 0x82, 0x14, 0x33, 0x8B, 0x57, 0xD5, 0x8E, 0x84, 0x67, 0x6A, + 0xE1, 0xED, 0xF2, 0xB9, 0x11, 0x16, 0x5E, 0x12, 0xE5, 0x0C, + 0x78, 0x8A, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, + 0x05, 0x30, 0x03, 0x01, 0x01, 0xFF, 0x30, 0x1C, 0x06, 0x03, + 0x55, 0x1D, 0x11, 0x04, 0x15, 0x30, 0x13, 0x82, 0x0B, 0x65, + 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2E, 0x63, 0x6F, 0x6D, + 0x87, 0x04, 0x7F, 0x00, 0x00, 0x01, 0x30, 0x1D, 0x06, 0x03, + 0x55, 0x1D, 0x25, 0x04, 0x16, 0x30, 0x14, 0x06, 0x08, 0x2B, + 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01, 0x06, 0x08, 0x2B, + 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x02, 0x30, 0x05, 0x06, + 0x03, 0x2B, 0x65, 0x70, 0x03, 0x41, 0x00, 0xAA, 0xC7, 0xBD, + 0x8E, 0x56, 0x40, 0xAB, 0x7D, 0x9C, 0x55, 0xF0, 0x4D, 0x1D, + 0x97, 0xE9, 0x03, 0x62, 0x11, 0xCA, 0x51, 0xAD, 0x80, 0xCF, + 0x1A, 0x2C, 0x2C, 0x5B, 0x2D, 0x71, 0xFE, 0xDB, 0x1D, 0x4B, + 0xCD, 0x4B, 0x8B, 0x2D, 0x12, 0xF7, 0x01, 0xEE, 0xFB, 0x7D, + 0x2E, 0x21, 0xFC, 0x81, 0xDE, 0x84, 0x59, 0xC8, 0xA5, 0x1E, + 0x92, 0xE3, 0x21, 0x58, 0xD1, 0x3E, 0x8A, 0x71, 0x91, 0x2D, + 0x0E +}; +static const int sizeof_client_ed25519_cert = sizeof(client_ed25519_cert); + +/* ./certs/ed25519/client-ed25519-key.der, ED25519 */ +static const unsigned char client_ed25519_key[] = +{ + 0x30, 0x2A, 0x30, 0x05, 0x06, 0x03, 0x2B, 0x65, 0x70, 0x03, + 0x21, 0x00, 0xE6, 0x57, 0x5B, 0x13, 0x1B, 0xC7, 0x51, 0x14, + 0x6B, 0xED, 0x3B, 0xF5, 0xD1, 0xFA, 0xAB, 0x9E, 0x6C, 0xB6, + 0xEB, 0x02, 0x09, 0xA3, 0x99, 0xF5, 0x6E, 0xBF, 0x9D, 0x3C, + 0xFE, 0x54, 0x39, 0xE6 +}; +static const int sizeof_client_ed25519_key = sizeof(client_ed25519_key); + +#endif /* HAVE_ED25519 */ + +#if defined(USE_CERT_BUFFERS_25519) + +/* ./certs/statickeys/x25519.der, CURVE25519 */ +static const unsigned char x25519_statickey_der[] = +{ + 0x30, 0x2E, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06, 0x03, 0x2B, + 0x65, 0x6E, 0x04, 0x22, 0x04, 0x20, 0x78, 0x8E, 0x31, 0x5C, + 0x33, 0xA9, 0x19, 0xC0, 0x5E, 0x36, 0x70, 0x1B, 0xA4, 0xE8, + 0xEF, 0xC1, 0x89, 0x8C, 0xB3, 0x15, 0xC6, 0x79, 0xD3, 0xAC, + 0x22, 0x00, 0xAE, 0xFA, 0xB3, 0xB7, 0x0F, 0x78 +}; +static const int sizeof_x25519_statickey_der = sizeof(x25519_statickey_der); + +/* ./certs/statickeys/x25519-pub.der, CURVE25519 */ +static const unsigned char x25519_pub_statickey_der[] = +{ + 0x30, 0x2A, 0x30, 0x05, 0x06, 0x03, 0x2B, 0x65, 0x6E, 0x03, + 0x21, 0x00, 0x09, 0xBC, 0x8C, 0xC7, 0x45, 0x0D, 0xC1, 0xC2, + 0x02, 0x57, 0x9A, 0x68, 0x3A, 0xFD, 0x7A, 0xA8, 0xA5, 0x2F, + 0xF0, 0x99, 0x39, 0x98, 0xEA, 0x26, 0xA2, 0x5B, 0x38, 0xFD, + 0x96, 0xDB, 0x2A, 0x26 +}; +static const int sizeof_x25519_pub_statickey_der = sizeof(x25519_pub_statickey_der); + +#endif /* USE_CERT_BUFFERS_25519 */ + +#endif /* WOLFSSL_CERTS_TEST_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/crl.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/crl.h @@ -0,0 +1,58 @@ +/* crl.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + +#ifndef WOLFSSL_CRL_H +#define WOLFSSL_CRL_H + + +#ifdef HAVE_CRL + +#include <wolfssl/ssl.h> +#include <wolfssl/wolfcrypt/asn.h> + +#ifdef __cplusplus + extern "C" { +#endif + +WOLFSSL_LOCAL int InitCRL(WOLFSSL_CRL* crl, WOLFSSL_CERT_MANAGER* cm); +WOLFSSL_LOCAL void FreeCRL(WOLFSSL_CRL* crl, int dynamic); + +WOLFSSL_LOCAL int LoadCRL(WOLFSSL_CRL* crl, const char* path, int type, + int monitor); +WOLFSSL_LOCAL int BufferLoadCRL(WOLFSSL_CRL* crl, const byte* buff, long sz, + int type, int verify); +WOLFSSL_LOCAL int CheckCertCRL(WOLFSSL_CRL* crl, DecodedCert* cert); +WOLFSSL_LOCAL int CheckCertCRL_ex(WOLFSSL_CRL* crl, byte* issuerHash, + byte* serial, int serialSz, byte* serialHash, const byte* extCrlInfo, + int extCrlInfoSz, void* issuerName); +#ifdef HAVE_CRL_UPDATE_CB +WOLFSSL_LOCAL int GetCRLInfo(WOLFSSL_CRL* crl, CrlInfo* info, const byte* buff, + long sz, int type); +#endif + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* HAVE_CRL */ +#endif /* WOLFSSL_CRL_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/error-ssl.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/error-ssl.h @@ -0,0 +1,280 @@ +/* error-ssl.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + +#ifndef WOLFSSL_ERROR_H +#define WOLFSSL_ERROR_H + +#include <wolfssl/wolfcrypt/error-crypt.h> /* pull in wolfCrypt errors */ + +#ifdef __cplusplus + extern "C" { +#endif + +#ifdef WOLFSSL_DEBUG_TRACE_ERROR_CODES_H + #include <wolfssl/debug-untrace-error-codes.h> +#endif + +enum wolfSSL_ErrorCodes { + WOLFSSL_FATAL_ERROR = -1, /* must be -1 for backward compat. */ + + /* negative counterparts to namesake positive constants in ssl.h */ + WOLFSSL_ERROR_WANT_READ_E = -2, + WOLFSSL_ERROR_WANT_WRITE_E = -3, + WOLFSSL_ERROR_WANT_X509_LOOKUP_E = -4, + WOLFSSL_ERROR_SYSCALL_E = -5, + WOLFSSL_ERROR_ZERO_RETURN_E = -6, + WOLFSSL_ERROR_WANT_CONNECT_E = -7, + WOLFSSL_ERROR_WANT_ACCEPT_E = -8, + + WOLFSSL_FIRST_E = -301, /* start of native TLS codes */ + + INPUT_CASE_ERROR = -301, /* process input state error */ + PREFIX_ERROR = -302, /* bad index to key rounds */ + MEMORY_ERROR = -303, /* out of memory */ + VERIFY_FINISHED_ERROR = -304, /* verify problem on finished */ + VERIFY_MAC_ERROR = -305, /* verify mac problem */ + PARSE_ERROR = -306, /* parse error on header */ + UNKNOWN_HANDSHAKE_TYPE = -307, /* weird handshake type */ + SOCKET_ERROR_E = -308, /* error state on socket */ + SOCKET_NODATA = -309, /* expected data, not there */ + INCOMPLETE_DATA = -310, /* don't have enough data to + complete task */ + UNKNOWN_RECORD_TYPE = -311, /* unknown type in record hdr */ + DECRYPT_ERROR = -312, /* error during decryption */ + FATAL_ERROR = -313, /* recvd alert fatal error */ + ENCRYPT_ERROR = -314, /* error during encryption */ + FREAD_ERROR = -315, /* fread problem */ + NO_PEER_KEY = -316, /* need peer's key */ + NO_PRIVATE_KEY = -317, /* need the private key */ + RSA_PRIVATE_ERROR = -318, /* error during rsa priv op */ + NO_DH_PARAMS = -319, /* server missing DH params */ + BUILD_MSG_ERROR = -320, /* build message failure */ + BAD_HELLO = -321, /* client hello malformed */ + DOMAIN_NAME_MISMATCH = -322, /* peer subject name mismatch */ + WANT_READ = -323, /* want read, call again */ + NOT_READY_ERROR = -324, /* handshake layer not ready */ + IPADDR_MISMATCH = -325, /* peer ip address mismatch */ + VERSION_ERROR = -326, /* record layer version error */ + WANT_WRITE = -327, /* want write, call again */ + BUFFER_ERROR = -328, /* malformed buffer input */ + VERIFY_CERT_ERROR = -329, /* verify cert error */ + VERIFY_SIGN_ERROR = -330, /* verify sign error */ + CLIENT_ID_ERROR = -331, /* psk client identity error */ + SERVER_HINT_ERROR = -332, /* psk server hint error */ + PSK_KEY_ERROR = -333, /* psk key error */ + + GETTIME_ERROR = -337, /* gettimeofday failed ??? */ + GETITIMER_ERROR = -338, /* getitimer failed ??? */ + SIGACT_ERROR = -339, /* sigaction failed ??? */ + SETITIMER_ERROR = -340, /* setitimer failed ??? */ + LENGTH_ERROR = -341, /* record layer length error */ + PEER_KEY_ERROR = -342, /* can't decode peer key */ + ZERO_RETURN = -343, /* peer sent close notify */ + SIDE_ERROR = -344, /* wrong client/server type */ + NO_PEER_CERT = -345, /* peer didn't send key */ + + ECC_CURVETYPE_ERROR = -350, /* Bad ECC Curve Type */ + ECC_CURVE_ERROR = -351, /* Bad ECC Curve */ + ECC_PEERKEY_ERROR = -352, /* Bad Peer ECC Key */ + ECC_MAKEKEY_ERROR = -353, /* Bad Make ECC Key */ + ECC_EXPORT_ERROR = -354, /* Bad ECC Export Key */ + ECC_SHARED_ERROR = -355, /* Bad ECC Shared Secret */ + + NOT_CA_ERROR = -357, /* Not a CA cert error */ + + BAD_CERT_MANAGER_ERROR = -359, /* Bad Cert Manager */ + OCSP_CERT_REVOKED = -360, /* OCSP Certificate revoked */ + CRL_CERT_REVOKED = -361, /* CRL Certificate revoked */ + CRL_MISSING = -362, /* CRL Not loaded */ + MONITOR_SETUP_E = -363, /* CRL Monitor setup error */ + THREAD_CREATE_E = -364, /* Thread Create Error */ + OCSP_NEED_URL = -365, /* OCSP need an URL for lookup */ + OCSP_CERT_UNKNOWN = -366, /* OCSP responder doesn't know */ + OCSP_LOOKUP_FAIL = -367, /* OCSP lookup not successful */ + MAX_CHAIN_ERROR = -368, /* max chain depth exceeded */ + COOKIE_ERROR = -369, /* dtls cookie error */ + SEQUENCE_ERROR = -370, /* dtls sequence error */ + SUITES_ERROR = -371, /* suites pointer error */ + MAX_CERT_EXTENSIONS_ERR = -372, /* max cert extension exceeded */ + OUT_OF_ORDER_E = -373, /* out of order message */ + BAD_KEA_TYPE_E = -374, /* bad KEA type found */ + SANITY_CIPHER_E = -375, /* sanity check on cipher error */ + RECV_OVERFLOW_E = -376, /* RXCB returned more than read */ + GEN_COOKIE_E = -377, /* Generate Cookie Error */ + NO_PEER_VERIFY = -378, /* Need peer cert verify Error */ + FWRITE_ERROR = -379, /* fwrite problem */ + CACHE_MATCH_ERROR = -380, /* Cache hdr match error */ + UNKNOWN_SNI_HOST_NAME_E = -381, /* Unrecognized host name Error */ + UNKNOWN_MAX_FRAG_LEN_E = -382, /* Unrecognized max frag len Error */ + KEYUSE_SIGNATURE_E = -383, /* KeyUse digSignature error */ + + KEYUSE_ENCIPHER_E = -385, /* KeyUse keyEncipher error */ + EXTKEYUSE_AUTH_E = -386, /* ExtKeyUse server|client_auth */ + SEND_OOB_READ_E = -387, /* Send Cb out of bounds read */ + SECURE_RENEGOTIATION_E = -388, /* Invalid Renegotiation Info */ + SESSION_TICKET_LEN_E = -389, /* Session Ticket too large */ + SESSION_TICKET_EXPECT_E = -390, /* Session Ticket missing */ + SCR_DIFFERENT_CERT_E = -391, /* SCR Different cert error */ + SESSION_SECRET_CB_E = -392, /* Session secret Cb fcn failure */ + NO_CHANGE_CIPHER_E = -393, /* Finished before change cipher */ + SANITY_MSG_E = -394, /* Sanity check on msg order error */ + DUPLICATE_MSG_E = -395, /* Duplicate message error */ + SNI_UNSUPPORTED = -396, /* SSL 3.0 does not support SNI */ + SOCKET_PEER_CLOSED_E = -397, /* Underlying transport closed */ + BAD_TICKET_KEY_CB_SZ = -398, /* Bad session ticket key cb size */ + BAD_TICKET_MSG_SZ = -399, /* Bad session ticket msg size */ + BAD_TICKET_ENCRYPT = -400, /* Bad user ticket encrypt */ + DH_KEY_SIZE_E = -401, /* DH Key too small */ + SNI_ABSENT_ERROR = -402, /* No SNI request. */ + RSA_SIGN_FAULT = -403, /* RSA Sign fault */ + HANDSHAKE_SIZE_ERROR = -404, /* Handshake message too large */ + UNKNOWN_ALPN_PROTOCOL_NAME_E = -405, /* Unrecognized protocol name Error*/ + BAD_CERTIFICATE_STATUS_ERROR = -406, /* Bad certificate status message */ + OCSP_INVALID_STATUS = -407, /* Invalid OCSP Status */ + OCSP_WANT_READ = -408, /* OCSP callback response WOLFSSL_CBIO_ERR_WANT_READ */ + RSA_KEY_SIZE_E = -409, /* RSA key too small */ + ECC_KEY_SIZE_E = -410, /* ECC key too small */ + DTLS_EXPORT_VER_E = -411, /* export version error */ + INPUT_SIZE_E = -412, /* input size too big error */ + CTX_INIT_MUTEX_E = -413, /* initialize ctx mutex error */ + EXT_MASTER_SECRET_NEEDED_E = -414, /* need EMS enabled to resume */ + DTLS_POOL_SZ_E = -415, /* exceeded DTLS pool size */ + DECODE_E = -416, /* decode handshake message error */ + HTTP_TIMEOUT = -417, /* HTTP timeout for OCSP or CRL req */ + WRITE_DUP_READ_E = -418, /* Write dup write side can't read */ + WRITE_DUP_WRITE_E = -419, /* Write dup read side can't write */ + INVALID_CERT_CTX_E = -420, /* TLS cert ctx not matching */ + BAD_KEY_SHARE_DATA = -421, /* Key Share data invalid */ + MISSING_HANDSHAKE_DATA = -422, /* Handshake message missing data */ + BAD_BINDER = -423, /* Binder does not match */ + EXT_NOT_ALLOWED = -424, /* Extension not allowed in msg */ + INVALID_PARAMETER = -425, /* Security parameter invalid */ + MCAST_HIGHWATER_CB_E = -426, /* Multicast highwater cb err */ + ALERT_COUNT_E = -427, /* Alert Count exceeded err */ + EXT_MISSING = -428, /* Required extension not found */ + UNSUPPORTED_EXTENSION = -429, /* TLSX not requested by client */ + PRF_MISSING = -430, /* PRF not compiled in */ + DTLS_RETX_OVER_TX = -431, /* Retransmit DTLS flight over */ + DH_PARAMS_NOT_FFDHE_E = -432, /* DH params from server not FFDHE */ + TCA_INVALID_ID_TYPE = -433, /* TLSX TCA ID type invalid */ + TCA_ABSENT_ERROR = -434, /* TLSX TCA ID no response */ + TSIP_MAC_DIGSZ_E = -435, /* Invalid MAC size for TSIP */ + CLIENT_CERT_CB_ERROR = -436, /* Client cert callback error */ + SSL_SHUTDOWN_ALREADY_DONE_E = -437, /* Shutdown called redundantly */ + TLS13_SECRET_CB_E = -438, /* TLS1.3 secret Cb fcn failure */ + DTLS_SIZE_ERROR = -439, /* Trying to send too much data */ + NO_CERT_ERROR = -440, /* TLS1.3 - no cert set error */ + APP_DATA_READY = -441, /* DTLS1.2 application data ready for read */ + TOO_MUCH_EARLY_DATA = -442, /* Too much Early data */ + SOCKET_FILTERED_E = -443, /* Session stopped by network filter */ + HTTP_RECV_ERR = -444, /* HTTP Receive error */ + HTTP_HEADER_ERR = -445, /* HTTP Header error */ + HTTP_PROTO_ERR = -446, /* HTTP Protocol error */ + HTTP_STATUS_ERR = -447, /* HTTP Status error */ + HTTP_VERSION_ERR = -448, /* HTTP Version error */ + HTTP_APPSTR_ERR = -449, /* HTTP Application string error */ + UNSUPPORTED_PROTO_VERSION = -450, /* bad/unsupported protocol version*/ + FALCON_KEY_SIZE_E = -451, /* Wrong key size for Falcon. */ + QUIC_TP_MISSING_E = -452, /* QUIC transport parameter missing */ + DILITHIUM_KEY_SIZE_E = -453, /* Wrong key size for Dilithium. */ + DTLS_CID_ERROR = -454, /* Wrong or missing CID */ + DTLS_TOO_MANY_FRAGMENTS_E = -455, /* Received too many fragments */ + QUIC_WRONG_ENC_LEVEL = -456, /* QUIC data received on wrong encryption level */ + DUPLICATE_TLS_EXT_E = -457, /* Duplicate TLS extension in msg. */ + + /* legacy CyaSSL compat layer error codes */ + WOLFSSL_ALPN_NOT_FOUND = -458, /* TLS extension not found */ + WOLFSSL_BAD_CERTTYPE = -459, /* Certificate type not supported */ + WOLFSSL_BAD_STAT = -460, /* not used */ + WOLFSSL_BAD_PATH = -461, /* No certificates found at designated path */ + WOLFSSL_BAD_FILETYPE = -462, /* Data format not supported */ + WOLFSSL_BAD_FILE = -463, /* Input/output error on file */ + WOLFSSL_NOT_IMPLEMENTED = -464, /* Function not implemented */ + WOLFSSL_UNKNOWN = -465, /* Unknown algorithm (EVP) */ + + /* negotiation parameter errors */ + UNSUPPORTED_SUITE = -500, /* unsupported cipher suite */ + MATCH_SUITE_ERROR = -501, /* can't match cipher suite */ + COMPRESSION_ERROR = -502, /* compression mismatch */ + KEY_SHARE_ERROR = -503, /* key share mismatch */ + POST_HAND_AUTH_ERROR = -504, /* client won't do post-hand auth */ + HRR_COOKIE_ERROR = -505, /* HRR msg cookie mismatch */ + UNSUPPORTED_CERTIFICATE = -506, /* unsupported certificate type */ + DTLS_PARTIAL_RECORD_READ = -455, /* received a partial record in a datagram */ + + /* PEM and EVP errors */ + WOLFSSL_PEM_R_NO_START_LINE_E = -507, + WOLFSSL_PEM_R_PROBLEMS_GETTING_PASSWORD_E = -508, + WOLFSSL_PEM_R_BAD_PASSWORD_READ_E = -509, + WOLFSSL_PEM_R_BAD_DECRYPT_E = -510, + WOLFSSL_ASN1_R_HEADER_TOO_LONG_E = -511, + + WOLFSSL_EVP_R_BAD_DECRYPT_E = -512, + WOLFSSL_EVP_R_BN_DECODE_ERROR = -513, + WOLFSSL_EVP_R_DECODE_ERROR = -514, + WOLFSSL_EVP_R_PRIVATE_KEY_DECODE_ERROR = -515, + + CRYPTO_POLICY_FORBIDDEN = -516, /* operation forbidden by system + * crypto-policy */ + + WOLFSSL_LAST_E = -516 + + /* codes -1000 to -1999 are reserved for wolfCrypt. */ +}; + +wc_static_assert((int)WC_LAST_E <= (int)WOLFSSL_LAST_E); + +/* I/O Callback default errors */ +enum IOerrors { + WOLFSSL_CBIO_ERR_GENERAL = -1, /* general unexpected err */ + WOLFSSL_CBIO_ERR_WANT_READ = -2, /* need to call read again */ + WOLFSSL_CBIO_ERR_WANT_WRITE = -2, /* need to call write again */ + WOLFSSL_CBIO_ERR_CONN_RST = -3, /* connection reset */ + WOLFSSL_CBIO_ERR_ISR = -4, /* interrupt */ + WOLFSSL_CBIO_ERR_CONN_CLOSE = -5, /* connection closed or epipe */ + WOLFSSL_CBIO_ERR_TIMEOUT = -6 /* socket timeout */ +}; + +#if defined(WOLFSSL_CALLBACKS) || defined(OPENSSL_EXTRA) + enum { + MIN_PARAM_ERR = UNSUPPORTED_SUITE, + MAX_PARAM_ERR = MIN_PARAM_ERR - 10 + }; +#endif + + +WOLFSSL_LOCAL +void SetErrorString(int err, char* buff); + +#if defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES) && \ + (defined(BUILDING_WOLFSSL) || \ + defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES_ALWAYS)) + #include <wolfssl/debug-trace-error-codes.h> +#endif + +#ifdef __cplusplus + } /* extern "C" */ +#endif + + +#endif /* wolfSSL_ERROR_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/ocsp.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/ocsp.h @@ -0,0 +1,183 @@ +/* ocsp.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + +/* wolfSSL OCSP API */ + +#ifndef WOLFSSL_OCSP_H +#define WOLFSSL_OCSP_H + +#ifdef HAVE_OCSP + +#include <wolfssl/ssl.h> +#include <wolfssl/wolfcrypt/asn.h> + +#ifdef __cplusplus + extern "C" { +#endif + +typedef struct WOLFSSL_OCSP WOLFSSL_OCSP; + +#if defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA) || defined(WOLFSSL_NGINX) ||\ + defined(WOLFSSL_HAPROXY) || defined(HAVE_LIGHTY) +typedef struct OcspResponse WOLFSSL_OCSP_BASICRESP; + +typedef struct OcspEntry WOLFSSL_OCSP_CERTID; + +typedef struct OcspEntry WOLFSSL_OCSP_SINGLERESP; + +typedef struct OcspRequest WOLFSSL_OCSP_ONEREQ; + +typedef struct OcspRequest WOLFSSL_OCSP_REQUEST; + +typedef struct { + WOLFSSL_BIO *bio; + WOLFSSL_BIO *reqResp; /* First used for request then for response */ + byte* buf; + int bufLen; + int state; + int ioState; + int sent; +} WOLFSSL_OCSP_REQ_CTX; +#endif + +WOLFSSL_LOCAL int InitOCSP(WOLFSSL_OCSP* ocsp, WOLFSSL_CERT_MANAGER* cm); +WOLFSSL_LOCAL void FreeOCSP(WOLFSSL_OCSP* ocsp, int dynamic); + +WOLFSSL_LOCAL int CheckCertOCSP(WOLFSSL_OCSP* ocsp, DecodedCert* cert); +WOLFSSL_LOCAL int CheckCertOCSP_ex(WOLFSSL_OCSP* ocsp, DecodedCert* cert, + WOLFSSL* ssl); +WOLFSSL_LOCAL int CheckOcspRequest(WOLFSSL_OCSP* ocsp, + OcspRequest* ocspRequest, WOLFSSL_BUFFER_INFO* responseBuffer, + void* heap); +WOLFSSL_LOCAL int CheckOcspResponse(WOLFSSL_OCSP *ocsp, byte *response, int responseSz, + WOLFSSL_BUFFER_INFO *responseBuffer, CertStatus *status, + OcspEntry *entry, OcspRequest *ocspRequest, + void* heap); + +WOLFSSL_LOCAL int CheckOcspResponder(OcspResponse *bs, DecodedCert *cert, + void* vp); + +#ifdef OPENSSL_EXTRA +WOLFSSL_API int wolfSSL_OCSP_resp_find_status(WOLFSSL_OCSP_BASICRESP *bs, + WOLFSSL_OCSP_CERTID *id, int *status, int *reason, + WOLFSSL_ASN1_TIME **revtime, WOLFSSL_ASN1_TIME **thisupd, + WOLFSSL_ASN1_TIME **nextupd); +WOLFSSL_API const char *wolfSSL_OCSP_cert_status_str(long s); +WOLFSSL_API int wolfSSL_OCSP_check_validity(WOLFSSL_ASN1_TIME* thisupd, + WOLFSSL_ASN1_TIME* nextupd, long sec, long maxsec); + +WOLFSSL_API void wolfSSL_OCSP_CERTID_free(WOLFSSL_OCSP_CERTID* certId); +WOLFSSL_API WOLFSSL_OCSP_CERTID* wolfSSL_OCSP_cert_to_id( + const WOLFSSL_EVP_MD *dgst, const WOLFSSL_X509 *subject, + const WOLFSSL_X509 *issuer); + +WOLFSSL_API void wolfSSL_OCSP_BASICRESP_free(WOLFSSL_OCSP_BASICRESP* basicResponse); +WOLFSSL_API int wolfSSL_OCSP_basic_verify(WOLFSSL_OCSP_BASICRESP *bs, + WOLF_STACK_OF(WOLFSSL_X509) *certs, WOLFSSL_X509_STORE *st, unsigned long flags); + +WOLFSSL_API void wolfSSL_OCSP_RESPONSE_free(OcspResponse* response); +#ifndef NO_BIO +WOLFSSL_API OcspResponse* wolfSSL_d2i_OCSP_RESPONSE_bio(WOLFSSL_BIO* bio, + OcspResponse** response); +#endif +WOLFSSL_API OcspResponse* wolfSSL_d2i_OCSP_RESPONSE(OcspResponse** response, + const unsigned char** data, int len); +WOLFSSL_API int wolfSSL_i2d_OCSP_RESPONSE(OcspResponse* response, + unsigned char** data); +WOLFSSL_API int wolfSSL_OCSP_response_status(OcspResponse *response); +WOLFSSL_API const char *wolfSSL_OCSP_response_status_str(long s); +WOLFSSL_API WOLFSSL_OCSP_BASICRESP* wolfSSL_OCSP_response_get1_basic( + OcspResponse* response); + +WOLFSSL_API OcspRequest* wolfSSL_OCSP_REQUEST_new(void); +WOLFSSL_API void wolfSSL_OCSP_REQUEST_free(OcspRequest* request); +WOLFSSL_API int wolfSSL_i2d_OCSP_REQUEST(OcspRequest* request, + unsigned char** data); +WOLFSSL_API WOLFSSL_OCSP_ONEREQ* wolfSSL_OCSP_request_add0_id(OcspRequest *req, + WOLFSSL_OCSP_CERTID *cid); +WOLFSSL_API WOLFSSL_OCSP_CERTID* wolfSSL_OCSP_CERTID_dup( + WOLFSSL_OCSP_CERTID* id); +#ifndef NO_BIO +WOLFSSL_API int wolfSSL_i2d_OCSP_REQUEST_bio(WOLFSSL_BIO* out, + WOLFSSL_OCSP_REQUEST *req); +#endif + +WOLFSSL_API int wolfSSL_i2d_OCSP_CERTID(WOLFSSL_OCSP_CERTID* id, + unsigned char** data); +WOLFSSL_API +WOLFSSL_OCSP_CERTID* wolfSSL_d2i_OCSP_CERTID(WOLFSSL_OCSP_CERTID** cidOut, + const unsigned char** derIn, + int length); +WOLFSSL_API const WOLFSSL_OCSP_CERTID* wolfSSL_OCSP_SINGLERESP_get0_id( + const WOLFSSL_OCSP_SINGLERESP *single); +WOLFSSL_API int wolfSSL_OCSP_id_cmp(WOLFSSL_OCSP_CERTID *a, WOLFSSL_OCSP_CERTID *b); +WOLFSSL_API int wolfSSL_OCSP_single_get0_status(WOLFSSL_OCSP_SINGLERESP *single, + int *reason, + WOLFSSL_ASN1_TIME **revtime, + WOLFSSL_ASN1_TIME **thisupd, + WOLFSSL_ASN1_TIME **nextupd); +WOLFSSL_API int wolfSSL_OCSP_resp_count(WOLFSSL_OCSP_BASICRESP *bs); +WOLFSSL_API WOLFSSL_OCSP_SINGLERESP* wolfSSL_OCSP_resp_get0( + WOLFSSL_OCSP_BASICRESP *bs, int idx); + +WOLFSSL_API WOLFSSL_OCSP_REQ_CTX* wolfSSL_OCSP_REQ_CTX_new(WOLFSSL_BIO *bio, + int maxline); +WOLFSSL_API void wolfSSL_OCSP_REQ_CTX_free(WOLFSSL_OCSP_REQ_CTX *ctx); +WOLFSSL_API WOLFSSL_OCSP_REQ_CTX *wolfSSL_OCSP_sendreq_new(WOLFSSL_BIO *bio, + const char *path, OcspRequest *req, int maxline); +WOLFSSL_API int wolfSSL_OCSP_REQ_CTX_set1_req(WOLFSSL_OCSP_REQ_CTX *ctx, + OcspRequest *req); +WOLFSSL_API int wolfSSL_OCSP_REQ_CTX_add1_header(WOLFSSL_OCSP_REQ_CTX *ctx, + const char *name, const char *value); +WOLFSSL_API int wolfSSL_OCSP_REQ_CTX_http(WOLFSSL_OCSP_REQ_CTX *ctx, + const char *op, const char *path); +WOLFSSL_API int wolfSSL_OCSP_REQ_CTX_nbio(WOLFSSL_OCSP_REQ_CTX *ctx); +WOLFSSL_API int wolfSSL_OCSP_sendreq_nbio(OcspResponse **presp, + WOLFSSL_OCSP_REQ_CTX *rctx); + +WOLFSSL_API int wolfSSL_OCSP_REQUEST_add_ext(OcspRequest* req, + WOLFSSL_X509_EXTENSION* ext, int idx); +WOLFSSL_API OcspResponse* wolfSSL_OCSP_response_create(int status, + WOLFSSL_OCSP_BASICRESP* bs); +WOLFSSL_API const char* wolfSSL_OCSP_crl_reason_str(long s); + +WOLFSSL_API int wolfSSL_OCSP_id_get0_info(WOLFSSL_ASN1_STRING **name, + WOLFSSL_ASN1_OBJECT **pmd, WOLFSSL_ASN1_STRING **keyHash, + WOLFSSL_ASN1_INTEGER **serial, WOLFSSL_OCSP_CERTID *cid); + +WOLFSSL_API int wolfSSL_OCSP_request_add1_nonce(OcspRequest* req, + unsigned char* val, int sz); +WOLFSSL_API int wolfSSL_OCSP_check_nonce(OcspRequest* req, + WOLFSSL_OCSP_BASICRESP* bs); +#endif /* OPENSSL_EXTRA */ + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + + +#endif /* HAVE_OCSP */ +#endif /* WOLFSSL_OCSP_H */ + + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/aes.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/aes.h @@ -0,0 +1,117 @@ +/* aes.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + +/* aes.h defines mini des openssl compatibility layer + * + */ + + +#ifndef WOLFSSL_AES_H_ +#define WOLFSSL_AES_H_ + +#include <wolfssl/wolfcrypt/settings.h> + +#ifndef NO_AES +#include <wolfssl/wolfcrypt/aes.h> + +#if !defined(WOLFSSL_NO_OPENSSL_AES_LOW_LEVEL_API) && \ + defined(WC_AESFREE_IS_MANDATORY) +#define WOLFSSL_NO_OPENSSL_AES_LOW_LEVEL_API +#endif + +#ifndef WOLFSSL_NO_OPENSSL_AES_LOW_LEVEL_API + +#include <wolfssl/openssl/ssl.h> /* for size_t */ + +#ifdef __cplusplus + extern "C" { +#endif + +/* This structure wrapper is done because there is no aes_new function with + * OpenSSL compatibility layer. This makes code working with an AES structure + * to need the size of the structure. */ +typedef struct WOLFSSL_AES_KEY { + ALIGN16 void *buf[(sizeof(Aes) / sizeof(void *)) + 1]; +} WOLFSSL_AES_KEY; + +WOLFSSL_API int wolfSSL_AES_set_encrypt_key( + const unsigned char *key, const int bits, WOLFSSL_AES_KEY *aes); +WOLFSSL_API int wolfSSL_AES_set_decrypt_key( + const unsigned char *key, const int bits, WOLFSSL_AES_KEY *aes); +WOLFSSL_API void wolfSSL_AES_cbc_encrypt( + const unsigned char *in, unsigned char* out, size_t len, WOLFSSL_AES_KEY *key, + unsigned char* iv, const int enc); +WOLFSSL_API void wolfSSL_AES_ecb_encrypt( + const unsigned char *in, unsigned char* out, WOLFSSL_AES_KEY *key, const int enc); +WOLFSSL_API void wolfSSL_AES_cfb128_encrypt( + const unsigned char *in, unsigned char* out, size_t len, WOLFSSL_AES_KEY *key, + unsigned char* iv, int* num, const int enc); +WOLFSSL_API int wolfSSL_AES_wrap_key( + WOLFSSL_AES_KEY *key, const unsigned char *iv, unsigned char *out, + const unsigned char *in, unsigned int inlen); +WOLFSSL_API int wolfSSL_AES_unwrap_key( + WOLFSSL_AES_KEY *key, const unsigned char *iv, unsigned char *out, + const unsigned char *in, unsigned int inlen); + +#ifdef WOLFSSL_AES_DIRECT +WOLFSSL_API void wolfSSL_AES_encrypt( + const unsigned char* input, unsigned char* output, WOLFSSL_AES_KEY *key); +WOLFSSL_API void wolfSSL_AES_decrypt( + const unsigned char* input, unsigned char* output, WOLFSSL_AES_KEY *key); +#endif /* WOLFSSL_AES_DIRECT */ + +#ifndef OPENSSL_COEXIST + +typedef WOLFSSL_AES_KEY AES_KEY; + +#define AES_cbc_encrypt wolfSSL_AES_cbc_encrypt +#define AES_ecb_encrypt wolfSSL_AES_ecb_encrypt +#define AES_cfb128_encrypt wolfSSL_AES_cfb128_encrypt +#define AES_set_encrypt_key wolfSSL_AES_set_encrypt_key +#define AES_set_decrypt_key wolfSSL_AES_set_decrypt_key +#define AES_wrap_key wolfSSL_AES_wrap_key +#define AES_unwrap_key wolfSSL_AES_unwrap_key + +#ifdef WOLFSSL_AES_DIRECT +#define AES_encrypt wolfSSL_AES_encrypt +#define AES_decrypt wolfSSL_AES_decrypt +#endif /* WOLFSSL_AES_DIRECT */ + +#ifndef AES_ENCRYPT +#define AES_ENCRYPT AES_ENCRYPTION +#endif +#ifndef AES_DECRYPT +#define AES_DECRYPT AES_DECRYPTION +#endif + +#endif /* !OPENSSL_COEXIST */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* !WOLFSSL_NO_OPENSSL_AES_LOW_LEVEL_API */ + +#endif /* NO_AES */ + +#endif /* WOLFSSL_AES_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/asn1.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/asn1.h @@ -0,0 +1,315 @@ +/* asn1.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* asn1.h for openssl */ + +#ifndef WOLFSSL_ASN1_H_ +#define WOLFSSL_ASN1_H_ + +#include <wolfssl/openssl/ssl.h> + +#ifndef OPENSSL_COEXIST + +#define ASN1_STRING_new wolfSSL_ASN1_STRING_new +#define ASN1_STRING_type_new wolfSSL_ASN1_STRING_type_new +#define ASN1_STRING_type wolfSSL_ASN1_STRING_type +#define ASN1_STRING_set wolfSSL_ASN1_STRING_set +#define ASN1_OCTET_STRING_set wolfSSL_ASN1_STRING_set +#define ASN1_STRING_free wolfSSL_ASN1_STRING_free + +#define ASN1_get_object wolfSSL_ASN1_get_object +#define d2i_ASN1_OBJECT wolfSSL_d2i_ASN1_OBJECT +#define c2i_ASN1_OBJECT wolfSSL_c2i_ASN1_OBJECT + +#define V_ASN1_BIT_STRING WOLFSSL_V_ASN1_BIT_STRING +#define V_ASN1_INTEGER WOLFSSL_V_ASN1_INTEGER +#define V_ASN1_NEG WOLFSSL_V_ASN1_NEG +#define V_ASN1_NEG_INTEGER WOLFSSL_V_ASN1_NEG_INTEGER +#define V_ASN1_NEG_ENUMERATED WOLFSSL_V_ASN1_NEG_ENUMERATED + +/* Type for ASN1_print_ex */ +#define ASN1_STRFLGS_ESC_2253 WOLFSSL_ASN1_STRFLGS_ESC_2253 +#define ASN1_STRFLGS_ESC_CTRL WOLFSSL_ASN1_STRFLGS_ESC_CTRL +#define ASN1_STRFLGS_ESC_MSB WOLFSSL_ASN1_STRFLGS_ESC_MSB +#define ASN1_STRFLGS_ESC_QUOTE WOLFSSL_ASN1_STRFLGS_ESC_QUOTE +#define ASN1_STRFLGS_UTF8_CONVERT WOLFSSL_ASN1_STRFLGS_UTF8_CONVERT +#define ASN1_STRFLGS_IGNORE_TYPE WOLFSSL_ASN1_STRFLGS_IGNORE_TYPE +#define ASN1_STRFLGS_SHOW_TYPE WOLFSSL_ASN1_STRFLGS_SHOW_TYPE +#define ASN1_STRFLGS_DUMP_ALL WOLFSSL_ASN1_STRFLGS_DUMP_ALL +#define ASN1_STRFLGS_DUMP_UNKNOWN WOLFSSL_ASN1_STRFLGS_DUMP_UNKNOWN +#define ASN1_STRFLGS_DUMP_DER WOLFSSL_ASN1_STRFLGS_DUMP_DER +#define ASN1_STRFLGS_RFC2253 WOLFSSL_ASN1_STRFLGS_RFC2253 + +#define MBSTRING_UTF8 WOLFSSL_MBSTRING_UTF8 +#define MBSTRING_ASC WOLFSSL_MBSTRING_ASC +#define MBSTRING_BMP WOLFSSL_MBSTRING_BMP +#define MBSTRING_UNIV WOLFSSL_MBSTRING_UNIV + +#define ASN1_UTCTIME_print wolfSSL_ASN1_UTCTIME_print +#define ASN1_TIME_check wolfSSL_ASN1_TIME_check +#define ASN1_TIME_diff wolfSSL_ASN1_TIME_diff +#define ASN1_TIME_compare wolfSSL_ASN1_TIME_compare +#define ASN1_TIME_set wolfSSL_ASN1_TIME_set + +#define V_ASN1_EOC WOLFSSL_V_ASN1_EOC +#define V_ASN1_BOOLEAN WOLFSSL_V_ASN1_BOOLEAN +#define V_ASN1_OCTET_STRING WOLFSSL_V_ASN1_OCTET_STRING +#define V_ASN1_NULL WOLFSSL_V_ASN1_NULL +#define V_ASN1_OBJECT WOLFSSL_V_ASN1_OBJECT +#define V_ASN1_UTF8STRING WOLFSSL_V_ASN1_UTF8STRING +#define V_ASN1_SEQUENCE WOLFSSL_V_ASN1_SEQUENCE +#define V_ASN1_SET WOLFSSL_V_ASN1_SET +#define V_ASN1_PRINTABLESTRING WOLFSSL_V_ASN1_PRINTABLESTRING +#define V_ASN1_T61STRING WOLFSSL_V_ASN1_T61STRING +#define V_ASN1_IA5STRING WOLFSSL_V_ASN1_IA5STRING +#define V_ASN1_UTCTIME WOLFSSL_V_ASN1_UTCTIME +#define V_ASN1_GENERALIZEDTIME WOLFSSL_V_ASN1_GENERALIZEDTIME +#define V_ASN1_UNIVERSALSTRING WOLFSSL_V_ASN1_UNIVERSALSTRING +#define V_ASN1_BMPSTRING WOLFSSL_V_ASN1_BMPSTRING + +#define V_ASN1_CONSTRUCTED WOLFSSL_V_ASN1_CONSTRUCTED + +#define ASN1_STRING_FLAG_BITS_LEFT WOLFSSL_ASN1_STRING_FLAG_BITS_LEFT +#define ASN1_STRING_FLAG_NDEF WOLFSSL_ASN1_STRING_FLAG_NDEF +#define ASN1_STRING_FLAG_CONT WOLFSSL_ASN1_STRING_FLAG_CONT +#define ASN1_STRING_FLAG_MSTRING WOLFSSL_ASN1_STRING_FLAG_MSTRING +#define ASN1_STRING_FLAG_EMBED WOLFSSL_ASN1_STRING_FLAG_EMBED + +/* X.509 PKI size limits from RFC2459 (appendix A) */ +/* internally our limit is CTC_NAME_SIZE (64) - overridden with WC_CTC_NAME_SIZE */ +#define ub_name WOLFSSL_ub_name +#define ub_common_name WOLFSSL_ub_common_name +#define ub_locality_name WOLFSSL_ub_locality_name +#define ub_state_name WOLFSSL_ub_state_name +#define ub_organization_name WOLFSSL_ub_organization_name +#define ub_organization_unit_name WOLFSSL_ub_organization_unit_name +#define ub_title WOLFSSL_ub_title +#define ub_email_address WOLFSSL_ub_email_address + +#endif /* !OPENSSL_COEXIST */ + +WOLFSSL_API WOLFSSL_ASN1_INTEGER *wolfSSL_BN_to_ASN1_INTEGER( + const WOLFSSL_BIGNUM *bn, WOLFSSL_ASN1_INTEGER *ai); + +WOLFSSL_API void wolfSSL_ASN1_TYPE_set(WOLFSSL_ASN1_TYPE *a, int type, void *value); +WOLFSSL_API int wolfSSL_ASN1_TYPE_get(const WOLFSSL_ASN1_TYPE *a); + +WOLFSSL_API int wolfSSL_ASN1_get_object(const unsigned char **in, long *len, int *tag, + int *cls, long inLen); + +WOLFSSL_API WOLFSSL_ASN1_OBJECT *wolfSSL_c2i_ASN1_OBJECT(WOLFSSL_ASN1_OBJECT **a, + const unsigned char **pp, long len); + +#ifdef OPENSSL_ALL +/* IMPLEMENT_ASN1_FUNCTIONS is strictly for external use only. Internally + * we don't use this. Some projects use OpenSSL to implement ASN1 types and + * this section is only to provide those projects with ASN1 functionality. */ + +typedef void* (*WolfsslAsn1NewCb)(void); +typedef void (*WolfsslAsn1FreeCb)(void*); +typedef int (*WolfsslAsn1i2dCb)(const void*, unsigned char**); +typedef void* (*WolfsslAsn1d2iCb)(void**, const byte **, long); + +struct WOLFSSL_ASN1_TEMPLATE { + /* Type functions */ + WolfsslAsn1NewCb new_func; + WolfsslAsn1FreeCb free_func; + WolfsslAsn1i2dCb i2d_func; + WolfsslAsn1d2iCb d2i_func; + /* Member info */ + size_t offset; /* Offset of this field in structure */ + /* DER info */ + int tag; + byte first_byte; /* First expected byte. Required for + * IMPLICIT types. */ + byte ex:1; /* explicit, name conflicts with C++ keyword */ + byte sequence:1; +}; + +enum WOLFSSL_ASN1_TYPES { + WOLFSSL_ASN1_SEQUENCE = 0, + WOLFSSL_ASN1_CHOICE, + WOLFSSL_ASN1_OBJECT_TYPE, +}; + +struct WOLFSSL_ASN1_ITEM { + enum WOLFSSL_ASN1_TYPES type; + const struct WOLFSSL_ASN1_TEMPLATE* members; /* If SEQUENCE or CHOICE this + * contains the contents */ + size_t mcount; /* Number of members if SEQUENCE + * or CHOICE */ + size_t size; /* Structure size */ + size_t toffset; /* Type offset */ +}; + +typedef struct WOLFSSL_ASN1_TEMPLATE WOLFSSL_ASN1_TEMPLATE; +typedef struct WOLFSSL_ASN1_ITEM WOLFSSL_ASN1_ITEM; + +#define ASN1_BIT_STRING_FIRST_BYTE ASN_BIT_STRING +#define ASN1_TFLG_EXPLICIT (0x1 << 0) +#define ASN1_TFLG_SEQUENCE_OF (0x1 << 1) +#define ASN1_TFLG_IMPTAG (0x1 << 2) +#define ASN1_TFLG_EXPTAG (0x1 << 3) + +#define ASN1_TFLG_TAG_MASK (ASN1_TFLG_IMPTAG|ASN1_TFLG_EXPTAG) + +#define ASN1_ITEM_TEMPLATE(mtype) \ + static const WOLFSSL_ASN1_TEMPLATE mtype##_member_data + +#define ASN1_ITEM_TEMPLATE_END(mtype) \ + ; \ + const WOLFSSL_ASN1_ITEM mtype##_template_data = { \ + WOLFSSL_ASN1_OBJECT_TYPE, \ + &mtype##_member_data, \ + 1, \ + 0, \ + 0 \ + }; + +#define ASN1_SEQUENCE(mtype) \ + static const WOLFSSL_ASN1_TEMPLATE mtype##_member_data[] + +#define ASN1_SEQUENCE_END(mtype) \ + ; \ + const WOLFSSL_ASN1_ITEM mtype##_template_data = { \ + WOLFSSL_ASN1_SEQUENCE, \ + mtype##_member_data, \ + sizeof(mtype##_member_data) / sizeof(WOLFSSL_ASN1_TEMPLATE), \ + sizeof(mtype), \ + 0 \ + }; \ + static WC_MAYBE_UNUSED const byte mtype##_FIRST_BYTE = \ + ASN_CONSTRUCTED | ASN_SEQUENCE; + +/* This is what a ASN1_CHOICE type should look like + * typedef struct { + * int type; + * union { + * ASN1_SOMETHING *opt1; + * ASN1_SOMEOTHER *opt2; + * } value; + * } chname; + */ + +#define ASN1_CHOICE(mtype) \ + static const WOLFSSL_ASN1_TEMPLATE mtype##_member_data[] + +#define ASN1_CHOICE_END(mtype) \ + ; \ + const WOLFSSL_ASN1_ITEM mtype##_template_data = { \ + WOLFSSL_ASN1_CHOICE, \ + mtype##_member_data, \ + sizeof(mtype##_member_data) / sizeof(WOLFSSL_ASN1_TEMPLATE), \ + sizeof(mtype) ,\ + WC_OFFSETOF(mtype, type) \ + }; + +#define ASN1_TYPE(type, member, tag, first_byte, exp, seq) \ + WC_OFFSETOF(type, member), tag, first_byte, exp, seq + +/* Function callbacks need to be defined immediately otherwise we will + * incorrectly expand the type. Ex: ASN1_INTEGER -> WOLFSSL_ASN1_INTEGER */ + +#define ASN1_SIMPLE(type, member, member_type) \ + { (WolfsslAsn1NewCb)member_type##_new, \ + (WolfsslAsn1FreeCb)member_type##_free, \ + (WolfsslAsn1i2dCb)i2d_##member_type, \ + (WolfsslAsn1d2iCb)d2i_##member_type, \ + ASN1_TYPE(type, member, -1, 0, 0, 0) } + +#define ASN1_IMP(type, member, member_type, tag) \ + { (WolfsslAsn1NewCb)member_type##_new, \ + (WolfsslAsn1FreeCb)member_type##_free, \ + (WolfsslAsn1i2dCb)i2d_##member_type, \ + (WolfsslAsn1d2iCb)d2i_##member_type, \ + ASN1_TYPE(type, member, tag, member_type##_FIRST_BYTE, 0, 0) } + +#define ASN1_EXP(type, member, member_type, tag) \ + { (WolfsslAsn1NewCb)member_type##_new, \ + (WolfsslAsn1FreeCb)member_type##_free, \ + (WolfsslAsn1i2dCb)i2d_##member_type, \ + (WolfsslAsn1d2iCb)d2i_##member_type, \ + ASN1_TYPE(type, member, tag, 0, 1, 0) } + +#define ASN1_SEQUENCE_OF(type, member, member_type) \ + { (WolfsslAsn1NewCb)member_type##_new, \ + (WolfsslAsn1FreeCb)member_type##_free, \ + (WolfsslAsn1i2dCb)i2d_##member_type, \ + (WolfsslAsn1d2iCb)d2i_##member_type, \ + ASN1_TYPE(type, member, -1, 0, 0, 1) } + +#define ASN1_EXP_SEQUENCE_OF(type, member, member_type, tag) \ + { (WolfsslAsn1NewCb)member_type##_new, \ + (WolfsslAsn1FreeCb)member_type##_free, \ + (WolfsslAsn1i2dCb)i2d_##member_type, \ + (WolfsslAsn1d2iCb)d2i_##member_type, \ + ASN1_TYPE(type, member, tag, 0, 1, 1) } + +#define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, member_type) \ + { (WolfsslAsn1NewCb)member_type##_new, \ + (WolfsslAsn1FreeCb)member_type##_free, \ + (WolfsslAsn1i2dCb)i2d_##member_type, \ + (WolfsslAsn1d2iCb)d2i_##member_type, \ + 0, (flags) & ASN1_TFLG_TAG_MASK ? (tag) : -1, 0, \ + !!((flags) & ASN1_TFLG_EXPLICIT), TRUE } + +WOLFSSL_API void *wolfSSL_ASN1_item_new(const WOLFSSL_ASN1_ITEM *tpl); +WOLFSSL_API void wolfSSL_ASN1_item_free(void *obj, + const WOLFSSL_ASN1_ITEM *item); +WOLFSSL_API int wolfSSL_ASN1_item_i2d(const void *src, byte **dest, + const WOLFSSL_ASN1_ITEM *tpl); +WOLFSSL_API void* wolfSSL_ASN1_item_d2i(void** dst, const byte **src, long len, + const WOLFSSL_ASN1_ITEM* item); + +/* Need function declaration otherwise compiler complains */ +/* // NOLINTBEGIN(readability-named-parameter,bugprone-macro-parentheses) */ +#define IMPLEMENT_ASN1_FUNCTIONS(type) \ + type *type##_new(void); \ + type *type##_new(void){ \ + return (type*)wolfSSL_ASN1_item_new(&type##_template_data); \ + } \ + void type##_free(type *t); \ + void type##_free(type *t){ \ + wolfSSL_ASN1_item_free(t, &type##_template_data); \ + } \ + int i2d_##type(type *src, byte **dest); \ + int i2d_##type(type *src, byte **dest) \ + { \ + return wolfSSL_ASN1_item_i2d(src, dest, &type##_template_data); \ + } \ + type* d2i_##type(type **dst, const byte **src, long len); \ + type* d2i_##type(type **dst, const byte **src, long len) \ + { \ + return (type*)wolfSSL_ASN1_item_d2i((void**)dst, src, len, \ + &type##_template_data); \ + } +/* // NOLINTEND(readability-named-parameter,bugprone-macro-parentheses) */ + +#endif /* OPENSSL_ALL */ + +#define BN_to_ASN1_INTEGER wolfSSL_BN_to_ASN1_INTEGER +#define ASN1_TYPE_set wolfSSL_ASN1_TYPE_set +#define ASN1_TYPE_get wolfSSL_ASN1_TYPE_get +#define ASN1_TYPE_new wolfSSL_ASN1_TYPE_new +#define ASN1_TYPE_free wolfSSL_ASN1_TYPE_free +#define i2d_ASN1_TYPE wolfSSL_i2d_ASN1_TYPE + +#endif /* WOLFSSL_ASN1_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/asn1t.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/asn1t.h @@ -0,0 +1,30 @@ +/* asn1t.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* asn1t.h for openssl */ + +#ifndef WOLFSSL_ASN1T_H_ +#define WOLFSSL_ASN1T_H_ + +#include <wolfssl/wolfcrypt/asn.h> +#include <wolfssl/openssl/asn1.h> + +#endif /* WOLFSSL_ASN1T_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/bio.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/bio.h @@ -0,0 +1,237 @@ +/* bio.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* bio.h for openssl */ + + +#ifndef WOLFSSL_BIO_H_ +#define WOLFSSL_BIO_H_ + +#include <wolfssl/openssl/ssl.h> + +#ifdef __cplusplus + extern "C" { +#endif + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + +/* helper to set specific retry/read flags */ +#define wolfSSL_BIO_set_retry_read(bio)\ + wolfSSL_BIO_set_flags((bio), WOLFSSL_BIO_FLAG_RETRY | WOLFSSL_BIO_FLAG_READ) +#define wolfSSL_BIO_set_retry_write(bio)\ + wolfSSL_BIO_set_flags((bio), WOLFSSL_BIO_FLAG_RETRY | WOLFSSL_BIO_FLAG_WRITE) + +/* BIO CTRL */ +#define WOLFSSL_BIO_CTRL_RESET 1 +#define WOLFSSL_BIO_CTRL_EOF 2 +#define WOLFSSL_BIO_CTRL_INFO 3 +#define WOLFSSL_BIO_CTRL_SET 4 +#define WOLFSSL_BIO_CTRL_GET 5 +#define WOLFSSL_BIO_CTRL_PUSH 6 +#define WOLFSSL_BIO_CTRL_POP 7 +#define WOLFSSL_BIO_CTRL_GET_CLOSE 8 +#define WOLFSSL_BIO_CTRL_SET_CLOSE 9 +#define WOLFSSL_BIO_CTRL_PENDING 10 +#define WOLFSSL_BIO_CTRL_FLUSH 11 +#define WOLFSSL_BIO_CTRL_DUP 12 +#define WOLFSSL_BIO_CTRL_WPENDING 13 + +#define WOLFSSL_BIO_C_SET_FILE_PTR 106 +#define WOLFSSL_BIO_C_GET_FILE_PTR 107 +#define WOLFSSL_BIO_C_SET_FILENAME 108 +#define WOLFSSL_BIO_C_SET_BUF_MEM 114 +#define WOLFSSL_BIO_C_GET_BUF_MEM_PTR 115 +#define WOLFSSL_BIO_C_FILE_SEEK 128 +#define WOLFSSL_BIO_C_SET_BUF_MEM_EOF_RETURN 130 +#define WOLFSSL_BIO_C_SET_WRITE_BUF_SIZE 136 +#define WOLFSSL_BIO_C_MAKE_WOLFSSL_BIO_PAIR 138 + +#define WOLFSSL_BIO_CTRL_DGRAM_CONNECT 31 +#define WOLFSSL_BIO_CTRL_DGRAM_SET_CONNECTED 32 +#define WOLFSSL_BIO_CTRL_DGRAM_QUERY_MTU 40 +#define WOLFSSL_BIO_CTRL_DGRAM_SET_PEER 44 + +#define WOLFSSL_BIO_FP_TEXT 0x00 +#define WOLFSSL_BIO_NOCLOSE 0x00 +#define WOLFSSL_BIO_CLOSE 0x01 + +#define WOLFSSL_BIO_FP_WRITE 0x04 + +#ifndef OPENSSL_COEXIST + +#define BIO_FLAGS_BASE64_NO_NL WOLFSSL_BIO_FLAG_BASE64_NO_NL +#define BIO_FLAGS_READ WOLFSSL_BIO_FLAG_READ +#define BIO_FLAGS_WRITE WOLFSSL_BIO_FLAG_WRITE +#define BIO_FLAGS_IO_SPECIAL WOLFSSL_BIO_FLAG_IO_SPECIAL +#define BIO_FLAGS_SHOULD_RETRY WOLFSSL_BIO_FLAG_RETRY +/* You shouldn't free up or change the data if BIO_FLAGS_MEM_RDONLY is set */ +#define BIO_FLAGS_MEM_RDONLY WOLFSSL_BIO_FLAG_MEM_RDONLY + +#define BIO_new_fp wolfSSL_BIO_new_fp +#if defined(OPENSSL_ALL) \ + || defined(HAVE_STUNNEL) \ + || defined(HAVE_LIGHTY) \ + || defined(WOLFSSL_MYSQL_COMPATIBLE) \ + || defined(WOLFSSL_HAPROXY) \ + || defined(OPENSSL_EXTRA) +#define BIO_new_file wolfSSL_BIO_new_file +#endif +#define BIO_new_fp wolfSSL_BIO_new_fp +#define BIO_ctrl wolfSSL_BIO_ctrl +#define BIO_ctrl_pending wolfSSL_BIO_ctrl_pending +#define BIO_wpending wolfSSL_BIO_wpending +#define BIO_get_mem_ptr wolfSSL_BIO_get_mem_ptr +#ifdef OPENSSL_ALL +#define BIO_set_mem_buf wolfSSL_BIO_set_mem_buf +#endif +#define BIO_int_ctrl wolfSSL_BIO_int_ctrl +#define BIO_reset wolfSSL_BIO_reset +#define BIO_s_null wolfSSL_BIO_s_null +#define BIO_s_file wolfSSL_BIO_s_file +#define BIO_s_bio wolfSSL_BIO_s_bio +#define BIO_s_socket wolfSSL_BIO_s_socket +#define BIO_s_datagram wolfSSL_BIO_s_datagram +#define BIO_s_accept wolfSSL_BIO_s_socket +#define BIO_set_fd wolfSSL_BIO_set_fd +#define BIO_set_close wolfSSL_BIO_set_close +#define BIO_ctrl_reset_read_request wolfSSL_BIO_ctrl_reset_read_request +#define BIO_set_write_buf_size wolfSSL_BIO_set_write_buf_size +#define BIO_make_bio_pair wolfSSL_BIO_make_bio_pair +#define BIO_up_ref wolfSSL_BIO_up_ref + +#define BIO_new_fd wolfSSL_BIO_new_fd +#define BIO_set_fp wolfSSL_BIO_set_fp +#define BIO_get_fp wolfSSL_BIO_get_fp +#define BIO_seek wolfSSL_BIO_seek +#define BIO_tell wolfSSL_BIO_tell +#define BIO_write_filename wolfSSL_BIO_write_filename +#define BIO_set_mem_eof_return wolfSSL_BIO_set_mem_eof_return + +#define BIO_find_type wolfSSL_BIO_find_type +#define BIO_next wolfSSL_BIO_next +#define BIO_gets wolfSSL_BIO_gets +#define BIO_puts wolfSSL_BIO_puts + +#define BIO_should_retry wolfSSL_BIO_should_retry +#define BIO_should_read wolfSSL_BIO_should_read +#define BIO_should_write wolfSSL_BIO_should_write + +#define BIO_TYPE_FILE WOLFSSL_BIO_FILE +#define BIO_TYPE_BIO WOLFSSL_BIO_BIO +#define BIO_TYPE_MEM WOLFSSL_BIO_MEMORY +#define BIO_TYPE_BASE64 WOLFSSL_BIO_BASE64 + +#define BIO_vprintf wolfSSL_BIO_vprintf +#define BIO_printf wolfSSL_BIO_printf +#define BIO_dump wolfSSL_BIO_dump + +/* BIO info callback */ +#define BIO_CB_FREE WOLFSSL_BIO_CB_FREE +#define BIO_CB_READ WOLFSSL_BIO_CB_READ +#define BIO_CB_WRITE WOLFSSL_BIO_CB_WRITE +#define BIO_CB_PUTS WOLFSSL_BIO_CB_PUTS +#define BIO_CB_GETS WOLFSSL_BIO_CB_GETS +#define BIO_CB_CTRL WOLFSSL_BIO_CB_CTRL +#define BIO_CB_RETURN WOLFSSL_BIO_CB_RETURN + +#define BIO_set_callback wolfSSL_BIO_set_callback +#define BIO_get_callback wolfSSL_BIO_get_callback +#define BIO_set_callback_arg wolfSSL_BIO_set_callback_arg +#define BIO_get_callback_arg wolfSSL_BIO_get_callback_arg + +/* BIO for 1.1.0 or later */ +#define BIO_set_init wolfSSL_BIO_set_init +#define BIO_get_data wolfSSL_BIO_get_data +#define BIO_set_data wolfSSL_BIO_set_data +#define BIO_get_shutdown wolfSSL_BIO_get_shutdown +#define BIO_set_shutdown wolfSSL_BIO_set_shutdown + +#define BIO_get_fd wolfSSL_BIO_get_fd + +#define BIO_clear_flags wolfSSL_BIO_clear_flags +#define BIO_set_ex_data wolfSSL_BIO_set_ex_data +#define BIO_get_ex_data wolfSSL_BIO_get_ex_data + +/* helper to set specific retry/read flags */ +#define BIO_set_retry_read(bio) wolfSSL_BIO_set_retry_read(bio) +#define BIO_set_retry_write(bio) wolfSSL_BIO_set_retry_write(bio) + +#define BIO_clear_retry_flags wolfSSL_BIO_clear_retry_flags + +#define BIO_meth_new wolfSSL_BIO_meth_new +#define BIO_meth_set_write wolfSSL_BIO_meth_set_write +#define BIO_meth_free wolfSSL_BIO_meth_free +#define BIO_meth_set_write wolfSSL_BIO_meth_set_write +#define BIO_meth_set_read wolfSSL_BIO_meth_set_read +#define BIO_meth_set_puts wolfSSL_BIO_meth_set_puts +#define BIO_meth_set_gets wolfSSL_BIO_meth_set_gets +#define BIO_meth_set_ctrl wolfSSL_BIO_meth_set_ctrl +#define BIO_meth_set_create wolfSSL_BIO_meth_set_create +#define BIO_meth_set_destroy wolfSSL_BIO_meth_set_destroy + +#define BIO_snprintf XSNPRINTF + +/* BIO CTRL */ +#define BIO_CTRL_RESET WOLFSSL_BIO_CTRL_RESET +#define BIO_CTRL_EOF WOLFSSL_BIO_CTRL_EOF +#define BIO_CTRL_INFO WOLFSSL_BIO_CTRL_INFO +#define BIO_CTRL_SET WOLFSSL_BIO_CTRL_SET +#define BIO_CTRL_GET WOLFSSL_BIO_CTRL_GET +#define BIO_CTRL_PUSH WOLFSSL_BIO_CTRL_PUSH +#define BIO_CTRL_POP WOLFSSL_BIO_CTRL_POP +#define BIO_CTRL_GET_CLOSE WOLFSSL_BIO_CTRL_GET_CLOSE +#define BIO_CTRL_SET_CLOSE WOLFSSL_BIO_CTRL_SET_CLOSE +#define BIO_CTRL_PENDING WOLFSSL_BIO_CTRL_PENDING +#define BIO_CTRL_FLUSH WOLFSSL_BIO_CTRL_FLUSH +#define BIO_CTRL_DUP WOLFSSL_BIO_CTRL_DUP +#define BIO_CTRL_WPENDING WOLFSSL_BIO_CTRL_WPENDING + +#define BIO_C_SET_FILE_PTR WOLFSSL_BIO_C_SET_FILE_PTR +#define BIO_C_GET_FILE_PTR WOLFSSL_BIO_C_GET_FILE_PTR +#define BIO_C_SET_FILENAME WOLFSSL_BIO_C_SET_FILENAME +#define BIO_C_SET_BUF_MEM WOLFSSL_BIO_C_SET_BUF_MEM +#define BIO_C_GET_BUF_MEM_PTR WOLFSSL_BIO_C_GET_BUF_MEM_PTR +#define BIO_C_FILE_SEEK WOLFSSL_BIO_C_FILE_SEEK +#define BIO_C_SET_BUF_MEM_EOF_RETURN WOLFSSL_BIO_C_SET_BUF_MEM_EOF_RETURN +#define BIO_C_SET_WRITE_BUF_SIZE WOLFSSL_BIO_C_SET_WRITE_BUF_SIZE +#define BIO_C_MAKE_BIO_PAIR WOLFSSL_BIO_C_MAKE_BIO_PAIR + +#define BIO_CTRL_DGRAM_CONNECT WOLFSSL_BIO_CTRL_DGRAM_CONNECT +#define BIO_CTRL_DGRAM_SET_CONNECTED WOLFSSL_BIO_CTRL_DGRAM_SET_CONNECTED +#define BIO_CTRL_DGRAM_QUERY_MTU WOLFSSL_BIO_CTRL_DGRAM_QUERY_MTU +#define BIO_CTRL_DGRAM_SET_PEER WOLFSSL_BIO_CTRL_DGRAM_SET_PEER + +#define BIO_FP_TEXT WOLFSSL_BIO_FP_TEXT +#define BIO_NOCLOSE WOLFSSL_BIO_NOCLOSE +#define BIO_CLOSE WOLFSSL_BIO_CLOSE + +#define BIO_FP_WRITE WOLFSSL_BIO_FP_WRITE + +#endif /* !OPENSSL_COEXIST */ + +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_BIO_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/bn.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/bn.h @@ -0,0 +1,332 @@ +/* bn.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* bn.h for openssl */ + +/*! + \file wolfssl/openssl/bn.h + \brief bn.h for openssl +*/ + + +#ifndef WOLFSSL_BN_H_ +#define WOLFSSL_BN_H_ + +#include <wolfssl/wolfcrypt/types.h> +#include <wolfssl/wolfcrypt/wolfmath.h> + +#ifdef __cplusplus + extern "C" { +#endif + +typedef struct WOLFSSL_BIGNUM { + int neg; /* openssh deference */ + void *internal; /* our big num */ +#if !defined(NO_BIG_INT) + mp_int mpi; +#endif +} WOLFSSL_BIGNUM; + +#define WOLFSSL_BN_ULONG unsigned long +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) +#define BN_ULONG WOLFSSL_BN_ULONG +#endif + +#ifndef WOLFSSL_MAX_BN_BITS + #if defined(WOLFSSL_SP_MATH_ALL) || defined(WOLFSSL_SP_MATH) + /* SP implementation supports numbers of SP_INT_BITS bits. */ + #define WOLFSSL_MAX_BN_BITS SP_INT_BITS + #elif defined(USE_FAST_MATH) + /* FP implementation support numbers up to FP_MAX_BITS / 2 bits. */ + #define WOLFSSL_MAX_BN_BITS (FP_MAX_BITS / 2) + #else + #ifdef WOLFSSL_MYSQL_COMPATIBLE + /* Integer maths is dynamic but we only go up to 8192 bits. */ + #define WOLFSSL_MAX_BN_BITS 8192 + #else + /* Integer maths is dynamic but we only go up to 4096 bits. */ + #define WOLFSSL_MAX_BN_BITS 4096 + #endif + #endif +#endif + +#define WOLFSSL_BN_RAND_TOP_ANY (-1) +#define WOLFSSL_BN_RAND_TOP_ONE 0 +#define WOLFSSL_BN_RAND_TOP_TWO 1 + +#define WOLFSSL_BN_RAND_BOTTOM_ANY 0 +#define WOLFSSL_BN_RAND_BOTTOM_ODD 1 + +#define WOLFSSL_BN_MAX_VAL ((BN_ULONG)-1) + +struct WOLFSSL_BN_CTX_LIST { + WOLFSSL_BIGNUM* bn; + struct WOLFSSL_BN_CTX_LIST* next; +}; +typedef struct WOLFSSL_BN_CTX { + struct WOLFSSL_BN_CTX_LIST* list; +} WOLFSSL_BN_CTX; +typedef struct WOLFSSL_BN_MONT_CTX WOLFSSL_BN_MONT_CTX; +typedef struct WOLFSSL_BN_GENCB WOLFSSL_BN_GENCB; + +WOLFSSL_API WOLFSSL_BN_CTX* wolfSSL_BN_CTX_new(void); +WOLFSSL_API void wolfSSL_BN_CTX_init(WOLFSSL_BN_CTX* ctx); +WOLFSSL_API void wolfSSL_BN_CTX_free(WOLFSSL_BN_CTX* ctx); + +WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_BN_new(void); +#if !defined(USE_INTEGER_HEAP_MATH) && !defined(HAVE_WOLF_BIGINT) +WOLFSSL_API void wolfSSL_BN_init(WOLFSSL_BIGNUM* bn); +#endif +WOLFSSL_API void wolfSSL_BN_free(WOLFSSL_BIGNUM* bn); +WOLFSSL_API void wolfSSL_BN_clear_free(WOLFSSL_BIGNUM* bn); +WOLFSSL_API void wolfSSL_BN_clear(WOLFSSL_BIGNUM* bn); + + +WOLFSSL_API int wolfSSL_BN_sub(WOLFSSL_BIGNUM* r, const WOLFSSL_BIGNUM* a, + const WOLFSSL_BIGNUM* b); +WOLFSSL_API int wolfSSL_BN_mul(WOLFSSL_BIGNUM *r, WOLFSSL_BIGNUM *a, + WOLFSSL_BIGNUM *b, WOLFSSL_BN_CTX *ctx); +WOLFSSL_API int wolfSSL_BN_div(WOLFSSL_BIGNUM* dv, WOLFSSL_BIGNUM* rem, + const WOLFSSL_BIGNUM* a, const WOLFSSL_BIGNUM* d, + WOLFSSL_BN_CTX* ctx); +#if defined(WOLFSSL_KEY_GEN) && !defined(NO_RSA) +WOLFSSL_API int wolfSSL_BN_gcd(WOLFSSL_BIGNUM* r, WOLFSSL_BIGNUM* a, + WOLFSSL_BIGNUM* b, WOLFSSL_BN_CTX* ctx); +#endif +WOLFSSL_API int wolfSSL_BN_mod(WOLFSSL_BIGNUM* r, const WOLFSSL_BIGNUM* a, + const WOLFSSL_BIGNUM* b, const WOLFSSL_BN_CTX* c); +WOLFSSL_API int wolfSSL_BN_mod_exp(WOLFSSL_BIGNUM *r, const WOLFSSL_BIGNUM *a, + const WOLFSSL_BIGNUM *p, const WOLFSSL_BIGNUM *m, WOLFSSL_BN_CTX *ctx); +WOLFSSL_API int wolfSSL_BN_mod_mul(WOLFSSL_BIGNUM *r, const WOLFSSL_BIGNUM *a, + const WOLFSSL_BIGNUM *p, const WOLFSSL_BIGNUM *m, WOLFSSL_BN_CTX *ctx); +WOLFSSL_API const WOLFSSL_BIGNUM* wolfSSL_BN_value_one(void); + + +WOLFSSL_API int wolfSSL_BN_num_bytes(const WOLFSSL_BIGNUM* bn); +WOLFSSL_API int wolfSSL_BN_num_bits(const WOLFSSL_BIGNUM* bn); + +WOLFSSL_API void wolfSSL_BN_zero(WOLFSSL_BIGNUM* bn); +WOLFSSL_API int wolfSSL_BN_one(WOLFSSL_BIGNUM* bn); +WOLFSSL_API int wolfSSL_BN_is_zero(const WOLFSSL_BIGNUM* bn); +WOLFSSL_API int wolfSSL_BN_is_one(const WOLFSSL_BIGNUM* bn); +WOLFSSL_API int wolfSSL_BN_is_odd(const WOLFSSL_BIGNUM* bn); +WOLFSSL_API int wolfSSL_BN_is_negative(const WOLFSSL_BIGNUM* bn); +WOLFSSL_API int wolfSSL_BN_is_word(const WOLFSSL_BIGNUM* bn, WOLFSSL_BN_ULONG w); + +WOLFSSL_API int wolfSSL_BN_cmp(const WOLFSSL_BIGNUM* a, const WOLFSSL_BIGNUM* b); +WOLFSSL_API int wolfSSL_BN_ucmp(const WOLFSSL_BIGNUM* a, const WOLFSSL_BIGNUM* b); + +WOLFSSL_API int wolfSSL_BN_bn2bin(const WOLFSSL_BIGNUM* bn, unsigned char* r); +WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_BN_bin2bn(const unsigned char* str, int len, + WOLFSSL_BIGNUM* ret); + +WOLFSSL_API int wolfSSL_mask_bits(WOLFSSL_BIGNUM* bn, int n); + +WOLFSSL_API int wolfSSL_BN_pseudo_rand(WOLFSSL_BIGNUM* bn, int bits, int top, + int bottom); +WOLFSSL_API int wolfSSL_BN_rand_range(WOLFSSL_BIGNUM *r, const WOLFSSL_BIGNUM *range); +WOLFSSL_API int wolfSSL_BN_rand(WOLFSSL_BIGNUM* bn, int bits, int top, int bottom); +WOLFSSL_API int wolfSSL_BN_is_bit_set(const WOLFSSL_BIGNUM* bn, int n); +WOLFSSL_API int wolfSSL_BN_hex2bn(WOLFSSL_BIGNUM** bn, const char* str); + +WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_BN_dup(const WOLFSSL_BIGNUM* bn); +WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_BN_copy(WOLFSSL_BIGNUM* r, + const WOLFSSL_BIGNUM* bn); + +WOLFSSL_API int wolfSSL_BN_dec2bn(WOLFSSL_BIGNUM** bn, const char* str); +WOLFSSL_API char* wolfSSL_BN_bn2dec(const WOLFSSL_BIGNUM* bn); + +WOLFSSL_API int wolfSSL_BN_lshift(WOLFSSL_BIGNUM* r, const WOLFSSL_BIGNUM* bn, + int n); +WOLFSSL_API int wolfSSL_BN_add_word(WOLFSSL_BIGNUM* bn, WOLFSSL_BN_ULONG w); +WOLFSSL_API int wolfSSL_BN_sub_word(WOLFSSL_BIGNUM* bn, WOLFSSL_BN_ULONG w); +WOLFSSL_API int wolfSSL_BN_mul_word(WOLFSSL_BIGNUM *bn, WOLFSSL_BN_ULONG w); +WOLFSSL_API int wolfSSL_BN_div_word(WOLFSSL_BIGNUM *bn, WOLFSSL_BN_ULONG w); +WOLFSSL_API int wolfSSL_BN_set_bit(WOLFSSL_BIGNUM* bn, int n); +WOLFSSL_API int wolfSSL_BN_clear_bit(WOLFSSL_BIGNUM* bn, int n); +WOLFSSL_API int wolfSSL_BN_set_word(WOLFSSL_BIGNUM* bn, WOLFSSL_BN_ULONG w); +WOLFSSL_API WOLFSSL_BN_ULONG wolfSSL_BN_get_word(const WOLFSSL_BIGNUM* bn); + +WOLFSSL_API int wolfSSL_BN_add(WOLFSSL_BIGNUM* r, WOLFSSL_BIGNUM* a, + WOLFSSL_BIGNUM* b); +WOLFSSL_API int wolfSSL_BN_mod_add(WOLFSSL_BIGNUM *r, const WOLFSSL_BIGNUM *a, + const WOLFSSL_BIGNUM *b, const WOLFSSL_BIGNUM *m, + WOLFSSL_BN_CTX *ctx); +WOLFSSL_API char *wolfSSL_BN_bn2hex(const WOLFSSL_BIGNUM* bn); +#if defined(WOLFSSL_KEY_GEN) && (!defined(NO_RSA) || !defined(NO_DH) || !defined(NO_DSA)) +WOLFSSL_API int wolfSSL_BN_generate_prime_ex( + WOLFSSL_BIGNUM* prime, int bits, int safe, const WOLFSSL_BIGNUM* add, + const WOLFSSL_BIGNUM* rem, WOLFSSL_BN_GENCB* cb); +WOLFSSL_API int wolfSSL_BN_is_prime_ex(const WOLFSSL_BIGNUM *bn, int nbchecks, + WOLFSSL_BN_CTX *ctx, WOLFSSL_BN_GENCB *cb); +WOLFSSL_API WOLFSSL_BN_ULONG wolfSSL_BN_mod_word(const WOLFSSL_BIGNUM *bn, + WOLFSSL_BN_ULONG w); +#endif +#if !defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM) + WOLFSSL_API int wolfSSL_BN_print_fp(XFILE fp, const WOLFSSL_BIGNUM *bn); +#endif +WOLFSSL_API int wolfSSL_BN_rshift(WOLFSSL_BIGNUM *r, const WOLFSSL_BIGNUM *bn, + int n); +WOLFSSL_API WOLFSSL_BIGNUM *wolfSSL_BN_CTX_get(WOLFSSL_BN_CTX *ctx); +WOLFSSL_API void wolfSSL_BN_CTX_start(WOLFSSL_BN_CTX *ctx); +WOLFSSL_API WOLFSSL_BIGNUM *wolfSSL_BN_mod_inverse( + WOLFSSL_BIGNUM *r, + WOLFSSL_BIGNUM *a, + const WOLFSSL_BIGNUM *n, + WOLFSSL_BN_CTX *ctx); + +WOLFSSL_API WOLFSSL_BN_MONT_CTX* wolfSSL_BN_MONT_CTX_new(void); +WOLFSSL_API void wolfSSL_BN_MONT_CTX_free(WOLFSSL_BN_MONT_CTX *mont); +WOLFSSL_API int wolfSSL_BN_MONT_CTX_set(WOLFSSL_BN_MONT_CTX *mont, + const WOLFSSL_BIGNUM *mod, WOLFSSL_BN_CTX *ctx); +WOLFSSL_API int wolfSSL_BN_mod_exp_mont_word(WOLFSSL_BIGNUM *r, + WOLFSSL_BN_ULONG a, const WOLFSSL_BIGNUM *p, const WOLFSSL_BIGNUM *m, + WOLFSSL_BN_CTX *ctx, WOLFSSL_BN_MONT_CTX *mont); + +#if !defined(OPENSSL_COEXIST) && (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) + +#define BN_RAND_TOP_ANY WOLFSSL_BN_RAND_TOP_ANY +#define BN_RAND_TOP_ONE WOLFSSL_BN_RAND_TOP_ONE +#define BN_RAND_TOP_TWO WOLFSSL_BN_RAND_TOP_TWO + +#define BN_RAND_BOTTOM_ANY WOLFSSL_BN_RAND_BOTTOM_ANY +#define BN_RAND_BOTTOM_ODD WOLFSSL_BN_RAND_BOTTOM_ODD + +typedef WOLFSSL_BIGNUM BIGNUM; +typedef WOLFSSL_BN_CTX BN_CTX; +typedef WOLFSSL_BN_MONT_CTX BN_MONT_CTX; +typedef WOLFSSL_BN_GENCB BN_GENCB; + +#ifndef NO_WOLFSSL_BN_CTX +#define BN_CTX_new wolfSSL_BN_CTX_new +#define BN_CTX_init wolfSSL_BN_CTX_init +#define BN_CTX_free wolfSSL_BN_CTX_free +#else +#define BN_CTX_new() ((BN_CTX*)-1) +#define BN_CTX_free(x) ((void)(x)) +#endif + +#define BN_new wolfSSL_BN_new +#if !defined(USE_INTEGER_HEAP_MATH) && !defined(HAVE_WOLF_BIGINT) +#define BN_init wolfSSL_BN_init +#endif +#define BN_free wolfSSL_BN_free +#define BN_clear_free wolfSSL_BN_clear_free +#define BN_clear wolfSSL_BN_clear + +#define BN_num_bytes wolfSSL_BN_num_bytes +#define BN_num_bits wolfSSL_BN_num_bits + +#define BN_zero wolfSSL_BN_zero +#define BN_one wolfSSL_BN_one +#define BN_is_zero wolfSSL_BN_is_zero +#define BN_is_one wolfSSL_BN_is_one +#define BN_is_odd wolfSSL_BN_is_odd +#define BN_is_negative wolfSSL_BN_is_negative +#define BN_is_word wolfSSL_BN_is_word + +#define BN_cmp wolfSSL_BN_cmp +#define BN_ucmp wolfSSL_BN_ucmp + +#define BN_bn2bin wolfSSL_BN_bn2bin +#define BN_bin2bn wolfSSL_BN_bin2bn + +#define BN_mod wolfSSL_BN_mod +#define BN_mod_exp wolfSSL_BN_mod_exp +#define BN_mod_exp_mont(a,b,c,d,e,f) \ + ((void)(f), wolfSSL_BN_mod_exp((a),(b),(c),(d),(e))) +#define BN_mod_mul wolfSSL_BN_mod_mul +#define BN_sub wolfSSL_BN_sub +#define BN_mul wolfSSL_BN_mul +#define BN_div wolfSSL_BN_div +#define BN_gcd wolfSSL_BN_gcd +#define BN_value_one wolfSSL_BN_value_one + +#define BN_mask_bits wolfSSL_mask_bits + +#define BN_pseudo_rand wolfSSL_BN_pseudo_rand +#define BN_rand wolfSSL_BN_rand +#define BN_rand_range wolfSSL_BN_rand_range +#define BN_is_bit_set wolfSSL_BN_is_bit_set +#define BN_hex2bn wolfSSL_BN_hex2bn + +#define BN_dup wolfSSL_BN_dup +#define BN_copy wolfSSL_BN_copy + +#define BN_get_word wolfSSL_BN_get_word +#define BN_set_word wolfSSL_BN_set_word + +#define BN_dec2bn wolfSSL_BN_dec2bn +#define BN_bn2dec wolfSSL_BN_bn2dec +#define BN_bn2hex wolfSSL_BN_bn2hex + +#define BN_lshift wolfSSL_BN_lshift +#define BN_add_word wolfSSL_BN_add_word +#define BN_mul_word wolfSSL_BN_mul_word +#define BN_sub_word wolfSSL_BN_sub_word +#define BN_div_word wolfSSL_BN_div_word +#define BN_add wolfSSL_BN_add +#define BN_mod_add wolfSSL_BN_mod_add +#define BN_set_word wolfSSL_BN_set_word +#define BN_set_bit wolfSSL_BN_set_bit +#define BN_clear_bit wolfSSL_BN_clear_bit + +#define BN_generate_prime_ex wolfSSL_BN_generate_prime_ex +#define BN_is_prime_ex wolfSSL_BN_is_prime_ex +#define BN_print_fp wolfSSL_BN_print_fp +#define BN_rshift wolfSSL_BN_rshift +#define BN_rshift1(r, a) wolfSSL_BN_rshift((r), (a), 1) +#define BN_mod_word wolfSSL_BN_mod_word + +#define BN_CTX_get wolfSSL_BN_CTX_get +#define BN_CTX_start wolfSSL_BN_CTX_start + +#define BN_mod_inverse wolfSSL_BN_mod_inverse + +#define BN_set_flags(x1, x2) WC_DO_NOTHING + +#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L +#define BN_get_rfc2409_prime_768 wolfSSL_DH_768_prime +#define BN_get_rfc2409_prime_1024 wolfSSL_DH_1024_prime +#define BN_get_rfc3526_prime_1536 wolfSSL_DH_1536_prime +#define BN_get_rfc3526_prime_2048 wolfSSL_DH_2048_prime +#define BN_get_rfc3526_prime_3072 wolfSSL_DH_3072_prime +#define BN_get_rfc3526_prime_4096 wolfSSL_DH_4096_prime +#define BN_get_rfc3526_prime_6144 wolfSSL_DH_6144_prime +#define BN_get_rfc3526_prime_8192 wolfSSL_DH_8192_prime +#endif + +#define BN_prime_checks 0 + +#define BN_MONT_CTX_new wolfSSL_BN_MONT_CTX_new +#define BN_MONT_CTX_free wolfSSL_BN_MONT_CTX_free +#define BN_MONT_CTX_set wolfSSL_BN_MONT_CTX_set +#define BN_mod_exp_mont_word wolfSSL_BN_mod_exp_mont_word + +#endif /* !OPENSSL_COEXIST && (OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL) */ + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + + +#endif /* WOLFSSL__H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/buffer.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/buffer.h @@ -0,0 +1,57 @@ +/* buffer.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + +#ifndef WOLFSSL_BUFFER_H_ +#define WOLFSSL_BUFFER_H_ + +#include <wolfssl/wolfcrypt/settings.h> +#include <wolfssl/openssl/ssl.h> + +#ifdef __cplusplus + extern "C" { +#endif + + +WOLFSSL_API WOLFSSL_BUF_MEM* wolfSSL_BUF_MEM_new(void); +WOLFSSL_API int wolfSSL_BUF_MEM_grow(WOLFSSL_BUF_MEM* buf, size_t len); +WOLFSSL_API int wolfSSL_BUF_MEM_grow_ex(WOLFSSL_BUF_MEM* buf, size_t len, + char zeroFill); +WOLFSSL_API int wolfSSL_BUF_MEM_resize(WOLFSSL_BUF_MEM* buf, size_t len); +WOLFSSL_API void wolfSSL_BUF_MEM_free(WOLFSSL_BUF_MEM* buf); + +#ifndef OPENSSL_COEXIST + +#define BUF_MEM_new wolfSSL_BUF_MEM_new +#define BUF_MEM_grow wolfSSL_BUF_MEM_grow +#define BUF_MEM_free wolfSSL_BUF_MEM_free + +#define BUF_strdup strdup +#define BUF_strlcpy wc_strlcpy +#define BUF_strlcat wc_strlcat + +#endif /* !OPENSSL_COEXIST */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_BUFFER_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/camellia.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/camellia.h @@ -0,0 +1,27 @@ +/* camellia.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifndef WOLFSSL_CAMELLIA_H_ +#define WOLFSSL_CAMELLIA_H_ + +#include <wolfssl/wolfcrypt/camellia.h> + +#endif /* WOLFSSL_CAMELLIA_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/cmac.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/cmac.h @@ -0,0 +1,66 @@ +/* cmac.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifndef WOLFSSL_CMAC_H_ +#define WOLFSSL_CMAC_H_ + +#include <wolfssl/wolfcrypt/cmac.h> +#include <wolfssl/openssl/compat_types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct WOLFSSL_CMAC_CTX { + void* internal; /* internal Cmac object */ + WOLFSSL_EVP_CIPHER_CTX* cctx; +} WOLFSSL_CMAC_CTX; + +WOLFSSL_API WOLFSSL_CMAC_CTX* wolfSSL_CMAC_CTX_new(void); +WOLFSSL_API void wolfSSL_CMAC_CTX_free(WOLFSSL_CMAC_CTX *ctx); +WOLFSSL_API WOLFSSL_EVP_CIPHER_CTX* wolfSSL_CMAC_CTX_get0_cipher_ctx( + WOLFSSL_CMAC_CTX* ctx); +WOLFSSL_API int wolfSSL_CMAC_Init( + WOLFSSL_CMAC_CTX* ctx, const void *key, size_t keyLen, + const WOLFSSL_EVP_CIPHER* cipher, WOLFSSL_ENGINE* engine); +WOLFSSL_API int wolfSSL_CMAC_Update( + WOLFSSL_CMAC_CTX* ctx, const void* data, size_t len); +WOLFSSL_API int wolfSSL_CMAC_Final( + WOLFSSL_CMAC_CTX* ctx, unsigned char* out, size_t* len); + +#ifndef OPENSSL_COEXIST + +typedef WOLFSSL_CMAC_CTX CMAC_CTX; + +#define CMAC_CTX_new wolfSSL_CMAC_CTX_new +#define CMAC_CTX_free wolfSSL_CMAC_CTX_free +#define CMAC_CTX_get0_cipher_ctx wolfSSL_CMAC_CTX_get0_cipher_ctx +#define CMAC_Init wolfSSL_CMAC_Init +#define CMAC_Update wolfSSL_CMAC_Update +#define CMAC_Final wolfSSL_CMAC_Final + +#endif /* !OPENSSL_COEXIST */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* WOLFSSL_CMAC_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/cms.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/cms.h @@ -0,0 +1,26 @@ +/* cms.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifndef WOLFSSL_CMS_H_ +#define WOLFSSL_CMS_H_ + + +#endif /* WOLFSSL_CMS_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/compat_types.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/compat_types.h @@ -0,0 +1,70 @@ +/* compat_types.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* + * Move types that cause cyclical dependency errors here. + */ + +#ifndef WOLFSSL_OPENSSL_COMPAT_TYPES_H_ +#define WOLFSSL_OPENSSL_COMPAT_TYPES_H_ + +#include <wolfssl/wolfcrypt/settings.h> +#include <wolfssl/wolfcrypt/types.h> +#include <wolfssl/wolfcrypt/hmac.h> + +#ifndef NO_HMAC +typedef struct WOLFSSL_HMAC_CTX { + Hmac hmac; + int type; + word32 save_ipad[WC_HMAC_BLOCK_SIZE / sizeof(word32)]; /* same block size all*/ + word32 save_opad[WC_HMAC_BLOCK_SIZE / sizeof(word32)]; +} WOLFSSL_HMAC_CTX; +#endif + +typedef char WOLFSSL_EVP_MD; +typedef char WOLFSSL_EVP_CIPHER; +typedef int WOLFSSL_ENGINE; + +typedef struct WOLFSSL_EVP_PKEY WOLFSSL_EVP_PKEY; +typedef struct WOLFSSL_EVP_MD_CTX WOLFSSL_EVP_MD_CTX; +typedef struct WOLFSSL_EVP_PKEY WOLFSSL_PKCS8_PRIV_KEY_INFO; +typedef struct WOLFSSL_EVP_PKEY_CTX WOLFSSL_EVP_PKEY_CTX; +typedef struct WOLFSSL_EVP_CIPHER_CTX WOLFSSL_EVP_CIPHER_CTX; +typedef struct WOLFSSL_ASN1_PCTX WOLFSSL_ASN1_PCTX; + +typedef struct WOLFSSL_BIO WOLFSSL_BIO; + +#if !defined(OPENSSL_COEXIST) && (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) +typedef WOLFSSL_EVP_MD EVP_MD; +typedef WOLFSSL_EVP_MD_CTX EVP_MD_CTX; +typedef WOLFSSL_EVP_CIPHER EVP_CIPHER; +typedef WOLFSSL_EVP_CIPHER_CTX EVP_CIPHER_CTX; +typedef WOLFSSL_ASN1_PCTX ASN1_PCTX; +typedef WOLFSSL_EVP_PKEY EVP_PKEY; +typedef WOLFSSL_EVP_PKEY PKCS8_PRIV_KEY_INFO; + +typedef WOLFSSL_ENGINE ENGINE; +typedef WOLFSSL_EVP_PKEY_CTX EVP_PKEY_CTX; +#endif /* !OPENSSL_COEXIST && (OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL) */ + +typedef unsigned long (*wolf_sk_hash_cb) (const void *v); + +#endif /* !WOLFSSL_OPENSSL_COMPAT_TYPES_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/conf.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/conf.h @@ -0,0 +1,117 @@ +/* conf.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* conf.h for openSSL */ + +#ifndef WOLFSSL_conf_H_ +#define WOLFSSL_conf_H_ + +#ifdef __cplusplus + extern "C" { +#endif + +#include <wolfssl/wolfcrypt/settings.h> +#include <wolfssl/version.h> + +typedef struct WOLFSSL_CONF_VALUE { + char *section; + char *name; + char *value; +} WOLFSSL_CONF_VALUE; + +/* ssl.h requires WOLFSSL_CONF_VALUE */ +#include <wolfssl/ssl.h> + +typedef struct WOLFSSL_CONF { + void *meth_data; + WOLF_LHASH_OF(WOLFSSL_CONF_VALUE) *data; +} WOLFSSL_CONF; + +#ifndef OPENSSL_COEXIST +typedef WOLFSSL_CONF CONF; +typedef WOLFSSL_CONF_VALUE CONF_VALUE; +#endif + +#ifdef OPENSSL_EXTRA + +WOLFSSL_API WOLFSSL_CONF_VALUE *wolfSSL_CONF_VALUE_new(void); +WOLFSSL_API int wolfSSL_CONF_add_string(WOLFSSL_CONF *conf, + WOLFSSL_CONF_VALUE *section, WOLFSSL_CONF_VALUE *value); +WOLFSSL_API void wolfSSL_X509V3_conf_free(WOLFSSL_CONF_VALUE *val); + +WOLFSSL_API WOLFSSL_CONF *wolfSSL_NCONF_new(void *meth); +WOLFSSL_API char *wolfSSL_NCONF_get_string(const WOLFSSL_CONF *conf, + const char *group, const char *name); +WOLFSSL_API int wolfSSL_NCONF_get_number(const WOLFSSL_CONF *conf, const char *group, + const char *name, long *result); +WOLFSSL_API WOLFSSL_STACK *wolfSSL_NCONF_get_section( + const WOLFSSL_CONF *conf, const char *section); +WOLFSSL_API int wolfSSL_NCONF_load(WOLFSSL_CONF *conf, const char *file, long *eline); +WOLFSSL_API void wolfSSL_NCONF_free(WOLFSSL_CONF *conf); + +WOLFSSL_API WOLFSSL_CONF_VALUE *wolfSSL_lh_WOLFSSL_CONF_VALUE_retrieve( + WOLF_LHASH_OF(WOLFSSL_CONF_VALUE) *sk, WOLFSSL_CONF_VALUE *data); + +WOLFSSL_API int wolfSSL_CONF_modules_load(const WOLFSSL_CONF *cnf, const char *appname, + unsigned long flags); +WOLFSSL_API WOLFSSL_CONF_VALUE *wolfSSL_CONF_new_section(WOLFSSL_CONF *conf, + const char *section); +WOLFSSL_API WOLFSSL_CONF_VALUE *wolfSSL_CONF_get_section(WOLFSSL_CONF *conf, + const char *section); + +WOLFSSL_API WOLFSSL_X509_EXTENSION* wolfSSL_X509V3_EXT_nconf_nid(WOLFSSL_CONF* conf, + WOLFSSL_X509V3_CTX *ctx, int nid, const char *value); +WOLFSSL_API WOLFSSL_X509_EXTENSION* wolfSSL_X509V3_EXT_nconf(WOLFSSL_CONF *conf, + WOLFSSL_X509V3_CTX *ctx, const char *sName, const char *value); + +#ifndef OPENSSL_COEXIST +#define sk_CONF_VALUE_new wolfSSL_sk_CONF_VALUE_new +#define sk_CONF_VALUE_free wolfSSL_sk_CONF_VALUE_free +#define sk_CONF_VALUE_pop_free(a,b) wolfSSL_sk_CONF_VALUE_free(a) +#define sk_CONF_VALUE_num wolfSSL_sk_CONF_VALUE_num +#define sk_CONF_VALUE_value wolfSSL_sk_CONF_VALUE_value + +#define lh_CONF_VALUE_retrieve wolfSSL_lh_WOLFSSL_CONF_VALUE_retrieve +#define lh_CONF_VALUE_insert wolfSSL_sk_CONF_VALUE_push + +#define NCONF_new wolfSSL_NCONF_new +#define NCONF_free wolfSSL_NCONF_free +#define NCONF_get_string wolfSSL_NCONF_get_string +#define NCONF_get_section wolfSSL_NCONF_get_section +#define NCONF_get_number wolfSSL_NCONF_get_number +#define NCONF_load wolfSSL_NCONF_load + +#define CONF_modules_load wolfSSL_CONF_modules_load +#define _CONF_new_section wolfSSL_CONF_new_section +#define _CONF_get_section wolfSSL_CONF_get_section + +#define X509V3_EXT_nconf_nid wolfSSL_X509V3_EXT_nconf_nid +#define X509V3_EXT_nconf wolfSSL_X509V3_EXT_nconf +#define X509V3_conf_free wolfSSL_X509V3_conf_free +#endif /* !OPENSSL_COEXIST */ + +#endif /* OPENSSL_EXTRA */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* WOLFSSL_conf_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/crypto.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/crypto.h @@ -0,0 +1,171 @@ +/* crypto.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* crypto.h for openSSL */ + +#ifndef WOLFSSL_CRYPTO_H_ +#define WOLFSSL_CRYPTO_H_ + +#include <wolfssl/openssl/compat_types.h> + +typedef struct WOLFSSL_INIT_SETTINGS { + char* appname; +} WOLFSSL_INIT_SETTINGS; +#ifndef OPENSSL_COEXIST +#define OPENSSL_INIT_SETTINGS WOLFSSL_INIT_SETTINGS +#endif + +typedef struct WOLFSSL_CRYPTO_THREADID { + int dummy; +} WOLFSSL_CRYPTO_THREADID; +#ifndef OPENSSL_COEXIST +typedef struct crypto_threadid_st CRYPTO_THREADID; +#endif + +#ifndef OPENSSL_COEXIST +typedef struct CRYPTO_EX_DATA CRYPTO_EX_DATA; +#endif + +#ifdef HAVE_EX_DATA +typedef WOLFSSL_CRYPTO_EX_new CRYPTO_new_func; +typedef WOLFSSL_CRYPTO_EX_dup CRYPTO_dup_func; +typedef WOLFSSL_CRYPTO_EX_free CRYPTO_free_func; +#endif + +#include <wolfssl/openssl/opensslv.h> +#include <wolfssl/openssl/conf.h> + +#ifdef WOLFSSL_PREFIX +#include "prefix_crypto.h" +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +WOLFSSL_API const char* wolfSSLeay_version(int type); +WOLFSSL_API unsigned long wolfSSLeay(void); +WOLFSSL_API unsigned long wolfSSL_OpenSSL_version_num(void); + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) +WOLFSSL_API void wolfSSL_OPENSSL_free(void* p); +#endif + +#ifdef OPENSSL_EXTRA +WOLFSSL_API void *wolfSSL_OPENSSL_malloc(size_t a); +WOLFSSL_API int wolfSSL_OPENSSL_hexchar2int(unsigned char c); +WOLFSSL_API unsigned char *wolfSSL_OPENSSL_hexstr2buf(const char *str, long *len); + +WOLFSSL_API int wolfSSL_OPENSSL_init_crypto(word64 opts, const WOLFSSL_INIT_SETTINGS *settings); +#endif + +/* class index for wolfSSL_CRYPTO_get_ex_new_index */ + +#ifndef OPENSSL_COEXIST + +#define CRYPTO_EX_INDEX_SSL WOLF_CRYPTO_EX_INDEX_SSL +#define CRYPTO_EX_INDEX_SSL_CTX WOLF_CRYPTO_EX_INDEX_SSL_CTX +#define CRYPTO_EX_INDEX_SSL_SESSION WOLF_CRYPTO_EX_INDEX_SSL_SESSION +#define CRYPTO_EX_INDEX_X509 WOLF_CRYPTO_EX_INDEX_X509 +#define CRYPTO_EX_INDEX_X509_STORE WOLF_CRYPTO_EX_INDEX_X509_STORE +#define CRYPTO_EX_INDEX_X509_STORE_CTX WOLF_CRYPTO_EX_INDEX_X509_STORE_CTX +#define CRYPTO_EX_INDEX_DH WOLF_CRYPTO_EX_INDEX_DH +#define CRYPTO_EX_INDEX_DSA WOLF_CRYPTO_EX_INDEX_DSA +#define CRYPTO_EX_INDEX_EC_KEY WOLF_CRYPTO_EX_INDEX_EC_KEY +#define CRYPTO_EX_INDEX_RSA WOLF_CRYPTO_EX_INDEX_RSA +#define CRYPTO_EX_INDEX_ENGINE WOLF_CRYPTO_EX_INDEX_ENGINE +#define CRYPTO_EX_INDEX_UI WOLF_CRYPTO_EX_INDEX_UI +#define CRYPTO_EX_INDEX_BIO WOLF_CRYPTO_EX_INDEX_BIO +#define CRYPTO_EX_INDEX_APP WOLF_CRYPTO_EX_INDEX_APP +#define CRYPTO_EX_INDEX_UI_METHOD WOLF_CRYPTO_EX_INDEX_UI_METHOD +#define CRYPTO_EX_INDEX_DRBG WOLF_CRYPTO_EX_INDEX_DRBG +#define CRYPTO_EX_INDEX__COUNT WOLF_CRYPTO_EX_INDEX__COUNT + +#define crypto_threadid_st WOLFSSL_CRYPTO_THREADID +#define CRYPTO_THREADID WOLFSSL_CRYPTO_THREADID + +#define SSLeay_version wolfSSLeay_version +#define SSLeay wolfSSLeay +#define OpenSSL_version_num wolfSSL_OpenSSL_version_num +#define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER +#define SSLEAY_VERSION OPENSSL_VERSION + +#define CRYPTO_lock wc_LockMutex_ex + +/* this function was used to set the default malloc, free, and realloc */ +#define CRYPTO_malloc_init() 0 /* CRYPTO_malloc_init is not needed */ + +#define OPENSSL_free wolfSSL_OPENSSL_free +#define OPENSSL_malloc wolfSSL_OPENSSL_malloc +#define OPENSSL_hexchar2int wolfSSL_OPENSSL_hexchar2int +#define OPENSSL_hexstr2buf wolfSSL_OPENSSL_hexstr2buf + +#define OPENSSL_INIT_ENGINE_ALL_BUILTIN 0x00000001L +#define OPENSSL_INIT_ADD_ALL_CIPHERS 0x00000004L +#define OPENSSL_INIT_ADD_ALL_DIGESTS 0x00000008L +#define OPENSSL_INIT_LOAD_CONFIG 0x00000040L + +#define OPENSSL_init_crypto wolfSSL_OPENSSL_init_crypto + +#ifdef WOLFSSL_OPENVPN +# define OPENSSL_assert(e) \ + if (!(e)) { \ + fprintf(stderr, "%s:%d wolfSSL internal error: assertion failed: " #e, \ + __FILE__, __LINE__); \ + raise(SIGABRT); \ + _exit(3); \ + } +#endif + +#if defined(OPENSSL_ALL) || defined(HAVE_STUNNEL) || defined(WOLFSSL_NGINX) || \ + defined(WOLFSSL_HAPROXY) || defined(OPENSSL_EXTRA) || defined(HAVE_EX_DATA) +#define CRYPTO_set_mem_ex_functions wolfSSL_CRYPTO_set_mem_ex_functions +#define FIPS_mode wolfSSL_FIPS_mode +#define FIPS_mode_set wolfSSL_FIPS_mode_set +#define CRYPTO_THREADID_set_callback wolfSSL_THREADID_set_callback +#define CRYPTO_THREADID_set_numeric wolfSSL_THREADID_set_numeric +#define CRYPTO_THREADID_current wolfSSL_THREADID_current +#define CRYPTO_THREADID_hash wolfSSL_THREADID_hash + +#define CRYPTO_r_lock wc_LockMutex_ex +#define CRYPTO_unlock wc_LockMutex_ex + +#define CRYPTO_THREAD_lock wc_LockMutex +#define CRYPTO_THREAD_r_lock wc_LockMutex +#define CRYPTO_THREAD_unlock wc_UnLockMutex + +#define CRYPTO_THREAD_lock_new wc_InitAndAllocMutex +#define CRYPTO_THREAD_read_lock wc_LockMutex +#define CRYPTO_THREAD_write_lock wc_LockMutex +#define CRYPTO_THREAD_lock_free wc_FreeMutex + +#define CRYPTO_get_ex_data wolfSSL_CRYPTO_get_ex_data +#define CRYPTO_set_ex_data wolfSSL_CRYPTO_set_ex_data + +#endif /* OPENSSL_ALL || HAVE_STUNNEL || WOLFSSL_NGINX || WOLFSSL_HAPROXY || HAVE_EX_DATA */ + +#endif /* !OPENSSL_COEXIST */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* header */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/des.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/des.h @@ -0,0 +1,124 @@ +/* des.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + +/* des.h defines mini des openssl compatibility layer + * + */ + + +#ifndef WOLFSSL_DES_H_ +#define WOLFSSL_DES_H_ + +#include <wolfssl/wolfcrypt/settings.h> + +#ifndef NO_DES3 + +#ifdef WOLFSSL_PREFIX +#include "prefix_des.h" +#endif + + +#ifdef __cplusplus + extern "C" { +#endif + +typedef unsigned char WOLFSSL_DES_cblock[8]; +typedef /* const */ WOLFSSL_DES_cblock WOLFSSL_const_DES_cblock; +typedef WOLFSSL_DES_cblock WOLFSSL_DES_key_schedule; +typedef unsigned int WOLFSSL_DES_LONG; + + +enum { + WC_DES_ENCRYPT = 1, + WC_DES_DECRYPT = 0 +}; + + +WOLFSSL_API int wolfSSL_DES_is_weak_key(WOLFSSL_const_DES_cblock* key); +WOLFSSL_API WOLFSSL_DES_LONG wolfSSL_DES_cbc_cksum(const unsigned char* in, + WOLFSSL_DES_cblock* out, long length, WOLFSSL_DES_key_schedule* sc, + WOLFSSL_const_DES_cblock* iv); +WOLFSSL_API int wolfSSL_DES_set_key(WOLFSSL_const_DES_cblock* myDes, + WOLFSSL_DES_key_schedule* key); +WOLFSSL_API int wolfSSL_DES_set_key_checked(WOLFSSL_const_DES_cblock* myDes, + WOLFSSL_DES_key_schedule* key); +WOLFSSL_API void wolfSSL_DES_set_key_unchecked(WOLFSSL_const_DES_cblock* myDes, + WOLFSSL_DES_key_schedule* key); +WOLFSSL_API int wolfSSL_DES_key_sched(WOLFSSL_const_DES_cblock* key, + WOLFSSL_DES_key_schedule* schedule); +WOLFSSL_API void wolfSSL_DES_cbc_encrypt(const unsigned char* input, + unsigned char* output, long length, + WOLFSSL_DES_key_schedule* schedule, WOLFSSL_DES_cblock* ivec, + int enc); +WOLFSSL_API void wolfSSL_DES_ede3_cbc_encrypt(const unsigned char* input, + unsigned char* output, long sz, + WOLFSSL_DES_key_schedule* ks1, + WOLFSSL_DES_key_schedule* ks2, + WOLFSSL_DES_key_schedule* ks3, + WOLFSSL_DES_cblock* ivec, int enc); +WOLFSSL_API void wolfSSL_DES_ncbc_encrypt(const unsigned char* input, + unsigned char* output, long length, + WOLFSSL_DES_key_schedule* schedule, + WOLFSSL_DES_cblock* ivec, int enc); + +WOLFSSL_API void wolfSSL_DES_set_odd_parity(WOLFSSL_DES_cblock* myDes); +WOLFSSL_API void wolfSSL_DES_ecb_encrypt(WOLFSSL_DES_cblock* desa, + WOLFSSL_DES_cblock* desb, WOLFSSL_DES_key_schedule* key, int enc); +WOLFSSL_API int wolfSSL_DES_check_key_parity(WOLFSSL_DES_cblock *myDes); + + +#ifndef OPENSSL_COEXIST + +enum { + DES_ENCRYPT = WC_DES_ENCRYPT, + DES_DECRYPT = WC_DES_DECRYPT +}; + +typedef WOLFSSL_DES_cblock DES_cblock; +typedef WOLFSSL_const_DES_cblock const_DES_cblock; +typedef WOLFSSL_DES_key_schedule DES_key_schedule; +typedef WOLFSSL_DES_LONG DES_LONG; + +#define DES_check_key(x) /* Define WOLFSSL_CHECK_DESKEY to check key */ +#define DES_is_weak_key wolfSSL_DES_is_weak_key +#define DES_set_key wolfSSL_DES_set_key +#define DES_set_key_checked wolfSSL_DES_set_key_checked +#define DES_set_key_unchecked wolfSSL_DES_set_key_unchecked +#define DES_key_sched wolfSSL_DES_key_sched +#define DES_cbc_encrypt wolfSSL_DES_cbc_encrypt +#define DES_ncbc_encrypt wolfSSL_DES_ncbc_encrypt +#define DES_set_odd_parity wolfSSL_DES_set_odd_parity +#define DES_ecb_encrypt wolfSSL_DES_ecb_encrypt +#define DES_ede3_cbc_encrypt wolfSSL_DES_ede3_cbc_encrypt +#define DES_cbc_cksum wolfSSL_DES_cbc_cksum +#define DES_check_key_parity wolfSSL_DES_check_key_parity + +#endif /* !OPENSSL_COEXIST */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* NO_DES3 */ + +#endif /* WOLFSSL_DES_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/dh.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/dh.h @@ -0,0 +1,144 @@ +/* dh.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* dh.h for openSSL */ + + +#ifndef WOLFSSL_DH_H_ +#define WOLFSSL_DH_H_ + +#include <wolfssl/openssl/bn.h> +#include <wolfssl/openssl/ssl.h> +#include <wolfssl/openssl/opensslv.h> + +#ifdef __cplusplus + extern "C" { +#endif + +#ifndef WOLFSSL_DH_TYPE_DEFINED /* guard on redeclaration */ + typedef struct WOLFSSL_DH WOLFSSL_DH; + #define WOLFSSL_DH_TYPE_DEFINED +#endif + +struct WOLFSSL_DH { + WOLFSSL_BIGNUM* p; + WOLFSSL_BIGNUM* g; + WOLFSSL_BIGNUM* q; + WOLFSSL_BIGNUM* pub_key; /* openssh deference g^x */ + WOLFSSL_BIGNUM* priv_key; /* openssh deference x */ + void* internal; /* our DH */ + char inSet; /* internal set from external ? */ + char exSet; /* external set from internal ? */ + /*added for lighttpd openssl compatibility, go back and add a getter in + * lighttpd src code. + */ + int length; + wolfSSL_Ref ref; /* Reference count information. */ +}; + +WOLFSSL_API WOLFSSL_DH *wolfSSL_d2i_DHparams(WOLFSSL_DH **dh, + const unsigned char **pp, long length); +WOLFSSL_API int wolfSSL_i2d_DHparams(const WOLFSSL_DH *dh, unsigned char **out); +WOLFSSL_API WOLFSSL_DH* wolfSSL_DH_new(void); +WOLFSSL_API WOLFSSL_DH* wolfSSL_DH_new_by_nid(int nid); +WOLFSSL_API void wolfSSL_DH_free(WOLFSSL_DH* dh); +WOLFSSL_API WOLFSSL_DH* wolfSSL_DH_dup(WOLFSSL_DH* dh); +WOLFSSL_API int wolfSSL_DH_up_ref(WOLFSSL_DH* dh); + +WOLFSSL_API int wolfSSL_DH_check(const WOLFSSL_DH *dh, int *codes); +WOLFSSL_API int wolfSSL_DH_size(WOLFSSL_DH* dh); +WOLFSSL_API int wolfSSL_DH_generate_key(WOLFSSL_DH* dh); +WOLFSSL_API int wolfSSL_DH_compute_key(unsigned char* key, const WOLFSSL_BIGNUM* pub, + WOLFSSL_DH* dh); +WOLFSSL_API int wolfSSL_DH_compute_key_padded(unsigned char* key, + const WOLFSSL_BIGNUM* otherPub, WOLFSSL_DH* dh); + +WOLFSSL_API int wolfSSL_DH_LoadDer(WOLFSSL_DH* dh, const unsigned char* derBuf, + int derSz); +WOLFSSL_API int wolfSSL_DH_set_length(WOLFSSL_DH* dh, long len); +WOLFSSL_API int wolfSSL_DH_set0_pqg(WOLFSSL_DH *dh, WOLFSSL_BIGNUM *p, + WOLFSSL_BIGNUM *q, WOLFSSL_BIGNUM *g); + +WOLFSSL_API WOLFSSL_DH* wolfSSL_DH_get_2048_256(void); + +#if !defined(OPENSSL_COEXIST) && (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) + +typedef WOLFSSL_DH DH; + +#define DH_new wolfSSL_DH_new +#define DH_free wolfSSL_DH_free +#define DH_up_ref wolfSSL_DH_up_ref +#define DH_new_by_nid wolfSSL_DH_new_by_nid + +#define d2i_DHparams wolfSSL_d2i_DHparams +#define i2d_DHparams wolfSSL_i2d_DHparams +#define DH_check wolfSSL_DH_check + +#define DH_size wolfSSL_DH_size +#define DH_generate_key wolfSSL_DH_generate_key +#define DH_compute_key wolfSSL_DH_compute_key +#define DH_compute_key_padded wolfSSL_DH_compute_key_padded +#define DH_set_length wolfSSL_DH_set_length +#define DH_set0_pqg wolfSSL_DH_set0_pqg +#define DH_get0_pqg wolfSSL_DH_get0_pqg +#define DH_get0_key wolfSSL_DH_get0_key +#define DH_set0_key wolfSSL_DH_set0_key +#define DH_bits(x) (BN_num_bits((x)->p)) + +#define OPENSSL_DH_MAX_MODULUS_BITS DH_MAX_SIZE + +#define DH_GENERATOR_2 2 +#define DH_CHECK_P_NOT_PRIME 0x01 +#define DH_CHECK_P_NOT_SAFE_PRIME 0x02 +#define DH_NOT_SUITABLE_GENERATOR 0x08 + +/* Temporary values for wolfSSL_DH_Check*/ +#define DH_CHECK_INVALID_Q_VALUE 0x10 +#define DH_CHECK_Q_NOT_PRIME 0x11 +/* end temp */ + +/* for pre 1.1.0 */ +#define get_rfc2409_prime_768 wolfSSL_DH_768_prime +#define get_rfc2409_prime_1024 wolfSSL_DH_1024_prime +#define get_rfc3526_prime_1536 wolfSSL_DH_1536_prime +#define get_rfc3526_prime_2048 wolfSSL_DH_2048_prime +#define get_rfc3526_prime_3072 wolfSSL_DH_3072_prime +#define get_rfc3526_prime_4096 wolfSSL_DH_4096_prime +#define get_rfc3526_prime_6144 wolfSSL_DH_6144_prime +#define get_rfc3526_prime_8192 wolfSSL_DH_8192_prime + +#define DH_get_2048_256 wolfSSL_DH_get_2048_256 + +#if defined(OPENSSL_ALL) || defined(HAVE_STUNNEL) +#define DH_generate_parameters wolfSSL_DH_generate_parameters +#define DH_generate_parameters_ex wolfSSL_DH_generate_parameters_ex +#endif /* OPENSSL_ALL || HAVE_STUNNEL */ + +#define DH_GENERATOR_2 2 +#define DH_GENERATOR_5 5 + +#endif /* !OPENSSL_COEXIST && (OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL) */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_DH_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/dsa.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/dsa.h @@ -0,0 +1,164 @@ +/* dsa.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* dsa.h for openSSL */ + + +#ifndef WOLFSSL_DSA_H_ +#define WOLFSSL_DSA_H_ + +#include <wolfssl/openssl/bn.h> +#include <wolfssl/openssl/compat_types.h> + +#ifdef __cplusplus + extern "C" { +#endif + +typedef struct WOLFSSL_DSA_SIG { + WOLFSSL_BIGNUM *r; + WOLFSSL_BIGNUM *s; +} WOLFSSL_DSA_SIG; + +#ifndef WOLFSSL_DSA_TYPE_DEFINED /* guard on redeclaration */ +typedef struct WOLFSSL_DSA WOLFSSL_DSA; +#define WOLFSSL_DSA_TYPE_DEFINED +#endif + +struct WOLFSSL_DSA { + WOLFSSL_BIGNUM* p; + WOLFSSL_BIGNUM* q; + WOLFSSL_BIGNUM* g; + WOLFSSL_BIGNUM* pub_key; /* our y */ + WOLFSSL_BIGNUM* priv_key; /* our x */ + void* internal; /* our Dsa Key */ + char inSet; /* internal set from external ? */ + char exSet; /* external set from internal ? */ +}; + + +WOLFSSL_API WOLFSSL_DSA* wolfSSL_DSA_new(void); +WOLFSSL_API void wolfSSL_DSA_free(WOLFSSL_DSA* dsa); +#if !defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM) +WOLFSSL_API int wolfSSL_DSA_print_fp(XFILE fp, WOLFSSL_DSA* dsa, int indent); +#endif /* !NO_FILESYSTEM && NO_STDIO_FILESYSTEM */ + +WOLFSSL_API int wolfSSL_DSA_generate_key(WOLFSSL_DSA* dsa); + +typedef void (*WOLFSSL_BN_CB)(int i, int j, void* exArg); +WOLFSSL_API WOLFSSL_DSA* wolfSSL_DSA_generate_parameters(int bits, + unsigned char* seed, int seedLen, int* counterRet, + unsigned long* hRet, WOLFSSL_BN_CB cb, void* CBArg); +WOLFSSL_API int wolfSSL_DSA_generate_parameters_ex(WOLFSSL_DSA* dsa, int bits, + unsigned char* seed, int seedLen, int* counterRet, + unsigned long* hRet, void* cb); + +WOLFSSL_API void wolfSSL_DSA_get0_pqg(const WOLFSSL_DSA *d, const WOLFSSL_BIGNUM **p, + const WOLFSSL_BIGNUM **q, const WOLFSSL_BIGNUM **g); +WOLFSSL_API int wolfSSL_DSA_set0_pqg(WOLFSSL_DSA *d, WOLFSSL_BIGNUM *p, + WOLFSSL_BIGNUM *q, WOLFSSL_BIGNUM *g); + +WOLFSSL_API void wolfSSL_DSA_get0_key(const WOLFSSL_DSA *d, + const WOLFSSL_BIGNUM **pub_key, const WOLFSSL_BIGNUM **priv_key); +WOLFSSL_API int wolfSSL_DSA_set0_key(WOLFSSL_DSA *d, WOLFSSL_BIGNUM *pub_key, + WOLFSSL_BIGNUM *priv_key); + + +WOLFSSL_API int wolfSSL_DSA_LoadDer( + WOLFSSL_DSA* dsa, const unsigned char* derBuf, int derSz); + +WOLFSSL_API int wolfSSL_DSA_LoadDer_ex( + WOLFSSL_DSA* dsa, const unsigned char* derBuf, int derSz, int opt); + +WOLFSSL_API int wolfSSL_DSA_do_sign( + const unsigned char* d, unsigned char* sigRet, WOLFSSL_DSA* dsa); + +WOLFSSL_API int wolfSSL_DSA_do_verify( + const unsigned char* d, unsigned char* sig, WOLFSSL_DSA* dsa, int *dsacheck); + +WOLFSSL_API int wolfSSL_DSA_bits(const WOLFSSL_DSA *d); + +WOLFSSL_API WOLFSSL_DSA_SIG* wolfSSL_DSA_SIG_new(void); +WOLFSSL_API void wolfSSL_DSA_SIG_free(WOLFSSL_DSA_SIG *sig); + +WOLFSSL_API void wolfSSL_DSA_SIG_get0(const WOLFSSL_DSA_SIG *sig, + const WOLFSSL_BIGNUM **r, const WOLFSSL_BIGNUM **s); +WOLFSSL_API int wolfSSL_DSA_SIG_set0(WOLFSSL_DSA_SIG *sig, WOLFSSL_BIGNUM *r, + WOLFSSL_BIGNUM *s); + +WOLFSSL_API int wolfSSL_i2d_DSA_SIG(const WOLFSSL_DSA_SIG *sig, byte **out); +WOLFSSL_API WOLFSSL_DSA_SIG* wolfSSL_d2i_DSA_SIG(WOLFSSL_DSA_SIG **sig, + const unsigned char **pp, long length); +WOLFSSL_API WOLFSSL_DSA_SIG* wolfSSL_DSA_do_sign_ex(const unsigned char* digest, + int inLen, WOLFSSL_DSA* dsa); +WOLFSSL_API int wolfSSL_DSA_do_verify_ex(const unsigned char* digest, int digest_len, + WOLFSSL_DSA_SIG* sig, WOLFSSL_DSA* dsa); + +WOLFSSL_API int wolfSSL_i2d_DSAparams( + const WOLFSSL_DSA* dsa, unsigned char** out); +WOLFSSL_API WOLFSSL_DSA* wolfSSL_d2i_DSAparams( + WOLFSSL_DSA** dsa, const unsigned char** der, long derLen); + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + +#define WOLFSSL_DSA_LOAD_PRIVATE 1 +#define WOLFSSL_DSA_LOAD_PUBLIC 2 + +#ifndef OPENSSL_COEXIST + +typedef WOLFSSL_DSA DSA; + +#define OPENSSL_DSA_MAX_MODULUS_BITS 3072 + +#define DSA_new wolfSSL_DSA_new +#define DSA_free wolfSSL_DSA_free +#define DSA_print_fp wolfSSL_DSA_print_fp + +#define DSA_LoadDer wolfSSL_DSA_LoadDer +#define DSA_generate_key wolfSSL_DSA_generate_key +#define DSA_generate_parameters wolfSSL_DSA_generate_parameters +#define DSA_generate_parameters_ex wolfSSL_DSA_generate_parameters_ex +#define DSA_get0_pqg wolfSSL_DSA_get0_pqg +#define DSA_set0_pqg wolfSSL_DSA_set0_pqg +#define DSA_get0_key wolfSSL_DSA_get0_key +#define DSA_set0_key wolfSSL_DSA_set0_key + +#define DSA_SIG_new wolfSSL_DSA_SIG_new +#define DSA_SIG_free wolfSSL_DSA_SIG_free +#define DSA_SIG_get0 wolfSSL_DSA_SIG_get0 +#define DSA_SIG_set0 wolfSSL_DSA_SIG_set0 +#define i2d_DSA_SIG wolfSSL_i2d_DSA_SIG +#define d2i_DSA_SIG wolfSSL_d2i_DSA_SIG +#define DSA_do_sign wolfSSL_DSA_do_sign_ex +#define DSA_do_verify wolfSSL_DSA_do_verify_ex +#define i2d_DSAparams wolfSSL_i2d_DSAparams +#define d2i_DSAparams wolfSSL_d2i_DSAparams + +#define DSA_SIG WOLFSSL_DSA_SIG + +#endif /* !OPENSSL_COEXIST */ + +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* header */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ec.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ec.h @@ -0,0 +1,522 @@ +/* ec.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* ec.h for openssl */ + +#ifndef WOLFSSL_EC_H_ +#define WOLFSSL_EC_H_ + +#include <wolfssl/wolfcrypt/types.h> +#include <wolfssl/openssl/compat_types.h> +#include <wolfssl/openssl/bn.h> +#include <wolfssl/openssl/compat_types.h> +#include <wolfssl/wolfcrypt/asn.h> +#include <wolfssl/wolfcrypt/ecc.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + +/* Map OpenSSL NID value */ +enum { + WC_POINT_CONVERSION_COMPRESSED = 2, + WC_POINT_CONVERSION_UNCOMPRESSED = 4, + +#ifdef HAVE_ECC + /* Use OpenSSL NIDs. NIDs can be mapped to ecc_curve_id enum values by + calling NIDToEccEnum() in ssl.c */ + WC_NID_X9_62_prime192v1 = 409, + WC_NID_X9_62_prime192v2 = 410, + WC_NID_X9_62_prime192v3 = 411, + WC_NID_X9_62_prime239v1 = 412, + WC_NID_X9_62_prime239v2 = 413, + WC_NID_X9_62_prime239v3 = 418, /* Previous value conflicted with AES128CBCb */ + WC_NID_X9_62_prime256v1 = 415, + WC_NID_secp112r1 = 704, + WC_NID_secp112r2 = 705, + WC_NID_secp128r1 = 706, + WC_NID_secp128r2 = 707, + WC_NID_secp160r1 = 709, + WC_NID_secp160r2 = 710, + WC_NID_secp224r1 = 713, + WC_NID_secp384r1 = 715, + WC_NID_secp521r1 = 716, + WC_NID_secp160k1 = 708, + WC_NID_secp192k1 = 711, + WC_NID_secp224k1 = 712, + WC_NID_secp256k1 = 714, + WC_NID_brainpoolP160r1 = 921, + WC_NID_brainpoolP192r1 = 923, + WC_NID_brainpoolP224r1 = 925, + WC_NID_brainpoolP256r1 = 927, + WC_NID_brainpoolP320r1 = 929, + WC_NID_brainpoolP384r1 = 931, + WC_NID_brainpoolP512r1 = 933, +#endif + +#ifdef HAVE_ED448 + WC_NID_ED448 = ED448k, +#endif +#ifdef HAVE_CURVE448 + WC_NID_X448 = X448k, +#endif +#ifdef HAVE_ED25519 + WC_NID_ED25519 = ED25519k, +#endif +#ifdef HAVE_CURVE25519 + WC_NID_X25519 = X25519k, +#endif + + WOLFSSL_EC_EXPLICIT_CURVE = 0x000, + WOLFSSL_EC_NAMED_CURVE = 0x001 +}; + +#ifndef OPENSSL_COEXIST + +#define POINT_CONVERSION_COMPRESSED WC_POINT_CONVERSION_COMPRESSED +#define POINT_CONVERSION_UNCOMPRESSED WC_POINT_CONVERSION_UNCOMPRESSED + +#ifdef HAVE_ECC +#define NID_X9_62_prime192v1 WC_NID_X9_62_prime192v1 +#define NID_X9_62_prime192v2 WC_NID_X9_62_prime192v2 +#define NID_X9_62_prime192v3 WC_NID_X9_62_prime192v3 +#define NID_X9_62_prime239v1 WC_NID_X9_62_prime239v1 +#define NID_X9_62_prime239v2 WC_NID_X9_62_prime239v2 +#define NID_X9_62_prime239v3 WC_NID_X9_62_prime239v3 +#define NID_X9_62_prime256v1 WC_NID_X9_62_prime256v1 +#define NID_secp112r1 WC_NID_secp112r1 +#define NID_secp112r2 WC_NID_secp112r2 +#define NID_secp128r1 WC_NID_secp128r1 +#define NID_secp128r2 WC_NID_secp128r2 +#define NID_secp160r1 WC_NID_secp160r1 +#define NID_secp160r2 WC_NID_secp160r2 +#define NID_secp224r1 WC_NID_secp224r1 +#define NID_secp384r1 WC_NID_secp384r1 +#define NID_secp521r1 WC_NID_secp521r1 +#define NID_secp160k1 WC_NID_secp160k1 +#define NID_secp192k1 WC_NID_secp192k1 +#define NID_secp224k1 WC_NID_secp224k1 +#define NID_secp256k1 WC_NID_secp256k1 +#define NID_brainpoolP160r1 WC_NID_brainpoolP160r1 +#define NID_brainpoolP192r1 WC_NID_brainpoolP192r1 +#define NID_brainpoolP224r1 WC_NID_brainpoolP224r1 +#define NID_brainpoolP256r1 WC_NID_brainpoolP256r1 +#define NID_brainpoolP320r1 WC_NID_brainpoolP320r1 +#define NID_brainpoolP384r1 WC_NID_brainpoolP384r1 +#define NID_brainpoolP512r1 WC_NID_brainpoolP512r1 +#endif + +#ifdef HAVE_ED448 +#define NID_ED448 WC_NID_ED448 +#endif +#ifdef HAVE_CURVE448 +#define NID_X448 WC_NID_X448 +#endif +#ifdef HAVE_ED25519 +#define NID_ED25519 WC_NID_ED25519 +#endif +#ifdef HAVE_CURVE25519 +#define NID_X25519 WC_NID_X25519 +#endif + +#define OPENSSL_EC_EXPLICIT_CURVE WOLFSSL_EC_EXPLICIT_CURVE +#define OPENSSL_EC_NAMED_CURVE WOLFSSL_EC_NAMED_CURVE + +#endif /* !OPENSSL_COEXIST */ + +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + +#ifndef WOLFSSL_EC_TYPE_DEFINED /* guard on redeclaration */ + typedef struct WOLFSSL_EC_KEY WOLFSSL_EC_KEY; + typedef struct WOLFSSL_EC_POINT WOLFSSL_EC_POINT; + typedef struct WOLFSSL_EC_GROUP WOLFSSL_EC_GROUP; + typedef struct WOLFSSL_EC_BUILTIN_CURVE WOLFSSL_EC_BUILTIN_CURVE; + /* WOLFSSL_EC_METHOD is just an alias of WOLFSSL_EC_GROUP for now */ + typedef struct WOLFSSL_EC_GROUP WOLFSSL_EC_METHOD; + + #define WOLFSSL_EC_TYPE_DEFINED +#endif + +struct WOLFSSL_EC_POINT { + WOLFSSL_BIGNUM *X; + WOLFSSL_BIGNUM *Y; + WOLFSSL_BIGNUM *Z; + + void* internal; /* our ECC point */ + char inSet; /* internal set from external ? */ + char exSet; /* external set from internal ? */ +}; + +struct WOLFSSL_EC_GROUP { + int curve_idx; /* index of curve, used by WolfSSL as reference */ + int curve_nid; /* NID of curve, used by OpenSSL/OpenSSH as reference */ + int curve_oid; /* OID of curve, used by OpenSSL/OpenSSH as reference */ +}; + +struct WOLFSSL_EC_KEY { + WOLFSSL_EC_GROUP *group; + WOLFSSL_EC_POINT *pub_key; + WOLFSSL_BIGNUM *priv_key; + + void* internal; /* our ECC Key */ + void* heap; + unsigned char form; /* Either POINT_CONVERSION_UNCOMPRESSED or + * POINT_CONVERSION_COMPRESSED */ + word16 pkcs8HeaderSz; + + /* option bits */ + WC_BITFIELD inSet:1; /* internal set from external ? */ + WC_BITFIELD exSet:1; /* external set from internal ? */ + + wolfSSL_Ref ref; /* Reference count information. */ +}; + +struct WOLFSSL_EC_BUILTIN_CURVE { + int nid; + const char *comment; +}; + +#define WOLFSSL_EC_KEY_LOAD_PRIVATE 1 +#define WOLFSSL_EC_KEY_LOAD_PUBLIC 2 + +typedef int wc_point_conversion_form_t; +#ifndef OPENSSL_COEXIST +#define point_conversion_form_t wc_point_conversion_form_t +#endif + +typedef struct WOLFSSL_EC_KEY_METHOD { + /* Not implemented */ + /* Just here so that some C compilers don't complain. To be removed. */ + void* dummy_member; +} WOLFSSL_EC_KEY_METHOD; + +WOLFSSL_API +size_t wolfSSL_EC_get_builtin_curves(WOLFSSL_EC_BUILTIN_CURVE *r,size_t nitems); + +WOLFSSL_API +WOLFSSL_EC_KEY *wolfSSL_EC_KEY_dup(const WOLFSSL_EC_KEY *src); +WOLFSSL_API +int wolfSSL_EC_KEY_up_ref(WOLFSSL_EC_KEY* key); + +WOLFSSL_API +int wolfSSL_ECPoint_i2d(const WOLFSSL_EC_GROUP *curve, + const WOLFSSL_EC_POINT *p, + unsigned char *out, unsigned int *len); +WOLFSSL_API +int wolfSSL_ECPoint_d2i(const unsigned char *in, unsigned int len, + const WOLFSSL_EC_GROUP *curve, WOLFSSL_EC_POINT *p); +WOLFSSL_API +size_t wolfSSL_EC_POINT_point2oct(const WOLFSSL_EC_GROUP *group, + const WOLFSSL_EC_POINT *p, + int form, + byte *buf, size_t len, WOLFSSL_BN_CTX *ctx); +WOLFSSL_API +int wolfSSL_EC_POINT_oct2point(const WOLFSSL_EC_GROUP *group, + WOLFSSL_EC_POINT *p, const unsigned char *buf, + size_t len, WOLFSSL_BN_CTX *ctx); +WOLFSSL_API +WOLFSSL_EC_KEY *wolfSSL_o2i_ECPublicKey(WOLFSSL_EC_KEY **a, const unsigned char **in, + long len); +WOLFSSL_API +int wolfSSL_i2o_ECPublicKey(const WOLFSSL_EC_KEY *in, unsigned char **out); +WOLFSSL_API +WOLFSSL_EC_KEY *wolfSSL_d2i_ECPrivateKey(WOLFSSL_EC_KEY **key, const unsigned char **in, + long len); +WOLFSSL_API +int wolfSSL_i2d_ECPrivateKey(const WOLFSSL_EC_KEY *in, unsigned char **out); +WOLFSSL_API +void wolfSSL_EC_KEY_set_conv_form(WOLFSSL_EC_KEY *eckey, int form); +WOLFSSL_API +wc_point_conversion_form_t wolfSSL_EC_KEY_get_conv_form(const WOLFSSL_EC_KEY* key); +WOLFSSL_API +WOLFSSL_BIGNUM *wolfSSL_EC_POINT_point2bn(const WOLFSSL_EC_GROUP *group, + const WOLFSSL_EC_POINT *p, + int form, + WOLFSSL_BIGNUM *in, WOLFSSL_BN_CTX *ctx); +WOLFSSL_API +int wolfSSL_EC_POINT_is_on_curve(const WOLFSSL_EC_GROUP *group, + const WOLFSSL_EC_POINT *point, + WOLFSSL_BN_CTX *ctx); + +WOLFSSL_API +int wolfSSL_EC_KEY_LoadDer(WOLFSSL_EC_KEY* key, + const unsigned char* der, int derSz); +WOLFSSL_API +int wolfSSL_EC_KEY_LoadDer_ex(WOLFSSL_EC_KEY* key, + const unsigned char* der, int derSz, int opt); +WOLFSSL_API +WOLFSSL_EC_KEY *wolfSSL_d2i_EC_PUBKEY_bio(WOLFSSL_BIO *bio, + WOLFSSL_EC_KEY **out); +WOLFSSL_API +void wolfSSL_EC_KEY_free(WOLFSSL_EC_KEY *key); +WOLFSSL_API +WOLFSSL_EC_POINT *wolfSSL_EC_KEY_get0_public_key(const WOLFSSL_EC_KEY *key); +WOLFSSL_API +const WOLFSSL_EC_GROUP *wolfSSL_EC_KEY_get0_group(const WOLFSSL_EC_KEY *key); +WOLFSSL_API +int wolfSSL_EC_KEY_set_private_key(WOLFSSL_EC_KEY *key, + const WOLFSSL_BIGNUM *priv_key); +WOLFSSL_API +WOLFSSL_BIGNUM *wolfSSL_EC_KEY_get0_private_key(const WOLFSSL_EC_KEY *key); +WOLFSSL_API +WOLFSSL_EC_KEY *wolfSSL_EC_KEY_new_by_curve_name(int nid); +WOLFSSL_API const char* wolfSSL_EC_curve_nid2nist(int nid); +WOLFSSL_API int wolfSSL_EC_curve_nist2nid(const char* name); +WOLFSSL_API +WOLFSSL_EC_KEY *wolfSSL_EC_KEY_new_ex(void* heap, int devId); +WOLFSSL_API +WOLFSSL_EC_KEY *wolfSSL_EC_KEY_new(void); +WOLFSSL_API +int wolfSSL_EC_KEY_set_group(WOLFSSL_EC_KEY *key, WOLFSSL_EC_GROUP *group); +WOLFSSL_API +int wolfSSL_EC_KEY_generate_key(WOLFSSL_EC_KEY *key); +WOLFSSL_API +void wolfSSL_EC_KEY_set_asn1_flag(WOLFSSL_EC_KEY *key, int asn1_flag); +WOLFSSL_API +int wolfSSL_EC_KEY_set_public_key(WOLFSSL_EC_KEY *key, + const WOLFSSL_EC_POINT *pub); +WOLFSSL_API int wolfSSL_EC_KEY_check_key(const WOLFSSL_EC_KEY *key); +#if !defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM) +WOLFSSL_API int wolfSSL_EC_KEY_print_fp(XFILE fp, WOLFSSL_EC_KEY* key, + int indent); +#endif /* !NO_FILESYSTEM && !NO_STDIO_FILESYSTEM */ +WOLFSSL_API int wolfSSL_ECDSA_size(const WOLFSSL_EC_KEY *key); +WOLFSSL_API int wolfSSL_ECDSA_sign(int type, const unsigned char *digest, + int digestSz, unsigned char *sig, + unsigned int *sigSz, WOLFSSL_EC_KEY *key); +WOLFSSL_API int wolfSSL_ECDSA_verify(int type, const unsigned char *digest, + int digestSz, const unsigned char *sig, + int sigSz, WOLFSSL_EC_KEY *key); + + +#if defined HAVE_ECC && (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) +WOLFSSL_API int EccEnumToNID(int n); +#endif + +WOLFSSL_API +void wolfSSL_EC_GROUP_set_asn1_flag(WOLFSSL_EC_GROUP *group, int flag); +WOLFSSL_API +WOLFSSL_EC_GROUP *wolfSSL_EC_GROUP_new_by_curve_name(int nid); +WOLFSSL_API +int wolfSSL_EC_GROUP_cmp(const WOLFSSL_EC_GROUP *a, const WOLFSSL_EC_GROUP *b, + WOLFSSL_BN_CTX *ctx); +WOLFSSL_API +WOLFSSL_EC_GROUP *wolfSSL_EC_GROUP_dup(const WOLFSSL_EC_GROUP *src); +WOLFSSL_API +int wolfSSL_EC_GROUP_get_curve_name(const WOLFSSL_EC_GROUP *group); +WOLFSSL_API +int wolfSSL_EC_GROUP_get_degree(const WOLFSSL_EC_GROUP *group); +WOLFSSL_API +int wolfSSL_EC_GROUP_get_order(const WOLFSSL_EC_GROUP *group, + WOLFSSL_BIGNUM *order, WOLFSSL_BN_CTX *ctx); +WOLFSSL_API +int wolfSSL_EC_GROUP_order_bits(const WOLFSSL_EC_GROUP *group); +WOLFSSL_API +void wolfSSL_EC_GROUP_free(WOLFSSL_EC_GROUP *group); +WOLFSSL_API +const WOLFSSL_EC_METHOD* wolfSSL_EC_GROUP_method_of( + const WOLFSSL_EC_GROUP *group); +WOLFSSL_API +int wolfSSL_EC_METHOD_get_field_type(const WOLFSSL_EC_METHOD *meth); +WOLFSSL_API +WOLFSSL_EC_POINT *wolfSSL_EC_POINT_new(const WOLFSSL_EC_GROUP *group); +WOLFSSL_LOCAL +int ec_point_convert_to_affine(const WOLFSSL_EC_GROUP *group, + WOLFSSL_EC_POINT *point); +WOLFSSL_API +int wolfSSL_EC_POINT_get_affine_coordinates_GFp(const WOLFSSL_EC_GROUP *group, + const WOLFSSL_EC_POINT *p, + WOLFSSL_BIGNUM *x, + WOLFSSL_BIGNUM *y, + WOLFSSL_BN_CTX *ctx); +WOLFSSL_API +int wolfSSL_EC_POINT_set_affine_coordinates_GFp(const WOLFSSL_EC_GROUP *group, + WOLFSSL_EC_POINT *point, + const WOLFSSL_BIGNUM *x, + const WOLFSSL_BIGNUM *y, + WOLFSSL_BN_CTX *ctx); +WOLFSSL_API +int wolfSSL_EC_POINT_add(const WOLFSSL_EC_GROUP *group, WOLFSSL_EC_POINT *r, + const WOLFSSL_EC_POINT *p1, + const WOLFSSL_EC_POINT *p2, WOLFSSL_BN_CTX *ctx); +WOLFSSL_API +int wolfSSL_EC_POINT_mul(const WOLFSSL_EC_GROUP *group, WOLFSSL_EC_POINT *r, + const WOLFSSL_BIGNUM *n, + const WOLFSSL_EC_POINT *q, const WOLFSSL_BIGNUM *m, + WOLFSSL_BN_CTX *ctx); +WOLFSSL_API +int wolfSSL_EC_POINT_invert(const WOLFSSL_EC_GROUP *group, WOLFSSL_EC_POINT *a, + WOLFSSL_BN_CTX *ctx); +WOLFSSL_API +void wolfSSL_EC_POINT_clear_free(WOLFSSL_EC_POINT *point); +WOLFSSL_API +int wolfSSL_EC_POINT_cmp(const WOLFSSL_EC_GROUP *group, + const WOLFSSL_EC_POINT *a, const WOLFSSL_EC_POINT *b, + WOLFSSL_BN_CTX *ctx); +WOLFSSL_API int wolfSSL_EC_POINT_copy(WOLFSSL_EC_POINT *dest, + const WOLFSSL_EC_POINT *src); +WOLFSSL_API +void wolfSSL_EC_POINT_free(WOLFSSL_EC_POINT *point); +WOLFSSL_API +int wolfSSL_EC_POINT_is_at_infinity(const WOLFSSL_EC_GROUP *group, + const WOLFSSL_EC_POINT *a); + +WOLFSSL_API +char* wolfSSL_EC_POINT_point2hex(const WOLFSSL_EC_GROUP* group, + const WOLFSSL_EC_POINT* point, int form, + WOLFSSL_BN_CTX* ctx); +WOLFSSL_API +WOLFSSL_EC_POINT *wolfSSL_EC_POINT_hex2point + (const WOLFSSL_EC_GROUP *group, const char *hex, + WOLFSSL_EC_POINT *p, WOLFSSL_BN_CTX *ctx); + +WOLFSSL_API const WOLFSSL_EC_KEY_METHOD *wolfSSL_EC_KEY_OpenSSL(void); +WOLFSSL_API WOLFSSL_EC_KEY_METHOD *wolfSSL_EC_KEY_METHOD_new( + const WOLFSSL_EC_KEY_METHOD *meth); +WOLFSSL_API void wolfSSL_EC_KEY_METHOD_free(WOLFSSL_EC_KEY_METHOD *meth); +/* TODO when implementing change the types to the real callback signatures + * and use real parameter names */ +WOLFSSL_API void wolfSSL_EC_KEY_METHOD_set_init(WOLFSSL_EC_KEY_METHOD *meth, + void* a1, void* a2, void* a3, void* a4, void* a5, void* a6); +WOLFSSL_API void wolfSSL_EC_KEY_METHOD_set_sign(WOLFSSL_EC_KEY_METHOD *meth, + void* a1, void* a2, void* a3); +WOLFSSL_API const WOLFSSL_EC_KEY_METHOD *wolfSSL_EC_KEY_get_method( + const WOLFSSL_EC_KEY *key); +WOLFSSL_API int wolfSSL_EC_KEY_set_method(WOLFSSL_EC_KEY *key, + const WOLFSSL_EC_KEY_METHOD *meth); + +#if !defined(OPENSSL_COEXIST) && (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) + +typedef WOLFSSL_EC_KEY EC_KEY; +typedef WOLFSSL_EC_GROUP EC_GROUP; +typedef WOLFSSL_EC_GROUP EC_METHOD; +typedef WOLFSSL_EC_POINT EC_POINT; +typedef WOLFSSL_EC_BUILTIN_CURVE EC_builtin_curve; +typedef WOLFSSL_EC_KEY_METHOD EC_KEY_METHOD; + +#ifndef HAVE_ECC +#define OPENSSL_NO_EC +#endif + +#define EC_KEY_new wolfSSL_EC_KEY_new +#define EC_KEY_free wolfSSL_EC_KEY_free +#define EC_KEY_up_ref wolfSSL_EC_KEY_up_ref +#define EC_KEY_dup wolfSSL_EC_KEY_dup +#define EC_KEY_get0_public_key wolfSSL_EC_KEY_get0_public_key +#define EC_KEY_get0_group wolfSSL_EC_KEY_get0_group +#define EC_KEY_set_private_key wolfSSL_EC_KEY_set_private_key +#define EC_KEY_get0_private_key wolfSSL_EC_KEY_get0_private_key +#define EC_KEY_new_by_curve_name wolfSSL_EC_KEY_new_by_curve_name +#define EC_KEY_set_group wolfSSL_EC_KEY_set_group +#define EC_KEY_generate_key wolfSSL_EC_KEY_generate_key +#define EC_KEY_set_asn1_flag wolfSSL_EC_KEY_set_asn1_flag +#define EC_KEY_set_public_key wolfSSL_EC_KEY_set_public_key +#define EC_KEY_check_key wolfSSL_EC_KEY_check_key +#define EC_KEY_print_fp wolfSSL_EC_KEY_print_fp + +#define d2i_EC_PUBKEY_bio wolfSSL_d2i_EC_PUBKEY_bio + +#define ECDSA_size wolfSSL_ECDSA_size +#define ECDSA_sign wolfSSL_ECDSA_sign +#define ECDSA_verify wolfSSL_ECDSA_verify + +#define EC_GROUP_free wolfSSL_EC_GROUP_free +#define EC_GROUP_set_asn1_flag wolfSSL_EC_GROUP_set_asn1_flag +#define EC_GROUP_new_by_curve_name wolfSSL_EC_GROUP_new_by_curve_name +#define EC_GROUP_cmp wolfSSL_EC_GROUP_cmp +#define EC_GROUP_dup wolfSSL_EC_GROUP_dup +#define EC_GROUP_get_curve_name wolfSSL_EC_GROUP_get_curve_name +#define EC_GROUP_get_degree wolfSSL_EC_GROUP_get_degree +#define EC_GROUP_get_order wolfSSL_EC_GROUP_get_order +#define EC_GROUP_order_bits wolfSSL_EC_GROUP_order_bits +#define EC_GROUP_method_of wolfSSL_EC_GROUP_method_of +#ifndef NO_WOLFSSL_STUB +#ifdef WOLF_NO_VARIADIC_MACROS + #define EC_GROUP_set_point_conversion_form() WC_DO_NOTHING +#else + #define EC_GROUP_set_point_conversion_form(...) WC_DO_NOTHING +#endif +#endif + +#define EC_METHOD_get_field_type wolfSSL_EC_METHOD_get_field_type + +#define EC_POINT_new wolfSSL_EC_POINT_new +#define EC_POINT_free wolfSSL_EC_POINT_free +#define EC_POINT_get_affine_coordinates_GFp \ + wolfSSL_EC_POINT_get_affine_coordinates_GFp +#define EC_POINT_get_affine_coordinates \ + wolfSSL_EC_POINT_get_affine_coordinates_GFp +#define EC_POINT_set_affine_coordinates_GFp \ + wolfSSL_EC_POINT_set_affine_coordinates_GFp +#define EC_POINT_set_affine_coordinates \ + wolfSSL_EC_POINT_set_affine_coordinates_GFp +#define EC_POINT_add wolfSSL_EC_POINT_add +#define EC_POINT_mul wolfSSL_EC_POINT_mul +#define EC_POINT_invert wolfSSL_EC_POINT_invert +#define EC_POINT_clear_free wolfSSL_EC_POINT_clear_free +#define EC_POINT_cmp wolfSSL_EC_POINT_cmp +#define EC_POINT_copy wolfSSL_EC_POINT_copy +#define EC_POINT_is_at_infinity wolfSSL_EC_POINT_is_at_infinity + +#define EC_get_builtin_curves wolfSSL_EC_get_builtin_curves + +#define ECPoint_i2d wolfSSL_ECPoint_i2d +#define ECPoint_d2i wolfSSL_ECPoint_d2i +#define EC_POINT_point2oct wolfSSL_EC_POINT_point2oct +#define EC_POINT_oct2point wolfSSL_EC_POINT_oct2point +#define EC_POINT_point2bn wolfSSL_EC_POINT_point2bn +#define EC_POINT_is_on_curve wolfSSL_EC_POINT_is_on_curve +#define o2i_ECPublicKey wolfSSL_o2i_ECPublicKey +#define i2o_ECPublicKey wolfSSL_i2o_ECPublicKey +#define i2d_EC_PUBKEY wolfSSL_i2o_ECPublicKey +#define d2i_ECPrivateKey wolfSSL_d2i_ECPrivateKey +#define i2d_ECPrivateKey wolfSSL_i2d_ECPrivateKey +#define EC_KEY_set_conv_form wolfSSL_EC_KEY_set_conv_form +#define EC_KEY_get_conv_form wolfSSL_EC_KEY_get_conv_form +#define d2i_ECPKParameters wolfSSL_d2i_ECPKParameters +#define i2d_ECPKParameters wolfSSL_i2d_ECPKParameters + +#define EC_POINT_point2hex wolfSSL_EC_POINT_point2hex +#define EC_POINT_hex2point wolfSSL_EC_POINT_hex2point + +#define EC_POINT_dump wolfSSL_EC_POINT_dump +#define EC_get_builtin_curves wolfSSL_EC_get_builtin_curves + +#define EC_curve_nid2nist wolfSSL_EC_curve_nid2nist +#define EC_curve_nist2nid wolfSSL_EC_curve_nist2nid + +#define EC_KEY_OpenSSL wolfSSL_EC_KEY_OpenSSL +#define EC_KEY_METHOD_new wolfSSL_EC_KEY_METHOD_new +#define EC_KEY_METHOD_free wolfSSL_EC_KEY_METHOD_free +#define EC_KEY_METHOD_set_init wolfSSL_EC_KEY_METHOD_set_init +#define EC_KEY_METHOD_set_sign wolfSSL_EC_KEY_METHOD_set_sign +#define EC_KEY_get_method wolfSSL_EC_KEY_get_method +#define EC_KEY_set_method wolfSSL_EC_KEY_set_method + +#endif /* !OPENSSL_COEXIST && (OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL) */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* header */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ec25519.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ec25519.h @@ -0,0 +1,46 @@ +/* ec25519.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* ec25519.h */ + +#ifndef WOLFSSL_EC25519_H_ +#define WOLFSSL_EC25519_H_ + +#include <wolfssl/openssl/compat_types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WOLFSSL_API +int wolfSSL_EC25519_generate_key(unsigned char *priv, unsigned int *privSz, + unsigned char *pub, unsigned int *pubSz); + +WOLFSSL_API +int wolfSSL_EC25519_shared_key(unsigned char *shared, unsigned int *sharedSz, + const unsigned char *priv, unsigned int privSz, + const unsigned char *pub, unsigned int pubSz); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* header */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ec448.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ec448.h @@ -0,0 +1,46 @@ +/* ec448.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* ec448.h */ + +#ifndef WOLFSSL_EC448_H_ +#define WOLFSSL_EC448_H_ + +#include <wolfssl/openssl/compat_types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WOLFSSL_API +int wolfSSL_EC448_generate_key(unsigned char *priv, unsigned int *privSz, + unsigned char *pub, unsigned int *pubSz); + +WOLFSSL_API +int wolfSSL_EC448_shared_key(unsigned char *shared, unsigned int *sharedSz, + const unsigned char *priv, unsigned int privSz, + const unsigned char *pub, unsigned int pubSz); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* header */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ecdh.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ecdh.h @@ -0,0 +1,49 @@ +/* ecdh.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* ecdh.h for openssl */ + +#ifndef WOLFSSL_ECDH_H_ +#define WOLFSSL_ECDH_H_ + +#include <wolfssl/openssl/ssl.h> +#include <wolfssl/openssl/bn.h> + +#ifdef __cplusplus +extern "C" { +#endif + + +WOLFSSL_API int wolfSSL_ECDH_compute_key(void *out, size_t outlen, + const WOLFSSL_EC_POINT *pub_key, + WOLFSSL_EC_KEY *ecdh, + void *(*KDF) (const void *in, + size_t inlen, + void *out, + size_t *outlen)); + +#define ECDH_compute_key wolfSSL_ECDH_compute_key + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif /* header */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ecdsa.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ecdsa.h @@ -0,0 +1,87 @@ +/* ecdsa.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* ecdsa.h for openssl */ + +#ifndef WOLFSSL_ECDSA_H_ +#define WOLFSSL_ECDSA_H_ + +#include <wolfssl/openssl/bn.h> +#include <wolfssl/openssl/ec.h> + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef WOLFSSL_ECDSA_TYPE_DEFINED /* guard on redeclaration */ +typedef struct WOLFSSL_ECDSA_SIG WOLFSSL_ECDSA_SIG; +#define WOLFSSL_ECDSA_TYPE_DEFINED +#endif + +#ifndef OPENSSL_COEXIST +typedef WOLFSSL_ECDSA_SIG ECDSA_SIG; +#endif + +struct WOLFSSL_ECDSA_SIG { + WOLFSSL_BIGNUM *r; + WOLFSSL_BIGNUM *s; +}; + +WOLFSSL_API void wolfSSL_ECDSA_SIG_free(WOLFSSL_ECDSA_SIG *sig); +WOLFSSL_API WOLFSSL_ECDSA_SIG *wolfSSL_ECDSA_SIG_new(void); +WOLFSSL_API void wolfSSL_ECDSA_SIG_get0(const WOLFSSL_ECDSA_SIG* sig, + const WOLFSSL_BIGNUM** r, const WOLFSSL_BIGNUM** s); +WOLFSSL_API int wolfSSL_ECDSA_SIG_set0(WOLFSSL_ECDSA_SIG* sig, WOLFSSL_BIGNUM* r, + WOLFSSL_BIGNUM* s); +WOLFSSL_API WOLFSSL_ECDSA_SIG *wolfSSL_ECDSA_do_sign(const unsigned char *dgst, + int dgst_len, + WOLFSSL_EC_KEY *eckey); +WOLFSSL_API int wolfSSL_ECDSA_do_verify(const unsigned char *dgst, + int dgst_len, + const WOLFSSL_ECDSA_SIG *sig, + WOLFSSL_EC_KEY *eckey); + +WOLFSSL_API WOLFSSL_ECDSA_SIG *wolfSSL_d2i_ECDSA_SIG(WOLFSSL_ECDSA_SIG **sig, + const unsigned char **pp, + long len); +WOLFSSL_API int wolfSSL_i2d_ECDSA_SIG(const WOLFSSL_ECDSA_SIG *sig, + unsigned char **pp); + +#ifndef OPENSSL_COEXIST + +#define ECDSA_SIG_free wolfSSL_ECDSA_SIG_free +#define ECDSA_SIG_new wolfSSL_ECDSA_SIG_new +#define ECDSA_SIG_get0 wolfSSL_ECDSA_SIG_get0 +#define ECDSA_SIG_set0 wolfSSL_ECDSA_SIG_set0 +#define ECDSA_do_sign wolfSSL_ECDSA_do_sign +#define ECDSA_do_verify wolfSSL_ECDSA_do_verify +#define d2i_ECDSA_SIG wolfSSL_d2i_ECDSA_SIG +#define i2d_ECDSA_SIG wolfSSL_i2d_ECDSA_SIG + +#endif /* !OPENSSL_COEXIST */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* header */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ed25519.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ed25519.h @@ -0,0 +1,49 @@ +/* ed25519.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* ed25519.h */ + +#ifndef WOLFSSL_ED25519_H_ +#define WOLFSSL_ED25519_H_ + +#include <wolfssl/openssl/compat_types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WOLFSSL_API +int wolfSSL_ED25519_generate_key(unsigned char *priv, unsigned int *privSz, + unsigned char *pub, unsigned int *pubSz); +WOLFSSL_API +int wolfSSL_ED25519_sign(const unsigned char *msg, unsigned int msgSz, + const unsigned char *priv, unsigned int privSz, + unsigned char *sig, unsigned int *sigSz); +WOLFSSL_API +int wolfSSL_ED25519_verify(const unsigned char *msg, unsigned int msgSz, + const unsigned char *pub, unsigned int pubSz, + const unsigned char *sig, unsigned int sigSz); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* header */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ed448.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ed448.h @@ -0,0 +1,49 @@ +/* ed448.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* ed448.h */ + +#ifndef WOLFSSL_ED448_H_ +#define WOLFSSL_ED448_H_ + +#include <wolfssl/openssl/compat_types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WOLFSSL_API +int wolfSSL_ED448_generate_key(unsigned char *priv, unsigned int *privSz, + unsigned char *pub, unsigned int *pubSz); +WOLFSSL_API +int wolfSSL_ED448_sign(const unsigned char *msg, unsigned int msgSz, + const unsigned char *priv, unsigned int privSz, + unsigned char *sig, unsigned int *sigSz); +WOLFSSL_API +int wolfSSL_ED448_verify(const unsigned char *msg, unsigned int msgSz, + const unsigned char *pub, unsigned int pubSz, + const unsigned char *sig, unsigned int sigSz); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* header */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/engine.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/engine.h @@ -0,0 +1,9 @@ +/* engine.h for libcurl */ + +#include <wolfssl/openssl/err.h> + +#undef HAVE_OPENSSL_ENGINE_H + +/* ENGINE_load_builtin_engines not needed, as all builtin engines are already + loaded into memory and used on startup. */ +#define ENGINE_load_builtin_engines() WC_DO_NOTHING diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/err.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/err.h @@ -0,0 +1,84 @@ +/* err.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifndef WOLFSSL_OPENSSL_ERR_ +#define WOLFSSL_OPENSSL_ERR_ + +#include <wolfssl/wolfcrypt/logging.h> + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + +#define wolfSSL_RSAerr(f,r) wolfSSL_ERR_put_error(0,(f),(r),__FILE__,__LINE__) +#define wolfSSL_SSLerr(f,r) wolfSSL_ERR_put_error(0,(f),(r),__FILE__,__LINE__) +#define wolfSSL_ECerr(f,r) wolfSSL_ERR_put_error(0,(f),(r),__FILE__,__LINE__) + +#define WOLFSSL_ERR_TXT_MALLOCED 1 + +/* SSL function codes */ +#define WOLFSSL_RSA_F_RSA_PADDING_ADD_SSLV23 0 +#define WOLFSSL_RSA_F_RSA_OSSL_PRIVATE_ENCRYPT 1 +#define WOLFSSL_SSL_F_SSL_CTX_USE_CERTIFICATE_FILE 2 +#define WOLFSSL_SSL_F_SSL_USE_PRIVATEKEY 3 +#define WOLFSSL_EC_F_EC_GFP_SIMPLE_POINT2OCT 4 + +/* reasons */ +#define WOLFSSL_ERR_R_SYS_LIB 1 +#define WOLFSSL_PKCS12_R_MAC_VERIFY_FAILURE 2 + +#ifndef OPENSSL_COEXIST + +/* err.h for openssl */ +#define ERR_load_ERR_strings wolfSSL_ERR_load_ERR_strings +#define ERR_load_crypto_strings wolfSSL_ERR_load_crypto_strings +#define ERR_load_CRYPTO_strings wolfSSL_ERR_load_crypto_strings +#define ERR_peek_last_error wolfSSL_ERR_peek_last_error + +/* fatal error */ +#define ERR_R_MALLOC_FAILURE MEMORY_E +#define ERR_R_PASSED_NULL_PARAMETER BAD_FUNC_ARG +#define ERR_R_DISABLED NOT_COMPILED_IN +#define ERR_R_PASSED_INVALID_ARGUMENT BAD_FUNC_ARG +#define RSA_R_UNKNOWN_PADDING_TYPE RSA_PAD_E +#define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE WC_KEY_SIZE_E +#define EC_R_BUFFER_TOO_SMALL BUFFER_E + +#define ERR_TXT_MALLOCED WOLFSSL_ERR_TXT_MALLOCED + +/* SSL function codes */ +#define RSA_F_RSA_PADDING_ADD_SSLV23 WOLFSSL_RSA_F_RSA_PADDING_ADD_SSLV23 +#define RSA_F_RSA_OSSL_PRIVATE_ENCRYPT WOLFSSL_RSA_F_RSA_OSSL_PRIVATE_ENCRYPT +#define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE WOLFSSL_SSL_F_SSL_CTX_USE_CERTIFICATE_FILE +#define SSL_F_SSL_USE_PRIVATEKEY WOLFSSL_SSL_F_SSL_USE_PRIVATEKEY +#define EC_F_EC_GFP_SIMPLE_POINT2OCT WOLFSSL_EC_F_EC_GFP_SIMPLE_POINT2OCT + +/* reasons */ +#define ERR_R_SYS_LIB WOLFSSL_ERR_R_SYS_LIB +#define PKCS12_R_MAC_VERIFY_FAILURE WOLFSSL_PKCS12_R_MAC_VERIFY_FAILURE + +#define RSAerr(f,r) wolfSSL_RSAerr(f,r) +#define SSLerr(f,r) wolfSSL_SSLerr(f,r) +#define ECerr(f,r) wolfSSL_ECerr(f,r) + +#endif /* !OPENSSL_COEXIST */ + +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + +#endif /* WOLFSSL_OPENSSL_ERR_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/evp.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/evp.h @@ -0,0 +1,1540 @@ +/* evp.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + +/*! + \file wolfssl/openssl/evp.h + \brief evp.h defines mini evp openssl compatibility layer + */ + + +#ifndef WOLFSSL_EVP_H_ +#define WOLFSSL_EVP_H_ + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef WOLFSSL_PREFIX +#include "prefix_evp.h" +#endif + +#ifndef NO_MD4 + #include <wolfssl/openssl/md4.h> +#endif +#ifndef NO_MD5 + #include <wolfssl/openssl/md5.h> +#endif +#include <wolfssl/openssl/sha.h> +#include <wolfssl/openssl/sha3.h> +#include <wolfssl/openssl/ripemd.h> +#include <wolfssl/openssl/rsa.h> +#include <wolfssl/openssl/dsa.h> +#include <wolfssl/openssl/ec.h> +#include <wolfssl/openssl/dh.h> +#include <wolfssl/openssl/opensslv.h> +#include <wolfssl/openssl/compat_types.h> + +#include <wolfssl/wolfcrypt/aes.h> +#include <wolfssl/wolfcrypt/des3.h> +#include <wolfssl/wolfcrypt/arc4.h> +#include <wolfssl/wolfcrypt/chacha20_poly1305.h> +#include <wolfssl/wolfcrypt/hmac.h> +#include <wolfssl/wolfcrypt/pwdbased.h> +#ifdef WOLFSSL_SM3 + #include <wolfssl/wolfcrypt/sm3.h> +#endif +#ifdef WOLFSSL_SM4 + #include <wolfssl/wolfcrypt/sm4.h> +#endif + +#if defined(WOLFSSL_BASE64_ENCODE) || defined(WOLFSSL_BASE64_DECODE) +#include <wolfssl/wolfcrypt/coding.h> +#endif + +#ifdef HAVE_ARIA + #include <wolfssl/wolfcrypt/port/aria/aria-crypt.h> +#endif + +#ifdef __cplusplus + extern "C" { +#endif + + +#ifndef NO_MD4 + WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_md4(void); +#endif +#ifndef NO_MD5 + WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_md5(void); +#endif +WOLFSSL_API void wolfSSL_EVP_set_pw_prompt(const char *prompt); +WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_mdc2(void); +WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_sha1(void); +WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_sha224(void); +WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_sha256(void); +WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_sha384(void); +WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_sha512(void); +WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_shake128(void); +WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_shake256(void); +WOLFSSL_API const WOLFSSL_EVP_MD *wolfSSL_EVP_sha512_224(void); +WOLFSSL_API const WOLFSSL_EVP_MD *wolfSSL_EVP_sha512_256(void); +WOLFSSL_API const WOLFSSL_EVP_MD *wolfSSL_EVP_ripemd160(void); + +WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_sha3_224(void); +WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_sha3_256(void); +WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_sha3_384(void); +WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_sha3_512(void); + +WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_sm3(void); + +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_128_ecb(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_192_ecb(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_256_ecb(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_128_cbc(void); +#if !defined(NO_AES) && (defined(HAVE_AES_CBC) || defined(WOLFSSL_AES_DIRECT)) +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_192_cbc(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_256_cbc(void); +#endif +#ifndef NO_AES +#ifdef WOLFSSL_AES_CFB +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_128_cfb1(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_192_cfb1(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_256_cfb1(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_128_cfb8(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_192_cfb8(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_256_cfb8(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_128_cfb128(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_192_cfb128(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_256_cfb128(void); +#endif +#ifdef WOLFSSL_AES_OFB +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_128_ofb(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_192_ofb(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_256_ofb(void); +#endif +#ifdef WOLFSSL_AES_XTS +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_128_xts(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_256_xts(void); +#endif +#endif /* NO_AES */ +#if !defined(NO_AES) && defined(HAVE_AESGCM) +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_128_gcm(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_192_gcm(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_256_gcm(void); +#endif +#if !defined(NO_AES) && defined(HAVE_AESCCM) +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_128_ccm(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_192_ccm(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_256_ccm(void); +#endif +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_128_ctr(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_192_ctr(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_256_ctr(void); +#if defined(HAVE_ARIA) +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aria_128_gcm(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aria_192_gcm(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aria_256_gcm(void); +#endif +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_des_ecb(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_des_ede3_ecb(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_des_cbc(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_des_ede3_cbc(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_rc4(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_enc_null(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_rc2_cbc(void); +#if defined(HAVE_CHACHA) && defined(HAVE_POLY1305) +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_chacha20_poly1305(void); +#endif +#ifdef HAVE_CHACHA +/* ChaCha IV + counter is set as one IV in EVP */ +#define WOLFSSL_EVP_CHACHA_IV_BYTES (CHACHA_IV_BYTES + sizeof(word32)) +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_chacha20(void); +#endif +#ifdef WOLFSSL_SM4_ECB +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_sm4_ecb(void); +#endif +#ifdef WOLFSSL_SM4_CBC +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_sm4_cbc(void); +#endif +#ifdef WOLFSSL_SM4_CTR +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_sm4_ctr(void); +#endif +#ifdef WOLFSSL_SM4_GCM +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_sm4_gcm(void); +#endif +#ifdef WOLFSSL_SM4_CCM +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_sm4_ccm(void); +#endif + +typedef union { + #ifndef NO_MD4 + WOLFSSL_MD4_CTX md4; + #endif + #ifndef NO_MD5 + WOLFSSL_MD5_CTX md5; + #endif + #ifndef NO_SHA + WOLFSSL_SHA_CTX sha; + #endif + #ifdef WOLFSSL_SHA224 + WOLFSSL_SHA224_CTX sha224; + #endif + #ifndef NO_SHA256 + WOLFSSL_SHA256_CTX sha256; + #endif + #ifdef WOLFSSL_SHA384 + WOLFSSL_SHA384_CTX sha384; + #endif + #ifdef WOLFSSL_SHA512 + WOLFSSL_SHA512_CTX sha512; + #endif + #ifdef WOLFSSL_RIPEMD + WOLFSSL_RIPEMD_CTX ripemd; + #endif + #ifndef WOLFSSL_NOSHA3_224 + WOLFSSL_SHA3_224_CTX sha3_224; + #endif + #ifndef WOLFSSL_NOSHA3_256 + WOLFSSL_SHA3_256_CTX sha3_256; + #endif + WOLFSSL_SHA3_384_CTX sha3_384; + #ifndef WOLFSSL_NOSHA3_512 + WOLFSSL_SHA3_512_CTX sha3_512; + #endif + #ifdef WOLFSSL_SM3 + wc_Sm3 sm3; + #endif + #if defined(WOLFSSL_SHAKE128) || defined(WOLFSSL_SHAKE256) + wc_Shake shake; + #endif +} WOLFSSL_Hasher; + + +struct WOLFSSL_EVP_MD_CTX { + union { + WOLFSSL_Hasher digest; + #ifndef NO_HMAC + Hmac hmac; + #endif + } hash; + enum wc_HashType macType; + WOLFSSL_EVP_PKEY_CTX *pctx; +#ifndef NO_HMAC + unsigned int isHMAC; +#endif +}; + + +typedef union { +#ifndef NO_AES + Aes aes; +#ifdef WOLFSSL_AES_XTS + XtsAes xts; +#endif +#endif +#ifdef HAVE_ARIA + wc_Aria aria; +#endif +#ifndef NO_DES3 + Des des; + Des3 des3; +#endif + Arc4 arc4; +#ifdef WOLFSSL_QT + int (*ctrl) (WOLFSSL_EVP_CIPHER_CTX *, int type, int arg, void *ptr); +#endif +#if defined(HAVE_CHACHA) && defined(HAVE_POLY1305) + ChaChaPoly_Aead chachaPoly; +#endif +#ifdef HAVE_CHACHA + ChaCha chacha; +#endif +#ifdef WOLFSSL_SM4 + wc_Sm4 sm4; +#endif +} WOLFSSL_Cipher; + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + +/* note, this WC_NID_undef definition duplicates the definition in + * wolfcrypt/asn.h, which is gated out when -DNO_ASN. + */ +#define WC_NID_undef 0 + +#define WC_NID_aes_128_cbc 419 +#define WC_NID_aes_192_cbc 423 +#define WC_NID_aes_256_cbc 427 +#define WC_NID_aes_128_ccm 896 +#define WC_NID_aes_192_ccm 899 +#define WC_NID_aes_256_ccm 902 +#define WC_NID_aes_128_gcm 895 +#define WC_NID_aes_192_gcm 898 +#define WC_NID_aes_256_gcm 901 +#define WC_NID_aes_128_ctr 904 +#define WC_NID_aes_192_ctr 905 +#define WC_NID_aes_256_ctr 906 +#define WC_NID_aes_128_ecb 418 +#define WC_NID_aes_192_ecb 422 +#define WC_NID_aes_256_ecb 426 +#define WC_NID_des_cbc 31 +#define WC_NID_des_ecb 29 +#define WC_NID_des_ede3_cbc 44 +#define WC_NID_des_ede3_ecb 33 +#define WC_NID_aes_128_cfb1 650 +#define WC_NID_aes_192_cfb1 651 +#define WC_NID_aes_256_cfb1 652 +#define WC_NID_aes_128_cfb8 653 +#define WC_NID_aes_192_cfb8 654 +#define WC_NID_aes_256_cfb8 655 +#define WC_NID_aes_128_cfb128 421 +#define WC_NID_aes_192_cfb128 425 +#define WC_NID_aes_256_cfb128 429 +#define WC_NID_aes_128_ofb 420 +#define WC_NID_aes_192_ofb 424 +#define WC_NID_aes_256_ofb 428 +#define WC_NID_aes_128_xts 913 +#define WC_NID_aes_256_xts 914 +#define WC_NID_camellia_128_cbc 751 +#define WC_NID_camellia_256_cbc 753 +#define WC_NID_chacha20_poly1305 1018 +#define WC_NID_chacha20 1019 +#define WC_NID_sm4_ecb 1133 +#define WC_NID_sm4_cbc 1134 +#define WC_NID_sm4_ctr 1139 +#define WC_NID_sm4_gcm 1248 +#define WC_NID_sm4_ccm 1249 +#define WC_NID_md5WithRSA 104 +#define WC_NID_md2WithRSAEncryption 9 +#define WC_NID_md5WithRSAEncryption 99 +#define WC_NID_dsaWithSHA1 113 +#define WC_NID_dsaWithSHA1_2 70 +#define WC_NID_sha1WithRSA 115 +#define WC_NID_sha1WithRSAEncryption 65 +#define WC_NID_sha224WithRSAEncryption 671 +#define WC_NID_sha256WithRSAEncryption 668 +#define WC_NID_sha384WithRSAEncryption 669 +#define WC_NID_sha512WithRSAEncryption 670 +#define WC_NID_RSA_SHA3_224 1116 +#define WC_NID_RSA_SHA3_256 1117 +#define WC_NID_RSA_SHA3_384 1118 +#define WC_NID_RSA_SHA3_512 1119 +#define WC_NID_rsassaPss 912 +#define WC_NID_ecdsa_with_SHA1 416 +#define WC_NID_ecdsa_with_SHA224 793 +#define WC_NID_ecdsa_with_SHA256 794 +#define WC_NID_ecdsa_with_SHA384 795 +#define WC_NID_ecdsa_with_SHA512 796 +#define WC_NID_ecdsa_with_SHA3_224 1112 +#define WC_NID_ecdsa_with_SHA3_256 1113 +#define WC_NID_ecdsa_with_SHA3_384 1114 +#define WC_NID_ecdsa_with_SHA3_512 1115 +#define WC_NID_dsa_with_SHA224 802 +#define WC_NID_dsa_with_SHA256 803 +#define WC_NID_sha3_224 1096 +#define WC_NID_sha3_256 1097 +#define WC_NID_sha3_384 1098 +#define WC_NID_sha3_512 1099 +#define WC_NID_blake2b512 1056 +#define WC_NID_blake2s256 1057 +#define WC_NID_shake128 1100 +#define WC_NID_shake256 1101 +#define WC_NID_sha1 64 +#define WC_NID_sha224 675 +#define WC_NID_sm3 1143 +#define WC_NID_md2 77 +#define WC_NID_md4 257 +#define WC_NID_md5 40 +#define WC_NID_hmac 855 +#define WC_NID_hmacWithSHA1 163 +#define WC_NID_hmacWithSHA224 798 +#define WC_NID_hmacWithSHA256 799 +#define WC_NID_hmacWithSHA384 800 +#define WC_NID_hmacWithSHA512 801 +#define WC_NID_hkdf 1036 +#define WC_NID_cmac 894 +#define WC_NID_dhKeyAgreement 28 +#define WC_NID_ffdhe2048 1126 +#define WC_NID_ffdhe3072 1127 +#define WC_NID_ffdhe4096 1128 +#define WC_NID_rc4 5 +#define WC_NID_bf_cbc 91 +#define WC_NID_bf_ecb 92 +#define WC_NID_bf_cfb64 93 +#define WC_NID_bf_ofb64 94 +#define WC_NID_cast5_cbc 108 +#define WC_NID_cast5_ecb 109 +#define WC_NID_cast5_cfb64 110 +#define WC_NID_cast5_ofb64 111 +/* key exchange */ +#define WC_NID_kx_rsa 1037 +#define WC_NID_kx_ecdhe 1038 +#define WC_NID_kx_dhe 1039 +#define WC_NID_kx_ecdhe_psk 1040 +#define WC_NID_kx_dhe_psk 1041 +#define WC_NID_kx_rsa_psk 1042 +#define WC_NID_kx_psk 1043 +#define WC_NID_kx_srp 1044 +#define WC_NID_kx_gost 1045 +#define WC_NID_kx_any 1063 +/* server authentication */ +#define WC_NID_auth_rsa 1046 +#define WC_NID_auth_ecdsa 1047 +#define WC_NID_auth_psk 1048 +#define WC_NID_auth_dss 1049 +#define WC_NID_auth_srp 1052 +#define WC_NID_auth_null 1054 +#define WC_NID_auth_any 1055 +/* Curve */ +#define WC_NID_aria_128_gcm 1123 +#define WC_NID_aria_192_gcm 1124 +#define WC_NID_aria_256_gcm 1125 +#define WC_NID_sm2 1172 + +#define WC_NID_X9_62_id_ecPublicKey WC_EVP_PKEY_EC +#define WC_NID_rsaEncryption WC_EVP_PKEY_RSA +#define WC_NID_rsa WC_EVP_PKEY_RSA +#define WC_NID_dsa WC_EVP_PKEY_DSA + +enum { + WC_EVP_PKEY_NONE = WC_NID_undef, + WC_AES_128_CBC_TYPE = 1, + WC_AES_192_CBC_TYPE = 2, + WC_AES_256_CBC_TYPE = 3, + WC_AES_128_CTR_TYPE = 4, + WC_AES_192_CTR_TYPE = 5, + WC_AES_256_CTR_TYPE = 6, + WC_AES_128_ECB_TYPE = 7, + WC_AES_192_ECB_TYPE = 8, + WC_AES_256_ECB_TYPE = 9, + WC_DES_CBC_TYPE = 10, + WC_DES_ECB_TYPE = 11, + WC_DES_EDE3_CBC_TYPE = 12, + WC_DES_EDE3_ECB_TYPE = 13, + WC_ARC4_TYPE = 14, + WC_NULL_CIPHER_TYPE = 15, + WC_EVP_PKEY_RSA = 16, + WC_EVP_PKEY_DSA = 17, + WC_EVP_PKEY_EC = 18, + WC_AES_128_GCM_TYPE = 21, + WC_AES_192_GCM_TYPE = 22, + WC_AES_256_GCM_TYPE = 23, + WC_EVP_PKEY_DH = WC_NID_dhKeyAgreement, + WC_EVP_PKEY_HMAC = WC_NID_hmac, + WC_EVP_PKEY_CMAC = WC_NID_cmac, + WC_EVP_PKEY_HKDF = WC_NID_hkdf, + WC_EVP_PKEY_FALCON = 300, /* Randomly picked value. */ + WC_EVP_PKEY_DILITHIUM = 301, /* Randomly picked value. */ + WC_AES_128_CFB1_TYPE = 24, + WC_AES_192_CFB1_TYPE = 25, + WC_AES_256_CFB1_TYPE = 26, + WC_AES_128_CFB8_TYPE = 27, + WC_AES_192_CFB8_TYPE = 28, + WC_AES_256_CFB8_TYPE = 29, + WC_AES_128_CFB128_TYPE = 30, + WC_AES_192_CFB128_TYPE = 31, + WC_AES_256_CFB128_TYPE = 32, + WC_AES_128_OFB_TYPE = 33, + WC_AES_192_OFB_TYPE = 34, + WC_AES_256_OFB_TYPE = 35, + WC_AES_128_XTS_TYPE = 36, + WC_AES_256_XTS_TYPE = 37, + WC_CHACHA20_POLY1305_TYPE = 38, + WC_CHACHA20_TYPE = 39, + WC_AES_128_CCM_TYPE = 40, + WC_AES_192_CCM_TYPE = 41, + WC_AES_256_CCM_TYPE = 42, + WC_SM4_ECB_TYPE = 43, + WC_SM4_CBC_TYPE = 44, + WC_SM4_CTR_TYPE = 45, + WC_SM4_GCM_TYPE = 46, + WC_SM4_CCM_TYPE = 47, + WC_ARIA_128_GCM_TYPE = 48, + WC_ARIA_192_GCM_TYPE = 49, + WC_ARIA_256_GCM_TYPE = 50 +}; + +#define WOLFSSL_EVP_PKEY_PRINT_INDENT_MAX 128 + +#define WC_EVP_PKEY_OP_SIGN (1 << 3) +#define WC_EVP_PKEY_OP_VERIFY (1 << 5) +#define WC_EVP_PKEY_OP_ENCRYPT (1 << 6) +#define WC_EVP_PKEY_OP_DECRYPT (1 << 7) +#define WC_EVP_PKEY_OP_DERIVE (1 << 8) + +#ifndef OPENSSL_COEXIST + +#define EVP_PKEY_NONE WC_EVP_PKEY_NONE +#define AES_128_CBC_TYPE WC_AES_128_CBC_TYPE +#define AES_192_CBC_TYPE WC_AES_192_CBC_TYPE +#define AES_256_CBC_TYPE WC_AES_256_CBC_TYPE +#define AES_128_CTR_TYPE WC_AES_128_CTR_TYPE +#define AES_192_CTR_TYPE WC_AES_192_CTR_TYPE +#define AES_256_CTR_TYPE WC_AES_256_CTR_TYPE +#define AES_128_ECB_TYPE WC_AES_128_ECB_TYPE +#define AES_192_ECB_TYPE WC_AES_192_ECB_TYPE +#define AES_256_ECB_TYPE WC_AES_256_ECB_TYPE +#define DES_CBC_TYPE WC_DES_CBC_TYPE +#define DES_ECB_TYPE WC_DES_ECB_TYPE +#define DES_EDE3_CBC_TYPE WC_DES_EDE3_CBC_TYPE +#define DES_EDE3_ECB_TYPE WC_DES_EDE3_ECB_TYPE +#define ARC4_TYPE WC_ARC4_TYPE +#define NULL_CIPHER_TYPE WC_NULL_CIPHER_TYPE +#define EVP_PKEY_RSA WC_EVP_PKEY_RSA +#define EVP_PKEY_DSA WC_EVP_PKEY_DSA +#define EVP_PKEY_EC WC_EVP_PKEY_EC +#define AES_128_GCM_TYPE WC_AES_128_GCM_TYPE +#define AES_192_GCM_TYPE WC_AES_192_GCM_TYPE +#define AES_256_GCM_TYPE WC_AES_256_GCM_TYPE +#define EVP_PKEY_DH WC_EVP_PKEY_DH +#define EVP_PKEY_HMAC WC_EVP_PKEY_HMAC +#define EVP_PKEY_CMAC WC_EVP_PKEY_CMAC +#define EVP_PKEY_HKDF WC_EVP_PKEY_HKDF +#define EVP_PKEY_FALCON WC_EVP_PKEY_FALCON +#define EVP_PKEY_DILITHIUM WC_EVP_PKEY_DILITHIUM +#define AES_128_CFB1_TYPE WC_AES_128_CFB1_TYPE +#define AES_192_CFB1_TYPE WC_AES_192_CFB1_TYPE +#define AES_256_CFB1_TYPE WC_AES_256_CFB1_TYPE +#define AES_128_CFB8_TYPE WC_AES_128_CFB8_TYPE +#define AES_192_CFB8_TYPE WC_AES_192_CFB8_TYPE +#define AES_256_CFB8_TYPE WC_AES_256_CFB8_TYPE +#define AES_128_CFB128_TYPE WC_AES_128_CFB128_TYPE +#define AES_192_CFB128_TYPE WC_AES_192_CFB128_TYPE +#define AES_256_CFB128_TYPE WC_AES_256_CFB128_TYPE +#define AES_128_OFB_TYPE WC_AES_128_OFB_TYPE +#define AES_192_OFB_TYPE WC_AES_192_OFB_TYPE +#define AES_256_OFB_TYPE WC_AES_256_OFB_TYPE +#define AES_128_XTS_TYPE WC_AES_128_XTS_TYPE +#define AES_256_XTS_TYPE WC_AES_256_XTS_TYPE +#define CHACHA20_POLY1305_TYPE WC_CHACHA20_POLY1305_TYPE +#define CHACHA20_TYPE WC_CHACHA20_TYPE +#define AES_128_CCM_TYPE WC_AES_128_CCM_TYPE +#define AES_192_CCM_TYPE WC_AES_192_CCM_TYPE +#define AES_256_CCM_TYPE WC_AES_256_CCM_TYPE +#define SM4_ECB_TYPE WC_SM4_ECB_TYPE +#define SM4_CBC_TYPE WC_SM4_CBC_TYPE +#define SM4_CTR_TYPE WC_SM4_CTR_TYPE +#define SM4_GCM_TYPE WC_SM4_GCM_TYPE +#define SM4_CCM_TYPE WC_SM4_CCM_TYPE +#define ARIA_128_GCM_TYPE WC_ARIA_128_GCM_TYPE +#define ARIA_192_GCM_TYPE WC_ARIA_192_GCM_TYPE +#define ARIA_256_GCM_TYPE WC_ARIA_256_GCM_TYPE + +#define NID_aes_128_cbc WC_NID_aes_128_cbc +#define NID_aes_192_cbc WC_NID_aes_192_cbc +#define NID_aes_256_cbc WC_NID_aes_256_cbc +#define NID_aes_128_ccm WC_NID_aes_128_ccm +#define NID_aes_192_ccm WC_NID_aes_192_ccm +#define NID_aes_256_ccm WC_NID_aes_256_ccm +#define NID_aes_128_gcm WC_NID_aes_128_gcm +#define NID_aes_192_gcm WC_NID_aes_192_gcm +#define NID_aes_256_gcm WC_NID_aes_256_gcm +#define NID_aes_128_ctr WC_NID_aes_128_ctr +#define NID_aes_192_ctr WC_NID_aes_192_ctr +#define NID_aes_256_ctr WC_NID_aes_256_ctr +#define NID_aes_128_ecb WC_NID_aes_128_ecb +#define NID_aes_192_ecb WC_NID_aes_192_ecb +#define NID_aes_256_ecb WC_NID_aes_256_ecb +#define NID_des_cbc WC_NID_des_cbc +#define NID_des_ecb WC_NID_des_ecb +#define NID_des_ede3_cbc WC_NID_des_ede3_cbc +#define NID_des_ede3_ecb WC_NID_des_ede3_ecb +#define NID_aes_128_cfb1 WC_NID_aes_128_cfb1 +#define NID_aes_192_cfb1 WC_NID_aes_192_cfb1 +#define NID_aes_256_cfb1 WC_NID_aes_256_cfb1 +#define NID_aes_128_cfb8 WC_NID_aes_128_cfb8 +#define NID_aes_192_cfb8 WC_NID_aes_192_cfb8 +#define NID_aes_256_cfb8 WC_NID_aes_256_cfb8 +#define NID_aes_128_cfb128 WC_NID_aes_128_cfb128 +#define NID_aes_192_cfb128 WC_NID_aes_192_cfb128 +#define NID_aes_256_cfb128 WC_NID_aes_256_cfb128 +#define NID_aes_128_ofb WC_NID_aes_128_ofb +#define NID_aes_192_ofb WC_NID_aes_192_ofb +#define NID_aes_256_ofb WC_NID_aes_256_ofb +#define NID_aes_128_xts WC_NID_aes_128_xts +#define NID_aes_256_xts WC_NID_aes_256_xts +#define NID_camellia_128_cbc WC_NID_camellia_128_cbc +#define NID_camellia_256_cbc WC_NID_camellia_256_cbc +#define NID_chacha20_poly1305 WC_NID_chacha20_poly1305 +#define NID_chacha20 WC_NID_chacha20 +#define NID_sm4_ecb WC_NID_sm4_ecb +#define NID_sm4_cbc WC_NID_sm4_cbc +#define NID_sm4_ctr WC_NID_sm4_ctr +#define NID_sm4_gcm WC_NID_sm4_gcm +#define NID_sm4_ccm WC_NID_sm4_ccm +#define NID_md5WithRSA WC_NID_md5WithRSA +#define NID_md2WithRSAEncryption WC_NID_md2WithRSAEncryption +#define NID_md5WithRSAEncryption WC_NID_md5WithRSAEncryption +#define NID_dsaWithSHA1 WC_NID_dsaWithSHA1 +#define NID_dsaWithSHA1_2 WC_NID_dsaWithSHA1_2 +#define NID_sha1WithRSA WC_NID_sha1WithRSA +#define NID_sha1WithRSAEncryption WC_NID_sha1WithRSAEncryption +#define NID_sha224WithRSAEncryption WC_NID_sha224WithRSAEncryption +#define NID_sha256WithRSAEncryption WC_NID_sha256WithRSAEncryption +#define NID_sha384WithRSAEncryption WC_NID_sha384WithRSAEncryption +#define NID_sha512WithRSAEncryption WC_NID_sha512WithRSAEncryption +#define NID_RSA_SHA3_224 WC_NID_RSA_SHA3_224 +#define NID_RSA_SHA3_256 WC_NID_RSA_SHA3_256 +#define NID_RSA_SHA3_384 WC_NID_RSA_SHA3_384 +#define NID_RSA_SHA3_512 WC_NID_RSA_SHA3_512 +#define NID_rsassaPss WC_NID_rsassaPss +#define NID_ecdsa_with_SHA1 WC_NID_ecdsa_with_SHA1 +#define NID_ecdsa_with_SHA224 WC_NID_ecdsa_with_SHA224 +#define NID_ecdsa_with_SHA256 WC_NID_ecdsa_with_SHA256 +#define NID_ecdsa_with_SHA384 WC_NID_ecdsa_with_SHA384 +#define NID_ecdsa_with_SHA512 WC_NID_ecdsa_with_SHA512 +#define NID_ecdsa_with_SHA3_224 WC_NID_ecdsa_with_SHA3_224 +#define NID_ecdsa_with_SHA3_256 WC_NID_ecdsa_with_SHA3_256 +#define NID_ecdsa_with_SHA3_384 WC_NID_ecdsa_with_SHA3_384 +#define NID_ecdsa_with_SHA3_512 WC_NID_ecdsa_with_SHA3_512 +#define NID_dsa_with_SHA224 WC_NID_dsa_with_SHA224 +#define NID_dsa_with_SHA256 WC_NID_dsa_with_SHA256 +#define NID_sha3_224 WC_NID_sha3_224 +#define NID_sha3_256 WC_NID_sha3_256 +#define NID_sha3_384 WC_NID_sha3_384 +#define NID_sha3_512 WC_NID_sha3_512 +#define NID_blake2b512 WC_NID_blake2b512 +#define NID_blake2s256 WC_NID_blake2s256 +#define NID_shake128 WC_NID_shake128 +#define NID_shake256 WC_NID_shake256 +#define NID_sha1 WC_NID_sha1 +#define NID_sha224 WC_NID_sha224 +#define NID_sm3 WC_NID_sm3 +#define NID_md2 WC_NID_md2 +#define NID_md4 WC_NID_md4 +#define NID_md5 WC_NID_md5 +#define NID_hmac WC_NID_hmac +#define NID_hmacWithSHA1 WC_NID_hmacWithSHA1 +#define NID_hmacWithSHA224 WC_NID_hmacWithSHA224 +#define NID_hmacWithSHA256 WC_NID_hmacWithSHA256 +#define NID_hmacWithSHA384 WC_NID_hmacWithSHA384 +#define NID_hmacWithSHA512 WC_NID_hmacWithSHA512 +#define NID_hkdf WC_NID_hkdf +#define NID_cmac WC_NID_cmac +#define NID_dhKeyAgreement WC_NID_dhKeyAgreement +#define NID_ffdhe2048 WC_NID_ffdhe2048 +#define NID_ffdhe3072 WC_NID_ffdhe3072 +#define NID_ffdhe4096 WC_NID_ffdhe4096 +#define NID_rc4 WC_NID_rc4 +#define NID_bf_cbc WC_NID_bf_cbc +#define NID_bf_ecb WC_NID_bf_ecb +#define NID_bf_cfb64 WC_NID_bf_cfb64 +#define NID_bf_ofb64 WC_NID_bf_ofb64 +#define NID_cast5_cbc WC_NID_cast5_cbc +#define NID_cast5_ecb WC_NID_cast5_ecb +#define NID_cast5_cfb64 WC_NID_cast5_cfb64 +#define NID_cast5_ofb64 WC_NID_cast5_ofb64 +/* key exchange */ +#define NID_kx_rsa WC_NID_kx_rsa +#define NID_kx_ecdhe WC_NID_kx_ecdhe +#define NID_kx_dhe WC_NID_kx_dhe +#define NID_kx_ecdhe_psk WC_NID_kx_ecdhe_psk +#define NID_kx_dhe_psk WC_NID_kx_dhe_psk +#define NID_kx_rsa_psk WC_NID_kx_rsa_psk +#define NID_kx_psk WC_NID_kx_psk +#define NID_kx_srp WC_NID_kx_srp +#define NID_kx_gost WC_NID_kx_gost +#define NID_kx_any WC_NID_kx_any +/* server authentication */ +#define NID_auth_rsa WC_NID_auth_rsa +#define NID_auth_ecdsa WC_NID_auth_ecdsa +#define NID_auth_psk WC_NID_auth_psk +#define NID_auth_dss WC_NID_auth_dss +#define NID_auth_srp WC_NID_auth_srp +#define NID_auth_null WC_NID_auth_null +#define NID_auth_any WC_NID_auth_any +/* Curve */ +#define NID_aria_128_gcm WC_NID_aria_128_gcm +#define NID_aria_192_gcm WC_NID_aria_192_gcm +#define NID_aria_256_gcm WC_NID_aria_256_gcm +#define NID_sm2 WC_NID_sm2 + +#define NID_X9_62_id_ecPublicKey WC_NID_X9_62_id_ecPublicKey +#define NID_rsaEncryption WC_NID_rsaEncryption +#define NID_rsa WC_NID_rsa +#define NID_dsa WC_NID_dsa + +#define EVP_PKEY_OP_SIGN WC_EVP_PKEY_OP_SIGN +#define EVP_PKEY_OP_VERIFY WC_EVP_PKEY_OP_VERIFY +#define EVP_PKEY_OP_ENCRYPT WC_EVP_PKEY_OP_ENCRYPT +#define EVP_PKEY_OP_DECRYPT WC_EVP_PKEY_OP_DECRYPT +#define EVP_PKEY_OP_DERIVE WC_EVP_PKEY_OP_DERIVE + +#define EVP_PKEY_PRINT_INDENT_MAX WOLFSSL_EVP_PKEY_PRINT_INDENT_MAX + +#endif /* !OPENSSL_COEXIST */ + +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + + +#define WOLFSSL_EVP_BUF_SIZE 16 +struct WOLFSSL_EVP_CIPHER_CTX { + int keyLen; /* user may set for variable */ + int block_size; + unsigned long flags; + unsigned char enc; /* if encrypt side, then true */ + unsigned char cipherType; +#if !defined(NO_AES) + /* working iv pointer into cipher */ + ALIGN16 unsigned char iv[WC_AES_BLOCK_SIZE]; +#elif defined(WOLFSSL_SM4) + ALIGN16 unsigned char iv[SM4_BLOCK_SIZE]; +#elif defined(HAVE_CHACHA) && defined(HAVE_POLY1305) + ALIGN16 unsigned char iv[CHACHA20_POLY1305_AEAD_IV_SIZE]; +#elif !defined(NO_DES3) + ALIGN16 unsigned char iv[DES_BLOCK_SIZE]; +#endif + WOLFSSL_Cipher cipher; + ALIGN16 byte buf[WOLFSSL_EVP_BUF_SIZE]; + int bufUsed; + ALIGN16 byte lastBlock[WOLFSSL_EVP_BUF_SIZE]; + int lastUsed; +#if !defined(NO_AES) || !defined(NO_DES3) || defined(HAVE_AESGCM) || \ + defined (WOLFSSL_AES_XTS) || (defined(HAVE_CHACHA) || \ + defined(HAVE_POLY1305) || defined(HAVE_AESCCM)) || \ + defined(WOLFSSL_SM4_GCM) || defined(WOLFSSL_SM4_CCM) +#define HAVE_WOLFSSL_EVP_CIPHER_CTX_IV + int ivSz; +#if defined(HAVE_AESGCM) || defined(HAVE_AESCCM) || \ + defined(WOLFSSL_SM4_GCM) || defined(WOLFSSL_SM4_CCM) + byte* authBuffer; + int authBufferLen; + byte* authIn; + int authInSz; +#endif +#if defined(HAVE_CHACHA) && defined(HAVE_POLY1305) + byte* key; /* used in partial Init()s */ +#endif +#if defined(HAVE_AESGCM) || defined(HAVE_AESCCM) || defined(HAVE_ARIA) || \ + defined(WOLFSSL_SM4_GCM) || defined(WOLFSSL_SM4_CCM) || \ + (defined(HAVE_CHACHA) && defined(HAVE_POLY1305)) +#if defined(HAVE_AESGCM) || defined(HAVE_AESCCM) || defined(HAVE_ARIA) + ALIGN16 unsigned char authTag[WC_AES_BLOCK_SIZE]; +#elif defined(WOLFSSL_SM4_GCM) || defined(WOLFSSL_SM4_CCM) + ALIGN16 unsigned char authTag[SM4_BLOCK_SIZE]; +#else + ALIGN16 unsigned char authTag[CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE]; +#endif + int authTagSz; +#endif +#if defined(HAVE_AESGCM) || defined(HAVE_AESCCM) || \ + defined(WOLFSSL_SM4_GCM) || defined(WOLFSSL_SM4_CCM) + WC_BITFIELD authIvGenEnable:1; + WC_BITFIELD authIncIv:1; +#endif +#endif +}; + +struct WOLFSSL_EVP_PKEY_CTX { + WOLFSSL_EVP_PKEY *pkey; + WOLFSSL_EVP_PKEY *peerKey; + int op; /* operation */ + int padding; + int nbits; +#ifdef HAVE_ECC + int curveNID; +#endif +#ifndef NO_RSA + const WOLFSSL_EVP_MD* md; + const WOLFSSL_EVP_MD* mgf1_md; + int saltlen; +#endif /* !NO_RSA */ +}; + +struct WOLFSSL_ASN1_PCTX { + int dummy; +}; +#if defined(WOLFSSL_BASE64_ENCODE) || defined(WOLFSSL_BASE64_DECODE) + +#define BASE64_ENCODE_BLOCK_SIZE 48 +#define BASE64_ENCODE_RESULT_BLOCK_SIZE 64 +#define BASE64_DECODE_BLOCK_SIZE 4 + +struct WOLFSSL_EVP_ENCODE_CTX { + void* heap; + int remaining; /* num of bytes in data[] */ + byte data[BASE64_ENCODE_BLOCK_SIZE];/* storage for unprocessed raw data */ +}; +typedef struct WOLFSSL_EVP_ENCODE_CTX WOLFSSL_EVP_ENCODE_CTX; + +WOLFSSL_API struct WOLFSSL_EVP_ENCODE_CTX* wolfSSL_EVP_ENCODE_CTX_new(void); +WOLFSSL_API void wolfSSL_EVP_ENCODE_CTX_free(WOLFSSL_EVP_ENCODE_CTX* ctx); +#endif /* WOLFSSL_BASE64_ENCODE || WOLFSSL_BASE64_DECODE */ + +#if defined(WOLFSSL_BASE64_ENCODE) +WOLFSSL_API void wolfSSL_EVP_EncodeInit(WOLFSSL_EVP_ENCODE_CTX* ctx); +WOLFSSL_API int wolfSSL_EVP_EncodeUpdate(WOLFSSL_EVP_ENCODE_CTX* ctx, + unsigned char*out, int *outl, const unsigned char*in, int inl); +WOLFSSL_API void wolfSSL_EVP_EncodeFinal(WOLFSSL_EVP_ENCODE_CTX* ctx, + unsigned char*out, int *outl); +WOLFSSL_API int wolfSSL_EVP_EncodeBlock(unsigned char *out, + const unsigned char *in, int inLen); +WOLFSSL_API int wolfSSL_EVP_DecodeBlock(unsigned char *out, + const unsigned char *in, int inLen); +#endif /* WOLFSSL_BASE64_ENCODE */ + +#if defined(WOLFSSL_BASE64_DECODE) +WOLFSSL_API void wolfSSL_EVP_DecodeInit(WOLFSSL_EVP_ENCODE_CTX* ctx); +WOLFSSL_API int wolfSSL_EVP_DecodeUpdate(WOLFSSL_EVP_ENCODE_CTX* ctx, + unsigned char*out, int *outl, const unsigned char*in, int inl); +WOLFSSL_API int wolfSSL_EVP_DecodeFinal(WOLFSSL_EVP_ENCODE_CTX* ctx, + unsigned char*out, int *outl); +#endif /* WOLFSSL_BASE64_DECODE */ + +WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_blake2b512(void); +WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_blake2s256(void); + +WOLFSSL_API void wolfSSL_EVP_init(void); +WOLFSSL_API int wolfSSL_EVP_MD_size(const WOLFSSL_EVP_MD* type); +WOLFSSL_API int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD* type); +WOLFSSL_API unsigned long wolfSSL_EVP_MD_flags(const WOLFSSL_EVP_MD *md); +WOLFSSL_API int wolfSSL_EVP_MD_block_size(const WOLFSSL_EVP_MD* type); +WOLFSSL_API int wolfSSL_EVP_MD_pkey_type(const WOLFSSL_EVP_MD* type); + +WOLFSSL_API WOLFSSL_EVP_MD_CTX *wolfSSL_EVP_MD_CTX_new (void); +WOLFSSL_API void wolfSSL_EVP_MD_CTX_free(WOLFSSL_EVP_MD_CTX* ctx); +WOLFSSL_API void wolfSSL_EVP_MD_CTX_init(WOLFSSL_EVP_MD_CTX* ctx); +WOLFSSL_API int wolfSSL_EVP_MD_CTX_cleanup(WOLFSSL_EVP_MD_CTX* ctx); +WOLFSSL_API int wolfSSL_EVP_MD_CTX_copy(WOLFSSL_EVP_MD_CTX *out, const WOLFSSL_EVP_MD_CTX *in); +WOLFSSL_API int wolfSSL_EVP_MD_CTX_copy_ex(WOLFSSL_EVP_MD_CTX *out, const WOLFSSL_EVP_MD_CTX *in); +WOLFSSL_API int wolfSSL_EVP_MD_CTX_type(const WOLFSSL_EVP_MD_CTX *ctx); +WOLFSSL_API int wolfSSL_EVP_MD_CTX_size(const WOLFSSL_EVP_MD_CTX *ctx); +WOLFSSL_API int wolfSSL_EVP_MD_CTX_block_size(const WOLFSSL_EVP_MD_CTX *ctx); +WOLFSSL_API const WOLFSSL_EVP_MD *wolfSSL_EVP_MD_CTX_md(const WOLFSSL_EVP_MD_CTX *ctx); +WOLFSSL_API const WOLFSSL_EVP_CIPHER *wolfSSL_EVP_get_cipherbyname(const char *name); +WOLFSSL_API const WOLFSSL_EVP_MD *wolfSSL_EVP_get_digestbyname(const char *name); +WOLFSSL_API int wolfSSL_EVP_CIPHER_nid(const WOLFSSL_EVP_CIPHER *cipher); + +WOLFSSL_API int wolfSSL_EVP_DigestInit(WOLFSSL_EVP_MD_CTX* ctx, + const WOLFSSL_EVP_MD* type); +WOLFSSL_API int wolfSSL_EVP_DigestUpdate(WOLFSSL_EVP_MD_CTX* ctx, const void* data, + size_t sz); +WOLFSSL_API int wolfSSL_EVP_DigestFinal(WOLFSSL_EVP_MD_CTX* ctx, unsigned char* md, + unsigned int* s); +WOLFSSL_API int wolfSSL_EVP_DigestFinal_ex(WOLFSSL_EVP_MD_CTX* ctx, + unsigned char* md, unsigned int* s); +WOLFSSL_API int wolfSSL_EVP_DigestFinalXOF(WOLFSSL_EVP_MD_CTX* ctx, + unsigned char* md, size_t sz); +WOLFSSL_API int wolfSSL_EVP_DigestSignUpdate(WOLFSSL_EVP_MD_CTX *ctx, + const void *d, unsigned int cnt); +WOLFSSL_API int wolfSSL_EVP_DigestSignFinal(WOLFSSL_EVP_MD_CTX *ctx, + unsigned char *sig, size_t *siglen); +WOLFSSL_API int wolfSSL_EVP_DigestVerifyUpdate(WOLFSSL_EVP_MD_CTX *ctx, + const void *d, size_t cnt); +WOLFSSL_API int wolfSSL_EVP_DigestVerifyFinal(WOLFSSL_EVP_MD_CTX *ctx, + const unsigned char *sig, + size_t siglen); + +WOLFSSL_API int wolfSSL_EVP_BytesToKey(const WOLFSSL_EVP_CIPHER* type, + const WOLFSSL_EVP_MD* md, const byte* salt, + const byte* data, int sz, int count, byte* key, byte* iv); + +WOLFSSL_API void wolfSSL_EVP_CIPHER_CTX_init(WOLFSSL_EVP_CIPHER_CTX* ctx); +WOLFSSL_API int wolfSSL_EVP_CIPHER_CTX_cleanup(WOLFSSL_EVP_CIPHER_CTX* ctx); +WOLFSSL_API int wolfSSL_EVP_CIPHER_CTX_ctrl(WOLFSSL_EVP_CIPHER_CTX *ctx, \ + int type, int arg, void *ptr); +WOLFSSL_API int wolfSSL_EVP_CIPHER_CTX_iv_length( + const WOLFSSL_EVP_CIPHER_CTX* ctx); +WOLFSSL_API int wolfSSL_EVP_CIPHER_iv_length(const WOLFSSL_EVP_CIPHER* cipher); +WOLFSSL_API int wolfSSL_EVP_Cipher_key_length(const WOLFSSL_EVP_CIPHER* c); + + +WOLFSSL_API int wolfSSL_EVP_CipherInit(WOLFSSL_EVP_CIPHER_CTX* ctx, + const WOLFSSL_EVP_CIPHER* type, + const unsigned char* key, + const unsigned char* iv, + int enc); +WOLFSSL_API int wolfSSL_EVP_CipherUpdate(WOLFSSL_EVP_CIPHER_CTX *ctx, + unsigned char *out, int *outl, + const unsigned char *in, int inl); +WOLFSSL_API int wolfSSL_EVP_CipherFinal(WOLFSSL_EVP_CIPHER_CTX *ctx, + unsigned char *out, int *outl); +WOLFSSL_API int wolfSSL_EVP_CipherFinal_ex(WOLFSSL_EVP_CIPHER_CTX *ctx, + unsigned char *out, int *outl, int enc); +WOLFSSL_API int wolfSSL_EVP_EncryptFinal(WOLFSSL_EVP_CIPHER_CTX *ctx, + unsigned char *out, int *outl); +WOLFSSL_API int wolfSSL_EVP_EncryptFinal_ex(WOLFSSL_EVP_CIPHER_CTX *ctx, + unsigned char *out, int *outl); +WOLFSSL_API int wolfSSL_EVP_DecryptFinal(WOLFSSL_EVP_CIPHER_CTX *ctx, + unsigned char *out, int *outl); +WOLFSSL_API int wolfSSL_EVP_DecryptFinal_ex(WOLFSSL_EVP_CIPHER_CTX *ctx, + unsigned char *out, int *outl); +WOLFSSL_API int wolfSSL_EVP_DecryptFinal_legacy(WOLFSSL_EVP_CIPHER_CTX *ctx, + unsigned char *out, int *outl); + +WOLFSSL_API WOLFSSL_EVP_CIPHER_CTX *wolfSSL_EVP_CIPHER_CTX_new(void); +WOLFSSL_API void wolfSSL_EVP_CIPHER_CTX_free(WOLFSSL_EVP_CIPHER_CTX *ctx); +WOLFSSL_API int wolfSSL_EVP_CIPHER_CTX_reset(WOLFSSL_EVP_CIPHER_CTX *ctx); +WOLFSSL_API int wolfSSL_EVP_CIPHER_CTX_nid(const WOLFSSL_EVP_CIPHER_CTX *ctx); +WOLFSSL_API int wolfSSL_EVP_CIPHER_CTX_key_length(WOLFSSL_EVP_CIPHER_CTX* ctx); +WOLFSSL_API int wolfSSL_EVP_CIPHER_CTX_set_key_length(WOLFSSL_EVP_CIPHER_CTX* ctx, + int keylen); +WOLFSSL_API int wolfSSL_EVP_CIPHER_CTX_set_iv_length(WOLFSSL_EVP_CIPHER_CTX* ctx, + int ivLen); +WOLFSSL_API int wolfSSL_EVP_CIPHER_CTX_set_iv(WOLFSSL_EVP_CIPHER_CTX* ctx, byte* iv, + int ivLen); +WOLFSSL_API int wolfSSL_EVP_CIPHER_CTX_get_iv(WOLFSSL_EVP_CIPHER_CTX* ctx, byte* iv, + int ivLen); +WOLFSSL_API int wolfSSL_EVP_Cipher(WOLFSSL_EVP_CIPHER_CTX* ctx, + unsigned char* dst, unsigned char* src, + unsigned int len); + +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_get_cipherbynid(int id); +WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_get_digestbynid(int id); +WOLFSSL_API const WOLFSSL_EVP_CIPHER *wolfSSL_EVP_CIPHER_CTX_cipher(const WOLFSSL_EVP_CIPHER_CTX *ctx); + +WOLFSSL_API int wolfSSL_EVP_PKEY_assign_RSA(WOLFSSL_EVP_PKEY* pkey, + WOLFSSL_RSA* key); +WOLFSSL_API int wolfSSL_EVP_PKEY_assign_EC_KEY(WOLFSSL_EVP_PKEY* pkey, + WOLFSSL_EC_KEY* key); +WOLFSSL_API int wolfSSL_EVP_PKEY_assign_DSA(WOLFSSL_EVP_PKEY* pkey, WOLFSSL_DSA* key); +WOLFSSL_API int wolfSSL_EVP_PKEY_assign_DH(WOLFSSL_EVP_PKEY* pkey, WOLFSSL_DH* key); +WOLFSSL_API WOLFSSL_RSA* wolfSSL_EVP_PKEY_get0_RSA(WOLFSSL_EVP_PKEY *pkey); +WOLFSSL_API WOLFSSL_DSA* wolfSSL_EVP_PKEY_get0_DSA(WOLFSSL_EVP_PKEY *pkey); +WOLFSSL_API WOLFSSL_RSA* wolfSSL_EVP_PKEY_get1_RSA(WOLFSSL_EVP_PKEY* key); +WOLFSSL_API WOLFSSL_DSA* wolfSSL_EVP_PKEY_get1_DSA(WOLFSSL_EVP_PKEY* key); +WOLFSSL_API WOLFSSL_EC_KEY *wolfSSL_EVP_PKEY_get0_EC_KEY(WOLFSSL_EVP_PKEY *pkey); +WOLFSSL_API WOLFSSL_EC_KEY *wolfSSL_EVP_PKEY_get1_EC_KEY(WOLFSSL_EVP_PKEY *key); +WOLFSSL_API WOLFSSL_DH* wolfSSL_EVP_PKEY_get0_DH(WOLFSSL_EVP_PKEY* key); +WOLFSSL_API WOLFSSL_DH* wolfSSL_EVP_PKEY_get1_DH(WOLFSSL_EVP_PKEY* key); +WOLFSSL_API int wolfSSL_EVP_PKEY_set1_RSA(WOLFSSL_EVP_PKEY *pkey, WOLFSSL_RSA *key); +WOLFSSL_API int wolfSSL_EVP_PKEY_set1_DSA(WOLFSSL_EVP_PKEY *pkey, WOLFSSL_DSA *key); +WOLFSSL_API int wolfSSL_EVP_PKEY_set1_DH(WOLFSSL_EVP_PKEY *pkey, WOLFSSL_DH *key); +WOLFSSL_API int wolfSSL_EVP_PKEY_set1_EC_KEY(WOLFSSL_EVP_PKEY *pkey, WOLFSSL_EC_KEY *key); +WOLFSSL_API int wolfSSL_EVP_PKEY_assign(WOLFSSL_EVP_PKEY *pkey, int type, void *key); + +WOLFSSL_API const unsigned char* wolfSSL_EVP_PKEY_get0_hmac(const WOLFSSL_EVP_PKEY* pkey, + size_t* len); +WOLFSSL_API int wolfSSL_EVP_PKEY_sign_init(WOLFSSL_EVP_PKEY_CTX *ctx); +WOLFSSL_API int wolfSSL_EVP_PKEY_sign(WOLFSSL_EVP_PKEY_CTX *ctx, + unsigned char *sig, size_t *siglen, const unsigned char *tbs, size_t tbslen); +WOLFSSL_API int wolfSSL_EVP_PKEY_verify_init(WOLFSSL_EVP_PKEY_CTX *ctx); +WOLFSSL_API int wolfSSL_EVP_PKEY_verify(WOLFSSL_EVP_PKEY_CTX *ctx, const unsigned char *sig, + size_t siglen, const unsigned char *tbs, size_t tbslen); +WOLFSSL_API int wolfSSL_EVP_PKEY_paramgen_init(WOLFSSL_EVP_PKEY_CTX *ctx); +WOLFSSL_API int wolfSSL_EVP_PKEY_CTX_set_ec_paramgen_curve_nid(WOLFSSL_EVP_PKEY_CTX *ctx, + int nid); +WOLFSSL_API int wolfSSL_EVP_PKEY_paramgen(WOLFSSL_EVP_PKEY_CTX* ctx, + WOLFSSL_EVP_PKEY** pkey); +WOLFSSL_API int wolfSSL_EVP_PKEY_CTX_set_ec_param_enc(WOLFSSL_EVP_PKEY_CTX *ctx, + int flag); +WOLFSSL_API int wolfSSL_EVP_PKEY_keygen_init(WOLFSSL_EVP_PKEY_CTX *ctx); +WOLFSSL_API int wolfSSL_EVP_PKEY_keygen(WOLFSSL_EVP_PKEY_CTX *ctx, + WOLFSSL_EVP_PKEY **ppkey); +WOLFSSL_API int wolfSSL_EVP_PKEY_bits(const WOLFSSL_EVP_PKEY *pkey); +WOLFSSL_API int wolfSSL_EVP_PKEY_is_a(const WOLFSSL_EVP_PKEY *pkey, + const char *name); +#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L +WOLFSSL_API void wolfSSL_EVP_PKEY_CTX_free(WOLFSSL_EVP_PKEY_CTX *ctx); +#else +WOLFSSL_API int wolfSSL_EVP_PKEY_CTX_free(WOLFSSL_EVP_PKEY_CTX *ctx); +#endif +WOLFSSL_API int wolfSSL_EVP_PKEY_CTX_set_rsa_padding(WOLFSSL_EVP_PKEY_CTX *ctx, int padding); +WOLFSSL_API int wolfSSL_EVP_PKEY_CTX_set_signature_md(WOLFSSL_EVP_PKEY_CTX *ctx, + const WOLFSSL_EVP_MD* md); +WOLFSSL_API int wolfSSL_EVP_PKEY_CTX_set_rsa_keygen_bits(WOLFSSL_EVP_PKEY_CTX *ctx, int bits); +WOLFSSL_API int wolfSSL_EVP_PKEY_CTX_set_rsa_pss_saltlen(WOLFSSL_EVP_PKEY_CTX *ctx, int saltlen); +WOLFSSL_API int wolfSSL_EVP_PKEY_CTX_set_rsa_mgf1_md(WOLFSSL_EVP_PKEY_CTX *ctx, const WOLFSSL_EVP_MD *md); +WOLFSSL_API int wolfSSL_EVP_PKEY_CTX_set_rsa_oaep_md(WOLFSSL_EVP_PKEY_CTX *ctx, const WOLFSSL_EVP_MD *md); + +WOLFSSL_API int wolfSSL_EVP_PKEY_derive_init(WOLFSSL_EVP_PKEY_CTX *ctx); +WOLFSSL_API int wolfSSL_EVP_PKEY_derive_set_peer(WOLFSSL_EVP_PKEY_CTX *ctx, WOLFSSL_EVP_PKEY *peer); +WOLFSSL_API int wolfSSL_EVP_PKEY_derive(WOLFSSL_EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); + +WOLFSSL_API int wolfSSL_EVP_PKEY_CTX_ctrl_str(WOLFSSL_EVP_PKEY_CTX *ctx, + const char *name, const char *value); + +WOLFSSL_API int wolfSSL_EVP_PKEY_decrypt(WOLFSSL_EVP_PKEY_CTX *ctx, + unsigned char *out, size_t *outlen, + const unsigned char *in, size_t inlen); +WOLFSSL_API int wolfSSL_EVP_PKEY_decrypt_init(WOLFSSL_EVP_PKEY_CTX *ctx); +WOLFSSL_API int wolfSSL_EVP_PKEY_encrypt(WOLFSSL_EVP_PKEY_CTX *ctx, + unsigned char *out, size_t *outlen, + const unsigned char *in, size_t inlen); +WOLFSSL_API int wolfSSL_EVP_PKEY_encrypt_init(WOLFSSL_EVP_PKEY_CTX *ctx); +WOLFSSL_API WOLFSSL_EVP_PKEY *wolfSSL_EVP_PKEY_new(void); +WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_EVP_PKEY_new_ex(void* heap); +WOLFSSL_API void wolfSSL_EVP_PKEY_free(WOLFSSL_EVP_PKEY* key); +WOLFSSL_API int wolfSSL_EVP_PKEY_size(WOLFSSL_EVP_PKEY *pkey); +WOLFSSL_API int wolfSSL_EVP_PKEY_copy_parameters(WOLFSSL_EVP_PKEY *to, const WOLFSSL_EVP_PKEY *from); +WOLFSSL_API int wolfSSL_EVP_PKEY_missing_parameters(WOLFSSL_EVP_PKEY *pkey); +WOLFSSL_API int wolfSSL_EVP_PKEY_cmp(const WOLFSSL_EVP_PKEY *a, const WOLFSSL_EVP_PKEY *b); +WOLFSSL_API int wolfSSL_EVP_PKEY_type(int type); +WOLFSSL_API int wolfSSL_EVP_PKEY_id(const WOLFSSL_EVP_PKEY *pkey); +WOLFSSL_API int wolfSSL_EVP_PKEY_base_id(const WOLFSSL_EVP_PKEY *pkey); +WOLFSSL_API int wolfSSL_EVP_PKEY_get_default_digest_nid(WOLFSSL_EVP_PKEY *pkey, int *pnid); +WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_EVP_PKCS82PKEY(const WOLFSSL_PKCS8_PRIV_KEY_INFO* p8); +WOLFSSL_API WOLFSSL_PKCS8_PRIV_KEY_INFO* wolfSSL_EVP_PKEY2PKCS8(const WOLFSSL_EVP_PKEY* pkey); + +WOLFSSL_API int wolfSSL_EVP_SignFinal(WOLFSSL_EVP_MD_CTX *ctx, unsigned char *sigret, + unsigned int *siglen, WOLFSSL_EVP_PKEY *pkey); +WOLFSSL_API int wolfSSL_EVP_SignInit(WOLFSSL_EVP_MD_CTX *ctx, const WOLFSSL_EVP_MD *type); +WOLFSSL_API int wolfSSL_EVP_SignUpdate(WOLFSSL_EVP_MD_CTX *ctx, const void *data, size_t len); +WOLFSSL_API int wolfSSL_EVP_VerifyFinal(WOLFSSL_EVP_MD_CTX *ctx, + const unsigned char* sig, unsigned int sig_len, WOLFSSL_EVP_PKEY *pkey); +WOLFSSL_API int wolfSSL_EVP_VerifyInit(WOLFSSL_EVP_MD_CTX *ctx, const WOLFSSL_EVP_MD *type); +WOLFSSL_API int wolfSSL_EVP_VerifyUpdate(WOLFSSL_EVP_MD_CTX *ctx, const void *data, size_t len); + + +/* these next ones don't need real OpenSSL type, for OpenSSH compat only */ +WOLFSSL_API void* wolfSSL_EVP_X_STATE(const WOLFSSL_EVP_CIPHER_CTX* ctx); +WOLFSSL_API int wolfSSL_EVP_X_STATE_LEN(const WOLFSSL_EVP_CIPHER_CTX* ctx); + +WOLFSSL_API void wolfSSL_3des_iv(WOLFSSL_EVP_CIPHER_CTX* ctx, int doset, + unsigned char* iv, int len); +WOLFSSL_API void wolfSSL_aes_ctr_iv(WOLFSSL_EVP_CIPHER_CTX* ctx, int doset, + unsigned char* iv, int len); + +WOLFSSL_API int wolfSSL_StoreExternalIV(WOLFSSL_EVP_CIPHER_CTX* ctx); +WOLFSSL_API int wolfSSL_SetInternalIV(WOLFSSL_EVP_CIPHER_CTX* ctx); + +WOLFSSL_API int wolfSSL_EVP_CIPHER_CTX_block_size(const WOLFSSL_EVP_CIPHER_CTX *ctx); +WOLFSSL_API int wolfSSL_EVP_CIPHER_block_size(const WOLFSSL_EVP_CIPHER *cipher); +WOLFSSL_API unsigned long WOLFSSL_EVP_CIPHER_mode(const WOLFSSL_EVP_CIPHER *cipher); +WOLFSSL_API unsigned long WOLFSSL_CIPHER_mode(const WOLFSSL_EVP_CIPHER *cipher); +WOLFSSL_API unsigned long wolfSSL_EVP_CIPHER_flags(const WOLFSSL_EVP_CIPHER *cipher); +WOLFSSL_API void wolfSSL_EVP_CIPHER_CTX_set_flags(WOLFSSL_EVP_CIPHER_CTX *ctx, int flags); +WOLFSSL_API void wolfSSL_EVP_CIPHER_CTX_clear_flags(WOLFSSL_EVP_CIPHER_CTX *ctx, int flags); +WOLFSSL_API unsigned long wolfSSL_EVP_CIPHER_CTX_flags(const WOLFSSL_EVP_CIPHER_CTX *ctx); +WOLFSSL_API unsigned long wolfSSL_EVP_CIPHER_CTX_mode(const WOLFSSL_EVP_CIPHER_CTX *ctx); +WOLFSSL_API int wolfSSL_EVP_CIPHER_CTX_set_padding(WOLFSSL_EVP_CIPHER_CTX *c, int pad); +WOLFSSL_API int wolfSSL_EVP_add_digest(const WOLFSSL_EVP_MD *digest); +WOLFSSL_API int wolfSSL_EVP_add_cipher(const WOLFSSL_EVP_CIPHER *cipher); +WOLFSSL_API void wolfSSL_EVP_cleanup(void); +WOLFSSL_API int wolfSSL_add_all_algorithms(void); +WOLFSSL_API int wolfSSL_OpenSSL_add_all_algorithms_conf(void); +WOLFSSL_API int wolfSSL_OpenSSL_add_all_algorithms_noconf(void); +WOLFSSL_API int wolfSSL_EVP_read_pw_string(char*, int, const char*, int); + +WOLFSSL_API int wolfSSL_PKCS5_PBKDF2_HMAC_SHA1(const char * pass, int passlen, + const unsigned char * salt, + int saltlen, int iter, + int keylen, unsigned char *out); + +WOLFSSL_API int wolfSSL_PKCS5_PBKDF2_HMAC(const char *pass, int passlen, + const unsigned char *salt, + int saltlen, int iter, + const WOLFSSL_EVP_MD *digest, + int keylen, unsigned char *out); + +#if defined(HAVE_SCRYPT) && defined(HAVE_PBKDF2) && !defined(NO_PWDBASED) && \ + !defined(NO_SHA256) +WOLFSSL_API int wolfSSL_EVP_PBE_scrypt(const char *pass, size_t passlen, + const unsigned char *salt, size_t saltlen, + word64 N, word64 r, word64 p, + word64 maxmem, unsigned char *key, size_t keylen); +#endif /* HAVE_SCRYPT && HAVE_PBKDF2 && !NO_PWDBASED && !NO_SHA256 */ + +WOLFSSL_LOCAL int wolfSSL_EVP_get_hashinfo(const WOLFSSL_EVP_MD* evp, + int* pHash, int* pHashSz); + +WOLFSSL_API void wolfSSL_EVP_MD_do_all(void (*fn) (const WOLFSSL_EVP_MD *md, + const char* from, const char* to, + void* xx), void* args); + +#ifdef HAVE_HKDF +WOLFSSL_API int wolfSSL_EVP_PKEY_CTX_set_hkdf_md(WOLFSSL_EVP_PKEY_CTX* ctx, + const WOLFSSL_EVP_MD* md); +WOLFSSL_API int wolfSSL_EVP_PKEY_CTX_set1_hkdf_salt(WOLFSSL_EVP_PKEY_CTX* ctx, + const byte* salt, + int saltSz); +WOLFSSL_API int wolfSSL_EVP_PKEY_CTX_set1_hkdf_key(WOLFSSL_EVP_PKEY_CTX* ctx, + const byte* key, int keySz); +WOLFSSL_API int wolfSSL_EVP_PKEY_CTX_add1_hkdf_info(WOLFSSL_EVP_PKEY_CTX* ctx, + const byte* info, + int infoSz); +WOLFSSL_API int wolfSSL_EVP_PKEY_CTX_hkdf_mode(WOLFSSL_EVP_PKEY_CTX* ctx, + int mode); +#endif + +#define WOLFSSL_EVP_CIPH_MODE 0x0007 +#define WOLFSSL_EVP_CIPH_STREAM_CIPHER 0x0 +#define WOLFSSL_EVP_CIPH_ECB_MODE 0x1 +#define WOLFSSL_EVP_CIPH_CBC_MODE 0x2 +#define WOLFSSL_EVP_CIPH_CFB_MODE 0x3 +#define WOLFSSL_EVP_CIPH_OFB_MODE 0x4 +#define WOLFSSL_EVP_CIPH_CTR_MODE 0x5 +#define WOLFSSL_EVP_CIPH_GCM_MODE 0x6 +#define WOLFSSL_EVP_CIPH_CCM_MODE 0x7 +#define WOLFSSL_EVP_CIPH_XTS_MODE 0x10 +#define WOLFSSL_EVP_CIPH_FLAG_AEAD_CIPHER 0x20 +#define WOLFSSL_EVP_CIPH_NO_PADDING 0x100 +#define WOLFSSL_EVP_CIPH_VARIABLE_LENGTH 0x200 +#define WOLFSSL_EVP_CIPH_LOW_LEVEL_INITED 0x400 +#define WOLFSSL_EVP_CIPH_TYPE_INIT 0xff + + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + +/* EVP ENGINE API's */ +WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_EVP_PKEY_new_mac_key(int type, WOLFSSL_ENGINE* e, + const unsigned char* key, int keylen); + +WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_EVP_PKEY_new_CMAC_key(WOLFSSL_ENGINE* e, + const unsigned char* priv, size_t len, + const WOLFSSL_EVP_CIPHER* cipher); + +WOLFSSL_API int wolfSSL_EVP_DigestInit_ex(WOLFSSL_EVP_MD_CTX* ctx, + const WOLFSSL_EVP_MD* type, + WOLFSSL_ENGINE *impl); + +WOLFSSL_API int wolfSSL_EVP_DigestSignInit(WOLFSSL_EVP_MD_CTX *ctx, + WOLFSSL_EVP_PKEY_CTX **pctx, + const WOLFSSL_EVP_MD *type, + WOLFSSL_ENGINE *e, + WOLFSSL_EVP_PKEY *pkey); +WOLFSSL_API int wolfSSL_EVP_DigestVerifyInit(WOLFSSL_EVP_MD_CTX *ctx, + WOLFSSL_EVP_PKEY_CTX **pctx, + const WOLFSSL_EVP_MD *type, + WOLFSSL_ENGINE *e, + WOLFSSL_EVP_PKEY *pkey); +WOLFSSL_API int wolfSSL_EVP_Digest(const unsigned char* in, int inSz, unsigned char* out, + unsigned int* outSz, const WOLFSSL_EVP_MD* evp, + WOLFSSL_ENGINE* eng); +WOLFSSL_API const char* wolfSSL_EVP_CIPHER_type_string(unsigned int type); +WOLFSSL_API int wolfSSL_EVP_CipherInit_ex(WOLFSSL_EVP_CIPHER_CTX* ctx, + const WOLFSSL_EVP_CIPHER* type, + WOLFSSL_ENGINE *impl, + const unsigned char* key, + const unsigned char* iv, + int enc); +WOLFSSL_API int wolfSSL_EVP_EncryptInit(WOLFSSL_EVP_CIPHER_CTX* ctx, + const WOLFSSL_EVP_CIPHER* type, + const unsigned char* key, + const unsigned char* iv); +WOLFSSL_API int wolfSSL_EVP_EncryptInit_ex(WOLFSSL_EVP_CIPHER_CTX* ctx, + const WOLFSSL_EVP_CIPHER* type, + WOLFSSL_ENGINE *impl, + const unsigned char* key, + const unsigned char* iv); +WOLFSSL_API int wolfSSL_EVP_DecryptInit(WOLFSSL_EVP_CIPHER_CTX* ctx, + const WOLFSSL_EVP_CIPHER* type, + const unsigned char* key, + const unsigned char* iv); +WOLFSSL_API int wolfSSL_EVP_DecryptInit_ex(WOLFSSL_EVP_CIPHER_CTX* ctx, + const WOLFSSL_EVP_CIPHER* type, + WOLFSSL_ENGINE *impl, + const unsigned char* key, + const unsigned char* iv); +WOLFSSL_API WOLFSSL_EVP_PKEY_CTX *wolfSSL_EVP_PKEY_CTX_new(WOLFSSL_EVP_PKEY *pkey, WOLFSSL_ENGINE *e); +WOLFSSL_API WOLFSSL_EVP_PKEY_CTX *wolfSSL_EVP_PKEY_CTX_new_id(int id, WOLFSSL_ENGINE *e); +WOLFSSL_API int wolfSSL_EVP_SignInit_ex(WOLFSSL_EVP_MD_CTX* ctx, + const WOLFSSL_EVP_MD* type, + WOLFSSL_ENGINE *impl); + +#define WOLFSSL_EVP_CTRL_INIT 0x0 +#define WOLFSSL_EVP_CTRL_SET_KEY_LENGTH 0x1 +#define WOLFSSL_EVP_CTRL_SET_RC2_KEY_BITS 0x3 /* needed for qt compilation */ + +#define WOLFSSL_EVP_CTRL_AEAD_SET_IVLEN 0x9 +#define WOLFSSL_EVP_CTRL_AEAD_GET_TAG 0x10 +#define WOLFSSL_EVP_CTRL_AEAD_SET_TAG 0x11 +#define WOLFSSL_EVP_CTRL_AEAD_SET_IV_FIXED 0x12 +#define WOLFSSL_EVP_CTRL_GCM_IV_GEN 0x13 +#define WOLFSSL_EVP_CTRL_GCM_SET_IVLEN WOLFSSL_EVP_CTRL_AEAD_SET_IVLEN +#define WOLFSSL_EVP_CTRL_GCM_GET_TAG WOLFSSL_EVP_CTRL_AEAD_GET_TAG +#define WOLFSSL_EVP_CTRL_GCM_SET_TAG WOLFSSL_EVP_CTRL_AEAD_SET_TAG +#define WOLFSSL_EVP_CTRL_GCM_SET_IV_FIXED WOLFSSL_EVP_CTRL_AEAD_SET_IV_FIXED +#define WOLFSSL_EVP_CTRL_CCM_SET_IVLEN WOLFSSL_EVP_CTRL_AEAD_SET_IVLEN +#define WOLFSSL_EVP_CTRL_CCM_GET_TAG WOLFSSL_EVP_CTRL_AEAD_GET_TAG +#define WOLFSSL_EVP_CTRL_CCM_SET_TAG WOLFSSL_EVP_CTRL_AEAD_SET_TAG +#define WOLFSSL_EVP_CTRL_CCM_SET_L 0x14 +#define WOLFSSL_EVP_CTRL_CCM_SET_MSGLEN 0x15 +#define WOLFSSL_EVP_MD_FLAG_XOF 0x2 + +#define WOLFSSL_NO_PADDING_BLOCK_SIZE 1 + +#ifndef OPENSSL_COEXIST + +#define EVP_CIPH_STREAM_CIPHER WOLFSSL_EVP_CIPH_STREAM_CIPHER +#define EVP_CIPH_VARIABLE_LENGTH WOLFSSL_EVP_CIPH_VARIABLE_LENGTH +#define EVP_CIPH_ECB_MODE WOLFSSL_EVP_CIPH_ECB_MODE +#define EVP_CIPH_CBC_MODE WOLFSSL_EVP_CIPH_CBC_MODE +#define EVP_CIPH_CFB_MODE WOLFSSL_EVP_CIPH_CFB_MODE +#define EVP_CIPH_OFB_MODE WOLFSSL_EVP_CIPH_OFB_MODE +#define EVP_CIPH_CTR_MODE WOLFSSL_EVP_CIPH_CTR_MODE +#define EVP_CIPH_GCM_MODE WOLFSSL_EVP_CIPH_GCM_MODE +#define EVP_CIPH_CCM_MODE WOLFSSL_EVP_CIPH_CCM_MODE +#define EVP_CIPH_XTS_MODE WOLFSSL_EVP_CIPH_XTS_MODE + +#define EVP_CIPH_FLAG_AEAD_CIPHER WOLFSSL_EVP_CIPH_FLAG_AEAD_CIPHER + +#ifndef NO_MD4 + #define EVP_md4 wolfSSL_EVP_md4 +#endif +#ifndef NO_MD5 + #define EVP_md5 wolfSSL_EVP_md5 +#endif +#define EVP_sha1 wolfSSL_EVP_sha1 +#define EVP_mdc2 wolfSSL_EVP_mdc2 +#define EVP_dds1 wolfSSL_EVP_sha1 +#define EVP_sha224 wolfSSL_EVP_sha224 +#define EVP_sha256 wolfSSL_EVP_sha256 +#define EVP_sha384 wolfSSL_EVP_sha384 +#define EVP_sha512 wolfSSL_EVP_sha512 +#define EVP_sha512_224 wolfSSL_EVP_sha512_224 +#define EVP_sha512_256 wolfSSL_EVP_sha512_256 +#define EVP_ripemd160 wolfSSL_EVP_ripemd160 +#define EVP_shake128 wolfSSL_EVP_shake128 +#define EVP_shake256 wolfSSL_EVP_shake256 +#define EVP_sm3 wolfSSL_EVP_sm3 +#define EVP_set_pw_prompt wolfSSL_EVP_set_pw_prompt + +#define EVP_sha3_224 wolfSSL_EVP_sha3_224 +#define EVP_sha3_256 wolfSSL_EVP_sha3_256 +#define EVP_sha3_384 wolfSSL_EVP_sha3_384 +#define EVP_sha3_512 wolfSSL_EVP_sha3_512 + +#define EVP_aes_128_cbc wolfSSL_EVP_aes_128_cbc +#define EVP_aes_192_cbc wolfSSL_EVP_aes_192_cbc +#define EVP_aes_256_cbc wolfSSL_EVP_aes_256_cbc +#define EVP_aes_128_cfb1 wolfSSL_EVP_aes_128_cfb1 +#define EVP_aes_192_cfb1 wolfSSL_EVP_aes_192_cfb1 +#define EVP_aes_256_cfb1 wolfSSL_EVP_aes_256_cfb1 +#define EVP_aes_128_cfb8 wolfSSL_EVP_aes_128_cfb8 +#define EVP_aes_192_cfb8 wolfSSL_EVP_aes_192_cfb8 +#define EVP_aes_256_cfb8 wolfSSL_EVP_aes_256_cfb8 +#define EVP_aes_128_cfb128 wolfSSL_EVP_aes_128_cfb128 +#define EVP_aes_192_cfb128 wolfSSL_EVP_aes_192_cfb128 +#define EVP_aes_256_cfb128 wolfSSL_EVP_aes_256_cfb128 +#define EVP_aes_128_cfb wolfSSL_EVP_aes_128_cfb128 +#define EVP_aes_192_cfb wolfSSL_EVP_aes_192_cfb128 +#define EVP_aes_256_cfb wolfSSL_EVP_aes_256_cfb128 +#define EVP_aes_128_ofb wolfSSL_EVP_aes_128_ofb +#define EVP_aes_192_ofb wolfSSL_EVP_aes_192_ofb +#define EVP_aes_256_ofb wolfSSL_EVP_aes_256_ofb +#define EVP_aes_128_xts wolfSSL_EVP_aes_128_xts +#define EVP_aes_256_xts wolfSSL_EVP_aes_256_xts +#define EVP_aes_128_gcm wolfSSL_EVP_aes_128_gcm +#define EVP_aes_192_gcm wolfSSL_EVP_aes_192_gcm +#define EVP_aes_256_gcm wolfSSL_EVP_aes_256_gcm +#define EVP_aes_128_ccm wolfSSL_EVP_aes_128_ccm +#define EVP_aes_192_ccm wolfSSL_EVP_aes_192_ccm +#define EVP_aes_256_ccm wolfSSL_EVP_aes_256_ccm +#define EVP_aes_128_ecb wolfSSL_EVP_aes_128_ecb +#define EVP_aes_192_ecb wolfSSL_EVP_aes_192_ecb +#define EVP_aes_256_ecb wolfSSL_EVP_aes_256_ecb +#define EVP_aes_128_ctr wolfSSL_EVP_aes_128_ctr +#define EVP_aes_192_ctr wolfSSL_EVP_aes_192_ctr +#define EVP_aes_256_ctr wolfSSL_EVP_aes_256_ctr +#define EVP_des_cbc wolfSSL_EVP_des_cbc +#define EVP_des_ecb wolfSSL_EVP_des_ecb +#define EVP_des_ede3_cbc wolfSSL_EVP_des_ede3_cbc +#define EVP_des_ede3_ecb wolfSSL_EVP_des_ede3_ecb +#define EVP_rc4 wolfSSL_EVP_rc4 +#define EVP_chacha20 wolfSSL_EVP_chacha20 +#define EVP_chacha20_poly1305 wolfSSL_EVP_chacha20_poly1305 +#define EVP_aria_128_gcm wolfSSL_EVP_aria_128_gcm +#define EVP_aria_192_gcm wolfSSL_EVP_aria_192_gcm +#define EVP_aria_256_gcm wolfSSL_EVP_aria_256_gcm +#define EVP_sm4_ecb wolfSSL_EVP_sm4_ecb +#define EVP_sm4_cbc wolfSSL_EVP_sm4_cbc +#define EVP_sm4_ctr wolfSSL_EVP_sm4_ctr +#define EVP_sm4_gcm wolfSSL_EVP_sm4_gcm +#define EVP_sm4_ccm wolfSSL_EVP_sm4_ccm +#define EVP_enc_null wolfSSL_EVP_enc_null + +#define EVP_MD_size wolfSSL_EVP_MD_size +#define EVP_MD_pkey_type wolfSSL_EVP_MD_pkey_type +#define EVP_MD_CTX_new wolfSSL_EVP_MD_CTX_new +#define EVP_MD_CTX_create wolfSSL_EVP_MD_CTX_new +#define EVP_MD_CTX_free wolfSSL_EVP_MD_CTX_free +#define EVP_MD_CTX_destroy wolfSSL_EVP_MD_CTX_free +#define EVP_MD_CTX_init wolfSSL_EVP_MD_CTX_init +#define EVP_MD_CTX_cleanup wolfSSL_EVP_MD_CTX_cleanup +#define EVP_MD_CTX_reset wolfSSL_EVP_MD_CTX_cleanup +#define EVP_MD_CTX_md wolfSSL_EVP_MD_CTX_md +#define EVP_MD_CTX_type wolfSSL_EVP_MD_CTX_type +#define EVP_MD_CTX_size wolfSSL_EVP_MD_CTX_size +#define EVP_MD_CTX_block_size wolfSSL_EVP_MD_CTX_block_size +#define EVP_MD_block_size wolfSSL_EVP_MD_block_size +#define EVP_MD_type wolfSSL_EVP_MD_type +#ifndef NO_WOLFSSL_STUB +#define EVP_MD_CTX_set_flags(ctx, flags) WC_DO_NOTHING +#endif + +#define EVP_MD_FLAG_XOF WOLFSSL_EVP_MD_FLAG_XOF + +#define EVP_Digest wolfSSL_EVP_Digest +#define EVP_DigestInit wolfSSL_EVP_DigestInit +#define EVP_DigestInit_ex wolfSSL_EVP_DigestInit_ex +#define EVP_DigestUpdate wolfSSL_EVP_DigestUpdate +#define EVP_DigestFinal wolfSSL_EVP_DigestFinal +#define EVP_DigestFinal_ex wolfSSL_EVP_DigestFinal_ex +#define EVP_DigestFinalXOF wolfSSL_EVP_DigestFinalXOF +#define EVP_DigestSignInit wolfSSL_EVP_DigestSignInit +#define EVP_DigestSignUpdate wolfSSL_EVP_DigestSignUpdate +#define EVP_DigestSignFinal wolfSSL_EVP_DigestSignFinal +#define EVP_DigestVerifyInit wolfSSL_EVP_DigestVerifyInit +#define EVP_DigestVerifyUpdate wolfSSL_EVP_DigestVerifyUpdate +#define EVP_DigestVerifyFinal wolfSSL_EVP_DigestVerifyFinal +#define EVP_BytesToKey wolfSSL_EVP_BytesToKey + +#define EVP_get_cipherbyname wolfSSL_EVP_get_cipherbyname +#define EVP_get_digestbyname wolfSSL_EVP_get_digestbyname + +#define EVP_CIPHER_CTX_init wolfSSL_EVP_CIPHER_CTX_init +#define EVP_CIPHER_CTX_cleanup wolfSSL_EVP_CIPHER_CTX_cleanup +#define EVP_CIPHER_CTX_iv_length wolfSSL_EVP_CIPHER_CTX_iv_length +#define EVP_CIPHER_CTX_nid wolfSSL_EVP_CIPHER_CTX_nid +#define EVP_CIPHER_CTX_key_length wolfSSL_EVP_CIPHER_CTX_key_length +#define EVP_CIPHER_CTX_set_key_length wolfSSL_EVP_CIPHER_CTX_set_key_length +#define EVP_CIPHER_CTX_set_iv_length wolfSSL_EVP_CIPHER_CTX_set_iv_length +#define EVP_CIPHER_CTX_mode wolfSSL_EVP_CIPHER_CTX_mode +#define EVP_CIPHER_CTX_cipher wolfSSL_EVP_CIPHER_CTX_cipher + +#define EVP_CIPHER_iv_length wolfSSL_EVP_CIPHER_iv_length +#define EVP_CIPHER_key_length wolfSSL_EVP_Cipher_key_length + +#define EVP_CipherInit wolfSSL_EVP_CipherInit +#define EVP_CipherInit_ex wolfSSL_EVP_CipherInit_ex +#define EVP_EncryptInit wolfSSL_EVP_EncryptInit +#define EVP_EncryptInit_ex wolfSSL_EVP_EncryptInit_ex +#define EVP_DecryptInit wolfSSL_EVP_DecryptInit +#define EVP_DecryptInit_ex wolfSSL_EVP_DecryptInit_ex + +#define EVP_Cipher wolfSSL_EVP_Cipher +#define EVP_CipherUpdate wolfSSL_EVP_CipherUpdate +#define EVP_EncryptUpdate wolfSSL_EVP_CipherUpdate +#define EVP_DecryptUpdate wolfSSL_EVP_CipherUpdate +#define EVP_CipherFinal wolfSSL_EVP_CipherFinal +#define EVP_CipherFinal_ex wolfSSL_EVP_CipherFinal +#define EVP_EncryptFinal wolfSSL_EVP_CipherFinal +#define EVP_EncryptFinal_ex wolfSSL_EVP_CipherFinal +#define EVP_DecryptFinal wolfSSL_EVP_CipherFinal +#define EVP_DecryptFinal_ex wolfSSL_EVP_CipherFinal + +#define EVP_CIPHER_CTX_free wolfSSL_EVP_CIPHER_CTX_free +#define EVP_CIPHER_CTX_reset wolfSSL_EVP_CIPHER_CTX_reset +#define EVP_CIPHER_CTX_new wolfSSL_EVP_CIPHER_CTX_new + +#define EVP_get_cipherbynid wolfSSL_EVP_get_cipherbynid +#define EVP_get_digestbynid wolfSSL_EVP_get_digestbynid +#define EVP_MD_nid wolfSSL_EVP_MD_type +#define EVP_MD_flags wolfSSL_EVP_MD_flags + +#define EVP_PKEY_assign wolfSSL_EVP_PKEY_assign +#define EVP_PKEY_assign_RSA wolfSSL_EVP_PKEY_assign_RSA +#define EVP_PKEY_assign_DSA wolfSSL_EVP_PKEY_assign_DSA +#define EVP_PKEY_assign_DH wolfSSL_EVP_PKEY_assign_DH +#define EVP_PKEY_assign_EC_KEY wolfSSL_EVP_PKEY_assign_EC_KEY +#define EVP_PKEY_get1_DSA wolfSSL_EVP_PKEY_get1_DSA +#define EVP_PKEY_set1_DSA wolfSSL_EVP_PKEY_set1_DSA +#define EVP_PKEY_get0_RSA wolfSSL_EVP_PKEY_get0_RSA +#define EVP_PKEY_get1_RSA wolfSSL_EVP_PKEY_get1_RSA +#define EVP_PKEY_set1_RSA wolfSSL_EVP_PKEY_set1_RSA +#define EVP_PKEY_set1_EC_KEY wolfSSL_EVP_PKEY_set1_EC_KEY +#define EVP_PKEY_get1_EC_KEY wolfSSL_EVP_PKEY_get1_EC_KEY +#define EVP_PKEY_set1_DH wolfSSL_EVP_PKEY_set1_DH +#define EVP_PKEY_get0_DH wolfSSL_EVP_PKEY_get0_DH +#define EVP_PKEY_get1_DH wolfSSL_EVP_PKEY_get1_DH +#define EVP_PKEY_get0_EC_KEY wolfSSL_EVP_PKEY_get0_EC_KEY +#define EVP_PKEY_get0_hmac wolfSSL_EVP_PKEY_get0_hmac +#define EVP_PKEY_new_mac_key wolfSSL_EVP_PKEY_new_mac_key +#define EVP_PKEY_new_CMAC_key wolfSSL_EVP_PKEY_new_CMAC_key +#define EVP_MD_CTX_copy wolfSSL_EVP_MD_CTX_copy +#define EVP_MD_CTX_copy_ex wolfSSL_EVP_MD_CTX_copy_ex +#define EVP_PKEY_sign_init wolfSSL_EVP_PKEY_sign_init +#define EVP_PKEY_sign wolfSSL_EVP_PKEY_sign +#define EVP_PKEY_verify_init wolfSSL_EVP_PKEY_verify_init +#define EVP_PKEY_verify wolfSSL_EVP_PKEY_verify +#define EVP_PKEY_paramgen_init wolfSSL_EVP_PKEY_paramgen_init +#define EVP_PKEY_CTX_set_ec_param_enc wolfSSL_EVP_PKEY_CTX_set_ec_param_enc +#define EVP_PKEY_CTX_set_ec_paramgen_curve_nid wolfSSL_EVP_PKEY_CTX_set_ec_paramgen_curve_nid +#define EVP_PKEY_paramgen wolfSSL_EVP_PKEY_paramgen +#define EVP_PKEY_keygen wolfSSL_EVP_PKEY_keygen +#define EVP_PKEY_keygen_init wolfSSL_EVP_PKEY_keygen_init +#define EVP_PKEY_bits wolfSSL_EVP_PKEY_bits +#define EVP_PKEY_is_a wolfSSL_EVP_PKEY_is_a +#define EVP_PKEY_CTX_free wolfSSL_EVP_PKEY_CTX_free +#define EVP_PKEY_CTX_new wolfSSL_EVP_PKEY_CTX_new +#define EVP_PKEY_CTX_set_rsa_padding wolfSSL_EVP_PKEY_CTX_set_rsa_padding +#define EVP_PKEY_CTX_set_signature_md wolfSSL_EVP_PKEY_CTX_set_signature_md +#define EVP_PKEY_CTX_new_id wolfSSL_EVP_PKEY_CTX_new_id +#define EVP_PKEY_CTX_set_rsa_keygen_bits wolfSSL_EVP_PKEY_CTX_set_rsa_keygen_bits +#define EVP_PKEY_CTX_set_rsa_mgf1_md wolfSSL_EVP_PKEY_CTX_set_rsa_mgf1_md +#define EVP_PKEY_CTX_set_rsa_pss_saltlen wolfSSL_EVP_PKEY_CTX_set_rsa_pss_saltlen +#define EVP_PKEY_CTX_set_rsa_oaep_md wolfSSL_EVP_PKEY_CTX_set_rsa_oaep_md +#define EVP_PKEY_derive_init wolfSSL_EVP_PKEY_derive_init +#define EVP_PKEY_derive_set_peer wolfSSL_EVP_PKEY_derive_set_peer +#define EVP_PKEY_derive wolfSSL_EVP_PKEY_derive +#define EVP_PKEY_decrypt wolfSSL_EVP_PKEY_decrypt +#define EVP_PKEY_decrypt_init wolfSSL_EVP_PKEY_decrypt_init +#define EVP_PKEY_encrypt wolfSSL_EVP_PKEY_encrypt +#define EVP_PKEY_encrypt_init wolfSSL_EVP_PKEY_encrypt_init +#define EVP_PKEY_new wolfSSL_EVP_PKEY_new +#define EVP_PKEY_free wolfSSL_EVP_PKEY_free +#define EVP_PKEY_up_ref wolfSSL_EVP_PKEY_up_ref +#define EVP_PKEY_size wolfSSL_EVP_PKEY_size +#define EVP_PKEY_copy_parameters wolfSSL_EVP_PKEY_copy_parameters +#define EVP_PKEY_missing_parameters wolfSSL_EVP_PKEY_missing_parameters +#define EVP_PKEY_cmp wolfSSL_EVP_PKEY_cmp +#define EVP_PKEY_type wolfSSL_EVP_PKEY_type +#define EVP_PKEY_base_id wolfSSL_EVP_PKEY_base_id +#define EVP_PKEY_get_default_digest_nid wolfSSL_EVP_PKEY_get_default_digest_nid +#define EVP_PKEY_id wolfSSL_EVP_PKEY_id +#define EVP_PKEY_CTX_ctrl_str wolfSSL_EVP_PKEY_CTX_ctrl_str +#define EVP_PKCS82PKEY wolfSSL_EVP_PKCS82PKEY +#define EVP_PKEY2PKCS8 wolfSSL_EVP_PKEY2PKCS8 +#define EVP_SignFinal wolfSSL_EVP_SignFinal +#define EVP_SignInit wolfSSL_EVP_SignInit +#define EVP_SignInit_ex wolfSSL_EVP_SignInit_ex +#define EVP_SignUpdate wolfSSL_EVP_SignUpdate +#define EVP_VerifyFinal wolfSSL_EVP_VerifyFinal +#define EVP_VerifyInit wolfSSL_EVP_VerifyInit +#define EVP_VerifyUpdate wolfSSL_EVP_VerifyUpdate + +#define EVP_CIPHER_CTX_ctrl wolfSSL_EVP_CIPHER_CTX_ctrl +#define EVP_CIPHER_CTX_block_size wolfSSL_EVP_CIPHER_CTX_block_size +#define EVP_CIPHER_block_size wolfSSL_EVP_CIPHER_block_size +#define EVP_CIPHER_flags wolfSSL_EVP_CIPHER_flags +#define EVP_CIPHER_CTX_set_flags wolfSSL_EVP_CIPHER_CTX_set_flags +#define EVP_CIPHER_CTX_clear_flags wolfSSL_EVP_CIPHER_CTX_clear_flags +#define EVP_CIPHER_CTX_set_padding wolfSSL_EVP_CIPHER_CTX_set_padding +#define EVP_CIPHER_CTX_flags wolfSSL_EVP_CIPHER_CTX_flags +#define EVP_CIPHER_CTX_set_iv wolfSSL_EVP_CIPHER_CTX_set_iv +#define EVP_CIPHER_CTX_get_iv wolfSSL_EVP_CIPHER_CTX_get_iv +#define EVP_add_digest wolfSSL_EVP_add_digest +#define EVP_add_cipher wolfSSL_EVP_add_cipher +#define EVP_cleanup wolfSSL_EVP_cleanup +#define EVP_read_pw_string wolfSSL_EVP_read_pw_string +#define EVP_rc2_cbc wolfSSL_EVP_rc2_cbc + +#define OpenSSL_add_all_digests() wolfSSL_EVP_init() +#define OpenSSL_add_all_ciphers() wolfSSL_EVP_init() +#define OpenSSL_add_all_algorithms wolfSSL_add_all_algorithms +#define OpenSSL_add_all_algorithms_noconf wolfSSL_OpenSSL_add_all_algorithms_noconf +#define OpenSSL_add_all_algorithms_conf wolfSSL_OpenSSL_add_all_algorithms_conf + +#define wolfSSL_OPENSSL_add_all_algorithms_noconf wolfSSL_OpenSSL_add_all_algorithms_noconf +#define wolfSSL_OPENSSL_add_all_algorithms_conf wolfSSL_OpenSSL_add_all_algorithms_conf + +/* provides older OpenSSL API compatibility */ +#define OPENSSL_add_all_algorithms OpenSSL_add_all_algorithms +#define OPENSSL_add_all_algorithms_noconf OpenSSL_add_all_algorithms_noconf +#define OPENSSL_add_all_algorithms_conf OpenSSL_add_all_algorithms_conf + +#define NO_PADDING_BLOCK_SIZE WOLFSSL_NO_PADDING_BLOCK_SIZE + +#define PKCS5_PBKDF2_HMAC_SHA1 wolfSSL_PKCS5_PBKDF2_HMAC_SHA1 +#define PKCS5_PBKDF2_HMAC wolfSSL_PKCS5_PBKDF2_HMAC +#define EVP_PBE_scrypt wolfSSL_EVP_PBE_scrypt + +/* OpenSSL compat. ctrl values */ +#define EVP_CTRL_INIT 0x0 +#define EVP_CTRL_SET_KEY_LENGTH 0x1 +#define EVP_CTRL_SET_RC2_KEY_BITS 0x3 /* needed for qt compilation */ + +#define EVP_CTRL_AEAD_SET_IVLEN WOLFSSL_EVP_CTRL_AEAD_SET_IVLEN +#define EVP_CTRL_AEAD_GET_TAG WOLFSSL_EVP_CTRL_AEAD_GET_TAG +#define EVP_CTRL_AEAD_SET_TAG WOLFSSL_EVP_CTRL_AEAD_SET_TAG +#define EVP_CTRL_AEAD_SET_IV_FIXED WOLFSSL_EVP_CTRL_AEAD_SET_IV_FIXED +#define EVP_CTRL_GCM_IV_GEN WOLFSSL_EVP_CTRL_GCM_IV_GEN +#define EVP_CTRL_GCM_SET_IVLEN WOLFSSL_EVP_CTRL_GCM_SET_IVLEN +#define EVP_CTRL_GCM_GET_TAG WOLFSSL_EVP_CTRL_GCM_GET_TAG +#define EVP_CTRL_GCM_SET_TAG WOLFSSL_EVP_CTRL_GCM_SET_TAG +#define EVP_CTRL_GCM_SET_IV_FIXED WOLFSSL_EVP_CTRL_GCM_SET_IV_FIXED +#define EVP_CTRL_CCM_SET_IVLEN WOLFSSL_EVP_CTRL_CCM_SET_IVLEN +#define EVP_CTRL_CCM_GET_TAG WOLFSSL_EVP_CTRL_CCM_GET_TAG +#define EVP_CTRL_CCM_SET_TAG WOLFSSL_EVP_CTRL_CCM_SET_TAG +#define EVP_CTRL_CCM_SET_L WOLFSSL_EVP_CTRL_CCM_SET_L +#define EVP_CTRL_CCM_SET_MSGLEN WOLFSSL_EVP_CTRL_CCM_SET_MSGLEN + +#define EVP_PKEY_print_public wolfSSL_EVP_PKEY_print_public +#define EVP_PKEY_print_private(arg1, arg2, arg3, arg4) WC_DO_NOTHING + +#ifndef EVP_MAX_MD_SIZE + #define EVP_MAX_MD_SIZE 64 /* sha512 */ +#endif + +#ifndef EVP_MAX_KEY_LENGTH +#define EVP_MAX_KEY_LENGTH 64 +#endif + +#ifndef EVP_MAX_IV_LENGTH +#define EVP_MAX_IV_LENGTH 16 +#endif + +#ifndef EVP_MAX_BLOCK_LENGTH + #define EVP_MAX_BLOCK_LENGTH 32 /* 2 * blocklen(AES)? */ + /* They define this as 32. Using the same value here. */ +#endif + +#ifndef EVP_MAX_IV_LENGTH + #define EVP_MAX_IV_LENGTH 16 +#endif + + +#define EVP_R_BAD_DECRYPT (-WOLFSSL_EVP_R_BAD_DECRYPT_E) +#define EVP_R_BN_DECODE_ERROR (-WOLFSSL_EVP_R_BN_DECODE_ERROR) +#define EVP_R_DECODE_ERROR (-WOLFSSL_EVP_R_DECODE_ERROR) +#define EVP_R_PRIVATE_KEY_DECODE_ERROR (-WOLFSSL_EVP_R_PRIVATE_KEY_DECODE_ERROR) + +#define EVP_CIPHER_mode WOLFSSL_EVP_CIPHER_mode +/* WOLFSSL_EVP_CIPHER is just the string name of the cipher */ +#define EVP_CIPHER_name(x) x +#define EVP_MD_CTX_reset wolfSSL_EVP_MD_CTX_cleanup +/* WOLFSSL_EVP_MD is just the string name of the digest */ +#define EVP_MD_name(x) x +#define EVP_CIPHER_nid wolfSSL_EVP_CIPHER_nid + +/* Base64 encoding/decoding APIs */ +#if defined(WOLFSSL_BASE64_ENCODE) || defined(WOLFSSL_BASE64_DECODE) +#define EVP_ENCODE_CTX WOLFSSL_EVP_ENCODE_CTX +#define EVP_ENCODE_CTX_new wolfSSL_EVP_ENCODE_CTX_new +#define EVP_ENCODE_CTX_free wolfSSL_EVP_ENCODE_CTX_free +#endif /* WOLFSSL_BASE64_ENCODE || WOLFSSL_BASE64_DECODE*/ +#if defined(WOLFSSL_BASE64_ENCODE) +#define EVP_EncodeInit wolfSSL_EVP_EncodeInit +#define EVP_EncodeUpdate wolfSSL_EVP_EncodeUpdate +#define EVP_EncodeFinal wolfSSL_EVP_EncodeFinal +#define EVP_EncodeBlock wolfSSL_EVP_EncodeBlock +#define EVP_DecodeBlock wolfSSL_EVP_DecodeBlock +#endif /* WOLFSSL_BASE64_ENCODE */ +#if defined(WOLFSSL_BASE64_DECODE) +#define EVP_DecodeInit wolfSSL_EVP_DecodeInit +#define EVP_DecodeUpdate wolfSSL_EVP_DecodeUpdate +#define EVP_DecodeFinal wolfSSL_EVP_DecodeFinal +#endif /* WOLFSSL_BASE64_DECODE */ + +#define EVP_blake2b512 wolfSSL_EVP_blake2b512 +#define EVP_blake2s256 wolfSSL_EVP_blake2s256 +#define EVP_MD_do_all wolfSSL_EVP_MD_do_all + +#ifdef HAVE_HKDF +#define EVP_PKEY_CTX_set_hkdf_md wolfSSL_EVP_PKEY_CTX_set_hkdf_md +#define EVP_PKEY_CTX_set1_hkdf_salt wolfSSL_EVP_PKEY_CTX_set1_hkdf_salt +#define EVP_PKEY_CTX_set1_hkdf_key wolfSSL_EVP_PKEY_CTX_set1_hkdf_key +#define EVP_PKEY_CTX_add1_hkdf_info wolfSSL_EVP_PKEY_CTX_add1_hkdf_info +#define EVP_PKEY_CTX_hkdf_mode wolfSSL_EVP_PKEY_CTX_hkdf_mode +#endif + +WOLFSSL_API void printPKEY(WOLFSSL_EVP_PKEY *k); + +#endif /* !OPENSSL_COEXIST */ + +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#include <wolfssl/openssl/objects.h> + +#endif /* WOLFSSL_EVP_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/fips_rand.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/fips_rand.h @@ -0,0 +1,125 @@ +/* fips_rand.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* fips_rand.h for openSSL compatibility */ + +#ifndef WOLFSSL_OPENSSL_FIPS_RAND_H_ +#define WOLFSSL_OPENSSL_FIPS_RAND_H_ + +#include <wolfssl/openssl/ssl.h> +#include <wolfssl/wolfcrypt/random.h> + +#if !defined(WC_NO_RNG) && defined(HAVE_HASHDRBG) + +struct WOLFSSL_DRBG_CTX; + +typedef size_t (*drbg_entropy_get)(struct WOLFSSL_DRBG_CTX* ctx, unsigned char** pout, + int entropy, size_t min_len, size_t max_len); +typedef void (*drbg_entropy_clean)(struct WOLFSSL_DRBG_CTX* ctx, unsigned char* out, + size_t olen); +typedef size_t (*drbg_nonce_get)(struct WOLFSSL_DRBG_CTX* ctx, unsigned char** pout, + int entropy, size_t min_len, size_t max_len); +typedef void (*drbg_nonce_clean)(struct WOLFSSL_DRBG_CTX* ctx, unsigned char* out, + size_t olen); + +typedef struct WOLFSSL_DRBG_CTX { + WC_RNG* rng; + drbg_entropy_get entropy_get; + drbg_entropy_clean entropy_clean; + size_t entropy_blocklen; + drbg_nonce_get none_get; + drbg_nonce_clean nonce_clean; + + int type; + int status; + int xflags; + void* app_data; +} WOLFSSL_DRBG_CTX; + +#define DRBG_FLAG_CTR_USE_DF 0x1 +#define DRBG_FLAG_TEST 0x2 + +#define DRBG_FLAG_NOERR 0x1 +#define DRBG_CUSTOM_RESEED 0x2 + +#define DRBG_STATUS_UNINITIALISED 0 +#define DRBG_STATUS_READY 1 +#define DRBG_STATUS_RESEED 2 +#define DRBG_STATUS_ERROR 3 + +WOLFSSL_API WOLFSSL_DRBG_CTX* wolfSSL_FIPS_drbg_new(int type, + unsigned int flags); + +WOLFSSL_API int wolfSSL_FIPS_drbg_init(WOLFSSL_DRBG_CTX *ctx, + int type, unsigned int flags); + +WOLFSSL_API int wolfSSL_FIPS_drbg_instantiate(WOLFSSL_DRBG_CTX* ctx, + const unsigned char* pers, size_t perslen); + +WOLFSSL_API int wolfSSL_FIPS_drbg_set_callbacks(WOLFSSL_DRBG_CTX* ctx, + drbg_entropy_get entropy_get, drbg_entropy_clean entropy_clean, + size_t entropy_blocklen, + drbg_nonce_get none_get, drbg_nonce_clean nonce_clean); + +WOLFSSL_API void wolfSSL_FIPS_rand_add(const void* buf, int num, + double entropy); +WOLFSSL_API int wolfSSL_FIPS_drbg_reseed(WOLFSSL_DRBG_CTX* ctx, + const unsigned char* adin, size_t adinlen); + +WOLFSSL_API int wolfSSL_FIPS_drbg_generate(WOLFSSL_DRBG_CTX* ctx, + unsigned char* out, size_t outlen, int prediction_resistance, + const unsigned char* adin, size_t adinlen); + +WOLFSSL_API int wolfSSL_FIPS_drbg_uninstantiate(WOLFSSL_DRBG_CTX *ctx); + +WOLFSSL_API void wolfSSL_FIPS_drbg_free(WOLFSSL_DRBG_CTX *ctx); + +WOLFSSL_API WOLFSSL_DRBG_CTX* wolfSSL_FIPS_get_default_drbg(void); + +WOLFSSL_API void wolfSSL_FIPS_get_timevec(unsigned char* buf, + unsigned long* pctr); + +WOLFSSL_API void* wolfSSL_FIPS_drbg_get_app_data(WOLFSSL_DRBG_CTX *ctx); + +WOLFSSL_API void wolfSSL_FIPS_drbg_set_app_data(WOLFSSL_DRBG_CTX *ctx, + void *app_data); + + +/* compatibility mapping */ +typedef WOLFSSL_DRBG_CTX DRBG_CTX; + +#define FIPS_drbg_init wolfSSL_FIPS_drbg_init +#define FIPS_drbg_new wolfSSL_FIPS_drbg_new +#define FIPS_drbg_instantiate wolfSSL_FIPS_drbg_instantiate +#define FIPS_drbg_set_callbacks wolfSSL_FIPS_drbg_set_callbacks +#define FIPS_rand_add wolfSSL_FIPS_rand_add +#define FIPS_drbg_reseed wolfSSL_FIPS_drbg_reseed +#define FIPS_drbg_generate wolfSSL_FIPS_drbg_generate +#define FIPS_drbg_uninstantiate wolfSSL_FIPS_drbg_uninstantiate +#define FIPS_drbg_free wolfSSL_FIPS_drbg_free +#define FIPS_get_default_drbg wolfSSL_FIPS_get_default_drbg +#define FIPS_get_timevec wolfSSL_FIPS_get_timevec +#define FIPS_drbg_get_app_data wolfSSL_FIPS_drbg_get_app_data +#define FIPS_drbg_set_app_data wolfSSL_FIPS_drbg_set_app_data + +#endif /* !WC_NO_RNG && HAVE_HASHDRBG */ + +#endif /* WOLFSSL_OPENSSL_FIPS_RAND_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/hmac.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/hmac.h @@ -0,0 +1,98 @@ +/* hmac.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + +/* hmac.h defines mini hmac openssl compatibility layer + * + */ + + +#ifndef WOLFSSL_HMAC_H_ +#define WOLFSSL_HMAC_H_ + +#include <wolfssl/wolfcrypt/settings.h> + +#ifdef WOLFSSL_PREFIX +#include "prefix_hmac.h" +#endif + +#include <wolfssl/openssl/compat_types.h> +#include <wolfssl/openssl/opensslv.h> + +#ifdef __cplusplus + extern "C" { +#endif + +#define HMAC_MAX_MD_CBLOCK WC_MAX_BLOCK_SIZE + +WOLFSSL_API unsigned char* wolfSSL_HMAC(const WOLFSSL_EVP_MD* evp_md, + const void* key, int key_len, + const unsigned char* d, size_t n, unsigned char* md, + unsigned int* md_len); + +WOLFSSL_API WOLFSSL_HMAC_CTX* wolfSSL_HMAC_CTX_new(void); +WOLFSSL_API int wolfSSL_HMAC_CTX_Init(WOLFSSL_HMAC_CTX* ctx); +WOLFSSL_API int wolfSSL_HMAC_CTX_copy(WOLFSSL_HMAC_CTX* des, + WOLFSSL_HMAC_CTX* src); +WOLFSSL_LOCAL int wolfSSL_HmacCopy(Hmac* des, Hmac* src); +WOLFSSL_API int wolfSSL_HMAC_Init(WOLFSSL_HMAC_CTX* ctx, const void* key, + int keylen, const WOLFSSL_EVP_MD* type); +WOLFSSL_API int wolfSSL_HMAC_Init_ex(WOLFSSL_HMAC_CTX* ctx, const void* key, + int keylen, const WOLFSSL_EVP_MD* type, WOLFSSL_ENGINE* e); +WOLFSSL_API int wolfSSL_HMAC_Update(WOLFSSL_HMAC_CTX* ctx, + const unsigned char* data, int len); +WOLFSSL_API int wolfSSL_HMAC_Final(WOLFSSL_HMAC_CTX* ctx, unsigned char* hash, + unsigned int* len); +WOLFSSL_API int wolfSSL_HMAC_cleanup(WOLFSSL_HMAC_CTX* ctx); +WOLFSSL_API void wolfSSL_HMAC_CTX_cleanup(WOLFSSL_HMAC_CTX* ctx); +WOLFSSL_API void wolfSSL_HMAC_CTX_free(WOLFSSL_HMAC_CTX* ctx); +WOLFSSL_API size_t wolfSSL_HMAC_size(const WOLFSSL_HMAC_CTX *ctx); +WOLFSSL_API const WOLFSSL_EVP_MD *wolfSSL_HMAC_CTX_get_md(const WOLFSSL_HMAC_CTX *ctx); + +#ifndef OPENSSL_COEXIST + +typedef struct WOLFSSL_HMAC_CTX HMAC_CTX; + +#define HMAC wolfSSL_HMAC + +#define HMAC_CTX_new wolfSSL_HMAC_CTX_new +#define HMAC_CTX_init wolfSSL_HMAC_CTX_Init +#define HMAC_CTX_copy wolfSSL_HMAC_CTX_copy +#define HMAC_CTX_free wolfSSL_HMAC_CTX_free +#define HMAC_CTX_cleanup wolfSSL_HMAC_CTX_cleanup +#define HMAC_CTX_reset wolfSSL_HMAC_cleanup +#define HMAC_Init_ex wolfSSL_HMAC_Init_ex +#define HMAC_Init wolfSSL_HMAC_Init +#define HMAC_Update wolfSSL_HMAC_Update +#define HMAC_Final wolfSSL_HMAC_Final +#define HMAC_cleanup wolfSSL_HMAC_cleanup +#define HMAC_size wolfSSL_HMAC_size +#define HMAC_CTX_get_md wolfSSL_HMAC_CTX_get_md + +#endif /* !OPENSSL_COEXIST */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + + +#endif /* WOLFSSL_HMAC_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/kdf.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/kdf.h @@ -0,0 +1,45 @@ +/* kdf.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifndef WOLFSSL_KDF_H_ +#define WOLFSSL_KDF_H_ + +#ifdef __cplusplus + extern "C" { +#endif + +#define WOLFSSL_EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND 0 +#define WOLFSSL_EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY 1 +#define WOLFSSL_EVP_PKEY_HKDEF_MODE_EXPAND_ONLY 2 + +#ifndef OPENSSL_COEXIST + +#define EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND WOLFSSL_EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND +#define EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY WOLFSSL_EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY +#define EVP_PKEY_HKDEF_MODE_EXPAND_ONLY WOLFSSL_EVP_PKEY_HKDEF_MODE_EXPAND_ONLY + +#endif /* !OPENSSL_COEXIST */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_KDF_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/lhash.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/lhash.h @@ -0,0 +1,64 @@ +/* lhash.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* lhash.h for openSSL */ + +#ifndef WOLFSSL_lhash_H_ +#define WOLFSSL_lhash_H_ + +#ifdef __cplusplus + extern "C" { +#endif + +#include <wolfssl/openssl/ssl.h> + +#ifdef OPENSSL_ALL +#define IMPLEMENT_LHASH_HASH_FN(name, type) \ + unsigned long wolfSSL_##name##_LHASH_HASH(const void *arg) \ + { \ + const type *a = arg; \ + return name##_hash(a); \ + } +#define IMPLEMENT_LHASH_COMP_FN(name, type) \ + int wolfSSL_##name##_LHASH_COMP(const void *p1, const void *p2) \ + { \ + const type *_p1 = p1; \ + const type *_p2 = p2; \ + return name##_cmp(_p1, _p2); \ + } + +#define LHASH_HASH_FN(name) wolfSSL_##name##_LHASH_HASH +#define LHASH_COMP_FN(name) wolfSSL_##name##_LHASH_COMP + +WOLFSSL_API unsigned long wolfSSL_LH_strhash(const char *str); + +WOLFSSL_API void *wolfSSL_lh_retrieve(WOLFSSL_STACK *sk, void *data); + +#define lh_strhash wolfSSL_LH_strhash + +#endif + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* WOLFSSL_lhash_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/md4.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/md4.h @@ -0,0 +1,66 @@ +/* md4.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + +#ifndef WOLFSSL_MD4_H_ +#define WOLFSSL_MD4_H_ + +#include <wolfssl/wolfcrypt/settings.h> + +#ifndef NO_MD4 + +#ifdef WOLFSSL_PREFIX +#include "prefix_md4.h" +#endif + +#ifdef __cplusplus + extern "C" { +#endif + + +typedef struct WOLFSSL_MD4_CTX { + int buffer[32]; /* big enough to hold, check size in Init */ +} WOLFSSL_MD4_CTX; + + +WOLFSSL_API void wolfSSL_MD4_Init(WOLFSSL_MD4_CTX* md4); +WOLFSSL_API void wolfSSL_MD4_Update(WOLFSSL_MD4_CTX* md4, const void* data, + unsigned long len); +WOLFSSL_API void wolfSSL_MD4_Final(unsigned char* digest, WOLFSSL_MD4_CTX* md4); + +#ifndef OPENSSL_COEXIST + +typedef WOLFSSL_MD4_CTX MD4_CTX; + +#define MD4_Init wolfSSL_MD4_Init +#define MD4_Update wolfSSL_MD4_Update +#define MD4_Final wolfSSL_MD4_Final + +#endif /* !OPENSSL_COEXIST */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* NO_MD4 */ + +#endif /* WOLFSSL_MD4_H_ */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/md5.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/md5.h @@ -0,0 +1,108 @@ +/* md5.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* md5.h for openssl */ + + +#ifndef WOLFSSL_MD5_H_ +#define WOLFSSL_MD5_H_ + +#include <wolfssl/wolfcrypt/settings.h> + +#ifndef NO_MD5 + +#include <wolfssl/wolfcrypt/hash.h> + +#ifdef WOLFSSL_PREFIX +#include "prefix_md5.h" +#endif + +#ifdef __cplusplus + extern "C" { +#endif + + +typedef struct WOLFSSL_MD5_CTX { + /* big enough to hold wolfcrypt md5, but check on init */ +#ifdef STM32_HASH + void* holder[(112 + WC_ASYNC_DEV_SIZE + sizeof(STM32_HASH_Context)) / sizeof(void*)]; +#else + void* holder[(112 + WC_ASYNC_DEV_SIZE) / sizeof(void*)]; +#endif +} WOLFSSL_MD5_CTX; + +WOLFSSL_API int wolfSSL_MD5_Init(WOLFSSL_MD5_CTX* md5); +WOLFSSL_API int wolfSSL_MD5_Update(WOLFSSL_MD5_CTX* md5, const void* input, + unsigned long sz); +WOLFSSL_API int wolfSSL_MD5_Final(unsigned char* output, WOLFSSL_MD5_CTX* md5); +WOLFSSL_API int wolfSSL_MD5_Transform(WOLFSSL_MD5_CTX* md5, const unsigned char* data); + +WOLFSSL_API unsigned char *wolfSSL_MD5(const unsigned char* data, size_t len, + unsigned char* hash); + +#ifndef OPENSSL_COEXIST + +typedef WOLFSSL_MD5_CTX MD5_CTX; + +#define MD5_Init wolfSSL_MD5_Init +#define MD5_Update wolfSSL_MD5_Update +#define MD5_Final wolfSSL_MD5_Final +#define MD5_Transform wolfSSL_MD5_Transform + +#ifdef OPENSSL_EXTRA_BSD + #define MD5Init wolfSSL_MD5_Init + #define MD5Update wolfSSL_MD5_Update + #define MD5Final wolfSSL_MD5_Final +#endif + +/* "MD5" has some conflicts + * If not FIPS and NO_OLD_SHA_NAMES defined + * If FIPS V2 or higher and NO_OLD_MD5_NAME defined + * If FIPS V2 and NO_OLD_WC_NAMES defined + * If FIPS v1 not allowed + */ +#if (defined(NO_OLD_MD5_NAME) && !defined(HAVE_FIPS)) || \ + (defined(NO_OLD_MD5_NAME) && defined(HAVE_FIPS) && \ + defined(HAVE_FIPS_VERSION) && HAVE_FIPS_VERSION >= 2) || \ + (defined(NO_OLD_WC_NAMES) && defined(HAVE_FIPS) && \ + defined(HAVE_FIPS_VERSION) && HAVE_FIPS_VERSION == 2) + + #define MD5 wolfSSL_MD5 +#endif + +/* FIPS v1 uses old MD5_DIGEST_SIZE naming */ +#if (!defined(HAVE_FIPS) || \ + (defined(HAVE_FIPS_VERSION) && HAVE_FIPS_VERSION >= 2)) && \ + defined(OPENSSL_EXTRA) + #define MD5_DIGEST_LENGTH WC_MD5_DIGEST_SIZE +#else + #define MD5_DIGEST_LENGTH MD5_DIGEST_SIZE +#endif + +#endif /* !OPENSSL_COEXIST */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* NO_MD5 */ + +#endif /* WOLFSSL_MD5_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/modes.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/modes.h @@ -0,0 +1,45 @@ +/* modes.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ +#ifndef WOLFSSL_OPENSSL_MODES_H +#define WOLFSSL_OPENSSL_MODES_H + +#include <wolfssl/wolfcrypt/settings.h> +#include <wolfssl/openssl/ssl.h> + +typedef void (*WOLFSSL_CBC128_CB) (const unsigned char *in, + unsigned char *out, size_t len, const void *key, + unsigned char *iv, int enc); + +WOLFSSL_API size_t wolfSSL_CRYPTO_cts128_encrypt(const unsigned char *in, + unsigned char *out, size_t len, const void *key, + unsigned char *iv, WOLFSSL_CBC128_CB cbc); +WOLFSSL_API size_t wolfSSL_CRYPTO_cts128_decrypt(const unsigned char *in, + unsigned char *out, size_t len, const void *key, + unsigned char *iv, WOLFSSL_CBC128_CB cbc); + +#define WOLFSSL_CTS128_BLOCK_SZ 16 + +/* Compatibility layer defines */ +#define CRYPTO_cts128_encrypt wolfSSL_CRYPTO_cts128_encrypt +#define CRYPTO_cts128_decrypt wolfSSL_CRYPTO_cts128_decrypt +#define cbc128_f WOLFSSL_CBC128_CB + +#endif /* WOLFSSL_OPENSSL_MODES_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/obj_mac.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/obj_mac.h @@ -0,0 +1,92 @@ +/* obj_mac.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* obj_mac.h for openSSL */ + +#ifndef WOLFSSL_OBJ_MAC_H_ +#define WOLFSSL_OBJ_MAC_H_ +#ifdef __cplusplus + extern "C" { +#endif + +#define WC_NID_sect163k1 721 +#define WC_NID_sect163r1 722 +#define WC_NID_sect163r2 723 +#define WC_NID_sect193r1 724 +#define WC_NID_sect193r2 725 +#define WC_NID_sect233k1 726 +#define WC_NID_sect233r1 727 +#define WC_NID_sect239k1 728 +#define WC_NID_sect283k1 729 +#define WC_NID_sect283r1 730 +#define WC_NID_sect409k1 731 +#define WC_NID_sect409r1 732 +#define WC_NID_sect571k1 733 +#define WC_NID_sect571r1 734 + +#ifndef OPENSSL_COEXIST + +#define NID_sect163k1 WC_NID_sect163k1 +#define NID_sect163r1 WC_NID_sect163r1 +#define NID_sect163r2 WC_NID_sect163r2 +#define NID_sect193r1 WC_NID_sect193r1 +#define NID_sect193r2 WC_NID_sect193r2 +#define NID_sect233k1 WC_NID_sect233k1 +#define NID_sect233r1 WC_NID_sect233r1 +#define NID_sect239k1 WC_NID_sect239k1 +#define NID_sect283k1 WC_NID_sect283k1 +#define NID_sect283r1 WC_NID_sect283r1 +#define NID_sect409k1 WC_NID_sect409k1 +#define NID_sect409r1 WC_NID_sect409r1 +#define NID_sect571k1 WC_NID_sect571k1 +#define NID_sect571r1 WC_NID_sect571r1 + +/* mapping of short names */ +#define SN_md4 WC_SN_md4 +#define SN_md5 WC_SN_md5 +#define SN_sha1 WC_SN_sha1 +#define SN_sha224 WC_SN_sha224 +#define SN_sha256 WC_SN_sha256 +#define SN_sha384 WC_SN_sha384 +#define SN_sha512 WC_SN_sha512 +#define SN_sha512_224 WC_SN_sha512_224 +#define SN_sha512_256 WC_SN_sha512_256 +#define SN_sha3_224 WC_SN_sha3_224 +#define SN_sha3_256 WC_SN_sha3_256 +#define SN_sha3_384 WC_SN_sha3_384 +#define SN_sha3_512 WC_SN_sha3_512 +#define SN_shake128 WC_SN_shake128 +#define SN_shake256 WC_SN_shake256 +#define SN_blake2s256 WC_SN_blake2s256 +#define SN_blake2s512 WC_SN_blake2s512 +#define SN_blake2b512 WC_SN_blake2b512 +#define SN_sm3 WC_SN_sm3 + +#endif /* !OPENSSL_COEXIST */ + +/* the definition is for Qt Unit test */ +#define SN_jurisdictionCountryName "jurisdictionC" +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_OBJ_MAC_H_ */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/objects.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/objects.h @@ -0,0 +1,86 @@ +/* objects.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + +#ifndef WOLFSSL_OBJECTS_H_ +#define WOLFSSL_OBJECTS_H_ + +#include <wolfssl/wolfcrypt/types.h> +#ifndef OPENSSL_EXTRA_SSL_GUARD +#define OPENSSL_EXTRA_SSL_GUARD +#include <wolfssl/ssl.h> +#endif /* OPENSSL_EXTRA_SSL_GUARD */ + +#include <wolfssl/openssl/obj_mac.h> + +#ifdef __cplusplus + extern "C" { +#endif + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + +#define WC_NID_ad_OCSP 178 +#define WC_NID_ad_ca_issuers 179 + +#ifndef OPENSSL_COEXIST + +#define OBJ_NAME_TYPE_UNDEF WOLFSSL_OBJ_NAME_TYPE_UNDEF +#define OBJ_NAME_TYPE_MD_METH WOLFSSL_OBJ_NAME_TYPE_MD_METH +#define OBJ_NAME_TYPE_CIPHER_METH WOLFSSL_OBJ_NAME_TYPE_CIPHER_METH +#define OBJ_NAME_TYPE_PKEY_METH WOLFSSL_OBJ_NAME_TYPE_PKEY_METH +#define OBJ_NAME_TYPE_COMP_METH WOLFSSL_OBJ_NAME_TYPE_COMP_METH +#define OBJ_NAME_TYPE_NUM WOLFSSL_OBJ_NAME_TYPE_NUM +#define OBJ_NAME_ALIAS WOLFSSL_OBJ_NAME_ALIAS + +#define OBJ_nid2sn wolfSSL_OBJ_nid2sn +#define OBJ_obj2nid wolfSSL_OBJ_obj2nid +#define OBJ_sn2nid wolfSSL_OBJ_sn2nid +#define OBJ_length wolfSSL_OBJ_length +#define OBJ_get0_data wolfSSL_OBJ_get0_data +#define OBJ_nid2ln wolfSSL_OBJ_nid2ln +#define OBJ_ln2nid wolfSSL_OBJ_ln2nid +#define OBJ_txt2nid wolfSSL_OBJ_txt2nid +#define OBJ_txt2obj wolfSSL_OBJ_txt2obj +#define OBJ_nid2obj wolfSSL_OBJ_nid2obj +#define OBJ_obj2txt wolfSSL_OBJ_obj2txt +#define OBJ_cleanup wolfSSL_OBJ_cleanup +#define OBJ_cmp wolfSSL_OBJ_cmp +#define OBJ_create wolfSSL_OBJ_create +#define ASN1_OBJECT_free wolfSSL_ASN1_OBJECT_free +#define OBJ_NAME_do_all wolfSSL_OBJ_NAME_do_all +#define i2t_ASN1_OBJECT wolfSSL_i2t_ASN1_OBJECT + +/* not required for wolfSSL */ +#define OPENSSL_load_builtin_modules() WC_DO_NOTHING + +#define NID_ad_OCSP WC_NID_ad_OCSP +#define NID_ad_ca_issuers WC_NID_ad_ca_issuers + +#endif /* !OPENSSL_COEXIST */ + +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_OBJECTS_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ocsp.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ocsp.h @@ -0,0 +1,108 @@ +/* ocsp.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* ocsp.h for libcurl */ + +#ifndef WOLFSSL_OCSP_H_ +#define WOLFSSL_OCSP_H_ + +#ifdef HAVE_OCSP +#include <wolfssl/ocsp.h> + +#ifndef OPENSSL_COEXIST + +#if defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA) || defined(WOLFSSL_NGINX) ||\ + defined(WOLFSSL_HAPROXY) || defined(HAVE_LIGHTY) +typedef OcspRequest OCSP_REQUEST; +typedef OcspResponse OCSP_RESPONSE; +typedef WOLFSSL_OCSP_BASICRESP OCSP_BASICRESP; +typedef WOLFSSL_OCSP_SINGLERESP OCSP_SINGLERESP; +typedef WOLFSSL_OCSP_CERTID OCSP_CERTID; +typedef WOLFSSL_OCSP_ONEREQ OCSP_ONEREQ; +typedef WOLFSSL_OCSP_REQ_CTX OCSP_REQ_CTX; +#endif + +#define OCSP_REVOKED_STATUS_NOSTATUS (-1) + + +#define OCSP_RESPONSE_STATUS_SUCCESSFUL 0 +#define OCSP_RESPONSE_STATUS_TRYLATER 3 + +#define V_OCSP_CERTSTATUS_GOOD 0 +#define V_OCSP_CERTSTATUS_REVOKED 1 +#define V_OCSP_CERTSTATUS_UNKNOWN 2 + +#define OCSP_resp_find_status wolfSSL_OCSP_resp_find_status +#define OCSP_cert_status_str wolfSSL_OCSP_cert_status_str +#define OCSP_check_validity wolfSSL_OCSP_check_validity + +#define OCSP_CERTID_free wolfSSL_OCSP_CERTID_free +#define OCSP_cert_to_id wolfSSL_OCSP_cert_to_id + +#define OCSP_BASICRESP_free wolfSSL_OCSP_BASICRESP_free +#define OCSP_basic_verify wolfSSL_OCSP_basic_verify + +#define OCSP_RESPONSE_free wolfSSL_OCSP_RESPONSE_free +#define d2i_OCSP_RESPONSE_bio wolfSSL_d2i_OCSP_RESPONSE_bio +#define d2i_OCSP_RESPONSE wolfSSL_d2i_OCSP_RESPONSE +#define i2d_OCSP_RESPONSE wolfSSL_i2d_OCSP_RESPONSE +#define OCSP_response_status wolfSSL_OCSP_response_status +#define OCSP_response_status_str wolfSSL_OCSP_response_status_str +#define OCSP_response_get1_basic wolfSSL_OCSP_response_get1_basic +#define OCSP_response_create wolfSSL_OCSP_response_create + +#define OCSP_REQUEST_new wolfSSL_OCSP_REQUEST_new +#define OCSP_REQUEST_free wolfSSL_OCSP_REQUEST_free +#define i2d_OCSP_REQUEST wolfSSL_i2d_OCSP_REQUEST +#define OCSP_request_add0_id wolfSSL_OCSP_request_add0_id +#define OCSP_request_add1_nonce wolfSSL_OCSP_request_add1_nonce +#define OCSP_check_nonce wolfSSL_OCSP_check_nonce +#define OCSP_id_get0_info wolfSSL_OCSP_id_get0_info +#define OCSP_crl_reason_str wolfSSL_OCSP_crl_reason_str +#define OCSP_REQUEST_add_ext wolfSSL_OCSP_REQUEST_add_ext + +#define OCSP_CERTID_dup wolfSSL_OCSP_CERTID_dup + +#define i2d_OCSP_REQUEST_bio wolfSSL_i2d_OCSP_REQUEST_bio + +#define i2d_OCSP_CERTID wolfSSL_i2d_OCSP_CERTID +#define d2i_OCSP_CERTID wolfSSL_d2i_OCSP_CERTID +#define OCSP_SINGLERESP_get0_id wolfSSL_OCSP_SINGLERESP_get0_id +#define OCSP_id_cmp wolfSSL_OCSP_id_cmp +#define OCSP_single_get0_status wolfSSL_OCSP_single_get0_status +#define OCSP_resp_count wolfSSL_OCSP_resp_count +#define OCSP_resp_get0 wolfSSL_OCSP_resp_get0 + +#define OCSP_REQ_CTX_new wolfSSL_OCSP_REQ_CTX_new +#define OCSP_REQ_CTX_free wolfSSL_OCSP_REQ_CTX_free +#define OCSP_sendreq_new wolfSSL_OCSP_sendreq_new +#define OCSP_REQ_CTX_set1_req wolfSSL_OCSP_REQ_CTX_set1_req +#define OCSP_REQ_CTX_add1_header wolfSSL_OCSP_REQ_CTX_add1_header +#define OCSP_REQ_CTX_http wolfSSL_OCSP_REQ_CTX_http +#define OCSP_REQ_CTX_nbio wolfSSL_OCSP_REQ_CTX_nbio +#define OCSP_sendreq_nbio wolfSSL_OCSP_sendreq_nbio + +#endif /* !OPENSSL_COEXIST */ + +#endif /* HAVE_OCSP */ + +#endif /* WOLFSSL_OCSP_H_ */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/opensslconf.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/opensslconf.h @@ -0,0 +1,8 @@ +/* opensslconf.h for openSSL */ + + +#ifndef OPENSSL_THREADS + #define OPENSSL_THREADS +#endif + + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/opensslv.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/opensslv.h @@ -0,0 +1,76 @@ +/* opensslv.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* opensslv.h compatibility */ + +#ifndef WOLFSSL_OPENSSLV_H_ +#define WOLFSSL_OPENSSLV_H_ + +#include <wolfssl/wolfcrypt/settings.h> +#include <wolfssl/version.h> + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + +/* api version compatibility */ +#if defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER == 0x009070dfL) ||\ + defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER == 0x0090810fL) ||\ + defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER == 0x10100000L) ||\ + defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER == 0x10001040L) + /* valid version */ +#elif defined(OPENSSL_VERSION_NUMBER) + /* unrecognized version, but continue. */ + #define WOLFSSL_OPENSSL_VERSION_NUMBER_UNRECOGNIZED +#elif defined(HAVE_MOSQUITTO) + #define OPENSSL_VERSION_NUMBER 0x10100000L +#elif defined(WOLFSSL_APACHE_HTTPD) || defined(HAVE_LIBEST) || \ + defined(WOLFSSL_BIND) || defined(WOLFSSL_NGINX) || \ + defined(WOLFSSL_RSYSLOG) || defined(WOLFSSL_KRB) || defined(HAVE_STUNNEL) || \ + defined(WOLFSSL_OPENSSH) + /* For Apache httpd, Use 1.1.0 compatibility */ + #define OPENSSL_VERSION_NUMBER 0x10100003L +#elif defined(WOLFSSL_QT) || defined(WOLFSSL_PYTHON) + /* For Qt and Python 3.8.5 compatibility */ + #define OPENSSL_VERSION_NUMBER 0x10101000L +#elif defined(WOLFSSL_HAPROXY) || defined(WOLFSSL_FFMPEG) + #define OPENSSL_VERSION_NUMBER 0x1010000fL +#elif defined(OPENSSL_ALL) || defined(HAVE_LIGHTY) || \ + defined(WOLFSSL_NGINX) || defined(WOLFSSL_OPENSSH) || defined(WOLFSSL_OPENVPN) + /* version number can be increased for Lighty after compatibility for ECDH + is added */ + #define OPENSSL_VERSION_NUMBER 0x10001040L +#else + #define OPENSSL_VERSION_NUMBER 0x0090810fL +#endif + +#ifndef OPENSSL_VERSION_TEXT + #define OPENSSL_VERSION_TEXT "wolfSSL " LIBWOLFSSL_VERSION_STRING +#endif +#ifndef OPENSSL_VERSION + #define OPENSSL_VERSION 0 +#endif + +#ifndef OPENSSL_IS_WOLFSSL + #define OPENSSL_IS_WOLFSSL +#endif + +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + +#endif /* header */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ossl_typ.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ossl_typ.h @@ -0,0 +1,32 @@ +/* ossl_typ.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/openssl/ossl_typ.h +*/ + + +#ifndef WOLFSSL_OSSL_TYP_H_ +#define WOLFSSL_OSSL_TYP_H_ + +#include <wolfssl/openssl/ssl.h> + +#endif /* !WOLFSSL_OSSL_TYP_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/pem.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/pem.h @@ -0,0 +1,301 @@ +/* pem.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* pem.h for openssl */ + +/*! + \file wolfssl/openssl/pem.h +*/ + + +#ifndef WOLFSSL_PEM_H_ +#define WOLFSSL_PEM_H_ + +#include <wolfssl/openssl/evp.h> +#include <wolfssl/openssl/bio.h> +#include <wolfssl/openssl/rsa.h> +#include <wolfssl/openssl/dsa.h> +#include <wolfssl/ssl.h> + +#ifdef __cplusplus + extern "C" { +#endif + +/* RSA */ +WOLFSSL_API +int wolfSSL_PEM_write_bio_RSAPrivateKey(WOLFSSL_BIO* bio, WOLFSSL_RSA* rsa, + const WOLFSSL_EVP_CIPHER* cipher, + unsigned char* passwd, int len, + wc_pem_password_cb* cb, void* arg); +WOLFSSL_API +WOLFSSL_RSA* wolfSSL_PEM_read_bio_RSAPrivateKey(WOLFSSL_BIO* bio, + WOLFSSL_RSA** rsa, wc_pem_password_cb* cb, void* pass); + +WOLFSSL_API +int wolfSSL_PEM_write_bio_RSA_PUBKEY(WOLFSSL_BIO* bio, WOLFSSL_RSA* rsa); + +WOLFSSL_API +WOLFSSL_RSA *wolfSSL_PEM_read_bio_RSA_PUBKEY(WOLFSSL_BIO* bio, + WOLFSSL_RSA** rsa, + wc_pem_password_cb* cb, void *u); +WOLFSSL_API +WOLFSSL_RSA *wolfSSL_d2i_RSA_PUBKEY_bio(WOLFSSL_BIO *bio, WOLFSSL_RSA **out); + +WOLFSSL_API +WOLFSSL_EC_GROUP* wolfSSL_PEM_read_bio_ECPKParameters(WOLFSSL_BIO* bio, + WOLFSSL_EC_GROUP** group, + wc_pem_password_cb* cb, + void* pass); +WOLFSSL_API +WOLFSSL_EC_GROUP *wolfSSL_d2i_ECPKParameters(WOLFSSL_EC_GROUP **out, + const unsigned char **in, + long len); +WOLFSSL_API +int wolfSSL_i2d_ECPKParameters(const WOLFSSL_EC_GROUP* grp, unsigned char** pp); +WOLFSSL_API +int wolfSSL_PEM_write_mem_RSAPrivateKey(WOLFSSL_RSA* rsa, + const WOLFSSL_EVP_CIPHER* cipher, + unsigned char* passwd, int len, + unsigned char **pem, int *plen); +#if !defined(NO_FILESYSTEM) +WOLFSSL_API +int wolfSSL_PEM_write_RSAPrivateKey(XFILE fp, WOLFSSL_RSA *rsa, + const WOLFSSL_EVP_CIPHER *enc, + unsigned char *kstr, int klen, + wc_pem_password_cb *cb, void *u); + +WOLFSSL_API +WOLFSSL_RSA* wolfSSL_PEM_read_RSAPrivateKey(XFILE fp, WOLFSSL_RSA** rsa, + wc_pem_password_cb* cb, void* pass); + +WOLFSSL_API +WOLFSSL_RSA *wolfSSL_PEM_read_RSAPublicKey(XFILE fp, WOLFSSL_RSA **x, + wc_pem_password_cb *cb, void *u); +WOLFSSL_API +int wolfSSL_PEM_write_RSAPublicKey(XFILE fp, WOLFSSL_RSA* key); + +WOLFSSL_API +int wolfSSL_PEM_write_RSA_PUBKEY(XFILE fp, WOLFSSL_RSA *x); + +WOLFSSL_API +WOLFSSL_RSA *wolfSSL_PEM_read_RSA_PUBKEY(XFILE fp, WOLFSSL_RSA** rsa, + wc_pem_password_cb* cb, void *pass); +#endif /* NO_FILESYSTEM */ + +/* DSA */ +WOLFSSL_API +int wolfSSL_PEM_write_bio_DSAPrivateKey(WOLFSSL_BIO* bio, + WOLFSSL_DSA* dsa, + const WOLFSSL_EVP_CIPHER* cipher, + unsigned char* passwd, int len, + wc_pem_password_cb* cb, void* arg); + +WOLFSSL_API +WOLFSSL_DSA* wolfSSL_PEM_read_bio_DSAPrivateKey(WOLFSSL_BIO* bio, + WOLFSSL_DSA** dsa, + wc_pem_password_cb* cb, + void *pass); + +WOLFSSL_API +WOLFSSL_DSA *wolfSSL_PEM_read_bio_DSA_PUBKEY(WOLFSSL_BIO* bio, + WOLFSSL_DSA** dsa, + wc_pem_password_cb* cb, + void *pass); + +WOLFSSL_API +int wolfSSL_PEM_write_bio_DSA_PUBKEY(WOLFSSL_BIO* bio, WOLFSSL_DSA* dsa); + +WOLFSSL_API +int wolfSSL_PEM_write_mem_DSAPrivateKey(WOLFSSL_DSA* dsa, + const WOLFSSL_EVP_CIPHER* cipher, + unsigned char* passwd, int len, + unsigned char **pem, int *plen); +#if !defined(NO_FILESYSTEM) +WOLFSSL_API +int wolfSSL_PEM_write_DSAPrivateKey(XFILE fp, WOLFSSL_DSA *dsa, + const WOLFSSL_EVP_CIPHER *enc, + unsigned char *kstr, int klen, + wc_pem_password_cb *cb, void *u); +WOLFSSL_API +int wolfSSL_PEM_write_DSA_PUBKEY(XFILE fp, WOLFSSL_DSA *x); +#endif /* NO_FILESYSTEM */ + +/* ECC */ +WOLFSSL_API +int wolfSSL_PEM_write_bio_ECPrivateKey(WOLFSSL_BIO* bio, WOLFSSL_EC_KEY* ec, + const WOLFSSL_EVP_CIPHER* cipher, + unsigned char* passwd, int len, + wc_pem_password_cb* cb, void* arg); +WOLFSSL_API +WOLFSSL_EC_KEY* wolfSSL_PEM_read_bio_ECPrivateKey(WOLFSSL_BIO* bio, + WOLFSSL_EC_KEY** ec, + wc_pem_password_cb* cb, + void *pass); +WOLFSSL_API +int wolfSSL_PEM_write_bio_EC_PUBKEY(WOLFSSL_BIO* bio, WOLFSSL_EC_KEY* ec); + +WOLFSSL_API +int wolfSSL_PEM_write_mem_ECPrivateKey(WOLFSSL_EC_KEY* key, + const WOLFSSL_EVP_CIPHER* cipher, + unsigned char* passwd, int len, + unsigned char **pem, int *plen); +#if !defined(NO_FILESYSTEM) +WOLFSSL_API +int wolfSSL_PEM_write_ECPrivateKey(XFILE fp, WOLFSSL_EC_KEY *key, + const WOLFSSL_EVP_CIPHER *enc, + unsigned char *kstr, int klen, + wc_pem_password_cb *cb, void *u); +WOLFSSL_API +int wolfSSL_PEM_write_EC_PUBKEY(XFILE fp, WOLFSSL_EC_KEY* key); +#endif + +#ifndef NO_BIO +WOLFSSL_API +WOLFSSL_EC_KEY* wolfSSL_PEM_read_bio_EC_PUBKEY(WOLFSSL_BIO* bio, + WOLFSSL_EC_KEY** ec, + wc_pem_password_cb* cb, + void *pass); +#endif /* !NO_BIO */ + +/* EVP_KEY */ +WOLFSSL_API +WOLFSSL_EVP_PKEY* wolfSSL_PEM_read_bio_PrivateKey(WOLFSSL_BIO* bio, + WOLFSSL_EVP_PKEY** key, + wc_pem_password_cb* cb, + void* pass); +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) +WOLFSSL_API +WOLFSSL_PKCS8_PRIV_KEY_INFO* wolfSSL_PEM_read_bio_PKCS8_PRIV_KEY_INFO(WOLFSSL_BIO* bio, + WOLFSSL_PKCS8_PRIV_KEY_INFO** key, wc_pem_password_cb* cb, void* arg); +#endif +WOLFSSL_API +WOLFSSL_EVP_PKEY *wolfSSL_PEM_read_bio_PUBKEY(WOLFSSL_BIO* bio, + WOLFSSL_EVP_PKEY **key, + wc_pem_password_cb *cb, + void *pass); +WOLFSSL_API +int wolfSSL_PEM_write_bio_PrivateKey(WOLFSSL_BIO* bio, WOLFSSL_EVP_PKEY* key, + const WOLFSSL_EVP_CIPHER* cipher, + unsigned char* passwd, int len, + wc_pem_password_cb* cb, void* arg); +WOLFSSL_API +int wolfSSL_PEM_write_bio_PUBKEY(WOLFSSL_BIO* bio, WOLFSSL_EVP_PKEY* key); + + +WOLFSSL_API +int wolfSSL_PEM_read_bio(WOLFSSL_BIO* bio, char **name, char **header, + unsigned char **data, long *len); +WOLFSSL_API +int wolfSSL_PEM_write_bio(WOLFSSL_BIO *bio, const char *name, + const char *header, const unsigned char *data, + long len); +#if !defined(NO_FILESYSTEM) +WOLFSSL_API +int wolfSSL_PEM_read(XFILE fp, char **name, char **header, unsigned char **data, + long *len); +WOLFSSL_API +int wolfSSL_PEM_write(XFILE fp, const char *name, const char *header, + const unsigned char *data, long len); +#endif + +#if !defined(NO_FILESYSTEM) +WOLFSSL_API +WOLFSSL_EVP_PKEY *wolfSSL_PEM_read_PUBKEY(XFILE fp, WOLFSSL_EVP_PKEY **x, + wc_pem_password_cb *cb, void *u); +WOLFSSL_API +WOLFSSL_X509 *wolfSSL_PEM_read_X509(XFILE fp, WOLFSSL_X509 **x, + wc_pem_password_cb *cb, void *u); +WOLFSSL_API +WOLFSSL_EVP_PKEY *wolfSSL_PEM_read_PrivateKey(XFILE fp, WOLFSSL_EVP_PKEY **x, + wc_pem_password_cb *cb, void *u); + +WOLFSSL_API +int wolfSSL_PEM_write_X509(XFILE fp, WOLFSSL_X509 *x); +WOLFSSL_API +int wolfSSL_PEM_write_DHparams(XFILE fp, WOLFSSL_DH* dh); +#endif /* NO_FILESYSTEM */ + +#ifndef OPENSSL_COEXIST + +#define PEM_BUFSIZE WOLF_PEM_BUFSIZE + +#define PEM_read wolfSSL_PEM_read +#define PEM_read_bio wolfSSL_PEM_read_bio +#define PEM_write wolfSSL_PEM_write +#define PEM_write_bio wolfSSL_PEM_write_bio + +#define PEM_read_X509 wolfSSL_PEM_read_X509 +#define PEM_read_PrivateKey wolfSSL_PEM_read_PrivateKey +#define PEM_write_X509 wolfSSL_PEM_write_X509 +#define PEM_write_bio_PrivateKey wolfSSL_PEM_write_bio_PrivateKey +#define PEM_write_bio_PKCS8PrivateKey wolfSSL_PEM_write_bio_PKCS8PrivateKey +#define PEM_write_PKCS8PrivateKey wolfSSL_PEM_write_PKCS8PrivateKey + +/* DH */ +#define PEM_write_DHparams wolfSSL_PEM_write_DHparams +/* RSA */ +#define PEM_write_bio_RSAPrivateKey wolfSSL_PEM_write_bio_RSAPrivateKey +#define PEM_read_bio_RSAPrivateKey wolfSSL_PEM_read_bio_RSAPrivateKey +#define PEM_read_RSAPrivateKey wolfSSL_PEM_read_RSAPrivateKey +#define PEM_write_bio_RSA_PUBKEY wolfSSL_PEM_write_bio_RSA_PUBKEY +#define PEM_read_bio_RSA_PUBKEY wolfSSL_PEM_read_bio_RSA_PUBKEY +#define PEM_read_bio_RSAPublicKey wolfSSL_PEM_read_bio_RSA_PUBKEY +#define PEM_write_RSAPrivateKey wolfSSL_PEM_write_RSAPrivateKey +#define PEM_write_RSA_PUBKEY wolfSSL_PEM_write_RSA_PUBKEY +#define PEM_read_RSA_PUBKEY wolfSSL_PEM_read_RSA_PUBKEY +#define PEM_write_RSAPublicKey wolfSSL_PEM_write_RSAPublicKey +#define PEM_read_RSAPublicKey wolfSSL_PEM_read_RSAPublicKey +#define d2i_RSA_PUBKEY_bio wolfSSL_d2i_RSA_PUBKEY_bio +/* DSA */ +#define PEM_write_bio_DSAPrivateKey wolfSSL_PEM_write_bio_DSAPrivateKey +#define PEM_write_DSAPrivateKey wolfSSL_PEM_write_DSAPrivateKey +#define PEM_write_bio_DSA_PUBKEY wolfSSL_PEM_write_bio_DSA_PUBKEY +#define PEM_write_DSA_PUBKEY wolfSSL_PEM_write_DSA_PUBKEY +#define PEM_read_bio_DSAPrivateKey wolfSSL_PEM_read_bio_DSAPrivateKey +#define PEM_read_bio_DSA_PUBKEY wolfSSL_PEM_read_bio_DSA_PUBKEY +/* ECC */ +#define PEM_write_bio_ECPrivateKey wolfSSL_PEM_write_bio_ECPrivateKey +#define PEM_write_bio_EC_PUBKEY wolfSSL_PEM_write_bio_EC_PUBKEY +#define PEM_write_EC_PUBKEY wolfSSL_PEM_write_EC_PUBKEY +#define PEM_write_ECPrivateKey wolfSSL_PEM_write_ECPrivateKey +#define PEM_read_bio_ECPrivateKey wolfSSL_PEM_read_bio_ECPrivateKey +#define PEM_read_bio_EC_PUBKEY wolfSSL_PEM_read_bio_EC_PUBKEY +#define PEM_read_bio_ECPKParameters wolfSSL_PEM_read_bio_ECPKParameters +#ifndef NO_WOLFSSL_STUB +#define PEM_write_bio_ECPKParameters(out, x) 0 +#endif +/* EVP_KEY */ +#define PEM_read_bio_PrivateKey wolfSSL_PEM_read_bio_PrivateKey +#define PEM_read_PUBKEY wolfSSL_PEM_read_PUBKEY +#define PEM_read_bio_PUBKEY wolfSSL_PEM_read_bio_PUBKEY +#define PEM_write_bio_PUBKEY wolfSSL_PEM_write_bio_PUBKEY + +#define PEM_write_bio_PKCS8_PRIV_KEY_INFO wolfSSL_PEM_write_bio_PKCS8_PRIV_KEY_INFO +#define PEM_read_bio_PKCS8_PRIV_KEY_INFO wolfSSL_PEM_read_bio_PKCS8_PRIV_KEY_INFO + +#endif /* !OPENSSL_COEXIST */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_PEM_H_ */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/pkcs12.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/pkcs12.h @@ -0,0 +1,57 @@ +/* pkcs12.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* pkcs12.h for openssl */ + + +#include <wolfssl/openssl/ssl.h> +#include <wolfssl/wolfcrypt/pkcs12.h> + +#ifndef WOLFSSL_PKCS12_COMPAT_H_ +#define WOLFSSL_PKCS12_COMPAT_H_ + +#define WC_NID_pbe_WithSHA1AndDES_CBC 2 +#define WC_NID_pbe_WithSHA1And3_Key_TripleDES_CBC 3 +#define WC_NID_pbe_WithSHA1And128BitRC4 1 + +#ifndef OPENSSL_COEXIST + +#define NID_pbe_WithSHA1AndDES_CBC WC_NID_pbe_WithSHA1AndDES_CBC +#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC WC_NID_pbe_WithSHA1And3_Key_TripleDES_CBC +#define NID_pbe_WithSHA1And128BitRC4 WC_NID_pbe_WithSHA1And128BitRC4 + +#define PKCS12_DEFAULT_ITER WC_PKCS12_ITT_DEFAULT + +/* wolfCrypt level does not make use of ssl.h */ +#define PKCS12 WC_PKCS12 +#define PKCS12_new wc_PKCS12_new +#define PKCS12_free wc_PKCS12_free + +/* wolfSSL level using structs from ssl.h and calls down to wolfCrypt */ +#define d2i_PKCS12_bio wolfSSL_d2i_PKCS12_bio +#define PKCS12_parse wolfSSL_PKCS12_parse +#define PKCS12_verify_mac wolfSSL_PKCS12_verify_mac +#define PKCS12_create wolfSSL_PKCS12_create +#define PKCS12_PBE_add wolfSSL_PKCS12_PBE_add + +#endif /* !OPENSSL_COEXIST */ + +#endif /* WOLFSSL_PKCS12_COMPAT_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/pkcs7.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/pkcs7.h @@ -0,0 +1,110 @@ +/* pkcs7.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* pkcs7.h for openSSL */ + + +#ifndef WOLFSSL_PKCS7_H_ +#define WOLFSSL_PKCS7_H_ + +#include <wolfssl/openssl/ssl.h> +#include <wolfssl/wolfcrypt/pkcs7.h> + +#ifdef __cplusplus + extern "C" { +#endif + +#if defined(OPENSSL_ALL) && defined(HAVE_PKCS7) + +#define PKCS7_TEXT 0x1 +#define PKCS7_NOCERTS 0x2 +#define PKCS7_DETACHED 0x40 +#define PKCS7_BINARY 0x80 +#define PKCS7_NOINTERN 0x0010 +#define PKCS7_NOVERIFY 0x0020 +#define PKCS7_STREAM 0x1000 +#define PKCS7_PARTIAL 0x4000 + +typedef struct WOLFSSL_PKCS7 +{ + PKCS7 pkcs7; + unsigned char* data; + int len; + int type; /* from PKCS7_TYPES, for PKCS7_final() */ + WOLFSSL_STACK* certs; +} WOLFSSL_PKCS7; + + +WOLFSSL_API PKCS7* wolfSSL_PKCS7_new(void); +WOLFSSL_API PKCS7_SIGNED* wolfSSL_PKCS7_SIGNED_new(void); +WOLFSSL_API void wolfSSL_PKCS7_free(PKCS7* p7); +WOLFSSL_API void wolfSSL_PKCS7_SIGNED_free(PKCS7_SIGNED* p7); +WOLFSSL_API PKCS7* wolfSSL_d2i_PKCS7(PKCS7** p7, const unsigned char** in, + int len); +WOLFSSL_LOCAL PKCS7* wolfSSL_d2i_PKCS7_ex(PKCS7** p7, const unsigned char** in, + int len, byte* content, word32 contentSz); +WOLFSSL_API PKCS7* wolfSSL_d2i_PKCS7_bio(WOLFSSL_BIO* bio, PKCS7** p7); +WOLFSSL_API int wolfSSL_i2d_PKCS7_bio(WOLFSSL_BIO *bio, PKCS7 *p7); +WOLFSSL_API int wolfSSL_i2d_PKCS7(PKCS7 *p7, unsigned char **out); +WOLFSSL_API PKCS7* wolfSSL_PKCS7_sign(WOLFSSL_X509* signer, + WOLFSSL_EVP_PKEY* pkey, WOLFSSL_STACK* certs, WOLFSSL_BIO* in, int flags); +WOLFSSL_API int wolfSSL_PKCS7_verify(PKCS7* p7, WOLFSSL_STACK* certs, + WOLFSSL_X509_STORE* store, WOLFSSL_BIO* in, WOLFSSL_BIO* out, int flags); +WOLFSSL_API int wolfSSL_PKCS7_final(PKCS7* pkcs7, WOLFSSL_BIO* in, int flags); +WOLFSSL_API int wolfSSL_PKCS7_encode_certs(PKCS7* p7, WOLFSSL_STACK* certs, + WOLFSSL_BIO* out); +WOLFSSL_API WOLFSSL_STACK* wolfSSL_PKCS7_to_stack(PKCS7* pkcs7); +WOLFSSL_API WOLFSSL_STACK* wolfSSL_PKCS7_get0_signers(PKCS7* p7, + WOLFSSL_STACK* certs, int flags); +WOLFSSL_API int wolfSSL_PEM_write_bio_PKCS7(WOLFSSL_BIO* bio, PKCS7* p7); +#if defined(HAVE_SMIME) +WOLFSSL_API PKCS7* wolfSSL_SMIME_read_PKCS7(WOLFSSL_BIO* in, WOLFSSL_BIO** bcont); +WOLFSSL_API int wolfSSL_SMIME_write_PKCS7(WOLFSSL_BIO* out, PKCS7* pkcs7, + WOLFSSL_BIO* in, int flags); +#endif /* HAVE_SMIME */ + + +#define PKCS7_new wolfSSL_PKCS7_new +#define PKCS7_SIGNED_new wolfSSL_PKCS7_SIGNED_new +#define PKCS7_free wolfSSL_PKCS7_free +#define PKCS7_SIGNED_free wolfSSL_PKCS7_SIGNED_free +#define d2i_PKCS7 wolfSSL_d2i_PKCS7 +#define d2i_PKCS7_bio wolfSSL_d2i_PKCS7_bio +#define i2d_PKCS7_bio wolfSSL_i2d_PKCS7_bio +#define i2d_PKCS7 wolfSSL_i2d_PKCS7 +#define PKCS7_sign wolfSSL_PKCS7_sign +#define PKCS7_verify wolfSSL_PKCS7_verify +#define PKCS7_final wolfSSL_PKCS7_final +#define PKCS7_get0_signers wolfSSL_PKCS7_get0_signers +#define PEM_write_bio_PKCS7 wolfSSL_PEM_write_bio_PKCS7 +#if defined(HAVE_SMIME) +#define SMIME_read_PKCS7 wolfSSL_SMIME_read_PKCS7 +#define SMIME_write_PKCS7 wolfSSL_SMIME_write_PKCS7 +#endif /* HAVE_SMIME */ + +#endif /* OPENSSL_ALL && HAVE_PKCS7 */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_PKCS7_H_ */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/rand.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/rand.h @@ -0,0 +1,38 @@ +/* rand.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* rand.h for openSSL */ + +#ifndef WOLFSSL_RAND_COMPAT_H_ +#define WOLFSSL_RAND_COMPAT_H_ + +#include <wolfssl/openssl/ssl.h> +#include <wolfssl/wolfcrypt/random.h> + +#ifndef OPENSSL_COEXIST + +typedef WOLFSSL_RAND_METHOD RAND_METHOD; + +#define RAND_set_rand_method wolfSSL_RAND_set_rand_method + +#endif /* !OPENSSL_COEXIST */ + +#endif /* WOLFSSL_RAND_COMPAT_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/rc4.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/rc4.h @@ -0,0 +1,64 @@ +/* rc4.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + +/* rc4.h defines mini des openssl compatibility layer + * + */ + +#ifndef WOLFSSL_RC4_COMPAT_H_ +#define WOLFSSL_RC4_COMPAT_H_ + +#include <wolfssl/wolfcrypt/settings.h> +#include <wolfssl/openssl/ssl.h> /* included for size_t */ + +#ifdef __cplusplus + extern "C" { +#endif + +/* applications including wolfssl/openssl/rc4.h are expecting to have access to + * the size of RC4_KEY structures. */ +typedef struct WOLFSSL_RC4_KEY { + /* big enough for Arc4 from wolfssl/wolfcrypt/arc4.h */ + void* holder[(272 + WC_ASYNC_DEV_SIZE) / sizeof(void*)]; +} WOLFSSL_RC4_KEY; + +WOLFSSL_API void wolfSSL_RC4_set_key(WOLFSSL_RC4_KEY* key, int len, + const unsigned char* data); +WOLFSSL_API void wolfSSL_RC4(WOLFSSL_RC4_KEY* key, size_t len, + const unsigned char* in, unsigned char* out); + +#ifndef OPENSSL_COEXIST + +typedef WOLFSSL_RC4_KEY RC4_KEY; + +#define RC4 wolfSSL_RC4 +#define RC4_set_key wolfSSL_RC4_set_key + +#endif /* !OPENSSL_COEXIST */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_RC4_COMPAT_H_ */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ripemd.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ripemd.h @@ -0,0 +1,58 @@ +/* ripemd.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* ripemd.h for openssl */ + + +#ifndef WOLFSSL_RIPEMD_H_ +#define WOLFSSL_RIPEMD_H_ + +#include <wolfssl/wolfcrypt/settings.h> + +#ifdef __cplusplus + extern "C" { +#endif + + +typedef struct WOLFSSL_RIPEMD_CTX { + int holder[32]; /* big enough to hold wolfcrypt, but check on init */ +} WOLFSSL_RIPEMD_CTX; + +WOLFSSL_API void wolfSSL_RIPEMD_Init(WOLFSSL_RIPEMD_CTX*); +WOLFSSL_API void wolfSSL_RIPEMD_Update(WOLFSSL_RIPEMD_CTX*, const void*, + unsigned long); +WOLFSSL_API void wolfSSL_RIPEMD_Final(unsigned char*, WOLFSSL_RIPEMD_CTX*); + + +typedef WOLFSSL_RIPEMD_CTX RIPEMD_CTX; + +#define RIPEMD_Init wolfSSL_RIPEMD_Init +#define RIPEMD_Update wolfSSL_RIPEMD_Update +#define RIPEMD_Final wolfSSL_RIPEMD_Final + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + + +#endif /* WOLFSSL_MD5_H_ */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/rsa.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/rsa.h @@ -0,0 +1,291 @@ +/* rsa.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* rsa.h for openSSL */ + + +#ifndef WOLFSSL_RSA_H_ +#define WOLFSSL_RSA_H_ + +#include <wolfssl/openssl/bn.h> +#include <wolfssl/openssl/err.h> +#include <wolfssl/openssl/compat_types.h> +#include <wolfssl/wolfcrypt/types.h> +#include <wolfssl/wolfcrypt/rsa.h> + +#ifdef __cplusplus + extern "C" { +#endif + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + +/* Padding types */ +#define WC_RSA_PKCS1_PADDING 0 +#define WC_RSA_PKCS1_OAEP_PADDING 1 +#define WC_RSA_PKCS1_PSS_PADDING 2 + +/* RSA PSS Salt special cases */ +/* Salt length same as digest length */ +#define WC_RSA_PSS_SALTLEN_DIGEST (-1) +/* Old max salt length */ +#define WC_RSA_PSS_SALTLEN_MAX_SIGN (-2) +/* Verification only value to indicate to discover salt length. */ +#define WC_RSA_PSS_SALTLEN_AUTO (-2) +/* Max salt length */ +#define WC_RSA_PSS_SALTLEN_MAX (-3) + + +#ifndef OPENSSL_COEXIST + +/* Padding types */ +#define RSA_PKCS1_PADDING WC_RSA_PKCS1_PADDING +#define RSA_PKCS1_OAEP_PADDING WC_RSA_PKCS1_OAEP_PADDING +#define RSA_PKCS1_PSS_PADDING WC_RSA_PKCS1_PSS_PADDING +#define RSA_NO_PADDING WC_RSA_NO_PAD + +/* Emulate OpenSSL flags */ +#define RSA_METHOD_FLAG_NO_CHECK (1 << 1) +#define RSA_FLAG_CACHE_PUBLIC (1 << 2) +#define RSA_FLAG_CACHE_PRIVATE (1 << 3) +#define RSA_FLAG_BLINDING (1 << 4) +#define RSA_FLAG_THREAD_SAFE (1 << 5) +#define RSA_FLAG_EXT_PKEY (1 << 6) +#define RSA_FLAG_NO_BLINDING (1 << 7) +#define RSA_FLAG_NO_CONSTTIME (1 << 8) + +#define RSA_PSS_SALTLEN_DIGEST WC_RSA_PSS_SALTLEN_DIGEST +#define RSA_PSS_SALTLEN_MAX_SIGN WC_RSA_PSS_SALTLEN_MAX_SIGN +#define RSA_PSS_SALTLEN_AUTO WC_RSA_PSS_SALTLEN_AUTO +#define RSA_PSS_SALTLEN_MAX WC_RSA_PSS_SALTLEN_MAX +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + +#endif /* !OPENSSL_COEXIST */ + +typedef struct WOLFSSL_RSA_METHOD { + /* Flags of RSA key implementation. */ + int flags; + /* Name of RSA key implementation. */ + char *name; + /* RSA method dynamically allocated. */ + WC_BITFIELD dynamic:1; +} WOLFSSL_RSA_METHOD; + +#ifndef WOLFSSL_RSA_TYPE_DEFINED /* guard on redeclaration */ +#define WOLFSSL_RSA_TYPE_DEFINED +/* RSA key compatible with OpenSSL. */ +typedef struct WOLFSSL_RSA { + WOLFSSL_BIGNUM* n; /* Modulus. */ + WOLFSSL_BIGNUM* e; /* Public exponent. */ + WOLFSSL_BIGNUM* d; /* Private exponent. */ + WOLFSSL_BIGNUM* p; /* First prime. */ + WOLFSSL_BIGNUM* q; /* Second prime. */ + WOLFSSL_BIGNUM* dmp1; /* dP = d mod (p - 1) */ + WOLFSSL_BIGNUM* dmq1; /* dQ = d mod (q - 1) */ + WOLFSSL_BIGNUM* iqmp; /* u = (1 / q) mod p */ + void* heap; /* Heap used for memory allocations. */ + void* internal; /* wolfCrypt RSA key. */ +#if defined(OPENSSL_EXTRA) + const WOLFSSL_RSA_METHOD* meth; /* RSA method. */ +#endif +#ifdef HAVE_EX_DATA + WOLFSSL_CRYPTO_EX_DATA ex_data; /* external data */ +#endif + wolfSSL_Ref ref; /* Reference count information. */ + word16 pkcs8HeaderSz; /* Size of PKCS#8 header from decode. */ + int flags; /* Flags of implementation. */ + + /* bits */ + WC_BITFIELD inSet:1; /* Internal set from external. */ + WC_BITFIELD exSet:1; /* External set from internal. */ + WC_BITFIELD ownRng:1; /* Rng needs to be free'd. */ +} WOLFSSL_RSA; +#endif + +#if !defined(OPENSSL_COEXIST) && (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) +typedef WOLFSSL_RSA RSA; +typedef WOLFSSL_RSA_METHOD RSA_METHOD; +#endif /* !OPENSSL_COEXIST && (OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL) */ + +WOLFSSL_API WOLFSSL_RSA* wolfSSL_RSA_new_ex(void* heap, int devId); +WOLFSSL_API WOLFSSL_RSA* wolfSSL_RSA_new(void); +WOLFSSL_API void wolfSSL_RSA_free(WOLFSSL_RSA* rsa); + +WOLFSSL_API int wolfSSL_RSA_generate_key_ex(WOLFSSL_RSA* rsa, int bits, + WOLFSSL_BIGNUM* bn, void* cb); + +WOLFSSL_API int wolfSSL_RSA_blinding_on(WOLFSSL_RSA* rsa, WOLFSSL_BN_CTX* bn); +WOLFSSL_API int wolfSSL_RSA_check_key(const WOLFSSL_RSA* rsa); +WOLFSSL_API int wolfSSL_RSA_public_encrypt(int len, const unsigned char* fr, + unsigned char* to, WOLFSSL_RSA* rsa, + int padding); +WOLFSSL_API int wolfSSL_RSA_private_decrypt(int len, const unsigned char* fr, + unsigned char* to, WOLFSSL_RSA* rsa, + int padding); +WOLFSSL_API int wolfSSL_RSA_private_encrypt(int len, const unsigned char* in, + unsigned char* out, WOLFSSL_RSA* rsa, int padding); + +WOLFSSL_API int wolfSSL_RSA_size(const WOLFSSL_RSA* rsa); +WOLFSSL_API int wolfSSL_RSA_bits(const WOLFSSL_RSA* rsa); +WOLFSSL_API int wolfSSL_RSA_sign(int type, const unsigned char* m, + unsigned int mLen, unsigned char* sigRet, + unsigned int* sigLen, WOLFSSL_RSA* rsa); +WOLFSSL_API int wolfSSL_RSA_sign_ex(int hashAlg, + const unsigned char* hash, unsigned int hLen, + unsigned char* sigRet, unsigned int* sigLen, + WOLFSSL_RSA* rsa, int flag); +WOLFSSL_API int wolfSSL_RSA_sign_generic_padding(int hashAlg, + const unsigned char* hash, unsigned int hLen, + unsigned char* sigRet, unsigned int* sigLen, + WOLFSSL_RSA* rsa, int flag, int padding); + +WOLFSSL_LOCAL int wolfSSL_RSA_sign_mgf(int hashAlg, + const unsigned char* hash, unsigned int hLen, + unsigned char* sigRet, unsigned int* sigLen, + WOLFSSL_RSA* rsa, int flag, int padding, + int mgf1Hash, int saltLen); + +WOLFSSL_API int wolfSSL_RSA_verify(int hashAlg, + const unsigned char* hash, unsigned int hLen, + const unsigned char* sig, unsigned int sigLen, + WOLFSSL_RSA* rsa); +WOLFSSL_API int wolfSSL_RSA_verify_ex(int hashAlg, + const unsigned char* hash, unsigned int hLen, + const unsigned char* sig, unsigned int sigLen, + WOLFSSL_RSA* rsa, int padding); +WOLFSSL_LOCAL int wolfSSL_RSA_verify_mgf(int hashAlg, + const unsigned char* hash, unsigned int hLen, + const unsigned char* sig, unsigned int sigLen, + WOLFSSL_RSA* rsa, int padding, + int mgf1Hash, int saltLen); +WOLFSSL_API int wolfSSL_RSA_public_decrypt(int flen, const unsigned char* from, + unsigned char* to, WOLFSSL_RSA* rsa, int padding); +WOLFSSL_API int wolfSSL_RSA_GenAdd(WOLFSSL_RSA* rsa); +WOLFSSL_API int wolfSSL_RSA_LoadDer(WOLFSSL_RSA* rsa, + const unsigned char* derBuf, int derSz); +WOLFSSL_API int wolfSSL_RSA_LoadDer_ex(WOLFSSL_RSA* rsa, + const unsigned char* derBuf, int derSz, int opt); + +WOLFSSL_API WOLFSSL_RSA_METHOD *wolfSSL_RSA_meth_new(const char *name, int flags); +WOLFSSL_API void wolfSSL_RSA_meth_free(WOLFSSL_RSA_METHOD *meth); +WOLFSSL_API int wolfSSL_RSA_meth_set(WOLFSSL_RSA_METHOD *rsa, void* p); +WOLFSSL_API int wolfSSL_RSA_set_method(WOLFSSL_RSA *rsa, WOLFSSL_RSA_METHOD *meth); +WOLFSSL_API const WOLFSSL_RSA_METHOD* wolfSSL_RSA_get_method(const WOLFSSL_RSA *rsa); +WOLFSSL_API const WOLFSSL_RSA_METHOD* wolfSSL_RSA_get_default_method(void); + +WOLFSSL_API void wolfSSL_RSA_get0_crt_params(const WOLFSSL_RSA *r, + const WOLFSSL_BIGNUM **dmp1, + const WOLFSSL_BIGNUM **dmq1, + const WOLFSSL_BIGNUM **iqmp); +WOLFSSL_API int wolfSSL_RSA_set0_crt_params(WOLFSSL_RSA *r, WOLFSSL_BIGNUM *dmp1, + WOLFSSL_BIGNUM *dmq1, WOLFSSL_BIGNUM *iqmp); +WOLFSSL_API void wolfSSL_RSA_get0_factors(const WOLFSSL_RSA *r, const WOLFSSL_BIGNUM **p, + const WOLFSSL_BIGNUM **q); +WOLFSSL_API int wolfSSL_RSA_set0_factors(WOLFSSL_RSA *r, WOLFSSL_BIGNUM *p, WOLFSSL_BIGNUM *q); +WOLFSSL_API void wolfSSL_RSA_get0_key(const WOLFSSL_RSA *r, const WOLFSSL_BIGNUM **n, + const WOLFSSL_BIGNUM **e, const WOLFSSL_BIGNUM **d); +WOLFSSL_API int wolfSSL_RSA_set0_key(WOLFSSL_RSA *r, WOLFSSL_BIGNUM *n, WOLFSSL_BIGNUM *e, + WOLFSSL_BIGNUM *d); +WOLFSSL_API int wolfSSL_RSA_flags(const WOLFSSL_RSA *r); +WOLFSSL_API void wolfSSL_RSA_set_flags(WOLFSSL_RSA *r, int flags); +WOLFSSL_API void wolfSSL_RSA_clear_flags(WOLFSSL_RSA *r, int flags); +WOLFSSL_API int wolfSSL_RSA_test_flags(const WOLFSSL_RSA *r, int flags); + +WOLFSSL_API WOLFSSL_RSA* wolfSSL_RSAPublicKey_dup(WOLFSSL_RSA *rsa); + +WOLFSSL_API void* wolfSSL_RSA_get_ex_data(const WOLFSSL_RSA *rsa, int idx); +WOLFSSL_API int wolfSSL_RSA_set_ex_data(WOLFSSL_RSA *rsa, int idx, void *data); +#ifdef HAVE_EX_DATA_CLEANUP_HOOKS +WOLFSSL_API int wolfSSL_RSA_set_ex_data_with_cleanup( + WOLFSSL_RSA *rsa, + int idx, + void *data, + wolfSSL_ex_data_cleanup_routine_t cleanup_routine); +#endif + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + +#define WOLFSSL_RSA_LOAD_PRIVATE 1 +#define WOLFSSL_RSA_LOAD_PUBLIC 2 +#define WOLFSSL_RSA_F4 0x10001L + +#ifndef OPENSSL_COEXIST + +#define OPENSSL_RSA_MAX_MODULUS_BITS RSA_MAX_SIZE + +#define RSA_new wolfSSL_RSA_new +#define RSA_free wolfSSL_RSA_free + +#define RSA_generate_key_ex wolfSSL_RSA_generate_key_ex + +#define RSA_blinding_on wolfSSL_RSA_blinding_on +#define RSA_check_key wolfSSL_RSA_check_key +#define RSA_public_encrypt wolfSSL_RSA_public_encrypt +#define RSA_private_decrypt wolfSSL_RSA_private_decrypt +#define RSA_private_encrypt wolfSSL_RSA_private_encrypt + +#define RSA_size wolfSSL_RSA_size +#define RSA_sign wolfSSL_RSA_sign +#define RSA_verify wolfSSL_RSA_verify +#define RSA_public_decrypt wolfSSL_RSA_public_decrypt + +#define RSA_meth_new wolfSSL_RSA_meth_new +#define RSA_meth_free wolfSSL_RSA_meth_free +#define RSA_meth_set_pub_enc wolfSSL_RSA_meth_set +#define RSA_meth_set_pub_dec wolfSSL_RSA_meth_set +#define RSA_meth_set_priv_enc wolfSSL_RSA_meth_set +#define RSA_meth_set_priv_dec wolfSSL_RSA_meth_set +#define RSA_meth_set_init wolfSSL_RSA_meth_set +#define RSA_meth_set_finish wolfSSL_RSA_meth_set +#define RSA_meth_set0_app_data wolfSSL_RSA_meth_set +#define RSA_get_default_method wolfSSL_RSA_get_default_method +#define RSA_get_method wolfSSL_RSA_get_method +#define RSA_set_method wolfSSL_RSA_set_method +#define RSA_get0_crt_params wolfSSL_RSA_get0_crt_params +#define RSA_set0_crt_params wolfSSL_RSA_set0_crt_params +#define RSA_get0_factors wolfSSL_RSA_get0_factors +#define RSA_set0_factors wolfSSL_RSA_set0_factors +#define RSA_get0_key wolfSSL_RSA_get0_key +#define RSA_set0_key wolfSSL_RSA_set0_key +#define RSA_flags wolfSSL_RSA_flags +#define RSA_set_flags wolfSSL_RSA_set_flags +#define RSA_clear_flags wolfSSL_RSA_clear_flags +#define RSA_test_flags wolfSSL_RSA_test_flags + +#define RSAPublicKey_dup wolfSSL_RSAPublicKey_dup +#define RSA_get_ex_data wolfSSL_RSA_get_ex_data +#define RSA_set_ex_data wolfSSL_RSA_set_ex_data + +#define RSA_get0_key wolfSSL_RSA_get0_key + +#define RSA_F4 WOLFSSL_RSA_F4 + +#define OPENSSL_RSA_MAX_MODULUS_BITS RSA_MAX_SIZE +#define OPENSSL_RSA_MAX_PUBEXP_BITS RSA_MAX_SIZE + +#endif /* !OPENSSL_COEXIST */ + +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* header */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/safestack.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/safestack.h @@ -0,0 +1,40 @@ +/* safestack.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* stack.h for openSSL */ + +#ifndef WOLFSSL_SAFESTACK_H_ +#define WOLFSSL_SAFESTACK_H_ + +#include <wolfssl/openssl/compat_types.h> +#include <wolfssl/openssl/ssl.h> + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/sha.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/sha.h @@ -0,0 +1,331 @@ +/* sha.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* sha.h for openssl */ + + +#ifndef WOLFSSL_SHA_H_ +#define WOLFSSL_SHA_H_ + +#include <wolfssl/wolfcrypt/settings.h> +#include <wolfssl/wolfcrypt/types.h> +#include <wolfssl/wolfcrypt/sha256.h> +#ifdef WOLFSSL_PREFIX +#include "prefix_sha.h" +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +/* adder for HW crypto */ +#if defined(STM32_HASH) + #define CTX_SHA_HW_ADDER sizeof(STM32_HASH_Context) +#elif defined(WOLFSSL_IMXRT1170_CAAM) + #define CTX_SHA_HW_ADDER (sizeof(caam_hash_ctx_t) + sizeof(caam_handle_t)) +#elif defined(WOLFSSL_ESP32) && \ + !defined(NO_WOLFSSL_ESP32_CRYPT_HASH) + #define CTX_SHA_HW_ADDER sizeof(WC_ESP32SHA) +#else + #define CTX_SHA_HW_ADDER 0 +#endif + + +#ifndef NO_SHA +typedef struct WOLFSSL_SHA_CTX { + /* big enough to hold wolfcrypt Sha, but check on init */ + void* holder[(112 + WC_ASYNC_DEV_SIZE + CTX_SHA_HW_ADDER) / sizeof(void*)]; +#if defined(WOLFSSL_DEVCRYPTO_HASH) || defined(WOLFSSL_HASH_KEEP) + void* keephash_holder[sizeof(void*) + (2 * sizeof(unsigned int))]; +#endif +#ifdef WOLF_CRYPTO_CB + void* cryptocb_holder[(sizeof(int) + sizeof(void*) + 4) / sizeof(void*)]; +#endif +} WOLFSSL_SHA_CTX; + +WOLFSSL_API int wolfSSL_SHA_Init(WOLFSSL_SHA_CTX* sha); +WOLFSSL_API int wolfSSL_SHA_Update(WOLFSSL_SHA_CTX* sha, const void* input, + unsigned long sz); +WOLFSSL_API int wolfSSL_SHA_Final(byte* input, WOLFSSL_SHA_CTX* sha); +WOLFSSL_API int wolfSSL_SHA_Transform(WOLFSSL_SHA_CTX* sha, + const unsigned char* data); +/* SHA1 points to above, shouldn't use SHA0 ever */ +WOLFSSL_API int wolfSSL_SHA1_Init(WOLFSSL_SHA_CTX* sha); +WOLFSSL_API int wolfSSL_SHA1_Update(WOLFSSL_SHA_CTX* sha, const void* input, + unsigned long sz); +WOLFSSL_API int wolfSSL_SHA1_Final(byte* output, WOLFSSL_SHA_CTX* sha); +WOLFSSL_API int wolfSSL_SHA1_Transform(WOLFSSL_SHA_CTX* sha, + const unsigned char *data); +#if !defined(OPENSSL_COEXIST) && (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) +enum { + SHA_DIGEST_LENGTH = 20 +}; + +typedef WOLFSSL_SHA_CTX SHA_CTX; + +#define SHA_Init wolfSSL_SHA_Init +#define SHA_Update wolfSSL_SHA_Update +#define SHA_Final wolfSSL_SHA_Final +#define SHA_Transform wolfSSL_SHA_Transform + +#if defined(NO_OLD_SHA_NAMES) && !defined(HAVE_SELFTEST) && \ + (!defined(HAVE_FIPS) || \ + (defined(HAVE_FIPS_VERSION) && HAVE_FIPS_VERSION > 2)) + /* SHA is only available in non-fips mode or fips version > 2 mode + * because of SHA enum in FIPS build. */ + #define SHA wolfSSL_SHA1 +#endif + +#define SHA1_Init wolfSSL_SHA1_Init +#define SHA1_Update wolfSSL_SHA1_Update +#define SHA1_Final wolfSSL_SHA1_Final +#define SHA1_Transform wolfSSL_SHA1_Transform + +#endif /* !OPENSSL_COEXIST && (OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL) */ +#endif /* !NO_SHA */ + + +#ifdef WOLFSSL_SHA224 + +/* Using ALIGN16 because when AES-NI is enabled digest and buffer in Sha256 + * struct are 16 byte aligned. Any dereference to those elements after casting + * to Sha224, is expected to also be 16 byte aligned addresses. */ +typedef struct WOLFSSL_SHA224_CTX { + /* big enough to hold wolfcrypt Sha224, but check on init */ + ALIGN16 void* holder[(274 + CTX_SHA_HW_ADDER + WC_ASYNC_DEV_SIZE) / + sizeof(void*)]; +#if defined(WOLFSSL_DEVCRYPTO_HASH) || defined(WOLFSSL_HASH_KEEP) + ALIGN16 void* keephash_holder[sizeof(void*) + (2 * sizeof(unsigned int))]; +#endif +#ifdef WOLF_CRYPTO_CB + ALIGN16 void* cryptocb_holder[(sizeof(int) + sizeof(void*) + 4) / + sizeof(void*)]; +#endif +} WOLFSSL_SHA224_CTX; + +WOLFSSL_API int wolfSSL_SHA224_Init(WOLFSSL_SHA224_CTX* sha); +WOLFSSL_API int wolfSSL_SHA224_Update(WOLFSSL_SHA224_CTX* sha, const void* input, + unsigned long sz); +WOLFSSL_API int wolfSSL_SHA224_Final(byte* output, WOLFSSL_SHA224_CTX* sha); +#if !defined(OPENSSL_COEXIST) && (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) +enum { + SHA224_DIGEST_LENGTH = 28 +}; + +typedef WOLFSSL_SHA224_CTX SHA224_CTX; + +#define SHA224_Init wolfSSL_SHA224_Init +#define SHA224_Update wolfSSL_SHA224_Update +#define SHA224_Final wolfSSL_SHA224_Final +#if defined(NO_OLD_SHA_NAMES) && !defined(HAVE_SELFTEST) && \ + (!defined(HAVE_FIPS) || \ + (defined(HAVE_FIPS_VERSION) && HAVE_FIPS_VERSION > 2)) + /* SHA224 is only available in non-fips mode or fips version > 2 mode + * because of SHA224 enum in FIPS build. */ + #define SHA224 wolfSSL_SHA224 +#endif +#endif /* !OPENSSL_COEXIST && (OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL) */ +#endif /* WOLFSSL_SHA224 */ + +#ifndef NO_SHA256 +/* Using ALIGN16 because when AES-NI is enabled digest and buffer in Sha256 + * struct are 16 byte aligned. Any dereference to those elements after casting + * to Sha256, is expected to also be 16 byte aligned addresses. */ +typedef struct WOLFSSL_SHA256_CTX { + /* big enough to hold wolfcrypt Sha256, but check on init */ + ALIGN16 void* holder[sizeof(wc_Sha256) / + sizeof(void*)]; +#if defined(WOLFSSL_DEVCRYPTO_HASH) || defined(WOLFSSL_HASH_KEEP) + ALIGN16 void* keephash_holder[sizeof(void*) + (2 * sizeof(unsigned int))]; +#endif +#ifdef WOLF_CRYPTO_CB + ALIGN16 void* cryptocb_holder[(sizeof(int) + sizeof(void*) + 4) / + sizeof(void*)]; +#endif +} WOLFSSL_SHA256_CTX; + +WOLFSSL_API int wolfSSL_SHA256_Init(WOLFSSL_SHA256_CTX* sha256); +WOLFSSL_API int wolfSSL_SHA256_Update(WOLFSSL_SHA256_CTX* sha, const void* input, + unsigned long sz); +WOLFSSL_API int wolfSSL_SHA256_Final(byte* output, WOLFSSL_SHA256_CTX* sha); +WOLFSSL_API int wolfSSL_SHA256_Transform(WOLFSSL_SHA256_CTX* sha256, + const unsigned char *data); +#if !defined(OPENSSL_COEXIST) && (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) +enum { + SHA256_DIGEST_LENGTH = 32 +}; + +typedef WOLFSSL_SHA256_CTX SHA256_CTX; + +#define SHA256_Init wolfSSL_SHA256_Init +#define SHA256_Update wolfSSL_SHA256_Update +#define SHA256_Final wolfSSL_SHA256_Final +#define SHA256_Transform wolfSSL_SHA256_Transform + +/* "SHA256" has some conflicts + * If not FIPS and NO_OLD_SHA_NAMES defined + * If FIPS V3 or higher and NO_OLD_SHA_NAMES defined + * If FIPS V2 and NO_OLD_SHA256_NAMES defined + * If FIPS v1 not allowed + * If HAVE_SELFTEST not allowed + */ +#if !defined(HAVE_SELFTEST) && \ + (defined(NO_OLD_SHA_NAMES) && !defined(HAVE_FIPS)) || \ + (defined(NO_OLD_SHA_NAMES) && defined(HAVE_FIPS) && \ + defined(HAVE_FIPS_VERSION) && HAVE_FIPS_VERSION >= 3) || \ + (defined(NO_OLD_SHA256_NAMES) && defined(HAVE_FIPS) && \ + defined(HAVE_FIPS_VERSION) && HAVE_FIPS_VERSION == 2) + + #define SHA256 wolfSSL_SHA256 +#endif +#endif /* !OPENSSL_COEXIST && (OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL) */ +#endif /* !NO_SHA256 */ + +#ifdef WOLFSSL_SHA384 +typedef struct WOLFSSL_SHA384_CTX { + /* big enough to hold wolfCrypt Sha384, but check on init */ + void* holder[(288 + CTX_SHA_HW_ADDER + WC_ASYNC_DEV_SIZE) / sizeof(void*)]; +#if defined(WOLFSSL_DEVCRYPTO_HASH) || defined(WOLFSSL_HASH_KEEP) + void* keephash_holder[sizeof(void*) + (2 * sizeof(unsigned int))]; +#endif +#ifdef WOLF_CRYPTO_CB + void* cryptocb_holder[(sizeof(int) + sizeof(void*) + 4) / sizeof(void*)]; +#endif +} WOLFSSL_SHA384_CTX; + +WOLFSSL_API int wolfSSL_SHA384_Init(WOLFSSL_SHA384_CTX* sha); +WOLFSSL_API int wolfSSL_SHA384_Update(WOLFSSL_SHA384_CTX* sha, const void* input, + unsigned long sz); +WOLFSSL_API int wolfSSL_SHA384_Final(byte* output, WOLFSSL_SHA384_CTX* sha); +#if !defined(OPENSSL_COEXIST) && (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) +enum { + SHA384_DIGEST_LENGTH = 48 +}; + +typedef WOLFSSL_SHA384_CTX SHA384_CTX; + +#define SHA384_Init wolfSSL_SHA384_Init +#define SHA384_Update wolfSSL_SHA384_Update +#define SHA384_Final wolfSSL_SHA384_Final +#if defined(NO_OLD_SHA_NAMES) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) + /* SHA384 is only available in non-fips mode because of SHA384 enum in FIPS + * build. */ + #define SHA384 wolfSSL_SHA384 +#endif +#endif /* !OPENSSL_COEXIST && (OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL) */ + +#endif /* WOLFSSL_SHA384 */ + +#ifdef WOLFSSL_SHA512 +typedef struct WOLFSSL_SHA512_CTX { + /* big enough to hold wolfCrypt Sha384, but check on init */ + void* holder[(288 + CTX_SHA_HW_ADDER + WC_ASYNC_DEV_SIZE) / sizeof(void*)]; +#if defined(WOLFSSL_DEVCRYPTO_HASH) || defined(WOLFSSL_HASH_KEEP) + void* keephash_holder[sizeof(void*) + (2 * sizeof(unsigned int))]; +#endif +#ifdef WOLF_CRYPTO_CB + void* cryptocb_holder[(sizeof(int) + sizeof(void*) + 4) / sizeof(void*)]; +#endif +} WOLFSSL_SHA512_CTX; + +WOLFSSL_API int wolfSSL_SHA512_Init(WOLFSSL_SHA512_CTX* sha); +WOLFSSL_API int wolfSSL_SHA512_Update(WOLFSSL_SHA512_CTX* sha, + const void* input, unsigned long sz); +WOLFSSL_API int wolfSSL_SHA512_Final(byte* output, WOLFSSL_SHA512_CTX* sha); +WOLFSSL_API int wolfSSL_SHA512_Transform(WOLFSSL_SHA512_CTX* sha512, + const unsigned char* data); +#if !defined(OPENSSL_COEXIST) && (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) +enum { + SHA512_DIGEST_LENGTH = 64 +}; + +typedef WOLFSSL_SHA512_CTX SHA512_CTX; + +#define SHA512_Init wolfSSL_SHA512_Init +#define SHA512_Update wolfSSL_SHA512_Update +#define SHA512_Final wolfSSL_SHA512_Final +#define SHA512_Transform wolfSSL_SHA512_Transform +#if defined(NO_OLD_SHA_NAMES) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) + /* SHA512 is only available in non-fips mode because of SHA512 enum in FIPS + * build. */ + #define SHA512 wolfSSL_SHA512 +#endif +#endif /* !OPENSSL_COEXIST && (OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL) */ + +#if !defined(WOLFSSL_NOSHA512_224) +typedef struct WOLFSSL_SHA512_CTX WOLFSSL_SHA512_224_CTX; +typedef WOLFSSL_SHA512_224_CTX SHA512_224_CTX; + +WOLFSSL_API int wolfSSL_SHA512_224_Init(WOLFSSL_SHA512_CTX* sha); +WOLFSSL_API int wolfSSL_SHA512_224_Update(WOLFSSL_SHA512_224_CTX* sha, + const void* input, unsigned long sz); +WOLFSSL_API int wolfSSL_SHA512_224_Final(byte* output, + WOLFSSL_SHA512_224_CTX* sha); +WOLFSSL_API int wolfSSL_SHA512_224_Transform(WOLFSSL_SHA512_CTX* sha512, + const unsigned char* data); + +#if !defined(OPENSSL_COEXIST) && (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) +#define SHA512_224_Init wolfSSL_SHA512_224_Init +#define SHA512_224_Update wolfSSL_SHA512_224_Update +#define SHA512_224_Final wolfSSL_SHA512_224_Final +#define SHA512_224_Transform wolfSSL_SHA512_224_Transform + +#if defined(NO_OLD_SHA_NAMES) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) + #define SHA512_224 wolfSSL_SHA512_224 +#endif +#endif /* !OPENSSL_COEXIST && (OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL) */ +#endif /* !WOLFSSL_NOSHA512_224 */ + +#if !defined(WOLFSSL_NOSHA512_256) +typedef struct WOLFSSL_SHA512_CTX WOLFSSL_SHA512_256_CTX; +typedef WOLFSSL_SHA512_256_CTX SHA512_256_CTX; + +WOLFSSL_API int wolfSSL_SHA512_256_Init(WOLFSSL_SHA512_CTX* sha); +WOLFSSL_API int wolfSSL_SHA512_256_Update(WOLFSSL_SHA512_256_CTX* sha, + const void* input, unsigned long sz); +WOLFSSL_API int wolfSSL_SHA512_256_Final(byte* output, WOLFSSL_SHA512_256_CTX* sha); +WOLFSSL_API int wolfSSL_SHA512_256_Transform(WOLFSSL_SHA512_CTX* sha512, + const unsigned char* data); + +#if !defined(OPENSSL_COEXIST) && (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) +#define SHA512_256_Init wolfSSL_SHA512_256_Init +#define SHA512_256_Update wolfSSL_SHA512_256_Update +#define SHA512_256_Final wolfSSL_SHA512_256_Final +#define SHA512_256_Transform wolfSSL_SHA512_256_Transform + +#if defined(NO_OLD_SHA_NAMES) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) + #define SHA512_256 wolfSSL_SHA512_256 +#endif +#endif /* !OPENSSL_COEXIST && (OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL) */ +#endif /* !WOLFSSL_NOSHA512_256 */ + + +#endif /* WOLFSSL_SHA512 */ + + + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + + +#endif /* WOLFSSL_SHA_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/sha3.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/sha3.h @@ -0,0 +1,158 @@ +/* sha3.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* sha3.h for openssl */ + + +#ifndef WOLFSSL_SHA3_H_ +#define WOLFSSL_SHA3_H_ + +#include <wolfssl/wolfcrypt/settings.h> +#include <wolfssl/wolfcrypt/types.h> +#include <wolfssl/wolfcrypt/sha3.h> + +#ifdef WOLFSSL_PREFIX +#include "prefix_sha.h" +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +/* Using ALIGN16 because when AES-NI is enabled digest and buffer in Sha3 + * struct are 16 byte aligned. Any dereference to those elements after casting + * to Sha3 is expected to also be 16 byte aligned addresses. */ +struct WOLFSSL_SHA3_CTX { + /* big enough to hold wolfcrypt Sha3, but check on init */ +#ifdef WOLFSSL_SHA3 + ALIGN16 void* holder[sizeof(wc_Sha3)]; +#else + ALIGN16 void* holder[(424 + WC_ASYNC_DEV_SIZE) / sizeof(void*)]; +#endif +}; + +#ifndef WOLFSSL_NOSHA3_224 +typedef struct WOLFSSL_SHA3_CTX WOLFSSL_SHA3_224_CTX; + +WOLFSSL_API int wolfSSL_SHA3_224_Init(WOLFSSL_SHA3_224_CTX* sha); +WOLFSSL_API int wolfSSL_SHA3_224_Update(WOLFSSL_SHA3_224_CTX* sha, const void* input, + unsigned long sz); +WOLFSSL_API int wolfSSL_SHA3_224_Final(unsigned char* output, + WOLFSSL_SHA3_224_CTX* sha); + +enum { + SHA3_224_DIGEST_LENGTH = 28 +}; + +typedef WOLFSSL_SHA3_224_CTX SHA3_224_CTX; + +#define SHA3_224_Init wolfSSL_SHA3_224_Init +#define SHA3_224_Update wolfSSL_SHA3_224_Update +#define SHA3_224_Final wolfSSL_SHA3_224_Final +#if defined(NO_OLD_WC_NAMES) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) + #define SHA3_224 wolfSSL_SHA3_224 +#endif +#endif /* WOLFSSL_NOSHA3_224 */ + + +#ifndef WOLFSSL_NOSHA3_256 +typedef struct WOLFSSL_SHA3_CTX WOLFSSL_SHA3_256_CTX; + + +WOLFSSL_API int wolfSSL_SHA3_256_Init(WOLFSSL_SHA3_256_CTX* sha); +WOLFSSL_API int wolfSSL_SHA3_256_Update(WOLFSSL_SHA3_256_CTX* sha, + const void* input, unsigned long sz); +WOLFSSL_API int wolfSSL_SHA3_256_Final(unsigned char* output, + WOLFSSL_SHA3_256_CTX* sha); + +enum { + SHA3_256_DIGEST_LENGTH = 32 +}; + + +typedef WOLFSSL_SHA3_256_CTX SHA3_256_CTX; + +#define SHA3_256_Init wolfSSL_SHA3_256_Init +#define SHA3_256_Update wolfSSL_SHA3_256_Update +#define SHA3_256_Final wolfSSL_SHA3_256_Final +#if defined(NO_OLD_WC_NAMES) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) + #define SHA3_256 wolfSSL_SHA3_256 +#endif +#endif /* WOLFSSL_NOSHA3_256 */ + + +typedef struct WOLFSSL_SHA3_CTX WOLFSSL_SHA3_384_CTX; + +WOLFSSL_API int wolfSSL_SHA3_384_Init(WOLFSSL_SHA3_384_CTX* sha); +WOLFSSL_API int wolfSSL_SHA3_384_Update(WOLFSSL_SHA3_384_CTX* sha, + const void* input, unsigned long sz); +WOLFSSL_API int wolfSSL_SHA3_384_Final(unsigned char* output, + WOLFSSL_SHA3_384_CTX* sha); + +enum { + SHA3_384_DIGEST_LENGTH = 48 +}; + +typedef WOLFSSL_SHA3_384_CTX SHA3_384_CTX; + +#define SHA3_384_Init wolfSSL_SHA3_384_Init +#define SHA3_384_Update wolfSSL_SHA3_384_Update +#define SHA3_384_Final wolfSSL_SHA3_384_Final +#if defined(NO_OLD_WC_NAMES) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) + #define SHA3_384 wolfSSL_SHA3_384 +#endif + + +#ifndef WOLFSSL_NOSHA3_512 + +typedef struct WOLFSSL_SHA3_CTX WOLFSSL_SHA3_512_CTX; + +WOLFSSL_API int wolfSSL_SHA3_512_Init(WOLFSSL_SHA3_512_CTX* sha); +WOLFSSL_API int wolfSSL_SHA3_512_Update(WOLFSSL_SHA3_512_CTX* sha, + const void* input, unsigned long sz); +WOLFSSL_API int wolfSSL_SHA3_512_Final(unsigned char* output, + WOLFSSL_SHA3_512_CTX* sha); + +enum { + SHA3_512_DIGEST_LENGTH = 64 +}; + + +typedef WOLFSSL_SHA3_512_CTX SHA3_512_CTX; + +#define SHA3_512_Init wolfSSL_SHA3_512_Init +#define SHA3_512_Update wolfSSL_SHA3_512_Update +#define SHA3_512_Final wolfSSL_SHA3_512_Final +#if defined(NO_OLD_WC_NAMES) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) + #define SHA3_512 wolfSSL_SHA3_512 +#endif +#endif /* WOLFSSL_NOSHA3_512 */ + + + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + + +#endif /* WOLFSSL_SHA3_H_ */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/srp.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/srp.h @@ -0,0 +1,33 @@ +/* srp.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifndef WOLFSSL_SRP_H_ +#define WOLFSSL_SRP_H_ + +#include <wolfssl/wolfcrypt/srp.h> + +#ifndef OPENSSL_COEXIST + +#define SRP_MINIMAL_N SRP_MODULUS_MIN_BITS + +#endif /* !OPENSSL_COEXIST */ + +#endif /* WOLFSSL_SRP_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ssl.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ssl.h @@ -0,0 +1,1915 @@ +/* ssl.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + +/* ssl.h defines wolfssl_openssl compatibility layer + * + */ + + +#ifndef WOLFSSL_OPENSSL_H_ +#define WOLFSSL_OPENSSL_H_ + +#include <wolfssl/wolfcrypt/types.h> + +#include <wolfssl/openssl/compat_types.h> + +/* wolfssl_openssl compatibility layer */ +#ifndef OPENSSL_EXTRA_SSL_GUARD +#define OPENSSL_EXTRA_SSL_GUARD +#include <wolfssl/ssl.h> +#endif /* OPENSSL_EXTRA_SSL_GUARD */ + +#include <wolfssl/openssl/tls1.h> +#ifndef WOLFCRYPT_ONLY +#include <wolfssl/openssl/evp.h> +#endif +#include <wolfssl/openssl/bio.h> +#ifdef OPENSSL_EXTRA +#include <wolfssl/openssl/crypto.h> +#endif + +#if defined(WOLFSSL_QT) || defined(OPENSSL_ALL) +#include <wolfssl/openssl/dh.h> +#include <wolfssl/openssl/objects.h> +#endif + +/* need MIN_CODE_E to determine wolfSSL error range */ +#include <wolfssl/wolfcrypt/error-crypt.h> + +/* all NID_* values are in asn.h */ +#include <wolfssl/wolfcrypt/asn.h> + +#include <wolfssl/openssl/x509.h> + +#ifdef __cplusplus + extern "C" { +#endif + +#ifdef _WIN32 + /* wincrypt.h clashes */ + #undef X509_NAME +#endif + +#ifdef WOLFSSL_UTASKER + /* tcpip.h clashes */ + #undef ASN1_INTEGER +#endif + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + +#ifndef WOLFCRYPT_ONLY + +#define WOLFSSL_ERR_LIB_SYS 2 +#define WOLFSSL_ERR_LIB_RSA 4 +#define WOLFSSL_ERR_LIB_PEM 9 +#define WOLFSSL_ERR_LIB_X509 10 +#define WOLFSSL_ERR_LIB_EVP 11 +#define WOLFSSL_ERR_LIB_ASN1 12 +#define WOLFSSL_ERR_LIB_DIGEST 13 +#define WOLFSSL_ERR_LIB_CIPHER 14 +#define WOLFSSL_ERR_LIB_USER 15 +#define WOLFSSL_ERR_LIB_EC 16 +#define WOLFSSL_ERR_LIB_SSL 20 +#define WOLFSSL_ERR_LIB_PKCS12 35 + +#endif + +#ifndef WOLFCRYPT_ONLY +#define WOLFSSL_PEMerr(func, reason) wolfSSL_ERR_put_error(WOLFSSL_ERR_LIB_PEM, \ + (func), (reason), __FILE__, __LINE__) +#else +#define WOLFSSL_PEMerr(func, reason) WOLFSSL_ERROR_LINE((reason), \ + NULL, __LINE__, __FILE__, NULL) +#endif +#ifndef WOLFCRYPT_ONLY +#define WOLFSSL_EVPerr(func, reason) wolfSSL_ERR_put_error(WOLFSSL_ERR_LIB_EVP, \ + (func), (reason), __FILE__, __LINE__) +#else +#define WOLFSSL_EVPerr(func, reason) WOLFSSL_ERROR_LINE((reason), \ + NULL, __LINE__, __FILE__, NULL) +#endif + +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + +#define WOLFSSL_AD_UNRECOGNIZED_NAME unrecognized_name + +#define WOLFSSL_TLSEXT_STATUSTYPE_ocsp 1 + +#if defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) || \ + defined(WOLFSSL_MYSQL_COMPATIBLE) || defined(OPENSSL_EXTRA) || \ + defined(HAVE_LIGHTY) || defined(HAVE_STUNNEL) || \ + defined(WOLFSSL_WPAS_SMALL) + +#define WOLFSSL_NPN_UNSUPPORTED 0 +#define WOLFSSL_NPN_NEGOTIATED 1 +#define WOLFSSL_NPN_NO_OVERLAP 2 + +#endif /* WOLFSSL_NGINX || WOLFSSL_HAPROXY || \ + WOLFSSL_MYSQL_COMPATIBLE || OPENSSL_EXTRA || \ + HAVE_LIGHTY || HAVE_STUNNEL || \ + WOLFSSL_WPAS_SMALL */ + +#if !defined(OPENSSL_COEXIST) && \ + (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) + +typedef WOLFSSL SSL; +typedef WOLFSSL_SESSION SSL_SESSION; +typedef WOLFSSL_METHOD SSL_METHOD; +typedef WOLFSSL_CTX SSL_CTX; + +typedef WOLFSSL_X509 X509; +typedef WOLFSSL_X509 X509_REQ; +typedef WOLFSSL_X509 X509_REQ_INFO; +typedef WOLFSSL_X509_NAME X509_NAME; +typedef WOLFSSL_X509_INFO X509_INFO; +typedef WOLFSSL_X509_CHAIN X509_CHAIN; + +/* STACK_OF(ASN1_OBJECT) */ +typedef WOLFSSL_STACK EXTENDED_KEY_USAGE; + + +/* redeclare guard */ +#define WOLFSSL_TYPES_DEFINED + +typedef WOLFSSL_BIO BIO; +typedef WOLFSSL_BIO_METHOD BIO_METHOD; +typedef WOLFSSL_CIPHER SSL_CIPHER; +typedef WOLFSSL_X509_LOOKUP X509_LOOKUP; +typedef WOLFSSL_X509_LOOKUP_METHOD X509_LOOKUP_METHOD; +typedef WOLFSSL_X509_CRL X509_CRL; +typedef WOLFSSL_X509_ACERT X509_ACERT; +typedef WOLFSSL_X509_EXTENSION X509_EXTENSION; +typedef WOLFSSL_X509_PUBKEY X509_PUBKEY; +typedef WOLFSSL_X509_ALGOR X509_ALGOR; +typedef WOLFSSL_ASN1_TIME ASN1_TIME; +typedef WOLFSSL_ASN1_INTEGER ASN1_INTEGER; +typedef WOLFSSL_ASN1_OBJECT ASN1_OBJECT; +typedef WOLFSSL_ASN1_STRING ASN1_STRING; +typedef WOLFSSL_ASN1_TYPE ASN1_TYPE; +typedef WOLFSSL_X509_ATTRIBUTE X509_ATTRIBUTE; +typedef WOLFSSL_ASN1_BIT_STRING ASN1_BIT_STRING; +typedef WOLFSSL_dynlock_value CRYPTO_dynlock_value; +typedef WOLFSSL_BUF_MEM BUF_MEM; +typedef WOLFSSL_GENERAL_NAMES GENERAL_NAMES; +typedef WOLFSSL_GENERAL_NAME GENERAL_NAME; +typedef WOLFSSL_OBJ_NAME OBJ_NAME; +typedef WOLFSSL_DIST_POINT_NAME DIST_POINT_NAME; +typedef WOLFSSL_DIST_POINT DIST_POINT; + +#define X509_L_FILE_LOAD WOLFSSL_X509_L_FILE_LOAD +#define X509_L_ADD_DIR WOLFSSL_X509_L_ADD_DIR +#define X509_L_ADD_STORE WOLFSSL_X509_L_ADD_STORE +#define X509_L_LOAD_STORE WOLFSSL_X509_L_LOAD_STORE + +#define ASN1_UTCTIME WOLFSSL_ASN1_TIME +#define ASN1_GENERALIZEDTIME WOLFSSL_ASN1_TIME + +typedef WOLFSSL_COMP_METHOD COMP_METHOD; +typedef WOLFSSL_COMP SSL_COMP; +typedef WOLFSSL_X509_REVOKED X509_REVOKED; +typedef WOLFSSL_X509_LOOKUP_TYPE X509_LOOKUP_TYPE; +typedef WOLFSSL_X509_OBJECT X509_OBJECT; +typedef WOLFSSL_X509_STORE X509_STORE; +typedef WOLFSSL_X509_STORE_CTX X509_STORE_CTX; +typedef WOLFSSL_X509_VERIFY_PARAM X509_VERIFY_PARAM; + +typedef int OSSL_HANDSHAKE_STATE; +#define TLS_ST_BEFORE 0 /* NULL_STATE from enum states */ + +#define EVP_CIPHER_INFO EncryptedInfo + +#define STACK_OF(x) WOLFSSL_STACK +#define OPENSSL_STACK WOLFSSL_STACK +#define _STACK OPENSSL_STACK + +#define CONF_get1_default_config_file wolfSSL_CONF_get1_default_config_file +typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS; + +#define CRYPTO_free wolfSSL_CRYPTO_free +#define CRYPTO_malloc wolfSSL_CRYPTO_malloc +#define CRYPTO_EX_new WOLFSSL_CRYPTO_EX_new +#define CRYPTO_EX_dup WOLFSSL_CRYPTO_EX_dup +#define CRYPTO_EX_free WOLFSSL_CRYPTO_EX_free +#ifdef HAVE_EX_DATA + #define CRYPTO_EX_DATA WOLFSSL_CRYPTO_EX_DATA +#endif + +#define CRYPTO_set_mem_functions wolfSSL_CRYPTO_set_mem_functions + +/* deprecated */ +#define CRYPTO_thread_id wolfSSL_thread_id +#define CRYPTO_set_id_callback wolfSSL_set_id_callback + +/* compat CRYPTO_LOCK is defined in wolfssl/ssl.h */ +#define CRYPTO_UNLOCK 0x02 +#define CRYPTO_READ 0x04 +#define CRYPTO_WRITE 0x08 + +#define CRYPTO_set_locking_callback wolfSSL_set_locking_callback +#define CRYPTO_get_locking_callback wolfSSL_get_locking_callback +#define CRYPTO_set_dynlock_create_callback wolfSSL_set_dynlock_create_callback +#define CRYPTO_set_dynlock_lock_callback wolfSSL_set_dynlock_lock_callback +#define CRYPTO_set_dynlock_destroy_callback wolfSSL_set_dynlock_destroy_callback +#define CRYPTO_num_locks wolfSSL_num_locks +#define CRYPTO_dynlock_value WOLFSSL_dynlock_value + +#define CRYPTO_cleanup_all_ex_data wolfSSL_cleanup_all_ex_data +#define set_ex_data wolfSSL_CRYPTO_set_ex_data +#define get_ex_data wolfSSL_CRYPTO_get_ex_data +#define CRYPTO_memcmp wolfSSL_CRYPTO_memcmp +#define CRYPTO_get_ex_new_index wolfSSL_CRYPTO_get_ex_new_index + +#define CRYPTO_get_ex_new_index wolfSSL_CRYPTO_get_ex_new_index + +/* this function was used to set the default malloc, free, and realloc */ +#define CRYPTO_malloc_init() 0 /* CRYPTO_malloc_init is not needed */ +#define OPENSSL_malloc_init() 0 /* OPENSSL_malloc_init is not needed */ + +#define SSL_get_client_random(ssl,out,outSz) \ + wolfSSL_get_client_random((ssl),(out),(outSz)) +#define SSL_get_cipher_list(ctx,i) wolfSSL_get_cipher_list_ex((ctx),(i)) +#define SSL_get_cipher_name(ctx) wolfSSL_get_cipher((ctx)) +#define SSL_get_shared_ciphers(ctx,buf,len) \ + wolfSSL_get_shared_ciphers((ctx),(buf),(len)) + +/* at the moment only returns ok */ +#define SSL_get_verify_result wolfSSL_get_verify_result +#define SSL_get_verify_mode wolfSSL_get_verify_mode +#define SSL_get_verify_depth wolfSSL_get_verify_depth +#define SSL_CTX_get_verify_mode wolfSSL_CTX_get_verify_mode +#define SSL_CTX_get_verify_depth wolfSSL_CTX_get_verify_depth +#define SSL_get_certificate wolfSSL_get_certificate +#define SSL_CTX_get0_certificate wolfSSL_CTX_get0_certificate +#define SSL_use_certificate wolfSSL_use_certificate +#define SSL_use_certificate_ASN1 wolfSSL_use_certificate_ASN1 +#define d2i_PKCS8_PRIV_KEY_INFO_bio wolfSSL_d2i_PKCS8_PKEY_bio +#define d2i_PKCS8_PRIV_KEY_INFO wolfSSL_d2i_PKCS8_PKEY +#define i2d_PKCS8_PRIV_KEY_INFO wolfSSL_i2d_PKCS8_PKEY +#define d2i_PKCS8PrivateKey_bio wolfSSL_d2i_PKCS8PrivateKey_bio +#define i2d_PKCS8PrivateKey_bio wolfSSL_PEM_write_bio_PKCS8PrivateKey +#define PKCS8_PRIV_KEY_INFO_free wolfSSL_EVP_PKEY_free +#define d2i_PKCS12_fp wolfSSL_d2i_PKCS12_fp +#define SSL_set_ecdh_auto wolfSSL_set_ecdh_auto +#define SSL_CTX_set_ecdh_auto wolfSSL_CTX_set_ecdh_auto + +#define i2d_PUBKEY wolfSSL_i2d_PUBKEY +#define i2d_X509_PUBKEY wolfSSL_i2d_X509_PUBKEY +#define d2i_PUBKEY wolfSSL_d2i_PUBKEY +#define d2i_PUBKEY_bio wolfSSL_d2i_PUBKEY_bio +#define d2i_PublicKey wolfSSL_d2i_PublicKey +#define d2i_PrivateKey wolfSSL_d2i_PrivateKey +#define d2i_AutoPrivateKey wolfSSL_d2i_AutoPrivateKey +#define SSL_use_PrivateKey wolfSSL_use_PrivateKey +#define SSL_use_PrivateKey_ASN1 wolfSSL_use_PrivateKey_ASN1 +#define SSL_use_RSAPrivateKey_ASN1 wolfSSL_use_RSAPrivateKey_ASN1 +#define SSL_get_privatekey wolfSSL_get_privatekey +#define SSL_CTX_use_PrivateKey_ASN1 wolfSSL_CTX_use_PrivateKey_ASN1 + +#define SSLv23_method wolfSSLv23_method +#define SSLv23_client_method wolfSSLv23_client_method +#define SSLv2_client_method wolfSSLv2_client_method +#define SSLv2_server_method wolfSSLv2_server_method +#define SSLv3_method wolfSSLv3_method +#define SSLv3_server_method wolfSSLv3_server_method +#define SSLv3_client_method wolfSSLv3_client_method +#define TLS_client_method wolfTLS_client_method +#define TLS_server_method wolfTLS_server_method +#define TLSv1_method wolfTLSv1_method +#define TLSv1_server_method wolfTLSv1_server_method +#define TLSv1_client_method wolfTLSv1_client_method +#define TLSv1_1_method wolfTLSv1_1_method +#define TLSv1_1_server_method wolfTLSv1_1_server_method +#define TLSv1_1_client_method wolfTLSv1_1_client_method +#define TLSv1_2_method wolfTLSv1_2_method +#define TLSv1_2_server_method wolfTLSv1_2_server_method +#define TLSv1_2_client_method wolfTLSv1_2_client_method +#define TLSv1_3_method wolfTLSv1_3_method +#define TLSv1_3_server_method wolfTLSv1_3_server_method +#define TLSv1_3_client_method wolfTLSv1_3_client_method +#define TLS_method wolfSSLv23_method + +#define X509_FILETYPE_PEM WOLFSSL_FILETYPE_PEM +#define X509_FILETYPE_ASN1 WOLFSSL_FILETYPE_ASN1 +#define X509_FILETYPE_DEFAULT WOLFSSL_FILETYPE_DEFAULT + +#define X509_F_X509_CHECK_PRIVATE_KEY 128 + +#ifdef WOLFSSL_DTLS + #define DTLS_client_method wolfDTLS_client_method + #define DTLS_server_method wolfDTLS_server_method + #define DTLSv1_client_method wolfDTLSv1_client_method + #define DTLSv1_server_method wolfDTLSv1_server_method + #define DTLSv1_2_client_method wolfDTLSv1_2_client_method + #define DTLSv1_2_server_method wolfDTLSv1_2_server_method + #define DTLS_method wolfDTLS_method +#endif + + +#ifndef NO_FILESYSTEM + #define SSL_CTX_use_certificate_file wolfSSL_CTX_use_certificate_file + #define SSL_CTX_use_PrivateKey_file wolfSSL_CTX_use_PrivateKey_file + #define SSL_CTX_load_verify_locations wolfSSL_CTX_load_verify_locations_compat + #define SSL_CTX_set_default_verify_paths wolfSSL_CTX_set_default_verify_paths + #define SSL_CTX_use_certificate_chain_file wolfSSL_CTX_use_certificate_chain_file + #define SSL_CTX_use_RSAPrivateKey_file wolfSSL_CTX_use_RSAPrivateKey_file + + #define SSL_use_certificate_file wolfSSL_use_certificate_file + #define SSL_use_PrivateKey_file wolfSSL_use_PrivateKey_file + #define SSL_use_certificate_chain_file wolfSSL_use_certificate_chain_file + #define SSL_use_RSAPrivateKey_file wolfSSL_use_RSAPrivateKey_file +#endif + +#define SSL_CTX_new(method) wolfSSL_CTX_new((WOLFSSL_METHOD*)(method)) +#ifdef OPENSSL_EXTRA +#define SSL_CTX_up_ref wolfSSL_CTX_up_ref +#endif +#define SSL_new wolfSSL_new +#define SSL_set_fd wolfSSL_set_fd +#define SSL_get_fd wolfSSL_get_fd +#define SSL_connect wolfSSL_connect +#define SSL_clear wolfSSL_clear +#define SSL_state wolfSSL_state +#define SSL_read_early_data(ssl, d, dLen, len) wolfSSL_read_early_data(ssl, d, (int)(dLen), (int *)(len)) +#define SSL_write_early_data(ssl, d, dLen, len) wolfSSL_write_early_data(ssl, d, (int)(dLen), (int *)(len)) + +#define SSL_write wolfSSL_write +#define SSL_write_ex wolfSSL_write_ex +#define SSL_read wolfSSL_read +#define SSL_read_ex wolfSSL_read_ex +#define SSL_peek wolfSSL_peek +#define SSL_accept wolfSSL_accept +#define SSL_CTX_free wolfSSL_CTX_free +#define SSL_free wolfSSL_free +#define SSL_shutdown wolfSSL_shutdown +#define SSL_set_timeout wolfSSL_SSL_SESSION_set_timeout + +#define SSL_CTX_set_quiet_shutdown wolfSSL_CTX_set_quiet_shutdown +#define SSL_set_quiet_shutdown wolfSSL_set_quiet_shutdown +#define SSL_get_error wolfSSL_get_error +#define SSL_set_session wolfSSL_set_session +#define SSL_get_session(x) wolfSSL_get_session((WOLFSSL*) (x)) +#define SSL_SESSION_get0_peer wolfSSL_SESSION_get0_peer +#define SSL_flush_sessions wolfSSL_flush_sessions +#define SSL_CTX_get_session_cache_mode(ctx) \ + wolfSSL_CTX_get_session_cache_mode((ctx)) + +#define SSL_CTX_set_verify wolfSSL_CTX_set_verify +#define SSL_CTX_set_cert_verify_callback wolfSSL_CTX_set_cert_verify_callback +#define SSL_CTX_set_cert_cb wolfSSL_CTX_set_cert_cb +#define SSL_set_verify wolfSSL_set_verify +#define SSL_set_verify_result wolfSSL_set_verify_result +#define SSL_verify_client_post_handshake wolfSSL_verify_client_post_handshake +#define SSL_set_post_handshake_auth wolfSSL_set_post_handshake_auth +#define SSL_CTX_set_post_handshake_auth wolfSSL_CTX_set_post_handshake_auth +#define SSL_pending(x) wolfSSL_pending((WOLFSSL*)(x)) +#define SSL_has_pending wolfSSL_has_pending +#define SSL_load_error_strings wolfSSL_load_error_strings +#define SSL_library_init wolfSSL_library_init +#define OPENSSL_cleanup (void)wolfSSL_Cleanup +#define OPENSSL_init_ssl wolfSSL_OPENSSL_init_ssl +#define OpenSSL_add_ssl_algorithms wolfSSL_library_init +#define SSL_CTX_set_session_cache_mode wolfSSL_CTX_set_session_cache_mode +#define SSL_CTX_set_cipher_list wolfSSL_CTX_set_cipher_list +#define SSL_CTX_set_ciphersuites wolfSSL_CTX_set_cipher_list +#define SSL_set_cipher_list wolfSSL_set_cipher_list +/* wolfSSL does not support security levels */ +#define SSL_CTX_set_security_level wolfSSL_CTX_set_security_level +#define SSL_CTX_get_security_level wolfSSL_CTX_get_security_level +#define SSL_export_keying_material wolfSSL_export_keying_material + +#define SSL_CTX_set1_sigalgs_list wolfSSL_CTX_set1_sigalgs_list +#define SSL_set1_sigalgs_list wolfSSL_set1_sigalgs_list +#define SSL_get_signature_nid wolfSSL_get_signature_nid +#define SSL_get_signature_type_nid wolfSSL_get_signature_type_nid +#define SSL_get_peer_signature_nid wolfSSL_get_peer_signature_nid +#define SSL_get_peer_signature_type_nid wolfSSL_get_peer_signature_type_nid + +#define SSL_CTX_set1_groups wolfSSL_CTX_set1_groups +#define SSL_set1_groups wolfSSL_set1_groups + +#define SSL_CTX_set1_groups_list wolfSSL_CTX_set1_groups_list +#define SSL_set1_groups_list wolfSSL_set1_groups_list + +#define SSL_set_ex_data wolfSSL_set_ex_data +#define SSL_get_shutdown wolfSSL_get_shutdown +#define SSL_get_finished wolfSSL_get_finished +#define SSL_get_peer_finished wolfSSL_get_peer_finished +#define SSL_set_rfd wolfSSL_set_rfd +#define SSL_set_wfd wolfSSL_set_wfd +#define SSL_set_shutdown wolfSSL_set_shutdown +#define SSL_set_session_id_context wolfSSL_set_session_id_context +#define SSL_set_connect_state wolfSSL_set_connect_state +#define SSL_set_accept_state wolfSSL_set_accept_state +#define SSL_SESSION_new wolfSSL_SESSION_new +#define SSL_session_reused wolfSSL_session_reused +#define SSL_SESSION_up_ref wolfSSL_SESSION_up_ref +#define SSL_SESSION_dup wolfSSL_SESSION_dup +#define SSL_SESSION_free wolfSSL_SESSION_free +#define SSL_SESSION_set_cipher wolfSSL_SESSION_set_cipher +#define SSL_SESSION_get_max_fragment_length \ + wolfSSL_SESSION_get_max_fragment_length +#define SSL_is_init_finished wolfSSL_is_init_finished + +#define SSL_SESSION_set1_id wolfSSL_SESSION_set1_id +#define SSL_SESSION_set1_id_context wolfSSL_SESSION_set1_id_context + +#define SSL_get_version wolfSSL_get_version +#define SSL_get_current_cipher wolfSSL_get_current_cipher +#define SSL_get_client_ciphers wolfSSL_get_client_ciphers + +/* use wolfSSL_get_cipher_name for its return format */ +#define SSL_get_cipher wolfSSL_get_cipher_name +#define SSL_CIPHER_description wolfSSL_CIPHER_description +#define SSL_CIPHER_get_name wolfSSL_CIPHER_get_name +#define SSL_CIPHER_get_version wolfSSL_CIPHER_get_version +#define SSL_CIPHER_get_id wolfSSL_CIPHER_get_id +#define SSL_CIPHER_get_rfc_name wolfSSL_CIPHER_get_name +#define SSL_CIPHER_standard_name wolfSSL_CIPHER_get_name +#define SSL_CIPHER_get_auth_nid wolfSSL_CIPHER_get_auth_nid +#define SSL_CIPHER_get_cipher_nid wolfSSL_CIPHER_get_cipher_nid +#define SSL_CIPHER_get_digest_nid wolfSSL_CIPHER_get_digest_nid +#define SSL_CIPHER_get_kx_nid wolfSSL_CIPHER_get_kx_nid +#define SSL_CIPHER_is_aead wolfSSL_CIPHER_is_aead +#define SSL_get_cipher_by_value wolfSSL_get_cipher_by_value + +#define SSL_get1_session wolfSSL_get1_session + +#define SSL_get_keyblock_size wolfSSL_get_keyblock_size +#define SSL_get_keys wolfSSL_get_keys +#define SSL_SESSION_get_master_key wolfSSL_SESSION_get_master_key +#define SSL_SESSION_get_master_key_length wolfSSL_SESSION_get_master_key_length +#define SSL_SESSION_get_max_early_data wolfSSL_SESSION_get_max_early_data + +#if defined(WOLFSSL_QT) || defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA) + /* compat SSL_MODE_RELEASE_BUFFERS is defined in wolfssl/ssl.h */ + #define ASN1_BOOLEAN WOLFSSL_ASN1_BOOLEAN + #define X509_get_ext wolfSSL_X509_get_ext + #define X509_get_ext_by_OBJ wolfSSL_X509_get_ext_by_OBJ + #define X509_OBJECT_set1_X509 wolfSSL_X509_OBJECT_set1_X509 + #define X509_OBJECT_set1_X509_CRL wolfSSL_X509_OBJECT_set1_X509_CRL + #define sk_X509_OBJECT_deep_copy wolfSSL_sk_X509_OBJECT_deep_copy + #define X509_cmp wolfSSL_X509_cmp + #define X509_EXTENSION_get_object wolfSSL_X509_EXTENSION_get_object + #define X509_EXTENSION_get_critical wolfSSL_X509_EXTENSION_get_critical + #define X509_EXTENSION_get_data wolfSSL_X509_EXTENSION_get_data + #define X509_EXTENSION_new wolfSSL_X509_EXTENSION_new + #define X509_EXTENSION_free wolfSSL_X509_EXTENSION_free + #define X509_EXTENSION_create_by_OBJ wolfSSL_X509_EXTENSION_create_by_OBJ +#endif + +#define DSA_dup_DH wolfSSL_DSA_dup_DH +/* wolfSSL does not support DSA as the cert public key */ +#define EVP_PKEY_get0_DSA wolfSSL_EVP_PKEY_get0_DSA +#define EVP_PKEY_param_check wolfSSL_EVP_PKEY_param_check +#define EVP_PKEY_CTX_free wolfSSL_EVP_PKEY_CTX_free +#define DSA_bits wolfSSL_DSA_bits + +#define i2d_X509_bio wolfSSL_i2d_X509_bio +#define i2d_X509_REQ_bio wolfSSL_i2d_X509_REQ_bio +#define d2i_X509_bio wolfSSL_d2i_X509_bio +#define d2i_X509_REQ_bio wolfSSL_d2i_X509_REQ_bio +#define d2i_X509_REQ_fp wolfSSL_d2i_X509_REQ_fp +#define d2i_X509_fp wolfSSL_d2i_X509_fp +#define i2d_X509 wolfSSL_i2d_X509 +#define d2i_X509 wolfSSL_d2i_X509 +#define d2i_X509_REQ_INFO wolfSSL_d2i_X509_REQ_INFO +#define PEM_read_bio_X509 wolfSSL_PEM_read_bio_X509 +#define PEM_read_bio_X509_REQ wolfSSL_PEM_read_bio_X509_REQ +#define PEM_read_X509_REQ wolfSSL_PEM_read_X509_REQ +#define PEM_read_bio_X509_CRL wolfSSL_PEM_read_bio_X509_CRL +#define PEM_read_bio_X509_AUX wolfSSL_PEM_read_bio_X509_AUX +#define PEM_read_X509 wolfSSL_PEM_read_X509 +#define PEM_write_bio_X509 wolfSSL_PEM_write_bio_X509 +#define PEM_write_bio_X509_AUX wolfSSL_PEM_write_bio_X509_AUX +#define PEM_X509_INFO_read_bio wolfSSL_PEM_X509_INFO_read_bio +#define PEM_X509_INFO_read wolfSSL_PEM_X509_INFO_read +#define i2d_PrivateKey wolfSSL_i2d_PrivateKey +#define i2d_PublicKey wolfSSL_i2d_PublicKey +#define i2d_PrivateKey_bio wolfSSL_i2d_PrivateKey_bio + +#define i2d_X509_REQ wolfSSL_i2d_X509_REQ +#define d2i_X509_REQ wolfSSL_d2i_X509_REQ +#define X509_REQ_new wolfSSL_X509_REQ_new +#define X509_REQ_free wolfSSL_X509_REQ_free +#define X509_REQ_INFO_free wolfSSL_X509_REQ_free +#define X509_REQ_sign wolfSSL_X509_REQ_sign +#define X509_REQ_sign_ctx wolfSSL_X509_REQ_sign_ctx +#define X509_REQ_add_extensions wolfSSL_X509_REQ_add_extensions +#define X509_REQ_add1_attr_by_NID wolfSSL_X509_REQ_add1_attr_by_NID +#define X509_REQ_add1_attr_by_txt wolfSSL_X509_REQ_add1_attr_by_txt +#define X509_REQ_get_attr_by_NID wolfSSL_X509_REQ_get_attr_by_NID +#define X509_REQ_get_attr wolfSSL_X509_REQ_get_attr +#define X509_ATTRIBUTE_get0_type wolfSSL_X509_ATTRIBUTE_get0_type +#define X509_to_X509_REQ wolfSSL_X509_to_X509_REQ +#define X509_REQ_set_subject_name wolfSSL_X509_REQ_set_subject_name +#define X509_REQ_set_pubkey wolfSSL_X509_REQ_set_pubkey +#define PEM_write_bio_X509_REQ wolfSSL_PEM_write_bio_X509_REQ + +#define X509_new wolfSSL_X509_new +#define X509_up_ref wolfSSL_X509_up_ref +#define X509_free wolfSSL_X509_free +#define X509_load_certificate_file wolfSSL_X509_load_certificate_file +#define X509_digest wolfSSL_X509_digest +#define X509_pubkey_digest wolfSSL_X509_pubkey_digest +#define X509_get_extension_flags wolfSSL_X509_get_extension_flags +#define X509_get_key_usage wolfSSL_X509_get_key_usage +#define X509_get_extended_key_usage wolfSSL_X509_get_extended_key_usage +#define X509_get_ext_count wolfSSL_X509_get_ext_count +#define X509_get_ext_d2i wolfSSL_X509_get_ext_d2i +#define X509V3_EXT_i2d wolfSSL_X509V3_EXT_i2d +#define X509_get0_extensions wolfSSL_X509_get0_extensions +#define X509_get_extensions wolfSSL_X509_get0_extensions +#define X509_REQ_get_extensions wolfSSL_X509_REQ_get_extensions +#define X509_get_ext wolfSSL_X509_get_ext +#define X509_get_ext_by_NID wolfSSL_X509_get_ext_by_NID +#define X509_get_issuer_name wolfSSL_X509_get_issuer_name +#define X509_issuer_name_hash wolfSSL_X509_issuer_name_hash +#define X509_subject_name_hash wolfSSL_X509_subject_name_hash +#define X509_get_subject_name(x) wolfSSL_X509_get_subject_name((WOLFSSL_X509*)(x)) +#define X509_REQ_get_subject_name wolfSSL_X509_get_subject_name +#define X509_get_pubkey wolfSSL_X509_get_pubkey +#define X509_get0_pubkey wolfSSL_X509_get_pubkey +#define X509_REQ_get_pubkey wolfSSL_X509_get_pubkey +#define X509_get_notBefore wolfSSL_X509_get_notBefore +#define X509_get0_notBefore wolfSSL_X509_get_notBefore +#define X509_getm_notBefore wolfSSL_X509_get_notBefore +#define X509_get_notAfter wolfSSL_X509_get_notAfter +#define X509_get0_notAfter wolfSSL_X509_get_notAfter +#define X509_getm_notAfter wolfSSL_X509_get_notAfter +#define X509_get_serialNumber wolfSSL_X509_get_serialNumber +#define X509_get0_serialNumber wolfSSL_X509_get_serialNumber +#define X509_get0_pubkey_bitstr wolfSSL_X509_get0_pubkey_bitstr +#define X509_get_ex_new_index wolfSSL_X509_get_ex_new_index +#define X509_get_ex_data wolfSSL_X509_get_ex_data +#define X509_set_ex_data wolfSSL_X509_set_ex_data +#define X509_get1_ocsp wolfSSL_X509_get1_ocsp +#define X509_get_version wolfSSL_X509_get_version +#define X509_get_signature_nid wolfSSL_X509_get_signature_nid +#define X509_set_subject_name wolfSSL_X509_set_subject_name +#define X509_set_issuer_name wolfSSL_X509_set_issuer_name +#define X509_set_pubkey wolfSSL_X509_set_pubkey +#define X509_set_notAfter wolfSSL_X509_set_notAfter +#define X509_set_notBefore wolfSSL_X509_set_notBefore +#define X509_set1_notAfter wolfSSL_X509_set1_notAfter +#define X509_set1_notBefore wolfSSL_X509_set1_notBefore +#define X509_set_serialNumber wolfSSL_X509_set_serialNumber +#define X509_set_version wolfSSL_X509_set_version +#define X509_REQ_set_version wolfSSL_X509_REQ_set_version +#define X509_REQ_get_version wolfSSL_X509_REQ_get_version +#define X509_sign wolfSSL_X509_sign +#define X509_sign_ctx wolfSSL_X509_sign_ctx +#define X509_print wolfSSL_X509_print +#define X509_REQ_print wolfSSL_X509_REQ_print +#define X509_print_ex wolfSSL_X509_print_ex +#define X509_print_fp wolfSSL_X509_print_fp +#define X509_CRL_print wolfSSL_X509_CRL_print +#define X509_REQ_print_fp wolfSSL_X509_print_fp +#define X509_signature_print wolfSSL_X509_signature_print +#define X509_get0_signature wolfSSL_X509_get0_signature +#define X509_verify_cert_error_string wolfSSL_X509_verify_cert_error_string +#define X509_verify_cert wolfSSL_X509_verify_cert +#define X509_verify wolfSSL_X509_verify +#define X509_REQ_verify wolfSSL_X509_REQ_verify +#define X509_check_private_key wolfSSL_X509_check_private_key +#define X509_REQ_check_private_key wolfSSL_X509_check_private_key +#define X509_check_ca wolfSSL_X509_check_ca +#define X509_check_host wolfSSL_X509_check_host +#define X509_check_email wolfSSL_X509_check_email +#define X509_check_ip_asc wolfSSL_X509_check_ip_asc +#define X509_email_free wolfSSL_X509_email_free +#define X509_check_issued wolfSSL_X509_check_issued +#define X509_dup wolfSSL_X509_dup +#define X509_add_ext wolfSSL_X509_add_ext +#define X509_delete_ext wolfSSL_X509_delete_ext +#define X509_get0_subject_key_id wolfSSL_X509_get0_subject_key_id + +#define X509_EXTENSION_get_object wolfSSL_X509_EXTENSION_get_object +#define X509_EXTENSION_get_data wolfSSL_X509_EXTENSION_get_data +#define X509_EXTENSION_dup wolfSSL_X509_EXTENSION_dup + +#define sk_X509_new wolfSSL_sk_X509_new +#define sk_X509_new_null wolfSSL_sk_X509_new_null +#define sk_X509_num wolfSSL_sk_X509_num +#define sk_X509_value wolfSSL_sk_X509_value +#define sk_X509_shift wolfSSL_sk_X509_shift +#define sk_X509_push wolfSSL_sk_X509_push +#define sk_X509_pop wolfSSL_sk_X509_pop +#define sk_X509_pop_free wolfSSL_sk_X509_pop_free +#define sk_X509_dup wolfSSL_sk_dup +#define sk_X509_free wolfSSL_sk_X509_free +#define X509_chain_up_ref wolfSSL_X509_chain_up_ref + +#define sk_X509_CRL_new wolfSSL_sk_X509_CRL_new +#define sk_X509_CRL_pop_free wolfSSL_sk_X509_CRL_pop_free +#define sk_X509_CRL_free wolfSSL_sk_X509_CRL_free +#define sk_X509_CRL_push wolfSSL_sk_X509_CRL_push +#define sk_X509_CRL_value wolfSSL_sk_X509_CRL_value +#define sk_X509_CRL_num wolfSSL_sk_X509_CRL_num + +#define sk_X509_OBJECT_new wolfSSL_sk_X509_OBJECT_new +#define sk_X509_OBJECT_free wolfSSL_sk_X509_OBJECT_free +#define sk_X509_OBJECT_pop_free wolfSSL_sk_X509_OBJECT_pop_free + +#define sk_X509_EXTENSION_num wolfSSL_sk_X509_EXTENSION_num +#define sk_X509_EXTENSION_value wolfSSL_sk_X509_EXTENSION_value +#define sk_X509_EXTENSION_new_null wolfSSL_sk_X509_EXTENSION_new_null +#define sk_X509_EXTENSION_pop_free wolfSSL_sk_X509_EXTENSION_pop_free +#define sk_X509_EXTENSION_push wolfSSL_sk_X509_EXTENSION_push +#define sk_X509_EXTENSION_free wolfSSL_sk_X509_EXTENSION_free + +#define X509_INFO_new wolfSSL_X509_INFO_new +#define X509_INFO_free wolfSSL_X509_INFO_free + +#define sk_X509_INFO_new_null wolfSSL_sk_X509_INFO_new_null +#define sk_X509_INFO_num wolfSSL_sk_X509_INFO_num +#define sk_X509_INFO_value wolfSSL_sk_X509_INFO_value +#define sk_X509_INFO_push wolfSSL_sk_X509_INFO_push +#define sk_X509_INFO_pop wolfSSL_sk_X509_INFO_pop +#define sk_X509_INFO_pop_free wolfSSL_sk_X509_INFO_pop_free +#define sk_X509_INFO_free wolfSSL_sk_X509_INFO_free +#define sk_X509_INFO_shift wolfSSL_sk_X509_INFO_pop + +#define i2d_X509_NAME wolfSSL_i2d_X509_NAME +#define d2i_X509_NAME wolfSSL_d2i_X509_NAME +#define X509_NAME_new wolfSSL_X509_NAME_new +#define X509_NAME_free wolfSSL_X509_NAME_free +#define X509_NAME_dup wolfSSL_X509_NAME_dup +#define X509_NAME_get_sz wolfSSL_X509_NAME_get_sz +#define X509_NAME_get_text_by_NID wolfSSL_X509_NAME_get_text_by_NID +#define X509_NAME_get_index_by_OBJ wolfSSL_X509_NAME_get_index_by_OBJ +#define X509_NAME_cmp wolfSSL_X509_NAME_cmp +#define X509_NAME_ENTRY_new wolfSSL_X509_NAME_ENTRY_new +#define X509_NAME_ENTRY_free wolfSSL_X509_NAME_ENTRY_free +#define X509_NAME_ENTRY_create_by_NID wolfSSL_X509_NAME_ENTRY_create_by_NID +#define X509_NAME_ENTRY_create_by_txt wolfSSL_X509_NAME_ENTRY_create_by_txt +#define X509_NAME_add_entry wolfSSL_X509_NAME_add_entry +#define X509_NAME_add_entry_by_txt wolfSSL_X509_NAME_add_entry_by_txt +#define X509_NAME_add_entry_by_NID wolfSSL_X509_NAME_add_entry_by_NID +#define X509_NAME_delete_entry wolfSSL_X509_NAME_delete_entry +#define X509_NAME_hash wolfSSL_X509_NAME_hash +#define X509_NAME_oneline wolfSSL_X509_NAME_oneline +#define X509_NAME_get_index_by_NID wolfSSL_X509_NAME_get_index_by_NID +#define X509_NAME_print_ex wolfSSL_X509_NAME_print_ex +#define X509_NAME_print_ex_fp wolfSSL_X509_NAME_print_ex_fp +#define X509_NAME_digest wolfSSL_X509_NAME_digest +#define X509_cmp_current_time wolfSSL_X509_cmp_current_time +#define X509_cmp_time wolfSSL_X509_cmp_time +#define X509_time_adj wolfSSL_X509_time_adj +#define X509_time_adj_ex wolfSSL_X509_time_adj_ex +#define X509_gmtime_adj wolfSSL_X509_gmtime_adj + +#define sk_ACCESS_DESCRIPTION_num wolfSSL_sk_ACCESS_DESCRIPTION_num +#define sk_ACCESS_DESCRIPTION_value wolfSSL_sk_ACCESS_DESCRIPTION_value + +#define sk_X509_NAME_new wolfSSL_sk_X509_NAME_new +#define sk_X509_NAME_new_null() wolfSSL_sk_X509_NAME_new(NULL) +#define sk_X509_NAME_push wolfSSL_sk_X509_NAME_push +#define sk_X509_NAME_find wolfSSL_sk_X509_NAME_find +#define sk_X509_NAME_set_cmp_func wolfSSL_sk_X509_NAME_set_cmp_func +#define sk_X509_NAME_num wolfSSL_sk_X509_NAME_num +#define sk_X509_NAME_value wolfSSL_sk_X509_NAME_value +#define sk_X509_NAME_pop wolfSSL_sk_X509_NAME_pop +#define sk_X509_NAME_pop_free wolfSSL_sk_X509_NAME_pop_free +#define sk_X509_NAME_free wolfSSL_sk_X509_NAME_free + +typedef WOLFSSL_X509_NAME_ENTRY X509_NAME_ENTRY; + +#define X509_NAME_entry_count wolfSSL_X509_NAME_entry_count +#define X509_NAME_get_entry wolfSSL_X509_NAME_get_entry +#define X509_NAME_ENTRY_set wolfSSL_X509_NAME_ENTRY_set +#define X509_NAME_ENTRY_get_object wolfSSL_X509_NAME_ENTRY_get_object +#define X509_NAME_ENTRY_get_data wolfSSL_X509_NAME_ENTRY_get_data +#define X509_NAME_ENTRY_get_object wolfSSL_X509_NAME_ENTRY_get_object + +#define sk_X509_NAME_ENTRY_new wolfSSL_sk_X509_NAME_ENTRY_new +#define sk_X509_NAME_ENTRY_push wolfSSL_sk_X509_NAME_ENTRY_push +#define sk_X509_NAME_ENTRY_num wolfSSL_sk_X509_NAME_ENTRY_num +#define sk_X509_NAME_ENTRY_value wolfSSL_sk_X509_NAME_ENTRY_value +#define sk_X509_NAME_ENTRY_free wolfSSL_sk_X509_NAME_ENTRY_free + +#define X509_V_FLAG_CRL_CHECK WOLFSSL_CRL_CHECK +#define X509_V_FLAG_CRL_CHECK_ALL WOLFSSL_CRL_CHECKALL + +#define X509_V_FLAG_PARTIAL_CHAIN WOLFSSL_PARTIAL_CHAIN +#define X509_V_FLAG_TRUSTED_FIRST 0 /* dummy value needed for gRPC port */ + +#define X509_V_FLAG_USE_CHECK_TIME WOLFSSL_USE_CHECK_TIME +#define X509_V_FLAG_NO_CHECK_TIME WOLFSSL_NO_CHECK_TIME +#define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT WOLFSSL_ALWAYS_CHECK_SUBJECT +#define X509_CHECK_FLAG_NO_WILDCARDS WOLFSSL_NO_WILDCARDS +#define X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS WOLFSSL_NO_PARTIAL_WILDCARDS +#define X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS WOLFSSL_MULTI_LABEL_WILDCARDS + +#define X509_VP_FLAG_DEFAULT WOLFSSL_VPARAM_DEFAULT +#define X509_VP_FLAG_OVERWRITE WOLFSSL_VPARAM_OVERWRITE +#define X509_VP_FLAG_RESET_FLAGS WOLFSSL_VPARAM_RESET_FLAGS +#define X509_VP_FLAG_LOCKED WOLFSSL_VPARAM_LOCKED +#define X509_VP_FLAG_ONCE WOLFSSL_VPARAM_ONCE + +#define X509_STORE_lock(x) 1 +#define X509_STORE_unlock(x) 1 + +#define X509_STORE_CTX_get_current_cert wolfSSL_X509_STORE_CTX_get_current_cert +#define X509_STORE_CTX_set_verify_cb wolfSSL_X509_STORE_CTX_set_verify_cb +#define X509_STORE_CTX_new wolfSSL_X509_STORE_CTX_new +#define X509_STORE_CTX_free wolfSSL_X509_STORE_CTX_free +#define X509_STORE_CTX_get_chain wolfSSL_X509_STORE_CTX_get_chain +#define X509_STORE_CTX_get0_chain wolfSSL_X509_STORE_CTX_get_chain +#define X509_STORE_CTX_get1_chain wolfSSL_X509_STORE_CTX_get1_chain +#define X509_STORE_CTX_get0_parent_ctx wolfSSL_X509_STORE_CTX_get0_parent_ctx +#define X509_STORE_CTX_get_error wolfSSL_X509_STORE_CTX_get_error +#define X509_STORE_CTX_get_error_depth wolfSSL_X509_STORE_CTX_get_error_depth +#define X509_STORE_CTX_init wolfSSL_X509_STORE_CTX_init +#define X509_STORE_CTX_cleanup wolfSSL_X509_STORE_CTX_cleanup +#define X509_STORE_CTX_set_error wolfSSL_X509_STORE_CTX_set_error +#define X509_STORE_CTX_set_error_depth wolfSSL_X509_STORE_CTX_set_error_depth +#define X509_STORE_CTX_get_ex_data wolfSSL_X509_STORE_CTX_get_ex_data +#define X509_STORE_CTX_set_ex_data wolfSSL_X509_STORE_CTX_set_ex_data +#define X509_STORE_CTX_set_depth wolfSSL_X509_STORE_CTX_set_depth +#define X509_STORE_CTX_verify_cb WOLFSSL_X509_STORE_CTX_verify_cb +#define X509_STORE_CTX_get0_current_issuer \ + wolfSSL_X509_STORE_CTX_get0_current_issuer +#define X509_STORE_CTX_get0_store wolfSSL_X509_STORE_CTX_get0_store +#define X509_STORE_CTX_get0_cert wolfSSL_X509_STORE_CTX_get0_cert +#define X509_STORE_CTX_trusted_stack wolfSSL_X509_STORE_CTX_trusted_stack + +#define X509_STORE_set_verify_cb(s, c) \ +wolfSSL_X509_STORE_set_verify_cb((WOLFSSL_X509_STORE *)(s), (WOLFSSL_X509_STORE_CTX_verify_cb)(c)) +#define X509_STORE_set_verify_cb_func(s, c) \ +wolfSSL_X509_STORE_set_verify_cb((WOLFSSL_X509_STORE *)(s), (WOLFSSL_X509_STORE_CTX_verify_cb)(c)) +#define X509_STORE_set_get_crl wolfSSL_X509_STORE_set_get_crl +#define X509_STORE_set_check_crl wolfSSL_X509_STORE_set_check_crl + + +#define X509_STORE_new wolfSSL_X509_STORE_new +#define X509_STORE_free wolfSSL_X509_STORE_free +#define X509_STORE_up_ref wolfSSL_X509_STORE_up_ref +#define X509_STORE_add_lookup wolfSSL_X509_STORE_add_lookup +#define X509_STORE_add_cert wolfSSL_X509_STORE_add_cert +#define X509_STORE_add_crl wolfSSL_X509_STORE_add_crl +#define X509_STORE_set_flags wolfSSL_X509_STORE_set_flags +#define X509_STORE_get1_certs wolfSSL_X509_STORE_get1_certs +#define X509_STORE_get_by_subject wolfSSL_X509_STORE_get_by_subject +#define X509_STORE_set_ex_data wolfSSL_X509_STORE_set_ex_data +#define X509_STORE_get_ex_data wolfSSL_X509_STORE_get_ex_data +#define X509_STORE_get0_param wolfSSL_X509_STORE_get0_param +#define X509_STORE_set1_param wolfSSL_X509_STORE_set1_param +#define X509_STORE_CTX_get1_issuer wolfSSL_X509_STORE_CTX_get1_issuer +#define X509_STORE_CTX_set_time wolfSSL_X509_STORE_CTX_set_time +#define X509_STORE_CTX_get0_param wolfSSL_X509_STORE_CTX_get0_param +#define X509_VERIFY_PARAM_new wolfSSL_X509_VERIFY_PARAM_new +#define X509_VERIFY_PARAM_free wolfSSL_X509_VERIFY_PARAM_free +#define X509_VERIFY_PARAM_set_flags wolfSSL_X509_VERIFY_PARAM_set_flags +#define X509_VERIFY_PARAM_get_flags wolfSSL_X509_VERIFY_PARAM_get_flags +#define X509_VERIFY_PARAM_clear_flags wolfSSL_X509_VERIFY_PARAM_clear_flags +#define X509_VERIFY_PARAM_set_hostflags wolfSSL_X509_VERIFY_PARAM_set_hostflags +#define SSL_set1_host wolfSSL_set1_host +#define X509_VERIFY_PARAM_set1_host wolfSSL_X509_VERIFY_PARAM_set1_host +#define X509_VERIFY_PARAM_set1_ip_asc wolfSSL_X509_VERIFY_PARAM_set1_ip_asc +#define X509_VERIFY_PARAM_set1_ip wolfSSL_X509_VERIFY_PARAM_set1_ip +#define X509_VERIFY_PARAM_set1 wolfSSL_X509_VERIFY_PARAM_set1 +#define X509_VERIFY_PARAM_lookup wolfSSL_X509_VERIFY_PARAM_lookup +#define X509_VERIFY_PARAM_inherit wolfSSL_X509_VERIFY_PARAM_inherit +#define X509_STORE_load_locations wolfSSL_X509_STORE_load_locations +#define X509_STORE_set_default_paths wolfSSL_X509_STORE_set_default_paths +#define X509_STORE_get0_param wolfSSL_X509_STORE_get0_param + +#define X509_LOOKUP_add_dir wolfSSL_X509_LOOKUP_add_dir +#define X509_LOOKUP_load_file wolfSSL_X509_LOOKUP_load_file +#define X509_LOOKUP_hash_dir wolfSSL_X509_LOOKUP_hash_dir +#define X509_LOOKUP_file wolfSSL_X509_LOOKUP_file +#define X509_LOOKUP_ctrl wolfSSL_X509_LOOKUP_ctrl + +#define d2i_X509_CRL wolfSSL_d2i_X509_CRL +#define d2i_X509_CRL_fp wolfSSL_d2i_X509_CRL_fp +#define PEM_read_X509_CRL wolfSSL_PEM_read_X509_CRL + +#define X509_CRL_dup wolfSSL_X509_CRL_dup +#define X509_CRL_free wolfSSL_X509_CRL_free +#define X509_CRL_get_lastUpdate wolfSSL_X509_CRL_get_lastUpdate +#define X509_CRL_get0_lastUpdate wolfSSL_X509_CRL_get_lastUpdate +#define X509_CRL_get_nextUpdate wolfSSL_X509_CRL_get_nextUpdate +#define X509_CRL_get0_nextUpdate wolfSSL_X509_CRL_get_nextUpdate +#define X509_CRL_verify wolfSSL_X509_CRL_verify +#define X509_CRL_get_REVOKED wolfSSL_X509_CRL_get_REVOKED +#define X509_CRL_get_issuer wolfSSL_X509_CRL_get_issuer_name +#define X509_CRL_get_signature_nid wolfSSL_X509_CRL_get_signature_nid +#define X509_CRL_get_version wolfSSL_X509_CRL_version +#define X509_load_crl_file wolfSSL_X509_load_crl_file + +#define X509_ACERT_new wolfSSL_X509_ACERT_new +#define X509_ACERT_free wolfSSL_X509_ACERT_free +#define X509_ACERT_get_version wolfSSL_X509_ACERT_get_version +#define X509_ACERT_get_signature_nid wolfSSL_X509_ACERT_get_signature_nid +#define X509_ACERT_print wolfSSL_X509_ACERT_print +#define X509_ACERT_verify wolfSSL_X509_ACERT_verify +#define X509_ACERT_sign wolfSSL_X509_ACERT_sign +#define PEM_read_bio_X509_ACERT wolfSSL_PEM_read_bio_X509_ACERT + +#define X509_get_X509_PUBKEY wolfSSL_X509_get_X509_PUBKEY +#define X509_REQ_get_X509_PUBKEY wolfSSL_X509_get_X509_PUBKEY +#define X509_get0_tbs_sigalg wolfSSL_X509_get0_tbs_sigalg +#define X509_PUBKEY_get0_param wolfSSL_X509_PUBKEY_get0_param +#define X509_PUBKEY_get wolfSSL_X509_PUBKEY_get +#define X509_PUBKEY_set wolfSSL_X509_PUBKEY_set +#define X509_ALGOR_get0 wolfSSL_X509_ALGOR_get0 +#define X509_ALGOR_set0 wolfSSL_X509_ALGOR_set0 + +#define X509_ALGOR_new wolfSSL_X509_ALGOR_new +#define X509_ALGOR_free wolfSSL_X509_ALGOR_free +#define i2d_X509_ALGOR wolfSSL_i2d_X509_ALGOR +#define d2i_X509_ALGOR wolfSSL_d2i_X509_ALGOR +#define X509_PUBKEY_new wolfSSL_X509_PUBKEY_new +#define X509_PUBKEY_free wolfSSL_X509_PUBKEY_free + +#define sk_X509_REVOKED_num wolfSSL_sk_X509_REVOKED_num +#define sk_X509_REVOKED_value wolfSSL_sk_X509_REVOKED_value + +#define X509_OBJECT_free_contents wolfSSL_X509_OBJECT_free_contents + +#define X509_OBJECT_get0_X509 wolfSSL_X509_OBJECT_get0_X509 +#define X509_OBJECT_get0_X509_CRL wolfSSL_X509_OBJECT_get0_X509_CRL + +#define X509_REVOKED_get0_serialNumber wolfSSL_X509_REVOKED_get0_serial_number +#define X509_REVOKED_get0_revocationDate wolfSSL_X509_REVOKED_get0_revocation_date + +#define X509_check_purpose(x, id, ca) 0 + +#define OCSP_parse_url wolfSSL_OCSP_parse_url + +#define MD4_Init wolfSSL_MD4_Init +#define MD4_Update wolfSSL_MD4_Update +#define MD4_Final wolfSSL_MD4_Final + +#define BIO_new wolfSSL_BIO_new +#define BIO_free wolfSSL_BIO_free +#define BIO_vfree wolfSSL_BIO_vfree +#define BIO_free_all wolfSSL_BIO_free_all +#define BIO_nread0 wolfSSL_BIO_nread0 +#define BIO_nread wolfSSL_BIO_nread +#define BIO_read wolfSSL_BIO_read +#define BIO_nwrite0 wolfSSL_BIO_nwrite0 +#define BIO_nwrite wolfSSL_BIO_nwrite +#define BIO_write wolfSSL_BIO_write +#define BIO_push wolfSSL_BIO_push +#define BIO_pop wolfSSL_BIO_pop +#define BIO_flush wolfSSL_BIO_flush +#define BIO_pending wolfSSL_BIO_pending +#define BIO_number_read wolfSSL_BIO_number_read +#define BIO_number_written wolfSSL_BIO_number_written +#define BIO_reset wolfSSL_BIO_reset +#define BIO_get_mem_data wolfSSL_BIO_get_mem_data +#define BIO_new_mem_buf wolfSSL_BIO_new_mem_buf + +#define BIO_f_buffer wolfSSL_BIO_f_buffer +#define BIO_set_write_buffer_size wolfSSL_BIO_set_write_buffer_size +#define BIO_f_ssl wolfSSL_BIO_f_ssl +#define BIO_new_socket wolfSSL_BIO_new_socket +#define BIO_new_dgram wolfSSL_BIO_new_dgram +#define BIO_new_connect wolfSSL_BIO_new_connect +#define BIO_new_accept wolfSSL_BIO_new_accept +#define BIO_set_conn_port wolfSSL_BIO_set_conn_port +#define BIO_do_connect wolfSSL_BIO_do_connect +#define BIO_do_accept wolfSSL_BIO_do_accept +#define BIO_do_handshake wolfSSL_BIO_do_handshake +#define BIO_ssl_shutdown wolfSSL_BIO_ssl_shutdown +#define SSL_set_bio wolfSSL_set_bio +#define SSL_set0_rbio wolfSSL_set_rbio +#define SSL_set0_wbio wolfSSL_set_wbio +#define BIO_method_type wolfSSL_BIO_method_type +#define BIO_set_ssl wolfSSL_BIO_set_ssl +#define BIO_get_ssl wolfSSL_BIO_get_ssl +#define BIO_new_ssl wolfSSL_BIO_new_ssl +#define BIO_new_ssl_connect wolfSSL_BIO_new_ssl_connect +#define BIO_set_conn_hostname wolfSSL_BIO_set_conn_hostname +#define BIO_eof wolfSSL_BIO_eof +#define BIO_set_ss wolfSSL_BIO_set_ss + +#define BIO_f_md wolfSSL_BIO_f_md +#define BIO_get_md_ctx wolfSSL_BIO_get_md_ctx +#define BIO_s_mem wolfSSL_BIO_s_mem +#define BIO_f_base64 wolfSSL_BIO_f_base64 +#define BIO_set_flags wolfSSL_BIO_set_flags +#define BIO_set_nbio wolfSSL_BIO_set_nbio + +#define SSLeay_add_ssl_algorithms wolfSSL_add_all_algorithms +#define SSLeay_add_all_algorithms wolfSSL_add_all_algorithms + +#define RAND_screen wolfSSL_RAND_screen +#define RAND_file_name wolfSSL_RAND_file_name +#define RAND_write_file wolfSSL_RAND_write_file +#define RAND_load_file wolfSSL_RAND_load_file +#define RAND_egd wolfSSL_RAND_egd +#define RAND_seed wolfSSL_RAND_seed +#define RAND_cleanup wolfSSL_RAND_Cleanup +#define RAND_add wolfSSL_RAND_add +#define RAND_poll wolfSSL_RAND_poll +#define RAND_status wolfSSL_RAND_status +#define RAND_bytes wolfSSL_RAND_bytes +#define RAND_pseudo_bytes wolfSSL_RAND_pseudo_bytes + +#define COMP_zlib wolfSSL_COMP_zlib +#define COMP_rle wolfSSL_COMP_rle +#define SSL_COMP_add_compression_method wolfSSL_COMP_add_compression_method +#define SSL_COMP_get_name wolfSSL_COMP_get_name +#define SSL_get_current_compression wolfSSL_get_current_compression +#define SSL_get_current_expansion wolfSSL_get_current_expansion + +#define SSL_get_ex_new_index wolfSSL_get_ex_new_index +#define RSA_get_ex_new_index wolfSSL_get_ex_new_index + +#define ASN1_BIT_STRING_new wolfSSL_ASN1_BIT_STRING_new +#define ASN1_BIT_STRING_free wolfSSL_ASN1_BIT_STRING_free +#define ASN1_BIT_STRING_get_bit wolfSSL_ASN1_BIT_STRING_get_bit +#define ASN1_BIT_STRING_set_bit wolfSSL_ASN1_BIT_STRING_set_bit +#define i2d_ASN1_BIT_STRING wolfSSL_i2d_ASN1_BIT_STRING +#define d2i_ASN1_BIT_STRING wolfSSL_d2i_ASN1_BIT_STRING + +#define sk_ASN1_OBJECT_free wolfSSL_sk_ASN1_OBJECT_free + +#ifndef NO_ASN_TIME +#define ASN1_TIME_new wolfSSL_ASN1_TIME_new +#define ASN1_UTCTIME_new wolfSSL_ASN1_TIME_new +#define ASN1_GENERALIZEDTIME_new wolfSSL_ASN1_TIME_new +#define ASN1_TIME_free wolfSSL_ASN1_TIME_free +#define ASN1_UTCTIME_free wolfSSL_ASN1_TIME_free +#define ASN1_GENERALIZEDTIME_free wolfSSL_ASN1_TIME_free +#define ASN1_TIME_adj wolfSSL_ASN1_TIME_adj +#define ASN1_TIME_print wolfSSL_ASN1_TIME_print +#define ASN1_TIME_to_string wolfSSL_ASN1_TIME_to_string +#define ASN1_TIME_to_tm wolfSSL_ASN1_TIME_to_tm +#define ASN1_TIME_to_generalizedtime wolfSSL_ASN1_TIME_to_generalizedtime +#define ASN1_UTCTIME_set wolfSSL_ASN1_UTCTIME_set +#endif +#define ASN1_TIME_set wolfSSL_ASN1_TIME_set +#define ASN1_TIME_set_string wolfSSL_ASN1_TIME_set_string +#define ASN1_TIME_set_string_X509 wolfSSL_ASN1_TIME_set_string_X509 +#define ASN1_GENERALIZEDTIME_set_string wolfSSL_ASN1_TIME_set_string +#define ASN1_GENERALIZEDTIME_print wolfSSL_ASN1_GENERALIZEDTIME_print + +#define ASN1_tag2str wolfSSL_ASN1_tag2str + +#define a2i_ASN1_INTEGER wolfSSL_a2i_ASN1_INTEGER +#define i2a_ASN1_INTEGER wolfSSL_i2a_ASN1_INTEGER +#define i2c_ASN1_INTEGER wolfSSL_i2c_ASN1_INTEGER +#define ASN1_INTEGER_new wolfSSL_ASN1_INTEGER_new +#define ASN1_INTEGER_free wolfSSL_ASN1_INTEGER_free +#define ASN1_INTEGER_cmp wolfSSL_ASN1_INTEGER_cmp +#define ASN1_INTEGER_get wolfSSL_ASN1_INTEGER_get +#define ASN1_INTEGER_set wolfSSL_ASN1_INTEGER_set +#define ASN1_INTEGER_to_BN wolfSSL_ASN1_INTEGER_to_BN +#define d2i_ASN1_INTEGER wolfSSL_d2i_ASN1_INTEGER +#define i2d_ASN1_INTEGER wolfSSL_i2d_ASN1_INTEGER + +#define i2a_ASN1_OBJECT wolfSSL_i2a_ASN1_OBJECT +#define i2d_ASN1_OBJECT wolfSSL_i2d_ASN1_OBJECT + +#define ASN1_STRING_new wolfSSL_ASN1_STRING_new +#define ASN1_OCTET_STRING_new wolfSSL_ASN1_STRING_new +#define ASN1_STRING_free wolfSSL_ASN1_STRING_free +#define ASN1_STRING_cmp wolfSSL_ASN1_STRING_cmp +#define ASN1_OCTET_STRING_cmp wolfSSL_ASN1_STRING_cmp +#define ASN1_STRING_data wolfSSL_ASN1_STRING_data +#define ASN1_STRING_get0_data wolfSSL_ASN1_STRING_get0_data +#define ASN1_STRING_length wolfSSL_ASN1_STRING_length +#define ASN1_STRING_to_UTF8 wolfSSL_ASN1_STRING_to_UTF8 +#define ASN1_UNIVERSALSTRING_to_string wolfSSL_ASN1_UNIVERSALSTRING_to_string +#define ASN1_STRING_print_ex wolfSSL_ASN1_STRING_print_ex +#define ASN1_STRING_print(x, y) wolfSSL_ASN1_STRING_print ((WOLFSSL_BIO*)(x), (WOLFSSL_ASN1_STRING*)(y)) +#define d2i_DISPLAYTEXT wolfSSL_d2i_DISPLAYTEXT +#ifndef NO_WOLFSSL_STUB +#define ASN1_STRING_set_default_mask_asc(p) 1 +#endif + +#define ASN1_GENERALSTRING WOLFSSL_ASN1_STRING +#define ASN1_GENERALSTRING_new wolfSSL_ASN1_STRING_new +#define ASN1_GENERALSTRING_free wolfSSL_ASN1_STRING_free +#define ASN1_GENERALSTRING_set wolfSSL_ASN1_STRING_set +#define i2d_ASN1_GENERALSTRING wolfSSL_i2d_ASN1_GENERALSTRING +#define i2d_ASN1_OCTET_STRING wolfSSL_i2d_ASN1_OCTET_STRING +#define i2d_ASN1_UTF8STRING wolfSSL_i2d_ASN1_UTF8STRING +#define i2d_ASN1_SEQUENCE wolfSSL_i2d_ASN1_SEQUENCE +#define d2i_ASN1_GENERALSTRING wolfSSL_d2i_ASN1_GENERALSTRING +#define d2i_ASN1_OCTET_STRING wolfSSL_d2i_ASN1_OCTET_STRING +#define d2i_ASN1_UTF8STRING wolfSSL_d2i_ASN1_UTF8STRING + +#define sk_ASN1_GENERALSTRING_num wolfSSL_sk_num +#define sk_ASN1_GENERALSTRING_value wolfSSL_sk_value +#define sk_ASN1_GENERALSTRING_push wolfSSL_sk_push + +#define ASN1_OCTET_STRING WOLFSSL_ASN1_STRING +#define ASN1_OCTET_STRING_new wolfSSL_ASN1_STRING_new +#define ASN1_OCTET_STRING_free wolfSSL_ASN1_STRING_free +#define ASN1_OCTET_STRING_set wolfSSL_ASN1_STRING_set + +#define ASN1_UTF8STRING WOLFSSL_ASN1_STRING +#define ASN1_UTF8STRING_new wolfSSL_ASN1_STRING_new +#define ASN1_UTF8STRING_free wolfSSL_ASN1_STRING_free +#define ASN1_UTF8STRING_set wolfSSL_ASN1_STRING_set + +#define ASN1_IA5STRING WOLFSSL_ASN1_STRING +#define ASN1_IA5STRING_new wolfSSL_ASN1_STRING_new +#define ASN1_IA5STRING_free wolfSSL_ASN1_STRING_free +#define ASN1_IA5STRING_set wolfSSL_ASN1_STRING_set + +#define ASN1_PRINTABLE_type(s, max) V_ASN1_PRINTABLESTRING + +#define ASN1_UTCTIME_pr wolfSSL_ASN1_UTCTIME_pr + +#define ASN1_IA5STRING WOLFSSL_ASN1_STRING + +#define ASN1_BOOLEAN WOLFSSL_ASN1_BOOLEAN + +#define SSL_load_client_CA_file wolfSSL_load_client_CA_file + +#define SSL_CTX_get_client_CA_list wolfSSL_CTX_get_client_CA_list +#define SSL_CTX_set_client_CA_list wolfSSL_CTX_set_client_CA_list +#define SSL_CTX_set_client_cert_cb wolfSSL_CTX_set_client_cert_cb +#define SSL_CTX_set_cert_store wolfSSL_CTX_set_cert_store +#ifdef OPENSSL_ALL +#define SSL_CTX_set1_verify_cert_store wolfSSL_CTX_set1_verify_cert_store +#endif +#define SSL_set0_verify_cert_store wolfSSL_set0_verify_cert_store +#define SSL_set1_verify_cert_store wolfSSL_set1_verify_cert_store +#define SSL_CTX_get_cert_store(x) wolfSSL_CTX_get_cert_store ((x)) +#define SSL_get_client_CA_list wolfSSL_get_client_CA_list +#define SSL_set_client_CA_list wolfSSL_set_client_CA_list +#define SSL_get_ex_data_X509_STORE_CTX_idx wolfSSL_get_ex_data_X509_STORE_CTX_idx +#define SSL_get_ex_data wolfSSL_get_ex_data + +#define SSL_CTX_set_default_passwd_cb_userdata wolfSSL_CTX_set_default_passwd_cb_userdata +#define SSL_CTX_set_default_passwd_cb wolfSSL_CTX_set_default_passwd_cb + +#define SSL_CTX_set_timeout(ctx, to) \ + wolfSSL_CTX_set_timeout(ctx, (unsigned int)(to)) +#define SSL_CTX_set_info_callback wolfSSL_CTX_set_info_callback +#define SSL_set_info_callback wolfSSL_set_info_callback +#define SSL_CTX_set_alpn_protos wolfSSL_CTX_set_alpn_protos + +#define SSL_CTX_keylog_cb_func wolfSSL_CTX_keylog_cb_func +#define SSL_CTX_set_keylog_callback wolfSSL_CTX_set_keylog_callback +#define SSL_CTX_get_keylog_callback wolfSSL_CTX_get_keylog_callback + +#define SSL_alert_type_string wolfSSL_alert_type_string +#define SSL_alert_desc_string wolfSSL_alert_desc_string +#define SSL_state_string wolfSSL_state_string_long + +#define RSA_free wolfSSL_RSA_free +#define RSA_generate_key wolfSSL_RSA_generate_key +#define SSL_CTX_set_tmp_rsa_callback wolfSSL_CTX_set_tmp_rsa_callback +#define RSA_print wolfSSL_RSA_print +#define RSA_print_fp wolfSSL_RSA_print_fp +#define RSA_bits wolfSSL_RSA_bits +#define RSA_up_ref wolfSSL_RSA_up_ref +#define RSA_padding_add_PKCS1_PSS_mgf1 wolfSSL_RSA_padding_add_PKCS1_PSS_mgf1 +#define RSA_padding_add_PKCS1_PSS wolfSSL_RSA_padding_add_PKCS1_PSS +#define RSA_verify_PKCS1_PSS_mgf1 wolfSSL_RSA_verify_PKCS1_PSS_mgf1 +#define RSA_verify_PKCS1_PSS wolfSSL_RSA_verify_PKCS1_PSS + +#define PEM_def_callback wolfSSL_PEM_def_callback + +#define SSL_CTX_sess_accept wolfSSL_CTX_sess_accept +#define SSL_CTX_sess_connect wolfSSL_CTX_sess_connect +#define SSL_CTX_sess_accept_good wolfSSL_CTX_sess_accept_good +#define SSL_CTX_sess_connect_good wolfSSL_CTX_sess_connect_good +#define SSL_CTX_sess_accept_renegotiate wolfSSL_CTX_sess_accept_renegotiate +#define SSL_CTX_sess_connect_renegotiate wolfSSL_CTX_sess_connect_renegotiate +#define SSL_CTX_sess_hits wolfSSL_CTX_sess_hits +#define SSL_CTX_sess_cb_hits wolfSSL_CTX_sess_cb_hits +#define SSL_CTX_sess_cache_full wolfSSL_CTX_sess_cache_full +#define SSL_CTX_sess_misses wolfSSL_CTX_sess_misses +#define SSL_CTX_sess_timeouts wolfSSL_CTX_sess_timeouts +#define SSL_CTX_sess_number wolfSSL_CTX_sess_number +#define SSL_CTX_sess_get_cache_size wolfSSL_CTX_sess_get_cache_size + + +#define SSL_DEFAULT_CIPHER_LIST WOLFSSL_DEFAULT_CIPHER_LIST + +#define SSL_CTX_set_psk_client_callback wolfSSL_CTX_set_psk_client_callback +#define SSL_set_psk_client_callback wolfSSL_set_psk_client_callback + +#define SSL_get_psk_identity_hint wolfSSL_get_psk_identity_hint +#define SSL_get_psk_identity wolfSSL_get_psk_identity + +#define SSL_CTX_use_psk_identity_hint wolfSSL_CTX_use_psk_identity_hint +#define SSL_use_psk_identity_hint wolfSSL_use_psk_identity_hint + +#define SSL_CTX_set_psk_server_callback wolfSSL_CTX_set_psk_server_callback +#define SSL_set_psk_server_callback wolfSSL_set_psk_server_callback + +#if !defined(USE_WINDOWS_API) && !defined(INVALID_SOCKET) + #define INVALID_SOCKET (-1) +#endif + +/* system file ints for ERR_put_error */ +#define SYS_F_ACCEPT WOLFSSL_SYS_ACCEPT +#define SYS_F_BIND WOLFSSL_SYS_BIND +#define SYS_F_CONNECT WOLFSSL_SYS_CONNECT +#define SYS_F_FOPEN WOLFSSL_SYS_FOPEN +#define SYS_F_FREAD WOLFSSL_SYS_FREAD +#define SYS_F_GETADDRINFO WOLFSSL_SYS_GETADDRINFO +#define SYS_F_GETSOCKOPT WOLFSSL_SYS_GETSOCKOPT +#define SYS_F_GETSOCKNAME WOLFSSL_SYS_GETSOCKNAME +#define SYS_F_OPENDIR WOLFSSL_SYS_OPENDIR +#define SYS_F_SETSOCKOPT WOLFSSL_SYS_SETSOCKOPT +#define SYS_F_SOCKET WOLFSSL_SYS_SOCKET +#define SYS_F_GETHOSTBYNAME WOLFSSL_SYS_GETHOSTBYNAME +#define SYS_F_GETNAMEINFO WOLFSSL_SYS_GETNAMEINFO +#define SYS_F_GETSERVBYNAME WOLFSSL_SYS_GETSERVBYNAME +#define SYS_F_IOCTLSOCKET WOLFSSL_SYS_IOCTLSOCKET +#define SYS_F_LISTEN WOLFSSL_SYS_LISTEN + +#define ERR_GET_LIB wolfSSL_ERR_GET_LIB +#define ERR_GET_REASON wolfSSL_ERR_GET_REASON + +#define ERR_put_error wolfSSL_ERR_put_error +#define ERR_peek_error wolfSSL_ERR_peek_error +#define ERR_peek_errors_fp wolfSSL_ERR_peek_errors_fp +#define ERR_peek_error_line_data wolfSSL_ERR_peek_error_line_data +#define ERR_peek_last_error wolfSSL_ERR_peek_last_error +#define ERR_peek_last_error_line wolfSSL_ERR_peek_last_error_line +#define ERR_get_error_line wolfSSL_ERR_get_error_line +#define ERR_get_error_line_data wolfSSL_ERR_get_error_line_data +#define ERR_get_error wolfSSL_ERR_get_error +#define ERR_print_errors_fp(file) wolfSSL_ERR_dump_errors_fp((file)) +#define ERR_print_errors_cb wolfSSL_ERR_print_errors_cb +#define ERR_print_errors wolfSSL_ERR_print_errors +#define ERR_clear_error wolfSSL_ERR_clear_error +#define ERR_free_strings wolfSSL_ERR_free_strings +#define ERR_remove_state wolfSSL_ERR_remove_state +#define ERR_remove_thread_state wolfSSL_ERR_remove_thread_state +#define ERR_error_string wolfSSL_ERR_error_string +#define ERR_error_string_n wolfSSL_ERR_error_string_n +#define ERR_reason_error_string wolfSSL_ERR_reason_error_string +#define ERR_func_error_string wolfSSL_ERR_func_error_string +#define ERR_lib_error_string wolfSSL_ERR_lib_error_string +#define ERR_load_BIO_strings wolfSSL_ERR_load_BIO_strings + +#define PEMerr(func, reason) WOLFSSL_PEMerr(func, reason) +#define EVPerr(func, reason) WOLFSSL_EVPerr(func, reason) + +#define SSLv23_server_method wolfSSLv23_server_method +#define SSL_CTX_set_options wolfSSL_CTX_set_options +#define SSL_CTX_get_options wolfSSL_CTX_get_options +#define SSL_CTX_clear_options wolfSSL_CTX_clear_options + +#define SSL_CTX_check_private_key wolfSSL_CTX_check_private_key +#define SSL_CTX_get0_privatekey wolfSSL_CTX_get0_privatekey +#define SSL_check_private_key wolfSSL_check_private_key + +#define SSL_CTX_set_mode wolfSSL_CTX_set_mode +#define SSL_CTX_clear_mode wolfSSL_CTX_clear_mode +#define SSL_CTX_get_mode wolfSSL_CTX_get_mode +#define SSL_CTX_set_default_read_ahead wolfSSL_CTX_set_default_read_ahead + +#define SSL_CTX_sess_set_cache_size wolfSSL_CTX_sess_set_cache_size +#define SSL_CTX_set_default_verify_paths wolfSSL_CTX_set_default_verify_paths +#define X509_get_default_cert_file_env wolfSSL_X509_get_default_cert_file_env +#define X509_get_default_cert_file wolfSSL_X509_get_default_cert_file +#define X509_get_default_cert_dir_env wolfSSL_X509_get_default_cert_dir_env +#define X509_get_default_cert_dir wolfSSL_X509_get_default_cert_dir + +#define SSL_CTX_set_session_id_context wolfSSL_CTX_set_session_id_context +#define SSL_get_peer_certificate wolfSSL_get_peer_certificate +#define SSL_get_peer_cert_chain wolfSSL_get_peer_cert_chain + +#define SSL_want wolfSSL_want +#define SSL_want_read wolfSSL_want_read +#define SSL_want_write wolfSSL_want_write + +#define BIO_prf wolfSSL_BIO_prf + +#define sk_num wolfSSL_sk_num +#define sk_ASN1_OBJECT_num wolfSSL_sk_num +#define OPENSSL_sk_num wolfSSL_sk_num +#define sk_value wolfSSL_sk_value +#define sk_ASN1_OBJECT_value wolfSSL_sk_value +#define OPENSSL_sk_value wolfSSL_sk_value + +#define d2i_PKCS12_bio wolfSSL_d2i_PKCS12_bio +#define d2i_PKCS12_fp wolfSSL_d2i_PKCS12_fp +#define i2d_PKCS12_bio wolfSSL_i2d_PKCS12_bio + +#define d2i_RSAPublicKey wolfSSL_d2i_RSAPublicKey +#define d2i_RSAPrivateKey wolfSSL_d2i_RSAPrivateKey +#define i2d_RSAPrivateKey wolfSSL_i2d_RSAPrivateKey +#define i2d_RSAPublicKey wolfSSL_i2d_RSAPublicKey + +#define SSL_CTX_get_ex_data wolfSSL_CTX_get_ex_data +#define SSL_CTX_set_ex_data wolfSSL_CTX_set_ex_data +#define SSL_CTX_sess_set_get_cb wolfSSL_CTX_sess_set_get_cb +#define SSL_CTX_sess_set_new_cb wolfSSL_CTX_sess_set_new_cb +#define SSL_CTX_sess_set_remove_cb wolfSSL_CTX_sess_set_remove_cb + +#define i2d_SSL_SESSION wolfSSL_i2d_SSL_SESSION +#define d2i_SSL_SESSION wolfSSL_d2i_SSL_SESSION +#define SSL_SESSION_has_ticket wolfSSL_SESSION_has_ticket +#define SSL_SESSION_get_ticket_lifetime_hint \ + wolfSSL_SESSION_get_ticket_lifetime_hint +#define SSL_SESSION_set_timeout wolfSSL_SSL_SESSION_set_timeout +#define SSL_SESSION_get_timeout wolfSSL_SESSION_get_timeout +#define SSL_SESSION_set_time wolfSSL_SESSION_set_time +#define SSL_SESSION_get_time wolfSSL_SESSION_get_time + +#define SSL_CTX_get_ex_new_index wolfSSL_CTX_get_ex_new_index +#define PEM_read wolfSSL_PEM_read +#define PEM_write wolfSSL_PEM_write +#define PEM_get_EVP_CIPHER_INFO wolfSSL_PEM_get_EVP_CIPHER_INFO +#define PEM_do_header wolfSSL_PEM_do_header + +/*#if OPENSSL_API_COMPAT < 0x10100000L*/ +#define CONF_modules_free() WC_DO_NOTHING +#define ENGINE_cleanup() WC_DO_NOTHING +#define SSL_CTX_need_tmp_RSA(ctx) 0 +#define SSL_CTX_set_tmp_rsa(ctx,rsa) 1 +#define SSL_need_tmp_RSA(ssl) 0 +#define SSL_set_tmp_rsa(ssl,rsa) 1 +/*#endif*/ + +#define CONF_modules_unload(a) WC_DO_NOTHING +#define CONF_get1_default_config_file wolfSSL_CONF_get1_default_config_file + +#define SSL_get_hit wolfSSL_session_reused + +/* yassl had set the default to be 500 */ +#define SSL_get_default_timeout(ctx) 500 + +#define DTLSv1_get_timeout(ssl, timeleft) wolfSSL_DTLSv1_get_timeout((ssl), (WOLFSSL_TIMEVAL*)(timeleft)) +#define DTLSv1_handle_timeout wolfSSL_DTLSv1_handle_timeout +#define DTLSv1_set_initial_timeout_duration wolfSSL_DTLSv1_set_initial_timeout_duration +#define SSL_set_mtu wolfSSL_set_mtu_compat + +/* DTLS SRTP */ +#ifdef WOLFSSL_SRTP +typedef WOLFSSL_SRTP_PROTECTION_PROFILE SRTP_PROTECTION_PROFILE; +#endif +#define SSL_CTX_set_tlsext_use_srtp wolfSSL_CTX_set_tlsext_use_srtp +#define SSL_set_tlsext_use_srtp wolfSSL_set_tlsext_use_srtp +#define SSL_get_selected_srtp_profile wolfSSL_get_selected_srtp_profile +#define SSL_get_srtp_profiles wolfSSL_get_srtp_profiles + +#ifndef NO_WOLFSSL_STUB +#define SSL_CTX_set_current_time_cb(ssl, cb) ({ (void)(ssl); (void)(cb); }) +#endif + +#define SSL_CTX_use_certificate wolfSSL_CTX_use_certificate +#define SSL_CTX_add0_chain_cert wolfSSL_CTX_add0_chain_cert +#define SSL_CTX_add1_chain_cert wolfSSL_CTX_add1_chain_cert +#define SSL_add0_chain_cert wolfSSL_add0_chain_cert +#define SSL_add1_chain_cert wolfSSL_add1_chain_cert +#define SSL_CTX_use_PrivateKey wolfSSL_CTX_use_PrivateKey +#define BIO_read_filename wolfSSL_BIO_read_filename +#define SSL_CTX_set_verify_depth wolfSSL_CTX_set_verify_depth +#define SSL_set_verify_depth wolfSSL_set_verify_depth +#define SSL_get_app_data wolfSSL_get_app_data +#define SSL_set_app_data wolfSSL_set_app_data +#define SHA1 wolfSSL_SHA1 + +#define SSL_dup_CA_list wolfSSL_dup_CA_list + +#define sk_X509_NAME_find wolfSSL_sk_X509_NAME_find + +#define DHparams_dup wolfSSL_DH_dup +#define PEM_read_bio_DHparams wolfSSL_PEM_read_bio_DHparams +#define PEM_read_DHparams wolfSSL_PEM_read_DHparams +#define PEM_read_bio_DSAparams wolfSSL_PEM_read_bio_DSAparams + +#if defined(OPENSSL_ALL) || defined(WOLFSSL_HAPROXY) +#define SSL_get_rbio wolfSSL_SSL_get_rbio +#define SSL_get_wbio wolfSSL_SSL_get_wbio +#define SSL_do_handshake wolfSSL_SSL_do_handshake +#define SSL_get_ciphers(x) wolfSSL_get_ciphers_compat(x) +#define SSL_SESSION_get_id wolfSSL_SESSION_get_id +#define SSL_get_cipher_bits(s,np) \ + wolfSSL_CIPHER_get_bits(SSL_get_current_cipher(s),np) +#define sk_SSL_CIPHER_num wolfSSL_sk_SSL_CIPHER_num +#define sk_SSL_COMP_zero wolfSSL_sk_SSL_COMP_zero +#define sk_SSL_CIPHER_value wolfSSL_sk_SSL_CIPHER_value +#endif /* OPENSSL_ALL || WOLFSSL_HAPROXY */ +#define sk_SSL_CIPHER_dup wolfSSL_sk_dup +#define sk_SSL_CIPHER_free wolfSSL_sk_SSL_CIPHER_free +#define sk_SSL_CIPHER_find wolfSSL_sk_SSL_CIPHER_find + +#if defined(SESSION_CERTS) && defined(OPENSSL_EXTRA) +#define SSL_get0_peername wolfSSL_get0_peername +#endif + +#if defined(OPENSSL_ALL) || defined(WOLFSSL_ASIO) || defined(WOLFSSL_HAPROXY) \ + || defined(WOLFSSL_NGINX) +#include <wolfssl/openssl/pem.h> + +#define SSL_CTRL_CHAIN 88 +#define SSL_R_SHORT_READ 10 +#define ERR_R_PEM_LIB 9 +#define SSL_CTRL_MODE 33 +#define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS 83 + +#define SSL_CTX_clear_chain_certs(ctx) SSL_CTX_set0_chain(ctx,NULL) +#define d2i_RSAPrivateKey_bio wolfSSL_d2i_RSAPrivateKey_bio +#define SSL_CTX_use_RSAPrivateKey wolfSSL_CTX_use_RSAPrivateKey +#define d2i_PrivateKey_bio wolfSSL_d2i_PrivateKey_bio +#define BIO_new_bio_pair wolfSSL_BIO_new_bio_pair +#define SSL_get_verify_callback wolfSSL_get_verify_callback + +#define SSL_set_mode(ssl,op) wolfSSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL) + +#define SSL_CTX_use_certificate_ASN1 wolfSSL_CTX_use_certificate_ASN1 +#define SSL_CTX_set0_chain(ctx,sk) \ + wolfSSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,0,(char *)(sk)) +#define SSL_CTX_get_app_data(ctx) wolfSSL_CTX_get_ex_data(ctx,0) +#define SSL_CTX_set_app_data(ctx,arg) wolfSSL_CTX_set_ex_data(ctx,0, \ + (char *)(arg)) +#endif /* OPENSSL_ALL || WOLFSSL_ASIO || WOLFSSL_HAPROXY */ + +#define SSL_CTX_set_dh_auto wolfSSL_CTX_set_dh_auto +#define SSL_CTX_set_tmp_dh wolfSSL_CTX_set_tmp_dh + +#define TLSEXT_STATUSTYPE_ocsp WOLFSSL_TLSEXT_STATUSTYPE_ocsp + +#define TLSEXT_max_fragment_length_DISABLED WOLFSSL_MFL_DISABLED +#define TLSEXT_max_fragment_length_512 WOLFSSL_MFL_2_9 +#define TLSEXT_max_fragment_length_1024 WOLFSSL_MFL_2_10 +#define TLSEXT_max_fragment_length_2048 WOLFSSL_MFL_2_11 +#define TLSEXT_max_fragment_length_4096 WOLFSSL_MFL_2_12 + +#define SSL_set_options wolfSSL_set_options +#define SSL_get_options wolfSSL_get_options +#define SSL_clear_options wolfSSL_clear_options +#define SSL_set_tmp_dh wolfSSL_set_tmp_dh +#define SSL_clear_num_renegotiations wolfSSL_clear_num_renegotiations +#define SSL_total_renegotiations wolfSSL_total_renegotiations +#define SSL_num_renegotiations wolfSSL_num_renegotiations +#define SSL_renegotiate wolfSSL_Rehandshake +#define SSL_get_secure_renegotiation_support wolfSSL_SSL_get_secure_renegotiation_support +#define SSL_renegotiate_pending wolfSSL_SSL_renegotiate_pending +#define SSL_set_tlsext_debug_arg wolfSSL_set_tlsext_debug_arg +#define SSL_set_tlsext_status_type wolfSSL_set_tlsext_status_type +#define SSL_get_tlsext_status_type wolfSSL_get_tlsext_status_type +#define SSL_set_tlsext_status_exts wolfSSL_set_tlsext_status_exts +#define SSL_get_tlsext_status_ids wolfSSL_get_tlsext_status_ids +#define SSL_set_tlsext_status_ids wolfSSL_set_tlsext_status_ids +#define SSL_get_tlsext_status_ocsp_res wolfSSL_get_tlsext_status_ocsp_resp +#define SSL_set_tlsext_status_ocsp_res wolfSSL_set_tlsext_status_ocsp_resp +#define SSL_set_tlsext_status_ocsp_resp wolfSSL_set_tlsext_status_ocsp_resp +#define SSL_get_tlsext_status_ocsp_resp wolfSSL_get_tlsext_status_ocsp_resp +#define SSL_set_tlsext_max_fragment_length wolfSSL_set_tlsext_max_fragment_length + +#define SSL_CTX_add_extra_chain_cert wolfSSL_CTX_add_extra_chain_cert +#define SSL_get_read_ahead wolfSSL_get_read_ahead +#define SSL_set_read_ahead wolfSSL_set_read_ahead +#define SSL_CTX_get_read_ahead wolfSSL_CTX_get_read_ahead +#define SSL_CTX_set_read_ahead wolfSSL_CTX_set_read_ahead +#define SSL_CTX_set_tlsext_status_arg wolfSSL_CTX_set_tlsext_status_arg +#define SSL_CTX_set_tlsext_opaque_prf_input_callback_arg \ + wolfSSL_CTX_set_tlsext_opaque_prf_input_callback_arg +#define SSL_CTX_set_tlsext_max_fragment_length \ + wolfSSL_CTX_set_tlsext_max_fragment_length +#define SSL_get_server_random wolfSSL_get_server_random +#define SSL_get_server_tmp_key wolfSSL_get_peer_tmp_key +#define SSL_get_peer_tmp_key wolfSSL_get_peer_tmp_key + +#define SSL_CTX_set_min_proto_version wolfSSL_CTX_set_min_proto_version +#define SSL_CTX_set_max_proto_version wolfSSL_CTX_set_max_proto_version +#define SSL_set_min_proto_version wolfSSL_set_min_proto_version +#define SSL_set_max_proto_version wolfSSL_set_max_proto_version +#define SSL_CTX_get_min_proto_version wolfSSL_CTX_get_min_proto_version +#define SSL_CTX_get_max_proto_version wolfSSL_CTX_get_max_proto_version + +#define SSL_get_tlsext_status_exts wolfSSL_get_tlsext_status_exts + +#define SSL_CTX_get_tlsext_ticket_keys wolfSSL_CTX_get_tlsext_ticket_keys +#define SSL_CTX_set_tlsext_ticket_keys wolfSSL_CTX_set_tlsext_ticket_keys +#define SSL_CTX_get_tlsext_status_cb wolfSSL_CTX_get_tlsext_status_cb +#define SSL_CTX_set_tlsext_status_cb wolfSSL_CTX_set_tlsext_status_cb +#define SSL_CTX_set_num_tickets wolfSSL_CTX_set_num_tickets +#define SSL_CTX_get_num_tickets wolfSSL_CTX_get_num_tickets + +#define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS 11 +#define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS 12 +#define SSL_CTRL_SET_TMP_DH 3 +#define SSL_CTRL_SET_TMP_ECDH 4 +#define SSL_CTRL_SET_SESS_CACHE_MODE 44 +#define SSL_CTRL_SET_TLSEXT_DEBUG_ARG 57 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE 65 +#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE 651 +#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS 66 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS 67 +#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS 68 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS 69 +#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP 70 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP 71 +#define SSL_CTRL_SET_GROUPS 91 +#define SSL_CTRL_GET_PEER_TMP_KEY 109 +#define SSL_CTRL_GET_SERVER_TMP_KEY SSL_CTRL_GET_PEER_TMP_KEY +#define SSL_CTRL_GET_CHAIN_CERTS 115 +#define SSL_CTRL_SET_MIN_PROTO_VERSION 123 +#define SSL_CTRL_SET_MAX_PROTO_VERSION 124 +#define SSL_CTRL_GET_MIN_PROTO_VERSION 125 +#define SSL_CTRL_GET_MAX_PROTO_VERSION 126 +#define SSL_CTRL_SET_CURVES SSL_CTRL_SET_GROUPS + +#define SSL_CTRL_EXTRA_CHAIN_CERT 14 +#define SSL_CTRL_OPTIONS 32 + +#define SSL_CTRL_SET_SESS_CACHE_SIZE 42 +#define SSL_CTRL_GET_READ_AHEAD 40 +#define SSL_CTRL_SET_READ_AHEAD 41 + +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB 63 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG 64 + +#define SSL_CTRL_GET_EXTRA_CHAIN_CERTS 82 +#define SSL_CTRL_GET_SESSION_REUSED 0 + +#define SSL_ctrl wolfSSL_ctrl +#define SSL_CTX_ctrl wolfSSL_CTX_ctrl +#define SSL_CTX_callback_ctrl wolfSSL_CTX_callback_ctrl + +#define SSL3_RANDOM_SIZE 32 /* same as RAN_LEN in internal.h */ + +#ifndef WOLFSSL_ALLOW_SSLV3 + #undef OPENSSL_NO_SSL3 + #define OPENSSL_NO_SSL3 +#endif + +/* Used as message callback types */ +#define SSL3_RT_CHANGE_CIPHER_SPEC 20 +#define SSL3_RT_ALERT 21 +#define SSL3_RT_HANDSHAKE 22 +#define SSL3_RT_APPLICATION_DATA 23 + +#define OPENSSL_INIT_LOAD_SSL_STRINGS 0x00200000L +#define OPENSSL_INIT_LOAD_CRYPTO_STRINGS 0x00000002L + +#define TLS_ANY_VERSION 0x10000 +#define DTLS1_2_VERSION 0xFEFD +#define DTLS_MAX_VERSION DTLS1_2_VERSION + +/* apache and lighty use SSL_CONF_FLAG_FILE to enable conf support */ +#define SSL_CONF_FLAG_CMDLINE WOLFSSL_CONF_FLAG_CMDLINE +#define SSL_CONF_FLAG_FILE WOLFSSL_CONF_FLAG_FILE +#define SSL_CONF_FLAG_CERTIFICATE WOLFSSL_CONF_FLAG_CERTIFICATE +#define SSL_CONF_FLAG_SERVER WOLFSSL_CONF_FLAG_SERVER +#define SSL_CONF_FLAG_CLIENT WOLFSSL_CONF_FLAG_CLIENT +#define SSL_CONF_FLAG_SHOW_ERRORS WOLFSSL_CONF_FLAG_SHOW_ERRORS +#define SSL_CONF_TYPE_UNKNOWN WOLFSSL_CONF_TYPE_UNKNOWN +#define SSL_CONF_TYPE_STRING WOLFSSL_CONF_TYPE_STRING +#define SSL_CONF_TYPE_FILE WOLFSSL_CONF_TYPE_FILE +#define SSL_CONF_TYPE_DIR WOLFSSL_CONF_TYPE_DIR + +#define OPENSSL_INIT_new wolfSSL_OPENSSL_INIT_new +#define OPENSSL_INIT_free wolfSSL_OPENSSL_INIT_free +#define OPENSSL_INIT_set_config_appname wolfSSL_OPENSSL_INIT_set_config_appname + +#if defined(HAVE_STUNNEL) || defined(WOLFSSL_NGINX) || \ + defined(WOLFSSL_HAPROXY) || defined(OPENSSL_EXTRA) || defined(OPENSSL_ALL) + +#define SSL23_ST_SR_CLNT_HELLO_A (0x210|0x2000) +#define SSL3_ST_SR_CLNT_HELLO_A (0x110|0x2000) + +#define SSL3_AD_BAD_CERTIFICATE bad_certificate +#define SSL_AD_BAD_CERTIFICATE SSL3_AD_BAD_CERTIFICATE +#define SSL_AD_UNRECOGNIZED_NAME WOLFSSL_AD_UNRECOGNIZED_NAME +#define SSL_AD_NO_RENEGOTIATION no_renegotiation +#define SSL_AD_INTERNAL_ERROR 80 +#define SSL_AD_NO_APPLICATION_PROTOCOL no_application_protocol +#define SSL_AD_MISSING_EXTENSION missing_extension + +#define SSL_MAX_MASTER_KEY_LENGTH WOLFSSL_MAX_MASTER_KEY_LENGTH + +#define SSL_alert_desc_string_long wolfSSL_alert_desc_string_long +#define SSL_alert_type_string_long wolfSSL_alert_type_string_long +#define SSL_CIPHER_get_bits wolfSSL_CIPHER_get_bits +#define sk_GENERAL_NAME_num wolfSSL_sk_GENERAL_NAME_num +#define SSL_CTX_get_options wolfSSL_CTX_get_options + +#define SSL_CTX_flush_sessions wolfSSL_flush_sessions +#define SSL_CTX_add_session wolfSSL_CTX_add_session +#define SSL_version(x) wolfSSL_version ((WOLFSSL*) (x)) +#define SSL_get_state wolfSSL_get_state +#define SSL_state_string_long wolfSSL_state_string_long + +#define GENERAL_NAME_new wolfSSL_GENERAL_NAME_new +#define GENERAL_NAME_free wolfSSL_GENERAL_NAME_free +#define GENERAL_NAME_dup wolfSSL_GENERAL_NAME_dup +#define GENERAL_NAME_print wolfSSL_GENERAL_NAME_print +#define GENERAL_NAME_set0_othername wolfSSL_GENERAL_NAME_set0_othername +#define GENERAL_NAME_set0_value wolfSSL_GENERAL_NAME_set0_value +#define sk_GENERAL_NAME_push wolfSSL_sk_GENERAL_NAME_push +#define sk_GENERAL_NAME_value wolfSSL_sk_GENERAL_NAME_value + +#define DIST_POINT_new wolfSSL_DIST_POINT_new +#define DIST_POINT_free wolfSSL_DIST_POINT_free +#define DIST_POINTS_free wolfSSL_DIST_POINTS_free +#define CRL_DIST_POINTS_free(cdp) wolfSSL_sk_DIST_POINT_pop_free((cdp), NULL) +#define sk_DIST_POINT_push wolfSSL_sk_DIST_POINT_push +#define sk_DIST_POINT_value wolfSSL_sk_DIST_POINT_value +#define sk_DIST_POINT_num wolfSSL_sk_DIST_POINT_num +#define sk_DIST_POINT_pop_free wolfSSL_sk_DIST_POINT_pop_free +#define sk_DIST_POINT_free wolfSSL_sk_DIST_POINT_free + +#define SSL_SESSION_get_ex_data wolfSSL_SESSION_get_ex_data +#define SSL_SESSION_set_ex_data wolfSSL_SESSION_set_ex_data +#define SSL_SESSION_get_ex_new_index wolfSSL_SESSION_get_ex_new_index +#define SSL_SESSION_get_id wolfSSL_SESSION_get_id +#define SSL_SESSION_get0_id_context wolfSSL_SESSION_get0_id_context +#define SSL_SESSION_set1_id wolfSSL_SESSION_set1_id +#define SSL_SESSION_set1_id_context wolfSSL_SESSION_set1_id_context +#define SSL_SESSION_print wolfSSL_SESSION_print +#define sk_GENERAL_NAME_pop_free wolfSSL_sk_GENERAL_NAME_pop_free +#define sk_GENERAL_NAME_new wolfSSL_sk_GENERAL_NAME_new +#define sk_GENERAL_NAME_free wolfSSL_sk_GENERAL_NAME_free +#define sk_ASN1_OBJECT_pop_free wolfSSL_sk_ASN1_OBJECT_pop_free +#define GENERAL_NAME_free wolfSSL_GENERAL_NAME_free +#define GENERAL_NAMES_free wolfSSL_GENERAL_NAMES_free +#define EXTENDED_KEY_USAGE_free wolfSSL_EXTENDED_KEY_USAGE_free + +#define AUTHORITY_INFO_ACCESS_free wolfSSL_AUTHORITY_INFO_ACCESS_free +#define AUTHORITY_INFO_ACCESS_pop_free wolfSSL_AUTHORITY_INFO_ACCESS_pop_free +#define sk_ACCESS_DESCRIPTION_pop_free wolfSSL_sk_ACCESS_DESCRIPTION_pop_free +#define sk_ACCESS_DESCRIPTION_free wolfSSL_sk_ACCESS_DESCRIPTION_free +#define ACCESS_DESCRIPTION_free wolfSSL_ACCESS_DESCRIPTION_free + +/* Alert types, matched to AlertDescription enum in wolfssl/ssl.h */ +#define SSL_AD_CLOSE_NOTIFY close_notify +#define SSL_AD_UNEXPECTED_MESSAGE unexpected_message +#define SSL_AD_BAD_RECORD_MAC bad_record_mac +#define SSL_AD_RECORD_OVERFLOW record_overflow +#define SSL_AD_DECOMPRESSION_FAILURE decompression_failure +#define SSL_AD_HANDSHAKE_FAILURE handshake_failure +#define SSL_AD_UNSUPPORTED_CERTIFICATE unsupported_certificate +#define SSL_AD_CERTIFICATE_REVOKED certificate_revoked +#define SSL_AD_CERTIFICATE_EXPIRED certificate_expired +#define SSL_AD_CERTIFICATE_UNKNOWN certificate_unknown +#define SSL_AD_ILLEGAL_PARAMETER illegal_parameter +#define SSL_AD_UNKNOWN_CA unknown_ca +#define SSL_AD_ACCESS_DENIED access_denied +#define SSL_AD_DECODE_ERROR decode_error +#define SSL_AD_DECRYPT_ERROR decrypt_error +#ifdef WOLFSSL_MYSQL_COMPATIBLE + #define SSL_AD_PROTOCOL_VERSION wc_protocol_version +#else + #define SSL_AD_PROTOCOL_VERSION protocol_version +#endif +#define SSL_AD_INSUFFICIENT_SECURITY insufficient_security +#define SSL_AD_USER_CANCELLED user_canceled + +#define SSL3_AL_FATAL 2 +#define SSL_TLSEXT_ERR_OK 0 +#define SSL_TLSEXT_ERR_ALERT_WARNING warning_return +#define SSL_TLSEXT_ERR_ALERT_FATAL fatal_return +#define SSL_TLSEXT_ERR_NOACK noack_return +#define TLSEXT_NAMETYPE_host_name WOLFSSL_SNI_HOST_NAME + +#define SSL_set_tlsext_host_name wolfSSL_set_tlsext_host_name +#define SSL_get_servername wolfSSL_get_servername +#define SSL_set_SSL_CTX wolfSSL_set_SSL_CTX +#define SSL_CTX_get_verify_callback wolfSSL_CTX_get_verify_callback +#define SSL_CTX_set_tlsext_servername_callback wolfSSL_CTX_set_tlsext_servername_callback +#define SSL_CTX_set_tlsext_servername_arg wolfSSL_CTX_set_servername_arg + +#define PSK_MAX_PSK_LEN 256 +#define PSK_MAX_IDENTITY_LEN 128 +#define SSL_CTX_clear_options wolfSSL_CTX_clear_options + +#define SSL_CTX_add_server_custom_ext(ctx, ext_type, add_cb, free_cb, add_arg, parse_cb, parse_arg) 0 + +#define SSL_get0_verified_chain wolfSSL_get0_verified_chain +#define X509_chain_up_ref wolfSSL_X509_chain_up_ref + +#endif /* HAVE_STUNNEL || WOLFSSL_NGINX */ + +#ifndef NO_WOLFSSL_STUB +#define b2i_PrivateKey_bio(in) NULL +#define b2i_PVK_bio(in, cb, u) NULL +#endif + +#define SSL_CTX_get_default_passwd_cb wolfSSL_CTX_get_default_passwd_cb +#define SSL_CTX_get_default_passwd_cb_userdata wolfSSL_CTX_get_default_passwd_cb_userdata + +#define SSL_CTX_set_msg_callback wolfSSL_CTX_set_msg_callback +#define SSL_set_msg_callback wolfSSL_set_msg_callback +#define SSL_CTX_set_msg_callback_arg wolfSSL_CTX_set_msg_callback_arg +#define SSL_set_msg_callback_arg wolfSSL_set_msg_callback_arg + +#define SSL_CTX_clear_extra_chain_certs wolfSSL_CTX_clear_extra_chain_certs + +#define SSL_certs_clear wolfSSL_certs_clear + +/* Nginx uses this to determine if reached end of certs in file. + * PEM_read_bio_X509 is called and the return error is lost. + * The error that needs to be detected is: SSL_NO_PEM_HEADER. + */ +#define ERR_GET_FUNC(l) (int)((((unsigned long)(l)) >> 12L) & 0xfffL) + +#define PEM_F_PEM_DEF_CALLBACK 100 + +#include <wolfssl/error-ssl.h> + +#define PEM_R_NO_START_LINE (-WOLFSSL_PEM_R_NO_START_LINE_E) +#define PEM_R_PROBLEMS_GETTING_PASSWORD (-WOLFSSL_PEM_R_PROBLEMS_GETTING_PASSWORD_E) +#define PEM_R_BAD_PASSWORD_READ (-WOLFSSL_PEM_R_BAD_PASSWORD_READ_E) +#define PEM_R_BAD_DECRYPT (-WOLFSSL_PEM_R_BAD_DECRYPT_E) +#define ASN1_R_HEADER_TOO_LONG (-WOLFSSL_ASN1_R_HEADER_TOO_LONG_E) + +#define ERR_LIB_SYS WOLFSSL_ERR_LIB_SYS +#define ERR_LIB_RSA WOLFSSL_ERR_LIB_RSA +#define ERR_LIB_PEM WOLFSSL_ERR_LIB_PEM +#define ERR_LIB_X509 WOLFSSL_ERR_LIB_X509 +#define ERR_LIB_EVP WOLFSSL_ERR_LIB_EVP +#define ERR_LIB_ASN1 WOLFSSL_ERR_LIB_ASN1 +#define ERR_LIB_DIGEST WOLFSSL_ERR_LIB_DIGEST +#define ERR_LIB_CIPHER WOLFSSL_ERR_LIB_CIPHER +#define ERR_LIB_USER WOLFSSL_ERR_LIB_USER +#define ERR_LIB_EC WOLFSSL_ERR_LIB_EC +#define ERR_LIB_SSL WOLFSSL_ERR_LIB_SSL +#define ERR_LIB_PKCS12 WOLFSSL_ERR_LIB_PKCS12 + +#if defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) || \ + defined(WOLFSSL_MYSQL_COMPATIBLE) || defined(OPENSSL_EXTRA) || \ + defined(HAVE_LIGHTY) || defined(HAVE_STUNNEL) || \ + defined(WOLFSSL_WPAS_SMALL) + +#define OPENSSL_STRING WOLFSSL_STRING +#define OPENSSL_CSTRING WOLFSSL_STRING + +#define TLSEXT_TYPE_application_layer_protocol_negotiation \ + TLSXT_APPLICATION_LAYER_PROTOCOL + +#define OPENSSL_NPN_UNSUPPORTED WOLFSSL_NPN_UNSUPPORTED +#define OPENSSL_NPN_NEGOTIATED WOLFSSL_NPN_NEGOTIATED +#define OPENSSL_NPN_NO_OVERLAP WOLFSSL_NPN_NO_OVERLAP + +/* Nginx checks these to see if the error was a handshake error. */ +#define SSL_R_BAD_CHANGE_CIPHER_SPEC LENGTH_ERROR +#define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG BUFFER_E +#define SSL_R_DIGEST_CHECK_FAILED VERIFY_MAC_ERROR +#define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST SUITES_ERROR +#define SSL_R_EXCESSIVE_MESSAGE_SIZE BUFFER_ERROR +#define SSL_R_LENGTH_MISMATCH LENGTH_ERROR +#define SSL_R_NO_CIPHERS_SPECIFIED SUITES_ERROR +#define SSL_R_NO_COMPRESSION_SPECIFIED COMPRESSION_ERROR +#define SSL_R_NO_SHARED_CIPHER MATCH_SUITE_ERROR +#define SSL_R_RECORD_LENGTH_MISMATCH HANDSHAKE_SIZE_ERROR +#define SSL_R_UNEXPECTED_MESSAGE OUT_OF_ORDER_E +#define SSL_R_UNEXPECTED_RECORD SANITY_MSG_E +#define SSL_R_UNKNOWN_ALERT_TYPE BUFFER_ERROR +#define SSL_R_BAD_DIGEST_LENGTH BUFFER_ERROR +#define SSL_R_BAD_PACKET_LENGTH BUFFER_ERROR +#define SSL_R_DATA_LENGTH_TOO_LONG BUFFER_ERROR +#define SSL_R_ENCRYPTED_LENGTH_TOO_LONG BUFFER_ERROR +#define SSL_R_BAD_LENGTH BUFFER_ERROR +#define SSL_R_UNKNOWN_PROTOCOL VERSION_ERROR +#define SSL_R_WRONG_VERSION_NUMBER VERSION_ERROR +#define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC ENCRYPT_ERROR +#define SSL_R_HTTPS_PROXY_REQUEST PARSE_ERROR +#define SSL_R_HTTP_REQUEST PARSE_ERROR +#define SSL_R_UNSUPPORTED_PROTOCOL VERSION_ERROR +#define SSL_R_CERTIFICATE_VERIFY_FAILED VERIFY_CERT_ERROR +#define SSL_R_CERT_CB_ERROR CLIENT_CERT_CB_ERROR +#define SSL_R_NULL_SSL_METHOD_PASSED BAD_FUNC_ARG +#define SSL_R_CCS_RECEIVED_EARLY OUT_OF_ORDER_E + +#ifdef HAVE_SESSION_TICKET +#define SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB 72 +#endif + +/* Some openssl consumers try to detect these options with ifdef, defining + * here since we use an enum internally instead */ +#define SSL_OP_SINGLE_DH_USE WOLFSSL_OP_SINGLE_DH_USE +#define SSL_OP_SINGLE_ECDH_USE WOLFSSL_OP_SINGLE_ECDH_USE +#define SSL_OP_CIPHER_SERVER_PREFERENCE WOLFSSL_OP_CIPHER_SERVER_PREFERENCE +#define SSL_OP_NO_RENEGOTIATION WOLFSSL_OP_NO_RENEGOTIATION + +#define OPENSSL_config wolfSSL_OPENSSL_config +#define OPENSSL_memdup wolfSSL_OPENSSL_memdup +#define OPENSSL_cleanse wolfSSL_OPENSSL_cleanse +#define SSL_CTX_get_timeout wolfSSL_SSL_CTX_get_timeout +#define SSL_CTX_set_tmp_ecdh wolfSSL_SSL_CTX_set_tmp_ecdh +#define SSL_CTX_remove_session wolfSSL_SSL_CTX_remove_session +#define SSL_get_rbio wolfSSL_SSL_get_rbio +#define SSL_get_wbio wolfSSL_SSL_get_wbio +#define SSL_do_handshake wolfSSL_SSL_do_handshake +#define SSL_in_init wolfSSL_SSL_in_init +#define SSL_in_before wolfSSL_SSL_in_before +#define SSL_in_connect_init wolfSSL_SSL_in_connect_init +#define SSL_get0_session wolfSSL_SSL_get0_session +#define SSL_CTX_set_tlsext_ticket_key_cb wolfSSL_CTX_set_tlsext_ticket_key_cb +#define SSL_CTX_set_tlsext_status_cb wolfSSL_CTX_set_tlsext_status_cb +#define SSL_CTX_get_extra_chain_certs wolfSSL_CTX_get_extra_chain_certs +#define SSL_CTX_get0_chain_certs wolfSSL_CTX_get0_chain_certs +#define SSL_get0_chain_certs wolfSSL_get0_chain_certs +#define sk_OPENSSL_STRING_num wolfSSL_sk_WOLFSSL_STRING_num +#define sk_OPENSSL_STRING_value wolfSSL_sk_WOLFSSL_STRING_value +#define sk_OPENSSL_PSTRING_num wolfSSL_sk_WOLFSSL_STRING_num +#define sk_OPENSSL_PSTRING_value (WOLFSSL_STRING*)wolfSSL_sk_WOLFSSL_STRING_value +#define sk_OPENSSL_STRING_free wolfSSL_sk_free +#define SSL_get0_alpn_selected wolfSSL_get0_alpn_selected +#define SSL_select_next_proto wolfSSL_select_next_proto +#define SSL_CTX_set_alpn_select_cb wolfSSL_CTX_set_alpn_select_cb +#define SSL_CTX_set_next_protos_advertised_cb wolfSSL_CTX_set_next_protos_advertised_cb +#define SSL_CTX_set_next_proto_select_cb wolfSSL_CTX_set_next_proto_select_cb +#define SSL_set_alpn_protos wolfSSL_set_alpn_protos +#define SSL_get0_next_proto_negotiated wolfSSL_get0_next_proto_negotiated +#define SSL_is_server wolfSSL_is_server + +#endif /* WOLFSSL_NGINX || WOLFSSL_HAPROXY || WOLFSSL_MYSQL_COMPATIBLE || + OPENSSL_ALL || HAVE_LIGHTY */ + +#if (defined(OPENSSL_EXTRA) || defined(HAVE_CURL)) && defined(HAVE_ECC) +#define SSL_CTX_set1_curves_list wolfSSL_CTX_set1_curves_list +#define SSL_set1_curves_list wolfSSL_set1_curves_list +#endif + +#ifdef OPENSSL_EXTRA +#define SSL_CTX_add_client_CA wolfSSL_CTX_add_client_CA +#define SSL_CTX_set_srp_password wolfSSL_CTX_set_srp_password +#define SSL_CTX_set_srp_username wolfSSL_CTX_set_srp_username +#define SSL_CTX_set_srp_strength wolfSSL_CTX_set_srp_strength +#define SSL_get_SSL_CTX wolfSSL_get_SSL_CTX +#define SSL_get0_param wolfSSL_get0_param +#define SSL_CTX_get0_param wolfSSL_CTX_get0_param +#define SSL_CTX_set1_param wolfSSL_CTX_set1_param +#define SSL_get_srp_username wolfSSL_get_srp_username + +#define ERR_NUM_ERRORS 16 +#define SN_pkcs9_emailAddress "Email" +#define LN_pkcs9_emailAddress "emailAddress" +#define NID_pkcs9_emailAddress WC_NID_pkcs9_emailAddress +#define OBJ_pkcs9_emailAddress 1L,2L,840L,113539L,1L,9L,1L + +#define LN_basic_constraints "X509v3 Basic Constraints" +#define LN_key_usage "X509v3 Key Usage" +#define LN_subject_key_identifier "X509v3 Subject Key Identifier" +#define LN_ext_key_usage "X509v3 Extended Key Usage" + +#define SSL_get_rbio wolfSSL_SSL_get_rbio +#define SSL_get_wbio wolfSSL_SSL_get_wbio +#define SSL_do_handshake wolfSSL_SSL_do_handshake + +#if defined(WOLFSSL_EARLY_DATA) +#define SSL_EARLY_DATA_NOT_SENT WOLFSSL_EARLY_DATA_NOT_SENT +#define SSL_EARLY_DATA_REJECTED WOLFSSL_EARLY_DATA_REJECTED +#define SSL_EARLY_DATA_ACCEPTED WOLFSSL_EARLY_DATA_ACCEPTED + +#define SSL_get_early_data_status wolfSSL_get_early_data_status +#define SSL_set_max_early_data wolfSSL_set_max_early_data +#define SSL_get_max_early_data wolfSSL_get_max_early_data +#define SSL_CTX_set_max_early_data wolfSSL_CTX_set_max_early_data +#define SSL_CTX_get_max_early_data wolfSSL_CTX_get_max_early_data +#endif + +#endif /* OPENSSL_EXTRA */ + +/* cipher suites for compatibility */ +#define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA (0xc013) +#define TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA (0xc014) +#define TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (0xc02f) +#define TLS1_CK_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (0xcca8) +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA (0xc009) +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (0xc00a) +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (0xc02b) +#define TLS1_CK_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 (0xcca9) + +#define X509_LU_NONE WOLFSSL_X509_LU_NONE +#define X509_LU_X509 WOLFSSL_X509_LU_X509 +#define X509_LU_CRL WOLFSSL_X509_LU_CRL + +#define X509_STORE_get0_objects wolfSSL_X509_STORE_get0_objects +#define sk_X509_OBJECT_num wolfSSL_sk_X509_OBJECT_num +#define sk_X509_OBJECT_value wolfSSL_sk_X509_OBJECT_value +#define sk_X509_OBJECT_delete wolfSSL_sk_X509_OBJECT_delete +#define X509_OBJECT_new wolfSSL_X509_OBJECT_new +#define X509_OBJECT_free wolfSSL_X509_OBJECT_free +#define X509_OBJECT_get_type wolfSSL_X509_OBJECT_get_type +#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L +#define OpenSSL_version(x) wolfSSL_OpenSSL_version(x) +#else +#define OpenSSL_version(x) wolfSSL_OpenSSL_version() +#endif + +#define X509_OBJECT_retrieve_by_subject wolfSSL_X509_OBJECT_retrieve_by_subject + +#ifndef NO_WOLFSSL_STUB +#define OBJ_create_objects(in) WC_DO_NOTHING +#define sk_SSL_COMP_free(sk) WC_DO_NOTHING +#endif + +#define ASN1_OBJECT_new wolfSSL_ASN1_OBJECT_new +#define ASN1_OBJECT_free wolfSSL_ASN1_OBJECT_free +#define i2d_ASN1_OBJECT wolfSSL_i2d_ASN1_OBJECT +#define OBJ_dup wolfSSL_ASN1_OBJECT_dup + +#define SSL_set_psk_use_session_callback wolfSSL_set_psk_use_session_callback +#define SSL_SESSION_is_resumable wolfSSL_SESSION_is_resumable +typedef WOLFSSL_CONF_CTX SSL_CONF_CTX; + +#define SSL_CONF_CTX_new wolfSSL_CONF_CTX_new +#define SSL_CONF_CTX_free wolfSSL_CONF_CTX_free +#define SSL_CONF_CTX_set_ssl_ctx wolfSSL_CONF_CTX_set_ssl_ctx +#define SSL_CONF_CTX_set_flags wolfSSL_CONF_CTX_set_flags +#define SSL_CONF_CTX_finish wolfSSL_CONF_CTX_finish +#define SSL_CONF_cmd wolfSSL_CONF_cmd +#define SSL_CONF_cmd_value_type wolfSSL_CONF_cmd_value_type + +#define SSL_OP_LEGACY_SERVER_CONNECT 0 + +#endif /* !OPENSSL_COEXIST && (OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL) */ + + +#ifdef WOLFSSL_QUIC + +#include <wolfssl/quic.h> + +/* Used by Chromium/QUIC - according to quictls/openssl fork */ +#define X25519_PRIVATE_KEY_LEN 32 +#define X25519_PUBLIC_VALUE_LEN 32 + +/* TLSv1.3 cipher ids as defined in RFC 8446, returned by + * SSL_CIPHER_get_id(cipher) + * used by QUIC implementations, such as HAProxy + */ +#define WOLF_TLS1_3_CK_AES_128_GCM_SHA256 0x1301 +#define WOLF_TLS1_3_CK_AES_256_GCM_SHA384 0x1302 +#define WOLF_TLS1_3_CK_CHACHA20_POLY1305_SHA256 0x1303 +#define WOLF_TLS1_3_CK_AES_128_CCM_SHA256 0x1304 +#define WOLF_TLS1_3_CK_AES_128_CCM_8_SHA256 0x1305 + +#ifndef OPENSSL_COEXIST + +#define TLS1_3_CK_AES_128_GCM_SHA256 WOLF_TLS1_3_CK_AES_128_GCM_SHA256 +#define TLS1_3_CK_AES_256_GCM_SHA384 WOLF_TLS1_3_CK_AES_256_GCM_SHA384 +#define TLS1_3_CK_CHACHA20_POLY1305_SHA256 WOLF_TLS1_3_CK_CHACHA20_POLY1305_SHA256 +#define TLS1_3_CK_AES_128_CCM_SHA256 WOLF_TLS1_3_CK_AES_128_CCM_SHA256 +#define TLS1_3_CK_AES_128_CCM_8_SHA256 WOLF_TLS1_3_CK_AES_128_CCM_8_SHA256 + +#define SSL_R_MISSING_QUIC_TRANSPORT_PARAMETERS_EXTENSION QUIC_TP_MISSING_E +#define SSL_R_WRONG_ENCRYPTION_LEVEL_RECEIVED QUIC_WRONG_ENC_LEVEL + +#define ssl_quic_method_st wolfssl_quic_method_t +typedef WOLFSSL_QUIC_METHOD SSL_QUIC_METHOD; + +#define ssl_encryption_level_t wolfssl_encryption_level_t +typedef WOLFSSL_ENCRYPTION_LEVEL OSSL_ENCRYPTION_LEVEL; +#define ssl_encryption_initial wolfssl_encryption_initial +#define ssl_encryption_early_data wolfssl_encryption_early_data +#define ssl_encryption_handshake wolfssl_encryption_handshake +#define ssl_encryption_application wolfssl_encryption_application + +#define SSL_CTX_set_quic_method wolfSSL_CTX_set_quic_method +#define SSL_set_quic_method wolfSSL_set_quic_method + +#define SSL_set_quic_transport_params wolfSSL_set_quic_transport_params +#define SSL_get_peer_quic_transport_params wolfSSL_get_peer_quic_transport_params + +#define SSL_quic_max_handshake_flight_len wolfSSL_quic_max_handshake_flight_len +#define SSL_quic_read_level wolfSSL_quic_read_level +#define SSL_quic_write_level wolfSSL_quic_write_level +#define SSL_provide_quic_data wolfSSL_provide_quic_data +#define SSL_process_quic_post_handshake wolfSSL_process_quic_post_handshake + +#define SSL_is_quic wolfSSL_is_quic + +#define SSL_set_quic_transport_version wolfSSL_set_quic_transport_version +#define SSL_get_quic_transport_version wolfSSL_get_quic_transport_version +#define SSL_get_peer_quic_transport_version wolfSSL_get_peer_quic_transport_version + +#define SSL_set_quic_early_data_enabled wolfSSL_set_quic_early_data_enabled + +/* BoringSSL API - according to quictls/openssl fork */ +#define SSL_set_quic_use_legacy_codepoint wolfSSL_set_quic_use_legacy_codepoint + +/* TODO: we do not have this in our QUIC api and HAProxy does not use it +int SSL_CIPHER_get_prf_nid(const SSL_CIPHER *c); +*/ + +#endif /* !OPENSSL_COEXIST */ + +#endif /* WOLFSSL_QUIC */ + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* !WOLFSSL_OPENSSL_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ssl23.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ssl23.h @@ -0,0 +1 @@ +/* ssl23.h for openssl */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/stack.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/stack.h @@ -0,0 +1,61 @@ +/* stack.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* stack.h for openSSL */ + +#ifndef WOLFSSL_STACK_H_ +#define WOLFSSL_STACK_H_ + +#include <wolfssl/openssl/compat_types.h> +#include <wolfssl/openssl/ssl.h> + +#ifdef __cplusplus + extern "C" { +#endif + +typedef void (*wolfSSL_sk_freefunc)(void *); + +WOLFSSL_API void wolfSSL_sk_GENERIC_pop_free(WOLFSSL_STACK* sk, wolfSSL_sk_freefunc f); +WOLFSSL_API void wolfSSL_sk_GENERIC_free(WOLFSSL_STACK *sk); +WOLFSSL_API int wolfSSL_sk_GENERIC_push(WOLFSSL_STACK *sk, void *data); +WOLFSSL_API void wolfSSL_sk_pop_free(WOLFSSL_STACK *st, void (*func) (void *)); +WOLFSSL_API WOLFSSL_STACK *wolfSSL_sk_new_null(void); + +WOLFSSL_API int wolfSSL_sk_CIPHER_push(WOLFSSL_STACK *st,WOLFSSL_CIPHER *cipher); +WOLFSSL_API WOLFSSL_CIPHER* wolfSSL_sk_CIPHER_pop(WOLF_STACK_OF(WOLFSSL_CIPHER)* sk); +WOLFSSL_API WOLFSSL_STACK* wolfSSL_sk_new_cipher(void); + +#define OPENSSL_sk_free wolfSSL_sk_free +#define OPENSSL_sk_pop_free wolfSSL_sk_pop_free +#define OPENSSL_sk_new_null wolfSSL_sk_new_null +#define OPENSSL_sk_push wolfSSL_sk_push + +/* provides older OpenSSL API compatibility */ +#define sk_free OPENSSL_sk_free +#define sk_pop_free OPENSSL_sk_pop_free +#define sk_new_null OPENSSL_sk_new_null +#define sk_push OPENSSL_sk_push + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/tls1.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/tls1.h @@ -0,0 +1,64 @@ +/* tls1.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + +#ifndef WOLFSSL_OPENSSL_TLS1_H_ +#define WOLFSSL_OPENSSL_TLS1_H_ + +#ifndef TLS1_VERSION +#define TLS1_VERSION 0x0301 +#endif + +#ifndef TLS1_1_VERSION +#define TLS1_1_VERSION 0x0302 +#endif + +#ifndef TLS1_2_VERSION +#define TLS1_2_VERSION 0x0303 +#endif + +#ifndef TLS1_3_VERSION +#define TLS1_3_VERSION 0x0304 +#endif + +#ifndef TLS_MAX_VERSION +#define TLS_MAX_VERSION TLS1_3_VERSION +#endif + +#ifdef WOLFSSL_QUIC +/* from rfc9001 */ +#define WOLFSSL_TLSEXT_TYPE_quic_transport_parameters_draft \ + TLSXT_KEY_QUIC_TP_PARAMS_DRAFT +#define WOLFSSL_TLSEXT_TYPE_quic_transport_parameters \ + TLSXT_KEY_QUIC_TP_PARAMS + +#ifndef OPENSSL_COEXIST + +#define TLSEXT_TYPE_quic_transport_parameters_draft \ + TLSXT_KEY_QUIC_TP_PARAMS_DRAFT +#define TLSEXT_TYPE_quic_transport_parameters \ + TLSXT_KEY_QUIC_TP_PARAMS + +#endif /* !OPENSSL_COEXIST */ + +#endif /* WOLFSSL_QUIC */ + +#endif /* WOLFSSL_OPENSSL_TLS1_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/txt_db.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/txt_db.h @@ -0,0 +1,60 @@ +/* txt_db.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifndef WOLFSSL_TXT_DB_H_ +#define WOLFSSL_TXT_DB_H_ + +#include <wolfssl/openssl/ssl.h> + +#define WOLFSSL_TXT_DB_MAX_FIELDS 10 + +struct WOLFSSL_TXT_DB { + int num_fields; + WOLF_STACK_OF(WOLFSSL_STRING) *data; + long error; + long arg1; + long arg2; + wolf_sk_hash_cb hash_fn[WOLFSSL_TXT_DB_MAX_FIELDS]; +}; + +typedef struct WOLFSSL_TXT_DB WOLFSSL_TXT_DB; +typedef int (*wolf_lh_compare_cb)(const void* a, + const void* b); + +WOLFSSL_API WOLFSSL_TXT_DB *wolfSSL_TXT_DB_read(WOLFSSL_BIO *in, int num); +WOLFSSL_API long wolfSSL_TXT_DB_write(WOLFSSL_BIO *out, WOLFSSL_TXT_DB *db); +WOLFSSL_API int wolfSSL_TXT_DB_insert(WOLFSSL_TXT_DB *db, WOLFSSL_STRING *row); +WOLFSSL_API void wolfSSL_TXT_DB_free(WOLFSSL_TXT_DB *db); +WOLFSSL_API int wolfSSL_TXT_DB_create_index(WOLFSSL_TXT_DB *db, int field, + void* qual, wolf_sk_hash_cb hash, wolf_lh_compare_cb cmp); +WOLFSSL_API WOLFSSL_STRING *wolfSSL_TXT_DB_get_by_index(WOLFSSL_TXT_DB *db, + int idx, WOLFSSL_STRING *value); + +#define TXT_DB WOLFSSL_TXT_DB + +#define TXT_DB_read wolfSSL_TXT_DB_read +#define TXT_DB_write wolfSSL_TXT_DB_write +#define TXT_DB_insert wolfSSL_TXT_DB_insert +#define TXT_DB_free wolfSSL_TXT_DB_free +#define TXT_DB_create_index wolfSSL_TXT_DB_create_index +#define TXT_DB_get_by_index wolfSSL_TXT_DB_get_by_index + +#endif /* WOLFSSL_TXT_DB_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ui.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/ui.h @@ -0,0 +1,2 @@ +/* ui.h for openssl */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/x509.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/x509.h @@ -0,0 +1,227 @@ +/* x509.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* x509.h for openssl */ + +#ifndef WOLFSSL_OPENSSL_509_H_ +#define WOLFSSL_OPENSSL_509_H_ + +#include <wolfssl/openssl/ssl.h> +#include <wolfssl/openssl/crypto.h> +#include <wolfssl/openssl/dh.h> +#include <wolfssl/openssl/ec.h> +#include <wolfssl/openssl/ecdsa.h> +#include <wolfssl/openssl/pkcs7.h> + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + +#define WOLFSSL_X509_FLAG_COMPAT (0UL) +#define WOLFSSL_X509_FLAG_NO_HEADER (1UL << 0) +#define WOLFSSL_X509_FLAG_NO_VERSION (1UL << 1) +#define WOLFSSL_X509_FLAG_NO_SERIAL (1UL << 2) +#define WOLFSSL_X509_FLAG_NO_SIGNAME (1UL << 3) +#define WOLFSSL_X509_FLAG_NO_ISSUER (1UL << 4) +#define WOLFSSL_X509_FLAG_NO_VALIDITY (1UL << 5) +#define WOLFSSL_X509_FLAG_NO_SUBJECT (1UL << 6) +#define WOLFSSL_X509_FLAG_NO_PUBKEY (1UL << 7) +#define WOLFSSL_X509_FLAG_NO_EXTENSIONS (1UL << 8) +#define WOLFSSL_X509_FLAG_NO_SIGDUMP (1UL << 9) +#define WOLFSSL_X509_FLAG_NO_AUX (1UL << 10) +#define WOLFSSL_X509_FLAG_NO_ATTRIBUTES (1UL << 11) +#define WOLFSSL_X509_FLAG_NO_IDS (1UL << 12) + +#define WOLFSSL_XN_FLAG_FN_SN 0 +#define WOLFSSL_XN_FLAG_COMPAT 0 +#define WOLFSSL_XN_FLAG_RFC2253 1 +#define WOLFSSL_XN_FLAG_SEP_COMMA_PLUS (1 << 16) +#define WOLFSSL_XN_FLAG_SEP_CPLUS_SPC (2 << 16) +#define WOLFSSL_XN_FLAG_SEP_SPLUS_SPC (3 << 16) +#define WOLFSSL_XN_FLAG_SEP_MULTILINE (4 << 16) +#define WOLFSSL_XN_FLAG_SEP_MASK (0xF << 16) +#define WOLFSSL_XN_FLAG_DN_REV (1 << 20) +#define WOLFSSL_XN_FLAG_FN_LN (1 << 21) +#define WOLFSSL_XN_FLAG_FN_OID (2 << 21) +#define WOLFSSL_XN_FLAG_FN_NONE (3 << 21) +#define WOLFSSL_XN_FLAG_FN_MASK (3 << 21) +#define WOLFSSL_XN_FLAG_SPC_EQ (1 << 23) +#define WOLFSSL_XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24) +#define WOLFSSL_XN_FLAG_FN_ALIGN (1 << 25) + +#define WOLFSSL_XN_FLAG_MULTILINE 0xFFFF +#define WOLFSSL_XN_FLAG_ONELINE (WOLFSSL_XN_FLAG_SEP_CPLUS_SPC | WOLFSSL_XN_FLAG_SPC_EQ | WOLFSSL_XN_FLAG_FN_SN) + +#define WOLFSSL_X509_V_ERR_CRL_HAS_EXPIRED 12 +#define WOLFSSL_X509_V_ERR_UNABLE_TO_GET_CRL 3 + +#ifndef OPENSSL_COEXIST + +/* wolfSSL_X509_print_ex flags */ +#define X509_FLAG_COMPAT WOLFSSL_X509_FLAG_COMPAT +#define X509_FLAG_NO_HEADER WOLFSSL_X509_FLAG_NO_HEADER +#define X509_FLAG_NO_VERSION WOLFSSL_X509_FLAG_NO_VERSION +#define X509_FLAG_NO_SERIAL WOLFSSL_X509_FLAG_NO_SERIAL +#define X509_FLAG_NO_SIGNAME WOLFSSL_X509_FLAG_NO_SIGNAME +#define X509_FLAG_NO_ISSUER WOLFSSL_X509_FLAG_NO_ISSUER +#define X509_FLAG_NO_VALIDITY WOLFSSL_X509_FLAG_NO_VALIDITY +#define X509_FLAG_NO_SUBJECT WOLFSSL_X509_FLAG_NO_SUBJECT +#define X509_FLAG_NO_PUBKEY WOLFSSL_X509_FLAG_NO_PUBKEY +#define X509_FLAG_NO_EXTENSIONS WOLFSSL_X509_FLAG_NO_EXTENSIONS +#define X509_FLAG_NO_SIGDUMP WOLFSSL_X509_FLAG_NO_SIGDUMP +#define X509_FLAG_NO_AUX WOLFSSL_X509_FLAG_NO_AUX +#define X509_FLAG_NO_ATTRIBUTES WOLFSSL_X509_FLAG_NO_ATTRIBUTES +#define X509_FLAG_NO_IDS WOLFSSL_X509_FLAG_NO_IDS + +#define XN_FLAG_FN_SN WOLFSSL_XN_FLAG_FN_SN +#define XN_FLAG_COMPAT WOLFSSL_XN_FLAG_COMPAT +#define XN_FLAG_RFC2253 WOLFSSL_XN_FLAG_RFC2253 +#define XN_FLAG_SEP_COMMA_PLUS WOLFSSL_XN_FLAG_SEP_COMMA_PLUS +#define XN_FLAG_SEP_CPLUS_SPC WOLFSSL_XN_FLAG_SEP_CPLUS_SPC +#define XN_FLAG_SEP_SPLUS_SPC WOLFSSL_XN_FLAG_SEP_SPLUS_SPC +#define XN_FLAG_SEP_MULTILINE WOLFSSL_XN_FLAG_SEP_MULTILINE +#define XN_FLAG_SEP_MASK WOLFSSL_XN_FLAG_SEP_MASK +#define XN_FLAG_DN_REV WOLFSSL_XN_FLAG_DN_REV +#define XN_FLAG_FN_LN WOLFSSL_XN_FLAG_FN_LN +#define XN_FLAG_FN_OID WOLFSSL_XN_FLAG_FN_OID +#define XN_FLAG_FN_NONE WOLFSSL_XN_FLAG_FN_NONE +#define XN_FLAG_FN_MASK WOLFSSL_XN_FLAG_FN_MASK +#define XN_FLAG_SPC_EQ WOLFSSL_XN_FLAG_SPC_EQ +#define XN_FLAG_DUMP_UNKNOWN_FIELDS WOLFSSL_XN_FLAG_DUMP_UNKNOWN_FIELDS +#define XN_FLAG_FN_ALIGN WOLFSSL_XN_FLAG_FN_ALIGN + +#define XN_FLAG_MULTILINE WOLFSSL_XN_FLAG_MULTILINE +#define XN_FLAG_ONELINE WOLFSSL_XN_FLAG_ONELINE + +#define X509_V_ERR_UNABLE_TO_GET_CRL WOLFSSL_X509_V_ERR_UNABLE_TO_GET_CRL +#define X509_V_ERR_CRL_HAS_EXPIRED WOLFSSL_X509_V_ERR_CRL_HAS_EXPIRED +#define X509_V_FLAG_ALLOW_PROXY_CERTS 0 +#define X509_V_FLAG_X509_STRICT 0 + +/* + * Not all of these X509_V_ERR values are used in wolfSSL. Some are included to + * satisfy OpenSSL compatibility compilation errors. + * For HAProxy the values should be literal constants. + */ + +#define X509_V_OK 0 +#define X509_V_ERR_UNSPECIFIED 1 +#define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2 +#define X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4 +#define X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE 5 +#define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 +#define X509_V_ERR_CERT_SIGNATURE_FAILURE 7 +#define X509_V_ERR_CRL_SIGNATURE_FAILURE 8 +#define X509_V_ERR_CERT_NOT_YET_VALID 9 +#define X509_V_ERR_CERT_HAS_EXPIRED 10 +#define X509_V_ERR_CRL_NOT_YET_VALID 11 +#define X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD 13 +#define X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD 14 +#define X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD 15 +#define X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD 16 +#define X509_V_ERR_OUT_OF_MEM 17 +#define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT 18 +#define X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN 19 +#define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY 20 +#define X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE 21 +#define X509_V_ERR_CERT_CHAIN_TOO_LONG 22 +#define X509_V_ERR_CERT_REVOKED 23 +#define X509_V_ERR_NO_ISSUER_PUBLIC_KEY 24 +#define X509_V_ERR_PATH_LENGTH_EXCEEDED 25 +#define X509_V_ERR_INVALID_PURPOSE 26 +#define X509_V_ERR_CERT_UNTRUSTED 27 +#define X509_V_ERR_CERT_REJECTED 28 +#define X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29 +#define X509_V_ERR_AKID_SKID_MISMATCH 30 +#define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31 +#define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32 +#define X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER 33 +#define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34 +#define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35 +#define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36 +#define X509_V_ERR_INVALID_NON_CA 37 +#define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED 38 +#define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39 +#define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40 +#define X509_V_ERR_INVALID_EXTENSION 41 +#define X509_V_ERR_INVALID_POLICY_EXTENSION 42 +#define X509_V_ERR_NO_EXPLICIT_POLICY 43 +#define X509_V_ERR_DIFFERENT_CRL_SCOPE 44 +#define X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE 45 +#define X509_V_ERR_UNNESTED_RESOURCE 46 +#define X509_V_ERR_PERMITTED_VIOLATION 47 +#define X509_V_ERR_EXCLUDED_VIOLATION 48 +#define X509_V_ERR_SUBTREE_MINMAX 49 +#define X509_V_ERR_APPLICATION_VERIFICATION 50 +#define X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE 51 +#define X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX 52 +#define X509_V_ERR_UNSUPPORTED_NAME_SYNTAX 53 +#define X509_V_ERR_CRL_PATH_VALIDATION_ERROR 54 +#define X509_V_ERR_PATH_LOOP 55 +#define X509_V_ERR_SUITE_B_INVALID_VERSION 56 +#define X509_V_ERR_SUITE_B_INVALID_ALGORITHM 57 +#define X509_V_ERR_SUITE_B_INVALID_CURVE 58 +#define X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM 59 +#define X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED 60 +#define X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256 61 +#define X509_V_ERR_HOSTNAME_MISMATCH 62 +#define X509_V_ERR_EMAIL_MISMATCH 63 +#define X509_V_ERR_IP_ADDRESS_MISMATCH 64 +#define X509_V_ERR_DANE_NO_MATCH 65 +#define X509_V_ERR_EE_KEY_TOO_SMALL 66 +#define X509_V_ERR_CA_KEY_TOO_SMALL 67 +#define X509_V_ERR_CA_MD_TOO_WEAK 68 +#define X509_V_ERR_INVALID_CALL 69 +#define X509_V_ERR_STORE_LOOKUP 70 +#define X509_V_ERR_NO_VALID_SCTS 71 +#define X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION 72 +#define X509_V_ERR_OCSP_VERIFY_NEEDED 73 +#define X509_V_ERR_OCSP_VERIFY_FAILED 74 +#define X509_V_ERR_OCSP_CERT_UNKNOWN 75 +#define X509_V_ERR_UNSUPPORTED_SIGNATURE_ALGORITHM 76 +#define X509_V_ERR_SIGNATURE_ALGORITHM_MISMATCH 77 +#define X509_V_ERR_SIGNATURE_ALGORITHM_INCONSISTENCY 78 +#define X509_V_ERR_INVALID_CA 79 +#define X509_V_ERR_PATHLEN_INVALID_FOR_NON_CA 80 +#define X509_V_ERR_PATHLEN_WITHOUT_KU_KEY_CERT_SIGN 81 +#define X509_V_ERR_KU_KEY_CERT_SIGN_INVALID_FOR_NON_CA 82 +#define X509_V_ERR_ISSUER_NAME_EMPTY 83 +#define X509_V_ERR_SUBJECT_NAME_EMPTY 84 +#define X509_V_ERR_MISSING_AUTHORITY_KEY_IDENTIFIER 85 +#define X509_V_ERR_MISSING_SUBJECT_KEY_IDENTIFIER 86 +#define X509_V_ERR_EMPTY_SUBJECT_ALT_NAME 87 +#define X509_V_ERR_EMPTY_SUBJECT_SAN_NOT_CRITICAL 88 +#define X509_V_ERR_CA_BCONS_NOT_CRITICAL 89 +#define X509_V_ERR_AUTHORITY_KEY_IDENTIFIER_CRITICAL 90 +#define X509_V_ERR_SUBJECT_KEY_IDENTIFIER_CRITICAL 91 +#define X509_V_ERR_CA_CERT_MISSING_KEY_USAGE 92 +#define X509_V_ERR_EXTENSIONS_REQUIRE_VERSION_3 93 +#define X509_V_ERR_EC_KEY_EXPLICIT_PARAMS 94 +#define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 +#define X509_R_KEY_VALUES_MISMATCH WC_KEY_MISMATCH_E + +#define X509_EXTENSION_set_critical wolfSSL_X509_EXTENSION_set_critical +#define X509_EXTENSION_set_object wolfSSL_X509_EXTENSION_set_object +#define X509_EXTENSION_set_data wolfSSL_X509_EXTENSION_set_data + +#endif /* !OPENSSL_COEXIST */ + +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + +#endif /* WOLFSSL_OPENSSL_509_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/x509_vfy.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/x509_vfy.h @@ -0,0 +1,50 @@ +/* x509_vfy.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* x509_vfy.h for openSSL */ + +#ifndef WOLFSSL_x509_vfy_H_ +#define WOLFSSL_x509_vfy_H_ + +#include <wolfssl/openssl/compat_types.h> +#include <wolfssl/openssl/x509v3.h> + +#ifdef __cplusplus + extern "C" { +#endif + +#if defined(WOLFSSL_QT) || defined(OPENSSL_ALL) + WOLFSSL_API int wolfSSL_X509_STORE_CTX_set_purpose(WOLFSSL_X509_STORE_CTX *ctx, int purpose); +#endif +#ifdef OPENSSL_EXTRA + WOLFSSL_API void wolfSSL_X509_STORE_CTX_set_flags(WOLFSSL_X509_STORE_CTX *ctx, + unsigned long flags); +#endif + + +#define X509_STORE_CTX_set_purpose wolfSSL_X509_STORE_CTX_set_purpose +#define X509_STORE_CTX_set_flags wolfSSL_X509_STORE_CTX_set_flags + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* WOLFSSL_x509_vfy_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/x509v3.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/openssl/x509v3.h @@ -0,0 +1,237 @@ +/* x509v3.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* x509v3.h for openSSL */ + +#ifndef WOLFSSL_x509v3_H +#define WOLFSSL_x509v3_H + +#include <wolfssl/wolfcrypt/types.h> +#include <wolfssl/openssl/compat_types.h> +#include <wolfssl/openssl/conf.h> +#include <wolfssl/openssl/bio.h> +#include <wolfssl/openssl/ssl.h> + +#ifdef __cplusplus + extern "C" { +#endif + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + +#define WOLFSSL_EXFLAG_KUSAGE 0x2 +#define WOLFSSL_EXFLAG_XKUSAGE 0x4 + +#define WOLFSSL_XKU_SSL_SERVER 0x1 +#define WOLFSSL_XKU_SSL_CLIENT 0x2 +#define WOLFSSL_XKU_SMIME 0x4 +#define WOLFSSL_XKU_CODE_SIGN 0x8 +#define WOLFSSL_XKU_SGC 0x10 +#define WOLFSSL_XKU_OCSP_SIGN 0x20 +#define WOLFSSL_XKU_TIMESTAMP 0x40 +#define WOLFSSL_XKU_DVCS 0x80 +#define WOLFSSL_XKU_ANYEKU 0x100 + +#define WOLFSSL_X509_PURPOSE_SSL_CLIENT 0 +#define WOLFSSL_X509_PURPOSE_SSL_SERVER 1 + +#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x0090801fL +typedef void *(*WOLFSSL_X509V3_EXT_D2I)(void *, const unsigned char **, long); +#else +typedef void *(*WOLFSSL_X509V3_EXT_D2I)(void *, unsigned char **, long); +#endif +typedef int (*WOLFSSL_X509V3_EXT_I2D) (void *, unsigned char **); +typedef WOLF_STACK_OF(CONF_VALUE) *(*WOLFSSL_X509V3_EXT_I2V) ( + struct WOLFSSL_v3_ext_method *method, + void *ext, WOLF_STACK_OF(CONF_VALUE) *extlist); +typedef char *(*WOLFSSL_X509V3_EXT_I2S)(struct WOLFSSL_v3_ext_method *method, void *ext); +typedef int (*WOLFSSL_X509V3_EXT_I2R) (struct WOLFSSL_v3_ext_method *method, + void *ext, WOLFSSL_BIO *out, int indent); +typedef struct WOLFSSL_v3_ext_method WOLFSSL_X509V3_EXT_METHOD; + +struct WOLFSSL_v3_ext_method { + int ext_nid; + int ext_flags; + void *usr_data; + WOLFSSL_X509V3_EXT_D2I d2i; + WOLFSSL_X509V3_EXT_I2D i2d; + WOLFSSL_X509V3_EXT_I2V i2v; + WOLFSSL_X509V3_EXT_I2S i2s; + WOLFSSL_X509V3_EXT_I2R i2r; +}; + +struct WOLFSSL_X509_EXTENSION { + WOLFSSL_ASN1_OBJECT *obj; + WOLFSSL_ASN1_BOOLEAN crit; + WOLFSSL_ASN1_STRING value; /* DER format of extension */ + WOLFSSL_v3_ext_method ext_method; + WOLFSSL_STACK* ext_sk; /* For extension specific data */ +}; + +#define WOLFSSL_ASN1_BOOLEAN int + +#define WOLFSSL_GEN_OTHERNAME 0 +#define WOLFSSL_GEN_EMAIL 1 +#define WOLFSSL_GEN_DNS 2 +#define WOLFSSL_GEN_X400 3 +#define WOLFSSL_GEN_DIRNAME 4 +#define WOLFSSL_GEN_EDIPARTY 5 +#define WOLFSSL_GEN_URI 6 +#define WOLFSSL_GEN_IPADD 7 +#define WOLFSSL_GEN_RID 8 +#define WOLFSSL_GEN_IA5 9 + +typedef WOLF_STACK_OF(WOLFSSL_ACCESS_DESCRIPTION) WOLFSSL_AUTHORITY_INFO_ACCESS; + +WOLFSSL_API WOLFSSL_BASIC_CONSTRAINTS* wolfSSL_BASIC_CONSTRAINTS_new(void); +WOLFSSL_API void wolfSSL_BASIC_CONSTRAINTS_free(WOLFSSL_BASIC_CONSTRAINTS *bc); +WOLFSSL_API WOLFSSL_AUTHORITY_KEYID* wolfSSL_AUTHORITY_KEYID_new(void); +WOLFSSL_API void wolfSSL_AUTHORITY_KEYID_free(WOLFSSL_AUTHORITY_KEYID *id); +#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L +WOLFSSL_API const WOLFSSL_v3_ext_method* wolfSSL_X509V3_EXT_get( + WOLFSSL_X509_EXTENSION* ex); +#else +WOLFSSL_API WOLFSSL_v3_ext_method* wolfSSL_X509V3_EXT_get( + WOLFSSL_X509_EXTENSION* ex); +#endif +WOLFSSL_API void* wolfSSL_X509V3_EXT_d2i(WOLFSSL_X509_EXTENSION* ex); +WOLFSSL_API char* wolfSSL_i2s_ASN1_STRING(WOLFSSL_v3_ext_method *method, + const WOLFSSL_ASN1_STRING *s); +WOLFSSL_API int wolfSSL_i2d_ASN1_GENERALSTRING(WOLFSSL_ASN1_STRING* s, + unsigned char **pp); +WOLFSSL_API int wolfSSL_i2d_ASN1_SEQUENCE(WOLFSSL_ASN1_STRING* s, + unsigned char **pp); +WOLFSSL_API int wolfSSL_i2d_ASN1_OCTET_STRING(WOLFSSL_ASN1_STRING* s, + unsigned char **pp); +WOLFSSL_API int wolfSSL_i2d_ASN1_UTF8STRING(WOLFSSL_ASN1_STRING* s, + unsigned char **pp); +WOLFSSL_API WOLFSSL_ASN1_STRING* wolfSSL_d2i_ASN1_GENERALSTRING( + WOLFSSL_ASN1_STRING** out, const byte** src, long len); +WOLFSSL_API WOLFSSL_ASN1_STRING* wolfSSL_d2i_ASN1_OCTET_STRING( + WOLFSSL_ASN1_STRING** out, const byte** src, long len); +WOLFSSL_API WOLFSSL_ASN1_STRING* wolfSSL_d2i_ASN1_UTF8STRING( + WOLFSSL_ASN1_STRING** out, const byte** src, long len); +WOLFSSL_API int wolfSSL_X509V3_EXT_print(WOLFSSL_BIO *out, + WOLFSSL_X509_EXTENSION *ext, unsigned long flag, int indent); +WOLFSSL_API int wolfSSL_X509V3_EXT_add_nconf(WOLFSSL_CONF *conf, + WOLFSSL_X509V3_CTX *ctx, const char *section, WOLFSSL_X509 *cert); +WOLFSSL_API WOLFSSL_X509_EXTENSION* wolfSSL_X509v3_get_ext( + const WOLF_STACK_OF(WOLFSSL_X509_EXTENSION)* sk, int loc); +WOLFSSL_API int wolfSSL_X509v3_get_ext_by_NID( + const WOLF_STACK_OF(WOLFSSL_X509_EXTENSION)* sk, int nid, int lastpos); + +WOLFSSL_API WOLFSSL_ASN1_STRING* wolfSSL_a2i_IPADDRESS(const char* ipa); + +#ifndef OPENSSL_COEXIST + +#define EXFLAG_KUSAGE WOLFSSL_EXFLAG_KUSAGE +#define EXFLAG_XKUSAGE WOLFSSL_EXFLAG_XKUSAGE + +#define KU_DIGITAL_SIGNATURE KEYUSE_DIGITAL_SIG +#define KU_NON_REPUDIATION KEYUSE_CONTENT_COMMIT +#define KU_KEY_ENCIPHERMENT KEYUSE_KEY_ENCIPHER +#define KU_DATA_ENCIPHERMENT KEYUSE_DATA_ENCIPHER +#define KU_KEY_AGREEMENT KEYUSE_KEY_AGREE +#define KU_KEY_CERT_SIGN KEYUSE_KEY_CERT_SIGN +#define KU_CRL_SIGN KEYUSE_CRL_SIGN +#define KU_ENCIPHER_ONLY KEYUSE_ENCIPHER_ONLY +#define KU_DECIPHER_ONLY KEYUSE_DECIPHER_ONLY + +#define XKU_SSL_SERVER WOLFSSL_XKU_SSL_SERVER +#define XKU_SSL_CLIENT WOLFSSL_XKU_SSL_CLIENT +#define XKU_SMIME WOLFSSL_XKU_SMIME +#define XKU_CODE_SIGN WOLFSSL_XKU_CODE_SIGN +#define XKU_SGC WOLFSSL_XKU_SGC +#define XKU_OCSP_SIGN WOLFSSL_XKU_OCSP_SIGN +#define XKU_TIMESTAMP WOLFSSL_XKU_TIMESTAMP +#define XKU_DVCS WOLFSSL_XKU_DVCS +#define XKU_ANYEKU WOLFSSL_XKU_ANYEKU + +#define X509_PURPOSE_SSL_CLIENT WOLFSSL_X509_PURPOSE_SSL_CLIENT +#define X509_PURPOSE_SSL_SERVER WOLFSSL_X509_PURPOSE_SSL_SERVER + +#define NS_SSL_CLIENT WC_NS_SSL_CLIENT +#define NS_SSL_SERVER WC_NS_SSL_SERVER + +/* Forward reference */ + +#define X509V3_EXT_D2I WOLFSSL_X509V3_EXT_D2I +#define X509V3_EXT_I2D WOLFSSL_X509V3_EXT_I2D +#define X509V3_EXT_I2V WOLFSSL_X509V3_EXT_I2V +#define X509V3_EXT_I2S WOLFSSL_X509V3_EXT_I2S +#define X509V3_EXT_I2R WOLFSSL_X509V3_EXT_I2R +typedef struct WOLFSSL_v3_ext_method X509V3_EXT_METHOD; + +#define GEN_OTHERNAME WOLFSSL_GEN_OTHERNAME +#define GEN_EMAIL WOLFSSL_GEN_EMAIL +#define GEN_DNS WOLFSSL_GEN_DNS +#define GEN_X400 WOLFSSL_GEN_X400 +#define GEN_DIRNAME WOLFSSL_GEN_DIRNAME +#define GEN_EDIPARTY WOLFSSL_GEN_EDIPARTY +#define GEN_URI WOLFSSL_GEN_URI +#define GEN_IPADD WOLFSSL_GEN_IPADD +#define GEN_RID WOLFSSL_GEN_RID +#define GEN_IA5 WOLFSSL_GEN_IA5 + +#define GENERAL_NAME WOLFSSL_GENERAL_NAME + +#define X509V3_CTX WOLFSSL_X509V3_CTX + +#define CTX_TEST 0x1 + +typedef struct WOLFSSL_AUTHORITY_KEYID AUTHORITY_KEYID; +typedef struct WOLFSSL_BASIC_CONSTRAINTS BASIC_CONSTRAINTS; +typedef struct WOLFSSL_ACCESS_DESCRIPTION ACCESS_DESCRIPTION; + +#define BASIC_CONSTRAINTS_free wolfSSL_BASIC_CONSTRAINTS_free +#define AUTHORITY_KEYID_free wolfSSL_AUTHORITY_KEYID_free +#define SSL_CTX_get_cert_store(x) wolfSSL_CTX_get_cert_store ((x)) +#define ASN1_INTEGER WOLFSSL_ASN1_INTEGER +#define ASN1_OCTET_STRING WOLFSSL_ASN1_STRING +#define X509V3_EXT_get wolfSSL_X509V3_EXT_get +#define X509V3_EXT_d2i wolfSSL_X509V3_EXT_d2i +#define X509V3_EXT_add_nconf wolfSSL_X509V3_EXT_add_nconf +#ifndef NO_WOLFSSL_STUB +#define X509V3_parse_list(line) NULL +#endif +#define i2s_ASN1_OCTET_STRING wolfSSL_i2s_ASN1_STRING +#define a2i_IPADDRESS wolfSSL_a2i_IPADDRESS +#define X509V3_EXT_print wolfSSL_X509V3_EXT_print +#define X509V3_EXT_conf_nid wolfSSL_X509V3_EXT_conf_nid +#define X509V3_set_ctx wolfSSL_X509V3_set_ctx +#ifndef NO_WOLFSSL_STUB +#define X509V3_set_nconf(ctx, conf) WC_DO_NOTHING +#define X509V3_EXT_cleanup() WC_DO_NOTHING +#endif +#define X509V3_set_ctx_test(ctx) wolfSSL_X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST) +#define X509V3_set_ctx_nodb wolfSSL_X509V3_set_ctx_nodb +#define X509v3_get_ext_count wolfSSL_sk_num +#define X509v3_get_ext_by_NID wolfSSL_X509v3_get_ext_by_NID +#define X509v3_get_ext wolfSSL_X509v3_get_ext + +#endif /* !OPENSSL_COEXIST */ + +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/options.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/options.h @@ -0,0 +1,216 @@ +/* wolfssl options.h + * generated from configure options + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. (formerly known as CyaSSL) + * + */ + +#ifdef WOLFSSL_NO_OPTIONS_H +/* options.h inhibited by configuration */ +#elif !defined(WOLFSSL_OPTIONS_H) +#define WOLFSSL_OPTIONS_H + + +#ifdef __cplusplus +extern "C" { +#endif + +#undef WOLFSSL_HAVE_ATOMIC_H +#define WOLFSSL_HAVE_ATOMIC_H + +#undef WOLFSSL_HAVE_ASSERT_H +#define WOLFSSL_HAVE_ASSERT_H + +#undef HAVE_C___ATOMIC +#define HAVE_C___ATOMIC 1 + +#undef HAVE_THREAD_LS +#define HAVE_THREAD_LS + +#undef NO_DO178 +#define NO_DO178 + +#undef WOLFSSL_ASN_TEMPLATE +#define WOLFSSL_ASN_TEMPLATE + +#undef ERROR_QUEUE_PER_THREAD +#define ERROR_QUEUE_PER_THREAD + +#undef TFM_TIMING_RESISTANT +#define TFM_TIMING_RESISTANT + +#undef ECC_TIMING_RESISTANT +#define ECC_TIMING_RESISTANT + +#undef WC_RSA_BLINDING +#define WC_RSA_BLINDING + +#undef WOLFSSL_ARMASM_NO_HW_CRYPTO +#define WOLFSSL_ARMASM_NO_HW_CRYPTO + +#undef WOLFSSL_USE_ALIGN +#define WOLFSSL_USE_ALIGN + +#undef WOLFSSL_SHA224 +#define WOLFSSL_SHA224 + +#undef WOLFSSL_SHA512 +#define WOLFSSL_SHA512 + +#undef WOLFSSL_SHA384 +#define WOLFSSL_SHA384 + +#undef HAVE_HKDF +#define HAVE_HKDF + +#undef NO_DSA +#define NO_DSA + +#undef HAVE_ECC +#define HAVE_ECC + +#undef ECC_SHAMIR +#define ECC_SHAMIR + +#undef ECC_MIN_KEY_SZ +#define ECC_MIN_KEY_SZ 224 + +#undef NO_OLD_TLS +#define NO_OLD_TLS + +#undef WC_RSA_PSS +#define WC_RSA_PSS + +#undef WOLFSSL_PSS_LONG_SALT +#define WOLFSSL_PSS_LONG_SALT + +#undef WOLFSSL_ASN_PRINT +#define WOLFSSL_ASN_PRINT + +#undef WOLFSSL_SHA3 +#define WOLFSSL_SHA3 + +#undef WOLFSSL_NO_SHAKE128 +#define WOLFSSL_NO_SHAKE128 + +#undef WOLFSSL_NO_SHAKE256 +#define WOLFSSL_NO_SHAKE256 + +#undef HAVE_POLY1305 +#define HAVE_POLY1305 + +#undef HAVE_CHACHA +#define HAVE_CHACHA + +#undef HAVE_HASHDRBG +#define HAVE_HASHDRBG + +#undef HAVE_TLS_EXTENSIONS +#define HAVE_TLS_EXTENSIONS + +#undef HAVE_SNI +#define HAVE_SNI + +#undef HAVE_TLS_EXTENSIONS +#define HAVE_TLS_EXTENSIONS + +#undef HAVE_ALPN +#define HAVE_ALPN + +#undef HAVE_TLS_EXTENSIONS +#define HAVE_TLS_EXTENSIONS + +#undef HAVE_SUPPORTED_CURVES +#define HAVE_SUPPORTED_CURVES + +#undef HAVE_FFDHE_2048 +#define HAVE_FFDHE_2048 + +#undef HAVE_SUPPORTED_CURVES +#define HAVE_SUPPORTED_CURVES + +#undef WOLFSSL_TLS13 +#define WOLFSSL_TLS13 + +#undef HAVE_TLS_EXTENSIONS +#define HAVE_TLS_EXTENSIONS + +#undef HAVE_EXTENDED_MASTER +#define HAVE_EXTENDED_MASTER + +#undef NO_RC4 +#define NO_RC4 + +#undef HAVE_ENCRYPT_THEN_MAC +#define HAVE_ENCRYPT_THEN_MAC + +#undef NO_PSK +#define NO_PSK + +#undef NO_MD4 +#define NO_MD4 + +#undef WOLFSSL_ENCRYPTED_KEYS +#define WOLFSSL_ENCRYPTED_KEYS + +#undef WOLFSSL_SP_MATH_ALL +#define WOLFSSL_SP_MATH_ALL + +#undef WOLFSSL_SP_ARM64 +#define WOLFSSL_SP_ARM64 + +#undef WOLFSSL_AARCH64_BUILD +#define WOLFSSL_AARCH64_BUILD + +#undef WC_NO_ASYNC_THREADING +#define WC_NO_ASYNC_THREADING + +#undef HAVE_DH_DEFAULT_PARAMS +#define HAVE_DH_DEFAULT_PARAMS + +#undef WOLFSSL_SYS_CA_CERTS +#define WOLFSSL_SYS_CA_CERTS + +#undef OPENSSL_EXTRA +#define OPENSSL_EXTRA + +#undef NO_DES3 +#define NO_DES3 + +#undef NO_DES3_TLS_SUITES +#define NO_DES3_TLS_SUITES + +#undef GCM_TABLE_4BIT +#define GCM_TABLE_4BIT + +#undef HAVE_AESGCM +#define HAVE_AESGCM + +#undef HAVE_TLS_EXTENSIONS +#define HAVE_TLS_EXTENSIONS + +#undef HAVE_SERVER_RENEGOTIATION_INFO +#define HAVE_SERVER_RENEGOTIATION_INFO + +#undef HAVE___UINT128_T +#define HAVE___UINT128_T 1 + +#undef HAVE_GETPID +#define HAVE_GETPID 1 + +#undef WOLFSSL_TEST_STATIC_BUILD +#define WOLFSSL_TEST_STATIC_BUILD + +#undef HAVE_WC_INTROSPECTION +#define HAVE_WC_INTROSPECTION + + +#ifdef __cplusplus +} +#endif + + +#endif /* WOLFSSL_OPTIONS_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/quic.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/quic.h @@ -0,0 +1,308 @@ +/* quic.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + +/* wolfSSL QUIC API */ + +#ifndef WOLFSSL_QUIC_H +#define WOLFSSL_QUIC_H + +#ifdef __cplusplus + extern "C" { +#endif + +#ifdef WOLFSSL_QUIC + +#include <stdint.h> + +/* QUIC operates on three encryption levels which determine + * which keys/algos are used for de-/encryption. These are + * kept separately for incoming and outgoing data and. + * Due to the nature of UDP, more than one might be in use + * at the same time due to resends or out-of-order arrivals. + */ +typedef enum wolfssl_encryption_level_t { + wolfssl_encryption_initial = 0, + wolfssl_encryption_early_data, + wolfssl_encryption_handshake, + wolfssl_encryption_application +} WOLFSSL_ENCRYPTION_LEVEL; + + +/* All QUIC related callbacks to the application. + */ +typedef struct wolfssl_quic_method_t WOLFSSL_QUIC_METHOD; + +struct wolfssl_quic_method_t { + /** + * Provide secrets to the QUIC stack when they become available in the SSL + * instance during handshake processing. read/write secrets have the same + * length. A call may only provide one, passing NULL as the other. + */ + int (*set_encryption_secrets)(WOLFSSL* ssl, WOLFSSL_ENCRYPTION_LEVEL level, + const uint8_t* read_secret, + const uint8_t* write_secret, + size_t secret_len); + /** + * Provide handshake packets to the QUIC stack to send to the peer. The + * QUIC stack will wrap these and take care of re-transmissions. + */ + int (*add_handshake_data)(WOLFSSL* ssl, WOLFSSL_ENCRYPTION_LEVEL level, + const uint8_t* data, size_t len); + /** + * Flush any buffered packets during handshake. + */ + int (*flush_flight)(WOLFSSL* ssl); + /** + * Send a TLS alert that happened during handshake. In QUIC, such alerts + * lead to connection shutdown. + */ + int (*send_alert)(WOLFSSL* ssl, WOLFSSL_ENCRYPTION_LEVEL level, + uint8_t alert); +}; + + +/** + * Mark the given SSL context for QUIC protocol handling. Meaning all + * SSL instances derived from it will inherit this. Provides all callbacks + * to the QUIC application the SSL stack needs. + */ +WOLFSSL_API +int wolfSSL_CTX_set_quic_method(WOLFSSL_CTX* ctx, + const WOLFSSL_QUIC_METHOD* quic_method); +/** + * Mark exactly this SSL instance for QUIC protocol handling. + * Provides all callbacks to the QUIC application the SSL stack needs. + */ +WOLFSSL_API +int wolfSSL_set_quic_method(WOLFSSL* ssl, + const WOLFSSL_QUIC_METHOD* quic_method); + +/** + * Check if QUIC handling has been installed on the given SSL instance. + */ +WOLFSSL_API int wolfSSL_is_quic(WOLFSSL* ssl); + +/** + * Return the current encryption level of the SSL instance for READs. + */ +WOLFSSL_API +WOLFSSL_ENCRYPTION_LEVEL wolfSSL_quic_read_level(const WOLFSSL* ssl); + +/** + * Return the current encryption level of the SSL instance for WRITEs. + */ +WOLFSSL_API +WOLFSSL_ENCRYPTION_LEVEL wolfSSL_quic_write_level(const WOLFSSL* ssl); + + +/** + * Configure the QUIC transport version to use. On `use_legacy` != 0, + * selects TLSX_KEY_QUIC_TP_PARAMS_DRAFT, otherwise TLSX_KEY_QUIC_TP_PARAMS. + * This method is part of the BoringSSL API and replicated here for app + * portability (as in quictls/openssl). + */ +WOLFSSL_API +void wolfSSL_set_quic_use_legacy_codepoint(WOLFSSL* ssl, int use_legacy); + +/** + * Set the TLS extension for the transport parameter version to announce + * to the peer. Known values are TLSX_KEY_QUIC_TP_PARAMS (V1) and + * TLSX_KEY_QUIC_TP_PARAMS_DRAFT. + * Setting it to 0 will announce both V1 and draft versions to a server. + * Servers will, on 0, select the latest version seen from the client. + * Default is 0. + */ +WOLFSSL_API +void wolfSSL_set_quic_transport_version(WOLFSSL* ssl, int version); + +/** + * Get the configured transport version. + */ +WOLFSSL_API int wolfSSL_get_quic_transport_version(const WOLFSSL* ssl); + +/** + * Set the raw QUIC transport parameter that will be sent in the TLS extension + * to the peer, using the configured transport version(s). + */ +WOLFSSL_API int wolfSSL_set_quic_transport_params(WOLFSSL* ssl, + const uint8_t* params, + size_t params_len); +/** + * Get the raw QUIC transport parameter as retrieved via TLS Extension + * from the peer. If the peer announced several versions, + * return the latest one. + * If the extension has not arrived yet, initializes out parameter to + * NULL, resp. 0. + */ +WOLFSSL_API +void wolfSSL_get_peer_quic_transport_params(const WOLFSSL* ssl, + const uint8_t* *out_params, + size_t* out_params_len); + +/** + * Get the QUIC version negotiated with the peer during the handshake. + */ +WOLFSSL_API int wolfSSL_get_peer_quic_transport_version(const WOLFSSL* ssl); + +#ifdef WOLFSSL_EARLY_DATA +WOLFSSL_API void wolfSSL_set_quic_early_data_enabled(WOLFSSL* ssl, int enabled); +#endif + +/** + * Advisory amount of the maximum data a QUIC protocol handler should have + * in flight. This varies during handshake processing, for example certificate + * exchange will increase the limit. + */ +WOLFSSL_API +size_t wolfSSL_quic_max_handshake_flight_len(const WOLFSSL* ssl, + WOLFSSL_ENCRYPTION_LEVEL level); + + +/** + * The QUIC protocol handler provides peer TLS records to the SSL instance + * during handshake to progress it. The SSL instance will use the registered + * callbacks to send packets to the peer. + * Encryption level is provided to indicate how to decrypt the data. Data may + * be added for levels not yet reached by the SSL instance. However, data + * may only be added in ever increasing levels and levels may only increase + * at TLS record boundaries. Any violation will make this function fail. + */ +WOLFSSL_API +int wolfSSL_provide_quic_data(WOLFSSL* ssl, WOLFSSL_ENCRYPTION_LEVEL level, + const uint8_t* data, size_t len); + +WOLFSSL_API +int wolfSSL_quic_do_handshake(WOLFSSL* ssl); + +/** + * Process any CRYPTO data added post-handshake. + */ +WOLFSSL_API int wolfSSL_process_quic_post_handshake(WOLFSSL* ssl); + +/** + * Process any pending input and flush all output. Can be invoked + * during and/or after handshake processing. + */ +WOLFSSL_API int wolfSSL_quic_read_write(WOLFSSL* ssl); + +/** + * Get the AEAD cipher that is currently selected in the SSL instance. + * Will return NULL if none has been selected so far. This is used by the + * QUIC stack to encrypt/decrypt packets after the handshake. + */ +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_quic_get_aead(WOLFSSL* ssl); + +/** + * Use to classify the AEAD cipher for key reuse limits. + */ +WOLFSSL_API int wolfSSL_quic_aead_is_gcm(const WOLFSSL_EVP_CIPHER* aead_cipher); +WOLFSSL_API int wolfSSL_quic_aead_is_ccm(const WOLFSSL_EVP_CIPHER* aead_cipher); +WOLFSSL_API +int wolfSSL_quic_aead_is_chacha20(const WOLFSSL_EVP_CIPHER* aead_cipher); + +/** + * Get the 'tag' length used by the AEAD cipher. Encryption buffer lengths + * are plaintext length plus this tag length. + */ +WOLFSSL_API +size_t wolfSSL_quic_get_aead_tag_len(const WOLFSSL_EVP_CIPHER* aead_cipher); + +/** + * The message digest currently selected in the SSL instance. + */ +WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_quic_get_md(WOLFSSL* ssl); + +/** + * The QUIC header protection cipher matching the AEAD cipher currently + * selected in the SSL instance. + */ +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_quic_get_hp(WOLFSSL* ssl); + +/** + * Create and initialize a cipher context for use in en- or decryption. + */ +WOLFSSL_API WOLFSSL_EVP_CIPHER_CTX* +wolfSSL_quic_crypt_new(const WOLFSSL_EVP_CIPHER* cipher, + const uint8_t* key, const uint8_t* iv, int encrypt); + +/** + * Use a previously created cipher context to encrypt the given plain text. + */ +WOLFSSL_API +int wolfSSL_quic_aead_encrypt(uint8_t* dest, WOLFSSL_EVP_CIPHER_CTX* aead_ctx, + const uint8_t* plain, size_t plainlen, + const uint8_t* iv, const uint8_t* aad, + size_t aadlen); +/** + * Use a previously created cipher context to decrypt the given encoded text. + */ +WOLFSSL_API +int wolfSSL_quic_aead_decrypt(uint8_t* dest, WOLFSSL_EVP_CIPHER_CTX* ctx, + const uint8_t* enc, size_t enclen, + const uint8_t* iv, const uint8_t* aad, + size_t aadlen); + +/** + * Extract a pseudo-random key, using the given message digest, a secret + * and a salt. The key size is the size of the digest. + */ +WOLFSSL_API +int wolfSSL_quic_hkdf_extract(uint8_t* dest, const WOLFSSL_EVP_MD* md, + const uint8_t* secret, size_t secretlen, + const uint8_t* salt, size_t saltlen); +/** + * Expand a pseudo-random key (secret) into a new key, using the mesasge + * digest and the info bytes. + */ +WOLFSSL_API +int wolfSSL_quic_hkdf_expand(uint8_t* dest, size_t destlen, + const WOLFSSL_EVP_MD* md, + const uint8_t* secret, size_t secretlen, + const uint8_t* info, size_t infolen); + +/** + * Extract and extpand secret, salt and info into a new key. + */ +WOLFSSL_API +int wolfSSL_quic_hkdf(uint8_t* dest, size_t destlen, + const WOLFSSL_EVP_MD* md, + const uint8_t* secret, size_t secretlen, + const uint8_t* salt, size_t saltlen, + const uint8_t* info, size_t infolen); + +/* most common QUIC packet size as of 2022 was 1,200 bytes + * largest packet size listed in the RFC is 1,392 bytes + * this gives plenty of breathing room for capacity of records but keeps sizes + * read from the wire sane */ +#ifndef WOLFSSL_QUIC_MAX_RECORD_CAPACITY + /* 1024*1024 -- 1 MB */ + #define WOLFSSL_QUIC_MAX_RECORD_CAPACITY (1048576) +#endif + +#endif /* WOLFSSL_QUIC */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_QUIC_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/sniffer.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/sniffer.h @@ -0,0 +1,359 @@ +/* sniffer.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + +#ifndef WOLFSSL_SNIFFER_H +#define WOLFSSL_SNIFFER_H + +#include <wolfssl/wolfcrypt/settings.h> +#include <wolfssl/wolfcrypt/asn_public.h> + +#ifdef HAVE_WOLF_EVENT + #include <wolfssl/wolfcrypt/wolfevent.h> +#endif + + +#ifdef _WIN32 + #ifdef SSL_SNIFFER_EXPORTS + #define SSL_SNIFFER_API __declspec(dllexport) + #else + #define SSL_SNIFFER_API __declspec(dllimport) + #endif +#else + #define SSL_SNIFFER_API +#endif /* _WIN32 */ + + +#ifdef __cplusplus + extern "C" { +#endif + + +typedef struct IpAddrInfo { + int version; + union { + word32 ip4; + byte ip6[16]; + }; +} IpAddrInfo; + +typedef struct SnifferStreamInfo { + IpAddrInfo src; /* server address in network byte order */ + IpAddrInfo dst; /* client address in network byte order */ + word16 dstPort; /* server port */ + word16 srcPort; /* client port */ +} SnifferStreamInfo; + +/* @param typeK: (formerly keyType) was shadowing a global declaration in + * wolfssl/wolfcrypt/asn.h line 175 + */ +WOLFSSL_API +SSL_SNIFFER_API int ssl_SetPrivateKey(const char* address, int port, + const char* keyFile, int typeK, + const char* password, char* error); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_SetPrivateKeyBuffer(const char* address, int port, + const char* keyBuf, int keySz, + int typeK, const char* password, + char* error); + + +WOLFSSL_API +SSL_SNIFFER_API int ssl_SetNamedPrivateKey(const char* name, + const char* address, int port, + const char* keyFile, int typeK, + const char* password, char* error); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_SetNamedPrivateKeyBuffer(const char* name, + const char* address, int port, + const char* keyBuf, int keySz, + int typeK, const char* password, + char* error); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_SetEphemeralKey(const char* address, int port, + const char* keyFile, int typeKey, + const char* password, char* error); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_SetEphemeralKeyBuffer(const char* address, int port, + const char* keyBuf, int keySz, int typeKey, + const char* password, char* error); + + +WOLFSSL_API +SSL_SNIFFER_API int ssl_SetNamedEphemeralKey(const char* name, + const char* address, int port, + const char* keyFile, int typeKey, + const char* password, char* error); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_SetNamedEphemeralKeyBuffer(const char* name, + const char* address, int port, + const char* keyBuf, int keySz, int typeKey, + const char* password, char* error); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_DecodePacket(const unsigned char* packet, int length, + unsigned char** data, char* error); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_FreeDecodeBuffer(unsigned char** data, char* error); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_FreeZeroDecodeBuffer(unsigned char** data, int sz, + char* error); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_Trace(const char* traceFile, char* error); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_EnableRecovery(int onOff, int maxMemory, char* error); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_GetSessionStats(unsigned int* active, + unsigned int* total, + unsigned int* peak, + unsigned int* maxSessions, + unsigned int* missedData, + unsigned int* reassemblyMemory, + char* error); + +WOLFSSL_API +SSL_SNIFFER_API void ssl_InitSniffer(void); +WOLFSSL_API +SSL_SNIFFER_API void ssl_InitSniffer_ex(int devId); +WOLFSSL_API +SSL_SNIFFER_API void ssl_InitSniffer_ex2(int threadNum); + +WOLFSSL_API +SSL_SNIFFER_API void ssl_FreeSniffer(void); + +WOLFSSL_API +SSL_SNIFFER_API void ssl_RemoveStaleSessions(void); + +/* ssl_SetPrivateKey typeKs */ +enum { + FILETYPE_PEM = 1, + FILETYPE_DER = 2, +}; + + +/* + * New Sniffer API that provides read-only access to the TLS and cipher + * information associated with the SSL session. + */ + +typedef struct SSLInfo +{ + unsigned char isValid; + /* indicates if the info in this struct is valid: 0 = no, 1 = yes */ + unsigned char protocolVersionMajor; /* SSL Version: major */ + unsigned char protocolVersionMinor; /* SSL Version: minor */ + unsigned char serverCipherSuite0; /* first byte, normally 0 */ + unsigned char serverCipherSuite; /* second byte, actual suite */ + unsigned char serverCipherSuiteName[256]; + /* cipher name, e.g., "TLS_RSA_..." */ + unsigned char serverNameIndication[128]; + unsigned int keySize; +} SSLInfo; + + +WOLFSSL_API +SSL_SNIFFER_API int ssl_DecodePacketWithSessionInfo( + const unsigned char* packet, int length, + unsigned char** data, SSLInfo* sslInfo, char* error); + +typedef void (*SSLConnCb)(const void* session, SSLInfo* info, void* ctx); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_SetConnectionCb(SSLConnCb cb); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_SetConnectionCtx(void* ctx); + + +typedef struct SSLStats +{ + unsigned long int sslStandardConns; /* server_hello count not including resumed sessions */ + unsigned long int sslClientAuthConns; /* client's who have presented certificates (mutual authentication) */ + unsigned long int sslResumedConns; /* resumed connections */ + unsigned long int sslEphemeralMisses; /* TLS v1.2 and older PFS / ephemeral connections missed (not able to decrypt) */ + unsigned long int sslResumeMisses; /* Resumption sessions not found */ + unsigned long int sslCiphersUnsupported; /* No cipher suite match found when compared to supported */ + unsigned long int sslKeysUnmatched; /* Key callback failures (not found). Applies to WOLFSSL_SNIFFER_WATCH only */ + unsigned long int sslKeyFails; /* Failures loading or using keys */ + unsigned long int sslDecodeFails; /* Dropped packets (not application_data or match protocol version) */ + unsigned long int sslAlerts; /* Number of decoded alert messages */ + unsigned long int sslDecryptedBytes; /* Number of decrypted bytes */ + unsigned long int sslEncryptedBytes; /* Number of encrypted bytes */ + unsigned long int sslEncryptedPackets; /* Number of encrypted packets */ + unsigned long int sslDecryptedPackets; /* Number of decrypted packets */ + unsigned long int sslKeyMatches; /* Key callback successes (failures tracked in sslKeysUnmatched). Applies to WOLFSSL_SNIFFER_WATCH only. */ + unsigned long int sslEncryptedConns; /* Number of created sniffer sessions */ + unsigned long int sslResumptionInserts; /* Number of sessions reused with resumption */ +} SSLStats; + +WOLFSSL_API +SSL_SNIFFER_API int ssl_ResetStatistics(void); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_ReadStatistics(SSLStats* stats); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_ReadResetStatistics(SSLStats* stats); + + +#if defined(WOLFSSL_STATIC_EPHEMERAL) && defined(WOLFSSL_TLS13) +/* macro indicating support for key callback */ +#undef WOLFSSL_SNIFFER_KEY_CALLBACK +#define WOLFSSL_SNIFFER_KEY_CALLBACK + +typedef int (*SSLKeyCb)(void* vSniffer, int namedGroup, + const unsigned char* srvPub, unsigned int srvPubSz, + const unsigned char* cliPub, unsigned int cliPubSz, + DerBuffer* privKey, void* cbCtx, char* error); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_SetKeyCallback(SSLKeyCb cb, void* cbCtx); +#endif + + +#ifdef WOLFSSL_SNIFFER_WATCH +typedef int (*SSLWatchCb)(void* vSniffer, + const unsigned char* certHash, + unsigned int certHashSz, + const unsigned char* certChain, + unsigned int certChainSz, + void* ctx, char* error); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_SetWatchKeyCallback(SSLWatchCb cb, char* error); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_SetWatchKeyCallback_ex(SSLWatchCb cb, int devId, + char* error); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_SetWatchKeyCtx(void* ctx, char* error); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_SetWatchKey_buffer(void* vSniffer, + const unsigned char* key, unsigned int keySz, + int keyType, char* error); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_SetWatchKey_file(void* vSniffer, + const char* keyFile, int keyType, + const char* password, char* error); +#endif + +#ifdef WOLFSSL_SNIFFER_STORE_DATA_CB +typedef int (*SSLStoreDataCb)(const unsigned char* decryptBuf, + unsigned int decryptBufSz, unsigned int decryptBufOffset, void* ctx); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_SetStoreDataCallback(SSLStoreDataCb cb); +#endif + +#ifdef WOLFSSL_SNIFFER_STORE_DATA_CB +WOLFSSL_API +SSL_SNIFFER_API int ssl_DecodePacketWithSessionInfoStoreData( + const unsigned char* packet, int length, void* ctx, + SSLInfo* sslInfo, char* error); +#endif + +#ifdef WOLFSSL_SNIFFER_CHAIN_INPUT +WOLFSSL_API +SSL_SNIFFER_API int ssl_DecodePacketWithChain(void* vChain, + unsigned int chainSz, unsigned char** data, char* error); +#endif + +#if defined(WOLFSSL_SNIFFER_CHAIN_INPUT) && \ + defined(WOLFSSL_SNIFFER_STORE_DATA_CB) +WOLFSSL_API +SSL_SNIFFER_API int ssl_DecodePacketWithChainSessionInfoStoreData( + void* vChain, unsigned int chainSz, void* ctx, SSLInfo* sslInfo, + char* error); +#endif + +WOLFSSL_API +SSL_SNIFFER_API int ssl_DecodePacket_GetStream(SnifferStreamInfo* info, + const byte* packet, int length, char* error); + +#ifdef WOLFSSL_ASYNC_CRYPT + +WOLFSSL_API +SSL_SNIFFER_API int ssl_DecodePacketAsync(void* packet, unsigned int packetSz, + int isChain, unsigned char** data, char* error, SSLInfo* sslInfo, + void* userCtx); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_PollSniffer(WOLF_EVENT** events, int maxEvents, + WOLF_EVENT_FLAG flags, int* eventCount); + +#endif /* WOLFSSL_ASYNC_CRYPT */ + +#ifdef WOLFSSL_SNIFFER_KEYLOGFILE + +typedef enum { + SNIFFER_SECRET_TLS12_MASTER_SECRET, +#if defined(WOLFSSL_TLS13) + SNIFFER_SECRET_CLIENT_EARLY_TRAFFIC_SECRET, + SNIFFER_SECRET_CLIENT_HANDSHAKE_TRAFFIC_SECRET, + SNIFFER_SECRET_SERVER_HANDSHAKE_TRAFFIC_SECRET, + SNIFFER_SECRET_CLIENT_TRAFFIC_SECRET, + SNIFFER_SECRET_SERVER_TRAFFIC_SECRET, +#endif /* WOLFSSL_TLS13 */ + SNIFFER_SECRET_NUM_SECRET_TYPES +} SnifferSecretType; + + +WOLFSSL_API +SSL_SNIFFER_API int ssl_CreateKeyLogSnifferServer(const char* address, + int port, + char* error); + +WOLFSSL_API +SSL_SNIFFER_API int ssl_LoadSecretsFromKeyLogFile(const char* keylogfile, + char* error); + +typedef int (*SSLSnifferSecretCb)(unsigned char* client_random, + int type, + unsigned char* output_secret); + +#endif /* WOLFSSL_SNIFFER_KEYLOGFILE */ + +WOLFSSL_API +SSL_SNIFFER_API int ssl_RemoveSession(const char* clientIp, int clientPort, + const char* serverIp, int serverPort, + char* error); + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* wolfSSL_SNIFFER_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/sniffer_error.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/sniffer_error.h @@ -0,0 +1,151 @@ +/* sniffer_error.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + +#ifndef WOLFSSL_SNIFFER_ERROR_H +#define WOLFSSL_SNIFFER_ERROR_H + + +/* General Sniffer Error */ +#define WOLFSSL_SNIFFER_ERROR -1 + +/* Sniffer failed and is in Fatal state */ +#define WOLFSSL_SNIFFER_FATAL_ERROR -2 + +/* need to have errors as #defines since .rc files can't handle enums */ +/* need to start at 1 and go in order for same reason */ + +#define MEMORY_STR 1 +#define NEW_SERVER_STR 2 +#define IP_CHECK_STR 3 +#define SERVER_NOT_REG_STR 4 +#define TCP_CHECK_STR 5 +#define SERVER_PORT_NOT_REG_STR 6 +#define RSA_DECRYPT_STR 7 +#define RSA_DECODE_STR 8 +#define BAD_CIPHER_SPEC_STR 9 +#define SERVER_HELLO_INPUT_STR 10 + +#define BAD_SESSION_RESUME_STR 11 +#define SERVER_DID_RESUMPTION_STR 12 +#define CLIENT_HELLO_INPUT_STR 13 +#define CLIENT_RESUME_TRY_STR 14 +#define HANDSHAKE_INPUT_STR 15 +#define GOT_HELLO_VERIFY_STR 16 +#define GOT_SERVER_HELLO_STR 17 +#define GOT_CERT_REQ_STR 18 +#define GOT_SERVER_KEY_EX_STR 19 +#define GOT_CERT_STR 20 + +#define GOT_SERVER_HELLO_DONE_STR 21 +#define GOT_FINISHED_STR 22 +#define GOT_CLIENT_HELLO_STR 23 +#define GOT_CLIENT_KEY_EX_STR 24 +#define GOT_CERT_VER_STR 25 +#define GOT_UNKNOWN_HANDSHAKE_STR 26 +#define NEW_SESSION_STR 27 +#define BAD_NEW_SSL_STR 28 +#define GOT_PACKET_STR 29 +#define NO_DATA_STR 30 + +#define BAD_SESSION_STR 31 +#define GOT_OLD_CLIENT_HELLO_STR 32 +#define OLD_CLIENT_INPUT_STR 33 +#define OLD_CLIENT_OK_STR 34 +#define BAD_OLD_CLIENT_STR 35 +#define BAD_RECORD_HDR_STR 36 +#define RECORD_INPUT_STR 37 +#define GOT_HANDSHAKE_STR 38 +#define BAD_HANDSHAKE_STR 39 +#define GOT_CHANGE_CIPHER_STR 40 + +#define GOT_APP_DATA_STR 41 +#define BAD_APP_DATA_STR 42 +#define GOT_ALERT_STR 43 +#define ANOTHER_MSG_STR 44 +#define REMOVE_SESSION_STR 45 +#define KEY_FILE_STR 46 +#define BAD_IPVER_STR 47 +#define BAD_PROTO_STR 48 +#define PACKET_HDR_SHORT_STR 49 +#define GOT_UNKNOWN_RECORD_STR 50 + +#define BAD_TRACE_FILE_STR 51 +#define FATAL_ERROR_STR 52 +#define PARTIAL_INPUT_STR 53 +#define BUFFER_ERROR_STR 54 +#define PARTIAL_ADD_STR 55 +#define DUPLICATE_STR 56 +#define OUT_OF_ORDER_STR 57 +#define OVERLAP_DUPLICATE_STR 58 +#define OVERLAP_REASSEMBLY_BEGIN_STR 59 +#define OVERLAP_REASSEMBLY_END_STR 60 + +#define MISSED_CLIENT_HELLO_STR 61 +#define GOT_HELLO_REQUEST_STR 62 +#define GOT_SESSION_TICKET_STR 63 +#define BAD_INPUT_STR 64 +#define BAD_DECRYPT_TYPE 65 +#define BAD_FINISHED_MSG 66 +#define BAD_COMPRESSION_STR 67 +#define BAD_DERIVE_STR 68 +#define ACK_MISSED_STR 69 +#define BAD_DECRYPT 70 + +#define DECRYPT_KEYS_NOT_SETUP 71 +#define CLIENT_HELLO_LATE_KEY_STR 72 +#define GOT_CERT_STATUS_STR 73 +#define RSA_KEY_MISSING_STR 74 +#define NO_SECURE_RENEGOTIATION 75 +#define BAD_SESSION_STATS 76 +#define REASSEMBLY_MAX_STR 77 +#define DROPPING_LOST_FRAG_STR 78 +#define DROPPING_PARTIAL_RECORD 79 +#define CLEAR_ACK_FAULT 80 + +#define BAD_DECRYPT_SIZE 81 +#define EXTENDED_MASTER_HASH_STR 82 +#define SPLIT_HANDSHAKE_MSG_STR 83 +#define ECC_DECODE_STR 84 +#define ECC_PUB_DECODE_STR 85 +#define WATCH_CB_MISSING_STR 86 +#define WATCH_HASH_STR 87 +#define WATCH_FAIL_STR 88 +#define BAD_CERT_MSG_STR 89 +#define STORE_DATA_CB_MISSING_STR 90 + +#define NO_DATA_DEST_STR 91 +#define STORE_DATA_FAIL_STR 92 +#define CHAIN_INPUT_STR 93 +#define GOT_ENC_EXT_STR 94 +#define GOT_HELLO_RETRY_REQ_STR 95 + +#define SNIFFER_KEY_SETUP_STR 96 +#define UNSUPPORTED_TLS_VER_STR 97 +#define KEY_MISMATCH_STR 98 + +#define KEYLOG_FILE_INVALID 99 +/* !!!! also add to msgTable in sniffer.c and .rc file !!!! */ + + +#endif /* wolfSSL_SNIFFER_ERROR_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/ssl.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/ssl.h @@ -0,0 +1,6223 @@ +/* ssl.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ +/*! + \file ../wolfssl/ssl.h + \brief Header file containing key wolfSSL API +*/ + +/* wolfSSL API */ + +#ifndef WOLFSSL_SSL_H +#define WOLFSSL_SSL_H + + +/* for users not using preprocessor flags*/ +#include <wolfssl/wolfcrypt/settings.h> +#include <wolfssl/version.h> +#include <wolfssl/error-ssl.h> +#include <wolfssl/wolfcrypt/asn_public.h> +#include <wolfssl/wolfcrypt/logging.h> +#include <wolfssl/wolfcrypt/memory.h> +#include <wolfssl/wolfcrypt/types.h> +#include <wolfssl/wolfcrypt/pkcs12.h> + +#if defined(HAVE_OCSP) || defined(HAVE_CRL) || (defined(WOLFSSL_CUSTOM_OID) && \ + defined(WOLFSSL_ASN_TEMPLATE) && defined(HAVE_OID_DECODING)) || \ + defined(WC_ASN_UNKNOWN_EXT_CB) +#include "wolfssl/wolfcrypt/asn.h" +#endif + +/* For the types */ +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) +#include <wolfssl/openssl/compat_types.h> +#endif + +#ifdef HAVE_WOLF_EVENT + #include <wolfssl/wolfcrypt/wolfevent.h> +#endif + + #ifdef WOLF_CRYPTO_CB + #include <wolfssl/wolfcrypt/cryptocb.h> +#endif + +/* used internally by wolfSSL while OpenSSL types aren't */ +#include <wolfssl/callbacks.h> + +#ifdef WOLFSSL_PREFIX + #include "prefix_ssl.h" +#endif + +#ifdef LIBWOLFSSL_VERSION_STRING + #define WOLFSSL_VERSION LIBWOLFSSL_VERSION_STRING +#endif + +#ifdef _WIN32 + /* wincrypt.h clashes */ + #undef OCSP_REQUEST + #undef OCSP_RESPONSE +#endif + +#ifdef OPENSSL_ALL + #if !defined(WOLFSSL_HAVE_BIO_ADDR) && !defined(WOLFSSL_NO_SOCK) + #define WOLFSSL_HAVE_BIO_ADDR + #endif + #if defined(WOLFSSL_DTLS) && !defined(WOLFSSL_DTLS_MTU) + #define WOLFSSL_DTLS_MTU + #endif +#endif + +#if (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) + #include <wolfssl/openssl/bn.h> + #ifndef WOLFCRYPT_ONLY + #include <wolfssl/openssl/hmac.h> + #endif + #if defined(WOLFSSL_CMAC) && !defined(NO_AES) && defined(WOLFSSL_AES_DIRECT) + #include <wolfssl/openssl/cmac.h> + #endif +#endif + +#ifdef OPENSSL_COEXIST + /* mode to allow wolfSSL and OpenSSL to coexist without symbol conflicts */ + + #ifndef NO_OLD_SSL_NAMES + #define NO_OLD_SSL_NAMES + #endif + #ifndef NO_OLD_WC_NAMES + #define NO_OLD_WC_NAMES + #endif + + #ifdef TEST_OPENSSL_COEXIST + /* + ./configure --enable-opensslcoexist \ + CFLAGS="-I/usr/local/opt/openssl/include -DTEST_OPENSSL_COEXIST" \ + LDFLAGS="-L/usr/local/opt/openssl/lib -lcrypto" + */ + #include <openssl/ssl.h> + #include <openssl/rand.h> + #include <openssl/err.h> + #include <openssl/ec.h> + #include <openssl/hmac.h> + #include <openssl/bn.h> + #include <openssl/crypto.h> + #if !defined(HAVE_SELFTEST) && (!defined(HAVE_FIPS) || \ + FIPS_VERSION3_GE(5,2,0)) + #include <openssl/aes.h> + #include <openssl/blowfish.h> + #include <openssl/camellia.h> + #include <openssl/cast.h> + #include <openssl/cmac.h> + #include <openssl/cms.h> + #include <openssl/conf_api.h> + #include <openssl/des.h> + #include <openssl/dh.h> + #include <openssl/dsa.h> + #include <openssl/ecdh.h> + #include <openssl/ecdsa.h> + #include <openssl/engine.h> + #include <openssl/hmac.h> + #include <openssl/idea.h> + #include <openssl/kdf.h> + #include <openssl/md2.h> + #include <openssl/md4.h> + #include <openssl/md5.h> + #include <openssl/mdc2.h> + #include <openssl/modes.h> + #include <openssl/ocsp.h> + #include <openssl/ossl_typ.h> + #include <openssl/pem2.h> + #include <openssl/pem.h> + #include <openssl/pkcs12.h> + #include <openssl/pkcs7.h> + #include <openssl/rand.h> + #include <openssl/rc2.h> + #include <openssl/rc4.h> + #include <openssl/rc5.h> + #include <openssl/ripemd.h> + #include <openssl/rsa.h> + #if defined(HAVE_FIPS_VERSION) && FIPS_VERSION3_LT(6,0,0) + /* clear conflicting name */ + #undef RSA_PKCS1_PADDING_SIZE + #endif + #include <openssl/seed.h> + #include <openssl/sha.h> + #include <openssl/srp.h> + #include <openssl/srtp.h> + #include <openssl/ssl.h> + #include <openssl/store.h> + #include <openssl/txt_db.h> + #include <openssl/ui.h> + #include <openssl/whrlpool.h> + + #if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x30000000L + #include <openssl/cmp.h> + #include <openssl/core_object.h> + #include <openssl/decoder.h> + #include <openssl/encoder.h> + #include <openssl/ess.h> + #include <openssl/fipskey.h> + #include <openssl/fips_names.h> + #if OPENSSL_VERSION_NUMBER >= 0x30200000L + #include <openssl/hpke.h> + #endif + #include <openssl/http.h> + #include <openssl/param_build.h> + #include <openssl/params.h> + #include <openssl/proverr.h> + #include <openssl/provider.h> + #include <openssl/self_test.h> + #endif /* OPENSSL_VERSION_NUMBER >= 0x30000000L */ + + #endif /* !HAVE_SELFTEST && (!HAVE_FIPS || FIPS_VERSION3_GE(5,2,0)) */ + + #endif + +#elif (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) + #include <wolfssl/openssl/rsa.h> + + /* We need the old SSL names */ + #if defined(NO_OLD_SSL_NAMES) && !defined(OPENSSL_COEXIST) + #undef NO_OLD_SSL_NAMES + #endif + #if defined(NO_OLD_WC_NAMES) && !defined(OPENSSL_COEXIST) + #undef NO_OLD_WC_NAMES + #endif +#endif + +#ifdef __cplusplus + extern "C" { +#endif + + +#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) || defined(WOLFSSL_WPAS_SMALL) +#ifndef WOLFSSL_LOCAL_X509_STORE +#define WOLFSSL_LOCAL_X509_STORE +#endif +#endif + +/* LHASH is implemented as a stack */ +typedef struct WOLFSSL_STACK WOLFSSL_LHASH; +#ifndef WOLF_LHASH_OF + #define WOLF_LHASH_OF(x) WOLFSSL_LHASH +#endif + +#ifndef WOLF_STACK_OF + #define WOLF_STACK_OF(x) WOLFSSL_STACK +#endif +#ifndef DECLARE_STACK_OF + #define DECLARE_STACK_OF(x) WOLF_STACK_OF(x); +#endif + +#ifndef WOLFSSL_TYPE_DEFINED +#define WOLFSSL_TYPE_DEFINED +typedef struct WOLFSSL WOLFSSL; +#endif +typedef struct WOLFSSL_SESSION WOLFSSL_SESSION; +typedef struct WOLFSSL_METHOD WOLFSSL_METHOD; +#ifndef WOLFSSL_CTX_TYPE_DEFINED +#define WOLFSSL_CTX_TYPE_DEFINED +typedef struct WOLFSSL_CTX WOLFSSL_CTX; +#endif + +typedef struct WOLFSSL_STACK WOLFSSL_STACK; +typedef struct WOLFSSL_X509 WOLFSSL_X509; +typedef struct WOLFSSL_X509_ACERT WOLFSSL_X509_ACERT; +typedef struct WOLFSSL_X509_NAME WOLFSSL_X509_NAME; +typedef struct WOLFSSL_X509_NAME_ENTRY WOLFSSL_X509_NAME_ENTRY; +typedef struct WOLFSSL_X509_PUBKEY WOLFSSL_X509_PUBKEY; +typedef struct WOLFSSL_X509_ALGOR WOLFSSL_X509_ALGOR; +typedef struct WOLFSSL_X509_CHAIN WOLFSSL_X509_CHAIN; +typedef struct WC_PKCS12 WOLFSSL_X509_PKCS12; +typedef struct WOLFSSL_X509_INFO WOLFSSL_X509_INFO; + +typedef struct WOLFSSL_CERT_MANAGER WOLFSSL_CERT_MANAGER; +typedef struct WOLFSSL_SOCKADDR WOLFSSL_SOCKADDR; +typedef struct WOLFSSL_CRL WOLFSSL_CRL; +typedef struct WOLFSSL_X509_STORE_CTX WOLFSSL_X509_STORE_CTX; + +typedef struct WOLFSSL_BY_DIR_HASH WOLFSSL_BY_DIR_HASH; +typedef struct WOLFSSL_BY_DIR_entry WOLFSSL_BY_DIR_entry; +typedef struct WOLFSSL_BY_DIR WOLFSSL_BY_DIR; + +/* redeclare guard */ +#define WOLFSSL_TYPES_DEFINED + +#include <wolfssl/wolfio.h> + +/* The WOLFSSL_RSA type is required in all build configurations. */ +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) +#include <wolfssl/openssl/rsa.h> +#endif + +#ifndef WC_RNG_TYPE_DEFINED /* guard on redeclaration */ + typedef struct WC_RNG WC_RNG; + #define WC_RNG_TYPE_DEFINED +#endif + +#ifndef WOLFSSL_DSA_TYPE_DEFINED /* guard on redeclaration */ +typedef struct WOLFSSL_DSA WOLFSSL_DSA; +#define WOLFSSL_DSA_TYPE_DEFINED +#endif + +#ifndef WOLFSSL_EC_TYPE_DEFINED /* guard on redeclaration */ +typedef struct WOLFSSL_EC_KEY WOLFSSL_EC_KEY; +typedef struct WOLFSSL_EC_POINT WOLFSSL_EC_POINT; +typedef struct WOLFSSL_EC_GROUP WOLFSSL_EC_GROUP; +typedef struct WOLFSSL_EC_BUILTIN_CURVE WOLFSSL_EC_BUILTIN_CURVE; +/* WOLFSSL_EC_METHOD is just an alias of WOLFSSL_EC_GROUP for now */ +typedef struct WOLFSSL_EC_GROUP WOLFSSL_EC_METHOD; +#define WOLFSSL_EC_TYPE_DEFINED +#endif + +#ifndef WOLFSSL_ECDSA_TYPE_DEFINED /* guard on redeclaration */ +typedef struct WOLFSSL_ECDSA_SIG WOLFSSL_ECDSA_SIG; +#define WOLFSSL_ECDSA_TYPE_DEFINED +#endif + +typedef struct WOLFSSL_CIPHER WOLFSSL_CIPHER; +typedef struct WOLFSSL_X509_LOOKUP WOLFSSL_X509_LOOKUP; +typedef struct WOLFSSL_X509_LOOKUP_METHOD WOLFSSL_X509_LOOKUP_METHOD; +typedef struct WOLFSSL_CRL WOLFSSL_X509_CRL; +typedef struct WOLFSSL_X509_STORE WOLFSSL_X509_STORE; +typedef struct WOLFSSL_X509_VERIFY_PARAM WOLFSSL_X509_VERIFY_PARAM; +typedef struct WOLFSSL_BIO_METHOD WOLFSSL_BIO_METHOD; +typedef struct WOLFSSL_X509_EXTENSION WOLFSSL_X509_EXTENSION; +typedef struct WOLFSSL_ASN1_OBJECT WOLFSSL_ASN1_OBJECT; +typedef struct WOLFSSL_ASN1_OTHERNAME WOLFSSL_ASN1_OTHERNAME; +#ifndef OPENSSL_COEXIST +typedef struct WOLFSSL_ASN1_OTHERNAME OTHERNAME; +#endif +typedef struct WOLFSSL_X509V3_CTX WOLFSSL_X509V3_CTX; +typedef struct WOLFSSL_v3_ext_method WOLFSSL_v3_ext_method; +typedef struct WOLFSSL_OBJ_NAME WOLFSSL_OBJ_NAME; + +typedef struct WOLFSSL_ASN1_STRING WOLFSSL_ASN1_STRING; +typedef struct WOLFSSL_dynlock_value WOLFSSL_dynlock_value; +#ifndef WOLFSSL_DH_TYPE_DEFINED /* guard on redeclaration */ +typedef struct WOLFSSL_DH WOLFSSL_DH; +#define WOLFSSL_DH_TYPE_DEFINED /* guard on redeclaration */ +#endif +typedef struct WOLFSSL_ASN1_BIT_STRING WOLFSSL_ASN1_BIT_STRING; +typedef struct WOLFSSL_ASN1_TYPE WOLFSSL_ASN1_TYPE; +typedef struct WOLFSSL_X509_ATTRIBUTE WOLFSSL_X509_ATTRIBUTE; + +typedef struct WOLFSSL_GENERAL_NAME WOLFSSL_GENERAL_NAME; +typedef struct WOLFSSL_AUTHORITY_KEYID WOLFSSL_AUTHORITY_KEYID; +typedef struct WOLFSSL_BASIC_CONSTRAINTS WOLFSSL_BASIC_CONSTRAINTS; +typedef struct WOLFSSL_ACCESS_DESCRIPTION WOLFSSL_ACCESS_DESCRIPTION; +typedef struct WOLFSSL_DIST_POINT_NAME WOLFSSL_DIST_POINT_NAME; +typedef struct WOLFSSL_DIST_POINT WOLFSSL_DIST_POINT; + +typedef struct WOLFSSL_CONF_CTX WOLFSSL_CONF_CTX; + +typedef int (*WOLFSSL_X509_STORE_CTX_get_crl_cb)(WOLFSSL_X509_STORE_CTX *, + WOLFSSL_X509_CRL **, WOLFSSL_X509 *); +typedef int (*WOLFSSL_X509_STORE_CTX_check_crl_cb)(WOLFSSL_X509_STORE_CTX *, + WOLFSSL_X509_CRL *); + +#define WOLFSSL_V_ASN1_BIT_STRING 0x03 +#define WOLFSSL_V_ASN1_INTEGER 0x02 +#define WOLFSSL_V_ASN1_NEG 0x100 +#define WOLFSSL_V_ASN1_NEG_INTEGER (2 | WOLFSSL_V_ASN1_NEG) +#define WOLFSSL_V_ASN1_NEG_ENUMERATED (10 | WOLFSSL_V_ASN1_NEG) + +/* Type for ASN1_print_ex */ +#define WOLFSSL_ASN1_STRFLGS_ESC_2253 1 +#define WOLFSSL_ASN1_STRFLGS_ESC_CTRL 2 +#define WOLFSSL_ASN1_STRFLGS_ESC_MSB 4 +#define WOLFSSL_ASN1_STRFLGS_ESC_QUOTE 8 +#define WOLFSSL_ASN1_STRFLGS_UTF8_CONVERT 0x10 +#define WOLFSSL_ASN1_STRFLGS_IGNORE_TYPE 0x20 +#define WOLFSSL_ASN1_STRFLGS_SHOW_TYPE 0x40 +#define WOLFSSL_ASN1_STRFLGS_DUMP_ALL 0x80 +#define WOLFSSL_ASN1_STRFLGS_DUMP_UNKNOWN 0x100 +#define WOLFSSL_ASN1_STRFLGS_DUMP_DER 0x200 +#define WOLFSSL_ASN1_STRFLGS_RFC2253 (WOLFSSL_ASN1_STRFLGS_ESC_2253 | \ + WOLFSSL_ASN1_STRFLGS_ESC_CTRL | \ + WOLFSSL_ASN1_STRFLGS_ESC_MSB | \ + WOLFSSL_ASN1_STRFLGS_UTF8_CONVERT | \ + WOLFSSL_ASN1_STRFLGS_DUMP_UNKNOWN | \ + WOLFSSL_ASN1_STRFLGS_DUMP_DER) + +#define WOLFSSL_MBSTRING_UTF8 0x1000 +#define WOLFSSL_MBSTRING_ASC 0x1001 +#define WOLFSSL_MBSTRING_BMP 0x1002 +#define WOLFSSL_MBSTRING_UNIV 0x1004 + +#define WOLFSSL_V_ASN1_EOC 0 +#define WOLFSSL_V_ASN1_BOOLEAN 1 +#define WOLFSSL_V_ASN1_OCTET_STRING 4 +#define WOLFSSL_V_ASN1_NULL 5 +#define WOLFSSL_V_ASN1_OBJECT 6 +#define WOLFSSL_V_ASN1_UTF8STRING 12 +#define WOLFSSL_V_ASN1_SEQUENCE 16 +#define WOLFSSL_V_ASN1_SET 17 +#define WOLFSSL_V_ASN1_PRINTABLESTRING 19 +#define WOLFSSL_V_ASN1_T61STRING 20 +#define WOLFSSL_V_ASN1_IA5STRING 22 +#define WOLFSSL_V_ASN1_UTCTIME 23 +#define WOLFSSL_V_ASN1_GENERALIZEDTIME 24 +#define WOLFSSL_V_ASN1_UNIVERSALSTRING 28 +#define WOLFSSL_V_ASN1_BMPSTRING 30 + + +#define WOLFSSL_V_ASN1_CONSTRUCTED 0x20 + +#define WOLFSSL_ASN1_STRING_FLAG_BITS_LEFT 0x008 +#define WOLFSSL_ASN1_STRING_FLAG_NDEF 0x010 +#define WOLFSSL_ASN1_STRING_FLAG_CONT 0x020 +#define WOLFSSL_ASN1_STRING_FLAG_MSTRING 0x040 +#define WOLFSSL_ASN1_STRING_FLAG_EMBED 0x080 + +/* X.509 PKI size limits from RFC2459 (appendix A) */ +/* internally our limit is CTC_NAME_SIZE (64) - overridden with WC_CTC_NAME_SIZE */ +#define WOLFSSL_ub_name CTC_NAME_SIZE /* 32768 */ +#define WOLFSSL_ub_common_name CTC_NAME_SIZE /* 64 */ +#define WOLFSSL_ub_locality_name CTC_NAME_SIZE /* 128 */ +#define WOLFSSL_ub_state_name CTC_NAME_SIZE /* 128 */ +#define WOLFSSL_ub_organization_name CTC_NAME_SIZE /* 64 */ +#define WOLFSSL_ub_organization_unit_name CTC_NAME_SIZE /* 64 */ +#define WOLFSSL_ub_title CTC_NAME_SIZE /* 64 */ +#define WOLFSSL_ub_email_address CTC_NAME_SIZE /* 128 */ + +#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL) || defined(HAVE_CURL) + +struct WOLFSSL_OBJ_NAME { + int type; + int alias; + const char *name; + const char *data; +}; + +struct WOLFSSL_AUTHORITY_KEYID { + WOLFSSL_ASN1_STRING *keyid; + WOLFSSL_ASN1_OBJECT *issuer; + WOLFSSL_ASN1_INTEGER *serial; +}; + +struct WOLFSSL_BASIC_CONSTRAINTS { + int ca; + WOLFSSL_ASN1_INTEGER *pathlen; +}; + +#endif /* OPENSSL_EXTRA*/ + +#define WOLFSSL_ASN1_UTCTIME WOLFSSL_ASN1_TIME +#define WOLFSSL_ASN1_GENERALIZEDTIME WOLFSSL_ASN1_TIME + +struct WOLFSSL_ASN1_STRING { + char strData[CTC_NAME_SIZE]; + int length; + int type; /* type of string i.e. CTC_UTF8 */ + int nid; + char* data; + long flags; + unsigned int isDynamic:1; /* flag for if data pointer dynamic (1 is yes 0 is no) */ +}; + +#define WOLFSSL_MAX_SNAME 40 + + +#define WOLFSSL_ASN1_DYNAMIC 0x1 +#define WOLFSSL_ASN1_DYNAMIC_DATA 0x2 + +struct WOLFSSL_ASN1_OTHERNAME { + WOLFSSL_ASN1_OBJECT* type_id; + WOLFSSL_ASN1_TYPE* value; +}; + +struct WOLFSSL_GENERAL_NAME { + int type; + union { + char* ptr; + WOLFSSL_ASN1_OTHERNAME* otherName; + WOLFSSL_ASN1_STRING* rfc822Name; + WOLFSSL_ASN1_STRING* dNSName; + WOLFSSL_ASN1_TYPE* x400Address; + WOLFSSL_X509_NAME* directoryName; + WOLFSSL_ASN1_STRING* uniformResourceIdentifier; + WOLFSSL_ASN1_STRING* iPAddress; + WOLFSSL_ASN1_OBJECT* registeredID; + + WOLFSSL_ASN1_STRING* ip; + WOLFSSL_X509_NAME* dirn; + WOLFSSL_ASN1_STRING* ia5; + WOLFSSL_ASN1_OBJECT* rid; + WOLFSSL_ASN1_TYPE* other; + } d; /* dereference */ +}; + +struct WOLFSSL_DIST_POINT_NAME { + int type; + + /* name 'name.fullname' needs to remain the same, in some ports the elements + * of the structure are accessed directly */ + union { + WOLF_STACK_OF(WOLFSSL_GENERAL_NAME)* fullname; + } name; +}; + +struct WOLFSSL_DIST_POINT { + /* name 'distpoint' needs to remain the same, in some ports the elements of + * the structure are accessed directly */ + WOLFSSL_DIST_POINT_NAME* distpoint; +}; + +struct WOLFSSL_ACCESS_DESCRIPTION { + WOLFSSL_ASN1_OBJECT* method; + WOLFSSL_GENERAL_NAME* location; +}; + +struct WOLFSSL_X509V3_CTX { + WOLFSSL_X509* x509; +}; + +struct WOLFSSL_ASN1_OBJECT { + void* heap; + const unsigned char* obj; + /* sName is short name i.e sha256 rather than oid (null terminated) */ + char sName[WOLFSSL_MAX_SNAME]; + int type; /* oid */ + int grp; /* type of OID, i.e. oidCertPolicyType */ + int nid; + unsigned int objSz; +#if defined(OPENSSL_EXTRA) + int ca; + WOLFSSL_ASN1_INTEGER *pathlen; +#endif + unsigned char dynamic; /* Use WOLFSSL_ASN1_DYNAMIC and WOLFSSL_ASN1_DYNAMIC_DATA + * to determine what needs to be freed. */ + +#if defined(WOLFSSL_APACHE_HTTPD) + WOLFSSL_GENERAL_NAME* gn; +#endif + + struct d { /* dereferenced */ + WOLFSSL_ASN1_STRING* dNSName; + WOLFSSL_ASN1_STRING ia5_internal; + WOLFSSL_ASN1_STRING* ia5; /* points to ia5_internal */ +#if defined(OPENSSL_ALL) + WOLFSSL_ASN1_STRING* uniformResourceIdentifier; + WOLFSSL_ASN1_STRING iPAddress_internal; + WOLFSSL_ASN1_OTHERNAME* otherName; /* added for Apache httpd */ +#endif + WOLFSSL_ASN1_STRING* iPAddress; /* points to iPAddress_internal */ + } d; +}; + +/* wrap ASN1 types */ +struct WOLFSSL_ASN1_TYPE { + int type; + union { + char *ptr; + WOLFSSL_ASN1_STRING* asn1_string; + WOLFSSL_ASN1_OBJECT* object; + WOLFSSL_ASN1_INTEGER* integer; + WOLFSSL_ASN1_BIT_STRING* bit_string; + WOLFSSL_ASN1_STRING* octet_string; + WOLFSSL_ASN1_STRING* printablestring; + WOLFSSL_ASN1_STRING* ia5string; + WOLFSSL_ASN1_UTCTIME* utctime; + WOLFSSL_ASN1_GENERALIZEDTIME* generalizedtime; + WOLFSSL_ASN1_STRING* utf8string; + WOLFSSL_ASN1_STRING* set; + WOLFSSL_ASN1_STRING* sequence; + } value; +}; + +struct WOLFSSL_X509_ATTRIBUTE { + WOLFSSL_ASN1_OBJECT *object; + WOLFSSL_ASN1_TYPE *value; + WOLF_STACK_OF(WOLFSSL_ASN1_TYPE) *set; +}; + +struct WOLFSSL_EVP_PKEY { + void* heap; + int type; /* openssh dereference */ + int save_type; /* openssh dereference */ + int pkey_sz; + wolfSSL_Ref ref; + + union { + char* ptr; /* der format of key */ + } pkey; +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + #ifndef NO_RSA + WOLFSSL_RSA* rsa; + #endif + #ifndef NO_DSA + WOLFSSL_DSA* dsa; + #endif + #ifdef HAVE_ECC + WOLFSSL_EC_KEY* ecc; + #endif + #ifndef NO_DH + WOLFSSL_DH* dh; + #endif + WC_RNG rng; + #ifdef HAVE_HKDF + const WOLFSSL_EVP_MD* hkdfMd; + byte* hkdfSalt; + word32 hkdfSaltSz; + byte* hkdfKey; + word32 hkdfKeySz; + byte* hkdfInfo; + word32 hkdfInfoSz; + int hkdfMode; + #endif + #if defined(WOLFSSL_CMAC) && !defined(NO_AES) && defined(WOLFSSL_AES_DIRECT) + WOLFSSL_CMAC_CTX* cmacCtx; + #endif +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ +#ifdef HAVE_ECC + int pkey_curve; +#endif + word16 pkcs8HeaderSz; + + /* option bits */ + WC_BITFIELD ownDh:1; /* if struct owns DH and should free it */ + WC_BITFIELD ownEcc:1; /* if struct owns ECC and should free it */ + WC_BITFIELD ownDsa:1; /* if struct owns DSA and should free it */ + WC_BITFIELD ownRsa:1; /* if struct owns RSA and should free it */ +}; + + +#define WOLFSSL_ALWAYS_CHECK_SUBJECT 0x1 +#define WOLFSSL_NO_WILDCARDS 0x2 +#define WOLFSSL_NO_PARTIAL_WILDCARDS 0x4 +#define WOLFSSL_MULTI_LABEL_WILDCARDS 0x8 +/* Custom to wolfSSL, OpenSSL compat goes up to 0x20 */ +#define WOLFSSL_LEFT_MOST_WILDCARD_ONLY 0x40 + + +typedef struct WOLFSSL_BUFFER_INFO { + unsigned char* buffer; + word32 length; +} WOLFSSL_BUFFER_INFO; + +typedef struct WOLFSSL_BUF_MEM { + char* data; /* dereferenced */ + size_t length; /* current length */ + size_t max; /* maximum length */ +} WOLFSSL_BUF_MEM; + + +typedef int (*VerifyCallback)(int, WOLFSSL_X509_STORE_CTX*); +typedef int (*WOLFSSL_X509_STORE_CTX_verify_cb)(int, WOLFSSL_X509_STORE_CTX *); + +struct WOLFSSL_X509_STORE_CTX { +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + WOLFSSL_X509_STORE* store; /* Store full of a CA cert chain */ + WOLFSSL_X509* current_cert; /* current X509 (OPENSSL_EXTRA) */ + #if defined(WOLFSSL_ASIO) || defined(OPENSSL_EXTRA) + WOLFSSL_X509* current_issuer; /* asio dereference */ + #endif +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + WOLFSSL_X509_CHAIN* sesChain; /* pointer to WOLFSSL_SESSION peer chain */ +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + WOLFSSL_STACK* chain; + #ifdef OPENSSL_EXTRA + WOLFSSL_X509_VERIFY_PARAM* param; /* certificate validation parameter */ + #endif +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + + char* domain; /* subject CN domain name */ +#ifdef HAVE_EX_DATA + WOLFSSL_CRYPTO_EX_DATA ex_data; /* external data */ +#endif +#if defined(WOLFSSL_APACHE_HTTPD) || defined(OPENSSL_EXTRA) + int depth; /* used in X509_STORE_CTX_*_depth */ +#endif + void* userCtx; /* user ctx */ + int error; /* current error */ + int error_depth; /* index of cert depth for this error */ + int discardSessionCerts; /* so verify callback can flag for discard */ + int totalCerts; /* number of peer cert buffers */ + WOLFSSL_BUFFER_INFO* certs; /* peer certs */ + WOLFSSL_X509_STORE_CTX_verify_cb verify_cb; /* verify callback */ + void* heap; + int flags; + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + WOLF_STACK_OF(WOLFSSL_X509)* owned; /* Certs owned by this CTX */ + WOLF_STACK_OF(WOLFSSL_X509)* ctxIntermediates; /* Intermediates specified + * on store ctx init */ + WOLF_STACK_OF(WOLFSSL_X509)* setTrustedSk;/* A trusted stack override + * set with + * X509_STORE_CTX_trusted_stack */ +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ +}; + + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + +struct WOLFSSL_X509_PKEY { + WOLFSSL_EVP_PKEY* dec_pkey; /* dereferenced by Apache */ + void* heap; +}; +typedef struct WOLFSSL_X509_PKEY WOLFSSL_X509_PKEY; + +struct WOLFSSL_X509_INFO { + WOLFSSL_X509 *x509; + WOLFSSL_X509_CRL *crl; + WOLFSSL_X509_PKEY *x_pkey; /* dereferenced by Apache */ + EncryptedInfo enc_cipher; + int enc_len; + char *enc_data; + int num; +}; + +#define WOLFSSL_EVP_PKEY_DEFAULT WC_EVP_PKEY_RSA /* default key type */ + +#if defined(OPENSSL_ALL) || defined(WOLFSSL_QT) + #define wolfSSL_SSL_MODE_RELEASE_BUFFERS 0x00000010U + #define wolfSSL_SSL_CTRL_SET_TMP_ECDH 4 +#endif + +struct WOLFSSL_X509_ALGOR { + WOLFSSL_ASN1_OBJECT* algorithm; + WOLFSSL_ASN1_TYPE* parameter; +}; + +struct WOLFSSL_X509_PUBKEY { + WOLFSSL_X509_ALGOR* algor; + WOLFSSL_EVP_PKEY* pkey; + int pubKeyOID; +}; + +enum BIO_TYPE { + WOLFSSL_BIO_UNDEF = 0, + WOLFSSL_BIO_BUFFER = 1, + WOLFSSL_BIO_SOCKET = 2, + WOLFSSL_BIO_SSL = 3, + WOLFSSL_BIO_MEMORY = 4, + WOLFSSL_BIO_BIO = 5, + WOLFSSL_BIO_FILE = 6, + WOLFSSL_BIO_BASE64 = 7, + WOLFSSL_BIO_MD = 8, + WOLFSSL_BIO_DGRAM = 9, + WOLFSSL_BIO_NULL = 10 +}; + +enum BIO_FLAGS { + WOLFSSL_BIO_FLAG_BASE64_NO_NL = 0x01, + WOLFSSL_BIO_FLAG_READ = 0x02, + WOLFSSL_BIO_FLAG_WRITE = 0x04, + WOLFSSL_BIO_FLAG_IO_SPECIAL = 0x08, + WOLFSSL_BIO_FLAG_RETRY = 0x10, + WOLFSSL_BIO_FLAG_MEM_RDONLY = 0x200 +}; + +enum BIO_CB_OPS { + WOLFSSL_BIO_CB_FREE = 0x01, + WOLFSSL_BIO_CB_READ = 0x02, + WOLFSSL_BIO_CB_WRITE = 0x03, + WOLFSSL_BIO_CB_PUTS = 0x04, + WOLFSSL_BIO_CB_GETS = 0x05, + WOLFSSL_BIO_CB_CTRL = 0x06, + WOLFSSL_BIO_CB_RETURN = 0x80 +}; + +/* custom method with user set callbacks */ +typedef int (*wolfSSL_BIO_meth_write_cb)(WOLFSSL_BIO*, const char*, int); +typedef int (*wolfSSL_BIO_meth_read_cb)(WOLFSSL_BIO *, char *, int); +typedef int (*wolfSSL_BIO_meth_puts_cb)(WOLFSSL_BIO*, const char*); +typedef int (*wolfSSL_BIO_meth_gets_cb)(WOLFSSL_BIO*, char*, int); +typedef long (*wolfSSL_BIO_meth_ctrl_get_cb)(WOLFSSL_BIO*, int, long, void*); +typedef int (*wolfSSL_BIO_meth_create_cb)(WOLFSSL_BIO*); +typedef int (*wolfSSL_BIO_meth_destroy_cb)(WOLFSSL_BIO*); + +typedef int wolfSSL_BIO_info_cb(WOLFSSL_BIO *, int, int); +typedef long (*wolfssl_BIO_meth_ctrl_info_cb)(WOLFSSL_BIO*, int, wolfSSL_BIO_info_cb*); + +/* wolfSSL BIO_METHOD type */ +#ifndef MAX_BIO_METHOD_NAME +#define MAX_BIO_METHOD_NAME 256 +#endif +struct WOLFSSL_BIO_METHOD { + byte type; /* method type */ + char name[MAX_BIO_METHOD_NAME]; + wolfSSL_BIO_meth_write_cb writeCb; + wolfSSL_BIO_meth_read_cb readCb; + wolfSSL_BIO_meth_puts_cb putsCb; + wolfSSL_BIO_meth_gets_cb getsCb; + wolfSSL_BIO_meth_ctrl_get_cb ctrlCb; + wolfSSL_BIO_meth_create_cb createCb; + wolfSSL_BIO_meth_destroy_cb freeCb; + wolfssl_BIO_meth_ctrl_info_cb ctrlInfoCb; +}; + +#define WOLFSSL_BIO_METHOD_INIT(bio_type) \ + { bio_type, { 0 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } + +/* wolfSSL BIO type */ +typedef long (*wolf_bio_info_cb)(WOLFSSL_BIO *bio, int event, const char *parg, + int iarg, long larg, long return_value); + +typedef struct WOLFSSL_COMP_METHOD { + int type; /* stunnel dereference */ +} WOLFSSL_COMP_METHOD; + +typedef struct WOLFSSL_COMP { + int id; + const char *name; + WOLFSSL_COMP_METHOD *method; +} WOLFSSL_COMP; + +#define WOLFSSL_X509_L_FILE_LOAD 0x1 +#define WOLFSSL_X509_L_ADD_DIR 0x2 +#define WOLFSSL_X509_L_ADD_STORE 0x3 +#define WOLFSSL_X509_L_LOAD_STORE 0x4 + +struct WOLFSSL_X509_LOOKUP_METHOD { + int type; +}; + +struct WOLFSSL_X509_LOOKUP { + WOLFSSL_X509_STORE *store; + int type; + WOLFSSL_BY_DIR* dirs; +}; + +struct WOLFSSL_X509_STORE { + int cache; /* stunnel dereference */ + WOLFSSL_CERT_MANAGER* cm; + WOLFSSL_X509_LOOKUP lookup; +#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) || \ + defined(WOLFSSL_WPAS_SMALL) + int isDynamic; + WOLFSSL_X509_VERIFY_PARAM* param; /* certificate validation parameter */ +#endif +#ifdef OPENSSL_ALL + WOLF_STACK_OF(WOLFSSL_X509_OBJECT)* objs; /* object stack cache */ +#endif +#if defined(OPENSSL_ALL) || defined(WOLFSSL_QT) + WOLFSSL_X509_STORE_CTX_verify_cb verify_cb; + WOLFSSL_X509_STORE_CTX_get_crl_cb get_crl_cb; +#endif +#ifdef HAVE_EX_DATA + WOLFSSL_CRYPTO_EX_DATA ex_data; +#endif +#if (defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) || \ + defined(WOLFSSL_WPAS_SMALL)) && defined(HAVE_CRL) + WOLFSSL_X509_CRL *crl; /* points to cm->crl */ +#endif + wolfSSL_Ref ref; + WOLF_STACK_OF(WOLFSSL_X509)* certs; + WOLF_STACK_OF(WOLFSSL_X509)* trusted; + WOLF_STACK_OF(WOLFSSL_X509)* owned; + word32 numAdded; /* Number of objs in objs that are in certs sk */ +}; + +#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL) +#define WOLFSSL_USE_CHECK_TIME 0x2 +#define WOLFSSL_NO_CHECK_TIME 0x200000 +#define WOLFSSL_PARTIAL_CHAIN 0x80000 +#define WOLFSSL_HOST_NAME_MAX 256 + +#define WOLFSSL_VPARAM_DEFAULT 0x1 +#define WOLFSSL_VPARAM_OVERWRITE 0x2 +#define WOLFSSL_VPARAM_RESET_FLAGS 0x4 +#define WOLFSSL_VPARAM_LOCKED 0x8 +#define WOLFSSL_VPARAM_ONCE 0x10 + +#ifndef WOLFSSL_MAX_IPSTR + #define WOLFSSL_MAX_IPSTR 46 /* max ip size IPv4 mapped IPv6 */ +#endif + +struct WOLFSSL_X509_VERIFY_PARAM { + const char *name; + time_t check_time; + unsigned int inherit_flags; + unsigned long flags; + char hostName[WOLFSSL_HOST_NAME_MAX]; + unsigned int hostFlags; + char ipasc[WOLFSSL_MAX_IPSTR]; +}; +#endif /* OPENSSL_EXTRA || WOLFSSL_WPAS_SMALL */ + +typedef struct WOLFSSL_X509_REVOKED { + WOLFSSL_ASN1_INTEGER* serialNumber; /* stunnel dereference */ +} WOLFSSL_X509_REVOKED; + +typedef enum { + WOLFSSL_X509_LU_NONE = 0, + WOLFSSL_X509_LU_X509, + WOLFSSL_X509_LU_CRL +} WOLFSSL_X509_LOOKUP_TYPE; + +typedef struct WOLFSSL_X509_OBJECT { + WOLFSSL_X509_LOOKUP_TYPE type; + union { + char* ptr; + WOLFSSL_X509 *x509; + WOLFSSL_X509_CRL* crl; /* stunnel dereference */ + } data; +} WOLFSSL_X509_OBJECT; + +#define WOLFSSL_ASN1_BOOLEAN int + +typedef char* WOLFSSL_STRING; + +typedef struct WOLFSSL_RAND_METHOD { + /* seed = Data to mix into the random generator. + * len = Number of bytes to mix from seed. */ + int (*seed)(const void* seed, int len); + /* buf = Buffer to store random bytes in. + * len = Number of bytes to store in buf. */ + int (*bytes)(unsigned char* buf, int len); + void (*cleanup)(void); + /* add = Data to mix into the random generator. + * len = Number of bytes to mix from add. + * entropy = Estimate of randomness contained in seed. + * Should be between 0 and len. */ + int (*add)(const void* add, int len, double entropy); + /* buf = Buffer to store pseudorandom bytes in. + * len = Number of bytes to store in buf. */ + int (*pseudorand)(unsigned char *buf, int len); + int (*status)(void); +} WOLFSSL_RAND_METHOD; + +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + + +typedef struct WOLFSSL_ALERT { + int code; + int level; +} WOLFSSL_ALERT; + +typedef struct WOLFSSL_ALERT_HISTORY { + WOLFSSL_ALERT last_rx; + WOLFSSL_ALERT last_tx; +} WOLFSSL_ALERT_HISTORY; + + +/* Valid Alert types from page 16/17 + * Add alert string to the function AlertTypeToString in src/ssl.c + */ +enum AlertDescription { + invalid_alert = -1, + close_notify = 0, + unexpected_message = 10, + bad_record_mac = 20, + record_overflow = 22, + decompression_failure = 30, + handshake_failure = 40, + no_certificate = 41, + bad_certificate = 42, + unsupported_certificate = 43, + certificate_revoked = 44, + certificate_expired = 45, + certificate_unknown = 46, + illegal_parameter = 47, + unknown_ca = 48, + access_denied = 49, + decode_error = 50, + decrypt_error = 51, + #ifdef WOLFSSL_MYSQL_COMPATIBLE + /* catch name conflict for enum protocol with MYSQL build */ + wc_protocol_version = 70, + #else + protocol_version = 70, + #endif + insufficient_security = 71, + internal_error = 80, + inappropriate_fallback = 86, + user_canceled = 90, + no_renegotiation = 100, + missing_extension = 109, + unsupported_extension = 110, /**< RFC 5246, section 7.2.2 */ + unrecognized_name = 112, /**< RFC 6066, section 3 */ + bad_certificate_status_response = 113, /**< RFC 6066, section 8 */ + unknown_psk_identity = 115, /**< RFC 4279, section 2 */ + certificate_required = 116, /**< RFC 8446, section 8.2 */ + no_application_protocol = 120 +}; + +#ifdef WOLFSSL_MYSQL_COMPATIBLE +#define wolfssl_alert_protocol_version wc_protocol_version +#else +#define wolfssl_alert_protocol_version protocol_version +#endif + +enum AlertLevel { + alert_none = 0, /* Used to indicate no alert level is set */ + alert_warning = 1, + alert_fatal = 2 +}; + +enum SNICbReturn { + warning_return = alert_warning, + fatal_return = alert_fatal, + noack_return +}; + +/* WS_RETURN_CODE macro + * Some OpenSSL APIs specify "0" as the return value when an error occurs. + * However, some corresponding wolfSSL APIs return negative values. Such + * functions should use this macro to fill this gap. Users who want them + * to return the same return value as OpenSSL can define + * WOLFSSL_ERR_CODE_OPENSSL. + * Give rc a variable that contains the potentially negative + * wolfSSL-defined return value or the return value itself, and + * give fail_rc the openSSL-defined return value. + * Note that this macro replaces only negative return values with the + * specified value. + * Since wolfSSL 4.7.0, the following functions use this macro: + * - wolfSSL_CTX_load_verify_locations + * - wolfSSL_X509_LOOKUP_load_file + * - wolfSSL_EVP_PKEY_cmp + */ +#if defined(WOLFSSL_ERROR_CODE_OPENSSL) + #define WS_RETURN_CODE(rc, fail_rc) \ + (((rc) < 0) ? (int)(fail_rc) : (int)(rc)) +#else + #define WS_RETURN_CODE(rc, fail_rc) (rc) +#endif +#define WS_RC(rc) \ + (((rc) == 1) ? 1 : 0) +#define WC_TO_WS_RC(ret) \ + (((ret) == 0) ? 1 : (ret)) + +/* Maximum master key length (SECRET_LEN) */ +#define WOLFSSL_MAX_MASTER_KEY_LENGTH 48 +/* Maximum number of groups that can be set */ +#ifdef HAVE_PQC +#define WOLFSSL_MAX_GROUP_COUNT 36 +#else +#define WOLFSSL_MAX_GROUP_COUNT 10 +#endif + +#if defined(HAVE_SECRET_CALLBACK) && defined(WOLFSSL_TLS13) +enum Tls13Secret { + CLIENT_EARLY_TRAFFIC_SECRET, + CLIENT_HANDSHAKE_TRAFFIC_SECRET, + SERVER_HANDSHAKE_TRAFFIC_SECRET, + CLIENT_TRAFFIC_SECRET, + SERVER_TRAFFIC_SECRET, + EARLY_EXPORTER_SECRET, + EXPORTER_SECRET +}; +#endif + +#ifndef WOLFSSL_MODE_AUTO_RETRY_ATTEMPTS +#define WOLFSSL_MODE_AUTO_RETRY_ATTEMPTS 10 +#endif + +typedef WOLFSSL_METHOD* (*wolfSSL_method_func)(void* heap); + +/* CTX Method Constructor Functions */ + +#ifndef NO_WOLFSSL_CLIENT + WOLFSSL_API WOLFSSL_METHOD *wolfTLS_client_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfTLS_client_method(void); +#endif +#ifndef NO_WOLFSSL_SERVER + WOLFSSL_API WOLFSSL_METHOD *wolfTLS_server_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfTLS_server_method(void); +#endif +WOLFSSL_API WOLFSSL_METHOD *wolfSSLv23_method_ex(void* heap); +WOLFSSL_API WOLFSSL_METHOD *wolfSSLv23_method(void); +#ifndef NO_WOLFSSL_CLIENT + WOLFSSL_API WOLFSSL_METHOD *wolfSSLv23_client_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD* wolfSSLv23_client_method(void); +#endif +#ifndef NO_WOLFSSL_SERVER + WOLFSSL_API WOLFSSL_METHOD *wolfSSLv23_server_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfSSLv23_server_method(void); +#endif + +#ifndef NO_OLD_TLS + +#ifdef OPENSSL_EXTRA +#ifndef NO_WOLFSSL_CLIENT + WOLFSSL_API WOLFSSL_METHOD* wolfSSLv2_client_method(void); +#endif +#ifndef NO_WOLFSSL_SERVER + WOLFSSL_API WOLFSSL_METHOD* wolfSSLv2_server_method(void); +#endif +#endif /* OPENSSL_EXTRA */ + +#ifdef WOLFSSL_ALLOW_SSLV3 + WOLFSSL_API WOLFSSL_METHOD *wolfSSLv3_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfSSLv3_method(void); +#ifndef NO_WOLFSSL_CLIENT + WOLFSSL_API WOLFSSL_METHOD *wolfSSLv3_client_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfSSLv3_client_method(void); +#endif +#ifndef NO_WOLFSSL_SERVER + WOLFSSL_API WOLFSSL_METHOD *wolfSSLv3_server_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfSSLv3_server_method(void); +#endif +#endif /* WOLFSSL_ALLOW_SSLV3 */ + +#ifdef WOLFSSL_ALLOW_TLSV10 + WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_method(void); +#ifndef NO_WOLFSSL_CLIENT + WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_client_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_client_method(void); +#endif +#ifndef NO_WOLFSSL_SERVER + WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_server_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_server_method(void); +#endif +#endif /* WOLFSSL_ALLOW_TLSV10 */ + + WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_1_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_1_method(void); +#ifndef NO_WOLFSSL_CLIENT + WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_1_client_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_1_client_method(void); +#endif +#ifndef NO_WOLFSSL_SERVER + WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_1_server_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_1_server_method(void); +#endif + +#endif /* NO_OLD_TLS */ + +#ifndef WOLFSSL_NO_TLS12 + WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_2_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_2_method(void); +#ifndef NO_WOLFSSL_CLIENT + WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_2_client_method_ex(void* heap); + WOLFSSL_ABI WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_2_client_method(void); +#endif +#ifndef NO_WOLFSSL_SERVER + WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_2_server_method_ex(void* heap); + WOLFSSL_ABI WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_2_server_method(void); +#endif +#endif /* !WOLFSSL_NO_TLS12 */ + +#ifdef WOLFSSL_TLS13 + WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_3_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_3_method(void); +#ifndef NO_WOLFSSL_CLIENT + WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_3_client_method_ex(void* heap); + WOLFSSL_ABI WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_3_client_method(void); +#endif +#ifndef NO_WOLFSSL_SERVER + WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_3_server_method_ex(void* heap); + WOLFSSL_ABI WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_3_server_method(void); +#endif +#endif /* WOLFSSL_TLS13 */ + +#ifdef WOLFSSL_DTLS + + WOLFSSL_API WOLFSSL_METHOD *wolfDTLS_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfDTLS_method(void); +#ifndef NO_WOLFSSL_CLIENT + WOLFSSL_API WOLFSSL_METHOD *wolfDTLS_client_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfDTLS_client_method(void); +#endif +#ifndef NO_WOLFSSL_SERVER + WOLFSSL_API WOLFSSL_METHOD *wolfDTLS_server_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfDTLS_server_method(void); +#endif + +#ifndef NO_OLD_TLS + WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_method(void); +#ifndef NO_WOLFSSL_CLIENT + WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_client_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_client_method(void); +#endif +#ifndef NO_WOLFSSL_SERVER + WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_server_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_server_method(void); +#endif +#endif /* !NO_OLD_TLS */ + +#ifndef WOLFSSL_NO_TLS12 + WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_2_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_2_method(void); +#ifndef NO_WOLFSSL_CLIENT + WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_2_client_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_2_client_method(void); +#endif +#ifndef NO_WOLFSSL_SERVER + WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_2_server_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_2_server_method(void); +#endif +#endif /* !WOLFSSL_NO_TLS12 */ + +#ifdef WOLFSSL_DTLS13 +#ifndef NO_WOLFSSL_CLIENT + WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_3_client_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_3_client_method(void); +#endif +#ifndef NO_WOLFSSL_SERVER + WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_3_server_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_3_server_method(void); +#endif +#if defined(WOLFSSL_EITHER_SIDE) || defined(OPENSSL_EXTRA) + WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_3_method_ex(void* heap); + WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_3_method(void); +#endif + WOLFSSL_API int wolfSSL_dtls13_has_pending_msg(WOLFSSL *ssl); +#endif /* WOLFSSL_DTLS13 */ + +#endif /* WOLFSSL_DTLS */ + +#if defined(WOLFSSL_TLS13) && defined(HAVE_ECH) +WOLFSSL_API int wolfSSL_CTX_GenerateEchConfig(WOLFSSL_CTX* ctx, + const char* publicName, word16 kemId, word16 kdfId, word16 aeadId); + +WOLFSSL_API int wolfSSL_CTX_SetEchConfigsBase64(WOLFSSL_CTX* ctx, + const char* echConfigs64, word32 echConfigs64Len); + +WOLFSSL_API int wolfSSL_CTX_SetEchConfigs(WOLFSSL_CTX* ctx, + const byte* echConfigs, word32 echConfigsLen); + +WOLFSSL_API int wolfSSL_CTX_GetEchConfigs(WOLFSSL_CTX* ctx, byte* output, + word32* outputLen); + +WOLFSSL_API void wolfSSL_CTX_SetEchEnable(WOLFSSL_CTX* ctx, byte enable); + +WOLFSSL_API int wolfSSL_SetEchConfigsBase64(WOLFSSL* ssl, char* echConfigs64, + word32 echConfigs64Len); + +WOLFSSL_API int wolfSSL_SetEchConfigs(WOLFSSL* ssl, const byte* echConfigs, + word32 echConfigsLen); + +WOLFSSL_API int wolfSSL_GetEchConfigs(WOLFSSL* ssl, byte* echConfigs, + word32* echConfigsLen); + +WOLFSSL_API void wolfSSL_SetEchEnable(WOLFSSL* ssl, byte enable); +#endif /* WOLFSSL_TLS13 && HAVE_ECH */ + +#ifdef HAVE_POLY1305 + WOLFSSL_API int wolfSSL_use_old_poly(WOLFSSL* ssl, int value); +#endif + +#ifdef WOLFSSL_SESSION_EXPORT +WOLFSSL_API int wolfSSL_tls_import(WOLFSSL* ssl, const unsigned char* buf, + unsigned int sz); +WOLFSSL_API int wolfSSL_tls_export(WOLFSSL* ssl, unsigned char* buf, + unsigned int* sz); + +#ifdef WOLFSSL_DTLS + +#ifndef WOLFSSL_DTLS_EXPORT_TYPES +typedef int (*wc_dtls_export)(WOLFSSL* ssl, + unsigned char* exportBuffer, unsigned int sz, void* userCtx); +#define WOLFSSL_DTLS_EXPORT_TYPES +#endif /* WOLFSSL_DTLS_EXPORT_TYPES */ + +WOLFSSL_API int wolfSSL_dtls_import(WOLFSSL* ssl, const unsigned char* buf, + unsigned int sz); +WOLFSSL_API int wolfSSL_CTX_dtls_set_export(WOLFSSL_CTX* ctx, + wc_dtls_export func); +WOLFSSL_API int wolfSSL_dtls_set_export(WOLFSSL* ssl, wc_dtls_export func); +WOLFSSL_API int wolfSSL_dtls_export(WOLFSSL* ssl, unsigned char* buf, + unsigned int* sz); +WOLFSSL_API int wolfSSL_dtls_export_state_only(WOLFSSL* ssl, unsigned char* buf, + unsigned int* sz); +#endif /* WOLFSSL_DTLS */ +#endif /* WOLFSSL_SESSION_EXPORT */ + +#ifdef WOLFSSL_STATIC_MEMORY +#ifndef WOLFSSL_MEM_GUARD +#define WOLFSSL_MEM_GUARD + typedef struct WOLFSSL_MEM_STATS WOLFSSL_MEM_STATS; + typedef struct WOLFSSL_MEM_CONN_STATS WOLFSSL_MEM_CONN_STATS; +#endif +WOLFSSL_API int wolfSSL_CTX_load_static_memory(WOLFSSL_CTX** ctx, + wolfSSL_method_func method, + unsigned char* buf, unsigned int sz, + int flag, int max); +WOLFSSL_API int wolfSSL_CTX_is_static_memory(WOLFSSL_CTX* ctx, + WOLFSSL_MEM_STATS* mem_stats); +WOLFSSL_API int wolfSSL_is_static_memory(WOLFSSL* ssl, + WOLFSSL_MEM_CONN_STATS* mem_stats); +#endif + +#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) + +WOLFSSL_ABI WOLFSSL_API int wolfSSL_CTX_use_certificate_file( + WOLFSSL_CTX* ctx, const char* file, int format); +WOLFSSL_ABI WOLFSSL_API int wolfSSL_CTX_use_PrivateKey_file( + WOLFSSL_CTX* ctx, const char* file, int format); +#ifdef WOLFSSL_DUAL_ALG_CERTS +WOLFSSL_API int wolfSSL_CTX_use_AltPrivateKey_file( + WOLFSSL_CTX* ctx, const char* file, int format); +#endif /* WOLFSSL_DUAL_ALG_CERTS */ +#endif /* !NO_FILESYSTEM && !NO_CERTS */ + +#ifndef NO_CERTS +#define WOLFSSL_LOAD_FLAG_NONE 0x00000000 +#define WOLFSSL_LOAD_FLAG_IGNORE_ERR 0x00000001 +#define WOLFSSL_LOAD_FLAG_DATE_ERR_OKAY 0x00000002 +#define WOLFSSL_LOAD_FLAG_PEM_CA_ONLY 0x00000004 +#if defined(WOLFSSL_QT) || defined(WOLFSSL_IGNORE_BAD_CERT_PATH) +#define WOLFSSL_LOAD_FLAG_IGNORE_BAD_PATH_ERR 0x00000008 +#endif +#if defined(WOLFSSL_QT) +#define WOLFSSL_LOAD_FLAG_IGNORE_ZEROFILE 0x00000010 +#endif + +#ifndef WOLFSSL_LOAD_VERIFY_DEFAULT_FLAGS +#define WOLFSSL_LOAD_VERIFY_DEFAULT_FLAGS WOLFSSL_LOAD_FLAG_NONE +#endif + +WOLFSSL_API long wolfSSL_get_verify_depth(WOLFSSL* ssl); +WOLFSSL_API long wolfSSL_CTX_get_verify_depth(WOLFSSL_CTX* ctx); +WOLFSSL_API void wolfSSL_CTX_set_verify_depth(WOLFSSL_CTX *ctx,int depth); +#endif /* !NO_CERTS */ + +#define WOLFSSL_CIPHER_SUITE_FLAG_NONE 0x0 +#define WOLFSSL_CIPHER_SUITE_FLAG_NAMEALIAS 0x1 + +#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) + +WOLFSSL_API int wolfSSL_CTX_load_verify_locations_ex( + WOLFSSL_CTX* ctx, const char* file, const char* path, word32 flags); +WOLFSSL_ABI WOLFSSL_API int wolfSSL_CTX_load_verify_locations( + WOLFSSL_CTX* ctx, const char* file, const char* path); +WOLFSSL_API int wolfSSL_CTX_load_verify_locations_compat( + WOLFSSL_CTX* ctx, const char* file, const char* path); +#ifndef _WIN32 +WOLFSSL_API const char** wolfSSL_get_system_CA_dirs(word32* num); +#endif /* !_WIN32 */ +WOLFSSL_API int wolfSSL_CTX_load_system_CA_certs(WOLFSSL_CTX* ctx); +#ifdef WOLFSSL_TRUST_PEER_CERT +WOLFSSL_API int wolfSSL_CTX_trust_peer_cert( + WOLFSSL_CTX* ctx, const char* file, int type); +WOLFSSL_API int wolfSSL_trust_peer_cert( + WOLFSSL* ssl, const char* file, int type); +#endif +WOLFSSL_ABI WOLFSSL_API int wolfSSL_CTX_use_certificate_chain_file( + WOLFSSL_CTX* ctx, const char* file); +WOLFSSL_API int wolfSSL_CTX_use_certificate_chain_file_format( + WOLFSSL_CTX* ctx, const char* file, int format); +WOLFSSL_API int wolfSSL_CTX_use_RSAPrivateKey_file( + WOLFSSL_CTX* ctx,const char* file, int format); + +WOLFSSL_ABI WOLFSSL_API int wolfSSL_use_certificate_file( + WOLFSSL* ssl, const char* file, int format); +WOLFSSL_ABI WOLFSSL_API int wolfSSL_use_PrivateKey_file( + WOLFSSL* ssl, const char* file, int format); +WOLFSSL_ABI WOLFSSL_API int wolfSSL_use_certificate_chain_file( + WOLFSSL* ssl, const char* file); +WOLFSSL_API int wolfSSL_use_certificate_chain_file_format( + WOLFSSL* ssl, const char* file, int format); +WOLFSSL_API int wolfSSL_use_RSAPrivateKey_file( + WOLFSSL* ssl, const char* file, int format); + +#ifdef WOLFSSL_DER_LOAD + WOLFSSL_API int wolfSSL_CTX_der_load_verify_locations( + WOLFSSL_CTX* ctx, const char* file, int format); +#endif +#endif /* !NO_FILESYSTEM && !NO_CERTS */ + +WOLFSSL_API WOLFSSL_CTX* wolfSSL_CTX_new_ex(WOLFSSL_METHOD* method, void* heap); +WOLFSSL_ABI WOLFSSL_API WOLFSSL_CTX* wolfSSL_CTX_new(WOLFSSL_METHOD* method); +WOLFSSL_API int wolfSSL_CTX_up_ref(WOLFSSL_CTX* ctx); +#ifdef OPENSSL_EXTRA +WOLFSSL_API int wolfSSL_set_ecdh_auto(WOLFSSL* ssl, int onoff); +WOLFSSL_API int wolfSSL_CTX_set_ecdh_auto(WOLFSSL_CTX* ctx, int onoff); +WOLFSSL_API int wolfSSL_CTX_set_dh_auto(WOLFSSL_CTX* ctx, int onoff); +WOLFSSL_API int wolfSSL_get_signature_nid(WOLFSSL* ssl, int* nid); +WOLFSSL_API int wolfSSL_get_signature_type_nid(const WOLFSSL* ssl, int* nid); +WOLFSSL_API int wolfSSL_get_peer_signature_nid(WOLFSSL* ssl, int* nid); +WOLFSSL_API int wolfSSL_get_peer_signature_type_nid(const WOLFSSL* ssl, + int* nid); +WOLFSSL_API int wolfSSL_CTX_set1_sigalgs_list(WOLFSSL_CTX* ctx, + const char* list); +WOLFSSL_API int wolfSSL_set1_sigalgs_list(WOLFSSL* ssl, const char* list); +#endif +WOLFSSL_ABI WOLFSSL_API WOLFSSL* wolfSSL_new(WOLFSSL_CTX* ctx); +WOLFSSL_API WOLFSSL_CTX* wolfSSL_get_SSL_CTX(const WOLFSSL* ssl); +WOLFSSL_API WOLFSSL_X509_VERIFY_PARAM* wolfSSL_CTX_get0_param(WOLFSSL_CTX* ctx); +WOLFSSL_API WOLFSSL_X509_VERIFY_PARAM* wolfSSL_get0_param(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_CTX_set1_param(WOLFSSL_CTX* ctx, WOLFSSL_X509_VERIFY_PARAM *vpm); +WOLFSSL_API int wolfSSL_is_server(WOLFSSL* ssl); +WOLFSSL_API WOLFSSL* wolfSSL_write_dup(WOLFSSL* ssl); +WOLFSSL_ABI WOLFSSL_API int wolfSSL_set_fd(WOLFSSL* ssl, int fd); +#ifdef WOLFSSL_DTLS +WOLFSSL_API int wolfSSL_set_dtls_fd_connected(WOLFSSL* ssl, int fd); +#endif +WOLFSSL_API int wolfSSL_set_write_fd (WOLFSSL* ssl, int fd); +WOLFSSL_API int wolfSSL_set_read_fd (WOLFSSL* ssl, int fd); +WOLFSSL_API char* wolfSSL_get_cipher_list(int priority); +WOLFSSL_API char* wolfSSL_get_cipher_list_ex(WOLFSSL* ssl, int priority); +WOLFSSL_API int wolfSSL_get_ciphers(char* buf, int len); +WOLFSSL_API int wolfSSL_get_ciphers_iana(char* buf, int len); +WOLFSSL_API const char* wolfSSL_get_cipher_name(WOLFSSL* ssl); +WOLFSSL_API const char* wolfSSL_get_cipher_name_from_suite( + unsigned char cipherSuite0, unsigned char cipherSuite); +WOLFSSL_API const char* wolfSSL_get_cipher_name_iana_from_suite( + unsigned char cipherSuite0, unsigned char cipherSuite); +WOLFSSL_API int wolfSSL_get_cipher_suite_from_name(const char* name, + unsigned char* cipherSuite0, unsigned char* cipherSuite, int *flags); +WOLFSSL_API const char* wolfSSL_get_shared_ciphers(WOLFSSL* ssl, char* buf, + int len); +WOLFSSL_API const char* wolfSSL_get_curve_name(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_get_fd(const WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_get_wfd(const WOLFSSL* ssl); +/* please see note at top of README if you get an error from connect */ +WOLFSSL_ABI WOLFSSL_API int wolfSSL_connect(WOLFSSL* ssl); +WOLFSSL_ABI WOLFSSL_API int wolfSSL_write( + WOLFSSL* ssl, const void* data, int sz); +WOLFSSL_API int wolfSSL_write_ex(WOLFSSL* ssl, const void* data, size_t sz, + size_t* wr); +WOLFSSL_ABI WOLFSSL_API int wolfSSL_read(WOLFSSL* ssl, void* data, int sz); +WOLFSSL_API int wolfSSL_read_ex(WOLFSSL* ssl, void* data, size_t sz, size_t* rd); +WOLFSSL_API int wolfSSL_peek(WOLFSSL* ssl, void* data, int sz); +WOLFSSL_ABI WOLFSSL_API int wolfSSL_accept(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_inject(WOLFSSL* ssl, const void* data, int sz); +WOLFSSL_API int wolfSSL_CTX_mutual_auth(WOLFSSL_CTX* ctx, int req); +WOLFSSL_API int wolfSSL_mutual_auth(WOLFSSL* ssl, int req); + +WOLFSSL_API int wolfSSL_CTX_set_groups(WOLFSSL_CTX* ctx, int* groups, + int count); +WOLFSSL_API int wolfSSL_set_groups(WOLFSSL* ssl, int* groups, int count); +#if defined(OPENSSL_EXTRA) && defined(HAVE_SUPPORTED_CURVES) +WOLFSSL_API int wolfSSL_CTX_set1_groups(WOLFSSL_CTX* ctx, int* groups, + int count); +WOLFSSL_API int wolfSSL_set1_groups(WOLFSSL* ssl, int* groups, int count); + +#ifdef HAVE_ECC +WOLFSSL_API int wolfSSL_CTX_set1_groups_list(WOLFSSL_CTX *ctx, const char *list); +WOLFSSL_API int wolfSSL_set1_groups_list(WOLFSSL *ssl, const char *list); +#endif +#endif + +#ifdef WOLFSSL_TLS13 +WOLFSSL_API int wolfSSL_send_hrr_cookie(WOLFSSL* ssl, + const unsigned char* secret, unsigned int secretSz); +WOLFSSL_API int wolfSSL_disable_hrr_cookie(WOLFSSL * ssl); +WOLFSSL_API int wolfSSL_CTX_no_ticket_TLSv13(WOLFSSL_CTX* ctx); +WOLFSSL_API int wolfSSL_no_ticket_TLSv13(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_CTX_no_dhe_psk(WOLFSSL_CTX* ctx); +WOLFSSL_API int wolfSSL_no_dhe_psk(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_CTX_only_dhe_psk(WOLFSSL_CTX* ctx); +WOLFSSL_API int wolfSSL_only_dhe_psk(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_update_keys(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_key_update_response(WOLFSSL* ssl, int* required); +WOLFSSL_API int wolfSSL_CTX_allow_post_handshake_auth(WOLFSSL_CTX* ctx); +WOLFSSL_API int wolfSSL_allow_post_handshake_auth(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_request_certificate(WOLFSSL* ssl); + +WOLFSSL_API int wolfSSL_preferred_group(WOLFSSL* ssl); + +WOLFSSL_API int wolfSSL_connect_TLSv13(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_accept_TLSv13(WOLFSSL* ssl); + +#ifdef WOLFSSL_EARLY_DATA + +#define WOLFSSL_EARLY_DATA_NOT_SENT 0 +#define WOLFSSL_EARLY_DATA_REJECTED 1 +#define WOLFSSL_EARLY_DATA_ACCEPTED 2 + +WOLFSSL_API int wolfSSL_CTX_set_max_early_data(WOLFSSL_CTX* ctx, + unsigned int sz); +WOLFSSL_API int wolfSSL_set_max_early_data(WOLFSSL* ssl, unsigned int sz); +WOLFSSL_API int wolfSSL_CTX_get_max_early_data(WOLFSSL_CTX* ctx); +WOLFSSL_API int wolfSSL_get_max_early_data(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_write_early_data(WOLFSSL* ssl, const void* data, + int sz, int* outSz); +WOLFSSL_API int wolfSSL_read_early_data(WOLFSSL* ssl, void* data, int sz, + int* outSz); +WOLFSSL_API int wolfSSL_get_early_data_status(const WOLFSSL* ssl); +#ifdef OPENSSL_EXTRA +WOLFSSL_API unsigned int wolfSSL_SESSION_get_max_early_data(const WOLFSSL_SESSION *s); +#endif /* OPENSSL_EXTRA */ +#endif /* WOLFSSL_EARLY_DATA */ +#endif /* WOLFSSL_TLS13 */ +WOLFSSL_ABI WOLFSSL_API void wolfSSL_CTX_free(WOLFSSL_CTX* ctx); +WOLFSSL_ABI WOLFSSL_API void wolfSSL_free(WOLFSSL* ssl); +WOLFSSL_ABI WOLFSSL_API int wolfSSL_shutdown(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_SendUserCanceled(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_send(WOLFSSL* ssl, const void* data, int sz, int flags); +WOLFSSL_API int wolfSSL_recv(WOLFSSL* ssl, void* data, int sz, int flags); + +WOLFSSL_API void wolfSSL_CTX_set_quiet_shutdown(WOLFSSL_CTX* ctx, int mode); +WOLFSSL_API void wolfSSL_set_quiet_shutdown(WOLFSSL* ssl, int mode); + +WOLFSSL_ABI WOLFSSL_API int wolfSSL_get_error(WOLFSSL* ssl, int ret); + +WOLFSSL_ABI WOLFSSL_API int wolfSSL_set_session(WOLFSSL* ssl, WOLFSSL_SESSION* session); +WOLFSSL_API long wolfSSL_SSL_SESSION_set_timeout(WOLFSSL_SESSION* ses, long t); +WOLFSSL_API long wolfSSL_SESSION_set_time(WOLFSSL_SESSION *ses, long t); +WOLFSSL_ABI WOLFSSL_API WOLFSSL_SESSION* wolfSSL_get_session(WOLFSSL* ssl); +WOLFSSL_ABI WOLFSSL_API void wolfSSL_flush_sessions(WOLFSSL_CTX* ctx, long tm); +WOLFSSL_API void wolfSSL_CTX_flush_sessions(WOLFSSL_CTX* ctx, long tm); +WOLFSSL_API int wolfSSL_SetServerID(WOLFSSL* ssl, const unsigned char* id, int len, int newSession); + +#if defined(OPENSSL_ALL) || defined(WOLFSSL_ASIO) || defined(WOLFSSL_HAPROXY) \ + || defined(WOLFSSL_NGINX) +WOLFSSL_API int wolfSSL_BIO_new_bio_pair(WOLFSSL_BIO** bio1_p, size_t writebuf1, + WOLFSSL_BIO** bio2_p, size_t writebuf2); + +WOLFSSL_API int wolfSSL_RSA_padding_add_PKCS1_PSS_mgf1(WOLFSSL_RSA *rsa, + unsigned char *em, const unsigned char *mHash, + const WOLFSSL_EVP_MD *hashAlg, const WOLFSSL_EVP_MD *mgf1Hash, + int saltLen); +WOLFSSL_API int wolfSSL_RSA_padding_add_PKCS1_PSS(WOLFSSL_RSA *rsa, + unsigned char *EM, + const unsigned char *mHash, + const WOLFSSL_EVP_MD *hashAlg, + int saltLen); +WOLFSSL_API int wolfSSL_RSA_verify_PKCS1_PSS_mgf1(WOLFSSL_RSA *rsa, + const unsigned char *mHash, const WOLFSSL_EVP_MD *hashAlg, + const WOLFSSL_EVP_MD *mgf1Hash, const unsigned char *em, int saltLen); +WOLFSSL_API int wolfSSL_RSA_verify_PKCS1_PSS(WOLFSSL_RSA *rsa, const unsigned char *mHash, + const WOLFSSL_EVP_MD *hashAlg, + const unsigned char *EM, int saltLen); +WOLFSSL_API WOLFSSL_RSA* wolfSSL_d2i_RSAPrivateKey_bio(WOLFSSL_BIO* bio, WOLFSSL_RSA** out); +WOLFSSL_API int wolfSSL_CTX_use_certificate_ASN1(WOLFSSL_CTX* ctx, + int derSz, const unsigned char* der); +WOLFSSL_API int wolfSSL_CTX_use_RSAPrivateKey(WOLFSSL_CTX* ctx, WOLFSSL_RSA* rsa); +WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_d2i_PrivateKey_bio(WOLFSSL_BIO* bio, WOLFSSL_EVP_PKEY** pkey); +#endif /* OPENSSL_ALL || WOLFSSL_ASIO */ + +#ifdef SESSION_INDEX +WOLFSSL_API int wolfSSL_GetSessionIndex(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_GetSessionAtIndex(int index, WOLFSSL_SESSION* session); +#endif /* SESSION_INDEX */ + + +#ifdef OPENSSL_EXTRA +/* compatibility callback for TLS state */ +typedef void (CallbackInfoState)(const WOLFSSL* ssl, int state, int err); +#endif + + +/* ----- EX DATA BEGIN ----- */ +WOLFSSL_API void* wolfSSL_get_ex_data(const WOLFSSL* ssl, int idx); +WOLFSSL_API int wolfSSL_set_ex_data(WOLFSSL* ssl, int idx, void* data); + +#ifdef HAVE_EX_DATA +WOLFSSL_API void wolfSSL_CRYPTO_cleanup_all_ex_data(void); +WOLFSSL_API void* wolfSSL_CRYPTO_get_ex_data( + const WOLFSSL_CRYPTO_EX_DATA* ex_data, int idx); +WOLFSSL_API int wolfSSL_CRYPTO_set_ex_data( + WOLFSSL_CRYPTO_EX_DATA* ex_data, int idx, void *data); + +#ifdef HAVE_EX_DATA_CLEANUP_HOOKS +WOLFSSL_API int wolfSSL_CRYPTO_set_ex_data_with_cleanup( + WOLFSSL_CRYPTO_EX_DATA* ex_data, + int idx, + void *data, + wolfSSL_ex_data_cleanup_routine_t cleanup_routine); +WOLFSSL_API int wolfSSL_set_ex_data_with_cleanup( + WOLFSSL* ssl, + int idx, + void* data, + wolfSSL_ex_data_cleanup_routine_t cleanup_routine); +#endif + +#ifdef HAVE_EX_DATA_CRYPTO +/* class index for wolfSSL_CRYPTO_get_ex_new_index */ +#define WOLF_CRYPTO_EX_INDEX_SSL 0 +#define WOLF_CRYPTO_EX_INDEX_SSL_CTX 1 +#define WOLF_CRYPTO_EX_INDEX_SSL_SESSION 2 +#define WOLF_CRYPTO_EX_INDEX_X509 3 +#define WOLF_CRYPTO_EX_INDEX_X509_STORE 4 +#define WOLF_CRYPTO_EX_INDEX_X509_STORE_CTX 5 +#define WOLF_CRYPTO_EX_INDEX_DH 6 +#define WOLF_CRYPTO_EX_INDEX_DSA 7 +#define WOLF_CRYPTO_EX_INDEX_EC_KEY 8 +#define WOLF_CRYPTO_EX_INDEX_RSA 9 +#define WOLF_CRYPTO_EX_INDEX_ENGINE 10 +#define WOLF_CRYPTO_EX_INDEX_UI 11 +#define WOLF_CRYPTO_EX_INDEX_BIO 12 +#define WOLF_CRYPTO_EX_INDEX_APP 13 +#define WOLF_CRYPTO_EX_INDEX_UI_METHOD 14 +#define WOLF_CRYPTO_EX_INDEX_DRBG 15 +#define WOLF_CRYPTO_EX_INDEX__COUNT 16 + +/* Helper macro to log that input arguments should not be used */ +#define WOLFSSL_CRYPTO_EX_DATA_IGNORE_PARAMS(a1, a2, a3, a4, a5) \ + (void)(a1); \ + (void)(a2); \ + (void)(a3); \ + (void)(a4); \ + (void)(a5); \ + do { \ + if ((a3) != NULL || (a4) != NULL || (a5) != NULL) { \ + WOLFSSL_MSG("get_ex_new_index API does not support " \ + "new, dup, or free callbacks"); \ + } \ + } while(0) + +WOLFSSL_API int wolfSSL_get_ex_new_index( + long argValue, void* arg, + WOLFSSL_CRYPTO_EX_new* a, WOLFSSL_CRYPTO_EX_dup* b, + WOLFSSL_CRYPTO_EX_free* c); +WOLFSSL_API int wolfSSL_CTX_get_ex_new_index( + long idx, void* arg, + WOLFSSL_CRYPTO_EX_new* new_func, + WOLFSSL_CRYPTO_EX_dup* dup_func, + WOLFSSL_CRYPTO_EX_free* free_func); +WOLFSSL_API int wolfSSL_CRYPTO_get_ex_new_index( + int class_index, long argl, void *argp, + WOLFSSL_CRYPTO_EX_new* new_func, + WOLFSSL_CRYPTO_EX_dup* dup_func, + WOLFSSL_CRYPTO_EX_free* free_func); +WOLFSSL_API int wolfSSL_SESSION_get_ex_new_index(long ctx_l,void* ctx_ptr, + WOLFSSL_CRYPTO_EX_new* new_func, WOLFSSL_CRYPTO_EX_dup* dup_func, + WOLFSSL_CRYPTO_EX_free* free_func); +#endif /* HAVE_EX_DATA_CRYPTO */ +#endif /* HAVE_EX_DATA */ + +/* Exposed EX data API's, guarded internally by HAVE_EX_DATA */ +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) +WOLFSSL_API void *wolfSSL_X509_get_ex_data(WOLFSSL_X509 *x509, int idx); +WOLFSSL_API int wolfSSL_X509_set_ex_data(WOLFSSL_X509 *x509, int idx, + void *data); +#ifdef HAVE_EX_DATA_CLEANUP_HOOKS +WOLFSSL_API int wolfSSL_X509_set_ex_data_with_cleanup( + WOLFSSL_X509 *x509, + int idx, + void *data, + wolfSSL_ex_data_cleanup_routine_t cleanup_routine); +#endif + +#ifdef HAVE_EX_DATA_CRYPTO +WOLFSSL_API int wolfSSL_X509_get_ex_new_index(int idx, void *arg, + WOLFSSL_CRYPTO_EX_new* new_func, + WOLFSSL_CRYPTO_EX_dup* dup_func, + WOLFSSL_CRYPTO_EX_free* free_func); +#endif +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + +#ifdef OPENSSL_EXTRA +WOLFSSL_API void* wolfSSL_CTX_get_ex_data(const WOLFSSL_CTX* ctx, int idx); +WOLFSSL_API int wolfSSL_CTX_set_ex_data(WOLFSSL_CTX* ctx, int idx, void* data); +#ifdef HAVE_EX_DATA_CLEANUP_HOOKS +WOLFSSL_API int wolfSSL_CTX_set_ex_data_with_cleanup( + WOLFSSL_CTX* ctx, + int idx, + void* data, + wolfSSL_ex_data_cleanup_routine_t cleanup_routine); +#endif +#endif /* OPENSSL_EXTRA */ +/* ----- EX DATA END ----- */ + +WOLFSSL_ABI WOLFSSL_API void wolfSSL_CTX_set_verify(WOLFSSL_CTX* ctx, int mode, + VerifyCallback verify_callback); + +#ifdef OPENSSL_ALL +typedef int (*CertVerifyCallback)(WOLFSSL_X509_STORE_CTX* store, void* arg); +WOLFSSL_API void wolfSSL_CTX_set_cert_verify_callback(WOLFSSL_CTX* ctx, + CertVerifyCallback cb, void* arg); +#endif + +WOLFSSL_API void wolfSSL_set_verify(WOLFSSL* ssl, int mode, VerifyCallback verify_callback); +WOLFSSL_API void wolfSSL_set_verify_result(WOLFSSL* ssl, long v); + +#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS) && \ + defined(WOLFSSL_TLS13) && defined(WOLFSSL_POST_HANDSHAKE_AUTH) +WOLFSSL_API int wolfSSL_verify_client_post_handshake(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_CTX_set_post_handshake_auth(WOLFSSL_CTX* ctx, int val); +WOLFSSL_API int wolfSSL_set_post_handshake_auth(WOLFSSL* ssl, int val); +#endif + +WOLFSSL_API void wolfSSL_SetCertCbCtx(WOLFSSL* ssl, void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetCertCbCtx(WOLFSSL_CTX* ctx, void* userCtx); + +WOLFSSL_ABI WOLFSSL_API int wolfSSL_pending(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_has_pending(const WOLFSSL* ssl); + +WOLFSSL_API void wolfSSL_load_error_strings(void); +WOLFSSL_API int wolfSSL_library_init(void); +WOLFSSL_ABI WOLFSSL_API long wolfSSL_CTX_set_session_cache_mode(WOLFSSL_CTX* ctx, + long mode); + +#ifdef HAVE_SECRET_CALLBACK +typedef int (*SessionSecretCb)(WOLFSSL* ssl, void* secret, int* secretSz, + void* ctx); +/* This callback is used to set the master secret during resumption */ +WOLFSSL_API int wolfSSL_set_session_secret_cb(WOLFSSL* ssl, SessionSecretCb cb, + void* ctx); +typedef int (*TicketParseCb)(WOLFSSL *ssl, const unsigned char *data, + int len, void *ctx); +WOLFSSL_API int wolfSSL_set_session_ticket_ext_cb(WOLFSSL* ssl, + TicketParseCb cb, void *ctx); +typedef int (*TlsSecretCb)(WOLFSSL* ssl, void* secret, int secretSz, + void* ctx); +/* This callback is used to log the secret for TLS <= 1.2 */ +WOLFSSL_API int wolfSSL_set_secret_cb(WOLFSSL* ssl, TlsSecretCb cb, void* ctx); +#ifdef WOLFSSL_TLS13 +typedef int (*Tls13SecretCb)(WOLFSSL* ssl, int id, const unsigned char* secret, + int secretSz, void* ctx); +WOLFSSL_API int wolfSSL_set_tls13_secret_cb(WOLFSSL* ssl, Tls13SecretCb, void*); +#endif +#endif /* HAVE_SECRET_CALLBACK */ + +/* session cache persistence */ +WOLFSSL_API int wolfSSL_save_session_cache(const char* fname); +WOLFSSL_API int wolfSSL_restore_session_cache(const char* fname); +WOLFSSL_API int wolfSSL_memsave_session_cache(void* mem, int sz); +WOLFSSL_API int wolfSSL_memrestore_session_cache(const void* mem, int sz); +WOLFSSL_API int wolfSSL_get_session_cache_memsize(void); + +/* certificate cache persistence, uses ctx since certs are per ctx */ +WOLFSSL_API int wolfSSL_CTX_save_cert_cache(WOLFSSL_CTX* ctx, const char* fname); +WOLFSSL_API int wolfSSL_CTX_restore_cert_cache(WOLFSSL_CTX* ctx, const char* fname); +WOLFSSL_API int wolfSSL_CTX_memsave_cert_cache(WOLFSSL_CTX* ctx, void* mem, int sz, int* used); +WOLFSSL_API int wolfSSL_CTX_memrestore_cert_cache(WOLFSSL_CTX* ctx, const void* mem, int sz); +WOLFSSL_API int wolfSSL_CTX_get_cert_cache_memsize(WOLFSSL_CTX* ctx); + +/* only supports full name from cipher_name[] delimited by : */ +WOLFSSL_API int wolfSSL_CTX_set_cipher_list(WOLFSSL_CTX* ctx, const char* list); +WOLFSSL_API int wolfSSL_set_cipher_list(WOLFSSL* ssl, const char* list); + +/* supports 2 byte code from cipher_name[] */ +WOLFSSL_API int wolfSSL_CTX_set_cipher_list_bytes(WOLFSSL_CTX* ctx, const byte* list, const int listSz); +WOLFSSL_API int wolfSSL_set_cipher_list_bytes(WOLFSSL* ssl, const byte* list, const int listSz); + +#ifdef HAVE_KEYING_MATERIAL +/* Keying Material Exporter for TLS */ +WOLFSSL_API int wolfSSL_export_keying_material(WOLFSSL *ssl, + unsigned char *out, size_t outLen, + const char *label, size_t labelLen, + const unsigned char *context, size_t contextLen, + int use_context); +#endif /* HAVE_KEYING_MATERIAL */ + +#ifdef WOLFSSL_WOLFSENTRY_HOOKS + +typedef enum { + WOLFSSL_NETFILTER_PASS = 0, + WOLFSSL_NETFILTER_ACCEPT = 1, + WOLFSSL_NETFILTER_REJECT = 2 +} wolfSSL_netfilter_decision_t; + +typedef int (*NetworkFilterCallback_t)( + WOLFSSL *ssl, + void *AcceptFilter_arg, + wolfSSL_netfilter_decision_t *decision); +WOLFSSL_API int wolfSSL_CTX_set_AcceptFilter( + WOLFSSL_CTX *ctx, + NetworkFilterCallback_t AcceptFilter, + void *AcceptFilter_arg); +WOLFSSL_API int wolfSSL_set_AcceptFilter( + WOLFSSL *ssl, + NetworkFilterCallback_t AcceptFilter, + void *AcceptFilter_arg); +WOLFSSL_API int wolfSSL_CTX_set_ConnectFilter( + WOLFSSL_CTX *ctx, + NetworkFilterCallback_t ConnectFilter, + void *ConnectFilter_arg); +WOLFSSL_API int wolfSSL_set_ConnectFilter( + WOLFSSL *ssl, + NetworkFilterCallback_t ConnectFilter, + void *ConnectFilter_arg); + +#endif /* WOLFSSL_WOLFSENTRY_HOOKS */ + +/* Nonblocking DTLS helper functions */ +WOLFSSL_API void wolfSSL_dtls_set_using_nonblock(WOLFSSL* ssl, int nonblock); +WOLFSSL_API int wolfSSL_dtls_get_using_nonblock(WOLFSSL* ssl); +#define wolfSSL_set_using_nonblock wolfSSL_dtls_set_using_nonblock +#define wolfSSL_get_using_nonblock wolfSSL_dtls_get_using_nonblock + /* The old names are deprecated. */ +WOLFSSL_API int wolfSSL_dtls_get_current_timeout(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_dtls13_use_quick_timeout(WOLFSSL* ssl); +WOLFSSL_API void wolfSSL_dtls13_set_send_more_acks(WOLFSSL* ssl, int value); +WOLFSSL_API int wolfSSL_DTLSv1_get_timeout(WOLFSSL* ssl, + WOLFSSL_TIMEVAL* timeleft); +WOLFSSL_API void wolfSSL_DTLSv1_set_initial_timeout_duration(WOLFSSL* ssl, + word32 duration_ms); +WOLFSSL_API int wolfSSL_DTLSv1_handle_timeout(WOLFSSL* ssl); + +WOLFSSL_API int wolfSSL_dtls_set_timeout_init(WOLFSSL* ssl, int timeout); +WOLFSSL_API int wolfSSL_dtls_set_timeout_max(WOLFSSL* ssl, int timeout); +WOLFSSL_API int wolfSSL_dtls_got_timeout(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_dtls_retransmit(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_dtls(WOLFSSL* ssl); + +WOLFSSL_API void* wolfSSL_dtls_create_peer(int port, char* ip); +WOLFSSL_API int wolfSSL_dtls_free_peer(void* addr); + +WOLFSSL_API int wolfSSL_dtls_set_peer(WOLFSSL* ssl, void* peer, + unsigned int peerSz); +WOLFSSL_API int wolfSSL_dtls_set_pending_peer(WOLFSSL* ssl, void* peer, + unsigned int peerSz); +WOLFSSL_API int wolfSSL_dtls_get_peer(WOLFSSL* ssl, void* peer, + unsigned int* peerSz); +WOLFSSL_API int wolfSSL_dtls_get0_peer(WOLFSSL* ssl, const void** peer, + unsigned int* peerSz); + +WOLFSSL_API byte wolfSSL_is_stateful(WOLFSSL* ssl); + +#if defined(WOLFSSL_SCTP) && defined(WOLFSSL_DTLS) +WOLFSSL_API int wolfSSL_CTX_dtls_set_sctp(WOLFSSL_CTX* ctx); +WOLFSSL_API int wolfSSL_dtls_set_sctp(WOLFSSL* ssl); +#endif +#if (defined(WOLFSSL_SCTP) || defined(WOLFSSL_DTLS_MTU)) && \ + defined(WOLFSSL_DTLS) +WOLFSSL_API int wolfSSL_CTX_dtls_set_mtu(WOLFSSL_CTX* ctx, unsigned short mtu); +WOLFSSL_API int wolfSSL_dtls_set_mtu(WOLFSSL* ssl, unsigned short mtu); +#if defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA) +WOLFSSL_API int wolfSSL_set_mtu_compat(WOLFSSL* ssl, unsigned short mtu); +#endif +#endif + +#ifdef WOLFSSL_SRTP + +/* SRTP Profile ID's from RFC 5764 and RFC 7714 */ +/* For WebRTC support for profile SRTP_AES128_CM_SHA1_80 is required per + * draft-ietf-rtcweb-security-arch) */ +#define SRTP_AES128_CM_SHA1_80 0x0001 +#define SRTP_AES128_CM_SHA1_32 0x0002 +#define SRTP_AES128_F8_SHA1_80 0x0003 /* not supported */ +#define SRTP_AES128_F8_SHA1_32 0x0004 /* not supported */ +#define SRTP_NULL_SHA1_80 0x0005 +#define SRTP_NULL_SHA1_32 0x0006 +#define SRTP_AEAD_AES_128_GCM 0x0007 +#define SRTP_AEAD_AES_256_GCM 0x0008 + +typedef struct WOLFSSL_SRTP_PROTECTION_PROFILE { + const char* name; + unsigned long id; + int kdfBits; +} WOLFSSL_SRTP_PROTECTION_PROFILE; + +/* Compatibility API's for SRTP */ +WOLFSSL_API int wolfSSL_CTX_set_tlsext_use_srtp(WOLFSSL_CTX* ctx, + const char* profile_str); +WOLFSSL_API int wolfSSL_set_tlsext_use_srtp(WOLFSSL* ssl, + const char* wolfSSL_set_tlsext_use_srtp); +WOLFSSL_API const WOLFSSL_SRTP_PROTECTION_PROFILE* + wolfSSL_get_selected_srtp_profile(WOLFSSL* ssl); +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_SRTP_PROTECTION_PROFILE)* + wolfSSL_get_srtp_profiles(WOLFSSL* ssl); + +/* Non standard API for getting the SRTP session keys using KDF */ +WOLFSSL_API int wolfSSL_export_dtls_srtp_keying_material(WOLFSSL* ssl, + unsigned char* out, size_t* olen); +#endif /* WOLFSSL_SRTP */ + +WOLFSSL_API int wolfSSL_dtls_get_drop_stats(WOLFSSL* ssl, + unsigned int*, unsigned int*); +WOLFSSL_API int wolfSSL_CTX_mcast_set_member_id(WOLFSSL_CTX* ctx, unsigned short id); +WOLFSSL_API int wolfSSL_set_secret(WOLFSSL* ssl, unsigned short epoch, + const unsigned char* preMasterSecret, unsigned int preMasterSz, + const unsigned char* clientRandom, const unsigned char* serverRandom, + const unsigned char* suite); +WOLFSSL_API int wolfSSL_mcast_read(WOLFSSL* ssl, unsigned short* id, void* data, int sz); +WOLFSSL_API int wolfSSL_mcast_peer_add(WOLFSSL* ssl, unsigned short peerId, int sub); +WOLFSSL_API int wolfSSL_mcast_peer_known(WOLFSSL* ssl, unsigned short peerId); +WOLFSSL_API int wolfSSL_mcast_get_max_peers(void); +typedef int (*CallbackMcastHighwater)(unsigned short peerId, + unsigned int maxSeq, + unsigned int curSeq, void* ctx); +WOLFSSL_API int wolfSSL_CTX_mcast_set_highwater_cb(WOLFSSL_CTX* ctx, + unsigned int maxSeq, + unsigned int first, + unsigned int second, + CallbackMcastHighwater cb); +WOLFSSL_API int wolfSSL_mcast_set_highwater_ctx(WOLFSSL* ssl, void* ctx); + +WOLFSSL_API int wolfSSL_ERR_GET_LIB(unsigned long err); +WOLFSSL_API int wolfSSL_ERR_GET_REASON(unsigned long err); +WOLFSSL_API char* wolfSSL_ERR_error_string(unsigned long errNumber,char* data); +WOLFSSL_API void wolfSSL_ERR_error_string_n(unsigned long e, char* buf, + unsigned long sz); +WOLFSSL_API const char* wolfSSL_ERR_reason_error_string(unsigned long e); +WOLFSSL_API const char* wolfSSL_ERR_func_error_string(unsigned long e); +WOLFSSL_API const char* wolfSSL_ERR_lib_error_string(unsigned long e); + +/* -------- EXTRAS BEGIN -------- */ +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) || \ + defined(WOLFSSL_EXTRA) +WOLFSSL_API int wolfSSL_X509_STORE_CTX_get_error(WOLFSSL_X509_STORE_CTX* ctx); +WOLFSSL_API int wolfSSL_X509_STORE_CTX_get_error_depth(WOLFSSL_X509_STORE_CTX* ctx); +#endif + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) +WOLFSSL_API void wolfSSL_ERR_print_errors(WOLFSSL_BIO *bio); + +WOLFSSL_API WOLFSSL_STACK* wolfSSL_sk_new_node(void* heap); +WOLFSSL_API void wolfSSL_sk_free(WOLFSSL_STACK* sk); +WOLFSSL_API void wolfSSL_sk_free_node(WOLFSSL_STACK* in); +WOLFSSL_API WOLFSSL_STACK* wolfSSL_sk_dup(WOLFSSL_STACK* sk); +WOLFSSL_API WOLFSSL_STACK* wolfSSL_shallow_sk_dup(WOLFSSL_STACK* sk); +WOLFSSL_API int wolfSSL_sk_push_node(WOLFSSL_STACK** stack, WOLFSSL_STACK* in); +WOLFSSL_API WOLFSSL_STACK* wolfSSL_sk_get_node(WOLFSSL_STACK* sk, int idx); +WOLFSSL_API int wolfSSL_sk_push(WOLFSSL_STACK *st, const void *data); +WOLFSSL_API int wolfSSL_sk_insert(WOLFSSL_STACK *sk, const void *data, int idx); +WOLFSSL_API void* wolfSSL_sk_pop(WOLFSSL_STACK* sk); + +#if defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA) || defined(WOLFSSL_QT) +WOLFSSL_API int wolfSSL_sk_ACCESS_DESCRIPTION_push( + WOLF_STACK_OF(ACCESS_DESCRIPTION)* sk, + WOLFSSL_ACCESS_DESCRIPTION* a); +#endif /* OPENSSL_ALL || OPENSSL_EXTRA || WOLFSSL_QT */ + +typedef WOLF_STACK_OF(WOLFSSL_GENERAL_NAME) WOLFSSL_GENERAL_NAMES; +typedef WOLF_STACK_OF(WOLFSSL_DIST_POINT) WOLFSSL_DIST_POINTS; + +WOLFSSL_API int wolfSSL_sk_X509_push(WOLF_STACK_OF(WOLFSSL_X509_NAME)* sk, + WOLFSSL_X509* x509); +WOLFSSL_API WOLFSSL_X509* wolfSSL_sk_X509_pop(WOLF_STACK_OF(WOLFSSL_X509)* sk); +WOLFSSL_API void wolfSSL_sk_X509_free(WOLF_STACK_OF(WOLFSSL_X509)* sk); + +WOLFSSL_API WOLFSSL_STACK* wolfSSL_sk_X509_CRL_new(void); +WOLFSSL_API void wolfSSL_sk_X509_CRL_pop_free(WOLF_STACK_OF(WOLFSSL_X509_CRL)* sk, + void (*f) (WOLFSSL_X509_CRL*)); +WOLFSSL_API void wolfSSL_sk_X509_CRL_free(WOLF_STACK_OF(WOLFSSL_X509_CRL)* sk); +WOLFSSL_API int wolfSSL_sk_X509_CRL_push(WOLF_STACK_OF(WOLFSSL_X509_CRL)* sk, + WOLFSSL_X509_CRL* crl); +WOLFSSL_API WOLFSSL_X509_CRL* wolfSSL_sk_X509_CRL_value( + WOLF_STACK_OF(WOLFSSL_X509)* sk, int i); +WOLFSSL_API int wolfSSL_sk_X509_CRL_num(WOLF_STACK_OF(WOLFSSL_X509)* sk); + +WOLFSSL_API WOLFSSL_GENERAL_NAME* wolfSSL_GENERAL_NAME_new(void); +WOLFSSL_API void wolfSSL_GENERAL_NAME_free(WOLFSSL_GENERAL_NAME* gn); +WOLFSSL_API WOLFSSL_GENERAL_NAME* wolfSSL_GENERAL_NAME_dup( + WOLFSSL_GENERAL_NAME* gn); +WOLFSSL_API int wolfSSL_GENERAL_NAME_set_type(WOLFSSL_GENERAL_NAME* name, + int typ); +WOLFSSL_API WOLFSSL_GENERAL_NAMES* wolfSSL_GENERAL_NAMES_dup( + WOLFSSL_GENERAL_NAMES* gns); +WOLFSSL_API int wolfSSL_GENERAL_NAME_set0_othername(WOLFSSL_GENERAL_NAME* gen, + WOLFSSL_ASN1_OBJECT* oid, + WOLFSSL_ASN1_TYPE* value); +WOLFSSL_API void wolfSSL_GENERAL_NAME_set0_value(WOLFSSL_GENERAL_NAME *a, + int type, void *value); + +WOLFSSL_API WOLFSSL_STACK* wolfSSL_sk_GENERAL_NAME_new(void *cmpFunc); +WOLFSSL_API int wolfSSL_sk_GENERAL_NAME_push(WOLFSSL_GENERAL_NAMES* sk, + WOLFSSL_GENERAL_NAME* gn); +WOLFSSL_API WOLFSSL_GENERAL_NAME* wolfSSL_sk_GENERAL_NAME_value( + WOLFSSL_STACK* sk, int i); +WOLFSSL_API int wolfSSL_sk_GENERAL_NAME_num(WOLFSSL_STACK* sk); +WOLFSSL_API void wolfSSL_sk_GENERAL_NAME_pop_free(WOLFSSL_STACK* sk, + void (*f) (WOLFSSL_GENERAL_NAME*)); +WOLFSSL_API void wolfSSL_sk_GENERAL_NAME_free(WOLFSSL_STACK* sk); +WOLFSSL_API void wolfSSL_GENERAL_NAMES_free(WOLFSSL_GENERAL_NAMES* name); +WOLFSSL_API int wolfSSL_GENERAL_NAME_print(WOLFSSL_BIO* out, + WOLFSSL_GENERAL_NAME* name); +WOLFSSL_API void wolfSSL_EXTENDED_KEY_USAGE_free(WOLFSSL_STACK * sk); + +WOLFSSL_API WOLFSSL_DIST_POINT* wolfSSL_DIST_POINT_new(void); +WOLFSSL_API void wolfSSL_DIST_POINT_free(WOLFSSL_DIST_POINT* dp); +WOLFSSL_API int wolfSSL_sk_DIST_POINT_push(WOLFSSL_DIST_POINTS* sk, + WOLFSSL_DIST_POINT* dp); +WOLFSSL_API WOLFSSL_DIST_POINT* wolfSSL_sk_DIST_POINT_value( + WOLFSSL_STACK* sk, int i); +WOLFSSL_API int wolfSSL_sk_DIST_POINT_num(WOLFSSL_STACK* sk); +WOLFSSL_API void wolfSSL_sk_DIST_POINT_pop_free(WOLFSSL_STACK* sk, + void (*f) (WOLFSSL_DIST_POINT*)); +WOLFSSL_API void wolfSSL_sk_DIST_POINT_free(WOLFSSL_STACK* sk); +WOLFSSL_API void wolfSSL_DIST_POINTS_free(WOLFSSL_DIST_POINTS* dp); + +WOLFSSL_API int wolfSSL_sk_ACCESS_DESCRIPTION_num(WOLFSSL_STACK* sk); +WOLFSSL_API void wolfSSL_AUTHORITY_INFO_ACCESS_free( + WOLF_STACK_OF(WOLFSSL_ACCESS_DESCRIPTION)* sk); +WOLFSSL_API void wolfSSL_AUTHORITY_INFO_ACCESS_pop_free( + WOLF_STACK_OF(WOLFSSL_ACCESS_DESCRIPTION)* sk, + void (*f) (WOLFSSL_ACCESS_DESCRIPTION*)); +WOLFSSL_API WOLFSSL_ACCESS_DESCRIPTION* wolfSSL_sk_ACCESS_DESCRIPTION_value( + WOLFSSL_STACK* sk, int idx); +WOLFSSL_API void wolfSSL_sk_ACCESS_DESCRIPTION_free(WOLFSSL_STACK* sk); +WOLFSSL_API void wolfSSL_sk_ACCESS_DESCRIPTION_pop_free(WOLFSSL_STACK* sk, + void (*f) (WOLFSSL_ACCESS_DESCRIPTION*)); +WOLFSSL_API void wolfSSL_ACCESS_DESCRIPTION_free(WOLFSSL_ACCESS_DESCRIPTION* a); +WOLFSSL_API void wolfSSL_sk_X509_EXTENSION_pop_free( + WOLF_STACK_OF(WOLFSSL_X509_EXTENSION)* sk, + void (*f) (WOLFSSL_X509_EXTENSION*)); +WOLFSSL_API void wolfSSL_sk_X509_EXTENSION_free( + WOLF_STACK_OF(WOLFSSL_X509_EXTENSION)* sk); +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509_EXTENSION)* wolfSSL_sk_X509_EXTENSION_new_null(void); +WOLFSSL_API WOLFSSL_ASN1_OBJECT* wolfSSL_ASN1_OBJECT_new(void); +WOLFSSL_API WOLFSSL_ASN1_OBJECT* wolfSSL_ASN1_OBJECT_dup(WOLFSSL_ASN1_OBJECT* obj); +WOLFSSL_API void wolfSSL_ASN1_OBJECT_free(WOLFSSL_ASN1_OBJECT* obj); +WOLFSSL_API WOLFSSL_STACK* wolfSSL_sk_new_asn1_obj(void); +WOLFSSL_API int wolfSSL_sk_ASN1_OBJECT_push(WOLF_STACK_OF(WOLFSSL_ASN1_OBJEXT)* sk, + WOLFSSL_ASN1_OBJECT* obj); +WOLFSSL_API WOLFSSL_ASN1_OBJECT* wolfSSL_sk_ASN1_OBJECT_pop( + WOLF_STACK_OF(WOLFSSL_ASN1_OBJECT)* sk); +WOLFSSL_API void wolfSSL_sk_ASN1_OBJECT_free(WOLF_STACK_OF(WOLFSSL_ASN1_OBJECT)* sk); +WOLFSSL_API void wolfSSL_sk_ASN1_OBJECT_pop_free( + WOLF_STACK_OF(WOLFSSL_ASN1_OBJECT)* sk, + void (*f)(WOLFSSL_ASN1_OBJECT*)); +WOLFSSL_API int wolfSSL_ASN1_STRING_to_UTF8(unsigned char **out, WOLFSSL_ASN1_STRING *in); +WOLFSSL_API int wolfSSL_ASN1_UNIVERSALSTRING_to_string(WOLFSSL_ASN1_STRING *s); +WOLFSSL_API int wolfSSL_sk_X509_EXTENSION_num(WOLF_STACK_OF(WOLFSSL_X509_EXTENSION)* sk); +WOLFSSL_API WOLFSSL_X509_EXTENSION* wolfSSL_sk_X509_EXTENSION_value( + const WOLF_STACK_OF(WOLFSSL_X509_EXTENSION)* sk, int idx); + +#if defined(OPENSSL_EXTRA_X509_SMALL) || defined(OPENSSL_EXTRA) +WOLFSSL_API int wolfSSL_RSA_up_ref(WOLFSSL_RSA* rsa); +WOLFSSL_API int wolfSSL_X509_up_ref(WOLFSSL_X509* x509); +WOLFSSL_API int wolfSSL_EVP_PKEY_up_ref(WOLFSSL_EVP_PKEY* pkey); +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509)* + wolfSSL_X509_chain_up_ref(WOLF_STACK_OF(WOLFSSL_X509)* chain); +#endif + +WOLFSSL_API int wolfSSL_OCSP_parse_url(const char* url, char** host, + char** port, char** path, int* ssl); + +#ifndef NO_BIO +#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L +WOLFSSL_API WOLFSSL_BIO* wolfSSL_BIO_new(const WOLFSSL_BIO_METHOD* method); +#else +WOLFSSL_API WOLFSSL_BIO* wolfSSL_BIO_new(WOLFSSL_BIO_METHOD* method); +#endif +WOLFSSL_API int wolfSSL_BIO_free(WOLFSSL_BIO* bio); +WOLFSSL_API void wolfSSL_BIO_vfree(WOLFSSL_BIO* bio); +WOLFSSL_API void wolfSSL_BIO_free_all(WOLFSSL_BIO* bio); +WOLFSSL_API int wolfSSL_BIO_gets(WOLFSSL_BIO* bio, char* buf, int sz); +WOLFSSL_API int wolfSSL_BIO_puts(WOLFSSL_BIO* bio, const char* buf); +WOLFSSL_API WOLFSSL_BIO* wolfSSL_BIO_next(WOLFSSL_BIO* bio); +WOLFSSL_API WOLFSSL_BIO* wolfSSL_BIO_find_type(WOLFSSL_BIO* bio, int type); +WOLFSSL_API int wolfSSL_BIO_read(WOLFSSL_BIO* bio, void* buf, int len); +WOLFSSL_API int wolfSSL_BIO_write(WOLFSSL_BIO* bio, const void* data, int len); +WOLFSSL_API WOLFSSL_BIO* wolfSSL_BIO_push(WOLFSSL_BIO* top, WOLFSSL_BIO* append); +WOLFSSL_API WOLFSSL_BIO* wolfSSL_BIO_pop(WOLFSSL_BIO* bio); +WOLFSSL_API int wolfSSL_BIO_flush(WOLFSSL_BIO* bio); +WOLFSSL_API int wolfSSL_BIO_pending(WOLFSSL_BIO* bio); +WOLFSSL_API void wolfSSL_BIO_set_callback(WOLFSSL_BIO *bio, + wolf_bio_info_cb callback_func); +WOLFSSL_API wolf_bio_info_cb wolfSSL_BIO_get_callback(WOLFSSL_BIO *bio); +WOLFSSL_API void wolfSSL_BIO_set_callback_arg(WOLFSSL_BIO *bio, char *arg); +WOLFSSL_API char* wolfSSL_BIO_get_callback_arg(const WOLFSSL_BIO *bio); + +WOLFSSL_API WOLFSSL_BIO_METHOD* wolfSSL_BIO_f_md(void); +WOLFSSL_API int wolfSSL_BIO_get_md_ctx(WOLFSSL_BIO *bio, + WOLFSSL_EVP_MD_CTX **mdcp); + +WOLFSSL_API WOLFSSL_BIO_METHOD* wolfSSL_BIO_f_buffer(void); +WOLFSSL_API long wolfSSL_BIO_set_write_buffer_size(WOLFSSL_BIO* bio, long size); +WOLFSSL_API WOLFSSL_BIO_METHOD* wolfSSL_BIO_f_ssl(void); +WOLFSSL_API WOLFSSL_BIO* wolfSSL_BIO_new_socket(int sfd, int flag); +WOLFSSL_API WOLFSSL_BIO* wolfSSL_BIO_new_dgram(int fd, int closeF); +WOLFSSL_API int wolfSSL_BIO_eof(WOLFSSL_BIO* b); + +WOLFSSL_API WOLFSSL_BIO_METHOD* wolfSSL_BIO_s_mem(void); +WOLFSSL_API WOLFSSL_BIO_METHOD* wolfSSL_BIO_f_base64(void); +WOLFSSL_API void wolfSSL_BIO_set_flags(WOLFSSL_BIO* bio, int flags); +WOLFSSL_API void wolfSSL_BIO_clear_flags(WOLFSSL_BIO *bio, int flags); +WOLFSSL_API int wolfSSL_BIO_get_fd(WOLFSSL_BIO *bio, int* fd); +WOLFSSL_API int wolfSSL_BIO_set_ex_data(WOLFSSL_BIO *bio, int idx, void *data); +#ifdef HAVE_EX_DATA_CLEANUP_HOOKS +WOLFSSL_API int wolfSSL_BIO_set_ex_data_with_cleanup( + WOLFSSL_BIO *bio, + int idx, + void *data, + wolfSSL_ex_data_cleanup_routine_t cleanup_routine); +#endif +WOLFSSL_API void *wolfSSL_BIO_get_ex_data(WOLFSSL_BIO *bio, int idx); +WOLFSSL_API long wolfSSL_BIO_set_nbio(WOLFSSL_BIO* bio, long on); + +WOLFSSL_API int wolfSSL_BIO_get_mem_data(WOLFSSL_BIO* bio,void* p); + +WOLFSSL_API void wolfSSL_BIO_set_init(WOLFSSL_BIO* bio, int init); +WOLFSSL_API void wolfSSL_BIO_set_data(WOLFSSL_BIO* bio, void* ptr); +WOLFSSL_API void* wolfSSL_BIO_get_data(WOLFSSL_BIO* bio); +WOLFSSL_API void wolfSSL_BIO_set_shutdown(WOLFSSL_BIO* bio, int shut); +WOLFSSL_API int wolfSSL_BIO_get_shutdown(WOLFSSL_BIO* bio); +WOLFSSL_API void wolfSSL_BIO_clear_retry_flags(WOLFSSL_BIO* bio); +WOLFSSL_API int wolfSSL_BIO_should_retry(WOLFSSL_BIO *bio); +WOLFSSL_API int wolfSSL_BIO_should_read(WOLFSSL_BIO *bio); +WOLFSSL_API int wolfSSL_BIO_should_write(WOLFSSL_BIO *bio); + +WOLFSSL_API WOLFSSL_BIO_METHOD *wolfSSL_BIO_meth_new(int type, const char* name); +WOLFSSL_API void wolfSSL_BIO_meth_free(WOLFSSL_BIO_METHOD* biom); +WOLFSSL_API int wolfSSL_BIO_meth_set_write(WOLFSSL_BIO_METHOD* biom, wolfSSL_BIO_meth_write_cb biom_write); +WOLFSSL_API int wolfSSL_BIO_meth_set_read(WOLFSSL_BIO_METHOD* biom, wolfSSL_BIO_meth_read_cb biom_read); +WOLFSSL_API int wolfSSL_BIO_meth_set_puts(WOLFSSL_BIO_METHOD* biom, wolfSSL_BIO_meth_puts_cb biom_puts); +WOLFSSL_API int wolfSSL_BIO_meth_set_gets(WOLFSSL_BIO_METHOD* biom, wolfSSL_BIO_meth_gets_cb biom_gets); +WOLFSSL_API int wolfSSL_BIO_meth_set_ctrl(WOLFSSL_BIO_METHOD* biom, wolfSSL_BIO_meth_ctrl_get_cb biom_ctrl); +WOLFSSL_API int wolfSSL_BIO_meth_set_create(WOLFSSL_BIO_METHOD* biom, wolfSSL_BIO_meth_create_cb biom_create); +WOLFSSL_API int wolfSSL_BIO_meth_set_destroy(WOLFSSL_BIO_METHOD* biom, wolfSSL_BIO_meth_destroy_cb biom_destroy); +WOLFSSL_API WOLFSSL_BIO* wolfSSL_BIO_new_mem_buf(const void* buf, int len); + +WOLFSSL_API long wolfSSL_BIO_set_ssl(WOLFSSL_BIO* b, WOLFSSL* ssl, int flag); +WOLFSSL_API long wolfSSL_BIO_get_ssl(WOLFSSL_BIO* bio, WOLFSSL** ssl); +#ifndef NO_FILESYSTEM +WOLFSSL_API long wolfSSL_BIO_set_fd(WOLFSSL_BIO* b, int fd, int flag); +#endif +WOLFSSL_API int wolfSSL_BIO_set_close(WOLFSSL_BIO *b, long flag); +WOLFSSL_API void wolfSSL_set_bio(WOLFSSL* ssl, WOLFSSL_BIO* rd, WOLFSSL_BIO* wr); +WOLFSSL_API void wolfSSL_set_rbio(WOLFSSL* ssl, WOLFSSL_BIO* rd); +WOLFSSL_API void wolfSSL_set_wbio(WOLFSSL* ssl, WOLFSSL_BIO* wr); +WOLFSSL_API int wolfSSL_BIO_method_type(const WOLFSSL_BIO *b); + +#ifndef NO_FILESYSTEM +WOLFSSL_API WOLFSSL_BIO_METHOD *wolfSSL_BIO_s_file(void); +WOLFSSL_API WOLFSSL_BIO *wolfSSL_BIO_new_fd(int fd, int close_flag); +#endif + +WOLFSSL_API WOLFSSL_BIO_METHOD *wolfSSL_BIO_s_bio(void); +WOLFSSL_API WOLFSSL_BIO_METHOD *wolfSSL_BIO_s_socket(void); +WOLFSSL_API WOLFSSL_BIO_METHOD *wolfSSL_BIO_s_datagram(void); +WOLFSSL_API WOLFSSL_BIO_METHOD *wolfSSL_BIO_s_null(void); + +WOLFSSL_API WOLFSSL_BIO *wolfSSL_BIO_new_connect(const char *str); +WOLFSSL_API WOLFSSL_BIO *wolfSSL_BIO_new_accept(const char *port); +WOLFSSL_API long wolfSSL_BIO_set_conn_hostname(WOLFSSL_BIO* b, char* name); +WOLFSSL_API long wolfSSL_BIO_set_conn_port(WOLFSSL_BIO *b, char* port); +WOLFSSL_API long wolfSSL_BIO_do_connect(WOLFSSL_BIO *b); +WOLFSSL_API int wolfSSL_BIO_do_accept(WOLFSSL_BIO *b); +WOLFSSL_API WOLFSSL_BIO* wolfSSL_BIO_new_ssl(WOLFSSL_CTX* ctx, int client); +WOLFSSL_API WOLFSSL_BIO* wolfSSL_BIO_new_ssl_connect(WOLFSSL_CTX* ctx); + +WOLFSSL_API long wolfSSL_BIO_do_handshake(WOLFSSL_BIO *b); +WOLFSSL_API void wolfSSL_BIO_ssl_shutdown(WOLFSSL_BIO* b); + +WOLFSSL_API long wolfSSL_BIO_ctrl(WOLFSSL_BIO *bp, int cmd, long larg, void *parg); +WOLFSSL_API long wolfSSL_BIO_int_ctrl(WOLFSSL_BIO *bp, int cmd, long larg, int iarg); + +WOLFSSL_API int wolfSSL_BIO_set_write_buf_size(WOLFSSL_BIO *b, long size); +WOLFSSL_API int wolfSSL_BIO_make_bio_pair(WOLFSSL_BIO *b1, WOLFSSL_BIO *b2); +WOLFSSL_API int wolfSSL_BIO_up_ref(WOLFSSL_BIO *b); +WOLFSSL_API int wolfSSL_BIO_ctrl_reset_read_request(WOLFSSL_BIO *b); +WOLFSSL_API int wolfSSL_BIO_nread0(WOLFSSL_BIO *bio, char **buf); +WOLFSSL_API int wolfSSL_BIO_nread(WOLFSSL_BIO *bio, char **buf, int num); +WOLFSSL_API int wolfSSL_BIO_nwrite(WOLFSSL_BIO *bio, char **buf, int num); +#if defined(WORD64_AVAILABLE) && !defined(WOLFSSL_BIO_NO_FLOW_STATS) +WOLFSSL_API word64 wolfSSL_BIO_number_read(WOLFSSL_BIO *bio); +WOLFSSL_API word64 wolfSSL_BIO_number_written(WOLFSSL_BIO *bio); +#endif +WOLFSSL_API int wolfSSL_BIO_reset(WOLFSSL_BIO *bio); + +WOLFSSL_API int wolfSSL_BIO_seek(WOLFSSL_BIO *bio, int ofs); +WOLFSSL_API int wolfSSL_BIO_tell(WOLFSSL_BIO* bio); +WOLFSSL_API int wolfSSL_BIO_write_filename(WOLFSSL_BIO *bio, char *name); +WOLFSSL_API long wolfSSL_BIO_set_mem_eof_return(WOLFSSL_BIO *bio, int v); +WOLFSSL_API long wolfSSL_BIO_get_mem_ptr(WOLFSSL_BIO *bio, WOLFSSL_BUF_MEM **m); +#ifdef OPENSSL_ALL +WOLFSSL_API int wolfSSL_BIO_set_mem_buf(WOLFSSL_BIO* bio, WOLFSSL_BUF_MEM* bufMem, + int closeFlag); +#endif +WOLFSSL_API int wolfSSL_BIO_get_len(WOLFSSL_BIO *bio); + +#ifdef WOLFSSL_HAVE_BIO_ADDR +WOLFSSL_API WOLFSSL_BIO_ADDR *wolfSSL_BIO_ADDR_new(void); +WOLFSSL_API void wolfSSL_BIO_ADDR_free(WOLFSSL_BIO_ADDR *addr); +WOLFSSL_API void wolfSSL_BIO_ADDR_clear(WOLFSSL_BIO_ADDR *addr); +#endif /* WOLFSSL_HAVE_BIO_ADDR */ + +#endif /* !NO_BIO */ + +WOLFSSL_API void wolfSSL_RAND_screen(void); +WOLFSSL_API const char* wolfSSL_RAND_file_name(char* fname, unsigned long len); +WOLFSSL_API int wolfSSL_RAND_write_file(const char* fname); +WOLFSSL_API int wolfSSL_RAND_load_file(const char* fname, long len); +WOLFSSL_API int wolfSSL_RAND_egd(const char* nm); +WOLFSSL_API int wolfSSL_RAND_seed(const void* seed, int len); +WOLFSSL_API void wolfSSL_RAND_Cleanup(void); +WOLFSSL_API void wolfSSL_RAND_add(const void* add, int len, double entropy); +WOLFSSL_API int wolfSSL_RAND_poll(void); + +#ifndef NO_WOLFSSL_STUB +WOLFSSL_API WOLFSSL_COMP_METHOD* wolfSSL_COMP_zlib(void); +WOLFSSL_API WOLFSSL_COMP_METHOD* wolfSSL_COMP_rle(void); +WOLFSSL_API int wolfSSL_COMP_add_compression_method(int method, void* data); +WOLFSSL_API const char *wolfSSL_COMP_get_name(const WOLFSSL_COMP_METHOD *comp); +WOLFSSL_API const WOLFSSL_COMP_METHOD* wolfSSL_get_current_compression(const WOLFSSL *ssl); +WOLFSSL_API const WOLFSSL_COMP_METHOD* wolfSSL_get_current_expansion(const WOLFSSL *ssl); +#endif /* !NO_WOLFSSL_STUB */ + +WOLFSSL_API unsigned long wolfSSL_thread_id(void); +WOLFSSL_API void wolfSSL_set_id_callback(unsigned long (*f)(void)); +#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) +WOLFSSL_API void wolfSSL_set_locking_callback(mutex_cb* f); +WOLFSSL_API mutex_cb* wolfSSL_get_locking_callback(void); +#endif +WOLFSSL_API void wolfSSL_set_dynlock_create_callback(WOLFSSL_dynlock_value* (*f) + (const char*, int)); +WOLFSSL_API void wolfSSL_set_dynlock_lock_callback(void (*f)(int, + WOLFSSL_dynlock_value*, const char*, int)); +WOLFSSL_API void wolfSSL_set_dynlock_destroy_callback(void (*f) + (WOLFSSL_dynlock_value*, const char*, int)); +WOLFSSL_API int wolfSSL_num_locks(void); + +WOLFSSL_API WOLFSSL_X509* wolfSSL_X509_STORE_CTX_get_current_cert( + WOLFSSL_X509_STORE_CTX* ctx); +WOLFSSL_API void wolfSSL_X509_STORE_CTX_set_verify_cb(WOLFSSL_X509_STORE_CTX *ctx, + WOLFSSL_X509_STORE_CTX_verify_cb verify_cb); +WOLFSSL_API void wolfSSL_X509_STORE_set_verify_cb(WOLFSSL_X509_STORE *st, + WOLFSSL_X509_STORE_CTX_verify_cb verify_cb); +WOLFSSL_API void wolfSSL_X509_STORE_set_get_crl(WOLFSSL_X509_STORE *st, + WOLFSSL_X509_STORE_CTX_get_crl_cb get_cb); +WOLFSSL_API void wolfSSL_X509_STORE_set_check_crl(WOLFSSL_X509_STORE *st, + WOLFSSL_X509_STORE_CTX_check_crl_cb check_crl); +WOLFSSL_API int wolfSSL_i2d_X509_NAME(WOLFSSL_X509_NAME* n, + unsigned char** out); +WOLFSSL_API int wolfSSL_i2d_X509_NAME_canon(WOLFSSL_X509_NAME* name, + unsigned char** out); +WOLFSSL_API WOLFSSL_X509_NAME *wolfSSL_d2i_X509_NAME(WOLFSSL_X509_NAME **name, + unsigned char **in, long length); +#ifndef NO_RSA +#if !defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM) +WOLFSSL_API int wolfSSL_RSA_print_fp(XFILE fp, WOLFSSL_RSA* rsa, int indent); +#endif /* !NO_FILESYSTEM && !NO_STDIO_FILESYSTEM */ +#ifndef NO_BIO +WOLFSSL_API int wolfSSL_RSA_print(WOLFSSL_BIO* bio, WOLFSSL_RSA* rsa, int offset); +#endif /* !NO_BIO */ +#endif /* !NO_RSA */ + +WOLFSSL_API int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, + unsigned long nmflags, unsigned long cflag); +#ifndef NO_FILESYSTEM +WOLFSSL_API int wolfSSL_X509_print_fp(XFILE fp, WOLFSSL_X509 *x509); +#endif +WOLFSSL_API int wolfSSL_X509_signature_print(WOLFSSL_BIO *bp, + const WOLFSSL_X509_ALGOR *sigalg, const WOLFSSL_ASN1_STRING *sig); +WOLFSSL_API void wolfSSL_X509_get0_signature(const WOLFSSL_ASN1_BIT_STRING **psig, + const WOLFSSL_X509_ALGOR **palg, const WOLFSSL_X509 *x509); +WOLFSSL_API int wolfSSL_X509_print(WOLFSSL_BIO* bio, WOLFSSL_X509* x509); +WOLFSSL_API int wolfSSL_X509_REQ_print(WOLFSSL_BIO* bio, WOLFSSL_X509* x509); +WOLFSSL_API unsigned long wolfSSL_X509_NAME_hash(WOLFSSL_X509_NAME* name); +#if defined(OPENSSL_EXTRA) && defined(XSNPRINTF) +WOLFSSL_API char* wolfSSL_X509_get_name_oneline(WOLFSSL_X509_NAME* name, char* in, int sz); +#endif +WOLFSSL_API unsigned long wolfSSL_X509_issuer_name_hash(const WOLFSSL_X509* x509); +WOLFSSL_API unsigned long wolfSSL_X509_subject_name_hash(const WOLFSSL_X509* x509); +WOLFSSL_API int wolfSSL_X509_ext_isSet_by_NID(WOLFSSL_X509* x509, int nid); +WOLFSSL_API int wolfSSL_X509_ext_get_critical_by_NID(WOLFSSL_X509* x509, int nid); +WOLFSSL_API int wolfSSL_X509_EXTENSION_set_critical(WOLFSSL_X509_EXTENSION* ex, int crit); +WOLFSSL_API int wolfSSL_X509_get_isSet_pathLength(WOLFSSL_X509* x509); +WOLFSSL_API unsigned int wolfSSL_X509_get_pathLength(WOLFSSL_X509* x509); +WOLFSSL_API unsigned int wolfSSL_X509_get_keyUsage(WOLFSSL_X509* x509); +WOLFSSL_API unsigned char* wolfSSL_X509_get_authorityKeyID( + WOLFSSL_X509* x509, unsigned char* dst, int* dstLen); +WOLFSSL_API unsigned char* wolfSSL_X509_get_subjectKeyID( + WOLFSSL_X509* x509, unsigned char* dst, int* dstLen); +WOLFSSL_API const WOLFSSL_ASN1_STRING *wolfSSL_X509_get0_subject_key_id( + WOLFSSL_X509 *x509); + +WOLFSSL_API int wolfSSL_X509_verify(WOLFSSL_X509* x509, WOLFSSL_EVP_PKEY* pkey); +#ifdef WOLFSSL_CERT_REQ +WOLFSSL_API int wolfSSL_X509_REQ_verify(WOLFSSL_X509* x509, WOLFSSL_EVP_PKEY* pkey); +#endif +WOLFSSL_API int wolfSSL_X509_set_subject_name(WOLFSSL_X509* cert, + WOLFSSL_X509_NAME* name); +WOLFSSL_API int wolfSSL_X509_set_issuer_name(WOLFSSL_X509* cert, + WOLFSSL_X509_NAME* name); +WOLFSSL_API int wolfSSL_X509_set_pubkey(WOLFSSL_X509* cert, WOLFSSL_EVP_PKEY* pkey); +WOLFSSL_API int wolfSSL_X509_set_notAfter(WOLFSSL_X509* x509, + const WOLFSSL_ASN1_TIME* t); +WOLFSSL_API int wolfSSL_X509_set1_notAfter(WOLFSSL_X509* x509, + const WOLFSSL_ASN1_TIME *t); +WOLFSSL_API int wolfSSL_X509_set_notBefore(WOLFSSL_X509* x509, + const WOLFSSL_ASN1_TIME* t); +WOLFSSL_API int wolfSSL_X509_set1_notBefore(WOLFSSL_X509* x509, + const WOLFSSL_ASN1_TIME *t); +WOLFSSL_API WOLFSSL_ASN1_TIME* wolfSSL_X509_get_notBefore(const WOLFSSL_X509* x509); +WOLFSSL_API WOLFSSL_ASN1_TIME* wolfSSL_X509_get_notAfter(const WOLFSSL_X509* x509); +WOLFSSL_API int wolfSSL_X509_set_serialNumber(WOLFSSL_X509* x509, + WOLFSSL_ASN1_INTEGER* s); +WOLFSSL_API int wolfSSL_X509_set_version(WOLFSSL_X509* x509, long v); +WOLFSSL_API int wolfSSL_X509_sign(WOLFSSL_X509* x509, WOLFSSL_EVP_PKEY* pkey, + const WOLFSSL_EVP_MD* md); +WOLFSSL_API int wolfSSL_X509_sign_ctx(WOLFSSL_X509 *x509, WOLFSSL_EVP_MD_CTX *ctx); + + +WOLFSSL_API int wolfSSL_X509_NAME_entry_count(WOLFSSL_X509_NAME* name); +WOLFSSL_API int wolfSSL_X509_NAME_get_sz(WOLFSSL_X509_NAME* name); +WOLFSSL_API int wolfSSL_X509_NAME_get_text_by_NID( + WOLFSSL_X509_NAME* name, int nid, char* buf, int len); +WOLFSSL_API int wolfSSL_X509_NAME_get_index_by_NID( + WOLFSSL_X509_NAME* name, int nid, int pos); +WOLFSSL_API WOLFSSL_ASN1_STRING* wolfSSL_X509_NAME_ENTRY_get_data(WOLFSSL_X509_NAME_ENTRY* in); + +WOLFSSL_API WOLFSSL_ASN1_STRING* wolfSSL_ASN1_STRING_new(void); +WOLFSSL_API WOLFSSL_ASN1_STRING* wolfSSL_ASN1_STRING_dup(WOLFSSL_ASN1_STRING* asn1); +WOLFSSL_API WOLFSSL_ASN1_STRING* wolfSSL_ASN1_STRING_type_new(int type); +WOLFSSL_API int wolfSSL_ASN1_STRING_type(const WOLFSSL_ASN1_STRING* asn1); +WOLFSSL_API WOLFSSL_ASN1_STRING* wolfSSL_d2i_DISPLAYTEXT(WOLFSSL_ASN1_STRING **asn, const unsigned char **in, long len); +WOLFSSL_API int wolfSSL_ASN1_STRING_cmp(const WOLFSSL_ASN1_STRING *a, const WOLFSSL_ASN1_STRING *b); +WOLFSSL_API void wolfSSL_ASN1_STRING_free(WOLFSSL_ASN1_STRING* asn1); +WOLFSSL_API int wolfSSL_ASN1_STRING_set(WOLFSSL_ASN1_STRING* asn1, + const void* data, int dataSz); +WOLFSSL_API unsigned char* wolfSSL_ASN1_STRING_data(WOLFSSL_ASN1_STRING* asn); +WOLFSSL_API const unsigned char* wolfSSL_ASN1_STRING_get0_data( + const WOLFSSL_ASN1_STRING* asn); +WOLFSSL_API int wolfSSL_ASN1_STRING_length(const WOLFSSL_ASN1_STRING* asn); +WOLFSSL_API int wolfSSL_ASN1_STRING_copy(WOLFSSL_ASN1_STRING* dst, + const WOLFSSL_ASN1_STRING* src); +WOLFSSL_API int wolfSSL_X509_verify_cert(WOLFSSL_X509_STORE_CTX* ctx); +WOLFSSL_API const char* wolfSSL_X509_verify_cert_error_string(long err); + +WOLFSSL_API int wolfSSL_X509_LOOKUP_add_dir(WOLFSSL_X509_LOOKUP* lookup,const char* dir,long type); +WOLFSSL_API int wolfSSL_X509_LOOKUP_load_file(WOLFSSL_X509_LOOKUP* lookup, const char* file, + long type); +WOLFSSL_API WOLFSSL_X509_LOOKUP_METHOD* wolfSSL_X509_LOOKUP_hash_dir(void); +WOLFSSL_API WOLFSSL_X509_LOOKUP_METHOD* wolfSSL_X509_LOOKUP_file(void); +WOLFSSL_API int wolfSSL_X509_LOOKUP_ctrl(WOLFSSL_X509_LOOKUP *ctx, int cmd, + const char *argc, long argl, char **ret); + +WOLFSSL_API WOLFSSL_X509_LOOKUP* wolfSSL_X509_STORE_add_lookup(WOLFSSL_X509_STORE* store, + WOLFSSL_X509_LOOKUP_METHOD* m); +WOLFSSL_API WOLFSSL_X509_STORE* wolfSSL_X509_STORE_new(void); +WOLFSSL_API void wolfSSL_X509_STORE_free(WOLFSSL_X509_STORE* store); +WOLFSSL_API int wolfSSL_X509_STORE_up_ref(WOLFSSL_X509_STORE* store); +WOLFSSL_API int wolfSSL_X509_STORE_add_cert( + WOLFSSL_X509_STORE* store, WOLFSSL_X509* x509); +WOLFSSL_API WOLFSSL_X509_VERIFY_PARAM *wolfSSL_X509_STORE_get0_param( + const WOLFSSL_X509_STORE *ctx); +WOLFSSL_API int wolfSSL_X509_STORE_set1_param(WOLFSSL_X509_STORE *ctx, + WOLFSSL_X509_VERIFY_PARAM *param); +WOLFSSL_API WOLFSSL_STACK* wolfSSL_X509_STORE_CTX_get_chain( + WOLFSSL_X509_STORE_CTX* ctx); +WOLFSSL_API WOLFSSL_STACK* wolfSSL_X509_STORE_CTX_get1_chain( + WOLFSSL_X509_STORE_CTX* ctx); +WOLFSSL_API WOLFSSL_X509_STORE_CTX *wolfSSL_X509_STORE_CTX_get0_parent_ctx( + WOLFSSL_X509_STORE_CTX *ctx); +WOLFSSL_API int wolfSSL_X509_STORE_set_flags(WOLFSSL_X509_STORE* store, + unsigned long flag); +WOLFSSL_API int wolfSSL_X509_STORE_get_by_subject(WOLFSSL_X509_STORE_CTX* ctx, + int idx, WOLFSSL_X509_NAME* name, WOLFSSL_X509_OBJECT* obj); +WOLFSSL_API WOLFSSL_X509_VERIFY_PARAM *wolfSSL_X509_STORE_CTX_get0_param( + WOLFSSL_X509_STORE_CTX *ctx); +WOLFSSL_API int wolfSSL_X509_STORE_CTX_init(WOLFSSL_X509_STORE_CTX* ctx, + WOLFSSL_X509_STORE* store, WOLFSSL_X509* x509, WOLF_STACK_OF(WOLFSSL_X509)*); +WOLFSSL_API void wolfSSL_X509_STORE_CTX_cleanup(WOLFSSL_X509_STORE_CTX* ctx); +WOLFSSL_API void wolfSSL_X509_STORE_CTX_trusted_stack(WOLFSSL_X509_STORE_CTX *ctx, + WOLF_STACK_OF(WOLFSSL_X509) *sk); + +WOLFSSL_API WOLFSSL_ASN1_TIME* wolfSSL_X509_CRL_get_lastUpdate(WOLFSSL_X509_CRL* crl); +WOLFSSL_API WOLFSSL_ASN1_TIME* wolfSSL_X509_CRL_get_nextUpdate(WOLFSSL_X509_CRL* crl); + +WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_X509_get_pubkey(WOLFSSL_X509* x509); +WOLFSSL_API int wolfSSL_X509_CRL_verify(WOLFSSL_X509_CRL* crl, WOLFSSL_EVP_PKEY* pkey); +WOLFSSL_API void wolfSSL_X509_OBJECT_free_contents(WOLFSSL_X509_OBJECT* obj); +WOLFSSL_API WOLFSSL_PKCS8_PRIV_KEY_INFO* wolfSSL_d2i_PKCS8_PKEY_bio( + WOLFSSL_BIO* bio, WOLFSSL_PKCS8_PRIV_KEY_INFO** pkey); +WOLFSSL_API WOLFSSL_PKCS8_PRIV_KEY_INFO* wolfSSL_d2i_PKCS8_PKEY( + WOLFSSL_PKCS8_PRIV_KEY_INFO** pkey, const unsigned char** keyBuf, long keyLen); +WOLFSSL_API int wolfSSL_i2d_PKCS8_PKEY(WOLFSSL_PKCS8_PRIV_KEY_INFO* key, + unsigned char** pp); +WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_d2i_PUBKEY_bio(WOLFSSL_BIO* bio, + WOLFSSL_EVP_PKEY** out); +WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_d2i_PUBKEY(WOLFSSL_EVP_PKEY** key, + const unsigned char** in, long inSz); +WOLFSSL_API int wolfSSL_i2d_PUBKEY(const WOLFSSL_EVP_PKEY *key, unsigned char **der); +WOLFSSL_API int wolfSSL_i2d_X509_PUBKEY(WOLFSSL_X509_PUBKEY* x509_PubKey, + unsigned char** der); +WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_d2i_PublicKey(int type, WOLFSSL_EVP_PKEY** pkey, + const unsigned char ** in, long inSz); +WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_d2i_PrivateKey(int type, + WOLFSSL_EVP_PKEY** out, const unsigned char **in, long inSz); +#ifdef WOLF_PRIVATE_KEY_ID +WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_d2i_PrivateKey_id(int type, + WOLFSSL_EVP_PKEY** out, void* heap, int devId); +#endif +WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_d2i_PrivateKey_EVP(WOLFSSL_EVP_PKEY** key, + unsigned char** in, long inSz); +WOLFSSL_API int wolfSSL_i2d_PrivateKey(const WOLFSSL_EVP_PKEY* key, + unsigned char** der); +WOLFSSL_API int wolfSSL_i2d_PublicKey(const WOLFSSL_EVP_PKEY* key, + unsigned char** der); +WOLFSSL_API int wolfSSL_i2d_PrivateKey_bio(WOLFSSL_BIO* bio, + WOLFSSL_EVP_PKEY* key); +#if defined(OPENSSL_EXTRA) && !defined(WOLFCRYPT_ONLY) +WOLFSSL_API int wolfSSL_EVP_PKEY_print_public(WOLFSSL_BIO* out, + const WOLFSSL_EVP_PKEY* pkey, + int indent, WOLFSSL_ASN1_PCTX* pctx); +#endif /* OPENSSL_EXTRA && !WOLFCRYPT_ONLY */ +WOLFSSL_API int wolfSSL_X509_cmp_current_time(const WOLFSSL_ASN1_TIME* asnTime); +#ifdef OPENSSL_EXTRA +WOLFSSL_API int wolfSSL_X509_cmp_time(const WOLFSSL_ASN1_TIME* asnTime, + time_t *cmpTime); +WOLFSSL_API WOLFSSL_ASN1_TIME *wolfSSL_X509_time_adj_ex(WOLFSSL_ASN1_TIME *asnTime, + int offset_day, long offset_sec, time_t *in_tm); +WOLFSSL_API WOLFSSL_ASN1_TIME *wolfSSL_X509_time_adj(WOLFSSL_ASN1_TIME *asnTime, + long offset_sec, time_t *in_tm); +WOLFSSL_API WOLFSSL_ASN1_TIME* wolfSSL_X509_gmtime_adj(WOLFSSL_ASN1_TIME* s, + long adj); +WOLFSSL_API int wolfSSL_sk_X509_REVOKED_num(WOLFSSL_X509_REVOKED* revoked); +WOLFSSL_API void wolfSSL_X509_STORE_CTX_set_time(WOLFSSL_X509_STORE_CTX* ctx, + unsigned long flags, + time_t t); +WOLFSSL_API WOLFSSL_X509_VERIFY_PARAM* wolfSSL_X509_VERIFY_PARAM_new(void); +WOLFSSL_API void wolfSSL_X509_VERIFY_PARAM_free(WOLFSSL_X509_VERIFY_PARAM *param); +WOLFSSL_API int wolfSSL_X509_VERIFY_PARAM_set_flags(WOLFSSL_X509_VERIFY_PARAM *param, + unsigned long flags); +WOLFSSL_API int wolfSSL_X509_VERIFY_PARAM_get_flags(WOLFSSL_X509_VERIFY_PARAM *param); +WOLFSSL_API int wolfSSL_X509_VERIFY_PARAM_clear_flags(WOLFSSL_X509_VERIFY_PARAM *param, + unsigned long flags); +WOLFSSL_API void wolfSSL_X509_VERIFY_PARAM_set_hostflags( + WOLFSSL_X509_VERIFY_PARAM* param, unsigned int flags); +WOLFSSL_API int wolfSSL_set1_host(WOLFSSL* ssl, const char * name); +WOLFSSL_API int wolfSSL_X509_VERIFY_PARAM_set1_host(WOLFSSL_X509_VERIFY_PARAM* pParam, + const char* name, + unsigned int nameSz); +WOLFSSL_API int wolfSSL_X509_VERIFY_PARAM_set1_ip_asc( + WOLFSSL_X509_VERIFY_PARAM *param, const char *ipasc); +WOLFSSL_API int wolfSSL_X509_VERIFY_PARAM_set1_ip( + WOLFSSL_X509_VERIFY_PARAM* param, const unsigned char* ip, size_t iplen); +WOLFSSL_API int wolfSSL_X509_VERIFY_PARAM_set1(WOLFSSL_X509_VERIFY_PARAM* to, + const WOLFSSL_X509_VERIFY_PARAM* from); +WOLFSSL_API const WOLFSSL_X509_VERIFY_PARAM *wolfSSL_X509_VERIFY_PARAM_lookup( + const char *name); +WOLFSSL_API int wolfSSL_X509_VERIFY_PARAM_inherit(WOLFSSL_X509_VERIFY_PARAM *to, + const WOLFSSL_X509_VERIFY_PARAM *from); +WOLFSSL_API int wolfSSL_X509_load_crl_file(WOLFSSL_X509_LOOKUP *ctx, + const char *file, int type); +WOLFSSL_API int wolfSSL_X509_load_cert_crl_file(WOLFSSL_X509_LOOKUP *ctx, + const char *file, int type); +#endif +WOLFSSL_API WOLFSSL_X509_REVOKED* wolfSSL_X509_CRL_get_REVOKED(WOLFSSL_X509_CRL* crl); +WOLFSSL_API WOLFSSL_X509_REVOKED* wolfSSL_sk_X509_REVOKED_value( + WOLFSSL_X509_REVOKED* revoked,int value); +WOLFSSL_API WOLFSSL_ASN1_INTEGER* wolfSSL_X509_get_serialNumber(WOLFSSL_X509* x509); +WOLFSSL_API void wolfSSL_ASN1_INTEGER_free(WOLFSSL_ASN1_INTEGER* in); +WOLFSSL_API WOLFSSL_ASN1_INTEGER* wolfSSL_ASN1_INTEGER_new(void); +WOLFSSL_API WOLFSSL_ASN1_INTEGER* wolfSSL_ASN1_INTEGER_dup( + const WOLFSSL_ASN1_INTEGER* src); +WOLFSSL_API int wolfSSL_ASN1_INTEGER_set(WOLFSSL_ASN1_INTEGER *a, long v); +WOLFSSL_API WOLFSSL_ASN1_INTEGER* wolfSSL_d2i_ASN1_INTEGER( + WOLFSSL_ASN1_INTEGER** a, + const unsigned char** in, + long inSz); +WOLFSSL_API int wolfSSL_i2d_ASN1_INTEGER(const WOLFSSL_ASN1_INTEGER* a, + unsigned char** pp); + +WOLFSSL_API int wolfSSL_ASN1_TIME_print(WOLFSSL_BIO* bio, const WOLFSSL_ASN1_TIME* asnTime); + +WOLFSSL_API char* wolfSSL_ASN1_TIME_to_string(WOLFSSL_ASN1_TIME* t, + char* buf, int len); +#ifndef NO_ASN_TIME +WOLFSSL_API int wolfSSL_ASN1_TIME_to_tm(const WOLFSSL_ASN1_TIME* asnTime, struct tm* tm); +#endif +WOLFSSL_API int wolfSSL_ASN1_INTEGER_cmp(const WOLFSSL_ASN1_INTEGER* a, + const WOLFSSL_ASN1_INTEGER* b); +WOLFSSL_API long wolfSSL_ASN1_INTEGER_get(const WOLFSSL_ASN1_INTEGER* a); + +#ifdef OPENSSL_EXTRA +WOLFSSL_API WOLFSSL_BIGNUM *wolfSSL_ASN1_INTEGER_to_BN(const WOLFSSL_ASN1_INTEGER *ai, + WOLFSSL_BIGNUM *bn); +WOLFSSL_API WOLFSSL_ASN1_TIME* wolfSSL_ASN1_TIME_adj(WOLFSSL_ASN1_TIME* s, time_t t, + int offset_day, long offset_sec); +WOLFSSL_API WOLFSSL_ASN1_TIME* wolfSSL_ASN1_TIME_new(void); +WOLFSSL_API void wolfSSL_ASN1_TIME_free(WOLFSSL_ASN1_TIME* t); +#endif + +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509_NAME)* wolfSSL_load_client_CA_file(const char* fname); + +#ifndef WOLFSSL_NO_CA_NAMES +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509_NAME)* wolfSSL_CTX_get_client_CA_list( + const WOLFSSL_CTX *ctx); +/* deprecated function name */ +#define wolfSSL_SSL_CTX_get_client_CA_list wolfSSL_CTX_get_client_CA_list + +WOLFSSL_API void wolfSSL_CTX_set_client_CA_list(WOLFSSL_CTX* ctx, + WOLF_STACK_OF(WOLFSSL_X509_NAME)*); +WOLFSSL_API void wolfSSL_set_client_CA_list(WOLFSSL* ssl, + WOLF_STACK_OF(WOLFSSL_X509_NAME)*); +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509_NAME)* wolfSSL_get_client_CA_list( + const WOLFSSL* ssl); +#endif /* !WOLFSSL_NO_CA_NAMES */ + +typedef int (*client_cert_cb)(WOLFSSL *ssl, WOLFSSL_X509 **x509, + WOLFSSL_EVP_PKEY **pkey); +WOLFSSL_API void wolfSSL_CTX_set_client_cert_cb(WOLFSSL_CTX *ctx, client_cert_cb cb); + +typedef int (*CertSetupCallback)(WOLFSSL* ssl, void*); +WOLFSSL_API void wolfSSL_CTX_set_cert_cb(WOLFSSL_CTX* ctx, + CertSetupCallback cb, void *arg); +WOLFSSL_API int wolfSSL_get_client_suites_sigalgs(const WOLFSSL* ssl, + const byte** suites, word16* suiteSz, + const byte** hashSigAlgo, word16* hashSigAlgoSz); +typedef struct WOLFSSL_CIPHERSUITE_INFO { + WC_BITFIELD rsaAuth:1; + WC_BITFIELD eccAuth:1; + WC_BITFIELD eccStatic:1; + WC_BITFIELD psk:1; +} WOLFSSL_CIPHERSUITE_INFO; +WOLFSSL_API WOLFSSL_CIPHERSUITE_INFO wolfSSL_get_ciphersuite_info(byte first, + byte second); +WOLFSSL_API int wolfSSL_get_sigalg_info(byte first, + byte second, int* hashAlgo, int* sigAlgo); +WOLFSSL_LOCAL int CertSetupCbWrapper(WOLFSSL* ssl); + +WOLFSSL_API void* wolfSSL_X509_STORE_CTX_get_ex_data( + WOLFSSL_X509_STORE_CTX* ctx, int idx); +WOLFSSL_API int wolfSSL_X509_STORE_CTX_set_ex_data(WOLFSSL_X509_STORE_CTX* ctx, + int idx, void *data); +#ifdef HAVE_EX_DATA_CLEANUP_HOOKS +WOLFSSL_API int wolfSSL_X509_STORE_CTX_set_ex_data_with_cleanup( + WOLFSSL_X509_STORE_CTX* ctx, + int idx, + void *data, + wolfSSL_ex_data_cleanup_routine_t cleanup_routine); +#endif +WOLFSSL_API void* wolfSSL_X509_STORE_get_ex_data( + WOLFSSL_X509_STORE* store, int idx); +WOLFSSL_API int wolfSSL_X509_STORE_set_ex_data(WOLFSSL_X509_STORE* store, + int idx, void *data); +#ifdef HAVE_EX_DATA_CLEANUP_HOOKS +WOLFSSL_API int wolfSSL_X509_STORE_set_ex_data_with_cleanup( + WOLFSSL_X509_STORE* store, + int idx, + void *data, + wolfSSL_ex_data_cleanup_routine_t cleanup_routine); +#endif +WOLFSSL_API void wolfSSL_X509_STORE_CTX_set_depth(WOLFSSL_X509_STORE_CTX* ctx, + int depth); +WOLFSSL_API WOLFSSL_X509* wolfSSL_X509_STORE_CTX_get0_current_issuer( + WOLFSSL_X509_STORE_CTX* ctx); +WOLFSSL_API WOLFSSL_X509_STORE* wolfSSL_X509_STORE_CTX_get0_store( + WOLFSSL_X509_STORE_CTX* ctx); +WOLFSSL_API WOLFSSL_X509* wolfSSL_X509_STORE_CTX_get0_cert( + WOLFSSL_X509_STORE_CTX* ctx); +WOLFSSL_API int wolfSSL_get_ex_data_X509_STORE_CTX_idx(void); +WOLFSSL_API void wolfSSL_X509_STORE_CTX_set_error( + WOLFSSL_X509_STORE_CTX* ctx, int er); +void wolfSSL_X509_STORE_CTX_set_error_depth(WOLFSSL_X509_STORE_CTX* ctx, + int depth); + +WOLFSSL_API void wolfSSL_CTX_set_info_callback(WOLFSSL_CTX* ctx, + void (*f)(const WOLFSSL* ssl, int type, int val)); +WOLFSSL_API void wolfSSL_set_info_callback(WOLFSSL* ssl, + void (*f)(const WOLFSSL* ssl, int type, int val)); + +WOLFSSL_API unsigned long wolfSSL_ERR_peek_error(void); +WOLFSSL_API int wolfSSL_GET_REASON(int); + +WOLFSSL_API const char* wolfSSL_alert_type_string_long(int alertID); +WOLFSSL_API const char* wolfSSL_alert_desc_string_long(int alertID); +WOLFSSL_API const char* wolfSSL_state_string_long(const WOLFSSL* ssl); + +WOLFSSL_API WOLFSSL_RSA* wolfSSL_RSA_generate_key(int len, unsigned long e, + void(*f)(int, int, void*), void* data); +WOLFSSL_API WOLFSSL_RSA *wolfSSL_d2i_RSAPublicKey(WOLFSSL_RSA **r, + const unsigned char **pp, long len); +WOLFSSL_API WOLFSSL_RSA *wolfSSL_d2i_RSAPrivateKey(WOLFSSL_RSA** r, + const unsigned char** derBuf, long derSz); +WOLFSSL_API int wolfSSL_i2d_RSAPublicKey(WOLFSSL_RSA *r, unsigned char **pp); +WOLFSSL_API int wolfSSL_i2d_RSAPrivateKey(WOLFSSL_RSA *r, unsigned char **pp); +WOLFSSL_API void wolfSSL_CTX_set_tmp_rsa_callback(WOLFSSL_CTX* ctx, + WOLFSSL_RSA *(*f)(WOLFSSL *, int, int)); + +WOLFSSL_API int wolfSSL_PEM_def_callback(char* name, int num, int w, void* key); + +WOLFSSL_API long wolfSSL_CTX_sess_accept(WOLFSSL_CTX* ctx); +WOLFSSL_API long wolfSSL_CTX_sess_connect(WOLFSSL_CTX* ctx); +WOLFSSL_API long wolfSSL_CTX_sess_accept_good(WOLFSSL_CTX* ctx); +WOLFSSL_API long wolfSSL_CTX_sess_connect_good(WOLFSSL_CTX* ctx); +WOLFSSL_API long wolfSSL_CTX_sess_accept_renegotiate(WOLFSSL_CTX* ctx); +WOLFSSL_API long wolfSSL_CTX_sess_connect_renegotiate(WOLFSSL_CTX* ctx); +WOLFSSL_API long wolfSSL_CTX_sess_hits(WOLFSSL_CTX* ctx); +WOLFSSL_API long wolfSSL_CTX_sess_cb_hits(WOLFSSL_CTX* ctx); +WOLFSSL_API long wolfSSL_CTX_sess_cache_full(WOLFSSL_CTX* ctx); +WOLFSSL_API long wolfSSL_CTX_sess_misses(WOLFSSL_CTX* ctx); +WOLFSSL_API long wolfSSL_CTX_sess_timeouts(WOLFSSL_CTX* ctx); +WOLFSSL_API long wolfSSL_CTX_sess_number(WOLFSSL_CTX* ctx); + +WOLFSSL_API long wolfSSL_CTX_add_extra_chain_cert(WOLFSSL_CTX* ctx, WOLFSSL_X509* x509); +WOLFSSL_API long wolfSSL_CTX_sess_set_cache_size(WOLFSSL_CTX* ctx, long sz); +WOLFSSL_API long wolfSSL_CTX_sess_get_cache_size(WOLFSSL_CTX* ctx); + +WOLFSSL_API long wolfSSL_CTX_get_session_cache_mode(WOLFSSL_CTX* ctx); +WOLFSSL_API int wolfSSL_get_read_ahead(const WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_set_read_ahead(WOLFSSL* ssl, int v); +WOLFSSL_API int wolfSSL_CTX_get_read_ahead(WOLFSSL_CTX* ctx); +WOLFSSL_API int wolfSSL_CTX_set_read_ahead(WOLFSSL_CTX* ctx, int v); +WOLFSSL_API long wolfSSL_CTX_set_tlsext_status_arg(WOLFSSL_CTX* ctx, void* arg); +WOLFSSL_API long wolfSSL_CTX_set_tlsext_opaque_prf_input_callback_arg( + WOLFSSL_CTX* ctx, void* arg); +WOLFSSL_API int wolfSSL_CTX_add_client_CA(WOLFSSL_CTX* ctx, WOLFSSL_X509* x509); +WOLFSSL_API int wolfSSL_CTX_set_srp_password(WOLFSSL_CTX* ctx, char* password); +WOLFSSL_API int wolfSSL_CTX_set_srp_username(WOLFSSL_CTX* ctx, char* username); +WOLFSSL_API int wolfSSL_CTX_set_srp_strength(WOLFSSL_CTX *ctx, int strength); + +WOLFSSL_API char* wolfSSL_get_srp_username(WOLFSSL *ssl); + +WOLFSSL_API long wolfSSL_clear_options(WOLFSSL *s, long op); +WOLFSSL_API long wolfSSL_set_tmp_dh(WOLFSSL *s, WOLFSSL_DH *dh); +WOLFSSL_API long wolfSSL_set_tlsext_debug_arg(WOLFSSL *s, void *arg); +WOLFSSL_API long wolfSSL_set_tlsext_status_type(WOLFSSL *s, int type); +WOLFSSL_API long wolfSSL_get_tlsext_status_type(WOLFSSL *s); +WOLFSSL_API long wolfSSL_set_tlsext_status_exts(WOLFSSL *s, void *arg); +WOLFSSL_API long wolfSSL_get_tlsext_status_ids(WOLFSSL *s, void *arg); +WOLFSSL_API long wolfSSL_set_tlsext_status_ids(WOLFSSL *s, void *arg); +WOLFSSL_API long wolfSSL_get_tlsext_status_ocsp_resp(WOLFSSL *s, unsigned char **resp); +WOLFSSL_API long wolfSSL_set_tlsext_status_ocsp_resp(WOLFSSL *s, unsigned char *resp, int len); +WOLFSSL_API int wolfSSL_set_tlsext_max_fragment_length + (WOLFSSL *s, unsigned char mode); +WOLFSSL_API int wolfSSL_CTX_set_tlsext_max_fragment_length + (WOLFSSL_CTX *c, unsigned char mode); +WOLFSSL_API void wolfSSL_CONF_modules_unload(int all); +WOLFSSL_API char* wolfSSL_CONF_get1_default_config_file(void); +WOLFSSL_API long wolfSSL_get_tlsext_status_exts(WOLFSSL *s, void *arg); +WOLFSSL_API long wolfSSL_get_verify_result(const WOLFSSL *ssl); + +WOLFSSL_API void* wolfSSL_get_app_data( const WOLFSSL *ssl); +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) || \ + defined(HAVE_WEBSERVER) || defined(HAVE_MEMCACHED) + + /* Errors used in wolfSSL. utilize the values from the defines in + * wolfssl/openssl/x509.h, but without the WOLFSSL_ prefix. + */ +enum { + WOLFSSL_X509_V_OK = 0, + WOLFSSL_X509_V_ERR_CERT_SIGNATURE_FAILURE = 7, + WOLFSSL_X509_V_ERR_CERT_NOT_YET_VALID = 9, + WOLFSSL_X509_V_ERR_CERT_HAS_EXPIRED = 10, + WOLFSSL_X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD = 13, + WOLFSSL_X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD = 14, + WOLFSSL_X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT = 18, + WOLFSSL_X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY = 20, + WOLFSSL_X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE = 21, + WOLFSSL_X509_V_ERR_CERT_CHAIN_TOO_LONG = 22, + WOLFSSL_X509_V_ERR_CERT_REVOKED = 23, + WOLFSSL_X509_V_ERR_INVALID_CA = 24, + WOLFSSL_X509_V_ERR_PATH_LENGTH_EXCEEDED = 25, + WOLFSSL_X509_V_ERR_CERT_REJECTED = 28, + WOLFSSL_X509_V_ERR_SUBJECT_ISSUER_MISMATCH = 29, + +#ifdef HAVE_OCSP + /* OCSP Flags */ + WOLFSSL_OCSP_NOCERTS = 1, + WOLFSSL_OCSP_NOINTERN = 2, + WOLFSSL_OCSP_NOSIGS = 4, + WOLFSSL_OCSP_NOCHAIN = 8, + WOLFSSL_OCSP_NOVERIFY = 16, + WOLFSSL_OCSP_NOEXPLICIT = 32, + WOLFSSL_OCSP_NOCASIGN = 64, + WOLFSSL_OCSP_NODELEGATED = 128, + WOLFSSL_OCSP_NOCHECKS = 256, + WOLFSSL_OCSP_TRUSTOTHER = 512, + WOLFSSL_OCSP_RESPID_KEY = 1024, + WOLFSSL_OCSP_NOTIME = 2048, +#endif + + WOLFSSL_ST_CONNECT = 0x1000, + WOLFSSL_ST_ACCEPT = 0x2000, + WOLFSSL_ST_MASK = 0x0FFF, + + WOLFSSL_CB_LOOP = 0x01, + WOLFSSL_CB_EXIT = 0x02, + WOLFSSL_CB_READ = 0x04, + WOLFSSL_CB_WRITE = 0x08, + WOLFSSL_CB_HANDSHAKE_START = 0x10, + WOLFSSL_CB_HANDSHAKE_DONE = 0x20, + WOLFSSL_CB_ALERT = 0x4000, + WOLFSSL_CB_READ_ALERT = (WOLFSSL_CB_ALERT | WOLFSSL_CB_READ), + WOLFSSL_CB_WRITE_ALERT = (WOLFSSL_CB_ALERT | WOLFSSL_CB_WRITE), + WOLFSSL_CB_ACCEPT_LOOP = (WOLFSSL_ST_ACCEPT | WOLFSSL_CB_LOOP), + WOLFSSL_CB_ACCEPT_EXIT = (WOLFSSL_ST_ACCEPT | WOLFSSL_CB_EXIT), + WOLFSSL_CB_CONNECT_LOOP = (WOLFSSL_ST_CONNECT | WOLFSSL_CB_LOOP), + WOLFSSL_CB_CONNECT_EXIT = (WOLFSSL_ST_CONNECT | WOLFSSL_CB_EXIT), + WOLFSSL_CB_MODE_READ = 1, + WOLFSSL_CB_MODE_WRITE = 2, + + WOLFSSL_MODE_ENABLE_PARTIAL_WRITE = 2, + WOLFSSL_MODE_AUTO_RETRY = 3, /* wolfSSL default is to return WANT_{READ|WRITE} + * to the user. This is set by default with + * OPENWOLFSSL_COMPATIBLE_DEFAULTS. The macro + * WOLFWOLFSSL_MODE_AUTO_RETRY_ATTEMPTS is used to + * limit the possibility of an infinite retry loop + */ + WOLFSSL_MODE_RELEASE_BUFFERS = -1, /* For libwebsockets build. No current use. */ + + WOLFSSL_CRYPTO_LOCK = 1, + WOLFSSL_CRYPTO_NUM_LOCKS = 10 +}; + +#define WOLFSSL_NOTHING 1 +#define WOLFSSL_WRITING 2 +#define WOLFSSL_READING 3 +#define WOLFSSL_MAX_SSL_SESSION_ID_LENGTH 32 /* = ID_LEN */ + +#ifndef OPENSSL_COEXIST + +/* for compatibility these must be macros */ + +#define SSL_OP_MICROSOFT_SESS_ID_BUG WOLFSSL_OP_MICROSOFT_SESS_ID_BUG +#define SSL_OP_NETSCAPE_CHALLENGE_BUG WOLFSSL_OP_NETSCAPE_CHALLENGE_BUG +#define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG WOLFSSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG +#define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG WOLFSSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG +#define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER WOLFSSL_OP_MICROSOFT_BIG_SSLV3_BUFFER +#define SSL_OP_MSIE_SSLV2_RSA_PADDING WOLFSSL_OP_MSIE_SSLV2_RSA_PADDING +#define SSL_OP_SSLEAY_080_CLIENT_DH_BUG WOLFSSL_OP_SSLEAY_080_CLIENT_DH_BUG +#define SSL_OP_TLS_D5_BUG WOLFSSL_OP_TLS_D5_BUG +#define SSL_OP_TLS_BLOCK_PADDING_BUG WOLFSSL_OP_TLS_BLOCK_PADDING_BUG +#define SSL_OP_TLS_ROLLBACK_BUG WOLFSSL_OP_TLS_ROLLBACK_BUG +#define SSL_OP_EPHEMERAL_RSA WOLFSSL_OP_EPHEMERAL_RSA +#define SSL_OP_PKCS1_CHECK_1 WOLFSSL_OP_PKCS1_CHECK_1 +#define SSL_OP_PKCS1_CHECK_2 WOLFSSL_OP_PKCS1_CHECK_2 +#define SSL_OP_NETSCAPE_CA_DN_BUG WOLFSSL_OP_NETSCAPE_CA_DN_BUG +#define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG WOLFSSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG +#define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS WOLFSSL_OP_DONT_INSERT_EMPTY_FRAGMENTS +#define SSL_OP_NO_QUERY_MTU WOLFSSL_OP_NO_QUERY_MTU +#define SSL_OP_COOKIE_EXCHANGE WOLFSSL_OP_COOKIE_EXCHANGE +#define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION \ + WOLFSSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION +#define SSL_OP_ALL WOLFSSL_OP_ALL + +#define SSL_OP_NO_SSLv2 WOLFSSL_OP_NO_SSLv2 +#define SSL_OP_NO_SSLv3 WOLFSSL_OP_NO_SSLv3 +#define SSL_OP_NO_TLSv1 WOLFSSL_OP_NO_TLSv1 +#define SSL_OP_NO_TLSv1_1 WOLFSSL_OP_NO_TLSv1_1 +#define SSL_OP_NO_TLSv1_2 WOLFSSL_OP_NO_TLSv1_2 +#define SSL_OP_NO_COMPRESSION WOLFSSL_OP_NO_COMPRESSION + +/* apache uses SSL_OP_NO_TLSv1_3 to determine if TLS 1.3 is enabled */ +#if !(!defined(WOLFSSL_TLS13) && defined(WOLFSSL_APACHE_HTTPD)) +#define SSL_OP_NO_TLSv1_3 WOLFSSL_OP_NO_TLSv1_3 +#endif + +#ifdef HAVE_SESSION_TICKET +#define SSL_OP_NO_TICKET WOLFSSL_OP_NO_TICKET +#endif + +#define SSL_OP_NO_SSL_MASK (SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | \ + SSL_OP_NO_TLSv1_1 | SSL_OP_NO_TLSv1_2 | SSL_OP_NO_TLSv1_3) + + +#define SSL_NOTHING WOLFSSL_NOTHING +#define SSL_WRITING WOLFSSL_WRITING +#define SSL_READING WOLFSSL_READING +#define SSL_MAX_SSL_SESSION_ID_LENGTH WOLFSSL_MAX_SSL_SESSION_ID_LENGTH +#define SSL_MAX_SID_CTX_LENGTH WOLFSSL_MAX_SSL_SESSION_ID_LENGTH + +#ifdef HAVE_OCSP + /* OCSP Flags */ +#define OCSP_NOCERTS WOLFSSL_OCSP_NOCERTS +#define OCSP_NOINTERN WOLFSSL_OCSP_NOINTERN +#define OCSP_NOSIGS WOLFSSL_OCSP_NOSIGS +#define OCSP_NOCHAIN WOLFSSL_OCSP_NOCHAIN +#define OCSP_NOVERIFY WOLFSSL_OCSP_NOVERIFY +#define OCSP_NOEXPLICIT WOLFSSL_OCSP_NOEXPLICIT +#define OCSP_NOCASIGN WOLFSSL_OCSP_NOCASIGN +#define OCSP_NODELEGATED WOLFSSL_OCSP_NODELEGATED +#define OCSP_NOCHECKS WOLFSSL_OCSP_NOCHECKS +#define OCSP_TRUSTOTHER WOLFSSL_OCSP_TRUSTOTHER +#define OCSP_RESPID_KEY WOLFSSL_OCSP_RESPID_KEY +#define OCSP_NOTIME WOLFSSL_OCSP_NOTIME +#endif + +#define SSL_ST_CONNECT WOLFSSL_ST_CONNECT +#define SSL_ST_ACCEPT WOLFSSL_ST_ACCEPT +#define SSL_ST_MASK WOLFSSL_ST_MASK + +#define SSL_CB_LOOP WOLFSSL_CB_LOOP +#define SSL_CB_EXIT WOLFSSL_CB_EXIT +#define SSL_CB_READ WOLFSSL_CB_READ +#define SSL_CB_WRITE WOLFSSL_CB_WRITE +#define SSL_CB_HANDSHAKE_START WOLFSSL_CB_HANDSHAKE_START +#define SSL_CB_HANDSHAKE_DONE WOLFSSL_CB_HANDSHAKE_DONE +#define SSL_CB_ALERT WOLFSSL_CB_ALERT +#define SSL_CB_READ_ALERT WOLFSSL_CB_READ_ALERT +#define SSL_CB_WRITE_ALERT WOLFSSL_CB_WRITE_ALERT +#define SSL_CB_ACCEPT_LOOP WOLFSSL_CB_ACCEPT_LOOP +#define SSL_CB_ACCEPT_EXIT WOLFSSL_CB_ACCEPT_EXIT +#define SSL_CB_CONNECT_LOOP WOLFSSL_CB_CONNECT_LOOP +#define SSL_CB_CONNECT_EXIT WOLFSSL_CB_CONNECT_EXIT +#define SSL_CB_MODE_READ WOLFSSL_CB_MODE_READ +#define SSL_CB_MODE_WRITE WOLFSSL_CB_MODE_WRITE + +#define SSL_MODE_ENABLE_PARTIAL_WRITE WOLFSSL_MODE_ENABLE_PARTIAL_WRITE +#define SSL_MODE_AUTO_RETRY WOLFSSL_MODE_AUTO_RETRY +#define SSL_MODE_RELEASE_BUFFERS WOLFSSL_MODE_RELEASE_BUFFERS + +#define CRYPTO_LOCK WOLFSSL_CRYPTO_LOCK +#define CRYPTO_NUM_LOCKS WOLFSSL_CRYPTO_NUM_LOCKS + +#endif /* !OPENSSL_COEXIST */ + +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL || HAVE_WEBSERVER || HAVE_MEMCACHED */ +/* -------- EXTRAS END -------- */ + + +#define WOLFSSL_DEFAULT_CIPHER_LIST "" /* default all */ + +/* These are bit-masks */ +enum { + WOLFSSL_OCSP_URL_OVERRIDE = 1, + WOLFSSL_OCSP_NO_NONCE = 2, + WOLFSSL_OCSP_CHECKALL = 4, + + WOLFSSL_CRL_CHECKALL = 1, + WOLFSSL_CRL_CHECK = 2 +}; + +/* Separated out from other enums because of size */ +enum { + WOLFSSL_OP_MICROSOFT_SESS_ID_BUG = 0x00000001, + WOLFSSL_OP_NETSCAPE_CHALLENGE_BUG = 0x00000002, + WOLFSSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG = 0x00000004, + WOLFSSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG = 0x00000008, + WOLFSSL_OP_MICROSOFT_BIG_SSLV3_BUFFER = 0x00000010, + WOLFSSL_OP_MSIE_SSLV2_RSA_PADDING = 0x00000020, + WOLFSSL_OP_SSLEAY_080_CLIENT_DH_BUG = 0x00000040, + WOLFSSL_OP_TLS_D5_BUG = 0x00000080, + WOLFSSL_OP_TLS_BLOCK_PADDING_BUG = 0x00000100, + WOLFSSL_OP_TLS_ROLLBACK_BUG = 0x00000200, + WOLFSSL_OP_NO_RENEGOTIATION = 0x00000400, + WOLFSSL_OP_EPHEMERAL_RSA = 0x00000800, + WOLFSSL_OP_NO_SSLv3 = 0x00001000, + WOLFSSL_OP_NO_TLSv1 = 0x00002000, + WOLFSSL_OP_PKCS1_CHECK_1 = 0x00004000, + WOLFSSL_OP_PKCS1_CHECK_2 = 0x00008000, + WOLFSSL_OP_NETSCAPE_CA_DN_BUG = 0x00010000, + WOLFSSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG = 0x00020000, + WOLFSSL_OP_SINGLE_DH_USE = 0x00040000, + WOLFSSL_OP_NO_TICKET = 0x00080000, + WOLFSSL_OP_DONT_INSERT_EMPTY_FRAGMENTS = 0x00100000, + WOLFSSL_OP_NO_QUERY_MTU = 0x00200000, + WOLFSSL_OP_COOKIE_EXCHANGE = 0x00400000, + WOLFSSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION = 0x00800000, + WOLFSSL_OP_SINGLE_ECDH_USE = 0x01000000, + WOLFSSL_OP_CIPHER_SERVER_PREFERENCE = 0x02000000, + WOLFSSL_OP_NO_TLSv1_1 = 0x04000000, + WOLFSSL_OP_NO_TLSv1_2 = 0x08000000, + WOLFSSL_OP_NO_COMPRESSION = 0x10000000, + WOLFSSL_OP_NO_TLSv1_3 = 0x20000000, + WOLFSSL_OP_NO_SSLv2 = 0x40000000, + WOLFSSL_OP_ALL = + (WOLFSSL_OP_MICROSOFT_SESS_ID_BUG + | WOLFSSL_OP_NETSCAPE_CHALLENGE_BUG + | WOLFSSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG + | WOLFSSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG + | WOLFSSL_OP_MICROSOFT_BIG_SSLV3_BUFFER + | WOLFSSL_OP_MSIE_SSLV2_RSA_PADDING + | WOLFSSL_OP_SSLEAY_080_CLIENT_DH_BUG + | WOLFSSL_OP_TLS_D5_BUG + | WOLFSSL_OP_TLS_BLOCK_PADDING_BUG + | WOLFSSL_OP_DONT_INSERT_EMPTY_FRAGMENTS + | WOLFSSL_OP_TLS_ROLLBACK_BUG) +}; + +WOLFSSL_API void wolfSSL_CTX_set_default_passwd_cb_userdata(WOLFSSL_CTX* ctx, + void* userdata); +WOLFSSL_API void wolfSSL_CTX_set_default_passwd_cb(WOLFSSL_CTX* ctx, + wc_pem_password_cb* cb); +WOLFSSL_API wc_pem_password_cb* wolfSSL_CTX_get_default_passwd_cb(WOLFSSL_CTX* ctx); +WOLFSSL_API void *wolfSSL_CTX_get_default_passwd_cb_userdata(WOLFSSL_CTX *ctx); + +WOLFSSL_API int wolfSSL_SSL_renegotiate_pending(WOLFSSL *s); +WOLFSSL_API long wolfSSL_total_renegotiations(WOLFSSL *s); +WOLFSSL_API long wolfSSL_num_renegotiations(WOLFSSL* s); +WOLFSSL_API long wolfSSL_clear_num_renegotiations(WOLFSSL *s); +WOLFSSL_API int wolfSSL_get_alert_history(WOLFSSL* ssl, WOLFSSL_ALERT_HISTORY *h); +WOLFSSL_API int wolfSSL_get_shutdown(const WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_set_rfd(WOLFSSL* ssl, int rfd); +WOLFSSL_API int wolfSSL_set_wfd(WOLFSSL* ssl, int wfd); +WOLFSSL_API void wolfSSL_set_shutdown(WOLFSSL* ssl, int opt); +WOLFSSL_API int wolfSSL_set_session_id_context(WOLFSSL* ssl, const unsigned char* id, + unsigned int len); +WOLFSSL_API void wolfSSL_set_connect_state(WOLFSSL* ssl); +WOLFSSL_API void wolfSSL_set_accept_state(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_session_reused(WOLFSSL* ssl); +#ifdef OPENSSL_EXTRA +/* using unsigned char instead of uint8_t here to avoid stdint include */ +WOLFSSL_API unsigned char wolfSSL_SESSION_get_max_fragment_length( + WOLFSSL_SESSION* session); +#endif +WOLFSSL_API int wolfSSL_SESSION_up_ref(WOLFSSL_SESSION* session); + +WOLFSSL_API WOLFSSL_SESSION* wolfSSL_SESSION_dup(WOLFSSL_SESSION* session); +WOLFSSL_API WOLFSSL_SESSION* wolfSSL_SESSION_new(void); +WOLFSSL_API WOLFSSL_SESSION* wolfSSL_SESSION_new_ex(void* heap); +WOLFSSL_API void wolfSSL_SESSION_free(WOLFSSL_SESSION* session); +WOLFSSL_API int wolfSSL_CTX_add_session(WOLFSSL_CTX* ctx, + WOLFSSL_SESSION* session); +WOLFSSL_API int wolfSSL_SESSION_set_cipher(WOLFSSL_SESSION* session, + const WOLFSSL_CIPHER* cipher); +WOLFSSL_API int wolfSSL_is_init_finished(const WOLFSSL* ssl); + +WOLFSSL_API const char* wolfSSL_get_version(const WOLFSSL* ssl); +#ifdef OPENSSL_EXTRA +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_CIPHER)* wolfSSL_get_client_ciphers( + WOLFSSL* ssl); +#endif +WOLFSSL_API int wolfSSL_get_current_cipher_suite(WOLFSSL* ssl); +WOLFSSL_API WOLFSSL_CIPHER* wolfSSL_get_current_cipher(WOLFSSL* ssl); +WOLFSSL_API char* wolfSSL_CIPHER_description(const WOLFSSL_CIPHER* cipher, char* in, int len); +WOLFSSL_API const char* wolfSSL_CIPHER_get_name(const WOLFSSL_CIPHER* cipher); +WOLFSSL_API const char* wolfSSL_CIPHER_get_version(const WOLFSSL_CIPHER* cipher); +WOLFSSL_API word32 wolfSSL_CIPHER_get_id(const WOLFSSL_CIPHER* cipher); +WOLFSSL_API int wolfSSL_CIPHER_get_auth_nid(const WOLFSSL_CIPHER* cipher); +WOLFSSL_API int wolfSSL_CIPHER_get_cipher_nid(const WOLFSSL_CIPHER* cipher); +WOLFSSL_API int wolfSSL_CIPHER_get_digest_nid(const WOLFSSL_CIPHER* cipher); +WOLFSSL_API int wolfSSL_CIPHER_get_kx_nid(const WOLFSSL_CIPHER* cipher); +WOLFSSL_API int wolfSSL_CIPHER_is_aead(const WOLFSSL_CIPHER* cipher); +WOLFSSL_API const WOLFSSL_CIPHER* wolfSSL_get_cipher_by_value(word16 value); +WOLFSSL_API const char* wolfSSL_SESSION_CIPHER_get_name(const WOLFSSL_SESSION* session); +WOLFSSL_API const char* wolfSSL_get_cipher(WOLFSSL* ssl); +WOLFSSL_API void wolfSSL_sk_CIPHER_free(WOLF_STACK_OF(WOLFSSL_CIPHER)* sk); +WOLFSSL_API WOLFSSL_SESSION* wolfSSL_get1_session(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_SessionIsSetup(WOLFSSL_SESSION* session); + +WOLFSSL_API WOLFSSL_X509_STORE_CTX* wolfSSL_X509_STORE_CTX_new(void); +WOLFSSL_API WOLFSSL_X509_STORE_CTX* wolfSSL_X509_STORE_CTX_new_ex(void* heap); +WOLFSSL_API void wolfSSL_X509_STORE_CTX_free(WOLFSSL_X509_STORE_CTX* ctx); + +WOLFSSL_API long wolfSSL_set_options(WOLFSSL *s, long op); +WOLFSSL_API long wolfSSL_get_options(const WOLFSSL *s); + +WOLFSSL_ABI WOLFSSL_API char* wolfSSL_X509_NAME_oneline(WOLFSSL_X509_NAME* name, + char* in, int sz); + +#if !defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM) +/* wolfSSL extension, provide last error from SSL_get_error + since not using thread storage error queue */ +#ifdef FUSION_RTOS + #include <fclstdio.h> +#else + #include <stdio.h> +#endif +WOLFSSL_API void wolfSSL_ERR_print_errors_fp(XFILE fp, int err); +#if defined(OPENSSL_EXTRA) || defined(DEBUG_WOLFSSL_VERBOSE) +WOLFSSL_API void wolfSSL_ERR_dump_errors_fp(XFILE fp); +WOLFSSL_API void wolfSSL_ERR_print_errors_cb(int (*cb)(const char *str, + size_t len, void *u), void *u); +#endif +#endif + +#ifndef NO_OLD_SSL_NAMES + #define SSL_ERROR_NONE WOLFSSL_ERROR_NONE + #define SSL_FAILURE WOLFSSL_FAILURE + #define SSL_SUCCESS WOLFSSL_SUCCESS + #define SSL_SHUTDOWN_NOT_DONE WOLFSSL_SHUTDOWN_NOT_DONE + + #define SSL_ALPN_NOT_FOUND WOLFSSL_ALPN_NOT_FOUND + #define SSL_BAD_CERTTYPE WOLFSSL_BAD_CERTTYPE + #define SSL_BAD_STAT WOLFSSL_BAD_STAT + #define SSL_BAD_PATH WOLFSSL_BAD_PATH + #define SSL_BAD_FILETYPE WOLFSSL_BAD_FILETYPE + #define SSL_BAD_FILE WOLFSSL_BAD_FILE + #define SSL_NOT_IMPLEMENTED WOLFSSL_NOT_IMPLEMENTED + #define SSL_UNKNOWN WOLFSSL_UNKNOWN + #define SSL_FATAL_ERROR WOLFSSL_FATAL_ERROR + + #define SSL_FILETYPE_ASN1 WOLFSSL_FILETYPE_ASN1 + #define SSL_FILETYPE_PEM WOLFSSL_FILETYPE_PEM + #define SSL_FILETYPE_DEFAULT WOLFSSL_FILETYPE_DEFAULT + + #define SSL_VERIFY_NONE WOLFSSL_VERIFY_NONE + #define SSL_VERIFY_PEER WOLFSSL_VERIFY_PEER + #define SSL_VERIFY_FAIL_IF_NO_PEER_CERT WOLFSSL_VERIFY_FAIL_IF_NO_PEER_CERT + #define SSL_VERIFY_CLIENT_ONCE WOLFSSL_VERIFY_CLIENT_ONCE + #define SSL_VERIFY_POST_HANDSHAKE WOLFSSL_VERIFY_POST_HANDSHAKE + #define SSL_VERIFY_FAIL_EXCEPT_PSK WOLFSSL_VERIFY_FAIL_EXCEPT_PSK + + #define SSL_SESS_CACHE_OFF WOLFSSL_SESS_CACHE_OFF + #define SSL_SESS_CACHE_CLIENT WOLFSSL_SESS_CACHE_CLIENT + #define SSL_SESS_CACHE_SERVER WOLFSSL_SESS_CACHE_SERVER + #define SSL_SESS_CACHE_BOTH WOLFSSL_SESS_CACHE_BOTH + #define SSL_SESS_CACHE_NO_AUTO_CLEAR WOLFSSL_SESS_CACHE_NO_AUTO_CLEAR + #define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP WOLFSSL_SESS_CACHE_NO_INTERNAL_LOOKUP + #define SSL_SESS_CACHE_NO_INTERNAL_STORE WOLFSSL_SESS_CACHE_NO_INTERNAL_STORE + #define SSL_SESS_CACHE_NO_INTERNAL WOLFSSL_SESS_CACHE_NO_INTERNAL + + #define SSL_ERROR_WANT_READ WOLFSSL_ERROR_WANT_READ + #define SSL_ERROR_WANT_WRITE WOLFSSL_ERROR_WANT_WRITE + #define SSL_ERROR_WANT_CONNECT WOLFSSL_ERROR_WANT_CONNECT + #define SSL_ERROR_WANT_ACCEPT WOLFSSL_ERROR_WANT_ACCEPT + #define SSL_ERROR_SYSCALL WOLFSSL_ERROR_SYSCALL + #define SSL_ERROR_WANT_X509_LOOKUP WOLFSSL_ERROR_WANT_X509_LOOKUP + #define SSL_ERROR_ZERO_RETURN WOLFSSL_ERROR_ZERO_RETURN + #define SSL_ERROR_SSL WOLFSSL_ERROR_SSL + + #define SSL_SENT_SHUTDOWN WOLFSSL_SENT_SHUTDOWN + #define SSL_RECEIVED_SHUTDOWN WOLFSSL_RECEIVED_SHUTDOWN + #define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER WOLFSSL_MODE_ACCEPT_MOVING_WRITE_BUFFER + + #define SSL_R_SSL_HANDSHAKE_FAILURE WOLFSSL_R_SSL_HANDSHAKE_FAILURE + #define SSL_R_TLSV1_ALERT_UNKNOWN_CA WOLFSSL_R_TLSV1_ALERT_UNKNOWN_CA + #define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN WOLFSSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN + #define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE WOLFSSL_R_SSLV3_ALERT_BAD_CERTIFICATE +#endif + +enum { /* ssl Constants */ + WOLFSSL_ERROR_NONE = 0, /* for most functions */ + WOLFSSL_FAILURE = 0, /* for some functions */ + WOLFSSL_SUCCESS = 1, + + #if defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES) && \ + (defined(BUILDING_WOLFSSL) || \ + defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES_ALWAYS)) + #define WOLFSSL_FAILURE WC_ERR_TRACE(WOLFSSL_FAILURE) + #define CONST_NUM_ERR_WOLFSSL_FAILURE 0 + /* include CONST_NUM_ERR_ variants of the success codes, so that they + * can be harmlessly wrapped in WC_NO_ERR_TRACE(). + */ + #define CONST_NUM_ERR_WOLFSSL_ERROR_NONE 0 + #define CONST_NUM_ERR_WOLFSSL_SUCCESS 1 + #endif + +/* WOLFSSL_SHUTDOWN_NOT_DONE is returned by wolfSSL_shutdown and + * wolfSSL_SendUserCanceled when the other end + * of the connection has yet to send its close notify alert as part of the + * bidirectional shutdown. To complete the shutdown, either keep calling + * wolfSSL_shutdown until it returns WOLFSSL_SUCCESS or call wolfSSL_read until + * it returns <= 0 AND SSL_get_error returns SSL_ERROR_ZERO_RETURN. See OpenSSL + * docs for more: https://www.openssl.org/docs/man1.1.1/man3/SSL_shutdown.html + */ +#ifdef WOLFSSL_ERROR_CODE_OPENSSL +/* SSL_shutdown returns 0 when not done, per OpenSSL documentation. */ + WOLFSSL_SHUTDOWN_NOT_DONE = 0, +#else + WOLFSSL_SHUTDOWN_NOT_DONE = 2, +#endif + + WOLFSSL_FILETYPE_ASN1 = CTC_FILETYPE_ASN1, + WOLFSSL_FILETYPE_PEM = CTC_FILETYPE_PEM, + WOLFSSL_FILETYPE_DEFAULT = CTC_FILETYPE_ASN1, /* ASN1 */ + + WOLFSSL_VERIFY_NONE = 0, + WOLFSSL_VERIFY_PEER = 1 << 0, + WOLFSSL_VERIFY_FAIL_IF_NO_PEER_CERT = 1 << 1, + WOLFSSL_VERIFY_CLIENT_ONCE = 1 << 2, + WOLFSSL_VERIFY_POST_HANDSHAKE = 1 << 3, + WOLFSSL_VERIFY_FAIL_EXCEPT_PSK = 1 << 4, + WOLFSSL_VERIFY_DEFAULT = 1 << 9, + + WOLFSSL_SESS_CACHE_OFF = 0x0000, + WOLFSSL_SESS_CACHE_CLIENT = 0x0001, + WOLFSSL_SESS_CACHE_SERVER = 0x0002, + WOLFSSL_SESS_CACHE_BOTH = 0x0003, + WOLFSSL_SESS_CACHE_NO_AUTO_CLEAR = 0x0008, + WOLFSSL_SESS_CACHE_NO_INTERNAL_LOOKUP = 0x0100, + WOLFSSL_SESS_CACHE_NO_INTERNAL_STORE = 0x0200, + WOLFSSL_SESS_CACHE_NO_INTERNAL = + (WOLFSSL_SESS_CACHE_NO_INTERNAL_STORE | + WOLFSSL_SESS_CACHE_NO_INTERNAL_LOOKUP), + + /* These values match OpenSSL values for corresponding names.*/ + WOLFSSL_ERROR_SSL = 1, + + /* Operation did not complete; call this API again.*/ + WOLFSSL_ERROR_WANT_READ = 2, + + /* Operation did not complete; call this API again.*/ + WOLFSSL_ERROR_WANT_WRITE = 3, + + /* Operation did not complete; callback needs this API to be called again.*/ + WOLFSSL_ERROR_WANT_X509_LOOKUP = 4, + + /* Some sort of system I/O error happened.*/ + WOLFSSL_ERROR_SYSCALL = 5, + + /* The connection has been closed with a closure alert.*/ + WOLFSSL_ERROR_ZERO_RETURN = 6, + + /* Underlying protocol connection not started yet, call this API again.*/ + WOLFSSL_ERROR_WANT_CONNECT = 7, + + /* Underlying protocol connection not started yet, call this API again.*/ + WOLFSSL_ERROR_WANT_ACCEPT = 8, + + /* Close notify alert was sent to the peer.*/ + WOLFSSL_SENT_SHUTDOWN = 1, + + /* Close notify or fatal error was received from the peer.*/ + WOLFSSL_RECEIVED_SHUTDOWN = 2, + + /* Let library know that write buffer might move to different addresses.*/ + WOLFSSL_MODE_ACCEPT_MOVING_WRITE_BUFFER = 4, + + /* The handshake failed. */ + WOLFSSL_R_SSL_HANDSHAKE_FAILURE = 101, + + /* The issuer CA certificate is unknown. */ + WOLFSSL_R_TLSV1_ALERT_UNKNOWN_CA = 102, + + /* Unable to validate the certificate. */ + WOLFSSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN = 103, + + /* There was a problem parsing the certificate. */ + WOLFSSL_R_SSLV3_ALERT_BAD_CERTIFICATE = 104, + + WOLF_PEM_BUFSIZE = 1024 +}; + +#ifndef NO_PSK + typedef unsigned int (*wc_psk_client_callback)(WOLFSSL* ssl, const char*, char*, + unsigned int, unsigned char*, unsigned int); + WOLFSSL_API void wolfSSL_CTX_set_psk_client_callback(WOLFSSL_CTX* ctx, + wc_psk_client_callback cb); + WOLFSSL_API void wolfSSL_set_psk_client_callback(WOLFSSL* ssl, + wc_psk_client_callback cb); + #ifdef OPENSSL_EXTRA + typedef int (*wc_psk_use_session_cb_func)(WOLFSSL* ssl, + const WOLFSSL_EVP_MD* md, const unsigned char **id, + size_t* idlen, WOLFSSL_SESSION **sess); + WOLFSSL_API void wolfSSL_set_psk_use_session_callback(WOLFSSL* ssl, + wc_psk_use_session_cb_func cb); + #endif +#ifdef WOLFSSL_TLS13 + typedef unsigned int (*wc_psk_client_cs_callback)(WOLFSSL* ssl, const char*, + char*, unsigned int, unsigned char*, unsigned int, const char*); + WOLFSSL_API void wolfSSL_CTX_set_psk_client_cs_callback(WOLFSSL_CTX* ctx, + wc_psk_client_cs_callback cb); + WOLFSSL_API void wolfSSL_set_psk_client_cs_callback(WOLFSSL* ssl, + wc_psk_client_cs_callback cb); + + typedef unsigned int (*wc_psk_client_tls13_callback)(WOLFSSL* ssl, const char*, + char*, unsigned int, unsigned char*, unsigned int, const char**); + WOLFSSL_API void wolfSSL_CTX_set_psk_client_tls13_callback(WOLFSSL_CTX* ctx, + wc_psk_client_tls13_callback cb); + WOLFSSL_API void wolfSSL_set_psk_client_tls13_callback(WOLFSSL* ssl, + wc_psk_client_tls13_callback cb); +#endif + + WOLFSSL_API const char* wolfSSL_get_psk_identity_hint(const WOLFSSL* ssl); + WOLFSSL_API const char* wolfSSL_get_psk_identity(const WOLFSSL* ssl); + + WOLFSSL_API int wolfSSL_CTX_use_psk_identity_hint(WOLFSSL_CTX* ctx, const char* hint); + WOLFSSL_API int wolfSSL_use_psk_identity_hint(WOLFSSL* ssl, const char* hint); + + typedef unsigned int (*wc_psk_server_callback)(WOLFSSL* ssl, const char*, + unsigned char*, unsigned int); + WOLFSSL_API void wolfSSL_CTX_set_psk_server_callback(WOLFSSL_CTX* ctx, + wc_psk_server_callback cb); + WOLFSSL_API void wolfSSL_set_psk_server_callback(WOLFSSL* ssl, + wc_psk_server_callback cb); +#ifdef WOLFSSL_TLS13 + typedef unsigned int (*wc_psk_server_tls13_callback)(WOLFSSL* ssl, const char*, + unsigned char*, unsigned int, const char**); + WOLFSSL_API void wolfSSL_CTX_set_psk_server_tls13_callback(WOLFSSL_CTX* ctx, + wc_psk_server_tls13_callback cb); + WOLFSSL_API void wolfSSL_set_psk_server_tls13_callback(WOLFSSL* ssl, + wc_psk_server_tls13_callback cb); +#endif + WOLFSSL_API void* wolfSSL_get_psk_callback_ctx(WOLFSSL* ssl); + WOLFSSL_API int wolfSSL_set_psk_callback_ctx(WOLFSSL* ssl, void* psk_ctx); + + WOLFSSL_API void* wolfSSL_CTX_get_psk_callback_ctx(WOLFSSL_CTX* ctx); + WOLFSSL_API int wolfSSL_CTX_set_psk_callback_ctx(WOLFSSL_CTX* ctx, void* psk_ctx); + + #define PSK_TYPES_DEFINED + +#ifdef WOLFSSL_TLS13 + WOLFSSL_API const char* wolfSSL_get_cipher_name_by_hash(WOLFSSL* ssl, + const char* hash); +#endif +#endif /* NO_PSK */ + + +#ifdef HAVE_ANON + WOLFSSL_API int wolfSSL_CTX_allow_anon_cipher(WOLFSSL_CTX* ctx); +#endif /* HAVE_ANON */ + + +/* extra begins */ +#if defined(OPENSSL_EXTRA) || defined(DEBUG_WOLFSSL_VERBOSE) +enum { /* ERR Constants */ + WOLFSSL_ERR_TXT_STRING = 1 +}; +#ifndef OPENSSL_COEXIST +#define ERR_TXT_STRING WOLFSSL_ERR_TXT_STRING +#endif +#endif +#ifdef OPENSSL_EXTRA +/* bio misc */ +enum { + WOLFSSL_BIO_ERROR = -1, + WOLFSSL_BIO_UNSET = -2, + WOLFSSL_BIO_SIZE = 17000 /* default BIO write size if not set */ +}; +#endif + +WOLFSSL_API void wolfSSL_ERR_put_error(int lib, int fun, int err, + const char* file, int line); +WOLFSSL_API unsigned long wolfSSL_ERR_get_error_line(const char** file, int* line); +WOLFSSL_API unsigned long wolfSSL_ERR_get_error_line_data(const char** file, int* line, + const char** data, int* flags); + +WOLFSSL_API unsigned long wolfSSL_ERR_get_error(void); +WOLFSSL_API void wolfSSL_ERR_clear_error(void); + + +WOLFSSL_API int wolfSSL_RAND_status(void); +WOLFSSL_API int wolfSSL_RAND_pseudo_bytes(unsigned char* buf, int num); +WOLFSSL_API int wolfSSL_RAND_bytes(unsigned char* buf, int num); +WOLFSSL_API long wolfSSL_CTX_set_options(WOLFSSL_CTX* ctx, long opt); +WOLFSSL_API long wolfSSL_CTX_get_options(WOLFSSL_CTX* ctx); +WOLFSSL_API long wolfSSL_CTX_clear_options(WOLFSSL_CTX* ctx, long opt); + +#if !defined(NO_CHECK_PRIVATE_KEY) + WOLFSSL_API int wolfSSL_CTX_check_private_key(const WOLFSSL_CTX* ctx); +#endif + +WOLFSSL_API void wolfSSL_ERR_free_strings(void); +WOLFSSL_API void wolfSSL_ERR_remove_state(unsigned long id); +WOLFSSL_API int wolfSSL_clear(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_state(WOLFSSL* ssl); + +WOLFSSL_API void wolfSSL_cleanup_all_ex_data(void); +WOLFSSL_API long wolfSSL_CTX_set_mode(WOLFSSL_CTX* ctx, long mode); +WOLFSSL_API long wolfSSL_CTX_clear_mode(WOLFSSL_CTX* ctx, long mode); +WOLFSSL_API long wolfSSL_CTX_get_mode(WOLFSSL_CTX* ctx); +WOLFSSL_API void wolfSSL_CTX_set_default_read_ahead(WOLFSSL_CTX* ctx, int m); +WOLFSSL_API long wolfSSL_SSL_get_mode(WOLFSSL* ssl); + + +WOLFSSL_API int wolfSSL_CTX_set_default_verify_paths(WOLFSSL_CTX* ctx); +WOLFSSL_API const char* wolfSSL_X509_get_default_cert_file_env(void); +WOLFSSL_API const char* wolfSSL_X509_get_default_cert_file(void); +WOLFSSL_API const char* wolfSSL_X509_get_default_cert_dir_env(void); +WOLFSSL_API const char* wolfSSL_X509_get_default_cert_dir(void); +WOLFSSL_API int wolfSSL_CTX_set_session_id_context(WOLFSSL_CTX* ctx, + const unsigned char* sid_ctx, unsigned int sid_ctx_len); +WOLFSSL_ABI WOLFSSL_API WOLFSSL_X509* wolfSSL_get_peer_certificate(WOLFSSL* ssl); +#ifdef OPENSSL_EXTRA +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509)* wolfSSL_get_peer_cert_chain(const WOLFSSL* ssl); +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509)* wolfSSL_set_peer_cert_chain(WOLFSSL* ssl); +#endif + +WOLFSSL_API int wolfSSL_want_read(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_want_write(WOLFSSL* ssl); + + +#ifdef OPENSSL_EXTRA +WOLFSSL_API int wolfSSL_want(WOLFSSL* ssl); + +WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_CTX_get0_privatekey(const WOLFSSL_CTX* ctx); + +#include <stdarg.h> /* var_arg */ +WOLFSSL_API int wolfSSL_BIO_vprintf(WOLFSSL_BIO* bio, const char* format, + va_list args); +WOLFSSL_API int wolfSSL_BIO_printf(WOLFSSL_BIO* bio, const char* format, ...); + + +WOLFSSL_API int wolfSSL_BIO_dump(WOLFSSL_BIO *bio, const char* buf, int length); +WOLFSSL_API int wolfSSL_ASN1_UTCTIME_print(WOLFSSL_BIO* bio, + const WOLFSSL_ASN1_UTCTIME* a); +WOLFSSL_API int wolfSSL_ASN1_GENERALIZEDTIME_print(WOLFSSL_BIO* bio, + const WOLFSSL_ASN1_GENERALIZEDTIME* asnTime); +WOLFSSL_API void wolfSSL_ASN1_GENERALIZEDTIME_free(WOLFSSL_ASN1_GENERALIZEDTIME*); +WOLFSSL_API int wolfSSL_ASN1_TIME_check(const WOLFSSL_ASN1_TIME* a); +WOLFSSL_API int wolfSSL_ASN1_TIME_diff(int* days, int* secs, const WOLFSSL_ASN1_TIME* from, + const WOLFSSL_ASN1_TIME* to); +WOLFSSL_API int wolfSSL_ASN1_TIME_compare(const WOLFSSL_ASN1_TIME *a, + const WOLFSSL_ASN1_TIME *b); +WOLFSSL_API WOLFSSL_ASN1_TIME *wolfSSL_ASN1_TIME_set(WOLFSSL_ASN1_TIME *s, time_t t); +WOLFSSL_API int wolfSSL_ASN1_TIME_set_string(WOLFSSL_ASN1_TIME *s, const char *str); +WOLFSSL_API int wolfSSL_ASN1_TIME_set_string_X509(WOLFSSL_ASN1_TIME *t, + const char *str); +#endif /* OPENSSL_EXTRA */ + + +#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL) +WOLFSSL_API int wolfSSL_sk_num(const WOLFSSL_STACK* sk); +WOLFSSL_API void* wolfSSL_sk_value(const WOLFSSL_STACK* sk, int i); +#endif + + +/* stunnel 4.28 needs */ +WOLFSSL_API void wolfSSL_CTX_sess_set_get_cb(WOLFSSL_CTX* ctx, + WOLFSSL_SESSION*(*f)(WOLFSSL* ssl, const unsigned char*, int, int*)); +WOLFSSL_API void wolfSSL_CTX_sess_set_new_cb(WOLFSSL_CTX* ctx, + int (*f)(WOLFSSL* ssl, WOLFSSL_SESSION*)); +WOLFSSL_API void wolfSSL_CTX_sess_set_remove_cb(WOLFSSL_CTX* ctx, + void (*f)(WOLFSSL_CTX* ctx, WOLFSSL_SESSION*)); + +WOLFSSL_API int wolfSSL_i2d_SSL_SESSION(WOLFSSL_SESSION* sess,unsigned char** p); +WOLFSSL_API WOLFSSL_SESSION* wolfSSL_d2i_SSL_SESSION(WOLFSSL_SESSION** sess, + const unsigned char** p, long i); + +WOLFSSL_API int wolfSSL_SESSION_has_ticket(const WOLFSSL_SESSION* session); +WOLFSSL_API unsigned long wolfSSL_SESSION_get_ticket_lifetime_hint( + const WOLFSSL_SESSION* sess); +WOLFSSL_API long wolfSSL_SESSION_get_timeout(const WOLFSSL_SESSION* session); +WOLFSSL_API long wolfSSL_SESSION_get_time(const WOLFSSL_SESSION* session); + + +#ifdef SESSION_CERTS +#ifdef OPENSSL_EXTRA +WOLFSSL_API const char *wolfSSL_get0_peername(WOLFSSL *ssl); +#endif + +WOLFSSL_API + WOLFSSL_X509_CHAIN* wolfSSL_SESSION_get_peer_chain(WOLFSSL_SESSION* session); +WOLFSSL_API WOLFSSL_X509* wolfSSL_SESSION_get0_peer(WOLFSSL_SESSION* session); + +WOLFSSL_API int wolfSSL_get_chain_cert_pem(WOLFSSL_X509_CHAIN* chain, int idx, + unsigned char* buf, int inLen, int* outLen); +#endif /* SESSION_CERTS */ + + +/* extra ends */ + + +/* wolfSSL extensions */ + +/* call before SSL_connect, if verifying will add name check to + date check and signature check */ +WOLFSSL_ABI WOLFSSL_API int wolfSSL_check_domain_name(WOLFSSL* ssl, const char* dn); + + +/* need to call once to load library (session cache) */ +WOLFSSL_ABI WOLFSSL_API int wolfSSL_Init(void); +/* call when done to cleanup/free session cache mutex / resources */ +WOLFSSL_ABI WOLFSSL_API int wolfSSL_Cleanup(void); + +#if defined(WOLFSSL_SYS_CRYPTO_POLICY) +#ifndef NO_FILESYSTEM +WOLFSSL_API int wolfSSL_crypto_policy_enable(const char * policy); +#endif /* ! NO_FILESYSTEM */ +WOLFSSL_API int wolfSSL_crypto_policy_enable_buffer(const char * buf); +WOLFSSL_API void wolfSSL_crypto_policy_disable(void); +WOLFSSL_API int wolfSSL_crypto_policy_is_enabled(void); +WOLFSSL_API const char * wolfSSL_crypto_policy_get_ciphers(void); +WOLFSSL_API int wolfSSL_crypto_policy_get_level(void); +WOLFSSL_LOCAL int wolfSSL_crypto_policy_init_ctx(WOLFSSL_CTX * ctx, + WOLFSSL_METHOD * method); +#endif /* WOLFSSL_SYS_CRYPTO_POLICY */ +/* compat functions. */ +WOLFSSL_API int wolfSSL_get_security_level(const WOLFSSL * ssl); +#ifndef NO_WOLFSSL_STUB +WOLFSSL_API void wolfSSL_set_security_level(WOLFSSL * ssl, int level); +#endif /* !NO_WOLFSSL_STUB */ + +/* which library version do we have */ +WOLFSSL_API const char* wolfSSL_lib_version(void); +#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L +WOLFSSL_API const char* wolfSSL_OpenSSL_version(int a); +#else +WOLFSSL_API const char* wolfSSL_OpenSSL_version(void); +#endif +/* which library version do we have in hex */ +WOLFSSL_API word32 wolfSSL_lib_version_hex(void); + +/* do accept or connect depedning on side */ +WOLFSSL_API int wolfSSL_negotiate(WOLFSSL* ssl); +/* turn on wolfSSL data compression */ +WOLFSSL_API int wolfSSL_set_compression(WOLFSSL* ssl); + +WOLFSSL_ABI WOLFSSL_API int wolfSSL_set_timeout(WOLFSSL* ssl, unsigned int to); +WOLFSSL_ABI WOLFSSL_API int wolfSSL_CTX_set_timeout(WOLFSSL_CTX* ctx, unsigned int to); +WOLFSSL_API void wolfSSL_CTX_set_current_time_cb(WOLFSSL_CTX* ctx, + void (*cb)(const WOLFSSL* ssl, WOLFSSL_TIMEVAL* out_clock)); + +/* get wolfSSL peer X509_CHAIN */ +WOLFSSL_API WOLFSSL_X509_CHAIN* wolfSSL_get_peer_chain(WOLFSSL* ssl); +#ifdef WOLFSSL_ALT_CERT_CHAINS +WOLFSSL_API int wolfSSL_is_peer_alt_cert_chain(const WOLFSSL* ssl); +/* get wolfSSL alternate peer X509_CHAIN */ +WOLFSSL_API WOLFSSL_X509_CHAIN* wolfSSL_get_peer_alt_chain(WOLFSSL* ssl); +#endif +/* peer chain count */ +WOLFSSL_API int wolfSSL_get_chain_count(WOLFSSL_X509_CHAIN* chain); +/* index cert length */ +WOLFSSL_API int wolfSSL_get_chain_length(WOLFSSL_X509_CHAIN* chain, int idx); +/* index cert */ +WOLFSSL_API unsigned char* wolfSSL_get_chain_cert(WOLFSSL_X509_CHAIN* chain, int idx); +/* index cert in X509 */ +WOLFSSL_API WOLFSSL_X509* wolfSSL_get_chain_X509(WOLFSSL_X509_CHAIN* chain, int idx); + + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) || \ + defined(KEEP_PEER_CERT) || defined(KEEP_OUR_CERT) || defined(SESSION_CERTS) + +WOLFSSL_API WOLFSSL_X509* wolfSSL_X509_new(void); +WOLFSSL_API WOLFSSL_X509* wolfSSL_X509_new_ex(void* heap); +WOLFSSL_API WOLFSSL_X509* wolfSSL_X509_dup(WOLFSSL_X509* x); + +WOLFSSL_ABI WOLFSSL_API WOLFSSL_X509_NAME* wolfSSL_X509_get_issuer_name( + WOLFSSL_X509* cert); +WOLFSSL_ABI WOLFSSL_API WOLFSSL_X509_NAME* wolfSSL_X509_get_subject_name( + WOLFSSL_X509* cert); + +WOLFSSL_API int wolfSSL_X509_get_signature_type(WOLFSSL_X509* x509); +WOLFSSL_API int wolfSSL_X509_get_isCA(WOLFSSL_X509* x509); +WOLFSSL_API int wolfSSL_X509_get_signature(WOLFSSL_X509* x509, + unsigned char* buf, int* bufSz); +WOLFSSL_API int wolfSSL_X509_get_pubkey_buffer(WOLFSSL_X509* x509, + unsigned char* buf, int* bufSz); +WOLFSSL_API int wolfSSL_X509_get_pubkey_type(WOLFSSL_X509* x509); + +#ifndef NO_FILESYSTEM +WOLFSSL_ABI WOLFSSL_API WOLFSSL_X509* + wolfSSL_X509_load_certificate_file(const char* fname, int format); +#endif +WOLFSSL_API WOLFSSL_X509* wolfSSL_X509_load_certificate_buffer( + const unsigned char* buf, int sz, int format); +#ifdef WOLFSSL_CERT_REQ +WOLFSSL_API WOLFSSL_X509* wolfSSL_X509_REQ_load_certificate_buffer( + const unsigned char* buf, int sz, int format); +#endif + +/* free X509 */ +#define wolfSSL_FreeX509(x509) wolfSSL_X509_free((x509)) +WOLFSSL_ABI WOLFSSL_API void wolfSSL_X509_free(WOLFSSL_X509* x509); + +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL || KEEP_PEER_CERT || \ + KEEP_OUR_CERT || SESSION_CERTS */ + + +/* get index cert in PEM */ + +WOLFSSL_ABI WOLFSSL_API const unsigned char* wolfSSL_get_sessionID( + const WOLFSSL_SESSION* s); +WOLFSSL_API int wolfSSL_X509_get_serial_number(WOLFSSL_X509* x509,unsigned char* in,int* inOutSz); +WOLFSSL_API char* wolfSSL_X509_get_subjectCN(WOLFSSL_X509* x509); +WOLFSSL_API const unsigned char* wolfSSL_X509_get_der(WOLFSSL_X509* x509, int* outSz); +WOLFSSL_API const unsigned char* wolfSSL_X509_get_tbs(WOLFSSL_X509* x509, int* outSz); +WOLFSSL_ABI WOLFSSL_API const byte* wolfSSL_X509_notBefore(WOLFSSL_X509* x509); +WOLFSSL_ABI WOLFSSL_API const byte* wolfSSL_X509_notAfter(WOLFSSL_X509* x509); +WOLFSSL_API int wolfSSL_X509_version(WOLFSSL_X509* x509); + +WOLFSSL_API int wolfSSL_cmp_peer_cert_to_file(WOLFSSL* ssl, const char* fname); + +WOLFSSL_ABI WOLFSSL_API char* wolfSSL_X509_get_next_altname(WOLFSSL_X509* cert); +WOLFSSL_API int wolfSSL_X509_add_altname_ex(WOLFSSL_X509* x509, const char* name, word32 nameSz, int type); +WOLFSSL_API int wolfSSL_X509_add_altname(WOLFSSL_X509* x509, const char* name, int type); + +WOLFSSL_API WOLFSSL_X509* wolfSSL_d2i_X509(WOLFSSL_X509** x509, + const unsigned char** in, int len); +WOLFSSL_API WOLFSSL_X509* + wolfSSL_X509_d2i(WOLFSSL_X509** x509, const unsigned char* in, int len); +WOLFSSL_API WOLFSSL_X509* + wolfSSL_X509_d2i_ex(WOLFSSL_X509** x509, const unsigned char* in, int len, + void* heap); +#ifdef WOLFSSL_CERT_REQ +WOLFSSL_API WOLFSSL_X509* + wolfSSL_X509_REQ_d2i(WOLFSSL_X509** x509, const unsigned char* in, int len); +WOLFSSL_API WOLFSSL_X509* wolfSSL_d2i_X509_REQ_INFO(WOLFSSL_X509** req, + const unsigned char** in, int len); +#endif +WOLFSSL_API int wolfSSL_i2d_X509(WOLFSSL_X509* x509, unsigned char** out); +WOLFSSL_API WOLFSSL_X509_CRL *wolfSSL_d2i_X509_CRL(WOLFSSL_X509_CRL **crl, + const unsigned char *in, int len); +#if !defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM) +WOLFSSL_API WOLFSSL_X509_CRL *wolfSSL_d2i_X509_CRL_fp(XFILE file, WOLFSSL_X509_CRL **crl); +#endif +#if defined(HAVE_CRL) && defined(OPENSSL_EXTRA) +WOLFSSL_API WOLFSSL_X509_CRL *wolfSSL_d2i_X509_CRL_bio(WOLFSSL_BIO *bp, + WOLFSSL_X509_CRL **crl); +WOLFSSL_API int wolfSSL_X509_CRL_version(WOLFSSL_X509_CRL *crl); +WOLFSSL_API int wolfSSL_X509_CRL_get_signature_type(WOLFSSL_X509_CRL* crl); +WOLFSSL_API int wolfSSL_X509_CRL_get_signature_nid( + const WOLFSSL_X509_CRL* crl); +WOLFSSL_API int wolfSSL_X509_CRL_get_signature(WOLFSSL_X509_CRL* crl, + unsigned char* buf, int* bufSz); +WOLFSSL_API int wolfSSL_X509_CRL_print(WOLFSSL_BIO* bio, + WOLFSSL_X509_CRL* crl); +WOLFSSL_API WOLFSSL_X509_NAME* wolfSSL_X509_CRL_get_issuer_name( + WOLFSSL_X509_CRL *crl); +WOLFSSL_API int wolfSSL_X509_REVOKED_get_serial_number(RevokedCert* rev, + byte* in, int* inOutSz); +#endif +#if defined(HAVE_CRL) && (defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL)) +WOLFSSL_API WOLFSSL_X509_CRL* wolfSSL_X509_CRL_dup(const WOLFSSL_X509_CRL* crl); +WOLFSSL_API void wolfSSL_X509_CRL_free(WOLFSSL_X509_CRL *crl); +#endif + +#if defined(WOLFSSL_ACERT) && \ + (defined(OPENSSL_EXTRA_X509_SMALL) || defined(OPENSSL_EXTRA)) +WOLFSSL_API WOLFSSL_X509_ACERT * wolfSSL_X509_ACERT_new_ex(void * heap); +WOLFSSL_API WOLFSSL_X509_ACERT * wolfSSL_X509_ACERT_new(void); +WOLFSSL_API void wolfSSL_X509_ACERT_init(WOLFSSL_X509_ACERT * x509, + int dynamic, void * heap); +WOLFSSL_API void wolfSSL_X509_ACERT_free(WOLFSSL_X509_ACERT* x509); +#ifndef NO_WOLFSSL_STUB +WOLFSSL_API int wolfSSL_X509_ACERT_sign(WOLFSSL_X509_ACERT * x509, + WOLFSSL_EVP_PKEY * pkey, + const WOLFSSL_EVP_MD * md); +#endif /* !NO_WOLFSSL_STUB */ +WOLFSSL_API int wolfSSL_X509_ACERT_verify(WOLFSSL_X509_ACERT* x509, + WOLFSSL_EVP_PKEY* pkey); +#if defined(OPENSSL_EXTRA) +WOLFSSL_API int wolfSSL_X509_ACERT_get_signature_nid( + const WOLFSSL_X509_ACERT* x); +WOLFSSL_API int wolfSSL_X509_ACERT_print(WOLFSSL_BIO* bio, + WOLFSSL_X509_ACERT* x509_acert); +WOLFSSL_API WOLFSSL_X509_ACERT * wolfSSL_PEM_read_bio_X509_ACERT( + WOLFSSL_BIO *bp, WOLFSSL_X509_ACERT **x, wc_pem_password_cb *cb, void *u); +WOLFSSL_API long wolfSSL_X509_ACERT_get_version(const WOLFSSL_X509_ACERT *x); +#endif /* OPENSSL_EXTRA */ +WOLFSSL_API int wolfSSL_X509_ACERT_get_attr_buf(const WOLFSSL_X509_ACERT* x509, + const byte ** rawAttr, + word32 * rawAttrLen); +WOLFSSL_API int wolfSSL_X509_ACERT_get_serial_number(WOLFSSL_X509_ACERT* x509, + unsigned char* in, + int * inOutSz); +WOLFSSL_API int wolfSSL_X509_ACERT_version(WOLFSSL_X509_ACERT* x509); +WOLFSSL_API int wolfSSL_X509_ACERT_get_signature(WOLFSSL_X509_ACERT* x509, + unsigned char* buf, + int* bufSz); +WOLFSSL_API WOLFSSL_X509_ACERT * wolfSSL_X509_ACERT_load_certificate_buffer_ex( + const unsigned char* buf, int sz, int format, void * heap); +WOLFSSL_API WOLFSSL_X509_ACERT * wolfSSL_X509_ACERT_load_certificate_buffer( + const unsigned char* buf, int sz, int format); +#endif /* WOLFSSL_ACERT && (OPENSSL_EXTRA_X509_SMALL || OPENSSL_EXTRA) */ + +#ifdef OPENSSL_EXTRA +WOLFSSL_API +const WOLFSSL_ASN1_INTEGER* wolfSSL_X509_REVOKED_get0_serial_number(const + WOLFSSL_X509_REVOKED *rev); +WOLFSSL_API +const WOLFSSL_ASN1_TIME* wolfSSL_X509_REVOKED_get0_revocation_date(const + WOLFSSL_X509_REVOKED *rev); + +#ifndef NO_FILESYSTEM + #ifndef NO_STDIO_FILESYSTEM + WOLFSSL_API WOLFSSL_X509* + wolfSSL_X509_d2i_fp(WOLFSSL_X509** x509, XFILE file); + #endif +#endif + +#ifdef WOLFSSL_SEP + WOLFSSL_API unsigned char* + wolfSSL_X509_get_device_type(WOLFSSL_X509* x509, unsigned char* in, int* inOutSz); + WOLFSSL_API unsigned char* + wolfSSL_X509_get_hw_type(WOLFSSL_X509* x509, unsigned char* in, int* inOutSz); + WOLFSSL_API unsigned char* + wolfSSL_X509_get_hw_serial_number(WOLFSSL_X509* x509, unsigned char* in, int* inOutSz); +#endif + +#endif /* OPENSSL_EXTRA */ + +/* connect enough to get peer cert */ +WOLFSSL_API int wolfSSL_connect_cert(WOLFSSL* ssl); + + +#ifdef OPENSSL_EXTRA +/* PKCS12 compatibility */ +WOLFSSL_API void wolfSSL_PKCS12_PBE_add(void); +#if !defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM) +WOLFSSL_API WOLFSSL_X509_PKCS12* wolfSSL_d2i_PKCS12_fp(XFILE fp, + WOLFSSL_X509_PKCS12** pkcs12); +#endif + +#ifdef HAVE_PKCS12 +WOLFSSL_API WC_PKCS12* wolfSSL_d2i_PKCS12_bio(WOLFSSL_BIO* bio, + WC_PKCS12** pkcs12); +WOLFSSL_API int wolfSSL_i2d_PKCS12_bio(WOLFSSL_BIO *bio, WC_PKCS12 *pkcs12); + +WOLFSSL_API int wolfSSL_PKCS12_parse(WC_PKCS12* pkcs12, const char* psw, + WOLFSSL_EVP_PKEY** pkey, WOLFSSL_X509** cert, + WOLF_STACK_OF(WOLFSSL_X509)** ca); +WOLFSSL_API int wolfSSL_PKCS12_verify_mac(WC_PKCS12 *pkcs12, const char *psw, + int pswLen); +WOLFSSL_API WC_PKCS12* wolfSSL_PKCS12_create(char* pass, char* name, + WOLFSSL_EVP_PKEY* pkey, WOLFSSL_X509* cert, + WOLF_STACK_OF(WOLFSSL_X509)* ca, + int keyNID, int certNID, int itt, int macItt, int keytype); +#endif /* HAVE_PKCS12 */ +#endif /* OPENSSL_EXTRA */ + + +#ifndef NO_DH +/* server Diffie-Hellman parameters */ +WOLFSSL_API int wolfSSL_SetTmpDH(WOLFSSL* ssl, const unsigned char* p, int pSz, + const unsigned char* g, int gSz); +WOLFSSL_API int wolfSSL_SetTmpDH_buffer(WOLFSSL* ssl, const unsigned char* b, long sz, + int format); +WOLFSSL_API int wolfSSL_SetEnableDhKeyTest(WOLFSSL* ssl, int enable); +#ifndef NO_FILESYSTEM + WOLFSSL_API int wolfSSL_SetTmpDH_file(WOLFSSL* ssl, const char* f, int format); +#endif + +/* server ctx Diffie-Hellman parameters */ +WOLFSSL_API int wolfSSL_CTX_SetTmpDH(WOLFSSL_CTX* ctx, const unsigned char* p, + int pSz, const unsigned char* g, int gSz); +WOLFSSL_API int wolfSSL_CTX_SetTmpDH_buffer(WOLFSSL_CTX* ctx, const unsigned char* b, + long sz, int format); + +#ifndef NO_FILESYSTEM + WOLFSSL_API int wolfSSL_CTX_SetTmpDH_file(WOLFSSL_CTX* ctx, const char* f, + int format); +#endif + +WOLFSSL_API int wolfSSL_CTX_SetMinDhKey_Sz(WOLFSSL_CTX* ctx, word16 keySz_bits); +WOLFSSL_API int wolfSSL_SetMinDhKey_Sz(WOLFSSL* ssl, word16 keySz_bits); +WOLFSSL_API int wolfSSL_CTX_SetMaxDhKey_Sz(WOLFSSL_CTX* ctx, word16 keySz_bits); +WOLFSSL_API int wolfSSL_SetMaxDhKey_Sz(WOLFSSL* ssl, word16 keySz_bits); +WOLFSSL_API int wolfSSL_GetDhKey_Sz(WOLFSSL* ssl); +#endif /* NO_DH */ + +#ifndef NO_RSA +WOLFSSL_API int wolfSSL_CTX_SetMinRsaKey_Sz(WOLFSSL_CTX* ctx, short keySz); +WOLFSSL_API int wolfSSL_SetMinRsaKey_Sz(WOLFSSL* ssl, short keySz); +#endif /* NO_RSA */ + +#ifdef HAVE_ECC +WOLFSSL_API int wolfSSL_CTX_SetMinEccKey_Sz(WOLFSSL_CTX* ctx, short keySz); +WOLFSSL_API int wolfSSL_SetMinEccKey_Sz(WOLFSSL* ssl, short keySz); +#endif /* NO_RSA */ + +WOLFSSL_API int wolfSSL_SetTmpEC_DHE_Sz(WOLFSSL* ssl, word16 sz); +WOLFSSL_API int wolfSSL_CTX_SetTmpEC_DHE_Sz(WOLFSSL_CTX* ctx, word16 sz); + +/* keyblock size in bytes or -1 */ +/* need to call wolfSSL_KeepArrays before handshake to save keys */ +WOLFSSL_API int wolfSSL_get_keyblock_size(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_get_keys(WOLFSSL* ssl,unsigned char** ms, unsigned int* msLen, + unsigned char** sr, unsigned int* srLen, + unsigned char** cr, unsigned int* crLen); + +/* Computes EAP-TLS and EAP-TTLS keying material from the master_secret. */ +WOLFSSL_API int wolfSSL_make_eap_keys(WOLFSSL* ssl, void* key, unsigned int len, + const char* label); + + +#ifndef _WIN32 + #ifndef NO_WRITEV + #ifdef __PPU + #include <sys/types.h> + #include <sys/socket.h> + #elif defined(ARDUINO) + /* TODO board specific */ + #elif defined(NUCLEUS_PLUS_2_3) + #include "services/sys/uio.h" + #elif !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_IAR_ARM) && \ + !defined(WOLFSSL_PICOTCP) && !defined(WOLFSSL_ROWLEY_ARM) && \ + !defined(WOLFSSL_EMBOS) && !defined(WOLFSSL_FROSTED) && \ + !defined(WOLFSSL_CHIBIOS) && !defined(WOLFSSL_CONTIKI) && \ + !defined(WOLFSSL_ZEPHYR) && !defined(NETOS) && \ + !defined(WOLFSSL_NDS) + #include <sys/uio.h> + #endif + /* allow writev style writing */ + WOLFSSL_API int wolfSSL_writev(WOLFSSL* ssl, const struct iovec* iov, + int iovcnt); + #endif /* !NO_WRITEV */ +#endif /* !_WIN32 */ + + +#ifndef NO_CERTS + /* SSL_CTX versions */ + WOLFSSL_API int wolfSSL_CTX_UnloadCAs(WOLFSSL_CTX* ctx); + WOLFSSL_API int wolfSSL_CTX_UnloadIntermediateCerts(WOLFSSL_CTX* ctx); +#ifdef WOLFSSL_TRUST_PEER_CERT + WOLFSSL_API int wolfSSL_CTX_Unload_trust_peers(WOLFSSL_CTX* ctx); +#ifdef WOLFSSL_LOCAL_X509_STORE + WOLFSSL_API int wolfSSL_Unload_trust_peers(WOLFSSL* ssl); +#endif + WOLFSSL_API int wolfSSL_CTX_trust_peer_buffer(WOLFSSL_CTX* ctx, + const unsigned char* in, + long sz, int format); +#endif + WOLFSSL_API int wolfSSL_CTX_load_verify_buffer_ex(WOLFSSL_CTX* ctx, + const unsigned char* in, long sz, int format, + int userChain, word32 flags); + WOLFSSL_API int wolfSSL_CTX_load_verify_buffer(WOLFSSL_CTX* ctx, + const unsigned char* in, long sz, int format); + WOLFSSL_API int wolfSSL_CTX_load_verify_chain_buffer_format(WOLFSSL_CTX* ctx, + const unsigned char* in, long sz, int format); + WOLFSSL_API int wolfSSL_CTX_use_certificate_buffer(WOLFSSL_CTX* ctx, + const unsigned char* in, long sz, int format); + WOLFSSL_API int wolfSSL_CTX_use_PrivateKey_buffer(WOLFSSL_CTX* ctx, + const unsigned char* in, long sz, int format); + WOLFSSL_API int wolfSSL_CTX_use_PrivateKey_id(WOLFSSL_CTX* ctx, + const unsigned char* id, long sz, + int devId, long keySz); + WOLFSSL_API int wolfSSL_CTX_use_PrivateKey_Id(WOLFSSL_CTX* ctx, + const unsigned char* id, long sz, + int devId); + WOLFSSL_API int wolfSSL_CTX_use_PrivateKey_Label(WOLFSSL_CTX* ctx, const char* label, + int devId); + WOLFSSL_API int wolfSSL_CTX_use_certificate_chain_buffer_format(WOLFSSL_CTX* ctx, + const unsigned char* in, long sz, int format); + WOLFSSL_API int wolfSSL_CTX_use_certificate_chain_buffer(WOLFSSL_CTX* ctx, + const unsigned char* in, long sz); +#if defined(WOLF_CRYPTO_CB) + WOLFSSL_API int wolfSSL_CTX_use_certificate_label(WOLFSSL_CTX* ctx, + const char *label, int devId); + WOLFSSL_API int wolfSSL_CTX_use_certificate_id(WOLFSSL_CTX* ctx, + const unsigned char *id, int idLen, int devId); +#endif +#ifdef WOLFSSL_DUAL_ALG_CERTS + WOLFSSL_API int wolfSSL_CTX_use_AltPrivateKey_buffer(WOLFSSL_CTX* ctx, + const unsigned char* in, long sz, int format); + WOLFSSL_API int wolfSSL_CTX_use_AltPrivateKey_id(WOLFSSL_CTX* ctx, + const unsigned char* id, long sz, + int devId, long keySz); + WOLFSSL_API int wolfSSL_CTX_use_AltPrivateKey_Id(WOLFSSL_CTX* ctx, + const unsigned char* id, long sz, int devId); + WOLFSSL_API int wolfSSL_CTX_use_AltPrivateKey_Label(WOLFSSL_CTX* ctx, + const char* label, int devId); +#endif + + /* SSL versions */ + WOLFSSL_API int wolfSSL_use_certificate_buffer(WOLFSSL* ssl, const unsigned char* in, + long sz, int format); + WOLFSSL_API int wolfSSL_use_certificate_ASN1(WOLFSSL* ssl, + const unsigned char* der, int derSz); + WOLFSSL_API int wolfSSL_use_PrivateKey_buffer(WOLFSSL* ssl, const unsigned char* in, + long sz, int format); + WOLFSSL_API int wolfSSL_use_PrivateKey_id(WOLFSSL* ssl, const unsigned char* id, + long sz, int devId, long keySz); + WOLFSSL_API int wolfSSL_use_PrivateKey_Id(WOLFSSL* ssl, const unsigned char* id, + long sz, int devId); + WOLFSSL_API int wolfSSL_use_PrivateKey_Label(WOLFSSL* ssl, const char* label, int devId); + WOLFSSL_API int wolfSSL_use_certificate_chain_buffer_format(WOLFSSL* ssl, + const unsigned char* in, long sz, int format); + WOLFSSL_API int wolfSSL_use_certificate_chain_buffer(WOLFSSL* ssl, + const unsigned char* in, long sz); + WOLFSSL_API int wolfSSL_UnloadCertsKeys(WOLFSSL* ssl); +#ifdef WOLFSSL_DUAL_ALG_CERTS + WOLFSSL_API int wolfSSL_use_AltPrivateKey_buffer(WOLFSSL* ssl, + const unsigned char* in, long sz, int format); + WOLFSSL_API int wolfSSL_use_AltPrivateKey_id(WOLFSSL* ssl, + const unsigned char* id, long sz, + int devId, long keySz); + WOLFSSL_API int wolfSSL_use_AltPrivateKey_Id(WOLFSSL* ssl, + const unsigned char* id, long sz, int devId); + WOLFSSL_API int wolfSSL_use_AltPrivateKey_Label(WOLFSSL* ssl, + const char* label, int devId); +#endif + + #if (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) && \ + defined(KEEP_OUR_CERT) + WOLFSSL_API WOLFSSL_X509* wolfSSL_get_certificate(WOLFSSL* ssl); + WOLFSSL_API WOLFSSL_X509* wolfSSL_CTX_get0_certificate(WOLFSSL_CTX* ctx); + #endif +#endif + +WOLFSSL_API int wolfSSL_CTX_set_group_messages(WOLFSSL_CTX* ctx); +WOLFSSL_API int wolfSSL_set_group_messages(WOLFSSL* ssl); + + +#ifdef HAVE_FUZZER +enum fuzzer_type { + FUZZ_HMAC = 0, + FUZZ_ENCRYPT = 1, + FUZZ_SIGNATURE = 2, + FUZZ_HASH = 3, + FUZZ_HEAD = 4 +}; + +typedef int (*CallbackFuzzer)(WOLFSSL* ssl, const unsigned char* buf, int sz, + int type, void* fuzzCtx); + +WOLFSSL_API void wolfSSL_SetFuzzerCb(WOLFSSL* ssl, CallbackFuzzer cbf, void* fCtx); +#endif + + +WOLFSSL_API int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl, const byte* secret, word32 secretSz); + + +/* CA cache callbacks */ +enum { + WOLFSSL_SSLV3 = 0, + WOLFSSL_TLSV1 = 1, + WOLFSSL_TLSV1_1 = 2, + WOLFSSL_TLSV1_2 = 3, + WOLFSSL_TLSV1_3 = 4, + WOLFSSL_DTLSV1 = 5, + WOLFSSL_DTLSV1_2 = 6, + WOLFSSL_DTLSV1_3 = 7, + + WOLFSSL_USER_CA = 1, /* user added as trusted */ + WOLFSSL_CHAIN_CA = 2, /* added to cache from trusted chain */ + WOLFSSL_TEMP_CA = 3 /* Temp intermediate CA, only for use by + * X509_STORE */ +}; + +WOLFSSL_ABI WOLFSSL_API WC_RNG* wolfSSL_GetRNG(WOLFSSL* ssl); + +WOLFSSL_ABI WOLFSSL_API int wolfSSL_CTX_SetMinVersion(WOLFSSL_CTX* ctx, int version); +WOLFSSL_API int wolfSSL_SetMinVersion(WOLFSSL* ssl, int version); +WOLFSSL_API int wolfSSL_GetObjectSize(void); /* object size based on build */ +WOLFSSL_API int wolfSSL_CTX_GetObjectSize(void); +WOLFSSL_API int wolfSSL_METHOD_GetObjectSize(void); +WOLFSSL_API int wolfSSL_GetOutputSize(WOLFSSL* ssl, int inSz); +WOLFSSL_API int wolfSSL_GetMaxOutputSize(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_GetVersion(const WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_SetVersion(WOLFSSL* ssl, int version); + +/* moved to asn.c, old names kept for backwards compatibility */ +#define wolfSSL_KeyPemToDer wc_KeyPemToDer +#define wolfSSL_CertPemToDer wc_CertPemToDer +#define wolfSSL_PemPubKeyToDer wc_PemPubKeyToDer +#define wolfSSL_PubKeyPemToDer wc_PubKeyPemToDer +#define wolfSSL_PemCertToDer wc_PemCertToDer + + +typedef void (*CallbackCACache)(unsigned char* der, int sz, int type); +typedef void (*CbMissingCRL)(const char* url); +typedef int (*crlErrorCb)(int ret, WOLFSSL_CRL* crl, WOLFSSL_CERT_MANAGER* cm, + void* ctx); +typedef int (*CbOCSPIO)(void*, const char*, int, + unsigned char*, int, unsigned char**); +typedef void (*CbOCSPRespFree)(void*,unsigned char*); + +#ifdef HAVE_CRL_IO +typedef int (*CbCrlIO)(WOLFSSL_CRL* crl, const char* url, int urlSz); +#endif + +#ifdef HAVE_CRL_UPDATE_CB +typedef struct CrlInfo { + byte crlNumber[CRL_MAX_NUM_SZ]; + byte *issuerHash; + word32 issuerHashLen; + byte *lastDate; + word32 lastDateMaxLen; + byte lastDateFormat; + byte *nextDate; + word32 nextDateMaxLen; + byte nextDateFormat; + byte crlNumberSet:1; +} CrlInfo; + +typedef void (*CbUpdateCRL)(CrlInfo* old, CrlInfo* cnew); +#endif + +/* User Atomic Record Layer CallBacks */ +typedef int (*CallbackMacEncrypt)(WOLFSSL* ssl, unsigned char* macOut, + const unsigned char* macIn, unsigned int macInSz, int macContent, + int macVerify, unsigned char* encOut, const unsigned char* encIn, + unsigned int encSz, void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetMacEncryptCb(WOLFSSL_CTX* ctx, CallbackMacEncrypt cb); +WOLFSSL_API void wolfSSL_SetMacEncryptCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetMacEncryptCtx(WOLFSSL* ssl); + +typedef int (*CallbackDecryptVerify)(WOLFSSL* ssl, + unsigned char* decOut, const unsigned char* decIn, + unsigned int decSz, int content, int verify, unsigned int* padSz, + void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetDecryptVerifyCb(WOLFSSL_CTX* ctx, + CallbackDecryptVerify cb); +WOLFSSL_API void wolfSSL_SetDecryptVerifyCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetDecryptVerifyCtx(WOLFSSL* ssl); + +typedef int (*CallbackEncryptMac)(WOLFSSL* ssl, unsigned char* macOut, + int content, int macVerify, unsigned char* encOut, + const unsigned char* encIn, unsigned int encSz, void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetEncryptMacCb(WOLFSSL_CTX* ctx, CallbackEncryptMac cb); +WOLFSSL_API void wolfSSL_SetEncryptMacCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetEncryptMacCtx(WOLFSSL* ssl); + +#ifdef WOLFSSL_THREADED_CRYPT + #ifndef WOLFSSL_THREADED_CRYPT_CNT + #define WOLFSSL_THREADED_CRYPT_CNT 16 + #endif + +typedef void (*WOLFSSL_THREAD_SIGNAL)(void* ctx, WOLFSSL* ssl); + +WOLFSSL_API int wolfSSL_AsyncEncryptReady(WOLFSSL* ssl, int idx); +WOLFSSL_API int wolfSSL_AsyncEncryptStop(WOLFSSL* ssl, int idx); +WOLFSSL_API int wolfSSL_AsyncEncrypt(WOLFSSL* ssl, int idx); +WOLFSSL_API int wolfSSL_AsyncEncryptSetSignal(WOLFSSL* ssl, int idx, + WOLFSSL_THREAD_SIGNAL signal, void* ctx); +#endif + + +typedef int (*CallbackVerifyDecrypt)(WOLFSSL* ssl, + unsigned char* decOut, const unsigned char* decIn, + unsigned int decSz, int content, int verify, unsigned int* padSz, + void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetVerifyDecryptCb(WOLFSSL_CTX* ctx, + CallbackVerifyDecrypt cb); +WOLFSSL_API void wolfSSL_SetVerifyDecryptCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetVerifyDecryptCtx(WOLFSSL* ssl); + +WOLFSSL_API const unsigned char* wolfSSL_GetMacSecret(WOLFSSL* ssl, int verify); +WOLFSSL_API const unsigned char* wolfSSL_GetDtlsMacSecret(WOLFSSL* ssl, int verify, int epochOrder); +WOLFSSL_API const unsigned char* wolfSSL_GetClientWriteKey(WOLFSSL* ssl); +WOLFSSL_API const unsigned char* wolfSSL_GetClientWriteIV(WOLFSSL* ssl); +WOLFSSL_API const unsigned char* wolfSSL_GetServerWriteKey(WOLFSSL* ssl); +WOLFSSL_API const unsigned char* wolfSSL_GetServerWriteIV(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_GetKeySize(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_GetIVSize(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_GetSide(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_IsTLSv1_1(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_GetBulkCipher(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_GetCipherBlockSize(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_GetAeadMacSize(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_GetHmacSize(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_GetHmacType(WOLFSSL* ssl); +#ifdef WORD64_AVAILABLE +WOLFSSL_API int wolfSSL_GetPeerSequenceNumber(WOLFSSL* ssl, word64* seq); +WOLFSSL_API int wolfSSL_GetSequenceNumber(WOLFSSL* ssl, word64* seq); +#endif +WOLFSSL_API int wolfSSL_GetCipherType(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_SetTlsHmacInner(WOLFSSL* ssl, + byte* inner, word32 sz, int content, int verify); + +/* Atomic User Needs */ +enum { + WOLFSSL_SERVER_END = 0, + WOLFSSL_CLIENT_END = 1, + WOLFSSL_NEITHER_END = 3, + WOLFSSL_BLOCK_TYPE = 2, + WOLFSSL_STREAM_TYPE = 3, + WOLFSSL_AEAD_TYPE = 4, + WOLFSSL_TLS_HMAC_INNER_SZ = 13 /* SEQ_SZ + ENUM + VERSION_SZ + LEN_SZ */ +}; + +/* for GetBulkCipher and internal use + * using explicit values to assist with serialization of a TLS session */ +enum BulkCipherAlgorithm { + wolfssl_cipher_null = 0, + wolfssl_rc4 = 1, + wolfssl_rc2 = 2, + wolfssl_des = 3, + wolfssl_triple_des = 4, + wolfssl_des40 = 5, + wolfssl_aes = 6, + wolfssl_aes_gcm = 7, + wolfssl_aes_ccm = 8, + wolfssl_chacha = 9, + wolfssl_camellia = 10, + wolfssl_sm4_cbc = 11, + wolfssl_sm4_gcm = 12, + wolfssl_sm4_ccm = 13, + wolfssl_aria_gcm = 14 +}; + + +/* for KDF TLS 1.2 mac types */ +enum KDF_MacAlgorithm { + wolfssl_sha256 = 4, /* needs to match hash.h wc_MACAlgorithm */ + wolfssl_sha384, + wolfssl_sha512, + wolfssl_sm3 = 9 +}; + + +/* Public Key Callback support */ +#ifdef HAVE_PK_CALLBACKS +#ifdef HAVE_ECC + +struct ecc_key; + +typedef int (*CallbackEccKeyGen)(WOLFSSL* ssl, struct ecc_key* key, + unsigned int keySz, int ecc_curve, void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetEccKeyGenCb(WOLFSSL_CTX* ctx, CallbackEccKeyGen cb); +WOLFSSL_API void wolfSSL_SetEccKeyGenCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetEccKeyGenCtx(WOLFSSL* ssl); + +typedef int (*CallbackEccSign)(WOLFSSL* ssl, + const unsigned char* in, unsigned int inSz, + unsigned char* out, word32* outSz, + const unsigned char* keyDer, unsigned int keySz, + void* ctx); +WOLFSSL_ABI WOLFSSL_API void wolfSSL_CTX_SetEccSignCb(WOLFSSL_CTX* ctx, + CallbackEccSign cb); +WOLFSSL_API void wolfSSL_SetEccSignCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetEccSignCtx(WOLFSSL* ssl); +WOLFSSL_API void wolfSSL_CTX_SetEccSignCtx(WOLFSSL_CTX* ctx, void *userCtx); +WOLFSSL_API void* wolfSSL_CTX_GetEccSignCtx(WOLFSSL_CTX* ctx); + +typedef int (*CallbackEccVerify)(WOLFSSL* ssl, + const unsigned char* sig, unsigned int sigSz, + const unsigned char* hash, unsigned int hashSz, + const unsigned char* keyDer, unsigned int keySz, + int* result, void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetEccVerifyCb(WOLFSSL_CTX* ctx, CallbackEccVerify cb); +WOLFSSL_API void wolfSSL_SetEccVerifyCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetEccVerifyCtx(WOLFSSL* ssl); + +typedef int (*CallbackEccSharedSecret)(WOLFSSL* ssl, struct ecc_key* otherKey, + unsigned char* pubKeyDer, word32* pubKeySz, + unsigned char* out, word32* outlen, + int side, void* ctx); /* side is WOLFSSL_CLIENT_END or WOLFSSL_SERVER_END */ +WOLFSSL_API void wolfSSL_CTX_SetEccSharedSecretCb(WOLFSSL_CTX* ctx, CallbackEccSharedSecret cb); +WOLFSSL_API void wolfSSL_SetEccSharedSecretCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetEccSharedSecretCtx(WOLFSSL* ssl); +#endif + +#ifdef HAVE_HKDF +#include <wolfssl/wolfcrypt/kdf.h> +typedef int (*CallbackHKDFExtract)(byte* prk, const byte* salt, word32 saltLen, + byte* ikm, word32 ikmLen, int digest, void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetHKDFExtractCb(WOLFSSL_CTX* ctx, CallbackHKDFExtract cb); +WOLFSSL_API void* wolfSSL_GetHKDFExtractCtx(WOLFSSL* ssl); +WOLFSSL_API void wolfSSL_SetHKDFExtractCtx(WOLFSSL* ssl, void *ctx); +#endif + +#ifndef NO_DH +/* Public DH Key Callback support */ +struct DhKey; +typedef int (*CallbackDhGenerateKeyPair)(DhKey* key, WC_RNG* rng, + byte* priv, word32* privSz, + byte* pub, word32* pubSz); +typedef int (*CallbackDhAgree)(WOLFSSL* ssl, struct DhKey* key, + const unsigned char* priv, unsigned int privSz, + const unsigned char* otherPubKeyDer, unsigned int otherPubKeySz, + unsigned char* out, word32* outlen, + void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetDhGenerateKeyPair(WOLFSSL_CTX* ctx, + CallbackDhGenerateKeyPair cb); +WOLFSSL_API void wolfSSL_CTX_SetDhAgreeCb(WOLFSSL_CTX* ctx, + CallbackDhAgree cb); +WOLFSSL_API void wolfSSL_SetDhAgreeCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetDhAgreeCtx(WOLFSSL* ssl); +#endif /* !NO_DH */ + +#ifdef HAVE_ED25519 +struct ed25519_key; +typedef int (*CallbackEd25519Sign)(WOLFSSL* ssl, + const unsigned char* in, unsigned int inSz, + unsigned char* out, unsigned int* outSz, + const unsigned char* keyDer, unsigned int keySz, + void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetEd25519SignCb(WOLFSSL_CTX* ctx, + CallbackEd25519Sign cb); +WOLFSSL_API void wolfSSL_SetEd25519SignCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetEd25519SignCtx(WOLFSSL* ssl); + +typedef int (*CallbackEd25519Verify)(WOLFSSL* ssl, + const unsigned char* sig, unsigned int sigSz, + const unsigned char* msg, unsigned int msgSz, + const unsigned char* keyDer, unsigned int keySz, + int* result, void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetEd25519VerifyCb(WOLFSSL_CTX* ctx, + CallbackEd25519Verify cb); +WOLFSSL_API void wolfSSL_SetEd25519VerifyCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetEd25519VerifyCtx(WOLFSSL* ssl); +#endif + +#ifdef HAVE_CURVE25519 +struct curve25519_key; + +typedef int (*CallbackX25519KeyGen)(WOLFSSL* ssl, struct curve25519_key* key, + unsigned int keySz, void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetX25519KeyGenCb(WOLFSSL_CTX* ctx, CallbackX25519KeyGen cb); +WOLFSSL_API void wolfSSL_SetX25519KeyGenCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetX25519KeyGenCtx(WOLFSSL* ssl); + +typedef int (*CallbackX25519SharedSecret)(WOLFSSL* ssl, + struct curve25519_key* otherKey, + unsigned char* pubKeyDer, unsigned int* pubKeySz, + unsigned char* out, unsigned int* outlen, + int side, void* ctx); + /* side is WOLFSSL_CLIENT_END or WOLFSSL_SERVER_END */ +WOLFSSL_API void wolfSSL_CTX_SetX25519SharedSecretCb(WOLFSSL_CTX* ctx, + CallbackX25519SharedSecret cb); +WOLFSSL_API void wolfSSL_SetX25519SharedSecretCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetX25519SharedSecretCtx(WOLFSSL* ssl); +#endif + +#ifdef HAVE_ED448 +struct ed448_key; +typedef int (*CallbackEd448Sign)(WOLFSSL* ssl, + const unsigned char* in, unsigned int inSz, + unsigned char* out, unsigned int* outSz, + const unsigned char* keyDer, unsigned int keySz, + void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetEd448SignCb(WOLFSSL_CTX* ctx, + CallbackEd448Sign cb); +WOLFSSL_API void wolfSSL_SetEd448SignCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetEd448SignCtx(WOLFSSL* ssl); + +typedef int (*CallbackEd448Verify)(WOLFSSL* ssl, + const unsigned char* sig, unsigned int sigSz, + const unsigned char* msg, unsigned int msgSz, + const unsigned char* keyDer, unsigned int keySz, + int* result, void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetEd448VerifyCb(WOLFSSL_CTX* ctx, + CallbackEd448Verify cb); +WOLFSSL_API void wolfSSL_SetEd448VerifyCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetEd448VerifyCtx(WOLFSSL* ssl); +#endif + +#ifdef HAVE_CURVE448 +struct curve448_key; + +typedef int (*CallbackX448KeyGen)(WOLFSSL* ssl, struct curve448_key* key, + unsigned int keySz, void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetX448KeyGenCb(WOLFSSL_CTX* ctx, CallbackX448KeyGen cb); +WOLFSSL_API void wolfSSL_SetX448KeyGenCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetX448KeyGenCtx(WOLFSSL* ssl); + +typedef int (*CallbackX448SharedSecret)(WOLFSSL* ssl, + struct curve448_key* otherKey, + unsigned char* pubKeyDer, unsigned int* pubKeySz, + unsigned char* out, unsigned int* outlen, + int side, void* ctx); + /* side is WOLFSSL_CLIENT_END or WOLFSSL_SERVER_END */ +WOLFSSL_API void wolfSSL_CTX_SetX448SharedSecretCb(WOLFSSL_CTX* ctx, + CallbackX448SharedSecret cb); +WOLFSSL_API void wolfSSL_SetX448SharedSecretCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetX448SharedSecretCtx(WOLFSSL* ssl); +#endif + +#ifndef NO_RSA +typedef int (*CallbackRsaSign)(WOLFSSL* ssl, + const unsigned char* in, unsigned int inSz, + unsigned char* out, word32* outSz, + const unsigned char* keyDer, unsigned int keySz, + void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetRsaSignCb(WOLFSSL_CTX* ctx, CallbackRsaSign cb); +WOLFSSL_API void wolfSSL_SetRsaSignCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetRsaSignCtx(WOLFSSL* ssl); + +typedef int (*CallbackRsaVerify)(WOLFSSL* ssl, + unsigned char* sig, unsigned int sigSz, + unsigned char** out, + const unsigned char* keyDer, unsigned int keySz, + void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetRsaVerifyCb(WOLFSSL_CTX* ctx, CallbackRsaVerify cb); +WOLFSSL_API void wolfSSL_CTX_SetRsaSignCheckCb(WOLFSSL_CTX* ctx, CallbackRsaVerify cb); +WOLFSSL_API void wolfSSL_SetRsaVerifyCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetRsaVerifyCtx(WOLFSSL* ssl); + +#ifdef WC_RSA_PSS +typedef int (*CallbackRsaPssSign)(WOLFSSL* ssl, + const unsigned char* in, unsigned int inSz, + unsigned char* out, unsigned int* outSz, + int hash, int mgf, + const unsigned char* keyDer, unsigned int keySz, + void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetRsaPssSignCb(WOLFSSL_CTX* ctx, CallbackRsaPssSign cb); +WOLFSSL_API void wolfSSL_SetRsaPssSignCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetRsaPssSignCtx(WOLFSSL* ssl); + +typedef int (*CallbackRsaPssVerify)(WOLFSSL* ssl, + unsigned char* sig, unsigned int sigSz, + unsigned char** out, + int hash, int mgf, + const unsigned char* keyDer, unsigned int keySz, + void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetRsaPssVerifyCb(WOLFSSL_CTX* ctx, + CallbackRsaPssVerify cb); +WOLFSSL_API void wolfSSL_CTX_SetRsaPssSignCheckCb(WOLFSSL_CTX* ctx, + CallbackRsaPssVerify cb); +WOLFSSL_API void wolfSSL_SetRsaPssVerifyCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetRsaPssVerifyCtx(WOLFSSL* ssl); +#endif + +/* RSA Public Encrypt cb */ +typedef int (*CallbackRsaEnc)(WOLFSSL* ssl, + const unsigned char* in, unsigned int inSz, + unsigned char* out, word32* outSz, + const unsigned char* keyDer, unsigned int keySz, + void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetRsaEncCb(WOLFSSL_CTX* ctx, CallbackRsaEnc cb); +WOLFSSL_API void wolfSSL_SetRsaEncCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetRsaEncCtx(WOLFSSL* ssl); + +/* RSA Private Decrypt cb */ +typedef int (*CallbackRsaDec)(WOLFSSL* ssl, + unsigned char* in, unsigned int inSz, + unsigned char** out, + const unsigned char* keyDer, unsigned int keySz, + void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetRsaDecCb(WOLFSSL_CTX* ctx, CallbackRsaDec cb); +WOLFSSL_API void wolfSSL_SetRsaDecCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetRsaDecCtx(WOLFSSL* ssl); +#endif + +/* Protocol Callback */ +typedef int (*CallbackGenMasterSecret)(WOLFSSL* ssl, void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetGenMasterSecretCb(WOLFSSL_CTX* ctx, + CallbackGenMasterSecret cb); +WOLFSSL_API void wolfSSL_SetGenMasterSecretCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetGenMasterSecretCtx(WOLFSSL* ssl); + +typedef int (*CallbackGenExtMasterSecret)(WOLFSSL* ssl, byte* hash, + word32 hashsz, void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetGenExtMasterSecretCb(WOLFSSL_CTX* ctx, + CallbackGenExtMasterSecret cb); +WOLFSSL_API void wolfSSL_SetGenExtMasterSecretCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetGenExtMasterSecretCtx(WOLFSSL* ssl); + +typedef int (*CallbackGenPreMaster)(WOLFSSL* ssl, byte *premaster, + word32 preSz, void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetGenPreMasterCb(WOLFSSL_CTX* ctx, + CallbackGenPreMaster cb); +WOLFSSL_API void wolfSSL_SetGenPreMasterCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetGenPreMasterCtx(WOLFSSL* ssl); + +typedef int (*CallbackGenSessionKey)(WOLFSSL* ssl, void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetGenSessionKeyCb(WOLFSSL_CTX* ctx, + CallbackGenSessionKey cb); +WOLFSSL_API void wolfSSL_SetGenSessionKeyCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetGenSessionKeyCtx(WOLFSSL* ssl); + +typedef int (*CallbackEncryptKeys)(WOLFSSL* ssl, void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetEncryptKeysCb(WOLFSSL_CTX* ctx, + CallbackEncryptKeys cb); +WOLFSSL_API void wolfSSL_SetEncryptKeysCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetEncryptKeysCtx(WOLFSSL* ssl); + +typedef int (*CallbackTlsFinished)(WOLFSSL* ssl, + const byte *side, + const byte *handshake_hash, word32 hashSz, + byte *hashes, void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetTlsFinishedCb(WOLFSSL_CTX* ctx, CallbackTlsFinished cb); +WOLFSSL_API void wolfSSL_SetTlsFinishedCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetTlsFinishedCtx(WOLFSSL* ssl); + +#if !defined(WOLFSSL_NO_TLS12) && !defined(WOLFSSL_AEAD_ONLY) +typedef int (*CallbackVerifyMac)(WOLFSSL *ssl, const byte* message, + word32 messageSz, word32 macSz, word32 content, void* ctx); +WOLFSSL_API void wolfSSL_CTX_SetVerifyMacCb(WOLFSSL_CTX* ctx, CallbackVerifyMac cb); +WOLFSSL_API void wolfSSL_SetVerifyMacCtx(WOLFSSL* ssl, void *ctx); +WOLFSSL_API void* wolfSSL_GetVerifyMacCtx(WOLFSSL* ssl); +#endif + +typedef int (*CallbackHKDFExpandLabel)(byte* okm, word32 okmLen, + const byte* prk, word32 prkLen, + const byte* protocol, word32 protocolLen, + const byte* label, word32 labelLen, + const byte* info, word32 infoLen, + int digest, int side); +WOLFSSL_API void wolfSSL_CTX_SetHKDFExpandLabelCb(WOLFSSL_CTX* ctx, + CallbackHKDFExpandLabel cb); + +typedef int (*CallbackProcessServerSigKex)(WOLFSSL* ssl, byte p_sig_algo, + const byte* p_sig, word32 p_sig_len, + const byte* p_rand, word32 p_rand_len, + const byte* p_server_params, word32 p_server_params_len); +WOLFSSL_API void wolfSSL_CTX_SetProcessServerSigKexCb(WOLFSSL_CTX* ctx, + CallbackProcessServerSigKex cb); + +typedef int (*CallbackPerformTlsRecordProcessing)(WOLFSSL* ssl, int is_encrypt, + byte* out, const byte* in, word32 sz, + const byte* iv, word32 ivSz, + byte* authTag, word32 authTagSz, + const byte* authIn, word32 authInSz); +WOLFSSL_API void wolfSSL_CTX_SetPerformTlsRecordProcessingCb(WOLFSSL_CTX* ctx, + CallbackPerformTlsRecordProcessing cb); + +#endif /* HAVE_PK_CALLBACKS */ + +#ifndef NO_CERTS + WOLFSSL_API void wolfSSL_CTX_SetCACb(WOLFSSL_CTX* ctx, CallbackCACache cb); + + WOLFSSL_API WOLFSSL_CERT_MANAGER* wolfSSL_CTX_GetCertManager(WOLFSSL_CTX* ctx); + + WOLFSSL_API WOLFSSL_CERT_MANAGER* wolfSSL_CertManagerNew_ex(void* heap); + WOLFSSL_API WOLFSSL_CERT_MANAGER* wolfSSL_CertManagerNew(void); + WOLFSSL_API void wolfSSL_CertManagerFree(WOLFSSL_CERT_MANAGER* cm); + WOLFSSL_API int wolfSSL_CertManager_up_ref(WOLFSSL_CERT_MANAGER* cm); + +#ifdef WC_ASN_UNKNOWN_EXT_CB + WOLFSSL_API void wolfSSL_CertManagerSetUnknownExtCallback( + WOLFSSL_CERT_MANAGER* cm, + wc_UnknownExtCallback cb); +#endif + + WOLFSSL_API int wolfSSL_CertManagerLoadCA(WOLFSSL_CERT_MANAGER* cm, + const char* f, const char* d); + WOLFSSL_API int wolfSSL_CertManagerLoadCABuffer_ex(WOLFSSL_CERT_MANAGER* cm, + const unsigned char* buff, long sz, int format, int userChain, + word32 flags); + WOLFSSL_API int wolfSSL_CertManagerLoadCABuffer(WOLFSSL_CERT_MANAGER* cm, + const unsigned char* buff, long sz, int format); + + WOLFSSL_API int wolfSSL_CertManagerUnloadCAs(WOLFSSL_CERT_MANAGER* cm); + WOLFSSL_API int wolfSSL_CertManagerUnloadIntermediateCerts( + WOLFSSL_CERT_MANAGER* cm); +#ifdef WOLFSSL_TRUST_PEER_CERT + WOLFSSL_API int wolfSSL_CertManagerUnload_trust_peers( + WOLFSSL_CERT_MANAGER* cm); +#endif + WOLFSSL_API int wolfSSL_CertManagerVerify(WOLFSSL_CERT_MANAGER* cm, + const char* f, int format); + WOLFSSL_API int wolfSSL_CertManagerVerifyBuffer(WOLFSSL_CERT_MANAGER* cm, + const unsigned char* buff, long sz, int format); + WOLFSSL_API int wolfSSL_CertManagerCheckCRL(WOLFSSL_CERT_MANAGER* cm, + const unsigned char* der, int sz); + WOLFSSL_API int wolfSSL_CertManagerEnableCRL(WOLFSSL_CERT_MANAGER* cm, + int options); + WOLFSSL_API int wolfSSL_CertManagerDisableCRL(WOLFSSL_CERT_MANAGER* cm); +#ifndef NO_WOLFSSL_CM_VERIFY + WOLFSSL_API void wolfSSL_CertManagerSetVerify(WOLFSSL_CERT_MANAGER* cm, + VerifyCallback vc); +#endif + WOLFSSL_API int wolfSSL_CertManagerLoadCRL(WOLFSSL_CERT_MANAGER* cm, + const char* path, int type, int monitor); + WOLFSSL_API int wolfSSL_CertManagerLoadCRLFile(WOLFSSL_CERT_MANAGER* cm, + const char* file, int type); + WOLFSSL_API int wolfSSL_CertManagerLoadCRLBuffer(WOLFSSL_CERT_MANAGER* cm, + const unsigned char* buff, long sz, int type); + WOLFSSL_API int wolfSSL_CertManagerSetCRL_Cb(WOLFSSL_CERT_MANAGER* cm, + CbMissingCRL cb); + WOLFSSL_API int wolfSSL_CertManagerSetCRL_ErrorCb(WOLFSSL_CERT_MANAGER* cm, + crlErrorCb cb, void* ctx); + WOLFSSL_API int wolfSSL_CertManagerFreeCRL(WOLFSSL_CERT_MANAGER* cm); +#ifdef HAVE_CRL_IO + WOLFSSL_API int wolfSSL_CertManagerSetCRL_IOCb(WOLFSSL_CERT_MANAGER* cm, + CbCrlIO cb); +#endif +#ifdef HAVE_CRL_UPDATE_CB + WOLFSSL_API int wolfSSL_CertManagerGetCRLInfo(WOLFSSL_CERT_MANAGER* cm, CrlInfo* info, + const byte* buff, long sz, int type); + WOLFSSL_API int wolfSSL_CertManagerSetCRLUpdate_Cb(WOLFSSL_CERT_MANAGER* cm, + CbUpdateCRL cb); +#endif +#if defined(HAVE_OCSP) + WOLFSSL_API int wolfSSL_CertManagerCheckOCSPResponse( + WOLFSSL_CERT_MANAGER* cm, unsigned char *response, int responseSz, + WOLFSSL_BUFFER_INFO *responseBuffer, CertStatus *status, + OcspEntry *entry, OcspRequest *ocspRequest); +#endif + WOLFSSL_API int wolfSSL_CertManagerCheckOCSP(WOLFSSL_CERT_MANAGER* cm, + const unsigned char* der, int sz); + WOLFSSL_API int wolfSSL_CertManagerEnableOCSP(WOLFSSL_CERT_MANAGER* cm, + int options); + WOLFSSL_API int wolfSSL_CertManagerDisableOCSP(WOLFSSL_CERT_MANAGER* cm); + WOLFSSL_API int wolfSSL_CertManagerSetOCSPOverrideURL( + WOLFSSL_CERT_MANAGER* cm, const char* url); + WOLFSSL_API int wolfSSL_CertManagerSetOCSP_Cb(WOLFSSL_CERT_MANAGER* cm, + CbOCSPIO ioCb, CbOCSPRespFree respFreeCb, void* ioCbCtx); + + WOLFSSL_API int wolfSSL_CertManagerEnableOCSPStapling( + WOLFSSL_CERT_MANAGER* cm); + WOLFSSL_API int wolfSSL_CertManagerDisableOCSPStapling( + WOLFSSL_CERT_MANAGER* cm); + WOLFSSL_API int wolfSSL_CertManagerEnableOCSPMustStaple( + WOLFSSL_CERT_MANAGER* cm); + WOLFSSL_API int wolfSSL_CertManagerDisableOCSPMustStaple( + WOLFSSL_CERT_MANAGER* cm); +#if defined(OPENSSL_EXTRA) && defined(WOLFSSL_SIGNER_DER_CERT) && \ + !defined(NO_FILESYSTEM) +WOLFSSL_API WOLFSSL_STACK* wolfSSL_CertManagerGetCerts( + WOLFSSL_CERT_MANAGER* cm); +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509)* wolfSSL_X509_STORE_get1_certs( + WOLFSSL_X509_STORE_CTX* ctx, WOLFSSL_X509_NAME* name); +#endif /* OPENSSL_EXTRA && WOLFSSL_SIGNER_DER_CERT && !NO_FILESYSTEM */ + WOLFSSL_API int wolfSSL_EnableCRL(WOLFSSL* ssl, int options); + WOLFSSL_API int wolfSSL_DisableCRL(WOLFSSL* ssl); + WOLFSSL_API int wolfSSL_LoadCRL(WOLFSSL* ssl, const char* path, int type, int monitor); + WOLFSSL_API int wolfSSL_LoadCRLFile(WOLFSSL* ssl, const char* file, int type); + WOLFSSL_API int wolfSSL_LoadCRLBuffer(WOLFSSL* ssl, + const unsigned char* buff, long sz, int type); + WOLFSSL_API int wolfSSL_SetCRL_Cb(WOLFSSL* ssl, CbMissingCRL cb); + WOLFSSL_API int wolfSSL_SetCRL_ErrorCb(WOLFSSL* ssl, crlErrorCb cb, + void* ctx); +#ifdef HAVE_CRL_IO + WOLFSSL_API int wolfSSL_SetCRL_IOCb(WOLFSSL* ssl, CbCrlIO cb); +#endif + WOLFSSL_API int wolfSSL_EnableOCSP(WOLFSSL* ssl, int options); + WOLFSSL_API int wolfSSL_DisableOCSP(WOLFSSL* ssl); + WOLFSSL_API int wolfSSL_SetOCSP_OverrideURL(WOLFSSL* ssl, const char* url); + WOLFSSL_API int wolfSSL_SetOCSP_Cb(WOLFSSL* ssl, CbOCSPIO ioCb, CbOCSPRespFree respFreeCb, void* ioCbCtx); + WOLFSSL_API int wolfSSL_EnableOCSPStapling(WOLFSSL* ssl); + WOLFSSL_API int wolfSSL_DisableOCSPStapling(WOLFSSL* ssl); + + WOLFSSL_API int wolfSSL_CTX_EnableCRL(WOLFSSL_CTX* ctx, int options); + WOLFSSL_API int wolfSSL_CTX_DisableCRL(WOLFSSL_CTX* ctx); + WOLFSSL_API int wolfSSL_CTX_LoadCRL(WOLFSSL_CTX* ctx, const char* path, int type, int monitor); + WOLFSSL_API int wolfSSL_CTX_LoadCRLFile(WOLFSSL_CTX* ctx, const char* path, int type); + WOLFSSL_API int wolfSSL_CTX_LoadCRLBuffer(WOLFSSL_CTX* ctx, + const unsigned char* buff, long sz, int type); + WOLFSSL_API int wolfSSL_CTX_SetCRL_Cb(WOLFSSL_CTX* ctx, CbMissingCRL cb); + WOLFSSL_API int wolfSSL_CTX_SetCRL_ErrorCb(WOLFSSL_CTX* ctx, crlErrorCb cb, + void* cbCtx); +#ifdef HAVE_CRL_IO + WOLFSSL_API int wolfSSL_CTX_SetCRL_IOCb(WOLFSSL_CTX* ctx, CbCrlIO cb); +#endif + + WOLFSSL_API int wolfSSL_CTX_EnableOCSP(WOLFSSL_CTX* ctx, int options); + WOLFSSL_API int wolfSSL_CTX_DisableOCSP(WOLFSSL_CTX* ctx); + WOLFSSL_API int wolfSSL_CTX_SetOCSP_OverrideURL(WOLFSSL_CTX* ctx, const char* url); + WOLFSSL_API int wolfSSL_CTX_SetOCSP_Cb(WOLFSSL_CTX* ctx, + CbOCSPIO ioCb, CbOCSPRespFree respFreeCb, void* ioCbCtx); + WOLFSSL_API int wolfSSL_CTX_EnableOCSPStapling(WOLFSSL_CTX* ctx); + WOLFSSL_API int wolfSSL_CTX_DisableOCSPStapling(WOLFSSL_CTX* ctx); + WOLFSSL_API int wolfSSL_CTX_EnableOCSPMustStaple(WOLFSSL_CTX* ctx); + WOLFSSL_API int wolfSSL_CTX_DisableOCSPMustStaple(WOLFSSL_CTX* ctx); +#endif /* !NO_CERTS */ + + +#ifdef SINGLE_THREADED + WOLFSSL_API int wolfSSL_CTX_new_rng(WOLFSSL_CTX* ctx); +#endif + +/* end of handshake frees temporary arrays, if user needs for get_keys or + psk hints, call KeepArrays before handshake and then FreeArrays when done + if don't want to wait for object free */ +WOLFSSL_API void wolfSSL_KeepArrays(WOLFSSL* ssl); +WOLFSSL_API void wolfSSL_FreeArrays(WOLFSSL* ssl); + +WOLFSSL_API int wolfSSL_KeepHandshakeResources(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_FreeHandshakeResources(WOLFSSL* ssl); + +WOLFSSL_API int wolfSSL_CTX_UseClientSuites(WOLFSSL_CTX* ctx); +WOLFSSL_API int wolfSSL_UseClientSuites(WOLFSSL* ssl); + +/* async additions */ +#define wolfSSL_UseAsync wolfSSL_SetDevId +#define wolfSSL_CTX_UseAsync wolfSSL_CTX_SetDevId +WOLFSSL_ABI WOLFSSL_API int wolfSSL_SetDevId(WOLFSSL* ssl, int devId); +WOLFSSL_ABI WOLFSSL_API int wolfSSL_CTX_SetDevId(WOLFSSL_CTX* ctx, int devId); + +/* helpers to get device id and heap */ +WOLFSSL_ABI WOLFSSL_API int wolfSSL_CTX_GetDevId(WOLFSSL_CTX* ctx, WOLFSSL* ssl); +WOLFSSL_API void* wolfSSL_CTX_GetHeap(WOLFSSL_CTX* ctx, WOLFSSL* ssl); + +/* TLS Extensions */ + +/* Server Name Indication */ +#ifdef HAVE_SNI + +/* SNI types */ +enum { + WOLFSSL_SNI_HOST_NAME = 0 +}; + +WOLFSSL_ABI WOLFSSL_API int wolfSSL_UseSNI(WOLFSSL* ssl, unsigned char type, + const void* data, unsigned short size); +WOLFSSL_ABI WOLFSSL_API int wolfSSL_CTX_UseSNI(WOLFSSL_CTX* ctx, unsigned char type, + const void* data, unsigned short size); + +#ifndef NO_WOLFSSL_SERVER + +/* SNI options */ +enum { + /* Do not abort the handshake if the requested SNI didn't match. */ + WOLFSSL_SNI_CONTINUE_ON_MISMATCH = 0x01, + + /* Behave as if the requested SNI matched in a case of mismatch. */ + /* In this case, the status will be set to WOLFSSL_SNI_FAKE_MATCH. */ + WOLFSSL_SNI_ANSWER_ON_MISMATCH = 0x02, + + /* Abort the handshake if the client didn't send a SNI request. */ + WOLFSSL_SNI_ABORT_ON_ABSENCE = 0x04 +}; + +WOLFSSL_API void wolfSSL_SNI_SetOptions(WOLFSSL* ssl, unsigned char type, + unsigned char options); +WOLFSSL_API void wolfSSL_CTX_SNI_SetOptions(WOLFSSL_CTX* ctx, + unsigned char type, unsigned char options); +WOLFSSL_API int wolfSSL_SNI_GetFromBuffer( + const unsigned char* clientHello, unsigned int helloSz, + unsigned char type, unsigned char* sni, unsigned int* inOutSz); + +#endif /* NO_WOLFSSL_SERVER */ + +/* SNI status */ +enum { + WOLFSSL_SNI_NO_MATCH = 0, + WOLFSSL_SNI_FAKE_MATCH = 1, /**< @see WOLFSSL_SNI_ANSWER_ON_MISMATCH */ + WOLFSSL_SNI_REAL_MATCH = 2, + WOLFSSL_SNI_FORCE_KEEP = 3 /** Used with -DWOLFSSL_ALWAYS_KEEP_SNI */ +}; + +WOLFSSL_API unsigned char wolfSSL_SNI_Status(WOLFSSL* ssl, unsigned char type); + +WOLFSSL_API unsigned short wolfSSL_SNI_GetRequest(WOLFSSL *ssl, + unsigned char type, void** data); + +#endif /* HAVE_SNI */ + +/* Trusted CA Key Indication - RFC 6066 (Section 6) */ +#ifdef HAVE_TRUSTED_CA + +/* TCA Identifier Type */ +enum { + WOLFSSL_TRUSTED_CA_PRE_AGREED = 0, + WOLFSSL_TRUSTED_CA_KEY_SHA1 = 1, + WOLFSSL_TRUSTED_CA_X509_NAME = 2, + WOLFSSL_TRUSTED_CA_CERT_SHA1 = 3 +}; + +WOLFSSL_API int wolfSSL_UseTrustedCA(WOLFSSL* ssl, unsigned char type, + const unsigned char* certId, unsigned int certIdSz); +#endif /* HAVE_TRUSTED_CA */ + +/* Application-Layer Protocol Negotiation */ +#ifdef HAVE_ALPN + +/* ALPN status code */ +enum { + WOLFSSL_ALPN_NO_MATCH = 0, + WOLFSSL_ALPN_MATCH = 1, + WOLFSSL_ALPN_CONTINUE_ON_MISMATCH = 2, + WOLFSSL_ALPN_FAILED_ON_MISMATCH = 4 +}; + +enum { + WOLFSSL_MAX_ALPN_PROTO_NAME_LEN = 255, + WOLFSSL_MAX_ALPN_NUMBER = 257 +}; + +#if defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) || \ + defined(WOLFSSL_HAPROXY) || defined(HAVE_LIGHTY) || \ + defined(WOLFSSL_QUIC) +typedef int (*CallbackALPNSelect)(WOLFSSL* ssl, const unsigned char** out, + unsigned char* outLen, const unsigned char* in, unsigned int inLen, + void *arg); +#endif + +WOLFSSL_ABI WOLFSSL_API int wolfSSL_UseALPN(WOLFSSL* ssl, + char *protocol_name_list, + unsigned int protocol_name_listSz, + unsigned char options); + +WOLFSSL_API int wolfSSL_ALPN_GetProtocol(WOLFSSL* ssl, char **protocol_name, + unsigned short *size); + +WOLFSSL_API int wolfSSL_ALPN_GetPeerProtocol(WOLFSSL* ssl, char **list, + unsigned short *listSz); +WOLFSSL_API int wolfSSL_ALPN_FreePeerProtocol(WOLFSSL* ssl, char **list); +#endif /* HAVE_ALPN */ + +/* Maximum Fragment Length */ +#ifdef HAVE_MAX_FRAGMENT + +/* Fragment lengths */ +enum { + WOLFSSL_MFL_DISABLED = 0, + WOLFSSL_MFL_2_9 = 1, /* 512 bytes */ + WOLFSSL_MFL_2_10 = 2, /* 1024 bytes */ + WOLFSSL_MFL_2_11 = 3, /* 2048 bytes */ + WOLFSSL_MFL_2_12 = 4, /* 4096 bytes */ + WOLFSSL_MFL_2_13 = 5, /* 8192 bytes *//* wolfSSL ONLY!!! */ + WOLFSSL_MFL_2_8 = 6, /* 256 bytes *//* wolfSSL ONLY!!! */ + WOLFSSL_MFL_MIN = WOLFSSL_MFL_2_9, + WOLFSSL_MFL_MAX = WOLFSSL_MFL_2_8 +}; + +#ifndef NO_WOLFSSL_CLIENT + +WOLFSSL_API int wolfSSL_UseMaxFragment(WOLFSSL* ssl, unsigned char mfl); +WOLFSSL_API int wolfSSL_CTX_UseMaxFragment(WOLFSSL_CTX* ctx, unsigned char mfl); + +#endif +#endif /* HAVE_MAX_FRAGMENT */ + +/* Truncated HMAC */ +#ifdef HAVE_TRUNCATED_HMAC +#ifndef NO_WOLFSSL_CLIENT + +WOLFSSL_API int wolfSSL_UseTruncatedHMAC(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_CTX_UseTruncatedHMAC(WOLFSSL_CTX* ctx); + +#endif +#endif + +/* Certificate Status Request */ +/* Certificate Status Type */ +enum { + WOLFSSL_CSR_OCSP = 1 +}; + +/* Certificate Status Options (flags) */ +enum { + WOLFSSL_CSR_OCSP_USE_NONCE = 0x01 +}; + +#ifdef HAVE_CERTIFICATE_STATUS_REQUEST +#ifndef NO_WOLFSSL_CLIENT + +WOLFSSL_API int wolfSSL_UseOCSPStapling(WOLFSSL* ssl, + unsigned char status_type, unsigned char options); + +WOLFSSL_API int wolfSSL_CTX_UseOCSPStapling(WOLFSSL_CTX* ctx, + unsigned char status_type, unsigned char options); + +#endif +#endif + +/* Certificate Status Request v2 */ +/* Certificate Status Type */ +enum { + WOLFSSL_CSR2_OCSP = 1, + WOLFSSL_CSR2_OCSP_MULTI = 2 +}; + +/* Certificate Status v2 Options (flags) */ +enum { + WOLFSSL_CSR2_OCSP_USE_NONCE = 0x01 +}; + +#ifdef HAVE_CERTIFICATE_STATUS_REQUEST_V2 +#ifndef NO_WOLFSSL_CLIENT + +WOLFSSL_API int wolfSSL_UseOCSPStaplingV2(WOLFSSL* ssl, + unsigned char status_type, unsigned char options); + +WOLFSSL_API int wolfSSL_CTX_UseOCSPStaplingV2(WOLFSSL_CTX* ctx, + unsigned char status_type, unsigned char options); + +#endif +#endif + +/* Named Groups */ +enum { + WOLFSSL_NAMED_GROUP_INVALID = 0, +#if 0 /* Not Supported */ + WOLFSSL_ECC_SECT163K1 = 1, + WOLFSSL_ECC_SECT163R1 = 2, + WOLFSSL_ECC_SECT163R2 = 3, + WOLFSSL_ECC_SECT193R1 = 4, + WOLFSSL_ECC_SECT193R2 = 5, + WOLFSSL_ECC_SECT233K1 = 6, + WOLFSSL_ECC_SECT233R1 = 7, + WOLFSSL_ECC_SECT239K1 = 8, + WOLFSSL_ECC_SECT283K1 = 9, + WOLFSSL_ECC_SECT283R1 = 10, + WOLFSSL_ECC_SECT409K1 = 11, + WOLFSSL_ECC_SECT409R1 = 12, + WOLFSSL_ECC_SECT571K1 = 13, + WOLFSSL_ECC_SECT571R1 = 14, +#endif + WOLFSSL_ECC_SECP160K1 = 15, + WOLFSSL_ECC_SECP160R1 = 16, + WOLFSSL_ECC_SECP160R2 = 17, + WOLFSSL_ECC_SECP192K1 = 18, + WOLFSSL_ECC_SECP192R1 = 19, + WOLFSSL_ECC_SECP224K1 = 20, + WOLFSSL_ECC_SECP224R1 = 21, + WOLFSSL_ECC_SECP256K1 = 22, + WOLFSSL_ECC_SECP256R1 = 23, + WOLFSSL_ECC_SECP384R1 = 24, + WOLFSSL_ECC_SECP521R1 = 25, + WOLFSSL_ECC_BRAINPOOLP256R1 = 26, + WOLFSSL_ECC_BRAINPOOLP384R1 = 27, + WOLFSSL_ECC_BRAINPOOLP512R1 = 28, + WOLFSSL_ECC_X25519 = 29, + WOLFSSL_ECC_X448 = 30, + WOLFSSL_ECC_SM2P256V1 = 41, + WOLFSSL_ECC_MAX = 41, + WOLFSSL_ECC_MAX_AVAIL = 46, + /* Update use of disabled curves when adding value greater than 46. */ + + WOLFSSL_FFDHE_START = 256, + WOLFSSL_FFDHE_2048 = 256, + WOLFSSL_FFDHE_3072 = 257, + WOLFSSL_FFDHE_4096 = 258, + WOLFSSL_FFDHE_6144 = 259, + WOLFSSL_FFDHE_8192 = 260, + WOLFSSL_FFDHE_END = 511, + +#ifdef HAVE_PQC + +#ifdef WOLFSSL_MLKEM_KYBER + /* Old code points to keep compatibility with Kyber Round 3. + * Taken from OQS's openssl provider, see: + * https://github.com/open-quantum-safe/oqs-provider/blob/main/oqs-template/ + * oqs-kem-info.md + */ + WOLFSSL_KYBER_LEVEL1 = 570, /* KYBER_512 */ + WOLFSSL_KYBER_LEVEL3 = 572, /* KYBER_768 */ + WOLFSSL_KYBER_LEVEL5 = 573, /* KYBER_1024 */ + + WOLFSSL_P256_KYBER_LEVEL1 = 12090, + WOLFSSL_P384_KYBER_LEVEL3 = 12092, + WOLFSSL_P521_KYBER_LEVEL5 = 12093, + WOLFSSL_X25519_KYBER_LEVEL1 = 12089, + WOLFSSL_X448_KYBER_LEVEL3 = 12176, + WOLFSSL_X25519_KYBER_LEVEL3 = 25497, + WOLFSSL_P256_KYBER_LEVEL3 = 25498, +#endif /* WOLFSSL_MLKEM_KYBER */ +#ifndef WOLFSSL_NO_ML_KEM + /* Taken from draft-connolly-tls-mlkem-key-agreement, see: + * https://github.com/dconnolly/draft-connolly-tls-mlkem-key-agreement/ + */ + WOLFSSL_ML_KEM_512 = 512, + WOLFSSL_ML_KEM_768 = 513, + WOLFSSL_ML_KEM_1024 = 514, + + /* Taken from draft-kwiatkowski-tls-ecdhe-mlkem. see: + * https://github.com/post-quantum-cryptography/ + * draft-kwiatkowski-tls-ecdhe-mlkem/ + */ + WOLFSSL_P256_ML_KEM_768 = 4587, + WOLFSSL_X25519_ML_KEM_768 = 4588, + WOLFSSL_P384_ML_KEM_1024 = 4589, + + /* Taken from OQS's openssl provider, see: + * https://github.com/open-quantum-safe/oqs-provider/blob/main/oqs-template/ + * oqs-kem-info.md + */ +#ifdef WOLFSSL_ML_KEM_USE_OLD_IDS + WOLFSSL_P256_ML_KEM_512_OLD = 12103, + WOLFSSL_P384_ML_KEM_768_OLD = 12104, + WOLFSSL_P521_ML_KEM_1024_OLD = 12105, +#endif + WOLFSSL_P256_ML_KEM_512 = 12107, + WOLFSSL_P384_ML_KEM_768 = 12108, + WOLFSSL_P521_ML_KEM_1024 = 12109, + WOLFSSL_X25519_ML_KEM_512 = 12214, + WOLFSSL_X448_ML_KEM_768 = 12215, +#endif /* WOLFSSL_NO_ML_KEM */ +#endif /* HAVE_PQC */ + WOLF_ENUM_DUMMY_LAST_ELEMENT(SSL_H) +}; + +enum { + WOLFSSL_EC_PF_UNCOMPRESSED = 0, +#if 0 /* Not Supported */ + WOLFSSL_EC_PF_X962_COMP_PRIME = 1, + WOLFSSL_EC_PF_X962_COMP_CHAR2 = 2, +#endif + WOLF_ENUM_DUMMY_LAST_ELEMENT(SSL_H) +}; + +#ifdef HAVE_SUPPORTED_CURVES +WOLFSSL_API int wolfSSL_UseSupportedCurve(WOLFSSL* ssl, word16 name); +WOLFSSL_API int wolfSSL_CTX_UseSupportedCurve(WOLFSSL_CTX* ctx, + word16 name); +#endif + +#ifdef WOLFSSL_TLS13 +WOLFSSL_API int wolfSSL_UseKeyShare(WOLFSSL* ssl, word16 group); +WOLFSSL_API int wolfSSL_NoKeyShares(WOLFSSL* ssl); +#endif + +#ifdef WOLFSSL_DUAL_ALG_CERTS +#define WOLFSSL_CKS_SIGSPEC_NATIVE 0x0001 +#define WOLFSSL_CKS_SIGSPEC_ALTERNATIVE 0x0002 +#define WOLFSSL_CKS_SIGSPEC_BOTH 0x0003 +#define WOLFSSL_CKS_SIGSPEC_EXTERNAL 0x0004 + +WOLFSSL_API int wolfSSL_UseCKS(WOLFSSL* ssl, byte *sigSpec, word16 sigSpecSz); +WOLFSSL_API int wolfSSL_CTX_UseCKS(WOLFSSL_CTX* ctx, byte *sigSpec, + word16 sigSpecSz); +#endif /* WOLFSSL_DUAL_ALG_CERTS */ + +/* Secure Renegotiation */ +#if defined(HAVE_SECURE_RENEGOTIATION) || defined(HAVE_SERVER_RENEGOTIATION_INFO) + +WOLFSSL_API int wolfSSL_UseSecureRenegotiation(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_CTX_UseSecureRenegotiation(WOLFSSL_CTX* ctx); +#ifdef HAVE_SECURE_RENEGOTIATION +WOLFSSL_API int wolfSSL_Rehandshake(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_SecureResume(WOLFSSL* ssl); +#endif +WOLFSSL_API long wolfSSL_SSL_get_secure_renegotiation_support(WOLFSSL* ssl); + +#endif + +#if defined(HAVE_SELFTEST) && \ + (!defined(HAVE_SELFTEST_VERSION) || (HAVE_SELFTEST_VERSION < 2)) + + /* Needed by session ticket stuff below */ + #ifndef WOLFSSL_AES_KEY_SIZE_ENUM + #define WOLFSSL_AES_KEY_SIZE_ENUM + enum SSL_Misc { + AES_IV_SIZE = 16, + AES_128_KEY_SIZE = 16, + AES_192_KEY_SIZE = 24, + AES_256_KEY_SIZE = 32 + }; + #endif +#endif + +/* Session Ticket */ +#ifdef HAVE_SESSION_TICKET + +#if !defined(WOLFSSL_NO_DEF_TICKET_ENC_CB) && !defined(NO_WOLFSSL_SERVER) + #ifdef WOLFSSL_TICKET_ENC_CBC_HMAC + #if defined(WOLFSSL_TICKET_ENC_HMAC_SHA512) + #define WOLFSSL_TICKET_ENC_HMAC WC_HASH_TYPE_SHA512 + #define WOLFSSL_TICKET_HMAC_KEY_SZ 64 + #elif defined(WOLFSSL_TICKET_ENC_HMAC_SHA384) + #define WOLFSSL_TICKET_ENC_HMAC WC_HASH_TYPE_SHA384 + #define WOLFSSL_TICKET_HMAC_KEY_SZ 48 + #else + #define WOLFSSL_TICKET_ENC_HMAC WC_HASH_TYPE_SHA256 + #define WOLFSSL_TICKET_HMAC_KEY_SZ 32 + #endif + #ifdef WOLFSSL_TICKET_ENC_AES256_CBC + #define WOLFSSL_TICKET_KEY_SZ \ + (AES_256_KEY_SIZE + WOLFSSL_TICKET_HMAC_KEY_SZ) + #else + #define WOLFSSL_TICKET_KEY_SZ \ + (AES_128_KEY_SIZE + WOLFSSL_TICKET_HMAC_KEY_SZ) + #endif + #elif defined(HAVE_CHACHA) && defined(HAVE_POLY1305) && \ + !defined(WOLFSSL_TICKET_ENC_AES128_GCM) && \ + !defined(WOLFSSL_TICKET_ENC_AES256_GCM) + #define WOLFSSL_TICKET_KEY_SZ CHACHA20_POLY1305_AEAD_KEYSIZE + #elif defined(WOLFSSL_TICKET_ENC_AES256_GCM) + #define WOLFSSL_TICKET_KEY_SZ AES_256_KEY_SIZE + #else + #define WOLFSSL_TICKET_KEY_SZ AES_128_KEY_SIZE + #endif + + #define WOLFSSL_TICKET_KEYS_SZ (WOLFSSL_TICKET_NAME_SZ + \ + 2 * WOLFSSL_TICKET_KEY_SZ + \ + sizeof(word32) * 2) +#endif + +#ifndef NO_WOLFSSL_CLIENT +WOLFSSL_API int wolfSSL_UseSessionTicket(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_CTX_UseSessionTicket(WOLFSSL_CTX* ctx); +WOLFSSL_API int wolfSSL_get_SessionTicket(WOLFSSL* ssl, unsigned char* buf, word32* bufSz); +WOLFSSL_API int wolfSSL_set_SessionTicket(WOLFSSL* ssl, const unsigned char* buf, word32 bufSz); +typedef int (*CallbackSessionTicket)(WOLFSSL* ssl, const unsigned char*, int, void*); +WOLFSSL_API int wolfSSL_set_SessionTicket_cb(WOLFSSL* ssl, + CallbackSessionTicket cb, void* ctx); +#endif /* NO_WOLFSSL_CLIENT */ +#ifndef NO_WOLFSSL_SERVER +WOLFSSL_API int wolfSSL_send_SessionTicket(WOLFSSL* ssl); +#endif /* !NO_WOLFSSL_SERVER */ + + +#define WOLFSSL_TICKET_NAME_SZ 16 +#define WOLFSSL_TICKET_IV_SZ 16 +#ifndef WOLFSSL_TICKET_ENC_CBC_HMAC + #define WOLFSSL_TICKET_MAC_SZ 32 +#else + #define WOLFSSL_TICKET_MAC_SZ WOLFSSL_TICKET_HMAC_KEY_SZ +#endif + +enum TicketEncRet { + WOLFSSL_TICKET_RET_FATAL = -1, /* fatal error, don't use ticket */ + WOLFSSL_TICKET_RET_OK = 0, /* ok, use ticket */ + WOLFSSL_TICKET_RET_REJECT, /* don't use ticket, but not fatal */ + WOLFSSL_TICKET_RET_CREATE /* existing ticket ok and create new one */ +}; + +#ifndef NO_WOLFSSL_SERVER + +WOLFSSL_API int wolfSSL_CTX_NoTicketTLSv12(WOLFSSL_CTX* ctx); +WOLFSSL_API int wolfSSL_NoTicketTLSv12(WOLFSSL* ssl); + +typedef int (*SessionTicketEncCb)(WOLFSSL* ssl, + unsigned char key_name[WOLFSSL_TICKET_NAME_SZ], + unsigned char iv[WOLFSSL_TICKET_IV_SZ], + unsigned char mac[WOLFSSL_TICKET_MAC_SZ], + int enc, unsigned char*, int, int*, void*); +WOLFSSL_API int wolfSSL_CTX_set_TicketEncCb(WOLFSSL_CTX* ctx, + SessionTicketEncCb cb); +WOLFSSL_API int wolfSSL_CTX_set_TicketHint(WOLFSSL_CTX* ctx, int hint); +WOLFSSL_API int wolfSSL_CTX_set_TicketEncCtx(WOLFSSL_CTX* ctx, void* userCtx); +WOLFSSL_API void* wolfSSL_CTX_get_TicketEncCtx(WOLFSSL_CTX* ctx); +WOLFSSL_API size_t wolfSSL_CTX_get_num_tickets(WOLFSSL_CTX* ctx); +WOLFSSL_API int wolfSSL_CTX_set_num_tickets(WOLFSSL_CTX* ctx, size_t mxTickets); + +#endif /* NO_WOLFSSL_SERVER */ + +#endif /* HAVE_SESSION_TICKET */ + +/* TLS Extended Master Secret Extension */ +WOLFSSL_API int wolfSSL_DisableExtendedMasterSecret(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_CTX_DisableExtendedMasterSecret(WOLFSSL_CTX* ctx); + + +#define WOLFSSL_CRL_MONITOR 0x01 /* monitor this dir flag */ +#define WOLFSSL_CRL_START_MON 0x02 /* start monitoring flag */ + + +#if defined(WOLFSSL_DTLS) && !defined(NO_WOLFSSL_SERVER) +WOLFSSL_API int wolfDTLS_accept_stateless(WOLFSSL* ssl); +/* notify user we parsed a verified ClientHello is done. This only has an effect + * on the server end. */ +typedef int (*ClientHelloGoodCb)(WOLFSSL* ssl, void*); +WOLFSSL_API int wolfDTLS_SetChGoodCb(WOLFSSL* ssl, ClientHelloGoodCb cb, void* user_ctx); +#endif + +/* notify user the handshake is done */ +typedef int (*HandShakeDoneCb)(WOLFSSL* ssl, void*); +WOLFSSL_API int wolfSSL_SetHsDoneCb(WOLFSSL* ssl, HandShakeDoneCb cb, void* user_ctx); + + +WOLFSSL_API int wolfSSL_PrintSessionStats(void); +WOLFSSL_API int wolfSSL_get_session_stats(unsigned int* active, + unsigned int* total, + unsigned int* peak, + unsigned int* maxSessions); +/* External facing KDF */ +WOLFSSL_API +int wolfSSL_MakeTlsMasterSecret(unsigned char* ms, word32 msLen, + const unsigned char* pms, word32 pmsLen, + const unsigned char* cr, const unsigned char* sr, + int tls1_2, int hash_type); + +WOLFSSL_API +int wolfSSL_MakeTlsExtendedMasterSecret(unsigned char* ms, word32 msLen, + const unsigned char* pms, word32 pmsLen, + const unsigned char* sHash, word32 sHashLen, + int tls1_2, int hash_type); + +WOLFSSL_API +int wolfSSL_DeriveTlsKeys(unsigned char* key_data, word32 keyLen, + const unsigned char* ms, word32 msLen, + const unsigned char* sr, const unsigned char* cr, + int tls1_2, int hash_type); + +#ifdef WOLFSSL_CALLBACKS + +typedef int (*HandShakeCallBack)(HandShakeInfo*); +typedef int (*TimeoutCallBack)(TimeoutInfo*); + +/* wolfSSL connect extension allowing HandShakeCallBack and/or TimeoutCallBack + for diagnostics */ +WOLFSSL_API int wolfSSL_connect_ex(WOLFSSL* ssl, HandShakeCallBack hsCb, + TimeoutCallBack toCb, WOLFSSL_TIMEVAL timeout); +WOLFSSL_API int wolfSSL_accept_ex(WOLFSSL* ssl, HandShakeCallBack hsCb, + TimeoutCallBack toCb, WOLFSSL_TIMEVAL timeout); + +#endif /* WOLFSSL_CALLBACKS */ + + +#ifdef WOLFSSL_HAVE_WOLFSCEP + WOLFSSL_API void wolfSSL_wolfSCEP(void); +#endif /* WOLFSSL_HAVE_WOLFSCEP */ + +#ifdef WOLFSSL_HAVE_CERT_SERVICE + WOLFSSL_API void wolfSSL_cert_service(void); +#endif + +#if defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) +/* Smaller subset of X509 compatibility functions. Avoid increasing the size of + * this subset and its memory usage */ + +#include <wolfssl/openssl/asn1.h> +struct WOLFSSL_X509_NAME_ENTRY { + WOLFSSL_ASN1_OBJECT* object; /* static object just for keeping grp, type */ + WOLFSSL_ASN1_STRING* value; /* points to data, for lighttpd port */ + int nid; /* i.e. ASN_COMMON_NAME */ + int set; + int size; +}; + +WOLFSSL_API int wolfSSL_X509_NAME_get_index_by_OBJ(WOLFSSL_X509_NAME *name, + const WOLFSSL_ASN1_OBJECT *obj, + int idx); + + + +enum { + WOLFSSL_SYS_ACCEPT = 0, + WOLFSSL_SYS_BIND, + WOLFSSL_SYS_CONNECT, + WOLFSSL_SYS_FOPEN, + WOLFSSL_SYS_FREAD, + WOLFSSL_SYS_GETADDRINFO, + WOLFSSL_SYS_GETSOCKOPT, + WOLFSSL_SYS_GETSOCKNAME, + WOLFSSL_SYS_GETHOSTBYNAME, + WOLFSSL_SYS_GETNAMEINFO, + WOLFSSL_SYS_GETSERVBYNAME, + WOLFSSL_SYS_IOCTLSOCKET, + WOLFSSL_SYS_LISTEN, + WOLFSSL_SYS_OPENDIR, + WOLFSSL_SYS_SETSOCKOPT, + WOLFSSL_SYS_SOCKET +}; + +/* Object functions */ +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) +/* Do not use - use wolfSSL_OBJ_sn2nid instead. */ +WOLFSSL_LOCAL int wc_OBJ_sn2nid(const char *sn); +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + +WOLFSSL_API const char* wolfSSL_OBJ_nid2sn(int n); +WOLFSSL_API int wolfSSL_OBJ_obj2nid(const WOLFSSL_ASN1_OBJECT *o); +WOLFSSL_API int wolfSSL_OBJ_get_type(const WOLFSSL_ASN1_OBJECT *o); +WOLFSSL_API int wolfSSL_OBJ_sn2nid(const char *sn); +WOLFSSL_API size_t wolfSSL_OBJ_length(const WOLFSSL_ASN1_OBJECT* o); +WOLFSSL_API const unsigned char* wolfSSL_OBJ_get0_data( + const WOLFSSL_ASN1_OBJECT* o); + +WOLFSSL_API const char* wolfSSL_OBJ_nid2ln(int n); +WOLFSSL_API int wolfSSL_OBJ_ln2nid(const char *ln); +WOLFSSL_API int wolfSSL_OBJ_cmp(const WOLFSSL_ASN1_OBJECT* a, + const WOLFSSL_ASN1_OBJECT* b); +WOLFSSL_API int wolfSSL_OBJ_txt2nid(const char *sn); +WOLFSSL_API WOLFSSL_ASN1_OBJECT* wolfSSL_OBJ_txt2obj(const char* s, int no_name); + +WOLFSSL_API WOLFSSL_ASN1_OBJECT* wolfSSL_OBJ_nid2obj(int n); +WOLFSSL_LOCAL WOLFSSL_ASN1_OBJECT* wolfSSL_OBJ_nid2obj_ex(int n, WOLFSSL_ASN1_OBJECT *arg_obj); +WOLFSSL_API int wolfSSL_OBJ_obj2txt(char *buf, int buf_len, + const WOLFSSL_ASN1_OBJECT *a, int no_name); + +WOLFSSL_API void wolfSSL_OBJ_cleanup(void); +WOLFSSL_API int wolfSSL_OBJ_create(const char *oid, const char *sn, const char *ln); +#ifdef HAVE_ECC +WOLFSSL_LOCAL int NIDToEccEnum(int n); +#endif + +#define WOLFSSL_OBJ_NAME_TYPE_UNDEF 0x00 +#define WOLFSSL_OBJ_NAME_TYPE_MD_METH 0x01 +#define WOLFSSL_OBJ_NAME_TYPE_CIPHER_METH 0x02 +#define WOLFSSL_OBJ_NAME_TYPE_PKEY_METH 0x03 +#define WOLFSSL_OBJ_NAME_TYPE_COMP_METH 0x04 +#define WOLFSSL_OBJ_NAME_TYPE_NUM 0x05 +#define WOLFSSL_OBJ_NAME_ALIAS 0x8000 + +WOLFSSL_API void wolfSSL_OBJ_NAME_do_all(int type, + void (*fn) (const WOLFSSL_OBJ_NAME* , void *arg), + void* arg); +/* end of object functions */ + +WOLFSSL_API unsigned long wolfSSL_ERR_peek_last_error_line(const char **file, int *line); +WOLFSSL_API long wolfSSL_CTX_ctrl(WOLFSSL_CTX* ctx, int cmd, long opt,void* pt); +WOLFSSL_API long wolfSSL_CTX_callback_ctrl(WOLFSSL_CTX* ctx, int cmd, void (*fp)(void)); +WOLFSSL_API long wolfSSL_CTX_clear_extra_chain_certs(WOLFSSL_CTX* ctx); + +WOLFSSL_API void wolfSSL_certs_clear(WOLFSSL* ssl); + +#ifndef NO_CERTS +WOLFSSL_API WOLFSSL_X509_NAME_ENTRY* wolfSSL_X509_NAME_ENTRY_create_by_NID( + WOLFSSL_X509_NAME_ENTRY** out, int nid, int type, + const unsigned char* data, int dataSz); +WOLFSSL_API WOLFSSL_X509_NAME_ENTRY* wolfSSL_X509_NAME_ENTRY_create_by_txt( + WOLFSSL_X509_NAME_ENTRY **neIn, const char *txt, int format, + const unsigned char *data, int dataSz); +WOLFSSL_API int wolfSSL_X509_NAME_add_entry(WOLFSSL_X509_NAME* name, + WOLFSSL_X509_NAME_ENTRY* entry, int idx, int set); +WOLFSSL_API int wolfSSL_X509_NAME_add_entry_by_txt(WOLFSSL_X509_NAME *name, + const char *field, int type, const unsigned char *bytes, int len, int loc, + int set); +#ifndef wolfSSL_X509_NAME_add_entry_by_NID +WOLFSSL_API int wolfSSL_X509_NAME_add_entry_by_NID(WOLFSSL_X509_NAME *name, int nid, + int type, const unsigned char *bytes, + int len, int loc, int set); +#endif +WOLFSSL_API WOLFSSL_X509_NAME_ENTRY *wolfSSL_X509_NAME_delete_entry( + WOLFSSL_X509_NAME *name, int loc); +WOLFSSL_API int wolfSSL_X509_NAME_cmp(const WOLFSSL_X509_NAME* x, + const WOLFSSL_X509_NAME* y); +WOLFSSL_API WOLFSSL_X509_NAME* wolfSSL_X509_NAME_new(void); +#ifndef wolfSSL_X509_NAME_new_ex +WOLFSSL_API WOLFSSL_X509_NAME* wolfSSL_X509_NAME_new_ex(void *heap); +#endif +WOLFSSL_API WOLFSSL_X509_NAME* wolfSSL_X509_NAME_dup(WOLFSSL_X509_NAME* name); +WOLFSSL_API int wolfSSL_X509_NAME_copy(WOLFSSL_X509_NAME* from, WOLFSSL_X509_NAME* to); +WOLFSSL_API int wolfSSL_check_private_key(const WOLFSSL* ssl); +#endif /* !NO_CERTS */ +#endif /* OPENSSL_ALL || OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + +#if defined(OPENSSL_ALL) || defined(WOLFSSL_ASIO) || defined(WOLFSSL_HAPROXY) \ + || defined(WOLFSSL_NGINX) || defined(WOLFSSL_QT) +WOLFSSL_API long wolfSSL_ctrl(WOLFSSL* ssl, int cmd, long opt, void* pt); +#endif + +#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL) +WOLFSSL_API void* wolfSSL_X509_get_ext_d2i(const WOLFSSL_X509* x509, + int nid, int* c, int* idx); +#endif /* OPENSSL_EXTRA || WOLFSSL_WPAS_SMALL */ + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_ALL) +#ifndef NO_CERTS +WOLFSSL_API unsigned int wolfSSL_X509_get_extension_flags(WOLFSSL_X509* x509); +WOLFSSL_API unsigned int wolfSSL_X509_get_key_usage(WOLFSSL_X509* x509); +WOLFSSL_API unsigned int wolfSSL_X509_get_extended_key_usage(WOLFSSL_X509* x509); +WOLFSSL_API int wolfSSL_X509_get_ext_count(const WOLFSSL_X509* passedCert); +WOLFSSL_API int wolfSSL_X509_get_ext_by_NID(const WOLFSSL_X509 *x, int nid, int lastpos); +WOLFSSL_API int wolfSSL_X509_add_ext(WOLFSSL_X509 *x, WOLFSSL_X509_EXTENSION *ex, int loc); +WOLFSSL_API WOLFSSL_X509_EXTENSION *wolfSSL_X509V3_EXT_i2d(int nid, int crit, + void *data); +WOLFSSL_API WOLFSSL_X509_EXTENSION *wolfSSL_X509_delete_ext(WOLFSSL_X509 *x509, int loc); +WOLFSSL_API WOLFSSL_X509_EXTENSION* wolfSSL_X509V3_EXT_conf_nid( + WOLF_LHASH_OF(CONF_VALUE)* conf, WOLFSSL_X509V3_CTX* ctx, int nid, + char* value); +WOLFSSL_API void wolfSSL_X509V3_set_ctx(WOLFSSL_X509V3_CTX* ctx, + WOLFSSL_X509* issuer, WOLFSSL_X509* subject, WOLFSSL_X509* req, + WOLFSSL_X509_CRL* crl, int flag); +WOLFSSL_API void wolfSSL_X509V3_set_ctx_nodb(WOLFSSL_X509V3_CTX* ctx); +WOLFSSL_API int wolfSSL_X509_digest(const WOLFSSL_X509* x509, + const WOLFSSL_EVP_MD* digest, unsigned char* buf, unsigned int* len); +WOLFSSL_API int wolfSSL_X509_pubkey_digest(const WOLFSSL_X509 *x509, + const WOLFSSL_EVP_MD *digest, unsigned char* buf, unsigned int* len); +WOLFSSL_API int wolfSSL_use_certificate(WOLFSSL* ssl, WOLFSSL_X509* x509); +WOLFSSL_API int wolfSSL_use_PrivateKey(WOLFSSL* ssl, WOLFSSL_EVP_PKEY* pkey); +WOLFSSL_API int wolfSSL_use_PrivateKey_ASN1(int pri, WOLFSSL* ssl, + const unsigned char* der, long derSz); +WOLFSSL_API WOLFSSL_EVP_PKEY *wolfSSL_get_privatekey(const WOLFSSL *ssl); +#ifndef NO_RSA +WOLFSSL_API int wolfSSL_use_RSAPrivateKey_ASN1(WOLFSSL* ssl, unsigned char* der, + long derSz); +#endif +WOLFSSL_API int wolfSSL_CTX_use_PrivateKey_ASN1(int pri, WOLFSSL_CTX* ctx, + unsigned char* der, long derSz); + +#if defined(WOLFSSL_QT) || defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA) +WOLFSSL_API int wolfSSL_X509_cmp(const WOLFSSL_X509* a, const WOLFSSL_X509* b); +WOLFSSL_API const WOLFSSL_STACK *wolfSSL_X509_get0_extensions(const WOLFSSL_X509 *x); +WOLFSSL_API const WOLFSSL_STACK *wolfSSL_X509_REQ_get_extensions(const WOLFSSL_X509 *x); +WOLFSSL_API WOLFSSL_X509_EXTENSION* wolfSSL_X509_get_ext(const WOLFSSL_X509* x, int loc); +WOLFSSL_API int wolfSSL_X509_get_ext_by_OBJ(const WOLFSSL_X509 *x, + const WOLFSSL_ASN1_OBJECT *obj, int lastpos); +WOLFSSL_API int wolfSSL_X509_OBJECT_set1_X509(WOLFSSL_X509_OBJECT *a, + WOLFSSL_X509 *obj); +WOLFSSL_API int wolfSSL_X509_OBJECT_set1_X509_CRL(WOLFSSL_X509_OBJECT *a, + WOLFSSL_X509_CRL *obj); +WOLFSSL_API WOLFSSL_X509_EXTENSION* wolfSSL_X509_set_ext(WOLFSSL_X509* x, int loc); +WOLFSSL_API int wolfSSL_X509_EXTENSION_get_critical(const WOLFSSL_X509_EXTENSION* ex); +WOLFSSL_API WOLFSSL_X509_EXTENSION* wolfSSL_X509_EXTENSION_new(void); +WOLFSSL_API WOLFSSL_X509_EXTENSION* wolfSSL_X509_EXTENSION_create_by_OBJ( + WOLFSSL_X509_EXTENSION* ex, WOLFSSL_ASN1_OBJECT *obj, int crit, + WOLFSSL_ASN1_STRING *data); +WOLFSSL_API WOLFSSL_X509_EXTENSION* wolfSSL_X509_EXTENSION_dup( + WOLFSSL_X509_EXTENSION* src); +WOLFSSL_API int wolfSSL_sk_X509_EXTENSION_push(WOLFSSL_STACK* sk, + WOLFSSL_X509_EXTENSION* ext); +WOLFSSL_API void wolfSSL_X509_EXTENSION_free(WOLFSSL_X509_EXTENSION* ext_to_free); +WOLFSSL_API WOLFSSL_STACK* wolfSSL_sk_new_x509_ext(void); +#endif + +WOLFSSL_API WOLFSSL_ASN1_OBJECT* wolfSSL_X509_EXTENSION_get_object(WOLFSSL_X509_EXTENSION* ext); +WOLFSSL_API int wolfSSL_X509_EXTENSION_set_object(WOLFSSL_X509_EXTENSION* ext, + const WOLFSSL_ASN1_OBJECT* obj); +WOLFSSL_API WOLFSSL_ASN1_STRING* wolfSSL_X509_EXTENSION_get_data(WOLFSSL_X509_EXTENSION* ext); +WOLFSSL_API int wolfSSL_X509_EXTENSION_set_data(WOLFSSL_X509_EXTENSION* ext, + WOLFSSL_ASN1_STRING* data); +#endif /* !NO_CERTS */ + +WOLFSSL_API WOLFSSL_DH *wolfSSL_DSA_dup_DH(const WOLFSSL_DSA *r); + +WOLFSSL_API int wolfSSL_SESSION_get_master_key(const WOLFSSL_SESSION* ses, + unsigned char* out, int outSz); +WOLFSSL_API int wolfSSL_SESSION_get_master_key_length(const WOLFSSL_SESSION* ses); + +WOLFSSL_API int wolfSSL_i2d_X509_bio(WOLFSSL_BIO* bio, WOLFSSL_X509* x509); +#ifdef WOLFSSL_CERT_REQ +WOLFSSL_API int wolfSSL_i2d_X509_REQ_bio(WOLFSSL_BIO* bio, WOLFSSL_X509* x509); +#endif +#if !defined(NO_FILESYSTEM) +WOLFSSL_API WOLFSSL_X509* wolfSSL_d2i_X509_fp(XFILE fp, + WOLFSSL_X509** x509); +#endif +WOLFSSL_API WOLFSSL_STACK* wolfSSL_X509_STORE_GetCerts(WOLFSSL_X509_STORE_CTX* s); +WOLFSSL_API WOLFSSL_X509* wolfSSL_d2i_X509_bio(WOLFSSL_BIO* bio, + WOLFSSL_X509** x509); +#ifdef WOLFSSL_CERT_REQ +WOLFSSL_API WOLFSSL_X509* wolfSSL_d2i_X509_REQ_bio(WOLFSSL_BIO* bio, + WOLFSSL_X509** x509); +#if !defined(NO_FILESYSTEM) +WOLFSSL_API WOLFSSL_X509* wolfSSL_d2i_X509_REQ_fp(XFILE fp, WOLFSSL_X509 **req); +#endif +#endif +#endif /* OPENSSL_EXTRA || OPENSSL_ALL */ + +#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL) +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509) *wolfSSL_get0_verified_chain( + const WOLFSSL *ssl); +WOLFSSL_API void wolfSSL_CTX_set_cert_store(WOLFSSL_CTX* ctx, + WOLFSSL_X509_STORE* str); +#ifdef OPENSSL_ALL +WOLFSSL_API int wolfSSL_CTX_set1_verify_cert_store(WOLFSSL_CTX* ctx, + WOLFSSL_X509_STORE* str); +#endif +WOLFSSL_API int wolfSSL_set0_verify_cert_store(WOLFSSL *ssl, + WOLFSSL_X509_STORE* str); +WOLFSSL_API int wolfSSL_set1_verify_cert_store(WOLFSSL *ssl, + WOLFSSL_X509_STORE* str); +WOLFSSL_API WOLFSSL_X509_STORE* wolfSSL_CTX_get_cert_store(const WOLFSSL_CTX* ctx); +#endif /* OPENSSL_EXTRA || WOLFSSL_WPAS_SMALL */ +#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL) || \ + defined(HAVE_SECRET_CALLBACK) +WOLFSSL_API size_t wolfSSL_get_server_random(const WOLFSSL *ssl, + unsigned char *out, size_t outlen); +WOLFSSL_API size_t wolfSSL_get_client_random(const WOLFSSL* ssl, + unsigned char* out, size_t outSz); +#endif /* OPENSSL_EXTRA || WOLFSSL_WPAS_SMALL || HAVE_SECRET_CALLBACK */ + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_ALL) +WOLFSSL_API size_t wolfSSL_BIO_wpending(const WOLFSSL_BIO *bio); +/* non-standard API to determine if BIO supports "pending" */ +WOLFSSL_API int wolfSSL_BIO_supports_pending(const WOLFSSL_BIO *bio); +WOLFSSL_API size_t wolfSSL_BIO_ctrl_pending(WOLFSSL_BIO *b); + +/* Definition for backwards comaptiblity */ +#define wolfSSL_get_server_tmp_key wolfSSL_get_peer_tmp_key +WOLFSSL_API int wolfSSL_get_peer_tmp_key(const WOLFSSL* ssl, WOLFSSL_EVP_PKEY** pkey); + +WOLFSSL_API int wolfSSL_CTX_set_min_proto_version(WOLFSSL_CTX* ctx, int version); +WOLFSSL_API int wolfSSL_CTX_set_max_proto_version(WOLFSSL_CTX* ctx, int version); +WOLFSSL_API int wolfSSL_set_min_proto_version(WOLFSSL* ssl, int version); +WOLFSSL_API int wolfSSL_set_max_proto_version(WOLFSSL* ssl, int version); +WOLFSSL_API int wolfSSL_CTX_get_min_proto_version(WOLFSSL_CTX* ctx); +WOLFSSL_API int wolfSSL_CTX_get_max_proto_version(WOLFSSL_CTX* ctx); + +WOLFSSL_API int wolfSSL_CTX_use_PrivateKey(WOLFSSL_CTX *ctx, + WOLFSSL_EVP_PKEY *pkey); +WOLFSSL_API WOLFSSL_X509 *wolfSSL_PEM_read_bio_X509(WOLFSSL_BIO *bp, + WOLFSSL_X509 **x, wc_pem_password_cb *cb, void *u); +#ifdef WOLFSSL_CERT_REQ +WOLFSSL_API WOLFSSL_X509 *wolfSSL_PEM_read_bio_X509_REQ(WOLFSSL_BIO *bp, + WOLFSSL_X509 **x, wc_pem_password_cb *cb, void *u); +#ifndef NO_FILESYSTEM +WOLFSSL_API WOLFSSL_X509* wolfSSL_PEM_read_X509_REQ(XFILE fp, WOLFSSL_X509** x, + wc_pem_password_cb* cb, void* u); +#endif +#endif +WOLFSSL_API WOLFSSL_X509_CRL *wolfSSL_PEM_read_bio_X509_CRL(WOLFSSL_BIO *bp, + WOLFSSL_X509_CRL **x, wc_pem_password_cb *cb, void *u); +WOLFSSL_API WOLFSSL_X509 *wolfSSL_PEM_read_bio_X509_AUX + (WOLFSSL_BIO *bp, WOLFSSL_X509 **x, wc_pem_password_cb *cb, void *u); +#ifndef NO_FILESYSTEM +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509_INFO)* wolfSSL_PEM_X509_INFO_read( + XFILE fp, WOLF_STACK_OF(WOLFSSL_X509_INFO)* sk, + wc_pem_password_cb* cb, void* u); +#endif +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509_INFO)* wolfSSL_PEM_X509_INFO_read_bio( + WOLFSSL_BIO* bio, WOLF_STACK_OF(WOLFSSL_X509_INFO)* sk, + wc_pem_password_cb* cb, void* u); +#ifndef NO_FILESYSTEM +WOLFSSL_API WOLFSSL_X509_CRL *wolfSSL_PEM_read_X509_CRL(XFILE fp, + WOLFSSL_X509_CRL **x, wc_pem_password_cb *cb, void *u); +#endif +WOLFSSL_API int wolfSSL_PEM_get_EVP_CIPHER_INFO(const char* header, + EncryptedInfo* cipher); +WOLFSSL_API int wolfSSL_PEM_do_header(EncryptedInfo* cipher, + unsigned char* data, long* len, + wc_pem_password_cb* callback, void* ctx); +#endif /* OPENSSL_EXTRA || OPENSSL_ALL */ + +/*lighttp compatibility */ + +#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL) || \ + defined(OPENSSL_EXTRA_X509_SMALL) +struct WOLFSSL_ASN1_BIT_STRING { + int length; + int type; + byte* data; + long flags; +}; + +struct WOLFSSL_CONF_CTX { + unsigned int flags; + WOLFSSL_CTX* ctx; + WOLFSSL* ssl; +}; + +WOLFSSL_API WOLFSSL_X509_NAME_ENTRY *wolfSSL_X509_NAME_get_entry(WOLFSSL_X509_NAME *name, int loc); +WOLFSSL_API int wolfSSL_X509_NAME_ENTRY_set(const WOLFSSL_X509_NAME_ENTRY *ne); +#endif /* OPENSSL_EXTRA || WOLFSSL_WPAS_SMALL */ + +#if defined(OPENSSL_EXTRA) \ + || defined(OPENSSL_ALL) \ + || defined(HAVE_LIGHTY) \ + || defined(WOLFSSL_MYSQL_COMPATIBLE) \ + || defined(HAVE_STUNNEL) \ + || defined(WOLFSSL_NGINX) \ + || defined(WOLFSSL_HAPROXY) \ + || defined(OPENSSL_EXTRA_X509_SMALL) +WOLFSSL_API void wolfSSL_X509_NAME_ENTRY_free(WOLFSSL_X509_NAME_ENTRY* ne); +WOLFSSL_API WOLFSSL_X509_NAME_ENTRY* wolfSSL_X509_NAME_ENTRY_new(void); +#ifndef wolfSSL_X509_NAME_free +WOLFSSL_API void wolfSSL_X509_NAME_free(WOLFSSL_X509_NAME* name); +#endif +WOLFSSL_API int wolfSSL_CTX_use_certificate(WOLFSSL_CTX* ctx, WOLFSSL_X509* x); +WOLFSSL_API int wolfSSL_CTX_add0_chain_cert(WOLFSSL_CTX* ctx, WOLFSSL_X509* x509); +WOLFSSL_API int wolfSSL_CTX_add1_chain_cert(WOLFSSL_CTX* ctx, WOLFSSL_X509* x509); +WOLFSSL_API int wolfSSL_add0_chain_cert(WOLFSSL* ssl, WOLFSSL_X509* x509); +WOLFSSL_API int wolfSSL_add1_chain_cert(WOLFSSL* ssl, WOLFSSL_X509* x509); +WOLFSSL_API int wolfSSL_BIO_read_filename(WOLFSSL_BIO *b, const char *name); +/* These are to be merged shortly */ +WOLFSSL_API void wolfSSL_set_verify_depth(WOLFSSL *ssl,int depth); +WOLFSSL_API int wolfSSL_set_app_data(WOLFSSL *ssl, void *arg); +WOLFSSL_API WOLFSSL_ASN1_OBJECT* wolfSSL_X509_NAME_ENTRY_get_object(WOLFSSL_X509_NAME_ENTRY *ne); +WOLFSSL_API unsigned char *wolfSSL_SHA1(const unsigned char *d, size_t n, unsigned char *md); +WOLFSSL_API unsigned char *wolfSSL_SHA224(const unsigned char *d, size_t n, unsigned char *md); +WOLFSSL_API unsigned char *wolfSSL_SHA256(const unsigned char *d, size_t n, unsigned char *md); +WOLFSSL_API unsigned char *wolfSSL_SHA384(const unsigned char *d, size_t n, unsigned char *md); +WOLFSSL_API unsigned char *wolfSSL_SHA512(const unsigned char *d, size_t n, unsigned char *md); +WOLFSSL_API int wolfSSL_X509_check_private_key(WOLFSSL_X509* x509, WOLFSSL_EVP_PKEY* pkey); +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509_NAME) *wolfSSL_dup_CA_list( WOLF_STACK_OF(WOLFSSL_X509_NAME) *sk ); +WOLFSSL_API int wolfSSL_X509_check_ca(WOLFSSL_X509 *x509); + +#ifndef NO_FILESYSTEM +WOLFSSL_API long wolfSSL_BIO_set_fp(WOLFSSL_BIO *bio, XFILE fp, int c); +WOLFSSL_API long wolfSSL_BIO_get_fp(WOLFSSL_BIO *bio, XFILE* fp); +#endif + +#endif /* OPENSSL_EXTRA || OPENSSL_ALL || HAVE_LIGHTY || \ + WOLFSSL_MYSQL_COMPATIBLE || HAVE_STUNNEL || WOLFSSL_NGINX || \ + WOLFSSL_HAPROXY */ + +#if defined(HAVE_LIGHTY) || defined(HAVE_STUNNEL) \ + || defined(WOLFSSL_MYSQL_COMPATIBLE) || defined(OPENSSL_EXTRA) +#ifndef NO_BIO +WOLFSSL_API WOLFSSL_BIO* wolfSSL_BIO_new_file(const char *filename, + const char *mode); +#ifndef NO_FILESYSTEM +WOLFSSL_API WOLFSSL_BIO* wolfSSL_BIO_new_fp(XFILE fp, int c); +#endif /* !NO_FILESYSTEM */ +#endif /* !NO_BIO */ +#endif + +#if defined(OPENSSL_ALL) \ + || defined(HAVE_STUNNEL) \ + || defined(HAVE_LIGHTY) \ + || defined(WOLFSSL_MYSQL_COMPATIBLE) \ + || defined(WOLFSSL_HAPROXY) \ + || defined(OPENSSL_EXTRA) +#define X509_BUFFER_SZ 8192 + +WOLFSSL_API long wolfSSL_CTX_set_tmp_dh(WOLFSSL_CTX* ctx, WOLFSSL_DH* dh); +WOLFSSL_API WOLFSSL_DH *wolfSSL_PEM_read_bio_DHparams(WOLFSSL_BIO *bp, + WOLFSSL_DH **x, wc_pem_password_cb *cb, void *u); +#ifndef NO_FILESYSTEM +WOLFSSL_API WOLFSSL_DH *wolfSSL_PEM_read_DHparams(XFILE fp, WOLFSSL_DH **x, + wc_pem_password_cb *cb, void *u); +#endif +WOLFSSL_API WOLFSSL_DSA *wolfSSL_PEM_read_bio_DSAparams(WOLFSSL_BIO *bp, + WOLFSSL_DSA **x, wc_pem_password_cb *cb, void *u); +WOLFSSL_API int wolfSSL_PEM_write_bio_X509_REQ(WOLFSSL_BIO *bp,WOLFSSL_X509 *x); +WOLFSSL_API int wolfSSL_PEM_write_bio_X509_AUX(WOLFSSL_BIO *bp,WOLFSSL_X509 *x); +WOLFSSL_API int wolfSSL_PEM_write_bio_X509(WOLFSSL_BIO *bp, WOLFSSL_X509 *x); +#endif /* HAVE_STUNNEL || HAVE_LIGHTY */ + +#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS) && defined(WOLFSSL_CERT_GEN) && \ + defined(WOLFSSL_CERT_REQ) +WOLFSSL_API int wolfSSL_i2d_X509_REQ(WOLFSSL_X509* req, unsigned char** out); +WOLFSSL_API WOLFSSL_X509* wolfSSL_X509_REQ_new(void); +WOLFSSL_API void wolfSSL_X509_REQ_free(WOLFSSL_X509* req); +WOLFSSL_API long wolfSSL_X509_REQ_get_version(const WOLFSSL_X509 *req); +WOLFSSL_API int wolfSSL_X509_REQ_set_version(WOLFSSL_X509 *x, long version); +WOLFSSL_API int wolfSSL_X509_REQ_sign(WOLFSSL_X509 *req, WOLFSSL_EVP_PKEY *pkey, + const WOLFSSL_EVP_MD *md); +WOLFSSL_API int wolfSSL_X509_REQ_sign_ctx(WOLFSSL_X509 *req, + WOLFSSL_EVP_MD_CTX* md_ctx); +WOLFSSL_API int wolfSSL_X509_REQ_add_extensions(WOLFSSL_X509* req, + WOLF_STACK_OF(WOLFSSL_X509_EXTENSION)* ext_sk); +WOLFSSL_API int wolfSSL_X509_REQ_set_subject_name(WOLFSSL_X509 *req, + WOLFSSL_X509_NAME *name); +WOLFSSL_API int wolfSSL_X509_REQ_set_pubkey(WOLFSSL_X509 *req, + WOLFSSL_EVP_PKEY *pkey); +WOLFSSL_API int wolfSSL_X509_REQ_add1_attr_by_NID(WOLFSSL_X509 *req, + int nid, int type, + const unsigned char *bytes, + int len); +WOLFSSL_API int wolfSSL_X509_REQ_add1_attr_by_txt(WOLFSSL_X509 *req, + const char *attrname, int type, + const unsigned char *bytes, int len); +WOLFSSL_API WOLFSSL_X509 *wolfSSL_X509_to_X509_REQ(WOLFSSL_X509 *x, + WOLFSSL_EVP_PKEY *pkey, const WOLFSSL_EVP_MD *md); +#endif + +#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS) && defined(WOLFSSL_CERT_GEN) || \ + defined(WOLFSSL_CERT_REQ) +WOLFSSL_API int wolfSSL_X509_REQ_get_attr_count(const WOLFSSL_X509 *req); +WOLFSSL_API WOLFSSL_X509_ATTRIBUTE *wolfSSL_X509_REQ_get_attr( + const WOLFSSL_X509 *req, int loc); +WOLFSSL_API int wolfSSL_X509_REQ_get_attr_by_NID(const WOLFSSL_X509 *req, + int nid, int lastpos); +WOLFSSL_API WOLFSSL_X509_ATTRIBUTE* wolfSSL_X509_ATTRIBUTE_new(void); +WOLFSSL_API void wolfSSL_X509_ATTRIBUTE_free(WOLFSSL_X509_ATTRIBUTE* attr); +WOLFSSL_API WOLFSSL_ASN1_TYPE *wolfSSL_X509_ATTRIBUTE_get0_type( + WOLFSSL_X509_ATTRIBUTE *attr, int idx); +#endif + +#if defined(OPENSSL_ALL) || defined(HAVE_STUNNEL) || defined(WOLFSSL_NGINX) \ + || defined(WOLFSSL_HAPROXY) || defined(OPENSSL_EXTRA) || defined(HAVE_LIGHTY) + +#include <wolfssl/openssl/crypto.h> + +WOLFSSL_API int wolfSSL_CRYPTO_set_mem_functions( + wolfSSL_OSSL_Malloc_cb m, + wolfSSL_OSSL_Realloc_cb r, + wolfSSL_OSSL_Free_cb f); +WOLFSSL_API int wolfSSL_CRYPTO_set_mem_ex_functions(void *(*m) (size_t, const char *, int), + void *(*r) (void *, size_t, const char *, int), void (*f) (void *)); + +WOLFSSL_API int wolfSSL_CRYPTO_memcmp(const void *a, const void *b, size_t size); + +WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_DH_768_prime(WOLFSSL_BIGNUM* bn); +WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_DH_1024_prime(WOLFSSL_BIGNUM* bn); +WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_DH_1536_prime(WOLFSSL_BIGNUM* bn); +WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_DH_2048_prime(WOLFSSL_BIGNUM* bn); +WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_DH_3072_prime(WOLFSSL_BIGNUM* bn); +WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_DH_4096_prime(WOLFSSL_BIGNUM* bn); +WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_DH_6144_prime(WOLFSSL_BIGNUM* bn); +WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_DH_8192_prime(WOLFSSL_BIGNUM* bn); + +WOLFSSL_API WOLFSSL_DH *wolfSSL_DH_generate_parameters(int prime_len, int generator, + void (*callback) (int, int, void *), void *cb_arg); + +WOLFSSL_API int wolfSSL_DH_generate_parameters_ex(WOLFSSL_DH* dh, int prime_len, int generator, + void (*callback) (int, int, void *)); + +WOLFSSL_API int wolfSSL_ERR_load_ERR_strings(void); +WOLFSSL_API void wolfSSL_ERR_load_crypto_strings(void); +WOLFSSL_API unsigned long wolfSSL_ERR_peek_last_error(void); + +WOLFSSL_API int wolfSSL_FIPS_mode(void); + +WOLFSSL_API int wolfSSL_FIPS_mode_set(int r); + +WOLFSSL_API int wolfSSL_RAND_set_rand_method(const WOLFSSL_RAND_METHOD *methods); + +WOLFSSL_API int wolfSSL_CIPHER_get_bits(const WOLFSSL_CIPHER *c, int *alg_bits); + +#define WOLF_SK_COMPARE_CB(type, arg) \ + int (*(arg)) (const type* const* a, const type* const* b) +WOLFSSL_API WOLFSSL_STACK* wolfSSL_sk_X509_new( + WOLF_SK_COMPARE_CB(WOLFSSL_X509, cb)); +WOLFSSL_API WOLFSSL_STACK* wolfSSL_sk_X509_new_null(void); +WOLFSSL_API int wolfSSL_sk_X509_num(const WOLF_STACK_OF(WOLFSSL_X509) *s); + +WOLFSSL_API WOLFSSL_STACK* wolfSSL_sk_X509_OBJECT_new(void); +WOLFSSL_API void wolfSSL_sk_X509_OBJECT_free(WOLFSSL_STACK* s); +WOLFSSL_API void wolfSSL_sk_X509_OBJECT_pop_free(WOLFSSL_STACK* s, + void (*f) (WOLFSSL_X509_OBJECT*)); +WOLFSSL_API int wolfSSL_sk_X509_OBJECT_push(WOLFSSL_STACK* sk, WOLFSSL_X509_OBJECT* obj); + +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509_OBJECT)* + wolfSSL_sk_X509_OBJECT_deep_copy( + const WOLF_STACK_OF(WOLFSSL_X509_OBJECT)* sk, + WOLFSSL_X509_OBJECT* (*c)(const WOLFSSL_X509_OBJECT*), + void (*f)(WOLFSSL_X509_OBJECT*)); + +WOLFSSL_API WOLFSSL_X509_INFO *wolfSSL_X509_INFO_new(void); +WOLFSSL_API void wolfSSL_X509_INFO_free(WOLFSSL_X509_INFO* info); + +WOLFSSL_API WOLFSSL_STACK* wolfSSL_sk_X509_INFO_new_null(void); +WOLFSSL_API int wolfSSL_sk_X509_INFO_num(const WOLF_STACK_OF(WOLFSSL_X509_INFO)* sk); +WOLFSSL_API WOLFSSL_X509_INFO* wolfSSL_sk_X509_INFO_value( + const WOLF_STACK_OF(WOLFSSL_X509_INFO)* sk, int i); +WOLFSSL_API int wolfSSL_sk_X509_INFO_push(WOLF_STACK_OF(WOLFSSL_X509_INFO)*, + WOLFSSL_X509_INFO* in); +WOLFSSL_API WOLFSSL_X509_INFO* wolfSSL_sk_X509_INFO_pop(WOLF_STACK_OF(WOLFSSL_X509_INFO)*); +WOLFSSL_API void wolfSSL_sk_X509_INFO_pop_free(WOLF_STACK_OF(WOLFSSL_X509_INFO)*, + void (*f) (WOLFSSL_X509_INFO*)); +WOLFSSL_API void wolfSSL_sk_X509_INFO_free(WOLF_STACK_OF(WOLFSSL_X509_INFO)*); + +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509_NAME)* wolfSSL_sk_X509_NAME_new( + WOLF_SK_COMPARE_CB(WOLFSSL_X509_NAME, cb)); +WOLFSSL_API int wolfSSL_sk_X509_NAME_push(WOLF_STACK_OF(WOLFSSL_X509_NAME)*, + WOLFSSL_X509_NAME* name); +WOLFSSL_API int wolfSSL_sk_X509_NAME_find(const WOLF_STACK_OF(WOLFSSL_X509_NAME)* sk, + WOLFSSL_X509_NAME* name); +WOLFSSL_API int wolfSSL_sk_X509_NAME_set_cmp_func( + WOLF_STACK_OF(WOLFSSL_X509_NAME)*, WOLF_SK_COMPARE_CB(WOLFSSL_X509_NAME, cb)); +WOLFSSL_API WOLFSSL_X509_NAME* wolfSSL_sk_X509_NAME_value(const WOLF_STACK_OF(WOLFSSL_X509_NAME)* sk, int i); +WOLFSSL_API int wolfSSL_sk_X509_NAME_num(const WOLF_STACK_OF(WOLFSSL_X509_NAME)* sk); +WOLFSSL_API WOLFSSL_X509_NAME* wolfSSL_sk_X509_NAME_pop(WOLF_STACK_OF(WOLFSSL_X509_NAME)*); +WOLFSSL_API void wolfSSL_sk_X509_NAME_pop_free(WOLF_STACK_OF(WOLFSSL_X509_NAME)*, + void (*f) (WOLFSSL_X509_NAME*)); +WOLFSSL_API void wolfSSL_sk_X509_NAME_free(WOLF_STACK_OF(WOLFSSL_X509_NAME) *); + +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509_NAME_ENTRY)* + wolfSSL_sk_X509_NAME_ENTRY_new(WOLF_SK_COMPARE_CB(WOLFSSL_X509_NAME_ENTRY, cb)); +WOLFSSL_API int wolfSSL_sk_X509_NAME_ENTRY_push(WOLF_STACK_OF(WOLFSSL_X509_NAME_ENTRY)* sk, + WOLFSSL_X509_NAME_ENTRY* name_entry); +WOLFSSL_API WOLFSSL_X509_NAME_ENTRY* + wolfSSL_sk_X509_NAME_ENTRY_value(const WOLF_STACK_OF(WOLFSSL_X509_NAME_ENTRY)* sk, int i); +WOLFSSL_API int wolfSSL_sk_X509_NAME_ENTRY_num(const WOLF_STACK_OF(WOLFSSL_X509_NAME_ENTRY)* sk); +WOLFSSL_API void wolfSSL_sk_X509_NAME_ENTRY_free(WOLF_STACK_OF(WOLFSSL_X509_NAME_ENTRY)* sk); + + +WOLFSSL_API int wolfSSL_sk_X509_OBJECT_num(const WOLF_STACK_OF(WOLFSSL_X509_OBJECT) *s); + +WOLFSSL_API int wolfSSL_X509_NAME_print_ex(WOLFSSL_BIO* bio,WOLFSSL_X509_NAME* name,int indent, + unsigned long flags); +#ifndef NO_FILESYSTEM +WOLFSSL_API int wolfSSL_X509_NAME_print_ex_fp(XFILE fp,WOLFSSL_X509_NAME* name,int indent, + unsigned long flags); +#endif + +WOLFSSL_API WOLFSSL_STACK *wolfSSL_sk_CONF_VALUE_new(WOLF_SK_COMPARE_CB(WOLFSSL_CONF_VALUE, compFunc)); +WOLFSSL_API void wolfSSL_sk_CONF_VALUE_free(struct WOLFSSL_STACK *sk); +WOLFSSL_API int wolfSSL_sk_CONF_VALUE_num(const WOLFSSL_STACK *sk); +WOLFSSL_API WOLFSSL_CONF_VALUE *wolfSSL_sk_CONF_VALUE_value( + const struct WOLFSSL_STACK *sk, int i); +WOLFSSL_API int wolfSSL_sk_CONF_VALUE_push(WOLF_STACK_OF(WOLFSSL_CONF_VALUE)* sk, + WOLFSSL_CONF_VALUE* val); +#endif /* OPENSSL_ALL || HAVE_STUNNEL || WOLFSSL_NGINX || WOLFSSL_HAPROXY || OPENSSL_EXTRA || HAVE_LIGHTY */ + +#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL) +WOLFSSL_API WOLFSSL_ASN1_BIT_STRING* wolfSSL_ASN1_BIT_STRING_new(void); +WOLFSSL_API void wolfSSL_ASN1_BIT_STRING_free(WOLFSSL_ASN1_BIT_STRING* str); +WOLFSSL_API WOLFSSL_ASN1_BIT_STRING* wolfSSL_X509_get0_pubkey_bitstr( + const WOLFSSL_X509* x); +WOLFSSL_API int wolfSSL_ASN1_BIT_STRING_get_bit( + const WOLFSSL_ASN1_BIT_STRING* str, int i); +WOLFSSL_API int wolfSSL_ASN1_BIT_STRING_set_bit( + WOLFSSL_ASN1_BIT_STRING* str, int pos, int val); +WOLFSSL_API int wolfSSL_i2d_ASN1_BIT_STRING(const WOLFSSL_ASN1_BIT_STRING* bstr, + unsigned char** pp); +WOLFSSL_API WOLFSSL_ASN1_BIT_STRING* wolfSSL_d2i_ASN1_BIT_STRING( + WOLFSSL_ASN1_BIT_STRING** out, const byte** src, long len); +#endif /* OPENSSL_EXTRA || WOLFSSL_WPAS_SMALL */ + +WOLFSSL_API int wolfSSL_version(WOLFSSL* ssl); + +#if defined(OPENSSL_ALL) || defined(HAVE_STUNNEL) || defined(WOLFSSL_NGINX) \ + || defined(WOLFSSL_HAPROXY) || defined(OPENSSL_EXTRA) || defined(HAVE_LIGHTY) + +WOLFSSL_API int wolfSSL_get_state(const WOLFSSL* ssl); + +WOLFSSL_API WOLFSSL_X509* wolfSSL_sk_X509_value(WOLF_STACK_OF(WOLFSSL_X509)*, int i); + +WOLFSSL_API WOLFSSL_X509* wolfSSL_sk_X509_shift(WOLF_STACK_OF(WOLFSSL_X509)*); + +WOLFSSL_API void* wolfSSL_sk_X509_OBJECT_value(WOLF_STACK_OF(WOLFSSL_X509_OBJECT)*, int i); +#endif /* OPENSSL_ALL || HAVE_STUNNEL || WOLFSSL_NGINX || WOLFSSL_HAPROXY || OPENSSL_EXTRA || HAVE_LIGHTY */ + +#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL) || defined(HAVE_EX_DATA) +WOLFSSL_API void* wolfSSL_SESSION_get_ex_data(const WOLFSSL_SESSION* session, int idx); + +WOLFSSL_API int wolfSSL_SESSION_set_ex_data(WOLFSSL_SESSION* session, int idx, void* data); +#ifdef HAVE_EX_DATA_CLEANUP_HOOKS +WOLFSSL_API int wolfSSL_SESSION_set_ex_data_with_cleanup( + WOLFSSL_SESSION* session, + int idx, + void* data, + wolfSSL_ex_data_cleanup_routine_t cleanup_routine); +#endif +#endif /* OPENSSL_EXTRA || WOLFSSL_WPAS_SMALL */ + +#if defined(OPENSSL_ALL) || defined(HAVE_STUNNEL) || defined(WOLFSSL_NGINX) \ + || defined(WOLFSSL_HAPROXY) || defined(OPENSSL_EXTRA) || defined(HAVE_LIGHTY) + +WOLFSSL_API const unsigned char* wolfSSL_SESSION_get_id( + const WOLFSSL_SESSION* sess, unsigned int* idLen); + +WOLFSSL_API int wolfSSL_SESSION_print(WOLFSSL_BIO* bp, const WOLFSSL_SESSION* session); + +WOLFSSL_API int wolfSSL_set_tlsext_host_name(WOLFSSL* ssl, const char* host_name); + +WOLFSSL_API const char* wolfSSL_get_servername(WOLFSSL* ssl, unsigned char type); + +WOLFSSL_API WOLFSSL_CTX* wolfSSL_set_SSL_CTX(WOLFSSL* ssl,WOLFSSL_CTX* ctx); + +WOLFSSL_API VerifyCallback wolfSSL_CTX_get_verify_callback(WOLFSSL_CTX* ctx); + +WOLFSSL_API VerifyCallback wolfSSL_get_verify_callback(WOLFSSL* ssl); + +#endif /* OPENSSL_ALL || HAVE_STUNNEL || WOLFSSL_NGINX || WOLFSSL_HAPROXY || HAVE_LIGHTY */ + +#ifdef HAVE_SNI +/* SNI received callback type */ +typedef int (*CallbackSniRecv)(WOLFSSL *ssl, int *ret, void* exArg); + +WOLFSSL_API void wolfSSL_CTX_set_servername_callback(WOLFSSL_CTX* ctx, + CallbackSniRecv cb); + +WOLFSSL_API int wolfSSL_CTX_set_servername_arg(WOLFSSL_CTX* ctx, void* arg); +#endif + +#if defined(OPENSSL_ALL) || defined(HAVE_STUNNEL) || defined(WOLFSSL_NGINX) || \ + defined(WOLFSSL_HAPROXY) || defined(OPENSSL_EXTRA) || defined(HAVE_LIGHTY) + +#ifdef HAVE_SNI +WOLFSSL_API int wolfSSL_CTX_set_tlsext_servername_callback(WOLFSSL_CTX* ctx, + CallbackSniRecv cb); +#endif + +WOLFSSL_API void wolfSSL_ERR_remove_thread_state(void* pid); + +/* support for deprecated old name */ +#define WOLFSSL_ERR_remove_thread_state wolfSSL_ERR_remove_thread_state + +#ifndef NO_FILESYSTEM +WOLFSSL_API void wolfSSL_print_all_errors_fp(XFILE fp); +#endif + +WOLFSSL_API int wolfSSL_THREADID_set_callback( + void (*threadid_func)(WOLFSSL_CRYPTO_THREADID*)); + +WOLFSSL_API void wolfSSL_THREADID_set_numeric(void* id, unsigned long val); +WOLFSSL_API void wolfSSL_THREADID_current(WOLFSSL_CRYPTO_THREADID* id); +WOLFSSL_API unsigned long wolfSSL_THREADID_hash( + const WOLFSSL_CRYPTO_THREADID* id); + +WOLFSSL_API WOLFSSL_X509_LOOKUP_TYPE wolfSSL_X509_OBJECT_get_type( + const WOLFSSL_X509_OBJECT* obj); +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509_OBJECT)* + wolfSSL_X509_STORE_get0_objects(WOLFSSL_X509_STORE* store); +WOLFSSL_API WOLFSSL_X509_OBJECT* + wolfSSL_sk_X509_OBJECT_delete(WOLF_STACK_OF(WOLFSSL_X509_OBJECT)* sk, int i); +WOLFSSL_API WOLFSSL_X509_OBJECT* wolfSSL_X509_OBJECT_new(void); +WOLFSSL_API void wolfSSL_X509_OBJECT_free(WOLFSSL_X509_OBJECT *obj); +WOLFSSL_API WOLFSSL_X509 *wolfSSL_X509_OBJECT_get0_X509(const WOLFSSL_X509_OBJECT *obj); +WOLFSSL_API WOLFSSL_X509_CRL *wolfSSL_X509_OBJECT_get0_X509_CRL(WOLFSSL_X509_OBJECT *obj); + +WOLFSSL_API WOLFSSL_X509_OBJECT *wolfSSL_X509_OBJECT_retrieve_by_subject( + WOLF_STACK_OF(WOLFSSL_X509_OBJECT) *sk, + WOLFSSL_X509_LOOKUP_TYPE type, + WOLFSSL_X509_NAME *name); +#endif /* OPENSSL_ALL || HAVE_STUNNEL || WOLFSSL_NGINX || WOLFSSL_HAPROXY || HAVE_LIGHTY */ + +#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL) +#include <wolfssl/openssl/stack.h> +WOLFSSL_API void wolfSSL_sk_X509_pop_free(WOLF_STACK_OF(WOLFSSL_X509)* sk, void (*f) (WOLFSSL_X509*)); +#endif /* OPENSSL_EXTRA || WOLFSSL_WPAS_SMALL */ + +#if (defined(OPENSSL_EXTRA) || defined(HAVE_CURL)) && (defined(HAVE_ECC) || \ + defined(HAVE_CURVE25519) || defined(HAVE_CURVE448)) +WOLFSSL_API int wolfSSL_CTX_set1_curves_list(WOLFSSL_CTX* ctx, const char* names); +WOLFSSL_API int wolfSSL_set1_curves_list(WOLFSSL* ssl, const char* names); +#endif + +#if defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA) || defined(HAVE_STUNNEL) || \ + defined(WOLFSSL_MYSQL_COMPATIBLE) || defined(WOLFSSL_NGINX) +WOLFSSL_API int wolfSSL_get_verify_mode(const WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_CTX_get_verify_mode(const WOLFSSL_CTX* ctx); +#endif + +#ifdef WOLFSSL_JNI +WOLFSSL_API int wolfSSL_set_jobject(WOLFSSL* ssl, void* objPtr); +WOLFSSL_API void* wolfSSL_get_jobject(WOLFSSL* ssl); +#endif /* WOLFSSL_JNI */ + + +#ifdef WOLFSSL_ASYNC_CRYPT +WOLFSSL_API int wolfSSL_AsyncPoll(WOLFSSL* ssl, WOLF_EVENT_FLAG flags); +WOLFSSL_API int wolfSSL_CTX_AsyncPoll(WOLFSSL_CTX* ctx, WOLF_EVENT** events, int maxEvents, + WOLF_EVENT_FLAG flags, int* eventCount); +#endif /* WOLFSSL_ASYNC_CRYPT */ + +typedef void (*Rem_Sess_Cb)(WOLFSSL_CTX*, WOLFSSL_SESSION*); + +#ifdef OPENSSL_EXTRA +typedef void (*SSL_Msg_Cb)(int write_p, int version, int content_type, + const void *buf, size_t len, WOLFSSL *ssl, void *arg); + +#if defined(HAVE_SECRET_CALLBACK) +typedef void (*wolfSSL_CTX_keylog_cb_func) + (const WOLFSSL* ssl, const char* line); +WOLFSSL_API void wolfSSL_CTX_set_keylog_callback(WOLFSSL_CTX* ctx, + wolfSSL_CTX_keylog_cb_func cb); +WOLFSSL_API wolfSSL_CTX_keylog_cb_func wolfSSL_CTX_get_keylog_callback( + const WOLFSSL_CTX* ctx); +#endif /* HAVE_SECRET_CALLBACK */ + +WOLFSSL_API int wolfSSL_CTX_set_msg_callback(WOLFSSL_CTX *ctx, SSL_Msg_Cb cb); +WOLFSSL_API int wolfSSL_set_msg_callback(WOLFSSL *ssl, SSL_Msg_Cb cb); +WOLFSSL_API int wolfSSL_CTX_set_msg_callback_arg(WOLFSSL_CTX *ctx, void* arg); +WOLFSSL_API int wolfSSL_set_msg_callback_arg(WOLFSSL *ssl, void* arg); +WOLFSSL_API unsigned long wolfSSL_ERR_peek_error_line_data(const char **file, + int *line, const char **data, int *flags); +WOLFSSL_API int wolfSSL_CTX_set_alpn_protos(WOLFSSL_CTX *ctx, + const unsigned char *protos, unsigned int protos_len); +WOLFSSL_API int wolfSSL_set_alpn_protos(WOLFSSL* ssl, + const unsigned char* protos, unsigned int protos_len); +WOLFSSL_API void *wolfSSL_OPENSSL_memdup(const void *data, + size_t siz, const char* file, int line); +WOLFSSL_API void wolfSSL_OPENSSL_cleanse(void *ptr, size_t len); +WOLFSSL_API void wolfSSL_ERR_load_BIO_strings(void); +WOLFSSL_API void wolfSSL_DH_get0_pqg(const WOLFSSL_DH* dh, + const WOLFSSL_BIGNUM** p, const WOLFSSL_BIGNUM** q, + const WOLFSSL_BIGNUM** g); +WOLFSSL_API void wolfSSL_DH_get0_key(const WOLFSSL_DH *dh, + const WOLFSSL_BIGNUM **pub_key, const WOLFSSL_BIGNUM **priv_key); +WOLFSSL_API int wolfSSL_DH_set0_key(WOLFSSL_DH *dh, WOLFSSL_BIGNUM *pub_key, + WOLFSSL_BIGNUM *priv_key); +#endif + +#if defined(HAVE_OCSP) && !defined(NO_ASN_TIME) + WOLFSSL_API int wolfSSL_get_ocsp_producedDate( + WOLFSSL *ssl, + byte *producedDate, + size_t producedDate_space, + int *producedDateFormat); + WOLFSSL_API int wolfSSL_get_ocsp_producedDate_tm(WOLFSSL *ssl, + struct tm *produced_tm); +#endif + +#if defined(OPENSSL_ALL) \ + || defined(WOLFSSL_NGINX) \ + || defined(WOLFSSL_HAPROXY) \ + || defined(OPENSSL_EXTRA) \ + || defined(HAVE_STUNNEL) +WOLFSSL_API void wolfSSL_OPENSSL_config(char *config_name); +#endif + +#if defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) +/* Not an OpenSSL API. */ +WOLFSSL_LOCAL int wolfSSL_get_ocsp_response(WOLFSSL* ssl, byte** response); +/* Not an OpenSSL API. */ +WOLFSSL_LOCAL char* wolfSSL_get_ocsp_url(WOLFSSL* ssl); +/* Not an OpenSSL API. */ +WOLFSSL_API int wolfSSL_set_ocsp_url(WOLFSSL* ssl, char* url); +#endif + +#if defined(OPENSSL_EXTRA) || defined(HAVE_SECRET_CALLBACK) +WOLFSSL_API long wolfSSL_SSL_CTX_get_timeout(const WOLFSSL_CTX *ctx); +WOLFSSL_API long wolfSSL_get_timeout(WOLFSSL* ssl); +#endif + +#if defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) \ + || defined(OPENSSL_EXTRA) || defined(HAVE_LIGHTY) +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_CIPHER) *wolfSSL_get_ciphers_compat(const WOLFSSL *ssl); +WOLFSSL_API int wolfSSL_X509_NAME_digest(const WOLFSSL_X509_NAME *data, + const WOLFSSL_EVP_MD *type, unsigned char *md, unsigned int *len); +WOLFSSL_API int wolfSSL_SSL_CTX_set_tmp_ecdh(WOLFSSL_CTX *ctx, + WOLFSSL_EC_KEY *ecdh); +WOLFSSL_API WOLFSSL_BIO *wolfSSL_SSL_get_rbio(const WOLFSSL *s); +WOLFSSL_API WOLFSSL_BIO *wolfSSL_SSL_get_wbio(const WOLFSSL *s); +WOLFSSL_API int wolfSSL_SSL_do_handshake(WOLFSSL *s); +#ifdef OPENSSL_EXTRA +WOLFSSL_API int wolfSSL_OPENSSL_init_ssl(word64 opts, + const WOLFSSL_INIT_SETTINGS *settings); +WOLFSSL_API WOLFSSL_INIT_SETTINGS* wolfSSL_OPENSSL_INIT_new(void); +WOLFSSL_API void wolfSSL_OPENSSL_INIT_free(WOLFSSL_INIT_SETTINGS* init); +WOLFSSL_API int wolfSSL_OPENSSL_INIT_set_config_appname( + WOLFSSL_INIT_SETTINGS* init, char* appname); +#endif +#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L +WOLFSSL_API int wolfSSL_SSL_in_init(const WOLFSSL* ssl); +#else +WOLFSSL_API int wolfSSL_SSL_in_init(WOLFSSL* ssl); +#endif +WOLFSSL_API int wolfSSL_SSL_in_before(const WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_SSL_in_connect_init(WOLFSSL* ssl); + +#ifndef NO_SESSION_CACHE + WOLFSSL_API int wolfSSL_SSL_CTX_remove_session(WOLFSSL_CTX* ctx, + WOLFSSL_SESSION *c); + WOLFSSL_API WOLFSSL_SESSION *wolfSSL_SSL_get0_session(const WOLFSSL *s); +#endif + +WOLFSSL_API int wolfSSL_i2a_ASN1_INTEGER(WOLFSSL_BIO *bp, + const WOLFSSL_ASN1_INTEGER *a); + +#ifdef HAVE_SESSION_TICKET +typedef int (*ticketCompatCb)(WOLFSSL *ssl, unsigned char *name, unsigned char *iv, + WOLFSSL_EVP_CIPHER_CTX *ectx, WOLFSSL_HMAC_CTX *hctx, int enc); +WOLFSSL_API int wolfSSL_CTX_set_tlsext_ticket_key_cb(WOLFSSL_CTX* ctx, ticketCompatCb cb); +#endif + +#if defined(HAVE_OCSP) || defined(OPENSSL_EXTRA) || defined(OPENSSL_ALL) || \ + defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) +WOLFSSL_API int wolfSSL_CTX_get_extra_chain_certs(WOLFSSL_CTX* ctx, + WOLF_STACK_OF(X509)** chain); +typedef int(*tlsextStatusCb)(WOLFSSL* ssl, void*); +WOLFSSL_API int wolfSSL_CTX_get_tlsext_status_cb(WOLFSSL_CTX* ctx, tlsextStatusCb* cb); +WOLFSSL_API int wolfSSL_CTX_set_tlsext_status_cb(WOLFSSL_CTX* ctx, tlsextStatusCb cb); + +WOLFSSL_API int wolfSSL_CTX_get0_chain_certs(WOLFSSL_CTX *ctx, + WOLF_STACK_OF(WOLFSSL_X509) **sk); +WOLFSSL_API int wolfSSL_get0_chain_certs(WOLFSSL *ssl, + WOLF_STACK_OF(WOLFSSL_X509) **sk); + +WOLFSSL_API int wolfSSL_X509_STORE_CTX_get1_issuer(WOLFSSL_X509 **issuer, + WOLFSSL_X509_STORE_CTX *ctx, WOLFSSL_X509 *x); + +WOLFSSL_API void wolfSSL_X509_email_free(WOLF_STACK_OF(WOLFSSL_STRING) *sk); +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_STRING) *wolfSSL_X509_get1_ocsp(WOLFSSL_X509 *x); + +WOLFSSL_API int wolfSSL_X509_check_issued(WOLFSSL_X509 *issuer, + WOLFSSL_X509 *subject); + +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_STRING)* wolfSSL_sk_WOLFSSL_STRING_new(void); +WOLFSSL_API void wolfSSL_WOLFSSL_STRING_free(WOLFSSL_STRING s); +WOLFSSL_API void wolfSSL_sk_WOLFSSL_STRING_free(WOLF_STACK_OF(WOLFSSL_STRING)* sk); +WOLFSSL_API WOLFSSL_STRING wolfSSL_sk_WOLFSSL_STRING_value( + WOLF_STACK_OF(WOLFSSL_STRING)* strings, int idx); +WOLFSSL_API int wolfSSL_sk_WOLFSSL_STRING_num( + WOLF_STACK_OF(WOLFSSL_STRING)* strings); +#endif /* HAVE_OCSP || OPENSSL_EXTRA || OPENSSL_ALL || WOLFSSL_NGINX || WOLFSSL_HAPROXY */ + +WOLFSSL_API int PEM_write_bio_WOLFSSL_X509(WOLFSSL_BIO *bio, + WOLFSSL_X509 *cert); + +#endif /* OPENSSL_ALL || WOLFSSL_NGINX || WOLFSSL_HAPROXY || + OPENSSL_EXTRA || HAVE_LIGHTY */ + +#if defined(HAVE_SESSION_TICKET) && !defined(WOLFSSL_NO_DEF_TICKET_ENC_CB) && \ + !defined(NO_WOLFSSL_SERVER) +WOLFSSL_API long wolfSSL_CTX_get_tlsext_ticket_keys(WOLFSSL_CTX *ctx, + unsigned char *keys, int keylen); +WOLFSSL_API long wolfSSL_CTX_set_tlsext_ticket_keys(WOLFSSL_CTX *ctx, + const void *keys_vp, int keylen); +#endif + +WOLFSSL_API void wolfSSL_get0_alpn_selected(const WOLFSSL *ssl, + const unsigned char **data, unsigned int *len); +WOLFSSL_API int wolfSSL_select_next_proto(unsigned char **out, + unsigned char *outlen, + const unsigned char *in, unsigned int inlen, + const unsigned char *client, + unsigned int client_len); +WOLFSSL_API void wolfSSL_set_alpn_select_cb(WOLFSSL *ssl, + int (*cb) (WOLFSSL *ssl, + const unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen, + void *arg), void *arg); +WOLFSSL_API void wolfSSL_CTX_set_alpn_select_cb(WOLFSSL_CTX *ctx, + int (*cb) (WOLFSSL *ssl, + const unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen, + void *arg), void *arg); +WOLFSSL_API void wolfSSL_CTX_set_next_protos_advertised_cb(WOLFSSL_CTX *s, + int (*cb) (WOLFSSL *ssl, + const unsigned char **out, + unsigned int *outlen, + void *arg), void *arg); +WOLFSSL_API void wolfSSL_CTX_set_next_proto_select_cb(WOLFSSL_CTX *s, + int (*cb) (WOLFSSL *ssl, + unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen, + void *arg), void *arg); +WOLFSSL_API void wolfSSL_get0_next_proto_negotiated(const WOLFSSL *s, const unsigned char **data, + unsigned *len); + +#ifndef NO_ASN +WOLFSSL_API int wolfSSL_X509_check_host(WOLFSSL_X509 *x, const char *chk, + size_t chklen, unsigned int flags, char **peername); +WOLFSSL_API int wolfSSL_X509_check_ip_asc(WOLFSSL_X509 *x, const char *ipasc, + unsigned int flags); +#endif +#if defined(OPENSSL_EXTRA) && defined(WOLFSSL_CERT_GEN) +WOLFSSL_API int wolfSSL_X509_check_email(WOLFSSL_X509 *x, const char *chk, + size_t chkLen, unsigned int flags); +#endif /* OPENSSL_EXTRA && WOLFSSL_CERT_GEN */ + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) +#if defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) || defined(WOLFSSL_WPAS) +WOLFSSL_API const unsigned char *wolfSSL_SESSION_get0_id_context( + const WOLFSSL_SESSION *sess, unsigned int *sid_ctx_length); +#endif +#endif + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) +WOLFSSL_API int wolfSSL_SESSION_set1_id(WOLFSSL_SESSION *s, + const unsigned char *sid, unsigned int sid_len); +WOLFSSL_API int wolfSSL_SESSION_set1_id_context(WOLFSSL_SESSION *s, + const unsigned char *sid_ctx, unsigned int sid_ctx_len); +WOLFSSL_API WOLFSSL_X509_ALGOR* wolfSSL_X509_ALGOR_new(void); +WOLFSSL_API void wolfSSL_X509_ALGOR_free(WOLFSSL_X509_ALGOR *alg); +WOLFSSL_API const WOLFSSL_X509_ALGOR* wolfSSL_X509_get0_tbs_sigalg(const WOLFSSL_X509 *x); +WOLFSSL_API void wolfSSL_X509_ALGOR_get0(const WOLFSSL_ASN1_OBJECT **paobj, int *pptype, const void **ppval, const WOLFSSL_X509_ALGOR *algor); +WOLFSSL_API int wolfSSL_X509_ALGOR_set0(WOLFSSL_X509_ALGOR *algor, WOLFSSL_ASN1_OBJECT *aobj, int ptype, void *pval); +WOLFSSL_API int wolfSSL_i2d_X509_ALGOR(const WOLFSSL_X509_ALGOR* alg, + unsigned char** pp); +WOLFSSL_API WOLFSSL_X509_ALGOR* wolfSSL_d2i_X509_ALGOR(WOLFSSL_X509_ALGOR** out, + const byte** src, long len); +WOLFSSL_API WOLFSSL_ASN1_TYPE* wolfSSL_ASN1_TYPE_new(void); +WOLFSSL_API void wolfSSL_ASN1_TYPE_free(WOLFSSL_ASN1_TYPE* at); +WOLFSSL_API int wolfSSL_i2d_ASN1_TYPE(WOLFSSL_ASN1_TYPE* at, + unsigned char** pp); +WOLFSSL_API WOLFSSL_X509_PUBKEY *wolfSSL_X509_PUBKEY_new(void); +WOLFSSL_API void wolfSSL_X509_PUBKEY_free(WOLFSSL_X509_PUBKEY *x); +WOLFSSL_API WOLFSSL_X509_PUBKEY *wolfSSL_X509_get_X509_PUBKEY(const WOLFSSL_X509* x509); +WOLFSSL_API int wolfSSL_X509_PUBKEY_get0_param(WOLFSSL_ASN1_OBJECT **ppkalg, const unsigned char **pk, int *ppklen, WOLFSSL_X509_ALGOR **pa, WOLFSSL_X509_PUBKEY *pub); +WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_X509_PUBKEY_get(WOLFSSL_X509_PUBKEY* key); +WOLFSSL_API int wolfSSL_X509_PUBKEY_set(WOLFSSL_X509_PUBKEY **x, WOLFSSL_EVP_PKEY *key); +WOLFSSL_API int wolfSSL_i2t_ASN1_OBJECT(char *buf, int buf_len, WOLFSSL_ASN1_OBJECT *a); +WOLFSSL_API WOLFSSL_ASN1_OBJECT *wolfSSL_d2i_ASN1_OBJECT(WOLFSSL_ASN1_OBJECT **a, + const unsigned char **der, + long length); +WOLFSSL_API int wolfSSL_i2a_ASN1_OBJECT(WOLFSSL_BIO *bp, WOLFSSL_ASN1_OBJECT *a); +WOLFSSL_API int wolfSSL_i2d_ASN1_OBJECT(WOLFSSL_ASN1_OBJECT *a, unsigned char **pp); +WOLFSSL_API void WOLFSSL_CTX_set_tmp_dh_callback(WOLFSSL_CTX *ctx, WOLFSSL_DH *(*dh) (WOLFSSL *ssl, int is_export, int keylength)); +#ifndef OPENSSL_COEXIST +#define SSL_CTX_set_tmp_dh_callback WOLFSSL_CTX_set_tmp_dh_callback +#endif +WOLFSSL_API WOLF_STACK_OF(WOLFSSL_COMP) *WOLFSSL_COMP_get_compression_methods(void); +#ifndef OPENSSL_COEXIST +#define SSL_COMP_get_compression_methods WOLFSSL_COMP_get_compression_methods +#endif +WOLFSSL_API int wolfSSL_X509_STORE_load_locations(WOLFSSL_X509_STORE *str, const char *file, const char *dir); +WOLFSSL_API int wolfSSL_X509_STORE_set_default_paths(WOLFSSL_X509_STORE *str); +WOLFSSL_API int wolfSSL_X509_STORE_add_crl(WOLFSSL_X509_STORE *ctx, WOLFSSL_X509_CRL *x); +WOLFSSL_API int wolfSSL_sk_SSL_CIPHER_num(const WOLF_STACK_OF(WOLFSSL_CIPHER)* p); +WOLFSSL_API int wolfSSL_sk_SSL_CIPHER_find( + WOLF_STACK_OF(WOLFSSL_CIPHER)* sk, const WOLFSSL_CIPHER* toFind); +WOLFSSL_API void wolfSSL_sk_SSL_CIPHER_free(WOLF_STACK_OF(WOLFSSL_CIPHER)* sk); +WOLFSSL_API int wolfSSL_sk_SSL_COMP_zero(WOLFSSL_STACK* st); +WOLFSSL_API int wolfSSL_sk_SSL_COMP_num(WOLF_STACK_OF(WOLFSSL_COMP)* sk); +WOLFSSL_API WOLFSSL_CIPHER* wolfSSL_sk_SSL_CIPHER_value(WOLFSSL_STACK* sk, int i); +WOLFSSL_API void wolfSSL_ERR_load_SSL_strings(void); +#ifndef OPENSSL_COEXIST +#define ERR_load_SSL_strings wolfSSL_ERR_load_SSL_strings +#endif +WOLFSSL_API void wolfSSL_EC_POINT_dump(const char *msg, const WOLFSSL_EC_POINT *p); + +WOLFSSL_API const char *wolfSSL_ASN1_tag2str(int tag); +WOLFSSL_API int wolfSSL_ASN1_STRING_print_ex(WOLFSSL_BIO *out, WOLFSSL_ASN1_STRING *str, unsigned long flags); +WOLFSSL_API int wolfSSL_ASN1_STRING_print(WOLFSSL_BIO *out, WOLFSSL_ASN1_STRING *str); +WOLFSSL_API int wolfSSL_ASN1_TIME_get_length(const WOLFSSL_ASN1_TIME *t); +WOLFSSL_API unsigned char* wolfSSL_ASN1_TIME_get_data(const WOLFSSL_ASN1_TIME *t); +WOLFSSL_API WOLFSSL_ASN1_TIME *wolfSSL_ASN1_TIME_to_generalizedtime(WOLFSSL_ASN1_TIME *t, + WOLFSSL_ASN1_TIME **out); +WOLFSSL_API WOLFSSL_ASN1_TIME* wolfSSL_ASN1_UTCTIME_set(WOLFSSL_ASN1_TIME *s, time_t t); +WOLFSSL_API int wolfSSL_i2c_ASN1_INTEGER(WOLFSSL_ASN1_INTEGER *a, unsigned char **pp); +WOLFSSL_API int wolfSSL_a2i_ASN1_INTEGER(WOLFSSL_BIO *bio, WOLFSSL_ASN1_INTEGER *asn1, + char *buf, int size); +WOLFSSL_API int wolfSSL_X509_CA_num(WOLFSSL_X509_STORE *store); +WOLFSSL_API long wolfSSL_X509_get_version(const WOLFSSL_X509 *x); +WOLFSSL_API int wolfSSL_X509_get_signature_nid(const WOLFSSL_X509* x); + +#ifndef WOLFCRYPT_ONLY +WOLFSSL_API int wolfSSL_PEM_write_bio_PKCS8PrivateKey(WOLFSSL_BIO* bio, + WOLFSSL_EVP_PKEY* pkey, const WOLFSSL_EVP_CIPHER* enc, char* passwd, + int passwdSz, wc_pem_password_cb* cb, void* ctx); +WOLFSSL_API int wolfSSL_PEM_write_bio_PKCS8_PRIV_KEY_INFO(WOLFSSL_BIO* bio, + WOLFSSL_PKCS8_PRIV_KEY_INFO* keyInfo); +#if !defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM) +WOLFSSL_API int wolfSSL_PEM_write_PKCS8PrivateKey( + XFILE fp, WOLFSSL_EVP_PKEY* pkey, const WOLFSSL_EVP_CIPHER* enc, + char* passwd, int passwdSz, wc_pem_password_cb* cb, void* ctx); +#endif /* !NO_FILESYSTEM && !NO_STDIO_FILESYSTEM */ +WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_d2i_PKCS8PrivateKey_bio(WOLFSSL_BIO* bio, + WOLFSSL_EVP_PKEY** pkey, wc_pem_password_cb* cb, void* u); +WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_d2i_AutoPrivateKey( + WOLFSSL_EVP_PKEY** pkey, const unsigned char** data, long length); +#endif /* !WOLFCRYPT_ONLY */ + +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + +#ifdef WOLFSSL_HAVE_TLS_UNIQUE +WOLFSSL_API size_t wolfSSL_get_finished(const WOLFSSL *ssl, void *buf, size_t count); +WOLFSSL_API size_t wolfSSL_get_peer_finished(const WOLFSSL *ssl, void *buf, size_t count); +#endif /* WOLFSSL_HAVE_TLS_UNIQUE */ + +#ifdef HAVE_PK_CALLBACKS +WOLFSSL_API int wolfSSL_IsPrivatePkSet(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_CTX_IsPrivatePkSet(WOLFSSL_CTX* ctx); +#endif + +#ifdef HAVE_ENCRYPT_THEN_MAC +WOLFSSL_API int wolfSSL_CTX_AllowEncryptThenMac(WOLFSSL_CTX* ctx, int set); +WOLFSSL_API int wolfSSL_AllowEncryptThenMac(WOLFSSL *s, int set); +#endif + +/* This feature is used to set a fixed ephemeral key and is for testing only */ +/* Currently allows ECDHE and DHE only */ +#ifdef WOLFSSL_STATIC_EPHEMERAL +WOLFSSL_API int wolfSSL_CTX_set_ephemeral_key(WOLFSSL_CTX* ctx, int keyAlgo, + const char* key, unsigned int keySz, int format); +WOLFSSL_API int wolfSSL_set_ephemeral_key(WOLFSSL* ssl, int keyAlgo, + const char* key, unsigned int keySz, int format); + +/* returns pointer to loaded key as ASN.1/DER */ +WOLFSSL_API int wolfSSL_CTX_get_ephemeral_key(WOLFSSL_CTX* ctx, int keyAlgo, + const unsigned char** key, unsigned int* keySz); +WOLFSSL_API int wolfSSL_get_ephemeral_key(WOLFSSL* ssl, int keyAlgo, + const unsigned char** key, unsigned int* keySz); +#endif + +#ifdef HAVE_RPK +/* cert type for client_certificate_type/server_certificate_type extensions */ +enum { + WOLFSSL_CERT_TYPE_UNKNOWN = -1, + WOLFSSL_CERT_TYPE_X509 = 0, + WOLFSSL_CERT_TYPE_RPK = 2 +}; +#define MAX_CLIENT_CERT_TYPE_CNT 2 +#define MAX_SERVER_CERT_TYPE_CNT 2 + +WOLFSSL_API int wolfSSL_CTX_set_client_cert_type(WOLFSSL_CTX* ctx, + const char* buf, int len); +WOLFSSL_API int wolfSSL_CTX_set_server_cert_type(WOLFSSL_CTX* ctx, + const char* buf, int len); +WOLFSSL_API int wolfSSL_set_client_cert_type(WOLFSSL* ssl, + const char* buf, int len); +WOLFSSL_API int wolfSSL_set_server_cert_type(WOLFSSL* ssl, + const char* buf, int len); +WOLFSSL_API int wolfSSL_get_negotiated_client_cert_type(WOLFSSL* ssl, int* tp); +WOLFSSL_API int wolfSSL_get_negotiated_server_cert_type(WOLFSSL* ssl, int* tp); +#endif /* HAVE_RPK */ + + +#if defined(OPENSSL_EXTRA) +#ifndef WOLFCRYPT_ONLY +WOLFSSL_API int wolfSSL_EVP_PKEY_param_check(WOLFSSL_EVP_PKEY_CTX* ctx); +#endif +WOLFSSL_API void wolfSSL_CTX_set_security_level(WOLFSSL_CTX* ctx, int level); +WOLFSSL_API int wolfSSL_CTX_get_security_level(const WOLFSSL_CTX* ctx); +WOLFSSL_API int wolfSSL_SESSION_is_resumable(const WOLFSSL_SESSION *s); + +WOLFSSL_API void wolfSSL_CRYPTO_free(void *str, const char *file, int line); +WOLFSSL_API void *wolfSSL_CRYPTO_malloc(size_t num, const char *file, int line); + +WOLFSSL_API WOLFSSL_CONF_CTX* wolfSSL_CONF_CTX_new(void); +WOLFSSL_API void wolfSSL_CONF_CTX_free(WOLFSSL_CONF_CTX* cctx); +WOLFSSL_API void wolfSSL_CONF_CTX_set_ssl_ctx(WOLFSSL_CONF_CTX* cctx, WOLFSSL_CTX *ctx); +WOLFSSL_API unsigned int wolfSSL_CONF_CTX_set_flags(WOLFSSL_CONF_CTX* cctx, unsigned int flags); +WOLFSSL_API int wolfSSL_CONF_CTX_finish(WOLFSSL_CONF_CTX* cctx); + +#define WOLFSSL_CONF_FLAG_CMDLINE 0x1 +#define WOLFSSL_CONF_FLAG_FILE 0x2 +#define WOLFSSL_CONF_FLAG_CLIENT 0x4 +#define WOLFSSL_CONF_FLAG_SERVER 0x8 +#define WOLFSSL_CONF_FLAG_SHOW_ERRORS 0x10 +#define WOLFSSL_CONF_FLAG_CERTIFICATE 0x20 + +#define WOLFSSL_CONF_TYPE_UNKNOWN 0x0 +#define WOLFSSL_CONF_TYPE_STRING 0x1 +#define WOLFSSL_CONF_TYPE_FILE 0x2 +#define WOLFSSL_CONF_TYPE_DIR 0x3 + +WOLFSSL_API int wolfSSL_CONF_cmd(WOLFSSL_CONF_CTX* cctx, const char* cmd, const char* value); +WOLFSSL_API int wolfSSL_CONF_cmd_value_type(WOLFSSL_CONF_CTX *cctx, const char *cmd); +#endif /* OPENSSL_EXTRA */ + +#if defined(WOLFSSL_DTLS_CID) +WOLFSSL_API int wolfSSL_dtls_cid_use(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_dtls_cid_is_enabled(WOLFSSL* ssl); +WOLFSSL_API int wolfSSL_dtls_cid_set(WOLFSSL* ssl, unsigned char* cid, + unsigned int size); +WOLFSSL_API int wolfSSL_dtls_cid_get_rx_size(WOLFSSL* ssl, + unsigned int* size); +WOLFSSL_API int wolfSSL_dtls_cid_get_rx(WOLFSSL* ssl, unsigned char* buffer, + unsigned int bufferSz); +WOLFSSL_API int wolfSSL_dtls_cid_get0_rx(WOLFSSL* ssl, unsigned char** cid); +WOLFSSL_API int wolfSSL_dtls_cid_get_tx_size(WOLFSSL* ssl, + unsigned int* size); +WOLFSSL_API int wolfSSL_dtls_cid_get_tx(WOLFSSL* ssl, unsigned char* buffer, + unsigned int bufferSz); +WOLFSSL_API int wolfSSL_dtls_cid_get0_tx(WOLFSSL* ssl, unsigned char** cid); +WOLFSSL_API int wolfSSL_dtls_cid_max_size(void); +WOLFSSL_API const unsigned char* wolfSSL_dtls_cid_parse(const unsigned char* msg, + unsigned int msgSz, unsigned int cidSz); +#endif /* defined(WOLFSSL_DTLS_CID) */ + +#ifdef WOLFSSL_DTLS_CH_FRAG + WOLFSSL_API int wolfSSL_dtls13_allow_ch_frag(WOLFSSL *ssl, int enabled); +#endif +#ifdef WOLFSSL_DTLS13_NO_HRR_ON_RESUME + WOLFSSL_API int wolfSSL_dtls13_no_hrr_on_resume(WOLFSSL *ssl, int enabled); +#endif + +/* */ +#define SSL2_VERSION 0x0002 +#define SSL3_VERSION 0x0300 +#define TLS1_VERSION 0x0301 +#define TLS1_1_VERSION 0x0302 +#define TLS1_2_VERSION 0x0303 +#define TLS1_3_VERSION 0x0304 +#define DTLS1_VERSION 0xFEFF +#define DTLS1_2_VERSION 0xFEFD +#define DTLS1_3_VERSION 0xFEFC + +/* These minimums where determined whilst referencing their RFC specs. The + * values represent the minimum sizes of the data types in the required struct + * for the `extension_data` field. A length of 0 was assumed when necassary. + * + * Documents Used for the respective extension: + * - https://datatracker.ietf.org/doc/html/rfc6066 + * - Server Name Indication (SNI) + * - Maximum Fragment Length Negotiation (MFL) + * - Trusted CA Indication (TCA) + * - Certificate Status Request (CSR) + * - Truncate HMAC (THM) + * - https://datatracker.ietf.org/doc/html/rfc8446 + * - Early Data Indication (EDI) + * - Pre-Shared Key (PSK) + * - Pre-Shared Key Exchange Modes (PKM) + * - Key Share (KS) + * - Post-Handshake Authentication (PHA) + * - Signature Algorithms (SA) + * - Signature Algorithms Certificate (SAC) + * - Support Groups (EC) + * - Cookie (CKE) + * - Supported Versions (SV) + * - Certificate Authorities (CAN) + * - https://datatracker.ietf.org/doc/html/rfc6961 + * - Certificate Status Request v2 (CSR2) + * - https://datatracker.ietf.org/doc/rfc9146/ + * - Connection Identifier (CID) + * - https://datatracker.ietf.org/doc/rfc7301/ + * - Application-Layer Protocol Negotiation (ALPN) + * - https://datatracker.ietf.org/doc/html/rfc3711 + * - Secure Real-time Transport Protocol (SRTP) + * - https://datatracker.ietf.org/doc/html/rfc7366 + * - Encrypt Then Mac (ETM) + * - https://datatracker.ietf.org/doc/html/rfc7250 + * - Client Certificate Type (CCT) + * - Server Certificate Type (SCT) + * - https://datatracker.ietf.org/doc/draft-ietf-tls-esni/ + * - Encrypted Client Hello (ECH) + * - https://datatracker.ietf.org/doc/html/rfc5746 + * - Secure Renegotiation (SCR) + * - https://datatracker.ietf.org/doc/rfc4492/ + * - Point Frame (PF) + * - https://datatracker.ietf.org/doc/rfc9000/ + * - QUIC (QTP) + * - https://datatracker.ietf.org/doc/html/rfc5077 + * - Session Ticket (STK) + * Example: + * For `WOLFSSL_CSR_MIN_SIZE_CLIENT = 5`, 5 was determined by looking at the + * struct below defined in its respective RFC. + * The below struct for `CertificateStatusRequest` is made up of the types: + * `CertificateStatusType` is an enum with a max value of 255, thus its + * length is 1 byte. + * `OCSPStatusRequest` is a struct of the following: + * - `responder_id_list`: which is 2 bytes + * - `request_extensions`: which is 2 bytes + * This then gives the minimum size/length of 5 bytes for this extension + * for the client + * struct { + * CertificateStatusType status_type; + * select (status_type) { + * case ocsp: OCSPStatusRequest; + * } request; + * } CertificateStatusRequest; + * enum { ocsp(1), (255) } CertificateStatusType; + * struct { + * ResponderID responder_id_list<0..2^16-1>; + * Extensions request_extensions; + * } OCSPStatusRequest; + * opaque ResponderID<1..2^16-1>; + * opaque Extensions<0..2^16-1>; + */ + +#ifndef WOLFSSL_SNI_MIN_SIZE_CLIENT + #define WOLFSSL_SNI_MIN_SIZE_CLIENT 4 +#endif +#ifndef WOLFSSL_SNI_MIN_SIZE_SERVER + #define WOLFSSL_SNI_MIN_SIZE_SERVER 0 +#endif +#ifndef WOLFSSL_EDI_MIN_SIZE_CLIENT + #define WOLFSSL_EDI_MIN_SIZE_CLIENT 0 +#endif +#ifndef WOLFSSL_EDI_MIN_SIZE_SERVER + #define WOLFSSL_EDI_MIN_SIZE_SERVER 0 +#endif +#ifndef WOLFSSL_TCA_MIN_SIZE_CLIENT + #define WOLFSSL_TCA_MIN_SIZE_CLIENT 2 +#endif +#ifndef WOLFSSL_TCA_MIN_SIZE_SERVER + #define WOLFSSL_TCA_MIN_SIZE_SERVER 0 +#endif +#ifndef WOLFSSL_CSR_MIN_SIZE_CLIENT + #define WOLFSSL_CSR_MIN_SIZE_CLIENT 5 +#endif +#ifndef WOLFSSL_CSR_MIN_SIZE_SERVER + #define WOLFSSL_CSR_MIN_SIZE_SERVER 0 +#endif +#ifndef WOLFSSL_PKM_MIN_SIZE_CLIENT + #define WOLFSSL_PKM_MIN_SIZE_CLIENT 1 +#endif +#ifndef WOLFSSL_PKM_MIN_SIZE_SERVER + #define WOLFSSL_PKM_MIN_SIZE_SERVER 0 +#endif +#ifndef WOLFSSL_CSR2_MIN_SIZE_CLIENT + #define WOLFSSL_CSR2_MIN_SIZE_CLIENT 7 +#endif +#ifndef WOLFSSL_CSR2_MIN_SIZE_SERVER + #define WOLFSSL_CSR2_MIN_SIZE_SERVER 0 +#endif +#ifndef WOLFSSL_CID_MIN_SIZE_CLIENT + #define WOLFSSL_CID_MIN_SIZE_CLIENT 1 +#endif +#ifndef WOLFSSL_CID_MIN_SIZE_SERVER + #define WOLFSSL_CID_MIN_SIZE_SERVER 1 +#endif +#ifndef WOLFSSL_ALPN_MIN_SIZE_CLIENT + #define WOLFSSL_ALPN_MIN_SIZE_CLIENT 2 +#endif +#ifndef WOLFSSL_ALPN_MIN_SIZE_SERVER + #define WOLFSSL_ALPN_MIN_SIZE_SERVER 2 +#endif +#ifndef WOLFSSL_SRTP_MIN_SIZE_CLIENT + #define WOLFSSL_SRTP_MIN_SIZE_CLIENT 3 +#endif +#ifndef WOLFSSL_SRTP_MIN_SIZE_SERVER + #define WOLFSSL_SRTP_MIN_SIZE_SERVER 3 +#endif +#ifndef WOLFSSL_KS_MIN_SIZE_CLIENT + #define WOLFSSL_KS_MIN_SIZE_CLIENT 1 +#endif +#ifndef WOLFSSL_KS_MIN_SIZE_SERVER + #define WOLFSSL_KS_MIN_SIZE_SERVER 1 +#endif +#ifndef WOLFSSL_ETM_MIN_SIZE_CLIENT + #define WOLFSSL_ETM_MIN_SIZE_CLIENT 0 +#endif +#ifndef WOLFSSL_ETM_MIN_SIZE_SERVER + #define WOLFSSL_ETM_MIN_SIZE_SERVER 0 +#endif +#ifndef WOLFSSL_PSK_MIN_SIZE_CLIENT + #define WOLFSSL_PSK_MIN_SIZE_CLIENT 2 +#endif +#ifndef WOLFSSL_PSK_MIN_SIZE_SERVER + #define WOLFSSL_PSK_MIN_SIZE_SERVER 2 +#endif +#ifndef WOLFSSL_CCT_MIN_SIZE_CLIENT + #define WOLFSSL_CCT_MIN_SIZE_CLIENT 1 +#endif +#ifndef WOLFSSL_CCT_MIN_SIZE_SERVER + #define WOLFSSL_CCT_MIN_SIZE_SERVER 1 +#endif +#ifndef WOLFSSL_SCT_MIN_SIZE_CLIENT + #define WOLFSSL_SCT_MIN_SIZE_CLIENT 1 +#endif +#ifndef WOLFSSL_SCT_MIN_SIZE_SERVER + #define WOLFSSL_SCT_MIN_SIZE_SERVER 1 +#endif +#ifndef WOLFSSL_PHA_MIN_SIZE_CLIENT + #define WOLFSSL_PHA_MIN_SIZE_CLIENT 0 +#endif +#ifndef WOLFSSL_PHA_MIN_SIZE_SERVER + #define WOLFSSL_PHA_MIN_SIZE_SERVER 0 +#endif +#ifndef WOLFSSL_THM_MIN_SIZE_CLIENT + #define WOLFSSL_THM_MIN_SIZE_CLIENT 0 +#endif +#ifndef WOLFSSL_THM_MIN_SIZE_SERVER + #define WOLFSSL_THM_MIN_SIZE_SERVER 0 +#endif +#ifndef WOLFSSL_SA_MIN_SIZE_CLIENT + #define WOLFSSL_SA_MIN_SIZE_CLIENT 2 +#endif +#ifndef WOLFSSL_SA_MIN_SIZE_SERVER + #define WOLFSSL_SA_MIN_SIZE_SERVER 2 +#endif +#ifndef WOLFSSL_SAC_MIN_SIZE_CLIENT + #define WOLFSSL_SAC_MIN_SIZE_CLIENT 2 +#endif +#ifndef WOLFSSL_SAC_MIN_SIZE_SERVER + #define WOLFSSL_SAC_MIN_SIZE_SERVER 2 +#endif +#ifndef WOLFSSL_EC_MIN_SIZE_CLIENT + #define WOLFSSL_EC_MIN_SIZE_CLIENT 2 +#endif +#ifndef WOLFSSL_EC_MIN_SIZE_SERVER + #define WOLFSSL_EC_MIN_SIZE_SERVER 2 +#endif +#ifndef WOLFSSL_ECH_MIN_SIZE_CLIENT + #define WOLFSSL_ECH_MIN_SIZE_CLIENT 1 +#endif +#ifndef WOLFSSL_ECH_MIN_SIZE_SERVER + #define WOLFSSL_ECH_MIN_SIZE_SERVER 0 +#endif +#ifndef WOLFSSL_MFL_MIN_SIZE_CLIENT + #define WOLFSSL_MFL_MIN_SIZE_CLIENT 1 +#endif +#ifndef WOLFSSL_MFL_MIN_SIZE_SERVER + #define WOLFSSL_MFL_MIN_SIZE_SERVER 1 +#endif +#ifndef WOLFSSL_CKE_MIN_SIZE_CLIENT + #define WOLFSSL_CKE_MIN_SIZE_CLIENT 3 +#endif +#ifndef WOLFSSL_CKE_MIN_SIZE_SERVER + #define WOLFSSL_CKE_MIN_SIZE_SERVER 3 +#endif +#ifndef WOLFSSL_SV_MIN_SIZE_CLIENT + #define WOLFSSL_SV_MIN_SIZE_CLIENT 2 +#endif +#ifndef WOLFSSL_SV_MIN_SIZE_SERVER + #define WOLFSSL_SV_MIN_SIZE_SERVER 2 +#endif +#ifndef WOLFSSL_SCR_MIN_SIZE_CLIENT + #define WOLFSSL_SCR_MIN_SIZE_CLIENT 1 +#endif +#ifndef WOLFSSL_SCR_MIN_SIZE_SERVER + #define WOLFSSL_SCR_MIN_SIZE_SERVER 1 +#endif +#ifndef WOLFSSL_PF_MIN_SIZE_CLIENT + #define WOLFSSL_PF_MIN_SIZE_CLIENT 1 +#endif +#ifndef WOLFSSL_PF_MIN_SIZE_SERVER + #define WOLFSSL_PF_MIN_SIZE_SERVER 1 +#endif +#ifndef WOLFSSL_CAN_MIN_SIZE_CLIENT + #define WOLFSSL_CAN_MIN_SIZE_CLIENT 3 +#endif +#ifndef WOLFSSL_CAN_MIN_SIZE_SERVER + #define WOLFSSL_CAN_MIN_SIZE_SERVER 3 +#endif +#ifndef WOLFSSL_QTP_MIN_SIZE_CLIENT + #define WOLFSSL_QTP_MIN_SIZE_CLIENT 0 +#endif +#ifndef WOLFSSL_QTP_MIN_SIZE_SERVER + #define WOLFSSL_QTP_MIN_SIZE_SERVER 0 +#endif +#ifndef WOLFSSL_STK_MIN_SIZE_CLIENT + #define WOLFSSL_STK_MIN_SIZE_CLIENT 0 +#endif +#ifndef WOLFSSL_STK_MIN_SIZE_SERVER + #define WOLFSSL_STK_MIN_SIZE_SERVER 0 +#endif + +#ifdef __cplusplus + } /* extern "C" */ +#endif + + +#endif /* WOLFSSL_SSL_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/test.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/test.h @@ -0,0 +1,4961 @@ +/* test.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ +/*! + \file ../wolfssl/test.h + \brief Header file containing test inline functions +*/ + +/* Testing functions */ + +#ifndef wolfSSL_TEST_H +#define wolfSSL_TEST_H + +#include <wolfssl/wolfcrypt/settings.h> + +#undef TEST_OPENSSL_COEXIST /* can't use this option with this example */ +#if defined(OPENSSL_EXTRA) && defined(OPENSSL_COEXIST) + #error "Example apps built with OPENSSL_EXTRA can't also be built with OPENSSL_COEXIST." +#endif + +#include <wolfssl/wolfcrypt/wc_port.h> + +#ifdef FUSION_RTOS + #include <fclstdio.h> + #include <fclstdlib.h> +#else + #include <stdio.h> + #include <stdlib.h> +#endif +#include <assert.h> +#include <ctype.h> +#ifdef HAVE_ERRNO_H + #include <errno.h> +#endif +#include <wolfssl/wolfcrypt/types.h> +#include <wolfssl/error-ssl.h> +#include <wolfssl/wolfcrypt/random.h> +#include <wolfssl/wolfcrypt/mem_track.h> +#include <wolfssl/wolfio.h> +#include <wolfssl/wolfcrypt/asn.h> + +#ifdef ATOMIC_USER + #include <wolfssl/wolfcrypt/aes.h> + #include <wolfssl/wolfcrypt/arc4.h> + #include <wolfssl/wolfcrypt/hmac.h> +#endif +#ifdef HAVE_PK_CALLBACKS + #ifndef NO_RSA + #include <wolfssl/wolfcrypt/rsa.h> + #endif + #ifdef HAVE_ECC + #include <wolfssl/wolfcrypt/ecc.h> + #endif /* HAVE_ECC */ + #ifndef NO_DH + #include <wolfssl/wolfcrypt/dh.h> + #endif /* !NO_DH */ + #ifdef HAVE_ED25519 + #include <wolfssl/wolfcrypt/ed25519.h> + #endif /* HAVE_ED25519 */ + #ifdef HAVE_CURVE25519 + #include <wolfssl/wolfcrypt/curve25519.h> + #endif /* HAVE_ECC */ + #ifdef HAVE_ED448 + #include <wolfssl/wolfcrypt/ed448.h> + #endif /* HAVE_ED448 */ + #ifdef HAVE_CURVE448 + #include <wolfssl/wolfcrypt/curve448.h> + #endif /* HAVE_ECC */ +#endif /*HAVE_PK_CALLBACKS */ + +#ifdef __WATCOMC__ + #define SNPRINTF snprintf + #if defined(__NT__) + #include <winsock2.h> + #include <ws2tcpip.h> + #include <process.h> + #ifdef TEST_IPV6 /* don't require newer SDK for IPV4 */ + #include <wspiapi.h> + #endif + #define SOCKET_T SOCKET + #define XSLEEP_MS(t) Sleep(t) + #elif defined(__OS2__) + #include <netdb.h> + #include <sys/ioctl.h> + #include <tcpustd.h> + #define SOCKET_T int + #elif defined(__UNIX__) + #include <string.h> + #include <netdb.h> + #include <netinet/tcp.h> + #ifndef WOLFSSL_NDS + #include <sys/ioctl.h> + #endif + #include <time.h> + #include <sys/time.h> + #ifdef HAVE_PTHREAD + #include <pthread.h> + #endif + #define SOCKET_T int + #ifndef SO_NOSIGPIPE + #include <signal.h> /* ignore SIGPIPE */ + #endif + + #define XSLEEP_MS(m) \ + { \ + struct timespec req = { (m)/1000, ((m) % 1000) * 1000 }; \ + nanosleep( &req, NULL ); \ + } + #endif +#elif defined(USE_WINDOWS_API) + #include <winsock2.h> + #include <ws2tcpip.h> + #include <process.h> + #ifdef TEST_IPV6 /* don't require newer SDK for IPV4 */ + #include <wspiapi.h> + #endif + #define SOCKET_T SOCKET + #define SNPRINTF _snprintf + #define XSLEEP_MS(t) Sleep(t) +#elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) + #include <string.h> + #include "rl_net.h" + #define SOCKET_T int + typedef int socklen_t ; + #define inet_addr wolfSSL_inet_addr + static unsigned long wolfSSL_inet_addr(const char *cp) + { + unsigned int a[4] ; unsigned long ret ; + sscanf(cp, "%u.%u.%u.%u", &a[0], &a[1], &a[2], &a[3]) ; + ret = ((a[3]<<24) + (a[2]<<16) + (a[1]<<8) + a[0]) ; + return(ret) ; + } + #if defined(HAVE_KEIL_RTX) + #define XSLEEP_MS(t) os_dly_wait(t) + #elif defined(WOLFSSL_CMSIS_RTOS) || defined(WOLFSSL_CMSIS_RTOSv2) + #define XSLEEP_MS(t) osDelay(t) + #endif +#elif defined(WOLFSSL_TIRTOS) + #include <string.h> + #include <netdb.h> + #if !defined(__ti__) /* conflicts with sys/socket.h */ + #include <sys/types.h> + #endif + #include <arpa/inet.h> + #include <sys/socket.h> + #include <ti/sysbios/knl/Task.h> + struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ + }; + #define SOCKET_T int + #define XSLEEP_MS(t) Task_sleep(t/1000) +#elif defined(WOLFSSL_VXWORKS) + #include <hostLib.h> + #include <sockLib.h> + #include <arpa/inet.h> + #include <string.h> + #include <selectLib.h> + #include <sys/types.h> + #include <netinet/in.h> + #include <fcntl.h> + #ifdef WOLFSSL_VXWORKS_6_x + #include <time.h> + #else + #include <sys/time.h> + #endif + #include <netdb.h> + #include <pthread.h> + #define SOCKET_T int +#elif defined(WOLFSSL_ZEPHYR) + #include <version.h> + #include <string.h> + #include <sys/types.h> + #if KERNEL_VERSION_NUMBER >= 0x30100 + #include <zephyr/net/socket.h> + #ifdef CONFIG_POSIX_API + #include <zephyr/posix/poll.h> + #include <zephyr/posix/netdb.h> + #include <zephyr/posix/sys/socket.h> + #include <zephyr/posix/sys/select.h> + #endif + #else + #include <net/socket.h> + #ifdef CONFIG_POSIX_API + #include <posix/poll.h> + #include <posix/netdb.h> + #include <posix/sys/socket.h> + #include <posix/sys/select.h> + #endif + #endif + #define SOCKET_T int + #define SOL_SOCKET 1 + #define WOLFSSL_USE_GETADDRINFO + + static unsigned long inet_addr(const char *cp) + { + unsigned int a[4]; unsigned long ret; + int i, j; + for (i=0, j=0; i<4; i++) { + a[i] = 0; + while (cp[j] != '.' && cp[j] != '\0') { + a[i] *= 10; + a[i] += cp[j] - '0'; + j++; + } + } + ret = ((a[3]<<24) + (a[2]<<16) + (a[1]<<8) + a[0]) ; + return(ret) ; + } +#elif defined(NETOS) + #include <string.h> + #include <sys/types.h> + struct hostent { + char* h_name; /* official name of host */ + char** h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char** h_addr_list; /* list of addresses from the name server */ + }; +#elif defined(ARDUINO) + /* TODO, define board-specific */ +#else + #include <string.h> + #include <sys/types.h> +#ifndef WOLFSSL_LEANPSK + #include <unistd.h> + #include <netdb.h> + #include <netinet/in.h> + #include <netinet/tcp.h> + #include <arpa/inet.h> + #ifndef WOLFSSL_NDS + #include <sys/ioctl.h> + #endif + #include <sys/time.h> + #include <sys/socket.h> + #ifdef HAVE_PTHREAD + #include <pthread.h> + #endif + #include <fcntl.h> + #ifdef TEST_IPV6 + #include <netdb.h> + #endif +#endif + #ifdef FREESCALE_MQX + typedef int socklen_t ; + #endif + #define SOCKET_T int + #ifndef SO_NOSIGPIPE + #include <signal.h> /* ignore SIGPIPE */ + #endif + #define SNPRINTF snprintf + + #define XSELECT_WAIT(x,y) do { \ + struct timeval tv = {((x) + ((y) / 1000000)),((y) % 1000000)}; \ + if ((select(0, NULL, NULL, NULL, &tv) < 0) && (errno != EINTR)) \ + err_sys("select for XSELECT_WAIT failed."); \ + } while (0) + #define XSLEEP_US(u) XSELECT_WAIT(0,u) + #define XSLEEP_MS(m) XSELECT_WAIT(0,(m)*1000) +#endif /* USE_WINDOWS_API */ + +#ifndef XSLEEP_MS + #define XSLEEP_MS(t) sleep(t/1000) +#endif + +#ifdef WOLFSSL_ASYNC_CRYPT + #include <wolfssl/wolfcrypt/async.h> +#endif +#ifdef HAVE_CAVIUM + #include <wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h> +#endif +#ifdef _MSC_VER + /* disable conversion warning */ + /* 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy */ + #pragma warning(disable:4244 4996) +#endif + +#ifndef WOLFSSL_CIPHER_LIST_MAX_SIZE + #define WOLFSSL_CIPHER_LIST_MAX_SIZE 4096 +#endif +/* Buffer for benchmark tests */ +#ifndef TEST_BUFFER_SIZE + #define TEST_BUFFER_SIZE 16384 +#endif + +#ifndef WOLFSSL_HAVE_MIN + #define WOLFSSL_HAVE_MIN + #ifdef NO_INLINE + #define min no_inline_min + #endif + static WC_INLINE word32 min(word32 a, word32 b) + { + return a > b ? b : a; + } +#endif /* WOLFSSL_HAVE_MIN */ + +/* Socket Handling */ +#ifndef WOLFSSL_SOCKET_INVALID +#ifdef USE_WINDOWS_API + #define WOLFSSL_SOCKET_INVALID ((SOCKET_T)INVALID_SOCKET) +#elif defined(WOLFSSL_TIRTOS) + #define WOLFSSL_SOCKET_INVALID ((SOCKET_T)-1) +#else + #define WOLFSSL_SOCKET_INVALID (SOCKET_T)(-1) +#endif +#endif /* WOLFSSL_SOCKET_INVALID */ + +#ifndef WOLFSSL_SOCKET_IS_INVALID +#if defined(USE_WINDOWS_API) || defined(WOLFSSL_TIRTOS) + #define WOLFSSL_SOCKET_IS_INVALID(s) ((SOCKET_T)(s) == WOLFSSL_SOCKET_INVALID) +#else + #define WOLFSSL_SOCKET_IS_INVALID(s) ((SOCKET_T)(s) < WOLFSSL_SOCKET_INVALID) +#endif +#endif /* WOLFSSL_SOCKET_IS_INVALID */ + +#if defined(__MACH__) || defined(USE_WINDOWS_API) + #ifndef _SOCKLEN_T + typedef int socklen_t; + #endif +#endif + + +/* HPUX doesn't use socklent_t for third parameter to accept, unless + _XOPEN_SOURCE_EXTENDED is defined */ +#if !defined(__hpux__) && !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_IAR_ARM)\ + && !defined(WOLFSSL_ROWLEY_ARM) && !defined(WOLFSSL_KEIL_TCP_NET) + typedef socklen_t* ACCEPT_THIRD_T; +#else + #if defined _XOPEN_SOURCE_EXTENDED + typedef socklen_t* ACCEPT_THIRD_T; + #else + typedef int* ACCEPT_THIRD_T; + #endif +#endif + + +#if defined(DEBUG_PK_CB) || defined(TEST_PK_PRIVKEY) || defined(TEST_PK_PSK) + #define WOLFSSL_PKMSG(...) printf(__VA_ARGS__) +#else + #define WOLFSSL_PKMSG(...) WC_DO_NOTHING +#endif + + +#ifndef MY_EX_USAGE +#define MY_EX_USAGE 2 +#endif + +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif + +#if defined(WOLFSSL_FORCE_MALLOC_FAIL_TEST) || defined(WOLFSSL_ZEPHYR) + #ifndef EXIT_SUCCESS + #define EXIT_SUCCESS 0 + #endif + #define XEXIT(rc) return rc + #define XEXIT_T(rc) return (THREAD_RETURN)rc +#else + #define XEXIT(rc) exit((int)(rc)) + #define XEXIT_T(rc) exit((int)(rc)) +#endif + +static WC_INLINE +#if defined(WOLFSSL_FORCE_MALLOC_FAIL_TEST) || defined(WOLFSSL_ZEPHYR) +THREAD_RETURN +#else +WC_NORETURN void +#endif +err_sys(const char* msg) +{ +#if !defined(__GNUC__) + /* scan-build (which pretends to be gnuc) can get confused and think the + * msg pointer can be null even when hardcoded and then it won't exit, + * making null pointer checks above the err_sys() call useless. + * We could just always exit() but some compilers will complain about no + * possible return, with gcc we know the attribute to handle that with + * WC_NORETURN. */ + if (msg) +#endif + { + fprintf(stderr, "wolfSSL error: %s\n", msg); + } + XEXIT_T(EXIT_FAILURE); +} + +static WC_INLINE +#if defined(WOLFSSL_FORCE_MALLOC_FAIL_TEST) || defined(WOLFSSL_ZEPHYR) +THREAD_RETURN +#else +WC_NORETURN void +#endif +err_sys_with_errno(const char* msg) +{ +#if !defined(__GNUC__) + /* scan-build (which pretends to be gnuc) can get confused and think the + * msg pointer can be null even when hardcoded and then it won't exit, + * making null pointer checks above the err_sys() call useless. + * We could just always exit() but some compilers will complain about no + * possible return, with gcc we know the attribute to handle that with + * WC_NORETURN. */ + if (msg) +#endif + { +#if defined(HAVE_STRING_H) && defined(HAVE_ERRNO_H) + fprintf(stderr, "wolfSSL error: %s: %s\n", msg, strerror(errno)); +#else + fprintf(stderr, "wolfSSL error: %s\n", msg); +#endif + } + XEXIT_T(EXIT_FAILURE); +} + +#define LIBCALL_CHECK_RET(...) do { \ + int _libcall_ret = (__VA_ARGS__); \ + if (_libcall_ret < 0) { \ + fprintf(stderr, "%s L%d error %d for \"%s\"\n", \ + __FILE__, __LINE__, errno, #__VA_ARGS__); \ + err_sys("library/system call failed"); \ + } \ + } while(0) + +#define THREAD_CHECK_RET(...) do { \ + int _thread_ret = (__VA_ARGS__); \ + if (_thread_ret != 0) { \ + errno = _thread_ret; \ + fprintf(stderr, "%s L%d error %d for \"%s\"\n", \ + __FILE__, __LINE__, _thread_ret, #__VA_ARGS__); \ + err_sys("thread call failed"); \ + } \ + } while(0) + + +#ifndef WOLFSSL_NO_TLS12 +#define SERVER_DEFAULT_VERSION 3 +#else +#define SERVER_DEFAULT_VERSION 4 +#endif +#define SERVER_DTLS_DEFAULT_VERSION (-2) +#define SERVER_INVALID_VERSION (-99) +#define SERVER_DOWNGRADE_VERSION (-98) +#ifndef WOLFSSL_NO_TLS12 +#define CLIENT_DEFAULT_VERSION 3 +#else +#define CLIENT_DEFAULT_VERSION 4 +#endif +#define CLIENT_DTLS_DEFAULT_VERSION (-2) +#define CLIENT_INVALID_VERSION (-99) +#define CLIENT_DOWNGRADE_VERSION (-98) +#define EITHER_DOWNGRADE_VERSION (-97) +#if !defined(NO_FILESYSTEM) && defined(WOLFSSL_MAX_STRENGTH) + #define DEFAULT_MIN_DHKEY_BITS 2048 + #define DEFAULT_MAX_DHKEY_BITS 3072 +#else + #define DEFAULT_MIN_DHKEY_BITS 1024 + #define DEFAULT_MAX_DHKEY_BITS 2048 +#endif +#if !defined(NO_FILESYSTEM) && defined(WOLFSSL_MAX_STRENGTH) + #define DEFAULT_MIN_RSAKEY_BITS 2048 +#else + #ifndef DEFAULT_MIN_RSAKEY_BITS + #define DEFAULT_MIN_RSAKEY_BITS 1024 + #endif +#endif +#if !defined(NO_FILESYSTEM) && defined(WOLFSSL_MAX_STRENGTH) + #define DEFAULT_MIN_ECCKEY_BITS 256 +#else + #ifndef DEFAULT_MIN_ECCKEY_BITS + #define DEFAULT_MIN_ECCKEY_BITS 224 + #endif +#endif + +#ifndef DEFAULT_TIMEOUT_SEC +#define DEFAULT_TIMEOUT_SEC 2 +#endif + +/* all certs relative to wolfSSL home directory now */ +#if defined(WOLFSSL_NO_CURRDIR) || defined(WOLFSSL_MDK_SHELL) +#define caCertFile "certs/ca-cert.pem" +#define eccCertFile "certs/server-ecc.pem" +#define eccKeyFile "certs/ecc-key.pem" +#define eccKeyPubFile "certs/ecc-keyPub.pem" +#define eccRsaCertFile "certs/server-ecc-rsa.pem" +#define svrCertFile "certs/server-cert.pem" +#define svrKeyFile "certs/server-key.pem" +#define svrKeyPubFile "certs/server-keyPub.pem" +#define cliCertFile "certs/client-cert.pem" +#define cliCertDerFile "certs/client-cert.der" +#define cliCertFileExt "certs/client-cert-ext.pem" +#define cliCertDerFileExt "certs/client-cert-ext.der" +#define cliKeyFile "certs/client-key.pem" +#define cliKeyPubFile "certs/client-keyPub.pem" +#define dhParamFile "certs/dh2048.pem" +#define cliEccKeyFile "certs/ecc-client-key.pem" +#define cliEccKeyPubFile "certs/ecc-client-keyPub.pem" +#define cliEccCertFile "certs/client-ecc-cert.pem" +#define caEccCertFile "certs/ca-ecc-cert.pem" +#define crlPemDir "certs/crl" +#define edCertFile "certs/ed25519/server-ed25519-cert.pem" +#define edKeyFile "certs/ed25519/server-ed25519-priv.pem" +#define edKeyPubFile "certs/ed25519/server-ed25519-key.pem" +#define cliEdCertFile "certs/ed25519/client-ed25519.pem" +#define cliEdKeyFile "certs/ed25519/client-ed25519-priv.pem" +#define cliEdKeyPubFile "certs/ed25519/client-ed25519-key.pem" +#define caEdCertFile "certs/ed25519/ca-ed25519.pem" +#define ed448CertFile "certs/ed448/server-ed448-cert.pem" +#define ed448KeyFile "certs/ed448/server-ed448-priv.pem" +#define cliEd448CertFile "certs/ed448/client-ed448.pem" +#define cliEd448KeyFile "certs/ed448/client-ed448-priv.pem" +#define caEd448CertFile "certs/ed448/ca-ed448.pem" +#define noIssuerCertFile "certs/empty-issuer-cert.pem" +#define caCertFolder "certs/" +#ifdef HAVE_WNR + /* Whitewood netRandom default config file */ + #define wnrConfig "wnr-example.conf" +#endif +#elif defined(NETOS) && defined(HAVE_FIPS) + /* These defines specify the file system volume and root directory used by + * the FTP server used in the only supported NETOS FIPS solution (at this + * time), these can be tailored in the event a future FIPS solution is added + * for an alternate NETOS use-case */ + #define FS_VOLUME1 "FLASH0" + #define FS_VOLUME1_DIR FS_VOLUME1 "/" + #define caCertFile FS_VOLUME1_DIR "certs/ca-cert.pem" + #define eccCertFile FS_VOLUME1_DIR "certs/server-ecc.pem" + #define eccKeyFile FS_VOLUME1_DIR "certs/ecc-key.pem" + #define svrCertFile FS_VOLUME1_DIR "certs/server-cert.pem" + #define svrKeyFile FS_VOLUME1_DIR "certs/server-key.pem" + #define cliCertFile FS_VOLUME1_DIR "certs/client-cert.pem" + #define cliKeyFile FS_VOLUME1_DIR "certs/client-key.pem" + #define ntruCertFile FS_VOLUME1_DIR "certs/ntru-cert.pem" + #define ntruKeyFile FS_VOLUME1_DIR "certs/ntru-key.raw" + #define dhParamFile FS_VOLUME1_DIR "certs/dh2048.pem" + #define cliEccKeyFile FS_VOLUME1_DIR "certs/ecc-client-key.pem" + #define cliEccCertFile FS_VOLUME1_DIR "certs/client-ecc-cert.pem" + #define caEccCertFile FS_VOLUME1_DIR "certs/ca-ecc-cert/pem" + #define crlPemDir FS_VOLUME1_DIR "certs/crl" + #ifdef HAVE_WNR + /* Whitewood netRandom default config file */ + #define wnrConfig "wnr-example.conf" + #endif +#else +#define caCertFile "./certs/ca-cert.pem" +#define eccCertFile "./certs/server-ecc.pem" +#define eccKeyFile "./certs/ecc-key.pem" +#define eccKeyPubFile "./certs/ecc-keyPub.pem" +#define eccRsaCertFile "./certs/server-ecc-rsa.pem" +#define svrCertFile "./certs/server-cert.pem" +#define svrKeyFile "./certs/server-key.pem" +#define svrKeyPubFile "./certs/server-keyPub.pem" +#define cliCertFile "./certs/client-cert.pem" +#define cliCertDerFile "./certs/client-cert.der" +#define cliCertFileExt "./certs/client-cert-ext.pem" +#define cliCertDerFileExt "./certs/client-cert-ext.der" +#define cliKeyFile "./certs/client-key.pem" +#define cliKeyPubFile "./certs/client-keyPub.pem" +#define dhParamFile "./certs/dh2048.pem" +#define cliEccKeyFile "./certs/ecc-client-key.pem" +#define cliEccKeyPubFile "./certs/ecc-client-keyPub.pem" +#define cliEccCertFile "./certs/client-ecc-cert.pem" +#define caEccCertFile "./certs/ca-ecc-cert.pem" +#define crlPemDir "./certs/crl" +#define edCertFile "./certs/ed25519/server-ed25519-cert.pem" +#define edKeyFile "./certs/ed25519/server-ed25519-priv.pem" +#define edKeyPubFile "./certs/ed25519/server-ed25519-key.pem" +#define cliEdCertFile "./certs/ed25519/client-ed25519.pem" +#define cliEdKeyFile "./certs/ed25519/client-ed25519-priv.pem" +#define cliEdKeyPubFile "./certs/ed25519/client-ed25519-key.pem" +#define caEdCertFile "./certs/ed25519/ca-ed25519.pem" +#define ed448CertFile "./certs/ed448/server-ed448-cert.pem" +#define ed448KeyFile "./certs/ed448/server-ed448-priv.pem" +#define cliEd448CertFile "./certs/ed448/client-ed448.pem" +#define cliEd448KeyFile "./certs/ed448/client-ed448-priv.pem" +#define caEd448CertFile "./certs/ed448/ca-ed448.pem" +#define noIssuerCertFile "./certs/empty-issuer-cert.pem" +#define caCertFolder "./certs/" +#ifdef HAVE_WNR + /* Whitewood netRandom default config file */ + #define wnrConfig "./wnr-example.conf" +#endif +#endif + + +#ifdef TEST_IPV6 + typedef struct sockaddr_in6 SOCKADDR_IN_T; + #define AF_INET_V AF_INET6 +#else + typedef struct sockaddr_in SOCKADDR_IN_T; + #define AF_INET_V AF_INET +#endif + +typedef struct tcp_ready { + word16 ready; /* predicate */ + word16 port; + char* srfName; /* server ready file name */ +#ifndef SINGLE_THREADED +#ifdef WOLFSSL_COND + wolfSSL_Mutex mutex; + COND_TYPE cond; +#else /* No signaling available, rely only on the mutex */ + wolfSSL_Mutex mutex; +#endif +#endif +} tcp_ready; + +static WC_INLINE void InitTcpReady(tcp_ready* ready) +{ + ready->ready = 0; + ready->port = 0; + ready->srfName = NULL; + +#ifndef SINGLE_THREADED + THREAD_CHECK_RET(wc_InitMutex(&ready->mutex)); + #ifdef WOLFSSL_COND + THREAD_CHECK_RET(wolfSSL_CondInit(&ready->cond)); + #endif +#endif +} + +#ifdef NETOS + struct hostent* gethostbyname(const char* name); +#endif + +static WC_INLINE void FreeTcpReady(tcp_ready* ready) +{ +#ifndef SINGLE_THREADED + THREAD_CHECK_RET(wc_FreeMutex(&ready->mutex)); +#ifdef WOLFSSL_COND + THREAD_CHECK_RET(wolfSSL_CondFree(&ready->cond)); +#endif +#else + (void)ready; +#endif +} + +typedef WOLFSSL_METHOD* (*method_provider)(void); +typedef void (*ctx_callback)(WOLFSSL_CTX* ctx); +typedef void (*ssl_callback)(WOLFSSL* ssl); + +typedef struct callback_functions { + method_provider method; + ctx_callback ctx_ready; + ssl_callback ssl_ready; + ssl_callback on_result; + ssl_callback on_cleanup; + WOLFSSL_CTX* ctx; + const char* caPemFile; + const char* certPemFile; + const char* keyPemFile; + const char* crlPemFile; +#ifdef WOLFSSL_STATIC_MEMORY + byte* mem; + word32 memSz; + wolfSSL_method_func method_ex; +#endif + int devId; + int return_code; + int last_err; + unsigned char isSharedCtx:1; + unsigned char loadToSSL:1; + unsigned char ticNoInit:1; + unsigned char doUdp:1; +} callback_functions; + +#if defined(WOLFSSL_SRTP) && defined(WOLFSSL_COND) +typedef struct srtp_test_helper { + wolfSSL_Mutex mutex; + COND_TYPE cond; + uint8_t* server_srtp_ekm; + size_t server_srtp_ekm_size; +} srtp_test_helper; +#endif /* WOLFSSL_SRTP WOLFSSL_COND */ + +typedef struct func_args { + int argc; + char** argv; + int return_code; + tcp_ready* signal; + callback_functions *callbacks; +#if defined(WOLFSSL_SRTP) && defined(WOLFSSL_COND) + srtp_test_helper* srtp_helper; +#endif +} func_args; + +#ifdef NETOS + int dc_log_printf(char* format, ...); + #undef printf + #define printf dc_log_printf +#endif + +void wait_tcp_ready(func_args* args); + +#ifndef SINGLE_THREADED +void start_thread(THREAD_CB fun, func_args* args, THREAD_TYPE* thread); +void join_thread(THREAD_TYPE thread); +#endif + +typedef int (*cbType)(WOLFSSL_CTX *ctx, WOLFSSL *ssl); + +void test_wolfSSL_client_server_nofail_ex(callback_functions* client_cb, + callback_functions* server_cb, cbType client_on_handshake); +void test_wolfSSL_client_server_nofail(callback_functions* client_cb, + callback_functions* server_cb); + + +#if defined(__MACH__) || defined(__FreeBSD__) + int link_file(const char* in, const char* out); + #define STAGE_FILE(x,y) link_file((x),(y)) +#else + #define STAGE_FILE(x,y) copy_file((x),(y)) +#endif + +void signal_ready(tcp_ready* ready); + +/* wolfSSL */ +#ifndef TEST_IPV6 + static const char* const wolfSSLIP = "127.0.0.1"; +#else + static const char* const wolfSSLIP = "::1"; +#endif +static const word16 wolfSSLPort = 11111; + + +extern int myoptind; +extern char* myoptarg; + +#if defined(WOLFSSL_SRTP) && defined(WOLFSSL_COND) + +static WC_INLINE void srtp_helper_init(srtp_test_helper *srtp) +{ + srtp->server_srtp_ekm_size = 0; + srtp->server_srtp_ekm = NULL; + + THREAD_CHECK_RET(wc_InitMutex(&srtp->mutex)); + THREAD_CHECK_RET(wolfSSL_CondInit(&srtp->cond)); +} + +/** + * strp_helper_get_ekm() - get exported key material of other peer + * @srtp: srtp_test_helper struct shared with other peer [in] + * @ekm: where to store the shared buffer pointer [out] + * @size: size of the shared buffer returned [out] + * + * This function wait that the other peer calls strp_helper_set_ekm() and then + * store the buffer pointer/size in @ekm and @size. + */ +static WC_INLINE void srtp_helper_get_ekm(srtp_test_helper *srtp, + uint8_t **ekm, size_t *size) +{ + THREAD_CHECK_RET(wolfSSL_CondStart(&srtp->cond)); + if (srtp->server_srtp_ekm == NULL) { + THREAD_CHECK_RET(wolfSSL_CondWait(&srtp->cond)); + } + *ekm = srtp->server_srtp_ekm; + *size = srtp->server_srtp_ekm_size; + + /* reset */ + srtp->server_srtp_ekm = NULL; + srtp->server_srtp_ekm_size = 0; + THREAD_CHECK_RET(wolfSSL_CondEnd(&srtp->cond)); +} + +/** + * strp_helper_set_ekm() - set exported key material of other peer + * @srtp: srtp_test_helper struct shared with other peer [in] + * @ekm: pointer to the shared buffer [in] + * @size: size of the shared buffer [in] + * + * This function set the @ekm and wakes up a peer waiting in + * srtp_helper_get_ekm(). + * + * used in client_srtp_test()/server_srtp_test() + */ +static WC_INLINE void srtp_helper_set_ekm(srtp_test_helper *srtp, + uint8_t *ekm, size_t size) +{ + THREAD_CHECK_RET(wolfSSL_CondStart(&srtp->cond)); + srtp->server_srtp_ekm_size = size; + srtp->server_srtp_ekm = ekm; + THREAD_CHECK_RET(wolfSSL_CondSignal(&srtp->cond)); + THREAD_CHECK_RET(wolfSSL_CondEnd(&srtp->cond)); +} + +static WC_INLINE void srtp_helper_free(srtp_test_helper *srtp) +{ + THREAD_CHECK_RET(wc_FreeMutex(&srtp->mutex)); + THREAD_CHECK_RET(wolfSSL_CondFree(&srtp->cond)); +} + +#endif /* WOLFSSL_SRTP && WOLFSSL_COND */ + + +/** + * + * @param argc Number of argv strings + * @param argv Array of string arguments + * @param optstring String containing the supported alphanumeric arguments. + * A ':' following a character means that it requires a + * value in myoptarg to be set. A ';' means that the + * myoptarg is optional. myoptarg is set to "" if not + * present. + * @return Option letter in argument + */ +static WC_INLINE int mygetopt(int argc, char** argv, const char* optstring) +{ + static char* next = NULL; + + char c; + char* cp; + + /* Added sanity check because scan-build complains argv[myoptind] access + * results in a null pointer dereference. */ + if (argv == NULL) { + myoptarg = NULL; + return -1; + } + + if (myoptind == 0) + next = NULL; /* we're starting new/over */ + + if (next == NULL || *next == '\0') { + if (myoptind == 0) + myoptind++; + + if (myoptind >= argc || argv[myoptind] == NULL || + argv[myoptind][0] != '-' || argv[myoptind][1] == '\0') { + myoptarg = NULL; + if (myoptind < argc) + myoptarg = argv[myoptind]; + + return -1; + } + + if (strcmp(argv[myoptind], "--") == 0) { + myoptind++; + myoptarg = NULL; + + if (myoptind < argc) + myoptarg = argv[myoptind]; + + return -1; + } + + next = argv[myoptind]; + next++; /* skip - */ + myoptind++; + } + + c = *next++; + /* The C++ strchr can return a different value */ + cp = (char*)strchr(optstring, c); + + if (cp == NULL || c == ':' || c == ';') + return '?'; + + cp++; + + if (*cp == ':') { + if (*next != '\0') { + myoptarg = next; + next = NULL; + } + else if (myoptind < argc) { + myoptarg = argv[myoptind]; + myoptind++; + } + else + return '?'; + } + else if (*cp == ';') { + myoptarg = (char*)""; + if (*next != '\0') { + myoptarg = next; + next = NULL; + } + else if (myoptind < argc) { + /* Check if next argument is not a parameter argument */ + if (argv[myoptind] && argv[myoptind][0] != '-') { + myoptarg = argv[myoptind]; + myoptind++; + } + } + } + + return c; +} + +struct mygetopt_long_config { + const char *name; + int takes_arg; /* 0=no arg, 1=required arg, 2=optional arg */ + int value; +}; + +/** + * + * @param argc Number of argv strings + * @param argv Array of string arguments + * @param optstring String containing the supported alphanumeric arguments. + * A ':' following a character means that it requires a + * value in myoptarg to be set. A ';' means that the + * myoptarg is optional. myoptarg is set to "" if not + * present. + * @return Option letter in argument + */ +static WC_INLINE int mygetopt_long(int argc, char** argv, const char* optstring, + const struct mygetopt_long_config *longopts, int *longindex) +{ + static char* next = NULL; + + int c; + char* cp; + + /* Added sanity check because scan-build complains argv[myoptind] access + * results in a null pointer dereference. */ + if (argv == NULL) { + myoptarg = NULL; + return -1; + } + + if (myoptind == 0) + next = NULL; /* we're starting new/over */ + + if (next == NULL || *next == '\0') { + if (myoptind == 0) + myoptind++; + + if (myoptind >= argc || argv[myoptind] == NULL || + argv[myoptind][0] != '-' || argv[myoptind][1] == '\0') { + myoptarg = NULL; + if (myoptind < argc) + myoptarg = argv[myoptind]; + + return -1; + } + + if (strcmp(argv[myoptind], "--") == 0) { + myoptind++; + myoptarg = NULL; + + if (myoptind < argc) + myoptarg = argv[myoptind]; + + return -1; + } + + if (strncmp(argv[myoptind], "--", 2) == 0) { + const struct mygetopt_long_config *i; + c = -1; + myoptarg = NULL; + for (i = longopts; i->name; ++i) { + if (! strcmp(argv[myoptind] + 2, i->name)) { + c = i->value; + myoptind++; + if (longindex) + *longindex = (int)((size_t)(i - longopts) / sizeof i[0]); + if (i->takes_arg) { + if (myoptind < argc) { + if (i->takes_arg == 1 || argv[myoptind][0] != '-') { + myoptarg = argv[myoptind]; + myoptind++; + } + } else if (i->takes_arg != 2) { + return -1; + } + } + break; + } + } + + return c; + } + + next = argv[myoptind]; + next++; /* skip - */ + myoptind++; + } + + c = (int)(unsigned char)*next++; + /* The C++ strchr can return a different value */ + cp = (char*)strchr(optstring, c); + + if (cp == NULL || c == ':' || c == ';') + return '?'; + + cp++; + + if (*cp == ':') { + if (*next != '\0') { + myoptarg = next; + next = NULL; + } + else if (myoptind < argc) { + myoptarg = argv[myoptind]; + myoptind++; + } + else + return '?'; + } + else if (*cp == ';') { + myoptarg = (char*)""; + if (*next != '\0') { + myoptarg = next; + next = NULL; + } + else if (myoptind < argc) { + /* Check if next argument is not a parameter argument */ + if (argv[myoptind] && argv[myoptind][0] != '-') { + myoptarg = argv[myoptind]; + myoptind++; + } + } + } + + return c; +} + + +#ifdef WOLFSSL_ENCRYPTED_KEYS + +static WC_INLINE int PasswordCallBack(char* passwd, int sz, int rw, void* userdata) +{ + (void)rw; + (void)userdata; + if (userdata != NULL) { + strncpy(passwd, (char*)userdata, (size_t) sz); + return (int)XSTRLEN((char*)userdata); + } + else { + strncpy(passwd, "yassl123", (size_t) sz); + return 8; + } +} + +#endif + +static const char* client_showpeer_msg[][9] = { + /* English */ + { + "SSL version is", + "SSL cipher suite is", + "SSL signature algorithm is", + "SSL curve name is", + "SSL DH size is", + "SSL reused session", + "Alternate cert chain used", + "peer's cert info:", + NULL + }, +#ifndef NO_MULTIBYTE_PRINT + /* Japanese */ + { + "SSL バージョンは", + "SSL 暗号スイートは", + "SSL signature algorithm is", + "SSL 曲線名は", + "SSL DH サイズは", + "SSL 再利用セッション", + "代替証明チェーンを使用", + "相手方証明書情報", + NULL + }, +#endif +}; + +#if defined(KEEP_PEER_CERT) || defined(KEEP_OUR_CERT) || defined(SESSION_CERTS) +static const char* client_showx509_msg[][5] = { + /* English */ + { + "issuer", + "subject", + "altname", + "serial number", + NULL + }, +#ifndef NO_MULTIBYTE_PRINT + /* Japanese */ + { + "発行者", + "サブジェクト", + "代替名", + "シリアル番号", + NULL + }, +#endif +}; + +/* lng_index is to specify the language for displaying message. */ +/* 0:English, 1:Japanese */ +static WC_INLINE void ShowX509Ex(WOLFSSL_X509* x509, const char* hdr, + int lng_index) +{ + char* altName; + char* issuer; + char* subject; + byte serial[32]; + int ret; + int sz = sizeof(serial); + const char** words = client_showx509_msg[lng_index]; + + if (x509 == NULL) { + fprintf(stderr, "%s No Cert\n", hdr); + return; + } + + issuer = wolfSSL_X509_NAME_oneline( + wolfSSL_X509_get_issuer_name(x509), 0, 0); + subject = wolfSSL_X509_NAME_oneline( + wolfSSL_X509_get_subject_name(x509), 0, 0); + + printf("%s\n %s : %s\n %s: %s\n", hdr, words[0], issuer, words[1], subject); + + while ( (altName = wolfSSL_X509_get_next_altname(x509)) != NULL) + printf(" %s = %s\n", words[2], altName); + + ret = wolfSSL_X509_get_serial_number(x509, serial, &sz); + if (ret == WOLFSSL_SUCCESS) { + int i; + int strLen; + char serialMsg[80]; + + /* testsuite has multiple threads writing to stdout, get output + * message ready to write once */ + strLen = XSNPRINTF(serialMsg, sizeof(serialMsg), " %s", words[3]); + for (i = 0; i < sz; i++) + strLen = XSNPRINTF(serialMsg + strLen, + sizeof(serialMsg) - (size_t)strLen, ":%02x ", serial[i]); + printf("%s\n", serialMsg); + } + + XFREE(subject, 0, DYNAMIC_TYPE_OPENSSL); + XFREE(issuer, 0, DYNAMIC_TYPE_OPENSSL); + +#if defined(SHOW_CERTS) && defined(OPENSSL_EXTRA) + { + WOLFSSL_BIO* bio; + char buf[WC_ASN_NAME_MAX]; + int textSz; + + /* print out domain component if certificate has it */ + textSz = wolfSSL_X509_NAME_get_text_by_NID( + wolfSSL_X509_get_subject_name(x509), NID_domainComponent, + buf, sizeof(buf)); + if (textSz > 0) { + printf("Domain Component = %s\n", buf); + } + + bio = wolfSSL_BIO_new(wolfSSL_BIO_s_file()); + if (bio != NULL) { + wolfSSL_BIO_set_fp(bio, stdout, BIO_NOCLOSE); + wolfSSL_X509_print(bio, x509); + wolfSSL_BIO_free(bio); + } + } +#endif /* SHOW_CERTS && OPENSSL_EXTRA */ +} +/* original ShowX509 to maintain compatibility */ +static WC_INLINE void ShowX509(WOLFSSL_X509* x509, const char* hdr) +{ + ShowX509Ex(x509, hdr, 0); +} + +#endif /* KEEP_PEER_CERT || KEEP_OUR_CERT || SESSION_CERTS */ + +#if defined(SHOW_CERTS) && defined(SESSION_CERTS) && \ + (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) +static WC_INLINE void ShowX509Chain(WOLFSSL_X509_CHAIN* chain, int count, + const char* hdr) +{ + int i; + int length; + unsigned char certPem[3072]; + WOLFSSL_X509* chainX509; + + for (i = 0; i < count; i++) { + wolfSSL_get_chain_cert_pem(chain, i, certPem, sizeof(certPem), &length); + certPem[length] = 0; + printf("\n%s: %d has length %d data = \n%s\n", hdr, i, length, certPem); + + chainX509 = wolfSSL_get_chain_X509(chain, i); + if (chainX509) + ShowX509(chainX509, hdr); + else + fprintf(stderr, "get_chain_X509 failed\n"); + wolfSSL_FreeX509(chainX509); + } +} +#endif /* SHOW_CERTS && SESSION_CERTS */ + +/* lng_index is to specify the language for displaying message. */ +/* 0:English, 1:Japanese */ +static WC_INLINE void showPeerEx(WOLFSSL* ssl, int lng_index) +{ + WOLFSSL_CIPHER* cipher; + const char** words = client_showpeer_msg[lng_index]; + +#if defined(HAVE_ECC) || defined(HAVE_CURVE25519) || defined(HAVE_CURVE448) || \ + !defined(NO_DH) + const char *name; +#endif +#ifndef NO_DH + int bits; +#endif +#if defined(OPENSSL_EXTRA) && !defined(WOLFCRYPT_ONLY) + int nid; +#endif +#ifdef KEEP_PEER_CERT + WOLFSSL_X509* peer = wolfSSL_get_peer_certificate(ssl); + if (peer) + ShowX509Ex(peer, words[6], lng_index); + else + fprintf(stderr, "peer has no cert!\n"); + wolfSSL_FreeX509(peer); +#endif +#if defined(SHOW_CERTS) && defined(KEEP_OUR_CERT) && \ + (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) + ShowX509(wolfSSL_get_certificate(ssl), "our cert info:"); + printf("Peer verify result = %lu\n", wolfSSL_get_verify_result(ssl)); +#endif /* SHOW_CERTS && KEEP_OUR_CERT */ + printf("%s %s\n", words[0], wolfSSL_get_version(ssl)); + + cipher = wolfSSL_get_current_cipher(ssl); + printf("%s %s\n", words[1], wolfSSL_CIPHER_get_name(cipher)); +#if defined(OPENSSL_EXTRA) && !defined(WOLFCRYPT_ONLY) + if (wolfSSL_get_signature_nid(ssl, &nid) == WOLFSSL_SUCCESS) { + printf("%s %s\n", words[2], OBJ_nid2sn(nid)); + } +#endif +#if defined(HAVE_ECC) || defined(HAVE_CURVE25519) || defined(HAVE_CURVE448) || \ + !defined(NO_DH) + if ((name = wolfSSL_get_curve_name(ssl)) != NULL) + printf("%s %s\n", words[3], name); +#endif +#ifndef NO_DH + else if ((bits = wolfSSL_GetDhKey_Sz(ssl)) > 0) + printf("%s %d bits\n", words[4], bits); +#endif + if (wolfSSL_session_reused(ssl)) + printf("%s\n", words[5]); +#ifdef WOLFSSL_ALT_CERT_CHAINS + if (wolfSSL_is_peer_alt_cert_chain(ssl)) + printf("%s\n", words[6]); +#endif + +#if defined(SHOW_CERTS) && defined(SESSION_CERTS) && \ + (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) + { + WOLFSSL_X509_CHAIN* chain; + + chain = wolfSSL_get_peer_chain(ssl); + ShowX509Chain(chain, wolfSSL_get_chain_count(chain), "session cert"); + + #ifdef WOLFSSL_ALT_CERT_CHAINS + if (wolfSSL_is_peer_alt_cert_chain(ssl)) { + chain = wolfSSL_get_peer_alt_chain(ssl); + ShowX509Chain(chain, wolfSSL_get_chain_count(chain), "alt cert"); + } + #endif + } +#endif /* SHOW_CERTS && SESSION_CERTS */ + (void)ssl; +} +/* original showPeer to maintain compatibility */ +static WC_INLINE void showPeer(WOLFSSL* ssl) +{ + showPeerEx(ssl, 0); +} + +static WC_INLINE void build_addr(SOCKADDR_IN_T* addr, const char* peer, + word16 port, int udp, int sctp) +{ + int useLookup = 0; + (void)useLookup; + (void)udp; + (void)sctp; + + if (addr == NULL) { + err_sys("invalid argument to build_addr, addr is NULL"); + return; + } + + XMEMSET(addr, 0, sizeof(SOCKADDR_IN_T)); + +#ifndef TEST_IPV6 + /* peer could be in human readable form */ + if ( ((size_t)peer != INADDR_ANY) && isalpha((unsigned char)peer[0])) { + #ifdef WOLFSSL_USE_POPEN_HOST + char host_ipaddr[4] = { 127, 0, 0, 1 }; + int found = 1; + + if ((XSTRCMP(peer, "localhost") != 0) && + (XSTRCMP(peer, "127.0.0.1") != 0)) { + FILE* fp; + char cmd[100]; + + XSTRNCPY(cmd, "host ", 6); + XSTRNCAT(cmd, peer, 99 - XSTRLEN(cmd)); + found = 0; + fp = popen(cmd, "r"); + if (fp != NULL) { + char host_out[100]; + while (fgets(host_out, sizeof(host_out), fp) != NULL) { + int i; + int j = 0; + for (j = 0; host_out[j] != '\0'; j++) { + if ((host_out[j] >= '0') && (host_out[j] <= '9')) { + break; + } + } + found = (host_out[j] >= '0') && (host_out[j] <= '9'); + if (!found) { + continue; + } + + for (i = 0; i < 4; i++) { + host_ipaddr[i] = atoi(host_out + j); + while ((host_out[j] >= '0') && (host_out[j] <= '9')) { + j++; + } + if (host_out[j] == '.') { + j++; + found &= (i != 3); + } + else { + found &= (i == 3); + break; + } + } + if (found) { + break; + } + } + pclose(fp); + } + } + if (found) { + XMEMCPY(&addr->sin_addr.s_addr, host_ipaddr, sizeof(host_ipaddr)); + useLookup = 1; + } + #elif !defined(WOLFSSL_USE_GETADDRINFO) + #if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) + int err; + struct hostent* entry = gethostbyname(peer, &err); + #elif defined(WOLFSSL_TIRTOS) + struct hostent* entry = (struct hostent*)DNSGetHostByName(peer); + #elif defined(WOLFSSL_VXWORKS) + struct hostent* entry = (struct hostent*)hostGetByName((char*)peer); + #else + struct hostent* entry = gethostbyname(peer); + #endif + + if (entry) { + XMEMCPY(&addr->sin_addr.s_addr, entry->h_addr_list[0], + (size_t) entry->h_length); + useLookup = 1; + } + #else + struct zsock_addrinfo hints, *addrInfo; + char portStr[6]; + XSNPRINTF(portStr, sizeof(portStr), "%d", port); + XMEMSET(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = udp ? SOCK_DGRAM : SOCK_STREAM; + hints.ai_protocol = udp ? IPPROTO_UDP : IPPROTO_TCP; + if (getaddrinfo((char*)peer, portStr, &hints, &addrInfo) == 0) { + XMEMCPY(addr, addrInfo->ai_addr, sizeof(*addr)); + useLookup = 1; + } + #endif + else + err_sys("no entry for host"); + } +#endif + + +#ifndef TEST_IPV6 + #if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) + addr->sin_family = PF_INET; + #else + addr->sin_family = AF_INET_V; + #endif + addr->sin_port = XHTONS(port); + if ((size_t)peer == INADDR_ANY) + addr->sin_addr.s_addr = INADDR_ANY; + else { + if (!useLookup) + addr->sin_addr.s_addr = inet_addr(peer); + } +#else + addr->sin6_family = AF_INET_V; + addr->sin6_port = XHTONS(port); + if ((size_t)peer == INADDR_ANY) { + addr->sin6_addr = in6addr_any; + } + else { + #if defined(HAVE_GETADDRINFO) + struct addrinfo hints; + struct addrinfo* answer = NULL; + int ret; + char strPort[80]; + + XMEMSET(&hints, 0, sizeof(hints)); + + hints.ai_family = AF_INET_V; + if (udp) { + hints.ai_socktype = SOCK_DGRAM; + hints.ai_protocol = IPPROTO_UDP; + } + #ifdef WOLFSSL_SCTP + else if (sctp) { + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_SCTP; + } + #endif + else { + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; + } + + (void)SNPRINTF(strPort, sizeof(strPort), "%d", port); + strPort[79] = '\0'; + + ret = getaddrinfo(peer, strPort, &hints, &answer); + if (ret < 0 || answer == NULL) + err_sys("getaddrinfo failed"); + + XMEMCPY(addr, answer->ai_addr, answer->ai_addrlen); + freeaddrinfo(answer); + #else + printf("no ipv6 getaddrinfo, loopback only tests/examples\n"); + addr->sin6_addr = in6addr_loopback; + #endif + } +#endif +} + + +static WC_INLINE void tcp_socket(SOCKET_T* sockfd, int udp, int sctp) +{ + (void)sctp; + + if (udp) + *sockfd = socket(AF_INET_V, SOCK_DGRAM, IPPROTO_UDP); +#ifdef WOLFSSL_SCTP + else if (sctp) + *sockfd = socket(AF_INET_V, SOCK_STREAM, IPPROTO_SCTP); +#endif + else + *sockfd = socket(AF_INET_V, SOCK_STREAM, IPPROTO_TCP); + + if(WOLFSSL_SOCKET_IS_INVALID(*sockfd)) { + err_sys_with_errno("socket failed\n"); + } + +#if !defined(USE_WINDOWS_API) && !defined(__WATCOMC__) && !defined(__OS2__) +#ifdef SO_NOSIGPIPE + { + int on = 1; + socklen_t len = sizeof(on); + int res = setsockopt(*sockfd, SOL_SOCKET, SO_NOSIGPIPE, &on, len); + if (res < 0) + err_sys_with_errno("setsockopt SO_NOSIGPIPE failed\n"); + } +#elif defined(WOLFSSL_MDK_ARM) || defined (WOLFSSL_TIRTOS) ||\ + defined(WOLFSSL_KEIL_TCP_NET) || defined(WOLFSSL_ZEPHYR) + /* nothing to define */ +#elif defined(NETOS) + /* TODO: signal(SIGPIPE, SIG_IGN); */ +#else /* no S_NOSIGPIPE */ + signal(SIGPIPE, SIG_IGN); +#endif /* S_NOSIGPIPE */ + +#if defined(TCP_NODELAY) + if (!udp && !sctp) + { + int on = 1; + socklen_t len = sizeof(on); + int res = setsockopt(*sockfd, IPPROTO_TCP, TCP_NODELAY, &on, len); + if (res < 0) + err_sys_with_errno("setsockopt TCP_NODELAY failed\n"); + } +#endif +#endif /* !defined(USE_WINDOWS_API) && !defined(__WATCOMC__) && ... */ +} + +#if defined(WOLFSSL_WOLFSENTRY_HOOKS) && defined(WOLFSENTRY_H) + +#include <wolfsentry/wolfssl_test.h> + +#else /* !WOLFSSL_WOLFSENTRY_HOOKS */ + +static WC_INLINE void tcp_connect(SOCKET_T* sockfd, const char* ip, word16 port, + int udp, int sctp, WOLFSSL* ssl) +{ + SOCKADDR_IN_T addr; + build_addr(&addr, ip, port, udp, sctp); + if (udp) { + wolfSSL_dtls_set_peer(ssl, &addr, sizeof(addr)); + } + tcp_socket(sockfd, udp, sctp); + + if (!udp) { + if (connect(*sockfd, (const struct sockaddr*)&addr, sizeof(addr)) != 0) + err_sys_with_errno("tcp connect failed"); + } +} + +#endif /* WOLFSSL_WOLFSENTRY_HOOKS */ + + +static WC_INLINE void udp_connect(SOCKET_T* sockfd, const char* ip, word16 port) +{ + SOCKADDR_IN_T addr; + build_addr(&addr, ip, port, 1, 0); + if (connect(*sockfd, (const struct sockaddr*)&addr, sizeof(addr)) != 0) + err_sys_with_errno("tcp connect failed"); +} + + +enum { + TEST_SELECT_FAIL, + TEST_TIMEOUT, + TEST_RECV_READY, + TEST_SEND_READY, + TEST_ERROR_READY +}; + + +#if !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_KEIL_TCP_NET) && \ + !defined(WOLFSSL_TIRTOS) +static WC_INLINE int tcp_select_ex(SOCKET_T socketfd, int to_sec, int rx) +{ + fd_set fds, errfds; + fd_set* recvfds = NULL; + fd_set* sendfds = NULL; + SOCKET_T nfds = socketfd + 1; +#if !defined(__INTEGRITY) && !defined(__WATCOMC__) + struct timeval timeout = {(to_sec > 0) ? to_sec : 0, 0}; +#else + struct timeval timeout; +#endif + int result; + + FD_ZERO(&fds); + FD_SET(socketfd, &fds); + FD_ZERO(&errfds); + FD_SET(socketfd, &errfds); + + if (rx) + recvfds = &fds; + else + sendfds = &fds; + +#if defined(__INTEGRITY) || defined(__WATCOMC__) + timeout.tv_sec = (long long)(to_sec > 0) ? to_sec : 0; + timeout.tv_usec = 0; +#endif + result = select(nfds, recvfds, sendfds, &errfds, &timeout); + + if (result == 0) + return TEST_TIMEOUT; + else if (result > 0) { + if (FD_ISSET(socketfd, &fds)) { + if (rx) + return TEST_RECV_READY; + else + return TEST_SEND_READY; + } + else if(FD_ISSET(socketfd, &errfds)) + return TEST_ERROR_READY; + } + + return TEST_SELECT_FAIL; +} + +static WC_INLINE int tcp_select(SOCKET_T socketfd, int to_sec) +{ + return tcp_select_ex(socketfd, to_sec, 1); +} + +static WC_INLINE int tcp_select_tx(SOCKET_T socketfd, int to_sec) +{ + return tcp_select_ex(socketfd, to_sec, 0); +} + +#elif defined(WOLFSSL_TIRTOS) || defined(WOLFSSL_KEIL_TCP_NET) +static WC_INLINE int tcp_select(SOCKET_T socketfd, int to_sec) +{ + return TEST_RECV_READY; +} +static WC_INLINE int tcp_select_tx(SOCKET_T socketfd, int to_sec) +{ + return TEST_SEND_READY; +} +#endif /* !WOLFSSL_MDK_ARM */ + + +static WC_INLINE void tcp_listen(SOCKET_T* sockfd, word16* port, int useAnyAddr, + int udp, int sctp) +{ + SOCKADDR_IN_T addr; + + /* don't use INADDR_ANY by default, firewall may block, make user switch + on */ + build_addr(&addr, (useAnyAddr ? (const char*)INADDR_ANY : wolfSSLIP), + *port, udp, sctp); + tcp_socket(sockfd, udp, sctp); + +#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_MDK_ARM)\ + && !defined(WOLFSSL_KEIL_TCP_NET) && !defined(WOLFSSL_ZEPHYR) + { + int res, on = 1; + socklen_t len = sizeof(on); + res = setsockopt(*sockfd, SOL_SOCKET, SO_REUSEADDR, &on, len); + if (res < 0) + err_sys_with_errno("setsockopt SO_REUSEADDR failed\n"); + } +#ifdef SO_REUSEPORT + { + int res, on = 1; + socklen_t len = sizeof(on); + res = setsockopt(*sockfd, SOL_SOCKET, SO_REUSEPORT, &on, len); + if (res < 0) + err_sys_with_errno("setsockopt SO_REUSEPORT failed\n"); + } +#endif +#endif + + if (bind(*sockfd, (const struct sockaddr*)&addr, sizeof(addr)) != 0) + err_sys_with_errno("tcp bind failed"); + if (!udp) { + #ifdef WOLFSSL_KEIL_TCP_NET + #define SOCK_LISTEN_MAX_QUEUE 1 + #else + #define SOCK_LISTEN_MAX_QUEUE 5 + #endif + if (listen(*sockfd, SOCK_LISTEN_MAX_QUEUE) != 0) + err_sys_with_errno("tcp listen failed"); + } + #if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_TIRTOS) \ + && !defined(WOLFSSL_ZEPHYR) + if (*port == 0) { + socklen_t len = sizeof(addr); + if (getsockname(*sockfd, (struct sockaddr*)&addr, &len) == 0) { + #ifndef TEST_IPV6 + *port = XNTOHS(addr.sin_port); + #else + *port = XNTOHS(addr.sin6_port); + #endif + } + } + #endif +} + + +#if 0 +static WC_INLINE int udp_read_connect(SOCKET_T sockfd) +{ + SOCKADDR_IN_T cliaddr; + byte b[1500]; + int n; + socklen_t len = sizeof(cliaddr); + + n = (int)recvfrom(sockfd, (char*)b, sizeof(b), MSG_PEEK, + (struct sockaddr*)&cliaddr, &len); + if (n > 0) { + if (connect(sockfd, (const struct sockaddr*)&cliaddr, + sizeof(cliaddr)) != 0) + err_sys("udp connect failed"); + } + else + err_sys("recvfrom failed"); + + return sockfd; +} +#endif + +static WC_INLINE void udp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd, + int useAnyAddr, word16 port, func_args* args) +{ + SOCKADDR_IN_T addr; + + (void)args; + build_addr(&addr, (useAnyAddr ? (const char*)INADDR_ANY : wolfSSLIP), + port, 1, 0); + tcp_socket(sockfd, 1, 0); + + +#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_MDK_ARM) \ + && !defined(WOLFSSL_KEIL_TCP_NET) && !defined(WOLFSSL_ZEPHYR) + { + int res, on = 1; + socklen_t len = sizeof(on); + res = setsockopt(*sockfd, SOL_SOCKET, SO_REUSEADDR, &on, len); + if (res < 0) + err_sys_with_errno("setsockopt SO_REUSEADDR failed\n"); + } +#ifdef SO_REUSEPORT + { + int res, on = 1; + socklen_t len = sizeof(on); + res = setsockopt(*sockfd, SOL_SOCKET, SO_REUSEPORT, &on, len); + if (res < 0) + err_sys_with_errno("setsockopt SO_REUSEPORT failed\n"); + } +#endif +#endif + + if (bind(*sockfd, (const struct sockaddr*)&addr, sizeof(addr)) != 0) + err_sys_with_errno("tcp bind failed"); + + #if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_TIRTOS) && \ + !defined(SINGLE_THREADED) + if (port == 0) { + socklen_t len = sizeof(addr); + if (getsockname(*sockfd, (struct sockaddr*)&addr, &len) == 0) { + #ifndef TEST_IPV6 + port = XNTOHS(addr.sin_port); + #else + port = XNTOHS(addr.sin6_port); + #endif + } + } + #else + (void)port; + #endif + + if (args != NULL && args->signal != NULL) { +#ifndef SINGLE_THREADED + tcp_ready* ready = args->signal; + #ifdef WOLFSSL_COND + THREAD_CHECK_RET(wolfSSL_CondStart(&ready->cond)); + #endif + ready->ready = 1; + ready->port = port; + #ifdef WOLFSSL_COND + /* signal ready to accept data */ + THREAD_CHECK_RET(wolfSSL_CondSignal(&ready->cond)); + THREAD_CHECK_RET(wolfSSL_CondEnd(&ready->cond)); + #endif +#endif /* !SINGLE_THREADED */ + } + else { + fprintf(stderr, "args or args->signal was NULL. Not setting ready info."); + } + + *clientfd = *sockfd; +} + +static WC_INLINE void tcp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd, + func_args* args, word16 port, int useAnyAddr, + int udp, int sctp, int ready_file, int do_listen, + SOCKADDR_IN_T *client_addr, socklen_t *client_len) +{ + tcp_ready* ready = NULL; + + (void) ready; /* Account for case when "ready" is not used */ + + if (udp) { + udp_accept(sockfd, clientfd, useAnyAddr, port, args); + return; + } + + if(do_listen) { + tcp_listen(sockfd, &port, useAnyAddr, udp, sctp); + +#ifndef SINGLE_THREADED + /* signal ready to tcp_accept */ + if (args) + ready = args->signal; + if (ready) { + #ifdef WOLFSSL_COND + THREAD_CHECK_RET(wolfSSL_CondStart(&ready->cond)); + #endif + ready->ready = 1; + ready->port = port; + #ifdef WOLFSSL_COND + THREAD_CHECK_RET(wolfSSL_CondSignal(&ready->cond)); + THREAD_CHECK_RET(wolfSSL_CondEnd(&ready->cond)); + #endif + } +#endif /* !SINGLE_THREADED */ + + if (ready_file) { + #if !defined(NO_FILESYSTEM) || defined(FORCE_BUFFER_TEST) && \ + !defined(NETOS) + XFILE srf = (XFILE)NULL; + if (args) + ready = args->signal; + + if (ready) { + srf = XFOPEN(ready->srfName, "w"); + + if (srf) { + /* let's write port sever is listening on to ready file + external monitor can then do ephemeral ports by passing + -p 0 to server on supported platforms with -R ready_file + client can then wait for existence of ready_file and see + which port the server is listening on. */ + LIBCALL_CHECK_RET(fprintf(srf, "%d\n", (int)port)); + fclose(srf); + } + } + #endif + } + } + + *clientfd = accept(*sockfd, (struct sockaddr*)client_addr, + (ACCEPT_THIRD_T)client_len); + if(WOLFSSL_SOCKET_IS_INVALID(*clientfd)) { + err_sys_with_errno("tcp accept failed"); + } +} + + +static WC_INLINE void tcp_set_nonblocking(SOCKET_T* sockfd) +{ + #if defined(USE_WINDOWS_API) || defined(EBSNET) + unsigned long blocking = 1; + int ret = ioctlsocket(*sockfd, FIONBIO, &blocking); + if (ret == SOCKET_ERROR) + err_sys_with_errno("ioctlsocket failed"); + #elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) \ + || defined (WOLFSSL_TIRTOS)|| defined(WOLFSSL_VXWORKS) \ + || defined(WOLFSSL_ZEPHYR) + /* non blocking not supported, for now */ + #elif defined(__WATCOMC__) && defined(__OS2__) + int blocking = 1; + if (ioctl(*sockfd, FIONBIO, &blocking) == -1) + err_sys_with_errno("ioctl failed"); + #else + int flags = fcntl(*sockfd, F_GETFL, 0); + if (flags < 0) + err_sys_with_errno("fcntl get failed"); + flags = fcntl(*sockfd, F_SETFL, flags | O_NONBLOCK); + if (flags < 0) + err_sys_with_errno("fcntl set failed"); + #endif +} + +static WC_INLINE void tcp_set_blocking(SOCKET_T* sockfd) +{ + #ifdef USE_WINDOWS_API + unsigned long blocking = 0; + int ret = ioctlsocket(*sockfd, FIONBIO, &blocking); + if (ret == SOCKET_ERROR) + err_sys_with_errno("ioctlsocket failed"); + #elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) \ + || defined (WOLFSSL_TIRTOS)|| defined(WOLFSSL_VXWORKS) \ + || defined(WOLFSSL_ZEPHYR) + /* non blocking not supported, for now */ + #elif defined(__WATCOMC__) && defined(__OS2__) + int blocking = 0; + if (ioctl(*sockfd, FIONBIO, &blocking) == -1) + err_sys_with_errno("ioctl failed"); + #else + int flags = fcntl(*sockfd, F_GETFL, 0); + if (flags < 0) + err_sys_with_errno("fcntl get failed"); + flags = fcntl(*sockfd, F_SETFL, flags & (~O_NONBLOCK)); + if (flags < 0) + err_sys_with_errno("fcntl set failed"); + #endif +} + +#ifndef NO_PSK + +/* identity is OpenSSL testing default for openssl s_client, keep same */ +static const char* kIdentityStr = "Client_identity"; + +static WC_INLINE unsigned int my_psk_client_cb(WOLFSSL* ssl, const char* hint, + char* identity, unsigned int id_max_len, unsigned char* key, + unsigned int key_max_len) +{ + unsigned int ret; + + (void)ssl; + (void)hint; + (void)key_max_len; + + /* see internal.h MAX_PSK_ID_LEN for PSK identity limit */ + XSTRNCPY(identity, kIdentityStr, id_max_len); + + if (wolfSSL_GetVersion(ssl) != WOLFSSL_TLSV1_3 && + wolfSSL_GetVersion(ssl) != WOLFSSL_DTLSV1_3) { + /* test key in hex is 0x1a2b3c4d , in decimal 439,041,101 , we're using + * unsigned binary */ + key[0] = 0x1a; + key[1] = 0x2b; + key[2] = 0x3c; + key[3] = 0x4d; + + ret = 4; /* length of key in octets or 0 for error */ + } + else { + int i; + int b = 0x01; + + for (i = 0; i < 32; i++, b += 0x22) { + if (b >= 0x100) + b = 0x01; + key[i] = (unsigned char) b; + } + + ret = 32; /* length of key in octets or 0 for error */ + } + +#if defined(HAVE_PK_CALLBACKS) && defined(TEST_PK_PSK) + WOLFSSL_PKMSG("PSK Client using HW (Len %d, Hint %s)\n", ret, hint); + ret = (unsigned int)USE_HW_PSK; +#endif + + return ret; +} + + +static WC_INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity, + unsigned char* key, unsigned int key_max_len) +{ + unsigned int ret; + + (void)ssl; + (void)key_max_len; + + /* see internal.h MAX_PSK_ID_LEN for PSK identity limit */ + if (XSTRCMP(identity, kIdentityStr) != 0) + return 0; + + if (wolfSSL_GetVersion(ssl) != WOLFSSL_TLSV1_3 && + wolfSSL_GetVersion(ssl) != WOLFSSL_DTLSV1_3) { + /* test key in hex is 0x1a2b3c4d , in decimal 439,041,101 , we're using + * unsigned binary */ + key[0] = 0x1a; + key[1] = 0x2b; + key[2] = 0x3c; + key[3] = 0x4d; + + ret = 4; /* length of key in octets or 0 for error */ + } + else { + int i; + int b = 0x01; + + for (i = 0; i < 32; i++, b += 0x22) { + if (b >= 0x100) + b = 0x01; + key[i] = (unsigned char) b; + } + + ret = 32; /* length of key in octets or 0 for error */ + } +#if defined(HAVE_PK_CALLBACKS) && defined(TEST_PK_PSK) + WOLFSSL_PKMSG("PSK Server using HW (Len %d, Hint %s)\n", ret, identity); + ret = (unsigned int)USE_HW_PSK; +#endif + + return ret; +} + +#ifdef WOLFSSL_TLS13 +static WC_INLINE unsigned int my_psk_client_tls13_cb(WOLFSSL* ssl, + const char* hint, char* identity, unsigned int id_max_len, + unsigned char* key, unsigned int key_max_len, const char** ciphersuite) +{ + unsigned int ret; + int i; + int b = 0x01; + const char* userCipher = (const char*)wolfSSL_get_psk_callback_ctx(ssl); + + (void)ssl; + (void)hint; + (void)key_max_len; + + /* see internal.h MAX_PSK_ID_LEN for PSK identity limit */ + XSTRNCPY(identity, kIdentityStr, id_max_len); + + for (i = 0; i < 32; i++, b += 0x22) { + if (b >= 0x100) + b = 0x01; + key[i] = (unsigned char) b; + } + +#if defined(WOLFSSL_SHA384) && defined(WOLFSSL_AES_256) + *ciphersuite = userCipher ? userCipher : "TLS13-AES256-GCM-SHA384"; +#else + *ciphersuite = userCipher ? userCipher : "TLS13-AES128-GCM-SHA256"; +#endif + + ret = 32; /* length of key in octets or 0 for error */ + +#if defined(HAVE_PK_CALLBACKS) && defined(TEST_PK_PSK) + WOLFSSL_PKMSG("PSK Client TLS 1.3 using HW (Len %d, Hint %s)\n", ret, hint); + ret = (unsigned int)USE_HW_PSK; +#endif + + return ret; +} + + +static WC_INLINE unsigned int my_psk_server_tls13_cb(WOLFSSL* ssl, + const char* identity, unsigned char* key, unsigned int key_max_len, + const char** ciphersuite) +{ + unsigned int ret; + int i; + int b = 0x01; + size_t kIdLen = XSTRLEN(kIdentityStr); + const char* userCipher = (const char*)wolfSSL_get_psk_callback_ctx(ssl); + + (void)ssl; + (void)key_max_len; + + /* see internal.h MAX_PSK_ID_LEN for PSK identity limit */ + if (XSTRNCMP(identity, kIdentityStr, kIdLen) != 0) + return 0; + if (identity[kIdLen] != '\0') { + userCipher = wolfSSL_get_cipher_name_by_hash(ssl, identity + kIdLen); + } + + for (i = 0; i < 32; i++, b += 0x22) { + if (b >= 0x100) + b = 0x01; + key[i] = (unsigned char) b; + } + +#if defined(WOLFSSL_SHA384) && defined(WOLFSSL_AES_256) + *ciphersuite = userCipher ? userCipher : "TLS13-AES256-GCM-SHA384"; +#else + *ciphersuite = userCipher ? userCipher : "TLS13-AES128-GCM-SHA256"; +#endif + + ret = 32; /* length of key in octets or 0 for error */ + +#if defined(HAVE_PK_CALLBACKS) && defined(TEST_PK_PSK) + WOLFSSL_PKMSG("PSK Server TLS 1.3 using HW (Len %d, Hint %s)\n", + ret, identity); + ret = (unsigned int)USE_HW_PSK; +#endif + + return ret; +} +#endif + +#ifdef OPENSSL_EXTRA +static WC_INLINE int my_psk_use_session_cb(WOLFSSL* ssl, + const WOLFSSL_EVP_MD* md, const unsigned char **id, + size_t* idlen, WOLFSSL_SESSION **sess) +{ +#if defined(OPENSSL_ALL) && !defined(NO_CERTS) && !defined(NO_FILESYSTEM) + static unsigned char local_psk[32]; + int i; + WOLFSSL_SESSION* lsess; + char buf[256]; + const char* cipher_id = "TLS13-AES128-GCM-SHA256"; + const SSL_CIPHER* cipher = NULL; + STACK_OF(SSL_CIPHER) *supportedCiphers = NULL; + int numCiphers = 0; + (void)ssl; + (void)md; + + printf("use psk session callback \n"); + + lsess = SSL_SESSION_new(); + if (lsess == NULL) { + return 0; + } + supportedCiphers = SSL_get_ciphers(ssl); + numCiphers = sk_num(supportedCiphers); + + for (i = 0; i < numCiphers; ++i) { + XMEMSET(buf, 0, sizeof(buf)); + + if ((cipher = (const WOLFSSL_CIPHER*)sk_value(supportedCiphers, i))) { + SSL_CIPHER_description(cipher, buf, sizeof(buf)); + } + + if (XMEMCMP(cipher_id, buf, XSTRLEN(cipher_id)) == 0) { + break; + } + } + + if (i != numCiphers) { + int b = 0x01; + SSL_SESSION_set_cipher(lsess, cipher); + for (i = 0; i < 32; i++, b += 0x22) { + if (b >= 0x100) + b = 0x01; + local_psk[i] = (unsigned char) b; + } + + *id = local_psk; + *idlen = 32; + *sess = lsess; + + return 1; + } + else { + *id = NULL; + *idlen = 0; + *sess = NULL; + SSL_SESSION_free(lsess); + return 0; + } +#else + (void)ssl; + (void)md; + (void)id; + (void)idlen; + (void)sess; + + return 0; +#endif +} +#endif /* OPENSSL_EXTRA */ + +static WC_INLINE unsigned int my_psk_client_cs_cb(WOLFSSL* ssl, + const char* hint, char* identity, unsigned int id_max_len, + unsigned char* key, unsigned int key_max_len, const char* ciphersuite) +{ + int i; + int b = 0x01; + + (void)ssl; + (void)hint; + (void)key_max_len; + +#ifdef WOLFSSL_PSK_MULTI_ID_PER_CS + /* Multiple calls for each cipher suite. First identity byte indicates the + * number of identities seen so far for cipher suite. */ + if (identity[0] != 0) { + return 0; + } +#endif + + /* see internal.h MAX_PSK_ID_LEN for PSK identity limit */ + XSTRNCPY(identity, kIdentityStr, id_max_len); + XSTRNCAT(identity, ciphersuite + XSTRLEN(ciphersuite) - 6, id_max_len); + + for (i = 0; i < 32; i++, b += 0x22) { + if (b >= 0x100) + b = 0x01; + key[i] = (unsigned char) b; + } + + return 32; /* length of key in octets or 0 for error */ +} + +#endif /* !NO_PSK */ + + +#if defined(WOLFSSL_USER_CURRTIME) + extern double current_time(int reset); + +#elif defined(USE_WINDOWS_API) + + #define WIN32_LEAN_AND_MEAN + #define _WINSOCKAPI_ /* block inclusion of winsock.h header file */ + #include <windows.h> + #undef _WINSOCKAPI_ /* undefine it for MINGW winsock2.h header file */ + + static WC_INLINE double current_time(int reset) + { + static int init = 0; + static LARGE_INTEGER freq; + + LARGE_INTEGER count; + + if (!init) { + QueryPerformanceFrequency(&freq); + init = 1; + } + + QueryPerformanceCounter(&count); + + (void)reset; + return (double)count.QuadPart / freq.QuadPart; + } + +#elif defined(WOLFSSL_TIRTOS) + extern double current_time(); +#elif defined(WOLFSSL_ZEPHYR) + extern double current_time(); +#else + +#if !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_KEIL_TCP_NET) && !defined(WOLFSSL_CHIBIOS) + #ifndef NETOS + #include <sys/time.h> + #endif + + static WC_INLINE double current_time(int reset) + { + struct timeval tv; + if (gettimeofday(&tv, NULL) < 0) + err_sys_with_errno("gettimeofday"); + (void)reset; + + return (double)tv.tv_sec + (double)tv.tv_usec / 1000000; + } +#else + extern double current_time(int reset); +#endif +#endif /* USE_WINDOWS_API */ + +#ifdef WOLFSSL_CALLBACKS +/* only for debug use! */ +static WC_INLINE void msgDebugCb(int write_p, int version, int content_type, + const void *buf, size_t len, WOLFSSL *ssl, void *arg) +{ + size_t z; + byte* pt; + + printf("Version %02X, content type = %d\n", version, content_type); + printf("%s ", (write_p)? "WRITING" : "READING"); + pt = (byte*)buf; + printf("DATA [%zu]: ", len); + for (z = 0; z < len; z++) + printf("%02X", pt[z]); + printf("\n"); + + (void)arg; + (void)ssl; +} +#endif /* WOLFSSL_CALLBACKS */ + +#if defined(HAVE_OCSP) && defined(WOLFSSL_NONBLOCK_OCSP) +static WC_INLINE int OCSPIOCb(void* ioCtx, const char* url, int urlSz, + unsigned char* request, int requestSz, unsigned char** response) +{ +#ifdef TEST_NONBLOCK_CERTS + static int ioCbCnt = 0; +#endif + + (void)ioCtx; + (void)url; + (void)urlSz; + (void)request; + (void)requestSz; + (void)response; + +#ifdef TEST_NONBLOCK_CERTS + if (ioCbCnt) { + ioCbCnt = 0; + return EmbedOcspLookup(ioCtx, url, urlSz, request, requestSz, response); + } + else { + ioCbCnt = 1; + return WOLFSSL_CBIO_ERR_WANT_READ; + } +#else + return EmbedOcspLookup(ioCtx, url, urlSz, request, requestSz, response); +#endif +} + +static WC_INLINE void OCSPRespFreeCb(void* ioCtx, unsigned char* response) +{ + EmbedOcspRespFree(ioCtx, response); +} +#endif + +#if !defined(NO_CERTS) + #if !defined(NO_FILESYSTEM) || \ + (defined(NO_FILESYSTEM) && defined(FORCE_BUFFER_TEST)) && \ + !defined(NETOS) + + /* reads file size, allocates buffer, reads into buffer, returns buffer */ + static WC_INLINE int load_file(const char* fname, byte** buf, size_t* bufLen) + { + int ret; + long int fileSz; + XFILE lFile; + + if (fname == NULL || buf == NULL || bufLen == NULL) + return BAD_FUNC_ARG; + + /* set defaults */ + *buf = NULL; + *bufLen = 0; + + /* open file (read-only binary) */ + lFile = XFOPEN(fname, "rb"); + if (!lFile) { + fprintf(stderr, "Error loading %s\n", fname); + return BAD_PATH_ERROR; + } + + LIBCALL_CHECK_RET(XFSEEK(lFile, 0, XSEEK_END)); + fileSz = (int)ftell(lFile); + LIBCALL_CHECK_RET(XFSEEK(lFile, 0, XSEEK_SET)); + if (fileSz > 0) { + *bufLen = (size_t)fileSz; + *buf = (byte*)malloc(*bufLen); + if (*buf == NULL) { + ret = MEMORY_E; + fprintf(stderr, + "Error allocating %lu bytes\n", (unsigned long)*bufLen); + } + else { + size_t readLen = fread(*buf, *bufLen, 1, lFile); + + /* check response code */ + ret = (readLen > 0) ? 0 : -1; + } + } + else { + ret = BUFFER_E; + } + fclose(lFile); + + return ret; + } + + enum { + WOLFSSL_CA = 1, + WOLFSSL_CERT = 2, + WOLFSSL_KEY = 3, + WOLFSSL_CERT_CHAIN = 4, + }; + + static WC_INLINE void load_buffer(WOLFSSL_CTX* ctx, const char* fname, int type) + { + int format = WOLFSSL_FILETYPE_PEM; + byte* buff = NULL; + size_t sz = 0; + + if (load_file(fname, &buff, &sz) != 0) { + err_sys("can't open file for buffer load " + "Please run from wolfSSL home directory if not"); + } + + /* determine format */ + if (strstr(fname, ".der")) + format = WOLFSSL_FILETYPE_ASN1; + + if (type == WOLFSSL_CA) { + if (wolfSSL_CTX_load_verify_buffer(ctx, buff, (long)sz, format) + != WOLFSSL_SUCCESS) + err_sys("can't load buffer ca file"); + } + else if (type == WOLFSSL_CERT) { + if (wolfSSL_CTX_use_certificate_buffer(ctx, buff, (long)sz, + format) != WOLFSSL_SUCCESS) + err_sys("can't load buffer cert file"); + } + else if (type == WOLFSSL_KEY) { + if (wolfSSL_CTX_use_PrivateKey_buffer(ctx, buff, (long)sz, + format) != WOLFSSL_SUCCESS) + err_sys("can't load buffer key file"); + } + else if (type == WOLFSSL_CERT_CHAIN) { + if (wolfSSL_CTX_use_certificate_chain_buffer_format(ctx, buff, + (long)sz, format) != WOLFSSL_SUCCESS) + err_sys("can't load cert chain buffer"); + } + + if (buff) + free(buff); + } + + static WC_INLINE void load_ssl_buffer(WOLFSSL* ssl, const char* fname, int type) + { + int format = WOLFSSL_FILETYPE_PEM; + byte* buff = NULL; + size_t sz = 0; + + if (load_file(fname, &buff, &sz) != 0) { + err_sys("can't open file for buffer load " + "Please run from wolfSSL home directory if not"); + } + + /* determine format */ + if (strstr(fname, ".der")) + format = WOLFSSL_FILETYPE_ASN1; + + if (type == WOLFSSL_CA) { + /* verify certs (CA's) use the shared ctx->cm (WOLFSSL_CERT_MANAGER) */ + WOLFSSL_CTX* ctx = wolfSSL_get_SSL_CTX(ssl); + if (wolfSSL_CTX_load_verify_buffer(ctx, buff, (long)sz, format) + != WOLFSSL_SUCCESS) + err_sys("can't load buffer ca file"); + } + else if (type == WOLFSSL_CERT) { + if (wolfSSL_use_certificate_buffer(ssl, buff, (long)sz, + format) != WOLFSSL_SUCCESS) + err_sys("can't load buffer cert file"); + } + else if (type == WOLFSSL_KEY) { + if (wolfSSL_use_PrivateKey_buffer(ssl, buff, (long)sz, + format) != WOLFSSL_SUCCESS) + err_sys("can't load buffer key file"); + } + else if (type == WOLFSSL_CERT_CHAIN) { + if (wolfSSL_use_certificate_chain_buffer_format(ssl, buff, + (long)sz, format) != WOLFSSL_SUCCESS) + err_sys("can't load cert chain buffer"); + } + + if (buff) + free(buff); + } + + #ifdef TEST_PK_PRIVKEY + static WC_INLINE int load_key_file(const char* fname, byte** derBuf, word32* derLen) + { + int ret; + byte* buf = NULL; + size_t bufLen; + + ret = load_file(fname, &buf, &bufLen); + if (ret != 0) + return ret; + + *derBuf = (byte*)malloc(bufLen); + if (*derBuf == NULL) { + free(buf); + return MEMORY_E; + } + + ret = wc_KeyPemToDer(buf, (word32)bufLen, *derBuf, (word32)bufLen, NULL); + if (ret < 0) { + free(buf); + free(*derBuf); + return ret; + } + *derLen = ret; + free(buf); + + return 0; + } + #endif /* TEST_PK_PRIVKEY */ + + #endif /* !NO_FILESYSTEM || (NO_FILESYSTEM && FORCE_BUFFER_TEST) */ +#endif /* !NO_CERTS */ + +enum { + VERIFY_OVERRIDE_ERROR, + VERIFY_FORCE_FAIL, + VERIFY_USE_PREVERIFY, + VERIFY_OVERRIDE_DATE_ERR, +}; +static THREAD_LS_T int myVerifyAction = VERIFY_OVERRIDE_ERROR; + +/* The verify callback is called for every certificate only when + * --enable-opensslextra is defined because it sets WOLFSSL_ALWAYS_VERIFY_CB and + * WOLFSSL_VERIFY_CB_ALL_CERTS. + * Normal cases of the verify callback only occur on certificate failures when the + * wolfSSL_set_verify(ssl, SSL_VERIFY_PEER, myVerify); is called +*/ + +static WC_INLINE int myVerify(int preverify, WOLFSSL_X509_STORE_CTX* store) +{ + char err_buffer[WOLFSSL_MAX_ERROR_SZ]; + int err; +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + WOLFSSL_X509* peer; +#endif +#if defined(OPENSSL_EXTRA) && defined(SHOW_CERTS) && !defined(NO_FILESYSTEM) + WOLFSSL_BIO* bio = NULL; + WOLFSSL_STACK* sk = NULL; + X509* x509 = NULL; +#endif + + /* Verify Callback Arguments: + * preverify: 1=Verify Okay, 0=Failure + * store->error: Failure error code (0 indicates no failure) + * store->current_cert: Current WOLFSSL_X509 object (only with OPENSSL_EXTRA) + * store->error_depth: Current Index + * store->domain: Subject CN as string (null term) + * store->totalCerts: Number of certs presented by peer + * store->certs[i]: A `WOLFSSL_BUFFER_INFO` with plain DER for each cert + * store->store: WOLFSSL_X509_STORE with CA cert chain + * store->store->cm: WOLFSSL_CERT_MANAGER + * store->ex_data: The WOLFSSL object pointer + * store->discardSessionCerts: When set to non-zero value session certs + will be discarded (only with SESSION_CERTS) + */ + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) || \ + defined(WOLFSSL_EXTRA) + err = wolfSSL_X509_STORE_CTX_get_error(store); +#else + err = store->error; +#endif + + fprintf(stderr, "In verification callback, error = %d, %s\n", err, + wolfSSL_ERR_error_string((unsigned long) err, err_buffer)); +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + peer = wolfSSL_X509_STORE_CTX_get_current_cert(store); + if (peer) { + char* issuer = wolfSSL_X509_NAME_oneline( + wolfSSL_X509_get_issuer_name(peer), 0, 0); + char* subject = wolfSSL_X509_NAME_oneline( + wolfSSL_X509_get_subject_name(peer), 0, 0); + printf("\tPeer's cert info:\n issuer : %s\n subject: %s\n", + issuer ? issuer : "[none]", + subject ? subject : "[none]"); +#if defined(OPENSSL_ALL) || defined(WOLFSSL_QT) + if (issuer != NULL && subject != NULL) { + /* preverify needs to be self-signer error for Qt compat. + * Should be ASN_SELF_SIGNED_E */ + if (XSTRCMP(issuer, subject) == 0 && preverify == ASN_NO_SIGNER_E) + return 0; + } +#endif + + XFREE(subject, 0, DYNAMIC_TYPE_OPENSSL); + XFREE(issuer, 0, DYNAMIC_TYPE_OPENSSL); +#if defined(OPENSSL_EXTRA) && defined(SHOW_CERTS) && !defined(NO_FILESYSTEM) + /* avoid printing duplicate certs */ + if (store->depth == 1) { + int i; + /* retrieve x509 certs and display them on stdout */ + sk = wolfSSL_X509_STORE_GetCerts(store); + + for (i = 0; i < wolfSSL_sk_X509_num(sk); i++) { + x509 = wolfSSL_sk_X509_value(sk, i); + bio = wolfSSL_BIO_new(wolfSSL_BIO_s_file()); + if (bio != NULL) { + wolfSSL_BIO_set_fp(bio, stdout, BIO_NOCLOSE); + wolfSSL_X509_print(bio, x509); + wolfSSL_BIO_free(bio); + } + } + wolfSSL_sk_X509_pop_free(sk, NULL); + } +#endif + } + else + fprintf(stderr, "\tPeer has no cert!\n"); +#else + printf("\tPeer certs: %d\n", store->totalCerts); + #ifdef SHOW_CERTS + { int i; + for (i=0; i<store->totalCerts; i++) { + WOLFSSL_BUFFER_INFO* cert = &store->certs[i]; + printf("\t\tCert %d: Ptr %p, Len %u\n", i, cert->buffer, cert->length); + } + } + #endif /* SHOW_CERTS */ +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + + printf("\tSubject's domain name at %d is %s\n", store->error_depth, store->domain); + + /* Testing forced fail case by return zero */ + if (myVerifyAction == VERIFY_FORCE_FAIL) { + return 0; /* test failure case */ + } + + if (myVerifyAction == VERIFY_OVERRIDE_DATE_ERR && + (store->error == ASN_BEFORE_DATE_E || store->error == ASN_AFTER_DATE_E)) { + printf("Overriding cert date error as example for bad clock testing\n"); + return 1; + } + + /* If error indicate we are overriding it for testing purposes */ + if (store->error != 0 && myVerifyAction == VERIFY_OVERRIDE_ERROR) { + printf("\tAllowing failed certificate check, testing only " + "(shouldn't do this in production)\n"); + } + + /* A non-zero return code indicates failure override */ + return (myVerifyAction == VERIFY_OVERRIDE_ERROR) ? 1 : preverify; +} + + +#ifdef HAVE_EXT_CACHE + +static WC_INLINE WOLFSSL_SESSION* mySessGetCb(WOLFSSL* ssl, + const unsigned char* id, int id_len, int* copy) +{ + (void)ssl; + (void)id; + (void)id_len; + (void)copy; + + /* using internal cache, this is for testing only */ + return NULL; +} + +static WC_INLINE int mySessNewCb(WOLFSSL* ssl, WOLFSSL_SESSION* session) +{ + (void)ssl; + (void)session; + + /* using internal cache, this is for testing only */ + return 0; +} + +static WC_INLINE void mySessRemCb(WOLFSSL_CTX* ctx, WOLFSSL_SESSION* session) +{ + (void)ctx; + (void)session; + + /* using internal cache, this is for testing only */ +} + +#endif /* HAVE_EXT_CACHE */ + + +#ifdef HAVE_CRL + +static WC_INLINE void CRL_CallBack(const char* url) +{ + printf("CRL callback url = %s\n", url); +} + +#endif + +#ifndef NO_DH +#if defined(WOLFSSL_SP_MATH) && !defined(WOLFSSL_SP_MATH_ALL) + /* dh2048 p */ + static const unsigned char test_dh_p[] = + { + 0xD3, 0xB2, 0x99, 0x84, 0x5C, 0x0A, 0x4C, 0xE7, 0x37, 0xCC, 0xFC, 0x18, + 0x37, 0x01, 0x2F, 0x5D, 0xC1, 0x4C, 0xF4, 0x5C, 0xC9, 0x82, 0x8D, 0xB7, + 0xF3, 0xD4, 0xA9, 0x8A, 0x9D, 0x34, 0xD7, 0x76, 0x57, 0xE5, 0xE5, 0xC3, + 0xE5, 0x16, 0x85, 0xCA, 0x4D, 0xD6, 0x5B, 0xC1, 0xF8, 0xCF, 0x89, 0x26, + 0xD0, 0x38, 0x8A, 0xEE, 0xF3, 0xCD, 0x33, 0xE5, 0x56, 0xBB, 0x90, 0x83, + 0x9F, 0x97, 0x8E, 0x71, 0xFB, 0x27, 0xE4, 0x35, 0x15, 0x45, 0x86, 0x09, + 0x71, 0xA8, 0x9A, 0xB9, 0x3E, 0x0F, 0x51, 0x8A, 0xC2, 0x75, 0x51, 0x23, + 0x12, 0xFB, 0x94, 0x31, 0x44, 0xBF, 0xCE, 0xF6, 0xED, 0xA6, 0x3A, 0xB7, + 0x92, 0xCE, 0x16, 0xA9, 0x14, 0xB3, 0x88, 0xB7, 0x13, 0x81, 0x71, 0x83, + 0x88, 0xCD, 0xB1, 0xA2, 0x37, 0xE1, 0x59, 0x5C, 0xD0, 0xDC, 0xCA, 0x82, + 0x87, 0xFA, 0x43, 0x44, 0xDD, 0x78, 0x3F, 0xCA, 0x27, 0x7E, 0xE1, 0x6B, + 0x93, 0x19, 0x7C, 0xD9, 0xA6, 0x96, 0x47, 0x0D, 0x12, 0xC1, 0x13, 0xD7, + 0xB9, 0x0A, 0x40, 0xD9, 0x1F, 0xFF, 0xB8, 0xB4, 0x00, 0xC8, 0xAA, 0x5E, + 0xD2, 0x66, 0x4A, 0x05, 0x8E, 0x9E, 0xF5, 0x34, 0xE7, 0xD7, 0x09, 0x7B, + 0x15, 0x49, 0x1D, 0x76, 0x31, 0xD6, 0x71, 0xEC, 0x13, 0x4E, 0x89, 0x8C, + 0x09, 0x22, 0xD8, 0xE7, 0xA3, 0xE9, 0x7D, 0x21, 0x51, 0x26, 0x6E, 0x9F, + 0x30, 0x8A, 0xBB, 0xBC, 0x74, 0xC1, 0xC3, 0x27, 0x6A, 0xCE, 0xA3, 0x12, + 0x60, 0x68, 0x01, 0xD2, 0x34, 0x07, 0x80, 0xCC, 0x2D, 0x7F, 0x5C, 0xAE, + 0xA2, 0x97, 0x40, 0xC8, 0x3C, 0xAC, 0xDB, 0x6F, 0xFE, 0x6C, 0x6D, 0xD2, + 0x06, 0x1C, 0x43, 0xA2, 0xB2, 0x2B, 0x82, 0xB7, 0xD0, 0xAB, 0x3F, 0x2C, + 0xE7, 0x9C, 0x19, 0x16, 0xD1, 0x5E, 0x26, 0x86, 0xC7, 0x92, 0xF9, 0x16, + 0x0B, 0xFA, 0x66, 0x83 + }; + + /* dh2048 g */ + static const unsigned char test_dh_g[] = + { + 0x02, + }; +#else + /* dh1024 p */ + static const unsigned char test_dh_p[] = + { + 0xE6, 0x96, 0x9D, 0x3D, 0x49, 0x5B, 0xE3, 0x2C, 0x7C, 0xF1, 0x80, 0xC3, + 0xBD, 0xD4, 0x79, 0x8E, 0x91, 0xB7, 0x81, 0x82, 0x51, 0xBB, 0x05, 0x5E, + 0x2A, 0x20, 0x64, 0x90, 0x4A, 0x79, 0xA7, 0x70, 0xFA, 0x15, 0xA2, 0x59, + 0xCB, 0xD5, 0x23, 0xA6, 0xA6, 0xEF, 0x09, 0xC4, 0x30, 0x48, 0xD5, 0xA2, + 0x2F, 0x97, 0x1F, 0x3C, 0x20, 0x12, 0x9B, 0x48, 0x00, 0x0E, 0x6E, 0xDD, + 0x06, 0x1C, 0xBC, 0x05, 0x3E, 0x37, 0x1D, 0x79, 0x4E, 0x53, 0x27, 0xDF, + 0x61, 0x1E, 0xBB, 0xBE, 0x1B, 0xAC, 0x9B, 0x5C, 0x60, 0x44, 0xCF, 0x02, + 0x3D, 0x76, 0xE0, 0x5E, 0xEA, 0x9B, 0xAD, 0x99, 0x1B, 0x13, 0xA6, 0x3C, + 0x97, 0x4E, 0x9E, 0xF1, 0x83, 0x9E, 0xB5, 0xDB, 0x12, 0x51, 0x36, 0xF7, + 0x26, 0x2E, 0x56, 0xA8, 0x87, 0x15, 0x38, 0xDF, 0xD8, 0x23, 0xC6, 0x50, + 0x50, 0x85, 0xE2, 0x1F, 0x0D, 0xD5, 0xC8, 0x6B, + }; + + /* dh1024 g */ + static const unsigned char test_dh_g[] = + { + 0x02, + }; +#endif + +static WC_INLINE void SetDH(WOLFSSL* ssl) +{ + wolfSSL_SetTmpDH(ssl, test_dh_p, sizeof(test_dh_p), test_dh_g, + sizeof(test_dh_g)); +} + +static WC_INLINE void SetDHCtx(WOLFSSL_CTX* ctx) +{ + wolfSSL_CTX_SetTmpDH(ctx, test_dh_p, sizeof(test_dh_p), test_dh_g, + sizeof(test_dh_g)); +} +#endif /* NO_DH */ + +#ifndef NO_CERTS + +static WC_INLINE void CaCb(unsigned char* der, int sz, int type) +{ + (void)der; + printf("Got CA cache add callback, derSz = %d, type = %d\n", sz, type); +} + +#endif /* !NO_CERTS */ + + +/* Wolf Root Directory Helper */ +/* KEIL-RL File System does not support relative directory */ +#if !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_KEIL_FS) && !defined(WOLFSSL_TIRTOS) + /* Maximum depth to search for WolfSSL root */ + #define MAX_WOLF_ROOT_DEPTH 5 + + static WC_INLINE int ChangeToWolfRoot(void) + { + #if !defined(NO_FILESYSTEM) || defined(FORCE_BUFFER_TEST) && \ + !defined(NETOS) + int depth; + for(depth = 0; depth <= MAX_WOLF_ROOT_DEPTH; depth++) { + int res; + XFILE keyFile = XFOPEN(dhParamFile, "rb"); + if (keyFile != NULL) { + fclose(keyFile); + return depth; + } + #ifdef USE_WINDOWS_API + res = SetCurrentDirectoryA("..\\"); + #elif defined(NETOS) + return 0; + #else + res = chdir("../"); + #endif + if (res < 0) { + printf("chdir to ../ failed!\n"); + break; + } + } + + err_sys("wolf root not found"); + return -1; + #else + return 0; + #endif + } +#endif /* !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_KEIL_FS) && !defined(WOLFSSL_TIRTOS) */ + + +#if defined(ATOMIC_USER) && !defined(WOLFSSL_AEAD_ONLY) + +/* Atomic Encrypt Context example */ +typedef struct AtomicEncCtx { + int keySetup; /* have we done key setup yet */ + Aes aes; /* for aes example */ +} AtomicEncCtx; + + +/* Atomic Decrypt Context example */ +typedef struct AtomicDecCtx { + int keySetup; /* have we done key setup yet */ + Aes aes; /* for aes example */ +} AtomicDecCtx; + +#if !defined(NO_HMAC) && !defined(NO_AES) && defined(HAVE_AES_CBC) +static WC_INLINE int myMacEncryptCb(WOLFSSL* ssl, unsigned char* macOut, + const unsigned char* macIn, unsigned int macInSz, int macContent, + int macVerify, unsigned char* encOut, const unsigned char* encIn, + unsigned int encSz, void* ctx) +{ + int ret; + Hmac hmac; + byte myInner[WOLFSSL_TLS_HMAC_INNER_SZ]; + AtomicEncCtx* encCtx = (AtomicEncCtx*)ctx; + const char* tlsStr = "TLS"; + + /* example supports (d)tls aes */ + if (wolfSSL_GetBulkCipher(ssl) != wolfssl_aes) { + printf("myMacEncryptCb not using AES\n"); + return -1; + } + + if (strstr(wolfSSL_get_version(ssl), tlsStr) == NULL) { + printf("myMacEncryptCb not using (D)TLS\n"); + return -1; + } + + /* hmac, not needed if aead mode */ + wolfSSL_SetTlsHmacInner(ssl, myInner, macInSz, macContent, macVerify); + + ret = wc_HmacInit(&hmac, NULL, INVALID_DEVID); + if (ret != 0) + return ret; + ret = wc_HmacSetKey(&hmac, wolfSSL_GetHmacType(ssl), + wolfSSL_GetMacSecret(ssl, macVerify), (word32) wolfSSL_GetHmacSize(ssl)); + if (ret != 0) + return ret; + ret = wc_HmacUpdate(&hmac, myInner, sizeof(myInner)); + if (ret != 0) + return ret; + ret = wc_HmacUpdate(&hmac, macIn, macInSz); + if (ret != 0) + return ret; + ret = wc_HmacFinal(&hmac, macOut); + if (ret != 0) + return ret; + + + /* encrypt setup on first time */ + if (encCtx->keySetup == 0) { + int keyLen = wolfSSL_GetKeySize(ssl); + const byte* key; + const byte* iv; + + if (wolfSSL_GetSide(ssl) == WOLFSSL_CLIENT_END) { + key = wolfSSL_GetClientWriteKey(ssl); + iv = wolfSSL_GetClientWriteIV(ssl); + } + else { + key = wolfSSL_GetServerWriteKey(ssl); + iv = wolfSSL_GetServerWriteIV(ssl); + } + + ret = wc_AesInit(&encCtx->aes, NULL, INVALID_DEVID); + if (ret != 0) { + fprintf(stderr, "AesInit failed in myMacEncryptCb\n"); + return ret; + } + ret = wc_AesSetKey(&encCtx->aes, key, (word32) keyLen, iv, AES_ENCRYPTION); + if (ret != 0) { + fprintf(stderr, "AesSetKey failed in myMacEncryptCb\n"); + return ret; + } + encCtx->keySetup = 1; + } + + /* encrypt */ + return wc_AesCbcEncrypt(&encCtx->aes, encOut, encIn, encSz); +} + +static WC_INLINE int myDecryptVerifyCb(WOLFSSL* ssl, + unsigned char* decOut, const unsigned char* decIn, + unsigned int decSz, int macContent, int macVerify, + unsigned int* padSz, void* ctx) +{ + AtomicDecCtx* decCtx = (AtomicDecCtx*)ctx; + int ret = 0; + unsigned int macInSz = 0; + int ivExtra = 0; + int digestSz = wolfSSL_GetHmacSize(ssl); + unsigned int pad = 0; + unsigned int padByte = 0; + Hmac hmac; + byte myInner[WOLFSSL_TLS_HMAC_INNER_SZ]; + byte verify[WC_MAX_DIGEST_SIZE]; + const char* tlsStr = "TLS"; + + /* example supports (d)tls aes */ + if (wolfSSL_GetBulkCipher(ssl) != wolfssl_aes) { + printf("myMacEncryptCb not using AES\n"); + return -1; + } + + if (strstr(wolfSSL_get_version(ssl), tlsStr) == NULL) { + printf("myMacEncryptCb not using (D)TLS\n"); + return -1; + } + + /*decrypt */ + if (decCtx->keySetup == 0) { + int keyLen = wolfSSL_GetKeySize(ssl); + const byte* key; + const byte* iv; + + /* decrypt is from other side (peer) */ + if (wolfSSL_GetSide(ssl) == WOLFSSL_SERVER_END) { + key = wolfSSL_GetClientWriteKey(ssl); + iv = wolfSSL_GetClientWriteIV(ssl); + } + else { + key = wolfSSL_GetServerWriteKey(ssl); + iv = wolfSSL_GetServerWriteIV(ssl); + } + + ret = wc_AesInit(&decCtx->aes, NULL, INVALID_DEVID); + if (ret != 0) { + fprintf(stderr, "AesInit failed in myDecryptVerifyCb\n"); + return ret; + } + ret = wc_AesSetKey(&decCtx->aes, key, (word32) keyLen, iv, AES_DECRYPTION); + if (ret != 0) { + fprintf(stderr, "AesSetKey failed in myDecryptVerifyCb\n"); + return ret; + } + decCtx->keySetup = 1; + } + + /* decrypt */ + ret = wc_AesCbcDecrypt(&decCtx->aes, decOut, decIn, decSz); + if (ret != 0) + return ret; + + if (wolfSSL_GetCipherType(ssl) == WOLFSSL_AEAD_TYPE) { + *padSz = (unsigned int)wolfSSL_GetAeadMacSize(ssl); + return 0; /* hmac, not needed if aead mode */ + } + + if (wolfSSL_GetCipherType(ssl) == WOLFSSL_BLOCK_TYPE) { + pad = *(decOut + decSz - 1); + padByte = 1; + if (wolfSSL_IsTLSv1_1(ssl)) + ivExtra = wolfSSL_GetCipherBlockSize(ssl); + } + + *padSz = (unsigned int)wolfSSL_GetHmacSize(ssl) + pad + padByte; + macInSz = decSz - (unsigned int)ivExtra - (unsigned int)digestSz - pad - padByte; + + wolfSSL_SetTlsHmacInner(ssl, myInner, macInSz, macContent, macVerify); + + ret = wc_HmacInit(&hmac, NULL, INVALID_DEVID); + if (ret != 0) + return ret; + ret = wc_HmacSetKey(&hmac, wolfSSL_GetHmacType(ssl), + wolfSSL_GetMacSecret(ssl, macVerify), (unsigned int) digestSz); + if (ret != 0) + return ret; + ret = wc_HmacUpdate(&hmac, myInner, sizeof(myInner)); + if (ret != 0) + return ret; + ret = wc_HmacUpdate(&hmac, decOut + ivExtra, macInSz); + if (ret != 0) + return ret; + ret = wc_HmacFinal(&hmac, verify); + if (ret != 0) + return ret; + + if (XMEMCMP(verify, decOut + decSz - digestSz - pad - padByte, + (size_t) digestSz) != 0) { + printf("myDecryptVerify verify failed\n"); + return -1; + } + + return ret; +} + +#ifdef HAVE_ENCRYPT_THEN_MAC + +static WC_INLINE int myEncryptMacCb(WOLFSSL* ssl, unsigned char* macOut, + int content, int macVerify, unsigned char* encOut, + const unsigned char* encIn, unsigned int encSz, void* ctx) +{ + int ret; + Hmac hmac; + AtomicEncCtx* encCtx = (AtomicEncCtx*)ctx; + byte myInner[WOLFSSL_TLS_HMAC_INNER_SZ]; + const char* tlsStr = "TLS"; + + /* example supports (d)tls aes */ + if (wolfSSL_GetBulkCipher(ssl) != wolfssl_aes) { + printf("myMacEncryptCb not using AES\n"); + return -1; + } + + if (strstr(wolfSSL_get_version(ssl), tlsStr) == NULL) { + printf("myMacEncryptCb not using (D)TLS\n"); + return -1; + } + + /* encrypt setup on first time */ + if (encCtx->keySetup == 0) { + int keyLen = wolfSSL_GetKeySize(ssl); + const byte* key; + const byte* iv; + + if (wolfSSL_GetSide(ssl) == WOLFSSL_CLIENT_END) { + key = wolfSSL_GetClientWriteKey(ssl); + iv = wolfSSL_GetClientWriteIV(ssl); + } + else { + key = wolfSSL_GetServerWriteKey(ssl); + iv = wolfSSL_GetServerWriteIV(ssl); + } + + ret = wc_AesInit(&encCtx->aes, NULL, INVALID_DEVID); + if (ret != 0) { + fprintf(stderr, "AesInit failed in myMacEncryptCb\n"); + return ret; + } + ret = wc_AesSetKey(&encCtx->aes, key, (word32) keyLen, iv, AES_ENCRYPTION); + if (ret != 0) { + fprintf(stderr, "AesSetKey failed in myMacEncryptCb\n"); + return ret; + } + encCtx->keySetup = 1; + } + + /* encrypt */ + ret = wc_AesCbcEncrypt(&encCtx->aes, encOut, encIn, encSz); + if (ret != 0) + return ret; + + /* Reconstruct record header. */ + wolfSSL_SetTlsHmacInner(ssl, myInner, encSz, content, macVerify); + + ret = wc_HmacInit(&hmac, NULL, INVALID_DEVID); + if (ret != 0) + return ret; + ret = wc_HmacSetKey(&hmac, wolfSSL_GetHmacType(ssl), + wolfSSL_GetMacSecret(ssl, macVerify), (word32) wolfSSL_GetHmacSize(ssl)); + if (ret != 0) + return ret; + ret = wc_HmacUpdate(&hmac, myInner, sizeof(myInner)); + if (ret != 0) + return ret; + ret = wc_HmacUpdate(&hmac, encOut, encSz); + if (ret != 0) + return ret; + return wc_HmacFinal(&hmac, macOut); +} + + +static WC_INLINE int myVerifyDecryptCb(WOLFSSL* ssl, + unsigned char* decOut, const unsigned char* decIn, + unsigned int decSz, int content, int macVerify, + unsigned int* padSz, void* ctx) +{ + AtomicDecCtx* decCtx = (AtomicDecCtx*)ctx; + int ret = 0; + int digestSz = wolfSSL_GetHmacSize(ssl); + Hmac hmac; + byte myInner[WOLFSSL_TLS_HMAC_INNER_SZ]; + byte verify[WC_MAX_DIGEST_SIZE]; + const char* tlsStr = "TLS"; + + /* example supports (d)tls aes */ + if (wolfSSL_GetBulkCipher(ssl) != wolfssl_aes) { + printf("myMacEncryptCb not using AES\n"); + return -1; + } + + if (strstr(wolfSSL_get_version(ssl), tlsStr) == NULL) { + printf("myMacEncryptCb not using (D)TLS\n"); + return -1; + } + + /* Reconstruct record header. */ + wolfSSL_SetTlsHmacInner(ssl, myInner, decSz, content, macVerify); + + ret = wc_HmacInit(&hmac, NULL, INVALID_DEVID); + if (ret != 0) + return ret; + ret = wc_HmacSetKey(&hmac, wolfSSL_GetHmacType(ssl), + wolfSSL_GetMacSecret(ssl, macVerify), (word32) digestSz); + if (ret != 0) + return ret; + ret = wc_HmacUpdate(&hmac, myInner, sizeof(myInner)); + if (ret != 0) + return ret; + ret = wc_HmacUpdate(&hmac, decIn, decSz); + if (ret != 0) + return ret; + ret = wc_HmacFinal(&hmac, verify); + if (ret != 0) + return ret; + + if (XMEMCMP(verify, decOut + decSz, (size_t) digestSz) != 0) { + printf("myDecryptVerify verify failed\n"); + return -1; + } + + /* decrypt */ + if (decCtx->keySetup == 0) { + int keyLen = wolfSSL_GetKeySize(ssl); + const byte* key; + const byte* iv; + + /* decrypt is from other side (peer) */ + if (wolfSSL_GetSide(ssl) == WOLFSSL_SERVER_END) { + key = wolfSSL_GetClientWriteKey(ssl); + iv = wolfSSL_GetClientWriteIV(ssl); + } + else { + key = wolfSSL_GetServerWriteKey(ssl); + iv = wolfSSL_GetServerWriteIV(ssl); + } + + ret = wc_AesInit(&decCtx->aes, NULL, INVALID_DEVID); + if (ret != 0) { + fprintf(stderr, "AesInit failed in myDecryptVerifyCb\n"); + return ret; + } + ret = wc_AesSetKey(&decCtx->aes, key, (word32) keyLen, iv, AES_DECRYPTION); + if (ret != 0) { + fprintf(stderr, "AesSetKey failed in myDecryptVerifyCb\n"); + return ret; + } + decCtx->keySetup = 1; + } + + /* decrypt */ + ret = wc_AesCbcDecrypt(&decCtx->aes, decOut, decIn, decSz); + if (ret != 0) + return ret; + + *padSz = *(decOut + decSz - 1) + 1; + + return 0; +} + +#endif /* HAVE_ENCRYPT_THEN_MAC */ +#endif /* !NO_HMAC && !NO_AES && HAVE_AES_CBC */ + + +static WC_INLINE void SetupAtomicUser(WOLFSSL_CTX* ctx, WOLFSSL* ssl) +{ +#if !defined(NO_HMAC) && !defined(NO_AES) && defined(HAVE_AES_CBC) + AtomicEncCtx* encCtx; + AtomicDecCtx* decCtx; + + encCtx = (AtomicEncCtx*)malloc(sizeof(AtomicEncCtx)); + if (encCtx == NULL) + err_sys_with_errno("AtomicEncCtx malloc failed"); + XMEMSET(encCtx, 0, sizeof(AtomicEncCtx)); + + decCtx = (AtomicDecCtx*)malloc(sizeof(AtomicDecCtx)); + if (decCtx == NULL) { + free(encCtx); + err_sys_with_errno("AtomicDecCtx malloc failed"); + } + XMEMSET(decCtx, 0, sizeof(AtomicDecCtx)); + + wolfSSL_CTX_SetMacEncryptCb(ctx, myMacEncryptCb); + wolfSSL_SetMacEncryptCtx(ssl, encCtx); + + wolfSSL_CTX_SetDecryptVerifyCb(ctx, myDecryptVerifyCb); + wolfSSL_SetDecryptVerifyCtx(ssl, decCtx); + + #ifdef HAVE_ENCRYPT_THEN_MAC + wolfSSL_CTX_SetEncryptMacCb(ctx, myEncryptMacCb); + wolfSSL_SetEncryptMacCtx(ssl, encCtx); + + wolfSSL_CTX_SetVerifyDecryptCb(ctx, myVerifyDecryptCb); + wolfSSL_SetVerifyDecryptCtx(ssl, decCtx); + #endif +#else + (void)ctx; + (void)ssl; +#endif +} + + +static WC_INLINE void FreeAtomicUser(WOLFSSL* ssl) +{ + AtomicEncCtx* encCtx = (AtomicEncCtx*)wolfSSL_GetMacEncryptCtx(ssl); + AtomicDecCtx* decCtx = (AtomicDecCtx*)wolfSSL_GetDecryptVerifyCtx(ssl); + + /* Encrypt-Then-MAC callbacks use same contexts. */ + + if (encCtx != NULL) { + if (encCtx->keySetup == 1) + wc_AesFree(&encCtx->aes); + free(encCtx); + } + if (decCtx != NULL) { + if (decCtx->keySetup == 1) + wc_AesFree(&decCtx->aes); + free(decCtx); + } +} + +#endif /* ATOMIC_USER */ + +#if defined(WOLFSSL_STATIC_MEMORY) && !defined(WOLFSSL_STATIC_MEMORY_LEAN) +static WC_INLINE int wolfSSL_PrintStats(WOLFSSL_MEM_STATS* stats) +{ + word16 i; + + if (stats == NULL) { + return 0; + } + + /* print to stderr so is on the same pipe as WOLFSSL_DEBUG */ + fprintf(stderr, "Total mallocs = %d\n", stats->totalAlloc); + fprintf(stderr, "Total frees = %d\n", stats->totalFr); + fprintf(stderr, "Current mallocs = %d\n", stats->curAlloc); + fprintf(stderr, "Available IO = %d\n", stats->avaIO); + fprintf(stderr, "Max con. handshakes = %d\n", stats->maxHa); + fprintf(stderr, "Max con. IO = %d\n", stats->maxIO); + fprintf(stderr, "State of memory blocks: size : available \n"); + for (i = 0; i < WOLFMEM_MAX_BUCKETS; i++) { + fprintf(stderr, " : %d\t : %d\n", stats->blockSz[i], + stats->avaBlock[i]); + } + + return 1; +} + +static WC_INLINE int wolfSSL_PrintStatsConn(WOLFSSL_MEM_CONN_STATS* stats) +{ + if (stats == NULL) { + return 0; + } + + fprintf(stderr, "peak connection memory = %d\n", stats->peakMem); + fprintf(stderr, "current memory in use = %d\n", stats->curMem); + fprintf(stderr, "peak connection allocs = %d\n", stats->peakAlloc); + fprintf(stderr, "current connection allocs = %d\n",stats->curAlloc); + fprintf(stderr, "total connection allocs = %d\n", stats->totalAlloc); + fprintf(stderr, "total connection frees = %d\n\n", stats->totalFr); + + return 1; +} +#endif /* WOLFSSL_STATIC_MEMORY */ + +#ifdef HAVE_PK_CALLBACKS + +typedef struct PkCbInfo { + const char* ourKey; +#ifdef TEST_PK_PRIVKEY + union { + #ifdef HAVE_ECC + /* only ECC PK callback with TLS v1.2 needs this */ + ecc_key ecc; + #endif + } keyGen; + int hasKeyGen; +#endif +} PkCbInfo; + +#ifdef HAVE_ECC + +static WC_INLINE int myEccKeyGen(WOLFSSL* ssl, ecc_key* key, word32 keySz, + int ecc_curve, void* ctx) +{ + int ret; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + ecc_key* new_key; + +#ifdef TEST_PK_PRIVKEY + new_key = cbInfo ? &cbInfo->keyGen.ecc : key; +#else + new_key = key; +#endif + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("PK ECC KeyGen: keySz %u, Curve ID %d\n", keySz, ecc_curve); + + ret = wc_ecc_init(new_key); + if (ret == 0) { + WC_RNG *rng = wolfSSL_GetRNG(ssl); + + /* create new key */ + ret = wc_ecc_make_key_ex(rng, (int) keySz, new_key, ecc_curve); + + #ifdef TEST_PK_PRIVKEY + if (ret == 0 && new_key != key) { + byte qx[MAX_ECC_BYTES], qy[MAX_ECC_BYTES]; + word32 qxLen = sizeof(qx), qyLen = sizeof(qy); + + /* extract public portion from new key into `key` arg */ + ret = wc_ecc_export_public_raw(new_key, qx, &qxLen, qy, &qyLen); + if (ret == 0) { + /* load public portion only into key */ + ret = wc_ecc_import_unsigned(key, qx, qy, NULL, ecc_curve); + } + (void)qxLen; + (void)qyLen; + } + if (ret == 0 && cbInfo != NULL) { + cbInfo->hasKeyGen = 1; + } + #endif + } + + WOLFSSL_PKMSG("PK ECC KeyGen: ret %d\n", ret); + + return ret; +} + +static WC_INLINE int myEccSign(WOLFSSL* ssl, const byte* in, word32 inSz, + byte* out, word32* outSz, const byte* key, word32 keySz, void* ctx) +{ + int ret; + word32 idx = 0; + ecc_key myKey; + byte* keyBuf = (byte*)key; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("PK ECC Sign: inSz %u, keySz %u\n", inSz, keySz); + +#ifdef TEST_PK_PRIVKEY + ret = load_key_file(cbInfo->ourKey, &keyBuf, &keySz); + if (ret != 0) + return ret; +#endif + + ret = wc_ecc_init(&myKey); + if (ret == 0) { + ret = wc_EccPrivateKeyDecode(keyBuf, &idx, &myKey, keySz); + if (ret == 0) { + WC_RNG *rng = wolfSSL_GetRNG(ssl); + + WOLFSSL_PKMSG("PK ECC Sign: Curve ID %d\n", myKey.dp->id); + ret = wc_ecc_sign_hash(in, inSz, out, outSz, rng, &myKey); + } + wc_ecc_free(&myKey); + } + +#ifdef TEST_PK_PRIVKEY + free(keyBuf); +#endif + + WOLFSSL_PKMSG("PK ECC Sign: ret %d outSz %u\n", ret, *outSz); + + return ret; +} + + +static WC_INLINE int myEccVerify(WOLFSSL* ssl, const byte* sig, word32 sigSz, + const byte* hash, word32 hashSz, const byte* key, word32 keySz, + int* result, void* ctx) +{ + int ret; + word32 idx = 0; + ecc_key myKey; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("PK ECC Verify: sigSz %u, hashSz %u, keySz %u\n", sigSz, hashSz, keySz); + + ret = wc_ecc_init(&myKey); + if (ret == 0) { + ret = wc_EccPublicKeyDecode(key, &idx, &myKey, keySz); + if (ret == 0) + ret = wc_ecc_verify_hash(sig, sigSz, hash, hashSz, result, &myKey); + wc_ecc_free(&myKey); + } + + WOLFSSL_PKMSG("PK ECC Verify: ret %d, result %d\n", ret, *result); + + return ret; +} + +static WC_INLINE int myEccSharedSecret(WOLFSSL* ssl, ecc_key* otherKey, + unsigned char* pubKeyDer, unsigned int* pubKeySz, + unsigned char* out, unsigned int* outlen, + int side, void* ctx) +{ + int ret; + ecc_key* privKey = NULL; + ecc_key* pubKey = NULL; + ecc_key tmpKey; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("PK ECC PMS: Side %s, Peer Curve %d\n", + side == WOLFSSL_CLIENT_END ? "client" : "server", otherKey->dp->id); + + ret = wc_ecc_init(&tmpKey); + if (ret != 0) { + return ret; + } + + /* for client: create and export public key */ + if (side == WOLFSSL_CLIENT_END) { + #ifdef TEST_PK_PRIVKEY + privKey = cbInfo ? &cbInfo->keyGen.ecc : &tmpKey; + #else + privKey = &tmpKey; + #endif + pubKey = otherKey; + + /* TLS v1.2 and older we must generate a key here for the client only. + * TLS v1.3 calls key gen early with key share */ + if (wolfSSL_GetVersion(ssl) < WOLFSSL_TLSV1_3) { + ret = myEccKeyGen(ssl, privKey, 0, otherKey->dp->id, ctx); + if (ret == 0) { + ret = wc_ecc_export_x963(privKey, pubKeyDer, pubKeySz); + } + } + } + + /* for server: import public key */ + else if (side == WOLFSSL_SERVER_END) { + #ifdef TEST_PK_PRIVKEY + privKey = cbInfo ? &cbInfo->keyGen.ecc : otherKey; + #else + privKey = otherKey; + #endif + pubKey = &tmpKey; + + ret = wc_ecc_import_x963_ex(pubKeyDer, *pubKeySz, pubKey, + otherKey->dp->id); + } + else { + ret = BAD_FUNC_ARG; + } + + if (privKey == NULL || pubKey == NULL) { + ret = BAD_FUNC_ARG; + } + +#if defined(ECC_TIMING_RESISTANT) && (!defined(HAVE_FIPS) || \ + (!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION != 2))) && \ + !defined(HAVE_SELFTEST) + if (ret == 0) { + ret = wc_ecc_set_rng(privKey, wolfSSL_GetRNG(ssl)); + } +#endif + + /* generate shared secret and return it */ + if (ret == 0) { + ret = wc_ecc_shared_secret(privKey, pubKey, out, outlen); + + #ifdef WOLFSSL_ASYNC_CRYPT + if (ret == WC_PENDING_E) { + ret = wc_AsyncWait(ret, &privKey->asyncDev, WC_ASYNC_FLAG_CALL_AGAIN); + } + #endif + } + +#ifdef TEST_PK_PRIVKEY + if (cbInfo && cbInfo->hasKeyGen) { + wc_ecc_free(&cbInfo->keyGen.ecc); + cbInfo->hasKeyGen = 0; + } +#endif + + wc_ecc_free(&tmpKey); + + WOLFSSL_PKMSG("PK ECC PMS: ret %d, PubKeySz %u, OutLen %u\n", ret, *pubKeySz, *outlen); + + return ret; +} + +#endif /* HAVE_ECC */ + +#if defined(HAVE_HKDF) && !defined(NO_HMAC) +static WC_INLINE int myHkdfExtract(byte* prk, const byte* salt, word32 saltLen, + byte* ikm, word32 ikmLen, int digest, void* ctx) +{ + int ret; + word32 len = 0; + + switch (digest) { +#ifndef NO_SHA256 + case WC_SHA256: + len = WC_SHA256_DIGEST_SIZE; + break; +#endif + +#ifdef WOLFSSL_SHA384 + case WC_SHA384: + len = WC_SHA384_DIGEST_SIZE; + break; +#endif + +#ifdef WOLFSSL_TLS13_SHA512 + case WC_SHA512: + len = WC_SHA512_DIGEST_SIZE; + break; +#endif + default: + return BAD_FUNC_ARG; + } + + /* When length is 0 then use zeroed data of digest length. */ + if (ikmLen == 0) { + ikmLen = len; + XMEMSET(ikm, 0, len); + } + + (void)ctx; + ret = wc_HKDF_Extract(digest, salt, saltLen, ikm, ikmLen, prk); + WOLFSSL_PKMSG("PK HKDF Extract: ret %d saltLen %d ikmLen %d\n", ret, saltLen, + ikmLen); + return ret; +} +#endif /* HAVE_HKDF && !NO_HMAC */ + +#if defined(HAVE_ED25519) && defined(HAVE_ED25519_KEY_IMPORT) +#ifdef HAVE_ED25519_SIGN +static WC_INLINE int myEd25519Sign(WOLFSSL* ssl, const byte* in, word32 inSz, + byte* out, word32* outSz, const byte* key, word32 keySz, void* ctx) +{ + int ret; + word32 idx = 0; + ed25519_key myKey; + byte* keyBuf = (byte*)key; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("PK 25519 Sign: inSz %d, keySz %d\n", inSz, keySz); + +#ifdef TEST_PK_PRIVKEY + ret = load_key_file(cbInfo->ourKey, &keyBuf, &keySz); + if (ret != 0) + return ret; +#endif + + ret = wc_ed25519_init(&myKey); + if (ret == 0) { + ret = wc_Ed25519PrivateKeyDecode(keyBuf, &idx, &myKey, keySz); + if (ret == 0) { + ret = wc_ed25519_make_public(&myKey, myKey.p, ED25519_PUB_KEY_SIZE); + } + if (ret == 0) { + myKey.pubKeySet = 1; + ret = wc_ed25519_sign_msg(in, inSz, out, outSz, &myKey); + } + wc_ed25519_free(&myKey); + } + +#ifdef TEST_PK_PRIVKEY + free(keyBuf); +#endif + + WOLFSSL_PKMSG("PK 25519 Sign: ret %d, outSz %d\n", ret, *outSz); + + return ret; +} +#endif /* HAVE_ED25519_SIGN */ + + +#ifdef HAVE_ED25519_VERIFY +static WC_INLINE int myEd25519Verify(WOLFSSL* ssl, const byte* sig, word32 sigSz, + const byte* msg, word32 msgSz, const byte* key, word32 keySz, + int* result, void* ctx) +{ + int ret; + ed25519_key myKey; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("PK 25519 Verify: sigSz %d, msgSz %d, keySz %d\n", sigSz, msgSz, keySz); + + ret = wc_ed25519_init(&myKey); + if (ret == 0) { + ret = wc_ed25519_import_public(key, keySz, &myKey); + if (ret == 0) { + ret = wc_ed25519_verify_msg(sig, sigSz, msg, msgSz, result, &myKey); + } + wc_ed25519_free(&myKey); + } + + WOLFSSL_PKMSG("PK 25519 Verify: ret %d, result %d\n", ret, *result); + + return ret; +} +#endif /* HAVE_ED25519_VERIFY */ +#endif /* HAVE_ED25519 && HAVE_ED25519_KEY_IMPORT */ + +#ifdef HAVE_CURVE25519 +static WC_INLINE int myX25519KeyGen(WOLFSSL* ssl, curve25519_key* key, + unsigned int keySz, void* ctx) +{ + int ret; + WC_RNG rng; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("PK 25519 KeyGen: keySz %u\n", keySz); + + ret = wc_InitRng(&rng); + if (ret != 0) + return ret; + + ret = wc_curve25519_make_key(&rng, (int) keySz, key); + + wc_FreeRng(&rng); + + WOLFSSL_PKMSG("PK 25519 KeyGen: ret %d\n", ret); + + return ret; +} + +static WC_INLINE int myX25519SharedSecret(WOLFSSL* ssl, curve25519_key* otherKey, + unsigned char* pubKeyDer, unsigned int* pubKeySz, + unsigned char* out, unsigned int* outlen, + int side, void* ctx) +{ + int ret; + curve25519_key* privKey = NULL; + curve25519_key* pubKey = NULL; + curve25519_key tmpKey; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("PK 25519 PMS: side %s\n", + side == WOLFSSL_CLIENT_END ? "client" : "server"); + + ret = wc_curve25519_init(&tmpKey); + if (ret != 0) { + return ret; + } + + /* for client: create and export public key */ + if (side == WOLFSSL_CLIENT_END) { + WC_RNG rng; + + privKey = &tmpKey; + pubKey = otherKey; + + ret = wc_InitRng(&rng); + if (ret == 0) { + ret = wc_curve25519_make_key(&rng, CURVE25519_KEYSIZE, privKey); + if (ret == 0) { + ret = wc_curve25519_export_public_ex(privKey, pubKeyDer, + pubKeySz, EC25519_LITTLE_ENDIAN); + } + wc_FreeRng(&rng); + } + } + + /* for server: import public key */ + else if (side == WOLFSSL_SERVER_END) { + privKey = otherKey; + pubKey = &tmpKey; + + ret = wc_curve25519_import_public_ex(pubKeyDer, *pubKeySz, pubKey, + EC25519_LITTLE_ENDIAN); + } + else { + ret = BAD_FUNC_ARG; + } + + /* generate shared secret and return it */ + if (ret == 0) { + ret = wc_curve25519_shared_secret_ex(privKey, pubKey, out, outlen, + EC25519_LITTLE_ENDIAN); + } + + wc_curve25519_free(&tmpKey); + + WOLFSSL_PKMSG("PK 25519 PMS: ret %d, pubKeySz %u, outLen %u\n", + ret, *pubKeySz, *outlen); + + return ret; +} +#endif /* HAVE_CURVE25519 */ + +#if defined(HAVE_ED448) && defined(HAVE_ED448_KEY_IMPORT) +#ifdef HAVE_ED448_SIGN +static WC_INLINE int myEd448Sign(WOLFSSL* ssl, const byte* in, word32 inSz, + byte* out, word32* outSz, const byte* key, word32 keySz, void* ctx) +{ + int ret; + word32 idx = 0; + ed448_key myKey; + byte* keyBuf = (byte*)key; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("PK 448 Sign: inSz %u, keySz %u\n", inSz, keySz); + +#ifdef TEST_PK_PRIVKEY + ret = load_key_file(cbInfo->ourKey, &keyBuf, &keySz); + if (ret != 0) + return ret; +#endif + + ret = wc_ed448_init(&myKey); + if (ret == 0) { + ret = wc_Ed448PrivateKeyDecode(keyBuf, &idx, &myKey, keySz); + if (ret == 0) { + ret = wc_ed448_make_public(&myKey, myKey.p, ED448_PUB_KEY_SIZE); + } + if (ret == 0) { + myKey.pubKeySet = 1; + ret = wc_ed448_sign_msg(in, inSz, out, outSz, &myKey, NULL, 0); + } + wc_ed448_free(&myKey); + } + +#ifdef TEST_PK_PRIVKEY + free(keyBuf); +#endif + + WOLFSSL_PKMSG("PK 448 Sign: ret %d, outSz %u\n", ret, *outSz); + + return ret; +} +#endif /* HAVE_ED448_SIGN */ + + +#ifdef HAVE_ED448_VERIFY +static WC_INLINE int myEd448Verify(WOLFSSL* ssl, const byte* sig, word32 sigSz, + const byte* msg, word32 msgSz, const byte* key, word32 keySz, + int* result, void* ctx) +{ + int ret; + ed448_key myKey; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("PK 448 Verify: sigSz %u, msgSz %u, keySz %u\n", sigSz, msgSz, + keySz); + + ret = wc_ed448_init(&myKey); + if (ret == 0) { + ret = wc_ed448_import_public(key, keySz, &myKey); + if (ret == 0) { + ret = wc_ed448_verify_msg(sig, sigSz, msg, msgSz, result, &myKey, + NULL, 0); + } + wc_ed448_free(&myKey); + } + + WOLFSSL_PKMSG("PK 448 Verify: ret %d, result %d\n", ret, *result); + + return ret; +} +#endif /* HAVE_ED448_VERIFY */ +#endif /* HAVE_ED448 && HAVE_ED448_KEY_IMPORT */ + +#ifdef HAVE_CURVE448 +static WC_INLINE int myX448KeyGen(WOLFSSL* ssl, curve448_key* key, + unsigned int keySz, void* ctx) +{ + int ret; + WC_RNG rng; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("PK 448 KeyGen: keySz %u\n", keySz); + + ret = wc_InitRng(&rng); + if (ret != 0) + return ret; + + ret = wc_curve448_make_key(&rng, (int) keySz, key); + + wc_FreeRng(&rng); + + WOLFSSL_PKMSG("PK 448 KeyGen: ret %d\n", ret); + + return ret; +} + +static WC_INLINE int myX448SharedSecret(WOLFSSL* ssl, curve448_key* otherKey, + unsigned char* pubKeyDer, unsigned int* pubKeySz, + unsigned char* out, unsigned int* outlen, + int side, void* ctx) +{ + int ret; + curve448_key* privKey = NULL; + curve448_key* pubKey = NULL; + curve448_key tmpKey; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("PK 448 PMS: side %s\n", + side == WOLFSSL_CLIENT_END ? "client" : "server"); + + ret = wc_curve448_init(&tmpKey); + if (ret != 0) { + return ret; + } + + /* for client: create and export public key */ + if (side == WOLFSSL_CLIENT_END) { + WC_RNG rng; + + privKey = &tmpKey; + pubKey = otherKey; + + ret = wc_InitRng(&rng); + if (ret == 0) { + ret = wc_curve448_make_key(&rng, CURVE448_KEY_SIZE, privKey); + if (ret == 0) { + ret = wc_curve448_export_public_ex(privKey, pubKeyDer, + pubKeySz, EC448_LITTLE_ENDIAN); + } + wc_FreeRng(&rng); + } + } + + /* for server: import public key */ + else if (side == WOLFSSL_SERVER_END) { + privKey = otherKey; + pubKey = &tmpKey; + + ret = wc_curve448_import_public_ex(pubKeyDer, *pubKeySz, pubKey, + EC448_LITTLE_ENDIAN); + } + else { + ret = BAD_FUNC_ARG; + } + + /* generate shared secret and return it */ + if (ret == 0) { + ret = wc_curve448_shared_secret_ex(privKey, pubKey, out, outlen, + EC448_LITTLE_ENDIAN); + } + + wc_curve448_free(&tmpKey); + + WOLFSSL_PKMSG("PK 448 PMS: ret %d, pubKeySz %u, outLen %u\n", + ret, *pubKeySz, *outlen); + + return ret; +} +#endif /* HAVE_CURVE448 */ + +#ifndef NO_DH +static WC_INLINE int myDhCallback(WOLFSSL* ssl, struct DhKey* key, + const unsigned char* priv, unsigned int privSz, + const unsigned char* pubKeyDer, unsigned int pubKeySz, + unsigned char* out, unsigned int* outlen, + void* ctx) +{ + int ret; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + /* return 0 on success */ + ret = wc_DhAgree(key, out, outlen, priv, privSz, pubKeyDer, pubKeySz); + + WOLFSSL_PKMSG("PK ED Agree: ret %d, privSz %u, pubKeySz %u, outlen %u\n", + ret, privSz, pubKeySz, *outlen); + + return ret; +} + +#endif /* !NO_DH */ + +#ifndef NO_RSA + +static WC_INLINE int myRsaSign(WOLFSSL* ssl, const byte* in, word32 inSz, + byte* out, word32* outSz, const byte* key, word32 keySz, void* ctx) +{ + WC_RNG rng; + int ret; + word32 idx = 0; + RsaKey myKey; + byte* keyBuf = (byte*)key; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("PK RSA Sign: inSz %u, keySz %u\n", inSz, keySz); + +#ifdef TEST_PK_PRIVKEY + ret = load_key_file(cbInfo->ourKey, &keyBuf, &keySz); + if (ret != 0) + return ret; +#endif + + ret = wc_InitRng(&rng); + if (ret != 0) + return ret; + + ret = wc_InitRsaKey(&myKey, NULL); + if (ret == 0) { + ret = wc_RsaPrivateKeyDecode(keyBuf, &idx, &myKey, keySz); + if (ret == 0) + ret = wc_RsaSSL_Sign(in, inSz, out, *outSz, &myKey, &rng); + if (ret > 0) { /* save and convert to 0 success */ + *outSz = (word32) ret; + ret = 0; + } + wc_FreeRsaKey(&myKey); + } + wc_FreeRng(&rng); + +#ifdef TEST_PK_PRIVKEY + free(keyBuf); +#endif + + WOLFSSL_PKMSG("PK RSA Sign: ret %d, outSz %u\n", ret, *outSz); + + return ret; +} + + +static WC_INLINE int myRsaVerify(WOLFSSL* ssl, byte* sig, word32 sigSz, + byte** out, const byte* key, word32 keySz, void* ctx) +{ + int ret; + word32 idx = 0; + RsaKey myKey; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("PK RSA Verify: sigSz %u, keySz %u\n", sigSz, keySz); + + ret = wc_InitRsaKey(&myKey, NULL); + if (ret == 0) { + ret = wc_RsaPublicKeyDecode(key, &idx, &myKey, keySz); + if (ret == 0) + ret = wc_RsaSSL_VerifyInline(sig, sigSz, out, &myKey); + wc_FreeRsaKey(&myKey); + } + + WOLFSSL_PKMSG("PK RSA Verify: ret %d\n", ret); + + return ret; +} + +static WC_INLINE int myRsaSignCheck(WOLFSSL* ssl, byte* sig, word32 sigSz, + byte** out, const byte* key, word32 keySz, void* ctx) +{ + int ret; + word32 idx = 0; + RsaKey myKey; + byte* keyBuf = (byte*)key; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("PK RSA SignCheck: sigSz %u, keySz %u\n", sigSz, keySz); + +#ifdef TEST_PK_PRIVKEY + ret = load_key_file(cbInfo->ourKey, &keyBuf, &keySz); + if (ret != 0) + return ret; +#endif + + ret = wc_InitRsaKey(&myKey, NULL); + if (ret == 0) { + ret = wc_RsaPrivateKeyDecode(keyBuf, &idx, &myKey, keySz); + if (ret == 0) + ret = wc_RsaSSL_VerifyInline(sig, sigSz, out, &myKey); + wc_FreeRsaKey(&myKey); + } +#ifdef TEST_PK_PRIVKEY + free(keyBuf); +#endif + + WOLFSSL_PKMSG("PK RSA SignCheck: ret %d\n", ret); + + return ret; +} + +#ifdef WC_RSA_PSS +static WC_INLINE int myRsaPssSign(WOLFSSL* ssl, const byte* in, word32 inSz, + byte* out, word32* outSz, int hash, int mgf, const byte* key, + word32 keySz, void* ctx) +{ + enum wc_HashType hashType = WC_HASH_TYPE_NONE; + WC_RNG rng; + int ret = 0; + word32 idx = 0; + RsaKey myKey; + byte* inBuf = (byte*)in; + word32 inBufSz = inSz; + byte* keyBuf = (byte*)key; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("PK RSA PSS Sign: inSz %u, hash %d, mgf %d, keySz %u\n", + inSz, hash, mgf, keySz); + +#ifdef TEST_PK_PRIVKEY + ret = load_key_file(cbInfo->ourKey, &keyBuf, &keySz); + if (ret != 0) + return ret; +#endif + + switch (hash) { +#ifndef NO_SHA256 + case SHA256h: + hashType = WC_HASH_TYPE_SHA256; + break; +#endif +#ifdef WOLFSSL_SHA384 + case SHA384h: + hashType = WC_HASH_TYPE_SHA384; + break; +#endif +#ifdef WOLFSSL_SHA512 + case SHA512h: + hashType = WC_HASH_TYPE_SHA512; + break; +#endif + } + + ret = wc_InitRng(&rng); + if (ret != 0) + return ret; + + #ifdef TLS13_RSA_PSS_SIGN_CB_NO_PREHASH + /* With this defined, RSA-PSS sign callback when used from TLS 1.3 + * does not hash data before giving to this callback. User must + * compute hash themselves. */ + if (wolfSSL_GetVersion(ssl) == WOLFSSL_TLSV1_3) { + inBufSz = wc_HashGetDigestSize(hashType); + inBuf = (byte*)XMALLOC(inBufSz, NULL, DYNAMIC_TYPE_TMP_BUFFER); + if (inBuf == NULL) { + ret = MEMORY_E; + } + if (ret == 0) { + ret = wc_Hash(hashType, in, inSz, inBuf, inBufSz); + } + } + #endif + + if (ret == 0) { + ret = wc_InitRsaKey(&myKey, NULL); + } + if (ret == 0) { + ret = wc_RsaPrivateKeyDecode(keyBuf, &idx, &myKey, keySz); + if (ret == 0) { + ret = wc_RsaPSS_Sign(inBuf, inBufSz, out, *outSz, hashType, mgf, + &myKey, &rng); + } + if (ret > 0) { /* save and convert to 0 success */ + *outSz = (word32) ret; + ret = 0; + } + #ifdef TLS13_RSA_PSS_SIGN_CB_NO_PREHASH + if ((inBuf != NULL) && (wolfSSL_GetVersion(ssl) == WOLFSSL_TLSV1_3)) { + XFREE(inBuf, NULL, DYNAMIC_TYPE_TMP_BUFFER); + } + #endif + wc_FreeRsaKey(&myKey); + } + wc_FreeRng(&rng); + +#ifdef TEST_PK_PRIVKEY + free(keyBuf); +#endif + + WOLFSSL_PKMSG("PK RSA PSS Sign: ret %d, outSz %u\n", ret, *outSz); + + return ret; +} + + +static WC_INLINE int myRsaPssVerify(WOLFSSL* ssl, byte* sig, word32 sigSz, + byte** out, int hash, int mgf, const byte* key, word32 keySz, void* ctx) +{ + int ret; + word32 idx = 0; + RsaKey myKey; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + enum wc_HashType hashType = WC_HASH_TYPE_NONE; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("PK RSA PSS Verify: sigSz %u, hash %d, mgf %d, keySz %u\n", + sigSz, hash, mgf, keySz); + + switch (hash) { +#ifndef NO_SHA256 + case SHA256h: + hashType = WC_HASH_TYPE_SHA256; + break; +#endif +#ifdef WOLFSSL_SHA384 + case SHA384h: + hashType = WC_HASH_TYPE_SHA384; + break; +#endif +#ifdef WOLFSSL_SHA512 + case SHA512h: + hashType = WC_HASH_TYPE_SHA512; + break; +#endif + } + + ret = wc_InitRsaKey(&myKey, NULL); + if (ret == 0) { + ret = wc_RsaPublicKeyDecode(key, &idx, &myKey, keySz); + if (ret == 0) { + ret = wc_RsaPSS_VerifyInline(sig, sigSz, out, hashType, mgf, + &myKey); + } + wc_FreeRsaKey(&myKey); + } + + WOLFSSL_PKMSG("PK RSA PSS Verify: ret %d\n", ret); + + return ret; +} + +static WC_INLINE int myRsaPssSignCheck(WOLFSSL* ssl, byte* sig, word32 sigSz, + byte** out, int hash, int mgf, const byte* key, word32 keySz, void* ctx) +{ + int ret; + word32 idx = 0; + RsaKey myKey; + byte* keyBuf = (byte*)key; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + enum wc_HashType hashType = WC_HASH_TYPE_NONE; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("PK RSA PSS SignCheck: sigSz %u, hash %d, mgf %d, keySz %u\n", + sigSz, hash, mgf, keySz); + +#ifdef TEST_PK_PRIVKEY + ret = load_key_file(cbInfo->ourKey, &keyBuf, &keySz); + if (ret != 0) + return ret; +#endif + + switch (hash) { +#ifndef NO_SHA256 + case SHA256h: + hashType = WC_HASH_TYPE_SHA256; + break; +#endif +#ifdef WOLFSSL_SHA384 + case SHA384h: + hashType = WC_HASH_TYPE_SHA384; + break; +#endif +#ifdef WOLFSSL_SHA512 + case SHA512h: + hashType = WC_HASH_TYPE_SHA512; + break; +#endif + } + + ret = wc_InitRsaKey(&myKey, NULL); + if (ret == 0) { + ret = wc_RsaPrivateKeyDecode(keyBuf, &idx, &myKey, keySz); + if (ret == 0) { + ret = wc_RsaPSS_VerifyInline(sig, sigSz, out, hashType, mgf, + &myKey); + } + wc_FreeRsaKey(&myKey); + } + +#ifdef TEST_PK_PRIVKEY + free(keyBuf); +#endif + + WOLFSSL_PKMSG("PK RSA PSS SignCheck: ret %d\n", ret); + + return ret; +} +#endif + + +static WC_INLINE int myRsaEnc(WOLFSSL* ssl, const byte* in, word32 inSz, + byte* out, word32* outSz, const byte* key, + word32 keySz, void* ctx) +{ + int ret; + word32 idx = 0; + RsaKey myKey; + WC_RNG rng; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("PK RSA Enc: inSz %u, keySz %u\n", inSz, keySz); + + ret = wc_InitRng(&rng); + if (ret != 0) + return ret; + + ret = wc_InitRsaKey(&myKey, NULL); + if (ret == 0) { + ret = wc_RsaPublicKeyDecode(key, &idx, &myKey, keySz); + if (ret == 0) { + ret = wc_RsaPublicEncrypt(in, inSz, out, *outSz, &myKey, &rng); + if (ret > 0) { + *outSz = (word32) ret; + ret = 0; /* reset to success */ + } + } + wc_FreeRsaKey(&myKey); + } + wc_FreeRng(&rng); + + WOLFSSL_PKMSG("PK RSA Enc: ret %d, outSz %u\n", ret, *outSz); + + return ret; +} + +static WC_INLINE int myRsaDec(WOLFSSL* ssl, byte* in, word32 inSz, + byte** out, + const byte* key, word32 keySz, void* ctx) +{ + int ret; + word32 idx = 0; + RsaKey myKey; + byte* keyBuf = (byte*)key; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("PK RSA Dec: inSz %u, keySz %u\n", inSz, keySz); + +#ifdef TEST_PK_PRIVKEY + ret = load_key_file(cbInfo->ourKey, &keyBuf, &keySz); + if (ret != 0) + return ret; +#endif + + ret = wc_InitRsaKey(&myKey, NULL); + if (ret == 0) { + ret = wc_RsaPrivateKeyDecode(keyBuf, &idx, &myKey, keySz); + if (ret == 0) { + #ifdef WC_RSA_BLINDING + ret = wc_RsaSetRNG(&myKey, wolfSSL_GetRNG(ssl)); + if (ret != 0) { + wc_FreeRsaKey(&myKey); + return ret; + } + #endif + ret = wc_RsaPrivateDecryptInline(in, inSz, out, &myKey); + } + wc_FreeRsaKey(&myKey); + } + +#ifdef TEST_PK_PRIVKEY + free(keyBuf); +#endif + + WOLFSSL_PKMSG("PK RSA Dec: ret %d\n", ret); + + return ret; +} + +#endif /* NO_RSA */ + +static WC_INLINE int myGenMaster(WOLFSSL* ssl, void* ctx) +{ + int ret; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("Gen Master"); + /* fall through to original routine */ + ret = PROTOCOLCB_UNAVAILABLE; + WOLFSSL_PKMSG("Gen Master: ret %d\n", ret); + + return ret; +} + +static WC_INLINE int myGenExtMaster(WOLFSSL* ssl, byte* hash, word32 hashSz, + void* ctx) +{ + int ret; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + (void)hash; + (void)hashSz; + + WOLFSSL_PKMSG("Gen Extended Master"); + /* fall through to original routine */ + ret = PROTOCOLCB_UNAVAILABLE; + WOLFSSL_PKMSG("Gen Extended Master: ret %d\n", ret); + + return ret; +} + +static WC_INLINE int myGenPreMaster(WOLFSSL* ssl, byte *premaster, + word32 preSz, void* ctx) +{ + int ret; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void) ssl; + (void) cbInfo; + (void) premaster; + (void) preSz; + + WOLFSSL_PKMSG("Gen Pre-Master Cb"); + /* fall through to original routine */ + ret = PROTOCOLCB_UNAVAILABLE; + WOLFSSL_PKMSG("Gen Pre-Master Cb: ret %d\n", ret); + + return ret; +} + +static WC_INLINE int myGenSessionKey(WOLFSSL* ssl, void* ctx) +{ + int ret; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("Gen Master Cb"); + /* fall through to original routine */ + ret = PROTOCOLCB_UNAVAILABLE; + WOLFSSL_PKMSG("Gen Master Cb: ret %d\n", ret); + + return ret; +} + +static WC_INLINE int mySetEncryptKeys(WOLFSSL* ssl, void* ctx) +{ + int ret; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + + WOLFSSL_PKMSG("Set Encrypt Keys Cb"); + /* fall through to original routine */ + ret = PROTOCOLCB_UNAVAILABLE; + WOLFSSL_PKMSG("Set Encrypt Keys Cb: ret %d\n", ret); + + return ret; +} + +#if !defined(WOLFSSL_NO_TLS12) && !defined(WOLFSSL_AEAD_ONLY) +static WC_INLINE int myVerifyMac(WOLFSSL *ssl, const byte* message, + word32 messageSz, word32 macSz, word32 content, void* ctx) +{ + int ret; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)message; + (void)messageSz; + (void)macSz; + (void)content; + (void)cbInfo; + + WOLFSSL_PKMSG("Verify Mac Cb"); + /* fall through to original routine */ + ret = PROTOCOLCB_UNAVAILABLE; + WOLFSSL_PKMSG("Verify Mac Cb: ret %d\n", ret); + + return ret; +} +#endif + +static WC_INLINE int myTlsFinished(WOLFSSL* ssl, + const byte *side, + const byte *handshake_hash, word32 hashSz, + byte *hashes, void* ctx) +{ + int ret; + PkCbInfo* cbInfo = (PkCbInfo*)ctx; + + (void)ssl; + (void)cbInfo; + (void)side; + (void)handshake_hash; + (void)hashSz; + (void)hashes; + + WOLFSSL_PKMSG("Tls Finished Cb"); + /* fall through to original routine */ + ret = PROTOCOLCB_UNAVAILABLE; + WOLFSSL_PKMSG("Tls Finished Cb: ret %d\n", ret); + + return ret; +} + +static WC_INLINE void SetupPkCallbacks(WOLFSSL_CTX* ctx) +{ + (void)ctx; + + #ifdef HAVE_ECC + wolfSSL_CTX_SetEccKeyGenCb(ctx, myEccKeyGen); + wolfSSL_CTX_SetEccSignCb(ctx, myEccSign); + wolfSSL_CTX_SetEccVerifyCb(ctx, myEccVerify); + wolfSSL_CTX_SetEccSharedSecretCb(ctx, myEccSharedSecret); + #endif /* HAVE_ECC */ + #if defined(HAVE_HKDF) && !defined(NO_HMAC) + wolfSSL_CTX_SetHKDFExtractCb(ctx, myHkdfExtract); + #endif /* HAVE_HKDF && !NO_HMAC */ + #ifndef NO_DH + wolfSSL_CTX_SetDhAgreeCb(ctx, myDhCallback); + #endif + #if defined(HAVE_ED25519) && defined(HAVE_ED25519_KEY_IMPORT) + #ifdef HAVE_ED25519_SIGN + wolfSSL_CTX_SetEd25519SignCb(ctx, myEd25519Sign); + #endif + #ifdef HAVE_ED25519_VERIFY + wolfSSL_CTX_SetEd25519VerifyCb(ctx, myEd25519Verify); + #endif + #endif + #ifdef HAVE_CURVE25519 + wolfSSL_CTX_SetX25519KeyGenCb(ctx, myX25519KeyGen); + wolfSSL_CTX_SetX25519SharedSecretCb(ctx, myX25519SharedSecret); + #endif + #if defined(HAVE_ED448) && defined(HAVE_ED448_KEY_IMPORT) + #if defined(HAVE_ED448_SIGN) + wolfSSL_CTX_SetEd448SignCb(ctx, myEd448Sign); + #endif + #if defined(HAVE_ED448_VERIFY) + wolfSSL_CTX_SetEd448VerifyCb(ctx, myEd448Verify); + #endif + #endif + #ifdef HAVE_CURVE448 + wolfSSL_CTX_SetX448KeyGenCb(ctx, myX448KeyGen); + wolfSSL_CTX_SetX448SharedSecretCb(ctx, myX448SharedSecret); + #endif + #ifndef NO_RSA + wolfSSL_CTX_SetRsaSignCb(ctx, myRsaSign); + wolfSSL_CTX_SetRsaVerifyCb(ctx, myRsaVerify); + wolfSSL_CTX_SetRsaSignCheckCb(ctx, myRsaSignCheck); + #ifdef WC_RSA_PSS + wolfSSL_CTX_SetRsaPssSignCb(ctx, myRsaPssSign); + wolfSSL_CTX_SetRsaPssVerifyCb(ctx, myRsaPssVerify); + wolfSSL_CTX_SetRsaPssSignCheckCb(ctx, myRsaPssSignCheck); + #endif + wolfSSL_CTX_SetRsaEncCb(ctx, myRsaEnc); + wolfSSL_CTX_SetRsaDecCb(ctx, myRsaDec); + #endif /* NO_RSA */ + + #ifndef NO_CERTS + wolfSSL_CTX_SetGenMasterSecretCb(ctx, myGenMaster); + wolfSSL_CTX_SetGenExtMasterSecretCb(ctx, myGenExtMaster); + wolfSSL_CTX_SetGenPreMasterCb(ctx, myGenPreMaster); + wolfSSL_CTX_SetGenSessionKeyCb(ctx, myGenSessionKey); + wolfSSL_CTX_SetEncryptKeysCb(ctx, mySetEncryptKeys); + + #if !defined(WOLFSSL_NO_TLS12) && !defined(WOLFSSL_AEAD_ONLY) + wolfSSL_CTX_SetVerifyMacCb(ctx, myVerifyMac); + #endif + + wolfSSL_CTX_SetTlsFinishedCb(ctx, myTlsFinished); + #endif /* NO_CERTS */ +} + +static WC_INLINE void SetupPkCallbackContexts(WOLFSSL* ssl, void* myCtx) +{ + #ifdef HAVE_ECC + wolfSSL_SetEccKeyGenCtx(ssl, myCtx); + wolfSSL_SetEccSignCtx(ssl, myCtx); + wolfSSL_SetEccVerifyCtx(ssl, myCtx); + wolfSSL_SetEccSharedSecretCtx(ssl, myCtx); + #endif /* HAVE_ECC */ + #ifdef HAVE_HKDF + wolfSSL_SetHKDFExtractCtx(ssl, myCtx); + #endif /* HAVE_HKDF */ + #ifndef NO_DH + wolfSSL_SetDhAgreeCtx(ssl, myCtx); + #endif + #ifdef HAVE_ED25519 + wolfSSL_SetEd25519SignCtx(ssl, myCtx); + wolfSSL_SetEd25519VerifyCtx(ssl, myCtx); + #endif + #ifdef HAVE_CURVE25519 + wolfSSL_SetX25519KeyGenCtx(ssl, myCtx); + wolfSSL_SetX25519SharedSecretCtx(ssl, myCtx); + #endif + #ifdef HAVE_ED448 + wolfSSL_SetEd448SignCtx(ssl, myCtx); + wolfSSL_SetEd448VerifyCtx(ssl, myCtx); + #endif + #ifdef HAVE_CURVE448 + wolfSSL_SetX448KeyGenCtx(ssl, myCtx); + wolfSSL_SetX448SharedSecretCtx(ssl, myCtx); + #endif + #ifndef NO_RSA + wolfSSL_SetRsaSignCtx(ssl, myCtx); + wolfSSL_SetRsaVerifyCtx(ssl, myCtx); + #ifdef WC_RSA_PSS + wolfSSL_SetRsaPssSignCtx(ssl, myCtx); + wolfSSL_SetRsaPssVerifyCtx(ssl, myCtx); + #endif + wolfSSL_SetRsaEncCtx(ssl, myCtx); + wolfSSL_SetRsaDecCtx(ssl, myCtx); + #endif /* NO_RSA */ + + #ifndef NO_CERTS + wolfSSL_SetGenMasterSecretCtx(ssl, myCtx); + wolfSSL_SetGenExtMasterSecretCtx(ssl, myCtx); + wolfSSL_SetGenPreMasterCtx(ssl, myCtx); + wolfSSL_SetGenSessionKeyCtx(ssl, myCtx); + wolfSSL_SetEncryptKeysCtx(ssl, myCtx); + + #if !defined(WOLFSSL_NO_TLS12) && !defined(WOLFSSL_AEAD_ONLY) + wolfSSL_SetVerifyMacCtx(ssl, myCtx); + #endif + + wolfSSL_SetTlsFinishedCtx(ssl, myCtx); + #endif +} + +#endif /* HAVE_PK_CALLBACKS */ + +#ifdef USE_WOLFSSL_IO +static WC_INLINE int SimulateWantWriteIOSendCb(WOLFSSL *ssl, char *buf, int sz, void *ctx) +{ + static int wantWriteFlag = 1; + + int sd = *(int*)ctx; + + (void)ssl; + + if (!wantWriteFlag) + { + int sent; + wantWriteFlag = 1; + + sent = wolfIO_Send(sd, buf, sz, 0); + if (sent < 0) { + int err = errno; + + if (err == SOCKET_EWOULDBLOCK || err == SOCKET_EAGAIN) { + return WOLFSSL_CBIO_ERR_WANT_WRITE; + } + else if (err == SOCKET_ECONNRESET) { + return WOLFSSL_CBIO_ERR_CONN_RST; + } + else if (err == SOCKET_EINTR) { + return WOLFSSL_CBIO_ERR_ISR; + } + else if (err == SOCKET_EPIPE) { + return WOLFSSL_CBIO_ERR_CONN_CLOSE; + } + else { + return WOLFSSL_CBIO_ERR_GENERAL; + } + } + + return sent; + } + else + { + wantWriteFlag = 0; + return WOLFSSL_CBIO_ERR_WANT_WRITE; + } +} +#endif /* USE_WOLFSSL_IO */ + +#if defined(__hpux__) || defined(__MINGW32__) || defined (WOLFSSL_TIRTOS) \ + || defined(_MSC_VER) || defined(__WATCOMC__) + +/* HP/UX doesn't have strsep, needed by test/suites.c */ +static WC_INLINE char* strsep(char **stringp, const char *delim) +{ + char* start; + char* end; + + start = *stringp; + if (start == NULL) + return NULL; + + if ((end = strpbrk(start, delim))) { + *end++ = '\0'; + *stringp = end; + } else { + *stringp = NULL; + } + + return start; +} + +#endif /* __hpux__ and others */ + +/* Create unique filename, len is length of tempfn name, assuming + len does not include null terminating character, + num is number of characters in tempfn name to randomize */ +static WC_INLINE const char* mymktemp(char *tempfn, int len, int num) +{ + int x, size; + static const char alphanum[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz"; + WC_RNG rng; + byte out = 0; + + if (tempfn == NULL || len < 1 || num < 1 || len <= num) { + fprintf(stderr, "Bad input\n"); + return NULL; + } + + size = len - 1; + + if (wc_InitRng(&rng) != 0) { + fprintf(stderr, "InitRng failed\n"); + return NULL; + } + + for (x = size; x > size - num; x--) { + if (wc_RNG_GenerateBlock(&rng,(byte*)&out, sizeof(out)) != 0) { + fprintf(stderr, "RNG_GenerateBlock failed\n"); + return NULL; + } + tempfn[x] = alphanum[out % (sizeof(alphanum) - 1)]; + } + tempfn[len] = '\0'; + + wc_FreeRng(&rng); + (void)rng; /* for WC_NO_RNG case */ + + return tempfn; +} + + + +#if defined(HAVE_SESSION_TICKET) && defined(WOLFSSL_NO_DEF_TICKET_ENC_CB) && \ + ((defined(HAVE_CHACHA) && defined(HAVE_POLY1305)) || \ + defined(HAVE_AESGCM)) + +#define HAVE_TEST_SESSION_TICKET + +#if defined(HAVE_CHACHA) && defined(HAVE_POLY1305) + #include <wolfssl/wolfcrypt/chacha20_poly1305.h> + #define WOLFSSL_TICKET_KEY_SZ CHACHA20_POLY1305_AEAD_KEYSIZE +#elif defined(HAVE_AESGCM) + #include <wolfssl/wolfcrypt/aes.h> + #include <wolfssl/wolfcrypt/wc_encrypt.h> /* AES IV sizes in FIPS mode */ + #define WOLFSSL_TICKET_KEY_SZ AES_256_KEY_SIZE +#endif + +typedef struct key_ctx { + byte name[WOLFSSL_TICKET_NAME_SZ]; /* name for this context */ + byte key[WOLFSSL_TICKET_KEY_SZ]; /* cipher key */ +} key_ctx; + +static THREAD_LS_T key_ctx myKey_ctx; +static THREAD_LS_T WC_RNG myKey_rng; + +static WC_INLINE int TicketInit(void) +{ + int ret = wc_InitRng(&myKey_rng); + if (ret == 0) { + ret = wc_RNG_GenerateBlock(&myKey_rng, myKey_ctx.key, + sizeof(myKey_ctx.key)); + } + if (ret == 0) { + ret = wc_RNG_GenerateBlock(&myKey_rng, myKey_ctx.name, + sizeof(myKey_ctx.name)); + } + return ret; +} + +static WC_INLINE void TicketCleanup(void) +{ + wc_FreeRng(&myKey_rng); +} + +typedef enum MyTicketState { + MY_TICKET_STATE_NONE, + MY_TICKET_STATE_INIT, + MY_TICKET_STATE_RNG, + MY_TICKET_STATE_CIPHER_SETUP, + MY_TICKET_STATE_CIPHER, + MY_TICKET_STATE_FINAL +} MyTicketState; +typedef struct MyTicketCtx { + MyTicketState state; + byte aad[WOLFSSL_TICKET_NAME_SZ + WOLFSSL_TICKET_IV_SZ + 2]; +#if defined(HAVE_CHACHA) && defined(HAVE_POLY1305) + /* chahca20/poly1305 */ +#elif defined(HAVE_AESGCM) + Aes aes; +#endif +} MyTicketCtx; + +static WC_INLINE int myTicketEncCb(WOLFSSL* ssl, + byte key_name[WOLFSSL_TICKET_NAME_SZ], + byte iv[WOLFSSL_TICKET_IV_SZ], + byte mac[WOLFSSL_TICKET_MAC_SZ], + int enc, byte* ticket, int inLen, int* outLen, + void* userCtx) +{ + int ret = 0; + MyTicketCtx tickCtx_lcl; + MyTicketCtx* tickCtx = (MyTicketCtx*)userCtx; + + (void)ssl; + + if (tickCtx == NULL) { + /* for test cases where userCtx is not set use local stack for context */ + XMEMSET(&tickCtx_lcl, 0, sizeof(tickCtx_lcl)); + tickCtx = &tickCtx_lcl; + } + + switch (tickCtx->state) { + case MY_TICKET_STATE_NONE: + case MY_TICKET_STATE_INIT: + { + /* encrypt */ + if (enc) { + XMEMCPY(key_name, myKey_ctx.name, WOLFSSL_TICKET_NAME_SZ); + } + else { + /* see if we know this key */ + if (XMEMCMP(key_name, myKey_ctx.name, WOLFSSL_TICKET_NAME_SZ) != 0) { + printf("client presented unknown ticket key name %s\n", key_name); + return WOLFSSL_TICKET_RET_FATAL; + } + } + tickCtx->state = MY_TICKET_STATE_RNG; + } + FALL_THROUGH; + case MY_TICKET_STATE_RNG: + { + if (enc) { + ret = wc_RNG_GenerateBlock(&myKey_rng, iv, WOLFSSL_TICKET_IV_SZ); + if (ret != 0) + break; + } + tickCtx->state = MY_TICKET_STATE_CIPHER_SETUP; + } + FALL_THROUGH; + case MY_TICKET_STATE_CIPHER_SETUP: + { + byte* tmp = tickCtx->aad; + word16 sLen = XHTONS(inLen); + + /* build aad from key name, iv, and length */ + XMEMCPY(tmp, key_name, WOLFSSL_TICKET_NAME_SZ); + tmp += WOLFSSL_TICKET_NAME_SZ; + XMEMCPY(tmp, iv, WOLFSSL_TICKET_IV_SZ); + tmp += WOLFSSL_TICKET_IV_SZ; + XMEMCPY(tmp, &sLen, sizeof(sLen)); + + #if defined(HAVE_CHACHA) && defined(HAVE_POLY1305) + #elif defined(HAVE_AESGCM) + ret = wc_AesInit(&tickCtx->aes, NULL, INVALID_DEVID); + if (ret == 0) { + ret = wc_AesGcmSetKey(&tickCtx->aes, myKey_ctx.key, + sizeof(myKey_ctx.key)); + } + if (ret != 0) + break; + #endif + tickCtx->state = MY_TICKET_STATE_CIPHER; + } + FALL_THROUGH; + case MY_TICKET_STATE_CIPHER: + { + int aadSz = (int)sizeof(tickCtx->aad); + + /* encrypt */ + if (enc) { + #if defined(HAVE_CHACHA) && defined(HAVE_POLY1305) + ret = wc_ChaCha20Poly1305_Encrypt(myKey_ctx.key, iv, + tickCtx->aad, aadSz, + ticket, inLen, + ticket, + mac); + #elif defined(HAVE_AESGCM) + ret = wc_AesGcmEncrypt(&tickCtx->aes, ticket, ticket, inLen, + iv, GCM_NONCE_MID_SZ, mac, WC_AES_BLOCK_SIZE, + tickCtx->aad, aadSz); + #endif + } + /* decrypt */ + else { + #if defined(HAVE_CHACHA) && defined(HAVE_POLY1305) + ret = wc_ChaCha20Poly1305_Decrypt(myKey_ctx.key, iv, + tickCtx->aad, aadSz, + ticket, inLen, + mac, + ticket); + #elif defined(HAVE_AESGCM) + ret = wc_AesGcmDecrypt(&tickCtx->aes, ticket, ticket, inLen, + iv, GCM_NONCE_MID_SZ, mac, WC_AES_BLOCK_SIZE, + tickCtx->aad, aadSz); + #endif + } + if (ret != 0) { + break; + } + tickCtx->state = MY_TICKET_STATE_FINAL; + } + FALL_THROUGH; + case MY_TICKET_STATE_FINAL: + *outLen = inLen; /* no padding in this mode */ + break; + } /* switch */ + +#ifdef WOLFSSL_ASYNC_CRYPT + if (ret == WC_PENDING_E) { + return ret; + } +#endif + + /* cleanup */ +#if defined(HAVE_CHACHA) && defined(HAVE_POLY1305) +#elif defined(HAVE_AESGCM) + wc_AesFree(&tickCtx->aes); +#endif + + /* reset context */ + XMEMSET(tickCtx, 0, sizeof(MyTicketCtx)); + + return (ret == 0) ? WOLFSSL_TICKET_RET_OK : WOLFSSL_TICKET_RET_REJECT; +} + +#endif /* HAVE_SESSION_TICKET && ((HAVE_CHACHA && HAVE_POLY1305) || HAVE_AESGCM) */ + + +static WC_INLINE word16 GetRandomPort(void) +{ + word16 port = 0; + + /* Generate random port for testing */ + WC_RNG rng; + if (wc_InitRng(&rng) == 0) { + if (wc_RNG_GenerateBlock(&rng, (byte*)&port, sizeof(port)) == 0) { + port |= 0xC000; /* Make sure its in the 49152 - 65535 range */ + } + wc_FreeRng(&rng); + } + (void)rng; /* for WC_NO_RNG case */ + return port; +} + +#ifdef WOLFSSL_EARLY_DATA +static WC_INLINE void EarlyDataStatus(WOLFSSL* ssl) +{ + int earlyData_status; +#ifdef OPENSSL_EXTRA + earlyData_status = SSL_get_early_data_status(ssl); +#else + earlyData_status = wolfSSL_get_early_data_status(ssl); +#endif + if (earlyData_status < 0) return; + + printf("Early Data was "); + + switch(earlyData_status) { + case WOLFSSL_EARLY_DATA_NOT_SENT: + printf("not sent.\n"); + break; + case WOLFSSL_EARLY_DATA_REJECTED: + printf("rejected.\n"); + break; + case WOLFSSL_EARLY_DATA_ACCEPTED: + printf("accepted\n"); + break; + default: + printf("unknown...\n"); + } +} +#endif /* WOLFSSL_EARLY_DATA */ + +#if defined(HAVE_SESSION_TICKET) || defined (WOLFSSL_DTLS13) +static WC_INLINE int process_handshake_messages(WOLFSSL* ssl, int blocking, + int* zero_return) +{ + char foo[1]; + int ret = 0; + int dtls; + + if (zero_return == NULL || ssl == NULL) + return -1; + + dtls = wolfSSL_dtls(ssl); + (void)dtls; + *zero_return = 0; + + if (!blocking) { + int timeout = DEFAULT_TIMEOUT_SEC; + +#ifdef WOLFSSL_DTLS + if (dtls) { + timeout = wolfSSL_dtls_get_current_timeout(ssl); + +#ifdef WOLFSSL_DTLS13 + if (timeout > 4 && wolfSSL_dtls13_use_quick_timeout(ssl)) + timeout /= 4; +#endif /* WOLFSSL_DTLS13 */ + } +#endif /* WOLFSSL_DTLS */ + + ret = tcp_select(wolfSSL_get_fd(ssl), timeout); + if (ret == TEST_ERROR_READY) { + err_sys("tcp_select error"); + return -1; + } + + if (ret == TEST_TIMEOUT) { +#ifdef WOLFSSL_DTLS + if (dtls) { + ret = wolfSSL_dtls_got_timeout(ssl); + if (ret != WOLFSSL_SUCCESS && !wolfSSL_want_write(ssl) && + !wolfSSL_want_read(ssl)) { + err_sys("got timeout error"); + return -1; + } + } +#endif /* WOLFSSL_DTLS */ + /* do the peek to detect if the peer closed the connection*/ + } + } + + ret = wolfSSL_peek(ssl, foo, 0); + if (ret < 0 && !wolfSSL_want_read(ssl) && !wolfSSL_want_write(ssl)) { + ret = wolfSSL_get_error(ssl, ret); + if (ret == WOLFSSL_ERROR_ZERO_RETURN) + *zero_return = 1; + return -1; + } + + return 0; +} +#endif /* HAVE_SESSION_TICKET || WOLFSSL_DTLS13 */ + +static WC_INLINE void printBuffer(const byte *buf, int size) +{ + int i; + for (i = 0; i < size; i++) + printf("%x", buf[i]); +} + +#if !defined(NO_FILESYSTEM) && defined(OPENSSL_EXTRA) && \ + defined(DEBUG_UNIT_TEST_CERTS) +void DEBUG_WRITE_CERT_X509(WOLFSSL_X509* x509, const char* fileName); +void DEBUG_WRITE_DER(const byte* der, int derSz, const char* fileName); +#endif + +#define DTLS_CID_BUFFER_SIZE 256 + +static WC_MAYBE_UNUSED void *mymemmem(const void *haystack, size_t haystacklen, + const void *needle, size_t needlelen) +{ + size_t i, j; + const char* h = (const char*)haystack; + const char* n = (const char*)needle; + if (needlelen > haystacklen) + return NULL; + for (i = 0; i <= haystacklen - needlelen; i++) { + for (j = 0; j < needlelen; j++) { + if (h[i + j] != n[j]) + break; + } + if (j == needlelen) + return (void*)(h + i); + } + return NULL; +} + +#endif /* wolfSSL_TEST_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/version.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/version.h @@ -0,0 +1,40 @@ +/* wolfssl_version.h.in + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + +#ifndef WOLFSSL_VERSION_H +#define WOLFSSL_VERSION_H + + +#ifdef __cplusplus +extern "C" { +#endif + +#define LIBWOLFSSL_VERSION_STRING "5.8.2" +#define LIBWOLFSSL_VERSION_HEX 0x05008002 + +#ifdef __cplusplus +} +#endif + + +#endif /* WOLFSSL_VERSION_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/aes.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/aes.h @@ -0,0 +1,939 @@ +/* aes.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/aes.h +*/ +/* + +DESCRIPTION +This library provides the interfaces to the Advanced Encryption Standard (AES) +for encrypting and decrypting data. AES is the standard known for a symmetric +block cipher mechanism that uses n-bit binary string parameter key with 128-bits, +192-bits, and 256-bits of key sizes. + +*/ +#ifndef WOLF_CRYPT_AES_H +#define WOLF_CRYPT_AES_H + +#include <wolfssl/wolfcrypt/types.h> + +#if !defined(NO_AES) || defined(WOLFSSL_SM4) +typedef struct Gcm { + ALIGN16 byte H[16]; +#ifdef OPENSSL_EXTRA + word32 aadH[4]; /* additional authenticated data GHASH */ + word32 aadLen; /* additional authenticated data len */ +#endif +#ifdef GCM_TABLE + /* key-based fast multiplication table. */ + ALIGN16 byte M0[256][16]; +#elif defined(GCM_TABLE_4BIT) + #if defined(BIG_ENDIAN_ORDER) || defined(WC_16BIT_CPU) + ALIGN16 byte M0[16][16]; + #else + ALIGN16 byte M0[32][16]; + #endif +#endif /* GCM_TABLE */ +} Gcm; + +#if FIPS_VERSION3_GE(6,0,0) + extern const unsigned int wolfCrypt_FIPS_aes_ro_sanity[2]; + WOLFSSL_LOCAL int wolfCrypt_FIPS_AES_sanity(void); +#endif + +WOLFSSL_LOCAL void GenerateM0(Gcm* gcm); +#if !defined(__aarch64__) && defined(WOLFSSL_ARMASM) +WOLFSSL_LOCAL void GMULT(byte* X, byte* Y); +#endif +WOLFSSL_LOCAL void GHASH(Gcm* gcm, const byte* a, word32 aSz, const byte* c, + word32 cSz, byte* s, word32 sSz); +#endif + +#ifndef NO_AES + +#if defined(HAVE_FIPS) && \ + defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2) + #include <wolfssl/wolfcrypt/fips.h> +#endif /* HAVE_FIPS_VERSION >= 2 */ + +#ifndef WC_NO_RNG + #include <wolfssl/wolfcrypt/random.h> +#endif +#ifdef STM32_CRYPTO + #include <wolfssl/wolfcrypt/port/st/stm32.h> +#endif + +#ifdef WOLFSSL_IMXRT_DCP + #include "fsl_dcp.h" +#endif + +#ifdef WOLFSSL_XILINX_CRYPT +#ifdef WOLFSSL_XILINX_CRYPT_VERSAL +#include <wolfssl/wolfcrypt/port/xilinx/xil-versal-glue.h> +#include <xsecure_aesclient.h> +#if !defined(WOLFSSL_XILINX_AES_KEY_SRC) + #define WOLFSSL_XILINX_AES_KEY_SRC XSECURE_AES_USER_KEY_0 +#endif +#else /* versal */ +#include <xsecure_aes.h> +#if !defined(WOLFSSL_XILINX_AES_KEY_SRC) + #define WOLFSSL_XILINX_AES_KEY_SRC XSECURE_CSU_AES_KEY_SRC_KUP +#endif +#endif /* !versal */ +#endif /* WOLFSSL_XILINX_CRYPT */ + +#if defined(WOLFSSL_XILINX_CRYPT) || defined(WOLFSSL_AFALG_XILINX_AES) +#if !defined(WOLFSSL_XILINX_AES_KEY_SRC) +#define WOLFSSL_XILINX_AES_KEY_SRC 0 +#endif /* !defined(WOLFSSL_XILINX_AES_KEY_SRC) */ +#endif /* all Xilinx crypto */ + +#ifdef WOLFSSL_SE050 + #include <wolfssl/wolfcrypt/port/nxp/se050_port.h> +#endif + +#if defined(WOLFSSL_AFALG) || defined(WOLFSSL_AFALG_XILINX_AES) +/* included for struct msghdr */ +#include <wolfssl/wolfcrypt/port/af_alg/wc_afalg.h> +#endif + +#if defined(WOLFSSL_KCAPI_AES) +#include <wolfssl/wolfcrypt/port/kcapi/wc_kcapi.h> +#endif + +#if defined(WOLFSSL_DEVCRYPTO_AES) || defined(WOLFSSL_DEVCRYPTO_CBC) +#include <wolfssl/wolfcrypt/port/devcrypto/wc_devcrypto.h> +#endif + +#ifdef WOLFSSL_SILABS_SE_ACCEL + #include <wolfssl/wolfcrypt/port/silabs/silabs_aes.h> +#endif + + +#if defined(HAVE_AESGCM) && !defined(WC_NO_RNG) + #include <wolfssl/wolfcrypt/random.h> +#endif + +#if defined(WOLFSSL_HAVE_PSA) && !defined(WOLFSSL_PSA_NO_AES) +#include <psa/crypto.h> +#endif + +#if defined(WOLFSSL_CRYPTOCELL) + #include <wolfssl/wolfcrypt/port/arm/cryptoCell.h> +#endif + +#if (defined(WOLFSSL_RENESAS_TSIP_TLS) && \ + defined(WOLFSSL_RENESAS_TSIP_TLS_AES_CRYPT)) ||\ + defined(WOLFSSL_RENESAS_TSIP_CRYPTONLY) + #include <wolfssl/wolfcrypt/port/Renesas/renesas_tsip_types.h> +#endif + +#if defined(WOLFSSL_RENESAS_FSPSM) + #include <wolfssl/wolfcrypt/port/Renesas/renesas-fspsm-crypt.h> +#endif + +#ifdef WOLFSSL_MAXQ10XX_CRYPTO + #include <wolfssl/wolfcrypt/port/maxim/maxq10xx.h> +#endif + + +#ifdef __cplusplus + extern "C" { +#endif + +#ifndef WOLFSSL_AES_KEY_SIZE_ENUM +#define WOLFSSL_AES_KEY_SIZE_ENUM +/* these are required for FIPS and non-FIPS */ +enum { + AES_128_KEY_SIZE = 16, /* for 128 bit */ + AES_192_KEY_SIZE = 24, /* for 192 bit */ + AES_256_KEY_SIZE = 32, /* for 256 bit */ + + AES_IV_SIZE = 16 /* always block size */ +}; +#endif + +/* avoid redefinition of structs */ +#if !defined(HAVE_FIPS) || \ + (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)) + +#ifdef WOLFSSL_ASYNC_CRYPT + #include <wolfssl/wolfcrypt/async.h> +#endif + +enum { + AES_ENC_TYPE = WC_CIPHER_AES, /* cipher unique type */ + AES_ENCRYPTION = 0, + AES_DECRYPTION = 1, +#ifdef WC_AES_XTS_SUPPORT_SIMULTANEOUS_ENC_AND_DEC_KEYS + AES_ENCRYPTION_AND_DECRYPTION = 2, +#endif + + WC_AES_BLOCK_SIZE = 16, +#ifdef OPENSSL_COEXIST + /* allow OPENSSL_COEXIST applications to detect absence of AES_BLOCK_SIZE + * and presence of WC_AES_BLOCK_SIZE. + * + * if WC_NO_COMPAT_AES_BLOCK_SIZE is defined, WC_AES_BLOCK_SIZE is + * available, otherwise AES_BLOCK_SIZE is available. + */ + #define WC_NO_COMPAT_AES_BLOCK_SIZE +#else + #define AES_BLOCK_SIZE WC_AES_BLOCK_SIZE +#endif + + KEYWRAP_BLOCK_SIZE = 8, + + GCM_NONCE_MAX_SZ = 16, /* wolfCrypt's maximum nonce size allowed. */ + GCM_NONCE_MID_SZ = 12, /* The default nonce size for AES-GCM. */ + GCM_NONCE_MIN_SZ = 8, /* wolfCrypt's minimum nonce size allowed. */ + CCM_NONCE_MIN_SZ = 7, + CCM_NONCE_MAX_SZ = 13, + CTR_SZ = 4, + AES_IV_FIXED_SZ = 4, +#ifdef WOLFSSL_AES_CFB + AES_CFB_MODE = 1, +#endif +#ifdef WOLFSSL_AES_OFB + AES_OFB_MODE = 2, +#endif +#ifdef WOLFSSL_AES_XTS + AES_XTS_MODE = 3, +#endif + +#ifdef WOLF_PRIVATE_KEY_ID + AES_MAX_ID_LEN = 32, + AES_MAX_LABEL_LEN = 32, +#endif + + WOLF_ENUM_DUMMY_LAST_ELEMENT(AES) +}; + +#ifdef WC_AES_BITSLICED + #ifdef WC_AES_BS_WORD_SIZE + #define BS_WORD_SIZE WC_AES_BS_WORD_SIZE + #elif defined(NO_64BIT) + #define BS_WORD_SIZE 32 + #else + #define BS_WORD_SIZE 64 + #endif + + /* Number of bits to a block. */ + #define AES_BLOCK_BITS (WC_AES_BLOCK_SIZE * 8) + /* Number of bytes of input that can be processed in one call. */ + #define BS_BLOCK_SIZE (WC_AES_BLOCK_SIZE * BS_WORD_SIZE) + /* Number of words in a block. */ + #define BS_BLOCK_WORDS (AES_BLOCK_BITS / BS_WORD_SIZE) + + #if BS_WORD_SIZE == 64 + typedef word64 bs_word; + #define BS_WORD_SHIFT 6 + #define bs_bswap(x) ByteReverseWord64(x) + #elif BS_WORD_SIZE == 32 + typedef word32 bs_word; + #define BS_WORD_SHIFT 5 + #define bs_bswap(x) ByteReverseWord32(x) + #elif BS_WORD_SIZE == 16 + typedef word16 bs_word; + #define BS_WORD_SHIFT 4 + #define bs_bswap(x) ByteReverseWord16(x) + #elif BS_WORD_SIZE == 8 + typedef word8 bs_word; + #define BS_WORD_SHIFT 3 + #define bs_bswap(x) (x) + #else + #error "Word size not supported" + #endif +#endif + +struct Aes { + ALIGN16 word32 key[60]; +#ifdef WC_AES_BITSLICED + /* Extra key schedule space required for bit-slicing technique. */ + ALIGN16 bs_word bs_key[15 * WC_AES_BLOCK_SIZE * BS_WORD_SIZE]; +#endif + word32 rounds; +#ifdef WC_C_DYNAMIC_FALLBACK + word32 key_C_fallback[60]; +#endif + int keylen; + + ALIGN16 word32 reg[WC_AES_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */ + ALIGN16 word32 tmp[WC_AES_BLOCK_SIZE / sizeof(word32)]; /* same */ + +#if defined(HAVE_AESGCM) || defined(HAVE_AESCCM) + word32 invokeCtr[2]; + word32 nonceSz; +#endif +#ifdef HAVE_AESGCM + Gcm gcm; + +#ifdef WOLFSSL_SE050 + sss_symmetric_t aes_ctx; /* used as the function context */ + int ctxInitDone; + word32 keyId; + byte keyIdSet; + byte useSWCrypt; /* Use SW crypt instead of SE050, before SCP03 auth */ +#endif +#ifdef HAVE_CAVIUM_OCTEON_SYNC + word32 y0; +#endif +#endif /* HAVE_AESGCM */ +#ifdef WOLFSSL_CAAM + int blackKey; /* black key / hsm key id */ +#endif +#ifdef WOLFSSL_AESNI + byte use_aesni; + #if defined(WOLFSSL_LINUXKM) || defined(WC_WANT_FLAG_DONT_USE_AESNI) + /* Note, we can't support WC_FLAG_DONT_USE_AESNI by default because we + * need to support legacy applications that call wc_AesSetKey() on + * uninited struct Aes. For details see the software implementation of + * wc_AesSetKeyLocal() (aes.c). + */ + #define WC_FLAG_DONT_USE_AESNI 2 + #endif +#endif /* WOLFSSL_AESNI */ +#if defined(__aarch64__) && defined(WOLFSSL_ARMASM) && \ + !defined(WOLFSSL_ARMASM_NO_HW_CRYPTO) + byte use_aes_hw_crypto; +#ifdef HAVE_AESGCM + byte use_pmull_hw_crypto; + byte use_sha3_hw_crypto; +#endif +#endif /* __aarch64__ && WOLFSSL_ARMASM && !WOLFSSL_ARMASM_NO_HW_CRYPTO */ +#ifdef WOLF_CRYPTO_CB + int devId; + void* devCtx; +#endif +#ifdef WOLF_PRIVATE_KEY_ID + byte id[AES_MAX_ID_LEN]; + int idLen; + char label[AES_MAX_LABEL_LEN]; + int labelLen; +#endif +#ifdef WOLFSSL_ASYNC_CRYPT + WC_ASYNC_DEV asyncDev; +#endif /* WOLFSSL_ASYNC_CRYPT */ +#if defined(WOLFSSL_AES_COUNTER) || defined(WOLFSSL_AES_CFB) || \ + defined(WOLFSSL_AES_OFB) || defined(WOLFSSL_AES_XTS) || \ + defined(WOLFSSL_AES_CTS) + word32 left; /* unused bytes left from last call */ +#endif +#ifdef WOLFSSL_XILINX_CRYPT +#ifdef WOLFSSL_XILINX_CRYPT_VERSAL + wc_Xsecure xSec; + XSecure_AesKeySize xKeySize; + int aadStyle; + byte keyInit[WOLFSSL_XSECURE_AES_KEY_SIZE] ALIGN64; +#else + XSecure_Aes xilAes; + XCsuDma dma; + word32 keyInit[8]; +#endif + word32 kup; +#endif +#if defined(WOLFSSL_AFALG) || defined(WOLFSSL_AFALG_XILINX_AES) + int alFd; /* server socket to bind to */ + int rdFd; /* socket to read from */ + struct msghdr msg; + int dir; /* flag for encrypt or decrypt */ +#ifdef WOLFSSL_AFALG_XILINX_AES + word32 msgBuf[CMSG_SPACE(4) + CMSG_SPACE(sizeof(struct af_alg_iv) + + GCM_NONCE_MID_SZ)]; +#endif +#endif +#if defined(WOLFSSL_KCAPI_AES) + struct kcapi_handle* handle; + int init; +#endif +#if defined(WOLF_CRYPTO_CB) || (defined(WOLFSSL_DEVCRYPTO) && \ + (defined(WOLFSSL_DEVCRYPTO_AES) || defined(WOLFSSL_DEVCRYPTO_CBC))) || \ + (defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_AES)) || \ + defined(WOLFSSL_KCAPI_AES) + word32 devKey[AES_MAX_KEY_SIZE/WOLFSSL_BIT_SIZE/sizeof(word32)]; /* raw key */ +#ifdef HAVE_CAVIUM_OCTEON_SYNC + int keySet; +#endif +#endif +#if defined(WOLFSSL_DEVCRYPTO) && \ + (defined(WOLFSSL_DEVCRYPTO_AES) || defined(WOLFSSL_DEVCRYPTO_CBC)) + WC_CRYPTODEV ctx; +#endif +#if defined(WOLFSSL_CRYPTOCELL) + aes_context_t ctx; +#endif +#if (defined(WOLFSSL_RENESAS_TSIP_TLS) && \ + defined(WOLFSSL_RENESAS_TSIP_TLS_AES_CRYPT)) ||\ + defined(WOLFSSL_RENESAS_TSIP_CRYPTONLY) + TSIP_AES_CTX ctx; +#endif +#if defined(WOLFSSL_RENESAS_FSPSM) + FSPSM_AES_CTX ctx; +#endif +#if defined(WOLFSSL_IMXRT_DCP) + dcp_handle_t handle; +#endif +#if defined(WOLFSSL_SILABS_SE_ACCEL) + silabs_aes_t ctx; +#endif +#ifdef WOLFSSL_MAXQ10XX_CRYPTO + maxq_aes_t maxq_ctx; +#endif +#if defined(WOLFSSL_HAVE_PSA) && !defined(WOLFSSL_PSA_NO_AES) + psa_key_id_t key_id; + psa_cipher_operation_t psa_ctx; + int ctx_initialized; + int key_need_importing; +#endif + void* heap; /* memory hint to use */ +#ifdef WOLFSSL_AESGCM_STREAM +#if !defined(WOLFSSL_SMALL_STACK) || defined(WOLFSSL_AESNI) + ALIGN16 byte streamData[5 * WC_AES_BLOCK_SIZE]; +#else + byte* streamData; + word32 streamData_sz; +#endif + word32 aSz; + word32 cSz; + byte over; + byte aOver; + byte cOver; + WC_BITFIELD gcmKeySet:1; + WC_BITFIELD nonceSet:1; + WC_BITFIELD ctrSet:1; +#endif +#ifdef WC_DEBUG_CIPHER_LIFECYCLE + void *CipherLifecycleTag; /* used for dummy allocation and initialization, + * trackable by sanitizers. + */ +#endif +#ifdef WOLFSSL_AES_CTS + byte ctsBlock[WC_AES_BLOCK_SIZE * 2]; +#endif +}; + +#ifndef WC_AES_TYPE_DEFINED + typedef struct Aes Aes; + #define WC_AES_TYPE_DEFINED +#endif + +#ifdef WOLFSSL_AES_XTS + #if FIPS_VERSION3_GE(6,0,0) + /* SP800-38E - Restrict data unit to 2^20 blocks per key. A block is + * WC_AES_BLOCK_SIZE or 16-bytes (128-bits). So each key may only be used to + * protect up to 1,048,576 blocks of WC_AES_BLOCK_SIZE (16,777,216 bytes) + */ + #define FIPS_AES_XTS_MAX_BYTES_PER_TWEAK 16777216 + #endif + struct XtsAes { + Aes aes; + #ifdef WC_AES_XTS_SUPPORT_SIMULTANEOUS_ENC_AND_DEC_KEYS + Aes aes_decrypt; + #endif + Aes tweak; + }; + + #ifdef WOLFSSL_AESXTS_STREAM + struct XtsAesStreamData { + byte tweak_block[WC_AES_BLOCK_SIZE]; + word32 bytes_crypted_with_this_tweak; + }; + #endif + + #ifndef WC_AESXTS_TYPE_DEFINED + typedef struct XtsAes XtsAes; + typedef struct XtsAesStreamData XtsAesStreamData; + #define WC_AESXTS_TYPE_DEFINED + #endif + +#endif + + +#if (!defined(WC_AESFREE_IS_MANDATORY)) && \ + (defined(WC_DEBUG_CIPHER_LIFECYCLE) || \ + (defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_AES)) || \ + defined(WOLFSSL_AFALG) || defined(WOLFSSL_AFALG_XILINX_AES) || \ + defined(WOLFSSL_KCAPI_AES) || \ + (defined(WOLFSSL_DEVCRYPTO) && \ + (defined(WOLFSSL_DEVCRYPTO_AES) || \ + defined(WOLFSSL_DEVCRYPTO_CBC))) || \ + defined(WOLFSSL_IMXRT_DCP) || \ + (defined(WOLFSSL_AESGCM_STREAM) && defined(WOLFSSL_SMALL_STACK) && \ + !defined(WOLFSSL_AESNI)) || \ + (defined(WOLFSSL_SE050) && defined(WOLFSSL_SE050_CRYPT)) || \ + (defined(WOLFSSL_HAVE_PSA) && !defined(WOLFSSL_PSA_NO_AES)) || \ + defined(WOLFSSL_MAXQ10XX_CRYPTO) || \ + ((defined(WOLFSSL_RENESAS_FSPSM_TLS) || \ + defined(WOLFSSL_RENESAS_FSPSM_CRYPTONLY)) && \ + !defined(NO_WOLFSSL_RENESAS_FSPSM_AES))) +#define WC_AESFREE_IS_MANDATORY +#endif + +#ifdef HAVE_AESGCM +struct Gmac { + Aes aes; +}; + +#ifndef WC_AESGCM_TYPE_DEFINED + typedef struct Gmac Gmac; + #define WC_AESGCM_TYPE_DEFINED +#endif + +#endif /* HAVE_AESGCM */ +#endif /* HAVE_FIPS */ + + +/* Authenticate cipher function prototypes */ +typedef int (*wc_AesAuthEncryptFunc)(Aes* aes, byte* out, + const byte* in, word32 sz, + const byte* iv, word32 ivSz, + byte* authTag, word32 authTagSz, + const byte* authIn, word32 authInSz); +typedef int (*wc_AesAuthDecryptFunc)(Aes* aes, byte* out, + const byte* in, word32 sz, + const byte* iv, word32 ivSz, + const byte* authTag, word32 authTagSz, + const byte* authIn, word32 authInSz); + +/* AES-CBC */ +WOLFSSL_API int wc_AesSetKey(Aes* aes, const byte* key, word32 len, + const byte* iv, int dir); +WOLFSSL_API int wc_AesSetIV(Aes* aes, const byte* iv); + +#ifdef HAVE_AES_CBC +WOLFSSL_API int wc_AesCbcEncrypt(Aes* aes, byte* out, + const byte* in, word32 sz); +WOLFSSL_API int wc_AesCbcDecrypt(Aes* aes, byte* out, + const byte* in, word32 sz); +#endif + +#ifdef WOLFSSL_AES_CFB +WOLFSSL_API int wc_AesCfbEncrypt(Aes* aes, byte* out, + const byte* in, word32 sz); +WOLFSSL_API int wc_AesCfb1Encrypt(Aes* aes, byte* out, + const byte* in, word32 sz); +WOLFSSL_API int wc_AesCfb8Encrypt(Aes* aes, byte* out, + const byte* in, word32 sz); +#ifdef HAVE_AES_DECRYPT +WOLFSSL_API int wc_AesCfbDecrypt(Aes* aes, byte* out, + const byte* in, word32 sz); +WOLFSSL_API int wc_AesCfb1Decrypt(Aes* aes, byte* out, + const byte* in, word32 sz); +WOLFSSL_API int wc_AesCfb8Decrypt(Aes* aes, byte* out, + const byte* in, word32 sz); +#endif /* HAVE_AES_DECRYPT */ +#endif /* WOLFSSL_AES_CFB */ + +#ifdef WOLFSSL_AES_OFB +WOLFSSL_API int wc_AesOfbEncrypt(Aes* aes, byte* out, + const byte* in, word32 sz); +#ifdef HAVE_AES_DECRYPT +WOLFSSL_API int wc_AesOfbDecrypt(Aes* aes, byte* out, + const byte* in, word32 sz); +#endif /* HAVE_AES_DECRYPT */ +#endif /* WOLFSSL_AES_OFB */ + +#ifdef HAVE_AES_ECB +WOLFSSL_API int wc_AesEcbEncrypt(Aes* aes, byte* out, + const byte* in, word32 sz); +WOLFSSL_API int wc_AesEcbDecrypt(Aes* aes, byte* out, + const byte* in, word32 sz); +#endif + +/* AES-CTR */ +#ifdef WOLFSSL_AES_COUNTER + WOLFSSL_API int wc_AesCtrEncrypt(Aes* aes, byte* out, + const byte* in, word32 sz); + WOLFSSL_API int wc_AesCtrSetKey(Aes* aes, const byte* key, word32 len, + const byte* iv, int dir); + +#endif +/* AES-DIRECT */ +#if defined(WOLFSSL_AES_DIRECT) +#if defined(BUILDING_WOLFSSL) + WOLFSSL_API WARN_UNUSED_RESULT int wc_AesEncryptDirect(Aes* aes, byte* out, + const byte* in); + WOLFSSL_API WARN_UNUSED_RESULT int wc_AesDecryptDirect(Aes* aes, byte* out, + const byte* in); + WOLFSSL_API WARN_UNUSED_RESULT int wc_AesSetKeyDirect(Aes* aes, + const byte* key, + word32 len, + const byte* iv, int dir); +#else + WOLFSSL_API int wc_AesEncryptDirect(Aes* aes, byte* out, const byte* in); + WOLFSSL_API int wc_AesDecryptDirect(Aes* aes, byte* out, const byte* in); + WOLFSSL_API int wc_AesSetKeyDirect(Aes* aes, const byte* key, word32 len, + const byte* iv, int dir); +#endif +#endif + +#ifdef HAVE_AESGCM +#ifdef WOLFSSL_XILINX_CRYPT + WOLFSSL_API int wc_AesGcmSetKey_ex(Aes* aes, const byte* key, word32 len, + word32 kup); +#elif defined(WOLFSSL_AFALG_XILINX_AES) + WOLFSSL_LOCAL int wc_AesGcmSetKey_ex(Aes* aes, const byte* key, word32 len, + word32 kup); +#endif + WOLFSSL_API int wc_AesGcmSetKey(Aes* aes, const byte* key, word32 len); + WOLFSSL_API int wc_AesGcmEncrypt(Aes* aes, byte* out, + const byte* in, word32 sz, + const byte* iv, word32 ivSz, + byte* authTag, word32 authTagSz, + const byte* authIn, word32 authInSz); + WOLFSSL_API WARN_UNUSED_RESULT int wc_AesGcmDecrypt(Aes* aes, byte* out, + const byte* in, word32 sz, + const byte* iv, word32 ivSz, + const byte* authTag, word32 authTagSz, + const byte* authIn, word32 authInSz); +#ifdef WOLFSSL_AESGCM_STREAM +WOLFSSL_API int wc_AesGcmInit(Aes* aes, const byte* key, word32 len, + const byte* iv, word32 ivSz); + +WOLFSSL_API int wc_AesGcmEncryptInit(Aes* aes, const byte* key, word32 len, + const byte* iv, word32 ivSz); +WOLFSSL_API int wc_AesGcmEncryptInit_ex(Aes* aes, const byte* key, word32 len, + byte* ivOut, word32 ivOutSz); +WOLFSSL_API int wc_AesGcmEncryptUpdate(Aes* aes, byte* out, const byte* in, + word32 sz, const byte* authIn, word32 authInSz); +WOLFSSL_API int wc_AesGcmEncryptFinal(Aes* aes, byte* authTag, + word32 authTagSz); + +WOLFSSL_API int wc_AesGcmDecryptInit(Aes* aes, const byte* key, word32 len, + const byte* iv, word32 ivSz); +WOLFSSL_API int wc_AesGcmDecryptUpdate(Aes* aes, byte* out, const byte* in, + word32 sz, const byte* authIn, word32 authInSz); +WOLFSSL_API WARN_UNUSED_RESULT int wc_AesGcmDecryptFinal(Aes* aes, + const byte* authTag, word32 authTagSz); +#endif + +#ifndef WC_NO_RNG + WOLFSSL_API int wc_AesGcmSetExtIV(Aes* aes, const byte* iv, word32 ivSz); + WOLFSSL_API int wc_AesGcmSetIV(Aes* aes, word32 ivSz, + const byte* ivFixed, word32 ivFixedSz, + WC_RNG* rng); + WOLFSSL_API int wc_AesGcmEncrypt_ex(Aes* aes, byte* out, + const byte* in, word32 sz, + byte* ivOut, word32 ivOutSz, + byte* authTag, word32 authTagSz, + const byte* authIn, word32 authInSz); +#endif /* WC_NO_RNG */ + + WOLFSSL_API int wc_GmacSetKey(Gmac* gmac, const byte* key, word32 len); + WOLFSSL_API int wc_GmacUpdate(Gmac* gmac, const byte* iv, word32 ivSz, + const byte* authIn, word32 authInSz, + byte* authTag, word32 authTagSz); +#ifndef WC_NO_RNG + WOLFSSL_API int wc_Gmac(const byte* key, word32 keySz, byte* iv, word32 ivSz, + const byte* authIn, word32 authInSz, + byte* authTag, word32 authTagSz, WC_RNG* rng); + WOLFSSL_API int wc_GmacVerify(const byte* key, word32 keySz, + const byte* iv, word32 ivSz, + const byte* authIn, word32 authInSz, + const byte* authTag, word32 authTagSz); +#endif /* WC_NO_RNG */ +#endif /* HAVE_AESGCM */ +#ifdef HAVE_AESCCM + WOLFSSL_LOCAL int wc_AesCcmCheckTagSize(int sz); + WOLFSSL_API int wc_AesCcmSetKey(Aes* aes, const byte* key, word32 keySz); + WOLFSSL_API int wc_AesCcmEncrypt(Aes* aes, byte* out, + const byte* in, word32 inSz, + const byte* nonce, word32 nonceSz, + byte* authTag, word32 authTagSz, + const byte* authIn, word32 authInSz); + WOLFSSL_API WARN_UNUSED_RESULT int wc_AesCcmDecrypt(Aes* aes, byte* out, + const byte* in, word32 inSz, + const byte* nonce, word32 nonceSz, + const byte* authTag, word32 authTagSz, + const byte* authIn, word32 authInSz); + WOLFSSL_API int wc_AesCcmSetNonce(Aes* aes, + const byte* nonce, word32 nonceSz); + WOLFSSL_API int wc_AesCcmEncrypt_ex(Aes* aes, byte* out, + const byte* in, word32 sz, + byte* ivOut, word32 ivOutSz, + byte* authTag, word32 authTagSz, + const byte* authIn, word32 authInSz); +#endif /* HAVE_AESCCM */ + +#ifdef HAVE_AES_KEYWRAP + WOLFSSL_API int wc_AesKeyWrap(const byte* key, word32 keySz, + const byte* in, word32 inSz, + byte* out, word32 outSz, + const byte* iv); + WOLFSSL_API int wc_AesKeyWrap_ex(Aes *aes, + const byte* in, word32 inSz, + byte* out, word32 outSz, + const byte* iv); + WOLFSSL_API int wc_AesKeyUnWrap(const byte* key, word32 keySz, + const byte* in, word32 inSz, + byte* out, word32 outSz, + const byte* iv); + WOLFSSL_API int wc_AesKeyUnWrap_ex(Aes *aes, + const byte* in, word32 inSz, + byte* out, word32 outSz, + const byte* iv); +#endif /* HAVE_AES_KEYWRAP */ + +#ifdef WOLFSSL_AES_XTS + +WOLFSSL_API int wc_AesXtsInit(XtsAes* aes, void* heap, int devId); + +WOLFSSL_API int wc_AesXtsSetKeyNoInit(XtsAes* aes, const byte* key, + word32 len, int dir); + +WOLFSSL_API int wc_AesXtsSetKey(XtsAes* aes, const byte* key, + word32 len, int dir, void* heap, int devId); + +WOLFSSL_API int wc_AesXtsEncryptSector(XtsAes* aes, byte* out, + const byte* in, word32 sz, word64 sector); + +WOLFSSL_API int wc_AesXtsDecryptSector(XtsAes* aes, byte* out, + const byte* in, word32 sz, word64 sector); + +WOLFSSL_API int wc_AesXtsEncrypt(XtsAes* aes, byte* out, + const byte* in, word32 sz, const byte* i, word32 iSz); + +WOLFSSL_API int wc_AesXtsDecrypt(XtsAes* aes, byte* out, + const byte* in, word32 sz, const byte* i, word32 iSz); + +WOLFSSL_API int wc_AesXtsEncryptConsecutiveSectors(XtsAes* aes, + byte* out, const byte* in, word32 sz, word64 sector, + word32 sectorSz); + +WOLFSSL_API int wc_AesXtsDecryptConsecutiveSectors(XtsAes* aes, + byte* out, const byte* in, word32 sz, word64 sector, + word32 sectorSz); + +#ifdef WOLFSSL_AESXTS_STREAM + +WOLFSSL_API int wc_AesXtsEncryptInit(XtsAes* aes, const byte* i, word32 iSz, + struct XtsAesStreamData *stream); + +WOLFSSL_API int wc_AesXtsDecryptInit(XtsAes* aes, const byte* i, word32 iSz, + struct XtsAesStreamData *stream); + +WOLFSSL_API int wc_AesXtsEncryptUpdate(XtsAes* aes, byte* out, + const byte* in, word32 sz, struct XtsAesStreamData *stream); + +WOLFSSL_API int wc_AesXtsDecryptUpdate(XtsAes* aes, byte* out, + const byte* in, word32 sz, struct XtsAesStreamData *stream); + +WOLFSSL_API int wc_AesXtsEncryptFinal(XtsAes* aes, byte* out, + const byte* in, word32 sz, struct XtsAesStreamData *stream); + +WOLFSSL_API int wc_AesXtsDecryptFinal(XtsAes* aes, byte* out, + const byte* in, word32 sz, struct XtsAesStreamData *stream); + +#endif /* WOLFSSL_AESXTS_STREAM */ + +WOLFSSL_API int wc_AesXtsFree(XtsAes* aes); +#endif + +WOLFSSL_API int wc_AesGetKeySize(Aes* aes, word32* keySize); + +WOLFSSL_API int wc_AesInit(Aes* aes, void* heap, int devId); +#ifdef WOLF_PRIVATE_KEY_ID +WOLFSSL_API int wc_AesInit_Id(Aes* aes, unsigned char* id, int len, void* heap, + int devId); +WOLFSSL_API int wc_AesInit_Label(Aes* aes, const char* label, void* heap, + int devId); +#endif +WOLFSSL_API void wc_AesFree(Aes* aes); +#ifndef WC_NO_CONSTRUCTORS +WOLFSSL_API Aes* wc_AesNew(void* heap, int devId, int *result_code); +WOLFSSL_API int wc_AesDelete(Aes* aes, Aes** aes_p); +#endif + +#ifdef WOLFSSL_AES_SIV +typedef struct AesSivAssoc { + const byte* assoc; + word32 assocSz; +} AesSivAssoc; + +WOLFSSL_API +int wc_AesSivEncrypt(const byte* key, word32 keySz, const byte* assoc, + word32 assocSz, const byte* nonce, word32 nonceSz, + const byte* in, word32 inSz, byte* siv, byte* out); +WOLFSSL_API WARN_UNUSED_RESULT +int wc_AesSivDecrypt(const byte* key, word32 keySz, const byte* assoc, + word32 assocSz, const byte* nonce, word32 nonceSz, + const byte* in, word32 inSz, byte* siv, byte* out); + +WOLFSSL_API +int wc_AesSivEncrypt_ex(const byte* key, word32 keySz, const AesSivAssoc* assoc, + word32 numAssoc, const byte* nonce, word32 nonceSz, + const byte* in, word32 inSz, byte* siv, byte* out); +WOLFSSL_API WARN_UNUSED_RESULT +int wc_AesSivDecrypt_ex(const byte* key, word32 keySz, const AesSivAssoc* assoc, + word32 numAssoc, const byte* nonce, word32 nonceSz, + const byte* in, word32 inSz, byte* siv, byte* out); +#endif + +#ifdef WOLFSSL_AES_EAX + +/* Because of the circular dependency between AES and CMAC, we need to prevent + * inclusion of AES EAX from CMAC to avoid a recursive inclusion */ +#ifndef WOLF_CRYPT_CMAC_H +#include <wolfssl/wolfcrypt/cmac.h> +struct AesEax { + Aes aes; + Cmac nonceCmac; + Cmac aadCmac; + Cmac ciphertextCmac; + byte nonceCmacFinal[WC_AES_BLOCK_SIZE]; + byte aadCmacFinal[WC_AES_BLOCK_SIZE]; + byte ciphertextCmacFinal[WC_AES_BLOCK_SIZE]; + byte prefixBuf[WC_AES_BLOCK_SIZE]; +}; +#endif /* !defined(WOLF_CRYPT_CMAC_H) */ + +typedef struct AesEax AesEax; + +/* One-shot API */ +WOLFSSL_API int wc_AesEaxEncryptAuth(const byte* key, word32 keySz, byte* out, + const byte* in, word32 inSz, + const byte* nonce, word32 nonceSz, + /* output computed auth tag */ + byte* authTag, word32 authTagSz, + /* input data to authenticate (header) */ + const byte* authIn, word32 authInSz); + +WOLFSSL_API WARN_UNUSED_RESULT int wc_AesEaxDecryptAuth(const byte* key, + word32 keySz, byte* out, + const byte* in, word32 inSz, + const byte* nonce, word32 nonceSz, + /* auth tag to verify against */ + const byte* authTag, word32 authTagSz, + /* input data to authenticate (header) */ + const byte* authIn, word32 authInSz); + +/* Incremental API */ +WOLFSSL_API int wc_AesEaxInit(AesEax* eax, + const byte* key, word32 keySz, + const byte* nonce, word32 nonceSz, + const byte* authIn, word32 authInSz); + +WOLFSSL_API int wc_AesEaxEncryptUpdate(AesEax* eax, byte* out, + const byte* in, word32 inSz, + const byte* authIn, word32 authInSz); + +WOLFSSL_API int wc_AesEaxDecryptUpdate(AesEax* eax, byte* out, + const byte* in, word32 inSz, + const byte* authIn, word32 authInSz); + +WOLFSSL_API int wc_AesEaxAuthDataUpdate(AesEax* eax, + const byte* authIn, word32 authInSz); + +WOLFSSL_API int wc_AesEaxEncryptFinal(AesEax* eax, + byte* authTag, word32 authTagSz); + +WOLFSSL_API WARN_UNUSED_RESULT int wc_AesEaxDecryptFinal(AesEax* eax, + const byte* authIn, word32 authInSz); + +WOLFSSL_API int wc_AesEaxFree(AesEax* eax); + +#endif /* WOLFSSL_AES_EAX */ + +#ifdef WOLFSSL_AES_CTS +/* Ciphertext stealing encryption compatible with RFC2040 and RFC3962. */ + +/* One-shot API */ +WOLFSSL_API int wc_AesCtsEncrypt(const byte* key, word32 keySz, byte* out, + const byte* in, word32 inSz, + const byte* iv); +WOLFSSL_API int wc_AesCtsDecrypt(const byte* key, word32 keySz, byte* out, + const byte* in, word32 inSz, + const byte* iv); + +/* Incremental API */ +WOLFSSL_API int wc_AesCtsEncryptUpdate(Aes* aes, byte* out, word32* outSz, + const byte* in, word32 inSz); +WOLFSSL_API int wc_AesCtsDecryptUpdate(Aes* aes, byte* out, word32* outSz, + const byte* in, word32 inSz); +WOLFSSL_API int wc_AesCtsEncryptFinal(Aes* aes, byte* out, word32* outSz); +WOLFSSL_API int wc_AesCtsDecryptFinal(Aes* aes, byte* out, word32* outSz); + + +#endif + +#if defined(__aarch64__) && defined(WOLFSSL_ARMASM) && \ + !defined(WOLFSSL_ARMASM_NO_HW_CRYPTO) + +/* GHASH one block of data. + * + * XOR block into tag and GMULT with H. + * + * @param [in, out] aes AES GCM object. + * @param [in] block Block of AAD or cipher text. + */ +#define GHASH_ONE_BLOCK_AARCH64(aes, block) \ + do { \ + xorbuf(AES_TAG(aes), block, WC_AES_BLOCK_SIZE); \ + GMULT_AARCH64(AES_TAG(aes), aes->gcm.H); \ + } \ + while (0) + +WOLFSSL_LOCAL int AES_set_key_AARCH64(const unsigned char *userKey, + const int keylen, Aes* aes, int dir); +WOLFSSL_LOCAL void AES_encrypt_AARCH64(const byte* inBlock, byte* outBlock, + byte* key, int nr); +WOLFSSL_LOCAL void AES_decrypt_AARCH64(const byte* inBlock, byte* outBlock, + byte* key, int nr); +WOLFSSL_LOCAL void AES_CBC_encrypt_AARCH64(const byte* in, byte* out, word32 sz, + byte* reg, byte* key, int rounds); +WOLFSSL_LOCAL void AES_CBC_decrypt_AARCH64(const byte* in, byte* out, word32 sz, + byte* reg, byte* key, int rounds); +WOLFSSL_LOCAL void AES_CTR_encrypt_AARCH64(Aes* aes, byte* out, const byte* in, + word32 sz); +WOLFSSL_LOCAL void GMULT_AARCH64(byte* X, byte* Y); +#ifdef WOLFSSL_AESGCM_STREAM +WOLFSSL_LOCAL void GHASH_UPDATE_AARCH64(Aes* aes, const byte* a, word32 aSz, + const byte* c, word32 cSz); +WOLFSSL_LOCAL void AES_GCM_init_AARCH64(Aes* aes, const byte* iv, word32 ivSz); +WOLFSSL_LOCAL void AES_GCM_crypt_update_AARCH64(Aes* aes, byte* out, + const byte* in, word32 sz); +WOLFSSL_LOCAL void AES_GCM_final_AARCH64(Aes* aes, byte* authTag, + word32 authTagSz); +#endif +WOLFSSL_LOCAL void AES_GCM_set_key_AARCH64(Aes* aes, byte* iv); +WOLFSSL_LOCAL void AES_GCM_encrypt_AARCH64(Aes* aes, byte* out, const byte* in, + word32 sz, const byte* iv, word32 ivSz, byte* authTag, word32 authTagSz, + const byte* authIn, word32 authInSz); +WOLFSSL_LOCAL int AES_GCM_decrypt_AARCH64(Aes* aes, byte* out, const byte* in, + word32 sz, const byte* iv, word32 ivSz, const byte* authTag, + word32 authTagSz, const byte* authIn, word32 authInSz); + +#ifdef WOLFSSL_AES_XTS +WOLFSSL_LOCAL void AES_XTS_encrypt_AARCH64(XtsAes* xaes, byte* out, + const byte* in, word32 sz, const byte* i); +WOLFSSL_LOCAL void AES_XTS_decrypt_AARCH64(XtsAes* xaes, byte* out, + const byte* in, word32 sz, const byte* i); +#endif /* WOLFSSL_AES_XTS */ +#endif /* __aarch64__ && WOLFSSL_ARMASM && !WOLFSSL_ARMASM_NO_HW_CRYPTO */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + + +#endif /* NO_AES */ +#endif /* WOLF_CRYPT_AES_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/arc4.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/arc4.h @@ -0,0 +1,69 @@ +/* arc4.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/arc4.h +*/ + +#ifndef WOLF_CRYPT_ARC4_H +#define WOLF_CRYPT_ARC4_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef __cplusplus + extern "C" { +#endif + +#ifdef WOLFSSL_ASYNC_CRYPT + #include <wolfssl/wolfcrypt/async.h> +#endif + +enum { + ARC4_ENC_TYPE = 4, /* cipher unique type */ + ARC4_STATE_SIZE = 256, + RC4_KEY_SIZE = 16 /* always 128bit */ +}; + +/* ARC4 encryption and decryption */ +typedef struct Arc4 { + byte x; + byte y; + byte state[ARC4_STATE_SIZE]; +#ifdef WOLFSSL_ASYNC_CRYPT + WC_ASYNC_DEV asyncDev; +#endif + void* heap; +} Arc4; + +WOLFSSL_API int wc_Arc4Process(Arc4* arc4, byte* out, const byte* in, + word32 length); +WOLFSSL_API int wc_Arc4SetKey(Arc4* arc4, const byte* key, word32 length); + +WOLFSSL_API int wc_Arc4Init(Arc4* arc4, void* heap, int devId); +WOLFSSL_API void wc_Arc4Free(Arc4* arc4); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + + +#endif /* WOLF_CRYPT_ARC4_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/ascon.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/ascon.h @@ -0,0 +1,109 @@ +/* ascon.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifndef WOLF_CRYPT_ASCON_H +#define WOLF_CRYPT_ASCON_H + +#ifdef HAVE_ASCON + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define ASCON_HASH256_SZ 32 + +#define ASCON_AEAD128_KEY_SZ 16 +#define ASCON_AEAD128_NONCE_SZ 16 +#define ASCON_AEAD128_TAG_SZ 16 + +typedef union AsconState { +#ifdef WORD64_AVAILABLE + word64 s64[5]; +#endif + word32 s32[10]; + word16 s16[20]; + byte s8[40]; +} AsconState; + +typedef struct wc_AsconHash256 { + AsconState state; + byte lastBlkSz; +} wc_AsconHash256; + +enum { + ASCON_AEAD128_NOTSET = 0, + ASCON_AEAD128_ENCRYPT = 1, + ASCON_AEAD128_DECRYPT = 2 +}; + +typedef struct wc_AsconAEAD128 { + /* needed throughout both encrypt and decrypt */ +#ifdef WORD64_AVAILABLE + word64 key[ASCON_AEAD128_KEY_SZ/sizeof(word64)]; +#endif + AsconState state; + byte lastBlkSz; + byte keySet:1; /* has the key been processed */ + byte nonceSet:1; /* has the nonce been processed */ + byte adSet:1; /* has the associated data been processed */ + byte op:2; /* 0 for not set, 1 for encrypt, 2 for decrypt */ +} wc_AsconAEAD128; + +/* AsconHash API */ + +WOLFSSL_API wc_AsconHash256* wc_AsconHash256_New(void); +WOLFSSL_API void wc_AsconHash256_Free(wc_AsconHash256* a); +WOLFSSL_API int wc_AsconHash256_Init(wc_AsconHash256* a); +WOLFSSL_API void wc_AsconHash256_Clear(wc_AsconHash256* a); +WOLFSSL_API int wc_AsconHash256_Update(wc_AsconHash256* a, const byte* data, + word32 dataSz); +WOLFSSL_API int wc_AsconHash256_Final(wc_AsconHash256* a, byte* hash); + +WOLFSSL_API wc_AsconAEAD128* wc_AsconAEAD128_New(void); +WOLFSSL_API void wc_AsconAEAD128_Free(wc_AsconAEAD128* a); +WOLFSSL_API int wc_AsconAEAD128_Init(wc_AsconAEAD128* a); +WOLFSSL_API void wc_AsconAEAD128_Clear(wc_AsconAEAD128* a); + +/* AsconAEAD API */ + +WOLFSSL_API int wc_AsconAEAD128_SetKey(wc_AsconAEAD128* a, const byte* key); +WOLFSSL_API int wc_AsconAEAD128_SetNonce(wc_AsconAEAD128* a, const byte* nonce); +WOLFSSL_API int wc_AsconAEAD128_SetAD(wc_AsconAEAD128* a, const byte* ad, + word32 adSz); + +WOLFSSL_API int wc_AsconAEAD128_EncryptUpdate(wc_AsconAEAD128* a, byte* out, + const byte* in, word32 inSz); +WOLFSSL_API int wc_AsconAEAD128_EncryptFinal(wc_AsconAEAD128* a, byte* tag); + +WOLFSSL_API int wc_AsconAEAD128_DecryptUpdate(wc_AsconAEAD128* a, byte* out, + const byte* in, word32 inSz); +WOLFSSL_API int wc_AsconAEAD128_DecryptFinal(wc_AsconAEAD128* a, + const byte* tag); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* HAVE_ASCON */ + +#endif /* WOLF_CRYPT_ASCON_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/asn.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/asn.h @@ -0,0 +1,2794 @@ +/* asn.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/asn.h +*/ + +/* + +DESCRIPTION +This library provides the interface to Abstract Syntax Notation One (ASN.1) objects. +ASN.1 is a standard interface description language for defining data structures +that can be serialized and deserialized in a cross-platform way. + +*/ +#ifndef WOLF_CRYPT_ASN_H +#define WOLF_CRYPT_ASN_H + +#include <wolfssl/wolfcrypt/types.h> + +#if !defined(NO_ASN) || !defined(NO_PWDBASED) + +#if !defined(NO_ASN_TIME) && defined(NO_TIME_H) + #define NO_ASN_TIME /* backwards compatibility with NO_TIME_H */ +#endif + +#include <wolfssl/wolfcrypt/wolfmath.h> + +#ifdef WOLFSSL_ASYNC_CRYPT + #include <wolfssl/wolfcrypt/async.h> +#endif + +#ifndef NO_DH + #include <wolfssl/wolfcrypt/dh.h> +#endif +#ifndef NO_DSA + #include <wolfssl/wolfcrypt/dsa.h> +#endif +#ifndef NO_RSA + #include <wolfssl/wolfcrypt/rsa.h> +#endif +#ifdef HAVE_ECC + #include <wolfssl/wolfcrypt/ecc.h> +#endif +#ifdef HAVE_ED25519 + #include <wolfssl/wolfcrypt/ed25519.h> +#endif +#ifdef HAVE_ED448 + #include <wolfssl/wolfcrypt/ed448.h> +#endif +#ifdef HAVE_SPHINCS + #include <wolfssl/wolfcrypt/sphincs.h> +#endif +#ifdef HAVE_FALCON + #include <wolfssl/wolfcrypt/falcon.h> +#endif +#ifdef HAVE_DILITHIUM + #include <wolfssl/wolfcrypt/dilithium.h> +#endif +#ifndef NO_SHA + #include <wolfssl/wolfcrypt/sha.h> +#endif +#ifndef NO_MD5 + #include <wolfssl/wolfcrypt/md5.h> +#endif +#include <wolfssl/wolfcrypt/sha256.h> +#ifdef WOLFSSL_SM3 + #include <wolfssl/wolfcrypt/sm3.h> +#endif +#include <wolfssl/wolfcrypt/asn_public.h> /* public interface */ + +#if defined(NO_SHA) && defined(NO_SHA256) + #define WC_SHA256_DIGEST_SIZE 32 +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +#ifndef NO_ASN + +#ifndef EXTERNAL_SERIAL_SIZE + #define EXTERNAL_SERIAL_SIZE 32 +#endif + +enum { + ASN_ISSUER = 0, + ASN_SUBJECT = 1, + + ASN_BEFORE = 0, + ASN_AFTER = 1 +}; + +#ifndef NO_ASN_OLD_TYPE_NAMES + #ifndef ISSUER + #define ISSUER ASN_ISSUER + #endif + #ifndef SUBJECT + #define SUBJECT ASN_SUBJECT + #endif + #ifndef BEFORE + #define BEFORE ASN_BEFORE + #endif + #ifndef AFTER + #define AFTER ASN_AFTER + #endif +#endif + +/* ASN Tags */ +enum ASN_Tags { + ASN_EOC = 0x00, + ASN_BOOLEAN = 0x01, + ASN_INTEGER = 0x02, + ASN_BIT_STRING = 0x03, + ASN_OCTET_STRING = 0x04, + ASN_TAG_NULL = 0x05, + ASN_OBJECT_ID = 0x06, + ASN_OBJECT_DESC = 0x07, + ASN_INSTANCE_OF = 0x08, + ASN_REAL = 0x09, + ASN_ENUMERATED = 0x0a, + ASN_EMBEDDED_PDV = 0x0b, + ASN_UTF8STRING = 0x0c, + ASN_RELATIVE_OID = 0x0d, + ASN_SEQUENCE = 0x10, + ASN_SET = 0x11, + ASN_NUMERICSTRING = 0x12, + ASN_PRINTABLE_STRING = 0x13, + ASN_T61STRING = 0x14, + ASN_VIDEOTEXSTRING = 0x15, + ASN_IA5_STRING = 0x16, + ASN_UTC_TIME = 0x17, + ASN_GENERALIZED_TIME = 0x18, + ASN_GRAPHICSTRING = 0x19, + ASN_ISO646STRING = 0x1a, + ASN_GENERALSTRING = 0x1b, + ASN_UNIVERSALSTRING = 0x1c, + ASN_CHARACTER_STRING = 0x1d, + ASN_BMPSTRING = 0x1e, + ASN_TYPE_MASK = 0x1f, + + ASN_LONG_LENGTH = 0x80, + ASN_INDEF_LENGTH = 0x80, + + /* ASN_Flags - Bitmask */ + ASN_CONSTRUCTED = 0x20, + ASN_APPLICATION = 0x40, + ASN_CONTEXT_SPECIFIC = 0x80, + ASN_PRIVATE = 0xC0, + ASN_CLASS_MASK = 0xC0, + + CRL_EXTENSIONS = 0xa0, + ASN_EXTENSIONS = 0xa3, + + /* GeneralName types */ + ASN_OTHER_TYPE = 0x00, + ASN_RFC822_TYPE = 0x01, + ASN_DNS_TYPE = 0x02, + ASN_DIR_TYPE = 0x04, + ASN_URI_TYPE = 0x06, /* the value 6 is from GeneralName OID */ + ASN_IP_TYPE = 0x07, /* the value 7 is from GeneralName OID */ + ASN_RID_TYPE = 0x08, + + /* PKCS #7 types */ + ASN_ENC_CONTENT = 0x00, + ASN_OTHERNAME_VALUE = 0x00, + + /* AuthorityKeyIdentifier fields */ + ASN_AUTHKEYID_KEYID = 0x00, + ASN_AUTHKEYID_ISSUER = 0x01, + ASN_AUTHKEYID_SERIAL = 0x02, + + /* GeneralSubtree fields */ + ASN_SUBTREE_MIN = 0x00, + ASN_SUBTREE_MAX = 0x01, + + /* x509 Cert Fields */ + ASN_X509_CERT_VERSION = 0x00, + + /* x509 Cert Extension Fields */ + ASN_AKID_KEYID = 0x00, + + /* ECC Key Fields */ + ASN_ECC_PARAMS = 0x00, + ASN_ECC_PUBKEY = 0x01, + + /* OneAsymmetricKey Fields */ + ASN_ASYMKEY_ATTRS = 0x00, + ASN_ASYMKEY_PUBKEY = 0x01 +}; + +/* NOTE: If ASN_UTC_TIME_SIZE or ASN_GENERALIZED_TIME_SIZE are ever modified + * one needs to update the logic in asn.c function GetAsnTimeString() + * which depends on the size 14 and/or 16 to determine which format to + * place in the "buf" (output) + */ +#define ASN_UTC_TIME_SIZE 14 /* Read note above before modifying */ +#define ASN_GENERALIZED_TIME_SIZE 16 /* Read note above before modifying */ +#define ASN_GENERALIZED_TIME_MAX 68 + +#ifdef WOLFSSL_ASN_TEMPLATE +/* Different data types that can be stored in ASNGetData/ASNSetData. */ +enum ASNItem_DataType { + /* Default for tag type. */ + ASN_DATA_TYPE_NONE = 0, + /* 8-bit integer value. */ + ASN_DATA_TYPE_WORD8 = 1, + /* 16-bit integer value. */ + ASN_DATA_TYPE_WORD16 = 2, + /* 32-bit integer value. */ + ASN_DATA_TYPE_WORD32 = 4, + /* Buffer with data and length. */ + ASN_DATA_TYPE_BUFFER = 5, + /* An expected/required buffer with data and length. */ + ASN_DATA_TYPE_EXP_BUFFER = 6, + /* Replace the item with buffer (data and length). */ + ASN_DATA_TYPE_REPLACE_BUFFER = 7, + /* Big number as an mp_int. */ + ASN_DATA_TYPE_MP = 8, + /* Big number as an mp_int that has already been initialized. */ + ASN_DATA_TYPE_MP_INITED = 9, + /* Big number as a positive or negative mp_int. */ + ASN_DATA_TYPE_MP_POS_NEG = 10, + /* ASN.1 CHOICE. A 0 terminated list of tags that are valid. */ + ASN_DATA_TYPE_CHOICE = 11 +}; + +/* A template entry describing an ASN.1 item. */ +typedef struct ASNItem { + /* Depth of ASN.1 item - how many constructed ASN.1 items above. */ + byte depth; + /* BER/DER tag to expect. */ + byte tag; + /* Whether the ASN.1 item is constructed. */ + WC_BITFIELD constructed:1; + /* Whether to parse the header only or skip data. If + * ASNSetData.data.buffer.data is supplied then this option gets + * overwritten and the child nodes get ignored. */ + WC_BITFIELD headerOnly:1; + /* Whether ASN.1 item is optional. + * - 0 means not optional + * - 1 means is optional + * - 2+ means one of these at the same level with same value must appear. + */ + byte optional; +} ASNItem; + +/* Dynamic data for setting (encoding) an ASN.1 item. */ +typedef struct ASNSetData { + /* Reverse offset into buffer of ASN.1 item - calculated in SizeASN_Items(). + * SetASN_Items() subtracts from total length to get usable value. + */ + word32 offset; + /* Length of data in ASN.1 item - calculated in SizeASN_Items(). */ + word32 length; + /* Different data type representation. */ + union { + /* 8-bit integer value. */ + byte u8; + /* 16-bit integer value. */ + word16 u16; + /* 32-bit integer value. */ + word32 u32; + /* Big number as an mp_int. */ + mp_int* mp; + /* Buffer as data pointer and length. */ + struct { + /* Data to write out. */ + const byte* data; + /* Length of data to write out. */ + word32 length; + } buffer; + } data; + /* Type of data stored in data field - enum ASNItem_DataType. */ + byte dataType; + /* Don't write this ASN.1 item out. + * Optional items are dependent on the data being encoded. + */ + byte noOut; +} ASNSetData; + +/* Dynamic data for getting (decoding) an ASN.1 item. */ +typedef struct ASNGetData { + /* Offset into buffer where encoding starts. */ + word32 offset; + /* Total length of data in ASN.1 item. + * BIT_STRING and INTEGER lengths include leading byte. */ + word32 length; + union { + /* Pointer to 8-bit integer. */ + byte* u8; + /* Pointer to 16-bit integer. */ + word16* u16; + /* Pointer to 32-bit integer. */ + word32* u32; + /* Pointer to mp_int for big number. */ + mp_int* mp; + /* List of possible tags. Useful for CHOICE ASN.1 items. */ + const byte* choice; + /* Buffer to copy into. */ + struct { + /* Buffer to hold ASN.1 data. */ + byte* data; + /* Maximum length of buffer. */ + word32* length; + } buffer; + /* Reference to ASN.1 item's data. */ + struct { + /* Pointer reference into input buffer. */ + const byte* data; + /* Length of data. */ + word32 length; + } ref; + /* Data of an OBJECT_ID. */ + struct { + /* OID data reference into input buffer. */ + const byte* data; + /* Length of OID data. */ + word32 length; + /* Type of OID expected. */ + word32 type; + /* OID sum - 32-bit id. */ + word32 sum; + } oid; + } data; + /* Type of data stored in data field - enum ASNItem_DataType. */ + byte dataType; + /* Tag found in BER/DER item. */ + byte tag; +} ASNGetData; + +WOLFSSL_LOCAL int SizeASN_Items(const ASNItem* asn, ASNSetData *data, + int count, int* encSz); +WOLFSSL_LOCAL int SetASN_Items(const ASNItem* asn, ASNSetData *data, int count, + byte* output); +WOLFSSL_LOCAL int GetASN_Items(const ASNItem* asn, ASNGetData *data, int count, + int complete, const byte* input, word32* inOutIdx, word32 length); + +#ifdef WOLFSSL_ASN_TEMPLATE_TYPE_CHECK +WOLFSSL_LOCAL void GetASN_Int8Bit(ASNGetData *dataASN, byte* num); +WOLFSSL_LOCAL void GetASN_Int16Bit(ASNGetData *dataASN, word16* num); +WOLFSSL_LOCAL void GetASN_Int32Bit(ASNGetData *dataASN, word32* num); +WOLFSSL_LOCAL void GetASN_Buffer(ASNGetData *dataASN, byte* data, + word32* length); +WOLFSSL_LOCAL void GetASN_ExpBuffer(ASNGetData *dataASN, const byte* data, + word32 length); +WOLFSSL_LOCAL void GetASN_MP(ASNGetData *dataASN, mp_int* num); +WOLFSSL_LOCAL void GetASN_MP_Inited(ASNGetData *dataASN, mp_int* num); +WOLFSSL_LOCAL void GetASN_MP_PosNeg(ASNGetData *dataASN, mp_int* num); +WOLFSSL_LOCAL void GetASN_Choice(ASNGetData *dataASN, const byte* options); +WOLFSSL_LOCAL void GetASN_Boolean(ASNGetData *dataASN, byte* num); +WOLFSSL_LOCAL void GetASN_OID(ASNGetData *dataASN, int oidType); +WOLFSSL_LOCAL void GetASN_GetConstRef(ASNGetData * dataASN, const byte** data, + word32* length); +WOLFSSL_LOCAL void GetASN_GetRef(ASNGetData * dataASN, byte** data, + word32* length); +WOLFSSL_LOCAL void GetASN_OIDData(ASNGetData * dataASN, byte** data, + word32* length); +WOLFSSL_LOCAL void SetASN_Boolean(ASNSetData *dataASN, byte val); +WOLFSSL_LOCAL void SetASN_Int8Bit(ASNSetData *dataASN, byte num); +WOLFSSL_LOCAL void SetASN_Int16Bit(ASNSetData *dataASN, word16 num); +WOLFSSL_LOCAL void SetASN_Buffer(ASNSetData *dataASN, const byte* data, + word32 length); +WOLFSSL_LOCAL void SetASN_ReplaceBuffer(ASNSetData *dataASN, const byte* data, + word32 length); +WOLFSSL_LOCAL void SetASN_MP(ASNSetData *dataASN, mp_int* num); +WOLFSSL_LOCAL void SetASN_OID(ASNSetData *dataASN, int oid, int oidType); +#else +/* Setup ASN data item to get an 8-bit number. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] num Pointer to an 8-bit variable. + */ +#define GetASN_Int8Bit(dataASN, num) \ + do { \ + (dataASN)->dataType = ASN_DATA_TYPE_WORD8; \ + (dataASN)->data.u8 = (num); \ + } while (0) + +/* Setup ASN data item to get a 16-bit number. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] num Pointer to a 16-bit variable. + */ +#define GetASN_Int16Bit(dataASN, num) \ + do { \ + (dataASN)->dataType = ASN_DATA_TYPE_WORD16; \ + (dataASN)->data.u16 = (num); \ + } while (0) + +/* Setup ASN data item to get a 32-bit number. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] num Pointer to a 32-bit variable. + */ +#define GetASN_Int32Bit(dataASN, num) \ + do { \ + (dataASN)->dataType = ASN_DATA_TYPE_WORD32; \ + (dataASN)->data.u32 = (num); \ + } while (0) + +/* Setup ASN data item to get data into a buffer of a specific length. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] d Buffer to hold data. + * @param [in] l Length of buffer in bytes. + */ +#define GetASN_Buffer(dataASN, d, l) \ + do { \ + (dataASN)->dataType = ASN_DATA_TYPE_BUFFER; \ + (dataASN)->data.buffer.data = (d); \ + (dataASN)->data.buffer.length = (l); \ + } while (0) + +/* Setup ASN data item to check parsed data against expected buffer. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] d Buffer containing expected data. + * @param [in] l Length of buffer in bytes. + */ +#define GetASN_ExpBuffer(dataASN, d, l) \ + do { \ + (dataASN)->dataType = ASN_DATA_TYPE_EXP_BUFFER; \ + (dataASN)->data.ref.data = (d); \ + (dataASN)->data.ref.length = (l); \ + } while (0) + +/* Setup ASN data item to get a number into an mp_int. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] num Multi-precision number object. + */ +#define GetASN_MP(dataASN, num) \ + do { \ + (dataASN)->dataType = ASN_DATA_TYPE_MP; \ + (dataASN)->data.mp = (num); \ + } while (0) + +/* Setup ASN data item to get a number into an mp_int that is initialized. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] num Multi-precision number object. + */ +#define GetASN_MP_Inited(dataASN, num) \ + do { \ + (dataASN)->dataType = ASN_DATA_TYPE_MP_INITED; \ + (dataASN)->data.mp = (num); \ + } while (0) + +/* Setup ASN data item to get a positive or negative number into an mp_int. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] num Multi-precision number object. + */ +#define GetASN_MP_PosNeg(dataASN, num) \ + do { \ + (dataASN)->dataType = ASN_DATA_TYPE_MP_POS_NEG; \ + (dataASN)->data.mp = (num); \ + } while (0) + +/* Setup ASN data item to be a choice of tags. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] choice 0 terminated list of tags that are valid. + */ +#define GetASN_Choice(dataASN, options) \ + do { \ + (dataASN)->dataType = ASN_DATA_TYPE_CHOICE; \ + (dataASN)->data.choice = (options); \ + } while (0) + +/* Setup ASN data item to get a boolean value. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] num Pointer to an 8-bit variable. + */ +#define GetASN_Boolean(dataASN, num) \ + do { \ + (dataASN)->dataType = ASN_DATA_TYPE_NONE; \ + (dataASN)->data.u8 = (num); \ + } while (0) + +/* Setup ASN data item to be a an OID of a specific type. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] oidType Type of OID to expect. + */ +#define GetASN_OID(dataASN, oidType) \ + (dataASN)->data.oid.type = (oidType) + +/* Get the data and length from an ASN data item. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [out] d Pointer to data of item. + * @param [out] l Length of buffer in bytes. + */ +#define GetASN_GetConstRef(dataASN, d, l) \ + do { \ + *(d) = (dataASN)->data.ref.data; \ + *(l) = (dataASN)->data.ref.length; \ + } while (0) + +/* Get the data and length from an ASN data item. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [out] d Pointer to data of item. + * @param [out] l Length of buffer in bytes. + */ +#define GetASN_GetRef(dataASN, d, l) \ + do { \ + *(d) = (byte*)(dataASN)->data.ref.data; \ + *(l) = (dataASN)->data.ref.length; \ + } while (0) + +/* Get the data and length from an ASN data item that is an OID. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [out] d Pointer to . + * @param [out] l Length of buffer in bytes. + */ +#define GetASN_OIDData(dataASN, d, l) \ + do { \ + *(d) = (byte*)(dataASN)->data.oid.data; \ + *(l) = (dataASN)->data.oid.length; \ + } while (0) + +/* Setup an ASN data item to set a boolean. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] val Boolean value. + */ +#define SetASN_Boolean(dataASN, val) \ + do { \ + (dataASN)->dataType = ASN_DATA_TYPE_NONE; \ + (dataASN)->data.u8 = (val); \ + } while (0) + +/* Setup an ASN data item to set an 8-bit number. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] num 8-bit number to set. + */ +#define SetASN_Int8Bit(dataASN, num) \ + do { \ + (dataASN)->dataType = ASN_DATA_TYPE_WORD8; \ + (dataASN)->data.u8 = (num); \ + } while (0) + +/* Setup an ASN data item to set a 16-bit number. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] num 16-bit number to set. + */ +#define SetASN_Int16Bit(dataASN, num) \ + do { \ + (dataASN)->dataType = ASN_DATA_TYPE_WORD16; \ + (dataASN)->data.u16 = (num); \ + } while (0) + +/* Setup an ASN data item to set the data in a buffer. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] d Buffer containing data to set. + * @param [in] l Length of data in buffer in bytes. + */ +#define SetASN_Buffer(dataASN, d, l) \ + do { \ + (dataASN)->data.buffer.data = (d); \ + (dataASN)->data.buffer.length = (word32)(l); \ + } while (0) + +/* Setup an ASN data item to set the DER encode data in a buffer. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] d Buffer containing BER encoded data to set. + * @param [in] l Length of data in buffer in bytes. + */ +#define SetASN_ReplaceBuffer(dataASN, d, l) \ + do { \ + (dataASN)->dataType = ASN_DATA_TYPE_REPLACE_BUFFER; \ + (dataASN)->data.buffer.data = (d); \ + (dataASN)->data.buffer.length = (l); \ + } while (0) + +/* Setup an ASN data item to set an muli-precision number. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] num Multi-precision number. + */ +#define SetASN_MP(dataASN, num) \ + do { \ + (dataASN)->dataType = ASN_DATA_TYPE_MP; \ + (dataASN)->data.mp = (num); \ + } while (0) + +/* Setup an ASN data item to set an OID based on id and type. + * + * oid and oidType pair are unique. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] oid OID identifier. + * @param [in] oidType Type of OID. + */ +#define SetASN_OID(dataASN, oid, oidType) \ + (dataASN)->data.buffer.data = OidFromId(oid, oidType, \ + &(dataASN)->data.buffer.length) +#endif /* WOLFSSL_ASN_TEMPLATE_TYPE_CHECK */ + + +/* Get address at the start of the BER item. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] in Input buffer. + * @return Address at start of BER item. + */ +#define GetASNItem_Addr(dataASN, in) \ + ((in) + (dataASN).offset) + +/* Get length of a BER item - including tag and length. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] in Input buffer. + * @return Length of a BER item. + */ +#define GetASNItem_Length(dataASN, in) \ + ((dataASN).length + (word32)((dataASN).data.buffer.data - (in)) - \ + (dataASN).offset) + +/* Get the index of a BER item's data. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] in Input buffer. + * @return Index of a BER item's data. + */ +#define GetASNItem_DataIdx(dataASN, in) \ + (word32)((dataASN).data.ref.data - (in)) + +/* Get the end index of a BER item - index of the start of the next item. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] in Input buffer. + * @return End index of a BER item. + */ +#define GetASNItem_EndIdx(dataASN, in) \ + ((word32)((dataASN).data.ref.data - (in)) + \ + (dataASN).data.ref.length) + +/* For a BIT_STRING, get the unused bits byte. + * + * @param [in] dataASN Dynamic ASN data item. + * @return Unused bits byte in BIT_STRING. + */ +#define GetASNItem_UnusedBits(dataASN) \ + (*((dataASN).data.ref.data - 1)) + +/* Set the data items at indices start to end inclusive to not be encoded. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] start First item not to be encoded. + * @param [in] end Last item not to be encoded. + */ +#define SetASNItem_NoOut(dataASN, start, end) \ + do { \ + int ii; \ + for (ii = (start); ii <= (end); ii++) { \ + (dataASN)[ii].noOut = 1; \ + } \ + } \ + while (0) + +/* Set the data items below node to not be encoded. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] node Node who's children should not be encoded. + * @param [in] dataASNLen Number of items in dataASN. + */ +#define SetASNItem_NoOutBelow(dataASN, asn, node, dataASNLen) \ + do { \ + int ii; \ + for (ii = (node) + 1; ii < (int)(dataASNLen); ii++) { \ + if ((asn)[ii].depth <= (asn)[node].depth) \ + break; \ + (dataASN)[ii].noOut = 1; \ + } \ + } \ + while (0) + +/* Set the node and all nodes below to not be encoded. + * + * @param [in] dataASN Dynamic ASN data item. + * @param [in] node Node which should not be encoded. Child nodes will + * also not be encoded. + * @param [in] dataASNLen Number of items in dataASN. + */ +#define SetASNItem_NoOutNode(dataASN, asn, node, dataASNLen) \ + do { \ + int ii; \ + (dataASN)[node].noOut = 1; \ + for (ii = (node) + 1; ii < (int)(dataASNLen); ii++) { \ + if ((asn)[ii].depth <= (asn)[node].depth) \ + break; \ + (dataASN)[ii].noOut = 1; \ + } \ + } \ + while (0) + +#endif /* WOLFSSL_ASN_TEMPLATE */ + + +enum DN_Tags { + ASN_DN_NULL = 0x00, + ASN_COMMON_NAME = 0x03, /* CN */ + ASN_SUR_NAME = 0x04, /* SN */ + ASN_SERIAL_NUMBER = 0x05, /* serialNumber */ + ASN_COUNTRY_NAME = 0x06, /* C */ + ASN_LOCALITY_NAME = 0x07, /* L */ + ASN_STATE_NAME = 0x08, /* ST */ + ASN_STREET_ADDR = 0x09, /* street */ + ASN_ORG_NAME = 0x0a, /* O */ + ASN_ORGUNIT_NAME = 0x0b, /* OU */ + ASN_BUS_CAT = 0x0f, /* businessCategory */ + ASN_POSTAL_CODE = 0x11, /* postalCode */ + ASN_USER_ID = 0x12, /* UserID */ +#ifdef WOLFSSL_CERT_NAME_ALL + ASN_NAME = 0x29, /* name */ + ASN_GIVEN_NAME = 0x2a, /* GN */ + ASN_INITIALS = 0x2b, /* initials */ + ASN_DNQUALIFIER = 0x2e, /* dnQualifier */ +#endif /* WOLFSSL_CERT_NAME_ALL */ + + + ASN_CONTENT_TYPE = 0x97, /* not actual OID (see attrPkcs9ContentTypeOid) */ + ASN_EMAIL_NAME = 0x98, /* not actual OID (see attrEmailOid) */ + ASN_CUSTOM_NAME = 0x99, /* not actual OID (see CertOidField) */ + + /* pilot attribute types + * OID values of 0.9.2342.19200300.100.1.* */ + ASN_FAVOURITE_DRINK = 0x13, /* favouriteDrink */ + ASN_RFC822_MAILBOX = 0x14, /* rfc822Mailbox */ + ASN_DOMAIN_COMPONENT = 0x19 /* DC */ +}; + +/* This is the size of the smallest possible PEM header and footer */ +extern const int pem_struct_min_sz; + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) +typedef struct WOLFSSL_ObjectInfo { + int nid; + int id; + word32 type; + const char* sName; + const char* lName; +} WOLFSSL_ObjectInfo; +extern const size_t wolfssl_object_info_sz; +extern const WOLFSSL_ObjectInfo wolfssl_object_info[]; +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + +/* DN Tag Strings */ +#define WOLFSSL_COMMON_NAME "/CN=" +#define WOLFSSL_LN_COMMON_NAME "/commonName=" +#define WOLFSSL_SUR_NAME "/SN=" +#ifdef WOLFSSL_CERT_NAME_ALL + #define WOLFSSL_NAME "/N=" + #define WOLFSSL_INITIALS "/initials=" + #define WOLFSSL_GIVEN_NAME "/GN=" + #define WOLFSSL_DNQUALIFIER "/dnQualifier=" +#endif /* WOLFSSL_CERT_NAME_ALL */ +#define WOLFSSL_SERIAL_NUMBER "/serialNumber=" +#define WOLFSSL_COUNTRY_NAME "/C=" +#define WOLFSSL_LN_COUNTRY_NAME "/countryName=" +#define WOLFSSL_LOCALITY_NAME "/L=" +#define WOLFSSL_LN_LOCALITY_NAME "/localityName=" +#define WOLFSSL_STATE_NAME "/ST=" +#define WOLFSSL_LN_STATE_NAME "/stateOrProvinceName=" +#define WOLFSSL_STREET_ADDR_NAME "/street=" +#define WOLFSSL_LN_STREET_ADDR_NAME "/streetAddress=" +#define WOLFSSL_POSTAL_NAME "/postalCode=" +#define WOLFSSL_ORG_NAME "/O=" +#define WOLFSSL_LN_ORG_NAME "/organizationName=" +#define WOLFSSL_ORGUNIT_NAME "/OU=" +#define WOLFSSL_LN_ORGUNIT_NAME "/organizationalUnitName=" +#define WOLFSSL_DOMAIN_COMPONENT "/DC=" +#define WOLFSSL_LN_DOMAIN_COMPONENT "/domainComponent=" +#define WOLFSSL_BUS_CAT "/businessCategory=" +#define WOLFSSL_JOI_C "/jurisdictionC=" +#define WOLFSSL_JOI_ST "/jurisdictionST=" +#define WOLFSSL_EMAIL_ADDR "/emailAddress=" + +#define WOLFSSL_USER_ID "/UID=" +#define WOLFSSL_DOMAIN_COMPONENT "/DC=" +#define WOLFSSL_RFC822_MAILBOX "/rfc822Mailbox=" +#define WOLFSSL_FAVOURITE_DRINK "/favouriteDrink=" +#define WOLFSSL_CONTENT_TYPE "/contentType=" + +#if defined(WOLFSSL_APACHE_HTTPD) + /* otherName strings */ + #define WOLFSSL_SN_MS_UPN "msUPN" + #define WOLFSSL_LN_MS_UPN "Microsoft User Principal Name" + #define WOLFSSL_MS_UPN_SUM UPN_OID + #define WOLFSSL_SN_DNS_SRV "id-on-dnsSRV" + #define WOLFSSL_LN_DNS_SRV "SRVName" + #define WOLFSSL_DNS_SRV_SUM DNS_SRV_OID + /* TLS features extension strings */ + #define WOLFSSL_SN_TLS_FEATURE "tlsfeature" + #define WOLFSSL_LN_TLS_FEATURE "TLS Feature" + #define WOLFSSL_TLS_FEATURE_SUM TLS_FEATURE_OID +#endif + +/* Maximum number of allowed subject alternative names in a certificate. + * Any certificate containing more than this number of subject + * alternative names will cause an error when attempting to parse. */ +#ifndef WOLFSSL_MAX_ALT_NAMES +#define WOLFSSL_MAX_ALT_NAMES 1024 +#endif + +/* Maximum number of allowed name constraints in a certificate. + * Any certificate containing more than this number of name constraints + * will cause an error when attempting to parse. */ +#ifndef WOLFSSL_MAX_NAME_CONSTRAINTS +#define WOLFSSL_MAX_NAME_CONSTRAINTS 128 +#endif + +#define WC_NID_undef 0 + +/* Setup for WC_MAX_RSA_BITS needs to be here, rather than rsa.h, because + * FIPS headers don't have it. And it needs to be here, rather than internal.h, + * so that setup occurs even in cryptonly builds. + */ +#ifndef NO_RSA + #ifndef WC_MAX_RSA_BITS + #ifdef USE_FAST_MATH + /* FP implementation support numbers up to FP_MAX_BITS / 2 bits. */ + #define WC_MAX_RSA_BITS (FP_MAX_BITS / 2) + #elif defined(WOLFSSL_SP_MATH_ALL) || defined(WOLFSSL_SP_MATH) + /* SP implementation supports numbers of SP_INT_BITS bits. */ + #define WC_MAX_RSA_BITS (((SP_INT_BITS + 7) / 8) * 8) + #else + /* Integer maths is dynamic but we only go up to 4096 bits. */ + #define WC_MAX_RSA_BITS 4096 + #endif + #endif + #if (WC_MAX_RSA_BITS % 8) + #error RSA maximum bit size must be multiple of 8 + #endif +#endif + +#if defined(HAVE_FALCON) || defined(HAVE_DILITHIUM) + #define WC_MAX_CERT_VERIFY_SZ 6000 /* For Dilithium */ +#elif defined(WOLFSSL_CERT_EXT) + #define WC_MAX_CERT_VERIFY_SZ 2048 /* For larger extensions */ +#elif !defined(NO_RSA) && defined(WC_MAX_RSA_BITS) + #define WC_MAX_CERT_VERIFY_SZ (WC_MAX_RSA_BITS / 8) /* max RSA bytes */ +#elif defined(HAVE_ECC) + #define WC_MAX_CERT_VERIFY_SZ ECC_MAX_SIG_SIZE /* max ECC */ +#elif defined(HAVE_ED448) + #define WC_MAX_CERT_VERIFY_SZ ED448_SIG_SIZE /* max Ed448 */ +#elif defined(HAVE_ED25519) + #define WC_MAX_CERT_VERIFY_SZ ED25519_SIG_SIZE /* max Ed25519 */ +#else + #define WC_MAX_CERT_VERIFY_SZ 1024 /* max default */ +#endif + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) +/* short names */ +#define WC_SN_md4 "MD4" +#define WC_SN_md5 "MD5" +#define WC_SN_sha1 "SHA1" +#define WC_SN_sha224 "SHA224" +#define WC_SN_sha256 "SHA256" +#define WC_SN_sha384 "SHA384" +#define WC_SN_sha512 "SHA512" +#define WC_SN_sha512_224 "SHA512-224" +#define WC_SN_sha512_256 "SHA512-256" +#define WC_SN_sha3_224 "SHA3-224" +#define WC_SN_sha3_256 "SHA3-256" +#define WC_SN_sha3_384 "SHA3-384" +#define WC_SN_sha3_512 "SHA3-512" +#define WC_SN_shake128 "SHAKE128" +#define WC_SN_shake256 "SHAKE256" +#define WC_SN_blake2s256 "BLAKE2s256" +#define WC_SN_blake2s512 "BLAKE2s512" +#define WC_SN_blake2b512 "BLAKE2b512" +#define WC_SN_sm3 "SM3" + +/* NIDs */ +#define WC_NID_netscape_cert_type 71 +#define WC_NID_des 66 +#define WC_NID_des3 67 +#define WC_NID_sha256 672 +#define WC_NID_sha384 673 +#define WC_NID_sha512 674 +#define WC_NID_sha512_224 1094 +#define WC_NID_sha512_256 1095 +#define WC_NID_pkcs7_signed 22 +#define WC_NID_pkcs7_enveloped 23 +#define WC_NID_pkcs7_signedAndEnveloped 24 +#define WC_NID_pkcs9_emailAddress 48 +#define WC_NID_pkcs9_unstructuredName 49 +#define WC_NID_pkcs9_contentType 50 /* 1.2.840.113549.1.9.3 */ +#define WC_NID_pkcs9_challengePassword 54 +#define WC_NID_hw_name_oid 73 +#define WC_NID_id_pkix_OCSP_basic 74 +#define WC_NID_any_policy 75 +#define WC_NID_anyExtendedKeyUsage 76 +#define WC_NID_givenName 100 /* 2.5.4.42 */ +#define WC_NID_initials 101 /* 2.5.4.43 */ +#define WC_NID_title 106 +#define WC_NID_description 107 +#define WC_NID_basic_constraints BASIC_CA_OID +#define WC_NID_key_usage KEY_USAGE_OID /* 2.5.29.15 */ +#define WC_NID_ext_key_usage EXT_KEY_USAGE_OID /* 2.5.29.37 */ +#define WC_NID_subject_key_identifier SUBJ_KEY_OID +#define WC_NID_authority_key_identifier AUTH_KEY_OID +#define WC_NID_private_key_usage_period PRIV_KEY_USAGE_PERIOD_OID +#define WC_NID_subject_alt_name ALT_NAMES_OID +#define WC_NID_issuer_alt_name ISSUE_ALT_NAMES_OID +#define WC_NID_info_access AUTH_INFO_OID +#define WC_NID_sinfo_access SUBJ_INFO_ACC_OID /* id-pe 11 */ +#define WC_NID_name_constraints NAME_CONS_OID /* 2.5.29.30 */ +#define WC_NID_crl_distribution_points CRL_DIST_OID /* 2.5.29.31 */ +#define WC_NID_certificate_policies CERT_POLICY_OID +#define WC_NID_policy_mappings POLICY_MAP_OID +#define WC_NID_policy_constraints POLICY_CONST_OID +#define WC_NID_inhibit_any_policy INHIBIT_ANY_OID /* 2.5.29.54 */ +#define WC_NID_tlsfeature TLS_FEATURE_OID /* id-pe 24 */ +#define WC_NID_buildingName 1494 + +#define WC_NID_dnQualifier 174 /* 2.5.4.46 */ +#define WC_NID_commonName 14 /* CN Changed to not conflict + * with PBE_SHA1_DES3 */ +#define WC_NID_name 173 /* N , OID = 2.5.4.41 */ +#define WC_NID_surname 0x04 /* SN */ +#define WC_NID_serialNumber 0x05 /* serialNumber */ +#define WC_NID_countryName 0x06 /* C */ +#define WC_NID_localityName 0x07 /* L */ +#define WC_NID_stateOrProvinceName 0x08 /* ST */ +#define WC_NID_streetAddress ASN_STREET_ADDR /* street */ +#define WC_NID_organizationName 0x0a /* O */ +#define WC_NID_organizationalUnitName 0x0b /* OU */ +#define WC_NID_jurisdictionCountryName 0xc +#define WC_NID_jurisdictionStateOrProvinceName 0xd +#define WC_NID_businessCategory ASN_BUS_CAT +#define WC_NID_domainComponent ASN_DOMAIN_COMPONENT +#define WC_NID_postalCode ASN_POSTAL_CODE /* postalCode */ +#define WC_NID_rfc822Mailbox 460 +#define WC_NID_favouriteDrink 462 +#define WC_NID_userId 458 +#define WC_NID_registeredAddress 870 +#define WC_NID_emailAddress 0x30 /* emailAddress */ +#define WC_NID_id_on_dnsSRV 82 /* 1.3.6.1.5.5.7.8.7 */ +#define WC_NID_ms_upn UPN_OID /* 1.3.6.1.4.1.311.20.2.3 */ + +#define WC_NID_X9_62_prime_field 406 /* 1.2.840.10045.1.1 */ + +#define WC_NID_id_GostR3410_2001 811 +#define WC_NID_id_GostR3410_2012_256 979 +#define WC_NID_id_GostR3410_2012_512 980 + +#ifndef OPENSSL_COEXIST + +#define NID_undef WC_NID_undef +#define NID_netscape_cert_type WC_NID_netscape_cert_type +#define NID_des WC_NID_des +#define NID_des3 WC_NID_des3 +#define NID_sha256 WC_NID_sha256 +#define NID_sha384 WC_NID_sha384 +#define NID_sha512 WC_NID_sha512 +#define NID_sha512_224 WC_NID_sha512_224 +#define NID_sha512_256 WC_NID_sha512_256 +#define NID_pkcs7_signed WC_NID_pkcs7_signed +#define NID_pkcs7_enveloped WC_NID_pkcs7_enveloped +#define NID_pkcs7_signedAndEnveloped WC_NID_pkcs7_signedAndEnveloped +#define NID_pkcs9_unstructuredName WC_NID_pkcs9_unstructuredName +#define NID_pkcs9_contentType WC_NID_pkcs9_contentType +#define NID_pkcs9_challengePassword WC_NID_pkcs9_challengePassword +#define NID_hw_name_oid WC_NID_hw_name_oid +#define NID_id_pkix_OCSP_basic WC_NID_id_pkix_OCSP_basic +#define NID_any_policy WC_NID_any_policy +#define NID_anyExtendedKeyUsage WC_NID_anyExtendedKeyUsage +#define NID_givenName WC_NID_givenName +#define NID_initials WC_NID_initials +#define NID_title WC_NID_title +#define NID_description WC_NID_description +#define NID_basic_constraints WC_NID_basic_constraints +#define NID_key_usage WC_NID_key_usage +#define NID_ext_key_usage WC_NID_ext_key_usage +#define NID_subject_key_identifier WC_NID_subject_key_identifier +#define NID_authority_key_identifier WC_NID_authority_key_identifier +#define NID_private_key_usage_period WC_NID_private_key_usage_period +#define NID_subject_alt_name WC_NID_subject_alt_name +#define NID_issuer_alt_name WC_NID_issuer_alt_name +#define NID_info_access WC_NID_info_access +#define NID_sinfo_access WC_NID_sinfo_access +#define NID_name_constraints WC_NID_name_constraints +#define NID_crl_distribution_points WC_NID_crl_distribution_points +#define NID_certificate_policies WC_NID_certificate_policies +#define NID_policy_mappings WC_NID_policy_mappings +#define NID_policy_constraints WC_NID_policy_constraints +#define NID_inhibit_any_policy WC_NID_inhibit_any_policy +#define NID_tlsfeature WC_NID_tlsfeature +#define NID_buildingName WC_NID_buildingName + +#define NID_dnQualifier WC_NID_dnQualifier +#define NID_commonName WC_NID_commonName +#define NID_name WC_NID_name +#define NID_surname WC_NID_surname +#define NID_serialNumber WC_NID_serialNumber +#define NID_countryName WC_NID_countryName +#define NID_localityName WC_NID_localityName +#define NID_stateOrProvinceName WC_NID_stateOrProvinceName +#define NID_streetAddress WC_NID_streetAddress +#define NID_organizationName WC_NID_organizationName +#define NID_organizationalUnitName WC_NID_organizationalUnitName +#define NID_jurisdictionCountryName WC_NID_jurisdictionCountryName +#define NID_jurisdictionStateOrProvinceName WC_NID_jurisdictionStateOrProvinceName +#define NID_businessCategory WC_NID_businessCategory +#define NID_domainComponent WC_NID_domainComponent +#define NID_postalCode WC_NID_postalCode +#define NID_rfc822Mailbox WC_NID_rfc822Mailbox +#define NID_favouriteDrink WC_NID_favouriteDrink +#define NID_userId WC_NID_userId +#define NID_emailAddress WC_NID_emailAddress +#define NID_id_on_dnsSRV WC_NID_id_on_dnsSRV +#define NID_ms_upn WC_NID_ms_upn + +#define NID_X9_62_prime_field WC_NID_X9_62_prime_field + +#define NID_id_GostR3410_2001 WC_NID_id_GostR3410_2001 +#define NID_id_GostR3410_2012_256 WC_NID_id_GostR3410_2012_256 +#define NID_id_GostR3410_2012_512 WC_NID_id_GostR3410_2012_512 + +#endif /* !OPENSSL_COEXIST */ + +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + +enum ECC_TYPES +{ + ECC_PREFIX_0 = 160, + ECC_PREFIX_1 = 161 +}; + +#ifdef WOLFSSL_CERT_PIV + enum PIV_Tags { + ASN_PIV_CERT = 0x0A, + ASN_PIV_NONCE = 0x0B, + ASN_PIV_SIGNED_NONCE = 0x0C, + + ASN_PIV_TAG_CERT = 0x70, + ASN_PIV_TAG_CERT_INFO = 0x71, + ASN_PIV_TAG_MSCUID = 0x72, + ASN_PIV_TAG_ERR_DET = 0xFE, + + /* certificate info masks */ + ASN_PIV_CERT_INFO_COMPRESSED = 0x03, + ASN_PIV_CERT_INFO_ISX509 = 0x04, + /* GZIP is 0x01 */ + ASN_PIV_CERT_INFO_GZIP = 0x01, + }; +#endif /* WOLFSSL_CERT_PIV */ + + +#define ASN_JOI_PREFIX_SZ 10 +#define ASN_JOI_PREFIX "\x2b\x06\x01\x04\x01\x82\x37\x3c\x02\x01" +#define ASN_JOI_C 0x3 +#define ASN_JOI_ST 0x2 + +#ifndef WC_ASN_NAME_MAX + #if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) || \ + defined(WOLFSSL_CERT_EXT) + #ifdef WOLFSSL_MULTI_ATTRIB + #define WC_ASN_NAME_MAX 360 + #else + #define WC_ASN_NAME_MAX 330 + #endif + #else + #ifdef WOLFSSL_MULTI_ATTRIB + #define WC_ASN_NAME_MAX 330 + #else + #define WC_ASN_NAME_MAX 256 + #endif + #endif +#endif + +/* Maximum OID dotted form size. */ +#define ASN1_OID_DOTTED_MAX_SZ 16 + +#ifndef WOLFSSL_ASN_MAX_LENGTH_SZ + #define WOLFSSL_ASN_MAX_LENGTH_SZ 5 /* 1 byte length + 4 bytes of number */ +#endif + +enum Misc_ASN { + ASN_BOOL_SIZE = 2, /* including type */ + ASN_ECC_HEADER_SZ = 2, /* String type + 1 byte len */ + ASN_ECC_CONTEXT_SZ = 2, /* Content specific type + 1 byte len */ +#if defined(WOLFSSL_SM2) && defined(WOLFSSL_SM3) + KEYID_SIZE = WC_SM3_DIGEST_SIZE, +#elif defined(NO_SHA) || (!defined(NO_SHA256) && defined(WC_ASN_HASH_SHA256)) + KEYID_SIZE = WC_SHA256_DIGEST_SIZE, +#else + KEYID_SIZE = WC_SHA_DIGEST_SIZE, +#endif + RSA_INTS = 2 /* RSA ints in private key */ +#ifndef WOLFSSL_RSA_PUBLIC_ONLY + + 3 +#if defined(WOLFSSL_KEY_GEN) || defined(OPENSSL_EXTRA) || !defined(RSA_LOW_MEM) + + 3 +#endif +#endif + , + DSA_PARAM_INTS = 3, /* DSA parameter ints */ + RSA_PUB_INTS = 2, /* RSA ints in public key */ + MIN_DATE_SIZE = 12, + MAX_DATE_SIZE = 32, + ASN_GEN_TIME_SZ = 15, /* 7 numbers * 2 + Zulu tag */ + +#ifdef WOLFSSL_CERT_GEN + #ifdef WOLFSSL_CERT_REQ + /* Max encoded cert req attributes length */ + MAX_ATTRIB_SZ = MAX_SEQ_SZ * 4 + (11 + MAX_SEQ_SZ) * 3 + + MAX_PRSTR_SZ * 2 + CTC_NAME_SIZE * 2, + /* 11 is the OID size */ + #endif + #if defined(WOLFSSL_ALT_NAMES) || defined(WOLFSSL_CERT_EXT) + MAX_EXTENSIONS_SZ = 1 + MAX_LENGTH_SZ + CTC_MAX_ALT_SIZE, + #else + MAX_EXTENSIONS_SZ = 1 + MAX_LENGTH_SZ + MAX_CA_SZ, + #endif + /* Max total extensions, id + len + others */ +#endif +#ifndef MAX_OID_SZ + MAX_OID_SZ = 32, /* Max DER length of OID*/ +#endif +#if defined(WOLFSSL_CERT_EXT) || defined(OPENSSL_EXTRA) || \ + defined(HAVE_PKCS7) || defined(OPENSSL_EXTRA_X509_SMALL) || \ + defined(HAVE_OID_DECODING) || defined(HAVE_OID_ENCODING) + MAX_OID_STRING_SZ = 64, /* Max string length representation of OID*/ +#endif +#ifdef WOLFSSL_CERT_EXT + MAX_KID_SZ = 45, /* Max encoded KID length (SHA-256 case) */ + MAX_KEYUSAGE_SZ = 18, /* Max encoded Key Usage length */ + MAX_EXTKEYUSAGE_SZ = 12 + (6 * (8 + 2)) + + CTC_MAX_EKU_OID_SZ, /* Max encoded ExtKeyUsage + (SEQ/LEN + OBJID + OCTSTR/LEN + SEQ + + (6 * (SEQ + OID))) */ +#ifndef IGNORE_NETSCAPE_CERT_TYPE + MAX_NSCERTTYPE_SZ = MAX_SEQ_SZ + 17, /* SEQ + OID + OCTET STR + + * NS BIT STR */ +#endif + MAX_CERTPOL_NB = CTC_MAX_CERTPOL_NB,/* Max number of Cert Policy */ + MAX_CERTPOL_SZ = CTC_MAX_CERTPOL_SZ, +#endif + OCSP_NONCE_EXT_SZ = 35, /* OCSP Nonce Extension size */ + MAX_OCSP_EXT_SZ = 58, /* Max OCSP Extension length */ + MAX_OCSP_NONCE_SZ = 16, /* OCSP Nonce size */ + TRAILING_ZERO = 1, /* Used for size of zero pad */ + ASN_TAG_SZ = 1, /* single byte ASN.1 tag */ + ASN_INDEF_END_SZ = 2, /* 0x00 0x00 at end of indef */ + MIN_VERSION_SZ = 3, /* Min bytes needed for GetMyVersion */ + MAX_X509_VERSION = 3, /* Max X509 version allowed */ + MIN_X509_VERSION = 0, /* Min X509 version allowed */ + WOLFSSL_X509_V1 = 0, + WOLFSSL_X509_V2 = 1, + WOLFSSL_X509_V3 = 2, +#if defined(OPENSSL_ALL) || defined(WOLFSSL_MYSQL_COMPATIBLE) || \ + defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) || \ + defined(OPENSSL_EXTRA) || defined(HAVE_PKCS7) + MAX_TIME_STRING_SZ = 25, /* Max length of formatted time string */ +#endif + + PKCS5_SALT_SZ = 8, + PKCS5V2_SALT_SZ = 16, + + PEM_LINE_SZ = 64, /* Length of Base64 encoded line, not including new line */ + PEM_LINE_LEN = PEM_LINE_SZ + 12, /* PEM line max + fudge */ + + COUNTRY_CODE_LEN = 2 /* RFC 3739 */ +}; + +#ifndef WC_MAX_NAME_ENTRIES + /* entries added to x509 name struct */ + #ifdef OPENSSL_EXTRA + #define WC_MAX_NAME_ENTRIES 16 + #else + #define WC_MAX_NAME_ENTRIES 14 + #endif +#endif +#define MAX_NAME_ENTRIES WC_MAX_NAME_ENTRIES + + +enum Oid_Types { + oidHashType = 0, + oidSigType = 1, + oidKeyType = 2, + oidCurveType = 3, + oidBlkType = 4, + oidOcspType = 5, + oidCertExtType = 6, + oidCertAuthInfoType = 7, + oidCertPolicyType = 8, + oidCertAltNameType = 9, + oidCertKeyUseType = 10, + oidKdfType = 11, + oidKeyWrapType = 12, + oidCmsKeyAgreeType = 13, + oidPBEType = 14, + oidHmacType = 15, + oidCompressType = 16, + oidCertNameType = 17, + oidTlsExtType = 18, + oidCrlExtType = 19, + oidCsrAttrType = 20, +#ifdef WOLFSSL_SUBJ_DIR_ATTR + oidSubjDirAttrType = 21, +#endif + oidIgnoreType +}; + + +enum VerifyType { + NO_VERIFY = 0, + VERIFY = 1, + VERIFY_CRL = 2, + VERIFY_OCSP = 3, + VERIFY_NAME = 4, + VERIFY_SKIP_DATE = 5, + VERIFY_OCSP_CERT = 6 +}; + +#ifdef WOLFSSL_CERT_EXT +enum KeyIdType { + SKID_TYPE = 0, + AKID_TYPE = 1 +}; +#endif + +/* Key usage extension bits (based on RFC 5280) */ +#define KEYUSE_DIGITAL_SIG 0x0080 +#define KEYUSE_CONTENT_COMMIT 0x0040 +#define KEYUSE_KEY_ENCIPHER 0x0020 +#define KEYUSE_DATA_ENCIPHER 0x0010 +#define KEYUSE_KEY_AGREE 0x0008 +#define KEYUSE_KEY_CERT_SIGN 0x0004 +#define KEYUSE_CRL_SIGN 0x0002 +#define KEYUSE_ENCIPHER_ONLY 0x0001 +#define KEYUSE_DECIPHER_ONLY 0x8000 + +/* Extended Key Usage bits (internal mapping only) */ +#define EXTKEYUSE_USER 0x80 +#define EXTKEYUSE_OCSP_SIGN 0x40 +#define EXTKEYUSE_TIMESTAMP 0x20 +#define EXTKEYUSE_EMAILPROT 0x10 +#define EXTKEYUSE_CODESIGN 0x08 +#define EXTKEYUSE_CLIENT_AUTH 0x04 +#define EXTKEYUSE_SERVER_AUTH 0x02 +#define EXTKEYUSE_ANY 0x01 +#ifdef WOLFSSL_WOLFSSH + #define EXTKEYUSE_SSH_CLIENT_AUTH 0x01 + #define EXTKEYUSE_SSH_MSCL 0x02 + #define EXTKEYUSE_SSH_KP_CLIENT_AUTH 0x04 +#endif /* WOLFSSL_WOLFSSH */ + +#define WC_NS_SSL_CLIENT 0x80 +#define WC_NS_SSL_SERVER 0x40 +#define WC_NS_SMIME 0x20 +#define WC_NS_OBJSIGN 0x10 +#define WC_NS_SSL_CA 0x04 +#define WC_NS_SMIME_CA 0x02 +#define WC_NS_OBJSIGN_CA 0x01 + + +#if defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA) || \ + defined(WOLFSSL_WPAS_SMALL) || defined(WOLFSSL_IP_ALT_NAME) + #ifndef WOLFSSL_MAX_IPSTR + #define WOLFSSL_MAX_IPSTR 46 /* max ip size IPv4 mapped IPv6 */ + #endif + #define WOLFSSL_IP4_ADDR_LEN 4 + #define WOLFSSL_IP6_ADDR_LEN 16 +#endif /* OPENSSL_ALL || WOLFSSL_IP_ALT_NAME */ + +typedef struct DNS_entry DNS_entry; + +struct DNS_entry { + DNS_entry* next; /* next on DNS list */ + int type; /* i.e. ASN_DNS_TYPE */ + int len; /* actual DNS len */ + char* name; /* actual DNS name */ +#ifdef WOLFSSL_IP_ALT_NAME + char* ipString; /* human readable form of IP address */ +#endif +#ifdef WOLFSSL_RID_ALT_NAME + char* ridString; /* human readable form of registeredID */ +#endif + +#ifdef WOLFSSL_FPKI + int oidSum; /* provide oid sum for verification */ +#endif +}; + +#ifdef WOLFSSL_FPKI + /* RFC4122 i.e urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6 */ + #define DEFAULT_UUID_SZ 45 +#endif + +typedef struct Base_entry Base_entry; + +struct Base_entry { + Base_entry* next; /* next on name base list */ + char* name; /* actual name base */ + int nameSz; /* name length */ + byte type; /* Name base type (DNS or RFC822) */ +}; + + +enum SignatureState { + SIG_STATE_BEGIN, + SIG_STATE_HASH, + SIG_STATE_KEY, + SIG_STATE_DO, + SIG_STATE_CHECK +}; + + +#ifdef HAVE_PK_CALLBACKS +#ifdef HAVE_ECC + typedef int (*wc_CallbackEccVerify)( + const unsigned char* sig, unsigned int sigSz, + const unsigned char* hash, unsigned int hashSz, + const unsigned char* keyDer, unsigned int keySz, + int* result, void* ctx); +#endif +#ifndef NO_RSA + typedef int (*wc_CallbackRsaVerify)( + unsigned char* sig, unsigned int sigSz, + unsigned char** out, + const unsigned char* keyDer, unsigned int keySz, + void* ctx); +#endif +#endif /* HAVE_PK_CALLBACKS */ + +#if defined(WOLFSSL_RENESAS_TSIP_TLS) || defined(WOLFSSL_RENESAS_FSPSM_TLS) ||\ + defined(HAVE_PK_CALLBACKS) +typedef struct tagCertAttribute { + byte verifyByTSIP_SCE; + word32 certBegin; + word32 pubkey_n_start; + word32 pubkey_n_len; + word32 pubkey_e_start; + word32 pubkey_e_len; + int curve_id; + const byte* cert; + word32 certSz; + const byte* keyIndex; + } CertAttribute; +#endif + +struct SignatureCtx { + void* heap; + #ifdef WOLFSSL_NO_MALLOC + byte digest[WC_MAX_DIGEST_SIZE]; + #else + byte* digest; + #endif +#ifndef NO_RSA + byte* out; +#endif +#if !defined(NO_RSA) || !defined(NO_DSA) + #ifdef WOLFSSL_NO_MALLOC + byte sigCpy[MAX_SIG_SZ]; + #else + byte* sigCpy; + #endif +#endif +#if defined(HAVE_ECC) || defined(HAVE_ED25519) || defined(HAVE_ED448) || \ + !defined(NO_DSA) || defined(HAVE_DILITHIUM) || defined(HAVE_FALCON) || \ + defined(HAVE_SPHINCS) + int verify; +#endif + union { + #ifndef NO_RSA + #ifdef WOLFSSL_NO_MALLOC + struct RsaKey rsa[1]; + #else + struct RsaKey* rsa; + #endif + #endif + #ifndef NO_DSA + #ifdef WOLFSSL_NO_MALLOC + struct DsaKey dsa[1]; + #else + struct DsaKey* dsa; + #endif + #endif + #ifdef HAVE_ECC + #ifdef WOLFSSL_NO_MALLOC + struct ecc_key ecc[1]; + #else + struct ecc_key* ecc; + #endif + #endif + #ifdef HAVE_ED25519 + #ifdef WOLFSSL_NO_MALLOC + struct ed25519_key ed25519[1]; + #else + struct ed25519_key* ed25519; + #endif + #endif + #ifdef HAVE_ED448 + #ifdef WOLFSSL_NO_MALLOC + struct ed448_key ed448[1]; + #else + struct ed448_key* ed448; + #endif + #endif + #ifdef HAVE_FALCON + #ifdef WOLFSSL_NO_MALLOC + struct falcon_key falcon[1]; + #else + struct falcon_key* falcon; + #endif + #endif + #ifdef HAVE_DILITHIUM + #ifdef WOLFSSL_NO_MALLOC + struct dilithium_key dilithium[1]; + #else + struct dilithium_key* dilithium; + #endif + #endif + #ifdef HAVE_SPHINCS + #ifdef WOLFSSL_NO_MALLOC + struct sphincs_key sphincs[1]; + #else + struct sphincs_key* sphincs; + #endif + #endif + #ifndef WOLFSSL_NO_MALLOC + void* ptr; + #endif + } key; + int devId; + int state; + int typeH; + int digestSz; + word32 keyOID; +#ifdef WOLFSSL_ASYNC_CRYPT + WC_ASYNC_DEV* asyncDev; + void* asyncCtx; +#endif + +#ifdef HAVE_PK_CALLBACKS +#ifdef HAVE_ECC + wc_CallbackEccVerify pkCbEcc; + void* pkCtxEcc; +#endif +#ifndef NO_RSA + wc_CallbackRsaVerify pkCbRsa; + void* pkCtxRsa; +#endif +#endif /* HAVE_PK_CALLBACKS */ +#ifndef NO_RSA +#if defined(WOLFSSL_RENESAS_TSIP_TLS) || defined(WOLFSSL_RENESAS_FSPSM_TLS) ||\ + defined(HAVE_PK_CALLBACKS) + CertAttribute CertAtt; +#endif +#ifdef WC_RSA_PSS + enum wc_HashType hash; + int mgf; + int saltLen; +#endif +#endif +}; + +#define DOMAIN_COMPONENT_MAX 10 + +struct DecodedName { + char* fullName; + int fullNameLen; + int entryCount; + int cnIdx; + int cnLen; + int cnNid; + int snIdx; + int snLen; + int snNid; + int cIdx; + int cLen; + int cNid; + int lIdx; + int lLen; + int lNid; + int stIdx; + int stLen; + int stNid; + int oIdx; + int oLen; + int oNid; + int ouIdx; + int ouLen; +#ifdef WOLFSSL_CERT_EXT + int bcIdx; + int bcLen; + int jcIdx; + int jcLen; + int jsIdx; + int jsLen; +#endif + int ouNid; + int emailIdx; + int emailLen; + int emailNid; + int uidIdx; + int uidLen; + int uidNid; + int serialIdx; + int serialLen; + int serialNid; + int dcIdx[DOMAIN_COMPONENT_MAX]; + int dcLen[DOMAIN_COMPONENT_MAX]; + int dcNum; + int dcMode; +}; + +/* ASN Encoded Name field */ +typedef struct EncodedName { + int nameLen; /* actual string value length */ + int totalLen; /* total encoded length */ + int type; /* type of name */ + int used; /* are we actually using this one */ + byte encoded[CTC_NAME_SIZE * 2]; /* encoding */ +} EncodedName; + +#ifndef WOLFSSL_MAX_PATH_LEN + /* RFC 5280 Section 6.1.2. "Initialization" - item (k) defines + * (k) max_path_length: this integer is initialized to "n", is + * decremented for each non-self-issued certificate in the path, + * and may be reduced to the value in the path length constraint + * field within the basic constraints extension of a CA + * certificate. + * + * wolfSSL has arbitrarily selected the value 127 for "n" in the above + * description. Users can modify the maximum path length by setting + * WOLFSSL_MAX_PATH_LEN to a preferred value at build time + */ + #define WOLFSSL_MAX_PATH_LEN 127 +#endif + +typedef struct DecodedName DecodedName; +typedef struct DecodedCert DecodedCert; +typedef struct Signer Signer; +#ifdef WOLFSSL_TRUST_PEER_CERT +typedef struct TrustedPeerCert TrustedPeerCert; +#endif /* WOLFSSL_TRUST_PEER_CERT */ +typedef struct SignatureCtx SignatureCtx; + +#ifdef WC_ASN_UNKNOWN_EXT_CB +typedef int (*wc_UnknownExtCallback)(const word16* oid, word32 oidSz, int crit, + const unsigned char* der, word32 derSz); +typedef int (*wc_UnknownExtCallbackEx)(const word16* oid, word32 oidSz, + int crit, const unsigned char* der, + word32 derSz, void *ctx); +#endif + +struct DecodedCert { + const byte* publicKey; + word32 pubKeySize; + int pubKeyStored; + word32 certBegin; /* offset to start of cert */ + word32 sigIndex; /* offset to start of signature */ + word32 sigLength; /* length of signature */ + word32 signatureOID; /* sum of algorithm object id */ + word32 keyOID; /* sum of key algo object id */ +#ifdef WC_RSA_PSS + word32 sigParamsIndex; /* start of signature parameters */ + word32 sigParamsLength; /* length of signature parameters */ +#endif + int version; /* cert version, 1 or 3 */ + DNS_entry* altNames; /* alt names list of dns entries */ +#ifndef IGNORE_NAME_CONSTRAINTS + DNS_entry* altEmailNames; /* alt names list of RFC822 entries */ + DNS_entry* altDirNames; /* alt names list of DIR entries */ + Base_entry* permittedNames; /* Permitted name bases */ + Base_entry* excludedNames; /* Excluded name bases */ +#endif /* IGNORE_NAME_CONSTRAINTS */ + byte subjectHash[KEYID_SIZE]; /* hash of all Names */ + byte issuerHash[KEYID_SIZE]; /* hash of all Names */ +#ifdef HAVE_OCSP + byte subjectKeyHash[KEYID_SIZE]; /* hash of the public Key */ + byte issuerKeyHash[KEYID_SIZE]; /* hash of the public Key */ +#endif /* HAVE_OCSP */ + const byte* signature; /* not owned, points into raw cert */ + char* subjectCN; /* CommonName */ + int subjectCNLen; /* CommonName Length */ + char subjectCNEnc; /* CommonName Encoding */ + char issuer[WC_ASN_NAME_MAX]; /* full name including common name */ + char subject[WC_ASN_NAME_MAX];/* full name including common name */ + int verify; /* Default to yes, but could be off */ + const byte* source; /* byte buffer holder cert, NOT owner */ + word32 srcIdx; /* current offset into buffer */ + word32 maxIdx; /* max offset based on init size */ + void* heap; /* for user memory overrides */ + byte serial[EXTERNAL_SERIAL_SIZE]; /* raw serial number */ + int serialSz; /* raw serial bytes stored */ + const byte* extensions; /* not owned, points into raw cert */ + int extensionsSz; /* length of cert extensions */ + word32 extensionsIdx; /* if want to go back and parse later */ + const byte* extAuthInfo; /* Authority Information Access URI */ + int extAuthInfoSz; /* length of the URI */ +#ifdef WOLFSSL_ASN_CA_ISSUER + const byte* extAuthInfoCaIssuer; /* Authority Info Access caIssuer URI */ + int extAuthInfoCaIssuerSz; /* length of the caIssuer URI */ +#endif + const byte* extCrlInfoRaw; /* Entire CRL Distribution Points + * Extension. This is useful when + * re-generating the DER. */ + int extCrlInfoRawSz; /* length of the extension */ + const byte* extCrlInfo; /* CRL Distribution Points */ + int extCrlInfoSz; /* length of the URI */ + byte extSubjKeyId[KEYID_SIZE]; /* Subject Key ID */ + word32 extSubjKeyIdSz; + byte extAuthKeyId[KEYID_SIZE]; /* Authority Key ID */ + word32 extAuthKeyIdSz; +#ifdef WOLFSSL_AKID_NAME + const byte* extAuthKeyIdIssuer; /* Authority Key ID authorityCertIssuer */ + word32 extAuthKeyIdIssuerSz; /* Authority Key ID authorityCertIssuer length */ + const byte* extAuthKeyIdIssuerSN; /* Authority Key ID authorityCertSerialNumber */ + word32 extAuthKeyIdIssuerSNSz; /* Authority Key ID authorityCertSerialNumber length */ +#endif + byte pathLength; /* CA basic constraint path length */ + byte maxPathLen; /* max_path_len see RFC 5280 section + * 6.1.2 "Initialization" - (k) for + * description of max_path_len */ + byte policyConstSkip; /* Policy Constraints skip certs value */ + word16 extKeyUsage; /* Key usage bitfield */ + byte extExtKeyUsage; /* Extended Key usage bitfield */ +#ifdef WOLFSSL_WOLFSSH + byte extExtKeyUsageSsh; /* Extended Key Usage bitfield for SSH */ +#endif /* WOLFSSL_WOLFSSH */ + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + const byte* extExtKeyUsageSrc; + word32 extExtKeyUsageSz; + word32 extExtKeyUsageCount; +#ifdef WOLFSSL_AKID_NAME + const byte* extRawAuthKeyIdSrc; + word32 extRawAuthKeyIdSz; +#endif + const byte* extAuthKeyIdSrc; + const byte* extSubjKeyIdSrc; +#endif +#ifdef OPENSSL_ALL + const byte* extSubjAltNameSrc; + word32 extSubjAltNameSz; +#endif +#ifdef WOLFSSL_SUBJ_DIR_ATTR + char countryOfCitizenship[COUNTRY_CODE_LEN+1]; /* ISO 3166 Country Code */ + #ifdef OPENSSL_ALL + const byte* extSubjDirAttrSrc; + word32 extSubjDirAttrSz; + #endif +#endif /* WOLFSSL_SUBJ_DIR_ATTR */ +#ifdef WOLFSSL_SUBJ_INFO_ACC + const byte* extSubjInfoAccCaRepo; + word32 extSubjInfoAccCaRepoSz; + #ifdef OPENSSL_ALL + const byte* extSubjInfoAccSrc; + word32 extSubjInfoAccSz; + #endif +#endif /* WOLFSSL_SUBJ_INFO_ACC */ + +#if defined(HAVE_ECC) || defined(HAVE_ED25519) || defined(HAVE_ED448) || \ + defined(HAVE_DILITHIUM) || defined(HAVE_FALCON) || defined(HAVE_SPHINCS) + word32 pkCurveOID; /* Public Key's curve OID */ + #ifdef WOLFSSL_CUSTOM_CURVES + int pkCurveSize; /* Public Key's curve size */ + #endif +#endif /* HAVE_ECC || HAVE_ED25519 || HAVE_ED448 || HAVE_DILITHIUM || + * HAVE_FALCON || HAVE_SPHINCS */ + const byte* beforeDate; + int beforeDateLen; + const byte* afterDate; + int afterDateLen; +#if defined(HAVE_PKCS7) || defined(WOLFSSL_CERT_EXT) + const byte* issuerRaw; /* pointer to issuer inside source */ + int issuerRawLen; +#endif +#if !defined(IGNORE_NAME_CONSTRAINTS) || defined(WOLFSSL_CERT_EXT) + const byte* subjectRaw; /* pointer to subject inside source */ + int subjectRawLen; +#endif +#if !defined(IGNORE_NAME_CONSTRAINTS) || \ + defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT) + char* subjectEmail; + int subjectEmailLen; +#endif +#if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT) + /* easy access to subject info for other sign */ + char* subjectSN; + int subjectSNLen; + char subjectSNEnc; +#ifdef WOLFSSL_CERT_NAME_ALL + char* subjectN; + int subjectNLen; + char subjectNEnc; + char* subjectI; + int subjectILen; + char subjectIEnc; + char* subjectGN; + int subjectGNLen; + char subjectGNEnc; + char* subjectDNQ; + int subjectDNQLen; + char subjectDNQEnc; +#endif /* WOLFSSL_CERT_NAME_ALL */ + char* subjectC; + int subjectCLen; + char subjectCEnc; + char* subjectL; + int subjectLLen; + char subjectLEnc; + char* subjectST; + int subjectSTLen; + char subjectSTEnc; + char* subjectO; + int subjectOLen; + char subjectOEnc; + char* subjectOU; + int subjectOULen; + char subjectOUEnc; + char* subjectSND; + int subjectSNDLen; + char subjectSNDEnc; + char* subjectUID; + int subjectUIDLen; + char subjectUIDEnc; + char* subjectStreet; + int subjectStreetLen; + char subjectStreetEnc; + char* subjectBC; + int subjectBCLen; + char subjectBCEnc; + char* subjectJC; + int subjectJCLen; + char subjectJCEnc; + char* subjectJS; + int subjectJSLen; + char subjectJSEnc; + char* subjectPC; + int subjectPCLen; + char subjectPCEnc; +#if defined(WOLFSSL_HAVE_ISSUER_NAMES) + char* issuerCN; + int issuerCNLen; + char issuerCNEnc; + char* issuerSN; + int issuerSNLen; + char issuerSNEnc; + char* issuerC; + int issuerCLen; + char issuerCEnc; + char* issuerL; + int issuerLLen; + char issuerLEnc; + char* issuerST; + int issuerSTLen; + char issuerSTEnc; + char* issuerO; + int issuerOLen; + char issuerOEnc; + char* issuerOU; + int issuerOULen; + char issuerOUEnc; + char* issuerSND; + int issuerSNDLen; + char issuerSNDEnc; + char* issuerEmail; + int issuerEmailLen; +#endif /* WOLFSSL_HAVE_ISSUER_NAMES */ +#endif /* WOLFSSL_CERT_GEN || WOLFSSL_CERT_EXT */ +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + /* WOLFSSL_X509_NAME structures (used void* to avoid including ssl.h) */ + void* issuerName; + void* subjectName; +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ +#ifdef WOLFSSL_SEP + int deviceTypeSz; + byte* deviceType; + int hwTypeSz; + byte* hwType; + int hwSerialNumSz; + byte* hwSerialNum; +#endif /* WOLFSSL_SEP */ +#ifdef WOLFSSL_CERT_EXT + char extCertPolicies[MAX_CERTPOL_NB][MAX_CERTPOL_SZ]; + int extCertPoliciesNb; +#endif /* WOLFSSL_CERT_EXT */ +#ifndef IGNORE_NETSCAPE_CERT_TYPE + byte nsCertType; +#endif + +#ifdef WOLFSSL_CERT_REQ + /* CSR attributes */ + char* contentType; /* Content Type */ + int contentTypeLen; + char* cPwd; /* Challenge Password */ + int cPwdLen; + char* sNum; /* Serial Number */ + int sNumLen; + char* dnQualifier; + int dnQualifierLen; + char* initials; + int initialsLen; + char* surname; + int surnameLen; + char* givenName; + int givenNameLen; + char* unstructuredName; + int unstructuredNameLen; +#endif /* WOLFSSL_CERT_REQ */ + + Signer* ca; +#ifndef NO_CERTS + SignatureCtx sigCtx; +#endif +#if defined(WOLFSSL_RENESAS_TSIP) || defined(WOLFSSL_RENESAS_FSPSM_TLS) + byte* sce_tsip_encRsaKeyIdx; +#endif +#ifdef WOLFSSL_MAXQ10XX_TLS + word32 publicKeyIndex; /* offset to start of public key */ +#endif + + int badDate; + int criticalExt; + + /* Option Bits */ + WC_BITFIELD subjectCNStored:1; /* have we saved a copy we own */ + WC_BITFIELD extSubjKeyIdSet:1; /* Set when the SKID was read from cert */ + WC_BITFIELD extAuthKeyIdSet:1; /* Set when the AKID was read from cert */ +#ifndef IGNORE_NAME_CONSTRAINTS + WC_BITFIELD extNameConstraintSet:1; +#endif + WC_BITFIELD isCA:1; /* CA basic constraint true */ + WC_BITFIELD pathLengthSet:1; /* CA basic const path length set */ + WC_BITFIELD weOwnAltNames:1; /* altNames haven't been given to copy */ + WC_BITFIELD extKeyUsageSet:1; + WC_BITFIELD extExtKeyUsageSet:1; /* Extended Key Usage set */ +#ifdef HAVE_OCSP + WC_BITFIELD ocspNoCheckSet:1; /* id-pkix-ocsp-nocheck set */ +#endif + WC_BITFIELD extCRLdistSet:1; + WC_BITFIELD extAuthInfoSet:1; + WC_BITFIELD extBasicConstSet:1; + WC_BITFIELD extPolicyConstSet:1; + WC_BITFIELD extPolicyConstRxpSet:1; /* requireExplicitPolicy set */ + WC_BITFIELD extPolicyConstIpmSet:1; /* inhibitPolicyMapping set */ + WC_BITFIELD extSubjAltNameSet:1; + WC_BITFIELD inhibitAnyOidSet:1; + WC_BITFIELD selfSigned:1; /* Indicates subject and issuer are same */ +#ifdef WOLFSSL_SEP + WC_BITFIELD extCertPolicySet:1; +#endif + WC_BITFIELD extCRLdistCrit:1; + WC_BITFIELD extAuthInfoCrit:1; + WC_BITFIELD extBasicConstCrit:1; + WC_BITFIELD extPolicyConstCrit:1; + WC_BITFIELD extSubjAltNameCrit:1; + WC_BITFIELD extAuthKeyIdCrit:1; +#ifndef IGNORE_NAME_CONSTRAINTS + WC_BITFIELD extNameConstraintCrit:1; +#endif + WC_BITFIELD extSubjKeyIdCrit:1; + WC_BITFIELD extKeyUsageCrit:1; + WC_BITFIELD extExtKeyUsageCrit:1; +#ifdef WOLFSSL_SUBJ_DIR_ATTR + WC_BITFIELD extSubjDirAttrSet:1; +#endif +#ifdef WOLFSSL_SUBJ_INFO_ACC + WC_BITFIELD extSubjInfoAccSet:1; +#endif +#ifdef WOLFSSL_SEP + WC_BITFIELD extCertPolicyCrit:1; +#endif +#ifdef WOLFSSL_CERT_REQ + WC_BITFIELD isCSR:1; /* Do we intend on parsing a CSR? */ +#endif +#ifdef HAVE_RPK + WC_BITFIELD isRPK:1; /* indicate the cert is Raw-Public-Key cert in RFC7250 */ +#endif +#ifdef WC_ASN_UNKNOWN_EXT_CB + wc_UnknownExtCallback unknownExtCallback; + wc_UnknownExtCallbackEx unknownExtCallbackEx; + void *unknownExtCallbackExCtx; +#endif +#ifdef WOLFSSL_DUAL_ALG_CERTS + /* Subject Alternative Public Key Info */ + byte *sapkiDer; + int sapkiLen; + word32 sapkiOID; + /* Alternative Signature Algorithm */ + byte *altSigAlgDer; + int altSigAlgLen; + word32 altSigAlgOID; + /* Alternative Signature Value */ + byte *altSigValDer; + int altSigValLen; + + WC_BITFIELD extSapkiSet:1; + WC_BITFIELD extAltSigAlgSet:1; + WC_BITFIELD extAltSigValSet:1; + WC_BITFIELD extSapkiCrit:1; + WC_BITFIELD extAltSigAlgCrit:1; + WC_BITFIELD extAltSigValCrit:1; +#endif /* WOLFSSL_DUAL_ALG_CERTS */ +}; + +#if defined(WOLFSSL_SM2) && defined(WOLFSSL_SM3) + #define SIGNER_DIGEST_SIZE WC_SM3_DIGEST_SIZE +#elif defined(NO_SHA) + #define SIGNER_DIGEST_SIZE WC_SHA256_DIGEST_SIZE +#else + #define SIGNER_DIGEST_SIZE WC_SHA_DIGEST_SIZE +#endif + +/* CA Signers */ +/* if change layout change PERSIST_CERT_CACHE functions too */ +struct Signer { + word32 pubKeySize; + word32 keyOID; /* key type */ + word16 keyUsage; + byte maxPathLen; + WC_BITFIELD selfSigned:1; + const byte* publicKey; + int nameLen; + char* name; /* common name */ +#ifndef IGNORE_NAME_CONSTRAINTS + Base_entry* permittedNames; + Base_entry* excludedNames; +#endif /* !IGNORE_NAME_CONSTRAINTS */ + byte subjectNameHash[SIGNER_DIGEST_SIZE]; + /* sha hash of names in certificate */ + #if defined(HAVE_OCSP) || defined(HAVE_CRL) + byte issuerNameHash[SIGNER_DIGEST_SIZE]; + /* sha hash of issuer names in certificate. + * Used in OCSP to check for authorized + * responders. */ + #endif + #ifndef NO_SKID + byte subjectKeyIdHash[SIGNER_DIGEST_SIZE]; + /* sha hash of key in certificate */ + #endif + #ifdef HAVE_OCSP + byte subjectKeyHash[KEYID_SIZE]; + #endif +#if defined(WOLFSSL_AKID_NAME) || defined(HAVE_CRL) + byte serialHash[SIGNER_DIGEST_SIZE]; /* serial number hash */ +#endif +#ifdef WOLFSSL_SIGNER_DER_CERT + DerBuffer* derCert; +#endif +#if defined(WOLFSSL_RENESAS_TSIP_TLS) || defined(WOLFSSL_RENESAS_FSPSM_TLS) + word32 cm_idx; +#endif +#ifdef WOLFSSL_DUAL_ALG_CERTS + word32 sapkiOID; /* key type */ + byte* sapkiDer; + int sapkiLen; +#endif /* WOLFSSL_DUAL_ALG_CERTS */ + byte type; + + Signer* next; +}; + + +#ifdef WOLFSSL_TRUST_PEER_CERT +/* used for having trusted peer certs rather then CA */ +struct TrustedPeerCert { + int nameLen; + char* name; /* common name */ + #ifndef IGNORE_NAME_CONSTRAINTS + Base_entry* permittedNames; + Base_entry* excludedNames; + #endif /* IGNORE_NAME_CONSTRAINTS */ + byte subjectNameHash[SIGNER_DIGEST_SIZE]; + /* sha hash of names in certificate */ + #ifndef WOLFSSL_NO_ISSUERHASH_TDPEER + byte issuerHash[SIGNER_DIGEST_SIZE]; + /* sha hash of issuer name in certificate */ + #endif + #ifndef NO_SKID + byte subjectKeyIdHash[SIGNER_DIGEST_SIZE]; + /* sha hash of SKID in certificate */ + #endif + word32 sigLen; + byte* sig; + struct TrustedPeerCert* next; +}; +#endif /* WOLFSSL_TRUST_PEER_CERT */ + + +/* for testing or custom openssl wrappers */ +#if defined(WOLFSSL_TEST_CERT) || defined(OPENSSL_EXTRA) || \ + defined(OPENSSL_EXTRA_X509_SMALL) || defined(WOLFSSL_PUBLIC_ASN) + #define WOLFSSL_ASN_API WOLFSSL_API +#else + #define WOLFSSL_ASN_API WOLFSSL_LOCAL +#endif + +#ifdef HAVE_SMIME +#define MIME_HEADER_ASCII_MIN 33 +#define MIME_HEADER_ASCII_MAX 126 + +typedef struct MimeParam MimeParam; +typedef struct MimeHdr MimeHdr; + +struct MimeParam +{ + MimeParam* next; + char* attribute; + char* value; +}; + +struct MimeHdr +{ + MimeHdr* next; + MimeParam* params; + char* name; + char* body; +}; + +typedef enum MimeTypes +{ + MIME_HDR, + MIME_PARAM +} MimeTypes; + +typedef enum MimeStatus +{ + MIME_NAMEATTR, + MIME_BODYVAL +} MimeStatus; +#endif /* HAVE_SMIME */ + +WOLFSSL_LOCAL int HashIdAlg(word32 oidSum); +WOLFSSL_LOCAL int CalcHashId(const byte* data, word32 len, byte* hash); +WOLFSSL_LOCAL int CalcHashId_ex(const byte* data, word32 len, byte* hash, + int hashAlg); +WOLFSSL_LOCAL int GetName(DecodedCert* cert, int nameType, int maxIdx); + +#ifdef ASN_BER_TO_DER +WOLFSSL_API int wc_BerToDer(const byte* ber, word32 berSz, byte* der, + word32* derSz); +#endif +WOLFSSL_LOCAL int StreamOctetString(const byte* inBuf, word32 inBufSz, + byte* out, word32* outSz, word32* idx); + +WOLFSSL_ASN_API void FreeAltNames(DNS_entry* altNames, void* heap); +WOLFSSL_ASN_API DNS_entry* AltNameNew(void* heap); +WOLFSSL_ASN_API DNS_entry* AltNameDup(DNS_entry* from, void* heap); +#ifndef IGNORE_NAME_CONSTRAINTS + WOLFSSL_ASN_API void FreeNameSubtrees(Base_entry* names, void* heap); +#endif /* IGNORE_NAME_CONSTRAINTS */ +WOLFSSL_ASN_API void InitDecodedCert(DecodedCert* cert, const byte* source, + word32 inSz, void* heap); +WOLFSSL_LOCAL void InitDecodedCert_ex(DecodedCert* cert, const byte* source, + word32 inSz, void* heap, int devId); +WOLFSSL_ASN_API void FreeDecodedCert(DecodedCert* cert); +WOLFSSL_ASN_API int ParseCert(DecodedCert* cert, int type, int verify, + void* cm); + +#ifdef WC_ASN_UNKNOWN_EXT_CB +WOLFSSL_API int wc_SetUnknownExtCallback(DecodedCert* cert, + wc_UnknownExtCallback cb); +WOLFSSL_API int wc_SetUnknownExtCallbackEx(DecodedCert* cert, + wc_UnknownExtCallbackEx cb, + void *ctx); +#endif + +WOLFSSL_LOCAL int DecodePolicyOID(char *out, word32 outSz, const byte *in, + word32 inSz); +WOLFSSL_LOCAL int EncodePolicyOID(byte *out, word32 *outSz, + const char *in, void* heap); +WOLFSSL_LOCAL int CheckCertSignaturePubKey(const byte* cert, word32 certSz, + void* heap, const byte* pubKey, word32 pubKeySz, int pubKeyOID); +#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_SMALL_CERT_VERIFY) + WOLFSSL_API int wc_CheckCertSignature(const byte* cert, word32 certSz, + void* heap, void* cm); + /* Deprecated public API name kept for backwards build compatibility */ + #define CheckCertSignature(cert, certSz, heap, cm) \ + wc_CheckCertSignature(cert, certSz, heap, cm) + + WOLFSSL_API int wc_CheckCertSigPubKey(const byte* cert, word32 certSz, + void* heap, const byte* pubKey, + word32 pubKeySz, int pubKeyOID); +#endif /* OPENSSL_EXTRA || WOLFSSL_SMALL_CERT_VERIFY */ + +#if (defined(HAVE_ED25519) && defined(HAVE_ED25519_KEY_IMPORT) || \ + (defined(HAVE_ED448) && defined(HAVE_ED448_KEY_IMPORT))) +WOLFSSL_LOCAL int wc_CertGetPubKey(const byte* cert, word32 certSz, + const unsigned char** pubKey, word32* pubKeySz); +#endif +WOLFSSL_LOCAL int ConfirmSignature(SignatureCtx* sigCtx, + const byte* buf, word32 bufSz, + const byte* key, word32 keySz, word32 keyOID, + const byte* sig, word32 sigSz, word32 sigOID, + const byte* sigParams, word32 sigParamsSz, + byte* rsaKeyIdx); +#ifdef WOLFSSL_CERT_REQ +WOLFSSL_LOCAL int CheckCSRSignaturePubKey(const byte* cert, word32 certSz, + void* heap, const byte* pubKey, word32 pubKeySz, int pubKeyOID); +#endif /* WOLFSSL_CERT_REQ */ +WOLFSSL_ASN_API int AddSignature(byte* buf, int bodySz, const byte* sig, int sigSz, + int sigAlgoType); +WOLFSSL_LOCAL int ParseCertRelative(DecodedCert* cert, int type, int verify, + void* cm, Signer *extraCa); +WOLFSSL_LOCAL int DecodeToKey(DecodedCert* cert, int verify); +#ifdef WOLFSSL_ASN_TEMPLATE +WOLFSSL_LOCAL int DecodeCert(DecodedCert* cert, int verify, int* criticalExt); +#endif +WOLFSSL_LOCAL int TryDecodeRPKToKey(DecodedCert* cert); +WOLFSSL_LOCAL int wc_GetPubX509(DecodedCert* cert, int verify, int* badDate); + +WOLFSSL_LOCAL const byte* OidFromId(word32 id, word32 type, word32* oidSz); +WOLFSSL_LOCAL Signer* findSignerByKeyHash(Signer *list, byte *hash); +WOLFSSL_LOCAL Signer* findSignerByName(Signer *list, byte *hash); +WOLFSSL_LOCAL int FillSigner(Signer* signer, DecodedCert* cert, int type, DerBuffer *der); +WOLFSSL_LOCAL Signer* MakeSigner(void* heap); +WOLFSSL_LOCAL void FreeSigner(Signer* signer, void* heap); +WOLFSSL_LOCAL void FreeSignerTable(Signer** table, int rows, void* heap); +WOLFSSL_LOCAL void FreeSignerTableType(Signer** table, int rows, byte type, + void* heap); +#ifdef WOLFSSL_TRUST_PEER_CERT +WOLFSSL_LOCAL void FreeTrustedPeer(TrustedPeerCert* tp, void* heap); +WOLFSSL_LOCAL void FreeTrustedPeerTable(TrustedPeerCert** table, int rows, + void* heap); +#endif /* WOLFSSL_TRUST_PEER_CERT */ + +WOLFSSL_ASN_API int ToTraditional(byte* input, word32 sz); +WOLFSSL_ASN_API int ToTraditional_ex(byte* input, word32 sz, word32* algId); +WOLFSSL_LOCAL int ToTraditionalInline(const byte* input, word32* inOutIdx, + word32 sz); +WOLFSSL_LOCAL int ToTraditionalInline_ex(const byte* input, word32* inOutIdx, + word32 sz, word32* algId); +WOLFSSL_LOCAL int ToTraditionalInline_ex2(const byte* input, word32* inOutIdx, + word32 sz, word32* algId, + word32* eccOid); +WOLFSSL_LOCAL int ToTraditionalEnc(byte* input, word32 sz, const char* password, + int passwordSz, word32* algId); +WOLFSSL_ASN_API int UnTraditionalEnc(byte* key, word32 keySz, byte* out, + word32* outSz, const char* password, int passwordSz, int vPKCS, + int vAlgo, byte* salt, word32 saltSz, int itt, WC_RNG* rng, void* heap); +WOLFSSL_ASN_API int TraditionalEnc_ex(byte* key, word32 keySz, byte* out, + word32* outSz, const char* password, int passwordSz, int vPKCS, + int vAlgo, int encAlgId, byte* salt, word32 saltSz, int itt, + int hmacOid, WC_RNG* rng, void* heap); +WOLFSSL_ASN_API int TraditionalEnc(byte* key, word32 keySz, byte* out, + word32* outSz, const char* password, int passwordSz, int vPKCS, + int vAlgo, int encAlgId, byte* salt, word32 saltSz, int itt, + WC_RNG* rng, void* heap); +WOLFSSL_LOCAL int DecryptContent(byte* input, word32 sz, const char* password, int passwordSz); +WOLFSSL_LOCAL int EncryptContent(byte* input, word32 sz, byte* out, word32* outSz, + const char* password,int passwordSz, int vPKCS, int vAlgo, int encAlgId, + byte* salt, word32 saltSz, int itt, int hmacOid, WC_RNG* rng, + void* heap); +WOLFSSL_LOCAL int wc_GetKeyOID(byte* key, word32 keySz, const byte** curveOID, + word32* oidSz, int* algoID, void* heap); + +typedef struct tm wolfssl_tm; +#ifdef WOLFSSL_ASN_TIME_STRING +WOLFSSL_LOCAL int GetTimeString(byte* date, int format, char* buf, int len); +#endif +#if !defined(NO_ASN_TIME) && !defined(USER_TIME) && \ + !defined(TIME_OVERRIDES) && (defined(OPENSSL_EXTRA) || defined(HAVE_PKCS7)) +WOLFSSL_LOCAL int GetFormattedTime(void* currTime, byte* buf, word32 len); +WOLFSSL_LOCAL int GetAsnTimeString(void* currTime, byte* buf, word32 len); +#endif +WOLFSSL_LOCAL int ExtractDate(const unsigned char* date, unsigned char format, + wolfssl_tm* certTime, int* idx); +WOLFSSL_LOCAL int DateGreaterThan(const struct tm* a, const struct tm* b); +WOLFSSL_LOCAL int wc_ValidateDate(const byte* date, byte format, int dateType); +WOLFSSL_TEST_VIS int wc_AsnSetSkipDateCheck(int skip_p); +WOLFSSL_LOCAL int wc_AsnGetSkipDateCheck(void); + +/* ASN.1 helper functions */ +#ifdef WOLFSSL_CERT_GEN +WOLFSSL_LOCAL int SetNameEx(byte* output, word32 outputSz, CertName* name, void* heap); +WOLFSSL_ASN_API int SetName(byte* output, word32 outputSz, CertName* name); +WOLFSSL_LOCAL const char* GetOneCertName(CertName* name, int idx); +WOLFSSL_LOCAL byte GetCertNameId(int idx); +#endif +WOLFSSL_LOCAL int GetShortInt(const byte* input, word32* inOutIdx, int* number, + word32 maxIdx); +WOLFSSL_TEST_VIS int SetShortInt(byte* output, word32* inOutIdx, word32 number, + word32 maxIdx); + +WOLFSSL_LOCAL const char* GetSigName(int oid); +WOLFSSL_ASN_API int GetLength(const byte* input, word32* inOutIdx, int* len, + word32 maxIdx); +WOLFSSL_LOCAL int GetLength_ex(const byte* input, word32* inOutIdx, int* len, + word32 maxIdx, int check); +WOLFSSL_LOCAL int GetASNHeader(const byte* input, byte tag, word32* inOutIdx, + int* len, word32 maxIdx); +WOLFSSL_LOCAL int GetSequence(const byte* input, word32* inOutIdx, int* len, + word32 maxIdx); +WOLFSSL_LOCAL int GetSequence_ex(const byte* input, word32* inOutIdx, int* len, + word32 maxIdx, int check); +WOLFSSL_LOCAL int GetOctetString(const byte* input, word32* inOutIdx, int* len, + word32 maxIdx); +WOLFSSL_LOCAL int CheckBitString(const byte* input, word32* inOutIdx, int* len, + word32 maxIdx, int zeroBits, byte* unusedBits); +WOLFSSL_LOCAL int GetSet(const byte* input, word32* inOutIdx, int* len, + word32 maxIdx); +WOLFSSL_LOCAL int GetSet_ex(const byte* input, word32* inOutIdx, int* len, + word32 maxIdx, int check); +WOLFSSL_LOCAL int GetMyVersion(const byte* input, word32* inOutIdx, + int* version, word32 maxIdx); +WOLFSSL_LOCAL int GetInt(mp_int* mpi, const byte* input, word32* inOutIdx, + word32 maxIdx); +WOLFSSL_ASN_API int GetASNInt(const byte* input, word32* inOutIdx, int* len, + word32 maxIdx); + +WOLFSSL_LOCAL word32 wc_oid_sum(const byte* input, int length); + +#ifdef HAVE_OID_ENCODING + WOLFSSL_API int wc_EncodeObjectId(const word16* in, word32 inSz, + byte* out, word32* outSz); + WOLFSSL_LOCAL int EncodeObjectId(const word16* in, word32 inSz, + byte* out, word32* outSz); +#endif +#if defined(HAVE_OID_DECODING) || defined(WOLFSSL_ASN_PRINT) || \ + defined(OPENSSL_ALL) + WOLFSSL_LOCAL int DecodeObjectId(const byte* in, word32 inSz, + word16* out, word32* outSz); +#endif +WOLFSSL_LOCAL int GetASNObjectId(const byte* input, word32* inOutIdx, int* len, + word32 maxIdx); +WOLFSSL_LOCAL int SetObjectId(int len, byte* output); +WOLFSSL_LOCAL int GetObjectId(const byte* input, word32* inOutIdx, word32* oid, + word32 oidType, word32 maxIdx); +WOLFSSL_LOCAL int GetAlgoId(const byte* input, word32* inOutIdx, word32* oid, + word32 oidType, word32 maxIdx); +WOLFSSL_LOCAL int GetAlgoIdEx(const byte* input, word32* inOutIdx, word32* oid, + word32 oidType, word32 maxIdx, byte *absentParams); +WOLFSSL_ASN_API int GetASNTag(const byte* input, word32* inOutIdx, byte* tag, + word32 maxIdx); +WOLFSSL_LOCAL int GetASN_BitString(const byte* input, word32 idx, int length); + +WOLFSSL_LOCAL word32 SetASNLength(word32 length, byte* output); +WOLFSSL_LOCAL word32 SetASNSequence(word32 len, byte* output); +WOLFSSL_LOCAL word32 SetASNOctetString(word32 len, byte* output); +WOLFSSL_LOCAL word32 SetASNImplicit(byte tag,byte number, word32 len, + byte* output); +WOLFSSL_LOCAL word32 SetASNExplicit(byte number, word32 len, byte* output); +WOLFSSL_LOCAL word32 SetASNSet(word32 len, byte* output); + +WOLFSSL_LOCAL word32 SetLength(word32 length, byte* output); +WOLFSSL_LOCAL word32 SetLengthEx(word32 length, byte* output, byte isIndef); +WOLFSSL_LOCAL word32 SetHeader(byte tag, word32 len, byte* output, + byte isIndef); +WOLFSSL_LOCAL word32 SetSequence(word32 len, byte* output); +WOLFSSL_LOCAL word32 SetSequenceEx(word32 len, byte* output, byte isIndef); +WOLFSSL_LOCAL word32 SetIndefEnd(byte* output); +WOLFSSL_LOCAL word32 SetOctetString(word32 len, byte* output); +WOLFSSL_LOCAL word32 SetOctetStringEx(word32 len, byte* output, byte indef); +WOLFSSL_LOCAL int SetASNInt(int len, byte firstByte, byte* output); +WOLFSSL_LOCAL word32 SetBitString(word32 len, byte unusedBits, byte* output); +WOLFSSL_LOCAL word32 SetImplicit(byte tag,byte number,word32 len,byte* output, + byte isIndef); +WOLFSSL_LOCAL word32 SetExplicit(byte number, word32 len, byte* output, + byte isIndef); +WOLFSSL_LOCAL word32 SetSet(word32 len, byte* output); +WOLFSSL_API word32 SetAlgoID(int algoOID, byte* output, int type, int curveSz); +WOLFSSL_LOCAL word32 SetAlgoIDEx(int algoOID, byte* output, int type, int curveSz, + byte absentParams); +WOLFSSL_LOCAL int SetMyVersion(word32 version, byte* output, int header); +WOLFSSL_LOCAL int SetSerialNumber(const byte* sn, word32 snSz, byte* output, + word32 outputSz, int maxSnSz); +/* name is of type WOLFSSL_ASN1_OTHERNAME; use void* to avoid including ssl.h */ +WOLFSSL_LOCAL word32 SetOthername(void *name, byte *output); + +#ifndef WOLFSSL_ASN_TEMPLATE +WOLFSSL_LOCAL int wc_GetSerialNumber(const byte* input, word32* inOutIdx, + byte* serial, int* serialSz, word32 maxIdx); +#endif +WOLFSSL_LOCAL int GetNameHash(const byte* source, word32* idx, byte* hash, + int maxIdx); +WOLFSSL_LOCAL int GetNameHash_ex(const byte* source, word32* idx, byte* hash, + int maxIdx, word32 sigOID); +WOLFSSL_LOCAL int wc_CheckPrivateKeyCert(const byte* key, word32 keySz, + DecodedCert* der, int checkAlt, + void* heap); +WOLFSSL_LOCAL int wc_CheckPrivateKey(const byte* privKey, word32 privKeySz, + const byte* pubKey, word32 pubKeySz, + enum Key_Sum ks, void* heap); +WOLFSSL_LOCAL int StoreDHparams(byte* out, word32* outLen, mp_int* p, mp_int* g); +#ifdef WOLFSSL_DH_EXTRA +WOLFSSL_API int wc_DhPublicKeyDecode(const byte* input, word32* inOutIdx, + DhKey* key, word32 inSz); +#endif +WOLFSSL_LOCAL int FlattenAltNames(byte* output, word32 outputSz, + const DNS_entry* names); + +WOLFSSL_LOCAL int wc_EncodeName(EncodedName* name, const char* nameStr, + char nameType, byte type); +WOLFSSL_LOCAL int wc_EncodeNameCanonical(EncodedName* name, const char* nameStr, + char nameType, byte type); + +#if defined(HAVE_ECC) || !defined(NO_DSA) + /* ASN sig helpers */ + WOLFSSL_LOCAL int StoreECC_DSA_Sig(byte* out, word32* outLen, mp_int* r, + mp_int* s); + WOLFSSL_LOCAL int StoreECC_DSA_Sig_Bin(byte* out, word32* outLen, + const byte* r, word32 rLen, const byte* s, word32 sLen); + WOLFSSL_LOCAL int DecodeECC_DSA_Sig_Bin(const byte* sig, word32 sigLen, + byte* r, word32* rLen, byte* s, word32* sLen); + WOLFSSL_LOCAL int DecodeECC_DSA_Sig(const byte* sig, word32 sigLen, + mp_int* r, mp_int* s); + WOLFSSL_LOCAL int DecodeECC_DSA_Sig_Ex(const byte* sig, word32 sigLen, + mp_int* r, mp_int* s, int init); +#endif +#ifndef NO_DSA +WOLFSSL_LOCAL int StoreDSAParams(byte*, word32*, const mp_int*, const mp_int*, + const mp_int*); +#endif + +WOLFSSL_LOCAL void InitSignatureCtx(SignatureCtx* sigCtx, void* heap, int devId); +WOLFSSL_LOCAL void FreeSignatureCtx(SignatureCtx* sigCtx); + +WOLFSSL_LOCAL int SetAsymKeyDerPublic(const byte* pubKey, word32 pubKeyLen, + byte* output, word32 outLen, int keyType, int withHeader); +WOLFSSL_LOCAL int DecodeAsymKeyPublic_Assign(const byte* input, + word32* inOutIdx, word32 inSz, const byte** pubKey, word32* pubKeyLen, + int* keyType); + +WOLFSSL_LOCAL int DecodeAsymKeyPublic(const byte* input, word32* inOutIdx, + word32 inSz, byte* pubKey, word32* pubKeyLen, int keyType); + +#ifndef NO_CERTS + +WOLFSSL_LOCAL int wc_EncryptedInfoParse(EncryptedInfo* info, + const char** pBuffer, size_t bufSz); + +WOLFSSL_LOCAL int PemToDer(const unsigned char* buff, long longSz, int type, + DerBuffer** pDer, void* heap, EncryptedInfo* info, + int* keyFormat); +WOLFSSL_LOCAL int AllocDer(DerBuffer** der, word32 length, int type, + void* heap); +WOLFSSL_LOCAL int AllocCopyDer(DerBuffer** der, const unsigned char* buff, + word32 length, int type, void* heap); +WOLFSSL_LOCAL void FreeDer(DerBuffer** der); + +#ifdef WOLFSSL_ASN_PARSE_KEYUSAGE +WOLFSSL_LOCAL int ParseKeyUsageStr(const char* value, word16* keyUsage, + void* heap); +WOLFSSL_LOCAL int ParseExtKeyUsageStr(const char* value, byte* extKeyUsage, + void* heap); +#endif + +#endif /* !NO_CERTS */ + +#ifdef HAVE_SMIME +WOLFSSL_LOCAL int wc_MIME_parse_headers(char* in, int inLen, MimeHdr** hdrs); +WOLFSSL_LOCAL int wc_MIME_header_strip(char* in, char** out, size_t start, size_t end); +WOLFSSL_LOCAL MimeHdr* wc_MIME_find_header_name(const char* name, MimeHdr* hdr); +WOLFSSL_LOCAL MimeParam* wc_MIME_find_param_attr(const char* attribute, MimeParam* param); +WOLFSSL_LOCAL char* wc_MIME_single_canonicalize(const char* line, word32* len); +WOLFSSL_LOCAL int wc_MIME_free_hdrs(MimeHdr* head); +#endif /* HAVE_SMIME */ + +#ifdef WOLFSSL_CERT_GEN + +enum cert_enums { + RSA_KEY = 10, + ECC_KEY = 12, + ED25519_KEY = 13, + ED448_KEY = 14, + DSA_KEY = 15, + FALCON_LEVEL1_KEY = 16, + FALCON_LEVEL5_KEY = 17, + DILITHIUM_LEVEL2_KEY = 18, + DILITHIUM_LEVEL3_KEY = 19, + DILITHIUM_LEVEL5_KEY = 20, + ML_DSA_LEVEL2_KEY = 21, + ML_DSA_LEVEL3_KEY = 22, + ML_DSA_LEVEL5_KEY = 23, + SPHINCS_FAST_LEVEL1_KEY = 24, + SPHINCS_FAST_LEVEL3_KEY = 25, + SPHINCS_FAST_LEVEL5_KEY = 26, + SPHINCS_SMALL_LEVEL1_KEY = 27, + SPHINCS_SMALL_LEVEL3_KEY = 28, + SPHINCS_SMALL_LEVEL5_KEY = 29 +}; + +#endif /* WOLFSSL_CERT_GEN */ + + + +/* for pointer use */ +typedef struct CertStatus CertStatus; + +#ifdef HAVE_OCSP + +enum Ocsp_Response_Status { + OCSP_SUCCESSFUL = 0, /* Response has valid confirmations */ + OCSP_MALFORMED_REQUEST = 1, /* Illegal confirmation request */ + OCSP_INTERNAL_ERROR = 2, /* Internal error in issuer */ + OCSP_TRY_LATER = 3, /* Try again later */ + OCSP_SIG_REQUIRED = 5, /* Must sign the request (4 is skipped) */ + OCSP_UNAUTHORIZED = 6 /* Request unauthorized */ +}; + + +enum Ocsp_Cert_Status { + CERT_GOOD = 0, + CERT_REVOKED = 1, + CERT_UNKNOWN = 2 +}; + + +#ifdef OPENSSL_EXTRA +enum Ocsp_Verify_Error { + OCSP_VERIFY_ERROR_NONE = 0, + OCSP_BAD_ISSUER = 1 +}; +#endif + + +typedef struct OcspRequest OcspRequest; +typedef struct OcspResponse OcspResponse; + + +struct CertStatus { + CertStatus* next; + + byte serial[EXTERNAL_SERIAL_SIZE]; + int serialSz; +#ifdef OPENSSL_EXTRA + WOLFSSL_ASN1_INTEGER* serialInt; +#endif + + int status; + + byte thisDate[MAX_DATE_SIZE]; + byte nextDate[MAX_DATE_SIZE]; + byte thisDateFormat; + byte nextDateFormat; +#ifdef WOLFSSL_OCSP_PARSE_STATUS + WOLFSSL_ASN1_TIME thisDateParsed; + WOLFSSL_ASN1_TIME nextDateParsed; + byte* thisDateAsn; + byte* nextDateAsn; +#endif + + byte* rawOcspResponse; + word32 rawOcspResponseSz; +}; + +typedef struct OcspEntry OcspEntry; + +#if defined(WOLFSSL_SM2) && defined(WOLFSSL_SM3) +#define OCSP_DIGEST WC_HASH_TYPE_SM3 +#elif defined(NO_SHA) +#define OCSP_DIGEST WC_HASH_TYPE_SHA256 +#else +#define OCSP_DIGEST WC_HASH_TYPE_SHA +#endif + +#if defined(WOLFSSL_SM2) && defined(WOLFSSL_SM3) +#define OCSP_DIGEST_SIZE WC_SM3_DIGEST_SIZE +#elif defined(NO_SHA) +#define OCSP_DIGEST_SIZE WC_SHA256_DIGEST_SIZE +#else +#define OCSP_DIGEST_SIZE WC_SHA_DIGEST_SIZE +#endif + +struct OcspEntry +{ + OcspEntry *next; /* next entry */ + word32 hashAlgoOID; /* hash algo ID */ + byte issuerHash[OCSP_DIGEST_SIZE]; /* issuer hash */ + byte issuerKeyHash[OCSP_DIGEST_SIZE]; /* issuer public key hash */ + CertStatus *status; /* OCSP response list */ + int totalStatus; /* number on list */ + byte* rawCertId; /* raw bytes of the CertID */ + int rawCertIdSize; /* num bytes in raw CertID */ + /* option bits - using 32-bit for alignment */ + WC_BITFIELD ownStatus:1; /* do we need to free the status + * response list */ + WC_BITFIELD isDynamic:1; /* was dynamically allocated */ + WC_BITFIELD used:1; /* entry used */ +}; + +#define OCSP_RESPONDER_ID_KEY_SZ 20 +#if !defined(NO_SHA) +#define OCSP_RESPONDER_ID_HASH_TYPE WC_SHA +#else +#define OCSP_RESPONDER_ID_HASH_TYPE WC_SHA256 +#endif +enum responderIdType { + OCSP_RESPONDER_ID_INVALID = 0, + OCSP_RESPONDER_ID_NAME = 1, + OCSP_RESPONDER_ID_KEY = 2, +}; +/* TODO: Long-term, it would be helpful if we made this struct and other OCSP + structs conform to the ASN spec as described in RFC 6960. It will help + with readability and with implementing OpenSSL compatibility API + functions, because OpenSSL's OCSP data structures conform to the + RFC. */ +struct OcspResponse { + int responseStatus; /* return code from Responder */ + + byte* response; /* Pointer to beginning of OCSP Response */ + word32 responseSz; /* length of the OCSP Response */ + + enum responderIdType responderIdType; + union { + byte keyHash[OCSP_RESPONDER_ID_KEY_SZ]; + byte nameHash[KEYID_SIZE]; + } responderId ; + + byte producedDate[MAX_DATE_SIZE]; + /* Date at which this response was signed */ + byte producedDateFormat; /* format of the producedDate */ + + byte* cert; + word32 certSz; + + byte* sig; /* Pointer to sig in source */ + word32 sigSz; /* Length in octets for the sig */ + word32 sigOID; /* OID for hash used for sig */ + + byte* sigParams; + word32 sigParamsSz; + + OcspEntry* single; /* chain of OCSP single responses */ + + byte* nonce; /* pointer to nonce inside ASN.1 response */ + int nonceSz; /* length of the nonce string */ + + byte* source; /* pointer to source buffer, not owned */ + word32 maxIdx; /* max offset based on init size */ + Signer* pendingCAs; + void* heap; +}; + + +struct OcspRequest { + byte issuerHash[KEYID_SIZE]; + byte issuerKeyHash[KEYID_SIZE]; +#if defined(WOLFSSL_SM2) && defined(WOLFSSL_SM3) + int hashSz; +#endif + byte* serial; /* copy of the serial number in source cert */ + int serialSz; +#ifdef OPENSSL_EXTRA + WOLFSSL_ASN1_INTEGER* serialInt; + void* cid; /* WOLFSSL_OCSP_CERTID kept to free */ +#endif + byte* url; /* copy of the extAuthInfo in source cert */ + int urlSz; + + byte nonce[MAX_OCSP_NONCE_SZ]; + int nonceSz; + void* heap; + void* ssl; +}; + +WOLFSSL_LOCAL void InitOcspResponse(OcspResponse* resp, OcspEntry* single, + CertStatus* status, byte* source, word32 inSz, void* heap); +WOLFSSL_LOCAL void FreeOcspResponse(OcspResponse* resp); +WOLFSSL_LOCAL int OcspResponseDecode(OcspResponse* resp, void* cm, void* heap, + int noVerifyCert, int noVerifySignature); + +WOLFSSL_LOCAL int InitOcspRequest(OcspRequest* req, DecodedCert* cert, + byte useNonce, void* heap); +WOLFSSL_LOCAL void FreeOcspRequest(OcspRequest* req); +WOLFSSL_LOCAL int EncodeOcspRequest(OcspRequest* req, byte* output, + word32 size); +WOLFSSL_LOCAL word32 EncodeOcspRequestExtensions(OcspRequest* req, byte* output, + word32 size); + + +WOLFSSL_LOCAL int CompareOcspReqResp(OcspRequest* req, OcspResponse* resp); +WOLFSSL_LOCAL int OcspDecodeCertID(const byte* input, word32* inOutIdx, word32 inSz, + OcspEntry* entry); + +#endif /* HAVE_OCSP */ + + +/* for pointer use */ +typedef struct RevokedCert RevokedCert; + +#ifdef HAVE_CRL + +struct RevokedCert { + byte serialNumber[EXTERNAL_SERIAL_SIZE]; + int serialSz; + RevokedCert* next; + byte revDate[MAX_DATE_SIZE]; + byte revDateFormat; +}; + +#ifndef CRL_MAX_NUM_SZ +#define CRL_MAX_NUM_SZ 20 /* RFC5280 states that CRL number can be up to 20 */ +#endif /* octets long */ + + +typedef struct DecodedCRL DecodedCRL; + +struct DecodedCRL { + word32 certBegin; /* offset to start of cert */ + word32 sigIndex; /* offset to start of signature */ + word32 sigLength; /* length of signature */ + word32 signatureOID; /* sum of algorithm object id */ +#ifdef WC_RSA_PSS + word32 sigParamsIndex; /* start of signature parameters */ + word32 sigParamsLength; /* length of signature parameters */ +#endif + byte* signature; /* pointer into raw source, not owned */ + byte crlNumber[CRL_MAX_NUM_SZ]; /* CRL number extension */ + byte issuerHash[SIGNER_DIGEST_SIZE]; /* issuer name hash */ + byte crlHash[SIGNER_DIGEST_SIZE]; /* raw crl data hash */ + byte lastDate[MAX_DATE_SIZE]; /* last date updated */ + byte nextDate[MAX_DATE_SIZE]; /* next update date */ + byte lastDateFormat; /* format of last date */ + byte nextDateFormat; /* format of next date */ + RevokedCert* certs; /* revoked cert list */ +#if defined(OPENSSL_EXTRA) + byte* issuer; /* full name including common name */ + word32 issuerSz; /* length of the issuer */ +#endif + int totalCerts; /* number on list */ + int version; /* version of cert */ + void* heap; +#ifndef NO_SKID + byte extAuthKeyId[SIGNER_DIGEST_SIZE]; /* Authority Key ID */ + WC_BITFIELD extAuthKeyIdSet:1; /* Auth key identifier set indicator */ +#endif + WC_BITFIELD crlNumberSet:1; /* CRL number set indicator */ +}; + +WOLFSSL_LOCAL void InitDecodedCRL(DecodedCRL* dcrl, void* heap); +WOLFSSL_LOCAL int VerifyCRL_Signature(SignatureCtx* sigCtx, + const byte* toBeSigned, word32 tbsSz, + const byte* signature, word32 sigSz, + word32 signatureOID, const byte* sigParams, + int sigParamsSz, Signer *ca, void* heap); +WOLFSSL_LOCAL int ParseCRL(RevokedCert* rcert, DecodedCRL* dcrl, + const byte* buff, word32 sz, int verify, void* cm); +WOLFSSL_LOCAL void FreeDecodedCRL(DecodedCRL* dcrl); + +#endif /* HAVE_CRL */ + +#if defined(WOLFSSL_ACERT) +/* Minimal structure for x509 attribute certificate (rfc 5755). + * + * The attributes field is not parsed, but is stored as raw buffer. + * */ +struct DecodedAcert { + word32 certBegin; /* Offset to start of acert. */ + word32 sigIndex; /* Offset to start of signature. */ + word32 sigLength; /* Signature length. */ + word32 signatureOID; /* Sum of algorithm object id. */ +#ifdef WC_RSA_PSS + word32 sigParamsIndex; /* start of signature parameters */ + word32 sigParamsLength; /* length of signature parameters */ +#endif + const byte * signature; /* Not owned, points into raw acert. */ + const byte * source; /* Byte buffer holding acert, NOT owned. */ + word32 srcIdx; /* Current offset into buffer. */ + word32 maxIdx; /* Max allowed offset. Set in init. */ + void * heap; /* For user memory overrides. */ + int version; /* attribute cert version. */ + byte serial[EXTERNAL_SERIAL_SIZE]; /* Raw serial number. */ + int serialSz; + const byte * beforeDate; /* Before and After dates. */ + int beforeDateLen; + const byte * afterDate; + int afterDateLen; + byte holderSerial[EXTERNAL_SERIAL_SIZE]; + int holderSerialSz; + DNS_entry * holderEntityName; /* Holder entityName from ACERT */ + DNS_entry * holderIssuerName; /* Holder issuerName from ACERT */ + DNS_entry * AttCertIssuerName; /* AttCertIssuer name from ACERT */ + const byte * rawAttr; /* Not owned, points into raw acert. */ + word32 rawAttrLen; + SignatureCtx sigCtx; +}; + +typedef struct DecodedAcert DecodedAcert; + +WOLFSSL_LOCAL void InitDecodedAcert(DecodedAcert* acert, + const byte* source, word32 inSz, + void* heap); +WOLFSSL_LOCAL void FreeDecodedAcert(DecodedAcert * acert); +WOLFSSL_LOCAL int ParseX509Acert(DecodedAcert* cert, int verify); +WOLFSSL_LOCAL int VerifyX509Acert(const byte* cert, word32 certSz, + const byte* pubKey, word32 pubKeySz, + int pubKeyOID, void * heap); +#endif /* WOLFSSL_ACERT */ + + +#if ((defined(HAVE_ED25519) && defined(HAVE_ED25519_KEY_IMPORT)) \ + || (defined(HAVE_CURVE25519) && defined(HAVE_CURVE25519_KEY_IMPORT)) \ + || (defined(HAVE_ED448) && defined(HAVE_ED448_KEY_IMPORT)) \ + || (defined(HAVE_CURVE448) && defined(HAVE_CURVE448_KEY_IMPORT)) \ + || defined(HAVE_FALCON) || defined(HAVE_DILITHIUM) || defined(HAVE_SPHINCS)) +WOLFSSL_LOCAL int DecodeAsymKey_Assign(const byte* input, word32* inOutIdx, + word32 inSz, const byte** privKey, word32* privKeyLen, const byte** pubKey, + word32* pubKeyLen, int* inOutKeyType); + +WOLFSSL_LOCAL int DecodeAsymKey(const byte* input, word32* inOutIdx, + word32 inSz, byte* privKey, word32* privKeyLen, byte* pubKey, + word32* pubKeyLen, int keyType); +#endif + +#ifdef WC_ENABLE_ASYM_KEY_EXPORT +WOLFSSL_LOCAL int SetAsymKeyDer(const byte* privKey, word32 privKeyLen, + const byte* pubKey, word32 pubKeyLen, byte* output, word32 outLen, + int keyType); +#endif + +#endif /* !NO_ASN */ + +#if !defined(NO_ASN) || !defined(NO_PWDBASED) + +#ifndef PKCS_MAX_KEY_SIZE + #define PKCS_MAX_KEY_SIZE 64 /* MAX PKCS Key length */ +#endif +#if !defined(WOLFSSL_GAME_BUILD) && !defined(MAX_KEY_SIZE) + /* for backwards compatibility */ + #define MAX_KEY_SIZE PKCS_MAX_KEY_SIZE +#endif +#ifndef MAX_UNICODE_SZ + #define MAX_UNICODE_SZ 256 +#endif + +enum PBESTypes { + PBE_MD5_DES = 0, + PBE_SHA1_RC4_128 = 1, + PBE_SHA1_DES = 2, + PBE_SHA1_DES3 = 3, + PBE_AES256_CBC = 4, + PBE_AES128_CBC = 5, + PBE_SHA1_40RC2_CBC = 6, + + PBE_SHA1_RC4_128_SUM = 657, + PBE_SHA1_DES3_SUM = 659, + PBE_SHA1_40RC2_CBC_SUM = 662, + PBE_MD5_DES_SUM = 651, + PBE_SHA1_DES_SUM = 658, + PBES2_SUM = 661, + + PBES2 = 13, /* algo ID */ + PBES1_MD5_DES = 3, + PBES1_SHA1_DES = 10, + + PBE_NONE = 999 +}; + +enum PKCSTypes { + PKCS5v2 = 6, /* PKCS #5 v2.0 */ + PKCS12v1 = 12, /* PKCS #12 */ + PKCS5 = 5, /* PKCS oid tag */ + PKCS8v0 = 0, /* default PKCS#8 version */ + PKCS8v1 = 1, /* PKCS#8 version including public key */ + PKCS1v0 = 0, /* default PKCS#1 version */ + PKCS1v1 = 1 /* Multi-prime version */ +}; + +#endif /* !NO_ASN || !NO_PWDBASED */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* !NO_ASN || !NO_PWDBASED */ + +#endif /* WOLF_CRYPT_ASN_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/asn_public.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/asn_public.h @@ -0,0 +1,1009 @@ +/* asn_public.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/asn_public.h +*/ + +/* +DESCRIPTION +This library defines the interface APIs for X509 certificates. + +*/ +#ifndef WOLF_CRYPT_ASN_PUBLIC_H +#define WOLF_CRYPT_ASN_PUBLIC_H + +#include <wolfssl/wolfcrypt/types.h> +#ifndef NO_DSA + #include <wolfssl/wolfcrypt/dsa.h> +#endif +#include <wolfssl/wolfcrypt/random.h> + +#ifdef __cplusplus + extern "C" { +#endif + +/* guard on redeclaration */ +#ifndef WC_ECCKEY_TYPE_DEFINED + typedef struct ecc_key ecc_key; + #define WC_ECCKEY_TYPE_DEFINED +#endif +#ifndef WC_ED25519KEY_TYPE_DEFINED + typedef struct ed25519_key ed25519_key; + #define WC_ED25519KEY_TYPE_DEFINED +#endif +#ifndef WC_CURVE25519KEY_TYPE_DEFINED + typedef struct curve25519_key curve25519_key; + #define WC_CURVE25519KEY_TYPE_DEFINED +#endif +#ifndef WC_ED448KEY_TYPE_DEFINED + typedef struct ed448_key ed448_key; + #define WC_ED448KEY_TYPE_DEFINED +#endif +#ifndef WC_CURVE448KEY_TYPE_DEFINED + typedef struct curve448_key curve448_key; + #define WC_CURVE448KEY_TYPE_DEFINED +#endif +#ifndef WC_RSAKEY_TYPE_DEFINED + typedef struct RsaKey RsaKey; + #define WC_RSAKEY_TYPE_DEFINED +#endif +#ifndef WC_DH_TYPE_DEFINED + typedef struct DhKey DhKey; + #define WC_DH_TYPE_DEFINED +#endif +#ifndef WC_FALCONKEY_TYPE_DEFINED + typedef struct falcon_key falcon_key; + #define WC_FALCONKEY_TYPE_DEFINED +#endif +#ifndef WC_DILITHIUMKEY_TYPE_DEFINED + typedef struct dilithium_key dilithium_key; + #define WC_DILITHIUMKEY_TYPE_DEFINED +#endif +#ifndef WC_SPHINCSKEY_TYPE_DEFINED + typedef struct sphincs_key sphincs_key; + #define WC_SPHINCSKEY_TYPE_DEFINED +#endif + +enum EncPkcs8Types { + ENC_PKCS8_VER_PKCS12 = 1, + ENC_PKCS8_VER_PKCS5 = 5, + + ENC_PKCS8_PBES2 = 13, + + ENC_PKCS8_PBE_SHA1_RC4_128 = 1, + ENC_PKCS8_PBE_SHA1_DES = 2, + ENC_PKCS8_PBE_SHA1_DES3 = 3, + ENC_PKCS8_PBE_SHA1_40RC2_CBC = 6, + + ENC_PKCS8_PBES1_MD5_DES = 3, + ENC_PKCS8_PBES1_SHA1_DES = 10, + + ENC_PKCS8_ALG_AES128CBC = 414, + ENC_PKCS8_ALG_AES256CBC = 454, + ENC_PKCS8_ALG_DES = 69, + ENC_PKCS8_ALG_DES3 = 652 +}; + +/* Certificate file Type */ +enum CertType { + CERT_TYPE = 0, + PRIVATEKEY_TYPE, + ALT_PRIVATEKEY_TYPE, + DH_PARAM_TYPE, + DSA_PARAM_TYPE, + CRL_TYPE, + CA_TYPE, + ECC_PRIVATEKEY_TYPE, + DSA_PRIVATEKEY_TYPE, + ACERT_TYPE, + CERTREQ_TYPE, + DSA_TYPE, + ECC_TYPE, + RSA_TYPE, + PUBLICKEY_TYPE, + RSA_PUBLICKEY_TYPE, + ECC_PUBLICKEY_TYPE, + TRUSTED_PEER_TYPE, + EDDSA_PRIVATEKEY_TYPE, + ED25519_TYPE, + ED448_TYPE, + PKCS12_TYPE, + PKCS8_PRIVATEKEY_TYPE, + PKCS8_ENC_PRIVATEKEY_TYPE, + DETECT_CERT_TYPE, + DH_PRIVATEKEY_TYPE, + X942_PARAM_TYPE, + FALCON_LEVEL1_TYPE, + FALCON_LEVEL5_TYPE, + DILITHIUM_LEVEL2_TYPE, + DILITHIUM_LEVEL3_TYPE, + DILITHIUM_LEVEL5_TYPE, + ML_DSA_LEVEL2_TYPE, + ML_DSA_LEVEL3_TYPE, + ML_DSA_LEVEL5_TYPE, + SPHINCS_FAST_LEVEL1_TYPE, + SPHINCS_FAST_LEVEL3_TYPE, + SPHINCS_FAST_LEVEL5_TYPE, + SPHINCS_SMALL_LEVEL1_TYPE, + SPHINCS_SMALL_LEVEL3_TYPE, + SPHINCS_SMALL_LEVEL5_TYPE, + ECC_PARAM_TYPE, + CHAIN_CERT_TYPE, + PKCS7_TYPE, + TRUSTED_CERT_TYPE +}; + + +enum Ctc_Encoding { + CTC_UTF8 = 0x0c, /* utf8 */ + CTC_PRINTABLE = 0x13 /* printable */ +}; + +#ifndef WC_CTC_NAME_SIZE + #define WC_CTC_NAME_SIZE 64 +#endif +#ifndef WC_CTC_MAX_ALT_SIZE + #define WC_CTC_MAX_ALT_SIZE 16384 +#endif +#ifdef WOLFSSL_CERT_EXT + #ifndef WC_CTC_MAX_CRLINFO_SZ + #define WC_CTC_MAX_CRLINFO_SZ 200 + #endif +#endif + +enum Ctc_Misc { + CTC_COUNTRY_SIZE = 2, + CTC_NAME_SIZE = WC_CTC_NAME_SIZE, + CTC_DATE_SIZE = 32, + CTC_MAX_ALT_SIZE = WC_CTC_MAX_ALT_SIZE, /* may be huge, default: 16384 */ + CTC_SERIAL_SIZE = 20, + CTC_GEN_SERIAL_SZ = 16, + CTC_FILETYPE_ASN1 = 2, + CTC_FILETYPE_PEM = 1, + CTC_FILETYPE_DEFAULT = 2, +#ifdef WOLFSSL_CERT_EXT + /* AKID could contains: hash + (Option) AuthCertIssuer,AuthCertSerialNum + * We support only hash */ + CTC_MAX_SKID_SIZE = 32, /* SHA256_DIGEST_SIZE */ + CTC_MAX_AKID_SIZE = 32, /* SHA256_DIGEST_SIZE */ + CTC_MAX_CERTPOL_SZ = 200, /* RFC 5280 Section 4.2.1.4 */ + CTC_MAX_CERTPOL_NB = 2, /* Max number of Certificate Policy */ + CTC_MAX_CRLINFO_SZ = WC_CTC_MAX_CRLINFO_SZ, /* Arbitrary size that should be + * enough for at least two + * distribution points. */ +#endif /* WOLFSSL_CERT_EXT */ + WOLF_ENUM_DUMMY_LAST_ELEMENT(Ctc_Misc) +}; + +/* DER buffer */ +typedef struct DerBuffer { + byte* buffer; + void* heap; + word32 length; + int type; /* enum CertType */ + int dynType; /* DYNAMIC_TYPE_* */ +} DerBuffer; + +typedef struct WOLFSSL_ASN1_TIME { + unsigned char data[CTC_DATE_SIZE]; /* date bytes */ + int length; + int type; +} WOLFSSL_ASN1_TIME; + +enum { + IV_SZ = 32, /* max iv sz */ +#ifdef OPENSSL_ALL + NAME_SZ = 160, /* larger max one line, allows for longer + encryption password support */ +#else + NAME_SZ = 80, /* max one line */ +#endif + + PEM_PASS_READ = 0, + PEM_PASS_WRITE = 1 +}; + +typedef int (wc_pem_password_cb)(char* passwd, int sz, int rw, void* userdata); +#ifndef OPENSSL_COEXIST +/* In the past, wc_pem_password_cb was called pem_password_cb, which is the same + * name as an identical typedef in OpenSSL. We don't want to break existing code + * that uses the name pem_password_cb, so we define it here as a macro alias for + * wc_pem_password_cb. In cases where a user needs to use both OpenSSL and + * wolfSSL headers in the same code, they should define OPENSSL_COEXIST to + * avoid errors stemming from the typedef being declared twice. */ +#define pem_password_cb wc_pem_password_cb +#endif + +typedef struct EncryptedInfo { + long consumed; /* tracks PEM bytes consumed */ + +#ifdef WOLFSSL_ENCRYPTED_KEYS + wc_pem_password_cb* passwd_cb; + void* passwd_userdata; + + int cipherType; + word32 keySz; + word32 ivSz; /* salt or encrypted IV size */ + + char name[NAME_SZ]; /* cipher name, such as "DES-CBC" */ + byte iv[IV_SZ]; /* salt or encrypted IV */ + + WC_BITFIELD set:1; /* if encryption set */ +#endif +} EncryptedInfo; + + +#define WOLFSSL_ASN1_INTEGER_MAX 20 +typedef struct WOLFSSL_ASN1_INTEGER { + /* size can be increased set at 20 for tag, length then to hold at least 16 + * byte type */ + unsigned char intData[WOLFSSL_ASN1_INTEGER_MAX]; + /* ASN_INTEGER | LENGTH | hex of number */ + unsigned char negative; /* negative number flag */ + + unsigned char* data; + unsigned int dataMax; /* max size of data buffer */ + WC_BITFIELD isDynamic:1; /* flag for if data pointer dynamic (1 is yes 0 is no) */ + + int length; /* Length of DER encoding. */ + int type; /* ASN.1 type. Includes negative flag. */ +} WOLFSSL_ASN1_INTEGER; + + +#if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT) +#ifdef WOLFSSL_EKU_OID + #ifndef CTC_MAX_EKU_NB + #define CTC_MAX_EKU_NB 1 + #endif + #ifndef CTC_MAX_EKU_OID_SZ + #define CTC_MAX_EKU_OID_SZ 30 + #endif +#else + #undef CTC_MAX_EKU_OID_SZ + #define CTC_MAX_EKU_OID_SZ 0 +#endif +#endif /* WOLFSSL_CERT_GEN || WOLFSSL_CERT_EXT */ + +#ifdef WOLFSSL_MULTI_ATTRIB +#ifndef CTC_MAX_ATTRIB + #define CTC_MAX_ATTRIB 4 +#endif + +/* ASN Encoded Name field */ +typedef struct NameAttrib { + int sz; /* actual string value length */ + int id; /* id of name */ + int type; /* enc of name */ + char value[CTC_NAME_SIZE]; /* name */ +} NameAttrib; +#endif /* WOLFSSL_MULTI_ATTRIB */ + +#ifdef WOLFSSL_CUSTOM_OID +typedef struct CertOidField { + byte* oid; + byte* val; + int oidSz; + int valSz; + char enc; +} CertOidField; + +typedef struct CertExtension { + char* oid; + byte crit; + byte* val; + int valSz; +} CertExtension; +#endif + +#if defined(WOLFSSL_CERT_GEN) || defined(OPENSSL_EXTRA) || \ + defined(OPENSSL_EXTRA_X509_SMALL) || defined(WOLFSSL_CERT_EXT) || \ + defined(WOLFSSL_CERT_REQ) +typedef struct CertName { + char country[CTC_NAME_SIZE]; + char countryEnc; + char state[CTC_NAME_SIZE]; + char stateEnc; + char street[CTC_NAME_SIZE]; + char streetEnc; + char locality[CTC_NAME_SIZE]; + char localityEnc; + char sur[CTC_NAME_SIZE]; + char surEnc; +#ifdef WOLFSSL_CERT_NAME_ALL + char givenName[CTC_NAME_SIZE]; + char givenNameEnc; + char initials[CTC_NAME_SIZE]; + char initialsEnc; + char dnQualifier[CTC_NAME_SIZE]; + char dnQualifierEnc; + char dnName[CTC_NAME_SIZE]; + char dnNameEnc; +#endif /* WOLFSSL_CERT_NAME_ALL */ + char org[CTC_NAME_SIZE]; + char orgEnc; + char unit[CTC_NAME_SIZE]; + char unitEnc; + char commonName[CTC_NAME_SIZE]; + char commonNameEnc; + char serialDev[CTC_NAME_SIZE]; + char serialDevEnc; + char userId[CTC_NAME_SIZE]; + char userIdEnc; + char postalCode[CTC_NAME_SIZE]; + char postalCodeEnc; +#ifdef WOLFSSL_CERT_EXT + char busCat[CTC_NAME_SIZE]; + char busCatEnc; + char joiC[CTC_NAME_SIZE]; + char joiCEnc; + char joiSt[CTC_NAME_SIZE]; + char joiStEnc; +#endif + char email[CTC_NAME_SIZE]; /* !!!! email has to be last !!!! */ +#ifdef WOLFSSL_MULTI_ATTRIB + NameAttrib name[CTC_MAX_ATTRIB]; +#endif +#ifdef WOLFSSL_CUSTOM_OID + CertOidField custom; +#endif +} CertName; +#endif /* WOLFSSL_CERT_GEN || OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL*/ + +#ifndef NUM_CUSTOM_EXT +#define NUM_CUSTOM_EXT 16 +#endif /* NUM_CUSTOM_EXT */ + +/* for user to fill for certificate generation */ +typedef struct Cert { + int version; /* x509 version */ + byte serial[CTC_SERIAL_SIZE]; /* serial number */ + int serialSz; /* serial size */ + int sigType; /* signature algo type */ +#if defined(WOLFSSL_CERT_GEN) || defined(OPENSSL_EXTRA) \ + || defined(OPENSSL_EXTRA_X509_SMALL) + CertName issuer; /* issuer info */ + CertName subject; /* subject info */ +#endif /* WOLFSSL_CERT_GEN || OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ + int daysValid; /* validity days */ + int selfSigned; /* self signed flag */ + int isCA; /* is this going to be a CA */ + byte pathLen; /* max depth of valid certification + * paths that include this cert */ + /* internal use only */ + int bodySz; /* pre sign total size */ + int keyType; /* public key type of subject */ +#ifdef WOLFSSL_ALT_NAMES + byte altNames[CTC_MAX_ALT_SIZE]; /* altNames copy */ + int altNamesSz; /* altNames size in bytes */ +#endif + byte beforeDate[CTC_DATE_SIZE]; /* before date copy */ + int beforeDateSz; /* size of copy */ + byte afterDate[CTC_DATE_SIZE]; /* after date copy */ + int afterDateSz; /* size of copy */ +#ifdef WOLFSSL_CERT_EXT + byte skid[CTC_MAX_SKID_SIZE]; /* Subject Key Identifier */ + int skidSz; /* SKID size in bytes */ + byte akid[CTC_MAX_AKID_SIZE +#ifdef WOLFSSL_AKID_NAME + + sizeof(CertName) + CTC_SERIAL_SIZE +#endif + ]; /* Authority Key + * Identifier */ + int akidSz; /* AKID size in bytes */ +#ifdef WOLFSSL_AKID_NAME + byte rawAkid; /* Set to true if akid is a + * AuthorityKeyIdentifier object. + * Set to false if akid is just a + * KeyIdentifier object. */ +#endif + word16 keyUsage; /* Key Usage */ + byte extKeyUsage; /* Extended Key Usage */ +#ifndef IGNORE_NETSCAPE_CERT_TYPE + byte nsCertType; /* Netscape Certificate Type */ +#endif +#ifdef WOLFSSL_EKU_OID + /* Extended Key Usage OIDs */ + byte extKeyUsageOID[CTC_MAX_EKU_NB][CTC_MAX_EKU_OID_SZ]; + byte extKeyUsageOIDSz[CTC_MAX_EKU_NB]; +#endif + char certPolicies[CTC_MAX_CERTPOL_NB][CTC_MAX_CERTPOL_SZ]; + word16 certPoliciesNb; /* Number of Cert Policy */ + byte crlInfo[CTC_MAX_CRLINFO_SZ]; /* CRL Distribution points */ + int crlInfoSz; +#endif +#if defined(WOLFSSL_CERT_EXT) || defined(OPENSSL_EXTRA) || \ + defined(WOLFSSL_CERT_REQ) + byte issRaw[sizeof(CertName)]; /* raw issuer info */ + byte sbjRaw[sizeof(CertName)]; /* raw subject info */ +#endif +#ifdef WOLFSSL_DUAL_ALG_CERTS + /* These will not point to managed buffers. They will point to buffers that + * are managed by others. No cleanup necessary. */ + /* Subject Alternative Public Key Info */ + byte *sapkiDer; + int sapkiLen; + byte sapkiCrit; + /* Alternative Signature Algorithm */ + byte *altSigAlgDer; + int altSigAlgLen; + byte altSigAlgCrit; + /* Alternative Signature Value */ + byte *altSigValDer; + int altSigValLen; + byte altSigValCrit; +#endif /* WOLFSSL_DUAL_ALG_CERTS */ +#ifdef WOLFSSL_CERT_REQ + char challengePw[CTC_NAME_SIZE]; + char unstructuredName[CTC_NAME_SIZE]; + int challengePwPrintableString; /* encode as PrintableString */ +#endif /* WOLFSSL_CERT_REQ */ +#ifdef WOLFSSL_CUSTOM_OID + /* user oid and value to go in req extensions */ + CertOidField extCustom; + + /* Extensions to go into X.509 certificates */ + CertExtension customCertExt[NUM_CUSTOM_EXT]; + int customCertExtCount; +#endif /* WOLFSSL_CUSTOM_OID */ + void* decodedCert; /* internal DecodedCert allocated from heap */ + byte* der; /* Pointer to buffer of current DecodedCert cache */ + void* heap; /* heap hint */ + WC_BITFIELD basicConstSet:1; /* Indicator for when Basic Constraint is set */ + byte basicConstCrit; /* Indicator of criticality of Basic Constraints extension */ +#ifdef WOLFSSL_ALLOW_ENCODING_CA_FALSE + WC_BITFIELD isCaSet:1; /* Indicator for when isCA is set */ +#endif + WC_BITFIELD pathLenSet:1; /* Indicator for when path length is set */ +#ifdef WOLFSSL_ALT_NAMES + WC_BITFIELD altNamesCrit:1; /* Indicator of criticality of SAN extension */ +#endif +} Cert; + + +/* Initialize and Set Certificate defaults: + version = 3 (0x2) + serial = 0 (Will be randomly generated) + sigType = SHA_WITH_RSA + issuer = blank + daysValid = 500 + selfSigned = 1 (true) use subject as issuer + subject = blank + isCA = 0 (false) + keyType = RSA_KEY (default) +*/ +WOLFSSL_ABI WOLFSSL_API int wc_InitCert(Cert* cert); +WOLFSSL_ABI WOLFSSL_API Cert* wc_CertNew(void* heap); +WOLFSSL_ABI WOLFSSL_API void wc_CertFree(Cert* cert); +WOLFSSL_API int wc_InitCert_ex(Cert* cert, void* heap, int devId); +WOLFSSL_API int wc_MakeCert_ex(Cert* cert, byte* derBuffer, word32 derSz, + int keyType, void* key, WC_RNG* rng); +WOLFSSL_ABI +WOLFSSL_API int wc_MakeCert(Cert* cert, byte* derBuffer, word32 derSz, + RsaKey* rsaKey, ecc_key* eccKey, WC_RNG* rng); +#ifdef WOLFSSL_CERT_REQ + WOLFSSL_API int wc_MakeCertReq_ex(Cert* cert, byte* derBuffer, word32 derSz, + int keyType, void* key); + WOLFSSL_ABI + WOLFSSL_API int wc_MakeCertReq(Cert* cert, byte* derBuffer, word32 derSz, + RsaKey* rsaKey, ecc_key* eccKey); +#endif +WOLFSSL_API int wc_SignCert_ex(int requestSz, int sType, byte* buf, + word32 buffSz, int keyType, void* key, + WC_RNG* rng); +WOLFSSL_API int wc_SignCert(int requestSz, int sType, byte* buf, word32 buffSz, + RsaKey* rsaKey, ecc_key* eccKey, WC_RNG* rng); +#ifdef WOLFSSL_DUAL_ALG_CERTS +WOLFSSL_API int wc_MakeSigWithBitStr(byte *sig, int sigSz, int sType, byte* buf, + word32 bufSz, int keyType, void* key, + WC_RNG* rng); +#endif +WOLFSSL_ABI +WOLFSSL_API int wc_MakeSelfCert(Cert* cert, byte* buf, word32 buffSz, + RsaKey* key, WC_RNG* rng); +WOLFSSL_ABI WOLFSSL_API int wc_SetIssuer(Cert* cert, const char* issuerFile); +WOLFSSL_ABI WOLFSSL_API int wc_SetSubject(Cert* cert, const char* subjectFile); +#ifdef WOLFSSL_ALT_NAMES + WOLFSSL_ABI WOLFSSL_API int wc_SetAltNames(Cert* cert, const char* file); +#endif + +#ifdef WOLFSSL_CERT_GEN_CACHE +WOLFSSL_ABI WOLFSSL_API void wc_SetCert_Free(Cert* cert); +#endif + +WOLFSSL_ABI +WOLFSSL_API int wc_SetIssuerBuffer(Cert* cert, const byte* der, int derSz); +WOLFSSL_ABI +WOLFSSL_API int wc_SetSubjectBuffer(Cert* cert, const byte* der, int derSz); +WOLFSSL_ABI +WOLFSSL_API int wc_SetAltNamesBuffer(Cert* cert, const byte* der, int derSz); +WOLFSSL_ABI +WOLFSSL_API int wc_SetDatesBuffer(Cert* cert, const byte* der, int derSz); + +#ifndef NO_ASN_TIME +WOLFSSL_API int wc_GetCertDates(Cert* cert, struct tm* before, + struct tm* after); +#endif + +#ifdef WOLFSSL_CERT_EXT +WOLFSSL_API int wc_SetAuthKeyIdFromPublicKey_ex(Cert *cert, int keyType, + void* key); +WOLFSSL_API int wc_SetAuthKeyIdFromPublicKey(Cert *cert, RsaKey *rsakey, + ecc_key *eckey); +WOLFSSL_API int wc_SetAuthKeyIdFromCert(Cert *cert, const byte *der, int derSz); +WOLFSSL_API int wc_SetAuthKeyId(Cert *cert, const char* file); +WOLFSSL_API int wc_SetSubjectKeyIdFromPublicKey_ex(Cert *cert, int keyType, + void* key); +WOLFSSL_API int wc_SetSubjectKeyIdFromPublicKey(Cert *cert, RsaKey *rsakey, + ecc_key *eckey); +WOLFSSL_API int wc_SetSubjectKeyId(Cert *cert, const char* file); +WOLFSSL_ABI WOLFSSL_API int wc_GetSubjectRaw(byte **subjectRaw, Cert *cert); +WOLFSSL_ABI +WOLFSSL_API int wc_SetSubjectRaw(Cert* cert, const byte* der, int derSz); +WOLFSSL_ABI +WOLFSSL_API int wc_SetIssuerRaw(Cert* cert, const byte* der, int derSz); + +/* Set the KeyUsage. + * Value is a string separated tokens with ','. Accepted tokens are : + * digitalSignature,nonRepudiation,contentCommitment,keyCertSign,cRLSign, + * dataEncipherment,keyAgreement,keyEncipherment,encipherOnly and decipherOnly. + * + * nonRepudiation and contentCommitment are for the same usage. + */ +WOLFSSL_API int wc_SetKeyUsage(Cert *cert, const char *value); + +/* Set ExtendedKeyUsage + * Value is a string separated tokens with ','. Accepted tokens are : + * any,serverAuth,clientAuth,codeSigning,emailProtection,timeStamping,OCSPSigning + */ +WOLFSSL_API int wc_SetExtKeyUsage(Cert *cert, const char *value); + + +#ifdef WOLFSSL_EKU_OID +/* Set ExtendedKeyUsage with unique OID + * oid is expected to be in byte representation + */ +WOLFSSL_API int wc_SetExtKeyUsageOID(Cert *cert, const char *oid, word32 sz, + byte idx, void* heap); +#endif /* WOLFSSL_EKU_OID */ + +#if defined(WOLFSSL_ASN_TEMPLATE) && defined(WOLFSSL_CUSTOM_OID) && \ + defined(HAVE_OID_ENCODING) +WOLFSSL_API int wc_SetCustomExtension(Cert *cert, int critical, const char *oid, + const byte *der, word32 derSz); +#endif + +#endif /* WOLFSSL_CERT_EXT */ + +WOLFSSL_API int wc_GetDateInfo(const byte* certDate, int certDateSz, + const byte** date, byte* format, int* length); +#ifndef NO_ASN_TIME +WOLFSSL_API int wc_GetDateAsCalendarTime(const byte* date, int length, + byte format, struct tm* timearg); +#endif + +#if defined(WOLFSSL_PEM_TO_DER) || defined(WOLFSSL_DER_TO_PEM) + + WOLFSSL_API int wc_PemGetHeaderFooter(int type, const char** header, + const char** footer); + +#endif + +WOLFSSL_API int wc_AllocDer(DerBuffer** pDer, word32 length, int type, void* heap); +WOLFSSL_API void wc_FreeDer(DerBuffer** pDer); + +#ifdef WOLFSSL_PEM_TO_DER + WOLFSSL_API int wc_PemToDer(const unsigned char* buff, long longSz, int type, + DerBuffer** pDer, void* heap, EncryptedInfo* info, int* keyFormat); + + WOLFSSL_API int wc_KeyPemToDer(const unsigned char* pem, int pemSz, + unsigned char* buff, int buffSz, const char* pass); + WOLFSSL_API int wc_CertPemToDer(const unsigned char* pem, int pemSz, + unsigned char* buff, int buffSz, int type); +#endif /* WOLFSSL_PEM_TO_DER */ + +#if defined(WOLFSSL_CERT_EXT) || defined(WOLFSSL_PUB_PEM_TO_DER) + #if !defined(NO_FILESYSTEM) && defined(WOLFSSL_PEM_TO_DER) + WOLFSSL_API int wc_PemPubKeyToDer(const char* fileName, + unsigned char* derBuf, int derSz); + WOLFSSL_API int wc_PemPubKeyToDer_ex(const char* fileName, DerBuffer** der); + #endif + + WOLFSSL_API int wc_PubKeyPemToDer(const unsigned char* pem, int pemSz, + unsigned char* buff, int buffSz); +#endif /* WOLFSSL_CERT_EXT || WOLFSSL_PUB_PEM_TO_DER */ + +#ifdef WOLFSSL_CERT_GEN + #if !defined(NO_FILESYSTEM) && defined(WOLFSSL_PEM_TO_DER) + WOLFSSL_API int wc_PemCertToDer(const char* fileName, + unsigned char* derBuf, int derSz); + WOLFSSL_API int wc_PemCertToDer_ex(const char* fileName, DerBuffer** der); + #endif +#endif /* WOLFSSL_CERT_GEN */ + +#ifdef WOLFSSL_DER_TO_PEM + WOLFSSL_ABI + WOLFSSL_API int wc_DerToPem(const byte* der, word32 derSz, byte* output, + word32 outSz, int type); + WOLFSSL_API int wc_DerToPemEx(const byte* der, word32 derSz, byte* output, + word32 outSz, byte *cipher_info, int type); +#endif + +WOLFSSL_API word32 wc_PkcsPad(byte* buf, word32 sz, word32 blockSz); + +#ifndef NO_RSA + WOLFSSL_API int wc_RsaPublicKeyDecode_ex(const byte* input, word32* inOutIdx, + word32 inSz, const byte** n, word32* nSz, const byte** e, word32* eSz); + /* For FIPS v1/v2 and selftest this is in rsa.h */ + #if (!defined(HAVE_SELFTEST) || \ + (defined(HAVE_SELFTEST) && defined(WOLFSSL_CERT_GEN) && \ + !defined(WOLFSSL_KEY_GEN))) && \ + (!defined(HAVE_FIPS) || \ + !defined(HAVE_FIPS_VERSION) || \ + ((HAVE_FIPS_VERSION > 2) && \ + (! ((HAVE_FIPS_VERSION == 5) && (HAVE_FIPS_VERSION_MINOR == 0))))) + WOLFSSL_API int wc_RsaKeyToPublicDer(RsaKey* key, byte* output, word32 inLen); + #endif + WOLFSSL_API int wc_RsaPublicKeyDerSize(RsaKey* key, int with_header); + WOLFSSL_API int wc_RsaKeyToPublicDer_ex(RsaKey* key, byte* output, word32 inLen, + int with_header); + + /* For FIPS v1/v2 and selftest rsa.h is replaced. */ + #if defined(HAVE_SELFTEST) || (defined(HAVE_FIPS) && \ + (!defined(HAVE_FIPS_VERSION) || (FIPS_VERSION_LE(5,2)))) + WOLFSSL_API int wc_RsaPrivateKeyValidate(const byte* input, + word32* inOutIdx, int* keySz, word32 inSz); + #endif +#endif + +#ifndef NO_DSA + /* DSA parameter DER helper functions */ + WOLFSSL_API int wc_DsaParamsDecode(const byte* input, word32* inOutIdx, DsaKey* key, + word32 inSz); + WOLFSSL_API int wc_DsaKeyToParamsDer(DsaKey* key, byte* output, + word32 inLen); + WOLFSSL_API int wc_DsaKeyToParamsDer_ex(DsaKey* key, byte* output, + word32* inLen); +#endif + +#if !defined(NO_DH) && defined(WOLFSSL_DH_EXTRA) +WOLFSSL_LOCAL int wc_DhKeyToDer(DhKey* key, byte* output, word32* outSz, int exportPriv); +WOLFSSL_API int wc_DhParamsToDer(DhKey* key, byte* out, word32* outSz); +WOLFSSL_API int wc_DhPubKeyToDer(DhKey* key, byte* out, word32* outSz); +WOLFSSL_API int wc_DhPrivKeyToDer(DhKey* key, byte* out, word32* outSz); +#endif + +#ifdef HAVE_ECC + /* private key helpers */ + WOLFSSL_ABI + WOLFSSL_API int wc_EccPrivateKeyDecode(const byte* input, word32* inOutIdx, + ecc_key* key, word32 inSz); + WOLFSSL_LOCAL int wc_BuildEccKeyDer(ecc_key* key, byte* output, word32 *inLen, + int pubIn, int curveIn); + WOLFSSL_ABI + WOLFSSL_API int wc_EccKeyToDer(ecc_key* key, byte* output, word32 inLen); + WOLFSSL_API int wc_EccPrivateKeyToDer(ecc_key* key, byte* output, + word32 inLen); + WOLFSSL_API int wc_EccKeyDerSize(ecc_key* key, int pub); + WOLFSSL_API int wc_EccPrivateKeyToPKCS8(ecc_key* key, byte* output, + word32* outLen); + WOLFSSL_API int wc_EccKeyToPKCS8(ecc_key* key, byte* output, + word32* outLen); + + /* public key helper */ + WOLFSSL_ABI + WOLFSSL_API int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx, + ecc_key* key, word32 inSz); + WOLFSSL_ABI WOLFSSL_API int wc_EccPublicKeyToDer(ecc_key* key, byte* output, + word32 inLen, int with_AlgCurve); + WOLFSSL_API int wc_EccPublicKeyToDer_ex(ecc_key* key, byte* output, + word32 inLen, int with_AlgCurve, + int comp); + WOLFSSL_API int wc_EccPublicKeyDerSize(ecc_key* key, int with_AlgCurve); +#endif + +#ifdef HAVE_ED25519 +#ifdef HAVE_ED25519_KEY_IMPORT +WOLFSSL_API int wc_Ed25519PrivateKeyDecode(const byte* input, word32* inOutIdx, + ed25519_key* key, word32 inSz); +WOLFSSL_API int wc_Ed25519PublicKeyDecode(const byte* input, word32* inOutIdx, + ed25519_key* key, word32 inSz); +#endif +#ifdef HAVE_ED25519_KEY_EXPORT +WOLFSSL_API int wc_Ed25519KeyToDer(ed25519_key* key, byte* output, + word32 inLen); +WOLFSSL_API int wc_Ed25519PrivateKeyToDer(ed25519_key* key, byte* output, + word32 inLen); +WOLFSSL_API int wc_Ed25519PublicKeyToDer(ed25519_key* key, byte* output, + word32 inLen, int withAlg); +#endif +#endif /* HAVE_ED25519 */ + +#ifdef HAVE_CURVE25519 +#ifdef HAVE_CURVE25519_KEY_IMPORT +WOLFSSL_API int wc_Curve25519PrivateKeyDecode( + const byte* input, word32* inOutIdx, curve25519_key* key, word32 inSz); +WOLFSSL_API int wc_Curve25519PublicKeyDecode( + const byte* input, word32* inOutIdx, curve25519_key* key, word32 inSz); +WOLFSSL_API int wc_Curve25519KeyDecode(const byte *input, word32 *inOutIdx, + curve25519_key *key, word32 inSz); +#endif +#ifdef HAVE_CURVE25519_KEY_EXPORT +WOLFSSL_API int wc_Curve25519PrivateKeyToDer( + curve25519_key* key, byte* output, word32 inLen); +WOLFSSL_API int wc_Curve25519PublicKeyToDer( + curve25519_key* key, byte* output, word32 inLen, int withAlg); +WOLFSSL_API int wc_Curve25519KeyToDer(curve25519_key* key, byte* output, + word32 inLen, int withAlg); +#endif +#endif /* HAVE_CURVE25519 */ + +#ifdef HAVE_ED448 +#ifdef HAVE_ED448_KEY_IMPORT +WOLFSSL_API int wc_Ed448PrivateKeyDecode( + const byte* input, word32* inOutIdx, ed448_key* key, word32 inSz); +WOLFSSL_API int wc_Ed448PublicKeyDecode( + const byte* input, word32* inOutIdx, ed448_key* key, word32 inSz); +#endif +#ifdef HAVE_ED448_KEY_EXPORT +WOLFSSL_API int wc_Ed448KeyToDer(ed448_key* key, byte* output, word32 inLen); +WOLFSSL_API int wc_Ed448PrivateKeyToDer( + ed448_key* key, byte* output, word32 inLen); +WOLFSSL_API int wc_Ed448PublicKeyToDer( + ed448_key* key, byte* output, word32 inLen, int withAlg); +#endif +#endif /* HAVE_ED448 */ + +#ifdef HAVE_CURVE448 +#ifdef HAVE_CURVE448_KEY_IMPORT +WOLFSSL_API int wc_Curve448PrivateKeyDecode(const byte* input, word32* inOutIdx, + curve448_key* key, word32 inSz); +WOLFSSL_API int wc_Curve448PublicKeyDecode(const byte* input, word32* inOutIdx, + curve448_key* key, word32 inSz); +#endif +#ifdef HAVE_CURVE448_KEY_EXPORT +WOLFSSL_API int wc_Curve448PrivateKeyToDer(curve448_key* key, byte* output, + word32 inLen); +WOLFSSL_API int wc_Curve448PublicKeyToDer(curve448_key* key, byte* output, + word32 inLen, int withAlg); +#endif +#endif /* HAVE_CURVE448 */ + + +/* DER encode signature */ +WOLFSSL_API word32 wc_EncodeSignature(byte* out, const byte* digest, + word32 digSz, int hashOID); +WOLFSSL_API int wc_GetCTC_HashOID(int type); + +WOLFSSL_API int wc_GetPkcs8TraditionalOffset(byte* input, + word32* inOutIdx, word32 sz); +WOLFSSL_API int wc_CreatePKCS8Key(byte* out, word32* outSz, + byte* key, word32 keySz, int algoID, const byte* curveOID, + word32 oidSz); +WOLFSSL_API int wc_EncryptPKCS8Key_ex(byte* key, word32 keySz, byte* out, + word32* outSz, const char* password, int passwordSz, int vPKCS, + int pbeOid, int encAlgId, byte* salt, word32 saltSz, int itt, + int hmacOid, WC_RNG* rng, void* heap); +WOLFSSL_API int wc_EncryptPKCS8Key(byte* key, word32 keySz, byte* out, word32* outSz, + const char* password, int passwordSz, int vPKCS, int pbeOid, + int encAlgId, byte* salt, word32 saltSz, int itt, WC_RNG* rng, + void* heap); +WOLFSSL_API int wc_DecryptPKCS8Key(byte* input, word32 sz, const char* password, + int passwordSz); +WOLFSSL_API int wc_CreateEncryptedPKCS8Key(byte* key, word32 keySz, byte* out, + word32* outSz, const char* password, int passwordSz, int vPKCS, + int pbeOid, int encAlgId, byte* salt, word32 saltSz, int itt, + WC_RNG* rng, void* heap); + +#ifndef NO_ASN_TIME +/* Time */ +/* Returns seconds (Epoch/UTC) + * timePtr: is "time_t", which is typically "long" + * Example: + long lTime; + rc = wc_GetTime(&lTime, (word32)sizeof(lTime)); +*/ +WOLFSSL_API int wc_GetTime(void* timePtr, word32 timeSize); + +typedef time_t (*wc_time_cb)(time_t* t); +WOLFSSL_API int wc_SetTimeCb(wc_time_cb f); +WOLFSSL_API time_t wc_Time(time_t* t); +#endif + +#ifdef WOLFSSL_ENCRYPTED_KEYS + WOLFSSL_API int wc_EncryptedInfoGet(EncryptedInfo* info, + const char* cipherInfo); +#endif + + +#ifdef WOLFSSL_CERT_PIV + +typedef struct _wc_CertPIV { + const byte* cert; + word32 certSz; + const byte* certErrDet; + word32 certErrDetSz; + const byte* nonce; /* Identiv Only */ + word32 nonceSz; /* Identiv Only */ + const byte* signedNonce; /* Identiv Only */ + word32 signedNonceSz; /* Identiv Only */ + + /* flags */ + WC_BITFIELD compression:2; + WC_BITFIELD isX509:1; + WC_BITFIELD isIdentiv:1; +} wc_CertPIV; + +WOLFSSL_API int wc_ParseCertPIV(wc_CertPIV* cert, const byte* buf, word32 totalSz); +#endif /* WOLFSSL_CERT_PIV */ + +/* Forward declaration needed, as DecodedCert is defined in asn.h.*/ +struct DecodedCert; + +WOLFSSL_API void wc_InitDecodedCert( + struct DecodedCert* cert, const byte* source, word32 inSz, void* heap); +WOLFSSL_API void wc_FreeDecodedCert(struct DecodedCert* cert); +WOLFSSL_API int wc_ParseCert( + struct DecodedCert* cert, int type, int verify, void* cm); + +WOLFSSL_API int wc_GetPubKeyDerFromCert(struct DecodedCert* cert, + byte* derKey, word32* derKeySz); +WOLFSSL_API int wc_GetSubjectPubKeyInfoDerFromCert(const byte* certDer, + word32 certDerSz, + byte* pubKeyDer, + word32* pubKeyDerSz); + +#ifdef WOLFSSL_FPKI +WOLFSSL_API int wc_GetUUIDFromCert(struct DecodedCert* cert, + byte* uuid, word32* uuidSz); +WOLFSSL_API int wc_GetFASCNFromCert(struct DecodedCert* cert, + byte* fascn, word32* fascnSz); +#endif /* WOLFSSL_FPKI */ + +#ifdef WOLFSSL_DUAL_ALG_CERTS +WOLFSSL_API int wc_GeneratePreTBS(struct DecodedCert* cert, byte *der, + int derSz); +#endif + +#if defined(WOLFSSL_ACERT) +/* Forward declaration needed, as DecodedAcert is defined in asn.h.*/ +struct DecodedAcert; +WOLFSSL_API void wc_InitDecodedAcert(struct DecodedAcert* acert, + const byte* source, word32 inSz, + void* heap); +WOLFSSL_API void wc_FreeDecodedAcert(struct DecodedAcert * acert); +WOLFSSL_API int wc_ParseX509Acert(struct DecodedAcert* acert, int verify); +WOLFSSL_API int wc_VerifyX509Acert(const byte* acert, word32 acertSz, + const byte* pubKey, word32 pubKeySz, + int pubKeyOID, void * heap); +#endif /* WOLFSSL_ACERT */ + +#if !defined(XFPRINTF) || defined(NO_FILESYSTEM) || \ + defined(NO_STDIO_FILESYSTEM) && defined(WOLFSSL_ASN_PRINT) +#undef WOLFSSL_ASN_PRINT +#endif + +#ifdef WOLFSSL_ASN_PRINT + +enum Asn1PrintOpt { + /* Offset into DER/BER data to start decoding from. */ + ASN1_PRINT_OPT_OFFSET, + /* Length of DER/BER encoding to parse. */ + ASN1_PRINT_OPT_LENGTH, + /* Number of spaces to indent for each change in depth. */ + ASN1_PRINT_OPT_INDENT, + /* Draw branches instead of indenting. */ + ASN1_PRINT_OPT_DRAW_BRANCH, + /* Show raw data of primitive types as octets. */ + ASN1_PRINT_OPT_SHOW_DATA, + /* Show header data as octets. */ + ASN1_PRINT_OPT_SHOW_HEADER_DATA, + /* Show the wolfSSL OID value for OBJECT_ID. */ + ASN1_PRINT_OPT_SHOW_OID, + /* Don't show text representations of primitive types. */ + ASN1_PRINT_OPT_SHOW_NO_TEXT, + /* Don't show dump text representations of primitive types. */ + ASN1_PRINT_OPT_SHOW_NO_DUMP_TEXT +}; + +/* ASN.1 print options. */ +typedef struct Asn1PrintOptions { + /* Offset into DER/BER encoding to start parsing from. */ + word32 offset; + /* Length of DER/BER encoding to parse. */ + word32 length; + /* Number of spaces to indent for each change in depth. */ + word8 indent; + /* Draw branches instead of indenting. */ + WC_BITFIELD draw_branch:1; + /* Show raw data of primitive types as octets. */ + WC_BITFIELD show_data:1; + /* Show header data as octets. */ + WC_BITFIELD show_header_data:1; + /* Show the wolfSSL OID value for OBJECT_ID. */ + WC_BITFIELD show_oid:1; + /* Don't show text representations of primitive types. */ + WC_BITFIELD show_no_text:1; + /* Don't show dump text representations of primitive types. */ + WC_BITFIELD show_no_dump_text:1; +} Asn1PrintOptions; + +/* ASN.1 item data. */ +typedef struct Asn1Item { + /* Tag of current item. */ + unsigned char tag; + /* Whether current item is constructed. */ + unsigned char cons; + /* Length of data in current ASN.1 item. */ + word32 len; + /* Index into data of ASN.1 item data. */ + word32 data_idx; +} Asn1Item; + +/* Maximum supported depth of ASN.1 items. */ +#define ASN_MAX_DEPTH 16 + +typedef const char* (*Asn1OidToNameCb)(unsigned char* oid, word32 len); + +/* ASN.1 parsing state. */ +typedef struct Asn1 { + /* ASN.1 item data. */ + Asn1Item item; + /* Current depth of ASN.1 item. */ + unsigned char depth; + /* End indices of ASN.1 items at different depths. */ + word32 end_idx[ASN_MAX_DEPTH]; + + /* Buffer to print. */ + unsigned char* data; + /* Maximum number of bytes to process. */ + word32 max; + /* Starting offset of current ASN.1 item. */ + word32 offset; + /* Current offset into ASN.1 data. */ + word32 curr; + /* Next part of ASN.1 item expected. */ + unsigned char part; + + /* File pointer to print to. */ + XFILE file; + + /* Callback to get a name for an hex OID. */ + Asn1OidToNameCb nameCb; +} Asn1; + +WOLFSSL_API int wc_Asn1PrintOptions_Init(Asn1PrintOptions* opts); +WOLFSSL_API int wc_Asn1PrintOptions_Set(Asn1PrintOptions* opts, + enum Asn1PrintOpt opt, word32 val); + +WOLFSSL_API int wc_Asn1_Init(Asn1* asn1); +WOLFSSL_API int wc_Asn1_SetFile(Asn1* asn1, XFILE file); +WOLFSSL_API int wc_Asn1_SetOidToNameCb(Asn1* asn1, Asn1OidToNameCb nameCb); +WOLFSSL_API int wc_Asn1_PrintAll(Asn1* asn1, Asn1PrintOptions* opts, + unsigned char* data, word32 len); + +#endif /* WOLFSSL_ASN_PRINT */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLF_CRYPT_ASN_PUBLIC_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/blake2-impl.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/blake2-impl.h @@ -0,0 +1,155 @@ +/* + BLAKE2 reference source code package - reference C implementations + + Written in 2012 by Samuel Neves <sneves@dei.uc.pt> + + To the extent possible under law, the author(s) have dedicated all copyright + and related and neighboring rights to this software to the public domain + worldwide. This software is distributed without any warranty. + + You should have received a copy of the CC0 Public Domain Dedication along with + this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. +*/ +/* blake2-impl.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + +#ifndef WOLFCRYPT_BLAKE2_IMPL_H +#define WOLFCRYPT_BLAKE2_IMPL_H + +#include <wolfssl/wolfcrypt/types.h> + +static WC_INLINE word32 load32( const void *src ) +{ +#if defined(LITTLE_ENDIAN_ORDER) + return *( word32 * )( src ); +#else + const byte *p = ( byte * )src; + word32 w = *p++; + w |= ( word32 )( *p++ ) << 8; + w |= ( word32 )( *p++ ) << 16; + w |= ( word32 )( *p++ ) << 24; + return w; +#endif +} + +static WC_INLINE word64 load64( const void *src ) +{ +#if defined(LITTLE_ENDIAN_ORDER) + return *( word64 * )( src ); +#else + const byte *p = ( byte * )src; + word64 w = *p++; + w |= ( word64 )( *p++ ) << 8; + w |= ( word64 )( *p++ ) << 16; + w |= ( word64 )( *p++ ) << 24; + w |= ( word64 )( *p++ ) << 32; + w |= ( word64 )( *p++ ) << 40; + w |= ( word64 )( *p++ ) << 48; + w |= ( word64 )( *p++ ) << 56; + return w; +#endif +} + +static WC_INLINE void store32( void *dst, word32 w ) +{ +#if defined(LITTLE_ENDIAN_ORDER) + *( word32 * )( dst ) = w; +#else + byte *p = ( byte * )dst; + *p++ = ( byte )w; w >>= 8; + *p++ = ( byte )w; w >>= 8; + *p++ = ( byte )w; w >>= 8; + *p++ = ( byte )w; +#endif +} + +static WC_INLINE void store64( void *dst, word64 w ) +{ +#if defined(LITTLE_ENDIAN_ORDER) && !defined(WOLFSSL_GENERAL_ALIGNMENT) + *( word64 * )( dst ) = w; +#else + byte *p = ( byte * )dst; + *p++ = ( byte )w; w >>= 8; + *p++ = ( byte )w; w >>= 8; + *p++ = ( byte )w; w >>= 8; + *p++ = ( byte )w; w >>= 8; + *p++ = ( byte )w; w >>= 8; + *p++ = ( byte )w; w >>= 8; + *p++ = ( byte )w; w >>= 8; + *p++ = ( byte )w; +#endif +} + +static WC_INLINE word64 load48( const void *src ) +{ + const byte *p = ( const byte * )src; + word64 w = *p++; + w |= ( word64 )( *p++ ) << 8; + w |= ( word64 )( *p++ ) << 16; + w |= ( word64 )( *p++ ) << 24; + w |= ( word64 )( *p++ ) << 32; + w |= ( word64 )( *p++ ) << 40; + return w; +} + +static WC_INLINE void store48( void *dst, word64 w ) +{ + byte *p = ( byte * )dst; + *p++ = ( byte )w; w >>= 8; + *p++ = ( byte )w; w >>= 8; + *p++ = ( byte )w; w >>= 8; + *p++ = ( byte )w; w >>= 8; + *p++ = ( byte )w; w >>= 8; + *p++ = ( byte )w; +} + +static WC_INLINE word32 rotl32( const word32 w, const unsigned c ) +{ + return ( w << c ) | ( w >> ( 32 - c ) ); +} + +static WC_INLINE word64 rotl64( const word64 w, const unsigned c ) +{ + return ( w << c ) | ( w >> ( 64 - c ) ); +} + +static WC_INLINE word32 rotr32( const word32 w, const unsigned c ) +{ + return ( w >> c ) | ( w << ( 32 - c ) ); +} + +static WC_INLINE word64 rotr64( const word64 w, const unsigned c ) +{ + return ( w >> c ) | ( w << ( 64 - c ) ); +} + +/* prevents compiler optimizing out memset() */ +static WC_INLINE void secure_zero_memory( void *v, word64 n ) +{ + volatile byte *p = ( volatile byte * )v; + + while( n-- ) *p++ = 0; +} + +#endif /* WOLFCRYPT_BLAKE2_IMPL_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/blake2-int.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/blake2-int.h @@ -0,0 +1,174 @@ +/* + BLAKE2 reference source code package - reference C implementations + + Written in 2012 by Samuel Neves <sneves@dei.uc.pt> + + To the extent possible under law, the author(s) have dedicated all copyright + and related and neighboring rights to this software to the public domain + worldwide. This software is distributed without any warranty. + + You should have received a copy of the CC0 Public Domain Dedication along with + this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. +*/ +/* blake2-int.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + + +#ifndef WOLFCRYPT_BLAKE2_INT_H +#define WOLFCRYPT_BLAKE2_INT_H + +#include <wolfssl/wolfcrypt/types.h> + +#if defined(__cplusplus) + extern "C" { +#endif + + enum blake2s_constant + { + BLAKE2S_BLOCKBYTES = 64, + BLAKE2S_OUTBYTES = 32, + BLAKE2S_KEYBYTES = 32, + BLAKE2S_SALTBYTES = 8, + BLAKE2S_PERSONALBYTES = 8 + }; + + enum blake2b_constant + { + BLAKE2B_BLOCKBYTES = 128, + BLAKE2B_OUTBYTES = 64, + BLAKE2B_KEYBYTES = 64, + BLAKE2B_SALTBYTES = 16, + BLAKE2B_PERSONALBYTES = 16 + }; + +#pragma pack(push, 1) + typedef struct __blake2s_param + { + byte digest_length; /* 1 */ + byte key_length; /* 2 */ + byte fanout; /* 3 */ + byte depth; /* 4 */ + word32 leaf_length; /* 8 */ + byte node_offset[6];/* 14 */ + byte node_depth; /* 15 */ + byte inner_length; /* 16 */ + /* byte reserved[0]; */ + byte salt[BLAKE2S_SALTBYTES]; /* 24 */ + byte personal[BLAKE2S_PERSONALBYTES]; /* 32 */ + } blake2s_param; + + typedef struct __blake2s_state + { + word32 h[8]; + word32 t[2]; + word32 f[2]; + byte buf[2 * BLAKE2S_BLOCKBYTES]; + word32 buflen; + byte last_node; + } blake2s_state ; + + typedef struct __blake2b_param + { + byte digest_length; /* 1 */ + byte key_length; /* 2 */ + byte fanout; /* 3 */ + byte depth; /* 4 */ + word32 leaf_length; /* 8 */ + word64 node_offset; /* 16 */ + byte node_depth; /* 17 */ + byte inner_length; /* 18 */ + byte reserved[14]; /* 32 */ + byte salt[BLAKE2B_SALTBYTES]; /* 48 */ + byte personal[BLAKE2B_PERSONALBYTES]; /* 64 */ + } blake2b_param; + + typedef struct __blake2b_state + { + word64 h[8]; + word64 t[2]; + word64 f[2]; + byte buf[2 * BLAKE2B_BLOCKBYTES]; + word64 buflen; + byte last_node; + } blake2b_state; + + typedef struct __blake2sp_state + { + blake2s_state S[8][1]; + blake2s_state R[1]; + byte buf[8 * BLAKE2S_BLOCKBYTES]; + word32 buflen; + } blake2sp_state; + + typedef struct __blake2bp_state + { + blake2b_state S[4][1]; + blake2b_state R[1]; + byte buf[4 * BLAKE2B_BLOCKBYTES]; + word64 buflen; + } blake2bp_state; +#pragma pack(pop) + + /* Streaming API */ + int blake2s_init( blake2s_state *S, byte outlen ); + int blake2s_init_key( blake2s_state *S, byte outlen, const void *key, byte keylen ); + int blake2s_init_param( blake2s_state *S, const blake2s_param *P ); + int blake2s_update( blake2s_state *S, const byte *in, word32 inlen ); + int blake2s_final( blake2s_state *S, byte *out, byte outlen ); + + int blake2b_init( blake2b_state *S, byte outlen ); + int blake2b_init_key( blake2b_state *S, byte outlen, const void *key, byte keylen ); + int blake2b_init_param( blake2b_state *S, const blake2b_param *P ); + int blake2b_update( blake2b_state *S, const byte *in, word64 inlen ); + int blake2b_final( blake2b_state *S, byte *out, byte outlen ); + + int blake2sp_init( blake2sp_state *S, byte outlen ); + int blake2sp_init_key( blake2sp_state *S, byte outlen, const void *key, byte keylen ); + int blake2sp_update( blake2sp_state *S, const byte *in, word32 inlen ); + int blake2sp_final( blake2sp_state *S, byte *out, byte outlen ); + + int blake2bp_init( blake2bp_state *S, byte outlen ); + int blake2bp_init_key( blake2bp_state *S, byte outlen, const void *key, byte keylen ); + int blake2bp_update( blake2bp_state *S, const byte *in, word64 inlen ); + int blake2bp_final( blake2bp_state *S, byte *out, byte outlen ); + + /* Simple API */ + int blake2s( byte *out, const void *in, const void *key, byte outlen, word32 inlen, byte keylen ); + int blake2b( byte *out, const void *in, const void *key, byte outlen, word64 inlen, byte keylen ); + + int blake2sp( byte *out, const void *in, const void *key, byte outlen, word32 inlen, byte keylen ); + int blake2bp( byte *out, const void *in, const void *key, byte outlen, word64 inlen, byte keylen ); + + static WC_INLINE int blake2( byte *out, const void *in, const void *key, byte outlen, word64 inlen, byte keylen ) + { + return blake2b( out, in, key, outlen, inlen, keylen ); + } + + + +#if defined(__cplusplus) + } +#endif + +#endif /* WOLFCRYPT_BLAKE2_INT_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/blake2.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/blake2.h @@ -0,0 +1,102 @@ +/* blake2.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/blake2.h +*/ + +#ifndef WOLF_CRYPT_BLAKE2_H +#define WOLF_CRYPT_BLAKE2_H + +#include <wolfssl/wolfcrypt/settings.h> + +#if defined(HAVE_BLAKE2) || defined(HAVE_BLAKE2S) + +#include <wolfssl/wolfcrypt/blake2-int.h> + +/* call old functions if using fips for the sake of hmac @wc_fips */ +#ifdef HAVE_FIPS + /* Since hmac can call blake functions provide original calls */ + #define wc_InitBlake2b InitBlake2b + #define wc_Blake2bUpdate Blake2bUpdate + #define wc_Blake2bFinal Blake2bFinal +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +/* in bytes, variable digest size up to 512 bits (64 bytes) */ +enum { +#ifdef HAVE_BLAKE2B + BLAKE2B_ID = WC_HASH_TYPE_BLAKE2B, + BLAKE2B_256 = 32, /* 256 bit type, SSL default */ + WC_BLAKE2B_DIGEST_SIZE = 64, +#endif +#ifdef HAVE_BLAKE2S + BLAKE2S_ID = WC_HASH_TYPE_BLAKE2S, + BLAKE2S_256 = 32, /* 256 bit type */ + WC_BLAKE2S_DIGEST_SIZE = 32 +#endif +}; + + +#ifdef HAVE_BLAKE2B +/* BLAKE2b digest */ +typedef struct Blake2b { + blake2b_state S[1]; /* our state */ + word32 digestSz; /* digest size used on init */ +} Blake2b; +#endif + +#ifdef HAVE_BLAKE2S +/* BLAKE2s digest */ +typedef struct Blake2s { + blake2s_state S[1]; /* our state */ + word32 digestSz; /* digest size used on init */ +} Blake2s; +#endif + + +#ifdef HAVE_BLAKE2B +WOLFSSL_API int wc_InitBlake2b(Blake2b* b2b, word32 digestSz); +WOLFSSL_API int wc_InitBlake2b_WithKey(Blake2b* b2b, word32 digestSz, + const byte *key, word32 keylen); +WOLFSSL_API int wc_Blake2bUpdate(Blake2b* b2b, const byte* data, word32 sz); +WOLFSSL_API int wc_Blake2bFinal(Blake2b* b2b, byte* final, word32 requestSz); +#endif + +#ifdef HAVE_BLAKE2S +WOLFSSL_API int wc_InitBlake2s(Blake2s* b2s, word32 digestSz); +WOLFSSL_API int wc_InitBlake2s_WithKey(Blake2s* b2s, word32 digestSz, + const byte *key, word32 keylen); +WOLFSSL_API int wc_Blake2sUpdate(Blake2s* b2s, const byte* data, word32 sz); +WOLFSSL_API int wc_Blake2sFinal(Blake2s* b2s, byte* final, word32 requestSz); +#endif + + +#ifdef __cplusplus + } +#endif + +#endif /* HAVE_BLAKE2 || HAVE_BLAKE2S */ +#endif /* WOLF_CRYPT_BLAKE2_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/camellia.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/camellia.h @@ -0,0 +1,116 @@ +/* camellia.h ver 1.2.0 + * + * Copyright (c) 2006,2007 + * NTT (Nippon Telegraph and Telephone Corporation) . All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer as + * the first lines of this file unmodified. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY NTT ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL NTT BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* camellia.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/camellia.h +*/ + + +#ifndef WOLF_CRYPT_CAMELLIA_H +#define WOLF_CRYPT_CAMELLIA_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef HAVE_CAMELLIA + +#ifdef __cplusplus + extern "C" { +#endif + +enum { + WC_CAMELLIA_BLOCK_SIZE = 16 +}; + +#define WC_CAMELLIA_TABLE_BYTE_LEN 272 +#define WC_CAMELLIA_TABLE_WORD_LEN (WC_CAMELLIA_TABLE_BYTE_LEN / sizeof(word32)) + +typedef word32 WC_CAMELLIA_KEY_TABLE_TYPE[WC_CAMELLIA_TABLE_WORD_LEN]; + +typedef struct wc_Camellia { + word32 keySz; + WC_CAMELLIA_KEY_TABLE_TYPE key; + word32 reg[WC_CAMELLIA_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */ + word32 tmp[WC_CAMELLIA_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */ +} wc_Camellia; + + +WOLFSSL_API int wc_CamelliaSetKey(wc_Camellia* cam, + const byte* key, word32 len, const byte* iv); +WOLFSSL_API int wc_CamelliaSetIV(wc_Camellia* cam, const byte* iv); +WOLFSSL_API int wc_CamelliaEncryptDirect(wc_Camellia* cam, byte* out, + const byte* in); +WOLFSSL_API int wc_CamelliaDecryptDirect(wc_Camellia* cam, byte* out, + const byte* in); +WOLFSSL_API int wc_CamelliaCbcEncrypt(wc_Camellia* cam, + byte* out, const byte* in, word32 sz); +WOLFSSL_API int wc_CamelliaCbcDecrypt(wc_Camellia* cam, + byte* out, const byte* in, word32 sz); + +#ifndef OPENSSL_COEXIST + +enum { + CAMELLIA_BLOCK_SIZE = WC_CAMELLIA_BLOCK_SIZE +}; + +#define CAMELLIA_TABLE_BYTE_LEN WC_CAMELLIA_TABLE_BYTE_LEN +#define CAMELLIA_TABLE_WORD_LEN WC_CAMELLIA_TABLE_WORD_LEN + +typedef word32 KEY_TABLE_TYPE[WC_CAMELLIA_TABLE_WORD_LEN]; + +typedef struct wc_Camellia Camellia; + +#endif /* !OPENSSL_COEXIST */ + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* HAVE_CAMELLIA */ +#endif /* WOLF_CRYPT_CAMELLIA_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/chacha.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/chacha.h @@ -0,0 +1,132 @@ +/* chacha.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ +/* + +DESCRIPTION +This library contains implementation for the ChaCha20 stream cipher. + +*/ +/*! + \file wolfssl/wolfcrypt/chacha.h +*/ + + +#ifndef WOLF_CRYPT_CHACHA_H +#define WOLF_CRYPT_CHACHA_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef HAVE_CHACHA + +#ifdef __cplusplus + extern "C" { +#endif + +/* +Initialization vector starts at 13 with zero being the index origin of a matrix. +Block counter is located at index 12. + 0 1 2 3 + 4 5 6 7 + 8 9 10 11 + 12 13 14 15 +*/ +#define CHACHA_MATRIX_CNT_IV 12 + +/* Size of the IV */ +#define CHACHA_IV_WORDS 3 + +/* Size of IV in bytes*/ +#define CHACHA_IV_BYTES 12 +#ifdef HAVE_XCHACHA +#define XCHACHA_NONCE_BYTES 24 +#endif + +/* Size of ChaCha chunks */ +#define CHACHA_CHUNK_WORDS 16 +#define CHACHA_CHUNK_BYTES (CHACHA_CHUNK_WORDS * (word32)sizeof(word32)) + +#ifdef WOLFSSL_X86_64_BUILD +#if defined(USE_INTEL_SPEEDUP) && !defined(NO_CHACHA_ASM) + #define USE_INTEL_CHACHA_SPEEDUP + #define HAVE_INTEL_AVX1 +#endif +#endif + +enum { + CHACHA_ENC_TYPE = WC_CIPHER_CHACHA, /* cipher unique type */ + CHACHA_MAX_KEY_SZ = 32 +}; + +typedef struct ChaCha { + word32 X[CHACHA_CHUNK_WORDS]; /* state of cipher */ +#if defined(USE_INTEL_CHACHA_SPEEDUP) + /* vpshufd reads 16 bytes but we only use bottom 4. */ + byte extra[12]; +#endif + word32 left; /* number of bytes leftover */ +#if defined(USE_INTEL_CHACHA_SPEEDUP) || defined(WOLFSSL_ARMASM) || \ + defined(WOLFSSL_RISCV_ASM) + word32 over[CHACHA_CHUNK_WORDS]; +#endif +} ChaCha; + +/** + * IV(nonce) changes with each record + * counter is for what value the block counter should start ... usually 0 + */ +WOLFSSL_API int wc_Chacha_SetIV(ChaCha* ctx, const byte* inIv, word32 counter); + +WOLFSSL_API int wc_Chacha_Process(ChaCha* ctx, byte* cipher, const byte* plain, + word32 msglen); + +WOLFSSL_API int wc_Chacha_SetKey(ChaCha* ctx, const byte* key, word32 keySz); + +#ifdef HAVE_XCHACHA +WOLFSSL_LOCAL void wc_Chacha_purge_current_block(ChaCha* ctx); + +WOLFSSL_API int wc_XChacha_SetKey(ChaCha *ctx, const byte *key, word32 keySz, + const byte *nonce, word32 nonceSz, + word32 counter); +#endif + +#if defined(WOLFSSL_ARMASM) + +#ifndef __aarch64__ +void wc_chacha_setiv(word32* x, const byte* iv, word32 counter); +void wc_chacha_setkey(word32* x, const byte* key, word32 keySz); +#endif + +#if defined(WOLFSSL_ARMASM_NO_NEON) || defined(WOLFSSL_ARMASM_THUMB2) +void wc_chacha_use_over(byte* over, byte* output, const byte* input, + word32 len); +void wc_chacha_crypt_bytes(ChaCha* ctx, byte* c, const byte* m, word32 len); +#endif + +#endif + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* HAVE_CHACHA */ +#endif /* WOLF_CRYPT_CHACHA_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/chacha20_poly1305.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/chacha20_poly1305.h @@ -0,0 +1,157 @@ +/* chacha20_poly1305.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ +/* + +DESCRIPTION +This library contains implementation for the ChaCha20 stream cipher and +the Poly1305 authenticator, both as as combined-mode, +or Authenticated Encryption with Additional Data (AEAD) algorithm. + +*/ + +/*! + \file wolfssl/wolfcrypt/chacha20_poly1305.h +*/ + +#ifndef WOLF_CRYPT_CHACHA20_POLY1305_H +#define WOLF_CRYPT_CHACHA20_POLY1305_H + +#include <wolfssl/wolfcrypt/types.h> +#include <wolfssl/wolfcrypt/chacha.h> +#include <wolfssl/wolfcrypt/poly1305.h> + +#if defined(HAVE_CHACHA) && defined(HAVE_POLY1305) + +#ifdef __cplusplus + extern "C" { +#endif + +#define CHACHA20_POLY1305_AEAD_KEYSIZE 32 +#define CHACHA20_POLY1305_AEAD_IV_SIZE 12 +#define CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE 16 +#define CHACHA20_POLY1305_MAX 4294967295U +#define XCHACHA20_POLY1305_AEAD_NONCE_SIZE 24 + +enum { + CHACHA20_POLY_1305_ENC_TYPE = 8, /* cipher unique type */ + + /* AEAD Cipher Direction */ + CHACHA20_POLY1305_AEAD_DECRYPT = 0, + CHACHA20_POLY1305_AEAD_ENCRYPT = 1, + + /* AEAD State */ + CHACHA20_POLY1305_STATE_INIT = 0, + CHACHA20_POLY1305_STATE_READY = 1, + CHACHA20_POLY1305_STATE_AAD = 2, + CHACHA20_POLY1305_STATE_DATA = 3 +}; + +typedef struct ChaChaPoly_Aead { + ChaCha chacha; + Poly1305 poly; + + word32 aadLen; + word32 dataLen; + + byte state; + WC_BITFIELD isEncrypt:1; +} ChaChaPoly_Aead; + + +/* + * The IV for this implementation is 96 bits to give the most flexibility. + * + * Some protocols may have unique per-invocation inputs that are not + * 96-bit in length. For example, IPsec may specify a 64-bit nonce. In + * such a case, it is up to the protocol document to define how to + * transform the protocol nonce into a 96-bit nonce, for example by + * concatenating a constant value. + */ + +WOLFSSL_ABI WOLFSSL_API +int wc_ChaCha20Poly1305_Encrypt( + const byte inKey[CHACHA20_POLY1305_AEAD_KEYSIZE], + const byte inIV[CHACHA20_POLY1305_AEAD_IV_SIZE], + const byte* inAAD, word32 inAADLen, + const byte* inPlaintext, word32 inPlaintextLen, + byte* outCiphertext, + byte outAuthTag[CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE]); + +WOLFSSL_ABI WOLFSSL_API WARN_UNUSED_RESULT +int wc_ChaCha20Poly1305_Decrypt( + const byte inKey[CHACHA20_POLY1305_AEAD_KEYSIZE], + const byte inIV[CHACHA20_POLY1305_AEAD_IV_SIZE], + const byte* inAAD, word32 inAADLen, + const byte* inCiphertext, word32 inCiphertextLen, + const byte inAuthTag[CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE], + byte* outPlaintext); + +WOLFSSL_API WARN_UNUSED_RESULT +int wc_ChaCha20Poly1305_CheckTag( + const byte authTag[CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE], + const byte authTagChk[CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE]); + + + +/* Implementation of AEAD, which includes support for adding + data, then final calculation of authentication tag */ +WOLFSSL_API int wc_ChaCha20Poly1305_Init(ChaChaPoly_Aead* aead, + const byte inKey[CHACHA20_POLY1305_AEAD_KEYSIZE], + const byte inIV[CHACHA20_POLY1305_AEAD_IV_SIZE], + int isEncrypt); +WOLFSSL_API int wc_ChaCha20Poly1305_UpdateAad(ChaChaPoly_Aead* aead, + const byte* inAAD, word32 inAADLen); +WOLFSSL_API int wc_ChaCha20Poly1305_UpdateData(ChaChaPoly_Aead* aead, + const byte* inData, byte* outData, word32 dataLen); +WOLFSSL_API WARN_UNUSED_RESULT int wc_ChaCha20Poly1305_Final(ChaChaPoly_Aead* aead, + byte outAuthTag[CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE]); + +#ifdef HAVE_XCHACHA + +WOLFSSL_API int wc_XChaCha20Poly1305_Init( + ChaChaPoly_Aead* aead, + const byte *ad, word32 ad_len, + const byte *inKey, word32 inKeySz, + const byte *inIV, word32 inIVSz, + int isEncrypt); + +WOLFSSL_API int wc_XChaCha20Poly1305_Encrypt( + byte *dst, size_t dst_space, + const byte *src, size_t src_len, + const byte *ad, size_t ad_len, + const byte *nonce, size_t nonce_len, + const byte *key, size_t key_len); + +WOLFSSL_API WARN_UNUSED_RESULT int wc_XChaCha20Poly1305_Decrypt( + byte *dst, size_t dst_space, + const byte *src, size_t src_len, + const byte *ad, size_t ad_len, + const byte *nonce, size_t nonce_len, + const byte *key, size_t key_len); + +#endif /* HAVE_XCHACHA */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* HAVE_CHACHA && HAVE_POLY1305 */ +#endif /* WOLF_CRYPT_CHACHA20_POLY1305_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/cmac.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/cmac.h @@ -0,0 +1,168 @@ +/* cmac.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + +#ifndef WOLF_CRYPT_CMAC_H +#define WOLF_CRYPT_CMAC_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef WOLFSSL_CMAC + +#ifndef NO_AES +#include <wolfssl/wolfcrypt/aes.h> +#endif + +#if defined(HAVE_FIPS) && \ + defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2) + #include <wolfssl/wolfcrypt/fips.h> +#endif /* HAVE_FIPS_VERSION >= 2 */ + +#ifdef __cplusplus + extern "C" { +#endif + +/* avoid redefinition of structs */ +#if !defined(HAVE_FIPS) || FIPS_VERSION3_GE(2,0,0) + +typedef enum CmacType { + WC_CMAC_AES = 1 +} CmacType; + +#ifndef WC_CMAC_TYPE_DEFINED + typedef struct Cmac Cmac; + #define WC_CMAC_TYPE_DEFINED +#endif +struct Cmac { +#ifndef NO_AES + Aes aes; + byte buffer[WC_AES_BLOCK_SIZE]; /* partially stored block */ + byte digest[WC_AES_BLOCK_SIZE]; /* running digest */ + byte k1[WC_AES_BLOCK_SIZE]; + byte k2[WC_AES_BLOCK_SIZE]; +#endif + word32 bufferSz; + word32 totalSz; +#ifdef WOLF_CRYPTO_CB + int devId; + void* devCtx; + #ifdef WOLFSSL_CAAM + byte ctx[32]; /* hold state for save and return */ + word32 blackKey; + word32 keylen; + byte initialized; + #endif +#endif +#if defined(WOLFSSL_HASH_KEEP) + byte* msg; + word32 used; + word32 len; +#endif +#ifdef WOLFSSL_SE050 + byte useSWCrypt; /* Use SW crypt instead of SE050, before SCP03 auth */ +#endif + CmacType type; +}; + + + + +#ifndef NO_AES +#define WC_CMAC_TAG_MAX_SZ WC_AES_BLOCK_SIZE +#define WC_CMAC_TAG_MIN_SZ (WC_AES_BLOCK_SIZE/4) +#else +/* Reasonable defaults */ +#define WC_CMAC_TAG_MAX_SZ 16 +#define WC_CMAC_TAG_MIN_SZ 4 +#endif + +#if FIPS_VERSION3_GE(6,0,0) + extern const unsigned int wolfCrypt_FIPS_cmac_ro_sanity[2]; + WOLFSSL_LOCAL int wolfCrypt_FIPS_CMAC_sanity(void); +#endif + +#endif /* HAVE_FIPS */ + +WOLFSSL_API +int wc_InitCmac(Cmac* cmac, + const byte* key, word32 keySz, + int type, void* unused); + +WOLFSSL_API +int wc_InitCmac_ex(Cmac* cmac, + const byte* key, word32 keySz, + int type, void* unused, void* heap, int devId); + +WOLFSSL_API +int wc_CmacUpdate(Cmac* cmac, + const byte* in, word32 inSz); +WOLFSSL_API +int wc_CmacFinalNoFree(Cmac* cmac, + byte* out, word32* outSz); +WOLFSSL_API +int wc_CmacFinal(Cmac* cmac, + byte* out, word32* outSz); + +WOLFSSL_API +int wc_CmacFree(Cmac* cmac); + +#ifndef NO_AES +WOLFSSL_API +int wc_AesCmacGenerate(byte* out, word32* outSz, + const byte* in, word32 inSz, + const byte* key, word32 keySz); +WOLFSSL_API +int wc_AesCmacGenerate_ex(Cmac *cmac, + byte* out, word32* outSz, + const byte* in, word32 inSz, + const byte* key, word32 keySz, + void* heap, + int devId); + +WOLFSSL_API +int wc_AesCmacVerify(const byte* check, word32 checkSz, + const byte* in, word32 inSz, + const byte* key, word32 keySz); +WOLFSSL_API +int wc_AesCmacVerify_ex(Cmac* cmac, + const byte* check, word32 checkSz, + const byte* in, word32 inSz, + const byte* key, word32 keySz, + void* heap, + int devId); +WOLFSSL_LOCAL +void ShiftAndXorRb(byte* out, byte* in); + +#endif /* !NO_AES */ + +#ifdef WOLFSSL_HASH_KEEP +WOLFSSL_API +int wc_CMAC_Grow(Cmac* cmac, const byte* in, int inSz); +#endif + +#ifdef __cplusplus + } /* extern "C" */ +#endif + + +#endif /* WOLFSSL_CMAC */ +#endif /* WOLF_CRYPT_CMAC_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/coding.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/coding.h @@ -0,0 +1,93 @@ +/* coding.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/coding.h +*/ + +#ifndef WOLF_CRYPT_CODING_H +#define WOLF_CRYPT_CODING_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef __cplusplus + extern "C" { +#endif + + +WOLFSSL_API int Base64_Decode(const byte* in, word32 inLen, byte* out, + word32* outLen); + +WOLFSSL_API int Base64_Decode_nonCT(const byte* in, word32 inLen, byte* out, + word32* outLen); + +#if defined(OPENSSL_EXTRA) || defined(SESSION_CERTS) || defined(WOLFSSL_KEY_GEN) \ + || defined(WOLFSSL_CERT_GEN) || defined(HAVE_WEBSERVER) || !defined(NO_DSA) + #ifndef WOLFSSL_BASE64_ENCODE + #define WOLFSSL_BASE64_ENCODE + #endif +#endif + + +#ifdef WOLFSSL_BASE64_ENCODE + enum Escaped { + WC_STD_ENC = 0, /* normal \n line ending encoding */ + WC_ESC_NL_ENC, /* use escape sequence encoding */ + WC_NO_NL_ENC /* no encoding at all */ + }; /* Encoding types */ + + /* encode isn't */ + WOLFSSL_API + int Base64_Encode(const byte* in, word32 inLen, byte* out, + word32* outLen); + WOLFSSL_API + int Base64_EncodeEsc(const byte* in, word32 inLen, byte* out, + word32* outLen); + WOLFSSL_API + int Base64_Encode_NoNl(const byte* in, word32 inLen, byte* out, + word32* outLen); +#endif + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) || \ + defined(HAVE_WEBSERVER) || defined(HAVE_FIPS) || \ + defined(HAVE_ECC_CDH) || defined(HAVE_SELFTEST) || \ + defined(WOLFSSL_ENCRYPTED_KEYS) + #ifndef WOLFSSL_BASE16 + #define WOLFSSL_BASE16 + #endif +#endif + +#ifdef WOLFSSL_BASE16 + WOLFSSL_API + int Base16_Decode(const byte* in, word32 inLen, byte* out, word32* outLen); + WOLFSSL_API + int Base16_Encode(const byte* in, word32 inLen, byte* out, word32* outLen); +#endif + + WOLFSSL_LOCAL int Base64_SkipNewline(const byte* in, word32* inLen, + word32* outJ); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLF_CRYPT_CODING_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/compress.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/compress.h @@ -0,0 +1,60 @@ +/* compress.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/compress.h +*/ + + +#ifndef WOLF_CRYPT_COMPRESS_H +#define WOLF_CRYPT_COMPRESS_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef HAVE_LIBZ + +#ifdef __cplusplus + extern "C" { +#endif + + +#define COMPRESS_FIXED 1 + +#define LIBZ_WINBITS_GZIP 16 + + +WOLFSSL_API int wc_Compress(byte*, word32, const byte*, word32, word32); +WOLFSSL_API int wc_Compress_ex(byte* out, word32 outSz, const byte* in, + word32 inSz, word32 flags, word32 windowBits); +WOLFSSL_API int wc_DeCompress(byte*, word32, const byte*, word32); +WOLFSSL_API int wc_DeCompress_ex(byte* out, word32 outSz, const byte* in, + word32 inSz, int windowBits); +WOLFSSL_API int wc_DeCompressDynamic(byte** out, int max, int memoryType, + const byte* in, word32 inSz, int windowBits, void* heap); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + + +#endif /* HAVE_LIBZ */ +#endif /* WOLF_CRYPT_COMPRESS_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/cpuid.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/cpuid.h @@ -0,0 +1,111 @@ +/* cpuid.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + +#ifndef WOLF_CRYPT_CPUID_H +#define WOLF_CRYPT_CPUID_H + + +#include <wolfssl/wolfcrypt/types.h> + + +#ifdef __cplusplus + extern "C" { +#endif + +#if (defined(WOLFSSL_X86_64_BUILD) || defined(USE_INTEL_SPEEDUP) || \ + defined(WOLFSSL_AESNI) || defined(WOLFSSL_SP_X86_64_ASM)) && \ + !defined(WOLFSSL_NO_ASM) + #define HAVE_CPUID + #define HAVE_CPUID_INTEL +#endif +#if (defined(WOLFSSL_AARCH64_BUILD) || (defined(__aarch64__) && \ + defined(WOLFSSL_ARMASM))) && !defined(WOLFSSL_NO_ASM) + #define HAVE_CPUID + #define HAVE_CPUID_AARCH64 +#endif + +#ifdef HAVE_CPUID_INTEL + + #define CPUID_AVX1 0x0001 + #define CPUID_AVX2 0x0002 + #define CPUID_RDRAND 0x0004 + #define CPUID_RDSEED 0x0008 + #define CPUID_BMI2 0x0010 /* MULX, RORX */ + #define CPUID_AESNI 0x0020 + #define CPUID_ADX 0x0040 /* ADCX, ADOX */ + #define CPUID_MOVBE 0x0080 /* Move and byte swap */ + #define CPUID_BMI1 0x0100 /* ANDN */ + #define CPUID_SHA 0x0200 /* SHA-1 and SHA-256 instructions */ + + #define IS_INTEL_AVX1(f) ((f) & CPUID_AVX1) + #define IS_INTEL_AVX2(f) ((f) & CPUID_AVX2) + #define IS_INTEL_RDRAND(f) ((f) & CPUID_RDRAND) + #define IS_INTEL_RDSEED(f) ((f) & CPUID_RDSEED) + #define IS_INTEL_BMI2(f) ((f) & CPUID_BMI2) + #define IS_INTEL_AESNI(f) ((f) & CPUID_AESNI) + #define IS_INTEL_ADX(f) ((f) & CPUID_ADX) + #define IS_INTEL_MOVBE(f) ((f) & CPUID_MOVBE) + #define IS_INTEL_BMI1(f) ((f) & CPUID_BMI1) + #define IS_INTEL_SHA(f) ((f) & CPUID_SHA) + +#elif defined(HAVE_CPUID_AARCH64) + + #define CPUID_AES 0x0001 /* AES enc/dec */ + #define CPUID_PMULL 0x0002 /* Carryless multiplication */ + #define CPUID_SHA256 0x0004 /* SHA-256 digest */ + #define CPUID_SHA512 0x0008 /* SHA-512 digest */ + #define CPUID_RDM 0x0010 /* SQRDMLAH and SQRDMLSH */ + #define CPUID_SHA3 0x0020 /* SHA-3 digest */ + #define CPUID_SM3 0x0040 /* SM3 digest */ + #define CPUID_SM4 0x0080 /* SM4 enc/dec */ + #define CPUID_SB 0x0100 /* Speculation barrier */ + + #define IS_AARCH64_AES(f) ((f) & CPUID_AES) + #define IS_AARCH64_PMULL(f) ((f) & CPUID_PMULL) + #define IS_AARCH64_SHA256(f) ((f) & CPUID_SHA256) + #define IS_AARCH64_SHA512(f) ((f) & CPUID_SHA512) + #define IS_AARCH64_RDM(f) ((f) & CPUID_RDM) + #define IS_AARCH64_SHA3(f) ((f) & CPUID_SHA3) + #define IS_AARCH64_SM3(f) ((f) & CPUID_SM3) + #define IS_AARCH64_SM4(f) ((f) & CPUID_SM4) + #define IS_AARCH64_SB(f) ((f) & CPUID_SB) + +#endif + +#ifdef HAVE_CPUID + void cpuid_set_flags(void); + word32 cpuid_get_flags(void); + + /* Public APIs to modify flags. */ + WOLFSSL_API void cpuid_select_flags(word32 flags); + WOLFSSL_API void cpuid_set_flag(word32 flag); + WOLFSSL_API void cpuid_clear_flag(word32 flag); + +#endif + +#ifdef __cplusplus + } /* extern "C" */ +#endif + + +#endif /* WOLF_CRYPT_CPUID_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/cryptocb.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/cryptocb.h @@ -0,0 +1,688 @@ +/* cryptocb.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifndef _WOLF_CRYPTO_CB_H_ +#define _WOLF_CRYPTO_CB_H_ + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef __cplusplus + extern "C" { +#endif + +/* Defines the Crypto Callback interface version, for compatibility */ +/* Increment this when Crypto Callback interface changes are made */ +#define CRYPTO_CB_VER 2 + + +#ifdef WOLF_CRYPTO_CB + +#ifndef NO_RSA + #include <wolfssl/wolfcrypt/rsa.h> +#endif +#ifdef HAVE_ECC + #include <wolfssl/wolfcrypt/ecc.h> +#endif +#ifndef NO_AES + #include <wolfssl/wolfcrypt/aes.h> +#endif +#ifndef NO_SHA + #include <wolfssl/wolfcrypt/sha.h> +#endif +#ifndef NO_SHA256 + #include <wolfssl/wolfcrypt/sha256.h> +#endif +#ifdef WOLFSSL_SHA3 + #include <wolfssl/wolfcrypt/sha3.h> +#endif +#ifndef NO_HMAC + #include <wolfssl/wolfcrypt/hmac.h> +#endif +#ifndef WC_NO_RNG + #include <wolfssl/wolfcrypt/random.h> +#endif +#ifndef NO_DES3 + #include <wolfssl/wolfcrypt/des3.h> +#endif +#ifdef WOLFSSL_CMAC + #include <wolfssl/wolfcrypt/cmac.h> +#endif +#ifdef HAVE_ED25519 + #include <wolfssl/wolfcrypt/ed25519.h> +#endif +#ifdef HAVE_CURVE25519 + #include <wolfssl/wolfcrypt/curve25519.h> +#endif +#if defined(WOLFSSL_SHA512) || defined(WOLFSSL_SHA384) + #include <wolfssl/wolfcrypt/sha512.h> +#endif +#ifdef WOLFSSL_HAVE_MLKEM + #include <wolfssl/wolfcrypt/mlkem.h> +#ifdef WOLFSSL_WC_MLKEM + #include <wolfssl/wolfcrypt/wc_mlkem.h> +#elif defined(HAVE_LIBOQS) + #include <wolfssl/wolfcrypt/ext_mlkem.h> +#endif +#endif +#if defined(HAVE_DILITHIUM) + #include <wolfssl/wolfcrypt/dilithium.h> +#endif +#if defined(HAVE_FALCON) + #include <wolfssl/wolfcrypt/falcon.h> +#endif + + +#ifdef WOLF_CRYPTO_CB_CMD +/* CryptoCb Commands */ +enum wc_CryptoCbCmdType { + WC_CRYPTOCB_CMD_TYPE_NONE = 0, + WC_CRYPTOCB_CMD_TYPE_REGISTER, + WC_CRYPTOCB_CMD_TYPE_UNREGISTER, + + WC_CRYPTOCB_CMD_TYPE_MAX = WC_CRYPTOCB_CMD_TYPE_UNREGISTER +}; +#endif + + +#if defined(HAVE_AESGCM) || defined(HAVE_AESCCM) +typedef struct { + Aes* aes; + byte* out; + const byte* in; + word32 sz; + const byte* nonce; + word32 nonceSz; + const byte* iv; + word32 ivSz; + byte* authTag; + word32 authTagSz; + const byte* authIn; + word32 authInSz; +} wc_CryptoCb_AesAuthEnc; +typedef struct { + Aes* aes; + byte* out; + const byte* in; + word32 sz; + const byte* nonce; + word32 nonceSz; + const byte* iv; + word32 ivSz; + const byte* authTag; + word32 authTagSz; + const byte* authIn; + word32 authInSz; +} wc_CryptoCb_AesAuthDec; +#endif + +/* Crypto Information Structure for callbacks */ +typedef struct wc_CryptoInfo { + int algo_type; /* enum wc_AlgoType */ +#ifdef HAVE_ANONYMOUS_INLINE_AGGREGATES + union { +#endif + struct { + int type; /* enum wc_PkType */ +#ifdef HAVE_ANONYMOUS_INLINE_AGGREGATES + union { +#endif + #ifndef NO_RSA + struct { + const byte* in; + word32 inLen; + byte* out; + word32* outLen; + int type; + RsaKey* key; + WC_RNG* rng; + #ifdef WOLF_CRYPTO_CB_RSA_PAD + RsaPadding *padding; + #endif + } rsa; + #ifdef WOLFSSL_KEY_GEN + struct { + RsaKey* key; + int size; + long e; + WC_RNG* rng; + } rsakg; + #endif + struct { + RsaKey* key; + const byte* pubKey; + word32 pubKeySz; + } rsa_check; + struct { + const RsaKey* key; + int* keySize; + } rsa_get_size; + #endif + #ifdef HAVE_ECC + #ifdef HAVE_ECC_DHE + struct { + WC_RNG* rng; + int size; + ecc_key* key; + int curveId; + } eckg; + struct { + ecc_key* private_key; + ecc_key* public_key; + byte* out; + word32* outlen; + } ecdh; + #endif + #ifdef HAVE_ECC_SIGN + struct { + const byte* in; + word32 inlen; + byte* out; + word32* outlen; + WC_RNG* rng; + ecc_key* key; + } eccsign; + #endif + #ifdef HAVE_ECC_VERIFY + struct { + const byte* sig; + word32 siglen; + const byte* hash; + word32 hashlen; + int* res; + ecc_key* key; + } eccverify; + #endif + #ifdef HAVE_ECC_CHECK_KEY + struct { + ecc_key* key; + const byte* pubKey; + word32 pubKeySz; + } ecc_check; + #endif + #endif /* HAVE_ECC */ + #ifdef HAVE_CURVE25519 + struct { + WC_RNG* rng; + int size; + curve25519_key* key; + int curveId; + } curve25519kg; + struct { + curve25519_key* private_key; + curve25519_key* public_key; + byte* out; + word32* outlen; + int endian; + } curve25519; + #endif + #ifdef HAVE_ED25519 + struct { + WC_RNG* rng; + int size; + ed25519_key* key; + int curveId; + } ed25519kg; + struct { + const byte* in; + word32 inLen; + byte* out; + word32* outLen; + ed25519_key* key; + byte type; + const byte* context; + byte contextLen; + } ed25519sign; + struct { + const byte* sig; + word32 sigLen; + const byte* msg; + word32 msgLen; + int* res; + ed25519_key* key; + byte type; + const byte* context; + byte contextLen; + } ed25519verify; + #endif + #if defined(WOLFSSL_HAVE_MLKEM) + struct { + WC_RNG* rng; + int size; + void* key; + int type; /* enum wc_PqcKemType */ + } pqc_kem_kg; + struct { + byte* ciphertext; + word32 ciphertextLen; + byte* sharedSecret; + word32 sharedSecretLen; + WC_RNG* rng; + void* key; + int type; /* enum wc_PqcKemType */ + } pqc_encaps; + struct { + const byte* ciphertext; + word32 ciphertextLen; + byte* sharedSecret; + word32 sharedSecretLen; + void* key; + int type; /* enum wc_PqcKemType */ + } pqc_decaps; + #endif + #if defined(HAVE_FALCON) || defined(HAVE_DILITHIUM) + struct { + WC_RNG* rng; + int size; + void* key; + int type; /* enum wc_PqcSignatureType */ + } pqc_sig_kg; + struct { + const byte* in; + word32 inlen; + byte* out; + word32* outlen; + WC_RNG* rng; + void* key; + int type; /* enum wc_PqcSignatureType */ + const byte* context; + byte contextLen; + word32 preHashType; /* enum wc_HashType */ + } pqc_sign; + struct { + const byte* sig; + word32 siglen; + const byte* msg; + word32 msglen; + int* res; + void* key; + int type; /* enum wc_PqcSignatureType */ + const byte* context; + byte contextLen; + word32 preHashType; /* enum wc_HashType */ + } pqc_verify; + struct { + void* key; + const byte* pubKey; + word32 pubKeySz; + int type; /* enum wc_PqcSignatureType */ + } pqc_sig_check; + #endif +#ifdef HAVE_ANONYMOUS_INLINE_AGGREGATES + }; +#endif + } pk; +#if !defined(NO_AES) || !defined(NO_DES3) + struct { + int type; /* enum wc_CipherType */ + int enc; +#ifdef HAVE_ANONYMOUS_INLINE_AGGREGATES + union { +#endif + #ifdef HAVE_AESGCM + wc_CryptoCb_AesAuthEnc aesgcm_enc; + wc_CryptoCb_AesAuthDec aesgcm_dec; + #endif /* HAVE_AESGCM */ + #ifdef HAVE_AESCCM + wc_CryptoCb_AesAuthEnc aesccm_enc; + wc_CryptoCb_AesAuthDec aesccm_dec; + #endif /* HAVE_AESCCM */ + #if defined(HAVE_AES_CBC) + struct { + Aes* aes; + byte* out; + const byte* in; + word32 sz; + } aescbc; + #endif /* HAVE_AES_CBC */ + #if defined(WOLFSSL_AES_COUNTER) + struct { + Aes* aes; + byte* out; + const byte* in; + word32 sz; + } aesctr; + #endif /* WOLFSSL_AES_COUNTER */ + #if defined(HAVE_AES_ECB) + struct { + Aes* aes; + byte* out; + const byte* in; + word32 sz; + } aesecb; + #endif /* HAVE_AES_ECB */ + #ifndef NO_DES3 + struct { + Des3* des; + byte* out; + const byte* in; + word32 sz; + } des3; + #endif + void* ctx; +#ifdef HAVE_ANONYMOUS_INLINE_AGGREGATES + }; +#endif + } cipher; +#endif /* !NO_AES || !NO_DES3 */ +#if !defined(NO_SHA) || !defined(NO_SHA256) || \ + defined(WOLFSSL_SHA384) || defined(WOLFSSL_SHA512) || defined(WOLFSSL_SHA3) + struct { + int type; /* enum wc_HashType */ + const byte* in; + word32 inSz; + byte* digest; +#ifdef HAVE_ANONYMOUS_INLINE_AGGREGATES + union { +#endif + #ifndef NO_SHA + wc_Sha* sha1; + #endif + #ifdef WOLFSSL_SHA224 + wc_Sha224* sha224; + #endif + #ifndef NO_SHA256 + wc_Sha256* sha256; + #endif + #ifdef WOLFSSL_SHA384 + wc_Sha384* sha384; + #endif + #ifdef WOLFSSL_SHA512 + wc_Sha512* sha512; + #endif + #ifdef WOLFSSL_SHA3 + wc_Sha3* sha3; + #endif + void* ctx; +#ifdef HAVE_ANONYMOUS_INLINE_AGGREGATES + }; +#endif + } hash; +#endif /* !NO_SHA || !NO_SHA256 */ +#ifndef NO_HMAC + struct { + int macType; /* enum wc_HashType */ + const byte* in; + word32 inSz; + byte* digest; + Hmac* hmac; + } hmac; +#endif +#ifndef WC_NO_RNG + struct { + WC_RNG* rng; + byte* out; + word32 sz; + } rng; + struct { + OS_Seed* os; + byte* seed; + word32 sz; + } seed; +#endif +#ifdef WOLFSSL_CMAC + struct { + Cmac* cmac; + void* ctx; + const byte* key; + const byte* in; + byte* out; + word32* outSz; + word32 keySz; + word32 inSz; + int type; + } cmac; +#endif +#ifndef NO_CERTS + struct { + const byte *id; + word32 idLen; + const char *label; + word32 labelLen; + byte **certDataOut; + word32 *certSz; + int *certFormatOut; + void *heap; + } cert; +#endif +#ifdef WOLF_CRYPTO_CB_CMD + struct { /* uses wc_AlgoType=ALGO_NONE */ + int type; /* enum wc_CryptoCbCmdType */ + void *ctx; + } cmd; +#endif +#ifdef HAVE_ANONYMOUS_INLINE_AGGREGATES + }; +#endif +} wc_CryptoInfo; + + +typedef int (*CryptoDevCallbackFunc)(int devId, struct wc_CryptoInfo* info, void* ctx); + +WOLFSSL_LOCAL void wc_CryptoCb_Init(void); +WOLFSSL_LOCAL void wc_CryptoCb_Cleanup(void); +WOLFSSL_LOCAL int wc_CryptoCb_GetDevIdAtIndex(int startIdx); +WOLFSSL_API int wc_CryptoCb_RegisterDevice(int devId, CryptoDevCallbackFunc cb, void* ctx); +WOLFSSL_API void wc_CryptoCb_UnRegisterDevice(int devId); +WOLFSSL_API int wc_CryptoCb_DefaultDevID(void); + +#ifdef WOLF_CRYPTO_CB_FIND +typedef int (*CryptoDevCallbackFind)(int devId, int algoType); +WOLFSSL_API void wc_CryptoCb_SetDeviceFindCb(CryptoDevCallbackFind cb); +#endif + +#ifdef DEBUG_CRYPTOCB +WOLFSSL_API void wc_CryptoCb_InfoString(wc_CryptoInfo* info); +#endif + +/* old function names */ +#define wc_CryptoDev_RegisterDevice wc_CryptoCb_RegisterDevice +#define wc_CryptoDev_UnRegisterDevice wc_CryptoCb_UnRegisterDevice + + +#ifndef NO_RSA +WOLFSSL_LOCAL int wc_CryptoCb_Rsa(const byte* in, word32 inLen, byte* out, + word32* outLen, int type, RsaKey* key, WC_RNG* rng); + +#ifdef WOLF_CRYPTO_CB_RSA_PAD +WOLFSSL_LOCAL int wc_CryptoCb_RsaPad(const byte* in, word32 inLen, byte* out, + word32* outLen, int type, RsaKey* key, WC_RNG* rng, RsaPadding *padding); +#endif + +#ifdef WOLFSSL_KEY_GEN +WOLFSSL_LOCAL int wc_CryptoCb_MakeRsaKey(RsaKey* key, int size, long e, + WC_RNG* rng); +#endif /* WOLFSSL_KEY_GEN */ + +WOLFSSL_LOCAL int wc_CryptoCb_RsaCheckPrivKey(RsaKey* key, const byte* pubKey, + word32 pubKeySz); +WOLFSSL_LOCAL int wc_CryptoCb_RsaGetSize(const RsaKey* key, int* keySize); +#endif /* !NO_RSA */ + +#ifdef HAVE_ECC +WOLFSSL_LOCAL int wc_CryptoCb_MakeEccKey(WC_RNG* rng, int keySize, + ecc_key* key, int curveId); + +WOLFSSL_LOCAL int wc_CryptoCb_Ecdh(ecc_key* private_key, ecc_key* public_key, + byte* out, word32* outlen); + +WOLFSSL_LOCAL int wc_CryptoCb_EccSign(const byte* in, word32 inlen, byte* out, + word32 *outlen, WC_RNG* rng, ecc_key* key); + +WOLFSSL_LOCAL int wc_CryptoCb_EccVerify(const byte* sig, word32 siglen, + const byte* hash, word32 hashlen, int* res, ecc_key* key); + +WOLFSSL_LOCAL int wc_CryptoCb_EccCheckPrivKey(ecc_key* key, const byte* pubKey, + word32 pubKeySz); +#endif /* HAVE_ECC */ + +#ifdef HAVE_CURVE25519 +WOLFSSL_LOCAL int wc_CryptoCb_Curve25519Gen(WC_RNG* rng, int keySize, + curve25519_key* key); + +WOLFSSL_LOCAL int wc_CryptoCb_Curve25519(curve25519_key* private_key, + curve25519_key* public_key, byte* out, word32* outlen, int endian); +#endif /* HAVE_CURVE25519 */ + +#ifdef HAVE_ED25519 +WOLFSSL_LOCAL int wc_CryptoCb_Ed25519Gen(WC_RNG* rng, int keySize, + ed25519_key* key); +WOLFSSL_LOCAL int wc_CryptoCb_Ed25519Sign(const byte* in, word32 inLen, + byte* out, word32 *outLen, ed25519_key* key, byte type, const byte* context, + byte contextLen); +WOLFSSL_LOCAL int wc_CryptoCb_Ed25519Verify(const byte* sig, word32 sigLen, + const byte* msg, word32 msgLen, int* res, ed25519_key* key, byte type, + const byte* context, byte contextLen); +#endif /* HAVE_ED25519 */ + +#if defined(WOLFSSL_HAVE_MLKEM) +WOLFSSL_LOCAL int wc_CryptoCb_PqcKemGetDevId(int type, void* key); + +WOLFSSL_LOCAL int wc_CryptoCb_MakePqcKemKey(WC_RNG* rng, int type, + int keySize, void* key); + +WOLFSSL_LOCAL int wc_CryptoCb_PqcEncapsulate(byte* ciphertext, + word32 ciphertextLen, byte* sharedSecret, word32 sharedSecretLen, + WC_RNG* rng, int type, void* key); + +WOLFSSL_LOCAL int wc_CryptoCb_PqcDecapsulate(const byte* ciphertext, + word32 ciphertextLen, byte* sharedSecret, word32 sharedSecretLen, + int type, void* key); +#endif /* WOLFSSL_HAVE_MLKEM */ + +#if defined(HAVE_FALCON) || defined(HAVE_DILITHIUM) +WOLFSSL_LOCAL int wc_CryptoCb_PqcSigGetDevId(int type, void* key); + +WOLFSSL_LOCAL int wc_CryptoCb_MakePqcSignatureKey(WC_RNG* rng, int type, + int keySize, void* key); + +WOLFSSL_LOCAL int wc_CryptoCb_PqcSign(const byte* in, word32 inlen, byte* out, + word32 *outlen, const byte* context, byte contextLen, word32 preHashType, + WC_RNG* rng, int type, void* key); + +WOLFSSL_LOCAL int wc_CryptoCb_PqcVerify(const byte* sig, word32 siglen, + const byte* msg, word32 msglen, const byte* context, byte contextLen, + word32 preHashType, int* res, int type, void* key); + +WOLFSSL_LOCAL int wc_CryptoCb_PqcSignatureCheckPrivKey(void* key, int type, + const byte* pubKey, word32 pubKeySz); +#endif /* HAVE_FALCON || HAVE_DILITHIUM */ + +#ifndef NO_AES +#ifdef HAVE_AESGCM +WOLFSSL_LOCAL int wc_CryptoCb_AesGcmEncrypt(Aes* aes, byte* out, + const byte* in, word32 sz, const byte* iv, word32 ivSz, + byte* authTag, word32 authTagSz, const byte* authIn, word32 authInSz); + +WOLFSSL_LOCAL int wc_CryptoCb_AesGcmDecrypt(Aes* aes, byte* out, + const byte* in, word32 sz, const byte* iv, word32 ivSz, + const byte* authTag, word32 authTagSz, + const byte* authIn, word32 authInSz); +#endif /* HAVE_AESGCM */ +#ifdef HAVE_AESCCM +WOLFSSL_LOCAL int wc_CryptoCb_AesCcmEncrypt(Aes* aes, byte* out, + const byte* in, word32 sz, + const byte* nonce, word32 nonceSz, + byte* authTag, word32 authTagSz, + const byte* authIn, word32 authInSz); + +WOLFSSL_LOCAL int wc_CryptoCb_AesCcmDecrypt(Aes* aes, byte* out, + const byte* in, word32 sz, + const byte* nonce, word32 nonceSz, + const byte* authTag, word32 authTagSz, + const byte* authIn, word32 authInSz); +#endif /* HAVE_AESCCM */ +#ifdef HAVE_AES_CBC +WOLFSSL_LOCAL int wc_CryptoCb_AesCbcEncrypt(Aes* aes, byte* out, + const byte* in, word32 sz); +WOLFSSL_LOCAL int wc_CryptoCb_AesCbcDecrypt(Aes* aes, byte* out, + const byte* in, word32 sz); +#endif /* HAVE_AES_CBC */ +#ifdef WOLFSSL_AES_COUNTER +WOLFSSL_LOCAL int wc_CryptoCb_AesCtrEncrypt(Aes* aes, byte* out, + const byte* in, word32 sz); +#endif /* WOLFSSL_AES_COUNTER */ +#ifdef HAVE_AES_ECB +WOLFSSL_LOCAL int wc_CryptoCb_AesEcbEncrypt(Aes* aes, byte* out, + const byte* in, word32 sz); +WOLFSSL_LOCAL int wc_CryptoCb_AesEcbDecrypt(Aes* aes, byte* out, + const byte* in, word32 sz); +#endif /* HAVE_AES_ECB */ +#endif /* !NO_AES */ + +#ifndef NO_DES3 +WOLFSSL_LOCAL int wc_CryptoCb_Des3Encrypt(Des3* des3, byte* out, + const byte* in, word32 sz); +WOLFSSL_LOCAL int wc_CryptoCb_Des3Decrypt(Des3* des3, byte* out, + const byte* in, word32 sz); +#endif /* !NO_DES3 */ + +#ifndef NO_SHA +WOLFSSL_LOCAL int wc_CryptoCb_ShaHash(wc_Sha* sha, const byte* in, + word32 inSz, byte* digest); +#endif /* !NO_SHA */ + +#ifndef NO_SHA256 +WOLFSSL_LOCAL int wc_CryptoCb_Sha256Hash(wc_Sha256* sha256, const byte* in, + word32 inSz, byte* digest); +#endif /* !NO_SHA256 */ +#ifdef WOLFSSL_SHA384 +WOLFSSL_LOCAL int wc_CryptoCb_Sha384Hash(wc_Sha384* sha384, const byte* in, + word32 inSz, byte* digest); +#endif +#ifdef WOLFSSL_SHA512 +WOLFSSL_LOCAL int wc_CryptoCb_Sha512Hash(wc_Sha512* sha512, const byte* in, + word32 inSz, byte* digest); +#endif + +#ifdef WOLFSSL_SHA3 +WOLFSSL_LOCAL int wc_CryptoCb_Sha3Hash(wc_Sha3* sha3, int type, const byte* in, + word32 inSz, byte* digest); +#endif + +#ifndef NO_HMAC +WOLFSSL_LOCAL int wc_CryptoCb_Hmac(Hmac* hmac, int macType, const byte* in, + word32 inSz, byte* digest); +#endif /* !NO_HMAC */ + +#ifndef WC_NO_RNG +WOLFSSL_LOCAL int wc_CryptoCb_RandomBlock(WC_RNG* rng, byte* out, word32 sz); +WOLFSSL_LOCAL int wc_CryptoCb_RandomSeed(OS_Seed* os, byte* seed, word32 sz); +#endif + +#ifdef WOLFSSL_CMAC +WOLFSSL_LOCAL int wc_CryptoCb_Cmac(Cmac* cmac, const byte* key, word32 keySz, + const byte* in, word32 inSz, byte* out, word32* outSz, int type, + void* ctx); +#endif + +#ifndef NO_CERTS +WOLFSSL_LOCAL int wc_CryptoCb_GetCert(int devId, const char *label, + word32 labelLen, const byte *id, word32 idLen, byte** out, + word32* outSz, int *format, void *heap); +#endif + +#endif /* WOLF_CRYPTO_CB */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* _WOLF_CRYPTO_CB_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/curve25519.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/curve25519.h @@ -0,0 +1,225 @@ +/* curve25519.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/curve25519.h +*/ + + +#ifndef WOLF_CRYPT_CURVE25519_H +#define WOLF_CRYPT_CURVE25519_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef HAVE_CURVE25519 + +#include <wolfssl/wolfcrypt/fe_operations.h> +#include <wolfssl/wolfcrypt/random.h> + +#ifdef WOLFSSL_ASYNC_CRYPT + #include <wolfssl/wolfcrypt/async.h> +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +#define CURVE25519_KEYSIZE 32 +#define CURVE25519_PUB_KEY_SIZE 32 +#define CURVE25519_MAX_KEY_TO_DER_SZ 82 /* for exported DER keys temp buffer */ + +#ifdef WOLFSSL_NAMES_STATIC +typedef char curve25519_str[12]; +#else +typedef const char* curve25519_str; +#endif + +/* curve25519 set type */ +typedef struct { + int size; /* The size of the curve in octets */ + curve25519_str name; /* name of this curve */ +} curve25519_set_type; + + +/* ECC point, the internal structure is Little endian + * the mathematical functions used the endianness */ +typedef struct ECPoint { + ALIGN16 byte point[CURVE25519_KEYSIZE]; +#ifdef FREESCALE_LTC_ECC + ALIGN16 byte pointY[CURVE25519_KEYSIZE]; +#endif + byte pointSz; +} ECPoint; + +#ifndef WC_CURVE25519KEY_TYPE_DEFINED + typedef struct curve25519_key curve25519_key; + #define WC_CURVE25519KEY_TYPE_DEFINED +#endif + +/* A CURVE25519 Key */ +struct curve25519_key { + int idx; /* Index into the ecc_sets[] for the parameters of + this curve if -1, this key is using user supplied + curve in dp */ + const curve25519_set_type* dp; /* domain parameters, either points to + curves (idx >= 0) or user supplied */ + ECPoint p; /* public point for key */ + ALIGN16 byte k[CURVE25519_KEYSIZE]; /* private scaler for key */ + +#ifdef WOLFSSL_ASYNC_CRYPT + WC_ASYNC_DEV asyncDev; +#endif +#if defined(WOLF_CRYPTO_CB) + void* devCtx; + int devId; +#endif + void *heap; +#ifdef WOLFSSL_CURVE25519_BLINDING + WC_RNG* rng; +#endif +#ifdef WOLFSSL_SE050 + word32 keyId; + byte keyIdSet; +#endif + + /* bit fields */ + WC_BITFIELD pubSet:1; + WC_BITFIELD privSet:1; +}; + +enum { + EC25519_LITTLE_ENDIAN=0, + EC25519_BIG_ENDIAN=1 +}; + +WOLFSSL_API +int wc_curve25519_make_pub(int public_size, byte* pub, int private_size, + const byte* priv); +#ifdef WOLFSSL_CURVE25519_BLINDING +WOLFSSL_API +int wc_curve25519_make_pub_blind(int public_size, byte* pub, int private_size, + const byte* priv, WC_RNG* rng); +#endif + +WOLFSSL_API +int wc_curve25519_generic(int public_size, byte* pub, + int private_size, const byte* priv, + int basepoint_size, const byte* basepoint); +#ifdef WOLFSSL_CURVE25519_BLINDING +WOLFSSL_API +int wc_curve25519_generic_blind(int public_size, byte* pub, + int private_size, const byte* priv, + int basepoint_size, const byte* basepoint, + WC_RNG* rng); +#endif + +WOLFSSL_API +int wc_curve25519_make_priv(WC_RNG* rng, int keysize, byte* priv); + +WOLFSSL_API +int wc_curve25519_make_key(WC_RNG* rng, int keysize, curve25519_key* key); + +WOLFSSL_API +int wc_curve25519_shared_secret(curve25519_key* private_key, + curve25519_key* public_key, + byte* out, word32* outlen); + +WOLFSSL_API +int wc_curve25519_shared_secret_ex(curve25519_key* private_key, + curve25519_key* public_key, + byte* out, word32* outlen, int endian); + +WOLFSSL_API +int wc_curve25519_init(curve25519_key* key); +WOLFSSL_API +int wc_curve25519_init_ex(curve25519_key* key, void* heap, int devId); + +WOLFSSL_API +void wc_curve25519_free(curve25519_key* key); + +#ifdef WOLFSSL_CURVE25519_BLINDING +WOLFSSL_API +int wc_curve25519_set_rng(curve25519_key* key, WC_RNG* rng); +#endif + +#ifndef WC_NO_CONSTRUCTORS +WOLFSSL_API +curve25519_key* wc_curve25519_new(void* heap, int devId, int *result_code); +WOLFSSL_API +int wc_curve25519_delete(curve25519_key* key, curve25519_key** key_p); +#endif + +/* raw key helpers */ +WOLFSSL_API +int wc_curve25519_import_private(const byte* priv, word32 privSz, + curve25519_key* key); +WOLFSSL_API +int wc_curve25519_import_private_ex(const byte* priv, word32 privSz, + curve25519_key* key, int endian); + +WOLFSSL_API +int wc_curve25519_import_private_raw(const byte* priv, word32 privSz, + const byte* pub, word32 pubSz, curve25519_key* key); +WOLFSSL_API +int wc_curve25519_import_private_raw_ex(const byte* priv, word32 privSz, + const byte* pub, word32 pubSz, + curve25519_key* key, int endian); +WOLFSSL_API +int wc_curve25519_export_private_raw(curve25519_key* key, byte* out, + word32* outLen); +WOLFSSL_API +int wc_curve25519_export_private_raw_ex(curve25519_key* key, byte* out, + word32* outLen, int endian); + +WOLFSSL_API +int wc_curve25519_import_public(const byte* in, word32 inLen, + curve25519_key* key); +WOLFSSL_API +int wc_curve25519_import_public_ex(const byte* in, word32 inLen, + curve25519_key* key, int endian); +WOLFSSL_API +int wc_curve25519_check_public(const byte* pub, word32 pubSz, int endian); + +WOLFSSL_API +int wc_curve25519_export_public(curve25519_key* key, byte* out, word32* outLen); +WOLFSSL_API +int wc_curve25519_export_public_ex(curve25519_key* key, byte* out, + word32* outLen, int endian); + +WOLFSSL_API +int wc_curve25519_export_key_raw(curve25519_key* key, + byte* priv, word32 *privSz, + byte* pub, word32 *pubSz); +WOLFSSL_API +int wc_curve25519_export_key_raw_ex(curve25519_key* key, + byte* priv, word32 *privSz, + byte* pub, word32 *pubSz, + int endian); +/* size helper */ +WOLFSSL_API +int wc_curve25519_size(curve25519_key* key); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* HAVE_CURVE25519 */ +#endif /* WOLF_CRYPT_CURVE25519_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/curve448.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/curve448.h @@ -0,0 +1,151 @@ +/* curve448.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* Implemented to: RFC 7748 */ + + +#ifndef WOLF_CRYPT_CURVE448_H +#define WOLF_CRYPT_CURVE448_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef HAVE_CURVE448 + +#include <wolfssl/wolfcrypt/fe_448.h> +#include <wolfssl/wolfcrypt/random.h> + +#ifdef WOLFSSL_ASYNC_CRYPT + #include <wolfssl/wolfcrypt/async.h> +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +#define CURVE448_KEY_SIZE 56 +#define CURVE448_PUB_KEY_SIZE 56 + +#ifndef WC_CURVE448KEY_TYPE_DEFINED + typedef struct curve448_key curve448_key; + #define WC_CURVE448KEY_TYPE_DEFINED +#endif + +/* A CURVE448 Key */ +struct curve448_key { + byte p[CURVE448_PUB_KEY_SIZE]; /* public key */ + byte k[CURVE448_KEY_SIZE]; /* private key */ + +#ifdef WOLFSSL_ASYNC_CRYPT + WC_ASYNC_DEV asyncDev; +#endif + + /* bit fields */ + WC_BITFIELD pubSet:1; + WC_BITFIELD privSet:1; +}; + +enum { + EC448_LITTLE_ENDIAN = 0, + EC448_BIG_ENDIAN = 1 +}; + +WOLFSSL_API +int wc_curve448_make_key(WC_RNG* rng, int keysize, curve448_key* key); + +WOLFSSL_API +int wc_curve448_make_pub(int public_size, byte* pub, int private_size, + const byte* priv); + +WOLFSSL_API +int wc_curve448_shared_secret(curve448_key* private_key, + curve448_key* public_key, + byte* out, word32* outlen); + +WOLFSSL_API +int wc_curve448_shared_secret_ex(curve448_key* private_key, + curve448_key* public_key, + byte* out, word32* outlen, int endian); + +WOLFSSL_API +int wc_curve448_init(curve448_key* key); + +WOLFSSL_API +void wc_curve448_free(curve448_key* key); + + +/* raw key helpers */ +WOLFSSL_API +int wc_curve448_import_private(const byte* priv, word32 privSz, + curve448_key* key); +WOLFSSL_API +int wc_curve448_import_private_ex(const byte* priv, word32 privSz, + curve448_key* key, int endian); + +WOLFSSL_API +int wc_curve448_import_private_raw(const byte* priv, word32 privSz, + const byte* pub, word32 pubSz, + curve448_key* key); +WOLFSSL_API +int wc_curve448_import_private_raw_ex(const byte* priv, word32 privSz, + const byte* pub, word32 pubSz, + curve448_key* key, int endian); +WOLFSSL_API +int wc_curve448_export_private_raw(curve448_key* key, byte* out, + word32* outLen); +WOLFSSL_API +int wc_curve448_export_private_raw_ex(curve448_key* key, byte* out, + word32* outLen, int endian); + +WOLFSSL_API +int wc_curve448_import_public(const byte* in, word32 inLen, + curve448_key* key); +WOLFSSL_API +int wc_curve448_import_public_ex(const byte* in, word32 inLen, + curve448_key* key, int endian); +WOLFSSL_API +int wc_curve448_check_public(const byte* pub, word32 pubSz, int endian); + +WOLFSSL_API +int wc_curve448_export_public(curve448_key* key, byte* out, word32* outLen); +WOLFSSL_API +int wc_curve448_export_public_ex(curve448_key* key, byte* out, + word32* outLen, int endian); + +WOLFSSL_API +int wc_curve448_export_key_raw(curve448_key* key, + byte* priv, word32 *privSz, + byte* pub, word32 *pubSz); +WOLFSSL_API +int wc_curve448_export_key_raw_ex(curve448_key* key, + byte* priv, word32 *privSz, + byte* pub, word32 *pubSz, + int endian); +/* size helper */ +WOLFSSL_API +int wc_curve448_size(curve448_key* key); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* HAVE_CURVE448 */ +#endif /* WOLF_CRYPT_CURVE448_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/des3.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/des3.h @@ -0,0 +1,167 @@ +/* des3.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/des3.h +*/ + +#ifndef WOLF_CRYPT_DES3_H +#define WOLF_CRYPT_DES3_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifndef NO_DES3 + +#if defined(HAVE_FIPS) && defined(HAVE_FIPS_VERSION) && \ + (HAVE_FIPS_VERSION == 2 || HAVE_FIPS_VERSION == 3) + #include <wolfssl/wolfcrypt/fips.h> +#endif /* HAVE_FIPS_VERSION >= 2 */ + +#ifdef __cplusplus + extern "C" { +#endif + +/* these are required for FIPS and non-FIPS */ +enum { + DES_KEY_SIZE = 8, /* des */ + DES3_KEY_SIZE = 24, /* 3 des ede */ + DES_IV_SIZE = 8 /* should be the same as DES_BLOCK_SIZE */ +}; + + +/* avoid redefinition of structs */ +#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && \ + HAVE_FIPS_VERSION >= 2) + +#ifdef WOLFSSL_ASYNC_CRYPT + #include <wolfssl/wolfcrypt/async.h> +#endif + +#ifdef WOLFSSL_SE050 + /* SE050 SDK also defines DES_BLOCK_SIZE */ + #undef DES_BLOCK_SIZE +#endif + +enum { + DES_ENC_TYPE = WC_CIPHER_DES, /* cipher unique type */ + DES3_ENC_TYPE = WC_CIPHER_DES3, /* cipher unique type */ + + DES_BLOCK_SIZE = 8, + DES_KS_SIZE = 32, /* internal DES key buffer size */ + + DES_ENCRYPTION = 0, + DES_DECRYPTION = 1 +}; + +#define DES_IVLEN 8 +#define DES_KEYLEN 8 +#define DES3_IVLEN 8 +#define DES3_KEYLEN 24 + + +#if defined(STM32_CRYPTO) + +#include <wolfssl/wolfcrypt/port/st/stm32.h> + +enum { + DES_CBC = 0, + DES_ECB = 1 +}; +#endif + + +/* DES encryption and decryption */ +typedef struct Des { + word32 reg[DES_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */ + word32 tmp[DES_BLOCK_SIZE / sizeof(word32)]; /* same */ + word32 key[DES_KS_SIZE]; +} Des; + + +/* DES3 encryption and decryption */ +struct Des3 { + word32 key[3][DES_KS_SIZE]; + word32 reg[DES_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */ + word32 tmp[DES_BLOCK_SIZE / sizeof(word32)]; /* same */ +#ifdef WOLFSSL_ASYNC_CRYPT + WC_ASYNC_DEV asyncDev; +#endif +#if defined(WOLF_CRYPTO_CB) || \ + (defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_3DES)) + word32 devKey[DES3_KEYLEN/sizeof(word32)]; /* raw key */ +#endif +#ifdef WOLF_CRYPTO_CB + int devId; + void* devCtx; +#endif + void* heap; +}; + +#ifndef WC_DES3_TYPE_DEFINED + typedef struct Des3 Des3; + #define WC_DES3_TYPE_DEFINED +#endif +#endif /* HAVE_FIPS && HAVE_FIPS_VERSION >= 2 */ + + +WOLFSSL_API int wc_Des_SetKey(Des* des, const byte* key, + const byte* iv, int dir); +WOLFSSL_API void wc_Des_SetIV(Des* des, const byte* iv); +WOLFSSL_API int wc_Des_CbcEncrypt(Des* des, byte* out, + const byte* in, word32 sz); +WOLFSSL_API int wc_Des_CbcDecrypt(Des* des, byte* out, + const byte* in, word32 sz); +WOLFSSL_API int wc_Des_EcbEncrypt(Des* des, byte* out, + const byte* in, word32 sz); +WOLFSSL_API int wc_Des3_EcbEncrypt(Des3* des, byte* out, + const byte* in, word32 sz); + +#ifdef FREESCALE_MMCAU /* Has separate encrypt/decrypt functions */ +WOLFSSL_API int wc_Des_EcbDecrypt(Des* des, byte* out, + const byte* in, word32 sz); +WOLFSSL_API int wc_Des3_EcbDecrypt(Des3* des, byte* out, + const byte* in, word32 sz); +#else +/* ECB decrypt same process as encrypt but with decrypt key */ +#define wc_Des_EcbDecrypt wc_Des_EcbEncrypt +#define wc_Des3_EcbDecrypt wc_Des3_EcbEncrypt +#endif + +WOLFSSL_API int wc_Des3_SetKey(Des3* des, const byte* key, + const byte* iv,int dir); +WOLFSSL_API int wc_Des3_SetIV(Des3* des, const byte* iv); +WOLFSSL_API int wc_Des3_CbcEncrypt(Des3* des, byte* out, + const byte* in,word32 sz); +WOLFSSL_API int wc_Des3_CbcDecrypt(Des3* des, byte* out, + const byte* in,word32 sz); + +/* These are only required when using either: + static memory (WOLFSSL_STATIC_MEMORY) or asynchronous (WOLFSSL_ASYNC_CRYPT) */ +WOLFSSL_API int wc_Des3Init(Des3* des3, void* heap, int devId); +WOLFSSL_API void wc_Des3Free(Des3* des3); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* NO_DES3 */ +#endif /* WOLF_CRYPT_DES3_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/dh.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/dh.h @@ -0,0 +1,218 @@ +/* dh.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/dh.h +*/ + +#ifndef WOLF_CRYPT_DH_H +#define WOLF_CRYPT_DH_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifndef NO_DH + +#if FIPS_VERSION3_GE(2,0,0) + #include <wolfssl/wolfcrypt/fips.h> +#endif /* HAVE_FIPS_VERSION >= 2 */ + +#include <wolfssl/wolfcrypt/wolfmath.h> +#include <wolfssl/wolfcrypt/random.h> + +#ifdef WOLFSSL_KCAPI_DH + #include <wolfssl/wolfcrypt/port/kcapi/kcapi_dh.h> +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +#ifdef WOLFSSL_ASYNC_CRYPT + #include <wolfssl/wolfcrypt/async.h> +#endif + +typedef struct DhParams { +#ifdef HAVE_FFDHE_Q + const byte* q; + word32 q_len; +#endif /* HAVE_FFDHE_Q */ + const byte* p; + word32 p_len; + const byte* g; + word32 g_len; +} DhParams; + +/* Diffie-Hellman Key */ +struct DhKey { + mp_int p, g, q; /* group parameters */ +#ifdef WOLFSSL_DH_EXTRA + mp_int pub; + mp_int priv; +#endif + void* heap; +#ifdef WOLFSSL_ASYNC_CRYPT + WC_ASYNC_DEV asyncDev; +#endif + int trustedGroup; +#ifdef WOLFSSL_KCAPI_DH + struct kcapi_handle* handle; +#endif +}; + +#ifndef WC_DH_TYPE_DEFINED + typedef struct DhKey DhKey; + #define WC_DH_TYPE_DEFINED +#endif + +enum { + WC_FFDHE_2048 = 256, + WC_FFDHE_3072 = 257, + WC_FFDHE_4096 = 258, + WC_FFDHE_6144 = 259, + WC_FFDHE_8192 = 260 +}; + +/* DH Private Key size up to 8192 bit */ +#ifndef WC_DH_PRIV_MAX_SZ +#define WC_DH_PRIV_MAX_SZ 52 +#endif + +#ifndef DH_MAX_SIZE + #ifdef USE_FAST_MATH + /* FP implementation support numbers up to FP_MAX_BITS / 2 bits. */ + #define DH_MAX_SIZE (FP_MAX_BITS / 2) + #if defined(WOLFSSL_MYSQL_COMPATIBLE) && DH_MAX_SIZE < 8192 + #error "MySQL needs FP_MAX_BITS at least at 16384" + #endif + #elif defined(WOLFSSL_SP_MATH_ALL) || defined(WOLFSSL_SP_MATH) + /* SP implementation supports numbers of SP_INT_BITS bits. */ + #define DH_MAX_SIZE (((SP_INT_BITS + 7) / 8) * 8) + #if defined(WOLFSSL_MYSQL_COMPATIBLE) && DH_MAX_SIZE < 8192 + #error "MySQL needs SP_INT_BITS at least at 8192" + #endif + #else + #ifdef WOLFSSL_MYSQL_COMPATIBLE + /* Integer maths is dynamic but we only go up to 8192 bits. */ + #define DH_MAX_SIZE 8192 + #else + /* Integer maths is dynamic but we only go up to 4096 bits. */ + #define DH_MAX_SIZE 4096 + #endif + #endif +#endif + +#if FIPS_VERSION3_GE(6,0,0) + extern const unsigned int wolfCrypt_FIPS_dh_ro_sanity[2]; + WOLFSSL_LOCAL int wolfCrypt_FIPS_DH_sanity(void); +#endif + +#ifdef HAVE_PUBLIC_FFDHE +#ifdef HAVE_FFDHE_2048 +WOLFSSL_API const DhParams* wc_Dh_ffdhe2048_Get(void); +#endif +#ifdef HAVE_FFDHE_3072 +WOLFSSL_API const DhParams* wc_Dh_ffdhe3072_Get(void); +#endif +#ifdef HAVE_FFDHE_4096 +WOLFSSL_API const DhParams* wc_Dh_ffdhe4096_Get(void); +#endif +#ifdef HAVE_FFDHE_6144 +WOLFSSL_API const DhParams* wc_Dh_ffdhe6144_Get(void); +#endif +#ifdef HAVE_FFDHE_8192 +WOLFSSL_API const DhParams* wc_Dh_ffdhe8192_Get(void); +#endif +#endif + +WOLFSSL_API int wc_InitDhKey(DhKey* key); +WOLFSSL_API int wc_InitDhKey_ex(DhKey* key, void* heap, int devId); +WOLFSSL_API int wc_FreeDhKey(DhKey* key); +WOLFSSL_API int wc_DhGenerateKeyPair(DhKey* key, WC_RNG* rng, byte* priv, + word32* privSz, byte* pub, word32* pubSz); +WOLFSSL_API int wc_DhAgree(DhKey* key, byte* agree, word32* agreeSz, + const byte* priv, word32 privSz, const byte* otherPub, + word32 pubSz); +WOLFSSL_API int wc_DhAgree_ct(DhKey* key, byte* agree, word32* agreeSz, + const byte* priv, word32 privSz, const byte* otherPub, + word32 pubSz); + +WOLFSSL_API int wc_DhKeyDecode(const byte* input, word32* inOutIdx, DhKey* key, + word32 inSz); /* wc_DhKeyDecode is in asn.c */ + +WOLFSSL_API int wc_DhSetKey(DhKey* key, const byte* p, word32 pSz, const byte* g, + word32 gSz); +WOLFSSL_API int wc_DhSetKey_ex(DhKey* key, const byte* p, word32 pSz, + const byte* g, word32 gSz, const byte* q, word32 qSz); +WOLFSSL_API int wc_DhSetNamedKey(DhKey* key, int name); +WOLFSSL_API int wc_DhGetNamedKeyParamSize(int name, + word32* p, word32* g, word32* q); +WOLFSSL_API word32 wc_DhGetNamedKeyMinSize(int name); +WOLFSSL_API int wc_DhCmpNamedKey(int name, int noQ, + const byte* p, word32 pSz, + const byte* g, word32 gSz, + const byte* q, word32 qSz); +WOLFSSL_API int wc_DhCopyNamedKey(int name, + byte* p, word32* pSz, byte* g, word32* gSz, byte* q, word32* qSz); + +#ifndef WOLFSSL_NO_DH_GEN_PUB + #if defined(WOLFSSL_DH_EXTRA) && !defined(WOLFSSL_DH_GEN_PUB) + #define WOLFSSL_DH_GEN_PUB + #endif + #ifdef WOLFSSL_DH_GEN_PUB + WOLFSSL_API int wc_DhGeneratePublic(DhKey* key, byte* priv, + word32 privSz, byte* pub, + word32* pubSz); + #endif /* WOLFSSL_DH_GEN_PUB */ +#endif /* !WOLFSSL_NO_DH_GEN_PUB */ + +#ifdef WOLFSSL_DH_EXTRA +WOLFSSL_API int wc_DhImportKeyPair(DhKey* key, const byte* priv, word32 privSz, + const byte* pub, word32 pubSz); +WOLFSSL_API int wc_DhExportKeyPair(DhKey* key, byte* priv, word32* pPrivSz, + byte* pub, word32* pPubSz); +WOLFSSL_LOCAL int wc_DhKeyCopy(DhKey* src, DhKey* dst); +#endif +WOLFSSL_API int wc_DhSetCheckKey(DhKey* key, const byte* p, word32 pSz, + const byte* g, word32 gSz, const byte* q, word32 qSz, + int trusted, WC_RNG* rng); +WOLFSSL_API int wc_DhParamsLoad(const byte* input, word32 inSz, byte* p, + word32* pInOutSz, byte* g, word32* gInOutSz); +WOLFSSL_API int wc_DhCheckPubKey(DhKey* key, const byte* pub, word32 pubSz); +WOLFSSL_API int wc_DhCheckPubKey_ex(DhKey* key, const byte* pub, word32 pubSz, + const byte* prime, word32 primeSz); +WOLFSSL_API int wc_DhCheckPubValue(const byte* prime, word32 primeSz, + const byte* pub, word32 pubSz); +WOLFSSL_API int wc_DhCheckPrivKey(DhKey* key, const byte* priv, word32 pubSz); +WOLFSSL_API int wc_DhCheckPrivKey_ex(DhKey* key, const byte* priv, word32 pubSz, + const byte* prime, word32 primeSz); +WOLFSSL_API int wc_DhCheckKeyPair(DhKey* key, const byte* pub, word32 pubSz, + const byte* priv, word32 privSz); +WOLFSSL_API int wc_DhGenerateParams(WC_RNG *rng, int modSz, DhKey *dh); +WOLFSSL_API int wc_DhExportParamsRaw(DhKey* dh, byte* p, word32* pSz, + byte* q, word32* qSz, byte* g, word32* gSz); + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* NO_DH */ +#endif /* WOLF_CRYPT_DH_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/dilithium.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/dilithium.h @@ -0,0 +1,967 @@ +/* dilithium.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/dilithium.h +*/ + +/* Interfaces for Dilithium NIST Level 1 (Dilithium512) and Dilithium NIST Level 5 + * (Dilithium1024). */ + +#ifndef WOLF_CRYPT_DILITHIUM_H +#define WOLF_CRYPT_DILITHIUM_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef WOLF_CRYPTO_CB + #include <wolfssl/wolfcrypt/cryptocb.h> +#endif + +#if defined(HAVE_DILITHIUM) + +#ifdef HAVE_LIBOQS +#include <oqs/oqs.h> +#include <wolfssl/wolfcrypt/port/liboqs/liboqs.h> +#endif + +#if defined(WOLFSSL_DILITHIUM_NO_MAKE_KEY) && \ + defined(WOLFSSL_DILITHIUM_NO_SIGN) && \ + !defined(WOLFSSL_DILITHIUM_NO_VERIFY) && \ + !defined(WOLFSSL_DILITHIUM_VERIFY_ONLY) + #define WOLFSSL_DILITHIUM_VERIFY_ONLY +#endif +#ifdef WOLFSSL_DILITHIUM_VERIFY_ONLY + #ifndef WOLFSSL_DILITHIUM_NO_MAKE_KEY + #define WOLFSSL_DILITHIUM_NO_MAKE_KEY + #endif + #ifndef WOLFSSL_DILITHIUM_NO_SIGN + #define WOLFSSL_DILITHIUM_NO_SIGN + #endif +#endif + +#if !defined(WOLFSSL_DILITHIUM_NO_MAKE_KEY) || \ + !defined(WOLFSSL_DILITHIUM_NO_VERIFY) + #define WOLFSSL_DILITHIUM_PUBLIC_KEY +#endif +#if !defined(WOLFSSL_DILITHIUM_NO_MAKE_KEY) || \ + !defined(WOLFSSL_DILITHIUM_NO_SIGN) + #define WOLFSSL_DILITHIUM_PRIVATE_KEY +#endif + +#if defined(WOLFSSL_DILITHIUM_PUBLIC_KEY) && \ + defined(WOLFSSL_DILITHIUM_PRIVATE_KEY) && \ + !defined(WOLFSSL_DILITHIUM_NO_CHECK_KEY) && \ + !defined(WOLFSSL_DILITHIUM_CHECK_KEY) + #define WOLFSSL_DILITHIUM_CHECK_KEY +#endif + +#ifdef WOLFSSL_WC_DILITHIUM + #include <wolfssl/wolfcrypt/sha3.h> +#ifndef WOLFSSL_DILITHIUM_VERIFY_ONLY + #include <wolfssl/wolfcrypt/random.h> +#endif +#endif + +#if defined(WC_DILITHIUM_CACHE_PRIV_VECTORS) && \ + !defined(WC_DILITHIUM_CACHE_MATRIX_A) + #define WC_DILITHIUM_CACHE_MATRIX_A +#endif +#if defined(WC_DILITHIUM_CACHE_PUB_VECTORS) && \ + !defined(WC_DILITHIUM_CACHE_MATRIX_A) + #define WC_DILITHIUM_CACHE_MATRIX_A +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +/* Macros Definitions */ + +#ifdef WOLFSSL_WC_DILITHIUM + +#ifndef WOLFSSL_DILITHIUM_ALIGNMENT + #if defined(__arch64__) + #define WOLFSSL_DILITHIUM_ALIGNMENT 8 + #elif defined(__arm__) + #define WOLFSSL_DILITHIUM_ALIGNMENT 4 + #elif !defined(WOLFSSL_AESNI) && defined(WOLFSSL_GENERAL_ALIGNMENT) + #define WOLFSSL_DILITHIUM_ALIGNMENT WOLFSSL_GENERAL_ALIGNMENT + #else + #define WOLFSSL_DILITHIUM_ALIGNMENT 8 + #endif +#endif /* WOLFSSL_DILITHIUM_ALIGNMENT */ + +#define DILITHIUM_LEVEL2_KEY_SIZE 2560 +#define DILITHIUM_LEVEL2_SIG_SIZE 2420 +#define DILITHIUM_LEVEL2_PUB_KEY_SIZE 1312 +#define DILITHIUM_LEVEL2_PRV_KEY_SIZE \ + (DILITHIUM_LEVEL2_PUB_KEY_SIZE + DILITHIUM_LEVEL2_KEY_SIZE) +/* Buffer sizes large enough to store exported DER encoded keys */ +#define DILITHIUM_LEVEL2_PUB_KEY_DER_SIZE 1334 +#define DILITHIUM_LEVEL2_PRV_KEY_DER_SIZE 2588 +#define DILITHIUM_LEVEL2_BOTH_KEY_DER_SIZE 3904 +/* PEM size with the header "-----BEGIN PRIVATE KEY-----" and + * the footer "-----END PRIVATE KEY-----" */ +#define DILITHIUM_LEVEL2_BOTH_KEY_PEM_SIZE 5344 + +#define DILITHIUM_LEVEL3_KEY_SIZE 4032 +#define DILITHIUM_LEVEL3_SIG_SIZE 3309 +#define DILITHIUM_LEVEL3_PUB_KEY_SIZE 1952 +#define DILITHIUM_LEVEL3_PRV_KEY_SIZE \ + (DILITHIUM_LEVEL3_PUB_KEY_SIZE + DILITHIUM_LEVEL3_KEY_SIZE) +/* Buffer sizes large enough to store exported DER encoded keys */ +#define DILITHIUM_LEVEL3_PUB_KEY_DER_SIZE 1974 +#define DILITHIUM_LEVEL3_PRV_KEY_DER_SIZE 4060 +#define DILITHIUM_LEVEL3_BOTH_KEY_DER_SIZE 6016 +/* PEM size with the header "-----BEGIN PRIVATE KEY-----" and + * the footer "-----END PRIVATE KEY-----" */ +#define DILITHIUM_LEVEL3_BOTH_KEY_PEM_SIZE 8204 + +#define DILITHIUM_LEVEL5_KEY_SIZE 4896 +#define DILITHIUM_LEVEL5_SIG_SIZE 4627 +#define DILITHIUM_LEVEL5_PUB_KEY_SIZE 2592 +#define DILITHIUM_LEVEL5_PRV_KEY_SIZE \ + (DILITHIUM_LEVEL5_PUB_KEY_SIZE + DILITHIUM_LEVEL5_KEY_SIZE) +/* Buffer sizes large enough to store exported DER encoded keys */ +#define DILITHIUM_LEVEL5_PUB_KEY_DER_SIZE 2614 +#define DILITHIUM_LEVEL5_PRV_KEY_DER_SIZE 4924 +#define DILITHIUM_LEVEL5_BOTH_KEY_DER_SIZE 7520 +/* PEM size with the header "-----BEGIN ML_DSA_LEVEL5 PRIVATE KEY-----" and + * the footer "-----END ML_DSA_LEVEL5 PRIVATE KEY-----" */ +#define DILITHIUM_LEVEL5_BOTH_KEY_PEM_SIZE 10267 + +#define ML_DSA_LEVEL2_KEY_SIZE 2560 +#define ML_DSA_LEVEL2_SIG_SIZE 2420 +#define ML_DSA_LEVEL2_PUB_KEY_SIZE 1312 +#define ML_DSA_LEVEL2_PRV_KEY_SIZE \ + (ML_DSA_LEVEL2_PUB_KEY_SIZE + ML_DSA_LEVEL2_KEY_SIZE) +/* Buffer sizes large enough to store exported DER encoded keys */ +#define ML_DSA_LEVEL2_PUB_KEY_DER_SIZE DILITHIUM_LEVEL2_PUB_KEY_DER_SIZE +#define ML_DSA_LEVEL2_PRV_KEY_DER_SIZE DILITHIUM_LEVEL2_PRV_KEY_DER_SIZE +#define ML_DSA_LEVEL2_BOTH_KEY_DER_SIZE DILITHIUM_LEVEL2_BOTH_KEY_DER_SIZE +/* PEM size with the header "-----BEGIN PRIVATE KEY-----" and + * the footer "-----END PRIVATE KEY-----" */ +#define ML_DSA_LEVEL2_BOTH_KEY_PEM_SIZE DILITHIUM_LEVEL2_BOTH_KEY_PEM_SIZE + +#define ML_DSA_LEVEL3_KEY_SIZE 4032 +#define ML_DSA_LEVEL3_SIG_SIZE 3309 +#define ML_DSA_LEVEL3_PUB_KEY_SIZE 1952 +#define ML_DSA_LEVEL3_PRV_KEY_SIZE \ + (ML_DSA_LEVEL3_PUB_KEY_SIZE + ML_DSA_LEVEL3_KEY_SIZE) +/* Buffer sizes large enough to store exported DER encoded keys */ +#define ML_DSA_LEVEL3_PUB_KEY_DER_SIZE DILITHIUM_LEVEL3_PUB_KEY_DER_SIZE +#define ML_DSA_LEVEL3_PRV_KEY_DER_SIZE DILITHIUM_LEVEL3_PRV_KEY_DER_SIZE +#define ML_DSA_LEVEL3_BOTH_KEY_DER_SIZE DILITHIUM_LEVEL3_BOTH_KEY_DER_SIZE +/* PEM size with the header "-----BEGIN PRIVATE KEY-----" and + * the footer "-----END PRIVATE KEY-----" */ +#define ML_DSA_LEVEL3_BOTH_KEY_PEM_SIZE DILITHIUM_LEVEL3_BOTH_KEY_PEM_SIZE + +#define ML_DSA_LEVEL5_KEY_SIZE 4896 +#define ML_DSA_LEVEL5_SIG_SIZE 4627 +#define ML_DSA_LEVEL5_PUB_KEY_SIZE 2592 +#define ML_DSA_LEVEL5_PRV_KEY_SIZE \ + (ML_DSA_LEVEL5_PUB_KEY_SIZE + ML_DSA_LEVEL5_KEY_SIZE) +/* Buffer sizes large enough to store exported DER encoded keys */ +#define ML_DSA_LEVEL5_PUB_KEY_DER_SIZE DILITHIUM_LEVEL5_PUB_KEY_DER_SIZE +#define ML_DSA_LEVEL5_PRV_KEY_DER_SIZE DILITHIUM_LEVEL5_PRV_KEY_DER_SIZE +#define ML_DSA_LEVEL5_BOTH_KEY_DER_SIZE DILITHIUM_LEVEL5_BOTH_KEY_DER_SIZE +/* PEM size with the header "-----BEGIN ML_DSA_LEVEL5 PRIVATE KEY-----" and + * the footer "-----END ML_DSA_LEVEL5 PRIVATE KEY-----" */ +#define ML_DSA_LEVEL5_BOTH_KEY_PEM_SIZE DILITHIUM_LEVEL5_BOTH_KEY_PEM_SIZE + + + +/* Modulus. */ +#define DILITHIUM_Q 0x7fe001 +/* Number of bits in modulus. */ +#define DILITHIUM_Q_BITS 23 +/* Number of elements in polynomial. */ +#define DILITHIUM_N 256 + +/* Number of dropped bits. */ +#define DILITHIUM_D 13 +/* Maximum value of dropped bits. */ +#define DILITHIUM_D_MAX (1 << DILITHIUM_D) +/* Half maximum value. */ +#define DILITHIUM_D_MAX_HALF (1 << (DILITHIUM_D - 1)) +/* Number of undropped bits. */ +#define DILITHIUM_U (DILITHIUM_Q_BITS - DILITHIUM_D) + +/* Bits in coefficient range of y, GAMMA1, of 2^17 is 17. */ +#define DILITHIUM_GAMMA1_BITS_17 17 +/* Coefficient range of y, GAMMA1, of 2^17. */ +#define DILITHIUM_GAMMA1_17 (1 << 17) +/* # encoding bits of y is GAMMA1 + 1. */ +#define DILITHIUM_GAMMA1_17_ENC_BITS 18 +/* Coefficient range of y, GAMMA1, of 2^17. */ +/* Bits in coefficient range of y, GAMMA1, of 2^19 is 19. */ +#define DILITHIUM_GAMMA1_BITS_19 19 +/* Coefficient range of y, GAMMA1, of 2^19. */ +#define DILITHIUM_GAMMA1_19 (1 << 19) +/* # encoding bits of y is GAMMA1 + 1. */ +#define DILITHIUM_GAMMA1_19_ENC_BITS 20 + +/* Low-order rounding range, GAMMA2, is Q divided by 88. */ +#define DILITHIUM_Q_LOW_88 ((DILITHIUM_Q - 1) / 88) +/* Absolute low-order rounding range, GAMMA2, is Q divided by 88. */ +#define DILITHIUM_Q_LOW_88_2 (((DILITHIUM_Q - 1) / 88) * 2) +/* # encoding bits of w1 when range is 88. */ +#define DILITHIUM_Q_HI_88_ENC_BITS 6 +/* Low-order rounding range, GAMMA2, is Q divided by 32. */ +#define DILITHIUM_Q_LOW_32 ((DILITHIUM_Q - 1) / 32) +/* Absolute low-order rounding range, GAMMA2, is Q divided by 32. */ +#define DILITHIUM_Q_LOW_32_2 (((DILITHIUM_Q - 1) / 32) * 2) +/* # encoding bits of w1 when range is 32. */ +#define DILITHIUM_Q_HI_32_ENC_BITS 4 + +/* Private key range, eta, of 2. */ +#define DILITHIUM_ETA_2 2 +/* Bits needed to encode values in range -2..2 as a positive number. */ +#define DILITHIUM_ETA_2_BITS 3 +/* Extract count of valid values. */ +#define DILITHIUM_ETA_2_MOD 15 +/* Private key range, eta, of 4. */ +#define DILITHIUM_ETA_4 4 +/* Bits needed to encode values in range -4..4 as a positive number. */ +#define DILITHIUM_ETA_4_BITS 4 +/* Extract count of valid values. */ +#define DILITHIUM_ETA_4_MOD 9 + +/* Number of bytes in a polynomial in memory. */ +#define DILITHIUM_POLY_SIZE (DILITHIUM_N * sizeof(sword32)) + +#ifndef WOLFSSL_NO_ML_DSA_44 + +/* Fist dimension of A, k, for ML-DSA-44. */ +#define PARAMS_ML_DSA_44_K 4 +/* Second dimension of A, l, for ML-DSA-44. */ +#define PARAMS_ML_DSA_44_L 4 +/* Private key range, ETA, for ML-DSA-44. */ +#define PARAMS_ML_DSA_44_ETA DILITHIUM_ETA_2 +/* Number of bits in private key for ML-DSA-44. */ +#define PARAMS_ML_DSA_44_ETA_BITS DILITHIUM_ETA_2_BITS +/* Collision strength of c-tilde, LAMBDA, in bits for ML-DSA-44. */ +#define PARAMS_ML_DSA_44_LAMBDA 128 +/* # +/-1's in polynomial c, TAU, for ML-DSA-44. */ +#define PARAMS_ML_DSA_44_TAU 39 +/* BETA = TAU * ETA for ML-DSA-44. */ +#define PARAMS_ML_DSA_44_BETA \ + (PARAMS_ML_DSA_44_TAU * PARAMS_ML_DSA_44_ETA) +/* Max # 1's in the hint h, OMEGA, for ML-DSA-44. */ +#define PARAMS_ML_DSA_44_OMEGA 80 +/* Bits in coefficient range of y, GAMMA1, for ML-DSA-44. */ +#define PARAMS_ML_DSA_44_GAMMA1_BITS DILITHIUM_GAMMA1_BITS_17 +/* Ccoefficient range of y, GAMMA1, for ML-DSA-44. */ +#define PARAMS_ML_DSA_44_GAMMA1 (1 << PARAMS_ML_DSA_44_GAMMA1_BITS) +/* Low-order rounding range, GAMMA2, for ML-DSA-44. */ +#define PARAMS_ML_DSA_44_GAMMA2 DILITHIUM_Q_LOW_88 +/* Bits in high-order rounding range, GAMMA2, for ML-DSA-44. */ +#define PARAMS_ML_DSA_44_GAMMA2_HI_BITS 6 +/* Encoding size of w1 in bytes for ML-DSA-44. + * K * N / 8 * 6 - 6 bits as max value is 43 in high bits. */ +#define PARAMS_ML_DSA_44_W1_ENC_SZ \ + (PARAMS_ML_DSA_44_K * DILITHIUM_N / 8 * PARAMS_ML_DSA_44_GAMMA2_HI_BITS) +/* Size of memory used for matrix a in bytes for ML-DSA-44. */ +#define PARAMS_ML_DSA_44_A_SIZE \ + (PARAMS_ML_DSA_44_K * PARAMS_ML_DSA_44_L * DILITHIUM_POLY_SIZE) +/* Size of memory used for vector s1 in bytes for ML-DSA-44. */ +#define PARAMS_ML_DSA_44_S1_SIZE \ + (PARAMS_ML_DSA_44_L * DILITHIUM_POLY_SIZE) +/* Encoding size of s1 in bytes for ML-DSA-44. */ +#define PARAMS_ML_DSA_44_S1_ENC_SIZE \ + (PARAMS_ML_DSA_44_S1_SIZE / sizeof(sword32) * PARAMS_ML_DSA_44_ETA_BITS / 8) +/* Size of memory used for vector s2 in bytes for ML-DSA-44. */ +#define PARAMS_ML_DSA_44_S2_SIZE \ + (PARAMS_ML_DSA_44_K * DILITHIUM_POLY_SIZE) +/* Encoding size of s2 in bytes for ML-DSA-44. */ +#define PARAMS_ML_DSA_44_S2_ENC_SIZE \ + (PARAMS_ML_DSA_44_S2_SIZE / sizeof(sword32) * PARAMS_ML_DSA_44_ETA_BITS / 8) +/* Encoding size of z in bytes for ML-DSA-44. */ +#define PARAMS_ML_DSA_44_Z_ENC_SIZE \ + (PARAMS_ML_DSA_44_S1_SIZE / sizeof(sword32) / 8 * \ + (PARAMS_ML_DSA_44_GAMMA1_BITS + 1)) +/* Encoding size of public key in bytes for ML-DSA-44. */ +#define PARAMS_ML_DSA_44_PK_SIZE \ + (DILITHIUM_PUB_SEED_SZ + PARAMS_ML_DSA_44_K * DILITHIUM_N * DILITHIUM_U / 8) +/* Encoding size of signature in bytes for ML-DSA-44. */ +#define PARAMS_ML_DSA_44_SIG_SIZE \ + ((PARAMS_ML_DSA_44_LAMBDA / 4) + \ + PARAMS_ML_DSA_44_L * DILITHIUM_N/8 * (PARAMS_ML_DSA_44_GAMMA1_BITS + 1) + \ + PARAMS_ML_DSA_44_OMEGA + PARAMS_ML_DSA_44_K) + +#endif /* WOLFSSL_NO_ML_DSA_44 */ + +#ifndef WOLFSSL_NO_ML_DSA_65 + +/* Fist dimension of A, k, for ML-DSA-65. */ +#define PARAMS_ML_DSA_65_K 6 +/* Second dimension of A, l, for ML-DSA-65. */ +#define PARAMS_ML_DSA_65_L 5 +/* Private key range, ETA, for ML-DSA-65. */ +#define PARAMS_ML_DSA_65_ETA DILITHIUM_ETA_4 +/* Number of bits in private key for ML-DSA-65. */ +#define PARAMS_ML_DSA_65_ETA_BITS DILITHIUM_ETA_4_BITS +/* Collision strength of c-tilde, LAMBDA, in bits for ML-DSA-65. */ +#define PARAMS_ML_DSA_65_LAMBDA 192 +/* # +/-1's in polynomial c, TAU, for ML-DSA-65. */ +#define PARAMS_ML_DSA_65_TAU 49 +/* BETA = TAU * ETA for ML-DSA-65. */ +#define PARAMS_ML_DSA_65_BETA \ + (PARAMS_ML_DSA_65_TAU * PARAMS_ML_DSA_65_ETA) +/* Max # 1's in the hint h, OMEGA, for ML-DSA-65. */ +#define PARAMS_ML_DSA_65_OMEGA 55 +/* Bits in coefficient range of y, GAMMA1, for ML-DSA-65. */ +#define PARAMS_ML_DSA_65_GAMMA1_BITS DILITHIUM_GAMMA1_BITS_19 +/* Ccoefficient range of y, GAMMA1, for ML-DSA-65. */ +#define PARAMS_ML_DSA_65_GAMMA1 (1 << PARAMS_ML_DSA_65_GAMMA1_BITS) +/* Low-order rounding range, GAMMA2, for ML-DSA-65. */ +#define PARAMS_ML_DSA_65_GAMMA2 DILITHIUM_Q_LOW_32 +/* Bits in high-order rounding range, GAMMA2, for ML-DSA-65. */ +#define PARAMS_ML_DSA_65_GAMMA2_HI_BITS 4 +/* Encoding size of w1 in bytes for ML-DSA-65. + * K * N / 8 * 4 - 4 bits as max value is 15 in high bits. */ +#define PARAMS_ML_DSA_65_W1_ENC_SZ \ + (PARAMS_ML_DSA_65_K * DILITHIUM_N / 8 * PARAMS_ML_DSA_65_GAMMA2_HI_BITS) +/* Size of memory used for matrix a in bytes for ML-DSA-65. */ +#define PARAMS_ML_DSA_65_A_SIZE \ + (PARAMS_ML_DSA_65_K * PARAMS_ML_DSA_65_L * DILITHIUM_POLY_SIZE) +/* Size of memory used for vector s1 in bytes for ML-DSA-65. */ +#define PARAMS_ML_DSA_65_S1_SIZE \ + (PARAMS_ML_DSA_65_L * DILITHIUM_POLY_SIZE) +/* Encoding size of s1 in bytes for ML-DSA-65. */ +#define PARAMS_ML_DSA_65_S1_ENC_SIZE \ + (PARAMS_ML_DSA_65_S1_SIZE / sizeof(sword32) * PARAMS_ML_DSA_65_ETA_BITS / 8) +/* Size of memory used for vector s2 in bytes for ML-DSA-65. */ +#define PARAMS_ML_DSA_65_S2_SIZE \ + (PARAMS_ML_DSA_65_K * DILITHIUM_POLY_SIZE) +/* Encoding size of s2 in bytes for ML-DSA-65. */ +#define PARAMS_ML_DSA_65_S2_ENC_SIZE \ + (PARAMS_ML_DSA_65_S2_SIZE / sizeof(sword32) * PARAMS_ML_DSA_65_ETA_BITS / 8) +/* Encoding size of z in bytes for ML-DSA-65. */ +#define PARAMS_ML_DSA_65_Z_ENC_SIZE \ + (PARAMS_ML_DSA_65_S1_SIZE / sizeof(sword32) / 8 * \ + (PARAMS_ML_DSA_65_GAMMA1_BITS + 1)) +/* Encoding size of public key in bytes for ML-DSA-65. */ +#define PARAMS_ML_DSA_65_PK_SIZE \ + (DILITHIUM_PUB_SEED_SZ + PARAMS_ML_DSA_65_K * DILITHIUM_N * DILITHIUM_U / 8) +/* Encoding size of signature in bytes for ML-DSA-65. */ +#define PARAMS_ML_DSA_65_SIG_SIZE \ + ((PARAMS_ML_DSA_65_LAMBDA / 4) + \ + PARAMS_ML_DSA_65_L * DILITHIUM_N/8 * (PARAMS_ML_DSA_65_GAMMA1_BITS + 1) + \ + PARAMS_ML_DSA_65_OMEGA + PARAMS_ML_DSA_65_K) + +#endif /* WOLFSSL_NO_ML_DSA_65 */ + +#ifndef WOLFSSL_NO_ML_DSA_87 + +/* Fist dimension of A, k, for ML-DSA-87. */ +#define PARAMS_ML_DSA_87_K 8 +/* Second dimension of A, l, for ML-DSA-87. */ +#define PARAMS_ML_DSA_87_L 7 +/* Private key range, ETA, for ML-DSA-87. */ +#define PARAMS_ML_DSA_87_ETA DILITHIUM_ETA_2 +/* Number of bits in private key for ML-DSA-87. */ +#define PARAMS_ML_DSA_87_ETA_BITS DILITHIUM_ETA_2_BITS +/* Collision strength of c-tilde, LAMBDA, in bits for ML-DSA-87. */ +#define PARAMS_ML_DSA_87_LAMBDA 256 +/* # +/-1's in polynomial c, TAU, for ML-DSA-87. */ +#define PARAMS_ML_DSA_87_TAU 60 +/* BETA = TAU * ETA for ML-DSA-87. */ +#define PARAMS_ML_DSA_87_BETA \ + (PARAMS_ML_DSA_87_TAU * PARAMS_ML_DSA_87_ETA) +/* Max # 1's in the hint h, OMEGA, for ML-DSA-87. */ +#define PARAMS_ML_DSA_87_OMEGA 75 +/* Bits in coefficient range of y, GAMMA1, for ML-DSA-87. */ +#define PARAMS_ML_DSA_87_GAMMA1_BITS DILITHIUM_GAMMA1_BITS_19 +/* Ccoefficient range of y, GAMMA1, for ML-DSA-87. */ +#define PARAMS_ML_DSA_87_GAMMA1 (1 << PARAMS_ML_DSA_87_GAMMA1_BITS) +/* Low-order rounding range, GAMMA2, for ML-DSA-87. */ +#define PARAMS_ML_DSA_87_GAMMA2 DILITHIUM_Q_LOW_32 +/* Bits in high-order rounding range, GAMMA2, for ML-DSA-87. */ +#define PARAMS_ML_DSA_87_GAMMA2_HI_BITS 4 +/* Encoding size of w1 in bytes for ML-DSA-87. + * K * N / 8 * 4 - 4 bits as max value is 15 in high bits. */ +#define PARAMS_ML_DSA_87_W1_ENC_SZ \ + (PARAMS_ML_DSA_87_K * DILITHIUM_N / 8 * PARAMS_ML_DSA_87_GAMMA2_HI_BITS) +/* Size of memory used for matrix A in bytes for ML-DSA-87. */ +#define PARAMS_ML_DSA_87_A_SIZE \ + (PARAMS_ML_DSA_87_K * PARAMS_ML_DSA_87_L * DILITHIUM_POLY_SIZE) +#define PARAMS_ML_DSA_87_S_SIZE 4 +/* Size of memory used for vector s1 in bytes for ML-DSA-87. */ +#define PARAMS_ML_DSA_87_S1_SIZE \ + (PARAMS_ML_DSA_87_L * DILITHIUM_POLY_SIZE) +/* Encoding size of s1 in bytes for ML-DSA-87. */ +#define PARAMS_ML_DSA_87_S1_ENC_SIZE \ + (PARAMS_ML_DSA_87_S1_SIZE / sizeof(sword32) * PARAMS_ML_DSA_87_ETA_BITS / 8) +/* Size of memory used for vector s2 in bytes for ML-DSA-87. */ +#define PARAMS_ML_DSA_87_S2_SIZE \ + (PARAMS_ML_DSA_87_K * DILITHIUM_POLY_SIZE) +/* Encoding size of s2 in bytes for ML-DSA-87. */ +#define PARAMS_ML_DSA_87_S2_ENC_SIZE \ + (PARAMS_ML_DSA_87_S2_SIZE / sizeof(sword32) * PARAMS_ML_DSA_87_ETA_BITS / 8) +/* Encoding size of z in bytes for ML-DSA-87. */ +#define PARAMS_ML_DSA_87_Z_ENC_SIZE \ + (PARAMS_ML_DSA_87_S1_SIZE / sizeof(sword32) / 8 * \ + (PARAMS_ML_DSA_87_GAMMA1_BITS + 1)) +/* Encoding size of public key in bytes for ML-DSA-87. */ +#define PARAMS_ML_DSA_87_PK_SIZE \ + (DILITHIUM_PUB_SEED_SZ + PARAMS_ML_DSA_87_K * DILITHIUM_N * DILITHIUM_U / 8) +/* Encoding size of signature in bytes for ML-DSA-87. */ +#define PARAMS_ML_DSA_87_SIG_SIZE \ + ((PARAMS_ML_DSA_87_LAMBDA / 4) + \ + PARAMS_ML_DSA_87_L * DILITHIUM_N/8 * (PARAMS_ML_DSA_87_GAMMA1_BITS + 1) + \ + PARAMS_ML_DSA_87_OMEGA + PARAMS_ML_DSA_87_K) + +#endif /* WOLFSSL_NO_ML_DSA_87 */ + + +#ifndef WOLFSSL_NO_ML_DSA_87 + +#define DILITHIUM_MAX_W1_ENC_SZ PARAMS_ML_DSA_87_W1_ENC_SZ +/* Maximum collision strength of c-tilde in bytes. */ +#define DILITHIUM_MAX_LAMBDA PARAMS_ML_DSA_87_LAMBDA + +/* Maximum count of elements of a vector with dimension K. */ +#define DILITHIUM_MAX_K_VECTOR_COUNT \ + (PARAMS_ML_DSA_87_K * DILITHIUM_N) +/* Maximum count of elements of a vector with dimension L. */ +#define DILITHIUM_MAX_L_VECTOR_COUNT \ + (PARAMS_ML_DSA_87_L * DILITHIUM_N) +/* Maximum count of elements of a matrix with dimension KxL. */ +#define DILITHIUM_MAX_MATRIX_COUNT \ + (PARAMS_ML_DSA_87_K * PARAMS_ML_DSA_87_L * DILITHIUM_N) + +#elif !defined(WOLFSSL_NO_ML_DSA_65) + +/* Maximum w1 encoding size in bytes. */ +#define DILITHIUM_MAX_W1_ENC_SZ PARAMS_ML_DSA_65_W1_ENC_SZ +/* Maximum collision strength of c-tilde in bytes. */ +#define DILITHIUM_MAX_LAMBDA PARAMS_ML_DSA_65_LAMBDA + +/* Maximum count of elements of a vector with dimension K. */ +#define DILITHIUM_MAX_K_VECTOR_COUNT \ + (PARAMS_ML_DSA_65_K * DILITHIUM_N) +/* Maximum count of elements of a vector with dimension L. */ +#define DILITHIUM_MAX_L_VECTOR_COUNT \ + (PARAMS_ML_DSA_65_L * DILITHIUM_N) +/* Maximum count of elements of a matrix with dimension KxL. */ +#define DILITHIUM_MAX_MATRIX_COUNT \ + (PARAMS_ML_DSA_65_K * PARAMS_ML_DSA_65_L * DILITHIUM_N) + +#else + +/* Maximum w1 encoding size in bytes. */ +#define DILITHIUM_MAX_W1_ENC_SZ PARAMS_ML_DSA_44_W1_ENC_SZ +/* Maximum collision strength of c-tilde in bytes. */ +#define DILITHIUM_MAX_LAMBDA PARAMS_ML_DSA_44_LAMBDA + +/* Maximum count of elements of a vector with dimension K. */ +#define DILITHIUM_MAX_K_VECTOR_COUNT \ + (PARAMS_ML_DSA_44_K * DILITHIUM_N) +/* Maximum count of elements of a vector with dimension L. */ +#define DILITHIUM_MAX_L_VECTOR_COUNT \ + (PARAMS_ML_DSA_44_L * DILITHIUM_N) +/* Maximum count of elements of a matrix with dimension KxL. */ +#define DILITHIUM_MAX_MATRIX_COUNT \ + (PARAMS_ML_DSA_44_K * PARAMS_ML_DSA_44_L * DILITHIUM_N) + +#endif + +/* Length of K in bytes. */ +#define DILITHIUM_K_SZ 32 +/* Length of TR in bytes. */ +#define DILITHIUM_TR_SZ 64 +/* Length of public key seed in bytes when expanding a. */ +#define DILITHIUM_PUB_SEED_SZ 32 +/* Length of private key seed in bytes when generating a key. */ +#define DILITHIUM_PRIV_SEED_SZ 64 + +/* Length of seed when creating vector c. */ +#define DILITHIUM_SEED_SZ 32 +/* Length of seeds created when making a key. */ +#define DILITHIUM_SEEDS_SZ 128 + +/* Length of MU in bytes. */ +#define DILITHIUM_MU_SZ 64 +/* Length of random in bytes when generating a signature. */ +#define DILITHIUM_RND_SZ 32 +/* Length of private random in bytes when generating a signature. */ +#define DILITHIUM_PRIV_RAND_SEED_SZ 64 + +/* 5 blocks, each block 21 * 8 bytes = 840 bytes. + * Minimum required is 256 * 3 = 768. */ +#define DILITHIUM_GEN_A_NBLOCKS 5 +/* Number of bytes to generate with Shake128 when generating A. */ +#define DILITHIUM_GEN_A_BYTES \ + (DILITHIUM_GEN_A_NBLOCKS * WC_SHA3_128_COUNT * 8) +/* Number of bytes to a block of SHAKE-128 when generating A. */ +#define DILITHIUM_GEN_A_BLOCK_BYTES (WC_SHA3_128_COUNT * 8) + +/* Number of bytes to a block of SHAKE-256 when generating c. */ +#define DILITHIUM_GEN_C_BLOCK_BYTES (WC_SHA3_256_COUNT * 8) + + +#ifndef WOLFSSL_DILITHIUM_SMALL +#if defined(LITTLE_ENDIAN_ORDER) && (WOLFSSL_DILITHIUM_ALIGNMENT == 0) + /* A block SHAKE-128 output plus one for reading 4 bytes at a time. */ + #define DILITHIUM_REJ_NTT_POLY_H_SIZE (DILITHIUM_GEN_A_BYTES + 1) +#else + /* A block SHAKE-128 output. */ + #define DILITHIUM_REJ_NTT_POLY_H_SIZE DILITHIUM_GEN_A_BYTES +#endif /* LITTLE_ENDIAN_ORDER && WOLFSSL_DILITHIUM_ALIGNMENT == 0 */ +#else +#if defined(LITTLE_ENDIAN_ORDER) && (WOLFSSL_DILITHIUM_ALIGNMENT == 0) + /* A block SHAKE-128 output plus one for reading 4 bytes at a time. */ + #define DILITHIUM_REJ_NTT_POLY_H_SIZE (DILITHIUM_GEN_A_BLOCK_BYTES + 1) +#else + /* A block SHAKE-128 output. */ + #define DILITHIUM_REJ_NTT_POLY_H_SIZE DILITHIUM_GEN_A_BLOCK_BYTES +#endif /* LITTLE_ENDIAN_ORDER && WOLFSSL_DILITHIUM_ALIGNMENT == 0 */ +#endif + +#elif defined(HAVE_LIBOQS) + +#define DILITHIUM_LEVEL2_KEY_SIZE OQS_SIG_ml_dsa_44_ipd_length_secret_key +#define DILITHIUM_LEVEL2_SIG_SIZE OQS_SIG_ml_dsa_44_ipd_length_signature +#define DILITHIUM_LEVEL2_PUB_KEY_SIZE OQS_SIG_ml_dsa_44_ipd_length_public_key +#define DILITHIUM_LEVEL2_PRV_KEY_SIZE \ + (DILITHIUM_LEVEL2_PUB_KEY_SIZE+DILITHIUM_LEVEL2_KEY_SIZE) +/* Buffer sizes large enough to store exported DER encoded keys */ +#define DILITHIUM_LEVEL2_PUB_KEY_DER_SIZE 1334 +#define DILITHIUM_LEVEL2_PRV_KEY_DER_SIZE 2588 +#define DILITHIUM_LEVEL2_BOTH_KEY_DER_SIZE 3904 +/* PEM size with the header "-----BEGIN PRIVATE KEY-----" and + * the footer "-----END PRIVATE KEY-----" */ +#define DILITHIUM_LEVEL2_BOTH_KEY_PEM_SIZE 5344 + +#define DILITHIUM_LEVEL3_KEY_SIZE OQS_SIG_ml_dsa_65_ipd_length_secret_key +#define DILITHIUM_LEVEL3_SIG_SIZE OQS_SIG_ml_dsa_65_ipd_length_signature +#define DILITHIUM_LEVEL3_PUB_KEY_SIZE OQS_SIG_ml_dsa_65_ipd_length_public_key +#define DILITHIUM_LEVEL3_PRV_KEY_SIZE \ + (DILITHIUM_LEVEL3_PUB_KEY_SIZE+DILITHIUM_LEVEL3_KEY_SIZE) +/* Buffer sizes large enough to store exported DER encoded keys */ +#define DILITHIUM_LEVEL3_PUB_KEY_DER_SIZE 1974 +#define DILITHIUM_LEVEL3_PRV_KEY_DER_SIZE 4060 +#define DILITHIUM_LEVEL3_BOTH_KEY_DER_SIZE 6016 +/* PEM size with the header "-----BEGIN PRIVATE KEY-----" and + * the footer "-----END PRIVATE KEY-----" */ +#define DILITHIUM_LEVEL3_BOTH_KEY_PEM_SIZE 8204 + +#define DILITHIUM_LEVEL5_KEY_SIZE OQS_SIG_ml_dsa_87_ipd_length_secret_key +#define DILITHIUM_LEVEL5_SIG_SIZE OQS_SIG_ml_dsa_87_ipd_length_signature +#define DILITHIUM_LEVEL5_PUB_KEY_SIZE OQS_SIG_ml_dsa_87_ipd_length_public_key +#define DILITHIUM_LEVEL5_PRV_KEY_SIZE \ + (DILITHIUM_LEVEL5_PUB_KEY_SIZE+DILITHIUM_LEVEL5_KEY_SIZE) +/* Buffer sizes large enough to store exported DER encoded keys */ +#define DILITHIUM_LEVEL5_PUB_KEY_DER_SIZE 2614 +#define DILITHIUM_LEVEL5_PRV_KEY_DER_SIZE 4924 +#define DILITHIUM_LEVEL5_BOTH_KEY_DER_SIZE 7520 +/* PEM size with the header "-----BEGIN ML_DSA_LEVEL5 PRIVATE KEY-----" and + * the footer "-----END ML_DSA_LEVEL5 PRIVATE KEY-----" */ +#define DILITHIUM_LEVEL5_BOTH_KEY_PEM_SIZE 10267 + +#define ML_DSA_LEVEL2_KEY_SIZE OQS_SIG_ml_dsa_44_ipd_length_secret_key +#define ML_DSA_LEVEL2_SIG_SIZE OQS_SIG_ml_dsa_44_ipd_length_signature +#define ML_DSA_LEVEL2_PUB_KEY_SIZE OQS_SIG_ml_dsa_44_ipd_length_public_key +#define ML_DSA_LEVEL2_PRV_KEY_SIZE \ + (ML_DSA_LEVEL2_PUB_KEY_SIZE+ML_DSA_LEVEL2_KEY_SIZE) +/* Buffer sizes large enough to store exported DER encoded keys */ +#define ML_DSA_LEVEL2_PUB_KEY_DER_SIZE DILITHIUM_LEVEL2_PUB_KEY_DER_SIZE +#define ML_DSA_LEVEL2_PRV_KEY_DER_SIZE DILITHIUM_LEVEL2_PRV_KEY_DER_SIZE +#define ML_DSA_LEVEL2_BOTH_KEY_DER_SIZE DILITHIUM_LEVEL2_BOTH_KEY_DER_SIZE +/* PEM size with the header "-----BEGIN PRIVATE KEY-----" and + * the footer "-----END PRIVATE KEY-----" */ +#define ML_DSA_LEVEL2_BOTH_KEY_PEM_SIZE DILITHIUM_LEVEL2_BOTH_KEY_PEM_SIZE + +#define ML_DSA_LEVEL3_KEY_SIZE OQS_SIG_ml_dsa_65_ipd_length_secret_key +#define ML_DSA_LEVEL3_SIG_SIZE OQS_SIG_ml_dsa_65_ipd_length_signature +#define ML_DSA_LEVEL3_PUB_KEY_SIZE OQS_SIG_ml_dsa_65_ipd_length_public_key +#define ML_DSA_LEVEL3_PRV_KEY_SIZE \ + (ML_DSA_LEVEL3_PUB_KEY_SIZE+ML_DSA_LEVEL3_KEY_SIZE) +/* Buffer sizes large enough to store exported DER encoded keys */ +#define ML_DSA_LEVEL3_PUB_KEY_DER_SIZE DILITHIUM_LEVEL3_PUB_KEY_DER_SIZE +#define ML_DSA_LEVEL3_PRV_KEY_DER_SIZE DILITHIUM_LEVEL3_PRV_KEY_DER_SIZE +#define ML_DSA_LEVEL3_BOTH_KEY_DER_SIZE DILITHIUM_LEVEL3_BOTH_KEY_DER_SIZE +/* PEM size with the header "-----BEGIN PRIVATE KEY-----" and + * the footer "-----END PRIVATE KEY-----" */ +#define ML_DSA_LEVEL3_BOTH_KEY_PEM_SIZE DILITHIUM_LEVEL3_BOTH_KEY_PEM_SIZE + +#define ML_DSA_LEVEL5_KEY_SIZE OQS_SIG_ml_dsa_87_ipd_length_secret_key +#define ML_DSA_LEVEL5_SIG_SIZE OQS_SIG_ml_dsa_87_ipd_length_signature +#define ML_DSA_LEVEL5_PUB_KEY_SIZE OQS_SIG_ml_dsa_87_ipd_length_public_key +#define ML_DSA_LEVEL5_PRV_KEY_SIZE \ + (ML_DSA_LEVEL5_PUB_KEY_SIZE+ML_DSA_LEVEL5_KEY_SIZE) +/* Buffer sizes large enough to store exported DER encoded keys */ +#define ML_DSA_LEVEL5_PUB_KEY_DER_SIZE DILITHIUM_LEVEL5_PUB_KEY_DER_SIZE +#define ML_DSA_LEVEL5_PRV_KEY_DER_SIZE DILITHIUM_LEVEL5_PRV_KEY_DER_SIZE +#define ML_DSA_LEVEL5_BOTH_KEY_DER_SIZE DILITHIUM_LEVEL5_BOTH_KEY_DER_SIZE +/* PEM size with the header "-----BEGIN ML_DSA_LEVEL5 PRIVATE KEY-----" and + * the footer "-----END ML_DSA_LEVEL5 PRIVATE KEY-----" */ +#define ML_DSA_LEVEL5_BOTH_KEY_PEM_SIZE DILITHIUM_LEVEL5_BOTH_KEY_PEM_SIZE + +#endif + +#define DILITHIUM_MAX_KEY_SIZE DILITHIUM_LEVEL5_KEY_SIZE +#define DILITHIUM_MAX_SIG_SIZE DILITHIUM_LEVEL5_SIG_SIZE +#define DILITHIUM_MAX_PUB_KEY_SIZE DILITHIUM_LEVEL5_PUB_KEY_SIZE +#define DILITHIUM_MAX_PRV_KEY_SIZE DILITHIUM_LEVEL5_PRV_KEY_SIZE +/* Buffer sizes large enough to store exported DER encoded keys */ +#define DILITHIUM_MAX_PUB_KEY_DER_SIZE DILITHIUM_LEVEL5_PUB_KEY_DER_SIZE +#define DILITHIUM_MAX_PRV_KEY_DER_SIZE DILITHIUM_LEVEL5_PRV_KEY_DER_SIZE +#define DILITHIUM_MAX_BOTH_KEY_DER_SIZE DILITHIUM_LEVEL5_BOTH_KEY_DER_SIZE +/* PEM size with the header "-----BEGIN ML_DSA_LEVEL5 PRIVATE KEY-----" and + * the footer "-----END ML_DSA_LEVEL5 PRIVATE KEY-----" */ +#define DILITHIUM_MAX_BOTH_KEY_PEM_SIZE DILITHIUM_LEVEL5_BOTH_KEY_PEM_SIZE + + +#ifdef WOLF_PRIVATE_KEY_ID +#define DILITHIUM_MAX_ID_LEN 32 +#define DILITHIUM_MAX_LABEL_LEN 32 +#endif + +/* Structs */ + +#ifdef WOLFSSL_WC_DILITHIUM +typedef struct wc_dilithium_params { + byte level; + byte k; + byte l; + byte eta; + byte eta_bits; + byte tau; + byte beta; + byte omega; + word16 lambda; + byte gamma1_bits; + sword32 gamma2; + word32 w1EncSz; + word16 aSz; + word16 s1Sz; + word16 s1EncSz; + word16 s2Sz; + word16 s2EncSz; + word16 zEncSz; + word16 pkSz; + word16 sigSz; +} wc_dilithium_params; +#endif + +struct dilithium_key { + byte pubKeySet; + byte prvKeySet; + byte level; /* 2,3 or 5 */ + + void* heap; /* heap hint */ + +#ifdef WOLF_CRYPTO_CB + void* devCtx; + int devId; +#endif +#ifdef WOLF_PRIVATE_KEY_ID + byte id[DILITHIUM_MAX_ID_LEN]; + int idLen; + char label[DILITHIUM_MAX_LABEL_LEN]; + int labelLen; +#endif + +#ifndef WOLFSSL_DILITHIUM_ASSIGN_KEY + byte p[DILITHIUM_MAX_PUB_KEY_SIZE]; + byte k[DILITHIUM_MAX_KEY_SIZE]; +#else + const byte* p; + const byte* k; +#endif + +#ifdef WOLFSSL_WC_DILITHIUM + const wc_dilithium_params* params; + wc_Shake shake; +#ifndef WC_DILITHIUM_FIXED_ARRAY +#ifdef WC_DILITHIUM_CACHE_MATRIX_A + sword32* a; + byte aSet; +#endif +#ifdef WC_DILITHIUM_CACHE_PRIV_VECTORS + sword32* s1; + sword32* s2; + sword32* t0; + byte privVecsSet; +#endif +#ifdef WC_DILITHIUM_CACHE_PUB_VECTORS + sword32* t1; + byte pubVecSet; +#endif +#else +#ifdef WC_DILITHIUM_CACHE_MATRIX_A + sword32 a[DILITHIUM_MAX_MATRIX_COUNT]; + byte aSet; +#endif +#ifdef WC_DILITHIUM_CACHE_PRIV_VECTORS + sword32 s1[DILITHIUM_MAX_L_VECTOR_COUNT]; + sword32 s2[DILITHIUM_MAX_K_VECTOR_COUNT]; + sword32 t0[DILITHIUM_MAX_K_VECTOR_COUNT]; + byte privVecsSet; +#endif +#ifdef WC_DILITHIUM_CACHE_PUB_VECTORS + sword32 t1[DILITHIUM_MAX_K_VECTOR_COUNT]; + byte pubVecSet; +#endif +#endif +#if defined(WOLFSSL_DILITHIUM_VERIFY_NO_MALLOC) && \ + defined(WOLFSSL_DILITHIUM_VERIFY_SMALL_MEM) + sword32 z[DILITHIUM_MAX_L_VECTOR_COUNT]; + sword32 c[DILITHIUM_N]; + sword32 w[DILITHIUM_N]; + sword32 t1[DILITHIUM_N]; + byte w1e[DILITHIUM_MAX_W1_ENC_SZ]; +#ifdef WOLFSSL_DILITHIUM_SMALL_MEM_POLY64 + sword64 t64[DILITHIUM_N]; +#endif + byte h[DILITHIUM_REJ_NTT_POLY_H_SIZE]; + byte block[DILITHIUM_GEN_C_BLOCK_BYTES]; +#endif /* WOLFSSL_DILITHIUM_VERIFY_NO_MALLOC && + * WOLFSSL_DILITHIUM_VERIFY_SMALL_MEM */ +#endif /* WOLFSSL_WC_DILITHIUM */ +}; + +#ifndef WC_DILITHIUMKEY_TYPE_DEFINED + typedef struct dilithium_key dilithium_key; + #define WC_DILITHIUMKEY_TYPE_DEFINED +#endif + +/* Functions */ + +#ifndef WOLFSSL_DILITHIUM_VERIFY_ONLY +WOLFSSL_API +int wc_dilithium_make_key(dilithium_key* key, WC_RNG* rng); +WOLFSSL_API +int wc_dilithium_make_key_from_seed(dilithium_key* key, const byte* seed); + +WOLFSSL_API +int wc_dilithium_sign_msg(const byte* msg, word32 msgLen, byte* sig, + word32* sigLen, dilithium_key* key, WC_RNG* rng); +WOLFSSL_API +int wc_dilithium_sign_ctx_msg(const byte* ctx, byte ctxLen, const byte* msg, + word32 msgLen, byte* sig, word32* sigLen, dilithium_key* key, WC_RNG* rng); +WOLFSSL_API +int wc_dilithium_sign_ctx_hash(const byte* ctx, byte ctxLen, int hashAlg, + const byte* hash, word32 hashLen, byte* sig, word32* sigLen, + dilithium_key* key, WC_RNG* rng); +WOLFSSL_API +int wc_dilithium_sign_msg_with_seed(const byte* msg, word32 msgLen, byte* sig, + word32 *sigLen, dilithium_key* key, const byte* seed); +WOLFSSL_API +int wc_dilithium_sign_ctx_msg_with_seed(const byte* ctx, byte ctxLen, + const byte* msg, word32 msgLen, byte* sig, word32 *sigLen, + dilithium_key* key, const byte* seed); +WOLFSSL_API +int wc_dilithium_sign_ctx_hash_with_seed(const byte* ctx, byte ctxLen, + int hashAlg, const byte* hash, word32 hashLen, byte* sig, word32 *sigLen, + dilithium_key* key, const byte* seed); +#endif +WOLFSSL_API +int wc_dilithium_verify_msg(const byte* sig, word32 sigLen, const byte* msg, + word32 msgLen, int* res, dilithium_key* key); +WOLFSSL_API +int wc_dilithium_verify_ctx_msg(const byte* sig, word32 sigLen, const byte* ctx, + word32 ctxLen, const byte* msg, word32 msgLen, int* res, + dilithium_key* key); +WOLFSSL_API +int wc_dilithium_verify_ctx_hash(const byte* sig, word32 sigLen, + const byte* ctx, word32 ctxLen, int hashAlg, const byte* hash, + word32 hashLen, int* res, dilithium_key* key); + +WOLFSSL_API +int wc_dilithium_init(dilithium_key* key); + +WOLFSSL_API +int wc_dilithium_init_ex(dilithium_key* key, void* heap, int devId); + +#ifdef WOLF_PRIVATE_KEY_ID +WOLFSSL_API +int wc_dilithium_init_id(dilithium_key* key, const unsigned char* id, int len, + void* heap, int devId); +WOLFSSL_API +int wc_dilithium_init_label(dilithium_key* key, const char* label, void* heap, + int devId); +#endif + +WOLFSSL_API +int wc_dilithium_set_level(dilithium_key* key, byte level); +WOLFSSL_API +int wc_dilithium_get_level(dilithium_key* key, byte* level); +WOLFSSL_API +void wc_dilithium_free(dilithium_key* key); + +#ifdef WOLFSSL_DILITHIUM_PRIVATE_KEY +WOLFSSL_API +int wc_dilithium_size(dilithium_key* key); +#endif +#if defined(WOLFSSL_DILITHIUM_PRIVATE_KEY) && \ + defined(WOLFSSL_DILITHIUM_PUBLIC_KEY) +WOLFSSL_API +int wc_dilithium_priv_size(dilithium_key* key); +#endif +#ifdef WOLFSSL_DILITHIUM_PUBLIC_KEY +WOLFSSL_API +int wc_dilithium_pub_size(dilithium_key* key); +#endif +#if !defined(WOLFSSL_DILITHIUM_NO_SIGN) || !defined(WOLFSSL_DILITHIUM_NO_VERIFY) +WOLFSSL_API +int wc_dilithium_sig_size(dilithium_key* key); +#endif + +#ifdef WOLFSSL_DILITHIUM_CHECK_KEY +WOLFSSL_API +int wc_dilithium_check_key(dilithium_key* key); +#endif + +#ifdef WOLFSSL_DILITHIUM_PUBLIC_KEY +WOLFSSL_API +int wc_dilithium_import_public(const byte* in, word32 inLen, + dilithium_key* key); +#endif +#ifdef WOLFSSL_DILITHIUM_PRIVATE_KEY +WOLFSSL_API +int wc_dilithium_import_private(const byte* priv, word32 privSz, + dilithium_key* key); +#define wc_dilithium_import_private_only wc_dilithium_import_private +WOLFSSL_API +int wc_dilithium_import_key(const byte* priv, word32 privSz, + const byte* pub, word32 pubSz, dilithium_key* key); +#endif + +#ifdef WOLFSSL_DILITHIUM_PUBLIC_KEY +WOLFSSL_API +int wc_dilithium_export_public(dilithium_key* key, byte* out, word32* outLen); +#endif +#ifdef WOLFSSL_DILITHIUM_PRIVATE_KEY +WOLFSSL_API +int wc_dilithium_export_private(dilithium_key* key, byte* out, word32* outLen); +#define wc_dilithium_export_private_only wc_dilithium_export_private +#endif +#ifdef WOLFSSL_DILITHIUM_PRIVATE_KEY +WOLFSSL_API +int wc_dilithium_export_key(dilithium_key* key, byte* priv, word32 *privSz, + byte* pub, word32 *pubSz); +#endif + +#ifndef WOLFSSL_DILITHIUM_NO_ASN1 +WOLFSSL_LOCAL int dilithium_get_oid_sum(dilithium_key* key, int* keyFormat); +#endif /* WOLFSSL_DILITHIUM_NO_ASN1 */ + +#ifndef WOLFSSL_DILITHIUM_NO_ASN1 +#if defined(WOLFSSL_DILITHIUM_PRIVATE_KEY) +WOLFSSL_API int wc_Dilithium_PrivateKeyDecode(const byte* input, + word32* inOutIdx, dilithium_key* key, word32 inSz); +#endif +#endif /* WOLFSSL_DILITHIUM_NO_ASN1 */ +#ifdef WOLFSSL_DILITHIUM_PUBLIC_KEY +WOLFSSL_API int wc_Dilithium_PublicKeyDecode(const byte* input, + word32* inOutIdx, dilithium_key* key, word32 inSz); +#endif + +#ifndef WOLFSSL_DILITHIUM_NO_ASN1 +#ifdef WC_ENABLE_ASYM_KEY_EXPORT +WOLFSSL_API int wc_Dilithium_PublicKeyToDer(dilithium_key* key, byte* output, + word32 inLen, int withAlg); +#endif +#if defined(WOLFSSL_DILITHIUM_PRIVATE_KEY) +WOLFSSL_API int wc_Dilithium_KeyToDer(dilithium_key* key, byte* output, + word32 inLen); +#endif +#ifdef WOLFSSL_DILITHIUM_PRIVATE_KEY +WOLFSSL_API int wc_Dilithium_PrivateKeyToDer(dilithium_key* key, byte* output, + word32 inLen); +#endif +#endif /* WOLFSSL_DILITHIUM_NO_ASN1 */ + + +#define WC_ML_DSA_DRAFT 10 + +#define WC_ML_DSA_44 2 +#define WC_ML_DSA_65 3 +#define WC_ML_DSA_87 5 +#define WC_ML_DSA_44_DRAFT (2 + WC_ML_DSA_DRAFT) +#define WC_ML_DSA_65_DRAFT (3 + WC_ML_DSA_DRAFT) +#define WC_ML_DSA_87_DRAFT (5 + WC_ML_DSA_DRAFT) + +#define DILITHIUM_ML_DSA_44_KEY_SIZE 2560 +#define DILITHIUM_ML_DSA_44_SIG_SIZE 2420 +#define DILITHIUM_ML_DSA_44_PUB_KEY_SIZE 1312 +#define DILITHIUM_ML_DSA_44_PRV_KEY_SIZE \ + (DILITHIUM_ML_DSA_44_PUB_KEY_SIZE + DILITHIUM_ML_DSA_44_KEY_SIZE) + +#define DILITHIUM_ML_DSA_65_KEY_SIZE 4032 +#define DILITHIUM_ML_DSA_65_SIG_SIZE 3309 +#define DILITHIUM_ML_DSA_65_PUB_KEY_SIZE 1952 +#define DILITHIUM_ML_DSA_65_PRV_KEY_SIZE \ + (DILITHIUM_ML_DSA_65_PUB_KEY_SIZE + DILITHIUM_ML_DSA_65_KEY_SIZE) + +#define DILITHIUM_ML_DSA_87_KEY_SIZE 4896 +#define DILITHIUM_ML_DSA_87_SIG_SIZE 4627 +#define DILITHIUM_ML_DSA_87_PUB_KEY_SIZE 2592 +#define DILITHIUM_ML_DSA_87_PRV_KEY_SIZE \ + (DILITHIUM_ML_DSA_87_PUB_KEY_SIZE + DILITHIUM_ML_DSA_87_KEY_SIZE) + + +#define MlDsaKey dilithium_key + + +#define wc_MlDsaKey_Init(key, heap, devId) \ + wc_dilithium_init_ex(key, heap, devId) +#define wc_MlDsaKey_SetParams(key, id) \ + wc_dilithium_set_level(key, id) +#define wc_MlDsaKey_GetParams(key, id) \ + wc_dilithium_get_level(key, id) +#define wc_MlDsaKey_MakeKey(key, rng) \ + wc_dilithium_make_key(key, rng) +#define wc_MlDsaKey_ExportPrivRaw(key, out, outLen) \ + wc_dilithium_export_private_only(key, out, outLen) +#define wc_MlDsaKey_ImportPrivRaw(key, in, inLen) \ + wc_dilithium_import_private_only(in, inLen, key) +#define wc_MlDsaKey_Sign(key, sig, sigSz, msg, msgSz, rng) \ + wc_dilithium_sign_msg(msg, msgSz, sig, sigSz, key, rng) +#define wc_MlDsaKey_Free(key) \ + wc_dilithium_free(key) +#define wc_MlDsaKey_ExportPubRaw(key, out, outLen) \ + wc_dilithium_export_public(key, out, outLen) +#define wc_MlDsaKey_ImportPubRaw(key, in, inLen) \ + wc_dilithium_import_public(in, inLen, key) +#define wc_MlDsaKey_Verify(key, sig, sigSz, msg, msgSz, res) \ + wc_dilithium_verify_msg(sig, sigSz, msg, msgSz, res, key) + +#define wc_MlDsaKey_PublicKeyToDer(key, output, len, withAlg) \ + wc_Dilithium_PublicKeyToDer(key, output, len, withAlg) + +#define wc_MlDsaKey_PrivateKeyToDer(key, output, len) \ + wc_Dilithium_PrivateKeyToDer(key, output, len) + + +WOLFSSL_API int wc_MlDsaKey_GetPrivLen(MlDsaKey* key, int* len); +WOLFSSL_API int wc_MlDsaKey_GetPubLen(MlDsaKey* key, int* len); +WOLFSSL_API int wc_MlDsaKey_GetSigLen(MlDsaKey* key, int* len); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* HAVE_DILITHIUM */ +#endif /* WOLF_CRYPT_DILITHIUM_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/dsa.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/dsa.h @@ -0,0 +1,121 @@ +/* dsa.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/dsa.h +*/ + +#ifndef WOLF_CRYPT_DSA_H +#define WOLF_CRYPT_DSA_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifndef NO_DSA + +#include <wolfssl/wolfcrypt/wolfmath.h> +#include <wolfssl/wolfcrypt/random.h> + +/* for DSA reverse compatibility */ +#define InitDsaKey wc_InitDsaKey +#define FreeDsaKey wc_FreeDsaKey +#define DsaSign wc_DsaSign +#define DsaVerify wc_DsaVerify +#define DsaPublicKeyDecode wc_DsaPublicKeyDecode +#define DsaPrivateKeyDecode wc_DsaPrivateKeyDecode +#define DsaKeyToDer wc_DsaKeyToDer + +#ifdef __cplusplus + extern "C" { +#endif + + +enum { + DSA_PUBLIC = 0, + DSA_PRIVATE = 1 +}; + +enum { + /* 160 bit q length */ + DSA_160_HALF_SIZE = 20, /* r and s size */ + DSA_160_SIG_SIZE = 40, /* signature size */ + DSA_HALF_SIZE = DSA_160_HALF_SIZE, /* kept for compatibility */ + DSA_SIG_SIZE = DSA_160_SIG_SIZE, /* kept for compatibility */ + /* 256 bit q length */ + DSA_256_HALF_SIZE = 32, /* r and s size */ + DSA_256_SIG_SIZE = 64, /* signature size */ + + DSA_MIN_HALF_SIZE = DSA_160_HALF_SIZE, + DSA_MIN_SIG_SIZE = DSA_160_SIG_SIZE, + + DSA_MAX_HALF_SIZE = DSA_256_HALF_SIZE, + DSA_MAX_SIG_SIZE = DSA_256_SIG_SIZE +}; + +/* DSA */ +typedef struct DsaKey { + mp_int p, q, g, y, x; + int type; /* public or private */ + void* heap; /* memory hint */ +} DsaKey; + +WOLFSSL_API int wc_InitDsaKey(DsaKey* key); +WOLFSSL_API int wc_InitDsaKey_h(DsaKey* key, void* h); +WOLFSSL_API void wc_FreeDsaKey(DsaKey* key); +WOLFSSL_API int wc_DsaSign(const byte* digest, byte* out, + DsaKey* key, WC_RNG* rng); +WOLFSSL_API int wc_DsaSign_ex(const byte* digest, word32 digestSz, byte* out, + DsaKey* key, WC_RNG* rng); +WOLFSSL_API int wc_DsaVerify(const byte* digest, const byte* sig, + DsaKey* key, int* answer); +WOLFSSL_API int wc_DsaVerify_ex(const byte* digest, word32 digestSz, + const byte* sig, DsaKey* key, int* answer); +WOLFSSL_API int wc_DsaPublicKeyDecode(const byte* input, word32* inOutIdx, + DsaKey* key, word32 inSz); +WOLFSSL_API int wc_DsaPrivateKeyDecode(const byte* input, word32* inOutIdx, + DsaKey* key, word32 inSz); +WOLFSSL_API int wc_DsaKeyToDer(DsaKey* key, byte* output, word32 inLen); +WOLFSSL_API int wc_SetDsaPublicKey(byte* output, DsaKey* key, + int outLen, int with_header); +WOLFSSL_API int wc_DsaKeyToPublicDer(DsaKey* key, byte* output, word32 inLen); + +#ifdef WOLFSSL_KEY_GEN +WOLFSSL_API int wc_MakeDsaKey(WC_RNG *rng, DsaKey *dsa); +WOLFSSL_API int wc_MakeDsaParameters(WC_RNG *rng, int modulus_size, DsaKey *dsa); +#endif + +/* raw export functions */ +WOLFSSL_API int wc_DsaImportParamsRaw(DsaKey* dsa, const char* p, + const char* q, const char* g); +WOLFSSL_API int wc_DsaImportParamsRawCheck(DsaKey* dsa, const char* p, + const char* q, const char* g, + int trusted, WC_RNG* rng); +WOLFSSL_API int wc_DsaExportParamsRaw(DsaKey* dsa, byte* p, word32* pSz, + byte* q, word32* qSz, byte* g, + word32* gSz); +WOLFSSL_API int wc_DsaExportKeyRaw(DsaKey* dsa, byte* x, word32* xSz, byte* y, + word32* ySz); +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* NO_DSA */ +#endif /* WOLF_CRYPT_DSA_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/ecc.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/ecc.h @@ -0,0 +1,1065 @@ +/* ecc.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/ecc.h +*/ + + +#ifndef WOLF_CRYPT_ECC_H +#define WOLF_CRYPT_ECC_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef HAVE_ECC + +#if FIPS_VERSION3_GE(2,0,0) + #include <wolfssl/wolfcrypt/fips.h> +#endif /* HAVE_FIPS_VERSION >= 2 */ + +#include <wolfssl/wolfcrypt/wolfmath.h> +#include <wolfssl/wolfcrypt/random.h> + +#ifdef HAVE_X963_KDF + #include <wolfssl/wolfcrypt/hash.h> +#endif + +#ifdef WOLFSSL_ASYNC_CRYPT + #include <wolfssl/wolfcrypt/async.h> + #ifdef WOLFSSL_CERT_GEN + #include <wolfssl/wolfcrypt/asn.h> + #endif +#endif + +#if defined(WOLFSSL_ATECC508A) || defined(WOLFSSL_ATECC608A) + #include <wolfssl/wolfcrypt/port/atmel/atmel.h> +#endif /* WOLFSSL_ATECC508A */ + +#if defined(WOLFSSL_CRYPTOCELL) + #include <wolfssl/wolfcrypt/port/arm/cryptoCell.h> +#endif + +#ifdef WOLFSSL_SILABS_SE_ACCEL + #include <wolfssl/wolfcrypt/port/silabs/silabs_ecc.h> +#endif + +#if defined(WOLFSSL_KCAPI_ECC) + #include <wolfssl/wolfcrypt/port/kcapi/kcapi_ecc.h> +#endif + +#ifdef WOLFSSL_SE050 + #include <wolfssl/wolfcrypt/port/nxp/se050_port.h> +#endif + +#if defined(WOLFSSL_XILINX_CRYPT_VERSAL) + #include <wolfssl/wolfcrypt/port/xilinx/xil-versal-glue.h> +#endif + +#ifdef WOLFSSL_HAVE_SP_ECC + #include <wolfssl/wolfcrypt/sp_int.h> +#endif + + +#ifdef __cplusplus + extern "C" { +#endif + +#if FIPS_VERSION3_GE(6,0,0) + extern const unsigned int wolfCrypt_FIPS_ecc_ro_sanity[2]; + WOLFSSL_LOCAL int wolfCrypt_FIPS_ECC_sanity(void); +#endif + +/* Enable curve B parameter if needed */ +#if defined(HAVE_COMP_KEY) || defined(ECC_CACHE_CURVE) + #ifndef USE_ECC_B_PARAM /* Allow someone to force enable */ + #define USE_ECC_B_PARAM + #endif +#endif + + +/* Use this as the key->idx if a custom ecc_set is used for key->dp */ +#define ECC_CUSTOM_IDX (-1) + + +/* Determine max ECC bits based on enabled curves */ +#if defined(WOLFCRYPT_HAVE_SAKKE) + #define MAX_ECC_BITS_NEEDED 1024 +#elif defined(HAVE_ECC521) || defined(HAVE_ALL_CURVES) + #define MAX_ECC_BITS_NEEDED 521 +#elif defined(HAVE_ECC512) + #define MAX_ECC_BITS_NEEDED 512 +#elif defined(HAVE_ECC384) + #define MAX_ECC_BITS_NEEDED 384 +#elif defined(HAVE_ECC320) + #define MAX_ECC_BITS_NEEDED 320 +#elif !defined(NO_ECC256) || defined(WOLFSSL_SM2) + #define MAX_ECC_BITS_NEEDED 256 +#elif defined(HAVE_ECC239) + #define MAX_ECC_BITS_NEEDED 239 +#elif defined(HAVE_ECC224) + #define MAX_ECC_BITS_NEEDED 224 +#elif defined(HAVE_ECC192) + #define MAX_ECC_BITS_NEEDED 192 +#elif defined(HAVE_ECC160) + #define MAX_ECC_BITS_NEEDED 160 +#elif defined(HAVE_ECC128) + #define MAX_ECC_BITS_NEEDED 128 +#elif defined(HAVE_ECC112) + #define MAX_ECC_BITS_NEEDED 112 +#endif + +#ifndef MAX_ECC_BITS + #define MAX_ECC_BITS MAX_ECC_BITS_NEEDED +#else + #if MAX_ECC_BITS_NEEDED > MAX_ECC_BITS + #error configured MAX_ECC_BITS is less than required by enabled curves. + #endif +#endif + +#if FIPS_VERSION3_GE(6,0,0) + #define WC_ECC_FIPS_SIG_MIN 224 + #define WC_ECC_FIPS_GEN_MIN (WC_ECC_FIPS_SIG_MIN/8) +#endif + +#ifdef WOLFSSL_SM2 + #define WOLFSSL_SM2_KEY_BITS 256 +#endif + +/* calculate max ECC bytes */ +#if ((MAX_ECC_BITS * 2) % 8) == 0 + #define MAX_ECC_BYTES (MAX_ECC_BITS / 8) +#else + /* add byte if not aligned */ + #define MAX_ECC_BYTES ((MAX_ECC_BITS / 8) + 1) +#endif + +#ifndef ECC_MAX_PAD_SZ + /* ECC maximum padding size (when MSB is set extra byte required for R and S) */ + #define ECC_MAX_PAD_SZ 2 +#endif + +enum { + ECC_PUBLICKEY = 1, + ECC_PRIVATEKEY = 2, + ECC_PRIVATEKEY_ONLY = 3, + ECC_MAXNAME = 16, /* MAX CURVE NAME LENGTH */ + SIG_HEADER_SZ = 7, /* ECC signature header size (30 81 87 02 42 [R] 02 42 [S]) */ + ECC_BUFSIZE = 257, /* for exported keys temp buffer */ + ECC_MINSIZE = ECC_MIN_KEY_SZ/8, /* MIN Private Key size */ +#ifdef WOLFCRYPT_HAVE_SAKKE + ECC_MAXSIZE = 128, /* MAX Private Key size */ + ECC_MAXSIZE_GEN = 128, /* MAX Buffer size required when generating ECC keys*/ +#else + ECC_MAXSIZE = 66, /* MAX Private Key size */ + ECC_MAXSIZE_GEN = 74, /* MAX Buffer size required when generating ECC keys*/ +#endif + ECC_MAX_OID_LEN = 16, + ECC_MAX_SIG_SIZE= ((MAX_ECC_BYTES * 2) + ECC_MAX_PAD_SZ + SIG_HEADER_SZ), + + /* max crypto hardware size */ +#if defined(WOLFSSL_ATECC508A) || defined(WOLFSSL_ATECC608A) + ECC_MAX_CRYPTO_HW_SIZE = ATECC_KEY_SIZE, /* from port/atmel/atmel.h */ + ECC_MAX_CRYPTO_HW_PUBKEY_SIZE = (ATECC_KEY_SIZE*2), +#elif defined(PLUTON_CRYPTO_ECC) + ECC_MAX_CRYPTO_HW_SIZE = 32, +#elif defined(WOLFSSL_SILABS_SE_ACCEL) + ECC_MAX_CRYPTO_HW_SIZE = 32, +#elif defined(WOLFSSL_CRYPTOCELL) + #ifndef CRYPTOCELL_KEY_SIZE + CRYPTOCELL_KEY_SIZE = ECC_MAXSIZE, + #endif + ECC_MAX_CRYPTO_HW_SIZE = CRYPTOCELL_KEY_SIZE, +#elif defined(WOLFSSL_SE050) + ECC_MAX_CRYPTO_HW_SIZE = 66, +#elif defined(WOLFSSL_XILINX_CRYPT_VERSAL) + ECC_MAX_CRYPTO_HW_SIZE = MAX_ECC_BYTES, +#endif + + + /* point compression type */ + ECC_POINT_COMP_EVEN = 0x02, + ECC_POINT_COMP_ODD = 0x03, + ECC_POINT_UNCOMP = 0x04, + + /* Shamir's dual add constants */ + SHAMIR_PRECOMP_SZ = 16, + +#ifdef WOLF_PRIVATE_KEY_ID + ECC_MAX_ID_LEN = 32, + ECC_MAX_LABEL_LEN = 32, +#endif + + WOLF_ENUM_DUMMY_LAST_ELEMENT(ECC) +}; + +#endif /* HAVE_ECC */ + +#if defined(HAVE_ECC) || defined(HAVE_CURVE25519) || \ + defined(HAVE_CURVE448) || defined(WOLFCRYPT_HAVE_SAKKE) +/* Curve Types */ +enum ecc_curve_ids { + ECC_CURVE_INVALID = -1, + ECC_CURVE_DEF = 0, /* NIST or SECP */ + + /* NIST Prime Curves */ + ECC_SECP192R1, /* 1 */ + ECC_PRIME192V2, + ECC_PRIME192V3, + ECC_PRIME239V1, + ECC_PRIME239V2, + ECC_PRIME239V3, + ECC_SECP256R1, /* 7 */ + + /* SECP Curves */ + ECC_SECP112R1, + ECC_SECP112R2, + ECC_SECP128R1, + ECC_SECP128R2, + ECC_SECP160R1, + ECC_SECP160R2, + ECC_SECP224R1, /* 14 */ + ECC_SECP384R1, /* 15 */ + ECC_SECP521R1, /* 16 */ + + /* Koblitz */ + ECC_SECP160K1, + ECC_SECP192K1, + ECC_SECP224K1, + ECC_SECP256K1, + + /* Brainpool Curves */ + ECC_BRAINPOOLP160R1, + ECC_BRAINPOOLP192R1, + ECC_BRAINPOOLP224R1, + ECC_BRAINPOOLP256R1, + ECC_BRAINPOOLP320R1, + ECC_BRAINPOOLP384R1, + ECC_BRAINPOOLP512R1, + + /* SM2 */ + ECC_SM2P256V1, + + /* Twisted Edwards Curves */ +#ifdef HAVE_CURVE25519 + ECC_X25519, +#endif +#ifdef HAVE_CURVE448 + ECC_X448, +#endif +#ifdef WOLFCRYPT_HAVE_SAKKE + ECC_SAKKE_1, +#endif + +#ifdef WOLFSSL_CUSTOM_CURVES + ECC_CURVE_CUSTOM, +#endif + ECC_CURVE_MAX +}; +typedef enum ecc_curve_ids ecc_curve_id; +#endif + +#ifdef HAVE_ECC + +#ifdef HAVE_OID_ENCODING +typedef word16 ecc_oid_t; +#else +typedef byte ecc_oid_t; + /* OID encoded with ASN scheme: + first element = (oid[0] * 40) + oid[1] + if any element > 127 then MSB 0x80 indicates additional byte */ +#endif + + +#if !defined(WOLFSSL_ECC_CURVE_STATIC) && defined(USE_WINDOWS_API) && \ + !defined(__WATCOMC__) + /* MSC does something different with the pointers to the arrays than GCC, + * and it causes the FIPS checksum to fail. In the case of windows builds, + * store everything as arrays instead of pointers to strings. */ + + #define WOLFSSL_ECC_CURVE_STATIC +#endif + +/* ECC set type defined a GF(p) curve */ +#ifndef WOLFSSL_ECC_CURVE_STATIC +struct ecc_set_type { + int size; /* The size of the curve in octets */ + int id; /* id of this curve */ + const char* name; /* name of this curve */ + const char* prime; /* prime that defines the field, curve is in (hex) */ + const char* Af; /* fields A param (hex) */ + const char* Bf; /* fields B param (hex) */ + const char* order; /* order of the curve (hex) */ + const char* Gx; /* x coordinate of the base point on curve (hex) */ + const char* Gy; /* y coordinate of the base point on curve (hex) */ + const ecc_oid_t* oid; + word32 oidSz; + word32 oidSum; /* sum of encoded OID bytes */ + int cofactor; +}; +#else +#define MAX_ECC_NAME 16 +#define MAX_ECC_STRING ((MAX_ECC_BYTES * 2) + 2) + /* The values are stored as text strings. */ + +struct ecc_set_type { + int size; /* The size of the curve in octets */ + int id; /* id of this curve */ + char name[MAX_ECC_NAME]; /* name of this curve */ + char prime[MAX_ECC_STRING]; /* prime that defines the field, curve is in (hex) */ + char Af[MAX_ECC_STRING]; /* fields A param (hex) */ + char Bf[MAX_ECC_STRING]; /* fields B param (hex) */ + char order[MAX_ECC_STRING]; /* order of the curve (hex) */ + char Gx[MAX_ECC_STRING]; /* x coordinate of the base point on curve (hex) */ + char Gy[MAX_ECC_STRING]; /* y coordinate of the base point on curve (hex) */ + ecc_oid_t oid[10]; + word32 oidSz; + word32 oidSum; /* sum of encoded OID bytes */ + int cofactor; +}; +#endif + + +#ifdef ALT_ECC_SIZE + +/* Note on ALT_ECC_SIZE: + * The fast math code uses an array of a fixed size to store the big integers. + * By default, the array is big enough for RSA keys. There is a size, + * FP_MAX_BITS which can be used to make the array smaller when one wants ECC + * but not RSA. Some people want fast math sized for both RSA and ECC, where + * ECC won't use as much as RSA. The flag ALT_ECC_SIZE switches in an alternate + * ecc_point structure that uses an alternate fp_int that has a shorter array + * of fp_digits. + * + * Now, without ALT_ECC_SIZE, the ecc_point has three single item arrays of + * mp_ints for the components of the point. With ALT_ECC_SIZE, the components + * of the point are pointers that are set to each of a three item array of + * alt_fp_ints. While an mp_int will have 4096 bits of digit inside the + * structure, the alt_fp_int will only have 512 bits for ECC 256-bit and + * 1056-bits for ECC 521-bit. A size value was added in the ALT case, as well, + * and is set by mp_init() and alt_fp_init(). The functions fp_zero() and + * fp_copy() use the size parameter. An int needs to be initialized before + * using it instead of just fp_zeroing it, the init will call zero. The + * FP_MAX_BITS_ECC defaults to calculating based on MAX_ECC_BITS, but + * can be set to change the number of bits used in the alternate FP_INT. + * + * The ALT_ECC_SIZE option only applies to stack based fast math USE_FAST_MATH. + */ + +#if defined(USE_INTEGER_HEAP_MATH) + #error Cannot use integer math with ALT_ECC_SIZE +#endif +#ifdef WOLFSSL_NO_MALLOC + #error ALT_ECC_SIZE cannot be used with no malloc (WOLFSSL_NO_MALLOC) +#endif + +#ifdef USE_FAST_MATH + +/* determine max bits required for ECC math */ +#ifndef FP_MAX_BITS_ECC + /* max bits rounded up by 8 then doubled */ + /* (ROUND8(MAX_ECC_BITS) * 2) */ + #define FP_MAX_BITS_ECC (2 * \ + ((MAX_ECC_BITS + DIGIT_BIT - 1) / DIGIT_BIT) * DIGIT_BIT) + + /* Note: For ECC verify only FP_MAX_BITS_ECC can be reduced to: + ROUND8(MAX_ECC_BITS) + ROUND8(DIGIT_BIT) */ +#endif + +/* verify alignment */ +#if CHAR_BIT == 0 + #error CHAR_BIT must be nonzero +#endif +#if FP_MAX_BITS_ECC % CHAR_BIT + #error FP_MAX_BITS_ECC must be a multiple of CHAR_BIT +#endif + +/* determine buffer size */ +/* Add one to accommodate extra digit used by sp_mul(), sp_mulmod(), sp_sqr(), and sp_sqrmod(). */ +#define FP_SIZE_ECC ((FP_MAX_BITS_ECC/DIGIT_BIT) + 1) + + +/* This needs to match the size of the fp_int struct, except the + * fp_digit array will be shorter. */ +typedef struct alt_fp_int { + int used, sign, size; + mp_digit dp[FP_SIZE_ECC]; +} alt_fp_int; + +#else + +#ifdef FP_MAX_BITS_ECC + #define SP_INT_BITS_ECC (FP_MAX_BITS_ECC / 2) +#elif SP_INT_BITS < MAX_ECC_BITS + #define SP_INT_BITS_ECC SP_INT_BITS +#else + #define SP_INT_BITS_ECC MAX_ECC_BITS +#endif + +#define SP_INT_DIGITS_ECC \ + (((SP_INT_BITS_ECC + SP_WORD_SIZE - 1) / SP_WORD_SIZE) * 2 + 1) + +#define FP_SIZE_ECC SP_INT_DIGITS_ECC + +typedef struct alt_fp_int { + /** Number of words that contain data. */ + unsigned int used; + /** Maximum number of words in data. */ + unsigned int size; +#ifdef WOLFSSL_SP_INT_NEGATIVE + /** Indicates whether number is 0/positive or negative. */ + unsigned int sign; +#endif +#ifdef HAVE_WOLF_BIGINT + /** Unsigned binary (big endian) representation of number. */ + struct WC_BIGINT raw; +#endif + /** Data of number. */ + sp_int_digit dp[SP_INT_DIGITS_ECC]; +} alt_fp_int; + +#endif +#endif /* ALT_ECC_SIZE */ + +#ifndef WC_ECCKEY_TYPE_DEFINED + typedef struct ecc_key ecc_key; + #define WC_ECCKEY_TYPE_DEFINED +#endif + +#ifndef WC_ECCPOINT_TYPE_DEFINED + typedef struct ecc_point ecc_point; + #define WC_ECCPOINT_TYPE_DEFINED +#endif + +#ifndef WC_ECCSET_TYPE_DEFINED + typedef struct ecc_set_type ecc_set_type; + #define WC_ECCSET_TYPE_DEFINED +#endif + +/* A point on an ECC curve, stored in Jacobian format such that (x,y,z) => + (x/z^2, y/z^3, 1) when interpreted as affine */ +struct ecc_point { +#ifndef ALT_ECC_SIZE + mp_int x[1]; /* The x coordinate */ + mp_int y[1]; /* The y coordinate */ + mp_int z[1]; /* The z coordinate */ +#else + mp_int* x; /* The x coordinate */ + mp_int* y; /* The y coordinate */ + mp_int* z; /* The z coordinate */ + alt_fp_int xyz[3]; +#endif +#if defined(WOLFSSL_SMALL_STACK_CACHE) && !defined(WOLFSSL_ECC_NO_SMALL_STACK) + ecc_key* key; +#endif + WC_BITFIELD isAllocated:1; +}; + +/* ECC Flags */ +enum { + WC_ECC_FLAG_NONE = 0x00, + WC_ECC_FLAG_COFACTOR = 0x01, + WC_ECC_FLAG_DEC_SIGN = 0x02 +}; + +/* ECC non-blocking */ +#ifdef WC_ECC_NONBLOCK + typedef struct ecc_nb_ctx { + #if defined(WOLFSSL_HAVE_SP_ECC) && defined(WOLFSSL_SP_NONBLOCK) + sp_ecc_ctx_t sp_ctx; + #else + /* build configuration not supported */ + #error ECC non-blocking only supports SP (--enable-sp=nonblock) + #endif + } ecc_nb_ctx_t; +#endif /* WC_ECC_NONBLOCK */ + + +/* An ECC Key */ +struct ecc_key { + int type; /* Public or Private */ + int idx; /* Index into the ecc_sets[] for the parameters of + this curve if -1, this key is using user supplied + curve in dp */ + int state; + word32 flags; + const ecc_set_type* dp; /* domain parameters, either points to NIST + curves (idx >= 0) or user supplied */ +#ifdef WOLFSSL_CUSTOM_CURVES + int deallocSet; +#endif + void* heap; /* heap hint */ + ecc_point pubkey; /* public key */ +#ifndef ALT_ECC_SIZE + mp_int k[1]; /* private key */ +#else + mp_int* k; + alt_fp_int ka[1]; +#endif +#ifdef WOLFSSL_ECC_BLIND_K +#ifndef ALT_ECC_SIZE + mp_int kb[1]; + mp_int ku[1]; +#else + mp_int* kb; + mp_int* ku; + alt_fp_int kba[1]; + alt_fp_int kua[1]; +#endif +#endif + +#ifdef WOLFSSL_CAAM + word32 blackKey; /* address of key encrypted and in secure memory */ + word32 securePubKey; /* address of public key in secure memory */ + int partNum; /* partition number*/ +#endif +#ifdef WOLFSSL_SE050 + word32 keyId; + byte keyIdSet; +#endif +#if defined(WOLFSSL_ATECC508A) || defined(WOLFSSL_ATECC608A) + int slot; /* Key Slot Number (-1 unknown) */ + byte pubkey_raw[ECC_MAX_CRYPTO_HW_PUBKEY_SIZE]; +#endif +#if defined(PLUTON_CRYPTO_ECC) || defined(WOLF_CRYPTO_CB) + void* devCtx; + int devId; +#endif +#ifdef WOLFSSL_SILABS_SE_ACCEL + sl_se_command_context_t cmd_ctx; + sl_se_key_descriptor_t key; + /* Used for SiLabs "plaintext" with public X, public Y, and + * private D concatenated. These are respectively at offset `0`, + * offset `keysize`, and offset `2 * keysize`. + */ + byte key_raw[3 * ECC_MAX_CRYPTO_HW_SIZE]; +#endif +#ifdef WOLFSSL_MAXQ10XX_CRYPTO + maxq_ecc_t maxq_ctx; +#endif +#ifdef WOLFSSL_KCAPI_ECC + struct kcapi_handle* handle; + byte pubkey_raw[MAX_ECC_BYTES * 2]; +#endif +#if defined(WOLFSSL_XILINX_CRYPT_VERSAL) + wc_Xsecure xSec; + byte keyRaw[3 * ECC_MAX_CRYPTO_HW_SIZE] ALIGN32; + byte* privKey; +#endif +#ifdef WOLFSSL_ASYNC_CRYPT + mp_int* r; /* sign/verify temps */ + mp_int* s; + WC_ASYNC_DEV asyncDev; + #ifdef HAVE_CAVIUM_V + mp_int* e; /* Sign, Verify and Shared Secret */ + mp_int* signK; + #endif + #ifdef WOLFSSL_CERT_GEN + CertSignCtx certSignCtx; /* context info for cert sign (MakeSignature) */ + #endif +#endif /* WOLFSSL_ASYNC_CRYPT */ +#ifdef WOLF_PRIVATE_KEY_ID + byte id[ECC_MAX_ID_LEN]; + int idLen; + char label[ECC_MAX_LABEL_LEN]; + int labelLen; +#endif +#if defined(WOLFSSL_CRYPTOCELL) + ecc_context_t ctx; +#endif + +#if defined(WOLFSSL_ECDSA_SET_K) || defined(WOLFSSL_ECDSA_SET_K_ONE_LOOP) || \ + defined(WOLFSSL_ECDSA_DETERMINISTIC_K) || \ + defined(WOLFSSL_ECDSA_DETERMINISTIC_K_VARIANT) +#ifndef WOLFSSL_NO_MALLOC + mp_int* sign_k; +#else + mp_int sign_k[1]; + WC_BITFIELD sign_k_set:1; +#endif +#endif +#if defined(WOLFSSL_ECDSA_DETERMINISTIC_K) || \ + defined(WOLFSSL_ECDSA_DETERMINISTIC_K_VARIANT) + WC_BITFIELD deterministic:1; + enum wc_HashType hashType; +#endif + +#if defined(WOLFSSL_SMALL_STACK_CACHE) && !defined(WOLFSSL_ECC_NO_SMALL_STACK) + mp_int* t1; + mp_int* t2; +#ifdef ALT_ECC_SIZE + mp_int* x; + mp_int* y; + mp_int* z; +#endif +#endif + +#ifdef WOLFSSL_DSP + remote_handle64 handle; +#endif +#ifdef ECC_TIMING_RESISTANT + WC_RNG* rng; +#endif +#ifdef WC_ECC_NONBLOCK + ecc_nb_ctx_t* nb_ctx; +#endif +}; + +#ifndef WOLFSSL_ECC_BLIND_K +#define ecc_get_k(key) (key)->k +#define ecc_blind_k(key, b) (void)b +#define ecc_blind_k_rng(key, rng) 0 + +#define wc_ecc_key_get_priv(key) (key)->k +#else +mp_int* ecc_get_k(ecc_key* key); +void ecc_blind_k(ecc_key* key, mp_int* b); +int ecc_blind_k_rng(ecc_key* key, WC_RNG* rng); + +WOLFSSL_API mp_int* wc_ecc_key_get_priv(ecc_key* key); +#endif + +#define WOLFSSL_HAVE_ECC_KEY_GET_PRIV + + +WOLFSSL_ABI WOLFSSL_API ecc_key* wc_ecc_key_new(void* heap); +WOLFSSL_ABI WOLFSSL_API void wc_ecc_key_free(ecc_key* key); + + +/* ECC predefined curve sets */ +#if defined(HAVE_FIPS) && FIPS_VERSION3_LT(6,0,0) + extern const ecc_set_type ecc_sets[]; + extern const size_t ecc_sets_count; +#else + WOLFSSL_API const ecc_set_type *wc_ecc_get_sets(void); + WOLFSSL_API size_t wc_ecc_get_sets_count(void); + #define ecc_sets wc_ecc_get_sets() + #define ecc_sets_count wc_ecc_get_sets_count() +#endif + +WOLFSSL_API +const char* wc_ecc_get_name(int curve_id); + +#ifdef WOLFSSL_PUBLIC_ECC_ADD_DBL + #define ECC_API WOLFSSL_API +#else + #define ECC_API WOLFSSL_LOCAL +#endif + +ECC_API int ecc_mul2add(ecc_point* A, mp_int* kA, + ecc_point* B, mp_int* kB, + ecc_point* C, mp_int* a, mp_int* modulus, void* heap); + +ECC_API int ecc_map(ecc_point* P, mp_int* modulus, mp_digit mp); +ECC_API int ecc_map_ex(ecc_point* P, mp_int* modulus, mp_digit mp, int ct); +ECC_API int ecc_projective_add_point(ecc_point* P, ecc_point* Q, ecc_point* R, + mp_int* a, mp_int* modulus, mp_digit mp); +ECC_API int ecc_projective_dbl_point(ecc_point* P, ecc_point* R, mp_int* a, + mp_int* modulus, mp_digit mp); + +ECC_API int ecc_projective_add_point_safe(ecc_point* A, ecc_point* B, + ecc_point* R, mp_int* a, mp_int* modulus, mp_digit mp, int* infinity); +ECC_API int ecc_projective_dbl_point_safe(ecc_point* P, ecc_point* R, mp_int* a, + mp_int* modulus, mp_digit mp); + +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_make_key(WC_RNG* rng, int keysize, ecc_key* key); +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_make_key_ex(WC_RNG* rng, int keysize, ecc_key* key, int curve_id); +WOLFSSL_API +int wc_ecc_make_key_ex2(WC_RNG* rng, int keysize, ecc_key* key, int curve_id, + int flags); +WOLFSSL_API +int wc_ecc_make_pub(ecc_key* key, ecc_point* pubOut); +WOLFSSL_API +int wc_ecc_make_pub_ex(ecc_key* key, ecc_point* pubOut, WC_RNG* rng); +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_check_key(ecc_key* key); +WOLFSSL_API +int wc_ecc_is_point(ecc_point* ecp, mp_int* a, mp_int* b, mp_int* prime); +WOLFSSL_API +int wc_ecc_get_generator(ecc_point* ecp, int curve_idx); + +#ifdef HAVE_ECC_DHE +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_shared_secret(ecc_key* private_key, ecc_key* public_key, byte* out, + word32* outlen); + +WOLFSSL_API +int wc_ecc_shared_secret_ex(ecc_key* private_key, ecc_point* point, + byte* out, word32 *outlen); + +/* Internal API for blocking ECDHE call */ +WOLFSSL_LOCAL +int wc_ecc_shared_secret_gen_sync(ecc_key* private_key, + ecc_point* point, byte* out, word32* outlen); + +#if !defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A) && \ + !defined(PLUTON_CRYPTO_ECC) && !defined(WOLFSSL_CRYPTOCELL) +#define wc_ecc_shared_secret_ssh wc_ecc_shared_secret_ex /* For backwards compat */ +#endif + +#endif /* HAVE_ECC_DHE */ + +#ifdef HAVE_ECC_SIGN +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_sign_hash(const byte* in, word32 inlen, byte* out, word32 *outlen, + WC_RNG* rng, ecc_key* key); +WOLFSSL_API +int wc_ecc_sign_hash_ex(const byte* in, word32 inlen, WC_RNG* rng, + ecc_key* key, mp_int *r, mp_int *s); +#if defined(WOLFSSL_ECDSA_DETERMINISTIC_K) || \ + defined(WOLFSSL_ECDSA_DETERMINISTIC_K_VARIANT) +WOLFSSL_API +int wc_ecc_set_deterministic(ecc_key* key, byte flag); +WOLFSSL_API +int wc_ecc_set_deterministic_ex(ecc_key* key, byte flag, + enum wc_HashType hashType); +WOLFSSL_API +int wc_ecc_gen_deterministic_k(const byte* hash, word32 hashSz, + enum wc_HashType hashType, mp_int* priv, mp_int* k, mp_int* order, + void* heap); +#endif +#if defined(WOLFSSL_ECDSA_SET_K) || defined(WOLFSSL_ECDSA_SET_K_ONE_LOOP) +WOLFSSL_API +int wc_ecc_sign_set_k(const byte* k, word32 klen, ecc_key* key); +#endif +#endif /* HAVE_ECC_SIGN */ + +#ifdef HAVE_ECC_VERIFY +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_verify_hash(const byte* sig, word32 siglen, const byte* hash, + word32 hashlen, int* res, ecc_key* key); +WOLFSSL_API +int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash, + word32 hashlen, int* res, ecc_key* key); +#endif /* HAVE_ECC_VERIFY */ + +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_init(ecc_key* key); +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_init_ex(ecc_key* key, void* heap, int devId); +#ifdef WOLF_PRIVATE_KEY_ID +WOLFSSL_API +int wc_ecc_init_id(ecc_key* key, unsigned char* id, int len, void* heap, + int devId); +WOLFSSL_API +int wc_ecc_init_label(ecc_key* key, const char* label, void* heap, int devId); +#endif +#ifdef WOLFSSL_CUSTOM_CURVES +WOLFSSL_LOCAL +void wc_ecc_free_curve(const ecc_set_type* curve, void* heap); +#endif +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_free(ecc_key* key); +WOLFSSL_API +int wc_ecc_set_flags(ecc_key* key, word32 flags); +WOLFSSL_ABI WOLFSSL_API +void wc_ecc_fp_free(void); +WOLFSSL_API +void wc_ecc_fp_init(void); +WOLFSSL_API +int wc_ecc_set_rng(ecc_key* key, WC_RNG* rng); + +WOLFSSL_API +int wc_ecc_set_curve(ecc_key* key, int keysize, int curve_id); + +WOLFSSL_API +int wc_ecc_is_valid_idx(int n); +WOLFSSL_API +int wc_ecc_get_curve_idx(int curve_id); +WOLFSSL_API +int wc_ecc_get_curve_id(int curve_idx); +#define wc_ecc_get_curve_name_from_id wc_ecc_get_name +WOLFSSL_API +int wc_ecc_get_curve_size_from_id(int curve_id); + +WOLFSSL_API +int wc_ecc_get_curve_idx_from_name(const char* curveName); +WOLFSSL_API +int wc_ecc_get_curve_size_from_name(const char* curveName); +WOLFSSL_API +int wc_ecc_get_curve_id_from_name(const char* curveName); +WOLFSSL_API +int wc_ecc_get_curve_id_from_params(int fieldSize, + const byte* prime, word32 primeSz, const byte* Af, word32 AfSz, + const byte* Bf, word32 BfSz, const byte* order, word32 orderSz, + const byte* Gx, word32 GxSz, const byte* Gy, word32 GySz, int cofactor); +WOLFSSL_API +int wc_ecc_get_curve_id_from_dp_params(const ecc_set_type* dp); + +WOLFSSL_API +int wc_ecc_get_curve_id_from_oid(const byte* oid, word32 len); + +WOLFSSL_API const ecc_set_type* wc_ecc_get_curve_params(int curve_idx); + +WOLFSSL_API +ecc_point* wc_ecc_new_point(void); +WOLFSSL_API +ecc_point* wc_ecc_new_point_h(void* h); +WOLFSSL_API +void wc_ecc_del_point(ecc_point* p); +WOLFSSL_API +void wc_ecc_del_point_h(ecc_point* p, void* h); +WOLFSSL_API +void wc_ecc_forcezero_point(ecc_point* p); +WOLFSSL_API +int wc_ecc_copy_point(const ecc_point* p, ecc_point *r); +WOLFSSL_API +int wc_ecc_cmp_point(ecc_point* a, ecc_point *b); +WOLFSSL_API +int wc_ecc_point_is_at_infinity(ecc_point *p); +WOLFSSL_API +int wc_ecc_point_is_on_curve(ecc_point *p, int curve_idx); + +#if !defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A) +WOLFSSL_API +int wc_ecc_mulmod(const mp_int* k, ecc_point *G, ecc_point *R, + mp_int* a, mp_int* modulus, int map); +ECC_API +int wc_ecc_mulmod_ex(const mp_int* k, ecc_point *G, ecc_point *R, + mp_int* a, mp_int* modulus, int map, void* heap); +ECC_API +int wc_ecc_mulmod_ex2(const mp_int* k, ecc_point *G, ecc_point *R, mp_int* a, + mp_int* modulus, mp_int* order, WC_RNG* rng, int map, + void* heap); +#endif /* !WOLFSSL_ATECC508A */ + + +#ifdef HAVE_ECC_KEY_EXPORT +/* ASN key helpers */ +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_export_x963(ecc_key* key, byte* out, word32* outLen); +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_export_x963_ex(ecc_key* key, byte* out, word32* outLen, + int compressed); + /* extended functionality with compressed option */ +#endif /* HAVE_ECC_KEY_EXPORT */ + +#ifdef HAVE_ECC_KEY_IMPORT +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_import_x963(const byte* in, word32 inLen, ecc_key* key); +WOLFSSL_API +int wc_ecc_import_x963_ex(const byte* in, word32 inLen, ecc_key* key, + int curve_id); +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_import_private_key(const byte* priv, word32 privSz, const byte* pub, + word32 pubSz, ecc_key* key); +WOLFSSL_API +int wc_ecc_import_private_key_ex(const byte* priv, word32 privSz, + const byte* pub, word32 pubSz, ecc_key* key, int curve_id); +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_rs_to_sig(const char* r, const char* s, byte* out, word32* outlen); +WOLFSSL_API +int wc_ecc_rs_raw_to_sig(const byte* r, word32 rSz, const byte* s, word32 sSz, + byte* out, word32* outlen); +WOLFSSL_API +int wc_ecc_sig_to_rs(const byte* sig, word32 sigLen, byte* r, word32* rLen, + byte* s, word32* sLen); +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_import_raw(ecc_key* key, const char* qx, const char* qy, + const char* d, const char* curveName); +WOLFSSL_API +int wc_ecc_import_raw_ex(ecc_key* key, const char* qx, const char* qy, + const char* d, int curve_id); +WOLFSSL_API +int wc_ecc_import_unsigned(ecc_key* key, const byte* qx, const byte* qy, + const byte* d, int curve_id); +#endif /* HAVE_ECC_KEY_IMPORT */ + +#ifdef HAVE_ECC_KEY_EXPORT +WOLFSSL_API +int wc_ecc_export_ex(ecc_key* key, byte* qx, word32* qxLen, + byte* qy, word32* qyLen, byte* d, word32* dLen, + int encType); +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_export_private_only(ecc_key* key, byte* out, word32* outLen); +WOLFSSL_API +int wc_ecc_export_public_raw(ecc_key* key, byte* qx, word32* qxLen, + byte* qy, word32* qyLen); +WOLFSSL_API +int wc_ecc_export_private_raw(ecc_key* key, byte* qx, word32* qxLen, + byte* qy, word32* qyLen, byte* d, word32* dLen); +#endif /* HAVE_ECC_KEY_EXPORT */ + +#ifdef HAVE_ECC_KEY_EXPORT +WOLFSSL_API +int wc_ecc_export_point_der_ex(const int curve_idx, ecc_point* point, byte* out, + word32* outLen, int compressed); +WOLFSSL_API +int wc_ecc_export_point_der(const int curve_idx, ecc_point* point, + byte* out, word32* outLen); +WOLFSSL_LOCAL +int wc_ecc_export_point_der_compressed(const int curve_idx, ecc_point* point, + byte* out, word32* outLen); +#endif /* HAVE_ECC_KEY_EXPORT */ + + +#ifdef HAVE_ECC_KEY_IMPORT +WOLFSSL_API +int wc_ecc_import_point_der_ex(const byte* in, word32 inLen, + const int curve_idx, ecc_point* point, + int shortKeySize); +WOLFSSL_API +int wc_ecc_import_point_der(const byte* in, word32 inLen, const int curve_idx, + ecc_point* point); +#endif /* HAVE_ECC_KEY_IMPORT */ + +/* size helper */ +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_size(ecc_key* key); +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_sig_size_calc(int sz); +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_sig_size(const ecc_key* key); + +WOLFSSL_API +int wc_ecc_get_oid(word32 oidSum, const byte** oid, word32* oidSz); + +#ifdef WOLFSSL_CUSTOM_CURVES + WOLFSSL_API + int wc_ecc_set_custom_curve(ecc_key* key, const ecc_set_type* dp); +#endif + +#ifdef HAVE_ECC_ENCRYPT +/* ecc encrypt */ + +enum ecEncAlgo { + ecAES_128_CBC = 1, /* default */ + ecAES_256_CBC = 2, + ecAES_128_CTR = 3, + ecAES_256_CTR = 4 +}; + +enum ecKdfAlgo { + ecHKDF_SHA256 = 1, /* default */ + ecHKDF_SHA1 = 2, + ecKDF_X963_SHA1 = 3, + ecKDF_X963_SHA256 = 4, + ecKDF_SHA1 = 5, + ecKDF_SHA256 = 6 +}; + +enum ecMacAlgo { + ecHMAC_SHA256 = 1, /* default */ + ecHMAC_SHA1 = 2 +}; + +enum { + KEY_SIZE_128 = 16, + KEY_SIZE_256 = 32, + IV_SIZE_64 = 8, + IV_SIZE_128 = 16, + ECC_MAX_IV_SIZE = 16, + EXCHANGE_SALT_SZ = 16, + EXCHANGE_INFO_SZ = 23 +}; + +enum ecFlags { + REQ_RESP_CLIENT = 1, + REQ_RESP_SERVER = 2 +}; + +#ifndef WOLFSSL_ECIES_GEN_IV_SIZE +#define WOLFSSL_ECIES_GEN_IV_SIZE 12 +#endif + + +typedef struct ecEncCtx ecEncCtx; + +WOLFSSL_ABI WOLFSSL_API +ecEncCtx* wc_ecc_ctx_new(int flags, WC_RNG* rng); +WOLFSSL_API +ecEncCtx* wc_ecc_ctx_new_ex(int flags, WC_RNG* rng, void* heap); +WOLFSSL_ABI WOLFSSL_API +void wc_ecc_ctx_free(ecEncCtx* ctx); +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_ctx_reset(ecEncCtx* ctx, WC_RNG* rng); /* reset for use again w/o alloc/free */ + +WOLFSSL_API +int wc_ecc_ctx_set_algo(ecEncCtx* ctx, byte encAlgo, byte kdfAlgo, + byte macAlgo); +WOLFSSL_API +const byte* wc_ecc_ctx_get_own_salt(ecEncCtx* ctx); +WOLFSSL_API +int wc_ecc_ctx_set_peer_salt(ecEncCtx* ctx, const byte* salt); +WOLFSSL_API +int wc_ecc_ctx_set_own_salt(ecEncCtx* ctx, const byte* salt, word32 sz); +WOLFSSL_API +int wc_ecc_ctx_set_kdf_salt(ecEncCtx* ctx, const byte* salt, word32 sz); +WOLFSSL_API +int wc_ecc_ctx_set_info(ecEncCtx* ctx, const byte* info, int sz); + +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_encrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg, + word32 msgSz, byte* out, word32* outSz, ecEncCtx* ctx); +WOLFSSL_API +int wc_ecc_encrypt_ex(ecc_key* privKey, ecc_key* pubKey, const byte* msg, + word32 msgSz, byte* out, word32* outSz, ecEncCtx* ctx, int compressed); +WOLFSSL_ABI WOLFSSL_API +int wc_ecc_decrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg, + word32 msgSz, byte* out, word32* outSz, ecEncCtx* ctx); + +#endif /* HAVE_ECC_ENCRYPT */ + +#ifdef HAVE_X963_KDF +WOLFSSL_API int wc_X963_KDF(enum wc_HashType type, const byte* secret, + word32 secretSz, const byte* sinfo, word32 sinfoSz, + byte* out, word32 outSz); +#endif + +#ifdef ECC_CACHE_CURVE +WOLFSSL_API int wc_ecc_curve_cache_init(void); +WOLFSSL_API void wc_ecc_curve_cache_free(void); +#endif + +#ifdef HAVE_OID_ENCODING +WOLFSSL_LOCAL int wc_ecc_oid_cache_init(void); +WOLFSSL_LOCAL void wc_ecc_oid_cache_free(void); +#endif + +WOLFSSL_API +int wc_ecc_gen_k(WC_RNG* rng, int size, mp_int* k, mp_int* order); + +#ifdef WOLFSSL_DSP +WOLFSSL_API +int wc_ecc_set_handle(ecc_key* key, remote_handle64 handle); +WOLFSSL_LOCAL +int sp_dsp_ecc_verify_256(remote_handle64 handle, const byte* hash, word32 hashLen, mp_int* pX, + mp_int* pY, mp_int* pZ, mp_int* r, mp_int* sm, int* res, void* heap); +#endif + +#ifdef WOLFSSL_SE050 +WOLFSSL_API +int wc_ecc_use_key_id(ecc_key* key, word32 keyId, word32 flags); +WOLFSSL_API +int wc_ecc_get_key_id(ecc_key* key, word32* keyId); +#endif + +#ifdef WC_ECC_NONBLOCK + WOLFSSL_API int wc_ecc_set_nonblock(ecc_key *key, ecc_nb_ctx_t* ctx); +#endif + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* HAVE_ECC */ +#endif /* WOLF_CRYPT_ECC_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/eccsi.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/eccsi.h @@ -0,0 +1,176 @@ +/* eccsi.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/eccsi.h +*/ + + +#ifndef WOLF_CRYPT_ECCSI_H +#define WOLF_CRYPT_ECCSI_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef WOLFCRYPT_HAVE_ECCSI + +#include <wolfssl/wolfcrypt/wolfmath.h> +#include <wolfssl/wolfcrypt/ecc.h> +#include <wolfssl/wolfcrypt/hash.h> +#include <wolfssl/wolfcrypt/hmac.h> + +#define WOLFCRYPT_ECCSI_KMS +#define WOLFCRYPT_ECCSI_CLIENT + +#define MAX_ECCSI_BYTES (256 / 8) + +/* Maximum number of loops of attempting to generate key pairs and signatures. + */ +#ifndef ECCSI_MAX_GEN_COUNT + #define ECCSI_MAX_GEN_COUNT 10 +#endif + +typedef struct EccsiKeyParams { + /** Order (q) of elliptic curve as an MP integer. */ + mp_int order; +#ifdef WOLFCRYPT_ECCSI_CLIENT + /** A parameter of elliptic curve as an MP integer. */ + mp_int a; + /** P parameter of elliptic curve as an MP integer. */ + mp_int b; + /** Prime of elliptic curve as an MP integer. */ + mp_int prime; +#endif + /** Base point for elliptic curve operations as an ECC point. */ + ecc_point* base; + + /** Bit indicates order (q) is set as an MP integer in ECCSI key. */ + WC_BITFIELD haveOrder:1; + /** Bit indicates A is set as an MP integer in ECCSI key. */ + WC_BITFIELD haveA:1; + /** Bit indicates B is set as an MP integer in ECCSI key. */ + WC_BITFIELD haveB:1; + /** Bit indicates prime is set as an MP integer in ECCSI key. */ + WC_BITFIELD havePrime:1; + /** Bit indicates base point is set as an MP integer in ECCSI key. */ + WC_BITFIELD haveBase:1; +} EccsiKeyParams; + +/** + * ECCSI key. + */ +typedef struct EccsiKey { + /** ECC key to perform elliptic curve operations with. */ + ecc_key ecc; + /** ECC key to perform public key elliptic curve operations with. */ + ecc_key pubkey; + /** ECC parameter in forms that can be used in computation. */ + EccsiKeyParams params; +#ifdef WOLFCRYPT_ECCSI_CLIENT + /** Temporary MP integer used during operations.. */ + mp_int tmp; + /** Secret Signing Key */ + mp_int ssk; + /** Public Validation Token (PVT) */ + ecc_point* pvt; +#endif + /** Generic hash algorithm object. */ + wc_HashAlg hash; + /** Temporary buffer for use in operations. */ + byte data[(MAX_ECCSI_BYTES * 2) + 1]; +#ifdef WOLFCRYPT_ECCSI_CLIENT + /** Hash of identity - used in signing/verification. */ + byte idHash[WC_MAX_DIGEST_SIZE]; + /** Size of hash of identity in bytes. */ + byte idHashSz; +#endif + /** Heap hint for dynamic memory allocation. */ + void* heap; + /** Bit indicates KPAK (public key) is in montgomery form. */ + WC_BITFIELD kpakMont:1; +} EccsiKey; + +#ifdef __cplusplus + extern "C" { +#endif + +WOLFSSL_API int wc_InitEccsiKey(EccsiKey* key, void* heap, int devId); +WOLFSSL_API int wc_InitEccsiKey_ex(EccsiKey* key, int keySz, int curveId, + void* heap, int devId); +WOLFSSL_API void wc_FreeEccsiKey(EccsiKey* key); + +WOLFSSL_API int wc_MakeEccsiKey(EccsiKey* key, WC_RNG* rng); + +WOLFSSL_API int wc_MakeEccsiPair(EccsiKey* key, WC_RNG* rng, + enum wc_HashType hashType, const byte* id, word32 idSz, mp_int* ssk, + ecc_point* pvt); +WOLFSSL_API int wc_ValidateEccsiPair(EccsiKey* key, enum wc_HashType hashType, + const byte* id, word32 idSz, const mp_int* ssk, ecc_point* pvt, + int* valid); +WOLFSSL_API int wc_ValidateEccsiPvt(EccsiKey* key, const ecc_point* pvt, + int* valid); +WOLFSSL_API int wc_EncodeEccsiPair(const EccsiKey* key, mp_int* ssk, + ecc_point* pvt, byte* data, word32* sz); +WOLFSSL_API int wc_EncodeEccsiSsk(const EccsiKey* key, mp_int* ssk, byte* data, + word32* sz); +WOLFSSL_API int wc_EncodeEccsiPvt(const EccsiKey* key, ecc_point* pvt, + byte* data, word32* sz, int raw); +WOLFSSL_API int wc_DecodeEccsiPair(const EccsiKey* key, const byte* data, + word32 sz, mp_int* ssk, ecc_point* pvt); +WOLFSSL_API int wc_DecodeEccsiSsk(const EccsiKey* key, const byte* data, + word32 sz, mp_int* ssk); +WOLFSSL_API int wc_DecodeEccsiPvt(const EccsiKey* key, const byte* data, + word32 sz, ecc_point* pvt); +WOLFSSL_API int wc_DecodeEccsiPvtFromSig(const EccsiKey* key, const byte* sig, + word32 sz, ecc_point* pvt); + +WOLFSSL_API int wc_ExportEccsiKey(EccsiKey* key, byte* data, word32* sz); +WOLFSSL_API int wc_ImportEccsiKey(EccsiKey* key, const byte* data, word32 sz); + +WOLFSSL_API int wc_ExportEccsiPrivateKey(EccsiKey* key, byte* data, word32* sz); +WOLFSSL_API int wc_ImportEccsiPrivateKey(EccsiKey* key, const byte* data, + word32 sz); + +WOLFSSL_API int wc_ExportEccsiPublicKey(EccsiKey* key, byte* data, word32* sz, + int raw); +WOLFSSL_API int wc_ImportEccsiPublicKey(EccsiKey* key, const byte* data, + word32 sz, int trusted); + +WOLFSSL_API int wc_HashEccsiId(EccsiKey* key, enum wc_HashType hashType, + const byte* id, word32 idSz, ecc_point* pvt, byte* hash, byte* hashSz); +WOLFSSL_API int wc_SetEccsiHash(EccsiKey* key, const byte* hash, byte hashSz); +WOLFSSL_API int wc_SetEccsiPair(EccsiKey* key, const mp_int* ssk, + const ecc_point* pvt); + +WOLFSSL_API int wc_SignEccsiHash(EccsiKey* key, WC_RNG* rng, + enum wc_HashType hashType, const byte* msg, word32 msgSz, byte* sig, + word32* sigSz); +WOLFSSL_API int wc_VerifyEccsiHash(EccsiKey* key, enum wc_HashType hashType, + const byte* msg, word32 msgSz, const byte* sig, word32 sigSz, + int* verified); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFCRYPT_HAVE_ECCSI */ + +#endif /* WOLF_CRYPT_ECCSI_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/ed25519.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/ed25519.h @@ -0,0 +1,239 @@ +/* ed25519.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/ed25519.h +*/ + + +#ifndef WOLF_CRYPT_ED25519_H +#define WOLF_CRYPT_ED25519_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef HAVE_ED25519 + +#include <wolfssl/wolfcrypt/random.h> +#ifndef WOLFSSL_SHA512 +#error ED25519 requires SHA512 +#endif +#include <wolfssl/wolfcrypt/sha512.h> + +#ifdef WOLFSSL_ASYNC_CRYPT + #include <wolfssl/wolfcrypt/async.h> +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +#if FIPS_VERSION3_GE(6,0,0) + extern const unsigned int wolfCrypt_FIPS_ed25519_ro_sanity[2]; + WOLFSSL_LOCAL int wolfCrypt_FIPS_ED25519_sanity(void); +#endif + +/* info about EdDSA curve specifically ed25519, defined as an elliptic curve + over GF(p) */ +/* + 32, key size + "ED25519", curve name + "2^255-19", prime number + "SHA512", hash function + "-121665/121666", value of d +*/ + +#define ED25519_KEY_SIZE 32 /* private key only */ +#define ED25519_SIG_SIZE 64 + +#define ED25519_PUB_KEY_SIZE 32 /* compressed */ +/* both private and public key */ +#define ED25519_PRV_KEY_SIZE (ED25519_PUB_KEY_SIZE+ED25519_KEY_SIZE) + + +enum { + Ed25519 = -1, + Ed25519ctx = 0, + Ed25519ph = 1 +}; + +/* ED25519 Flags */ +enum { + WC_ED25519_FLAG_NONE = 0x00, + WC_ED25519_FLAG_DEC_SIGN = 0x01 +}; + +/* An ED25519 Key */ +struct ed25519_key { + ALIGN16 byte p[ED25519_PUB_KEY_SIZE]; /* compressed public key */ + ALIGN16 byte k[ED25519_PRV_KEY_SIZE]; /* private key: 32 secret, 32 pub */ +#ifdef FREESCALE_LTC_ECC + /* uncompressed point coordinates */ + ALIGN16 byte pointX[ED25519_KEY_SIZE]; /* recovered X coordinate */ + ALIGN16 byte pointY[ED25519_KEY_SIZE]; /* Y coordinate is the public key with The most significant bit of the final octet always zero. */ +#endif +#ifdef WOLFSSL_SE050 + word32 keyId; + word32 flags; + byte keyIdSet; +#endif + WC_BITFIELD privKeySet:1; + WC_BITFIELD pubKeySet:1; + WC_BITFIELD sha_clean_flag:1; /* only used if WOLFSSL_ED25519_PERSISTENT_SHA */ +#ifdef WOLFSSL_ASYNC_CRYPT + WC_ASYNC_DEV asyncDev; +#endif +#if defined(WOLF_CRYPTO_CB) + void* devCtx; + int devId; +#endif + void *heap; +#ifdef WOLFSSL_ED25519_PERSISTENT_SHA + wc_Sha512 sha; +#endif +}; + +#ifndef WC_ED25519KEY_TYPE_DEFINED + typedef struct ed25519_key ed25519_key; + #define WC_ED25519KEY_TYPE_DEFINED +#endif + + +WOLFSSL_API +int wc_ed25519_make_public(ed25519_key* key, unsigned char* pubKey, + word32 pubKeySz); +WOLFSSL_API +int wc_ed25519_make_key(WC_RNG* rng, int keysize, ed25519_key* key); +#ifdef HAVE_ED25519_SIGN +WOLFSSL_API +int wc_ed25519_sign_msg(const byte* in, word32 inLen, byte* out, + word32 *outLen, ed25519_key* key); +WOLFSSL_API +int wc_ed25519ctx_sign_msg(const byte* in, word32 inLen, byte* out, + word32 *outLen, ed25519_key* key, + const byte* context, byte contextLen); +WOLFSSL_API +int wc_ed25519ph_sign_hash(const byte* hash, word32 hashLen, byte* out, + word32 *outLen, ed25519_key* key, + const byte* context, byte contextLen); +WOLFSSL_API +int wc_ed25519ph_sign_msg(const byte* in, word32 inLen, byte* out, + word32 *outLen, ed25519_key* key, const byte* context, + byte contextLen); +WOLFSSL_API +int wc_ed25519_sign_msg_ex(const byte* in, word32 inLen, byte* out, + word32 *outLen, ed25519_key* key, byte type, + const byte* context, byte contextLen); +#endif /* HAVE_ED25519_SIGN */ +#ifdef HAVE_ED25519_VERIFY +WOLFSSL_API +int wc_ed25519_verify_msg(const byte* sig, word32 sigLen, const byte* msg, + word32 msgLen, int* res, ed25519_key* key); +WOLFSSL_API +int wc_ed25519ctx_verify_msg(const byte* sig, word32 sigLen, const byte* msg, + word32 msgLen, int* res, ed25519_key* key, + const byte* context, byte contextLen); +WOLFSSL_API +int wc_ed25519ph_verify_hash(const byte* sig, word32 sigLen, const byte* hash, + word32 hashLen, int* res, ed25519_key* key, + const byte* context, byte contextLen); +WOLFSSL_API +int wc_ed25519ph_verify_msg(const byte* sig, word32 sigLen, const byte* msg, + word32 msgLen, int* res, ed25519_key* key, + const byte* context, byte contextLen); +WOLFSSL_API +int wc_ed25519_verify_msg_ex(const byte* sig, word32 sigLen, const byte* msg, + word32 msgLen, int* res, ed25519_key* key, + byte type, const byte* context, byte contextLen); +#ifdef WOLFSSL_ED25519_STREAMING_VERIFY +WOLFSSL_API +int wc_ed25519_verify_msg_init(const byte* sig, word32 sigLen, ed25519_key* key, + byte type, const byte* context, byte contextLen); +WOLFSSL_API +int wc_ed25519_verify_msg_update(const byte* msgSegment, word32 msgSegmentLen, + ed25519_key* key); +WOLFSSL_API +int wc_ed25519_verify_msg_final(const byte* sig, word32 sigLen, int* res, + ed25519_key* key); +#endif /* WOLFSSL_ED25519_STREAMING_VERIFY */ +#endif /* HAVE_ED25519_VERIFY */ + +WOLFSSL_API +int wc_ed25519_init(ed25519_key* key); +WOLFSSL_API +int wc_ed25519_init_ex(ed25519_key* key, void* heap, int devId); +WOLFSSL_API +void wc_ed25519_free(ed25519_key* key); +#ifndef WC_NO_CONSTRUCTORS +WOLFSSL_API +ed25519_key* wc_ed25519_new(void* heap, int devId, int *result_code); +WOLFSSL_API +int wc_ed25519_delete(ed25519_key* key, ed25519_key** key_p); +#endif + +#ifdef HAVE_ED25519_KEY_IMPORT +WOLFSSL_API +int wc_ed25519_import_public(const byte* in, word32 inLen, ed25519_key* key); +WOLFSSL_API +int wc_ed25519_import_public_ex(const byte* in, word32 inLen, ed25519_key* key, + int trusted); +WOLFSSL_API +int wc_ed25519_import_private_only(const byte* priv, word32 privSz, + ed25519_key* key); +WOLFSSL_API +int wc_ed25519_import_private_key(const byte* priv, word32 privSz, + const byte* pub, word32 pubSz, ed25519_key* key); +WOLFSSL_API +int wc_ed25519_import_private_key_ex(const byte* priv, word32 privSz, + const byte* pub, word32 pubSz, ed25519_key* key, int trusted); +#endif /* HAVE_ED25519_KEY_IMPORT */ + +#ifdef HAVE_ED25519_KEY_EXPORT +WOLFSSL_API +int wc_ed25519_export_public(ed25519_key* key, byte* out, word32* outLen); +WOLFSSL_API +int wc_ed25519_export_private_only(ed25519_key* key, byte* out, word32* outLen); +WOLFSSL_API +int wc_ed25519_export_private(ed25519_key* key, byte* out, word32* outLen); +WOLFSSL_API +int wc_ed25519_export_key(ed25519_key* key, + byte* priv, word32 *privSz, + byte* pub, word32 *pubSz); +#endif /* HAVE_ED25519_KEY_EXPORT */ + +WOLFSSL_API +int wc_ed25519_check_key(ed25519_key* key); + +/* size helper */ +WOLFSSL_API +int wc_ed25519_size(ed25519_key* key); +WOLFSSL_API +int wc_ed25519_priv_size(ed25519_key* key); +WOLFSSL_API +int wc_ed25519_pub_size(ed25519_key* key); +WOLFSSL_API +int wc_ed25519_sig_size(ed25519_key* key); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* HAVE_ED25519 */ +#endif /* WOLF_CRYPT_ED25519_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/ed448.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/ed448.h @@ -0,0 +1,214 @@ +/* ed448.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/ed448.h +*/ + + +#ifndef WOLF_CRYPT_ED448_H +#define WOLF_CRYPT_ED448_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef HAVE_ED448 + +#include <wolfssl/wolfcrypt/fe_448.h> +#include <wolfssl/wolfcrypt/ge_448.h> +#include <wolfssl/wolfcrypt/random.h> +#ifndef WOLFSSL_SHAKE256 +#error ED448 requires SHAKE256 +#endif +#include <wolfssl/wolfcrypt/sha3.h> + +#ifdef WOLFSSL_ASYNC_CRYPT + #include <wolfssl/wolfcrypt/async.h> +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +#if FIPS_VERSION3_GE(6,0,0) + extern const unsigned int wolfCrypt_FIPS_ed448_ro_sanity[2]; + WOLFSSL_LOCAL int wolfCrypt_FIPS_ED448_sanity(void); +#endif + +/* info about EdDSA curve specifically ed448, defined as an elliptic curve + * over GF(p) + * + * 56 key size + * "ED448" curve name + * "2^448-2^224-1" prime number + * "-39081" value of d + * "SHAKE256" hash function + */ + +#define ED448_KEY_SIZE 57 /* private key only */ +#define ED448_SIG_SIZE 114 /* two elements */ + +#define ED448_PUB_KEY_SIZE 57 /* compressed */ +/* both private and public key */ +#define ED448_PRV_KEY_SIZE (ED448_PUB_KEY_SIZE+ED448_KEY_SIZE) + +#define ED448_PREHASH_SIZE 64 + +enum { + Ed448 = 0, + Ed448ph = 1 +}; + +/* An ED448 Key */ +struct ed448_key { + byte p[ED448_PUB_KEY_SIZE]; /* compressed public key */ + byte k[ED448_PRV_KEY_SIZE]; /* private key : 57 secret -- 57 public */ +#ifdef FREESCALE_LTC_ECC + /* uncompressed point coordinates */ + byte pointX[ED448_KEY_SIZE]; /* recovered X coordinate */ + byte pointY[ED448_KEY_SIZE]; /* Y coordinate is the public key with The most significant bit of the final octet always zero. */ +#endif + WC_BITFIELD privKeySet:1; + WC_BITFIELD pubKeySet:1; +#ifdef WOLFSSL_ASYNC_CRYPT + WC_ASYNC_DEV asyncDev; +#endif +#if defined(WOLF_CRYPTO_CB) + void* devCtx; + int devId; +#endif + void *heap; +#ifdef WOLFSSL_ED448_PERSISTENT_SHA + wc_Shake sha; + unsigned int sha_clean_flag : 1; +#endif +}; + +#ifndef WC_ED448KEY_TYPE_DEFINED + typedef struct ed448_key ed448_key; + #define WC_ED448KEY_TYPE_DEFINED +#endif + +WOLFSSL_API +int wc_ed448_make_public(ed448_key* key, unsigned char* pubKey, + word32 pubKeySz); +WOLFSSL_API +int wc_ed448_make_key(WC_RNG* rng, int keysize, ed448_key* key); +#ifdef HAVE_ED448_SIGN +WOLFSSL_API +int wc_ed448_sign_msg(const byte* in, word32 inLen, byte* out, word32 *outLen, + ed448_key* key, const byte* context, byte contextLen); +WOLFSSL_API +int wc_ed448ph_sign_hash(const byte* hash, word32 hashLen, byte* out, + word32 *outLen, ed448_key* key, + const byte* context, byte contextLen); +WOLFSSL_API +int wc_ed448_sign_msg_ex(const byte* in, word32 inLen, byte* out, + word32 *outLen, ed448_key* key, byte type, + const byte* context, byte contextLen); +WOLFSSL_API +int wc_ed448ph_sign_msg(const byte* in, word32 inLen, byte* out, + word32 *outLen, ed448_key* key, const byte* context, + byte contextLen); +#endif /* HAVE_ED448_SIGN */ +#ifdef HAVE_ED448_VERIFY +WOLFSSL_API +int wc_ed448_verify_msg_ex(const byte* sig, word32 sigLen, const byte* msg, + word32 msgLen, int* res, ed448_key* key, + byte type, const byte* context, byte contextLen); +#ifdef WOLFSSL_ED448_STREAMING_VERIFY +WOLFSSL_API +int wc_ed448_verify_msg_init(const byte* sig, word32 sigLen, ed448_key* key, + byte type, const byte* context, byte contextLen); +WOLFSSL_API +int wc_ed448_verify_msg_update(const byte* msgSegment, word32 msgSegmentLen, + ed448_key* key); +WOLFSSL_API +int wc_ed448_verify_msg_final(const byte* sig, word32 sigLen, + int* res, ed448_key* key); +#endif /* WOLFSSL_ED448_STREAMING_VERIFY */ +WOLFSSL_API +int wc_ed448_verify_msg(const byte* sig, word32 sigLen, const byte* msg, + word32 msgLen, int* res, ed448_key* key, + const byte* context, byte contextLen); +WOLFSSL_API +int wc_ed448ph_verify_hash(const byte* sig, word32 sigLen, const byte* hash, + word32 hashLen, int* res, ed448_key* key, + const byte* context, byte contextLen); +WOLFSSL_API +int wc_ed448ph_verify_msg(const byte* sig, word32 sigLen, const byte* msg, + word32 msgLen, int* res, ed448_key* key, + const byte* context, byte contextLen); +#endif /* HAVE_ED448_VERIFY */ +WOLFSSL_API +int wc_ed448_init_ex(ed448_key* key, void *heap, int devId); +WOLFSSL_API +int wc_ed448_init(ed448_key* key); +WOLFSSL_API +void wc_ed448_free(ed448_key* key); + +#ifdef HAVE_ED448_KEY_IMPORT +WOLFSSL_API +int wc_ed448_import_public(const byte* in, word32 inLen, ed448_key* key); +WOLFSSL_API +int wc_ed448_import_public_ex(const byte* in, word32 inLen, ed448_key* key, + int trusted); +WOLFSSL_API +int wc_ed448_import_private_only(const byte* priv, word32 privSz, + ed448_key* key); +WOLFSSL_API +int wc_ed448_import_private_key(const byte* priv, word32 privSz, + const byte* pub, word32 pubSz, ed448_key* key); +WOLFSSL_API +int wc_ed448_import_private_key_ex(const byte* priv, word32 privSz, + const byte* pub, word32 pubSz, ed448_key* key, int trusted); +#endif /* HAVE_ED448_KEY_IMPORT */ + +#ifdef HAVE_ED448_KEY_EXPORT +WOLFSSL_API +int wc_ed448_export_public(ed448_key* key, byte* out, word32* outLen); +WOLFSSL_API +int wc_ed448_export_private_only(ed448_key* key, byte* out, word32* outLen); +WOLFSSL_API +int wc_ed448_export_private(ed448_key* key, byte* out, word32* outLen); +WOLFSSL_API +int wc_ed448_export_key(ed448_key* key, byte* priv, word32 *privSz, + byte* pub, word32 *pubSz); +#endif /* HAVE_ED448_KEY_EXPORT */ + +WOLFSSL_API +int wc_ed448_check_key(ed448_key* key); + +/* size helper */ +WOLFSSL_API +int wc_ed448_size(ed448_key* key); +WOLFSSL_API +int wc_ed448_priv_size(ed448_key* key); +WOLFSSL_API +int wc_ed448_pub_size(ed448_key* key); +WOLFSSL_API +int wc_ed448_sig_size(ed448_key* key); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* HAVE_ED448 */ +#endif /* WOLF_CRYPT_ED448_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/error-crypt.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/error-crypt.h @@ -0,0 +1,377 @@ +/* error-crypt.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/error-crypt.h +*/ +/* +DESCRIPTION +This library defines error codes and contains routines for setting and examining +the error status. +*/ + +#ifndef WOLF_CRYPT_ERROR_H +#define WOLF_CRYPT_ERROR_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef __cplusplus + extern "C" { +#endif + +#ifdef WOLFSSL_DEBUG_TRACE_ERROR_CODES_H +#include <wolfssl/debug-untrace-error-codes.h> +#endif + +/* error codes, add string for new errors !!! */ +enum wolfCrypt_ErrorCodes { + /* note that WOLFSSL_FATAL_ERROR is defined as -1 in error-ssl.h, for + * reasons of backward compatibility. + */ + WC_FAILURE = -1, /* Generic but traceable back compat errcode. + * Note, not reflected in MAX_CODE_E or + * WC_FIRST_E. + */ + + MAX_CODE_E = -96, /* WC_FIRST_E + 1, for backward compat. */ + WC_FIRST_E = -97, /* First code used for wolfCrypt */ + + WC_SPAN1_FIRST_E = -97, /* errors -97 - -300 */ + + MP_MEM = -97, /* MP dynamic memory allocation failed. */ + MP_VAL = -98, /* MP value passed is not able to be used. */ + MP_WOULDBLOCK = -99, /* MP non-blocking operation is returning after + * partial completion. */ + MP_NOT_INF = -100, /* MP point not at infinity */ + + OPEN_RAN_E = -101, /* opening random device error */ + READ_RAN_E = -102, /* reading random device error */ + WINCRYPT_E = -103, /* windows crypt init error */ + CRYPTGEN_E = -104, /* windows crypt generation error */ + RAN_BLOCK_E = -105, /* reading random device would block */ + BAD_MUTEX_E = -106, /* Bad mutex operation */ + WC_TIMEOUT_E = -107, /* timeout error */ + WC_PENDING_E = -108, /* wolfCrypt operation pending (would block) */ + WC_NO_PENDING_E = -109, /* no asynchronous operation pending */ + + MP_INIT_E = -110, /* mp_init error state */ + MP_READ_E = -111, /* mp_read error state */ + MP_EXPTMOD_E = -112, /* mp_exptmod error state */ + MP_TO_E = -113, /* mp_to_xxx error state, can't convert */ + MP_SUB_E = -114, /* mp_sub error state, can't subtract */ + MP_ADD_E = -115, /* mp_add error state, can't add */ + MP_MUL_E = -116, /* mp_mul error state, can't multiply */ + MP_MULMOD_E = -117, /* mp_mulmod error state, can't multiply mod */ + MP_MOD_E = -118, /* mp_mod error state, can't mod */ + MP_INVMOD_E = -119, /* mp_invmod error state, can't inv mod */ + MP_CMP_E = -120, /* mp_cmp error state */ + MP_ZERO_E = -121, /* got a mp zero result, not expected */ + + AES_EAX_AUTH_E = -122, /* AES-EAX Authentication check failure */ + KEY_EXHAUSTED_E = -123, /* No longer usable for operation. */ + + /* -124 unused. */ + + MEMORY_E = -125, /* out of memory error */ + VAR_STATE_CHANGE_E = -126, /* var state modified by different thread */ + FIPS_DEGRADED_E = -127, /* FIPS Module in degraded mode */ + + FIPS_CODE_SZ_E = -128, /* Module CODE too big */ + FIPS_DATA_SZ_E = -129, /* Module DATA too big */ + + RSA_WRONG_TYPE_E = -130, /* RSA wrong block type for RSA function */ + RSA_BUFFER_E = -131, /* RSA buffer error, output too small or + input too large */ + BUFFER_E = -132, /* output buffer too small or input too large */ + ALGO_ID_E = -133, /* setting algo id error */ + PUBLIC_KEY_E = -134, /* setting public key error */ + DATE_E = -135, /* setting date validity error */ + SUBJECT_E = -136, /* setting subject name error */ + ISSUER_E = -137, /* setting issuer name error */ + CA_TRUE_E = -138, /* setting CA basic constraint true error */ + EXTENSIONS_E = -139, /* setting extensions error */ + + ASN_PARSE_E = -140, /* ASN parsing error, invalid input */ + ASN_VERSION_E = -141, /* ASN version error, invalid number */ + ASN_GETINT_E = -142, /* ASN get big int error, invalid data */ + ASN_RSA_KEY_E = -143, /* ASN key init error, invalid input */ + ASN_OBJECT_ID_E = -144, /* ASN object id error, invalid id */ + ASN_TAG_NULL_E = -145, /* ASN tag error, not null */ + ASN_EXPECT_0_E = -146, /* ASN expect error, not zero */ + ASN_BITSTR_E = -147, /* ASN bit string error, wrong id */ + ASN_UNKNOWN_OID_E = -148, /* ASN oid error, unknown sum id */ + ASN_DATE_SZ_E = -149, /* ASN date error, bad size */ + ASN_BEFORE_DATE_E = -150, /* ASN date error, current date before */ + ASN_AFTER_DATE_E = -151, /* ASN date error, current date after */ + ASN_SIG_OID_E = -152, /* ASN signature error, mismatched oid */ + ASN_TIME_E = -153, /* ASN time error, unknown time type */ + ASN_INPUT_E = -154, /* ASN input error, not enough data */ + ASN_SIG_CONFIRM_E = -155, /* ASN sig error, confirm failure */ + ASN_SIG_HASH_E = -156, /* ASN sig error, unsupported hash type */ + ASN_SIG_KEY_E = -157, /* ASN sig error, unsupported key type */ + ASN_DH_KEY_E = -158, /* ASN key init error, invalid input */ + KDF_SRTP_KAT_FIPS_E = -159, /* SRTP-KDF Known Answer Test Failure */ + ASN_CRIT_EXT_E = -160, /* ASN unsupported critical extension */ + ASN_ALT_NAME_E = -161, /* ASN alternate name error */ + ASN_NO_PEM_HEADER = -162, /* ASN no PEM header found */ + ED25519_KAT_FIPS_E = -163, /* Ed25519 Known answer test failure */ + ED448_KAT_FIPS_E = -164, /* Ed448 Known answer test failure */ + PBKDF2_KAT_FIPS_E = -165, /* PBKDF2 Known answer test failure */ + WC_KEY_MISMATCH_E = -166, /* Error for private/public key mismatch */ + /* -167..-169 unused. */ + + ECC_BAD_ARG_E = -170, /* ECC input argument of wrong type */ + ASN_ECC_KEY_E = -171, /* ASN ECC bad input */ + ECC_CURVE_OID_E = -172, /* Unsupported ECC OID curve type */ + BAD_FUNC_ARG = -173, /* Bad function argument provided */ + NOT_COMPILED_IN = -174, /* Feature not compiled in */ + UNICODE_SIZE_E = -175, /* Unicode password too big */ + NO_PASSWORD = -176, /* no password provided by user */ + ALT_NAME_E = -177, /* alt name size problem, too big */ + BAD_OCSP_RESPONDER = -178, /* missing key usage extensions */ + CRL_CERT_DATE_ERR = -179, /* CRL date error */ + + AES_GCM_AUTH_E = -180, /* AES-GCM Authentication check failure */ + AES_CCM_AUTH_E = -181, /* AES-CCM Authentication check failure */ + + ASYNC_INIT_E = -182, /* Async Init type error */ + + COMPRESS_INIT_E = -183, /* Compress init error */ + COMPRESS_E = -184, /* Compress error */ + DECOMPRESS_INIT_E = -185, /* DeCompress init error */ + DECOMPRESS_E = -186, /* DeCompress error */ + + BAD_ALIGN_E = -187, /* Bad alignment for operation, no alloc */ + ASN_NO_SIGNER_E = -188, /* ASN no signer to confirm failure */ + ASN_CRL_CONFIRM_E = -189, /* ASN CRL signature confirm failure */ + ASN_CRL_NO_SIGNER_E = -190, /* ASN CRL no signer to confirm failure */ + ASN_OCSP_CONFIRM_E = -191, /* ASN OCSP signature confirm failure */ + + BAD_STATE_E = -192, /* Bad state operation */ + BAD_PADDING_E = -193, /* Bad padding, msg not correct length */ + + REQ_ATTRIBUTE_E = -194, /* setting cert request attributes error */ + + PKCS7_OID_E = -195, /* PKCS#7, mismatched OID error */ + PKCS7_RECIP_E = -196, /* PKCS#7, recipient error */ + FIPS_NOT_ALLOWED_E = -197, /* FIPS not allowed error */ + ASN_NAME_INVALID_E = -198, /* ASN name constraint error */ + + RNG_FAILURE_E = -199, /* RNG Failed, Reinitialize */ + HMAC_MIN_KEYLEN_E = -200, /* FIPS Mode HMAC Minimum Key Length error */ + RSA_PAD_E = -201, /* RSA Padding Error */ + LENGTH_ONLY_E = -202, /* Returning output length only */ + + IN_CORE_FIPS_E = -203, /* In Core Integrity check failure */ + AES_KAT_FIPS_E = -204, /* AES KAT failure */ + DES3_KAT_FIPS_E = -205, /* DES3 KAT failure */ + HMAC_KAT_FIPS_E = -206, /* HMAC KAT failure */ + RSA_KAT_FIPS_E = -207, /* RSA KAT failure */ + DRBG_KAT_FIPS_E = -208, /* HASH DRBG KAT failure */ + DRBG_CONT_FIPS_E = -209, /* HASH DRBG Continuous test failure */ + AESGCM_KAT_FIPS_E = -210, /* AESGCM KAT failure */ + THREAD_STORE_KEY_E = -211, /* Thread local storage key create failure */ + THREAD_STORE_SET_E = -212, /* Thread local storage key set failure */ + + MAC_CMP_FAILED_E = -213, /* MAC comparison failed */ + IS_POINT_E = -214, /* ECC is point on curve failed */ + ECC_INF_E = -215, /* ECC point infinity error */ + ECC_PRIV_KEY_E = -216, /* ECC private key not valid error */ + ECC_OUT_OF_RANGE_E = -217, /* ECC key component out of range */ + + SRP_CALL_ORDER_E = -218, /* SRP function called in the wrong order. */ + SRP_VERIFY_E = -219, /* SRP proof verification failed. */ + SRP_BAD_KEY_E = -220, /* SRP bad ephemeral values. */ + + ASN_NO_SKID = -221, /* ASN no Subject Key Identifier found */ + ASN_NO_AKID = -222, /* ASN no Authority Key Identifier found */ + ASN_NO_KEYUSAGE = -223, /* ASN no Key Usage found */ + SKID_E = -224, /* setting Subject Key Identifier error */ + AKID_E = -225, /* setting Authority Key Identifier error */ + KEYUSAGE_E = -226, /* Bad Key Usage value */ + CERTPOLICIES_E = -227, /* setting Certificate Policies error */ + + WC_INIT_E = -228, /* wolfcrypt failed to initialize */ + SIG_VERIFY_E = -229, /* wolfcrypt signature verify error */ + BAD_COND_E = -230, /* Bad condition variable operation */ + SIG_TYPE_E = -231, /* Signature Type not enabled/available + * NOTE: 1024-bit sign disabled in FIPS mode */ + HASH_TYPE_E = -232, /* Hash Type not enabled/available */ + + FIPS_INVALID_VER_E = -233, /* Invalid FIPS Version defined */ + + WC_KEY_SIZE_E = -234, /* Key size error, either too small or large */ + ASN_COUNTRY_SIZE_E = -235, /* ASN Cert Gen, invalid country code size */ + MISSING_RNG_E = -236, /* RNG required but not provided */ + ASN_PATHLEN_SIZE_E = -237, /* ASN CA path length too large error */ + ASN_PATHLEN_INV_E = -238, /* ASN CA path length inversion error */ + + BAD_KEYWRAP_ALG_E = -239, + BAD_KEYWRAP_IV_E = -240, /* Decrypted AES key wrap IV incorrect */ + WC_CLEANUP_E = -241, /* wolfcrypt cleanup failed */ + ECC_CDH_KAT_FIPS_E = -242, /* ECC CDH Known Answer Test failure */ + DH_CHECK_PUB_E = -243, /* DH Check Pub Key error */ + BAD_PATH_ERROR = -244, /* Bad path for opendir */ + + ASYNC_OP_E = -245, /* Async operation error */ + + ECC_PRIVATEONLY_E = -246, /* Invalid use of private only ECC key*/ + EXTKEYUSAGE_E = -247, /* Bad Extended Key Usage value */ + WC_HW_E = -248, /* Error with hardware crypto use */ + WC_HW_WAIT_E = -249, /* Hardware waiting on resource */ + + PSS_SALTLEN_E = -250, /* PSS length of salt is too long for hash */ + PRIME_GEN_E = -251, /* Failure finding a prime. */ + BER_INDEF_E = -252, /* Cannot decode indefinite length BER. */ + RSA_OUT_OF_RANGE_E = -253, /* Ciphertext to decrypt out of range. */ + RSAPSS_PAT_FIPS_E = -254, /* RSA-PSS PAT failure */ + ECDSA_PAT_FIPS_E = -255, /* ECDSA PAT failure */ + DH_KAT_FIPS_E = -256, /* DH KAT failure */ + AESCCM_KAT_FIPS_E = -257, /* AESCCM KAT failure */ + SHA3_KAT_FIPS_E = -258, /* SHA-3 KAT failure */ + ECDHE_KAT_FIPS_E = -259, /* ECDHE KAT failure */ + AES_GCM_OVERFLOW_E = -260, /* AES-GCM invocation counter overflow. */ + AES_CCM_OVERFLOW_E = -261, /* AES-CCM invocation counter overflow. */ + RSA_KEY_PAIR_E = -262, /* RSA Key Pair-Wise Consistency check fail. */ + DH_CHECK_PRIV_E = -263, /* DH Check Priv Key error */ + + WC_AFALG_SOCK_E = -264, /* AF_ALG socket error */ + WC_DEVCRYPTO_E = -265, /* /dev/crypto error */ + + ZLIB_INIT_ERROR = -266, /* zlib init error */ + ZLIB_COMPRESS_ERROR = -267, /* zlib compression error */ + ZLIB_DECOMPRESS_ERROR = -268, /* zlib decompression error */ + + PKCS7_NO_SIGNER_E = -269, /* No signer in PKCS#7 signed data msg */ + WC_PKCS7_WANT_READ_E= -270, /* PKCS7 operations wants more input */ + + CRYPTOCB_UNAVAILABLE= -271, /* Crypto callback unavailable */ + PKCS7_SIGNEEDS_CHECK= -272, /* signature needs verified by caller */ + PSS_SALTLEN_RECOVER_E=-273, /* PSS slat length not recoverable */ + CHACHA_POLY_OVERFLOW =-274, /* ChaCha20Poly1305 limit overflow */ + ASN_SELF_SIGNED_E = -275, /* ASN self-signed certificate error */ + SAKKE_VERIFY_FAIL_E = -276, /* SAKKE derivation verification error */ + MISSING_IV = -277, /* IV was not set */ + MISSING_KEY = -278, /* Key was not set */ + BAD_LENGTH_E = -279, /* Value of length parameter is invalid. */ + ECDSA_KAT_FIPS_E = -280, /* ECDSA KAT failure */ + RSA_PAT_FIPS_E = -281, /* RSA Pairwise failure */ + KDF_TLS12_KAT_FIPS_E = -282, /* TLS12 KDF KAT failure */ + KDF_TLS13_KAT_FIPS_E = -283, /* TLS13 KDF KAT failure */ + KDF_SSH_KAT_FIPS_E = -284, /* SSH KDF KAT failure */ + DHE_PCT_E = -285, /* DHE Pairwise Consistency Test failure */ + ECC_PCT_E = -286, /* ECDHE Pairwise Consistency Test failure */ + FIPS_PRIVATE_KEY_LOCKED_E = -287, /* Cannot export private key. */ + PROTOCOLCB_UNAVAILABLE = -288, /* Protocol callback unavailable */ + AES_SIV_AUTH_E = -289, /* AES-SIV authentication failed */ + NO_VALID_DEVID = -290, /* no valid device ID */ + + IO_FAILED_E = -291, /* Input/output failure */ + SYSLIB_FAILED_E = -292, /* System/library call failed */ + USE_HW_PSK = -293, /* Callback return to indicate HW has PSK */ + + ENTROPY_RT_E = -294, /* Entropy Repetition Test failed */ + ENTROPY_APT_E = -295, /* Entropy Adaptive Proportion Test failed */ + + ASN_DEPTH_E = -296, /* Invalid ASN.1 - depth check */ + ASN_LEN_E = -297, /* ASN.1 length invalid */ + + SM4_GCM_AUTH_E = -298, /* SM4-GCM Authentication check failure */ + SM4_CCM_AUTH_E = -299, /* SM4-CCM Authentication check failure */ + + WC_SPAN1_LAST_E = -299, /* Last used code in span 1 */ + WC_SPAN1_MIN_CODE_E = -300, /* Last usable code in span 1 */ + + WC_SPAN2_FIRST_E = -1000, + + DEADLOCK_AVERTED_E = -1000, /* Deadlock averted -- retry the call */ + ASCON_AUTH_E = -1001, /* ASCON Authentication check failure */ + WC_ACCEL_INHIBIT_E = -1002, /* Crypto acceleration is currently inhibited */ + + WC_SPAN2_LAST_E = -1002, /* Update to indicate last used error code */ + WC_SPAN2_MIN_CODE_E = -1999, /* Last usable code in span 2 */ + + WC_LAST_E = -1002, /* the last code used either here or in + * error-ssl.h + */ + + MIN_CODE_E = -1999 /* the last code allocated either here or in + * error-ssl.h + */ + + /* add new companion error id strings for any new error codes + wolfcrypt/src/error.c !!! */ +}; + +wc_static_assert((int)WC_LAST_E <= (int)WC_SPAN2_LAST_E); +wc_static_assert((int)MIN_CODE_E <= (int)WC_LAST_E); +wc_static_assert((int)MIN_CODE_E <= (int)WC_SPAN2_MIN_CODE_E); + +#ifdef NO_ERROR_STRINGS + #define wc_GetErrorString(error) "no support for error strings built in" + #define wc_ErrorString(err, buf) \ + (void)(err); XSTRNCPY((buf), wc_GetErrorString(err), \ + WOLFSSL_MAX_ERROR_SZ); + +#else +WOLFSSL_API void wc_ErrorString(int err, char* buff); +WOLFSSL_ABI WOLFSSL_API const char* wc_GetErrorString(int error); +#endif + +#if defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES) && \ + (defined(BUILDING_WOLFSSL) || \ + defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES_ALWAYS)) + WOLFSSL_API extern void wc_backtrace_render(void); + #define WC_NO_ERR_TRACE(label) (CONST_NUM_ERR_ ## label) + #ifndef WOLFSSL_DEBUG_BACKTRACE_RENDER_CLAUSE + #ifdef WOLFSSL_DEBUG_BACKTRACE_ERROR_CODES + #define WOLFSSL_DEBUG_BACKTRACE_RENDER_CLAUSE wc_backtrace_render() + #else + #define WOLFSSL_DEBUG_BACKTRACE_RENDER_CLAUSE (void)0 + #endif + #endif + #ifndef WC_ERR_TRACE + #ifdef NO_STDIO_FILESYSTEM + #define WC_ERR_TRACE(label) \ + ( printf("ERR TRACE: %s L %d %s (%d)\n", \ + __FILE__, __LINE__, #label, label), \ + WOLFSSL_DEBUG_BACKTRACE_RENDER_CLAUSE, \ + label \ + ) + #else + #define WC_ERR_TRACE(label) \ + ( fprintf(stderr, \ + "ERR TRACE: %s L %d %s (%d)\n", \ + __FILE__, __LINE__, #label, label), \ + WOLFSSL_DEBUG_BACKTRACE_RENDER_CLAUSE, \ + label \ + ) + #endif + #endif + #include <wolfssl/debug-trace-error-codes.h> +#else + #define WC_NO_ERR_TRACE(label) (label) +#endif + +#ifdef __cplusplus + } /* extern "C" */ +#endif +#endif /* WOLF_CRYPT_ERROR_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/ext_lms.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/ext_lms.h @@ -0,0 +1,62 @@ +/* ext_lms.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifndef EXT_LMS_H +#define EXT_LMS_H + +#if defined(WOLFSSL_HAVE_LMS) && defined(HAVE_LIBLMS) + +#include <wolfssl/wolfcrypt/lms.h> + +/* hash-sigs LMS HSS includes */ +#include <hss.h> + +#if defined(WOLFSSL_WC_LMS) +#error "This code is incompatible with wolfCrypt's implementation of LMS." +#endif + +/* + * The hash-sigs LMS lib supports from MIN_HSS_LEVELS to MAX_HSS_LEVELS + * number of levels of Merkle trees. It allows for the tree height and + * winternitz parameter to be unique per level. + */ + +/* hss structs */ +typedef struct hss_working_key hss_working_key; +typedef struct hss_extra_info hss_extra_info; + +struct LmsKey { + unsigned levels; /* Number of tree levels. */ + param_set_t lm_type[MAX_HSS_LEVELS]; /* Height param per level. */ + param_set_t lm_ots_type[MAX_HSS_LEVELS]; /* Winternitz param per level. */ + unsigned char pub[HSS_MAX_PUBLIC_KEY_LEN]; +#ifndef WOLFSSL_LMS_VERIFY_ONLY + hss_working_key * working_key; + wc_lms_write_private_key_cb write_private_key; /* Callback to write/update key. */ + wc_lms_read_private_key_cb read_private_key; /* Callback to read key. */ + void * context; /* Context arg passed to callbacks. */ + hss_extra_info info; +#endif /* ifndef WOLFSSL_LMS_VERIFY_ONLY */ + enum wc_LmsState state; +}; + +#endif /* WOLFSSL_HAVE_LMS */ +#endif /* EXT_LMS_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/ext_mlkem.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/ext_mlkem.h @@ -0,0 +1,74 @@ +/* ext_mlkem.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifndef EXT_KYBER_H +#define EXT_KYBER_H + +#ifdef WOLF_CRYPTO_CB + #include <wolfssl/wolfcrypt/cryptocb.h> +#endif + +#ifdef WOLFSSL_HAVE_MLKEM +#include <wolfssl/wolfcrypt/mlkem.h> + +#if !defined(HAVE_LIBOQS) +#error "This code requires liboqs" +#endif + +#if defined(WOLFSSL_WC_MLKEM) +#error "This code is incompatible with wolfCrypt's implementation of Kyber." +#endif + +#if defined (HAVE_LIBOQS) + #include <oqs/kem.h> + + #ifndef WOLFSSL_NO_ML_KEM + #define EXT_KYBER_MAX_PRIV_SZ OQS_KEM_ml_kem_1024_length_secret_key + #define EXT_KYBER_MAX_PUB_SZ OQS_KEM_ml_kem_1024_length_public_key + #elif defined(WOLFSSL_MLKEM_KYBER) + #define EXT_KYBER_MAX_PRIV_SZ OQS_KEM_kyber_1024_length_secret_key + #define EXT_KYBER_MAX_PUB_SZ OQS_KEM_kyber_1024_length_public_key + #endif +#endif + +struct KyberKey { + /* Type of key: KYBER_LEVEL1 + * KYBER_LEVEL3 + * KYBER_LEVEL5 + * + * Note we don't save the variant (SHAKE vs AES) as that is decided at + * configuration time. */ + int type; + +#ifdef WOLF_CRYPTO_CB + void* devCtx; + int devId; +#endif + + byte priv[EXT_KYBER_MAX_PRIV_SZ]; + byte pub[EXT_KYBER_MAX_PUB_SZ]; +}; + +#if defined (HAVE_LIBOQS) +WOLFSSL_LOCAL int ext_mlkem_enabled(int id); +#endif +#endif /* WOLFSSL_HAVE_MLKEM */ +#endif /* EXT_KYBER_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/ext_xmss.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/ext_xmss.h @@ -0,0 +1,53 @@ +/* ext_xmss.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifndef EXT_XMSS_H +#define EXT_XMSS_H + +#if defined(WOLFSSL_HAVE_XMSS) && defined(HAVE_LIBXMSS) + +#include <wolfssl/wolfcrypt/xmss.h> + +#include <xmss.h> +#include <params.h> + +#if defined(WOLFSSL_WC_XMSS) + #error "This code is incompatible with wolfCrypt's implementation of XMSS." +#endif + +struct XmssKey { + unsigned char pk[XMSS_SHA256_PUBLEN]; + uint32_t oid; + int is_xmssmt; + xmss_params params; +#ifndef WOLFSSL_XMSS_VERIFY_ONLY + /* The secret key length is a function of xmss_params. */ + unsigned char * sk; + word32 sk_len; + wc_xmss_write_private_key_cb write_private_key; /* Callback to write/update key. */ + wc_xmss_read_private_key_cb read_private_key; /* Callback to read key. */ + void * context; /* Context arg passed to callbacks. */ +#endif /* ifndef WOLFSSL_XMSS_VERIFY_ONLY */ + enum wc_XmssState state; +}; + +#endif /* WOLFSSL_HAVE_XMSS */ +#endif /* EXT_XMSS_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/falcon.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/falcon.h @@ -0,0 +1,180 @@ +/* falcon.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/falcon.h +*/ + +/* Interfaces for Falcon NIST Level 1 (Falcon512) and Falcon NIST Level 5 + * (Falcon1024). */ + +#ifndef WOLF_CRYPT_FALCON_H +#define WOLF_CRYPT_FALCON_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef WOLF_CRYPTO_CB + #include <wolfssl/wolfcrypt/cryptocb.h> +#endif + +#if defined(HAVE_PQC) && defined(HAVE_FALCON) + +#ifdef HAVE_LIBOQS +#include <oqs/oqs.h> +#include <wolfssl/wolfcrypt/port/liboqs/liboqs.h> +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +/* Macros Definitions */ + +#ifdef HAVE_LIBOQS +#define FALCON_LEVEL1_KEY_SIZE OQS_SIG_falcon_512_length_secret_key +#define FALCON_LEVEL1_SIG_SIZE OQS_SIG_falcon_512_length_signature +#define FALCON_LEVEL1_PUB_KEY_SIZE OQS_SIG_falcon_512_length_public_key +#define FALCON_LEVEL1_PRV_KEY_SIZE (FALCON_LEVEL1_PUB_KEY_SIZE+FALCON_LEVEL1_KEY_SIZE) + +#define FALCON_LEVEL5_KEY_SIZE OQS_SIG_falcon_1024_length_secret_key +#define FALCON_LEVEL5_SIG_SIZE OQS_SIG_falcon_1024_length_signature +#define FALCON_LEVEL5_PUB_KEY_SIZE OQS_SIG_falcon_1024_length_public_key +#define FALCON_LEVEL5_PRV_KEY_SIZE (FALCON_LEVEL5_PUB_KEY_SIZE+FALCON_LEVEL5_KEY_SIZE) +#endif + +#define FALCON_MAX_KEY_SIZE FALCON_LEVEL5_KEY_SIZE +#define FALCON_MAX_SIG_SIZE FALCON_LEVEL5_SIG_SIZE +#define FALCON_MAX_PUB_KEY_SIZE FALCON_LEVEL5_PUB_KEY_SIZE +#define FALCON_MAX_PRV_KEY_SIZE FALCON_LEVEL5_PRV_KEY_SIZE + +#ifdef WOLF_PRIVATE_KEY_ID +#define FALCON_MAX_ID_LEN 32 +#define FALCON_MAX_LABEL_LEN 32 +#endif + + +/* Structs */ + +struct falcon_key { + bool pubKeySet; + bool prvKeySet; + byte level; + +#ifdef WOLF_CRYPTO_CB + void* devCtx; + int devId; +#endif +#ifdef WOLF_PRIVATE_KEY_ID + byte id[FALCON_MAX_ID_LEN]; + int idLen; + char label[FALCON_MAX_LABEL_LEN]; + int labelLen; +#endif + + byte p[FALCON_MAX_PUB_KEY_SIZE]; + byte k[FALCON_MAX_PRV_KEY_SIZE]; +}; + +#ifndef WC_FALCONKEY_TYPE_DEFINED + typedef struct falcon_key falcon_key; + #define WC_FALCONKEY_TYPE_DEFINED +#endif + +/* Functions */ + +WOLFSSL_API +int wc_falcon_sign_msg(const byte* in, word32 inLen, byte* out, word32 *outLen, + falcon_key* key, WC_RNG* rng); +WOLFSSL_API +int wc_falcon_verify_msg(const byte* sig, word32 sigLen, const byte* msg, + word32 msgLen, int* res, falcon_key* key); + +WOLFSSL_API +int wc_falcon_init(falcon_key* key); + +WOLFSSL_API +int wc_falcon_init_ex(falcon_key* key, void* heap, int devId); + +#ifdef WOLF_PRIVATE_KEY_ID +WOLFSSL_API +int wc_falcon_init_id(falcon_key* key, const unsigned char* id, int len, + void* heap, int devId); +WOLFSSL_API +int wc_falcon_init_label(falcon_key* key, const char* label, void* heap, + int devId); +#endif + +WOLFSSL_API +int wc_falcon_set_level(falcon_key* key, byte level); +WOLFSSL_API +int wc_falcon_get_level(falcon_key* key, byte* level); +WOLFSSL_API +void wc_falcon_free(falcon_key* key); + +WOLFSSL_API +int wc_falcon_import_public(const byte* in, word32 inLen, falcon_key* key); +WOLFSSL_API +int wc_falcon_import_private_only(const byte* priv, word32 privSz, + falcon_key* key); +WOLFSSL_API +int wc_falcon_import_private_key(const byte* priv, word32 privSz, + const byte* pub, word32 pubSz, + falcon_key* key); + +WOLFSSL_API +int wc_falcon_export_public(falcon_key* key, byte* out, word32* outLen); +WOLFSSL_API +int wc_falcon_export_private_only(falcon_key* key, byte* out, word32* outLen); +WOLFSSL_API +int wc_falcon_export_private(falcon_key* key, byte* out, word32* outLen); +WOLFSSL_API +int wc_falcon_export_key(falcon_key* key, byte* priv, word32 *privSz, + byte* pub, word32 *pubSz); + +WOLFSSL_API +int wc_falcon_check_key(falcon_key* key); + +WOLFSSL_API +int wc_falcon_size(falcon_key* key); +WOLFSSL_API +int wc_falcon_priv_size(falcon_key* key); +WOLFSSL_API +int wc_falcon_pub_size(falcon_key* key); +WOLFSSL_API +int wc_falcon_sig_size(falcon_key* key); + +WOLFSSL_API int wc_Falcon_PrivateKeyDecode(const byte* input, word32* inOutIdx, + falcon_key* key, word32 inSz); +WOLFSSL_API int wc_Falcon_PublicKeyDecode(const byte* input, word32* inOutIdx, + falcon_key* key, word32 inSz); +WOLFSSL_API int wc_Falcon_KeyToDer(falcon_key* key, byte* output, + word32 inLen); +WOLFSSL_API int wc_Falcon_PrivateKeyToDer(falcon_key* key, byte* output, + word32 inLen); +WOLFSSL_API int wc_Falcon_PublicKeyToDer(falcon_key* key, byte* output, + word32 inLen, int withAlg); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* HAVE_PQC && HAVE_FALCON */ +#endif /* WOLF_CRYPT_FALCON_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/fe_448.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/fe_448.h @@ -0,0 +1,122 @@ +/* fe448_448.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + +#ifndef WOLF_CRYPT_FE_448_H +#define WOLF_CRYPT_FE_448_H + +#include <wolfssl/wolfcrypt/settings.h> + +#if defined(HAVE_CURVE448) || defined(HAVE_ED448) + +#include <wolfssl/wolfcrypt/types.h> + +#if defined(HAVE___UINT128_T) && !defined(NO_CURVED448_128BIT) && \ + !defined(NO_INT128) + #define CURVED448_128BIT +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +/* default to be faster but take more memory */ +#if !defined(CURVE448_SMALL) && !defined(ED448_SMALL) + +#if defined(CURVED448_128BIT) + typedef sword64 fe448; + #ifndef WOLFSSL_UINT128_T_DEFINED + #ifdef __SIZEOF_INT128__ + typedef __uint128_t uint128_t; + typedef __int128_t int128_t; + typedef __uint128_t word128; + typedef __int128_t sword128; + #else + typedef unsigned long uint128_t __attribute__ ((mode(TI))); + typedef long int128_t __attribute__ ((mode(TI))); + typedef uint128_t word128; + typedef int128_t sword128; + #endif + #define WOLFSSL_UINT128_T_DEFINED + #endif +#else + typedef sword32 fe448; +#endif + +WOLFSSL_LOCAL void fe448_init(void); +WOLFSSL_LOCAL int curve448(byte* r, const byte* n, const byte* a); + +#if !defined(CURVED448_128BIT) +WOLFSSL_LOCAL void fe448_reduce(fe448*); +#else +#define fe448_reduce(a) WC_DO_NOTHING +#endif +WOLFSSL_LOCAL void fe448_neg(fe448* r, const fe448* a); +WOLFSSL_LOCAL void fe448_add(fe448* r, const fe448* a, const fe448* b); +WOLFSSL_LOCAL void fe448_sub(fe448* r, const fe448* a, const fe448* b); +WOLFSSL_LOCAL void fe448_mul(fe448* r, const fe448* a, const fe448* b); +WOLFSSL_LOCAL void fe448_sqr(fe448* r, const fe448* a); +WOLFSSL_LOCAL void fe448_mul39081(fe448* r, const fe448* a); +WOLFSSL_LOCAL void fe448_invert(fe448* r, const fe448* a); + +WOLFSSL_LOCAL void fe448_0(fe448* a); +WOLFSSL_LOCAL void fe448_1(fe448* a); +WOLFSSL_LOCAL void fe448_copy(fe448* d, const fe448* a); +WOLFSSL_LOCAL int fe448_isnonzero(const fe448* a); +WOLFSSL_LOCAL int fe448_isnegative(const fe448* a); + +WOLFSSL_LOCAL void fe448_from_bytes(fe448* r, const unsigned char* b); +WOLFSSL_LOCAL void fe448_to_bytes(unsigned char* b, const fe448* a); + +WOLFSSL_LOCAL void fe448_cmov(fe448* a, const fe448* b, int c); +WOLFSSL_LOCAL void fe448_pow_2_446_222_1(fe448* r, const fe448* a); + +#else + +WOLFSSL_LOCAL void fe448_init(void); +WOLFSSL_LOCAL int curve448(byte* r, const byte* n, const byte* a); + +#define fe448_reduce(a) WC_DO_NOTHING + +WOLFSSL_LOCAL void fe448_neg(word8* r, const word8* a); +WOLFSSL_LOCAL void fe448_add(word8* r, const word8* a, const word8* b); +WOLFSSL_LOCAL void fe448_sub(word8* r, const word8* a, const word8* b); +WOLFSSL_LOCAL void fe448_mul(word8* r, const word8* a, const word8* b); +WOLFSSL_LOCAL void fe448_sqr(word8* r, const word8* a); +WOLFSSL_LOCAL void fe448_mul39081(word8* r, const word8* a); +WOLFSSL_LOCAL void fe448_invert(word8* r, const word8* a); + +WOLFSSL_LOCAL void fe448_norm(byte *a); +WOLFSSL_LOCAL void fe448_copy(word8* d, const word8* a); +WOLFSSL_LOCAL int fe448_isnonzero(const word8* a); + +WOLFSSL_LOCAL void fe448_cmov(word8* a, const word8* b, int c); +WOLFSSL_LOCAL void fe448_pow_2_446_222_1(word8* r, const word8* a); + +#endif /* !CURVE448_SMALL || !ED448_SMALL */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* HAVE_CURVE448 || HAVE_ED448 */ + +#endif /* WOLF_CRYPT_FE_448_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/fe_operations.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/fe_operations.h @@ -0,0 +1,188 @@ +/* fe_operations.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + +#ifndef WOLF_CRYPT_FE_OPERATIONS_H +#define WOLF_CRYPT_FE_OPERATIONS_H + +#include <wolfssl/wolfcrypt/settings.h> + +#if defined(HAVE_CURVE25519) || defined(HAVE_ED25519) + +#include <wolfssl/wolfcrypt/types.h> + +#if defined(USE_INTEL_SPEEDUP) && !defined(NO_CURVED25519_X64) + #define CURVED25519_X64 +#elif defined(HAVE___UINT128_T) && !defined(NO_CURVED25519_128BIT) + #define CURVED25519_128BIT +#endif + +#if defined(CURVED25519_X64) + #define CURVED25519_ASM_64BIT + #define CURVED25519_ASM +#endif +#if defined(WOLFSSL_ARMASM) + #ifdef __aarch64__ + #define CURVED25519_ASM_64BIT + #else + #define CURVED25519_ASM_32BIT + #endif + #define CURVED25519_ASM +#endif + +/* +fe means field element. +Here the field is \Z/(2^255-19). +An element t, entries t[0]...t[9], represents the integer +t[0]+2^26 t[1]+2^51 t[2]+2^77 t[3]+2^102 t[4]+...+2^230 t[9]. +Bounds on each t[i] vary depending on context. +*/ + +#ifdef __cplusplus + extern "C" { +#endif + +#if defined(CURVE25519_SMALL) || defined(ED25519_SMALL) + #define F25519_SIZE 32 + + WOLFSSL_LOCAL void lm_copy(byte*, const byte*); + WOLFSSL_LOCAL void lm_add(byte*, const byte*, const byte*); + WOLFSSL_LOCAL void lm_sub(byte*, const byte*, const byte*); + WOLFSSL_LOCAL void lm_neg(byte*,const byte*); + WOLFSSL_LOCAL void lm_invert(byte*, const byte*); + WOLFSSL_LOCAL void lm_mul(byte*,const byte*,const byte*); +#endif + + +#if !defined(FREESCALE_LTC_ECC) +WOLFSSL_LOCAL void fe_init(void); + +WOLFSSL_LOCAL int curve25519(byte * q, const byte * n, const byte * p); +#ifdef WOLFSSL_CURVE25519_BLINDING +WOLFSSL_LOCAL int curve25519_blind(byte * q, const byte * n, const byte* mask, + const byte * p, const byte* rz); +#endif +#endif + +/* default to be faster but take more memory */ +#if !defined(CURVE25519_SMALL) || !defined(ED25519_SMALL) + +#ifdef CURVED25519_ASM_64BIT + typedef sword64 fe[4]; +#elif defined(CURVED25519_ASM_32BIT) + typedef sword32 fe[8]; +#elif defined(CURVED25519_128BIT) + typedef sword64 fe[5]; +#else + typedef sword32 fe[10]; +#endif + +WOLFSSL_LOCAL void fe_copy(fe h,const fe f); +WOLFSSL_LOCAL void fe_add(fe h,const fe f,const fe g); +WOLFSSL_LOCAL void fe_neg(fe h,const fe f); +WOLFSSL_LOCAL void fe_sub(fe h,const fe f,const fe g); +WOLFSSL_LOCAL void fe_invert(fe out,const fe z); +WOLFSSL_LOCAL void fe_mul(fe h,const fe f,const fe g); + + +/* Based On Daniel J Bernstein's curve25519 and ed25519 Public Domain ref10 + work. */ + +WOLFSSL_LOCAL void fe_0(fe h); +WOLFSSL_LOCAL void fe_1(fe h); +WOLFSSL_LOCAL int fe_isnonzero(const fe f); +WOLFSSL_LOCAL int fe_isnegative(const fe f); +WOLFSSL_LOCAL void fe_tobytes(unsigned char *s,const fe h); +WOLFSSL_LOCAL void fe_sq(fe h,const fe f); +WOLFSSL_LOCAL void fe_sq2(fe h,const fe f); +WOLFSSL_LOCAL void fe_frombytes(fe h,const unsigned char *s); +WOLFSSL_LOCAL void fe_cswap(fe f, fe g, int b); +WOLFSSL_LOCAL void fe_mul121666(fe h,fe f); +WOLFSSL_LOCAL void fe_cmov(fe f, const fe g, int b); +WOLFSSL_LOCAL void fe_pow22523(fe out,const fe z); + +/* 64 type needed for SHA512 */ +WOLFSSL_LOCAL sword64 load_3(const unsigned char *in); +WOLFSSL_LOCAL sword64 load_4(const unsigned char *in); + +#ifdef CURVED25519_ASM +WOLFSSL_LOCAL void fe_cmov_table(fe* r, fe* base, signed char b); +#endif /* CURVED25519_ASM */ +#endif /* !CURVE25519_SMALL || !ED25519_SMALL */ + +/* Use less memory and only 32bit types or less, but is slower + Based on Daniel Beer's public domain work. */ +#if defined(CURVE25519_SMALL) || defined(ED25519_SMALL) +static const byte c25519_base_x[F25519_SIZE] = {9}; +static const byte f25519_zero[F25519_SIZE] = {0}; +static const byte f25519_one[F25519_SIZE] = {1}; +static const byte fprime_zero[F25519_SIZE] = {0}; +static const byte fprime_one[F25519_SIZE] = {1}; + +WOLFSSL_LOCAL void fe_load(byte *x, word32 c); +WOLFSSL_LOCAL void fe_normalize(byte *x); +WOLFSSL_LOCAL void fe_inv__distinct(byte *r, const byte *x); + +/* Conditional copy. If condition == 0, then zero is copied to dst. If + * condition == 1, then one is copied to dst. Any other value results in + * undefined behavior. + */ +WOLFSSL_LOCAL void fe_select(byte *dst, const byte *zero, const byte *one, + byte condition); + +/* Multiply a point by a small constant. The two pointers are not + * required to be distinct. + * + * The constant must be less than 2^24. + */ +WOLFSSL_LOCAL void fe_mul_c(byte *r, const byte *a, word32 b); +WOLFSSL_LOCAL void fe_mul__distinct(byte *r, const byte *a, const byte *b); + +/* Compute one of the square roots of the field element, if the element + * is square. The other square is -r. + * + * If the input is not square, the returned value is a valid field + * element, but not the correct answer. If you don't already know that + * your element is square, you should square the return value and test. + */ +WOLFSSL_LOCAL void fe_sqrt(byte *r, const byte *x); + +/* Conditional copy. If condition == 0, then zero is copied to dst. If + * condition == 1, then one is copied to dst. Any other value results in + * undefined behavior. + */ +WOLFSSL_LOCAL void fprime_select(byte *dst, const byte *zero, const byte *one, + byte condition); +WOLFSSL_LOCAL void fprime_add(byte *r, const byte *a, const byte *modulus); +WOLFSSL_LOCAL void fprime_sub(byte *r, const byte *a, const byte *modulus); +WOLFSSL_LOCAL void fprime_mul(byte *r, const byte *a, const byte *b, + const byte *modulus); +WOLFSSL_LOCAL void fprime_copy(byte *x, const byte *a); + +#endif /* CURVE25519_SMALL || ED25519_SMALL */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* HAVE_CURVE25519 || HAVE_ED25519 */ + +#endif /* WOLF_CRYPT_FE_OPERATIONS_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/fips_test.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/fips_test.h @@ -0,0 +1,131 @@ +/* fips_test.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + +#ifndef WOLF_CRYPT_FIPS_TEST_H +#define WOLF_CRYPT_FIPS_TEST_H + +#include <wolfssl/wolfcrypt/types.h> + + +#ifdef __cplusplus + extern "C" { +#endif + +/* Added for FIPS v5.3 or later */ +#if defined(FIPS_VERSION_GE) && FIPS_VERSION_GE(5,3) + /* Determine FIPS in core hash type and size */ + #ifndef NO_SHA256 + #define FIPS_IN_CORE_DIGEST_SIZE 32 + #define FIPS_IN_CORE_HASH_TYPE WC_SHA256 + #define FIPS_IN_CORE_KEY_SZ 32 + #define FIPS_IN_CORE_VERIFY_SZ FIPS_IN_CORE_KEY_SZ + #elif defined(WOLFSSL_SHA384) + #define FIPS_IN_CORE_DIGEST_SIZE 48 + #define FIPS_IN_CORE_HASH_TYPE WC_SHA384 + #define FIPS_IN_CORE_KEY_SZ 48 + #define FIPS_IN_CORE_VERIFY_SZ FIPS_IN_CORE_KEY_SZ + #else + #error No FIPS hash (SHA2-256 or SHA2-384) + #endif +#endif /* FIPS v5.3 or later */ + + +enum FipsCastId { + /* v5.2.0 & v5.2.1 + */ + FIPS_CAST_AES_CBC = 0, + FIPS_CAST_AES_GCM = 1, + FIPS_CAST_HMAC_SHA1 = 2, + FIPS_CAST_HMAC_SHA2_256 = 3, + FIPS_CAST_HMAC_SHA2_512 = 4, + FIPS_CAST_HMAC_SHA3_256 = 5, + FIPS_CAST_DRBG = 6, + FIPS_CAST_RSA_SIGN_PKCS1v15 = 7, + FIPS_CAST_ECC_CDH = 8, + FIPS_CAST_ECC_PRIMITIVE_Z = 9, + FIPS_CAST_DH_PRIMITIVE_Z = 10, + FIPS_CAST_ECDSA = 11, + FIPS_CAST_KDF_TLS12 = 12, + FIPS_CAST_KDF_TLS13 = 13, + FIPS_CAST_KDF_SSH = 14, + /* v6.0.0 + */ + FIPS_CAST_KDF_SRTP = 15, + FIPS_CAST_ED25519 = 16, + FIPS_CAST_ED448 = 17, + FIPS_CAST_PBKDF2 = 18, + /* v7.0.0 + */ + FIPS_CAST_AES_ECB = 19, + FIPS_CAST_COUNT = 20 +}; + +enum FipsCastStateId { + FIPS_CAST_STATE_INIT = 0, + FIPS_CAST_STATE_PROCESSING = 1, + FIPS_CAST_STATE_SUCCESS = 2, + FIPS_CAST_STATE_FAILURE = 3 +}; + +enum FipsModeId { + FIPS_MODE_INIT = 0, + FIPS_MODE_NORMAL = 1, + FIPS_MODE_DEGRADED = 2, + FIPS_MODE_FAILED = 3 +}; + +/* FIPS failure callback */ +typedef void(*wolfCrypt_fips_cb)(int ok, int err, const char* hash); + +/* Public set function */ +WOLFSSL_API int wolfCrypt_SetCb_fips(wolfCrypt_fips_cb cbf); + +/* Public get status functions */ +WOLFSSL_API int wolfCrypt_GetStatus_fips(void); +WOLFSSL_API int wolfCrypt_GetMode_fips(void); +WOLFSSL_API const char* wolfCrypt_GetCoreHash_fips(void); +WOLFSSL_API const char* wolfCrypt_GetRawComputedHash_fips(void); + +#ifdef HAVE_FORCE_FIPS_FAILURE + /* Public function to force failure mode for operational testing */ + WOLFSSL_API int wolfCrypt_SetStatus_fips(int status); +#endif + +WOLFSSL_LOCAL int DoPOST(char* base16_hash, int base16_hashSz); +WOLFSSL_LOCAL int DoCAST(int type); +WOLFSSL_LOCAL int DoKnownAnswerTests(char* base16_hash, int base16_hashSz); /* FIPSv1 and FIPSv2 */ + +WOLFSSL_API int wc_RunCast_fips(int type); +WOLFSSL_API int wc_GetCastStatus_fips(int type); +WOLFSSL_API int wc_RunAllCast_fips(void); + +#ifdef NO_ATTRIBUTE_CONSTRUCTOR + /* NOTE: Must be called in OS initialization section outside user control + * and must prove during operational testing/code review with the lab that + * this is outside user-control if called by the OS */ + void fipsEntry(void); +#endif + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLF_CRYPT_FIPS_TEST_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/ge_448.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/ge_448.h @@ -0,0 +1,84 @@ +/* ge_448.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + +#ifndef WOLF_CRYPT_GE_448_H +#define WOLF_CRYPT_GE_448_H + +#include <wolfssl/wolfcrypt/settings.h> + +#ifdef HAVE_ED448 + +#include <wolfssl/wolfcrypt/fe_448.h> + +/* +ge448 means group element. + +Here the group is the set of pairs (x,y) of field elements (see fe.h) +satisfying -x^2 + y^2 = 1 + d x^2y^2 +where d = -39081. + +Representations: + ge448_p2 (projective) : (X:Y:Z) satisfying x=X/Z, y=Y/Z + ge448_precomp (affine): (x,y) +*/ + +#ifdef ED448_SMALL + typedef byte ge448; + #define GE448_WORDS 56 +#elif defined(CURVED448_128BIT) + typedef sword64 ge448; + #define GE448_WORDS 8 +#else + typedef sword32 ge448; + #define GE448_WORDS 16 +#endif + +typedef struct { + ge448 X[GE448_WORDS]; + ge448 Y[GE448_WORDS]; + ge448 Z[GE448_WORDS]; +} ge448_p2; + + +WOLFSSL_LOCAL int ge448_compress_key(byte* out, const byte* xIn, const byte* yIn); +WOLFSSL_LOCAL int ge448_from_bytes_negate_vartime(ge448_p2 *r, const byte *b); + +WOLFSSL_LOCAL int ge448_double_scalarmult_vartime(ge448_p2 *r, const byte *a, + const ge448_p2 *A, const byte *b); +WOLFSSL_LOCAL int ge448_scalarmult_base(ge448_p2* h, const byte* a); +/* Only performs a weak reduce. */ +WOLFSSL_LOCAL void sc448_reduce(byte* b); +WOLFSSL_LOCAL void sc448_muladd(byte* r, const byte* a, const byte* b, const byte* d); +WOLFSSL_LOCAL void ge448_to_bytes(byte *s, const ge448_p2 *h); + + +#ifndef ED448_SMALL +typedef struct { + ge448 x[GE448_WORDS]; + ge448 y[GE448_WORDS]; +} ge448_precomp; + +#endif /* !ED448_SMALL */ + +#endif /* HAVE_ED448 */ + +#endif /* WOLF_CRYPT_GE_448_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/ge_operations.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/ge_operations.h @@ -0,0 +1,134 @@ +/* ge_operations.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + /* Based On Daniel J Bernstein's ed25519 Public Domain ref10 work. */ + +#ifndef WOLF_CRYPT_GE_OPERATIONS_H +#define WOLF_CRYPT_GE_OPERATIONS_H + +#include <wolfssl/wolfcrypt/settings.h> + +#ifdef HAVE_ED25519 + +#include <wolfssl/wolfcrypt/fe_operations.h> + +/* +ge means group element. + +Here the group is the set of pairs (x,y) of field elements (see fe.h) +satisfying -x^2 + y^2 = 1 + d x^2y^2 +where d = -121665/121666. + +Representations: + ge_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z + ge_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT + ge_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T + ge_precomp (Duif): (y+x,y-x,2dxy) +*/ + +#ifdef ED25519_SMALL + ALIGN16 typedef byte ge[F25519_SIZE]; +#elif defined(CURVED25519_ASM_64BIT) + ALIGN16 typedef sword64 ge[4]; +#elif defined(CURVED25519_ASM_32BIT) + ALIGN16 typedef sword32 ge[8]; +#elif defined(CURVED25519_128BIT) + ALIGN16 typedef sword64 ge[5]; +#else + ALIGN16 typedef sword32 ge[10]; +#endif + +typedef struct { + ge X; + ge Y; + ge Z; +} ge_p2; + +typedef struct { + ge X; + ge Y; + ge Z; + ge T; +} ge_p3; + +#ifdef __cplusplus + extern "C" { +#endif + +WOLFSSL_LOCAL int ge_compress_key(byte* out, const byte* xIn, const byte* yIn, + word32 keySz); +WOLFSSL_LOCAL int ge_frombytes_negate_vartime(ge_p3 *h,const unsigned char *s); + +WOLFSSL_LOCAL int ge_double_scalarmult_vartime(ge_p2 *r, const unsigned char *a, + const ge_p3 *A, const unsigned char *b); +WOLFSSL_LOCAL void ge_scalarmult_base(ge_p3 *h,const unsigned char *a); +WOLFSSL_LOCAL void sc_reduce(byte* s); +WOLFSSL_LOCAL void sc_muladd(byte* s, const byte* a, const byte* b, + const byte* c); +WOLFSSL_LOCAL void ge_tobytes(unsigned char *s,const ge_p2 *h); +#ifndef GE_P3_TOBYTES_IMPL +#define ge_p3_tobytes(s, h) ge_tobytes((s), (const ge_p2 *)(h)) +#else +WOLFSSL_LOCAL void ge_p3_tobytes(unsigned char *s,const ge_p3 *h); +#endif + + +#ifndef ED25519_SMALL +typedef struct { + ge X; + ge Y; + ge Z; + ge T; +} ge_p1p1; + +typedef struct { + ge yplusx; + ge yminusx; + ge xy2d; +} ge_precomp; + +typedef struct { + ge YplusX; + ge YminusX; + ge Z; + ge T2d; +} ge_cached; + +#ifdef CURVED25519_ASM +void ge_p1p1_to_p2(ge_p2 *r, const ge_p1p1 *p); +void ge_p1p1_to_p3(ge_p3 *r, const ge_p1p1 *p); +void ge_p2_dbl(ge_p1p1 *r, const ge_p2 *p); +#define ge_p3_dbl(r, p) ge_p2_dbl((ge_p1p1 *)(r), (ge_p2 *)(p)) +void ge_madd(ge_p1p1 *r, const ge_p3 *p, const ge_precomp *q); +void ge_msub(ge_p1p1 *r, const ge_p3 *p, const ge_precomp *q); +void ge_add(ge_p1p1 *r, const ge_p3 *p, const ge_cached *q); +void ge_sub(ge_p1p1 *r, const ge_p3 *p, const ge_cached *q); +#endif +#endif /* !ED25519_SMALL */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* HAVE_ED25519 */ + +#endif /* WOLF_CRYPT_GE_OPERATIONS_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/hash.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/hash.h @@ -0,0 +1,293 @@ +/* hash.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/hash.h +*/ + +#ifndef WOLF_CRYPT_HASH_H +#define WOLF_CRYPT_HASH_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifndef NO_MD5 + #include <wolfssl/wolfcrypt/md5.h> +#endif +#ifndef NO_SHA + #include <wolfssl/wolfcrypt/sha.h> +#endif +#if defined(WOLFSSL_SHA224) || !defined(NO_SHA256) + #include <wolfssl/wolfcrypt/sha256.h> +#endif +#if defined(WOLFSSL_SHA384) || defined(WOLFSSL_SHA512) + #include <wolfssl/wolfcrypt/sha512.h> +#endif +#if defined(HAVE_BLAKE2) || defined(HAVE_BLAKE2S) + #include <wolfssl/wolfcrypt/blake2.h> +#endif +#ifdef WOLFSSL_SHA3 + #include <wolfssl/wolfcrypt/sha3.h> +#endif +#ifndef NO_MD4 + #include <wolfssl/wolfcrypt/md4.h> +#endif +#ifdef WOLFSSL_MD2 + #include <wolfssl/wolfcrypt/md2.h> +#endif +#ifdef WOLFSSL_SM3 + #include <wolfssl/wolfcrypt/sm3.h> +#endif + + +#ifdef __cplusplus + extern "C" { +#endif + +#if !defined(HAVE_FIPS) && !defined(NO_OLD_WC_NAMES) + #define MAX_DIGEST_SIZE WC_MAX_DIGEST_SIZE +#endif + + +/* Supported Message Authentication Codes from page 43 */ +enum wc_MACAlgorithm { + no_mac, + md5_mac, + sha_mac, + sha224_mac, + sha256_mac, /* needs to match external KDF_MacAlgorithm */ + sha384_mac, + sha512_mac, + rmd_mac, + blake2b_mac, + sm3_mac +}; + +/* hash union */ +typedef union { +#ifndef NO_MD5 + wc_Md5 md5; +#endif +#ifndef NO_SHA + wc_Sha sha; +#endif +#ifdef WOLFSSL_SHA224 + wc_Sha224 sha224; +#endif +#ifndef NO_SHA256 + wc_Sha256 sha256; +#endif +#ifdef WOLFSSL_SHA384 + wc_Sha384 sha384; +#endif +#ifdef WOLFSSL_SHA512 + wc_Sha512 sha512; +#endif +#ifdef WOLFSSL_SHA3 + wc_Sha3 sha3; +#endif +#ifdef WOLFSSL_SM3 + wc_Sm3 sm3; +#endif + WOLF_AGG_DUMMY_MEMBER; +} wc_Hashes; + +#ifndef NO_HASH_WRAPPER +typedef struct { + wc_Hashes alg; + enum wc_HashType type; /* sanity check */ +#ifndef WC_NO_CONSTRUCTORS + void *heap; +#endif +} wc_HashAlg; +#endif /* !NO_HASH_WRAPPER */ + + +/* Find largest possible digest size + Note if this gets up to the size of 80 or over check smallstack build */ +#undef WC_MAX_DIGEST_SIZE +#undef WC_MAX_BLOCK_SIZE +#if defined(WOLFSSL_SHA3) + /* note: SHA3-224 has the largest block size */ + #define WC_MAX_DIGEST_SIZE WC_SHA3_512_DIGEST_SIZE + #define WC_MAX_BLOCK_SIZE WC_SHA3_224_BLOCK_SIZE +#elif defined(WOLFSSL_SHA512) + #define WC_MAX_DIGEST_SIZE WC_SHA512_DIGEST_SIZE + #define WC_MAX_BLOCK_SIZE WC_SHA512_BLOCK_SIZE +#elif defined(HAVE_BLAKE2) + #define WC_MAX_DIGEST_SIZE BLAKE2B_OUTBYTES + #define WC_MAX_BLOCK_SIZE BLAKE2B_BLOCKBYTES +#elif defined(WOLFSSL_SHA384) + #define WC_MAX_DIGEST_SIZE WC_SHA384_DIGEST_SIZE + #define WC_MAX_BLOCK_SIZE WC_SHA384_BLOCK_SIZE +#elif !defined(NO_SHA256) + #define WC_MAX_DIGEST_SIZE WC_SHA256_DIGEST_SIZE + #define WC_MAX_BLOCK_SIZE WC_SHA256_BLOCK_SIZE +#elif defined(WOLFSSL_SM3) + #define WC_MAX_DIGEST_SIZE WC_SM3_DIGEST_SIZE + #define WC_MAX_BLOCK_SIZE WC_SM3_BLOCK_SIZE +#elif defined(WOLFSSL_SHA224) + #define WC_MAX_DIGEST_SIZE WC_SHA224_DIGEST_SIZE + #define WC_MAX_BLOCK_SIZE WC_SHA224_BLOCK_SIZE +#elif !defined(NO_SHA) + #define WC_MAX_DIGEST_SIZE WC_SHA_DIGEST_SIZE + #define WC_MAX_BLOCK_SIZE WC_SHA_BLOCK_SIZE +#elif !defined(NO_MD5) + #define WC_MAX_DIGEST_SIZE WC_MD5_DIGEST_SIZE + #define WC_MAX_BLOCK_SIZE WC_MD5_BLOCK_SIZE +#else + #define WC_MAX_DIGEST_SIZE 64 /* default to max size of 64 */ + #define WC_MAX_BLOCK_SIZE 128 +#endif + +#if !defined(NO_ASN) || !defined(NO_DH) || defined(HAVE_ECC) +WOLFSSL_API int wc_HashGetOID(enum wc_HashType hash_type); +WOLFSSL_API enum wc_HashType wc_OidGetHash(int oid); +#endif + +WOLFSSL_API enum wc_HashType wc_HashTypeConvert(int hashType); + +#ifndef NO_HASH_WRAPPER + +WOLFSSL_API int wc_HashGetDigestSize(enum wc_HashType hash_type); +WOLFSSL_API int wc_HashGetBlockSize(enum wc_HashType hash_type); +WOLFSSL_API int wc_Hash(enum wc_HashType hash_type, + const byte* data, word32 data_len, + byte* hash, word32 hash_len); +WOLFSSL_API int wc_Hash_ex(enum wc_HashType hash_type, + const byte* data, word32 data_len, + byte* hash, word32 hash_len, void* heap, int devId); + +/* generic hash operation wrappers */ +WOLFSSL_API int wc_HashInit_ex(wc_HashAlg* hash, enum wc_HashType type, + void* heap, int devId); +WOLFSSL_API int wc_HashInit(wc_HashAlg* hash, enum wc_HashType type); +WOLFSSL_API int wc_HashUpdate(wc_HashAlg* hash, enum wc_HashType type, + const byte* data, word32 dataSz); +WOLFSSL_API int wc_HashFinal(wc_HashAlg* hash, enum wc_HashType type, + byte* out); +WOLFSSL_API int wc_HashFree(wc_HashAlg* hash, enum wc_HashType type); +#ifndef WC_NO_CONSTRUCTORS +WOLFSSL_API wc_HashAlg* wc_HashNew(enum wc_HashType type, void* heap, + int devId, int *result_code); +WOLFSSL_API int wc_HashDelete(wc_HashAlg *hash, wc_HashAlg **hash_p); +#endif + +#ifdef WOLFSSL_HASH_FLAGS + WOLFSSL_API int wc_HashSetFlags(wc_HashAlg* hash, enum wc_HashType type, + word32 flags); + WOLFSSL_API int wc_HashGetFlags(wc_HashAlg* hash, enum wc_HashType type, + word32* flags); +#endif + +#ifndef NO_MD5 +#include <wolfssl/wolfcrypt/md5.h> +WOLFSSL_API int wc_Md5Hash(const byte* data, word32 len, byte* hash); +WOLFSSL_API int wc_Md5Hash_ex(const byte* data, word32 len, byte* hash, + void* heap, int devId); +#endif + +#ifndef NO_SHA +#include <wolfssl/wolfcrypt/sha.h> +WOLFSSL_API int wc_ShaHash(const byte* data, word32 len, byte* hash); +WOLFSSL_API int wc_ShaHash_ex(const byte* data, word32 len, byte* hash, + void* heap, int devId); +#endif + +#ifdef WOLFSSL_SHA224 +#include <wolfssl/wolfcrypt/sha256.h> +WOLFSSL_API int wc_Sha224Hash(const byte* data, word32 len, byte* hash); +WOLFSSL_API int wc_Sha224Hash_ex(const byte* data, word32 len, byte* hash, + void* heap, int devId); +#endif /* defined(WOLFSSL_SHA224) */ + +#ifndef NO_SHA256 +#include <wolfssl/wolfcrypt/sha256.h> +WOLFSSL_API int wc_Sha256Hash(const byte* data, word32 len, byte* hash); +WOLFSSL_API int wc_Sha256Hash_ex(const byte* data, word32 len, byte* hash, + void* heap, int devId); +#endif + +#ifdef WOLFSSL_SHA384 +#include <wolfssl/wolfcrypt/sha512.h> +WOLFSSL_API int wc_Sha384Hash(const byte* data, word32 len, byte* hash); +WOLFSSL_API int wc_Sha384Hash_ex(const byte* data, word32 len, byte* hash, + void* heap, int devId); +#endif /* defined(WOLFSSL_SHA384) */ + +#ifdef WOLFSSL_SHA512 +#include <wolfssl/wolfcrypt/sha512.h> +WOLFSSL_API int wc_Sha512Hash(const byte* data, word32 len, byte* hash); +WOLFSSL_API int wc_Sha512_224Hash(const byte* data, word32 len, byte* hash); +WOLFSSL_API int wc_Sha512_256Hash(const byte* data, word32 len, byte* hash); +WOLFSSL_API int wc_Sha512Hash_ex(const byte* data, word32 len, byte* hash, + void* heap, int devId); +WOLFSSL_API int wc_Sha512_224Hash_ex(const byte* data, word32 len, byte* hash, + void* heap, int devId); +WOLFSSL_API int wc_Sha512_256Hash_ex(const byte* data, word32 len, byte* hash, + void* heap, int devId); +#endif /* WOLFSSL_SHA512 */ + +#ifdef WOLFSSL_SHA3 +#include <wolfssl/wolfcrypt/sha3.h> +WOLFSSL_API int wc_Sha3_224Hash(const byte* data, word32 len, byte* hash); +WOLFSSL_API int wc_Sha3_256Hash(const byte* data, word32 len, byte* hash); +WOLFSSL_API int wc_Sha3_384Hash(const byte* data, word32 len, byte* hash); +WOLFSSL_API int wc_Sha3_512Hash(const byte* data, word32 len, byte* hash); +WOLFSSL_API int wc_Sha3_224Hash_ex(const byte* data, word32 len, byte* hash, + void* heap, int devId); +WOLFSSL_API int wc_Sha3_256Hash_ex(const byte* data, word32 len, byte* hash, + void* heap, int devId); +WOLFSSL_API int wc_Sha3_384Hash_ex(const byte* data, word32 len, byte* hash, + void* heap, int devId); +WOLFSSL_API int wc_Sha3_512Hash_ex(const byte* data, word32 len, byte* hash, + void* heap, int devId); +#ifdef WOLFSSL_SHAKE128 +WOLFSSL_API int wc_Shake128Hash(const byte* data, word32 len, byte* hash, + word32 hashLen); +WOLFSSL_API int wc_Shake128Hash_ex(const byte* data, word32 len, byte* hash, + word32 hashLen, void* heap, int devId); +#endif +#ifdef WOLFSSL_SHAKE256 +WOLFSSL_API int wc_Shake256Hash(const byte* data, word32 len, byte* hash, + word32 hashLen); +WOLFSSL_API int wc_Shake256Hash_ex(const byte* data, word32 len, byte* hash, + word32 hashLen, void* heap, int devId); +#endif +#endif /* WOLFSSL_SHA3 */ + +#ifdef WOLFSSL_SM3 +WOLFSSL_API int wc_Sm3Hash(const byte* data, word32 len, byte* hash); +WOLFSSL_API int wc_Sm3Hash_ex(const byte* data, word32 len, byte* hash, + void* heap, int devId); +#endif + +#endif /* !NO_HASH_WRAPPER */ + +#if defined(WOLFSSL_HASH_KEEP) +WOLFSSL_LOCAL int _wc_Hash_Grow(byte** msg, word32* used, word32* len, + const byte* in, int inSz, void* heap); +#endif + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLF_CRYPT_HASH_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/hmac.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/hmac.h @@ -0,0 +1,227 @@ +/* hmac.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/hmac.h +*/ + +#ifndef WOLF_CRYPT_HMAC_H +#define WOLF_CRYPT_HMAC_H + +#include <wolfssl/wolfcrypt/hash.h> + +#ifndef NO_HMAC + +#if FIPS_VERSION3_GE(2,0,0) + #include <wolfssl/wolfcrypt/fips.h> +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +#if FIPS_VERSION3_GE(6,0,0) + extern const unsigned int wolfCrypt_FIPS_hmac_ro_sanity[2]; + WOLFSSL_LOCAL int wolfCrypt_FIPS_HMAC_sanity(void); +#endif + +#if FIPS_VERSION3_GE(6,0,0) + #define FIPS_ALLOW_SHORT 1 +#endif + +/* avoid redefinition of structs */ +#if !defined(HAVE_FIPS) || FIPS_VERSION3_GE(2,0,0) + +#ifdef WOLFSSL_ASYNC_CRYPT + #include <wolfssl/wolfcrypt/async.h> +#endif + +#if defined(WOLFSSL_DEVCRYPTO_AES) || defined(WOLFSSL_DEVCRYPTO_HMAC) + #include <wolfssl/wolfcrypt/port/devcrypto/wc_devcrypto.h> +#endif + +#ifndef NO_OLD_WC_NAMES + #define HMAC_BLOCK_SIZE WC_HMAC_BLOCK_SIZE +#endif + +#define WC_HMAC_INNER_HASH_KEYED_SW 1 +#define WC_HMAC_INNER_HASH_KEYED_DEV 2 + +enum { + HMAC_FIPS_MIN_KEY = 14, /* 112 bit key length minimum */ + + IPAD = 0x36, + OPAD = 0x5C, + +/* If any hash is not enabled, add the ID here. */ +#ifdef NO_MD5 + WC_MD5 = WC_HASH_TYPE_MD5, +#endif +#ifdef NO_SHA + WC_SHA = WC_HASH_TYPE_SHA, +#endif +#ifdef NO_SHA256 + WC_SHA256 = WC_HASH_TYPE_SHA256, +#endif +#ifndef WOLFSSL_SHA512 + WC_SHA512 = WC_HASH_TYPE_SHA512, + #ifndef WOLFSSL_NOSHA512_224 + WC_SHA512_224 = WC_HASH_TYPE_SHA512_224, + #endif + #ifndef WOLFSSL_NOSHA512_256 + WC_SHA512_256 = WC_HASH_TYPE_SHA512_256, + #endif +#endif +#ifndef WOLFSSL_SHA384 + WC_SHA384 = WC_HASH_TYPE_SHA384, +#endif +#ifndef WOLFSSL_SHA224 + WC_SHA224 = WC_HASH_TYPE_SHA224, +#endif +#ifndef WOLFSSL_SHA3 + WC_SHA3_224 = WC_HASH_TYPE_SHA3_224, + WC_SHA3_256 = WC_HASH_TYPE_SHA3_256, + WC_SHA3_384 = WC_HASH_TYPE_SHA3_384, + WC_SHA3_512 = WC_HASH_TYPE_SHA3_512, +#endif +#ifdef WOLF_PRIVATE_KEY_ID + HMAC_MAX_ID_LEN = 32, + HMAC_MAX_LABEL_LEN = 32, +#endif + + WOLF_ENUM_DUMMY_LAST_ELEMENT(HMAC) +}; + +/* Select the largest available hash for the buffer size. */ +#define WC_HMAC_BLOCK_SIZE WC_MAX_BLOCK_SIZE + +#if !defined(WOLFSSL_SHA3) && !defined(WOLFSSL_SHA512) && \ + !defined(WOLFSSL_SHA384) && defined(NO_SHA256) && \ + defined(WOLFSSL_SHA224) && defined(NO_SHA) && defined(NO_MD5) + #error "You have to have some kind of hash if you want to use HMAC." +#endif + +typedef wc_Hashes wc_HmacHash; + +/* Hmac digest */ +struct Hmac { + wc_HmacHash hash; +#ifdef WOLFSSL_HMAC_COPY_HASH + wc_HmacHash i_hash; + wc_HmacHash o_hash; +#endif + word32 ipad[WC_HMAC_BLOCK_SIZE / sizeof(word32)]; /* same block size all*/ + word32 opad[WC_HMAC_BLOCK_SIZE / sizeof(word32)]; + word32 innerHash[WC_MAX_DIGEST_SIZE / sizeof(word32)]; + void* heap; /* heap hint */ + byte macType; /* md5 sha or sha256 */ + byte innerHashKeyed; /* keyed flag */ +#ifdef WOLFSSL_KCAPI_HMAC + struct kcapi_handle* handle; +#endif +#ifdef WOLFSSL_ASYNC_CRYPT + WC_ASYNC_DEV asyncDev; +#endif /* WOLFSSL_ASYNC_CRYPT */ +#if defined(WOLFSSL_DEVCRYPTO) && defined(WOLFSSL_DEVCRYPTO_HMAC) + WC_CRYPTODEV ctx; +#endif +#ifdef WOLF_CRYPTO_CB + int devId; + void* devCtx; + const byte* keyRaw; +#endif +#ifdef WOLF_PRIVATE_KEY_ID + byte id[HMAC_MAX_ID_LEN]; + int idLen; + char label[HMAC_MAX_LABEL_LEN]; + int labelLen; +#endif +#if defined(WOLFSSL_ASYNC_CRYPT) || defined(WOLF_CRYPTO_CB) + word16 keyLen; /* hmac key length (key in ipad) */ +#endif +}; + +#ifndef WC_HMAC_TYPE_DEFINED + typedef struct Hmac Hmac; + #define WC_HMAC_TYPE_DEFINED +#endif + + +#endif /* HAVE_FIPS */ + +/* does init */ +WOLFSSL_API int wc_HmacSetKey(Hmac* hmac, int type, const byte* key, + word32 keySz); +WOLFSSL_API int wc_HmacSetKey_ex(Hmac* hmac, int type, const byte* key, + word32 length, int allowFlag); +WOLFSSL_API int wc_HmacUpdate(Hmac* hmac, const byte* in, word32 sz); +WOLFSSL_API int wc_HmacFinal(Hmac* hmac, byte* out); +#ifdef WOLFSSL_KCAPI_HMAC +WOLFSSL_API int wc_HmacSetKey_Software(Hmac* hmac, int type, const byte* key, + word32 keySz); +WOLFSSL_API int wc_HmacUpdate_Software(Hmac* hmac, const byte* in, word32 sz); +WOLFSSL_API int wc_HmacFinal_Software(Hmac* hmac, byte* out); +#endif +WOLFSSL_API int wc_HmacSizeByType(int type); + +WOLFSSL_API int wc_HmacInit(Hmac* hmac, void* heap, int devId); +#ifdef WOLF_PRIVATE_KEY_ID +WOLFSSL_API int wc_HmacInit_Id(Hmac* hmac, byte* id, int len, void* heap, + int devId); +WOLFSSL_API int wc_HmacInit_Label(Hmac* hmac, const char* label, void* heap, + int devId); +#endif +WOLFSSL_API void wc_HmacFree(Hmac* hmac); + +WOLFSSL_API int wolfSSL_GetHmacMaxSize(void); + +WOLFSSL_LOCAL int _InitHmac(Hmac* hmac, int type, void* heap); +WOLFSSL_LOCAL int _HmacInitIOHashes(Hmac* hmac); + +#ifdef HAVE_HKDF + +WOLFSSL_API int wc_HKDF_Extract_ex(int type, const byte* salt, word32 saltSz, + const byte* inKey, word32 inKeySz, byte* out, + void* heap, int devId); + +WOLFSSL_API int wc_HKDF_Extract(int type, const byte* salt, word32 saltSz, + const byte* inKey, word32 inKeySz, byte* out); + +WOLFSSL_API int wc_HKDF_Expand_ex(int type, const byte* inKey, word32 inKeySz, + const byte* info, word32 infoSz, + byte* out, word32 outSz, void* heap, int devId); +WOLFSSL_API int wc_HKDF_Expand(int type, const byte* inKey, word32 inKeySz, + const byte* info, word32 infoSz, + byte* out, word32 outSz); + +WOLFSSL_API int wc_HKDF(int type, const byte* inKey, word32 inKeySz, + const byte* salt, word32 saltSz, + const byte* info, word32 infoSz, + byte* out, word32 outSz); + +#endif /* HAVE_HKDF */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* NO_HMAC */ +#endif /* WOLF_CRYPT_HMAC_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/hpke.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/hpke.h @@ -0,0 +1,145 @@ +/* hpke.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/hpke.h +*/ + +#include <wolfssl/wolfcrypt/settings.h> +#include <wolfssl/wolfcrypt/types.h> +#include <wolfssl/wolfcrypt/ecc.h> + +#ifdef __cplusplus + extern "C" { +#endif + +#if defined(HAVE_HPKE) && defined(HAVE_ECC) + +#ifndef WOLFCRYPT_HPKE +#define WOLFCRYPT_HPKE + +/* KEM enum */ +enum { + DHKEM_P256_HKDF_SHA256 = 0x0010, + DHKEM_P384_HKDF_SHA384 = 0x0011, + DHKEM_P521_HKDF_SHA512 = 0x0012, + DHKEM_X25519_HKDF_SHA256 = 0x0020, + DHKEM_X448_HKDF_SHA512 = 0x0021 +}; + +#define DHKEM_P256_ENC_LEN 65 +#define DHKEM_P384_ENC_LEN 97 +#define DHKEM_P521_ENC_LEN 133 +#define DHKEM_X25519_ENC_LEN 32 +#define DHKEM_X448_ENC_LEN 56 + +/* KDF enum */ +enum { + HKDF_SHA256 = 0x0001, + HKDF_SHA384 = 0x0002, + HKDF_SHA512 = 0x0003 +}; + +/* AEAD enum */ +enum { + HPKE_AES_128_GCM = 0x0001, + HPKE_AES_256_GCM = 0x0002 +}; + +/* TODO better way of doing this */ +#define HPKE_SUPPORTED_KEM_LEN 4 +#define HPKE_SUPPORTED_KDF_LEN 3 +#define HPKE_SUPPORTED_AEAD_LEN 2 +extern const int hpkeSupportedKem[HPKE_SUPPORTED_KEM_LEN]; +extern const int hpkeSupportedKdf[HPKE_SUPPORTED_KDF_LEN]; +extern const int hpkeSupportedAead[HPKE_SUPPORTED_AEAD_LEN]; + +#define HPKE_Nh_MAX 64 +#define HPKE_Nk_MAX 32 +#define HPKE_Nn_MAX 12 +#define HPKE_Nt_MAX 16 +#define HPKE_Ndh_MAX 66 +#define HPKE_Npk_MAX 133 +#define HPKE_Nsecret_MAX 64 +#define KEM_SUITE_ID_LEN 5 +#define HPKE_SUITE_ID_LEN 10 + +#ifndef MAX_HPKE_LABEL_SZ +#define MAX_HPKE_LABEL_SZ 512 +#endif + +typedef struct { + void* heap; + word32 kem; + word32 kdf; + word32 aead; + word32 Nh; + word32 Nk; + word32 Nn; + word32 Nt; + word32 Ndh; + word32 Npk; + word32 Nsecret; + int kdf_digest; + int curve_id; + byte kem_suite_id[KEM_SUITE_ID_LEN]; + byte hpke_suite_id[HPKE_SUITE_ID_LEN]; +} Hpke; + +typedef struct { + int seq; + byte key[HPKE_Nk_MAX]; + byte base_nonce[HPKE_Nn_MAX]; + byte exporter_secret[HPKE_Nsecret_MAX]; +} HpkeBaseContext; + + +WOLFSSL_API int wc_HpkeInit(Hpke* hpke, int kem, int kdf, int aead, void* heap); +WOLFSSL_API int wc_HpkeGenerateKeyPair(Hpke* hpke, void** keypair, WC_RNG* rng); +WOLFSSL_API int wc_HpkeSerializePublicKey(Hpke* hpke, void* key, byte* out, + word16* outSz); +WOLFSSL_API int wc_HpkeDeserializePublicKey(Hpke* hpke, void** key, + const byte* in, word16 inSz); +WOLFSSL_API void wc_HpkeFreeKey(Hpke* hpke, word16 kem, void* keypair, + void* heap); +WOLFSSL_API int wc_HpkeInitSealContext(Hpke* hpke, HpkeBaseContext* context, + void* ephemeralKey, void* receiverKey, byte* info, word32 infoSz); +WOLFSSL_API int wc_HpkeContextSealBase(Hpke* hpke, HpkeBaseContext* context, + byte* aad, word32 aadSz, byte* plaintext, word32 ptSz, byte* out); +WOLFSSL_API int wc_HpkeSealBase(Hpke* hpke, void* ephemeralKey, + void* receiverKey, byte* info, word32 infoSz, byte* aad, word32 aadSz, + byte* plaintext, word32 ptSz, byte* ciphertext); +WOLFSSL_API int wc_HpkeInitOpenContext(Hpke* hpke, HpkeBaseContext* context, + void* receiverKey, const byte* pubKey, word16 pubKeySz, byte* info, + word32 infoSz); +WOLFSSL_API int wc_HpkeContextOpenBase(Hpke* hpke, HpkeBaseContext* context, + byte* aad, word32 aadSz, byte* ciphertext, word32 ctSz, byte* out); +WOLFSSL_API int wc_HpkeOpenBase(Hpke* hpke, void* receiverKey, + const byte* pubKey, word16 pubKeySz, byte* info, word32 infoSz, byte* aad, + word32 aadSz, byte* ciphertext, word32 ctSz, byte* plaintext); + +#endif + +#endif /* HAVE_HPKE && HAVE_ECC */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/integer.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/integer.h @@ -0,0 +1,453 @@ +/* integer.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + +/* + * Based on public domain LibTomMath 0.38 by Tom St Denis, tomstdenis@iahu.ca, + * http://math.libtomcrypt.com + */ + + +#ifndef WOLF_CRYPT_INTEGER_H +#define WOLF_CRYPT_INTEGER_H + +/* may optionally use SP math all or fast math instead. The heap math requires + * realloc and is not timing resistant. The SP math all is recommended for new + * designs. + */ + +#ifndef USE_INTEGER_HEAP_MATH + + /* Some platforms (like FIPS) may only include integer.h for math. */ + /* Handle variations of fast math, integer and sp math */ + #include <wolfssl/wolfcrypt/wolfmath.h> + +#else + +#include <wolfssl/wolfcrypt/types.h> +#include <wolfssl/wolfcrypt/error-crypt.h> +#include <wolfssl/wolfcrypt/random.h> + +#ifndef CHAR_BIT + #if defined(WOLFSSL_LINUXKM) + #include <linux/limits.h> + #else + #include <limits.h> + #endif +#endif + +#include <wolfssl/wolfcrypt/mpi_class.h> + + +#ifdef __cplusplus +extern "C" { + +/* C++ compilers don't like assigning void * to mp_digit * */ +#define OPT_CAST(x) (x *) + +#elif defined(_SH3) + +/* SuperH SH3 compiler doesn't like assigning voi* to mp_digit* */ +#define OPT_CAST(x) (x *) + +#else + +/* C on the other hand doesn't care */ +#define OPT_CAST(x) /* null expansion */ + +#endif /* __cplusplus */ + + +/* detect 64-bit mode if possible */ +#if (defined(__x86_64__) || defined(__aarch64__)) && !(defined (_MSC_VER) && defined(__clang__)) + #if !(defined(MP_64BIT) && defined(MP_16BIT) && defined(MP_8BIT)) + #define MP_64BIT + #endif +#endif +/* if intel compiler doesn't provide 128 bit type don't turn on 64bit */ +#if defined(MP_64BIT) && defined(__INTEL_COMPILER) && !defined(HAVE___UINT128_T) + #undef MP_64BIT +#endif + + +/* allow user to define on mp_digit, mp_word, DIGIT_BIT types */ +#ifndef WOLFSSL_BIGINT_TYPES + +/* some default configurations. + * + * A "mp_digit" must be able to hold DIGIT_BIT + 1 bits + * A "mp_word" must be able to hold 2*DIGIT_BIT + 1 bits + * + * At the very least a mp_digit must be able to hold 7 bits + * [any size beyond that is ok provided it doesn't overflow the data type] + */ +#ifdef MP_8BIT + /* 8-bit */ + typedef unsigned char mp_digit; + typedef unsigned short mp_word; + /* don't define DIGIT_BIT, so its calculated below */ +#elif defined(MP_16BIT) + /* 16-bit */ + typedef unsigned int mp_digit; + typedef unsigned long mp_word; + /* don't define DIGIT_BIT, so its calculated below */ +#elif defined(NO_64BIT) + /* 32-bit forced to 16-bit */ + typedef unsigned short mp_digit; + typedef unsigned int mp_word; + #define DIGIT_BIT 12 +#elif defined(MP_64BIT) + /* 64-bit */ + /* for GCC only on supported platforms */ + typedef unsigned long long mp_digit; /* 64 bit type, 128 uses mode(TI) */ + typedef unsigned long mp_word __attribute__ ((mode(TI))); + #define DIGIT_BIT 60 +#else + /* 32-bit default case */ + + #if defined(_MSC_VER) || defined(__BORLANDC__) + typedef unsigned __int64 ulong64; + #else + typedef unsigned long long ulong64; + #endif + + typedef unsigned int mp_digit; /* long could be 64 now, changed TAO */ + typedef ulong64 mp_word; + + #ifdef MP_31BIT + /* this is an extension that uses 31-bit digits */ + #define DIGIT_BIT 31 + #else + /* default case is 28-bit digits, defines MP_28BIT as a handy test macro */ + #define DIGIT_BIT 28 + #define MP_28BIT + #endif +#endif + +#endif /* WOLFSSL_BIGINT_TYPES */ + +/* otherwise the bits per digit is calculated automatically from the size of + a mp_digit */ +#ifndef DIGIT_BIT + #define DIGIT_BIT ((int)((CHAR_BIT * sizeof(mp_digit) - 1))) + /* bits per digit */ +#endif + +#define MP_DIGIT_BIT DIGIT_BIT +#define MP_MASK ((((mp_digit)1)<<((mp_digit)DIGIT_BIT))-((mp_digit)1)) +#define MP_DIGIT_MAX MP_MASK + +/* equalities */ +#define MP_LT (-1) /* less than */ +#define MP_EQ 0 /* equal to */ +#define MP_GT 1 /* greater than */ + +#define MP_ZPOS 0 /* positive integer */ +#define MP_NEG 1 /* negative */ + +#define MP_OKAY 0 /* ok result */ +#define MP_RANGE MP_NOT_INF + +#define MP_YES 1 /* yes response */ +#define MP_NO 0 /* no response */ + +/* Primality generation flags */ +#define LTM_PRIME_BBS 0x0001 /* BBS style prime */ +#define LTM_PRIME_SAFE 0x0002 /* Safe prime (p-1)/2 == prime */ +#define LTM_PRIME_2MSB_ON 0x0008 /* force 2nd MSB to 1 */ + +typedef int mp_err; + +/* define this to use lower memory usage routines (exptmods mostly) */ +#define MP_LOW_MEM + +/* default precision */ +#ifndef MP_PREC + #ifndef MP_LOW_MEM + #define MP_PREC 32 /* default digits of precision */ + #else + #define MP_PREC 1 /* default digits of precision */ + #endif +#endif + +/* size of comba arrays, should be at least 2 * 2**(BITS_PER_WORD - + BITS_PER_DIGIT*2) */ +#define MP_WARRAY ((mp_word)1 << (sizeof(mp_word) * CHAR_BIT - 2 * DIGIT_BIT + 1)) + +/* No point in dynamically allocating mp_int when it is very small. + * The dp field will grow and shrink dynamically. + */ +/* Declare a statically allocated mp_int. */ +#define DECL_MP_INT_SIZE(name, bits) \ + mp_int name[1] +/* Declare statically allocated mp_int. */ +#define DECL_MP_INT_SIZE_DYN(name, bits, max) \ + mp_int name[1] +/* Zero out mp_int of minimal size. */ +#define NEW_MP_INT_SIZE(name, bits, heap, type) \ + XMEMSET(name, 0, sizeof(mp_int)) +/* Dispose of static mp_int. */ +#define FREE_MP_INT_SIZE(name, heap, type) \ + do { \ + if ((name) != NULL) { \ + mp_free(name); \ + } \ + } while (0) +/* Initialize an mp_int. */ +#define INIT_MP_INT_SIZE(name, bits) \ + mp_init(name) +/* Type to cast to when using size marcos. */ +#define MP_INT_SIZE mp_int + +#ifdef HAVE_WOLF_BIGINT + /* raw big integer */ + typedef struct WC_BIGINT { + byte* buf; + word32 len; + void* heap; + } WC_BIGINT; + #define WOLF_BIGINT_DEFINED +#endif + +#define wc_mp_size_t int +#define wc_mp_sign_t int + +/* the mp_int structure */ +typedef struct mp_int { + int used, alloc, sign; + mp_digit *dp; + +#ifdef HAVE_WOLF_BIGINT + struct WC_BIGINT raw; /* unsigned binary (big endian) */ +#endif +} mp_int; + +/* wolf big int and common functions */ +#include <wolfssl/wolfcrypt/wolfmath.h> + + +/* callback for mp_prime_random, should fill dst with random bytes and return + how many read [up to len] */ +typedef int ltm_prime_callback(unsigned char *dst, int len, void *dat); + + +#define USED(m) ((m)->used) +#define DIGIT(m,k) ((m)->dp[(k)]) +#define SIGN(m) ((m)->sign) + + +/* ---> Basic Manipulations <--- */ +#define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO) +#define mp_isone(a) \ + (((((a)->used == 1)) && ((a)->dp[0] == 1u) && ((a)->sign == MP_ZPOS)) \ + ? MP_YES : MP_NO) +#define mp_iseven(a) \ + (((a)->used > 0 && (((a)->dp[0] & 1u) == 0u)) ? MP_YES : MP_NO) +#define mp_isodd(a) \ + (((a)->used > 0 && (((a)->dp[0] & 1u) == 1u)) ? MP_YES : MP_NO) +#define mp_isneg(a) (((a)->sign != MP_ZPOS) ? MP_YES : MP_NO) +#define mp_setneg(a) ((a)->sign = MP_NEG) +#define mp_isword(a, w) \ + ((((a)->used == 1) && ((a)->dp[0] == (w))) || (((w) == 0) && ((a)->used == 0)) \ + ? MP_YES : MP_NO) +/* Number of bits used based on used field only. */ +#define mp_bitsused(a) ((a)->used * DIGIT_BIT) + +/* number of primes */ +#ifdef MP_8BIT + #define PRIME_SIZE 31 +#else + #define PRIME_SIZE 256 +#endif + +#ifndef MAX_INVMOD_SZ + #if defined(WOLFSSL_MYSQL_COMPATIBLE) + #define MAX_INVMOD_SZ 8192 + #else + #define MAX_INVMOD_SZ 4096 + #endif +#endif + +#define mp_prime_random(a, t, size, bbs, cb, dat) \ + mp_prime_random_ex(a, t, ((size) * 8) + 1, ((bbs)==1)?LTM_PRIME_BBS:0, cb, dat) + +#define mp_read_mag(mp, str, len) mp_read_unsigned_bin((mp), (str), (len)) +#define mp_mag_size(mp) mp_unsigned_bin_size(mp) +#define mp_tomag(mp, str) mp_to_unsigned_bin((mp), (str)) + +#define MP_RADIX_BIN 2 +#define MP_RADIX_OCT 8 +#define MP_RADIX_DEC 10 +#define MP_RADIX_HEX 16 +#define MP_RADIX_MAX 64 + +#define mp_tobinary(M, S) mp_toradix((M), (S), MP_RADIX_BIN) +#define mp_tooctal(M, S) mp_toradix((M), (S), MP_RADIX_OCT) +#define mp_todecimal(M, S) mp_toradix((M), (S), MP_RADIX_DEC) +#define mp_tohex(M, S) mp_toradix((M), (S), MP_RADIX_HEX) + +#define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1) + +#if defined(HAVE_ECC) || defined(WOLFSSL_KEY_GEN) || defined(HAVE_COMP_KEY) || \ + defined(WOLFSSL_DEBUG_MATH) || defined(DEBUG_WOLFSSL) +extern const char *mp_s_rmap; +#endif + +/* 6 functions needed by Rsa */ +MP_API int mp_init (mp_int * a); +MP_API void mp_clear (mp_int * a); +MP_API void mp_free (mp_int * a); +MP_API void mp_forcezero(mp_int * a); +MP_API int mp_unsigned_bin_size(const mp_int * a); +MP_API int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c); +MP_API int mp_to_unsigned_bin_at_pos(int x, mp_int *t, unsigned char *b); +MP_API int mp_to_unsigned_bin (mp_int * a, unsigned char *b); +#define mp_to_unsigned_bin_len_ct mp_to_unsigned_bin_len +MP_API int mp_to_unsigned_bin_len(mp_int * a, unsigned char *b, int c); +MP_API int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y); +MP_API int mp_exptmod_ex (mp_int * G, mp_int * X, int digits, mp_int * P, + mp_int * Y); +/* end functions needed by Rsa */ + +/* functions added to support above needed, removed TOOM and KARATSUBA */ +MP_API int mp_count_bits (const mp_int * a); +MP_API int mp_leading_bit (mp_int * a); +MP_API int mp_init_copy (mp_int * a, mp_int * b); +MP_API int mp_copy (const mp_int * a, mp_int * b); +MP_API int mp_grow (mp_int * a, int size); +MP_API int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d); +MP_API void mp_zero (mp_int * a); +MP_API void mp_clamp (mp_int * a); +MP_API int mp_exch (mp_int * a, mp_int * b); +MP_API int mp_cond_swap_ct_ex (mp_int * a, mp_int * b, int c, int m, + mp_int * t); +MP_API int mp_cond_swap_ct (mp_int * a, mp_int * b, int c, int m); +MP_API void mp_rshd (mp_int * a, int b); +MP_API void mp_rshb (mp_int * a, int b); +MP_API int mp_mod_2d (mp_int * a, int b, mp_int * c); +MP_API int mp_mul_2d (mp_int * a, int b, mp_int * c); +MP_API int mp_lshd (mp_int * a, int b); +MP_API int mp_abs (mp_int * a, mp_int * b); +MP_API int mp_invmod (mp_int * a, mp_int * b, mp_int * c); +int fast_mp_invmod (mp_int * a, mp_int * b, mp_int * c); +MP_API int mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c); +MP_API int mp_cmp_mag (mp_int * a, mp_int * b); +MP_API int mp_cmp (mp_int * a, mp_int * b); +#define mp_cmp_ct(a, b, n) mp_cmp(a, b) +MP_API int mp_cmp_d(mp_int * a, mp_digit b); +MP_API int mp_set (mp_int * a, mp_digit b); +MP_API int mp_is_bit_set (mp_int * a, mp_digit b); +MP_API int mp_mod (mp_int * a, mp_int * b, mp_int * c); +MP_API int mp_div(mp_int * a, mp_int * b, mp_int * c, mp_int * d); +MP_API int mp_div_2(mp_int * a, mp_int * b); +MP_API int mp_div_2_mod_ct (mp_int* a, mp_int* b, mp_int* c); +MP_API int mp_add (mp_int * a, mp_int * b, mp_int * c); +int s_mp_add (mp_int * a, mp_int * b, mp_int * c); +int s_mp_sub (mp_int * a, mp_int * b, mp_int * c); +MP_API int mp_sub (mp_int * a, mp_int * b, mp_int * c); +MP_API int mp_reduce_is_2k_l(mp_int *a); +MP_API int mp_reduce_is_2k(mp_int *a); +MP_API int mp_dr_is_modulus(mp_int *a); +MP_API int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, + int redmode); +MP_API int mp_exptmod_base_2 (mp_int * X, mp_int * P, mp_int * Y); +#define mp_exptmod_nct(G,X,P,Y) mp_exptmod_fast(G,X,P,Y,0) +MP_API int mp_montgomery_setup (mp_int * n, mp_digit * rho); +int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho); +MP_API int mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho); +#define mp_montgomery_reduce_ex(x, n, rho, ct) mp_montgomery_reduce (x, n, rho) +#define mp_montgomery_reduce_ct(x, n, rho) mp_montgomery_reduce (x, n, rho) +MP_API void mp_dr_setup(mp_int *a, mp_digit *d); +MP_API int mp_dr_reduce (mp_int * x, mp_int * n, mp_digit k); +MP_API int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d); +int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs); +int s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs); +MP_API int mp_reduce_2k_setup_l(mp_int *a, mp_int *d); +MP_API int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d); +MP_API int mp_reduce (mp_int * x, mp_int * m, mp_int * mu); +MP_API int mp_reduce_setup (mp_int * a, mp_int * b); +int s_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode); +MP_API int mp_montgomery_calc_normalization (mp_int * a, mp_int * b); +int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs); +int s_mp_sqr (mp_int * a, mp_int * b); +int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs); +int fast_s_mp_sqr (mp_int * a, mp_int * b); +MP_API int mp_init_size (mp_int * a, int size); +MP_API int mp_div_3 (mp_int * a, mp_int *c, mp_digit * d); +MP_API int mp_mul_2(mp_int * a, mp_int * b); +MP_API int mp_mul (mp_int * a, mp_int * b, mp_int * c); +MP_API int mp_sqr (mp_int * a, mp_int * b); +MP_API int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d); +MP_API int mp_submod (mp_int* a, mp_int* b, mp_int* c, mp_int* d); +MP_API int mp_addmod (mp_int* a, mp_int* b, mp_int* c, mp_int* d); +MP_API int mp_submod_ct (mp_int* a, mp_int* b, mp_int* c, mp_int* d); +MP_API int mp_addmod_ct (mp_int* a, mp_int* b, mp_int* c, mp_int* d); +MP_API int mp_mul_d (mp_int * a, mp_digit b, mp_int * c); +MP_API int mp_2expt (mp_int * a, int b); +MP_API int mp_set_bit (mp_int * a, int b); +MP_API int mp_reduce_2k_setup(mp_int *a, mp_digit *d); +MP_API int mp_add_d (mp_int* a, mp_digit b, mp_int* c); +MP_API int mp_set_int (mp_int * a, unsigned long b); +MP_API int mp_sub_d (mp_int * a, mp_digit b, mp_int * c); +/* end support added functions */ + +/* added */ +MP_API int mp_init_multi(mp_int* a, mp_int* b, mp_int* c, mp_int* d, mp_int* e, + mp_int* f); +MP_API int mp_toradix (mp_int *a, char *str, int radix); +MP_API int mp_radix_size (mp_int * a, int radix, int *size); + +#ifdef WOLFSSL_DEBUG_MATH + MP_API void mp_dump(const char* desc, mp_int* a, byte verbose); +#else + #define mp_dump(desc, a, verbose) WC_DO_NOTHING +#endif + +#if defined(HAVE_ECC) || defined(WOLFSSL_KEY_GEN) || !defined(NO_RSA) || \ + !defined(NO_DSA) || !defined(NO_DH) + MP_API int mp_sqrmod(mp_int* a, mp_int* b, mp_int* c); +#endif +#if !defined(NO_DSA) || defined(HAVE_ECC) || defined(OPENSSL_EXTRA) + MP_API int mp_read_radix(mp_int* a, const char* str, int radix); +#endif + +#if defined(WOLFSSL_KEY_GEN) || !defined(NO_RSA) || !defined(NO_DSA) || !defined(NO_DH) + MP_API int mp_prime_is_prime (mp_int * a, int t, int *result); + MP_API int mp_prime_is_prime_ex (mp_int * a, int t, int *result, WC_RNG* rng); +#endif /* WOLFSSL_KEY_GEN NO_RSA NO_DSA NO_DH */ +#ifdef WOLFSSL_KEY_GEN + MP_API int mp_gcd (mp_int * a, mp_int * b, mp_int * c); + MP_API int mp_lcm (mp_int * a, mp_int * b, mp_int * c); + MP_API int mp_rand_prime(mp_int* a, int len, WC_RNG* rng, void* heap); +#endif + +MP_API int mp_cnt_lsb(mp_int *a); +MP_API int mp_mod_d(mp_int* a, mp_digit b, mp_digit* c); + + +#ifdef __cplusplus + } +#endif + + +#endif /* USE_INTEGER_HEAP_MATH */ + +#endif /* WOLF_CRYPT_INTEGER_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/kdf.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/kdf.h @@ -0,0 +1,181 @@ +/* kdf.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/kdf.h +*/ + +#ifndef NO_KDF + +#ifndef WOLF_CRYPT_KDF_H +#define WOLF_CRYPT_KDF_H + +#if defined(HAVE_FIPS) && \ + defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 5) + #include <wolfssl/wolfcrypt/fips.h> +#endif + +#include <wolfssl/wolfcrypt/hmac.h> + +#ifdef __cplusplus + extern "C" { +#endif + +#if FIPS_VERSION3_GE(6,0,0) + extern const unsigned int wolfCrypt_FIPS_kdf_ro_sanity[2]; + WOLFSSL_LOCAL int wolfCrypt_FIPS_KDF_sanity(void); +#endif + +enum max_prf { +#ifdef HAVE_FFDHE_8192 + MAX_PRF_HALF = 516, /* Maximum half secret len */ +#elif defined(HAVE_FFDHE_6144) + MAX_PRF_HALF = 388, /* Maximum half secret len */ +#else + MAX_PRF_HALF = 260, /* Maximum half secret len */ +#endif + MAX_PRF_LABSEED = 128, /* Maximum label + seed len */ + MAX_PRF_DIG = 224 /* Maximum digest len */ +}; + + +#ifdef WOLFSSL_HAVE_PRF +WOLFSSL_API int wc_PRF(byte* result, word32 resLen, const byte* secret, + word32 secLen, const byte* seed, word32 seedLen, int hash, + void* heap, int devId); +WOLFSSL_API int wc_PRF_TLSv1(byte* digest, word32 digLen, const byte* secret, + word32 secLen, const byte* label, word32 labLen, + const byte* seed, word32 seedLen, void* heap, int devId); +WOLFSSL_API int wc_PRF_TLS(byte* digest, word32 digLen, const byte* secret, + word32 secLen, const byte* label, word32 labLen, + const byte* seed, word32 seedLen, int useAtLeastSha256, + int hash_type, void* heap, int devId); +#endif /* WOLFSSL_HAVE_PRF */ + +#ifdef HAVE_HKDF + +enum { +/* + MAX_HKDF_LABEL_SZ = OPAQUE16_LEN + + OPAQUE8_LEN + PROTOCOL_LABEL_SZ + MAX_LABEL_SZ + + OPAQUE8_LEN + WC_MAX_DIGEST_SIZE +*/ + MAX_TLS13_HKDF_LABEL_SZ = 47 + WC_MAX_DIGEST_SIZE +}; + +WOLFSSL_API int wc_Tls13_HKDF_Extract_ex(byte* prk, const byte* salt, + word32 saltLen, byte* ikm, word32 ikmLen, int digest, + void* heap, int devId); + +WOLFSSL_API int wc_Tls13_HKDF_Extract(byte* prk, const byte* salt, + word32 saltLen, byte* ikm, word32 ikmLen, int digest); + +WOLFSSL_API int wc_Tls13_HKDF_Expand_Label_ex(byte* okm, word32 okmLen, + const byte* prk, word32 prkLen, + const byte* protocol, word32 protocolLen, + const byte* label, word32 labelLen, + const byte* info, word32 infoLen, + int digest, void* heap, int devId); + +WOLFSSL_API int wc_Tls13_HKDF_Expand_Label(byte* okm, word32 okmLen, + const byte* prk, word32 prkLen, + const byte* protocol, word32 protocolLen, + const byte* label, word32 labelLen, + const byte* info, word32 infoLen, + int digest); +#if defined(WOLFSSL_TICKET_NONCE_MALLOC) && \ + (!defined(HAVE_FIPS) || (defined(FIPS_VERSION_GE) && FIPS_VERSION_GE(5,3))) +WOLFSSL_API int wc_Tls13_HKDF_Expand_Label_Alloc(byte* okm, word32 okmLen, + const byte* prk, word32 prkLen, const byte* protocol, word32 protocolLen, + const byte* label, word32 labelLen, const byte* info, word32 infoLen, + int digest, void* heap); +#endif /* !defined(HAVE_FIPS) || FIPS_VERSION_GE(5,3) */ + +#endif /* HAVE_HKDF */ + +#ifdef WOLFSSL_WOLFSSH + +WOLFSSL_API int wc_SSH_KDF(byte hashId, byte keyId, + byte* key, word32 keySz, + const byte* k, word32 kSz, + const byte* h, word32 hSz, + const byte* sessionId, word32 sessionIdSz); + +#endif /* WOLFSSL_WOLFSSH */ + +#ifdef WC_SRTP_KDF +/* Label values for purpose. */ +#define WC_SRTP_LABEL_ENCRYPTION 0x00 +#define WC_SRTP_LABEL_MSG_AUTH 0x01 +#define WC_SRTP_LABEL_SALT 0x02 +#define WC_SRTCP_LABEL_ENCRYPTION 0x03 +#define WC_SRTCP_LABEL_MSG_AUTH 0x04 +#define WC_SRTCP_LABEL_SALT 0x05 +#define WC_SRTP_LABEL_HDR_ENCRYPTION 0x06 +#define WC_SRTP_LABEL_HDR_SALT 0x07 + +/* Length of index for SRTP KDF. */ +#define WC_SRTP_INDEX_LEN 6 +/* Length of index for SRTCP KDF. */ +#define WC_SRTCP_INDEX_LEN 4 + +/* Indicators */ +enum { + WC_SRTCP_32BIT_IDX = 0, + WC_SRTCP_48BIT_IDX = 1 +}; + +/* Maximum length of salt that can be used with SRTP/SRTCP. */ +#define WC_SRTP_MAX_SALT 14 + +WOLFSSL_API int wc_SRTP_KDF(const byte* key, word32 keySz, const byte* salt, + word32 saltSz, int kdrIdx, const byte* idx, byte* key1, word32 key1Sz, + byte* key2, word32 key2Sz, byte* key3, word32 key3Sz); +WOLFSSL_API int wc_SRTCP_KDF(const byte* key, word32 keySz, const byte* salt, + word32 saltSz, int kdrIdx, const byte* idx, byte* key1, word32 key1Sz, + byte* key2, word32 key2Sz, byte* key3, word32 key3Sz); +WOLFSSL_API int wc_SRTCP_KDF_ex(const byte* key, word32 keySz, const byte* salt, + word32 saltSz, int kdrIdx, const byte* idx, byte* key1, word32 key1Sz, + byte* key2, word32 key2Sz, byte* key3, word32 key3Sz, int idxLenIndicator); +WOLFSSL_API int wc_SRTP_KDF_label(const byte* key, word32 keySz, + const byte* salt, word32 saltSz, int kdrIdx, const byte* idx, byte label, + byte* outKey, word32 outKeySz); +WOLFSSL_API int wc_SRTCP_KDF_label(const byte* key, word32 keySz, + const byte* salt, word32 saltSz, int kdrIdx, const byte* idx, byte label, + byte* outKey, word32 outKeySz); + +WOLFSSL_API int wc_SRTP_KDF_kdr_to_idx(word32 kdr); + +#endif /* WC_SRTP_KDF */ + +#ifdef WC_KDF_NIST_SP_800_56C +WOLFSSL_API int wc_KDA_KDF_onestep(const byte* z, word32 zSz, + const byte* fixedInfo, word32 fixedInfoSz, word32 derivedSecretSz, + enum wc_HashType hashType, byte* output, word32 outputSz); +#endif +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLF_CRYPT_KDF_H */ + +#endif /* NO_KDF */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/lms.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/lms.h @@ -0,0 +1,202 @@ +/* lms.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/lms.h + */ + +#ifndef WOLF_CRYPT_LMS_H +#define WOLF_CRYPT_LMS_H + +#include <wolfssl/wolfcrypt/types.h> +#include <wolfssl/wolfcrypt/random.h> + +#ifdef WOLFSSL_HAVE_LMS + +/* Length of the Key ID. */ +#define WC_LMS_I_LEN 16 + +typedef struct LmsKey LmsKey; + +/* Private key write and read callbacks. */ +typedef int (*wc_lms_write_private_key_cb)(const byte * priv, word32 privSz, void *context); +typedef int (*wc_lms_read_private_key_cb)(byte * priv, word32 privSz, void *context); + +/* Return codes returned by private key callbacks. */ +enum wc_LmsRc { + WC_LMS_RC_NONE, + WC_LMS_RC_BAD_ARG, /* Bad arg in read or write callback. */ + WC_LMS_RC_WRITE_FAIL, /* Write or update private key failed. */ + WC_LMS_RC_READ_FAIL, /* Read private key failed. */ + WC_LMS_RC_SAVED_TO_NV_MEMORY, /* Wrote private key to nonvolatile storage. */ + WC_LMS_RC_READ_TO_MEMORY /* Read private key from storage. */ +}; + +/* LMS/HSS signatures are defined by 3 parameters: + * levels: number of levels of Merkle trees. + * height: height of an individual Merkle tree. + * winternitz: number of bits from hash used in a Winternitz chain. + * + * The acceptable parameter values are those in RFC8554: + * levels = {1..8} + * height = {5, 10, 15, 20, 25} + * winternitz = {1, 2, 4, 8} + * + * The number of available signatures is: + * N = 2 ** (levels * height) + * + * Signature sizes are determined by levels and winternitz + * parameters primarily, and height to a lesser extent: + * - Larger levels values increase signature size significantly. + * - Larger height values increase signature size moderately. + * - Larger winternitz values will reduce the signature size, at + * the expense of longer key generation and sign/verify times. + * + * Key generation time is strongly determined by the height of + * the first level tree. A 3 level, 5 height tree is much faster + * than 1 level, 15 height at initial key gen, even if the number + * of available signatures is the same. + * */ + +/* Predefined LMS/HSS parameter sets for convenience. + * + * Not predefining many sets with Winternitz=1, because the signatures + * will be large. */ +enum wc_LmsParm { +#ifndef WOLFSSL_NO_LMS_SHA256_256 + WC_LMS_PARM_NONE = 0, + WC_LMS_PARM_L1_H5_W1 = 1, + WC_LMS_PARM_L1_H5_W2 = 2, + WC_LMS_PARM_L1_H5_W4 = 3, + WC_LMS_PARM_L1_H5_W8 = 4, + WC_LMS_PARM_L1_H10_W2 = 5, + WC_LMS_PARM_L1_H10_W4 = 6, + WC_LMS_PARM_L1_H10_W8 = 7, + WC_LMS_PARM_L1_H15_W2 = 8, + WC_LMS_PARM_L1_H15_W4 = 9, + WC_LMS_PARM_L1_H15_W8 = 10, + WC_LMS_PARM_L1_H20_W2 = 11, + WC_LMS_PARM_L1_H20_W4 = 12, + WC_LMS_PARM_L1_H20_W8 = 13, + WC_LMS_PARM_L2_H5_W2 = 14, + WC_LMS_PARM_L2_H5_W4 = 15, + WC_LMS_PARM_L2_H5_W8 = 16, + WC_LMS_PARM_L2_H10_W2 = 17, + WC_LMS_PARM_L2_H10_W4 = 18, + WC_LMS_PARM_L2_H10_W8 = 19, + WC_LMS_PARM_L2_H15_W2 = 20, + WC_LMS_PARM_L2_H15_W4 = 21, + WC_LMS_PARM_L2_H15_W8 = 22, + WC_LMS_PARM_L2_H20_W2 = 23, + WC_LMS_PARM_L2_H20_W4 = 24, + WC_LMS_PARM_L2_H20_W8 = 25, + WC_LMS_PARM_L3_H5_W2 = 26, + WC_LMS_PARM_L3_H5_W4 = 27, + WC_LMS_PARM_L3_H5_W8 = 28, + WC_LMS_PARM_L3_H10_W4 = 29, + WC_LMS_PARM_L3_H10_W8 = 30, + WC_LMS_PARM_L4_H5_W2 = 31, + WC_LMS_PARM_L4_H5_W4 = 32, + WC_LMS_PARM_L4_H5_W8 = 33, + WC_LMS_PARM_L4_H10_W4 = 34, + WC_LMS_PARM_L4_H10_W8 = 35, +#endif + +#ifdef WOLFSSL_LMS_SHA256_192 + WC_LMS_PARM_SHA256_192_L1_H5_W1 = 36, + WC_LMS_PARM_SHA256_192_L1_H5_W2 = 37, + WC_LMS_PARM_SHA256_192_L1_H5_W4 = 38, + WC_LMS_PARM_SHA256_192_L1_H5_W8 = 39, + WC_LMS_PARM_SHA256_192_L1_H10_W2 = 40, + WC_LMS_PARM_SHA256_192_L1_H10_W4 = 41, + WC_LMS_PARM_SHA256_192_L1_H10_W8 = 42, + WC_LMS_PARM_SHA256_192_L1_H15_W2 = 43, + WC_LMS_PARM_SHA256_192_L1_H15_W4 = 44, + WC_LMS_PARM_SHA256_192_L1_H20_W2 = 53, + WC_LMS_PARM_SHA256_192_L1_H20_W4 = 54, + WC_LMS_PARM_SHA256_192_L1_H20_W8 = 55, + WC_LMS_PARM_SHA256_192_L2_H10_W2 = 45, + WC_LMS_PARM_SHA256_192_L2_H10_W4 = 46, + WC_LMS_PARM_SHA256_192_L2_H10_W8 = 47, + WC_LMS_PARM_SHA256_192_L3_H5_W2 = 48, + WC_LMS_PARM_SHA256_192_L3_H5_W4 = 49, + WC_LMS_PARM_SHA256_192_L3_H5_W8 = 50, + WC_LMS_PARM_SHA256_192_L3_H10_W4 = 51, + WC_LMS_PARM_SHA256_192_L4_H5_W8 = 52, +#endif +}; + +/* enum wc_LmsState is to help track the state of an LMS/HSS Key. */ +enum wc_LmsState { + WC_LMS_STATE_FREED, /* Key has been freed from memory. */ + WC_LMS_STATE_INITED, /* Key has been inited, ready to set params.*/ + WC_LMS_STATE_PARMSET, /* Params are set, ready to MakeKey or Reload. */ + WC_LMS_STATE_OK, /* Able to sign signatures and verify. */ + WC_LMS_STATE_VERIFYONLY, /* A public only LmsKey. */ + WC_LMS_STATE_BAD, /* Can't guarantee key's state. */ + WC_LMS_STATE_NOSIGS /* Signatures exhausted. */ +}; + +#ifdef __cplusplus + extern "C" { +#endif +WOLFSSL_API int wc_LmsKey_Init(LmsKey * key, void * heap, int devId); +WOLFSSL_API int wc_LmsKey_SetLmsParm(LmsKey * key, enum wc_LmsParm lmsParm); +WOLFSSL_API int wc_LmsKey_SetParameters(LmsKey * key, int levels, + int height, int winternitz); +WOLFSSL_API int wc_LmsKey_GetParameters(const LmsKey * key, int * levels, + int * height, int * winternitz); +#ifndef WOLFSSL_LMS_VERIFY_ONLY +WOLFSSL_API int wc_LmsKey_SetWriteCb(LmsKey * key, + wc_lms_write_private_key_cb write_cb); +WOLFSSL_API int wc_LmsKey_SetReadCb(LmsKey * key, + wc_lms_read_private_key_cb read_cb); +WOLFSSL_API int wc_LmsKey_SetContext(LmsKey * key, void * context); +WOLFSSL_API int wc_LmsKey_MakeKey(LmsKey * key, WC_RNG * rng); +WOLFSSL_API int wc_LmsKey_Reload(LmsKey * key); +WOLFSSL_API int wc_LmsKey_GetPrivLen(const LmsKey * key, word32 * len); +WOLFSSL_API int wc_LmsKey_Sign(LmsKey * key, byte * sig, word32 * sigSz, + const byte * msg, int msgSz); +WOLFSSL_API int wc_LmsKey_SigsLeft(LmsKey * key); +#endif /* ifndef WOLFSSL_LMS_VERIFY_ONLY */ +WOLFSSL_API void wc_LmsKey_Free(LmsKey * key); +WOLFSSL_API int wc_LmsKey_GetSigLen(const LmsKey * key, word32 * len); +WOLFSSL_API int wc_LmsKey_GetPubLen(const LmsKey * key, word32 * len); +WOLFSSL_API int wc_LmsKey_ExportPub(LmsKey * keyDst, const LmsKey * keySrc); +WOLFSSL_API int wc_LmsKey_ExportPubRaw(const LmsKey * key, byte * out, + word32 * outLen); +WOLFSSL_API int wc_LmsKey_ImportPubRaw(LmsKey * key, const byte * in, + word32 inLen); +WOLFSSL_API int wc_LmsKey_Verify(LmsKey * key, const byte * sig, word32 sigSz, + const byte * msg, int msgSz); +WOLFSSL_API const char * wc_LmsKey_ParmToStr(enum wc_LmsParm lmsParm); +WOLFSSL_API const char * wc_LmsKey_RcToStr(enum wc_LmsRc lmsRc); + +WOLFSSL_API int wc_LmsKey_GetKid(LmsKey * key, const byte ** kid, + word32* kidSz); +WOLFSSL_API const byte * wc_LmsKey_GetKidFromPrivRaw(const byte * priv, + word32 privSz); +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_HAVE_LMS */ +#endif /* WOLF_CRYPT_LMS_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/logging.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/logging.h @@ -0,0 +1,363 @@ +/* logging.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/logging.h +*/ + + +/* submitted by eof */ + + +#ifndef WOLFSSL_LOGGING_H +#define WOLFSSL_LOGGING_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef __cplusplus + extern "C" { +#endif + + +enum wc_LogLevels { + ERROR_LOG = 0, + INFO_LOG, + ENTER_LOG, + LEAVE_LOG, + OTHER_LOG +}; + +#ifdef WOLFSSL_FUNC_TIME +/* WARNING: This code is only to be used for debugging performance. + * The code is not thread-safe. + * Do not use WOLFSSL_FUNC_TIME in production code. + */ +enum wc_FuncNum { + WC_FUNC_HELLO_REQUEST_SEND = 0, + WC_FUNC_HELLO_REQUEST_DO, + WC_FUNC_CLIENT_HELLO_SEND, + WC_FUNC_CLIENT_HELLO_DO, + WC_FUNC_SERVER_HELLO_SEND, + WC_FUNC_SERVER_HELLO_DO, + WC_FUNC_ENCRYPTED_EXTENSIONS_SEND, + WC_FUNC_ENCRYPTED_EXTENSIONS_DO, + WC_FUNC_CERTIFICATE_REQUEST_SEND, + WC_FUNC_CERTIFICATE_REQUEST_DO, + WC_FUNC_CERTIFICATE_SEND, + WC_FUNC_CERTIFICATE_DO, + WC_FUNC_CERTIFICATE_VERIFY_SEND, + WC_FUNC_CERTIFICATE_VERIFY_DO, + WC_FUNC_FINISHED_SEND, + WC_FUNC_FINISHED_DO, + WC_FUNC_KEY_UPDATE_SEND, + WC_FUNC_KEY_UPDATE_DO, + WC_FUNC_EARLY_DATA_SEND, + WC_FUNC_EARLY_DATA_DO, + WC_FUNC_NEW_SESSION_TICKET_SEND, + WC_FUNC_NEW_SESSION_TICKET_DO, + WC_FUNC_SERVER_HELLO_DONE_SEND, + WC_FUNC_SERVER_HELLO_DONE_DO, + WC_FUNC_TICKET_SEND, + WC_FUNC_TICKET_DO, + WC_FUNC_CLIENT_KEY_EXCHANGE_SEND, + WC_FUNC_CLIENT_KEY_EXCHANGE_DO, + WC_FUNC_CERTIFICATE_STATUS_SEND, + WC_FUNC_CERTIFICATE_STATUS_DO, + WC_FUNC_SERVER_KEY_EXCHANGE_SEND, + WC_FUNC_SERVER_KEY_EXCHANGE_DO, + WC_FUNC_END_OF_EARLY_DATA_SEND, + WC_FUNC_END_OF_EARLY_DATA_DO, + WC_FUNC_COUNT +}; +#endif + +typedef void (*wolfSSL_Logging_cb)(const int logLevel, + const char *const logMessage); + +WOLFSSL_API int wolfSSL_SetLoggingCb(wolfSSL_Logging_cb log_function); +WOLFSSL_API wolfSSL_Logging_cb wolfSSL_GetLoggingCb(void); + +/* turn logging on, only if compiled in */ +WOLFSSL_API int wolfSSL_Debugging_ON(void); +/* turn logging off */ +WOLFSSL_API void wolfSSL_Debugging_OFF(void); + +WOLFSSL_API void wolfSSL_SetLoggingPrefix(const char* prefix); + +#ifdef HAVE_WC_INTROSPECTION + WOLFSSL_API const char *wolfSSL_configure_args(void); + WOLFSSL_API const char *wolfSSL_global_cflags(void); +#endif + + +#if (defined(OPENSSL_EXTRA) && !defined(_WIN32) && \ + !defined(NO_ERROR_QUEUE)) || defined(DEBUG_WOLFSSL_VERBOSE) \ + || defined(HAVE_MEMCACHED) +#define WOLFSSL_HAVE_ERROR_QUEUE +#endif + +#if defined(OPENSSL_EXTRA) || defined(DEBUG_WOLFSSL_VERBOSE) || defined(HAVE_MEMCACHED) + WOLFSSL_LOCAL int wc_LoggingInit(void); + WOLFSSL_LOCAL int wc_LoggingCleanup(void); + WOLFSSL_LOCAL int wc_AddErrorNode(int error, int line, char* buf, + char* file); + WOLFSSL_LOCAL int wc_PeekErrorNode(int idx, const char **file, + const char **reason, int *line); + WOLFSSL_LOCAL void wc_RemoveErrorNode(int idx); + WOLFSSL_LOCAL void wc_ClearErrorNodes(void); + WOLFSSL_LOCAL int wc_PullErrorNode(const char **file, const char **reason, + int *line); + WOLFSSL_API int wc_SetLoggingHeap(void* h); + WOLFSSL_API int wc_ERR_remove_state(void); + WOLFSSL_LOCAL unsigned long wc_PeekErrorNodeLineData( + const char **file, int *line, const char **data, int *flags, + int (*ignore_err)(int err)); + WOLFSSL_LOCAL int wc_GetErrorNodeErr(void); + #if !defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM) + WOLFSSL_API void wc_ERR_print_errors_fp(XFILE fp); + WOLFSSL_API void wc_ERR_print_errors_cb(int (*cb)(const char *str, + size_t len, void *u), void *u); + #endif +#endif /* OPENSSL_EXTRA || DEBUG_WOLFSSL_VERBOSE || HAVE_MEMCACHED */ + +#ifdef WOLFSSL_FUNC_TIME + /* WARNING: This code is only to be used for debugging performance. + * The code is not thread-safe. + * Do not use WOLFSSL_FUNC_TIME in production code. + */ + WOLFSSL_API void WOLFSSL_START(int funcNum); + WOLFSSL_API void WOLFSSL_END(int funcNum); + WOLFSSL_API void WOLFSSL_TIME(int count); +#else + #define WOLFSSL_START(n) WC_DO_NOTHING + #define WOLFSSL_END(n) WC_DO_NOTHING + #define WOLFSSL_TIME(n) WC_DO_NOTHING +#endif + +#if defined(DEBUG_WOLFSSL) && !defined(WOLFSSL_DEBUG_ERRORS_ONLY) + #if defined(_WIN32) + #if defined(INTIME_RTOS) + #define __func__ NULL + #else + #define __func__ __FUNCTION__ + #endif + #endif + + /* a is prepended to m and b is appended, creating a log msg a + m + b */ + #define WOLFSSL_LOG_CAT(a, m, b) #a " " m " " #b + + WOLFSSL_API void WOLFSSL_ENTER(const char* msg); + WOLFSSL_API void WOLFSSL_LEAVE(const char* msg, int ret); + #define WOLFSSL_STUB(m) \ + WOLFSSL_MSG(WOLFSSL_LOG_CAT(wolfSSL Stub, m, not implemented)) + WOLFSSL_API int WOLFSSL_IS_DEBUG_ON(void); +#if defined(XVSNPRINTF) && !defined(NO_WOLFSSL_MSG_EX) + WOLFSSL_API void WOLFSSL_MSG_EX(const char* fmt, ...); + #define HAVE_WOLFSSL_MSG_EX +#else + #ifdef WOLF_NO_VARIADIC_MACROS + #define WOLFSSL_MSG_EX() WC_DO_NOTHING + #else + #define WOLFSSL_MSG_EX(...) WC_DO_NOTHING + #endif +#endif + WOLFSSL_API void WOLFSSL_MSG(const char* msg); +#ifdef WOLFSSL_DEBUG_CODEPOINTS + WOLFSSL_API void WOLFSSL_MSG2( + const char *file, int line, const char* msg); + WOLFSSL_API void WOLFSSL_ENTER2( + const char *file, int line, const char* msg); + WOLFSSL_API void WOLFSSL_LEAVE2( + const char *file, int line, const char* msg, int ret); + #define WOLFSSL_MSG(msg) WOLFSSL_MSG2(__FILE__, __LINE__, msg) + #define WOLFSSL_ENTER(msg) WOLFSSL_ENTER2(__FILE__, __LINE__, msg) + #define WOLFSSL_LEAVE(msg, ret) WOLFSSL_LEAVE2(__FILE__, __LINE__, msg, ret) + #ifdef XVSNPRINTF + WOLFSSL_API void WOLFSSL_MSG_EX2( + const char *file, int line, const char* fmt, ...); + #define WOLFSSL_MSG_EX(fmt, args...) \ + WOLFSSL_MSG_EX2(__FILE__, __LINE__, fmt, ## args) + #else + #ifdef WOLF_NO_VARIADIC_MACROS + #define WOLFSSL_MSG_EX2() WC_DO_NOTHING + #else + #define WOLFSSL_MSG_EX2(...) WC_DO_NOTHING + #endif + #endif +#endif + WOLFSSL_API void WOLFSSL_BUFFER(const byte* buffer, word32 length); + +#else + + #define WOLFSSL_ENTER(m) WC_DO_NOTHING + #define WOLFSSL_LEAVE(m, r) WC_DO_NOTHING + #define WOLFSSL_STUB(m) WC_DO_NOTHING + #define WOLFSSL_IS_DEBUG_ON() 0 + + #ifdef WOLF_NO_VARIADIC_MACROS + /* note, modern preprocessors will generate errors with this definition. + * "error: macro "WOLFSSL_MSG_EX" passed 2 arguments, but takes just 0" + */ + #define WOLFSSL_MSG_EX() WC_DO_NOTHING + #else + #define WOLFSSL_MSG_EX(...) WC_DO_NOTHING + #endif + #define WOLFSSL_MSG(m) WC_DO_NOTHING + #define WOLFSSL_BUFFER(b, l) WC_DO_NOTHING + +#endif /* DEBUG_WOLFSSL && !WOLFSSL_DEBUG_ERRORS_ONLY */ + +#if defined(DEBUG_WOLFSSL) || defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) ||\ + defined(WOLFSSL_HAPROXY) || defined(OPENSSL_EXTRA) + + #ifdef WOLFSSL_HAVE_ERROR_QUEUE + WOLFSSL_API void WOLFSSL_ERROR_LINE(int err, const char* func, unsigned int line, + const char* file, void* ctx); + #ifdef WOLF_C89 + #define WOLFSSL_ERROR(x) \ + WOLFSSL_ERROR_LINE((x), __FILE__, __LINE__, __FILE__, NULL) + #else + #define WOLFSSL_ERROR(x) \ + WOLFSSL_ERROR_LINE((x), __func__, __LINE__, __FILE__, NULL) + #endif + #else + WOLFSSL_API void WOLFSSL_ERROR(int err); + #endif /* WOLFSSL_HAVE_ERROR_QUEUE */ + + WOLFSSL_API void WOLFSSL_ERROR_MSG(const char* msg); +#else + #define WOLFSSL_ERROR(e) (void)(e) + #define WOLFSSL_ERROR_MSG(m) (void)(m) +#endif /* DEBUG_WOLFSSL | OPENSSL_ALL || WOLFSSL_NGINX || WOLFSSL_HAPROXY || + OPENSSL_EXTRA */ + +#ifdef WOLFSSL_VERBOSE_ERRORS +#define WOLFSSL_ERROR_VERBOSE(e) WOLFSSL_ERROR(e) +#else +#define WOLFSSL_ERROR_VERBOSE(e) (void)(e) +#endif /* WOLFSSL_VERBOSE_ERRORS */ + +#ifdef HAVE_STACK_SIZE_VERBOSE + extern WOLFSSL_API THREAD_LS_T unsigned char *StackSizeCheck_myStack; + extern WOLFSSL_API THREAD_LS_T size_t StackSizeCheck_stackSize; + extern WOLFSSL_API THREAD_LS_T size_t StackSizeCheck_stackSizeHWM; + extern WOLFSSL_API THREAD_LS_T size_t *StackSizeCheck_stackSizeHWM_ptr; + extern WOLFSSL_API THREAD_LS_T void *StackSizeCheck_stackOffsetPointer; +#endif + +/* Port-specific includes and printf methods: */ + +#if defined(ARDUINO) + /* implemented in Arduino wolfssl.h */ + extern WOLFSSL_API int wolfSSL_Arduino_Serial_Print(const char* const s); +#elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX) + /* see wc_port.h for fio.h and nio.h includes */ +#elif defined(WOLFSSL_SGX) + /* Declare sprintf for ocall */ + int sprintf(char* buf, const char *fmt, ...); +#elif defined(WOLFSSL_DEOS) +#elif defined(MICRIUM) + #if (BSP_SER_COMM_EN == DEF_ENABLED) + #include <bsp_ser.h> + #endif +#elif defined(WOLFSSL_USER_LOG) + /* user includes their own headers */ +#elif defined(WOLFSSL_ESPIDF) + #include "esp_types.h" + #include "esp_log.h" +#elif defined(WOLFSSL_TELIT_M2MB) + #include <stdio.h> + #include "m2m_log.h" +#elif defined(WOLFSSL_ANDROID_DEBUG) + #include <android/log.h> +#elif defined(WOLFSSL_XILINX) + #include "xil_printf.h" +#elif defined(WOLFSSL_LINUXKM) + /* the requisite linux/kernel.h is included in linuxkm_wc_port.h, with + * incompatible warnings masked out. + */ +#elif defined(FUSION_RTOS) + #include <fclstdio.h> + #define fprintf FCL_FPRINTF +#else + #include <stdio.h> /* for default printf stuff */ +#endif + +#if defined(THREADX) && !defined(THREADX_NO_DC_PRINTF) + int dc_log_printf(char*, ...); +#endif + +#ifdef WOLFSSL_DEBUG_PRINTF_FN + /* user-supplied definition */ +#elif defined(ARDUINO) + /* ARDUINO only has print and sprintf, no printf. */ +#elif defined(WOLFSSL_LOG_PRINTF) || defined(WOLFSSL_DEOS) + #define WOLFSSL_DEBUG_PRINTF_FN printf +#elif defined(THREADX) && !defined(THREADX_NO_DC_PRINTF) + #define WOLFSSL_DEBUG_PRINTF_FN dc_log_printf +#elif defined(MICRIUM) + #define WOLFSSL_DEBUG_PRINTF_FN BSP_Ser_Printf +#elif defined(WOLFSSL_MDK_ARM) + #define WOLFSSL_DEBUG_PRINTF_FN printf +#elif defined(WOLFSSL_UTASKER) + /* WOLFSSL_UTASKER only has fnDebugMsg and related primitives, no printf. */ +#elif defined(MQX_USE_IO_OLD) + #define WOLFSSL_DEBUG_PRINTF_FN fprintf + #define WOLFSSL_DEBUG_PRINTF_FIRST_ARGS _mqxio_stderr, +#elif defined(WOLFSSL_APACHE_MYNEWT) + #define WOLFSSL_DEBUG_PRINTF_FN LOG_DEBUG + #define WOLFSSL_DEBUG_PRINTF_FIRST_ARGS &mynewt_log, LOG_MODULE_DEFAULT, +#elif defined(WOLFSSL_ESPIDF) + #define WOLFSSL_DEBUG_PRINTF_FN ESP_LOGI + #define WOLFSSL_DEBUG_PRINTF_FIRST_ARGS "wolfssl", +#elif defined(WOLFSSL_ZEPHYR) + #define WOLFSSL_DEBUG_PRINTF_FN printk +#elif defined(WOLFSSL_TELIT_M2MB) + #define WOLFSSL_DEBUG_PRINTF_FN M2M_LOG_INFO +#elif defined(WOLFSSL_ANDROID_DEBUG) + #define WOLFSSL_DEBUG_PRINTF_FN __android_log_print + #define WOLFSSL_DEBUG_PRINTF_FIRST_ARGS ANDROID_LOG_VERBOSE, "[wolfSSL]" +#elif defined(WOLFSSL_XILINX) + #define WOLFSSL_DEBUG_PRINTF_FN xil_printf +#elif defined(WOLFSSL_LINUXKM) + #define WOLFSSL_DEBUG_PRINTF_FN printk +#elif defined(WOLFSSL_RENESAS_RA6M4) + #define WOLFSSL_DEBUG_PRINTF_FN myprintf +#else + #define WOLFSSL_DEBUG_PRINTF_FN fprintf + #define WOLFSSL_DEBUG_PRINTF_FIRST_ARGS stderr, +#endif + +#ifndef WOLFSSL_DEBUG_PRINTF_FIRST_ARGS + #define WOLFSSL_DEBUG_PRINTF_FIRST_ARGS +#endif + +#if defined(WOLFSSL_DEBUG_PRINTF_FN) && !defined(WOLFSSL_DEBUG_PRINTF) && \ + !defined(WOLF_NO_VARIADIC_MACROS) + #define WOLFSSL_DEBUG_PRINTF(...) \ + WOLFSSL_DEBUG_PRINTF_FN(WOLFSSL_DEBUG_PRINTF_FIRST_ARGS __VA_ARGS__) +#endif + +#ifdef __cplusplus +} +#endif +#endif /* WOLFSSL_LOGGING_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/md2.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/md2.h @@ -0,0 +1,83 @@ +/* md2.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/md2.h +*/ + + +#ifndef WOLF_CRYPT_MD2_H +#define WOLF_CRYPT_MD2_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef WOLFSSL_MD2 + +#ifdef __cplusplus + extern "C" { +#endif + +/* in bytes */ +enum { + WC_MD2_BLOCK_SIZE = 16, + WC_MD2_DIGEST_SIZE = 16, + WC_MD2_PAD_SIZE = 16, + WC_MD2_X_SIZE = 48 +}; + + +/* Md2 digest */ +typedef struct wc_Md2 { + word32 count; /* bytes % PAD_SIZE */ + byte X[WC_MD2_X_SIZE]; + byte C[WC_MD2_BLOCK_SIZE]; + byte buffer[WC_MD2_BLOCK_SIZE]; +} wc_Md2; + + +WOLFSSL_API void wc_InitMd2(wc_Md2* md2); +WOLFSSL_API void wc_Md2Update(wc_Md2* md2, const byte* data, word32 len); +WOLFSSL_API void wc_Md2Final(wc_Md2* md2, byte* hash); +WOLFSSL_API int wc_Md2Hash(const byte* data, word32 len, byte* hash); + +#ifndef OPENSSL_COEXIST + +enum { + MD2 = WC_HASH_TYPE_MD2, + MD2_BLOCK_SIZE = WC_MD2_BLOCK_SIZE, + MD2_DIGEST_SIZE = WC_MD2_DIGEST_SIZE, + MD2_PAD_SIZE = WC_MD2_PAD_SIZE, + MD2_X_SIZE = WC_MD2_X_SIZE +}; + + +/* Md2 digest */ +typedef struct wc_Md2 Md2; + +#endif /* !OPENSSL_COEXIST */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_MD2 */ +#endif /* WOLF_CRYPT_MD2_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/md4.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/md4.h @@ -0,0 +1,77 @@ +/* md4.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/md4.h +*/ + +#ifndef WOLF_CRYPT_MD4_H +#define WOLF_CRYPT_MD4_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifndef NO_MD4 + +#ifdef __cplusplus + extern "C" { +#endif + +/* in bytes */ +enum { + WC_MD4_BLOCK_SIZE = 64, + WC_MD4_DIGEST_SIZE = 16, + WC_MD4_PAD_SIZE = 56 +}; + +/* MD4 digest */ +typedef struct wc_Md4 { + word32 buffLen; /* in bytes */ + word32 loLen; /* length in bytes */ + word32 hiLen; /* length in bytes */ + word32 digest[WC_MD4_DIGEST_SIZE / sizeof(word32)]; + word32 buffer[WC_MD4_BLOCK_SIZE / sizeof(word32)]; +} wc_Md4; + +WOLFSSL_API void wc_InitMd4(wc_Md4* md4); +WOLFSSL_API void wc_Md4Update(wc_Md4* md4, const byte* data, word32 len); +WOLFSSL_API void wc_Md4Final(wc_Md4* md4, byte* hash); + +#ifndef OPENSSL_COEXIST + +enum { + MD4 = WC_HASH_TYPE_MD4, + MD4_BLOCK_SIZE = WC_MD4_BLOCK_SIZE, + MD4_DIGEST_SIZE = WC_MD4_DIGEST_SIZE, + MD4_PAD_SIZE = WC_MD4_PAD_SIZE +}; + +typedef struct wc_Md4 Md4; + +#endif /* !OPENSSL_COEXIST */ + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* NO_MD4 */ +#endif /* WOLF_CRYPT_MD4_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/md5.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/md5.h @@ -0,0 +1,136 @@ +/* md5.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/md5.h +*/ + + +#ifndef WOLF_CRYPT_MD5_H +#define WOLF_CRYPT_MD5_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifndef NO_MD5 + +#ifdef HAVE_FIPS + #define wc_InitMd5 InitMd5 + #define wc_Md5Update Md5Update + #define wc_Md5Final Md5Final + #define wc_Md5Hash Md5Hash +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +#ifndef NO_OLD_MD5_NAME + #define MD5 WC_MD5 +#endif + +#ifndef NO_OLD_WC_NAMES + #define Md5 wc_Md5 + #define MD5_BLOCK_SIZE WC_MD5_BLOCK_SIZE + #define MD5_DIGEST_SIZE WC_MD5_DIGEST_SIZE + #define WC_MD5_PAD_SIZE WC_MD5_PAD_SIZE +#endif + +/* in bytes */ +enum { + WC_MD5 = WC_HASH_TYPE_MD5, + WC_MD5_BLOCK_SIZE = 64, + WC_MD5_DIGEST_SIZE = 16, + WC_MD5_PAD_SIZE = 56 +}; + + +#ifdef WOLFSSL_MICROCHIP_PIC32MZ + #include <wolfssl/wolfcrypt/port/pic32/pic32mz-crypt.h> +#endif +#if defined(STM32_HASH) && !defined(STM32_NOMD5) + #include <wolfssl/wolfcrypt/port/st/stm32.h> +#endif +#ifdef WOLFSSL_ASYNC_CRYPT + #include <wolfssl/wolfcrypt/async.h> +#endif + +#ifdef WOLFSSL_TI_HASH + #include "wolfssl/wolfcrypt/port/ti/ti-hash.h" +#elif defined(WOLFSSL_IMX6_CAAM) && !defined(WOLFSSL_QNX_CAAM) + #include "wolfssl/wolfcrypt/port/caam/wolfcaam_sha.h" +#else + +/* MD5 digest */ +typedef struct wc_Md5 { +#if defined(STM32_HASH) && !defined(STM32_NOMD5) + STM32_HASH_Context stmCtx; +#else + word32 buffLen; /* in bytes */ + word32 loLen; /* length in bytes */ + word32 hiLen; /* length in bytes */ + word32 buffer[WC_MD5_BLOCK_SIZE / sizeof(word32)]; +#ifdef WOLFSSL_PIC32MZ_HASH + word32 digest[PIC32_DIGEST_SIZE / sizeof(word32)]; +#else + word32 digest[WC_MD5_DIGEST_SIZE / sizeof(word32)]; +#endif + void* heap; +#ifdef WOLFSSL_PIC32MZ_HASH + hashUpdCache cache; /* cache for updates */ +#endif +#endif /* STM32_HASH */ +#ifdef WOLFSSL_ASYNC_CRYPT + WC_ASYNC_DEV asyncDev; +#endif /* WOLFSSL_ASYNC_CRYPT */ +#ifdef WOLFSSL_HASH_FLAGS + word32 flags; /* enum wc_HashFlags in hash.h */ +#endif +} wc_Md5; + +#endif /* WOLFSSL_TI_HASH */ + +WOLFSSL_API int wc_InitMd5(wc_Md5* md5); +WOLFSSL_API int wc_InitMd5_ex(wc_Md5* md5, void* heap, int devId); +WOLFSSL_API int wc_Md5Update(wc_Md5* md5, const byte* data, word32 len); +WOLFSSL_API int wc_Md5Final(wc_Md5* md5, byte* hash); +WOLFSSL_API void wc_Md5Free(wc_Md5* md5); +#if defined(OPENSSL_EXTRA) || defined(HAVE_CURL) +WOLFSSL_API int wc_Md5Transform(wc_Md5* md5, const byte* data); +#endif + +WOLFSSL_API int wc_Md5GetHash(wc_Md5* md5, byte* hash); +WOLFSSL_API int wc_Md5Copy(wc_Md5* src, wc_Md5* dst); + +#ifdef WOLFSSL_PIC32MZ_HASH +WOLFSSL_API void wc_Md5SizeSet(wc_Md5* md5, word32 len); +#endif + +#ifdef WOLFSSL_HASH_FLAGS + WOLFSSL_API int wc_Md5SetFlags(wc_Md5* md5, word32 flags); + WOLFSSL_API int wc_Md5GetFlags(wc_Md5* md5, word32* flags); +#endif + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* NO_MD5 */ +#endif /* WOLF_CRYPT_MD5_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/mem_track.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/mem_track.h @@ -0,0 +1,821 @@ +/* mem_track.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* Memory and stack use tracking */ + +#ifndef WOLFSSL_MEM_TRACK_H +#define WOLFSSL_MEM_TRACK_H + +/* The memory tracker overrides the wolfSSL memory callback system and uses a + * static to track the total, peak and currently allocated bytes. + * + * If you are already using the memory callbacks then enabling this will + * override the memory callbacks and prevent your memory callbacks from + * working. This assumes malloc() and free() are available. Feel free to + * customize this for your needs. + + * The enable this feature define the following: + * #define USE_WOLFSSL_MEMORY + * #define WOLFSSL_TRACK_MEMORY + * + * On startup call: + * InitMemoryTracker(); + * + * When ready to dump the memory report call: + * ShowMemoryTracker(); + * + * Report example: + * total Allocs = 228 + * total Bytes = 93442 + * peak Bytes = 8840 + * current Bytes = 0 + * + * + * You can also: + * #define WOLFSSL_DEBUG_MEMORY + * + * To print every alloc/free along with the function and line number. + * Example output: + * Alloc: 0x7fa14a500010 -> 120 at wc_InitRng:496 + * Free: 0x7fa14a500010 -> 120 at wc_FreeRng:606 + */ + +#include "wolfssl/wolfcrypt/settings.h" +#include "wolfssl/wolfcrypt/types.h" +#include "wolfssl/wolfcrypt/logging.h" +#include "wolfssl/wolfcrypt/error-crypt.h" +#include "wolfssl/wolfcrypt/memory.h" + +#if defined(WOLFSSL_TRACK_MEMORY) || defined(HAVE_STACK_SIZE) || \ + defined(HAVE_STACK_SIZE_VERBOSE) + #ifdef NO_STDIO_FILESYSTEM + /* if wc_port.h/linuxkm_wc_port.h doesn't define printf, then the user + * needs to define it. + */ + #define wc_mem_printf(...) printf(__VA_ARGS__) + #else + #include <stdio.h> + #define wc_mem_printf(...) fprintf(stderr, __VA_ARGS__) + #endif +#endif + +/* Track Memory */ +#if defined(WOLFSSL_TRACK_MEMORY) && defined(USE_WOLFSSL_MEMORY) && \ + !defined(WOLFSSL_STATIC_MEMORY) + +#define DO_MEM_STATS +#if (defined(__linux__) && !defined(WOLFSSL_LINUXKM)) || defined(__MACH__) + #define DO_MEM_LIST +#endif + +typedef struct memoryStats { + long totalAllocs; /* number of allocations */ + long totalDeallocs; /* number of deallocations */ + long totalBytes; /* total number of bytes allocated */ + long peakBytes; /* concurrent max bytes */ + long currentBytes; /* total current bytes in use */ +#ifdef WOLFSSL_TRACK_MEMORY_VERBOSE + long peakAllocsTripOdometer; /* peak number of concurrent allocations, + * subject to reset by + * wolfCrypt_heap_peak_checkpoint() + */ + long peakBytesTripOdometer; /* peak concurrent bytes, subject to reset + * by wolfCrypt_heap_peak_checkpoint() + */ +#endif +} memoryStats; + +typedef struct memHint { + size_t thisSize; /* size of this memory */ + +#ifdef DO_MEM_LIST + struct memHint* next; + struct memHint* prev; + #ifdef WOLFSSL_DEBUG_MEMORY + const char* func; + unsigned int line; + #endif +#endif + void* thisMemory; /* actual memory for user */ +} memHint; + +typedef struct memoryTrack { + union { + memHint hint; + /* make sure we have strong alignment */ + byte alignit[sizeof(memHint) + ((16-1) & ~(16-1))]; + } u; +} memoryTrack; + +#ifdef DO_MEM_LIST +/* track allocations and report at end */ +typedef struct memoryList { + memHint* head; + memHint* tail; + word32 count; +} memoryList; +#endif + + +static memoryStats ourMemStats; + +#ifdef DO_MEM_LIST + #include <pthread.h> + static memoryList ourMemList; + static pthread_mutex_t memLock = PTHREAD_MUTEX_INITIALIZER; +#endif + +#ifdef WOLFSSL_DEBUG_MEMORY +static WC_INLINE void* TrackMalloc(size_t sz, const char* func, + unsigned int line) +#else +static WC_INLINE void* TrackMalloc(size_t sz) +#endif +{ + memoryTrack* mt; + memHint* header; + + if (sz == 0) + return NULL; + +#ifdef FREERTOS + mt = (memoryTrack*)pvPortMalloc(sizeof(memoryTrack) + sz); /* native heap */ +#else + mt = (memoryTrack*)malloc(sizeof(memoryTrack) + sz); /* native heap */ +#endif + if (mt == NULL) + return NULL; + + header = &mt->u.hint; + header->thisSize = sz; + header->thisMemory = (byte*)mt + sizeof(memoryTrack); + +#ifdef WOLFSSL_DEBUG_MEMORY +#ifdef WOLFSSL_DEBUG_MEMORY_PRINT + wc_mem_printf("Alloc: %p -> %u at %s:%d\n", + header->thisMemory, (word32)sz, func, line); +#else + (void)func; + (void)line; +#endif +#endif +#if !defined(SINGLE_THREADED) && (defined(DO_MEM_LIST) || defined(DO_MEM_STATS)) + if (pthread_mutex_lock(&memLock) == 0) + { +#endif + +#ifdef DO_MEM_STATS + ourMemStats.totalAllocs++; + ourMemStats.totalBytes += sz; + ourMemStats.currentBytes += sz; + #ifdef WOLFSSL_TRACK_MEMORY_VERBOSE + if (ourMemStats.peakAllocsTripOdometer < ourMemStats.totalAllocs - + ourMemStats.totalDeallocs) { + ourMemStats.peakAllocsTripOdometer = ourMemStats.totalAllocs - + ourMemStats.totalDeallocs; + } + if (ourMemStats.peakBytesTripOdometer < ourMemStats.currentBytes) + #endif + { + #ifdef WOLFSSL_TRACK_MEMORY_VERBOSE + ourMemStats.peakBytesTripOdometer = ourMemStats.currentBytes; + #endif + if (ourMemStats.currentBytes > ourMemStats.peakBytes) + ourMemStats.peakBytes = ourMemStats.currentBytes; + } + +#endif /* DO_MEM_STATS */ + +#ifdef DO_MEM_LIST + #ifdef WOLFSSL_DEBUG_MEMORY + header->func = func; + header->line = line; + #endif + + /* Setup event */ + header->next = NULL; + if (ourMemList.tail == NULL) { + ourMemList.head = header; + header->prev = NULL; + } + else { + ourMemList.tail->next = header; + header->prev = ourMemList.tail; + } + ourMemList.tail = header; /* add to the end either way */ + ourMemList.count++; +#endif +#if !defined(SINGLE_THREADED) && (defined(DO_MEM_LIST) || defined(DO_MEM_STATS)) + pthread_mutex_unlock(&memLock); + } +#endif /* DO_MEM_LIST */ + + return header->thisMemory; +} + + +#ifdef WOLFSSL_DEBUG_MEMORY +static WC_INLINE void TrackFree(void* ptr, const char* func, unsigned int line) +#else +static WC_INLINE void TrackFree(void* ptr) +#endif +{ + memoryTrack* mt; + memHint* header; + size_t sz; + + if (ptr == NULL) { + return; + } + + mt = (memoryTrack*)((byte*)ptr - sizeof(memoryTrack)); + header = &mt->u.hint; + sz = header->thisSize; + +#if !defined(SINGLE_THREADED) && (defined(DO_MEM_LIST) || defined(DO_MEM_STATS)) + if (pthread_mutex_lock(&memLock) == 0) + { +#endif + +#ifdef DO_MEM_STATS + ourMemStats.currentBytes -= header->thisSize; + ourMemStats.totalDeallocs++; +#endif + +#ifdef DO_MEM_LIST + if (header == ourMemList.head && header == ourMemList.tail) { + ourMemList.head = NULL; + ourMemList.tail = NULL; + } + else if (header == ourMemList.head) { + ourMemList.head = header->next; + ourMemList.head->prev = NULL; + } + else if (header == ourMemList.tail) { + ourMemList.tail = header->prev; + ourMemList.tail->next = NULL; + } + else { + memHint* next = header->next; + memHint* prev = header->prev; + if (next) + next->prev = prev; + if (prev) + prev->next = next; + } + ourMemList.count--; +#endif + +#if !defined(SINGLE_THREADED) && (defined(DO_MEM_LIST) || defined(DO_MEM_STATS)) + pthread_mutex_unlock(&memLock); + } +#endif + +#ifdef WOLFSSL_DEBUG_MEMORY +#ifdef WOLFSSL_DEBUG_MEMORY_PRINT + wc_mem_printf("Free: %p -> %u at %s:%d\n", ptr, (word32)sz, func, line); +#else + (void)func; + (void)line; +#endif +#endif + (void)sz; + +#ifdef FREERTOS + vPortFree(mt); /* native heap */ +#else + free(mt); /* native heap */ +#endif +} + + +#ifdef WOLFSSL_DEBUG_MEMORY +static WC_INLINE void* TrackRealloc(void* ptr, size_t sz, const char* func, + unsigned int line) +#else +static WC_INLINE void* TrackRealloc(void* ptr, size_t sz) +#endif +{ +#ifdef WOLFSSL_DEBUG_MEMORY + void* ret = TrackMalloc(sz, func, line); +#else + void* ret = TrackMalloc(sz); +#endif + + if (ptr) { + /* if realloc is bigger, don't overread old ptr */ + memoryTrack* mt; + memHint* header; + + mt = (memoryTrack*)((byte*)ptr - sizeof(memoryTrack)); + header = &mt->u.hint; + + if (header->thisSize < sz) + sz = header->thisSize; + } + + if (ret && ptr) + XMEMCPY(ret, ptr, sz); + + if (ret) { + #ifdef WOLFSSL_DEBUG_MEMORY + TrackFree(ptr, func, line); + #else + TrackFree(ptr); + #endif + } + + return ret; +} + +static wolfSSL_Malloc_cb mfDefault = NULL; +static wolfSSL_Free_cb ffDefault = NULL; +static wolfSSL_Realloc_cb rfDefault = NULL; + +static WC_INLINE int InitMemoryTracker(void) +{ + int ret; + + ret = wolfSSL_GetAllocators(&mfDefault, &ffDefault, &rfDefault); + if (ret < 0) { + wc_mem_printf("wolfSSL GetAllocators failed to get the defaults\n"); + } + ret = wolfSSL_SetAllocators(TrackMalloc, TrackFree, TrackRealloc); + if (ret < 0) { + wc_mem_printf("wolfSSL SetAllocators failed for track memory\n"); + return ret; + } + +#ifdef DO_MEM_LIST + if (pthread_mutex_lock(&memLock) == 0) +#endif + { + #ifdef DO_MEM_STATS + ourMemStats.totalAllocs = 0; + ourMemStats.totalDeallocs = 0; + ourMemStats.totalBytes = 0; + ourMemStats.peakBytes = 0; + ourMemStats.currentBytes = 0; + #ifdef WOLFSSL_TRACK_MEMORY_VERBOSE + ourMemStats.peakAllocsTripOdometer = 0; + ourMemStats.peakBytesTripOdometer = 0; + #endif + #endif /* DO_MEM_STATS */ + + #ifdef DO_MEM_LIST + XMEMSET(&ourMemList, 0, sizeof(ourMemList)); + + pthread_mutex_unlock(&memLock); + #endif + } + + return ret; +} + +static WC_INLINE void ShowMemoryTracker(void) +{ +#ifdef DO_MEM_LIST + if (pthread_mutex_lock(&memLock) == 0) +#endif + { + #ifdef DO_MEM_STATS + wc_mem_printf("total Allocs = %9ld\n", ourMemStats.totalAllocs); + wc_mem_printf("total Deallocs = %9ld\n", ourMemStats.totalDeallocs); + wc_mem_printf("total Bytes = %9ld\n", ourMemStats.totalBytes); + wc_mem_printf("peak Bytes = %9ld\n", ourMemStats.peakBytes); + wc_mem_printf("current Bytes = %9ld\n", ourMemStats.currentBytes); + #endif + + #ifdef DO_MEM_LIST + if (ourMemList.count > 0) { + /* print list of allocations */ + memHint* header; + for (header = ourMemList.head; + header != NULL; + header = header->next) { + #ifdef WOLFSSL_DEBUG_MEMORY + wc_mem_printf("Leak: Ptr %p, Size %u, Func %s, Line %d\n", + (byte*)header + sizeof(memHint), + (unsigned int)header->thisSize, header->func, header->line); + #else + wc_mem_printf("Leak: Ptr %p, Size %u\n", + (byte*)header + sizeof(memHint), + (unsigned int)header->thisSize); + #endif + } + } + + pthread_mutex_unlock(&memLock); + #endif + } +} + +static WC_INLINE int CleanupMemoryTracker(void) +{ + /* restore default allocators */ + return wolfSSL_SetAllocators(mfDefault, ffDefault, rfDefault); +} +#endif /* WOLFSSL_TRACK_MEMORY && USE_WOLFSSL_MEMORY && \ + !WOLFSSL_STATIC_MEMORY */ + + +#ifdef HAVE_STACK_SIZE + +#include <stdio.h> +#include <pthread.h> +#include <errno.h> +#include <sched.h> +#include <unistd.h> + +typedef void* (*thread_func)(void* args); +#define STACK_CHECK_VAL 0x01 + +struct stack_size_debug_context { + unsigned char *myStack; + size_t stackSize; +#ifdef HAVE_STACK_SIZE_VERBOSE + size_t *stackSizeHWM_ptr; + thread_func fn; + void *args; +#endif +}; + +struct func_args; /* forward declaration */ + +#ifdef HAVE_STACK_SIZE_VERBOSE + +/* per-subtest stack high water mark tracking. + * + * enable with + * + * ./configure --enable-stacksize=verbose [...] + */ + +static void* debug_stack_size_verbose_shim( + struct stack_size_debug_context *shim_args) +{ + StackSizeCheck_myStack = shim_args->myStack; + StackSizeCheck_stackSize = shim_args->stackSize; + StackSizeCheck_stackSizeHWM_ptr = shim_args->stackSizeHWM_ptr; + return shim_args->fn(shim_args->args); +} + +static WC_INLINE int StackSizeSetOffset(const char *funcname, void *p) +{ + if (StackSizeCheck_myStack == NULL) + return -BAD_FUNC_ARG; + + StackSizeCheck_stackOffsetPointer = p; + + printf("setting stack relative offset reference mark in %s to +%lu\n", + funcname, (unsigned long)((char*)(StackSizeCheck_myStack + + StackSizeCheck_stackSize) - (char *)p)); + + return 0; +} + +static WC_INLINE ssize_t StackSizeHWM(void) +{ + size_t i; + ssize_t used; + + if (StackSizeCheck_myStack == NULL) + return -BAD_FUNC_ARG; + + for (i = 0; i < StackSizeCheck_stackSize; i++) { + if (StackSizeCheck_myStack[i] != STACK_CHECK_VAL) { + break; + } + } + + used = StackSizeCheck_stackSize - i; + if ((ssize_t)*StackSizeCheck_stackSizeHWM_ptr < used) + *StackSizeCheck_stackSizeHWM_ptr = used; + + return used; +} + +static WC_INLINE ssize_t StackSizeHWM_OffsetCorrected(void) +{ + ssize_t used = StackSizeHWM(); + if (used < 0) + return used; + if (StackSizeCheck_stackOffsetPointer) { + used -= (ssize_t)(((char *)StackSizeCheck_myStack + + StackSizeCheck_stackSize) - + (char *)StackSizeCheck_stackOffsetPointer); + } + return used; +} + +static +#ifdef __GNUC__ +__attribute__((unused)) __attribute__((noinline)) +#endif +int StackSizeHWMReset(void) +{ + volatile ssize_t i; + + if (StackSizeCheck_myStack == NULL) + return -BAD_FUNC_ARG; + + for (i = (ssize_t)((char *)&i - (char *)StackSizeCheck_myStack) - + (ssize_t)sizeof(i) - 1; i >= 0; --i) { + StackSizeCheck_myStack[i] = STACK_CHECK_VAL; + } + + return 0; +} + +#define STACK_SIZE_CHECKPOINT(...) ({ \ + ssize_t HWM = StackSizeHWM_OffsetCorrected(); \ + __VA_ARGS__; \ + printf(" relative stack peak usage = %ld bytes\n", (long int)HWM); \ + StackSizeHWMReset(); \ + }) + +#define STACK_SIZE_CHECKPOINT_MSG(msg) ({ \ + ssize_t HWM = StackSizeHWM_OffsetCorrected(); \ + wc_mem_printf("%ld\t%s\n", (long int)HWM, msg); \ + StackSizeHWMReset(); \ + }) + +#define STACK_SIZE_CHECKPOINT_WITH_MAX_CHECK(max, ...) ({ \ + ssize_t HWM = StackSizeHWM_OffsetCorrected(); \ + int _ret; \ + __VA_ARGS__; \ + printf(" relative stack peak usage = %ld bytes\n", (long int)HWM); \ + _ret = StackSizeHWMReset(); \ + if ((max >= 0) && (HWM > (ssize_t)(max))) { \ + wc_mem_printf( \ + " relative stack usage at %s L%d exceeds designated " \ + "max %ld bytes.\n", \ + __FILE__, __LINE__, (long int)(max)); \ + _ret = -1; \ + } \ + _ret; \ + }) + + +#if defined(__GNUC__) || defined(__clang__) +#define STACK_SIZE_INIT() \ + (void)StackSizeSetOffset(__FUNCTION__, __builtin_frame_address(0)) +#endif + +#endif /* HAVE_STACK_SIZE_VERBOSE */ + +static WC_INLINE int StackSizeCheck(struct func_args* args, thread_func tf) +{ + size_t i; + int ret; + void* status; + unsigned char* myStack = NULL; + size_t stackSize = 1024*1024*2; + pthread_attr_t myAttr; + pthread_t threadId; +#ifdef HAVE_STACK_SIZE_VERBOSE + struct stack_size_debug_context shim_args; +#endif + +#ifdef PTHREAD_STACK_MIN + if (stackSize < (size_t)PTHREAD_STACK_MIN) + stackSize = PTHREAD_STACK_MIN; +#endif + + ret = posix_memalign((void**)&myStack, sysconf(_SC_PAGESIZE), stackSize); /* native heap */ + if (ret != 0 || myStack == NULL) { + wc_mem_printf("posix_memalign failed\n"); + return -1; + } + + XMEMSET(myStack, STACK_CHECK_VAL, stackSize); + + ret = pthread_attr_init(&myAttr); + if (ret != 0) { + wc_mem_printf("attr_init failed\n"); + return ret; + } + + ret = pthread_attr_setstack(&myAttr, myStack, stackSize); + if (ret != 0) { + wc_mem_printf("attr_setstackaddr failed\n"); + return ret; + } + +#ifdef HAVE_STACK_SIZE_VERBOSE + StackSizeCheck_stackSizeHWM = 0; + shim_args.myStack = myStack; + shim_args.stackSize = stackSize; + shim_args.stackSizeHWM_ptr = &StackSizeCheck_stackSizeHWM; + shim_args.fn = tf; + shim_args.args = args; + ret = pthread_create(&threadId, &myAttr, + (thread_func)debug_stack_size_verbose_shim, (void *)&shim_args); +#else + ret = pthread_create(&threadId, &myAttr, tf, args); +#endif + if (ret != 0) { + printf("ret = %d\n", ret); + perror("pthread_create failed"); + exit(EXIT_FAILURE); + } + + ret = pthread_join(threadId, &status); + if (ret != 0) { + wc_mem_printf("pthread_join failed\n"); + return ret; + } + + for (i = 0; i < stackSize; i++) { + if (myStack[i] != STACK_CHECK_VAL) { + break; + } + } + + free(myStack); /* native heap */ +#ifdef HAVE_STACK_SIZE_VERBOSE + printf("stack used = %lu\n", StackSizeCheck_stackSizeHWM > (stackSize - i) + ? (unsigned long)StackSizeCheck_stackSizeHWM + : (unsigned long)(stackSize - i)); + StackSizeCheck_myStack = NULL; + StackSizeCheck_stackOffsetPointer = NULL; +#else + { + size_t used = stackSize - i; + printf("stack used = %lu\n", (unsigned long)used); + } +#endif + + return (int)((size_t)status); +} + +static WC_INLINE int StackSizeCheck_launch(struct func_args* args, + thread_func tf, pthread_t *threadId, void **stack_context) +{ + int ret; + unsigned char* myStack = NULL; + size_t stackSize = 1024*1024*2; + pthread_attr_t myAttr; + struct stack_size_debug_context* shim_args; + +#ifdef PTHREAD_STACK_MIN + if (stackSize < (size_t)PTHREAD_STACK_MIN) + stackSize = PTHREAD_STACK_MIN; +#endif + + shim_args = (struct stack_size_debug_context *)malloc(sizeof *shim_args); /* native heap */ + if (shim_args == NULL) { + perror("malloc"); + return -1; + } + + ret = posix_memalign((void**)&myStack, sysconf(_SC_PAGESIZE), stackSize); /* native heap */ + if (ret != 0 || myStack == NULL) { + wc_mem_printf("posix_memalign failed\n"); + free(shim_args); /* native heap */ + return -1; + } + + XMEMSET(myStack, STACK_CHECK_VAL, stackSize); + + ret = pthread_attr_init(&myAttr); + if (ret != 0) { + wc_mem_printf("attr_init failed\n"); + free(shim_args); /* native heap */ + free(myStack); /* native heap */ + return ret; + } + + ret = pthread_attr_setstack(&myAttr, myStack, stackSize); + if (ret != 0) { + wc_mem_printf("attr_setstackaddr failed\n"); + } + + shim_args->myStack = myStack; + shim_args->stackSize = stackSize; +#ifdef HAVE_STACK_SIZE_VERBOSE + shim_args->stackSizeHWM_ptr = &StackSizeCheck_stackSizeHWM; + shim_args->fn = tf; + shim_args->args = args; + ret = pthread_create(threadId, &myAttr, + (thread_func)debug_stack_size_verbose_shim, (void *)shim_args); +#else + ret = pthread_create(threadId, &myAttr, tf, args); +#endif + if (ret != 0) { + fprintf(stderr,"pthread_create failed: %s",strerror(ret)); + exit(EXIT_FAILURE); + } + + *stack_context = (void *)shim_args; + + return 0; +} + +static WC_INLINE int StackSizeCheck_reap(pthread_t threadId, + void *stack_context) +{ + struct stack_size_debug_context *shim_args = + (struct stack_size_debug_context *)stack_context; + size_t i; + void *status; + int ret = pthread_join(threadId, &status); + if (ret != 0) { + wc_mem_printf("pthread_join failed\n"); + return ret; + } + + for (i = 0; i < shim_args->stackSize; i++) { + if (shim_args->myStack[i] != STACK_CHECK_VAL) { + break; + } + } + + free(shim_args->myStack); /* native heap */ +#ifdef HAVE_STACK_SIZE_VERBOSE + printf("stack used = %lu\n", + *shim_args->stackSizeHWM_ptr > (shim_args->stackSize - i) + ? (unsigned long)*shim_args->stackSizeHWM_ptr + : (unsigned long)(shim_args->stackSize - i)); +#else + { + size_t used = shim_args->stackSize - i; + printf("stack used = %lu\n", (unsigned long)used); + } +#endif + free(shim_args); /* native heap */ + + return (int)((size_t)status); +} + +#endif /* HAVE_STACK_SIZE */ + + +#ifdef STACK_TRAP + +/* good settings + ./configure --enable-debug --disable-shared C_EXTRA_FLAGS="-DUSER_TIME \ + -DTFM_TIMING_RESISTANT -DPOSITIVE_EXP_ONLY -DSTACK_TRAP" + +*/ + +#ifdef HAVE_STACK_SIZE + /* client only for now, setrlimit will fail if pthread_create() called */ + /* STACK_SIZE does pthread_create() on client */ + #error "can't use STACK_TRAP with STACK_SIZE, setrlimit will fail" +#endif /* HAVE_STACK_SIZE */ + +static WC_INLINE void StackTrap(void) +{ + struct rlimit rl; + if (getrlimit(RLIMIT_STACK, &rl) != 0) { + wc_mem_printf("getrlimit failed\n"); + } + printf("rlim_cur = %llu\n", rl.rlim_cur); + rl.rlim_cur = 1024*21; /* adjust trap size here */ + if (setrlimit(RLIMIT_STACK, &rl) != 0) { + wc_mem_printf("setrlimit failed\n"); + } +} + +#else /* STACK_TRAP */ + +static WC_INLINE void StackTrap(void) +{ +} + +#endif /* STACK_TRAP */ + +/* Stubs when not used */ +#ifndef STACK_SIZE_CHECKPOINT +#define STACK_SIZE_CHECKPOINT(...) (__VA_ARGS__) +#endif +#ifndef STACK_SIZE_CHECKPOINT_MSG +#define STACK_SIZE_CHECKPOINT_MSG(msg) WC_DO_NOTHING +#endif +#ifndef STACK_SIZE_CHECKPOINT_WITH_MAX_CHECK +#define STACK_SIZE_CHECKPOINT_WITH_MAX_CHECK(max, ...) (__VA_ARGS__, 0) +#endif +#ifndef STACK_SIZE_INIT +#define STACK_SIZE_INIT() WC_DO_NOTHING +#endif + +#endif /* WOLFSSL_MEM_TRACK_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/memory.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/memory.h @@ -0,0 +1,541 @@ +/* memory.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + +/* submitted by eof */ + +/*! + \file wolfssl/wolfcrypt/memory.h +*/ + +#ifndef WOLFSSL_MEMORY_H +#define WOLFSSL_MEMORY_H + +#if !defined(STRING_USER) && !defined(WOLFSSL_LINUXKM) +#include <stdlib.h> +#endif + +#ifndef WOLF_CRYPT_TYPES_H +#include <wolfssl/wolfcrypt/types.h> +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +#ifdef WOLFSSL_FORCE_MALLOC_FAIL_TEST + WOLFSSL_API void wolfSSL_SetMemFailCount(int memFailCount); +#endif + +#ifdef OPENSSL_EXTRA + typedef void *(*wolfSSL_OSSL_Malloc_cb)(size_t, const char *, int); + typedef void (*wolfSSL_OSSL_Free_cb)(void *, const char *, int); + typedef void *(*wolfSSL_OSSL_Realloc_cb)(void *, size_t, const char *, int); +#endif /* OPENSSL_EXTRA */ + +#ifdef WOLFSSL_STATIC_MEMORY + #ifdef WOLFSSL_DEBUG_MEMORY + typedef void *(*wolfSSL_Malloc_cb)(size_t size, void* heap, int type, const char* func, unsigned int line); + typedef void (*wolfSSL_Free_cb)(void *ptr, void* heap, int type, const char* func, unsigned int line); + typedef void *(*wolfSSL_Realloc_cb)(void *ptr, size_t size, void* heap, int type, const char* func, unsigned int line); + WOLFSSL_API void* wolfSSL_Malloc(size_t size, void* heap, int type, const char* func, unsigned int line); + WOLFSSL_API void wolfSSL_Free(void *ptr, void* heap, int type, const char* func, unsigned int line); + WOLFSSL_API void* wolfSSL_Realloc(void *ptr, size_t size, void* heap, int type, const char* func, unsigned int line); + #else + typedef void *(*wolfSSL_Malloc_cb)(size_t size, void* heap, int type); + typedef void (*wolfSSL_Free_cb)(void *ptr, void* heap, int type); + typedef void *(*wolfSSL_Realloc_cb)(void *ptr, size_t size, void* heap, int type); + WOLFSSL_API void* wolfSSL_Malloc(size_t size, void* heap, int type); + WOLFSSL_API void wolfSSL_Free(void *ptr, void* heap, int type); + WOLFSSL_API void* wolfSSL_Realloc(void *ptr, size_t size, void* heap, int type); + #endif /* WOLFSSL_DEBUG_MEMORY */ +#else + #ifdef WOLFSSL_DEBUG_MEMORY + typedef void *(*wolfSSL_Malloc_cb)(size_t size, const char* func, unsigned int line); + typedef void (*wolfSSL_Free_cb)(void *ptr, const char* func, unsigned int line); + typedef void *(*wolfSSL_Realloc_cb)(void *ptr, size_t size, const char* func, unsigned int line); + + /* Public in case user app wants to use XMALLOC/XFREE */ + WOLFSSL_API void* wolfSSL_Malloc(size_t size, const char* func, unsigned int line); + WOLFSSL_API void wolfSSL_Free(void *ptr, const char* func, unsigned int line); + WOLFSSL_API void* wolfSSL_Realloc(void *ptr, size_t size, const char* func, unsigned int line); + #else + typedef void *(*wolfSSL_Malloc_cb)(size_t size); + typedef void (*wolfSSL_Free_cb)(void *ptr); + typedef void *(*wolfSSL_Realloc_cb)(void *ptr, size_t size); + /* Public in case user app wants to use XMALLOC/XFREE */ + WOLFSSL_API void* wolfSSL_Malloc(size_t size); + WOLFSSL_API void wolfSSL_Free(void *ptr); + WOLFSSL_API void* wolfSSL_Realloc(void *ptr, size_t size); + #endif /* WOLFSSL_DEBUG_MEMORY */ +#endif /* WOLFSSL_STATIC_MEMORY */ + +/* Public get/set functions */ +WOLFSSL_API int wolfSSL_SetAllocators(wolfSSL_Malloc_cb mf, + wolfSSL_Free_cb ff, + wolfSSL_Realloc_cb rf); +WOLFSSL_API int wolfSSL_GetAllocators(wolfSSL_Malloc_cb* mf, + wolfSSL_Free_cb* ff, + wolfSSL_Realloc_cb* rf); + +#ifdef WOLFSSL_STATIC_MEMORY + #define WOLFSSL_STATIC_TIMEOUT 1 + #ifndef WOLFSSL_STATIC_ALIGN + #define WOLFSSL_STATIC_ALIGN 16 + #endif +/* WOLFMEM_BUCKETS - list of the sizes of buckets in the pool + * WOLFMEM_DIST - list of quantities of buffers in the buckets + * WOLFMEM_DEF_BUCKETS - number of values in WOLFMEM_BUCKETS and WOLFMEM_DIST + * WOLFMEM_MAX_BUCKETS - size of the arrays used to store the buckets and + * dists in the memory pool; defaults to WOLFMEM_DEF_BUCKETS + * + * The following defines provide a reasonable set of buckets in the memory + * pool for running wolfSSL on a Linux box. The bucket and dist lists below + * have nine items each, so WOLFMEM_DEF_BUCKETS is set to 9. + * + * If WOLFMEM_DEF_BUCKETS is less then WOLFMEM_MAX_BUCKETS, the unused values + * are set to zero and ignored. If WOLFMEM_MAX_BUCKETS is less than + * WOLFMEM_DEF_BUCKETS, not all the buckets will be created in the pool. + */ + #ifndef WOLFMEM_DEF_BUCKETS + #define WOLFMEM_DEF_BUCKETS 9 /* number of default memory blocks */ + #endif + + #ifndef WOLFMEM_MAX_BUCKETS + #define WOLFMEM_MAX_BUCKETS WOLFMEM_DEF_BUCKETS + #endif + + #if WOLFMEM_MAX_BUCKETS < WOLFMEM_DEF_BUCKETS + #warning "ignoring excess buckets, MAX_BUCKETS less than DEF_BUCKETS" + #endif + + #ifndef WOLFMEM_IO_SZ + #define WOLFMEM_IO_SZ 16992 /* 16 byte aligned */ + #endif + + #ifndef LARGEST_MEM_BUCKET + #ifndef SESSION_CERTS + #ifdef HAVE_DILITHIUM + #if defined(WOLFSSL_DILITHIUM_VERIFY_SMALL_MEM) && \ + defined(WOLFSSL_DILITHIUM_SIGN_SMALL_MEM) && \ + defined(WOLFSSL_DILITHIUM_MAKE_KEY_SMALL_MEM) && \ + defined(WOLFSSL_DILITHIUM_VERIFY_ONLY) + #define LARGEST_MEM_BUCKET 14000 /* Dilithium low mem */ + #else + #define LARGEST_MEM_BUCKET 131072 /* Dilithium full mem */ + #endif + #else + #define LARGEST_MEM_BUCKET 16128 + #endif + #elif defined(OPENSSL_EXTRA) + #ifdef WOLFSSL_TLS13 + #define LARGEST_MEM_BUCKET 30400 + #else + #define LARGEST_MEM_BUCKET 25600 + #endif + #elif defined(WOLFSSL_CERT_EXT) + /* certificate extensions requires 24k for the SSL struct */ + #define LARGEST_MEM_BUCKET 24576 + #else + /* increase 23k for object member of WOLFSSL_X509_NAME_ENTRY */ + #define LARGEST_MEM_BUCKET 23440 + #endif + #endif + + #ifndef WOLFMEM_BUCKETS + #ifndef SESSION_CERTS + #ifdef HAVE_DILITHIUM + #if defined(WOLFSSL_DILITHIUM_VERIFY_SMALL_MEM) && \ + defined(WOLFSSL_DILITHIUM_SIGN_SMALL_MEM) && \ + defined(WOLFSSL_DILITHIUM_MAKE_KEY_SMALL_MEM) && \ + defined(WOLFSSL_DILITHIUM_VERIFY_ONLY) + /* default size of chunks of memory to separate into */ + #define WOLFMEM_BUCKETS 64,128,256,512,1024,2048,4096,\ + 8192,LARGEST_MEM_BUCKET + #else + /* default size of chunks of memory to separate into */ + #define WOLFMEM_BUCKETS 64,128,256,512,1024,8192,32768,\ + 65536,LARGEST_MEM_BUCKET + #endif + #else + /* default size of chunks of memory to separate into */ + #define WOLFMEM_BUCKETS 64,128,256,512,1024,2432,3456,4544,\ + LARGEST_MEM_BUCKET + #endif + #elif defined(OPENSSL_EXTRA) + /* extra storage in structs for multiple attributes and order */ + #define WOLFMEM_BUCKETS 64,128,256,512,1024,2432,3360,4480,\ + LARGEST_MEM_BUCKET + #elif defined(WOLFSSL_CERT_EXT) + #define WOLFMEM_BUCKETS 64,128,256,512,1024,2432,3456,4544,\ + LARGEST_MEM_BUCKET + #else + #define WOLFMEM_BUCKETS 64,128,256,512,1024,2432,3456,4544,\ + LARGEST_MEM_BUCKET + #endif + #endif + + #ifndef WOLFMEM_DIST + #ifdef HAVE_DILITHIUM + #if defined(WOLFSSL_DILITHIUM_VERIFY_SMALL_MEM) && \ + defined(WOLFSSL_DILITHIUM_SIGN_SMALL_MEM) && \ + defined(WOLFSSL_DILITHIUM_MAKE_KEY_SMALL_MEM) && \ + defined(WOLFSSL_DILITHIUM_VERIFY_ONLY) + #define WOLFMEM_DIST 20,8,6,10,8,6,4,2,1 + #else + #define WOLFMEM_DIST 30,10,8,15,8,10,8,5,1 + #endif + #elif !defined(WOLFSSL_STATIC_MEMORY_SMALL) + #define WOLFMEM_DIST 49,10,6,14,5,6,9,1,1 + #else + /* Low resource and not RSA */ + #define WOLFMEM_DIST 29, 7,6, 9,4,4,0,0,0 + #endif + #endif + + /* flags for loading static memory (one hot bit) */ + #define WOLFMEM_GENERAL 0x01 + #define WOLFMEM_IO_POOL 0x02 + #define WOLFMEM_IO_POOL_FIXED 0x04 + #define WOLFMEM_TRACK_STATS 0x08 + + #ifndef WOLFSSL_MEM_GUARD + #define WOLFSSL_MEM_GUARD + typedef struct WOLFSSL_MEM_STATS WOLFSSL_MEM_STATS; + typedef struct WOLFSSL_MEM_CONN_STATS WOLFSSL_MEM_CONN_STATS; + #endif + + struct WOLFSSL_MEM_CONN_STATS { + word32 peakMem; /* peak memory usage */ + word32 curMem; /* current memory usage */ + word32 peakAlloc; /* peak memory allocations */ + word32 curAlloc; /* current memory allocations */ + word32 totalAlloc;/* total memory allocations for lifetime */ + word32 totalFr; /* total frees for lifetime */ + }; + + struct WOLFSSL_MEM_STATS { + word32 curAlloc; /* current memory allocations */ + word32 totalAlloc;/* total memory allocations for lifetime */ + word32 totalFr; /* total frees for lifetime */ + word32 totalUse; /* total amount of memory used in blocks */ + word32 avaIO; /* available IO specific pools */ + word32 maxHa; /* max number of concurrent handshakes allowed */ + word32 maxIO; /* max number of concurrent IO connections allowed */ + word32 blockSz[WOLFMEM_MAX_BUCKETS]; /* block sizes in stacks */ + word32 avaBlock[WOLFMEM_MAX_BUCKETS];/* ava block sizes */ + word32 usedBlock[WOLFMEM_MAX_BUCKETS]; + int flag; /* flag used */ + }; + + typedef struct wc_Memory wc_Memory; /* internal structure for mem bucket */ + typedef struct WOLFSSL_HEAP { + wc_Memory* ava[WOLFMEM_MAX_BUCKETS]; + #ifndef WOLFSSL_STATIC_MEMORY_LEAN + wc_Memory* io; /* list of buffers to use for IO */ + #endif + + #ifdef WOLFSSL_STATIC_MEMORY_LEAN + word32 sizeList[WOLFMEM_MAX_BUCKETS];/* memory sizes in ava list */ + word32 distList[WOLFMEM_MAX_BUCKETS];/* general distribution */ + #else + word32 maxHa; /* max concurrent handshakes */ + word32 curHa; + word32 maxIO; /* max concurrent IO connections */ + word32 curIO; + word32 sizeList[WOLFMEM_MAX_BUCKETS];/* memory sizes in ava list */ + word32 distList[WOLFMEM_MAX_BUCKETS];/* general distribution */ + word32 inUse; /* amount of memory currently in use */ + word32 ioUse; + #endif + + #ifndef WOLFSSL_STATIC_MEMORY_LEAN + word32 alloc; /* total number of allocs */ + word32 frAlc; /* total number of frees */ + int flag; + #endif + #ifndef SINGLE_THREADED + wolfSSL_Mutex memory_mutex; + #endif + } WOLFSSL_HEAP; + + /* structure passed into XMALLOC as heap hint + * having this abstraction allows tracking statistics of individual ssl's + */ + typedef struct WOLFSSL_HEAP_HINT { + WOLFSSL_HEAP* memory; + WOLFSSL_MEM_CONN_STATS* stats; /* hold individual connection stats */ + #ifndef WOLFSSL_STATIC_MEMORY_LEAN + wc_Memory* outBuf; /* set if using fixed io buffers */ + wc_Memory* inBuf; + byte haFlag; /* flag used for checking handshake count */ + #endif + } WOLFSSL_HEAP_HINT; + + WOLFSSL_API void* wolfSSL_SetGlobalHeapHint(void* heap); + WOLFSSL_API void* wolfSSL_GetGlobalHeapHint(void); + WOLFSSL_API int wc_LoadStaticMemory_ex(WOLFSSL_HEAP_HINT** pHint, + unsigned int listSz, const word32 *sizeList, + const word32 *distList, unsigned char* buf, unsigned int sz, + int flag, int max); +#ifdef WOLFSSL_STATIC_MEMORY_DEBUG_CALLBACK + #define WOLFSSL_DEBUG_MEMORY_ALLOC 0 + #define WOLFSSL_DEBUG_MEMORY_FAIL 1 + #define WOLFSSL_DEBUG_MEMORY_FREE 2 + #define WOLFSSL_DEBUG_MEMORY_INIT 3 + + + typedef void (*DebugMemoryCb)(size_t sz, int bucketSz, byte st, int type); + WOLFSSL_API void wolfSSL_SetDebugMemoryCb(DebugMemoryCb cb); +#endif + WOLFSSL_API int wc_LoadStaticMemory(WOLFSSL_HEAP_HINT** pHint, + unsigned char* buf, unsigned int sz, int flag, int max); + WOLFSSL_API void wc_UnloadStaticMemory(WOLFSSL_HEAP_HINT* heap); + + WOLFSSL_API int wolfSSL_GetMemStats(WOLFSSL_HEAP* heap, + WOLFSSL_MEM_STATS* stats); + WOLFSSL_LOCAL int SetFixedIO(WOLFSSL_HEAP* heap, wc_Memory** io); + WOLFSSL_LOCAL int FreeFixedIO(WOLFSSL_HEAP* heap, wc_Memory** io); + + WOLFSSL_API int wolfSSL_StaticBufferSz_ex(unsigned int listSz, + const word32 *sizeList, const word32 *distList, + byte* buffer, word32 sz, int flag); + WOLFSSL_API int wolfSSL_StaticBufferSz(byte* buffer, word32 sz, int flag); + WOLFSSL_API int wolfSSL_MemoryPaddingSz(void); +#endif /* WOLFSSL_STATIC_MEMORY */ + +#ifdef WOLFSSL_STACK_LOG + WOLFSSL_API void __attribute__((no_instrument_function)) + __cyg_profile_func_enter(void *func, void *caller); + WOLFSSL_API void __attribute__((no_instrument_function)) + __cyg_profile_func_exit(void *func, void *caller); +#endif /* WOLFSSL_STACK_LOG */ + +#ifdef WOLFSSL_MEM_FAIL_COUNT +WOLFSSL_LOCAL void wc_MemFailCount_Init(void); +WOLFSSL_LOCAL void wc_MemFailCount_Free(void); +#endif + +#ifdef WOLFSSL_CHECK_MEM_ZERO +WOLFSSL_LOCAL void wc_MemZero_Init(void); +WOLFSSL_LOCAL void wc_MemZero_Free(void); +WOLFSSL_LOCAL void wc_MemZero_Add(const char* name, const void* addr, + size_t len); +WOLFSSL_LOCAL void wc_MemZero_Check(void* addr, size_t len); +#endif + +#ifdef WC_DEBUG_CIPHER_LIFECYCLE +WOLFSSL_LOCAL int wc_debug_CipherLifecycleInit(void **CipherLifecycleTag, + void *heap); +WOLFSSL_LOCAL int wc_debug_CipherLifecycleCheck(void *CipherLifecycleTag, + int abort_p); +WOLFSSL_LOCAL int wc_debug_CipherLifecycleFree(void **CipherLifecycleTag, + void *heap, int abort_p); +#else +#define wc_debug_CipherLifecycleInit(CipherLifecycleTag, heap) \ + ((void)(CipherLifecycleTag), (void)(heap), 0) +#define wc_debug_CipherLifecycleCheck(CipherLifecycleTag, abort_p) \ + ((void)(CipherLifecycleTag), (void)(abort_p), 0) +#define wc_debug_CipherLifecycleFree(CipherLifecycleTag, heap, abort_p) \ + ((void)(CipherLifecycleTag), (void)(heap), (void)(abort_p), 0) +#endif + +#ifdef DEBUG_VECTOR_REGISTER_ACCESS_FUZZING + WOLFSSL_LOCAL int SAVE_VECTOR_REGISTERS2_fuzzer(void); + #ifndef WC_DEBUG_VECTOR_REGISTERS_FUZZING_SEED + #define WC_DEBUG_VECTOR_REGISTERS_FUZZING_SEED 0 + #endif + #ifndef CAN_SAVE_VECTOR_REGISTERS + #define CAN_SAVE_VECTOR_REGISTERS() (SAVE_VECTOR_REGISTERS2_fuzzer() == 0) + #endif +#endif + +#ifdef DEBUG_VECTOR_REGISTER_ACCESS + WOLFSSL_API extern THREAD_LS_T int wc_svr_count; + WOLFSSL_API extern THREAD_LS_T const char *wc_svr_last_file; + WOLFSSL_API extern THREAD_LS_T int wc_svr_last_line; + + #ifdef DEBUG_VECTOR_REGISTERS_ABORT_ON_FAIL + #define DEBUG_VECTOR_REGISTERS_EXTRA_FAIL_CLAUSE abort(); + #elif defined(DEBUG_VECTOR_REGISTERS_EXIT_ON_FAIL) + #define DEBUG_VECTOR_REGISTERS_EXTRA_FAIL_CLAUSE exit(1); + #elif !defined(DEBUG_VECTOR_REGISTERS_EXTRA_FAIL_CLAUSE) + #define DEBUG_VECTOR_REGISTERS_EXTRA_FAIL_CLAUSE + #endif + + #define SAVE_VECTOR_REGISTERS(fail_clause) { \ + int _svr_ret = wc_debug_vector_registers_retval; \ + if (_svr_ret != 0) { fail_clause } \ + else { \ + ++wc_svr_count; \ + if (wc_svr_count > 5) { \ + fprintf(stderr, \ + ("%s @ L%d : incr : " \ + "wc_svr_count %d (last op %s L%d)\n"), \ + __FILE__, \ + __LINE__, \ + wc_svr_count, \ + wc_svr_last_file, \ + wc_svr_last_line); \ + DEBUG_VECTOR_REGISTERS_EXTRA_FAIL_CLAUSE \ + } \ + wc_svr_last_file = __FILE__; \ + wc_svr_last_line = __LINE__; \ + } \ + } + + WOLFSSL_API extern THREAD_LS_T int wc_debug_vector_registers_retval; + +#ifndef WC_DEBUG_VECTOR_REGISTERS_RETVAL_INITVAL +#define WC_DEBUG_VECTOR_REGISTERS_RETVAL_INITVAL 0 +#endif +#define WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(x) do { \ + if (((x) != 0) && (wc_svr_count > 0)) { \ + fprintf(stderr, \ + ("%s @ L%d : incr : " \ + "wc_svr_count %d (last op %s L%d)\n"), \ + __FILE__, \ + __LINE__, \ + wc_svr_count, \ + wc_svr_last_file, \ + wc_svr_last_line); \ + DEBUG_VECTOR_REGISTERS_EXTRA_FAIL_CLAUSE \ + } \ + wc_debug_vector_registers_retval = (x); \ + } while (0) + +#ifdef DEBUG_VECTOR_REGISTER_ACCESS_FUZZING + #define SAVE_VECTOR_REGISTERS2(...) ({ \ + int _svr2_val = SAVE_VECTOR_REGISTERS2_fuzzer(); \ + if (_svr2_val == 0) { \ + ++wc_svr_count; \ + if (wc_svr_count > 5) { \ + fprintf(stderr, \ + ("%s @ L%d : incr : " \ + "wc_svr_count %d (last op %s L%d)\n"), \ + __FILE__, \ + __LINE__, \ + wc_svr_count, \ + wc_svr_last_file, \ + wc_svr_last_line); \ + DEBUG_VECTOR_REGISTERS_EXTRA_FAIL_CLAUSE \ + } \ + wc_svr_last_file = __FILE__; \ + wc_svr_last_line = __LINE__; \ + _svr2_val = 0; \ + } \ + _svr2_val; \ + }) + +#else + + #define SAVE_VECTOR_REGISTERS2(...) ({ \ + int _svr2_val; \ + if (wc_debug_vector_registers_retval != 0) { \ + if (wc_svr_count > 0) { \ + fprintf(stderr, \ + ("%s @ L%d : incr : " \ + "wc_svr_count %d (last op %s L%d)\n"), \ + __FILE__, \ + __LINE__, \ + wc_svr_count, \ + wc_svr_last_file, \ + wc_svr_last_line); \ + DEBUG_VECTOR_REGISTERS_EXTRA_FAIL_CLAUSE \ + } \ + _svr2_val = wc_debug_vector_registers_retval; \ + } else { \ + ++wc_svr_count; \ + if (wc_svr_count > 5) { \ + fprintf(stderr, \ + ("%s @ L%d : incr : " \ + "wc_svr_count %d (last op %s L%d)\n"), \ + __FILE__, \ + __LINE__, \ + wc_svr_count, \ + wc_svr_last_file, \ + wc_svr_last_line); \ + DEBUG_VECTOR_REGISTERS_EXTRA_FAIL_CLAUSE \ + } \ + wc_svr_last_file = __FILE__; \ + wc_svr_last_line = __LINE__; \ + _svr2_val = 0; \ + } \ + _svr2_val; \ + }) + +#endif + + #define ASSERT_SAVED_VECTOR_REGISTERS() do { \ + if (wc_svr_count <= 0) { \ + fprintf(stderr, \ + ("ASSERT_SAVED_VECTOR_REGISTERS : %s @ L%d : " \ + "wc_svr_count %d (last op %s L%d)\n"), \ + __FILE__, \ + __LINE__, \ + wc_svr_count, \ + wc_svr_last_file, \ + wc_svr_last_line); \ + DEBUG_VECTOR_REGISTERS_EXTRA_FAIL_CLAUSE \ + } \ + } while (0) + #define ASSERT_RESTORED_VECTOR_REGISTERS(fail_clause) do { \ + if (wc_svr_count != 0) { \ + fprintf(stderr, \ + ("ASSERT_RESTORED_VECTOR_REGISTERS : %s @ L%d" \ + " : wc_svr_count %d (last op %s L%d)\n"), \ + __FILE__, \ + __LINE__, \ + wc_svr_count, \ + wc_svr_last_file, \ + wc_svr_last_line); \ + DEBUG_VECTOR_REGISTERS_EXTRA_FAIL_CLAUSE \ + { fail_clause } \ + } \ + } while (0) + #define RESTORE_VECTOR_REGISTERS() do { \ + --wc_svr_count; \ + if ((wc_svr_count > 4) || (wc_svr_count < 0)) { \ + fprintf(stderr, \ + ("%s @ L%d : decr : " \ + "wc_svr_count %d (last op %s L%d)\n"), \ + __FILE__, \ + __LINE__, \ + wc_svr_count, \ + wc_svr_last_file, \ + wc_svr_last_line); \ + DEBUG_VECTOR_REGISTERS_EXTRA_FAIL_CLAUSE \ + } \ + wc_svr_last_file = __FILE__; \ + wc_svr_last_line = __LINE__; \ + } while(0) + +#else /* !DEBUG_VECTOR_REGISTER_ACCESS */ + #if !defined(SAVE_VECTOR_REGISTERS2) && defined(DEBUG_VECTOR_REGISTER_ACCESS_FUZZING) + #define SAVE_VECTOR_REGISTERS2(...) SAVE_VECTOR_REGISTERS2_fuzzer() + #endif +#endif + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_MEMORY_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/misc.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/misc.h @@ -0,0 +1,214 @@ +/* misc.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ +/* + +DESCRIPTION +This module implements the arithmetic-shift right, left, byte swapping, XOR, +masking and clearing memory logic. + +*/ +#ifndef WOLF_CRYPT_MISC_H +#define WOLF_CRYPT_MISC_H + + +#include <wolfssl/wolfcrypt/types.h> + + +#ifdef __cplusplus + extern "C" { +#endif + + +#ifdef NO_INLINE + +#define WC_MISC_STATIC + +WOLFSSL_LOCAL +word32 rotlFixed(word32 x, word32 y); +WOLFSSL_LOCAL +word32 rotrFixed(word32 x, word32 y); + +WOLFSSL_LOCAL +word16 rotlFixed16(word16 x, word16 y); +WOLFSSL_LOCAL +word16 rotrFixed16(word16 x, word16 y); + +WOLFSSL_LOCAL +word32 ByteReverseWord32(word32 value); +WOLFSSL_LOCAL +void ByteReverseWords(word32* out, const word32* in, word32 byteCount); + +WOLFSSL_LOCAL +void XorWordsOut(wolfssl_word** r, const wolfssl_word** a, + const wolfssl_word** b, word32 n); +WOLFSSL_LOCAL +void xorbufout(void* out, const void* buf, const void* mask, word32 count); +WOLFSSL_LOCAL +void XorWords(wolfssl_word** r, const wolfssl_word** a, word32 n); +WOLFSSL_LOCAL +void xorbuf(void* buf, const void* mask, word32 count); + +WOLFSSL_LOCAL +void ForceZero(void* mem, word32 len); + +WOLFSSL_LOCAL +int ConstantCompare(const byte* a, const byte* b, int length); + +WOLFSSL_LOCAL +word32 readUnalignedWord32(const byte *in); +WOLFSSL_LOCAL +word32 writeUnalignedWord32(void *out, word32 in); +WOLFSSL_LOCAL +void readUnalignedWords32(word32 *out, const byte *in, size_t count); +WOLFSSL_LOCAL +void writeUnalignedWords32(byte *out, const word32 *in, size_t count); + +#ifdef WORD64_AVAILABLE +WOLFSSL_LOCAL +word64 readUnalignedWord64(const byte *in); +WOLFSSL_LOCAL +word64 writeUnalignedWord64(void *out, word64 in); +WOLFSSL_LOCAL +void readUnalignedWords64(word64 *out, const byte *in, size_t count); +WOLFSSL_LOCAL +void writeUnalignedWords64(byte *out, const word64 *in, size_t count); +WOLFSSL_LOCAL +word64 rotlFixed64(word64 x, word64 y); +WOLFSSL_LOCAL +word64 rotrFixed64(word64 x, word64 y); + +WOLFSSL_LOCAL +word64 ByteReverseWord64(word64 value); +WOLFSSL_LOCAL +void ByteReverseWords64(word64* out, const word64* in, word32 byteCount); +#endif /* WORD64_AVAILABLE */ + +#ifndef WOLFSSL_HAVE_MIN + #if defined(HAVE_FIPS) && !defined(min) /* so ifdef check passes */ + #define min min + #endif + WOLFSSL_LOCAL word32 min(word32 a, word32 b); +#endif + +#ifndef WOLFSSL_HAVE_MAX + #if defined(HAVE_FIPS) && !defined(max) /* so ifdef check passes */ + #define max max + #endif + WOLFSSL_LOCAL word32 max(word32 a, word32 b); +#endif /* WOLFSSL_HAVE_MAX */ + + +void c32to24(word32 in, word24 out); +void c16toa(word16 wc_u16, byte* c); +void c32toa(word32 wc_u32, byte* c); +void c24to32(const word24 wc_u24, word32* wc_u32); +void ato16(const byte* c, word16* wc_u16); +void ato24(const byte* c, word32* wc_u24); +void ato32(const byte* c, word32* wc_u32); +void ato32le(const byte* c, word32* wc_u32); +word32 btoi(byte b); + +WOLFSSL_LOCAL signed char HexCharToByte(char ch); +WOLFSSL_LOCAL char ByteToHex(byte in); +WOLFSSL_LOCAL int ByteToHexStr(byte in, char* out); +WOLFSSL_LOCAL int CharIsWhiteSpace(char ch); + +WOLFSSL_LOCAL byte ctMaskGT(int a, int b); +WOLFSSL_LOCAL byte ctMaskGTE(int a, int b); +WOLFSSL_LOCAL int ctMaskIntGTE(int a, int b); +#ifdef WORD64_AVAILABLE +WOLFSSL_LOCAL word32 ctMaskWord32GTE(word32 a, word32 b); +#endif +WOLFSSL_LOCAL byte ctMaskLT(int a, int b); +WOLFSSL_LOCAL byte ctMaskLTE(int a, int b); +WOLFSSL_LOCAL byte ctMaskEq(int a, int b); +WOLFSSL_LOCAL word16 ctMask16GT(int a, int b); +WOLFSSL_LOCAL word16 ctMask16GTE(int a, int b); +WOLFSSL_LOCAL word16 ctMask16LT(int a, int b); +WOLFSSL_LOCAL word16 ctMask16LTE(int a, int b); +WOLFSSL_LOCAL word16 ctMask16Eq(int a, int b); +WOLFSSL_LOCAL byte ctMaskNotEq(int a, int b); +WOLFSSL_LOCAL byte ctMaskSel(byte m, byte a, byte b); +WOLFSSL_LOCAL int ctMaskSelInt(byte m, int a, int b); +WOLFSSL_LOCAL word32 ctMaskSelWord32(byte m, word32 a, word32 b); +WOLFSSL_LOCAL byte ctSetLTE(int a, int b); +WOLFSSL_LOCAL void ctMaskCopy(byte mask, byte* dst, byte* src, word16 size); +WOLFSSL_LOCAL word32 MakeWordFromHash(const byte* hashID); +WOLFSSL_LOCAL word32 HashObject(const byte* o, word32 len, int* error); +WOLFSSL_LOCAL char* CopyString(const char* src, int srcLen, void* heap, + int type); + +WOLFSSL_LOCAL void w64Increment(w64wrapper *n); +WOLFSSL_LOCAL void w64Decrement(w64wrapper *n); +WOLFSSL_LOCAL byte w64Equal(w64wrapper a, w64wrapper b); +WOLFSSL_LOCAL word32 w64GetLow32(w64wrapper n); +WOLFSSL_LOCAL word32 w64GetHigh32(w64wrapper n); +WOLFSSL_LOCAL void w64SetLow32(w64wrapper *n, word32 low); +WOLFSSL_LOCAL w64wrapper w64Add32(w64wrapper a, word32 b, byte *wrap); +WOLFSSL_LOCAL w64wrapper w64Add(w64wrapper a, w64wrapper b, byte *wrap); +WOLFSSL_LOCAL w64wrapper w64Sub32(w64wrapper a, word32 b, byte *wrap); +WOLFSSL_LOCAL byte w64GT(w64wrapper a, w64wrapper b); +WOLFSSL_LOCAL byte w64IsZero(w64wrapper a); +WOLFSSL_LOCAL void c64toa(const w64wrapper *a, byte *out); +WOLFSSL_LOCAL void ato64(const byte *in, w64wrapper *w64); +WOLFSSL_LOCAL w64wrapper w64From32(word32 hi, word32 lo); +WOLFSSL_LOCAL byte w64GTE(w64wrapper a, w64wrapper b); +WOLFSSL_LOCAL byte w64LT(w64wrapper a, w64wrapper b); +WOLFSSL_LOCAL w64wrapper w64Sub(w64wrapper a, w64wrapper b); +WOLFSSL_LOCAL void w64Zero(w64wrapper *a); +WOLFSSL_LOCAL w64wrapper w64ShiftRight(w64wrapper a, int shift); +WOLFSSL_LOCAL w64wrapper w64ShiftLeft(w64wrapper a, int shift); +WOLFSSL_LOCAL w64wrapper w64Mul(word32 a, word32 b); + +#else /* !NO_INLINE */ + +#define WC_MISC_STATIC static + +/* Declarations for user defined functions */ +#ifdef WOLFSSL_NO_FORCE_ZERO +void ForceZero(void* mem, word32 len); +#endif +#ifdef WOLFSSL_NO_CONST_CMP +int ConstantCompare(const byte* a, const byte* b, int length); +#endif +#ifdef WOLFSSL_NO_INT_ENCODE +void c32to24(word32 in, word24 out); +void c16toa(word16 wc_u16, byte* c); +void c32toa(word32 wc_u32, byte* c); +#endif +#ifdef WOLFSSL_NO_INT_DECODE +void c24to32(const word24 wc_u24, word32* wc_u32); +void ato24(const byte* c, word32* wc_u24); +void ato16(const byte* c, word16* wc_u16); +void ato32(const byte* c, word32* wc_u32); +void ato32le(const byte* c, word32* wc_u32); +word32 btoi(byte b); +#endif +#endif /* NO_INLINE */ + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + + +#endif /* WOLF_CRYPT_MISC_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/mlkem.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/mlkem.h @@ -0,0 +1,374 @@ +/* mlkem.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/mlkem.h + */ + +#ifndef WOLF_CRYPT_MLKEM_H +#define WOLF_CRYPT_MLKEM_H + +#include <wolfssl/wolfcrypt/types.h> +#include <wolfssl/wolfcrypt/random.h> + +#ifdef WOLFSSL_HAVE_MLKEM + +/* Number of co-efficients in polynomial. */ +#define MLKEM_N 256 + +/* Define algorithm type when not excluded. */ +#ifndef WOLFSSL_NO_ML_KEM + #if !defined(WOLFSSL_NO_ML_KEM_512) + #define WOLFSSL_WC_ML_KEM_512 + #endif + #if !defined(WOLFSSL_NO_ML_KEM_768) + #define WOLFSSL_WC_ML_KEM_768 + #endif + #if !defined(WOLFSSL_NO_ML_KEM_1024) + #define WOLFSSL_WC_ML_KEM_1024 + #endif + + #if !defined(WOLFSSL_WC_ML_KEM_512) && !defined(WOLFSSL_WC_ML_KEM_768) && \ + !defined(WOLFSSL_WC_ML_KEM_1024) + #error "No ML-KEM key size chosen." + #endif +#endif + +#ifdef WOLFSSL_MLKEM_KYBER + #ifndef WOLFSSL_NO_KYBER512 + #define WOLFSSL_KYBER512 + #define WOLFSSL_WC_ML_KEM_512 + #endif + #ifndef WOLFSSL_NO_KYBER768 + #define WOLFSSL_KYBER768 + #define WOLFSSL_WC_ML_KEM_768 + #endif + #ifndef WOLFSSL_NO_KYBER1024 + #define WOLFSSL_KYBER1024 + #define WOLFSSL_WC_ML_KEM_1024 + #endif + + #if !defined(WOLFSSL_KYBER512) && !defined(WOLFSSL_KYBER768) && \ + !defined(WOLFSSL_KYBER1024) + #error "No Kyber key size chosen." + #endif +#endif + +/* Size of a polynomial vector based on dimensions. */ +#define MLKEM_POLY_VEC_SZ(k) ((k) * WC_ML_KEM_POLY_SIZE) +/* Size of a compressed polynomial based on bits per coefficient. */ +#define MLKEM_POLY_COMPRESSED_SZ(b) ((b) * (MLKEM_N / 8)) +/* Size of a compressed vector polynomial based on dimensions and bits per + * coefficient. */ +#define MLKEM_POLY_VEC_COMPRESSED_SZ(k, b) ((k) * ((b) * (MLKEM_N / 8))) + +#ifdef WOLFSSL_WC_ML_KEM_512 +#define WC_ML_KEM_512_K 2 +/* Size of a polynomial vector. */ +#define WC_ML_KEM_512_POLY_VEC_SZ MLKEM_POLY_VEC_SZ(WC_ML_KEM_512_K) +/* Size of a compressed polynomial based on bits per coefficient. */ +#define WC_ML_KEM_512_POLY_COMPRESSED_SZ MLKEM_POLY_COMPRESSED_SZ(4) +/* Size of a compressed vector polynomial based on dimensions and bits per + * coefficient. */ +#define WC_ML_KEM_512_POLY_VEC_COMPRESSED_SZ \ + MLKEM_POLY_VEC_COMPRESSED_SZ(WC_ML_KEM_512_K, 10) + +/* Public key size. */ +#define WC_ML_KEM_512_PUBLIC_KEY_SIZE \ + (WC_ML_KEM_512_POLY_VEC_SZ + WC_ML_KEM_SYM_SZ) +/* Private key size. */ +#define WC_ML_KEM_512_PRIVATE_KEY_SIZE \ + (WC_ML_KEM_512_POLY_VEC_SZ + WC_ML_KEM_512_PUBLIC_KEY_SIZE + \ + 2 * WC_ML_KEM_SYM_SZ) +/* Cipher text size. */ +#define WC_ML_KEM_512_CIPHER_TEXT_SIZE \ + (WC_ML_KEM_512_POLY_VEC_COMPRESSED_SZ + WC_ML_KEM_512_POLY_COMPRESSED_SZ) +#endif + +#ifdef WOLFSSL_WC_ML_KEM_768 +#define WC_ML_KEM_768_K 3 + +/* Size of a polynomial vector. */ +#define WC_ML_KEM_768_POLY_VEC_SZ MLKEM_POLY_VEC_SZ(WC_ML_KEM_768_K) +/* Size of a compressed polynomial based on bits per coefficient. */ +#define WC_ML_KEM_768_POLY_COMPRESSED_SZ MLKEM_POLY_COMPRESSED_SZ(4) +/* Size of a compressed vector polynomial based on dimensions and bits per + * coefficient. */ +#define WC_ML_KEM_768_POLY_VEC_COMPRESSED_SZ \ + MLKEM_POLY_VEC_COMPRESSED_SZ(WC_ML_KEM_768_K, 10) + +/* Public key size. */ +#define WC_ML_KEM_768_PUBLIC_KEY_SIZE \ + (WC_ML_KEM_768_POLY_VEC_SZ + WC_ML_KEM_SYM_SZ) +/* Private key size. */ +#define WC_ML_KEM_768_PRIVATE_KEY_SIZE \ + (WC_ML_KEM_768_POLY_VEC_SZ + WC_ML_KEM_768_PUBLIC_KEY_SIZE + \ + 2 * WC_ML_KEM_SYM_SZ) +/* Cipher text size. */ +#define WC_ML_KEM_768_CIPHER_TEXT_SIZE \ + (WC_ML_KEM_768_POLY_VEC_COMPRESSED_SZ + WC_ML_KEM_768_POLY_COMPRESSED_SZ) +#endif + +#ifdef WOLFSSL_WC_ML_KEM_1024 +#define WC_ML_KEM_1024_K 4 + +/* Size of a polynomial vector. */ +#define WC_ML_KEM_1024_POLY_VEC_SZ MLKEM_POLY_VEC_SZ(WC_ML_KEM_1024_K) +/* Size of a compressed polynomial based on bits per coefficient. */ +#define WC_ML_KEM_1024_POLY_COMPRESSED_SZ MLKEM_POLY_COMPRESSED_SZ(5) +/* Size of a compressed vector polynomial based on dimensions and bits per + * coefficient. */ +#define WC_ML_KEM_1024_POLY_VEC_COMPRESSED_SZ \ + MLKEM_POLY_VEC_COMPRESSED_SZ(WC_ML_KEM_1024_K, 11) + +/* Public key size. */ +#define WC_ML_KEM_1024_PUBLIC_KEY_SIZE \ + (WC_ML_KEM_1024_POLY_VEC_SZ + WC_ML_KEM_SYM_SZ) +/* Private key size. */ +#define WC_ML_KEM_1024_PRIVATE_KEY_SIZE \ + (WC_ML_KEM_1024_POLY_VEC_SZ + WC_ML_KEM_1024_PUBLIC_KEY_SIZE + \ + 2 * WC_ML_KEM_SYM_SZ) +/* Cipher text size. */ +#define WC_ML_KEM_1024_CIPHER_TEXT_SIZE \ + (WC_ML_KEM_1024_POLY_VEC_COMPRESSED_SZ + WC_ML_KEM_1024_POLY_COMPRESSED_SZ) +#endif + +#ifndef WC_ML_KEM_MAX_K +#ifdef WOLFSSL_WC_ML_KEM_1024 +#define WC_ML_KEM_MAX_K WC_ML_KEM_1024_K +#define WC_ML_KEM_MAX_PRIVATE_KEY_SIZE WC_ML_KEM_1024_PRIVATE_KEY_SIZE +#define WC_ML_KEM_MAX_PUBLIC_KEY_SIZE WC_ML_KEM_1024_PUBLIC_KEY_SIZE +#define WC_ML_KEM_MAX_CIPHER_TEXT_SIZE WC_ML_KEM_1024_CIPHER_TEXT_SIZE +#elif defined(WOLFSSL_WC_ML_KEM_768) +#define WC_ML_KEM_MAX_K WC_ML_KEM_768_K +#define WC_ML_KEM_MAX_PRIVATE_KEY_SIZE WC_ML_KEM_768_PRIVATE_KEY_SIZE +#define WC_ML_KEM_MAX_PUBLIC_KEY_SIZE WC_ML_KEM_768_PUBLIC_KEY_SIZE +#define WC_ML_KEM_MAX_CIPHER_TEXT_SIZE WC_ML_KEM_768_CIPHER_TEXT_SIZE +#elif defined(WOLFSSL_WC_ML_KEM_512) +#define WC_ML_KEM_MAX_K WC_ML_KEM_512_K +#define WC_ML_KEM_MAX_PRIVATE_KEY_SIZE WC_ML_KEM_512_PRIVATE_KEY_SIZE +#define WC_ML_KEM_MAX_PUBLIC_KEY_SIZE WC_ML_KEM_512_PUBLIC_KEY_SIZE +#define WC_ML_KEM_MAX_CIPHER_TEXT_SIZE WC_ML_KEM_512_CIPHER_TEXT_SIZE +#endif +#endif /* WC_ML_KEM_MAX_K */ + +#define KYBER_N MLKEM_N + +/* Size of a polynomial vector based on dimensions. */ +#define KYBER_POLY_VEC_SZ(k) ((k) * KYBER_POLY_SIZE) +/* Size of a compressed polynomial based on bits per coefficient. */ +#define KYBER_POLY_COMPRESSED_SZ(b) ((b) * (KYBER_N / 8)) +/* Size of a compressed vector polynomial based on dimensions and bits per + * coefficient. */ +#define KYBER_POLY_VEC_COMPRESSED_SZ(k, b) ((k) * ((b) * (KYBER_N / 8))) + + +/* Kyber-512 parameters */ +/* Number of polynomials in a vector and vectors in a matrix. */ +#define KYBER512_K 2 + +/* Size of a polynomial vector. */ +#define KYBER512_POLY_VEC_SZ KYBER_POLY_VEC_SZ(KYBER512_K) +/* Size of a compressed polynomial based on bits per coefficient. */ +#define KYBER512_POLY_COMPRESSED_SZ KYBER_POLY_COMPRESSED_SZ(4) +/* Size of a compressed vector polynomial based on dimensions and bits per + * coefficient. */ +#define KYBER512_POLY_VEC_COMPRESSED_SZ \ + KYBER_POLY_VEC_COMPRESSED_SZ(KYBER512_K, 10) + +/* Public key size. */ +#define KYBER512_PUBLIC_KEY_SIZE \ + (KYBER512_POLY_VEC_SZ + KYBER_SYM_SZ) +/* Private key size. */ +#define KYBER512_PRIVATE_KEY_SIZE \ + (KYBER512_POLY_VEC_SZ + KYBER512_PUBLIC_KEY_SIZE + 2 * KYBER_SYM_SZ) +/* Cipher text size. */ +#define KYBER512_CIPHER_TEXT_SIZE \ + (KYBER512_POLY_VEC_COMPRESSED_SZ + KYBER512_POLY_COMPRESSED_SZ) + +/* Kyber-768 parameters */ +/* Number of polynomials in a vector and vectors in a matrix. */ +#define KYBER768_K 3 + +/* Size of a polynomial vector. */ +#define KYBER768_POLY_VEC_SZ KYBER_POLY_VEC_SZ(KYBER768_K) +/* Size of a compressed polynomial based on bits per coefficient. */ +#define KYBER768_POLY_COMPRESSED_SZ KYBER_POLY_COMPRESSED_SZ(4) +/* Size of a compressed vector polynomial based on dimensions and bits per + * coefficient. */ +#define KYBER768_POLY_VEC_COMPRESSED_SZ \ + KYBER_POLY_VEC_COMPRESSED_SZ(KYBER768_K, 10) + +/* Public key size. */ +#define KYBER768_PUBLIC_KEY_SIZE \ + (KYBER768_POLY_VEC_SZ + KYBER_SYM_SZ) +/* Private key size. */ +#define KYBER768_PRIVATE_KEY_SIZE \ + (KYBER768_POLY_VEC_SZ + KYBER768_PUBLIC_KEY_SIZE + 2 * KYBER_SYM_SZ) +/* Cipher text size. */ +#define KYBER768_CIPHER_TEXT_SIZE \ + (KYBER768_POLY_VEC_COMPRESSED_SZ + KYBER768_POLY_COMPRESSED_SZ) + +/* Kyber-1024 parameters */ +/* Number of polynomials in a vector and vectors in a matrix. */ +#define KYBER1024_K 4 + +/* Size of a polynomial vector. */ +#define KYBER1024_POLY_VEC_SZ KYBER_POLY_VEC_SZ(KYBER1024_K) +/* Size of a compressed polynomial based on bits per coefficient. */ +#define KYBER1024_POLY_COMPRESSED_SZ KYBER_POLY_COMPRESSED_SZ(5) +/* Size of a compressed vector polynomial based on dimensions and bits per + * coefficient. */ +#define KYBER1024_POLY_VEC_COMPRESSED_SZ \ + KYBER_POLY_VEC_COMPRESSED_SZ(KYBER1024_K, 11) + +/* Public key size. */ +#define KYBER1024_PUBLIC_KEY_SIZE \ + (KYBER1024_POLY_VEC_SZ + KYBER_SYM_SZ) +/* Private key size. */ +#define KYBER1024_PRIVATE_KEY_SIZE \ + (KYBER1024_POLY_VEC_SZ + KYBER1024_PUBLIC_KEY_SIZE + 2 * KYBER_SYM_SZ) +/* Cipher text size. */ +#define KYBER1024_CIPHER_TEXT_SIZE \ + (KYBER1024_POLY_VEC_COMPRESSED_SZ + KYBER1024_POLY_COMPRESSED_SZ) + + +/* Maximum dimensions and sizes of supported key types. */ +#ifdef WOLFSSL_KYBER1024 +#define KYBER_MAX_K KYBER1024_K +#define KYBER_MAX_PRIVATE_KEY_SIZE KYBER1024_PRIVATE_KEY_SIZE +#define KYBER_MAX_PUBLIC_KEY_SIZE KYBER1024_PUBLIC_KEY_SIZE +#define KYBER_MAX_CIPHER_TEXT_SIZE KYBER1024_CIPHER_TEXT_SIZE +#elif defined(WOLFSSL_KYBER768) +#define KYBER_MAX_K KYBER768_K +#define KYBER_MAX_PRIVATE_KEY_SIZE KYBER768_PRIVATE_KEY_SIZE +#define KYBER_MAX_PUBLIC_KEY_SIZE KYBER768_PUBLIC_KEY_SIZE +#define KYBER_MAX_CIPHER_TEXT_SIZE KYBER768_CIPHER_TEXT_SIZE +#elif defined(WOLFSSL_KYBER512) +#define KYBER_MAX_K KYBER512_K +#define KYBER_MAX_PRIVATE_KEY_SIZE KYBER512_PRIVATE_KEY_SIZE +#define KYBER_MAX_PUBLIC_KEY_SIZE KYBER512_PUBLIC_KEY_SIZE +#define KYBER_MAX_CIPHER_TEXT_SIZE KYBER512_CIPHER_TEXT_SIZE +#endif + +#define KYBER_SYM_SZ WC_ML_KEM_SYM_SZ +#define KYBER_SS_SZ WC_ML_KEM_SS_SZ +#define KYBER_MAKEKEY_RAND_SZ WC_ML_KEM_MAKEKEY_RAND_SZ +#define KYBER_ENC_RAND_SZ WC_ML_KEM_ENC_RAND_SZ +#define KYBER_POLY_SIZE WC_ML_KEM_POLY_SIZE + + +enum { + /* Types of Kyber keys. */ + WC_ML_KEM_512 = 0, + WC_ML_KEM_768 = 1, + WC_ML_KEM_1024 = 2, + + MLKEM_KYBER = 0x10, + KYBER512 = 0 | MLKEM_KYBER, + KYBER768 = 1 | MLKEM_KYBER, + KYBER1024 = 2 | MLKEM_KYBER, + + KYBER_LEVEL1 = KYBER512, + KYBER_LEVEL3 = KYBER768, + KYBER_LEVEL5 = KYBER1024, + + /* Symmetric data size. */ + WC_ML_KEM_SYM_SZ = 32, + /* Shared secret size. */ + WC_ML_KEM_SS_SZ = 32, + /* Size of random required for making a key. */ + WC_ML_KEM_MAKEKEY_RAND_SZ = 2 * WC_ML_KEM_SYM_SZ, + /* Size of random required for encapsulation. */ + WC_ML_KEM_ENC_RAND_SZ = WC_ML_KEM_SYM_SZ, + + /* Encoded polynomial size. */ + WC_ML_KEM_POLY_SIZE = 384, +}; + + +/* Different structures for different implementations. */ +typedef struct MlKemKey MlKemKey; + + +#ifdef __cplusplus + extern "C" { +#endif + +WOLFSSL_API int wc_MlKemKey_Init(MlKemKey* key, int type, void* heap, + int devId); +WOLFSSL_API int wc_MlKemKey_Free(MlKemKey* key); + +WOLFSSL_API int wc_MlKemKey_MakeKey(MlKemKey* key, WC_RNG* rng); +WOLFSSL_API int wc_MlKemKey_MakeKeyWithRandom(MlKemKey* key, + const unsigned char* rand, int len); + +WOLFSSL_API int wc_MlKemKey_CipherTextSize(MlKemKey* key, word32* len); +WOLFSSL_API int wc_MlKemKey_SharedSecretSize(MlKemKey* key, word32* len); + +WOLFSSL_API int wc_MlKemKey_Encapsulate(MlKemKey* key, unsigned char* ct, + unsigned char* ss, WC_RNG* rng); +WOLFSSL_API int wc_MlKemKey_EncapsulateWithRandom(MlKemKey* key, + unsigned char* ct, unsigned char* ss, const unsigned char* rand, int len); +WOLFSSL_API int wc_MlKemKey_Decapsulate(MlKemKey* key, unsigned char* ss, + const unsigned char* ct, word32 len); + +WOLFSSL_API int wc_MlKemKey_DecodePrivateKey(MlKemKey* key, + const unsigned char* in, word32 len); +WOLFSSL_API int wc_MlKemKey_DecodePublicKey(MlKemKey* key, + const unsigned char* in, word32 len); + +WOLFSSL_API int wc_MlKemKey_PrivateKeySize(MlKemKey* key, word32* len); +WOLFSSL_API int wc_MlKemKey_PublicKeySize(MlKemKey* key, word32* len); +WOLFSSL_API int wc_MlKemKey_EncodePrivateKey(MlKemKey* key, unsigned char* out, + word32 len); +WOLFSSL_API int wc_MlKemKey_EncodePublicKey(MlKemKey* key, unsigned char* out, + word32 len); + + +#define KyberKey MlKemKey + +#define wc_KyberKey_Init(type, key, heap, devId) \ + wc_MlKemKey_Init(key, type, heap, devId) +#define wc_KyberKey_Free wc_MlKemKey_Free +#define wc_KyberKey_MakeKey wc_MlKemKey_MakeKey +#define wc_KyberKey_MakeKeyWithRandom wc_MlKemKey_MakeKeyWithRandom +#define wc_KyberKey_CipherTextSize wc_MlKemKey_CipherTextSize +#define wc_KyberKey_SharedSecretSize wc_MlKemKey_SharedSecretSize +#define wc_KyberKey_Encapsulate wc_MlKemKey_Encapsulate +#define wc_KyberKey_EncapsulateWithRandom wc_MlKemKey_EncapsulateWithRandom +#define wc_KyberKey_Decapsulate wc_MlKemKey_Decapsulate +#define wc_KyberKey_DecodePrivateKey wc_MlKemKey_DecodePrivateKey +#define wc_KyberKey_DecodePublicKey wc_MlKemKey_DecodePublicKey +#define wc_KyberKey_PrivateKeySize wc_MlKemKey_PrivateKeySize +#define wc_KyberKey_PublicKeySize wc_MlKemKey_PublicKeySize +#define wc_KyberKey_EncodePrivateKey wc_MlKemKey_EncodePrivateKey +#define wc_KyberKey_EncodePublicKey wc_MlKemKey_EncodePublicKey + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_HAVE_MLKEM */ + +#endif /* WOLF_CRYPT_MLKEM_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/mpi_class.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/mpi_class.h @@ -0,0 +1,1021 @@ +/* mpi_class.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + +#if !(defined(LTM1) && defined(LTM2) && defined(LTM3)) +#if defined(LTM2) +#define LTM3 +#endif +#if defined(LTM1) +#define LTM2 +#endif +#define LTM1 + +#if defined(LTM_ALL) +#define BN_ERROR_C +#define BN_FAST_MP_INVMOD_C +#define BN_FAST_MP_MONTGOMERY_REDUCE_C +#define BN_FAST_S_MP_MUL_DIGS_C +#define BN_FAST_S_MP_MUL_HIGH_DIGS_C +#define BN_FAST_S_MP_SQR_C +#define BN_MP_2EXPT_C +#define BN_MP_ABS_C +#define BN_MP_ADD_C +#define BN_MP_ADD_D_C +#define BN_MP_ADDMOD_C +#define BN_MP_AND_C +#define BN_MP_CLAMP_C +#define BN_MP_CLEAR_C +#define BN_MP_CLEAR_MULTI_C +#define BN_MP_CMP_C +#define BN_MP_CMP_D_C +#define BN_MP_CMP_MAG_C +#define BN_MP_CNT_LSB_C +#define BN_MP_COPY_C +#define BN_MP_COUNT_BITS_C +#define BN_MP_DIV_C +#define BN_MP_DIV_2_C +#define BN_MP_DIV_2D_C +#define BN_MP_DIV_3_C +#define BN_MP_DIV_D_C +#define BN_MP_DR_IS_MODULUS_C +#define BN_MP_DR_REDUCE_C +#define BN_MP_DR_SETUP_C +#define BN_MP_EXCH_C +#define BN_MP_EXPT_D_C +#define BN_MP_EXPTMOD_BASE_2 +#define BN_MP_EXPTMOD_C +#define BN_MP_EXPTMOD_FAST_C +#define BN_MP_EXTEUCLID_C +#define BN_MP_FREAD_C +#define BN_MP_FWRITE_C +#define BN_MP_GCD_C +#define BN_MP_GET_INT_C +#define BN_MP_GROW_C +#define BN_MP_INIT_C +#define BN_MP_INIT_COPY_C +#define BN_MP_INIT_MULTI_C +#define BN_MP_INIT_SET_C +#define BN_MP_INIT_SET_INT_C +#define BN_MP_INIT_SIZE_C +#define BN_MP_INVMOD_C +#define BN_MP_INVMOD_SLOW_C +#define BN_MP_IS_SQUARE_C +#define BN_MP_JACOBI_C +#define BN_MP_KARATSUBA_MUL_C +#define BN_MP_KARATSUBA_SQR_C +#define BN_MP_LCM_C +#define BN_MP_LSHD_C +#define BN_MP_MOD_C +#define BN_MP_MOD_2D_C +#define BN_MP_MOD_D_C +#define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +#define BN_MP_MONTGOMERY_REDUCE_C +#define BN_MP_MONTGOMERY_SETUP_C +#define BN_MP_MUL_C +#define BN_MP_MUL_2_C +#define BN_MP_MUL_2D_C +#define BN_MP_MUL_D_C +#define BN_MP_MULMOD_C +#define BN_MP_N_ROOT_C +#define BN_MP_NEG_C +#define BN_MP_OR_C +#define BN_MP_PRIME_FERMAT_C +#define BN_MP_PRIME_IS_DIVISIBLE_C +#define BN_MP_PRIME_IS_PRIME_C +#define BN_MP_PRIME_MILLER_RABIN_C +#define BN_MP_PRIME_NEXT_PRIME_C +#define BN_MP_PRIME_RABIN_MILLER_TRIALS_C +#define BN_MP_PRIME_RANDOM_EX_C +#define BN_MP_RADIX_SIZE_C +#define BN_MP_RADIX_SMAP_C +#define BN_MP_RAND_C +#define BN_MP_READ_RADIX_C +#define BN_MP_READ_SIGNED_BIN_C +#define BN_MP_READ_UNSIGNED_BIN_C +#define BN_MP_REDUCE_C +#define BN_MP_REDUCE_2K_C +#define BN_MP_REDUCE_2K_L_C +#define BN_MP_REDUCE_2K_SETUP_C +#define BN_MP_REDUCE_2K_SETUP_L_C +#define BN_MP_REDUCE_IS_2K_C +#define BN_MP_REDUCE_IS_2K_L_C +#define BN_MP_REDUCE_SETUP_C +#define BN_MP_RSHD_C +#define BN_MP_SET_C +#define BN_MP_SET_INT_C +#define BN_MP_SHRINK_C +#define BN_MP_SIGNED_BIN_SIZE_C +#define BN_MP_SQR_C +#define BN_MP_SQRMOD_C +#define BN_MP_SQRT_C +#define BN_MP_SUB_C +#define BN_MP_SUB_D_C +#define BN_MP_SUBMOD_C +#define BN_MP_TO_SIGNED_BIN_C +#define BN_MP_TO_SIGNED_BIN_N_C +#define BN_MP_TO_UNSIGNED_BIN_C +#define BN_MP_TO_UNSIGNED_BIN_N_C +#define BN_MP_TOOM_MUL_C +#define BN_MP_TOOM_SQR_C +#define BN_MP_TORADIX_C +#define BN_MP_TORADIX_N_C +#define BN_MP_UNSIGNED_BIN_SIZE_C +#define BN_MP_XOR_C +#define BN_MP_ZERO_C +#define BN_PRIME_TAB_C +#define BN_REVERSE_C +#define BN_S_MP_ADD_C +#define BN_S_MP_EXPTMOD_C +#define BN_S_MP_MUL_DIGS_C +#define BN_S_MP_MUL_HIGH_DIGS_C +#define BN_S_MP_SQR_C +#define BN_S_MP_SUB_C +#define BNCORE_C +#endif + +#if defined(BN_ERROR_C) + #define BN_MP_ERROR_TO_STRING_C +#endif + +#if defined(BN_FAST_MP_INVMOD_C) + #define BN_MP_ISEVEN_C + #define BN_MP_INIT_MULTI_C + #define BN_MP_COPY_C + #define BN_MP_MOD_C + #define BN_MP_SET_C + #define BN_MP_DIV_2_C + #define BN_MP_ISODD_C + #define BN_MP_SUB_C + #define BN_MP_CMP_C + #define BN_MP_ISZERO_C + #define BN_MP_CMP_D_C + #define BN_MP_ADD_C + #define BN_MP_EXCH_C + #define BN_MP_CLEAR_MULTI_C +#endif + +#if defined(BN_FAST_MP_MONTGOMERY_REDUCE_C) + #define BN_MP_GROW_C + #define BN_MP_RSHD_C + #define BN_MP_CLAMP_C + #define BN_MP_CMP_MAG_C + #define BN_S_MP_SUB_C +#endif + +#if defined(BN_FAST_S_MP_MUL_DIGS_C) + #define BN_MP_GROW_C + #define BN_MP_CLAMP_C +#endif + +#if defined(BN_FAST_S_MP_MUL_HIGH_DIGS_C) + #define BN_MP_GROW_C + #define BN_MP_CLAMP_C +#endif + +#if defined(BN_FAST_S_MP_SQR_C) + #define BN_MP_GROW_C + #define BN_MP_CLAMP_C +#endif + +#if defined(BN_MP_2EXPT_C) + #define BN_MP_ZERO_C + #define BN_MP_GROW_C +#endif + +#if defined(BN_MP_ABS_C) + #define BN_MP_COPY_C +#endif + +#if defined(BN_MP_ADD_C) + #define BN_S_MP_ADD_C + #define BN_MP_CMP_MAG_C + #define BN_S_MP_SUB_C +#endif + +#if defined(BN_MP_ADD_D_C) + #define BN_MP_GROW_C + #define BN_MP_SUB_D_C + #define BN_MP_CLAMP_C +#endif + +#if defined(BN_MP_ADDMOD_C) + #define BN_MP_INIT_C + #define BN_MP_ADD_C + #define BN_MP_CLEAR_C + #define BN_MP_MOD_C +#endif + +#if defined(BN_MP_AND_C) + #define BN_MP_INIT_COPY_C + #define BN_MP_CLAMP_C + #define BN_MP_EXCH_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_CLAMP_C) +#endif + +#if defined(BN_MP_CLEAR_C) +#endif + +#if defined(BN_MP_CLEAR_MULTI_C) + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_CMP_C) + #define BN_MP_CMP_MAG_C +#endif + +#if defined(BN_MP_CMP_D_C) +#endif + +#if defined(BN_MP_CMP_MAG_C) +#endif + +#if defined(BN_MP_CNT_LSB_C) + #define BN_MP_ISZERO_C +#endif + +#if defined(BN_MP_COPY_C) + #define BN_MP_GROW_C +#endif + +#if defined(BN_MP_COUNT_BITS_C) +#endif + +#if defined(BN_MP_DIV_C) + #define BN_MP_ISZERO_C + #define BN_MP_CMP_MAG_C + #define BN_MP_COPY_C + #define BN_MP_ZERO_C + #define BN_MP_INIT_MULTI_C + #define BN_MP_SET_C + #define BN_MP_COUNT_BITS_C + #define BN_MP_ABS_C + #define BN_MP_MUL_2D_C + #define BN_MP_CMP_C + #define BN_MP_SUB_C + #define BN_MP_ADD_C + #define BN_MP_DIV_2D_C + #define BN_MP_EXCH_C + #define BN_MP_CLEAR_MULTI_C + #define BN_MP_INIT_SIZE_C + #define BN_MP_INIT_C + #define BN_MP_INIT_COPY_C + #define BN_MP_LSHD_C + #define BN_MP_RSHD_C + #define BN_MP_MUL_D_C + #define BN_MP_CLAMP_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_DIV_2_C) + #define BN_MP_GROW_C + #define BN_MP_CLAMP_C +#endif + +#if defined(BN_MP_DIV_2D_C) + #define BN_MP_COPY_C + #define BN_MP_ZERO_C + #define BN_MP_INIT_C + #define BN_MP_MOD_2D_C + #define BN_MP_CLEAR_C + #define BN_MP_RSHD_C + #define BN_MP_CLAMP_C + #define BN_MP_EXCH_C +#endif + +#if defined(BN_MP_DIV_3_C) + #define BN_MP_INIT_SIZE_C + #define BN_MP_CLAMP_C + #define BN_MP_EXCH_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_DIV_D_C) + #define BN_MP_ISZERO_C + #define BN_MP_COPY_C + #define BN_MP_DIV_2D_C + #define BN_MP_DIV_3_C + #define BN_MP_INIT_SIZE_C + #define BN_MP_CLAMP_C + #define BN_MP_EXCH_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_DR_IS_MODULUS_C) +#endif + +#if defined(BN_MP_DR_REDUCE_C) + #define BN_MP_GROW_C + #define BN_MP_CLAMP_C + #define BN_MP_CMP_MAG_C + #define BN_S_MP_SUB_C +#endif + +#if defined(BN_MP_DR_SETUP_C) +#endif + +#if defined(BN_MP_EXCH_C) +#endif + +#if defined(BN_MP_EXPT_D_C) + #define BN_MP_INIT_COPY_C + #define BN_MP_SET_C + #define BN_MP_SQR_C + #define BN_MP_CLEAR_C + #define BN_MP_MUL_C +#endif + +#if defined(BN_MP_EXPTMOD_C) + #define BN_MP_INIT_C + #define BN_MP_INVMOD_C + #define BN_MP_CLEAR_C + #define BN_MP_ABS_C + #define BN_MP_CLEAR_MULTI_C + #define BN_MP_REDUCE_IS_2K_L_C + #define BN_S_MP_EXPTMOD_C + #define BN_MP_DR_IS_MODULUS_C + #define BN_MP_REDUCE_IS_2K_C + #define BN_MP_ISODD_C + #define BN_MP_EXPTMOD_FAST_C + #define BN_MP_EXPTMOD_BASE_2 +#endif + +#if defined(BN_MP_EXPTMOD_FAST_C) + #define BN_MP_COUNT_BITS_C + #define BN_MP_INIT_C + #define BN_MP_CLEAR_C + #define BN_MP_MONTGOMERY_SETUP_C + #define BN_FAST_MP_MONTGOMERY_REDUCE_C + #define BN_MP_MONTGOMERY_REDUCE_C + #define BN_MP_DR_SETUP_C + #define BN_MP_DR_REDUCE_C + #define BN_MP_REDUCE_2K_SETUP_C + #define BN_MP_REDUCE_2K_C + #define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C + #define BN_MP_MULMOD_C + #define BN_MP_SET_C + #define BN_MP_MOD_C + #define BN_MP_COPY_C + #define BN_MP_SQR_C + #define BN_MP_MUL_C + #define BN_MP_EXCH_C +#endif + +#if defined(BN_MP_EXTEUCLID_C) + #define BN_MP_INIT_MULTI_C + #define BN_MP_SET_C + #define BN_MP_COPY_C + #define BN_MP_ISZERO_C + #define BN_MP_DIV_C + #define BN_MP_MUL_C + #define BN_MP_SUB_C + #define BN_MP_NEG_C + #define BN_MP_EXCH_C + #define BN_MP_CLEAR_MULTI_C +#endif + +#if defined(BN_MP_FREAD_C) + #define BN_MP_ZERO_C + #define BN_MP_S_RMAP_C + #define BN_MP_MUL_D_C + #define BN_MP_ADD_D_C + #define BN_MP_CMP_D_C +#endif + +#if defined(BN_MP_FWRITE_C) + #define BN_MP_RADIX_SIZE_C + #define BN_MP_TORADIX_C +#endif + +#if defined(BN_MP_GCD_C) + #define BN_MP_ISZERO_C + #define BN_MP_ABS_C + #define BN_MP_ZERO_C + #define BN_MP_INIT_COPY_C + #define BN_MP_CNT_LSB_C + #define BN_MP_DIV_2D_C + #define BN_MP_CMP_MAG_C + #define BN_MP_EXCH_C + #define BN_S_MP_SUB_C + #define BN_MP_MUL_2D_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_GET_INT_C) +#endif + +#if defined(BN_MP_GROW_C) +#endif + +#if defined(BN_MP_INIT_C) +#endif + +#if defined(BN_MP_INIT_COPY_C) + #define BN_MP_COPY_C +#endif + +#if defined(BN_MP_INIT_MULTI_C) + #define BN_MP_ERR_C + #define BN_MP_INIT_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_INIT_SET_C) + #define BN_MP_INIT_C + #define BN_MP_SET_C +#endif + +#if defined(BN_MP_INIT_SET_INT_C) + #define BN_MP_INIT_C + #define BN_MP_SET_INT_C +#endif + +#if defined(BN_MP_INIT_SIZE_C) + #define BN_MP_INIT_C +#endif + +#if defined(BN_MP_INVMOD_C) + #define BN_MP_ISZERO_C + #define BN_MP_ISODD_C + #define BN_FAST_MP_INVMOD_C + #define BN_MP_INVMOD_SLOW_C +#endif + +#if defined(BN_MP_INVMOD_SLOW_C) + #define BN_MP_ISZERO_C + #define BN_MP_INIT_MULTI_C + #define BN_MP_MOD_C + #define BN_MP_COPY_C + #define BN_MP_ISEVEN_C + #define BN_MP_SET_C + #define BN_MP_DIV_2_C + #define BN_MP_ISODD_C + #define BN_MP_ADD_C + #define BN_MP_SUB_C + #define BN_MP_CMP_C + #define BN_MP_CMP_D_C + #define BN_MP_CMP_MAG_C + #define BN_MP_EXCH_C + #define BN_MP_CLEAR_MULTI_C +#endif + +#if defined(BN_MP_IS_SQUARE_C) + #define BN_MP_MOD_D_C + #define BN_MP_INIT_SET_INT_C + #define BN_MP_MOD_C + #define BN_MP_GET_INT_C + #define BN_MP_SQRT_C + #define BN_MP_SQR_C + #define BN_MP_CMP_MAG_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_JACOBI_C) + #define BN_MP_CMP_D_C + #define BN_MP_ISZERO_C + #define BN_MP_INIT_COPY_C + #define BN_MP_CNT_LSB_C + #define BN_MP_DIV_2D_C + #define BN_MP_MOD_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_KARATSUBA_MUL_C) + #define BN_MP_MUL_C + #define BN_MP_INIT_SIZE_C + #define BN_MP_CLAMP_C + #define BN_MP_SUB_C + #define BN_MP_ADD_C + #define BN_MP_LSHD_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_KARATSUBA_SQR_C) + #define BN_MP_INIT_SIZE_C + #define BN_MP_CLAMP_C + #define BN_MP_SQR_C + #define BN_MP_SUB_C + #define BN_S_MP_ADD_C + #define BN_MP_LSHD_C + #define BN_MP_ADD_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_LCM_C) + #define BN_MP_INIT_MULTI_C + #define BN_MP_GCD_C + #define BN_MP_CMP_MAG_C + #define BN_MP_DIV_C + #define BN_MP_MUL_C + #define BN_MP_CLEAR_MULTI_C +#endif + +#if defined(BN_MP_LSHD_C) + #define BN_MP_GROW_C + #define BN_MP_RSHD_C +#endif + +#if defined(BN_MP_MOD_C) + #define BN_MP_INIT_C + #define BN_MP_DIV_C + #define BN_MP_CLEAR_C + #define BN_MP_ADD_C + #define BN_MP_EXCH_C +#endif + +#if defined(BN_MP_MOD_2D_C) + #define BN_MP_ZERO_C + #define BN_MP_COPY_C + #define BN_MP_CLAMP_C +#endif + +#if defined(BN_MP_MOD_D_C) + #define BN_MP_DIV_D_C +#endif + +#if defined(BN_MP_MONTGOMERY_CALC_NORMALIZATION_C) + #define BN_MP_COUNT_BITS_C + #define BN_MP_2EXPT_C + #define BN_MP_SET_C + #define BN_MP_MUL_2_C + #define BN_MP_CMP_MAG_C + #define BN_S_MP_SUB_C +#endif + +#if defined(BN_MP_MONTGOMERY_REDUCE_C) + #define BN_FAST_MP_MONTGOMERY_REDUCE_C + #define BN_MP_GROW_C + #define BN_MP_CLAMP_C + #define BN_MP_RSHD_C + #define BN_MP_CMP_MAG_C + #define BN_S_MP_SUB_C +#endif + +#if defined(BN_MP_MONTGOMERY_SETUP_C) +#endif + +#if defined(BN_MP_MUL_C) + #define BN_MP_TOOM_MUL_C + #define BN_MP_KARATSUBA_MUL_C + #define BN_FAST_S_MP_MUL_DIGS_C + #define BN_S_MP_MUL_C + #define BN_S_MP_MUL_DIGS_C +#endif + +#if defined(BN_MP_MUL_2_C) + #define BN_MP_GROW_C +#endif + +#if defined(BN_MP_MUL_2D_C) + #define BN_MP_COPY_C + #define BN_MP_GROW_C + #define BN_MP_LSHD_C + #define BN_MP_CLAMP_C +#endif + +#if defined(BN_MP_MUL_D_C) + #define BN_MP_GROW_C + #define BN_MP_CLAMP_C +#endif + +#if defined(BN_MP_MULMOD_C) + #define BN_MP_INIT_C + #define BN_MP_MUL_C + #define BN_MP_CLEAR_C + #define BN_MP_MOD_C +#endif + +#if defined(BN_MP_N_ROOT_C) + #define BN_MP_INIT_C + #define BN_MP_SET_C + #define BN_MP_COPY_C + #define BN_MP_EXPT_D_C + #define BN_MP_MUL_C + #define BN_MP_SUB_C + #define BN_MP_MUL_D_C + #define BN_MP_DIV_C + #define BN_MP_CMP_C + #define BN_MP_SUB_D_C + #define BN_MP_EXCH_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_NEG_C) + #define BN_MP_COPY_C + #define BN_MP_ISZERO_C +#endif + +#if defined(BN_MP_OR_C) + #define BN_MP_INIT_COPY_C + #define BN_MP_CLAMP_C + #define BN_MP_EXCH_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_PRIME_FERMAT_C) + #define BN_MP_CMP_D_C + #define BN_MP_INIT_C + #define BN_MP_EXPTMOD_C + #define BN_MP_CMP_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_PRIME_IS_DIVISIBLE_C) + #define BN_MP_MOD_D_C +#endif + +#if defined(BN_MP_PRIME_IS_PRIME_C) + #define BN_MP_CMP_D_C + #define BN_MP_PRIME_IS_DIVISIBLE_C + #define BN_MP_INIT_C + #define BN_MP_SET_C + #define BN_MP_PRIME_MILLER_RABIN_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_PRIME_MILLER_RABIN_C) + #define BN_MP_CMP_D_C + #define BN_MP_INIT_COPY_C + #define BN_MP_SUB_D_C + #define BN_MP_CNT_LSB_C + #define BN_MP_DIV_2D_C + #define BN_MP_EXPTMOD_C + #define BN_MP_CMP_C + #define BN_MP_SQRMOD_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_PRIME_NEXT_PRIME_C) + #define BN_MP_CMP_D_C + #define BN_MP_SET_C + #define BN_MP_SUB_D_C + #define BN_MP_ISEVEN_C + #define BN_MP_MOD_D_C + #define BN_MP_INIT_C + #define BN_MP_ADD_D_C + #define BN_MP_PRIME_MILLER_RABIN_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_PRIME_RABIN_MILLER_TRIALS_C) +#endif + +#if defined(BN_MP_PRIME_RANDOM_EX_C) + #define BN_MP_READ_UNSIGNED_BIN_C + #define BN_MP_PRIME_IS_PRIME_C + #define BN_MP_SUB_D_C + #define BN_MP_DIV_2_C + #define BN_MP_MUL_2_C + #define BN_MP_ADD_D_C +#endif + +#if defined(BN_MP_RADIX_SIZE_C) + #define BN_MP_COUNT_BITS_C + #define BN_MP_INIT_COPY_C + #define BN_MP_ISZERO_C + #define BN_MP_DIV_D_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_RADIX_SMAP_C) + #define BN_MP_S_RMAP_C +#endif + +#if defined(BN_MP_RAND_C) + #define BN_MP_ZERO_C + #define BN_MP_ADD_D_C + #define BN_MP_LSHD_C +#endif + +#if defined(BN_MP_READ_RADIX_C) + #define BN_MP_ZERO_C + #define BN_MP_S_RMAP_C + #define BN_MP_RADIX_SMAP_C + #define BN_MP_MUL_D_C + #define BN_MP_ADD_D_C + #define BN_MP_ISZERO_C +#endif + +#if defined(BN_MP_READ_SIGNED_BIN_C) + #define BN_MP_READ_UNSIGNED_BIN_C +#endif + +#if defined(BN_MP_READ_UNSIGNED_BIN_C) + #define BN_MP_GROW_C + #define BN_MP_ZERO_C + #define BN_MP_MUL_2D_C + #define BN_MP_CLAMP_C +#endif + +#if defined(BN_MP_REDUCE_C) + #define BN_MP_REDUCE_SETUP_C + #define BN_MP_INIT_COPY_C + #define BN_MP_RSHD_C + #define BN_MP_MUL_C + #define BN_S_MP_MUL_HIGH_DIGS_C + #define BN_FAST_S_MP_MUL_HIGH_DIGS_C + #define BN_MP_MOD_2D_C + #define BN_S_MP_MUL_DIGS_C + #define BN_MP_SUB_C + #define BN_MP_CMP_D_C + #define BN_MP_SET_C + #define BN_MP_LSHD_C + #define BN_MP_ADD_C + #define BN_MP_CMP_C + #define BN_S_MP_SUB_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_REDUCE_2K_C) + #define BN_MP_INIT_C + #define BN_MP_COUNT_BITS_C + #define BN_MP_DIV_2D_C + #define BN_MP_MUL_D_C + #define BN_S_MP_ADD_C + #define BN_MP_CMP_MAG_C + #define BN_S_MP_SUB_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_REDUCE_2K_L_C) + #define BN_MP_INIT_C + #define BN_MP_COUNT_BITS_C + #define BN_MP_DIV_2D_C + #define BN_MP_MUL_C + #define BN_S_MP_ADD_C + #define BN_MP_CMP_MAG_C + #define BN_S_MP_SUB_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_REDUCE_2K_SETUP_C) + #define BN_MP_INIT_C + #define BN_MP_COUNT_BITS_C + #define BN_MP_2EXPT_C + #define BN_MP_CLEAR_C + #define BN_S_MP_SUB_C +#endif + +#if defined(BN_MP_REDUCE_2K_SETUP_L_C) + #define BN_MP_INIT_C + #define BN_MP_2EXPT_C + #define BN_MP_COUNT_BITS_C + #define BN_S_MP_SUB_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_REDUCE_IS_2K_C) + #define BN_MP_REDUCE_2K_C + #define BN_MP_COUNT_BITS_C +#endif + +#if defined(BN_MP_REDUCE_IS_2K_L_C) +#endif + +#if defined(BN_MP_REDUCE_SETUP_C) + #define BN_MP_2EXPT_C + #define BN_MP_DIV_C +#endif + +#if defined(BN_MP_RSHD_C) + #define BN_MP_ZERO_C +#endif + +#if defined(BN_MP_SET_C) + #define BN_MP_ZERO_C +#endif + +#if defined(BN_MP_SET_INT_C) + #define BN_MP_ZERO_C + #define BN_MP_MUL_2D_C + #define BN_MP_CLAMP_C +#endif + +#if defined(BN_MP_SHRINK_C) +#endif + +#if defined(BN_MP_SIGNED_BIN_SIZE_C) + #define BN_MP_UNSIGNED_BIN_SIZE_C +#endif + +#if defined(BN_MP_SQR_C) + #define BN_MP_TOOM_SQR_C + #define BN_MP_KARATSUBA_SQR_C + #define BN_FAST_S_MP_SQR_C + #define BN_S_MP_SQR_C +#endif + +#if defined(BN_MP_SQRMOD_C) + #define BN_MP_INIT_C + #define BN_MP_SQR_C + #define BN_MP_CLEAR_C + #define BN_MP_MOD_C +#endif + +#if defined(BN_MP_SQRT_C) + #define BN_MP_N_ROOT_C + #define BN_MP_ISZERO_C + #define BN_MP_ZERO_C + #define BN_MP_INIT_COPY_C + #define BN_MP_RSHD_C + #define BN_MP_DIV_C + #define BN_MP_ADD_C + #define BN_MP_DIV_2_C + #define BN_MP_CMP_MAG_C + #define BN_MP_EXCH_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_SUB_C) + #define BN_S_MP_ADD_C + #define BN_MP_CMP_MAG_C + #define BN_S_MP_SUB_C +#endif + +#if defined(BN_MP_SUB_D_C) + #define BN_MP_GROW_C + #define BN_MP_ADD_D_C + #define BN_MP_CLAMP_C +#endif + +#if defined(BN_MP_SUBMOD_C) + #define BN_MP_INIT_C + #define BN_MP_SUB_C + #define BN_MP_CLEAR_C + #define BN_MP_MOD_C +#endif + +#if defined(BN_MP_TO_SIGNED_BIN_C) + #define BN_MP_TO_UNSIGNED_BIN_C +#endif + +#if defined(BN_MP_TO_SIGNED_BIN_N_C) + #define BN_MP_SIGNED_BIN_SIZE_C + #define BN_MP_TO_SIGNED_BIN_C +#endif + +#if defined(BN_MP_TO_UNSIGNED_BIN_C) + #define BN_MP_INIT_COPY_C + #define BN_MP_ISZERO_C + #define BN_MP_DIV_2D_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_TO_UNSIGNED_BIN_N_C) + #define BN_MP_UNSIGNED_BIN_SIZE_C + #define BN_MP_TO_UNSIGNED_BIN_C +#endif + +#if defined(BN_MP_TOOM_MUL_C) + #define BN_MP_INIT_MULTI_C + #define BN_MP_MOD_2D_C + #define BN_MP_COPY_C + #define BN_MP_RSHD_C + #define BN_MP_MUL_C + #define BN_MP_MUL_2_C + #define BN_MP_ADD_C + #define BN_MP_SUB_C + #define BN_MP_DIV_2_C + #define BN_MP_MUL_2D_C + #define BN_MP_MUL_D_C + #define BN_MP_DIV_3_C + #define BN_MP_LSHD_C + #define BN_MP_CLEAR_MULTI_C +#endif + +#if defined(BN_MP_TOOM_SQR_C) + #define BN_MP_INIT_MULTI_C + #define BN_MP_MOD_2D_C + #define BN_MP_COPY_C + #define BN_MP_RSHD_C + #define BN_MP_SQR_C + #define BN_MP_MUL_2_C + #define BN_MP_ADD_C + #define BN_MP_SUB_C + #define BN_MP_DIV_2_C + #define BN_MP_MUL_2D_C + #define BN_MP_MUL_D_C + #define BN_MP_DIV_3_C + #define BN_MP_LSHD_C + #define BN_MP_CLEAR_MULTI_C +#endif + +#if defined(BN_MP_TORADIX_C) + #define BN_MP_ISZERO_C + #define BN_MP_INIT_COPY_C + #define BN_MP_DIV_D_C + #define BN_MP_CLEAR_C + #define BN_MP_S_RMAP_C +#endif + +#if defined(BN_MP_TORADIX_N_C) + #define BN_MP_ISZERO_C + #define BN_MP_INIT_COPY_C + #define BN_MP_DIV_D_C + #define BN_MP_CLEAR_C + #define BN_MP_S_RMAP_C +#endif + +#if defined(BN_MP_UNSIGNED_BIN_SIZE_C) + #define BN_MP_COUNT_BITS_C +#endif + +#if defined(BN_MP_XOR_C) + #define BN_MP_INIT_COPY_C + #define BN_MP_CLAMP_C + #define BN_MP_EXCH_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_MP_ZERO_C) +#endif + +#if defined(BN_PRIME_TAB_C) +#endif + +#if defined(BN_REVERSE_C) +#endif + +#if defined(BN_S_MP_ADD_C) + #define BN_MP_GROW_C + #define BN_MP_CLAMP_C +#endif + +#if defined(BN_S_MP_EXPTMOD_C) + #define BN_MP_COUNT_BITS_C + #define BN_MP_INIT_C + #define BN_MP_CLEAR_C + #define BN_MP_REDUCE_SETUP_C + #define BN_MP_REDUCE_C + #define BN_MP_REDUCE_2K_SETUP_L_C + #define BN_MP_REDUCE_2K_L_C + #define BN_MP_MOD_C + #define BN_MP_COPY_C + #define BN_MP_SQR_C + #define BN_MP_MUL_C + #define BN_MP_SET_C + #define BN_MP_EXCH_C +#endif + +#if defined(BN_S_MP_MUL_DIGS_C) + #define BN_FAST_S_MP_MUL_DIGS_C + #define BN_MP_INIT_SIZE_C + #define BN_MP_CLAMP_C + #define BN_MP_EXCH_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_S_MP_MUL_HIGH_DIGS_C) + #define BN_FAST_S_MP_MUL_HIGH_DIGS_C + #define BN_MP_INIT_SIZE_C + #define BN_MP_CLAMP_C + #define BN_MP_EXCH_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_S_MP_SQR_C) + #define BN_MP_INIT_SIZE_C + #define BN_MP_CLAMP_C + #define BN_MP_EXCH_C + #define BN_MP_CLEAR_C +#endif + +#if defined(BN_S_MP_SUB_C) + #define BN_MP_GROW_C + #define BN_MP_CLAMP_C +#endif + +#if defined(BNCORE_C) +#endif + +#ifdef LTM3 +#define LTM_LAST +#endif +#include "mpi_superclass.h" +#include "mpi_class.h" +#else +#define LTM_LAST +#endif + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/mpi_superclass.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/mpi_superclass.h @@ -0,0 +1,96 @@ +/* mpi_superclass.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + +/* super class file for PK algos */ + +/* default ... include all MPI */ +#define LTM_ALL + +/* RSA only (does not support DH/DSA/ECC) */ +/* #define SC_RSA_1 */ + +/* For reference.... On an Athlon64 optimizing for speed... + + LTM's mpi.o with all functions [striped] is 142KiB in size. + +*/ + +/* Works for RSA only, mpi.o is 68KiB */ +#ifdef SC_RSA_1 + #define BN_MP_SHRINK_C + #define BN_MP_LCM_C + #define BN_MP_PRIME_RANDOM_EX_C + #define BN_MP_INVMOD_C + #define BN_MP_GCD_C + #define BN_MP_MOD_C + #define BN_MP_MULMOD_C + #define BN_MP_ADDMOD_C + #define BN_MP_EXPTMOD_C + #define BN_MP_SET_INT_C + #define BN_MP_INIT_MULTI_C + #define BN_MP_CLEAR_MULTI_C + #define BN_MP_UNSIGNED_BIN_SIZE_C + #define BN_MP_TO_UNSIGNED_BIN_C + #define BN_MP_MOD_D_C + #define BN_MP_PRIME_RABIN_MILLER_TRIALS_C + #define BN_REVERSE_C + #define BN_PRIME_TAB_C + + /* other modifiers */ + #define BN_MP_DIV_SMALL /* Slower division, not critical */ + + /* here we are on the last pass so we turn things off. The functions classes are still there + * but we remove them specifically from the build. This also invokes tweaks in functions + * like removing support for even moduli, etc... + */ +#ifdef LTM_LAST + #undef BN_MP_TOOM_MUL_C + #undef BN_MP_TOOM_SQR_C + #undef BN_MP_KARATSUBA_MUL_C + #undef BN_MP_KARATSUBA_SQR_C + #undef BN_MP_REDUCE_C + #undef BN_MP_REDUCE_SETUP_C + #undef BN_MP_DR_IS_MODULUS_C + #undef BN_MP_DR_SETUP_C + #undef BN_MP_DR_REDUCE_C + #undef BN_MP_REDUCE_IS_2K_C + #undef BN_MP_REDUCE_2K_SETUP_C + #undef BN_MP_REDUCE_2K_C + #undef BN_S_MP_EXPTMOD_C + #undef BN_MP_DIV_3_C + #undef BN_S_MP_MUL_HIGH_DIGS_C + #undef BN_FAST_S_MP_MUL_HIGH_DIGS_C + #undef BN_FAST_MP_INVMOD_C + + /* To safely undefine these you have to make sure your RSA key won't exceed the Comba threshold + * which is roughly 255 digits [7140 bits for 32-bit machines, 15300 bits for 64-bit machines] + * which means roughly speaking you can handle up to 2536-bit RSA keys with these defined without + * trouble. + */ + #undef BN_S_MP_MUL_DIGS_C + #undef BN_S_MP_SQR_C + #undef BN_MP_MONTGOMERY_REDUCE_C +#endif + +#endif + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/oid_sum.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/oid_sum.h @@ -0,0 +1,1903 @@ +/* oid_sum.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* Generated using (from wolfssl): + * ./scripts/asn1_oid_sum.pl > wolfssl/wolfcrypt/oid_sum.h + */ + +#ifndef WOLF_CRYPT_OID_SUM_H +#define WOLF_CRYPT_OID_SUM_H + +enum Hash_Sum { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x02 */ + MD2h = 646, /* 1.2.840.113549.2.2 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x04 */ + MD4h = 648, /* 1.2.840.113549.2.4 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05 */ + MD5h = 649, /* 1.2.840.113549.2.5 */ + /* 0x2b,0x0e,0x03,0x02,0x1a */ + SHAh = 88, /* 1.3.14.3.2.26 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x04 */ + SHA224h = 417, /* 2.16.840.1.101.3.4.2.4 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01 */ + SHA256h = 414, /* 2.16.840.1.101.3.4.2.1 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x02 */ + SHA384h = 415, /* 2.16.840.1.101.3.4.2.2 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x03 */ + SHA512h = 416, /* 2.16.840.1.101.3.4.2.3 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x05 */ + SHA512_224h = 418, /* 2.16.840.1.101.3.4.2.5 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x06 */ + SHA512_256h = 419, /* 2.16.840.1.101.3.4.2.6 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x07 */ + SHA3_224h = 420, /* 2.16.840.1.101.3.4.2.7 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x08 */ + SHA3_256h = 421, /* 2.16.840.1.101.3.4.2.8 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x09 */ + SHA3_384h = 422, /* 2.16.840.1.101.3.4.2.9 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x0a */ + SHA3_512h = 423, /* 2.16.840.1.101.3.4.2.10 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x0b */ + SHAKE128h = 424, /* 2.16.840.1.101.3.4.2.11 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x0c */ + SHAKE256h = 425, /* 2.16.840.1.101.3.4.2.12 */ + /* 0x2a,0x81,0x1c,0xcf,0x55,0x01,0x83,0x11 */ + SM3h = 640 /* 1.2.156.10197.1.401 */ +#else + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x02 */ + MD2h = 0x044a8bdd, /* 1.2.840.113549.2.2 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x04 */ + MD4h = 0x024a8bdd, /* 1.2.840.113549.2.4 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05 */ + MD5h = 0x034a8bdd, /* 1.2.840.113549.2.5 */ + /* 0x2b,0x0e,0x03,0x02,0x1a */ + SHAh = 0x7d03f131, /* 1.3.14.3.2.26 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x04 */ + SHA224h = 0x7cb37afe, /* 2.16.840.1.101.3.4.2.4 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01 */ + SHA256h = 0x7cb37afb, /* 2.16.840.1.101.3.4.2.1 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x02 */ + SHA384h = 0x7cb37af8, /* 2.16.840.1.101.3.4.2.2 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x03 */ + SHA512h = 0x7cb37af9, /* 2.16.840.1.101.3.4.2.3 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x05 */ + SHA512_224h = 0x7cb37aff, /* 2.16.840.1.101.3.4.2.5 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x06 */ + SHA512_256h = 0x7cb37afc, /* 2.16.840.1.101.3.4.2.6 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x07 */ + SHA3_224h = 0x7cb37afd, /* 2.16.840.1.101.3.4.2.7 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x08 */ + SHA3_256h = 0x7cb37af2, /* 2.16.840.1.101.3.4.2.8 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x09 */ + SHA3_384h = 0x7cb37af3, /* 2.16.840.1.101.3.4.2.9 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x0a */ + SHA3_512h = 0x7cb37af0, /* 2.16.840.1.101.3.4.2.10 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x0b */ + SHAKE128h = 0x7cb37af1, /* 2.16.840.1.101.3.4.2.11 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x0c */ + SHAKE256h = 0x7cb37af6, /* 2.16.840.1.101.3.4.2.12 */ + /* 0x2a,0x81,0x1c,0xcf,0x55,0x01,0x83,0x11 */ + SM3h = 0x5e9f807f /* 1.2.156.10197.1.401 */ +#endif +}; + +enum Block_Sum { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x02 */ + AES128CBCb = 414, /* 2.16.840.1.101.3.4.1.2 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x06 */ + AES128GCMb = 418, /* 2.16.840.1.101.3.4.1.6 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x07 */ + AES128CCMb = 419, /* 2.16.840.1.101.3.4.1.7 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x16 */ + AES192CBCb = 434, /* 2.16.840.1.101.3.4.1.22 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x1a */ + AES192GCMb = 438, /* 2.16.840.1.101.3.4.1.26 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x1b */ + AES192CCMb = 439, /* 2.16.840.1.101.3.4.1.27 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x2a */ + AES256CBCb = 454, /* 2.16.840.1.101.3.4.1.42 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x2e */ + AES256GCMb = 458, /* 2.16.840.1.101.3.4.1.46 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x2f */ + AES256CCMb = 459, /* 2.16.840.1.101.3.4.1.47 */ + /* 0x2b,0x0e,0x03,0x02,0x07 */ + DESb = 69, /* 1.3.14.3.2.7 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x03,0x07 */ + DES3b = 652 /* 1.2.840.113549.3.7 */ +#else + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x02 */ + AES128CBCb = 0x7fb37af8, /* 2.16.840.1.101.3.4.1.2 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x06 */ + AES128GCMb = 0x7fb37afc, /* 2.16.840.1.101.3.4.1.6 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x07 */ + AES128CCMb = 0x7fb37afd, /* 2.16.840.1.101.3.4.1.7 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x16 */ + AES192CBCb = 0x7fb37aec, /* 2.16.840.1.101.3.4.1.22 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x1a */ + AES192GCMb = 0x7fb37ae0, /* 2.16.840.1.101.3.4.1.26 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x1b */ + AES192CCMb = 0x7fb37ae1, /* 2.16.840.1.101.3.4.1.27 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x2a */ + AES256CBCb = 0x7fb37ad0, /* 2.16.840.1.101.3.4.1.42 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x2e */ + AES256GCMb = 0x7fb37ad4, /* 2.16.840.1.101.3.4.1.46 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x2f */ + AES256CCMb = 0x7fb37ad5, /* 2.16.840.1.101.3.4.1.47 */ + /* 0x2b,0x0e,0x03,0x02,0x07 */ + DESb = 0x7d03f12c, /* 1.3.14.3.2.7 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x03,0x07 */ + DES3b = 0x014b8bdd /* 1.2.840.113549.3.7 */ +#endif +}; + +enum Key_Sum { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x00 */ + ANONk = 0, /* 0.0 */ + /* 0x2a,0x86,0x48,0xce,0x38,0x04,0x01 */ + DSAk = 515, /* 1.2.840.10040.4.1 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01 */ + RSAk = 645, /* 1.2.840.113549.1.1.1 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0a */ + RSAPSSk = 654, /* 1.2.840.113549.1.1.10 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x07 */ + RSAESOAEPk = 651, /* 1.2.840.113549.1.1.7 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x02,0x01 */ + ECDSAk = 518, /* 1.2.840.10045.2.1 */ + /* 0x2a,0x81,0x1c,0xcf,0x55,0x01,0x82,0x2d */ + SM2k = 667, /* 1.2.156.10197.1.301 */ + /* 0x2b,0x65,0x70 */ + ED25519k = 256, /* 1.3.101.112 */ + /* 0x2b,0x65,0x6e */ + X25519k = 254, /* 1.3.101.110 */ + /* 0x2b,0x65,0x71 */ + ED448k = 257, /* 1.3.101.113 */ + /* 0x2b,0x65,0x6f */ + X448k = 255, /* 1.3.101.111 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x03,0x01 */ + DHk = 647, /* 1.2.840.113549.1.3.1 */ + /* 0x2b,0xce,0x0f,0x03,0x06 */ + FALCON_LEVEL1k = 273, /* 1.3.9999.3.6 */ + /* 0x2b,0xce,0x0f,0x03,0x09 */ + FALCON_LEVEL5k = 276, /* 1.3.9999.3.9 */ + /* 0x2b,0x06,0x01,0x04,0x01,0x02,0x82,0x0b,0x0c,0x04,0x04 */ + DILITHIUM_LEVEL2k = 218, /* 1.3.6.1.4.1.2.267.12.4.4 */ + /* 0x2b,0x06,0x01,0x04,0x01,0x02,0x82,0x0b,0x0c,0x06,0x05 */ + DILITHIUM_LEVEL3k = 221, /* 1.3.6.1.4.1.2.267.12.6.5 */ + /* 0x2b,0x06,0x01,0x04,0x01,0x02,0x82,0x0b,0x0c,0x08,0x07 */ + DILITHIUM_LEVEL5k = 225, /* 1.3.6.1.4.1.2.267.12.8.7 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x11 */ + ML_DSA_LEVEL2k = 431, /* 2.16.840.1.101.3.4.3.17 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x12 */ + ML_DSA_LEVEL3k = 432, /* 2.16.840.1.101.3.4.3.18 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x13 */ + ML_DSA_LEVEL5k = 433, /* 2.16.840.1.101.3.4.3.19 */ + /* 0x2b,0xce,0x0f,0x06,0x07,0x04 */ + SPHINCS_FAST_LEVEL1k = 281, /* 1.3.9999.6.7.4 */ + /* 0x2b,0xce,0x0f,0x06,0x08,0x03 */ + SPHINCS_FAST_LEVEL3k = 283, /* 1.3.9999.6.8.3 */ + /* 0x2b,0xce,0x0f,0x06,0x09,0x03 */ + SPHINCS_FAST_LEVEL5k = 282, /* 1.3.9999.6.9.3 */ + /* 0x2b,0xce,0x0f,0x06,0x07,0x0a */ + SPHINCS_SMALL_LEVEL1k = 287, /* 1.3.9999.6.7.10 */ + /* 0x2b,0xce,0x0f,0x06,0x08,0x07 */ + SPHINCS_SMALL_LEVEL3k = 285, /* 1.3.9999.6.8.7 */ + /* 0x2b,0xce,0x0f,0x06,0x09,0x07 */ + SPHINCS_SMALL_LEVEL5k = 286 /* 1.3.9999.6.9.7 */ +#else + /* 0x00 */ + ANONk = 0x7fffffff, /* 0.0 */ + /* 0x2a,0x86,0x48,0xce,0x38,0x04,0x01 */ + DSAk = 0x31498212, /* 1.2.840.10040.4.1 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01 */ + RSAk = 0x78b67423, /* 1.2.840.113549.1.1.1 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0a */ + RSAPSSk = 0x78b67428, /* 1.2.840.113549.1.1.10 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x07 */ + RSAESOAEPk = 0x78b67425, /* 1.2.840.113549.1.1.7 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x02,0x01 */ + ECDSAk = 0x31498417, /* 1.2.840.10045.2.1 */ + /* 0x2a,0x81,0x1c,0xcf,0x55,0x01,0x82,0x2d */ + SM2k = 0x629e807f, /* 1.2.156.10197.1.301 */ + /* 0x2b,0x65,0x70 */ + ED25519k = 0x7f8f65d4, /* 1.3.101.112 */ + /* 0x2b,0x65,0x6e */ + X25519k = 0x7f9165d4, /* 1.3.101.110 */ + /* 0x2b,0x65,0x71 */ + ED448k = 0x7f8e65d4, /* 1.3.101.113 */ + /* 0x2b,0x65,0x6f */ + X448k = 0x7f9065d4, /* 1.3.101.111 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x03,0x01 */ + DHk = 0x7ab67423, /* 1.2.840.113549.1.3.1 */ + /* 0x2b,0xce,0x0f,0x03,0x06 */ + FALCON_LEVEL1k = 0x7c0f312d, /* 1.3.9999.3.6 */ + /* 0x2b,0xce,0x0f,0x03,0x09 */ + FALCON_LEVEL5k = 0x7c0f3122, /* 1.3.9999.3.9 */ + /* 0x2b,0x06,0x01,0x04,0x01,0x02,0x82,0x0b,0x0c,0x04,0x04 */ + DILITHIUM_LEVEL2k = 0x707800d9, /* 1.3.6.1.4.1.2.267.12.4.4 */ + /* 0x2b,0x06,0x01,0x04,0x01,0x02,0x82,0x0b,0x0c,0x06,0x05 */ + DILITHIUM_LEVEL3k = 0x707902d9, /* 1.3.6.1.4.1.2.267.12.6.5 */ + /* 0x2b,0x06,0x01,0x04,0x01,0x02,0x82,0x0b,0x0c,0x08,0x07 */ + DILITHIUM_LEVEL5k = 0x707b0cd9, /* 1.3.6.1.4.1.2.267.12.8.7 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x11 */ + ML_DSA_LEVEL2k = 0x7db37aeb, /* 2.16.840.1.101.3.4.3.17 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x12 */ + ML_DSA_LEVEL3k = 0x7db37ae8, /* 2.16.840.1.101.3.4.3.18 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x13 */ + ML_DSA_LEVEL5k = 0x7db37ae9, /* 2.16.840.1.101.3.4.3.19 */ + /* 0x2b,0xce,0x0f,0x06,0x07,0x04 */ + SPHINCS_FAST_LEVEL1k = 0x06f0ca2c, /* 1.3.9999.6.7.4 */ + /* 0x2b,0xce,0x0f,0x06,0x08,0x03 */ + SPHINCS_FAST_LEVEL3k = 0x06f0cd23, /* 1.3.9999.6.8.3 */ + /* 0x2b,0xce,0x0f,0x06,0x09,0x03 */ + SPHINCS_FAST_LEVEL5k = 0x06f0cd22, /* 1.3.9999.6.9.3 */ + /* 0x2b,0xce,0x0f,0x06,0x07,0x0a */ + SPHINCS_SMALL_LEVEL1k = 0x06f0c42c, /* 1.3.9999.6.7.10 */ + /* 0x2b,0xce,0x0f,0x06,0x08,0x07 */ + SPHINCS_SMALL_LEVEL3k = 0x06f0c923, /* 1.3.9999.6.8.7 */ + /* 0x2b,0xce,0x0f,0x06,0x09,0x07 */ + SPHINCS_SMALL_LEVEL5k = 0x06f0c922 /* 1.3.9999.6.9.7 */ +#endif +}; + +enum KeyWrap_Sum { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x05 */ + AES128_WRAP = 417, /* 2.16.840.1.101.3.4.1.5 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x19 */ + AES192_WRAP = 437, /* 2.16.840.1.101.3.4.1.25 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x2d */ + AES256_WRAP = 457, /* 2.16.840.1.101.3.4.1.45 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x10,0x03,0x09 */ + PWRI_KEK_WRAP = 680 /* 1.2.840.113549.1.9.16.3.9 */ +#else + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x05 */ + AES128_WRAP = 0x7fb37aff, /* 2.16.840.1.101.3.4.1.5 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x19 */ + AES192_WRAP = 0x7fb37ae3, /* 2.16.840.1.101.3.4.1.25 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x01,0x2d */ + AES256_WRAP = 0x7fb37ad7, /* 2.16.840.1.101.3.4.1.45 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x10,0x03,0x09 */ + PWRI_KEK_WRAP = 0x70bf8832 /* 1.2.840.113549.1.9.16.3.9 */ +#endif +}; + +enum Key_Agree { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x2b,0x81,0x05,0x10,0x86,0x48,0x3f,0x00,0x02 */ + /* 1.3.133.16.840.63.0.2 */ + dhSinglePass_stdDH_sha1kdf_scheme = 464, + /* 0x2b,0x81,0x04,0x01,0x0b,0x00 */ + /* 1.3.132.1.11.0 */ + dhSinglePass_stdDH_sha224kdf_scheme = 188, + /* 0x2b,0x81,0x04,0x01,0x0b,0x01 */ + /* 1.3.132.1.11.1 */ + dhSinglePass_stdDH_sha256kdf_scheme = 189, + /* 0x2b,0x81,0x04,0x01,0x0b,0x02 */ + /* 1.3.132.1.11.2 */ + dhSinglePass_stdDH_sha384kdf_scheme = 190, + /* 0x2b,0x81,0x04,0x01,0x0b,0x03 */ + /* 1.3.132.1.11.3 */ + dhSinglePass_stdDH_sha512kdf_scheme = 191 +#else + /* 0x2b,0x81,0x05,0x10,0x86,0x48,0x3f,0x00,0x02 */ + /* 1.3.133.16.840.63.0.2 */ + dhSinglePass_stdDH_sha1kdf_scheme = 0x6fc53650, + /* 0x2b,0x81,0x04,0x01,0x0b,0x00 */ + /* 1.3.132.1.11.0 */ + dhSinglePass_stdDH_sha224kdf_scheme = 0x01fb8120, + /* 0x2b,0x81,0x04,0x01,0x0b,0x01 */ + /* 1.3.132.1.11.1 */ + dhSinglePass_stdDH_sha256kdf_scheme = 0x01fb8020, + /* 0x2b,0x81,0x04,0x01,0x0b,0x02 */ + /* 1.3.132.1.11.2 */ + dhSinglePass_stdDH_sha384kdf_scheme = 0x01fb8320, + /* 0x2b,0x81,0x04,0x01,0x0b,0x03 */ + /* 1.3.132.1.11.3 */ + dhSinglePass_stdDH_sha512kdf_scheme = 0x01fb8220 +#endif +}; + +enum KDF_Sum { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x05,0x0c */ + PBKDF2_OID = 660, /* 1.2.840.113549.1.5.12 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x08 */ + MGF1_OID = 652 /* 1.2.840.113549.1.1.8 */ +#else + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x05,0x0c */ + PBKDF2_OID = 0x7cb6742e, /* 1.2.840.113549.1.5.12 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x08 */ + MGF1_OID = 0x78b6742a /* 1.2.840.113549.1.1.8 */ +#endif +}; + +enum HMAC_Sum { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x08 */ + HMAC_SHA224_OID = 652, /* 1.2.840.113549.2.8 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x09 */ + HMAC_SHA256_OID = 653, /* 1.2.840.113549.2.9 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x0a */ + HMAC_SHA384_OID = 654, /* 1.2.840.113549.2.10 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x0b */ + HMAC_SHA512_OID = 655, /* 1.2.840.113549.2.11 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x0d */ + HMAC_SHA3_224_OID = 426, /* 2.16.840.1.101.3.4.2.13 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x0e */ + HMAC_SHA3_256_OID = 427, /* 2.16.840.1.101.3.4.2.14 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x0f */ + HMAC_SHA3_384_OID = 428, /* 2.16.840.1.101.3.4.2.15 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x10 */ + HMAC_SHA3_512_OID = 429 /* 2.16.840.1.101.3.4.2.16 */ +#else + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x08 */ + HMAC_SHA224_OID = 0x0e4a8bdd, /* 1.2.840.113549.2.8 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x09 */ + HMAC_SHA256_OID = 0x0f4a8bdd, /* 1.2.840.113549.2.9 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x0a */ + HMAC_SHA384_OID = 0x0c4a8bdd, /* 1.2.840.113549.2.10 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x0b */ + HMAC_SHA512_OID = 0x0d4a8bdd, /* 1.2.840.113549.2.11 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x0d */ + HMAC_SHA3_224_OID = 0x7cb37af7, /* 2.16.840.1.101.3.4.2.13 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x0e */ + HMAC_SHA3_256_OID = 0x7cb37af4, /* 2.16.840.1.101.3.4.2.14 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x0f */ + HMAC_SHA3_384_OID = 0x7cb37af5, /* 2.16.840.1.101.3.4.2.15 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x10 */ + HMAC_SHA3_512_OID = 0x7cb37aea /* 2.16.840.1.101.3.4.2.16 */ +#endif +}; + +enum Extensions_Sum { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x55,0x1d,0x13 */ + BASIC_CA_OID = 133, /* 2.5.29.19 */ + /* 0x55,0x1d,0x11 */ + ALT_NAMES_OID = 131, /* 2.5.29.17 */ + /* 0x55,0x1d,0x1f */ + CRL_DIST_OID = 145, /* 2.5.29.31 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x01,0x01 */ + AUTH_INFO_OID = 69, /* 1.3.6.1.5.5.7.1.1 */ + /* 0x55,0x1d,0x23 */ + AUTH_KEY_OID = 149, /* 2.5.29.35 */ + /* 0x55,0x1d,0x0e */ + SUBJ_KEY_OID = 128, /* 2.5.29.14 */ + /* 0x55,0x1d,0x20 */ + CERT_POLICY_OID = 146, /* 2.5.29.32 */ + /* 0x55,0x1d,0x14 */ + CRL_NUMBER_OID = 134, /* 2.5.29.20 */ + /* 0x55,0x1d,0x0f */ + KEY_USAGE_OID = 129, /* 2.5.29.15 */ + /* 0x55,0x1d,0x36 */ + INHIBIT_ANY_OID = 168, /* 2.5.29.54 */ + /* 0x55,0x1d,0x25 */ + EXT_KEY_USAGE_OID = 151, /* 2.5.29.37 */ + /* 0x55,0x1d,0x1e */ + NAME_CONS_OID = 144, /* 2.5.29.30 */ + /* 0x55,0x1d,0x10 */ + PRIV_KEY_USAGE_PERIOD_OID = 130, /* 2.5.29.16 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x01,0x0b */ + SUBJ_INFO_ACC_OID = 79, /* 1.3.6.1.5.5.7.1.11 */ + /* 0x55,0x1d,0x21 */ + POLICY_MAP_OID = 147, /* 2.5.29.33 */ + /* 0x55,0x1d,0x24 */ + POLICY_CONST_OID = 150, /* 2.5.29.36 */ + /* 0x55,0x1d,0x12 */ + ISSUE_ALT_NAMES_OID = 132, /* 2.5.29.18 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x01,0x18 */ + TLS_FEATURE_OID = 92, /* 1.3.6.1.5.5.7.1.24 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x08,0x07 */ + DNS_SRV_OID = 82, /* 1.3.6.1.5.5.7.8.7 */ + /* 0x60,0x86,0x48,0x01,0x86,0xf8,0x42,0x01,0x01 */ + NETSCAPE_CT_OID = 753, /* 2.16.840.1.113730.1.1 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x05 */ + OCSP_NOCHECK_OID = 121, /* 1.3.6.1.5.5.7.48.1.5 */ + /* 0x55,0x1d,0x09 */ + SUBJ_DIR_ATTR_OID = 123, /* 2.5.29.9 */ + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x02,0x4e,0x05 */ + AKEY_PACKAGE_OID = 492, /* 2.16.840.1.101.2.1.2.78.5 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x06,0x06 */ + FASCN_OID = 419, /* 2.16.840.1.101.3.6.6 */ + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x14,0x02,0x03 */ + UPN_OID = 265, /* 1.3.6.1.4.1.311.20.2.3 */ + /* 0x55,0x1d,0x48 */ + SUBJ_ALT_PUB_KEY_INFO_OID = 186, /* 2.5.29.72 */ + /* 0x55,0x1d,0x49 */ + ALT_SIG_ALG_OID = 187, /* 2.5.29.73 */ + /* 0x55,0x1d,0x4a */ + ALT_SIG_VAL_OID = 188 /* 2.5.29.74 */ +#else + /* 0x55,0x1d,0x13 */ + BASIC_CA_OID = 0x7fec1daa, /* 2.5.29.19 */ + /* 0x55,0x1d,0x11 */ + ALT_NAMES_OID = 0x7fee1daa, /* 2.5.29.17 */ + /* 0x55,0x1d,0x1f */ + CRL_DIST_OID = 0x7fe01daa, /* 2.5.29.31 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x01,0x01 */ + AUTH_INFO_OID = 0x0400012e, /* 1.3.6.1.5.5.7.1.1 */ + /* 0x55,0x1d,0x23 */ + AUTH_KEY_OID = 0x7fdc1daa, /* 2.5.29.35 */ + /* 0x55,0x1d,0x0e */ + SUBJ_KEY_OID = 0x7ff11daa, /* 2.5.29.14 */ + /* 0x55,0x1d,0x20 */ + CERT_POLICY_OID = 0x7fdf1daa, /* 2.5.29.32 */ + /* 0x55,0x1d,0x14 */ + CRL_NUMBER_OID = 0x7feb1daa, /* 2.5.29.20 */ + /* 0x55,0x1d,0x0f */ + KEY_USAGE_OID = 0x7ff01daa, /* 2.5.29.15 */ + /* 0x55,0x1d,0x36 */ + INHIBIT_ANY_OID = 0x7fc91daa, /* 2.5.29.54 */ + /* 0x55,0x1d,0x25 */ + EXT_KEY_USAGE_OID = 0x7fda1daa, /* 2.5.29.37 */ + /* 0x55,0x1d,0x1e */ + NAME_CONS_OID = 0x7fe11daa, /* 2.5.29.30 */ + /* 0x55,0x1d,0x10 */ + PRIV_KEY_USAGE_PERIOD_OID = 0x7fef1daa, /* 2.5.29.16 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x01,0x0b */ + SUBJ_INFO_ACC_OID = 0x0e00012e, /* 1.3.6.1.5.5.7.1.11 */ + /* 0x55,0x1d,0x21 */ + POLICY_MAP_OID = 0x7fde1daa, /* 2.5.29.33 */ + /* 0x55,0x1d,0x24 */ + POLICY_CONST_OID = 0x7fdb1daa, /* 2.5.29.36 */ + /* 0x55,0x1d,0x12 */ + ISSUE_ALT_NAMES_OID = 0x7fed1daa, /* 2.5.29.18 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x01,0x18 */ + TLS_FEATURE_OID = 0x1d00012e, /* 1.3.6.1.5.5.7.1.24 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x08,0x07 */ + DNS_SRV_OID = 0x0209012e, /* 1.3.6.1.5.5.7.8.7 */ + /* 0x60,0x86,0x48,0x01,0x86,0xf8,0x42,0x01,0x01 */ + NETSCAPE_CT_OID = 0x7ff58118, /* 2.16.840.1.113730.1.1 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x05 */ + OCSP_NOCHECK_OID = 0x7bcefed4, /* 1.3.6.1.5.5.7.48.1.5 */ + /* 0x55,0x1d,0x09 */ + SUBJ_DIR_ATTR_OID = 0x7ff61daa, /* 2.5.29.9 */ + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x02,0x4e,0x05 */ + AKEY_PACKAGE_OID = 0x034981b4, /* 2.16.840.1.101.2.1.2.78.5 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x06,0x06 */ + FASCN_OID = 0x074e8505, /* 2.16.840.1.101.3.6.6 */ + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x14,0x02,0x03 */ + UPN_OID = 0x103687d7, /* 1.3.6.1.4.1.311.20.2.3 */ + /* 0x55,0x1d,0x48 */ + SUBJ_ALT_PUB_KEY_INFO_OID = 0x7fb71daa, /* 2.5.29.72 */ + /* 0x55,0x1d,0x49 */ + ALT_SIG_ALG_OID = 0x7fb61daa, /* 2.5.29.73 */ + /* 0x55,0x1d,0x4a */ + ALT_SIG_VAL_OID = 0x7fb51daa /* 2.5.29.74 */ +#endif +}; + +enum CertificatePolicy_Sum { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x55,0x1d,0x20,0x00 */ + /* 2.5.29.32.0 */ + CP_ANY_OID = 146, + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0xdf,0x13,0x01,0x01,0x01 */ + /* 1.3.6.1.4.1.44947.1.1.1 */ + CP_ISRG_DOMAIN_VALID = 430, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x04 */ + /* 2.16.840.1.101.3.2.1.3.4 */ + CP_FPKI_HIGH_ASSURANCE_OID = 417, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x07 */ + /* 2.16.840.1.101.3.2.1.3.7 */ + CP_FPKI_COMMON_HARDWARE_OID = 420, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x0c */ + /* 2.16.840.1.101.3.2.1.3.12 */ + CP_FPKI_MEDIUM_HARDWARE_OID = 425, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x0d */ + /* 2.16.840.1.101.3.2.1.3.13 */ + CP_FPKI_COMMON_AUTH_OID = 426, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x10 */ + /* 2.16.840.1.101.3.2.1.3.16 */ + CP_FPKI_COMMON_HIGH_OID = 429, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x12 */ + /* 2.16.840.1.101.3.2.1.3.18 */ + CP_FPKI_PIVI_HARDWARE_OID = 431, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x14 */ + /* 2.16.840.1.101.3.2.1.3.20 */ + CP_FPKI_PIVI_CONTENT_SIGNING_OID = 433, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x24 */ + /* 2.16.840.1.101.3.2.1.3.36 */ + CP_FPKI_COMMON_DEVICES_HARDWARE_OID = 449, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x26 */ + /* 2.16.840.1.101.3.2.1.3.38 */ + CP_FPKI_MEDIUM_DEVICE_HARDWARE_OID = 451, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x27 */ + /* 2.16.840.1.101.3.2.1.3.39 */ + CP_FPKI_COMMON_PIV_CONTENT_SIGNING_OID = 452, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x28 */ + /* 2.16.840.1.101.3.2.1.3.40 */ + CP_FPKI_PIV_AUTH_OID = 453, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x29 */ + /* 2.16.840.1.101.3.2.1.3.41 */ + CP_FPKI_PIV_AUTH_HW_OID = 454, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x2d */ + /* 2.16.840.1.101.3.2.1.3.45 */ + CP_FPKI_PIVI_AUTH_OID = 458, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x2f */ + /* 2.16.840.1.101.3.2.1.3.47 */ + CP_FPKI_COMMON_PIVI_CONTENT_SIGNING_OID = 460, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x30,0x0b */ + /* 2.16.840.1.101.3.2.1.48.11 */ + CP_FPKI_AUTH_TEST_OID = 469, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x30,0x0d */ + /* 2.16.840.1.101.3.2.1.48.13 */ + CP_FPKI_CARDAUTH_TEST_OID = 471, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x30,0x56 */ + /* 2.16.840.1.101.3.2.1.48.86 */ + CP_FPKI_PIV_CONTENT_TEST_OID = 544, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x30,0x6d */ + /* 2.16.840.1.101.3.2.1.48.109 */ + CP_FPKI_PIV_AUTH_DERIVED_TEST_OID = 567, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x30,0x6e */ + /* 2.16.840.1.101.3.2.1.48.110 */ + CP_FPKI_PIV_AUTH_DERIVED_HW_TEST_OID = 568, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x05 */ + /* 2.16.840.1.101.2.1.11.5 */ + CP_DOD_MEDIUM_OID = 423, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x09 */ + /* 2.16.840.1.101.2.1.11.9 */ + CP_DOD_MEDIUM_HARDWARE_OID = 427, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x0a */ + /* 2.16.840.1.101.2.1.11.10 */ + CP_DOD_PIV_AUTH_OID = 428, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x11 */ + /* 2.16.840.1.101.2.1.11.17 */ + CP_DOD_MEDIUM_NPE_OID = 435, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x12 */ + /* 2.16.840.1.101.2.1.11.18 */ + CP_DOD_MEDIUM_2048_OID = 436, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x13 */ + /* 2.16.840.1.101.2.1.11.19 */ + CP_DOD_MEDIUM_HARDWARE_2048_OID = 437, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x14 */ + /* 2.16.840.1.101.2.1.11.20 */ + CP_DOD_PIV_AUTH_2048_OID = 438, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x1f */ + /* 2.16.840.1.101.2.1.11.31 */ + CP_DOD_PEER_INTEROP_OID = 100449, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x24 */ + /* 2.16.840.1.101.2.1.11.36 */ + CP_DOD_MEDIUM_NPE_112_OID = 100454, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x25 */ + /* 2.16.840.1.101.2.1.11.37 */ + CP_DOD_MEDIUM_NPE_128_OID = 455, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x26 */ + /* 2.16.840.1.101.2.1.11.38 */ + CP_DOD_MEDIUM_NPE_192_OID = 456, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x27 */ + /* 2.16.840.1.101.2.1.11.39 */ + CP_DOD_MEDIUM_112_OID = 457, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x28 */ + /* 2.16.840.1.101.2.1.11.40 */ + CP_DOD_MEDIUM_128_OID = 100458, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x29 */ + /* 2.16.840.1.101.2.1.11.41 */ + CP_DOD_MEDIUM_192_OID = 459, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x2a */ + /* 2.16.840.1.101.2.1.11.42 */ + CP_DOD_MEDIUM_HARDWARE_112_OID = 100460, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x2b */ + /* 2.16.840.1.101.2.1.11.43 */ + CP_DOD_MEDIUM_HARDWARE_128_OID = 461, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x2c */ + /* 2.16.840.1.101.2.1.11.44 */ + CP_DOD_MEDIUM_HARDWARE_192_OID = 462, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x3b */ + /* 2.16.840.1.101.2.1.11.59 */ + CP_DOD_ADMIN_OID = 477, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x3c */ + /* 2.16.840.1.101.2.1.11.60 */ + CP_DOD_INTERNAL_NPE_112_OID = 478, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x3d */ + /* 2.16.840.1.101.2.1.11.61 */ + CP_DOD_INTERNAL_NPE_128_OID = 479, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x3e */ + /* 2.16.840.1.101.2.1.11.62 */ + CP_DOD_INTERNAL_NPE_192_OID = 480, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x0c,0x01 */ + /* 2.16.840.1.101.3.2.1.12.1 */ + CP_ECA_MEDIUM_OID = 100423, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x0c,0x02 */ + /* 2.16.840.1.101.3.2.1.12.2 */ + CP_ECA_MEDIUM_HARDWARE_OID = 424, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x0c,0x03 */ + /* 2.16.840.1.101.3.2.1.12.3 */ + CP_ECA_MEDIUM_TOKEN_OID = 100425, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x0c,0x04 */ + /* 2.16.840.1.101.3.2.1.12.4 */ + CP_ECA_MEDIUM_SHA256_OID = 100426, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x0c,0x05 */ + /* 2.16.840.1.101.3.2.1.12.5 */ + CP_ECA_MEDIUM_TOKEN_SHA256_OID = 100427, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x0c,0x06 */ + /* 2.16.840.1.101.3.2.1.12.6 */ + CP_ECA_MEDIUM_HARDWARE_PIVI_OID = 100428, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x0c,0x08 */ + /* 2.16.840.1.101.3.2.1.12.8 */ + CP_ECA_CONTENT_SIGNING_PIVI_OID = 100430, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x0c,0x09 */ + /* 2.16.840.1.101.3.2.1.12.9 */ + CP_ECA_MEDIUM_DEVICE_SHA256_OID = 431, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x0c,0x0a */ + /* 2.16.840.1.101.3.2.1.12.10 */ + CP_ECA_MEDIUM_HARDWARE_SHA256_OID = 432, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x06,0x01 */ + /* 2.16.840.1.101.3.2.1.6.1 */ + CP_STATE_BASIC_OID = 100417, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x06,0x02 */ + /* 2.16.840.1.101.3.2.1.6.2 */ + CP_STATE_LOW_OID = 418, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x06,0x03 */ + /* 2.16.840.1.101.3.2.1.6.3 */ + CP_STATE_MODERATE_OID = 100419, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x06,0x04 */ + /* 2.16.840.1.101.3.2.1.6.4 */ + CP_STATE_HIGH_OID = 100420, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x06,0x0c */ + /* 2.16.840.1.101.3.2.1.6.12 */ + CP_STATE_MEDHW_OID = 101428, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x06,0x26 */ + /* 2.16.840.1.101.3.2.1.6.38 */ + CP_STATE_MEDDEVHW_OID = 101454, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x05,0x04 */ + /* 2.16.840.1.101.3.2.1.5.4 */ + CP_TREAS_MEDIUMHW_OID = 419, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x05,0x05 */ + /* 2.16.840.1.101.3.2.1.5.5 */ + CP_TREAS_HIGH_OID = 101420, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x05,0x0a */ + /* 2.16.840.1.101.3.2.1.5.10 */ + CP_TREAS_PIVI_HW_OID = 101425, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x05,0x0c */ + /* 2.16.840.1.101.3.2.1.5.12 */ + CP_TREAS_PIVI_CONTENT_OID = 101427, + /* 0x2b,0x06,0x01,0x04,0x01,0x49,0x0f,0x03,0x01,0x0c */ + /* 1.3.6.1.4.1.73.15.3.1.12 */ + CP_BOEING_MEDIUMHW_SHA256_OID = 159, + /* 0x2b,0x06,0x01,0x04,0x01,0x49,0x0f,0x03,0x01,0x11 */ + /* 1.3.6.1.4.1.73.15.3.1.17 */ + CP_BOEING_MEDIUMHW_CONTENT_SHA256_OID = 164, + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0xe4,0x26,0x03,0x01,0x0c */ + /* 1.3.6.1.4.1.45606.3.1.12 */ + CP_CARILLON_MEDIUMHW_256_OID = 467, + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0xe4,0x26,0x03,0x01,0x14 */ + /* 1.3.6.1.4.1.45606.3.1.20 */ + CP_CARILLON_AIVHW_OID = 475, + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0xe4,0x26,0x03,0x01,0x16 */ + /* 1.3.6.1.4.1.45606.3.1.22 */ + CP_CARILLON_AIVCONTENT_OID = 100477, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xc3,0x5e,0x03,0x01,0x0c */ + /* 1.3.6.1.4.1.25054.3.1.12 */ + CP_CIS_MEDIUMHW_256_OID = 489, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xc3,0x5e,0x03,0x01,0x0e */ + /* 1.3.6.1.4.1.25054.3.1.14 */ + CP_CIS_MEDDEVHW_256_OID = 491, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xc3,0x5e,0x03,0x01,0x14 */ + /* 1.3.6.1.4.1.25054.3.1.20 */ + CP_CIS_ICECAP_HW_OID = 497, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xc3,0x5e,0x03,0x01,0x16 */ + /* 1.3.6.1.4.1.25054.3.1.22 */ + CP_CIS_ICECAP_CONTENT_OID = 499, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xbb,0x53,0x01,0x01,0x01,0x02 */ + /* 1.3.6.1.4.1.24019.1.1.1.2 */ + CP_CERTIPATH_MEDIUMHW_OID = 100459, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xbb,0x53,0x01,0x01,0x01,0x03 */ + /* 1.3.6.1.4.1.24019.1.1.1.3 */ + CP_CERTIPATH_HIGHHW_OID = 101460, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xbb,0x53,0x01,0x01,0x01,0x07 */ + /* 1.3.6.1.4.1.24019.1.1.1.7 */ + CP_CERTIPATH_ICECAP_HW_OID = 464, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xbb,0x53,0x01,0x01,0x01,0x09 */ + /* 1.3.6.1.4.1.24019.1.1.1.9 */ + CP_CERTIPATH_ICECAP_CONTENT_OID = 466, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xbb,0x53,0x01,0x01,0x01,0x12 */ + /* 1.3.6.1.4.1.24019.1.1.1.18 */ + CP_CERTIPATH_VAR_MEDIUMHW_OID = 100475, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xbb,0x53,0x01,0x01,0x01,0x13 */ + /* 1.3.6.1.4.1.24019.1.1.1.19 */ + CP_CERTIPATH_VAR_HIGHHW_OID = 476, + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0xa9,0x53,0x01,0x01,0x01,0x02 */ + /* 1.3.6.1.4.1.38099.1.1.1.2 */ + CP_TSCP_MEDIUMHW_OID = 442, + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0xa9,0x53,0x01,0x01,0x01,0x05 */ + /* 1.3.6.1.4.1.38099.1.1.1.5 */ + CP_TSCP_PIVI_OID = 445, + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0xa9,0x53,0x01,0x01,0x01,0x07 */ + /* 1.3.6.1.4.1.38099.1.1.1.7 */ + CP_TSCP_PIVI_CONTENT_OID = 447, + /* 0x60,0x86,0x48,0x01,0x86,0xf8,0x45,0x01,0x07,0x17,0x03,0x01,0x07 */ + /* 2.16.840.1.113733.1.7.23.3.1.7 */ + CP_DIGICERT_NFSSP_MEDIUMHW_OID = 796, + /* 0x60,0x86,0x48,0x01,0x86,0xf8,0x45,0x01,0x07,0x17,0x03,0x01,0x0d */ + /* 2.16.840.1.113733.1.7.23.3.1.13 */ + CP_DIGICERT_NFSSP_AUTH_OID = 802, + /* 0x60,0x86,0x48,0x01,0x86,0xf8,0x45,0x01,0x07,0x17,0x03,0x01,0x12 */ + /* 2.16.840.1.113733.1.7.23.3.1.18 */ + CP_DIGICERT_NFSSP_PIVI_HW_OID = 807, + /* 0x60,0x86,0x48,0x01,0x86,0xf8,0x45,0x01,0x07,0x17,0x03,0x01,0x14 */ + /* 2.16.840.1.113733.1.7.23.3.1.20 */ + CP_DIGICERT_NFSSP_PIVI_CONTENT_OID = 809, + /* 0x60,0x86,0x48,0x01,0x86,0xf8,0x45,0x01,0x07,0x17,0x03,0x01,0x24 */ + /* 2.16.840.1.113733.1.7.23.3.1.36 */ + CP_DIGICERT_NFSSP_MEDDEVHW_OID = 825, + /* 0x60,0x86,0x48,0x01,0x86,0xfa,0x6b,0x81,0x48,0x03,0x0a,0x07,0x02 */ + /* 2.16.840.1.114027.200.3.10.7.2 */ + CP_ENTRUST_NFSSP_MEDIUMHW_OID = 1017, + /* 0x60,0x86,0x48,0x01,0x86,0xfa,0x6b,0x81,0x48,0x03,0x0a,0x07,0x04 */ + /* 2.16.840.1.114027.200.3.10.7.4 */ + CP_ENTRUST_NFSSP_MEDAUTH_OID = 1019, + /* 0x60,0x86,0x48,0x01,0x86,0xfa,0x6b,0x81,0x48,0x03,0x0a,0x07,0x06 */ + /* 2.16.840.1.114027.200.3.10.7.6 */ + CP_ENTRUST_NFSSP_PIVI_HW_OID = 1021, + /* 0x60,0x86,0x48,0x01,0x86,0xfa,0x6b,0x81,0x48,0x03,0x0a,0x07,0x09 */ + /* 2.16.840.1.114027.200.3.10.7.9 */ + CP_ENTRUST_NFSSP_PIVI_CONTENT_OID = 1024, + /* 0x60,0x86,0x48,0x01,0x86,0xfa,0x6b,0x81,0x48,0x03,0x0a,0x07,0x10 */ + /* 2.16.840.1.114027.200.3.10.7.16 */ + CP_ENTRUST_NFSSP_MEDDEVHW_OID = 1031, + /* 0x2b,0x06,0x01,0x04,0x01,0xec,0x7c,0x01,0x01,0x01,0x06 */ + /* 1.3.6.1.4.1.13948.1.1.1.6 */ + CP_EXOSTAR_MEDIUMHW_SHA2_OID = 100424, + /* 0x60,0x86,0x48,0x01,0x86,0xf9,0x2f,0x00,0x64,0x0c,0x01 */ + /* 2.16.840.1.113839.0.100.12.1 */ + CP_IDENTRUST_MEDIUMHW_SIGN_OID = 846, + /* 0x60,0x86,0x48,0x01,0x86,0xf9,0x2f,0x00,0x64,0x0c,0x02 */ + /* 2.16.840.1.113839.0.100.12.2 */ + CP_IDENTRUST_MEDIUMHW_ENC_OID = 847, + /* 0x60,0x86,0x48,0x01,0x86,0xf9,0x2f,0x00,0x64,0x12,0x00 */ + /* 2.16.840.1.113839.0.100.18.0 */ + CP_IDENTRUST_PIVI_HW_ID_OID = 851, + /* 0x60,0x86,0x48,0x01,0x86,0xf9,0x2f,0x00,0x64,0x12,0x01 */ + /* 2.16.840.1.113839.0.100.18.1 */ + CP_IDENTRUST_PIVI_HW_SIGN_OID = 852, + /* 0x60,0x86,0x48,0x01,0x86,0xf9,0x2f,0x00,0x64,0x12,0x02 */ + /* 2.16.840.1.113839.0.100.18.2 */ + CP_IDENTRUST_PIVI_HW_ENC_OID = 853, + /* 0x60,0x86,0x48,0x01,0x86,0xf9,0x2f,0x00,0x64,0x14,0x01 */ + /* 2.16.840.1.113839.0.100.20.1 */ + CP_IDENTRUST_PIVI_CONTENT_OID = 854, + /* 0x2b,0x06,0x01,0x04,0x01,0x67,0x64,0x01,0x01,0x03,0x03 */ + /* 1.3.6.1.4.1.103.100.1.1.3.3 */ + CP_LOCKHEED_MEDIUMHW_OID = 266, + /* 0x2b,0x06,0x01,0x04,0x01,0xff,0x4e,0x83,0x7d,0x02,0x08 */ + /* 1.3.6.1.4.1.16334.509.2.8 */ + CP_NORTHROP_MEDIUM_256_HW_OID = 654, + /* 0x2b,0x06,0x01,0x04,0x01,0xff,0x4e,0x83,0x7d,0x02,0x09 */ + /* 1.3.6.1.4.1.16334.509.2.9 */ + CP_NORTHROP_PIVI_256_HW_OID = 655, + /* 0x2b,0x06,0x01,0x04,0x01,0xff,0x4e,0x83,0x7d,0x02,0x0b */ + /* 1.3.6.1.4.1.16334.509.2.11 */ + CP_NORTHROP_PIVI_256_CONTENT_OID = 657, + /* 0x2b,0x06,0x01,0x04,0x01,0xff,0x4e,0x83,0x7d,0x02,0x0e */ + /* 1.3.6.1.4.1.16334.509.2.14 */ + CP_NORTHROP_MEDIUM_384_HW_OID = 660, + /* 0x2b,0x06,0x01,0x04,0x01,0x8c,0x21,0x0a,0x01,0x0c */ + /* 1.3.6.1.4.1.1569.10.1.12 */ + CP_RAYTHEON_MEDIUMHW_OID = 251, + /* 0x2b,0x06,0x01,0x04,0x01,0x8c,0x21,0x0a,0x01,0x12 */ + /* 1.3.6.1.4.1.1569.10.1.18 */ + CP_RAYTHEON_MEDDEVHW_OID = 257, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xd1,0x11,0x0a,0x01,0x0c */ + /* 1.3.6.1.4.1.26769.10.1.12 */ + CP_RAYTHEON_SHA2_MEDIUMHW_OID = 433, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xd1,0x11,0x0a,0x01,0x12 */ + /* 1.3.6.1.4.1.26769.10.1.18 */ + CP_RAYTHEON_SHA2_MEDDEVHW_OID = 439, + /* 0x2b,0x06,0x01,0x04,0x01,0x9e,0x52,0x01,0x01,0x01,0x0c */ + /* 1.3.6.1.4.1.3922.1.1.1.12 */ + CP_WIDEPOINT_MEDIUMHW_OID = 310, + /* 0x2b,0x06,0x01,0x04,0x01,0x9e,0x52,0x01,0x01,0x01,0x12 */ + /* 1.3.6.1.4.1.3922.1.1.1.18 */ + CP_WIDEPOINT_PIVI_HW_OID = 316, + /* 0x2b,0x06,0x01,0x04,0x01,0x9e,0x52,0x01,0x01,0x01,0x14 */ + /* 1.3.6.1.4.1.3922.1.1.1.20 */ + CP_WIDEPOINT_PIVI_CONTENT_OID = 318, + /* 0x2b,0x06,0x01,0x04,0x01,0x9e,0x52,0x01,0x01,0x01,0x26 */ + /* 1.3.6.1.4.1.3922.1.1.1.38 */ + CP_WIDEPOINT_MEDDEVHW_OID = 336, + /* 0x2a,0x24,0x01,0x82,0x4e,0x01,0x02,0x01,0x02 */ + /* 1.2.36.1.334.1.2.1.2 */ + CP_ADO_MEDIUM_OID = 293, + /* 0x2a,0x24,0x01,0x82,0x4e,0x01,0x02,0x01,0x03 */ + /* 1.2.36.1.334.1.2.1.3 */ + CP_ADO_HIGH_OID = 294, + /* 0x2a,0x24,0x01,0x82,0x4e,0x01,0x02,0x02,0x02 */ + /* 1.2.36.1.334.1.2.2.2 */ + CP_ADO_RESOURCE_MEDIUM_OID = 100294, + /* 0x2b,0x06,0x01,0x04,0x01,0xb2,0x31,0x01,0x02,0x01,0x03,0x04 */ + /* 1.3.6.1.4.1.6449.1.2.1.3.4 */ + CP_COMODO_OID = 100293, + /* 0x60,0x84,0x10,0x01,0x87,0x6b,0x01,0x02,0x05,0x01 */ + /* 2.16.528.1.1003.1.2.5.1 */ + CP_NL_MOD_AUTH_OID = 496, + /* 0x60,0x84,0x10,0x01,0x87,0x6b,0x01,0x02,0x05,0x02 */ + /* 2.16.528.1.1003.1.2.5.2 */ + CP_NL_MOD_IRREFUT_OID = 100497, + /* 0x60,0x84,0x10,0x01,0x87,0x6b,0x01,0x02,0x05,0x03 */ + /* 2.16.528.1.1003.1.2.5.3 */ + CP_NL_MOD_CONFID_OID = 498 +#else + /* 0x55,0x1d,0x20,0x00 */ + /* 2.5.29.32.0 */ + CP_ANY_OID = 0x00df1daa, + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0xdf,0x13,0x01,0x01,0x01 */ + /* 1.3.6.1.4.1.44947.1.1.1 */ + CP_ISRG_DOMAIN_VALID = 0x682085d4, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x04 */ + /* 2.16.840.1.101.3.2.1.3.4 */ + CP_FPKI_HIGH_ASSURANCE_OID = 0x004a81f9, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x07 */ + /* 2.16.840.1.101.3.2.1.3.7 */ + CP_FPKI_COMMON_HARDWARE_OID = 0x004a82f9, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x0c */ + /* 2.16.840.1.101.3.2.1.3.12 */ + CP_FPKI_MEDIUM_HARDWARE_OID = 0x004a89f9, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x0d */ + /* 2.16.840.1.101.3.2.1.3.13 */ + CP_FPKI_COMMON_AUTH_OID = 0x004a88f9, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x10 */ + /* 2.16.840.1.101.3.2.1.3.16 */ + CP_FPKI_COMMON_HIGH_OID = 0x004a95f9, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x12 */ + /* 2.16.840.1.101.3.2.1.3.18 */ + CP_FPKI_PIVI_HARDWARE_OID = 0x004a97f9, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x14 */ + /* 2.16.840.1.101.3.2.1.3.20 */ + CP_FPKI_PIVI_CONTENT_SIGNING_OID = 0x004a91f9, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x24 */ + /* 2.16.840.1.101.3.2.1.3.36 */ + CP_FPKI_COMMON_DEVICES_HARDWARE_OID = 0x004aa1f9, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x26 */ + /* 2.16.840.1.101.3.2.1.3.38 */ + CP_FPKI_MEDIUM_DEVICE_HARDWARE_OID = 0x004aa3f9, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x27 */ + /* 2.16.840.1.101.3.2.1.3.39 */ + CP_FPKI_COMMON_PIV_CONTENT_SIGNING_OID = 0x004aa2f9, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x28 */ + /* 2.16.840.1.101.3.2.1.3.40 */ + CP_FPKI_PIV_AUTH_OID = 0x004aadf9, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x29 */ + /* 2.16.840.1.101.3.2.1.3.41 */ + CP_FPKI_PIV_AUTH_HW_OID = 0x004aacf9, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x2d */ + /* 2.16.840.1.101.3.2.1.3.45 */ + CP_FPKI_PIVI_AUTH_OID = 0x004aa8f9, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x03,0x2f */ + /* 2.16.840.1.101.3.2.1.3.47 */ + CP_FPKI_COMMON_PIVI_CONTENT_SIGNING_OID = 0x004aaaf9, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x30,0x0b */ + /* 2.16.840.1.101.3.2.1.48.11 */ + CP_FPKI_AUTH_TEST_OID = 0x004a8eca, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x30,0x0d */ + /* 2.16.840.1.101.3.2.1.48.13 */ + CP_FPKI_CARDAUTH_TEST_OID = 0x004a88ca, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x30,0x56 */ + /* 2.16.840.1.101.3.2.1.48.86 */ + CP_FPKI_PIV_CONTENT_TEST_OID = 0x004ad3ca, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x30,0x6d */ + /* 2.16.840.1.101.3.2.1.48.109 */ + CP_FPKI_PIV_AUTH_DERIVED_TEST_OID = 0x004ae8ca, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x30,0x6e */ + /* 2.16.840.1.101.3.2.1.48.110 */ + CP_FPKI_PIV_AUTH_DERIVED_HW_TEST_OID = 0x004aebca, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x05 */ + /* 2.16.840.1.101.2.1.11.5 */ + CP_DOD_MEDIUM_OID = 0x75b67bff, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x09 */ + /* 2.16.840.1.101.2.1.11.9 */ + CP_DOD_MEDIUM_HARDWARE_OID = 0x75b67bf3, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x0a */ + /* 2.16.840.1.101.2.1.11.10 */ + CP_DOD_PIV_AUTH_OID = 0x75b67bf0, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x11 */ + /* 2.16.840.1.101.2.1.11.17 */ + CP_DOD_MEDIUM_NPE_OID = 0x75b67beb, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x12 */ + /* 2.16.840.1.101.2.1.11.18 */ + CP_DOD_MEDIUM_2048_OID = 0x75b67be8, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x13 */ + /* 2.16.840.1.101.2.1.11.19 */ + CP_DOD_MEDIUM_HARDWARE_2048_OID = 0x75b67be9, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x14 */ + /* 2.16.840.1.101.2.1.11.20 */ + CP_DOD_PIV_AUTH_2048_OID = 0x75b67bee, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x1f */ + /* 2.16.840.1.101.2.1.11.31 */ + CP_DOD_PEER_INTEROP_OID = 0x75b67be5, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x24 */ + /* 2.16.840.1.101.2.1.11.36 */ + CP_DOD_MEDIUM_NPE_112_OID = 0x75b67bde, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x25 */ + /* 2.16.840.1.101.2.1.11.37 */ + CP_DOD_MEDIUM_NPE_128_OID = 0x75b67bdf, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x26 */ + /* 2.16.840.1.101.2.1.11.38 */ + CP_DOD_MEDIUM_NPE_192_OID = 0x75b67bdc, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x27 */ + /* 2.16.840.1.101.2.1.11.39 */ + CP_DOD_MEDIUM_112_OID = 0x75b67bdd, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x28 */ + /* 2.16.840.1.101.2.1.11.40 */ + CP_DOD_MEDIUM_128_OID = 0x75b67bd2, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x29 */ + /* 2.16.840.1.101.2.1.11.41 */ + CP_DOD_MEDIUM_192_OID = 0x75b67bd3, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x2a */ + /* 2.16.840.1.101.2.1.11.42 */ + CP_DOD_MEDIUM_HARDWARE_112_OID = 0x75b67bd0, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x2b */ + /* 2.16.840.1.101.2.1.11.43 */ + CP_DOD_MEDIUM_HARDWARE_128_OID = 0x75b67bd1, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x2c */ + /* 2.16.840.1.101.2.1.11.44 */ + CP_DOD_MEDIUM_HARDWARE_192_OID = 0x75b67bd6, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x3b */ + /* 2.16.840.1.101.2.1.11.59 */ + CP_DOD_ADMIN_OID = 0x75b67bc1, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x3c */ + /* 2.16.840.1.101.2.1.11.60 */ + CP_DOD_INTERNAL_NPE_112_OID = 0x75b67bc6, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x3d */ + /* 2.16.840.1.101.2.1.11.61 */ + CP_DOD_INTERNAL_NPE_128_OID = 0x75b67bc7, + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x0b,0x3e */ + /* 2.16.840.1.101.2.1.11.62 */ + CP_DOD_INTERNAL_NPE_192_OID = 0x75b67bc4, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x0c,0x01 */ + /* 2.16.840.1.101.3.2.1.12.1 */ + CP_ECA_MEDIUM_OID = 0x004a84f6, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x0c,0x02 */ + /* 2.16.840.1.101.3.2.1.12.2 */ + CP_ECA_MEDIUM_HARDWARE_OID = 0x004a87f6, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x0c,0x03 */ + /* 2.16.840.1.101.3.2.1.12.3 */ + CP_ECA_MEDIUM_TOKEN_OID = 0x004a86f6, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x0c,0x04 */ + /* 2.16.840.1.101.3.2.1.12.4 */ + CP_ECA_MEDIUM_SHA256_OID = 0x004a81f6, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x0c,0x05 */ + /* 2.16.840.1.101.3.2.1.12.5 */ + CP_ECA_MEDIUM_TOKEN_SHA256_OID = 0x004a80f6, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x0c,0x06 */ + /* 2.16.840.1.101.3.2.1.12.6 */ + CP_ECA_MEDIUM_HARDWARE_PIVI_OID = 0x004a83f6, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x0c,0x08 */ + /* 2.16.840.1.101.3.2.1.12.8 */ + CP_ECA_CONTENT_SIGNING_PIVI_OID = 0x004a8df6, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x0c,0x09 */ + /* 2.16.840.1.101.3.2.1.12.9 */ + CP_ECA_MEDIUM_DEVICE_SHA256_OID = 0x004a8cf6, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x0c,0x0a */ + /* 2.16.840.1.101.3.2.1.12.10 */ + CP_ECA_MEDIUM_HARDWARE_SHA256_OID = 0x004a8ff6, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x06,0x01 */ + /* 2.16.840.1.101.3.2.1.6.1 */ + CP_STATE_BASIC_OID = 0x004a84fc, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x06,0x02 */ + /* 2.16.840.1.101.3.2.1.6.2 */ + CP_STATE_LOW_OID = 0x004a87fc, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x06,0x03 */ + /* 2.16.840.1.101.3.2.1.6.3 */ + CP_STATE_MODERATE_OID = 0x004a86fc, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x06,0x04 */ + /* 2.16.840.1.101.3.2.1.6.4 */ + CP_STATE_HIGH_OID = 0x004a81fc, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x06,0x0c */ + /* 2.16.840.1.101.3.2.1.6.12 */ + CP_STATE_MEDHW_OID = 0x004a89fc, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x06,0x26 */ + /* 2.16.840.1.101.3.2.1.6.38 */ + CP_STATE_MEDDEVHW_OID = 0x004aa3fc, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x05,0x04 */ + /* 2.16.840.1.101.3.2.1.5.4 */ + CP_TREAS_MEDIUMHW_OID = 0x004a81ff, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x05,0x05 */ + /* 2.16.840.1.101.3.2.1.5.5 */ + CP_TREAS_HIGH_OID = 0x004a80ff, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x05,0x0a */ + /* 2.16.840.1.101.3.2.1.5.10 */ + CP_TREAS_PIVI_HW_OID = 0x004a8fff, + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x05,0x0c */ + /* 2.16.840.1.101.3.2.1.5.12 */ + CP_TREAS_PIVI_CONTENT_OID = 0x004a89ff, + /* 0x2b,0x06,0x01,0x04,0x01,0x49,0x0f,0x03,0x01,0x0c */ + /* 1.3.6.1.4.1.73.15.3.1.12 */ + CP_BOEING_MEDIUMHW_SHA256_OID = 0x070e43d4, + /* 0x2b,0x06,0x01,0x04,0x01,0x49,0x0f,0x03,0x01,0x11 */ + /* 1.3.6.1.4.1.73.15.3.1.17 */ + CP_BOEING_MEDIUMHW_CONTENT_SHA256_OID = 0x070e5ed4, + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0xe4,0x26,0x03,0x01,0x0c */ + /* 1.3.6.1.4.1.45606.3.1.12 */ + CP_CARILLON_MEDIUMHW_256_OID = 0x5d1685d6, + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0xe4,0x26,0x03,0x01,0x14 */ + /* 1.3.6.1.4.1.45606.3.1.20 */ + CP_CARILLON_AIVHW_OID = 0x5d0e85d6, + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0xe4,0x26,0x03,0x01,0x16 */ + /* 1.3.6.1.4.1.45606.3.1.22 */ + CP_CARILLON_AIVCONTENT_OID = 0x5d0c85d6, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xc3,0x5e,0x03,0x01,0x0c */ + /* 1.3.6.1.4.1.25054.3.1.12 */ + CP_CIS_MEDIUMHW_256_OID = 0x253186d6, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xc3,0x5e,0x03,0x01,0x0e */ + /* 1.3.6.1.4.1.25054.3.1.14 */ + CP_CIS_MEDDEVHW_256_OID = 0x253386d6, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xc3,0x5e,0x03,0x01,0x14 */ + /* 1.3.6.1.4.1.25054.3.1.20 */ + CP_CIS_ICECAP_HW_OID = 0x252986d6, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xc3,0x5e,0x03,0x01,0x16 */ + /* 1.3.6.1.4.1.25054.3.1.22 */ + CP_CIS_ICECAP_CONTENT_OID = 0x252b86d6, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xbb,0x53,0x01,0x01,0x01,0x02 */ + /* 1.3.6.1.4.1.24019.1.1.1.2 */ + CP_CERTIPATH_MEDIUMHW_OID = 0x554486d4, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xbb,0x53,0x01,0x01,0x01,0x03 */ + /* 1.3.6.1.4.1.24019.1.1.1.3 */ + CP_CERTIPATH_HIGHHW_OID = 0x544486d4, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xbb,0x53,0x01,0x01,0x01,0x07 */ + /* 1.3.6.1.4.1.24019.1.1.1.7 */ + CP_CERTIPATH_ICECAP_HW_OID = 0x504486d4, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xbb,0x53,0x01,0x01,0x01,0x09 */ + /* 1.3.6.1.4.1.24019.1.1.1.9 */ + CP_CERTIPATH_ICECAP_CONTENT_OID = 0x5e4486d4, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xbb,0x53,0x01,0x01,0x01,0x12 */ + /* 1.3.6.1.4.1.24019.1.1.1.18 */ + CP_CERTIPATH_VAR_MEDIUMHW_OID = 0x454486d4, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xbb,0x53,0x01,0x01,0x01,0x13 */ + /* 1.3.6.1.4.1.24019.1.1.1.19 */ + CP_CERTIPATH_VAR_HIGHHW_OID = 0x444486d4, + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0xa9,0x53,0x01,0x01,0x01,0x02 */ + /* 1.3.6.1.4.1.38099.1.1.1.2 */ + CP_TSCP_MEDIUMHW_OID = 0x555685d4, + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0xa9,0x53,0x01,0x01,0x01,0x05 */ + /* 1.3.6.1.4.1.38099.1.1.1.5 */ + CP_TSCP_PIVI_OID = 0x525685d4, + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0xa9,0x53,0x01,0x01,0x01,0x07 */ + /* 1.3.6.1.4.1.38099.1.1.1.7 */ + CP_TSCP_PIVI_CONTENT_OID = 0x505685d4, + /* 0x60,0x86,0x48,0x01,0x86,0xf8,0x45,0x01,0x07,0x17,0x03,0x01,0x07 */ + /* 2.16.840.1.113733.1.7.23.3.1.7 */ + CP_DIGICERT_NFSSP_MEDIUMHW_OID = 0x7e0e96e6, + /* 0x60,0x86,0x48,0x01,0x86,0xf8,0x45,0x01,0x07,0x17,0x03,0x01,0x0d */ + /* 2.16.840.1.113733.1.7.23.3.1.13 */ + CP_DIGICERT_NFSSP_AUTH_OID = 0x7e0e96ec, + /* 0x60,0x86,0x48,0x01,0x86,0xf8,0x45,0x01,0x07,0x17,0x03,0x01,0x12 */ + /* 2.16.840.1.113733.1.7.23.3.1.18 */ + CP_DIGICERT_NFSSP_PIVI_HW_OID = 0x7e0e96f3, + /* 0x60,0x86,0x48,0x01,0x86,0xf8,0x45,0x01,0x07,0x17,0x03,0x01,0x14 */ + /* 2.16.840.1.113733.1.7.23.3.1.20 */ + CP_DIGICERT_NFSSP_PIVI_CONTENT_OID = 0x7e0e96f5, + /* 0x60,0x86,0x48,0x01,0x86,0xf8,0x45,0x01,0x07,0x17,0x03,0x01,0x24 */ + /* 2.16.840.1.113733.1.7.23.3.1.36 */ + CP_DIGICERT_NFSSP_MEDDEVHW_OID = 0x7e0e96c5, + /* 0x60,0x86,0x48,0x01,0x86,0xfa,0x6b,0x81,0x48,0x03,0x0a,0x07,0x02 */ + /* 2.16.840.1.114027.200.3.10.7.2 */ + CP_ENTRUST_NFSSP_MEDIUMHW_OID = 0x782980ac, + /* 0x60,0x86,0x48,0x01,0x86,0xfa,0x6b,0x81,0x48,0x03,0x0a,0x07,0x04 */ + /* 2.16.840.1.114027.200.3.10.7.4 */ + CP_ENTRUST_NFSSP_MEDAUTH_OID = 0x782980aa, + /* 0x60,0x86,0x48,0x01,0x86,0xfa,0x6b,0x81,0x48,0x03,0x0a,0x07,0x06 */ + /* 2.16.840.1.114027.200.3.10.7.6 */ + CP_ENTRUST_NFSSP_PIVI_HW_OID = 0x782980a8, + /* 0x60,0x86,0x48,0x01,0x86,0xfa,0x6b,0x81,0x48,0x03,0x0a,0x07,0x09 */ + /* 2.16.840.1.114027.200.3.10.7.9 */ + CP_ENTRUST_NFSSP_PIVI_CONTENT_OID = 0x782980a7, + /* 0x60,0x86,0x48,0x01,0x86,0xfa,0x6b,0x81,0x48,0x03,0x0a,0x07,0x10 */ + /* 2.16.840.1.114027.200.3.10.7.16 */ + CP_ENTRUST_NFSSP_MEDDEVHW_OID = 0x782980be, + /* 0x2b,0x06,0x01,0x04,0x01,0xec,0x7c,0x01,0x01,0x01,0x06 */ + /* 1.3.6.1.4.1.13948.1.1.1.6 */ + CP_EXOSTAR_MEDIUMHW_SHA2_OID = 0x7a84ebd4, + /* 0x60,0x86,0x48,0x01,0x86,0xf9,0x2f,0x00,0x64,0x0c,0x01 */ + /* 2.16.840.1.113839.0.100.12.1 */ + CP_IDENTRUST_MEDIUMHW_SIGN_OID = 0x7e99737d, + /* 0x60,0x86,0x48,0x01,0x86,0xf9,0x2f,0x00,0x64,0x0c,0x02 */ + /* 2.16.840.1.113839.0.100.12.2 */ + CP_IDENTRUST_MEDIUMHW_ENC_OID = 0x7e9a737d, + /* 0x60,0x86,0x48,0x01,0x86,0xf9,0x2f,0x00,0x64,0x12,0x00 */ + /* 2.16.840.1.113839.0.100.18.0 */ + CP_IDENTRUST_PIVI_HW_ID_OID = 0x7e986d7d, + /* 0x60,0x86,0x48,0x01,0x86,0xf9,0x2f,0x00,0x64,0x12,0x01 */ + /* 2.16.840.1.113839.0.100.18.1 */ + CP_IDENTRUST_PIVI_HW_SIGN_OID = 0x7e996d7d, + /* 0x60,0x86,0x48,0x01,0x86,0xf9,0x2f,0x00,0x64,0x12,0x02 */ + /* 2.16.840.1.113839.0.100.18.2 */ + CP_IDENTRUST_PIVI_HW_ENC_OID = 0x7e9a6d7d, + /* 0x60,0x86,0x48,0x01,0x86,0xf9,0x2f,0x00,0x64,0x14,0x01 */ + /* 2.16.840.1.113839.0.100.20.1 */ + CP_IDENTRUST_PIVI_CONTENT_OID = 0x7e996b7d, + /* 0x2b,0x06,0x01,0x04,0x01,0x67,0x64,0x01,0x01,0x03,0x03 */ + /* 1.3.6.1.4.1.103.100.1.1.3.3 */ + CP_LOCKHEED_MEDIUMHW_OID = 0x7a9962d4, + /* 0x2b,0x06,0x01,0x04,0x01,0xff,0x4e,0x83,0x7d,0x02,0x08 */ + /* 1.3.6.1.4.1.16334.509.2.8 */ + CP_NORTHROP_MEDIUM_256_HW_OID = 0x78b8fba8, + /* 0x2b,0x06,0x01,0x04,0x01,0xff,0x4e,0x83,0x7d,0x02,0x09 */ + /* 1.3.6.1.4.1.16334.509.2.9 */ + CP_NORTHROP_PIVI_256_HW_OID = 0x78b9fba8, + /* 0x2b,0x06,0x01,0x04,0x01,0xff,0x4e,0x83,0x7d,0x02,0x0b */ + /* 1.3.6.1.4.1.16334.509.2.11 */ + CP_NORTHROP_PIVI_256_CONTENT_OID = 0x78bbfba8, + /* 0x2b,0x06,0x01,0x04,0x01,0xff,0x4e,0x83,0x7d,0x02,0x0e */ + /* 1.3.6.1.4.1.16334.509.2.14 */ + CP_NORTHROP_MEDIUM_384_HW_OID = 0x78befba8, + /* 0x2b,0x06,0x01,0x04,0x01,0x8c,0x21,0x0a,0x01,0x0c */ + /* 1.3.6.1.4.1.1569.10.1.12 */ + CP_RAYTHEON_MEDIUMHW_OID = 0x0e2086d4, + /* 0x2b,0x06,0x01,0x04,0x01,0x8c,0x21,0x0a,0x01,0x12 */ + /* 1.3.6.1.4.1.1569.10.1.18 */ + CP_RAYTHEON_MEDDEVHW_OID = 0x0e2098d4, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xd1,0x11,0x0a,0x01,0x0c */ + /* 1.3.6.1.4.1.26769.10.1.12 */ + CP_RAYTHEON_SHA2_MEDIUMHW_OID = 0x6a2386df, + /* 0x2b,0x06,0x01,0x04,0x01,0x81,0xd1,0x11,0x0a,0x01,0x12 */ + /* 1.3.6.1.4.1.26769.10.1.18 */ + CP_RAYTHEON_SHA2_MEDDEVHW_OID = 0x6a3d86df, + /* 0x2b,0x06,0x01,0x04,0x01,0x9e,0x52,0x01,0x01,0x01,0x0c */ + /* 1.3.6.1.4.1.3922.1.1.1.12 */ + CP_WIDEPOINT_MEDIUMHW_OID = 0x7aa099d4, + /* 0x2b,0x06,0x01,0x04,0x01,0x9e,0x52,0x01,0x01,0x01,0x12 */ + /* 1.3.6.1.4.1.3922.1.1.1.18 */ + CP_WIDEPOINT_PIVI_HW_OID = 0x7abe99d4, + /* 0x2b,0x06,0x01,0x04,0x01,0x9e,0x52,0x01,0x01,0x01,0x14 */ + /* 1.3.6.1.4.1.3922.1.1.1.20 */ + CP_WIDEPOINT_PIVI_CONTENT_OID = 0x7ab899d4, + /* 0x2b,0x06,0x01,0x04,0x01,0x9e,0x52,0x01,0x01,0x01,0x26 */ + /* 1.3.6.1.4.1.3922.1.1.1.38 */ + CP_WIDEPOINT_MEDDEVHW_OID = 0x7a8a99d4, + /* 0x2a,0x24,0x01,0x82,0x4e,0x01,0x02,0x01,0x02 */ + /* 1.2.36.1.334.1.2.1.2 */ + CP_ADO_MEDIUM_OID = 0x7cfcda99, + /* 0x2a,0x24,0x01,0x82,0x4e,0x01,0x02,0x01,0x03 */ + /* 1.2.36.1.334.1.2.1.3 */ + CP_ADO_HIGH_OID = 0x7cfcda98, + /* 0x2a,0x24,0x01,0x82,0x4e,0x01,0x02,0x02,0x02 */ + /* 1.2.36.1.334.1.2.2.2 */ + CP_ADO_RESOURCE_MEDIUM_OID = 0x7ffcda99, + /* 0x2b,0x06,0x01,0x04,0x01,0xb2,0x31,0x01,0x02,0x01,0x03,0x04 */ + /* 1.3.6.1.4.1.6449.1.2.1.3.4 */ + CP_COMODO_OID = 0x01ccb5d7, + /* 0x60,0x84,0x10,0x01,0x87,0x6b,0x01,0x02,0x05,0x01 */ + /* 2.16.528.1.1003.1.2.5.1 */ + CP_NL_MOD_AUTH_OID = 0x0311ee1d, + /* 0x60,0x84,0x10,0x01,0x87,0x6b,0x01,0x02,0x05,0x02 */ + /* 2.16.528.1.1003.1.2.5.2 */ + CP_NL_MOD_IRREFUT_OID = 0x0311ed1d, + /* 0x60,0x84,0x10,0x01,0x87,0x6b,0x01,0x02,0x05,0x03 */ + /* 2.16.528.1.1003.1.2.5.3 */ + CP_NL_MOD_CONFID_OID = 0x0311ec1d +#endif +}; + +enum SepHardwareName_Sum { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x08,0x04 */ + HW_NAME_OID = 79 /* 1.3.6.1.5.5.7.8.4 */ +#else + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x08,0x04 */ + HW_NAME_OID = 0x0109012e /* 1.3.6.1.5.5.7.8.4 */ +#endif +}; + +enum AuthInfo_Sum { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x01 */ + AIA_OCSP_OID = 116, /* 1.3.6.1.5.5.7.48.1 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x02 */ + AIA_CA_ISSUER_OID = 117, /* 1.3.6.1.5.5.7.48.2 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x05 */ + AIA_CA_REPO_OID = 120 /* 1.3.6.1.5.5.7.48.5 */ +#else + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x01 */ + AIA_OCSP_OID = 0x0431012e, /* 1.3.6.1.5.5.7.48.1 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x02 */ + AIA_CA_ISSUER_OID = 0x0731012e, /* 1.3.6.1.5.5.7.48.2 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x05 */ + AIA_CA_REPO_OID = 0x0031012e /* 1.3.6.1.5.5.7.48.5 */ +#endif +}; + +enum ExtKeyUsage_Sum { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x55,0x1d,0x25,0x00 */ + EKU_ANY_OID = 151, /* 2.5.29.37.0 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x03,0x01 */ + EKU_SERVER_AUTH_OID = 71, /* 1.3.6.1.5.5.7.3.1 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x03,0x02 */ + EKU_CLIENT_AUTH_OID = 72, /* 1.3.6.1.5.5.7.3.2 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x03,0x03 */ + EKU_CODESIGNING_OID = 73, /* 1.3.6.1.5.5.7.3.3 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x03,0x04 */ + EKU_EMAILPROTECT_OID = 74, /* 1.3.6.1.5.5.7.3.4 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x03,0x08 */ + EKU_TIMESTAMP_OID = 78, /* 1.3.6.1.5.5.7.3.8 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x03,0x09 */ + EKU_OCSP_SIGN_OID = 79, /* 1.3.6.1.5.5.7.3.9 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x03,0x15 */ + EKU_SSH_CLIENT_AUTH_OID = 91, /* 1.3.6.1.5.5.7.3.21 */ + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x14,0x02,0x02 */ + EKU_SSH_MSCL_OID = 264, /* 1.3.6.1.4.1.311.20.2.2 */ + /* 0x2b,0x06,0x01,0x05,0x02,0x03,0x04 */ + EKU_SSH_KP_CLIENT_AUTH_OID = 64 /* 1.3.6.1.5.2.3.4 */ +#else + /* 0x55,0x1d,0x25,0x00 */ + EKU_ANY_OID = 0x00da1daa, /* 2.5.29.37.0 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x03,0x01 */ + EKU_SERVER_AUTH_OID = 0x0402012e, /* 1.3.6.1.5.5.7.3.1 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x03,0x02 */ + EKU_CLIENT_AUTH_OID = 0x0702012e, /* 1.3.6.1.5.5.7.3.2 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x03,0x03 */ + EKU_CODESIGNING_OID = 0x0602012e, /* 1.3.6.1.5.5.7.3.3 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x03,0x04 */ + EKU_EMAILPROTECT_OID = 0x0102012e, /* 1.3.6.1.5.5.7.3.4 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x03,0x08 */ + EKU_TIMESTAMP_OID = 0x0d02012e, /* 1.3.6.1.5.5.7.3.8 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x03,0x09 */ + EKU_OCSP_SIGN_OID = 0x0c02012e, /* 1.3.6.1.5.5.7.3.9 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x03,0x15 */ + EKU_SSH_CLIENT_AUTH_OID = 0x1002012e, /* 1.3.6.1.5.5.7.3.21 */ + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x14,0x02,0x02 */ + EKU_SSH_MSCL_OID = 0x103686d7, /* 1.3.6.1.4.1.311.20.2.2 */ + /* 0x2b,0x06,0x01,0x05,0x02,0x03,0x04 */ + EKU_SSH_KP_CLIENT_AUTH_OID = 0x7a050529 /* 1.3.6.1.5.2.3.4 */ +#endif +}; + +enum SubjDirAttr_Sum { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x09,0x01 */ + SDA_DOB_OID = 77, /* 1.3.6.1.5.5.7.9.1 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x09,0x02 */ + SDA_POB_OID = 78, /* 1.3.6.1.5.5.7.9.2 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x09,0x03 */ + SDA_GENDER_OID = 79, /* 1.3.6.1.5.5.7.9.3 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x09,0x04 */ + SDA_COC_OID = 80, /* 1.3.6.1.5.5.7.9.4 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x09,0x05 */ + SDA_COR_OID = 81 /* 1.3.6.1.5.5.7.9.5 */ +#else + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x09,0x01 */ + SDA_DOB_OID = 0x0408012e, /* 1.3.6.1.5.5.7.9.1 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x09,0x02 */ + SDA_POB_OID = 0x0708012e, /* 1.3.6.1.5.5.7.9.2 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x09,0x03 */ + SDA_GENDER_OID = 0x0608012e, /* 1.3.6.1.5.5.7.9.3 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x09,0x04 */ + SDA_COC_OID = 0x0108012e, /* 1.3.6.1.5.5.7.9.4 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x09,0x05 */ + SDA_COR_OID = 0x0008012e /* 1.3.6.1.5.5.7.9.5 */ +#endif +}; + +enum CompressAlg_Sum { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x10,0x03,0x08 */ + ZLIBc = 679 /* 1.2.840.113549.1.9.16.3.8 */ +#else + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x10,0x03,0x08 */ + ZLIBc = 0x70be8832 /* 1.2.840.113549.1.9.16.3.8 */ +#endif +}; + +enum CsrAttrType { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x02 */ + UNSTRUCTURED_NAME_OID = 654, /* 1.2.840.113549.1.9.2 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x03 */ + PKCS9_CONTENT_TYPE_OID = 655, /* 1.2.840.113549.1.9.3 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x07 */ + CHALLENGE_PASSWORD_OID = 659, /* 1.2.840.113549.1.9.7 */ + /* 0x55,0x04,0x05 */ + SERIAL_NUMBER_OID = 94, /* 2.5.4.5 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x0e */ + EXTENSION_REQUEST_OID = 666, /* 1.2.840.113549.1.9.14 */ + /* 0x09,0x92,0x26,0x89,0x93,0xf2,0x2c,0x64,0x01,0x01 */ + USER_ID_OID = 865, /* 0.9.2342.19200300.100.1.1 */ + /* 0x55,0x04,0x2e */ + DNQUALIFIER_OID = 135, /* 2.5.4.46 */ + /* 0x55,0x04,0x2b */ + INITIALS_OID = 132, /* 2.5.4.43 */ + /* 0x55,0x04,0x04 */ + SURNAME_OID = 93, /* 2.5.4.4 */ + /* 0x55,0x04,0x29 */ + NAME_OID = 130, /* 2.5.4.41 */ + /* 0x55,0x04,0x2a */ + GIVEN_NAME_OID = 131 /* 2.5.4.42 */ +#else + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x02 */ + UNSTRUCTURED_NAME_OID = 0x70b67420, /* 1.2.840.113549.1.9.2 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x03 */ + PKCS9_CONTENT_TYPE_OID = 0x70b67421, /* 1.2.840.113549.1.9.3 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x07 */ + CHALLENGE_PASSWORD_OID = 0x70b67425, /* 1.2.840.113549.1.9.7 */ + /* 0x55,0x04,0x05 */ + SERIAL_NUMBER_OID = 0x7ffa04aa, /* 2.5.4.5 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x0e */ + EXTENSION_REQUEST_OID = 0x70b6742c, /* 1.2.840.113549.1.9.14 */ + /* 0x09,0x92,0x26,0x89,0x93,0xf2,0x2c,0x64,0x01,0x01 */ + USER_ID_OID = 0x6d0a6164, /* 0.9.2342.19200300.100.1.1 */ + /* 0x55,0x04,0x2e */ + DNQUALIFIER_OID = 0x7fd104aa, /* 2.5.4.46 */ + /* 0x55,0x04,0x2b */ + INITIALS_OID = 0x7fd404aa, /* 2.5.4.43 */ + /* 0x55,0x04,0x04 */ + SURNAME_OID = 0x7ffb04aa, /* 2.5.4.4 */ + /* 0x55,0x04,0x29 */ + NAME_OID = 0x7fd604aa, /* 2.5.4.41 */ + /* 0x55,0x04,0x2a */ + GIVEN_NAME_OID = 0x7fd504aa /* 2.5.4.42 */ +#endif +}; + +enum Ocsp_Sum { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x01 */ + OCSP_BASIC_OID = 117, /* 1.3.6.1.5.5.7.48.1.1 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x02 */ + OCSP_NONCE_OID = 118 /* 1.3.6.1.5.5.7.48.1.2 */ +#else + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x01 */ + OCSP_BASIC_OID = 0x7bcefed0, /* 1.3.6.1.5.5.7.48.1.1 */ + /* 0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x02 */ + OCSP_NONCE_OID = 0x7bcefed3 /* 1.3.6.1.5.5.7.48.1.2 */ +#endif +}; + +enum Ecc_Sum { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x2b,0x81,0x04,0x00,0x06 */ + ECC_SECP112R1_OID = 182, /* 1.3.132.0.6 */ + /* 0x2b,0x81,0x04,0x00,0x07 */ + ECC_SECP112R2_OID = 183, /* 1.3.132.0.7 */ + /* 0x2b,0x81,0x04,0x00,0x1c */ + ECC_SECP128R1_OID = 204, /* 1.3.132.0.28 */ + /* 0x2b,0x81,0x04,0x00,0x1d */ + ECC_SECP128R2_OID = 205, /* 1.3.132.0.29 */ + /* 0x2b,0x81,0x04,0x00,0x08 */ + ECC_SECP160R1_OID = 184, /* 1.3.132.0.8 */ + /* 0x2b,0x81,0x04,0x00,0x1e */ + ECC_SECP160R2_OID = 206, /* 1.3.132.0.30 */ + /* 0x2b,0x81,0x04,0x00,0x09 */ + ECC_SECP160K1_OID = 185, /* 1.3.132.0.9 */ + /* 0x2b,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x01 */ + ECC_BRAINPOOLP160R1_OID = 98, /* 1.3.36.3.3.2.8.1.1.1 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x01 */ + ECC_SECP192R1_OID = 520, /* 1.2.840.10045.3.1.1 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x02 */ + ECC_PRIME192V2_OID = 521, /* 1.2.840.10045.3.1.2 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x03 */ + ECC_PRIME192V3_OID = 522, /* 1.2.840.10045.3.1.3 */ + /* 0x2b,0x81,0x04,0x00,0x1f */ + ECC_SECP192K1_OID = 207, /* 1.3.132.0.31 */ + /* 0x2b,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x03 */ + ECC_BRAINPOOLP192R1_OID = 100, /* 1.3.36.3.3.2.8.1.1.3 */ + /* 0x2b,0x81,0x04,0x00,0x21 */ + ECC_SECP224R1_OID = 209, /* 1.3.132.0.33 */ + /* 0x2b,0x81,0x04,0x00,0x20 */ + ECC_SECP224K1_OID = 208, /* 1.3.132.0.32 */ + /* 0x2b,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x05 */ + ECC_BRAINPOOLP224R1_OID = 102, /* 1.3.36.3.3.2.8.1.1.5 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x04 */ + ECC_PRIME239V1_OID = 523, /* 1.2.840.10045.3.1.4 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x05 */ + ECC_PRIME239V2_OID = 524, /* 1.2.840.10045.3.1.5 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x06 */ + ECC_PRIME239V3_OID = 525, /* 1.2.840.10045.3.1.6 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x07 */ + ECC_SECP256R1_OID = 526, /* 1.2.840.10045.3.1.7 */ + /* 0x2b,0x81,0x04,0x00,0x0a */ + ECC_SECP256K1_OID = 186, /* 1.3.132.0.10 */ + /* 0x2b,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x07 */ + ECC_BRAINPOOLP256R1_OID = 104, /* 1.3.36.3.3.2.8.1.1.7 */ + /* 0x2a,0x81,0x1c,0xcf,0x55,0x01,0x82,0x2d */ + ECC_SM2P256V1_OID = 667, /* 1.2.156.10197.1.301 */ + /* 0x2b,0x65,0x6e */ + ECC_X25519_OID = 254, /* 1.3.101.110 */ + /* 0x2b,0x65,0x70 */ + ECC_ED25519_OID = 256, /* 1.3.101.112 */ + /* 0x2b,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x09 */ + ECC_BRAINPOOLP320R1_OID = 106, /* 1.3.36.3.3.2.8.1.1.9 */ + /* 0x2b,0x65,0x6f */ + ECC_X448_OID = 255, /* 1.3.101.111 */ + /* 0x2b,0x65,0x71 */ + ECC_ED448_OID = 257, /* 1.3.101.113 */ + /* 0x2b,0x81,0x04,0x00,0x22 */ + ECC_SECP384R1_OID = 210, /* 1.3.132.0.34 */ + /* 0x2b,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x0b */ + ECC_BRAINPOOLP384R1_OID = 108, /* 1.3.36.3.3.2.8.1.1.11 */ + /* 0x2b,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x0d */ + ECC_BRAINPOOLP512R1_OID = 110, /* 1.3.36.3.3.2.8.1.1.13 */ + /* 0x2b,0x81,0x04,0x00,0x23 */ + ECC_SECP521R1_OID = 211 /* 1.3.132.0.35 */ +#else + /* 0x2b,0x81,0x04,0x00,0x06 */ + ECC_SECP112R1_OID = 0x7f047e2d, /* 1.3.132.0.6 */ + /* 0x2b,0x81,0x04,0x00,0x07 */ + ECC_SECP112R2_OID = 0x7f047e2c, /* 1.3.132.0.7 */ + /* 0x2b,0x81,0x04,0x00,0x1c */ + ECC_SECP128R1_OID = 0x7f047e37, /* 1.3.132.0.28 */ + /* 0x2b,0x81,0x04,0x00,0x1d */ + ECC_SECP128R2_OID = 0x7f047e36, /* 1.3.132.0.29 */ + /* 0x2b,0x81,0x04,0x00,0x08 */ + ECC_SECP160R1_OID = 0x7f047e23, /* 1.3.132.0.8 */ + /* 0x2b,0x81,0x04,0x00,0x1e */ + ECC_SECP160R2_OID = 0x7f047e35, /* 1.3.132.0.30 */ + /* 0x2b,0x81,0x04,0x00,0x09 */ + ECC_SECP160K1_OID = 0x7f047e22, /* 1.3.132.0.9 */ + /* 0x2b,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x01 */ + ECC_BRAINPOOLP160R1_OID = 0x7dfdd3d7, /* 1.3.36.3.3.2.8.1.1.1 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x01 */ + ECC_SECP192R1_OID = 0x4f498517, /* 1.2.840.10045.3.1.1 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x02 */ + ECC_PRIME192V2_OID = 0x4c498517, /* 1.2.840.10045.3.1.2 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x03 */ + ECC_PRIME192V3_OID = 0x4d498517, /* 1.2.840.10045.3.1.3 */ + /* 0x2b,0x81,0x04,0x00,0x1f */ + ECC_SECP192K1_OID = 0x7f047e34, /* 1.3.132.0.31 */ + /* 0x2b,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x03 */ + ECC_BRAINPOOLP192R1_OID = 0x7dfdd3d5, /* 1.3.36.3.3.2.8.1.1.3 */ + /* 0x2b,0x81,0x04,0x00,0x21 */ + ECC_SECP224R1_OID = 0x7f047e0a, /* 1.3.132.0.33 */ + /* 0x2b,0x81,0x04,0x00,0x20 */ + ECC_SECP224K1_OID = 0x7f047e0b, /* 1.3.132.0.32 */ + /* 0x2b,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x05 */ + ECC_BRAINPOOLP224R1_OID = 0x7dfdd3d3, /* 1.3.36.3.3.2.8.1.1.5 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x04 */ + ECC_PRIME239V1_OID = 0x4a498517, /* 1.2.840.10045.3.1.4 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x05 */ + ECC_PRIME239V2_OID = 0x4b498517, /* 1.2.840.10045.3.1.5 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x06 */ + ECC_PRIME239V3_OID = 0x48498517, /* 1.2.840.10045.3.1.6 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x07 */ + ECC_SECP256R1_OID = 0x49498517, /* 1.2.840.10045.3.1.7 */ + /* 0x2b,0x81,0x04,0x00,0x0a */ + ECC_SECP256K1_OID = 0x7f047e21, /* 1.3.132.0.10 */ + /* 0x2b,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x07 */ + ECC_BRAINPOOLP256R1_OID = 0x7dfdd3d1, /* 1.3.36.3.3.2.8.1.1.7 */ + /* 0x2a,0x81,0x1c,0xcf,0x55,0x01,0x82,0x2d */ + ECC_SM2P256V1_OID = 0x629e807f, /* 1.2.156.10197.1.301 */ + /* 0x2b,0x65,0x6e */ + ECC_X25519_OID = 0x7f9165d4, /* 1.3.101.110 */ + /* 0x2b,0x65,0x70 */ + ECC_ED25519_OID = 0x7f8f65d4, /* 1.3.101.112 */ + /* 0x2b,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x09 */ + ECC_BRAINPOOLP320R1_OID = 0x7dfdd3df, /* 1.3.36.3.3.2.8.1.1.9 */ + /* 0x2b,0x65,0x6f */ + ECC_X448_OID = 0x7f9065d4, /* 1.3.101.111 */ + /* 0x2b,0x65,0x71 */ + ECC_ED448_OID = 0x7f8e65d4, /* 1.3.101.113 */ + /* 0x2b,0x81,0x04,0x00,0x22 */ + ECC_SECP384R1_OID = 0x7f047e09, /* 1.3.132.0.34 */ + /* 0x2b,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x0b */ + ECC_BRAINPOOLP384R1_OID = 0x7dfdd3dd, /* 1.3.36.3.3.2.8.1.1.11 */ + /* 0x2b,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x0d */ + ECC_BRAINPOOLP512R1_OID = 0x7dfdd3db, /* 1.3.36.3.3.2.8.1.1.13 */ + /* 0x2b,0x81,0x04,0x00,0x23 */ + ECC_SECP521R1_OID = 0x7f047e08 /* 1.3.132.0.35 */ +#endif +}; + +enum Ctc_SigType { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x2a,0x86,0x48,0xce,0x38,0x04,0x03 */ + CTC_SHAwDSA = 517, /* 1.2.840.10040.4.3 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x02 */ + CTC_SHA256wDSA = 416, /* 2.16.840.1.101.3.4.3.2 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x02 */ + CTC_MD2wRSA = 646, /* 1.2.840.113549.1.1.2 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x04 */ + CTC_MD5wRSA = 648, /* 1.2.840.113549.1.1.4 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05 */ + CTC_SHAwRSA = 649, /* 1.2.840.113549.1.1.5 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x04,0x01 */ + CTC_SHAwECDSA = 520, /* 1.2.840.10045.4.1 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0e */ + CTC_SHA224wRSA = 658, /* 1.2.840.113549.1.1.14 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x04,0x03,0x01 */ + CTC_SHA224wECDSA = 523, /* 1.2.840.10045.4.3.1 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0b */ + CTC_SHA256wRSA = 655, /* 1.2.840.113549.1.1.11 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x04,0x03,0x02 */ + CTC_SHA256wECDSA = 524, /* 1.2.840.10045.4.3.2 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0c */ + CTC_SHA384wRSA = 656, /* 1.2.840.113549.1.1.12 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x04,0x03,0x03 */ + CTC_SHA384wECDSA = 525, /* 1.2.840.10045.4.3.3 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0d */ + CTC_SHA512wRSA = 657, /* 1.2.840.113549.1.1.13 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x04,0x03,0x04 */ + CTC_SHA512wECDSA = 526, /* 1.2.840.10045.4.3.4 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x09 */ + CTC_SHA3_224wECDSA = 423, /* 2.16.840.1.101.3.4.3.9 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x0a */ + CTC_SHA3_256wECDSA = 424, /* 2.16.840.1.101.3.4.3.10 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x0b */ + CTC_SHA3_384wECDSA = 425, /* 2.16.840.1.101.3.4.3.11 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x0c */ + CTC_SHA3_512wECDSA = 426, /* 2.16.840.1.101.3.4.3.12 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x0d */ + CTC_SHA3_224wRSA = 427, /* 2.16.840.1.101.3.4.3.13 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x0e */ + CTC_SHA3_256wRSA = 428, /* 2.16.840.1.101.3.4.3.14 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x0f */ + CTC_SHA3_384wRSA = 429, /* 2.16.840.1.101.3.4.3.15 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x10 */ + CTC_SHA3_512wRSA = 430, /* 2.16.840.1.101.3.4.3.16 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0a */ + CTC_RSASSAPSS = 654, /* 1.2.840.113549.1.1.10 */ + /* 0x2a,0x81,0x1c,0xcf,0x55,0x01,0x83,0x75 */ + CTC_SM3wSM2 = 740, /* 1.2.156.10197.1.501 */ + /* 0x2b,0x65,0x70 */ + CTC_ED25519 = 256, /* 1.3.101.112 */ + /* 0x2b,0x65,0x71 */ + CTC_ED448 = 257, /* 1.3.101.113 */ + /* 0x2b,0xce,0x0f,0x03,0x06 */ + CTC_FALCON_LEVEL1 = 273, /* 1.3.9999.3.6 */ + /* 0x2b,0xce,0x0f,0x03,0x09 */ + CTC_FALCON_LEVEL5 = 276, /* 1.3.9999.3.9 */ + /* 0x2b,0x06,0x01,0x04,0x01,0x02,0x82,0x0b,0x0c,0x04,0x04 */ + CTC_DILITHIUM_LEVEL2 = 218, /* 1.3.6.1.4.1.2.267.12.4.4 */ + /* 0x2b,0x06,0x01,0x04,0x01,0x02,0x82,0x0b,0x0c,0x06,0x05 */ + CTC_DILITHIUM_LEVEL3 = 221, /* 1.3.6.1.4.1.2.267.12.6.5 */ + /* 0x2b,0x06,0x01,0x04,0x01,0x02,0x82,0x0b,0x0c,0x08,0x07 */ + CTC_DILITHIUM_LEVEL5 = 225, /* 1.3.6.1.4.1.2.267.12.8.7 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x11 */ + CTC_ML_DSA_LEVEL2 = 431, /* 2.16.840.1.101.3.4.3.17 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x12 */ + CTC_ML_DSA_LEVEL3 = 432, /* 2.16.840.1.101.3.4.3.18 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x13 */ + CTC_ML_DSA_LEVEL5 = 433, /* 2.16.840.1.101.3.4.3.19 */ + /* 0x2b,0xce,0x0f,0x06,0x07,0x04 */ + CTC_SPHINCS_FAST_LEVEL1 = 281, /* 1.3.9999.6.7.4 */ + /* 0x2b,0xce,0x0f,0x06,0x08,0x03 */ + CTC_SPHINCS_FAST_LEVEL3 = 283, /* 1.3.9999.6.8.3 */ + /* 0x2b,0xce,0x0f,0x06,0x09,0x03 */ + CTC_SPHINCS_FAST_LEVEL5 = 282, /* 1.3.9999.6.9.3 */ + /* 0x2b,0xce,0x0f,0x06,0x07,0x0a */ + CTC_SPHINCS_SMALL_LEVEL1 = 287, /* 1.3.9999.6.7.10 */ + /* 0x2b,0xce,0x0f,0x06,0x08,0x07 */ + CTC_SPHINCS_SMALL_LEVEL3 = 285, /* 1.3.9999.6.8.7 */ + /* 0x2b,0xce,0x0f,0x06,0x09,0x07 */ + CTC_SPHINCS_SMALL_LEVEL5 = 286 /* 1.3.9999.6.9.7 */ +#else + /* 0x2a,0x86,0x48,0xce,0x38,0x04,0x03 */ + CTC_SHAwDSA = 0x314b8212, /* 1.2.840.10040.4.3 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x02 */ + CTC_SHA256wDSA = 0x7db37af8, /* 2.16.840.1.101.3.4.3.2 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x02 */ + CTC_MD2wRSA = 0x78b67420, /* 1.2.840.113549.1.1.2 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x04 */ + CTC_MD5wRSA = 0x78b67426, /* 1.2.840.113549.1.1.4 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05 */ + CTC_SHAwRSA = 0x78b67427, /* 1.2.840.113549.1.1.5 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x04,0x01 */ + CTC_SHAwECDSA = 0x31498217, /* 1.2.840.10045.4.1 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0e */ + CTC_SHA224wRSA = 0x78b6742c, /* 1.2.840.113549.1.1.14 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x04,0x03,0x01 */ + CTC_SHA224wECDSA = 0x4f4b8217, /* 1.2.840.10045.4.3.1 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0b */ + CTC_SHA256wRSA = 0x78b67429, /* 1.2.840.113549.1.1.11 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x04,0x03,0x02 */ + CTC_SHA256wECDSA = 0x4c4b8217, /* 1.2.840.10045.4.3.2 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0c */ + CTC_SHA384wRSA = 0x78b6742e, /* 1.2.840.113549.1.1.12 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x04,0x03,0x03 */ + CTC_SHA384wECDSA = 0x4d4b8217, /* 1.2.840.10045.4.3.3 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0d */ + CTC_SHA512wRSA = 0x78b6742f, /* 1.2.840.113549.1.1.13 */ + /* 0x2a,0x86,0x48,0xce,0x3d,0x04,0x03,0x04 */ + CTC_SHA512wECDSA = 0x4a4b8217, /* 1.2.840.10045.4.3.4 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x09 */ + CTC_SHA3_224wECDSA = 0x7db37af3, /* 2.16.840.1.101.3.4.3.9 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x0a */ + CTC_SHA3_256wECDSA = 0x7db37af0, /* 2.16.840.1.101.3.4.3.10 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x0b */ + CTC_SHA3_384wECDSA = 0x7db37af1, /* 2.16.840.1.101.3.4.3.11 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x0c */ + CTC_SHA3_512wECDSA = 0x7db37af6, /* 2.16.840.1.101.3.4.3.12 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x0d */ + CTC_SHA3_224wRSA = 0x7db37af7, /* 2.16.840.1.101.3.4.3.13 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x0e */ + CTC_SHA3_256wRSA = 0x7db37af4, /* 2.16.840.1.101.3.4.3.14 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x0f */ + CTC_SHA3_384wRSA = 0x7db37af5, /* 2.16.840.1.101.3.4.3.15 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x10 */ + CTC_SHA3_512wRSA = 0x7db37aea, /* 2.16.840.1.101.3.4.3.16 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0a */ + CTC_RSASSAPSS = 0x78b67428, /* 1.2.840.113549.1.1.10 */ + /* 0x2a,0x81,0x1c,0xcf,0x55,0x01,0x83,0x75 */ + CTC_SM3wSM2 = 0x3a9f807f, /* 1.2.156.10197.1.501 */ + /* 0x2b,0x65,0x70 */ + CTC_ED25519 = 0x7f8f65d4, /* 1.3.101.112 */ + /* 0x2b,0x65,0x71 */ + CTC_ED448 = 0x7f8e65d4, /* 1.3.101.113 */ + /* 0x2b,0xce,0x0f,0x03,0x06 */ + CTC_FALCON_LEVEL1 = 0x7c0f312d, /* 1.3.9999.3.6 */ + /* 0x2b,0xce,0x0f,0x03,0x09 */ + CTC_FALCON_LEVEL5 = 0x7c0f3122, /* 1.3.9999.3.9 */ + /* 0x2b,0x06,0x01,0x04,0x01,0x02,0x82,0x0b,0x0c,0x04,0x04 */ + CTC_DILITHIUM_LEVEL2 = 0x707800d9, /* 1.3.6.1.4.1.2.267.12.4.4 */ + /* 0x2b,0x06,0x01,0x04,0x01,0x02,0x82,0x0b,0x0c,0x06,0x05 */ + CTC_DILITHIUM_LEVEL3 = 0x707902d9, /* 1.3.6.1.4.1.2.267.12.6.5 */ + /* 0x2b,0x06,0x01,0x04,0x01,0x02,0x82,0x0b,0x0c,0x08,0x07 */ + CTC_DILITHIUM_LEVEL5 = 0x707b0cd9, /* 1.3.6.1.4.1.2.267.12.8.7 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x11 */ + CTC_ML_DSA_LEVEL2 = 0x7db37aeb, /* 2.16.840.1.101.3.4.3.17 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x12 */ + CTC_ML_DSA_LEVEL3 = 0x7db37ae8, /* 2.16.840.1.101.3.4.3.18 */ + /* 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x03,0x13 */ + CTC_ML_DSA_LEVEL5 = 0x7db37ae9, /* 2.16.840.1.101.3.4.3.19 */ + /* 0x2b,0xce,0x0f,0x06,0x07,0x04 */ + CTC_SPHINCS_FAST_LEVEL1 = 0x06f0ca2c, /* 1.3.9999.6.7.4 */ + /* 0x2b,0xce,0x0f,0x06,0x08,0x03 */ + CTC_SPHINCS_FAST_LEVEL3 = 0x06f0cd23, /* 1.3.9999.6.8.3 */ + /* 0x2b,0xce,0x0f,0x06,0x09,0x03 */ + CTC_SPHINCS_FAST_LEVEL5 = 0x06f0cd22, /* 1.3.9999.6.9.3 */ + /* 0x2b,0xce,0x0f,0x06,0x07,0x0a */ + CTC_SPHINCS_SMALL_LEVEL1 = 0x06f0c42c, /* 1.3.9999.6.7.10 */ + /* 0x2b,0xce,0x0f,0x06,0x08,0x07 */ + CTC_SPHINCS_SMALL_LEVEL3 = 0x06f0c923, /* 1.3.9999.6.8.7 */ + /* 0x2b,0xce,0x0f,0x06,0x09,0x07 */ + CTC_SPHINCS_SMALL_LEVEL5 = 0x06f0c922 /* 1.3.9999.6.9.7 */ +#endif +}; + +enum PKCS7_TYPES { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07 */ + PKCS7_MSG = 650, /* 1.2.840.113549.1.7 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x01 */ + DATA = 651, /* 1.2.840.113549.1.7.1 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x02 */ + SIGNED_DATA = 652, /* 1.2.840.113549.1.7.2 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x03 */ + ENVELOPED_DATA = 653, /* 1.2.840.113549.1.7.3 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x04 */ + SIGNED_AND_ENVELOPED_DATA = 654, /* 1.2.840.113549.1.7.4 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x05 */ + DIGESTED_DATA = 655, /* 1.2.840.113549.1.7.5 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x10,0x01,0x09 */ + COMPRESSED_DATA = 678, /* 1.2.840.113549.1.9.16.1.9 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x06 */ + ENCRYPTED_DATA = 656, /* 1.2.840.113549.1.7.6 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x10,0x01,0x10 */ + FIRMWARE_PKG_DATA = 685, /* 1.2.840.113549.1.9.16.1.16 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x10,0x01,0x17 */ + AUTH_ENVELOPED_DATA = 692, /* 1.2.840.113549.1.9.16.1.23 */ + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x02,0x4E,0x02 */ + ENCRYPTED_KEY_PACKAGE = 489 /* 2.16.840.1.101.2.1.2.78.2 */ +#else + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07 */ + PKCS7_MSG = 0x01498bdd, /* 1.2.840.113549.1.7 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x01 */ + DATA = 0x7eb67423, /* 1.2.840.113549.1.7.1 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x02 */ + SIGNED_DATA = 0x7eb67420, /* 1.2.840.113549.1.7.2 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x03 */ + ENVELOPED_DATA = 0x7eb67421, /* 1.2.840.113549.1.7.3 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x04 */ + SIGNED_AND_ENVELOPED_DATA = 0x7eb67426, /* 1.2.840.113549.1.7.4 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x05 */ + DIGESTED_DATA = 0x7eb67427, /* 1.2.840.113549.1.7.5 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x10,0x01,0x09 */ + COMPRESSED_DATA = 0x70bf8a32, /* 1.2.840.113549.1.9.16.1.9 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x06 */ + ENCRYPTED_DATA = 0x7eb67424, /* 1.2.840.113549.1.7.6 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x10,0x01,0x10 */ + FIRMWARE_PKG_DATA = 0x70a68a32, /* 1.2.840.113549.1.9.16.1.16 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x10,0x01,0x17 */ + AUTH_ENVELOPED_DATA = 0x70a18a32, /* 1.2.840.113549.1.9.16.1.23 */ + /* 0x60,0x86,0x48,0x01,0x65,0x02,0x01,0x02,0x4E,0x02 */ + ENCRYPTED_KEY_PACKAGE = 0x034986B4 /* 2.16.840.1.101.2.1.2.78.2 */ +#endif +}; + +enum PKCS12_TYPES { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x0c,0x0a,0x01,0x01 */ + WC_PKCS12_KeyBag = 667, /* 1.2.840.113549.1.12.10.1.1 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x0c,0x0a,0x01,0x02 */ + WC_PKCS12_ShroudedKeyBag = 668, /* 1.2.840.113549.1.12.10.1.2 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x0c,0x0a,0x01,0x03 */ + WC_PKCS12_CertBag = 669, /* 1.2.840.113549.1.12.10.1.3 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x16,0x01 */ + WC_PKCS12_CertBag_Type1 = 675, /* 1.2.840.113549.1.9.22.1 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x0c,0x0a,0x01,0x04 */ + WC_PKCS12_CrlBag = 670, /* 1.2.840.113549.1.12.10.1.4 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x0c,0x0a,0x01,0x05 */ + WC_PKCS12_SecretBag = 671, /* 1.2.840.113549.1.12.10.1.5 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x0c,0x0a,0x01,0x06 */ + WC_PKCS12_SafeContentsBag = 672, /* 1.2.840.113549.1.12.10.1.6 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x01 */ + WC_PKCS12_DATA = 651, /* 1.2.840.113549.1.7.1 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x06 */ + WC_PKCS12_ENCRYPTED_DATA = 656 /* 1.2.840.113549.1.7.6 */ +#else + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x0c,0x0a,0x01,0x01 */ + WC_PKCS12_KeyBag = 0x75b78a28, /* 1.2.840.113549.1.12.10.1.1 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x0c,0x0a,0x01,0x02 */ + WC_PKCS12_ShroudedKeyBag = 0x75b48a28, /* 1.2.840.113549.1.12.10.1.2 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x0c,0x0a,0x01,0x03 */ + WC_PKCS12_CertBag = 0x75b58a28, /* 1.2.840.113549.1.12.10.1.3 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x16,0x01 */ + WC_PKCS12_CertBag_Type1 = 0x0f498a34, /* 1.2.840.113549.1.9.22.1 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x0c,0x0a,0x01,0x04 */ + WC_PKCS12_CrlBag = 0x75b28a28, /* 1.2.840.113549.1.12.10.1.4 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x0c,0x0a,0x01,0x05 */ + WC_PKCS12_SecretBag = 0x75b38a28, /* 1.2.840.113549.1.12.10.1.5 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x0c,0x0a,0x01,0x06 */ + WC_PKCS12_SafeContentsBag = 0x75b08a28, /* 1.2.840.113549.1.12.10.1.6 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x01 */ + WC_PKCS12_DATA = 0x7eb67423, /* 1.2.840.113549.1.7.1 */ + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x06 */ + WC_PKCS12_ENCRYPTED_DATA = 0x7eb67424 /* 1.2.840.113549.1.7.6 */ +#endif +}; + +enum CertName_Sum { +#ifdef WOLFSSL_OLD_OID_SUM + /* 0x55,0x04,0x03 */ + /* 2.5.4.3 */ + WC_NAME_COMMON_NAME_OID = 92, + /* 0x55,0x04,0x04 */ + /* 2.5.4.4 */ + WC_NAME_SURNAME_OID = 93, + /* 0x55,0x04,0x05 */ + /* 2.5.4.5 */ + WC_NAME_SERIAL_NUMBER_OID = 94, + /* 0x55,0x04,0x06 */ + /* 2.5.4.6 */ + WC_NAME_COUNTRY_NAME_OID = 95, + /* 0x55,0x04,0x07 */ + /* 2.5.4.7 */ + WC_NAME_LOCALITY_NAME_OID = 96, + /* 0x55,0x04,0x08 */ + /* 2.5.4.8 */ + WC_NAME_STATE_NAME_OID = 97, + /* 0x55,0x04,0x09 */ + /* 2.5.4.9 */ + WC_NAME_STREET_ADDRESS_OID = 98, + /* 0x55,0x04,0x0a */ + /* 2.5.4.10 */ + WC_NAME_ORGANIZATION_NAME_OID = 99, + /* 0x55,0x04,0x0b */ + /* 2.5.4.11 */ + WC_NAME_ORGANIZATION_UNIT_NAME_OID = 100, + /* 0x55,0x04,0x09,0x0c */ + /* 2.5.4.9.12 */ + WC_NAME_TITLE_OID = 110, + /* 0x55,0x04,0x0d */ + /* 2.5.4.13 */ + WC_NAME_DESCRIPTION_OID = 102, + /* 0x55,0x04,0x0f */ + /* 2.5.4.15 */ + WC_NAME_BUSINESS_CATEGORY_OID = 104, + /* 0x55,0x04,0x11 */ + /* 2.5.4.17 */ + WC_NAME_POSTAL_CODE_OID = 106, + /* 0x55,0x04,0x29 */ + /* 2.5.4.41 */ + WC_NAME_NAME_OID = 130, + /* 0x55,0x04,0x2a */ + /* 2.5.4.42 */ + WC_NAME_GIVEN_NAME_OID = 131, + /* 0x55,0x04,0x2b */ + /* 2.5.4.43 */ + WC_NAME_INITIALIS_OID = 132, + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x01 */ + /* 1.2.840.113549.1.9.1 */ + WC_NAME_EMAIL_ADDRESS_OID = 653, + /* 0x09,0x92,0x26,0x89,0x93,0xf2,0x2c,0x64,0x01,0x01 */ + /* 0.9.2342.19200300.100.1.1 */ + WC_NAME_USER_ID_OID = 865, + /* 0x09,0x92,0x26,0x89,0x93,0xf2,0x2c,0x64,0x01,0x03 */ + /* 0.9.2342.19200300.100.1.3 */ + WC_NAME_RFC822_MAILBOX_OID = 867, + /* 0x09,0x92,0x26,0x89,0x93,0xf2,0x2c,0x64,0x01,0x05 */ + /* 0.9.2342.19200300.100.1.5 */ + WC_NAME_FAVOURITE_DRINK_OID = 869, + /* 0x09,0x92,0x26,0x89,0x93,0xf2,0x2c,0x64,0x01,0x19 */ + /* 0.9.2342.19200300.100.1.25 */ + WC_NAME_DOMAIN_COMPONENT_OID = 889, + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x3c,0x02,0x01,0x02 */ + /* 1.3.6.1.4.1.311.60.2.1.2 */ + WC_NAME_JURIS_STATE_PROV_OID = 305, + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x3c,0x02,0x01,0x03 */ + /* 1.3.6.1.4.1.311.60.2.1.3 */ + WC_NAME_JURIS_COUNTRY_OID = 306 +#else + /* 0x55,0x04,0x03 */ + /* 2.5.4.3 */ + WC_NAME_COMMON_NAME_OID = 0x7ffc04aa, + /* 0x55,0x04,0x04 */ + /* 2.5.4.4 */ + WC_NAME_SURNAME_OID = 0x7ffb04aa, + /* 0x55,0x04,0x05 */ + /* 2.5.4.5 */ + WC_NAME_SERIAL_NUMBER_OID = 0x7ffa04aa, + /* 0x55,0x04,0x06 */ + /* 2.5.4.6 */ + WC_NAME_COUNTRY_NAME_OID = 0x7ff904aa, + /* 0x55,0x04,0x07 */ + /* 2.5.4.7 */ + WC_NAME_LOCALITY_NAME_OID = 0x7ff804aa, + /* 0x55,0x04,0x08 */ + /* 2.5.4.8 */ + WC_NAME_STATE_NAME_OID = 0x7ff704aa, + /* 0x55,0x04,0x09 */ + /* 2.5.4.9 */ + WC_NAME_STREET_ADDRESS_OID = 0x7ff604aa, + /* 0x55,0x04,0x0a */ + /* 2.5.4.10 */ + WC_NAME_ORGANIZATION_NAME_OID = 0x7ff504aa, + /* 0x55,0x04,0x0b */ + /* 2.5.4.11 */ + WC_NAME_ORGANIZATION_UNIT_NAME_OID = 0x7ff404aa, + /* 0x55,0x04,0x09,0x0c */ + /* 2.5.4.9.12 */ + WC_NAME_TITLE_OID = 0x0cf604aa, + /* 0x55,0x04,0x0d */ + /* 2.5.4.13 */ + WC_NAME_DESCRIPTION_OID = 0x7ff204aa, + /* 0x55,0x04,0x0f */ + /* 2.5.4.15 */ + WC_NAME_BUSINESS_CATEGORY_OID = 0x7ff004aa, + /* 0x55,0x04,0x11 */ + /* 2.5.4.17 */ + WC_NAME_POSTAL_CODE_OID = 0x7fee04aa, + /* 0x55,0x04,0x29 */ + /* 2.5.4.41 */ + WC_NAME_NAME_OID = 0x7fd604aa, + /* 0x55,0x04,0x2a */ + /* 2.5.4.42 */ + WC_NAME_GIVEN_NAME_OID = 0x7fd504aa, + /* 0x55,0x04,0x2b */ + /* 2.5.4.43 */ + WC_NAME_INITIALIS_OID = 0x7fd404aa, + /* 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x01 */ + /* 1.2.840.113549.1.9.1 */ + WC_NAME_EMAIL_ADDRESS_OID = 0x70b67423, + /* 0x09,0x92,0x26,0x89,0x93,0xf2,0x2c,0x64,0x01,0x01 */ + /* 0.9.2342.19200300.100.1.1 */ + WC_NAME_USER_ID_OID = 0x6d0a6164, + /* 0x09,0x92,0x26,0x89,0x93,0xf2,0x2c,0x64,0x01,0x03 */ + /* 0.9.2342.19200300.100.1.3 */ + WC_NAME_RFC822_MAILBOX_OID = 0x6d0a6364, + /* 0x09,0x92,0x26,0x89,0x93,0xf2,0x2c,0x64,0x01,0x05 */ + /* 0.9.2342.19200300.100.1.5 */ + WC_NAME_FAVOURITE_DRINK_OID = 0x6d0a6564, + /* 0x09,0x92,0x26,0x89,0x93,0xf2,0x2c,0x64,0x01,0x19 */ + /* 0.9.2342.19200300.100.1.25 */ + WC_NAME_DOMAIN_COMPONENT_OID = 0x6d0a7964, + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x3c,0x02,0x01,0x02 */ + /* 1.3.6.1.4.1.311.60.2.1.2 */ + WC_NAME_JURIS_STATE_PROV_OID = 0x47cb85d7, + /* 0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x3c,0x02,0x01,0x03 */ + /* 1.3.6.1.4.1.311.60.2.1.3 */ + WC_NAME_JURIS_COUNTRY_OID = 0x47ca85d7 +#endif +}; + +#endif /* !WOLF_CRYPT_OID_SUM_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/pkcs12.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/pkcs12.h @@ -0,0 +1,79 @@ +/* pkcs12.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + +#ifndef WOLF_CRYPT_PKCS12_H +#define WOLF_CRYPT_PKCS12_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef __cplusplus + extern "C" { +#endif + +typedef struct WC_PKCS12 WC_PKCS12; + +typedef struct WC_DerCertList { /* dereferenced in ssl.c */ + byte* buffer; + word32 bufferSz; + struct WC_DerCertList* next; +} WC_DerCertList; + +/* default values for creating PKCS12 */ +enum { + WC_PKCS12_ITT_DEFAULT = 2048, + WC_PKCS12_VERSION_DEFAULT = 3, + WC_PKCS12_MAC_DEFAULT = 1 +}; + +WOLFSSL_API WC_PKCS12* wc_PKCS12_new(void); +WOLFSSL_API WC_PKCS12* wc_PKCS12_new_ex(void* heap); +WOLFSSL_API void wc_PKCS12_free(WC_PKCS12* pkcs12); +WOLFSSL_API int wc_d2i_PKCS12(const byte* der, word32 derSz, WC_PKCS12* pkcs12); +#ifndef NO_FILESYSTEM +WOLFSSL_API int wc_d2i_PKCS12_fp(const char* file, WC_PKCS12** pkcs12); +#endif +WOLFSSL_API int wc_i2d_PKCS12(WC_PKCS12* pkcs12, byte** der, int* derSz); +WOLFSSL_API int wc_PKCS12_parse(WC_PKCS12* pkcs12, const char* psw, + byte** pkey, word32* pkeySz, byte** cert, word32* certSz, + WC_DerCertList** ca); +WOLFSSL_API int wc_PKCS12_parse_ex(WC_PKCS12* pkcs12, const char* psw, + byte** pkey, word32* pkeySz, byte** cert, word32* certSz, + WC_DerCertList** ca, int keepKeyHeader); +WOLFSSL_LOCAL int wc_PKCS12_verify_ex(WC_PKCS12* pkcs12, + const byte* psw, word32 pswSz); +WOLFSSL_API WC_PKCS12* wc_PKCS12_create(char* pass, word32 passSz, + char* name, byte* key, word32 keySz, byte* cert, word32 certSz, + WC_DerCertList* ca, int nidKey, int nidCert, int iter, int macIter, + int keyType, void* heap); + + +WOLFSSL_LOCAL int wc_PKCS12_SetHeap(WC_PKCS12* pkcs12, void* heap); +WOLFSSL_LOCAL void* wc_PKCS12_GetHeap(WC_PKCS12* pkcs12); + +WOLFSSL_API void wc_FreeCertList(WC_DerCertList* list, void* heap); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLF_CRYPT_PKCS12_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/pkcs7.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/pkcs7.h @@ -0,0 +1,561 @@ +/* pkcs7.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/pkcs7.h +*/ + +#ifndef WOLF_CRYPT_PKCS7_H +#define WOLF_CRYPT_PKCS7_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef HAVE_PKCS7 + +#ifndef NO_ASN + #include <wolfssl/wolfcrypt/asn.h> +#endif +#include <wolfssl/wolfcrypt/asn_public.h> +#include <wolfssl/wolfcrypt/random.h> +#ifndef NO_AES + #include <wolfssl/wolfcrypt/aes.h> +#endif +#ifndef NO_DES3 + #include <wolfssl/wolfcrypt/des3.h> +#endif +#include <wolfssl/wolfcrypt/wc_encrypt.h> + +#ifdef __cplusplus + extern "C" { +#endif + +/* Max number of certificates that PKCS7 structure can parse */ +#ifndef MAX_PKCS7_CERTS +#ifdef OPENSSL_ALL + #define MAX_PKCS7_CERTS 15 +#else + #define MAX_PKCS7_CERTS 4 +#endif +#endif + +#ifndef MAX_ORI_TYPE_SZ + #define MAX_ORI_TYPE_SZ MAX_OID_SZ +#endif +#ifndef MAX_ORI_VALUE_SZ + #define MAX_ORI_VALUE_SZ 512 +#endif + +#ifndef MAX_SIGNED_ATTRIBS_SZ + #define MAX_SIGNED_ATTRIBS_SZ 7 +#endif + +#ifndef MAX_AUTH_ATTRIBS_SZ + #define MAX_AUTH_ATTRIBS_SZ 7 +#endif + +#ifndef MAX_UNAUTH_ATTRIBS_SZ + #define MAX_UNAUTH_ATTRIBS_SZ 7 +#endif + +/* bitmap flag for attributes */ +#define WOLFSSL_NO_ATTRIBUTES 0x1 +#define WOLFSSL_CONTENT_TYPE_ATTRIBUTE 0x2 +#define WOLFSSL_SIGNING_TIME_ATTRIBUTE 0x4 +#define WOLFSSL_MESSAGE_DIGEST_ATTRIBUTE 0x8 + +enum PKCS7_STATE { + WC_PKCS7_START = 0, + + /* decode encrypted */ + WC_PKCS7_STAGE2, + WC_PKCS7_STAGE3, + WC_PKCS7_STAGE4, + WC_PKCS7_STAGE5, + WC_PKCS7_STAGE6, + + WC_PKCS7_VERIFY_STAGE2, + WC_PKCS7_VERIFY_STAGE3, + WC_PKCS7_VERIFY_STAGE4, + WC_PKCS7_VERIFY_STAGE5, + WC_PKCS7_VERIFY_STAGE6, + WC_PKCS7_VERIFY_STAGE7, + + /* parse info set */ + WC_PKCS7_INFOSET_START, + WC_PKCS7_INFOSET_BER, + WC_PKCS7_INFOSET_STAGE1, + WC_PKCS7_INFOSET_STAGE2, + WC_PKCS7_INFOSET_END, + + /* decode enveloped data */ + WC_PKCS7_ENV_2, + WC_PKCS7_ENV_3, + WC_PKCS7_ENV_4, + WC_PKCS7_ENV_5, + + /* decode auth enveloped */ + WC_PKCS7_AUTHENV_2, + WC_PKCS7_AUTHENV_3, + WC_PKCS7_AUTHENV_4, + WC_PKCS7_AUTHENV_5, + WC_PKCS7_AUTHENV_6, + WC_PKCS7_AUTHENV_ATRB, + WC_PKCS7_AUTHENV_ATRBEND, + WC_PKCS7_AUTHENV_7, + + /* decryption state types */ + WC_PKCS7_DECRYPT_KTRI, + WC_PKCS7_DECRYPT_KTRI_2, + WC_PKCS7_DECRYPT_KTRI_3, + + + WC_PKCS7_DECRYPT_KARI, + WC_PKCS7_DECRYPT_KEKRI, + WC_PKCS7_DECRYPT_PWRI, + WC_PKCS7_DECRYPT_ORI, + + WC_PKCS7_DECRYPT_DONE + +}; + +enum Pkcs7_Misc { + PKCS7_NONCE_SZ = 16, + MAX_ENCRYPTED_KEY_SZ = 512, /* max enc. key size, RSA <= 4096 */ + MAX_CONTENT_KEY_LEN = 32, /* highest current cipher is AES-256-CBC */ + MAX_CONTENT_IV_SIZE = 16, /* highest current is AES128 */ +#ifndef NO_AES + MAX_CONTENT_BLOCK_LEN = WC_AES_BLOCK_SIZE, +#else + MAX_CONTENT_BLOCK_LEN = DES_BLOCK_SIZE, +#endif + MAX_RECIP_SZ = MAX_VERSION_SZ + + MAX_SEQ_SZ + WC_ASN_NAME_MAX + MAX_SN_SZ + + MAX_SEQ_SZ + MAX_ALGO_SZ + 1 + MAX_ENCRYPTED_KEY_SZ, + WOLF_ENUM_DUMMY_LAST_ELEMENT(Pkcs7_Misc) +}; + +enum Cms_Options { + CMS_SKID = 1, + CMS_ISSUER_AND_SERIAL_NUMBER = 2 +}; +#define DEGENERATE_SID 3 + +/* CMS/PKCS#7 RecipientInfo types, RFC 5652, Section 6.2 */ +enum Pkcs7_RecipientInfo_Types { + PKCS7_KTRI = 0, + PKCS7_KARI = 1, + PKCS7_KEKRI = 2, + PKCS7_PWRI = 3, + PKCS7_ORI = 4 +}; + +typedef struct PKCS7Attrib { + const byte* oid; + word32 oidSz; + const byte* value; + word32 valueSz; +} PKCS7Attrib; + + +typedef struct PKCS7DecodedAttrib { + struct PKCS7DecodedAttrib* next; + byte* oid; + word32 oidSz; + byte* value; + word32 valueSz; +} PKCS7DecodedAttrib; + +typedef struct PKCS7State PKCS7State; +typedef struct Pkcs7Cert Pkcs7Cert; +typedef struct Pkcs7EncodedRecip Pkcs7EncodedRecip; +typedef struct PKCS7SignerInfo PKCS7SignerInfo; +typedef struct wc_PKCS7 wc_PKCS7; +typedef struct wc_PKCS7 wc_PKCS7_SIGNED; + +#ifndef OPENSSL_COEXIST +#define PKCS7 wc_PKCS7 +#define PKCS7_SIGNED wc_PKCS7_SIGNED +#endif + +/* OtherRecipientInfo decrypt callback prototype */ +typedef int (*CallbackOriDecrypt)(wc_PKCS7* pkcs7, byte* oriType, word32 oriTypeSz, + byte* oriValue, word32 oriValueSz, + byte* decryptedKey, word32* decryptedKeySz, + void* ctx); +typedef int (*CallbackOriEncrypt)(wc_PKCS7* pkcs7, byte* cek, word32 cekSz, + byte* oriType, word32* oriTypeSz, + byte* oriValue, word32* oriValueSz, + void* ctx); +typedef int (*CallbackDecryptContent)(wc_PKCS7* pkcs7, int encryptOID, + byte* iv, int ivSz, byte* aad, word32 aadSz, + byte* authTag, word32 authTagSz, byte* in, + int inSz, byte* out, void* ctx); +typedef int (*CallbackWrapCEK)(wc_PKCS7* pkcs7, byte* cek, word32 cekSz, + byte* keyId, word32 keyIdSz, + byte* originKey, word32 originKeySz, + byte* out, word32 outSz, + int keyWrapAlgo, int type, int dir); + +/* Callbacks for supporting different stream cases */ +typedef int (*CallbackGetContent)(wc_PKCS7* pkcs7, byte** content, void* ctx); +typedef int (*CallbackStreamOut)(wc_PKCS7* pkcs7, const byte* output, + word32 outputSz, void* ctx); + +#if defined(HAVE_PKCS7_RSA_RAW_SIGN_CALLBACK) && !defined(NO_RSA) +/* RSA sign raw digest callback, user builds DigestInfo */ +typedef int (*CallbackRsaSignRawDigest)(wc_PKCS7* pkcs7, byte* digest, + word32 digestSz, byte* out, word32 outSz, + byte* privateKey, word32 privateKeySz, + int devId, int hashOID); +#endif + + +/* Public Structure Warning: + * Existing members must not be changed to maintain backwards compatibility! + */ +struct wc_PKCS7 { + WC_RNG* rng; + PKCS7Attrib* signedAttribs; + byte* content; /* inner content, not owner */ + byte* contentDynamic; /* content if constructed OCTET_STRING */ + byte* singleCert; /* recipient cert, DER, not owner */ + const byte* issuer; /* issuer name of singleCert */ + byte* privateKey; /* private key, DER, not owner */ + void* heap; /* heap hint for dynamic memory */ +#ifdef ASN_BER_TO_DER + byte* der; /* DER encoded version of message */ + word32 derSz; + byte indefDepth; + CallbackGetContent getContentCb; + CallbackStreamOut streamOutCb; + void* streamCtx; /* passed to getcontentCb and streamOutCb */ +#endif + WC_BITFIELD encodeStream:1; /* use BER when encoding */ + WC_BITFIELD noCerts:1; /* if certificates should be added into bundle + during creation */ + byte* cert[MAX_PKCS7_CERTS]; /* array of certs parsed from bundle */ + byte* verifyCert; /* cert from array used for verify */ + word32 verifyCertSz; + + /* Encrypted-data Content Type */ + byte* encryptionKey; /* block cipher encryption key */ + PKCS7Attrib* unprotectedAttribs; /* optional */ + PKCS7DecodedAttrib* decodedAttrib; /* linked list of decoded attribs */ + + /* Enveloped-data optional ukm, not owner */ + byte* ukm; + word32 ukmSz; + + word32 encryptionKeySz; /* size of key buffer, bytes */ + word32 unprotectedAttribsSz; + word32 contentSz; /* content size */ + word32 singleCertSz; /* size of recipient cert buffer, bytes */ + word32 issuerSz; /* length of issuer name */ + word32 issuerSnSz; /* length of serial number */ + + word32 publicKeySz; + word32 publicKeyOID; /* key OID (RSAk, ECDSAk, etc) */ + word32 privateKeySz; /* size of private key buffer, bytes */ + word32 signedAttribsSz; + int contentOID; /* PKCS#7 content type OID sum */ + int hashOID; + int encryptOID; /* key encryption algorithm OID */ + int keyWrapOID; /* key wrap algorithm OID */ + int keyAgreeOID; /* key agreement algorithm OID */ + int devId; /* device ID for HW based private key */ + byte issuerHash[KEYID_SIZE]; /* hash of all alt Names */ + byte issuerSn[MAX_SN_SZ]; /* singleCert's serial number */ + byte publicKey[MAX_RSA_INT_SZ + MAX_RSA_E_SZ]; /* MAX RSA key size (m + e)*/ + word32 certSz[MAX_PKCS7_CERTS]; + + /* flags - up to 16-bits */ + WC_BITFIELD isDynamic:1; + WC_BITFIELD noDegenerate:1; /* allow degenerate case in verify function */ + WC_BITFIELD detached:1; /* generate detached SignedData signature bundles */ + + byte contentType[MAX_OID_SZ]; /* custom contentType byte array */ + word32 contentTypeSz; /* size of contentType, bytes */ + + int sidType; /* SignerIdentifier type to use, of type + Pkcs7_SignerIdentifier_Types, default to + SID_ISSUER_AND_SERIAL_NUMBER */ + byte issuerSubjKeyId[KEYID_SIZE]; /* SubjectKeyIdentifier of singleCert */ + Pkcs7Cert* certList; /* certificates list for SignedData set */ + Pkcs7EncodedRecip* recipList; /* recipients list */ + byte* cek; /* content encryption key, random, dynamic */ + word32 cekSz; /* size of cek, bytes */ + byte* pass; /* password, for PWRI decryption */ + word32 passSz; /* size of pass, bytes */ + int kekEncryptOID; /* KEK encryption algorithm OID */ + + CallbackOriEncrypt oriEncryptCb; /* ORI encrypt callback */ + CallbackOriDecrypt oriDecryptCb; /* ORI decrypt callback */ + void* oriEncryptCtx; /* ORI encrypt user context ptr */ + void* oriDecryptCtx; /* ORI decrypt user context ptr */ + + PKCS7Attrib* authAttribs; /* authenticated attribs */ + word32 authAttribsSz; + PKCS7Attrib* unauthAttribs; /* unauthenticated attribs */ + word32 unauthAttribsSz; + +#ifndef NO_PKCS7_STREAM + PKCS7State* stream; +#endif + word32 state; + + word16 defaultSignedAttribs; /* set which default signed attribs */ + + byte version; /* 1 for RFC 2315 and 3 for RFC 4108 */ + PKCS7SignerInfo* signerInfo; + CallbackDecryptContent decryptionCb; + CallbackWrapCEK wrapCEKCb; + void* decryptionCtx; + + byte* signature; + byte* plainDigest; + byte* pkcs7Digest; + word32 signatureSz; + word32 plainDigestSz; + word32 pkcs7DigestSz; + +#ifdef WC_ASN_UNKNOWN_EXT_CB + wc_UnknownExtCallback unknownExtCallback; +#endif + +#if defined(HAVE_PKCS7_RSA_RAW_SIGN_CALLBACK) && !defined(NO_RSA) + CallbackRsaSignRawDigest rsaSignRawDigestCb; +#endif + + /* used by DecodeEnvelopedData with multiple encrypted contents */ + byte* cachedEncryptedContent; + word32 cachedEncryptedContentSz; + WC_BITFIELD contentCRLF:1; /* have content line endings been converted to CRLF */ + WC_BITFIELD contentIsPkcs7Type:1; /* eContent follows PKCS#7 RFC not CMS */ + WC_BITFIELD hashParamsAbsent:1; + + /* RFC 5280 section-4.2.1.2 lists a possible method for creating the SKID as + * a SHA1 hash of the public key, but leaves it open to other methods as + * long as it is a unique ID. This allows for setting a custom SKID when + * creating PKCS7 bundles*/ + byte* customSKID; + word16 customSKIDSz; + + +#if !defined(NO_DES3) || !defined(NO_AES) + union { + #ifndef NO_AES + Aes* aes; + #endif + #ifndef NO_DES3 + Des* des; + Des3* des3; + #endif + } decryptKey; +#endif + + /* !! NEW DATA MEMBERS MUST BE ADDED AT END !! */ +}; + +WOLFSSL_API wc_PKCS7* wc_PKCS7_New(void* heap, int devId); +#ifdef WC_ASN_UNKNOWN_EXT_CB + WOLFSSL_API void wc_PKCS7_SetUnknownExtCallback(wc_PKCS7* pkcs7, + wc_UnknownExtCallback cb); +#endif +WOLFSSL_API int wc_PKCS7_Init(wc_PKCS7* pkcs7, void* heap, int devId); +WOLFSSL_API int wc_PKCS7_InitWithCert(wc_PKCS7* pkcs7, byte* der, word32 derSz); +WOLFSSL_API int wc_PKCS7_AddCertificate(wc_PKCS7* pkcs7, byte* der, word32 derSz); +WOLFSSL_API void wc_PKCS7_Free(wc_PKCS7* pkcs7); + +WOLFSSL_API int wc_PKCS7_GetAttributeValue(wc_PKCS7* pkcs7, const byte* oid, + word32 oidSz, byte* out, word32* outSz); + +WOLFSSL_API int wc_PKCS7_SetSignerIdentifierType(wc_PKCS7* pkcs7, int type); +WOLFSSL_API int wc_PKCS7_SetContentType(wc_PKCS7* pkcs7, byte* contentType, + word32 sz); +WOLFSSL_API int wc_PKCS7_GetPadSize(word32 inputSz, word32 blockSz); +WOLFSSL_API int wc_PKCS7_PadData(byte* in, word32 inSz, byte* out, word32 outSz, + word32 blockSz); + +/* CMS/PKCS#7 Data */ +WOLFSSL_API int wc_PKCS7_EncodeData(wc_PKCS7* pkcs7, byte* output, + word32 outputSz); + +/* CMS/PKCS#7 SignedData */ +WOLFSSL_API int wc_PKCS7_SetCustomSKID(wc_PKCS7* pkcs7, const byte* in, + word16 inSz); +WOLFSSL_API int wc_PKCS7_SetDetached(wc_PKCS7* pkcs7, word16 flag); +WOLFSSL_API int wc_PKCS7_NoDefaultSignedAttribs(wc_PKCS7* pkcs7); +WOLFSSL_API int wc_PKCS7_SetDefaultSignedAttribs(wc_PKCS7* pkcs7, word16 flag); +WOLFSSL_API int wc_PKCS7_EncodeSignedData(wc_PKCS7* pkcs7, + byte* output, word32 outputSz); +WOLFSSL_API int wc_PKCS7_EncodeSignedData_ex(wc_PKCS7* pkcs7, const byte* hashBuf, + word32 hashSz, byte* outputHead, + word32* outputHeadSz, + byte* outputFoot, + word32* outputFootSz); +WOLFSSL_API void wc_PKCS7_AllowDegenerate(wc_PKCS7* pkcs7, word16 flag); +WOLFSSL_API int wc_PKCS7_VerifySignedData(wc_PKCS7* pkcs7, + byte* pkiMsg, word32 pkiMsgSz); +WOLFSSL_API int wc_PKCS7_VerifySignedData_ex(wc_PKCS7* pkcs7, const byte* hashBuf, + word32 hashSz, byte* pkiMsgHead, + word32 pkiMsgHeadSz, byte* pkiMsgFoot, + word32 pkiMsgFootSz); + +WOLFSSL_API int wc_PKCS7_GetSignerSID(wc_PKCS7* pkcs7, byte* out, word32* outSz); + +/* CMS single-shot API for Signed FirmwarePkgData */ +WOLFSSL_API int wc_PKCS7_EncodeSignedFPD(wc_PKCS7* pkcs7, byte* privateKey, + word32 privateKeySz, int signOID, + int hashOID, byte* content, + word32 contentSz, + PKCS7Attrib* signedAttribs, + word32 signedAttribsSz, byte* output, + word32 outputSz); +#ifndef NO_PKCS7_ENCRYPTED_DATA +/* CMS single-shot API for Signed Encrypted FirmwarePkgData */ +WOLFSSL_API int wc_PKCS7_EncodeSignedEncryptedFPD(wc_PKCS7* pkcs7, + byte* encryptKey, word32 encryptKeySz, + byte* privateKey, word32 privateKeySz, + int encryptOID, int signOID, + int hashOID, byte* content, + word32 contentSz, + PKCS7Attrib* unprotectedAttribs, + word32 unprotectedAttribsSz, + PKCS7Attrib* signedAttribs, + word32 signedAttribsSz, + byte* output, word32 outputSz); +#endif /* NO_PKCS7_ENCRYPTED_DATA */ +#if defined(HAVE_LIBZ) && !defined(NO_PKCS7_COMPRESSED_DATA) +/* CMS single-shot API for Signed Compressed FirmwarePkgData */ +WOLFSSL_API int wc_PKCS7_EncodeSignedCompressedFPD(wc_PKCS7* pkcs7, + byte* privateKey, word32 privateKeySz, + int signOID, int hashOID, + byte* content, word32 contentSz, + PKCS7Attrib* signedAttribs, + word32 signedAttribsSz, byte* output, + word32 outputSz); + +#ifndef NO_PKCS7_ENCRYPTED_DATA +/* CMS single-shot API for Signed Encrypted Compressed FirmwarePkgData */ +WOLFSSL_API int wc_PKCS7_EncodeSignedEncryptedCompressedFPD(wc_PKCS7* pkcs7, + byte* encryptKey, word32 encryptKeySz, + byte* privateKey, word32 privateKeySz, + int encryptOID, int signOID, + int hashOID, byte* content, + word32 contentSz, + PKCS7Attrib* unprotectedAttribs, + word32 unprotectedAttribsSz, + PKCS7Attrib* signedAttribs, + word32 signedAttribsSz, + byte* output, word32 outputSz); +#endif /* !NO_PKCS7_ENCRYPTED_DATA */ +#endif /* HAVE_LIBZ && !NO_PKCS7_COMPRESSED_DATA */ + +/* EnvelopedData and AuthEnvelopedData RecipientInfo functions */ +WOLFSSL_API int wc_PKCS7_AddRecipient_KTRI(wc_PKCS7* pkcs7, const byte* cert, + word32 certSz, int options); +WOLFSSL_API int wc_PKCS7_AddRecipient_KARI(wc_PKCS7* pkcs7, const byte* cert, + word32 certSz, int keyWrapOID, + int keyAgreeOID, byte* ukm, + word32 ukmSz, int options); + +WOLFSSL_API int wc_PKCS7_SetKey(wc_PKCS7* pkcs7, byte* key, word32 keySz); +WOLFSSL_API int wc_PKCS7_AddRecipient_KEKRI(wc_PKCS7* pkcs7, int keyWrapOID, + byte* kek, word32 kekSz, + byte* keyID, word32 keyIdSz, + void* timePtr, byte* otherOID, + word32 otherOIDSz, byte* other, + word32 otherSz, int options); + +WOLFSSL_API int wc_PKCS7_SetPassword(wc_PKCS7* pkcs7, byte* passwd, word32 pLen); +WOLFSSL_API int wc_PKCS7_AddRecipient_PWRI(wc_PKCS7* pkcs7, byte* passwd, + word32 pLen, byte* salt, + word32 saltSz, int kdfOID, + int prfOID, int iterations, + int kekEncryptOID, int options); +WOLFSSL_API int wc_PKCS7_SetOriEncryptCtx(wc_PKCS7* pkcs7, void* ctx); +WOLFSSL_API int wc_PKCS7_SetOriDecryptCtx(wc_PKCS7* pkcs7, void* ctx); +WOLFSSL_API int wc_PKCS7_SetOriDecryptCb(wc_PKCS7* pkcs7, CallbackOriDecrypt cb); +WOLFSSL_API int wc_PKCS7_AddRecipient_ORI(wc_PKCS7* pkcs7, CallbackOriEncrypt cb, + int options); +WOLFSSL_API int wc_PKCS7_SetWrapCEKCb(wc_PKCS7* pkcs7, + CallbackWrapCEK wrapCEKCb); + +#if defined(HAVE_PKCS7_RSA_RAW_SIGN_CALLBACK) && !defined(NO_RSA) +WOLFSSL_API int wc_PKCS7_SetRsaSignRawDigestCb(wc_PKCS7* pkcs7, + CallbackRsaSignRawDigest cb); +#endif + +/* CMS/PKCS#7 EnvelopedData */ +WOLFSSL_API int wc_PKCS7_EncodeEnvelopedData(wc_PKCS7* pkcs7, + byte* output, word32 outputSz); +WOLFSSL_API int wc_PKCS7_DecodeEnvelopedData(wc_PKCS7* pkcs7, byte* pkiMsg, + word32 pkiMsgSz, byte* output, + word32 outputSz); + +/* CMS/PKCS#7 AuthEnvelopedData */ +WOLFSSL_API int wc_PKCS7_EncodeAuthEnvelopedData(wc_PKCS7* pkcs7, + byte* output, word32 outputSz); +WOLFSSL_API int wc_PKCS7_DecodeAuthEnvelopedData(wc_PKCS7* pkcs7, byte* pkiMsg, + word32 pkiMsgSz, byte* output, + word32 outputSz); + +/* CMS/PKCS#7 EncryptedData */ +#ifndef NO_PKCS7_ENCRYPTED_DATA +WOLFSSL_API int wc_PKCS7_EncodeEncryptedData(wc_PKCS7* pkcs7, + byte* output, word32 outputSz); +WOLFSSL_API int wc_PKCS7_DecodeEncryptedData(wc_PKCS7* pkcs7, byte* pkiMsg, + word32 pkiMsgSz, byte* output, + word32 outputSz); +WOLFSSL_API int wc_PKCS7_SetDecodeEncryptedCb(wc_PKCS7* pkcs7, + CallbackDecryptContent decryptionCb); +WOLFSSL_API int wc_PKCS7_SetDecodeEncryptedCtx(wc_PKCS7* pkcs7, void* ctx); +#endif /* NO_PKCS7_ENCRYPTED_DATA */ + +/* CMS/PKCS#7 EncryptedKeyPackage */ +WOLFSSL_API int wc_PKCS7_DecodeEncryptedKeyPackage(wc_PKCS7 * pkcs7, + byte * pkiMsg, word32 pkiMsgSz, byte * output, word32 outputSz); + +/* stream and certs */ +WOLFSSL_LOCAL int wc_PKCS7_WriteOut(wc_PKCS7* pkcs7, byte* output, + const byte* input, word32 inputSz); +WOLFSSL_API int wc_PKCS7_SetStreamMode(wc_PKCS7* pkcs7, byte flag, + CallbackGetContent getContentCb, CallbackStreamOut streamOutCb, void* ctx); +WOLFSSL_API int wc_PKCS7_GetStreamMode(wc_PKCS7* pkcs7); +WOLFSSL_API int wc_PKCS7_SetNoCerts(wc_PKCS7* pkcs7, byte flag); +WOLFSSL_API int wc_PKCS7_GetNoCerts(wc_PKCS7* pkcs7); + +/* CMS/PKCS#7 CompressedData */ +#if defined(HAVE_LIBZ) && !defined(NO_PKCS7_COMPRESSED_DATA) +WOLFSSL_API int wc_PKCS7_EncodeCompressedData(wc_PKCS7* pkcs7, byte* output, + word32 outputSz); +WOLFSSL_API int wc_PKCS7_DecodeCompressedData(wc_PKCS7* pkcs7, byte* pkiMsg, + word32 pkiMsgSz, byte* output, + word32 outputSz); +#endif /* HAVE_LIBZ && !NO_PKCS7_COMPRESSED_DATA */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* HAVE_PKCS7 */ +#endif /* WOLF_CRYPT_PKCS7_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/poly1305.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/poly1305.h @@ -0,0 +1,210 @@ +/* poly1305.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/poly1305.h +*/ + +#ifndef WOLF_CRYPT_POLY1305_H +#define WOLF_CRYPT_POLY1305_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef HAVE_POLY1305 + +#ifdef __cplusplus + extern "C" { +#endif + +/* auto detect between 32bit / 64bit */ +#if defined(__SIZEOF_INT128__) && defined(__LP64__) +#define WC_HAS_SIZEOF_INT128_64BIT +#endif + +#if defined(_MSC_VER) && defined(_M_X64) +#define WC_HAS_MSVC_64BIT +#endif + +#if (defined(__GNUC__) && defined(__LP64__) && \ + ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)))) +#define WC_HAS_GCC_4_4_64BIT +#endif + +#ifdef WOLFSSL_X86_64_BUILD +#if defined(USE_INTEL_SPEEDUP) && !defined(NO_POLY1305_ASM) + #define USE_INTEL_POLY1305_SPEEDUP + #define HAVE_INTEL_AVX1 +#endif +#endif + +#if defined(USE_INTEL_POLY1305_SPEEDUP) +#elif (defined(WC_HAS_SIZEOF_INT128_64BIT) || defined(WC_HAS_MSVC_64BIT) || \ + defined(WC_HAS_GCC_4_4_64BIT)) && !defined(WOLFSSL_W64_WRAPPER_TEST) +#define POLY130564 +#else +#define POLY130532 +#endif + +enum { + POLY1305 = 7, + POLY1305_BLOCK_SIZE = 16, + POLY1305_DIGEST_SIZE = 16 +}; + +#define WC_POLY1305_PAD_SZ 16 +#define WC_POLY1305_MAC_SZ 16 + +/* Poly1305 state */ +typedef struct Poly1305 { +#ifdef USE_INTEL_POLY1305_SPEEDUP + word64 r[3]; + word64 h[3]; + word64 pad[2]; + word64 hh[20]; + word32 r1[8]; + word32 r2[8]; + word32 r3[8]; + word32 r4[8]; + word64 hm[16]; + unsigned char buffer[8*POLY1305_BLOCK_SIZE]; + size_t leftover; + unsigned char finished; + unsigned char started; +#elif defined(WOLFSSL_ARMASM) && defined(__aarch64__) + ALIGN128 word64 r64[2]; + ALIGN128 word32 r[5]; + ALIGN128 word32 r_2[5]; /* r^2 */ + ALIGN128 word32 r_4[5]; /* r^4 */ + ALIGN128 word32 h[5]; + word32 pad[4]; + word64 leftover; + unsigned char buffer[POLY1305_BLOCK_SIZE]; + unsigned char finished; +#elif defined(WOLFSSL_ARMASM) && !defined(WOLFSSL_ARMASM_THUMB2) && \ + !defined(WOLFSSL_ARMASM_NO_NEON) + /* NEON implementation for ARM32 */ + word32 r[4]; + word32 h[6]; + word32 pad[4]; + word32 leftover; + unsigned char buffer[4*POLY1305_BLOCK_SIZE]; + word32 r_21[10]; + word32 r_43[10]; +#elif defined(WOLFSSL_ARMASM) + /* ARM32 (non-NEON) and Thumb2 */ + word32 r[4]; + word32 h[5]; + word32 pad[4]; + word32 leftover; + unsigned char buffer[POLY1305_BLOCK_SIZE]; +#elif defined(WOLFSSL_RISCV_ASM) + word64 r[2]; +#ifdef WOLFSSL_RISCV_VECTOR + word64 r2[6]; +#endif + word64 h[3]; + word64 pad[2]; + size_t leftover; + unsigned char buffer[POLY1305_BLOCK_SIZE]; +#else +#if defined(POLY130564) + word64 r[3]; + word64 h[3]; + word64 pad[2]; +#else + word32 r[5]; + word32 h[5]; + word32 pad[4]; +#endif + size_t leftover; + unsigned char buffer[POLY1305_BLOCK_SIZE]; + unsigned char finished; +#endif /* WOLFSSL_ARMASM */ +} Poly1305; + +/* does init */ + +WOLFSSL_API int wc_Poly1305SetKey(Poly1305* poly1305, const byte* key, + word32 kySz); +WOLFSSL_API int wc_Poly1305Update(Poly1305* poly1305, const byte* m, word32 bytes); +WOLFSSL_API int wc_Poly1305Final(Poly1305* poly1305, byte* tag); + +/* AEAD Functions */ +WOLFSSL_API int wc_Poly1305_Pad(Poly1305* ctx, word32 lenToPad); +WOLFSSL_API int wc_Poly1305_EncodeSizes(Poly1305* ctx, word32 aadSz, + word32 dataSz); +#ifdef WORD64_AVAILABLE +WOLFSSL_API int wc_Poly1305_EncodeSizes64(Poly1305* ctx, word64 aadSz, + word64 dataSz); +#endif +WOLFSSL_API int wc_Poly1305_MAC(Poly1305* ctx, const byte* additional, + word32 addSz, const byte* input, word32 sz, byte* tag, word32 tagSz); + +#if defined(WOLFSSL_ARMASM) +#if defined(__aarch64__ ) +#define poly1305_blocks poly1305_blocks_aarch64 +#define poly1305_block poly1305_block_aarch64 + +void poly1305_blocks_aarch64(Poly1305* ctx, const unsigned char *m, + size_t bytes); +void poly1305_block_aarch64(Poly1305* ctx, const unsigned char *m); +#else +#if defined(WOLFSSL_ARMASM_THUMB2) +#define poly1305_blocks poly1305_blocks_thumb2 +#define poly1305_block poly1305_block_thumb2 + +void poly1305_blocks_thumb2(Poly1305* ctx, const unsigned char *m, + size_t bytes); +void poly1305_block_thumb2(Poly1305* ctx, const unsigned char *m); + +void poly1305_blocks_thumb2_16(Poly1305* ctx, const unsigned char* m, + word32 len, int notLast); +#else +#define poly1305_blocks poly1305_blocks_arm32 +#define poly1305_block poly1305_block_arm32 + +void poly1305_blocks_arm32(Poly1305* ctx, const unsigned char *m, size_t bytes); +void poly1305_block_arm32(Poly1305* ctx, const unsigned char *m); + +void poly1305_arm32_blocks(Poly1305* ctx, const unsigned char* m, word32 len); +void poly1305_arm32_blocks_16(Poly1305* ctx, const unsigned char* m, word32 len, + int notLast); +#endif +void poly1305_set_key(Poly1305* ctx, const byte* key); +void poly1305_final(Poly1305* ctx, byte* mac); +#endif +#endif /* WOLFSSL_ARMASM */ + +#if defined(WOLFSSL_RISCV_ASM) +#define poly1305_blocks poly1305_blocks_riscv64 +#define poly1305_block poly1305_block_riscv64 + +void poly1305_blocks_riscv64(Poly1305* ctx, const unsigned char *m, + size_t bytes); +void poly1305_block_riscv64(Poly1305* ctx, const unsigned char *m); +#endif + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* HAVE_POLY1305 */ +#endif /* WOLF_CRYPT_POLY1305_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/pwdbased.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/pwdbased.h @@ -0,0 +1,81 @@ +/* pwdbased.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/pwdbased.h +*/ + +#ifndef WOLF_CRYPT_PWDBASED_H +#define WOLF_CRYPT_PWDBASED_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifndef NO_PWDBASED + + +#ifdef __cplusplus + extern "C" { +#endif + +#if FIPS_VERSION3_GE(6,0,0) + extern const unsigned int wolfCrypt_FIPS_pbkdf_ro_sanity[2]; + WOLFSSL_LOCAL int wolfCrypt_FIPS_PBKDF_sanity(void); +#endif +/* + * hashType renamed to typeH to avoid shadowing global declaration here: + * wolfssl/wolfcrypt/asn.h line 173 in enum Oid_Types + */ +WOLFSSL_API int wc_PBKDF1_ex(byte* key, int keyLen, byte* iv, int ivLen, + const byte* passwd, int passwdLen, + const byte* salt, int saltLen, int iterations, + int hashType, void* heap); +WOLFSSL_API int wc_PBKDF1(byte* output, const byte* passwd, int pLen, + const byte* salt, int sLen, int iterations, int kLen, + int typeH); +WOLFSSL_API int wc_PBKDF2_ex(byte* output, const byte* passwd, int pLen, + const byte* salt, int sLen, int iterations, int kLen, + int typeH, void* heap, int devId); +WOLFSSL_API int wc_PBKDF2(byte* output, const byte* passwd, int pLen, + const byte* salt, int sLen, int iterations, int kLen, + int typeH); +WOLFSSL_API int wc_PKCS12_PBKDF(byte* output, const byte* passwd, int pLen, + const byte* salt, int sLen, int iterations, + int kLen, int typeH, int purpose); +WOLFSSL_API int wc_PKCS12_PBKDF_ex(byte* output, const byte* passwd,int passLen, + const byte* salt, int saltLen, int iterations, int kLen, + int hashType, int id, void* heap); + +#ifdef HAVE_SCRYPT +WOLFSSL_API int wc_scrypt(byte* output, const byte* passwd, int passLen, + const byte* salt, int saltLen, int cost, + int blockSize, int parallel, int dkLen); +WOLFSSL_API int wc_scrypt_ex(byte* output, const byte* passwd, int passLen, + const byte* salt, int saltLen, word32 iterations, + int blockSize, int parallel, int dkLen); +#endif + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* NO_PWDBASED */ +#endif /* WOLF_CRYPT_PWDBASED_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/random.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/random.h @@ -0,0 +1,295 @@ +/* random.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/random.h +*/ + + + +#ifndef WOLF_CRYPT_RANDOM_H +#define WOLF_CRYPT_RANDOM_H + +#include <wolfssl/wolfcrypt/types.h> + +#if FIPS_VERSION3_GE(2,0,0) + #include <wolfssl/wolfcrypt/fips.h> +#endif /* HAVE_FIPS_VERSION >= 2 */ + +#ifdef __cplusplus + extern "C" { +#endif + +#if FIPS_VERSION3_GE(6,0,0) + extern const unsigned int wolfCrypt_FIPS_drbg_ro_sanity[2]; + WOLFSSL_LOCAL int wolfCrypt_FIPS_DRBG_sanity(void); +#endif + + /* Maximum generate block length */ +#ifndef RNG_MAX_BLOCK_LEN + #ifdef HAVE_INTEL_QA + #define RNG_MAX_BLOCK_LEN (0xFFFFl) + #else + #define RNG_MAX_BLOCK_LEN (0x10000l) + #endif +#endif + +/* Size of the BRBG seed */ +#ifndef DRBG_SEED_LEN + #define DRBG_SEED_LEN (440/8) +#endif + + +#if !defined(CUSTOM_RAND_TYPE) + /* To maintain compatibility the default is byte */ + #define CUSTOM_RAND_TYPE byte +#endif + +/* make sure Hash DRBG is enabled, unless WC_NO_HASHDRBG is defined + or CUSTOM_RAND_GENERATE_BLOCK is defined */ +#if !defined(WC_NO_HASHDRBG) && !defined(CUSTOM_RAND_GENERATE_BLOCK) + #undef HAVE_HASHDRBG + #define HAVE_HASHDRBG + #ifndef WC_RESEED_INTERVAL + #define WC_RESEED_INTERVAL (1000000) + #endif +#endif + + +/* avoid redefinition of structs */ +#if !defined(HAVE_FIPS) || \ + (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)) + +/* RNG supports the following sources (in order): + * 1. CUSTOM_RAND_GENERATE_BLOCK: Defines name of function as RNG source and + * bypasses the options below. + * 2. HAVE_INTEL_RDRAND: Uses the Intel RDRAND if supported by CPU. + * 3. HAVE_HASHDRBG (requires SHA256 enabled): Uses SHA256 based P-RNG + * seeded via wc_GenerateSeed. This is the default source. + */ + + /* Seed source can be overridden by defining one of these: + CUSTOM_RAND_GENERATE_SEED + CUSTOM_RAND_GENERATE_SEED_OS + CUSTOM_RAND_GENERATE */ + + +#if defined(CUSTOM_RAND_GENERATE_BLOCK) + /* To use define the following: + * #define CUSTOM_RAND_GENERATE_BLOCK myRngFunc + * extern int myRngFunc(byte* output, word32 sz); + */ + #if defined(CUSTOM_RAND_GENERATE_BLOCK) && defined(WOLFSSL_KCAPI) + #undef CUSTOM_RAND_GENERATE_BLOCK + #define CUSTOM_RAND_GENERATE_BLOCK wc_hwrng_generate_block + WOLFSSL_LOCAL int wc_hwrng_generate_block(byte *output, word32 sz); + #endif +#elif defined(HAVE_HASHDRBG) + #ifdef NO_SHA256 + #error "Hash DRBG requires SHA-256." + #endif /* NO_SHA256 */ + #include <wolfssl/wolfcrypt/sha256.h> +#elif defined(HAVE_WNR) + /* allow whitewood as direct RNG source using wc_GenerateSeed directly */ +#elif defined(HAVE_INTEL_RDRAND) + /* Intel RDRAND or RDSEED */ +#elif defined(WOLF_CRYPTO_CB) + /* Requires registered Crypto Callback to service RNG, with devId set */ +#elif !defined(WC_NO_RNG) + #error No RNG source defined! +#endif + +#ifdef HAVE_WNR + #include <wnr.h> +#endif + +#ifdef WOLFSSL_ASYNC_CRYPT + #include <wolfssl/wolfcrypt/async.h> +#endif + + +#if defined(USE_WINDOWS_API) + #if defined(_WIN64) + typedef unsigned __int64 ProviderHandle; + /* type HCRYPTPROV, avoid #include <windows.h> */ + #else + typedef unsigned long ProviderHandle; + #endif + + #ifdef WIN_REUSE_CRYPT_HANDLE + /* called from wolfCrypt_Init() and wolfCrypt_Cleanup() */ + WOLFSSL_LOCAL int wc_WinCryptHandleInit(void); + WOLFSSL_LOCAL void wc_WinCryptHandleCleanup(void); + #endif +#endif + +#ifndef WC_RNG_TYPE_DEFINED /* guard on redeclaration */ + typedef struct OS_Seed OS_Seed; + typedef struct WC_RNG WC_RNG; + #ifdef WC_RNG_SEED_CB + typedef int (*wc_RngSeed_Cb)(OS_Seed* os, byte* seed, word32 sz); + #endif + #define WC_RNG_TYPE_DEFINED +#endif + +/* OS specific seeder */ +struct OS_Seed { + #if defined(USE_WINDOWS_API) + ProviderHandle handle; + #else + int fd; + #endif + #if defined(WOLF_CRYPTO_CB) + int devId; + #endif +}; + +#ifdef HAVE_HASHDRBG +struct DRBG_internal { + #ifdef WORD64_AVAILABLE + word64 reseedCtr; + #else + word32 reseedCtr; + #endif + byte V[DRBG_SEED_LEN]; + byte C[DRBG_SEED_LEN]; + void* heap; +#if defined(WOLFSSL_ASYNC_CRYPT) || defined(WOLF_CRYPTO_CB) + int devId; +#endif +#ifdef WOLFSSL_SMALL_STACK_CACHE + wc_Sha256 sha256; +#endif +}; +#endif + +/* RNG context */ +struct WC_RNG { + struct OS_Seed seed; + void* heap; +#ifdef HAVE_HASHDRBG + /* Hash-based Deterministic Random Bit Generator */ + struct DRBG* drbg; +#if defined(WOLFSSL_NO_MALLOC) && !defined(WOLFSSL_STATIC_MEMORY) + struct DRBG_internal drbg_data; +#endif + byte status; +#endif +#if defined(HAVE_GETPID) && !defined(WOLFSSL_NO_GETPID) + pid_t pid; +#endif +#ifdef WOLFSSL_ASYNC_CRYPT + WC_ASYNC_DEV asyncDev; +#endif +#if defined(WOLFSSL_ASYNC_CRYPT) || defined(WOLF_CRYPTO_CB) + int devId; +#endif +}; + +#endif /* NO FIPS or have FIPS v2*/ + +/* NO_OLD_RNGNAME removes RNG struct name to prevent possible type conflicts, + * can't be used with CTaoCrypt FIPS */ +#if !defined(NO_OLD_RNGNAME) && !defined(HAVE_FIPS) + #define RNG WC_RNG +#endif + +WOLFSSL_API int wc_GenerateSeed(OS_Seed* os, byte* seed, word32 sz); + + +#ifdef HAVE_WNR + /* Whitewood netRandom client library */ + WOLFSSL_API int wc_InitNetRandom(const char*, wnr_hmac_key, int); + WOLFSSL_API int wc_FreeNetRandom(void); +#endif /* HAVE_WNR */ + + +WOLFSSL_ABI WOLFSSL_API WC_RNG* wc_rng_new(byte* nonce, word32 nonceSz, + void* heap); +WOLFSSL_API int wc_rng_new_ex(WC_RNG **rng, byte* nonce, word32 nonceSz, + void* heap, int devId); +WOLFSSL_ABI WOLFSSL_API void wc_rng_free(WC_RNG* rng); + + +#ifndef WC_NO_RNG +WOLFSSL_ABI WOLFSSL_API int wc_InitRng(WC_RNG* rng); +WOLFSSL_API int wc_InitRng_ex(WC_RNG* rng, void* heap, int devId); +WOLFSSL_API int wc_InitRngNonce(WC_RNG* rng, byte* nonce, word32 nonceSz); +WOLFSSL_API int wc_InitRngNonce_ex(WC_RNG* rng, byte* nonce, word32 nonceSz, + void* heap, int devId); +WOLFSSL_ABI WOLFSSL_API int wc_RNG_GenerateBlock(WC_RNG* rng, byte* b, word32 sz); +WOLFSSL_API int wc_RNG_GenerateByte(WC_RNG* rng, byte* b); +WOLFSSL_API int wc_FreeRng(WC_RNG* rng); +#else +#include <wolfssl/wolfcrypt/error-crypt.h> +#define wc_InitRng(rng) NOT_COMPILED_IN +#define wc_InitRng_ex(rng, h, d) NOT_COMPILED_IN +#define wc_InitRngNonce(rng, n, s) NOT_COMPILED_IN +#define wc_InitRngNonce_ex(rng, n, s, h, d) NOT_COMPILED_IN +#if defined(__ghs__) || defined(WC_NO_RNG_SIMPLE) +/* some older compilers do not like macro function in expression */ +#define wc_RNG_GenerateBlock(rng, b, s) NOT_COMPILED_IN +#else +#define wc_RNG_GenerateBlock(rng, b, s) ({(void)rng; (void)b; (void)s; NOT_COMPILED_IN;}) +#endif +#define wc_RNG_GenerateByte(rng, b) NOT_COMPILED_IN +#define wc_FreeRng(rng) (void)NOT_COMPILED_IN +#endif + +#ifdef WC_RNG_SEED_CB + WOLFSSL_API int wc_SetSeed_Cb(wc_RngSeed_Cb cb); +#endif + +#ifdef HAVE_HASHDRBG + WOLFSSL_API int wc_RNG_DRBG_Reseed(WC_RNG* rng, const byte* entropy, + word32 entropySz); + WOLFSSL_API int wc_RNG_TestSeed(const byte* seed, word32 seedSz); + WOLFSSL_API int wc_RNG_HealthTest(int reseed, + const byte* entropyA, word32 entropyASz, + const byte* entropyB, word32 entropyBSz, + byte* output, word32 outputSz); + WOLFSSL_API int wc_RNG_HealthTest_ex(int reseed, + const byte* nonce, word32 nonceSz, + const byte* entropyA, word32 entropyASz, + const byte* entropyB, word32 entropyBSz, + byte* output, word32 outputSz, + void* heap, int devId); +#endif /* HAVE_HASHDRBG */ + +#ifdef HAVE_ENTROPY_MEMUSE +/* Maximum entropy bits that can be produced. */ +#define MAX_ENTROPY_BITS 256 + +/* For generating data for assessment. */ +WOLFSSL_API int wc_Entropy_GetRawEntropy(unsigned char* raw, int cnt); +WOLFSSL_API int wc_Entropy_Get(int bits, unsigned char* entropy, word32 len); +WOLFSSL_API int wc_Entropy_OnDemandTest(void); + +WOLFSSL_LOCAL int Entropy_Init(void); +WOLFSSL_LOCAL void Entropy_Final(void); +#endif + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLF_CRYPT_RANDOM_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/rc2.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/rc2.h @@ -0,0 +1,68 @@ +/* rc2.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifndef WOLF_CRYPT_RC2_H +#define WOLF_CRYPT_RC2_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef WC_RC2 + +#ifdef __cplusplus + extern "C" { +#endif + +enum { + RC2_MAX_KEY_SIZE = 128, /* max effective key size, octets */ + RC2_BLOCK_SIZE = 8 +}; + +/* RC2 encryption and decryption */ +typedef struct Rc2 { + ALIGN16 word16 key[RC2_MAX_KEY_SIZE/2]; + ALIGN16 word32 reg[RC2_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */ + ALIGN16 word32 tmp[RC2_BLOCK_SIZE / sizeof(word32)]; /* same */ + word32 keylen; /* key length, octets */ + word32 bits; /* effective key length, bits */ +} Rc2; + +WOLFSSL_API int wc_Rc2SetKey(Rc2* rc2, const byte* key, word32 length, + const byte* iv, word32 bits); +WOLFSSL_API int wc_Rc2SetIV(Rc2* rc2, const byte* iv); + +/* RC2-ECB */ +WOLFSSL_API int wc_Rc2EcbEncrypt(Rc2* rc2, byte* out, + const byte* in, word32 sz); +WOLFSSL_API int wc_Rc2EcbDecrypt(Rc2* rc2, byte* out, + const byte* in, word32 sz); + +/* RC2-CBC */ +WOLFSSL_API int wc_Rc2CbcEncrypt(Rc2* rc2, byte* out, + const byte* in, word32 sz); +WOLFSSL_API int wc_Rc2CbcDecrypt(Rc2* rc2, byte* out, + const byte* in, word32 sz); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WC_RC2 */ +#endif /* WOLF_CRYPT_RC2_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/ripemd.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/ripemd.h @@ -0,0 +1,67 @@ +/* ripemd.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/ripemd.h +*/ + +#ifndef WOLF_CRYPT_RIPEMD_H +#define WOLF_CRYPT_RIPEMD_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef WOLFSSL_RIPEMD + +#ifdef __cplusplus + extern "C" { +#endif + + +/* in bytes */ +enum { + RIPEMD = 3, /* hash type unique */ + RIPEMD_BLOCK_SIZE = 64, + RIPEMD_DIGEST_SIZE = 20, + RIPEMD_PAD_SIZE = 56 +}; + + +/* RipeMd 160 digest */ +typedef struct RipeMd { + word32 buffLen; /* in bytes */ + word32 loLen; /* length in bytes */ + word32 hiLen; /* length in bytes */ + word32 digest[RIPEMD_DIGEST_SIZE / sizeof(word32)]; + word32 buffer[RIPEMD_BLOCK_SIZE / sizeof(word32)]; +} RipeMd; + + +WOLFSSL_API int wc_InitRipeMd(RipeMd* ripemd); +WOLFSSL_API int wc_RipeMdUpdate(RipeMd* ripemd, const byte* data, word32 len); +WOLFSSL_API int wc_RipeMdFinal(RipeMd* ripemd, byte* hash); + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_RIPEMD */ +#endif /* WOLF_CRYPT_RIPEMD_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/rsa.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/rsa.h @@ -0,0 +1,495 @@ +/* rsa.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/rsa.h +*/ + +/* + +DESCRIPTION +This library provides the interface to the RSA. +RSA keys can be used to encrypt, decrypt, sign and verify data. + +*/ +#ifndef WOLF_CRYPT_RSA_H +#define WOLF_CRYPT_RSA_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifndef NO_RSA + + +/* RSA default exponent */ +#ifndef WC_RSA_EXPONENT + #define WC_RSA_EXPONENT 65537L +#endif + +#if defined(WC_RSA_NONBLOCK) + /* enable support for fast math based non-blocking exptmod */ + /* this splits the RSA function into many smaller operations */ + #ifndef USE_FAST_MATH + #error RSA non-blocking mode only supported using fast math + #endif + #ifndef TFM_TIMING_RESISTANT + #error RSA non-blocking mode only supported with timing resistance enabled + #endif + + /* RSA bounds check is not supported with RSA non-blocking mode */ + #undef NO_RSA_BOUNDS_CHECK + #define NO_RSA_BOUNDS_CHECK +#endif + +#include <wolfssl/wolfcrypt/wolfmath.h> +#include <wolfssl/wolfcrypt/random.h> + +#if defined(HAVE_FIPS) && \ + defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2) +#include <wolfssl/wolfcrypt/fips.h> +#endif + +/* header file needed for OAEP padding */ +#include <wolfssl/wolfcrypt/hash.h> + +#ifdef WOLFSSL_XILINX_CRYPT +#ifdef WOLFSSL_XILINX_CRYPT_VERSAL +#include <wolfssl/wolfcrypt/port/xilinx/xil-versal-glue.h> +#else +#include <xsecure_rsa.h> +#endif +#endif + +#if defined(WOLFSSL_CRYPTOCELL) + #include <wolfssl/wolfcrypt/port/arm/cryptoCell.h> +#endif + +#if defined(WOLFSSL_KCAPI_RSA) + #include <wolfssl/wolfcrypt/port/kcapi/kcapi_rsa.h> +#endif + +#if defined(WOLFSSL_DEVCRYPTO_RSA) + #include <wolfssl/wolfcrypt/port/devcrypto/wc_devcrypto.h> +#endif + +#if defined(WOLFSSL_RENESAS_FSPSM) + #include <wolfssl/wolfcrypt/port/renesas/renesas-fspsm-crypt.h> +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +#if FIPS_VERSION3_GE(6,0,0) + extern const unsigned int wolfCrypt_FIPS_rsa_ro_sanity[2]; + WOLFSSL_LOCAL int wolfCrypt_FIPS_RSA_sanity(void); +#endif + +#ifndef RSA_MIN_SIZE + #if defined(HAVE_WOLFENGINE) || defined(HAVE_WOLFPROVIDER) + #define RSA_MIN_SIZE 1024 + #else + #define RSA_MIN_SIZE 2048 + #endif +#endif + +#ifndef RSA_MAX_SIZE + #ifdef USE_FAST_MATH + /* FP implementation support numbers up to FP_MAX_BITS / 2 bits. */ + #define RSA_MAX_SIZE (FP_MAX_BITS / 2) + #if defined(WOLFSSL_MYSQL_COMPATIBLE) && RSA_MAX_SIZE < 8192 + #error "MySQL needs FP_MAX_BITS at least at 16384" + #endif + #elif defined(WOLFSSL_SP_MATH_ALL) || defined(WOLFSSL_SP_MATH) + /* SP implementation supports numbers of SP_INT_BITS bits. */ + #define RSA_MAX_SIZE (((SP_INT_BITS + 7) / 8) * 8) + #if defined(WOLFSSL_MYSQL_COMPATIBLE) && RSA_MAX_SIZE < 8192 + #error "MySQL needs SP_INT_BITS at least at 8192" + #endif + #else + #ifdef WOLFSSL_MYSQL_COMPATIBLE + /* Integer maths is dynamic but we only go up to 8192 bits. */ + #define RSA_MAX_SIZE 8192 + #else + /* Integer maths is dynamic but we only go up to 4096 bits. */ + #define RSA_MAX_SIZE 4096 + #endif + #endif +#endif + +/* avoid redefinition of structs */ +#if !defined(HAVE_FIPS) || \ + (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)) + +#ifdef WOLFSSL_ASYNC_CRYPT + #include <wolfssl/wolfcrypt/async.h> + #ifdef WOLFSSL_CERT_GEN + #include <wolfssl/wolfcrypt/asn.h> + #endif +#endif + +#if FIPS_VERSION3_GE(6,0,0) + #define WC_RSA_FIPS_GEN_MIN 2048 + #define WC_RSA_FIPS_SIG_MIN (WC_RSA_FIPS_GEN_MIN/8) +#endif + +enum { + RSA_PUBLIC = 0, + RSA_PRIVATE = 1, + + RSA_TYPE_UNKNOWN = -1, + RSA_PUBLIC_ENCRYPT = 0, + RSA_PUBLIC_DECRYPT = 1, + RSA_PRIVATE_ENCRYPT = 2, + RSA_PRIVATE_DECRYPT = 3, + + RSA_BLOCK_TYPE_1 = 1, + RSA_BLOCK_TYPE_2 = 2, + + RSA_MIN_PAD_SZ = 11, /* separator + 0 + pad value + 8 pads */ + + RSA_PSS_PAD_SZ = 8, + RSA_PSS_SALT_MAX_SZ = 62, + +#ifdef OPENSSL_EXTRA + WC_RSA_PKCS1_PADDING_SIZE = 11, + WC_RSA_PKCS1_OAEP_PADDING_SIZE = 42, /* (2 * hashlen(SHA-1)) + 2 */ + #ifndef OPENSSL_COEXIST + #define RSA_PKCS1_PADDING_SIZE WC_RSA_PKCS1_PADDING_SIZE + #define RSA_PKCS1_OAEP_PADDING_SIZE WC_RSA_PKCS1_OAEP_PADDING_SIZE + #endif +#endif +#ifdef WC_RSA_PSS + RSA_PSS_PAD_TERM = 0xBC, +#endif + + RSA_PSS_SALT_LEN_DEFAULT = -1, +#ifdef WOLFSSL_PSS_SALT_LEN_DISCOVER + RSA_PSS_SALT_LEN_DISCOVER = -2, +#endif + +#ifdef WOLF_PRIVATE_KEY_ID + RSA_MAX_ID_LEN = 32, + RSA_MAX_LABEL_LEN = 32, +#endif + + WOLF_ENUM_DUMMY_LAST_ELEMENT(RSA) +}; + +#ifdef WC_RSA_NONBLOCK +typedef struct RsaNb { + exptModNb_t exptmod; /* non-block expt_mod */ + mp_int tmp; +} RsaNb; +#endif + +/* RSA */ +struct RsaKey { + mp_int n, e; +#ifndef WOLFSSL_RSA_PUBLIC_ONLY + mp_int d, p, q; +#if defined(WOLFSSL_KEY_GEN) || defined(OPENSSL_EXTRA) || !defined(RSA_LOW_MEM) + mp_int dP, dQ, u; +#endif +#endif + void* heap; /* for user memory overrides */ + byte* data; /* temp buffer for async RSA */ + int type; /* public or private */ + int state; + word32 dataLen; +#ifdef WC_RSA_BLINDING + WC_RNG* rng; /* for PrivateDecrypt blinding */ +#endif +#ifdef WOLFSSL_SE050 + word32 keyId; + byte keyIdSet; +#endif +#ifdef WOLF_CRYPTO_CB + void* devCtx; + int devId; +#endif +#ifdef WOLFSSL_ASYNC_CRYPT + WC_ASYNC_DEV asyncDev; + #ifdef WOLFSSL_CERT_GEN + CertSignCtx certSignCtx; /* context info for cert sign (MakeSignature) */ + #endif +#endif /* WOLFSSL_ASYNC_CRYPT */ +#ifdef WOLFSSL_XILINX_CRYPT + word32 pubExp; /* to keep values in scope they are here in struct */ + byte* mod; +#if defined(WOLFSSL_XILINX_CRYPT_VERSAL) + int mSz; + wc_Xsecure xSec; +#else + XSecure_Rsa xRsa; +#endif +#endif +#if defined(WOLFSSL_KCAPI_RSA) + struct kcapi_handle* handle; +#endif +#ifdef WOLF_PRIVATE_KEY_ID + byte id[RSA_MAX_ID_LEN]; + int idLen; + char label[RSA_MAX_LABEL_LEN]; + int labelLen; +#endif +#if !defined(WOLFSSL_NO_MALLOC) && (defined(WOLFSSL_ASYNC_CRYPT) || \ + (!defined(WOLFSSL_RSA_VERIFY_ONLY) && !defined(WOLFSSL_RSA_VERIFY_INLINE))) + byte dataIsAlloc; +#endif +#ifdef WC_RSA_NONBLOCK + RsaNb* nb; +#endif +#ifdef WOLFSSL_AFALG_XILINX_RSA + int alFd; + int rdFd; +#endif +#if defined(WOLFSSL_CRYPTOCELL) + rsa_context_t ctx; +#endif +#if defined(WOLFSSL_CAAM) + word32 blackKey; +#endif +#if defined(WOLFSSL_DEVCRYPTO_RSA) + WC_CRYPTODEV ctx; +#endif +#if defined(WOLFSSL_RENESAS_FSPSM) + FSPSM_RSA_CTX ctx; +#endif +}; + +#ifndef WC_RSAKEY_TYPE_DEFINED + typedef struct RsaKey RsaKey; + #define WC_RSAKEY_TYPE_DEFINED +#endif + +#endif /* HAVE_FIPS */ + +#if defined(WOLF_CRYPTO_CB) && defined(WOLF_CRYPTO_CB_RSA_PAD) +struct RsaPadding { + byte pad_value; + int pad_type; + enum wc_HashType hash; + int mgf; + byte* label; + word32 labelSz; + int saltLen; + int unpadded; +}; +typedef struct RsaPadding RsaPadding; +#endif + +WOLFSSL_API int wc_InitRsaKey(RsaKey* key, void* heap); +WOLFSSL_API int wc_InitRsaKey_ex(RsaKey* key, void* heap, int devId); +WOLFSSL_API int wc_FreeRsaKey(RsaKey* key); +#ifndef WC_NO_CONSTRUCTORS +WOLFSSL_API RsaKey* wc_NewRsaKey(void* heap, int devId, int *result_code); +WOLFSSL_API int wc_DeleteRsaKey(RsaKey* key, RsaKey** key_p); +#endif + +#ifdef WOLF_PRIVATE_KEY_ID +WOLFSSL_API int wc_InitRsaKey_Id(RsaKey* key, unsigned char* id, int len, + void* heap, int devId); +WOLFSSL_API int wc_InitRsaKey_Label(RsaKey* key, const char* label, void* heap, + int devId); +#endif +WOLFSSL_API int wc_CheckRsaKey(RsaKey* key); +#ifdef WOLFSSL_XILINX_CRYPT +WOLFSSL_LOCAL int wc_InitRsaHw(RsaKey* key); +#endif /* WOLFSSL_XILINX_CRYPT */ +#ifdef WOLFSSL_SE050 +WOLFSSL_API int wc_RsaUseKeyId(RsaKey* key, word32 keyId, word32 flags); +WOLFSSL_API int wc_RsaGetKeyId(RsaKey* key, word32* keyId); +#endif /* WOLFSSL_SE050 */ + +WOLFSSL_API int wc_RsaFunction(const byte* in, word32 inLen, byte* out, + word32* outLen, int type, RsaKey* key, WC_RNG* rng); + +WOLFSSL_API int wc_RsaPublicEncrypt(const byte* in, word32 inLen, byte* out, + word32 outLen, RsaKey* key, WC_RNG* rng); +WOLFSSL_API int wc_RsaPrivateDecryptInline(byte* in, word32 inLen, byte** out, + RsaKey* key); +WOLFSSL_API int wc_RsaPrivateDecrypt(const byte* in, word32 inLen, byte* out, + word32 outLen, RsaKey* key); +WOLFSSL_API int wc_RsaSSL_Sign(const byte* in, word32 inLen, byte* out, + word32 outLen, RsaKey* key, WC_RNG* rng); +WOLFSSL_API int wc_RsaPSS_Sign(const byte* in, word32 inLen, byte* out, + word32 outLen, enum wc_HashType hash, int mgf, + RsaKey* key, WC_RNG* rng); +WOLFSSL_API int wc_RsaPSS_Sign_ex(const byte* in, word32 inLen, byte* out, + word32 outLen, enum wc_HashType hash, + int mgf, int saltLen, RsaKey* key, + WC_RNG* rng); +WOLFSSL_API int wc_RsaSSL_VerifyInline(byte* in, word32 inLen, byte** out, + RsaKey* key); +WOLFSSL_API int wc_RsaSSL_Verify(const byte* in, word32 inLen, byte* out, + word32 outLen, RsaKey* key); +WOLFSSL_API int wc_RsaSSL_Verify_ex(const byte* in, word32 inLen, byte* out, + word32 outLen, RsaKey* key, int pad_type); +WOLFSSL_API int wc_RsaSSL_Verify_ex2(const byte* in, word32 inLen, byte* out, + word32 outLen, RsaKey* key, int pad_type, + enum wc_HashType hash); +WOLFSSL_API int wc_RsaPSS_VerifyInline(byte* in, word32 inLen, byte** out, + enum wc_HashType hash, int mgf, + RsaKey* key); +WOLFSSL_API int wc_RsaPSS_VerifyInline_ex(byte* in, word32 inLen, byte** out, + enum wc_HashType hash, int mgf, + int saltLen, RsaKey* key); +WOLFSSL_API int wc_RsaPSS_Verify(byte* in, word32 inLen, byte* out, + word32 outLen, enum wc_HashType hash, int mgf, + RsaKey* key); +WOLFSSL_API int wc_RsaPSS_Verify_ex(byte* in, word32 inLen, byte* out, + word32 outLen, enum wc_HashType hash, + int mgf, int saltLen, RsaKey* key); +WOLFSSL_API int wc_RsaPSS_CheckPadding(const byte* in, word32 inLen, byte* sig, + word32 sigSz, + enum wc_HashType hashType); +WOLFSSL_API int wc_RsaPSS_CheckPadding_ex(const byte* in, word32 inLen, + byte* sig, word32 sigSz, + enum wc_HashType hashType, + int saltLen, int bits); +WOLFSSL_API int wc_RsaPSS_CheckPadding_ex2(const byte* in, word32 inLen, + byte* sig, word32 sigSz, + enum wc_HashType hashType, + int saltLen, int bits, void* heap); +WOLFSSL_API int wc_RsaPSS_VerifyCheckInline(byte* in, word32 inLen, byte** out, + const byte* digest, word32 digentLen, + enum wc_HashType hash, int mgf, + RsaKey* key); +WOLFSSL_API int wc_RsaPSS_VerifyCheck(byte* in, word32 inLen, + byte* out, word32 outLen, + const byte* digest, word32 digestLen, + enum wc_HashType hash, int mgf, + RsaKey* key); + +WOLFSSL_API int wc_RsaEncryptSize(const RsaKey* key); + +#if !defined(HAVE_FIPS) || \ + (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)) +/* to avoid asn duplicate symbols @wc_fips */ +WOLFSSL_API int wc_RsaPrivateKeyDecode(const byte* input, word32* inOutIdx, + RsaKey* key, word32 inSz); +#if !defined(HAVE_FIPS) || \ + (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2)) +WOLFSSL_API int wc_RsaPrivateKeyValidate(const byte* input, word32* inOutIdx, + int* keySz, word32 inSz); +#endif +WOLFSSL_API int wc_RsaPublicKeyDecode(const byte* input, word32* inOutIdx, + RsaKey* key, word32 inSz); +WOLFSSL_API int wc_RsaPublicKeyDecodeRaw(const byte* n, word32 nSz, + const byte* e, word32 eSz, RsaKey* key); +#if defined(WOLFSSL_KEY_GEN) || defined(OPENSSL_EXTRA) || \ + defined(WOLFSSL_KCAPI_RSA) || defined(WOLFSSL_SE050) + WOLFSSL_API int wc_RsaKeyToDer(RsaKey* key, byte* output, word32 inLen); +#endif + +#ifdef WC_RSA_BLINDING + WOLFSSL_API int wc_RsaSetRNG(RsaKey* key, WC_RNG* rng); +#endif +#ifdef WC_RSA_NONBLOCK + WOLFSSL_API int wc_RsaSetNonBlock(RsaKey* key, RsaNb* nb); + #ifdef WC_RSA_NONBLOCK_TIME + WOLFSSL_API int wc_RsaSetNonBlockTime(RsaKey* key, word32 maxBlockUs, + word32 cpuMHz); + #endif +#endif + +/* + choice of padding added after fips, so not available when using fips RSA + */ + +/* Mask Generation Function Identifiers */ +#define WC_MGF1NONE 0 +#define WC_MGF1SHA1 26 +#define WC_MGF1SHA224 4 +#define WC_MGF1SHA256 1 +#define WC_MGF1SHA384 2 +#define WC_MGF1SHA512 3 +#define WC_MGF1SHA512_224 5 +#define WC_MGF1SHA512_256 6 + +/* Padding types */ +#define WC_RSA_PKCSV15_PAD 0 +#define WC_RSA_OAEP_PAD 1 +#define WC_RSA_PSS_PAD 2 +#define WC_RSA_NO_PAD 3 + +WOLFSSL_API int wc_RsaPublicEncrypt_ex(const byte* in, word32 inLen, byte* out, + word32 outLen, RsaKey* key, WC_RNG* rng, int type, + enum wc_HashType hash, int mgf, byte* label, word32 labelSz); +WOLFSSL_API int wc_RsaPrivateDecrypt_ex(const byte* in, word32 inLen, + byte* out, word32 outLen, RsaKey* key, int type, + enum wc_HashType hash, int mgf, byte* label, word32 labelSz); +WOLFSSL_API int wc_RsaPrivateDecryptInline_ex(byte* in, word32 inLen, + byte** out, RsaKey* key, int type, enum wc_HashType hash, + int mgf, byte* label, word32 labelSz); +#if defined(WC_RSA_DIRECT) || defined(WC_RSA_NO_PADDING) || defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) +WOLFSSL_API int wc_RsaDirect(byte* in, word32 inLen, byte* out, word32* outSz, + RsaKey* key, int type, WC_RNG* rng); +#endif + +#endif /* HAVE_FIPS */ + +WOLFSSL_API int wc_RsaFlattenPublicKey(RsaKey* key, byte* e, word32* eSz, + byte* n, word32* nSz); +WOLFSSL_API int wc_RsaExportKey(RsaKey* key, + byte* e, word32* eSz, + byte* n, word32* nSz, + byte* d, word32* dSz, + byte* p, word32* pSz, + byte* q, word32* qSz); + +#ifdef WOLFSSL_KEY_GEN + WOLFSSL_API int wc_MakeRsaKey(RsaKey* key, int size, long e, WC_RNG* rng); + WOLFSSL_API int wc_CheckProbablePrime_ex(const byte* p, word32 pSz, + const byte* q, word32 qSz, + const byte* e, word32 eSz, + int nlen, int* isPrime, WC_RNG* rng); + WOLFSSL_API int wc_CheckProbablePrime(const byte* p, word32 pSz, + const byte* q, word32 qSz, + const byte* e, word32 eSz, + int nlen, int* isPrime); +#endif + +WOLFSSL_API int wc_RsaPad_ex(const byte* input, word32 inputLen, + byte* pkcsBlock, word32 pkcsBlockLen, byte padValue, + WC_RNG* rng, int padType, enum wc_HashType hType, int mgf, + byte* optLabel, word32 labelLen, int saltLen, int bits, void* heap); +WOLFSSL_API int wc_RsaUnPad_ex(byte* pkcsBlock, word32 pkcsBlockLen, + byte** out, byte padValue, int padType, enum wc_HashType hType, int mgf, + byte* optLabel, word32 labelLen, int saltLen, int bits, void* heap); + +WOLFSSL_LOCAL int wc_hash2mgf(enum wc_HashType hType); +WOLFSSL_LOCAL int RsaFunctionCheckIn(const byte* in, word32 inLen, RsaKey* key, + int checkSmallCt); + +WOLFSSL_API int wc_RsaPrivateKeyDecodeRaw(const byte* n, word32 nSz, + const byte* e, word32 eSz, const byte* d, word32 dSz, + const byte* u, word32 uSz, const byte* p, word32 pSz, + const byte* q, word32 qSz, const byte* dP, word32 dPSz, + const byte* dQ, word32 dQSz, RsaKey* key); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* NO_RSA */ +#endif /* WOLF_CRYPT_RSA_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/sakke.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/sakke.h @@ -0,0 +1,228 @@ +/* sakke.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/sakke.h +*/ + + +#ifndef WOLF_CRYPT_SAKKE_H +#define WOLF_CRYPT_SAKKE_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef WOLFCRYPT_HAVE_SAKKE + +#include <wolfssl/wolfcrypt/wolfmath.h> +#include <wolfssl/wolfcrypt/ecc.h> +#include <wolfssl/wolfcrypt/hash.h> +#include <wolfssl/wolfcrypt/hmac.h> + +#define WOLFCRYPT_SAKKE_KMS +#define WOLFCRYPT_SAKKE_CLIENT + +#define SAKKE_ID_MAX_SIZE 128 + +/* Maximum number of loops of attempting to generate a key. */ +#ifndef SAKKE_MAX_GEN_COUNT + #define SAKKE_MAX_GEN_COUNT 10 +#endif + + +/** MP integer in projective form. */ +typedef ecc_point mp_proj; + +/** SAKKE ECC parameters in usable format. */ +typedef struct SakkeKeyParams { + /** Prime as an MP integer. */ + mp_int prime; + /** Q (order) as an MP integer. */ + mp_int q; + /** G (pairing base) as an MP integer. */ + mp_int g; + /** Temporary MP integer used during operations. */ + mp_int a; + /** Base point for elliptic curve operations as an ECC point. */ + ecc_point* base; + + /** Bit indicate prime is set as an MP integer in SAKKE key. */ + WC_BITFIELD havePrime:1; + /** Bit indicates q (order) is set as an MP integer in SAKKE key. */ + WC_BITFIELD haveQ:1; + /** Bit indicates g (pairing base) is set as an MP integer in SAKKE key. */ + WC_BITFIELD haveG:1; + /** Bit indicates a is set as an MP integer in SAKKE key. */ + WC_BITFIELD haveA:1; + /** Bit indicates base point is set as an ECC point in SAKKE key. */ + WC_BITFIELD haveBase:1; +} SakkeKeyParams; + +/** Temporary values to use in SAKKE calculations. */ +typedef struct SakkeKeyTmp { + /** Temporary MP integer used during operations. */ + mp_int m1; + /** Temporary MP integer used during operations. */ + mp_int m2; + +#ifdef WOLFCRYPT_SAKKE_CLIENT + /** Temporary elliptic curve point for use in operations. */ + ecc_point* p1; + /** Temporary elliptic curve point for use in operations. */ + ecc_point* p2; + /** Temporary MP projective integer for use in operations. */ + mp_proj* p3; +#endif +} SakkeKeyTmp; + +#ifdef WOLFCRYPT_SAKKE_CLIENT +/** SAKKE data for the intermediate point I. */ +typedef struct SakkeKeyPointI { + /** Temporary elliptic curve point for use in operations. */ + ecc_point* i; + /** Table associated with point I. */ + byte* table; + /** Length of table */ + word32 tableLen; + /** Identity associated with point I. */ + byte id[SAKKE_ID_MAX_SIZE]; + /** Size of identity associated with point I. */ + word16 idSz; +} SakkeKeyPointI; + +/** SAKKE data for the Receiver Secret Key (RSK). */ +typedef struct SakkeKeyRsk { + /** RSK (Receiver Secret Key). */ + ecc_point* rsk; + /** Table associated with point I. */ + byte* table; + /** Length of table */ + word32 tableLen; + /** Indicates whether an RSK value has been set. */ + WC_BITFIELD set:1; +} SakkeKeyRsk; +#endif + +/** + * SAKKE key. + */ +typedef struct SakkeKey { + /** ECC key to perform elliptic curve operations with. */ + ecc_key ecc; + + /** ECC parameter in forms that can be used in computation. */ + SakkeKeyParams params; + /** Temporaries used during calculations. */ + SakkeKeyTmp tmp; + +#ifdef WOLFCRYPT_SAKKE_CLIENT + /** Data relating to the RSK (Receiver Secret Key). */ + SakkeKeyRsk rsk; + /** Identity to perform operations with. */ + byte id[SAKKE_ID_MAX_SIZE]; + /** Size of identity in bytes. */ + word16 idSz; + + /** Data relating to the intermediate point I. */ + SakkeKeyPointI i; + + /** Generic hash algorithm object. */ + wc_HashAlg hash; + /** Temporary buffer for use in operations. */ + byte data[(MAX_ECC_BYTES * 2) + 1]; +#endif + + /** Heap hint for dynamic memory allocation. */ + void* heap; + + /** Bit indicates Z, public key, is in montgomery form. */ + WC_BITFIELD zMont:1; + /** Bit indicate MP integers have been initialized. */ + WC_BITFIELD mpInit:1; +} SakkeKey; + +#ifdef __cplusplus + extern "C" { +#endif + +WOLFSSL_API int wc_InitSakkeKey(SakkeKey* key, void* heap, int devId); +WOLFSSL_API int wc_InitSakkeKey_ex(SakkeKey* key, int keySize, int curveId, + void* heap, int devId); +WOLFSSL_API void wc_FreeSakkeKey(SakkeKey* key); + +WOLFSSL_API int wc_MakeSakkeKey(SakkeKey* key, WC_RNG* rng); +WOLFSSL_API int wc_MakeSakkePublicKey(SakkeKey* key, ecc_point* pub); + +WOLFSSL_API int wc_MakeSakkeRsk(SakkeKey* key, const byte* id, word16 idSz, + ecc_point* rsk); +WOLFSSL_API int wc_ValidateSakkeRsk(SakkeKey* key, const byte* id, word16 idSz, + ecc_point* rsk, int* valid); + +WOLFSSL_API int wc_ExportSakkeKey(SakkeKey* key, byte* data, word32* sz); +WOLFSSL_API int wc_ImportSakkeKey(SakkeKey* key, const byte* data, word32 sz); +WOLFSSL_API int wc_ExportSakkePrivateKey(SakkeKey* key, byte* data, word32* sz); +WOLFSSL_API int wc_ImportSakkePrivateKey(SakkeKey* key, const byte* data, + word32 sz); +WOLFSSL_API int wc_ExportSakkePublicKey(SakkeKey* key, byte* data, + word32* sz, int raw); +WOLFSSL_API int wc_ImportSakkePublicKey(SakkeKey* key, const byte* data, + word32 sz, int trusted); + +WOLFSSL_API int wc_EncodeSakkeRsk(const SakkeKey* key, ecc_point* rsk, + byte* out, word32* sz, int raw); +WOLFSSL_API int wc_DecodeSakkeRsk(const SakkeKey* key, const byte* data, + word32 sz, ecc_point* rsk); +WOLFSSL_API int wc_ImportSakkeRsk(SakkeKey* key, const byte* data, word32 sz); + +WOLFSSL_API int wc_GetSakkeAuthSize(SakkeKey* key, word16* authSz); + +WOLFSSL_API int wc_SetSakkeIdentity(SakkeKey* key, const byte* id, word16 idSz); +WOLFSSL_API int wc_MakeSakkePointI(SakkeKey* key, const byte* id, word16 idSz); +WOLFSSL_API int wc_GetSakkePointI(SakkeKey* key, byte* data, word32* sz); +WOLFSSL_API int wc_SetSakkePointI(SakkeKey* key, const byte* id, word16 idSz, + const byte* data, word32 sz); +WOLFSSL_API int wc_GenerateSakkePointITable(SakkeKey* key, byte* table, + word32* len); +WOLFSSL_API int wc_SetSakkePointITable(SakkeKey* key, byte* table, word32 len); +WOLFSSL_API int wc_ClearSakkePointITable(SakkeKey* key); + +WOLFSSL_API int wc_MakeSakkeEncapsulatedSSV(SakkeKey* key, + enum wc_HashType hashType, byte* ssv, word16 ssvSz, byte* auth, + word16* authSz); + +WOLFSSL_API int wc_GenerateSakkeRskTable(const SakkeKey* key, + const ecc_point* rsk, byte* table, word32* len); +WOLFSSL_API int wc_SetSakkeRsk(SakkeKey* key, const ecc_point* rsk, byte* table, + word32 len); + +WOLFSSL_API int wc_GenerateSakkeSSV(SakkeKey* key, WC_RNG* rng, byte* ssv, + word16* ssvSz); +WOLFSSL_API int wc_DeriveSakkeSSV(SakkeKey* key, enum wc_HashType hashType, + byte* ssv, word16 ssvSz, const byte* auth, + word16 authSz); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFCRYPT_HAVE_SAKKE */ + +#endif /* WOLF_CRYPT_SAKKE_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/settings.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/settings.h @@ -0,0 +1,4525 @@ +/* settings.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* + * Note, this file should not be edited to activate/deactivate features. + * + * Instead, add/edit user_settings.h, and compile with -DWOLFSSL_USER_SETTINGS + * + * or + * + * ./configure CFLAGS="-DFEATURE_FLAG_TO_DEFINE -UFEATURE_FLAG_TO_CLEAR [...]" + * + * To build using a custom configuration method, define WOLFSSL_CUSTOM_CONFIG + * + * For more information see: + * + * https://www.wolfssl.com/how-do-i-manage-the-build-configuration-of-wolfssl/ + */ + + +/* Place OS specific preprocessor flags, defines, includes here, will be + included into every file because types.h includes it */ + + +#ifndef WOLF_CRYPT_SETTINGS_H +#define WOLF_CRYPT_SETTINGS_H + +#ifdef __cplusplus + extern "C" { +#endif + +#if defined(TEST_LIBWOLFSSL_SOURCES_INCLUSION_SEQUENCE) && \ + defined(BUILDING_WOLFSSL) && !defined(LIBWOLFSSL_SOURCES_H) && \ + !defined(LIBWOLFSSL_SOURCES_ASM_H) + #error settings.h included before libwolfssl_sources[_asm].h. +#endif + +/* WOLFSSL_USE_OPTIONS_H directs wolfSSL to include options.h on behalf of + * application code, rather than the application including it directly. This is + * not defined when compiling wolfSSL library objects, which are configured + * through CFLAGS. + */ +#if (defined(EXTERNAL_OPTS_OPENVPN) || defined(WOLFSSL_USE_OPTIONS_H)) && \ + !defined(WOLFSSL_NO_OPTIONS_H) + #include <wolfssl/options.h> +#endif + +/* Uncomment next line if using IPHONE */ +/* #define IPHONE */ + +/* Uncomment next line if using ThreadX */ +/* #define THREADX */ + +/* Uncomment next line if using Micrium uC/OS-III */ +/* #define MICRIUM */ + +/* Uncomment next line if using Deos RTOS*/ +/* #define WOLFSSL_DEOS*/ + +/* Uncomment next line if using Mbed */ +/* #define MBED */ + +/* Uncomment next line if using Microchip PIC32 ethernet starter kit */ +/* #define MICROCHIP_PIC32 */ + +/* Uncomment next line if using Microchip TCP/IP stack, version 5 */ +/* #define MICROCHIP_TCPIP_V5 */ + +/* Uncomment next line if using Microchip TCP/IP stack, version 6 or later */ +/* #define MICROCHIP_TCPIP */ + +/* Uncomment next line if using above Microchip TCP/IP defines with BSD API */ +/* #define MICROCHIP_TCPIP_BSD_API */ + +/* Uncomment next line if using PIC32MZ Crypto Engine */ +/* #define WOLFSSL_MICROCHIP_PIC32MZ */ + +/* Uncomment next line if using FreeRTOS */ +/* #define FREERTOS */ + +/* Uncomment next line if using FreeRTOS+ TCP */ +/* #define FREERTOS_TCP */ + +/* Uncomment next line if using FreeRTOS Windows Simulator */ +/* #define FREERTOS_WINSIM */ + +/* Uncomment next line if using RTIP */ +/* #define EBSNET */ + +/* Uncomment next line if using lwip */ +/* #define WOLFSSL_LWIP */ + +/* Uncomment next line if building wolfSSL for a game console */ +/* #define WOLFSSL_GAME_BUILD */ + +/* Uncomment next line if building wolfSSL for LSR */ +/* #define WOLFSSL_LSR */ + +/* Uncomment next line if building for Freescale Classic MQX version 5.0 */ +/* #define FREESCALE_MQX_5_0 */ + +/* Uncomment next line if building for Freescale Classic MQX version 4.0 */ +/* #define FREESCALE_MQX_4_0 */ + +/* Uncomment next line if building for Freescale Classic MQX/RTCS/MFS */ +/* #define FREESCALE_MQX */ + +/* Uncomment next line if building for Freescale KSDK MQX/RTCS/MFS */ +/* #define FREESCALE_KSDK_MQX */ + +/* Uncomment next line if building for Freescale KSDK Bare Metal */ +/* #define FREESCALE_KSDK_BM */ + +/* Uncomment next line if building for Freescale KSDK FreeRTOS, */ +/* (old name FREESCALE_FREE_RTOS) */ +/* #define FREESCALE_KSDK_FREERTOS */ + +/* Uncomment next line if using STM32F2 */ +/* #define WOLFSSL_STM32F2 */ + +/* Uncomment next line if using STM32F4 */ +/* #define WOLFSSL_STM32F4 */ + +/* Uncomment next line if using STM32FL */ +/* #define WOLFSSL_STM32FL */ + +/* Uncomment next line if using STM32F7 */ +/* #define WOLFSSL_STM32F7 */ + +/* Uncomment next line if using QL SEP settings */ +/* #define WOLFSSL_QL */ + +/* Uncomment next line if building for EROAD */ +/* #define WOLFSSL_EROAD */ + +/* Uncomment next line if building for IAR EWARM */ +/* #define WOLFSSL_IAR_ARM */ + +/* Uncomment next line if building for Rowley CrossWorks ARM */ +/* #define WOLFSSL_ROWLEY_ARM */ + +/* Uncomment next line if using TI-RTOS settings */ +/* #define WOLFSSL_TIRTOS */ + +/* Uncomment next line if building with PicoTCP */ +/* #define WOLFSSL_PICOTCP */ + +/* Uncomment next line if building for PicoTCP demo bundle */ +/* #define WOLFSSL_PICOTCP_DEMO */ + +/* Uncomment next line if building for uITRON4 */ +/* #define WOLFSSL_uITRON4 */ + +/* Uncomment next line if building for uT-Kernel */ +/* #define WOLFSSL_uTKERNEL2 */ + +/* Uncomment next line if using Max Strength build */ +/* #define WOLFSSL_MAX_STRENGTH */ + +/* Uncomment next line if building for VxWorks */ +/* #define WOLFSSL_VXWORKS */ + +/* Uncomment next line if building for Nordic nRF5x platform */ +/* #define WOLFSSL_NRF5x */ + +/* Uncomment next line to enable deprecated less secure static DH suites */ +/* #define WOLFSSL_STATIC_DH */ + +/* Uncomment next line to enable deprecated less secure static RSA suites */ +/* #define WOLFSSL_STATIC_RSA */ + +/* Uncomment next line if building for ARDUINO */ +/* Uncomment both lines if building for ARDUINO on INTEL_GALILEO */ +/* #define WOLFSSL_ARDUINO */ +/* #define INTEL_GALILEO */ + +/* Uncomment next line to enable asynchronous crypto WC_PENDING_E */ +/* #define WOLFSSL_ASYNC_CRYPT */ + +/* Uncomment next line if building for uTasker */ +/* #define WOLFSSL_UTASKER */ + +/* Uncomment next line if building for embOS */ +/* #define WOLFSSL_EMBOS */ + +/* Uncomment next line if building for RIOT-OS */ +/* #define WOLFSSL_RIOT_OS */ + +/* Uncomment next line if building for using XILINX hardened crypto */ +/* #define WOLFSSL_XILINX_CRYPT */ + +/* Uncomment next line if building for using XILINX */ +/* #define WOLFSSL_XILINX */ + +/* Uncomment next line if building for WICED Studio. */ +/* #define WOLFSSL_WICED */ + +/* Uncomment next line if building for Nucleus 1.2 */ +/* #define WOLFSSL_NUCLEUS_1_2 */ + +/* Uncomment next line if building for Nucleus Plus 2.3 */ +/* #define NUCLEUS_PLUS_2_3 */ + +/* Uncomment next line if building for using Apache mynewt */ +/* #define WOLFSSL_APACHE_MYNEWT */ + +/* For Espressif chips see example user_settings.h + * + * https://github.com/wolfSSL/wolfssl/blob/master/IDE/Espressif/ESP-IDF/user_settings.h + */ + +/* Uncomment next line if building for using ESP-IDF */ +/* #define WOLFSSL_ESPIDF */ + +/* Uncomment next line if using Espressif ESP32-WROOM-32 */ +/* #define WOLFSSL_ESP32 */ + +/* Uncomment next line if using Espressif ESP32-WROOM-32SE */ +/* #define WOLFSSL_ESPWROOM32SE */ + +/* Uncomment next line if using ARM CRYPTOCELL*/ +/* #define WOLFSSL_CRYPTOCELL */ + +/* Uncomment next line if using RENESAS TSIP */ +/* #define WOLFSSL_RENESAS_TSIP */ + +/* Uncomment next line if using RENESAS RX64N */ +/* #define WOLFSSL_RENESAS_RX65N */ + +/* Uncomment next line if using RENESAS SCE Protected Mode */ +/* #define WOLFSSL_RENESAS_SCEPROTECT */ + +/* Uncomment next line if using RENESAS RA6M4 */ +/* #define WOLFSSL_RENESAS_RA6M4 */ + +/* Uncomment next line if using RENESAS RX64 hardware acceleration */ +/* #define WOLFSSL_RENESAS_RX64_HASH */ + +/* Uncomment next line if using Solaris OS*/ +/* #define WOLFSSL_SOLARIS */ + +/* Uncomment next line if building for Linux Kernel Module */ +/* #define WOLFSSL_LINUXKM */ + +/* Uncomment next line if building for devkitPro */ +/* #define DEVKITPRO */ + +/* Uncomment next line if building for Dolphin Emulator */ +/* #define DOLPHIN_EMULATOR */ + +/* Uncomment next line if building for WOLFSSL_NDS */ +/* #define WOLFSSL_NDS */ + +/* Uncomment next line if using MAXQ1065 */ +/* #define WOLFSSL_MAXQ1065 */ + +/* Uncomment next line if using MAXQ108x */ +/* #define WOLFSSL_MAXQ108X */ + +/* Uncomment next line if using Raspberry Pi RP2040 or RP2350 */ +/* #define WOLFSSL_RPIPICO */ + +/* Check PLATFORMIO first, as it may define other known environments. */ +#ifdef PLATFORMIO + #ifdef ESP_PLATFORM + /* Turn on the wolfSSL ESPIDF flag for the PlatformIO ESP-IDF detect */ + #undef WOLFSSL_ESPIDF + #define WOLFSSL_ESPIDF + #endif /* ESP_PLATFORM */ + + /* Ensure all PlatformIO boards have the wolfSSL user_setting.h enabled. */ + #ifndef WOLFSSL_USER_SETTINGS + #define WOLFSSL_USER_SETTINGS + #endif /* WOLFSSL_USER_SETTINGS */ + + /* Similar to Arduino we have limited build control, so suppress warning */ + #undef WOLFSSL_IGNORE_FILE_WARN + #define WOLFSSL_IGNORE_FILE_WARN +#endif + +#if defined(ARDUINO) + /* Due to limited build control, we'll ignore file warnings. */ + /* See https://github.com/arduino/arduino-cli/issues/631 */ + #undef WOLFSSL_IGNORE_FILE_WARN + #define WOLFSSL_IGNORE_FILE_WARN + + /* we don't have the luxury of compiler options, so manually define */ + #if defined(__arm__) + #undef WOLFSSL_ARDUINO + #define WOLFSSL_ARDUINO + /* ESP32? */ + #endif + + #undef FREERTOS + #ifndef WOLFSSL_USER_SETTINGS + #define WOLFSSL_USER_SETTINGS + #endif /* WOLFSSL_USER_SETTINGS */ + + /* board-specific */ + #if defined(__AVR__) + #define WOLFSSL_USER_IO + #define WOLFSSL_NO_SOCK + #define NO_WRITEV + #elif defined(__arm__) + #define WOLFSSL_NO_SOCK + #define NO_WRITEV + #elif defined(ESP32) || defined(ESP8266) + /* assume sockets available */ + #else + #define WOLFSSL_NO_SOCK + #endif +#endif + +#if !defined(WOLFSSL_CUSTOM_CONFIG) && \ + ((defined(BUILDING_WOLFSSL) && defined(WOLFSSL_USE_OPTIONS_H)) || \ + (defined(BUILDING_WOLFSSL) && defined(WOLFSSL_OPTIONS_H) && \ + !defined(EXTERNAL_OPTS_OPENVPN))) + #warning wolfssl/options.h included in compiled wolfssl library object. +#endif + +#ifdef WOLFSSL_USER_SETTINGS + #include "user_settings.h" +#elif defined(USE_HAL_DRIVER) && !defined(HAVE_CONFIG_H) + /* STM Configuration File (generated by CubeMX) */ + #include "wolfSSL.I-CUBE-wolfSSL_conf.h" +#elif defined(NUCLEUS_PLUS_2_3) + /* NOTE: cyassl_nucleus_defs.h is akin to user_settings.h */ + #include "nucleus.h" + #include "os/networking/ssl/lite/cyassl_nucleus_defs.h" +#elif !defined(BUILDING_WOLFSSL) && !defined(WOLFSSL_OPTIONS_H) && \ + !defined(WOLFSSL_NO_OPTIONS_H) && !defined(WOLFSSL_CUSTOM_CONFIG) + /* This warning indicates that wolfSSL features may not have been properly + * configured before other wolfSSL headers were included. If you are using + * an alternative configuration method -- e.g. custom header, or CFLAGS in + * an application build -- then your application can avoid this warning by + * defining WOLFSSL_NO_OPTIONS_H or WOLFSSL_CUSTOM_CONFIG as appropriate. + */ + #warning "No configuration for wolfSSL detected, check header order" +#endif + +#include <wolfssl/wolfcrypt/visibility.h> + +/*------------------------------------------------------------*/ +#if defined(WOLFSSL_FIPS_READY) || defined(WOLFSSL_FIPS_DEV) + #undef HAVE_FIPS_VERSION_MAJOR + #define HAVE_FIPS_VERSION_MAJOR 7 /* always one more than major version */ + /* of most recent FIPS certificate */ + #undef HAVE_FIPS_VERSION + #define HAVE_FIPS_VERSION HAVE_FIPS_VERSION_MAJOR + #undef HAVE_FIPS_VERSION_MINOR + #define HAVE_FIPS_VERSION_MINOR 0 /* always 0 */ + #undef HAVE_FIPS_VERSION_PATCH + #define HAVE_FIPS_VERSION_PATCH 0 /* always 0 */ +#endif + +#define WOLFSSL_MAKE_FIPS_VERSION3(major, minor, patch) \ + (((major) * 65536) + ((minor) * 256) + (patch)) +#define WOLFSSL_MAKE_FIPS_VERSION(major, minor) \ + WOLFSSL_MAKE_FIPS_VERSION3(major, minor, 0) + +#if !defined(HAVE_FIPS) + #define WOLFSSL_FIPS_VERSION_CODE WOLFSSL_MAKE_FIPS_VERSION3(0,0,0) + #define WOLFSSL_FIPS_VERSION2_CODE WOLFSSL_FIPS_VERSION_CODE +#elif !defined(HAVE_FIPS_VERSION) + #define WOLFSSL_FIPS_VERSION_CODE WOLFSSL_MAKE_FIPS_VERSION3(1,0,0) + #define WOLFSSL_FIPS_VERSION2_CODE WOLFSSL_FIPS_VERSION_CODE +#elif !defined(HAVE_FIPS_VERSION_MINOR) + #define WOLFSSL_FIPS_VERSION_CODE \ + WOLFSSL_MAKE_FIPS_VERSION3(HAVE_FIPS_VERSION,0,0) + #define WOLFSSL_FIPS_VERSION2_CODE WOLFSSL_FIPS_VERSION_CODE +#elif !defined(HAVE_FIPS_VERSION_PATCH) + #define WOLFSSL_FIPS_VERSION_CODE \ + WOLFSSL_MAKE_FIPS_VERSION3(HAVE_FIPS_VERSION, \ + HAVE_FIPS_VERSION_MINOR, 0) + #define WOLFSSL_FIPS_VERSION2_CODE WOLFSSL_FIPS_VERSION_CODE +#else + #define WOLFSSL_FIPS_VERSION_CODE \ + WOLFSSL_MAKE_FIPS_VERSION3(HAVE_FIPS_VERSION,\ + HAVE_FIPS_VERSION_MINOR, \ + HAVE_FIPS_VERSION_PATCH) + #define WOLFSSL_FIPS_VERSION2_CODE \ + WOLFSSL_MAKE_FIPS_VERSION3(HAVE_FIPS_VERSION,\ + HAVE_FIPS_VERSION_MINOR, \ + 0) +#endif + +#define FIPS_VERSION_LT(major,minor) \ + (WOLFSSL_FIPS_VERSION2_CODE < WOLFSSL_MAKE_FIPS_VERSION(major,minor)) +#define FIPS_VERSION_LE(major,minor) \ + (WOLFSSL_FIPS_VERSION2_CODE <= WOLFSSL_MAKE_FIPS_VERSION(major,minor)) +#define FIPS_VERSION_EQ(major,minor) \ + (WOLFSSL_FIPS_VERSION2_CODE == WOLFSSL_MAKE_FIPS_VERSION(major,minor)) +#define FIPS_VERSION_GE(major,minor) \ + (WOLFSSL_FIPS_VERSION2_CODE >= WOLFSSL_MAKE_FIPS_VERSION(major,minor)) +#define FIPS_VERSION_GT(major,minor) \ + (WOLFSSL_FIPS_VERSION2_CODE > WOLFSSL_MAKE_FIPS_VERSION(major,minor)) + +#define FIPS_VERSION3_LT(major,minor,patch) \ + (WOLFSSL_FIPS_VERSION_CODE < WOLFSSL_MAKE_FIPS_VERSION3(major,minor,patch)) +#define FIPS_VERSION3_LE(major,minor,patch) \ + (WOLFSSL_FIPS_VERSION_CODE <= WOLFSSL_MAKE_FIPS_VERSION3(major,minor,patch)) +#define FIPS_VERSION3_EQ(major,minor,patch) \ + (WOLFSSL_FIPS_VERSION_CODE == WOLFSSL_MAKE_FIPS_VERSION3(major,minor,patch)) +#define FIPS_VERSION3_GE(major,minor,patch) \ + (WOLFSSL_FIPS_VERSION_CODE >= WOLFSSL_MAKE_FIPS_VERSION3(major,minor,patch)) +#define FIPS_VERSION3_GT(major,minor,patch) \ + (WOLFSSL_FIPS_VERSION_CODE > WOLFSSL_MAKE_FIPS_VERSION3(major,minor,patch)) +/*------------------------------------------------------------*/ + + +/* make sure old RNG name is used with CTaoCrypt FIPS */ +#ifdef HAVE_FIPS + #if FIPS_VERSION_LT(2,0) + #define WC_RNG RNG + #else + /* RNG needs to be defined to WC_RNG anytime another library on the + * system or other set of headers included by wolfSSL already defines + * RNG. Examples are: + * wolfEngine, wolfProvider and potentially other use-cases */ + #if !defined(RNG) && !defined(NO_OLD_RNGNAME) + #define RNG WC_RNG + #endif + #endif + /* blinding adds API not available yet in FIPS mode */ + #undef WC_RSA_BLINDING +#endif + +/* old FIPS has only AES_BLOCK_SIZE. */ +#if !defined(NO_AES) && (defined(HAVE_SELFTEST) || \ + (defined(HAVE_FIPS) && FIPS_VERSION3_LT(6,0,0))) + #define WC_AES_BLOCK_SIZE AES_BLOCK_SIZE +#endif /* !NO_AES && (HAVE_SELFTEST || FIPS_VERSION3_LT(6,0,0)) */ + +#ifdef WOLFSSL_HARDEN_TLS + #if WOLFSSL_HARDEN_TLS != 112 && WOLFSSL_HARDEN_TLS != 128 + #error "WOLFSSL_HARDEN_TLS must be defined either to 112 or 128 bits of security." + #endif +#endif + +/* Important build-time configuration messages may be saved. + * Enable DEBUG_WOLFSSL and see wolfSSL_Init() for display. */ +#define LIBWOLFSSL_CMAKE_OUTPUT "" + +/* --------------------------------------------------------------------------- + * Dual Algorithm Certificate Required Features. + * --------------------------------------------------------------------------- + */ +#ifdef WOLFSSL_DUAL_ALG_CERTS + #ifdef NO_RSA + #error "Need RSA or else dual alg cert example will not work." + #endif + + #ifndef HAVE_ECC + #error "Need ECDSA or else dual alg cert example will not work." + #endif + + #undef WOLFSSL_CERT_GEN + #define WOLFSSL_CERT_GEN + + #undef WOLFSSL_CUSTOM_OID + #define WOLFSSL_CUSTOM_OID + + #undef HAVE_OID_ENCODING + #define HAVE_OID_ENCODING + + #undef WOLFSSL_CERT_EXT + #define WOLFSSL_CERT_EXT + + #undef OPENSSL_EXTRA + #define OPENSSL_EXTRA + + #undef HAVE_OID_DECODING + #define HAVE_OID_DECODING +#endif /* WOLFSSL_DUAL_ALG_CERTS */ + + +#if defined(_WIN32) && !defined(_M_X64) && \ + defined(HAVE_AESGCM) && defined(WOLFSSL_AESNI) + +/* The _M_X64 macro is what's used in the headers for MSC to tell if it + * has the 64-bit versions of the 128-bit integers available. If one is + * building on 32-bit Windows with AES-NI, turn off the AES-GCMloop + * unrolling. */ + + #define AES_GCM_AESNI_NO_UNROLL +#endif + +#ifdef IPHONE + #define SIZEOF_LONG_LONG 8 +#endif + +#ifdef THREADX + #define SIZEOF_LONG_LONG 8 +#endif + +#ifdef HAVE_NETX + #ifdef NEED_THREADX_TYPES + #include <types.h> + #endif + #include <nx_api.h> +#endif + + +#ifdef WOLFSSL_NDS + #include <stddef.h> + #define SIZEOF_LONG_LONG 8 + #define socklen_t int + #define IPPROTO_UDP 17 + #define IPPROTO_TCP 6 + #define NO_WRITEV +#endif + +#if defined(ARDUINO) + #if defined(ESP32) + #ifndef NO_ARDUINO_DEFAULT + #define SIZEOF_LONG_LONG 8 + #ifdef FREERTOS + #undef FREERTOS + #endif + + #define WOLFSSL_LWIP + #define NO_WRITEV + #define NO_WOLFSSL_DIR + #define WOLFSSL_NO_CURRDIR + + #define TFM_TIMING_RESISTANT + #define ECC_TIMING_RESISTANT + #define WC_RSA_BLINDING + #define WC_NO_CACHE_RESISTANT + #endif /* !NO_ARDUINO_DEFAULT */ + #elif defined(__arm__) + #define NO_WRITEV + #define NO_WOLFSSL_DIR + #define WOLFSSL_NO_CURRDIR + #elif defined(OTHERBOARD) + /* TODO: define other Arduino boards here */ + #endif +#endif + +#if defined(WOLFSSL_ESPIDF) + #define SIZEOF_LONG_LONG 8 + + #ifndef WOLFSSL_MAX_ERROR_SZ + /* Espressif paths can be quite long. Ensure error prints full path. */ + #define WOLFSSL_MAX_ERROR_SZ 200 + #endif + + /* Parse any Kconfig / menuconfig items into wolfSSL macro equivalents. + * Macros may or may not be defined. If defined, they may have a value of + * + * 0 - not enabled (also the equivalent of not defined) + * 1 - enabled + * + * The naming convention is generally an exact match of wolfSSL macros + * in the Kconfig file. At cmake time, the Kconfig is processed and an + * sdkconfig.h file is created by the ESP-IDF. Any configured options are + * named CONFIG_[Kconfig name] and thus CONFIG_[macro name]. Those that + * are expected to be ESP-IDF specific and may be ambiguous can named + * with an ESP prefix, for example CONFIG_[ESP_(Kconfig name)] + * + * Note there are some inconsistent macro names that may have been + * used in the esp-wolfssl or other places in the ESP-IDF. They should + * be always be included for backward compatibility. + * + * See also: Espressif api-reference kconfig docs. + * + * These settings should be checked and assigned wolfssl equivalents before + * any others. + * + * Only the actual config settings should be defined here. Any others that + * may be application specific should be conditionally defined in the + * respective user_settings.h file. + * + * See the template example for reference: + * https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples/template + * + * Reminder that by the time we are here, the user_settings.h has already + * been processed. The following settings are additive; Enabled settings + * from user_settings are not disabled here. + */ + #if defined(CONFIG_ESP_WOLFSSL_TEST_LOOP) && \ + CONFIG_ESP_WOLFSSL_TEST_LOOP + #define WOLFSSL_TEST_LOOP 1 + #else + #define WOLFSSL_TEST_LOOP 0 + #endif + #if (defined(CONFIG_DEBUG_WOLFSSL) && \ + CONFIG_DEBUG_WOLFSSL) || \ + (defined(CONFIG_ESP_WOLFSSL_DEBUG_WOLFSSL) && \ + CONFIG_ESP_WOLFSSL_DEBUG_WOLFSSL ) + #define DEBUG_WOLFSSL + #endif + #if defined(CONFIG_ESP_WOLFSSL_ENABLE_WOLFSSH) && \ + CONFIG_ESP_WOLFSSL_ENABLE_WOLFSSH + #define WOLFSSL_ENABLE_WOLFSSH + #endif + #if (defined(CONFIG_TEST_ESPIDF_ALL_WOLFSSL) && \ + CONFIG_TEST_ESPIDF_ALL_WOLFSSL ) + #define TEST_ESPIDF_ALL_WOLFSSL + #endif + #if (defined(CONFIG_WOLFSSL_ALT_CERT_CHAINS) && \ + CONFIG_WOLFSSL_ALT_CERT_CHAINS ) + #define WOLFSSL_ALT_CERT_CHAINS + #endif + #if defined(CONFIG_WOLFSSL_ASN_ALLOW_0_SERIAL) && \ + CONFIG_WOLFSSL_ASN_ALLOW_0_SERIAL + #define WOLFSSL_ASN_ALLOW_0_SERIAL + #endif + #if defined(CONFIG_WOLFSSL_NO_ASN_STRICT) && \ + CONFIG_WOLFSSL_NO_ASN_STRICT + #define WOLFSSL_NO_ASN_STRICT + #endif + #if defined(CONFIG_WOLFSSL_DEBUG_CERT_BUNDLE) && \ + CONFIG_WOLFSSL_DEBUG_CERT_BUNDLE + #define WOLFSSL_DEBUG_CERT_BUNDLE + #endif + #if defined(CONFIG_USE_WOLFSSL_ESP_SDK_TIME) && \ + CONFIG_USE_WOLFSSL_ESP_SDK_TIME + #define USE_WOLFSSL_ESP_SDK_TIME + #endif + #if defined(CONFIG_USE_WOLFSSL_ESP_SDK_WIFI) && \ + CONFIG_USE_WOLFSSL_ESP_SDK_WIFI + #define USE_WOLFSSL_ESP_SDK_WIFI + #endif + #if defined(CONFIG_WOLFSSL_APPLE_HOMEKIT) && \ + CONFIG_WOLFSSL_APPLE_HOMEKIT + #define WOLFSSL_APPLE_HOMEKIT + #endif + #if defined(CONFIG_ESP_WOLFSSL_DEBUG_ESP_HW_MULTI_RSAMAX_BITS) && \ + CONFIG_ESP_WOLFSSL_DEBUG_ESP_HW_MULTI_RSAMAX_BITS + #define WOLFSSL_DEBUG_ESP_HW_MULTI_RSAMAX_BITS + #endif + #if defined(CONFIG_ESP_WOLFSSL_DEBUG_ESP_HW_MOD_RSAMAX_BITS) && \ + CONFIG_ESP_WOLFSSL_DEBUG_ESP_HW_MOD_RSAMAX_BITS + #define WOLFSSL_DEBUG_ESP_HW_MOD_RSAMAX_BITS + #endif + + #if defined(CONFIG_TLS_STACK_WOLFSSL) + /* When using ESP-TLS, some old algorithms such as SHA1 are no longer + * enabled in wolfSSL, except for the OpenSSL compatibility. So enable + * that here: */ + #define OPENSSL_EXTRA + #endif + + /* Optional Apple HomeKit support. See below for related sanity checks. */ + #if defined(WOLFSSL_APPLE_HOMEKIT) + /* SRP is known to need 8K; slow on some devices */ + #undef FP_MAX_BITS + #define FP_MAX_BITS (8192 * 2) + #define WOLFCRYPT_HAVE_SRP + #define HAVE_CHACHA + #define HAVE_POLY1305 + #define WOLFSSL_BASE64_ENCODE + #define HAVE_HKDF + #define WOLFSSL_SHA512 + #endif + + /* Enable benchmark code via menuconfig, or when not otherwise disable: */ + #ifdef CONFIG_ESP_WOLFSSL_ENABLE_BENCHMARK + #ifdef NO_CRYPT_BENCHMARK + #pragma message("Benchmark conflict:") + #pragma message("-- NO_CRYPT_BENCHMARK defined.") + #pragma message("-- CONFIG_WOLFSSL_ENABLE_BENCHMARK also defined.") + #pragma message("-- NO_CRYPT_BENCHMARK will be undefined.") + #undef NO_CRYPT_BENCHMARK + #endif + #endif + + #if !defined(NO_CRYPT_BENCHMARK) || \ + defined(CONFIG_ESP_WOLFSSL_ENABLE_BENCHMARK) + + #define BENCH_EMBEDDED + #define WOLFSSL_BENCHMARK_FIXED_UNITS_KB + + /* See wolfcrypt/benchmark/benchmark.c for debug and other settings: */ + + /* Turn on benchmark timing debugging (CPU Cycles, RTOS ticks, etc) */ + #ifdef CONFIG_ESP_DEBUG_WOLFSSL_BENCHMARK_TIMING + #define DEBUG_WOLFSSL_BENCHMARK_TIMING + #endif + + /* Turn on timer debugging (used when CPU cycles not available) */ + #ifdef CONFIG_ESP_WOLFSSL_BENCHMARK_TIMER_DEBUG + #define WOLFSSL_BENCHMARK_TIMER_DEBUG + #endif + #endif + + /* Typically only used in tests, but available to all apps is + * the "enable all" feature: */ + #if defined(TEST_ESPIDF_ALL_WOLFSSL) + #define WOLFSSL_MD2 + #define HAVE_BLAKE2 + #define HAVE_BLAKE2B + #define HAVE_BLAKE2S + + #define WC_RC2 + #define WOLFSSL_ALLOW_RC4 + + #define HAVE_POLY1305 + + #define WOLFSSL_AES_128 + #define WOLFSSL_AES_OFB + #define WOLFSSL_AES_CFB + #define WOLFSSL_AES_XTS + + /* #define WC_SRTP_KDF */ + /* TODO Causes failure with Espressif AES HW Enabled */ + /* #define HAVE_AES_ECB */ + /* #define HAVE_AESCCM */ + /* TODO sanity check when missing HAVE_AES_ECB */ + #define WOLFSSL_WOLFSSH + + #define HAVE_AESGCM + #define WOLFSSL_AES_COUNTER + + #define HAVE_FFDHE + #define HAVE_FFDHE_2048 + #if defined(CONFIG_IDF_TARGET_ESP8266) + /* TODO Full size SRP is disabled on the ESP8266 at this time. + * Low memory issue? */ + #define WOLFCRYPT_HAVE_SRP + /* MIN_FFDHE_FP_MAX_BITS = (MIN_FFDHE_BITS * 2); see settings.h */ + #define FP_MAX_BITS MIN_FFDHE_FP_MAX_BITS + #elif defined(CONFIG_IDF_TARGET_ESP32) || \ + defined(CONFIG_IDF_TARGET_ESP32S2) || \ + defined(CONFIG_IDF_TARGET_ESP32S3) + #define WOLFCRYPT_HAVE_SRP + #define FP_MAX_BITS (8192 * 2) + #elif defined(CONFIG_IDF_TARGET_ESP32C3) || \ + defined(CONFIG_IDF_TARGET_ESP32H2) + /* SRP Known to be working on this target::*/ + #define WOLFCRYPT_HAVE_SRP + #define FP_MAX_BITS (8192 * 2) + #else + /* For everything else, give a try and see if SRP working: */ + #define WOLFCRYPT_HAVE_SRP + #define FP_MAX_BITS (8192 * 2) + #endif + + #define HAVE_DH + + /* TODO: there may be a problem with HAVE_CAMELLIA with HW AES disabled. + * Do not define NO_WOLFSSL_ESP32_CRYPT_AES when enabled: */ + /* #define HAVE_CAMELLIA */ + + /* DSA requires old SHA */ + #define HAVE_DSA + + /* Needs SHA512 ? */ + #define HAVE_HPKE + + /* Not for Espressif? */ + #if defined(CONFIG_IDF_TARGET_ESP32C2) || \ + defined(CONFIG_IDF_TARGET_ESP8684) || \ + defined(CONFIG_IDF_TARGET_ESP32H2) || \ + defined(CONFIG_IDF_TARGET_ESP8266) + + #if defined(CONFIG_IDF_TARGET_ESP8266) + #undef HAVE_ECC + #undef HAVE_ECC_CDH + #undef HAVE_CURVE25519 + + #ifdef HAVE_CHACHA + #error "HAVE_CHACHA not supported on ESP8266" + #endif + #ifdef HAVE_XCHACHA + #error "HAVE_XCHACHA not supported on ESP8266" + #endif + #else + #define HAVE_XCHACHA + #define HAVE_CHACHA + /* TODO Not enabled at this time, needs further testing: + * #define WC_SRTP_KDF + * #define HAVE_COMP_KEY + * #define WOLFSSL_HAVE_XMSS + */ + #endif + /* TODO AES-EAX needs stesting on this platform */ + + /* Optionally disable DH + * #undef HAVE_DH + * #undef HAVE_FFDHE + */ + + /* ECC_SHAMIR out of memory on ESP32-C2 during ECC */ + #ifndef HAVE_ECC + #define ECC_SHAMIR + #endif + #else + #define WOLFSSL_AES_EAX + + #define ECC_SHAMIR + #endif + + /* Only for WOLFSSL_IMX6_CAAM / WOLFSSL_QNX_CAAM ? */ + /* #define WOLFSSL_CAAM */ + /* #define WOLFSSL_CAAM_BLOB */ + + #define WOLFSSL_AES_SIV + #define WOLFSSL_CMAC + + #define WOLFSSL_CERT_PIV + + /* HAVE_SCRYPT may turn on HAVE_PBKDF2 see settings.h */ + /* #define HAVE_SCRYPT */ + #define SCRYPT_TEST_ALL + #define HAVE_X963_KDF + #endif + + /* Optionally enable some wolfSSH settings via compiler def or Kconfig */ + #if defined(ESP_ENABLE_WOLFSSH) + /* The default SSH Windows size is massive for an embedded target. + * Limit it: */ + #define DEFAULT_WINDOW_SZ 2000 + + /* These may be defined in cmake for other examples: */ + #undef WOLFSSH_TERM + #define WOLFSSH_TERM + + #if defined(CONFIG_ESP_WOLFSSL_DEBUG_WOLFSSH) + /* wolfSSH debugging enabled via Kconfig / menuconfig */ + #undef DEBUG_WOLFSSH + #define DEBUG_WOLFSSH + #endif + + #undef WOLFSSL_KEY_GEN + #define WOLFSSL_KEY_GEN + + #undef WOLFSSL_PTHREADS + #define WOLFSSL_PTHREADS + + #define WOLFSSH_TEST_SERVER + #define WOLFSSH_TEST_THREADING + + #endif /* ESP_ENABLE_WOLFSSH */ + + /* ML-KEM. */ + #ifdef CONFIG_ESP_WOLFSSL_ENABLE_KYBER + #define CONFIG_ESP_WOLFSSL_ENABLE_MLKEM + #endif + #ifdef CONFIG_ESP_WOLFSSL_ENABLE_MLKEM + /* Kyber typically needs a minimum 10K stack */ + #define WOLFSSL_HAVE_MLKEM + #define WOLFSSL_WC_MLKEM + #define WOLFSSL_SHA3 + #if defined(CONFIG_IDF_TARGET_ESP8266) + /* With limited RAM, we'll disable some of the Kyber sizes: */ + #define WOLFSSL_NO_ML_KEM_1024 + #define WOLFSSL_NO_ML_KEM_768 + #define NO_SESSION_CACHE + #endif + #endif + + #ifndef NO_ESPIDF_DEFAULT + #define FREERTOS + #define WOLFSSL_LWIP + #define NO_WRITEV + #define NO_WOLFSSL_DIR + #define WOLFSSL_NO_CURRDIR + + #define TFM_TIMING_RESISTANT + #define ECC_TIMING_RESISTANT + + /* WC_RSA_BLINDING takes up extra space! */ + #define WC_RSA_BLINDING + + /* Cache Resistant features are on by default, but has performance + * penalty on embedded systems. May not be needed here. Disabled: */ + #define WC_NO_CACHE_RESISTANT + #endif /* !WOLFSSL_ESPIDF_NO_DEFAULT */ + + #if defined(NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384) && \ + !defined(NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512) + #error "NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 cannot be defined without" \ + "NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 (enable or disable both)" + #endif + #if defined(NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512) && \ + !defined(NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384) + #error "NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 cannot be defined without" \ + "NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 (enable or disable both)" + #endif +#if defined(WOLFSSL_ESPWROOM32) + /* WOLFSSL_ESPWROOM32 is a legacy macro gate. + ** Not be be confused with WOLFSSL_ESPWROOM32SE, naming a specific board */ + #undef WOLFSSL_ESP32 + #define WOLFSSL_ESP32 +#endif + +#if defined(NO_ESP32WROOM32_CRYPT) + #undef NO_ESP32WROOM32_CRYPT + #define NO_ESP32_CRYPT + #error "Please use NO_ESP32_CRYPT not NO_ESP32WROOM32_CRYPT" +#endif + +#if defined(NO_WOLFSSL_ESP32WROOM32_CRYPT_HASH) + #undef NO_WOLFSSL_ESP32WROOM32_CRYPT_HASH + #define NO_WOLFSSL_ESP32_CRYPT_HASH + #error "Please use NO_WOLFSSL_ESP32_CRYPT_HASH not NO_ESP32WROOM32_CRYPT" +#endif + +#if defined(NO_WOLFSSL_ESP32WROOM32_CRYPT_AES) + #undef NO_WOLFSSL_ESP32WROOM32_CRYPT_AES + #define NO_WOLFSSL_ESP32_CRYPT_AES + #error "Please use NO_WOLFSSL_ESP32_CRYPT_AES" \ + " not " "NO_WOLFSSL_ESP32WROOM32_CRYPT_AES" +#endif + +#if defined(NO_WOLFSSL_ESP32WROOM32_CRYPT_RSA_PRI) + #undef NO_WOLFSSL_ESP32WROOM32_CRYPT_RSA_PRI + #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI + #error "Please use NO_WOLFSSL_ESP32_CRYPT_RSA_PRI" \ + " not " "NO_WOLFSSL_ESP32WROOM32_CRYPT_RSA_PRI" +#endif + +#if defined(WOLFSSL_ESP32) || defined(WOLFSSL_ESPWROOM32SE) + #ifndef NO_ESP32_CRYPT + #define WOLFSSL_ESP32_CRYPT + #if defined(ESP32_USE_RSA_PRIMITIVE) && \ + !defined(NO_WOLFSSL_ESP32_CRYPT_RSA_PRI) + #define WOLFSSL_ESP32_CRYPT_RSA_PRI + #define WOLFSSL_SMALL_STACK + #endif + #endif + + #if defined(WOLFSSL_SP_RISCV32) + #if defined(CONFIG_IDF_TARGET_ESP32C2) || \ + defined(CONFIG_IDF_TARGET_ESP32C3) || \ + defined(CONFIG_IDF_TARGET_ESP32C6) + /* ok, only the known C2, C3, C6 chips allowed */ + #else + #error "WOLFSSL_SP_RISCV32 can only be used on RISC-V architecture" + #endif + #endif + #if defined(WOLFSSL_SM2) || defined(WOLFSSL_SM3) || defined(WOLFSSL_SM4) + /* SM settings */ + #undef WOLFSSL_BASE16 + #define WOLFSSL_BASE16 /* required for WOLFSSL_SM2 */ + + #undef WOLFSSL_SM4_ECB + #define WOLFSSL_SM4_ECB + + #undef WOLFSSL_SM4_CBC + #define WOLFSSL_SM4_CBC + + #undef WOLFSSL_SM4_CTR + #define WOLFSSL_SM4_CTR + + #undef WOLFSSL_SM4_GCM + #define WOLFSSL_SM4_GCM + + #undef WOLFSSL_SM4_CCM + #define WOLFSSL_SM4_CCM + + #undef HAVE_POLY1305 + #define HAVE_POLY1305 + + #undef HAVE_CHACHA + #define HAVE_CHACHA + + #undef HAVE_AESGCM + #define HAVE_AESGCM + #endif /* SM */ + +#endif /* defined(WOLFSSL_ESP32) || defined(WOLFSSL_ESPWROOM32SE) */ + /* Final device-specific hardware settings. user_settings.h loaded above. */ + + /* Counters for RSA wait timeout. CPU and frequency specific. */ + #define ESP_RSA_WAIT_TIMEOUT_CNT 0x000020 + #if defined(CONFIG_IDF_TARGET_ESP32) || defined(WOLFSSL_ESPWROOM32SE) + #ifndef ESP_RSA_TIMEOUT_CNT + #define ESP_RSA_TIMEOUT_CNT 0x349F00 + #endif + #elif defined(CONFIG_IDF_TARGET_ESP32S2) + #ifndef ESP_RSA_TIMEOUT_CNT + #define ESP_RSA_TIMEOUT_CNT 0x349F00 + #endif + #elif defined(CONFIG_IDF_TARGET_ESP32S3) + #ifndef ESP_RSA_TIMEOUT_CNT + /* Observed: 0xAE8C8F @ 80MHz */ + #define ESP_RSA_TIMEOUT_CNT 0xAF0000 + #endif + #elif defined(CONFIG_IDF_TARGET_ESP32C2) + /* See also CONFIG_IDF_TARGET_ESP8684 equivalent */ + #ifndef ESP_RSA_TIMEOUT_CNT + #define ESP_RSA_TIMEOUT_CNT 0x349F00 + #endif + #elif defined(CONFIG_IDF_TARGET_ESP32C3) + #ifndef ESP_RSA_TIMEOUT_CNT + /* Observed: 0x2624B2 @ 80MHz */ + #define ESP_RSA_TIMEOUT_CNT 0x280000 + #endif + #elif defined(CONFIG_IDF_TARGET_ESP32C6) + #ifndef ESP_RSA_TIMEOUT_CNT + /* Observed: 144323 @ 80MHz */ + #define ESP_RSA_TIMEOUT_CNT 0x160000 + #endif + #elif defined(CONFIG_IDF_TARGET_ESP32H2) + #ifndef ESP_RSA_TIMEOUT_CNT + #define ESP_RSA_TIMEOUT_CNT 0x349F00 + #endif + #elif defined(CONFIG_IDF_TARGET_ESP8266) + #ifndef ESP_RSA_TIMEOUT_CNT + #define ESP_RSA_TIMEOUT_CNT 0x349F00 + #endif + #elif defined(CONFIG_IDF_TARGET_ESP8684) + /* See also CONFIG_IDF_TARGET_ESP8684 equivalent */ + #ifndef ESP_RSA_TIMEOUT_CNT + #define ESP_RSA_TIMEOUT_CNT 0x349F00 + #endif + #else + #ifndef ESP_RSA_TIMEOUT_CNT + #define ESP_RSA_TIMEOUT_CNT 0x349F00 + #endif + #endif +#endif /* WOLFSSL_ESPIDF */ + +#if defined(WOLFSSL_RENESAS_TSIP) + #define TSIP_TLS_HMAC_KEY_INDEX_WORDSIZE 64 + #define TSIP_TLS_MASTERSECRET_SIZE 80 /* 20 words */ + #define TSIP_TLS_ENCPUBKEY_SZ_BY_CERTVRFY 560 /* in byte */ + + #ifdef WOLF_CRYPTO_CB + /* make sure RSA padding callbacks are enabled */ + #define WOLF_CRYPTO_CB_RSA_PAD + #endif +#endif /* WOLFSSL_RENESAS_TSIP */ + +#if !defined(WOLFSSL_NO_HASH_RAW) && defined(WOLFSSL_RENESAS_RX64_HASH) + /* RAW hash function APIs are not implemented with RX64 hardware acceleration */ + #define WOLFSSL_NO_HASH_RAW +#endif + +#if defined(WOLFSSL_RENESAS_SCEPROTECT) + #define FSPSM_TLS_MASTERSECRET_SIZE 80 /* 20 words */ + #define TSIP_TLS_HMAC_KEY_INDEX_WORDSIZE 64 + #define TSIP_TLS_ENCPUBKEY_SZ_BY_CERTVRFY 560 /* in bytes */ + #define FSPSM_TLS_CLIENTRANDOM_SZ 36 /* in bytes */ + #define FSPSM_TLS_SERVERRANDOM_SZ 36 /* in bytes */ + #define FSPSM_TLS_ENCRYPTED_ECCPUBKEY_SZ 96 /* in bytes */ + + #define WOLFSSL_RENESAS_FSPSM_ECC + #if defined(WOLFSSL_RENESAS_FSPSM_ECC) + #define HAVE_PK_CALLBACKS + /* #define DEBUG_PK_CB */ + #endif +#endif +#if defined(WOLFSSL_RENESAS_RA6M3G) || defined(WOLFSSL_RENESAS_RA6M3) ||\ + defined(WOLFSSL_RENESAS_RA6M4) + /* settings in user_settings.h */ +#endif + +#if defined(WOLFSSL_LWIP_NATIVE) || \ + defined(HAVE_LWIP_NATIVE) /* using LwIP native TCP socket */ + #undef WOLFSSL_USER_IO + #define WOLFSSL_USER_IO + + #if defined(HAVE_LWIP_NATIVE) + #define WOLFSSL_LWIP + #define NO_WRITEV + #define SINGLE_THREADED + #define NO_FILESYSTEM + #endif +#endif + +#if defined(WOLFSSL_CONTIKI) + #include <contiki.h> + #define WOLFSSL_UIP + #define NO_WOLFSSL_MEMORY + #define NO_WRITEV + #define SINGLE_THREADED + #define WOLFSSL_USER_IO + #define NO_FILESYSTEM + #ifndef CUSTOM_RAND_GENERATE + #define CUSTOM_RAND_TYPE uint16_t + #define CUSTOM_RAND_GENERATE random_rand + #endif + static inline word32 LowResTimer(void) + { + return clock_seconds(); + } +#endif + +#if defined(WOLFSSL_IAR_ARM) || defined(WOLFSSL_ROWLEY_ARM) + #define NO_MAIN_DRIVER + #define SINGLE_THREADED + #if !defined(USE_CERT_BUFFERS_2048) && !defined(USE_CERT_BUFFERS_4096) + #define USE_CERT_BUFFERS_1024 + #endif + #define BENCH_EMBEDDED + #define NO_FILESYSTEM + #define NO_WRITEV + #define WOLFSSL_USER_IO + #define BENCH_EMBEDDED +#endif + +#ifdef MICROCHIP_PIC32 + /* #define WOLFSSL_MICROCHIP_PIC32MZ */ + #define SIZEOF_LONG_LONG 8 + #define SINGLE_THREADED + #ifndef MICROCHIP_TCPIP_BSD_API + #define WOLFSSL_USER_IO + #endif + #define NO_WRITEV + #define NO_DEV_RANDOM + #define NO_FILESYSTEM + #define TFM_TIMING_RESISTANT +#endif + +#ifdef WOLFSSL_MICROCHIP_PIC32MZ + #define WOLFSSL_HAVE_MIN + #define WOLFSSL_HAVE_MAX + + #ifndef NO_PIC32MZ_CRYPT + #define WOLFSSL_PIC32MZ_CRYPT + #endif + #ifndef NO_PIC32MZ_RNG + #define WOLFSSL_PIC32MZ_RNG + #endif + #ifndef NO_PIC32MZ_HASH + #define WOLFSSL_PIC32MZ_HASH + #endif +#endif + +#ifdef MICROCHIP_TCPIP_V5 + /* include timer functions */ + #include "TCPIP Stack/TCPIP.h" +#endif + +#ifdef MICROCHIP_TCPIP + /* include timer, NTP functions */ + #ifdef MICROCHIP_MPLAB_HARMONY + #include "tcpip/tcpip.h" + #else + #include "system/system_services.h" + #include "tcpip/sntp.h" + #endif +#endif + +#ifdef WOLFSSL_ATECC508A + /* backwards compatibility */ +#ifndef WOLFSSL_ATECC_NO_ECDH_ENC + #define WOLFSSL_ATECC_ECDH_ENC +#endif + #ifdef WOLFSSL_ATECC508A_DEBUG + #define WOLFSSL_ATECC_DEBUG + #endif +#endif + +#ifdef MBED + #define WOLFSSL_USER_IO + #define NO_FILESYSTEM + #define NO_CERTS + #if !defined(USE_CERT_BUFFERS_2048) && !defined(USE_CERT_BUFFERS_4096) + #define USE_CERT_BUFFERS_1024 + #endif + #define NO_WRITEV + #define NO_DEV_RANDOM + #define NO_SHA512 + #define NO_DH + /* Allows use of DH with fixed points if uncommented and NO_DH is removed */ + /* WOLFSSL_DH_CONST */ + #define NO_DSA + #define HAVE_ECC + #define NO_SESSION_CACHE + #define WOLFSSL_CMSIS_RTOS +#endif + + +#ifdef WOLFSSL_EROAD + #define FREESCALE_MQX + #define FREESCALE_MMCAU + #define SINGLE_THREADED + #define NO_STDIO_FILESYSTEM + #define WOLFSSL_LEANPSK + #define HAVE_NULL_CIPHER + #define NO_OLD_TLS + #define NO_ASN + #define NO_BIG_INT + #define NO_RSA + #define NO_DSA + #define NO_DH + /* Allows use of DH with fixed points if uncommented and NO_DH is removed */ + /* WOLFSSL_DH_CONST */ + #define NO_CERTS + #define NO_PWDBASED + #define NO_DES3 + #define NO_MD4 + #define NO_RC4 + #define NO_MD5 + #define NO_SESSION_CACHE + #define NO_MAIN_DRIVER +#endif + +#ifdef WOLFSSL_PICOTCP + #ifndef errno + #define errno pico_err + #endif + #include "pico_defines.h" + #include "pico_stack.h" + #include "pico_constants.h" + #include "pico_protocol.h" + #ifndef CUSTOM_RAND_GENERATE + #define CUSTOM_RAND_GENERATE pico_rand + #endif +#endif + +#ifdef WOLFSSL_PICOTCP_DEMO + #define WOLFSSL_STM32 + #define TFM_TIMING_RESISTANT + #define XMALLOC(s, h, type) ((void)(h), (void)(type), PICO_ZALLOC((s))) + #define XFREE(p, h, type) ((void)(h), (void)(type), PICO_FREE((p))) + #define SINGLE_THREADED + #define NO_WRITEV + #define WOLFSSL_USER_IO + #define NO_DEV_RANDOM + #define NO_FILESYSTEM +#endif + +#ifdef FREERTOS_WINSIM + #define FREERTOS + #define USE_WINDOWS_API +#endif + + +#ifdef WOLFSSL_VXWORKS + /* VxWorks simulator incorrectly detects building for i386 */ + #ifdef VXWORKS_SIM + #define TFM_NO_ASM + #endif + /* For VxWorks pthreads wrappers for mutexes uncomment the next line. */ + /* #define WOLFSSL_PTHREADS */ + #define WOLFSSL_HAVE_MIN + #define WOLFSSL_HAVE_MAX + #define NO_MAIN_DRIVER + #define NO_DEV_RANDOM + #define NO_WRITEV + #define HAVE_STRINGS_H +#endif + + +#ifdef WOLFSSL_ARDUINO + /* Define WOLFSSL_USER_IO here to avoid check in internal.c */ + #define WOLFSSL_USER_IO + + #define NO_WRITEV + #define NO_WOLFSSL_DIR + #define SINGLE_THREADED + #define NO_DEV_RANDOM + #if defined(INTEL_GALILEO) || defined(ESP32) + /* boards with has time.h compatibility */ + #elif defined(__arm__) + /* TODO is time really missing from Arduino Due? */ + /* This is a brute-force solution to make it work: */ + #define NO_ASN_TIME + #else + #define TIME_OVERRIDES + #ifndef XTIME + #error "Must define XTIME externally see porting guide" + /* https://www.wolfssl.com/docs/porting-guide/ */ + #endif + #ifndef XGMTIME + #error "Must define XGMTIME externally see porting guide" + /* https://www.wolfssl.com/docs/porting-guide/ */ + #endif + #endif + + #define HAVE_ECC + #define NO_DH + #define NO_SESSION_CACHE +#endif + + +#ifdef WOLFSSL_UTASKER + /* uTasker configuration - used for fnRandom() */ + #include "config.h" + + #define SINGLE_THREADED + #define NO_WOLFSSL_DIR + #define WOLFSSL_HAVE_MIN + #define NO_WRITEV + + #define HAVE_ECC + #define ALT_ECC_SIZE + #define TFM_TIMING_RESISTANT + #define ECC_TIMING_RESISTANT + + /* used in wolfCrypt test */ + #define NO_MAIN_DRIVER + #define USE_CERT_BUFFERS_2048 + + /* uTasker port uses RAW sockets, use I/O callbacks + * See wolfSSL uTasker example for sample callbacks */ + #define WOLFSSL_USER_IO + + /* uTasker filesystem not ported */ + #define NO_FILESYSTEM + + /* uTasker RNG is abstracted, calls HW RNG when available */ + #define CUSTOM_RAND_GENERATE fnRandom + #define CUSTOM_RAND_TYPE unsigned short + + /* user needs to define XTIME to function that provides + * seconds since Unix epoch */ + #ifndef XTIME + #error XTIME must be defined in wolfSSL settings.h + /* #define XTIME fnSecondsSinceEpoch */ + #endif + + /* use uTasker std library replacements where available */ + #define STRING_USER + #define XMEMCPY(d,s,l) uMemcpy((d),(s),(l)) + #define XMEMSET(b,c,l) uMemset((b),(c),(l)) + #define XMEMCMP(s1,s2,n) uMemcmp((s1),(s2),(n)) + #define XMEMMOVE(d,s,l) memmove((d),(s),(l)) + + #define XSTRLEN(s1) uStrlen((s1)) + #define XSTRNCPY(s1,s2,n) strncpy((s1),(s2),(n)) + #define XSTRSTR(s1,s2) strstr((s1),(s2)) + #define XSTRNSTR(s1,s2,n) mystrnstr((s1),(s2),(n)) + #define XSTRNCMP(s1,s2,n) strncmp((s1),(s2),(n)) + #define XSTRNCAT(s1,s2,n) strncat((s1),(s2),(n)) + #define XSTRNCASECMP(s1,s2,n) _strnicmp((s1),(s2),(n)) + #if defined(WOLFSSL_CERT_EXT) || defined(OPENSSL_EXTRA) || \ + defined(OPENSSL_ALL) || defined(HAVE_ALPN) + #define XSTRTOK strtok_r + #endif +#endif + +#ifdef WOLFSSL_EMBOS + #define NO_FILESYSTEM /* Not ported at this time */ + #define USE_CERT_BUFFERS_2048 /* use when NO_FILESYSTEM */ + #define NO_MAIN_DRIVER + #define NO_RC4 +#endif + +#ifdef WOLFSSL_RIOT_OS + #define TFM_NO_ASM + #define NO_FILESYSTEM + #define USE_CERT_BUFFERS_2048 + #if defined(WOLFSSL_GNRC) && !defined(WOLFSSL_DTLS) + #define WOLFSSL_DTLS + #endif +#endif + +#ifdef WOLFSSL_CHIBIOS + /* ChibiOS definitions. This file is distributed with chibiOS. */ + #include "wolfssl_chibios.h" +#endif + +#ifdef WOLFSSL_PB + /* PB is using older 1.2 version of Nucleus */ + #undef WOLFSSL_NUCLEUS + #define WOLFSSL_NUCLEUS_1_2 +#endif + +#ifdef WOLFSSL_NUCLEUS_1_2 + #define NO_WRITEV + #define NO_WOLFSSL_DIR + + #if !defined(NO_ASN_TIME) && !defined(USER_TIME) + #error User must define XTIME, see manual + #endif + + #if !defined(XMALLOC_OVERRIDE) && !defined(XMALLOC_USER) + extern void* nucleus_malloc(unsigned long size, void* heap, int type); + extern void* nucleus_realloc(void* ptr, unsigned long size, void* heap, + int type); + extern void nucleus_free(void* ptr, void* heap, int type); + + #define XMALLOC(s, h, type) nucleus_malloc((s), (h), (type)) + #define XREALLOC(p, n, h, t) nucleus_realloc((p), (n), (h), (t)) + #define XFREE(p, h, type) nucleus_free((p), (h), (type)) + #endif +#endif + +#ifdef WOLFSSL_NRF5x + #define SIZEOF_LONG 4 + #define SIZEOF_LONG_LONG 8 + #define NO_DEV_RANDOM + #define NO_FILESYSTEM + #define NO_MAIN_DRIVER + #define NO_WRITEV + #define SINGLE_THREADED + #define TFM_TIMING_RESISTANT + #define WOLFSSL_NRF51 + #define WOLFSSL_USER_IO + #define NO_SESSION_CACHE +#endif + +/* For platforms where the target OS is not Windows, but compilation is + * done on Windows/Visual Studio, enable a way to disable USE_WINDOWS_API. + * Examples: Micrium, TenAsus INtime, uTasker, FreeRTOS simulator */ +#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) && \ + !defined(FREERTOS_TCP) && !defined(EBSNET) && !defined(WOLFSSL_EROAD) && \ + !defined(WOLFSSL_UTASKER) && !defined(INTIME_RTOS) && \ + !defined(WOLFSSL_NOT_WINDOWS_API) + #define USE_WINDOWS_API +#endif + +#if defined(WOLFSSL_uITRON4) + +#define XMALLOC_USER +#include <stddef.h> +#define ITRON_POOL_SIZE 1024*20 +extern int uITRON4_minit(size_t poolsz) ; +extern void *uITRON4_malloc(size_t sz) ; +extern void *uITRON4_realloc(void *p, size_t sz) ; +extern void uITRON4_free(void *p) ; + +#define XMALLOC(sz, heap, type) ((void)(heap), (void)(type), uITRON4_malloc(sz)) +#define XREALLOC(p, sz, heap, type) ((void)(heap), (void)(type), uITRON4_realloc(p, sz)) +#define XFREE(p, heap, type) ((void)(heap), (void)(type), uITRON4_free(p)) +#endif + +#if defined(WOLFSSL_uTKERNEL2) + #ifndef NO_TKERNEL_MEM_POOL + #define XMALLOC_OVERRIDE + int uTKernel_init_mpool(unsigned int sz); /* initializing malloc pool */ + void* uTKernel_malloc(unsigned int sz); + void* uTKernel_realloc(void *p, unsigned int sz); + void uTKernel_free(void *p); + #define XMALLOC(s, h, type) ((void)(h), (void)(type), uTKernel_malloc((s))) + #define XREALLOC(p, n, h, t) ((void)(h), (void)(t), uTKernel_realloc((p), (n))) + #define XFREE(p, h, type) ((void)(h), (void)(type), uTKernel_free((p))) + #endif + + #ifndef NO_STDIO_FGETS_REMAP + #include <stdio.h> + #include "tm/tmonitor.h" + + /* static char* gets(char *buff); */ + static char* fgets(char *buff, int sz, XFILE fp) { + char * s = buff; + *s = '\0'; + while (1) { + *s = tm_getchar(-1); + tm_putchar(*s); + if (*s == '\r') { + tm_putchar('\n'); + *s = '\0'; + break; + } + s++; + } + return buff; + } + #endif /* !NO_STDIO_FGETS_REMAP */ +#endif + + +#if defined(WOLFSSL_LEANPSK) && !defined(XMALLOC_USER) && \ + !defined(NO_WOLFSSL_MEMORY) && !defined(WOLFSSL_STATIC_MEMORY) + #include <stdlib.h> + #define XMALLOC(s, h, type) ((void)(h), (void)(type), malloc((s))) /* native heap */ + #define XFREE(p, h, type) ((void)(h), (void)(type), free((p))) /* native heap */ + #define XREALLOC(p, n, h, t) ((void)(h), (void)(t), realloc((p), (n))) /* native heap */ +#endif + +#if defined(XMALLOC_USER) && defined(SSN_BUILDING_LIBYASSL) + #undef XMALLOC + #define XMALLOC yaXMALLOC + #undef XFREE + #define XFREE yaXFREE + #undef XREALLOC + #define XREALLOC yaXREALLOC +#endif + + +#ifdef FREERTOS + + #ifdef PLATFORMIO + #include <freertos/FreeRTOS.h> + #include <freertos/task.h> + #else + #include "FreeRTOS.h" + #include <task.h> + #endif + + #if !defined(XMALLOC_USER) && !defined(NO_WOLFSSL_MEMORY) && \ + !defined(WOLFSSL_STATIC_MEMORY) && !defined(WOLFSSL_TRACK_MEMORY) + + /* XMALLOC */ + #if defined(WOLFSSL_ESPIDF) && \ + (defined(DEBUG_WOLFSSL) || defined(DEBUG_WOLFSSL_MALLOC)) + #include <wolfssl/wolfcrypt/port/Espressif/esp-sdk-lib.h> + #define XMALLOC(s, h, type) \ + ((void)(h), (void)(type), wc_debug_pvPortMalloc( \ + (s), (__FILE__), (__LINE__), (__FUNCTION__) )) + #else + #define XMALLOC(s, h, type) \ + ((void)(h), (void)(type), pvPortMalloc((s))) /* native heap */ + #endif + + /* XFREE */ + #define XFREE(p, h, type) ((void)(h), (void)(type), vPortFree((p))) /* native heap */ + + /* XREALLOC */ + #if defined(WOLFSSL_ESPIDF) + /* In the Espressif EDP-IDF, realloc(p, n) is equivalent to + * heap_caps_realloc(p, s, MALLOC_CAP_8BIT) + * There's no pvPortRealloc available: */ + #define XREALLOC(p, n, h, t) ((void)(h), (void)(t), realloc((p), (n))) /* native heap */ + #elif defined(USE_INTEGER_HEAP_MATH) || defined(OPENSSL_EXTRA) || \ + defined(OPENSSL_ALL) + /* FreeRTOS pvPortRealloc() implementation can be found here: + * https://github.com/wolfSSL/wolfssl-freertos/pull/3/files */ + #define XREALLOC(p, n, h, t) ((void)(h), (void)(t), pvPortRealloc((p), (n))) + #else + /* no XREALLOC available */ + #endif + #endif + + #ifndef NO_WRITEV + #define NO_WRITEV + #endif + #ifndef WOLFSSL_SHA512 + #ifndef NO_SHA512 + #define NO_SHA512 + #endif + #endif + #ifndef HAVE_DH + #ifndef NO_DH + #define NO_DH + #endif + #endif + #ifndef HAVE_DSA + #ifndef NO_DSA + #define NO_DSA + #endif + #endif + + #ifndef SINGLE_THREADED + #ifdef PLATFORMIO + #include <freertos/semphr.h> + #else + #include "semphr.h" + #endif + #endif +#endif + +#ifdef FREERTOS_TCP + #if !defined(NO_WOLFSSL_MEMORY) && !defined(XMALLOC_USER) && \ + !defined(WOLFSSL_STATIC_MEMORY) + #ifndef XMALLOC + #define XMALLOC(s, h, type) pvPortMalloc((s)) /* native heap */ + #endif + #ifndef XFREE + #define XFREE(p, h, type) vPortFree((p)) /* native heap */ + #endif + #endif + + #define WOLFSSL_GENSEED_FORTEST + + #define NO_WOLFSSL_DIR + #define NO_WRITEV + #define TFM_TIMING_RESISTANT + #define NO_MAIN_DRIVER +#endif + +#ifdef WOLFSSL_TIRTOS + #define SIZEOF_LONG_LONG 8 + #define NO_WRITEV + #define NO_WOLFSSL_DIR + + /* Enable SP math by default, unless fast math + * specified in user_settings. + */ + #ifndef USE_FAST_MATH + #define SP_WORD_SIZE 32 + #define WOLFSSL_HAVE_SP_ECC + #ifndef NO_RSA + #define WOLFSSL_HAVE_SP_RSA + #endif + #ifndef NO_DH + #define WOLFSSL_HAVE_SP_DH + #endif + #if !defined(NO_RSA) || !defined(NO_DH) + /* DH/RSA 2048, 3072 and 4096 */ + #if defined(SP_INT_MAX_BITS) && SP_INT_MAX_BITS >= 4096 + #define WOLFSSL_SP_4096 + #endif + #endif + #endif + #define TFM_TIMING_RESISTANT + #define ECC_TIMING_RESISTANT + #define WC_RSA_BLINDING + #define NO_DEV_RANDOM + #define NO_FILESYSTEM + #define NO_MAIN_DRIVER + #ifndef NO_CRYPT_TEST + #define USE_CERT_BUFFERS_2048 + #endif + #ifndef DEBUG_WOLFSSL + #define NO_ERROR_STRINGS + #endif + + #define HAVE_ECC + #define HAVE_ALPN + #define USE_WOLF_STRTOK /* use with HAVE_ALPN */ + #define HAVE_TLS_EXTENSIONS + #define HAVE_SUPPORTED_CURVES + + #define HAVE_AESGCM + + #ifdef __IAR_SYSTEMS_ICC__ + #pragma diag_suppress=Pa089 + #elif !defined(__GNUC__) + /* Suppress the sslpro warning */ + #pragma diag_suppress=11 + #endif + + /* Uncomment this setting if your toolchain does not offer time.h header */ + /* #define USER_TIME */ + #include <ti/sysbios/hal/Seconds.h> + #if defined(__ti__) && !defined(USER_TIME) + /* TI internal time() offsets by 2208988800 (1990 -> 1970), + * which overflows signed 32-bit */ + #define NO_TIME_SIGNEDNESS_CHECK + #endif +#endif + +#ifdef EBSNET + #include "rtip.h" + + /* #define DEBUG_WOLFSSL */ + #define NO_WOLFSSL_DIR /* tbd */ + + #if (POLLOS) + #define SINGLE_THREADED + #endif + + #if (defined(RTPLATFORM) && (RTPLATFORM != 0)) + #if (!RTP_LITTLE_ENDIAN) + #define BIG_ENDIAN_ORDER + #endif + #else + #if (!KS_LITTLE_ENDIAN) + #define BIG_ENDIAN_ORDER + #endif + #endif + + #if (WINMSP3) + #undef SIZEOF_LONG + #define SIZEOF_LONG_LONG 8 + #else + #if !defined(SIZEOF_LONG) && !defined(SIZEOF_LONG_LONG) + #error settings.h - please implement SIZEOF_LONG and SIZEOF_LONG_LONG + #endif + #endif + + #if (WINMSP3) + #define strtok_r strtok_s + #endif + + #define XMALLOC(s, h, type) ((void)(h), (void)(type), ((void *)rtp_malloc((s), SSL_PRO_MALLOC))) + #define XFREE(p, h, type) ((void)(h), (void)(type), rtp_free(p)) + #define XREALLOC(p, n, h, t) ((void)(h), rtp_realloc((p), (n), (t))) + + #if (WINMSP3) + #define XSTRNCASECMP(s1,s2,n) _strnicmp((s1),(s2),(n)) + #else + #ifndef XSTRNCASECMP + #error settings.h - please implement XSTRNCASECMP - needed for HAVE_ECC + #endif + #endif + + #define WOLFSSL_HAVE_MAX + #define WOLFSSL_HAVE_MIN + + #define TFM_TIMING_RESISTANT + #define WC_RSA_BLINDING + #define ECC_TIMING_RESISTANT + + #define HAVE_ECC + +#endif /* EBSNET */ + +#ifdef WOLFSSL_GAME_BUILD + #define SIZEOF_LONG_LONG 8 +#endif + +#ifdef WOLFSSL_LSR + #define HAVE_WEBSERVER + #define SIZEOF_LONG_LONG 8 + #define WOLFSSL_LOW_MEMORY + #define NO_WRITEV + #define NO_SHA512 + #define NO_DH + /* Allows use of DH with fixed points if uncommented and NO_DH is removed */ + /* WOLFSSL_DH_CONST */ + #define NO_DSA + #define NO_DEV_RANDOM + #define NO_WOLFSSL_DIR + #ifndef NO_FILESYSTEM + #define LSR_FS + #include "inc/hw_types.h" + #include "fs.h" + #endif + #define WOLFSSL_LWIP + #include <errno.h> /* for tcp errno */ + #define WOLFSSL_SAFERTOS + #if defined(__IAR_SYSTEMS_ICC__) + /* enum uses enum */ + #pragma diag_suppress=Pa089 + #endif +#endif + +#ifdef WOLFSSL_SAFERTOS + #ifndef SINGLE_THREADED + #include "SafeRTOS/semphr.h" + #endif + #ifndef WOLFSSL_NO_MALLOC + #include "SafeRTOS/heap.h" + #endif + #if !defined(XMALLOC_USER) && !defined(NO_WOLFSSL_MEMORY) && \ + !defined(WOLFSSL_STATIC_MEMORY) + #define XMALLOC(s, h, type) ((void)(h), (void)(type), pvPortMalloc((s))) /* native heap */ + #define XFREE(p, h, type) ((void)(h), (void)(type), vPortFree((p))) /* native heap */ + + /* FreeRTOS pvPortRealloc() implementation can be found here: + https://github.com/wolfSSL/wolfssl-freertos/pull/3/files */ + #if !defined(USE_FAST_MATH) || defined(HAVE_ED25519) || \ + defined(HAVE_ED448) + #define XREALLOC(p, n, h, t) ((void)(h), (void)(t), pvPortRealloc((p), (n))) + #endif + #endif +#endif + +#ifdef WOLFSSL_LOW_MEMORY + #undef RSA_LOW_MEM + #define RSA_LOW_MEM + #undef WOLFSSL_SMALL_STACK + #define WOLFSSL_SMALL_STACK + #undef TFM_TIMING_RESISTANT + #define TFM_TIMING_RESISTANT +#endif + +/* To support storing some of the large constant tables in flash memory rather than SRAM. + Useful for processors that have limited SRAM, such as the AVR family of microtrollers. */ +#ifdef WOLFSSL_USE_FLASHMEM + /* This is supported on the avr-gcc compiler, for more information see: + https://gcc.gnu.org/onlinedocs/gcc/Named-Address-Spaces.html */ + #define FLASH_QUALIFIER __flash + + /* Copy data out of flash memory and into SRAM */ + #define XMEMCPY_P(pdest, psrc, size) memcpy_P((pdest), (psrc), (size)) +#else +#ifndef FLASH_QUALIFIER + #define FLASH_QUALIFIER +#endif +#endif + +#ifdef FREESCALE_MQX_5_0 + /* use normal Freescale MQX port, but with minor changes for 5.0 */ + #define FREESCALE_MQX +#endif + +#ifdef FREESCALE_MQX_4_0 + /* use normal Freescale MQX port, but with minor changes for 4.0 */ + #define FREESCALE_MQX +#endif + +#ifdef FREESCALE_MQX + #define FREESCALE_COMMON + #include "mqx.h" + #ifndef NO_FILESYSTEM + #include "mfs.h" + #if (defined(MQX_USE_IO_OLD) && MQX_USE_IO_OLD) || \ + defined(FREESCALE_MQX_5_0) + #include "fio.h" + #define NO_STDIO_FILESYSTEM + #else + #include "nio.h" + #endif + #endif + #ifndef SINGLE_THREADED + #include "mutex.h" + #endif + + #if !defined(XMALLOC_OVERRIDE) && !defined(XMALLOC_USER) + #define XMALLOC_OVERRIDE + #define XMALLOC(s, h, t) ((void)(h), (void)(t), (void *)_mem_alloc_system((s))) + #ifdef WOLFSSL_XFREE_NO_NULLNESS_CHECK + #define XFREE(p, h, t) {(void)(h); (void)(t); _mem_free(p);} + #else + #define XFREE(p, h, t) {void* xp = (p); (void)(h); (void)(t); if ((xp)) _mem_free((xp));} + #endif + + /* Note: MQX has no realloc, using fastmath above */ + #endif + #ifdef USE_FAST_MATH + /* Undef first to avoid re-definition if user_settings.h defines */ + #undef TFM_TIMING_RESISTANT + #define TFM_TIMING_RESISTANT + #undef ECC_TIMING_RESISTANT + #define ECC_TIMING_RESISTANT + #undef WC_RSA_BLINDING + #define WC_RSA_BLINDING + #endif +#endif + +#ifdef FREESCALE_KSDK_MQX + #define FREESCALE_COMMON + #include <mqx.h> + #ifndef NO_FILESYSTEM + #if (defined(MQX_USE_IO_OLD) && MQX_USE_IO_OLD) || \ + defined(FREESCALE_MQX_5_0) + #include <fio.h> + #else + #include <stdio.h> + #include <nio.h> + #endif + #endif + #ifndef SINGLE_THREADED + #include <mutex.h> + #endif + + #define XMALLOC(s, h, t) ((void)(h), (void)(t), (void *)_mem_alloc_system((s))) + #ifdef WOLFSSL_XFREE_NO_NULLNESS_CHECK + #define XFREE(p, h, t) {(void)(h); (void)(t); _mem_free(p);} + #else + #define XFREE(p, h, t) {void* xp = (p); (void)(h); (void)(t); if ((xp)) _mem_free((xp));} + #endif + #define XREALLOC(p, n, h, t) _mem_realloc((p), (n)) /* since MQX 4.1.2 */ + + #define MQX_FILE_PTR FILE * + #define IO_SEEK_SET SEEK_SET + #define IO_SEEK_END SEEK_END +#endif /* FREESCALE_KSDK_MQX */ + +#if defined(FREESCALE_FREE_RTOS) || defined(FREESCALE_KSDK_FREERTOS) + #define NO_FILESYSTEM + #define WOLFSSL_CRYPT_HW_MUTEX 1 + + #if !defined(XMALLOC_USER) && !defined(NO_WOLFSSL_MEMORY) + #define XMALLOC(s, h, type) ((void)(h), (void)(type), pvPortMalloc((s))) /* native heap */ + #define XFREE(p, h, type) ((void)(h), (void)(type), vPortFree((p))) /* native heap */ + #endif + + /* #define USER_TICKS */ + /* Allows use of DH with fixed points if uncommented and NO_DH is removed */ + /* WOLFSSL_DH_CONST */ + #define WOLFSSL_LWIP + #define FREERTOS_TCP + + #define FREESCALE_FREE_RTOS + #define FREERTOS_SOCKET_ERROR ( -1 ) + #define FREERTOS_EWOULDBLOCK ( -2 ) + #define FREERTOS_EINVAL ( -4 ) + #define FREERTOS_EADDRNOTAVAIL ( -5 ) + #define FREERTOS_EADDRINUSE ( -6 ) + #define FREERTOS_ENOBUFS ( -7 ) + #define FREERTOS_ENOPROTOOPT ( -8 ) +#endif /* FREESCALE_FREE_RTOS || FREESCALE_KSDK_FREERTOS */ + +#ifdef FREESCALE_KSDK_BM + #define FREESCALE_COMMON + #define WOLFSSL_USER_IO + #define SINGLE_THREADED + #define NO_FILESYSTEM + #ifndef TIME_OVERRIDES + #define USER_TICKS + #endif +#endif /* FREESCALE_KSDK_BM */ + +#ifdef FREESCALE_COMMON + #define SIZEOF_LONG_LONG 8 + + /* disable features */ + #undef NO_WRITEV + #define NO_WRITEV + #undef NO_DEV_RANDOM + #define NO_DEV_RANDOM + #undef NO_WOLFSSL_DIR + #define NO_WOLFSSL_DIR + #undef NO_RC4 + #define NO_RC4 + + /* enable features */ + #define USE_CERT_BUFFERS_2048 + #define BENCH_EMBEDDED + + #define TFM_TIMING_RESISTANT + #define ECC_TIMING_RESISTANT + + #ifdef FREESCALE_KSDK_1_3 + #include "fsl_device_registers.h" + #elif !defined(FREESCALE_MQX) + /* Classic MQX does not have fsl_common.h */ + #include "fsl_common.h" + #endif + + /* random seed */ + #define NO_OLD_RNGNAME + #if defined(FREESCALE_NO_RNG) + /* nothing to define */ + #elif defined(FSL_FEATURE_SOC_TRNG_COUNT) && (FSL_FEATURE_SOC_TRNG_COUNT > 0) + #define FREESCALE_KSDK_2_0_TRNG + #elif defined(FSL_FEATURE_SOC_RNG_COUNT) && (FSL_FEATURE_SOC_RNG_COUNT > 0) + #ifdef FREESCALE_KSDK_1_3 + #include "fsl_rnga_driver.h" + #define FREESCALE_RNGA + #define RNGA_INSTANCE (0) + #else + #define FREESCALE_KSDK_2_0_RNGA + #endif + #elif !defined(FREESCALE_KSDK_BM) && !defined(FREESCALE_FREE_RTOS) && !defined(FREESCALE_KSDK_FREERTOS) + #define FREESCALE_RNGA + #define RNGA_INSTANCE (0) + /* defaulting to K70 RNGA, user should change if different */ + /* #define FREESCALE_K53_RNGB */ + #define FREESCALE_K70_RNGA + #endif + + /* HW crypto */ + /* automatic enable based on Kinetis feature */ + /* if case manual selection is required, for example for benchmarking purposes, + * just define FREESCALE_USE_MMCAU or FREESCALE_USE_LTC or none of these two macros (for software only) + * both can be enabled simultaneously as LTC has priority over MMCAU in source code. + */ + /* #define FSL_HW_CRYPTO_MANUAL_SELECTION */ + #ifndef FSL_HW_CRYPTO_MANUAL_SELECTION + #if defined(FSL_FEATURE_SOC_MMCAU_COUNT) && FSL_FEATURE_SOC_MMCAU_COUNT + #define FREESCALE_USE_MMCAU + #endif + + #if defined(FSL_FEATURE_SOC_LTC_COUNT) && FSL_FEATURE_SOC_LTC_COUNT + #define FREESCALE_USE_LTC + #endif + #else + /* #define FREESCALE_USE_MMCAU */ + /* #define FREESCALE_USE_LTC */ + #endif +#endif /* FREESCALE_COMMON */ + +/* Classic pre-KSDK mmCAU library */ +#ifdef FREESCALE_USE_MMCAU_CLASSIC + #define FREESCALE_USE_MMCAU + #define FREESCALE_MMCAU_CLASSIC + #define FREESCALE_MMCAU_CLASSIC_SHA +#endif + +/* KSDK mmCAU library */ +#ifdef FREESCALE_USE_MMCAU + /* AES and DES */ + #define FREESCALE_MMCAU + /* MD5, SHA-1 and SHA-256 */ + #define FREESCALE_MMCAU_SHA +#endif /* FREESCALE_USE_MMCAU */ + +#ifdef FREESCALE_USE_LTC + #if defined(FSL_FEATURE_SOC_LTC_COUNT) && FSL_FEATURE_SOC_LTC_COUNT + #define FREESCALE_LTC + #define LTC_BASE LTC0 + + #if defined(FSL_FEATURE_LTC_HAS_DES) && FSL_FEATURE_LTC_HAS_DES + #define FREESCALE_LTC_DES + #endif + + #if defined(FSL_FEATURE_LTC_HAS_GCM) && FSL_FEATURE_LTC_HAS_GCM + #define FREESCALE_LTC_AES_GCM + #endif + + #if defined(FSL_FEATURE_LTC_HAS_SHA) && FSL_FEATURE_LTC_HAS_SHA + #define FREESCALE_LTC_SHA + #endif + + #if defined(FSL_FEATURE_LTC_HAS_PKHA) && FSL_FEATURE_LTC_HAS_PKHA + #ifndef WOLFCRYPT_FIPS_RAND + #define FREESCALE_LTC_ECC + #endif + #define FREESCALE_LTC_TFM + + /* the LTC PKHA hardware limit is 2048 bits (256 bytes) for integer arithmetic. + the LTC_MAX_INT_BYTES defines the size of local variables that hold big integers. */ + /* size is multiplication of 2 big ints */ + #if !defined(NO_RSA) || !defined(NO_DH) + #define LTC_MAX_INT_BYTES (256*2) + #else + #define LTC_MAX_INT_BYTES (48*2) + #endif + + /* This FREESCALE_LTC_TFM_RSA_4096_ENABLE macro can be defined. + * In such a case both software and hardware algorithm + * for TFM is linked in. The decision for which algorithm is used is determined at runtime + * from size of inputs. If inputs and result can fit into LTC (see LTC_MAX_INT_BYTES) + * then we call hardware algorithm, otherwise we call software algorithm. + * + * Chinese reminder theorem is used to break RSA 4096 exponentiations (both public and private key) + * into several computations with 2048-bit modulus and exponents. + */ + /* #define FREESCALE_LTC_TFM_RSA_4096_ENABLE */ + + /* ECC-384, ECC-256, ECC-224 and ECC-192 have been enabled with LTC PKHA acceleration */ + #ifdef HAVE_ECC + #undef ECC_TIMING_RESISTANT + #define ECC_TIMING_RESISTANT + + /* the LTC PKHA hardware limit is 512 bits (64 bytes) for ECC. + the LTC_MAX_ECC_BITS defines the size of local variables that hold ECC parameters + and point coordinates */ + #ifndef LTC_MAX_ECC_BITS + #define LTC_MAX_ECC_BITS (384) + #endif + + /* Enable curves up to 384 bits */ + #if !defined(ECC_USER_CURVES) && !defined(HAVE_ALL_CURVES) + #define ECC_USER_CURVES + #define HAVE_ECC192 + #define HAVE_ECC224 + #undef NO_ECC256 + #define HAVE_ECC384 + #endif + #endif + #endif + #endif +#endif /* FREESCALE_USE_LTC */ + +#ifdef FREESCALE_LTC_TFM_RSA_4096_ENABLE + #undef USE_CERT_BUFFERS_4096 + #define USE_CERT_BUFFERS_4096 + #undef FP_MAX_BITS + #define FP_MAX_BITS (8192) + #undef SP_INT_BITS + #define SP_INT_BITS (4096) + + #undef NO_DH + #define NO_DH + #undef NO_DSA + #define NO_DSA +#endif /* FREESCALE_LTC_TFM_RSA_4096_ENABLE */ + +/* if LTC has AES engine but doesn't have GCM, use software with LTC AES ECB mode */ +#if defined(FREESCALE_USE_LTC) && !defined(FREESCALE_LTC_AES_GCM) + #define GCM_TABLE +#endif + +#if defined(WOLFSSL_MAXQ1065) || defined(WOLFSSL_MAXQ108X) + + #define MAXQ10XX_MODULE_INIT + + #define HAVE_PK_CALLBACKS + #define WOLFSSL_STATIC_PSK + /* Server side support to be added at a later date. */ + #define NO_WOLFSSL_SERVER + + /* Need WOLFSSL_PUBLIC_ASN to use ProcessPeerCert callback. */ + #define WOLFSSL_PUBLIC_ASN + + #ifdef HAVE_PTHREAD + #define WOLFSSL_CRYPT_HW_MUTEX 1 + #define MAXQ10XX_MUTEX + #endif + + #define WOLFSSL_MAXQ10XX_CRYPTO + #define WOLFSSL_MAXQ10XX_TLS + + + #if defined(WOLFSSL_MAXQ1065) + #define MAXQ_DEVICE_ID 1065 + #elif defined(WOLFSSL_MAXQ108X) + #define MAXQ_DEVICE_ID 1080 + #else + #error "There is only support for MAXQ1065 or MAXQ1080" + #endif + + #if defined(WOLFSSL_TICKET_NONCE_MALLOC) + #error "WOLFSSL_TICKET_NONCE_MALLOC disables the HKDF expand callbacks." + #endif + +#endif /* WOLFSSL_MAXQ1065 || WOLFSSL_MAXQ108X */ + +#if defined(WOLFSSL_STM32F2) || defined(WOLFSSL_STM32F4) || \ + defined(WOLFSSL_STM32F7) || defined(WOLFSSL_STM32F1) || \ + defined(WOLFSSL_STM32L4) || defined(WOLFSSL_STM32L5) || \ + defined(WOLFSSL_STM32WB) || defined(WOLFSSL_STM32H7) || \ + defined(WOLFSSL_STM32G0) || defined(WOLFSSL_STM32U5) || \ + defined(WOLFSSL_STM32H5) || defined(WOLFSSL_STM32WL) || \ + defined(WOLFSSL_STM32G4) || defined(WOLFSSL_STM32MP13) || \ + defined(WOLFSSL_STM32H7S) || defined(WOLFSSL_STM32WBA) || \ + defined(WOLFSSL_STM32N6) + + #define SIZEOF_LONG_LONG 8 + #ifndef CHAR_BIT + #define CHAR_BIT 8 + #endif + #define NO_DEV_RANDOM + #define NO_WOLFSSL_DIR + #ifndef NO_STM32_RNG + #undef STM32_RNG + #define STM32_RNG + #ifdef WOLFSSL_STM32F427_RNG + #include "stm32f427xx.h" + #endif + #endif + #ifndef NO_STM32_CRYPTO + #undef STM32_CRYPTO + #define STM32_CRYPTO + + #if defined(WOLFSSL_STM32L4) || defined(WOLFSSL_STM32L5) || \ + defined(WOLFSSL_STM32WB) || defined(WOLFSSL_STM32U5) || \ + defined(WOLFSSL_STM32WL) || defined(WOLFSSL_STM32WBA) + #define NO_AES_192 /* hardware does not support 192-bit */ + #endif + #endif + #ifndef NO_STM32_HASH + #undef STM32_HASH + #define STM32_HASH + #endif + #if !defined(__GNUC__) && !defined(__ICCARM__) + #define KEIL_INTRINSICS + #endif + #define NO_OLD_RNGNAME + #ifdef WOLFSSL_STM32_CUBEMX + #if defined(WOLFSSL_STM32F1) + #include "stm32f1xx_hal.h" + #elif defined(WOLFSSL_STM32F2) + #include "stm32f2xx_hal.h" + #elif defined(WOLFSSL_STM32L5) + #include "stm32l5xx_hal.h" + #elif defined(WOLFSSL_STM32L4) + #include "stm32l4xx_hal.h" + #elif defined(WOLFSSL_STM32F4) + #include "stm32f4xx_hal.h" + #elif defined(WOLFSSL_STM32F7) + #include "stm32f7xx_hal.h" + #elif defined(WOLFSSL_STM32F1) + #include "stm32f1xx_hal.h" + #elif defined(WOLFSSL_STM32H7S) + #include "stm32h7rsxx_hal.h" + #elif defined(WOLFSSL_STM32H7) + #include "stm32h7xx_hal.h" + #elif defined(WOLFSSL_STM32WB) + #include "stm32wbxx_hal.h" + #elif defined(WOLFSSL_STM32WL) + #include "stm32wlxx_hal.h" + #elif defined(WOLFSSL_STM32G0) + #include "stm32g0xx_hal.h" + #elif defined(WOLFSSL_STM32G4) + #include "stm32g4xx_hal.h" + #elif defined(WOLFSSL_STM32U5) + #include "stm32u5xx_hal.h" + #elif defined(WOLFSSL_STM32H5) + #include "stm32h5xx_hal.h" + #elif defined(WOLFSSL_STM32N6) + #include "stm32n6xx_hal.h" + #elif defined(WOLFSSL_STM32MP13) + /* HAL headers error on our ASM files */ + #ifndef __ASSEMBLER__ + #include "stm32mp13xx_hal.h" + #include "stm32mp13xx_hal_conf.h" + #endif + #elif defined(WOLFSSL_STM32WBA) + #include "stm32wbaxx_hal.h" + #endif + #if defined(WOLFSSL_CUBEMX_USE_LL) && defined(WOLFSSL_STM32L4) + #include "stm32l4xx_ll_rng.h" + #endif + + #ifndef STM32_HAL_TIMEOUT + #define STM32_HAL_TIMEOUT 0xFF + #endif + + #if defined(WOLFSSL_STM32_PKA) && !defined(WOLFSSL_SP_INT_NEGATIVE) + /* enable the negative support for abs(a) |a| */ + #define WOLFSSL_SP_INT_NEGATIVE + #endif + #else + #if defined(WOLFSSL_STM32F2) + #include "stm32f2xx.h" + #ifdef STM32_CRYPTO + #include "stm32f2xx_cryp.h" + #endif + #ifdef STM32_HASH + #include "stm32f2xx_hash.h" + #endif + #elif defined(WOLFSSL_STM32F4) + #include "stm32f4xx.h" + #ifdef STM32_CRYPTO + #include "stm32f4xx_cryp.h" + #endif + #ifdef STM32_HASH + #include "stm32f4xx_hash.h" + #endif + #elif defined(WOLFSSL_STM32L5) + #include "stm32l5xx.h" + #ifdef STM32_CRYPTO + #include "stm32l5xx_cryp.h" + #endif + #ifdef STM32_HASH + #include "stm32l5xx_hash.h" + #endif + #elif defined(WOLFSSL_STM32L4) + #include "stm32l4xx.h" + #ifdef STM32_CRYPTO + #include "stm32l4xx_cryp.h" + #endif + #ifdef STM32_HASH + #include "stm32l4xx_hash.h" + #endif + #elif defined(WOLFSSL_STM32F7) + #include "stm32f7xx.h" + #elif defined(WOLFSSL_STM32H7) + #include "stm32h7xx.h" + #elif defined(WOLFSSL_STM32F1) + #include "stm32f1xx.h" + #endif + #endif /* WOLFSSL_STM32_CUBEMX */ +#endif /* WOLFSSL_STM32* */ +#ifdef WOLFSSL_DEOS + #include <deos.h> + #include <timeout.h> + #include <socketapi.h> + #include <lwip-socket.h> + #include <mem.h> + #include <string.h> + #include <stdlib.h> /* for rand_r: pseudo-random number generator */ + #include <stdio.h> /* for snprintf */ + + /* use external memory XMALLOC, XFREE and XREALLOC functions */ + #define XMALLOC_USER + + /* disable fall-back case, malloc, realloc and free are unavailable */ + #define WOLFSSL_NO_MALLOC + + /* file system has not been ported since it is a separate product. */ + + #define NO_FILESYSTEM + + #ifdef NO_FILESYSTEM + #define NO_WOLFSSL_DIR + #define NO_WRITEV + #endif + + #define TFM_TIMING_RESISTANT + #define ECC_TIMING_RESISTANT + #define WC_RSA_BLINDING + + #define HAVE_ECC + #define TFM_ECC192 + #define TFM_ECC224 + #define TFM_ECC256 + #define TFM_ECC384 + #define TFM_ECC521 + + #define HAVE_TLS_EXTENSIONS + #define HAVE_SUPPORTED_CURVES + #define HAVE_EXTENDED_MASTER + + #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) + #define BIG_ENDIAN_ORDER + #else + #undef BIG_ENDIAN_ORDER + #define LITTLE_ENDIAN_ORDER + #endif +#endif /* WOLFSSL_DEOS*/ + +#ifdef MICRIUM + #include <stdlib.h> + #include <os.h> + #include <app_cfg.h> + #if defined(RTOS_MODULE_NET_AVAIL) || (APP_CFG_TCPIP_EN == DEF_ENABLED) + #include <net_cfg.h> + #include <net_sock.h> + #if (OS_VERSION < 50000) + #include <net_err.h> + #endif + #endif + #include <lib_mem.h> + #include <lib_math.h> + #include <lib_str.h> + #include <stdio.h> + #include <string.h> + + #define TFM_TIMING_RESISTANT + #define ECC_TIMING_RESISTANT + #define WC_RSA_BLINDING + #define HAVE_HASHDRBG + + #define HAVE_ECC + #if !defined(WOLFSSL_STATIC_MEMORY) && !defined(WOLFSSL_NO_MALLOC) + #define ALT_ECC_SIZE + #endif + #define TFM_ECC192 + #define TFM_ECC224 + #define TFM_ECC256 + #define TFM_ECC384 + #define TFM_ECC521 + + #define NO_RC4 + #define HAVE_TLS_EXTENSIONS + #define HAVE_SUPPORTED_CURVES + #define HAVE_EXTENDED_MASTER + + #define NO_WOLFSSL_DIR + #define NO_WRITEV + + #if !defined(WOLFSSL_SILABS_SE_ACCEL) && !defined(STM32_RNG) && \ + !defined(CUSTOM_RAND_GENERATE) + #define CUSTOM_RAND_TYPE RAND_NBR + #define CUSTOM_RAND_GENERATE Math_Rand + #endif + #define STRING_USER + #define XSTRCASECMP(s1,s2) strcasecmp((s1),(s2)) + #define XSTRCMP(s1,s2) strcmp((s1),(s2)) + #define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr))) + #define XSTRNCPY(pstr_dest, pstr_src, len_max) \ + ((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \ + (CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max))) + #define XSTRNCMP(pstr_1, pstr_2, len_max) \ + ((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \ + (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max))) + #define XSTRNCASECMP(pstr_1, pstr_2, len_max) \ + ((CPU_INT16S)Str_CmpIgnoreCase_N((CPU_CHAR *)(pstr_1), \ + (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max))) + #define XSTRSTR(pstr, pstr_srch) \ + ((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \ + (CPU_CHAR *)(pstr_srch))) + #define XSTRNSTR(pstr, pstr_srch, len_max) \ + ((CPU_CHAR *)Str_Str_N((CPU_CHAR *)(pstr), \ + (CPU_CHAR *)(pstr_srch),(CPU_SIZE_T)(len_max))) + #define XSTRNCAT(pstr_dest, pstr_cat, len_max) \ + ((CPU_CHAR *)Str_Cat_N((CPU_CHAR *)(pstr_dest), \ + (const CPU_CHAR *)(pstr_cat),(CPU_SIZE_T)(len_max))) + #ifndef XATOI /* if custom XATOI is not already defined */ + #define XATOI(s) atoi((s)) + #endif + #if defined(USE_WOLF_STRTOK) + #define XSTRTOK(s1, d, ptr) wc_strtok((s1), (d), (ptr)) + #else + #define XSTRTOK(s1, d, ptr) strtok_r((s1), (d), (ptr)) + #endif + #define XMEMSET(pmem, data_val, size) \ + ((void)Mem_Set((void *)(pmem), \ + (CPU_INT08U) (data_val), \ + (CPU_SIZE_T)(size))) + #define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \ + (void *)(psrc), (CPU_SIZE_T)(size))) + + #if (OS_VERSION < 50000) + #define XMEMCMP(pmem_1, pmem_2, size) \ + (((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), \ + (void *)(pmem_2), \ + (CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES) + #else + /* Work around for Micrium OS version 5.8 change in behavior + * that returns DEF_NO for 0 size compare + */ + #define XMEMCMP(pmem_1, pmem_2, size) \ + (( (size < 1 ) || \ + ((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), \ + (void *)(pmem_2), \ + (CPU_SIZE_T)(size)) == DEF_YES)) \ + ? 0 : 1) + #define XSNPRINTF snprintf + #endif + + #define XMEMMOVE(pdest, psrc, size) ((void)Mem_Move((void *)(pdest), \ + (void *)(psrc), (CPU_SIZE_T)(size))) + + #if (OS_CFG_MUTEX_EN == DEF_DISABLED) + #define SINGLE_THREADED + #endif + + #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG) + #define BIG_ENDIAN_ORDER + #else + #undef BIG_ENDIAN_ORDER + #define LITTLE_ENDIAN_ORDER + #endif +#endif /* MICRIUM */ + +#if defined(sun) || defined(__sun) +# if defined(__SVR4) || defined(__svr4__) + /* Solaris */ + #ifndef WOLFSSL_SOLARIS + #define WOLFSSL_SOLARIS + #endif +# else + /* SunOS */ +# endif +#endif + +#ifdef WOLFSSL_SOLARIS + /* Avoid naming clash with fp_zero from math.h > ieefp.h */ + #define WOLFSSL_DH_CONST +#endif + +#ifdef WOLFSSL_MCF5441X + #define BIG_ENDIAN_ORDER + #ifndef SIZEOF_LONG + #define SIZEOF_LONG 4 + #endif + #ifndef SIZEOF_LONG_LONG + #define SIZEOF_LONG_LONG 8 + #endif +#endif + +#ifdef WOLFSSL_QL + #ifndef WOLFSSL_SEP + #define WOLFSSL_SEP + #endif + #ifndef OPENSSL_EXTRA + #define OPENSSL_EXTRA + #endif + #ifndef SESSION_CERTS + #define SESSION_CERTS + #endif + #ifndef HAVE_AESCCM + #define HAVE_AESCCM + #endif + #ifndef ATOMIC_USER + #define ATOMIC_USER + #endif + #ifndef WOLFSSL_DER_LOAD + #define WOLFSSL_DER_LOAD + #endif + #ifndef KEEP_PEER_CERT + #define KEEP_PEER_CERT + #endif + #ifndef HAVE_ECC + #define HAVE_ECC + #endif + #ifndef SESSION_INDEX + #define SESSION_INDEX + #endif +#endif /* WOLFSSL_QL */ + + +#if defined(WOLFSSL_XILINX) + #if !defined(WOLFSSL_XILINX_CRYPT_VERSAL) + #define NO_DEV_RANDOM + #endif + #undef NO_WOLFSSL_DIR + #define NO_WOLFSSL_DIR + + #undef HAVE_AESGCM + #define HAVE_AESGCM +#endif + +/* Detect Cortex M3 (no UMAAL) */ +#if defined(__ARM_ARCH_7M__) && !defined(WOLFSSL_ARM_ARCH_7M) + #define WOLFSSL_ARM_ARCH_7M +#endif +#if defined(WOLFSSL_SP_ARM_CORTEX_M_ASM) && defined(WOLFSSL_ARM_ARCH_7M) + #undef WOLFSSL_SP_NO_UMAAL + #define WOLFSSL_SP_NO_UMAAL +#endif + +#if defined(WOLFSSL_XILINX_CRYPT) || defined(WOLFSSL_AFALG_XILINX) + #if defined(WOLFSSL_ARMASM) + #error can not use both ARMv8 instructions and XILINX hardened crypto + #endif + #if defined(WOLFSSL_SHA3) + /* only SHA3-384 is supported */ + #undef WOLFSSL_NOSHA3_224 + #undef WOLFSSL_NOSHA3_256 + #undef WOLFSSL_NOSHA3_512 + #define WOLFSSL_NOSHA3_224 + #define WOLFSSL_NOSHA3_256 + #define WOLFSSL_NOSHA3_512 + #ifndef WOLFSSL_NO_SHAKE128 + #define WOLFSSL_NO_SHAKE128 + #endif + #ifndef WOLFSSL_NO_SHAKE256 + #define WOLFSSL_NO_SHAKE256 + #endif + #endif + #ifdef WOLFSSL_AFALG_XILINX_AES + #undef WOLFSSL_AES_DIRECT + #define WOLFSSL_AES_DIRECT + #endif +#endif /*(WOLFSSL_XILINX_CRYPT)*/ + +#ifdef WOLFSSL_KCAPI_AES + #define WOLFSSL_AES_GCM_FIXED_IV_AAD +#endif +#ifdef WOLFSSL_KCAPI_ECC + #undef ECC_USER_CURVES + #define ECC_USER_CURVES + #undef NO_ECC256 + #undef HAVE_ECC384 + #define HAVE_ECC384 + #undef HAVE_ECC521 + #define HAVE_ECC521 +#endif + +#if defined(WOLFSSL_APACHE_MYNEWT) + #include "os/os_malloc.h" + #if !defined(WOLFSSL_LWIP) + #include <mn_socket/mn_socket.h> + #endif + + #if !defined(SIZEOF_LONG) + #define SIZEOF_LONG 4 + #endif + #if !defined(SIZEOF_LONG_LONG) + #define SIZEOF_LONG_LONG 8 + #endif + #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) + #define BIG_ENDIAN_ORDER + #else + #undef BIG_ENDIAN_ORDER + #define LITTLE_ENDIAN_ORDER + #endif + #define NO_WRITEV + #define WOLFSSL_USER_IO + #define SINGLE_THREADED + #define NO_DEV_RANDOM + #define NO_DH + #define NO_WOLFSSL_DIR + #define NO_ERROR_STRINGS + #define HAVE_ECC + #define NO_SESSION_CACHE + #define NO_ERROR_STRINGS + #define XMALLOC_USER + #define XMALLOC(sz, heap, type) ((void)(heap), (void)(type), os_malloc(sz)) + #define XREALLOC(p, sz, heap, type) ((void)(heap), (void)(type), os_realloc(p, sz)) + #define XFREE(p, heap, type) ((void)(heap), (void)(type), os_free(p)) + +#endif /*(WOLFSSL_APACHE_MYNEWT)*/ + +#ifdef WOLFSSL_ZEPHYR + #include <version.h> +#if KERNEL_VERSION_NUMBER >= 0x30100 + #include <zephyr/kernel.h> + #include <zephyr/sys/printk.h> + #include <zephyr/sys/util.h> +#else + #include <kernel.h> + #include <sys/printk.h> + #include <sys/util.h> +#endif + #include <stdlib.h> + + #define WOLFSSL_DH_CONST + #define WOLFSSL_HAVE_MAX + #define NO_WRITEV + #define NO_STDLIB_ISASCII + + #define USE_FLAT_BENCHMARK_H + #define USE_FLAT_TEST_H + #define EXIT_FAILURE 1 + #define MAIN_NO_ARGS + + void *z_realloc(void *ptr, size_t size); + #define realloc z_realloc + #define max MAX + + #if !defined(CONFIG_NET_SOCKETS_POSIX_NAMES) && !defined(CONFIG_POSIX_API) + #define CONFIG_NET_SOCKETS_POSIX_NAMES + #endif +#endif /* WOLFSSL_ZEPHYR */ + +#ifdef WOLFSSL_IMX6 + #ifndef SIZEOF_LONG_LONG + #define SIZEOF_LONG_LONG 8 + #endif +#endif + +/* Setting supported CAAM algorithms */ +#ifdef WOLFSSL_IMX6Q_CAAM + #undef WOLFSSL_CAAM + #define WOLFSSL_CAAM + + /* hardware does not support AES-GCM and ECC + * has the low power AES module only (no high power with GCM) */ + #define WOLFSSL_LP_ONLY_CAAM_AES + #define WOLFSSL_NO_CAAM_ECC +#endif + +#ifdef WOLFSSL_SECO_CAAM + #define WOLFSSL_CAAM + + #define WOLFSSL_HASH_KEEP + #define WOLFSSL_NO_CAAM_BLOB +#endif + +#ifdef WOLFSSL_IMXRT1170_CAAM + #define WOLFSSL_CAAM +#endif + +/* OS specific support so far */ +#ifdef WOLFSSL_QNX_CAAM + /* shim layer for QNX hashing not yet implemented */ + #define WOLFSSL_NO_CAAM_HASH +#endif + +#ifdef WOLFSSL_CAAM + /* switch for all AES type algos */ + #undef WOLFSSL_CAAM_CIPHER + #define WOLFSSL_CAAM_CIPHER + #ifdef WOLFSSL_CAAM_CIPHER + #ifndef WOLFSSL_LP_ONLY_CAAM_AES + /* GCM and XTS mode are only available in the high power module */ + #define WOLFSSL_CAAM_AESGCM + #define WOLFSSL_CAAM_AESXTS + #endif + #define WOLFSSL_CAAM_AESCCM + #define WOLFSSL_CAAM_AESCTR + #define WOLFSSL_CAAM_AESCBC + #define WOLFSSL_CAAM_CMAC + #endif /* WOLFSSL_CAAM_CIPHER */ + #if defined(HAVE_AESGCM) || defined(WOLFSSL_AES_XTS) || \ + defined(WOLFSSL_CMAC) + /* large performance gain with HAVE_AES_ECB defined */ + #undef HAVE_AES_ECB + #define HAVE_AES_ECB + + /* @TODO used for now until plugging in caam aes use with qnx */ + #undef WOLFSSL_AES_DIRECT + #define WOLFSSL_AES_DIRECT + #endif + + /* switch for all hashing algos */ + #ifndef WOLFSSL_NO_CAAM_HASH + #define WOLFSSL_CAAM_HASH + #endif + #if defined(WOLFSSL_DEVCRYPTO_HMAC) + /* HMAC is through the devcrypto calls */ + #define WOLFSSL_CAAM_HMAC + #endif + + /* public key operations */ + #ifndef WOLFSSL_NO_CAAM_ECC + #undef WOLFSSL_CAAM_ECC + #define WOLFSSL_CAAM_ECC + #endif + + /* so far curve25519 support was only done with the SECO */ + #ifdef WOLFSSL_SECO_CAAM + #define WOLFSSL_CAAM_CURVE25519 + #endif + + /* Blob support */ + #ifndef WOLFSSL_NO_CAAM_BLOB + #define WOLFSSL_CAAM_BLOB + #endif +#endif + +#if defined(NO_WC_SSIZE_TYPE) || defined(ssize_t) + /* ssize_t comes from system headers or user_settings.h */ +#elif defined(WC_SSIZE_TYPE) + typedef WC_SSIZE_TYPE ssize_t; +#elif defined(_MSC_VER) + #include <BaseTsd.h> + typedef SSIZE_T ssize_t; +#endif + +/* If DCP is used without SINGLE_THREADED, enforce WOLFSSL_CRYPT_HW_MUTEX */ +#if defined(WOLFSSL_IMXRT_DCP) && !defined(SINGLE_THREADED) + #undef WOLFSSL_CRYPT_HW_MUTEX + #define WOLFSSL_CRYPT_HW_MUTEX 1 +#endif + +#if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \ + !defined(WOLFSSL_LEANPSK) && !defined(NO_WOLFSSL_MEMORY) && \ + !defined(XMALLOC_OVERRIDE) + #define USE_WOLFSSL_MEMORY +#endif + +#ifdef WOLFSSL_EMBOS + #include "RTOS.h" + #if !defined(XMALLOC_USER) && !defined(NO_WOLFSSL_MEMORY) && \ + !defined(WOLFSSL_STATIC_MEMORY) + /* Per the user manual of embOS https://www.segger.com/downloads/embos/UM01001 + * this API has changed with V5. */ + #if (OS_VERSION >= 50000U) + #define XMALLOC(s, h, type) ((void)(h), (void)(type), OS_HEAP_malloc((s))) + #define XFREE(p, h, type) ((void)(h), (void)(type), OS_HEAP_free((p))) + #define XREALLOC(p, n, h, t) ((void)(h), (void)(t), OS_HEAP_realloc((p), (n))) + #else + #define XMALLOC(s, h, type) ((void)(h), (void)(type), OS_malloc((s))) + #define XFREE(p, h, type) ((void)(h), (void)(type), OS_free((p))) + #define XREALLOC(p, n, h, t) ((void)(h), (void)(t), OS_realloc((p), (n))) + #endif + #endif +#endif + + +/* stream ciphers except arc4 need 32bit alignment, intel ok without */ +#ifndef XSTREAM_ALIGN + #if defined(__x86_64__) || defined(__ia64__) || defined(__i386__) + #define NO_XSTREAM_ALIGN + #else + #define XSTREAM_ALIGN + #endif +#endif + +/* write dup cannot be used with secure renegotiation because write dup + * make write side write only and read side read only */ +#if defined(HAVE_WRITE_DUP) && defined(HAVE_SECURE_RENEGOTIATION) + #error "WRITE DUP and SECURE RENEGOTIATION cannot both be on" +#endif + +#ifdef WOLFSSL_SGX + #ifdef _MSC_VER + #define NO_RC4 + #ifndef HAVE_FIPS + #define WOLFCRYPT_ONLY + #define NO_DES3 + #define NO_SHA + #define NO_MD5 + #else + #define TFM_TIMING_RESISTANT + #define NO_WOLFSSL_DIR + #define NO_WRITEV + #define NO_MAIN_DRIVER + #define WOLFSSL_LOG_PRINTF + #define WOLFSSL_DH_CONST + #endif + #else + #define HAVE_ECC + #define NO_WRITEV + #define NO_MAIN_DRIVER + #define USER_TICKS + #define WOLFSSL_LOG_PRINTF + #define WOLFSSL_DH_CONST + #endif /* _MSC_VER */ + #if !defined(HAVE_FIPS) && !defined(NO_RSA) + #define WC_RSA_BLINDING + #endif + + #define NO_FILESYSTEM + #define ECC_TIMING_RESISTANT + #define TFM_TIMING_RESISTANT + #define SINGLE_THREADED + #define NO_ASN_TIME /* can not use headers such as windows.h */ + #define HAVE_AESGCM + #define USE_CERT_BUFFERS_2048 +#endif /* WOLFSSL_SGX */ + +/* FreeScale MMCAU hardware crypto has 4 byte alignment. + However, KSDK fsl_mmcau.h gives API with no alignment + requirements (4 byte alignment is managed internally by fsl_mmcau.c) */ +#ifdef FREESCALE_MMCAU + #ifdef FREESCALE_MMCAU_CLASSIC + #define WOLFSSL_MMCAU_ALIGNMENT 4 + #else + #define WOLFSSL_MMCAU_ALIGNMENT 0 + #endif +#endif + +/* if using hardware crypto and have alignment requirements, specify the + requirement here. The record header of SSL/TLS will prevent easy alignment. + This hint tries to help as much as possible. */ +#ifndef WOLFSSL_GENERAL_ALIGNMENT + #ifdef WOLFSSL_AESNI + #define WOLFSSL_GENERAL_ALIGNMENT 16 + #elif defined(XSTREAM_ALIGN) + #define WOLFSSL_GENERAL_ALIGNMENT 4 + #elif defined(FREESCALE_MMCAU) || defined(FREESCALE_MMCAU_CLASSIC) + #define WOLFSSL_GENERAL_ALIGNMENT WOLFSSL_MMCAU_ALIGNMENT + #else + #define WOLFSSL_GENERAL_ALIGNMENT 0 + #endif +#endif + +#if defined(WOLFSSL_GENERAL_ALIGNMENT) && (WOLFSSL_GENERAL_ALIGNMENT > 0) + #if defined(_MSC_VER) + #define XGEN_ALIGN __declspec(align(WOLFSSL_GENERAL_ALIGNMENT)) + #elif defined(__GNUC__) + #define XGEN_ALIGN __attribute__((aligned(WOLFSSL_GENERAL_ALIGNMENT))) + #else + #define XGEN_ALIGN + #endif +#else + #define XGEN_ALIGN +#endif + +#if defined(__mips) || defined(__mips64) || \ + defined(WOLFSSL_SP_MIPS64) || defined(WOLFSSL_SP_MIPS) || \ + defined(__sparc) || defined(__arm__) || defined(__aarch64__) + /* This setting currently only affects big endian targets, currently + * only in sp_read_unsigned_bin(). + */ + #undef WOLFSSL_SP_INT_DIGIT_ALIGN + #define WOLFSSL_SP_INT_DIGIT_ALIGN +#endif + +#if defined(__APPLE__) || defined(WOLF_C89) + #define WOLFSSL_SP_NO_DYN_STACK +#endif + +#if defined(__WATCOMC__) && !defined(WOLF_NO_VARIADIC_MACROS) + #define WOLF_NO_VARIADIC_MACROS +#endif + +#ifdef __INTEL_COMPILER + #pragma warning(disable:2259) /* explicit casts to smaller sizes, disable */ +#endif + +/* --------------------------------------------------------------------------- + * Math Library Selection (in order of preference) + * --------------------------------------------------------------------------- + */ +#if !defined(HAVE_FIPS_VERSION) || \ + (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 5)) + #if defined(WOLFSSL_SP_MATH_ALL) + /* 1) SP Math: wolfSSL proprietary math implementation (sp_int.c). + * Constant time: Always + * Enable: WOLFSSL_SP_MATH_ALL + */ + #undef USE_FAST_MATH + #undef USE_INTEGER_HEAP_MATH + #elif defined(WOLFSSL_SP_MATH) + /* 2) SP Math with restricted key sizes: wolfSSL proprietary math + * implementation (sp_*.c). + * Constant time: Always + * Enable: WOLFSSL_SP_MATH + */ + #undef USE_FAST_MATH + #undef USE_INTEGER_HEAP_MATH + #elif defined(USE_FAST_MATH) + /* 3) Tom's Fast Math: Stack based (tfm.c) + * Constant time: Only with TFM_TIMING_RESISTANT + * Enable: USE_FAST_MATH + */ + #undef USE_INTEGER_HEAP_MATH + #elif defined(USE_INTEGER_HEAP_MATH) + /* 4) Integer Heap Math: Heap based (integer.c) + * Constant time: Not supported + * Enable: USE_INTEGER_HEAP_MATH + */ + #elif defined(NO_BIG_INT) + /* 5) No big integer math libraries + */ + #else + /* default is SP Math. */ + #define WOLFSSL_SP_MATH_ALL + #endif +#elif defined(WOLFCRYPT_FIPS_RAND) + #ifndef NO_BIG_INT + #define NO_BIG_INT + #endif +#else + /* FIPS 140-2 or older */ + /* Default to fast math (tfm.c), but allow heap math (integer.c) */ + #if !defined(USE_INTEGER_HEAP_MATH) + #undef USE_FAST_MATH + #define USE_FAST_MATH + #ifndef FP_MAX_BITS + #define FP_MAX_BITS 8192 + #endif + #endif +#endif + +/* Verify that only one of the above multi-precision math libraries is enabled */ +#if (defined(WOLFSSL_SP_MATH_ALL) && \ + (defined(USE_FAST_MATH) || defined(USE_INTEGER_HEAP_MATH))) || \ + (defined(USE_FAST_MATH) && defined(USE_INTEGER_HEAP_MATH)) + #error Cannot enable more than one multiple precision math library! +#endif +/*----------------------------------------------------------------------------*/ + +/* SP Math specific options */ +/* Determine when mp_add_d is required. */ +#if !defined(NO_PWDBASED) || defined(WOLFSSL_KEY_GEN) || !defined(NO_DH) || \ + !defined(NO_DSA) || defined(HAVE_ECC) || \ + (!defined(NO_RSA) && !defined(WOLFSSL_RSA_VERIFY_ONLY)) || \ + defined(OPENSSL_EXTRA) + #define WOLFSSL_SP_ADD_D +#endif + +/* Determine when mp_sub_d is required. */ +#if (!defined(NO_RSA) && !defined(WOLFSSL_RSA_VERIFY_ONLY)) || \ + !defined(NO_DH) || defined(HAVE_ECC) || !defined(NO_DSA) + #define WOLFSSL_SP_SUB_D +#endif + +/* Determine when mp_read_radix with a radix of 10 is required. */ +#if (defined(WOLFSSL_SP_MATH_ALL) && !defined(NO_RSA) && \ + !defined(WOLFSSL_RSA_VERIFY_ONLY)) || defined(HAVE_ECC) || \ + !defined(NO_DSA) || defined(OPENSSL_EXTRA) || defined(WOLFSSL_PUBLIC_MP) + #define WOLFSSL_SP_READ_RADIX_16 +#endif + +/* Determine when mp_read_radix with a radix of 10 is required. */ +#if defined(WOLFSSL_SP_MATH_ALL) && !defined(NO_RSA) && \ + !defined(WOLFSSL_RSA_VERIFY_ONLY) + #define WOLFSSL_SP_READ_RADIX_10 +#endif + +/* Determine when mp_invmod is required. */ +#if defined(HAVE_ECC) || !defined(NO_DSA) || defined(OPENSSL_EXTRA) || \ + (!defined(NO_RSA) && !defined(WOLFSSL_RSA_VERIFY_ONLY) && \ + !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || defined(OPENSSL_EXTRA) + #define WOLFSSL_SP_INVMOD +#endif + +/* Determine when mp_invmod_mont_ct is required. */ +#if defined(WOLFSSL_SP_MATH_ALL) && defined(HAVE_ECC) + #define WOLFSSL_SP_INVMOD_MONT_CT +#endif + +/* Determine when mp_prime_gen is required. */ +#if (defined(WOLFSSL_SP_MATH_ALL) && !defined(WOLFSSL_RSA_VERIFY_ONLY) && \ + !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || !defined(NO_DH) || \ + (!defined(NO_RSA) && defined(WOLFSSL_KEY_GEN)) + #define WOLFSSL_SP_PRIME_GEN +#endif + +#if (defined(WOLFSSL_SP_MATH_ALL) && !defined(WOLFSSL_RSA_VERIFY_ONLY)) || \ + (defined(WOLFSSL_KEY_GEN) && !defined(NO_RSA)) || defined(OPENSSL_EXTRA) + /* Determine when mp_mul_d is required */ + #define WOLFSSL_SP_MUL_D +#endif + + +/* user can specify what curves they want with ECC_USER_CURVES otherwise + * all curves are on by default for now */ +#ifndef ECC_USER_CURVES + #ifdef WOLFSSL_SP_MATH + /* for single precision math only make sure the enabled key sizes are + * included in the ECC curve table */ + #if defined(WOLFSSL_SP_NO_256) && !defined(NO_ECC256) + #define NO_ECC256 + #endif + #if defined(WOLFSSL_SP_384) && !defined(HAVE_ECC384) + #define HAVE_ECC384 + #endif + #if defined(WOLFSSL_SP_521) && !defined(HAVE_ECC521) + #define HAVE_ECC521 + #endif + #elif !defined(HAVE_ALL_CURVES) + #define HAVE_ALL_CURVES + #endif +#endif + +/* The minimum allowed ECC key size */ +/* Note: 224-bits is equivalent to 2048-bit RSA */ +#ifndef ECC_MIN_KEY_SZ + #ifdef WOLFSSL_MIN_ECC_BITS + #define ECC_MIN_KEY_SZ WOLFSSL_MIN_ECC_BITS + #else + #if defined(WOLFSSL_HARDEN_TLS) && \ + !defined(WOLFSSL_HARDEN_TLS_NO_PKEY_CHECK) + /* Using guidance from section 5.6.1 + * https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-57pt1r5.pdf */ + #if WOLFSSL_HARDEN_TLS >= 128 + #define ECC_MIN_KEY_SZ 256 + #elif WOLFSSL_HARDEN_TLS >= 112 + #define ECC_MIN_KEY_SZ 224 + #endif + #elif FIPS_VERSION_GE(2,0) + /* FIPSv2 and ready (for now) includes 192-bit support */ + #define ECC_MIN_KEY_SZ 192 + #else + #define ECC_MIN_KEY_SZ 224 + #endif + #endif +#endif + +#if defined(WOLFSSL_HARDEN_TLS) && ECC_MIN_KEY_SZ < 224 && \ + !defined(WOLFSSL_HARDEN_TLS_NO_PKEY_CHECK) + /* Implementations MUST NOT negotiate cipher suites offering less than + * 112 bits of security. + * https://www.rfc-editor.org/rfc/rfc9325#section-4.1 + * Using guidance from section 5.6.1 + * https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-57pt1r5.pdf */ + #error "For 112 bits of security ECC needs at least 224 bit keys" +#endif + +/* ECC Configs */ +#ifdef HAVE_ECC + /* By default enable Sign, Verify, DHE, Key Import and Key Export unless + * explicitly disabled */ + #if !defined(NO_ECC_SIGN) && \ + (!defined(ECC_TIMING_RESISTANT) || \ + (defined(ECC_TIMING_RESISTANT) && !defined(WC_NO_RNG))) + #undef HAVE_ECC_SIGN + #define HAVE_ECC_SIGN + #endif + #ifndef NO_ECC_VERIFY + #undef HAVE_ECC_VERIFY + #define HAVE_ECC_VERIFY + #endif + #ifndef NO_ECC_CHECK_KEY + #undef HAVE_ECC_CHECK_KEY + #define HAVE_ECC_CHECK_KEY + #endif + #if !defined(NO_ECC_DHE) && !defined(WC_NO_RNG) + #undef HAVE_ECC_DHE + #define HAVE_ECC_DHE + #endif + #ifndef NO_ECC_KEY_IMPORT + #undef HAVE_ECC_KEY_IMPORT + #define HAVE_ECC_KEY_IMPORT + #endif + /* The ECC key export requires mp_int or SP */ + #if (!defined(NO_ECC_KEY_EXPORT) && defined(WOLFSSL_SP_MATH)) || \ + (!defined(NO_ECC_KEY_EXPORT) && !defined(NO_BIG_INT)) + #undef HAVE_ECC_KEY_EXPORT + #define HAVE_ECC_KEY_EXPORT + #endif +#endif /* HAVE_ECC */ + +#if (defined(OPENSSL_EXTRA) || defined(OPENSSL_ALL)) && defined(HAVE_ECC) && \ + !defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A) && \ + !defined(WOLFSSL_CRYPTOCELL) && !defined(WOLFSSL_SE050) && \ + !defined(WOLF_CRYPTO_CB_ONLY_ECC) && !defined(WOLFSSL_STM32_PKA) + #undef USE_ECC_B_PARAM + #define USE_ECC_B_PARAM +#endif + +/* Curve25519 Configs */ +#ifdef HAVE_CURVE25519 + /* By default enable shared secret, key export and import */ + #ifndef NO_CURVE25519_SHARED_SECRET + #undef HAVE_CURVE25519_SHARED_SECRET + #define HAVE_CURVE25519_SHARED_SECRET + #endif + #ifndef NO_CURVE25519_KEY_EXPORT + #undef HAVE_CURVE25519_KEY_EXPORT + #define HAVE_CURVE25519_KEY_EXPORT + #endif + #ifndef NO_CURVE25519_KEY_IMPORT + #undef HAVE_CURVE25519_KEY_IMPORT + #define HAVE_CURVE25519_KEY_IMPORT + #endif +#endif /* HAVE_CURVE25519 */ + +/* Ed25519 Configs */ +#ifdef HAVE_ED25519 + /* By default enable make key, sign, verify, key export and import */ + #ifndef NO_ED25519_MAKE_KEY + #undef HAVE_ED25519_MAKE_KEY + #define HAVE_ED25519_MAKE_KEY + #endif + #ifndef NO_ED25519_SIGN + #ifndef HAVE_ED25519_MAKE_KEY + #error "Need HAVE_ED25519_MAKE_KEY with HAVE_ED25519_SIGN" + #endif + #undef HAVE_ED25519_SIGN + #define HAVE_ED25519_SIGN + #endif + #ifndef NO_ED25519_VERIFY + #undef HAVE_ED25519_VERIFY + #define HAVE_ED25519_VERIFY + #ifdef WOLFSSL_ED25519_STREAMING_VERIFY + #undef WOLFSSL_ED25519_PERSISTENT_SHA + #define WOLFSSL_ED25519_PERSISTENT_SHA + #endif + #endif + #ifndef NO_ED25519_KEY_EXPORT + #undef HAVE_ED25519_KEY_EXPORT + #define HAVE_ED25519_KEY_EXPORT + #endif + #ifndef NO_ED25519_KEY_IMPORT + #undef HAVE_ED25519_KEY_IMPORT + #define HAVE_ED25519_KEY_IMPORT + #endif +#endif /* HAVE_ED25519 */ + +/* Curve448 Configs */ +#ifdef HAVE_CURVE448 + /* By default enable shared secret, key export and import */ + #ifndef NO_CURVE448_SHARED_SECRET + #undef HAVE_CURVE448_SHARED_SECRET + #define HAVE_CURVE448_SHARED_SECRET + #endif + #ifndef NO_CURVE448_KEY_EXPORT + #undef HAVE_CURVE448_KEY_EXPORT + #define HAVE_CURVE448_KEY_EXPORT + #endif + #ifndef NO_CURVE448_KEY_IMPORT + #undef HAVE_CURVE448_KEY_IMPORT + #define HAVE_CURVE448_KEY_IMPORT + #endif +#endif /* HAVE_CURVE448 */ + +/* Ed448 Configs */ +#ifdef HAVE_ED448 + /* By default enable sign, verify, key export and import */ + #ifndef NO_ED448_SIGN + #undef HAVE_ED448_SIGN + #define HAVE_ED448_SIGN + #endif + #ifndef NO_ED448_VERIFY + #undef HAVE_ED448_VERIFY + #define HAVE_ED448_VERIFY + #ifdef WOLFSSL_ED448_STREAMING_VERIFY + #undef WOLFSSL_ED448_PERSISTENT_SHA + #define WOLFSSL_ED448_PERSISTENT_SHA + #endif + #endif + #ifndef NO_ED448_KEY_EXPORT + #undef HAVE_ED448_KEY_EXPORT + #define HAVE_ED448_KEY_EXPORT + #endif + #ifndef NO_ED448_KEY_IMPORT + #undef HAVE_ED448_KEY_IMPORT + #define HAVE_ED448_KEY_IMPORT + #endif +#endif /* HAVE_ED448 */ + + +/* RFC 5958 (Asymmetric Key Packages) */ +#if !defined(WC_ENABLE_ASYM_KEY_EXPORT) && \ + ((defined(HAVE_ED25519) && defined(HAVE_ED25519_KEY_EXPORT)) || \ + (defined(HAVE_CURVE25519) && defined(HAVE_CURVE25519_KEY_EXPORT)) || \ + (defined(HAVE_ED448) && defined(HAVE_ED448_KEY_EXPORT)) || \ + (defined(HAVE_CURVE448) && defined(HAVE_CURVE448_KEY_EXPORT)) || \ + defined(HAVE_FALCON) || defined(HAVE_DILITHIUM) || \ + defined(HAVE_SPHINCS) || defined(HAVE_LIBOQS)) + #define WC_ENABLE_ASYM_KEY_EXPORT +#endif + +#if !defined(WC_ENABLE_ASYM_KEY_IMPORT) && \ + ((defined(HAVE_ED25519) && defined(HAVE_ED25519_KEY_IMPORT)) || \ + (defined(HAVE_CURVE25519) && defined(HAVE_CURVE25519_KEY_IMPORT)) || \ + (defined(HAVE_ED448) && defined(HAVE_ED448_KEY_IMPORT)) || \ + (defined(HAVE_CURVE448) && defined(HAVE_CURVE448_KEY_IMPORT)) || \ + defined(HAVE_FALCON) || defined(HAVE_DILITHIUM) || \ + defined(HAVE_SPHINCS) || defined(HAVE_LIBOQS)) + #define WC_ENABLE_ASYM_KEY_IMPORT +#endif + + +/* FIPS does not support CFB1 or CFB8 */ +#if !defined(WOLFSSL_NO_AES_CFB_1_8) && \ + (defined(HAVE_SELFTEST) || \ + (defined(HAVE_FIPS) && FIPS_VERSION3_LT(6,0,0))) + #define WOLFSSL_NO_AES_CFB_1_8 +#endif + +/* AES Config */ +#ifndef NO_AES + /* By default enable all AES key sizes, decryption and CBC */ + #ifndef AES_MAX_KEY_SIZE + #undef AES_MAX_KEY_SIZE + #define AES_MAX_KEY_SIZE 256 + #endif + + #ifndef NO_AES_128 + #undef WOLFSSL_AES_128 + #define WOLFSSL_AES_128 + #endif + #if !defined(NO_AES_192) && AES_MAX_KEY_SIZE >= 192 + #undef WOLFSSL_AES_192 + #define WOLFSSL_AES_192 + #endif + #if !defined(NO_AES_256) && AES_MAX_KEY_SIZE >= 256 + #undef WOLFSSL_AES_256 + #define WOLFSSL_AES_256 + #endif + #if !defined(WOLFSSL_AES_128) && !defined(WOLFSSL_AES_256) && \ + defined(HAVE_ECC_ENCRYPT) + #warning HAVE_ECC_ENCRYPT uses AES 128/256 bit keys + #endif + + #ifndef NO_AES_DECRYPT + #undef HAVE_AES_DECRYPT + #define HAVE_AES_DECRYPT + #endif + #ifndef NO_AES_CBC + #undef HAVE_AES_CBC + #define HAVE_AES_CBC + #endif + #ifdef WOLFSSL_AES_XTS + /* AES-XTS makes calls to AES direct functions */ + #ifndef WOLFSSL_AES_DIRECT + #define WOLFSSL_AES_DIRECT + #endif + #endif + #ifdef WOLFSSL_AES_CFB + /* AES-CFB makes calls to AES direct functions */ + #ifndef WOLFSSL_AES_DIRECT + #define WOLFSSL_AES_DIRECT + #endif + #endif + #ifdef WOLFSSL_AES_CTS + #if defined(NO_AES_CBC) || !defined(HAVE_AES_CBC) + #error "AES CTS requires AES CBC" + #endif + #endif +#endif + +#if (defined(WOLFSSL_TLS13) && defined(WOLFSSL_NO_TLS12)) || \ + (!defined(HAVE_AES_CBC) && defined(NO_DES3) && defined(NO_RC4) && \ + !defined(HAVE_CAMELLIA) & !defined(HAVE_NULL_CIPHER)) + #define WOLFSSL_AEAD_ONLY +#endif + +#if !defined(HAVE_PUBLIC_FFDHE) && !defined(NO_DH) && \ + !defined(WOLFSSL_NO_PUBLIC_FFDHE) && \ + (defined(HAVE_SELFTEST) || FIPS_VERSION_LE(2,0)) + /* This should only be enabled for FIPS v2 or older. It enables use of the + * older wc_Dh_ffdhe####_Get() API's */ + #define HAVE_PUBLIC_FFDHE +#endif + +#if !defined(NO_DH) && !defined(HAVE_FFDHE) + #if defined(HAVE_FFDHE_2048) || defined(HAVE_FFDHE_3072) || \ + defined(HAVE_FFDHE_4096) || defined(HAVE_FFDHE_6144) || \ + defined(HAVE_FFDHE_8192) + #define HAVE_FFDHE + #endif +#endif +#if defined(HAVE_FFDHE_8192) + #define MIN_FFDHE_BITS 8192 +#elif defined(HAVE_FFDHE_6144) + #define MIN_FFDHE_BITS 6144 +#elif defined(HAVE_FFDHE_4096) + #define MIN_FFDHE_BITS 4096 +#elif defined(HAVE_FFDHE_3072) + #define MIN_FFDHE_BITS 3072 +#elif defined(HAVE_FFDHE_2048) + #define MIN_FFDHE_BITS 2048 +#else + #define MIN_FFDHE_BITS 0 +#endif +#define MIN_FFDHE_FP_MAX_BITS (MIN_FFDHE_BITS * 2) +#if defined(HAVE_FFDHE) && defined(FP_MAX_BITS) + #if MIN_FFDHE_FP_MAX_BITS > FP_MAX_BITS + #error "FFDHE parameters are too large for FP_MAX_BIT as set" + #endif +#endif +#if defined(HAVE_FFDHE) && defined(SP_INT_BITS) + #if MIN_FFDHE_BITS > SP_INT_BITS + #error "FFDHE parameters are too large for SP_INT_BIT as set" + #endif +#endif + +/* if desktop type system and fastmath increase default max bits */ +#if defined(WOLFSSL_X86_64_BUILD) || defined(WOLFSSL_AARCH64_BUILD) + #if defined(USE_FAST_MATH) && !defined(FP_MAX_BITS) + #if MIN_FFDHE_FP_MAX_BITS <= 8192 + #define FP_MAX_BITS 8192 + #else + #define FP_MAX_BITS MIN_FFDHE_FP_MAX_BITS + #endif + #endif + #if defined(WOLFSSL_SP_MATH_ALL) && !defined(SP_INT_BITS) + #ifdef WOLFSSL_MYSQL_COMPATIBLE + #define SP_INT_BITS 8192 + #elif MIN_FFDHE_BITS <= 4096 + #define SP_INT_BITS 4096 + #else + #define SP_INT_BITS MIN_FFDHE_BITS + #endif + #endif +#endif + +/* If using the max strength build, ensure OLD TLS is disabled. */ +#ifdef WOLFSSL_MAX_STRENGTH + #undef NO_OLD_TLS + #define NO_OLD_TLS +#endif + + +/* Default AES minimum auth tag sz, allow user to override */ +#ifndef WOLFSSL_MIN_AUTH_TAG_SZ + #define WOLFSSL_MIN_AUTH_TAG_SZ 12 +#endif + + +/* sniffer requires: + * static RSA cipher suites + * session stats and peak stats + */ +#ifdef WOLFSSL_SNIFFER + #ifndef WOLFSSL_STATIC_RSA + #define WOLFSSL_STATIC_RSA + #endif + #ifndef WOLFSSL_STATIC_DH + #define WOLFSSL_STATIC_DH + #endif + /* Allow option to be disabled. */ + #ifndef WOLFSSL_NO_SESSION_STATS + #ifndef WOLFSSL_SESSION_STATS + #define WOLFSSL_SESSION_STATS + #endif + #ifndef WOLFSSL_PEAK_SESSIONS + #define WOLFSSL_PEAK_SESSIONS + #endif + #endif +#endif + +/* Decode Public Key extras on by default, user can turn off with + * WOLFSSL_NO_DECODE_EXTRA */ +#ifndef WOLFSSL_NO_DECODE_EXTRA + #ifndef RSA_DECODE_EXTRA + #define RSA_DECODE_EXTRA + #endif + #ifndef ECC_DECODE_EXTRA + #define ECC_DECODE_EXTRA + #endif +#endif + +/* C Sharp wrapper defines */ +#ifdef HAVE_CSHARP + #ifndef WOLFSSL_DTLS + #define WOLFSSL_DTLS + #endif + #undef NO_PSK + #undef NO_SHA256 + #undef NO_DH +#endif + +/* CryptoCell defines */ +#ifdef WOLFSSL_CRYPTOCELL + #if defined(HAVE_ECC) && defined(HAVE_ECC_SIGN) + /* Don't attempt to sign/verify an all-zero digest in wolfCrypt tests */ + #define WC_TEST_NO_ECC_SIGN_VERIFY_ZERO_DIGEST + #endif /* HAVE_ECC && HAVE_ECC_SIGN */ +#endif + +/* Asynchronous Crypto */ +#ifdef WOLFSSL_ASYNC_CRYPT + #if !defined(HAVE_CAVIUM) && !defined(HAVE_INTEL_QA) && \ + !defined(WOLF_CRYPTO_CB) && !defined(HAVE_PK_CALLBACKS) && \ + !defined(WOLFSSL_ASYNC_CRYPT_SW) + #error No async backend defined with WOLFSSL_ASYNC_CRYPT! + #endif + + /* Make sure wolf events are enabled */ + #undef HAVE_WOLF_EVENT + #define HAVE_WOLF_EVENT + + #ifdef WOLFSSL_ASYNC_CRYPT_SW + #define WC_ASYNC_DEV_SIZE 168 + #else + #define WC_ASYNC_DEV_SIZE 336 + #endif + + /* Enable ECC_CACHE_CURVE for ASYNC */ + #if !defined(ECC_CACHE_CURVE) && !defined(NO_ECC_CACHE_CURVE) + /* Enabled by default for increased async performance, + * but not required */ + #define ECC_CACHE_CURVE + #endif + + #if defined(HAVE_ECC) && defined(HAVE_ECC_SIGN) + /* Don't attempt to sign/verify an all-zero digest in wolfCrypt tests */ + #define WC_TEST_NO_ECC_SIGN_VERIFY_ZERO_DIGEST + #endif /* HAVE_ECC && HAVE_ECC_SIGN */ + +#endif /* WOLFSSL_ASYNC_CRYPT */ +#ifndef WC_ASYNC_DEV_SIZE + #define WC_ASYNC_DEV_SIZE 0 +#endif +#ifdef HAVE_INTEL_QA /* Disable SHA512/224 and SHA512/256 support for QAT */ + #define WOLFSSL_NOSHA512_224 + #define WOLFSSL_NOSHA512_256 +#endif +/* leantls checks */ +#ifdef WOLFSSL_LEANTLS + #ifndef HAVE_ECC + #error leantls build needs ECC + #endif +#endif /* WOLFSSL_LEANTLS*/ + +/* restriction with static memory */ +#ifdef WOLFSSL_STATIC_MEMORY + #if defined(HAVE_IO_POOL) || defined(XMALLOC_USER) || defined(NO_WOLFSSL_MEMORY) + #error static memory cannot be used with HAVE_IO_POOL, XMALLOC_USER or NO_WOLFSSL_MEMORY + #endif + #if !defined(WOLFSSL_SP_MATH_ALL) && !defined(USE_FAST_MATH) && \ + !defined(WOLFSSL_SP_MATH) && !defined(NO_BIG_INT) + #error The static memory option is only supported for fast math or SP Math + #endif +#endif /* WOLFSSL_STATIC_MEMORY */ + +#ifdef HAVE_AES_KEYWRAP + #ifndef WOLFSSL_AES_DIRECT + #error AES key wrap requires AES direct please define WOLFSSL_AES_DIRECT + #endif +#endif + +#ifdef HAVE_PKCS7 + #if defined(NO_AES) && defined(NO_DES3) + #error PKCS7 needs either AES or 3DES enabled, please enable one + #endif + #ifndef HAVE_AES_KEYWRAP + #error PKCS7 requires AES key wrap please define HAVE_AES_KEYWRAP + #endif + #if defined(HAVE_ECC) && !defined(HAVE_X963_KDF) + #error PKCS7 requires X963 KDF please define HAVE_X963_KDF + #endif +#endif + +#ifndef NO_PKCS12 + #undef HAVE_PKCS12 + #define HAVE_PKCS12 +#endif + +#if !defined(NO_PKCS8) || defined(HAVE_PKCS12) + #undef HAVE_PKCS8 + #define HAVE_PKCS8 +#endif + +#if !defined(NO_PBKDF1) || defined(WOLFSSL_ENCRYPTED_KEYS) || \ + defined(HAVE_PKCS8) || defined(HAVE_PKCS12) + #undef HAVE_PBKDF1 + #define HAVE_PBKDF1 +#endif + +#if !defined(NO_PBKDF2) || defined(HAVE_PKCS7) || defined(HAVE_SCRYPT) + #undef HAVE_PBKDF2 + #define HAVE_PBKDF2 +#endif + + +#if !defined(WOLFCRYPT_ONLY) && !defined(NO_OLD_TLS) && \ + (defined(NO_SHA) || defined(NO_MD5)) + #error old TLS requires MD5 and SHA +#endif + +/* for backwards compatibility */ +#if defined(TEST_IPV6) && !defined(WOLFSSL_IPV6) + #define WOLFSSL_IPV6 +#endif + +/* --------------------------------------------------------------------------- + * ASN Library Selection (default to ASN_TEMPLATE) + * --------------------------------------------------------------------------- + */ +#if !defined(WOLFSSL_ASN_TEMPLATE) && !defined(WOLFSSL_ASN_ORIGINAL) && \ + !defined(NO_ASN) + #define WOLFSSL_ASN_TEMPLATE +#endif + +#if defined(WOLFSSL_DUAL_ALG_CERTS) && !defined(WOLFSSL_ASN_TEMPLATE) + #error "Dual alg cert support requires the ASN.1 template feature." +#endif + +#if defined(WOLFSSL_ACERT) && !defined(WOLFSSL_ASN_TEMPLATE) + #error "Attribute Certificate support requires the ASN.1 template feature." +#endif + +#if defined(OPENSSL_ALL) || defined(WOLFSSL_QT) + #undef WOLFSSL_ASN_ALL + #define WOLFSSL_ASN_ALL +#endif + +/* Enable all parsing features for ASN */ +#ifdef WOLFSSL_ASN_ALL + /* Alternate Names */ + #undef WOLFSSL_ALT_NAMES + #define WOLFSSL_ALT_NAMES + + /* Alternate Name: human readable form of IP address*/ + #undef WOLFSSL_IP_ALT_NAME + #define WOLFSSL_IP_ALT_NAME + + /* Alternate name: human readable form of registered ID */ + #undef WOLFSSL_RID_ALT_NAME + #define WOLFSSL_RID_ALT_NAME + + /* CA Issuer URI */ + #undef WOLFSSL_ASN_CA_ISSUER + #define WOLFSSL_ASN_CA_ISSUER + + /* FPKI (Federal PKI) extensions */ + #undef WOLFSSL_FPKI + #define WOLFSSL_FPKI + + /* Certificate policies */ + #undef WOLFSSL_SEP + #define WOLFSSL_SEP + + /* Support for full AuthorityKeyIdentifier extension. + * Only supports copying full AKID from an existing certificate */ + #undef WOLFSSL_AKID_NAME + #define WOLFSSL_AKID_NAME + + /* Extended ASN.1 parsing support (typically used with cert gen) */ + #undef WOLFSSL_CERT_EXT + #define WOLFSSL_CERT_EXT + + /* Support for SubjectDirectoryAttributes extension */ + #undef WOLFSSL_SUBJ_DIR_ATTR + #define WOLFSSL_SUBJ_DIR_ATTR + + /* Support for SubjectInfoAccess extension */ + #undef WOLFSSL_SUBJ_INFO_ACC + #define WOLFSSL_SUBJ_INFO_ACC + + #undef WOLFSSL_CERT_NAME_ALL + #define WOLFSSL_CERT_NAME_ALL + + /* Store pointers to issuer name components (lengths and encodings) */ + #undef WOLFSSL_HAVE_ISSUER_NAMES + #define WOLFSSL_HAVE_ISSUER_NAMES + + /* Additional ASN.1 encoded name fields. See CTC_MAX_ATTRIB for max limit */ + #undef WOLFSSL_MULTI_ATTRIB + #define WOLFSSL_MULTI_ATTRIB + + /* Parsing of indefinite length encoded ASN.1 + * Optionally used by PKCS7/PKCS12 */ + #undef ASN_BER_TO_DER + #define ASN_BER_TO_DER + + /* Enable custom OID support for subject and request extensions */ + #undef WOLFSSL_CUSTOM_OID + #define WOLFSSL_CUSTOM_OID + + /* Support for full OID (not just sum) encoding */ + #undef HAVE_OID_ENCODING + #define HAVE_OID_ENCODING + + /* Support for full OID (not just sum) decoding */ + #undef HAVE_OID_DECODING + #define HAVE_OID_DECODING + + /* S/MIME - Secure Multipurpose Internet Mail Extension (used with PKCS7) */ + #undef HAVE_SMIME + #define HAVE_SMIME + + /* Enable compatibility layer function for getting time string */ + #undef WOLFSSL_ASN_TIME_STRING + #define WOLFSSL_ASN_TIME_STRING + + /* Support for parsing key usage */ + #undef WOLFSSL_ASN_PARSE_KEYUSAGE + #define WOLFSSL_ASN_PARSE_KEYUSAGE + + /* Support for parsing OCSP status */ + #undef WOLFSSL_OCSP_PARSE_STATUS + #define WOLFSSL_OCSP_PARSE_STATUS + + /* Extended Key Usage */ + #undef WOLFSSL_EKU_OID + #define WOLFSSL_EKU_OID + + /* Attribute Certificate support */ + #if defined(WOLFSSL_ASN_TEMPLATE) && !defined(WOLFSSL_ACERT) + #define WOLFSSL_ACERT + #endif +#endif + +#if defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA) || \ + defined(WOLFSSL_MYSQL_COMPATIBLE) || defined(WOLFSSL_NGINX) || \ + defined(WOLFSSL_HAPROXY) + #undef WOLFSSL_ASN_TIME_STRING + #define WOLFSSL_ASN_TIME_STRING +#endif + +#if (defined(WOLFSSL_CERT_GEN) && defined(WOLFSSL_CERT_EXT)) || \ + (defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA)) + #undef WOLFSSL_ASN_PARSE_KEYUSAGE + #define WOLFSSL_ASN_PARSE_KEYUSAGE +#endif + +#if defined(HAVE_OCSP) && !defined(WOLFCRYPT_ONLY) && \ + (defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) || \ + defined(WOLFSSL_HAPROXY) || defined(HAVE_LIGHTY) || \ + defined(WOLFSSL_APACHE_HTTPD)) + #undef WOLFSSL_OCSP_PARSE_STATUS + #define WOLFSSL_OCSP_PARSE_STATUS +#endif + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_ALL) || \ + defined(OPENSSL_EXTRA_X509_SMALL) || defined(WOLFSSL_CERT_GEN) + #undef WOLFSSL_MULTI_ATTRIB + #define WOLFSSL_MULTI_ATTRIB +#endif + +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_ALL) || \ + defined(OPENSSL_EXTRA_X509_SMALL) + #undef WOLFSSL_EKU_OID + #define WOLFSSL_EKU_OID +#endif + +/* Disable time checking if no timer */ +#if defined(NO_ASN_TIME) + #define NO_ASN_TIME_CHECK +#endif + +/* ASN Unknown Extension Callback support */ +#if defined(WOLFSSL_CUSTOM_OID) && defined(HAVE_OID_DECODING) && \ + defined(WOLFSSL_ASN_TEMPLATE) + #undef WC_ASN_UNKNOWN_EXT_CB + #define WC_ASN_UNKNOWN_EXT_CB +#else + /* if user supplied build option and not using ASN template, raise error */ + #if defined(WC_ASN_UNKNOWN_EXT_CB) && !defined(WOLFSSL_ASN_TEMPLATE) + #error ASN unknown extension callback is only supported \ + with ASN template + #endif +#endif + +#ifdef WOLFSSL_PYTHON + /* Need to use old OID sum algorithm until OSP patches, in particular to + * tests, for all versions reflect the new OID sum value. */ + #undef WOLFSSL_OLD_OID_SUM + #define WOLFSSL_OLD_OID_SUM +#endif + + +/* Linux Kernel Module */ +#ifdef WOLFSSL_LINUXKM + #ifdef HAVE_CONFIG_H + #include <config.h> + #undef HAVE_CONFIG_H + #endif + #ifndef NO_DEV_RANDOM + #define NO_DEV_RANDOM + #endif + #ifndef NO_WRITEV + #define NO_WRITEV + #endif + #ifndef NO_FILESYSTEM + #define NO_FILESYSTEM + #endif + #ifndef NO_STDIO_FILESYSTEM + #define NO_STDIO_FILESYSTEM + #endif + #ifndef WOLFSSL_NO_SOCK + #define WOLFSSL_NO_SOCK + #endif + #ifndef WOLFSSL_DH_CONST + #define WOLFSSL_DH_CONST + #endif + #ifndef WOLFSSL_USER_IO + #define WOLFSSL_USER_IO + #endif + #ifndef USE_WOLF_STRTOK + #define USE_WOLF_STRTOK + #endif + #ifndef WOLFSSL_OLD_PRIME_CHECK + #define WOLFSSL_OLD_PRIME_CHECK + #endif + #ifndef WOLFSSL_TEST_SUBROUTINE + #ifdef LINUXKM_LKCAPI_REGISTER + #define WOLFSSL_TEST_SUBROUTINE + #else + #define WOLFSSL_TEST_SUBROUTINE static + #endif + #endif + #ifdef LINUXKM_LKCAPI_REGISTER + #define WC_TEST_EXPORT_SUBTESTS + #endif + #undef HAVE_PTHREAD + /* linuxkm uses linux/string.h, included by linuxkm_wc_port.h. */ + #undef HAVE_STRINGS_H + /* linuxkm uses linux/limits.h, included by linuxkm_wc_port.h. */ + #undef HAVE_LIMITS_H + #undef HAVE_ERRNO_H + #undef HAVE_THREAD_LS + #undef HAVE_ATEXIT + #undef WOLFSSL_HAVE_MIN + #undef WOLFSSL_HAVE_MAX + #undef WOLFSSL_HAVE_ASSERT_H + #define WOLFSSL_NO_ASSERT_H + #ifndef WOLFSSL_NO_GETPID + #define WOLFSSL_NO_GETPID + #endif /* WOLFSSL_NO_GETPID */ + #ifndef SIZEOF_LONG + #define SIZEOF_LONG 8 + #endif + #ifndef SIZEOF_LONG_LONG + #define SIZEOF_LONG_LONG 8 + #endif + #define CHAR_BIT 8 + #ifndef WOLFSSL_SP_DIV_64 + #define WOLFSSL_SP_DIV_64 + #endif + #ifndef WOLFSSL_SP_DIV_WORD_HALF + #define WOLFSSL_SP_DIV_WORD_HALF + #endif + + #ifdef HAVE_LINUXKM_PIE_SUPPORT + #define WC_NO_INTERNAL_FUNCTION_POINTERS + #define WOLFSSL_ECC_CURVE_STATIC + #define WOLFSSL_NAMES_STATIC + #define WOLFSSL_NO_PUBLIC_FFDHE + #undef HAVE_PUBLIC_FFDHE + #endif + + #ifndef NO_OLD_WC_NAMES + #define NO_OLD_WC_NAMES + #endif + #ifndef NO_OLD_SHA_NAMES + #define NO_OLD_SHA_NAMES + #endif + #ifndef NO_OLD_MD5_NAME + #define NO_OLD_MD5_NAME + #endif + #ifndef OPENSSL_COEXIST + #define OPENSSL_COEXIST + #endif + #ifndef NO_OLD_SSL_NAMES + #define NO_OLD_SSL_NAMES + #endif + #undef WOLFSSL_MIN_AUTH_TAG_SZ + #define WOLFSSL_MIN_AUTH_TAG_SZ 4 + + #if defined(LINUXKM_LKCAPI_REGISTER) && !defined(WOLFSSL_ASN_INT_LEAD_0_ANY) + /* kernel 5.10 crypto manager tests key(s) that fail unless leading + * zero bytes are tolerated in GetASN_Integer(). + */ + #define WOLFSSL_ASN_INT_LEAD_0_ANY + #endif + + #ifdef CONFIG_KASAN + #ifndef WC_SANITIZE_DISABLE + #define WC_SANITIZE_DISABLE() kasan_disable_current() + #endif + #ifndef WC_SANITIZE_ENABLE + #define WC_SANITIZE_ENABLE() kasan_enable_current() + #endif + #endif + + #if !defined(WC_RESEED_INTERVAL) && defined(LINUXKM_LKCAPI_REGISTER) + /* If installing handlers, use the maximum reseed interval allowed by + * NIST SP 800-90A Rev. 1, to avoid unnecessary delays in DRBG + * generation. + */ + #define WC_RESEED_INTERVAL (((word64)1UL)<<48UL) + #endif +#endif + + +/* Place any other flags or defines here */ + +#if defined(WOLFSSL_MYSQL_COMPATIBLE) && defined(_WIN32) \ + && defined(HAVE_GMTIME_R) + #undef HAVE_GMTIME_R /* don't trust macro with windows */ +#endif /* WOLFSSL_MYSQL_COMPATIBLE */ + +#if (defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) || \ + defined(WOLFSSL_HAPROXY) || defined(HAVE_LIGHTY)) && !defined(NO_TLS) + #define OPENSSL_NO_ENGINE + + /* Session Tickets will be enabled when --enable-opensslall is used. + * Time is required for ticket expiration checking */ + #if !defined(HAVE_SESSION_TICKET) && !defined(NO_ASN_TIME) + #define HAVE_SESSION_TICKET + #endif + /* OCSP will be enabled in configure.ac when --enable-opensslall is used, + * but do not force all users to have it enabled. */ + #ifndef HAVE_OCSP + /*#define HAVE_OCSP*/ + #endif + #ifndef KEEP_OUR_CERT + #define KEEP_OUR_CERT + #endif + #ifndef HAVE_SNI + #define HAVE_SNI + #endif + #ifndef WOLFSSL_RSA_KEY_CHECK + #define WOLFSSL_RSA_KEY_CHECK + #endif +#endif + +/* Make sure setting OPENSSL_ALL also sets OPENSSL_EXTRA. */ +#if defined(OPENSSL_ALL) && !defined(OPENSSL_EXTRA) + #define OPENSSL_EXTRA +#endif + + +#if (defined(OPENSSL_EXTRA) || defined(WOLFSSL_QT)) && \ + !defined(WOLFSSL_ASN_CA_ISSUER) + #define WOLFSSL_ASN_CA_ISSUER +#endif + + +/* --------------------------------------------------------------------------- + * OpenSSL compat layer + * --------------------------------------------------------------------------- + */ +#ifdef OPENSSL_EXTRA + #undef WOLFSSL_ALWAYS_VERIFY_CB + #define WOLFSSL_ALWAYS_VERIFY_CB + + #undef WOLFSSL_VERIFY_CB_ALL_CERTS + #define WOLFSSL_VERIFY_CB_ALL_CERTS + + #undef WOLFSSL_EXTRA_ALERTS + #define WOLFSSL_EXTRA_ALERTS + + #undef HAVE_EXT_CACHE + #define HAVE_EXT_CACHE + + #undef WOLFSSL_FORCE_CACHE_ON_TICKET + #define WOLFSSL_FORCE_CACHE_ON_TICKET + + #undef WOLFSSL_AKID_NAME + #define WOLFSSL_AKID_NAME + + #undef HAVE_CTS + #define HAVE_CTS + + #undef WOLFSSL_SESSION_ID_CTX + #define WOLFSSL_SESSION_ID_CTX +#endif /* OPENSSL_EXTRA */ + +#ifdef OPENSSL_EXTRA_X509_SMALL + #undef WOLFSSL_NO_OPENSSL_RAND_CB + #define WOLFSSL_NO_OPENSSL_RAND_CB +#endif + +#ifdef HAVE_SNI + #define SSL_CTRL_SET_TLSEXT_HOSTNAME 55 +#endif + +/* both CURVE and ED small math should be enabled */ +#ifdef CURVED25519_SMALL + #define CURVE25519_SMALL + #define ED25519_SMALL +#endif + +/* both CURVE and ED small math should be enabled */ +#ifdef CURVED448_SMALL + #define CURVE448_SMALL + #define ED448_SMALL +#endif + + +#ifndef WOLFSSL_ALERT_COUNT_MAX + #define WOLFSSL_ALERT_COUNT_MAX 5 +#endif + +/* Enable blinding by default for C-only, non-small curve25519 implementation */ +#if defined(HAVE_CURVE25519) && !defined(CURVE25519_SMALL) && \ + !defined(FREESCALE_LTC_ECC) && !defined(WOLFSSL_ARMASM) && \ + (!defined(USE_INTEL_SPEEDUP) || defined(NO_CURVED25519_X64)) && \ + !defined(WOLFSSL_CURVE25519_BLINDING) && !defined(NO_CURVE25519_BLINDING) + #define WOLFSSL_CURVE25519_BLINDING +#endif + +/* warning for not using harden build options (default with ./configure) */ +/* do not warn if big integer support is disabled */ +#if !defined(WC_NO_HARDEN) && !defined(NO_BIG_INT) + #if (defined(USE_FAST_MATH) && !defined(TFM_TIMING_RESISTANT)) || \ + (defined(HAVE_ECC) && !defined(ECC_TIMING_RESISTANT)) || \ + (!defined(NO_RSA) && !defined(WC_RSA_BLINDING) && !defined(HAVE_FIPS) && \ + !defined(WC_NO_RNG)) + + #ifndef _MSC_VER + #warning "For timing resistance / side-channel attack prevention consider using harden options" + #else + #pragma message("Warning: For timing resistance / side-channel attack prevention consider using harden options") + #endif + #endif +#endif + +#ifdef OPENSSL_COEXIST + /* make sure old names are disabled */ + #ifndef NO_OLD_SSL_NAMES + #define NO_OLD_SSL_NAMES + #endif + #ifndef NO_OLD_WC_NAMES + #define NO_OLD_WC_NAMES + #endif + #if defined(HAVE_SELFTEST) || \ + (defined(HAVE_FIPS) && FIPS_VERSION3_LT(5,0,0)) + /* old FIPS needs this remapping. */ + #define Sha3 wc_Sha3 + #endif +#endif + +#if defined(NO_OLD_WC_NAMES) || defined(OPENSSL_EXTRA) + /* added to have compatibility with SHA256() */ + #if !defined(NO_OLD_SHA_NAMES) && (!defined(HAVE_FIPS) || \ + FIPS_VERSION_GT(2,0)) + #define NO_OLD_SHA_NAMES + #endif + #if !defined(NO_OLD_MD5_NAME) && (!defined(HAVE_FIPS) || \ + FIPS_VERSION_GT(2,0)) + #define NO_OLD_MD5_NAME + #endif +#endif + +/* switch for compatibility layer functionality. Has subparts i.e. BIO/X509 + * When opensslextra is enabled all subparts should be turned on. */ +#ifdef OPENSSL_EXTRA + #undef OPENSSL_EXTRA_X509_SMALL + #define OPENSSL_EXTRA_X509_SMALL +#endif /* OPENSSL_EXTRA */ + +/* support for converting DER to PEM */ +#if (defined(WOLFSSL_KEY_GEN) && !defined(WOLFSSL_NO_DER_TO_PEM)) || \ + defined(WOLFSSL_CERT_GEN) || defined(OPENSSL_EXTRA) + #undef WOLFSSL_DER_TO_PEM + #define WOLFSSL_DER_TO_PEM +#endif + +/* keep backwards compatibility enabling encrypted private key */ +#ifndef WOLFSSL_ENCRYPTED_KEYS + #if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) || \ + defined(HAVE_WEBSERVER) + #define WOLFSSL_ENCRYPTED_KEYS + #endif +#endif + +/* support for disabling PEM to DER */ +#if !defined(WOLFSSL_NO_PEM) && !defined(NO_CODING) + #undef WOLFSSL_PEM_TO_DER + #define WOLFSSL_PEM_TO_DER +#endif + +/* Parts of the openssl compatibility layer require peer certs */ +#if (defined(OPENSSL_EXTRA) || defined(OPENSSL_ALL) || \ + defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) || \ + defined(HAVE_LIGHTY)) && !defined(NO_CERTS) && !defined(NO_KEEP_PEER_CERT) + #undef KEEP_PEER_CERT + #define KEEP_PEER_CERT +#endif + +/* Always copy certificate(s) from SSL CTX to each SSL object on creation, + * if this is not defined then each SSL object shares a pointer to the + * original certificate buffer owned by the SSL CTX. */ +#if defined(OPENSSL_ALL) && !defined(WOLFSSL_NO_COPY_CERT) + #undef WOLFSSL_COPY_CERT + #define WOLFSSL_COPY_CERT +#endif + +/* Always copy private key from SSL CTX to each SSL object on creation, + * if this is not defined then each SSL object shares a pointer to the + * original key buffer owned by the SSL CTX. */ +#if defined(OPENSSL_ALL) && !defined(WOLFSSL_NO_COPY_KEY) + #undef WOLFSSL_COPY_KEY + #define WOLFSSL_COPY_KEY +#endif + +/* + * Keeps the "Finished" messages after a TLS handshake for use as the so-called + * "tls-unique" channel binding. See comment in internal.h around clientFinished + * and serverFinished for more information. + */ +#if defined(OPENSSL_ALL) || defined(WOLFSSL_HAPROXY) || defined(WOLFSSL_WPAS) + #undef WOLFSSL_HAVE_TLS_UNIQUE + #define WOLFSSL_HAVE_TLS_UNIQUE +#endif + +/* WPAS Small option requires OPENSSL_EXTRA_X509_SMALL */ +#if defined(WOLFSSL_WPAS_SMALL) && !defined(OPENSSL_EXTRA_X509_SMALL) + #define OPENSSL_EXTRA_X509_SMALL +#endif + +/* Web Server needs to enable OPENSSL_EXTRA_X509_SMALL */ +#if defined(HAVE_WEBSERVER) && !defined(OPENSSL_EXTRA_X509_SMALL) + #define OPENSSL_EXTRA_X509_SMALL +#endif + +/* The EX data CRYPTO API's used with compatibility */ +#if !defined(HAVE_EX_DATA_CRYPTO) && \ + (defined(OPENSSL_ALL) || defined(WOLFSSL_WPAS_SMALL) || \ + defined(HAVE_STUNNEL) || defined(WOLFSSL_NGINX) || \ + defined(HAVE_LIGHTY) || defined(WOLFSSL_HAPROXY) || \ + defined(WOLFSSL_OPENSSH) || defined(HAVE_SBLIM_SFCB) || \ + defined(WOLFSSL_WOLFSENTRY_HOOKS)) + #define HAVE_EX_DATA_CRYPTO +#endif + +#if defined(WOLFSSL_WOLFSENTRY_HOOKS) && !defined(HAVE_EX_DATA_CLEANUP_HOOKS) + #define HAVE_EX_DATA_CLEANUP_HOOKS +#endif + +/* Enable EX Data support if required */ +#if (defined(HAVE_EX_DATA_CRYPTO) || defined(HAVE_EX_DATA_CLEANUP_HOOKS)) && \ + !defined(HAVE_EX_DATA) + #define HAVE_EX_DATA +#endif + + +/* RAW hash function APIs are not implemented */ +#if defined(WOLFSSL_ARMASM) || defined(WOLFSSL_AFALG_HASH) + #undef WOLFSSL_NO_HASH_RAW + #define WOLFSSL_NO_HASH_RAW +#endif + +#if defined(HAVE_XCHACHA) && !defined(HAVE_CHACHA) + /* XChacha requires ChaCha */ + #undef HAVE_XCHACHA +#endif + +#if !defined(WOLFCRYPT_ONLY) && \ + (!defined(WOLFSSL_NO_TLS12) || defined(HAVE_KEYING_MATERIAL)) + #undef WOLFSSL_HAVE_PRF + #define WOLFSSL_HAVE_PRF +#endif + +#if defined(NO_ASN) && defined(WOLFCRYPT_ONLY) && !defined(WOLFSSL_WOLFSSH) + #undef WOLFSSL_NO_INT_ENCODE + #define WOLFSSL_NO_INT_ENCODE +#endif + +#if defined(NO_ASN) && defined(WOLFCRYPT_ONLY) + #undef WOLFSSL_NO_INT_DECODE + #define WOLFSSL_NO_INT_DECODE +#endif + +#if defined(WOLFCRYPT_ONLY) && defined(WOLFSSL_RSA_VERIFY_ONLY) && \ + defined(WC_NO_RSA_OAEP) + #undef WOLFSSL_NO_CT_OPS + #define WOLFSSL_NO_CT_OPS +#endif + +#if defined(WOLFCRYPT_ONLY) && defined(NO_AES) && !defined(HAVE_CURVE25519) && \ + !defined(HAVE_CURVE448) && defined(WC_NO_RNG) && defined(WC_NO_RSA_OAEP) + #undef WOLFSSL_NO_CONST_CMP + #define WOLFSSL_NO_CONST_CMP +#endif + +#if defined(WOLFCRYPT_ONLY) && defined(NO_AES) && !defined(WOLFSSL_SHA384) && \ + !defined(WOLFSSL_SHA512) && defined(WC_NO_RNG) && \ + !defined(WOLFSSL_SP_MATH) && !defined(WOLFSSL_SP_MATH_ALL) \ + && !defined(USE_FAST_MATH) && defined(NO_SHA256) + #undef WOLFSSL_NO_FORCE_ZERO + #define WOLFSSL_NO_FORCE_ZERO +#endif + +/* Detect old cryptodev name */ +#if defined(WOLF_CRYPTO_DEV) && !defined(WOLF_CRYPTO_CB) + #define WOLF_CRYPTO_CB +#endif + +#if defined(WOLFSSL_TLS13) && defined(WOLFSSL_NO_SIGALG) + #error TLS 1.3 requires the Signature Algorithms extension to be enabled +#endif + +#ifndef NO_WOLFSSL_BASE64_DECODE + #define WOLFSSL_BASE64_DECODE +#endif + +#if defined(FORTRESS) && !defined(HAVE_EX_DATA) + #define HAVE_EX_DATA +#endif + +#ifdef HAVE_EX_DATA + #ifndef MAX_EX_DATA + #define MAX_EX_DATA 5 /* allow for five items of ex_data */ + #endif +#endif + + +#ifdef NO_WOLFSSL_SMALL_STACK + #undef WOLFSSL_SMALL_STACK +#endif + +#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_SMALL_STACK_STATIC) && \ + !defined(NO_WOLFSSL_SMALL_STACK_STATIC) +#define WOLFSSL_SMALL_STACK_STATIC +#endif + +#ifdef WOLFSSL_SMALL_STACK_STATIC + #undef WOLFSSL_SMALL_STACK_STATIC + #define WOLFSSL_SMALL_STACK_STATIC static +#else + #define WOLFSSL_SMALL_STACK_STATIC +#endif + +/* The client session cache requires time for timeout */ +#if defined(NO_ASN_TIME) && !defined(NO_SESSION_CACHE) + #define NO_SESSION_CACHE +#endif + +#if defined(NO_ASN_TIME) && !defined(WOLFSSL_NO_DEF_TICKET_ENC_CB) + #define WOLFSSL_NO_DEF_TICKET_ENC_CB +#endif +#if defined(NO_ASN_TIME) && defined(HAVE_SESSION_TICKET) + #undef HAVE_SESSION_TICKET +#endif + +/* Use static ECC structs for Position Independent Code (PIC) */ +#if defined(__IAR_SYSTEMS_ICC__) && defined(__ROPI__) + #define WOLFSSL_ECC_CURVE_STATIC + #define WOLFSSL_NAMES_STATIC +#endif + +/* FIPS v1 does not support TLS v1.3 (requires RSA PSS and HKDF) */ +#if FIPS_VERSION_EQ(1,0) + #undef WC_RSA_PSS + #undef WOLFSSL_TLS13 +#endif + +/* FIPS v2 does not support WOLFSSL_PSS_LONG_SALT */ +#if FIPS_VERSION_EQ(2,0) + #ifdef WOLFSSL_PSS_LONG_SALT + #undef WOLFSSL_PSS_LONG_SALT + #endif +#endif + +/* For FIPSv2 make sure the ECDSA encoding allows extra bytes + * but make sure users consider enabling it */ +#if !defined(NO_STRICT_ECDSA_LEN) && FIPS_VERSION_GE(2,0) + /* ECDSA length checks off by default for CAVP testing + * consider enabling strict checks in production */ + #define NO_STRICT_ECDSA_LEN +#endif + +/* Do not allow using small stack with no malloc */ +#if defined(WOLFSSL_NO_MALLOC) && \ + (defined(WOLFSSL_SMALL_STACK) || defined(WOLFSSL_SMALL_STACK_CACHE)) && \ + !defined(WOLFSSL_STATIC_MEMORY) + #error Small stack cannot be used with no malloc (WOLFSSL_NO_MALLOC) and \ + without staticmemory (WOLFSSL_STATIC_MEMORY) +#endif + +/* If malloc is disabled make sure it is also disabled in SP math */ +#if defined(WOLFSSL_NO_MALLOC) && !defined(WOLFSSL_SP_NO_MALLOC) && \ + (defined(WOLFSSL_SP_MATH) || defined(WOLFSSL_SP_MATH_ALL)) + #define WOLFSSL_SP_NO_MALLOC +#endif + +/* Enable DH Extra for QT, openssl all, openssh and static ephemeral */ +/* Allows export/import of DH key and params as DER */ +#if !defined(NO_DH) && !defined(WOLFSSL_DH_EXTRA) && \ + (defined(WOLFSSL_QT) || defined(OPENSSL_ALL) || defined(WOLFSSL_OPENSSH) || \ + defined(WOLFSSL_STATIC_EPHEMERAL)) + #define WOLFSSL_DH_EXTRA +#endif + +/* DH Extra is not supported on FIPS v1 or v2 (is missing DhKey .pub/.priv) */ +#if defined(WOLFSSL_DH_EXTRA) && defined(HAVE_FIPS) && FIPS_VERSION_LE(2,0) + #undef WOLFSSL_DH_EXTRA +#endif + +/* FIPS 140-3 does not have this definition in wolfCrypt dh.h, but OpenSSL dh.h depends on it. + * Define it here as well if needed, as we want to avoid modifying dh.h in FIPS. */ +#ifndef DH_MAX_SIZE + #ifdef USE_FAST_MATH + /* FP implementation support numbers up to FP_MAX_BITS / 2 bits. */ + #define DH_MAX_SIZE (FP_MAX_BITS / 2) + #if defined(WOLFSSL_MYSQL_COMPATIBLE) && DH_MAX_SIZE < 8192 + #error "MySQL needs FP_MAX_BITS at least at 16384" + #endif + #elif defined(WOLFSSL_SP_MATH_ALL) || defined(WOLFSSL_SP_MATH) + /* SP implementation supports numbers of SP_INT_BITS bits. */ + #define DH_MAX_SIZE (((SP_INT_BITS + 7) / 8) * 8) + #if defined(WOLFSSL_MYSQL_COMPATIBLE) && DH_MAX_SIZE < 8192 + #error "MySQL needs SP_INT_BITS at least at 8192" + #endif + #else + #ifdef WOLFSSL_MYSQL_COMPATIBLE + /* Integer maths is dynamic but we only go up to 8192 bits. */ + #define DH_MAX_SIZE 8192 + #else + /* Integer maths is dynamic but we only go up to 4096 bits. */ + #define DH_MAX_SIZE 4096 + #endif + #endif +#endif + +/* wc_Sha512.devId isn't available before FIPS 5.1 */ +#if defined(HAVE_FIPS) && FIPS_VERSION_LT(5,1) + #define NO_SHA2_CRYPTO_CB +#endif + +/* Enable HAVE_ONE_TIME_AUTH by default for use with TLS cipher suites + * when poly1305 is enabled + */ +#if defined(HAVE_POLY1305) && !defined(HAVE_ONE_TIME_AUTH) + #define HAVE_ONE_TIME_AUTH +#endif + +/* This is checked for in configure.ac, so might want to do it in here as well. + */ +#if defined(HAVE_SECURE_RENEGOTIATION) && defined(HAVE_RENEGOTIATION_INDICATION) + #error HAVE_RENEGOTIATION_INDICATION cannot be defined together with \ + HAVE_SECURE_RENEGOTIATION +#endif + +/* Check for insecure build combination: + * secure renegotiation [enabled] + * extended master secret [disabled] + * session resumption [enabled] + */ +#if defined(HAVE_SECURE_RENEGOTIATION) && !defined(HAVE_EXTENDED_MASTER) && \ + (defined(HAVE_SESSION_TICKET) || !defined(NO_SESSION_CACHE)) + /* secure renegotiation requires extended master secret with resumption */ + #ifndef _MSC_VER + #warning Extended master secret must be enabled with secure renegotiation and session resumption + #else + #pragma message("Warning: Extended master secret must be enabled with secure renegotiation and session resumption") + #endif + + /* Note: "--enable-renegotiation-indication" ("HAVE_RENEGOTIATION_INDICATION") + * only sends the secure renegotiation extension, but is not actually supported. + * This was added because some TLS peers required it even if not used, so we call + * this "(FAKE Secure Renegotiation)" + */ +#endif + +/* if secure renegotiation is enabled, make sure server info is enabled */ +#if !defined(HAVE_RENEGOTIATION_INDICATION) && \ + !defined(HAVE_SERVER_RENEGOTIATION_INFO) && \ + defined(HAVE_SECURE_RENEGOTIATION) && \ + !defined(NO_WOLFSSL_SERVER) + #define HAVE_SERVER_RENEGOTIATION_INFO +#endif + +/* Crypto callbacks should enable hash flag support */ +#if defined(WOLF_CRYPTO_CB) && !defined(WOLFSSL_HASH_FLAGS) + /* FIPS v1 and v2 do not support hash flags, so do not allow it with + * crypto callbacks */ + #if !defined(HAVE_FIPS) || (defined(HAVE_FIPS) && \ + defined(HAVE_FIPS_VERSION) && HAVE_FIPS_VERSION >= 3) + #define WOLFSSL_HASH_FLAGS + #endif +#endif + +#ifdef WOLFSSL_HAVE_MLKEM +#define HAVE_PQC +#endif + +/* Enable Post-Quantum Cryptography if we have liboqs from the OpenQuantumSafe + * group */ +#ifdef HAVE_LIBOQS +#define HAVE_PQC +#define HAVE_FALCON +#ifndef HAVE_DILITHIUM + #define HAVE_DILITHIUM +#endif +#ifndef WOLFSSL_NO_SPHINCS + #define HAVE_SPHINCS +#endif +#ifndef WOLFSSL_HAVE_MLKEM + #define WOLFSSL_HAVE_MLKEM + #define WOLFSSL_KYBER512 + #define WOLFSSL_KYBER768 + #define WOLFSSL_KYBER1024 + #define WOLFSSL_WC_ML_KEM_512 + #define WOLFSSL_WC_ML_KEM_768 + #define WOLFSSL_WC_ML_KEM_1024 +#endif +#endif + +#if (defined(HAVE_LIBOQS) || \ + defined(HAVE_LIBXMSS) || \ + defined(HAVE_LIBLMS) || \ + defined(WOLFSSL_DUAL_ALG_CERTS) || \ + defined(HAVE_ASCON)) && \ + !defined(WOLFSSL_EXPERIMENTAL_SETTINGS) + #error Experimental settings without WOLFSSL_EXPERIMENTAL_SETTINGS +#endif + +#if defined(HAVE_PQC) && !defined(HAVE_LIBOQS) && !defined(WOLFSSL_HAVE_MLKEM) +#error Please do not define HAVE_PQC yourself. +#endif + +/* If no malloc then make sure the valid Dilithium settings are used */ +#if defined(HAVE_DILITHIUM) && defined(WOLFSSL_NO_MALLOC) + #undef WOLFSSL_DILITHIUM_VERIFY_NO_MALLOC + #define WOLFSSL_DILITHIUM_VERIFY_NO_MALLOC +#endif + +#if defined(HAVE_PQC) && defined(WOLFSSL_DTLS13) && \ + !defined(WOLFSSL_DTLS_CH_FRAG) +#warning "Using DTLS 1.3 + pqc without WOLFSSL_DTLS_CH_FRAG will probably" \ + "fail.Use --enable-dtls-frag-ch to enable it." +#endif +#if !defined(WOLFSSL_DTLS13) && defined(WOLFSSL_DTLS_CH_FRAG) +#error "WOLFSSL_DTLS_CH_FRAG only works with DTLS 1.3" +#endif + +/* SRTP requires DTLS */ +#if defined(WOLFSSL_SRTP) && !defined(WOLFSSL_DTLS) + #error The SRTP extension requires DTLS +#endif + +/* FIPS v5 and older doesn't support WOLF_PRIVATE_KEY_ID with PK callbacks */ +#if defined(HAVE_FIPS) && FIPS_VERSION_LT(5,3) && defined(HAVE_PK_CALLBACKS) + #define NO_WOLF_PRIVATE_KEY_ID +#endif + +/* Are we using an external private key store like: + * PKCS11 / HSM / crypto callback / PK callback */ +#if !defined(WOLF_PRIVATE_KEY_ID) && !defined(NO_WOLF_PRIVATE_KEY_ID) && \ + (defined(HAVE_PKCS11) || defined(HAVE_PK_CALLBACKS) || \ + defined(WOLF_CRYPTO_CB) || defined(WOLFSSL_KCAPI)) + /* Enables support for using wolfSSL_CTX_use_PrivateKey_Id and + * wolfSSL_CTX_use_PrivateKey_Label */ + #define WOLF_PRIVATE_KEY_ID +#endif + +/* With titan cache size there is too many sessions to fit with the default + * multiplier of 8 */ +#if defined(TITAN_SESSION_CACHE) && !defined(NO_SESSION_CACHE_REF) + #define NO_SESSION_CACHE_REF +#endif + +/* (D)TLS v1.3 requires 64-bit number wrappers as does XMSS and LMS. */ +#if defined(WOLFSSL_TLS13) || defined(WOLFSSL_DTLS_DROP_STATS) || \ + (defined(WOLFSSL_WC_XMSS) && (!defined(WOLFSSL_XMSS_MAX_HEIGHT) || \ + WOLFSSL_XMSS_MAX_HEIGHT > 32)) || (defined(WOLFSSL_WC_LMS) && \ + !defined(WOLFSSL_LMS_VERIFY_ONLY)) + #undef WOLFSSL_W64_WRAPPER + #define WOLFSSL_W64_WRAPPER +#endif + +/* wc_xmss and wc_lms require these misc.c functions. */ +#if defined(WOLFSSL_WC_XMSS) || defined(WOLFSSL_WC_LMS) + #undef WOLFSSL_NO_INT_ENCODE + #undef WOLFSSL_NO_INT_DECODE +#endif + +/* DTLS v1.3 requires AES ECB if using AES */ +#if defined(WOLFSSL_DTLS13) && !defined(NO_AES) && \ + !defined(WOLFSSL_AES_DIRECT) +#define WOLFSSL_AES_DIRECT +#endif + +#if defined(WOLFSSL_DTLS13) && (!defined(WOLFSSL_DTLS) || \ + !defined(WOLFSSL_TLS13)) +#error "DTLS v1.3 requires both WOLFSSL_TLS13 and WOLFSSL_DTLS" +#endif + +#if defined(WOLFSSL_QUIC) && defined(WOLFSSL_CALLBACKS) + #error WOLFSSL_QUIC is incompatible with WOLFSSL_CALLBACKS. +#endif + +/* RSA Key Checking is disabled by default unless WOLFSSL_RSA_KEY_CHECK is + * defined or FIPS v2 3389, FIPS v5 or later. + * Not allowed for: + * RSA public only, CAVP selftest, fast RSA, user RSA, QAT or CryptoCell */ +#if (defined(WOLFSSL_RSA_KEY_CHECK) || (defined(HAVE_FIPS) && FIPS_VERSION_GE(2,0))) && \ + !defined(WOLFSSL_NO_RSA_KEY_CHECK) && !defined(WOLFSSL_RSA_PUBLIC_ONLY) && \ + !defined(HAVE_INTEL_QA) && !defined(WOLFSSL_CRYPTOCELL) && \ + !defined(HAVE_SELFTEST) + + #undef WOLFSSL_RSA_KEY_CHECK + #define WOLFSSL_RSA_KEY_CHECK +#endif + +/* ED448 Requires Shake256 */ +#if defined(HAVE_ED448) && defined(WOLFSSL_SHA3) + #undef WOLFSSL_SHAKE256 + #define WOLFSSL_SHAKE256 +#endif + +/* SHAKE - Not allowed in FIPS v5.2 or older */ +#if defined(WOLFSSL_SHA3) && (defined(HAVE_SELFTEST) || \ + (defined(HAVE_FIPS) && FIPS_VERSION_LE(5,2))) + #undef WOLFSSL_NO_SHAKE128 + #define WOLFSSL_NO_SHAKE128 + #undef WOLFSSL_NO_SHAKE256 + #define WOLFSSL_NO_SHAKE256 +#endif +/* SHAKE Disable */ +#ifdef WOLFSSL_NO_SHAKE128 + #undef WOLFSSL_SHAKE128 +#endif +#ifdef WOLFSSL_NO_SHAKE256 + #undef WOLFSSL_SHAKE256 +#endif + + +/* Encrypted Client Hello - requires HPKE */ +#if defined(HAVE_ECH) && !defined(HAVE_HPKE) + #define HAVE_HPKE +#endif + +/* Provide way to forcefully disable use of XREALLOC */ +#ifdef WOLFSSL_NO_REALLOC + #undef XREALLOC +#endif + + +/* --------------------------------------------------------------------------- + * Deprecated Algorithm Handling + * Unless allowed via a build macro, disable support + * ---------------------------------------------------------------------------*/ + +/* RC4: Per RFC7465 Feb 2015, the cipher suite has been deprecated due to a + * number of exploits capable of decrypting portions of encrypted messages. */ +#ifndef WOLFSSL_ALLOW_RC4 + #undef NO_RC4 + #define NO_RC4 +#endif + +#if !defined(WOLFSSL_NO_ASYNC_IO) || defined(WOLFSSL_ASYNC_CRYPT) || \ + defined(WOLFSSL_NONBLOCK_OCSP) + /* Enable asynchronous support in TLS functions to support one or more of + * the following: + * - re-entry after a network blocking return + * - re-entry after OCSP blocking return + * - asynchronous cryptography */ + #undef WOLFSSL_ASYNC_IO + #define WOLFSSL_ASYNC_IO +#endif + +#ifdef WOLFSSL_SYS_CA_CERTS + #ifdef NO_FILESYSTEM + /* Turning off WOLFSSL_SYS_CA_CERTS b/c NO_FILESYSTEM is defined */ + #undef WOLFSSL_SYS_CA_CERTS + #endif + + #ifdef NO_CERTS + /* Turning off WOLFSSL_SYS_CA_CERTS b/c NO_CERTS is defined */ + #undef WOLFSSL_SYS_CA_CERTS + #endif +#endif /* WOLFSSL_SYS_CA_CERTS */ + +#if defined(SESSION_CACHE_DYNAMIC_MEM) && defined(PERSIST_SESSION_CACHE) +#error "Dynamic session cache currently does not support persistent session cache." +#endif + +#ifdef WOLFSSL_HARDEN_TLS + #if defined(HAVE_TRUNCATED_HMAC) && !defined(WOLFSSL_HARDEN_TLS_ALLOW_TRUNCATED_HMAC) + #error "Truncated HMAC Extension not allowed" + /* https://www.rfc-editor.org/rfc/rfc9325#section-4.6 */ + #endif + #if !defined(NO_OLD_TLS) && !defined(WOLFSSL_HARDEN_TLS_ALLOW_OLD_TLS) + #error "TLS < 1.2 protocol versions not allowed" + /* https://www.rfc-editor.org/rfc/rfc9325#section-3.1.1 */ + #endif + #if !defined(WOLFSSL_NO_TLS12) && !defined(HAVE_SECURE_RENEGOTIATION) && \ + !defined(HAVE_SERVER_RENEGOTIATION_INFO) && !defined(WOLFSSL_HARDEN_TLS_NO_SCR_CHECK) + #error "TLS 1.2 requires at least HAVE_SERVER_RENEGOTIATION_INFO to send the secure renegotiation extension" + /* https://www.rfc-editor.org/rfc/rfc9325#section-3.5 */ + #endif + #if !defined(WOLFSSL_EXTRA_ALERTS) || !defined(WOLFSSL_CHECK_ALERT_ON_ERR) + #error "RFC9325 requires some additional alerts to be sent" + #endif + /* Ciphersuite check done in internal.h */ +#endif + +/* Some final sanity checks. See esp32-crypt.h for Apple HomeKit config. */ +#if defined(WOLFSSL_APPLE_HOMEKIT) || defined(CONFIG_WOLFSSL_APPLE_HOMEKIT) + #ifndef WOLFCRYPT_HAVE_SRP + #error "WOLFCRYPT_HAVE_SRP is required for Apple Homekit" + #endif + #ifndef HAVE_CHACHA + #error "HAVE_CHACHA is required for Apple Homekit" + #endif + #ifdef USE_FAST_MATH + #ifdef FP_MAX_BITS + #if FP_MAX_BITS < (8192 * 2) + #error "HomeKit FP_MAX_BITS must at least (8192 * 2)" + #endif + #else + #error "HomeKit FP_MAX_BITS must be assigned a value (8192 * 2)" + #endif + #endif +#endif + +#if defined(CONFIG_WOLFSSL_NO_ASN_STRICT) && !defined(WOLFSSL_NO_ASN_STRICT) + /* The settings.h and/or user_settings.h should have detected config + * values from Kconfig and set the appropriate wolfSSL macro: */ + #error "CONFIG_WOLFSSL_NO_ASN_STRICT found without WOLFSSL_NO_ASN_STRICT" +#endif + +#if defined(WOLFSSL_ESPIDF) && defined(ARDUINO) + #error "Found both ESPIDF and ARDUINO. Pick one." +#endif + +#if defined(CONFIG_MBEDTLS_CERTIFICATE_BUNDLE) && \ + defined(CONFIG_WOLFSSL_CERTIFICATE_BUNDLE) && \ + CONFIG_MBEDTLS_CERTIFICATE_BUNDLE && \ + CONFIG_WOLFSSL_CERTIFICATE_BUNDLE + #error "mbedTLS and wolfSSL Certificate Bundles both enabled. Pick one". +#endif + +#if defined(HAVE_FIPS) && defined(HAVE_PKCS11) + #error "PKCS11 not allowed with FIPS enabled (Crypto outside boundary)" +#endif + +#if defined(WOLFSSL_CAAM_BLOB) + #ifndef WOLFSSL_CAAM + #error "WOLFSSL_CAAM_BLOB requires WOLFSSL_CAAM" + #endif +#endif + +#if defined(HAVE_ED25519) + #ifndef WOLFSSL_SHA512 + #error "HAVE_ED25519 requires WOLFSSL_SHA512" + #endif +#endif + +#if defined(OPENSSL_ALL) && defined(OPENSSL_COEXIST) + #error "OPENSSL_ALL can not be defined with OPENSSL_COEXIST" +#endif + +#if !defined(NO_DSA) && defined(NO_SHA) + #error "Please disable DSA if disabling SHA-1" +#endif + +#if defined(WOLFSSL_SYS_CRYPTO_POLICY) + #if !defined(WOLFSSL_CRYPTO_POLICY_FILE) + #error "WOLFSSL_SYS_CRYPTO_POLICY requires a crypto policy file" + #endif /* ! WOLFSSL_CRYPTO_POLICY_FILE */ + + #if !defined(OPENSSL_EXTRA) + #error "WOLFSSL_SYS_CRYPTO_POLICY requires OPENSSL_EXTRA" + #endif /* ! OPENSSL_EXTRA */ +#endif /* WOLFSSL_SYS_CRYPTO_POLICY */ + +/* if configure.ac turned on this feature, HAVE_ENTROPY_MEMUSE will be set, + * also define HAVE_WOLFENTROPY */ +#ifdef HAVE_ENTROPY_MEMUSE + #ifndef HAVE_WOLFENTROPY + #define HAVE_WOLFENTROPY + #endif +#elif defined(HAVE_WOLFENTROPY) + /* else if user_settings.h only defined HAVE_WOLFENTROPY + * also define HAVE_ENTROPY_MEMUSE */ + #ifndef HAVE_ENTROPY_MEMUSE + #define HAVE_ENTROPY_MEMUSE + #endif +#endif /* HAVE_ENTROPY_MEMUSE */ + +#if defined(NO_WOLFSSL_CLIENT) && defined(NO_WOLFSSL_SERVER) && \ + !defined(WOLFCRYPT_ONLY) && !defined(NO_TLS) +#error "If TLS is enabled please make sure either client or server is enabled." +#endif + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/sha.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/sha.h @@ -0,0 +1,225 @@ +/* sha.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/sha.h +*/ + + +#ifndef WOLF_CRYPT_SHA_H +#define WOLF_CRYPT_SHA_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifndef NO_SHA + +#if FIPS_VERSION3_GE(2,0,0) + #include <wolfssl/wolfcrypt/fips.h> +#endif /* HAVE_FIPS_VERSION >= 2 */ + +#ifdef FREESCALE_LTC_SHA + #include "fsl_ltc.h" +#endif + +#if defined(WOLFSSL_IMXRT1170_CAAM) + #include "fsl_device_registers.h" + #include "fsl_caam.h" +#endif + +#ifdef WOLFSSL_IMXRT_DCP + #include "fsl_dcp.h" +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +#if FIPS_VERSION3_GE(6,0,0) + extern const unsigned int wolfCrypt_FIPS_sha_ro_sanity[2]; + WOLFSSL_LOCAL int wolfCrypt_FIPS_SHA_sanity(void); +#endif + +/* avoid redefinition of structs */ +#if !defined(HAVE_FIPS) || \ + (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)) + +#ifdef WOLFSSL_MICROCHIP_PIC32MZ + #include <wolfssl/wolfcrypt/port/pic32/pic32mz-crypt.h> +#endif +#ifdef STM32_HASH + #include <wolfssl/wolfcrypt/port/st/stm32.h> +#endif +#ifdef WOLFSSL_ASYNC_CRYPT + #include <wolfssl/wolfcrypt/async.h> +#endif +#ifdef WOLFSSL_ESP32_CRYPT + #include <wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h> +#endif +#if defined(WOLFSSL_SILABS_SE_ACCEL) + #include <wolfssl/wolfcrypt/port/silabs/silabs_hash.h> +#endif +#if defined(WOLFSSL_MAX3266X) || defined(WOLFSSL_MAX3266X_OLD) + #include <wolfssl/wolfcrypt/port/maxim/max3266x.h> +#endif + +#if !defined(NO_OLD_SHA_NAMES) + #define SHA WC_SHA +#endif + +#ifndef NO_OLD_WC_NAMES + #define Sha wc_Sha + #define SHA_BLOCK_SIZE WC_SHA_BLOCK_SIZE + #define SHA_DIGEST_SIZE WC_SHA_DIGEST_SIZE + #define SHA_PAD_SIZE WC_SHA_PAD_SIZE +#endif + +/* in bytes */ +enum { + WC_SHA = WC_HASH_TYPE_SHA, + WC_SHA_BLOCK_SIZE = 64, + WC_SHA_DIGEST_SIZE = 20, + WC_SHA_PAD_SIZE = 56 +}; + + +#if defined(WOLFSSL_TI_HASH) + #include "wolfssl/wolfcrypt/port/ti/ti-hash.h" + +#elif defined(WOLFSSL_IMX6_CAAM) && !defined(WOLFSSL_QNX_CAAM) + #include "wolfssl/wolfcrypt/port/caam/wolfcaam_sha.h" +#elif (defined(WOLFSSL_RENESAS_TSIP_TLS) || \ + defined(WOLFSSL_RENESAS_TSIP_CRYPTONLY)) && \ + !defined(NO_WOLFSSL_RENESAS_TSIP_CRYPT_HASH) + #include "wolfssl/wolfcrypt/port/Renesas/renesas_tsip_types.h" +#elif defined(WOLFSSL_RENESAS_RX64_HASH) + #include "wolfssl/wolfcrypt/port/Renesas/renesas-rx64-hw-crypt.h" +#elif defined(WOLFSSL_RENESAS_RSIP) && \ + !defined(NO_WOLFSSL_RENESAS_FSPSM_HASH) + #include "wolfssl/wolfcrypt/port/Renesas/renesas-fspsm-crypt.h" +#else + +#if defined(WOLFSSL_SE050) && defined(WOLFSSL_SE050_HASH) + #include "wolfssl/wolfcrypt/port/nxp/se050_port.h" +#endif + +#if defined(WOLFSSL_HAVE_PSA) && !defined(WOLFSSL_PSA_NO_HASH) +#include <psa/crypto.h> +#undef WOLFSSL_NO_HASH_RAW +#define WOLFSSL_NO_HASH_RAW +#endif + +/* Sha digest */ +struct wc_Sha { +#ifdef FREESCALE_LTC_SHA + ltc_hash_ctx_t ctx; +#elif defined(WOLFSSL_SE050) && defined(WOLFSSL_SE050_HASH) + SE050_HASH_Context se050Ctx; +#elif defined(STM32_HASH) + STM32_HASH_Context stmCtx; +#elif defined(WOLFSSL_SILABS_SE_ACCEL) + wc_silabs_sha_t silabsCtx; +#elif defined(WOLFSSL_IMXRT_DCP) + dcp_handle_t handle; + dcp_hash_ctx_t ctx; +#elif defined(WOLFSSL_HAVE_PSA) && !defined(WOLFSSL_PSA_NO_HASH) + psa_hash_operation_t psa_ctx; +#else + word32 buffLen; /* in bytes */ + word32 loLen; /* length in bytes */ + word32 hiLen; /* length in bytes */ + word32 buffer[WC_SHA_BLOCK_SIZE / sizeof(word32)]; + #ifdef WOLFSSL_PIC32MZ_HASH + word32 digest[PIC32_DIGEST_SIZE / sizeof(word32)]; + #else + word32 digest[WC_SHA_DIGEST_SIZE / sizeof(word32)]; + #endif +#endif + void* heap; +#ifdef WOLFSSL_PIC32MZ_HASH + hashUpdCache cache; /* cache for updates */ +#endif +#ifdef WOLFSSL_ASYNC_CRYPT + WC_ASYNC_DEV asyncDev; +#endif /* WOLFSSL_ASYNC_CRYPT */ +#ifdef WOLF_CRYPTO_CB + int devId; + void* devCtx; /* generic crypto callback context */ +#endif +#if defined(MAX3266X_SHA_CB) || defined(MAX3266X_SHA) + wc_MXC_Sha mxcCtx; +#endif +#ifdef WOLFSSL_IMXRT1170_CAAM + caam_hash_ctx_t ctx; + caam_handle_t hndl; +#endif +#if defined(WOLFSSL_DEVCRYPTO_HASH) || defined(WOLFSSL_HASH_KEEP) + byte* msg; + word32 used; + word32 len; +#endif +#if defined(WOLFSSL_ESP32_CRYPT) && \ + !defined(NO_WOLFSSL_ESP32_CRYPT_HASH) + WC_ESP32SHA ctx; +#endif +#ifdef WOLFSSL_HASH_FLAGS + word32 flags; /* enum wc_HashFlags in hash.h */ +#endif +}; + +#ifndef WC_SHA_TYPE_DEFINED + typedef struct wc_Sha wc_Sha; + #define WC_SHA_TYPE_DEFINED +#endif + +#endif /* WOLFSSL_TI_HASH */ + + +#endif /* HAVE_FIPS */ + +WOLFSSL_API int wc_InitSha(wc_Sha* sha); +WOLFSSL_API int wc_InitSha_ex(wc_Sha* sha, void* heap, int devId); +WOLFSSL_API int wc_ShaUpdate(wc_Sha* sha, const byte* data, word32 len); +WOLFSSL_API int wc_ShaFinalRaw(wc_Sha* sha, byte* hash); +WOLFSSL_API int wc_ShaFinal(wc_Sha* sha, byte* hash); +WOLFSSL_API void wc_ShaFree(wc_Sha* sha); + +WOLFSSL_API int wc_ShaGetHash(wc_Sha* sha, byte* hash); +WOLFSSL_API int wc_ShaCopy(wc_Sha* src, wc_Sha* dst); +#if defined(OPENSSL_EXTRA) || defined(HAVE_CURL) +WOLFSSL_API int wc_ShaTransform(wc_Sha* sha, const unsigned char* data); +#endif + +#ifdef WOLFSSL_PIC32MZ_HASH +WOLFSSL_API void wc_ShaSizeSet(wc_Sha* sha, word32 len); +#endif + +#ifdef WOLFSSL_HASH_FLAGS + WOLFSSL_API int wc_ShaSetFlags(wc_Sha* sha, word32 flags); + WOLFSSL_API int wc_ShaGetFlags(wc_Sha* sha, word32* flags); +#endif + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* NO_SHA */ +#endif /* WOLF_CRYPT_SHA_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/sha256.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/sha256.h @@ -0,0 +1,351 @@ +/* sha256.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/sha256.h +*/ + + + +#ifndef WOLF_CRYPT_SHA256_H +#define WOLF_CRYPT_SHA256_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifndef NO_SHA256 + +#if FIPS_VERSION3_GE(2,0,0) + #include <wolfssl/wolfcrypt/fips.h> +#endif /* HAVE_FIPS_VERSION >= 2 */ + +#ifdef FREESCALE_LTC_SHA + #include "fsl_ltc.h" +#endif + +#if defined(WOLFSSL_IMXRT1170_CAAM) + #include "fsl_device_registers.h" + #include "fsl_caam.h" +#endif + +#ifdef WOLFSSL_IMXRT_DCP + #include "fsl_dcp.h" +#endif + +#if defined(WOLFSSL_PSOC6_CRYPTO) +#include "cy_crypto_core_sha.h" +#include "cy_device_headers.h" +#include "cy_crypto_common.h" +#include "cy_crypto_core.h" +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +#if FIPS_VERSION3_GE(6,0,0) + extern const unsigned int wolfCrypt_FIPS_sha256_ro_sanity[2]; + WOLFSSL_LOCAL int wolfCrypt_FIPS_SHA256_sanity(void); +#endif + +/* avoid redefinition of structs */ +#if !defined(HAVE_FIPS) || \ + (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)) + +#ifdef WOLFSSL_MICROCHIP_PIC32MZ + #include <wolfssl/wolfcrypt/port/pic32/pic32mz-crypt.h> +#endif +#ifdef STM32_HASH + #include <wolfssl/wolfcrypt/port/st/stm32.h> +#endif +#ifdef WOLFSSL_ASYNC_CRYPT + #include <wolfssl/wolfcrypt/async.h> +#endif +#if defined(WOLFSSL_DEVCRYPTO) && defined(WOLFSSL_DEVCRYPTO_HASH) + #include <wolfssl/wolfcrypt/port/devcrypto/wc_devcrypto.h> +#endif +#if defined(WOLFSSL_ESP32_CRYPT) + #include "wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h" +#endif +#if defined(WOLFSSL_CRYPTOCELL) + #include <wolfssl/wolfcrypt/port/arm/cryptoCell.h> +#endif +#if defined(WOLFSSL_SILABS_SE_ACCEL) + #include <wolfssl/wolfcrypt/port/silabs/silabs_hash.h> +#endif +#if defined(WOLFSSL_KCAPI_HASH) + #include "wolfssl/wolfcrypt/port/kcapi/kcapi_hash.h" +#endif + +#if defined(WOLFSSL_HAVE_PSA) && !defined(WOLFSSL_PSA_NO_HASH) +#include <psa/crypto.h> +#undef WOLFSSL_NO_HASH_RAW +#define WOLFSSL_NO_HASH_RAW +#endif + +#if defined(_MSC_VER) + #define SHA256_NOINLINE __declspec(noinline) +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__GNUC__) + #define SHA256_NOINLINE __attribute__((noinline)) +#else + #define SHA256_NOINLINE +#endif + +#if !defined(NO_OLD_SHA_NAMES) + #define SHA256 WC_SHA256 +#endif + +#ifndef NO_OLD_WC_NAMES + #define Sha256 wc_Sha256 + #define SHA256_BLOCK_SIZE WC_SHA256_BLOCK_SIZE + #define SHA256_DIGEST_SIZE WC_SHA256_DIGEST_SIZE + #define SHA256_PAD_SIZE WC_SHA256_PAD_SIZE +#endif + +/* in bytes */ +enum { + WC_SHA256 = WC_HASH_TYPE_SHA256, + WC_SHA256_BLOCK_SIZE = 64, + WC_SHA256_DIGEST_SIZE = 32, + WC_SHA256_PAD_SIZE = 56 +}; + + +#ifdef WOLFSSL_TI_HASH + #include "wolfssl/wolfcrypt/port/ti/ti-hash.h" +#elif defined(WOLFSSL_IMX6_CAAM) && !defined(WOLFSSL_QNX_CAAM) + #include "wolfssl/wolfcrypt/port/caam/wolfcaam_sha.h" +#elif defined(WOLFSSL_AFALG_HASH) + #include "wolfssl/wolfcrypt/port/af_alg/afalg_hash.h" +#elif (defined(WOLFSSL_RENESAS_TSIP_TLS) || \ + defined(WOLFSSL_RENESAS_TSIP_CRYPTONLY)) && \ + !defined(NO_WOLFSSL_RENESAS_TSIP_CRYPT_HASH) + #include "wolfssl/wolfcrypt/port/Renesas/renesas_tsip_types.h" +#elif (defined(WOLFSSL_RENESAS_SCEPROTECT) || \ + defined(WOLFSSL_RENESAS_RSIP)) && \ + !defined(NO_WOLFSSL_RENESAS_FSPSM_HASH) + #include "wolfssl/wolfcrypt/port/Renesas/renesas-fspsm-crypt.h" +#elif defined(WOLFSSL_RENESAS_RX64_HASH) + #include "wolfssl/wolfcrypt/port/Renesas/renesas-rx64-hw-crypt.h" +#else + +#if defined(WOLFSSL_MAX3266X) || defined(WOLFSSL_MAX3266X_OLD) + #include "wolfssl/wolfcrypt/port/maxim/max3266x.h" +#endif + +#if defined(WOLFSSL_SE050) && defined(WOLFSSL_SE050_HASH) + #include "wolfssl/wolfcrypt/port/nxp/se050_port.h" +#endif + +#ifdef WOLFSSL_MAXQ10XX_CRYPTO + #include <wolfssl/wolfcrypt/port/maxim/maxq10xx.h> +#endif + +#ifdef HAVE_ARIA + #include "mcapi.h" + #include "mcapi_error.h" +#endif + +/* wc_Sha256 digest */ +struct wc_Sha256 { +#ifdef FREESCALE_LTC_SHA + ltc_hash_ctx_t ctx; +#elif defined(WOLFSSL_SE050) && defined(WOLFSSL_SE050_HASH) + SE050_HASH_Context se050Ctx; +#elif defined(STM32_HASH_SHA2) + STM32_HASH_Context stmCtx; +#elif defined(WOLFSSL_SILABS_SE_ACCEL) + wc_silabs_sha_t silabsCtx; +#elif defined(WOLFSSL_IMXRT_DCP) + dcp_handle_t handle; + dcp_hash_ctx_t ctx; +#elif defined(WOLFSSL_PSOC6_CRYPTO) + cy_stc_crypto_sha_state_t hash_state; + cy_en_crypto_sha_mode_t sha_mode; + cy_stc_crypto_v2_sha256_buffers_t sha_buffers; +#elif defined(WOLFSSL_HAVE_PSA) && !defined(WOLFSSL_PSA_NO_HASH) + psa_hash_operation_t psa_ctx; +#else +#ifdef WC_64BIT_CPU + /* alignment on digest and buffer speeds up ARMv8 crypto operations */ + ALIGN16 word32 digest[WC_SHA256_DIGEST_SIZE / sizeof(word32)]; + ALIGN16 word32 buffer[WC_SHA256_BLOCK_SIZE / sizeof(word32)]; +#else + word32 digest[WC_SHA256_DIGEST_SIZE / sizeof(word32)]; + word32 buffer[WC_SHA256_BLOCK_SIZE / sizeof(word32)]; +#endif + word32 buffLen; /* in bytes */ + word32 loLen; /* length in bytes */ + word32 hiLen; /* length in bytes */ + +#ifdef WC_C_DYNAMIC_FALLBACK + int sha_method; +#endif + +#endif + void* heap; +#ifdef WOLFSSL_PIC32MZ_HASH + hashUpdCache cache; /* cache for updates */ +#endif +#ifdef WOLFSSL_ASYNC_CRYPT + WC_ASYNC_DEV asyncDev; +#endif /* WOLFSSL_ASYNC_CRYPT */ +#ifdef WOLFSSL_SMALL_STACK_CACHE + word32* W; +#endif /* !FREESCALE_LTC_SHA && !STM32_HASH_SHA2 */ +#ifdef WOLFSSL_DEVCRYPTO_HASH + WC_CRYPTODEV ctx; +#endif +#if defined(MAX3266X_SHA_CB) || defined(MAX3266X_SHA) + wc_MXC_Sha mxcCtx; +#endif +#if defined(WOLFSSL_DEVCRYPTO_HASH) || defined(WOLFSSL_HASH_KEEP) + byte* msg; + word32 used; + word32 len; +#endif +#if defined(WOLFSSL_ESP32_CRYPT) && \ + !defined(NO_WOLFSSL_ESP32_CRYPT_HASH) && \ + (!defined(NO_WOLFSSL_ESP32_CRYPT_HASH_SHA256) || \ + !defined(NO_WOLFSSL_ESP32_CRYPT_HASH_SHA224)) + WC_ESP32SHA ctx; +#endif +#ifdef WOLFSSL_MAXQ10XX_CRYPTO + maxq_sha256_t maxq_ctx; +#endif +#ifdef WOLFSSL_CRYPTOCELL + CRYS_HASHUserContext_t ctx; +#endif +#ifdef WOLFSSL_KCAPI_HASH + wolfssl_KCAPI_Hash kcapi; +#endif +#ifdef WOLF_CRYPTO_CB + int devId; + void* devCtx; /* generic crypto callback context */ +#endif +#ifdef WOLFSSL_IMXRT1170_CAAM + caam_hash_ctx_t ctx; + caam_handle_t hndl; +#endif +#ifdef HAVE_ARIA + MC_HSESSION hSession; +#endif +#ifdef WOLFSSL_HASH_FLAGS + word32 flags; /* enum wc_HashFlags in hash.h */ +#endif +}; + +#ifndef WC_SHA256_TYPE_DEFINED + typedef struct wc_Sha256 wc_Sha256; + #define WC_SHA256_TYPE_DEFINED +#endif + +#endif + +#endif /* HAVE_FIPS */ + +WOLFSSL_API int wc_InitSha256(wc_Sha256* sha); +WOLFSSL_API int wc_InitSha256_ex(wc_Sha256* sha, void* heap, int devId); +WOLFSSL_API int wc_Sha256Update(wc_Sha256* sha, const byte* data, word32 len); + +#if !defined(WOLFSSL_KCAPI_HASH) && !defined(WOLFSSL_AFALG_HASH) +WOLFSSL_API int wc_Sha256FinalRaw(wc_Sha256* sha256, byte* hash); +#endif +WOLFSSL_API int wc_Sha256Final(wc_Sha256* sha256, byte* hash); +WOLFSSL_API void wc_Sha256Free(wc_Sha256* sha256); +#if (defined(OPENSSL_EXTRA) || defined(HAVE_CURL)) && \ + !defined(WOLFSSL_KCAPI_HASH) && !defined(WOLFSSL_AFALG_HASH) +WOLFSSL_API int wc_Sha256Transform(wc_Sha256* sha, const unsigned char* data); +#endif +#if defined(WOLFSSL_HAVE_LMS) && !defined(WOLFSSL_LMS_FULL_HASH) +WOLFSSL_API int wc_Sha256HashBlock(wc_Sha256* sha, const unsigned char* data, + unsigned char* hash); +#endif +#if defined(WOLFSSL_HASH_KEEP) +WOLFSSL_API int wc_Sha256_Grow(wc_Sha256* sha256, const byte* in, int inSz); +#endif +WOLFSSL_API int wc_Sha256GetHash(wc_Sha256* sha256, byte* hash); +WOLFSSL_API int wc_Sha256Copy(wc_Sha256* src, wc_Sha256* dst); + +#ifdef WOLFSSL_PIC32MZ_HASH +WOLFSSL_API void wc_Sha256SizeSet(wc_Sha256* sha256, word32 len); +#endif + +#ifdef WOLFSSL_HASH_FLAGS + WOLFSSL_API int wc_Sha256SetFlags(wc_Sha256* sha256, word32 flags); + WOLFSSL_API int wc_Sha256GetFlags(wc_Sha256* sha256, word32* flags); +#endif + +#ifdef WOLFSSL_SHA224 +/* avoid redefinition of structs */ +#if !defined(HAVE_FIPS) || \ + (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)) + +#if !defined(NO_OLD_SHA_NAMES) + #define SHA224 WC_SHA224 +#endif + +#ifndef NO_OLD_WC_NAMES + #define Sha224 wc_Sha224 + #define SHA224_BLOCK_SIZE WC_SHA224_BLOCK_SIZE + #define SHA224_DIGEST_SIZE WC_SHA224_DIGEST_SIZE + #define SHA224_PAD_SIZE WC_SHA224_PAD_SIZE +#endif + +/* in bytes */ +enum { + WC_SHA224 = WC_HASH_TYPE_SHA224, + WC_SHA224_BLOCK_SIZE = WC_SHA256_BLOCK_SIZE, + WC_SHA224_DIGEST_SIZE = 28, + WC_SHA224_PAD_SIZE = WC_SHA256_PAD_SIZE +}; + + +#ifndef WC_SHA224_TYPE_DEFINED + typedef struct wc_Sha256 wc_Sha224; + #define WC_SHA224_TYPE_DEFINED +#endif +#endif /* HAVE_FIPS */ + +WOLFSSL_API int wc_InitSha224(wc_Sha224* sha224); +WOLFSSL_API int wc_InitSha224_ex(wc_Sha224* sha224, void* heap, int devId); +WOLFSSL_API int wc_Sha224Update(wc_Sha224* sha224, const byte* data, word32 len); +WOLFSSL_API int wc_Sha224Final(wc_Sha224* sha224, byte* hash); +WOLFSSL_API void wc_Sha224Free(wc_Sha224* sha224); + +#if defined(WOLFSSL_HASH_KEEP) +WOLFSSL_API int wc_Sha224_Grow(wc_Sha224* sha224, const byte* in, int inSz); +#endif +WOLFSSL_API int wc_Sha224GetHash(wc_Sha224* sha224, byte* hash); +WOLFSSL_API int wc_Sha224Copy(wc_Sha224* src, wc_Sha224* dst); + +#ifdef WOLFSSL_HASH_FLAGS + WOLFSSL_API int wc_Sha224SetFlags(wc_Sha224* sha224, word32 flags); + WOLFSSL_API int wc_Sha224GetFlags(wc_Sha224* sha224, word32* flags); +#endif + +#endif /* WOLFSSL_SHA224 */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* NO_SHA256 */ +#endif /* WOLF_CRYPT_SHA256_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/sha3.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/sha3.h @@ -0,0 +1,250 @@ +/* sha3.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + +#ifndef WOLF_CRYPT_SHA3_H +#define WOLF_CRYPT_SHA3_H + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef WOLFSSL_SHA3 + +#ifdef HAVE_FIPS + /* for fips @wc_fips */ + #include <wolfssl/wolfcrypt/fips.h> +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +#if FIPS_VERSION3_GE(6,0,0) + extern const unsigned int wolfCrypt_FIPS_sha3_ro_sanity[2]; + WOLFSSL_LOCAL int wolfCrypt_FIPS_SHA3_sanity(void); +#endif + +#ifdef WOLFSSL_ASYNC_CRYPT + #include <wolfssl/wolfcrypt/async.h> +#endif + +#ifdef STM32_HASH + #include <wolfssl/wolfcrypt/port/st/stm32.h> +#endif + +/* in bytes */ +enum { + /* SHAKE-128 */ + WC_SHA3_128_COUNT = 21, + + WC_SHA3_224 = WC_HASH_TYPE_SHA3_224, + WC_SHA3_224_DIGEST_SIZE = 28, + WC_SHA3_224_COUNT = 18, + + WC_SHA3_256 = WC_HASH_TYPE_SHA3_256, + WC_SHA3_256_DIGEST_SIZE = 32, + WC_SHA3_256_COUNT = 17, + + WC_SHA3_384 = WC_HASH_TYPE_SHA3_384, + WC_SHA3_384_DIGEST_SIZE = 48, + WC_SHA3_384_COUNT = 13, + + WC_SHA3_512 = WC_HASH_TYPE_SHA3_512, + WC_SHA3_512_DIGEST_SIZE = 64, + WC_SHA3_512_COUNT = 9, + + #ifdef WOLFSSL_SHAKE128 + WC_SHAKE128 = WC_HASH_TYPE_SHAKE128, + #endif + #ifdef WOLFSSL_SHAKE256 + WC_SHAKE256 = WC_HASH_TYPE_SHAKE256, + #endif + +#if !defined(HAVE_SELFTEST) || \ + defined(HAVE_SELFTEST_VERSION) && (HAVE_SELFTEST_VERSION >= 2) + /* These values are used for HMAC, not SHA-3 directly. + * They come from from FIPS PUB 202. */ + WC_SHA3_128_BLOCK_SIZE = 168, + WC_SHA3_224_BLOCK_SIZE = 144, + WC_SHA3_256_BLOCK_SIZE = 136, + WC_SHA3_384_BLOCK_SIZE = 104, + WC_SHA3_512_BLOCK_SIZE = 72, +#endif + + WOLF_ENUM_DUMMY_LAST_ELEMENT(WC_SHA3) +}; + +#ifndef NO_OLD_WC_NAMES + #define SHA3_224 WC_SHA3_224 + #define SHA3_224_DIGEST_SIZE WC_SHA3_224_DIGEST_SIZE + #define SHA3_256 WC_SHA3_256 + #define SHA3_256_DIGEST_SIZE WC_SHA3_256_DIGEST_SIZE + #define SHA3_384 WC_SHA3_384 + #define SHA3_384_DIGEST_SIZE WC_SHA3_384_DIGEST_SIZE + #define SHA3_512 WC_SHA3_512 + #define SHA3_512_DIGEST_SIZE WC_SHA3_512_DIGEST_SIZE + #define Sha3 wc_Sha3 + #ifdef WOLFSSL_SHAKE128 + #define SHAKE128 WC_SHAKE128 + #endif + #ifdef WOLFSSL_SHAKE256 + #define SHAKE256 WC_SHAKE256 + #endif +#endif + + + +#ifdef WOLFSSL_XILINX_CRYPT + #include "wolfssl/wolfcrypt/port/xilinx/xil-sha3.h" +#elif defined(WOLFSSL_AFALG_XILINX_SHA3) + #include <wolfssl/wolfcrypt/port/af_alg/afalg_hash.h> +#else + +/* Sha3 digest */ +struct wc_Sha3 { + /* State data that is processed for each block. */ + word64 s[25]; + /* Unprocessed message data. */ + byte t[200]; + /* Index into unprocessed data to place next message byte. */ + byte i; + + void* heap; + +#ifdef WOLF_CRYPTO_CB + int devId; +#endif + +#ifdef WC_C_DYNAMIC_FALLBACK + void (*sha3_block)(word64 *s); + void (*sha3_block_n)(word64 *s, const byte* data, word32 n, + word64 c); +#endif + +#ifdef WOLFSSL_ASYNC_CRYPT + WC_ASYNC_DEV asyncDev; +#endif /* WOLFSSL_ASYNC_CRYPT */ +#ifdef WOLFSSL_HASH_FLAGS + word32 flags; /* enum wc_HashFlags in hash.h */ +#endif +#if defined(STM32_HASH_SHA3) + STM32_HASH_Context stmCtx; +#endif +}; + +#ifndef WC_SHA3_TYPE_DEFINED + typedef struct wc_Sha3 wc_Sha3; + #define WC_SHA3_TYPE_DEFINED +#endif + +#endif + +#if defined(WOLFSSL_SHAKE128) || defined(WOLFSSL_SHAKE256) + #ifndef WC_SHAKE_TYPE_DEFINED + typedef wc_Sha3 wc_Shake; + #define WC_SHAKE_TYPE_DEFINED + #endif +#endif + +WOLFSSL_API int wc_InitSha3_224(wc_Sha3* sha3, void* heap, int devId); +WOLFSSL_API int wc_Sha3_224_Update(wc_Sha3* sha3, const byte* data, word32 len); +WOLFSSL_API int wc_Sha3_224_Final(wc_Sha3* sha3, byte* hash); +WOLFSSL_API void wc_Sha3_224_Free(wc_Sha3* sha3); +WOLFSSL_API int wc_Sha3_224_GetHash(wc_Sha3* sha3, byte* hash); +WOLFSSL_API int wc_Sha3_224_Copy(wc_Sha3* src, wc_Sha3* dst); + +WOLFSSL_API int wc_InitSha3_256(wc_Sha3* sha3, void* heap, int devId); +WOLFSSL_API int wc_Sha3_256_Update(wc_Sha3* sha3, const byte* data, word32 len); +WOLFSSL_API int wc_Sha3_256_Final(wc_Sha3* sha3, byte* hash); +WOLFSSL_API void wc_Sha3_256_Free(wc_Sha3* sha3); +WOLFSSL_API int wc_Sha3_256_GetHash(wc_Sha3* sha3, byte* hash); +WOLFSSL_API int wc_Sha3_256_Copy(wc_Sha3* src, wc_Sha3* dst); + +WOLFSSL_API int wc_InitSha3_384(wc_Sha3* sha3, void* heap, int devId); +WOLFSSL_API int wc_Sha3_384_Update(wc_Sha3* sha3, const byte* data, word32 len); +WOLFSSL_API int wc_Sha3_384_Final(wc_Sha3* sha3, byte* hash); +WOLFSSL_API void wc_Sha3_384_Free(wc_Sha3* sha3); +WOLFSSL_API int wc_Sha3_384_GetHash(wc_Sha3* sha3, byte* hash); +WOLFSSL_API int wc_Sha3_384_Copy(wc_Sha3* src, wc_Sha3* dst); + +WOLFSSL_API int wc_InitSha3_512(wc_Sha3* sha3, void* heap, int devId); +WOLFSSL_API int wc_Sha3_512_Update(wc_Sha3* sha3, const byte* data, word32 len); +WOLFSSL_API int wc_Sha3_512_Final(wc_Sha3* sha3, byte* hash); +WOLFSSL_API void wc_Sha3_512_Free(wc_Sha3* sha3); +WOLFSSL_API int wc_Sha3_512_GetHash(wc_Sha3* sha3, byte* hash); +WOLFSSL_API int wc_Sha3_512_Copy(wc_Sha3* src, wc_Sha3* dst); + +#ifdef WOLFSSL_SHAKE128 +WOLFSSL_API int wc_InitShake128(wc_Shake* shake, void* heap, int devId); +WOLFSSL_API int wc_Shake128_Update(wc_Shake* shake, const byte* data, word32 len); +WOLFSSL_API int wc_Shake128_Final(wc_Shake* shake, byte* hash, word32 hashLen); +WOLFSSL_API int wc_Shake128_Absorb(wc_Shake* shake, const byte* data, + word32 len); +WOLFSSL_API int wc_Shake128_SqueezeBlocks(wc_Shake* shake, byte* out, + word32 blockCnt); +WOLFSSL_API void wc_Shake128_Free(wc_Shake* shake); +WOLFSSL_API int wc_Shake128_Copy(wc_Shake* src, wc_Sha3* dst); +#endif + +#ifdef WOLFSSL_SHAKE256 +WOLFSSL_API int wc_InitShake256(wc_Shake* shake, void* heap, int devId); +WOLFSSL_API int wc_Shake256_Update(wc_Shake* shake, const byte* data, word32 len); +WOLFSSL_API int wc_Shake256_Final(wc_Shake* shake, byte* hash, word32 hashLen); +WOLFSSL_API int wc_Shake256_Absorb(wc_Shake* shake, const byte* data, + word32 len); +WOLFSSL_API int wc_Shake256_SqueezeBlocks(wc_Shake* shake, byte* out, + word32 blockCnt); +WOLFSSL_API void wc_Shake256_Free(wc_Shake* shake); +WOLFSSL_API int wc_Shake256_Copy(wc_Shake* src, wc_Sha3* dst); +#endif + +#ifdef WOLFSSL_HASH_FLAGS + WOLFSSL_API int wc_Sha3_SetFlags(wc_Sha3* sha3, word32 flags); + WOLFSSL_API int wc_Sha3_GetFlags(wc_Sha3* sha3, word32* flags); +#endif + +WOLFSSL_LOCAL void BlockSha3(word64 *s); + +#ifdef WC_SHA3_NO_ASM + /* asm speedups disabled */ + #if defined(USE_INTEL_SPEEDUP) && !defined(WC_MLKEM_NO_ASM) + /* native ML-KEM uses this directly. */ + WOLFSSL_LOCAL void sha3_blocksx4_avx2(word64* s); + #endif +#elif defined(USE_INTEL_SPEEDUP) + WOLFSSL_LOCAL void sha3_block_n_bmi2(word64* s, const byte* data, word32 n, + word64 c); + WOLFSSL_LOCAL void sha3_block_bmi2(word64* s); + WOLFSSL_LOCAL void sha3_block_avx2(word64* s); + WOLFSSL_LOCAL void sha3_blocksx4_avx2(word64* s); +#elif defined(__aarch64__) && defined(WOLFSSL_ARMASM) + #ifdef WOLFSSL_ARMASM_CRYPTO_SHA3 + WOLFSSL_LOCAL void BlockSha3_crypto(word64 *s); + #endif + WOLFSSL_LOCAL void BlockSha3_base(word64 *s); +#endif + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_SHA3 */ +#endif /* WOLF_CRYPT_SHA3_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/sha512.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/sha512.h @@ -0,0 +1,366 @@ +/* sha512.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/sha512.h +*/ + + +#ifndef WOLF_CRYPT_SHA512_H +#define WOLF_CRYPT_SHA512_H + +#include <wolfssl/wolfcrypt/types.h> + +#if defined(WOLFSSL_SHA512) || defined(WOLFSSL_SHA384) + + +#if FIPS_VERSION3_GE(2,0,0) + #include <wolfssl/wolfcrypt/fips.h> +#endif /* HAVE_FIPS_VERSION >= 2 */ + +#ifdef __cplusplus + extern "C" { +#endif + +#if FIPS_VERSION3_GE(6,0,0) + extern const unsigned int wolfCrypt_FIPS_sha512_ro_sanity[2]; + WOLFSSL_LOCAL int wolfCrypt_FIPS_SHA512_sanity(void); +#endif + +/* avoid redefinition of structs */ +#if !defined(HAVE_FIPS) || \ + (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)) + +#ifdef WOLFSSL_ASYNC_CRYPT + #include <wolfssl/wolfcrypt/async.h> +#endif +#ifdef WOLFSSL_ESP32_CRYPT + #include <wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h> +#endif +#if defined(WOLFSSL_SILABS_SE_ACCEL) + #include <wolfssl/wolfcrypt/port/silabs/silabs_hash.h> +#endif +#if defined(WOLFSSL_PSOC6_CRYPTO) + #include "cy_crypto_core_sha.h" + #include "cy_device_headers.h" + #include "cy_crypto_common.h" + #include "cy_crypto_core.h" +#endif +#if defined(WOLFSSL_KCAPI_HASH) + #include <wolfssl/wolfcrypt/port/kcapi/kcapi_hash.h> +#endif + +#if defined(WOLFSSL_IMXRT1170_CAAM) + #include "fsl_device_registers.h" + #include "fsl_caam.h" +#endif + +#ifdef STM32_HASH + #include <wolfssl/wolfcrypt/port/st/stm32.h> +#endif + +#if defined(_MSC_VER) + #define SHA512_NOINLINE __declspec(noinline) +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__GNUC__) + #define SHA512_NOINLINE __attribute__((noinline)) +#else + #define SHA512_NOINLINE +#endif + +#ifdef WOLFSSL_SHA512 + +#if !defined(NO_OLD_SHA_NAMES) + #define SHA512 WC_SHA512 +#endif + +#if !defined(NO_OLD_WC_NAMES) + #define Sha512 wc_Sha512 + #define SHA512_BLOCK_SIZE WC_SHA512_BLOCK_SIZE + #define SHA512_DIGEST_SIZE WC_SHA512_DIGEST_SIZE + #define SHA512_PAD_SIZE WC_SHA512_PAD_SIZE +#endif + +#endif /* WOLFSSL_SHA512 */ + +/* in bytes */ +enum { +#ifdef WOLFSSL_SHA512 + WC_SHA512 = WC_HASH_TYPE_SHA512, + #ifndef WOLFSSL_NOSHA512_224 + WC_SHA512_224 = WC_HASH_TYPE_SHA512_224, + #endif + #ifndef WOLFSSL_NOSHA512_256 + WC_SHA512_256 = WC_HASH_TYPE_SHA512_256, + #endif +#endif + WC_SHA512_BLOCK_SIZE = 128, + WC_SHA512_DIGEST_SIZE = 64, + WC_SHA512_PAD_SIZE = 112, + + WC_SHA512_224_BLOCK_SIZE = WC_SHA512_BLOCK_SIZE, + WC_SHA512_224_DIGEST_SIZE = 28, + WC_SHA512_224_PAD_SIZE = WC_SHA512_PAD_SIZE, + + WC_SHA512_256_BLOCK_SIZE = WC_SHA512_BLOCK_SIZE, + WC_SHA512_256_DIGEST_SIZE = 32, + WC_SHA512_256_PAD_SIZE = WC_SHA512_PAD_SIZE +}; + + +#if defined(WOLFSSL_IMX6_CAAM) && !defined(WOLFSSL_QNX_CAAM) + #include "wolfssl/wolfcrypt/port/caam/wolfcaam_sha.h" +#elif defined(WOLFSSL_RENESAS_RSIP) && \ + !defined(NO_WOLFSSL_RENESAS_FSPSM_HASH) + #include "wolfssl/wolfcrypt/port/Renesas/renesas-fspsm-crypt.h" + +#else +#if defined(WOLFSSL_SE050) && defined(WOLFSSL_SE050_HASH) + #include "wolfssl/wolfcrypt/port/nxp/se050_port.h" +#endif +#ifdef HAVE_ARIA + #include "mcapi.h" + #include "mcapi_error.h" +#endif +#if defined(WOLFSSL_MAX3266X) || defined(WOLFSSL_MAX3266X_OLD) + #include "wolfssl/wolfcrypt/port/maxim/max3266x.h" +#endif +/* wc_Sha512 digest */ +struct wc_Sha512 { +#ifdef WOLFSSL_PSOC6_CRYPTO + cy_stc_crypto_sha_state_t hash_state; + cy_en_crypto_sha_mode_t sha_mode; + cy_stc_crypto_v2_sha512_buffers_t sha_buffers; + void* heap; +#else + word64 digest[WC_SHA512_DIGEST_SIZE / sizeof(word64)]; + word64 buffer[WC_SHA512_BLOCK_SIZE / sizeof(word64)]; + word32 buffLen; /* in bytes */ + word64 loLen; /* length in bytes */ + word64 hiLen; /* length in bytes */ + void* heap; +#ifdef USE_INTEL_SPEEDUP + const byte* data; +#endif +#ifdef WC_C_DYNAMIC_FALLBACK + int sha_method; +#endif +#ifdef WOLFSSL_ASYNC_CRYPT + WC_ASYNC_DEV asyncDev; +#endif /* WOLFSSL_ASYNC_CRYPT */ +#ifdef WOLFSSL_SMALL_STACK_CACHE + word64* W; +#endif + +#if defined(WOLFSSL_ESP32_CRYPT) && \ + !defined(NO_WOLFSSL_ESP32_CRYPT_HASH) && \ + (!defined(NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512) || \ + !defined(NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384)) + WC_ESP32SHA ctx; +#endif +#if defined(WOLFSSL_SILABS_SE_ACCEL) + wc_silabs_sha_t silabsCtx; +#endif +#ifdef WOLFSSL_KCAPI_HASH + wolfssl_KCAPI_Hash kcapi; +#endif +#if defined(WOLFSSL_SE050) && defined(WOLFSSL_SE050_HASH) + SE050_HASH_Context se050Ctx; +#endif +#if defined(WOLFSSL_HASH_KEEP) + byte* msg; + word32 used; + word32 len; +#endif +#ifdef WOLF_CRYPTO_CB + int devId; + void* devCtx; /* generic crypto callback context */ +#endif +#if defined(MAX3266X_SHA_CB) || defined(MAX3266X_SHA) + wc_MXC_Sha mxcCtx; +#endif +#ifdef WOLFSSL_HASH_FLAGS + word32 flags; /* enum wc_HashFlags in hash.h */ +#endif +#ifdef WOLFSSL_IMXRT1170_CAAM + caam_hash_ctx_t ctx; + caam_handle_t hndl; +#endif +#ifdef HAVE_ARIA + MC_HSESSION hSession; +#endif +#if defined(STM32_HASH_SHA512) + STM32_HASH_Context stmCtx; +#endif +#endif /* WOLFSSL_PSOC6_CRYPTO */ +}; + + +#ifndef WC_SHA512_TYPE_DEFINED + typedef struct wc_Sha512 wc_Sha512; + typedef struct wc_Sha512 wc_Sha512_224; + typedef struct wc_Sha512 wc_Sha512_256; + +#define WC_SHA512_TYPE_DEFINED +#endif +#endif /* WOLFSSL_IMX6_CAAM && !WOLFSSL_QNX_CAAM */ + +#endif /* HAVE_FIPS */ + +#if defined(WOLFSSL_SHA512) || defined(WOLFSSL_SHA384) + +#ifdef WOLFSSL_ARMASM +#ifdef __aarch64__ + void Transform_Sha512_Len_neon(wc_Sha512* sha512, const byte* data, + word32 len); +#ifdef WOLFSSL_ARMASM_CRYPTO_SHA512 + void Transform_Sha512_Len_crypto(wc_Sha512* sha512, const byte* data, + word32 len); +#endif +#else +extern void Transform_Sha512_Len(wc_Sha512* sha512, const byte* data, + word32 len); +#endif +#endif + +WOLFSSL_API int wc_InitSha512(wc_Sha512* sha); +WOLFSSL_API int wc_InitSha512_ex(wc_Sha512* sha, void* heap, int devId); +WOLFSSL_API int wc_Sha512Update(wc_Sha512* sha, const byte* data, word32 len); +WOLFSSL_API int wc_Sha512FinalRaw(wc_Sha512* sha512, byte* hash); +WOLFSSL_API int wc_Sha512Final(wc_Sha512* sha512, byte* hash); +WOLFSSL_API void wc_Sha512Free(wc_Sha512* sha); + +WOLFSSL_API int wc_Sha512GetHash(wc_Sha512* sha512, byte* hash); +WOLFSSL_API int wc_Sha512Copy(wc_Sha512* src, wc_Sha512* dst); + +#if defined(WOLFSSL_HASH_KEEP) + WOLFSSL_API int wc_Sha512_Grow(wc_Sha512* sha512, const byte* in, int inSz); +#endif +#ifdef WOLFSSL_HASH_FLAGS + WOLFSSL_API int wc_Sha512SetFlags(wc_Sha512* sha512, word32 flags); + WOLFSSL_API int wc_Sha512GetFlags(wc_Sha512* sha512, word32* flags); +#endif + +#if defined(OPENSSL_EXTRA) || defined(HAVE_CURL) +WOLFSSL_API int wc_Sha512Transform(wc_Sha512* sha, const unsigned char* data); +#endif + +#if !defined(WOLFSSL_NOSHA512_224) && \ + (!defined(HAVE_FIPS) || FIPS_VERSION_GE(5, 3)) && !defined(HAVE_SELFTEST) +WOLFSSL_API int wc_InitSha512_224(wc_Sha512* sha); +WOLFSSL_API int wc_InitSha512_224_ex(wc_Sha512* sha, void* heap, int devId); +WOLFSSL_API int wc_Sha512_224Update(wc_Sha512* sha, const byte* data, word32 len); +WOLFSSL_API int wc_Sha512_224FinalRaw(wc_Sha512* sha512, byte* hash); +WOLFSSL_API int wc_Sha512_224Final(wc_Sha512* sha512, byte* hash); +WOLFSSL_API void wc_Sha512_224Free(wc_Sha512* sha); +WOLFSSL_API int wc_Sha512_224GetHash(wc_Sha512* sha512, byte* hash); +WOLFSSL_API int wc_Sha512_224Copy(wc_Sha512* src, wc_Sha512* dst); +#ifdef WOLFSSL_HASH_FLAGS + WOLFSSL_API int wc_Sha512_224SetFlags(wc_Sha512* sha512, word32 flags); + WOLFSSL_API int wc_Sha512_224GetFlags(wc_Sha512* sha512, word32* flags); +#endif + +#if defined(OPENSSL_EXTRA) || defined(HAVE_CURL) +WOLFSSL_API int wc_Sha512_224Transform(wc_Sha512* sha, + const unsigned char* data); +#endif /* OPENSSL_EXTRA */ +#endif /* !WOLFSSL_NOSHA512_224 && !FIPS ... */ + +#if !defined(WOLFSSL_NOSHA512_256) && \ + (!defined(HAVE_FIPS) || FIPS_VERSION_GE(5, 3)) && !defined(HAVE_SELFTEST) +WOLFSSL_API int wc_InitSha512_256(wc_Sha512* sha); +WOLFSSL_API int wc_InitSha512_256_ex(wc_Sha512* sha, void* heap, int devId); +WOLFSSL_API int wc_Sha512_256Update(wc_Sha512* sha, const byte* data, word32 len); +WOLFSSL_API int wc_Sha512_256FinalRaw(wc_Sha512* sha512, byte* hash); +WOLFSSL_API int wc_Sha512_256Final(wc_Sha512* sha512, byte* hash); +WOLFSSL_API void wc_Sha512_256Free(wc_Sha512* sha); +WOLFSSL_API int wc_Sha512_256GetHash(wc_Sha512* sha512, byte* hash); +WOLFSSL_API int wc_Sha512_256Copy(wc_Sha512* src, wc_Sha512* dst); +#ifdef WOLFSSL_HASH_FLAGS + WOLFSSL_API int wc_Sha512_256SetFlags(wc_Sha512* sha512, word32 flags); + WOLFSSL_API int wc_Sha512_256GetFlags(wc_Sha512* sha512, word32* flags); +#endif + +#if defined(OPENSSL_EXTRA) || defined(HAVE_CURL) +WOLFSSL_API int wc_Sha512_256Transform(wc_Sha512* sha, + const unsigned char* data); +#endif /* OPENSSL_EXTRA */ +#endif /* !WOLFSSL_NOSHA512_256 && !FIPS ... */ + +#endif /* WOLFSSL_SHA512 */ + +#if defined(WOLFSSL_SHA384) + +/* avoid redefinition of structs */ +#if !defined(HAVE_FIPS) || \ + (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)) + +#if !defined(NO_OLD_SHA_NAMES) + #define SHA384 WC_SHA384 +#endif + +#if !defined(NO_OLD_WC_NAMES) + #define Sha384 wc_Sha384 + #define SHA384_BLOCK_SIZE WC_SHA384_BLOCK_SIZE + #define SHA384_DIGEST_SIZE WC_SHA384_DIGEST_SIZE + #define SHA384_PAD_SIZE WC_SHA384_PAD_SIZE +#endif + +/* in bytes */ +enum { + WC_SHA384 = WC_HASH_TYPE_SHA384, + WC_SHA384_BLOCK_SIZE = WC_SHA512_BLOCK_SIZE, + WC_SHA384_DIGEST_SIZE = 48, + WC_SHA384_PAD_SIZE = WC_SHA512_PAD_SIZE +}; + + +#ifndef WC_SHA384_TYPE_DEFINED + typedef struct wc_Sha512 wc_Sha384; + #define WC_SHA384_TYPE_DEFINED +#endif +#endif /* HAVE_FIPS */ + +WOLFSSL_API int wc_InitSha384(wc_Sha384* sha); +WOLFSSL_API int wc_InitSha384_ex(wc_Sha384* sha, void* heap, int devId); +WOLFSSL_API int wc_Sha384Update(wc_Sha384* sha, const byte* data, word32 len); +WOLFSSL_API int wc_Sha384FinalRaw(wc_Sha384* sha384, byte* hash); +WOLFSSL_API int wc_Sha384Final(wc_Sha384* sha384, byte* hash); +WOLFSSL_API void wc_Sha384Free(wc_Sha384* sha); + +WOLFSSL_API int wc_Sha384GetHash(wc_Sha384* sha384, byte* hash); +WOLFSSL_API int wc_Sha384Copy(wc_Sha384* src, wc_Sha384* dst); + +#if defined(WOLFSSL_HASH_KEEP) + WOLFSSL_API int wc_Sha384_Grow(wc_Sha384* sha384, const byte* in, int inSz); +#endif +#ifdef WOLFSSL_HASH_FLAGS + WOLFSSL_API int wc_Sha384SetFlags(wc_Sha384* sha384, word32 flags); + WOLFSSL_API int wc_Sha384GetFlags(wc_Sha384* sha384, word32* flags); +#endif + +#endif /* WOLFSSL_SHA384 */ + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_SHA512 || WOLFSSL_SHA384 */ +#endif /* WOLF_CRYPT_SHA512_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/signature.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/signature.h @@ -0,0 +1,87 @@ +/* signature.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/signature.h +*/ + + +#ifndef WOLF_CRYPT_SIGNATURE_H +#define WOLF_CRYPT_SIGNATURE_H + +#include <wolfssl/wolfcrypt/types.h> +#include <wolfssl/wolfcrypt/hash.h> +#include <wolfssl/wolfcrypt/random.h> + +#ifdef __cplusplus + extern "C" { +#endif + +enum wc_SignatureType { + WC_SIGNATURE_TYPE_NONE = 0, + WC_SIGNATURE_TYPE_ECC = 1, + WC_SIGNATURE_TYPE_RSA = 2, + WC_SIGNATURE_TYPE_RSA_W_ENC = 3 /* Adds DER header via wc_EncodeSignature */ +}; + +WOLFSSL_API int wc_SignatureGetSize(enum wc_SignatureType sig_type, + const void* key, word32 key_len); + +WOLFSSL_API int wc_SignatureVerifyHash( + enum wc_HashType hash_type, enum wc_SignatureType sig_type, + const byte* hash_data, word32 hash_len, + const byte* sig, word32 sig_len, + const void* key, word32 key_len); + +WOLFSSL_API int wc_SignatureVerify( + enum wc_HashType hash_type, enum wc_SignatureType sig_type, + const byte* data, word32 data_len, + const byte* sig, word32 sig_len, + const void* key, word32 key_len); + +WOLFSSL_API int wc_SignatureGenerateHash( + enum wc_HashType hash_type, enum wc_SignatureType sig_type, + const byte* hash_data, word32 hash_len, + byte* sig, word32 *sig_len, + const void* key, word32 key_len, WC_RNG* rng); +WOLFSSL_API int wc_SignatureGenerateHash_ex( + enum wc_HashType hash_type, enum wc_SignatureType sig_type, + const byte* hash_data, word32 hash_len, + byte* sig, word32 *sig_len, + const void* key, word32 key_len, WC_RNG* rng, int verify); +WOLFSSL_API int wc_SignatureGenerate( + enum wc_HashType hash_type, enum wc_SignatureType sig_type, + const byte* data, word32 data_len, + byte* sig, word32 *sig_len, + const void* key, word32 key_len, + WC_RNG* rng); +WOLFSSL_API int wc_SignatureGenerate_ex( + enum wc_HashType hash_type, enum wc_SignatureType sig_type, + const byte* data, word32 data_len, + byte* sig, word32 *sig_len, + const void* key, word32 key_len, + WC_RNG* rng, int verify); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLF_CRYPT_SIGNATURE_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/siphash.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/siphash.h @@ -0,0 +1,101 @@ +/* siphash.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + +#ifndef WOLF_CRYPT_SIPHASH_H +#define WOLF_CRYPT_SIPHASH_H + +#include <wolfssl/wolfcrypt/types.h> + +#if defined(WOLFSSL_SIPHASH) + +/* DESCRIPTION + * + * SipHash is a PseudoRandom Function (PRF) that can be used with small + * messages (less than 256 bytes). + * SipHash can be used for Message Authentication Codes (MACs) and as such must + * be passed a secret key. + * https://eprint.iacr.org/2012/351.pdf + * + * SipHash is commonly used in hash tables. + * Do not use this as a hash not as a general purpose MAC. + * + * WOLFSSL_SIPHASH_CROUNDS and WOLFSSL_SIPHASH_DROUNDS can be defined at build + * time to change the algorithm. + * Default is SipHash-2-4: + * WOLFSSL_SIPHASH_CROUNDS = 2 + * WOLFSSL_SIPHASH_DROUNDS = 4 + */ + +#ifndef WOLFSSL_SIPHASH_CROUNDS +/* Number of rounds to perform in compression operation. */ +#define WOLFSSL_SIPHASH_CROUNDS 2 +#endif /* WOLFSSL_SIPHASH_CROUNDS */ + +#ifndef WOLFSSL_SIPHASH_DROUNDS +/* Number of rounds to perform in final operation. */ +#define WOLFSSL_SIPHASH_DROUNDS 4 +#endif /* WOLFSSL_SIPHASH_DROUNDS */ + +enum { + SIPHASH_KEY_SIZE = 16, /* Key size of SipHash. */ + SIPHASH_BLOCK_SIZE = 8, /* Block size of SipHash. */ + SIPHASH_MAC_SIZE_8 = 8, /* Output an 8 byte MAC. */ + SIPHASH_MAC_SIZE_16 = 16 /* Output a 16 byte MAC. */ +}; + +typedef struct SipHash SipHash; + +struct SipHash { + /* Internal state. */ + word64 v[4]; + /* Cached message data. */ + byte cache[SIPHASH_BLOCK_SIZE]; + /* Number of bytes cached. */ + byte cacheCnt; + /* Number of output bytes. */ + byte outSz; + /* Number of input bytes processed. */ + word32 inCnt; +}; + + +#ifdef __cplusplus + extern "C" { +#endif + +WOLFSSL_API int wc_InitSipHash(SipHash* sipHash, const unsigned char* key, + unsigned char outSz); +WOLFSSL_API int wc_SipHashUpdate(SipHash* sipHash, const unsigned char* in, + word32 inSz); +WOLFSSL_API int wc_SipHashFinal(SipHash* sipHash, unsigned char* out, + unsigned char outSz); +WOLFSSL_API int wc_SipHash(const unsigned char* key, const unsigned char* in, + word32 inSz, unsigned char* out, unsigned char outSz); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + + +#endif /* NO_AES && WOLFSSL_SIPHASH */ +#endif /* WOLF_CRYPT_SIPHASH_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/sm2.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/sm2.h @@ -0,0 +1,27 @@ +/* sm2.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifdef WOLFSSL_SM2 + +#error "See https://github.com/wolfSSL/wolfsm for implementation of this file" + +#endif + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/sm3.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/sm3.h @@ -0,0 +1,27 @@ +/* sm3.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifdef WOLFSSL_SM3 + +#error "See https://github.com/wolfSSL/wolfsm for implementation of this file" + +#endif + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/sm4.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/sm4.h @@ -0,0 +1,27 @@ +/* sm4.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifdef WOLFSSL_SM4 + +#error "See https://github.com/wolfSSL/wolfsm for implementation of this file" + +#endif + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/sp_int.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/sp_int.h @@ -0,0 +1,1248 @@ +/* sp_int.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* +DESCRIPTION +This library provides single precision (SP) integer math functions. + +*/ +#ifndef WOLF_CRYPT_SP_INT_H +#define WOLF_CRYPT_SP_INT_H + +#ifndef WOLFSSL_LINUXKM +#include <limits.h> +#endif +#include <wolfssl/wolfcrypt/settings.h> +#include <wolfssl/wolfcrypt/types.h> +#include <wolfssl/wolfcrypt/hash.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(WOLFSSL_SP_ARM_ARCH) && !defined(WOLFSSL_ARM_ARCH) + #define WOLFSSL_ARM_ARCH WOLFSSL_SP_ARM_ARCH +#endif + +#if defined(OPENSSL_EXTRA) && !defined(NO_ASN) && \ + !defined(WOLFSSL_SP_INT_NEGATIVE) + #define WOLFSSL_SP_INT_NEGATIVE +#endif + +/* Find smallest type for smallest bits. */ +#if UCHAR_MAX == 255 + #define SP_UCHAR_BITS 8 + + typedef unsigned char sp_uint8; + typedef char sp_int8; +#elif UCHAR_MAX == 127 + #define SP_UCHAR_BITS 7 + + typedef unsigned char sp_uint7; + typedef char sp_int7; +#else + #error "Size of unsigned short not detected" +#endif + +#if USHRT_MAX == 65535 + #define SP_USHORT_BITS 16 + + typedef unsigned short sp_uint16; + typedef short sp_int16; +#elif USHRT_MAX == 255 + #define SP_USHORT_BITS 8 + + #if USHRT_MAX > UCHAR_MAX + typedef unsigned short sp_uint8; + typedef short sp_int8; + #endif +#else + #error "Size of unsigned short not detected" +#endif + +#if UINT_MAX == 4294967295UL + #define SP_UINT_BITS 32 + + typedef unsigned int sp_uint32; + typedef int sp_int32; +#elif UINT_MAX == 65535 + #define SP_UINT_BITS 16 + + #if UINT_MAX > USHRT_MAX + typedef unsigned int sp_uint16; + typedef int sp_int16; + #endif +#elif UINT_MAX == 255 + #define SP_UINT_BITS 8 + + #if UINT_MAX > USHRT_MAX + typedef unsigned int sp_uint8; + typedef int sp_int8; + #endif +#else + #error "Size of unsigned int not detected" +#endif + +#if defined(__WATCOMC__) && defined(__WATCOM_INT64__) + /* For older Watcom C compiler force types */ + #define SP_ULLONG_BITS 64 + typedef unsigned __int64 sp_uint64; + typedef __int64 sp_int64; + +#else + +/* 32-bit type */ +#if defined(WOLF_C89) && !defined(NO_64BIT) && \ + ULONG_MAX == 18446744073709551615UL + #define SP_ULONG_BITS 64 + + typedef unsigned long sp_uint64; + typedef long sp_int64; +#elif !defined(WOLF_C89) && !defined(NO_64BIT) && \ + ULONG_MAX == 18446744073709551615ULL && \ + /* sanity check pre-processor supports 64-bit ULL types */ \ + 4294967295UL != 18446744073709551615ULL + #define SP_ULONG_BITS 64 + + typedef unsigned long sp_uint64; + typedef long sp_int64; +#elif ULONG_MAX == 4294967295UL + #define SP_ULONG_BITS 32 + + #if ULONG_MAX > UINT_MAX + typedef unsigned long sp_uint32; + typedef long sp_int32; + #endif +#elif ULONG_MAX == 65535 + #define SP_ULONG_BITS 16 + + #if ULONG_MAX > UINT_MAX + typedef unsigned long sp_uint16; + typedef long sp_int16; + #endif +#else + #error "Size of unsigned long not detected" +#endif + +/* 64-bit type */ +#ifdef ULLONG_MAX + #if defined(WOLF_C89) && ULLONG_MAX == 18446744073709551615UL + #define SP_ULLONG_BITS 64 + + #if SP_ULLONG_BITS > SP_ULONG_BITS + typedef unsigned long long sp_uint64; + typedef long long sp_int64; + #endif + #elif !defined(WOLF_C89) && ULLONG_MAX == 18446744073709551615ULL + #define SP_ULLONG_BITS 64 + + #if SP_ULLONG_BITS > SP_ULONG_BITS + typedef unsigned long long sp_uint64; + typedef long long sp_int64; + #endif + #elif ULLONG_MAX == 4294967295UL + #define SP_ULLONG_BITS 32 + + #if SP_ULLONG_BITS > SP_ULONG_BITS + typedef unsigned long long sp_uint32; + typedef long long sp_int32; + #endif + #elif ULLONG_MAX == 65535 + #define SP_ULLONG_BITS 16 + + #if SP_ULLONG_BITS > SP_ULONG_BITS + typedef unsigned long long sp_uint16; + typedef long long sp_int16; + #endif + #else + #error "Size of unsigned long long not detected" + #endif +#elif (SP_ULONG_BITS == 32) && !defined(NO_64BIT) + #define SP_ULLONG_BITS 64 + /* Speculatively use long long as the 64-bit type as we don't have one + * otherwise. */ + typedef unsigned long long sp_uint64; + typedef long long sp_int64; +#else + #define SP_ULLONG_BITS 0 +#endif + +#endif /* __WATCOMC__ */ + +#ifdef WOLFSSL_SP_DIV_32 +#define WOLFSSL_SP_DIV_WORD_HALF +#endif + +/* Make sure WOLFSSL_SP_ASM build option defined when requested */ +#if !defined(WOLFSSL_SP_ASM) && ( \ + defined(WOLFSSL_SP_X86_64_ASM) || defined(WOLFSSL_SP_ARM32_ASM) || \ + defined(WOLFSSL_SP_ARM64_ASM) || defined(WOLFSSL_SP_ARM_THUMB_ASM) || \ + defined(WOLFSSL_SP_ARM_CORTEX_M_ASM)) + #define WOLFSSL_SP_ASM +#endif + + +/* Determine the number of bits to use in each word. */ +#ifdef SP_WORD_SIZE +#elif defined(WOLFSSL_DSP_BUILD) + #define SP_WORD_SIZE 32 +#elif defined(WOLFSSL_SP_X86_64) && !defined(WOLFSSL_SP_X86_64_ASM) && \ + !defined(HAVE___UINT128_T) + #define SP_WORD_SIZE 32 +#elif defined(WOLFSSL_SP_X86_64_ASM) || defined(WOLFSSL_SP_X86_64) + #if SP_ULONG_BITS == 64 || SP_ULLONG_BITS == 64 + #define SP_WORD_SIZE 64 + #ifndef HAVE_INTEL_AVX1 + #define HAVE_INTEL_AVX1 + #endif + #if !defined(NO_AVX2_SUPPORT) && !defined(HAVE_INTEL_AVX2) + #define HAVE_INTEL_AVX2 + #endif + #elif SP_ULONG_BITS == 32 + #define SP_WORD_SIZE 32 + #undef WOLFSSL_SP_ASM + #elif SP_ULONG_BITS == 16 + #define SP_WORD_SIZE 16 + #undef WOLFSSL_SP_ASM + #endif +#elif defined(WOLFSSL_SP_X86) + #define SP_WORD_SIZE 32 +#elif defined(WOLFSSL_SP_ARM64_ASM) || defined(WOLFSSL_SP_ARM64) + #define SP_WORD_SIZE 64 +#elif defined(WOLFSSL_SP_ARM32_ASM) || defined(WOLFSSL_SP_ARM32) + #define SP_WORD_SIZE 32 +#elif defined(WOLFSSL_SP_ARM_THUMB_ASM) || defined(WOLFSSL_SP_ARM_THUMB) + #define SP_WORD_SIZE 32 +#elif defined(WOLFSSL_SP_PPC) + #define SP_WORD_SIZE 32 +#elif defined(WOLFSSL_SP_PPC64) + #define SP_WORD_SIZE 64 +#elif defined(WOLFSSL_SP_MIPS) + #define SP_WORD_SIZE 32 +#elif defined(WOLFSSL_SP_MIPS64) + #define SP_WORD_SIZE 64 +#elif defined(WOLFSSL_SP_RISCV32) + #define SP_WORD_SIZE 32 +#elif defined(WOLFSSL_SP_RISCV64) + #define SP_WORD_SIZE 64 +#elif defined(WOLFSSL_SP_S390X) + #define SP_WORD_SIZE 64 +#endif + +/* If no predefined or assembly required size then use maximum available + * with compiler. + */ +#ifndef SP_WORD_SIZE + #ifdef NO_64BIT + #define SP_WORD_SIZE 16 + #elif !defined(HAVE___UINT128_T) || defined(_WIN32) + #define SP_WORD_SIZE 32 + #else + #define SP_WORD_SIZE 64 + #endif +#endif + +/* Define the types used. */ +#if defined(HAVE___UINT128_T) && !defined(NO_INT128) + #ifdef __SIZEOF_INT128__ + typedef __uint128_t sp_uint128; + typedef __int128_t sp_int128; + #else + typedef unsigned long sp_uint128 __attribute__ ((mode(TI))); + typedef long sp_int128 __attribute__ ((mode(TI))); + #endif + #ifndef WOLFSSL_UINT128_T_DEFINED + #ifdef __SIZEOF_INT128__ + typedef __uint128_t uint128_t; + typedef __int128_t int128_t; + #else + typedef unsigned long uint128_t __attribute__ ((mode(TI))); + typedef long int128_t __attribute__ ((mode(TI))); + #endif + #define WOLFSSL_UINT128_T_DEFINED + #endif +#endif + +#if SP_WORD_SIZE == 8 + #define SP_WORD_SIZEOF 1 + + typedef sp_uint8 sp_int_digit; + typedef sp_int8 sp_int_sdigit; + typedef sp_uint16 sp_int_word; + typedef sp_int16 sp_int_sword; + + #define SP_MASK 0xffU +#elif SP_WORD_SIZE == 16 + #define SP_WORD_SIZEOF 2 + + typedef sp_uint16 sp_int_digit; + typedef sp_int16 sp_int_sdigit; + typedef sp_uint32 sp_int_word; + typedef sp_int32 sp_int_sword; + + #define SP_MASK 0xffffU +#elif SP_WORD_SIZE == 32 + #define SP_WORD_SIZEOF 4 + + typedef sp_uint32 sp_int_digit; + typedef sp_int32 sp_int_sdigit; + typedef sp_uint64 sp_int_word; + typedef sp_int64 sp_int_sword; + + #define SP_MASK 0xffffffffU +#elif SP_WORD_SIZE == 64 + #define SP_WORD_SIZEOF 8 + + typedef sp_uint64 sp_int_digit; + typedef sp_int64 sp_int_sdigit; +#if (defined(WOLFSSL_SP_MATH) || defined(WOLFSSL_SP_MATH_ALL)) && \ + !defined(_WIN64) && defined(WOLFSSL_UINT128_T_DEFINED) + typedef sp_uint128 sp_int_word; + typedef sp_int128 sp_int_sword; +#endif + + #define SP_MASK 0xffffffffffffffffUL +#else + #error Word size not defined +#endif + +/* Define an SP digit. */ +#ifndef WOLFSSL_SP_ASM + /* SP C code uses n/m bits and therefore needs a signed type. */ + #if SP_WORD_SIZE == 8 + typedef sp_int8 sp_digit; + #elif SP_WORD_SIZE == 16 + typedef sp_int16 sp_digit; + #elif SP_WORD_SIZE == 32 + typedef sp_int32 sp_digit; + #elif SP_WORD_SIZE == 64 + typedef sp_int64 sp_digit; + #endif +#else + /* SP ASM code uses full size and needs an unsigned type. */ + #if SP_WORD_SIZE == 8 + typedef sp_uint8 sp_digit; + #elif SP_WORD_SIZE == 16 + typedef sp_uint16 sp_digit; + #elif SP_WORD_SIZE == 32 + typedef sp_uint32 sp_digit; + #elif SP_WORD_SIZE == 64 + typedef sp_uint64 sp_digit; + #endif +#endif + +/** Number of bits in a half a word. */ +#define SP_HALF_SIZE (SP_WORD_SIZE / 2) +/** Maximum value that can be held in a half a word. */ +#define SP_HALF_MAX (((sp_digit)1 << SP_HALF_SIZE) - 1) +/** Maximum value that can be held in a word. */ +#define SP_DIGIT_MAX SP_MASK +/* Number of bits to shift to divide by word size. */ +#if SP_WORD_SIZE == 8 + #define SP_WORD_SHIFT 3 +#elif SP_WORD_SIZE == 16 + #define SP_WORD_SHIFT 4 +#elif SP_WORD_SIZE == 32 + #define SP_WORD_SHIFT 5 +#elif SP_WORD_SIZE == 64 + #define SP_WORD_SHIFT 6 +#endif +/* Mask of word size. */ +#define SP_WORD_MASK (SP_WORD_SIZE - 1) + +/* For debugging only - format string for different digit sizes. */ +#if SP_WORD_SIZE == 64 + #if SP_ULONG_BITS == 64 + #define SP_PRINT_FMT "%016lx" + #else + #define SP_PRINT_FMT "%016llx" + #endif +#elif SP_WORD_SIZE == 32 + #if SP_UINT_BITS == 32 + #define SP_PRINT_FMT "%08x" + #else + #define SP_PRINT_FMT "%08lx" + #endif +#elif SP_WORD_SIZE == 16 + #define SP_PRINT_FMT "%04x" +#elif SP_WORD_SIZE == 8 + #define SP_PRINT_FMT "%02x" +#endif + + +#if defined(WOLFSSL_HAVE_SP_ECC) && defined(WOLFSSL_SP_NONBLOCK) +/* Non-blocking ECC operation context. */ +typedef struct sp_ecc_ctx { + #ifdef WOLFSSL_SP_521 + XALIGNED(4) byte data[66*80]; /* stack data */ + #elif defined(WOLFSSL_SP_384) + XALIGNED(4) byte data[48*80]; /* stack data */ + #else + XALIGNED(4) byte data[32*80]; /* stack data */ + #endif +} sp_ecc_ctx_t; +#endif + +#if defined(WOLFSSL_SP_MATH) || defined(WOLFSSL_SP_MATH_ALL) +#include <wolfssl/wolfcrypt/random.h> + +#ifndef SP_INT_BITS + #ifdef SP_INT_DIGITS + #define SP_INT_BITS (((SP_INT_DIGITS - 1) * SP_WORD_SIZE) / 2) + #else + /* Calculate number of bits to have in an sp_int based on features + * compiled in. + */ + #ifdef WOLFSSL_MYSQL_COMPATIBLE + /* MySQL wants to be able to use 8192-bit numbers. */ + #define SP_INT_BITS 8192 + #elif !defined(WOLFSSL_HAVE_SP_RSA) && !defined(WOLFSSL_HAVE_SP_DH) && \ + !defined(WOLFSSL_HAVE_SP_ECC) + /* Not using SP - must be SP math all. */ + #if !defined(NO_RSA) || !defined(NO_DH) || !defined(NO_DSA) + /* Support max size FFHDE parameters compiled in. */ + #if !defined(NO_DH) && defined(HAVE_FFDHE_8192) + #define SP_INT_BITS 8192 + #elif !defined(NO_DH) && defined(HAVE_FFDHE_6144) + #define SP_INT_BITS 6144 + #elif !defined(NO_DH) && defined(HAVE_FFDHE_4096) + #define SP_INT_BITS 4096 + #else + /* Default to max 3072 for general RSA and DH. */ + #define SP_INT_BITS 3072 + #endif + #elif defined(WOLFCRYPT_HAVE_SAKKE) + #define SP_INT_BITS 1024 + #elif defined(HAVE_ECC) + /* P521 is the largest supported ECC algorithm curve. */ + #define SP_INT_BITS 521 + #elif !defined(NO_PWDBASED) && defined(HAVE_PKCS12) + /* wc_PKCS12_PBKDF_ex() */ + #define SP_INT_BITS (64 * 8) + #else + #define SP_INT_BITS 128 + #endif + #elif !defined(WOLFSSL_HAVE_SP_RSA) && !defined(WOLFSSL_HAVE_SP_DH) + /* Not use SP_RSA or DH but are using SP ECC. */ + #if defined(WOLFCRYPT_HAVE_SAKKE) + #define SP_INT_BITS 1024 + #elif defined(WOLFSSL_SP_521) || defined(WOLFSSL_SP_MATH_ALL) + /* P521 is the largest supported ECC algorithm curve. */ + #define SP_INT_BITS 521 + #elif defined(WOLFSSL_SP_384) + /* No generic support - largest curve P384. */ + #define SP_INT_BITS 384 + #else + /* No generic support - largest curve P256. */ + #define SP_INT_BITS 256 + #endif + /* SP RSA and DH supported so base on max size of RSA/DH in SP. */ + #elif defined(WOLFSSL_SP_4096) + #define SP_INT_BITS 4096 + #elif !defined(WOLFSSL_SP_NO_3072) || defined(WOLFSSL_SP_MATH_ALL) + #define SP_INT_BITS 3072 + #else + #define SP_INT_BITS 2048 + #endif + #endif +#endif + +#ifndef SP_INT_DIGITS + /* Calculate number of digits to have in an sp_int based on maximum size of + * numbers in bits that will be used. + * Double the size to hold multiplication result. + * Add one to accommodate extra digit used by sp_mul(), sp_mulmod(), + * sp_sqr(), sp_sqrmod() and sp_mont_red(). + */ + #define SP_INT_DIGITS \ + (((SP_INT_BITS + SP_WORD_SIZE - 1) / SP_WORD_SIZE) * 2 + 1) +#endif + +#ifndef SP_INT_MAX_BITS + /* Convert number digits to number of bits. */ + #define SP_INT_MAX_BITS (SP_INT_DIGITS * SP_WORD_SIZE) +#endif + +#if SP_WORD_SIZE < 32 + /* Maximum number of digits in a number to mul or sqr. */ + #define SP_MUL_SQR_DIGITS (SP_INT_MAX_BITS / 2 / SP_WORD_SIZE) + /* Maximum value of partial in mul/sqr. */ + #define SP_MUL_SQR_MAX_PARTIAL \ + (SP_MUL_SQR_DIGITS * ((1 << SP_WORD_SIZE) - 1)) + /* Maximum value in an sp_int_word. */ + #define SP_INT_WORD_MAX ((1 << (SP_WORD_SIZE * 2)) - 1) + + #if SP_MUL_SQR_MAX_PARTIAL > SP_INT_WORD_MAX + /* The sum of the partials in the multiplication/square can exceed the + * size of a word. This will overflow the word and loose data. + * Use an implementation that handles carry after every add and uses an + * extra temporary word for overflowing high word. + */ + #define SP_WORD_OVERFLOW + #endif +#endif + + +#ifndef NO_FILESYSTEM +/* Output is formatted to be used with script that checks calculations. */ + +/* Print out a number in big endian. */ +#ifndef WOLFSSL_SP_INT_NEGATIVE +/* Print out a positive multi-precision number. + * + * @param [in] a SP integer to print. + * @param [in] s String that describes the use of the number. + */ +#define sp_print(a, s) \ + do { \ + int ii; \ + fprintf(stderr, "%s=0x0", s); \ + for (ii = (a)->used-1; ii >= 0; ii--) { \ + fprintf(stderr, SP_PRINT_FMT, (a)->dp[ii]); \ + } \ + fprintf(stderr, "\n"); \ + } \ + while (0) +#else +/* Print out a multi-precision number. + * + * @param [in] a SP integer to print. + * @param [in] s String that describes the use of the number. + */ +#define sp_print(a, s) \ + do { \ + int ii; \ + fprintf(stderr, "%s=0x", s); \ + if ((a)->sign == MP_NEG) { \ + fprintf(stderr, "-"); \ + } \ + fprintf(stderr, "0"); \ + for (ii = (a)->used-1; ii >= 0; ii--) { \ + fprintf(stderr, SP_PRINT_FMT, (a)->dp[ii]); \ + } \ + fprintf(stderr, "\n"); \ + } \ + while (0) +#endif + +/* Print out a single multi-precision digit. + * + * @param [in] a SP integer digit to print. + * @param [in] s String that describes the use of the number. + */ +#define sp_print_digit(a, s) \ + do { \ + fprintf(stderr, "%s=0x0", s); \ + fprintf(stderr, SP_PRINT_FMT, a); \ + fprintf(stderr, "\n"); \ + } \ + while (0) + +/* Print out an integer. + * + * @param [in] a Number to print. + * @param [in] s String that describes the use of the number. + */ +#define sp_print_int(a, s) \ + do { \ + fprintf(stderr, "%s=0x0%x\n", s, a); \ + } \ + while (0) + +#else + + /* No filesystem, no output + * TODO: Use logging API? + */ + #define sp_print(a, s) WC_DO_NOTHING + #define sp_print_digit(a, s) WC_DO_NOTHING + #define sp_print_int(a, s) WC_DO_NOTHING + +#endif /* !NO_FILESYSTEM */ + +/* Returns whether multi-precision number is odd + * + * Assumes a is not NULL. + * + * @param [in] a SP integer to check. + * @return 1 when odd. + * @return 0 when even. + */ +#define sp_isodd(a) (((a)->used != 0) && ((a)->dp[0] & 1)) +/* Returns whether multi-precision number is even + * + * Assumes a is not NULL. + * + * @param [in] a SP integer to check. + * @return 1 when even. + * @return 0 when odd. + */ +#define sp_iseven(a) (((a)->used != 0) && (((a)->dp[0] & 1) == 0)) +/* Returns whether multi-precision number has the value zero. + * + * Assumes a is not NULL. + * + * @param [in] a SP integer to check. + * @return 1 when zero. + * @return 0 when not zero. + */ +#define sp_iszero(a) ((a)->used == 0) + +#ifndef WOLFSSL_SP_INT_NEGATIVE +/* Returns whether multi-precision number has the value one. + * + * Assumes a is not NULL. + * + * @param [in] a SP integer to check. + * @return 1 when one. + * @return 0 when not one. + */ +#define sp_isone(a) (((a)->used == 1) && ((a)->dp[0] == 1)) +#else +/* Returns whether multi-precision number has the value of positive one. + * + * Assumes a is not NULL. + * + * @param [in] a SP integer to check. + * @return 1 when one. + * @return 0 when not one. + */ +#define sp_isone(a) \ + (((a)->used == 1) && ((a)->dp[0] == 1) && ((a)->sign == MP_ZPOS)) +#endif + +#ifndef WOLFSSL_SP_INT_NEGATIVE +/* Returns whether multi-precision number has the value 'd'. + * + * Assumes a is not NULL. + * + * @param [in] a SP integer to check. + * @param [in] d SP integer digit. + * @return 1 when one. + * @return 0 when not one. + */ +#define sp_isword(a, d) \ + ((((d) == 0) && sp_iszero(a)) || (((a)->used == 1) && ((a)->dp[0] == (d)))) +#else +/* Returns whether multi-precision number has the value 'd'. + * + * Assumes a is not NULL. + * + * @param [in] a SP integer to check. + * @param [in] d SP integer digit. + * @return 1 when one. + * @return 0 when not one. + */ +#define sp_isword(a, d) \ + ((((d) == 0) && sp_iszero(a)) || \ + (((a)->used == 1) && ((a)->dp[0] == (d)) && ((a)->sign == MP_ZPOS))) +#endif + +#ifndef WOLFSSL_SP_INT_NEGATIVE +/* Calculate the absolute value of the multi-precision number. + * + * Negative support not compiled in so just copies. + * + * @param [in] a SP integer to calculate absolute value of. + * @param [out] r SP integer to hold result. + * + * @return MP_OKAY on success. + * @return MP_VAL when a or r is NULL. + */ +#define sp_abs(a, b) sp_copy(a, b) +/* Returns whether multi-precision number is negative. + * + * Negative support not compiled in so always returns 0 (false). + * + * @param [in] a SP integer to check. + * @param [in] d SP integer digit. + * @return 0 indicating not negative always. + */ +#define sp_isneg(a) (0) +/* Sets the multi-precision number negative. + * + * Negative support not compiled in, so does nothing. */ +#define sp_setneg(a) WC_DO_NOTHING +#else +/* Returns whether multi-precision number is negative. + * + * Assumes a is not NULL. + * + * @param [in] a SP integer to check. + * @param [in] d SP integer digit. + * @return 1 when negative. + * @return 0 when not negative. + */ +#define sp_isneg(a) ((a)->sign == MP_NEG) +/* Sets the multi-precision number negative. */ +#define sp_setneg(a) ((a)->sign = MP_NEG) +#endif + +/* Number of bits used based on used field only. */ +#define sp_bitsused(a) ((a)->used * SP_WORD_SIZE) + +/* Updates the used count to exclude leading zeros. + * + * Assumes a is not NULL. + * + * @param [in] a SP integer to update. + */ +#define sp_clamp(a) \ + do { \ + int ii; \ + if ((a)->used > 0) { \ + for (ii = (int)(a)->used - 1; ii >= 0; ii--) { \ + if ((a)->dp[ii] != 0) { \ + break; \ + } \ + } \ + (a)->used = (wc_mp_size_t)(ii + 1); \ + } \ + } while (0) + +/* Check the compiled and linked math implementation are the same. + * Use the number of bits in a digit as indication of how code was compiled. + * + * @return 1 when the number of bits are the same. + * @return 0 when the number of bits are different. + */ +#define CheckFastMathSettings() (SP_WORD_SIZE == CheckRunTimeFastMath()) + + +/** + * A result of NO. + * e.g. Is prime? NO. + */ +#define MP_NO 0 +/** + * A result of YES. + * e.g. Is prime? YES. + */ +#define MP_YES 1 + +#ifdef WOLFSSL_SP_INT_NEGATIVE +/** Number is 0/positive. */ +#define MP_ZPOS 0 +/** Number is negative. */ +#define MP_NEG 1 +#endif + +/** Radix is base 10 or decimal. */ +#define MP_RADIX_DEC 10 +/** Radix is base 16 or hexadecimal. */ +#define MP_RADIX_HEX 16 + +/** Result of comparison is that the first number is greater than second. */ +#define MP_GT 1 +/** Result of comparison is they are equal. */ +#define MP_EQ 0 +/** Result of comparison is that the first number is less than second. */ +#define MP_LT (-1) + +/* ERROR VALUES */ + +/* MP_MEM, MP_VAL, MP_WOULDBLOCK, and MP_NOT_INF are defined in error-crypt.h */ + +/** Error value on success. */ +#define MP_OKAY 0 + +#define FP_WOULDBLOCK MP_WOULDBLOCK +/* Unused error. Defined for backward compatibility. */ +#define MP_RANGE MP_NOT_INF +#ifdef USE_FAST_MATH +/* For old FIPS, need FP_MEM defined for old implementation. */ +#define FP_MEM MP_MEM +#endif + +/* Number of bits in each word/digit. */ +#define DIGIT_BIT SP_WORD_SIZE +/* Mask of all used bits in word/digit. */ +#define MP_MASK SP_MASK + +#ifdef MP_LOW_MEM +/* Use algorithms that use less memory. */ +#define WOLFSSL_SP_LOW_MEM +#endif + + +/* The number of bytes to a sp_int with 'cnt' digits. + * Must have at least one digit. + */ +#define MP_INT_SIZEOF(cnt) \ + (sizeof(sp_int_minimal) + (((cnt) <= 1) ? 0 : ((size_t)((cnt) - 1))) * \ + sizeof(sp_int_digit)) +/* The address of the next sp_int after one with 'cnt' digits. */ +#define MP_INT_NEXT(t, cnt) \ + (sp_int*)(((byte*)(t)) + MP_INT_SIZEOF(cnt)) + +#define MP_INT_SIZEOF_DIGITS(cnt) (MP_INT_SIZEOF(cnt) / sizeof(sp_int_digit)) + +/* Calculate the number of words required to support a number of bits. */ +#define MP_BITS_CNT(bits) \ + ((unsigned int)(((((bits) + SP_WORD_SIZE - 1) / SP_WORD_SIZE) * 2 + 1))) + +#if !defined(WOLFSSL_SP_NO_DYN_STACK) && defined(__STDC_VERSION__) && \ + (__STDC_VERSION__ >= 199901L) && \ + (defined(WOLFSSL_SP_NO_MALLOC) || \ + !(defined(WOLFSSL_SMALL_STACK) || defined(SP_ALLOC))) + #define WOLFSSL_SP_DYN_STACK +#endif + +#ifdef WOLFSSL_SMALL_STACK +/* + * Dynamic memory allocation of mp_int. + */ +/* Declare a dynamically allocated mp_int. */ +#define DECL_MP_INT_SIZE_DYN(name, bits, max) \ + sp_int* name = NULL +/* Declare a dynamically allocated mp_int. */ +#define DECL_MP_INT_SIZE(name, bits) \ + sp_int* name = NULL +/* Allocate an mp_int of minimal size and zero out. */ +#define NEW_MP_INT_SIZE(name, bits, heap, type) \ +do { \ + (name) = (mp_int*)XMALLOC(MP_INT_SIZEOF(MP_BITS_CNT(bits)), heap, type); \ + if ((name) != NULL) { \ + XMEMSET(name, 0, MP_INT_SIZEOF(MP_BITS_CNT(bits))); \ + } \ +} \ +while (0) +/* Dispose of dynamically allocated mp_int. */ +#define FREE_MP_INT_SIZE(name, heap, type) \ + XFREE(name, heap, type) +/* Type to cast to when using size marcos. */ +#define MP_INT_SIZE sp_int +/* Must check mp_int pointer for NULL. */ +#define MP_INT_SIZE_CHECK_NULL +#else +/* + * Static allocation of mp_int. + */ +#ifdef WOLFSSL_SP_DYN_STACK +/* Declare a dynamically allocated mp_int. */ +#define DECL_MP_INT_SIZE_DYN(name, bits, max) \ + sp_int_digit name##d[MP_INT_SIZEOF_DIGITS(MP_BITS_CNT(bits))]; \ + sp_int* (name) = (sp_int*)name##d +#elif defined(__cplusplus) +/* C++ doesn't tolerate parentheses around "name" (-Wparentheses) */ +#define DECL_MP_INT_SIZE_DYN(name, bits, max) \ + sp_int_digit name##d[MP_INT_SIZEOF_DIGITS(MP_BITS_CNT(max))]; \ + sp_int* name = (sp_int*)name##d +#else +/* Declare a dynamically allocated mp_int. */ +#define DECL_MP_INT_SIZE_DYN(name, bits, max) \ + sp_int_digit name##d[MP_INT_SIZEOF_DIGITS(MP_BITS_CNT(max))]; \ + sp_int* (name) = (sp_int*)name##d +#endif +/* Declare a statically allocated mp_int. */ +#define DECL_MP_INT_SIZE(name, bits) \ + sp_int_digit name##d[MP_INT_SIZEOF_DIGITS(MP_BITS_CNT(bits))]; \ + sp_int* (name) = (sp_int*)name##d +/* Zero out mp_int of minimal size. */ +#define NEW_MP_INT_SIZE(name, bits, heap, type) \ + XMEMSET(name, 0, MP_INT_SIZEOF(MP_BITS_CNT(bits))) +/* Dispose of static mp_int. */ +#define FREE_MP_INT_SIZE(name, heap, type) WC_DO_NOTHING +/* Type to force compiler to not complain about size. */ +#define MP_INT_SIZE sp_int_minimal +#endif + +/* Initialize an mp_int to a specific size. */ +#define INIT_MP_INT_SIZE(name, bits) \ + mp_init_size(name, MP_BITS_CNT(bits)) + + +#ifdef HAVE_WOLF_BIGINT + /* Raw big integer as a big-endian byte array. + * + * Useful for when using hardware - canonical format. + */ + typedef struct WC_BIGINT { + /* Dynamically allocated buffer that is big-endian byte array. */ + byte* buf; + /* Length of buffer in bytes. */ + word32 len; + /* Hint for heap used to allocate buffer. */ + void* heap; + } WC_BIGINT; + + /* Ensure WC_BIGINT defined once. */ + #define WOLF_BIGINT_DEFINED +#endif + +#if SP_INT_DIGITS < (65536 / SP_WORD_SIZEOF) +/* Type for number of digits. */ +typedef word16 sp_size_t; +#else +/* Type for number of digits. */ +typedef unsigned int sp_size_t; +#endif + +/* Type for number of digits. */ +#define wc_mp_size_t sp_size_t +#ifdef WOLFSSL_SP_INT_NEGATIVE + typedef sp_uint8 sp_sign_t; + #define wc_mp_sign_t sp_sign_t +#endif + +/** + * SP integer. + * + * dp at end so user can allocate a smaller amount and set size. + */ +typedef struct sp_int { + /** Number of words that contain data. */ + sp_size_t used; + /** Maximum number of words in data. */ + sp_size_t size; +#ifdef WOLFSSL_SP_INT_NEGATIVE + /** Indicates whether number is 0/positive or negative. */ + sp_sign_t sign; +#endif +#ifdef HAVE_WOLF_BIGINT + /** Unsigned binary (big endian) representation of number. */ + struct WC_BIGINT raw; +#endif + /** Data of number. */ + XALIGNED(SP_WORD_SIZEOF) sp_int_digit dp[SP_INT_DIGITS]; +} sp_int; + +typedef struct sp_int_minimal { + /** Number of words that contain data. */ + sp_size_t used; + /** Maximum number of words in data. */ + sp_size_t size; +#ifdef WOLFSSL_SP_INT_NEGATIVE + /** Indicates whether number is 0/positive or negative. */ + sp_sign_t sign; +#endif +#ifdef HAVE_WOLF_BIGINT + /** Unsigned binary (big endian) representation of number. */ + struct WC_BIGINT raw; +#endif + /** First digit of number. */ + XALIGNED(SP_WORD_SIZEOF) sp_int_digit dp[1]; +} sp_int_minimal; + +/* MP_INT_SIZEOF_DIGITS() requires that sizeof(sp_int) is a multiple of + * sizeof(sp_int_digit). + */ +wc_static_assert(sizeof(struct sp_int) % sizeof(sp_int_digit) == 0); +wc_static_assert(sizeof(struct sp_int_minimal) % sizeof(sp_int_digit) == 0); + +/* Multi-precision integer type is SP integer type. */ +typedef sp_int mp_int; +/* Multi-precision integer digit type is SP integer digit type. + * Type is unsigned. + */ +typedef sp_int_digit mp_digit; + + +/* Include the maths operations that are not implementation specific. */ +#include <wolfssl/wolfcrypt/wolfmath.h> + +/* + * Function prototypes. + */ + +MP_API int sp_init(sp_int* a); +MP_API int sp_init_size(sp_int* a, unsigned int size); +MP_API int sp_init_multi(sp_int* n1, sp_int* n2, sp_int* n3, sp_int* n4, + sp_int* n5, sp_int* n6); +MP_API void sp_free(sp_int* a); +MP_API int sp_grow(sp_int* a, int l); + +MP_API void sp_zero(sp_int* a); +MP_API void sp_clear(sp_int* a); +MP_API void sp_forcezero(sp_int* a); +MP_API int sp_init_copy (sp_int* r, const sp_int* a); + +MP_API int sp_copy(const sp_int* a, sp_int* r); +MP_API int sp_exch(sp_int* a, sp_int* b); +MP_API int sp_cond_swap_ct(sp_int* a, sp_int* b, int cnt, int swap); +MP_API int sp_cond_swap_ct_ex(sp_int* a, sp_int* b, int cnt, int swap, + sp_int* t); + +#ifdef WOLFSSL_SP_INT_NEGATIVE +MP_API int sp_abs(const sp_int* a, sp_int* r); +#endif +#ifdef WOLFSSL_SP_MATH_ALL +MP_API int sp_cmp_mag(const sp_int* a, const sp_int* b); +#endif +MP_API int sp_cmp(const sp_int* a, const sp_int* b); +MP_API int sp_cmp_ct(const sp_int* a, const sp_int* b, unsigned int n); + +MP_API int sp_is_bit_set(const sp_int* a, unsigned int b); +MP_API int sp_count_bits(const sp_int* a); +#if defined(HAVE_ECC) && defined(HAVE_COMP_KEY) +MP_API int sp_cnt_lsb(const sp_int* a); +#endif +MP_API int sp_leading_bit(const sp_int* a); +MP_API int sp_set_bit(sp_int* a, int i); +MP_API int sp_2expt(sp_int* a, int e); + +MP_API int sp_set(sp_int* a, sp_int_digit d); +MP_API int sp_set_int(sp_int* a, unsigned long n); +MP_API int sp_cmp_d(const sp_int* a, sp_int_digit d); +MP_API int sp_add_d(const sp_int* a, sp_int_digit d, sp_int* r); +MP_API int sp_sub_d(const sp_int* a, sp_int_digit d, sp_int* r); +MP_API int sp_mul_d(const sp_int* a, sp_int_digit d, sp_int* r); +#if (defined(WOLFSSL_SP_MATH_ALL) && !defined(WOLFSSL_RSA_VERIFY_ONLY)) || \ + defined(WOLFSSL_KEY_GEN) || defined(HAVE_COMP_KEY) || \ + defined(WC_MP_TO_RADIX) +MP_API int sp_div_d(const sp_int* a, sp_int_digit d, sp_int* r, + sp_int_digit* rem); +#endif +#if defined(WOLFSSL_SP_MATH_ALL) || (defined(HAVE_ECC) && \ + defined(HAVE_COMP_KEY)) || defined(OPENSSL_EXTRA) +MP_API int sp_mod_d(const sp_int* a, sp_int_digit d, sp_int_digit* r); +#endif +#if defined(WOLFSSL_SP_MATH_ALL) && defined(HAVE_ECC) +MP_API int sp_div_2_mod_ct(const sp_int* a, const sp_int* m, sp_int* r); +MP_API int sp_div_2(const sp_int* a, sp_int* r); +#endif + +MP_API int sp_add(const sp_int* a, const sp_int* b, sp_int* r); +MP_API int sp_sub(const sp_int* a, const sp_int* b, sp_int* r); +#if (defined(WOLFSSL_SP_MATH_ALL) && !defined(WOLFSSL_RSA_VERIFY_ONLY)) || \ + (!defined(WOLFSSL_SP_MATH) && defined(WOLFSSL_CUSTOM_CURVES)) || \ + defined(WOLFCRYPT_HAVE_ECCSI) || defined(WOLFCRYPT_HAVE_SAKKE) +MP_API int sp_addmod(const sp_int* a, const sp_int* b, const sp_int* m, + sp_int* r); +#endif +#if defined(WOLFSSL_SP_MATH_ALL) && (!defined(WOLFSSL_RSA_VERIFY_ONLY) || \ + defined(HAVE_ECC)) +MP_API int sp_submod(const sp_int* a, const sp_int* b, const sp_int* m, + sp_int* r); +#endif +#if defined(WOLFSSL_SP_MATH_ALL) && defined(HAVE_ECC) +MP_API int sp_submod_ct(const sp_int* a, const sp_int* b, const sp_int* m, + sp_int* r); +MP_API int sp_addmod_ct(const sp_int* a, const sp_int* b, const sp_int* m, + sp_int* r); +#endif +#if defined(WOLFSSL_SP_MATH_ALL) && defined(HAVE_ECC) +MP_API void sp_xor_ct(const sp_int* a, const sp_int* b, int len, sp_int* r); +#endif + +MP_API int sp_lshd(sp_int* a, int s); +#ifdef WOLFSSL_SP_MATH_ALL +MP_API void sp_rshd(sp_int* a, int c); +#endif +MP_API int sp_rshb(const sp_int* a, int n, sp_int* r); + +#if defined(WOLFSSL_SP_MATH_ALL) || !defined(NO_DH) || defined(HAVE_ECC) || \ + (!defined(NO_RSA) && !defined(WOLFSSL_RSA_VERIFY_ONLY) && \ + !defined(WOLFSSL_RSA_PUBLIC_ONLY)) +MP_API int sp_div(const sp_int* a, const sp_int* d, sp_int* r, sp_int* rem); +#endif +MP_API int sp_mod(const sp_int* a, const sp_int* m, sp_int* r); + +MP_API int sp_mul(const sp_int* a, const sp_int* b, sp_int* r); +MP_API int sp_mulmod(const sp_int* a, const sp_int* b, const sp_int* m, + sp_int* r); + +MP_API int sp_invmod(const sp_int* a, const sp_int* m, sp_int* r); +#if defined(WOLFSSL_SP_MATH_ALL) && defined(HAVE_ECC) +MP_API int sp_invmod_mont_ct(const sp_int* a, const sp_int* m, sp_int* r, + sp_int_digit mp); +#endif + +MP_API int sp_exptmod_ex(const sp_int* b, const sp_int* e, int digits, + const sp_int* m, sp_int* r); +MP_API int sp_exptmod(const sp_int* b, const sp_int* e, const sp_int* m, + sp_int* r); +#if defined(WOLFSSL_SP_MATH_ALL) || defined(WOLFSSL_HAVE_SP_DH) +MP_API int sp_exptmod_nct(const sp_int* b, const sp_int* e, const sp_int* m, + sp_int* r); +#endif + +#if defined(WOLFSSL_SP_MATH_ALL) || defined(OPENSSL_ALL) +MP_API int sp_div_2d(const sp_int* a, int e, sp_int* r, sp_int* rem); +MP_API int sp_mul_2d(const sp_int* a, int e, sp_int* r); +#endif +#if defined(WOLFSSL_SP_MATH_ALL) || defined(HAVE_ECC) || defined(OPENSSL_ALL) +MP_API int sp_mod_2d(const sp_int* a, int e, sp_int* r); +#endif + +MP_API int sp_sqr(const sp_int* a, sp_int* r); +MP_API int sp_sqrmod(const sp_int* a, const sp_int* m, sp_int* r); + +MP_API int sp_mont_red_ex(sp_int* a, const sp_int* m, sp_int_digit mp, int ct); +#define sp_mont_red(a, m, mp) sp_mont_red_ex(a, m, mp, 0) +MP_API int sp_mont_setup(const sp_int* m, sp_int_digit* rho); +MP_API int sp_mont_norm(sp_int* norm, const sp_int* m); + +MP_API int sp_unsigned_bin_size(const sp_int* a); +MP_API int sp_read_unsigned_bin(sp_int* a, const byte* in, word32 inSz); +MP_API int sp_to_unsigned_bin(const sp_int* a, byte* out); +MP_API int sp_to_unsigned_bin_len(const sp_int* a, byte* out, int outSz); +MP_API int sp_to_unsigned_bin_len_ct(const sp_int* a, byte* out, int outSz); +#ifdef WOLFSSL_SP_MATH_ALL +MP_API int sp_to_unsigned_bin_at_pos(int o, const sp_int* a, + unsigned char* out); +#endif + +MP_API int sp_read_radix(sp_int* a, const char* in, int radix); +MP_API int sp_tohex(const sp_int* a, char* str); +MP_API int sp_todecimal(const sp_int* a, char* str); +#if defined(WOLFSSL_SP_MATH_ALL) || defined(WC_MP_TO_RADIX) +MP_API int sp_toradix(const sp_int* a, char* str, int radix); +MP_API int sp_radix_size(const sp_int* a, int radix, int* size); +#endif + +MP_API int sp_rand_prime(sp_int* r, int len, WC_RNG* rng, void* heap); +MP_API int sp_prime_is_prime(const sp_int* a, int t, int* result); +MP_API int sp_prime_is_prime_ex(const sp_int* a, int t, int* result, + WC_RNG* rng); +#if !defined(NO_RSA) || defined(WOLFSSL_KEY_GEN) +MP_API int sp_gcd(const sp_int* a, const sp_int* b, sp_int* r); +#endif +#if !defined(NO_RSA) && defined(WOLFSSL_KEY_GEN) && \ + (!defined(WC_RSA_BLINDING) || defined(HAVE_FIPS) || defined(HAVE_SELFTEST)) +MP_API int sp_lcm(const sp_int* a, const sp_int* b, sp_int* r); +#endif + +WOLFSSL_API word32 CheckRunTimeFastMath(void); + +#ifdef WOLFSSL_CHECK_MEM_ZERO +WOLFSSL_LOCAL void sp_memzero_add(const char* name, sp_int* sp); +WOLFSSL_LOCAL void sp_memzero_check(sp_int* sp); +#endif + + +/* Map mp functions to SP math versions. */ +/* Different name or signature. */ +#define mp_mul_2(a, r) sp_mul_2d(a, 1, r) +#define mp_div_3(a, r, rem) sp_div_d(a, 3, r, rem) +#define mp_rshb(A,x) sp_rshb(A,x,A) +#define mp_is_bit_set(a,b) sp_is_bit_set(a,(unsigned int)(b)) +#define mp_montgomery_reduce(a, m, mp) sp_mont_red_ex(a, m, mp, 0) +#define mp_montgomery_reduce_ct(a, m, mp) sp_mont_red_ex(a, m, mp, 1) +#define mp_montgomery_setup sp_mont_setup +#define mp_montgomery_calc_normalization sp_mont_norm + +/* Macros mappings. */ +#define mp_isodd sp_isodd +#define mp_iseven sp_iseven +#define mp_iszero sp_iszero +#define mp_isone sp_isone +#define mp_isword sp_isword +#define mp_abs sp_abs +#define mp_isneg sp_isneg +#define mp_setneg sp_setneg +#define mp_bitsused sp_bitsused +#define mp_clamp sp_clamp + +/* One to one mappings. */ +#define mp_init sp_init +#define mp_init_size sp_init_size +#define mp_init_multi sp_init_multi +#define mp_free sp_free +#define mp_grow sp_grow +#define mp_zero sp_zero +#define mp_clear sp_clear +#define mp_forcezero sp_forcezero +#define mp_copy sp_copy +#define mp_init_copy sp_init_copy +#define mp_exch sp_exch +#define mp_cond_swap_ct sp_cond_swap_ct +#define mp_cond_swap_ct_ex sp_cond_swap_ct_ex +#define mp_cmp_mag sp_cmp_mag +#define mp_cmp sp_cmp +#define mp_cmp_ct sp_cmp_ct +#define mp_count_bits sp_count_bits +#define mp_cnt_lsb sp_cnt_lsb +#define mp_leading_bit sp_leading_bit +#define mp_set_bit sp_set_bit +#define mp_2expt sp_2expt +#define mp_set sp_set +#define mp_set_int sp_set_int +#define mp_cmp_d sp_cmp_d +#define mp_add_d sp_add_d +#define mp_sub_d sp_sub_d +#define mp_mul_d sp_mul_d +#define mp_div_d sp_div_d +#define mp_mod_d sp_mod_d +#define mp_div_2_mod_ct sp_div_2_mod_ct +#define mp_div_2 sp_div_2 +#define mp_add sp_add +#define mp_sub sp_sub + +#define mp_addmod_ct sp_addmod_ct +#define mp_submod_ct sp_submod_ct +#define mp_xor_ct sp_xor_ct +#define mp_lshd sp_lshd +#define mp_rshd sp_rshd +#define mp_div sp_div +#define mp_mul sp_mul +#define mp_invmod sp_invmod +#define mp_invmod_mont_ct sp_invmod_mont_ct +#define mp_exptmod_ex sp_exptmod_ex +#define mp_exptmod_nct sp_exptmod_nct +#define mp_div_2d sp_div_2d +#define mp_mod_2d sp_mod_2d +#define mp_mul_2d sp_mul_2d +#define mp_sqr sp_sqr + +#define mp_unsigned_bin_size sp_unsigned_bin_size +#define mp_read_unsigned_bin sp_read_unsigned_bin +#define mp_to_unsigned_bin sp_to_unsigned_bin +#define mp_to_unsigned_bin_len sp_to_unsigned_bin_len +#define mp_to_unsigned_bin_len_ct sp_to_unsigned_bin_len_ct +#define mp_to_unsigned_bin_at_pos sp_to_unsigned_bin_at_pos +#define mp_read_radix sp_read_radix +#define mp_tohex sp_tohex +#define mp_todecimal sp_todecimal +#define mp_toradix sp_toradix +#define mp_radix_size sp_radix_size + +#define mp_rand_prime sp_rand_prime +#define mp_prime_is_prime sp_prime_is_prime +#define mp_prime_is_prime_ex sp_prime_is_prime_ex +#define mp_gcd sp_gcd +#define mp_lcm sp_lcm + +#define mp_memzero_add sp_memzero_add +#define mp_memzero_check sp_memzero_check + +/* Allow for Hardware Based Mod Math */ +/* Avoid redeclaration warnings */ +#ifndef WOLFSSL_USE_HW_MP + #define mp_mod sp_mod + #define mp_addmod sp_addmod + #define mp_submod sp_submod + #define mp_mulmod sp_mulmod + #define mp_exptmod sp_exptmod + #define mp_sqrmod sp_sqrmod +#endif + +#ifdef WOLFSSL_DEBUG_MATH +#define mp_dump(d, a, v) sp_print(a, d) +#endif + +#endif /* WOLFSSL_SP_MATH || WOLFSSL_SP_MATH_ALL */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* WOLF_CRYPT_SP_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/sphincs.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/sphincs.h @@ -0,0 +1,167 @@ +/* sphincs.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/sphincs.h +*/ + +/* Interfaces for Sphincs: + * - SPHINCS_FAST_LEVEL1 (AKA SPHINCS+-SHAKE-128f-simple) + * - SPHINCS_FAST_LEVEL3 (AKA SPHINCS+-SHAKE-192f-simple) + * - SPHINCS_FAST_LEVEL5 (AKA SPHINCS+-SHAKE-256f-simple) + * - SPHINCS_SMALL_LEVEL1 (AKA SPHINCS+-SHAKE-128s-simple) + * - SPHINCS_SMALL_LEVEL3 (AKA SPHINCS+-SHAKE-192s-simple) + * - SPHINCS_SMALL_LEVEL5 (AKA SPHINCS+-SHAKE-256s-simple) + */ + +#ifndef WOLF_CRYPT_SPHINCS_H +#define WOLF_CRYPT_SPHINCS_H + +#include <wolfssl/wolfcrypt/types.h> + +#if defined(HAVE_PQC) && defined(HAVE_SPHINCS) + +#ifdef HAVE_LIBOQS +#include <oqs/oqs.h> +#include <wolfssl/wolfcrypt/port/liboqs/liboqs.h> +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +/* Macros Definitions */ + +#ifdef HAVE_LIBOQS + +#define SPHINCS_FAST_LEVEL1_SIG_SIZE OQS_SIG_sphincs_shake_128f_simple_length_signature +#define SPHINCS_FAST_LEVEL3_SIG_SIZE OQS_SIG_sphincs_shake_192f_simple_length_signature +#define SPHINCS_FAST_LEVEL5_SIG_SIZE OQS_SIG_sphincs_shake_256f_simple_length_signature +#define SPHINCS_SMALL_LEVEL1_SIG_SIZE OQS_SIG_sphincs_shake_128s_simple_length_signature +#define SPHINCS_SMALL_LEVEL3_SIG_SIZE OQS_SIG_sphincs_shake_192s_simple_length_signature +#define SPHINCS_SMALL_LEVEL5_SIG_SIZE OQS_SIG_sphincs_shake_256s_simple_length_signature + +#define SPHINCS_LEVEL1_KEY_SIZE OQS_SIG_sphincs_shake_128f_simple_length_secret_key +#define SPHINCS_LEVEL1_PUB_KEY_SIZE OQS_SIG_sphincs_shake_128f_simple_length_public_key +#define SPHINCS_LEVEL1_PRV_KEY_SIZE (SPHINCS_LEVEL1_PUB_KEY_SIZE+SPHINCS_LEVEL1_KEY_SIZE) + +#define SPHINCS_LEVEL3_KEY_SIZE OQS_SIG_sphincs_shake_192f_simple_length_secret_key +#define SPHINCS_LEVEL3_PUB_KEY_SIZE OQS_SIG_sphincs_shake_192f_simple_length_public_key +#define SPHINCS_LEVEL3_PRV_KEY_SIZE (SPHINCS_LEVEL3_PUB_KEY_SIZE+SPHINCS_LEVEL3_KEY_SIZE) + +#define SPHINCS_LEVEL5_KEY_SIZE OQS_SIG_sphincs_shake_256f_simple_length_secret_key +#define SPHINCS_LEVEL5_PUB_KEY_SIZE OQS_SIG_sphincs_shake_256f_simple_length_public_key +#define SPHINCS_LEVEL5_PRV_KEY_SIZE (SPHINCS_LEVEL5_PUB_KEY_SIZE+SPHINCS_LEVEL5_KEY_SIZE) +#endif + +#define SPHINCS_MAX_SIG_SIZE SPHINCS_FAST_LEVEL5_SIG_SIZE +#define SPHINCS_MAX_KEY_SIZE SPHINCS_LEVEL5_PRV_KEY_SIZE +#define SPHINCS_MAX_PUB_KEY_SIZE SPHINCS_LEVEL5_PUB_KEY_SIZE +#define SPHINCS_MAX_PRV_KEY_SIZE SPHINCS_LEVEL5_PRV_KEY_SIZE + +#define FAST_VARIANT 1 +#define SMALL_VARIANT 2 + +/* Structs */ + +struct sphincs_key { + bool pubKeySet; + bool prvKeySet; + byte level; /* 1,3 or 5 */ + byte optim; /* FAST_VARIANT or SMALL_VARIANT */ + byte p[SPHINCS_MAX_PUB_KEY_SIZE]; + byte k[SPHINCS_MAX_PRV_KEY_SIZE]; +}; + +#ifndef WC_SPHINCSKEY_TYPE_DEFINED + typedef struct sphincs_key sphincs_key; + #define WC_SPHINCSKEY_TYPE_DEFINED +#endif + +/* Functions */ + +WOLFSSL_API +int wc_sphincs_sign_msg(const byte* in, word32 inLen, byte* out, word32 *outLen, + sphincs_key* key, WC_RNG* rng); +WOLFSSL_API +int wc_sphincs_verify_msg(const byte* sig, word32 sigLen, const byte* msg, + word32 msgLen, int* res, sphincs_key* key); + +WOLFSSL_API +int wc_sphincs_init(sphincs_key* key); +WOLFSSL_API +int wc_sphincs_set_level_and_optim(sphincs_key* key, byte level, byte optim); +WOLFSSL_API +int wc_sphincs_get_level_and_optim(sphincs_key* key, byte* level, byte *optim); +WOLFSSL_API +void wc_sphincs_free(sphincs_key* key); + +WOLFSSL_API +int wc_sphincs_import_public(const byte* in, word32 inLen, sphincs_key* key); +WOLFSSL_API +int wc_sphincs_import_private_only(const byte* priv, word32 privSz, + sphincs_key* key); +WOLFSSL_API +int wc_sphincs_import_private_key(const byte* priv, word32 privSz, + const byte* pub, word32 pubSz, + sphincs_key* key); + +WOLFSSL_API +int wc_sphincs_export_public(sphincs_key* key, byte* out, word32* outLen); +WOLFSSL_API +int wc_sphincs_export_private_only(sphincs_key* key, byte* out, word32* outLen); +WOLFSSL_API +int wc_sphincs_export_private(sphincs_key* key, byte* out, word32* outLen); +WOLFSSL_API +int wc_sphincs_export_key(sphincs_key* key, byte* priv, word32 *privSz, + byte* pub, word32 *pubSz); + +WOLFSSL_API +int wc_sphincs_check_key(sphincs_key* key); + +WOLFSSL_API +int wc_sphincs_size(sphincs_key* key); +WOLFSSL_API +int wc_sphincs_priv_size(sphincs_key* key); +WOLFSSL_API +int wc_sphincs_pub_size(sphincs_key* key); +WOLFSSL_API +int wc_sphincs_sig_size(sphincs_key* key); + +WOLFSSL_API int wc_Sphincs_PrivateKeyDecode(const byte* input, + word32* inOutIdx, + sphincs_key* key, word32 inSz); +WOLFSSL_API int wc_Sphincs_PublicKeyDecode(const byte* input, + word32* inOutIdx, + sphincs_key* key, word32 inSz); +WOLFSSL_API int wc_Sphincs_KeyToDer(sphincs_key* key, byte* output, + word32 inLen); +WOLFSSL_API int wc_Sphincs_PrivateKeyToDer(sphincs_key* key, byte* output, + word32 inLen); +WOLFSSL_API int wc_Sphincs_PublicKeyToDer(sphincs_key* key, byte* output, + word32 inLen, int withAlg); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* HAVE_PQC && HAVE_SPHINCS */ +#endif /* WOLF_CRYPT_SPHINCS_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/srp.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/srp.h @@ -0,0 +1,313 @@ +/* srp.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/srp.h +*/ + +#ifdef WOLFCRYPT_HAVE_SRP + +#ifndef WOLFCRYPT_SRP_H +#define WOLFCRYPT_SRP_H + +#include <wolfssl/wolfcrypt/types.h> +#include <wolfssl/wolfcrypt/sha.h> +#include <wolfssl/wolfcrypt/sha256.h> +#include <wolfssl/wolfcrypt/sha512.h> +#include <wolfssl/wolfcrypt/wolfmath.h> + +#ifdef __cplusplus + extern "C" { +#endif + +/* Select the largest available hash for the buffer size. */ +#if defined(WOLFSSL_SHA512) + #define SRP_MAX_DIGEST_SIZE WC_SHA512_DIGEST_SIZE +#elif defined(WOLFSSL_SHA384) + #define SRP_MAX_DIGEST_SIZE WC_SHA384_DIGEST_SIZE +#elif !defined(NO_SHA256) + #define SRP_MAX_DIGEST_SIZE WC_SHA256_DIGEST_SIZE +#elif !defined(NO_SHA) + #define SRP_MAX_DIGEST_SIZE WC_SHA_DIGEST_SIZE +#else + #error "You have to have some kind of SHA hash if you want to use SRP." +#endif + +/* Set the minimum number of bits acceptable in an SRP modulus */ +#define SRP_MODULUS_MIN_BITS 512 + +/* Set the minimum number of bits acceptable for private keys (RFC 5054) */ +#define SRP_PRIVATE_KEY_MIN_BITS 256 + +/* salt size for SRP password */ +#define SRP_SALT_SIZE 16 + +/** + * SRP side, client or server. + */ +typedef enum { + SRP_CLIENT_SIDE = 0, + SRP_SERVER_SIDE = 1 +} SrpSide; + +/** + * SRP hash type, SHA[1|256|384|512]. + */ +typedef enum { + SRP_TYPE_SHA = 1, + SRP_TYPE_SHA256 = 2, + SRP_TYPE_SHA384 = 3, + SRP_TYPE_SHA512 = 4 +} SrpType; + + +/** + * SRP hash struct. + */ +typedef struct { + byte type; + union { + #ifndef NO_SHA + wc_Sha sha; + #endif + #ifndef NO_SHA256 + wc_Sha256 sha256; + #endif + #ifdef WOLFSSL_SHA384 + wc_Sha384 sha384; + #endif + #ifdef WOLFSSL_SHA512 + wc_Sha512 sha512; + #endif + } data; +} SrpHash; + +typedef struct Srp { + SrpSide side; /**< Client or Server, @see SrpSide. */ + SrpType type; /**< Hash type, @see SrpType. */ + byte* user; /**< Username, login. */ + word32 userSz; /**< Username length. */ + byte* salt; /**< Small salt. */ + word32 saltSz; /**< Salt length. */ + mp_int N; /**< Modulus. N = 2q+1, [q, N] are primes.*/ + mp_int g; /**< Generator. A generator modulo N. */ + byte k[SRP_MAX_DIGEST_SIZE]; /**< Multiplier parameter. k = H(N, g) */ + mp_int auth; /**< Client: x = H(salt + H(user:pswd)) */ + /**< Server: v = g ^ x % N */ + mp_int priv; /**< Private ephemeral value. */ + SrpHash client_proof; /**< Client proof. Sent to the Server. */ + SrpHash server_proof; /**< Server proof. Sent to the Client. */ + byte* key; /**< Session key. */ + word32 keySz; /**< Session key length. */ + int (*keyGenFunc_cb) (struct Srp* srp, byte* secret, word32 size); + /**< Function responsible for generating the session key. */ + /**< It MUST use XMALLOC with type DYNAMIC_TYPE_SRP to allocate the */ + /**< key buffer for this structure and set keySz to the buffer size. */ + /**< The default function used by this implementation is a modified */ + /**< version of t_mgf1 that uses the proper hash function according */ + /**< to srp->type. */ + void* heap; /**< heap hint pointer */ +} Srp; + +/** + * Initializes the Srp struct for usage. + * + * @param[out] srp the Srp structure to be initialized. + * @param[in] type the hash type to be used. + * @param[in] side the side of the communication. + * + * @return 0 on success, {@literal <} 0 on error. @see error-crypt.h + */ +WOLFSSL_API int wc_SrpInit(Srp* srp, SrpType type, SrpSide side); +WOLFSSL_API int wc_SrpInit_ex(Srp* srp, SrpType type, SrpSide side, + void* heap, int devId); + +/** + * Releases the Srp struct resources after usage. + * + * @param[in,out] srp the Srp structure to be terminated. + */ +WOLFSSL_API void wc_SrpTerm(Srp* srp); + +/** + * Sets the username. + * + * This function MUST be called after wc_SrpInit. + * + * @param[in,out] srp the Srp structure. + * @param[in] username the buffer containing the username. + * @param[in] size the username size in bytes + * + * @return 0 on success, {@literal <} 0 on error. @see error-crypt.h + */ +WOLFSSL_API int wc_SrpSetUsername(Srp* srp, const byte* username, word32 size); + + +/** + * Sets the srp parameters based on the username. + * + * This function MUST be called after wc_SrpSetUsername. + * + * @param[in,out] srp the Srp structure. + * @param[in] N the Modulus. N = 2q+1, [q, N] are primes. + * @param[in] nSz the N size in bytes. + * @param[in] g the Generator modulo N. + * @param[in] gSz the g size in bytes + * @param[in] salt a small random salt. Specific for each username. + * @param[in] saltSz the salt size in bytes + * + * @return 0 on success, {@literal <} 0 on error. @see error-crypt.h + */ +WOLFSSL_API int wc_SrpSetParams(Srp* srp, const byte* N, word32 nSz, + const byte* g, word32 gSz, + const byte* salt, word32 saltSz); + +/** + * Sets the password. + * + * Setting the password does not persists the clear password data in the + * srp structure. The client calculates x = H(salt + H(user:pswd)) and stores + * it in the auth field. + * + * This function MUST be called after wc_SrpSetParams and is CLIENT SIDE ONLY. + * + * @param[in,out] srp the Srp structure. + * @param[in] password the buffer containing the password. + * @param[in] size the password size in bytes. + * + * @return 0 on success, {@literal <} 0 on error. @see error-crypt.h + */ +WOLFSSL_API int wc_SrpSetPassword(Srp* srp, const byte* password, word32 size); + +/** + * Sets the verifier. + * + * This function MUST be called after wc_SrpSetParams and is SERVER SIDE ONLY. + * + * @param[in,out] srp the Srp structure. + * @param[in] verifier the buffer containing the verifier. + * @param[in] size the verifier size in bytes. + * + * @return 0 on success, {@literal <} 0 on error. @see error-crypt.h + */ +WOLFSSL_API int wc_SrpSetVerifier(Srp* srp, const byte* verifier, word32 size); + +/** + * Gets the verifier. + * + * The client calculates the verifier with v = g ^ x % N. + * This function MAY be called after wc_SrpSetPassword and is CLIENT SIDE ONLY. + * + * @param[in,out] srp the Srp structure. + * @param[out] verifier the buffer to write the verifier. + * @param[in,out] size the buffer size in bytes. Will be updated with the + * verifier size. + * + * @return 0 on success, {@literal <} 0 on error. @see error-crypt.h + */ +WOLFSSL_API int wc_SrpGetVerifier(Srp* srp, byte* verifier, word32* size); + +/** + * Sets the private ephemeral value. + * + * The private ephemeral value is known as: + * a at the client side. a = random() + * b at the server side. b = random() + * This function is handy for unit test cases or if the developer wants to use + * an external random source to set the ephemeral value. + * This function MAY be called before wc_SrpGetPublic. + * + * @param[in,out] srp the Srp structure. + * @param[in] priv the ephemeral value. + * @param[in] size the private size in bytes. + * + * @return 0 on success, {@literal <} 0 on error. @see error-crypt.h + */ +WOLFSSL_API int wc_SrpSetPrivate(Srp* srp, const byte* priv, word32 size); + +/** + * Gets the public ephemeral value. + * + * The public ephemeral value is known as: + * A at the client side. A = g ^ a % N + * B at the server side. B = (k * v + (g ^ b % N)) % N + * This function MUST be called after wc_SrpSetPassword or wc_SrpSetVerifier. + * + * @param[in,out] srp the Srp structure. + * @param[out] pub the buffer to write the public ephemeral value. + * @param[in,out] size the the buffer size in bytes. Will be updated with + * the ephemeral value size. + * + * @return 0 on success, {@literal <} 0 on error. @see error-crypt.h + */ +WOLFSSL_API int wc_SrpGetPublic(Srp* srp, byte* pub, word32* size); + + +/** + * Computes the session key. + * + * The key can be accessed at srp->key after success. + * + * @param[in,out] srp the Srp structure. + * @param[in] clientPubKey the client's public ephemeral value. + * @param[in] clientPubKeySz the client's public ephemeral value size. + * @param[in] serverPubKey the server's public ephemeral value. + * @param[in] serverPubKeySz the server's public ephemeral value size. + * + * @return 0 on success, {@literal <} 0 on error. @see error-crypt.h + */ +WOLFSSL_API int wc_SrpComputeKey(Srp* srp, + byte* clientPubKey, word32 clientPubKeySz, + byte* serverPubKey, word32 serverPubKeySz); + +/** + * Gets the proof. + * + * This function MUST be called after wc_SrpComputeKey. + * + * @param[in,out] srp the Srp structure. + * @param[out] proof the buffer to write the proof. + * @param[in,out] size the buffer size in bytes. Will be updated with the + * proof size. + * + * @return 0 on success, {@literal <} 0 on error. @see error-crypt.h + */ +WOLFSSL_API int wc_SrpGetProof(Srp* srp, byte* proof, word32* size); + +/** + * Verifies the peers proof. + * + * This function MUST be called before wc_SrpGetSessionKey. + * + * @param[in,out] srp the Srp structure. + * @param[in] proof the peers proof. + * @param[in] size the proof size in bytes. + * + * @return 0 on success, {@literal <} 0 on error. @see error-crypt.h + */ +WOLFSSL_API int wc_SrpVerifyPeersProof(Srp* srp, byte* proof, word32 size); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFCRYPT_SRP_H */ +#endif /* WOLFCRYPT_HAVE_SRP */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/tfm.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/tfm.h @@ -0,0 +1,938 @@ +/* tfm.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + + +/* + * Based on public domain TomsFastMath 0.10 by Tom St Denis, tomstdenis@iahu.ca, + * http://math.libtomcrypt.com + */ + + +/** + * Edited by Moises Guimaraes (moises.guimaraes@phoebus.com.br) + * to fit CyaSSL's needs. + */ + +/*! + \file wolfssl/wolfcrypt/tfm.h +*/ + +#ifndef WOLF_CRYPT_TFM_H +#define WOLF_CRYPT_TFM_H + +#include <wolfssl/wolfcrypt/types.h> +#include <wolfssl/wolfcrypt/error-crypt.h> +#ifndef CHAR_BIT + #include <limits.h> +#endif + +#include <wolfssl/wolfcrypt/random.h> + +#ifdef __cplusplus + extern "C" { +#endif + +#ifdef WOLFSSL_NO_ASM + #undef TFM_NO_ASM + #define TFM_NO_ASM +#endif + +#ifdef NO_64BIT + #undef NO_TFM_64BIT + #define NO_TFM_64BIT +#endif + +#ifndef NO_TFM_64BIT +/* autodetect x86-64 and make sure we are using 64-bit digits with x86-64 asm */ +#if defined(__x86_64__) + #if defined(TFM_X86) || defined(TFM_SSE2) || defined(TFM_ARM) + #error x86-64 detected, x86-32/SSE2/ARM optimizations are not valid! + #endif + #if !defined(TFM_X86_64) && !defined(TFM_NO_ASM) + #define TFM_X86_64 + #endif +#endif +#if defined(__aarch64__) && defined(__APPLE__) + #if !defined(TFM_AARCH_64) && !defined(TFM_NO_ASM) + #define TFM_AARCH_64 + #endif +#endif +#if defined(TFM_X86_64) || defined(TFM_AARCH_64) + #if !defined(FP_64BIT) + #define FP_64BIT + #endif +#endif +/* use 64-bit digit even if not using asm on x86_64 */ +#if defined(__x86_64__) && !defined(FP_64BIT) + #define FP_64BIT +#endif +/* if intel compiler doesn't provide 128 bit type don't turn on 64bit */ +#if defined(FP_64BIT) && defined(__INTEL_COMPILER) && !defined(HAVE___UINT128_T) + #undef FP_64BIT + #undef TFM_X86_64 +#endif +#endif /* NO_TFM_64BIT */ + +/* try to detect x86-32 */ +#if defined(__i386__) && !defined(TFM_SSE2) + #if defined(TFM_X86_64) || defined(TFM_ARM) + #error x86-32 detected, x86-64/ARM optimizations are not valid! + #endif + #if !defined(TFM_X86) && !defined(TFM_NO_ASM) + #define TFM_X86 + #endif +#endif + +/* make sure we're 32-bit for x86-32/sse/arm/ppc32 */ +#if (defined(TFM_X86) || defined(TFM_SSE2) || defined(TFM_ARM) || defined(TFM_PPC32)) && defined(FP_64BIT) + #warning x86-32, SSE2 and ARM, PPC32 optimizations require 32-bit digits (undefining) + #undef FP_64BIT +#endif + +/* multi asms? */ +#ifdef TFM_X86 + #define TFM_ASM +#endif +#ifdef TFM_X86_64 + #ifdef TFM_ASM + #error TFM_ASM already defined! + #endif + #define TFM_ASM +#endif +#ifdef TFM_SSE2 + #ifdef TFM_ASM + #error TFM_ASM already defined! + #endif + #define TFM_ASM +#endif +#ifdef TFM_ARM + #ifdef TFM_ASM + #error TFM_ASM already defined! + #endif + #define TFM_ASM +#endif +#ifdef TFM_PPC32 + #ifdef TFM_ASM + #error TFM_ASM already defined! + #endif + #define TFM_ASM +#endif +#ifdef TFM_PPC64 + #ifdef TFM_ASM + #error TFM_ASM already defined! + #endif + #define TFM_ASM +#endif +#ifdef TFM_AVR32 + #ifdef TFM_ASM + #error TFM_ASM already defined! + #endif + #define TFM_ASM +#endif + +/* we want no asm? */ +#ifdef TFM_NO_ASM + #undef TFM_X86 + #undef TFM_X86_64 + #undef TFM_SSE2 + #undef TFM_ARM + #undef TFM_PPC32 + #undef TFM_PPC64 + #undef TFM_AVR32 + #undef TFM_ASM +#endif + +/* ECC helpers */ +#ifdef TFM_ECC192 + #ifdef FP_64BIT + #define TFM_MUL3 + #define TFM_SQR3 + #else + #define TFM_MUL6 + #define TFM_SQR6 + #endif +#endif + +#ifdef TFM_ECC224 + #ifdef FP_64BIT + #define TFM_MUL4 + #define TFM_SQR4 + #else + #define TFM_MUL7 + #define TFM_SQR7 + #endif +#endif + +#ifdef TFM_ECC256 + #ifdef FP_64BIT + #define TFM_MUL4 + #define TFM_SQR4 + #else + #define TFM_MUL8 + #define TFM_SQR8 + #endif +#endif + +#ifdef TFM_ECC384 + #ifdef FP_64BIT + #define TFM_MUL6 + #define TFM_SQR6 + #else + #define TFM_MUL12 + #define TFM_SQR12 + #endif +#endif + +#ifdef TFM_ECC521 + #ifdef FP_64BIT + #define TFM_MUL9 + #define TFM_SQR9 + #else + #define TFM_MUL17 + #define TFM_SQR17 + #endif +#endif + + +/* allow user to define on fp_digit, fp_word types */ +#ifndef WOLFSSL_BIGINT_TYPES + +/* some default configurations. + */ +#if defined(WC_16BIT_CPU) + typedef unsigned int fp_digit; + #define SIZEOF_FP_DIGIT 2 + typedef unsigned long fp_word; + typedef signed long fp_sword; +#elif defined(FP_64BIT) + /* for GCC only on supported platforms */ + typedef unsigned long long fp_digit; /* 64bit, 128 uses mode(TI) below */ + #define SIZEOF_FP_DIGIT 8 + typedef unsigned long fp_word __attribute__ ((mode(TI))); + typedef signed long fp_sword __attribute__ ((mode(TI))); +#else + + #ifndef NO_TFM_64BIT + #if defined(_MSC_VER) || defined(__BORLANDC__) + typedef unsigned __int64 ulong64; + typedef signed __int64 long64; + #else + typedef unsigned long long ulong64; + typedef signed long long long64; + #endif + typedef unsigned int fp_digit; + #define SIZEOF_FP_DIGIT 4 + typedef ulong64 fp_word; + typedef long64 fp_sword; + #define FP_32BIT + #else + /* some procs like coldfire prefer not to place multiply into 64bit type + even though it exists */ + typedef unsigned short fp_digit; + #define SIZEOF_FP_DIGIT 2 + typedef unsigned int fp_word; + typedef signed int fp_sword; + #endif +#endif + +#endif /* WOLFSSL_BIGINT_TYPES */ + + +/* # of digits this is */ +#define DIGIT_BIT ((CHAR_BIT) * SIZEOF_FP_DIGIT) + +/* Max size of any number in bits. Basically the largest size you will be + * multiplying should be half [or smaller] of FP_MAX_SIZE-four_digit + * + * It defaults to 4096-bits [allowing multiplications up to 2048x2048 bits ] + */ + + +#ifndef FP_MAX_BITS + #define FP_MAX_BITS 4096 +#endif +#ifdef WOLFSSL_OPENSSH + /* OpenSSH uses some BIG primes so we need to accommodate for that */ + #undef FP_MAX_BITS + #define FP_MAX_BITS 16384 +#endif +#define FP_MAX_SIZE (FP_MAX_BITS+(8*DIGIT_BIT)) + +/* will this lib work? */ +#if CHAR_BIT == 0 + #error CHAR_BIT must be nonzero +#endif +#if (CHAR_BIT & 7) + #error CHAR_BIT must be a multiple of eight. +#endif +#if FP_MAX_BITS % CHAR_BIT + #error FP_MAX_BITS must be a multiple of CHAR_BIT +#endif + +#define FP_MASK (fp_digit)(-1) +#define FP_DIGIT_MAX FP_MASK +#define FP_SIZE (FP_MAX_SIZE/DIGIT_BIT) +#define MP_SIZE (FP_MAX_SIZE/DIGIT_BIT) /* for compatibility with SP_INT */ + + +#define FP_MAX_PRIME_SIZE (FP_MAX_BITS/(2*CHAR_BIT)) +/* In terms of FP_MAX_BITS, it is double the size possible for a number + * to allow for multiplication, divide that 2 out. Also divide by CHAR_BIT + * to convert from bits to bytes. (Note, FP_PRIME_SIZE is the number of + * values in the canned prime number list.) */ + +/* signs */ +#define FP_ZPOS 0 +#define FP_NEG 1 + +/* return codes */ +#define FP_OKAY 0 +#define FP_VAL MP_VAL +#define FP_MEM MP_MEM +#define FP_NOT_INF MP_NOT_INF +#define FP_WOULDBLOCK MP_WOULDBLOCK + +/* equalities */ +#define FP_LT (-1) /* less than */ +#define FP_EQ 0 /* equal to */ +#define FP_GT 1 /* greater than */ + +/* replies */ +#define FP_YES 1 /* yes response */ +#define FP_NO 0 /* no response */ + + +#ifdef WOLFSSL_SMALL_STACK +/* + * Dynamic memory allocation of mp_int. + */ +/* Declare a dynamically allocated mp_int. */ +#define DECL_MP_INT_SIZE(name, bits) \ + mp_int* name = NULL +/* Declare a dynamically allocated mp_int. */ +#define DECL_MP_INT_SIZE_DYN(name, bits, max) \ + mp_int* name = NULL +/* Allocate an mp_int of minimal size and zero out. */ +#define NEW_MP_INT_SIZE(name, bits, heap, type) \ +do { \ + name = (mp_int*)XMALLOC(sizeof(mp_int), heap, type); \ + if (name != NULL) { \ + XMEMSET(name, 0, sizeof(mp_int)); \ + } \ +} \ +while (0) +/* Dispose of dynamically allocated mp_int. */ +#define FREE_MP_INT_SIZE(name, heap, type) \ + XFREE(name, heap, type) +/* Must check for mp_int pointer for NULL. */ +#define MP_INT_SIZE_CHECK_NULL +#else +/* + * Static allocation of mp_int. + */ +/* Declare a statically allocated mp_int. */ +#define DECL_MP_INT_SIZE(name, bits) \ + mp_int name[1] +/* Declare a statically allocated mp_int. */ +#define DECL_MP_INT_SIZE_DYN(name, bits, max) \ + mp_int name[1] +/* Zero out mp_int of minimal size. */ +#define NEW_MP_INT_SIZE(name, bits, heap, type) \ + XMEMSET(name, 0, sizeof(mp_int)) +/* Dispose of static mp_int. */ +#define FREE_MP_INT_SIZE(name, heap, type) WC_DO_NOTHING +#endif + +/* Initialize an mp_int. */ +#define INIT_MP_INT_SIZE(name, bits) \ + mp_init(name) +/* Type to cast to when using size macros. */ +#define MP_INT_SIZE mp_int + + +#ifdef HAVE_WOLF_BIGINT + /* raw big integer */ + typedef struct WC_BIGINT { + byte* buf; + word32 len; + void* heap; + } WC_BIGINT; + #define WOLF_BIGINT_DEFINED +#endif + +#define wc_mp_size_t int +#define wc_mp_sign_t int + +/* a FP type */ +typedef struct fp_int { + int used; + int sign; +#if defined(ALT_ECC_SIZE) || defined(HAVE_WOLF_BIGINT) + int size; +#endif + fp_digit dp[FP_SIZE]; + +#ifdef HAVE_WOLF_BIGINT + struct WC_BIGINT raw; /* unsigned binary (big endian) */ +#endif +} fp_int; + +/* Types */ +typedef fp_digit mp_digit; +typedef fp_word mp_word; +typedef fp_int mp_int; + + +/* wolf big int and common functions */ +#include <wolfssl/wolfcrypt/wolfmath.h> + + +/* externally define this symbol to ignore the default settings, useful for changing the build from the make process */ +#ifndef TFM_ALREADY_SET + +/* do we want the large set of small multiplications ? + Enable these if you are going to be doing a lot of small (<= 16 digit) multiplications say in ECC + Or if you're on a 64-bit machine doing RSA as a 1024-bit integer == 16 digits ;-) + */ +/* need to refactor the function */ +/*#define TFM_SMALL_SET */ + +/* do we want huge code + Enable these if you are doing 20, 24, 28, 32, 48, 64 digit multiplications (useful for RSA) + Less important on 64-bit machines as 32 digits == 2048 bits + */ +#if 0 +#define TFM_MUL3 +#define TFM_MUL4 +#define TFM_MUL6 +#define TFM_MUL7 +#define TFM_MUL8 +#define TFM_MUL9 +#define TFM_MUL12 +#define TFM_MUL17 +#endif +#ifdef TFM_HUGE_SET +#define TFM_MUL20 +#define TFM_MUL24 +#define TFM_MUL28 +#define TFM_MUL32 +#if (FP_MAX_BITS >= 6144) && defined(FP_64BIT) + #define TFM_MUL48 +#endif +#if (FP_MAX_BITS >= 8192) && defined(FP_64BIT) + #define TFM_MUL64 +#endif +#endif + +#if 0 +#define TFM_SQR3 +#define TFM_SQR4 +#define TFM_SQR6 +#define TFM_SQR7 +#define TFM_SQR8 +#define TFM_SQR9 +#define TFM_SQR12 +#define TFM_SQR17 +#endif +#ifdef TFM_HUGE_SET +#define TFM_SQR20 +#define TFM_SQR24 +#define TFM_SQR28 +#define TFM_SQR32 +#define TFM_SQR48 +#define TFM_SQR64 +#endif + +/* Optional math checks (enable WOLFSSL_DEBUG_MATH to print info) */ +/* #define TFM_CHECK */ + +/* Is the target a P4 Prescott + */ +/* #define TFM_PRESCOTT */ + +/* Do we want timing resistant fp_exptmod() ? + * This makes it slower but also timing invariant with respect to the exponent + */ +/* #define TFM_TIMING_RESISTANT */ + +#endif /* TFM_ALREADY_SET */ + +/* functions */ + +/* returns a TFM ident string useful for debugging... */ +/*const char *fp_ident(void);*/ + +/* initialize [or zero] an fp int */ +void fp_init(fp_int *a); +MP_API void fp_zero(fp_int *a); +MP_API void fp_clear(fp_int *a); +/* uses ForceZero to clear sensitive memory */ +MP_API void fp_forcezero (fp_int * a); +MP_API void fp_free(fp_int* a); + +/* zero/one/even/odd/neg/word ? */ +#define fp_iszero(a) (((a)->used == 0) ? FP_YES : FP_NO) +#define fp_isone(a) \ + ((((a)->used == 1) && ((a)->dp[0] == 1) && ((a)->sign == FP_ZPOS)) \ + ? FP_YES : FP_NO) +#define fp_iseven(a) \ + (((a)->used > 0 && (((a)->dp[0] & 1) == 0)) ? FP_YES : FP_NO) +#define fp_isodd(a) \ + (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? FP_YES : FP_NO) +#define fp_isneg(a) (((a)->sign != FP_ZPOS) ? FP_YES : FP_NO) +#define fp_setneg(a) ((a)->sign = FP_NEG) +#define fp_isword(a, w) \ + (((((a)->used == 1) && ((a)->dp[0] == (w))) || \ + (((w) == 0) && ((a)->used == 0))) ? FP_YES : FP_NO) +/* Number of bits used based on used field only. */ +#define fp_bitsused(a) ((a)->used * DIGIT_BIT) + +/* set to a small digit */ +void fp_set(fp_int *a, fp_digit b); +int fp_set_int(fp_int *a, unsigned long b); + +/* check if a bit is set */ +int fp_is_bit_set(fp_int *a, fp_digit b); +/* set the b bit to 1 */ +int fp_set_bit (fp_int * a, fp_digit b); + +/* copy from a to b */ +void fp_copy(const fp_int *a, fp_int *b); +void fp_init_copy(fp_int *a, fp_int *b); + +/* clamp digits */ +#define fp_clamp(a) { while ((a)->used && (a)->dp[(a)->used-1] == 0) --((a)->used); (a)->sign = (a)->used ? (a)->sign : FP_ZPOS; } +#define mp_clamp(a) fp_clamp(a) +#define mp_grow(a,s) MP_OKAY + +/* negate and absolute */ +#define fp_neg(a, b) { fp_copy(a, b); (b)->sign ^= 1; fp_clamp(b); } +#define fp_abs(a, b) { fp_copy(a, b); (b)->sign = 0; } + +/* right shift x digits */ +void fp_rshd(fp_int *a, int x); + +/* right shift x bits */ +void fp_rshb(fp_int *c, int x); + +/* left shift x digits */ +int fp_lshd(fp_int *a, int x); + +/* signed comparison */ +int fp_cmp(fp_int *a, fp_int *b); + +/* unsigned comparison */ +int fp_cmp_mag(fp_int *a, fp_int *b); + +/* power of 2 operations */ +void fp_div_2d(fp_int *a, int b, fp_int *c, fp_int *d); +void fp_mod_2d(fp_int *a, int b, fp_int *c); +int fp_mul_2d(fp_int *a, int b, fp_int *c); +void fp_2expt (fp_int *a, int b); +int fp_mul_2(fp_int *a, fp_int *b); +void fp_div_2(fp_int *a, fp_int *b); +/* c = a / 2 (mod b) - constant time (a < b and positive) */ +int fp_div_2_mod_ct(fp_int *a, fp_int *b, fp_int *c); + + +/* Counts the number of lsbs which are zero before the first zero bit */ +int fp_cnt_lsb(fp_int *a); + +/* c = a + b */ +int fp_add(fp_int *a, fp_int *b, fp_int *c); + +/* c = a - b */ +int fp_sub(fp_int *a, fp_int *b, fp_int *c); + +/* c = a * b */ +int fp_mul(fp_int *a, fp_int *b, fp_int *c); + +/* b = a*a */ +int fp_sqr(fp_int *a, fp_int *b); + +/* a/b => cb + d == a */ +int fp_div(fp_int *a, fp_int *b, fp_int *c, fp_int *d); + +/* c = a mod b, 0 <= c < b */ +int fp_mod(fp_int *a, fp_int *b, fp_int *c); + +/* compare against a single digit */ +int fp_cmp_d(fp_int *a, fp_digit b); + +/* c = a + b */ +int fp_add_d(fp_int *a, fp_digit b, fp_int *c); + +/* c = a - b */ +int fp_sub_d(fp_int *a, fp_digit b, fp_int *c); + +/* c = a * b */ +int fp_mul_d(fp_int *a, fp_digit b, fp_int *c); + +/* a/b => cb + d == a */ +/*int fp_div_d(fp_int *a, fp_digit b, fp_int *c, fp_digit *d);*/ + +/* c = a mod b, 0 <= c < b */ +/*int fp_mod_d(fp_int *a, fp_digit b, fp_digit *c);*/ + +/* ---> number theory <--- */ +/* d = a + b (mod c) */ +/*int fp_addmod(fp_int *a, fp_int *b, fp_int *c, fp_int *d);*/ + +/* d = a - b (mod c) */ +/*int fp_submod(fp_int *a, fp_int *b, fp_int *c, fp_int *d);*/ + +/* d = a * b (mod c) */ +int fp_mulmod(fp_int *a, fp_int *b, fp_int *c, fp_int *d); + +/* d = a - b (mod c) */ +int fp_submod(fp_int *a, fp_int *b, fp_int *c, fp_int *d); + +/* d = a + b (mod c) */ +int fp_addmod(fp_int *a, fp_int *b, fp_int *c, fp_int *d); + +/* d = a - b (mod c) - constant time (a < c and b < c) */ +int fp_submod_ct(fp_int *a, fp_int *b, fp_int *c, fp_int *d); + +/* d = a + b (mod c) - constant time (a < c and b < c) */ +int fp_addmod_ct(fp_int *a, fp_int *b, fp_int *c, fp_int *d); + +/* c = a * a (mod b) */ +int fp_sqrmod(fp_int *a, fp_int *b, fp_int *c); + +/* c = 1/a (mod b) */ +int fp_invmod(fp_int *a, fp_int *b, fp_int *c); +int fp_invmod_mont_ct(fp_int *a, fp_int *b, fp_int *c, fp_digit mp); + +/* c = (a, b) */ +/*int fp_gcd(fp_int *a, fp_int *b, fp_int *c);*/ + +/* c = [a, b] */ +/*int fp_lcm(fp_int *a, fp_int *b, fp_int *c);*/ + +/* setups the montgomery reduction */ +int fp_montgomery_setup(fp_int *a, fp_digit *rho); + +/* computes a = B**n mod b without division or multiplication useful for + * normalizing numbers in a Montgomery system. + */ +int fp_montgomery_calc_normalization(fp_int *a, fp_int *b); + +/* computes x/R == x (mod N) via Montgomery Reduction */ +int fp_montgomery_reduce(fp_int *a, fp_int *m, fp_digit mp); +int fp_montgomery_reduce_ex(fp_int *a, fp_int *m, fp_digit mp, int ct); + +/* d = a**b (mod c) */ +int fp_exptmod(fp_int *G, fp_int *X, fp_int *P, fp_int *Y); +int fp_exptmod_ex(fp_int *G, fp_int *X, int minDigits, fp_int *P, fp_int *Y); +int fp_exptmod_nct(fp_int *G, fp_int *X, fp_int *P, fp_int *Y); + +#ifdef WC_RSA_NONBLOCK + +enum tfmExptModNbState { + TFM_EXPTMOD_NB_INIT = 0, + TFM_EXPTMOD_NB_MONT, + TFM_EXPTMOD_NB_MONT_RED, + TFM_EXPTMOD_NB_MONT_MUL, + TFM_EXPTMOD_NB_MONT_MOD, + TFM_EXPTMOD_NB_MONT_MODCHK, + TFM_EXPTMOD_NB_NEXT, + TFM_EXPTMOD_NB_MUL, + TFM_EXPTMOD_NB_MUL_RED, + TFM_EXPTMOD_NB_SQR, + TFM_EXPTMOD_NB_SQR_RED, + TFM_EXPTMOD_NB_RED, + TFM_EXPTMOD_NB_COUNT /* last item for total state count only */ +}; + +typedef struct { +#ifndef WC_NO_CACHE_RESISTANT + fp_int R[3]; +#else + fp_int R[2]; +#endif + fp_digit buf; + fp_digit mp; + int bitcnt; + int digidx; + int y; + int state; /* tfmExptModNbState */ +#ifdef WC_RSA_NONBLOCK_TIME + word32 maxBlockInst; /* maximum instructions to block */ + word32 totalInst; /* tracks total instructions */ +#endif +} exptModNb_t; + +#ifdef WC_RSA_NONBLOCK_TIME +enum { + TFM_EXPTMOD_NB_STOP = 0, /* stop and return FP_WOULDBLOCK */ + TFM_EXPTMOD_NB_CONTINUE = 1, /* keep blocking */ +}; +#endif + +/* non-blocking version of timing resistant fp_exptmod function */ +/* supports cache resistance */ +int fp_exptmod_nb(exptModNb_t* nb, fp_int* G, fp_int* X, fp_int* P, fp_int* Y); + +#endif /* WC_RSA_NONBLOCK */ + +/* primality stuff */ + +/* perform a Miller-Rabin test of a to the base b and store result in "result" */ +/*void fp_prime_miller_rabin (fp_int * a, fp_int * b, int *result);*/ + +#define FP_PRIME_SIZE 256 +/* 256 trial divisions + 8 Miller-Rabins, returns FP_YES if probable prime */ +/*int fp_isprime(fp_int *a);*/ +/* extended version of fp_isprime, do 't' Miller-Rabins instead of only 8 */ +/*int fp_isprime_ex(fp_int *a, int t, int* result);*/ + +/* Primality generation flags */ +/*#define TFM_PRIME_BBS 0x0001 */ /* BBS style prime */ +/*#define TFM_PRIME_SAFE 0x0002 */ /* Safe prime (p-1)/2 == prime */ +/*#define TFM_PRIME_2MSB_OFF 0x0004 */ /* force 2nd MSB to 0 */ +/*#define TFM_PRIME_2MSB_ON 0x0008 */ /* force 2nd MSB to 1 */ + +/* callback for fp_prime_random, should fill dst with random bytes and return how many read [up to len] */ +/*typedef int tfm_prime_callback(unsigned char *dst, int len, void *dat);*/ + +/*#define fp_prime_random(a, t, size, bbs, cb, dat) fp_prime_random_ex(a, t, ((size) * 8) + 1, (bbs==1)?TFM_PRIME_BBS:0, cb, dat)*/ + +/*int fp_prime_random_ex(fp_int *a, int t, int size, int flags, tfm_prime_callback cb, void *dat);*/ + +/* radix conversions */ +int fp_count_bits(const fp_int *a); +int fp_leading_bit(fp_int *a); + +int fp_unsigned_bin_size(const fp_int *a); +int fp_read_unsigned_bin(fp_int *a, const unsigned char *b, int c); +int fp_to_unsigned_bin(fp_int *a, unsigned char *b); +int fp_to_unsigned_bin_len_ct(fp_int *a, unsigned char *out, int outSz); +int fp_to_unsigned_bin_len(fp_int *a, unsigned char *b, int c); +int fp_to_unsigned_bin_at_pos(int x, fp_int *t, unsigned char *b); + +/*int fp_read_radix(fp_int *a, char *str, int radix);*/ +/*int fp_toradix(fp_int *a, char *str, int radix);*/ +/*int fp_toradix_n(fp_int * a, char *str, int radix, int maxlen);*/ + + +/* VARIOUS LOW LEVEL STUFFS */ +int s_fp_add(fp_int *a, fp_int *b, fp_int *c); +void s_fp_sub(fp_int *a, fp_int *b, fp_int *c); + +int fp_mul_comba(fp_int *a, fp_int *b, fp_int *c); + +int fp_mul_comba_small(fp_int *a, fp_int *b, fp_int *c); +int fp_mul_comba3(fp_int *a, fp_int *b, fp_int *c); +int fp_mul_comba4(fp_int *a, fp_int *b, fp_int *c); +int fp_mul_comba6(fp_int *a, fp_int *b, fp_int *c); +int fp_mul_comba7(fp_int *a, fp_int *b, fp_int *c); +int fp_mul_comba8(fp_int *a, fp_int *b, fp_int *c); +int fp_mul_comba9(fp_int *a, fp_int *b, fp_int *c); +int fp_mul_comba12(fp_int *a, fp_int *b, fp_int *c); +int fp_mul_comba17(fp_int *a, fp_int *b, fp_int *c); +int fp_mul_comba20(fp_int *a, fp_int *b, fp_int *c); +int fp_mul_comba24(fp_int *a, fp_int *b, fp_int *c); +int fp_mul_comba28(fp_int *a, fp_int *b, fp_int *c); +int fp_mul_comba32(fp_int *a, fp_int *b, fp_int *c); +int fp_mul_comba48(fp_int *a, fp_int *b, fp_int *c); +int fp_mul_comba64(fp_int *a, fp_int *b, fp_int *c); +int fp_sqr_comba(fp_int *a, fp_int *b); +int fp_sqr_comba_small(fp_int *a, fp_int *b); +int fp_sqr_comba3(fp_int *a, fp_int *b); +int fp_sqr_comba4(fp_int *a, fp_int *b); +int fp_sqr_comba6(fp_int *a, fp_int *b); +int fp_sqr_comba7(fp_int *a, fp_int *b); +int fp_sqr_comba8(fp_int *a, fp_int *b); +int fp_sqr_comba9(fp_int *a, fp_int *b); +int fp_sqr_comba12(fp_int *a, fp_int *b); +int fp_sqr_comba17(fp_int *a, fp_int *b); +int fp_sqr_comba20(fp_int *a, fp_int *b); +int fp_sqr_comba24(fp_int *a, fp_int *b); +int fp_sqr_comba28(fp_int *a, fp_int *b); +int fp_sqr_comba32(fp_int *a, fp_int *b); +int fp_sqr_comba48(fp_int *a, fp_int *b); +int fp_sqr_comba64(fp_int *a, fp_int *b); + + +/** + * Used by wolfSSL + */ + +/* Constants */ +#define MP_LT FP_LT /* less than */ +#define MP_EQ FP_EQ /* equal to */ +#define MP_GT FP_GT /* greater than */ +#define MP_RANGE MP_NOT_INF +#define MP_OKAY FP_OKAY /* ok result */ +#define MP_NO FP_NO /* yes/no result */ +#define MP_YES FP_YES /* yes/no result */ +#define MP_ZPOS FP_ZPOS +#define MP_NEG FP_NEG +#define MP_MASK FP_MASK + +/* Prototypes */ +#define mp_zero(a) fp_zero(a) +#define mp_isone(a) fp_isone(a) +#define mp_iseven(a) fp_iseven(a) +#define mp_isneg(a) fp_isneg(a) +#define mp_setneg(a) fp_setneg(a) +#define mp_isword(a, w) fp_isword(a, w) +#define mp_bitsused(a) fp_bitsused(a) + +#define MP_RADIX_BIN 2 +#define MP_RADIX_OCT 8 +#define MP_RADIX_DEC 10 +#define MP_RADIX_HEX 16 +#define MP_RADIX_MAX 64 + +#define mp_tobinary(M, S) mp_toradix((M), (S), MP_RADIX_BIN) +#define mp_tooctal(M, S) mp_toradix((M), (S), MP_RADIX_OCT) +#define mp_todecimal(M, S) mp_toradix((M), (S), MP_RADIX_DEC) +#define mp_tohex(M, S) mp_toradix((M), (S), MP_RADIX_HEX) + +MP_API int mp_init (mp_int * a); +MP_API int mp_init_copy(fp_int * a, fp_int * b); +MP_API void mp_clear (mp_int * a); +MP_API void mp_free (mp_int * a); +MP_API void mp_forcezero (mp_int * a); +MP_API int mp_init_multi(mp_int* a, mp_int* b, mp_int* c, mp_int* d, mp_int* e, + mp_int* f); + +MP_API int mp_add (mp_int * a, mp_int * b, mp_int * c); +MP_API int mp_sub (mp_int * a, mp_int * b, mp_int * c); +MP_API int mp_add_d (mp_int * a, mp_digit b, mp_int * c); + +MP_API int mp_mul (mp_int * a, mp_int * b, mp_int * c); +MP_API int mp_mul_d (mp_int * a, mp_digit b, mp_int * c); +MP_API int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d); +MP_API int mp_submod (mp_int* a, mp_int* b, mp_int* c, mp_int* d); +MP_API int mp_addmod (mp_int* a, mp_int* b, mp_int* c, mp_int* d); +MP_API int mp_submod_ct (mp_int* a, mp_int* b, mp_int* c, mp_int* d); +MP_API int mp_addmod_ct (mp_int* a, mp_int* b, mp_int* c, mp_int* d); +MP_API int mp_mod(mp_int *a, mp_int *b, mp_int *c); +MP_API int mp_invmod(mp_int *a, mp_int *b, mp_int *c); +MP_API int mp_invmod_mont_ct(mp_int *a, mp_int *b, mp_int *c, fp_digit mp); +MP_API int mp_exptmod (mp_int * g, mp_int * x, mp_int * p, mp_int * y); +MP_API int mp_exptmod_ex (mp_int * g, mp_int * x, int minDigits, mp_int * p, + mp_int * y); +MP_API int mp_exptmod_nct (mp_int * g, mp_int * x, mp_int * p, mp_int * y); +MP_API int mp_mul_2d(mp_int *a, int b, mp_int *c); +MP_API int mp_2expt(mp_int* a, int b); + +MP_API int mp_div(mp_int * a, mp_int * b, mp_int * c, mp_int * d); + +MP_API int mp_cmp(mp_int *a, mp_int *b); +#define mp_cmp_ct(a, b, n) mp_cmp(a, b) +MP_API int mp_cmp_d(mp_int *a, mp_digit b); + +MP_API int mp_unsigned_bin_size(const mp_int * a); +MP_API int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c); +MP_API int mp_to_unsigned_bin_at_pos(int x, mp_int *t, unsigned char *b); +MP_API int mp_to_unsigned_bin (mp_int * a, unsigned char *b); +MP_API int mp_to_unsigned_bin_len_ct(mp_int * a, unsigned char *b, int c); +MP_API int mp_to_unsigned_bin_len(mp_int * a, unsigned char *b, int c); + +MP_API int mp_sub_d(fp_int *a, fp_digit b, fp_int *c); +MP_API int mp_copy(const fp_int* a, fp_int* b); +MP_API int mp_isodd(const mp_int* a); +MP_API int mp_iszero(const mp_int* a); +MP_API int mp_count_bits(const mp_int *a); +MP_API int mp_leading_bit(mp_int *a); +MP_API int mp_set_int(mp_int *a, unsigned long b); +MP_API int mp_is_bit_set (mp_int * a, mp_digit b); +MP_API int mp_set_bit (mp_int * a, mp_digit b); +MP_API void mp_rshb(mp_int *a, int x); +MP_API void mp_rshd(mp_int *a, int x); +MP_API int mp_toradix (mp_int *a, char *str, int radix); +MP_API int mp_radix_size (mp_int * a, int radix, int *size); + +#ifdef WOLFSSL_DEBUG_MATH + MP_API void mp_dump(const char* desc, mp_int* a, byte verbose); +#else + #define mp_dump(desc, a, verbose) WC_DO_NOTHING +#endif + +#if defined(OPENSSL_EXTRA) || !defined(NO_DSA) || defined(HAVE_ECC) + MP_API int mp_read_radix(mp_int* a, const char* str, int radix); +#endif + +#define mp_montgomery_reduce_ct(a, m, mp) \ + mp_montgomery_reduce_ex(a, m, mp, 1) +MP_API int mp_montgomery_reduce(fp_int *a, fp_int *m, fp_digit mp); +MP_API int mp_montgomery_reduce_ex(fp_int *a, fp_int *m, fp_digit mp, int ct); +MP_API int mp_montgomery_setup(fp_int *a, fp_digit *rho); +MP_API int mp_sqr(fp_int *a, fp_int *b); + +#ifdef HAVE_ECC + MP_API int mp_div_2(fp_int * a, fp_int * b); + MP_API int mp_div_2_mod_ct(mp_int *a, mp_int *b, mp_int *c); +#endif + +#if defined(HAVE_ECC) || !defined(NO_RSA) || !defined(NO_DSA) || \ + defined(WOLFSSL_KEY_GEN) + MP_API int mp_set(fp_int *a, fp_digit b); +#endif + +#if defined(HAVE_ECC) || defined(WOLFSSL_KEY_GEN) || !defined(NO_RSA) || \ + !defined(NO_DSA) || !defined(NO_DH) + MP_API int mp_sqrmod(mp_int* a, mp_int* b, mp_int* c); + MP_API int mp_montgomery_calc_normalization(mp_int *a, mp_int *b); +#endif + +#if !defined(NO_DH) || !defined(NO_DSA) || !defined(NO_RSA) || defined(WOLFSSL_KEY_GEN) +MP_API int mp_prime_is_prime(mp_int* a, int t, int* result); +MP_API int mp_prime_is_prime_ex(mp_int* a, int t, int* result, WC_RNG* rng); +#endif /* !NO_DH || !NO_DSA || !NO_RSA || WOLFSSL_KEY_GEN */ +#ifdef WOLFSSL_KEY_GEN +MP_API int mp_gcd(fp_int *a, fp_int *b, fp_int *c); +MP_API int mp_lcm(fp_int *a, fp_int *b, fp_int *c); +MP_API int mp_rand_prime(mp_int* a, int len, WC_RNG* rng, void* heap); +MP_API int mp_exch(mp_int *a, mp_int *b); +#endif /* WOLFSSL_KEY_GEN */ +MP_API int mp_cond_swap_ct_ex(mp_int* a, mp_int* b, int c, int m, mp_int* t); +MP_API int mp_cond_swap_ct(mp_int* a, mp_int* b, int c, int m); + +MP_API int mp_cnt_lsb(fp_int *a); +MP_API int mp_div_2d(fp_int *a, int b, fp_int *c, fp_int *d); +MP_API int mp_mod_2d(fp_int *a, int b, fp_int *c); +MP_API int mp_mod_d(fp_int* a, fp_digit b, fp_digit* c); +MP_API int mp_lshd (mp_int * a, int b); +MP_API int mp_abs(mp_int* a, mp_int* b); + +WOLFSSL_API word32 CheckRunTimeFastMath(void); + +#ifdef WOLFSSL_CHECK_MEM_ZERO +void mp_memzero_add(const char* name, mp_int* a); +void mp_memzero_check(mp_int* a); +#endif + +/* If user uses RSA, DH, DSA, or ECC math lib directly then fast math FP_SIZE + must match, return 1 if a match otherwise 0 */ +#define CheckFastMathSettings() (FP_SIZE == CheckRunTimeFastMath()) + + +#ifdef __cplusplus + } +#endif + +#endif /* WOLF_CRYPT_TFM_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/types.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/types.h @@ -0,0 +1,2143 @@ +/* types.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/types.h +*/ +/* +DESCRIPTION +This library defines the primitive data types and abstraction macros to +decouple library dependencies with standard string, memory and so on. + +*/ +#ifndef WOLF_CRYPT_TYPES_H +#define WOLF_CRYPT_TYPES_H + +#include <wolfssl/wolfcrypt/settings.h> +#include <wolfssl/wolfcrypt/wc_port.h> +#include <wolfssl/wolfcrypt/oid_sum.h> + +#if defined(EXTERNAL_OPTS_OPENVPN) && defined(BUILDING_WOLFSSL) + #error EXTERNAL_OPTS_OPENVPN should not be defined in compiled wolfssl \ +library files. +#endif + +#ifdef __APPLE__ + #include <AvailabilityMacros.h> +#endif + +#ifdef __cplusplus + extern "C" { +#endif + + +/* + * This struct is used multiple time by other structs and + * needs to be defined somewhere that all structs can import + * (with minimal dependencies). + */ +#ifdef HAVE_EX_DATA + #ifdef HAVE_EX_DATA_CLEANUP_HOOKS + typedef void (*wolfSSL_ex_data_cleanup_routine_t)(void *data); + #endif + typedef struct WOLFSSL_CRYPTO_EX_DATA { + void* ex_data[MAX_EX_DATA]; + #ifdef HAVE_EX_DATA_CLEANUP_HOOKS + wolfSSL_ex_data_cleanup_routine_t + ex_data_cleanup_routines[MAX_EX_DATA]; + #endif + } WOLFSSL_CRYPTO_EX_DATA; + typedef void (WOLFSSL_CRYPTO_EX_new)(void* p, void* ptr, + WOLFSSL_CRYPTO_EX_DATA* a, int idx, long argValue, void* arg); + typedef int (WOLFSSL_CRYPTO_EX_dup)(WOLFSSL_CRYPTO_EX_DATA* out, + const WOLFSSL_CRYPTO_EX_DATA* in, void* inPtr, int idx, + long argV, void* arg); + typedef void (WOLFSSL_CRYPTO_EX_free)(void* p, void* ptr, + WOLFSSL_CRYPTO_EX_DATA* a, int idx, long argValue, void* arg); +#endif + +#if defined(WORDS_BIGENDIAN) + #define BIG_ENDIAN_ORDER +#endif + +#ifndef BIG_ENDIAN_ORDER + #define LITTLE_ENDIAN_ORDER +#endif + +#ifndef WOLFSSL_TYPES + #define WOLFSSL_TYPES + #ifndef byte + /* If using C++ C17 or later and getting: + * "error: reference to 'byte' is ambiguous", this is caused by + * cstddef conflict with "std::byte" in + * "enum class byte : unsigned char {};". + * This can occur if the user application is using "std" as the + * default namespace before including wolfSSL headers. + * Workarounds: https://github.com/wolfSSL/wolfssl/issues/5400 + */ + typedef unsigned char byte; + #endif + typedef signed char sword8; + typedef unsigned char word8; + #ifdef WC_16BIT_CPU + typedef int sword16; + typedef unsigned int word16; + typedef long sword32; + typedef unsigned long word32; + #else + typedef short sword16; + typedef unsigned short word16; + typedef int sword32; + typedef unsigned int word32; + #endif + typedef byte word24[3]; +#endif + +typedef const char wcchar[]; + +#ifndef WC_BITFIELD + #ifdef WOLF_C89 + #define WC_BITFIELD unsigned + #else + #define WC_BITFIELD byte + #endif +#endif + +#ifndef HAVE_ANONYMOUS_INLINE_AGGREGATES + /* if a version is available, pivot on the version, otherwise guess it's + * disallowed, subject to override. + */ + #if !defined(WOLF_C89) && (!defined(__STDC__) \ + || (!defined(__STDC_VERSION__) && !defined(__cplusplus)) \ + || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201101L)) \ + || (defined(__cplusplus) && (__cplusplus >= 201103L))) + #define HAVE_ANONYMOUS_INLINE_AGGREGATES 1 + #endif +#elif ~(~HAVE_ANONYMOUS_INLINE_AGGREGATES + 1) == 1 + /* forced on with empty value -- remap to 1 */ + #undef HAVE_ANONYMOUS_INLINE_AGGREGATES + #define HAVE_ANONYMOUS_INLINE_AGGREGATES 1 +#elif HAVE_ANONYMOUS_INLINE_AGGREGATES + /* forced on with explicit nonzero value -- leave as-is. */ +#else + /* forced off with explicit zero value -- remap to undef. */ + #undef HAVE_ANONYMOUS_INLINE_AGGREGATES +#endif + +#ifndef HAVE_EMPTY_AGGREGATES + /* The C standards don't define empty aggregates, but gcc and clang do. + * We need to accommodate them for one of the same reasons C++ does -- + * conditionally empty aggregates, e.g. in hash.h. + * + * Nonetheless, in C++, empty aggregates wind up with size 1. If we use + * the [0] construct and the header is compiled by clang++, it warns + * "struct has size 0 in C, size 1 in C++ [-Wextern-c-compat]", despite + * the extern "C" wrapper. We sidestep this warning by recognizing + * here that C++ doesn't support truly empty aggregates. LLVM, for its + * part, deprecates compilation of C code as C++ using clang++. + */ + #if !defined(WOLF_C89) && defined(__GNUC__) && \ + !defined(__STRICT_ANSI__) && \ + !defined(__cplusplus) && \ + defined(HAVE_ANONYMOUS_INLINE_AGGREGATES) + #define HAVE_EMPTY_AGGREGATES 1 + #endif +#elif ~(~HAVE_EMPTY_AGGREGATES + 1) == 1 + /* forced on with empty value -- remap to 1 */ + #undef HAVE_EMPTY_AGGREGATES + #define HAVE_EMPTY_AGGREGATES 1 +#elif HAVE_EMPTY_AGGREGATES + /* forced on with explicit nonzero value -- leave as-is. */ +#else + /* forced off with explicit zero value -- remap to undef. */ + #undef HAVE_EMPTY_AGGREGATES +#endif + +#define _WOLF_AGG_DUMMY_MEMBER_HELPER2(a, b, c) a ## b ## c +#define _WOLF_AGG_DUMMY_MEMBER_HELPER(a, b, c) \ + _WOLF_AGG_DUMMY_MEMBER_HELPER2(a, b, c) +#ifdef HAVE_EMPTY_AGGREGATES + /* swallow the semicolon with a zero-sized array (language extension + * specific to gcc/clang). + */ + #define WOLF_AGG_DUMMY_MEMBER \ + struct { \ + PRAGMA_GCC_DIAG_PUSH \ + PRAGMA_GCC("GCC diagnostic ignored \"-Wpedantic\"") \ + PRAGMA_CLANG_DIAG_PUSH \ + PRAGMA_CLANG("clang diagnostic ignored \"-Wzero-length-array\"") \ + byte _WOLF_AGG_DUMMY_MEMBER_HELPER(_wolf_L, __LINE__, \ + _agg_dummy_member)[0]; \ + PRAGMA_CLANG_DIAG_POP \ + PRAGMA_GCC_DIAG_POP \ + } +#else + /* Use a single byte with a constructed name as a dummy member -- these + * are the standard semantics of an empty structure in C++. + */ + #define WOLF_AGG_DUMMY_MEMBER char _WOLF_AGG_DUMMY_MEMBER_HELPER( \ + _wolf_L, __LINE__, _agg_dummy_member) +#endif + +/* helpers for stringifying the expanded value of a macro argument rather + * than its literal text: + */ +#define _WC_STRINGIFY_L2(str) #str +#define WC_STRINGIFY(str) _WC_STRINGIFY_L2(str) + +/* With a true C89-dialect compiler (simulate with gcc -std=c89 -Wall + * -Wextra -pedantic), a trailing comma on the last value in an enum + * definition is a syntax error. We use this macro to accommodate that + * without disrupting clean flow/syntax when some enum values are + * preprocessor-gated. + */ +#if defined(WOLF_C89) || defined(WOLF_NO_TRAILING_ENUM_COMMAS) + #define _WOLF_ENUM_DUMMY_LAST_ELEMENT_HELPER2(a, b, c, d, e) \ + a ## b ## c ## d ## e + #define _WOLF_ENUM_DUMMY_LAST_ELEMENT_HELPER(a, b, c, d, e) \ + _WOLF_ENUM_DUMMY_LAST_ELEMENT_HELPER2(a, b, c, d, e) + #define WOLF_ENUM_DUMMY_LAST_ELEMENT(prefix) \ + _WOLF_ENUM_DUMMY_LAST_ELEMENT_HELPER(_wolf_, prefix, _L, __LINE__, \ + _enum_dummy_last_element) +#else + #define WOLF_ENUM_DUMMY_LAST_ELEMENT(prefix) /* null expansion */ +#endif + +/* try to set SIZEOF_LONG or SIZEOF_LONG_LONG if user didn't */ +#if defined(_WIN32) || defined(HAVE_LIMITS_H) + #include <limits.h> + /* make sure both SIZEOF_LONG_LONG and SIZEOF_LONG are set, + * otherwise causes issues with CTC_SETTINGS */ + #if !defined(SIZEOF_LONG_LONG) || !defined(SIZEOF_LONG) + #if !defined(SIZEOF_LONG) && defined(ULONG_MAX) && \ + (ULONG_MAX == 0xffffffffUL) + #define SIZEOF_LONG 4 + #endif + #if !defined(SIZEOF_LONG_LONG) && defined(ULLONG_MAX) && \ + (ULLONG_MAX == 0xffffffffffffffffULL) + #define SIZEOF_LONG_LONG 8 + #endif + #endif +#elif !defined(__BCPLUSPLUS__) && !defined(__EMSCRIPTEN__) + #if !defined(SIZEOF_LONG_LONG) && !defined(SIZEOF_LONG) + #if (defined(__alpha__) || defined(__ia64__) || \ + defined(_ARCH_PPC64) || defined(__ppc64__) || \ + defined(__x86_64__) || defined(__s390x__ ) || \ + ((defined(sun) || defined(__sun)) && \ + (defined(LP64) || defined(_LP64))) || \ + (defined(__riscv_xlen) && (__riscv_xlen == 64)) || \ + defined(__aarch64__) || defined(__mips64) || \ + (defined(__DCC__) && (defined(__LP64) || defined(__LP64__)))) + /* long should be 64bit */ + #define SIZEOF_LONG 8 + #elif defined(__i386__) || defined(__CORTEX_M3__) || defined(__ppc__) + /* long long should be 64bit */ + #define SIZEOF_LONG_LONG 8 + #endif + #endif +#endif + +#if (defined(_MSC_VER) && (_MSC_VER == 1200)) || /* MSVC6 */ \ + (defined(_MSC_VER) && !defined(WOLFSSL_NOT_WINDOWS_API)) || \ + defined(__BCPLUSPLUS__) || \ + (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) + /* windows types */ + #define WORD64_AVAILABLE + #define W64LIT(x) x##ui64 + #define SW64LIT(x) x##i64 + typedef __int64 sword64; + typedef unsigned __int64 word64; +#elif defined(__EMSCRIPTEN__) + #define WORD64_AVAILABLE + #define W64LIT(x) x##ull + #define SW64LIT(x) x##ll + typedef long long sword64; + typedef unsigned long long word64; +#elif defined(SIZEOF_LONG) && SIZEOF_LONG == 8 + #define WORD64_AVAILABLE + #ifdef WOLF_C89 + #define W64LIT(x) x##UL + #define SW64LIT(x) x##L + #else + #define W64LIT(x) x##ULL + #define SW64LIT(x) x##LL + #endif + typedef long sword64; + typedef unsigned long word64; +#elif defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG == 8 + #define WORD64_AVAILABLE + #ifdef WOLF_C89 + #define W64LIT(x) x##UL + #define SW64LIT(x) x##L + #else + #define W64LIT(x) x##ULL + #define SW64LIT(x) x##LL + #endif + typedef long long sword64; + typedef unsigned long long word64; +#elif defined(__SIZEOF_LONG_LONG__) && __SIZEOF_LONG_LONG__ == 8 + #define WORD64_AVAILABLE + #ifdef WOLF_C89 + #define W64LIT(x) x##UL + #define SW64LIT(x) x##L + #else + #define W64LIT(x) x##ULL + #define SW64LIT(x) x##LL + #endif + typedef long long sword64; + typedef unsigned long long word64; +#endif + +#if defined(WORD64_AVAILABLE) && !defined(WC_16BIT_CPU) + /* These platforms have 64-bit CPU registers. */ + #if (defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || \ + (defined(__mips64) && \ + ((defined(_ABI64) && (_MIPS_SIM == _ABI64)) || \ + (defined(_ABIO64) && (_MIPS_SIM == _ABIO64)))) || \ + defined(__x86_64__) || defined(_M_X64)) || \ + defined(__aarch64__) || defined(__sparc64__) || defined(__s390x__ ) || \ + (defined(__riscv_xlen) && (__riscv_xlen == 64)) || defined(_M_ARM64) || \ + defined(__aarch64__) || defined(__ppc64__) || \ + (defined(__DCC__) && (defined(__LP64) || defined(__LP64__))) + #define WC_64BIT_CPU + #elif (defined(sun) || defined(__sun)) && \ + (defined(LP64) || defined(_LP64)) + /* LP64 with GNU GCC compiler is reserved for when long int is 64 bits + * and int uses 32 bits. When using Solaris Studio sparc and __sparc are + * available for 32 bit detection but __sparc64__ could be missed. This + * uses LP64 for checking 64 bit CPU arch. */ + #define WC_64BIT_CPU + #else + #define WC_32BIT_CPU + #endif + + #if defined(NO_64BIT) + typedef word32 wolfssl_word; + #define WOLFSSL_WORD_SIZE_LOG2 2 + #undef WORD64_AVAILABLE + #else + #ifdef WC_64BIT_CPU + typedef word64 wolfssl_word; + #define WOLFSSL_WORD_SIZE_LOG2 3 + #else + typedef word32 wolfssl_word; + #define WOLFSSL_WORD_SIZE_LOG2 2 + #ifdef WORD64_AVAILABLE + #define WOLFCRYPT_SLOW_WORD64 + #endif + #endif + #endif + +#elif defined(WC_16BIT_CPU) + #ifndef MICROCHIP_PIC24 + #undef WORD64_AVAILABLE + #endif + typedef word16 wolfssl_word; + #define WOLFSSL_WORD_SIZE_LOG2 1 + #define MP_16BIT /* for mp_int, mp_word needs to be twice as big as \ + * mp_digit, no 64 bit type so make mp_digit 16 bit */ + +#else + #undef WORD64_AVAILABLE + typedef word32 wolfssl_word; + #define WOLFSSL_WORD_SIZE_LOG2 2 + #define MP_16BIT /* for mp_int, mp_word needs to be twice as big as \ + * mp_digit, no 64 bit type so make mp_digit 16 bit */ +#endif + +typedef struct w64wrapper { +#if defined(WORD64_AVAILABLE) && !defined(WOLFSSL_W64_WRAPPER_TEST) + word64 n; +#else + word32 n[2]; +#endif /* WORD64_AVAILABLE && WOLFSSL_W64_WRAPPER_TEST */ +} w64wrapper; + +#ifdef WC_PTR_TYPE /* Allow user supplied type */ + typedef WC_PTR_TYPE wc_ptr_t; +#elif defined(HAVE_UINTPTR_T) + #include <stdint.h> + typedef uintptr_t wc_ptr_t; +#else /* fallback to architecture size_t for pointer size */ + #include <stddef.h> /* included for getting size_t type */ + typedef size_t wc_ptr_t; +#endif + +enum { + WOLFSSL_WORD_SIZE = sizeof(wolfssl_word), + WOLFSSL_BIT_SIZE = 8, + WOLFSSL_WORD_BITS = WOLFSSL_WORD_SIZE * WOLFSSL_BIT_SIZE +}; + +#define WOLFSSL_MAX_8BIT 0xffU +#define WOLFSSL_MAX_16BIT 0xffffU +#define WOLFSSL_MAX_32BIT 0xffffffffU + +#ifndef WC_DO_NOTHING + #define WC_DO_NOTHING do {} while (0) + #ifdef _MSC_VER + /* disable buggy MSC warning around while(0), + *"warning C4127: conditional expression is constant" + */ + #pragma warning(disable: 4127) + #endif +#endif + +#if defined(HAVE_FIPS) || defined(HAVE_SELFTEST) + #define INLINE WC_INLINE +#endif + +/* set up rotate style */ +#if ((defined(_MSC_VER) && !defined(WOLFSSL_NOT_WINDOWS_API)) || \ + defined(__BCPLUSPLUS__)) && !defined(WOLFSSL_SGX) && \ + !defined(INTIME_RTOS) + #define INTEL_INTRINSICS + #define FAST_ROTATE +#elif defined(__MWERKS__) && TARGET_CPU_PPC + #define PPC_INTRINSICS + #define FAST_ROTATE +#elif defined(__CCRX__) + #define FAST_ROTATE +#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) + /* GCC does peephole optimizations which should result in using rotate + instructions */ + #define FAST_ROTATE +#endif + +/* set up thread local storage if available */ +#ifdef HAVE_THREAD_LS + #if defined(_MSC_VER) || defined(__WATCOMC__) + #define THREAD_LS_T __declspec(thread) + /* Thread local storage only in FreeRTOS v8.2.1 and higher */ + #elif defined(FREERTOS) || defined(FREERTOS_TCP) || \ + defined(WOLFSSL_ZEPHYR) + #define THREAD_LS_T + #else + #define THREAD_LS_T __thread + #endif +#else + #define THREAD_LS_T +#endif + +#ifndef FALL_THROUGH + /* GCC 7 has new switch() fall-through detection */ + #if defined(__GNUC__) + #if defined(fallthrough) + #define FALL_THROUGH fallthrough + #elif ((__GNUC__ > 7) || ((__GNUC__ == 7) && (__GNUC_MINOR__ >= 1))) + #define FALL_THROUGH ; __attribute__ ((fallthrough)) + #elif defined(__clang__) && defined(__clang_major__) && \ + (__clang_major__ >= 12) + #define FALL_THROUGH ; __attribute__ ((fallthrough)) + #endif + #endif +#endif /* FALL_THROUGH */ +#if !defined(FALL_THROUGH) || defined(__XC32) + /* use stub for fall through by default or for Microchip compiler */ + #undef FALL_THROUGH + #define FALL_THROUGH +#endif + +#define XSTR_SIZEOF(x) (sizeof(x) - 1) /* -1 to not count the null char */ + +#define XELEM_CNT(x) (sizeof((x))/sizeof(*(x))) + +#define WC_SAFE_SUM_WORD32(in1, in2, out) ((in2) <= 0xffffffffU - (in1) ? \ + ((out) = (in1) + (in2), 1) : ((out) = 0xffffffffU, 0)) + +#if defined(HAVE_IO_POOL) + WOLFSSL_API void* XMALLOC(size_t n, void* heap, int type); + WOLFSSL_API void* XREALLOC(void *p, size_t n, void* heap, int type); + WOLFSSL_API void XFREE(void *p, void* heap, int type); +#elif (defined(WOLFSSL_ASYNC_CRYPT) && defined(HAVE_INTEL_QA)) || \ + defined(HAVE_INTEL_QA_SYNC) + #ifndef HAVE_INTEL_QA_SYNC + #include <wolfssl/wolfcrypt/port/intel/quickassist_mem.h> + #undef USE_WOLFSSL_MEMORY + #ifdef WOLFSSL_DEBUG_MEMORY + #define XMALLOC(s, h, t) \ + IntelQaMalloc((s), (h), (t), __func__, __LINE__) + #define XFREE(p, h, t) \ + IntelQaFree((p), (h), (t), __func__, __LINE__) + #define XREALLOC(p, n, h, t) \ + IntelQaRealloc((p), (n), (h), (t), __func__, __LINE__) + #else + #define XMALLOC(s, h, t) IntelQaMalloc((s), (h), (t)) + #define XFREE(p, h, t) IntelQaFree((p), (h), (t)) + #define XREALLOC(p, n, h, t) IntelQaRealloc((p), (n), (h), (t)) + #endif /* WOLFSSL_DEBUG_MEMORY */ + #else + #include <wolfssl/wolfcrypt/port/intel/quickassist_sync.h> + #undef USE_WOLFSSL_MEMORY + #ifdef WOLFSSL_DEBUG_MEMORY + #define XMALLOC(s, h, t) \ + wc_CryptoCb_IntelQaMalloc((s), (h), (t), __func__, __LINE__) + #define XFREE(p, h, t) \ + wc_CryptoCb_IntelQaFree((p), (h), (t), __func__, __LINE__) + #define XREALLOC(p, n, h, t) \ + wc_CryptoCb_IntelQaRealloc((p), (n), (h), (t), __func__, \ + __LINE__) + #else + #define XMALLOC(s, h, t) \ + wc_CryptoCb_IntelQaMalloc((s), (h), (t)) + #define XFREE(p, h, t) \ + wc_CryptoCb_IntelQaFree((p), (h), (t)) + #define XREALLOC(p, n, h, t) \ + wc_CryptoCb_IntelQaRealloc((p), (n), (h), (t)) + #endif /* WOLFSSL_DEBUG_MEMORY */ + #endif +#elif defined(XMALLOC_USER) + /* prototypes for user heap override functions */ + #include <stddef.h> /* for size_t */ + extern void *XMALLOC(size_t n, void* heap, int type); + extern void *XREALLOC(void *p, size_t n, void* heap, int type); + extern void XFREE(void *p, void* heap, int type); +#elif defined(WOLFSSL_MEMORY_LOG) + #define XMALLOC(n, h, t) xmalloc(n, h, t, __func__, __FILE__, __LINE__) + #define XREALLOC(p, n, h, t) \ + xrealloc(p, n, h, t, __func__, __FILE__, __LINE__) + #define XFREE(p, h, t) xfree(p, h, t, __func__, __FILE__, __LINE__) + + /* prototypes for user heap override functions */ + #include <stddef.h> /* for size_t */ + #include <stdlib.h> + WOLFSSL_API void *xmalloc(size_t n, void* heap, int type, + const char* func, const char* file, unsigned int line); + WOLFSSL_API void *xrealloc(void *p, size_t n, void* heap, int type, + const char* func, const char* file, unsigned int line); + WOLFSSL_API void xfree(void *p, void* heap, int type, const char* func, + const char* file, unsigned int line); +#elif defined(XMALLOC_OVERRIDE) + /* override the XMALLOC, XFREE and XREALLOC macros */ +#elif defined(WOLFSSL_TELIT_M2MB) + /* Telit M2MB SDK requires use m2mb_os API's, not std malloc/free */ + /* Use of malloc/free will cause CPU reboot */ + #define XMALLOC(s, h, t) ((void)(h), (void)(t), \ + m2mb_os_malloc((s))) + #ifdef WOLFSSL_XFREE_NO_NULLNESS_CHECK + #define XFREE(p, h, t) m2mb_os_free(xp) + #else + #define XFREE(p, h, t) do { void* xp = (p); if (xp) \ + m2mb_os_free(xp); } while (0) + #endif + #define XREALLOC(p, n, h, t) m2mb_os_realloc((p), (n)) + +#elif defined(NO_WOLFSSL_MEMORY) + #ifdef WOLFSSL_NO_MALLOC + /* this platform does not support heap use */ + #ifdef WOLFSSL_SMALL_STACK + #error WOLFSSL_SMALL_STACK requires a heap implementation. + #endif + #ifndef WC_NO_CONSTRUCTORS + #define WC_NO_CONSTRUCTORS + #endif + #ifdef WOLFSSL_MALLOC_CHECK + #ifndef NO_STDIO_FILESYSTEM + #include <stdio.h> + #endif + static inline void* malloc_check(size_t sz) { + fprintf(stderr, "wolfSSL_malloc failed"); + return NULL; + }; + #define XMALLOC(s, h, t) ((void)(h), (void)(t), malloc_check((s))) + #define XFREE(p, h, t) do { (void)(h); (void)(t); } while (0) + #define XREALLOC(p, n, h, t) ((void)(h), (void)(t), NULL) + #else + #define XMALLOC(s, h, t) ((void)(s), (void)(h), (void)(t), NULL) + #define XFREE(p, h, t) do { (void)(p); (void)(h); (void)(t); } while(0) + #define XREALLOC(p, n, h, t) ((void)(p), (void)(n), (void)(h), (void)(t), NULL) + #endif + #else + /* just use plain C stdlib stuff if desired */ + #include <stdlib.h> + #define XMALLOC(s, h, t) ((void)(h), (void)(t), malloc((size_t)(s))) /* native heap */ + #ifdef WOLFSSL_XFREE_NO_NULLNESS_CHECK + #define XFREE(p, h, t) do { (void)(h); (void)(t); free(p); } while (0) /* native heap */ + #else + #define XFREE(p, h, t) do { void* xp = (p); (void)(h); if (xp) free(xp); } while (0) /* native heap */ + #endif + #define XREALLOC(p, n, h, t) \ + ((void)(h), (void)(t), realloc((p), (size_t)(n))) /* native heap */ + #endif + +#elif defined(WOLFSSL_LINUXKM) + + /* definitions are in linuxkm/linuxkm_wc_port.h */ + +#elif !defined(MICRIUM_MALLOC) && !defined(EBSNET) \ + && !defined(WOLFSSL_SAFERTOS) && !defined(FREESCALE_MQX) \ + && !defined(FREESCALE_KSDK_MQX) && !defined(FREESCALE_FREE_RTOS) \ + && !defined(WOLFSSL_LEANPSK) && !defined(WOLFSSL_uITRON4) + /* default C runtime, can install different routines at runtime via cbs */ + #ifndef WOLFSSL_MEMORY_H + #include <wolfssl/wolfcrypt/memory.h> + #endif + #ifdef WOLFSSL_STATIC_MEMORY + #ifdef WOLFSSL_DEBUG_MEMORY + #define XMALLOC(s, h, t) \ + wolfSSL_Malloc((s), (h), (t), __func__, __LINE__) + #ifdef WOLFSSL_XFREE_NO_NULLNESS_CHECK + #define XFREE(p, h, t) \ + wolfSSL_Free(xp, h, t, __func__, __LINE__) + #else + #define XFREE(p, h, t) do { void* xp = (p); if (xp) \ + wolfSSL_Free(xp, h, t, __func__, __LINE__); } while (0) + #endif + #define XREALLOC(p, n, h, t) \ + wolfSSL_Realloc((p), (n), (h), (t), __func__, __LINE__) + #else + #define XMALLOC(s, h, t) wolfSSL_Malloc((s), (h), (t)) + #ifdef WOLFSSL_XFREE_NO_NULLNESS_CHECK + #define XFREE(p, h, t) wolfSSL_Free(xp, h, t) + #else + #define XFREE(p, h, t) do { void* xp = (p); if (xp) \ + wolfSSL_Free(xp, h, t); } while (0) + #endif + #define XREALLOC(p, n, h, t) wolfSSL_Realloc((p), (n), (h), (t)) + #endif /* WOLFSSL_DEBUG_MEMORY */ + #elif defined(WOLFSSL_EMBOS) && !defined(XMALLOC_USER) \ + && !defined(NO_WOLFSSL_MEMORY) \ + && !defined(WOLFSSL_STATIC_MEMORY) + /* settings.h solve this case already. Avoid redefinition. */ + #elif (!defined(FREERTOS) && !defined(FREERTOS_TCP)) || \ + defined(WOLFSSL_TRACK_MEMORY) + #ifdef WOLFSSL_DEBUG_MEMORY + #define XMALLOC(s, h, t) ((void)(h), (void)(t), \ + wolfSSL_Malloc((s), __func__, __LINE__)) + #ifdef WOLFSSL_XFREE_NO_NULLNESS_CHECK + #define XFREE(p, h, t) do { (void)(h); (void)(t); \ + wolfSSL_Free(xp, __func__, __LINE__); } while (0) + #else + #define XFREE(p, h, t) do { void* xp = (p); (void)(h); \ + (void)(t); if (xp) wolfSSL_Free(xp, __func__, __LINE__); \ + } while (0) + #endif + #define XREALLOC(p, n, h, t) ((void)(h), (void)(t), \ + wolfSSL_Realloc((p), (n), __func__, __LINE__)) + #else + #define XMALLOC(s, h, t) ((void)(h), (void)(t), \ + wolfSSL_Malloc((s))) + #ifdef WOLFSSL_XFREE_NO_NULLNESS_CHECK + #define XFREE(p, h, t) do { (void)(h); (void)(t); \ + wolfSSL_Free(p); } while (0) + #else + #define XFREE(p, h, t) do { void* xp = (p); (void)(h); \ + (void)(t); if (xp) wolfSSL_Free(xp); } while (0) + #endif + #define XREALLOC(p, n, h, t) ((void)(h), (void)(t), \ + wolfSSL_Realloc((p), (n))) + #endif /* WOLFSSL_DEBUG_MEMORY */ + #endif /* WOLFSSL_STATIC_MEMORY */ +#endif + +#if defined(WOLFSSL_SMALL_STACK) && defined(WC_NO_CONSTRUCTORS) + #error WOLFSSL_SMALL_STACK requires constructors. +#endif + +#include <wolfssl/wolfcrypt/memory.h> + +/* declare/free variable handling for async and smallstack */ +#ifndef WC_ALLOC_DO_ON_FAILURE + #define WC_ALLOC_DO_ON_FAILURE() WC_DO_NOTHING +#endif + +#define WC_DECLARE_HEAP_ARRAY(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE, HEAP) \ + VAR_TYPE* VAR_NAME[VAR_ITEMS] = { NULL, }; \ + int idx##VAR_NAME = 0, inner_idx_##VAR_NAME +#define WC_HEAP_ARRAY_ARG(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE) \ + VAR_TYPE* VAR_NAME[VAR_ITEMS] +#define WC_ALLOC_HEAP_ARRAY(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE, HEAP) \ + for (idx##VAR_NAME=0; idx##VAR_NAME<(VAR_ITEMS); idx##VAR_NAME++) { \ + (VAR_NAME)[idx##VAR_NAME] = (VAR_TYPE*)XMALLOC(VAR_SIZE, (HEAP), \ + DYNAMIC_TYPE_TMP_BUFFER); \ + if ((VAR_NAME)[idx##VAR_NAME] == NULL) { \ + for (inner_idx_##VAR_NAME = 0; \ + inner_idx_##VAR_NAME < idx##VAR_NAME; \ + inner_idx_##VAR_NAME++) { \ + XFREE((VAR_NAME)[inner_idx_##VAR_NAME], (HEAP), \ + DYNAMIC_TYPE_TMP_BUFFER); \ + (VAR_NAME)[inner_idx_##VAR_NAME] = NULL; \ + } \ + for (inner_idx_##VAR_NAME = idx##VAR_NAME + 1; \ + inner_idx_##VAR_NAME < (VAR_ITEMS); \ + inner_idx_##VAR_NAME++) { \ + (VAR_NAME)[inner_idx_##VAR_NAME] = NULL; \ + } \ + idx##VAR_NAME = 0; \ + WC_ALLOC_DO_ON_FAILURE(); \ + break; \ + } \ + } +#define WC_CALLOC_HEAP_ARRAY(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE, HEAP) \ + do { \ + WC_ALLOC_HEAP_ARRAY(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE, HEAP); \ + if (idx##VAR_NAME != 0) { \ + for (idx##VAR_NAME=0; \ + idx##VAR_NAME<(VAR_ITEMS); \ + idx##VAR_NAME++) { \ + XMEMSET((VAR_NAME)[idx##VAR_NAME], 0, VAR_SIZE); \ + } \ + } \ + } while (0) +#define WC_HEAP_ARRAY_OK(VAR_NAME) (idx##VAR_NAME != 0) +#define WC_FREE_HEAP_ARRAY(VAR_NAME, VAR_ITEMS, HEAP) \ + if (WC_HEAP_ARRAY_OK(VAR_NAME)) { \ + for (idx##VAR_NAME=0; idx##VAR_NAME<(VAR_ITEMS); idx##VAR_NAME++) { \ + XFREE((VAR_NAME)[idx##VAR_NAME], (HEAP), DYNAMIC_TYPE_TMP_BUFFER); \ + } \ + idx##VAR_NAME = 0; \ + } + +#if defined(WOLFSSL_ASYNC_CRYPT) || defined(WOLFSSL_SMALL_STACK) + #define WC_DECLARE_VAR_IS_HEAP_ALLOC + #define WC_DECLARE_VAR(VAR_NAME, VAR_TYPE, VAR_SIZE, HEAP) \ + VAR_TYPE* VAR_NAME = NULL + #define WC_ALLOC_VAR(VAR_NAME, VAR_TYPE, VAR_SIZE, HEAP) \ + do { \ + (VAR_NAME) = (VAR_TYPE*)XMALLOC(sizeof(VAR_TYPE) * (VAR_SIZE), \ + (HEAP), DYNAMIC_TYPE_WOLF_BIGINT); \ + if ((VAR_NAME) == NULL) { \ + WC_ALLOC_DO_ON_FAILURE(); \ + } \ + } while (0) + #define WC_CALLOC_VAR(VAR_NAME, VAR_TYPE, VAR_SIZE, HEAP) \ + do { \ + WC_ALLOC_VAR(VAR_NAME, VAR_TYPE, VAR_SIZE, HEAP); \ + XMEMSET(VAR_NAME, 0, sizeof(VAR_TYPE) * (VAR_SIZE)); \ + } while (0) + #define WC_FREE_VAR(VAR_NAME, HEAP) \ + XFREE(VAR_NAME, (HEAP), DYNAMIC_TYPE_WOLF_BIGINT) + #define WC_DECLARE_ARRAY(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE, HEAP) \ + WC_DECLARE_HEAP_ARRAY(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE, HEAP) + #define WC_ARRAY_ARG(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE) \ + WC_HEAP_ARRAY_ARG(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE) + #define WC_ALLOC_ARRAY(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE, HEAP) \ + WC_ALLOC_HEAP_ARRAY(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE, HEAP) + #define WC_CALLOC_ARRAY(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE, HEAP) \ + WC_CALLOC_HEAP_ARRAY(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE, HEAP) + #define WC_ARRAY_OK(VAR_NAME) WC_HEAP_ARRAY_OK(VAR_NAME) + #define WC_FREE_ARRAY(VAR_NAME, VAR_ITEMS, HEAP) \ + WC_FREE_HEAP_ARRAY(VAR_NAME, VAR_ITEMS, HEAP) +#else + #undef WC_DECLARE_VAR_IS_HEAP_ALLOC + #define WC_DECLARE_VAR(VAR_NAME, VAR_TYPE, VAR_SIZE, HEAP) \ + VAR_TYPE VAR_NAME[VAR_SIZE] + #define WC_ALLOC_VAR(VAR_NAME, VAR_TYPE, VAR_SIZE, HEAP) WC_DO_NOTHING + #define WC_CALLOC_VAR(VAR_NAME, VAR_TYPE, VAR_SIZE, HEAP) \ + XMEMSET(VAR_NAME, 0, sizeof(var)) + #define WC_FREE_VAR(VAR_NAME, HEAP) WC_DO_NOTHING \ + /* nothing to free, its stack */ + #define WC_DECLARE_ARRAY(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE, HEAP) \ + VAR_TYPE VAR_NAME[VAR_ITEMS][(VAR_SIZE) / sizeof(VAR_TYPE)] /* // NOLINT(bugprone-sizeof-expression) */ + #define WC_ARRAY_ARG(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE) \ + VAR_TYPE VAR_NAME[VAR_ITEMS][(VAR_SIZE) / sizeof(VAR_TYPE)] /* // NOLINT(bugprone-sizeof-expression) */ + #define WC_ALLOC_ARRAY(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE, HEAP) \ + WC_DO_NOTHING + #define WC_CALLOC_ARRAY(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE, HEAP) \ + XMEMSET(VAR_NAME, 0, sizeof(VAR_NAME)) + #define WC_ARRAY_OK(VAR_NAME) 1 + #define WC_FREE_ARRAY(VAR_NAME, VAR_ITEMS, HEAP) WC_DO_NOTHING \ + /* nothing to free, its stack */ +#endif + +#if defined(HAVE_FIPS) || defined(HAVE_SELFTEST) + /* These are here for the FIPS code that can't be changed. + * New definitions don't need to be added here. */ + #define DECLARE_VAR WC_DECLARE_VAR + #define DECLARE_ARRAY WC_DECLARE_ARRAY + #define FREE_VAR WC_FREE_VAR + #define FREE_ARRAY WC_FREE_ARRAY + #define DECLARE_ARRAY_DYNAMIC_DEC WC_DECLARE_HEAP_ARRAY + #define DECLARE_ARRAY_DYNAMIC_EXE WC_ALLOC_HEAP_ARRAY + #define FREE_ARRAY_DYNAMIC WC_FREE_HEAP_ARRAY +#endif /* HAVE_FIPS */ + +#if !defined(USE_WOLF_STRTOK) && \ + ((defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)) || \ + defined(WOLFSSL_TIRTOS) || defined(WOLF_C99)) + #define USE_WOLF_STRTOK +#endif +#if !defined(USE_WOLF_STRSEP) && (defined(WOLF_C89) || defined(WOLF_C99)) + #define USE_WOLF_STRSEP +#endif +#if !defined(XSTRLCPY) && !defined(USE_WOLF_STRLCPY) + #define USE_WOLF_STRLCPY +#endif +#if !defined(XSTRLCAT) && !defined(USE_WOLF_STRLCAT) + #define USE_WOLF_STRLCAT +#endif + +#ifndef STRING_USER + #if defined(WOLFSSL_LINUXKM) + #include <linux/string.h> + #else + #include <string.h> + #endif + + #define XMEMCPY(d,s,l) memcpy((d),(s),(l)) + #define XMEMSET(b,c,l) memset((b),(c),(l)) + #define XMEMCMP(s1,s2,n) memcmp((s1),(s2),(n)) + #define XMEMMOVE(d,s,l) memmove((d),(s),(l)) + + #define XSTRLEN(s1) strlen((s1)) + #define XSTRNCPY(s1,s2,n) strncpy((s1),(s2),(n)) + /* strstr, strncmp, strcmp, and strncat only used by wolfSSL proper, + * not required for wolfCrypt only */ + #define XSTRSTR(s1,s2) strstr((s1),(s2)) + #define XSTRNSTR(s1,s2,n) mystrnstr((s1),(s2),(n)) + #define XSTRNCMP(s1,s2,n) strncmp((s1),(s2),(n)) + #define XSTRCMP(s1,s2) strcmp((s1),(s2)) + #define XSTRNCAT(s1,s2,n) strncat((s1),(s2),(n)) + + #ifdef USE_WOLF_STRSEP + #define XSTRSEP(s1,d) wc_strsep((s1),(d)) + #else + #define XSTRSEP(s1,d) strsep((s1),(d)) + #endif + + #ifndef XSTRCASECMP + #if (defined(MICROCHIP_MPLAB_HARMONY) || defined(MICROCHIP_PIC32)) && \ + (__XC32_VERSION >= 1000) && (__XC32_VERSION < 4000) + /* XC32 supports str[n]casecmp in version >= 1.0 through 4.0. */ + #define XSTRCASECMP(s1,s2) strcasecmp((s1),(s2)) + #elif defined(MICROCHIP_MPLAB_HARMONY) || defined(MICROCHIP_PIC32) || \ + defined(WOLFSSL_TIRTOS) || defined(WOLFSSL_ZEPHYR) || \ + defined(MICROCHIP_PIC24) + /* XC32 version < 1.0 does not support strcasecmp. */ + #define USE_WOLF_STRCASECMP + #elif defined(USE_WINDOWS_API) || defined(FREERTOS_TCP_WINSIM) + #define XSTRCASECMP(s1,s2) _stricmp((s1),(s2)) + #else + #if defined(HAVE_STRINGS_H) && defined(WOLF_C99) && \ + !defined(WOLFSSL_SGX) + #include <strings.h> + #endif + #if defined(WOLFSSL_DEOS) + #define XSTRCASECMP(s1,s2) stricmp((s1),(s2)) + #elif defined(WOLFSSL_CMSIS_RTOSv2) || defined(WOLFSSL_AZSPHERE) \ + || defined(WOLF_C89) + #define USE_WOLF_STRCASECMP + #elif defined(WOLF_C89) + #define XSTRCASECMP(s1,s2) strcmp((s1),(s2)) + #else + #define XSTRCASECMP(s1,s2) strcasecmp((s1),(s2)) + #endif + #endif + #ifdef USE_WOLF_STRCASECMP + #undef XSTRCASECMP + #define XSTRCASECMP(s1,s2) wc_strcasecmp((s1), (s2)) + #endif + #endif /* !XSTRCASECMP */ + + #ifndef XSTRNCASECMP + #if (defined(MICROCHIP_MPLAB_HARMONY) || defined(MICROCHIP_PIC32)) && \ + (__XC32_VERSION >= 1000) + /* XC32 supports str[n]casecmp in version >= 1.0. */ + #define XSTRNCASECMP(s1,s2,n) strncasecmp((s1),(s2),(n)) + #elif defined(MICROCHIP_MPLAB_HARMONY) || defined(MICROCHIP_PIC32) || \ + defined(WOLFSSL_TIRTOS) || defined(WOLFSSL_ZEPHYR) || \ + defined(MICROCHIP_PIC24) + /* XC32 version < 1.0 does not support strncasecmp. */ + #define USE_WOLF_STRNCASECMP + #elif defined(USE_WINDOWS_API) || defined(FREERTOS_TCP_WINSIM) + #define XSTRNCASECMP(s1,s2,n) _strnicmp((s1),(s2),(n)) + #else + #if defined(HAVE_STRINGS_H) && defined(WOLF_C99) && \ + !defined(WOLFSSL_SGX) + #include <strings.h> + #endif + #if defined(WOLFSSL_DEOS) + #define XSTRNCASECMP(s1,s2,n) strnicmp((s1),(s2),(n)) + #elif defined(WOLFSSL_CMSIS_RTOSv2) || defined(WOLFSSL_AZSPHERE) \ + || defined(WOLF_C89) + #define USE_WOLF_STRNCASECMP + #elif defined(WOLF_C89) + #define XSTRNCASECMP(s1,s2,n) strncmp((s1),(s2),(n)) + #else + #define XSTRNCASECMP(s1,s2,n) strncasecmp((s1),(s2),(n)) + #endif + #endif + #ifdef USE_WOLF_STRNCASECMP + #undef XSTRNCASECMP + #define XSTRNCASECMP(s1,s2,n) wc_strncasecmp((s1),(s2),(n)) + #endif + #endif /* !XSTRNCASECMP */ + + /* snprintf is used in asn.c for GetTimeString, PKCS7 test, and when + * debugging is turned on */ + #ifndef XSNPRINTF + #ifndef USE_WINDOWS_API + #if defined(WOLFSSL_ESPIDF) && \ + (!defined(NO_ASN_TIME) && defined(HAVE_PKCS7)) + #include <stdarg.h> + /* later gcc than 7.1 introduces -Wformat-truncation */ + /* In cases when truncation is expected the caller needs*/ + /* to check the return value from the function so that */ + /* compiler doesn't complain. */ + /* xtensa-esp32-elf v8.2.0 warns truncation at */ + /* GetAsnTimeString() */ + static WC_INLINE + int _xsnprintf_(char *s, size_t n, const char *format, ...) + { + va_list ap; + int ret; + + if ((int)n <= 0) return -1; + + va_start(ap, format); + + ret = XVSNPRINTF(s, n, format, ap); + if (ret < 0) + ret = -1; + + va_end(ap); + + return ret; + } + #define XSNPRINTF _xsnprintf_ + #elif defined(FREESCALE_MQX) + /* see wc_port.h for fio.h and nio.h includes. MQX does not + have stdio.h available, so it needs its own section. */ + #define XSNPRINTF snprintf + #elif defined(WOLF_C89) + #ifndef NO_STDIO_FILESYSTEM + #include <stdio.h> + #endif + #define XSPRINTF sprintf + /* snprintf not available for C89, so remap using macro */ + #ifdef WOLF_NO_VARIADIC_MACROS + #error WOLF_NO_VARIADIC_MACROS requires user-supplied \ +binding for XSNPRINTF + #else + #define XSNPRINTF(f, len, ...) sprintf(f, __VA_ARGS__) + #endif + #else + #ifndef NO_STDIO_FILESYSTEM + #include <stdio.h> + #endif + #define XSNPRINTF snprintf + #endif + #else + #if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) + #if defined(_MSC_VER) && (_MSC_VER >= 1900) + /* Beginning with the UCRT in Visual Studio 2015 and + * Windows 10, snprintf is no longer identical to + * _snprintf. The snprintf function behavior is now + * C99 standard compliant. */ + #include <stdio.h> + #define XSNPRINTF snprintf + #else + /* 4996 warning to use MS extensions e.g., _sprintf_s + * instead of _snprintf */ + #if !defined(__MINGW32__) + #pragma warning(disable: 4996) + #endif + #include <stdarg.h> + static WC_INLINE + int xsnprintf(char *buffer, size_t bufsize, + const char *format, ...) { + va_list ap; + int ret; + + if ((int)bufsize <= 0) return -1; + va_start(ap, format); + ret = XVSNPRINTF(buffer, bufsize, format, ap); + if (ret >= (int)bufsize) + ret = -1; + va_end(ap); + return ret; + } + #define XSNPRINTF xsnprintf + #endif /* (_MSC_VER >= 1900) */ + #else + #define XSNPRINTF snprintf + #endif /* _MSC_VER */ + #endif /* USE_WINDOWS_API */ + #endif /* !XSNPRINTF */ + + #if defined(WOLFSSL_CERT_EXT) || defined(OPENSSL_EXTRA) || \ + defined(HAVE_ALPN) || defined(WOLFSSL_SNIFFER) || \ + defined(WOLFSSL_ASN_PARSE_KEYUSAGE) + /* use only Thread Safe version of strtok */ + #if defined(USE_WOLF_STRTOK) + #define XSTRTOK(s1,d,ptr) wc_strtok((s1),(d),(ptr)) + #elif defined(__WATCOMC__) + #if __WATCOMC__ < 1300 + #define USE_WOLF_STRTOK + #define XSTRTOK(s1,d,ptr) wc_strtok((s1),(d),(ptr)) + #else + #define XSTRTOK(s1,d,ptr) strtok_r((s1),(d),(ptr)) + #endif + #elif defined(USE_WINDOWS_API) || defined(INTIME_RTOS) + #define XSTRTOK(s1,d,ptr) strtok_s((s1),(d),(ptr)) + #else + #define XSTRTOK(s1,d,ptr) strtok_r((s1),(d),(ptr)) + #endif + #endif + + #if defined(WOLFSSL_CERT_EXT) || defined(HAVE_OCSP) || \ + defined(HAVE_CRL_IO) || defined(HAVE_HTTP_CLIENT) || \ + !defined(NO_CRYPT_BENCHMARK) || defined(OPENSSL_EXTRA) + + #ifndef XATOI /* if custom XATOI is not already defined */ + #include <stdlib.h> + #define XATOI(s) atoi((s)) + #endif + #endif +#endif /* STRING_USER */ + +#ifdef USE_WOLF_STRTOK + WOLFSSL_API char* wc_strtok(char *str, const char *delim, char **nextp); +#endif +#ifdef USE_WOLF_STRSEP + WOLFSSL_API char* wc_strsep(char **stringp, const char *delim); +#endif + +#ifdef USE_WOLF_STRLCPY + WOLFSSL_API size_t wc_strlcpy(char *dst, const char *src, size_t dstSize); + #define XSTRLCPY(s1,s2,n) wc_strlcpy((s1),(s2),(n)) +#endif +#ifdef USE_WOLF_STRLCAT + WOLFSSL_API size_t wc_strlcat(char *dst, const char *src, size_t dstSize); + #define XSTRLCAT(s1,s2,n) wc_strlcat((s1),(s2),(n)) +#endif +#ifdef USE_WOLF_STRCASECMP + WOLFSSL_API int wc_strcasecmp(const char *s1, const char *s2); +#endif +#ifdef USE_WOLF_STRNCASECMP + WOLFSSL_API int wc_strncasecmp(const char *s1, const char *s2, size_t n); +#endif + +#if !defined(XSTRDUP) && !defined(USE_WOLF_STRDUP) + #define USE_WOLF_STRDUP +#endif +#ifdef USE_WOLF_STRDUP + WOLFSSL_LOCAL char* wc_strdup_ex(const char *src, int memType); + #define wc_strdup(src) wc_strdup_ex(src, DYNAMIC_TYPE_TMP_BUFFER) + #define XSTRDUP(src) wc_strdup(src) +#endif + +#if !defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM) + #ifndef XGETENV + #ifdef NO_GETENV + #define XGETENV(x) (NULL) + #else + #include <stdlib.h> + #define XGETENV getenv + #endif + #endif +#endif /* !NO_FILESYSTEM && !NO_STDIO_FILESYSTEM */ + +#ifndef CTYPE_USER + #ifndef WOLFSSL_LINUXKM + #include <ctype.h> + #endif + #if defined(HAVE_ECC) || defined(HAVE_OCSP) || \ + defined(WOLFSSL_KEY_GEN) || !defined(NO_DSA) || \ + defined(OPENSSL_EXTRA) + #define XTOUPPER(c) toupper((c)) + #endif + #if defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) + #define XISALNUM(c) isalnum((c)) + #if !defined(HAVE_ISASCII) || defined(NO_STDLIB_ISASCII) + #define XISASCII(c) (((c) >= 0 && (c) <= 127) ? 1 : 0) + #else + #define XISASCII(c) isascii((c)) + #endif + #define XISSPACE(c) isspace((c)) + #endif + /* needed by wolfSSL_check_domain_name() */ + #define XTOLOWER(c) tolower((c)) +#endif + +#ifndef WC_OFFSETOF + #if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 4)) + #define WC_OFFSETOF(type, field) __builtin_offsetof(type, field) + #elif defined(__WATCOMC__) + #include <stddef.h> + #define WC_OFFSETOF offsetof + #else + #define WC_OFFSETOF(type, field) ((size_t)&(((type *)0)->field)) + #endif +#endif + + +/* memory allocation types for user hints */ +enum { + DYNAMIC_TYPE_CA = 1, + DYNAMIC_TYPE_CERT = 2, + DYNAMIC_TYPE_KEY = 3, + DYNAMIC_TYPE_FILE = 4, + DYNAMIC_TYPE_SUBJECT_CN = 5, + DYNAMIC_TYPE_PUBLIC_KEY = 6, + DYNAMIC_TYPE_SIGNER = 7, + DYNAMIC_TYPE_NONE = 8, + DYNAMIC_TYPE_BIGINT = 9, + DYNAMIC_TYPE_RSA = 10, + DYNAMIC_TYPE_METHOD = 11, + DYNAMIC_TYPE_OUT_BUFFER = 12, + DYNAMIC_TYPE_IN_BUFFER = 13, + DYNAMIC_TYPE_INFO = 14, + DYNAMIC_TYPE_DH = 15, + DYNAMIC_TYPE_DOMAIN = 16, + DYNAMIC_TYPE_SSL = 17, + DYNAMIC_TYPE_CTX = 18, + DYNAMIC_TYPE_WRITEV = 19, + DYNAMIC_TYPE_OPENSSL = 20, + DYNAMIC_TYPE_DSA = 21, + DYNAMIC_TYPE_CRL = 22, + DYNAMIC_TYPE_REVOKED = 23, + DYNAMIC_TYPE_CRL_ENTRY = 24, + DYNAMIC_TYPE_CERT_MANAGER = 25, + DYNAMIC_TYPE_CRL_MONITOR = 26, + DYNAMIC_TYPE_OCSP_STATUS = 27, + DYNAMIC_TYPE_OCSP_ENTRY = 28, + DYNAMIC_TYPE_ALTNAME = 29, + DYNAMIC_TYPE_SUITES = 30, + DYNAMIC_TYPE_CIPHER = 31, + DYNAMIC_TYPE_RNG = 32, + DYNAMIC_TYPE_ARRAYS = 33, + DYNAMIC_TYPE_DTLS_POOL = 34, + DYNAMIC_TYPE_SOCKADDR = 35, + DYNAMIC_TYPE_LIBZ = 36, + DYNAMIC_TYPE_ECC = 37, + DYNAMIC_TYPE_TMP_BUFFER = 38, + DYNAMIC_TYPE_DTLS_MSG = 39, + DYNAMIC_TYPE_X509 = 40, + DYNAMIC_TYPE_TLSX = 41, + DYNAMIC_TYPE_OCSP = 42, + DYNAMIC_TYPE_SIGNATURE = 43, + DYNAMIC_TYPE_HASHES = 44, + DYNAMIC_TYPE_SRP = 45, + DYNAMIC_TYPE_COOKIE_PWD = 46, + DYNAMIC_TYPE_USER_CRYPTO = 47, + DYNAMIC_TYPE_OCSP_REQUEST = 48, + DYNAMIC_TYPE_X509_EXT = 49, + DYNAMIC_TYPE_X509_STORE = 50, + DYNAMIC_TYPE_X509_CTX = 51, + DYNAMIC_TYPE_URL = 52, + DYNAMIC_TYPE_DTLS_FRAG = 53, + DYNAMIC_TYPE_DTLS_BUFFER = 54, + DYNAMIC_TYPE_SESSION_TICK = 55, + DYNAMIC_TYPE_PKCS = 56, + DYNAMIC_TYPE_MUTEX = 57, + DYNAMIC_TYPE_PKCS7 = 58, + DYNAMIC_TYPE_AES_BUFFER = 59, + DYNAMIC_TYPE_WOLF_BIGINT = 60, + DYNAMIC_TYPE_ASN1 = 61, + DYNAMIC_TYPE_LOG = 62, + DYNAMIC_TYPE_WRITEDUP = 63, + DYNAMIC_TYPE_PRIVATE_KEY = 64, + DYNAMIC_TYPE_HMAC = 65, + DYNAMIC_TYPE_ASYNC = 66, + DYNAMIC_TYPE_ASYNC_NUMA = 67, + DYNAMIC_TYPE_ASYNC_NUMA64 = 68, + DYNAMIC_TYPE_CURVE25519 = 69, + DYNAMIC_TYPE_ED25519 = 70, + DYNAMIC_TYPE_SECRET = 71, + DYNAMIC_TYPE_DIGEST = 72, + DYNAMIC_TYPE_RSA_BUFFER = 73, + DYNAMIC_TYPE_DCERT = 74, + DYNAMIC_TYPE_STRING = 75, + DYNAMIC_TYPE_PEM = 76, + DYNAMIC_TYPE_DER = 77, + DYNAMIC_TYPE_CERT_EXT = 78, + DYNAMIC_TYPE_ALPN = 79, + DYNAMIC_TYPE_ENCRYPTEDINFO= 80, + DYNAMIC_TYPE_DIRCTX = 81, + DYNAMIC_TYPE_HASHCTX = 82, + DYNAMIC_TYPE_SEED = 83, + DYNAMIC_TYPE_SYMMETRIC_KEY= 84, + DYNAMIC_TYPE_ECC_BUFFER = 85, + DYNAMIC_TYPE_SALT = 87, + DYNAMIC_TYPE_HASH_TMP = 88, + DYNAMIC_TYPE_BLOB = 89, + DYNAMIC_TYPE_NAME_ENTRY = 90, + DYNAMIC_TYPE_CURVE448 = 91, + DYNAMIC_TYPE_ED448 = 92, + DYNAMIC_TYPE_AES = 93, + DYNAMIC_TYPE_CMAC = 94, + DYNAMIC_TYPE_FALCON = 95, + DYNAMIC_TYPE_SESSION = 96, + DYNAMIC_TYPE_DILITHIUM = 97, + DYNAMIC_TYPE_SPHINCS = 98, + DYNAMIC_TYPE_SM4_BUFFER = 99, + DYNAMIC_TYPE_DEBUG_TAG = 100, + DYNAMIC_TYPE_LMS = 101, + DYNAMIC_TYPE_BIO = 102, + DYNAMIC_TYPE_X509_ACERT = 103, + DYNAMIC_TYPE_OS_BUF = 104, + DYNAMIC_TYPE_ASCON = 105, + DYNAMIC_TYPE_SNIFFER_SERVER = 1000, + DYNAMIC_TYPE_SNIFFER_SESSION = 1001, + DYNAMIC_TYPE_SNIFFER_PB = 1002, + DYNAMIC_TYPE_SNIFFER_PB_BUFFER = 1003, + DYNAMIC_TYPE_SNIFFER_TICKET_ID = 1004, + DYNAMIC_TYPE_SNIFFER_NAMED_KEY = 1005, + DYNAMIC_TYPE_SNIFFER_KEY = 1006, + DYNAMIC_TYPE_SNIFFER_KEYLOG_NODE = 1007, + DYNAMIC_TYPE_SNIFFER_CHAIN_BUFFER = 1008, + DYNAMIC_TYPE_AES_EAX = 1009 +}; + +/* max error buffer string size */ +#ifndef WOLFSSL_MAX_ERROR_SZ + #define WOLFSSL_MAX_ERROR_SZ 80 +#endif + +/* stack protection */ +enum { + MIN_STACK_BUFFER = 8 +}; + + +/* Algorithm Types */ +enum wc_AlgoType { + WC_ALGO_TYPE_NONE = 0, + WC_ALGO_TYPE_HASH = 1, + WC_ALGO_TYPE_CIPHER = 2, + WC_ALGO_TYPE_PK = 3, + WC_ALGO_TYPE_RNG = 4, + WC_ALGO_TYPE_SEED = 5, + WC_ALGO_TYPE_HMAC = 6, + WC_ALGO_TYPE_CMAC = 7, + WC_ALGO_TYPE_CERT = 8, + + WC_ALGO_TYPE_MAX = WC_ALGO_TYPE_CERT +}; + +/* hash types */ +enum wc_HashType { +#if defined(HAVE_SELFTEST) || (defined(HAVE_FIPS) && \ + ((! defined(HAVE_FIPS_VERSION)) || \ + defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION <= 2))) + /* In selftest build, WC_* types are not mapped to WC_HASH_TYPE types. + * Values here are based on old selftest hmac.h enum, with additions. + * These values are fixed for backwards FIPS compatibility */ + WC_HASH_TYPE_NONE = 15, + WC_HASH_TYPE_MD2 = 16, + WC_HASH_TYPE_MD4 = 17, + WC_HASH_TYPE_MD5 = 0, + WC_HASH_TYPE_SHA = 1, /* SHA-1 (not old SHA-0) */ + WC_HASH_TYPE_SHA224 = 8, + WC_HASH_TYPE_SHA256 = 2, + WC_HASH_TYPE_SHA384 = 5, + WC_HASH_TYPE_SHA512 = 4, + WC_HASH_TYPE_MD5_SHA = 18, + WC_HASH_TYPE_SHA3_224 = 10, + WC_HASH_TYPE_SHA3_256 = 11, + WC_HASH_TYPE_SHA3_384 = 12, + WC_HASH_TYPE_SHA3_512 = 13, + WC_HASH_TYPE_BLAKE2B = 14, + WC_HASH_TYPE_BLAKE2S = 19, + WC_HASH_TYPE_MAX = WC_HASH_TYPE_BLAKE2S, + #ifndef WOLFSSL_NOSHA512_224 + #define WOLFSSL_NOSHA512_224 + #endif + #ifndef WOLFSSL_NOSHA512_256 + #define WOLFSSL_NOSHA512_256 + #endif +#else + WC_HASH_TYPE_NONE = 0, + WC_HASH_TYPE_MD2 = 1, + WC_HASH_TYPE_MD4 = 2, + WC_HASH_TYPE_MD5 = 3, + WC_HASH_TYPE_SHA = 4, /* SHA-1 (not old SHA-0) */ + WC_HASH_TYPE_SHA224 = 5, + WC_HASH_TYPE_SHA256 = 6, + WC_HASH_TYPE_SHA384 = 7, + WC_HASH_TYPE_SHA512 = 8, + WC_HASH_TYPE_MD5_SHA = 9, + WC_HASH_TYPE_SHA3_224 = 10, + WC_HASH_TYPE_SHA3_256 = 11, + WC_HASH_TYPE_SHA3_384 = 12, + WC_HASH_TYPE_SHA3_512 = 13, + WC_HASH_TYPE_BLAKE2B = 14, + WC_HASH_TYPE_BLAKE2S = 15, + #define _WC_HASH_TYPE_MAX WC_HASH_TYPE_BLAKE2S + #ifndef WOLFSSL_NOSHA512_224 + WC_HASH_TYPE_SHA512_224 = 16, + #undef _WC_HASH_TYPE_MAX + #define _WC_HASH_TYPE_MAX WC_HASH_TYPE_SHA512_224 + #endif + #ifndef WOLFSSL_NOSHA512_256 + WC_HASH_TYPE_SHA512_256 = 17, + #undef _WC_HASH_TYPE_MAX + #define _WC_HASH_TYPE_MAX WC_HASH_TYPE_SHA512_256 + #endif + #ifdef WOLFSSL_SHAKE128 + WC_HASH_TYPE_SHAKE128 = 18, + #undef _WC_HASH_TYPE_MAX + #define _WC_HASH_TYPE_MAX WC_HASH_TYPE_SHAKE128 + #endif + #ifdef WOLFSSL_SHAKE256 + WC_HASH_TYPE_SHAKE256 = 19, + #undef _WC_HASH_TYPE_MAX + #define _WC_HASH_TYPE_MAX WC_HASH_TYPE_SHAKE256 + #endif + #ifdef WOLFSSL_SM3 + WC_HASH_TYPE_SM3 = 20, + #undef _WC_HASH_TYPE_MAX + #define _WC_HASH_TYPE_MAX WC_HASH_TYPE_SM3 + #endif + WC_HASH_TYPE_MAX = _WC_HASH_TYPE_MAX + #undef _WC_HASH_TYPE_MAX + +#endif /* HAVE_SELFTEST */ +}; + +enum wc_HashFlags { + WC_HASH_FLAG_NONE = 0x00000000, + WC_HASH_FLAG_WILLCOPY = 0x00000001, /* flag to indicate hash will be copied */ + WC_HASH_FLAG_ISCOPY = 0x00000002, /* hash is copy */ +#ifdef WOLFSSL_SHA3 + WC_HASH_SHA3_KECCAK256 =0x00010000, /* Older KECCAK256 */ +#endif + WOLF_ENUM_DUMMY_LAST_ELEMENT(WC_HASH) +}; + +/* cipher types */ +enum wc_CipherType { + WC_CIPHER_NONE = 0, + WC_CIPHER_AES = 1, + WC_CIPHER_AES_CBC = 2, + WC_CIPHER_AES_GCM = 3, + WC_CIPHER_AES_CTR = 4, + WC_CIPHER_AES_XTS = 5, + WC_CIPHER_AES_CFB = 6, + WC_CIPHER_AES_CCM = 12, + WC_CIPHER_AES_ECB = 13, + WC_CIPHER_DES3 = 7, + WC_CIPHER_DES = 8, + WC_CIPHER_CHACHA = 9, + + WC_CIPHER_MAX = WC_CIPHER_AES_CCM +}; + +/* PK=public key (asymmetric) based algorithms */ +enum wc_PkType { + WC_PK_TYPE_NONE = 0, + WC_PK_TYPE_RSA = 1, + WC_PK_TYPE_DH = 2, + WC_PK_TYPE_ECDH = 3, + WC_PK_TYPE_ECDSA_SIGN = 4, + WC_PK_TYPE_ECDSA_VERIFY = 5, + WC_PK_TYPE_ED25519_SIGN = 6, + WC_PK_TYPE_CURVE25519 = 7, + WC_PK_TYPE_RSA_KEYGEN = 8, + WC_PK_TYPE_EC_KEYGEN = 9, + WC_PK_TYPE_RSA_CHECK_PRIV_KEY = 10, + WC_PK_TYPE_EC_CHECK_PRIV_KEY = 11, + WC_PK_TYPE_ED448 = 12, + WC_PK_TYPE_CURVE448 = 13, + WC_PK_TYPE_ED25519_VERIFY = 14, + WC_PK_TYPE_ED25519_KEYGEN = 15, + WC_PK_TYPE_CURVE25519_KEYGEN = 16, + WC_PK_TYPE_RSA_GET_SIZE = 17, + #define _WC_PK_TYPE_MAX WC_PK_TYPE_RSA_GET_SIZE +#if defined(WOLFSSL_HAVE_MLKEM) + WC_PK_TYPE_PQC_KEM_KEYGEN = 18, + WC_PK_TYPE_PQC_KEM_ENCAPS = 19, + WC_PK_TYPE_PQC_KEM_DECAPS = 20, + #undef _WC_PK_TYPE_MAX + #define _WC_PK_TYPE_MAX WC_PK_TYPE_PQC_KEM_DECAPS +#endif +#if defined(HAVE_DILITHIUM) || defined(HAVE_FALCON) + WC_PK_TYPE_PQC_SIG_KEYGEN = 21, + WC_PK_TYPE_PQC_SIG_SIGN = 22, + WC_PK_TYPE_PQC_SIG_VERIFY = 23, + WC_PK_TYPE_PQC_SIG_CHECK_PRIV_KEY = 24, + #undef _WC_PK_TYPE_MAX + #define _WC_PK_TYPE_MAX WC_PK_TYPE_PQC_SIG_CHECK_PRIV_KEY +#endif + WC_PK_TYPE_RSA_PKCS = 25, + WC_PK_TYPE_RSA_PSS = 26, + WC_PK_TYPE_RSA_OAEP = 27, + WC_PK_TYPE_MAX = _WC_PK_TYPE_MAX +}; + +#if defined(WOLFSSL_HAVE_MLKEM) + /* Post quantum KEM algorithms */ + enum wc_PqcKemType { + WC_PQC_KEM_TYPE_NONE = 0, + #define _WC_PQC_KEM_TYPE_MAX WC_PQC_KEM_TYPE_NONE + #if defined(WOLFSSL_HAVE_MLKEM) + WC_PQC_KEM_TYPE_KYBER = 1, + #undef _WC_PQC_KEM_TYPE_MAX + #define _WC_PQC_KEM_TYPE_MAX WC_PQC_KEM_TYPE_KYBER + #endif + WC_PQC_KEM_TYPE_MAX = _WC_PQC_KEM_TYPE_MAX + }; +#endif + +#if defined(HAVE_DILITHIUM) || defined(HAVE_FALCON) + /* Post quantum signature algorithms */ + enum wc_PqcSignatureType { + WC_PQC_SIG_TYPE_NONE = 0, + #define _WC_PQC_SIG_TYPE_MAX WC_PQC_SIG_TYPE_NONE + #if defined(HAVE_DILITHIUM) + WC_PQC_SIG_TYPE_DILITHIUM = 1, + #undef _WC_PQC_SIG_TYPE_MAX + #define _WC_PQC_SIG_TYPE_MAX WC_PQC_SIG_TYPE_DILITHIUM + #endif + #if defined(HAVE_FALCON) + WC_PQC_SIG_TYPE_FALCON = 2, + #undef _WC_PQC_SIG_TYPE_MAX + #define _WC_PQC_SIG_TYPE_MAX WC_PQC_SIG_TYPE_FALCON + #endif + WC_PQC_SIG_TYPE_MAX = _WC_PQC_SIG_TYPE_MAX + }; +#endif + + +/* settings detection for compile vs runtime math incompatibilities */ +enum { +#if !defined(USE_FAST_MATH) && !defined(SIZEOF_LONG) && !defined(SIZEOF_LONG_LONG) + CTC_SETTINGS = 0x0 +#elif !defined(USE_FAST_MATH) && defined(SIZEOF_LONG) && (SIZEOF_LONG == 8) + CTC_SETTINGS = 0x1 +#elif !defined(USE_FAST_MATH) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 8) + CTC_SETTINGS = 0x2 +#elif !defined(USE_FAST_MATH) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 4) + CTC_SETTINGS = 0x4 +#elif defined(USE_FAST_MATH) && !defined(SIZEOF_LONG) && !defined(SIZEOF_LONG_LONG) + CTC_SETTINGS = 0x8 +#elif defined(USE_FAST_MATH) && defined(SIZEOF_LONG) && (SIZEOF_LONG == 8) + CTC_SETTINGS = 0x10 +#elif defined(USE_FAST_MATH) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 8) + CTC_SETTINGS = 0x20 +#elif defined(USE_FAST_MATH) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 4) + CTC_SETTINGS = 0x40 +#else + #error "bad math long / long long settings" +#endif +}; + + +WOLFSSL_API word32 CheckRunTimeSettings(void); + +/* If user uses RSA, DH, DSA, or ECC math lib directly then fast math and long + * types need to match at compile time and run time, CheckCtcSettings will + * return 1 if a match otherwise 0 */ +#define CheckCtcSettings() (CTC_SETTINGS == CheckRunTimeSettings()) + +/* invalid device id */ +#define INVALID_DEVID (-2) + +#if defined(HAVE_FIPS) && FIPS_VERSION_LT(5,3) + #ifdef XASM_LINK + #error User-supplied XASM_LINK is not compatible with this FIPS version. + #else + /* use version in FIPS <=5.2 aes.c */ + #endif +#elif defined(XASM_LINK) + /* keep user-supplied definition */ +#elif defined(WOLFSSL_NO_ASM) + #define XASM_LINK(f) /* null expansion */ +#elif defined(_MSC_VER) + #define XASM_LINK(f) /* null expansion */ +#elif defined(__APPLE__) + #define XASM_LINK(f) asm("_" f) +#elif defined(__GNUC__) + /* use alternate keyword for compatibility with -std=c99 */ + #define XASM_LINK(f) __asm__(f) +#else + #define XASM_LINK(f) asm(f) +#endif + +/* AESNI requires alignment and ARMASM gains some performance from it. + * Xilinx RSA operations require alignment. + */ +#if defined(WOLFSSL_AESNI) || defined(WOLFSSL_ARMASM) || \ + defined(USE_INTEL_SPEEDUP) || defined(WOLFSSL_AFALG_XILINX) || \ + defined(WOLFSSL_XILINX) + #ifndef WOLFSSL_USE_ALIGN + #define WOLFSSL_USE_ALIGN + #endif +#endif /* WOLFSSL_AESNI || WOLFSSL_ARMASM || USE_INTEL_SPEEDUP || \ + * WOLFSSL_AFALG_XILINX */ + +/* Helpers for memory alignment */ +#ifndef XALIGNED + #if defined(__GNUC__) || defined(__llvm__) || \ + defined(__IAR_SYSTEMS_ICC__) + #define XALIGNED(x) __attribute__ ( (aligned (x))) + #elif defined(__KEIL__) + #define XALIGNED(x) __align(x) + #elif defined(_MSC_VER) + /* disable align warning, we want alignment ! */ + #pragma warning(disable: 4324) + #define XALIGNED(x) __declspec (align (x)) + #else + #define XALIGNED(x) /* null expansion */ + #endif +#endif + +/* Only use alignment in wolfSSL/wolfCrypt if WOLFSSL_USE_ALIGN is set */ +#ifdef WOLFSSL_USE_ALIGN + /* For IAR ARM the maximum variable alignment on stack is 8-bytes. + * Variables declared outside stack (like static globals) can have + * higher alignment. */ + #if defined(__ICCARM__) + #define WOLFSSL_ALIGN(x) XALIGNED(8) + #else + #define WOLFSSL_ALIGN(x) XALIGNED(x) + #endif +#else + #define WOLFSSL_ALIGN(x) /* null expansion */ +#endif + +#ifndef ALIGN8 + #define ALIGN8 WOLFSSL_ALIGN(8) +#endif +#ifndef ALIGN16 + #define ALIGN16 WOLFSSL_ALIGN(16) +#endif +#ifndef ALIGN32 + #define ALIGN32 WOLFSSL_ALIGN(32) +#endif +#ifndef ALIGN64 + #define ALIGN64 WOLFSSL_ALIGN(64) +#endif +#ifndef ALIGN128 + #define ALIGN128 WOLFSSL_ALIGN(128) +#endif +#ifndef ALIGN256 + #define ALIGN256 WOLFSSL_ALIGN(256) +#endif + +#if !defined(PEDANTIC_EXTENSION) + #if defined(__GNUC__) + #define PEDANTIC_EXTENSION __extension__ + #else + #define PEDANTIC_EXTENSION + #endif +#endif /* !PEDANTIC_EXTENSION */ + + +#ifndef TRUE + #define TRUE 1 +#endif +#ifndef FALSE + #define FALSE 0 +#endif + +#ifdef SINGLE_THREADED + #if defined(WC_32BIT_CPU) || defined(HAVE_STACK_SIZE) + typedef void* THREAD_RETURN; + #else + typedef unsigned int THREAD_RETURN; + #endif + typedef void* THREAD_TYPE; + #define WOLFSSL_THREAD +#elif defined(WOLFSSL_USER_THREADING) + /* User can define user specific threading types + * THREAD_RETURN + * TREAD_TYPE + * WOLFSSL_THREAD + * e.g. + * typedef unsigned int THREAD_RETURN; + * typedef size_t THREAD_TYPE; + * #define WOLFSSL_THREAD void + * + * User can also implement their own wolfSSL_NewThread(), + * wolfSSL_JoinThread() and wolfSSL_Cond signaling if they want. + * Otherwise, those functions are omitted. + */ +#elif defined(__WATCOMC__) + #if __WATCOMC__ < 1300 + #define _WCCALLBACK + #endif + #if defined(__MACH__) + #include <dispatch/dispatch.h> + #include <pthread.h> + typedef struct COND_TYPE { + dispatch_semaphore_t cond; + } COND_TYPE; + typedef void* THREAD_RETURN; + typedef pthread_t THREAD_TYPE; + #define WOLFSSL_COND + #define WOLFSSL_THREAD + #ifndef HAVE_SELFTEST + #define WOLFSSL_THREAD_NO_JOIN + #endif + #elif defined(__NT__) + typedef unsigned THREAD_RETURN; + typedef uintptr_t THREAD_TYPE; + typedef struct COND_TYPE { + wolfSSL_Mutex mutex; + HANDLE cond; + } COND_TYPE; + #define WOLFSSL_COND + #define INVALID_THREAD_VAL ((THREAD_TYPE)(INVALID_HANDLE_VALUE)) + #define WOLFSSL_THREAD __stdcall + #define WOLFSSL_THREAD_NO_JOIN _WCCALLBACK + #elif defined(__OS2__) + #define WOLFSSL_THREAD_VOID_RETURN + typedef void THREAD_RETURN; + typedef TID THREAD_TYPE; + typedef struct COND_TYPE { + wolfSSL_Mutex mutex; + LHANDLE cond; + } COND_TYPE; + #define WOLFSSL_COND + #define INVALID_THREAD_VAL ((THREAD_TYPE)(-1)) + #define WOLFSSL_THREAD _WCCALLBACK + #define WOLFSSL_THREAD_NO_JOIN _WCCALLBACK + #elif defined(__LINUX__) + #include <pthread.h> + typedef struct COND_TYPE { + pthread_mutex_t mutex; + pthread_cond_t cond; + } COND_TYPE; + typedef void* THREAD_RETURN; + typedef pthread_t THREAD_TYPE; + #define WOLFSSL_COND + #define WOLFSSL_THREAD + #ifndef HAVE_SELFTEST + #define WOLFSSL_THREAD_NO_JOIN + #endif + #endif +#elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) || \ + defined(FREESCALE_MQX) + typedef unsigned int THREAD_RETURN; + typedef int THREAD_TYPE; + #define WOLFSSL_THREAD +#elif defined(WOLFSSL_NUCLEUS) + typedef unsigned int THREAD_RETURN; + typedef intptr_t THREAD_TYPE; + #define WOLFSSL_THREAD +#elif defined(WOLFSSL_TIRTOS) + typedef void THREAD_RETURN; + #define WOLFSSL_THREAD_VOID_RETURN + typedef Task_Handle THREAD_TYPE; + #define WOLFSSL_THREAD +#elif defined(WOLFSSL_ZEPHYR) + typedef void THREAD_RETURN; + #define WOLFSSL_THREAD_VOID_RETURN + typedef struct { + /* Zephyr k_thread can be large, > 128 bytes. */ + struct k_thread* tid; + k_thread_stack_t* threadStack; + } THREAD_TYPE; + #define WOLFSSL_THREAD + extern void* wolfsslThreadHeapHint; +#elif defined(NETOS) + typedef UINT THREAD_RETURN; + typedef struct { + TX_THREAD tid; + void* threadStack; + } THREAD_TYPE; + #define WOLFSSL_THREAD + #define INFINITE TX_WAIT_FOREVER + #define WAIT_OBJECT_0 TX_NO_WAIT +#elif defined(WOLFSSL_LINUXKM) + typedef unsigned int THREAD_RETURN; + typedef size_t THREAD_TYPE; + #define WOLFSSL_THREAD +#elif defined(WOLFSSL_PTHREADS) + #if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 \ + && !defined(__ppc__) + #include <dispatch/dispatch.h> + typedef struct COND_TYPE { + wolfSSL_Mutex mutex; + dispatch_semaphore_t cond; + } COND_TYPE; + #else + #include <pthread.h> + typedef struct COND_TYPE { + pthread_mutex_t mutex; + pthread_cond_t cond; + } COND_TYPE; + #endif + typedef void* THREAD_RETURN; + typedef pthread_t THREAD_TYPE; + #define WOLFSSL_COND + #define WOLFSSL_THREAD + #ifndef HAVE_SELFTEST + #define WOLFSSL_THREAD_NO_JOIN + #endif +#elif defined(FREERTOS) && defined(WOLFSSL_ESPIDF) + typedef void* THREAD_RETURN; + typedef pthread_t THREAD_TYPE; + #define WOLFSSL_THREAD +#elif defined(FREERTOS) + typedef unsigned int THREAD_RETURN; + typedef TaskHandle_t THREAD_TYPE; + #define WOLFSSL_THREAD +#elif defined(_WIN32_WCE) + typedef unsigned THREAD_RETURN; + typedef size_t THREAD_TYPE; + typedef struct COND_TYPE { + wolfSSL_Mutex mutex; + HANDLE cond; + } COND_TYPE; + #define WOLFSSL_COND + #define INVALID_THREAD_VAL ((THREAD_TYPE)(INVALID_HANDLE_VALUE)) + #define WOLFSSL_THREAD __stdcall + #define WOLFSSL_THREAD_NO_JOIN __cdecl +#elif defined(USE_WINDOWS_API) + typedef unsigned THREAD_RETURN; + typedef uintptr_t THREAD_TYPE; + typedef struct COND_TYPE { + wolfSSL_Mutex mutex; + HANDLE cond; + } COND_TYPE; + #define WOLFSSL_COND + #define INVALID_THREAD_VAL ((THREAD_TYPE)(INVALID_HANDLE_VALUE)) + #define WOLFSSL_THREAD __stdcall + #if !defined(__MINGW32__) + #define WOLFSSL_THREAD_NO_JOIN __cdecl + #endif +#elif defined(THREADX) + typedef unsigned int THREAD_RETURN; + typedef TX_THREAD THREAD_TYPE; + #define WOLFSSL_THREAD +#else + typedef unsigned int THREAD_RETURN; + typedef size_t THREAD_TYPE; + #define WOLFSSL_THREAD __stdcall +#endif + + +#ifndef SINGLE_THREADED + /* Necessary headers should already be included. */ + + #ifndef INVALID_THREAD_VAL + #define INVALID_THREAD_VAL ((THREAD_TYPE)(-1)) + #endif + + #ifndef WOLFSSL_THREAD_VOID_RETURN + #define WOLFSSL_RETURN_FROM_THREAD(x) return (THREAD_RETURN)(x) + #else + #define WOLFSSL_RETURN_FROM_THREAD(x) \ + do { (void)(x); return; } while(0) + #endif + + /* List of defines/types and what they mean: + * THREAD_RETURN - return type of a thread callback + * THREAD_TYPE - type that should be passed into thread handling API + * INVALID_THREAD_VAL - a value that THREAD_TYPE can be checked against + * to check if the value is an invalid thread + * WOLFSSL_THREAD - attribute that should be used to declare thread + * callbacks + * WOLFSSL_COND - defined if this system supports signaling + * COND_TYPE - type that should be passed into the signaling API + * WOLFSSL_THREAD_VOID_RETURN - defined if the thread callback has a + * void return + * WOLFSSL_RETURN_FROM_THREAD - define used to correctly return from a + * thread callback + * THREAD_CB - thread callback type for regular threading API + * + * WOLFSSL_THREAD_NO_JOIN - attribute used to declare thread callbacks + * that do not require cleanup + * THREAD_CB_NOJOIN - thread callback type for thread APIs that do not + * require cleanup + * THREAD_RETURN_NOJOIN - return type used to declare thread callbacks + * that do not require cleanup + * RETURN_FROM_THREAD_NOJOIN - define used to correctly return from + * a thread callback that do not require + * cleanup + * + * Other defines/types are specific for the threading implementation + */ + + /* Internal wolfSSL threading interface. It does NOT need to be ported + * during initial porting efforts. This is a very basic interface. Some + * areas don't use this interface on purpose as they need more control + * over threads. + * + * It is currently used for: + * - CRL monitor + * - Testing + * - Entropy generation */ + + /* We don't support returns from threads */ + typedef THREAD_RETURN (WOLFSSL_THREAD *THREAD_CB)(void* arg); + WOLFSSL_API int wolfSSL_NewThread(THREAD_TYPE* thread, + THREAD_CB cb, void* arg); + #ifdef WOLFSSL_THREAD_NO_JOIN + /* Create a thread that will be automatically cleaned up. We can't + * return a handle/pointer to the new thread because there are no + * guarantees for how long it will be valid. */ + #if defined(WOLFSSL_PTHREADS) + #define THREAD_CB_NOJOIN THREAD_CB + #define THREAD_RETURN_NOJOIN THREAD_RETURN + #define RETURN_FROM_THREAD_NOJOIN(x) \ + WOLFSSL_RETURN_FROM_THREAD(x) + #else + #define THREAD_RETURN_NOJOIN void + typedef THREAD_RETURN_NOJOIN + (WOLFSSL_THREAD_NO_JOIN *THREAD_CB_NOJOIN)(void* arg); + #define RETURN_FROM_THREAD_NOJOIN(x) return + #endif + WOLFSSL_API int wolfSSL_NewThreadNoJoin(THREAD_CB_NOJOIN cb, + void* arg); + #endif + WOLFSSL_API int wolfSSL_JoinThread(THREAD_TYPE thread); + + #ifdef WOLFSSL_COND + WOLFSSL_API int wolfSSL_CondInit(COND_TYPE* cond); + WOLFSSL_API int wolfSSL_CondFree(COND_TYPE* cond); + WOLFSSL_API int wolfSSL_CondSignal(COND_TYPE* cond); + WOLFSSL_API int wolfSSL_CondWait(COND_TYPE* cond); + WOLFSSL_API int wolfSSL_CondStart(COND_TYPE* cond); + WOLFSSL_API int wolfSSL_CondEnd(COND_TYPE* cond); + #endif +#else + #define WOLFSSL_RETURN_FROM_THREAD(x) return (THREAD_RETURN)(x) +#endif /* SINGLE_THREADED */ + +#if defined(HAVE_STACK_SIZE) + #define EXIT_TEST(ret) return (THREAD_RETURN)((size_t)(ret)) +#else + #define EXIT_TEST(ret) return ret +#endif + + +#if (defined(__IAR_SYSTEMS_ICC__) && (__IAR_SYSTEMS_ICC__ > 8)) || \ + defined(__GNUC__) + #define WOLFSSL_PACK __attribute__ ((packed)) +#else + #define WOLFSSL_PACK +#endif + +#ifndef __GNUC_PREREQ + #if defined(__GNUC__) && defined(__GNUC_MINOR__) + #define __GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) + #else + #define __GNUC_PREREQ(maj, min) (0) /* not GNUC */ + #endif +#endif + +#if defined(__IAR_SYSTEMS_ICC__) || defined(__GNUC__) + #define WC_NORETURN __attribute__((noreturn)) +#else + #define WC_NORETURN +#endif + +#if defined(WOLFSSL_KEY_GEN) || defined(HAVE_COMP_KEY) || \ + defined(WOLFSSL_DEBUG_MATH) || defined(DEBUG_WOLFSSL) || \ + defined(WOLFSSL_PUBLIC_MP) || defined(OPENSSL_EXTRA) || \ + (defined(HAVE_ECC) && defined(HAVE_ECC_KEY_EXPORT)) + #undef WC_MP_TO_RADIX + #define WC_MP_TO_RADIX +#endif + +#if defined(__GNUC__) && __GNUC__ > 5 + #define PRAGMA_GCC_DIAG_PUSH _Pragma("GCC diagnostic push") + #define PRAGMA_GCC(str) _Pragma(str) + #define PRAGMA_GCC_DIAG_POP _Pragma("GCC diagnostic pop") + #define PRAGMA_DIAG_PUSH PRAGMA_GCC_DIAG_PUSH + #define PRAGMA(str) PRAGMA_GCC(str) + #define PRAGMA_DIAG_POP PRAGMA_GCC_DIAG_POP +#else + #define PRAGMA_GCC_DIAG_PUSH /* null expansion */ + #define PRAGMA_GCC(str) /* null expansion */ + #define PRAGMA_GCC_DIAG_POP /* null expansion */ +#endif + +#ifdef __clang__ + #define PRAGMA_CLANG_DIAG_PUSH _Pragma("clang diagnostic push") + #define PRAGMA_CLANG(str) _Pragma(str) + #define PRAGMA_CLANG_DIAG_POP _Pragma("clang diagnostic pop") + #define PRAGMA_DIAG_PUSH PRAGMA_CLANG_DIAG_PUSH + #define PRAGMA(str) PRAGMA_CLANG(str) + #define PRAGMA_DIAG_POP PRAGMA_CLANG_DIAG_POP +#else + #define PRAGMA_CLANG_DIAG_PUSH /* null expansion */ + #define PRAGMA_CLANG(str) /* null expansion */ + #define PRAGMA_CLANG_DIAG_POP /* null expansion */ +#endif + +#ifndef PRAGMA_DIAG_PUSH + #define PRAGMA_DIAG_PUSH /* null expansion */ +#endif +#ifndef PRAGMA + #define PRAGMA(str) /* null expansion */ +#endif +#ifndef PRAGMA_DIAG_POP + #define PRAGMA_DIAG_POP /* null expansion */ +#endif + +#define WC_CPP_CAT4_(a, b, c, d) a ## b ## c ## d +#define WC_CPP_CAT4(a, b, c, d) WC_CPP_CAT4_(a, b, c, d) +#if defined(WC_NO_STATIC_ASSERT) + #define wc_static_assert(expr) struct wc_static_assert_dummy_struct + #define wc_static_assert2(expr, msg) wc_static_assert(expr) +#elif !defined(wc_static_assert) + #if defined(WOLFSSL_HAVE_ASSERT_H) && !defined(WOLFSSL_NO_ASSERT_H) + #include <assert.h> + #endif + #if (defined(__cplusplus) && (__cplusplus >= 201703L)) || \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L)) || \ + (defined(_MSVC_LANG) && (__cpp_static_assert >= 201411L)) + /* native variadic static_assert() */ + #define wc_static_assert static_assert + #ifndef wc_static_assert2 + #define wc_static_assert2 static_assert + #endif + #elif (defined(_MSC_VER) && (__STDC_VERSION__ >= 201112L)) || \ + (defined(_MSVC_LANG) && (__cpp_static_assert >= 200410L)) + /* native 2-argument static_assert() */ + #define wc_static_assert(expr) static_assert(expr, #expr) + #ifndef wc_static_assert2 + #define wc_static_assert2(expr, msg) static_assert(expr, msg) + #endif + #elif !defined(__cplusplus) && \ + !defined(__STRICT_ANSI__) && \ + !defined(WOLF_C89) && \ + defined(__STDC_VERSION__) && \ + (__STDC_VERSION__ >= 201112L) && \ + ((defined(__GNUC__) && \ + (__GNUC__ >= 5)) || \ + defined(__clang__)) + /* native 2-argument _Static_assert() */ + #define wc_static_assert(expr) _Static_assert(expr, #expr) + #ifndef wc_static_assert2 + #define wc_static_assert2(expr, msg) _Static_assert(expr, msg) + #endif + #else + #ifdef __COUNTER__ + #define wc_static_assert(expr) \ + struct WC_CPP_CAT4(wc_static_assert_dummy_struct_L, \ + __LINE__, _, __COUNTER__) { \ + char t[(expr) ? 1 : -1]; \ + } + #else + #define wc_static_assert(expr) \ + struct wc_static_assert_dummy_struct + #endif + #ifndef wc_static_assert2 + #define wc_static_assert2(expr, msg) wc_static_assert(expr) + #endif + #endif +#elif !defined(wc_static_assert2) + #define wc_static_assert2(expr, msg) wc_static_assert(expr) +#endif + +#ifndef SAVE_VECTOR_REGISTERS + #define SAVE_VECTOR_REGISTERS(fail_clause) WC_DO_NOTHING +#endif +#ifndef SAVE_VECTOR_REGISTERS2 + #define SAVE_VECTOR_REGISTERS2() 0 + #define SAVE_VECTOR_REGISTERS2_DOES_NOTHING +#endif +#ifndef CAN_SAVE_VECTOR_REGISTERS + #define CAN_SAVE_VECTOR_REGISTERS() 1 + #define CAN_SAVE_VECTOR_REGISTERS_ALWAYS_TRUE +#endif +#ifndef WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL + #define WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(x) WC_DO_NOTHING +#endif +#ifndef ASSERT_SAVED_VECTOR_REGISTERS + #define ASSERT_SAVED_VECTOR_REGISTERS() WC_DO_NOTHING +#endif +#ifndef ASSERT_RESTORED_VECTOR_REGISTERS + #define ASSERT_RESTORED_VECTOR_REGISTERS(fail_clause) WC_DO_NOTHING +#endif +#ifndef RESTORE_VECTOR_REGISTERS + #define RESTORE_VECTOR_REGISTERS() WC_DO_NOTHING +#endif +#ifdef WOLFSSL_NO_ASM + /* We define fallback no-op definitions for these only if asm is disabled, + * otherwise the using code must detect that these macros are undefined and + * provide its own non-vector implementation paths. + * + * Currently these macros are only used in WOLFSSL_LINUXKM code paths, which + * are always compiled either with substantive definitions from + * linuxkm_wc_port.h, or with WOLFSSL_NO_ASM defined. + */ + #ifndef DISABLE_VECTOR_REGISTERS + #define DISABLE_VECTOR_REGISTERS() 0 + #endif + #ifndef REENABLE_VECTOR_REGISTERS + #define REENABLE_VECTOR_REGISTERS() WC_DO_NOTHING + #endif +#endif + +#ifndef WC_SANITIZE_DISABLE + #define WC_SANITIZE_DISABLE() WC_DO_NOTHING +#endif +#ifndef WC_SANITIZE_ENABLE + #define WC_SANITIZE_ENABLE() WC_DO_NOTHING +#endif + +#if FIPS_VERSION_GE(5,1) + #define WC_SPKRE_F(x,y) wolfCrypt_SetPrivateKeyReadEnable_fips((x),(y)) + #define PRIVATE_KEY_LOCK() WC_SPKRE_F(0,WC_KEYTYPE_ALL) + #define PRIVATE_KEY_UNLOCK() WC_SPKRE_F(1,WC_KEYTYPE_ALL) +#else + #define PRIVATE_KEY_LOCK() WC_DO_NOTHING + #define PRIVATE_KEY_UNLOCK() WC_DO_NOTHING +#endif + + +#ifdef _MSC_VER + /* disable buggy MSC warning (incompatible with clang-tidy + * readability-avoid-const-params-in-decls) + * "warning C4028: formal parameter x different from declaration" + */ + #pragma warning(disable: 4028) +#endif + + +/* opaque math variable type */ +#if defined(USE_FAST_MATH) + struct fp_int; + #define MATH_INT_T struct fp_int +#elif defined(USE_INTEGER_HEAP_MATH) + struct mp_int; + #define MATH_INT_T struct mp_int +#else + struct sp_int; + #define MATH_INT_T struct sp_int +#endif + + +/* Maximum ASN sizes */ +#ifndef WOLFSSL_ASN_MAX_LENGTH_SZ + #define WOLFSSL_ASN_MAX_LENGTH_SZ 5 /* 1 byte length + 4 bytes of number */ +#endif + +enum Max_ASN { + DSA_PUB_INTS = 4, /* DSA ints in public key */ + DSA_INTS = 5, /* DSA ints in private key */ + MAX_SALT_SIZE = 64, /* MAX PKCS Salt length */ + MAX_IV_SIZE = 64, /* MAX PKCS Iv length */ +#ifdef HAVE_SPHINCS + MAX_ENCODED_SIG_SZ = 51200, +#elif defined(HAVE_FALCON) || defined(HAVE_DILITHIUM) + MAX_ENCODED_SIG_SZ = 5120, +#elif !defined(NO_RSA) +#if defined(USE_FAST_MATH) && defined(FP_MAX_BITS) + MAX_ENCODED_SIG_SZ = FP_MAX_BITS / 8, +#elif (defined(WOLFSSL_SP_MATH_ALL) || defined(WOLFSSL_SP_MATH)) && \ + defined(SP_INT_BITS) + MAX_ENCODED_SIG_SZ = (SP_INT_BITS + 7) / 8, +#elif defined(WOLFSSL_HAPROXY) + MAX_ENCODED_SIG_SZ = 1024, /* Supports 8192 bit keys */ +#else + MAX_ENCODED_SIG_SZ = 512, /* Supports 4096 bit keys */ +#endif +#elif defined(HAVE_ECC) + MAX_ENCODED_SIG_SZ = 140, +#elif defined(HAVE_CURVE448) + MAX_ENCODED_SIG_SZ = 114, +#else + MAX_ENCODED_SIG_SZ = 64, +#endif + MAX_SIG_SZ = 256, + MAX_ALGO_SZ = 20, + MAX_LENGTH_SZ = WOLFSSL_ASN_MAX_LENGTH_SZ, /* Max length size for DER encoding */ + MAX_SHORT_SZ = (1 + 1 + 5), /* asn int + byte len + 5 byte length */ + MAX_SEQ_SZ = (1 + MAX_LENGTH_SZ), /* enum(seq | con) + length(5) */ + MAX_SET_SZ = (1 + MAX_LENGTH_SZ), /* enum(set | con) + length(5) */ + MAX_OCTET_STR_SZ = (1 + MAX_LENGTH_SZ), /* enum(set | con) + length(5) */ + MAX_EXP_SZ = (1 + MAX_LENGTH_SZ), /* enum(contextspec|con|exp) + length(5) */ + MAX_PRSTR_SZ = (1 + MAX_LENGTH_SZ), /* enum(prstr) + length(5) */ + MAX_VERSION_SZ = 5, /* enum + id + version(byte) + (header(2))*/ + MAX_ENCODED_DIG_ASN_SZ = (5 + MAX_LENGTH_SZ), /* enum(bit or octet) + length(5) */ + MAX_ENCODED_DIG_SZ = 64 + MAX_ENCODED_DIG_ASN_SZ, /* asn header + sha512 */ + MAX_RSA_INT_SZ = (512 + 1 + MAX_LENGTH_SZ), /* RSA raw sz 4096 for bits + tag + len(5) */ + MAX_DSA_INT_SZ = (384 + 1 + MAX_LENGTH_SZ), /* DSA raw sz 3072 for bits + tag + len(5) */ + MAX_DSA_PUBKEY_SZ = (DSA_PUB_INTS * MAX_DSA_INT_SZ) + (2 * MAX_SEQ_SZ) + + 2 + MAX_LENGTH_SZ, /* Maximum size of a DSA public + key taken from wc_SetDsaPublicKey. */ + MAX_DSA_PRIVKEY_SZ = (DSA_INTS * MAX_DSA_INT_SZ) + MAX_SEQ_SZ + + MAX_VERSION_SZ, /* Maximum size of a DSA Private + key taken from DsaKeyIntsToDer. */ +#if defined(HAVE_FALCON) || defined(HAVE_DILITHIUM) + MAX_PQC_PUBLIC_KEY_SZ = 2592, /* Maximum size of a Dilithium public key. */ +#endif + MAX_RSA_E_SZ = 16, /* Max RSA public e size */ + MAX_CA_SZ = 32, /* Max encoded CA basic constraint length */ + MAX_SN_SZ = 35, /* Max encoded serial number (INT) length */ + MAX_DER_DIGEST_SZ = MAX_ENCODED_DIG_SZ + MAX_ALGO_SZ + MAX_SEQ_SZ, + /* Maximum DER digest size */ + MAX_DER_DIGEST_ASN_SZ = MAX_ENCODED_DIG_ASN_SZ + MAX_ALGO_SZ + MAX_SEQ_SZ, + /* Maximum DER digest ASN header size */ + /* Max X509 header length indicates the + * max length + 2 ('\n', '\0') */ +#if defined(HAVE_FALCON) || defined(HAVE_DILITHIUM) || defined(HAVE_SPHINCS) + MAX_X509_HEADER_SZ = (48 + 2), /* Maximum PEM Header/Footer Size */ +#else + MAX_X509_HEADER_SZ = (37 + 2), /* Maximum PEM Header/Footer Size */ +#endif + +#if defined(HAVE_FALCON) || defined(HAVE_DILITHIUM) + MAX_PUBLIC_KEY_SZ = MAX_PQC_PUBLIC_KEY_SZ + MAX_ALGO_SZ + MAX_SEQ_SZ * 2, +#else + MAX_PUBLIC_KEY_SZ = MAX_DSA_PUBKEY_SZ + MAX_ALGO_SZ + MAX_SEQ_SZ * 2, +#endif +#ifdef WOLFSSL_ENCRYPTED_KEYS + HEADER_ENCRYPTED_KEY_SIZE = 88 /* Extra header size for encrypted key */ +#else + HEADER_ENCRYPTED_KEY_SIZE = 0 +#endif +}; + +#ifndef WC_MAX_DIGEST_SIZE +#define WC_MAX_DIGEST_SIZE 64 +#endif +#ifndef WC_MAX_BLOCK_SIZE +#define WC_MAX_BLOCK_SIZE 128 +#endif + +#ifdef WOLFSSL_CERT_GEN + /* Used in asn.c MakeSignature for ECC and RSA non-blocking/async */ + enum CertSignState { + CERTSIGN_STATE_BEGIN, + CERTSIGN_STATE_DIGEST, + CERTSIGN_STATE_ENCODE, + CERTSIGN_STATE_DO + }; + + typedef struct CertSignCtx { + #ifdef WOLFSSL_NO_MALLOC + byte sig[MAX_ENCODED_SIG_SZ]; + byte digest[WC_MAX_DIGEST_SIZE]; + #ifndef NO_RSA + byte encSig[MAX_DER_DIGEST_SZ]; + #endif + #else + byte* sig; + byte* digest; + #ifndef NO_RSA + byte* encSig; + #endif + #endif + + #ifndef NO_RSA + int encSigSz; + #endif + int state; /* enum CertSignState */ + } CertSignCtx; + +#endif /* WOLFSSL_CERT_GEN */ + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLF_CRYPT_TYPES_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/visibility.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/visibility.h @@ -0,0 +1,97 @@ +/* visibility.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + +/* Visibility control macros */ + +#ifndef WOLF_CRYPT_VISIBILITY_H +#define WOLF_CRYPT_VISIBILITY_H + +/* WOLFSSL_API is used for the public API symbols. + It either imports or exports (or does nothing for static builds) + + WOLFSSL_LOCAL is used for non-API symbols (private). +*/ + +#if defined(BUILDING_WOLFSSL) + #if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) || \ + defined(_WIN32_WCE) || defined(__WATCOMC__) + #if defined(WOLFSSL_DLL) + #define WOLFSSL_API __declspec(dllexport) + #else + #define WOLFSSL_API + #endif + #define WOLFSSL_LOCAL + #elif defined(HAVE_VISIBILITY) && HAVE_VISIBILITY + #define WOLFSSL_API __attribute__ ((visibility("default"))) + #define WOLFSSL_LOCAL __attribute__ ((visibility("hidden"))) + #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) + #define WOLFSSL_API __global + #define WOLFSSL_LOCAL __hidden + #else + #define WOLFSSL_API + #define WOLFSSL_LOCAL + #endif /* HAVE_VISIBILITY */ + + #ifdef WOLFSSL_PRIVATE_TEST_VIS + #define WOLFSSL_TEST_VIS WOLFSSL_LOCAL + #else + #define WOLFSSL_TEST_VIS WOLFSSL_API + #endif +#else /* !BUILDING_WOLFSSL */ + #if defined(__WATCOMC__) + #if defined(WOLFSSL_DLL) && defined(__NT__) + #define WOLFSSL_API __declspec(dllimport) + #else + #define WOLFSSL_API + #endif + #define WOLFSSL_LOCAL + #elif defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) || \ + defined(_WIN32_WCE) + #if defined(WOLFSSL_DLL) + #define WOLFSSL_API __declspec(dllimport) + #else + #define WOLFSSL_API + #endif + #define WOLFSSL_LOCAL + #else + #define WOLFSSL_API + #define WOLFSSL_LOCAL + #endif + + #if defined(WOLFSSL_VIS_FOR_TESTS) + #ifdef WOLFSSL_PRIVATE_TEST_VIS + #error WOLFSSL_VIS_FOR_TESTS is unavailable in WOLFSSL_PRIVATE_TEST_VIS builds. + #endif + #define WOLFSSL_TEST_VIS WOLFSSL_API + #else + #define WOLFSSL_TEST_VIS WOLFSSL_API WC_DEPRECATED("internal use only") + #endif + +#endif /* !BUILDING_WOLFSSL */ + +/* WOLFSSL_ABI is used for public API symbols that must not change + * their signature. This tag is used for all APIs that are a + * part of the fixed ABI. + */ +#define WOLFSSL_ABI + +#endif /* WOLF_CRYPT_VISIBILITY_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/wc_encrypt.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/wc_encrypt.h @@ -0,0 +1,126 @@ +/* wc_encrypt.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/wc_encrypt.h +*/ + + +#ifndef WOLF_CRYPT_ENCRYPT_H +#define WOLF_CRYPT_ENCRYPT_H + +#include <wolfssl/wolfcrypt/types.h> +#ifndef NO_AES + #include <wolfssl/wolfcrypt/aes.h> +#endif +#ifdef HAVE_CHACHA + #include <wolfssl/wolfcrypt/chacha.h> +#endif +#ifndef NO_DES3 + #include <wolfssl/wolfcrypt/des3.h> +#endif +#ifndef NO_RC4 + #include <wolfssl/wolfcrypt/arc4.h> +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +/* determine max cipher key size - cannot use enum values here, must be define, + * since WC_MAX_SYM_KEY_SIZE is used in if macro logic. */ +#ifndef NO_AES + #define WC_MAX_SYM_KEY_SIZE (AES_MAX_KEY_SIZE/8) +#elif defined(HAVE_CHACHA) + #define WC_MAX_SYM_KEY_SIZE 32 /* CHACHA_MAX_KEY_SZ */ +#elif !defined(NO_DES3) + #define WC_MAX_SYM_KEY_SIZE 24 /* DES3_KEY_SIZE */ +#elif !defined(NO_RC4) + #define WC_MAX_SYM_KEY_SIZE 16 /* RC4_KEY_SIZE */ +#else + #define WC_MAX_SYM_KEY_SIZE 32 +#endif + + +#if (defined(HAVE_FIPS) && defined(HAVE_FIPS_VERSION) && \ + (HAVE_FIPS_VERSION <= 2)) || (defined(HAVE_SELFTEST) && \ + (!defined(HAVE_SELFTEST_VERSION) || (HAVE_SELFTEST_VERSION < 2))) + /* In FIPS cert 3389 and CAVP selftest v1 build, these enums are + * not in aes.h. Define them here outside the fips boundary. + */ + #ifndef GCM_NONCE_MID_SZ + /* The usual default nonce size for AES-GCM. */ + #define GCM_NONCE_MID_SZ 12 + #endif + #ifndef CCM_NONCE_MIN_SZ + #define CCM_NONCE_MIN_SZ 7 + #endif +#endif + + +#if !defined(NO_AES) && defined(HAVE_AES_CBC) +WOLFSSL_API int wc_AesCbcEncryptWithKey(byte* out, const byte* in, word32 inSz, + const byte* key, word32 keySz, + const byte* iv); +WOLFSSL_API int wc_AesCbcDecryptWithKey(byte* out, const byte* in, word32 inSz, + const byte* key, word32 keySz, + const byte* iv); +#endif /* !NO_AES */ + + +#ifndef NO_DES3 +WOLFSSL_API int wc_Des_CbcDecryptWithKey(byte* out, + const byte* in, word32 sz, + const byte* key, const byte* iv); +WOLFSSL_API int wc_Des_CbcEncryptWithKey(byte* out, + const byte* in, word32 sz, + const byte* key, const byte* iv); +WOLFSSL_API int wc_Des3_CbcEncryptWithKey(byte* out, + const byte* in, word32 sz, + const byte* key, const byte* iv); +WOLFSSL_API int wc_Des3_CbcDecryptWithKey(byte* out, + const byte* in, word32 sz, + const byte* key, const byte* iv); +#endif /* !NO_DES3 */ + + + + +#ifdef WOLFSSL_ENCRYPTED_KEYS + struct EncryptedInfo; + WOLFSSL_API int wc_BufferKeyDecrypt(struct EncryptedInfo* info, byte* der, word32 derSz, + const byte* password, int passwordSz, int hashType); + WOLFSSL_API int wc_BufferKeyEncrypt(struct EncryptedInfo* info, byte* der, word32 derSz, + const byte* password, int passwordSz, int hashType); +#endif /* WOLFSSL_ENCRYPTED_KEYS */ + +#ifndef NO_PWDBASED + WOLFSSL_LOCAL int wc_CryptKey(const char* password, int passwordSz, + byte* salt, int saltSz, int iterations, int id, byte* input, int length, + int version, byte* cbcIv, int enc, int shaOid); +#endif + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLF_CRYPT_ENCRYPT_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/wc_lms.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/wc_lms.h @@ -0,0 +1,506 @@ +/* wc_lms.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* Implementation based on: + * RFC 8554: Leighton-Micali Hash-Based Signatures + * https://datatracker.ietf.org/doc/html/rfc8554 + * Implementation by Sean Parkinson. + */ + +/* Possible LMS options: + * + * WOLFSSL_LMS_LARGE_CACHES Default: OFF + * Authentication path caches are large and signing faster. + * WOLFSSL_LMS_ROOT_LEVELS Default: 5 (Large: 7) + * Number of levels of interior nodes from the to to cached. + * Valid value are: 1..height of subtree. + * The bigger the number, the larger the LmsKey but faster signing. + * Only applies when !WOLFSSL_WC_LMS_SMALL. + * WOLFSSL_LMS_CACHE_BITS Default: 5 (Large: 7) + * 2 to the power of the value is the number of leaf nodes to cache. + * Maximum valid value is height of subtree. + * Valid value are: 0..height of subtree. + * The bigger the number, the larger the LmsKey but faster signing. + * Only applies when !WOLFSSL_WC_LMS_SMALL. + * + * Memory/Level | R/C | Approx. Time (% of 5/5) + * (Bytes) | | H=10 | H=15 | H=20 + * -------------+--------------+--------+-------- + * 2016 | 5/5 | 100.0% | 100.0% | 100.0% + * 3040 | 5/6 | 75.5% | 89.2% | + * 4064 | 6/6 | 75.3% | 78.8% | + * 4576 | 4/7 | 72.4% | 87.6% | + * 6112 | 6/7 | 72.1% | 67.5% | + * 8160 | 7/7 | 72.2% | 56.8% | + * 8416 | 3/8 | 66.4% | 84.9% | + * 12256 | 7/8 | 66.5% | 45.9% | + * 16352 | 8/8 | 66.0% | 35.0% | + * 16416 | 1/9 | 54.1% | 79.5% | + * R = Root levels + * C = Cache bits + * To mimic the dynamic memory usage of XMSS, use 3/3. + * + * WOLFSSL_LMS_NO_SIGN SMOOTHING Default: OFF + * Disable precalculation of next subtree. + * Use less dynamic memory. + * At certain indexes, signing will take a long time compared to the mean. + * When OFF, the private key holds a second copy of caches. + * + * WOLFSSL_LMS_NO_SIG_CACHE Default: OFF + * Signature cache is disabled. + * This will use less dynamic memory and make signing slower when multiple + * levels. + * + * Sig cache holds the C and y hashes for a tree that is not the lowest. + * Sig cache size = (levels - 1) * (1 + p) * 32 bytes + * p is the number of y terms based on Winternitz width. + * + * w | p | l | Bytes + * ---+----+---+------ + * 4 | 67 | 2 | 2176 + * 4 | 67 | 3 | 4353 + * 4 | 67 | 4 | 6528 + * 8 | 34 | 2 | 1120 + * 8 | 34 | 3 | 2240 + * 8 | 34 | 4 | 3360 + * w = Winternitz width + * l = #levels + */ + +#ifndef WC_LMS_H +#define WC_LMS_H + +#include <wolfssl/wolfcrypt/types.h> + +#if defined(WOLFSSL_HAVE_LMS) && defined(WOLFSSL_WC_LMS) + +#include <wolfssl/wolfcrypt/lms.h> +#include <wolfssl/wolfcrypt/sha256.h> + +#ifdef WOLFSSL_LMS_MAX_LEVELS + /* Maximum number of levels of trees supported by implementation. */ + #define LMS_MAX_LEVELS WOLFSSL_LMS_MAX_LEVELS +#else + /* Maximum number of levels of trees supported by implementation. */ + #define LMS_MAX_LEVELS 4 +#endif +#if (LMS_MAX_LEVELS < 1) || (LMS_MAX_LEVELS > 4) + #error "LMS parameters only support heights 1-4." +#endif + +/* Smoothing is only used when there are 2 or more levels. */ +#if LMS_MAX_LEVELS == 1 && !defined(WOLFSSL_LMS_NO_SIGN_SMOOTHING) + #define WOLFSSL_LMS_NO_SIGN_SMOOTHING +#endif + +#ifdef WOLFSSL_LMS_MAX_HEIGHT + /* Maximum height of a tree supported by implementation. */ + #define LMS_MAX_HEIGHT WOLFSSL_LMS_MAX_HEIGHT +#else + /* Maximum height of a tree supported by implementation. */ + #define LMS_MAX_HEIGHT 20 +#endif +#if (LMS_MAX_HEIGHT < 5) || (LMS_MAX_HEIGHT > 20) + #error "LMS parameters only support heights 5-20." +#endif + +/* Length of I in bytes. */ +#define LMS_I_LEN 16 +/* Length of L in bytes. */ +#define LMS_L_LEN 4 +/* Length of Q for a level. */ +#define LMS_Q_LEN 4 +/* Length of P in bytes. */ +#define LMS_P_LEN 2 +/* Length of W in bytes. */ +#define LMS_W_LEN 1 + +/* Length of numeric types when encoding. */ +#define LMS_TYPE_LEN 4 + +/* Size of digest output when truncatint SHA-256 to 192 bits. */ +#define WC_SHA256_192_DIGEST_SIZE 24 + +/* Maximum size of a node hash. */ +#define LMS_MAX_NODE_LEN WC_SHA256_DIGEST_SIZE +/* Maximum size of SEED (produced by hash). */ +#define LMS_SEED_LEN WC_SHA256_DIGEST_SIZE +/* Maximum number of P, number of n-byte string elements in LM-OTS signature. + * Value of P when N=32 and W=1. + */ +#define LMS_MAX_P 265 + + +#ifndef WOLFSSL_LMS_ROOT_LEVELS + #ifdef WOLFSSL_LMS_LARGE_CACHES + /* Number of root levels of interior nodes to store. */ + #define LMS_ROOT_LEVELS 7 + #else + /* Number of root levels of interior nodes to store. */ + #define LMS_ROOT_LEVELS 5 + #endif +#else + #define LMS_ROOT_LEVELS WOLFSSL_LMS_ROOT_LEVELS +#endif +#if LMS_ROOT_LEVELS <= 0 + #error "LMS_ROOT_LEVELS must be greater than 0." +#endif +/* Count of root nodes to store per level. */ +#define LMS_ROOT_COUNT ((1 << (LMS_ROOT_LEVELS)) - 1) + +#ifndef WOLFSSL_LMS_CACHE_BITS + #ifdef WOLFSSL_LMS_LARGE_CACHES + /* 2 to the power of the value is the number of leaf nodes to cache. */ + #define LMS_CACHE_BITS 7 + #else + /* 2 to the power of the value is the number of leaf nodes to cache. */ + #define LMS_CACHE_BITS 5 + #endif +#else + #define LMS_CACHE_BITS WOLFSSL_LMS_CACHE_BITS +#endif +#if LMS_CACHE_BITS < 0 + #error "LMS_CACHE_BITS must be greater than or equal to 0." +#endif +/* Number of leaf nodes to cache. */ +#define LMS_LEAF_CACHE (1 << LMS_CACHE_BITS) + +/* Maximum number of levels of trees described in private key. */ +#define HSS_MAX_LEVELS 8 +/* Length of full Q in bytes. Q from all levels combined. */ +#define HSS_Q_LEN 8 + +/* Compressed parameter set length in bytes. */ +#define HSS_COMPRESS_PARAM_SET_LEN 1 +/* Total compressed parameter set length for private key in bytes. */ +#define HSS_PRIV_KEY_PARAM_SET_LEN \ + (HSS_COMPRESS_PARAM_SET_LEN * HSS_MAX_LEVELS) + +/* Private key length for one level. */ +#define LMS_PRIV_LEN(hLen) \ + (LMS_Q_LEN + (hLen) + LMS_I_LEN) +/* Public key length in signature. */ +#define LMS_PUBKEY_LEN(hLen) \ + (LMS_TYPE_LEN + LMS_TYPE_LEN + LMS_I_LEN + (hLen)) + +/* LMS signature data length. */ +#define LMS_SIG_LEN(h, p, hLen) \ + (LMS_Q_LEN + LMS_TYPE_LEN + (hLen) + (p) * (hLen) + LMS_TYPE_LEN + \ + (h) * (hLen)) + +/* Length of public key. */ +#define HSS_PUBLIC_KEY_LEN(hLen) (LMS_L_LEN + LMS_PUBKEY_LEN(hLen)) +/* Length of private key. */ +#define HSS_PRIVATE_KEY_LEN(hLen) \ + (HSS_Q_LEN + HSS_PRIV_KEY_PARAM_SET_LEN + (hLen) + LMS_I_LEN) +/* Maximum public key length - length is constant for all parameters. */ +#define HSS_MAX_PRIVATE_KEY_LEN HSS_PRIVATE_KEY_LEN(LMS_MAX_NODE_LEN) +/* Maximum private key length - length is constant for all parameters. */ +#define HSS_MAX_PUBLIC_KEY_LEN HSS_PUBLIC_KEY_LEN(LMS_MAX_NODE_LEN) +/* Maximum signature length. */ +#define HSS_MAX_SIG_LEN \ + (LMS_TYPE_LEN + \ + LMS_MAX_LEVELS * (LMS_Q_LEN + LMS_TYPE_LEN + LMS_TYPE_LEN + \ + LMS_MAX_NODE_LEN * (1 + LMS_MAX_P + LMS_MAX_HEIGHT)) + \ + (LMS_MAX_LEVELS - 1) * LMS_PUBKEY_LEN(LMS_MAX_NODE_LEN)) + +/* Maximum buffer length required for use when hashing. */ +#define LMS_MAX_BUFFER_LEN \ + (LMS_I_LEN + LMS_Q_LEN + LMS_P_LEN + LMS_W_LEN + 2 * LMS_MAX_NODE_LEN) + + +/* Private key data length. + * + * HSSPrivKey.priv + */ +#define LMS_PRIV_KEY_LEN(l, hLen) \ + ((l) * LMS_PRIV_LEN(hLen)) + +/* Stack of nodes. */ +#define LMS_STACK_CACHE_LEN(h, hLen) \ + (((h) + 1) * (hLen)) + +/* Root cache length. */ +#define LMS_ROOT_CACHE_LEN(rl, hLen) \ + (((1 << (rl)) - 1) * (hLen)) + +/* Leaf cache length. */ +#define LMS_LEAF_CACHE_LEN(cb, hLen) \ + ((1 << (cb)) * (hLen)) + +/* Length of LMS private key state. + * + * LmsPrivState + * auth_path + + * root + + * stack.stack + stack.offset + + * cache.leaf + cache.index + cache.offset + */ +#define LMS_PRIV_STATE_LEN(h, rl, cb, hLen) \ + (((h) * (hLen)) + \ + LMS_STACK_CACHE_LEN(h, hLen) + 4 + \ + LMS_ROOT_CACHE_LEN(rl, hLen) + \ + LMS_LEAF_CACHE_LEN(cb, hLen) + 4 + 4) + +#ifndef WOLFSSL_WC_LMS_SMALL + /* Private key data state for all levels. */ + #define LMS_PRIV_STATE_ALL_LEN(l, h, rl, cb, hLen) \ + ((l) * LMS_PRIV_STATE_LEN(h, rl, cb, hLen)) +#else + /* Private key data state for all levels. */ + #define LMS_PRIV_STATE_ALL_LEN(l, h, rl, cb, hLen) 0 +#endif + +#ifndef WOLFSSL_LMS_NO_SIGN_SMOOTHING + /* Extra private key data for smoothing. */ + #define LMS_PRIV_SMOOTH_LEN(l, h, rl, cb, hLen) \ + (LMS_PRIV_KEY_LEN(l, hLen) + \ + ((l) - 1) * LMS_PRIV_STATE_LEN(h, rl, cb, hLen)) +#else + /* Extra private key data for smoothing. */ + #define LMS_PRIV_SMOOTH_LEN(l, h, rl, cb, hLen) 0 +#endif + +#ifndef WOLFSSL_LMS_NO_SIG_CACHE + #define LMS_PRIV_Y_TREE_LEN(p, hLen) \ + ((hLen) + (p) * (hLen)) + /* Length of the y data cached in private key data. */ + #define LMS_PRIV_Y_LEN(l, p, hLen) \ + (((l) - 1) * ((hLen) + (p) * (hLen))) +#else + /* Length of the y data cached in private key data. */ + #define LMS_PRIV_Y_LEN(l, p, hLen) 0 +#endif + +#ifndef WOLFSSL_WC_LMS_SMALL +/* Length of private key data. */ +#define LMS_PRIV_DATA_LEN(l, h, p, rl, cb, hLen) \ + (LMS_PRIV_KEY_LEN(l, hLen) + \ + LMS_PRIV_STATE_ALL_LEN(l, h, rl, cb, hLen) + \ + LMS_PRIV_SMOOTH_LEN(l, h, rl, cb, hLen) + \ + LMS_PRIV_Y_LEN(l, p, hLen)) +#else +#define LMS_PRIV_DATA_LEN(l, h, p, rl, cb, hLen) \ + LMS_PRIV_KEY_LEN(l, hLen) +#endif + +/* Indicates using SHA-256 for hashing. */ +#define LMS_SHA256 0x0000 +/* Indicates using SHA-256/192 for hashing. */ +#define LMS_SHA256_192 0x1000 +/* Mask to get hashing algorithm from type. */ +#define LMS_HASH_MASK 0xf000 +/* Mask to get height or Winternitz width from type. */ +#define LMS_H_W_MASK 0x0fff + +/* LMS Parameters. */ +/* SHA-256 hash, 32-bytes of hash used, tree height of 5. */ +#define LMS_SHA256_M32_H5 0x05 +/* SHA-256 hash, 32-bytes of hash used, tree height of 10. */ +#define LMS_SHA256_M32_H10 0x06 +/* SHA-256 hash, 32-bytes of hash used, tree height of 15. */ +#define LMS_SHA256_M32_H15 0x07 +/* SHA-256 hash, 32-bytes of hash used, tree height of 20. */ +#define LMS_SHA256_M32_H20 0x08 +/* SHA-256 hash, 32-bytes of hash used, tree height of 25. */ +#define LMS_SHA256_M32_H25 0x09 + +/* SHA-256 hash, 32-bytes of hash used, Winternitz width of 1 bit. */ +#define LMOTS_SHA256_N32_W1 0x01 +/* SHA-256 hash, 32-bytes of hash used, Winternitz width of 2 bits. */ +#define LMOTS_SHA256_N32_W2 0x02 +/* SHA-256 hash, 32-bytes of hash used, Winternitz width of 4 bits. */ +#define LMOTS_SHA256_N32_W4 0x03 +/* SHA-256 hash, 32-bytes of hash used, Winternitz width of 8 bits. */ +#define LMOTS_SHA256_N32_W8 0x04 + +/* SHA-256 hash, 32-bytes of hash used, tree height of 5. */ +#define LMS_SHA256_M24_H5 (0x0a | LMS_SHA256_192) +/* SHA-256 hash, 32-bytes of hash used, tree height of 10. */ +#define LMS_SHA256_M24_H10 (0x0b | LMS_SHA256_192) +/* SHA-256 hash, 32-bytes of hash used, tree height of 15. */ +#define LMS_SHA256_M24_H15 (0x0c | LMS_SHA256_192) +/* SHA-256 hash, 32-bytes of hash used, tree height of 20. */ +#define LMS_SHA256_M24_H20 (0x0d | LMS_SHA256_192) +/* SHA-256 hash, 32-bytes of hash used, tree height of 25. */ +#define LMS_SHA256_M24_H25 (0x0e | LMS_SHA256_192) + +/* SHA-256 hash, 32-bytes of hash used, Winternitz width of 1 bit. */ +#define LMOTS_SHA256_N24_W1 (0x05 | LMS_SHA256_192) +/* SHA-256 hash, 32-bytes of hash used, Winternitz width of 2 bits. */ +#define LMOTS_SHA256_N24_W2 (0x06 | LMS_SHA256_192) +/* SHA-256 hash, 32-bytes of hash used, Winternitz width of 4 bits. */ +#define LMOTS_SHA256_N24_W4 (0x07 | LMS_SHA256_192) +/* SHA-256 hash, 32-bytes of hash used, Winternitz width of 8 bits. */ +#define LMOTS_SHA256_N24_W8 (0x08 | LMS_SHA256_192) + +typedef struct LmsParams { + /* Number of tree levels. */ + word8 levels; + /* Height of each tree. */ + word8 height; + /* Width or Winternitz coefficient. */ + word8 width; + /* Number of left-shift bits used in checksum calculation. */ + word8 ls; + /* Number of n-byte string elements in LM-OTS signature. */ + word16 p; + /* LMS type. */ + word16 lmsType; + /* LMOTS type. */ + word16 lmOtsType; + /* Length of LM-OTS signature. */ + word16 sig_len; + /* Length of seed. */ + word16 hash_len; +#ifndef WOLFSSL_WC_LMS_SMALL + /* Number of root levels of interior nodes to store. */ + word8 rootLevels; + /* 2 to the power of the value is the number of leaf nodes to cache. */ + word8 cacheBits; +#endif +} LmsParams; + +/* Mapping of id and string to parameters. */ +typedef struct wc_LmsParamsMap { + /* Identifier of parameters. */ + enum wc_LmsParm id; + /* String representation of identifier of parameters. */ +#ifdef WOLFSSL_NAMES_STATIC + const char str[32]; /* large enough for largest string in wc_lms_map[] */ +#else + const char* str; +#endif + /* LMS parameter set. */ + LmsParams params; +} wc_LmsParamsMap; + +typedef struct LmsState { + /* Buffer to hold data to hash. */ + ALIGN16 byte buffer[LMS_MAX_BUFFER_LEN]; +#ifdef WOLFSSL_SMALL_STACK + /* Buffer to hold expanded Q coefficients. */ + ALIGN16 byte a[LMS_MAX_P]; +#endif + /* LMS parameters. */ + const LmsParams* params; + /* Hash algorithm. */ + wc_Sha256 hash; + /* Hash algorithm for calculating K. */ + wc_Sha256 hash_k; +} LmsState; + +#ifndef WOLFSSL_WC_LMS_SMALL +/* Stack of interior node hashes. */ +typedef struct LmsStack { + /* Stack nodes. */ + byte* stack; + /* Top of stack offset. */ + word32 offset; +} LmsStack; + +/* Cache of leaf hashes. */ +typedef struct HssLeafCache { + /* Cache of leaf nodes. Circular queue. */ + byte* cache; + /* Start index of cached leaf nodes. */ + word32 idx; + /* Index into cache of first leaf node. */ + word32 offset; +} HssLeafCache; + +typedef struct LmsPrivState { + /* Authentication path for current index. */ + byte* auth_path; + /* Stack nodes. */ + LmsStack stack; + /* Root nodes. */ + byte* root; + /* Cache of leaf nodes. */ + HssLeafCache leaf; +} LmsPrivState; +#endif /* WOLFSSL_WC_LMS_SMALL */ + +typedef struct HssPrivKey { + /* Private key. */ + byte* priv; +#ifndef WOLFSSL_WC_LMS_SMALL + /* Per level state of the private key. */ + LmsPrivState state[LMS_MAX_LEVELS]; +#ifndef WOLFSSL_LMS_NO_SIGN_SMOOTHING + /* Next private key. */ + byte* next_priv; + /* Next private state. */ + LmsPrivState next_state[LMS_MAX_LEVELS - 1]; +#endif +#ifndef WOLFSSL_LMS_NO_SIG_CACHE + /* Per level state of the private key. */ + byte* y; +#endif + /* Indicates the key has all levels initialized. */ + word8 inited:1; +#endif +} HssPrivKey; + +struct LmsKey { + /* Public key. */ + ALIGN16 byte pub[HSS_PUBLIC_KEY_LEN(LMS_MAX_NODE_LEN)]; +#ifndef WOLFSSL_LMS_VERIFY_ONLY + /* Encoded private key. */ + ALIGN16 byte priv_raw[HSS_MAX_PRIVATE_KEY_LEN]; + + /* Packed private key data. */ + byte* priv_data; + /* HSS Private key. */ + HssPrivKey priv; + + /* Callback to write/update key. */ + wc_lms_write_private_key_cb write_private_key; + /* Callback to read key. */ + wc_lms_read_private_key_cb read_private_key; + /* Context arg passed to callbacks. */ + void* context; + /* Dynamic memory hint. */ + void* heap; +#endif /* !WOLFSSL_LMS_VERIFY_ONLY */ + /* Parameters of key. */ + const LmsParams* params; + /* Current state of key. */ + enum wc_LmsState state; +#ifdef WOLF_CRYPTO_CB + /* Device Identifier. */ + int devId; +#endif +}; + +int wc_hss_make_key(LmsState* state, WC_RNG* rng, byte* priv_raw, + HssPrivKey* priv_key, byte* priv_data, byte* pub); +int wc_hss_reload_key(LmsState* state, const byte* priv_raw, + HssPrivKey* priv_key, byte* priv_data, byte* pub_root); +int wc_hss_sign(LmsState* state, byte* priv_raw, HssPrivKey* priv_key, + byte* priv_data, const byte* msg, word32 msgSz, byte* sig); +int wc_hss_sigsleft(const LmsParams* params, const byte* priv_raw); +int wc_hss_verify(LmsState* state, const byte* pub, const byte* msg, + word32 msgSz, const byte* sig); + +#endif /* WOLFSSL_HAVE_LMS && WOLFSSL_WC_LMS */ + +#endif /* WC_LMS_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/wc_mlkem.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/wc_mlkem.h @@ -0,0 +1,375 @@ +/* wc_mlkem.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/wc_mlkem.h +*/ + + +#ifndef WOLF_CRYPT_WC_MLKEM_H +#define WOLF_CRYPT_WC_MLKEM_H + +#include <wolfssl/wolfcrypt/types.h> +#include <wolfssl/wolfcrypt/random.h> +#include <wolfssl/wolfcrypt/sha3.h> +#include <wolfssl/wolfcrypt/mlkem.h> + +#ifdef WOLFSSL_HAVE_MLKEM + +#ifdef WOLFSSL_KYBER_NO_MAKE_KEY + #define WOLFSSL_MLKEM_NO_MAKE_KEY +#endif +#ifdef WOLFSSL_KYBER_NO_ENCAPSULATE + #define WOLFSSL_MLKEM_NO_ENCAPSULATE +#endif +#ifdef WOLFSSL_KYBER_NO_DECAPSULATE + #define WOLFSSL_MLKEM_NO_DECAPSULATE +#endif + +#ifdef noinline + #define MLKEM_NOINLINE noinline +#elif defined(_MSC_VER) + #define MLKEM_NOINLINE __declspec(noinline) +#elif defined(__GNUC__) + #define MLKEM_NOINLINE __attribute__((noinline)) +#else + #define MLKEM_NOINLINE +#endif + +enum { + /* Flags of Kyber keys. */ + MLKEM_FLAG_PRIV_SET = 0x0001, + MLKEM_FLAG_PUB_SET = 0x0002, + MLKEM_FLAG_BOTH_SET = 0x0003, + MLKEM_FLAG_H_SET = 0x0004, + MLKEM_FLAG_A_SET = 0x0008, + + /* 2 bits of random used to create noise value. */ + MLKEM_CBD_ETA2 = 2, + /* 3 bits of random used to create noise value. */ + MLKEM_CBD_ETA3 = 3, + + /* Number of bits to compress to. */ + MLKEM_COMP_4BITS = 4, + MLKEM_COMP_5BITS = 5, + MLKEM_COMP_10BITS = 10, + MLKEM_COMP_11BITS = 11, +}; + + +/* SHAKE128 rate. */ +#define XOF_BLOCK_SIZE 168 + +/* Modulus of co-efficients of polynomial. */ +#define MLKEM_Q 3329 + + +/* Kyber-512 parameters */ +#ifdef WOLFSSL_WC_ML_KEM_512 +/* Number of bits of random to create noise from. */ +#define WC_ML_KEM_512_ETA1 MLKEM_CBD_ETA3 +#endif /* WOLFSSL_WC_ML_KEM_512 */ + +/* Kyber-768 parameters */ +#ifdef WOLFSSL_WC_ML_KEM_768 +/* Number of bits of random to create noise from. */ +#define WC_ML_KEM_768_ETA1 MLKEM_CBD_ETA2 +#endif /* WOLFSSL_WC_ML_KEM_768 */ + +/* Kyber-1024 parameters */ +#ifdef WOLFSSL_WC_ML_KEM_1024 +/* Number of bits of random to create noise from. */ +#define WC_ML_KEM_1024_ETA1 MLKEM_CBD_ETA2 +#endif /* WOLFSSL_KYBER1024 */ + + + +/* The data type of the hash function. */ +#define MLKEM_HASH_T wc_Sha3 + +/* The data type of the pseudo-random function. */ +#define MLKEM_PRF_T wc_Shake + +/* ML-KEM key. */ +struct MlKemKey { + /* Type of key: WC_ML_KEM_512, WC_ML_KEM_768, WC_ML_KEM_1024 */ + int type; + /* Dynamic memory allocation hint. */ + void* heap; +#if defined(WOLF_CRYPTO_CB) + /* Device Id. */ + int devId; +#endif + /* Flags indicating what is stored in the key. */ + int flags; + + /* A pseudo-random function object. */ + MLKEM_HASH_T hash; + /* A pseudo-random function object. */ + MLKEM_PRF_T prf; + + /* Private key as a vector. */ + sword16 priv[WC_ML_KEM_MAX_K * MLKEM_N]; + /* Public key as a vector. */ + sword16 pub[WC_ML_KEM_MAX_K * MLKEM_N]; + /* Public seed. */ + byte pubSeed[WC_ML_KEM_SYM_SZ]; + /* Public hash - hash of encoded public key. */ + byte h[WC_ML_KEM_SYM_SZ]; + /* Randomizer for decapsulation. */ + byte z[WC_ML_KEM_SYM_SZ]; +#ifdef WOLFSSL_MLKEM_CACHE_A + /* A matrix from key generation. */ + sword16 a[WC_ML_KEM_MAX_K * WC_ML_KEM_MAX_K * MLKEM_N]; +#endif +}; + +#ifdef __cplusplus + extern "C" { +#endif + +WOLFSSL_LOCAL +void mlkem_init(void); + +#ifndef WOLFSSL_MLKEM_MAKEKEY_SMALL_MEM +WOLFSSL_LOCAL +void mlkem_keygen(sword16* priv, sword16* pub, sword16* e, const sword16* a, + int kp); +#else +WOLFSSL_LOCAL +int mlkem_keygen_seeds(sword16* priv, sword16* pub, MLKEM_PRF_T* prf, + sword16* e, int kp, byte* seed, byte* noiseSeed); +#endif +#ifndef WOLFSSL_MLKEM_ENCAPSULATE_SMALL_MEM +WOLFSSL_LOCAL +void mlkem_encapsulate(const sword16* pub, sword16* bp, sword16* v, + const sword16* at, sword16* sp, const sword16* ep, const sword16* epp, + const sword16* m, int kp); +#else +WOLFSSL_LOCAL +int mlkem_encapsulate_seeds(const sword16* pub, MLKEM_PRF_T* prf, sword16* bp, + sword16* tp, sword16* sp, int kp, const byte* msg, byte* seed, + byte* coins); +#endif +WOLFSSL_LOCAL +void mlkem_decapsulate(const sword16* priv, sword16* mp, sword16* bp, + const sword16* v, int kp); + +WOLFSSL_LOCAL +int mlkem_gen_matrix(MLKEM_PRF_T* prf, sword16* a, int kp, byte* seed, + int transposed); +WOLFSSL_LOCAL +int mlkem_get_noise(MLKEM_PRF_T* prf, int kp, sword16* vec1, sword16* vec2, + sword16* poly, byte* seed); + +#if defined(USE_INTEL_SPEEDUP) || \ + (defined(WOLFSSL_ARMASM) && defined(__aarch64__)) +WOLFSSL_LOCAL +int mlkem_kdf(byte* seed, int seedLen, byte* out, int outLen); +#endif +WOLFSSL_LOCAL +void mlkem_hash_init(MLKEM_HASH_T* hash); +WOLFSSL_LOCAL +int mlkem_hash_new(MLKEM_HASH_T* hash, void* heap, int devId); +WOLFSSL_LOCAL +void mlkem_hash_free(MLKEM_HASH_T* hash); +WOLFSSL_LOCAL +int mlkem_hash256(wc_Sha3* hash, const byte* data, word32 dataLen, byte* out); +WOLFSSL_LOCAL +int mlkem_hash512(wc_Sha3* hash, const byte* data1, word32 data1Len, + const byte* data2, word32 data2Len, byte* out); + +WOLFSSL_LOCAL +int mlkem_derive_secret(MLKEM_PRF_T* prf, const byte* z, const byte* ct, + word32 ctSz, byte* ss); + +WOLFSSL_LOCAL +void mlkem_prf_init(MLKEM_PRF_T* prf); +WOLFSSL_LOCAL +int mlkem_prf_new(MLKEM_PRF_T* prf, void* heap, int devId); +WOLFSSL_LOCAL +void mlkem_prf_free(MLKEM_PRF_T* prf); + +WOLFSSL_LOCAL +int mlkem_cmp(const byte* a, const byte* b, int sz); + +WOLFSSL_LOCAL +void mlkem_vec_compress_10(byte* r, sword16* v, unsigned int kp); +WOLFSSL_LOCAL +void mlkem_vec_compress_11(byte* r, sword16* v); +WOLFSSL_LOCAL +void mlkem_vec_decompress_10(sword16* v, const unsigned char* b, + unsigned int kp); +WOLFSSL_LOCAL +void mlkem_vec_decompress_11(sword16* v, const unsigned char* b); + +WOLFSSL_LOCAL +void mlkem_compress_4(byte* b, sword16* p); +WOLFSSL_LOCAL +void mlkem_compress_5(byte* b, sword16* p); +WOLFSSL_LOCAL +void mlkem_decompress_4(sword16* p, const unsigned char* b); +WOLFSSL_LOCAL +void mlkem_decompress_5(sword16* p, const unsigned char* b); + +WOLFSSL_LOCAL +void mlkem_from_msg(sword16* p, const byte* msg); +WOLFSSL_LOCAL +void mlkem_to_msg(byte* msg, sword16* p); +WOLFSSL_LOCAL +void mlkem_from_bytes(sword16* p, const byte* b, int k); +WOLFSSL_LOCAL +void mlkem_to_bytes(byte* b, sword16* p, int k); + +#ifdef USE_INTEL_SPEEDUP +WOLFSSL_LOCAL +void mlkem_keygen_avx2(sword16* priv, sword16* pub, sword16* e, + const sword16* a, int kp); +WOLFSSL_LOCAL +void mlkem_encapsulate_avx2(const sword16* pub, sword16* bp, sword16* v, + const sword16* at, sword16* sp, const sword16* ep, const sword16* epp, + const sword16* m, int kp); +WOLFSSL_LOCAL +void mlkem_decapsulate_avx2(const sword16* priv, sword16* mp, sword16* bp, + const sword16* v, int kp); + +WOLFSSL_LOCAL +unsigned int mlkem_rej_uniform_n_avx2(sword16* p, unsigned int len, + const byte* r, unsigned int rLen); +WOLFSSL_LOCAL +unsigned int mlkem_rej_uniform_avx2(sword16* p, unsigned int len, const byte* r, + unsigned int rLen); +WOLFSSL_LOCAL +void mlkem_redistribute_21_rand_avx2(const word64* s, byte* r0, byte* r1, + byte* r2, byte* r3); +void mlkem_redistribute_17_rand_avx2(const word64* s, byte* r0, byte* r1, + byte* r2, byte* r3); +void mlkem_redistribute_16_rand_avx2(const word64* s, byte* r0, byte* r1, + byte* r2, byte* r3); +void mlkem_redistribute_8_rand_avx2(const word64* s, byte* r0, byte* r1, + byte* r2, byte* r3); + +WOLFSSL_LOCAL +void mlkem_sha3_128_blocksx4_seed_avx2(word64* s, byte* seed); +WOLFSSL_LOCAL +void mlkem_sha3_256_blocksx4_seed_avx2(word64* s, byte* seed); + +WOLFSSL_LOCAL +void mlkem_cbd_eta2_avx2(sword16* p, const byte* r); +WOLFSSL_LOCAL +void mlkem_cbd_eta3_avx2(sword16* p, const byte* r); + +WOLFSSL_LOCAL +void mlkem_from_msg_avx2(sword16* p, const byte* msg); +WOLFSSL_LOCAL +void mlkem_to_msg_avx2(byte* msg, sword16* p); + +WOLFSSL_LOCAL +void mlkem_from_bytes_avx2(sword16* p, const byte* b); +WOLFSSL_LOCAL +void mlkem_to_bytes_avx2(byte* b, sword16* p); + +WOLFSSL_LOCAL +void mlkem_compress_10_avx2(byte* r, const sword16* p, int n); +WOLFSSL_LOCAL +void mlkem_decompress_10_avx2(sword16* p, const byte* r, int n); +WOLFSSL_LOCAL +void mlkem_compress_11_avx2(byte* r, const sword16* p, int n); +WOLFSSL_LOCAL +void mlkem_decompress_11_avx2(sword16* p, const byte* r, int n); + +WOLFSSL_LOCAL +void mlkem_compress_4_avx2(byte* r, const sword16* p); +WOLFSSL_LOCAL +void mlkem_decompress_4_avx2(sword16* p, const byte* r); +WOLFSSL_LOCAL +void mlkem_compress_5_avx2(byte* r, const sword16* p); +WOLFSSL_LOCAL +void mlkem_decompress_5_avx2(sword16* p, const byte* r); + + +WOLFSSL_LOCAL +int mlkem_cmp_avx2(const byte* a, const byte* b, int sz); +#elif defined(__aarch64__) && defined(WOLFSSL_ARMASM) +WOLFSSL_LOCAL void mlkem_ntt(sword16* r); +WOLFSSL_LOCAL void mlkem_invntt(sword16* r); +WOLFSSL_LOCAL void mlkem_ntt_sqrdmlsh(sword16* r); +WOLFSSL_LOCAL void mlkem_invntt_sqrdmlsh(sword16* r); +WOLFSSL_LOCAL void mlkem_basemul_mont(sword16* r, const sword16* a, + const sword16* b); +WOLFSSL_LOCAL void mlkem_basemul_mont_add(sword16* r, const sword16* a, + const sword16* b); +WOLFSSL_LOCAL void mlkem_add_reduce(sword16* r, const sword16* a); +WOLFSSL_LOCAL void mlkem_add3_reduce(sword16* r, const sword16* a, + const sword16* b); +WOLFSSL_LOCAL void mlkem_rsub_reduce(sword16* r, const sword16* a); +WOLFSSL_LOCAL void mlkem_to_mont(sword16* p); +WOLFSSL_LOCAL void mlkem_to_mont_sqrdmlsh(sword16* p); +WOLFSSL_LOCAL void mlkem_sha3_blocksx3_neon(word64* state); +WOLFSSL_LOCAL void mlkem_shake128_blocksx3_seed_neon(word64* state, byte* seed); +WOLFSSL_LOCAL void mlkem_shake256_blocksx3_seed_neon(word64* state, byte* seed); +WOLFSSL_LOCAL unsigned int mlkem_rej_uniform_neon(sword16* p, unsigned int len, + const byte* r, unsigned int rLen); +WOLFSSL_LOCAL int mlkem_cmp_neon(const byte* a, const byte* b, int sz); +WOLFSSL_LOCAL void mlkem_csubq_neon(sword16* p); +WOLFSSL_LOCAL void mlkem_from_msg_neon(sword16* p, const byte* msg); +WOLFSSL_LOCAL void mlkem_to_msg_neon(byte* msg, sword16* p); +#elif defined(WOLFSSL_ARMASM_THUMB2) && defined(WOLFSSL_ARMASM) +#define mlkem_ntt mlkem_thumb2_ntt +#define mlkem_invntt mlkem_thumb2_invntt +#define mlkem_basemul_mont mlkem_thumb2_basemul_mont +#define mlkem_basemul_mont_add mlkem_thumb2_basemul_mont_add +#define mlkem_rej_uniform_c mlkem_thumb2_rej_uniform + +WOLFSSL_LOCAL void mlkem_thumb2_ntt(sword16* r); +WOLFSSL_LOCAL void mlkem_thumb2_invntt(sword16* r); +WOLFSSL_LOCAL void mlkem_thumb2_basemul_mont(sword16* r, const sword16* a, + const sword16* b); +WOLFSSL_LOCAL void mlkem_thumb2_basemul_mont_add(sword16* r, const sword16* a, + const sword16* b); +WOLFSSL_LOCAL void mlkem_thumb2_csubq(sword16* p); +WOLFSSL_LOCAL unsigned int mlkem_thumb2_rej_uniform(sword16* p, + unsigned int len, const byte* r, unsigned int rLen); +#elif defined(WOLFSSL_ARMASM) +#define mlkem_ntt mlkem_arm32_ntt +#define mlkem_invntt mlkem_arm32_invntt +#define mlkem_basemul_mont mlkem_arm32_basemul_mont +#define mlkem_basemul_mont_add mlkem_arm32_basemul_mont_add +#define mlkem_rej_uniform_c mlkem_arm32_rej_uniform + +WOLFSSL_LOCAL void mlkem_arm32_ntt(sword16* r); +WOLFSSL_LOCAL void mlkem_arm32_invntt(sword16* r); +WOLFSSL_LOCAL void mlkem_arm32_basemul_mont(sword16* r, const sword16* a, + const sword16* b); +WOLFSSL_LOCAL void mlkem_arm32_basemul_mont_add(sword16* r, const sword16* a, + const sword16* b); +WOLFSSL_LOCAL void mlkem_arm32_csubq(sword16* p); +WOLFSSL_LOCAL unsigned int mlkem_arm32_rej_uniform(sword16* p, unsigned int len, + const byte* r, unsigned int rLen); +#endif + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_HAVE_MLKEM */ + +#endif /* WOLF_CRYPT_WC_MLKEM_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/wc_port.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/wc_port.h @@ -0,0 +1,1599 @@ +/* wc_port.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/wc_port.h +*/ + +#ifndef WOLF_CRYPT_PORT_H +#define WOLF_CRYPT_PORT_H + +#include <wolfssl/wolfcrypt/settings.h> +#include <wolfssl/wolfcrypt/visibility.h> + +#ifdef __cplusplus + extern "C" { +#endif + +/* Detect if compiler supports C99. "NO_WOLF_C99" can be defined in + * user_settings.h to disable checking for C99 support. */ +#if !defined(WOLF_C99) && defined(__STDC_VERSION__) && \ + !defined(WOLFSSL_ARDUINO) && !defined(NO_WOLF_C99) + #if __STDC_VERSION__ >= 199901L + #define WOLF_C99 + #endif +#endif + + +/* GENERIC INCLUDE SECTION */ +#if defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX) + #include <mqx.h> + #if (defined(MQX_USE_IO_OLD) && MQX_USE_IO_OLD) || \ + defined(FREESCALE_MQX_5_0) + #include <fio.h> + #else + #include <nio.h> + #endif +#endif + +#if defined(WOLFSSL_MAX3266X) || defined(WOLFSSL_MAX3266X_OLD) + #include <wolfssl/wolfcrypt/port/maxim/max3266x.h> +#endif + +#ifdef WOLFSSL_LINUXKM + #include "../../linuxkm/linuxkm_wc_port.h" +#endif /* WOLFSSL_LINUXKM */ + +#ifndef WARN_UNUSED_RESULT + #if defined(WOLFSSL_LINUXKM) && defined(__must_check) + #define WARN_UNUSED_RESULT __must_check + #elif (defined(__GNUC__) && (__GNUC__ >= 4)) || \ + (defined(__IAR_SYSTEMS_ICC__) && (__VER__ >= 9040001)) + #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) + #else + #define WARN_UNUSED_RESULT + #endif +#endif /* !WARN_UNUSED_RESULT */ + +#ifndef WC_MAYBE_UNUSED + #if (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) || \ + defined(__IAR_SYSTEMS_ICC__) + #define WC_MAYBE_UNUSED __attribute__((unused)) + #else + #define WC_MAYBE_UNUSED + #endif +#endif /* !WC_MAYBE_UNUSED */ + +#ifndef WC_DEPRECATED + #ifdef WOLFSSL_ZEPHYR + #define WC_DEPRECATED(msg) /* null expansion */ + #elif ((defined(__GNUC__) && \ + ((__GNUC__ >= 5) || \ + ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5))))) || \ + defined(__clang__) + #define WC_DEPRECATED(msg) __attribute__((deprecated(msg))) + #elif defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) || \ + defined(_WIN32_WCE) || defined(__WATCOMC__) + #define WC_DEPRECATED(msg) __declspec(deprecated(msg)) + #elif (defined(__GNUC__) && (__GNUC__ >= 4)) || \ + defined(__IAR_SYSTEMS_ICC__) + #define WC_DEPRECATED(msg) __attribute__((deprecated)) + #else + #define WC_DEPRECATED(msg) /* null expansion */ + #endif +#endif /* !WC_MAYBE_UNUSED */ + +/* use inlining if compiler allows */ +#ifndef WC_INLINE +#ifndef NO_INLINE + #ifdef _MSC_VER + #define WC_INLINE __inline + #elif defined(__GNUC__) + #ifdef WOLFSSL_VXWORKS + #define WC_INLINE __inline__ + #else + #define WC_INLINE inline + #endif + #elif defined(__IAR_SYSTEMS_ICC__) + #define WC_INLINE inline + #elif defined(THREADX) + #define WC_INLINE _Inline + #elif defined(__ghc__) + #ifndef __cplusplus + #define WC_INLINE __inline + #else + #define WC_INLINE inline + #endif + #elif defined(__CCRX__) + #define WC_INLINE inline + #elif defined(__DCC__) + #ifndef __cplusplus + #define WC_INLINE __inline__ + #else + #define WC_INLINE inline + #endif + #else + #define WC_INLINE WC_MAYBE_UNUSED + #endif +#else + #define WC_INLINE WC_MAYBE_UNUSED +#endif +#endif + +#ifndef WC_OMIT_FRAME_POINTER + #if defined(__GNUC__) + #define WC_OMIT_FRAME_POINTER \ + __attribute__((optimize("-fomit-frame-pointer"))) + #else + #define WC_OMIT_FRAME_POINTER + #endif +#endif + +/* THREADING/MUTEX SECTION */ +#if defined(SINGLE_THREADED) && defined(NO_FILESYSTEM) + /* No system headers required for build. */ +#elif defined(__WATCOMC__) + #if defined(SINGLE_THREADED) + #if defined(USE_WINDOWS_API) + #define _WINSOCKAPI_ /* block inclusion of winsock.h header file */ + #include <windows.h> + #undef _WINSOCKAPI_ /* undefine it for MINGW winsock2.h header */ + #ifndef WOLFSSL_USER_IO + #include <winsock2.h> + #include <ws2tcpip.h> /* required for InetPton */ + #endif + #elif defined(__OS2__) + #include <os2.h> + #endif + #else + #if defined(USE_WINDOWS_API) + #define _WINSOCKAPI_ /* block inclusion of winsock.h header file */ + #include <windows.h> + #undef _WINSOCKAPI_ /* undefine it for MINGW winsock2.h header */ + #include <process.h> + #ifndef WOLFSSL_USER_IO + #include <winsock2.h> + #include <ws2tcpip.h> /* required for InetPton */ + #endif + #elif defined(__OS2__) + #define INCL_DOSSEMAPHORES + #define INCL_DOSPROCESS + #include <os2.h> + #include <process.h> + #else + #ifndef WOLFSSL_USER_MUTEX + #define WOLFSSL_PTHREADS + #endif + #if defined(WOLFSSL_PTHREADS) + #include <pthread.h> + #endif + #endif + #endif +#elif defined(USE_WINDOWS_API) + #if defined(WOLFSSL_PTHREADS) + #include <pthread.h> + #endif + #ifdef WOLFSSL_GAME_BUILD + #include "system/xtl.h" + #else + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif + #if !defined(WOLFSSL_SGX) && !defined(WOLFSSL_NOT_WINDOWS_API) + #define _WINSOCKAPI_ /* block inclusion of winsock.h header file. */ + #include <windows.h> + #undef _WINSOCKAPI_ /* undefine it for MINGW winsock2.h header */ + #ifndef WOLFSSL_USER_IO + #include <winsock2.h> + #include <ws2tcpip.h> /* required for InetPton */ + #endif + #endif /* WOLFSSL_SGX */ + #endif + #if !defined(SINGLE_THREADED) && !defined(_WIN32_WCE) + #include <process.h> + #endif +#elif defined(THREADX) + #ifndef SINGLE_THREADED + #ifdef NEED_THREADX_TYPES + #include <types.h> + #endif + #include <tx_api.h> + #endif +#elif defined(WOLFSSL_DEOS) + #include "mutexapi.h" +#elif defined(MICRIUM) + /* do nothing, just don't pick Unix */ +#elif defined(FREERTOS) || defined(FREERTOS_TCP) || defined(WOLFSSL_SAFERTOS) + /* do nothing */ +#elif defined(RTTHREAD) + /* do nothing */ +#elif defined(EBSNET) + /* do nothing */ +#elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX) + /* do nothing */ +#elif defined(FREESCALE_FREE_RTOS) + #include "fsl_os_abstraction.h" +#elif defined(WOLFSSL_VXWORKS) + #include <semLib.h> + #ifdef WOLFSSL_VXWORKS_6_x + #ifndef SEM_ID_NULL + #define SEM_ID_NULL ((SEM_ID)NULL) + #endif + #endif +#elif defined(WOLFSSL_uITRON4) + #include "stddef.h" + #include "kernel.h" +#elif defined(WOLFSSL_uTKERNEL2) + #include "tk/tkernel.h" +#elif defined(WOLFSSL_CMSIS_RTOS) + #include "cmsis_os.h" +#elif defined(WOLFSSL_CMSIS_RTOSv2) + #include "cmsis_os2.h" +#elif defined(WOLFSSL_MDK_ARM) + #if defined(WOLFSSL_MDK5) + #include "cmsis_os.h" + #else + #include <rtl.h> + #endif +#elif defined(WOLFSSL_CMSIS_RTOS) + #include "cmsis_os.h" +#elif defined(WOLFSSL_TIRTOS) + #include <ti/sysbios/BIOS.h> + #include <ti/sysbios/knl/Task.h> + #include <ti/sysbios/knl/Semaphore.h> +#elif defined(WOLFSSL_FROSTED) + #include <semaphore.h> +#elif defined(INTIME_RTOS) + #include <rt.h> + #include <io.h> +#elif defined(WOLFSSL_NUCLEUS_1_2) + /* NU_DEBUG needed struct access in nucleus_realloc */ + #define NU_DEBUG + #include "plus/nucleus.h" + #include "nucleus.h" +#elif defined(WOLFSSL_APACHE_MYNEWT) + /* do nothing */ +#elif defined(WOLFSSL_ZEPHYR) + #include <version.h> + #ifndef SINGLE_THREADED + #if !defined(CONFIG_PTHREAD_IPC) && !defined(CONFIG_POSIX_THREADS) + #error "Threading needs CONFIG_PTHREAD_IPC / CONFIG_POSIX_THREADS" + #endif + #ifdef max + #undef max + #endif + #if KERNEL_VERSION_NUMBER >= 0x30100 + #include <zephyr/kernel.h> + #include <zephyr/posix/posix_types.h> + #include <zephyr/posix/pthread.h> + #else + #include <kernel.h> + #include <posix/posix_types.h> + #include <posix/pthread.h> + #endif + #define max MAX + #endif +#elif defined(WOLFSSL_TELIT_M2MB) + + /* Telit SDK uses C++ compile option (--cpp), which causes link issue + to API's if wrapped in extern "C" */ + #ifdef __cplusplus + } /* extern "C" */ + #endif + + #include "m2mb_types.h" + #include "m2mb_os_types.h" + #include "m2mb_os_api.h" + #include "m2mb_os.h" + #include "m2mb_os_mtx.h" + #ifndef NO_ASN_TIME + #include "m2mb_rtc.h" + #endif + #ifndef NO_FILESYSTEM + #include "m2mb_fs_posix.h" + #endif + + #undef kB /* eliminate conflict in asn.h */ + + #ifdef __cplusplus + extern "C" { + #endif +#elif defined(WOLFSSL_EMBOS) + /* do nothing */ +#else + #ifndef SINGLE_THREADED + #ifndef WOLFSSL_USER_MUTEX + #ifdef WOLFSSL_LINUXKM + /* definitions are in linuxkm/linuxkm_wc_port.h */ + #else + #define WOLFSSL_PTHREADS + #include <pthread.h> + #endif + #endif + #endif + #if (defined(OPENSSL_EXTRA) || defined(GOAHEAD_WS)) && \ + !defined(NO_FILESYSTEM) + #ifdef FUSION_RTOS + #include <fclunistd.h> + #else + #include <unistd.h> /* for close of BIO */ + #endif + #endif +#endif + +/* For FIPS keep the function names the same */ +#ifdef HAVE_FIPS +#define wc_InitMutex InitMutex +#define wc_FreeMutex FreeMutex +#define wc_LockMutex LockMutex +#define wc_UnLockMutex UnLockMutex +#endif /* HAVE_FIPS */ + +#ifdef SINGLE_THREADED + typedef int wolfSSL_Mutex; +#else /* MULTI_THREADED */ + /* FREERTOS comes first to enable use of FreeRTOS Windows simulator only */ + #if defined(FREERTOS) + #if defined(ESP_IDF_VERSION_MAJOR) && (ESP_IDF_VERSION_MAJOR >= 4) + typedef SemaphoreHandle_t wolfSSL_Mutex; + #else + typedef xSemaphoreHandle wolfSSL_Mutex; + #endif + #elif defined(FREERTOS_TCP) + #include "FreeRTOS.h" + #include "semphr.h" + typedef SemaphoreHandle_t wolfSSL_Mutex; + #elif defined (RTTHREAD) + #include "rtthread.h" + typedef rt_mutex_t wolfSSL_Mutex; + #elif defined(WOLFSSL_SAFERTOS) + typedef struct wolfSSL_Mutex { + signed char mutexBuffer[portQUEUE_OVERHEAD_BYTES]; + xSemaphoreHandle mutex; + } wolfSSL_Mutex; + #elif defined(USE_WINDOWS_API) && !defined(WOLFSSL_PTHREADS) + typedef CRITICAL_SECTION wolfSSL_Mutex; + #elif defined(MAXQ10XX_MUTEX) + #include <sys/mman.h> + #include <fcntl.h> + #include <pthread.h> + typedef pthread_mutex_t wolfSSL_Mutex; + int maxq_CryptHwMutexTryLock(void); + #elif defined(WOLFSSL_PTHREADS) + #ifdef WOLFSSL_USE_RWLOCK + typedef pthread_rwlock_t wolfSSL_RwLock; + #endif + typedef pthread_mutex_t wolfSSL_Mutex; + #define WOLFSSL_MUTEX_INITIALIZER(lockname) PTHREAD_MUTEX_INITIALIZER + #elif defined(THREADX) + typedef TX_MUTEX wolfSSL_Mutex; + #elif defined(WOLFSSL_DEOS) + typedef mutex_handle_t wolfSSL_Mutex; + #elif defined(MICRIUM) + typedef OS_MUTEX wolfSSL_Mutex; + #elif defined(EBSNET) + #if (defined(RTPLATFORM) && (RTPLATFORM != 0)) + typedef RTP_MUTEX wolfSSL_Mutex; + #else + typedef KS_RTIPSEM wolfSSL_Mutex; + #endif + #elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX) + typedef MUTEX_STRUCT wolfSSL_Mutex; + #elif defined(FREESCALE_FREE_RTOS) + typedef mutex_t wolfSSL_Mutex; + #elif defined(WOLFSSL_VXWORKS) + typedef SEM_ID wolfSSL_Mutex; + #elif defined(WOLFSSL_uITRON4) + typedef struct wolfSSL_Mutex { + T_CSEM sem ; + ID id ; + } wolfSSL_Mutex; + #elif defined(WOLFSSL_uTKERNEL2) + typedef struct wolfSSL_Mutex { + T_CSEM sem ; + ID id ; + } wolfSSL_Mutex; + #elif defined(WOLFSSL_MDK_ARM) + #if defined(WOLFSSL_CMSIS_RTOS) + typedef osMutexId wolfSSL_Mutex; + #else + typedef OS_MUT wolfSSL_Mutex; + #endif + #elif defined(WOLFSSL_CMSIS_RTOS) + typedef osMutexId wolfSSL_Mutex; + #elif defined(WOLFSSL_CMSIS_RTOSv2) + typedef osMutexId_t wolfSSL_Mutex; + #elif defined(WOLFSSL_TIRTOS) + typedef ti_sysbios_knl_Semaphore_Handle wolfSSL_Mutex; + #elif defined(WOLFSSL_FROSTED) + typedef mutex_t * wolfSSL_Mutex; + #elif defined(INTIME_RTOS) + typedef RTHANDLE wolfSSL_Mutex; + #elif defined(WOLFSSL_NUCLEUS_1_2) + typedef NU_SEMAPHORE wolfSSL_Mutex; + #elif defined(WOLFSSL_ZEPHYR) + typedef struct k_mutex wolfSSL_Mutex; + #elif defined(WOLFSSL_TELIT_M2MB) + typedef M2MB_OS_MTX_HANDLE wolfSSL_Mutex; + #elif defined(WOLFSSL_EMBOS) + typedef OS_MUTEX wolfSSL_Mutex; + #elif defined(WOLFSSL_USER_MUTEX) + /* typedef User_Mutex wolfSSL_Mutex; */ + #elif defined(WOLFSSL_LINUXKM) + /* definitions are in linuxkm/linuxkm_wc_port.h */ + #elif defined(__WATCOMC__) + /* OS/2 */ + typedef ULONG wolfSSL_Mutex; + #else + #error Need a mutex type in multithreaded mode + #endif /* USE_WINDOWS_API */ + +#endif /* SINGLE_THREADED */ + +#ifdef WOLFSSL_TEST_NO_MUTEX_INITIALIZER + #undef WOLFSSL_MUTEX_INITIALIZER +#endif + +#ifdef WOLFSSL_MUTEX_INITIALIZER + #define WOLFSSL_MUTEX_INITIALIZER_CLAUSE(lockname) = WOLFSSL_MUTEX_INITIALIZER(lockname) +#else + #define WOLFSSL_MUTEX_INITIALIZER_CLAUSE(lockname) /* null expansion */ +#endif + +#if !defined(WOLFSSL_USE_RWLOCK) || defined(SINGLE_THREADED) + typedef wolfSSL_Mutex wolfSSL_RwLock; +#endif + +#ifndef WOLFSSL_NO_ATOMICS +#ifdef SINGLE_THREADED + typedef int wolfSSL_Atomic_Int; + #define WOLFSSL_ATOMIC_INITIALIZER(x) (x) + #define WOLFSSL_ATOMIC_LOAD(x) (x) + #define WOLFSSL_ATOMIC_STORE(x, val) (x) = (val) + #define WOLFSSL_ATOMIC_OPS +#elif defined(HAVE_C___ATOMIC) +#ifdef __cplusplus +#if defined(__GNUC__) && defined(__ATOMIC_RELAXED) + /* C++ using direct calls to compiler built-in functions */ + typedef volatile int wolfSSL_Atomic_Int; + #define WOLFSSL_ATOMIC_INITIALIZER(x) (x) + #define WOLFSSL_ATOMIC_LOAD(x) __atomic_load_n(&(x), __ATOMIC_CONSUME) + #define WOLFSSL_ATOMIC_STORE(x, val) __atomic_store_n(&(x), val, __ATOMIC_RELEASE) + #define WOLFSSL_ATOMIC_OPS +#endif +#else + #ifdef WOLFSSL_HAVE_ATOMIC_H + /* Default C Implementation */ + #include <stdatomic.h> + typedef atomic_int wolfSSL_Atomic_Int; + #define WOLFSSL_ATOMIC_INITIALIZER(x) (x) + #define WOLFSSL_ATOMIC_LOAD(x) atomic_load(&(x)) + #define WOLFSSL_ATOMIC_STORE(x, val) atomic_store(&(x), val) + #define WOLFSSL_ATOMIC_OPS + #endif /* WOLFSSL_HAVE_ATOMIC_H */ +#endif +#elif defined(_MSC_VER) && !defined(WOLFSSL_NOT_WINDOWS_API) + /* Use MSVC compiler intrinsics for atomic ops */ + #ifdef _WIN32_WCE + #include <armintr.h> + #else + #include <intrin.h> + #endif + typedef volatile long wolfSSL_Atomic_Int; + #define WOLFSSL_ATOMIC_INITIALIZER(x) (x) + #define WOLFSSL_ATOMIC_LOAD(x) (x) + #define WOLFSSL_ATOMIC_STORE(x, val) (x) = (val) + #define WOLFSSL_ATOMIC_OPS +#endif +#endif /* WOLFSSL_NO_ATOMICS */ + +#if defined(WOLFSSL_ATOMIC_OPS) && !defined(SINGLE_THREADED) + WOLFSSL_API void wolfSSL_Atomic_Int_Init(wolfSSL_Atomic_Int* c, int i); + /* Fetch* functions return the value of the counter immediately preceding + * the effects of the function. */ + WOLFSSL_API int wolfSSL_Atomic_Int_FetchAdd(wolfSSL_Atomic_Int* c, int i); + WOLFSSL_API int wolfSSL_Atomic_Int_FetchSub(wolfSSL_Atomic_Int* c, int i); +#else + /* Code using these fallback implementations in non-SINGLE_THREADED builds + * needs to arrange its own explicit fallback to int for wolfSSL_Atomic_Int, + * which is not defined if !defined(WOLFSSL_ATOMIC_OPS) && + * !defined(SINGLE_THREADED). This forces local awareness of thread-unsafe + * semantics. + */ + #define wolfSSL_Atomic_Int_Init(c, i) (*(c) = (i)) + static WC_INLINE int wolfSSL_Atomic_Int_FetchAdd(int *c, int i) { + int ret = *c; + *c += i; + return ret; + } + static WC_INLINE int wolfSSL_Atomic_Int_FetchSub(int *c, int i) { + int ret = *c; + *c -= i; + return ret; + } +#endif + +/* Reference counting. */ +typedef struct wolfSSL_RefWithMutex { +#if !defined(SINGLE_THREADED) + wolfSSL_Mutex mutex; +#endif + int count; +} wolfSSL_RefWithMutex; + +#if defined(WOLFSSL_ATOMIC_OPS) && !defined(SINGLE_THREADED) +typedef struct wolfSSL_Ref { + wolfSSL_Atomic_Int count; +} wolfSSL_Ref; +#else +typedef struct wolfSSL_RefWithMutex wolfSSL_Ref; +#endif + +#if defined(SINGLE_THREADED) || defined(WOLFSSL_ATOMIC_OPS) + +#define wolfSSL_RefInit(ref, err) \ + do { \ + wolfSSL_Atomic_Int_Init(&(ref)->count, 1); \ + *(err) = 0; \ + } while(0) +#define wolfSSL_RefFree(ref) WC_DO_NOTHING +#define wolfSSL_RefInc(ref, err) \ + do { \ + (void)wolfSSL_Atomic_Int_FetchAdd(&(ref)->count, 1); \ + *(err) = 0; \ + } while(0) +#define wolfSSL_RefDec(ref, isZero, err) \ + do { \ + int __prev = wolfSSL_Atomic_Int_FetchSub(&(ref)->count, 1); \ + /* __prev holds the value of count before subtracting 1 */ \ + *(isZero) = (__prev == 1); \ + *(err) = 0; \ + } while(0) + +#else + +#define WOLFSSL_REFCNT_ERROR_RETURN + +#define wolfSSL_RefInit wolfSSL_RefWithMutexInit +#define wolfSSL_RefFree wolfSSL_RefWithMutexFree +#define wolfSSL_RefInc wolfSSL_RefWithMutexInc +#define wolfSSL_RefDec wolfSSL_RefWithMutexDec + +#endif + +#if defined(SINGLE_THREADED) + +#define wolfSSL_RefWithMutexInit wolfSSL_RefInit +#define wolfSSL_RefWithMutexFree wolfSSL_RefFree +#define wolfSSL_RefWithMutexInc wolfSSL_RefInc +#define wolfSSL_RefWithMutexLock(ref) 0 +#define wolfSSL_RefWithMutexUnlock(ref) 0 +#define wolfSSL_RefWithMutexDec wolfSSL_RefDec + +#else + +WOLFSSL_LOCAL void wolfSSL_RefWithMutexInit(wolfSSL_RefWithMutex* ref, + int* err); +WOLFSSL_LOCAL void wolfSSL_RefWithMutexFree(wolfSSL_RefWithMutex* ref); +WOLFSSL_LOCAL void wolfSSL_RefWithMutexInc(wolfSSL_RefWithMutex* ref, + int* err); +WOLFSSL_LOCAL int wolfSSL_RefWithMutexLock(wolfSSL_RefWithMutex* ref); +WOLFSSL_LOCAL int wolfSSL_RefWithMutexUnlock(wolfSSL_RefWithMutex* ref); +WOLFSSL_LOCAL void wolfSSL_RefWithMutexDec(wolfSSL_RefWithMutex* ref, + int* isZero, int* err); + +#endif + + +/* Enable crypt HW mutex for Freescale MMCAU, PIC32MZ or STM32 */ +#if defined(FREESCALE_MMCAU) || defined(WOLFSSL_MICROCHIP_PIC32MZ) || \ + defined(STM32_CRYPTO) || defined(STM32_HASH) || defined(STM32_RNG) || \ + defined(WOLFSSL_MAX3266X) || defined(WOLFSSL_MAX3266X_OLD) + #ifndef WOLFSSL_CRYPT_HW_MUTEX + #define WOLFSSL_CRYPT_HW_MUTEX 1 + #endif +#endif /* FREESCALE_MMCAU */ + +#ifndef WOLFSSL_CRYPT_HW_MUTEX + #define WOLFSSL_CRYPT_HW_MUTEX 0 +#endif + +#if WOLFSSL_CRYPT_HW_MUTEX + /* wolfSSL_CryptHwMutexInit is called on first wolfSSL_CryptHwMutexLock, + however it's recommended to call this directly on Hw init to avoid possible + race condition where two calls to wolfSSL_CryptHwMutexLock are made at + the same time. */ + WOLFSSL_LOCAL int wolfSSL_CryptHwMutexInit(void); + WOLFSSL_LOCAL int wolfSSL_CryptHwMutexLock(void); + WOLFSSL_LOCAL int wolfSSL_CryptHwMutexUnLock(void); +#else + /* Define stubs, since HW mutex is disabled */ + #define wolfSSL_CryptHwMutexInit() 0 /* Success */ + #define wolfSSL_CryptHwMutexLock() 0 /* Success */ + #define wolfSSL_CryptHwMutexUnLock() (void)0 /* Success */ +#endif /* WOLFSSL_CRYPT_HW_MUTEX */ + +#if defined(WOLFSSL_ALGO_HW_MUTEX) && (defined(NO_RNG_MUTEX) && \ + defined(NO_AES_MUTEX) && defined(NO_HASH_MUTEX) && defined(NO_PK_MUTEX)) + #error WOLFSSL_ALGO_HW_MUTEX does not support having all mutexes off +#endif +/* To support HW that can do different Crypto in parallel */ +#if WOLFSSL_CRYPT_HW_MUTEX && defined(WOLFSSL_ALGO_HW_MUTEX) + typedef enum { + #ifndef NO_RNG_MUTEX + rng_mutex, + #endif + #ifndef NO_AES_MUTEX + aes_mutex, + #endif + #ifndef NO_HASH_MUTEX + hash_mutex, + #endif + #ifndef NO_PK_MUTEX + pk_mutex, + #endif + } hw_mutex_algo; +#endif + +/* If algo mutex is off, or WOLFSSL_ALGO_HW_MUTEX is not define, default */ +/* to using the generic wolfSSL_CryptHwMutex */ +#if (!defined(NO_RNG_MUTEX) && defined(WOLFSSL_ALGO_HW_MUTEX)) && \ + WOLFSSL_CRYPT_HW_MUTEX + WOLFSSL_LOCAL int wolfSSL_HwRngMutexInit(void); + WOLFSSL_LOCAL int wolfSSL_HwRngMutexLock(void); + WOLFSSL_LOCAL int wolfSSL_HwRngMutexUnLock(void); +#else + #define wolfSSL_HwRngMutexInit wolfSSL_CryptHwMutexInit + #define wolfSSL_HwRngMutexLock wolfSSL_CryptHwMutexLock + #define wolfSSL_HwRngMutexUnLock wolfSSL_CryptHwMutexUnLock +#endif /* !defined(NO_RNG_MUTEX) && defined(WOLFSSL_ALGO_HW_MUTEX) */ + +#if (!defined(NO_AES_MUTEX) && defined(WOLFSSL_ALGO_HW_MUTEX)) && \ + WOLFSSL_CRYPT_HW_MUTEX + WOLFSSL_LOCAL int wolfSSL_HwAesMutexInit(void); + WOLFSSL_LOCAL int wolfSSL_HwAesMutexLock(void); + WOLFSSL_LOCAL int wolfSSL_HwAesMutexUnLock(void); +#else + #define wolfSSL_HwAesMutexInit wolfSSL_CryptHwMutexInit + #define wolfSSL_HwAesMutexLock wolfSSL_CryptHwMutexLock + #define wolfSSL_HwAesMutexUnLock wolfSSL_CryptHwMutexUnLock +#endif /* !defined(NO_AES_MUTEX) && defined(WOLFSSL_ALGO_HW_MUTEX) */ + +#if (!defined(NO_HASH_MUTEX) && defined(WOLFSSL_ALGO_HW_MUTEX)) && \ + WOLFSSL_CRYPT_HW_MUTEX + WOLFSSL_LOCAL int wolfSSL_HwHashMutexInit(void); + WOLFSSL_LOCAL int wolfSSL_HwHashMutexLock(void); + WOLFSSL_LOCAL int wolfSSL_HwHashMutexUnLock(void); +#else + #define wolfSSL_HwHashMutexInit wolfSSL_CryptHwMutexInit + #define wolfSSL_HwHashMutexLock wolfSSL_CryptHwMutexLock + #define wolfSSL_HwHashMutexUnLock wolfSSL_CryptHwMutexUnLock +#endif /* !defined(NO_HASH_MUTEX) && defined(WOLFSSL_ALGO_HW_MUTEX) */ + +#if (!defined(NO_PK_MUTEX) && defined(WOLFSSL_ALGO_HW_MUTEX)) && \ + WOLFSSL_CRYPT_HW_MUTEX + WOLFSSL_LOCAL int wolfSSL_HwPkMutexInit(void); + WOLFSSL_LOCAL int wolfSSL_HwPkMutexLock(void); + WOLFSSL_LOCAL int wolfSSL_HwPkMutexUnLock(void); +#else + #define wolfSSL_HwPkMutexInit wolfSSL_CryptHwMutexInit + #define wolfSSL_HwPkMutexLock wolfSSL_CryptHwMutexLock + #define wolfSSL_HwPkMutexUnLock wolfSSL_CryptHwMutexUnLock +#endif /* !defined(NO_PK_MUTEX) && defined(WOLFSSL_ALGO_HW_MUTEX) */ + +/* Mutex functions */ +WOLFSSL_API int wc_InitMutex(wolfSSL_Mutex* m); +WOLFSSL_API wolfSSL_Mutex* wc_InitAndAllocMutex(void); +WOLFSSL_API int wc_FreeMutex(wolfSSL_Mutex* m); +WOLFSSL_API int wc_LockMutex(wolfSSL_Mutex* m); +WOLFSSL_API int wc_UnLockMutex(wolfSSL_Mutex* m); +/* RwLock functions. Fallback to Mutex when not implemented explicitly. */ +WOLFSSL_API int wc_InitRwLock(wolfSSL_RwLock* m); +WOLFSSL_API int wc_FreeRwLock(wolfSSL_RwLock* m); +WOLFSSL_API int wc_LockRwLock_Wr(wolfSSL_RwLock* m); +WOLFSSL_API int wc_LockRwLock_Rd(wolfSSL_RwLock* m); +WOLFSSL_API int wc_UnLockRwLock(wolfSSL_RwLock* m); +#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) +/* dynamically set which mutex to use. unlock / lock is controlled by flag */ +typedef void (mutex_cb)(int flag, int type, const char* file, int line); + +WOLFSSL_API int wc_LockMutex_ex(int flag, int type, const char* file, int line); +WOLFSSL_API int wc_SetMutexCb(mutex_cb* cb); +WOLFSSL_API mutex_cb* wc_GetMutexCb(void); +#endif + +/* main crypto initialization function */ +WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Init(void); +WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void); + +#ifdef WOLFSSL_TRACK_MEMORY_VERBOSE + WOLFSSL_API long wolfCrypt_heap_peakAllocs_checkpoint(void); + WOLFSSL_API long wolfCrypt_heap_peakBytes_checkpoint(void); +#endif + + +/* FILESYSTEM SECTION */ +/* filesystem abstraction layer, used by ssl.c */ +#ifndef NO_FILESYSTEM + +#if defined(EBSNET) + #include "vfapi.h" + #include "vfile.h" + + int ebsnet_fseek(int a, long b, int c); /* Not prototyped in vfile.h per + * EBSnet feedback */ + + #define XFILE int + #define XFOPEN(NAME, MODE) vf_open((const char *)NAME, VO_RDONLY, 0) + #define XFSEEK ebsnet_fseek + #define XFTELL vf_tell + #define XFREAD(BUF, SZ, AMT, FD) vf_read(FD, BUF, SZ*AMT) + #define XFWRITE(BUF, SZ, AMT, FD) vf_write(FD, BUF, SZ*AMT) + #define XFCLOSE vf_close + #define XSEEK_SET VSEEK_SET + #define XSEEK_END VSEEK_END + #define XBADFILE -1 + #define XFGETS(b,s,f) -2 /* Not ported yet */ + #define XSNPRINTF rtp_snprintf + #define XFPRINTF fprintf + +#elif defined(LSR_FS) + #include <fs.h> + #define XFILE struct fs_file* + #define XFOPEN(NAME, MODE) fs_open((char*)NAME) + #define XFSEEK(F, O, W) (void)F + #define XFTELL(F) (F)->len + #define XFREAD(BUF, SZ, AMT, F) fs_read(F, (char*)BUF, SZ*AMT) + #define XFWRITE(BUF, SZ, AMT, F) fs_write(F, (char*)BUF, SZ*AMT) + #define XFCLOSE fs_close + #define XSEEK_SET 0 + #define XSEEK_END 0 + #define XBADFILE NULL + #define XFGETS(b,s,f) -2 /* Not ported yet */ + +#elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX) + #define XFILE MQX_FILE_PTR + #define XFOPEN fopen + #define XFSEEK fseek + #define XFTELL ftell + #define XFREAD fread + #define XFWRITE fwrite + #define XFCLOSE fclose + #define XSEEK_SET IO_SEEK_SET + #define XSEEK_END IO_SEEK_END + #define XBADFILE NULL + #define XFGETS fgets + +#elif defined(WOLFSSL_DEOS) + #define NO_FILESYSTEM + #warning "TODO - DDC-I Certifiable Fast File System for Deos is not integrated" +#elif defined(MICRIUM) + #include <fs_api.h> + #define XFILE FS_FILE* + #define XFOPEN fs_fopen + #define XFSEEK fs_fseek + #define XFTELL fs_ftell + #define XFREAD fs_fread + #define XFWRITE fs_fwrite + #define XFCLOSE fs_fclose + #define XSEEK_SET FS_SEEK_SET + #define XSEEK_END FS_SEEK_END + #define XBADFILE NULL + #define XFGETS(b,s,f) -2 /* Not ported yet */ + +#elif defined(WOLFSSL_NUCLEUS_1_2) + #include "fal/inc/fal.h" + #define XFILE FILE* + #define XFOPEN fopen + #define XFSEEK fseek + #define XFTELL ftell + #define XFREAD fread + #define XFWRITE fwrite + #define XFCLOSE fclose + #define XSEEK_SET PSEEK_SET + #define XSEEK_END PSEEK_END + #define XBADFILE NULL + +#elif defined(WOLFSSL_APACHE_MYNEWT) + #include <fs/fs.h> + #define XFILE struct fs_file* + + #define XFOPEN mynewt_fopen + #define XFSEEK mynewt_fseek + #define XFTELL mynewt_ftell + #define XFREAD mynewt_fread + #define XFWRITE mynewt_fwrite + #define XFCLOSE mynewt_fclose + #define XSEEK_SET 0 + #define XSEEK_END 2 + #define XBADFILE NULL + #define XFGETS(b,s,f) -2 /* Not ported yet */ + +#elif defined(WOLFSSL_ZEPHYR) + #include <zephyr/fs/fs.h> + + #define XFILE struct fs_file_t* + + /* These are our wrappers for opening and closing files to + * make the API more POSIX like. */ + XFILE z_fs_open(const char* filename, const char* mode); + int z_fs_close(XFILE file); + int z_fs_rewind(XFILE file); + + #define XFOPEN z_fs_open + #define XFCLOSE z_fs_close + #define XFFLUSH fs_sync + #define XFSEEK fs_seek + #define XFTELL fs_tell + #define XFREWIND z_fs_rewind + #define XFREAD(P,S,N,F) fs_read(F, P, S*N) + #define XFWRITE(P,S,N,F) fs_write(F, P, S*N) + #define XSEEK_SET FS_SEEK_SET + #define XSEEK_END FS_SEEK_END + #define XBADFILE NULL + #define XFGETS(b,s,f) -2 /* Not ported yet */ + + #define XSTAT fs_stat + #define XSTAT_TYPE struct fs_dirent + #define XS_ISREG(s) (s == FS_DIR_ENTRY_FILE) + #define SEPARATOR_CHAR ':' + +#elif defined(WOLFSSL_TELIT_M2MB) + #define XFILE INT32 + #define XFOPEN(NAME, MODE) m2mb_fs_open((NAME), 0, (MODE)) + #define XFSEEK(F, O, W) m2mb_fs_lseek((F), (O), (W)) + #define XFTELL(F) m2mb_fs_lseek((F), 0, M2MB_SEEK_END) + #define XFREAD(BUF, SZ, AMT, F) m2mb_fs_read((F), (BUF), (SZ)*(AMT)) + #define XFWRITE(BUF, SZ, AMT, F) m2mb_fs_write((F), (BUF), (SZ)*(AMT)) + #define XFCLOSE m2mb_fs_close + #define XSEEK_SET M2MB_SEEK_SET + #define XSEEK_END M2MB_SEEK_END + #define XBADFILE -1 + #define XFGETS(b,s,f) -2 /* Not ported yet */ + +#elif defined (WOLFSSL_XILINX) + #include "xsdps.h" + #include "ff.h" + + /* workaround to declare variable and provide type */ + #define XFILE FIL curFile; FIL* + #define XFOPEN(NAME, MODE) ({ FRESULT res; res = f_open(&curFile, (NAME), (FA_OPEN_ALWAYS | FA_WRITE | FA_READ)); (res == FR_OK) ? &curFile : NULL; }) + #define XFSEEK(F, O, W) f_lseek((F), (O)) + #define XFTELL(F) f_tell((F)) + #define XFREAD(BUF, SZ, AMT, F) ({ FRESULT res; UINT br; res = f_read((F), (BUF), (SZ)*(AMT), &br); (void)br; res; }) + #define XFWRITE(BUF, SZ, AMT, F) ({ FRESULT res; UINT written; res = f_write((F), (BUF), (SZ)*(AMT), &written); (void)written; res; }) + #define XFCLOSE(F) f_close((F)) + #define XSEEK_SET 0 + #define XSEEK_END 0 + #define XBADFILE NULL + #define XFGETS(b,s,f) f_gets((b), (s), (f)) +#elif defined (_WIN32_WCE) + /* stdio, WINCE case */ + #include <stdio.h> + #define XFILE FILE* + #define XFOPEN fopen + #define XFDOPEN fdopen + #define XFSEEK fseek + #define XFTELL ftell + #define XFREAD fread + #define XFWRITE fwrite + #define XFCLOSE fclose + #define XSEEK_SET SEEK_SET + #define XSEEK_END SEEK_END + #define XBADFILE NULL + #define XFGETS fgets + #define XVSNPRINTF _vsnprintf + +#elif defined(FUSION_RTOS) + #include <fclstdio.h> + #include <fclunistd.h> + #include <fcldirent.h> + #include <sys/fclstat.h> + #include <fclstring.h> + #include <fcl_os.h> + #define XFILE FCL_FILE* + #define XFOPEN FCL_FOPEN + #define XFSEEK FCL_FSEEK + #define XFTELL FCL_FTELL + #define XFREAD FCL_FREAD + #define XFWRITE FCL_FWRITE + #define XFCLOSE FCL_FCLOSE + #define XSEEK_SET SEEK_SET + #define XSEEK_END SEEK_END + #define XBADFILE NULL + #define XFGETS FCL_FGETS + #define XFPUTS FCL_FPUTS + #define XFPRINTF FCL_FPRINTF + #define XVFPRINTF FCL_VFPRINTF + #define XVSNPRINTF FCL_VSNPRINTF + #define XSNPRINTF FCL_SNPRINTF + #define XSPRINTF FCL_SPRINTF + #define DIR FCL_DIR + #define stat FCL_STAT + #define opendir FCL_OPENDIR + #define closedir FCL_CLOSEDIR + #define readdir FCL_READDIR + #define dirent fclDirent + #define strncasecmp FCL_STRNCASECMP + + /* FUSION SPECIFIC ERROR CODE */ + #define FUSION_IO_SEND_E FCL_EWOULDBLOCK + +#elif defined(WOLFSSL_USER_FILESYSTEM) + /* To be defined in user_settings.h */ +#else + /* stdio, default case */ + #include <stdio.h> + #define XFILE FILE* + #if defined(WOLFSSL_MDK_ARM) + extern FILE * wolfSSL_fopen(const char *name, const char *mode) ; + #define XFOPEN wolfSSL_fopen + #else + #define XFOPEN fopen + #endif + #define XFDOPEN fdopen + #define XFSEEK fseek + #define XFTELL ftell + #define XFREAD fread + #define XFWRITE fwrite + #define XFCLOSE fclose + #define XSEEK_SET SEEK_SET + #define XSEEK_END SEEK_END + #define XBADFILE NULL + #define XFGETS fgets + #define XFPRINTF fprintf + #define XFFLUSH fflush + #define XFEOF(fp) feof(fp) + #define XFERROR(fp) ferror(fp) + #define XCLEARERR(fp) clearerr(fp) + + #if !defined(NO_WOLFSSL_DIR)\ + && !defined(WOLFSSL_NUCLEUS) && !defined(WOLFSSL_NUCLEUS_1_2) + #if defined(__WATCOMC__) + #include <unistd.h> + #include <sys/stat.h> + #define XWRITE write + #define XREAD read + #define XCLOSE close + #define XSTAT stat + #define XS_ISREG(s) S_ISREG(s) + #if defined(__UNIX__) + #include <dirent.h> + #define SEPARATOR_CHAR ':' + #else + #include <direct.h> + #define SEPARATOR_CHAR ';' + #endif + #if defined(__NT__) + #define XALTHOMEVARNAME "USERPROFILE" + #endif + #elif defined(USE_WINDOWS_API) + #include <io.h> + #include <sys/stat.h> + #ifndef XSTAT + #define XSTAT _stat + #endif + #define XS_ISREG(s) (s & _S_IFREG) + #define SEPARATOR_CHAR ';' + #define XWRITE _write + #define XREAD _read + #define XALTHOMEVARNAME "USERPROFILE" + + #elif defined(ARDUINO) + #ifndef XSTAT + #define XSTAT _stat + #endif + #define XS_ISREG(s) (s & _S_IFREG) + #define SEPARATOR_CHAR ';' + + #elif defined(INTIME_RTOS) + #include <sys/stat.h> + #ifndef XSTAT + #define XSTAT _stat64 + #endif + #define XS_ISREG(s) S_ISREG(s) + #define SEPARATOR_CHAR ';' + #define XWRITE write + #define XREAD read + #define XCLOSE close + + #elif defined(WOLFSSL_TELIT_M2MB) + #ifndef XSTAT + #define XSTAT m2mb_fs_stat + #endif + #define XS_ISREG(s) (s & M2MB_S_IFREG) + #define SEPARATOR_CHAR ':' + + #else + #include <dirent.h> + #include <unistd.h> + #include <sys/stat.h> + #define XWRITE write + #define XREAD read + #define XCLOSE close + #ifndef XSTAT + #define XSTAT stat + #endif + #define XS_ISREG(s) S_ISREG(s) + #define SEPARATOR_CHAR ':' + #endif + + #ifndef XSTAT_TYPE + #define XSTAT_TYPE struct XSTAT + #endif + #endif /* !NO_WOLFSSL_DIR !WOLFSSL_NUCLEUS !WOLFSSL_NUCLEUS_1_2 */ +#endif + + #ifndef MAX_FILENAME_SZ + #define MAX_FILENAME_SZ (260 + 1) /* max file name length */ + #endif + #ifndef MAX_PATH + #define MAX_PATH (260 + 1) + #endif + #ifndef XFEOF + #define XFEOF(fp) 0 + #endif + #ifndef XFERROR + #define XFERROR(fp) 0 + #endif + #ifndef XCLEARERR + #define XCLEARERR(fp) WC_DO_NOTHING + #endif + + WOLFSSL_LOCAL int wc_FileLoad(const char* fname, unsigned char** buf, + size_t* bufLen, void* heap); + +#if !defined(NO_WOLFSSL_DIR) && !defined(WOLFSSL_NUCLEUS) && \ + !defined(WOLFSSL_NUCLEUS_1_2) + typedef struct ReadDirCtx { + #ifdef USE_WINDOWS_API + WIN32_FIND_DATAA FindFileData; + HANDLE hFind; + XSTAT_TYPE s; + #elif defined(WOLFSSL_ZEPHYR) + struct fs_dirent entry; + struct fs_dir_t dir; + struct fs_dirent s; + struct fs_dir_t* dirp; + + #elif defined(WOLFSSL_TELIT_M2MB) + M2MB_DIR_T* dir; + struct M2MB_DIRENT* entry; + struct M2MB_STAT s; + #elif defined(INTIME_RTOS) + struct stat64 s; + struct _find64 FindFileData; + #define IntimeFindFirst(name, data) (0 == _findfirst64(name, data)) + #define IntimeFindNext(data) (0 == _findnext64(data)) + #define IntimeFindClose(data) (0 == _findclose64(data)) + #define IntimeFilename(ctx) ctx->FindFileData.f_filename + #elif defined(ARDUINO) + /* TODO: board specific features */ + #else + struct dirent* entry; + DIR* dir; + XSTAT_TYPE s; + #endif + char name[MAX_FILENAME_SZ]; + } ReadDirCtx; + + #define WC_READDIR_NOFILE (-1) + + WOLFSSL_API int wc_ReadDirFirst(ReadDirCtx* ctx, const char* path, char** name); + WOLFSSL_API int wc_ReadDirNext(ReadDirCtx* ctx, const char* path, char** name); + WOLFSSL_API void wc_ReadDirClose(ReadDirCtx* ctx); +#endif /* !NO_WOLFSSL_DIR */ + #define WC_ISFILEEXIST_NOFILE (-1) + + WOLFSSL_API int wc_FileExists(const char* fname); + +#endif /* !NO_FILESYSTEM */ + +/* Defaults, user may over-ride with user_settings.h or in a porting section + * above + */ +#ifndef XVFPRINTF + #define XVFPRINTF vfprintf +#endif +#ifndef XVSNPRINTF + #define XVSNPRINTF vsnprintf +#endif +#ifndef XFPUTS + #define XFPUTS fputs +#endif +#ifndef XSPRINTF + #define XSPRINTF sprintf +#endif + +#ifdef USE_WINDOWS_API + #ifndef SOCKET_T + #ifdef __MINGW64__ + typedef size_t SOCKET_T; + #else + typedef unsigned int SOCKET_T; + #endif + #endif + #ifndef SOCKET_INVALID + #define SOCKET_INVALID INVALID_SOCKET + #endif +#else + #ifndef SOCKET_T + typedef int SOCKET_T; + #endif + #ifndef SOCKET_INVALID + #define SOCKET_INVALID (-1) + #endif +#endif + +/* MIN/MAX MACRO SECTION */ +/* Windows API defines its own min() macro. */ +#if defined(USE_WINDOWS_API) + #if defined(min) || defined(WOLFSSL_MYSQL_COMPATIBLE) + #undef WOLFSSL_HAVE_MIN + #define WOLFSSL_HAVE_MIN + #endif /* min */ + #if defined(max) || defined(WOLFSSL_MYSQL_COMPATIBLE) + #undef WOLFSSL_HAVE_MAX + #define WOLFSSL_HAVE_MAX + #endif /* max */ +#endif /* USE_WINDOWS_API */ + +#ifdef __QNXNTO__ + #define WOLFSSL_HAVE_MIN + #define WOLFSSL_HAVE_MAX +#endif + +/* TIME SECTION */ +/* Time functions */ +#ifndef NO_ASN_TIME +#if defined(USER_TIME) + /* Use our gmtime and time_t/struct tm types. + Only needs seconds since EPOCH using XTIME function. + time_t XTIME(time_t * timer) {} + */ + #define WOLFSSL_GMTIME + #ifndef HAVE_TM_TYPE + #define USE_WOLF_TM + #endif + #ifndef HAVE_TIME_T_TYPE + #define USE_WOLF_TIME_T + #endif + +#elif defined(TIME_OVERRIDES) + /* Override XTIME() and XGMTIME() functionality. + Requires user to provide these functions: + time_t XTIME(time_t * timer) {} + struct tm* XGMTIME(const time_t* timer, struct tm* tmp) {} + */ + #ifndef HAVE_TIME_T_TYPE + #define USE_WOLF_TIME_T + #endif + #ifndef HAVE_TM_TYPE + #define USE_WOLF_TM + #endif + #define NEED_TMP_TIME + +#elif defined(WOLFSSL_XILINX) + #ifndef XTIME + #define XTIME(t1) xilinx_time((t1)) + #endif + #include <time.h> + time_t xilinx_time(time_t * timer); + +#elif defined(HAVE_RTP_SYS) + #include "os.h" /* dc_rtc_api needs */ + #include "dc_rtc_api.h" /* to get current time */ + + /* uses partial <time.h> structures */ + #define XTIME(tl) (0) + #define XGMTIME(c, t) rtpsys_gmtime((c)) + +#elif defined(WOLFSSL_DEOS) || defined(WOLFSSL_DEOS_RTEMS) + #include <time.h> + #ifndef XTIME + extern time_t deos_time(time_t* timer); + #define XTIME(t1) deos_time((t1)) + #endif +#elif defined(MICRIUM) + #include <clk.h> + #include <time.h> + #define XTIME(t1) micrium_time((t1)) + #define WOLFSSL_GMTIME + +#elif defined(MICROCHIP_TCPIP_V5) || defined(MICROCHIP_TCPIP) + #include <time.h> + extern time_t pic32_time(time_t* timer); + #define XTIME(t1) pic32_time((t1)) + #define XGMTIME(c, t) gmtime((c)) + +#elif defined(FREESCALE_RTC) + #include <time.h> + #include "fsl_rtc.h" + #ifndef XTIME + #define XTIME(t1) fsl_time((t1)) + #endif +#elif defined(FREESCALE_SNVS_RTC) + #include <time.h> + #include "fsl_snvs_hp.h" + time_t fsl_time(time_t* t); + #ifndef XTIME + #define XTIME(t1) fsl_time((t1)) + #endif +#elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX) + #ifdef FREESCALE_MQX_4_0 + #include <time.h> + extern time_t mqx_time(time_t* timer); + #else + #define HAVE_GMTIME_R + #endif + #define XTIME(t1) mqx_time((t1)) + +#elif defined(FREESCALE_KSDK_BM) || defined(FREESCALE_FREE_RTOS) || defined(FREESCALE_KSDK_FREERTOS) + #include <time.h> + #ifndef XTIME + /*extern time_t ksdk_time(time_t* timer);*/ + #define XTIME(t1) ksdk_time((t1)) + #endif + #define XGMTIME(c, t) gmtime((c)) + +#elif defined(WOLFSSL_ATMEL) && defined(WOLFSSL_ATMEL_TIME) + #define XTIME(t1) atmel_get_curr_time_and_date((t1)) + #define WOLFSSL_GMTIME + #define USE_WOLF_TM + #define USE_WOLF_TIME_T + +#elif defined(WOLFSSL_WICED) + #include <time.h> + time_t wiced_pseudo_unix_epoch_time(time_t * timer); + #define XTIME(t1) wiced_pseudo_unix_epoch_time((t1)) + #define HAVE_GMTIME_R + +#elif defined(IDIRECT_DEV_TIME) + /*Gets the timestamp from cloak software owned by VT iDirect + in place of time() from <time.h> */ + #include <time.h> + #define XTIME(t1) idirect_time((t1)) + #define XGMTIME(c, t) gmtime((c)) + +#elif defined(_WIN32_WCE) + #define _WINSOCKAPI_ /* block inclusion of winsock.h header file */ + #include <windows.h> + #undef _WINSOCKAPI_ /* undefine it for MINGW winsock2.h header file */ + #include <stdlib.h> /* For file system */ + + time_t windows_time(time_t* timer); + + #define FindNextFileA(h, d) FindNextFile(h, (LPWIN32_FIND_DATAW) d) + #define FindFirstFileA(fn, d) FindFirstFile((LPCWSTR) fn, \ + (LPWIN32_FIND_DATAW) d) + #define XTIME(t1) windows_time((t1)) + #define WOLFSSL_GMTIME + + /* if struct tm is not defined in WINCE SDK */ + #ifndef _TM_DEFINED + struct tm { + int tm_sec; /* seconds */ + int tm_min; /* minutes */ + int tm_hour; /* hours */ + int tm_mday; /* day of month (month specific) */ + int tm_mon; /* month */ + int tm_year; /* year */ + int tm_wday; /* day of week (out of 1-7)*/ + int tm_yday; /* day of year (out of 365) */ + int tm_isdst; /* is it daylight savings */ + }; + #define _TM_DEFINED + #endif + +#elif defined(WOLFSSL_APACHE_MYNEWT) + #include "os/os_time.h" + typedef long time_t; + extern time_t mynewt_time(time_t* timer); + #define XTIME(t1) mynewt_time((t1)) + #define WOLFSSL_GMTIME + #define USE_WOLF_TM + #define USE_WOLF_TIME_T + +#elif defined(WOLFSSL_ZEPHYR) + #include <version.h> + #ifndef _POSIX_C_SOURCE + #if KERNEL_VERSION_NUMBER >= 0x30100 + #include <zephyr/posix/time.h> + #else + #include <posix/time.h> + #endif + #else + #include <time.h> + #endif + + #if defined(CONFIG_RTC) + #if defined(CONFIG_PICOLIBC) || defined(CONFIG_NEWLIB_LIBC) + #include <zephyr/drivers/rtc.h> + #else + #warning "RTC support needs picolibc or newlib (nano)" + #endif + #endif + + time_t z_time(time_t *timer); + + #define XTIME(tl) z_time((tl)) + #define XGMTIME(c, t) gmtime((c)) + +#elif defined(WOLFSSL_TELIT_M2MB) + typedef long time_t; + extern time_t m2mb_xtime(time_t * timer); + #define XTIME(tl) m2mb_xtime((tl)) + #ifdef WOLFSSL_TLS13 + extern time_t m2mb_xtime_ms(time_t * timer); + #define XTIME_MS(tl) m2mb_xtime_ms((tl)) + #endif + #ifndef NO_CRYPT_BENCHMARK + extern double m2mb_xtime_bench(int reset); + #define WOLFSSL_CURRTIME_REMAP m2mb_xtime_bench + #endif + #define XGMTIME(c, t) gmtime((c)) + #define WOLFSSL_GMTIME + #define USE_WOLF_TM + + +#elif defined(WOLFSSL_LINUXKM) + + /* definitions are in linuxkm/linuxkm_wc_port.h */ + +#elif defined(HAL_RTC_MODULE_ENABLED) + #include <time.h> + WOLFSSL_LOCAL time_t stm32_hal_time(time_t* t1); + #define XTIME(t1) stm32_hal_time(t1) + #define WOLFSSL_GMTIME +#else + /* default */ + /* uses complete <time.h> facility */ + #include <time.h> + #if defined(HAVE_SYS_TIME_H) + #include <sys/time.h> + #endif + + /* PowerPC time_t is int */ + #if defined(__PPC__) || defined(__ppc__) + #define TIME_T_NOT_64BIT + #endif + + #define XMKTIME(tm) mktime(tm) + #define XDIFFTIME(to, from) difftime(to, from) +#endif + +#ifdef SIZEOF_TIME_T + /* check if size of time_t from autoconf is less than 8 bytes (64bits) */ + #if SIZEOF_TIME_T < 8 + #undef TIME_T_NOT_64BIT + #define TIME_T_NOT_64BIT + #endif +#endif +#ifdef TIME_T_NOT_LONG + /* one old reference to TIME_T_NOT_LONG in GCC-ARM example README + * this keeps support for the old macro name */ + #undef TIME_T_NOT_64BIT + #define TIME_T_NOT_64BIT +#endif + +/* Map default time functions */ +#if !defined(XTIME) && !defined(TIME_OVERRIDES) && !defined(USER_TIME) + #ifdef TEST_BEFORE_DATE + #define XTIME(tl) (946681200UL) /* Jan 1, 2000 */ + #else + #define XTIME(tl) time((tl)) + #endif +#endif + +#if defined(WOLFSSL_GMTIME) && !defined(HAVE_GMTIME_R) + #define HAVE_GMTIME_R +#endif + +#if !defined(XGMTIME) && !defined(TIME_OVERRIDES) + /* Always use gmtime_r if available. */ + #if defined(HAVE_GMTIME_S) + /* reentrant version */ + #define XGMTIME(c, t) gmtime_s((c), (t)) + #define NEED_TMP_TIME + #elif defined(HAVE_GMTIME_R) + #define XGMTIME(c, t) gmtime_r((c), (t)) + #define NEED_TMP_TIME + #else + #define XGMTIME(c, t) gmtime((c)) + #endif +#endif +#if !defined(XVALIDATE_DATE) && !defined(HAVE_VALIDATE_DATE) + #define USE_WOLF_VALIDDATE + #define XVALIDATE_DATE(d, f, t) wc_ValidateDate((d), (f), (t)) +#endif + +/* wolf struct tm and time_t */ +#if defined(USE_WOLF_TM) + struct tm { + int tm_sec; /* seconds after the minute [0-60] */ + int tm_min; /* minutes after the hour [0-59] */ + int tm_hour; /* hours since midnight [0-23] */ + int tm_mday; /* day of the month [1-31] */ + int tm_mon; /* months since January [0-11] */ + int tm_year; /* years since 1900 */ + int tm_wday; /* days since Sunday [0-6] */ + int tm_yday; /* days since January 1 [0-365] */ + int tm_isdst; /* Daylight Savings Time flag */ + long tm_gmtoff; /* offset from CUT in seconds */ + char *tm_zone; /* timezone abbreviation */ + }; +#endif /* USE_WOLF_TM */ +#if defined(USE_WOLF_TIME_T) + typedef long time_t; +#endif +#if defined(USE_WOLF_SUSECONDS_T) + typedef long suseconds_t; +#endif +#if defined(USE_WOLF_TIMEVAL_T) + struct timeval + { + time_t tv_sec; + suseconds_t tv_usec; + }; +#endif + + /* forward declarations */ +#if defined(USER_TIME) + struct tm* gmtime(const time_t* timer); + extern time_t XTIME(time_t * timer); + + #ifdef STACK_TRAP + /* for stack trap tracking, don't call os gmtime on OS X/linux, + uses a lot of stack spce */ + extern time_t time(time_t * timer); + #define XTIME(tl) time((tl)) + #endif /* STACK_TRAP */ + +#elif defined(TIME_OVERRIDES) + extern time_t XTIME(time_t * timer); + extern struct tm* XGMTIME(const time_t* timer, struct tm* tmp); +#elif defined(WOLFSSL_GMTIME) + struct tm* gmtime(const time_t* timer); + struct tm* gmtime_r(const time_t* timer, struct tm *ret); +#endif +#endif /* !NO_ASN_TIME */ + + +#if (!defined(WOLFSSL_LEANPSK) && !defined(STRING_USER)) || \ + defined(USE_WOLF_STRNSTR) + char* mystrnstr(const char* s1, const char* s2, unsigned int n); +#endif + +#ifndef FILE_BUFFER_SIZE + /* default static file buffer size for input, will use dynamic buffer if + * not big enough */ + #ifdef WOLFSSL_CERT_EXT + #define FILE_BUFFER_SIZE (3*1024) + #else + #define FILE_BUFFER_SIZE (1*1024) + #endif +#endif + +#ifdef HAVE_CAVIUM_OCTEON_SYNC + /* By default, the OCTEON's global variables are all thread local. This + * tag allows them to be shared between threads. */ + #include "cvmx-platform.h" + #define WC_THREADSHARED CVMX_SHARED +#else + #define WC_THREADSHARED +#endif + +#ifdef WOLFSSL_DSP + #include "wolfssl_dsp.h" + + /* callbacks for setting handle */ + typedef int (*wolfSSL_DSP_Handle_cb)(remote_handle64 *handle, int finished, + void *ctx); + WOLFSSL_API int wolfSSL_GetHandleCbSet(); + WOLFSSL_API int wolfSSL_SetHandleCb(wolfSSL_DSP_Handle_cb in); + WOLFSSL_LOCAL int wolfSSL_InitHandle(); + WOLFSSL_LOCAL void wolfSSL_CleanupHandle(); +#endif + +#ifdef WOLFSSL_SCE + #ifndef WOLFSSL_SCE_GSCE_HANDLE + #define WOLFSSL_SCE_GSCE_HANDLE g_sce + #endif +#endif + +#ifdef WOLF_C99 + /* use alternate keyword for compatibility with -std=c99 */ + #define XASM_VOLATILE(a) __asm__ volatile(a) +#elif defined(__IAR_SYSTEMS_ICC__) + #define XASM_VOLATILE(a) asm volatile(a) +#elif defined(__KEIL__) + #define XASM_VOLATILE(a) __asm volatile(a) +#else + #define XASM_VOLATILE(a) __asm__ __volatile__(a) +#endif + +#ifndef WOLFSSL_NO_FENCE + #ifdef XFENCE + /* use user-supplied XFENCE definition. */ + #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ + !defined(__STDC_NO_ATOMICS__) + #include <stdatomic.h> + #define XFENCE() atomic_thread_fence(memory_order_seq_cst) + #elif defined(__GNUC__) && (__GNUC__ == 4) && \ + defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 1) + #define XFENCE() __sync_synchronize() + #elif (defined(__GNUC__) && (__GNUC__ >= 5)) || defined (__clang__) + #define XFENCE() __atomic_thread_fence(__ATOMIC_SEQ_CST) + #elif defined(WOLFSSL_NO_ASM) + #define XFENCE() WC_DO_NOTHING + #elif defined (__i386__) || defined(__x86_64__) + #define XFENCE() XASM_VOLATILE("lfence") + #elif defined (__arm__) && (__ARM_ARCH > 6) + #define XFENCE() XASM_VOLATILE("isb") + #elif defined(__aarch64__) + /* Change ".inst 0xd50330ff" to "sb" when compilers support it. */ + #ifdef WOLFSSL_ARMASM_BARRIER_SB + #define XFENCE() XASM_VOLATILE(".inst 0xd50330ff") + #elif defined(WOLFSSL_ARMASM_BARRIER_DETECT) + extern int aarch64_use_sb; + #define XFENCE() \ + do { \ + if (aarch64_use_sb) \ + XASM_VOLATILE(".inst 0xd50330ff"); \ + else \ + XASM_VOLATILE("isb"); \ + } while (0) + #else + #define XFENCE() XASM_VOLATILE("isb") + #endif + #elif defined(__riscv) + #define XFENCE() XASM_VOLATILE("fence") + #elif defined(__PPC__) || defined(__POWERPC__) + #define XFENCE() XASM_VOLATILE("isync; sync") + #else + #define XFENCE() WC_DO_NOTHING + #endif +#else + #define XFENCE() WC_DO_NOTHING +#endif + + + /* AFTER user_settings.h is loaded, + ** determine if POSIX multi-threaded: HAVE_PTHREAD */ + #if defined(SINGLE_THREADED) || defined(__MINGW32__) + /* Never HAVE_PTHREAD in single thread, or non-POSIX mode. + ** Reminder: MING32 is win32 threads, not POSIX threads */ + #undef HAVE_PTHREAD + #else + /* _POSIX_THREADS is defined by unistd.h so this check needs to happen + * after we include all the platform relevant libs. */ + #ifdef _POSIX_THREADS + /* HAVE_PTHREAD == POSIX threads capable and enabled. */ + #undef HAVE_PTHREAD + #define HAVE_PTHREAD 1 + #endif + #endif + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLF_CRYPT_PORT_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/wc_xmss.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/wc_xmss.h @@ -0,0 +1,285 @@ +/* wc_xmss.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* Based on: + * o RFC 8391 - XMSS: eXtended Merkle Signature Scheme + * o [HDSS] "Hash-based Digital Signature Schemes", Buchmann, Dahmen and Szydlo + * from "Post Quantum Cryptography", Springer 2009. + */ + +#ifndef WC_XMSS_H +#define WC_XMSS_H + +#ifdef WOLFSSL_HAVE_XMSS +#include <wolfssl/wolfcrypt/xmss.h> +#include <wolfssl/wolfcrypt/sha256.h> +#include <wolfssl/wolfcrypt/sha512.h> +#include <wolfssl/wolfcrypt/sha3.h> + +#if !defined(WOLFSSL_WC_XMSS) + #error "This code is incompatible with external implementation of XMSS." +#endif + +#if (defined(WC_XMSS_SHA512) || defined(WC_XMSS_SHAKE256)) && \ + (WOLFSSL_WC_XMSS_MAX_HASH_SIZE >= 512) + #define WC_XMSS_MAX_N 64 + #define WC_XMSS_MAX_PADDING_LEN 64 +#else + #define WC_XMSS_MAX_N 32 + #define WC_XMSS_MAX_PADDING_LEN 32 +#endif +#define WC_XMSS_MAX_MSG_PRE_LEN \ + (WC_XMSS_MAX_PADDING_LEN + 3 * WC_XMSS_MAX_N) +#define WC_XMSS_MAX_TREE_HEIGHT 20 +#define WC_XMSS_MAX_CSUM_BYTES 4 +#define WC_XMSS_MAX_WOTS_LEN (8 * WC_XMSS_MAX_N / 4 + 3) +#define WC_XMSS_MAX_WOTS_SIG_LEN (WC_XMSS_MAX_WOTS_LEN * WC_XMSS_MAX_N) +#define WC_XMSS_MAX_STACK_LEN \ + ((WC_XMSS_MAX_TREE_HEIGHT + 1) * WC_XMSS_MAX_N) +#define WC_XMSS_MAX_D 12 +#define WC_XMSS_MAX_BDS_STATES (2 * WC_XMSS_MAX_D - 1) +#define WC_XMSS_MAX_TREE_HASH \ + ((2 * WC_XMSS_MAX_D - 1) * WC_XMSS_MAX_TREE_HEIGHT) +#define WC_XMSS_MAX_BDS_K 0 + +#define WC_XMSS_ADDR_LEN 32 + +#define WC_XMSS_HASH_PRF_MAX_DATA_LEN \ + (WC_XMSS_MAX_PADDING_LEN + 2 * WC_XMSS_MAX_N + WC_XMSS_ADDR_LEN) +#define WC_XMSS_HASH_MAX_DATA_LEN \ + (WC_XMSS_MAX_PADDING_LEN + 3 * WC_XMSS_MAX_N) + + +#define WC_XMSS_SHA256_N 32 +#define WC_XMSS_SHA256_PADDING_LEN 32 +#define WC_XMSS_SHA256_WOTS_LEN 67 + +#define XMSS_OID_LEN 4 + +#define XMSS_MAX_HASH_LEN WC_SHA256_DIGEST_SIZE + +#define XMSS_RETAIN_LEN(k, n) ((!!(k)) * ((1 << (k)) - (k) - 1) * (n)) + +/* XMMS Algorithm OIDs + * Note: values are used in mathematical calculations in OID to parames. */ +#define WC_XMSS_OID_SHA2_10_256 0x01 +#define WC_XMSS_OID_SHA2_16_256 0x02 +#define WC_XMSS_OID_SHA2_20_256 0x03 +#define WC_XMSS_OID_SHA2_10_512 0x04 +#define WC_XMSS_OID_SHA2_16_512 0x05 +#define WC_XMSS_OID_SHA2_20_512 0x06 +#define WC_XMSS_OID_SHAKE_10_256 0x07 +#define WC_XMSS_OID_SHAKE_16_256 0x08 +#define WC_XMSS_OID_SHAKE_20_256 0x09 +#define WC_XMSS_OID_SHAKE_10_512 0x0a +#define WC_XMSS_OID_SHAKE_16_512 0x0b +#define WC_XMSS_OID_SHAKE_20_512 0x0c +#define WC_XMSS_OID_SHA2_10_192 0x0d +#define WC_XMSS_OID_SHA2_16_192 0x0e +#define WC_XMSS_OID_SHA2_20_192 0x0f +#define WC_XMSS_OID_SHAKE256_10_256 0x10 +#define WC_XMSS_OID_SHAKE256_16_256 0x11 +#define WC_XMSS_OID_SHAKE256_20_256 0x12 +#define WC_XMSS_OID_SHAKE256_10_192 0x13 +#define WC_XMSS_OID_SHAKE256_16_192 0x14 +#define WC_XMSS_OID_SHAKE256_20_192 0x15 +#define WC_XMSS_OID_FIRST WC_XMSS_OID_SHA2_10_256 +#define WC_XMSS_OID_LAST WC_XMSS_OID_SHAKE256_20_192 + +/* XMMS^MT Algorithm OIDs + * Note: values are used in mathematical calculations in OID to parames. */ +#define WC_XMSSMT_OID_SHA2_20_2_256 0x01 +#define WC_XMSSMT_OID_SHA2_20_4_256 0x02 +#define WC_XMSSMT_OID_SHA2_40_2_256 0x03 +#define WC_XMSSMT_OID_SHA2_40_4_256 0x04 +#define WC_XMSSMT_OID_SHA2_40_8_256 0x05 +#define WC_XMSSMT_OID_SHA2_60_3_256 0x06 +#define WC_XMSSMT_OID_SHA2_60_6_256 0x07 +#define WC_XMSSMT_OID_SHA2_60_12_256 0x08 +#define WC_XMSSMT_OID_SHA2_20_2_512 0x09 +#define WC_XMSSMT_OID_SHA2_20_4_512 0x0a +#define WC_XMSSMT_OID_SHA2_40_2_512 0x0b +#define WC_XMSSMT_OID_SHA2_40_4_512 0x0c +#define WC_XMSSMT_OID_SHA2_40_8_512 0x0d +#define WC_XMSSMT_OID_SHA2_60_3_512 0x0e +#define WC_XMSSMT_OID_SHA2_60_6_512 0x0f +#define WC_XMSSMT_OID_SHA2_60_12_512 0x10 +#define WC_XMSSMT_OID_SHAKE_20_2_256 0x11 +#define WC_XMSSMT_OID_SHAKE_20_4_256 0x12 +#define WC_XMSSMT_OID_SHAKE_40_2_256 0x13 +#define WC_XMSSMT_OID_SHAKE_40_4_256 0x14 +#define WC_XMSSMT_OID_SHAKE_40_8_256 0x15 +#define WC_XMSSMT_OID_SHAKE_60_3_256 0x16 +#define WC_XMSSMT_OID_SHAKE_60_6_256 0x17 +#define WC_XMSSMT_OID_SHAKE_60_12_256 0x18 +#define WC_XMSSMT_OID_SHAKE_20_2_512 0x19 +#define WC_XMSSMT_OID_SHAKE_20_4_512 0x1a +#define WC_XMSSMT_OID_SHAKE_40_2_512 0x1b +#define WC_XMSSMT_OID_SHAKE_40_4_512 0x1c +#define WC_XMSSMT_OID_SHAKE_40_8_512 0x1d +#define WC_XMSSMT_OID_SHAKE_60_3_512 0x1e +#define WC_XMSSMT_OID_SHAKE_60_6_512 0x1f +#define WC_XMSSMT_OID_SHAKE_60_12_512 0x20 +#define WC_XMSSMT_OID_SHA2_20_2_192 0x21 +#define WC_XMSSMT_OID_SHA2_20_4_192 0x22 +#define WC_XMSSMT_OID_SHA2_40_2_192 0x23 +#define WC_XMSSMT_OID_SHA2_40_4_192 0x24 +#define WC_XMSSMT_OID_SHA2_40_8_192 0x25 +#define WC_XMSSMT_OID_SHA2_60_3_192 0x26 +#define WC_XMSSMT_OID_SHA2_60_6_192 0x27 +#define WC_XMSSMT_OID_SHA2_60_12_192 0x28 +#define WC_XMSSMT_OID_SHAKE256_20_2_256 0x29 +#define WC_XMSSMT_OID_SHAKE256_20_4_256 0x2a +#define WC_XMSSMT_OID_SHAKE256_40_2_256 0x2b +#define WC_XMSSMT_OID_SHAKE256_40_4_256 0x2c +#define WC_XMSSMT_OID_SHAKE256_40_8_256 0x2d +#define WC_XMSSMT_OID_SHAKE256_60_3_256 0x2e +#define WC_XMSSMT_OID_SHAKE256_60_6_256 0x2f +#define WC_XMSSMT_OID_SHAKE256_60_12_256 0x30 +#define WC_XMSSMT_OID_SHAKE256_20_2_192 0x31 +#define WC_XMSSMT_OID_SHAKE256_20_4_192 0x32 +#define WC_XMSSMT_OID_SHAKE256_40_2_192 0x33 +#define WC_XMSSMT_OID_SHAKE256_40_4_192 0x34 +#define WC_XMSSMT_OID_SHAKE256_40_8_192 0x35 +#define WC_XMSSMT_OID_SHAKE256_60_3_192 0x36 +#define WC_XMSSMT_OID_SHAKE256_60_6_192 0x37 +#define WC_XMSSMT_OID_SHAKE256_60_12_192 0x38 +#define WC_XMSSMT_OID_FIRST WC_XMSSMT_OID_SHA2_20_2_256 +#define WC_XMSSMT_OID_LAST WC_XMSSMT_OID_SHAKE256_60_12_192 + + +/* Type for hash address. */ +typedef word32 HashAddress[8]; + +/* XMSS/XMSS^MT fixed parameters. */ +typedef struct XmssParams { + /* Hash algorithm to use. */ + word8 hash; + /* Size of hash output. */ + word8 n; + /* Number of bytes of padding before rest of hash data. */ + word8 pad_len; + /* Number of values to chain = 2 * n + 3. */ + word8 wots_len; + /* Number of bytes in each WOTS+ signature. */ + word16 wots_sig_len; + /* Full height of tree. */ + word8 h; + /* Height of tree each subtree. */ + word8 sub_h; + /* Number of subtrees = h / sub_h. */ + word8 d; + /* Number of bytes to encode index into in private/secret key. */ + word8 idx_len; + /* Number of bytes in a signature. */ + word32 sig_len; + /* Number of bytes in a secret/private key. */ + word32 sk_len; + /* Number of bytes in a public key. */ + word8 pk_len; + /* BDS parameter for fast C implementation. */ + word8 bds_k; +} XmssParams; + +struct XmssKey { + /* Public key. */ + unsigned char pk[2 * WC_XMSS_MAX_N]; + /* OID that identifies parameters. */ + word32 oid; + /* Indicates whether the parameters are for XMSS^MT. */ + int is_xmssmt; + /* XMSS/XMSS^MT parameters. */ + const XmssParams* params; +#ifndef WOLFSSL_XMSS_VERIFY_ONLY + /* Secret/private key. */ + unsigned char* sk; + /* Length of secret key. */ + word32 sk_len; + /* Callback to write/update key. */ + wc_xmss_write_private_key_cb write_private_key; + /* Callback to read key. */ + wc_xmss_read_private_key_cb read_private_key; + /* Context arg passed to callbacks. */ + void* context; +#endif /* ifndef WOLFSSL_XMSS_VERIFY_ONLY */ + /* State of key. */ + enum wc_XmssState state; +}; + +typedef struct XmssState { + const XmssParams* params; + + /* Digest is assumed to be at the end. */ + union { + #ifdef WC_XMSS_SHA256 + wc_Sha256 sha256; + #endif + #ifdef WC_XMSS_SHA512 + wc_Sha512 sha512; + #endif + #if defined(WC_XMSS_SHAKE128) || defined(WC_XMSS_SHAKE256) + wc_Shake shake; + #endif + } digest; +#if !defined(WOLFSSL_WC_XMSS_SMALL) && defined(WC_XMSS_SHA256) && \ + !defined(WC_XMSS_FULL_HASH) + ALIGN16 word32 dgst_state[WC_SHA256_DIGEST_SIZE / sizeof(word32)]; +#endif + ALIGN16 byte prf_buf[WC_XMSS_HASH_PRF_MAX_DATA_LEN]; + ALIGN16 byte buf[WC_XMSS_HASH_MAX_DATA_LEN]; + ALIGN16 byte pk[WC_XMSS_MAX_WOTS_SIG_LEN]; +#ifndef WOLFSSL_XMSS_VERIFY_ONLY + ALIGN16 byte stack[WC_XMSS_MAX_STACK_LEN]; +#else + ALIGN16 byte stack[WC_XMSS_ADDR_LEN]; +#endif + byte encMsg[WC_XMSS_MAX_WOTS_LEN]; + HashAddress addr; + + int ret; +} XmssState; + +#ifdef __cplusplus + extern "C" { +#endif + +WOLFSSL_LOCAL int wc_xmssmt_keygen(XmssState *state, const unsigned char* seed, + unsigned char *sk, unsigned char *pk); +WOLFSSL_LOCAL int wc_xmss_keygen(XmssState *state, const unsigned char* seed, + unsigned char *sk, unsigned char *pk); + +WOLFSSL_LOCAL int wc_xmssmt_sign(XmssState *state, const unsigned char *m, + word32 mlen, unsigned char *sk, unsigned char *sm); +WOLFSSL_LOCAL int wc_xmss_sign(XmssState *state, const unsigned char *m, + word32 mlen, unsigned char *sk, unsigned char *sm); + +WOLFSSL_LOCAL int wc_xmss_sigsleft(const XmssParams* params, unsigned char* sk); + +WOLFSSL_LOCAL int wc_xmssmt_verify(XmssState *state, const unsigned char *m, + word32 mlen, const unsigned char *sm, const unsigned char *pk); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_HAVE_XMSS */ +#endif /* WC_XMSS_H */ + diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/wolfevent.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/wolfevent.h @@ -0,0 +1,120 @@ +/* wolfevent.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifndef _WOLF_EVENT_H_ +#define _WOLF_EVENT_H_ + +#ifdef __cplusplus + extern "C" { +#endif + +#ifndef SINGLE_THREADED + #include <wolfssl/wolfcrypt/wc_port.h> +#endif + +typedef struct WOLF_EVENT WOLF_EVENT; +typedef unsigned short WOLF_EVENT_FLAG; + +typedef enum WOLF_EVENT_TYPE { + WOLF_EVENT_TYPE_NONE, +#ifdef WOLFSSL_ASYNC_CRYPT + WOLF_EVENT_TYPE_ASYNC_WOLFSSL, /* context is WOLFSSL* */ + WOLF_EVENT_TYPE_ASYNC_WOLFCRYPT, /* context is WC_ASYNC_DEV */ + WOLF_EVENT_TYPE_ASYNC_FIRST = WOLF_EVENT_TYPE_ASYNC_WOLFSSL, + WOLF_EVENT_TYPE_ASYNC_LAST = WOLF_EVENT_TYPE_ASYNC_WOLFCRYPT, +#endif /* WOLFSSL_ASYNC_CRYPT */ +} WOLF_EVENT_TYPE; + +typedef enum WOLF_EVENT_STATE { + WOLF_EVENT_STATE_READY, + WOLF_EVENT_STATE_PENDING, + WOLF_EVENT_STATE_DONE, +} WOLF_EVENT_STATE; + +struct WOLF_EVENT { + /* double linked list */ + WOLF_EVENT* next; + WOLF_EVENT* prev; + + void* context; + union { + void* ptr; +#ifdef WOLFSSL_ASYNC_CRYPT + struct WC_ASYNC_DEV* async; +#endif + } dev; +#ifdef HAVE_CAVIUM + word64 reqId; + #ifdef WOLFSSL_NITROX_DEBUG + word32 pendCount; + #endif +#endif +#ifndef WC_NO_ASYNC_THREADING + pthread_t threadId; +#endif + int ret; /* Async return code */ + unsigned int flags; + WOLF_EVENT_TYPE type; + WOLF_EVENT_STATE state; +}; + +enum WOLF_POLL_FLAGS { + WOLF_POLL_FLAG_CHECK_HW = 0x01, +}; + +typedef struct { + WOLF_EVENT* head; /* head of queue */ + WOLF_EVENT* tail; /* tail of queue */ +#ifndef SINGLE_THREADED + wolfSSL_Mutex lock; /* queue lock */ +#endif + int count; +} WOLF_EVENT_QUEUE; + + +#ifdef HAVE_WOLF_EVENT + +/* Event */ +WOLFSSL_API int wolfEvent_Init(WOLF_EVENT* event, WOLF_EVENT_TYPE type, void* context); +WOLFSSL_API int wolfEvent_Poll(WOLF_EVENT* event, WOLF_EVENT_FLAG flags); + +/* Event Queue */ +WOLFSSL_API int wolfEventQueue_Init(WOLF_EVENT_QUEUE* queue); +WOLFSSL_API int wolfEventQueue_Push(WOLF_EVENT_QUEUE* queue, WOLF_EVENT* event); +WOLFSSL_API int wolfEventQueue_Pop(WOLF_EVENT_QUEUE* queue, WOLF_EVENT** event); +WOLFSSL_API int wolfEventQueue_Poll(WOLF_EVENT_QUEUE* queue, void* context_filter, + WOLF_EVENT** events, int maxEvents, WOLF_EVENT_FLAG flags, int* eventCount); +WOLFSSL_API int wolfEventQueue_Count(WOLF_EVENT_QUEUE* queue); +WOLFSSL_API void wolfEventQueue_Free(WOLF_EVENT_QUEUE* queue); + +/* the queue mutex must be locked prior to calling these */ +WOLFSSL_API int wolfEventQueue_Add(WOLF_EVENT_QUEUE* queue, WOLF_EVENT* event); +WOLFSSL_API int wolfEventQueue_Remove(WOLF_EVENT_QUEUE* queue, WOLF_EVENT* event); + + +#endif /* HAVE_WOLF_EVENT */ + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* _WOLF_EVENT_H_ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/wolfmath.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/wolfmath.h @@ -0,0 +1,166 @@ +/* wolfmath.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* +DESCRIPTION +This library provides big integer math functions. + +*/ +#ifndef __WOLFMATH_H__ +#define __WOLFMATH_H__ + +#ifdef __cplusplus + extern "C" { +#endif + +#include <wolfssl/wolfcrypt/types.h> + +#ifdef WOLFSSL_PUBLIC_MP + #define MP_API WOLFSSL_API +#else + #define MP_API WOLFSSL_LOCAL +#endif + + +#if defined(NO_BIG_INT) + /* MPI globally disabled -- no PK algorithms supported. */ + #if defined(USE_FAST_MATH) || defined(USE_INTEGER_HEAP_MATH) || \ + defined(WOLFSSL_SP_MATH_ALL) || defined(WOLFSSL_SP_MATH) || \ + defined(HAVE_WOLF_BIGINT) || defined(WOLFSSL_EXPORT_INT) + #error Conflicting MPI settings. + #endif +#elif defined(WOLFSSL_SP_MATH_ALL) || defined(WOLFSSL_SP_MATH) + #include <wolfssl/wolfcrypt/sp_int.h> +#elif defined(USE_FAST_MATH) + #include <wolfssl/wolfcrypt/tfm.h> +#elif defined(USE_INTEGER_HEAP_MATH) + #include <wolfssl/wolfcrypt/integer.h> +#else + #include <wolfssl/wolfcrypt/sp_int.h> +#endif + +#if !defined(NO_BIG_INT) + #include <wolfssl/wolfcrypt/random.h> +#endif + +#if defined(WOLFSSL_MAX3266X) || defined(WOLFSSL_MAX3266X_OLD) + #include <wolfssl/wolfcrypt/port/maxim/max3266x.h> +#endif + +#ifndef MIN + #define MIN(x,y) ((x)<(y)?(x):(y)) +#endif + +#ifndef MAX + #define MAX(x,y) ((x)>(y)?(x):(y)) +#endif + +/* timing resistance array */ +#if !defined(WC_NO_CACHE_RESISTANT) && \ + ((defined(HAVE_ECC) && defined(ECC_TIMING_RESISTANT)) || \ + (defined(USE_FAST_MATH) && defined(TFM_TIMING_RESISTANT))) + + extern const wc_ptr_t wc_off_on_addr[2]; +#endif + +#if !defined(NO_BIG_INT) +/* common math functions */ +MP_API int mp_get_digit_count(const mp_int* a); +MP_API mp_digit mp_get_digit(const mp_int* a, int n); +MP_API int mp_get_rand_digit(WC_RNG* rng, mp_digit* d); +WOLFSSL_LOCAL void mp_reverse(unsigned char *s, int len); + +#if defined(HAVE_FIPS) || defined(HAVE_SELFTEST) +#define get_digit_count mp_get_digit_count +#define get_digit mp_get_digit +#define get_rand_digit mp_get_rand_digit +#endif + +WOLFSSL_API int mp_cond_copy(mp_int* a, int copy, mp_int* b); +WOLFSSL_API int mp_rand(mp_int* a, int digits, WC_RNG* rng); +#endif + +#define WC_TYPE_HEX_STR 1 +#define WC_TYPE_UNSIGNED_BIN 2 +#if defined(WOLFSSL_QNX_CAAM) || defined(WOLFSSL_IMXRT1170_CAAM) + #define WC_TYPE_BLACK_KEY 3 +#endif + +#if defined(HAVE_ECC) || defined(WOLFSSL_EXPORT_INT) +WOLFSSL_API int wc_export_int(mp_int* mp, byte* buf, word32* len, + word32 keySz, int encType); +#endif + +#ifdef HAVE_WOLF_BIGINT + #if !defined(WOLF_BIGINT_DEFINED) + /* raw big integer */ + typedef struct WC_BIGINT { + byte* buf; + word32 len; + void* heap; + } WC_BIGINT; + #define WOLF_BIGINT_DEFINED + #endif + + WOLFSSL_LOCAL void wc_bigint_init(WC_BIGINT* a); + WOLFSSL_LOCAL int wc_bigint_alloc(WC_BIGINT* a, word32 sz); + WOLFSSL_LOCAL int wc_bigint_from_unsigned_bin(WC_BIGINT* a, const byte* in, word32 inlen); + WOLFSSL_LOCAL int wc_bigint_to_unsigned_bin(WC_BIGINT* a, byte* out, word32* outlen); + WOLFSSL_LOCAL void wc_bigint_zero(WC_BIGINT* a); + WOLFSSL_LOCAL void wc_bigint_free(WC_BIGINT* a); + + WOLFSSL_LOCAL int wc_mp_to_bigint(mp_int* src, WC_BIGINT* dst); + WOLFSSL_LOCAL int wc_mp_to_bigint_sz(mp_int* src, WC_BIGINT* dst, word32 sz); + WOLFSSL_LOCAL int wc_bigint_to_mp(WC_BIGINT* src, mp_int* dst); +#endif /* HAVE_WOLF_BIGINT */ + + +#ifdef HAVE_WC_INTROSPECTION + WOLFSSL_API const char *wc_GetMathInfo(void); +#endif + +/* Support for generic Hardware based Math Functions */ +#ifdef WOLFSSL_USE_HW_MP + +WOLFSSL_LOCAL int hw_mod(mp_int* multiplier, mp_int* mod, mp_int* result); +WOLFSSL_LOCAL int hw_mulmod(mp_int* multiplier, mp_int* multiplicand, + mp_int* mod, mp_int* result); +WOLFSSL_LOCAL int hw_addmod(mp_int* a, mp_int* b, mp_int* mod, mp_int* result); +WOLFSSL_LOCAL int hw_submod(mp_int* a, mp_int* b, mp_int* mod, mp_int* result); +WOLFSSL_LOCAL int hw_exptmod(mp_int* base, mp_int* exp, mp_int* mod, + mp_int* result); +WOLFSSL_LOCAL int hw_sqrmod(mp_int* base, mp_int* mod, mp_int* result); + +/* One to one mappings */ +#define mp_mod hw_mod +#define mp_addmod hw_addmod +#define mp_submod hw_submod +#define mp_mulmod hw_mulmod +#define mp_exptmod hw_exptmod +#define mp_sqrmod hw_sqrmod + +#endif + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* __WOLFMATH_H__ */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/xmss.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfcrypt/xmss.h @@ -0,0 +1,203 @@ +/* xmss.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfcrypt/xmss.h + */ + +#ifndef WOLF_CRYPT_XMSS_H +#define WOLF_CRYPT_XMSS_H + +#include <wolfssl/wolfcrypt/types.h> +#include <wolfssl/wolfcrypt/random.h> + +#ifdef WOLFSSL_HAVE_XMSS + +/* Note on XMSS/XMSS^MT pub/priv key sizes: + * - The XMSS/XMSS^MT pub key has a defined format and size. + * - The XMSS/XMSS^MT private key is implementation and parameter + * specific. It does not have a standardized format or size. + * + * The XMSS/XMSS^MT public and secret key format and length is: + * PK = OID || root || SEED; + * PK_len = 4 + 2 * n + * + * SK = OID || (implementation defined) + * SK_len = 4 + (implementation defined) + * + * where n is the number of bytes in the hash function, which is 32 + * in this SHA256 implementation. + * + * However the private key is implementation specific. For example, + * in xmss-reference the private key size varies from 137 bytes to + * 1377 bytes between slow and fast implementations with param name + * "XMSSMT-SHA2_20/2_256". + * + * References: + * - RFC 8391 + * - Table 2 of Kampanakis, Fluhrer, IACR, 2017. + * */ + +#define XMSS_SHA256_PUBLEN (68) + +/* Supported XMSS/XMSS^MT parameter set names: + * We are supporting all SHA256 parameter sets with n=32 and + * Winternitz=16, from RFC 8391 and NIST SP 800-208. + * + * ---------------------------------------------------------- + * | Name OID n w len h d | + * XMSS: | "XMSS-SHA2_10_256" 0x00000001 32 16 67 10 1 | + * | "XMSS-SHA2_16_256" 0x00000002 32 16 67 16 1 | + * | "XMSS-SHA2_20_256" 0x00000003 32 16 67 20 1 | + * | | + * XMSSMT: | "XMSSMT-SHA2_20/2_256" 0x00000001 32 16 67 20 2 | + * | "XMSSMT-SHA2_20/4_256" 0x00000002 32 16 67 20 4 | + * | "XMSSMT-SHA2_40/2_256" 0x00000003 32 16 67 40 2 | + * | "XMSSMT-SHA2_40/4_256" 0x00000004 32 16 67 40 4 | + * | "XMSSMT-SHA2_40/8_256" 0x00000005 32 16 67 40 8 | + * | "XMSSMT-SHA2_60/3_256" 0x00000006 32 16 67 60 3 | + * | "XMSSMT-SHA2_60/6_256" 0x00000007 32 16 67 60 6 | + * | "XMSSMT-SHA2_60/12_256" 0x00000008 32 16 67 60 12 | + * ---------------------------------------------------------- + * + * Note that some XMSS and XMSSMT names do have overlapping OIDs. + * + * References: + * 1. NIST SP 800-208 + * 2. RFC 8391 + * */ + +#define XMSS_NAME_LEN (16) /* strlen("XMSS-SHA2_10_256") */ +#define XMSSMT_NAME_MIN_LEN (20) /* strlen("XMSSMT-SHA2_20/2_256") */ +#define XMSSMT_NAME_MAX_LEN (21) /* strlen("XMSSMT-SHA2_60/12_256") */ + +#if defined(HAVE_FIPS) || defined(HAVE_LIBXMSS) + #undef WOLFSSL_WC_XMSS_NO_SHA512 + #define WOLFSSL_WC_XMSS_NO_SHA512 + #undef WOLFSSL_WC_XMSS_NO_SHAKE128 + #define WOLFSSL_WC_XMSS_NO_SHAKE128 + #undef WOLFSSL_WC_XMSS_MAX_HASH_SIZE + #ifdef HAVE_LIBXMSS + #define WOLFSSL_WC_XMSS_MIN_HASH_SIZE 256 + #else + #define WOLFSSL_WC_XMSS_MIN_HASH_SIZE 192 + #endif + #define WOLFSSL_WC_XMSS_MAX_HASH_SIZE 256 +#endif + +#if !defined(NO_SHA256) && !defined(WOLFSSL_WC_XMSS_NO_SHA256) + #define WC_XMSS_SHA256 +#endif +#if defined(WOLFSSL_SHA512) && !defined(WOLFSSL_WC_XMSS_NO_SHA512) + #define WC_XMSS_SHA512 +#endif +#if defined(WOLFSSL_SHAKE128) && !defined(WOLFSSL_WC_XMSS_NO_SHAKE128) + #define WC_XMSS_SHAKE128 +#endif +#if defined(WOLFSSL_SHAKE256) && !defined(WOLFSSL_WC_XMSS_NO_SHAKE256) + #define WC_XMSS_SHAKE256 +#endif + +#ifndef WOLFSSL_WC_XMSS_MIN_HASH_SIZE + #define WOLFSSL_WC_XMSS_MIN_HASH_SIZE 192 +#endif +#ifndef WOLFSSL_WC_XMSS_MAX_HASH_SIZE + #define WOLFSSL_WC_XMSS_MAX_HASH_SIZE 512 +#endif +#if WOLFSSL_WC_XMSS_MIN_HASH_SIZE > WOLFSSL_WC_XMSS_MAX_HASH_SIZE + #error "XMSS minimum hash size is greater than maximum hash size" +#endif + +#ifndef WOLFSSL_XMSS_MIN_HEIGHT + #define WOLFSSL_XMSS_MIN_HEIGHT 10 +#endif +#ifndef WOLFSSL_XMSS_MAX_HEIGHT + #define WOLFSSL_XMSS_MAX_HEIGHT 60 +#endif +#if WOLFSSL_XMSS_MIN_HEIGHT > WOLFSSL_XMSS_MAX_HEIGHT + #error "XMSS minimum height is greater than maximum height" +#endif + +typedef struct XmssKey XmssKey; + +/* Return codes returned by private key callbacks. */ +enum wc_XmssRc { + WC_XMSS_RC_NONE, + WC_XMSS_RC_BAD_ARG, /* Bad arg in read or write callback. */ + WC_XMSS_RC_WRITE_FAIL, /* Write or update private key failed. */ + WC_XMSS_RC_READ_FAIL, /* Read private key failed. */ + WC_XMSS_RC_SAVED_TO_NV_MEMORY, /* Wrote private key to nonvolatile storage. */ + WC_XMSS_RC_READ_TO_MEMORY /* Read private key from storage. */ +}; + +/* enum wc_XmssState is to help track the state of an XMSS Key. */ +enum wc_XmssState { + WC_XMSS_STATE_FREED, /* Key has been freed from memory. */ + WC_XMSS_STATE_INITED, /* Key has been inited, ready to set params.*/ + WC_XMSS_STATE_PARMSET, /* Params are set, ready to MakeKey or Reload. */ + WC_XMSS_STATE_OK, /* Able to sign signatures and verify. */ + WC_XMSS_STATE_VERIFYONLY, /* A public only XmssKey. */ + WC_XMSS_STATE_BAD, /* Can't guarantee key's state. */ + WC_XMSS_STATE_NOSIGS /* Signatures exhausted. */ +}; + +/* Private key write and read callbacks. */ +typedef enum wc_XmssRc (*wc_xmss_write_private_key_cb)(const byte* priv, word32 privSz, + void* context); +typedef enum wc_XmssRc (*wc_xmss_read_private_key_cb)(byte* priv, word32 privSz, + void* context); + +#ifdef __cplusplus + extern "C" { +#endif + +WOLFSSL_API int wc_XmssKey_Init(XmssKey* key, void* heap, int devId); +WOLFSSL_API int wc_XmssKey_SetParamStr(XmssKey* key, const char* str); +#ifndef WOLFSSL_XMSS_VERIFY_ONLY +WOLFSSL_API int wc_XmssKey_SetWriteCb(XmssKey* key, + wc_xmss_write_private_key_cb write_cb); +WOLFSSL_API int wc_XmssKey_SetReadCb(XmssKey* key, + wc_xmss_read_private_key_cb read_cb); +WOLFSSL_API int wc_XmssKey_SetContext(XmssKey* key, void* context); +WOLFSSL_API int wc_XmssKey_MakeKey(XmssKey* key, WC_RNG* rng); +WOLFSSL_API int wc_XmssKey_Reload(XmssKey* key); +WOLFSSL_API int wc_XmssKey_GetPrivLen(const XmssKey* key, word32* len); +WOLFSSL_API int wc_XmssKey_Sign(XmssKey* key, byte* sig, word32* sigSz, + const byte* msg, int msgSz); +WOLFSSL_API int wc_XmssKey_SigsLeft(XmssKey* key); +#endif /* ifndef WOLFSSL_XMSS_VERIFY_ONLY */ +WOLFSSL_API void wc_XmssKey_Free(XmssKey* key); +WOLFSSL_API int wc_XmssKey_GetSigLen(const XmssKey* key, word32* len); +WOLFSSL_API int wc_XmssKey_GetPubLen(const XmssKey* key, word32* len); +WOLFSSL_API int wc_XmssKey_ExportPub(XmssKey* keyDst, const XmssKey* keySrc); +WOLFSSL_API int wc_XmssKey_ExportPubRaw(const XmssKey* key, byte* out, + word32* outLen); +WOLFSSL_API int wc_XmssKey_ImportPubRaw(XmssKey* key, const byte* in, + word32 inLen); +WOLFSSL_API int wc_XmssKey_Verify(XmssKey* key, const byte* sig, word32 sigSz, + const byte* msg, int msgSz); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_HAVE_XMSS */ +#endif /* WOLF_CRYPT_XMSS_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfio.h b/android_studio/distribution/wolfssl/lib/arm64-v8a/include/wolfssl/wolfio.h @@ -0,0 +1,967 @@ +/* io.h + * + * Copyright (C) 2006-2025 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/*! + \file wolfssl/wolfio.h +*/ + +#ifndef WOLFSSL_IO_H +#define WOLFSSL_IO_H + +#include <wolfssl/ssl.h> + +#ifdef __cplusplus + extern "C" { +#endif + +/* Micrium uses NetSock I/O callbacks in wolfio.c */ +#if !defined(WOLFSSL_USER_IO) + /* OCSP and CRL_IO require HTTP client */ + #if defined(HAVE_OCSP) || defined(HAVE_CRL_IO) + #ifndef HAVE_HTTP_CLIENT + #define HAVE_HTTP_CLIENT + #endif + #endif +#endif + +#if !defined(WOLFSSL_USER_IO) + /* Micrium uses NetSock I/O callbacks in wolfio.c */ + #if !defined(USE_WOLFSSL_IO) && !defined(MICRIUM) && \ + !defined(WOLFSSL_CONTIKI) && !defined(WOLFSSL_NO_SOCK) + #define USE_WOLFSSL_IO + #endif +#endif + + +#if defined(USE_WOLFSSL_IO) || defined(HAVE_HTTP_CLIENT) + +#ifdef HAVE_LIBZ + #include "zlib.h" +#endif + +#if defined(__WATCOMC__) + #if defined(__NT__) + #elif defined(__OS2__) + #include <errno.h> + #include <os2.h> + #include <sys/types.h> + #include <os2/types.h> + #include <sys/socket.h> + #include <arpa/inet.h> + #include <netinet/in.h> + #include <nerrno.h> + #include <sys/ioctl.h> + + typedef int socklen_t; + #elif defined(__LINUX__) + #include <sys/types.h> + #include <errno.h> + #include <unistd.h> + #include <fcntl.h> + #define XFCNTL(fd, flag, block) fcntl((fd), (flag), (block)) + #include <sys/socket.h> + #include <arpa/inet.h> + #include <netinet/in.h> + #endif +#elif defined(USE_WINDOWS_API) +#else + #if defined(WOLFSSL_LWIP) && !defined(WOLFSSL_APACHE_MYNEWT) + /* lwIP needs to be configured to use sockets API in this mode */ + /* LWIP_SOCKET 1 in lwip/opt.h or in build */ + #include "lwip/sockets.h" + #ifndef LWIP_PROVIDE_ERRNO + #include <errno.h> + #define LWIP_PROVIDE_ERRNO 1 + #endif + #elif defined(ARDUINO) + /* TODO Add specific boards */ + #elif defined(FREESCALE_MQX) + #include <posix.h> + #include <rtcs.h> + #elif defined(FREESCALE_KSDK_MQX) + #include <rtcs.h> + #elif (defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET)) + #include "rl_net.h" + #include "errno.h" + #elif defined(WOLFSSL_CMSIS_RTOS) + #include "cmsis_os.h" + #elif defined(WOLFSSL_CMSIS_RTOSv2) + #include "cmsis_os2.h" + #elif defined(WOLFSSL_TIRTOS) + #include <sys/socket.h> + #elif defined(FREERTOS_TCP) + #include "FreeRTOS_Sockets.h" + #elif defined(WOLFSSL_IAR_ARM) + /* nothing */ + #elif defined(HAVE_NETX_BSD) + #ifdef NETX_DUO + #include "nxd_bsd.h" + #else + #include "nx_bsd.h" + #endif + #elif defined(WOLFSSL_VXWORKS) + #include <sockLib.h> + #include <errno.h> + #elif defined(WOLFSSL_NUCLEUS_1_2) + #include <externs.h> + #include <errno.h> + #elif defined(WOLFSSL_LINUXKM) + /* the requisite linux/net.h is included in wc_port.h, with incompatible warnings masked out. */ + #elif defined(WOLFSSL_ATMEL) + #include "socket/include/socket.h" + #elif defined(INTIME_RTOS) + #undef MIN + #undef MAX + #include <rt.h> + #include <sys/types.h> + #include <sys/socket.h> + #include <netdb.h> + #include <netinet/in.h> + #include <io.h> + /* <sys/socket.h> defines these, to avoid conflict, do undef */ + #undef SOCKADDR + #undef SOCKADDR_IN + #elif defined(WOLFSSL_PRCONNECT_PRO) + #include <prconnect_pro/prconnect_pro.h> + #include <sys/types.h> + #include <errno.h> + #include <unistd.h> + #include <fcntl.h> + #elif defined(WOLFSSL_SGX) + #include <errno.h> + #elif defined(WOLFSSL_APACHE_MYNEWT) && !defined(WOLFSSL_LWIP) + #include <mn_socket/mn_socket.h> + #elif defined(WOLFSSL_DEOS) + #include <socketapi.h> + #include <lwip-socket.h> + #include <errno.h> + #elif defined(WOLFSSL_ZEPHYR) + #include <version.h> + #if KERNEL_VERSION_NUMBER >= 0x30100 + #include <zephyr/net/socket.h> + #ifdef CONFIG_POSIX_API + #include <zephyr/posix/sys/socket.h> + #endif + #else + #include <net/socket.h> + #ifdef CONFIG_POSIX_API + #include <posix/sys/socket.h> + #endif + #endif + #elif defined(MICROCHIP_PIC32) + #include <sys/errno.h> + #elif defined(HAVE_NETX) + #include "nx_api.h" + #include "errno.h" + #elif defined(FUSION_RTOS) + #include <sys/fcltypes.h> + #include <fclerrno.h> + #include <fclfcntl.h> + #elif defined(WOLFSSL_EMNET) + #include <IP/IP.h> + #elif !defined(WOLFSSL_NO_SOCK) + #include <sys/types.h> + #include <errno.h> + #ifndef EBSNET + #include <unistd.h> + #endif + #include <fcntl.h> + #define XFCNTL(fd, flag, block) fcntl((fd), (flag), (block)) + + #if defined(HAVE_RTP_SYS) + #include <socket.h> + #elif defined(EBSNET) + #include "rtipapi.h" /* errno */ + #include "socket.h" + #elif defined(NETOS) + #include <sockapi.h> + #elif defined(NUCLEUS_PLUS_2_3) + #define SO_TYPE 17 /* Socket type */ + #define SO_RCVTIMEO 13 /* Recv Timeout */ + #elif !defined(DEVKITPRO) && !defined(WOLFSSL_PICOTCP) \ + && !defined(WOLFSSL_CONTIKI) && !defined(WOLFSSL_WICED) \ + && !defined(WOLFSSL_GNRC) && !defined(WOLFSSL_RIOT_OS) + #include <sys/socket.h> + #include <arpa/inet.h> + #include <netinet/in.h> + #ifdef __PPU + #include <netex/errno.h> + #else + #endif + #endif + #endif + + #if defined(WOLFSSL_RENESAS_RA6M3G) || defined(WOLFSSL_RENESAS_RA6M3) ||\ + defined(WOLFSSL_RENESAS_RA6M4) || \ + defined(WOLFSSL_RENESAS_RZN2L) + /* Uses FREERTOS_TCP */ + #include <errno.h> + #endif + + #if defined(WOLFSSL_EMBOS) + #include <errno.h> + #endif + +#endif /* USE_WINDOWS_API */ + +#ifdef __sun + #include <sys/filio.h> +#endif + +#define SOCKET_RECEIVING 1 +#define SOCKET_SENDING 2 + +#ifdef __WATCOMC__ + #if defined(__NT__) + /* no epipe yet */ + #ifndef WSAEPIPE + #define WSAEPIPE -12345 + #endif + #define SOCKET_EWOULDBLOCK WSAEWOULDBLOCK + #define SOCKET_EAGAIN WSAETIMEDOUT + #define SOCKET_ETIMEDOUT WSAETIMEDOUT + #define SOCKET_ECONNRESET WSAECONNRESET + #define SOCKET_EINTR WSAEINTR + #define SOCKET_EPIPE WSAEPIPE + #define SOCKET_ECONNREFUSED WSAENOTCONN + #define SOCKET_ECONNABORTED WSAECONNABORTED + #elif defined(__OS2__) + #define SOCKET_EWOULDBLOCK SOCEWOULDBLOCK + #define SOCKET_EAGAIN SOCEAGAIN + #define SOCKET_ETIMEDOUT SOCETIMEDOUT + #define SOCKET_ECONNRESET SOCECONNRESET + #define SOCKET_EINTR SOCEINTR + #define SOCKET_EPIPE SOCEPIPE + #define SOCKET_ECONNREFUSED SOCECONNREFUSED + #define SOCKET_ECONNABORTED SOCECONNABORTED + #elif defined(__UNIX__) + #define SOCKET_EWOULDBLOCK EWOULDBLOCK + #define SOCKET_EAGAIN EAGAIN + #define SOCKET_ETIMEDOUT ETIMEDOUT + #define SOCKET_ECONNRESET ECONNRESET + #define SOCKET_EINTR EINTR + #define SOCKET_EPIPE EPIPE + #define SOCKET_ECONNREFUSED ECONNREFUSED + #define SOCKET_ECONNABORTED ECONNABORTED + #endif +#elif defined(USE_WINDOWS_API) + /* no epipe yet */ + #ifndef WSAEPIPE + #define WSAEPIPE -12345 + #endif + #define SOCKET_EWOULDBLOCK WSAEWOULDBLOCK + #define SOCKET_EAGAIN WSAETIMEDOUT + #define SOCKET_ETIMEDOUT WSAETIMEDOUT + #define SOCKET_ECONNRESET WSAECONNRESET + #define SOCKET_EINTR WSAEINTR + #define SOCKET_EPIPE WSAEPIPE + #define SOCKET_ECONNREFUSED WSAENOTCONN + #define SOCKET_ECONNABORTED WSAECONNABORTED +#elif defined(__PPU) + #define SOCKET_EWOULDBLOCK SYS_NET_EWOULDBLOCK + #define SOCKET_EAGAIN SYS_NET_EAGAIN + #define SOCKET_ECONNRESET SYS_NET_ECONNRESET + #define SOCKET_EINTR SYS_NET_EINTR + #define SOCKET_EPIPE SYS_NET_EPIPE + #define SOCKET_ECONNREFUSED SYS_NET_ECONNREFUSED + #define SOCKET_ECONNABORTED SYS_NET_ECONNABORTED +#elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX) + #if (defined(MQX_USE_IO_OLD) && MQX_USE_IO_OLD) || \ + defined(FREESCALE_MQX_5_0) + /* RTCS old I/O doesn't have an EWOULDBLOCK */ + #define SOCKET_EWOULDBLOCK EAGAIN + #define SOCKET_EAGAIN EAGAIN + #define SOCKET_ETIMEDOUT RTCSERR_TCP_TIMED_OUT + #define SOCKET_ECONNRESET RTCSERR_TCP_CONN_RESET + #define SOCKET_EINTR EINTR + #define SOCKET_EPIPE EPIPE + #define SOCKET_ECONNREFUSED RTCSERR_TCP_CONN_REFUSED + #define SOCKET_ECONNABORTED RTCSERR_TCP_CONN_ABORTED + #else + #define SOCKET_EWOULDBLOCK NIO_EWOULDBLOCK + #define SOCKET_EAGAIN NIO_EAGAIN + #define SOCKET_ETIMEDOUT NIO_ETIMEDOUT + #define SOCKET_ECONNRESET NIO_ECONNRESET + #define SOCKET_EINTR NIO_EINTR + #define SOCKET_EPIPE NIO_EPIPE + #define SOCKET_ECONNREFUSED NIO_ECONNREFUSED + #define SOCKET_ECONNABORTED NIO_ECONNABORTED + #endif +#elif defined(WOLFSSL_MDK_ARM)|| defined(WOLFSSL_KEIL_TCP_NET) + #define SOCKET_EWOULDBLOCK BSD_ERROR_WOULDBLOCK + #define SOCKET_EAGAIN BSD_ERROR_LOCKED + #define SOCKET_ECONNRESET BSD_ERROR_CLOSED + #define SOCKET_EINTR BSD_ERROR + #define SOCKET_EPIPE BSD_ERROR + #define SOCKET_ECONNREFUSED BSD_ERROR + #define SOCKET_ECONNABORTED BSD_ERROR +#elif defined(WOLFSSL_PICOTCP) + #define SOCKET_EWOULDBLOCK PICO_ERR_EAGAIN + #define SOCKET_EAGAIN PICO_ERR_EAGAIN + #define SOCKET_ETIMEDOUT PICO_ERR_ETIMEDOUT + #define SOCKET_ECONNRESET PICO_ERR_ECONNRESET + #define SOCKET_EINTR PICO_ERR_EINTR + #define SOCKET_EPIPE PICO_ERR_EIO + #define SOCKET_ECONNREFUSED PICO_ERR_ECONNREFUSED + #define SOCKET_ECONNABORTED PICO_ERR_ESHUTDOWN +#elif defined(FREERTOS_TCP) + #define SOCKET_EWOULDBLOCK FREERTOS_EWOULDBLOCK + #define SOCKET_EAGAIN FREERTOS_EWOULDBLOCK + #define SOCKET_ETIMEDOUT (-pdFREERTOS_ERRNO_ETIMEDOUT) + #define SOCKET_ECONNRESET FREERTOS_SOCKET_ERROR + #define SOCKET_EINTR FREERTOS_SOCKET_ERROR + #define SOCKET_EPIPE FREERTOS_SOCKET_ERROR + #define SOCKET_ECONNREFUSED FREERTOS_SOCKET_ERROR + #define SOCKET_ECONNABORTED FREERTOS_SOCKET_ERROR +#elif defined(WOLFSSL_NUCLEUS_1_2) + #define SOCKET_EWOULDBLOCK NU_WOULD_BLOCK + #define SOCKET_EAGAIN NU_WOULD_BLOCK + #define SOCKET_ECONNRESET NU_NOT_CONNECTED + #define SOCKET_EINTR NU_NOT_CONNECTED + #define SOCKET_EPIPE NU_NOT_CONNECTED + #define SOCKET_ECONNREFUSED NU_CONNECTION_REFUSED + #define SOCKET_ECONNABORTED NU_NOT_CONNECTED +#elif defined(NUCLEUS_PLUS_2_3) + #define SOCKET_EWOULDBLOCK NU_WOULD_BLOCK + #define SOCKET_EAGAIN NU_NO_DATA + #define SOCKET_ECONNRESET NU_RESET + #define SOCKET_EINTR 0 + #define SOCKET_EPIPE 0 + #define SOCKET_ECONNREFUSED NU_CONNECTION_REFUSED + #define SOCKET_ECONNABORTED NU_CONNECTION_REFUSED +#elif defined(WOLFSSL_DEOS) + /* `sockaddr_storage` is not defined in DEOS. This workaround will + * work for IPV4, but not IPV6 + */ + #define sockaddr_storage sockaddr_in + #define SOCKET_EWOULDBLOCK EAGAIN + #define SOCKET_EAGAIN EAGAIN + #define SOCKET_ECONNRESET EINTR + #define SOCKET_EINTR EINTR + #define SOCKET_EPIPE EPIPE + #define SOCKET_ECONNREFUSED SOCKET_ERROR + #define SOCKET_ECONNABORTED SOCKET_ERROR +#elif defined(HAVE_NETX) + #define SOCKET_EWOULDBLOCK NX_NOT_CONNECTED + #define SOCKET_EAGAIN NX_NOT_CONNECTED + #define SOCKET_ECONNRESET NX_NOT_CONNECTED + #define SOCKET_EINTR NX_NOT_CONNECTED + #define SOCKET_EPIPE NX_NOT_CONNECTED + #define SOCKET_ECONNREFUSED NX_NOT_CONNECTED + #define SOCKET_ECONNABORTED NX_NOT_CONNECTED +#elif defined(FUSION_RTOS) + #define SOCKET_EWOULDBLOCK FCL_EWOULDBLOCK + #define SOCKET_EAGAIN FCL_EAGAIN + #define SOCKET_ECONNRESET FNS_ECONNRESET + #define SOCKET_EINTR FCL_EINTR + #define SOCKET_EPIPE FCL_EPIPE + #define SOCKET_ECONNREFUSED FCL_ECONNREFUSED + #define SOCKET_ECONNABORTED FNS_ECONNABORTED +#elif defined(WOLFSSL_LWIP_NATIVE) + #define SOCKET_EWOULDBLOCK ERR_WOULDBLOCK + #define SOCKET_EAGAIN ERR_WOULDBLOCK + #define SOCKET_TIMEDOUT ERR_TIMEOUT + #define SOCKET_ECONNRESET ERR_RST + #define SOCKET_EINTR ERR_CLSD + #define SOCKET_EPIPE ERR_CLSD + #define SOCKET_ECONNREFUSED ERR_CONN + #define SOCKET_ECONNABORTED ERR_ABRT +#elif defined(WOLFSSL_EMNET) + #define XSOCKLENT int + #define SOCKET_EWOULDBLOCK IP_ERR_WOULD_BLOCK + #define SOCKET_EAGAIN IP_ERR_WOULD_BLOCK + #define SOCKET_ECONNRESET IP_ERR_CONN_RESET + #define SOCKET_EINTR IP_ERR_FAULT + #define SOCKET_EPIPE IP_ERR_PIPE + #define SOCKET_ECONNREFUSED IP_ERR_CONN_REFUSED + #define SOCKET_ECONNABORTED IP_ERR_CONN_ABORTED +#else + #define SOCKET_EWOULDBLOCK EWOULDBLOCK + #define SOCKET_EAGAIN EAGAIN + #define SOCKET_ETIMEDOUT ETIMEDOUT + #define SOCKET_ECONNRESET ECONNRESET + #define SOCKET_EINTR EINTR + #define SOCKET_EPIPE EPIPE + #define SOCKET_ECONNREFUSED ECONNREFUSED + #define SOCKET_ECONNABORTED ECONNABORTED +#endif /* USE_WINDOWS_API */ + +#ifdef DEVKITPRO + /* from network.h */ + #include <network.h> + #define SEND_FUNCTION net_send + #define RECV_FUNCTION net_recv +#elif defined(WOLFSSL_ESPIDF) + #define SEND_FUNCTION send + #define RECV_FUNCTION recv + #if !defined(HAVE_SOCKADDR) && !defined(WOLFSSL_NO_SOCK) + #define HAVE_SOCKADDR + #endif +#elif defined(WOLFSSL_LWIP) && !defined(WOLFSSL_APACHE_MYNEWT) + #define SEND_FUNCTION lwip_send + #define RECV_FUNCTION lwip_recv +#elif defined(WOLFSSL_PICOTCP) + #define SEND_FUNCTION pico_send + #define RECV_FUNCTION pico_recv +#elif defined(FREERTOS_TCP) + #define RECV_FUNCTION(a,b,c,d) FreeRTOS_recv((Socket_t)(a),(void*)(b), (size_t)(c), (BaseType_t)(d)) + #define SEND_FUNCTION(a,b,c,d) FreeRTOS_send((Socket_t)(a),(void*)(b), (size_t)(c), (BaseType_t)(d)) +#elif defined(WOLFSSL_VXWORKS) + /*socket.h already has "typedef struct sockaddr SOCKADDR;" + so don't redefine it in wolfSSL */ + #define HAVE_SOCKADDR_DEFINED + #define SEND_FUNCTION send + #define RECV_FUNCTION recv +#elif defined(WOLFSSL_NUCLEUS_1_2) + #define SEND_FUNCTION NU_Send + #define RECV_FUNCTION NU_Recv +#elif defined(NUCLEUS_PLUS_2_3) + #define SEND_FUNCTION nucyassl_send + #define RECV_FUNCTION nucyassl_recv + #define DTLS_RECVFROM_FUNCTION nucyassl_recvfrom + #define DTLS_SENDTO_FUNCTION nucyassl_sendto +#elif defined(FUSION_RTOS) + #define SEND_FUNCTION FNS_SEND + #define RECV_FUNCTION FNS_RECV +#elif defined(WOLFSSL_ZEPHYR) + #ifndef WOLFSSL_MAX_SEND_SZ + #define WOLFSSL_MAX_SEND_SZ 256 + #endif + + #define SEND_FUNCTION send + #define RECV_FUNCTION recv +#elif defined(WOLFSSL_LINUXKM) + #define SEND_FUNCTION linuxkm_send + #define RECV_FUNCTION linuxkm_recv +#elif defined(WOLFSSL_SGX) + #define SEND_FUNCTION send + #define RECV_FUNCTION recv +#else + #define SEND_FUNCTION send + #define RECV_FUNCTION recv + #if !defined(HAVE_SOCKADDR) && !defined(WOLFSSL_NO_SOCK) + #define HAVE_SOCKADDR + #endif +#endif + +#ifndef WOLFSSL_NO_SOCK + #ifndef XSOCKLENT + #ifdef USE_WINDOWS_API + #define XSOCKLENT int + #elif defined(NUCLEUS_PLUS_2_3) + typedef int socklen_t; + #define XSOCKLENT socklen_t + #else + #define XSOCKLENT socklen_t + #endif + #endif + #ifndef XSOCKOPT_TYPE_OPTVAL_TYPE + #ifndef USE_WINDOWS_API + #define XSOCKOPT_TYPE_OPTVAL_TYPE void* + #else + #define XSOCKOPT_TYPE_OPTVAL_TYPE char* + #endif + #endif + + /* Socket Addr Support */ + #ifdef HAVE_SOCKADDR + #ifndef HAVE_SOCKADDR_DEFINED + typedef struct sockaddr SOCKADDR; + #endif + typedef struct sockaddr_storage SOCKADDR_S; + typedef struct sockaddr_in SOCKADDR_IN; + #ifdef WOLFSSL_IPV6 + typedef struct sockaddr_in6 SOCKADDR_IN6; + #endif + #if defined(HAVE_SYS_UN_H) && !defined(WOLFSSL_NO_SOCKADDR_UN) + #include <sys/un.h> + typedef struct sockaddr_un SOCKADDR_UN; + #endif + typedef struct hostent HOSTENT; + #endif /* HAVE_SOCKADDR */ + + #if defined(HAVE_GETADDRINFO) + typedef struct addrinfo ADDRINFO; + #endif +#endif /* WOLFSSL_NO_SOCK */ + + +/* IO API's */ +#ifdef HAVE_IO_TIMEOUT + WOLFSSL_API int wolfIO_SetBlockingMode(SOCKET_T sockfd, int non_blocking); + WOLFSSL_API void wolfIO_SetTimeout(int to_sec); + WOLFSSL_API int wolfIO_Select(SOCKET_T sockfd, int to_sec); +#endif +WOLFSSL_API int wolfIO_TcpConnect(SOCKET_T* sockfd, const char* ip, + unsigned short port, int to_sec); +#ifdef HAVE_SOCKADDR +WOLFSSL_API int wolfIO_TcpAccept(SOCKET_T sockfd, SOCKADDR* peer_addr, XSOCKLENT* peer_len); +#endif +WOLFSSL_API int wolfIO_TcpBind(SOCKET_T* sockfd, word16 port); +WOLFSSL_API int wolfIO_Send(SOCKET_T sd, char *buf, int sz, int wrFlags); +WOLFSSL_API int wolfIO_Recv(SOCKET_T sd, char *buf, int sz, int rdFlags); + +#ifdef WOLFSSL_HAVE_BIO_ADDR + +#ifdef WOLFSSL_NO_SOCK +#error WOLFSSL_HAVE_BIO_ADDR and WOLFSSL_NO_SOCK are mutually incompatible. +#endif + +union WOLFSSL_BIO_ADDR { + SOCKADDR sa; + SOCKADDR_IN sa_in; +#ifdef WOLFSSL_IPV6 + SOCKADDR_IN6 sa_in6; +#endif +#if defined(HAVE_SYS_UN_H) && !defined(WOLFSSL_NO_SOCKADDR_UN) + SOCKADDR_UN sa_un; +#endif +}; + +typedef union WOLFSSL_BIO_ADDR WOLFSSL_BIO_ADDR; + +#if defined(WOLFSSL_DTLS) && defined(OPENSSL_EXTRA) +WOLFSSL_API int wolfIO_SendTo(SOCKET_T sd, WOLFSSL_BIO_ADDR *addr, char *buf, int sz, int wrFlags); +WOLFSSL_API int wolfIO_RecvFrom(SOCKET_T sd, WOLFSSL_BIO_ADDR *addr, char *buf, int sz, int rdFlags); +#endif + +#endif /* WOLFSSL_HAVE_BIO_ADDR */ + +#endif /* USE_WOLFSSL_IO || HAVE_HTTP_CLIENT */ + +#ifndef WOLFSSL_NO_SOCK +#ifdef USE_WINDOWS_API + #ifndef CloseSocket + #define CloseSocket(s) closesocket(s) + #endif + #define StartTCP() { WSADATA wsd; WSAStartup(0x0002, &wsd); } +#elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) + #ifndef CloseSocket + extern int closesocket(int); + #define CloseSocket(s) closesocket(s) + #endif + #define StartTCP() WC_DO_NOTHING +#elif defined(FUSION_RTOS) + #ifndef CloseSocket + #define CloseSocket(s) do { \ + int err; \ + FNS_CLOSE(s, &err); \ + } while(0) + #endif + #define StartTCP() WC_DO_NOTHING +#else + #ifndef CloseSocket + #define CloseSocket(s) close(s) + #endif + #define StartTCP() WC_DO_NOTHING + #ifdef FREERTOS_TCP_WINSIM + extern int close(int); + #endif +#endif +#endif /* WOLFSSL_NO_SOCK */ + +WOLFSSL_API int wolfSSL_BioSend(WOLFSSL* ssl, char *buf, int sz, void *ctx); +WOLFSSL_API int wolfSSL_BioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx); +#ifndef OPENSSL_COEXIST +/* Preserve API previously exposed */ +#define BioSend wolfSSL_BioSend +#define BioReceive wolfSSL_BioReceive +#endif + +WOLFSSL_LOCAL int SslBioSend(WOLFSSL* ssl, char *buf, int sz, void *ctx); +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) +WOLFSSL_LOCAL int BioReceiveInternal(WOLFSSL_BIO* biord, WOLFSSL_BIO* biowr, + char* buf, int sz); +#endif +WOLFSSL_LOCAL int SslBioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx); +#if defined(USE_WOLFSSL_IO) + /* default IO callbacks */ + WOLFSSL_API int EmbedReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx); + WOLFSSL_API int EmbedSend(WOLFSSL* ssl, char* buf, int sz, void* ctx); + + #ifdef WOLFSSL_DTLS + #ifdef NUCLEUS_PLUS_2_3 + #define SELECT_FUNCTION nucyassl_select + WOLFSSL_LOCAL int nucyassl_select(INT sd, UINT32 timeout); + #endif + WOLFSSL_API int EmbedReceiveFrom(WOLFSSL *ssl, char *buf, int sz, + void *ctx); + WOLFSSL_API int EmbedSendTo(WOLFSSL* ssl, char *buf, int sz, void *ctx); + WOLFSSL_API int EmbedGenerateCookie(WOLFSSL* ssl, byte *buf, int sz, + void *ctx); + #ifdef WOLFSSL_MULTICAST + WOLFSSL_API int EmbedReceiveFromMcast(WOLFSSL *ssl, char *buf, + int sz, void *ctx); + #endif /* WOLFSSL_MULTICAST */ + #endif /* WOLFSSL_DTLS */ +#endif /* USE_WOLFSSL_IO */ + + +typedef int (*WolfSSLGenericIORecvCb)(char *buf, int sz, void *ctx); +#ifdef HAVE_OCSP + WOLFSSL_API int wolfIO_HttpBuildRequestOcsp(const char* domainName, + const char* path, int ocspReqSz, unsigned char* buf, int bufSize); + WOLFSSL_API int wolfIO_HttpProcessResponseOcspGenericIO( + WolfSSLGenericIORecvCb ioCb, void* ioCbCtx, unsigned char** respBuf, + unsigned char* httpBuf, int httpBufSz, void* heap); + WOLFSSL_API int wolfIO_HttpProcessResponseOcsp(int sfd, + unsigned char** respBuf, unsigned char* httpBuf, int httpBufSz, + void* heap); + + WOLFSSL_API int EmbedOcspLookup(void* ctx, const char* url, int urlSz, + byte* ocspReqBuf, int ocspReqSz, byte** ocspRespBuf); + WOLFSSL_API void EmbedOcspRespFree(void* ctx, byte *resp); +#endif + +#ifdef HAVE_CRL_IO + WOLFSSL_API int wolfIO_HttpBuildRequestCrl(const char* url, int urlSz, + const char* domainName, unsigned char* buf, int bufSize); + WOLFSSL_API int wolfIO_HttpProcessResponseCrl(WOLFSSL_CRL* crl, int sfd, + unsigned char* httpBuf, int httpBufSz); + + WOLFSSL_API int EmbedCrlLookup(WOLFSSL_CRL* crl, const char* url, + int urlSz); +#endif + + +#if defined(HAVE_HTTP_CLIENT) + WOLFSSL_API int wolfIO_DecodeUrl(const char* url, int urlSz, char* outName, + char* outPath, unsigned short* outPort); + + WOLFSSL_API int wolfIO_HttpBuildRequest(const char* reqType, + const char* domainName, const char* path, int pathLen, int reqSz, + const char* contentType, unsigned char* buf, int bufSize); + WOLFSSL_LOCAL int wolfIO_HttpBuildRequest_ex(const char* reqType, + const char* domainName, const char* path, int pathLen, int reqSz, + const char* contentType, const char *exHdrs, unsigned char* buf, int bufSize); + WOLFSSL_API int wolfIO_HttpProcessResponseGenericIO( + WolfSSLGenericIORecvCb ioCb, void* ioCbCtx, const char** appStrList, + unsigned char** respBuf, unsigned char* httpBuf, int httpBufSz, + int dynType, void* heap); + WOLFSSL_API int wolfIO_HttpProcessResponse(int sfd, const char** appStrList, + unsigned char** respBuf, unsigned char* httpBuf, int httpBufSz, + int dynType, void* heap); +#endif /* HAVE_HTTP_CLIENT */ + + +/* I/O callbacks */ +typedef int (*CallbackIORecv)(WOLFSSL *ssl, char *buf, int sz, void *ctx); +typedef int (*CallbackIOSend)(WOLFSSL *ssl, char *buf, int sz, void *ctx); +WOLFSSL_API void wolfSSL_CTX_SetIORecv(WOLFSSL_CTX *ctx, CallbackIORecv CBIORecv); +WOLFSSL_API void wolfSSL_CTX_SetIOSend(WOLFSSL_CTX *ctx, CallbackIOSend CBIOSend); +WOLFSSL_API void wolfSSL_SSLSetIORecv(WOLFSSL *ssl, CallbackIORecv CBIORecv); +WOLFSSL_API void wolfSSL_SSLSetIOSend(WOLFSSL *ssl, CallbackIOSend CBIOSend); +WOLFSSL_API void wolfSSL_SSLDisableRead(WOLFSSL *ssl); +WOLFSSL_API void wolfSSL_SSLEnableRead(WOLFSSL *ssl); +/* deprecated old name */ +#define wolfSSL_SetIORecv wolfSSL_CTX_SetIORecv +#define wolfSSL_SetIOSend wolfSSL_CTX_SetIOSend + +WOLFSSL_API void wolfSSL_SetIOReadCtx( WOLFSSL* ssl, void *ctx); +WOLFSSL_API void wolfSSL_SetIOWriteCtx(WOLFSSL* ssl, void *ctx); + +WOLFSSL_API void* wolfSSL_GetIOReadCtx( WOLFSSL* ssl); +WOLFSSL_API void* wolfSSL_GetIOWriteCtx(WOLFSSL* ssl); + +WOLFSSL_API void wolfSSL_SetIOReadFlags( WOLFSSL* ssl, int flags); +WOLFSSL_API void wolfSSL_SetIOWriteFlags(WOLFSSL* ssl, int flags); + +#ifdef HAVE_NETX + WOLFSSL_LOCAL int NetX_Receive(WOLFSSL *ssl, char *buf, int sz, void *ctx); + WOLFSSL_LOCAL int NetX_Send(WOLFSSL *ssl, char *buf, int sz, void *ctx); + + WOLFSSL_API void wolfSSL_SetIO_NetX(WOLFSSL* ssl, NX_TCP_SOCKET* nxsocket, + ULONG waitoption); +#endif /* HAVE_NETX */ + +#ifdef MICRIUM + WOLFSSL_LOCAL int MicriumSend(WOLFSSL* ssl, char* buf, int sz, void* ctx); + WOLFSSL_LOCAL int MicriumReceive(WOLFSSL* ssl, char* buf, int sz, + void* ctx); + WOLFSSL_LOCAL int MicriumReceiveFrom(WOLFSSL* ssl, char* buf, int sz, + void* ctx); + WOLFSSL_LOCAL int MicriumSendTo(WOLFSSL* ssl, char* buf, int sz, void* ctx); +#endif /* MICRIUM */ + +#if defined(WOLFSSL_APACHE_MYNEWT) && !defined(WOLFSSL_LWIP) + WOLFSSL_LOCAL int Mynewt_Receive(WOLFSSL *ssl, char *buf, int sz, void *ctx); + WOLFSSL_LOCAL int Mynewt_Send(WOLFSSL* ssl, char *buf, int sz, void *ctx); + WOLFSSL_API void wolfSSL_SetIO_Mynewt(WOLFSSL* ssl, struct mn_socket* mnSocket, + struct mn_sockaddr_in* mnSockAddrIn); +#endif /* defined(WOLFSSL_APACHE_MYNEWT) && !defined(WOLFSSL_LWIP) */ + +#ifdef WOLFSSL_UIP + + struct uip_wolfssl_ctx { + union socket_connector { + struct tcp_socket tcp; + struct udp_socket udp; + } conn; + WOLFSSL_CTX *ctx; + WOLFSSL *ssl; + byte *input_databuf; + byte *output_databuf; + byte *ssl_rx_databuf; + int ssl_rb_len; + int ssl_rb_off; + struct process *process; + tcp_socket_data_callback_t input_callback; + tcp_socket_event_callback_t event_callback; + int closing; + uip_ipaddr_t peer_addr; + word16 peer_port; + }; + + typedef struct uip_wolfssl_ctx uip_wolfssl_ctx; + + WOLFSSL_LOCAL int uIPSend(WOLFSSL* ssl, char* buf, int sz, void* ctx); + WOLFSSL_LOCAL int uIPReceive(WOLFSSL* ssl, char* buf, int sz, + void* ctx); + WOLFSSL_LOCAL int uIPReceiveFrom(WOLFSSL* ssl, char* buf, int sz, + void* ctx); + WOLFSSL_LOCAL int uIPSendTo(WOLFSSL* ssl, char* buf, int sz, void* ctx); + +#endif + +#ifdef WOLFSSL_GNRC + #include <sock_types.h> + #include <net/gnrc.h> + #include <net/af.h> + #include <net/sock.h> + #include <net/gnrc/tcp.h> + #include <net/gnrc/udp.h> + + struct gnrc_wolfssl_ctx { + union socket_connector { + #ifdef MODULE_SOCK_TCP + sock_tcp_t tcp; + #endif + sock_udp_t udp; + } conn; + WOLFSSL_CTX *ctx; + WOLFSSL *ssl; + + int closing; + struct _sock_tl_ep peer_addr; + }; + + typedef struct gnrc_wolfssl_ctx sock_tls_t; + + WOLFSSL_LOCAL int GNRC_ReceiveFrom(WOLFSSL* ssl, char* buf, int sz, + void* ctx); + WOLFSSL_LOCAL int GNRC_SendTo(WOLFSSL* ssl, char* buf, int sz, void* ctx); + +#endif + +#ifdef WOLFSSL_LWIP_NATIVE + #include "lwip/tcp.h" + #include "lwip/sockets.h" + + typedef struct WOLFSSL_LWIP_NATIVE_STATE { + struct tcp_pcb * pcb; + tcp_recv_fn recv_fn; + tcp_sent_fn sent_fn; + int pulled; + struct pbuf *pbuf; + int wait; + void * arg; /* arg for application */ + int idle_count; + } WOLFSSL_LWIP_NATIVE_STATE; + + WOLFSSL_LOCAL int LwIPNativeSend(WOLFSSL* ssl, char* buf, int sz, void* ctx); + WOLFSSL_LOCAL int LwIPNativeReceive(WOLFSSL* ssl, char* buf, int sz, + void* ctx); + WOLFSSL_API int wolfSSL_SetIO_LwIP(WOLFSSL* ssl, void *pcb, + tcp_recv_fn recv, tcp_sent_fn sent, void *arg); +#endif +#ifdef WOLFSSL_ISOTP + #define ISOTP_DEFAULT_TIMEOUT 100 + #define ISOTP_DEFAULT_WAIT_COUNT 3 + #define ISOTP_FIRST_FRAME_DATA_SIZE 6 + #define ISOTP_SINGLE_FRAME_DATA_SIZE 7 + #define ISOTP_MAX_CONSECUTIVE_FRAME_DATA_SIZE 7 + #define ISOTP_MAX_MS_FRAME_DELAY 0x7f + #define ISOTP_CAN_BUS_PAYLOAD_SIZE 8 + #define ISOTP_MAX_DATA_SIZE 4095 + /* Packets will never be larger than the ISO-TP max data size */ + #define ISOTP_DEFAULT_BUFFER_SIZE ISOTP_MAX_DATA_SIZE + #define ISOTP_FLOW_CONTROL_PACKET_SIZE 3 + #define ISOTP_FLOW_CONTROL_FRAMES 0 /* infinite */ + #define ISOTP_MAX_SEQUENCE_COUNTER 15 + + enum isotp_frame_type { + ISOTP_FRAME_TYPE_SINGLE = 0, + ISOTP_FRAME_TYPE_FIRST = 1, + ISOTP_FRAME_TYPE_CONSECUTIVE = 2, + ISOTP_FRAME_TYPE_CONTROL = 3 + }; + + enum isotp_flow_control { + ISOTP_FLOW_CONTROL_CTS = 0, + ISOTP_FLOW_CONTROL_WAIT = 1, + ISOTP_FLOW_CONTROL_ABORT = 2 + }; + + enum isotp_connection_state { + ISOTP_CONN_STATE_IDLE, + ISOTP_CONN_STATE_SENDING, + ISOTP_CONN_STATE_RECEIVING + }; + + typedef struct isotp_can_data { + byte data[ISOTP_CAN_BUS_PAYLOAD_SIZE]; + byte length; + } isotp_can_data; + + /* User supplied functions for sending/receiving CAN bus messages of up to + * 8 bytes, as well as a function to add an artificial delay when a + * receiver requests one. */ + typedef int (*can_recv_fn)(struct isotp_can_data *data, void *arg, + int timeout); + typedef int (*can_send_fn)(struct isotp_can_data *data, void *arg); + typedef void (*can_delay_fn)(int microseconds); + + typedef struct isotp_wolfssl_ctx { + struct isotp_can_data frame; + char *buf_ptr; + char *receive_buffer; + char *receive_buffer_ptr; + can_recv_fn recv_fn; + can_send_fn send_fn; + can_delay_fn delay_fn; + void *arg; + int receive_buffer_len; + int receive_buffer_size; + enum isotp_connection_state state; + word16 buf_length; + byte sequence; + byte flow_packets; + byte flow_counter; + byte frame_delay; + byte wait_counter; + byte receive_delay; + } isotp_wolfssl_ctx; + + WOLFSSL_LOCAL int ISOTP_Receive(WOLFSSL* ssl, char* buf, int sz, void* ctx); + WOLFSSL_LOCAL int ISOTP_Send(WOLFSSL* ssl, char* buf, int sz, void* ctx); + WOLFSSL_API int wolfSSL_SetIO_ISOTP(WOLFSSL *ssl, isotp_wolfssl_ctx *ctx, + can_recv_fn recv_fn, can_send_fn send_fn, can_delay_fn delay_fn, + word32 receive_delay, char *receive_buffer, + int receive_buffer_size, void *arg); + +#endif +#ifdef WOLFSSL_DTLS + typedef int (*CallbackGenCookie)(WOLFSSL* ssl, unsigned char* buf, int sz, + void* ctx); + WOLFSSL_API void wolfSSL_CTX_SetGenCookie(WOLFSSL_CTX* ctx, + CallbackGenCookie cb); + WOLFSSL_API void wolfSSL_SetCookieCtx(WOLFSSL* ssl, void *ctx); + WOLFSSL_API void* wolfSSL_GetCookieCtx(WOLFSSL* ssl); + +#endif +#ifdef WOLFSSL_SESSION_EXPORT + typedef int (*CallbackGetPeer)(WOLFSSL* ssl, char* ip, int* ipSz, + unsigned short* port, int* fam); + typedef int (*CallbackSetPeer)(WOLFSSL* ssl, char* ip, int ipSz, + unsigned short port, int fam); + + WOLFSSL_API void wolfSSL_CTX_SetIOGetPeer(WOLFSSL_CTX*, CallbackGetPeer); + WOLFSSL_API void wolfSSL_CTX_SetIOSetPeer(WOLFSSL_CTX*, CallbackSetPeer); + WOLFSSL_API int EmbedGetPeer(WOLFSSL* ssl, char* ip, int* ipSz, + unsigned short* port, int* fam); + WOLFSSL_API int EmbedSetPeer(WOLFSSL* ssl, char* ip, int ipSz, + unsigned short port, int fam); +#endif /* WOLFSSL_SESSION_EXPORT */ + + + +#ifndef XINET_NTOP + #if defined(__WATCOMC__) + #if defined(__OS2__) || defined(__NT__) && \ + (NTDDI_VERSION >= NTDDI_VISTA) + #define XINET_NTOP(a,b,c,d) inet_ntop((a),(b),(c),(d)) + #else + #define XINET_NTOP(a,b,c,d) \ + strncpy((c),inet_ntoa(*(unsigned *)(b)),(d)) + #endif + #elif defined(USE_WINDOWS_API) /* Windows-friendly definition */ + #define XINET_NTOP(a,b,c,d) InetNtop((a),(b),(c),(d)) + #else + #define XINET_NTOP(a,b,c,d) inet_ntop((a),(b),(c),(d)) + #endif +#endif +#ifndef XINET_PTON + #if defined(__WATCOMC__) + #if defined(__OS2__) || defined(__NT__) && \ + (NTDDI_VERSION >= NTDDI_VISTA) + #define XINET_PTON(a,b,c) inet_pton((a),(b),(c)) + #else + #define XINET_PTON(a,b,c) *(unsigned *)(c) = inet_addr((b)) + #endif + #elif defined(USE_WINDOWS_API) /* Windows-friendly definition */ + #if defined(__MINGW64__) && !defined(UNICODE) + #define XINET_PTON(a,b,c) InetPton((a),(b),(c)) + #else + #define XINET_PTON(a,b,c) InetPton((a),(PCWSTR)(b),(c)) + #endif + #else + #define XINET_PTON(a,b,c) inet_pton((a),(b),(c)) + #endif +#endif + +#ifndef XHTONS + #if !defined(WOLFSSL_NO_SOCK) && (defined(USE_WOLFSSL_IO) || defined(HAVE_HTTP_CLIENT)) + #define XHTONS(a) htons((a)) + #else + /* we don't have sockets, so define our own htons and ntohs */ + #ifdef BIG_ENDIAN_ORDER + #define XHTONS(a) (a) + #else + #define XHTONS(a) ((((a) >> 8) & 0xff) | (((a) & 0xff) << 8)) + #endif + #endif +#endif +#ifndef XNTOHS + #if !defined(WOLFSSL_NO_SOCK) && (defined(USE_WOLFSSL_IO) || defined(HAVE_HTTP_CLIENT)) + #define XNTOHS(a) ntohs((a)) + #else + /* we don't have sockets, so define our own htons and ntohs */ + #ifdef BIG_ENDIAN_ORDER + #define XNTOHS(a) (a) + #else + #define XNTOHS(a) ((((a) >> 8) & 0xff) | (((a) & 0xff) << 8)) + #endif + #endif +#endif + +#ifndef WOLFSSL_IP4 + #define WOLFSSL_IP4 AF_INET +#endif +#ifndef WOLFSSL_IP6 + #define WOLFSSL_IP6 AF_INET6 +#endif + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WOLFSSL_IO_H */ diff --git a/android_studio/distribution/wolfssl/lib/arm64-v8a/libwolfssl.so b/android_studio/distribution/wolfssl/lib/arm64-v8a/libwolfssl.so Binary files differ.