repo
stringlengths
1
152
file
stringlengths
14
221
code
stringlengths
501
25k
file_length
int64
501
25k
avg_line_length
float64
20
99.5
max_line_length
int64
21
134
extension_type
stringclasses
2 values
openssl
openssl-master/include/internal/recordmethod.h
/* * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OSSL_INTERNAL_RECORDMETHOD_H # define OSSL_INTERNAL_RECORDMETHOD_H # pragma once # include <openssl/ssl.h> /* * We use the term "record" here to refer to a packet of data. Records are * typically protected via a cipher and MAC, or an AEAD cipher (although not * always). This usage of the term record is consistent with the TLS concept. * In QUIC the term "record" is not used but it is analogous to the QUIC term * "packet". The interface in this file applies to all protocols that protect * records/packets of data, i.e. (D)TLS and QUIC. The term record is used to * refer to both contexts. */ /* * An OSSL_RECORD_METHOD is a protocol specific method which provides the * functions for reading and writing records for that protocol. Which * OSSL_RECORD_METHOD to use for a given protocol is defined by the SSL_METHOD. */ typedef struct ossl_record_method_st OSSL_RECORD_METHOD; /* * An OSSL_RECORD_LAYER is just an externally defined opaque pointer created by * the method */ typedef struct ossl_record_layer_st OSSL_RECORD_LAYER; # define OSSL_RECORD_ROLE_CLIENT 0 # define OSSL_RECORD_ROLE_SERVER 1 # define OSSL_RECORD_DIRECTION_READ 0 # define OSSL_RECORD_DIRECTION_WRITE 1 /* * Protection level. For <= TLSv1.2 only "NONE" and "APPLICATION" are used. */ # define OSSL_RECORD_PROTECTION_LEVEL_NONE 0 # define OSSL_RECORD_PROTECTION_LEVEL_EARLY 1 # define OSSL_RECORD_PROTECTION_LEVEL_HANDSHAKE 2 # define OSSL_RECORD_PROTECTION_LEVEL_APPLICATION 3 # define OSSL_RECORD_RETURN_SUCCESS 1 # define OSSL_RECORD_RETURN_RETRY 0 # define OSSL_RECORD_RETURN_NON_FATAL_ERR -1 # define OSSL_RECORD_RETURN_FATAL -2 # define OSSL_RECORD_RETURN_EOF -3 /* * Template for creating a record. A record consists of the |type| of data it * will contain (e.g. alert, handshake, application data, etc) along with a * buffer of payload data in |buf| of length |buflen|. */ struct ossl_record_template_st { unsigned char type; unsigned int version; const unsigned char *buf; size_t buflen; }; typedef struct ossl_record_template_st OSSL_RECORD_TEMPLATE; /* * Rather than a "method" approach, we could make this fetchable - Should we? * There could be some complexity in finding suitable record layer implementations * e.g. we need to find one that matches the negotiated protocol, cipher, * extensions, etc. The selection_cb approach given above doesn't work so well * if unknown third party providers with OSSL_RECORD_METHOD implementations are * loaded. */ /* * If this becomes public API then we will need functions to create and * free an OSSL_RECORD_METHOD, as well as functions to get/set the various * function pointers....unless we make it fetchable. */ struct ossl_record_method_st { /* * Create a new OSSL_RECORD_LAYER object for handling the protocol version * set by |vers|. |role| is 0 for client and 1 for server. |direction| * indicates either read or write. |level| is the protection level as * described above. |settings| are mandatory settings that will cause the * new() call to fail if they are not understood (for example to require * Encrypt-Then-Mac support). |options| are optional settings that will not * cause the new() call to fail if they are not understood (for example * whether to use "read ahead" or not). * * The BIO in |transport| is the BIO for the underlying transport layer. * Where the direction is "read", then this BIO will only ever be used for * reading data. Where the direction is "write", then this BIO will only * every be used for writing data. * * An SSL object will always have at least 2 OSSL_RECORD_LAYER objects in * force at any one time (one for reading and one for writing). In some * protocols more than 2 might be used (e.g. in DTLS for retransmitting * messages from an earlier epoch). * * The created OSSL_RECORD_LAYER object is stored in *ret on success (or * NULL otherwise). The return value will be one of * OSSL_RECORD_RETURN_SUCCESS, OSSL_RECORD_RETURN_FATAL or * OSSL_RECORD_RETURN_NON_FATAL. A non-fatal return means that creation of * the record layer has failed because it is unsuitable, but an alternative * record layer can be tried instead. */ /* * If we eventually make this fetchable then we will need to use something * other than EVP_CIPHER. Also mactype would not be a NID, but a string. For * now though, this works. */ int (*new_record_layer)(OSSL_LIB_CTX *libctx, const char *propq, int vers, int role, int direction, int level, uint16_t epoch, unsigned char *secret, size_t secretlen, unsigned char *key, size_t keylen, unsigned char *iv, size_t ivlen, unsigned char *mackey, size_t mackeylen, const EVP_CIPHER *ciph, size_t taglen, int mactype, const EVP_MD *md, COMP_METHOD *comp, const EVP_MD *kdfdigest, BIO *prev, BIO *transport, BIO *next, BIO_ADDR *local, BIO_ADDR *peer, const OSSL_PARAM *settings, const OSSL_PARAM *options, const OSSL_DISPATCH *fns, void *cbarg, void *rlarg, OSSL_RECORD_LAYER **ret); int (*free)(OSSL_RECORD_LAYER *rl); /* Returns 1 if we have unprocessed data buffered or 0 otherwise */ int (*unprocessed_read_pending)(OSSL_RECORD_LAYER *rl); /* * Returns 1 if we have processed data buffered that can be read or 0 otherwise * - not necessarily app data */ int (*processed_read_pending)(OSSL_RECORD_LAYER *rl); /* * The amount of processed app data that is internally buffered and * available to read */ size_t (*app_data_pending)(OSSL_RECORD_LAYER *rl); /* * Find out the maximum number of records that the record layer is prepared * to process in a single call to write_records. It is the caller's * responsibility to ensure that no call to write_records exceeds this * number of records. |type| is the type of the records that the caller * wants to write, and |len| is the total amount of data that it wants * to send. |maxfrag| is the maximum allowed fragment size based on user * configuration, or TLS parameter negotiation. |*preffrag| contains on * entry the default fragment size that will actually be used based on user * configuration. This will always be less than or equal to |maxfrag|. On * exit the record layer may update this to an alternative fragment size to * be used. This must always be less than or equal to |maxfrag|. */ size_t (*get_max_records)(OSSL_RECORD_LAYER *rl, int type, size_t len, size_t maxfrag, size_t *preffrag); /* * Write |numtempl| records from the array of record templates pointed to * by |templates|. Each record should be no longer than the value returned * by get_max_record_len(), and there should be no more records than the * value returned by get_max_records(). * Where possible the caller will attempt to ensure that all records are the * same length, except the last record. This may not always be possible so * the record method implementation should not rely on this being the case. * In the event of a retry the caller should call retry_write_records() * to try again. No more calls to write_records() should be attempted until * retry_write_records() returns success. * Buffers allocated for the record templates can be freed immediately after * write_records() returns - even in the case a retry. * The record templates represent the plaintext payload. The encrypted * output is written to the |transport| BIO. * Returns: * 1 on success * 0 on retry * -1 on failure */ int (*write_records)(OSSL_RECORD_LAYER *rl, OSSL_RECORD_TEMPLATE *templates, size_t numtempl); /* * Retry a previous call to write_records. The caller should continue to * call this until the function returns with success or failure. After * each retry more of the data may have been incrementally sent. * Returns: * 1 on success * 0 on retry * -1 on failure */ int (*retry_write_records)(OSSL_RECORD_LAYER *rl); /* * Read a record and return the record layer version and record type in * the |rversion| and |type| parameters. |*data| is set to point to a * record layer buffer containing the record payload data and |*datalen| * is filled in with the length of that data. The |epoch| and |seq_num| * values are only used if DTLS has been negotiated. In that case they are * filled in with the epoch and sequence number from the record. * An opaque record layer handle for the record is returned in |*rechandle| * which is used in a subsequent call to |release_record|. The buffer must * remain available until all the bytes from record are released via one or * more release_record calls. * * Internally the the OSSL_RECORD_METHOD the implementation may read/process * multiple records in one go and buffer them. */ int (*read_record)(OSSL_RECORD_LAYER *rl, void **rechandle, int *rversion, int *type, const unsigned char **data, size_t *datalen, uint16_t *epoch, unsigned char *seq_num); /* * Release length bytes from a buffer associated with a record previously * read with read_record. Once all the bytes from a record are released, the * whole record and its associated buffer is released. Records are * guaranteed to be released in the order that they are read. */ int (*release_record)(OSSL_RECORD_LAYER *rl, void *rechandle, size_t length); /* * In the event that a fatal error is returned from the functions above then * get_alert_code() can be called to obtain a more details identifier for * the error. In (D)TLS this is the alert description code. */ int (*get_alert_code)(OSSL_RECORD_LAYER *rl); /* * Update the transport BIO from the one originally set in the * new_record_layer call */ int (*set1_bio)(OSSL_RECORD_LAYER *rl, BIO *bio); /* Called when protocol negotiation selects a protocol version to use */ int (*set_protocol_version)(OSSL_RECORD_LAYER *rl, int version); /* * Whether we are allowed to receive unencrypted alerts, even if we might * otherwise expect encrypted records. Ignored by protocol versions where * this isn't relevant */ void (*set_plain_alerts)(OSSL_RECORD_LAYER *rl, int allow); /* * Called immediately after creation of the record layer if we are in a * first handshake. Also called at the end of the first handshake */ void (*set_first_handshake)(OSSL_RECORD_LAYER *rl, int first); /* * Set the maximum number of pipelines that the record layer should process. * The default is 1. */ void (*set_max_pipelines)(OSSL_RECORD_LAYER *rl, size_t max_pipelines); /* * Called to tell the record layer whether we are currently "in init" or * not. Default at creation of the record layer is "yes". */ void (*set_in_init)(OSSL_RECORD_LAYER *rl, int in_init); /* * Get a short or long human readable description of the record layer state */ void (*get_state)(OSSL_RECORD_LAYER *rl, const char **shortstr, const char **longstr); /* * Set new options or modify ones that were originally specified in the * new_record_layer call. */ int (*set_options)(OSSL_RECORD_LAYER *rl, const OSSL_PARAM *options); const COMP_METHOD *(*get_compression)(OSSL_RECORD_LAYER *rl); /* * Set the maximum fragment length to be used for the record layer. This * will override any previous value supplied for the "max_frag_len" * setting during construction of the record layer. */ void (*set_max_frag_len)(OSSL_RECORD_LAYER *rl, size_t max_frag_len); /* * The maximum expansion in bytes that the record layer might add while * writing a record */ size_t (*get_max_record_overhead)(OSSL_RECORD_LAYER *rl); /* * Increment the record sequence number */ int (*increment_sequence_ctr)(OSSL_RECORD_LAYER *rl); /* * Allocate read or write buffers. Does nothing if already allocated. * Assumes default buffer length and 1 pipeline. */ int (*alloc_buffers)(OSSL_RECORD_LAYER *rl); /* * Free read or write buffers. Fails if there is pending read or write * data. Buffers are automatically reallocated on next read/write. */ int (*free_buffers)(OSSL_RECORD_LAYER *rl); }; /* Standard built-in record methods */ extern const OSSL_RECORD_METHOD ossl_tls_record_method; # ifndef OPENSSL_NO_KTLS extern const OSSL_RECORD_METHOD ossl_ktls_record_method; # endif extern const OSSL_RECORD_METHOD ossl_dtls_record_method; #endif /* !defined(OSSL_INTERNAL_RECORDMETHOD_H) */
14,181
40.711765
83
h
openssl
openssl-master/include/internal/refcount.h
/* * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OSSL_INTERNAL_REFCOUNT_H # define OSSL_INTERNAL_REFCOUNT_H # pragma once # include <openssl/e_os2.h> # include <openssl/trace.h> # if defined(OPENSSL_THREADS) && !defined(OPENSSL_DEV_NO_ATOMICS) # if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \ && !defined(__STDC_NO_ATOMICS__) # include <stdatomic.h> # define HAVE_C11_ATOMICS # endif # if defined(HAVE_C11_ATOMICS) && defined(ATOMIC_INT_LOCK_FREE) \ && ATOMIC_INT_LOCK_FREE > 0 # define HAVE_ATOMICS 1 typedef struct { _Atomic int val; } CRYPTO_REF_COUNT; static inline int CRYPTO_UP_REF(CRYPTO_REF_COUNT *refcnt, int *ret) { *ret = atomic_fetch_add_explicit(&refcnt->val, 1, memory_order_relaxed) + 1; return 1; } /* * Changes to shared structure other than reference counter have to be * serialized. And any kind of serialization implies a release fence. This * means that by the time reference counter is decremented all other * changes are visible on all processors. Hence decrement itself can be * relaxed. In case it hits zero, object will be destructed. Since it's * last use of the object, destructor programmer might reason that access * to mutable members doesn't have to be serialized anymore, which would * otherwise imply an acquire fence. Hence conditional acquire fence... */ static inline int CRYPTO_DOWN_REF(CRYPTO_REF_COUNT *refcnt, int *ret) { *ret = atomic_fetch_sub_explicit(&refcnt->val, 1, memory_order_relaxed) - 1; if (*ret == 0) atomic_thread_fence(memory_order_acquire); return 1; } static inline int CRYPTO_GET_REF(CRYPTO_REF_COUNT *refcnt, int *ret) { *ret = atomic_load_explicit(&refcnt->val, memory_order_relaxed); return 1; } # elif defined(__GNUC__) && defined(__ATOMIC_RELAXED) && __GCC_ATOMIC_INT_LOCK_FREE > 0 # define HAVE_ATOMICS 1 typedef struct { int val; } CRYPTO_REF_COUNT; static __inline__ int CRYPTO_UP_REF(CRYPTO_REF_COUNT *refcnt, int *ret) { *ret = __atomic_fetch_add(&refcnt->val, 1, __ATOMIC_RELAXED) + 1; return 1; } static __inline__ int CRYPTO_DOWN_REF(CRYPTO_REF_COUNT *refcnt, int *ret) { *ret = __atomic_fetch_sub(&refcnt->val, 1, __ATOMIC_RELAXED) - 1; if (*ret == 0) __atomic_thread_fence(__ATOMIC_ACQUIRE); return 1; } static __inline__ int CRYPTO_GET_REF(CRYPTO_REF_COUNT *refcnt, int *ret) { *ret = __atomic_load_n(&refcnt->val, __ATOMIC_RELAXED); return 1; } # elif defined(__ICL) && defined(_WIN32) # define HAVE_ATOMICS 1 typedef struct { volatile int val; } CRYPTO_REF_COUNT; static __inline int CRYPTO_UP_REF(CRYPTO_REF_COUNT *refcnt, int *ret) { *ret = _InterlockedExchangeAdd((void *)&refcnt->val, 1) + 1; return 1; } static __inline int CRYPTO_DOWN_REF(CRYPTO_REF_COUNT *val, int *refcnt) { *ret = _InterlockedExchangeAdd((void *)&refcnt->val, -1) - 1; return 1; } static __inline int CRYPTO_GET_REF(CRYPTO_REF_COUNT *refcnt, int *ret) { *ret = _InterlockedOr((void *)&refcnt->val, 0); return 1; } # elif defined(_MSC_VER) && _MSC_VER>=1200 # define HAVE_ATOMICS 1 typedef struct { volatile int val; } CRYPTO_REF_COUNT; # if (defined(_M_ARM) && _M_ARM>=7 && !defined(_WIN32_WCE)) || defined(_M_ARM64) # include <intrin.h> # if defined(_M_ARM64) && !defined(_ARM_BARRIER_ISH) # define _ARM_BARRIER_ISH _ARM64_BARRIER_ISH # endif static __inline int CRYPTO_UP_REF(CRYPTO_REF_COUNT *refcnt, int *ret) { *ret = _InterlockedExchangeAdd_nf(&refcnt->val, 1) + 1; return 1; } static __inline int CRYPTO_DOWN_REF(CRYPTO_REF_COUNT *refcnt, int *ret) { *ret = _InterlockedExchangeAdd_nf(&refcnt->val, -1) - 1; if (*ret == 0) __dmb(_ARM_BARRIER_ISH); return 1; } static __inline int CRYPTO_GET_REF(CRYPTO_REF_COUNT *refcnt, int *ret) { *ret = _InterlockedOr_nf((void *)&refcnt->val, 0); return 1; } # else # if !defined(_WIN32_WCE) # pragma intrinsic(_InterlockedExchangeAdd) # else # if _WIN32_WCE >= 0x600 extern long __cdecl _InterlockedExchangeAdd(long volatile*, long); # else /* under Windows CE we still have old-style Interlocked* functions */ extern long __cdecl InterlockedExchangeAdd(long volatile*, long); # define _InterlockedExchangeAdd InterlockedExchangeAdd # endif # endif static __inline int CRYPTO_UP_REF(CRYPTO_REF_COUNT *refcnt, int *ret) { *ret = _InterlockedExchangeAdd(&refcnt->val, 1) + 1; return 1; } static __inline int CRYPTO_DOWN_REF(CRYPTO_REF_COUNT *refcnt, int *ret) { *ret = _InterlockedExchangeAdd(&refcnt->val, -1) - 1; return 1; } static __inline int CRYPTO_GET_REF(CRYPTO_REF_COUNT *refcnt, int *ret) { *ret = _InterlockedExchangeAdd(&refcnt->val, 0); return 1; } # endif # endif # endif /* !OPENSSL_DEV_NO_ATOMICS */ /* * All the refcounting implementations above define HAVE_ATOMICS, so if it's * still undefined here (such as when OPENSSL_DEV_NO_ATOMICS is defined), it * means we need to implement a fallback. This fallback uses locks. */ # ifndef HAVE_ATOMICS typedef struct { int val; # ifdef OPENSSL_THREADS CRYPTO_RWLOCK *lock; # endif } CRYPTO_REF_COUNT; # ifdef OPENSSL_THREADS static ossl_unused ossl_inline int CRYPTO_UP_REF(CRYPTO_REF_COUNT *refcnt, int *ret) { return CRYPTO_atomic_add(&refcnt->val, 1, ret, refcnt->lock); } static ossl_unused ossl_inline int CRYPTO_DOWN_REF(CRYPTO_REF_COUNT *refcnt, int *ret) { return CRYPTO_atomic_add(&refcnt->val, -1, ret, refcnt->lock); } static ossl_unused ossl_inline int CRYPTO_GET_REF(CRYPTO_REF_COUNT *refcnt, int *ret) { return CRYPTO_atomic_load_int(&refcnt->val, ret, refcnt->lock); } # define CRYPTO_NEW_FREE_DEFINED 1 static ossl_unused ossl_inline int CRYPTO_NEW_REF(CRYPTO_REF_COUNT *refcnt, int n) { refcnt->val = n; refcnt->lock = CRYPTO_THREAD_lock_new(); if (refcnt->lock == NULL) { ERR_raise(ERR_LIB_CRYPTO, ERR_R_CRYPTO_LIB); return 0; } return 1; } static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt) \ { if (refcnt != NULL) CRYPTO_THREAD_lock_free(refcnt->lock); } # else /* OPENSSL_THREADS */ static ossl_unused ossl_inline int CRYPTO_UP_REF(CRYPTO_REF_COUNT *refcnt, int *ret) { refcnt->val++; *ret = refcnt->val; return 1; } static ossl_unused ossl_inline int CRYPTO_DOWN_REF(CRYPTO_REF_COUNT *refcnt, int *ret) { refcnt->val--; *ret = refcnt->val; return 1; } static ossl_unused ossl_inline int CRYPTO_GET_REF(CRYPTO_REF_COUNT *refcnt, int *ret) { *ret = refcnt->val; return 1; } # endif /* OPENSSL_THREADS */ # endif # ifndef CRYPTO_NEW_FREE_DEFINED static ossl_unused ossl_inline int CRYPTO_NEW_REF(CRYPTO_REF_COUNT *refcnt, int n) { refcnt->val = n; return 1; } static ossl_unused ossl_inline void CRYPTO_FREE_REF(CRYPTO_REF_COUNT *refcnt) \ { } # endif /* CRYPTO_NEW_FREE_DEFINED */ #undef CRYPTO_NEW_FREE_DEFINED # if !defined(NDEBUG) && !defined(OPENSSL_NO_STDIO) # define REF_ASSERT_ISNT(test) \ (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0) # else # define REF_ASSERT_ISNT(i) # endif # define REF_PRINT_EX(text, count, object) \ OSSL_TRACE3(REF_COUNT, "%p:%4d:%s\n", (object), (count), (text)); # define REF_PRINT_COUNT(text, object) \ REF_PRINT_EX(text, object->references.val, (void *)object) #endif
8,093
26.814433
112
h
openssl
openssl-master/include/internal/ring_buf.h
/* * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OSSL_INTERNAL_RING_BUF_H # define OSSL_INTERNAL_RING_BUF_H # pragma once # include <openssl/e_os2.h> /* For 'ossl_inline' */ /* * ================================================================== * Byte-wise ring buffer which supports pushing and popping blocks of multiple * bytes at a time. The logical offset of each byte for the purposes of a QUIC * stream is tracked. Bytes can be popped from the ring buffer in two stages; * first they are popped, and then they are culled. Bytes which have been popped * but not yet culled will not be overwritten, and can be restored. */ struct ring_buf { void *start; size_t alloc; /* size of buffer allocation in bytes */ /* * Logical offset of the head (where we append to). This is the current size * of the QUIC stream. This increases monotonically. */ uint64_t head_offset; /* * Logical offset of the cull tail. Data is no longer needed and is * deallocated as the cull tail advances, which occurs as data is * acknowledged. This increases monotonically. */ uint64_t ctail_offset; }; static ossl_inline int ring_buf_init(struct ring_buf *r) { r->start = NULL; r->alloc = 0; r->head_offset = r->ctail_offset = 0; return 1; } static ossl_inline void ring_buf_destroy(struct ring_buf *r, int cleanse) { if (cleanse) OPENSSL_clear_free(r->start, r->alloc); else OPENSSL_free(r->start); r->start = NULL; r->alloc = 0; } static ossl_inline size_t ring_buf_used(struct ring_buf *r) { return (size_t)(r->head_offset - r->ctail_offset); } static ossl_inline size_t ring_buf_avail(struct ring_buf *r) { return r->alloc - ring_buf_used(r); } static ossl_inline int ring_buf_write_at(struct ring_buf *r, uint64_t logical_offset, const unsigned char *buf, size_t buf_len) { size_t avail, idx, l; unsigned char *start = r->start; int i; avail = ring_buf_avail(r); if (logical_offset < r->ctail_offset || logical_offset + buf_len > r->head_offset + avail) return 0; for (i = 0; buf_len > 0 && i < 2; ++i) { idx = logical_offset % r->alloc; l = r->alloc - idx; if (buf_len < l) l = buf_len; memcpy(start + idx, buf, l); if (r->head_offset < logical_offset + l) r->head_offset = logical_offset + l; logical_offset += l; buf += l; buf_len -= l; } assert(buf_len == 0); return 1; } static ossl_inline size_t ring_buf_push(struct ring_buf *r, const unsigned char *buf, size_t buf_len) { size_t pushed = 0, avail, idx, l; unsigned char *start = r->start; for (;;) { avail = ring_buf_avail(r); if (buf_len > avail) buf_len = avail; if (buf_len == 0) break; idx = r->head_offset % r->alloc; l = r->alloc - idx; if (buf_len < l) l = buf_len; memcpy(start + idx, buf, l); r->head_offset += l; buf += l; buf_len -= l; pushed += l; } return pushed; } static ossl_inline const unsigned char *ring_buf_get_ptr(const struct ring_buf *r, uint64_t logical_offset, size_t *max_len) { unsigned char *start = r->start; size_t idx; if (logical_offset >= r->head_offset || logical_offset < r->ctail_offset) return NULL; idx = logical_offset % r->alloc; *max_len = r->alloc - idx; return start + idx; } /* * Retrieves data out of the read side of the ring buffer starting at the given * logical offset. *buf is set to point to a contiguous span of bytes and * *buf_len is set to the number of contiguous bytes. After this function * returns, there may or may not be more bytes available at the logical offset * of (logical_offset + *buf_len) by calling this function again. If the logical * offset is out of the range retained by the ring buffer, returns 0, else * returns 1. A logical offset at the end of the range retained by the ring * buffer is not considered an error and is returned with a *buf_len of 0. * * The ring buffer state is not changed. */ static ossl_inline int ring_buf_get_buf_at(const struct ring_buf *r, uint64_t logical_offset, const unsigned char **buf, size_t *buf_len) { const unsigned char *start = r->start; size_t idx, l; if (logical_offset > r->head_offset || logical_offset < r->ctail_offset) return 0; if (r->alloc == 0) { *buf = NULL; *buf_len = 0; return 1; } idx = logical_offset % r->alloc; l = (size_t)(r->head_offset - logical_offset); if (l > r->alloc - idx) l = r->alloc - idx; *buf = start + idx; *buf_len = l; return 1; } static ossl_inline void ring_buf_cpop_range(struct ring_buf *r, uint64_t start, uint64_t end, int cleanse) { assert(end >= start); if (start > r->ctail_offset) return; if (cleanse && r->alloc > 0 && end > r->ctail_offset) { size_t idx = r->ctail_offset % r->alloc; uint64_t cleanse_end = end + 1; size_t l; if (cleanse_end > r->head_offset) cleanse_end = r->head_offset; l = (size_t)(cleanse_end - r->ctail_offset); if (l > r->alloc - idx) { OPENSSL_cleanse((unsigned char *)r->start + idx, r->alloc - idx); l -= r->alloc - idx; idx = 0; } if (l > 0) OPENSSL_cleanse((unsigned char *)r->start + idx, l); } r->ctail_offset = end + 1; /* Allow culling unpushed data */ if (r->head_offset < r->ctail_offset) r->head_offset = r->ctail_offset; } static ossl_inline int ring_buf_resize(struct ring_buf *r, size_t num_bytes, int cleanse) { struct ring_buf rnew = {0}; const unsigned char *src = NULL; size_t src_len = 0, copied = 0; if (num_bytes == r->alloc) return 1; if (num_bytes < ring_buf_used(r)) return 0; rnew.start = OPENSSL_malloc(num_bytes); if (rnew.start == NULL) return 0; rnew.alloc = num_bytes; rnew.head_offset = r->head_offset - ring_buf_used(r); rnew.ctail_offset = rnew.head_offset; for (;;) { if (!ring_buf_get_buf_at(r, r->ctail_offset + copied, &src, &src_len)) { OPENSSL_free(rnew.start); return 0; } if (src_len == 0) break; if (ring_buf_push(&rnew, src, src_len) != src_len) { OPENSSL_free(rnew.start); return 0; } copied += src_len; } assert(rnew.head_offset == r->head_offset); rnew.ctail_offset = r->ctail_offset; ring_buf_destroy(r, cleanse); memcpy(r, &rnew, sizeof(*r)); return 1; } #endif /* OSSL_INTERNAL_RING_BUF_H */
7,808
28.357143
82
h
openssl
openssl-master/include/internal/sha3.h
/* * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ /* This header can move into provider when legacy support is removed */ #ifndef OSSL_INTERNAL_SHA3_H # define OSSL_INTERNAL_SHA3_H # pragma once # include <openssl/e_os2.h> # include <stddef.h> # define KECCAK1600_WIDTH 1600 # define SHA3_MDSIZE(bitlen) (bitlen / 8) # define KMAC_MDSIZE(bitlen) 2 * (bitlen / 8) # define SHA3_BLOCKSIZE(bitlen) (KECCAK1600_WIDTH - bitlen * 2) / 8 typedef struct keccak_st KECCAK1600_CTX; typedef size_t (sha3_absorb_fn)(void *vctx, const void *inp, size_t len); typedef int (sha3_final_fn)(unsigned char *md, void *vctx); typedef struct prov_sha3_meth_st { sha3_absorb_fn *absorb; sha3_final_fn *final; } PROV_SHA3_METHOD; struct keccak_st { uint64_t A[5][5]; size_t block_size; /* cached ctx->digest->block_size */ size_t md_size; /* output length, variable in XOF */ size_t bufsz; /* used bytes in below buffer */ unsigned char buf[KECCAK1600_WIDTH / 8 - 32]; unsigned char pad; PROV_SHA3_METHOD meth; }; void ossl_sha3_reset(KECCAK1600_CTX *ctx); int ossl_sha3_init(KECCAK1600_CTX *ctx, unsigned char pad, size_t bitlen); int ossl_keccak_kmac_init(KECCAK1600_CTX *ctx, unsigned char pad, size_t bitlen); int ossl_sha3_update(KECCAK1600_CTX *ctx, const void *_inp, size_t len); int ossl_sha3_final(unsigned char *md, KECCAK1600_CTX *ctx); size_t SHA3_absorb(uint64_t A[5][5], const unsigned char *inp, size_t len, size_t r); #endif /* OSSL_INTERNAL_SHA3_H */
1,863
32.890909
74
h
openssl
openssl-master/include/internal/sizes.h
/* * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OSSL_INTERNAL_SIZES_H # define OSSL_INTERNAL_SIZES_H # pragma once /* * Max sizes used to allocate buffers with a fixed sizes, for example for * stack allocations, structure fields, ... */ # define OSSL_MAX_NAME_SIZE 50 /* Algorithm name */ # define OSSL_MAX_PROPQUERY_SIZE 256 /* Property query strings */ # define OSSL_MAX_ALGORITHM_ID_SIZE 256 /* AlgorithmIdentifier DER */ #endif
749
31.608696
74
h
openssl
openssl-master/include/internal/sm3.h
/* * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved. * Copyright 2017 Ribose Inc. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ /* This header can move into provider when legacy support is removed */ #ifndef OSSL_INTERNAL_SM3_H # define OSSL_INTERNAL_SM3_H # pragma once # include <openssl/opensslconf.h> # ifdef OPENSSL_NO_SM3 # error SM3 is disabled. # endif # define SM3_DIGEST_LENGTH 32 # define SM3_WORD unsigned int # define SM3_CBLOCK 64 # define SM3_LBLOCK (SM3_CBLOCK/4) typedef struct SM3state_st { SM3_WORD A, B, C, D, E, F, G, H; SM3_WORD Nl, Nh; SM3_WORD data[SM3_LBLOCK]; unsigned int num; } SM3_CTX; int ossl_sm3_init(SM3_CTX *c); int ossl_sm3_update(SM3_CTX *c, const void *data, size_t len); int ossl_sm3_final(unsigned char *md, SM3_CTX *c); #endif /* OSSL_INTERNAL_SM3_H */
1,083
26.1
74
h
openssl
openssl-master/include/internal/sockets.h
/* * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OSSL_INTERNAL_SOCKETS_H # define OSSL_INTERNAL_SOCKETS_H # pragma once # include <openssl/opensslconf.h> # if defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_UEFI) # define NO_SYS_PARAM_H # endif # ifdef WIN32 # define NO_SYS_UN_H # endif # ifdef OPENSSL_SYS_VMS # define NO_SYS_PARAM_H # define NO_SYS_UN_H # endif # ifdef OPENSSL_NO_SOCK # elif defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) # if defined(__DJGPP__) # define WATT32 # define WATT32_NO_OLDIES # include <sys/socket.h> # include <sys/un.h> # include <tcp.h> # include <netdb.h> # include <arpa/inet.h> # include <netinet/tcp.h> # elif defined(_WIN32_WCE) && _WIN32_WCE<410 # define getservbyname _masked_declaration_getservbyname # endif # if !defined(IPPROTO_IP) /* winsock[2].h was included already? */ # include <winsock.h> # endif # ifdef getservbyname /* this is used to be wcecompat/include/winsock_extras.h */ # undef getservbyname struct servent *PASCAL getservbyname(const char *, const char *); # endif # ifdef _WIN64 /* * Even though sizeof(SOCKET) is 8, it's safe to cast it to int, because * the value constitutes an index in per-process table of limited size * and not a real pointer. And we also depend on fact that all processors * Windows run on happen to be two's-complement, which allows to * interchange INVALID_SOCKET and -1. */ # define socket(d,t,p) ((int)socket(d,t,p)) # define accept(s,f,l) ((int)accept(s,f,l)) # endif /* Windows have other names for shutdown() reasons */ # ifndef SHUT_RD # define SHUT_RD SD_RECEIVE # endif # ifndef SHUT_WR # define SHUT_WR SD_SEND # endif # ifndef SHUT_RDWR # define SHUT_RDWR SD_BOTH # endif # else # if defined(__APPLE__) /* * This must be defined before including <netinet/in6.h> to get * IPV6_RECVPKTINFO */ # define __APPLE_USE_RFC_3542 # endif # ifndef NO_SYS_PARAM_H # include <sys/param.h> # endif # ifdef OPENSSL_SYS_VXWORKS # include <time.h> # endif # include <netdb.h> # if defined(OPENSSL_SYS_VMS_NODECC) # include <socket.h> # include <in.h> # include <inet.h> # else # include <sys/socket.h> # if !defined(NO_SYS_UN_H) && defined(AF_UNIX) && !defined(OPENSSL_NO_UNIX_SOCK) # include <sys/un.h> # ifndef UNIX_PATH_MAX # define UNIX_PATH_MAX sizeof(((struct sockaddr_un *)NULL)->sun_path) # endif # endif # ifdef FILIO_H # include <sys/filio.h> /* FIONBIO in some SVR4, e.g. unixware, solaris */ # endif # include <netinet/in.h> # include <arpa/inet.h> # include <netinet/tcp.h> # endif # ifdef OPENSSL_SYS_AIX # include <sys/select.h> # endif # ifdef OPENSSL_SYS_UNIX # include <poll.h> # include <errno.h> # endif # ifndef VMS # include <sys/ioctl.h> # else # if !defined(TCPIP_TYPE_SOCKETSHR) && defined(__VMS_VER) && (__VMS_VER > 70000000) /* ioctl is only in VMS > 7.0 and when socketshr is not used */ # include <sys/ioctl.h> # endif # include <unixio.h> # if defined(TCPIP_TYPE_SOCKETSHR) # include <socketshr.h> # endif # endif # ifndef INVALID_SOCKET # define INVALID_SOCKET (-1) # endif # endif /* * Some IPv6 implementations are broken, you can disable them in known * bad versions. */ # if !defined(OPENSSL_USE_IPV6) # if defined(AF_INET6) # define OPENSSL_USE_IPV6 1 # else # define OPENSSL_USE_IPV6 0 # endif # endif /* * Some platforms define AF_UNIX, but don't support it */ # if !defined(OPENSSL_NO_UNIX_SOCK) # if !defined(AF_UNIX) || defined(NO_SYS_UN_H) # define OPENSSL_NO_UNIX_SOCK # endif # endif # define get_last_socket_error() errno # define clear_socket_error() errno=0 # define get_last_socket_error_is_eintr() (get_last_socket_error() == EINTR) # if defined(OPENSSL_SYS_WINDOWS) # undef get_last_socket_error # undef clear_socket_error # undef get_last_socket_error_is_eintr # define get_last_socket_error() WSAGetLastError() # define clear_socket_error() WSASetLastError(0) # define get_last_socket_error_is_eintr() (get_last_socket_error() == WSAEINTR) # define readsocket(s,b,n) recv((s),(b),(n),0) # define writesocket(s,b,n) send((s),(b),(n),0) # elif defined(__DJGPP__) # define closesocket(s) close_s(s) # define readsocket(s,b,n) read_s(s,b,n) # define writesocket(s,b,n) send(s,b,n,0) # elif defined(OPENSSL_SYS_VMS) # define ioctlsocket(a,b,c) ioctl(a,b,c) # define closesocket(s) close(s) # define readsocket(s,b,n) recv((s),(b),(n),0) # define writesocket(s,b,n) send((s),(b),(n),0) # elif defined(OPENSSL_SYS_VXWORKS) # define ioctlsocket(a,b,c) ioctl((a),(b),(int)(c)) # define closesocket(s) close(s) # define readsocket(s,b,n) read((s),(b),(n)) # define writesocket(s,b,n) write((s),(char *)(b),(n)) # elif defined(OPENSSL_SYS_TANDEM) # if defined(OPENSSL_TANDEM_FLOSS) # include <floss.h(floss_read, floss_write)> # define readsocket(s,b,n) floss_read((s),(b),(n)) # define writesocket(s,b,n) floss_write((s),(b),(n)) # else # define readsocket(s,b,n) read((s),(b),(n)) # define writesocket(s,b,n) write((s),(b),(n)) # endif # define ioctlsocket(a,b,c) ioctl(a,b,c) # define closesocket(s) close(s) # else # define ioctlsocket(a,b,c) ioctl(a,b,c) # define closesocket(s) close(s) # define readsocket(s,b,n) read((s),(b),(n)) # define writesocket(s,b,n) write((s),(b),(n)) # endif /* also in apps/include/apps.h */ # if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINCE) # define openssl_fdset(a, b) FD_SET((unsigned int)(a), b) # else # define openssl_fdset(a, b) FD_SET(a, b) # endif #endif
6,077
27.535211
85
h
openssl
openssl-master/include/internal/ssl.h
/* * Copyright 2023 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #include <openssl/ssl.h> #ifndef OSSL_INTERNAL_SSL_H # define OSSL_INTERNAL_SSL_H # pragma once typedef void (*ossl_msg_cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg); #endif
589
28.5
78
h
openssl
openssl-master/include/internal/ssl3_cbc.h
/* * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #include <openssl/evp.h> /* tls_pad.c */ int ssl3_cbc_remove_padding_and_mac(size_t *reclen, size_t origreclen, unsigned char *recdata, unsigned char **mac, int *alloced, size_t block_size, size_t mac_size, OSSL_LIB_CTX *libctx); int tls1_cbc_remove_padding_and_mac(size_t *reclen, size_t origreclen, unsigned char *recdata, unsigned char **mac, int *alloced, size_t block_size, size_t mac_size, int aead, OSSL_LIB_CTX *libctx); /* ssl3_cbc.c */ __owur char ssl3_cbc_record_digest_supported(const EVP_MD_CTX *ctx); __owur int ssl3_cbc_digest_record(const EVP_MD *md, unsigned char *md_out, size_t *md_out_size, const unsigned char *header, const unsigned char *data, size_t data_size, size_t data_plus_mac_plus_padding_size, const unsigned char *mac_secret, size_t mac_secret_length, char is_sslv3);
1,875
44.756098
75
h
openssl
openssl-master/include/internal/sslconf.h
/* * Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OSSL_INTERNAL_SSLCONF_H # define OSSL_INTERNAL_SSLCONF_H # pragma once typedef struct ssl_conf_cmd_st SSL_CONF_CMD; const SSL_CONF_CMD *conf_ssl_get(size_t idx, const char **name, size_t *cnt); int conf_ssl_name_find(const char *name, size_t *idx); void conf_ssl_get_cmd(const SSL_CONF_CMD *cmd, size_t idx, char **cmdstr, char **arg); #endif
713
31.454545
77
h
openssl
openssl-master/include/internal/statem.h
/* * Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OSSL_INTERNAL_STATEM_H # define OSSL_INTERNAL_STATEM_H /***************************************************************************** * * * These enums should be considered PRIVATE to the state machine. No * * non-state machine code should need to use these * * * *****************************************************************************/ /* * Valid return codes used for functions performing work prior to or after * sending or receiving a message */ typedef enum { /* Something went wrong */ WORK_ERROR, /* We're done working and there shouldn't be anything else to do after */ WORK_FINISHED_STOP, /* We're done working move onto the next thing */ WORK_FINISHED_CONTINUE, /* We're working on phase A */ WORK_MORE_A, /* We're working on phase B */ WORK_MORE_B, /* We're working on phase C */ WORK_MORE_C } WORK_STATE; /* Write transition return codes */ typedef enum { /* Something went wrong */ WRITE_TRAN_ERROR, /* A transition was successfully completed and we should continue */ WRITE_TRAN_CONTINUE, /* There is no more write work to be done */ WRITE_TRAN_FINISHED } WRITE_TRAN; /* Message flow states */ typedef enum { /* No handshake in progress */ MSG_FLOW_UNINITED, /* A permanent error with this connection */ MSG_FLOW_ERROR, /* We are reading messages */ MSG_FLOW_READING, /* We are writing messages */ MSG_FLOW_WRITING, /* Handshake has finished */ MSG_FLOW_FINISHED } MSG_FLOW_STATE; /* Read states */ typedef enum { READ_STATE_HEADER, READ_STATE_BODY, READ_STATE_POST_PROCESS } READ_STATE; /* Write states */ typedef enum { WRITE_STATE_TRANSITION, WRITE_STATE_PRE_WORK, WRITE_STATE_SEND, WRITE_STATE_POST_WORK } WRITE_STATE; typedef enum { CON_FUNC_ERROR = 0, CON_FUNC_SUCCESS, CON_FUNC_DONT_SEND } CON_FUNC_RETURN; typedef int (*ossl_statem_mutate_handshake_cb)(const unsigned char *msgin, size_t inlen, unsigned char **msgout, size_t *outlen, void *arg); typedef void (*ossl_statem_finish_mutate_handshake_cb)(void *arg); /***************************************************************************** * * * This structure should be considered "opaque" to anything outside of the * * state machine. No non-state machine code should be accessing the members * * of this structure. * * * *****************************************************************************/ struct ossl_statem_st { MSG_FLOW_STATE state; WRITE_STATE write_state; WORK_STATE write_state_work; READ_STATE read_state; WORK_STATE read_state_work; OSSL_HANDSHAKE_STATE hand_state; /* The handshake state requested by an API call (e.g. HelloRequest) */ OSSL_HANDSHAKE_STATE request_state; int in_init; int read_state_first_init; /* true when we are actually in SSL_accept() or SSL_connect() */ int in_handshake; /* * True when are processing a "real" handshake that needs cleaning up (not * just a HelloRequest or similar). */ int cleanuphand; /* Should we skip the CertificateVerify message? */ unsigned int no_cert_verify; int use_timer; /* Test harness message mutator callbacks */ ossl_statem_mutate_handshake_cb mutate_handshake_cb; ossl_statem_finish_mutate_handshake_cb finish_mutate_handshake_cb; void *mutatearg; unsigned int write_in_progress : 1; }; typedef struct ossl_statem_st OSSL_STATEM; /***************************************************************************** * * * The following macros/functions represent the libssl internal API to the * * state machine. Any libssl code may call these functions/macros * * * *****************************************************************************/ typedef struct ssl_connection_st SSL_CONNECTION; __owur int ossl_statem_accept(SSL *s); __owur int ossl_statem_connect(SSL *s); OSSL_HANDSHAKE_STATE ossl_statem_get_state(SSL_CONNECTION *s); void ossl_statem_clear(SSL_CONNECTION *s); void ossl_statem_set_renegotiate(SSL_CONNECTION *s); void ossl_statem_send_fatal(SSL_CONNECTION *s, int al); void ossl_statem_fatal(SSL_CONNECTION *s, int al, int reason, const char *fmt, ...); # define SSLfatal_alert(s, al) ossl_statem_send_fatal((s), (al)) # define SSLfatal(s, al, r) SSLfatal_data((s), (al), (r), NULL) # define SSLfatal_data \ (ERR_new(), \ ERR_set_debug(OPENSSL_FILE, OPENSSL_LINE, OPENSSL_FUNC), \ ossl_statem_fatal) int ossl_statem_in_error(const SSL_CONNECTION *s); void ossl_statem_set_in_init(SSL_CONNECTION *s, int init); int ossl_statem_get_in_handshake(SSL_CONNECTION *s); void ossl_statem_set_in_handshake(SSL_CONNECTION *s, int inhand); __owur int ossl_statem_skip_early_data(SSL_CONNECTION *s); void ossl_statem_check_finish_init(SSL_CONNECTION *s, int send); void ossl_statem_set_hello_verify_done(SSL_CONNECTION *s); __owur int ossl_statem_app_data_allowed(SSL_CONNECTION *s); __owur int ossl_statem_export_allowed(SSL_CONNECTION *s); __owur int ossl_statem_export_early_allowed(SSL_CONNECTION *s); /* Flush the write BIO */ int statem_flush(SSL_CONNECTION *s); int ossl_statem_set_mutator(SSL *s, ossl_statem_mutate_handshake_cb mutate_handshake_cb, ossl_statem_finish_mutate_handshake_cb finish_mutate_handshake_cb, void *mutatearg); #endif
6,596
37.354651
94
h
openssl
openssl-master/include/internal/symhacks.h
/* * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OSSL_INTERNAL_SYMHACKS_H # define OSSL_INTERNAL_SYMHACKS_H # pragma once # include <openssl/e_os2.h> # if defined(OPENSSL_SYS_VMS) /* ossl_provider_gettable_params vs OSSL_PROVIDER_gettable_params */ # undef ossl_provider_gettable_params # define ossl_provider_gettable_params ossl_int_prov_gettable_params /* ossl_provider_get_params vs OSSL_PROVIDER_get_params */ # undef ossl_provider_get_params # define ossl_provider_get_params ossl_int_prov_get_params # endif #endif /* ! defined HEADER_VMS_IDHACKS_H */
915
31.714286
80
h
openssl
openssl-master/include/internal/thread.h
/* * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_INTERNAL_THREAD_H # define OPENSSL_INTERNAL_THREAD_H # include <openssl/configuration.h> # include <internal/thread_arch.h> # include <openssl/e_os2.h> # include <openssl/types.h> # include <internal/cryptlib.h> # include "crypto/context.h" void *ossl_crypto_thread_start(OSSL_LIB_CTX *ctx, CRYPTO_THREAD_ROUTINE start, void *data); int ossl_crypto_thread_join(void *task, CRYPTO_THREAD_RETVAL *retval); int ossl_crypto_thread_clean(void *vhandle); uint64_t ossl_get_avail_threads(OSSL_LIB_CTX *ctx); # if defined(OPENSSL_THREADS) # define OSSL_LIB_CTX_GET_THREADS(CTX) \ ossl_lib_ctx_get_data(CTX, OSSL_LIB_CTX_THREAD_INDEX); typedef struct openssl_threads_st { uint64_t max_threads; uint64_t active_threads; CRYPTO_MUTEX *lock; CRYPTO_CONDVAR *cond_finished; } OSSL_LIB_CTX_THREADS; # endif /* defined(OPENSSL_THREADS) */ #endif /* OPENSSL_INTERNAL_THREAD_H */
1,312
31.825
79
h
openssl
openssl-master/include/internal/thread_arch.h
/* * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OSSL_INTERNAL_THREAD_ARCH_H # define OSSL_INTERNAL_THREAD_ARCH_H # include <openssl/configuration.h> # include <openssl/e_os2.h> # include "internal/time.h" # if defined(_WIN32) # include <windows.h> # endif # if defined(OPENSSL_THREADS) && defined(OPENSSL_SYS_UNIX) # define OPENSSL_THREADS_POSIX # elif defined(OPENSSL_THREADS) && defined(OPENSSL_SYS_VMS) # define OPENSSL_THREADS_POSIX # elif defined(OPENSSL_THREADS) && defined(OPENSSL_SYS_WINDOWS) && \ defined(_WIN32_WINNT) # if _WIN32_WINNT >= 0x0600 # define OPENSSL_THREADS_WINNT # elif _WIN32_WINNT >= 0x0501 # define OPENSSL_THREADS_WINNT # define OPENSSL_THREADS_WINNT_LEGACY # else # define OPENSSL_THREADS_NONE # endif # else # define OPENSSL_THREADS_NONE # endif # include <openssl/crypto.h> typedef void CRYPTO_MUTEX; typedef void CRYPTO_CONDVAR; CRYPTO_MUTEX *ossl_crypto_mutex_new(void); void ossl_crypto_mutex_lock(CRYPTO_MUTEX *mutex); int ossl_crypto_mutex_try_lock(CRYPTO_MUTEX *mutex); void ossl_crypto_mutex_unlock(CRYPTO_MUTEX *mutex); void ossl_crypto_mutex_free(CRYPTO_MUTEX **mutex); CRYPTO_CONDVAR *ossl_crypto_condvar_new(void); void ossl_crypto_condvar_wait(CRYPTO_CONDVAR *cv, CRYPTO_MUTEX *mutex); void ossl_crypto_condvar_wait_timeout(CRYPTO_CONDVAR *cv, CRYPTO_MUTEX *mutex, OSSL_TIME deadline); void ossl_crypto_condvar_broadcast(CRYPTO_CONDVAR *cv); void ossl_crypto_condvar_signal(CRYPTO_CONDVAR *cv); void ossl_crypto_condvar_free(CRYPTO_CONDVAR **cv); typedef uint32_t CRYPTO_THREAD_RETVAL; typedef CRYPTO_THREAD_RETVAL (*CRYPTO_THREAD_ROUTINE)(void *); typedef CRYPTO_THREAD_RETVAL (*CRYPTO_THREAD_ROUTINE_CB)(void *, void (**)(void *), void **); # define CRYPTO_THREAD_NO_STATE 0UL # define CRYPTO_THREAD_FINISHED (1UL << 0) # define CRYPTO_THREAD_JOIN_AWAIT (1UL << 1) # define CRYPTO_THREAD_JOINED (1UL << 2) # define CRYPTO_THREAD_GET_STATE(THREAD, FLAG) ((THREAD)->state & (FLAG)) # define CRYPTO_THREAD_GET_ERROR(THREAD, FLAG) (((THREAD)->state >> 16) & (FLAG)) typedef struct crypto_thread_st { uint32_t state; void *data; CRYPTO_THREAD_ROUTINE routine; CRYPTO_THREAD_RETVAL retval; void *handle; CRYPTO_MUTEX *lock; CRYPTO_MUTEX *statelock; CRYPTO_CONDVAR *condvar; unsigned long thread_id; int joinable; OSSL_LIB_CTX *ctx; } CRYPTO_THREAD; # if defined(OPENSSL_THREADS) # define CRYPTO_THREAD_UNSET_STATE(THREAD, FLAG) \ do { \ (THREAD)->state &= ~(FLAG); \ } while ((void)0, 0) # define CRYPTO_THREAD_SET_STATE(THREAD, FLAG) \ do { \ (THREAD)->state |= (FLAG); \ } while ((void)0, 0) # define CRYPTO_THREAD_SET_ERROR(THREAD, FLAG) \ do { \ (THREAD)->state |= ((FLAG) << 16); \ } while ((void)0, 0) # define CRYPTO_THREAD_UNSET_ERROR(THREAD, FLAG) \ do { \ (THREAD)->state &= ~((FLAG) << 16); \ } while ((void)0, 0) # else # define CRYPTO_THREAD_UNSET_STATE(THREAD, FLAG) # define CRYPTO_THREAD_SET_STATE(THREAD, FLAG) # define CRYPTO_THREAD_SET_ERROR(THREAD, FLAG) # define CRYPTO_THREAD_UNSET_ERROR(THREAD, FLAG) # endif /* defined(OPENSSL_THREADS) */ CRYPTO_THREAD * ossl_crypto_thread_native_start(CRYPTO_THREAD_ROUTINE routine, void *data, int joinable); int ossl_crypto_thread_native_spawn(CRYPTO_THREAD *thread); int ossl_crypto_thread_native_join(CRYPTO_THREAD *thread, CRYPTO_THREAD_RETVAL *retval); int ossl_crypto_thread_native_perform_join(CRYPTO_THREAD *thread, CRYPTO_THREAD_RETVAL *retval); int ossl_crypto_thread_native_exit(void); int ossl_crypto_thread_native_is_self(CRYPTO_THREAD *thread); int ossl_crypto_thread_native_clean(CRYPTO_THREAD *thread); #endif /* OSSL_INTERNAL_THREAD_ARCH_H */
4,762
36.210938
81
h
openssl
openssl-master/include/internal/thread_once.h
/* * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OSSL_INTERNAL_THREAD_ONCE_H # define OSSL_INTERNAL_THREAD_ONCE_H # pragma once # include <openssl/crypto.h> /* * Initialisation of global data should never happen via "RUN_ONCE" inside the * FIPS module. Global data should instead always be associated with a specific * OSSL_LIB_CTX object. In this way data will get cleaned up correctly when the * module gets unloaded. */ # if !defined(FIPS_MODULE) || defined(ALLOW_RUN_ONCE_IN_FIPS) /* * DEFINE_RUN_ONCE: Define an initialiser function that should be run exactly * once. It takes no arguments and returns an int result (1 for success or * 0 for failure). Typical usage might be: * * DEFINE_RUN_ONCE(myinitfunc) * { * do_some_initialisation(); * if (init_is_successful()) * return 1; * * return 0; * } */ # define DEFINE_RUN_ONCE(init) \ static int init(void); \ int init##_ossl_ret_ = 0; \ void init##_ossl_(void) \ { \ init##_ossl_ret_ = init(); \ } \ static int init(void) /* * DECLARE_RUN_ONCE: Declare an initialiser function that should be run exactly * once that has been defined in another file via DEFINE_RUN_ONCE(). */ # define DECLARE_RUN_ONCE(init) \ extern int init##_ossl_ret_; \ void init##_ossl_(void); /* * DEFINE_RUN_ONCE_STATIC: Define an initialiser function that should be run * exactly once. This function will be declared as static within the file. It * takes no arguments and returns an int result (1 for success or 0 for * failure). Typical usage might be: * * DEFINE_RUN_ONCE_STATIC(myinitfunc) * { * do_some_initialisation(); * if (init_is_successful()) * return 1; * * return 0; * } */ # define DEFINE_RUN_ONCE_STATIC(init) \ static int init(void); \ static int init##_ossl_ret_ = 0; \ static void init##_ossl_(void) \ { \ init##_ossl_ret_ = init(); \ } \ static int init(void) /* * DEFINE_RUN_ONCE_STATIC_ALT: Define an alternative initialiser function. This * function will be declared as static within the file. It takes no arguments * and returns an int result (1 for success or 0 for failure). An alternative * initialiser function is expected to be associated with a primary initialiser * function defined via DEFINE_ONCE_STATIC where both functions use the same * CRYPTO_ONCE object to synchronise. Where an alternative initialiser function * is used only one of the primary or the alternative initialiser function will * ever be called - and that function will be called exactly once. Definition * of an alternative initialiser function MUST occur AFTER the definition of the * primary initialiser function. * * Typical usage might be: * * DEFINE_RUN_ONCE_STATIC(myinitfunc) * { * do_some_initialisation(); * if (init_is_successful()) * return 1; * * return 0; * } * * DEFINE_RUN_ONCE_STATIC_ALT(myaltinitfunc, myinitfunc) * { * do_some_alternative_initialisation(); * if (init_is_successful()) * return 1; * * return 0; * } */ # define DEFINE_RUN_ONCE_STATIC_ALT(initalt, init) \ static int initalt(void); \ static void initalt##_ossl_(void) \ { \ init##_ossl_ret_ = initalt(); \ } \ static int initalt(void) /* * RUN_ONCE - use CRYPTO_THREAD_run_once, and check if the init succeeded * @once: pointer to static object of type CRYPTO_ONCE * @init: function name that was previously given to DEFINE_RUN_ONCE, * DEFINE_RUN_ONCE_STATIC or DECLARE_RUN_ONCE. This function * must return 1 for success or 0 for failure. * * The return value is 1 on success (*) or 0 in case of error. * * (*) by convention, since the init function must return 1 on success. */ # define RUN_ONCE(once, init) \ (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0) /* * RUN_ONCE_ALT - use CRYPTO_THREAD_run_once, to run an alternative initialiser * function and check if that initialisation succeeded * @once: pointer to static object of type CRYPTO_ONCE * @initalt: alternative initialiser function name that was previously given to * DEFINE_RUN_ONCE_STATIC_ALT. This function must return 1 for * success or 0 for failure. * @init: primary initialiser function name that was previously given to * DEFINE_RUN_ONCE_STATIC. This function must return 1 for success or * 0 for failure. * * The return value is 1 on success (*) or 0 in case of error. * * (*) by convention, since the init function must return 1 on success. */ # define RUN_ONCE_ALT(once, initalt, init) \ (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0) # endif /* FIPS_MODULE */ #endif /* OSSL_INTERNAL_THREAD_ONCE_H */
5,660
36.243421
80
h
openssl
openssl-master/include/internal/time.h
/* * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OSSL_INTERNAL_TIME_H # define OSSL_INTERNAL_TIME_H # pragma once # include <openssl/e_os2.h> /* uint64_t */ # include "internal/e_os.h" /* for struct timeval */ # include "internal/safe_math.h" /* * Internal type defining a time. * This should be treated as an opaque structure. * * The time datum is Unix's 1970 and at nanosecond precision, this gives * a range of 584 years roughly. */ typedef struct { uint64_t t; /* Ticks since the epoch */ } OSSL_TIME; /* The precision of times allows this many values per second */ # define OSSL_TIME_SECOND ((uint64_t)1000000000) /* One millisecond. */ # define OSSL_TIME_MS (OSSL_TIME_SECOND / 1000) /* One microsecond. */ # define OSSL_TIME_US (OSSL_TIME_MS / 1000) /* One nanosecond. */ # define OSSL_TIME_NS (OSSL_TIME_US / 1000) #define ossl_seconds2time(s) ossl_ticks2time((s) * OSSL_TIME_SECOND) #define ossl_time2seconds(t) (ossl_time2ticks(t) / OSSL_TIME_SECOND) #define ossl_ms2time(ms) ossl_ticks2time((ms) * OSSL_TIME_MS) #define ossl_time2ms(t) (ossl_time2ticks(t) / OSSL_TIME_MS) #define ossl_us2time(us) ossl_ticks2time((us) * OSSL_TIME_US) #define ossl_time2us(t) (ossl_time2ticks(t) / OSSL_TIME_US) /* Convert a tick count into a time */ static ossl_unused ossl_inline OSSL_TIME ossl_ticks2time(uint64_t ticks) { OSSL_TIME r; r.t = ticks; return r; } /* Convert a time to a tick count */ static ossl_unused ossl_inline uint64_t ossl_time2ticks(OSSL_TIME t) { return t.t; } /* Get current time */ OSSL_TIME ossl_time_now(void); /* The beginning and end of the time range */ static ossl_unused ossl_inline OSSL_TIME ossl_time_zero(void) { return ossl_ticks2time(0); } static ossl_unused ossl_inline OSSL_TIME ossl_time_infinite(void) { return ossl_ticks2time(~(uint64_t)0); } /* Convert time to timeval */ static ossl_unused ossl_inline struct timeval ossl_time_to_timeval(OSSL_TIME t) { struct timeval tv; #ifdef _WIN32 tv.tv_sec = (long int)(t.t / OSSL_TIME_SECOND); #else tv.tv_sec = (time_t)(t.t / OSSL_TIME_SECOND); #endif tv.tv_usec = (t.t % OSSL_TIME_SECOND) / OSSL_TIME_US; return tv; } /* Convert timeval to time */ static ossl_unused ossl_inline OSSL_TIME ossl_time_from_timeval(struct timeval tv) { OSSL_TIME t; #ifndef __DJGPP__ /* tv_sec is unsigned on djgpp. */ if (tv.tv_sec < 0) return ossl_time_zero(); #endif t.t = tv.tv_sec * OSSL_TIME_SECOND + tv.tv_usec * OSSL_TIME_US; return t; } /* Convert OSSL_TIME to time_t */ static ossl_unused ossl_inline time_t ossl_time_to_time_t(OSSL_TIME t) { return (time_t)(t.t / OSSL_TIME_SECOND); } /* Convert time_t to OSSL_TIME */ static ossl_unused ossl_inline OSSL_TIME ossl_time_from_time_t(time_t t) { OSSL_TIME ot; ot.t = t; ot.t *= OSSL_TIME_SECOND; return ot; } /* Compare two time values, return -1 if less, 1 if greater and 0 if equal */ static ossl_unused ossl_inline int ossl_time_compare(OSSL_TIME a, OSSL_TIME b) { if (a.t > b.t) return 1; if (a.t < b.t) return -1; return 0; } /* Returns true if an OSSL_TIME is ossl_time_zero(). */ static ossl_unused ossl_inline int ossl_time_is_zero(OSSL_TIME t) { return ossl_time_compare(t, ossl_time_zero()) == 0; } /* Returns true if an OSSL_TIME is ossl_time_infinite(). */ static ossl_unused ossl_inline int ossl_time_is_infinite(OSSL_TIME t) { return ossl_time_compare(t, ossl_time_infinite()) == 0; } /* * Arithmetic operations on times. * These operations are saturating, in that an overflow or underflow returns * the largest or smallest value respectively. */ OSSL_SAFE_MATH_UNSIGNED(time, uint64_t) static ossl_unused ossl_inline OSSL_TIME ossl_time_add(OSSL_TIME a, OSSL_TIME b) { OSSL_TIME r; int err = 0; r.t = safe_add_time(a.t, b.t, &err); return err ? ossl_time_infinite() : r; } static ossl_unused ossl_inline OSSL_TIME ossl_time_subtract(OSSL_TIME a, OSSL_TIME b) { OSSL_TIME r; int err = 0; r.t = safe_sub_time(a.t, b.t, &err); return err ? ossl_time_zero() : r; } /* Returns |a - b|. */ static ossl_unused ossl_inline OSSL_TIME ossl_time_abs_difference(OSSL_TIME a, OSSL_TIME b) { return a.t > b.t ? ossl_time_subtract(a, b) : ossl_time_subtract(b, a); } static ossl_unused ossl_inline OSSL_TIME ossl_time_multiply(OSSL_TIME a, uint64_t b) { OSSL_TIME r; int err = 0; r.t = safe_mul_time(a.t, b, &err); return err ? ossl_time_infinite() : r; } static ossl_unused ossl_inline OSSL_TIME ossl_time_divide(OSSL_TIME a, uint64_t b) { OSSL_TIME r; int err = 0; r.t = safe_div_time(a.t, b, &err); return err ? ossl_time_zero() : r; } static ossl_unused ossl_inline OSSL_TIME ossl_time_muldiv(OSSL_TIME a, uint64_t b, uint64_t c) { OSSL_TIME r; int err = 0; r.t = safe_muldiv_time(a.t, b, c, &err); return err ? ossl_time_zero() : r; } /* Return higher of the two given time values. */ static ossl_unused ossl_inline OSSL_TIME ossl_time_max(OSSL_TIME a, OSSL_TIME b) { return a.t > b.t ? a : b; } /* Return the lower of the two given time values. */ static ossl_unused ossl_inline OSSL_TIME ossl_time_min(OSSL_TIME a, OSSL_TIME b) { return a.t < b.t ? a : b; } #endif
5,606
22.961538
77
h
openssl
openssl-master/include/internal/tlsgroups.h
/* * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OSSL_INTERNAL_TLSGROUPS_H # define OSSL_INTERNAL_TLSGROUPS_H # pragma once # define OSSL_TLS_GROUP_ID_sect163k1 0x0001 # define OSSL_TLS_GROUP_ID_sect163r1 0x0002 # define OSSL_TLS_GROUP_ID_sect163r2 0x0003 # define OSSL_TLS_GROUP_ID_sect193r1 0x0004 # define OSSL_TLS_GROUP_ID_sect193r2 0x0005 # define OSSL_TLS_GROUP_ID_sect233k1 0x0006 # define OSSL_TLS_GROUP_ID_sect233r1 0x0007 # define OSSL_TLS_GROUP_ID_sect239k1 0x0008 # define OSSL_TLS_GROUP_ID_sect283k1 0x0009 # define OSSL_TLS_GROUP_ID_sect283r1 0x000A # define OSSL_TLS_GROUP_ID_sect409k1 0x000B # define OSSL_TLS_GROUP_ID_sect409r1 0x000C # define OSSL_TLS_GROUP_ID_sect571k1 0x000D # define OSSL_TLS_GROUP_ID_sect571r1 0x000E # define OSSL_TLS_GROUP_ID_secp160k1 0x000F # define OSSL_TLS_GROUP_ID_secp160r1 0x0010 # define OSSL_TLS_GROUP_ID_secp160r2 0x0011 # define OSSL_TLS_GROUP_ID_secp192k1 0x0012 # define OSSL_TLS_GROUP_ID_secp192r1 0x0013 # define OSSL_TLS_GROUP_ID_secp224k1 0x0014 # define OSSL_TLS_GROUP_ID_secp224r1 0x0015 # define OSSL_TLS_GROUP_ID_secp256k1 0x0016 # define OSSL_TLS_GROUP_ID_secp256r1 0x0017 # define OSSL_TLS_GROUP_ID_secp384r1 0x0018 # define OSSL_TLS_GROUP_ID_secp521r1 0x0019 # define OSSL_TLS_GROUP_ID_brainpoolP256r1 0x001A # define OSSL_TLS_GROUP_ID_brainpoolP384r1 0x001B # define OSSL_TLS_GROUP_ID_brainpoolP512r1 0x001C # define OSSL_TLS_GROUP_ID_x25519 0x001D # define OSSL_TLS_GROUP_ID_x448 0x001E # define OSSL_TLS_GROUP_ID_brainpoolP256r1_tls13 0x001F # define OSSL_TLS_GROUP_ID_brainpoolP384r1_tls13 0x0020 # define OSSL_TLS_GROUP_ID_brainpoolP512r1_tls13 0x0021 # define OSSL_TLS_GROUP_ID_gc256A 0x0022 # define OSSL_TLS_GROUP_ID_gc256B 0x0023 # define OSSL_TLS_GROUP_ID_gc256C 0x0024 # define OSSL_TLS_GROUP_ID_gc256D 0x0025 # define OSSL_TLS_GROUP_ID_gc512A 0x0026 # define OSSL_TLS_GROUP_ID_gc512B 0x0027 # define OSSL_TLS_GROUP_ID_gc512C 0x0028 # define OSSL_TLS_GROUP_ID_ffdhe2048 0x0100 # define OSSL_TLS_GROUP_ID_ffdhe3072 0x0101 # define OSSL_TLS_GROUP_ID_ffdhe4096 0x0102 # define OSSL_TLS_GROUP_ID_ffdhe6144 0x0103 # define OSSL_TLS_GROUP_ID_ffdhe8192 0x0104 #endif
2,739
43.918033
74
h
openssl
openssl-master/include/internal/tsan_assist.h
/* * Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ /* * Contemporary compilers implement lock-free atomic memory access * primitives that facilitate writing "thread-opportunistic" or even real * multi-threading low-overhead code. "Thread-opportunistic" is when * exact result is not required, e.g. some statistics, or execution flow * doesn't have to be unambiguous. Simplest example is lazy "constant" * initialization when one can synchronize on variable itself, e.g. * * if (var == NOT_YET_INITIALIZED) * var = function_returning_same_value(); * * This does work provided that loads and stores are single-instruction * operations (and integer ones are on *all* supported platforms), but * it upsets Thread Sanitizer. Suggested solution is * * if (tsan_load(&var) == NOT_YET_INITIALIZED) * tsan_store(&var, function_returning_same_value()); * * Production machine code would be the same, so one can wonder why * bother. Having Thread Sanitizer accept "thread-opportunistic" code * allows to move on trouble-shooting real bugs. * * Resolving Thread Sanitizer nits was the initial purpose for this module, * but it was later extended with more nuanced primitives that are useful * even in "non-opportunistic" scenarios. Most notably verifying if a shared * structure is fully initialized and bypassing the initialization lock. * It's suggested to view macros defined in this module as "annotations" for * thread-safe lock-free code, "Thread-Safe ANnotations"... * * It's assumed that ATOMIC_{LONG|INT}_LOCK_FREE are assigned same value as * ATOMIC_POINTER_LOCK_FREE. And check for >= 2 ensures that corresponding * code is inlined. It should be noted that statistics counters become * accurate in such case. * * Special note about TSAN_QUALIFIER. It might be undesired to use it in * a shared header. Because whether operation on specific variable or member * is atomic or not might be irrelevant in other modules. In such case one * can use TSAN_QUALIFIER in cast specifically when it has to count. */ #ifndef OSSL_INTERNAL_TSAN_ASSIST_H # define OSSL_INTERNAL_TSAN_ASSIST_H # pragma once # if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \ && !defined(__STDC_NO_ATOMICS__) # include <stdatomic.h> # if defined(ATOMIC_POINTER_LOCK_FREE) \ && ATOMIC_POINTER_LOCK_FREE >= 2 # define TSAN_QUALIFIER _Atomic # define tsan_load(ptr) atomic_load_explicit((ptr), memory_order_relaxed) # define tsan_store(ptr, val) atomic_store_explicit((ptr), (val), memory_order_relaxed) # define tsan_add(ptr, n) atomic_fetch_add_explicit((ptr), (n), memory_order_relaxed) # define tsan_ld_acq(ptr) atomic_load_explicit((ptr), memory_order_acquire) # define tsan_st_rel(ptr, val) atomic_store_explicit((ptr), (val), memory_order_release) # endif # elif defined(__GNUC__) && defined(__ATOMIC_RELAXED) # if defined(__GCC_ATOMIC_POINTER_LOCK_FREE) \ && __GCC_ATOMIC_POINTER_LOCK_FREE >= 2 # define TSAN_QUALIFIER volatile # define tsan_load(ptr) __atomic_load_n((ptr), __ATOMIC_RELAXED) # define tsan_store(ptr, val) __atomic_store_n((ptr), (val), __ATOMIC_RELAXED) # define tsan_add(ptr, n) __atomic_fetch_add((ptr), (n), __ATOMIC_RELAXED) # define tsan_ld_acq(ptr) __atomic_load_n((ptr), __ATOMIC_ACQUIRE) # define tsan_st_rel(ptr, val) __atomic_store_n((ptr), (val), __ATOMIC_RELEASE) # endif # elif defined(_MSC_VER) && _MSC_VER>=1200 \ && (defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) || \ defined(_M_ARM64) || (defined(_M_ARM) && _M_ARM >= 7 && !defined(_WIN32_WCE))) /* * There is subtle dependency on /volatile:<iso|ms> command-line option. * "ms" implies same semantic as memory_order_acquire for loads and * memory_order_release for stores, while "iso" - memory_order_relaxed for * either. Real complication is that defaults are different on x86 and ARM. * There is explanation for that, "ms" is backward compatible with earlier * compiler versions, while multi-processor ARM can be viewed as brand new * platform to MSC and its users, and with non-relaxed semantic taking toll * with additional instructions and penalties, it kind of makes sense to * default to "iso"... */ # define TSAN_QUALIFIER volatile # if defined(_M_ARM) || defined(_M_ARM64) # define _InterlockedExchangeAdd _InterlockedExchangeAdd_nf # pragma intrinsic(_InterlockedExchangeAdd_nf) # pragma intrinsic(__iso_volatile_load32, __iso_volatile_store32) # ifdef _WIN64 # define _InterlockedExchangeAdd64 _InterlockedExchangeAdd64_nf # pragma intrinsic(_InterlockedExchangeAdd64_nf) # pragma intrinsic(__iso_volatile_load64, __iso_volatile_store64) # define tsan_load(ptr) (sizeof(*(ptr)) == 8 ? __iso_volatile_load64(ptr) \ : __iso_volatile_load32(ptr)) # define tsan_store(ptr, val) (sizeof(*(ptr)) == 8 ? __iso_volatile_store64((ptr), (val)) \ : __iso_volatile_store32((ptr), (val))) # else # define tsan_load(ptr) __iso_volatile_load32(ptr) # define tsan_store(ptr, val) __iso_volatile_store32((ptr), (val)) # endif # else # define tsan_load(ptr) (*(ptr)) # define tsan_store(ptr, val) (*(ptr) = (val)) # endif # pragma intrinsic(_InterlockedExchangeAdd) # ifdef _WIN64 # pragma intrinsic(_InterlockedExchangeAdd64) # define tsan_add(ptr, n) (sizeof(*(ptr)) == 8 ? _InterlockedExchangeAdd64((ptr), (n)) \ : _InterlockedExchangeAdd((ptr), (n))) # else # define tsan_add(ptr, n) _InterlockedExchangeAdd((ptr), (n)) # endif # if !defined(_ISO_VOLATILE) # define tsan_ld_acq(ptr) (*(ptr)) # define tsan_st_rel(ptr, val) (*(ptr) = (val)) # endif # endif # ifndef TSAN_QUALIFIER # ifdef OPENSSL_THREADS # define TSAN_QUALIFIER volatile # define TSAN_REQUIRES_LOCKING # else /* OPENSSL_THREADS */ # define TSAN_QUALIFIER # endif /* OPENSSL_THREADS */ # define tsan_load(ptr) (*(ptr)) # define tsan_store(ptr, val) (*(ptr) = (val)) # define tsan_add(ptr, n) (*(ptr) += (n)) /* * Lack of tsan_ld_acq and tsan_ld_rel means that compiler support is not * sophisticated enough to support them. Code that relies on them should be * protected with #ifdef tsan_ld_acq with locked fallback. */ # endif # define tsan_counter(ptr) tsan_add((ptr), 1) # define tsan_decr(ptr) tsan_add((ptr), -1) #endif
6,712
42.590909
94
h
openssl
openssl-master/include/internal/uint_set.h
/* * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OSSL_UINT_SET_H # define OSSL_UINT_SET_H #include "openssl/params.h" #include "internal/list.h" /* * uint64_t Integer Sets * ===================== * * Utilities for managing a logical set of unsigned 64-bit integers. The * structure tracks each contiguous range of integers using one allocation and * is thus optimised for cases where integers tend to appear consecutively. * Queries are optimised under the assumption that they will generally be made * on integers near the end of the set. * * Discussion of implementation details can be found in uint_set.c. */ typedef struct uint_range_st { uint64_t start, end; } UINT_RANGE; typedef struct uint_set_item_st UINT_SET_ITEM; struct uint_set_item_st { OSSL_LIST_MEMBER(uint_set, UINT_SET_ITEM); UINT_RANGE range; }; DEFINE_LIST_OF(uint_set, UINT_SET_ITEM); typedef OSSL_LIST(uint_set) UINT_SET; void ossl_uint_set_init(UINT_SET *s); void ossl_uint_set_destroy(UINT_SET *s); /* * Insert a range into a integer set. Returns 0 on allocation failure, in which * case the integer set is in a valid but undefined state. Otherwise, returns 1. * Ranges can overlap existing ranges without limitation. If a range is a subset * of an existing range in the set, this is a no-op and returns 1. */ int ossl_uint_set_insert(UINT_SET *s, const UINT_RANGE *range); /* * Remove a range from the set. Returns 0 on allocation failure, in which case * the integer set is unchanged. Otherwise, returns 1. Ranges which are not * already in the set can be removed without issue. If a passed range is not in * the integer set at all, this is a no-op and returns 1. */ int ossl_uint_set_remove(UINT_SET *s, const UINT_RANGE *range); /* Returns 1 iff the given integer is in the integer set. */ int ossl_uint_set_query(const UINT_SET *s, uint64_t v); #endif
2,184
33.140625
80
h
openssl
openssl-master/include/internal/unicode.h
/* * Copyright 2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OSSL_INTERNAL_UNICODE_H # define OSSL_INTERNAL_UNICODE_H # pragma once typedef enum { SURROGATE_MIN = 0xd800UL, SURROGATE_MAX = 0xdfffUL, UNICODE_MAX = 0x10ffffUL, UNICODE_LIMIT } UNICODE_CONSTANTS; static ossl_unused ossl_inline int is_unicode_surrogate(unsigned long value) { return value >= SURROGATE_MIN && value <= SURROGATE_MAX; } static ossl_unused ossl_inline int is_unicode_valid(unsigned long value) { return value <= UNICODE_MAX && !is_unicode_surrogate(value); } #endif
850
25.59375
76
h
openssl
openssl-master/include/openssl/aes.h
/* * Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_AES_H # define OPENSSL_AES_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_AES_H # endif # include <openssl/opensslconf.h> # include <stddef.h> # ifdef __cplusplus extern "C" { # endif # define AES_BLOCK_SIZE 16 # ifndef OPENSSL_NO_DEPRECATED_3_0 # define AES_ENCRYPT 1 # define AES_DECRYPT 0 # define AES_MAXNR 14 /* This should be a hidden type, but EVP requires that the size be known */ struct aes_key_st { # ifdef AES_LONG unsigned long rd_key[4 * (AES_MAXNR + 1)]; # else unsigned int rd_key[4 * (AES_MAXNR + 1)]; # endif int rounds; }; typedef struct aes_key_st AES_KEY; # endif # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 const char *AES_options(void); OSSL_DEPRECATEDIN_3_0 int AES_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key); OSSL_DEPRECATEDIN_3_0 int AES_set_decrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key); OSSL_DEPRECATEDIN_3_0 void AES_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key); OSSL_DEPRECATEDIN_3_0 void AES_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key); OSSL_DEPRECATEDIN_3_0 void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key, const int enc); OSSL_DEPRECATEDIN_3_0 void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t length, const AES_KEY *key, unsigned char *ivec, const int enc); OSSL_DEPRECATEDIN_3_0 void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, const AES_KEY *key, unsigned char *ivec, int *num, const int enc); OSSL_DEPRECATEDIN_3_0 void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, size_t length, const AES_KEY *key, unsigned char *ivec, int *num, const int enc); OSSL_DEPRECATEDIN_3_0 void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, size_t length, const AES_KEY *key, unsigned char *ivec, int *num, const int enc); OSSL_DEPRECATEDIN_3_0 void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, const AES_KEY *key, unsigned char *ivec, int *num); /* NB: the IV is _two_ blocks long */ OSSL_DEPRECATEDIN_3_0 void AES_ige_encrypt(const unsigned char *in, unsigned char *out, size_t length, const AES_KEY *key, unsigned char *ivec, const int enc); /* NB: the IV is _four_ blocks long */ OSSL_DEPRECATEDIN_3_0 void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out, size_t length, const AES_KEY *key, const AES_KEY *key2, const unsigned char *ivec, const int enc); OSSL_DEPRECATEDIN_3_0 int AES_wrap_key(AES_KEY *key, const unsigned char *iv, unsigned char *out, const unsigned char *in, unsigned int inlen); OSSL_DEPRECATEDIN_3_0 int AES_unwrap_key(AES_KEY *key, const unsigned char *iv, unsigned char *out, const unsigned char *in, unsigned int inlen); # endif # ifdef __cplusplus } # endif #endif
3,752
32.508929
79
h
openssl
openssl-master/include/openssl/asn1err.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_ASN1ERR_H # define OPENSSL_ASN1ERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> /* * ASN1 reason codes. */ # define ASN1_R_ADDING_OBJECT 171 # define ASN1_R_ASN1_PARSE_ERROR 203 # define ASN1_R_ASN1_SIG_PARSE_ERROR 204 # define ASN1_R_AUX_ERROR 100 # define ASN1_R_BAD_OBJECT_HEADER 102 # define ASN1_R_BAD_TEMPLATE 230 # define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 214 # define ASN1_R_BN_LIB 105 # define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106 # define ASN1_R_BUFFER_TOO_SMALL 107 # define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 108 # define ASN1_R_CONTEXT_NOT_INITIALISED 217 # define ASN1_R_DATA_IS_WRONG 109 # define ASN1_R_DECODE_ERROR 110 # define ASN1_R_DEPTH_EXCEEDED 174 # define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED 198 # define ASN1_R_ENCODE_ERROR 112 # define ASN1_R_ERROR_GETTING_TIME 173 # define ASN1_R_ERROR_LOADING_SECTION 172 # define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114 # define ASN1_R_EXPECTING_AN_INTEGER 115 # define ASN1_R_EXPECTING_AN_OBJECT 116 # define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119 # define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120 # define ASN1_R_FIELD_MISSING 121 # define ASN1_R_FIRST_NUM_TOO_LARGE 122 # define ASN1_R_HEADER_TOO_LONG 123 # define ASN1_R_ILLEGAL_BITSTRING_FORMAT 175 # define ASN1_R_ILLEGAL_BOOLEAN 176 # define ASN1_R_ILLEGAL_CHARACTERS 124 # define ASN1_R_ILLEGAL_FORMAT 177 # define ASN1_R_ILLEGAL_HEX 178 # define ASN1_R_ILLEGAL_IMPLICIT_TAG 179 # define ASN1_R_ILLEGAL_INTEGER 180 # define ASN1_R_ILLEGAL_NEGATIVE_VALUE 226 # define ASN1_R_ILLEGAL_NESTED_TAGGING 181 # define ASN1_R_ILLEGAL_NULL 125 # define ASN1_R_ILLEGAL_NULL_VALUE 182 # define ASN1_R_ILLEGAL_OBJECT 183 # define ASN1_R_ILLEGAL_OPTIONAL_ANY 126 # define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170 # define ASN1_R_ILLEGAL_PADDING 221 # define ASN1_R_ILLEGAL_TAGGED_ANY 127 # define ASN1_R_ILLEGAL_TIME_VALUE 184 # define ASN1_R_ILLEGAL_ZERO_CONTENT 222 # define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185 # define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128 # define ASN1_R_INVALID_BIT_STRING_BITS_LEFT 220 # define ASN1_R_INVALID_BMPSTRING_LENGTH 129 # define ASN1_R_INVALID_DIGIT 130 # define ASN1_R_INVALID_MIME_TYPE 205 # define ASN1_R_INVALID_MODIFIER 186 # define ASN1_R_INVALID_NUMBER 187 # define ASN1_R_INVALID_OBJECT_ENCODING 216 # define ASN1_R_INVALID_SCRYPT_PARAMETERS 227 # define ASN1_R_INVALID_SEPARATOR 131 # define ASN1_R_INVALID_STRING_TABLE_VALUE 218 # define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133 # define ASN1_R_INVALID_UTF8STRING 134 # define ASN1_R_INVALID_VALUE 219 # define ASN1_R_LENGTH_TOO_LONG 231 # define ASN1_R_LIST_ERROR 188 # define ASN1_R_MIME_NO_CONTENT_TYPE 206 # define ASN1_R_MIME_PARSE_ERROR 207 # define ASN1_R_MIME_SIG_PARSE_ERROR 208 # define ASN1_R_MISSING_EOC 137 # define ASN1_R_MISSING_SECOND_NUMBER 138 # define ASN1_R_MISSING_VALUE 189 # define ASN1_R_MSTRING_NOT_UNIVERSAL 139 # define ASN1_R_MSTRING_WRONG_TAG 140 # define ASN1_R_NESTED_ASN1_STRING 197 # define ASN1_R_NESTED_TOO_DEEP 201 # define ASN1_R_NON_HEX_CHARACTERS 141 # define ASN1_R_NOT_ASCII_FORMAT 190 # define ASN1_R_NOT_ENOUGH_DATA 142 # define ASN1_R_NO_CONTENT_TYPE 209 # define ASN1_R_NO_MATCHING_CHOICE_TYPE 143 # define ASN1_R_NO_MULTIPART_BODY_FAILURE 210 # define ASN1_R_NO_MULTIPART_BOUNDARY 211 # define ASN1_R_NO_SIG_CONTENT_TYPE 212 # define ASN1_R_NULL_IS_WRONG_LENGTH 144 # define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191 # define ASN1_R_ODD_NUMBER_OF_CHARS 145 # define ASN1_R_SECOND_NUMBER_TOO_LARGE 147 # define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148 # define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149 # define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192 # define ASN1_R_SHORT_LINE 150 # define ASN1_R_SIG_INVALID_MIME_TYPE 213 # define ASN1_R_STREAMING_NOT_SUPPORTED 202 # define ASN1_R_STRING_TOO_LONG 151 # define ASN1_R_STRING_TOO_SHORT 152 # define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154 # define ASN1_R_TIME_NOT_ASCII_FORMAT 193 # define ASN1_R_TOO_LARGE 223 # define ASN1_R_TOO_LONG 155 # define ASN1_R_TOO_SMALL 224 # define ASN1_R_TYPE_NOT_CONSTRUCTED 156 # define ASN1_R_TYPE_NOT_PRIMITIVE 195 # define ASN1_R_UNEXPECTED_EOC 159 # define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 215 # define ASN1_R_UNKNOWN_DIGEST 229 # define ASN1_R_UNKNOWN_FORMAT 160 # define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161 # define ASN1_R_UNKNOWN_OBJECT_TYPE 162 # define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163 # define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM 199 # define ASN1_R_UNKNOWN_TAG 194 # define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164 # define ASN1_R_UNSUPPORTED_CIPHER 228 # define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167 # define ASN1_R_UNSUPPORTED_TYPE 196 # define ASN1_R_WRONG_INTEGER_TYPE 225 # define ASN1_R_WRONG_PUBLIC_KEY_TYPE 200 # define ASN1_R_WRONG_TAG 168 #endif
7,731
53.836879
74
h
openssl
openssl-master/include/openssl/async.h
/* * Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #include <stdlib.h> #ifndef OPENSSL_ASYNC_H # define OPENSSL_ASYNC_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_ASYNC_H # endif #if defined(_WIN32) # if defined(BASETYPES) || defined(_WINDEF_H) /* application has to include <windows.h> to use this */ #define OSSL_ASYNC_FD HANDLE #define OSSL_BAD_ASYNC_FD INVALID_HANDLE_VALUE # endif #else #define OSSL_ASYNC_FD int #define OSSL_BAD_ASYNC_FD -1 #endif # include <openssl/asyncerr.h> # ifdef __cplusplus extern "C" { # endif typedef struct async_job_st ASYNC_JOB; typedef struct async_wait_ctx_st ASYNC_WAIT_CTX; typedef int (*ASYNC_callback_fn)(void *arg); #define ASYNC_ERR 0 #define ASYNC_NO_JOBS 1 #define ASYNC_PAUSE 2 #define ASYNC_FINISH 3 #define ASYNC_STATUS_UNSUPPORTED 0 #define ASYNC_STATUS_ERR 1 #define ASYNC_STATUS_OK 2 #define ASYNC_STATUS_EAGAIN 3 int ASYNC_init_thread(size_t max_size, size_t init_size); void ASYNC_cleanup_thread(void); #ifdef OSSL_ASYNC_FD ASYNC_WAIT_CTX *ASYNC_WAIT_CTX_new(void); void ASYNC_WAIT_CTX_free(ASYNC_WAIT_CTX *ctx); int ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key, OSSL_ASYNC_FD fd, void *custom_data, void (*cleanup)(ASYNC_WAIT_CTX *, const void *, OSSL_ASYNC_FD, void *)); int ASYNC_WAIT_CTX_get_fd(ASYNC_WAIT_CTX *ctx, const void *key, OSSL_ASYNC_FD *fd, void **custom_data); int ASYNC_WAIT_CTX_get_all_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *fd, size_t *numfds); int ASYNC_WAIT_CTX_get_callback(ASYNC_WAIT_CTX *ctx, ASYNC_callback_fn *callback, void **callback_arg); int ASYNC_WAIT_CTX_set_callback(ASYNC_WAIT_CTX *ctx, ASYNC_callback_fn callback, void *callback_arg); int ASYNC_WAIT_CTX_set_status(ASYNC_WAIT_CTX *ctx, int status); int ASYNC_WAIT_CTX_get_status(ASYNC_WAIT_CTX *ctx); int ASYNC_WAIT_CTX_get_changed_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *addfd, size_t *numaddfds, OSSL_ASYNC_FD *delfd, size_t *numdelfds); int ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key); #endif int ASYNC_is_capable(void); typedef void *(*ASYNC_stack_alloc_fn)(size_t *num); typedef void (*ASYNC_stack_free_fn)(void *addr); int ASYNC_set_mem_functions(ASYNC_stack_alloc_fn alloc_fn, ASYNC_stack_free_fn free_fn); void ASYNC_get_mem_functions(ASYNC_stack_alloc_fn *alloc_fn, ASYNC_stack_free_fn *free_fn); int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *ctx, int *ret, int (*func)(void *), void *args, size_t size); int ASYNC_pause_job(void); ASYNC_JOB *ASYNC_get_current_job(void); ASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job); void ASYNC_block_pause(void); void ASYNC_unblock_pause(void); # ifdef __cplusplus } # endif #endif
3,504
32.380952
78
h
openssl
openssl-master/include/openssl/asyncerr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_ASYNCERR_H # define OPENSSL_ASYNCERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> /* * ASYNC reason codes. */ # define ASYNC_R_FAILED_TO_SET_POOL 101 # define ASYNC_R_FAILED_TO_SWAP_CONTEXT 102 # define ASYNC_R_INIT_FAILED 105 # define ASYNC_R_INVALID_POOL_SIZE 103 #endif
842
27.1
74
h
openssl
openssl-master/include/openssl/bioerr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_BIOERR_H # define OPENSSL_BIOERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> /* * BIO reason codes. */ # define BIO_R_ACCEPT_ERROR 100 # define BIO_R_ADDRINFO_ADDR_IS_NOT_AF_INET 141 # define BIO_R_AMBIGUOUS_HOST_OR_SERVICE 129 # define BIO_R_BAD_FOPEN_MODE 101 # define BIO_R_BROKEN_PIPE 124 # define BIO_R_CONNECT_ERROR 103 # define BIO_R_CONNECT_TIMEOUT 147 # define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107 # define BIO_R_GETSOCKNAME_ERROR 132 # define BIO_R_GETSOCKNAME_TRUNCATED_ADDRESS 133 # define BIO_R_GETTING_SOCKTYPE 134 # define BIO_R_INVALID_ARGUMENT 125 # define BIO_R_INVALID_SOCKET 135 # define BIO_R_IN_USE 123 # define BIO_R_LENGTH_TOO_LONG 102 # define BIO_R_LISTEN_V6_ONLY 136 # define BIO_R_LOCAL_ADDR_NOT_AVAILABLE 111 # define BIO_R_LOOKUP_RETURNED_NOTHING 142 # define BIO_R_MALFORMED_HOST_OR_SERVICE 130 # define BIO_R_NBIO_CONNECT_ERROR 110 # define BIO_R_NON_FATAL 112 # define BIO_R_NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED 143 # define BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED 144 # define BIO_R_NO_PORT_DEFINED 113 # define BIO_R_NO_SUCH_FILE 128 # define BIO_R_NULL_PARAMETER 115 /* unused */ # define BIO_R_TFO_DISABLED 106 # define BIO_R_TFO_NO_KERNEL_SUPPORT 108 # define BIO_R_TRANSFER_ERROR 104 # define BIO_R_TRANSFER_TIMEOUT 105 # define BIO_R_UNABLE_TO_BIND_SOCKET 117 # define BIO_R_UNABLE_TO_CREATE_SOCKET 118 # define BIO_R_UNABLE_TO_KEEPALIVE 137 # define BIO_R_UNABLE_TO_LISTEN_SOCKET 119 # define BIO_R_UNABLE_TO_NODELAY 138 # define BIO_R_UNABLE_TO_REUSEADDR 139 # define BIO_R_UNABLE_TO_TFO 109 # define BIO_R_UNAVAILABLE_IP_FAMILY 145 # define BIO_R_UNINITIALIZED 120 # define BIO_R_UNKNOWN_INFO_TYPE 140 # define BIO_R_UNSUPPORTED_IP_FAMILY 146 # define BIO_R_UNSUPPORTED_METHOD 121 # define BIO_R_UNSUPPORTED_PROTOCOL_FAMILY 131 # define BIO_R_WRITE_TO_READ_ONLY_BIO 126 # define BIO_R_WSASTARTUP 122 # define BIO_R_PORT_MISMATCH 150 # define BIO_R_PEER_ADDR_NOT_AVAILABLE 151 #endif
3,515
47.164384
74
h
openssl
openssl-master/include/openssl/blowfish.h
/* * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_BLOWFISH_H # define OPENSSL_BLOWFISH_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_BLOWFISH_H # endif # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_BF # include <openssl/e_os2.h> # ifdef __cplusplus extern "C" { # endif # define BF_BLOCK 8 # ifndef OPENSSL_NO_DEPRECATED_3_0 # define BF_ENCRYPT 1 # define BF_DECRYPT 0 /*- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * ! BF_LONG has to be at least 32 bits wide. ! * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ # define BF_LONG unsigned int # define BF_ROUNDS 16 typedef struct bf_key_st { BF_LONG P[BF_ROUNDS + 2]; BF_LONG S[4 * 256]; } BF_KEY; # endif /* OPENSSL_NO_DEPRECATED_3_0 */ # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 void BF_set_key(BF_KEY *key, int len, const unsigned char *data); OSSL_DEPRECATEDIN_3_0 void BF_encrypt(BF_LONG *data, const BF_KEY *key); OSSL_DEPRECATEDIN_3_0 void BF_decrypt(BF_LONG *data, const BF_KEY *key); OSSL_DEPRECATEDIN_3_0 void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, const BF_KEY *key, int enc); OSSL_DEPRECATEDIN_3_0 void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, const BF_KEY *schedule, unsigned char *ivec, int enc); OSSL_DEPRECATEDIN_3_0 void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, const BF_KEY *schedule, unsigned char *ivec, int *num, int enc); OSSL_DEPRECATEDIN_3_0 void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, const BF_KEY *schedule, unsigned char *ivec, int *num); OSSL_DEPRECATEDIN_3_0 const char *BF_options(void); # endif # ifdef __cplusplus } # endif # endif #endif
2,693
33.101266
80
h
openssl
openssl-master/include/openssl/bn.h
/* * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved. * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_BN_H # define OPENSSL_BN_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_BN_H # endif # include <openssl/e_os2.h> # ifndef OPENSSL_NO_STDIO # include <stdio.h> # endif # include <openssl/opensslconf.h> # include <openssl/types.h> # include <openssl/crypto.h> # include <openssl/bnerr.h> #ifdef __cplusplus extern "C" { #endif /* * 64-bit processor with LP64 ABI */ # ifdef SIXTY_FOUR_BIT_LONG # define BN_ULONG unsigned long # define BN_BYTES 8 # endif /* * 64-bit processor other than LP64 ABI */ # ifdef SIXTY_FOUR_BIT # define BN_ULONG unsigned long long # define BN_BYTES 8 # endif # ifdef THIRTY_TWO_BIT # define BN_ULONG unsigned int # define BN_BYTES 4 # endif # define BN_BITS2 (BN_BYTES * 8) # define BN_BITS (BN_BITS2 * 2) # define BN_TBIT ((BN_ULONG)1 << (BN_BITS2 - 1)) # define BN_FLG_MALLOCED 0x01 # define BN_FLG_STATIC_DATA 0x02 /* * avoid leaking exponent information through timing, * BN_mod_exp_mont() will call BN_mod_exp_mont_consttime, * BN_div() will call BN_div_no_branch, * BN_mod_inverse() will call bn_mod_inverse_no_branch. */ # define BN_FLG_CONSTTIME 0x04 # define BN_FLG_SECURE 0x08 # ifndef OPENSSL_NO_DEPRECATED_0_9_8 /* deprecated name for the flag */ # define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME # define BN_FLG_FREE 0x8000 /* used for debugging */ # endif void BN_set_flags(BIGNUM *b, int n); int BN_get_flags(const BIGNUM *b, int n); /* Values for |top| in BN_rand() */ #define BN_RAND_TOP_ANY -1 #define BN_RAND_TOP_ONE 0 #define BN_RAND_TOP_TWO 1 /* Values for |bottom| in BN_rand() */ #define BN_RAND_BOTTOM_ANY 0 #define BN_RAND_BOTTOM_ODD 1 /* * get a clone of a BIGNUM with changed flags, for *temporary* use only (the * two BIGNUMs cannot be used in parallel!). Also only for *read only* use. The * value |dest| should be a newly allocated BIGNUM obtained via BN_new() that * has not been otherwise initialised or used. */ void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags); /* Wrapper function to make using BN_GENCB easier */ int BN_GENCB_call(BN_GENCB *cb, int a, int b); BN_GENCB *BN_GENCB_new(void); void BN_GENCB_free(BN_GENCB *cb); /* Populate a BN_GENCB structure with an "old"-style callback */ void BN_GENCB_set_old(BN_GENCB *gencb, void (*callback) (int, int, void *), void *cb_arg); /* Populate a BN_GENCB structure with a "new"-style callback */ void BN_GENCB_set(BN_GENCB *gencb, int (*callback) (int, int, BN_GENCB *), void *cb_arg); void *BN_GENCB_get_arg(BN_GENCB *cb); # ifndef OPENSSL_NO_DEPRECATED_3_0 # define BN_prime_checks 0 /* default: select number of iterations based * on the size of the number */ /* * BN_prime_checks_for_size() returns the number of Miller-Rabin iterations * that will be done for checking that a random number is probably prime. The * error rate for accepting a composite number as prime depends on the size of * the prime |b|. The error rates used are for calculating an RSA key with 2 primes, * and so the level is what you would expect for a key of double the size of the * prime. * * This table is generated using the algorithm of FIPS PUB 186-4 * Digital Signature Standard (DSS), section F.1, page 117. * (https://dx.doi.org/10.6028/NIST.FIPS.186-4) * * The following magma script was used to generate the output: * securitybits:=125; * k:=1024; * for t:=1 to 65 do * for M:=3 to Floor(2*Sqrt(k-1)-1) do * S:=0; * // Sum over m * for m:=3 to M do * s:=0; * // Sum over j * for j:=2 to m do * s+:=(RealField(32)!2)^-(j+(k-1)/j); * end for; * S+:=2^(m-(m-1)*t)*s; * end for; * A:=2^(k-2-M*t); * B:=8*(Pi(RealField(32))^2-6)/3*2^(k-2)*S; * pkt:=2.00743*Log(2)*k*2^-k*(A+B); * seclevel:=Floor(-Log(2,pkt)); * if seclevel ge securitybits then * printf "k: %5o, security: %o bits (t: %o, M: %o)\n",k,seclevel,t,M; * break; * end if; * end for; * if seclevel ge securitybits then break; end if; * end for; * * It can be run online at: * http://magma.maths.usyd.edu.au/calc * * And will output: * k: 1024, security: 129 bits (t: 6, M: 23) * * k is the number of bits of the prime, securitybits is the level we want to * reach. * * prime length | RSA key size | # MR tests | security level * -------------+--------------|------------+--------------- * (b) >= 6394 | >= 12788 | 3 | 256 bit * (b) >= 3747 | >= 7494 | 3 | 192 bit * (b) >= 1345 | >= 2690 | 4 | 128 bit * (b) >= 1080 | >= 2160 | 5 | 128 bit * (b) >= 852 | >= 1704 | 5 | 112 bit * (b) >= 476 | >= 952 | 5 | 80 bit * (b) >= 400 | >= 800 | 6 | 80 bit * (b) >= 347 | >= 694 | 7 | 80 bit * (b) >= 308 | >= 616 | 8 | 80 bit * (b) >= 55 | >= 110 | 27 | 64 bit * (b) >= 6 | >= 12 | 34 | 64 bit */ # define BN_prime_checks_for_size(b) ((b) >= 3747 ? 3 : \ (b) >= 1345 ? 4 : \ (b) >= 476 ? 5 : \ (b) >= 400 ? 6 : \ (b) >= 347 ? 7 : \ (b) >= 308 ? 8 : \ (b) >= 55 ? 27 : \ /* b >= 6 */ 34) # endif # define BN_num_bytes(a) ((BN_num_bits(a)+7)/8) int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w); int BN_is_zero(const BIGNUM *a); int BN_is_one(const BIGNUM *a); int BN_is_word(const BIGNUM *a, const BN_ULONG w); int BN_is_odd(const BIGNUM *a); # define BN_one(a) (BN_set_word((a),1)) void BN_zero_ex(BIGNUM *a); # if OPENSSL_API_LEVEL > 908 # define BN_zero(a) BN_zero_ex(a) # else # define BN_zero(a) (BN_set_word((a),0)) # endif const BIGNUM *BN_value_one(void); char *BN_options(void); BN_CTX *BN_CTX_new_ex(OSSL_LIB_CTX *ctx); BN_CTX *BN_CTX_new(void); BN_CTX *BN_CTX_secure_new_ex(OSSL_LIB_CTX *ctx); BN_CTX *BN_CTX_secure_new(void); void BN_CTX_free(BN_CTX *c); void BN_CTX_start(BN_CTX *ctx); BIGNUM *BN_CTX_get(BN_CTX *ctx); void BN_CTX_end(BN_CTX *ctx); int BN_rand_ex(BIGNUM *rnd, int bits, int top, int bottom, unsigned int strength, BN_CTX *ctx); int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); int BN_priv_rand_ex(BIGNUM *rnd, int bits, int top, int bottom, unsigned int strength, BN_CTX *ctx); int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom); int BN_rand_range_ex(BIGNUM *r, const BIGNUM *range, unsigned int strength, BN_CTX *ctx); int BN_rand_range(BIGNUM *rnd, const BIGNUM *range); int BN_priv_rand_range_ex(BIGNUM *r, const BIGNUM *range, unsigned int strength, BN_CTX *ctx); int BN_priv_rand_range(BIGNUM *rnd, const BIGNUM *range); # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); OSSL_DEPRECATEDIN_3_0 int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range); # endif int BN_num_bits(const BIGNUM *a); int BN_num_bits_word(BN_ULONG l); int BN_security_bits(int L, int N); BIGNUM *BN_new(void); BIGNUM *BN_secure_new(void); void BN_clear_free(BIGNUM *a); BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b); void BN_swap(BIGNUM *a, BIGNUM *b); BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret); BIGNUM *BN_signed_bin2bn(const unsigned char *s, int len, BIGNUM *ret); int BN_bn2bin(const BIGNUM *a, unsigned char *to); int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen); int BN_signed_bn2bin(const BIGNUM *a, unsigned char *to, int tolen); BIGNUM *BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret); BIGNUM *BN_signed_lebin2bn(const unsigned char *s, int len, BIGNUM *ret); int BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen); int BN_signed_bn2lebin(const BIGNUM *a, unsigned char *to, int tolen); BIGNUM *BN_native2bn(const unsigned char *s, int len, BIGNUM *ret); BIGNUM *BN_signed_native2bn(const unsigned char *s, int len, BIGNUM *ret); int BN_bn2nativepad(const BIGNUM *a, unsigned char *to, int tolen); int BN_signed_bn2native(const BIGNUM *a, unsigned char *to, int tolen); BIGNUM *BN_mpi2bn(const unsigned char *s, int len, BIGNUM *ret); int BN_bn2mpi(const BIGNUM *a, unsigned char *to); int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx); /** BN_set_negative sets sign of a BIGNUM * \param b pointer to the BIGNUM object * \param n 0 if the BIGNUM b should be positive and a value != 0 otherwise */ void BN_set_negative(BIGNUM *b, int n); /** BN_is_negative returns 1 if the BIGNUM is negative * \param b pointer to the BIGNUM object * \return 1 if a < 0 and 0 otherwise */ int BN_is_negative(const BIGNUM *b); int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx); # define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx)) int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx); int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx); int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m); int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx); int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m); int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx); int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m); int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, BN_CTX *ctx); int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m); BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); int BN_mul_word(BIGNUM *a, BN_ULONG w); int BN_add_word(BIGNUM *a, BN_ULONG w); int BN_sub_word(BIGNUM *a, BN_ULONG w); int BN_set_word(BIGNUM *a, BN_ULONG w); BN_ULONG BN_get_word(const BIGNUM *a); int BN_cmp(const BIGNUM *a, const BIGNUM *b); void BN_free(BIGNUM *a); int BN_is_bit_set(const BIGNUM *a, int n); int BN_lshift(BIGNUM *r, const BIGNUM *a, int n); int BN_lshift1(BIGNUM *r, const BIGNUM *a); int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx); int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont); int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1, const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx); int BN_mod_exp_mont_consttime_x2(BIGNUM *rr1, const BIGNUM *a1, const BIGNUM *p1, const BIGNUM *m1, BN_MONT_CTX *in_mont1, BIGNUM *rr2, const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m2, BN_MONT_CTX *in_mont2, BN_CTX *ctx); int BN_mask_bits(BIGNUM *a, int n); # ifndef OPENSSL_NO_STDIO int BN_print_fp(FILE *fp, const BIGNUM *a); # endif int BN_print(BIO *bio, const BIGNUM *a); int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx); int BN_rshift(BIGNUM *r, const BIGNUM *a, int n); int BN_rshift1(BIGNUM *r, const BIGNUM *a); void BN_clear(BIGNUM *a); BIGNUM *BN_dup(const BIGNUM *a); int BN_ucmp(const BIGNUM *a, const BIGNUM *b); int BN_set_bit(BIGNUM *a, int n); int BN_clear_bit(BIGNUM *a, int n); char *BN_bn2hex(const BIGNUM *a); char *BN_bn2dec(const BIGNUM *a); int BN_hex2bn(BIGNUM **a, const char *str); int BN_dec2bn(BIGNUM **a, const char *str); int BN_asc2bn(BIGNUM **a, const char *str); int BN_gcd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); /* returns * -2 for * error */ int BN_are_coprime(BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); BIGNUM *BN_mod_inverse(BIGNUM *ret, const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); BIGNUM *BN_mod_sqrt(BIGNUM *ret, const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords); /* Deprecated versions */ # ifndef OPENSSL_NO_DEPRECATED_0_9_8 OSSL_DEPRECATEDIN_0_9_8 BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe, const BIGNUM *add, const BIGNUM *rem, void (*callback) (int, int, void *), void *cb_arg); OSSL_DEPRECATEDIN_0_9_8 int BN_is_prime(const BIGNUM *p, int nchecks, void (*callback) (int, int, void *), BN_CTX *ctx, void *cb_arg); OSSL_DEPRECATEDIN_0_9_8 int BN_is_prime_fasttest(const BIGNUM *p, int nchecks, void (*callback) (int, int, void *), BN_CTX *ctx, void *cb_arg, int do_trial_division); # endif # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 int BN_is_prime_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, BN_GENCB *cb); OSSL_DEPRECATEDIN_3_0 int BN_is_prime_fasttest_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, int do_trial_division, BN_GENCB *cb); # endif /* Newer versions */ int BN_generate_prime_ex2(BIGNUM *ret, int bits, int safe, const BIGNUM *add, const BIGNUM *rem, BN_GENCB *cb, BN_CTX *ctx); int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add, const BIGNUM *rem, BN_GENCB *cb); int BN_check_prime(const BIGNUM *p, BN_CTX *ctx, BN_GENCB *cb); # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx); OSSL_DEPRECATEDIN_3_0 int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, const BIGNUM *Xp, const BIGNUM *Xp1, const BIGNUM *Xp2, const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb); OSSL_DEPRECATEDIN_3_0 int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, BIGNUM *Xp1, BIGNUM *Xp2, const BIGNUM *Xp, const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb); # endif BN_MONT_CTX *BN_MONT_CTX_new(void); int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_MONT_CTX *mont, BN_CTX *ctx); int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, BN_CTX *ctx); int BN_from_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, BN_CTX *ctx); void BN_MONT_CTX_free(BN_MONT_CTX *mont); int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx); BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from); BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock, const BIGNUM *mod, BN_CTX *ctx); /* BN_BLINDING flags */ # define BN_BLINDING_NO_UPDATE 0x00000001 # define BN_BLINDING_NO_RECREATE 0x00000002 BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod); void BN_BLINDING_free(BN_BLINDING *b); int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx); int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *); int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *); int BN_BLINDING_is_current_thread(BN_BLINDING *b); void BN_BLINDING_set_current_thread(BN_BLINDING *b); int BN_BLINDING_lock(BN_BLINDING *b); int BN_BLINDING_unlock(BN_BLINDING *b); unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, int (*bn_mod_exp) (BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), BN_MONT_CTX *m_ctx); # ifndef OPENSSL_NO_DEPRECATED_0_9_8 OSSL_DEPRECATEDIN_0_9_8 void BN_set_params(int mul, int high, int low, int mont); OSSL_DEPRECATEDIN_0_9_8 int BN_get_params(int which); /* 0, mul, 1 high, 2 low, 3 mont */ # endif BN_RECP_CTX *BN_RECP_CTX_new(void); void BN_RECP_CTX_free(BN_RECP_CTX *recp); int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *rdiv, BN_CTX *ctx); int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y, BN_RECP_CTX *recp, BN_CTX *ctx); int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx); int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, BN_RECP_CTX *recp, BN_CTX *ctx); # ifndef OPENSSL_NO_EC2M /* * Functions for arithmetic over binary polynomials represented by BIGNUMs. * The BIGNUM::neg property of BIGNUMs representing binary polynomials is * ignored. Note that input arguments are not const so that their bit arrays * can be expanded to the appropriate size if needed. */ /* * r = a + b */ int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); # define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b) /* * r=a mod p */ int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p); /* r = (a * b) mod p */ int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx); /* r = (a * a) mod p */ int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); /* r = (1 / b) mod p */ int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx); /* r = (a / b) mod p */ int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx); /* r = (a ^ b) mod p */ int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx); /* r = sqrt(a) mod p */ int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); /* r^2 + r = a mod p */ int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); # define BN_GF2m_cmp(a, b) BN_ucmp((a), (b)) /*- * Some functions allow for representation of the irreducible polynomials * as an unsigned int[], say p. The irreducible f(t) is then of the form: * t^p[0] + t^p[1] + ... + t^p[k] * where m = p[0] > p[1] > ... > p[k] = 0. */ /* r = a mod p */ int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]); /* r = (a * b) mod p */ int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const int p[], BN_CTX *ctx); /* r = (a * a) mod p */ int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[], BN_CTX *ctx); /* r = (1 / b) mod p */ int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[], BN_CTX *ctx); /* r = (a / b) mod p */ int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const int p[], BN_CTX *ctx); /* r = (a ^ b) mod p */ int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const int p[], BN_CTX *ctx); /* r = sqrt(a) mod p */ int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, const int p[], BN_CTX *ctx); /* r^2 + r = a mod p */ int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a, const int p[], BN_CTX *ctx); int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max); int BN_GF2m_arr2poly(const int p[], BIGNUM *a); # endif /* * faster mod functions for the 'NIST primes' 0 <= a < p^2 */ int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); const BIGNUM *BN_get0_nist_prime_192(void); const BIGNUM *BN_get0_nist_prime_224(void); const BIGNUM *BN_get0_nist_prime_256(void); const BIGNUM *BN_get0_nist_prime_384(void); const BIGNUM *BN_get0_nist_prime_521(void); int (*BN_nist_mod_func(const BIGNUM *p)) (BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx); int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range, const BIGNUM *priv, const unsigned char *message, size_t message_len, BN_CTX *ctx); /* Primes from RFC 2409 */ BIGNUM *BN_get_rfc2409_prime_768(BIGNUM *bn); BIGNUM *BN_get_rfc2409_prime_1024(BIGNUM *bn); /* Primes from RFC 3526 */ BIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn); BIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn); BIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn); BIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn); BIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn); BIGNUM *BN_get_rfc3526_prime_8192(BIGNUM *bn); # ifndef OPENSSL_NO_DEPRECATED_1_1_0 # define get_rfc2409_prime_768 BN_get_rfc2409_prime_768 # define get_rfc2409_prime_1024 BN_get_rfc2409_prime_1024 # define get_rfc3526_prime_1536 BN_get_rfc3526_prime_1536 # define get_rfc3526_prime_2048 BN_get_rfc3526_prime_2048 # define get_rfc3526_prime_3072 BN_get_rfc3526_prime_3072 # define get_rfc3526_prime_4096 BN_get_rfc3526_prime_4096 # define get_rfc3526_prime_6144 BN_get_rfc3526_prime_6144 # define get_rfc3526_prime_8192 BN_get_rfc3526_prime_8192 # endif int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom); # ifdef __cplusplus } # endif #endif
24,183
39.920474
84
h
openssl
openssl-master/include/openssl/bnerr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_BNERR_H # define OPENSSL_BNERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> /* * BN reason codes. */ # define BN_R_ARG2_LT_ARG3 100 # define BN_R_BAD_RECIPROCAL 101 # define BN_R_BIGNUM_TOO_LONG 114 # define BN_R_BITS_TOO_SMALL 118 # define BN_R_CALLED_WITH_EVEN_MODULUS 102 # define BN_R_DIV_BY_ZERO 103 # define BN_R_ENCODING_ERROR 104 # define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105 # define BN_R_INPUT_NOT_REDUCED 110 # define BN_R_INVALID_LENGTH 106 # define BN_R_INVALID_RANGE 115 # define BN_R_INVALID_SHIFT 119 # define BN_R_NOT_A_SQUARE 111 # define BN_R_NOT_INITIALIZED 107 # define BN_R_NO_INVERSE 108 # define BN_R_NO_PRIME_CANDIDATE 121 # define BN_R_NO_SOLUTION 116 # define BN_R_NO_SUITABLE_DIGEST 120 # define BN_R_PRIVATE_KEY_TOO_LARGE 117 # define BN_R_P_IS_NOT_PRIME 112 # define BN_R_TOO_MANY_ITERATIONS 113 # define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109 #endif
1,949
39.625
74
h
openssl
openssl-master/include/openssl/buffer.h
/* * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_BUFFER_H # define OPENSSL_BUFFER_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_BUFFER_H # endif # include <openssl/types.h> # ifndef OPENSSL_CRYPTO_H # include <openssl/crypto.h> # endif # include <openssl/buffererr.h> #ifdef __cplusplus extern "C" { #endif # include <stddef.h> # include <sys/types.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define BUF_strdup(s) OPENSSL_strdup(s) # define BUF_strndup(s, size) OPENSSL_strndup(s, size) # define BUF_memdup(data, size) OPENSSL_memdup(data, size) # define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size) # define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size) # define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen) # endif struct buf_mem_st { size_t length; /* current number of bytes */ char *data; size_t max; /* size of buffer */ unsigned long flags; }; # define BUF_MEM_FLAG_SECURE 0x01 BUF_MEM *BUF_MEM_new(void); BUF_MEM *BUF_MEM_new_ex(unsigned long flags); void BUF_MEM_free(BUF_MEM *a); size_t BUF_MEM_grow(BUF_MEM *str, size_t len); size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len); void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); # ifdef __cplusplus } # endif #endif
1,658
25.333333
74
h
openssl
openssl-master/include/openssl/buffererr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_BUFFERERR_H # define OPENSSL_BUFFERERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> /* * BUF reason codes. */ #endif
594
21.884615
74
h
openssl
openssl-master/include/openssl/camellia.h
/* * Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_CAMELLIA_H # define OPENSSL_CAMELLIA_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_CAMELLIA_H # endif # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_CAMELLIA # include <stddef.h> #ifdef __cplusplus extern "C" { #endif # define CAMELLIA_BLOCK_SIZE 16 # ifndef OPENSSL_NO_DEPRECATED_3_0 # define CAMELLIA_ENCRYPT 1 # define CAMELLIA_DECRYPT 0 /* * Because array size can't be a const in C, the following two are macros. * Both sizes are in bytes. */ /* This should be a hidden type, but EVP requires that the size be known */ # define CAMELLIA_TABLE_BYTE_LEN 272 # define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4) typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match * with WORD */ struct camellia_key_st { union { double d; /* ensures 64-bit align */ KEY_TABLE_TYPE rd_key; } u; int grand_rounds; }; typedef struct camellia_key_st CAMELLIA_KEY; # endif /* OPENSSL_NO_DEPRECATED_3_0 */ # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 int Camellia_set_key(const unsigned char *userKey, const int bits, CAMELLIA_KEY *key); OSSL_DEPRECATEDIN_3_0 void Camellia_encrypt(const unsigned char *in, unsigned char *out, const CAMELLIA_KEY *key); OSSL_DEPRECATEDIN_3_0 void Camellia_decrypt(const unsigned char *in, unsigned char *out, const CAMELLIA_KEY *key); OSSL_DEPRECATEDIN_3_0 void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out, const CAMELLIA_KEY *key, const int enc); OSSL_DEPRECATEDIN_3_0 void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char *ivec, const int enc); OSSL_DEPRECATEDIN_3_0 void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char *ivec, int *num, const int enc); OSSL_DEPRECATEDIN_3_0 void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char *ivec, int *num, const int enc); OSSL_DEPRECATEDIN_3_0 void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char *ivec, int *num, const int enc); OSSL_DEPRECATEDIN_3_0 void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char *ivec, int *num); OSSL_DEPRECATEDIN_3_0 void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out, size_t length, const CAMELLIA_KEY *key, unsigned char ivec[CAMELLIA_BLOCK_SIZE], unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE], unsigned int *num); # endif # ifdef __cplusplus } # endif # endif #endif
5,069
41.966102
77
h
openssl
openssl-master/include/openssl/cast.h
/* * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_CAST_H # define OPENSSL_CAST_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_CAST_H # endif # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_CAST # ifdef __cplusplus extern "C" { # endif # define CAST_BLOCK 8 # define CAST_KEY_LENGTH 16 # ifndef OPENSSL_NO_DEPRECATED_3_0 # define CAST_ENCRYPT 1 # define CAST_DECRYPT 0 # define CAST_LONG unsigned int typedef struct cast_key_st { CAST_LONG data[32]; int short_key; /* Use reduced rounds for short key */ } CAST_KEY; # endif /* OPENSSL_NO_DEPRECATED_3_0 */ # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); OSSL_DEPRECATEDIN_3_0 void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, const CAST_KEY *key, int enc); OSSL_DEPRECATEDIN_3_0 void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key); OSSL_DEPRECATEDIN_3_0 void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key); OSSL_DEPRECATEDIN_3_0 void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, const CAST_KEY *ks, unsigned char *iv, int enc); OSSL_DEPRECATEDIN_3_0 void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, const CAST_KEY *schedule, unsigned char *ivec, int *num, int enc); OSSL_DEPRECATEDIN_3_0 void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, const CAST_KEY *schedule, unsigned char *ivec, int *num); # endif # ifdef __cplusplus } # endif # endif #endif
2,066
27.708333
74
h
openssl
openssl-master/include/openssl/cmac.h
/* * Copyright 2010-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_CMAC_H # define OPENSSL_CMAC_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_CMAC_H # endif # ifndef OPENSSL_NO_CMAC # ifdef __cplusplus extern "C" { # endif # include <openssl/evp.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 /* Opaque */ typedef struct CMAC_CTX_st CMAC_CTX; # endif # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 CMAC_CTX *CMAC_CTX_new(void); OSSL_DEPRECATEDIN_3_0 void CMAC_CTX_cleanup(CMAC_CTX *ctx); OSSL_DEPRECATEDIN_3_0 void CMAC_CTX_free(CMAC_CTX *ctx); OSSL_DEPRECATEDIN_3_0 EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); OSSL_DEPRECATEDIN_3_0 int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); OSSL_DEPRECATEDIN_3_0 int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, const EVP_CIPHER *cipher, ENGINE *impl); OSSL_DEPRECATEDIN_3_0 int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); OSSL_DEPRECATEDIN_3_0 int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); OSSL_DEPRECATEDIN_3_0 int CMAC_resume(CMAC_CTX *ctx); # endif # ifdef __cplusplus } # endif # endif #endif
1,608
29.358491
78
h
openssl
openssl-master/include/openssl/cmp_util.h
/* * Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved. * Copyright Nokia 2007-2019 * Copyright Siemens AG 2015-2019 * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_CMP_UTIL_H # define OPENSSL_CMP_UTIL_H # pragma once # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_CMP # include <openssl/macros.h> # include <openssl/trace.h> # ifdef __cplusplus extern "C" { # endif int OSSL_CMP_log_open(void); void OSSL_CMP_log_close(void); # define OSSL_CMP_LOG_PREFIX "CMP " /* * generalized logging/error callback mirroring the severity levels of syslog.h */ typedef int OSSL_CMP_severity; # define OSSL_CMP_LOG_EMERG 0 # define OSSL_CMP_LOG_ALERT 1 # define OSSL_CMP_LOG_CRIT 2 # define OSSL_CMP_LOG_ERR 3 # define OSSL_CMP_LOG_WARNING 4 # define OSSL_CMP_LOG_NOTICE 5 # define OSSL_CMP_LOG_INFO 6 # define OSSL_CMP_LOG_DEBUG 7 # define OSSL_CMP_LOG_TRACE 8 # define OSSL_CMP_LOG_MAX OSSL_CMP_LOG_TRACE typedef int (*OSSL_CMP_log_cb_t)(const char *func, const char *file, int line, OSSL_CMP_severity level, const char *msg); int OSSL_CMP_print_to_bio(BIO *bio, const char *component, const char *file, int line, OSSL_CMP_severity level, const char *msg); /* use of the logging callback for outputting error queue */ void OSSL_CMP_print_errors_cb(OSSL_CMP_log_cb_t log_fn); # ifdef __cplusplus } # endif # endif /* !defined(OPENSSL_NO_CMP) */ #endif /* !defined(OPENSSL_CMP_UTIL_H) */
1,742
29.578947
79
h
openssl
openssl-master/include/openssl/cmperr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_CMPERR_H # define OPENSSL_CMPERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> # ifndef OPENSSL_NO_CMP /* * CMP reason codes. */ # define CMP_R_ALGORITHM_NOT_SUPPORTED 139 # define CMP_R_BAD_CHECKAFTER_IN_POLLREP 167 # define CMP_R_BAD_REQUEST_ID 108 # define CMP_R_CERTHASH_UNMATCHED 156 # define CMP_R_CERTID_NOT_FOUND 109 # define CMP_R_CERTIFICATE_NOT_ACCEPTED 169 # define CMP_R_CERTIFICATE_NOT_FOUND 112 # define CMP_R_CERTREQMSG_NOT_FOUND 157 # define CMP_R_CERTRESPONSE_NOT_FOUND 113 # define CMP_R_CERT_AND_KEY_DO_NOT_MATCH 114 # define CMP_R_CHECKAFTER_OUT_OF_RANGE 181 # define CMP_R_ENCOUNTERED_KEYUPDATEWARNING 176 # define CMP_R_ENCOUNTERED_WAITING 162 # define CMP_R_ERROR_CALCULATING_PROTECTION 115 # define CMP_R_ERROR_CREATING_CERTCONF 116 # define CMP_R_ERROR_CREATING_CERTREP 117 # define CMP_R_ERROR_CREATING_CERTREQ 163 # define CMP_R_ERROR_CREATING_ERROR 118 # define CMP_R_ERROR_CREATING_GENM 119 # define CMP_R_ERROR_CREATING_GENP 120 # define CMP_R_ERROR_CREATING_PKICONF 122 # define CMP_R_ERROR_CREATING_POLLREP 123 # define CMP_R_ERROR_CREATING_POLLREQ 124 # define CMP_R_ERROR_CREATING_RP 125 # define CMP_R_ERROR_CREATING_RR 126 # define CMP_R_ERROR_PARSING_PKISTATUS 107 # define CMP_R_ERROR_PROCESSING_MESSAGE 158 # define CMP_R_ERROR_PROTECTING_MESSAGE 127 # define CMP_R_ERROR_SETTING_CERTHASH 128 # define CMP_R_ERROR_UNEXPECTED_CERTCONF 160 # define CMP_R_ERROR_VALIDATING_PROTECTION 140 # define CMP_R_ERROR_VALIDATING_SIGNATURE 171 # define CMP_R_FAILED_BUILDING_OWN_CHAIN 164 # define CMP_R_FAILED_EXTRACTING_PUBKEY 141 # define CMP_R_FAILURE_OBTAINING_RANDOM 110 # define CMP_R_FAIL_INFO_OUT_OF_RANGE 129 # define CMP_R_GETTING_GENP 192 # define CMP_R_INVALID_ARGS 100 # define CMP_R_INVALID_GENP 193 # define CMP_R_INVALID_OPTION 174 # define CMP_R_INVALID_ROOTCAKEYUPDATE 195 # define CMP_R_MISSING_CERTID 165 # define CMP_R_MISSING_KEY_INPUT_FOR_CREATING_PROTECTION 130 # define CMP_R_MISSING_KEY_USAGE_DIGITALSIGNATURE 142 # define CMP_R_MISSING_P10CSR 121 # define CMP_R_MISSING_PBM_SECRET 166 # define CMP_R_MISSING_PRIVATE_KEY 131 # define CMP_R_MISSING_PRIVATE_KEY_FOR_POPO 190 # define CMP_R_MISSING_PROTECTION 143 # define CMP_R_MISSING_PUBLIC_KEY 183 # define CMP_R_MISSING_REFERENCE_CERT 168 # define CMP_R_MISSING_SECRET 178 # define CMP_R_MISSING_SENDER_IDENTIFICATION 111 # define CMP_R_MISSING_TRUST_ANCHOR 179 # define CMP_R_MISSING_TRUST_STORE 144 # define CMP_R_MULTIPLE_REQUESTS_NOT_SUPPORTED 161 # define CMP_R_MULTIPLE_RESPONSES_NOT_SUPPORTED 170 # define CMP_R_MULTIPLE_SAN_SOURCES 102 # define CMP_R_NO_STDIO 194 # define CMP_R_NO_SUITABLE_SENDER_CERT 145 # define CMP_R_NULL_ARGUMENT 103 # define CMP_R_PKIBODY_ERROR 146 # define CMP_R_PKISTATUSINFO_NOT_FOUND 132 # define CMP_R_POLLING_FAILED 172 # define CMP_R_POTENTIALLY_INVALID_CERTIFICATE 147 # define CMP_R_RECEIVED_ERROR 180 # define CMP_R_RECIPNONCE_UNMATCHED 148 # define CMP_R_REQUEST_NOT_ACCEPTED 149 # define CMP_R_REQUEST_REJECTED_BY_SERVER 182 # define CMP_R_SENDER_GENERALNAME_TYPE_NOT_SUPPORTED 150 # define CMP_R_SRVCERT_DOES_NOT_VALIDATE_MSG 151 # define CMP_R_TOTAL_TIMEOUT 184 # define CMP_R_TRANSACTIONID_UNMATCHED 152 # define CMP_R_TRANSFER_ERROR 159 # define CMP_R_UNCLEAN_CTX 191 # define CMP_R_UNEXPECTED_PKIBODY 133 # define CMP_R_UNEXPECTED_PKISTATUS 185 # define CMP_R_UNEXPECTED_PVNO 153 # define CMP_R_UNKNOWN_ALGORITHM_ID 134 # define CMP_R_UNKNOWN_CERT_TYPE 135 # define CMP_R_UNKNOWN_PKISTATUS 186 # define CMP_R_UNSUPPORTED_ALGORITHM 136 # define CMP_R_UNSUPPORTED_KEY_TYPE 137 # define CMP_R_UNSUPPORTED_PROTECTION_ALG_DHBASEDMAC 154 # define CMP_R_VALUE_TOO_LARGE 175 # define CMP_R_VALUE_TOO_SMALL 177 # define CMP_R_WRONG_ALGORITHM_OID 138 # define CMP_R_WRONG_CERTID 189 # define CMP_R_WRONG_CERTID_IN_RP 187 # define CMP_R_WRONG_PBM_VALUE 155 # define CMP_R_WRONG_RP_COMPONENT_COUNT 188 # define CMP_R_WRONG_SERIAL_IN_RP 173 # endif #endif
6,417
52.041322
74
h
openssl
openssl-master/include/openssl/cmserr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_CMSERR_H # define OPENSSL_CMSERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> # ifndef OPENSSL_NO_CMS /* * CMS reason codes. */ # define CMS_R_ADD_SIGNER_ERROR 99 # define CMS_R_ATTRIBUTE_ERROR 161 # define CMS_R_CERTIFICATE_ALREADY_PRESENT 175 # define CMS_R_CERTIFICATE_HAS_NO_KEYID 160 # define CMS_R_CERTIFICATE_VERIFY_ERROR 100 # define CMS_R_CIPHER_AEAD_SET_TAG_ERROR 184 # define CMS_R_CIPHER_GET_TAG 185 # define CMS_R_CIPHER_INITIALISATION_ERROR 101 # define CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR 102 # define CMS_R_CMS_DATAFINAL_ERROR 103 # define CMS_R_CMS_LIB 104 # define CMS_R_CONTENTIDENTIFIER_MISMATCH 170 # define CMS_R_CONTENT_NOT_FOUND 105 # define CMS_R_CONTENT_TYPE_MISMATCH 171 # define CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA 106 # define CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA 107 # define CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA 108 # define CMS_R_CONTENT_VERIFY_ERROR 109 # define CMS_R_CTRL_ERROR 110 # define CMS_R_CTRL_FAILURE 111 # define CMS_R_DECODE_ERROR 187 # define CMS_R_DECRYPT_ERROR 112 # define CMS_R_ERROR_GETTING_PUBLIC_KEY 113 # define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE 114 # define CMS_R_ERROR_SETTING_KEY 115 # define CMS_R_ERROR_SETTING_RECIPIENTINFO 116 # define CMS_R_ESS_SIGNING_CERTID_MISMATCH_ERROR 183 # define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH 117 # define CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER 176 # define CMS_R_INVALID_KEY_LENGTH 118 # define CMS_R_INVALID_LABEL 190 # define CMS_R_INVALID_OAEP_PARAMETERS 191 # define CMS_R_KDF_PARAMETER_ERROR 186 # define CMS_R_MD_BIO_INIT_ERROR 119 # define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH 120 # define CMS_R_MESSAGEDIGEST_WRONG_LENGTH 121 # define CMS_R_MSGSIGDIGEST_ERROR 172 # define CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE 162 # define CMS_R_MSGSIGDIGEST_WRONG_LENGTH 163 # define CMS_R_NEED_ONE_SIGNER 164 # define CMS_R_NOT_A_SIGNED_RECEIPT 165 # define CMS_R_NOT_ENCRYPTED_DATA 122 # define CMS_R_NOT_KEK 123 # define CMS_R_NOT_KEY_AGREEMENT 181 # define CMS_R_NOT_KEY_TRANSPORT 124 # define CMS_R_NOT_PWRI 177 # define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 125 # define CMS_R_NO_CIPHER 126 # define CMS_R_NO_CONTENT 127 # define CMS_R_NO_CONTENT_TYPE 173 # define CMS_R_NO_DEFAULT_DIGEST 128 # define CMS_R_NO_DIGEST_SET 129 # define CMS_R_NO_KEY 130 # define CMS_R_NO_KEY_OR_CERT 174 # define CMS_R_NO_MATCHING_DIGEST 131 # define CMS_R_NO_MATCHING_RECIPIENT 132 # define CMS_R_NO_MATCHING_SIGNATURE 166 # define CMS_R_NO_MSGSIGDIGEST 167 # define CMS_R_NO_PASSWORD 178 # define CMS_R_NO_PRIVATE_KEY 133 # define CMS_R_NO_PUBLIC_KEY 134 # define CMS_R_NO_RECEIPT_REQUEST 168 # define CMS_R_NO_SIGNERS 135 # define CMS_R_OPERATION_UNSUPPORTED 182 # define CMS_R_PEER_KEY_ERROR 188 # define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 136 # define CMS_R_RECEIPT_DECODE_ERROR 169 # define CMS_R_RECIPIENT_ERROR 137 # define CMS_R_SHARED_INFO_ERROR 189 # define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND 138 # define CMS_R_SIGNFINAL_ERROR 139 # define CMS_R_SMIME_TEXT_ERROR 140 # define CMS_R_STORE_INIT_ERROR 141 # define CMS_R_TYPE_NOT_COMPRESSED_DATA 142 # define CMS_R_TYPE_NOT_DATA 143 # define CMS_R_TYPE_NOT_DIGESTED_DATA 144 # define CMS_R_TYPE_NOT_ENCRYPTED_DATA 145 # define CMS_R_TYPE_NOT_ENVELOPED_DATA 146 # define CMS_R_UNABLE_TO_FINALIZE_CONTEXT 147 # define CMS_R_UNKNOWN_CIPHER 148 # define CMS_R_UNKNOWN_DIGEST_ALGORITHM 149 # define CMS_R_UNKNOWN_ID 150 # define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM 151 # define CMS_R_UNSUPPORTED_CONTENT_ENCRYPTION_ALGORITHM 194 # define CMS_R_UNSUPPORTED_CONTENT_TYPE 152 # define CMS_R_UNSUPPORTED_ENCRYPTION_TYPE 192 # define CMS_R_UNSUPPORTED_KEK_ALGORITHM 153 # define CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM 179 # define CMS_R_UNSUPPORTED_LABEL_SOURCE 193 # define CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE 155 # define CMS_R_UNSUPPORTED_RECIPIENT_TYPE 154 # define CMS_R_UNSUPPORTED_TYPE 156 # define CMS_R_UNWRAP_ERROR 157 # define CMS_R_UNWRAP_FAILURE 180 # define CMS_R_VERIFICATION_FAILURE 158 # define CMS_R_WRAP_ERROR 159 # endif #endif
6,668
52.352
74
h
openssl
openssl-master/include/openssl/comp.h
/* * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_COMP_H # define OPENSSL_COMP_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_COMP_H # endif # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_COMP # include <openssl/crypto.h> # include <openssl/comperr.h> # ifdef __cplusplus extern "C" { # endif COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); const COMP_METHOD *COMP_CTX_get_method(const COMP_CTX *ctx); int COMP_CTX_get_type(const COMP_CTX* comp); int COMP_get_type(const COMP_METHOD *meth); const char *COMP_get_name(const COMP_METHOD *meth); void COMP_CTX_free(COMP_CTX *ctx); int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, unsigned char *in, int ilen); int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, unsigned char *in, int ilen); COMP_METHOD *COMP_zlib(void); COMP_METHOD *COMP_zlib_oneshot(void); COMP_METHOD *COMP_brotli(void); COMP_METHOD *COMP_brotli_oneshot(void); COMP_METHOD *COMP_zstd(void); COMP_METHOD *COMP_zstd_oneshot(void); #ifndef OPENSSL_NO_DEPRECATED_1_1_0 # define COMP_zlib_cleanup() while(0) continue #endif # ifdef OPENSSL_BIO_H const BIO_METHOD *BIO_f_zlib(void); const BIO_METHOD *BIO_f_brotli(void); const BIO_METHOD *BIO_f_zstd(void); # endif # ifdef __cplusplus } # endif # endif #endif
1,674
24.769231
74
h
openssl
openssl-master/include/openssl/comperr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_COMPERR_H # define OPENSSL_COMPERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> # ifndef OPENSSL_NO_COMP /* * COMP reason codes. */ # define COMP_R_BROTLI_DECODE_ERROR 102 # define COMP_R_BROTLI_ENCODE_ERROR 103 # define COMP_R_BROTLI_NOT_SUPPORTED 104 # define COMP_R_ZLIB_DEFLATE_ERROR 99 # define COMP_R_ZLIB_INFLATE_ERROR 100 # define COMP_R_ZLIB_NOT_SUPPORTED 101 # define COMP_R_ZSTD_COMPRESS_ERROR 105 # define COMP_R_ZSTD_DECODE_ERROR 106 # define COMP_R_ZSTD_DECOMPRESS_ERROR 107 # define COMP_R_ZSTD_NOT_SUPPORTED 108 # endif #endif
1,254
31.179487
74
h
openssl
openssl-master/include/openssl/conf_api.h
/* * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_CONF_API_H # define OPENSSL_CONF_API_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_CONF_API_H # endif # include <openssl/lhash.h> # include <openssl/conf.h> #ifdef __cplusplus extern "C" { #endif /* Up until OpenSSL 0.9.5a, this was new_section */ CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); /* Up until OpenSSL 0.9.5a, this was get_section */ CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, const char *section); int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); char *_CONF_get_string(const CONF *conf, const char *section, const char *name); long _CONF_get_number(const CONF *conf, const char *section, const char *name); int _CONF_new_data(CONF *conf); void _CONF_free_data(CONF *conf); #ifdef __cplusplus } #endif #endif
1,420
29.234043
74
h
openssl
openssl-master/include/openssl/conferr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_CONFERR_H # define OPENSSL_CONFERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> /* * CONF reason codes. */ # define CONF_R_ERROR_LOADING_DSO 110 # define CONF_R_INVALID_PRAGMA 122 # define CONF_R_LIST_CANNOT_BE_NULL 115 # define CONF_R_MANDATORY_BRACES_IN_VARIABLE_EXPANSION 123 # define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 # define CONF_R_MISSING_EQUAL_SIGN 101 # define CONF_R_MISSING_INIT_FUNCTION 112 # define CONF_R_MODULE_INITIALIZATION_ERROR 109 # define CONF_R_NO_CLOSE_BRACE 102 # define CONF_R_NO_CONF 105 # define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106 # define CONF_R_NO_SECTION 107 # define CONF_R_NO_SUCH_FILE 114 # define CONF_R_NO_VALUE 108 # define CONF_R_NUMBER_TOO_LARGE 121 # define CONF_R_OPENSSL_CONF_REFERENCES_MISSING_SECTION 124 # define CONF_R_RECURSIVE_DIRECTORY_INCLUDE 111 # define CONF_R_RELATIVE_PATH 125 # define CONF_R_SSL_COMMAND_SECTION_EMPTY 117 # define CONF_R_SSL_COMMAND_SECTION_NOT_FOUND 118 # define CONF_R_SSL_SECTION_EMPTY 119 # define CONF_R_SSL_SECTION_NOT_FOUND 120 # define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 # define CONF_R_UNKNOWN_MODULE_NAME 113 # define CONF_R_VARIABLE_EXPANSION_TOO_LONG 116 # define CONF_R_VARIABLE_HAS_NO_VALUE 104 #endif
2,203
41.384615
74
h
openssl
openssl-master/include/openssl/conftypes.h
/* * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_CONFTYPES_H # define OPENSSL_CONFTYPES_H # pragma once #ifndef OPENSSL_CONF_H # include <openssl/conf.h> #endif /* * The contents of this file are deprecated and will be made opaque */ struct conf_method_st { const char *name; CONF *(*create) (CONF_METHOD *meth); int (*init) (CONF *conf); int (*destroy) (CONF *conf); int (*destroy_data) (CONF *conf); int (*load_bio) (CONF *conf, BIO *bp, long *eline); int (*dump) (const CONF *conf, BIO *bp); int (*is_number) (const CONF *conf, char c); int (*to_int) (const CONF *conf, char c); int (*load) (CONF *conf, const char *name, long *eline); }; struct conf_st { CONF_METHOD *meth; void *meth_data; LHASH_OF(CONF_VALUE) *data; int flag_dollarid; int flag_abspath; char *includedir; OSSL_LIB_CTX *libctx; }; #endif
1,190
25.466667
74
h
openssl
openssl-master/include/openssl/core.h
/* * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_CORE_H # define OPENSSL_CORE_H # pragma once # include <stddef.h> # include <openssl/types.h> # ifdef __cplusplus extern "C" { # endif /*- * Base types * ---------- * * These are the types that the OpenSSL core and providers have in common * to communicate data between them. */ /* Opaque handles to be used with core upcall functions from providers */ typedef struct ossl_core_handle_st OSSL_CORE_HANDLE; typedef struct openssl_core_ctx_st OPENSSL_CORE_CTX; typedef struct ossl_core_bio_st OSSL_CORE_BIO; /* * Dispatch table element. function_id numbers and the functions are defined * in core_dispatch.h, see macros with 'OSSL_CORE_MAKE_FUNC' in their names. * * An array of these is always terminated by function_id == 0 */ struct ossl_dispatch_st { int function_id; void (*function)(void); }; # define OSSL_DISPATCH_END \ { 0, NULL } /* * Other items, essentially an int<->pointer map element. * * We make this type distinct from OSSL_DISPATCH to ensure that dispatch * tables remain tables with function pointers only. * * This is used whenever we need to pass things like a table of error reason * codes <-> reason string maps, ... * * Usage determines which field works as key if any, rather than field order. * * An array of these is always terminated by id == 0 && ptr == NULL */ struct ossl_item_st { unsigned int id; void *ptr; }; /* * Type to tie together algorithm names, property definition string and * the algorithm implementation in the form of a dispatch table. * * An array of these is always terminated by algorithm_names == NULL */ struct ossl_algorithm_st { const char *algorithm_names; /* key */ const char *property_definition; /* key */ const OSSL_DISPATCH *implementation; const char *algorithm_description; }; /* * Type to pass object data in a uniform way, without exposing the object * structure. * * An array of these is always terminated by key == NULL */ struct ossl_param_st { const char *key; /* the name of the parameter */ unsigned int data_type; /* declare what kind of content is in buffer */ void *data; /* value being passed in or out */ size_t data_size; /* data size */ size_t return_size; /* returned content size */ }; /* Currently supported OSSL_PARAM data types */ /* * OSSL_PARAM_INTEGER and OSSL_PARAM_UNSIGNED_INTEGER * are arbitrary length and therefore require an arbitrarily sized buffer, * since they may be used to pass numbers larger than what is natively * available. * * The number must be buffered in native form, i.e. MSB first on B_ENDIAN * systems and LSB first on L_ENDIAN systems. This means that arbitrary * native integers can be stored in the buffer, just make sure that the * buffer size is correct and the buffer itself is properly aligned (for * example by having the buffer field point at a C integer). */ # define OSSL_PARAM_INTEGER 1 # define OSSL_PARAM_UNSIGNED_INTEGER 2 /*- * OSSL_PARAM_REAL * is a C binary floating point values in native form and alignment. */ # define OSSL_PARAM_REAL 3 /*- * OSSL_PARAM_UTF8_STRING * is a printable string. It is expected to be printed as it is. */ # define OSSL_PARAM_UTF8_STRING 4 /*- * OSSL_PARAM_OCTET_STRING * is a string of bytes with no further specification. It is expected to be * printed as a hexdump. */ # define OSSL_PARAM_OCTET_STRING 5 /*- * OSSL_PARAM_UTF8_PTR * is a pointer to a printable string. It is expected to be printed as it is. * * The difference between this and OSSL_PARAM_UTF8_STRING is that only pointers * are manipulated for this type. * * This is more relevant for parameter requests, where the responding * function doesn't need to copy the data to the provided buffer, but * sets the provided buffer to point at the actual data instead. * * WARNING! Using these is FRAGILE, as it assumes that the actual * data and its location are constant. * * EXTRA WARNING! If you are not completely sure you most likely want * to use the OSSL_PARAM_UTF8_STRING type. */ # define OSSL_PARAM_UTF8_PTR 6 /*- * OSSL_PARAM_OCTET_PTR * is a pointer to a string of bytes with no further specification. It is * expected to be printed as a hexdump. * * The difference between this and OSSL_PARAM_OCTET_STRING is that only pointers * are manipulated for this type. * * This is more relevant for parameter requests, where the responding * function doesn't need to copy the data to the provided buffer, but * sets the provided buffer to point at the actual data instead. * * WARNING! Using these is FRAGILE, as it assumes that the actual * data and its location are constant. * * EXTRA WARNING! If you are not completely sure you most likely want * to use the OSSL_PARAM_OCTET_STRING type. */ # define OSSL_PARAM_OCTET_PTR 7 /* * Typedef for the thread stop handling callback. Used both internally and by * providers. * * Providers may register for notifications about threads stopping by * registering a callback to hear about such events. Providers register the * callback using the OSSL_FUNC_CORE_THREAD_START function in the |in| dispatch * table passed to OSSL_provider_init(). The arg passed back to a provider will * be the provider side context object. */ typedef void (*OSSL_thread_stop_handler_fn)(void *arg); /*- * Provider entry point * -------------------- * * This function is expected to be present in any dynamically loadable * provider module. By definition, if this function doesn't exist in a * module, that module is not an OpenSSL provider module. */ /*- * |handle| pointer to opaque type OSSL_CORE_HANDLE. This can be used * together with some functions passed via |in| to query data. * |in| is the array of functions that the Core passes to the provider. * |out| will be the array of base functions that the provider passes * back to the Core. * |provctx| a provider side context object, optionally created if the * provider needs it. This value is passed to other provider * functions, notably other context constructors. */ typedef int (OSSL_provider_init_fn)(const OSSL_CORE_HANDLE *handle, const OSSL_DISPATCH *in, const OSSL_DISPATCH **out, void **provctx); # ifdef __VMS # pragma names save # pragma names uppercase,truncated # endif OPENSSL_EXPORT OSSL_provider_init_fn OSSL_provider_init; # ifdef __VMS # pragma names restore # endif /* * Generic callback function signature. * * The expectation is that any provider function that wants to offer * a callback / hook can do so by taking an argument with this type, * as well as a pointer to caller-specific data. When calling the * callback, the provider function can populate an OSSL_PARAM array * with data of its choice and pass that in the callback call, along * with the caller data argument. * * libcrypto may use the OSSL_PARAM array to create arguments for an * application callback it knows about. */ typedef int (OSSL_CALLBACK)(const OSSL_PARAM params[], void *arg); typedef int (OSSL_INOUT_CALLBACK)(const OSSL_PARAM in_params[], OSSL_PARAM out_params[], void *arg); /* * Passphrase callback function signature * * This is similar to the generic callback function above, but adds a * result parameter. */ typedef int (OSSL_PASSPHRASE_CALLBACK)(char *pass, size_t pass_size, size_t *pass_len, const OSSL_PARAM params[], void *arg); # ifdef __cplusplus } # endif #endif
8,177
33.506329
80
h
openssl
openssl-master/include/openssl/core_object.h
/* * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_CORE_OBJECT_H # define OPENSSL_CORE_OBJECT_H # pragma once # ifdef __cplusplus extern "C" { # endif /*- * Known object types * * These numbers are used as values for the OSSL_PARAM parameter * OSSL_OBJECT_PARAM_TYPE. * * For most of these types, there's a corresponding libcrypto object type. * The corresponding type is indicated with a comment after the number. */ # define OSSL_OBJECT_UNKNOWN 0 # define OSSL_OBJECT_NAME 1 /* char * */ # define OSSL_OBJECT_PKEY 2 /* EVP_PKEY * */ # define OSSL_OBJECT_CERT 3 /* X509 * */ # define OSSL_OBJECT_CRL 4 /* X509_CRL * */ /* * The rest of the associated OSSL_PARAM elements is described in core_names.h */ # ifdef __cplusplus } # endif #endif
1,126
25.833333
78
h
openssl
openssl-master/include/openssl/crmferr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_CRMFERR_H # define OPENSSL_CRMFERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> # ifndef OPENSSL_NO_CRMF /* * CRMF reason codes. */ # define CRMF_R_BAD_PBM_ITERATIONCOUNT 100 # define CRMF_R_CRMFERROR 102 # define CRMF_R_ERROR 103 # define CRMF_R_ERROR_DECODING_CERTIFICATE 104 # define CRMF_R_ERROR_DECRYPTING_CERTIFICATE 105 # define CRMF_R_ERROR_DECRYPTING_SYMMETRIC_KEY 106 # define CRMF_R_FAILURE_OBTAINING_RANDOM 107 # define CRMF_R_ITERATIONCOUNT_BELOW_100 108 # define CRMF_R_MALFORMED_IV 101 # define CRMF_R_NULL_ARGUMENT 109 # define CRMF_R_POPOSKINPUT_NOT_SUPPORTED 113 # define CRMF_R_POPO_INCONSISTENT_PUBLIC_KEY 117 # define CRMF_R_POPO_MISSING 121 # define CRMF_R_POPO_MISSING_PUBLIC_KEY 118 # define CRMF_R_POPO_MISSING_SUBJECT 119 # define CRMF_R_POPO_RAVERIFIED_NOT_ACCEPTED 120 # define CRMF_R_SETTING_MAC_ALGOR_FAILURE 110 # define CRMF_R_SETTING_OWF_ALGOR_FAILURE 111 # define CRMF_R_UNSUPPORTED_ALGORITHM 112 # define CRMF_R_UNSUPPORTED_CIPHER 114 # define CRMF_R_UNSUPPORTED_METHOD_FOR_CREATING_POPO 115 # define CRMF_R_UNSUPPORTED_POPO_METHOD 116 # endif #endif
2,011
38.45098
74
h
openssl
openssl-master/include/openssl/cryptoerr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_CRYPTOERR_H # define OPENSSL_CRYPTOERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> /* * CRYPTO reason codes. */ # define CRYPTO_R_BAD_ALGORITHM_NAME 117 # define CRYPTO_R_CONFLICTING_NAMES 118 # define CRYPTO_R_HEX_STRING_TOO_SHORT 121 # define CRYPTO_R_ILLEGAL_HEX_DIGIT 102 # define CRYPTO_R_INSUFFICIENT_DATA_SPACE 106 # define CRYPTO_R_INSUFFICIENT_PARAM_SIZE 107 # define CRYPTO_R_INSUFFICIENT_SECURE_DATA_SPACE 108 # define CRYPTO_R_INTEGER_OVERFLOW 127 # define CRYPTO_R_INVALID_NEGATIVE_VALUE 122 # define CRYPTO_R_INVALID_NULL_ARGUMENT 109 # define CRYPTO_R_INVALID_OSSL_PARAM_TYPE 110 # define CRYPTO_R_NO_PARAMS_TO_MERGE 131 # define CRYPTO_R_NO_SPACE_FOR_TERMINATING_NULL 128 # define CRYPTO_R_ODD_NUMBER_OF_DIGITS 103 # define CRYPTO_R_PARAM_CANNOT_BE_REPRESENTED_EXACTLY 123 # define CRYPTO_R_PARAM_NOT_INTEGER_TYPE 124 # define CRYPTO_R_PARAM_OF_INCOMPATIBLE_TYPE 129 # define CRYPTO_R_PARAM_UNSIGNED_INTEGER_NEGATIVE_VALUE_UNSUPPORTED 125 # define CRYPTO_R_PARAM_UNSUPPORTED_FLOATING_POINT_FORMAT 130 # define CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION 126 # define CRYPTO_R_PROVIDER_ALREADY_EXISTS 104 # define CRYPTO_R_PROVIDER_SECTION_ERROR 105 # define CRYPTO_R_RANDOM_SECTION_ERROR 119 # define CRYPTO_R_SECURE_MALLOC_FAILURE 111 # define CRYPTO_R_STRING_TOO_LONG 112 # define CRYPTO_R_TOO_MANY_BYTES 113 # define CRYPTO_R_TOO_MANY_RECORDS 114 # define CRYPTO_R_TOO_SMALL_BUFFER 116 # define CRYPTO_R_UNKNOWN_NAME_IN_RANDOM_SECTION 120 # define CRYPTO_R_ZERO_LENGTH_NUMBER 115 #endif
2,467
43.071429
74
h
openssl
openssl-master/include/openssl/cterr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_CTERR_H # define OPENSSL_CTERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> # ifndef OPENSSL_NO_CT /* * CT reason codes. */ # define CT_R_BASE64_DECODE_ERROR 108 # define CT_R_INVALID_LOG_ID_LENGTH 100 # define CT_R_LOG_CONF_INVALID 109 # define CT_R_LOG_CONF_INVALID_KEY 110 # define CT_R_LOG_CONF_MISSING_DESCRIPTION 111 # define CT_R_LOG_CONF_MISSING_KEY 112 # define CT_R_LOG_KEY_INVALID 113 # define CT_R_SCT_FUTURE_TIMESTAMP 116 # define CT_R_SCT_INVALID 104 # define CT_R_SCT_INVALID_SIGNATURE 107 # define CT_R_SCT_LIST_INVALID 105 # define CT_R_SCT_LOG_ID_MISMATCH 114 # define CT_R_SCT_NOT_SET 106 # define CT_R_SCT_UNSUPPORTED_VERSION 115 # define CT_R_UNRECOGNIZED_SIGNATURE_NID 101 # define CT_R_UNSUPPORTED_ENTRY_TYPE 102 # define CT_R_UNSUPPORTED_VERSION 103 # endif #endif
1,688
35.717391
74
h
openssl
openssl-master/include/openssl/decoder.h
/* * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_DECODER_H # define OPENSSL_DECODER_H # pragma once # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_STDIO # include <stdio.h> # endif # include <stdarg.h> # include <stddef.h> # include <openssl/decodererr.h> # include <openssl/types.h> # include <openssl/core.h> # ifdef __cplusplus extern "C" { # endif OSSL_DECODER *OSSL_DECODER_fetch(OSSL_LIB_CTX *libctx, const char *name, const char *properties); int OSSL_DECODER_up_ref(OSSL_DECODER *encoder); void OSSL_DECODER_free(OSSL_DECODER *encoder); const OSSL_PROVIDER *OSSL_DECODER_get0_provider(const OSSL_DECODER *encoder); const char *OSSL_DECODER_get0_properties(const OSSL_DECODER *encoder); const char *OSSL_DECODER_get0_name(const OSSL_DECODER *decoder); const char *OSSL_DECODER_get0_description(const OSSL_DECODER *decoder); int OSSL_DECODER_is_a(const OSSL_DECODER *encoder, const char *name); void OSSL_DECODER_do_all_provided(OSSL_LIB_CTX *libctx, void (*fn)(OSSL_DECODER *encoder, void *arg), void *arg); int OSSL_DECODER_names_do_all(const OSSL_DECODER *encoder, void (*fn)(const char *name, void *data), void *data); const OSSL_PARAM *OSSL_DECODER_gettable_params(OSSL_DECODER *decoder); int OSSL_DECODER_get_params(OSSL_DECODER *decoder, OSSL_PARAM params[]); const OSSL_PARAM *OSSL_DECODER_settable_ctx_params(OSSL_DECODER *encoder); OSSL_DECODER_CTX *OSSL_DECODER_CTX_new(void); int OSSL_DECODER_CTX_set_params(OSSL_DECODER_CTX *ctx, const OSSL_PARAM params[]); void OSSL_DECODER_CTX_free(OSSL_DECODER_CTX *ctx); /* Utilities that help set specific parameters */ int OSSL_DECODER_CTX_set_passphrase(OSSL_DECODER_CTX *ctx, const unsigned char *kstr, size_t klen); int OSSL_DECODER_CTX_set_pem_password_cb(OSSL_DECODER_CTX *ctx, pem_password_cb *cb, void *cbarg); int OSSL_DECODER_CTX_set_passphrase_cb(OSSL_DECODER_CTX *ctx, OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg); int OSSL_DECODER_CTX_set_passphrase_ui(OSSL_DECODER_CTX *ctx, const UI_METHOD *ui_method, void *ui_data); /* * Utilities to read the object to decode, with the result sent to cb. * These will discover all provided methods */ int OSSL_DECODER_CTX_set_selection(OSSL_DECODER_CTX *ctx, int selection); int OSSL_DECODER_CTX_set_input_type(OSSL_DECODER_CTX *ctx, const char *input_type); int OSSL_DECODER_CTX_set_input_structure(OSSL_DECODER_CTX *ctx, const char *input_structure); int OSSL_DECODER_CTX_add_decoder(OSSL_DECODER_CTX *ctx, OSSL_DECODER *decoder); int OSSL_DECODER_CTX_add_extra(OSSL_DECODER_CTX *ctx, OSSL_LIB_CTX *libctx, const char *propq); int OSSL_DECODER_CTX_get_num_decoders(OSSL_DECODER_CTX *ctx); typedef struct ossl_decoder_instance_st OSSL_DECODER_INSTANCE; OSSL_DECODER * OSSL_DECODER_INSTANCE_get_decoder(OSSL_DECODER_INSTANCE *decoder_inst); void * OSSL_DECODER_INSTANCE_get_decoder_ctx(OSSL_DECODER_INSTANCE *decoder_inst); const char * OSSL_DECODER_INSTANCE_get_input_type(OSSL_DECODER_INSTANCE *decoder_inst); const char * OSSL_DECODER_INSTANCE_get_input_structure(OSSL_DECODER_INSTANCE *decoder_inst, int *was_set); typedef int OSSL_DECODER_CONSTRUCT(OSSL_DECODER_INSTANCE *decoder_inst, const OSSL_PARAM *params, void *construct_data); typedef void OSSL_DECODER_CLEANUP(void *construct_data); int OSSL_DECODER_CTX_set_construct(OSSL_DECODER_CTX *ctx, OSSL_DECODER_CONSTRUCT *construct); int OSSL_DECODER_CTX_set_construct_data(OSSL_DECODER_CTX *ctx, void *construct_data); int OSSL_DECODER_CTX_set_cleanup(OSSL_DECODER_CTX *ctx, OSSL_DECODER_CLEANUP *cleanup); OSSL_DECODER_CONSTRUCT *OSSL_DECODER_CTX_get_construct(OSSL_DECODER_CTX *ctx); void *OSSL_DECODER_CTX_get_construct_data(OSSL_DECODER_CTX *ctx); OSSL_DECODER_CLEANUP *OSSL_DECODER_CTX_get_cleanup(OSSL_DECODER_CTX *ctx); int OSSL_DECODER_export(OSSL_DECODER_INSTANCE *decoder_inst, void *reference, size_t reference_sz, OSSL_CALLBACK *export_cb, void *export_cbarg); int OSSL_DECODER_from_bio(OSSL_DECODER_CTX *ctx, BIO *in); #ifndef OPENSSL_NO_STDIO int OSSL_DECODER_from_fp(OSSL_DECODER_CTX *ctx, FILE *in); #endif int OSSL_DECODER_from_data(OSSL_DECODER_CTX *ctx, const unsigned char **pdata, size_t *pdata_len); /* * Create the OSSL_DECODER_CTX with an associated type. This will perform * an implicit OSSL_DECODER_fetch(), suitable for the object of that type. */ OSSL_DECODER_CTX * OSSL_DECODER_CTX_new_for_pkey(EVP_PKEY **pkey, const char *input_type, const char *input_struct, const char *keytype, int selection, OSSL_LIB_CTX *libctx, const char *propquery); # ifdef __cplusplus } # endif #endif
5,760
41.992537
79
h
openssl
openssl-master/include/openssl/decodererr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_DECODERERR_H # define OPENSSL_DECODERERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> /* * OSSL_DECODER reason codes. */ # define OSSL_DECODER_R_COULD_NOT_DECODE_OBJECT 101 # define OSSL_DECODER_R_DECODER_NOT_FOUND 102 # define OSSL_DECODER_R_MISSING_GET_PARAMS 100 #endif
791
26.310345
74
h
openssl
openssl-master/include/openssl/des.h
/* * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_DES_H # define OPENSSL_DES_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_DES_H # endif # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_DES # ifdef __cplusplus extern "C" { # endif # include <openssl/e_os2.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 typedef unsigned int DES_LONG; # ifdef OPENSSL_BUILD_SHLIBCRYPTO # undef OPENSSL_EXTERN # define OPENSSL_EXTERN OPENSSL_EXPORT # endif typedef unsigned char DES_cblock[8]; typedef /* const */ unsigned char const_DES_cblock[8]; /* * With "const", gcc 2.8.1 on Solaris thinks that DES_cblock * and * const_DES_cblock * are incompatible pointer types. */ typedef struct DES_ks { union { DES_cblock cblock; /* * make sure things are correct size on machines with 8 byte longs */ DES_LONG deslong[2]; } ks[16]; } DES_key_schedule; # define DES_KEY_SZ (sizeof(DES_cblock)) # define DES_SCHEDULE_SZ (sizeof(DES_key_schedule)) # define DES_ENCRYPT 1 # define DES_DECRYPT 0 # define DES_CBC_MODE 0 # define DES_PCBC_MODE 1 # define DES_ecb2_encrypt(i,o,k1,k2,e) \ DES_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) # define DES_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ DES_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) # define DES_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ DES_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) # define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ DES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) # define DES_fixup_key_parity DES_set_odd_parity # endif # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 const char *DES_options(void); OSSL_DEPRECATEDIN_3_0 void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, int enc); OSSL_DEPRECATEDIN_3_0 DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output, long length, DES_key_schedule *schedule, const_DES_cblock *ivec); # endif /* DES_cbc_encrypt does not update the IV! Use DES_ncbc_encrypt instead. */ # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 void DES_cbc_encrypt(const unsigned char *input, unsigned char *output, long length, DES_key_schedule *schedule, DES_cblock *ivec, int enc); OSSL_DEPRECATEDIN_3_0 void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output, long length, DES_key_schedule *schedule, DES_cblock *ivec, int enc); OSSL_DEPRECATEDIN_3_0 void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output, long length, DES_key_schedule *schedule, DES_cblock *ivec, const_DES_cblock *inw, const_DES_cblock *outw, int enc); OSSL_DEPRECATEDIN_3_0 void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, long length, DES_key_schedule *schedule, DES_cblock *ivec, int enc); OSSL_DEPRECATEDIN_3_0 void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, DES_key_schedule *ks, int enc); # endif /* * This is the DES encryption function that gets called by just about every * other DES routine in the library. You should not use this function except * to implement 'modes' of DES. I say this because the functions that call * this routine do the conversion from 'char *' to long, and this needs to be * done to make sure 'non-aligned' memory access do not occur. The * characters are loaded 'little endian'. Data is a pointer to 2 unsigned * long's and ks is the DES_key_schedule to use. enc, is non zero specifies * encryption, zero if decryption. */ # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc); # endif /* * This functions is the same as DES_encrypt1() except that the DES initial * permutation (IP) and final permutation (FP) have been left out. As for * DES_encrypt1(), you should not use this function. It is used by the * routines in the library that implement triple DES. IP() DES_encrypt2() * DES_encrypt2() DES_encrypt2() FP() is the same as DES_encrypt1() * DES_encrypt1() DES_encrypt1() except faster :-). */ # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc); OSSL_DEPRECATEDIN_3_0 void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3); OSSL_DEPRECATEDIN_3_0 void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3); OSSL_DEPRECATEDIN_3_0 void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, long length, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, DES_cblock *ivec, int enc); OSSL_DEPRECATEDIN_3_0 void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, DES_cblock *ivec, int *num, int enc); OSSL_DEPRECATEDIN_3_0 void DES_ede3_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, long length, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, DES_cblock *ivec, int enc); OSSL_DEPRECATEDIN_3_0 void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, DES_cblock *ivec, int *num); OSSL_DEPRECATEDIN_3_0 char *DES_fcrypt(const char *buf, const char *salt, char *ret); OSSL_DEPRECATEDIN_3_0 char *DES_crypt(const char *buf, const char *salt); OSSL_DEPRECATEDIN_3_0 void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits, long length, DES_key_schedule *schedule, DES_cblock *ivec); OSSL_DEPRECATEDIN_3_0 void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output, long length, DES_key_schedule *schedule, DES_cblock *ivec, int enc); OSSL_DEPRECATEDIN_3_0 DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[], long length, int out_count, DES_cblock *seed); OSSL_DEPRECATEDIN_3_0 int DES_random_key(DES_cblock *ret); OSSL_DEPRECATEDIN_3_0 void DES_set_odd_parity(DES_cblock *key); OSSL_DEPRECATEDIN_3_0 int DES_check_key_parity(const_DES_cblock *key); OSSL_DEPRECATEDIN_3_0 int DES_is_weak_key(const_DES_cblock *key); # endif /* * DES_set_key (= set_key = DES_key_sched = key_sched) calls * DES_set_key_checked */ # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule); OSSL_DEPRECATEDIN_3_0 int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule); OSSL_DEPRECATEDIN_3_0 int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule); OSSL_DEPRECATEDIN_3_0 void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule); OSSL_DEPRECATEDIN_3_0 void DES_string_to_key(const char *str, DES_cblock *key); OSSL_DEPRECATEDIN_3_0 void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2); OSSL_DEPRECATEDIN_3_0 void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, DES_key_schedule *schedule, DES_cblock *ivec, int *num, int enc); OSSL_DEPRECATEDIN_3_0 void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, DES_key_schedule *schedule, DES_cblock *ivec, int *num); # endif # ifdef __cplusplus } # endif # endif #endif
8,525
39.216981
80
h
openssl
openssl-master/include/openssl/dh.h
/* * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_DH_H # define OPENSSL_DH_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_DH_H # endif # include <openssl/opensslconf.h> # include <openssl/types.h> # ifdef __cplusplus extern "C" { # endif #include <stdlib.h> /* DH parameter generation types used by EVP_PKEY_CTX_set_dh_paramgen_type() */ # define DH_PARAMGEN_TYPE_GENERATOR 0 /* Use a safe prime generator */ # define DH_PARAMGEN_TYPE_FIPS_186_2 1 /* Use FIPS186-2 standard */ # define DH_PARAMGEN_TYPE_FIPS_186_4 2 /* Use FIPS186-4 standard */ # define DH_PARAMGEN_TYPE_GROUP 3 /* Use a named safe prime group */ int EVP_PKEY_CTX_set_dh_paramgen_type(EVP_PKEY_CTX *ctx, int typ); int EVP_PKEY_CTX_set_dh_paramgen_gindex(EVP_PKEY_CTX *ctx, int gindex); int EVP_PKEY_CTX_set_dh_paramgen_seed(EVP_PKEY_CTX *ctx, const unsigned char *seed, size_t seedlen); int EVP_PKEY_CTX_set_dh_paramgen_prime_len(EVP_PKEY_CTX *ctx, int pbits); int EVP_PKEY_CTX_set_dh_paramgen_subprime_len(EVP_PKEY_CTX *ctx, int qlen); int EVP_PKEY_CTX_set_dh_paramgen_generator(EVP_PKEY_CTX *ctx, int gen); int EVP_PKEY_CTX_set_dh_nid(EVP_PKEY_CTX *ctx, int nid); int EVP_PKEY_CTX_set_dh_rfc5114(EVP_PKEY_CTX *ctx, int gen); int EVP_PKEY_CTX_set_dhx_rfc5114(EVP_PKEY_CTX *ctx, int gen); int EVP_PKEY_CTX_set_dh_pad(EVP_PKEY_CTX *ctx, int pad); int EVP_PKEY_CTX_set_dh_kdf_type(EVP_PKEY_CTX *ctx, int kdf); int EVP_PKEY_CTX_get_dh_kdf_type(EVP_PKEY_CTX *ctx); int EVP_PKEY_CTX_set0_dh_kdf_oid(EVP_PKEY_CTX *ctx, ASN1_OBJECT *oid); int EVP_PKEY_CTX_get0_dh_kdf_oid(EVP_PKEY_CTX *ctx, ASN1_OBJECT **oid); int EVP_PKEY_CTX_set_dh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD *md); int EVP_PKEY_CTX_get_dh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD **md); int EVP_PKEY_CTX_set_dh_kdf_outlen(EVP_PKEY_CTX *ctx, int len); int EVP_PKEY_CTX_get_dh_kdf_outlen(EVP_PKEY_CTX *ctx, int *len); int EVP_PKEY_CTX_set0_dh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char *ukm, int len); # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 int EVP_PKEY_CTX_get0_dh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char **ukm); #endif # define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN (EVP_PKEY_ALG_CTRL + 1) # define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR (EVP_PKEY_ALG_CTRL + 2) # define EVP_PKEY_CTRL_DH_RFC5114 (EVP_PKEY_ALG_CTRL + 3) # define EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN (EVP_PKEY_ALG_CTRL + 4) # define EVP_PKEY_CTRL_DH_PARAMGEN_TYPE (EVP_PKEY_ALG_CTRL + 5) # define EVP_PKEY_CTRL_DH_KDF_TYPE (EVP_PKEY_ALG_CTRL + 6) # define EVP_PKEY_CTRL_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 7) # define EVP_PKEY_CTRL_GET_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 8) # define EVP_PKEY_CTRL_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 9) # define EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 10) # define EVP_PKEY_CTRL_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 11) # define EVP_PKEY_CTRL_GET_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 12) # define EVP_PKEY_CTRL_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 13) # define EVP_PKEY_CTRL_GET_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 14) # define EVP_PKEY_CTRL_DH_NID (EVP_PKEY_ALG_CTRL + 15) # define EVP_PKEY_CTRL_DH_PAD (EVP_PKEY_ALG_CTRL + 16) /* KDF types */ # define EVP_PKEY_DH_KDF_NONE 1 # define EVP_PKEY_DH_KDF_X9_42 2 # ifndef OPENSSL_NO_STDIO # include <stdio.h> # endif # ifndef OPENSSL_NO_DH # include <openssl/e_os2.h> # include <openssl/bio.h> # include <openssl/asn1.h> # ifndef OPENSSL_NO_DEPRECATED_1_1_0 # include <openssl/bn.h> # endif # include <openssl/dherr.h> # ifndef OPENSSL_DH_MAX_MODULUS_BITS # define OPENSSL_DH_MAX_MODULUS_BITS 10000 # endif # define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024 # define DH_FLAG_CACHE_MONT_P 0x01 # define DH_FLAG_TYPE_MASK 0xF000 # define DH_FLAG_TYPE_DH 0x0000 # define DH_FLAG_TYPE_DHX 0x1000 # ifndef OPENSSL_NO_DEPRECATED_1_1_0 /* * Does nothing. Previously this switched off constant time behaviour. */ # define DH_FLAG_NO_EXP_CONSTTIME 0x00 # endif # ifndef OPENSSL_NO_DEPRECATED_3_0 /* * If this flag is set the DH method is FIPS compliant and can be used in * FIPS mode. This is set in the validated module method. If an application * sets this flag in its own methods it is its responsibility to ensure the * result is compliant. */ # define DH_FLAG_FIPS_METHOD 0x0400 /* * If this flag is set the operations normally disabled in FIPS mode are * permitted it is then the applications responsibility to ensure that the * usage is compliant. */ # define DH_FLAG_NON_FIPS_ALLOW 0x0400 # endif /* Already defined in ossl_typ.h */ /* typedef struct dh_st DH; */ /* typedef struct dh_method DH_METHOD; */ DECLARE_ASN1_ITEM(DHparams) # ifndef OPENSSL_NO_DEPRECATED_3_0 # define DH_GENERATOR_2 2 # define DH_GENERATOR_3 3 # define DH_GENERATOR_5 5 /* DH_check error codes */ /* * NB: These values must align with the equivalently named macros in * internal/ffc.h. */ # define DH_CHECK_P_NOT_PRIME 0x01 # define DH_CHECK_P_NOT_SAFE_PRIME 0x02 # define DH_UNABLE_TO_CHECK_GENERATOR 0x04 # define DH_NOT_SUITABLE_GENERATOR 0x08 # define DH_CHECK_Q_NOT_PRIME 0x10 # define DH_CHECK_INVALID_Q_VALUE 0x20 # define DH_CHECK_INVALID_J_VALUE 0x40 # define DH_MODULUS_TOO_SMALL 0x80 # define DH_MODULUS_TOO_LARGE 0x100 /* DH_check_pub_key error codes */ # define DH_CHECK_PUBKEY_TOO_SMALL 0x01 # define DH_CHECK_PUBKEY_TOO_LARGE 0x02 # define DH_CHECK_PUBKEY_INVALID 0x04 /* * primes p where (p-1)/2 is prime too are called "safe"; we define this for * backward compatibility: */ # define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME # define d2i_DHparams_fp(fp, x) \ (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ (char *(*)())d2i_DHparams, \ (fp), \ (unsigned char **)(x)) # define i2d_DHparams_fp(fp, x) \ ASN1_i2d_fp(i2d_DHparams,(fp), (unsigned char *)(x)) # define d2i_DHparams_bio(bp, x) \ ASN1_d2i_bio_of(DH, DH_new, d2i_DHparams, bp, x) # define i2d_DHparams_bio(bp, x) \ ASN1_i2d_bio_of(DH, i2d_DHparams, bp, x) # define d2i_DHxparams_fp(fp,x) \ (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ (char *(*)())d2i_DHxparams, \ (fp), \ (unsigned char **)(x)) # define i2d_DHxparams_fp(fp, x) \ ASN1_i2d_fp(i2d_DHxparams,(fp), (unsigned char *)(x)) # define d2i_DHxparams_bio(bp, x) \ ASN1_d2i_bio_of(DH, DH_new, d2i_DHxparams, bp, x) # define i2d_DHxparams_bio(bp, x) \ ASN1_i2d_bio_of(DH, i2d_DHxparams, bp, x) DECLARE_ASN1_DUP_FUNCTION_name_attr(OSSL_DEPRECATEDIN_3_0, DH, DHparams) OSSL_DEPRECATEDIN_3_0 const DH_METHOD *DH_OpenSSL(void); OSSL_DEPRECATEDIN_3_0 void DH_set_default_method(const DH_METHOD *meth); OSSL_DEPRECATEDIN_3_0 const DH_METHOD *DH_get_default_method(void); OSSL_DEPRECATEDIN_3_0 int DH_set_method(DH *dh, const DH_METHOD *meth); OSSL_DEPRECATEDIN_3_0 DH *DH_new_method(ENGINE *engine); OSSL_DEPRECATEDIN_3_0 DH *DH_new(void); OSSL_DEPRECATEDIN_3_0 void DH_free(DH *dh); OSSL_DEPRECATEDIN_3_0 int DH_up_ref(DH *dh); OSSL_DEPRECATEDIN_3_0 int DH_bits(const DH *dh); OSSL_DEPRECATEDIN_3_0 int DH_size(const DH *dh); OSSL_DEPRECATEDIN_3_0 int DH_security_bits(const DH *dh); # define DH_get_ex_new_index(l, p, newf, dupf, freef) \ CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DH, l, p, newf, dupf, freef) OSSL_DEPRECATEDIN_3_0 int DH_set_ex_data(DH *d, int idx, void *arg); OSSL_DEPRECATEDIN_3_0 void *DH_get_ex_data(const DH *d, int idx); OSSL_DEPRECATEDIN_3_0 int DH_generate_parameters_ex(DH *dh, int prime_len, int generator, BN_GENCB *cb); OSSL_DEPRECATEDIN_3_0 int DH_check_params_ex(const DH *dh); OSSL_DEPRECATEDIN_3_0 int DH_check_ex(const DH *dh); OSSL_DEPRECATEDIN_3_0 int DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key); OSSL_DEPRECATEDIN_3_0 int DH_check_params(const DH *dh, int *ret); OSSL_DEPRECATEDIN_3_0 int DH_check(const DH *dh, int *codes); OSSL_DEPRECATEDIN_3_0 int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *codes); OSSL_DEPRECATEDIN_3_0 int DH_generate_key(DH *dh); OSSL_DEPRECATEDIN_3_0 int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); OSSL_DEPRECATEDIN_3_0 int DH_compute_key_padded(unsigned char *key, const BIGNUM *pub_key, DH *dh); DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0, DH, DHparams) DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0, DH, DHxparams) # ifndef OPENSSL_NO_STDIO OSSL_DEPRECATEDIN_3_0 int DHparams_print_fp(FILE *fp, const DH *x); # endif OSSL_DEPRECATEDIN_3_0 int DHparams_print(BIO *bp, const DH *x); /* RFC 5114 parameters */ OSSL_DEPRECATEDIN_3_0 DH *DH_get_1024_160(void); OSSL_DEPRECATEDIN_3_0 DH *DH_get_2048_224(void); OSSL_DEPRECATEDIN_3_0 DH *DH_get_2048_256(void); /* Named parameters, currently RFC7919 and RFC3526 */ OSSL_DEPRECATEDIN_3_0 DH *DH_new_by_nid(int nid); OSSL_DEPRECATEDIN_3_0 int DH_get_nid(const DH *dh); /* RFC2631 KDF */ OSSL_DEPRECATEDIN_3_0 int DH_KDF_X9_42(unsigned char *out, size_t outlen, const unsigned char *Z, size_t Zlen, ASN1_OBJECT *key_oid, const unsigned char *ukm, size_t ukmlen, const EVP_MD *md); OSSL_DEPRECATEDIN_3_0 void DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); OSSL_DEPRECATEDIN_3_0 int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g); OSSL_DEPRECATEDIN_3_0 void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key); OSSL_DEPRECATEDIN_3_0 int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key); OSSL_DEPRECATEDIN_3_0 const BIGNUM *DH_get0_p(const DH *dh); OSSL_DEPRECATEDIN_3_0 const BIGNUM *DH_get0_q(const DH *dh); OSSL_DEPRECATEDIN_3_0 const BIGNUM *DH_get0_g(const DH *dh); OSSL_DEPRECATEDIN_3_0 const BIGNUM *DH_get0_priv_key(const DH *dh); OSSL_DEPRECATEDIN_3_0 const BIGNUM *DH_get0_pub_key(const DH *dh); OSSL_DEPRECATEDIN_3_0 void DH_clear_flags(DH *dh, int flags); OSSL_DEPRECATEDIN_3_0 int DH_test_flags(const DH *dh, int flags); OSSL_DEPRECATEDIN_3_0 void DH_set_flags(DH *dh, int flags); OSSL_DEPRECATEDIN_3_0 ENGINE *DH_get0_engine(DH *d); OSSL_DEPRECATEDIN_3_0 long DH_get_length(const DH *dh); OSSL_DEPRECATEDIN_3_0 int DH_set_length(DH *dh, long length); OSSL_DEPRECATEDIN_3_0 DH_METHOD *DH_meth_new(const char *name, int flags); OSSL_DEPRECATEDIN_3_0 void DH_meth_free(DH_METHOD *dhm); OSSL_DEPRECATEDIN_3_0 DH_METHOD *DH_meth_dup(const DH_METHOD *dhm); OSSL_DEPRECATEDIN_3_0 const char *DH_meth_get0_name(const DH_METHOD *dhm); OSSL_DEPRECATEDIN_3_0 int DH_meth_set1_name(DH_METHOD *dhm, const char *name); OSSL_DEPRECATEDIN_3_0 int DH_meth_get_flags(const DH_METHOD *dhm); OSSL_DEPRECATEDIN_3_0 int DH_meth_set_flags(DH_METHOD *dhm, int flags); OSSL_DEPRECATEDIN_3_0 void *DH_meth_get0_app_data(const DH_METHOD *dhm); OSSL_DEPRECATEDIN_3_0 int DH_meth_set0_app_data(DH_METHOD *dhm, void *app_data); OSSL_DEPRECATEDIN_3_0 int (*DH_meth_get_generate_key(const DH_METHOD *dhm)) (DH *); OSSL_DEPRECATEDIN_3_0 int DH_meth_set_generate_key(DH_METHOD *dhm, int (*generate_key) (DH *)); OSSL_DEPRECATEDIN_3_0 int (*DH_meth_get_compute_key(const DH_METHOD *dhm)) (unsigned char *key, const BIGNUM *pub_key, DH *dh); OSSL_DEPRECATEDIN_3_0 int DH_meth_set_compute_key(DH_METHOD *dhm, int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh)); OSSL_DEPRECATEDIN_3_0 int (*DH_meth_get_bn_mod_exp(const DH_METHOD *dhm)) (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *); OSSL_DEPRECATEDIN_3_0 int DH_meth_set_bn_mod_exp(DH_METHOD *dhm, int (*bn_mod_exp) (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *)); OSSL_DEPRECATEDIN_3_0 int (*DH_meth_get_init(const DH_METHOD *dhm))(DH *); OSSL_DEPRECATEDIN_3_0 int DH_meth_set_init(DH_METHOD *dhm, int (*init)(DH *)); OSSL_DEPRECATEDIN_3_0 int (*DH_meth_get_finish(const DH_METHOD *dhm)) (DH *); OSSL_DEPRECATEDIN_3_0 int DH_meth_set_finish(DH_METHOD *dhm, int (*finish) (DH *)); OSSL_DEPRECATEDIN_3_0 int (*DH_meth_get_generate_params(const DH_METHOD *dhm)) (DH *, int, int, BN_GENCB *); OSSL_DEPRECATEDIN_3_0 int DH_meth_set_generate_params(DH_METHOD *dhm, int (*generate_params) (DH *, int, int, BN_GENCB *)); # endif /* OPENSSL_NO_DEPRECATED_3_0 */ # ifndef OPENSSL_NO_DEPRECATED_0_9_8 OSSL_DEPRECATEDIN_0_9_8 DH *DH_generate_parameters(int prime_len, int generator, void (*callback) (int, int, void *), void *cb_arg); # endif # endif # ifdef __cplusplus } # endif #endif
15,151
44.638554
83
h
openssl
openssl-master/include/openssl/dherr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_DHERR_H # define OPENSSL_DHERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> # ifndef OPENSSL_NO_DH /* * DH reason codes. */ # define DH_R_BAD_FFC_PARAMETERS 127 # define DH_R_BAD_GENERATOR 101 # define DH_R_BN_DECODE_ERROR 109 # define DH_R_BN_ERROR 106 # define DH_R_CHECK_INVALID_J_VALUE 115 # define DH_R_CHECK_INVALID_Q_VALUE 116 # define DH_R_CHECK_PUBKEY_INVALID 122 # define DH_R_CHECK_PUBKEY_TOO_LARGE 123 # define DH_R_CHECK_PUBKEY_TOO_SMALL 124 # define DH_R_CHECK_P_NOT_PRIME 117 # define DH_R_CHECK_P_NOT_SAFE_PRIME 118 # define DH_R_CHECK_Q_NOT_PRIME 119 # define DH_R_DECODE_ERROR 104 # define DH_R_INVALID_PARAMETER_NAME 110 # define DH_R_INVALID_PARAMETER_NID 114 # define DH_R_INVALID_PUBKEY 102 # define DH_R_INVALID_SECRET 128 # define DH_R_INVALID_SIZE 129 # define DH_R_KDF_PARAMETER_ERROR 112 # define DH_R_KEYS_NOT_SET 108 # define DH_R_MISSING_PUBKEY 125 # define DH_R_MODULUS_TOO_LARGE 103 # define DH_R_MODULUS_TOO_SMALL 126 # define DH_R_NOT_SUITABLE_GENERATOR 120 # define DH_R_NO_PARAMETERS_SET 107 # define DH_R_NO_PRIVATE_VALUE 100 # define DH_R_PARAMETER_ENCODING_ERROR 105 # define DH_R_PEER_KEY_ERROR 111 # define DH_R_SHARED_INFO_ERROR 113 # define DH_R_UNABLE_TO_CHECK_GENERATOR 121 # endif #endif
2,507
41.508475
74
h
openssl
openssl-master/include/openssl/dsa.h
/* * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_DSA_H # define OPENSSL_DSA_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_DSA_H # endif # include <openssl/opensslconf.h> # include <openssl/types.h> # include <stdlib.h> # ifndef OPENSSL_NO_DSA # include <openssl/e_os2.h> # include <openssl/asn1.h> # include <openssl/bio.h> # include <openssl/crypto.h> # include <openssl/bn.h> # ifndef OPENSSL_NO_DEPRECATED_1_1_0 # include <openssl/dh.h> # endif # include <openssl/dsaerr.h> # ifndef OPENSSL_NO_STDIO # include <stdio.h> # endif # endif # ifdef __cplusplus extern "C" { # endif int EVP_PKEY_CTX_set_dsa_paramgen_bits(EVP_PKEY_CTX *ctx, int nbits); int EVP_PKEY_CTX_set_dsa_paramgen_q_bits(EVP_PKEY_CTX *ctx, int qbits); int EVP_PKEY_CTX_set_dsa_paramgen_md_props(EVP_PKEY_CTX *ctx, const char *md_name, const char *md_properties); int EVP_PKEY_CTX_set_dsa_paramgen_gindex(EVP_PKEY_CTX *ctx, int gindex); int EVP_PKEY_CTX_set_dsa_paramgen_type(EVP_PKEY_CTX *ctx, const char *name); int EVP_PKEY_CTX_set_dsa_paramgen_seed(EVP_PKEY_CTX *ctx, const unsigned char *seed, size_t seedlen); int EVP_PKEY_CTX_set_dsa_paramgen_md(EVP_PKEY_CTX *ctx, const EVP_MD *md); # define EVP_PKEY_CTRL_DSA_PARAMGEN_BITS (EVP_PKEY_ALG_CTRL + 1) # define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS (EVP_PKEY_ALG_CTRL + 2) # define EVP_PKEY_CTRL_DSA_PARAMGEN_MD (EVP_PKEY_ALG_CTRL + 3) # ifndef OPENSSL_NO_DSA # ifndef OPENSSL_DSA_MAX_MODULUS_BITS # define OPENSSL_DSA_MAX_MODULUS_BITS 10000 # endif # define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS 1024 typedef struct DSA_SIG_st DSA_SIG; DSA_SIG *DSA_SIG_new(void); void DSA_SIG_free(DSA_SIG *a); DECLARE_ASN1_ENCODE_FUNCTIONS_only(DSA_SIG, DSA_SIG) void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s); # ifndef OPENSSL_NO_DEPRECATED_1_1_0 /* * Does nothing. Previously this switched off constant time behaviour. */ # define DSA_FLAG_NO_EXP_CONSTTIME 0x00 # endif # ifndef OPENSSL_NO_DEPRECATED_3_0 # define DSA_FLAG_CACHE_MONT_P 0x01 /* * If this flag is set the DSA method is FIPS compliant and can be used in * FIPS mode. This is set in the validated module method. If an application * sets this flag in its own methods it is its responsibility to ensure the * result is compliant. */ # define DSA_FLAG_FIPS_METHOD 0x0400 /* * If this flag is set the operations normally disabled in FIPS mode are * permitted it is then the applications responsibility to ensure that the * usage is compliant. */ # define DSA_FLAG_NON_FIPS_ALLOW 0x0400 # define DSA_FLAG_FIPS_CHECKED 0x0800 /* Already defined in ossl_typ.h */ /* typedef struct dsa_st DSA; */ /* typedef struct dsa_method DSA_METHOD; */ # define d2i_DSAparams_fp(fp, x) \ (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ (char *(*)())d2i_DSAparams, (fp), \ (unsigned char **)(x)) # define i2d_DSAparams_fp(fp, x) \ ASN1_i2d_fp(i2d_DSAparams, (fp), (unsigned char *)(x)) # define d2i_DSAparams_bio(bp, x) \ ASN1_d2i_bio_of(DSA, DSA_new, d2i_DSAparams, bp, x) # define i2d_DSAparams_bio(bp, x) \ ASN1_i2d_bio_of(DSA, i2d_DSAparams, bp, x) DECLARE_ASN1_DUP_FUNCTION_name_attr(OSSL_DEPRECATEDIN_3_0, DSA, DSAparams) OSSL_DEPRECATEDIN_3_0 DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); OSSL_DEPRECATEDIN_3_0 int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, DSA *dsa); OSSL_DEPRECATEDIN_3_0 const DSA_METHOD *DSA_OpenSSL(void); OSSL_DEPRECATEDIN_3_0 void DSA_set_default_method(const DSA_METHOD *); OSSL_DEPRECATEDIN_3_0 const DSA_METHOD *DSA_get_default_method(void); OSSL_DEPRECATEDIN_3_0 int DSA_set_method(DSA *dsa, const DSA_METHOD *); OSSL_DEPRECATEDIN_3_0 const DSA_METHOD *DSA_get_method(DSA *d); OSSL_DEPRECATEDIN_3_0 DSA *DSA_new(void); OSSL_DEPRECATEDIN_3_0 DSA *DSA_new_method(ENGINE *engine); OSSL_DEPRECATEDIN_3_0 void DSA_free(DSA *r); /* "up" the DSA object's reference count */ OSSL_DEPRECATEDIN_3_0 int DSA_up_ref(DSA *r); OSSL_DEPRECATEDIN_3_0 int DSA_size(const DSA *); OSSL_DEPRECATEDIN_3_0 int DSA_bits(const DSA *d); OSSL_DEPRECATEDIN_3_0 int DSA_security_bits(const DSA *d); /* next 4 return -1 on error */ OSSL_DEPRECATEDIN_3_0 int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp); OSSL_DEPRECATEDIN_3_0 int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig, unsigned int *siglen, DSA *dsa); OSSL_DEPRECATEDIN_3_0 int DSA_verify(int type, const unsigned char *dgst, int dgst_len, const unsigned char *sigbuf, int siglen, DSA *dsa); # define DSA_get_ex_new_index(l, p, newf, dupf, freef) \ CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DSA, l, p, newf, dupf, freef) OSSL_DEPRECATEDIN_3_0 int DSA_set_ex_data(DSA *d, int idx, void *arg); OSSL_DEPRECATEDIN_3_0 void *DSA_get_ex_data(const DSA *d, int idx); DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0, DSA, DSAPublicKey) DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0, DSA, DSAPrivateKey) DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0, DSA, DSAparams) # endif # ifndef OPENSSL_NO_DEPRECATED_0_9_8 /* Deprecated version */ OSSL_DEPRECATEDIN_0_9_8 DSA *DSA_generate_parameters(int bits, unsigned char *seed, int seed_len, int *counter_ret, unsigned long *h_ret, void (*callback) (int, int, void *), void *cb_arg); # endif # ifndef OPENSSL_NO_DEPRECATED_3_0 /* New version */ OSSL_DEPRECATEDIN_3_0 int DSA_generate_parameters_ex(DSA *dsa, int bits, const unsigned char *seed, int seed_len, int *counter_ret, unsigned long *h_ret, BN_GENCB *cb); OSSL_DEPRECATEDIN_3_0 int DSA_generate_key(DSA *a); OSSL_DEPRECATEDIN_3_0 int DSAparams_print(BIO *bp, const DSA *x); OSSL_DEPRECATEDIN_3_0 int DSA_print(BIO *bp, const DSA *x, int off); # ifndef OPENSSL_NO_STDIO OSSL_DEPRECATEDIN_3_0 int DSAparams_print_fp(FILE *fp, const DSA *x); OSSL_DEPRECATEDIN_3_0 int DSA_print_fp(FILE *bp, const DSA *x, int off); # endif # define DSS_prime_checks 64 /* * Primality test according to FIPS PUB 186-4, Appendix C.3. Since we only * have one value here we set the number of checks to 64 which is the 128 bit * security level that is the highest level and valid for creating a 3072 bit * DSA key. */ # define DSA_is_prime(n, callback, cb_arg) \ BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg) # ifndef OPENSSL_NO_DH /* * Convert DSA structure (key or just parameters) into DH structure (be * careful to avoid small subgroup attacks when using this!) */ OSSL_DEPRECATEDIN_3_0 DH *DSA_dup_DH(const DSA *r); # endif OSSL_DEPRECATEDIN_3_0 void DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); OSSL_DEPRECATEDIN_3_0 int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g); OSSL_DEPRECATEDIN_3_0 void DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key); OSSL_DEPRECATEDIN_3_0 int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key); OSSL_DEPRECATEDIN_3_0 const BIGNUM *DSA_get0_p(const DSA *d); OSSL_DEPRECATEDIN_3_0 const BIGNUM *DSA_get0_q(const DSA *d); OSSL_DEPRECATEDIN_3_0 const BIGNUM *DSA_get0_g(const DSA *d); OSSL_DEPRECATEDIN_3_0 const BIGNUM *DSA_get0_pub_key(const DSA *d); OSSL_DEPRECATEDIN_3_0 const BIGNUM *DSA_get0_priv_key(const DSA *d); OSSL_DEPRECATEDIN_3_0 void DSA_clear_flags(DSA *d, int flags); OSSL_DEPRECATEDIN_3_0 int DSA_test_flags(const DSA *d, int flags); OSSL_DEPRECATEDIN_3_0 void DSA_set_flags(DSA *d, int flags); OSSL_DEPRECATEDIN_3_0 ENGINE *DSA_get0_engine(DSA *d); OSSL_DEPRECATEDIN_3_0 DSA_METHOD *DSA_meth_new(const char *name, int flags); OSSL_DEPRECATEDIN_3_0 void DSA_meth_free(DSA_METHOD *dsam); OSSL_DEPRECATEDIN_3_0 DSA_METHOD *DSA_meth_dup(const DSA_METHOD *dsam); OSSL_DEPRECATEDIN_3_0 const char *DSA_meth_get0_name(const DSA_METHOD *dsam); OSSL_DEPRECATEDIN_3_0 int DSA_meth_set1_name(DSA_METHOD *dsam, const char *name); OSSL_DEPRECATEDIN_3_0 int DSA_meth_get_flags(const DSA_METHOD *dsam); OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_flags(DSA_METHOD *dsam, int flags); OSSL_DEPRECATEDIN_3_0 void *DSA_meth_get0_app_data(const DSA_METHOD *dsam); OSSL_DEPRECATEDIN_3_0 int DSA_meth_set0_app_data(DSA_METHOD *dsam, void *app_data); OSSL_DEPRECATEDIN_3_0 DSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam)) (const unsigned char *, int, DSA *); OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_sign(DSA_METHOD *dsam, DSA_SIG *(*sign) (const unsigned char *, int, DSA *)); OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam)) (DSA *, BN_CTX *, BIGNUM **, BIGNUM **); OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_sign_setup(DSA_METHOD *dsam, int (*sign_setup) (DSA *, BN_CTX *, BIGNUM **, BIGNUM **)); OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_verify(const DSA_METHOD *dsam)) (const unsigned char *, int, DSA_SIG *, DSA *); OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_verify(DSA_METHOD *dsam, int (*verify) (const unsigned char *, int, DSA_SIG *, DSA *)); OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam)) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *); OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_mod_exp(DSA_METHOD *dsam, int (*mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *)); OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam)) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *); OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam, int (*bn_mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *)); OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *); OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_init(DSA_METHOD *dsam, int (*init)(DSA *)); OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_finish(const DSA_METHOD *dsam))(DSA *); OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_finish(DSA_METHOD *dsam, int (*finish)(DSA *)); OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_paramgen(const DSA_METHOD *dsam)) (DSA *, int, const unsigned char *, int, int *, unsigned long *, BN_GENCB *); OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_paramgen(DSA_METHOD *dsam, int (*paramgen) (DSA *, int, const unsigned char *, int, int *, unsigned long *, BN_GENCB *)); OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_keygen(const DSA_METHOD *dsam))(DSA *); OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_keygen(DSA_METHOD *dsam, int (*keygen) (DSA *)); # endif # endif # ifdef __cplusplus } # endif #endif
12,532
43.601423
80
h
openssl
openssl-master/include/openssl/dsaerr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_DSAERR_H # define OPENSSL_DSAERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> # ifndef OPENSSL_NO_DSA /* * DSA reason codes. */ # define DSA_R_BAD_FFC_PARAMETERS 114 # define DSA_R_BAD_Q_VALUE 102 # define DSA_R_BN_DECODE_ERROR 108 # define DSA_R_BN_ERROR 109 # define DSA_R_DECODE_ERROR 104 # define DSA_R_INVALID_DIGEST_TYPE 106 # define DSA_R_INVALID_PARAMETERS 112 # define DSA_R_MISSING_PARAMETERS 101 # define DSA_R_MISSING_PRIVATE_KEY 111 # define DSA_R_MODULUS_TOO_LARGE 103 # define DSA_R_NO_PARAMETERS_SET 107 # define DSA_R_PARAMETER_ENCODING_ERROR 105 # define DSA_R_P_NOT_PRIME 115 # define DSA_R_Q_NOT_PRIME 113 # define DSA_R_SEED_LEN_SMALL 110 # define DSA_R_TOO_MANY_RETRIES 116 # endif #endif
1,629
35.222222
74
h
openssl
openssl-master/include/openssl/dtls1.h
/* * Copyright 2005-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_DTLS1_H # define OPENSSL_DTLS1_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_DTLS1_H # endif # include <openssl/prov_ssl.h> #ifdef __cplusplus extern "C" { #endif #include <openssl/opensslconf.h> /* DTLS*_VERSION constants are defined in prov_ssl.h */ # ifndef OPENSSL_NO_DEPRECATED_3_0 # define DTLS_MIN_VERSION DTLS1_VERSION # define DTLS_MAX_VERSION DTLS1_2_VERSION # endif # define DTLS1_VERSION_MAJOR 0xFE /* Special value for method supporting multiple versions */ # define DTLS_ANY_VERSION 0x1FFFF /* lengths of messages */ # define DTLS1_COOKIE_LENGTH 255 # define DTLS1_RT_HEADER_LENGTH 13 # define DTLS1_HM_HEADER_LENGTH 12 # define DTLS1_HM_BAD_FRAGMENT -2 # define DTLS1_HM_FRAGMENT_RETRY -3 # define DTLS1_CCS_HEADER_LENGTH 1 # define DTLS1_AL_HEADER_LENGTH 2 # define DTLS1_TMO_ALERT_COUNT 12 #ifdef __cplusplus } #endif #endif
1,465
24.275862
74
h
openssl
openssl-master/include/openssl/e_os2.h
/* * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_E_OS2_H # define OPENSSL_E_OS2_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_E_OS2_H # endif # include <openssl/opensslconf.h> #ifdef __cplusplus extern "C" { #endif /****************************************************************************** * Detect operating systems. This probably needs completing. * The result is that at least one OPENSSL_SYS_os macro should be defined. * However, if none is defined, Unix is assumed. **/ # define OPENSSL_SYS_UNIX /* --------------------- Microsoft operating systems ---------------------- */ /* * Note that MSDOS actually denotes 32-bit environments running on top of * MS-DOS, such as DJGPP one. */ # if defined(OPENSSL_SYS_MSDOS) # undef OPENSSL_SYS_UNIX # endif /* * For 32 bit environment, there seems to be the CygWin environment and then * all the others that try to do the same thing Microsoft does... */ /* * UEFI lives here because it might be built with a Microsoft toolchain and * we need to avoid the false positive match on Windows. */ # if defined(OPENSSL_SYS_UEFI) # undef OPENSSL_SYS_UNIX # elif defined(OPENSSL_SYS_UWIN) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_WIN32_UWIN # else # if defined(__CYGWIN__) || defined(OPENSSL_SYS_CYGWIN) # define OPENSSL_SYS_WIN32_CYGWIN # else # if defined(_WIN32) || defined(OPENSSL_SYS_WIN32) # undef OPENSSL_SYS_UNIX # if !defined(OPENSSL_SYS_WIN32) # define OPENSSL_SYS_WIN32 # endif # endif # if defined(_WIN64) || defined(OPENSSL_SYS_WIN64) # undef OPENSSL_SYS_UNIX # if !defined(OPENSSL_SYS_WIN64) # define OPENSSL_SYS_WIN64 # endif # endif # if defined(OPENSSL_SYS_WINNT) # undef OPENSSL_SYS_UNIX # endif # if defined(OPENSSL_SYS_WINCE) # undef OPENSSL_SYS_UNIX # endif # endif # endif /* Anything that tries to look like Microsoft is "Windows" */ # if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN64) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_WINDOWS # ifndef OPENSSL_SYS_MSDOS # define OPENSSL_SYS_MSDOS # endif # endif /* * DLL settings. This part is a bit tough, because it's up to the * application implementor how he or she will link the application, so it * requires some macro to be used. */ # ifdef OPENSSL_SYS_WINDOWS # ifndef OPENSSL_OPT_WINDLL # if defined(_WINDLL) /* This is used when building OpenSSL to * indicate that DLL linkage should be used */ # define OPENSSL_OPT_WINDLL # endif # endif # endif /* ------------------------------- OpenVMS -------------------------------- */ # if defined(__VMS) || defined(VMS) # if !defined(OPENSSL_SYS_VMS) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_VMS # endif # if defined(__DECC) # define OPENSSL_SYS_VMS_DECC # elif defined(__DECCXX) # define OPENSSL_SYS_VMS_DECC # define OPENSSL_SYS_VMS_DECCXX # else # define OPENSSL_SYS_VMS_NODECC # endif # endif /* -------------------------------- Unix ---------------------------------- */ # ifdef OPENSSL_SYS_UNIX # if defined(linux) || defined(__linux__) && !defined(OPENSSL_SYS_LINUX) # define OPENSSL_SYS_LINUX # endif # if defined(_AIX) && !defined(OPENSSL_SYS_AIX) # define OPENSSL_SYS_AIX # endif # endif /* -------------------------------- VOS ----------------------------------- */ # if defined(__VOS__) && !defined(OPENSSL_SYS_VOS) # define OPENSSL_SYS_VOS # ifdef __HPPA__ # define OPENSSL_SYS_VOS_HPPA # endif # ifdef __IA32__ # define OPENSSL_SYS_VOS_IA32 # endif # endif /* ---------------------------- HP NonStop -------------------------------- */ # ifdef __TANDEM # ifdef _STRING # include <strings.h> # endif # define OPENSSL_USE_BUILD_DATE # if defined(OPENSSL_THREADS) && defined(_SPT_MODEL_) # define SPT_THREAD_SIGNAL 1 # define SPT_THREAD_AWARE 1 # include <spthread.h> # elif defined(OPENSSL_THREADS) && defined(_PUT_MODEL_) # include <pthread.h> # endif # endif /** * That's it for OS-specific stuff *****************************************************************************/ /*- * OPENSSL_EXTERN is normally used to declare a symbol with possible extra * attributes to handle its presence in a shared library. * OPENSSL_EXPORT is used to define a symbol with extra possible attributes * to make it visible in a shared library. * Care needs to be taken when a header file is used both to declare and * define symbols. Basically, for any library that exports some global * variables, the following code must be present in the header file that * declares them, before OPENSSL_EXTERN is used: * * #ifdef SOME_BUILD_FLAG_MACRO * # undef OPENSSL_EXTERN * # define OPENSSL_EXTERN OPENSSL_EXPORT * #endif * * The default is to have OPENSSL_EXPORT and OPENSSL_EXTERN * have some generally sensible values. */ # if defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL) # define OPENSSL_EXPORT extern __declspec(dllexport) # define OPENSSL_EXTERN extern __declspec(dllimport) # else # define OPENSSL_EXPORT extern # define OPENSSL_EXTERN extern # endif # ifdef _WIN32 # ifdef _WIN64 # define ossl_ssize_t __int64 # define OSSL_SSIZE_MAX _I64_MAX # else # define ossl_ssize_t int # define OSSL_SSIZE_MAX INT_MAX # endif # endif # if defined(OPENSSL_SYS_UEFI) && !defined(ossl_ssize_t) # define ossl_ssize_t INTN # define OSSL_SSIZE_MAX MAX_INTN # endif # ifndef ossl_ssize_t # define ossl_ssize_t ssize_t # if defined(SSIZE_MAX) # define OSSL_SSIZE_MAX SSIZE_MAX # elif defined(_POSIX_SSIZE_MAX) # define OSSL_SSIZE_MAX _POSIX_SSIZE_MAX # else # define OSSL_SSIZE_MAX ((ssize_t)(SIZE_MAX>>1)) # endif # endif # if defined(UNUSEDRESULT_DEBUG) # define __owur __attribute__((__warn_unused_result__)) # else # define __owur # endif /* Standard integer types */ # define OPENSSL_NO_INTTYPES_H # define OPENSSL_NO_STDINT_H # if defined(OPENSSL_SYS_UEFI) typedef INT8 int8_t; typedef UINT8 uint8_t; typedef INT16 int16_t; typedef UINT16 uint16_t; typedef INT32 int32_t; typedef UINT32 uint32_t; typedef INT64 int64_t; typedef UINT64 uint64_t; # elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ defined(__osf__) || defined(__sgi) || defined(__hpux) || \ defined(OPENSSL_SYS_VMS) || defined (__OpenBSD__) # include <inttypes.h> # undef OPENSSL_NO_INTTYPES_H /* Because the specs say that inttypes.h includes stdint.h if present */ # undef OPENSSL_NO_STDINT_H # elif defined(_MSC_VER) && _MSC_VER<1600 /* * minimally required typdefs for systems not supporting inttypes.h or * stdint.h: currently just older VC++ */ typedef signed char int8_t; typedef unsigned char uint8_t; typedef short int16_t; typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; typedef __int64 int64_t; typedef unsigned __int64 uint64_t; # elif defined(OPENSSL_SYS_TANDEM) # include <stdint.h> # include <sys/types.h> # else # include <stdint.h> # undef OPENSSL_NO_STDINT_H # endif # if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && \ defined(INTMAX_MAX) && defined(UINTMAX_MAX) typedef intmax_t ossl_intmax_t; typedef uintmax_t ossl_uintmax_t; # else /* Fall back to the largest we know we require and can handle */ typedef int64_t ossl_intmax_t; typedef uint64_t ossl_uintmax_t; # endif /* ossl_inline: portable inline definition usable in public headers */ # if !defined(inline) && !defined(__cplusplus) # if defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L /* just use inline */ # define ossl_inline inline # elif defined(__GNUC__) && __GNUC__>=2 # define ossl_inline __inline__ # elif defined(_MSC_VER) /* * Visual Studio: inline is available in C++ only, however * __inline is available for C, see * http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx */ # define ossl_inline __inline # else # define ossl_inline # endif # else # define ossl_inline inline # endif # if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && \ !defined(__cplusplus) # define ossl_noreturn _Noreturn # elif defined(__GNUC__) && __GNUC__ >= 2 # define ossl_noreturn __attribute__((noreturn)) # else # define ossl_noreturn # endif /* ossl_unused: portable unused attribute for use in public headers */ # if defined(__GNUC__) # define ossl_unused __attribute__((unused)) # else # define ossl_unused # endif #ifdef __cplusplus } #endif #endif
8,800
27.482201
121
h
openssl
openssl-master/include/openssl/ebcdic.h
/* * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_EBCDIC_H # define OPENSSL_EBCDIC_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_EBCDIC_H # endif # include <stdlib.h> #ifdef __cplusplus extern "C" { #endif /* Avoid name clashes with other applications */ # define os_toascii _openssl_os_toascii # define os_toebcdic _openssl_os_toebcdic # define ebcdic2ascii _openssl_ebcdic2ascii # define ascii2ebcdic _openssl_ascii2ebcdic extern const unsigned char os_toascii[256]; extern const unsigned char os_toebcdic[256]; void *ebcdic2ascii(void *dest, const void *srce, size_t count); void *ascii2ebcdic(void *dest, const void *srce, size_t count); #ifdef __cplusplus } #endif #endif
1,042
25.075
74
h
openssl
openssl-master/include/openssl/ecerr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_ECERR_H # define OPENSSL_ECERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> # ifndef OPENSSL_NO_EC /* * EC reason codes. */ # define EC_R_ASN1_ERROR 115 # define EC_R_BAD_SIGNATURE 156 # define EC_R_BIGNUM_OUT_OF_RANGE 144 # define EC_R_BUFFER_TOO_SMALL 100 # define EC_R_CANNOT_INVERT 165 # define EC_R_COORDINATES_OUT_OF_RANGE 146 # define EC_R_CURVE_DOES_NOT_SUPPORT_ECDH 160 # define EC_R_CURVE_DOES_NOT_SUPPORT_ECDSA 170 # define EC_R_CURVE_DOES_NOT_SUPPORT_SIGNING 159 # define EC_R_DECODE_ERROR 142 # define EC_R_DISCRIMINANT_IS_ZERO 118 # define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 119 # define EC_R_EXPLICIT_PARAMS_NOT_SUPPORTED 127 # define EC_R_FAILED_MAKING_PUBLIC_KEY 166 # define EC_R_FIELD_TOO_LARGE 143 # define EC_R_GF2M_NOT_SUPPORTED 147 # define EC_R_GROUP2PKPARAMETERS_FAILURE 120 # define EC_R_I2D_ECPKPARAMETERS_FAILURE 121 # define EC_R_INCOMPATIBLE_OBJECTS 101 # define EC_R_INVALID_A 168 # define EC_R_INVALID_ARGUMENT 112 # define EC_R_INVALID_B 169 # define EC_R_INVALID_COFACTOR 171 # define EC_R_INVALID_COMPRESSED_POINT 110 # define EC_R_INVALID_COMPRESSION_BIT 109 # define EC_R_INVALID_CURVE 141 # define EC_R_INVALID_DIGEST 151 # define EC_R_INVALID_DIGEST_TYPE 138 # define EC_R_INVALID_ENCODING 102 # define EC_R_INVALID_FIELD 103 # define EC_R_INVALID_FORM 104 # define EC_R_INVALID_GENERATOR 173 # define EC_R_INVALID_GROUP_ORDER 122 # define EC_R_INVALID_KEY 116 # define EC_R_INVALID_LENGTH 117 # define EC_R_INVALID_NAMED_GROUP_CONVERSION 174 # define EC_R_INVALID_OUTPUT_LENGTH 161 # define EC_R_INVALID_P 172 # define EC_R_INVALID_PEER_KEY 133 # define EC_R_INVALID_PENTANOMIAL_BASIS 132 # define EC_R_INVALID_PRIVATE_KEY 123 # define EC_R_INVALID_SEED 175 # define EC_R_INVALID_TRINOMIAL_BASIS 137 # define EC_R_KDF_PARAMETER_ERROR 148 # define EC_R_KEYS_NOT_SET 140 # define EC_R_LADDER_POST_FAILURE 136 # define EC_R_LADDER_PRE_FAILURE 153 # define EC_R_LADDER_STEP_FAILURE 162 # define EC_R_MISSING_OID 167 # define EC_R_MISSING_PARAMETERS 124 # define EC_R_MISSING_PRIVATE_KEY 125 # define EC_R_NEED_NEW_SETUP_VALUES 157 # define EC_R_NOT_A_NIST_PRIME 135 # define EC_R_NOT_IMPLEMENTED 126 # define EC_R_NOT_INITIALIZED 111 # define EC_R_NO_PARAMETERS_SET 139 # define EC_R_NO_PRIVATE_VALUE 154 # define EC_R_OPERATION_NOT_SUPPORTED 152 # define EC_R_PASSED_NULL_PARAMETER 134 # define EC_R_PEER_KEY_ERROR 149 # define EC_R_POINT_ARITHMETIC_FAILURE 155 # define EC_R_POINT_AT_INFINITY 106 # define EC_R_POINT_COORDINATES_BLIND_FAILURE 163 # define EC_R_POINT_IS_NOT_ON_CURVE 107 # define EC_R_RANDOM_NUMBER_GENERATION_FAILED 158 # define EC_R_SHARED_INFO_ERROR 150 # define EC_R_SLOT_FULL 108 # define EC_R_TOO_MANY_RETRIES 176 # define EC_R_UNDEFINED_GENERATOR 113 # define EC_R_UNDEFINED_ORDER 128 # define EC_R_UNKNOWN_COFACTOR 164 # define EC_R_UNKNOWN_GROUP 129 # define EC_R_UNKNOWN_ORDER 114 # define EC_R_UNSUPPORTED_FIELD 131 # define EC_R_WRONG_CURVE_PARAMETERS 145 # define EC_R_WRONG_ORDER 130 # endif #endif
5,405
50.485714
74
h
openssl
openssl-master/include/openssl/encoder.h
/* * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_ENCODER_H # define OPENSSL_ENCODER_H # pragma once # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_STDIO # include <stdio.h> # endif # include <stdarg.h> # include <stddef.h> # include <openssl/encodererr.h> # include <openssl/types.h> # include <openssl/core.h> # ifdef __cplusplus extern "C" { # endif OSSL_ENCODER *OSSL_ENCODER_fetch(OSSL_LIB_CTX *libctx, const char *name, const char *properties); int OSSL_ENCODER_up_ref(OSSL_ENCODER *encoder); void OSSL_ENCODER_free(OSSL_ENCODER *encoder); const OSSL_PROVIDER *OSSL_ENCODER_get0_provider(const OSSL_ENCODER *encoder); const char *OSSL_ENCODER_get0_properties(const OSSL_ENCODER *encoder); const char *OSSL_ENCODER_get0_name(const OSSL_ENCODER *kdf); const char *OSSL_ENCODER_get0_description(const OSSL_ENCODER *kdf); int OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name); void OSSL_ENCODER_do_all_provided(OSSL_LIB_CTX *libctx, void (*fn)(OSSL_ENCODER *encoder, void *arg), void *arg); int OSSL_ENCODER_names_do_all(const OSSL_ENCODER *encoder, void (*fn)(const char *name, void *data), void *data); const OSSL_PARAM *OSSL_ENCODER_gettable_params(OSSL_ENCODER *encoder); int OSSL_ENCODER_get_params(OSSL_ENCODER *encoder, OSSL_PARAM params[]); const OSSL_PARAM *OSSL_ENCODER_settable_ctx_params(OSSL_ENCODER *encoder); OSSL_ENCODER_CTX *OSSL_ENCODER_CTX_new(void); int OSSL_ENCODER_CTX_set_params(OSSL_ENCODER_CTX *ctx, const OSSL_PARAM params[]); void OSSL_ENCODER_CTX_free(OSSL_ENCODER_CTX *ctx); /* Utilities that help set specific parameters */ int OSSL_ENCODER_CTX_set_passphrase(OSSL_ENCODER_CTX *ctx, const unsigned char *kstr, size_t klen); int OSSL_ENCODER_CTX_set_pem_password_cb(OSSL_ENCODER_CTX *ctx, pem_password_cb *cb, void *cbarg); int OSSL_ENCODER_CTX_set_passphrase_cb(OSSL_ENCODER_CTX *ctx, OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg); int OSSL_ENCODER_CTX_set_passphrase_ui(OSSL_ENCODER_CTX *ctx, const UI_METHOD *ui_method, void *ui_data); int OSSL_ENCODER_CTX_set_cipher(OSSL_ENCODER_CTX *ctx, const char *cipher_name, const char *propquery); int OSSL_ENCODER_CTX_set_selection(OSSL_ENCODER_CTX *ctx, int selection); int OSSL_ENCODER_CTX_set_output_type(OSSL_ENCODER_CTX *ctx, const char *output_type); int OSSL_ENCODER_CTX_set_output_structure(OSSL_ENCODER_CTX *ctx, const char *output_structure); /* Utilities to add encoders */ int OSSL_ENCODER_CTX_add_encoder(OSSL_ENCODER_CTX *ctx, OSSL_ENCODER *encoder); int OSSL_ENCODER_CTX_add_extra(OSSL_ENCODER_CTX *ctx, OSSL_LIB_CTX *libctx, const char *propq); int OSSL_ENCODER_CTX_get_num_encoders(OSSL_ENCODER_CTX *ctx); typedef struct ossl_encoder_instance_st OSSL_ENCODER_INSTANCE; OSSL_ENCODER * OSSL_ENCODER_INSTANCE_get_encoder(OSSL_ENCODER_INSTANCE *encoder_inst); void * OSSL_ENCODER_INSTANCE_get_encoder_ctx(OSSL_ENCODER_INSTANCE *encoder_inst); const char * OSSL_ENCODER_INSTANCE_get_output_type(OSSL_ENCODER_INSTANCE *encoder_inst); const char * OSSL_ENCODER_INSTANCE_get_output_structure(OSSL_ENCODER_INSTANCE *encoder_inst); typedef const void *OSSL_ENCODER_CONSTRUCT(OSSL_ENCODER_INSTANCE *encoder_inst, void *construct_data); typedef void OSSL_ENCODER_CLEANUP(void *construct_data); int OSSL_ENCODER_CTX_set_construct(OSSL_ENCODER_CTX *ctx, OSSL_ENCODER_CONSTRUCT *construct); int OSSL_ENCODER_CTX_set_construct_data(OSSL_ENCODER_CTX *ctx, void *construct_data); int OSSL_ENCODER_CTX_set_cleanup(OSSL_ENCODER_CTX *ctx, OSSL_ENCODER_CLEANUP *cleanup); /* Utilities to output the object to encode */ int OSSL_ENCODER_to_bio(OSSL_ENCODER_CTX *ctx, BIO *out); #ifndef OPENSSL_NO_STDIO int OSSL_ENCODER_to_fp(OSSL_ENCODER_CTX *ctx, FILE *fp); #endif int OSSL_ENCODER_to_data(OSSL_ENCODER_CTX *ctx, unsigned char **pdata, size_t *pdata_len); /* * Create the OSSL_ENCODER_CTX with an associated type. This will perform * an implicit OSSL_ENCODER_fetch(), suitable for the object of that type. * This is more useful than calling OSSL_ENCODER_CTX_new(). */ OSSL_ENCODER_CTX *OSSL_ENCODER_CTX_new_for_pkey(const EVP_PKEY *pkey, int selection, const char *output_type, const char *output_struct, const char *propquery); # ifdef __cplusplus } # endif #endif
5,450
42.608
80
h
openssl
openssl-master/include/openssl/encodererr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_ENCODERERR_H # define OPENSSL_ENCODERERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> /* * OSSL_ENCODER reason codes. */ # define OSSL_ENCODER_R_ENCODER_NOT_FOUND 101 # define OSSL_ENCODER_R_INCORRECT_PROPERTY_QUERY 100 # define OSSL_ENCODER_R_MISSING_GET_PARAMS 102 #endif
791
26.310345
74
h
openssl
openssl-master/include/openssl/engineerr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_ENGINEERR_H # define OPENSSL_ENGINEERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> # ifndef OPENSSL_NO_ENGINE /* * ENGINE reason codes. */ # define ENGINE_R_ALREADY_LOADED 100 # define ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER 133 # define ENGINE_R_CMD_NOT_EXECUTABLE 134 # define ENGINE_R_COMMAND_TAKES_INPUT 135 # define ENGINE_R_COMMAND_TAKES_NO_INPUT 136 # define ENGINE_R_CONFLICTING_ENGINE_ID 103 # define ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED 119 # define ENGINE_R_DSO_FAILURE 104 # define ENGINE_R_DSO_NOT_FOUND 132 # define ENGINE_R_ENGINES_SECTION_ERROR 148 # define ENGINE_R_ENGINE_CONFIGURATION_ERROR 102 # define ENGINE_R_ENGINE_IS_NOT_IN_LIST 105 # define ENGINE_R_ENGINE_SECTION_ERROR 149 # define ENGINE_R_FAILED_LOADING_PRIVATE_KEY 128 # define ENGINE_R_FAILED_LOADING_PUBLIC_KEY 129 # define ENGINE_R_FINISH_FAILED 106 # define ENGINE_R_ID_OR_NAME_MISSING 108 # define ENGINE_R_INIT_FAILED 109 # define ENGINE_R_INTERNAL_LIST_ERROR 110 # define ENGINE_R_INVALID_ARGUMENT 143 # define ENGINE_R_INVALID_CMD_NAME 137 # define ENGINE_R_INVALID_CMD_NUMBER 138 # define ENGINE_R_INVALID_INIT_VALUE 151 # define ENGINE_R_INVALID_STRING 150 # define ENGINE_R_NOT_INITIALISED 117 # define ENGINE_R_NOT_LOADED 112 # define ENGINE_R_NO_CONTROL_FUNCTION 120 # define ENGINE_R_NO_INDEX 144 # define ENGINE_R_NO_LOAD_FUNCTION 125 # define ENGINE_R_NO_REFERENCE 130 # define ENGINE_R_NO_SUCH_ENGINE 116 # define ENGINE_R_UNIMPLEMENTED_CIPHER 146 # define ENGINE_R_UNIMPLEMENTED_DIGEST 147 # define ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD 101 # define ENGINE_R_VERSION_INCOMPATIBILITY 145 # endif #endif
2,838
43.359375
74
h
openssl
openssl-master/include/openssl/esserr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_ESSERR_H # define OPENSSL_ESSERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> /* * ESS reason codes. */ # define ESS_R_EMPTY_ESS_CERT_ID_LIST 107 # define ESS_R_ESS_CERT_DIGEST_ERROR 103 # define ESS_R_ESS_CERT_ID_NOT_FOUND 104 # define ESS_R_ESS_CERT_ID_WRONG_ORDER 105 # define ESS_R_ESS_DIGEST_ALG_UNKNOWN 106 # define ESS_R_ESS_SIGNING_CERTIFICATE_ERROR 102 # define ESS_R_ESS_SIGNING_CERT_ADD_ERROR 100 # define ESS_R_ESS_SIGNING_CERT_V2_ADD_ERROR 101 # define ESS_R_MISSING_SIGNING_CERTIFICATE_ATTRIBUTE 108 #endif
1,144
33.69697
74
h
openssl
openssl-master/include/openssl/evperr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_EVPERR_H # define OPENSSL_EVPERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> /* * EVP reason codes. */ # define EVP_R_AES_KEY_SETUP_FAILED 143 # define EVP_R_ARIA_KEY_SETUP_FAILED 176 # define EVP_R_BAD_ALGORITHM_NAME 200 # define EVP_R_BAD_DECRYPT 100 # define EVP_R_BAD_KEY_LENGTH 195 # define EVP_R_BUFFER_TOO_SMALL 155 # define EVP_R_CACHE_CONSTANTS_FAILED 225 # define EVP_R_CAMELLIA_KEY_SETUP_FAILED 157 # define EVP_R_CANNOT_GET_PARAMETERS 197 # define EVP_R_CANNOT_SET_PARAMETERS 198 # define EVP_R_CIPHER_NOT_GCM_MODE 184 # define EVP_R_CIPHER_PARAMETER_ERROR 122 # define EVP_R_COMMAND_NOT_SUPPORTED 147 # define EVP_R_CONFLICTING_ALGORITHM_NAME 201 # define EVP_R_COPY_ERROR 173 # define EVP_R_CTRL_NOT_IMPLEMENTED 132 # define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133 # define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138 # define EVP_R_DECODE_ERROR 114 # define EVP_R_DEFAULT_QUERY_PARSE_ERROR 210 # define EVP_R_DIFFERENT_KEY_TYPES 101 # define EVP_R_DIFFERENT_PARAMETERS 153 # define EVP_R_ERROR_LOADING_SECTION 165 # define EVP_R_EXPECTING_AN_HMAC_KEY 174 # define EVP_R_EXPECTING_AN_RSA_KEY 127 # define EVP_R_EXPECTING_A_DH_KEY 128 # define EVP_R_EXPECTING_A_DSA_KEY 129 # define EVP_R_EXPECTING_A_ECX_KEY 219 # define EVP_R_EXPECTING_A_EC_KEY 142 # define EVP_R_EXPECTING_A_POLY1305_KEY 164 # define EVP_R_EXPECTING_A_SIPHASH_KEY 175 # define EVP_R_FINAL_ERROR 188 # define EVP_R_GENERATE_ERROR 214 # define EVP_R_GET_RAW_KEY_FAILED 182 # define EVP_R_ILLEGAL_SCRYPT_PARAMETERS 171 # define EVP_R_INACCESSIBLE_DOMAIN_PARAMETERS 204 # define EVP_R_INACCESSIBLE_KEY 203 # define EVP_R_INITIALIZATION_ERROR 134 # define EVP_R_INPUT_NOT_INITIALIZED 111 # define EVP_R_INVALID_CUSTOM_LENGTH 185 # define EVP_R_INVALID_DIGEST 152 # define EVP_R_INVALID_IV_LENGTH 194 # define EVP_R_INVALID_KEY 163 # define EVP_R_INVALID_KEY_LENGTH 130 # define EVP_R_INVALID_LENGTH 221 # define EVP_R_INVALID_NULL_ALGORITHM 218 # define EVP_R_INVALID_OPERATION 148 # define EVP_R_INVALID_PROVIDER_FUNCTIONS 193 # define EVP_R_INVALID_SALT_LENGTH 186 # define EVP_R_INVALID_SECRET_LENGTH 223 # define EVP_R_INVALID_SEED_LENGTH 220 # define EVP_R_INVALID_VALUE 222 # define EVP_R_KEYMGMT_EXPORT_FAILURE 205 # define EVP_R_KEY_SETUP_FAILED 180 # define EVP_R_LOCKING_NOT_SUPPORTED 213 # define EVP_R_MEMORY_LIMIT_EXCEEDED 172 # define EVP_R_MESSAGE_DIGEST_IS_NULL 159 # define EVP_R_METHOD_NOT_SUPPORTED 144 # define EVP_R_MISSING_PARAMETERS 103 # define EVP_R_NOT_ABLE_TO_COPY_CTX 190 # define EVP_R_NOT_XOF_OR_INVALID_LENGTH 178 # define EVP_R_NO_CIPHER_SET 131 # define EVP_R_NO_DEFAULT_DIGEST 158 # define EVP_R_NO_DIGEST_SET 139 # define EVP_R_NO_IMPORT_FUNCTION 206 # define EVP_R_NO_KEYMGMT_AVAILABLE 199 # define EVP_R_NO_KEYMGMT_PRESENT 196 # define EVP_R_NO_KEY_SET 154 # define EVP_R_NO_OPERATION_SET 149 # define EVP_R_NULL_MAC_PKEY_CTX 208 # define EVP_R_ONLY_ONESHOT_SUPPORTED 177 # define EVP_R_OPERATION_NOT_INITIALIZED 151 # define EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 150 # define EVP_R_OUTPUT_WOULD_OVERFLOW 202 # define EVP_R_PARAMETER_TOO_LARGE 187 # define EVP_R_PARTIALLY_OVERLAPPING 162 # define EVP_R_PBKDF2_ERROR 181 # define EVP_R_PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED 179 # define EVP_R_PRIVATE_KEY_DECODE_ERROR 145 # define EVP_R_PRIVATE_KEY_ENCODE_ERROR 146 # define EVP_R_PUBLIC_KEY_NOT_RSA 106 # define EVP_R_SETTING_XOF_FAILED 227 # define EVP_R_SET_DEFAULT_PROPERTY_FAILURE 209 # define EVP_R_TOO_MANY_RECORDS 183 # define EVP_R_UNABLE_TO_ENABLE_LOCKING 212 # define EVP_R_UNABLE_TO_GET_MAXIMUM_REQUEST_SIZE 215 # define EVP_R_UNABLE_TO_GET_RANDOM_STRENGTH 216 # define EVP_R_UNABLE_TO_LOCK_CONTEXT 211 # define EVP_R_UNABLE_TO_SET_CALLBACKS 217 # define EVP_R_UNKNOWN_CIPHER 160 # define EVP_R_UNKNOWN_DIGEST 161 # define EVP_R_UNKNOWN_KEY_TYPE 207 # define EVP_R_UNKNOWN_OPTION 169 # define EVP_R_UNKNOWN_PBE_ALGORITHM 121 # define EVP_R_UNSUPPORTED_ALGORITHM 156 # define EVP_R_UNSUPPORTED_CIPHER 107 # define EVP_R_UNSUPPORTED_KEYLENGTH 123 # define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 124 # define EVP_R_UNSUPPORTED_KEY_SIZE 108 # define EVP_R_UNSUPPORTED_KEY_TYPE 224 # define EVP_R_UNSUPPORTED_NUMBER_OF_ROUNDS 135 # define EVP_R_UNSUPPORTED_PRF 125 # define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM 118 # define EVP_R_UNSUPPORTED_SALT_TYPE 126 # define EVP_R_UPDATE_ERROR 189 # define EVP_R_WRAP_MODE_NOT_ALLOWED 170 # define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109 # define EVP_R_XTS_DATA_UNIT_IS_TOO_LARGE 191 # define EVP_R_XTS_DUPLICATED_KEYS 192 #endif
7,351
53.459259
74
h
openssl
openssl-master/include/openssl/fips_names.h
/* * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_FIPS_NAMES_H # define OPENSSL_FIPS_NAMES_H # pragma once # ifdef __cplusplus extern "C" { # endif /* * Parameter names that the FIPS Provider defines */ /* * The calculated MAC of the module file (Used for FIPS Self Testing) * Type: OSSL_PARAM_UTF8_STRING */ # define OSSL_PROV_FIPS_PARAM_MODULE_MAC "module-mac" /* * A version number for the fips install process (Used for FIPS Self Testing) * Type: OSSL_PARAM_UTF8_STRING */ # define OSSL_PROV_FIPS_PARAM_INSTALL_VERSION "install-version" /* * The calculated MAC of the install status indicator (Used for FIPS Self Testing) * Type: OSSL_PARAM_UTF8_STRING */ # define OSSL_PROV_FIPS_PARAM_INSTALL_MAC "install-mac" /* * The install status indicator (Used for FIPS Self Testing) * Type: OSSL_PARAM_UTF8_STRING */ # define OSSL_PROV_FIPS_PARAM_INSTALL_STATUS "install-status" /* * A boolean that determines if the FIPS conditional test errors result in * the module entering an error state. * Type: OSSL_PARAM_UTF8_STRING */ # define OSSL_PROV_FIPS_PARAM_CONDITIONAL_ERRORS "conditional-errors" /* * A boolean that determines if the runtime FIPS security checks are performed. * This is enabled by default. * Type: OSSL_PARAM_UTF8_STRING */ # define OSSL_PROV_FIPS_PARAM_SECURITY_CHECKS "security-checks" /* * A boolean that determines if the runtime FIPS check for TLS1_PRF EMS is performed. * This is disabled by default. * Type: OSSL_PARAM_UTF8_STRING */ # define OSSL_PROV_FIPS_PARAM_TLS1_PRF_EMS_CHECK "tls1-prf-ems-check" /* * A boolean that determines if truncated digests can be used with Hash and HMAC * DRBGs. FIPS 140-3 IG D.R disallows such use for efficiency rather than * security reasons. * This is disabled by default. * Type: OSSL_PARAM_UTF8_STRING */ # define OSSL_PROV_FIPS_PARAM_DRBG_TRUNC_DIGEST "drbg-no-trunc-md" # ifdef __cplusplus } # endif #endif /* OPENSSL_FIPS_NAMES_H */
2,255
27.923077
85
h
openssl
openssl-master/include/openssl/hmac.h
/* * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_HMAC_H # define OPENSSL_HMAC_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_HMAC_H # endif # include <openssl/opensslconf.h> # include <openssl/evp.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HMAC_MAX_MD_CBLOCK 200 /* Deprecated */ # endif # ifdef __cplusplus extern "C" { # endif # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 size_t HMAC_size(const HMAC_CTX *e); OSSL_DEPRECATEDIN_3_0 HMAC_CTX *HMAC_CTX_new(void); OSSL_DEPRECATEDIN_3_0 int HMAC_CTX_reset(HMAC_CTX *ctx); OSSL_DEPRECATEDIN_3_0 void HMAC_CTX_free(HMAC_CTX *ctx); # endif # ifndef OPENSSL_NO_DEPRECATED_1_1_0 OSSL_DEPRECATEDIN_1_1_0 __owur int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md); # endif # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md, ENGINE *impl); OSSL_DEPRECATEDIN_3_0 int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len); OSSL_DEPRECATEDIN_3_0 int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); OSSL_DEPRECATEDIN_3_0 __owur int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); OSSL_DEPRECATEDIN_3_0 void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); OSSL_DEPRECATEDIN_3_0 const EVP_MD *HMAC_CTX_get_md(const HMAC_CTX *ctx); # endif unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, const unsigned char *data, size_t data_len, unsigned char *md, unsigned int *md_len); # ifdef __cplusplus } # endif #endif
2,141
33
82
h
openssl
openssl-master/include/openssl/hpke.h
/* * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ /* APIs and data structures for HPKE (RFC9180) */ #ifndef OSSL_HPKE_H # define OSSL_HPKE_H # pragma once # include <openssl/types.h> /* HPKE modes */ # define OSSL_HPKE_MODE_BASE 0 /* Base mode */ # define OSSL_HPKE_MODE_PSK 1 /* Pre-shared key mode */ # define OSSL_HPKE_MODE_AUTH 2 /* Authenticated mode */ # define OSSL_HPKE_MODE_PSKAUTH 3 /* PSK+authenticated mode */ /* * Max for ikm, psk, pskid, info and exporter contexts. * RFC9180, section 7.2.1 RECOMMENDS 64 octets but we have test vectors from * Appendix A.6.1 with a 66 octet IKM so we'll allow that. */ # define OSSL_HPKE_MAX_PARMLEN 66 # define OSSL_HPKE_MAX_INFOLEN 1024 /* * The (16bit) HPKE algorithm ID IANA codepoints * If/when new IANA codepoints are added there are tables in * crypto/hpke/hpke_util.c that must also be updated. */ # define OSSL_HPKE_KEM_ID_RESERVED 0x0000 /* not used */ # define OSSL_HPKE_KEM_ID_P256 0x0010 /* NIST P-256 */ # define OSSL_HPKE_KEM_ID_P384 0x0011 /* NIST P-384 */ # define OSSL_HPKE_KEM_ID_P521 0x0012 /* NIST P-521 */ # define OSSL_HPKE_KEM_ID_X25519 0x0020 /* Curve25519 */ # define OSSL_HPKE_KEM_ID_X448 0x0021 /* Curve448 */ # define OSSL_HPKE_KDF_ID_RESERVED 0x0000 /* not used */ # define OSSL_HPKE_KDF_ID_HKDF_SHA256 0x0001 /* HKDF-SHA256 */ # define OSSL_HPKE_KDF_ID_HKDF_SHA384 0x0002 /* HKDF-SHA384 */ # define OSSL_HPKE_KDF_ID_HKDF_SHA512 0x0003 /* HKDF-SHA512 */ # define OSSL_HPKE_AEAD_ID_RESERVED 0x0000 /* not used */ # define OSSL_HPKE_AEAD_ID_AES_GCM_128 0x0001 /* AES-GCM-128 */ # define OSSL_HPKE_AEAD_ID_AES_GCM_256 0x0002 /* AES-GCM-256 */ # define OSSL_HPKE_AEAD_ID_CHACHA_POLY1305 0x0003 /* Chacha20-Poly1305 */ # define OSSL_HPKE_AEAD_ID_EXPORTONLY 0xFFFF /* export-only fake ID */ /* strings for suite components */ # define OSSL_HPKE_KEMSTR_P256 "P-256" /* KEM id 0x10 */ # define OSSL_HPKE_KEMSTR_P384 "P-384" /* KEM id 0x11 */ # define OSSL_HPKE_KEMSTR_P521 "P-521" /* KEM id 0x12 */ # define OSSL_HPKE_KEMSTR_X25519 "X25519" /* KEM id 0x20 */ # define OSSL_HPKE_KEMSTR_X448 "X448" /* KEM id 0x21 */ # define OSSL_HPKE_KDFSTR_256 "hkdf-sha256" /* KDF id 1 */ # define OSSL_HPKE_KDFSTR_384 "hkdf-sha384" /* KDF id 2 */ # define OSSL_HPKE_KDFSTR_512 "hkdf-sha512" /* KDF id 3 */ # define OSSL_HPKE_AEADSTR_AES128GCM "aes-128-gcm" /* AEAD id 1 */ # define OSSL_HPKE_AEADSTR_AES256GCM "aes-256-gcm" /* AEAD id 2 */ # define OSSL_HPKE_AEADSTR_CP "chacha20-poly1305" /* AEAD id 3 */ # define OSSL_HPKE_AEADSTR_EXP "exporter" /* AEAD id 0xff */ /* * Roles for use in creating an OSSL_HPKE_CTX, most * important use of this is to control nonce re-use. */ # define OSSL_HPKE_ROLE_SENDER 0 # define OSSL_HPKE_ROLE_RECEIVER 1 # ifdef __cplusplus extern "C" { # endif typedef struct { uint16_t kem_id; /* Key Encapsulation Method id */ uint16_t kdf_id; /* Key Derivation Function id */ uint16_t aead_id; /* AEAD alg id */ } OSSL_HPKE_SUITE; /** * Suite constants, use this like: * OSSL_HPKE_SUITE myvar = OSSL_HPKE_SUITE_DEFAULT; */ # ifndef OPENSSL_NO_ECX # define OSSL_HPKE_SUITE_DEFAULT \ {\ OSSL_HPKE_KEM_ID_X25519, \ OSSL_HPKE_KDF_ID_HKDF_SHA256, \ OSSL_HPKE_AEAD_ID_AES_GCM_128 \ } # else # define OSSL_HPKE_SUITE_DEFAULT \ {\ OSSL_HPKE_KEM_ID_P256, \ OSSL_HPKE_KDF_ID_HKDF_SHA256, \ OSSL_HPKE_AEAD_ID_AES_GCM_128 \ } #endif typedef struct ossl_hpke_ctx_st OSSL_HPKE_CTX; OSSL_HPKE_CTX *OSSL_HPKE_CTX_new(int mode, OSSL_HPKE_SUITE suite, int role, OSSL_LIB_CTX *libctx, const char *propq); void OSSL_HPKE_CTX_free(OSSL_HPKE_CTX *ctx); int OSSL_HPKE_encap(OSSL_HPKE_CTX *ctx, unsigned char *enc, size_t *enclen, const unsigned char *pub, size_t publen, const unsigned char *info, size_t infolen); int OSSL_HPKE_seal(OSSL_HPKE_CTX *ctx, unsigned char *ct, size_t *ctlen, const unsigned char *aad, size_t aadlen, const unsigned char *pt, size_t ptlen); int OSSL_HPKE_keygen(OSSL_HPKE_SUITE suite, unsigned char *pub, size_t *publen, EVP_PKEY **priv, const unsigned char *ikm, size_t ikmlen, OSSL_LIB_CTX *libctx, const char *propq); int OSSL_HPKE_decap(OSSL_HPKE_CTX *ctx, const unsigned char *enc, size_t enclen, EVP_PKEY *recippriv, const unsigned char *info, size_t infolen); int OSSL_HPKE_open(OSSL_HPKE_CTX *ctx, unsigned char *pt, size_t *ptlen, const unsigned char *aad, size_t aadlen, const unsigned char *ct, size_t ctlen); int OSSL_HPKE_export(OSSL_HPKE_CTX *ctx, unsigned char *secret, size_t secretlen, const unsigned char *label, size_t labellen); int OSSL_HPKE_CTX_set1_authpriv(OSSL_HPKE_CTX *ctx, EVP_PKEY *priv); int OSSL_HPKE_CTX_set1_authpub(OSSL_HPKE_CTX *ctx, const unsigned char *pub, size_t publen); int OSSL_HPKE_CTX_set1_psk(OSSL_HPKE_CTX *ctx, const char *pskid, const unsigned char *psk, size_t psklen); int OSSL_HPKE_CTX_set1_ikme(OSSL_HPKE_CTX *ctx, const unsigned char *ikme, size_t ikmelen); int OSSL_HPKE_CTX_set_seq(OSSL_HPKE_CTX *ctx, uint64_t seq); int OSSL_HPKE_CTX_get_seq(OSSL_HPKE_CTX *ctx, uint64_t *seq); int OSSL_HPKE_suite_check(OSSL_HPKE_SUITE suite); int OSSL_HPKE_get_grease_value(const OSSL_HPKE_SUITE *suite_in, OSSL_HPKE_SUITE *suite, unsigned char *enc, size_t *enclen, unsigned char *ct, size_t ctlen, OSSL_LIB_CTX *libctx, const char *propq); int OSSL_HPKE_str2suite(const char *str, OSSL_HPKE_SUITE *suite); size_t OSSL_HPKE_get_ciphertext_size(OSSL_HPKE_SUITE suite, size_t clearlen); size_t OSSL_HPKE_get_public_encap_size(OSSL_HPKE_SUITE suite); size_t OSSL_HPKE_get_recommended_ikmelen(OSSL_HPKE_SUITE suite); # ifdef __cplusplus } # endif #endif
6,935
40.04142
77
h
openssl
openssl-master/include/openssl/http.h
/* * Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. * Copyright Siemens AG 2018-2020 * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_HTTP_H # define OPENSSL_HTTP_H # pragma once # include <openssl/opensslconf.h> # include <openssl/bio.h> # include <openssl/asn1.h> # include <openssl/conf.h> # ifdef __cplusplus extern "C" { # endif # define OSSL_HTTP_NAME "http" # define OSSL_HTTPS_NAME "https" # define OSSL_HTTP_PREFIX OSSL_HTTP_NAME"://" # define OSSL_HTTPS_PREFIX OSSL_HTTPS_NAME"://" # define OSSL_HTTP_PORT "80" # define OSSL_HTTPS_PORT "443" # define OPENSSL_NO_PROXY "NO_PROXY" # define OPENSSL_HTTP_PROXY "HTTP_PROXY" # define OPENSSL_HTTPS_PROXY "HTTPS_PROXY" # ifndef OPENSSL_NO_HTTP #define OSSL_HTTP_DEFAULT_MAX_LINE_LEN (4 * 1024) #define OSSL_HTTP_DEFAULT_MAX_RESP_LEN (100 * 1024) /* Low-level HTTP API */ OSSL_HTTP_REQ_CTX *OSSL_HTTP_REQ_CTX_new(BIO *wbio, BIO *rbio, int buf_size); void OSSL_HTTP_REQ_CTX_free(OSSL_HTTP_REQ_CTX *rctx); int OSSL_HTTP_REQ_CTX_set_request_line(OSSL_HTTP_REQ_CTX *rctx, int method_POST, const char *server, const char *port, const char *path); int OSSL_HTTP_REQ_CTX_add1_header(OSSL_HTTP_REQ_CTX *rctx, const char *name, const char *value); int OSSL_HTTP_REQ_CTX_set_expected(OSSL_HTTP_REQ_CTX *rctx, const char *content_type, int asn1, int timeout, int keep_alive); int OSSL_HTTP_REQ_CTX_set1_req(OSSL_HTTP_REQ_CTX *rctx, const char *content_type, const ASN1_ITEM *it, const ASN1_VALUE *req); int OSSL_HTTP_REQ_CTX_nbio(OSSL_HTTP_REQ_CTX *rctx); int OSSL_HTTP_REQ_CTX_nbio_d2i(OSSL_HTTP_REQ_CTX *rctx, ASN1_VALUE **pval, const ASN1_ITEM *it); BIO *OSSL_HTTP_REQ_CTX_exchange(OSSL_HTTP_REQ_CTX *rctx); BIO *OSSL_HTTP_REQ_CTX_get0_mem_bio(const OSSL_HTTP_REQ_CTX *rctx); size_t OSSL_HTTP_REQ_CTX_get_resp_len(const OSSL_HTTP_REQ_CTX *rctx); void OSSL_HTTP_REQ_CTX_set_max_response_length(OSSL_HTTP_REQ_CTX *rctx, unsigned long len); int OSSL_HTTP_is_alive(const OSSL_HTTP_REQ_CTX *rctx); /* High-level HTTP API */ typedef BIO *(*OSSL_HTTP_bio_cb_t)(BIO *bio, void *arg, int connect, int detail); OSSL_HTTP_REQ_CTX *OSSL_HTTP_open(const char *server, const char *port, const char *proxy, const char *no_proxy, int use_ssl, BIO *bio, BIO *rbio, OSSL_HTTP_bio_cb_t bio_update_fn, void *arg, int buf_size, int overall_timeout); int OSSL_HTTP_proxy_connect(BIO *bio, const char *server, const char *port, const char *proxyuser, const char *proxypass, int timeout, BIO *bio_err, const char *prog); int OSSL_HTTP_set1_request(OSSL_HTTP_REQ_CTX *rctx, const char *path, const STACK_OF(CONF_VALUE) *headers, const char *content_type, BIO *req, const char *expected_content_type, int expect_asn1, size_t max_resp_len, int timeout, int keep_alive); BIO *OSSL_HTTP_exchange(OSSL_HTTP_REQ_CTX *rctx, char **redirection_url); BIO *OSSL_HTTP_get(const char *url, const char *proxy, const char *no_proxy, BIO *bio, BIO *rbio, OSSL_HTTP_bio_cb_t bio_update_fn, void *arg, int buf_size, const STACK_OF(CONF_VALUE) *headers, const char *expected_content_type, int expect_asn1, size_t max_resp_len, int timeout); BIO *OSSL_HTTP_transfer(OSSL_HTTP_REQ_CTX **prctx, const char *server, const char *port, const char *path, int use_ssl, const char *proxy, const char *no_proxy, BIO *bio, BIO *rbio, OSSL_HTTP_bio_cb_t bio_update_fn, void *arg, int buf_size, const STACK_OF(CONF_VALUE) *headers, const char *content_type, BIO *req, const char *expected_content_type, int expect_asn1, size_t max_resp_len, int timeout, int keep_alive); int OSSL_HTTP_close(OSSL_HTTP_REQ_CTX *rctx, int ok); /* Auxiliary functions */ int OSSL_parse_url(const char *url, char **pscheme, char **puser, char **phost, char **pport, int *pport_num, char **ppath, char **pquery, char **pfrag); int OSSL_HTTP_parse_url(const char *url, int *pssl, char **puser, char **phost, char **pport, int *pport_num, char **ppath, char **pquery, char **pfrag); const char *OSSL_HTTP_adapt_proxy(const char *proxy, const char *no_proxy, const char *server, int use_ssl); # endif /* !defined(OPENSSL_NO_HTTP) */ # ifdef __cplusplus } # endif #endif /* !defined(OPENSSL_HTTP_H) */
5,353
45.964912
81
h
openssl
openssl-master/include/openssl/httperr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_HTTPERR_H # define OPENSSL_HTTPERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> /* * HTTP reason codes. */ # define HTTP_R_ASN1_LEN_EXCEEDS_MAX_RESP_LEN 108 # define HTTP_R_CONNECT_FAILURE 100 # define HTTP_R_ERROR_PARSING_ASN1_LENGTH 109 # define HTTP_R_ERROR_PARSING_CONTENT_LENGTH 119 # define HTTP_R_ERROR_PARSING_URL 101 # define HTTP_R_ERROR_RECEIVING 103 # define HTTP_R_ERROR_SENDING 102 # define HTTP_R_FAILED_READING_DATA 128 # define HTTP_R_HEADER_PARSE_ERROR 126 # define HTTP_R_INCONSISTENT_CONTENT_LENGTH 120 # define HTTP_R_INVALID_PORT_NUMBER 123 # define HTTP_R_INVALID_URL_PATH 125 # define HTTP_R_INVALID_URL_SCHEME 124 # define HTTP_R_MAX_RESP_LEN_EXCEEDED 117 # define HTTP_R_MISSING_ASN1_ENCODING 110 # define HTTP_R_MISSING_CONTENT_TYPE 121 # define HTTP_R_MISSING_REDIRECT_LOCATION 111 # define HTTP_R_RECEIVED_ERROR 105 # define HTTP_R_RECEIVED_WRONG_HTTP_VERSION 106 # define HTTP_R_REDIRECTION_FROM_HTTPS_TO_HTTP 112 # define HTTP_R_REDIRECTION_NOT_ENABLED 116 # define HTTP_R_RESPONSE_LINE_TOO_LONG 113 # define HTTP_R_RESPONSE_PARSE_ERROR 104 # define HTTP_R_RETRY_TIMEOUT 129 # define HTTP_R_SERVER_CANCELED_CONNECTION 127 # define HTTP_R_SOCK_NOT_SUPPORTED 122 # define HTTP_R_STATUS_CODE_UNSUPPORTED 114 # define HTTP_R_TLS_NOT_ENABLED 107 # define HTTP_R_TOO_MANY_REDIRECTIONS 115 # define HTTP_R_UNEXPECTED_CONTENT_TYPE 118 #endif
2,451
42.785714
74
h
openssl
openssl-master/include/openssl/idea.h
/* * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_IDEA_H # define OPENSSL_IDEA_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_IDEA_H # endif # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_IDEA # ifdef __cplusplus extern "C" { # endif # define IDEA_BLOCK 8 # define IDEA_KEY_LENGTH 16 # ifndef OPENSSL_NO_DEPRECATED_3_0 typedef unsigned int IDEA_INT; # define IDEA_ENCRYPT 1 # define IDEA_DECRYPT 0 typedef struct idea_key_st { IDEA_INT data[9][6]; } IDEA_KEY_SCHEDULE; #endif #ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 const char *IDEA_options(void); OSSL_DEPRECATEDIN_3_0 void IDEA_ecb_encrypt(const unsigned char *in, unsigned char *out, IDEA_KEY_SCHEDULE *ks); OSSL_DEPRECATEDIN_3_0 void IDEA_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); OSSL_DEPRECATEDIN_3_0 void IDEA_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk); OSSL_DEPRECATEDIN_3_0 void IDEA_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int enc); OSSL_DEPRECATEDIN_3_0 void IDEA_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int *num, int enc); OSSL_DEPRECATEDIN_3_0 void IDEA_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int *num); OSSL_DEPRECATEDIN_3_0 void IDEA_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks); #endif # ifndef OPENSSL_NO_DEPRECATED_1_1_0 # define idea_options IDEA_options # define idea_ecb_encrypt IDEA_ecb_encrypt # define idea_set_encrypt_key IDEA_set_encrypt_key # define idea_set_decrypt_key IDEA_set_decrypt_key # define idea_cbc_encrypt IDEA_cbc_encrypt # define idea_cfb64_encrypt IDEA_cfb64_encrypt # define idea_ofb64_encrypt IDEA_ofb64_encrypt # define idea_encrypt IDEA_encrypt # endif # ifdef __cplusplus } # endif # endif #endif
3,010
35.277108
78
h
openssl
openssl-master/include/openssl/kdf.h
/* * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_KDF_H # define OPENSSL_KDF_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_KDF_H # endif # include <stdarg.h> # include <stddef.h> # include <openssl/types.h> # include <openssl/core.h> # ifdef __cplusplus extern "C" { # endif int EVP_KDF_up_ref(EVP_KDF *kdf); void EVP_KDF_free(EVP_KDF *kdf); EVP_KDF *EVP_KDF_fetch(OSSL_LIB_CTX *libctx, const char *algorithm, const char *properties); EVP_KDF_CTX *EVP_KDF_CTX_new(EVP_KDF *kdf); void EVP_KDF_CTX_free(EVP_KDF_CTX *ctx); EVP_KDF_CTX *EVP_KDF_CTX_dup(const EVP_KDF_CTX *src); const char *EVP_KDF_get0_description(const EVP_KDF *kdf); int EVP_KDF_is_a(const EVP_KDF *kdf, const char *name); const char *EVP_KDF_get0_name(const EVP_KDF *kdf); const OSSL_PROVIDER *EVP_KDF_get0_provider(const EVP_KDF *kdf); const EVP_KDF *EVP_KDF_CTX_kdf(EVP_KDF_CTX *ctx); void EVP_KDF_CTX_reset(EVP_KDF_CTX *ctx); size_t EVP_KDF_CTX_get_kdf_size(EVP_KDF_CTX *ctx); int EVP_KDF_derive(EVP_KDF_CTX *ctx, unsigned char *key, size_t keylen, const OSSL_PARAM params[]); int EVP_KDF_get_params(EVP_KDF *kdf, OSSL_PARAM params[]); int EVP_KDF_CTX_get_params(EVP_KDF_CTX *ctx, OSSL_PARAM params[]); int EVP_KDF_CTX_set_params(EVP_KDF_CTX *ctx, const OSSL_PARAM params[]); const OSSL_PARAM *EVP_KDF_gettable_params(const EVP_KDF *kdf); const OSSL_PARAM *EVP_KDF_gettable_ctx_params(const EVP_KDF *kdf); const OSSL_PARAM *EVP_KDF_settable_ctx_params(const EVP_KDF *kdf); const OSSL_PARAM *EVP_KDF_CTX_gettable_params(EVP_KDF_CTX *ctx); const OSSL_PARAM *EVP_KDF_CTX_settable_params(EVP_KDF_CTX *ctx); void EVP_KDF_do_all_provided(OSSL_LIB_CTX *libctx, void (*fn)(EVP_KDF *kdf, void *arg), void *arg); int EVP_KDF_names_do_all(const EVP_KDF *kdf, void (*fn)(const char *name, void *data), void *data); # define EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND 0 # define EVP_KDF_HKDF_MODE_EXTRACT_ONLY 1 # define EVP_KDF_HKDF_MODE_EXPAND_ONLY 2 #define EVP_KDF_SSHKDF_TYPE_INITIAL_IV_CLI_TO_SRV 65 #define EVP_KDF_SSHKDF_TYPE_INITIAL_IV_SRV_TO_CLI 66 #define EVP_KDF_SSHKDF_TYPE_ENCRYPTION_KEY_CLI_TO_SRV 67 #define EVP_KDF_SSHKDF_TYPE_ENCRYPTION_KEY_SRV_TO_CLI 68 #define EVP_KDF_SSHKDF_TYPE_INTEGRITY_KEY_CLI_TO_SRV 69 #define EVP_KDF_SSHKDF_TYPE_INTEGRITY_KEY_SRV_TO_CLI 70 /**** The legacy PKEY-based KDF API follows. ****/ # define EVP_PKEY_CTRL_TLS_MD (EVP_PKEY_ALG_CTRL) # define EVP_PKEY_CTRL_TLS_SECRET (EVP_PKEY_ALG_CTRL + 1) # define EVP_PKEY_CTRL_TLS_SEED (EVP_PKEY_ALG_CTRL + 2) # define EVP_PKEY_CTRL_HKDF_MD (EVP_PKEY_ALG_CTRL + 3) # define EVP_PKEY_CTRL_HKDF_SALT (EVP_PKEY_ALG_CTRL + 4) # define EVP_PKEY_CTRL_HKDF_KEY (EVP_PKEY_ALG_CTRL + 5) # define EVP_PKEY_CTRL_HKDF_INFO (EVP_PKEY_ALG_CTRL + 6) # define EVP_PKEY_CTRL_HKDF_MODE (EVP_PKEY_ALG_CTRL + 7) # define EVP_PKEY_CTRL_PASS (EVP_PKEY_ALG_CTRL + 8) # define EVP_PKEY_CTRL_SCRYPT_SALT (EVP_PKEY_ALG_CTRL + 9) # define EVP_PKEY_CTRL_SCRYPT_N (EVP_PKEY_ALG_CTRL + 10) # define EVP_PKEY_CTRL_SCRYPT_R (EVP_PKEY_ALG_CTRL + 11) # define EVP_PKEY_CTRL_SCRYPT_P (EVP_PKEY_ALG_CTRL + 12) # define EVP_PKEY_CTRL_SCRYPT_MAXMEM_BYTES (EVP_PKEY_ALG_CTRL + 13) # define EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND \ EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND # define EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY \ EVP_KDF_HKDF_MODE_EXTRACT_ONLY # define EVP_PKEY_HKDEF_MODE_EXPAND_ONLY \ EVP_KDF_HKDF_MODE_EXPAND_ONLY int EVP_PKEY_CTX_set_tls1_prf_md(EVP_PKEY_CTX *ctx, const EVP_MD *md); int EVP_PKEY_CTX_set1_tls1_prf_secret(EVP_PKEY_CTX *pctx, const unsigned char *sec, int seclen); int EVP_PKEY_CTX_add1_tls1_prf_seed(EVP_PKEY_CTX *pctx, const unsigned char *seed, int seedlen); int EVP_PKEY_CTX_set_hkdf_md(EVP_PKEY_CTX *ctx, const EVP_MD *md); int EVP_PKEY_CTX_set1_hkdf_salt(EVP_PKEY_CTX *ctx, const unsigned char *salt, int saltlen); int EVP_PKEY_CTX_set1_hkdf_key(EVP_PKEY_CTX *ctx, const unsigned char *key, int keylen); int EVP_PKEY_CTX_add1_hkdf_info(EVP_PKEY_CTX *ctx, const unsigned char *info, int infolen); int EVP_PKEY_CTX_set_hkdf_mode(EVP_PKEY_CTX *ctx, int mode); # define EVP_PKEY_CTX_hkdf_mode EVP_PKEY_CTX_set_hkdf_mode int EVP_PKEY_CTX_set1_pbe_pass(EVP_PKEY_CTX *ctx, const char *pass, int passlen); int EVP_PKEY_CTX_set1_scrypt_salt(EVP_PKEY_CTX *ctx, const unsigned char *salt, int saltlen); int EVP_PKEY_CTX_set_scrypt_N(EVP_PKEY_CTX *ctx, uint64_t n); int EVP_PKEY_CTX_set_scrypt_r(EVP_PKEY_CTX *ctx, uint64_t r); int EVP_PKEY_CTX_set_scrypt_p(EVP_PKEY_CTX *ctx, uint64_t p); int EVP_PKEY_CTX_set_scrypt_maxmem_bytes(EVP_PKEY_CTX *ctx, uint64_t maxmem_bytes); # ifdef __cplusplus } # endif #endif
5,619
39.431655
76
h
openssl
openssl-master/include/openssl/macros.h
/* * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_MACROS_H # define OPENSSL_MACROS_H # pragma once #include <openssl/opensslconf.h> #include <openssl/opensslv.h> /* Helper macros for CPP string composition */ # define OPENSSL_MSTR_HELPER(x) #x # define OPENSSL_MSTR(x) OPENSSL_MSTR_HELPER(x) /* * Sometimes OPENSSL_NO_xxx ends up with an empty file and some compilers * don't like that. This will hopefully silence them. */ # define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy; /* * Generic deprecation macro * * If OPENSSL_SUPPRESS_DEPRECATED is defined, then OSSL_DEPRECATED and * OSSL_DEPRECATED_FOR become no-ops */ # ifndef OSSL_DEPRECATED # undef OSSL_DEPRECATED_FOR # ifndef OPENSSL_SUPPRESS_DEPRECATED # if defined(_MSC_VER) /* * MSVC supports __declspec(deprecated) since MSVC 2003 (13.10), * and __declspec(deprecated(message)) since MSVC 2005 (14.00) */ # if _MSC_VER >= 1400 # define OSSL_DEPRECATED(since) \ __declspec(deprecated("Since OpenSSL " # since)) # define OSSL_DEPRECATED_FOR(since, message) \ __declspec(deprecated("Since OpenSSL " # since ";" message)) # elif _MSC_VER >= 1310 # define OSSL_DEPRECATED(since) __declspec(deprecated) # define OSSL_DEPRECATED_FOR(since, message) __declspec(deprecated) # endif # elif defined(__GNUC__) /* * According to GCC documentation, deprecations with message appeared in * GCC 4.5.0 */ # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) # define OSSL_DEPRECATED(since) \ __attribute__((deprecated("Since OpenSSL " # since))) # define OSSL_DEPRECATED_FOR(since, message) \ __attribute__((deprecated("Since OpenSSL " # since ";" message))) # elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0) # define OSSL_DEPRECATED(since) __attribute__((deprecated)) # define OSSL_DEPRECATED_FOR(since, message) __attribute__((deprecated)) # endif # elif defined(__SUNPRO_C) # if (__SUNPRO_C >= 0x5130) # define OSSL_DEPRECATED(since) __attribute__ ((deprecated)) # define OSSL_DEPRECATED_FOR(since, message) __attribute__ ((deprecated)) # endif # endif # endif # endif /* * Still not defined? Then define no-op macros. This means these macros * are unsuitable for use in a typedef. */ # ifndef OSSL_DEPRECATED # define OSSL_DEPRECATED(since) extern # define OSSL_DEPRECATED_FOR(since, message) extern # endif /* * Applications should use -DOPENSSL_API_COMPAT=<version> to suppress the * declarations of functions deprecated in or before <version>. If this is * undefined, the value of the macro OPENSSL_CONFIGURED_API (defined in * <openssl/opensslconf.h>) is the default. * * For any version number up until version 1.1.x, <version> is expected to be * the calculated version number 0xMNNFFPPSL. * For version numbers 3.0 and on, <version> is expected to be a computation * of the major and minor numbers in decimal using this formula: * * MAJOR * 10000 + MINOR * 100 * * So version 3.0 becomes 30000, version 3.2 becomes 30200, etc. */ /* * We use the OPENSSL_API_COMPAT value to define API level macros. These * macros are used to enable or disable features at that API version boundary. */ # ifdef OPENSSL_API_LEVEL # error "OPENSSL_API_LEVEL must not be defined by application" # endif /* * We figure out what API level was intended by simple numeric comparison. * The lowest old style number we recognise is 0x00908000L, so we take some * safety margin and assume that anything below 0x00900000L is a new style * number. This allows new versions up to and including v943.71.83. */ # ifdef OPENSSL_API_COMPAT # if OPENSSL_API_COMPAT < 0x900000L # define OPENSSL_API_LEVEL (OPENSSL_API_COMPAT) # else # define OPENSSL_API_LEVEL \ (((OPENSSL_API_COMPAT >> 28) & 0xF) * 10000 \ + ((OPENSSL_API_COMPAT >> 20) & 0xFF) * 100 \ + ((OPENSSL_API_COMPAT >> 12) & 0xFF)) # endif # endif /* * If OPENSSL_API_COMPAT wasn't given, we use default numbers to set * the API compatibility level. */ # ifndef OPENSSL_API_LEVEL # if OPENSSL_CONFIGURED_API > 0 # define OPENSSL_API_LEVEL (OPENSSL_CONFIGURED_API) # else # define OPENSSL_API_LEVEL \ (OPENSSL_VERSION_MAJOR * 10000 + OPENSSL_VERSION_MINOR * 100) # endif # endif # if OPENSSL_API_LEVEL > OPENSSL_CONFIGURED_API # error "The requested API level higher than the configured API compatibility level" # endif /* * Check of sane values. */ /* Can't go higher than the current version. */ # if OPENSSL_API_LEVEL > (OPENSSL_VERSION_MAJOR * 10000 + OPENSSL_VERSION_MINOR * 100) # error "OPENSSL_API_COMPAT expresses an impossible API compatibility level" # endif /* OpenSSL will have no version 2.y.z */ # if OPENSSL_API_LEVEL < 30000 && OPENSSL_API_LEVEL >= 20000 # error "OPENSSL_API_COMPAT expresses an impossible API compatibility level" # endif /* Below 0.9.8 is unacceptably low */ # if OPENSSL_API_LEVEL < 908 # error "OPENSSL_API_COMPAT expresses an impossible API compatibility level" # endif /* * Define macros for deprecation and simulated removal purposes. * * The macros OSSL_DEPRECATED_{major}_{minor} are always defined for * all OpenSSL versions we care for. They can be used as attributes * in function declarations where appropriate. * * The macros OPENSSL_NO_DEPRECATED_{major}_{minor} are defined for * all OpenSSL versions up to or equal to the version given with * OPENSSL_API_COMPAT. They are used as guards around anything that's * deprecated up to that version, as an effect of the developer option * 'no-deprecated'. */ # undef OPENSSL_NO_DEPRECATED_3_2 # undef OPENSSL_NO_DEPRECATED_3_0 # undef OPENSSL_NO_DEPRECATED_1_1_1 # undef OPENSSL_NO_DEPRECATED_1_1_0 # undef OPENSSL_NO_DEPRECATED_1_0_2 # undef OPENSSL_NO_DEPRECATED_1_0_1 # undef OPENSSL_NO_DEPRECATED_1_0_0 # undef OPENSSL_NO_DEPRECATED_0_9_8 # if OPENSSL_API_LEVEL >= 30200 # ifndef OPENSSL_NO_DEPRECATED # define OSSL_DEPRECATEDIN_3_2 OSSL_DEPRECATED(3.2) # define OSSL_DEPRECATEDIN_3_2_FOR(msg) OSSL_DEPRECATED_FOR(3.2, msg) # else # define OPENSSL_NO_DEPRECATED_3_2 # endif # else # define OSSL_DEPRECATEDIN_3_2 # define OSSL_DEPRECATEDIN_3_2_FOR(msg) # endif # if OPENSSL_API_LEVEL >= 30000 # ifndef OPENSSL_NO_DEPRECATED # define OSSL_DEPRECATEDIN_3_0 OSSL_DEPRECATED(3.0) # define OSSL_DEPRECATEDIN_3_0_FOR(msg) OSSL_DEPRECATED_FOR(3.0, msg) # else # define OPENSSL_NO_DEPRECATED_3_0 # endif # else # define OSSL_DEPRECATEDIN_3_0 # define OSSL_DEPRECATEDIN_3_0_FOR(msg) # endif # if OPENSSL_API_LEVEL >= 10101 # ifndef OPENSSL_NO_DEPRECATED # define OSSL_DEPRECATEDIN_1_1_1 OSSL_DEPRECATED(1.1.1) # define OSSL_DEPRECATEDIN_1_1_1_FOR(msg) OSSL_DEPRECATED_FOR(1.1.1, msg) # else # define OPENSSL_NO_DEPRECATED_1_1_1 # endif # else # define OSSL_DEPRECATEDIN_1_1_1 # define OSSL_DEPRECATEDIN_1_1_1_FOR(msg) # endif # if OPENSSL_API_LEVEL >= 10100 # ifndef OPENSSL_NO_DEPRECATED # define OSSL_DEPRECATEDIN_1_1_0 OSSL_DEPRECATED(1.1.0) # define OSSL_DEPRECATEDIN_1_1_0_FOR(msg) OSSL_DEPRECATED_FOR(1.1.0, msg) # else # define OPENSSL_NO_DEPRECATED_1_1_0 # endif # else # define OSSL_DEPRECATEDIN_1_1_0 # define OSSL_DEPRECATEDIN_1_1_0_FOR(msg) # endif # if OPENSSL_API_LEVEL >= 10002 # ifndef OPENSSL_NO_DEPRECATED # define OSSL_DEPRECATEDIN_1_0_2 OSSL_DEPRECATED(1.0.2) # define OSSL_DEPRECATEDIN_1_0_2_FOR(msg) OSSL_DEPRECATED_FOR(1.0.2, msg) # else # define OPENSSL_NO_DEPRECATED_1_0_2 # endif # else # define OSSL_DEPRECATEDIN_1_0_2 # define OSSL_DEPRECATEDIN_1_0_2_FOR(msg) # endif # if OPENSSL_API_LEVEL >= 10001 # ifndef OPENSSL_NO_DEPRECATED # define OSSL_DEPRECATEDIN_1_0_1 OSSL_DEPRECATED(1.0.1) # define OSSL_DEPRECATEDIN_1_0_1_FOR(msg) OSSL_DEPRECATED_FOR(1.0.1, msg) # else # define OPENSSL_NO_DEPRECATED_1_0_1 # endif # else # define OSSL_DEPRECATEDIN_1_0_1 # define OSSL_DEPRECATEDIN_1_0_1_FOR(msg) # endif # if OPENSSL_API_LEVEL >= 10000 # ifndef OPENSSL_NO_DEPRECATED # define OSSL_DEPRECATEDIN_1_0_0 OSSL_DEPRECATED(1.0.0) # define OSSL_DEPRECATEDIN_1_0_0_FOR(msg) OSSL_DEPRECATED_FOR(1.0.0, msg) # else # define OPENSSL_NO_DEPRECATED_1_0_0 # endif # else # define OSSL_DEPRECATEDIN_1_0_0 # define OSSL_DEPRECATEDIN_1_0_0_FOR(msg) # endif # if OPENSSL_API_LEVEL >= 908 # ifndef OPENSSL_NO_DEPRECATED # define OSSL_DEPRECATEDIN_0_9_8 OSSL_DEPRECATED(0.9.8) # define OSSL_DEPRECATEDIN_0_9_8_FOR(msg) OSSL_DEPRECATED_FOR(0.9.8, msg) # else # define OPENSSL_NO_DEPRECATED_0_9_8 # endif # else # define OSSL_DEPRECATEDIN_0_9_8 # define OSSL_DEPRECATEDIN_0_9_8_FOR(msg) # endif /* * Make our own variants of __FILE__ and __LINE__, depending on configuration */ # ifndef OPENSSL_FILE # ifdef OPENSSL_NO_FILENAMES # define OPENSSL_FILE "" # define OPENSSL_LINE 0 # else # define OPENSSL_FILE __FILE__ # define OPENSSL_LINE __LINE__ # endif # endif /* * __func__ was standardized in C99, so for any compiler that claims * to implement that language level or newer, we assume we can safely * use that symbol. * * GNU C also provides __FUNCTION__ since version 2, which predates * C99. We can, however, only use this if __STDC_VERSION__ exists, * as it's otherwise not allowed according to ISO C standards (C90). * (compiling with GNU C's -pedantic tells us so) * * If none of the above applies, we check if the compiler is MSVC, * and use __FUNCTION__ if that's the case. */ # ifndef OPENSSL_FUNC # if defined(__STDC_VERSION__) # if __STDC_VERSION__ >= 199901L # define OPENSSL_FUNC __func__ # elif defined(__GNUC__) && __GNUC__ >= 2 # define OPENSSL_FUNC __FUNCTION__ # endif # elif defined(_MSC_VER) # define OPENSSL_FUNC __FUNCTION__ # endif /* * If all these possibilities are exhausted, we give up and use a * static string. */ # ifndef OPENSSL_FUNC # define OPENSSL_FUNC "(unknown function)" # endif # endif # ifndef OSSL_CRYPTO_ALLOC # if defined(__GNUC__) # define OSSL_CRYPTO_ALLOC __attribute__((__malloc__)) # elif defined(_MSC_VER) # define OSSL_CRYPTO_ALLOC __declspec(restrict) # else # define OSSL_CRYPTO_ALLOC # endif # endif #endif /* OPENSSL_MACROS_H */
10,736
31.834862
86
h
openssl
openssl-master/include/openssl/md2.h
/* * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_MD2_H # define OPENSSL_MD2_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_MD2_H # endif # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_MD2 # include <stddef.h> # ifdef __cplusplus extern "C" { # endif # define MD2_DIGEST_LENGTH 16 # if !defined(OPENSSL_NO_DEPRECATED_3_0) typedef unsigned char MD2_INT; # define MD2_BLOCK 16 typedef struct MD2state_st { unsigned int num; unsigned char data[MD2_BLOCK]; MD2_INT cksm[MD2_BLOCK]; MD2_INT state[MD2_BLOCK]; } MD2_CTX; # endif # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 const char *MD2_options(void); OSSL_DEPRECATEDIN_3_0 int MD2_Init(MD2_CTX *c); OSSL_DEPRECATEDIN_3_0 int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len); OSSL_DEPRECATEDIN_3_0 int MD2_Final(unsigned char *md, MD2_CTX *c); OSSL_DEPRECATEDIN_3_0 unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md); # endif # ifdef __cplusplus } # endif # endif #endif
1,461
24.649123
75
h
openssl
openssl-master/include/openssl/md4.h
/* * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_MD4_H # define OPENSSL_MD4_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_MD4_H # endif # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_MD4 # include <openssl/e_os2.h> # include <stddef.h> # ifdef __cplusplus extern "C" { # endif # define MD4_DIGEST_LENGTH 16 # if !defined(OPENSSL_NO_DEPRECATED_3_0) /*- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * ! MD4_LONG has to be at least 32 bits wide. ! * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ # define MD4_LONG unsigned int # define MD4_CBLOCK 64 # define MD4_LBLOCK (MD4_CBLOCK/4) typedef struct MD4state_st { MD4_LONG A, B, C, D; MD4_LONG Nl, Nh; MD4_LONG data[MD4_LBLOCK]; unsigned int num; } MD4_CTX; # endif # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 int MD4_Init(MD4_CTX *c); OSSL_DEPRECATEDIN_3_0 int MD4_Update(MD4_CTX *c, const void *data, size_t len); OSSL_DEPRECATEDIN_3_0 int MD4_Final(unsigned char *md, MD4_CTX *c); OSSL_DEPRECATEDIN_3_0 unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md); OSSL_DEPRECATEDIN_3_0 void MD4_Transform(MD4_CTX *c, const unsigned char *b); # endif # ifdef __cplusplus } # endif # endif #endif
1,699
25.5625
79
h
openssl
openssl-master/include/openssl/md5.h
/* * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_MD5_H # define OPENSSL_MD5_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_MD5_H # endif # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_MD5 # include <openssl/e_os2.h> # include <stddef.h> # ifdef __cplusplus extern "C" { # endif # define MD5_DIGEST_LENGTH 16 # if !defined(OPENSSL_NO_DEPRECATED_3_0) /* * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * ! MD5_LONG has to be at least 32 bits wide. ! * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ # define MD5_LONG unsigned int # define MD5_CBLOCK 64 # define MD5_LBLOCK (MD5_CBLOCK/4) typedef struct MD5state_st { MD5_LONG A, B, C, D; MD5_LONG Nl, Nh; MD5_LONG data[MD5_LBLOCK]; unsigned int num; } MD5_CTX; # endif # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 int MD5_Init(MD5_CTX *c); OSSL_DEPRECATEDIN_3_0 int MD5_Update(MD5_CTX *c, const void *data, size_t len); OSSL_DEPRECATEDIN_3_0 int MD5_Final(unsigned char *md, MD5_CTX *c); OSSL_DEPRECATEDIN_3_0 unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md); OSSL_DEPRECATEDIN_3_0 void MD5_Transform(MD5_CTX *c, const unsigned char *b); # endif # ifdef __cplusplus } # endif # endif #endif
1,696
25.936508
79
h
openssl
openssl-master/include/openssl/mdc2.h
/* * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_MDC2_H # define OPENSSL_MDC2_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_MDC2_H # endif # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_MDC2 # include <stdlib.h> # include <openssl/des.h> # ifdef __cplusplus extern "C" { # endif # define MDC2_DIGEST_LENGTH 16 # if !defined(OPENSSL_NO_DEPRECATED_3_0) # define MDC2_BLOCK 8 typedef struct mdc2_ctx_st { unsigned int num; unsigned char data[MDC2_BLOCK]; DES_cblock h, hh; unsigned int pad_type; /* either 1 or 2, default 1 */ } MDC2_CTX; # endif # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 int MDC2_Init(MDC2_CTX *c); OSSL_DEPRECATEDIN_3_0 int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len); OSSL_DEPRECATEDIN_3_0 int MDC2_Final(unsigned char *md, MDC2_CTX *c); OSSL_DEPRECATEDIN_3_0 unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md); # endif # ifdef __cplusplus } # endif # endif #endif
1,441
24.75
77
h
openssl
openssl-master/include/openssl/modes.h
/* * Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_MODES_H # define OPENSSL_MODES_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_MODES_H # endif # include <stddef.h> # include <openssl/types.h> # ifdef __cplusplus extern "C" { # endif typedef void (*block128_f) (const unsigned char in[16], unsigned char out[16], const void *key); typedef void (*cbc128_f) (const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], int enc); typedef void (*ecb128_f) (const unsigned char *in, unsigned char *out, size_t len, const void *key, int enc); typedef void (*ctr128_f) (const unsigned char *in, unsigned char *out, size_t blocks, const void *key, const unsigned char ivec[16]); typedef void (*ccm128_f) (const unsigned char *in, unsigned char *out, size_t blocks, const void *key, const unsigned char ivec[16], unsigned char cmac[16]); void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], block128_f block); void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], block128_f block); void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], unsigned char ecount_buf[16], unsigned int *num, block128_f block); void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], unsigned char ecount_buf[16], unsigned int *num, ctr128_f ctr); void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], int *num, block128_f block); void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], int *num, int enc, block128_f block); void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out, size_t length, const void *key, unsigned char ivec[16], int *num, int enc, block128_f block); void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out, size_t bits, const void *key, unsigned char ivec[16], int *num, int enc, block128_f block); size_t CRYPTO_cts128_encrypt_block(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], block128_f block); size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], cbc128_f cbc); size_t CRYPTO_cts128_decrypt_block(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], block128_f block); size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], cbc128_f cbc); size_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], block128_f block); size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], cbc128_f cbc); size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], block128_f block); size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key, unsigned char ivec[16], cbc128_f cbc); typedef struct gcm128_context GCM128_CONTEXT; GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block); void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block); void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, size_t len); int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, size_t len); int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, const unsigned char *in, unsigned char *out, size_t len); int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, const unsigned char *in, unsigned char *out, size_t len); int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, const unsigned char *in, unsigned char *out, size_t len, ctr128_f stream); int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, const unsigned char *in, unsigned char *out, size_t len, ctr128_f stream); int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag, size_t len); void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len); void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx); typedef struct ccm128_context CCM128_CONTEXT; void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx, unsigned int M, unsigned int L, void *key, block128_f block); int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx, const unsigned char *nonce, size_t nlen, size_t mlen); void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx, const unsigned char *aad, size_t alen); int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, const unsigned char *inp, unsigned char *out, size_t len); int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, const unsigned char *inp, unsigned char *out, size_t len); int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp, unsigned char *out, size_t len, ccm128_f stream); int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp, unsigned char *out, size_t len, ccm128_f stream); size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len); typedef struct xts128_context XTS128_CONTEXT; int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], const unsigned char *inp, unsigned char *out, size_t len, int enc); size_t CRYPTO_128_wrap(void *key, const unsigned char *iv, unsigned char *out, const unsigned char *in, size_t inlen, block128_f block); size_t CRYPTO_128_unwrap(void *key, const unsigned char *iv, unsigned char *out, const unsigned char *in, size_t inlen, block128_f block); size_t CRYPTO_128_wrap_pad(void *key, const unsigned char *icv, unsigned char *out, const unsigned char *in, size_t inlen, block128_f block); size_t CRYPTO_128_unwrap_pad(void *key, const unsigned char *icv, unsigned char *out, const unsigned char *in, size_t inlen, block128_f block); # ifndef OPENSSL_NO_OCB typedef struct ocb128_context OCB128_CONTEXT; typedef void (*ocb128_f) (const unsigned char *in, unsigned char *out, size_t blocks, const void *key, size_t start_block_num, unsigned char offset_i[16], const unsigned char L_[][16], unsigned char checksum[16]); OCB128_CONTEXT *CRYPTO_ocb128_new(void *keyenc, void *keydec, block128_f encrypt, block128_f decrypt, ocb128_f stream); int CRYPTO_ocb128_init(OCB128_CONTEXT *ctx, void *keyenc, void *keydec, block128_f encrypt, block128_f decrypt, ocb128_f stream); int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src, void *keyenc, void *keydec); int CRYPTO_ocb128_setiv(OCB128_CONTEXT *ctx, const unsigned char *iv, size_t len, size_t taglen); int CRYPTO_ocb128_aad(OCB128_CONTEXT *ctx, const unsigned char *aad, size_t len); int CRYPTO_ocb128_encrypt(OCB128_CONTEXT *ctx, const unsigned char *in, unsigned char *out, size_t len); int CRYPTO_ocb128_decrypt(OCB128_CONTEXT *ctx, const unsigned char *in, unsigned char *out, size_t len); int CRYPTO_ocb128_finish(OCB128_CONTEXT *ctx, const unsigned char *tag, size_t len); int CRYPTO_ocb128_tag(OCB128_CONTEXT *ctx, unsigned char *tag, size_t len); void CRYPTO_ocb128_cleanup(OCB128_CONTEXT *ctx); # endif /* OPENSSL_NO_OCB */ # ifdef __cplusplus } # endif #endif
10,786
48.031818
78
h
openssl
openssl-master/include/openssl/objects.h
/* * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_OBJECTS_H # define OPENSSL_OBJECTS_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_OBJECTS_H # endif # include <openssl/obj_mac.h> # include <openssl/bio.h> # include <openssl/asn1.h> # include <openssl/objectserr.h> # define OBJ_NAME_TYPE_UNDEF 0x00 # define OBJ_NAME_TYPE_MD_METH 0x01 # define OBJ_NAME_TYPE_CIPHER_METH 0x02 # define OBJ_NAME_TYPE_PKEY_METH 0x03 # define OBJ_NAME_TYPE_COMP_METH 0x04 # define OBJ_NAME_TYPE_MAC_METH 0x05 # define OBJ_NAME_TYPE_KDF_METH 0x06 # define OBJ_NAME_TYPE_NUM 0x07 # define OBJ_NAME_ALIAS 0x8000 # define OBJ_BSEARCH_VALUE_ON_NOMATCH 0x01 # define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH 0x02 #ifdef __cplusplus extern "C" { #endif typedef struct obj_name_st { int type; int alias; const char *name; const char *data; } OBJ_NAME; # define OBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c) int OBJ_NAME_init(void); int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *), int (*cmp_func) (const char *, const char *), void (*free_func) (const char *, int, const char *)); const char *OBJ_NAME_get(const char *name, int type); int OBJ_NAME_add(const char *name, int type, const char *data); int OBJ_NAME_remove(const char *name, int type); void OBJ_NAME_cleanup(int type); /* -1 for everything */ void OBJ_NAME_do_all(int type, void (*fn) (const OBJ_NAME *, void *arg), void *arg); void OBJ_NAME_do_all_sorted(int type, void (*fn) (const OBJ_NAME *, void *arg), void *arg); DECLARE_ASN1_DUP_FUNCTION_name(ASN1_OBJECT, OBJ) ASN1_OBJECT *OBJ_nid2obj(int n); const char *OBJ_nid2ln(int n); const char *OBJ_nid2sn(int n); int OBJ_obj2nid(const ASN1_OBJECT *o); ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name); int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name); int OBJ_txt2nid(const char *s); int OBJ_ln2nid(const char *s); int OBJ_sn2nid(const char *s); int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b); const void *OBJ_bsearch_(const void *key, const void *base, int num, int size, int (*cmp) (const void *, const void *)); const void *OBJ_bsearch_ex_(const void *key, const void *base, int num, int size, int (*cmp) (const void *, const void *), int flags); # define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm) \ static int nm##_cmp_BSEARCH_CMP_FN(const void *, const void *); \ static int nm##_cmp(type1 const *, type2 const *); \ scope type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) # define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp) \ _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp) # define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) /*- * Unsolved problem: if a type is actually a pointer type, like * nid_triple is, then its impossible to get a const where you need * it. Consider: * * typedef int nid_triple[3]; * const void *a_; * const nid_triple const *a = a_; * * The assignment discards a const because what you really want is: * * const int const * const *a = a_; * * But if you do that, you lose the fact that a is an array of 3 ints, * which breaks comparison functions. * * Thus we end up having to cast, sadly, or unpack the * declarations. Or, as I finally did in this case, declare nid_triple * to be a struct, which it should have been in the first place. * * Ben, August 2008. * * Also, strictly speaking not all types need be const, but handling * the non-constness means a lot of complication, and in practice * comparison routines do always not touch their arguments. */ # define IMPLEMENT_OBJ_BSEARCH_CMP_FN(type1, type2, nm) \ static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ { \ type1 const *a = a_; \ type2 const *b = b_; \ return nm##_cmp(a,b); \ } \ static type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ { \ return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ nm##_cmp_BSEARCH_CMP_FN); \ } \ extern void dummy_prototype(void) # define IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ { \ type1 const *a = a_; \ type2 const *b = b_; \ return nm##_cmp(a,b); \ } \ type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ { \ return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ nm##_cmp_BSEARCH_CMP_FN); \ } \ extern void dummy_prototype(void) # define OBJ_bsearch(type1,key,type2,base,num,cmp) \ ((type2 *)OBJ_bsearch_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ num,sizeof(type2), \ ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ (void)CHECKED_PTR_OF(type2,cmp##_type_2), \ cmp##_BSEARCH_CMP_FN))) # define OBJ_bsearch_ex(type1,key,type2,base,num,cmp,flags) \ ((type2 *)OBJ_bsearch_ex_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ num,sizeof(type2), \ ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ (void)type_2=CHECKED_PTR_OF(type2,cmp##_type_2), \ cmp##_BSEARCH_CMP_FN)),flags) int OBJ_new_nid(int num); int OBJ_add_object(const ASN1_OBJECT *obj); int OBJ_create(const char *oid, const char *sn, const char *ln); #ifndef OPENSSL_NO_DEPRECATED_1_1_0 # define OBJ_cleanup() while(0) continue #endif int OBJ_create_objects(BIO *in); size_t OBJ_length(const ASN1_OBJECT *obj); const unsigned char *OBJ_get0_data(const ASN1_OBJECT *obj); int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid); int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid); int OBJ_add_sigid(int signid, int dig_id, int pkey_id); void OBJ_sigid_free(void); # ifdef __cplusplus } # endif #endif
6,848
36.222826
83
h
openssl
openssl-master/include/openssl/objectserr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_OBJECTSERR_H # define OPENSSL_OBJECTSERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> /* * OBJ reason codes. */ # define OBJ_R_OID_EXISTS 102 # define OBJ_R_UNKNOWN_NID 101 # define OBJ_R_UNKNOWN_OBJECT_NAME 103 #endif
782
26
74
h
openssl
openssl-master/include/openssl/ocsperr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_OCSPERR_H # define OPENSSL_OCSPERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> # ifndef OPENSSL_NO_OCSP /* * OCSP reason codes. */ # define OCSP_R_CERTIFICATE_VERIFY_ERROR 101 # define OCSP_R_DIGEST_ERR 102 # define OCSP_R_DIGEST_NAME_ERR 106 # define OCSP_R_DIGEST_SIZE_ERR 107 # define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD 122 # define OCSP_R_ERROR_IN_THISUPDATE_FIELD 123 # define OCSP_R_MISSING_OCSPSIGNING_USAGE 103 # define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE 124 # define OCSP_R_NOT_BASIC_RESPONSE 104 # define OCSP_R_NO_CERTIFICATES_IN_CHAIN 105 # define OCSP_R_NO_RESPONSE_DATA 108 # define OCSP_R_NO_REVOKED_TIME 109 # define OCSP_R_NO_SIGNER_KEY 130 # define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 110 # define OCSP_R_REQUEST_NOT_SIGNED 128 # define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA 111 # define OCSP_R_ROOT_CA_NOT_TRUSTED 112 # define OCSP_R_SIGNATURE_FAILURE 117 # define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND 118 # define OCSP_R_STATUS_EXPIRED 125 # define OCSP_R_STATUS_NOT_YET_VALID 126 # define OCSP_R_STATUS_TOO_OLD 127 # define OCSP_R_UNKNOWN_MESSAGE_DIGEST 119 # define OCSP_R_UNKNOWN_NID 120 # define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE 129 # endif #endif
2,200
39.759259
74
h
openssl
openssl-master/include/openssl/opensslconf.h
/* * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_OPENSSLCONF_H # define OPENSSL_OPENSSLCONF_H # pragma once # include <openssl/configuration.h> # include <openssl/macros.h> #endif /* OPENSSL_OPENSSLCONF_H */
515
27.666667
74
h
openssl
openssl-master/include/openssl/ossl_typ.h
/* * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ /* * The original <openssl/ossl_typ.h> was renamed to <openssl/types.h> * * This header file only exists for compatibility reasons with older * applications which #include <openssl/ossl_typ.h>. */ # include <openssl/types.h>
562
32.117647
74
h
openssl
openssl-master/include/openssl/param_build.h
/* * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_PARAM_BUILD_H # define OPENSSL_PARAM_BUILD_H # pragma once # include <openssl/params.h> # include <openssl/types.h> # ifdef __cplusplus extern "C" { # endif OSSL_PARAM_BLD *OSSL_PARAM_BLD_new(void); OSSL_PARAM *OSSL_PARAM_BLD_to_param(OSSL_PARAM_BLD *bld); void OSSL_PARAM_BLD_free(OSSL_PARAM_BLD *bld); int OSSL_PARAM_BLD_push_int(OSSL_PARAM_BLD *bld, const char *key, int val); int OSSL_PARAM_BLD_push_uint(OSSL_PARAM_BLD *bld, const char *key, unsigned int val); int OSSL_PARAM_BLD_push_long(OSSL_PARAM_BLD *bld, const char *key, long int val); int OSSL_PARAM_BLD_push_ulong(OSSL_PARAM_BLD *bld, const char *key, unsigned long int val); int OSSL_PARAM_BLD_push_int32(OSSL_PARAM_BLD *bld, const char *key, int32_t val); int OSSL_PARAM_BLD_push_uint32(OSSL_PARAM_BLD *bld, const char *key, uint32_t val); int OSSL_PARAM_BLD_push_int64(OSSL_PARAM_BLD *bld, const char *key, int64_t val); int OSSL_PARAM_BLD_push_uint64(OSSL_PARAM_BLD *bld, const char *key, uint64_t val); int OSSL_PARAM_BLD_push_size_t(OSSL_PARAM_BLD *bld, const char *key, size_t val); int OSSL_PARAM_BLD_push_time_t(OSSL_PARAM_BLD *bld, const char *key, time_t val); int OSSL_PARAM_BLD_push_double(OSSL_PARAM_BLD *bld, const char *key, double val); int OSSL_PARAM_BLD_push_BN(OSSL_PARAM_BLD *bld, const char *key, const BIGNUM *bn); int OSSL_PARAM_BLD_push_BN_pad(OSSL_PARAM_BLD *bld, const char *key, const BIGNUM *bn, size_t sz); int OSSL_PARAM_BLD_push_utf8_string(OSSL_PARAM_BLD *bld, const char *key, const char *buf, size_t bsize); int OSSL_PARAM_BLD_push_utf8_ptr(OSSL_PARAM_BLD *bld, const char *key, char *buf, size_t bsize); int OSSL_PARAM_BLD_push_octet_string(OSSL_PARAM_BLD *bld, const char *key, const void *buf, size_t bsize); int OSSL_PARAM_BLD_push_octet_ptr(OSSL_PARAM_BLD *bld, const char *key, void *buf, size_t bsize); # ifdef __cplusplus } # endif #endif /* OPENSSL_PARAM_BUILD_H */
2,809
42.90625
75
h
openssl
openssl-master/include/openssl/params.h
/* * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_PARAMS_H # define OPENSSL_PARAMS_H # pragma once # include <openssl/core.h> # include <openssl/bn.h> # ifdef __cplusplus extern "C" { # endif # define OSSL_PARAM_UNMODIFIED ((size_t)-1) # define OSSL_PARAM_END \ { NULL, 0, NULL, 0, 0 } # define OSSL_PARAM_DEFN(key, type, addr, sz) \ { (key), (type), (addr), (sz), OSSL_PARAM_UNMODIFIED } /* Basic parameter types without return sizes */ # define OSSL_PARAM_int(key, addr) \ OSSL_PARAM_DEFN((key), OSSL_PARAM_INTEGER, (addr), sizeof(int)) # define OSSL_PARAM_uint(key, addr) \ OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (addr), \ sizeof(unsigned int)) # define OSSL_PARAM_long(key, addr) \ OSSL_PARAM_DEFN((key), OSSL_PARAM_INTEGER, (addr), sizeof(long int)) # define OSSL_PARAM_ulong(key, addr) \ OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (addr), \ sizeof(unsigned long int)) # define OSSL_PARAM_int32(key, addr) \ OSSL_PARAM_DEFN((key), OSSL_PARAM_INTEGER, (addr), sizeof(int32_t)) # define OSSL_PARAM_uint32(key, addr) \ OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (addr), \ sizeof(uint32_t)) # define OSSL_PARAM_int64(key, addr) \ OSSL_PARAM_DEFN((key), OSSL_PARAM_INTEGER, (addr), sizeof(int64_t)) # define OSSL_PARAM_uint64(key, addr) \ OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (addr), \ sizeof(uint64_t)) # define OSSL_PARAM_size_t(key, addr) \ OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (addr), sizeof(size_t)) # define OSSL_PARAM_time_t(key, addr) \ OSSL_PARAM_DEFN((key), OSSL_PARAM_INTEGER, (addr), sizeof(time_t)) # define OSSL_PARAM_double(key, addr) \ OSSL_PARAM_DEFN((key), OSSL_PARAM_REAL, (addr), sizeof(double)) # define OSSL_PARAM_BN(key, bn, sz) \ OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (bn), (sz)) # define OSSL_PARAM_utf8_string(key, addr, sz) \ OSSL_PARAM_DEFN((key), OSSL_PARAM_UTF8_STRING, (addr), sz) # define OSSL_PARAM_octet_string(key, addr, sz) \ OSSL_PARAM_DEFN((key), OSSL_PARAM_OCTET_STRING, (addr), sz) # define OSSL_PARAM_utf8_ptr(key, addr, sz) \ OSSL_PARAM_DEFN((key), OSSL_PARAM_UTF8_PTR, (addr), sz) # define OSSL_PARAM_octet_ptr(key, addr, sz) \ OSSL_PARAM_DEFN((key), OSSL_PARAM_OCTET_PTR, (addr), sz) /* Search an OSSL_PARAM array for a matching name */ OSSL_PARAM *OSSL_PARAM_locate(OSSL_PARAM *p, const char *key); const OSSL_PARAM *OSSL_PARAM_locate_const(const OSSL_PARAM *p, const char *key); /* Basic parameter type run-time construction */ OSSL_PARAM OSSL_PARAM_construct_int(const char *key, int *buf); OSSL_PARAM OSSL_PARAM_construct_uint(const char *key, unsigned int *buf); OSSL_PARAM OSSL_PARAM_construct_long(const char *key, long int *buf); OSSL_PARAM OSSL_PARAM_construct_ulong(const char *key, unsigned long int *buf); OSSL_PARAM OSSL_PARAM_construct_int32(const char *key, int32_t *buf); OSSL_PARAM OSSL_PARAM_construct_uint32(const char *key, uint32_t *buf); OSSL_PARAM OSSL_PARAM_construct_int64(const char *key, int64_t *buf); OSSL_PARAM OSSL_PARAM_construct_uint64(const char *key, uint64_t *buf); OSSL_PARAM OSSL_PARAM_construct_size_t(const char *key, size_t *buf); OSSL_PARAM OSSL_PARAM_construct_time_t(const char *key, time_t *buf); OSSL_PARAM OSSL_PARAM_construct_BN(const char *key, unsigned char *buf, size_t bsize); OSSL_PARAM OSSL_PARAM_construct_double(const char *key, double *buf); OSSL_PARAM OSSL_PARAM_construct_utf8_string(const char *key, char *buf, size_t bsize); OSSL_PARAM OSSL_PARAM_construct_utf8_ptr(const char *key, char **buf, size_t bsize); OSSL_PARAM OSSL_PARAM_construct_octet_string(const char *key, void *buf, size_t bsize); OSSL_PARAM OSSL_PARAM_construct_octet_ptr(const char *key, void **buf, size_t bsize); OSSL_PARAM OSSL_PARAM_construct_end(void); int OSSL_PARAM_allocate_from_text(OSSL_PARAM *to, const OSSL_PARAM *paramdefs, const char *key, const char *value, size_t value_n, int *found); int OSSL_PARAM_get_int(const OSSL_PARAM *p, int *val); int OSSL_PARAM_get_uint(const OSSL_PARAM *p, unsigned int *val); int OSSL_PARAM_get_long(const OSSL_PARAM *p, long int *val); int OSSL_PARAM_get_ulong(const OSSL_PARAM *p, unsigned long int *val); int OSSL_PARAM_get_int32(const OSSL_PARAM *p, int32_t *val); int OSSL_PARAM_get_uint32(const OSSL_PARAM *p, uint32_t *val); int OSSL_PARAM_get_int64(const OSSL_PARAM *p, int64_t *val); int OSSL_PARAM_get_uint64(const OSSL_PARAM *p, uint64_t *val); int OSSL_PARAM_get_size_t(const OSSL_PARAM *p, size_t *val); int OSSL_PARAM_get_time_t(const OSSL_PARAM *p, time_t *val); int OSSL_PARAM_set_int(OSSL_PARAM *p, int val); int OSSL_PARAM_set_uint(OSSL_PARAM *p, unsigned int val); int OSSL_PARAM_set_long(OSSL_PARAM *p, long int val); int OSSL_PARAM_set_ulong(OSSL_PARAM *p, unsigned long int val); int OSSL_PARAM_set_int32(OSSL_PARAM *p, int32_t val); int OSSL_PARAM_set_uint32(OSSL_PARAM *p, uint32_t val); int OSSL_PARAM_set_int64(OSSL_PARAM *p, int64_t val); int OSSL_PARAM_set_uint64(OSSL_PARAM *p, uint64_t val); int OSSL_PARAM_set_size_t(OSSL_PARAM *p, size_t val); int OSSL_PARAM_set_time_t(OSSL_PARAM *p, time_t val); int OSSL_PARAM_get_double(const OSSL_PARAM *p, double *val); int OSSL_PARAM_set_double(OSSL_PARAM *p, double val); int OSSL_PARAM_get_BN(const OSSL_PARAM *p, BIGNUM **val); int OSSL_PARAM_set_BN(OSSL_PARAM *p, const BIGNUM *val); int OSSL_PARAM_get_utf8_string(const OSSL_PARAM *p, char **val, size_t max_len); int OSSL_PARAM_set_utf8_string(OSSL_PARAM *p, const char *val); int OSSL_PARAM_get_octet_string(const OSSL_PARAM *p, void **val, size_t max_len, size_t *used_len); int OSSL_PARAM_set_octet_string(OSSL_PARAM *p, const void *val, size_t len); int OSSL_PARAM_get_utf8_ptr(const OSSL_PARAM *p, const char **val); int OSSL_PARAM_set_utf8_ptr(OSSL_PARAM *p, const char *val); int OSSL_PARAM_get_octet_ptr(const OSSL_PARAM *p, const void **val, size_t *used_len); int OSSL_PARAM_set_octet_ptr(OSSL_PARAM *p, const void *val, size_t used_len); int OSSL_PARAM_get_utf8_string_ptr(const OSSL_PARAM *p, const char **val); int OSSL_PARAM_get_octet_string_ptr(const OSSL_PARAM *p, const void **val, size_t *used_len); int OSSL_PARAM_modified(const OSSL_PARAM *p); void OSSL_PARAM_set_all_unmodified(OSSL_PARAM *p); OSSL_PARAM *OSSL_PARAM_dup(const OSSL_PARAM *p); OSSL_PARAM *OSSL_PARAM_merge(const OSSL_PARAM *p1, const OSSL_PARAM *p2); void OSSL_PARAM_free(OSSL_PARAM *p); # ifdef __cplusplus } # endif #endif
7,328
44.521739
80
h
openssl
openssl-master/include/openssl/pem2.h
/* * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_PEM2_H # define OPENSSL_PEM2_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_PEM2_H # endif # include <openssl/pemerr.h> #endif
531
25.6
74
h
openssl
openssl-master/include/openssl/pemerr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_PEMERR_H # define OPENSSL_PEMERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> /* * PEM reason codes. */ # define PEM_R_BAD_BASE64_DECODE 100 # define PEM_R_BAD_DECRYPT 101 # define PEM_R_BAD_END_LINE 102 # define PEM_R_BAD_IV_CHARS 103 # define PEM_R_BAD_MAGIC_NUMBER 116 # define PEM_R_BAD_PASSWORD_READ 104 # define PEM_R_BAD_VERSION_NUMBER 117 # define PEM_R_BIO_WRITE_FAILURE 118 # define PEM_R_CIPHER_IS_NULL 127 # define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115 # define PEM_R_EXPECTING_DSS_KEY_BLOB 131 # define PEM_R_EXPECTING_PRIVATE_KEY_BLOB 119 # define PEM_R_EXPECTING_PUBLIC_KEY_BLOB 120 # define PEM_R_EXPECTING_RSA_KEY_BLOB 132 # define PEM_R_HEADER_TOO_LONG 128 # define PEM_R_INCONSISTENT_HEADER 121 # define PEM_R_KEYBLOB_HEADER_PARSE_ERROR 122 # define PEM_R_KEYBLOB_TOO_SHORT 123 # define PEM_R_MISSING_DEK_IV 129 # define PEM_R_NOT_DEK_INFO 105 # define PEM_R_NOT_ENCRYPTED 106 # define PEM_R_NOT_PROC_TYPE 107 # define PEM_R_NO_START_LINE 108 # define PEM_R_PROBLEMS_GETTING_PASSWORD 109 # define PEM_R_PVK_DATA_TOO_SHORT 124 # define PEM_R_PVK_TOO_SHORT 125 # define PEM_R_READ_KEY 111 # define PEM_R_SHORT_HEADER 112 # define PEM_R_UNEXPECTED_DEK_IV 130 # define PEM_R_UNSUPPORTED_CIPHER 113 # define PEM_R_UNSUPPORTED_ENCRYPTION 114 # define PEM_R_UNSUPPORTED_KEY_COMPONENTS 126 # define PEM_R_UNSUPPORTED_PUBLIC_KEY_TYPE 110 #endif
2,634
43.661017
74
h
openssl
openssl-master/include/openssl/pkcs12err.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_PKCS12ERR_H # define OPENSSL_PKCS12ERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> /* * PKCS12 reason codes. */ # define PKCS12_R_CALLBACK_FAILED 115 # define PKCS12_R_CANT_PACK_STRUCTURE 100 # define PKCS12_R_CONTENT_TYPE_NOT_DATA 121 # define PKCS12_R_DECODE_ERROR 101 # define PKCS12_R_ENCODE_ERROR 102 # define PKCS12_R_ENCRYPT_ERROR 103 # define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE 120 # define PKCS12_R_INVALID_NULL_ARGUMENT 104 # define PKCS12_R_INVALID_NULL_PKCS12_POINTER 105 # define PKCS12_R_INVALID_TYPE 112 # define PKCS12_R_IV_GEN_ERROR 106 # define PKCS12_R_KEY_GEN_ERROR 107 # define PKCS12_R_MAC_ABSENT 108 # define PKCS12_R_MAC_GENERATION_ERROR 109 # define PKCS12_R_MAC_SETUP_ERROR 110 # define PKCS12_R_MAC_STRING_SET_ERROR 111 # define PKCS12_R_MAC_VERIFY_FAILURE 113 # define PKCS12_R_PARSE_ERROR 114 # define PKCS12_R_PKCS12_CIPHERFINAL_ERROR 116 # define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM 118 # define PKCS12_R_UNSUPPORTED_PKCS12_MODE 119 #endif
1,899
39.425532
74
h
openssl
openssl-master/include/openssl/pkcs7err.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_PKCS7ERR_H # define OPENSSL_PKCS7ERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> /* * PKCS7 reason codes. */ # define PKCS7_R_CERTIFICATE_VERIFY_ERROR 117 # define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 144 # define PKCS7_R_CIPHER_NOT_INITIALIZED 116 # define PKCS7_R_CONTENT_AND_DATA_PRESENT 118 # define PKCS7_R_CTRL_ERROR 152 # define PKCS7_R_DECRYPT_ERROR 119 # define PKCS7_R_DIGEST_FAILURE 101 # define PKCS7_R_ENCRYPTION_CTRL_FAILURE 149 # define PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 150 # define PKCS7_R_ERROR_ADDING_RECIPIENT 120 # define PKCS7_R_ERROR_SETTING_CIPHER 121 # define PKCS7_R_INVALID_NULL_POINTER 143 # define PKCS7_R_INVALID_SIGNED_DATA_TYPE 155 # define PKCS7_R_NO_CONTENT 122 # define PKCS7_R_NO_DEFAULT_DIGEST 151 # define PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND 154 # define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115 # define PKCS7_R_NO_SIGNATURES_ON_DATA 123 # define PKCS7_R_NO_SIGNERS 142 # define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104 # define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124 # define PKCS7_R_PKCS7_ADD_SIGNER_ERROR 153 # define PKCS7_R_PKCS7_DATASIGN 145 # define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127 # define PKCS7_R_SIGNATURE_FAILURE 105 # define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND 128 # define PKCS7_R_SIGNING_CTRL_FAILURE 147 # define PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 148 # define PKCS7_R_SMIME_TEXT_ERROR 129 # define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 106 # define PKCS7_R_UNABLE_TO_FIND_MEM_BIO 107 # define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST 108 # define PKCS7_R_UNKNOWN_DIGEST_TYPE 109 # define PKCS7_R_UNKNOWN_OPERATION 110 # define PKCS7_R_UNSUPPORTED_CIPHER_TYPE 111 # define PKCS7_R_UNSUPPORTED_CONTENT_TYPE 112 # define PKCS7_R_WRONG_CONTENT_TYPE 113 # define PKCS7_R_WRONG_PKCS7_TYPE 114 #endif
2,952
45.140625
74
h
openssl
openssl-master/include/openssl/prov_ssl.h
/* * Copyright 2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_PROV_SSL_H # define OPENSSL_PROV_SSL_H # pragma once # ifdef __cplusplus extern "C" { # endif /* SSL/TLS related defines useful to providers */ # define SSL_MAX_MASTER_KEY_LENGTH 48 /* SSL/TLS uses a 2 byte unsigned version number */ # 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_BAD_VER 0x0100 /* QUIC uses a 4 byte unsigned version number */ # define OSSL_QUIC1_VERSION 0x0000001 # ifdef __cplusplus } # endif #endif /* OPENSSL_PROV_SSL_H */
1,134
28.102564
74
h
openssl
openssl-master/include/openssl/proverr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_PROVERR_H # define OPENSSL_PROVERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> /* * PROV reason codes. */ # define PROV_R_ADDITIONAL_INPUT_TOO_LONG 184 # define PROV_R_ALGORITHM_MISMATCH 173 # define PROV_R_ALREADY_INSTANTIATED 185 # define PROV_R_BAD_DECRYPT 100 # define PROV_R_BAD_ENCODING 141 # define PROV_R_BAD_LENGTH 142 # define PROV_R_BAD_TLS_CLIENT_VERSION 161 # define PROV_R_BN_ERROR 160 # define PROV_R_CIPHER_OPERATION_FAILED 102 # define PROV_R_DERIVATION_FUNCTION_INIT_FAILED 205 # define PROV_R_DIGEST_NOT_ALLOWED 174 # define PROV_R_EMS_NOT_ENABLED 233 # define PROV_R_ENTROPY_SOURCE_STRENGTH_TOO_WEAK 186 # define PROV_R_ERROR_INSTANTIATING_DRBG 188 # define PROV_R_ERROR_RETRIEVING_ENTROPY 189 # define PROV_R_ERROR_RETRIEVING_NONCE 190 # define PROV_R_FAILED_DURING_DERIVATION 164 # define PROV_R_FAILED_TO_CREATE_LOCK 180 # define PROV_R_FAILED_TO_DECRYPT 162 # define PROV_R_FAILED_TO_GENERATE_KEY 121 # define PROV_R_FAILED_TO_GET_PARAMETER 103 # define PROV_R_FAILED_TO_SET_PARAMETER 104 # define PROV_R_FAILED_TO_SIGN 175 # define PROV_R_FIPS_MODULE_CONDITIONAL_ERROR 227 # define PROV_R_FIPS_MODULE_ENTERING_ERROR_STATE 224 # define PROV_R_FIPS_MODULE_IN_ERROR_STATE 225 # define PROV_R_GENERATE_ERROR 191 # define PROV_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE 165 # define PROV_R_INDICATOR_INTEGRITY_FAILURE 210 # define PROV_R_INSUFFICIENT_DRBG_STRENGTH 181 # define PROV_R_INVALID_AAD 108 # define PROV_R_INVALID_AEAD 231 # define PROV_R_INVALID_CONFIG_DATA 211 # define PROV_R_INVALID_CONSTANT_LENGTH 157 # define PROV_R_INVALID_CURVE 176 # define PROV_R_INVALID_CUSTOM_LENGTH 111 # define PROV_R_INVALID_DATA 115 # define PROV_R_INVALID_DIGEST 122 # define PROV_R_INVALID_DIGEST_LENGTH 166 # define PROV_R_INVALID_DIGEST_SIZE 218 # define PROV_R_INVALID_INPUT_LENGTH 230 # define PROV_R_INVALID_ITERATION_COUNT 123 # define PROV_R_INVALID_IV_LENGTH 109 # define PROV_R_INVALID_KDF 232 # define PROV_R_INVALID_KEY 158 # define PROV_R_INVALID_KEY_LENGTH 105 # define PROV_R_INVALID_MAC 151 # define PROV_R_INVALID_MEMORY_SIZE 235 # define PROV_R_INVALID_MGF1_MD 167 # define PROV_R_INVALID_MODE 125 # define PROV_R_INVALID_OUTPUT_LENGTH 217 # define PROV_R_INVALID_PADDING_MODE 168 # define PROV_R_INVALID_PUBINFO 198 # define PROV_R_INVALID_SALT_LENGTH 112 # define PROV_R_INVALID_SEED_LENGTH 154 # define PROV_R_INVALID_SIGNATURE_SIZE 179 # define PROV_R_INVALID_STATE 212 # define PROV_R_INVALID_TAG 110 # define PROV_R_INVALID_TAG_LENGTH 118 # define PROV_R_INVALID_THREAD_POOL_SIZE 234 # define PROV_R_INVALID_UKM_LENGTH 200 # define PROV_R_INVALID_X931_DIGEST 170 # define PROV_R_IN_ERROR_STATE 192 # define PROV_R_KEY_SETUP_FAILED 101 # define PROV_R_KEY_SIZE_TOO_SMALL 171 # define PROV_R_LENGTH_TOO_LARGE 202 # define PROV_R_MISMATCHING_DOMAIN_PARAMETERS 203 # define PROV_R_MISSING_CEK_ALG 144 # define PROV_R_MISSING_CIPHER 155 # define PROV_R_MISSING_CONFIG_DATA 213 # define PROV_R_MISSING_CONSTANT 156 # define PROV_R_MISSING_KEY 128 # define PROV_R_MISSING_MAC 150 # define PROV_R_MISSING_MESSAGE_DIGEST 129 # define PROV_R_MISSING_OID 209 # define PROV_R_MISSING_PASS 130 # define PROV_R_MISSING_SALT 131 # define PROV_R_MISSING_SECRET 132 # define PROV_R_MISSING_SEED 140 # define PROV_R_MISSING_SESSION_ID 133 # define PROV_R_MISSING_TYPE 134 # define PROV_R_MISSING_XCGHASH 135 # define PROV_R_MODULE_INTEGRITY_FAILURE 214 # define PROV_R_NOT_A_PRIVATE_KEY 221 # define PROV_R_NOT_A_PUBLIC_KEY 220 # define PROV_R_NOT_INSTANTIATED 193 # define PROV_R_NOT_PARAMETERS 226 # define PROV_R_NOT_SUPPORTED 136 # define PROV_R_NOT_XOF_OR_INVALID_LENGTH 113 # define PROV_R_NO_KEY_SET 114 # define PROV_R_NO_PARAMETERS_SET 177 # define PROV_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 178 # define PROV_R_OUTPUT_BUFFER_TOO_SMALL 106 # define PROV_R_PARENT_CANNOT_GENERATE_RANDOM_NUMBERS 228 # define PROV_R_PARENT_CANNOT_SUPPLY_ENTROPY_SEED 187 # define PROV_R_PARENT_LOCKING_NOT_ENABLED 182 # define PROV_R_PARENT_STRENGTH_TOO_WEAK 194 # define PROV_R_PATH_MUST_BE_ABSOLUTE 219 # define PROV_R_PERSONALISATION_STRING_TOO_LONG 195 # define PROV_R_PSS_SALTLEN_TOO_SMALL 172 # define PROV_R_REQUEST_TOO_LARGE_FOR_DRBG 196 # define PROV_R_REQUIRE_CTR_MODE_CIPHER 206 # define PROV_R_RESEED_ERROR 197 # define PROV_R_SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES 222 # define PROV_R_SEED_SOURCES_MUST_NOT_HAVE_A_PARENT 229 # define PROV_R_SELF_TEST_KAT_FAILURE 215 # define PROV_R_SELF_TEST_POST_FAILURE 216 # define PROV_R_TAG_NOT_NEEDED 120 # define PROV_R_TAG_NOT_SET 119 # define PROV_R_TOO_MANY_RECORDS 126 # define PROV_R_UNABLE_TO_FIND_CIPHERS 207 # define PROV_R_UNABLE_TO_GET_PARENT_STRENGTH 199 # define PROV_R_UNABLE_TO_GET_PASSPHRASE 159 # define PROV_R_UNABLE_TO_INITIALISE_CIPHERS 208 # define PROV_R_UNABLE_TO_LOAD_SHA256 147 # define PROV_R_UNABLE_TO_LOCK_PARENT 201 # define PROV_R_UNABLE_TO_RESEED 204 # define PROV_R_UNSUPPORTED_CEK_ALG 145 # define PROV_R_UNSUPPORTED_KEY_SIZE 153 # define PROV_R_UNSUPPORTED_MAC_TYPE 137 # define PROV_R_UNSUPPORTED_NUMBER_OF_ROUNDS 152 # define PROV_R_URI_AUTHORITY_UNSUPPORTED 223 # define PROV_R_VALUE_ERROR 138 # define PROV_R_WRONG_FINAL_BLOCK_LENGTH 107 # define PROV_R_WRONG_OUTPUT_BUFFER_SIZE 139 # define PROV_R_XOF_DIGESTS_NOT_ALLOWED 183 # define PROV_R_XTS_DATA_UNIT_IS_TOO_LARGE 148 # define PROV_R_XTS_DUPLICATED_KEYS 149 #endif
8,527
54.376623
74
h
openssl
openssl-master/include/openssl/provider.h
/* * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_PROVIDER_H # define OPENSSL_PROVIDER_H # pragma once # include <openssl/core.h> # ifdef __cplusplus extern "C" { # endif /* Set and Get a library context search path */ int OSSL_PROVIDER_set_default_search_path(OSSL_LIB_CTX *, const char *path); const char *OSSL_PROVIDER_get0_default_search_path(OSSL_LIB_CTX *libctx); /* Load and unload a provider */ OSSL_PROVIDER *OSSL_PROVIDER_load(OSSL_LIB_CTX *, const char *name); OSSL_PROVIDER *OSSL_PROVIDER_try_load(OSSL_LIB_CTX *, const char *name, int retain_fallbacks); int OSSL_PROVIDER_unload(OSSL_PROVIDER *prov); int OSSL_PROVIDER_available(OSSL_LIB_CTX *, const char *name); int OSSL_PROVIDER_do_all(OSSL_LIB_CTX *ctx, int (*cb)(OSSL_PROVIDER *provider, void *cbdata), void *cbdata); const OSSL_PARAM *OSSL_PROVIDER_gettable_params(const OSSL_PROVIDER *prov); int OSSL_PROVIDER_get_params(const OSSL_PROVIDER *prov, OSSL_PARAM params[]); int OSSL_PROVIDER_self_test(const OSSL_PROVIDER *prov); int OSSL_PROVIDER_get_capabilities(const OSSL_PROVIDER *prov, const char *capability, OSSL_CALLBACK *cb, void *arg); const OSSL_ALGORITHM *OSSL_PROVIDER_query_operation(const OSSL_PROVIDER *prov, int operation_id, int *no_cache); void OSSL_PROVIDER_unquery_operation(const OSSL_PROVIDER *prov, int operation_id, const OSSL_ALGORITHM *algs); void *OSSL_PROVIDER_get0_provider_ctx(const OSSL_PROVIDER *prov); const OSSL_DISPATCH *OSSL_PROVIDER_get0_dispatch(const OSSL_PROVIDER *prov); /* Add a built in providers */ int OSSL_PROVIDER_add_builtin(OSSL_LIB_CTX *, const char *name, OSSL_provider_init_fn *init_fn); /* Information */ const char *OSSL_PROVIDER_get0_name(const OSSL_PROVIDER *prov); # ifdef __cplusplus } # endif #endif
2,404
37.790323
83
h
openssl
openssl-master/include/openssl/quic.h
/* * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_QUIC_H # define OPENSSL_QUIC_H # pragma once # include <openssl/macros.h> # include <openssl/ssl.h> # ifndef OPENSSL_NO_QUIC # ifdef __cplusplus extern "C" { # endif /* * Method used for non-thread-assisted QUIC client operation. */ __owur const SSL_METHOD *OSSL_QUIC_client_method(void); /* * Method used for thread-assisted QUIC client operation. */ __owur const SSL_METHOD *OSSL_QUIC_client_thread_method(void); # ifdef __cplusplus } # endif # endif /* OPENSSL_NO_QUIC */ #endif
844
21.236842
74
h
openssl
openssl-master/include/openssl/rand.h
/* * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_RAND_H # define OPENSSL_RAND_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_RAND_H # endif # include <stdlib.h> # include <openssl/types.h> # include <openssl/e_os2.h> # include <openssl/randerr.h> # include <openssl/evp.h> #ifdef __cplusplus extern "C" { #endif /* * Default security strength (in the sense of [NIST SP 800-90Ar1]) * * NIST SP 800-90Ar1 supports the strength of the DRBG being smaller than that * of the cipher by collecting less entropy. The current DRBG implementation * does not take RAND_DRBG_STRENGTH into account and sets the strength of the * DRBG to that of the cipher. */ # define RAND_DRBG_STRENGTH 256 # ifndef OPENSSL_NO_DEPRECATED_3_0 struct rand_meth_st { int (*seed) (const void *buf, int num); int (*bytes) (unsigned char *buf, int num); void (*cleanup) (void); int (*add) (const void *buf, int num, double randomness); int (*pseudorand) (unsigned char *buf, int num); int (*status) (void); }; OSSL_DEPRECATEDIN_3_0 int RAND_set_rand_method(const RAND_METHOD *meth); OSSL_DEPRECATEDIN_3_0 const RAND_METHOD *RAND_get_rand_method(void); # ifndef OPENSSL_NO_ENGINE OSSL_DEPRECATEDIN_3_0 int RAND_set_rand_engine(ENGINE *engine); # endif OSSL_DEPRECATEDIN_3_0 RAND_METHOD *RAND_OpenSSL(void); # endif /* OPENSSL_NO_DEPRECATED_3_0 */ # ifndef OPENSSL_NO_DEPRECATED_1_1_0 # define RAND_cleanup() while(0) continue # endif int RAND_bytes(unsigned char *buf, int num); int RAND_priv_bytes(unsigned char *buf, int num); /* * Equivalent of RAND_priv_bytes() but additionally taking an OSSL_LIB_CTX and * a strength. */ int RAND_priv_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, size_t num, unsigned int strength); /* * Equivalent of RAND_bytes() but additionally taking an OSSL_LIB_CTX and * a strength. */ int RAND_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, size_t num, unsigned int strength); # ifndef OPENSSL_NO_DEPRECATED_1_1_0 OSSL_DEPRECATEDIN_1_1_0 int RAND_pseudo_bytes(unsigned char *buf, int num); # endif EVP_RAND_CTX *RAND_get0_primary(OSSL_LIB_CTX *ctx); EVP_RAND_CTX *RAND_get0_public(OSSL_LIB_CTX *ctx); EVP_RAND_CTX *RAND_get0_private(OSSL_LIB_CTX *ctx); int RAND_set0_public(OSSL_LIB_CTX *ctx, EVP_RAND_CTX *rand); int RAND_set0_private(OSSL_LIB_CTX *ctx, EVP_RAND_CTX *rand); int RAND_set_DRBG_type(OSSL_LIB_CTX *ctx, const char *drbg, const char *propq, const char *cipher, const char *digest); int RAND_set_seed_source_type(OSSL_LIB_CTX *ctx, const char *seed, const char *propq); void RAND_seed(const void *buf, int num); void RAND_keep_random_devices_open(int keep); # if defined(__ANDROID__) && defined(__NDK_FPABI__) __NDK_FPABI__ /* __attribute__((pcs("aapcs"))) on ARM */ # endif void RAND_add(const void *buf, int num, double randomness); int RAND_load_file(const char *file, long max_bytes); int RAND_write_file(const char *file); const char *RAND_file_name(char *file, size_t num); int RAND_status(void); # ifndef OPENSSL_NO_EGD int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes); int RAND_egd(const char *path); int RAND_egd_bytes(const char *path, int bytes); # endif int RAND_poll(void); # if defined(_WIN32) && (defined(BASETYPES) || defined(_WINDEF_H)) /* application has to include <windows.h> in order to use these */ # ifndef OPENSSL_NO_DEPRECATED_1_1_0 OSSL_DEPRECATEDIN_1_1_0 void RAND_screen(void); OSSL_DEPRECATEDIN_1_1_0 int RAND_event(UINT, WPARAM, LPARAM); # endif # endif #ifdef __cplusplus } #endif #endif
3,983
30.619048
78
h
openssl
openssl-master/include/openssl/randerr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_RANDERR_H # define OPENSSL_RANDERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> /* * RAND reason codes. */ # define RAND_R_ADDITIONAL_INPUT_TOO_LONG 102 # define RAND_R_ALREADY_INSTANTIATED 103 # define RAND_R_ARGUMENT_OUT_OF_RANGE 105 # define RAND_R_CANNOT_OPEN_FILE 121 # define RAND_R_DRBG_ALREADY_INITIALIZED 129 # define RAND_R_DRBG_NOT_INITIALISED 104 # define RAND_R_ENTROPY_INPUT_TOO_LONG 106 # define RAND_R_ENTROPY_OUT_OF_RANGE 124 # define RAND_R_ERROR_ENTROPY_POOL_WAS_IGNORED 127 # define RAND_R_ERROR_INITIALISING_DRBG 107 # define RAND_R_ERROR_INSTANTIATING_DRBG 108 # define RAND_R_ERROR_RETRIEVING_ADDITIONAL_INPUT 109 # define RAND_R_ERROR_RETRIEVING_ENTROPY 110 # define RAND_R_ERROR_RETRIEVING_NONCE 111 # define RAND_R_FAILED_TO_CREATE_LOCK 126 # define RAND_R_FUNC_NOT_IMPLEMENTED 101 # define RAND_R_FWRITE_ERROR 123 # define RAND_R_GENERATE_ERROR 112 # define RAND_R_INSUFFICIENT_DRBG_STRENGTH 139 # define RAND_R_INTERNAL_ERROR 113 # define RAND_R_IN_ERROR_STATE 114 # define RAND_R_NOT_A_REGULAR_FILE 122 # define RAND_R_NOT_INSTANTIATED 115 # define RAND_R_NO_DRBG_IMPLEMENTATION_SELECTED 128 # define RAND_R_PARENT_LOCKING_NOT_ENABLED 130 # define RAND_R_PARENT_STRENGTH_TOO_WEAK 131 # define RAND_R_PERSONALISATION_STRING_TOO_LONG 116 # define RAND_R_PREDICTION_RESISTANCE_NOT_SUPPORTED 133 # define RAND_R_PRNG_NOT_SEEDED 100 # define RAND_R_RANDOM_POOL_OVERFLOW 125 # define RAND_R_RANDOM_POOL_UNDERFLOW 134 # define RAND_R_REQUEST_TOO_LARGE_FOR_DRBG 117 # define RAND_R_RESEED_ERROR 118 # define RAND_R_SELFTEST_FAILURE 119 # define RAND_R_TOO_LITTLE_NONCE_REQUESTED 135 # define RAND_R_TOO_MUCH_NONCE_REQUESTED 136 # define RAND_R_UNABLE_TO_CREATE_DRBG 143 # define RAND_R_UNABLE_TO_FETCH_DRBG 144 # define RAND_R_UNABLE_TO_GET_PARENT_RESEED_PROP_COUNTER 141 # define RAND_R_UNABLE_TO_GET_PARENT_STRENGTH 138 # define RAND_R_UNABLE_TO_LOCK_PARENT 140 # define RAND_R_UNSUPPORTED_DRBG_FLAGS 132 # define RAND_R_UNSUPPORTED_DRBG_TYPE 120 #endif
3,257
46.217391
74
h
openssl
openssl-master/include/openssl/rc2.h
/* * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_RC2_H # define OPENSSL_RC2_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_RC2_H # endif # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_RC2 # ifdef __cplusplus extern "C" { # endif # define RC2_BLOCK 8 # define RC2_KEY_LENGTH 16 # ifndef OPENSSL_NO_DEPRECATED_3_0 typedef unsigned int RC2_INT; # define RC2_ENCRYPT 1 # define RC2_DECRYPT 0 typedef struct rc2_key_st { RC2_INT data[64]; } RC2_KEY; # endif # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits); OSSL_DEPRECATEDIN_3_0 void RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, RC2_KEY *key, int enc); OSSL_DEPRECATEDIN_3_0 void RC2_encrypt(unsigned long *data, RC2_KEY *key); OSSL_DEPRECATEDIN_3_0 void RC2_decrypt(unsigned long *data, RC2_KEY *key); OSSL_DEPRECATEDIN_3_0 void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, RC2_KEY *ks, unsigned char *iv, int enc); OSSL_DEPRECATEDIN_3_0 void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, RC2_KEY *schedule, unsigned char *ivec, int *num, int enc); OSSL_DEPRECATEDIN_3_0 void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, RC2_KEY *schedule, unsigned char *ivec, int *num); # endif # ifdef __cplusplus } # endif # endif #endif
2,382
33.536232
77
h
openssl
openssl-master/include/openssl/rc4.h
/* * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_RC4_H # define OPENSSL_RC4_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_RC4_H # endif # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_RC4 # include <stddef.h> # ifdef __cplusplus extern "C" { # endif # ifndef OPENSSL_NO_DEPRECATED_3_0 typedef struct rc4_key_st { RC4_INT x, y; RC4_INT data[256]; } RC4_KEY; # endif # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 const char *RC4_options(void); OSSL_DEPRECATEDIN_3_0 void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); OSSL_DEPRECATEDIN_3_0 void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, unsigned char *outdata); # endif # ifdef __cplusplus } # endif # endif #endif
1,194
23.895833
74
h
openssl
openssl-master/include/openssl/rc5.h
/* * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_RC5_H # define OPENSSL_RC5_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_RC5_H # endif # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_RC5 # ifdef __cplusplus extern "C" { # endif # define RC5_32_BLOCK 8 # define RC5_32_KEY_LENGTH 16/* This is a default, max is 255 */ # ifndef OPENSSL_NO_DEPRECATED_3_0 # define RC5_ENCRYPT 1 # define RC5_DECRYPT 0 # define RC5_32_INT unsigned int /* * This are the only values supported. Tweak the code if you want more The * most supported modes will be RC5-32/12/16 RC5-32/16/8 */ # define RC5_8_ROUNDS 8 # define RC5_12_ROUNDS 12 # define RC5_16_ROUNDS 16 typedef struct rc5_key_st { /* Number of rounds */ int rounds; RC5_32_INT data[2 * (RC5_16_ROUNDS + 1)]; } RC5_32_KEY; # endif # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 int RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, int rounds); OSSL_DEPRECATEDIN_3_0 void RC5_32_ecb_encrypt(const unsigned char *in, unsigned char *out, RC5_32_KEY *key, int enc); OSSL_DEPRECATEDIN_3_0 void RC5_32_encrypt(unsigned long *data, RC5_32_KEY *key); OSSL_DEPRECATEDIN_3_0 void RC5_32_decrypt(unsigned long *data, RC5_32_KEY *key); OSSL_DEPRECATEDIN_3_0 void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, RC5_32_KEY *ks, unsigned char *iv, int enc); OSSL_DEPRECATEDIN_3_0 void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, RC5_32_KEY *schedule, unsigned char *ivec, int *num, int enc); OSSL_DEPRECATEDIN_3_0 void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, RC5_32_KEY *schedule, unsigned char *ivec, int *num); # endif # ifdef __cplusplus } # endif # endif #endif
2,861
34.775
80
h
openssl
openssl-master/include/openssl/ripemd.h
/* * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_RIPEMD_H # define OPENSSL_RIPEMD_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_RIPEMD_H # endif # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_RMD160 # include <openssl/e_os2.h> # include <stddef.h> # define RIPEMD160_DIGEST_LENGTH 20 # ifdef __cplusplus extern "C" { # endif # if !defined(OPENSSL_NO_DEPRECATED_3_0) # define RIPEMD160_LONG unsigned int # define RIPEMD160_CBLOCK 64 # define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4) typedef struct RIPEMD160state_st { RIPEMD160_LONG A, B, C, D, E; RIPEMD160_LONG Nl, Nh; RIPEMD160_LONG data[RIPEMD160_LBLOCK]; unsigned int num; } RIPEMD160_CTX; # endif # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 int RIPEMD160_Init(RIPEMD160_CTX *c); OSSL_DEPRECATEDIN_3_0 int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); OSSL_DEPRECATEDIN_3_0 int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); OSSL_DEPRECATEDIN_3_0 unsigned char *RIPEMD160(const unsigned char *d, size_t n, unsigned char *md); OSSL_DEPRECATEDIN_3_0 void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b); # endif # ifdef __cplusplus } # endif # endif #endif
1,717
27.633333
80
h
openssl
openssl-master/include/openssl/rsaerr.h
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_RSAERR_H # define OPENSSL_RSAERR_H # pragma once # include <openssl/opensslconf.h> # include <openssl/symhacks.h> # include <openssl/cryptoerr_legacy.h> /* * RSA reason codes. */ # define RSA_R_ALGORITHM_MISMATCH 100 # define RSA_R_BAD_E_VALUE 101 # define RSA_R_BAD_FIXED_HEADER_DECRYPT 102 # define RSA_R_BAD_PAD_BYTE_COUNT 103 # define RSA_R_BAD_SIGNATURE 104 # define RSA_R_BLOCK_TYPE_IS_NOT_01 106 # define RSA_R_BLOCK_TYPE_IS_NOT_02 107 # define RSA_R_DATA_GREATER_THAN_MOD_LEN 108 # define RSA_R_DATA_TOO_LARGE 109 # define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 110 # define RSA_R_DATA_TOO_LARGE_FOR_MODULUS 132 # define RSA_R_DATA_TOO_SMALL 111 # define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE 122 # define RSA_R_DIGEST_DOES_NOT_MATCH 158 # define RSA_R_DIGEST_NOT_ALLOWED 145 # define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 112 # define RSA_R_DMP1_NOT_CONGRUENT_TO_D 124 # define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125 # define RSA_R_D_E_NOT_CONGRUENT_TO_1 123 # define RSA_R_FIRST_OCTET_INVALID 133 # define RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE 144 # define RSA_R_INVALID_DIGEST 157 # define RSA_R_INVALID_DIGEST_LENGTH 143 # define RSA_R_INVALID_HEADER 137 # define RSA_R_INVALID_KEYPAIR 171 # define RSA_R_INVALID_KEY_LENGTH 173 # define RSA_R_INVALID_LABEL 160 # define RSA_R_INVALID_LENGTH 181 # define RSA_R_INVALID_MESSAGE_LENGTH 131 # define RSA_R_INVALID_MGF1_MD 156 # define RSA_R_INVALID_MODULUS 174 # define RSA_R_INVALID_MULTI_PRIME_KEY 167 # define RSA_R_INVALID_OAEP_PARAMETERS 161 # define RSA_R_INVALID_PADDING 138 # define RSA_R_INVALID_PADDING_MODE 141 # define RSA_R_INVALID_PSS_PARAMETERS 149 # define RSA_R_INVALID_PSS_SALTLEN 146 # define RSA_R_INVALID_REQUEST 175 # define RSA_R_INVALID_SALT_LENGTH 150 # define RSA_R_INVALID_STRENGTH 176 # define RSA_R_INVALID_TRAILER 139 # define RSA_R_INVALID_X931_DIGEST 142 # define RSA_R_IQMP_NOT_INVERSE_OF_Q 126 # define RSA_R_KEY_PRIME_NUM_INVALID 165 # define RSA_R_KEY_SIZE_TOO_SMALL 120 # define RSA_R_LAST_OCTET_INVALID 134 # define RSA_R_MGF1_DIGEST_NOT_ALLOWED 152 # define RSA_R_MISSING_PRIVATE_KEY 179 # define RSA_R_MODULUS_TOO_LARGE 105 # define RSA_R_MP_COEFFICIENT_NOT_INVERSE_OF_R 168 # define RSA_R_MP_EXPONENT_NOT_CONGRUENT_TO_D 169 # define RSA_R_MP_R_NOT_PRIME 170 # define RSA_R_NO_PUBLIC_EXPONENT 140 # define RSA_R_NULL_BEFORE_BLOCK_MISSING 113 # define RSA_R_N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES 172 # define RSA_R_N_DOES_NOT_EQUAL_P_Q 127 # define RSA_R_OAEP_DECODING_ERROR 121 # define RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 148 # define RSA_R_PADDING_CHECK_FAILED 114 # define RSA_R_PAIRWISE_TEST_FAILURE 177 # define RSA_R_PKCS_DECODING_ERROR 159 # define RSA_R_PSS_SALTLEN_TOO_SMALL 164 # define RSA_R_PUB_EXPONENT_OUT_OF_RANGE 178 # define RSA_R_P_NOT_PRIME 128 # define RSA_R_Q_NOT_PRIME 129 # define RSA_R_RANDOMNESS_SOURCE_STRENGTH_INSUFFICIENT 180 # define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED 130 # define RSA_R_SLEN_CHECK_FAILED 136 # define RSA_R_SLEN_RECOVERY_FAILED 135 # define RSA_R_SSLV3_ROLLBACK_ATTACK 115 # define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116 # define RSA_R_UNKNOWN_ALGORITHM_TYPE 117 # define RSA_R_UNKNOWN_DIGEST 166 # define RSA_R_UNKNOWN_MASK_DIGEST 151 # define RSA_R_UNKNOWN_PADDING_TYPE 118 # define RSA_R_UNSUPPORTED_ENCRYPTION_TYPE 162 # define RSA_R_UNSUPPORTED_LABEL_SOURCE 163 # define RSA_R_UNSUPPORTED_MASK_ALGORITHM 153 # define RSA_R_UNSUPPORTED_MASK_PARAMETER 154 # define RSA_R_UNSUPPORTED_SIGNATURE_TYPE 155 # define RSA_R_VALUE_MISSING 147 # define RSA_R_WRONG_SIGNATURE_LENGTH 119 #endif
5,681
51.611111
74
h
openssl
openssl-master/include/openssl/seed.h
/* * Copyright 2007-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ /* * Copyright (c) 2007 KISA(Korea Information Security Agency). 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. * 2. Neither the name of author nor the names of its contributors may * be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``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 AUTHOR OR CONTRIBUTORS 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. */ #ifndef OPENSSL_SEED_H # define OPENSSL_SEED_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_SEED_H # endif # include <openssl/opensslconf.h> # ifndef OPENSSL_NO_SEED # include <openssl/e_os2.h> # include <openssl/crypto.h> # include <sys/types.h> # ifdef __cplusplus extern "C" { # endif # define SEED_BLOCK_SIZE 16 # define SEED_KEY_LENGTH 16 # ifndef OPENSSL_NO_DEPRECATED_3_0 /* look whether we need 'long' to get 32 bits */ # ifdef AES_LONG # ifndef SEED_LONG # define SEED_LONG 1 # endif # endif typedef struct seed_key_st { # ifdef SEED_LONG unsigned long data[32]; # else unsigned int data[32]; # endif } SEED_KEY_SCHEDULE; # endif /* OPENSSL_NO_DEPRECATED_3_0 */ # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SCHEDULE *ks); OSSL_DEPRECATEDIN_3_0 void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks); OSSL_DEPRECATEDIN_3_0 void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks); OSSL_DEPRECATEDIN_3_0 void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out, const SEED_KEY_SCHEDULE *ks, int enc); OSSL_DEPRECATEDIN_3_0 void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int enc); OSSL_DEPRECATEDIN_3_0 void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int *num, int enc); OSSL_DEPRECATEDIN_3_0 void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int *num); # endif # ifdef __cplusplus } # endif # endif #endif
3,964
33.780702
83
h
openssl
openssl-master/include/openssl/self_test.h
/* * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_SELF_TEST_H # define OPENSSL_SELF_TEST_H # pragma once # include <openssl/core.h> /* OSSL_CALLBACK */ # ifdef __cplusplus extern "C" { # endif /* The test event phases */ # define OSSL_SELF_TEST_PHASE_NONE "None" # define OSSL_SELF_TEST_PHASE_START "Start" # define OSSL_SELF_TEST_PHASE_CORRUPT "Corrupt" # define OSSL_SELF_TEST_PHASE_PASS "Pass" # define OSSL_SELF_TEST_PHASE_FAIL "Fail" /* Test event categories */ # define OSSL_SELF_TEST_TYPE_NONE "None" # define OSSL_SELF_TEST_TYPE_MODULE_INTEGRITY "Module_Integrity" # define OSSL_SELF_TEST_TYPE_INSTALL_INTEGRITY "Install_Integrity" # define OSSL_SELF_TEST_TYPE_CRNG "Continuous_RNG_Test" # define OSSL_SELF_TEST_TYPE_PCT "Conditional_PCT" # define OSSL_SELF_TEST_TYPE_PCT_KAT "Conditional_KAT" # define OSSL_SELF_TEST_TYPE_KAT_INTEGRITY "KAT_Integrity" # define OSSL_SELF_TEST_TYPE_KAT_CIPHER "KAT_Cipher" # define OSSL_SELF_TEST_TYPE_KAT_ASYM_CIPHER "KAT_AsymmetricCipher" # define OSSL_SELF_TEST_TYPE_KAT_DIGEST "KAT_Digest" # define OSSL_SELF_TEST_TYPE_KAT_SIGNATURE "KAT_Signature" # define OSSL_SELF_TEST_TYPE_PCT_SIGNATURE "PCT_Signature" # define OSSL_SELF_TEST_TYPE_KAT_KDF "KAT_KDF" # define OSSL_SELF_TEST_TYPE_KAT_KA "KAT_KA" # define OSSL_SELF_TEST_TYPE_DRBG "DRBG" /* Test event sub categories */ # define OSSL_SELF_TEST_DESC_NONE "None" # define OSSL_SELF_TEST_DESC_INTEGRITY_HMAC "HMAC" # define OSSL_SELF_TEST_DESC_PCT_RSA_PKCS1 "RSA" # define OSSL_SELF_TEST_DESC_PCT_ECDSA "ECDSA" # define OSSL_SELF_TEST_DESC_PCT_DSA "DSA" # define OSSL_SELF_TEST_DESC_CIPHER_AES_GCM "AES_GCM" # define OSSL_SELF_TEST_DESC_CIPHER_AES_ECB "AES_ECB_Decrypt" # define OSSL_SELF_TEST_DESC_CIPHER_TDES "TDES" # define OSSL_SELF_TEST_DESC_ASYM_RSA_ENC "RSA_Encrypt" # define OSSL_SELF_TEST_DESC_ASYM_RSA_DEC "RSA_Decrypt" # define OSSL_SELF_TEST_DESC_MD_SHA1 "SHA1" # define OSSL_SELF_TEST_DESC_MD_SHA2 "SHA2" # define OSSL_SELF_TEST_DESC_MD_SHA3 "SHA3" # define OSSL_SELF_TEST_DESC_SIGN_DSA "DSA" # define OSSL_SELF_TEST_DESC_SIGN_RSA "RSA" # define OSSL_SELF_TEST_DESC_SIGN_ECDSA "ECDSA" # define OSSL_SELF_TEST_DESC_DRBG_CTR "CTR" # define OSSL_SELF_TEST_DESC_DRBG_HASH "HASH" # define OSSL_SELF_TEST_DESC_DRBG_HMAC "HMAC" # define OSSL_SELF_TEST_DESC_KA_DH "DH" # define OSSL_SELF_TEST_DESC_KA_ECDH "ECDH" # define OSSL_SELF_TEST_DESC_KDF_HKDF "HKDF" # define OSSL_SELF_TEST_DESC_KDF_SSKDF "SSKDF" # define OSSL_SELF_TEST_DESC_KDF_X963KDF "X963KDF" # define OSSL_SELF_TEST_DESC_KDF_X942KDF "X942KDF" # define OSSL_SELF_TEST_DESC_KDF_PBKDF2 "PBKDF2" # define OSSL_SELF_TEST_DESC_KDF_SSHKDF "SSHKDF" # define OSSL_SELF_TEST_DESC_KDF_TLS12_PRF "TLS12_PRF" # define OSSL_SELF_TEST_DESC_KDF_KBKDF "KBKDF" # define OSSL_SELF_TEST_DESC_KDF_TLS13_EXTRACT "TLS13_KDF_EXTRACT" # define OSSL_SELF_TEST_DESC_KDF_TLS13_EXPAND "TLS13_KDF_EXPAND" # define OSSL_SELF_TEST_DESC_RNG "RNG" void OSSL_SELF_TEST_set_callback(OSSL_LIB_CTX *libctx, OSSL_CALLBACK *cb, void *cbarg); void OSSL_SELF_TEST_get_callback(OSSL_LIB_CTX *libctx, OSSL_CALLBACK **cb, void **cbarg); OSSL_SELF_TEST *OSSL_SELF_TEST_new(OSSL_CALLBACK *cb, void *cbarg); void OSSL_SELF_TEST_free(OSSL_SELF_TEST *st); void OSSL_SELF_TEST_onbegin(OSSL_SELF_TEST *st, const char *type, const char *desc); int OSSL_SELF_TEST_oncorrupt_byte(OSSL_SELF_TEST *st, unsigned char *bytes); void OSSL_SELF_TEST_onend(OSSL_SELF_TEST *st, int ret); # ifdef __cplusplus } # endif #endif /* OPENSSL_SELF_TEST_H */
4,145
42.642105
76
h
openssl
openssl-master/include/openssl/sha.h
/* * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_SHA_H # define OPENSSL_SHA_H # pragma once # include <openssl/macros.h> # ifndef OPENSSL_NO_DEPRECATED_3_0 # define HEADER_SHA_H # endif # include <openssl/e_os2.h> # include <stddef.h> # ifdef __cplusplus extern "C" { # endif # define SHA_DIGEST_LENGTH 20 # ifndef OPENSSL_NO_DEPRECATED_3_0 /*- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * ! SHA_LONG has to be at least 32 bits wide. ! * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ # define SHA_LONG unsigned int # define SHA_LBLOCK 16 # define SHA_CBLOCK (SHA_LBLOCK*4)/* SHA treats input data as a * contiguous array of 32 bit wide * big-endian values. */ # define SHA_LAST_BLOCK (SHA_CBLOCK-8) typedef struct SHAstate_st { SHA_LONG h0, h1, h2, h3, h4; SHA_LONG Nl, Nh; SHA_LONG data[SHA_LBLOCK]; unsigned int num; } SHA_CTX; OSSL_DEPRECATEDIN_3_0 int SHA1_Init(SHA_CTX *c); OSSL_DEPRECATEDIN_3_0 int SHA1_Update(SHA_CTX *c, const void *data, size_t len); OSSL_DEPRECATEDIN_3_0 int SHA1_Final(unsigned char *md, SHA_CTX *c); OSSL_DEPRECATEDIN_3_0 void SHA1_Transform(SHA_CTX *c, const unsigned char *data); # endif unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md); # ifndef OPENSSL_NO_DEPRECATED_3_0 # define SHA256_CBLOCK (SHA_LBLOCK*4)/* SHA-256 treats input data as a * contiguous array of 32 bit wide * big-endian values. */ typedef struct SHA256state_st { SHA_LONG h[8]; SHA_LONG Nl, Nh; SHA_LONG data[SHA_LBLOCK]; unsigned int num, md_len; } SHA256_CTX; OSSL_DEPRECATEDIN_3_0 int SHA224_Init(SHA256_CTX *c); OSSL_DEPRECATEDIN_3_0 int SHA224_Update(SHA256_CTX *c, const void *data, size_t len); OSSL_DEPRECATEDIN_3_0 int SHA224_Final(unsigned char *md, SHA256_CTX *c); OSSL_DEPRECATEDIN_3_0 int SHA256_Init(SHA256_CTX *c); OSSL_DEPRECATEDIN_3_0 int SHA256_Update(SHA256_CTX *c, const void *data, size_t len); OSSL_DEPRECATEDIN_3_0 int SHA256_Final(unsigned char *md, SHA256_CTX *c); OSSL_DEPRECATEDIN_3_0 void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); # endif unsigned char *SHA224(const unsigned char *d, size_t n, unsigned char *md); unsigned char *SHA256(const unsigned char *d, size_t n, unsigned char *md); # define SHA256_192_DIGEST_LENGTH 24 # define SHA224_DIGEST_LENGTH 28 # define SHA256_DIGEST_LENGTH 32 # define SHA384_DIGEST_LENGTH 48 # define SHA512_DIGEST_LENGTH 64 # ifndef OPENSSL_NO_DEPRECATED_3_0 /* * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64 * being exactly 64-bit wide. See Implementation Notes in sha512.c * for further details. */ /* * SHA-512 treats input data as a * contiguous array of 64 bit * wide big-endian values. */ # define SHA512_CBLOCK (SHA_LBLOCK*8) # if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) # define SHA_LONG64 unsigned __int64 # elif defined(__arch64__) # define SHA_LONG64 unsigned long # else # define SHA_LONG64 unsigned long long # endif typedef struct SHA512state_st { SHA_LONG64 h[8]; SHA_LONG64 Nl, Nh; union { SHA_LONG64 d[SHA_LBLOCK]; unsigned char p[SHA512_CBLOCK]; } u; unsigned int num, md_len; } SHA512_CTX; OSSL_DEPRECATEDIN_3_0 int SHA384_Init(SHA512_CTX *c); OSSL_DEPRECATEDIN_3_0 int SHA384_Update(SHA512_CTX *c, const void *data, size_t len); OSSL_DEPRECATEDIN_3_0 int SHA384_Final(unsigned char *md, SHA512_CTX *c); OSSL_DEPRECATEDIN_3_0 int SHA512_Init(SHA512_CTX *c); OSSL_DEPRECATEDIN_3_0 int SHA512_Update(SHA512_CTX *c, const void *data, size_t len); OSSL_DEPRECATEDIN_3_0 int SHA512_Final(unsigned char *md, SHA512_CTX *c); OSSL_DEPRECATEDIN_3_0 void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); # endif unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md); unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md); # ifdef __cplusplus } # endif #endif
4,695
32.542857
81
h