id
int64
0
755k
file_name
stringlengths
3
109
file_path
stringlengths
13
185
content
stringlengths
31
9.38M
size
int64
31
9.38M
language
stringclasses
1 value
extension
stringclasses
11 values
total_lines
int64
1
340k
avg_line_length
float64
2.18
149k
max_line_length
int64
7
2.22M
alphanum_fraction
float64
0
1
repo_name
stringlengths
6
65
repo_stars
int64
100
47.3k
repo_forks
int64
0
12k
repo_open_issues
int64
0
3.4k
repo_license
stringclasses
9 values
repo_extraction_date
stringclasses
92 values
exact_duplicates_redpajama
bool
2 classes
near_duplicates_redpajama
bool
2 classes
exact_duplicates_githubcode
bool
2 classes
exact_duplicates_stackv2
bool
1 class
exact_duplicates_stackv1
bool
2 classes
near_duplicates_githubcode
bool
2 classes
near_duplicates_stackv1
bool
2 classes
near_duplicates_stackv2
bool
1 class
22,336
chvalid.h
Nevcairiel_LAVFilters/thirdparty/32/include/libxml2/libxml/chvalid.h
/* * Summary: Unicode character range checking * Description: this module exports interfaces for the character * range validation APIs * * This file is automatically generated from the cvs source * definition files using the genChRanges.py Python script * * Generation date: Mon Mar 27 11:09:48 2006 * Sources: chvalid.def * Author: William Brack <wbrack@mmm.com.hk> */ #ifndef __XML_CHVALID_H__ #define __XML_CHVALID_H__ #include <libxml/xmlversion.h> #include <libxml/xmlstring.h> #ifdef __cplusplus extern "C" { #endif /* * Define our typedefs and structures * */ typedef struct _xmlChSRange xmlChSRange; typedef xmlChSRange *xmlChSRangePtr; struct _xmlChSRange { unsigned short low; unsigned short high; }; typedef struct _xmlChLRange xmlChLRange; typedef xmlChLRange *xmlChLRangePtr; struct _xmlChLRange { unsigned int low; unsigned int high; }; typedef struct _xmlChRangeGroup xmlChRangeGroup; typedef xmlChRangeGroup *xmlChRangeGroupPtr; struct _xmlChRangeGroup { int nbShortRange; int nbLongRange; const xmlChSRange *shortRange; /* points to an array of ranges */ const xmlChLRange *longRange; }; /** * Range checking routine */ XMLPUBFUN int xmlCharInRange(unsigned int val, const xmlChRangeGroup *group); /** * xmlIsBaseChar_ch: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ ((0x61 <= (c)) && ((c) <= 0x7a)) || \ ((0xc0 <= (c)) && ((c) <= 0xd6)) || \ ((0xd8 <= (c)) && ((c) <= 0xf6)) || \ (0xf8 <= (c))) /** * xmlIsBaseCharQ: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsBaseCharQ(c) (((c) < 0x100) ? \ xmlIsBaseChar_ch((c)) : \ xmlCharInRange((c), &xmlIsBaseCharGroup)) XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup; /** * xmlIsBlank_ch: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsBlank_ch(c) (((c) == 0x20) || \ ((0x9 <= (c)) && ((c) <= 0xa)) || \ ((c) == 0xd)) /** * xmlIsBlankQ: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsBlankQ(c) (((c) < 0x100) ? \ xmlIsBlank_ch((c)) : 0) /** * xmlIsChar_ch: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \ ((c) == 0xd) || \ (0x20 <= (c))) /** * xmlIsCharQ: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsCharQ(c) (((c) < 0x100) ? \ xmlIsChar_ch((c)) :\ (((0x100 <= (c)) && ((c) <= 0xd7ff)) || \ ((0xe000 <= (c)) && ((c) <= 0xfffd)) || \ ((0x10000 <= (c)) && ((c) <= 0x10ffff)))) XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup; /** * xmlIsCombiningQ: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsCombiningQ(c) (((c) < 0x100) ? \ 0 : \ xmlCharInRange((c), &xmlIsCombiningGroup)) XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup; /** * xmlIsDigit_ch: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39))) /** * xmlIsDigitQ: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsDigitQ(c) (((c) < 0x100) ? \ xmlIsDigit_ch((c)) : \ xmlCharInRange((c), &xmlIsDigitGroup)) XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup; /** * xmlIsExtender_ch: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsExtender_ch(c) (((c) == 0xb7)) /** * xmlIsExtenderQ: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsExtenderQ(c) (((c) < 0x100) ? \ xmlIsExtender_ch((c)) : \ xmlCharInRange((c), &xmlIsExtenderGroup)) XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup; /** * xmlIsIdeographicQ: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsIdeographicQ(c) (((c) < 0x100) ? \ 0 :\ (((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \ ((c) == 0x3007) || \ ((0x3021 <= (c)) && ((c) <= 0x3029)))) XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup; XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256]; /** * xmlIsPubidChar_ch: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)]) /** * xmlIsPubidCharQ: * @c: char to validate * * Automatically generated by genChRanges.py */ #define xmlIsPubidCharQ(c) (((c) < 0x100) ? \ xmlIsPubidChar_ch((c)) : 0) XMLPUBFUN int xmlIsBaseChar(unsigned int ch); XMLPUBFUN int xmlIsBlank(unsigned int ch); XMLPUBFUN int xmlIsChar(unsigned int ch); XMLPUBFUN int xmlIsCombining(unsigned int ch); XMLPUBFUN int xmlIsDigit(unsigned int ch); XMLPUBFUN int xmlIsExtender(unsigned int ch); XMLPUBFUN int xmlIsIdeographic(unsigned int ch); XMLPUBFUN int xmlIsPubidChar(unsigned int ch); #ifdef __cplusplus } #endif #endif /* __XML_CHVALID_H__ */
5,087
C++
.h
199
23.070352
69
0.672226
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,337
parserInternals.h
Nevcairiel_LAVFilters/thirdparty/32/include/libxml2/libxml/parserInternals.h
/* * Summary: internals routines and limits exported by the parser. * Description: this module exports a number of internal parsing routines * they are not really all intended for applications but * can prove useful doing low level processing. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_PARSER_INTERNALS_H__ #define __XML_PARSER_INTERNALS_H__ #include <libxml/xmlversion.h> #include <libxml/parser.h> #include <libxml/HTMLparser.h> #include <libxml/chvalid.h> #ifdef __cplusplus extern "C" { #endif /** * xmlParserMaxDepth: * * arbitrary depth limit for the XML documents that we allow to * process. This is not a limitation of the parser but a safety * boundary feature, use XML_PARSE_HUGE option to override it. */ XMLPUBVAR unsigned int xmlParserMaxDepth; /** * XML_MAX_TEXT_LENGTH: * * Maximum size allowed for a single text node when building a tree. * This is not a limitation of the parser but a safety boundary feature, * use XML_PARSE_HUGE option to override it. * Introduced in 2.9.0 */ #define XML_MAX_TEXT_LENGTH 10000000 /** * XML_MAX_HUGE_LENGTH: * * Maximum size allowed when XML_PARSE_HUGE is set. */ #define XML_MAX_HUGE_LENGTH 1000000000 /** * XML_MAX_NAME_LENGTH: * * Maximum size allowed for a markup identifier. * This is not a limitation of the parser but a safety boundary feature, * use XML_PARSE_HUGE option to override it. * Note that with the use of parsing dictionaries overriding the limit * may result in more runtime memory usage in face of "unfriendly' content * Introduced in 2.9.0 */ #define XML_MAX_NAME_LENGTH 50000 /** * XML_MAX_DICTIONARY_LIMIT: * * Maximum size allowed by the parser for a dictionary by default * This is not a limitation of the parser but a safety boundary feature, * use XML_PARSE_HUGE option to override it. * Introduced in 2.9.0 */ #define XML_MAX_DICTIONARY_LIMIT 10000000 /** * XML_MAX_LOOKUP_LIMIT: * * Maximum size allowed by the parser for ahead lookup * This is an upper boundary enforced by the parser to avoid bad * behaviour on "unfriendly' content * Introduced in 2.9.0 */ #define XML_MAX_LOOKUP_LIMIT 10000000 /** * XML_MAX_NAMELEN: * * Identifiers can be longer, but this will be more costly * at runtime. */ #define XML_MAX_NAMELEN 100 /** * INPUT_CHUNK: * * The parser tries to always have that amount of input ready. * One of the point is providing context when reporting errors. */ #define INPUT_CHUNK 250 /************************************************************************ * * * UNICODE version of the macros. * * * ************************************************************************/ /** * IS_BYTE_CHAR: * @c: an byte value (int) * * Macro to check the following production in the XML spec: * * [2] Char ::= #x9 | #xA | #xD | [#x20...] * any byte character in the accepted range */ #define IS_BYTE_CHAR(c) xmlIsChar_ch(c) /** * IS_CHAR: * @c: an UNICODE value (int) * * Macro to check the following production in the XML spec: * * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] * | [#x10000-#x10FFFF] * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */ #define IS_CHAR(c) xmlIsCharQ(c) /** * IS_CHAR_CH: * @c: an xmlChar (usually an unsigned char) * * Behaves like IS_CHAR on single-byte value */ #define IS_CHAR_CH(c) xmlIsChar_ch(c) /** * IS_BLANK: * @c: an UNICODE value (int) * * Macro to check the following production in the XML spec: * * [3] S ::= (#x20 | #x9 | #xD | #xA)+ */ #define IS_BLANK(c) xmlIsBlankQ(c) /** * IS_BLANK_CH: * @c: an xmlChar value (normally unsigned char) * * Behaviour same as IS_BLANK */ #define IS_BLANK_CH(c) xmlIsBlank_ch(c) /** * IS_BASECHAR: * @c: an UNICODE value (int) * * Macro to check the following production in the XML spec: * * [85] BaseChar ::= ... long list see REC ... */ #define IS_BASECHAR(c) xmlIsBaseCharQ(c) /** * IS_DIGIT: * @c: an UNICODE value (int) * * Macro to check the following production in the XML spec: * * [88] Digit ::= ... long list see REC ... */ #define IS_DIGIT(c) xmlIsDigitQ(c) /** * IS_DIGIT_CH: * @c: an xmlChar value (usually an unsigned char) * * Behaves like IS_DIGIT but with a single byte argument */ #define IS_DIGIT_CH(c) xmlIsDigit_ch(c) /** * IS_COMBINING: * @c: an UNICODE value (int) * * Macro to check the following production in the XML spec: * * [87] CombiningChar ::= ... long list see REC ... */ #define IS_COMBINING(c) xmlIsCombiningQ(c) /** * IS_COMBINING_CH: * @c: an xmlChar (usually an unsigned char) * * Always false (all combining chars > 0xff) */ #define IS_COMBINING_CH(c) 0 /** * IS_EXTENDER: * @c: an UNICODE value (int) * * Macro to check the following production in the XML spec: * * * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] | * [#x309D-#x309E] | [#x30FC-#x30FE] */ #define IS_EXTENDER(c) xmlIsExtenderQ(c) /** * IS_EXTENDER_CH: * @c: an xmlChar value (usually an unsigned char) * * Behaves like IS_EXTENDER but with a single-byte argument */ #define IS_EXTENDER_CH(c) xmlIsExtender_ch(c) /** * IS_IDEOGRAPHIC: * @c: an UNICODE value (int) * * Macro to check the following production in the XML spec: * * * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029] */ #define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c) /** * IS_LETTER: * @c: an UNICODE value (int) * * Macro to check the following production in the XML spec: * * * [84] Letter ::= BaseChar | Ideographic */ #define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c)) /** * IS_LETTER_CH: * @c: an xmlChar value (normally unsigned char) * * Macro behaves like IS_LETTER, but only check base chars * */ #define IS_LETTER_CH(c) xmlIsBaseChar_ch(c) /** * IS_ASCII_LETTER: * @c: an xmlChar value * * Macro to check [a-zA-Z] * */ #define IS_ASCII_LETTER(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ ((0x61 <= (c)) && ((c) <= 0x7a))) /** * IS_ASCII_DIGIT: * @c: an xmlChar value * * Macro to check [0-9] * */ #define IS_ASCII_DIGIT(c) ((0x30 <= (c)) && ((c) <= 0x39)) /** * IS_PUBIDCHAR: * @c: an UNICODE value (int) * * Macro to check the following production in the XML spec: * * * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] */ #define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c) /** * IS_PUBIDCHAR_CH: * @c: an xmlChar value (normally unsigned char) * * Same as IS_PUBIDCHAR but for single-byte value */ #define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c) /** * Global variables used for predefined strings. */ XMLPUBVAR const xmlChar xmlStringText[]; XMLPUBVAR const xmlChar xmlStringTextNoenc[]; XMLPUBVAR const xmlChar xmlStringComment[]; /* * Function to finish the work of the macros where needed. */ XMLPUBFUN int xmlIsLetter (int c); /** * Parser context. */ XMLPUBFUN xmlParserCtxtPtr xmlCreateFileParserCtxt (const char *filename); XMLPUBFUN xmlParserCtxtPtr xmlCreateURLParserCtxt (const char *filename, int options); XMLPUBFUN xmlParserCtxtPtr xmlCreateMemoryParserCtxt(const char *buffer, int size); XMLPUBFUN xmlParserCtxtPtr xmlCreateEntityParserCtxt(const xmlChar *URL, const xmlChar *ID, const xmlChar *base); XMLPUBFUN int xmlSwitchEncoding (xmlParserCtxtPtr ctxt, xmlCharEncoding enc); XMLPUBFUN int xmlSwitchToEncoding (xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler); XML_DEPRECATED XMLPUBFUN int xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt, xmlParserInputPtr input, xmlCharEncodingHandlerPtr handler); /** * Input Streams. */ XMLPUBFUN xmlParserInputPtr xmlNewStringInputStream (xmlParserCtxtPtr ctxt, const xmlChar *buffer); XML_DEPRECATED XMLPUBFUN xmlParserInputPtr xmlNewEntityInputStream (xmlParserCtxtPtr ctxt, xmlEntityPtr entity); XMLPUBFUN int xmlPushInput (xmlParserCtxtPtr ctxt, xmlParserInputPtr input); XMLPUBFUN xmlChar xmlPopInput (xmlParserCtxtPtr ctxt); XMLPUBFUN void xmlFreeInputStream (xmlParserInputPtr input); XMLPUBFUN xmlParserInputPtr xmlNewInputFromFile (xmlParserCtxtPtr ctxt, const char *filename); XMLPUBFUN xmlParserInputPtr xmlNewInputStream (xmlParserCtxtPtr ctxt); /** * Namespaces. */ XMLPUBFUN xmlChar * xmlSplitQName (xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix); /** * Generic production rules. */ XML_DEPRECATED XMLPUBFUN const xmlChar * xmlParseName (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN xmlChar * xmlParseNmtoken (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN xmlChar * xmlParseEntityValue (xmlParserCtxtPtr ctxt, xmlChar **orig); XML_DEPRECATED XMLPUBFUN xmlChar * xmlParseAttValue (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN xmlChar * xmlParseSystemLiteral (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN xmlChar * xmlParsePubidLiteral (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN void xmlParseCharData (xmlParserCtxtPtr ctxt, int cdata); XML_DEPRECATED XMLPUBFUN xmlChar * xmlParseExternalID (xmlParserCtxtPtr ctxt, xmlChar **publicID, int strict); XML_DEPRECATED XMLPUBFUN void xmlParseComment (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN const xmlChar * xmlParsePITarget (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN void xmlParsePI (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN void xmlParseNotationDecl (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN void xmlParseEntityDecl (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN int xmlParseDefaultDecl (xmlParserCtxtPtr ctxt, xmlChar **value); XML_DEPRECATED XMLPUBFUN xmlEnumerationPtr xmlParseNotationType (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN xmlEnumerationPtr xmlParseEnumerationType (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN int xmlParseEnumeratedType (xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree); XML_DEPRECATED XMLPUBFUN int xmlParseAttributeType (xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree); XML_DEPRECATED XMLPUBFUN void xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN xmlElementContentPtr xmlParseElementMixedContentDecl (xmlParserCtxtPtr ctxt, int inputchk); XML_DEPRECATED XMLPUBFUN xmlElementContentPtr xmlParseElementChildrenContentDecl (xmlParserCtxtPtr ctxt, int inputchk); XML_DEPRECATED XMLPUBFUN int xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlElementContentPtr *result); XML_DEPRECATED XMLPUBFUN int xmlParseElementDecl (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN void xmlParseMarkupDecl (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN int xmlParseCharRef (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN xmlEntityPtr xmlParseEntityRef (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN void xmlParseReference (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN void xmlParsePEReference (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN void xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt); #ifdef LIBXML_SAX1_ENABLED XML_DEPRECATED XMLPUBFUN const xmlChar * xmlParseAttribute (xmlParserCtxtPtr ctxt, xmlChar **value); XML_DEPRECATED XMLPUBFUN const xmlChar * xmlParseStartTag (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN void xmlParseEndTag (xmlParserCtxtPtr ctxt); #endif /* LIBXML_SAX1_ENABLED */ XML_DEPRECATED XMLPUBFUN void xmlParseCDSect (xmlParserCtxtPtr ctxt); XMLPUBFUN void xmlParseContent (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN void xmlParseElement (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN xmlChar * xmlParseVersionNum (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN xmlChar * xmlParseVersionInfo (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN xmlChar * xmlParseEncName (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN const xmlChar * xmlParseEncodingDecl (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN int xmlParseSDDecl (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN void xmlParseXMLDecl (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN void xmlParseTextDecl (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN void xmlParseMisc (xmlParserCtxtPtr ctxt); XMLPUBFUN void xmlParseExternalSubset (xmlParserCtxtPtr ctxt, const xmlChar *ExternalID, const xmlChar *SystemID); /** * XML_SUBSTITUTE_NONE: * * If no entities need to be substituted. */ #define XML_SUBSTITUTE_NONE 0 /** * XML_SUBSTITUTE_REF: * * Whether general entities need to be substituted. */ #define XML_SUBSTITUTE_REF 1 /** * XML_SUBSTITUTE_PEREF: * * Whether parameter entities need to be substituted. */ #define XML_SUBSTITUTE_PEREF 2 /** * XML_SUBSTITUTE_BOTH: * * Both general and parameter entities need to be substituted. */ #define XML_SUBSTITUTE_BOTH 3 XML_DEPRECATED XMLPUBFUN xmlChar * xmlStringDecodeEntities (xmlParserCtxtPtr ctxt, const xmlChar *str, int what, xmlChar end, xmlChar end2, xmlChar end3); XML_DEPRECATED XMLPUBFUN xmlChar * xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt, const xmlChar *str, int len, int what, xmlChar end, xmlChar end2, xmlChar end3); /* * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP. */ XML_DEPRECATED XMLPUBFUN int nodePush (xmlParserCtxtPtr ctxt, xmlNodePtr value); XML_DEPRECATED XMLPUBFUN xmlNodePtr nodePop (xmlParserCtxtPtr ctxt); XMLPUBFUN int inputPush (xmlParserCtxtPtr ctxt, xmlParserInputPtr value); XMLPUBFUN xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN const xmlChar * namePop (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN int namePush (xmlParserCtxtPtr ctxt, const xmlChar *value); /* * other commodities shared between parser.c and parserInternals. */ XML_DEPRECATED XMLPUBFUN int xmlSkipBlankChars (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN int xmlStringCurrentChar (xmlParserCtxtPtr ctxt, const xmlChar *cur, int *len); XML_DEPRECATED XMLPUBFUN void xmlParserHandlePEReference(xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN int xmlCheckLanguageID (const xmlChar *lang); /* * Really core function shared with HTML parser. */ XML_DEPRECATED XMLPUBFUN int xmlCurrentChar (xmlParserCtxtPtr ctxt, int *len); XMLPUBFUN int xmlCopyCharMultiByte (xmlChar *out, int val); XMLPUBFUN int xmlCopyChar (int len, xmlChar *out, int val); XML_DEPRECATED XMLPUBFUN void xmlNextChar (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN void xmlParserInputShrink (xmlParserInputPtr in); /* * Specific function to keep track of entities references * and used by the XSLT debugger. */ #ifdef LIBXML_LEGACY_ENABLED /** * xmlEntityReferenceFunc: * @ent: the entity * @firstNode: the fist node in the chunk * @lastNode: the last nod in the chunk * * Callback function used when one needs to be able to track back the * provenance of a chunk of nodes inherited from an entity replacement. */ typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent, xmlNodePtr firstNode, xmlNodePtr lastNode); XML_DEPRECATED XMLPUBFUN void xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func); XML_DEPRECATED XMLPUBFUN xmlChar * xmlParseQuotedString (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN void xmlParseNamespace (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN xmlChar * xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN xmlChar * xmlScanName (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN xmlChar * xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN void xmlParserHandleReference(xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN xmlChar * xmlNamespaceParseQName (xmlParserCtxtPtr ctxt, xmlChar **prefix); /** * Entities */ XML_DEPRECATED XMLPUBFUN xmlChar * xmlDecodeEntities (xmlParserCtxtPtr ctxt, int len, int what, xmlChar end, xmlChar end2, xmlChar end3); XML_DEPRECATED XMLPUBFUN void xmlHandleEntity (xmlParserCtxtPtr ctxt, xmlEntityPtr entity); #endif /* LIBXML_LEGACY_ENABLED */ #ifdef __cplusplus } #endif #endif /* __XML_PARSER_INTERNALS_H__ */
16,579
C++
.h
617
24.377634
76
0.736571
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,338
xmlexports.h
Nevcairiel_LAVFilters/thirdparty/32/include/libxml2/libxml/xmlexports.h
/* * Summary: macros for marking symbols as exportable/importable. * Description: macros for marking symbols as exportable/importable. * * Copy: See Copyright for the status of this software. */ #ifndef __XML_EXPORTS_H__ #define __XML_EXPORTS_H__ /** DOC_DISABLE */ #if defined(_WIN32) || defined(__CYGWIN__) #ifdef LIBXML_STATIC #define XMLPUBLIC #elif defined(IN_LIBXML) #define XMLPUBLIC __declspec(dllexport) #else #define XMLPUBLIC __declspec(dllimport) #endif #else /* not Windows */ #define XMLPUBLIC #endif /* platform switch */ /** DOC_ENABLE */ /* * XMLPUBFUN: * * Macro which declares an exportable function */ #define XMLPUBFUN XMLPUBLIC /** * XMLPUBVAR: * * Macro which declares an exportable variable */ #define XMLPUBVAR XMLPUBLIC extern /** DOC_DISABLE */ /* Compatibility */ #define XMLCALL #define XMLCDECL #if !defined(LIBXML_DLL_IMPORT) #define LIBXML_DLL_IMPORT XMLPUBVAR #endif /** DOC_ENABLE */ #endif /* __XML_EXPORTS_H__ */
992
C++
.h
42
21.595238
68
0.726115
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,339
xmlsave.h
Nevcairiel_LAVFilters/thirdparty/32/include/libxml2/libxml/xmlsave.h
/* * Summary: the XML document serializer * Description: API to save document or subtree of document * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_XMLSAVE_H__ #define __XML_XMLSAVE_H__ #include <libxml/xmlversion.h> #include <libxml/tree.h> #include <libxml/encoding.h> #include <libxml/xmlIO.h> #ifdef LIBXML_OUTPUT_ENABLED #ifdef __cplusplus extern "C" { #endif /** * xmlSaveOption: * * This is the set of XML save options that can be passed down * to the xmlSaveToFd() and similar calls. */ typedef enum { XML_SAVE_FORMAT = 1<<0, /* format save output */ XML_SAVE_NO_DECL = 1<<1, /* drop the xml declaration */ XML_SAVE_NO_EMPTY = 1<<2, /* no empty tags */ XML_SAVE_NO_XHTML = 1<<3, /* disable XHTML1 specific rules */ XML_SAVE_XHTML = 1<<4, /* force XHTML1 specific rules */ XML_SAVE_AS_XML = 1<<5, /* force XML serialization on HTML doc */ XML_SAVE_AS_HTML = 1<<6, /* force HTML serialization on XML doc */ XML_SAVE_WSNONSIG = 1<<7 /* format with non-significant whitespace */ } xmlSaveOption; typedef struct _xmlSaveCtxt xmlSaveCtxt; typedef xmlSaveCtxt *xmlSaveCtxtPtr; XMLPUBFUN xmlSaveCtxtPtr xmlSaveToFd (int fd, const char *encoding, int options); XMLPUBFUN xmlSaveCtxtPtr xmlSaveToFilename (const char *filename, const char *encoding, int options); XMLPUBFUN xmlSaveCtxtPtr xmlSaveToBuffer (xmlBufferPtr buffer, const char *encoding, int options); XMLPUBFUN xmlSaveCtxtPtr xmlSaveToIO (xmlOutputWriteCallback iowrite, xmlOutputCloseCallback ioclose, void *ioctx, const char *encoding, int options); XMLPUBFUN long xmlSaveDoc (xmlSaveCtxtPtr ctxt, xmlDocPtr doc); XMLPUBFUN long xmlSaveTree (xmlSaveCtxtPtr ctxt, xmlNodePtr node); XMLPUBFUN int xmlSaveFlush (xmlSaveCtxtPtr ctxt); XMLPUBFUN int xmlSaveClose (xmlSaveCtxtPtr ctxt); XMLPUBFUN int xmlSaveSetEscape (xmlSaveCtxtPtr ctxt, xmlCharEncodingOutputFunc escape); XMLPUBFUN int xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt, xmlCharEncodingOutputFunc escape); #ifdef __cplusplus } #endif #endif /* LIBXML_OUTPUT_ENABLED */ #endif /* __XML_XMLSAVE_H__ */
2,257
C++
.h
75
26.946667
76
0.72568
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,340
xmlschemastypes.h
Nevcairiel_LAVFilters/thirdparty/32/include/libxml2/libxml/xmlschemastypes.h
/* * Summary: implementation of XML Schema Datatypes * Description: module providing the XML Schema Datatypes implementation * both definition and validity checking * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_SCHEMA_TYPES_H__ #define __XML_SCHEMA_TYPES_H__ #include <libxml/xmlversion.h> #ifdef LIBXML_SCHEMAS_ENABLED #include <libxml/schemasInternals.h> #include <libxml/xmlschemas.h> #ifdef __cplusplus extern "C" { #endif typedef enum { XML_SCHEMA_WHITESPACE_UNKNOWN = 0, XML_SCHEMA_WHITESPACE_PRESERVE = 1, XML_SCHEMA_WHITESPACE_REPLACE = 2, XML_SCHEMA_WHITESPACE_COLLAPSE = 3 } xmlSchemaWhitespaceValueType; XMLPUBFUN int xmlSchemaInitTypes (void); XML_DEPRECATED XMLPUBFUN void xmlSchemaCleanupTypes (void); XMLPUBFUN xmlSchemaTypePtr xmlSchemaGetPredefinedType (const xmlChar *name, const xmlChar *ns); XMLPUBFUN int xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type, const xmlChar *value, xmlSchemaValPtr *val); XMLPUBFUN int xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type, const xmlChar *value, xmlSchemaValPtr *val, xmlNodePtr node); XMLPUBFUN int xmlSchemaValidateFacet (xmlSchemaTypePtr base, xmlSchemaFacetPtr facet, const xmlChar *value, xmlSchemaValPtr val); XMLPUBFUN int xmlSchemaValidateFacetWhtsp (xmlSchemaFacetPtr facet, xmlSchemaWhitespaceValueType fws, xmlSchemaValType valType, const xmlChar *value, xmlSchemaValPtr val, xmlSchemaWhitespaceValueType ws); XMLPUBFUN void xmlSchemaFreeValue (xmlSchemaValPtr val); XMLPUBFUN xmlSchemaFacetPtr xmlSchemaNewFacet (void); XMLPUBFUN int xmlSchemaCheckFacet (xmlSchemaFacetPtr facet, xmlSchemaTypePtr typeDecl, xmlSchemaParserCtxtPtr ctxt, const xmlChar *name); XMLPUBFUN void xmlSchemaFreeFacet (xmlSchemaFacetPtr facet); XMLPUBFUN int xmlSchemaCompareValues (xmlSchemaValPtr x, xmlSchemaValPtr y); XMLPUBFUN xmlSchemaTypePtr xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaTypePtr type); XMLPUBFUN int xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacetPtr facet, const xmlChar *value, unsigned long actualLen, unsigned long *expectedLen); XMLPUBFUN xmlSchemaTypePtr xmlSchemaGetBuiltInType (xmlSchemaValType type); XMLPUBFUN int xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type, int facetType); XMLPUBFUN xmlChar * xmlSchemaCollapseString (const xmlChar *value); XMLPUBFUN xmlChar * xmlSchemaWhiteSpaceReplace (const xmlChar *value); XMLPUBFUN unsigned long xmlSchemaGetFacetValueAsULong (xmlSchemaFacetPtr facet); XMLPUBFUN int xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type, xmlSchemaFacetPtr facet, const xmlChar *value, xmlSchemaValPtr val, unsigned long *length); XMLPUBFUN int xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet, xmlSchemaValType valType, const xmlChar *value, xmlSchemaValPtr val, unsigned long *length, xmlSchemaWhitespaceValueType ws); XMLPUBFUN int xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type, const xmlChar *value, xmlSchemaValPtr *val, xmlNodePtr node); XMLPUBFUN int xmlSchemaGetCanonValue (xmlSchemaValPtr val, const xmlChar **retValue); XMLPUBFUN int xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val, const xmlChar **retValue, xmlSchemaWhitespaceValueType ws); XMLPUBFUN int xmlSchemaValueAppend (xmlSchemaValPtr prev, xmlSchemaValPtr cur); XMLPUBFUN xmlSchemaValPtr xmlSchemaValueGetNext (xmlSchemaValPtr cur); XMLPUBFUN const xmlChar * xmlSchemaValueGetAsString (xmlSchemaValPtr val); XMLPUBFUN int xmlSchemaValueGetAsBoolean (xmlSchemaValPtr val); XMLPUBFUN xmlSchemaValPtr xmlSchemaNewStringValue (xmlSchemaValType type, const xmlChar *value); XMLPUBFUN xmlSchemaValPtr xmlSchemaNewNOTATIONValue (const xmlChar *name, const xmlChar *ns); XMLPUBFUN xmlSchemaValPtr xmlSchemaNewQNameValue (const xmlChar *namespaceName, const xmlChar *localName); XMLPUBFUN int xmlSchemaCompareValuesWhtsp (xmlSchemaValPtr x, xmlSchemaWhitespaceValueType xws, xmlSchemaValPtr y, xmlSchemaWhitespaceValueType yws); XMLPUBFUN xmlSchemaValPtr xmlSchemaCopyValue (xmlSchemaValPtr val); XMLPUBFUN xmlSchemaValType xmlSchemaGetValType (xmlSchemaValPtr val); #ifdef __cplusplus } #endif #endif /* LIBXML_SCHEMAS_ENABLED */ #endif /* __XML_SCHEMA_TYPES_H__ */
4,583
C++
.h
142
28.316901
72
0.785827
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,341
xmlwriter.h
Nevcairiel_LAVFilters/thirdparty/32/include/libxml2/libxml/xmlwriter.h
/* * Summary: text writing API for XML * Description: text writing API for XML * * Copy: See Copyright for the status of this software. * * Author: Alfred Mickautsch <alfred@mickautsch.de> */ #ifndef __XML_XMLWRITER_H__ #define __XML_XMLWRITER_H__ #include <libxml/xmlversion.h> #ifdef LIBXML_WRITER_ENABLED #include <stdarg.h> #include <libxml/xmlIO.h> #include <libxml/list.h> #include <libxml/xmlstring.h> #ifdef __cplusplus extern "C" { #endif typedef struct _xmlTextWriter xmlTextWriter; typedef xmlTextWriter *xmlTextWriterPtr; /* * Constructors & Destructor */ XMLPUBFUN xmlTextWriterPtr xmlNewTextWriter(xmlOutputBufferPtr out); XMLPUBFUN xmlTextWriterPtr xmlNewTextWriterFilename(const char *uri, int compression); XMLPUBFUN xmlTextWriterPtr xmlNewTextWriterMemory(xmlBufferPtr buf, int compression); XMLPUBFUN xmlTextWriterPtr xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, int compression); XMLPUBFUN xmlTextWriterPtr xmlNewTextWriterDoc(xmlDocPtr * doc, int compression); XMLPUBFUN xmlTextWriterPtr xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node, int compression); XMLPUBFUN void xmlFreeTextWriter(xmlTextWriterPtr writer); /* * Functions */ /* * Document */ XMLPUBFUN int xmlTextWriterStartDocument(xmlTextWriterPtr writer, const char *version, const char *encoding, const char *standalone); XMLPUBFUN int xmlTextWriterEndDocument(xmlTextWriterPtr writer); /* * Comments */ XMLPUBFUN int xmlTextWriterStartComment(xmlTextWriterPtr writer); XMLPUBFUN int xmlTextWriterEndComment(xmlTextWriterPtr writer); XMLPUBFUN int xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer, const char *format, ...) LIBXML_ATTR_FORMAT(2,3); XMLPUBFUN int xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(2,0); XMLPUBFUN int xmlTextWriterWriteComment(xmlTextWriterPtr writer, const xmlChar * content); /* * Elements */ XMLPUBFUN int xmlTextWriterStartElement(xmlTextWriterPtr writer, const xmlChar * name); XMLPUBFUN int xmlTextWriterStartElementNS(xmlTextWriterPtr writer, const xmlChar * prefix, const xmlChar * name, const xmlChar * namespaceURI); XMLPUBFUN int xmlTextWriterEndElement(xmlTextWriterPtr writer); XMLPUBFUN int xmlTextWriterFullEndElement(xmlTextWriterPtr writer); /* * Elements conveniency functions */ XMLPUBFUN int xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer, const xmlChar * name, const char *format, ...) LIBXML_ATTR_FORMAT(3,4); XMLPUBFUN int xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer, const xmlChar * name, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(3,0); XMLPUBFUN int xmlTextWriterWriteElement(xmlTextWriterPtr writer, const xmlChar * name, const xmlChar * content); XMLPUBFUN int xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer, const xmlChar * prefix, const xmlChar * name, const xmlChar * namespaceURI, const char *format, ...) LIBXML_ATTR_FORMAT(5,6); XMLPUBFUN int xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer, const xmlChar * prefix, const xmlChar * name, const xmlChar * namespaceURI, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(5,0); XMLPUBFUN int xmlTextWriterWriteElementNS(xmlTextWriterPtr writer, const xmlChar * prefix, const xmlChar * name, const xmlChar * namespaceURI, const xmlChar * content); /* * Text */ XMLPUBFUN int xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer, const char *format, ...) LIBXML_ATTR_FORMAT(2,3); XMLPUBFUN int xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(2,0); XMLPUBFUN int xmlTextWriterWriteRawLen(xmlTextWriterPtr writer, const xmlChar * content, int len); XMLPUBFUN int xmlTextWriterWriteRaw(xmlTextWriterPtr writer, const xmlChar * content); XMLPUBFUN int xmlTextWriterWriteFormatString(xmlTextWriterPtr writer, const char *format, ...) LIBXML_ATTR_FORMAT(2,3); XMLPUBFUN int xmlTextWriterWriteVFormatString(xmlTextWriterPtr writer, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(2,0); XMLPUBFUN int xmlTextWriterWriteString(xmlTextWriterPtr writer, const xmlChar * content); XMLPUBFUN int xmlTextWriterWriteBase64(xmlTextWriterPtr writer, const char *data, int start, int len); XMLPUBFUN int xmlTextWriterWriteBinHex(xmlTextWriterPtr writer, const char *data, int start, int len); /* * Attributes */ XMLPUBFUN int xmlTextWriterStartAttribute(xmlTextWriterPtr writer, const xmlChar * name); XMLPUBFUN int xmlTextWriterStartAttributeNS(xmlTextWriterPtr writer, const xmlChar * prefix, const xmlChar * name, const xmlChar * namespaceURI); XMLPUBFUN int xmlTextWriterEndAttribute(xmlTextWriterPtr writer); /* * Attributes conveniency functions */ XMLPUBFUN int xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer, const xmlChar * name, const char *format, ...) LIBXML_ATTR_FORMAT(3,4); XMLPUBFUN int xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer, const xmlChar * name, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(3,0); XMLPUBFUN int xmlTextWriterWriteAttribute(xmlTextWriterPtr writer, const xmlChar * name, const xmlChar * content); XMLPUBFUN int xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer, const xmlChar * prefix, const xmlChar * name, const xmlChar * namespaceURI, const char *format, ...) LIBXML_ATTR_FORMAT(5,6); XMLPUBFUN int xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer, const xmlChar * prefix, const xmlChar * name, const xmlChar * namespaceURI, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(5,0); XMLPUBFUN int xmlTextWriterWriteAttributeNS(xmlTextWriterPtr writer, const xmlChar * prefix, const xmlChar * name, const xmlChar * namespaceURI, const xmlChar * content); /* * PI's */ XMLPUBFUN int xmlTextWriterStartPI(xmlTextWriterPtr writer, const xmlChar * target); XMLPUBFUN int xmlTextWriterEndPI(xmlTextWriterPtr writer); /* * PI conveniency functions */ XMLPUBFUN int xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer, const xmlChar * target, const char *format, ...) LIBXML_ATTR_FORMAT(3,4); XMLPUBFUN int xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer, const xmlChar * target, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(3,0); XMLPUBFUN int xmlTextWriterWritePI(xmlTextWriterPtr writer, const xmlChar * target, const xmlChar * content); /** * xmlTextWriterWriteProcessingInstruction: * * This macro maps to xmlTextWriterWritePI */ #define xmlTextWriterWriteProcessingInstruction xmlTextWriterWritePI /* * CDATA */ XMLPUBFUN int xmlTextWriterStartCDATA(xmlTextWriterPtr writer); XMLPUBFUN int xmlTextWriterEndCDATA(xmlTextWriterPtr writer); /* * CDATA conveniency functions */ XMLPUBFUN int xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer, const char *format, ...) LIBXML_ATTR_FORMAT(2,3); XMLPUBFUN int xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(2,0); XMLPUBFUN int xmlTextWriterWriteCDATA(xmlTextWriterPtr writer, const xmlChar * content); /* * DTD */ XMLPUBFUN int xmlTextWriterStartDTD(xmlTextWriterPtr writer, const xmlChar * name, const xmlChar * pubid, const xmlChar * sysid); XMLPUBFUN int xmlTextWriterEndDTD(xmlTextWriterPtr writer); /* * DTD conveniency functions */ XMLPUBFUN int xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer, const xmlChar * name, const xmlChar * pubid, const xmlChar * sysid, const char *format, ...) LIBXML_ATTR_FORMAT(5,6); XMLPUBFUN int xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer, const xmlChar * name, const xmlChar * pubid, const xmlChar * sysid, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(5,0); XMLPUBFUN int xmlTextWriterWriteDTD(xmlTextWriterPtr writer, const xmlChar * name, const xmlChar * pubid, const xmlChar * sysid, const xmlChar * subset); /** * xmlTextWriterWriteDocType: * * this macro maps to xmlTextWriterWriteDTD */ #define xmlTextWriterWriteDocType xmlTextWriterWriteDTD /* * DTD element definition */ XMLPUBFUN int xmlTextWriterStartDTDElement(xmlTextWriterPtr writer, const xmlChar * name); XMLPUBFUN int xmlTextWriterEndDTDElement(xmlTextWriterPtr writer); /* * DTD element definition conveniency functions */ XMLPUBFUN int xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer, const xmlChar * name, const char *format, ...) LIBXML_ATTR_FORMAT(3,4); XMLPUBFUN int xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer, const xmlChar * name, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(3,0); XMLPUBFUN int xmlTextWriterWriteDTDElement(xmlTextWriterPtr writer, const xmlChar * name, const xmlChar * content); /* * DTD attribute list definition */ XMLPUBFUN int xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer, const xmlChar * name); XMLPUBFUN int xmlTextWriterEndDTDAttlist(xmlTextWriterPtr writer); /* * DTD attribute list definition conveniency functions */ XMLPUBFUN int xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer, const xmlChar * name, const char *format, ...) LIBXML_ATTR_FORMAT(3,4); XMLPUBFUN int xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer, const xmlChar * name, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(3,0); XMLPUBFUN int xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr writer, const xmlChar * name, const xmlChar * content); /* * DTD entity definition */ XMLPUBFUN int xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer, int pe, const xmlChar * name); XMLPUBFUN int xmlTextWriterEndDTDEntity(xmlTextWriterPtr writer); /* * DTD entity definition conveniency functions */ XMLPUBFUN int xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer, int pe, const xmlChar * name, const char *format, ...) LIBXML_ATTR_FORMAT(4,5); XMLPUBFUN int xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer, int pe, const xmlChar * name, const char *format, va_list argptr) LIBXML_ATTR_FORMAT(4,0); XMLPUBFUN int xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer, int pe, const xmlChar * name, const xmlChar * content); XMLPUBFUN int xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer, int pe, const xmlChar * name, const xmlChar * pubid, const xmlChar * sysid, const xmlChar * ndataid); XMLPUBFUN int xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr writer, const xmlChar * pubid, const xmlChar * sysid, const xmlChar * ndataid); XMLPUBFUN int xmlTextWriterWriteDTDEntity(xmlTextWriterPtr writer, int pe, const xmlChar * name, const xmlChar * pubid, const xmlChar * sysid, const xmlChar * ndataid, const xmlChar * content); /* * DTD notation definition */ XMLPUBFUN int xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer, const xmlChar * name, const xmlChar * pubid, const xmlChar * sysid); /* * Indentation */ XMLPUBFUN int xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent); XMLPUBFUN int xmlTextWriterSetIndentString(xmlTextWriterPtr writer, const xmlChar * str); XMLPUBFUN int xmlTextWriterSetQuoteChar(xmlTextWriterPtr writer, xmlChar quotechar); /* * misc */ XMLPUBFUN int xmlTextWriterFlush(xmlTextWriterPtr writer); #ifdef __cplusplus } #endif #endif /* LIBXML_WRITER_ENABLED */ #endif /* __XML_XMLWRITER_H__ */
20,625
C++
.h
450
23.497778
78
0.444058
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,342
xmlstring.h
Nevcairiel_LAVFilters/thirdparty/32/include/libxml2/libxml/xmlstring.h
/* * Summary: set of routines to process strings * Description: type and interfaces needed for the internal string handling * of the library, especially UTF8 processing. * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_STRING_H__ #define __XML_STRING_H__ #include <stdarg.h> #include <libxml/xmlversion.h> #ifdef __cplusplus extern "C" { #endif /** * xmlChar: * * This is a basic byte in an UTF-8 encoded string. * It's unsigned allowing to pinpoint case where char * are assigned * to xmlChar * (possibly making serialization back impossible). */ typedef unsigned char xmlChar; /** * BAD_CAST: * * Macro to cast a string to an xmlChar * when one know its safe. */ #define BAD_CAST (xmlChar *) /* * xmlChar handling */ XMLPUBFUN xmlChar * xmlStrdup (const xmlChar *cur); XMLPUBFUN xmlChar * xmlStrndup (const xmlChar *cur, int len); XMLPUBFUN xmlChar * xmlCharStrndup (const char *cur, int len); XMLPUBFUN xmlChar * xmlCharStrdup (const char *cur); XMLPUBFUN xmlChar * xmlStrsub (const xmlChar *str, int start, int len); XMLPUBFUN const xmlChar * xmlStrchr (const xmlChar *str, xmlChar val); XMLPUBFUN const xmlChar * xmlStrstr (const xmlChar *str, const xmlChar *val); XMLPUBFUN const xmlChar * xmlStrcasestr (const xmlChar *str, const xmlChar *val); XMLPUBFUN int xmlStrcmp (const xmlChar *str1, const xmlChar *str2); XMLPUBFUN int xmlStrncmp (const xmlChar *str1, const xmlChar *str2, int len); XMLPUBFUN int xmlStrcasecmp (const xmlChar *str1, const xmlChar *str2); XMLPUBFUN int xmlStrncasecmp (const xmlChar *str1, const xmlChar *str2, int len); XMLPUBFUN int xmlStrEqual (const xmlChar *str1, const xmlChar *str2); XMLPUBFUN int xmlStrQEqual (const xmlChar *pref, const xmlChar *name, const xmlChar *str); XMLPUBFUN int xmlStrlen (const xmlChar *str); XMLPUBFUN xmlChar * xmlStrcat (xmlChar *cur, const xmlChar *add); XMLPUBFUN xmlChar * xmlStrncat (xmlChar *cur, const xmlChar *add, int len); XMLPUBFUN xmlChar * xmlStrncatNew (const xmlChar *str1, const xmlChar *str2, int len); XMLPUBFUN int xmlStrPrintf (xmlChar *buf, int len, const char *msg, ...) LIBXML_ATTR_FORMAT(3,4); XMLPUBFUN int xmlStrVPrintf (xmlChar *buf, int len, const char *msg, va_list ap) LIBXML_ATTR_FORMAT(3,0); XMLPUBFUN int xmlGetUTF8Char (const unsigned char *utf, int *len); XMLPUBFUN int xmlCheckUTF8 (const unsigned char *utf); XMLPUBFUN int xmlUTF8Strsize (const xmlChar *utf, int len); XMLPUBFUN xmlChar * xmlUTF8Strndup (const xmlChar *utf, int len); XMLPUBFUN const xmlChar * xmlUTF8Strpos (const xmlChar *utf, int pos); XMLPUBFUN int xmlUTF8Strloc (const xmlChar *utf, const xmlChar *utfchar); XMLPUBFUN xmlChar * xmlUTF8Strsub (const xmlChar *utf, int start, int len); XMLPUBFUN int xmlUTF8Strlen (const xmlChar *utf); XMLPUBFUN int xmlUTF8Size (const xmlChar *utf); XMLPUBFUN int xmlUTF8Charcmp (const xmlChar *utf1, const xmlChar *utf2); #ifdef __cplusplus } #endif #endif /* __XML_STRING_H__ */
5,271
C++
.h
132
24.818182
77
0.432274
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,343
version.h
Nevcairiel_LAVFilters/thirdparty/32/include/dav1d/version.h
/* * Copyright © 2019, VideoLAN and dav1d authors * 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. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT OWNER 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 DAV1D_VERSION_H #define DAV1D_VERSION_H #ifdef __cplusplus extern "C" { #endif #define DAV1D_API_VERSION_MAJOR 7 #define DAV1D_API_VERSION_MINOR 0 #define DAV1D_API_VERSION_PATCH 0 /** * Extract version components from the value returned by * dav1d_version_int() */ #define DAV1D_API_MAJOR(v) (((v) >> 16) & 0xFF) #define DAV1D_API_MINOR(v) (((v) >> 8) & 0xFF) #define DAV1D_API_PATCH(v) (((v) >> 0) & 0xFF) #ifdef __cplusplus } /* extern "C" */ #endif #endif /* DAV1D_VERSION_H */
1,885
C++
.h
44
41.090909
82
0.759673
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,344
picture.h
Nevcairiel_LAVFilters/thirdparty/32/include/dav1d/picture.h
/* * Copyright © 2018-2020, VideoLAN and dav1d authors * Copyright © 2018, Two Orioles, LLC * 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. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT OWNER 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 DAV1D_PICTURE_H #define DAV1D_PICTURE_H #include <stddef.h> #include <stdint.h> #include "common.h" #include "headers.h" #ifdef __cplusplus extern "C" { #endif /* Number of bytes to align AND pad picture memory buffers by, so that SIMD * implementations can over-read by a few bytes, and use aligned read/write * instructions. */ #define DAV1D_PICTURE_ALIGNMENT 64 typedef struct Dav1dPictureParameters { int w; ///< width (in pixels) int h; ///< height (in pixels) enum Dav1dPixelLayout layout; ///< format of the picture int bpc; ///< bits per pixel component (8 or 10) } Dav1dPictureParameters; typedef struct Dav1dPicture { Dav1dSequenceHeader *seq_hdr; Dav1dFrameHeader *frame_hdr; /** * Pointers to planar image data (Y is [0], U is [1], V is [2]). The data * should be bytes (for 8 bpc) or words (for 10 bpc). In case of words * containing 10 bpc image data, the pixels should be located in the LSB * bits, so that values range between [0, 1023]; the upper bits should be * zero'ed out. */ void *data[3]; /** * Number of bytes between 2 lines in data[] for luma [0] or chroma [1]. */ ptrdiff_t stride[2]; Dav1dPictureParameters p; Dav1dDataProps m; /** * High Dynamic Range Content Light Level metadata applying to this picture, * as defined in section 5.8.3 and 6.7.3 */ Dav1dContentLightLevel *content_light; /** * High Dynamic Range Mastering Display Color Volume metadata applying to * this picture, as defined in section 5.8.4 and 6.7.4 */ Dav1dMasteringDisplay *mastering_display; /** * Array of ITU-T T.35 metadata as defined in section 5.8.2 and 6.7.2 */ Dav1dITUTT35 *itut_t35; /** * Number of ITU-T T35 metadata entries in the array */ size_t n_itut_t35; uintptr_t reserved[4]; ///< reserved for future use struct Dav1dRef *frame_hdr_ref; ///< Dav1dFrameHeader allocation origin struct Dav1dRef *seq_hdr_ref; ///< Dav1dSequenceHeader allocation origin struct Dav1dRef *content_light_ref; ///< Dav1dContentLightLevel allocation origin struct Dav1dRef *mastering_display_ref; ///< Dav1dMasteringDisplay allocation origin struct Dav1dRef *itut_t35_ref; ///< Dav1dITUTT35 allocation origin uintptr_t reserved_ref[4]; ///< reserved for future use struct Dav1dRef *ref; ///< Frame data allocation origin void *allocator_data; ///< pointer managed by the allocator } Dav1dPicture; typedef struct Dav1dPicAllocator { void *cookie; ///< custom data to pass to the allocator callbacks. /** * Allocate the picture buffer based on the Dav1dPictureParameters. * * The data[0], data[1] and data[2] must be DAV1D_PICTURE_ALIGNMENT byte * aligned and with a pixel width/height multiple of 128 pixels. Any * allocated memory area should also be padded by DAV1D_PICTURE_ALIGNMENT * bytes. * data[1] and data[2] must share the same stride[1]. * * This function will be called on the main thread (the thread which calls * dav1d_get_picture()). * * @param pic The picture to allocate the buffer for. The callback needs to * fill the picture data[0], data[1], data[2], stride[0] and * stride[1]. * The allocator can fill the pic allocator_data pointer with * a custom pointer that will be passed to * release_picture_callback(). * @param cookie Custom pointer passed to all calls. * * @note No fields other than data, stride and allocator_data must be filled * by this callback. * @return 0 on success. A negative DAV1D_ERR value on error. */ int (*alloc_picture_callback)(Dav1dPicture *pic, void *cookie); /** * Release the picture buffer. * * If frame threading is used, this function may be called by the main * thread (the thread which calls dav1d_get_picture()) or any of the frame * threads and thus must be thread-safe. If frame threading is not used, * this function will only be called on the main thread. * * @param pic The picture that was filled by alloc_picture_callback(). * @param cookie Custom pointer passed to all calls. */ void (*release_picture_callback)(Dav1dPicture *pic, void *cookie); } Dav1dPicAllocator; /** * Release reference to a picture. */ DAV1D_API void dav1d_picture_unref(Dav1dPicture *p); #ifdef __cplusplus } /* extern "C" */ #endif #endif /* DAV1D_PICTURE_H */
6,013
C++
.h
138
39.376812
88
0.704817
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,345
data.h
Nevcairiel_LAVFilters/thirdparty/32/include/dav1d/data.h
/* * Copyright © 2018, VideoLAN and dav1d authors * Copyright © 2018, Two Orioles, LLC * 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. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT OWNER 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 DAV1D_DATA_H #define DAV1D_DATA_H #include <stddef.h> #include <stdint.h> #include "common.h" #ifdef __cplusplus extern "C" { #endif typedef struct Dav1dData { const uint8_t *data; ///< data pointer size_t sz; ///< data size struct Dav1dRef *ref; ///< allocation origin Dav1dDataProps m; ///< user provided metadata passed to the output picture } Dav1dData; /** * Allocate data. * * @param data Input context. * @param sz Size of the data that should be allocated. * * @return Pointer to the allocated buffer on success. NULL on error. */ DAV1D_API uint8_t * dav1d_data_create(Dav1dData *data, size_t sz); /** * Wrap an existing data array. * * @param data Input context. * @param buf The data to be wrapped. * @param sz Size of the data. * @param free_callback Function to be called when we release our last * reference to this data. In this callback, $buf will be * the $buf argument to this function, and $cookie will * be the $cookie input argument to this function. * @param cookie Opaque parameter passed to free_callback(). * * @return 0 on success. A negative DAV1D_ERR value on error. */ DAV1D_API int dav1d_data_wrap(Dav1dData *data, const uint8_t *buf, size_t sz, void (*free_callback)(const uint8_t *buf, void *cookie), void *cookie); /** * Wrap a user-provided data pointer into a reference counted object. * * data->m.user_data field will initialized to wrap the provided $user_data * pointer. * * $free_callback will be called on the same thread that released the last * reference. If frame threading is used, make sure $free_callback is * thread-safe. * * @param data Input context. * @param user_data The user data to be wrapped. * @param free_callback Function to be called when we release our last * reference to this data. In this callback, $user_data * will be the $user_data argument to this function, and * $cookie will be the $cookie input argument to this * function. * @param cookie Opaque parameter passed to $free_callback. * * @return 0 on success. A negative DAV1D_ERR value on error. */ DAV1D_API int dav1d_data_wrap_user_data(Dav1dData *data, const uint8_t *user_data, void (*free_callback)(const uint8_t *user_data, void *cookie), void *cookie); /** * Free the data reference. * * The reference count for data->m.user_data will be decremented (if it has been * initialized with dav1d_data_wrap_user_data). The $data object will be memset * to 0. * * @param data Input context. */ DAV1D_API void dav1d_data_unref(Dav1dData *data); #ifdef __cplusplus } /* extern "C" */ #endif #endif /* DAV1D_DATA_H */
4,488
C++
.h
106
38.09434
87
0.67155
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,346
headers.h
Nevcairiel_LAVFilters/thirdparty/32/include/dav1d/headers.h
/* * Copyright © 2018-2020, VideoLAN and dav1d authors * Copyright © 2018, Two Orioles, LLC * 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. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT OWNER 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 DAV1D_HEADERS_H #define DAV1D_HEADERS_H #include <stdint.h> #include <stddef.h> #ifdef __cplusplus extern "C" { #endif // Constants from Section 3. "Symbols and abbreviated terms" #define DAV1D_MAX_CDEF_STRENGTHS 8 #define DAV1D_MAX_OPERATING_POINTS 32 #define DAV1D_MAX_TILE_COLS 64 #define DAV1D_MAX_TILE_ROWS 64 #define DAV1D_MAX_SEGMENTS 8 #define DAV1D_NUM_REF_FRAMES 8 #define DAV1D_PRIMARY_REF_NONE 7 #define DAV1D_REFS_PER_FRAME 7 #define DAV1D_TOTAL_REFS_PER_FRAME (DAV1D_REFS_PER_FRAME + 1) enum Dav1dObuType { DAV1D_OBU_SEQ_HDR = 1, DAV1D_OBU_TD = 2, DAV1D_OBU_FRAME_HDR = 3, DAV1D_OBU_TILE_GRP = 4, DAV1D_OBU_METADATA = 5, DAV1D_OBU_FRAME = 6, DAV1D_OBU_REDUNDANT_FRAME_HDR = 7, DAV1D_OBU_PADDING = 15, }; enum Dav1dTxfmMode { DAV1D_TX_4X4_ONLY, DAV1D_TX_LARGEST, DAV1D_TX_SWITCHABLE, DAV1D_N_TX_MODES, }; enum Dav1dFilterMode { DAV1D_FILTER_8TAP_REGULAR, DAV1D_FILTER_8TAP_SMOOTH, DAV1D_FILTER_8TAP_SHARP, DAV1D_N_SWITCHABLE_FILTERS, DAV1D_FILTER_BILINEAR = DAV1D_N_SWITCHABLE_FILTERS, DAV1D_N_FILTERS, DAV1D_FILTER_SWITCHABLE = DAV1D_N_FILTERS, }; enum Dav1dAdaptiveBoolean { DAV1D_OFF = 0, DAV1D_ON = 1, DAV1D_ADAPTIVE = 2, }; enum Dav1dRestorationType { DAV1D_RESTORATION_NONE, DAV1D_RESTORATION_SWITCHABLE, DAV1D_RESTORATION_WIENER, DAV1D_RESTORATION_SGRPROJ, }; enum Dav1dWarpedMotionType { DAV1D_WM_TYPE_IDENTITY, DAV1D_WM_TYPE_TRANSLATION, DAV1D_WM_TYPE_ROT_ZOOM, DAV1D_WM_TYPE_AFFINE, }; typedef struct Dav1dWarpedMotionParams { enum Dav1dWarpedMotionType type; int32_t matrix[6]; union { struct { int16_t alpha, beta, gamma, delta; } p; int16_t abcd[4]; } u; } Dav1dWarpedMotionParams; enum Dav1dPixelLayout { DAV1D_PIXEL_LAYOUT_I400, ///< monochrome DAV1D_PIXEL_LAYOUT_I420, ///< 4:2:0 planar DAV1D_PIXEL_LAYOUT_I422, ///< 4:2:2 planar DAV1D_PIXEL_LAYOUT_I444, ///< 4:4:4 planar }; enum Dav1dFrameType { DAV1D_FRAME_TYPE_KEY = 0, ///< Key Intra frame DAV1D_FRAME_TYPE_INTER = 1, ///< Inter frame DAV1D_FRAME_TYPE_INTRA = 2, ///< Non key Intra frame DAV1D_FRAME_TYPE_SWITCH = 3, ///< Switch Inter frame }; enum Dav1dColorPrimaries { DAV1D_COLOR_PRI_BT709 = 1, DAV1D_COLOR_PRI_UNKNOWN = 2, DAV1D_COLOR_PRI_BT470M = 4, DAV1D_COLOR_PRI_BT470BG = 5, DAV1D_COLOR_PRI_BT601 = 6, DAV1D_COLOR_PRI_SMPTE240 = 7, DAV1D_COLOR_PRI_FILM = 8, DAV1D_COLOR_PRI_BT2020 = 9, DAV1D_COLOR_PRI_XYZ = 10, DAV1D_COLOR_PRI_SMPTE431 = 11, DAV1D_COLOR_PRI_SMPTE432 = 12, DAV1D_COLOR_PRI_EBU3213 = 22, DAV1D_COLOR_PRI_RESERVED = 255, }; enum Dav1dTransferCharacteristics { DAV1D_TRC_BT709 = 1, DAV1D_TRC_UNKNOWN = 2, DAV1D_TRC_BT470M = 4, DAV1D_TRC_BT470BG = 5, DAV1D_TRC_BT601 = 6, DAV1D_TRC_SMPTE240 = 7, DAV1D_TRC_LINEAR = 8, DAV1D_TRC_LOG100 = 9, ///< logarithmic (100:1 range) DAV1D_TRC_LOG100_SQRT10 = 10, ///< lograithmic (100*sqrt(10):1 range) DAV1D_TRC_IEC61966 = 11, DAV1D_TRC_BT1361 = 12, DAV1D_TRC_SRGB = 13, DAV1D_TRC_BT2020_10BIT = 14, DAV1D_TRC_BT2020_12BIT = 15, DAV1D_TRC_SMPTE2084 = 16, ///< PQ DAV1D_TRC_SMPTE428 = 17, DAV1D_TRC_HLG = 18, ///< hybrid log/gamma (BT.2100 / ARIB STD-B67) DAV1D_TRC_RESERVED = 255, }; enum Dav1dMatrixCoefficients { DAV1D_MC_IDENTITY = 0, DAV1D_MC_BT709 = 1, DAV1D_MC_UNKNOWN = 2, DAV1D_MC_FCC = 4, DAV1D_MC_BT470BG = 5, DAV1D_MC_BT601 = 6, DAV1D_MC_SMPTE240 = 7, DAV1D_MC_SMPTE_YCGCO = 8, DAV1D_MC_BT2020_NCL = 9, DAV1D_MC_BT2020_CL = 10, DAV1D_MC_SMPTE2085 = 11, DAV1D_MC_CHROMAT_NCL = 12, ///< Chromaticity-derived DAV1D_MC_CHROMAT_CL = 13, DAV1D_MC_ICTCP = 14, DAV1D_MC_RESERVED = 255, }; enum Dav1dChromaSamplePosition { DAV1D_CHR_UNKNOWN = 0, DAV1D_CHR_VERTICAL = 1, ///< Horizontally co-located with luma(0, 0) ///< sample, between two vertical samples DAV1D_CHR_COLOCATED = 2, ///< Co-located with luma(0, 0) sample }; typedef struct Dav1dContentLightLevel { uint16_t max_content_light_level; uint16_t max_frame_average_light_level; } Dav1dContentLightLevel; typedef struct Dav1dMasteringDisplay { ///< 0.16 fixed point uint16_t primaries[3][2]; ///< 0.16 fixed point uint16_t white_point[2]; ///< 24.8 fixed point uint32_t max_luminance; ///< 18.14 fixed point uint32_t min_luminance; } Dav1dMasteringDisplay; typedef struct Dav1dITUTT35 { uint8_t country_code; uint8_t country_code_extension_byte; size_t payload_size; uint8_t *payload; } Dav1dITUTT35; typedef struct Dav1dSequenceHeader { /** * Stream profile, 0 for 8-10 bits/component 4:2:0 or monochrome; * 1 for 8-10 bits/component 4:4:4; 2 for 4:2:2 at any bits/component, * or 12 bits/component at any chroma subsampling. */ uint8_t profile; /** * Maximum dimensions for this stream. In non-scalable streams, these * are often the actual dimensions of the stream, although that is not * a normative requirement. */ int max_width, max_height; enum Dav1dPixelLayout layout; ///< format of the picture enum Dav1dColorPrimaries pri; ///< color primaries (av1) enum Dav1dTransferCharacteristics trc; ///< transfer characteristics (av1) enum Dav1dMatrixCoefficients mtrx; ///< matrix coefficients (av1) enum Dav1dChromaSamplePosition chr; ///< chroma sample position (av1) /** * 0, 1 and 2 mean 8, 10 or 12 bits/component, respectively. This is not * exactly the same as 'hbd' from the spec; the spec's hbd distinguishes * between 8 (0) and 10-12 (1) bits/component, and another element * (twelve_bit) to distinguish between 10 and 12 bits/component. To get * the spec's hbd, use !!our_hbd, and to get twelve_bit, use hbd == 2. */ uint8_t hbd; /** * Pixel data uses JPEG pixel range ([0,255] for 8bits) instead of * MPEG pixel range ([16,235] for 8bits luma, [16,240] for 8bits chroma). */ uint8_t color_range; uint8_t num_operating_points; struct Dav1dSequenceHeaderOperatingPoint { uint8_t major_level, minor_level; uint8_t initial_display_delay; uint16_t idc; uint8_t tier; uint8_t decoder_model_param_present; uint8_t display_model_param_present; } operating_points[DAV1D_MAX_OPERATING_POINTS]; uint8_t still_picture; uint8_t reduced_still_picture_header; uint8_t timing_info_present; uint32_t num_units_in_tick; uint32_t time_scale; uint8_t equal_picture_interval; uint32_t num_ticks_per_picture; uint8_t decoder_model_info_present; uint8_t encoder_decoder_buffer_delay_length; uint32_t num_units_in_decoding_tick; uint8_t buffer_removal_delay_length; uint8_t frame_presentation_delay_length; uint8_t display_model_info_present; uint8_t width_n_bits, height_n_bits; uint8_t frame_id_numbers_present; uint8_t delta_frame_id_n_bits; uint8_t frame_id_n_bits; uint8_t sb128; uint8_t filter_intra; uint8_t intra_edge_filter; uint8_t inter_intra; uint8_t masked_compound; uint8_t warped_motion; uint8_t dual_filter; uint8_t order_hint; uint8_t jnt_comp; uint8_t ref_frame_mvs; enum Dav1dAdaptiveBoolean screen_content_tools; enum Dav1dAdaptiveBoolean force_integer_mv; uint8_t order_hint_n_bits; uint8_t super_res; uint8_t cdef; uint8_t restoration; uint8_t ss_hor, ss_ver, monochrome; uint8_t color_description_present; uint8_t separate_uv_delta_q; uint8_t film_grain_present; // Dav1dSequenceHeaders of the same sequence are required to be // bit-identical until this offset. See 7.5 "Ordering of OBUs": // Within a particular coded video sequence, the contents of // sequence_header_obu must be bit-identical each time the // sequence header appears except for the contents of // operating_parameters_info. struct Dav1dSequenceHeaderOperatingParameterInfo { uint32_t decoder_buffer_delay; uint32_t encoder_buffer_delay; uint8_t low_delay_mode; } operating_parameter_info[DAV1D_MAX_OPERATING_POINTS]; } Dav1dSequenceHeader; typedef struct Dav1dSegmentationData { int16_t delta_q; int8_t delta_lf_y_v, delta_lf_y_h, delta_lf_u, delta_lf_v; int8_t ref; uint8_t skip; uint8_t globalmv; } Dav1dSegmentationData; typedef struct Dav1dSegmentationDataSet { Dav1dSegmentationData d[DAV1D_MAX_SEGMENTS]; uint8_t preskip; int8_t last_active_segid; } Dav1dSegmentationDataSet; typedef struct Dav1dLoopfilterModeRefDeltas { int8_t mode_delta[2 /* is_zeromv */]; int8_t ref_delta[DAV1D_TOTAL_REFS_PER_FRAME]; } Dav1dLoopfilterModeRefDeltas; typedef struct Dav1dFilmGrainData { unsigned seed; int num_y_points; uint8_t y_points[14][2 /* value, scaling */]; int chroma_scaling_from_luma; int num_uv_points[2]; uint8_t uv_points[2][10][2 /* value, scaling */]; int scaling_shift; int ar_coeff_lag; int8_t ar_coeffs_y[24]; int8_t ar_coeffs_uv[2][25 + 3 /* padding for alignment purposes */]; uint64_t ar_coeff_shift; int grain_scale_shift; int uv_mult[2]; int uv_luma_mult[2]; int uv_offset[2]; int overlap_flag; int clip_to_restricted_range; } Dav1dFilmGrainData; typedef struct Dav1dFrameHeader { struct { Dav1dFilmGrainData data; uint8_t present, update; } film_grain; ///< film grain parameters enum Dav1dFrameType frame_type; ///< type of the picture int width[2 /* { coded_width, superresolution_upscaled_width } */], height; uint8_t frame_offset; ///< frame number uint8_t temporal_id; ///< temporal id of the frame for SVC uint8_t spatial_id; ///< spatial id of the frame for SVC uint8_t show_existing_frame; uint8_t existing_frame_idx; uint32_t frame_id; uint32_t frame_presentation_delay; uint8_t show_frame; uint8_t showable_frame; uint8_t error_resilient_mode; uint8_t disable_cdf_update; uint8_t allow_screen_content_tools; uint8_t force_integer_mv; uint8_t frame_size_override; uint8_t primary_ref_frame; uint8_t buffer_removal_time_present; struct Dav1dFrameHeaderOperatingPoint { uint32_t buffer_removal_time; } operating_points[DAV1D_MAX_OPERATING_POINTS]; uint8_t refresh_frame_flags; int render_width, render_height; struct { uint8_t width_scale_denominator; uint8_t enabled; } super_res; uint8_t have_render_size; uint8_t allow_intrabc; uint8_t frame_ref_short_signaling; int8_t refidx[DAV1D_REFS_PER_FRAME]; uint8_t hp; enum Dav1dFilterMode subpel_filter_mode; uint8_t switchable_motion_mode; uint8_t use_ref_frame_mvs; uint8_t refresh_context; struct { uint8_t uniform; uint8_t n_bytes; uint8_t min_log2_cols, max_log2_cols, log2_cols, cols; uint8_t min_log2_rows, max_log2_rows, log2_rows, rows; uint16_t col_start_sb[DAV1D_MAX_TILE_COLS + 1]; uint16_t row_start_sb[DAV1D_MAX_TILE_ROWS + 1]; uint16_t update; } tiling; struct { uint8_t yac; int8_t ydc_delta; int8_t udc_delta, uac_delta, vdc_delta, vac_delta; uint8_t qm, qm_y, qm_u, qm_v; } quant; struct { uint8_t enabled, update_map, temporal, update_data; Dav1dSegmentationDataSet seg_data; uint8_t lossless[DAV1D_MAX_SEGMENTS], qidx[DAV1D_MAX_SEGMENTS]; } segmentation; struct { struct { uint8_t present; uint8_t res_log2; } q; struct { uint8_t present; uint8_t res_log2; uint8_t multi; } lf; } delta; uint8_t all_lossless; struct { uint8_t level_y[2 /* dir */]; uint8_t level_u, level_v; uint8_t mode_ref_delta_enabled; uint8_t mode_ref_delta_update; Dav1dLoopfilterModeRefDeltas mode_ref_deltas; uint8_t sharpness; } loopfilter; struct { uint8_t damping; uint8_t n_bits; uint8_t y_strength[DAV1D_MAX_CDEF_STRENGTHS]; uint8_t uv_strength[DAV1D_MAX_CDEF_STRENGTHS]; } cdef; struct { enum Dav1dRestorationType type[3 /* plane */]; uint8_t unit_size[2 /* y, uv */]; } restoration; enum Dav1dTxfmMode txfm_mode; uint8_t switchable_comp_refs; uint8_t skip_mode_allowed, skip_mode_enabled; int8_t skip_mode_refs[2]; uint8_t warp_motion; uint8_t reduced_txtp_set; Dav1dWarpedMotionParams gmv[DAV1D_REFS_PER_FRAME]; } Dav1dFrameHeader; #ifdef __cplusplus } /* extern "C" */ #endif #endif /* DAV1D_HEADERS_H */
14,355
C++
.h
412
29.912621
82
0.68524
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,347
dav1d.h
Nevcairiel_LAVFilters/thirdparty/32/include/dav1d/dav1d.h
/* * Copyright © 2018-2021, VideoLAN and dav1d authors * Copyright © 2018, Two Orioles, LLC * 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. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT OWNER 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 DAV1D_H #define DAV1D_H #include <errno.h> #include <stdarg.h> #include "common.h" #include "picture.h" #include "data.h" #include "version.h" #ifdef __cplusplus extern "C" { #endif typedef struct Dav1dContext Dav1dContext; typedef struct Dav1dRef Dav1dRef; #define DAV1D_MAX_THREADS 256 #define DAV1D_MAX_FRAME_DELAY 256 typedef struct Dav1dLogger { void *cookie; ///< Custom data to pass to the callback. /** * Logger callback. May be NULL to disable logging. * * @param cookie Custom pointer passed to all calls. * @param format The vprintf compatible format string. * @param ap List of arguments referenced by the format string. */ void (*callback)(void *cookie, const char *format, va_list ap); } Dav1dLogger; enum Dav1dInloopFilterType { DAV1D_INLOOPFILTER_NONE = 0, DAV1D_INLOOPFILTER_DEBLOCK = 1 << 0, DAV1D_INLOOPFILTER_CDEF = 1 << 1, DAV1D_INLOOPFILTER_RESTORATION = 1 << 2, DAV1D_INLOOPFILTER_ALL = DAV1D_INLOOPFILTER_DEBLOCK | DAV1D_INLOOPFILTER_CDEF | DAV1D_INLOOPFILTER_RESTORATION, }; enum Dav1dDecodeFrameType { DAV1D_DECODEFRAMETYPE_ALL = 0, ///< decode and return all frames DAV1D_DECODEFRAMETYPE_REFERENCE = 1,///< decode and return frames referenced by other frames only DAV1D_DECODEFRAMETYPE_INTRA = 2, ///< decode and return intra frames only (includes keyframes) DAV1D_DECODEFRAMETYPE_KEY = 3, ///< decode and return keyframes only }; typedef struct Dav1dSettings { int n_threads; ///< number of threads (0 = number of logical cores in host system, default 0) int max_frame_delay; ///< Set to 1 for low-latency decoding (0 = ceil(sqrt(n_threads)), default 0) int apply_grain; ///< whether to apply film grain on output frames (default 1) int operating_point; ///< select an operating point for scalable AV1 bitstreams (0 - 31, default 0) int all_layers; ///< output all spatial layers of a scalable AV1 biststream (default 1) unsigned frame_size_limit; ///< maximum frame size, in pixels (0 = unlimited, default 0) Dav1dPicAllocator allocator; ///< Picture allocator callback. Dav1dLogger logger; ///< Logger callback. int strict_std_compliance; ///< whether to abort decoding on standard compliance violations ///< that don't affect actual bitstream decoding (e.g. inconsistent ///< or invalid metadata, default 0) int output_invisible_frames; ///< output invisibly coded frames (in coding order) in addition ///< to all visible frames. Because of show-existing-frame, this ///< means some frames may appear twice (once when coded, ///< once when shown, default 0) enum Dav1dInloopFilterType inloop_filters; ///< postfilters to enable during decoding (default ///< DAV1D_INLOOPFILTER_ALL) enum Dav1dDecodeFrameType decode_frame_type; ///< frame types to decode (default ///< DAV1D_DECODEFRAMETYPE_ALL) uint8_t reserved[16]; ///< reserved for future use } Dav1dSettings; /** * Get library version. */ DAV1D_API const char *dav1d_version(void); /** * Get library API version. * * @return A value in the format 0x00XXYYZZ, where XX is the major version, * YY the minor version, and ZZ the patch version. * @see DAV1D_API_MAJOR, DAV1D_API_MINOR, DAV1D_API_PATCH */ DAV1D_API unsigned dav1d_version_api(void); /** * Initialize settings to default values. * * @param s Input settings context. */ DAV1D_API void dav1d_default_settings(Dav1dSettings *s); /** * Allocate and open a decoder instance. * * @param c_out The decoder instance to open. *c_out will be set to the * allocated context. * @param s Input settings context. * * @note The context must be freed using dav1d_close() when decoding is * finished. * * @return 0 on success, or < 0 (a negative DAV1D_ERR code) on error. */ DAV1D_API int dav1d_open(Dav1dContext **c_out, const Dav1dSettings *s); /** * Parse a Sequence Header OBU from bitstream data. * * @param out Output Sequence Header. * @param buf The data to be parser. * @param sz Size of the data. * * @return * 0: Success, and out is filled with the parsed Sequence Header * OBU parameters. * DAV1D_ERR(ENOENT): No Sequence Header OBUs were found in the buffer. * Other negative DAV1D_ERR codes: Invalid data in the buffer, invalid passed-in * arguments, and other errors during parsing. * * @note It is safe to feed this function data containing other OBUs than a * Sequence Header, as they will simply be ignored. If there is more than * one Sequence Header OBU present, only the last will be returned. */ DAV1D_API int dav1d_parse_sequence_header(Dav1dSequenceHeader *out, const uint8_t *buf, const size_t sz); /** * Feed bitstream data to the decoder, in the form of one or multiple AV1 * Open Bitstream Units (OBUs). * * @param c Input decoder instance. * @param in Input bitstream data. On success, ownership of the reference is * passed to the library. * * @return * 0: Success, and the data was consumed. * DAV1D_ERR(EAGAIN): The data can't be consumed. dav1d_get_picture() should * be called to get one or more frames before the function * can consume new data. * Other negative DAV1D_ERR codes: Error during decoding or because of invalid * passed-in arguments. The reference remains * owned by the caller. */ DAV1D_API int dav1d_send_data(Dav1dContext *c, Dav1dData *in); /** * Return a decoded picture. * * @param c Input decoder instance. * @param out Output frame. The caller assumes ownership of the returned * reference. * * @return * 0: Success, and a frame is returned. * DAV1D_ERR(EAGAIN): Not enough data to output a frame. dav1d_send_data() * should be called with new input. * Other negative DAV1D_ERR codes: Error during decoding or because of invalid * passed-in arguments. * * @note To drain buffered frames from the decoder (i.e. on end of stream), * call this function until it returns DAV1D_ERR(EAGAIN). * * @code{.c} * Dav1dData data = { 0 }; * Dav1dPicture p = { 0 }; * int res; * * read_data(&data); * do { * res = dav1d_send_data(c, &data); * // Keep going even if the function can't consume the current data * packet. It eventually will after one or more frames have been * returned in this loop. * if (res < 0 && res != DAV1D_ERR(EAGAIN)) * free_and_abort(); * res = dav1d_get_picture(c, &p); * if (res < 0) { * if (res != DAV1D_ERR(EAGAIN)) * free_and_abort(); * } else * output_and_unref_picture(&p); * // Stay in the loop as long as there's data to consume. * } while (data.sz || read_data(&data) == SUCCESS); * * // Handle EOS by draining all buffered frames. * do { * res = dav1d_get_picture(c, &p); * if (res < 0) { * if (res != DAV1D_ERR(EAGAIN)) * free_and_abort(); * } else * output_and_unref_picture(&p); * } while (res == 0); * @endcode */ DAV1D_API int dav1d_get_picture(Dav1dContext *c, Dav1dPicture *out); /** * Apply film grain to a previously decoded picture. If the picture contains no * film grain metadata, then this function merely returns a new reference. * * @param c Input decoder instance. * @param out Output frame. The caller assumes ownership of the returned * reference. * @param in Input frame. No ownership is transferred. * * @return * 0: Success, and a frame is returned. * Other negative DAV1D_ERR codes: Error due to lack of memory or because of * invalid passed-in arguments. * * @note If `Dav1dSettings.apply_grain` is true, film grain was already applied * by `dav1d_get_picture`, and so calling this function leads to double * application of film grain. Users should only call this when needed. */ DAV1D_API int dav1d_apply_grain(Dav1dContext *c, Dav1dPicture *out, const Dav1dPicture *in); /** * Close a decoder instance and free all associated memory. * * @param c_out The decoder instance to close. *c_out will be set to NULL. */ DAV1D_API void dav1d_close(Dav1dContext **c_out); /** * Flush all delayed frames in decoder and clear internal decoder state, * to be used when seeking. * * @param c Input decoder instance. * * @note Decoding will start only after a valid sequence header OBU is * delivered to dav1d_send_data(). * */ DAV1D_API void dav1d_flush(Dav1dContext *c); enum Dav1dEventFlags { /** * The last returned picture contains a reference to a new Sequence Header, * either because it's the start of a new coded sequence, or the decoder was * flushed before it was generated. */ DAV1D_EVENT_FLAG_NEW_SEQUENCE = 1 << 0, /** * The last returned picture contains a reference to a Sequence Header with * new operating parameters information for the current coded sequence. */ DAV1D_EVENT_FLAG_NEW_OP_PARAMS_INFO = 1 << 1, }; /** * Fetch a combination of DAV1D_EVENT_FLAG_* event flags generated by the decoding * process. * * @param c Input decoder instance. * @param flags Where to write the flags. * * @return 0 on success, or < 0 (a negative DAV1D_ERR code) on error. * * @note Calling this function will clear all the event flags currently stored in * the decoder. * */ DAV1D_API int dav1d_get_event_flags(Dav1dContext *c, enum Dav1dEventFlags *flags); /** * Retrieve the user-provided metadata associated with the input data packet * for the last decoding error reported to the user, i.e. a negative return * value (not EAGAIN) from dav1d_send_data() or dav1d_get_picture(). * * @param c Input decoder instance. * @param out Output Dav1dDataProps. On success, the caller assumes ownership of * the returned reference. * * @return 0 on success, or < 0 (a negative DAV1D_ERR code) on error. */ DAV1D_API int dav1d_get_decode_error_data_props(Dav1dContext *c, Dav1dDataProps *out); /** * Get the decoder delay, which is the number of internally buffered frames, not * including reference frames. * This value is guaranteed to be >= 1 and <= max_frame_delay. * * @param s Input settings context. * * @return Decoder frame delay on success, or < 0 (a negative DAV1D_ERR code) on * error. * * @note The returned delay is valid only for a Dav1dContext initialized with the * provided Dav1dSettings. */ DAV1D_API int dav1d_get_frame_delay(const Dav1dSettings *s); #ifdef __cplusplus } /* extern "C" */ #endif #endif /* DAV1D_H */
12,659
C++
.h
303
38.165017
103
0.673264
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,348
common.h
Nevcairiel_LAVFilters/thirdparty/32/include/dav1d/common.h
/* * Copyright © 2018, VideoLAN and dav1d authors * Copyright © 2018, Two Orioles, LLC * 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. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT OWNER 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 DAV1D_COMMON_H #define DAV1D_COMMON_H #include <errno.h> #include <stddef.h> #include <stdint.h> #ifdef __cplusplus extern "C" { #endif #ifndef DAV1D_API #if defined _WIN32 #if defined DAV1D_BUILDING_DLL #define DAV1D_API __declspec(dllexport) #else #define DAV1D_API #endif #else #if __GNUC__ >= 4 #define DAV1D_API __attribute__ ((visibility ("default"))) #else #define DAV1D_API #endif #endif #endif #if EPERM > 0 #define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code. #else #define DAV1D_ERR(e) (e) #endif /** * A reference-counted object wrapper for a user-configurable pointer. */ typedef struct Dav1dUserData { const uint8_t *data; ///< data pointer struct Dav1dRef *ref; ///< allocation origin } Dav1dUserData; /** * Input packet metadata which are copied from the input data used to * decode each image into the matching structure of the output image * returned back to the user. Since these are metadata fields, they * can be used for other purposes than the documented ones, they will * still be passed from input data to output picture without being * used internally. */ typedef struct Dav1dDataProps { int64_t timestamp; ///< container timestamp of input data, INT64_MIN if unknown (default) int64_t duration; ///< container duration of input data, 0 if unknown (default) int64_t offset; ///< stream offset of input data, -1 if unknown (default) size_t size; ///< packet size, default Dav1dData.sz struct Dav1dUserData user_data; ///< user-configurable data, default NULL members } Dav1dDataProps; /** * Release reference to a Dav1dDataProps. */ DAV1D_API void dav1d_data_props_unref(Dav1dDataProps *props); #ifdef __cplusplus } /* extern "C" */ #endif #endif /* DAV1D_COMMON_H */
3,258
C++
.h
84
35.928571
93
0.739722
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,349
gostdsa.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/gostdsa.h
/* gostdsa.h Copyright (C) 2015 Dmity Eremin-Solenikov Copyright (C) 2013 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_GOSTDSA_H_INCLUDED #define NETTLE_GOSTDSA_H_INCLUDED #include "ecc.h" #include "dsa.h" #include "ecdsa.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define gostdsa_sign nettle_gostdsa_sign #define gostdsa_verify nettle_gostdsa_verify #define gostdsa_vko nettle_gostdsa_vko #define ecc_gostdsa_sign nettle_ecc_gostdsa_sign #define ecc_gostdsa_sign_itch nettle_ecc_gostdsa_sign_itch #define ecc_gostdsa_verify nettle_ecc_gostdsa_verify #define ecc_gostdsa_verify_itch nettle_ecc_gostdsa_verify_itch /* Just use ECDSA function for key generation */ #define gostdsa_generate_keypair ecdsa_generate_keypair /* High level GOST DSA functions. * * A public key is represented as a struct ecc_point, and a private * key as a struct ecc_scalar. */ void gostdsa_sign (const struct ecc_scalar *key, void *random_ctx, nettle_random_func *random, size_t digest_length, const uint8_t *digest, struct dsa_signature *signature); int gostdsa_verify (const struct ecc_point *pub, size_t length, const uint8_t *digest, const struct dsa_signature *signature); void gostdsa_vko (const struct ecc_scalar *key, const struct ecc_point *pub, size_t ukm_length, const uint8_t *ukm, uint8_t *out); /* Low-level GOSTDSA functions. */ mp_size_t ecc_gostdsa_sign_itch (const struct ecc_curve *ecc); void ecc_gostdsa_sign (const struct ecc_curve *ecc, const mp_limb_t *zp, /* Random nonce, must be invertible mod ecc group order. */ const mp_limb_t *kp, size_t length, const uint8_t *digest, mp_limb_t *rp, mp_limb_t *sp, mp_limb_t *scratch); mp_size_t ecc_gostdsa_verify_itch (const struct ecc_curve *ecc); int ecc_gostdsa_verify (const struct ecc_curve *ecc, const mp_limb_t *pp, /* Public key */ size_t length, const uint8_t *digest, const mp_limb_t *rp, const mp_limb_t *sp, mp_limb_t *scratch); #ifdef __cplusplus } #endif #endif /* NETTLE_GOSTDSA_H_INCLUDED */
3,042
C++
.h
83
33.192771
72
0.736627
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,350
version.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/version.h
/* version.h Information about library version. Copyright (C) 2015 Red Hat, Inc. Copyright (C) 2015 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_VERSION_H_INCLUDED #define NETTLE_VERSION_H_INCLUDED #ifdef __cplusplus extern "C" { #endif /* Individual version numbers in decimal */ #define NETTLE_VERSION_MAJOR 3 #define NETTLE_VERSION_MINOR 9 #define NETTLE_USE_MINI_GMP 0 /* We need a preprocessor constant for GMP_NUMB_BITS, simply using sizeof(mp_limb_t) * CHAR_BIT is not good enough. */ #if NETTLE_USE_MINI_GMP # define GMP_NUMB_BITS n/a #endif int nettle_version_major (void); int nettle_version_minor (void); #ifdef __cplusplus } #endif #endif /* NETTLE_VERSION_H_INCLUDED */
1,655
C++
.h
45
33.444444
72
0.752357
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,351
sha.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/sha.h
/* sha.h This file is deprecated, and provided only for backwards compatibility with earlier versions of Nettle. Please use sha1.h and/or sha2.h instead. Copyright (C) 2001 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_SHA_H_INCLUDED #define NETTLE_SHA_H_INCLUDED #include "sha1.h" #include "sha2.h" #endif /* NETTLE_SHA_H_INCLUDED */
1,300
C++
.h
29
40.413793
72
0.747218
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
22,352
balloon.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/balloon.h
/* balloon.h Balloon password-hashing algorithm. Copyright (C) 2022 Zoltan Fridrich Copyright (C) 2022 Red Hat, Inc. This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ /* For a description of the algorithm, see: * Boneh, D., Corrigan-Gibbs, H., Schechter, S. (2017, May 12). Balloon Hashing: * A Memory-Hard Function Providing Provable Protection Against Sequential Attacks. * Retrieved Sep 1, 2022, from https://eprint.iacr.org/2016/027.pdf */ #ifndef NETTLE_BALLOON_H_INCLUDED #define NETTLE_BALLOON_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define balloon nettle_balloon #define balloon_itch nettle_balloon_itch #define balloon_sha1 nettle_balloon_sha1 #define balloon_sha256 nettle_balloon_sha256 #define balloon_sha384 nettle_balloon_sha384 #define balloon_sha512 nettle_balloon_sha512 void balloon(void *hash_ctx, nettle_hash_update_func *update, nettle_hash_digest_func *digest, size_t digest_size, size_t s_cost, size_t t_cost, size_t passwd_length, const uint8_t *passwd, size_t salt_length, const uint8_t *salt, uint8_t *scratch, uint8_t *dst); size_t balloon_itch(size_t digest_size, size_t s_cost); void balloon_sha1(size_t s_cost, size_t t_cost, size_t passwd_length, const uint8_t *passwd, size_t salt_length, const uint8_t *salt, uint8_t *scratch, uint8_t *dst); void balloon_sha256(size_t s_cost, size_t t_cost, size_t passwd_length, const uint8_t *passwd, size_t salt_length, const uint8_t *salt, uint8_t *scratch, uint8_t *dst); void balloon_sha384(size_t s_cost, size_t t_cost, size_t passwd_length, const uint8_t *passwd, size_t salt_length, const uint8_t *salt, uint8_t *scratch, uint8_t *dst); void balloon_sha512(size_t s_cost, size_t t_cost, size_t passwd_length, const uint8_t *passwd, size_t salt_length, const uint8_t *salt, uint8_t *scratch, uint8_t *dst); #ifdef __cplusplus } #endif #endif /* NETTLE_BALLOON_H_INCLUDED */
3,071
C++
.h
75
35.52
83
0.701312
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,353
pgp.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/pgp.h
/* pgp.h PGP related functions. Copyright (C) 2001, 2002 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_PGP_H_INCLUDED #define NETTLE_PGP_H_INCLUDED #include <time.h> #include "nettle-types.h" #include "bignum.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define pgp_put_uint32 nettle_pgp_put_uint32 #define pgp_put_uint16 nettle_pgp_put_uint16 #define pgp_put_mpi nettle_pgp_put_mpi #define pgp_put_string nettle_pgp_put_string #define pgp_put_length nettle_pgp_put_length #define pgp_put_header nettle_pgp_put_header #define pgp_put_header_length nettle_pgp_put_header_length #define pgp_sub_packet_start nettle_pgp_sub_packet_start #define pgp_put_sub_packet nettle_pgp_put_sub_packet #define pgp_sub_packet_end nettle_pgp_sub_packet_end #define pgp_put_public_rsa_key nettle_pgp_put_public_rsa_key #define pgp_put_rsa_sha1_signature nettle_pgp_put_rsa_sha1_signature #define pgp_put_userid nettle_pgp_put_userid #define pgp_crc24 nettle_pgp_crc24 #define pgp_armor nettle_pgp_armor struct nettle_buffer; struct rsa_public_key; struct rsa_private_key; struct sha1_ctx; int pgp_put_uint32(struct nettle_buffer *buffer, uint32_t i); int pgp_put_uint16(struct nettle_buffer *buffer, unsigned i); int pgp_put_mpi(struct nettle_buffer *buffer, const mpz_t x); int pgp_put_string(struct nettle_buffer *buffer, unsigned length, const uint8_t *s); int pgp_put_length(struct nettle_buffer *buffer, unsigned length); int pgp_put_header(struct nettle_buffer *buffer, unsigned tag, unsigned length); void pgp_put_header_length(struct nettle_buffer *buffer, /* start of the header */ unsigned start, unsigned field_size); unsigned pgp_sub_packet_start(struct nettle_buffer *buffer); int pgp_put_sub_packet(struct nettle_buffer *buffer, unsigned type, unsigned length, const uint8_t *data); void pgp_sub_packet_end(struct nettle_buffer *buffer, unsigned start); int pgp_put_public_rsa_key(struct nettle_buffer *, const struct rsa_public_key *key, time_t timestamp); int pgp_put_rsa_sha1_signature(struct nettle_buffer *buffer, const struct rsa_private_key *key, const uint8_t *keyid, unsigned type, struct sha1_ctx *hash); int pgp_put_userid(struct nettle_buffer *buffer, unsigned length, const uint8_t *name); uint32_t pgp_crc24(unsigned length, const uint8_t *data); int pgp_armor(struct nettle_buffer *buffer, const char *tag, unsigned length, const uint8_t *data); /* Values that can be passed to pgp_put_header when the size of the * length field, but not the length itself, is known. Also the minimum length * for the given field size. */ enum pgp_lengths { PGP_LENGTH_ONE_OCTET = 0, PGP_LENGTH_TWO_OCTETS = 192, PGP_LENGTH_FOUR_OCTETS = 8384, }; enum pgp_public_key_algorithm { PGP_RSA = 1, PGP_RSA_ENCRYPT = 2, PGP_RSA_SIGN = 3, PGP_EL_GAMAL_ENCRYPT = 16, PGP_DSA = 17, PGP_EL_GAMAL = 20, }; enum pgp_symmetric_algorithm { PGP_PLAINTEXT = 0, PGP_IDEA = 1, PGP_3DES = 2, PGP_CAST5 = 3, PGP_BLOWFISH = 4, PGP_SAFER_SK = 5, PGP_AES128 = 7, PGP_AES192 = 8, PGP_AES256 = 9, }; enum pgp_compression_algorithm { PGP_UNCOMPRESSED = 0, PGP_ZIP = 1, PGP_ZLIB = 2, }; enum pgp_hash_algorithm { PGP_MD5 = 1, PGP_SHA1 = 2, PGP_RIPEMD = 3, PGP_MD2 = 5, PGP_TIGER192 = 6, PGP_HAVAL = 7, }; enum pgp_tag { PGP_TAG_PUBLIC_SESSION_KEY = 1, PGP_TAG_SIGNATURE = 2, PGP_TAG_SYMMETRIC_SESSION_KEY = 3, PGP_TAG_ONE_PASS_SIGNATURE = 4, PGP_TAG_SECRET_KEY = 5, PGP_TAG_PUBLIC_KEY = 6, PGP_TAG_SECRET_SUBKEY = 7, PGP_TAG_COMPRESSED = 8, PGP_TAG_ENCRYPTED = 9, PGP_TAG_MARKER = 10, PGP_TAG_LITERAL = 11, PGP_TAG_TRUST = 12, PGP_TAG_USERID = 13, PGP_TAG_PUBLIC_SUBKEY = 14, }; enum pgp_signature_type { PGP_SIGN_BINARY = 0, PGP_SIGN_TEXT = 1, PGP_SIGN_STANDALONE = 2, PGP_SIGN_CERTIFICATION = 0x10, PGP_SIGN_CERTIFICATION_PERSONA = 0x11, PGP_SIGN_CERTIFICATION_CASUAL = 0x12, PGP_SIGN_CERTIFICATION_POSITIVE = 0x13, PGP_SIGN_SUBKEY = 0x18, PGP_SIGN_KEY = 0x1f, PGP_SIGN_REVOCATION = 0x20, PGP_SIGN_REVOCATION_SUBKEY = 0x28, PGP_SIGN_REVOCATION_CERTIFICATE = 0x30, PGP_SIGN_TIMESTAMP = 0x40, }; enum pgp_subpacket_tag { PGP_SUBPACKET_CREATION_TIME = 2, PGP_SUBPACKET_SIGNATURE_EXPIRATION_TIME = 3, PGP_SUBPACKET_EXPORTABLE_CERTIFICATION = 4, PGP_SUBPACKET_TRUST_SIGNATURE = 5, PGP_SUBPACKET_REGULAR_EXPRESSION = 6, PGP_SUBPACKET_REVOCABLE = 7, PGP_SUBPACKET_KEY_EXPIRATION_TIME = 9, PGP_SUBPACKET_PLACEHOLDER = 10 , PGP_SUBPACKET_PREFERRED_SYMMETRIC_ALGORITHMS = 11, PGP_SUBPACKET_REVOCATION_KEY = 12, PGP_SUBPACKET_ISSUER_KEY_ID = 16, PGP_SUBPACKET_NOTATION_DATA = 20, PGP_SUBPACKET_PREFERRED_HASH_ALGORITHMS = 21, PGP_SUBPACKET_PREFERRED_COMPRESSION_ALGORITHMS = 22, PGP_SUBPACKET_KEY_SERVER_PREFERENCES = 23, PGP_SUBPACKET_PREFERRED_KEY_SERVER = 24, PGP_SUBPACKET_PRIMARY_USER_ID = 25, PGP_SUBPACKET_POLICY_URL = 26, PGP_SUBPACKET_KEY_FLAGS = 27, PGP_SUBPACKET_SIGNERS_USER_ID = 28, PGP_SUBPACKET_REASON_FOR_REVOCATION = 29, }; #ifdef __cplusplus } #endif #endif /* NETTLE_PGP_H_INCLUDED */
6,337
C++
.h
207
26.748792
77
0.711775
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
22,354
cmac.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/cmac.h
/* cmac.h CMAC mode, as specified in RFC4493 Copyright (C) 2017 Red Hat, Inc. Contributed by Nikos Mavrogiannopoulos This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_CMAC_H_INCLUDED #define NETTLE_CMAC_H_INCLUDED #include "aes.h" #include "des.h" #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif #define CMAC128_DIGEST_SIZE 16 #define CMAC64_DIGEST_SIZE 8 #define cmac128_set_key nettle_cmac128_set_key #define cmac128_init nettle_cmac128_init #define cmac128_update nettle_cmac128_update #define cmac128_digest nettle_cmac128_digest #define cmac_aes128_set_key nettle_cmac_aes128_set_key #define cmac_aes128_update nettle_cmac_aes128_update #define cmac_aes128_digest nettle_cmac_aes128_digest #define cmac_aes256_set_key nettle_cmac_aes256_set_key #define cmac_aes256_update nettle_cmac_aes256_update #define cmac_aes256_digest nettle_cmac_aes256_digest #define cmac64_set_key nettle_cmac64_set_key #define cmac64_init nettle_cmac64_init #define cmac64_update nettle_cmac64_update #define cmac64_digest nettle_cmac64_digest #define cmac_des3_set_key nettle_cmac_des3_set_key #define cmac_des3_update nettle_cmac_des3_update #define cmac_des3_digest nettle_cmac_des3_digest struct cmac128_key { union nettle_block16 K1; union nettle_block16 K2; }; struct cmac128_ctx { /* MAC state */ union nettle_block16 X; /* Block buffer */ union nettle_block16 block; size_t index; }; struct cmac64_key { union nettle_block8 K1; union nettle_block8 K2; }; struct cmac64_ctx { /* MAC state */ union nettle_block8 X; /* Block buffer */ union nettle_block8 block; size_t index; }; void cmac128_set_key(struct cmac128_key *key, const void *cipher, nettle_cipher_func *encrypt); void cmac128_init(struct cmac128_ctx *ctx); void cmac128_update(struct cmac128_ctx *ctx, const void *cipher, nettle_cipher_func *encrypt, size_t msg_len, const uint8_t *msg); void cmac128_digest(struct cmac128_ctx *ctx, const struct cmac128_key *key, const void *cipher, nettle_cipher_func *encrypt, unsigned length, uint8_t *digest); #define CMAC128_CTX(type) \ { struct cmac128_key key; struct cmac128_ctx ctx; type cipher; } /* NOTE: Avoid using NULL, as we don't include anything defining it. */ #define CMAC128_SET_KEY(self, set_key, encrypt, cmac_key) \ do { \ (set_key)(&(self)->cipher, (cmac_key)); \ if (0) (encrypt)(&(self)->cipher, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0); \ cmac128_set_key(&(self)->key, &(self)->cipher, \ (nettle_cipher_func *) (encrypt)); \ cmac128_init(&(self)->ctx); \ } while (0) #define CMAC128_UPDATE(self, encrypt, length, src) \ (0 ? (encrypt)(&(self)->cipher, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0) \ : cmac128_update(&(self)->ctx, &(self)->cipher, \ (nettle_cipher_func *)encrypt, \ (length), (src))) #define CMAC128_DIGEST(self, encrypt, length, digest) \ (0 ? (encrypt)(&(self)->cipher, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0) \ : cmac128_digest(&(self)->ctx, &(self)->key, \ &(self)->cipher, \ (nettle_cipher_func *) (encrypt), \ (length), (digest))) void cmac64_set_key(struct cmac64_key *key, const void *cipher, nettle_cipher_func *encrypt); void cmac64_init(struct cmac64_ctx *ctx); void cmac64_update(struct cmac64_ctx *ctx, const void *cipher, nettle_cipher_func *encrypt, size_t msg_len, const uint8_t *msg); void cmac64_digest(struct cmac64_ctx *ctx, const struct cmac64_key *key, const void *cipher, nettle_cipher_func *encrypt, unsigned length, uint8_t *digest); #define CMAC64_CTX(type) \ { struct cmac64_key key; struct cmac64_ctx ctx; type cipher; } /* NOTE: Avoid using NULL, as we don't include anything defining it. */ #define CMAC64_SET_KEY(self, set_key, encrypt, cmac_key) \ do { \ (set_key)(&(self)->cipher, (cmac_key)); \ if (0) (encrypt)(&(self)->cipher, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0); \ cmac64_set_key(&(self)->key, &(self)->cipher, \ (nettle_cipher_func *) (encrypt)); \ cmac64_init(&(self)->ctx); \ } while (0) #define CMAC64_UPDATE(self, encrypt, length, src) \ (0 ? (encrypt)(&(self)->cipher, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0) \ : cmac64_update(&(self)->ctx, &(self)->cipher, \ (nettle_cipher_func *)encrypt, \ (length), (src))) #define CMAC64_DIGEST(self, encrypt, length, digest) \ (0 ? (encrypt)(&(self)->cipher, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0) \ : cmac64_digest(&(self)->ctx, &(self)->key, \ &(self)->cipher, \ (nettle_cipher_func *) (encrypt), \ (length), (digest))) struct cmac_aes128_ctx CMAC128_CTX(struct aes128_ctx); void cmac_aes128_set_key(struct cmac_aes128_ctx *ctx, const uint8_t *key); void cmac_aes128_update(struct cmac_aes128_ctx *ctx, size_t length, const uint8_t *data); void cmac_aes128_digest(struct cmac_aes128_ctx *ctx, size_t length, uint8_t *digest); struct cmac_aes256_ctx CMAC128_CTX(struct aes256_ctx); void cmac_aes256_set_key(struct cmac_aes256_ctx *ctx, const uint8_t *key); void cmac_aes256_update(struct cmac_aes256_ctx *ctx, size_t length, const uint8_t *data); void cmac_aes256_digest(struct cmac_aes256_ctx *ctx, size_t length, uint8_t *digest); struct cmac_des3_ctx CMAC64_CTX(struct des3_ctx); void cmac_des3_set_key(struct cmac_des3_ctx *ctx, const uint8_t *key); void cmac_des3_update(struct cmac_des3_ctx *ctx, size_t length, const uint8_t *data); void cmac_des3_digest(struct cmac_des3_ctx *ctx, size_t length, uint8_t *digest); #ifdef __cplusplus } #endif #endif /* CMAC_H_INCLUDED */
6,730
C++
.h
183
33.322404
72
0.691206
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,355
rsa.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/rsa.h
/* rsa.h The RSA publickey algorithm. Copyright (C) 2001, 2002 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_RSA_H_INCLUDED #define NETTLE_RSA_H_INCLUDED #include "nettle-types.h" #include "bignum.h" #include "md5.h" #include "sha1.h" #include "sha2.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define rsa_public_key_init nettle_rsa_public_key_init #define rsa_public_key_clear nettle_rsa_public_key_clear #define rsa_public_key_prepare nettle_rsa_public_key_prepare #define rsa_private_key_init nettle_rsa_private_key_init #define rsa_private_key_clear nettle_rsa_private_key_clear #define rsa_private_key_prepare nettle_rsa_private_key_prepare #define rsa_pkcs1_verify nettle_rsa_pkcs1_verify #define rsa_pkcs1_sign nettle_rsa_pkcs1_sign #define rsa_pkcs1_sign_tr nettle_rsa_pkcs1_sign_tr #define rsa_md5_sign nettle_rsa_md5_sign #define rsa_md5_sign_tr nettle_rsa_md5_sign_tr #define rsa_md5_verify nettle_rsa_md5_verify #define rsa_sha1_sign nettle_rsa_sha1_sign #define rsa_sha1_sign_tr nettle_rsa_sha1_sign_tr #define rsa_sha1_verify nettle_rsa_sha1_verify #define rsa_sha256_sign nettle_rsa_sha256_sign #define rsa_sha256_sign_tr nettle_rsa_sha256_sign_tr #define rsa_sha256_verify nettle_rsa_sha256_verify #define rsa_sha512_sign nettle_rsa_sha512_sign #define rsa_sha512_sign_tr nettle_rsa_sha512_sign_tr #define rsa_sha512_verify nettle_rsa_sha512_verify #define rsa_md5_sign_digest nettle_rsa_md5_sign_digest #define rsa_md5_sign_digest_tr nettle_rsa_md5_sign_digest_tr #define rsa_md5_verify_digest nettle_rsa_md5_verify_digest #define rsa_sha1_sign_digest nettle_rsa_sha1_sign_digest #define rsa_sha1_sign_digest_tr nettle_rsa_sha1_sign_digest_tr #define rsa_sha1_verify_digest nettle_rsa_sha1_verify_digest #define rsa_sha256_sign_digest nettle_rsa_sha256_sign_digest #define rsa_sha256_sign_digest_tr nettle_rsa_sha256_sign_digest_tr #define rsa_sha256_verify_digest nettle_rsa_sha256_verify_digest #define rsa_sha512_sign_digest nettle_rsa_sha512_sign_digest #define rsa_sha512_sign_digest_tr nettle_rsa_sha512_sign_digest_tr #define rsa_sha512_verify_digest nettle_rsa_sha512_verify_digest #define rsa_pss_sha256_sign_digest_tr nettle_rsa_pss_sha256_sign_digest_tr #define rsa_pss_sha256_verify_digest nettle_rsa_pss_sha256_verify_digest #define rsa_pss_sha384_sign_digest_tr nettle_rsa_pss_sha384_sign_digest_tr #define rsa_pss_sha384_verify_digest nettle_rsa_pss_sha384_verify_digest #define rsa_pss_sha512_sign_digest_tr nettle_rsa_pss_sha512_sign_digest_tr #define rsa_pss_sha512_verify_digest nettle_rsa_pss_sha512_verify_digest #define rsa_encrypt nettle_rsa_encrypt #define rsa_decrypt nettle_rsa_decrypt #define rsa_decrypt_tr nettle_rsa_decrypt_tr #define rsa_sec_decrypt nettle_rsa_sec_decrypt #define rsa_compute_root nettle_rsa_compute_root #define rsa_compute_root_tr nettle_rsa_compute_root_tr #define rsa_generate_keypair nettle_rsa_generate_keypair #define rsa_keypair_to_sexp nettle_rsa_keypair_to_sexp #define rsa_keypair_from_sexp_alist nettle_rsa_keypair_from_sexp_alist #define rsa_keypair_from_sexp nettle_rsa_keypair_from_sexp #define rsa_public_key_from_der_iterator nettle_rsa_public_key_from_der_iterator #define rsa_private_key_from_der_iterator nettle_rsa_private_key_from_der_iterator #define rsa_keypair_from_der nettle_rsa_keypair_from_der #define rsa_keypair_to_openpgp nettle_rsa_keypair_to_openpgp /* This limit is somewhat arbitrary. Technically, the smallest modulo which makes sense at all is 15 = 3*5, phi(15) = 8, size 4 bits. But for ridiculously small keys, not all odd e are possible (e.g., for 5 bits, the only possible modulo is 3*7 = 21, phi(21) = 12, and e = 3 don't work). The smallest size that makes sense with pkcs#1, and which allows RSA encryption of one byte messages, is 12 octets, 89 bits. */ #define RSA_MINIMUM_N_OCTETS 12 #define RSA_MINIMUM_N_BITS (8*RSA_MINIMUM_N_OCTETS - 7) struct rsa_public_key { /* Size of the modulo, in octets. This is also the size of all * signatures that are created or verified with this key. */ size_t size; /* Modulo */ mpz_t n; /* Public exponent */ mpz_t e; }; struct rsa_private_key { size_t size; /* d is filled in by the key generation function; otherwise it's * completely unused. */ mpz_t d; /* The two factors */ mpz_t p; mpz_t q; /* d % (p-1), i.e. a e = 1 (mod (p-1)) */ mpz_t a; /* d % (q-1), i.e. b e = 1 (mod (q-1)) */ mpz_t b; /* modular inverse of q , i.e. c q = 1 (mod p) */ mpz_t c; }; /* Signing a message works as follows: * * Store the private key in a rsa_private_key struct. * * Call rsa_private_key_prepare. This initializes the size attribute * to the length of a signature. * * Initialize a hashing context, by callling * md5_init * * Hash the message by calling * md5_update * * Create the signature by calling * rsa_md5_sign * * The signature is represented as a mpz_t bignum. This call also * resets the hashing context. * * When done with the key and signature, don't forget to call * mpz_clear. */ /* Calls mpz_init to initialize bignum storage. */ void rsa_public_key_init(struct rsa_public_key *key); /* Calls mpz_clear to deallocate bignum storage. */ void rsa_public_key_clear(struct rsa_public_key *key); int rsa_public_key_prepare(struct rsa_public_key *key); /* Calls mpz_init to initialize bignum storage. */ void rsa_private_key_init(struct rsa_private_key *key); /* Calls mpz_clear to deallocate bignum storage. */ void rsa_private_key_clear(struct rsa_private_key *key); int rsa_private_key_prepare(struct rsa_private_key *key); /* PKCS#1 style signatures */ int rsa_pkcs1_sign(const struct rsa_private_key *key, size_t length, const uint8_t *digest_info, mpz_t s); int rsa_pkcs1_sign_tr(const struct rsa_public_key *pub, const struct rsa_private_key *key, void *random_ctx, nettle_random_func *random, size_t length, const uint8_t *digest_info, mpz_t s); int rsa_pkcs1_verify(const struct rsa_public_key *key, size_t length, const uint8_t *digest_info, const mpz_t signature); int rsa_md5_sign(const struct rsa_private_key *key, struct md5_ctx *hash, mpz_t signature); int rsa_md5_sign_tr(const struct rsa_public_key *pub, const struct rsa_private_key *key, void *random_ctx, nettle_random_func *random, struct md5_ctx *hash, mpz_t s); int rsa_md5_verify(const struct rsa_public_key *key, struct md5_ctx *hash, const mpz_t signature); int rsa_sha1_sign(const struct rsa_private_key *key, struct sha1_ctx *hash, mpz_t signature); int rsa_sha1_sign_tr(const struct rsa_public_key *pub, const struct rsa_private_key *key, void *random_ctx, nettle_random_func *random, struct sha1_ctx *hash, mpz_t s); int rsa_sha1_verify(const struct rsa_public_key *key, struct sha1_ctx *hash, const mpz_t signature); int rsa_sha256_sign(const struct rsa_private_key *key, struct sha256_ctx *hash, mpz_t signature); int rsa_sha256_sign_tr(const struct rsa_public_key *pub, const struct rsa_private_key *key, void *random_ctx, nettle_random_func *random, struct sha256_ctx *hash, mpz_t s); int rsa_sha256_verify(const struct rsa_public_key *key, struct sha256_ctx *hash, const mpz_t signature); int rsa_sha512_sign(const struct rsa_private_key *key, struct sha512_ctx *hash, mpz_t signature); int rsa_sha512_sign_tr(const struct rsa_public_key *pub, const struct rsa_private_key *key, void *random_ctx, nettle_random_func *random, struct sha512_ctx *hash, mpz_t s); int rsa_sha512_verify(const struct rsa_public_key *key, struct sha512_ctx *hash, const mpz_t signature); /* Variants taking the digest as argument. */ int rsa_md5_sign_digest(const struct rsa_private_key *key, const uint8_t *digest, mpz_t s); int rsa_md5_sign_digest_tr(const struct rsa_public_key *pub, const struct rsa_private_key *key, void *random_ctx, nettle_random_func *random, const uint8_t *digest, mpz_t s); int rsa_md5_verify_digest(const struct rsa_public_key *key, const uint8_t *digest, const mpz_t signature); int rsa_sha1_sign_digest(const struct rsa_private_key *key, const uint8_t *digest, mpz_t s); int rsa_sha1_sign_digest_tr(const struct rsa_public_key *pub, const struct rsa_private_key *key, void *random_ctx, nettle_random_func *random, const uint8_t *digest, mpz_t s); int rsa_sha1_verify_digest(const struct rsa_public_key *key, const uint8_t *digest, const mpz_t signature); int rsa_sha256_sign_digest(const struct rsa_private_key *key, const uint8_t *digest, mpz_t s); int rsa_sha256_sign_digest_tr(const struct rsa_public_key *pub, const struct rsa_private_key *key, void *random_ctx, nettle_random_func *random, const uint8_t *digest, mpz_t s); int rsa_sha256_verify_digest(const struct rsa_public_key *key, const uint8_t *digest, const mpz_t signature); int rsa_sha512_sign_digest(const struct rsa_private_key *key, const uint8_t *digest, mpz_t s); int rsa_sha512_sign_digest_tr(const struct rsa_public_key *pub, const struct rsa_private_key *key, void *random_ctx, nettle_random_func *random, const uint8_t *digest, mpz_t s); int rsa_sha512_verify_digest(const struct rsa_public_key *key, const uint8_t *digest, const mpz_t signature); /* PSS style signatures */ int rsa_pss_sha256_sign_digest_tr(const struct rsa_public_key *pub, const struct rsa_private_key *key, void *random_ctx, nettle_random_func *random, size_t salt_length, const uint8_t *salt, const uint8_t *digest, mpz_t s); int rsa_pss_sha256_verify_digest(const struct rsa_public_key *key, size_t salt_length, const uint8_t *digest, const mpz_t signature); int rsa_pss_sha384_sign_digest_tr(const struct rsa_public_key *pub, const struct rsa_private_key *key, void *random_ctx, nettle_random_func *random, size_t salt_length, const uint8_t *salt, const uint8_t *digest, mpz_t s); int rsa_pss_sha384_verify_digest(const struct rsa_public_key *key, size_t salt_length, const uint8_t *digest, const mpz_t signature); int rsa_pss_sha512_sign_digest_tr(const struct rsa_public_key *pub, const struct rsa_private_key *key, void *random_ctx, nettle_random_func *random, size_t salt_length, const uint8_t *salt, const uint8_t *digest, mpz_t s); int rsa_pss_sha512_verify_digest(const struct rsa_public_key *key, size_t salt_length, const uint8_t *digest, const mpz_t signature); /* RSA encryption, using PKCS#1 */ /* These functions uses the v1.5 padding. What should the v2 (OAEP) * functions be called? */ /* Returns 1 on success, 0 on failure, which happens if the * message is too long for the key. */ int rsa_encrypt(const struct rsa_public_key *key, /* For padding */ void *random_ctx, nettle_random_func *random, size_t length, const uint8_t *cleartext, mpz_t cipher); /* Message must point to a buffer of size *LENGTH. KEY->size is enough * for all valid messages. On success, *LENGTH is updated to reflect * the actual length of the message. Returns 1 on success, 0 on * failure, which happens if decryption failed or if the message * didn't fit. */ int rsa_decrypt(const struct rsa_private_key *key, size_t *length, uint8_t *cleartext, const mpz_t ciphertext); /* Timing-resistant version, using randomized RSA blinding. */ int rsa_decrypt_tr(const struct rsa_public_key *pub, const struct rsa_private_key *key, void *random_ctx, nettle_random_func *random, size_t *length, uint8_t *message, const mpz_t gibberish); /* like rsa_decrypt_tr but with additional side-channel resistance. * NOTE: the length of the final message must be known in advance. */ int rsa_sec_decrypt(const struct rsa_public_key *pub, const struct rsa_private_key *key, void *random_ctx, nettle_random_func *random, size_t length, uint8_t *message, const mpz_t gibberish); /* Compute x, the e:th root of m. Calling it with x == m is allowed. It is required that 0 <= m < n. */ void rsa_compute_root(const struct rsa_private_key *key, mpz_t x, const mpz_t m); /* Safer variant, using RSA blinding, and checking the result after CRT. It is required that 0 <= m < n. */ int rsa_compute_root_tr(const struct rsa_public_key *pub, const struct rsa_private_key *key, void *random_ctx, nettle_random_func *random, mpz_t x, const mpz_t m); /* Key generation */ /* Note that the key structs must be initialized first. */ int rsa_generate_keypair(struct rsa_public_key *pub, struct rsa_private_key *key, void *random_ctx, nettle_random_func *random, void *progress_ctx, nettle_progress_func *progress, /* Desired size of modulo, in bits */ unsigned n_size, /* Desired size of public exponent, in bits. If * zero, the passed in value pub->e is used. */ unsigned e_size); #define RSA_SIGN(key, algorithm, ctx, length, data, signature) ( \ algorithm##_update(ctx, length, data), \ rsa_##algorithm##_sign(key, ctx, signature) \ ) #define RSA_VERIFY(key, algorithm, ctx, length, data, signature) ( \ algorithm##_update(ctx, length, data), \ rsa_##algorithm##_verify(key, ctx, signature) \ ) /* Keys in sexp form. */ struct nettle_buffer; /* Generates a public-key expression if PRIV is NULL .*/ int rsa_keypair_to_sexp(struct nettle_buffer *buffer, const char *algorithm_name, /* NULL means "rsa" */ const struct rsa_public_key *pub, const struct rsa_private_key *priv); struct sexp_iterator; int rsa_keypair_from_sexp_alist(struct rsa_public_key *pub, struct rsa_private_key *priv, unsigned limit, struct sexp_iterator *i); /* If PRIV is NULL, expect a public-key expression. If PUB is NULL, * expect a private key expression and ignore the parts not needed for * the public key. */ /* Keys must be initialized before calling this function, as usual. */ int rsa_keypair_from_sexp(struct rsa_public_key *pub, struct rsa_private_key *priv, unsigned limit, size_t length, const uint8_t *expr); /* Keys in PKCS#1 format. */ struct asn1_der_iterator; int rsa_public_key_from_der_iterator(struct rsa_public_key *pub, unsigned limit, struct asn1_der_iterator *i); int rsa_private_key_from_der_iterator(struct rsa_public_key *pub, struct rsa_private_key *priv, unsigned limit, struct asn1_der_iterator *i); /* For public keys, use PRIV == NULL */ int rsa_keypair_from_der(struct rsa_public_key *pub, struct rsa_private_key *priv, unsigned limit, size_t length, const uint8_t *data); /* OpenPGP format. Experimental interface, subject to change. */ int rsa_keypair_to_openpgp(struct nettle_buffer *buffer, const struct rsa_public_key *pub, const struct rsa_private_key *priv, /* A single user id. NUL-terminated utf8. */ const char *userid); #ifdef __cplusplus } #endif #endif /* NETTLE_RSA_H_INCLUDED */
16,409
C++
.h
439
33.473804
82
0.718547
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,356
pss.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/pss.h
/* pss.h PKCS#1 RSA-PSS (RFC-3447). Copyright (C) 2017 Daiki Ueno This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_PSS_H_INCLUDED #define NETTLE_PSS_H_INCLUDED #include "nettle-meta.h" #include "bignum.h" #ifdef __cplusplus extern "C" { #endif /* Namespace mangling */ #define pss_encode_mgf1 nettle_pss_encode_mgf1 #define pss_verify_mgf1 nettle_pss_verify_mgf1 int pss_encode_mgf1(mpz_t m, size_t bits, const struct nettle_hash *hash, size_t salt_length, const uint8_t *salt, const uint8_t *digest); int pss_verify_mgf1(const mpz_t m, size_t bits, const struct nettle_hash *hash, size_t salt_length, const uint8_t *digest); #ifdef __cplusplus } #endif #endif /* NETTLE_PSS_H_INCLUDED */
1,648
C++
.h
47
31.723404
72
0.744157
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,357
ecc.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/ecc.h
/* ecc.h Copyright (C) 2013 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ /* Development of Nettle's ECC support was funded by the .SE Internet Fund. */ #ifndef NETTLE_ECC_H_INCLUDED #define NETTLE_ECC_H_INCLUDED #include "nettle-types.h" #include "bignum.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define ecc_point_init nettle_ecc_point_init #define ecc_point_clear nettle_ecc_point_clear #define ecc_point_set nettle_ecc_point_set #define ecc_point_get nettle_ecc_point_get #define ecc_point_mul nettle_ecc_point_mul #define ecc_point_mul_g nettle_ecc_point_mul_g #define ecc_scalar_init nettle_ecc_scalar_init #define ecc_scalar_clear nettle_ecc_scalar_clear #define ecc_scalar_set nettle_ecc_scalar_set #define ecc_scalar_get nettle_ecc_scalar_get #define ecc_scalar_random nettle_ecc_scalar_random #define ecc_point_mul nettle_ecc_point_mul #define ecc_bit_size nettle_ecc_bit_size #define ecc_size nettle_ecc_size #define ecc_size_a nettle_ecc_size_a #define ecc_size_j nettle_ecc_size_j struct ecc_curve; /* High level interface, for ECDSA, DH, etc */ /* Represents a point on the ECC curve */ struct ecc_point { const struct ecc_curve *ecc; /* Allocated using the same allocation function as GMP. */ mp_limb_t *p; }; /* Represents a non-zero scalar, an element of Z_q^*, where q is the group order of the curve. */ struct ecc_scalar { const struct ecc_curve *ecc; /* Allocated using the same allocation function as GMP. */ mp_limb_t *p; }; void ecc_point_init (struct ecc_point *p, const struct ecc_curve *ecc); void ecc_point_clear (struct ecc_point *p); /* Fails and returns zero if the point is not on the curve. */ int ecc_point_set (struct ecc_point *p, const mpz_t x, const mpz_t y); void ecc_point_get (const struct ecc_point *p, mpz_t x, mpz_t y); void ecc_scalar_init (struct ecc_scalar *s, const struct ecc_curve *ecc); void ecc_scalar_clear (struct ecc_scalar *s); /* Fails and returns zero if the scalar is not in the proper range. */ int ecc_scalar_set (struct ecc_scalar *s, const mpz_t z); void ecc_scalar_get (const struct ecc_scalar *s, mpz_t z); /* Generates a random scalar, suitable as an ECDSA private key or a ECDH exponent. */ void ecc_scalar_random (struct ecc_scalar *s, void *random_ctx, nettle_random_func *random); /* Computes r = n p */ void ecc_point_mul (struct ecc_point *r, const struct ecc_scalar *n, const struct ecc_point *p); /* Computes r = n g */ void ecc_point_mul_g (struct ecc_point *r, const struct ecc_scalar *n); /* Low-level interface */ /* Points on a curve are represented as arrays of mp_limb_t, with curve-specific representation. For the secp curves, we use Jacobian coordinates (possibly in Montgomery form for mod multiplication). For curve25519 we use homogeneous coordinates on an equivalent Edwards curve. The suffix "_h" denotes this internal representation. Since we use additive notation for the groups, the infinity point on the curve is denoted 0. The infinity point can be represented with x = y = 0 in affine coordinates, and Z = 0 in Jacobian coordinates. However, note that most of the ECC functions do *not* support infinity as an input or output. */ /* Returns the bit size of a single coordinate (and of the prime p). */ unsigned ecc_bit_size (const struct ecc_curve *ecc); /* Returns the size of a single coordinate. */ mp_size_t ecc_size (const struct ecc_curve *ecc); /* Size of a point, using affine coordinates x, y. */ mp_size_t ecc_size_a (const struct ecc_curve *ecc); /* Size of a point, using jacobian coordinates X, Y and Z. */ mp_size_t ecc_size_j (const struct ecc_curve *ecc); /* FIXME: Define a generic ecc_dup, ecc_add, for any type of curve. Do they need to handle infinity points? */ #ifdef __cplusplus } #endif #endif /* NETTLE_ECC_H_INCLUDED */
4,794
C++
.h
124
36.193548
78
0.745301
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,358
knuth-lfib.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/knuth-lfib.h
/* knuth-lfib.h The "lagged fibonacci" pseudorandomness generator, described in Knuth, TAoCP, 3.6 This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ /* NOTE: This generator is totally inappropriate for cryptographic * applications. It is useful for generating deterministic but * random-looking test data, and is used by the Nettle testsuite. */ #ifndef NETTLE_KNUTH_LFIB_H_INCLUDED #define NETTLE_KNUTH_LFIB_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Namespace mangling */ #define knuth_lfib_init nettle_knuth_lfib_init #define knuth_lfib_get nettle_knuth_lfib_get #define knuth_lfib_get_array nettle_knuth_lfib_get_array #define knuth_lfib_random nettle_knuth_lfib_random #define _KNUTH_LFIB_KK 100 struct knuth_lfib_ctx { uint32_t x[_KNUTH_LFIB_KK]; unsigned index; }; void knuth_lfib_init(struct knuth_lfib_ctx *ctx, uint32_t seed); /* Get's a single number in the range 0 ... 2^30-1 */ uint32_t knuth_lfib_get(struct knuth_lfib_ctx *ctx); /* Get an array of numbers */ void knuth_lfib_get_array(struct knuth_lfib_ctx *ctx, size_t n, uint32_t *a); /* Get an array of octets. */ void knuth_lfib_random(struct knuth_lfib_ctx *ctx, size_t n, uint8_t *dst); #ifdef __cplusplus } #endif #endif /* NETTLE_KNUTH_LFIB_H_INCLUDED */
2,214
C++
.h
59
34.525424
72
0.750234
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
22,359
camellia.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/camellia.h
/* camellia.h Copyright (C) 2006,2007 NTT (Nippon Telegraph and Telephone Corporation). Copyright (C) 2010, 2013 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_CAMELLIA_H_INCLUDED #define NETTLE_CAMELLIA_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define camellia128_set_encrypt_key nettle_camellia128_set_encrypt_key #define camellia128_set_decrypt_key nettle_camellia_set_decrypt_key #define camellia128_invert_key nettle_camellia128_invert_key #define camellia128_crypt nettle_camellia128_crypt #define camellia192_set_encrypt_key nettle_camellia192_set_encrypt_key #define camellia192_set_decrypt_key nettle_camellia192_set_decrypt_key #define camellia256_set_encrypt_key nettle_camellia256_set_encrypt_key #define camellia256_set_decrypt_key nettle_camellia256_set_decrypt_key #define camellia256_invert_key nettle_camellia256_invert_key #define camellia256_crypt nettle_camellia256_crypt #define CAMELLIA_BLOCK_SIZE 16 /* Valid key sizes are 128, 192 or 256 bits (16, 24 or 32 bytes) */ #define CAMELLIA128_KEY_SIZE 16 #define CAMELLIA192_KEY_SIZE 24 #define CAMELLIA256_KEY_SIZE 32 /* For 128-bit keys, there are 18 regular rounds, pre- and post-whitening, and two FL and FLINV rounds, using a total of 26 subkeys, each of 64 bit. For 192- and 256-bit keys, there are 6 additional regular rounds and one additional FL and FLINV, using a total of 34 subkeys. */ /* The clever combination of subkeys imply one of the pre- and post-whitening keys is folded with the round keys, so that subkey #1 and the last one (#25 or #33) is not used. The result is that we have only 24 or 32 subkeys at the end of key setup. */ #define _CAMELLIA128_NKEYS 24 #define _CAMELLIA256_NKEYS 32 struct camellia128_ctx { uint64_t keys[_CAMELLIA128_NKEYS]; }; void camellia128_set_encrypt_key(struct camellia128_ctx *ctx, const uint8_t *key); void camellia128_set_decrypt_key(struct camellia128_ctx *ctx, const uint8_t *key); void camellia128_invert_key(struct camellia128_ctx *dst, const struct camellia128_ctx *src); void camellia128_crypt(const struct camellia128_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); struct camellia256_ctx { uint64_t keys[_CAMELLIA256_NKEYS]; }; void camellia256_set_encrypt_key(struct camellia256_ctx *ctx, const uint8_t *key); void camellia256_set_decrypt_key(struct camellia256_ctx *ctx, const uint8_t *key); void camellia256_invert_key(struct camellia256_ctx *dst, const struct camellia256_ctx *src); void camellia256_crypt(const struct camellia256_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); /* camellia192 is the same as camellia256, except for the key schedule. */ /* Slightly ugly with a #define on a struct tag, since it might cause surprises if also used as a name of a variable. */ #define camellia192_ctx camellia256_ctx void camellia192_set_encrypt_key(struct camellia256_ctx *ctx, const uint8_t *key); void camellia192_set_decrypt_key(struct camellia256_ctx *ctx, const uint8_t *key); #define camellia192_invert_key camellia256_invert_key #define camellia192_crypt camellia256_crypt #ifdef __cplusplus } #endif #endif /* NETTLE_CAMELLIA_H_INCLUDED */
4,252
C++
.h
107
36.626168
72
0.768313
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
22,360
md5.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/md5.h
/* md5.h The MD5 hash function, described in RFC 1321. Copyright (C) 2001 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_MD5_H_INCLUDED #define NETTLE_MD5_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define md5_init nettle_md5_init #define md5_update nettle_md5_update #define md5_digest nettle_md5_digest #define md5_compress nettle_md5_compress #define MD5_DIGEST_SIZE 16 #define MD5_BLOCK_SIZE 64 /* For backwards compatibility */ #define MD5_DATA_SIZE MD5_BLOCK_SIZE /* Digest is kept internally as 4 32-bit words. */ #define _MD5_DIGEST_LENGTH 4 struct md5_ctx { uint32_t state[_MD5_DIGEST_LENGTH]; uint64_t count; /* Block count */ unsigned index; /* Into buffer */ uint8_t block[MD5_BLOCK_SIZE]; /* Block buffer */ }; void md5_init(struct md5_ctx *ctx); void md5_update(struct md5_ctx *ctx, size_t length, const uint8_t *data); void md5_digest(struct md5_ctx *ctx, size_t length, uint8_t *digest); /* MD5 compression function. STATE points to 4 uint32_t words, and DATA points to 64 bytes of input data, possibly unaligned. */ void md5_compress(uint32_t *state, const uint8_t *data); /* Old name, for backwards compatibility. */ #define _nettle_md5_compress nettle_md5_compress #ifdef __cplusplus } #endif #endif /* NETTLE_MD5_H_INCLUDED */
2,325
C++
.h
66
32.227273
72
0.735452
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,361
asn1.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/asn1.h
/* asn1.h Limited support for ASN.1 DER decoding. Copyright (C) 2005 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_ASN1_H_INCLUDED #define NETTLE_ASN1_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define asn1_der_iterator_first nettle_asn1_der_iterator_first #define asn1_der_iterator_next nettle_asn1_der_iterator_next #define asn1_der_decode_constructed nettle_asn1_der_decode_constructed #define asn1_der_decode_constructed_last nettle_asn1_der_decode_constructed_last #define asn1_der_decode_bitstring nettle_asn1_der_decode_bitstring #define asn1_der_decode_bitstring_last nettle_asn1_der_decode_bitstring_last #define asn1_der_get_uint32 nettle_asn1_der_get_uint32 #define asn1_der_get_bignum nettle_asn1_der_get_bignum /* enum asn1_type keeps the class number and the constructive in bits 13-14, and the constructive flag in bit 12. The remaining 14 bits are the tag (although currently, only tags in the range 0-30 are supported). */ enum { ASN1_TYPE_CONSTRUCTED = 1 << 12, ASN1_CLASS_UNIVERSAL = 0, ASN1_CLASS_APPLICATION = 1 << 13, ASN1_CLASS_CONTEXT_SPECIFIC = 2 << 13, ASN1_CLASS_PRIVATE = 3 << 13, ASN1_CLASS_MASK = 3 << 13, ASN1_CLASS_SHIFT = 13, }; enum asn1_type { ASN1_BOOLEAN = 1, ASN1_INTEGER = 2, ASN1_BITSTRING = 3, ASN1_OCTETSTRING = 4, ASN1_NULL = 5, ASN1_IDENTIFIER = 6, ASN1_REAL = 9, ASN1_ENUMERATED = 10, ASN1_UTF8STRING = 12, ASN1_SEQUENCE = 16 | ASN1_TYPE_CONSTRUCTED, ASN1_SET = 17 | ASN1_TYPE_CONSTRUCTED, ASN1_PRINTABLESTRING = 19, ASN1_TELETEXSTRING = 20, ASN1_IA5STRING = 22, ASN1_UTC = 23, ASN1_UNIVERSALSTRING = 28, ASN1_BMPSTRING = 30, }; enum asn1_iterator_result { ASN1_ITERATOR_ERROR, ASN1_ITERATOR_PRIMITIVE, ASN1_ITERATOR_CONSTRUCTED, ASN1_ITERATOR_END, }; /* Parsing DER objects. */ struct asn1_der_iterator { size_t buffer_length; const uint8_t *buffer; /* Next object to parse. */ size_t pos; enum asn1_type type; /* Pointer to the current object */ size_t length; const uint8_t *data; }; /* Initializes the iterator. */ enum asn1_iterator_result asn1_der_iterator_first(struct asn1_der_iterator *iterator, size_t length, const uint8_t *input); enum asn1_iterator_result asn1_der_iterator_next(struct asn1_der_iterator *iterator); /* Starts parsing of a constructed object. */ enum asn1_iterator_result asn1_der_decode_constructed(struct asn1_der_iterator *i, struct asn1_der_iterator *contents); /* For the common case that we have a sequence at the end of the object. Checks that the current object is the final one, and then reinitializes the iterator to parse its ontents. */ enum asn1_iterator_result asn1_der_decode_constructed_last(struct asn1_der_iterator *i); enum asn1_iterator_result asn1_der_decode_bitstring(struct asn1_der_iterator *i, struct asn1_der_iterator *contents); enum asn1_iterator_result asn1_der_decode_bitstring_last(struct asn1_der_iterator *i); /* All these functions return 1 on success, 0 on failure */ int asn1_der_get_uint32(struct asn1_der_iterator *i, uint32_t *x); #ifdef __cplusplus } #endif #endif /* NETTLE_ASN1_H_INCLUDED */
4,217
C++
.h
118
32.279661
80
0.738745
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
22,362
nettle-meta.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/nettle-meta.h
/* nettle-meta.h Information about algorithms. Copyright (C) 2002, 2014, 2020 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_META_H_INCLUDED #define NETTLE_META_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif struct nettle_cipher { const char *name; unsigned context_size; /* Zero for stream ciphers */ unsigned block_size; /* Suggested key size; other sizes are sometimes possible. */ unsigned key_size; nettle_set_key_func *set_encrypt_key; nettle_set_key_func *set_decrypt_key; nettle_cipher_func *encrypt; nettle_cipher_func *decrypt; }; /* null-terminated list of ciphers implemented by this version of nettle */ const struct nettle_cipher * const * _NETTLE_ATTRIBUTE_PURE nettle_get_ciphers (void); #define nettle_ciphers (nettle_get_ciphers()) extern const struct nettle_cipher nettle_aes128; extern const struct nettle_cipher nettle_aes192; extern const struct nettle_cipher nettle_aes256; extern const struct nettle_cipher nettle_camellia128; extern const struct nettle_cipher nettle_camellia192; extern const struct nettle_cipher nettle_camellia256; extern const struct nettle_cipher nettle_cast128; extern const struct nettle_cipher nettle_serpent128; extern const struct nettle_cipher nettle_serpent192; extern const struct nettle_cipher nettle_serpent256; extern const struct nettle_cipher nettle_twofish128; extern const struct nettle_cipher nettle_twofish192; extern const struct nettle_cipher nettle_twofish256; extern const struct nettle_cipher nettle_arctwo40; extern const struct nettle_cipher nettle_arctwo64; extern const struct nettle_cipher nettle_arctwo128; extern const struct nettle_cipher nettle_arctwo_gutmann128; extern const struct nettle_cipher nettle_sm4; struct nettle_hash { const char *name; /* Size of the context struct */ unsigned context_size; /* Size of digests */ unsigned digest_size; /* Internal block size */ unsigned block_size; nettle_hash_init_func *init; nettle_hash_update_func *update; nettle_hash_digest_func *digest; }; #define _NETTLE_HASH(name, NAME) { \ #name, \ sizeof(struct name##_ctx), \ NAME##_DIGEST_SIZE, \ NAME##_BLOCK_SIZE, \ (nettle_hash_init_func *) name##_init, \ (nettle_hash_update_func *) name##_update, \ (nettle_hash_digest_func *) name##_digest \ } /* null-terminated list of digests implemented by this version of nettle */ const struct nettle_hash * const * _NETTLE_ATTRIBUTE_PURE nettle_get_hashes (void); #define nettle_hashes (nettle_get_hashes()) const struct nettle_hash * nettle_lookup_hash (const char *name); extern const struct nettle_hash nettle_md2; extern const struct nettle_hash nettle_md4; extern const struct nettle_hash nettle_md5; extern const struct nettle_hash nettle_gosthash94; extern const struct nettle_hash nettle_gosthash94cp; extern const struct nettle_hash nettle_ripemd160; extern const struct nettle_hash nettle_sha1; extern const struct nettle_hash nettle_sha224; extern const struct nettle_hash nettle_sha256; extern const struct nettle_hash nettle_sha384; extern const struct nettle_hash nettle_sha512; extern const struct nettle_hash nettle_sha512_224; extern const struct nettle_hash nettle_sha512_256; extern const struct nettle_hash nettle_sha3_224; extern const struct nettle_hash nettle_sha3_256; extern const struct nettle_hash nettle_sha3_384; extern const struct nettle_hash nettle_sha3_512; extern const struct nettle_hash nettle_streebog256; extern const struct nettle_hash nettle_streebog512; extern const struct nettle_hash nettle_sm3; struct nettle_mac { const char *name; /* Size of the context struct */ unsigned context_size; /* Size of digests */ unsigned digest_size; /* Key size */ unsigned key_size; nettle_set_key_func *set_key; nettle_hash_update_func *update; nettle_hash_digest_func *digest; }; struct nettle_aead { const char *name; unsigned context_size; /* Block size for encrypt and decrypt. */ unsigned block_size; unsigned key_size; unsigned nonce_size; unsigned digest_size; nettle_set_key_func *set_encrypt_key; nettle_set_key_func *set_decrypt_key; nettle_set_key_func *set_nonce; nettle_hash_update_func *update; nettle_crypt_func *encrypt; nettle_crypt_func *decrypt; /* FIXME: Drop length argument? */ nettle_hash_digest_func *digest; }; /* null-terminated list of aead constructions implemented by this version of nettle */ const struct nettle_aead * const * _NETTLE_ATTRIBUTE_PURE nettle_get_aeads (void); #define nettle_aeads (nettle_get_aeads()) extern const struct nettle_aead nettle_gcm_aes128; extern const struct nettle_aead nettle_gcm_aes192; extern const struct nettle_aead nettle_gcm_aes256; extern const struct nettle_aead nettle_gcm_camellia128; extern const struct nettle_aead nettle_gcm_camellia256; extern const struct nettle_aead nettle_gcm_sm4; extern const struct nettle_aead nettle_eax_aes128; extern const struct nettle_aead nettle_chacha_poly1305; struct nettle_armor { const char *name; unsigned encode_context_size; unsigned decode_context_size; unsigned encode_final_length; nettle_armor_init_func *encode_init; nettle_armor_length_func *encode_length; nettle_armor_encode_update_func *encode_update; nettle_armor_encode_final_func *encode_final; nettle_armor_init_func *decode_init; nettle_armor_length_func *decode_length; nettle_armor_decode_update_func *decode_update; nettle_armor_decode_final_func *decode_final; }; #define _NETTLE_ARMOR(name, NAME) { \ #name, \ sizeof(struct name##_encode_ctx), \ sizeof(struct name##_decode_ctx), \ NAME##_ENCODE_FINAL_LENGTH, \ (nettle_armor_init_func *) name##_encode_init, \ (nettle_armor_length_func *) name##_encode_length, \ (nettle_armor_encode_update_func *) name##_encode_update, \ (nettle_armor_encode_final_func *) name##_encode_final, \ (nettle_armor_init_func *) name##_decode_init, \ (nettle_armor_length_func *) name##_decode_length, \ (nettle_armor_decode_update_func *) name##_decode_update, \ (nettle_armor_decode_final_func *) name##_decode_final, \ } #define _NETTLE_ARMOR_0(name, NAME) { \ #name, \ 0, \ sizeof(struct name##_decode_ctx), \ NAME##_ENCODE_FINAL_LENGTH, \ (nettle_armor_init_func *) name##_encode_init, \ (nettle_armor_length_func *) name##_encode_length, \ (nettle_armor_encode_update_func *) name##_encode_update, \ (nettle_armor_encode_final_func *) name##_encode_final, \ (nettle_armor_init_func *) name##_decode_init, \ (nettle_armor_length_func *) name##_decode_length, \ (nettle_armor_decode_update_func *) name##_decode_update, \ (nettle_armor_decode_final_func *) name##_decode_final, \ } /* null-terminated list of armor schemes implemented by this version of nettle */ const struct nettle_armor * const * _NETTLE_ATTRIBUTE_PURE nettle_get_armors (void); #define nettle_armors (nettle_get_armors()) extern const struct nettle_armor nettle_base64; extern const struct nettle_armor nettle_base64url; extern const struct nettle_armor nettle_base16; #define _NETTLE_HMAC(name, HASH) { \ #name, \ sizeof(struct name##_ctx), \ HASH##_DIGEST_SIZE, \ HASH##_DIGEST_SIZE, \ name##_set_key_wrapper, \ (nettle_hash_update_func *) name##_update, \ (nettle_hash_digest_func *) name##_digest, \ } /* null-terminated list of macs implemented by this version of nettle */ const struct nettle_mac * const * _NETTLE_ATTRIBUTE_PURE nettle_get_macs (void); #define nettle_macs (nettle_get_macs()) extern const struct nettle_mac nettle_cmac_aes128; extern const struct nettle_mac nettle_cmac_aes256; extern const struct nettle_mac nettle_cmac_des3; /* HMAC variants with key size = digest size */ extern const struct nettle_mac nettle_hmac_md5; extern const struct nettle_mac nettle_hmac_ripemd160; extern const struct nettle_mac nettle_hmac_sha1; extern const struct nettle_mac nettle_hmac_sha224; extern const struct nettle_mac nettle_hmac_sha256; extern const struct nettle_mac nettle_hmac_sha384; extern const struct nettle_mac nettle_hmac_sha512; extern const struct nettle_mac nettle_hmac_streebog256; extern const struct nettle_mac nettle_hmac_streebog512; extern const struct nettle_mac nettle_hmac_sm3; #ifdef __cplusplus } #endif #endif /* NETTLE_META_H_INCLUDED */
9,331
C++
.h
237
36.911392
81
0.762475
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,363
siv-cmac.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/siv-cmac.h
/* siv-cmac.h AES-SIV, RFC5297 Copyright (C) 2017 Nikos Mavrogiannopoulos This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_SIV_H_INCLUDED #define NETTLE_SIV_H_INCLUDED #include "nettle-types.h" #include "nettle-meta.h" #include "cmac.h" #include "aes.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define siv_cmac_set_key nettle_siv_cmac_set_key #define siv_cmac_encrypt_message nettle_siv_cmac_encrypt_message #define siv_cmac_decrypt_message nettle_siv_cmac_decrypt_message #define siv_cmac_aes128_set_key nettle_siv_cmac_aes128_set_key #define siv_cmac_aes128_encrypt_message nettle_siv_cmac_aes128_encrypt_message #define siv_cmac_aes128_decrypt_message nettle_siv_cmac_aes128_decrypt_message #define siv_cmac_aes256_set_key nettle_siv_cmac_aes256_set_key #define siv_cmac_aes256_encrypt_message nettle_siv_cmac_aes256_encrypt_message #define siv_cmac_aes256_decrypt_message nettle_siv_cmac_aes256_decrypt_message /* For SIV, the block size of the underlying cipher shall be 128 bits. */ #define SIV_BLOCK_SIZE 16 #define SIV_DIGEST_SIZE 16 #define SIV_MIN_NONCE_SIZE 1 void siv_cmac_set_key(struct cmac128_key *cmac_key, void *cmac_cipher, void *ctr_cipher, const struct nettle_cipher *nc, const uint8_t *key); void siv_cmac_encrypt_message(const struct cmac128_key *cmac_key, const void *cmac_cipher_ctx, const struct nettle_cipher *nc, const void *ctr_ctx, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t clength, uint8_t *dst, const uint8_t *src); int siv_cmac_decrypt_message(const struct cmac128_key *cmac_key, const void *cmac_cipher, const struct nettle_cipher *nc, const void *ctr_cipher, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t mlength, uint8_t *dst, const uint8_t *src); /* * SIV mode requires the aad and plaintext when building the IV, which * prevents streaming processing and it incompatible with the AEAD API. */ #define SIV_CMAC_CTX(type) { struct cmac128_key cmac_key; type cmac_cipher; type ctr_cipher; } /* SIV_CMAC_AES128 */ #define SIV_CMAC_AES128_KEY_SIZE 32 struct siv_cmac_aes128_ctx SIV_CMAC_CTX(struct aes128_ctx); void siv_cmac_aes128_set_key(struct siv_cmac_aes128_ctx *ctx, const uint8_t *key); void siv_cmac_aes128_encrypt_message(const struct siv_cmac_aes128_ctx *ctx, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t clength, uint8_t *dst, const uint8_t *src); int siv_cmac_aes128_decrypt_message(const struct siv_cmac_aes128_ctx *ctx, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t mlength, uint8_t *dst, const uint8_t *src); /* SIV_CMAC_AES256 */ #define SIV_CMAC_AES256_KEY_SIZE 64 struct siv_cmac_aes256_ctx SIV_CMAC_CTX(struct aes256_ctx); void siv_cmac_aes256_set_key(struct siv_cmac_aes256_ctx *ctx, const uint8_t *key); void siv_cmac_aes256_encrypt_message(const struct siv_cmac_aes256_ctx *ctx, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t clength, uint8_t *dst, const uint8_t *src); int siv_cmac_aes256_decrypt_message(const struct siv_cmac_aes256_ctx *ctx, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t mlength, uint8_t *dst, const uint8_t *src); #ifdef __cplusplus } #endif #endif /* NETTLE_SIV_H_INCLUDED */
4,356
C++
.h
102
39.656863
94
0.752013
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,364
serpent.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/serpent.h
/* serpent.h The serpent block cipher. Copyright (C) 2001 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ /* Serpent is a 128-bit block cipher that accepts a key size of 256 * bits, designed by Ross Anderson, Eli Biham, and Lars Knudsen. See * http://www.cl.cam.ac.uk/~rja14/serpent.html for details. */ #ifndef NETTLE_SERPENT_H_INCLUDED #define NETTLE_SERPENT_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define serpent_set_key nettle_serpent_set_key #define serpent128_set_key nettle_serpent128_set_key #define serpent192_set_key nettle_serpent192_set_key #define serpent256_set_key nettle_serpent256_set_key #define serpent_encrypt nettle_serpent_encrypt #define serpent_decrypt nettle_serpent_decrypt #define SERPENT_BLOCK_SIZE 16 /* Other key lengths are possible, but the design of Serpent makes * smaller key lengths quite pointless; they cheated with the AES * requirements, using a 256-bit key length exclusively and just * padding it out if the desired key length was less, so there really * is no advantage to using key lengths less than 256 bits. */ #define SERPENT_KEY_SIZE 32 /* Allow keys of size 128 <= bits <= 256 */ #define SERPENT_MIN_KEY_SIZE 16 #define SERPENT_MAX_KEY_SIZE 32 #define SERPENT128_KEY_SIZE 16 #define SERPENT192_KEY_SIZE 24 #define SERPENT256_KEY_SIZE 32 struct serpent_ctx { uint32_t keys[33][4]; /* key schedule */ }; void serpent_set_key(struct serpent_ctx *ctx, size_t length, const uint8_t *key); void serpent128_set_key(struct serpent_ctx *ctx, const uint8_t *key); void serpent192_set_key(struct serpent_ctx *ctx, const uint8_t *key); void serpent256_set_key(struct serpent_ctx *ctx, const uint8_t *key); void serpent_encrypt(const struct serpent_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void serpent_decrypt(const struct serpent_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); #ifdef __cplusplus } #endif #endif /* NETTLE_SERPENT_H_INCLUDED */
3,015
C++
.h
77
35.636364
72
0.743907
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
22,365
pkcs1.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/pkcs1.h
/* pkcs1.h PKCS1 embedding. Copyright (C) 2003 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_PKCS1_H_INCLUDED #define NETTLE_PKCS1_H_INCLUDED #include "nettle-types.h" #include "bignum.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define pkcs1_rsa_digest_encode nettle_pkcs1_rsa_digest_encode #define pkcs1_rsa_md5_encode nettle_pkcs1_rsa_md5_encode #define pkcs1_rsa_md5_encode_digest nettle_pkcs1_rsa_md5_encode_digest #define pkcs1_rsa_sha1_encode nettle_pkcs1_rsa_sha1_encode #define pkcs1_rsa_sha1_encode_digest nettle_pkcs1_rsa_sha1_encode_digest #define pkcs1_rsa_sha256_encode nettle_pkcs1_rsa_sha256_encode #define pkcs1_rsa_sha256_encode_digest nettle_pkcs1_rsa_sha256_encode_digest #define pkcs1_rsa_sha512_encode nettle_pkcs1_rsa_sha512_encode #define pkcs1_rsa_sha512_encode_digest nettle_pkcs1_rsa_sha512_encode_digest #define pkcs1_encrypt nettle_pkcs1_encrypt #define pkcs1_decrypt nettle_pkcs1_decrypt struct md5_ctx; struct sha1_ctx; struct sha256_ctx; struct sha512_ctx; int pkcs1_encrypt (size_t key_size, /* For padding */ void *random_ctx, nettle_random_func *random, size_t length, const uint8_t *message, mpz_t m); int pkcs1_decrypt (size_t key_size, const mpz_t m, size_t *length, uint8_t *message); int pkcs1_rsa_digest_encode(mpz_t m, size_t key_size, size_t di_length, const uint8_t *digest_info); int pkcs1_rsa_md5_encode(mpz_t m, size_t length, struct md5_ctx *hash); int pkcs1_rsa_md5_encode_digest(mpz_t m, size_t length, const uint8_t *digest); int pkcs1_rsa_sha1_encode(mpz_t m, size_t length, struct sha1_ctx *hash); int pkcs1_rsa_sha1_encode_digest(mpz_t m, size_t length, const uint8_t *digest); int pkcs1_rsa_sha256_encode(mpz_t m, size_t length, struct sha256_ctx *hash); int pkcs1_rsa_sha256_encode_digest(mpz_t m, size_t length, const uint8_t *digest); int pkcs1_rsa_sha512_encode(mpz_t m, size_t length, struct sha512_ctx *hash); int pkcs1_rsa_sha512_encode_digest(mpz_t m, size_t length, const uint8_t *digest); #ifdef __cplusplus } #endif #endif /* NETTLE_PKCS1_H_INCLUDED */
3,062
C++
.h
78
36.217949
78
0.757442
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,366
dsa-compat.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/dsa-compat.h
/* dsa-compat.h Old DSA publickey interface. Copyright (C) 2002, 2013, 2014 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_DSA_COMPAT_H_INCLUDED #define NETTLE_DSA_COMPAT_H_INCLUDED #include "dsa.h" #include "sha1.h" #include "sha2.h" /* Name mangling */ #define dsa_public_key_init nettle_dsa_public_key_init #define dsa_public_key_clear nettle_dsa_public_key_clear #define dsa_private_key_init nettle_dsa_private_key_init #define dsa_private_key_clear nettle_dsa_private_key_clear #define dsa_sha1_sign nettle_dsa_sha1_sign #define dsa_sha1_verify nettle_dsa_sha1_verify #define dsa_sha256_sign nettle_dsa_sha256_sign #define dsa_sha256_verify nettle_dsa_sha256_verify #define dsa_sha1_sign_digest nettle_dsa_sha1_sign_digest #define dsa_sha1_verify_digest nettle_dsa_sha1_verify_digest #define dsa_sha256_sign_digest nettle_dsa_sha256_sign_digest #define dsa_sha256_verify_digest nettle_dsa_sha256_verify_digest #define dsa_compat_generate_keypair nettle_dsa_compat_generate_keypair /* Switch meaning of dsa_generate_keypair */ #undef dsa_generate_keypair #define dsa_generate_keypair nettle_dsa_compat_generate_keypair #ifdef __cplusplus extern "C" { #endif struct dsa_public_key { /* Same as struct dsa_params, but can't use that struct here without breaking backwards compatibility. Layout must be identical, since this is cast to a struct dsa_param pointer for calling _dsa_sign and _dsa_verify */ mpz_t p; mpz_t q; mpz_t g; /* Public value */ mpz_t y; }; struct dsa_private_key { /* Unlike an rsa public key, private key operations will need both * the private and the public information. */ mpz_t x; }; /* Signing a message works as follows: * * Store the private key in a dsa_private_key struct. * * Initialize a hashing context, by callling * sha1_init * * Hash the message by calling * sha1_update * * Create the signature by calling * dsa_sha1_sign * * The signature is represented as a struct dsa_signature. This call also * resets the hashing context. * * When done with the key and signature, don't forget to call * dsa_signature_clear. */ /* Calls mpz_init to initialize bignum storage. */ void dsa_public_key_init(struct dsa_public_key *key); /* Calls mpz_clear to deallocate bignum storage. */ void dsa_public_key_clear(struct dsa_public_key *key); /* Calls mpz_init to initialize bignum storage. */ void dsa_private_key_init(struct dsa_private_key *key); /* Calls mpz_clear to deallocate bignum storage. */ void dsa_private_key_clear(struct dsa_private_key *key); int dsa_sha1_sign(const struct dsa_public_key *pub, const struct dsa_private_key *key, void *random_ctx, nettle_random_func *random, struct sha1_ctx *hash, struct dsa_signature *signature); int dsa_sha256_sign(const struct dsa_public_key *pub, const struct dsa_private_key *key, void *random_ctx, nettle_random_func *random, struct sha256_ctx *hash, struct dsa_signature *signature); int dsa_sha1_verify(const struct dsa_public_key *key, struct sha1_ctx *hash, const struct dsa_signature *signature); int dsa_sha256_verify(const struct dsa_public_key *key, struct sha256_ctx *hash, const struct dsa_signature *signature); int dsa_sha1_sign_digest(const struct dsa_public_key *pub, const struct dsa_private_key *key, void *random_ctx, nettle_random_func *random, const uint8_t *digest, struct dsa_signature *signature); int dsa_sha256_sign_digest(const struct dsa_public_key *pub, const struct dsa_private_key *key, void *random_ctx, nettle_random_func *random, const uint8_t *digest, struct dsa_signature *signature); int dsa_sha1_verify_digest(const struct dsa_public_key *key, const uint8_t *digest, const struct dsa_signature *signature); int dsa_sha256_verify_digest(const struct dsa_public_key *key, const uint8_t *digest, const struct dsa_signature *signature); /* Key generation */ int dsa_generate_keypair(struct dsa_public_key *pub, struct dsa_private_key *key, void *random_ctx, nettle_random_func *random, void *progress_ctx, nettle_progress_func *progress, unsigned p_bits, unsigned q_bits); #ifdef __cplusplus } #endif #endif /* NETTLE_DSA_COMPAT_H_INCLUDED */
5,263
C++
.h
147
32.530612
73
0.74626
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
22,367
ripemd160.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/ripemd160.h
/* ripemd160.h RIPEMD-160 hash function. Copyright (C) 2011 Andres Mejia This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_RIPEMD160_H_INCLUDED #define NETTLE_RIPEMD160_H_INCLUDED #ifdef __cplusplus extern "C" { #endif #include "nettle-types.h" /* Name mangling */ #define ripemd160_init nettle_ripemd160_init #define ripemd160_update nettle_ripemd160_update #define ripemd160_digest nettle_ripemd160_digest /* RIPEMD160 */ #define RIPEMD160_DIGEST_SIZE 20 #define RIPEMD160_BLOCK_SIZE 64 /* For backwards compatibility */ #define RIPEMD160_DATA_SIZE RIPEMD160_BLOCK_SIZE /* Digest is kept internally as 5 32-bit words. */ #define _RIPEMD160_DIGEST_LENGTH 5 struct ripemd160_ctx { uint32_t state[_RIPEMD160_DIGEST_LENGTH]; uint64_t count; /* 64-bit block count */ unsigned int index; uint8_t block[RIPEMD160_BLOCK_SIZE]; }; void ripemd160_init(struct ripemd160_ctx *ctx); void ripemd160_update(struct ripemd160_ctx *ctx, size_t length, const uint8_t *data); void ripemd160_digest(struct ripemd160_ctx *ctx, size_t length, uint8_t *digest); #ifdef __cplusplus } #endif #endif /* NETTLE_RIPEMD160_H_INCLUDED */
2,088
C++
.h
60
31.75
72
0.759102
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,368
sm4.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/sm4.h
/* sm4.h Copyright (C) 2022 Tianjia Zhang <tianjia.zhang@linux.alibaba.com> This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_SM4_H_INCLUDED #define NETTLE_SM4_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define sm4_set_encrypt_key nettle_sm4_set_encrypt_key #define sm4_set_decrypt_key nettle_sm4_set_decrypt_key #define sm4_crypt nettle_sm4_crypt #define SM4_BLOCK_SIZE 16 #define SM4_KEY_SIZE 16 struct sm4_ctx { uint32_t rkey[32]; }; void sm4_set_encrypt_key(struct sm4_ctx *ctx, const uint8_t *key); void sm4_set_decrypt_key(struct sm4_ctx *ctx, const uint8_t *key); void sm4_crypt(const struct sm4_ctx *context, size_t length, uint8_t *dst, const uint8_t *src); #ifdef __cplusplus } #endif #endif /* NETTLE_SM4_H_INCLUDED */
1,736
C++
.h
49
32.285714
72
0.74925
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,369
curve25519.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/curve25519.h
/* curve25519.h Copyright (C) 2014 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_CURVE25519_H #define NETTLE_CURVE25519_H #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define curve25519_mul_g nettle_curve25519_mul_g #define curve25519_mul nettle_curve25519_mul #define CURVE25519_SIZE 32 /* Indicates that curve25519_mul conforms to RFC 7748. */ #define NETTLE_CURVE25519_RFC7748 1 void curve25519_mul_g (uint8_t *q, const uint8_t *n); void curve25519_mul (uint8_t *q, const uint8_t *n, const uint8_t *p); #ifdef __cplusplus } #endif #endif /* NETTLE_CURVE25519_H */
1,569
C++
.h
41
34.926829
72
0.752816
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,370
md4.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/md4.h
/* md4.h The MD4 hash function, described in RFC 1320. Copyright (C) 2003 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_MD4_H_INCLUDED #define NETTLE_MD4_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define md4_init nettle_md4_init #define md4_update nettle_md4_update #define md4_digest nettle_md4_digest #define MD4_DIGEST_SIZE 16 #define MD4_BLOCK_SIZE 64 /* For backwards compatibility */ #define MD4_DATA_SIZE MD4_BLOCK_SIZE /* Digest is kept internally as 4 32-bit words. */ #define _MD4_DIGEST_LENGTH 4 /* FIXME: Identical to md5_ctx */ struct md4_ctx { uint32_t state[_MD4_DIGEST_LENGTH]; uint64_t count; /* Block count */ unsigned index; /* Into buffer */ uint8_t block[MD4_BLOCK_SIZE]; /* Block buffer */ }; void md4_init(struct md4_ctx *ctx); void md4_update(struct md4_ctx *ctx, size_t length, const uint8_t *data); void md4_digest(struct md4_ctx *ctx, size_t length, uint8_t *digest); #ifdef __cplusplus } #endif #endif /* NETTLE_MD4_H_INCLUDED */
2,009
C++
.h
60
30.366667
72
0.73676
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,371
sha1.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/sha1.h
/* sha1.h The sha1 hash function. Copyright (C) 2001, 2012 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_SHA1_H_INCLUDED #define NETTLE_SHA1_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define sha1_init nettle_sha1_init #define sha1_update nettle_sha1_update #define sha1_digest nettle_sha1_digest #define sha1_compress nettle_sha1_compress /* SHA1 */ #define SHA1_DIGEST_SIZE 20 #define SHA1_BLOCK_SIZE 64 /* For backwards compatibility */ #define SHA1_DATA_SIZE SHA1_BLOCK_SIZE /* Digest is kept internally as 5 32-bit words. */ #define _SHA1_DIGEST_LENGTH 5 struct sha1_ctx { uint32_t state[_SHA1_DIGEST_LENGTH]; /* State variables */ uint64_t count; /* 64-bit block count */ unsigned int index; /* index into buffer */ uint8_t block[SHA1_BLOCK_SIZE]; /* SHA1 data buffer */ }; void sha1_init(struct sha1_ctx *ctx); void sha1_update(struct sha1_ctx *ctx, size_t length, const uint8_t *data); void sha1_digest(struct sha1_ctx *ctx, size_t length, uint8_t *digest); /* SHA1 compression function. STATE points to 5 uint32_t words, and DATA points to 64 bytes of input data, possibly unaligned. */ void sha1_compress(uint32_t *state, const uint8_t *data); /* Old name, for backwards compatibility. */ #define _nettle_sha1_compress nettle_sha1_compress #ifdef __cplusplus } #endif #endif /* NETTLE_SHA1_H_INCLUDED */
2,425
C++
.h
67
33.149254
72
0.726415
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,372
aes.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/aes.h
/* aes.h The aes/rijndael block cipher. Copyright (C) 2001, 2013 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_AES_H_INCLUDED #define NETTLE_AES_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define aes_set_encrypt_key nettle_aes_set_encrypt_key #define aes_set_decrypt_key nettle_aes_set_decrypt_key #define aes_invert_key nettle_aes_invert_key #define aes_encrypt nettle_aes_encrypt #define aes_decrypt nettle_aes_decrypt #define aes128_set_encrypt_key nettle_aes128_set_encrypt_key #define aes128_set_decrypt_key nettle_aes128_set_decrypt_key #define aes128_invert_key nettle_aes128_invert_key #define aes128_encrypt nettle_aes128_encrypt #define aes128_decrypt nettle_aes128_decrypt #define aes192_set_encrypt_key nettle_aes192_set_encrypt_key #define aes192_set_decrypt_key nettle_aes192_set_decrypt_key #define aes192_invert_key nettle_aes192_invert_key #define aes192_encrypt nettle_aes192_encrypt #define aes192_decrypt nettle_aes192_decrypt #define aes256_set_encrypt_key nettle_aes256_set_encrypt_key #define aes256_set_decrypt_key nettle_aes256_set_decrypt_key #define aes256_invert_key nettle_aes256_invert_key #define aes256_encrypt nettle_aes256_encrypt #define aes256_decrypt nettle_aes256_decrypt #define AES_BLOCK_SIZE 16 #define AES128_KEY_SIZE 16 #define AES192_KEY_SIZE 24 #define AES256_KEY_SIZE 32 #define _AES128_ROUNDS 10 #define _AES192_ROUNDS 12 #define _AES256_ROUNDS 14 struct aes128_ctx { uint32_t keys[4 * (_AES128_ROUNDS + 1)]; }; void aes128_set_encrypt_key(struct aes128_ctx *ctx, const uint8_t *key); void aes128_set_decrypt_key(struct aes128_ctx *ctx, const uint8_t *key); void aes128_invert_key(struct aes128_ctx *dst, const struct aes128_ctx *src); void aes128_encrypt(const struct aes128_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void aes128_decrypt(const struct aes128_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); struct aes192_ctx { uint32_t keys[4 * (_AES192_ROUNDS + 1)]; }; void aes192_set_encrypt_key(struct aes192_ctx *ctx, const uint8_t *key); void aes192_set_decrypt_key(struct aes192_ctx *ctx, const uint8_t *key); void aes192_invert_key(struct aes192_ctx *dst, const struct aes192_ctx *src); void aes192_encrypt(const struct aes192_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void aes192_decrypt(const struct aes192_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); struct aes256_ctx { uint32_t keys[4 * (_AES256_ROUNDS + 1)]; }; void aes256_set_encrypt_key(struct aes256_ctx *ctx, const uint8_t *key); void aes256_set_decrypt_key(struct aes256_ctx *ctx, const uint8_t *key); void aes256_invert_key(struct aes256_ctx *dst, const struct aes256_ctx *src); void aes256_encrypt(const struct aes256_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void aes256_decrypt(const struct aes256_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); /* The older nettle-2.7 AES interface is deprecated, please migrate to the newer interface where each algorithm has a fixed key size. */ /* Variable key size between 128 and 256 bits. But the only valid * values are 16 (128 bits), 24 (192 bits) and 32 (256 bits). */ #define AES_MIN_KEY_SIZE AES128_KEY_SIZE #define AES_MAX_KEY_SIZE AES256_KEY_SIZE #define AES_KEY_SIZE 32 struct aes_ctx { unsigned key_size; /* In octets */ union { struct aes128_ctx ctx128; struct aes192_ctx ctx192; struct aes256_ctx ctx256; } u; }; void aes_set_encrypt_key(struct aes_ctx *ctx, size_t length, const uint8_t *key) _NETTLE_ATTRIBUTE_DEPRECATED; void aes_set_decrypt_key(struct aes_ctx *ctx, size_t length, const uint8_t *key) _NETTLE_ATTRIBUTE_DEPRECATED; void aes_invert_key(struct aes_ctx *dst, const struct aes_ctx *src) _NETTLE_ATTRIBUTE_DEPRECATED; void aes_encrypt(const struct aes_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src) _NETTLE_ATTRIBUTE_DEPRECATED; void aes_decrypt(const struct aes_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src) _NETTLE_ATTRIBUTE_DEPRECATED; #ifdef __cplusplus } #endif #endif /* NETTLE_AES_H_INCLUDED */
5,221
C++
.h
153
31.202614
72
0.749752
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,373
hmac.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/hmac.h
/* hmac.h HMAC message authentication code (RFC-2104). Copyright (C) 2001, 2002 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_HMAC_H_INCLUDED #define NETTLE_HMAC_H_INCLUDED #include "nettle-meta.h" #include "gosthash94.h" #include "md5.h" #include "ripemd160.h" #include "sha1.h" #include "sha2.h" #include "streebog.h" #include "sm3.h" #ifdef __cplusplus extern "C" { #endif /* Namespace mangling */ #define hmac_set_key nettle_hmac_set_key #define hmac_update nettle_hmac_update #define hmac_digest nettle_hmac_digest #define hmac_md5_set_key nettle_hmac_md5_set_key #define hmac_md5_update nettle_hmac_md5_update #define hmac_md5_digest nettle_hmac_md5_digest #define hmac_ripemd160_set_key nettle_hmac_ripemd160_set_key #define hmac_ripemd160_update nettle_hmac_ripemd160_update #define hmac_ripemd160_digest nettle_hmac_ripemd160_digest #define hmac_sha1_set_key nettle_hmac_sha1_set_key #define hmac_sha1_update nettle_hmac_sha1_update #define hmac_sha1_digest nettle_hmac_sha1_digest #define hmac_sha224_set_key nettle_hmac_sha224_set_key #define hmac_sha224_digest nettle_hmac_sha224_digest #define hmac_sha256_set_key nettle_hmac_sha256_set_key #define hmac_sha256_update nettle_hmac_sha256_update #define hmac_sha256_digest nettle_hmac_sha256_digest #define hmac_sha384_set_key nettle_hmac_sha384_set_key #define hmac_sha384_digest nettle_hmac_sha384_digest #define hmac_sha512_set_key nettle_hmac_sha512_set_key #define hmac_sha512_update nettle_hmac_sha512_update #define hmac_sha512_digest nettle_hmac_sha512_digest #define hmac_gosthash94_set_key nettle_hmac_gosthash94_set_key #define hmac_gosthash94_update nettle_hmac_gosthash94_update #define hmac_gosthash94_digest nettle_hmac_gosthash94_digest #define hmac_gosthash94cp_set_key nettle_hmac_gosthash94cp_set_key #define hmac_gosthash94cp_update nettle_hmac_gosthash94cp_update #define hmac_gosthash94cp_digest nettle_hmac_gosthash94cp_digest #define hmac_streebog256_set_key nettle_hmac_streebog256_set_key #define hmac_streebog256_digest nettle_hmac_streebog256_digest #define hmac_streebog512_set_key nettle_hmac_streebog512_set_key #define hmac_streebog512_update nettle_hmac_streebog512_update #define hmac_streebog512_digest nettle_hmac_streebog512_digest #define hmac_sm3_set_key nettle_hmac_sm3_set_key #define hmac_sm3_update nettle_hmac_sm3_update #define hmac_sm3_digest nettle_hmac_sm3_digest void hmac_set_key(void *outer, void *inner, void *state, const struct nettle_hash *hash, size_t length, const uint8_t *key); /* This function is not strictly needed, it's s just the same as the * hash update function. */ void hmac_update(void *state, const struct nettle_hash *hash, size_t length, const uint8_t *data); void hmac_digest(const void *outer, const void *inner, void *state, const struct nettle_hash *hash, size_t length, uint8_t *digest); #define HMAC_CTX(type) \ { type outer; type inner; type state; } #define HMAC_SET_KEY(ctx, hash, length, key) \ hmac_set_key( &(ctx)->outer, &(ctx)->inner, &(ctx)->state, \ (hash), (length), (key) ) #define HMAC_DIGEST(ctx, hash, length, digest) \ hmac_digest( &(ctx)->outer, &(ctx)->inner, &(ctx)->state, \ (hash), (length), (digest) ) /* HMAC using specific hash functions */ /* hmac-md5 */ struct hmac_md5_ctx HMAC_CTX(struct md5_ctx); void hmac_md5_set_key(struct hmac_md5_ctx *ctx, size_t key_length, const uint8_t *key); void hmac_md5_update(struct hmac_md5_ctx *ctx, size_t length, const uint8_t *data); void hmac_md5_digest(struct hmac_md5_ctx *ctx, size_t length, uint8_t *digest); /* hmac-ripemd160 */ struct hmac_ripemd160_ctx HMAC_CTX(struct ripemd160_ctx); void hmac_ripemd160_set_key(struct hmac_ripemd160_ctx *ctx, size_t key_length, const uint8_t *key); void hmac_ripemd160_update(struct hmac_ripemd160_ctx *ctx, size_t length, const uint8_t *data); void hmac_ripemd160_digest(struct hmac_ripemd160_ctx *ctx, size_t length, uint8_t *digest); /* hmac-sha1 */ struct hmac_sha1_ctx HMAC_CTX(struct sha1_ctx); void hmac_sha1_set_key(struct hmac_sha1_ctx *ctx, size_t key_length, const uint8_t *key); void hmac_sha1_update(struct hmac_sha1_ctx *ctx, size_t length, const uint8_t *data); void hmac_sha1_digest(struct hmac_sha1_ctx *ctx, size_t length, uint8_t *digest); /* hmac-sha256 */ struct hmac_sha256_ctx HMAC_CTX(struct sha256_ctx); void hmac_sha256_set_key(struct hmac_sha256_ctx *ctx, size_t key_length, const uint8_t *key); void hmac_sha256_update(struct hmac_sha256_ctx *ctx, size_t length, const uint8_t *data); void hmac_sha256_digest(struct hmac_sha256_ctx *ctx, size_t length, uint8_t *digest); /* hmac-sha224 */ #define hmac_sha224_ctx hmac_sha256_ctx void hmac_sha224_set_key(struct hmac_sha224_ctx *ctx, size_t key_length, const uint8_t *key); #define hmac_sha224_update nettle_hmac_sha256_update void hmac_sha224_digest(struct hmac_sha224_ctx *ctx, size_t length, uint8_t *digest); /* hmac-sha512 */ struct hmac_sha512_ctx HMAC_CTX(struct sha512_ctx); void hmac_sha512_set_key(struct hmac_sha512_ctx *ctx, size_t key_length, const uint8_t *key); void hmac_sha512_update(struct hmac_sha512_ctx *ctx, size_t length, const uint8_t *data); void hmac_sha512_digest(struct hmac_sha512_ctx *ctx, size_t length, uint8_t *digest); /* hmac-sha384 */ #define hmac_sha384_ctx hmac_sha512_ctx void hmac_sha384_set_key(struct hmac_sha512_ctx *ctx, size_t key_length, const uint8_t *key); #define hmac_sha384_update nettle_hmac_sha512_update void hmac_sha384_digest(struct hmac_sha512_ctx *ctx, size_t length, uint8_t *digest); /* hmac-gosthash94 */ struct hmac_gosthash94_ctx HMAC_CTX(struct gosthash94_ctx); void hmac_gosthash94_set_key(struct hmac_gosthash94_ctx *ctx, size_t key_length, const uint8_t *key); void hmac_gosthash94_update(struct hmac_gosthash94_ctx *ctx, size_t length, const uint8_t *data); void hmac_gosthash94_digest(struct hmac_gosthash94_ctx *ctx, size_t length, uint8_t *digest); struct hmac_gosthash94cp_ctx HMAC_CTX(struct gosthash94cp_ctx); void hmac_gosthash94cp_set_key(struct hmac_gosthash94cp_ctx *ctx, size_t key_length, const uint8_t *key); void hmac_gosthash94cp_update(struct hmac_gosthash94cp_ctx *ctx, size_t length, const uint8_t *data); void hmac_gosthash94cp_digest(struct hmac_gosthash94cp_ctx *ctx, size_t length, uint8_t *digest); /* hmac-streebog */ struct hmac_streebog512_ctx HMAC_CTX(struct streebog512_ctx); void hmac_streebog512_set_key(struct hmac_streebog512_ctx *ctx, size_t key_length, const uint8_t *key); void hmac_streebog512_update(struct hmac_streebog512_ctx *ctx, size_t length, const uint8_t *data); void hmac_streebog512_digest(struct hmac_streebog512_ctx *ctx, size_t length, uint8_t *digest); #define hmac_streebog256_ctx hmac_streebog512_ctx void hmac_streebog256_set_key(struct hmac_streebog256_ctx *ctx, size_t key_length, const uint8_t *key); #define hmac_streebog256_update hmac_streebog512_update void hmac_streebog256_digest(struct hmac_streebog256_ctx *ctx, size_t length, uint8_t *digest); /* hmac-sm3 */ struct hmac_sm3_ctx HMAC_CTX(struct sm3_ctx); void hmac_sm3_set_key(struct hmac_sm3_ctx *ctx, size_t key_length, const uint8_t *key); void hmac_sm3_update(struct hmac_sm3_ctx *ctx, size_t length, const uint8_t *data); void hmac_sm3_digest(struct hmac_sm3_ctx *ctx, size_t length, uint8_t *digest); #ifdef __cplusplus } #endif #endif /* NETTLE_HMAC_H_INCLUDED */
8,539
C++
.h
223
35.542601
72
0.759951
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,374
cast128.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/cast128.h
/* cast128.h The CAST-128 block cipher. Copyright (C) 2001, 2014 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_CAST128_H_INCLUDED #define NETTLE_CAST128_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define cast5_set_key nettle_cast5_set_key #define cast128_set_key nettle_cast128_set_key #define cast128_encrypt nettle_cast128_encrypt #define cast128_decrypt nettle_cast128_decrypt #define CAST128_BLOCK_SIZE 8 /* Variable key size between 40 and 128. */ #define CAST5_MIN_KEY_SIZE 5 #define CAST5_MAX_KEY_SIZE 16 #define CAST128_KEY_SIZE 16 struct cast128_ctx { unsigned rounds; /* Number of rounds to use, 12 or 16 */ /* Expanded key, rotations (5 bits only) and 32-bit masks. */ unsigned char Kr[16]; uint32_t Km[16]; }; /* Using variable key size. */ void cast5_set_key(struct cast128_ctx *ctx, size_t length, const uint8_t *key); void cast128_set_key(struct cast128_ctx *ctx, const uint8_t *key); void cast128_encrypt(const struct cast128_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void cast128_decrypt(const struct cast128_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); #ifdef __cplusplus } #endif #endif /* NETTLE_CAST128_H_INCLUDED */
2,218
C++
.h
63
32.190476
72
0.747067
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,375
eddsa.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/eddsa.h
/* eddsa.h Copyright (C) 2014 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_EDDSA_H #define NETTLE_EDDSA_H #include "nettle-types.h" #include "bignum.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define ed25519_sha512_set_private_key nettle_ed25519_sha512_set_private_key #define ed25519_sha512_public_key nettle_ed25519_sha512_public_key #define ed25519_sha512_sign nettle_ed25519_sha512_sign #define ed25519_sha512_verify nettle_ed25519_sha512_verify #define ed448_shake256_public_key nettle_ed448_shake256_public_key #define ed448_shake256_sign nettle_ed448_shake256_sign #define ed448_shake256_verify nettle_ed448_shake256_verify #define ED25519_KEY_SIZE 32 #define ED25519_SIGNATURE_SIZE 64 void ed25519_sha512_public_key (uint8_t *pub, const uint8_t *priv); void ed25519_sha512_sign (const uint8_t *pub, const uint8_t *priv, size_t length, const uint8_t *msg, uint8_t *signature); int ed25519_sha512_verify (const uint8_t *pub, size_t length, const uint8_t *msg, const uint8_t *signature); #define ED448_KEY_SIZE 57 #define ED448_SIGNATURE_SIZE 114 void ed448_shake256_public_key (uint8_t *pub, const uint8_t *priv); void ed448_shake256_sign (const uint8_t *pub, const uint8_t *priv, size_t length, const uint8_t *msg, uint8_t *signature); int ed448_shake256_verify (const uint8_t *pub, size_t length, const uint8_t *msg, const uint8_t *signature); #ifdef __cplusplus } #endif #endif /* NETTLE_EDDSA_H */
2,486
C++
.h
66
33.757576
76
0.744351
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,376
umac.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/umac.h
/* umac.h UMAC message authentication code (RFC-4418). Copyright (C) 2013 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_UMAC_H_INCLUDED #define NETTLE_UMAC_H_INCLUDED #ifdef __cplusplus extern "C" { #endif /* Namespace mangling */ #define umac32_set_key nettle_umac32_set_key #define umac64_set_key nettle_umac64_set_key #define umac96_set_key nettle_umac96_set_key #define umac128_set_key nettle_umac128_set_key #define umac32_set_nonce nettle_umac32_set_nonce #define umac64_set_nonce nettle_umac64_set_nonce #define umac96_set_nonce nettle_umac96_set_nonce #define umac128_set_nonce nettle_umac128_set_nonce #define umac32_update nettle_umac32_update #define umac64_update nettle_umac64_update #define umac96_update nettle_umac96_update #define umac128_update nettle_umac128_update #define umac32_digest nettle_umac32_digest #define umac64_digest nettle_umac64_digest #define umac96_digest nettle_umac96_digest #define umac128_digest nettle_umac128_digest #include "nettle-types.h" #include "aes.h" #define UMAC_KEY_SIZE AES128_KEY_SIZE #define UMAC32_DIGEST_SIZE 4 #define UMAC64_DIGEST_SIZE 8 #define UMAC96_DIGEST_SIZE 12 #define UMAC128_DIGEST_SIZE 16 #define UMAC_BLOCK_SIZE 1024 #define UMAC_MIN_NONCE_SIZE 1 #define UMAC_MAX_NONCE_SIZE AES_BLOCK_SIZE /* For backwards compatibility */ #define UMAC_DATA_SIZE UMAC_BLOCK_SIZE /* Subkeys and state for UMAC with tag size 32*n bits. */ #define _UMAC_STATE(n) \ uint32_t l1_key[UMAC_BLOCK_SIZE/4 + 4*((n)-1)]; \ /* Keys in 32-bit pieces, high first */ \ uint32_t l2_key[6*(n)]; \ uint64_t l3_key1[8*(n)]; \ uint32_t l3_key2[(n)]; \ /* AES cipher for encrypting the nonce */ \ struct aes128_ctx pdf_key; \ /* The l2_state consists of 2*n uint64_t, for poly64 \ and poly128 hashing, followed by n additional \ uint64_t used as an input buffer. */ \ uint64_t l2_state[3*(n)]; \ /* Input to the pdf_key, zero-padded and low bits \ cleared if appropriate. */ \ uint8_t nonce[AES_BLOCK_SIZE]; \ unsigned short nonce_length /* For incrementing */ /* Buffering */ #define _UMAC_BUFFER \ unsigned index; \ /* Complete blocks processed */ \ uint64_t count; \ uint8_t block[UMAC_BLOCK_SIZE] #define _UMAC_NONCE_CACHED 0x80 struct umac32_ctx { _UMAC_STATE(1); /* Low bits and cache flag. */ unsigned short nonce_low; /* Previous padding block */ uint32_t pad_cache[AES_BLOCK_SIZE / 4]; _UMAC_BUFFER; }; struct umac64_ctx { _UMAC_STATE(2); /* Low bit and cache flag. */ unsigned short nonce_low; /* Previous padding block */ uint32_t pad_cache[AES_BLOCK_SIZE/4]; _UMAC_BUFFER; }; struct umac96_ctx { _UMAC_STATE(3); _UMAC_BUFFER; }; struct umac128_ctx { _UMAC_STATE(4); _UMAC_BUFFER; }; /* The _set_key function initialize the nonce to zero. */ void umac32_set_key (struct umac32_ctx *ctx, const uint8_t *key); void umac64_set_key (struct umac64_ctx *ctx, const uint8_t *key); void umac96_set_key (struct umac96_ctx *ctx, const uint8_t *key); void umac128_set_key (struct umac128_ctx *ctx, const uint8_t *key); /* Optional, if not used, messages get incrementing nonces starting from zero. */ void umac32_set_nonce (struct umac32_ctx *ctx, size_t nonce_length, const uint8_t *nonce); void umac64_set_nonce (struct umac64_ctx *ctx, size_t nonce_length, const uint8_t *nonce); void umac96_set_nonce (struct umac96_ctx *ctx, size_t nonce_length, const uint8_t *nonce); void umac128_set_nonce (struct umac128_ctx *ctx, size_t nonce_length, const uint8_t *nonce); void umac32_update (struct umac32_ctx *ctx, size_t length, const uint8_t *data); void umac64_update (struct umac64_ctx *ctx, size_t length, const uint8_t *data); void umac96_update (struct umac96_ctx *ctx, size_t length, const uint8_t *data); void umac128_update (struct umac128_ctx *ctx, size_t length, const uint8_t *data); /* The _digest functions increment the nonce */ void umac32_digest (struct umac32_ctx *ctx, size_t length, uint8_t *digest); void umac64_digest (struct umac64_ctx *ctx, size_t length, uint8_t *digest); void umac96_digest (struct umac96_ctx *ctx, size_t length, uint8_t *digest); void umac128_digest (struct umac128_ctx *ctx, size_t length, uint8_t *digest); /* Internal functions */ #define UMAC_POLY64_BLOCKS 16384 #define UMAC_P64_OFFSET 59 #define UMAC_P64 (- (uint64_t) UMAC_P64_OFFSET) #define UMAC_P128_OFFSET 159 #define UMAC_P128_HI (~(uint64_t) 0) #define UMAC_P128_LO (-(uint64_t) UMAC_P128_OFFSET) #ifdef __cplusplus } #endif #endif /* NETTLE_UMAC_H_INCLUDED */
5,584
C++
.h
166
31.042169
81
0.729941
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,377
base64.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/base64.h
/* base64.h Base-64 encoding and decoding. Copyright (C) 2002 Niels Möller, Dan Egnor This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_BASE64_H_INCLUDED #define NETTLE_BASE64_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define base64_encode_init nettle_base64_encode_init #define base64url_encode_init nettle_base64url_encode_init #define base64_encode_single nettle_base64_encode_single #define base64_encode_update nettle_base64_encode_update #define base64_encode_final nettle_base64_encode_final #define base64_encode_raw nettle_base64_encode_raw #define base64_encode_group nettle_base64_encode_group #define base64_decode_init nettle_base64_decode_init #define base64url_decode_init nettle_base64url_decode_init #define base64_decode_single nettle_base64_decode_single #define base64_decode_update nettle_base64_decode_update #define base64_decode_final nettle_base64_decode_final #define BASE64_BINARY_BLOCK_SIZE 3 #define BASE64_TEXT_BLOCK_SIZE 4 /* Base64 encoding */ /* Maximum length of output for base64_encode_update. NOTE: Doesn't * include any padding that base64_encode_final may add. */ /* We have at most 4 buffered bits, and a total of (4 + length * 8) bits. */ #define BASE64_ENCODE_LENGTH(length) (((length) * 8 + 4)/6) /* Maximum length of output generated by base64_encode_final. */ #define BASE64_ENCODE_FINAL_LENGTH 3 /* Exact length of output generated by base64_encode_raw, including * padding. */ #define BASE64_ENCODE_RAW_LENGTH(length) ((((length) + 2)/3)*4) struct base64_encode_ctx { const char *alphabet; /* Alphabet to use for encoding */ unsigned short word; /* Leftover bits */ unsigned char bits; /* Number of bits, always 0, 2, or 4. */ }; /* Initialize encoding context for base-64 */ void base64_encode_init(struct base64_encode_ctx *ctx); /* Initialize encoding context for URL safe alphabet, RFC 4648. */ void base64url_encode_init(struct base64_encode_ctx *ctx); /* Encodes a single byte. Returns amount of output (always 1 or 2). */ size_t base64_encode_single(struct base64_encode_ctx *ctx, char *dst, uint8_t src); /* Returns the number of output characters. DST should point to an * area of size at least BASE64_ENCODE_LENGTH(length). */ size_t base64_encode_update(struct base64_encode_ctx *ctx, char *dst, size_t length, const uint8_t *src); /* DST should point to an area of size at least * BASE64_ENCODE_FINAL_LENGTH */ size_t base64_encode_final(struct base64_encode_ctx *ctx, char *dst); /* Lower level functions */ /* Encodes a string in one go, including any padding at the end. * Generates exactly BASE64_ENCODE_RAW_LENGTH(length) bytes of output. * Supports overlapped operation, if src <= dst. FIXME: Use of overlap * is deprecated, if needed there should be a separate public fucntion * to do that.*/ void base64_encode_raw(char *dst, size_t length, const uint8_t *src); void base64_encode_group(char *dst, uint32_t group); /* Base64 decoding */ /* Maximum length of output for base64_decode_update. */ /* We have at most 6 buffered bits, and a total of (length + 1) * 6 bits. */ #define BASE64_DECODE_LENGTH(length) ((((length) + 1) * 6) / 8) struct base64_decode_ctx { const signed char *table; /* Decoding table */ unsigned short word; /* Leftover bits */ unsigned char bits; /* Number buffered bits */ /* Number of padding characters encountered */ unsigned char padding; }; /* Initialize decoding context for base-64 */ void base64_decode_init(struct base64_decode_ctx *ctx); /* Initialize encoding context for URL safe alphabet, RFC 4648. */ void base64url_decode_init(struct base64_decode_ctx *ctx); /* Decodes a single byte. Returns amount of output (0 or 1), or -1 on * errors. */ int base64_decode_single(struct base64_decode_ctx *ctx, uint8_t *dst, char src); /* Returns 1 on success, 0 on error. DST should point to an area of * size at least BASE64_DECODE_LENGTH(length). The amount of data * generated is returned in *DST_LENGTH. */ int base64_decode_update(struct base64_decode_ctx *ctx, size_t *dst_length, uint8_t *dst, size_t src_length, const char *src); /* Returns 1 on success. */ int base64_decode_final(struct base64_decode_ctx *ctx); #ifdef __cplusplus } #endif #endif /* NETTLE_BASE64_H_INCLUDED */
5,342
C++
.h
132
37.69697
76
0.74158
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,378
base16.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/base16.h
/* base16.h Hex encoding and decoding, following spki conventions (i.e. allowing whitespace between digits). Copyright (C) 2002 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_BASE16_H_INCLUDED #define NETTLE_BASE16_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define base16_encode_single nettle_base16_encode_single #define base16_encode_update nettle_base16_encode_update #define base16_decode_init nettle_base16_decode_init #define base16_decode_single nettle_base16_decode_single #define base16_decode_update nettle_base16_decode_update #define base16_decode_final nettle_base16_decode_final /* Base16 encoding */ /* Maximum length of output for base16_encode_update. */ #define BASE16_ENCODE_LENGTH(length) ((length) * 2) /* Encodes a single byte. Always stores two digits in dst[0] and dst[1]. */ void base16_encode_single(char *dst, uint8_t src); /* Always stores BASE16_ENCODE_LENGTH(length) digits in dst. */ void base16_encode_update(char *dst, size_t length, const uint8_t *src); /* Base16 decoding */ /* Maximum length of output for base16_decode_update. */ /* We have at most 4 buffered bits, and a total of (length + 1) * 4 bits. */ #define BASE16_DECODE_LENGTH(length) (((length) + 1) / 2) struct base16_decode_ctx { unsigned char word; /* Leftover bits */ unsigned char bits; /* Number buffered bits */ }; void base16_decode_init(struct base16_decode_ctx *ctx); /* Decodes a single byte. Returns amount of output (0 or 1), or -1 on * errors. */ int base16_decode_single(struct base16_decode_ctx *ctx, uint8_t *dst, char src); /* Returns 1 on success, 0 on error. DST should point to an area of * size at least BASE16_DECODE_LENGTH(length). The amount of data * generated is returned in *DST_LENGTH. */ int base16_decode_update(struct base16_decode_ctx *ctx, size_t *dst_length, uint8_t *dst, size_t src_length, const char *src); /* Returns 1 on success. */ int base16_decode_final(struct base16_decode_ctx *ctx); #ifdef __cplusplus } #endif #endif /* NETTLE_BASE16_H_INCLUDED */
3,097
C++
.h
81
34.938272
76
0.737177
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,379
blowfish.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/blowfish.h
/* blowfish.h Blowfish block cipher. Copyright (C) 2014 Niels Möller Copyright (C) 1998, 2001 FSF, Ray Dassen, Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_BLOWFISH_H_INCLUDED #define NETTLE_BLOWFISH_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define blowfish_set_key nettle_blowfish_set_key #define blowfish128_set_key nettle_blowfish128_set_key #define blowfish_encrypt nettle_blowfish_encrypt #define blowfish_decrypt nettle_blowfish_decrypt #define blowfish_bcrypt_hash nettle_blowfish_bcrypt_hash #define blowfish_bcrypt_verify nettle_blowfish_bcrypt_verify #define BLOWFISH_BLOCK_SIZE 8 /* Variable key size between 64 and 448 bits. */ #define BLOWFISH_MIN_KEY_SIZE 8 #define BLOWFISH_MAX_KEY_SIZE 56 /* Default to 128 bits */ #define BLOWFISH_KEY_SIZE 16 #define BLOWFISH128_KEY_SIZE 16 #define _BLOWFISH_ROUNDS 16 #define BLOWFISH_BCRYPT_HASH_SIZE (60 + 1) /* Including null-terminator */ #define BLOWFISH_BCRYPT_BINSALT_SIZE 16 /* Binary string size */ struct blowfish_ctx { uint32_t s[4][256]; uint32_t p[_BLOWFISH_ROUNDS+2]; }; /* Returns 0 for weak keys, otherwise 1. */ int blowfish_set_key(struct blowfish_ctx *ctx, size_t length, const uint8_t *key); int blowfish128_set_key(struct blowfish_ctx *ctx, const uint8_t *key); void blowfish_encrypt(const struct blowfish_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void blowfish_decrypt(const struct blowfish_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); /* dst parameter must point to a buffer of minimally * BLOWFISH_BCRYPT_HASH_SIZE bytes */ int blowfish_bcrypt_hash(uint8_t *dst, size_t lenkey, const uint8_t *key, size_t lenscheme, const uint8_t *scheme, int log2rounds, const uint8_t *salt); int blowfish_bcrypt_verify(size_t lenkey, const uint8_t *key, size_t lenhashed, const uint8_t *hashed); #ifdef __cplusplus } #endif #endif /* NETTLE_BLOWFISH_H_INCLUDED */
3,063
C++
.h
80
33.775
74
0.723426
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,380
bignum.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/bignum.h
/* bignum.h Bignum operations that are missing from gmp. Copyright (C) 2001 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_BIGNUM_H_INCLUDED #define NETTLE_BIGNUM_H_INCLUDED #include "nettle-types.h" /* For NETTLE_USE_MINI_GMP */ #include "version.h" #if NETTLE_USE_MINI_GMP # include "mini-gmp.h" # define GMP_NUMB_MASK (~(mp_limb_t) 0) /* Side-channel silent powm not available in mini-gmp. */ # define mpz_powm_sec mpz_powm #else # include <gmp.h> #endif #ifdef __cplusplus extern "C" { #endif /* Size needed for signed encoding, including extra sign byte if * necessary. */ size_t nettle_mpz_sizeinbase_256_s(const mpz_t x); /* Size needed for unsigned encoding */ size_t nettle_mpz_sizeinbase_256_u(const mpz_t x); /* Writes an integer as length octets, using big endian byte order, * and two's complement for negative numbers. */ void nettle_mpz_get_str_256(size_t length, uint8_t *s, const mpz_t x); /* Reads a big endian, two's complement, integer. */ void nettle_mpz_set_str_256_s(mpz_t x, size_t length, const uint8_t *s); void nettle_mpz_init_set_str_256_s(mpz_t x, size_t length, const uint8_t *s); /* Similar, but for unsigned format. These function don't interpret * the most significant bit as the sign. */ void nettle_mpz_set_str_256_u(mpz_t x, size_t length, const uint8_t *s); void nettle_mpz_init_set_str_256_u(mpz_t x, size_t length, const uint8_t *s); /* Returns a uniformly distributed random number 0 <= x < 2^n */ void nettle_mpz_random_size(mpz_t x, void *ctx, nettle_random_func *random, unsigned bits); /* Returns a number x, almost uniformly random in the range * 0 <= x < n. */ void nettle_mpz_random(mpz_t x, void *ctx, nettle_random_func *random, const mpz_t n); void nettle_random_prime(mpz_t p, unsigned bits, int top_bits_set, void *ctx, nettle_random_func *random, void *progress_ctx, nettle_progress_func *progress); /* sexp parsing */ struct sexp_iterator; /* If LIMIT is non-zero, the number must be at most LIMIT bits. * Implies sexp_iterator_next. */ int nettle_mpz_set_sexp(mpz_t x, unsigned limit, struct sexp_iterator *i); /* der parsing */ struct asn1_der_iterator; int nettle_asn1_der_get_bignum(struct asn1_der_iterator *iterator, mpz_t x, unsigned max_bits); #ifdef __cplusplus } #endif #endif /* NETTLE_BIGNUM_H_INCLUDED */
3,331
C++
.h
94
32.37234
72
0.727102
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,381
sm3.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/sm3.h
/* sm3.h The SM3 hash function. Copyright (C) 2017 Jia Zhang Copyright (C) 2021 Tianjia Zhang <tianjia.zhang@linux.alibaba.com> This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_SM3_H_INCLUDED #define NETTLE_SM3_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define sm3_init nettle_sm3_init #define sm3_update nettle_sm3_update #define sm3_digest nettle_sm3_digest #define SM3_DIGEST_SIZE 32 #define SM3_BLOCK_SIZE 64 /* Digest is kept internally as 8 32-bit words. */ #define _SM3_DIGEST_LENGTH 8 struct sm3_ctx { uint32_t state[_SM3_DIGEST_LENGTH]; uint64_t count; /* Block count */ unsigned index; /* Into buffer */ uint8_t block[SM3_BLOCK_SIZE]; /* Block buffer */ }; void sm3_init(struct sm3_ctx *ctx); void sm3_update(struct sm3_ctx *ctx, size_t length, const uint8_t *data); void sm3_digest(struct sm3_ctx *ctx, size_t length, uint8_t *digest); #ifdef __cplusplus } #endif #endif /* NETTLE_SM3_H_INCLUDED */
1,970
C++
.h
58
30.741379
72
0.727513
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,382
pss-mgf1.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/pss-mgf1.h
/* pss-mgf1.h PKCS#1 mask generation function 1, used in RSA-PSS (RFC-3447). Copyright (C) 2017 Daiki Ueno This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_PSS_MGF1_H_INCLUDED #define NETTLE_PSS_MGF1_H_INCLUDED #include "nettle-meta.h" #include "sha1.h" #include "sha2.h" #ifdef __cplusplus extern "C" { #endif /* Namespace mangling */ #define pss_mgf1 nettle_pss_mgf1 void pss_mgf1(const void *seed, const struct nettle_hash *hash, size_t length, uint8_t *mask); #ifdef __cplusplus } #endif #endif /* NETTLE_PSS_MGF1_H_INCLUDED */
1,481
C++
.h
40
33.525
72
0.744202
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,383
gcm.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/gcm.h
/* gcm.h Galois counter mode, specified by NIST, http://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf Copyright (C) 2011 Katholieke Universiteit Leuven Copyright (C) 2011, 2014 Niels Möller Contributed by Nikos Mavrogiannopoulos This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_GCM_H_INCLUDED #define NETTLE_GCM_H_INCLUDED #include "aes.h" #include "camellia.h" #include "sm4.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define gcm_set_key nettle_gcm_set_key #define gcm_set_iv nettle_gcm_set_iv #define gcm_update nettle_gcm_update #define gcm_encrypt nettle_gcm_encrypt #define gcm_decrypt nettle_gcm_decrypt #define gcm_digest nettle_gcm_digest #define gcm_aes128_set_key nettle_gcm_aes128_set_key #define gcm_aes128_set_iv nettle_gcm_aes128_set_iv #define gcm_aes128_update nettle_gcm_aes128_update #define gcm_aes128_encrypt nettle_gcm_aes128_encrypt #define gcm_aes128_decrypt nettle_gcm_aes128_decrypt #define gcm_aes128_digest nettle_gcm_aes128_digest #define gcm_aes192_set_key nettle_gcm_aes192_set_key #define gcm_aes192_set_iv nettle_gcm_aes192_set_iv #define gcm_aes192_update nettle_gcm_aes192_update #define gcm_aes192_encrypt nettle_gcm_aes192_encrypt #define gcm_aes192_decrypt nettle_gcm_aes192_decrypt #define gcm_aes192_digest nettle_gcm_aes192_digest #define gcm_aes256_set_key nettle_gcm_aes256_set_key #define gcm_aes256_set_iv nettle_gcm_aes256_set_iv #define gcm_aes256_update nettle_gcm_aes256_update #define gcm_aes256_encrypt nettle_gcm_aes256_encrypt #define gcm_aes256_decrypt nettle_gcm_aes256_decrypt #define gcm_aes256_digest nettle_gcm_aes256_digest #define gcm_aes_set_key nettle_gcm_aes_set_key #define gcm_aes_set_iv nettle_gcm_aes_set_iv #define gcm_aes_update nettle_gcm_aes_update #define gcm_aes_encrypt nettle_gcm_aes_encrypt #define gcm_aes_decrypt nettle_gcm_aes_decrypt #define gcm_aes_digest nettle_gcm_aes_digest #define gcm_camellia128_set_key nettle_gcm_camellia128_set_key #define gcm_camellia128_set_iv nettle_gcm_camellia128_set_iv #define gcm_camellia128_update nettle_gcm_camellia128_update #define gcm_camellia128_encrypt nettle_gcm_camellia128_encrypt #define gcm_camellia128_decrypt nettle_gcm_camellia128_decrypt #define gcm_camellia128_digest nettle_gcm_camellia128_digest #define gcm_camellia256_set_key nettle_gcm_camellia256_set_key #define gcm_camellia256_set_iv nettle_gcm_camellia256_set_iv #define gcm_camellia256_update nettle_gcm_camellia256_update #define gcm_camellia256_encrypt nettle_gcm_camellia256_encrypt #define gcm_camellia256_decrypt nettle_gcm_camellia256_decrypt #define gcm_camellia256_digest nettle_gcm_camellia256_digest #define gcm_sm4_set_key nettle_gcm_sm4_set_key #define gcm_sm4_set_iv nettle_gcm_sm4_set_iv #define gcm_sm4_update nettle_gcm_sm4_update #define gcm_sm4_encrypt nettle_gcm_sm4_encrypt #define gcm_sm4_decrypt nettle_gcm_sm4_decrypt #define gcm_sm4_digest nettle_gcm_sm4_digest #define GCM_BLOCK_SIZE 16 #define GCM_IV_SIZE (GCM_BLOCK_SIZE - 4) #define GCM_DIGEST_SIZE 16 #define GCM_TABLE_BITS 8 /* Hashing subkey */ struct gcm_key { union nettle_block16 h[1 << GCM_TABLE_BITS]; }; /* Per-message state, depending on the iv */ struct gcm_ctx { /* Original counter block */ union nettle_block16 iv; /* Updated for each block. */ union nettle_block16 ctr; /* Hashing state */ union nettle_block16 x; uint64_t auth_size; uint64_t data_size; }; void gcm_set_key(struct gcm_key *key, const void *cipher, nettle_cipher_func *f); void gcm_set_iv(struct gcm_ctx *ctx, const struct gcm_key *key, size_t length, const uint8_t *iv); void gcm_update(struct gcm_ctx *ctx, const struct gcm_key *key, size_t length, const uint8_t *data); void gcm_encrypt(struct gcm_ctx *ctx, const struct gcm_key *key, const void *cipher, nettle_cipher_func *f, size_t length, uint8_t *dst, const uint8_t *src); void gcm_decrypt(struct gcm_ctx *ctx, const struct gcm_key *key, const void *cipher, nettle_cipher_func *f, size_t length, uint8_t *dst, const uint8_t *src); void gcm_digest(struct gcm_ctx *ctx, const struct gcm_key *key, const void *cipher, nettle_cipher_func *f, size_t length, uint8_t *digest); /* Convenience macrology (not sure how useful it is) */ /* All-in-one context, with hash subkey, message state, and cipher. */ #define GCM_CTX(type) \ { struct gcm_key key; struct gcm_ctx gcm; type cipher; } /* NOTE: Avoid using NULL, as we don't include anything defining it. */ #define GCM_SET_KEY(ctx, set_key, encrypt, gcm_key) \ do { \ (set_key)(&(ctx)->cipher, (gcm_key)); \ if (0) (encrypt)(&(ctx)->cipher, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0); \ gcm_set_key(&(ctx)->key, &(ctx)->cipher, \ (nettle_cipher_func *) (encrypt)); \ } while (0) #define GCM_SET_IV(ctx, length, data) \ gcm_set_iv(&(ctx)->gcm, &(ctx)->key, (length), (data)) #define GCM_UPDATE(ctx, length, data) \ gcm_update(&(ctx)->gcm, &(ctx)->key, (length), (data)) #define GCM_ENCRYPT(ctx, encrypt, length, dst, src) \ (0 ? (encrypt)(&(ctx)->cipher, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0) \ : gcm_encrypt(&(ctx)->gcm, &(ctx)->key, &(ctx)->cipher, \ (nettle_cipher_func *) (encrypt), \ (length), (dst), (src))) #define GCM_DECRYPT(ctx, encrypt, length, dst, src) \ (0 ? (encrypt)(&(ctx)->cipher, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0) \ : gcm_decrypt(&(ctx)->gcm, &(ctx)->key, &(ctx)->cipher, \ (nettle_cipher_func *) (encrypt), \ (length), (dst), (src))) #define GCM_DIGEST(ctx, encrypt, length, digest) \ (0 ? (encrypt)(&(ctx)->cipher, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0) \ : gcm_digest(&(ctx)->gcm, &(ctx)->key, &(ctx)->cipher, \ (nettle_cipher_func *) (encrypt), \ (length), (digest))) struct gcm_aes128_ctx GCM_CTX(struct aes128_ctx); void gcm_aes128_set_key(struct gcm_aes128_ctx *ctx, const uint8_t *key); /* FIXME: Define _update and _set_iv as some kind of aliaes, there's nothing aes-specific. */ void gcm_aes128_update (struct gcm_aes128_ctx *ctx, size_t length, const uint8_t *data); void gcm_aes128_set_iv (struct gcm_aes128_ctx *ctx, size_t length, const uint8_t *iv); void gcm_aes128_encrypt(struct gcm_aes128_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void gcm_aes128_decrypt(struct gcm_aes128_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void gcm_aes128_digest(struct gcm_aes128_ctx *ctx, size_t length, uint8_t *digest); struct gcm_aes192_ctx GCM_CTX(struct aes192_ctx); void gcm_aes192_set_key(struct gcm_aes192_ctx *ctx, const uint8_t *key); void gcm_aes192_update (struct gcm_aes192_ctx *ctx, size_t length, const uint8_t *data); void gcm_aes192_set_iv (struct gcm_aes192_ctx *ctx, size_t length, const uint8_t *iv); void gcm_aes192_encrypt(struct gcm_aes192_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void gcm_aes192_decrypt(struct gcm_aes192_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void gcm_aes192_digest(struct gcm_aes192_ctx *ctx, size_t length, uint8_t *digest); struct gcm_aes256_ctx GCM_CTX(struct aes256_ctx); void gcm_aes256_set_key(struct gcm_aes256_ctx *ctx, const uint8_t *key); void gcm_aes256_update (struct gcm_aes256_ctx *ctx, size_t length, const uint8_t *data); void gcm_aes256_set_iv (struct gcm_aes256_ctx *ctx, size_t length, const uint8_t *iv); void gcm_aes256_encrypt(struct gcm_aes256_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void gcm_aes256_decrypt(struct gcm_aes256_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void gcm_aes256_digest(struct gcm_aes256_ctx *ctx, size_t length, uint8_t *digest); /* Old deprecated aes interface, for backwards compatibility */ struct gcm_aes_ctx GCM_CTX(struct aes_ctx); void gcm_aes_set_key(struct gcm_aes_ctx *ctx, size_t length, const uint8_t *key) _NETTLE_ATTRIBUTE_DEPRECATED; void gcm_aes_set_iv(struct gcm_aes_ctx *ctx, size_t length, const uint8_t *iv) _NETTLE_ATTRIBUTE_DEPRECATED; void gcm_aes_update(struct gcm_aes_ctx *ctx, size_t length, const uint8_t *data) _NETTLE_ATTRIBUTE_DEPRECATED; void gcm_aes_encrypt(struct gcm_aes_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src) _NETTLE_ATTRIBUTE_DEPRECATED; void gcm_aes_decrypt(struct gcm_aes_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src) _NETTLE_ATTRIBUTE_DEPRECATED; void gcm_aes_digest(struct gcm_aes_ctx *ctx, size_t length, uint8_t *digest) _NETTLE_ATTRIBUTE_DEPRECATED; struct gcm_camellia128_ctx GCM_CTX(struct camellia128_ctx); void gcm_camellia128_set_key(struct gcm_camellia128_ctx *ctx, const uint8_t *key); void gcm_camellia128_set_iv(struct gcm_camellia128_ctx *ctx, size_t length, const uint8_t *iv); void gcm_camellia128_update(struct gcm_camellia128_ctx *ctx, size_t length, const uint8_t *data); void gcm_camellia128_encrypt(struct gcm_camellia128_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void gcm_camellia128_decrypt(struct gcm_camellia128_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void gcm_camellia128_digest(struct gcm_camellia128_ctx *ctx, size_t length, uint8_t *digest); struct gcm_camellia256_ctx GCM_CTX(struct camellia256_ctx); void gcm_camellia256_set_key(struct gcm_camellia256_ctx *ctx, const uint8_t *key); void gcm_camellia256_set_iv(struct gcm_camellia256_ctx *ctx, size_t length, const uint8_t *iv); void gcm_camellia256_update(struct gcm_camellia256_ctx *ctx, size_t length, const uint8_t *data); void gcm_camellia256_encrypt(struct gcm_camellia256_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void gcm_camellia256_decrypt(struct gcm_camellia256_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void gcm_camellia256_digest(struct gcm_camellia256_ctx *ctx, size_t length, uint8_t *digest); struct gcm_sm4_ctx GCM_CTX(struct sm4_ctx); void gcm_sm4_set_key(struct gcm_sm4_ctx *ctx, const uint8_t *key); void gcm_sm4_set_iv(struct gcm_sm4_ctx *ctx, size_t length, const uint8_t *iv); void gcm_sm4_update(struct gcm_sm4_ctx *ctx, size_t length, const uint8_t *data); void gcm_sm4_encrypt(struct gcm_sm4_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void gcm_sm4_decrypt(struct gcm_sm4_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void gcm_sm4_digest(struct gcm_sm4_ctx *ctx, size_t length, uint8_t *digest); #ifdef __cplusplus } #endif #endif /* NETTLE_GCM_H_INCLUDED */
11,630
C++
.h
278
38.902878
73
0.72874
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,384
macros.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/macros.h
/* macros.h Copyright (C) 2001, 2010 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_MACROS_H_INCLUDED #define NETTLE_MACROS_H_INCLUDED /* Reads a 64-bit integer, in network, big-endian, byte order */ #define READ_UINT64(p) \ ( (((uint64_t) (p)[0]) << 56) \ | (((uint64_t) (p)[1]) << 48) \ | (((uint64_t) (p)[2]) << 40) \ | (((uint64_t) (p)[3]) << 32) \ | (((uint64_t) (p)[4]) << 24) \ | (((uint64_t) (p)[5]) << 16) \ | (((uint64_t) (p)[6]) << 8) \ | ((uint64_t) (p)[7])) #define WRITE_UINT64(p, i) \ do { \ (p)[0] = ((i) >> 56) & 0xff; \ (p)[1] = ((i) >> 48) & 0xff; \ (p)[2] = ((i) >> 40) & 0xff; \ (p)[3] = ((i) >> 32) & 0xff; \ (p)[4] = ((i) >> 24) & 0xff; \ (p)[5] = ((i) >> 16) & 0xff; \ (p)[6] = ((i) >> 8) & 0xff; \ (p)[7] = (i) & 0xff; \ } while(0) /* Reads a 32-bit integer, in network, big-endian, byte order */ #define READ_UINT32(p) \ ( (((uint32_t) (p)[0]) << 24) \ | (((uint32_t) (p)[1]) << 16) \ | (((uint32_t) (p)[2]) << 8) \ | ((uint32_t) (p)[3])) #define WRITE_UINT32(p, i) \ do { \ (p)[0] = ((i) >> 24) & 0xff; \ (p)[1] = ((i) >> 16) & 0xff; \ (p)[2] = ((i) >> 8) & 0xff; \ (p)[3] = (i) & 0xff; \ } while(0) /* Analogous macros, for 24 and 16 bit numbers */ #define READ_UINT24(p) \ ( (((uint32_t) (p)[0]) << 16) \ | (((uint32_t) (p)[1]) << 8) \ | ((uint32_t) (p)[2])) #define WRITE_UINT24(p, i) \ do { \ (p)[0] = ((i) >> 16) & 0xff; \ (p)[1] = ((i) >> 8) & 0xff; \ (p)[2] = (i) & 0xff; \ } while(0) #define READ_UINT16(p) \ ( (((uint32_t) (p)[0]) << 8) \ | ((uint32_t) (p)[1])) #define WRITE_UINT16(p, i) \ do { \ (p)[0] = ((i) >> 8) & 0xff; \ (p)[1] = (i) & 0xff; \ } while(0) /* And the other, little-endian, byteorder */ #define LE_READ_UINT64(p) \ ( (((uint64_t) (p)[7]) << 56) \ | (((uint64_t) (p)[6]) << 48) \ | (((uint64_t) (p)[5]) << 40) \ | (((uint64_t) (p)[4]) << 32) \ | (((uint64_t) (p)[3]) << 24) \ | (((uint64_t) (p)[2]) << 16) \ | (((uint64_t) (p)[1]) << 8) \ | ((uint64_t) (p)[0])) #define LE_WRITE_UINT64(p, i) \ do { \ (p)[7] = ((i) >> 56) & 0xff; \ (p)[6] = ((i) >> 48) & 0xff; \ (p)[5] = ((i) >> 40) & 0xff; \ (p)[4] = ((i) >> 32) & 0xff; \ (p)[3] = ((i) >> 24) & 0xff; \ (p)[2] = ((i) >> 16) & 0xff; \ (p)[1] = ((i) >> 8) & 0xff; \ (p)[0] = (i) & 0xff; \ } while (0) #define LE_READ_UINT32(p) \ ( (((uint32_t) (p)[3]) << 24) \ | (((uint32_t) (p)[2]) << 16) \ | (((uint32_t) (p)[1]) << 8) \ | ((uint32_t) (p)[0])) #define LE_WRITE_UINT32(p, i) \ do { \ (p)[3] = ((i) >> 24) & 0xff; \ (p)[2] = ((i) >> 16) & 0xff; \ (p)[1] = ((i) >> 8) & 0xff; \ (p)[0] = (i) & 0xff; \ } while(0) /* Analogous macros, for 16 bit numbers */ #define LE_READ_UINT16(p) \ ( (((uint32_t) (p)[1]) << 8) \ | ((uint32_t) (p)[0])) #define LE_WRITE_UINT16(p, i) \ do { \ (p)[1] = ((i) >> 8) & 0xff; \ (p)[0] = (i) & 0xff; \ } while(0) /* Macro to make it easier to loop over several blocks. */ #define FOR_BLOCKS(length, dst, src, blocksize) \ assert( !((length) % (blocksize))); \ for (; (length); ((length) -= (blocksize), \ (dst) += (blocksize), \ (src) += (blocksize)) ) /* The masking of the right shift is needed to allow n == 0 (using just 32 - n and 64 - n results in undefined behaviour). Most uses of these macros use a constant and non-zero rotation count. */ #define ROTL32(n,x) (((x)<<(n)) | ((x)>>((-(n)&31)))) #define ROTL64(n,x) (((x)<<(n)) | ((x)>>((-(n))&63))) /* Requires that size > 0 */ #define INCREMENT(size, ctr) \ do { \ unsigned increment_i = (size) - 1; \ if (++(ctr)[increment_i] == 0) \ while (increment_i > 0 \ && ++(ctr)[--increment_i] == 0 ) \ ; \ } while (0) /* Helper macro for Merkle-Damgård hash functions. Assumes the context structs includes the following fields: uint8_t block[...]; // Buffer holding one block unsigned int index; // Index into block */ /* Currently used by sha512 (and sha384) only. */ #define MD_INCR(ctx) ((ctx)->count_high += !++(ctx)->count_low) /* Takes the compression function f as argument. NOTE: also clobbers length and data. */ #define MD_UPDATE(ctx, length, data, f, incr) \ do { \ if ((ctx)->index) \ { \ /* Try to fill partial block */ \ unsigned __md_left = sizeof((ctx)->block) - (ctx)->index; \ if ((length) < __md_left) \ { \ memcpy((ctx)->block + (ctx)->index, (data), (length)); \ (ctx)->index += (length); \ goto __md_done; /* Finished */ \ } \ else \ { \ memcpy((ctx)->block + (ctx)->index, (data), __md_left); \ \ f((ctx), (ctx)->block); \ (incr); \ \ (data) += __md_left; \ (length) -= __md_left; \ } \ } \ while ((length) >= sizeof((ctx)->block)) \ { \ f((ctx), (data)); \ (incr); \ \ (data) += sizeof((ctx)->block); \ (length) -= sizeof((ctx)->block); \ } \ memcpy ((ctx)->block, (data), (length)); \ (ctx)->index = (length); \ __md_done: \ ; \ } while (0) /* Pads the block to a block boundary with the bit pattern 1 0*, leaving size octets for the length field at the end. If needed, compresses the block and starts a new one. */ #define MD_PAD(ctx, size, f) \ do { \ unsigned __md_i; \ __md_i = (ctx)->index; \ \ /* Set the first char of padding to 0x80. This is safe since there \ is always at least one byte free */ \ \ assert(__md_i < sizeof((ctx)->block)); \ (ctx)->block[__md_i++] = 0x80; \ \ if (__md_i > (sizeof((ctx)->block) - (size))) \ { /* No room for length in this block. Process it and \ pad with another one */ \ memset((ctx)->block + __md_i, 0, sizeof((ctx)->block) - __md_i); \ \ f((ctx), (ctx)->block); \ __md_i = 0; \ } \ memset((ctx)->block + __md_i, 0, \ sizeof((ctx)->block) - (size) - __md_i); \ \ } while (0) #endif /* NETTLE_MACROS_H_INCLUDED */
7,309
C++
.h
210
31.314286
72
0.492212
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,385
sexp.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/sexp.h
/* sexp.h Parsing s-expressions. Copyright (C) 2002 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_SEXP_H_INCLUDED #define NETTLE_SEXP_H_INCLUDED #include <stdarg.h> #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define sexp_iterator_first nettle_sexp_iterator_first #define sexp_transport_iterator_first nettle_sexp_transport_iterator_first #define sexp_iterator_next nettle_sexp_iterator_next #define sexp_iterator_enter_list nettle_sexp_iterator_enter_list #define sexp_iterator_exit_list nettle_sexp_iterator_exit_list #define sexp_iterator_subexpr nettle_sexp_iterator_subexpr #define sexp_iterator_get_uint32 nettle_sexp_iterator_get_uint32 #define sexp_iterator_check_type nettle_sexp_iterator_check_type #define sexp_iterator_check_types nettle_sexp_iterator_check_types #define sexp_iterator_assoc nettle_sexp_iterator_assoc #define sexp_format nettle_sexp_format #define sexp_vformat nettle_sexp_vformat #define sexp_transport_format nettle_sexp_transport_format #define sexp_transport_vformat nettle_sexp_transport_vformat #define sexp_token_chars nettle_sexp_token_chars enum sexp_type { SEXP_ATOM, SEXP_LIST, SEXP_END }; struct sexp_iterator { size_t length; const uint8_t *buffer; /* Points at the start of the current sub expression. */ size_t start; /* If type is SEXP_LIST, pos points at the start of the current * element. Otherwise, it points at the end. */ size_t pos; unsigned level; enum sexp_type type; size_t display_length; const uint8_t *display; size_t atom_length; const uint8_t *atom; }; /* All these functions return 1 on success, 0 on failure */ /* Initializes the iterator. */ int sexp_iterator_first(struct sexp_iterator *iterator, size_t length, const uint8_t *input); /* NOTE: Decodes the input string in place */ int sexp_transport_iterator_first(struct sexp_iterator *iterator, size_t length, uint8_t *input); int sexp_iterator_next(struct sexp_iterator *iterator); /* Current element must be a list. */ int sexp_iterator_enter_list(struct sexp_iterator *iterator); /* Skips the rest of the current list */ int sexp_iterator_exit_list(struct sexp_iterator *iterator); #if 0 /* Skips out of as many lists as necessary to get back to the given * level. */ int sexp_iterator_exit_lists(struct sexp_iterator *iterator, unsigned level); #endif /* Gets start and length of the current subexpression. Implies * sexp_iterator_next. */ const uint8_t * sexp_iterator_subexpr(struct sexp_iterator *iterator, size_t *length); int sexp_iterator_get_uint32(struct sexp_iterator *iterator, uint32_t *x); /* Checks the type of the current expression, which should be a list * * (<type> ...) */ int sexp_iterator_check_type(struct sexp_iterator *iterator, const char *type); const char * sexp_iterator_check_types(struct sexp_iterator *iterator, unsigned ntypes, const char * const *types); /* Current element must be a list. Looks up element of type * * (key rest...) * * For a matching key, the corresponding iterator is initialized * pointing at the start of REST. * * On success, exits the current list. */ int sexp_iterator_assoc(struct sexp_iterator *iterator, unsigned nkeys, const char * const *keys, struct sexp_iterator *values); /* Output functions. What is a reasonable API for this? It seems * ugly to have to reimplement string streams. */ /* Declared for real in buffer.h */ struct nettle_buffer; /* Returns the number of output characters, or 0 on out of memory. If * buffer == NULL, just compute length. * * Format strings can contained matched parentheses, tokens ("foo" in * the format string is formatted as "3:foo"), whitespace (which * separates tokens but is otherwise ignored) and the following * formatting specifiers: * * %s String represented as size_t length, const uint8_t *data. * * %t Optional display type, represented as * size_t display_length, const uint8_t *display, * display == NULL means no display type. * * %i Non-negative small integer, uint32_t. * * %b Non-negative bignum, mpz_t. * * %l Literal string (no length added), typically a balanced * subexpression. Represented as size_t length, const uint8_t * *data. * * %(, %) Allows insertion of unbalanced parenthesis. * * Modifiers: * * %0 For %s, %t and %l, says that there's no length argument, * instead the string is NUL-terminated, and there's only one * const uint8_t * argument. */ size_t sexp_format(struct nettle_buffer *buffer, const char *format, ...); size_t sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args); size_t sexp_transport_format(struct nettle_buffer *buffer, const char *format, ...); size_t sexp_transport_vformat(struct nettle_buffer *buffer, const char *format, va_list args); #ifdef __cplusplus } #endif #endif /* NETTLE_SEXP_H_INCLUDED */
5,974
C++
.h
170
32.423529
74
0.740747
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,386
buffer.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/buffer.h
/* buffer.h A bare-bones string stream. Copyright (C) 2002 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_BUFFER_H_INCLUDED #define NETTLE_BUFFER_H_INCLUDED #include "realloc.h" #ifdef __cplusplus extern "C" { #endif struct nettle_buffer { uint8_t *contents; /* Allocated size */ size_t alloc; void *realloc_ctx; nettle_realloc_func *realloc; /* Current size */ size_t size; }; /* Initializes a buffer that uses plain realloc */ void nettle_buffer_init(struct nettle_buffer *buffer); void nettle_buffer_init_realloc(struct nettle_buffer *buffer, void *realloc_ctx, nettle_realloc_func *realloc); /* Initializes a buffer of fix size */ void nettle_buffer_init_size(struct nettle_buffer *buffer, size_t length, uint8_t *space); void nettle_buffer_clear(struct nettle_buffer *buffer); /* Resets the buffer, without freeing the buffer space. */ void nettle_buffer_reset(struct nettle_buffer *buffer); int nettle_buffer_grow(struct nettle_buffer *buffer, size_t length); #define NETTLE_BUFFER_PUTC(buffer, c) \ ( (((buffer)->size < (buffer)->alloc) || nettle_buffer_grow((buffer), 1)) \ && ((buffer)->contents[(buffer)->size++] = (c), 1) ) int nettle_buffer_write(struct nettle_buffer *buffer, size_t length, const uint8_t *data); /* Like nettle_buffer_write, but instead of copying data to the * buffer, it returns a pointer to the area where the caller can copy * the data. The pointer is valid only until the next call that can * reallocate the buffer. */ uint8_t * nettle_buffer_space(struct nettle_buffer *buffer, size_t length); /* Copy the contents of SRC to the end of DST. */ int nettle_buffer_copy(struct nettle_buffer *dst, const struct nettle_buffer *src); #ifdef __cplusplus } #endif #endif /* NETTLE_BUFFER_H_INCLUDED */
2,760
C++
.h
78
32.269231
75
0.738032
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,387
hkdf.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/hkdf.h
/* hkdf.h TLS PRF code (RFC-5246, RFC-2246). Copyright (C) 2017 Red Hat, Inc. This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_HKDF_H_INCLUDED #define NETTLE_HKDF_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Namespace mangling */ #define hkdf_extract nettle_hkdf_extract #define hkdf_expand nettle_hkdf_expand void hkdf_extract(void *mac_ctx, nettle_hash_update_func *update, nettle_hash_digest_func *digest, size_t digest_size, size_t secret_size, const uint8_t *secret, uint8_t *dst); void hkdf_expand(void *mac_ctx, nettle_hash_update_func *update, nettle_hash_digest_func *digest, size_t digest_size, size_t info_size, const uint8_t *info, size_t length, uint8_t *dst); #ifdef __cplusplus } #endif #endif /* NETTLE_HKDF_H_INCLUDED */
1,774
C++
.h
49
32.081633
72
0.728178
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,388
salsa20.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/salsa20.h
/* salsa20.h The Salsa20 stream cipher. Copyright (C) 2012 Simon Josefsson Copyright (C) 2001 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_SALSA20_H_INCLUDED #define NETTLE_SALSA20_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define salsa20_set_key nettle_salsa20_set_key #define salsa20_128_set_key nettle_salsa20_128_set_key #define salsa20_256_set_key nettle_salsa20_256_set_key #define salsa20_set_nonce nettle_salsa20_set_nonce #define salsa20_crypt nettle_salsa20_crypt #define salsa20r12_crypt nettle_salsa20r12_crypt /* Alias for backwards compatibility */ #define salsa20_set_iv nettle_salsa20_set_nonce /* In octets.*/ #define SALSA20_128_KEY_SIZE 16 #define SALSA20_256_KEY_SIZE 32 #define SALSA20_BLOCK_SIZE 64 #define SALSA20_NONCE_SIZE 8 #define SALSA20_IV_SIZE SALSA20_NONCE_SIZE /* Aliases */ #define SALSA20_MIN_KEY_SIZE 16 #define SALSA20_MAX_KEY_SIZE 32 #define SALSA20_KEY_SIZE 32 #define _SALSA20_INPUT_LENGTH 16 struct salsa20_ctx { /* Indices 1-4 and 11-14 holds the key (two identical copies for the shorter key size), indices 0, 5, 10, 15 are constant, indices 6, 7 are the IV, and indices 8, 9 are the block counter: C K K K K C I I B B C K K K K C */ uint32_t input[_SALSA20_INPUT_LENGTH]; }; void salsa20_128_set_key(struct salsa20_ctx *ctx, const uint8_t *key); void salsa20_256_set_key(struct salsa20_ctx *ctx, const uint8_t *key); void salsa20_set_key(struct salsa20_ctx *ctx, size_t length, const uint8_t *key); void salsa20_set_nonce(struct salsa20_ctx *ctx, const uint8_t *nonce); void salsa20_crypt(struct salsa20_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void salsa20r12_crypt(struct salsa20_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); #ifdef __cplusplus } #endif #endif /* NETTLE_SALSA20_H_INCLUDED */
2,863
C++
.h
82
31.829268
72
0.748819
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,389
arcfour.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/arcfour.h
/* arcfour.h The arcfour/rc4 stream cipher. Copyright (C) 2001, 2014 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_ARCFOUR_H_INCLUDED #define NETTLE_ARCFOUR_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define arcfour128_set_key nettle_arcfour128_set_key #define arcfour_set_key nettle_arcfour_set_key #define arcfour_crypt nettle_arcfour_crypt /* Minimum and maximum keysizes, and a reasonable default. In * octets.*/ #define ARCFOUR_MIN_KEY_SIZE 1 #define ARCFOUR_MAX_KEY_SIZE 256 #define ARCFOUR_KEY_SIZE 16 #define ARCFOUR128_KEY_SIZE 16 struct arcfour_ctx { uint8_t S[256]; uint8_t i; uint8_t j; }; void arcfour_set_key(struct arcfour_ctx *ctx, size_t length, const uint8_t *key); void arcfour128_set_key(struct arcfour_ctx *ctx, const uint8_t *key); void arcfour_crypt(struct arcfour_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); #ifdef __cplusplus } #endif #endif /* NETTLE_ARCFOUR_H_INCLUDED */
1,960
C++
.h
57
31.175439
72
0.750532
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,390
poly1305.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/poly1305.h
/* poly1305.h Poly1305 message authentication code. Copyright (C) 2013 Nikos Mavrogiannopoulos Copyright (C) 2013, 2014 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_POLY1305_H_INCLUDED #define NETTLE_POLY1305_H_INCLUDED #include "aes.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define poly1305_aes_set_key nettle_poly1305_aes_set_key #define poly1305_aes_set_nonce nettle_poly1305_aes_set_nonce #define poly1305_aes_update nettle_poly1305_aes_update #define poly1305_aes_digest nettle_poly1305_aes_digest /* Low level functions/macros for the poly1305 construction. */ #define POLY1305_BLOCK_SIZE 16 struct poly1305_ctx { /* Key, 128-bit value and some cached multiples. */ union { uint32_t r32[6]; uint64_t r64[3]; } r; uint32_t s32[3]; /* State, represented as words of 26, 32 or 64 bits, depending on implementation. */ /* High bits first, to maintain alignment. */ uint32_t hh; union { uint32_t h32[4]; uint64_t h64[2]; } h; }; /* poly1305-aes */ #define POLY1305_AES_KEY_SIZE 32 #define POLY1305_AES_DIGEST_SIZE 16 #define POLY1305_AES_NONCE_SIZE 16 struct poly1305_aes_ctx { /* Keep aes context last, to make it possible to use a general poly1305_update if other variants are added. */ struct poly1305_ctx pctx; uint8_t block[POLY1305_BLOCK_SIZE]; unsigned index; uint8_t nonce[POLY1305_BLOCK_SIZE]; struct aes128_ctx aes; }; /* Also initialize the nonce to zero. */ void poly1305_aes_set_key (struct poly1305_aes_ctx *ctx, const uint8_t *key); /* Optional, if not used, messages get incrementing nonces starting from zero. */ void poly1305_aes_set_nonce (struct poly1305_aes_ctx *ctx, const uint8_t *nonce); /* Update is not aes-specific, but since this is the only implemented variant, we need no more general poly1305_update. */ void poly1305_aes_update (struct poly1305_aes_ctx *ctx, size_t length, const uint8_t *data); /* Also increments the nonce */ void poly1305_aes_digest (struct poly1305_aes_ctx *ctx, size_t length, uint8_t *digest); #ifdef __cplusplus } #endif #endif /* NETTLE_POLY1305_H_INCLUDED */
3,105
C++
.h
88
32.022727
87
0.739886
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,391
cbc.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/cbc.h
/* cbc.h Cipher block chaining mode. Copyright (C) 2001 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_CBC_H_INCLUDED #define NETTLE_CBC_H_INCLUDED #include "nettle-types.h" #include "aes.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define cbc_encrypt nettle_cbc_encrypt #define cbc_decrypt nettle_cbc_decrypt #define cbc_aes128_encrypt nettle_cbc_aes128_encrypt #define cbc_aes192_encrypt nettle_cbc_aes192_encrypt #define cbc_aes256_encrypt nettle_cbc_aes256_encrypt void cbc_encrypt(const void *ctx, nettle_cipher_func *f, size_t block_size, uint8_t *iv, size_t length, uint8_t *dst, const uint8_t *src); void cbc_decrypt(const void *ctx, nettle_cipher_func *f, size_t block_size, uint8_t *iv, size_t length, uint8_t *dst, const uint8_t *src); #define CBC_CTX(type, size) \ { type ctx; uint8_t iv[size]; } #define CBC_SET_IV(ctx, data) \ memcpy((ctx)->iv, (data), sizeof((ctx)->iv)) /* NOTE: Avoid using NULL, as we don't include anything defining it. */ #define CBC_ENCRYPT(self, f, length, dst, src) \ (0 ? ((f)(&(self)->ctx, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0)) \ : cbc_encrypt((void *) &(self)->ctx, \ (nettle_cipher_func *) (f), \ sizeof((self)->iv), (self)->iv, \ (length), (dst), (src))) #define CBC_DECRYPT(self, f, length, dst, src) \ (0 ? ((f)(&(self)->ctx, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0)) \ : cbc_decrypt((void *) &(self)->ctx, \ (nettle_cipher_func *) (f), \ sizeof((self)->iv), (self)->iv, \ (length), (dst), (src))) void cbc_aes128_encrypt(const struct aes128_ctx *ctx, uint8_t *iv, size_t length, uint8_t *dst, const uint8_t *src); void cbc_aes192_encrypt(const struct aes192_ctx *ctx, uint8_t *iv, size_t length, uint8_t *dst, const uint8_t *src); void cbc_aes256_encrypt(const struct aes256_ctx *ctx, uint8_t *iv, size_t length, uint8_t *dst, const uint8_t *src); #ifdef __cplusplus } #endif #endif /* NETTLE_CBC_H_INCLUDED */
2,965
C++
.h
77
35.064935
72
0.685994
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,392
ocb.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/ocb.h
/* ocb.h OCB AEAD mode, RFC 7253 Copyright (C) 2021 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_OCB_H_INCLUDED #define NETTLE_OCB_H_INCLUDED #include "nettle-types.h" #include "aes.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define ocb_set_key nettle_ocb_set_key #define ocb_set_nonce nettle_ocb_set_nonce #define ocb_update nettle_ocb_update #define ocb_encrypt nettle_ocb_encrypt #define ocb_decrypt nettle_ocb_decrypt #define ocb_digest nettle_ocb_digest #define ocb_encrypt_message nettle_ocb_encrypt_message #define ocb_decrypt_message nettle_ocb_decrypt_message #define ocb_aes128_set_encrypt_key nettle_ocb_aes128_set_encrypt_key #define ocb_aes128_set_decrypt_key nettle_ocb_aes128_set_decrypt_key #define ocb_aes128_set_nonce nettle_ocb_aes128_set_nonce #define ocb_aes128_update nettle_ocb_aes128_update #define ocb_aes128_encrypt nettle_ocb_aes128_encrypt #define ocb_aes128_decrypt nettle_ocb_aes128_decrypt #define ocb_aes128_digest nettle_ocb_aes128_digest #define ocb_aes128_encrypt_message nettle_ocb_aes128_encrypt_message #define ocb_aes128_decrypt_message nettle_ocb_aes128_decrypt_message #define OCB_BLOCK_SIZE 16 #define OCB_DIGEST_SIZE 16 #define OCB_MAX_NONCE_SIZE 15 struct ocb_key { /* L_*, L_$ and L_0, and one reserved entry */ union nettle_block16 L[4]; }; struct ocb_ctx { /* Initial offset, Offset_0 in the spec. */ union nettle_block16 initial; /* Offset, updated per block. */ union nettle_block16 offset; /* Authentication for the associated data */ union nettle_block16 sum; /* Authentication for the message */ union nettle_block16 checksum; /* Count of processed blocks. */ size_t data_count; size_t message_count; }; void ocb_set_key (struct ocb_key *key, const void *cipher, nettle_cipher_func *f); void ocb_set_nonce (struct ocb_ctx *ctx, const void *cipher, nettle_cipher_func *f, size_t tag_length, size_t nonce_length, const uint8_t *nonce); void ocb_update (struct ocb_ctx *ctx, const struct ocb_key *key, const void *cipher, nettle_cipher_func *f, size_t length, const uint8_t *data); void ocb_encrypt (struct ocb_ctx *ctx, const struct ocb_key *key, const void *cipher, nettle_cipher_func *f, size_t length, uint8_t *dst, const uint8_t *src); void ocb_decrypt (struct ocb_ctx *ctx, const struct ocb_key *key, const void *encrypt_ctx, nettle_cipher_func *encrypt, const void *decrypt_ctx, nettle_cipher_func *decrypt, size_t length, uint8_t *dst, const uint8_t *src); void ocb_digest (const struct ocb_ctx *ctx, const struct ocb_key *key, const void *cipher, nettle_cipher_func *f, size_t length, uint8_t *digest); void ocb_encrypt_message (const struct ocb_key *ocb_key, const void *cipher, nettle_cipher_func *f, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t tlength, size_t clength, uint8_t *dst, const uint8_t *src); int ocb_decrypt_message (const struct ocb_key *ocb_key, const void *encrypt_ctx, nettle_cipher_func *encrypt, const void *decrypt_ctx, nettle_cipher_func *decrypt, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t tlength, size_t mlength, uint8_t *dst, const uint8_t *src); /* OCB-AES */ /* This struct represents an expanded key for ocb-aes encryption. For decryption, a separate decryption context is needed as well. */ struct ocb_aes128_encrypt_key { struct ocb_key ocb; struct aes128_ctx encrypt; }; void ocb_aes128_set_encrypt_key (struct ocb_aes128_encrypt_key *ocb, const uint8_t *key); void ocb_aes128_set_decrypt_key (struct ocb_aes128_encrypt_key *ocb, struct aes128_ctx *decrypt, const uint8_t *key); void ocb_aes128_set_nonce (struct ocb_ctx *ctx, const struct ocb_aes128_encrypt_key *key, size_t tag_length, size_t nonce_length, const uint8_t *nonce); void ocb_aes128_update (struct ocb_ctx *ctx, const struct ocb_aes128_encrypt_key *key, size_t length, const uint8_t *data); void ocb_aes128_encrypt(struct ocb_ctx *ctx, const struct ocb_aes128_encrypt_key *key, size_t length, uint8_t *dst, const uint8_t *src); void ocb_aes128_decrypt(struct ocb_ctx *ctx, const struct ocb_aes128_encrypt_key *key, const struct aes128_ctx *decrypt, size_t length, uint8_t *dst, const uint8_t *src); void ocb_aes128_digest(struct ocb_ctx *ctx, const struct ocb_aes128_encrypt_key *key, size_t length, uint8_t *digest); void ocb_aes128_encrypt_message (const struct ocb_aes128_encrypt_key *key, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t tlength, size_t clength, uint8_t *dst, const uint8_t *src); int ocb_aes128_decrypt_message (const struct ocb_aes128_encrypt_key *key, const struct aes128_ctx *decrypt, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t tlength, size_t mlength, uint8_t *dst, const uint8_t *src); #ifdef __cplusplus } #endif #endif /* NETTLE_OCB_H_INCLUDED */
6,067
C++
.h
151
36.556291
91
0.732902
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,393
memxor.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/memxor.h
/* memxor.h * */ #ifndef NETTLE_MEMXOR_H_INCLUDED #define NETTLE_MEMXOR_H_INCLUDED #include <stdlib.h> #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define memxor nettle_memxor #define memxor3 nettle_memxor3 void *memxor(void *dst, const void *src, size_t n); void *memxor3(void *dst, const void *a, const void *b, size_t n); #ifdef __cplusplus } #endif #endif /* NETTLE_MEMXOR_H_INCLUDED */
415
C++
.h
18
21.555556
65
0.735897
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
22,394
curve448.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/curve448.h
/* curve448.h Copyright (C) 2017 Daiki Ueno Copyright (C) 2017 Red Hat, Inc. This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_CURVE448_H #define NETTLE_CURVE448_H #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define curve448_mul_g nettle_curve448_mul_g #define curve448_mul nettle_curve448_mul #define CURVE448_SIZE 56 void curve448_mul_g (uint8_t *q, const uint8_t *n); void curve448_mul (uint8_t *q, const uint8_t *n, const uint8_t *p); #ifdef __cplusplus } #endif #endif /* NETTLE_CURVE448_H */
1,485
C++
.h
40
33.675
72
0.744219
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,395
twofish.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/twofish.h
/* twofish.h The twofish block cipher. Copyright (C) 2001, 2014 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ /* * Twofish is a 128-bit block cipher that accepts a variable-length * key up to 256 bits, designed by Bruce Schneier and others. See * http://www.counterpane.com/twofish.html for details. */ #ifndef NETTLE_TWOFISH_H_INCLUDED #define NETTLE_TWOFISH_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define twofish_set_key nettle_twofish_set_key #define twofish128_set_key nettle_twofish128_set_key #define twofish192_set_key nettle_twofish192_set_key #define twofish256_set_key nettle_twofish256_set_key #define twofish_encrypt nettle_twofish_encrypt #define twofish_decrypt nettle_twofish_decrypt #define TWOFISH_BLOCK_SIZE 16 /* Variable key size between 128 and 256 bits. But the only valid * values are 16 (128 bits), 24 (192 bits) and 32 (256 bits). */ #define TWOFISH_MIN_KEY_SIZE 16 #define TWOFISH_MAX_KEY_SIZE 32 #define TWOFISH_KEY_SIZE 32 #define TWOFISH128_KEY_SIZE 16 #define TWOFISH192_KEY_SIZE 24 #define TWOFISH256_KEY_SIZE 32 struct twofish_ctx { uint32_t keys[40]; uint32_t s_box[4][256]; }; void twofish_set_key(struct twofish_ctx *ctx, size_t length, const uint8_t *key); void twofish128_set_key(struct twofish_ctx *context, const uint8_t *key); void twofish192_set_key(struct twofish_ctx *context, const uint8_t *key); void twofish256_set_key(struct twofish_ctx *context, const uint8_t *key); void twofish_encrypt(const struct twofish_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void twofish_decrypt(const struct twofish_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); #ifdef __cplusplus } #endif #endif /* NETTLE_TWOFISH_H_INCLUDED */
2,717
C++
.h
75
33.6
72
0.762505
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,396
ctr.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/ctr.h
/* ctr.h Counter mode, using an network byte order incremented counter, matching the testcases of NIST 800-38A. Copyright (C) 2005 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_CTR_H_INCLUDED #define NETTLE_CTR_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define ctr_crypt nettle_ctr_crypt void ctr_crypt(const void *ctx, nettle_cipher_func *f, size_t block_size, uint8_t *ctr, size_t length, uint8_t *dst, const uint8_t *src); #define CTR_CTX(type, size) \ { type ctx; uint8_t ctr[size]; } #define CTR_SET_COUNTER(ctx, data) \ memcpy((ctx)->ctr, (data), sizeof((ctx)->ctr)) #define CTR_CRYPT(self, f, length, dst, src) \ (0 ? ((f)(&(self)->ctx, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0)) \ : ctr_crypt((void *) &(self)->ctx, \ (nettle_cipher_func *) (f), \ sizeof((self)->ctr), (self)->ctr, \ (length), (dst), (src))) #ifdef __cplusplus } #endif #endif /* NETTLE_CTR_H_INCLUDED */
1,960
C++
.h
51
34.607843
72
0.694018
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,397
md2.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/md2.h
/* md2.h The MD2 hash function, described in RFC 1319. Copyright (C) 2003 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_MD2_H_INCLUDED #define NETTLE_MD2_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define md2_init nettle_md2_init #define md2_update nettle_md2_update #define md2_digest nettle_md2_digest #define MD2_DIGEST_SIZE 16 #define MD2_BLOCK_SIZE 16 /* For backwards compatibility */ #define MD2_DATA_SIZE MD2_BLOCK_SIZE struct md2_ctx { uint8_t C[MD2_BLOCK_SIZE]; uint8_t X[3 * MD2_BLOCK_SIZE]; unsigned index; /* Into buffer */ uint8_t block[MD2_BLOCK_SIZE]; /* Block buffer */ }; void md2_init(struct md2_ctx *ctx); void md2_update(struct md2_ctx *ctx, size_t length, const uint8_t *data); void md2_digest(struct md2_ctx *ctx, size_t length, uint8_t *digest); #ifdef __cplusplus } #endif #endif /* NETTLE_MD2_H_INCLUDED */
1,893
C++
.h
57
29.982456
72
0.733591
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,398
ecdsa.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/ecdsa.h
/* ecdsa.h Copyright (C) 2013 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ /* Development of Nettle's ECC support was funded by the .SE Internet Fund. */ #ifndef NETTLE_ECDSA_H_INCLUDED #define NETTLE_ECDSA_H_INCLUDED #include "ecc.h" #include "dsa.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define ecdsa_sign nettle_ecdsa_sign #define ecdsa_verify nettle_ecdsa_verify #define ecdsa_generate_keypair nettle_ecdsa_generate_keypair #define ecc_ecdsa_sign nettle_ecc_ecdsa_sign #define ecc_ecdsa_sign_itch nettle_ecc_ecdsa_sign_itch #define ecc_ecdsa_verify nettle_ecc_ecdsa_verify #define ecc_ecdsa_verify_itch nettle_ecc_ecdsa_verify_itch /* High level ECDSA functions. * * A public key is represented as a struct ecc_point, and a private * key as a struct ecc_scalar. */ void ecdsa_sign (const struct ecc_scalar *key, void *random_ctx, nettle_random_func *random, size_t digest_length, const uint8_t *digest, struct dsa_signature *signature); int ecdsa_verify (const struct ecc_point *pub, size_t length, const uint8_t *digest, const struct dsa_signature *signature); void ecdsa_generate_keypair (struct ecc_point *pub, struct ecc_scalar *key, void *random_ctx, nettle_random_func *random); /* Low-level ECDSA functions. */ mp_size_t ecc_ecdsa_sign_itch (const struct ecc_curve *ecc); void ecc_ecdsa_sign (const struct ecc_curve *ecc, const mp_limb_t *zp, /* Random nonce, must be invertible mod ecc group order. */ const mp_limb_t *kp, size_t length, const uint8_t *digest, mp_limb_t *rp, mp_limb_t *sp, mp_limb_t *scratch); mp_size_t ecc_ecdsa_verify_itch (const struct ecc_curve *ecc); int ecc_ecdsa_verify (const struct ecc_curve *ecc, const mp_limb_t *pp, /* Public key */ size_t length, const uint8_t *digest, const mp_limb_t *rp, const mp_limb_t *sp, mp_limb_t *scratch); #ifdef __cplusplus } #endif #endif /* NETTLE_ECDSA_H_INCLUDED */
2,893
C++
.h
79
33.379747
78
0.737993
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
22,399
xts.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/xts.h
/* xts.h XEX-based tweaked-codebook mode with ciphertext stealing (XTS) Copyright (C) 2005 Niels Möller Copyright (C) 2018 Red Hat, Inc. This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_XTS_H_INCLUDED #define NETTLE_XTS_H_INCLUDED #include "nettle-types.h" #include "aes.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define xts_encrypt_message nettle_xts_encrypt_message #define xts_decrypt_message nettle_xts_decrypt_message #define xts_aes128_set_encrypt_key nettle_xts_aes128_set_encrypt_key #define xts_aes128_set_decrypt_key nettle_xts_aes128_set_decrypt_key #define xts_aes128_encrypt_message nettle_xts_aes128_encrypt_message #define xts_aes128_decrypt_message nettle_xts_aes128_decrypt_message #define xts_aes256_set_encrypt_key nettle_xts_aes256_set_encrypt_key #define xts_aes256_set_decrypt_key nettle_xts_aes256_set_decrypt_key #define xts_aes256_encrypt_message nettle_xts_aes256_encrypt_message #define xts_aes256_decrypt_message nettle_xts_aes256_decrypt_message #define XTS_BLOCK_SIZE 16 void xts_encrypt_message(const void *enc_ctx, const void *twk_ctx, nettle_cipher_func *encf, const uint8_t *tweak, size_t length, uint8_t *dst, const uint8_t *src); void xts_decrypt_message(const void *dec_ctx, const void *twk_ctx, nettle_cipher_func *decf, nettle_cipher_func *encf, const uint8_t *tweak, size_t length, uint8_t *dst, const uint8_t *src); /* XTS Mode with AES-128 */ struct xts_aes128_key { struct aes128_ctx cipher; struct aes128_ctx tweak_cipher; }; void xts_aes128_set_encrypt_key(struct xts_aes128_key *xts_key, const uint8_t *key); void xts_aes128_set_decrypt_key(struct xts_aes128_key *xts_key, const uint8_t *key); void xts_aes128_encrypt_message(const struct xts_aes128_key *xtskey, const uint8_t *tweak, size_t length, uint8_t *dst, const uint8_t *src); void xts_aes128_decrypt_message(const struct xts_aes128_key *xts_key, const uint8_t *tweak, size_t length, uint8_t *dst, const uint8_t *src); /* XTS Mode with AES-256 */ struct xts_aes256_key { struct aes256_ctx cipher; struct aes256_ctx tweak_cipher; }; void xts_aes256_set_encrypt_key(struct xts_aes256_key *xts_key, const uint8_t *key); void xts_aes256_set_decrypt_key(struct xts_aes256_key *xts_key, const uint8_t *key); void xts_aes256_encrypt_message(const struct xts_aes256_key *xts_key, const uint8_t *tweak, size_t length, uint8_t *dst, const uint8_t *src); void xts_aes256_decrypt_message(const struct xts_aes256_key *xts_key, const uint8_t *tweak, size_t length, uint8_t *dst, const uint8_t *src); #ifdef __cplusplus } #endif #endif /* NETTLE_XTS_H_INCLUDED */
3,983
C++
.h
94
35.414894
72
0.682383
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,400
chacha.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/chacha.h
/* chacha.h The ChaCha stream cipher. Copyright (C) 2013 Joachim Strömbergson Copyright (C) 2012 Simon Josefsson Copyright (C) 2014 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_CHACHA_H_INCLUDED #define NETTLE_CHACHA_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define chacha_set_key nettle_chacha_set_key #define chacha_set_nonce nettle_chacha_set_nonce #define chacha_set_nonce96 nettle_chacha_set_nonce96 #define chacha_set_counter nettle_chacha_set_counter #define chacha_set_counter32 nettle_chacha_set_counter32 #define chacha_crypt nettle_chacha_crypt #define chacha_crypt32 nettle_chacha_crypt32 /* Currently, only 256-bit keys are supported. */ #define CHACHA_KEY_SIZE 32 #define CHACHA_BLOCK_SIZE 64 #define CHACHA_NONCE_SIZE 8 #define CHACHA_NONCE96_SIZE 12 #define CHACHA_COUNTER_SIZE 8 #define CHACHA_COUNTER32_SIZE 4 #define _CHACHA_STATE_LENGTH 16 struct chacha_ctx { /* Indices 0-3 holds a constant (SIGMA or TAU). Indices 4-11 holds the key. Indices 12-13 holds the block counter. Indices 14-15 holds the IV: This creates the state matrix: C C C C K K K K K K K K B B I I */ uint32_t state[_CHACHA_STATE_LENGTH]; }; void chacha_set_key(struct chacha_ctx *ctx, const uint8_t *key); void chacha_set_nonce(struct chacha_ctx *ctx, const uint8_t *nonce); void chacha_set_nonce96(struct chacha_ctx *ctx, const uint8_t *nonce); void chacha_set_counter(struct chacha_ctx *ctx, const uint8_t *counter); void chacha_set_counter32(struct chacha_ctx *ctx, const uint8_t *counter); void chacha_crypt(struct chacha_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void chacha_crypt32(struct chacha_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); #ifdef __cplusplus } #endif #endif /* NETTLE_CHACHA_H_INCLUDED */
2,839
C++
.h
80
32.2
72
0.750183
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,401
eax.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/eax.h
/* eax.h EAX mode, see http://www.cs.ucdavis.edu/~rogaway/papers/eax.pdf Copyright (C) 2013 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_EAX_H_INCLUDED #define NETTLE_EAX_H_INCLUDED #include "aes.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define eax_set_key nettle_eax_set_key #define eax_set_nonce nettle_eax_set_nonce #define eax_update nettle_eax_update #define eax_encrypt nettle_eax_encrypt #define eax_decrypt nettle_eax_decrypt #define eax_digest nettle_eax_digest #define eax_aes128_set_key nettle_eax_aes128_set_key #define eax_aes128_set_nonce nettle_eax_aes128_set_nonce #define eax_aes128_update nettle_eax_aes128_update #define eax_aes128_encrypt nettle_eax_aes128_encrypt #define eax_aes128_decrypt nettle_eax_aes128_decrypt #define eax_aes128_digest nettle_eax_aes128_digest /* Restricted to block ciphers with 128 bit block size. FIXME: Reflect this in naming? */ #define EAX_BLOCK_SIZE 16 #define EAX_DIGEST_SIZE 16 /* FIXME: Reasonable default? */ #define EAX_IV_SIZE 16 /* Values independent of message and nonce */ struct eax_key { union nettle_block16 pad_block; union nettle_block16 pad_partial; }; struct eax_ctx { union nettle_block16 omac_nonce; union nettle_block16 omac_data; union nettle_block16 omac_message; union nettle_block16 ctr; }; void eax_set_key (struct eax_key *key, const void *cipher, nettle_cipher_func *f); void eax_set_nonce (struct eax_ctx *eax, const struct eax_key *key, const void *cipher, nettle_cipher_func *f, size_t nonce_length, const uint8_t *nonce); void eax_update (struct eax_ctx *eax, const struct eax_key *key, const void *cipher, nettle_cipher_func *f, size_t data_length, const uint8_t *data); void eax_encrypt (struct eax_ctx *eax, const struct eax_key *key, const void *cipher, nettle_cipher_func *f, size_t length, uint8_t *dst, const uint8_t *src); void eax_decrypt (struct eax_ctx *eax, const struct eax_key *key, const void *cipher, nettle_cipher_func *f, size_t length, uint8_t *dst, const uint8_t *src); void eax_digest (struct eax_ctx *eax, const struct eax_key *key, const void *cipher, nettle_cipher_func *f, size_t length, uint8_t *digest); /* Put the cipher last, to get cipher-independent offsets for the EAX * state. */ #define EAX_CTX(type) \ { struct eax_key key; struct eax_ctx eax; type cipher; } #define EAX_SET_KEY(ctx, set_key, encrypt, data) \ do { \ (set_key)(&(ctx)->cipher, (data)); \ if (0) (encrypt) (&(ctx)->cipher, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0); \ eax_set_key (&(ctx)->key, &(ctx)->cipher, (nettle_cipher_func *) encrypt); \ } while (0) #define EAX_SET_NONCE(ctx, encrypt, length, nonce) \ (0 ? (encrypt) (&(ctx)->cipher, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0) \ : eax_set_nonce (&(ctx)->eax, &(ctx)->key, \ &(ctx)->cipher, (nettle_cipher_func *) (encrypt), \ (length), (nonce))) #define EAX_UPDATE(ctx, encrypt, length, data) \ (0 ? (encrypt) (&(ctx)->cipher, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0) \ : eax_update (&(ctx)->eax, &(ctx)->key, \ &(ctx)->cipher, (nettle_cipher_func *) (encrypt), \ (length), (data))) #define EAX_ENCRYPT(ctx, encrypt, length, dst, src) \ (0 ? (encrypt) (&(ctx)->cipher, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0) \ : eax_encrypt (&(ctx)->eax, &(ctx)->key, \ &(ctx)->cipher, (nettle_cipher_func *) (encrypt), \ (length), (dst), (src))) #define EAX_DECRYPT(ctx, encrypt, length, dst, src) \ (0 ? (encrypt) (&(ctx)->cipher, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0) \ : eax_decrypt (&(ctx)->eax, &(ctx)->key, \ &(ctx)->cipher, (nettle_cipher_func *) (encrypt), \ (length), (dst), (src))) #define EAX_DIGEST(ctx, encrypt, length, digest) \ (0 ? (encrypt) (&(ctx)->cipher, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0) \ : eax_digest (&(ctx)->eax, &(ctx)->key, \ &(ctx)->cipher, (nettle_cipher_func *) (encrypt), \ (length), (digest))) struct eax_aes128_ctx EAX_CTX(struct aes128_ctx); void eax_aes128_set_key(struct eax_aes128_ctx *ctx, const uint8_t *key); void eax_aes128_set_nonce(struct eax_aes128_ctx *ctx, size_t length, const uint8_t *iv); void eax_aes128_update(struct eax_aes128_ctx *ctx, size_t length, const uint8_t *data); void eax_aes128_encrypt(struct eax_aes128_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void eax_aes128_decrypt(struct eax_aes128_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void eax_aes128_digest(struct eax_aes128_ctx *ctx, size_t length, uint8_t *digest); #ifdef __cplusplus } #endif #endif /* NETTLE_EAX_H_INCLUDED */
5,752
C++
.h
144
36.673611
80
0.677025
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,402
chacha-poly1305.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/chacha-poly1305.h
/* chacha-poly1305.h AEAD mechanism based on chacha and poly1305. See draft-agl-tls-chacha20poly1305-04. Copyright (C) 2014 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_CHACHA_POLY1305_H_INCLUDED #define NETTLE_CHACHA_POLY1305_H_INCLUDED #include "chacha.h" #include "poly1305.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define chacha_poly1305_set_key nettle_chacha_poly1305_set_key #define chacha_poly1305_set_nonce nettle_chacha_poly1305_set_nonce #define chacha_poly1305_update nettle_chacha_poly1305_update #define chacha_poly1305_decrypt nettle_chacha_poly1305_decrypt #define chacha_poly1305_encrypt nettle_chacha_poly1305_encrypt #define chacha_poly1305_digest nettle_chacha_poly1305_digest #define CHACHA_POLY1305_BLOCK_SIZE 64 /* FIXME: Any need for 128-bit variant? */ #define CHACHA_POLY1305_KEY_SIZE 32 #define CHACHA_POLY1305_NONCE_SIZE CHACHA_NONCE96_SIZE #define CHACHA_POLY1305_DIGEST_SIZE 16 struct chacha_poly1305_ctx { struct chacha_ctx chacha; struct poly1305_ctx poly1305; union nettle_block16 s; uint64_t auth_size; uint64_t data_size; /* poly1305 block */ uint8_t block[POLY1305_BLOCK_SIZE]; unsigned index; }; void chacha_poly1305_set_key (struct chacha_poly1305_ctx *ctx, const uint8_t *key); void chacha_poly1305_set_nonce (struct chacha_poly1305_ctx *ctx, const uint8_t *nonce); void chacha_poly1305_update (struct chacha_poly1305_ctx *ctx, size_t length, const uint8_t *data); void chacha_poly1305_encrypt (struct chacha_poly1305_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void chacha_poly1305_decrypt (struct chacha_poly1305_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void chacha_poly1305_digest (struct chacha_poly1305_ctx *ctx, size_t length, uint8_t *digest); #ifdef __cplusplus } #endif #endif /* NETTLE_CHACHA_POLY1305_H_INCLUDED */
2,841
C++
.h
75
34.826667
72
0.770384
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,403
nist-keywrap.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/nist-keywrap.h
/* nist-keywrap.h AES Key Wrap function. implements RFC 3394 https://tools.ietf.org/html/rfc3394 Copyright (C) 2021 Nicolas Mora 2021 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_NIST_KEYWRAP_H_INCLUDED #define NETTLE_NIST_KEYWRAP_H_INCLUDED #include "nettle-types.h" #include "aes.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define nist_keywrap16 nettle_nist_keywrap16 #define nist_keyunwrap16 nettle_nist_keyunwrap16 #define aes128_keywrap nettle_aes128_keywrap #define aes192_keywrap nettle_aes192_keywrap #define aes256_keywrap nettle_aes256_keywrap #define aes128_keyunwrap nettle_aes128_keyunwrap #define aes192_keyunwrap nettle_aes192_keyunwrap #define aes256_keyunwrap nettle_aes256_keyunwrap void nist_keywrap16 (const void *ctx, nettle_cipher_func *encrypt, const uint8_t *iv, size_t ciphertext_length, uint8_t *ciphertext, const uint8_t *cleartext); int nist_keyunwrap16 (const void *ctx, nettle_cipher_func *decrypt, const uint8_t *iv, size_t cleartext_length, uint8_t *cleartext, const uint8_t *ciphertext); void aes128_keywrap (struct aes128_ctx *ctx, const uint8_t *iv, size_t ciphertext_length, uint8_t *ciphertext, const uint8_t *cleartext); void aes192_keywrap (struct aes192_ctx *ctx, const uint8_t *iv, size_t ciphertext_length, uint8_t *ciphertext, const uint8_t *cleartext); void aes256_keywrap (struct aes256_ctx *ctx, const uint8_t *iv, size_t ciphertext_length, uint8_t *ciphertext, const uint8_t *cleartext); int aes128_keyunwrap (struct aes128_ctx *ctx, const uint8_t *iv, size_t cleartext_length, uint8_t *cleartext, const uint8_t *ciphertext); int aes192_keyunwrap (struct aes192_ctx *ctx, const uint8_t *iv, size_t cleartext_length, uint8_t *cleartext, const uint8_t *ciphertext); int aes256_keyunwrap (struct aes256_ctx *ctx, const uint8_t *iv, size_t cleartext_length, uint8_t *cleartext, const uint8_t *ciphertext); #ifdef __cplusplus } #endif #endif /* NETTLE_NIST_KEYWRAP_H_INCLUDED */
2,993
C++
.h
77
35.493506
72
0.756916
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,404
siv-gcm.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/siv-gcm.h
/* siv-gcm.h AES-GCM-SIV, RFC8452 Copyright (C) 2022 Red Hat, Inc. This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_SIV_GCM_H_INCLUDED #define NETTLE_SIV_GCM_H_INCLUDED #include "nettle-types.h" #include "nettle-meta.h" #include "aes.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define siv_gcm_encrypt_message nettle_siv_gcm_encrypt_message #define siv_gcm_decrypt_message nettle_siv_gcm_decrypt_message #define siv_gcm_aes128_encrypt_message nettle_siv_gcm_aes128_encrypt_message #define siv_gcm_aes128_decrypt_message nettle_siv_gcm_aes128_decrypt_message #define siv_gcm_aes256_encrypt_message nettle_siv_gcm_aes256_encrypt_message #define siv_gcm_aes256_decrypt_message nettle_siv_gcm_aes256_decrypt_message /* For AES-GCM-SIV, the block size of the underlying cipher shall be 128 bits. */ #define SIV_GCM_BLOCK_SIZE 16 #define SIV_GCM_DIGEST_SIZE 16 #define SIV_GCM_NONCE_SIZE 12 /* Generic interface. NC must be a block cipher with 128-bit block size, and keysize that is a multiple of 64 bits, such as AES-128 or AES-256. */ void siv_gcm_encrypt_message (const struct nettle_cipher *nc, const void *ctx, void *ctr_ctx, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t clength, uint8_t *dst, const uint8_t *src); int siv_gcm_decrypt_message (const struct nettle_cipher *nc, const void *ctx, void *ctr_ctx, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t mlength, uint8_t *dst, const uint8_t *src); /* AEAD_AES_128_GCM_SIV */ void siv_gcm_aes128_encrypt_message (const struct aes128_ctx *ctx, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t clength, uint8_t *dst, const uint8_t *src); int siv_gcm_aes128_decrypt_message (const struct aes128_ctx *ctx, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t mlength, uint8_t *dst, const uint8_t *src); /* AEAD_AES_256_GCM_SIV */ void siv_gcm_aes256_encrypt_message (const struct aes256_ctx *ctx, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t clength, uint8_t *dst, const uint8_t *src); int siv_gcm_aes256_decrypt_message (const struct aes256_ctx *ctx, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t mlength, uint8_t *dst, const uint8_t *src); #ifdef __cplusplus } #endif #endif /* NETTLE_SIV_H_INCLUDED */
3,430
C++
.h
84
37.488095
81
0.737887
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,405
sha3.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/sha3.h
/* sha3.h The sha3 hash function (aka Keccak). Copyright (C) 2012 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_SHA3_H_INCLUDED #define NETTLE_SHA3_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define sha3_permute nettle_sha3_permute #define sha3_224_init nettle_sha3_224_init #define sha3_224_update nettle_sha3_224_update #define sha3_224_digest nettle_sha3_224_digest #define sha3_256_init nettle_sha3_256_init #define sha3_256_update nettle_sha3_256_update #define sha3_256_digest nettle_sha3_256_digest #define sha3_256_shake nettle_sha3_256_shake #define sha3_384_init nettle_sha3_384_init #define sha3_384_update nettle_sha3_384_update #define sha3_384_digest nettle_sha3_384_digest #define sha3_512_init nettle_sha3_512_init #define sha3_512_update nettle_sha3_512_update #define sha3_512_digest nettle_sha3_512_digest /* Indicates that SHA3 is the NIST FIPS 202 version. */ #define NETTLE_SHA3_FIPS202 1 /* The sha3 state is a 5x5 matrix of 64-bit words. In the notation of Keccak description, S[x,y] is element x + 5*y, so if x is interpreted as the row index and y the column index, it is stored in column-major order. */ #define SHA3_STATE_LENGTH 25 /* The "width" is 1600 bits or 200 octets */ struct sha3_state { uint64_t a[SHA3_STATE_LENGTH]; }; void sha3_permute (struct sha3_state *state); /* The "capacity" is set to 2*(digest size), 512 bits or 64 octets. The "rate" is the width - capacity, or width - 2 * (digest size). */ #define SHA3_224_DIGEST_SIZE 28 #define SHA3_224_BLOCK_SIZE 144 #define SHA3_256_DIGEST_SIZE 32 #define SHA3_256_BLOCK_SIZE 136 #define SHA3_384_DIGEST_SIZE 48 #define SHA3_384_BLOCK_SIZE 104 #define SHA3_512_DIGEST_SIZE 64 #define SHA3_512_BLOCK_SIZE 72 /* For backwards compatibility */ #define SHA3_224_DATA_SIZE SHA3_224_BLOCK_SIZE #define SHA3_256_DATA_SIZE SHA3_256_BLOCK_SIZE #define SHA3_384_DATA_SIZE SHA3_384_BLOCK_SIZE #define SHA3_512_DATA_SIZE SHA3_512_BLOCK_SIZE struct sha3_224_ctx { struct sha3_state state; unsigned index; uint8_t block[SHA3_224_BLOCK_SIZE]; }; void sha3_224_init (struct sha3_224_ctx *ctx); void sha3_224_update (struct sha3_224_ctx *ctx, size_t length, const uint8_t *data); void sha3_224_digest(struct sha3_224_ctx *ctx, size_t length, uint8_t *digest); struct sha3_256_ctx { struct sha3_state state; unsigned index; uint8_t block[SHA3_256_BLOCK_SIZE]; }; void sha3_256_init (struct sha3_256_ctx *ctx); void sha3_256_update (struct sha3_256_ctx *ctx, size_t length, const uint8_t *data); void sha3_256_digest(struct sha3_256_ctx *ctx, size_t length, uint8_t *digest); /* Alternative digest function implementing shake256, with arbitrary digest size */ void sha3_256_shake(struct sha3_256_ctx *ctx, size_t length, uint8_t *digest); struct sha3_384_ctx { struct sha3_state state; unsigned index; uint8_t block[SHA3_384_BLOCK_SIZE]; }; void sha3_384_init (struct sha3_384_ctx *ctx); void sha3_384_update (struct sha3_384_ctx *ctx, size_t length, const uint8_t *data); void sha3_384_digest(struct sha3_384_ctx *ctx, size_t length, uint8_t *digest); struct sha3_512_ctx { struct sha3_state state; unsigned index; uint8_t block[SHA3_512_BLOCK_SIZE]; }; void sha3_512_init (struct sha3_512_ctx *ctx); void sha3_512_update (struct sha3_512_ctx *ctx, size_t length, const uint8_t *data); void sha3_512_digest(struct sha3_512_ctx *ctx, size_t length, uint8_t *digest); #ifdef __cplusplus } #endif #endif /* NETTLE_SHA3_H_INCLUDED */
4,545
C++
.h
147
28.394558
72
0.752412
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,406
gosthash94.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/gosthash94.h
/* gosthash94.h The GOST R 34.11-94 hash function, described in RFC 5831. Copyright (C) 2012 Nikos Mavrogiannopoulos, Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ /* Based on rhash gost.h. */ /* Copyright: 2009-2012 Aleksey Kravchenko <rhash.admin@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Ported to nettle by Nikos Mavrogiannopoulos. */ #ifndef NETTLE_GOSTHASH94_H_INCLUDED #define NETTLE_GOSTHASH94_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif #define gosthash94_init nettle_gosthash94_init #define gosthash94_update nettle_gosthash94_update #define gosthash94_digest nettle_gosthash94_digest #define gosthash94cp_update nettle_gosthash94cp_update #define gosthash94cp_digest nettle_gosthash94cp_digest #define GOSTHASH94_BLOCK_SIZE 32 #define GOSTHASH94_DIGEST_SIZE 32 /* For backwards compatibility */ #define GOSTHASH94_DATA_SIZE GOSTHASH94_BLOCK_SIZE #define GOSTHASH94CP_BLOCK_SIZE GOSTHASH94_BLOCK_SIZE #define GOSTHASH94CP_DIGEST_SIZE GOSTHASH94_DIGEST_SIZE struct gosthash94_ctx { uint32_t hash[8]; /* algorithm 256-bit state */ uint32_t sum[8]; /* sum of processed message blocks */ uint64_t count; /* Block count */ unsigned index; /* Into buffer */ uint8_t block[GOSTHASH94_BLOCK_SIZE]; /* 256-bit buffer for leftovers */ }; #define gosthash94cp_ctx gosthash94_ctx void gosthash94_init(struct gosthash94_ctx *ctx); void gosthash94_update(struct gosthash94_ctx *ctx, size_t length, const uint8_t *msg); void gosthash94_digest(struct gosthash94_ctx *ctx, size_t length, uint8_t *result); #define gosthash94cp_init gosthash94_init void gosthash94cp_update(struct gosthash94_ctx *ctx, size_t length, const uint8_t *msg); void gosthash94cp_digest(struct gosthash94_ctx *ctx, size_t length, uint8_t *result); #ifdef __cplusplus } #endif #endif /* NETTLE_GOSTHASH94_H_INCLUDED */
3,897
C++
.h
87
41.91954
74
0.765125
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,407
streebog.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/streebog.h
/* streebog.h The Streebog family of hash functions. Copyright (C) 2020 Dmitry Baryshkov This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_STREEBOG_H_INCLUDED #define NETTLE_STREEBOG_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define streebog256_init nettle_streebog256_init #define streebog256_digest nettle_streebog256_digest #define streebog512_init nettle_streebog512_init #define streebog512_update nettle_streebog512_update #define streebog512_digest nettle_streebog512_digest /* STREEBOG512 */ #define STREEBOG512_DIGEST_SIZE 64 #define STREEBOG512_BLOCK_SIZE 64 /* Digest is kept internally as 8 64-bit words. */ #define _STREEBOG512_DIGEST_LENGTH 8 struct streebog512_ctx { uint64_t state[_STREEBOG512_DIGEST_LENGTH]; /* State variables */ uint64_t count[_STREEBOG512_DIGEST_LENGTH]; uint64_t sigma[_STREEBOG512_DIGEST_LENGTH]; unsigned int index; /* index into buffer */ uint8_t block[STREEBOG512_BLOCK_SIZE]; /* STREEBOG512 data buffer */ }; void streebog512_init(struct streebog512_ctx *ctx); void streebog512_update(struct streebog512_ctx *ctx, size_t length, const uint8_t *data); void streebog512_digest(struct streebog512_ctx *ctx, size_t length, uint8_t *digest); #define STREEBOG256_DIGEST_SIZE 32 #define STREEBOG256_BLOCK_SIZE STREEBOG512_BLOCK_SIZE #define streebog256_ctx streebog512_ctx void streebog256_init(struct streebog256_ctx *ctx); #define streebog256_update nettle_streebog512_update void streebog256_digest(struct streebog256_ctx *ctx, size_t length, uint8_t *digest); #ifdef __cplusplus } #endif #endif /* NETTLE_STREEBOG_H_INCLUDED */
2,659
C++
.h
71
34.267606
79
0.762016
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,408
nettle-types.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/nettle-types.h
/* nettle-types.h Copyright (C) 2005, 2014 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_TYPES_H #define NETTLE_TYPES_H /* For size_t */ #include <stddef.h> #include <stdint.h> /* Attributes we want to use in installed header files, and hence can't rely on config.h. */ #ifdef __GNUC__ #define _NETTLE_ATTRIBUTE_PURE __attribute__((pure)) #ifndef _NETTLE_ATTRIBUTE_DEPRECATED /* Variant without message is supported since gcc-3.1 or so. */ #define _NETTLE_ATTRIBUTE_DEPRECATED __attribute__((deprecated)) #endif #else /* !__GNUC__ */ #define _NETTLE_ATTRIBUTE_PURE #define _NETTLE_ATTRIBUTE_DEPRECATED #endif /* !__GNUC__ */ #ifdef __cplusplus extern "C" { #endif /* An aligned 16-byte block. */ union nettle_block16 { uint8_t b[16]; unsigned long w[16 / sizeof(unsigned long)] _NETTLE_ATTRIBUTE_DEPRECATED; uint64_t u64[2]; }; union nettle_block8 { uint8_t b[8]; uint64_t u64; }; /* Randomness. Used by key generation and dsa signature creation. */ typedef void nettle_random_func(void *ctx, size_t length, uint8_t *dst); /* Progress report function, mainly for key generation. */ typedef void nettle_progress_func(void *ctx, int c); /* Realloc function, used by struct nettle_buffer. */ typedef void *nettle_realloc_func(void *ctx, void *p, size_t length); /* Ciphers */ typedef void nettle_set_key_func(void *ctx, const uint8_t *key); /* For block ciphers, const context. */ typedef void nettle_cipher_func(const void *ctx, size_t length, uint8_t *dst, const uint8_t *src); /* Uses a void * for cipher contexts. Used for crypt operations where the internal state changes during the encryption. */ typedef void nettle_crypt_func(void *ctx, size_t length, uint8_t *dst, const uint8_t *src); /* Hash algorithms */ typedef void nettle_hash_init_func(void *ctx); typedef void nettle_hash_update_func(void *ctx, size_t length, const uint8_t *src); typedef void nettle_hash_digest_func(void *ctx, size_t length, uint8_t *dst); /* ASCII armor codecs. NOTE: Experimental and subject to change. */ typedef size_t nettle_armor_length_func(size_t length); typedef void nettle_armor_init_func(void *ctx); typedef size_t nettle_armor_encode_update_func(void *ctx, char *dst, size_t src_length, const uint8_t *src); typedef size_t nettle_armor_encode_final_func(void *ctx, char *dst); typedef int nettle_armor_decode_update_func(void *ctx, size_t *dst_length, uint8_t *dst, size_t src_length, const char *src); typedef int nettle_armor_decode_final_func(void *ctx); #ifdef __cplusplus } #endif #endif /* NETTLE_TYPES_H */
3,635
C++
.h
96
34.166667
75
0.716895
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,409
md5-compat.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/md5-compat.h
/* md5-compat.h The md5 hash function, RFC 1321-style interface. Copyright (C) 2001 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_MD5_COMPAT_H_INCLUDED #define NETTLE_MD5_COMPAT_H_INCLUDED #include "md5.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define MD5Init nettle_MD5Init #define MD5Update nettle_MD5Update #define MD5Final nettle_MD5Final typedef struct md5_ctx MD5_CTX; void MD5Init(MD5_CTX *ctx); void MD5Update(MD5_CTX *ctx, const unsigned char *data, unsigned int length); void MD5Final(unsigned char *out, MD5_CTX *ctx); #ifdef __cplusplus } #endif #endif /* NETTLE_MD5_COMPAT_H_INCLUDED */
1,585
C++
.h
40
36.175
77
0.75573
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
22,410
realloc.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/realloc.h
/* realloc.h Copyright (C) 2002 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_REALLOC_H_INCLUDED #define NETTLE_REALLOC_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif nettle_realloc_func nettle_realloc; nettle_realloc_func nettle_xrealloc; #ifdef __cplusplus } #endif #endif /* NETTLE_REALLOC_H_INCLUDED */
1,295
C++
.h
33
35.424242
72
0.753612
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,411
cfb.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/cfb.h
/* cfb.h Cipher feedback mode. Copyright (C) 2015, 2017 Dmitry Eremin-Solenikov Copyright (C) 2001 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_CFB_H_INCLUDED #define NETTLE_CFB_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define cfb_encrypt nettle_cfb_encrypt #define cfb_decrypt nettle_cfb_decrypt #define cfb8_encrypt nettle_cfb8_encrypt #define cfb8_decrypt nettle_cfb8_decrypt void cfb_encrypt(const void *ctx, nettle_cipher_func *f, size_t block_size, uint8_t *iv, size_t length, uint8_t *dst, const uint8_t *src); void cfb_decrypt(const void *ctx, nettle_cipher_func *f, size_t block_size, uint8_t *iv, size_t length, uint8_t *dst, const uint8_t *src); void cfb8_encrypt(const void *ctx, nettle_cipher_func *f, size_t block_size, uint8_t *iv, size_t length, uint8_t *dst, const uint8_t *src); void cfb8_decrypt(const void *ctx, nettle_cipher_func *f, size_t block_size, uint8_t *iv, size_t length, uint8_t *dst, const uint8_t *src); #define CFB_CTX(type, size) \ { type ctx; uint8_t iv[size]; } #define CFB_SET_IV(ctx, data) \ memcpy((ctx)->iv, (data), sizeof((ctx)->iv)) #define CFB8_CTX CFB_CTX #define CFB8_SET_IV CFB_SET_IV /* NOTE: Avoid using NULL, as we don't include anything defining it. */ #define CFB_ENCRYPT(self, f, length, dst, src) \ (0 ? ((f)(&(self)->ctx, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0)) \ : cfb_encrypt((void *) &(self)->ctx, \ (nettle_cipher_func *) (f), \ sizeof((self)->iv), (self)->iv, \ (length), (dst), (src))) #define CFB_DECRYPT(self, f, length, dst, src) \ (0 ? ((f)(&(self)->ctx, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0)) \ : cfb_decrypt((void *) &(self)->ctx, \ (nettle_cipher_func *) (f), \ sizeof((self)->iv), (self)->iv, \ (length), (dst), (src))) #define CFB8_ENCRYPT(self, f, length, dst, src) \ (0 ? ((f)(&(self)->ctx, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0)) \ : cfb8_encrypt((void *) &(self)->ctx, \ (nettle_cipher_func *) (f), \ sizeof((self)->iv), (self)->iv, \ (length), (dst), (src))) #define CFB8_DECRYPT(self, f, length, dst, src) \ (0 ? ((f)(&(self)->ctx, ~(size_t) 0, \ (uint8_t *) 0, (const uint8_t *) 0)) \ : cfb8_decrypt((void *) &(self)->ctx, \ (nettle_cipher_func *) (f), \ sizeof((self)->iv), (self)->iv, \ (length), (dst), (src))) #ifdef __cplusplus } #endif #endif /* NETTLE_CFB_H_INCLUDED */
3,495
C++
.h
93
33.784946
72
0.647495
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,412
yarrow.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/yarrow.h
/* yarrow.h The yarrow pseudo-randomness generator. Copyright (C) 2001 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_YARROW_H_INCLUDED #define NETTLE_YARROW_H_INCLUDED #include "aes.h" #include "sha2.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define yarrow256_init nettle_yarrow256_init #define yarrow256_seed nettle_yarrow256_seed #define yarrow256_update nettle_yarrow256_update #define yarrow256_random nettle_yarrow256_random #define yarrow256_is_seeded nettle_yarrow256_is_seeded #define yarrow256_needed_sources nettle_yarrow256_needed_sources #define yarrow256_fast_reseed nettle_yarrow256_fast_reseed #define yarrow256_slow_reseed nettle_yarrow256_slow_reseed #define yarrow_key_event_init nettle_yarrow_key_event_init #define yarrow_key_event_estimate nettle_yarrow_key_event_estimate /* Obsolete alias for backwards compatibility. Will be deleted in some later version. */ #define yarrow256_force_reseed yarrow256_slow_reseed enum yarrow_pool_id { YARROW_FAST = 0, YARROW_SLOW = 1 }; struct yarrow_source { /* Indexed by yarrow_pool_id */ uint32_t estimate[2]; /* The pool next sample should go to. */ enum yarrow_pool_id next; }; #define YARROW256_SEED_FILE_SIZE (2 * AES_BLOCK_SIZE) /* Yarrow-256, based on SHA-256 and AES-256 */ struct yarrow256_ctx { /* Indexed by yarrow_pool_id */ struct sha256_ctx pools[2]; int seeded; /* The current key and counter block */ struct aes256_ctx key; uint8_t counter[AES_BLOCK_SIZE]; /* The entropy sources */ unsigned nsources; struct yarrow_source *sources; }; void yarrow256_init(struct yarrow256_ctx *ctx, unsigned nsources, struct yarrow_source *sources); void yarrow256_seed(struct yarrow256_ctx *ctx, size_t length, const uint8_t *seed_file); /* Returns 1 on reseed */ int yarrow256_update(struct yarrow256_ctx *ctx, unsigned source, unsigned entropy, size_t length, const uint8_t *data); void yarrow256_random(struct yarrow256_ctx *ctx, size_t length, uint8_t *dst); int yarrow256_is_seeded(struct yarrow256_ctx *ctx); unsigned yarrow256_needed_sources(struct yarrow256_ctx *ctx); void yarrow256_fast_reseed(struct yarrow256_ctx *ctx); void yarrow256_slow_reseed(struct yarrow256_ctx *ctx); /* Key event estimator */ #define YARROW_KEY_EVENT_BUFFER 16 struct yarrow_key_event_ctx { /* Counter for initial priming of the state */ unsigned index; unsigned chars[YARROW_KEY_EVENT_BUFFER]; unsigned previous; }; void yarrow_key_event_init(struct yarrow_key_event_ctx *ctx); unsigned yarrow_key_event_estimate(struct yarrow_key_event_ctx *ctx, unsigned key, unsigned time); #ifdef __cplusplus } #endif #endif /* NETTLE_YARROW_H_INCLUDED */
3,684
C++
.h
106
31.811321
73
0.764723
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
22,413
des.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/des.h
/* des.h The des block cipher. And triple des. Copyright (C) 1992 Dana L. How Copyright (C) 2001 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ /* * des - fast & portable DES encryption & decryption. * Copyright (C) 1992 Dana L. How * Please see the file `../lib/descore.README' for the complete copyright * notice. * * Slightly edited by Niels Möller, 1997 */ #ifndef NETTLE_DES_H_INCLUDED #define NETTLE_DES_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Namespace mangling */ #define des_set_key nettle_des_set_key #define des_encrypt nettle_des_encrypt #define des_decrypt nettle_des_decrypt #define des_check_parity nettle_des_check_parity #define des_fix_parity nettle_des_fix_parity #define des3_set_key nettle_des3_set_key #define des3_encrypt nettle_des3_encrypt #define des3_decrypt nettle_des3_decrypt #define DES_KEY_SIZE 8 #define DES_BLOCK_SIZE 8 /* Expanded key length */ #define _DES_KEY_LENGTH 32 struct des_ctx { uint32_t key[_DES_KEY_LENGTH]; }; /* Returns 1 for good keys and 0 for weak keys. */ int des_set_key(struct des_ctx *ctx, const uint8_t *key); void des_encrypt(const struct des_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void des_decrypt(const struct des_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); int des_check_parity(size_t length, const uint8_t *key); void des_fix_parity(size_t length, uint8_t *dst, const uint8_t *src); #define DES3_KEY_SIZE 24 #define DES3_BLOCK_SIZE DES_BLOCK_SIZE struct des3_ctx { struct des_ctx des[3]; }; /* Returns 1 for good keys and 0 for weak keys. */ int des3_set_key(struct des3_ctx *ctx, const uint8_t *key); void des3_encrypt(const struct des3_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void des3_decrypt(const struct des3_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); #ifdef __cplusplus } #endif #endif /* NETTLE_DES_H_INCLUDED */
2,922
C++
.h
91
29.164835
73
0.735
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,414
pbkdf2.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/pbkdf2.h
/* pbkdf2.h PKCS #5 password-based key derivation function PBKDF2, see RFC 2898. Copyright (C) 2012 Simon Josefsson This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_PBKDF2_H_INCLUDED #define NETTLE_PBKDF2_H_INCLUDED #include "nettle-meta.h" #ifdef __cplusplus extern "C" { #endif /* Namespace mangling */ #define pbkdf2 nettle_pbkdf2 #define pbkdf2_hmac_sha1 nettle_pbkdf2_hmac_sha1 #define pbkdf2_hmac_sha256 nettle_pbkdf2_hmac_sha256 #define pbkdf2_hmac_sha384 nettle_pbkdf2_hmac_sha384 #define pbkdf2_hmac_sha512 nettle_pbkdf2_hmac_sha512 #define pbkdf2_hmac_gosthash94cp nettle_pbkdf2_hmac_gosthash94cp void pbkdf2 (void *mac_ctx, nettle_hash_update_func *update, nettle_hash_digest_func *digest, size_t digest_size, unsigned iterations, size_t salt_length, const uint8_t *salt, size_t length, uint8_t *dst); #define PBKDF2(ctx, update, digest, digest_size, \ iterations, salt_length, salt, length, dst) \ (0 ? ((update)((ctx), 0, (uint8_t *) 0), \ (digest)((ctx), 0, (uint8_t *) 0)) \ : pbkdf2 ((ctx), \ (nettle_hash_update_func *)(update), \ (nettle_hash_digest_func *)(digest), \ (digest_size), (iterations), \ (salt_length), (salt), (length), (dst))) /* PBKDF2 with specific PRFs. */ void pbkdf2_hmac_sha1 (size_t key_length, const uint8_t *key, unsigned iterations, size_t salt_length, const uint8_t *salt, size_t length, uint8_t *dst); void pbkdf2_hmac_sha256 (size_t key_length, const uint8_t *key, unsigned iterations, size_t salt_length, const uint8_t *salt, size_t length, uint8_t *dst); void pbkdf2_hmac_sha384 (size_t key_length, const uint8_t *key, unsigned iterations, size_t salt_length, const uint8_t *salt, size_t length, uint8_t *dst); void pbkdf2_hmac_sha512 (size_t key_length, const uint8_t *key, unsigned iterations, size_t salt_length, const uint8_t *salt, size_t length, uint8_t *dst); void pbkdf2_hmac_gosthash94cp (size_t key_length, const uint8_t *key, unsigned iterations, size_t salt_length, const uint8_t *salt, size_t length, uint8_t *dst); #ifdef __cplusplus } #endif #endif /* NETTLE_PBKDF2_H_INCLUDED */
3,141
C++
.h
82
34.52439
72
0.714992
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,415
arctwo.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/arctwo.h
/* arctwo.h The arctwo/rfc2268 block cipher. Copyright (C) 2004 Simon Josefsson Copyright (C) 2002, 2004, 2014 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_ARCTWO_H_INCLUDED #define NETTLE_ARCTWO_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define arctwo_set_key nettle_arctwo_set_key #define arctwo_set_key_ekb nettle_arctwo_set_key_ekb #define arctwo_set_key_gutmann nettle_arctwo_set_key_gutmann #define arctwo40_set_key nettle_arctwo40_set_key #define arctwo64_set_key nettle_arctwo64_set_key #define arctwo128_set_key nettle_arctwo128_set_key #define arctwo128_set_key_gutmann nettle_arctwo128_set_key_gutmann #define arctwo_encrypt nettle_arctwo_encrypt #define arctwo_decrypt nettle_arctwo_decrypt #define ARCTWO_BLOCK_SIZE 8 /* Variable key size from 1 byte to 128 bytes. */ #define ARCTWO_MIN_KEY_SIZE 1 #define ARCTWO_MAX_KEY_SIZE 128 #define ARCTWO_KEY_SIZE 8 struct arctwo_ctx { uint16_t S[64]; }; /* Key expansion function that takes the "effective key bits", 1-1024, as an explicit argument. 0 means maximum key bits. */ void arctwo_set_key_ekb (struct arctwo_ctx *ctx, size_t length, const uint8_t * key, unsigned ekb); /* Equvivalent to arctwo_set_key_ekb, with ekb = 8 * length */ void arctwo_set_key (struct arctwo_ctx *ctx, size_t length, const uint8_t *key); void arctwo40_set_key (struct arctwo_ctx *ctx, const uint8_t *key); void arctwo64_set_key (struct arctwo_ctx *ctx, const uint8_t *key); void arctwo128_set_key (struct arctwo_ctx *ctx, const uint8_t *key); /* Equvivalent to arctwo_set_key_ekb, with ekb = 1024 */ void arctwo_set_key_gutmann (struct arctwo_ctx *ctx, size_t length, const uint8_t *key); void arctwo128_set_key_gutmann (struct arctwo_ctx *ctx, const uint8_t *key); void arctwo_encrypt (struct arctwo_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void arctwo_decrypt (struct arctwo_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); #ifdef __cplusplus } #endif #endif /* NETTLE_ARCTWO_H_INCLUDED */
3,013
C++
.h
79
35.481013
75
0.75567
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,416
memops.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/memops.h
/* memops.h Copyright (C) 2016 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_MEMOPS_H_INCLUDED #define NETTLE_MEMOPS_H_INCLUDED #include "memxor.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define cnd_memcpy nettle_cnd_memcpy #define memeql_sec nettle_memeql_sec int memeql_sec (const void *a, const void *b, size_t n); /* Side-channel silent conditional memcpy. cnd must be 0 (nop) or 1 (copy). */ void cnd_memcpy(int cnd, volatile void *dst, const volatile void *src, size_t n); #ifdef __cplusplus } #endif #endif /* NETTLE_MEMOPS_H_INCLUDED */
1,528
C++
.h
40
34.775
76
0.743032
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,417
dsa.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/dsa.h
/* dsa.h The DSA publickey algorithm. Copyright (C) 2002, 2013, 2014 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_DSA_H_INCLUDED #define NETTLE_DSA_H_INCLUDED #include "nettle-types.h" #include "bignum.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define dsa_params_init nettle_dsa_params_init #define dsa_params_clear nettle_dsa_params_clear #define dsa_signature_init nettle_dsa_signature_init #define dsa_signature_clear nettle_dsa_signature_clear #define dsa_sign nettle_dsa_sign #define dsa_verify nettle_dsa_verify #define dsa_generate_params nettle_dsa_generate_params #define dsa_generate_keypair nettle_dsa_generate_keypair #define dsa_signature_from_sexp nettle_dsa_signature_from_sexp #define dsa_keypair_to_sexp nettle_dsa_keypair_to_sexp #define dsa_keypair_from_sexp_alist nettle_dsa_keypair_from_sexp_alist #define dsa_sha1_keypair_from_sexp nettle_dsa_sha1_keypair_from_sexp #define dsa_sha256_keypair_from_sexp nettle_dsa_sha256_keypair_from_sexp #define dsa_params_from_der_iterator nettle_dsa_params_from_der_iterator #define dsa_public_key_from_der_iterator nettle_dsa_public_key_from_der_iterator #define dsa_openssl_private_key_from_der_iterator nettle_dsa_openssl_private_key_from_der_iterator #define dsa_openssl_private_key_from_der nettle_openssl_provate_key_from_der /* For FIPS approved parameters */ #define DSA_SHA1_MIN_P_BITS 512 #define DSA_SHA1_Q_OCTETS 20 #define DSA_SHA1_Q_BITS 160 #define DSA_SHA256_MIN_P_BITS 1024 #define DSA_SHA256_Q_OCTETS 32 #define DSA_SHA256_Q_BITS 256 struct dsa_params { /* Modulo */ mpz_t p; /* Group order */ mpz_t q; /* Generator */ mpz_t g; }; void dsa_params_init (struct dsa_params *params); void dsa_params_clear (struct dsa_params *params); struct dsa_signature { mpz_t r; mpz_t s; }; /* Calls mpz_init to initialize bignum storage. */ void dsa_signature_init(struct dsa_signature *signature); /* Calls mpz_clear to deallocate bignum storage. */ void dsa_signature_clear(struct dsa_signature *signature); int dsa_sign(const struct dsa_params *params, const mpz_t x, void *random_ctx, nettle_random_func *random, size_t digest_size, const uint8_t *digest, struct dsa_signature *signature); int dsa_verify(const struct dsa_params *params, const mpz_t y, size_t digest_size, const uint8_t *digest, const struct dsa_signature *signature); /* Key generation */ int dsa_generate_params(struct dsa_params *params, void *random_ctx, nettle_random_func *random, void *progress_ctx, nettle_progress_func *progress, unsigned p_bits, unsigned q_bits); void dsa_generate_keypair (const struct dsa_params *params, mpz_t pub, mpz_t key, void *random_ctx, nettle_random_func *random); /* Keys in sexp form. */ struct nettle_buffer; /* Generates a public-key expression if PRIV is NULL .*/ int dsa_keypair_to_sexp(struct nettle_buffer *buffer, const char *algorithm_name, /* NULL means "dsa" */ const struct dsa_params *params, const mpz_t pub, const mpz_t priv); struct sexp_iterator; int dsa_signature_from_sexp(struct dsa_signature *rs, struct sexp_iterator *i, unsigned q_bits); int dsa_keypair_from_sexp_alist(struct dsa_params *params, mpz_t pub, mpz_t priv, unsigned p_max_bits, unsigned q_bits, struct sexp_iterator *i); /* If PRIV is NULL, expect a public-key expression. If PUB is NULL, * expect a private key expression and ignore the parts not needed for * the public key. */ /* Keys must be initialized before calling this function, as usual. */ int dsa_sha1_keypair_from_sexp(struct dsa_params *params, mpz_t pub, mpz_t priv, unsigned p_max_bits, size_t length, const uint8_t *expr); int dsa_sha256_keypair_from_sexp(struct dsa_params *params, mpz_t pub, mpz_t priv, unsigned p_max_bits, size_t length, const uint8_t *expr); /* Keys in X.509 andd OpenSSL format. */ struct asn1_der_iterator; int dsa_params_from_der_iterator(struct dsa_params *params, unsigned max_bits, unsigned q_bits, struct asn1_der_iterator *i); int dsa_public_key_from_der_iterator(const struct dsa_params *params, mpz_t pub, struct asn1_der_iterator *i); int dsa_openssl_private_key_from_der_iterator(struct dsa_params *params, mpz_t pub, mpz_t priv, unsigned p_max_bits, struct asn1_der_iterator *i); int dsa_openssl_private_key_from_der(struct dsa_params *params, mpz_t pub, mpz_t priv, unsigned p_max_bits, size_t length, const uint8_t *data); #ifdef __cplusplus } #endif #endif /* NETTLE_DSA_H_INCLUDED */
5,639
C++
.h
164
30.926829
99
0.739315
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,418
sha2.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/sha2.h
/* sha2.h The sha2 family of hash functions. Copyright (C) 2001, 2012 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #ifndef NETTLE_SHA2_H_INCLUDED #define NETTLE_SHA2_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define sha224_init nettle_sha224_init #define sha224_digest nettle_sha224_digest #define sha256_init nettle_sha256_init #define sha256_update nettle_sha256_update #define sha256_digest nettle_sha256_digest #define sha256_compress nettle_sha256_compress #define sha384_init nettle_sha384_init #define sha384_digest nettle_sha384_digest #define sha512_init nettle_sha512_init #define sha512_update nettle_sha512_update #define sha512_digest nettle_sha512_digest #define sha512_compress nettle_sha512_compress #define sha512_224_init nettle_sha512_224_init #define sha512_224_digest nettle_sha512_224_digest #define sha512_256_init nettle_sha512_256_init #define sha512_256_digest nettle_sha512_256_digest /* For backwards compatibility */ #define SHA224_DATA_SIZE SHA256_BLOCK_SIZE #define SHA256_DATA_SIZE SHA256_BLOCK_SIZE #define SHA512_DATA_SIZE SHA512_BLOCK_SIZE #define SHA384_DATA_SIZE SHA512_BLOCK_SIZE /* SHA256 */ #define SHA256_DIGEST_SIZE 32 #define SHA256_BLOCK_SIZE 64 /* Digest is kept internally as 8 32-bit words. */ #define _SHA256_DIGEST_LENGTH 8 struct sha256_ctx { uint32_t state[_SHA256_DIGEST_LENGTH]; /* State variables */ uint64_t count; /* 64-bit block count */ unsigned int index; /* index into buffer */ uint8_t block[SHA256_BLOCK_SIZE]; /* SHA256 data buffer */ }; void sha256_init(struct sha256_ctx *ctx); void sha256_update(struct sha256_ctx *ctx, size_t length, const uint8_t *data); void sha256_digest(struct sha256_ctx *ctx, size_t length, uint8_t *digest); void sha256_compress(uint32_t *state, const uint8_t *input); /* SHA224, a truncated SHA256 with different initial state. */ #define SHA224_DIGEST_SIZE 28 #define SHA224_BLOCK_SIZE SHA256_BLOCK_SIZE #define sha224_ctx sha256_ctx void sha224_init(struct sha256_ctx *ctx); #define sha224_update nettle_sha256_update void sha224_digest(struct sha256_ctx *ctx, size_t length, uint8_t *digest); /* SHA512 */ #define SHA512_DIGEST_SIZE 64 #define SHA512_BLOCK_SIZE 128 /* Digest is kept internally as 8 64-bit words. */ #define _SHA512_DIGEST_LENGTH 8 struct sha512_ctx { uint64_t state[_SHA512_DIGEST_LENGTH]; /* State variables */ uint64_t count_low, count_high; /* 128-bit block count */ unsigned int index; /* index into buffer */ uint8_t block[SHA512_BLOCK_SIZE]; /* SHA512 data buffer */ }; void sha512_init(struct sha512_ctx *ctx); void sha512_update(struct sha512_ctx *ctx, size_t length, const uint8_t *data); void sha512_digest(struct sha512_ctx *ctx, size_t length, uint8_t *digest); void sha512_compress(uint64_t *state, const uint8_t *input); /* SHA384, a truncated SHA512 with different initial state. */ #define SHA384_DIGEST_SIZE 48 #define SHA384_BLOCK_SIZE SHA512_BLOCK_SIZE #define sha384_ctx sha512_ctx void sha384_init(struct sha512_ctx *ctx); #define sha384_update nettle_sha512_update void sha384_digest(struct sha512_ctx *ctx, size_t length, uint8_t *digest); /* SHA512_224 and SHA512_256, two truncated versions of SHA512 with different initial states. */ #define SHA512_224_DIGEST_SIZE 28 #define SHA512_224_BLOCK_SIZE SHA512_BLOCK_SIZE #define sha512_224_ctx sha512_ctx void sha512_224_init(struct sha512_224_ctx *ctx); #define sha512_224_update nettle_sha512_update void sha512_224_digest(struct sha512_224_ctx *ctx, size_t length, uint8_t *digest); #define SHA512_256_DIGEST_SIZE 32 #define SHA512_256_BLOCK_SIZE SHA512_BLOCK_SIZE #define sha512_256_ctx sha512_ctx void sha512_256_init(struct sha512_256_ctx *ctx); #define sha512_256_update nettle_sha512_update void sha512_256_digest(struct sha512_256_ctx *ctx, size_t length, uint8_t *digest); #ifdef __cplusplus } #endif #endif /* NETTLE_SHA2_H_INCLUDED */
5,156
C++
.h
146
32.184932
72
0.738648
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,419
ccm.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/ccm.h
/* ccm.h Counter with CBC-MAC mode, specified by NIST, http://csrc.nist.gov/publications/nistpubs/800-38C/SP800-38C_updated-July20_2007.pdf Copyright (C) 2014 Exegin Technologies Limited Copyright (C) 2014 Owen Kirby Contributed to GNU Nettle by Owen Kirby This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ /* NIST SP800-38C doesn't specify the particular formatting and * counter generation algorithm for CCM, but it does include an * example algorithm. This example has become the de-factor standard, * and has been adopted by both the IETF and IEEE across a wide * variety of protocols. */ #ifndef NETTLE_CCM_H_INCLUDED #define NETTLE_CCM_H_INCLUDED #include "aes.h" #ifdef __cplusplus extern "C" { #endif /* Name mangling */ #define ccm_set_nonce nettle_ccm_set_nonce #define ccm_update nettle_ccm_update #define ccm_encrypt nettle_ccm_encrypt #define ccm_decrypt nettle_ccm_decrypt #define ccm_digest nettle_ccm_digest #define ccm_encrypt_message nettle_ccm_encrypt_message #define ccm_decrypt_message nettle_ccm_decrypt_message #define ccm_aes128_set_key nettle_ccm_aes128_set_key #define ccm_aes128_set_nonce nettle_ccm_aes128_set_nonce #define ccm_aes128_update nettle_ccm_aes128_update #define ccm_aes128_encrypt nettle_ccm_aes128_encrypt #define ccm_aes128_decrypt nettle_ccm_aes128_decrypt #define ccm_aes128_digest nettle_ccm_aes128_digest #define ccm_aes128_encrypt_message nettle_ccm_aes128_encrypt_message #define ccm_aes128_decrypt_message nettle_ccm_aes128_decrypt_message #define ccm_aes192_set_key nettle_ccm_aes192_set_key #define ccm_aes192_set_nonce nettle_ccm_aes192_set_nonce #define ccm_aes192_update nettle_ccm_aes192_update #define ccm_aes192_encrypt nettle_ccm_aes192_encrypt #define ccm_aes192_decrypt nettle_ccm_aes192_decrypt #define ccm_aes192_digest nettle_ccm_aes192_digest #define ccm_aes192_encrypt_message nettle_ccm_aes192_encrypt_message #define ccm_aes192_decrypt_message nettle_ccm_aes192_decrypt_message #define ccm_aes256_set_key nettle_ccm_aes256_set_key #define ccm_aes256_set_nonce nettle_ccm_aes256_set_nonce #define ccm_aes256_update nettle_ccm_aes256_update #define ccm_aes256_encrypt nettle_ccm_aes256_encrypt #define ccm_aes256_decrypt nettle_ccm_aes256_decrypt #define ccm_aes256_digest nettle_ccm_aes256_digest #define ccm_aes256_encrypt_message nettle_ccm_aes256_encrypt_message #define ccm_aes256_decrypt_message nettle_ccm_aes256_decrypt_message /* For CCM, the block size of the block cipher shall be 128 bits. */ #define CCM_BLOCK_SIZE 16 #define CCM_DIGEST_SIZE 16 #define CCM_MIN_NONCE_SIZE 7 #define CCM_MAX_NONCE_SIZE 14 /* Maximum cleartext message size, as a function of the nonce size N. The length field is L octets, with L = 15 - N, and then the maximum size M = 2^{8L} - 1. */ #define CCM_MAX_MSG_SIZE(N) \ ((sizeof(size_t) + (N) <= 15) \ ? ~(size_t) 0 \ : ((size_t) 1 << (8*(15 - N))) - 1) /* Per-message state */ struct ccm_ctx { union nettle_block16 ctr; /* Counter for CTR encryption. */ union nettle_block16 tag; /* CBC-MAC message tag. */ /* Length of data processed by the CBC-MAC modulus the block size */ unsigned int blength; }; /* * CCM mode requires the adata and message lengths when building the IV, which * prevents streaming processing and it incompatible with the AEAD API. */ void ccm_set_nonce(struct ccm_ctx *ctx, const void *cipher, nettle_cipher_func *f, size_t noncelen, const uint8_t *nonce, size_t authlen, size_t msglen, size_t taglen); void ccm_update(struct ccm_ctx *ctx, const void *cipher, nettle_cipher_func *f, size_t length, const uint8_t *data); void ccm_encrypt(struct ccm_ctx *ctx, const void *cipher, nettle_cipher_func *f, size_t length, uint8_t *dst, const uint8_t *src); void ccm_decrypt(struct ccm_ctx *ctx, const void *cipher, nettle_cipher_func *f, size_t length, uint8_t *dst, const uint8_t *src); void ccm_digest(struct ccm_ctx *ctx, const void *cipher, nettle_cipher_func *f, size_t length, uint8_t *digest); /* * All-in-one encryption and decryption API: * tlength = sizeof(digest) * mlength = sizeof(cleartext) * clength = sizeof(ciphertext) = mlength + tlength * * The ciphertext will contain the encrypted payload with the message digest * appended to the end. */ void ccm_encrypt_message(const void *cipher, nettle_cipher_func *f, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t tlength, size_t clength, uint8_t *dst, const uint8_t *src); /* * The decryption function will write the plaintext to dst and parse the digest * from the final tlength bytes of the ciphertext. If the digest matched the * value computed during decryption then this will return 1, or it will return * 0 if the digest was invalid. */ int ccm_decrypt_message(const void *cipher, nettle_cipher_func *f, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t tlength, size_t mlength, uint8_t *dst, const uint8_t *src); /* CCM Mode with AES-128 */ struct ccm_aes128_ctx { struct ccm_ctx ccm; struct aes128_ctx cipher; }; void ccm_aes128_set_key(struct ccm_aes128_ctx *ctx, const uint8_t *key); void ccm_aes128_set_nonce(struct ccm_aes128_ctx *ctx, size_t length, const uint8_t *nonce, size_t authlen, size_t msglen, size_t taglen); void ccm_aes128_update (struct ccm_aes128_ctx *ctx, size_t length, const uint8_t *data); void ccm_aes128_encrypt(struct ccm_aes128_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void ccm_aes128_decrypt(struct ccm_aes128_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void ccm_aes128_digest(struct ccm_aes128_ctx *ctx, size_t length, uint8_t *digest); /* FIXME: For next API/ABI break: first argument should be const struct aes128_ctx *, and similarly for other ccm_*_message functions below. */ void ccm_aes128_encrypt_message(struct ccm_aes128_ctx *ctx, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t tlength, size_t clength, uint8_t *dst, const uint8_t *src); int ccm_aes128_decrypt_message(struct ccm_aes128_ctx *ctx, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t tlength, size_t mlength, uint8_t *dst, const uint8_t *src); struct ccm_aes192_ctx { struct ccm_ctx ccm; struct aes192_ctx cipher; }; /* CCM Mode with AES-192 */ void ccm_aes192_set_key(struct ccm_aes192_ctx *ctx, const uint8_t *key); void ccm_aes192_set_nonce(struct ccm_aes192_ctx *ctx, size_t length, const uint8_t *nonce, size_t authlen, size_t msglen, size_t taglen); void ccm_aes192_update(struct ccm_aes192_ctx *ctx, size_t length, const uint8_t *data); void ccm_aes192_encrypt(struct ccm_aes192_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void ccm_aes192_decrypt(struct ccm_aes192_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void ccm_aes192_digest(struct ccm_aes192_ctx *ctx, size_t length, uint8_t *digest); void ccm_aes192_encrypt_message(struct ccm_aes192_ctx *ctx, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t tlength, size_t clength, uint8_t *dst, const uint8_t *src); int ccm_aes192_decrypt_message(struct ccm_aes192_ctx *ctx, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t tlength, size_t mlength, uint8_t *dst, const uint8_t *src); /* CCM Mode with AES-256 */ struct ccm_aes256_ctx { struct ccm_ctx ccm; struct aes256_ctx cipher; }; void ccm_aes256_set_key(struct ccm_aes256_ctx *ctx, const uint8_t *key); void ccm_aes256_set_nonce(struct ccm_aes256_ctx *ctx, size_t length, const uint8_t *nonce, size_t authlen, size_t msglen, size_t taglen); void ccm_aes256_update(struct ccm_aes256_ctx *ctx, size_t length, const uint8_t *data); void ccm_aes256_encrypt(struct ccm_aes256_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void ccm_aes256_decrypt(struct ccm_aes256_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); void ccm_aes256_digest(struct ccm_aes256_ctx *ctx, size_t length, uint8_t *digest); void ccm_aes256_encrypt_message(struct ccm_aes256_ctx *ctx, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t tlength, size_t clength, uint8_t *dst, const uint8_t *src); int ccm_aes256_decrypt_message(struct ccm_aes256_ctx *ctx, size_t nlength, const uint8_t *nonce, size_t alength, const uint8_t *adata, size_t tlength, size_t mlength, uint8_t *dst, const uint8_t *src); #ifdef __cplusplus } #endif #endif /* NETTLE_CCM_H_INCLUDED */
9,775
C++
.h
247
36.380567
87
0.734847
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
22,420
ecc-curve.h
Nevcairiel_LAVFilters/thirdparty/32/include/nettle/ecc-curve.h
/* ecc-curve.h Copyright (C) 2013 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ /* Development of Nettle's ECC support was funded by the .SE Internet Fund. */ #ifndef NETTLE_ECC_CURVE_H_INCLUDED #define NETTLE_ECC_CURVE_H_INCLUDED #include "nettle-types.h" #ifdef __cplusplus extern "C" { #endif /* The contents of this struct is internal. */ struct ecc_curve; const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_gost_gc256b(void); const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_gost_gc512a(void); const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_secp_192r1(void); const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_secp_224r1(void); const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_secp_256r1(void); const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_secp_384r1(void); const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_secp_521r1(void); #ifdef __cplusplus } #endif #endif /* NETTLE_ECC_CURVE_H_INCLUDED */
1,916
C++
.h
41
43.439024
78
0.758342
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,422
avisynth_c.h
Nevcairiel_LAVFilters/thirdparty/32/include/avisynth/avisynth_c.h
// Avisynth C Interface Version 0.20 // Copyright 2003 Kevin Atkinson // Copyright 2020 AviSynth+ project // Actual C Interface version follows the global Avisynth+ IF version numbers. // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, // MA 02110-1301 USA, or visit // http://www.gnu.org/copyleft/gpl.html . // // As a special exception, I give you permission to link to the // Avisynth C interface with independent modules that communicate with // the Avisynth C interface solely through the interfaces defined in // avisynth_c.h, regardless of the license terms of these independent // modules, and to copy and distribute the resulting combined work // under terms of your choice, provided that every copy of the // combined work is accompanied by a complete copy of the source code // of the Avisynth C interface and Avisynth itself (with the version // used to produce the combined work), being distributed under the // terms of the GNU General Public License plus this exception. An // independent module is a module which is not derived from or based // on Avisynth C Interface, such as 3rd-party filters, import and // export plugins, or graphical user interfaces. // NOTE: this is a partial update of the Avisynth C interface to recognize // new color spaces and interface elements added in Avisynth 2.60 and AviSynth+. // This interface is not 100% Avisynth+ CPP interface equivalent. // 170103: added new CPU constants (FMA4, AVX512xx) // 171102: define SIZETMOD. do not use yet, experimental. Offsets are size_t instead of int. Affects x64. // 171106: avs_get_row_size calls into avs_get_row_size_p, instead of direct field access // 171106: avs_get_height calls into avs_get_row_size_p, instead of direct field access // 180524: AVSC_EXPORT to dllexport in capi.h for avisynth_c_plugin_init // 180524: avs_is_same_colorspace VideoInfo parameters to const // 181230: Readability: functions regrouped to mix less AVSC_API and AVSC_INLINE, put together Avisynth+ specific stuff // 181230: use #ifndef AVSC_NO_DECLSPEC for AVSC_INLINE functions which are calling API functions // 181230: comments on avs_load_library (helper for loading API entries dynamically into a struct using AVSC_NO_DECLSPEC define) // 181230: define alias AVS_FRAME_ALIGN as FRAME_ALIGN // 181230: remove unused form of avs_get_rowsize and avs_get_height (kept earlier for reference) // 190104: avs_load_library: smart fallback mechanism for Avisynth+ specific functions: // if they are not loadable, they will work in a classic Avisynth compatible mode // Example#1: e.g. avs_is_444 will call the existing avs_is_yv24 instead // Example#2: avs_bits_per_component will return 8 for all colorspaces (Classic Avisynth supports only 8 bits/pixel) // Thus the Avisynth+ specific API functions are safely callable even when connected to classic Avisynth DLL // 2002xx non-Windows friendly additions // 200305 avs_vsprintf parameter type change: (void *) to va_list // 200330: (remove test SIZETMOD define for clarity) // 200513: user must use explicite #define AVS26_FALLBACK_SIMULATION for having fallback helpers in dynamic loaded library section // 200513: Follow AviSynth+ V8 interface additions // AVS_VideoFrame struct extended with placeholder for frame property pointer // avs_subframe_planar_a // avs_copy_frame_props // avs_get_frame_props_ro, avs_get_frame_props_rw // avs_prop_num_keys, avs_prop_get_key, avs_prop_num_elements, avs_prop_get_type, avs_prop_get_data_size // avs_prop_get_int, avs_prop_get_float, avs_prop_get_data, avs_prop_get_clip, avs_prop_get_frame, avs_prop_get_int_array, avs_prop_get_float_array // avs_prop_set_int, avs_prop_set_float, avs_prop_set_data, avs_prop_set_clip, avs_prop_set_frame, avs_prop_set_int_array, avs_prop_set_float_array // avs_prop_delete_key, avs_clear_map // avs_new_video_frame_p, avs_new_video_frame_p_a // avs_get_env_property (internal system properties), AVS_AEP_xxx (AvsEnvProperty) enums // avs_get_var_try, avs_get_var_bool, avs_get_var_int, avs_get_var_double, avs_get_var_string, avs_get_var_long // avs_pool_allocate, avs_pool_free // 2021: Follow AviSynth+ V9 interface additions // avs_is_property_writable, avs_make_property_writable // Add enum AVISYNTHPLUS_INTERFACE_BUGFIX_VERSION (AVISYNTH_INTERFACE_VERSION still exists) // Add enum AVS_AEP_HOST_SYSTEM_ENDIANNESS to system property request types (avs_get_env_property) // Add enums AVS_AEP_INTERFACE_VERSION and AVS_AEP_INTERFACE_BUGFIX for direct interface version system property request types (avs_get_env_property) // Bugfix 9.1: fix avs_prop_get_data // 2023: Follow AviSynth+ V10 interface additions // Add enum AVS_DEFAULT_PLANE (as 0) to plane constants // prop_src argument now const in avs_new_video_frame_p and avs_new_video_frame_p_a (no change in use) // Add pixel_type to struct AVS_VideoFrame // Add avs_video_frame_get_pixel_type and avs_video_frame_amend_pixel_type for getting and setting AVS_VideoFrame pixel_type // Additional AviSynth+ V10 interface additions: // Add enum AVS_SPEAKER_xxx, AVS_IT_SPEAKER_xxx // audio channel mask support avs_is_channel_mask_known, avs_set_channel_mask, avs_get_channel_mask #ifndef __AVISYNTH_C__ #define __AVISYNTH_C__ #include "avs/config.h" #include "avs/capi.h" #include "avs/types.h" #define AVS_FRAME_ALIGN FRAME_ALIGN ///////////////////////////////////////////////////////////////////// // // Constants // #ifndef __AVISYNTH_10_H__ enum { AVISYNTH_INTERFACE_CLASSIC_VERSION = 6, AVISYNTH_INTERFACE_VERSION = 10, AVISYNTHPLUS_INTERFACE_BUGFIX_VERSION = 0 // reset to zero whenever the normal interface version bumps }; #endif enum { AVS_SAMPLE_INT8 = 1 << 0, AVS_SAMPLE_INT16 = 1 << 1, AVS_SAMPLE_INT24 = 1 << 2, AVS_SAMPLE_INT32 = 1 << 3, AVS_SAMPLE_FLOAT = 1 << 4 }; enum { AVS_DEFAULT_PLANE = 0, AVS_PLANAR_Y = 1 << 0, AVS_PLANAR_U = 1 << 1, AVS_PLANAR_V = 1 << 2, AVS_PLANAR_ALIGNED = 1 << 3, AVS_PLANAR_Y_ALIGNED = AVS_PLANAR_Y | AVS_PLANAR_ALIGNED, AVS_PLANAR_U_ALIGNED = AVS_PLANAR_U | AVS_PLANAR_ALIGNED, AVS_PLANAR_V_ALIGNED = AVS_PLANAR_V | AVS_PLANAR_ALIGNED, AVS_PLANAR_A = 1 << 4, AVS_PLANAR_R = 1 << 5, AVS_PLANAR_G = 1 << 6, AVS_PLANAR_B = 1 << 7, AVS_PLANAR_A_ALIGNED = AVS_PLANAR_A | AVS_PLANAR_ALIGNED, AVS_PLANAR_R_ALIGNED = AVS_PLANAR_R | AVS_PLANAR_ALIGNED, AVS_PLANAR_G_ALIGNED = AVS_PLANAR_G | AVS_PLANAR_ALIGNED, AVS_PLANAR_B_ALIGNED = AVS_PLANAR_B | AVS_PLANAR_ALIGNED }; // Colorspace properties. enum { AVS_CS_YUVA = 1 << 27, AVS_CS_BGR = 1 << 28, AVS_CS_YUV = 1 << 29, AVS_CS_INTERLEAVED = 1 << 30, AVS_CS_PLANAR = 1 << 31, AVS_CS_SHIFT_SUB_WIDTH = 0, AVS_CS_SHIFT_SUB_HEIGHT = 8, AVS_CS_SHIFT_SAMPLE_BITS = 16, AVS_CS_SUB_WIDTH_MASK = 7 << AVS_CS_SHIFT_SUB_WIDTH, AVS_CS_SUB_WIDTH_1 = 3 << AVS_CS_SHIFT_SUB_WIDTH, // YV24 AVS_CS_SUB_WIDTH_2 = 0 << AVS_CS_SHIFT_SUB_WIDTH, // YV12, I420, YV16 AVS_CS_SUB_WIDTH_4 = 1 << AVS_CS_SHIFT_SUB_WIDTH, // YUV9, YV411 AVS_CS_VPLANEFIRST = 1 << 3, // YV12, YV16, YV24, YV411, YUV9 AVS_CS_UPLANEFIRST = 1 << 4, // I420 AVS_CS_SUB_HEIGHT_MASK = 7 << AVS_CS_SHIFT_SUB_HEIGHT, AVS_CS_SUB_HEIGHT_1 = 3 << AVS_CS_SHIFT_SUB_HEIGHT, // YV16, YV24, YV411 AVS_CS_SUB_HEIGHT_2 = 0 << AVS_CS_SHIFT_SUB_HEIGHT, // YV12, I420 AVS_CS_SUB_HEIGHT_4 = 1 << AVS_CS_SHIFT_SUB_HEIGHT, // YUV9 AVS_CS_SAMPLE_BITS_MASK = 7 << AVS_CS_SHIFT_SAMPLE_BITS, AVS_CS_SAMPLE_BITS_8 = 0 << AVS_CS_SHIFT_SAMPLE_BITS, AVS_CS_SAMPLE_BITS_10 = 5 << AVS_CS_SHIFT_SAMPLE_BITS, AVS_CS_SAMPLE_BITS_12 = 6 << AVS_CS_SHIFT_SAMPLE_BITS, AVS_CS_SAMPLE_BITS_14 = 7 << AVS_CS_SHIFT_SAMPLE_BITS, AVS_CS_SAMPLE_BITS_16 = 1 << AVS_CS_SHIFT_SAMPLE_BITS, AVS_CS_SAMPLE_BITS_32 = 2 << AVS_CS_SHIFT_SAMPLE_BITS, AVS_CS_PLANAR_MASK = AVS_CS_PLANAR | AVS_CS_INTERLEAVED | AVS_CS_YUV | AVS_CS_BGR | AVS_CS_YUVA | AVS_CS_SAMPLE_BITS_MASK | AVS_CS_SUB_WIDTH_MASK | AVS_CS_SUB_HEIGHT_MASK, AVS_CS_PLANAR_FILTER = ~(AVS_CS_VPLANEFIRST | AVS_CS_UPLANEFIRST), AVS_CS_RGB_TYPE = 1 << 0, AVS_CS_RGBA_TYPE = 1 << 1, AVS_CS_GENERIC_YUV444 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_VPLANEFIRST | AVS_CS_SUB_WIDTH_1 | AVS_CS_SUB_HEIGHT_1, // 4:4:4 planar AVS_CS_GENERIC_YUV422 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_VPLANEFIRST | AVS_CS_SUB_WIDTH_2 | AVS_CS_SUB_HEIGHT_1, // 4:2:2 planar AVS_CS_GENERIC_YUV420 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_VPLANEFIRST | AVS_CS_SUB_WIDTH_2 | AVS_CS_SUB_HEIGHT_2, // 4:2:0 planar AVS_CS_GENERIC_Y = AVS_CS_PLANAR | AVS_CS_INTERLEAVED | AVS_CS_YUV, // Y only (4:0:0) AVS_CS_GENERIC_RGBP = AVS_CS_PLANAR | AVS_CS_BGR | AVS_CS_RGB_TYPE, // planar RGB AVS_CS_GENERIC_RGBAP = AVS_CS_PLANAR | AVS_CS_BGR | AVS_CS_RGBA_TYPE, // planar RGBA AVS_CS_GENERIC_YUVA444 = AVS_CS_PLANAR | AVS_CS_YUVA | AVS_CS_VPLANEFIRST | AVS_CS_SUB_WIDTH_1 | AVS_CS_SUB_HEIGHT_1, // 4:4:4:A planar AVS_CS_GENERIC_YUVA422 = AVS_CS_PLANAR | AVS_CS_YUVA | AVS_CS_VPLANEFIRST | AVS_CS_SUB_WIDTH_2 | AVS_CS_SUB_HEIGHT_1, // 4:2:2:A planar AVS_CS_GENERIC_YUVA420 = AVS_CS_PLANAR | AVS_CS_YUVA | AVS_CS_VPLANEFIRST | AVS_CS_SUB_WIDTH_2 | AVS_CS_SUB_HEIGHT_2 // 4:2:0:A planar }; // Specific color formats enum { AVS_CS_UNKNOWN = 0, AVS_CS_BGR24 = AVS_CS_RGB_TYPE | AVS_CS_BGR | AVS_CS_INTERLEAVED, AVS_CS_BGR32 = AVS_CS_RGBA_TYPE | AVS_CS_BGR | AVS_CS_INTERLEAVED, AVS_CS_YUY2 = 1 << 2 | AVS_CS_YUV | AVS_CS_INTERLEAVED, // AVS_CS_YV12 = 1 << 3 Reserved // AVS_CS_I420 = 1 << 4 Reserved AVS_CS_RAW32 = 1 << 5 | AVS_CS_INTERLEAVED, AVS_CS_YV24 = AVS_CS_GENERIC_YUV444 | AVS_CS_SAMPLE_BITS_8, // YUV 4:4:4 planar AVS_CS_YV16 = AVS_CS_GENERIC_YUV422 | AVS_CS_SAMPLE_BITS_8, // YUV 4:2:2 planar AVS_CS_YV12 = AVS_CS_GENERIC_YUV420 | AVS_CS_SAMPLE_BITS_8, // YUV 4:2:0 planar AVS_CS_I420 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_UPLANEFIRST | AVS_CS_SUB_WIDTH_2 | AVS_CS_SUB_HEIGHT_2, // YUV 4:2:0 planar AVS_CS_IYUV = AVS_CS_I420, AVS_CS_YV411 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_VPLANEFIRST | AVS_CS_SUB_WIDTH_4 | AVS_CS_SUB_HEIGHT_1, // YUV 4:1:1 planar AVS_CS_YUV9 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_VPLANEFIRST | AVS_CS_SUB_WIDTH_4 | AVS_CS_SUB_HEIGHT_4, // YUV 4:1:0 planar AVS_CS_Y8 = AVS_CS_GENERIC_Y | AVS_CS_SAMPLE_BITS_8, // Y 4:0:0 planar //------------------------- // AVS16: new planar constants go live! Experimental PF 160613 // 10-12-14-16 bit + planar RGB + BGR48/64 160725 AVS_CS_YUV444P10 = AVS_CS_GENERIC_YUV444 | AVS_CS_SAMPLE_BITS_10, // YUV 4:4:4 10bit samples AVS_CS_YUV422P10 = AVS_CS_GENERIC_YUV422 | AVS_CS_SAMPLE_BITS_10, // YUV 4:2:2 10bit samples AVS_CS_YUV420P10 = AVS_CS_GENERIC_YUV420 | AVS_CS_SAMPLE_BITS_10, // YUV 4:2:0 10bit samples AVS_CS_Y10 = AVS_CS_GENERIC_Y | AVS_CS_SAMPLE_BITS_10, // Y 4:0:0 10bit samples AVS_CS_YUV444P12 = AVS_CS_GENERIC_YUV444 | AVS_CS_SAMPLE_BITS_12, // YUV 4:4:4 12bit samples AVS_CS_YUV422P12 = AVS_CS_GENERIC_YUV422 | AVS_CS_SAMPLE_BITS_12, // YUV 4:2:2 12bit samples AVS_CS_YUV420P12 = AVS_CS_GENERIC_YUV420 | AVS_CS_SAMPLE_BITS_12, // YUV 4:2:0 12bit samples AVS_CS_Y12 = AVS_CS_GENERIC_Y | AVS_CS_SAMPLE_BITS_12, // Y 4:0:0 12bit samples AVS_CS_YUV444P14 = AVS_CS_GENERIC_YUV444 | AVS_CS_SAMPLE_BITS_14, // YUV 4:4:4 14bit samples AVS_CS_YUV422P14 = AVS_CS_GENERIC_YUV422 | AVS_CS_SAMPLE_BITS_14, // YUV 4:2:2 14bit samples AVS_CS_YUV420P14 = AVS_CS_GENERIC_YUV420 | AVS_CS_SAMPLE_BITS_14, // YUV 4:2:0 14bit samples AVS_CS_Y14 = AVS_CS_GENERIC_Y | AVS_CS_SAMPLE_BITS_14, // Y 4:0:0 14bit samples AVS_CS_YUV444P16 = AVS_CS_GENERIC_YUV444 | AVS_CS_SAMPLE_BITS_16, // YUV 4:4:4 16bit samples AVS_CS_YUV422P16 = AVS_CS_GENERIC_YUV422 | AVS_CS_SAMPLE_BITS_16, // YUV 4:2:2 16bit samples AVS_CS_YUV420P16 = AVS_CS_GENERIC_YUV420 | AVS_CS_SAMPLE_BITS_16, // YUV 4:2:0 16bit samples AVS_CS_Y16 = AVS_CS_GENERIC_Y | AVS_CS_SAMPLE_BITS_16, // Y 4:0:0 16bit samples // 32 bit samples (float) AVS_CS_YUV444PS = AVS_CS_GENERIC_YUV444 | AVS_CS_SAMPLE_BITS_32, // YUV 4:4:4 32bit samples AVS_CS_YUV422PS = AVS_CS_GENERIC_YUV422 | AVS_CS_SAMPLE_BITS_32, // YUV 4:2:2 32bit samples AVS_CS_YUV420PS = AVS_CS_GENERIC_YUV420 | AVS_CS_SAMPLE_BITS_32, // YUV 4:2:0 32bit samples AVS_CS_Y32 = AVS_CS_GENERIC_Y | AVS_CS_SAMPLE_BITS_32, // Y 4:0:0 32bit samples // RGB packed AVS_CS_BGR48 = AVS_CS_RGB_TYPE | AVS_CS_BGR | AVS_CS_INTERLEAVED | AVS_CS_SAMPLE_BITS_16, // BGR 3x16 bit AVS_CS_BGR64 = AVS_CS_RGBA_TYPE | AVS_CS_BGR | AVS_CS_INTERLEAVED | AVS_CS_SAMPLE_BITS_16, // BGR 4x16 bit // no packed 32 bit (float) support for these legacy types // RGB planar AVS_CS_RGBP = AVS_CS_GENERIC_RGBP | AVS_CS_SAMPLE_BITS_8, // Planar RGB 8 bit samples AVS_CS_RGBP10 = AVS_CS_GENERIC_RGBP | AVS_CS_SAMPLE_BITS_10, // Planar RGB 10bit samples AVS_CS_RGBP12 = AVS_CS_GENERIC_RGBP | AVS_CS_SAMPLE_BITS_12, // Planar RGB 12bit samples AVS_CS_RGBP14 = AVS_CS_GENERIC_RGBP | AVS_CS_SAMPLE_BITS_14, // Planar RGB 14bit samples AVS_CS_RGBP16 = AVS_CS_GENERIC_RGBP | AVS_CS_SAMPLE_BITS_16, // Planar RGB 16bit samples AVS_CS_RGBPS = AVS_CS_GENERIC_RGBP | AVS_CS_SAMPLE_BITS_32, // Planar RGB 32bit samples // RGBA planar AVS_CS_RGBAP = AVS_CS_GENERIC_RGBAP | AVS_CS_SAMPLE_BITS_8, // Planar RGBA 8 bit samples AVS_CS_RGBAP10 = AVS_CS_GENERIC_RGBAP | AVS_CS_SAMPLE_BITS_10, // Planar RGBA 10bit samples AVS_CS_RGBAP12 = AVS_CS_GENERIC_RGBAP | AVS_CS_SAMPLE_BITS_12, // Planar RGBA 12bit samples AVS_CS_RGBAP14 = AVS_CS_GENERIC_RGBAP | AVS_CS_SAMPLE_BITS_14, // Planar RGBA 14bit samples AVS_CS_RGBAP16 = AVS_CS_GENERIC_RGBAP | AVS_CS_SAMPLE_BITS_16, // Planar RGBA 16bit samples AVS_CS_RGBAPS = AVS_CS_GENERIC_RGBAP | AVS_CS_SAMPLE_BITS_32, // Planar RGBA 32bit samples // Planar YUVA AVS_CS_YUVA444 = AVS_CS_GENERIC_YUVA444 | AVS_CS_SAMPLE_BITS_8, // YUVA 4:4:4 8bit samples AVS_CS_YUVA422 = AVS_CS_GENERIC_YUVA422 | AVS_CS_SAMPLE_BITS_8, // YUVA 4:2:2 8bit samples AVS_CS_YUVA420 = AVS_CS_GENERIC_YUVA420 | AVS_CS_SAMPLE_BITS_8, // YUVA 4:2:0 8bit samples AVS_CS_YUVA444P10 = AVS_CS_GENERIC_YUVA444 | AVS_CS_SAMPLE_BITS_10, // YUVA 4:4:4 10bit samples AVS_CS_YUVA422P10 = AVS_CS_GENERIC_YUVA422 | AVS_CS_SAMPLE_BITS_10, // YUVA 4:2:2 10bit samples AVS_CS_YUVA420P10 = AVS_CS_GENERIC_YUVA420 | AVS_CS_SAMPLE_BITS_10, // YUVA 4:2:0 10bit samples AVS_CS_YUVA444P12 = AVS_CS_GENERIC_YUVA444 | AVS_CS_SAMPLE_BITS_12, // YUVA 4:4:4 12bit samples AVS_CS_YUVA422P12 = AVS_CS_GENERIC_YUVA422 | AVS_CS_SAMPLE_BITS_12, // YUVA 4:2:2 12bit samples AVS_CS_YUVA420P12 = AVS_CS_GENERIC_YUVA420 | AVS_CS_SAMPLE_BITS_12, // YUVA 4:2:0 12bit samples AVS_CS_YUVA444P14 = AVS_CS_GENERIC_YUVA444 | AVS_CS_SAMPLE_BITS_14, // YUVA 4:4:4 14bit samples AVS_CS_YUVA422P14 = AVS_CS_GENERIC_YUVA422 | AVS_CS_SAMPLE_BITS_14, // YUVA 4:2:2 14bit samples AVS_CS_YUVA420P14 = AVS_CS_GENERIC_YUVA420 | AVS_CS_SAMPLE_BITS_14, // YUVA 4:2:0 14bit samples AVS_CS_YUVA444P16 = AVS_CS_GENERIC_YUVA444 | AVS_CS_SAMPLE_BITS_16, // YUVA 4:4:4 16bit samples AVS_CS_YUVA422P16 = AVS_CS_GENERIC_YUVA422 | AVS_CS_SAMPLE_BITS_16, // YUVA 4:2:2 16bit samples AVS_CS_YUVA420P16 = AVS_CS_GENERIC_YUVA420 | AVS_CS_SAMPLE_BITS_16, // YUVA 4:2:0 16bit samples AVS_CS_YUVA444PS = AVS_CS_GENERIC_YUVA444 | AVS_CS_SAMPLE_BITS_32, // YUVA 4:4:4 32bit samples AVS_CS_YUVA422PS = AVS_CS_GENERIC_YUVA422 | AVS_CS_SAMPLE_BITS_32, // YUVA 4:2:2 32bit samples AVS_CS_YUVA420PS = AVS_CS_GENERIC_YUVA420 | AVS_CS_SAMPLE_BITS_32, // YUVA 4:2:0 32bit samples }; // AvsChannelMask enum: Unshifted channel mask constants like in WAVEFORMATEXTENSIBLE // in AvsImageTypeFlags they are shifted by 4 bits enum { AVS_MASK_SPEAKER_FRONT_LEFT = 0x1, AVS_MASK_SPEAKER_FRONT_RIGHT = 0x2, AVS_MASK_SPEAKER_FRONT_CENTER = 0x4, AVS_MASK_SPEAKER_LOW_FREQUENCY = 0x8, AVS_MASK_SPEAKER_BACK_LEFT = 0x10, AVS_MASK_SPEAKER_BACK_RIGHT = 0x20, AVS_MASK_SPEAKER_FRONT_LEFT_OF_CENTER = 0x40, AVS_MASK_SPEAKER_FRONT_RIGHT_OF_CENTER = 0x80, AVS_MASK_SPEAKER_BACK_CENTER = 0x100, AVS_MASK_SPEAKER_SIDE_LEFT = 0x200, AVS_MASK_SPEAKER_SIDE_RIGHT = 0x400, AVS_MASK_SPEAKER_TOP_CENTER = 0x800, AVS_MASK_SPEAKER_TOP_FRONT_LEFT = 0x1000, AVS_MASK_SPEAKER_TOP_FRONT_CENTER = 0x2000, AVS_MASK_SPEAKER_TOP_FRONT_RIGHT = 0x4000, AVS_MASK_SPEAKER_TOP_BACK_LEFT = 0x8000, AVS_MASK_SPEAKER_TOP_BACK_CENTER = 0x10000, AVS_MASK_SPEAKER_TOP_BACK_RIGHT = 0x20000, // Bit mask locations used up for the above positions AVS_MASK_SPEAKER_DEFINED = 0x0003FFFF, // Bit mask locations reserved for future use AVS_MASK_SPEAKER_RESERVED = 0x7FFC0000, // Used to specify that any possible permutation of speaker configurations // Due to lack of available bits this one is put differently into image_type AVS_MASK_SPEAKER_ALL = 0x80000000 }; // AvsImageTypeFlags enum { AVS_IT_BFF = 1 << 0, AVS_IT_TFF = 1 << 1, AVS_IT_FIELDBASED = 1 << 2, // Audio channel mask support AVS_IT_HAS_CHANNELMASK = 1 << 3, // shifted by 4 bits compared to WAVEFORMATEXTENSIBLE dwChannelMask // otherwise same as AvsChannelMask AVS_IT_SPEAKER_FRONT_LEFT = 0x1 << 4, AVS_IT_SPEAKER_FRONT_RIGHT = 0x2 << 4, AVS_IT_SPEAKER_FRONT_CENTER = 0x4 << 4, AVS_IT_SPEAKER_LOW_FREQUENCY = 0x8 << 4, AVS_IT_SPEAKER_BACK_LEFT = 0x10 << 4, AVS_IT_SPEAKER_BACK_RIGHT = 0x20 << 4, AVS_IT_SPEAKER_FRONT_LEFT_OF_CENTER = 0x40 << 4, AVS_IT_SPEAKER_FRONT_RIGHT_OF_CENTER = 0x80 << 4, AVS_IT_SPEAKER_BACK_CENTER = 0x100 << 4, AVS_IT_SPEAKER_SIDE_LEFT = 0x200 << 4, AVS_IT_SPEAKER_SIDE_RIGHT = 0x400 << 4, AVS_IT_SPEAKER_TOP_CENTER = 0x800 << 4, AVS_IT_SPEAKER_TOP_FRONT_LEFT = 0x1000 << 4, AVS_IT_SPEAKER_TOP_FRONT_CENTER = 0x2000 << 4, AVS_IT_SPEAKER_TOP_FRONT_RIGHT = 0x4000 << 4, AVS_IT_SPEAKER_TOP_BACK_LEFT = 0x8000 << 4, AVS_IT_SPEAKER_TOP_BACK_CENTER = 0x10000 << 4, AVS_IT_SPEAKER_TOP_BACK_RIGHT = 0x20000 << 4, // End of officially defined speaker bits // The next one is special, since cannot shift SPEAKER_ALL 0x80000000 further. // Set mask and get mask handles it. AVS_IT_SPEAKER_ALL = 0x40000 << 4, // Mask for the defined 18 bits + SPEAKER_ALL AVS_IT_SPEAKER_BITS_MASK = (AVS_MASK_SPEAKER_DEFINED << 4) | AVS_IT_SPEAKER_ALL, AVS_IT_NEXT_AVAILABLE = 1 << 23 }; enum { AVS_FILTER_TYPE = 1, AVS_FILTER_INPUT_COLORSPACE = 2, AVS_FILTER_OUTPUT_TYPE = 9, AVS_FILTER_NAME = 4, AVS_FILTER_AUTHOR = 5, AVS_FILTER_VERSION = 6, AVS_FILTER_ARGS = 7, AVS_FILTER_ARGS_INFO = 8, AVS_FILTER_ARGS_DESCRIPTION = 10, AVS_FILTER_DESCRIPTION = 11 }; enum { // SUBTYPES AVS_FILTER_TYPE_AUDIO = 1, AVS_FILTER_TYPE_VIDEO = 2, AVS_FILTER_OUTPUT_TYPE_SAME = 3, AVS_FILTER_OUTPUT_TYPE_DIFFERENT = 4 }; enum { // New 2.6 explicitly defined cache hints. AVS_CACHE_NOTHING = 10, // Do not cache video. AVS_CACHE_WINDOW = 11, // Hard protect up to X frames within a range of X from the current frame N. AVS_CACHE_GENERIC = 12, // LRU cache up to X frames. AVS_CACHE_FORCE_GENERIC = 13, // LRU cache up to X frames, override any previous CACHE_WINDOW. AVS_CACHE_GET_POLICY = 30, // Get the current policy. AVS_CACHE_GET_WINDOW = 31, // Get the current window h_span. AVS_CACHE_GET_RANGE = 32, // Get the current generic frame range. // Set Audio cache mode and answers to CACHE_GETCHILD_AUDIO_MODE AVS_CACHE_AUDIO = 50, // Explicitly do cache audio, X byte cache. AVS_CACHE_AUDIO_NOTHING = 51, // Explicitly do not cache audio. AVS_CACHE_AUDIO_NONE = 52, // Audio cache off (auto mode), X byte initial cache. AVS_CACHE_AUDIO_AUTO_START_OFF = 52, // synonym AVS_CACHE_AUDIO_AUTO = 53, // Audio cache on (auto mode), X byte initial cache. AVS_CACHE_AUDIO_AUTO_START_ON = 53, // synonym // These just returns actual value if clip is cached AVS_CACHE_GET_AUDIO_POLICY = 70, // Get the current audio policy. AVS_CACHE_GET_AUDIO_SIZE = 71, // Get the current audio cache size. AVS_CACHE_PREFETCH_FRAME = 100, // n/a Queue request to prefetch frame N. AVS_CACHE_PREFETCH_GO = 101, // n/a Action video prefetches. AVS_CACHE_PREFETCH_AUDIO_BEGIN = 120, // n/a Begin queue request transaction to prefetch audio (take critical section). AVS_CACHE_PREFETCH_AUDIO_STARTLO = 121, // n/a Set low 32 bits of start. AVS_CACHE_PREFETCH_AUDIO_STARTHI = 122, // n/a Set high 32 bits of start. AVS_CACHE_PREFETCH_AUDIO_COUNT = 123, // n/a Set low 32 bits of length. AVS_CACHE_PREFETCH_AUDIO_COMMIT = 124, // n/a Enqueue request transaction to prefetch audio (release critical section). AVS_CACHE_PREFETCH_AUDIO_GO = 125, // n/a Action audio prefetches. AVS_CACHE_GETCHILD_CACHE_MODE = 200, // n/a Cache ask Child for desired video cache mode. AVS_CACHE_GETCHILD_CACHE_SIZE = 201, // n/a Cache ask Child for desired video cache size. // Filters are queried about their desired audio cache mode. // Child can answer them with CACHE_AUDIO_xxx AVS_CACHE_GETCHILD_AUDIO_MODE = 202, // Cache ask Child for desired audio cache mode. AVS_CACHE_GETCHILD_AUDIO_SIZE = 203, // Cache ask Child for desired audio cache size. AVS_CACHE_GETCHILD_COST = 220, // n/a Cache ask Child for estimated processing cost. AVS_CACHE_COST_ZERO = 221, // n/a Child response of zero cost (ptr arithmetic only). AVS_CACHE_COST_UNIT = 222, // n/a Child response of unit cost (less than or equal 1 full frame blit). AVS_CACHE_COST_LOW = 223, // n/a Child response of light cost. (Fast) AVS_CACHE_COST_MED = 224, // n/a Child response of medium cost. (Real time) AVS_CACHE_COST_HI = 225, // n/a Child response of heavy cost. (Slow) AVS_CACHE_GETCHILD_THREAD_MODE = 240, // n/a Cache ask Child for thread safety. AVS_CACHE_THREAD_UNSAFE = 241, // n/a Only 1 thread allowed for all instances. 2.5 filters default! AVS_CACHE_THREAD_CLASS = 242, // n/a Only 1 thread allowed for each instance. 2.6 filters default! AVS_CACHE_THREAD_SAFE = 243, // n/a Allow all threads in any instance. AVS_CACHE_THREAD_OWN = 244, // n/a Safe but limit to 1 thread, internally threaded. AVS_CACHE_GETCHILD_ACCESS_COST = 260, // Cache ask Child for preferred access pattern. AVS_CACHE_ACCESS_RAND = 261, // Filter is access order agnostic. AVS_CACHE_ACCESS_SEQ0 = 262, // Filter prefers sequential access (low cost) AVS_CACHE_ACCESS_SEQ1 = 263, // Filter needs sequential access (high cost) AVS_CACHE_AVSPLUS_CONSTANTS = 500, // Smaller values are reserved for classic Avisynth AVS_CACHE_DONT_CACHE_ME = 501, // Filters that don't need caching (eg. trim, cache etc.) should return 1 to this request AVS_CACHE_SET_MIN_CAPACITY = 502, AVS_CACHE_SET_MAX_CAPACITY = 503, AVS_CACHE_GET_MIN_CAPACITY = 504, AVS_CACHE_GET_MAX_CAPACITY = 505, AVS_CACHE_GET_SIZE = 506, AVS_CACHE_GET_REQUESTED_CAP = 507, AVS_CACHE_GET_CAPACITY = 508, AVS_CACHE_GET_MTMODE = 509, // Filters specify their desired MT mode, see enum MtMode // By returning IS_CACHE_ANS to IS_CACHE_REQ, we tell the caller we are a cache AVS_CACHE_IS_CACHE_REQ = 510, AVS_CACHE_IS_CACHE_ANS = 511, // By returning IS_MTGUARD_ANS to IS_MTGUARD_REQ, we tell the caller we are an mt guard AVS_CACHE_IS_MTGUARD_REQ = 512, AVS_CACHE_IS_MTGUARD_ANS = 513, AVS_CACHE_AVSPLUS_CUDA_CONSTANTS = 600, AVS_CACHE_GET_DEV_TYPE = 601, // Device types a filter can return AVS_CACHE_GET_CHILD_DEV_TYPE = 602, // Device types a fitler can receive AVS_CACHE_USER_CONSTANTS = 1000 // Smaller values are reserved for the core }; // enums for frame property functions // AVSPropTypes enum { AVS_PROPTYPE_UNSET = 'u', AVS_PROPTYPE_INT = 'i', AVS_PROPTYPE_FLOAT = 'f', AVS_PROPTYPE_DATA = 's', AVS_PROPTYPE_CLIP = 'c', AVS_PROPTYPE_FRAME = 'v' }; // AVSGetPropErrors for avs_prop_get_... enum { AVS_GETPROPERROR_UNSET = 1, AVS_GETPROPERROR_TYPE = 2, AVS_GETPROPERROR_INDEX = 4 }; // AVSPropAppendMode for avs_prop_set_... enum { AVS_PROPAPPENDMODE_REPLACE = 0, AVS_PROPAPPENDMODE_APPEND = 1, AVS_PROPAPPENDMODE_TOUCH = 2 }; // AvsEnvProperty for avs_get_env_property enum { AVS_AEP_PHYSICAL_CPUS = 1, AVS_AEP_LOGICAL_CPUS = 2, AVS_AEP_THREADPOOL_THREADS = 3, AVS_AEP_FILTERCHAIN_THREADS = 4, AVS_AEP_THREAD_ID = 5, AVS_AEP_VERSION = 6, AVS_AEP_HOST_SYSTEM_ENDIANNESS = 7, AVS_AEP_INTERFACE_VERSION = 8, AVS_AEP_INTERFACE_BUGFIX = 9, // Neo additionals AVS_AEP_NUM_DEVICES = 901, AVS_AEP_FRAME_ALIGN = 902, AVS_AEP_PLANE_ALIGN = 903, AVS_AEP_SUPPRESS_THREAD = 921, AVS_AEP_GETFRAME_RECURSIVE = 922 }; // enum AvsAllocType for avs_allocate enum { AVS_ALLOCTYPE_NORMAL_ALLOC = 1, AVS_ALLOCTYPE_POOLED_ALLOC = 2 }; #ifdef BUILDING_AVSCORE AVSValue create_c_video_filter(AVSValue args, void * user_data, IScriptEnvironment * e0); struct AVS_ScriptEnvironment { IScriptEnvironment * env; const char * error; AVS_ScriptEnvironment(IScriptEnvironment * e = 0) : env(e), error(0) {} }; #endif typedef struct AVS_Clip AVS_Clip; typedef struct AVS_ScriptEnvironment AVS_ScriptEnvironment; ///////////////////////////////////////////////////////////////////// // // AVS_VideoInfo // // AVS_VideoInfo is laid out identically to VideoInfo typedef struct AVS_VideoInfo { int width, height; // width=0 means no video unsigned fps_numerator, fps_denominator; int num_frames; int pixel_type; int audio_samples_per_second; // 0 means no audio int sample_type; int64_t num_audio_samples; int nchannels; // Image type properties // BFF, TFF, FIELDBASED. Also used for storing Channel Mask // Manipulate it through the channelmask interface calls int image_type; } AVS_VideoInfo; // useful functions of the above AVSC_INLINE int avs_has_video(const AVS_VideoInfo * p) { return (p->width!=0); } AVSC_INLINE int avs_has_audio(const AVS_VideoInfo * p) { return (p->audio_samples_per_second!=0); } AVSC_INLINE int avs_is_rgb(const AVS_VideoInfo * p) { return !!(p->pixel_type&AVS_CS_BGR); } AVSC_INLINE int avs_is_rgb24(const AVS_VideoInfo * p) { return ((p->pixel_type&AVS_CS_BGR24)==AVS_CS_BGR24) && ((p->pixel_type & AVS_CS_SAMPLE_BITS_MASK) == AVS_CS_SAMPLE_BITS_8); } AVSC_INLINE int avs_is_rgb32(const AVS_VideoInfo * p) { return ((p->pixel_type&AVS_CS_BGR32)==AVS_CS_BGR32) && ((p->pixel_type & AVS_CS_SAMPLE_BITS_MASK) == AVS_CS_SAMPLE_BITS_8); } AVSC_INLINE int avs_is_yuv(const AVS_VideoInfo * p) { return !!(p->pixel_type&AVS_CS_YUV ); } AVSC_INLINE int avs_is_yuy2(const AVS_VideoInfo * p) { return (p->pixel_type & AVS_CS_YUY2) == AVS_CS_YUY2; } AVSC_API(int, avs_is_yv24)(const AVS_VideoInfo * p); // avs+: for generic 444 check, use avs_is_yuv444 AVSC_API(int, avs_is_yv16)(const AVS_VideoInfo * p); // avs+: for generic 422 check, use avs_is_yuv422 AVSC_API(int, avs_is_yv12)(const AVS_VideoInfo * p) ; // avs+: for generic 420 check, use avs_is_yuv420 AVSC_API(int, avs_is_yv411)(const AVS_VideoInfo * p); AVSC_API(int, avs_is_y8)(const AVS_VideoInfo * p); // avs+: for generic grayscale, use avs_is_y AVSC_API(int, avs_get_plane_width_subsampling)(const AVS_VideoInfo * p, int plane); AVSC_API(int, avs_get_plane_height_subsampling)(const AVS_VideoInfo * p, int plane); AVSC_API(int, avs_bits_per_pixel)(const AVS_VideoInfo * p); AVSC_API(int, avs_bytes_from_pixels)(const AVS_VideoInfo * p, int pixels); AVSC_API(int, avs_row_size)(const AVS_VideoInfo * p, int plane); AVSC_API(int, avs_bmp_size)(const AVS_VideoInfo * vi); AVSC_API(int, avs_is_color_space)(const AVS_VideoInfo * p, int c_space); // no API for these, inline helper functions AVSC_INLINE int avs_is_property(const AVS_VideoInfo * p, int property) { return ((p->image_type & property) == property); } AVSC_INLINE int avs_is_planar(const AVS_VideoInfo * p) { return !!(p->pixel_type & AVS_CS_PLANAR); } AVSC_INLINE int avs_is_field_based(const AVS_VideoInfo * p) { return !!(p->image_type & AVS_IT_FIELDBASED); } AVSC_INLINE int avs_is_parity_known(const AVS_VideoInfo * p) { return ((p->image_type & AVS_IT_FIELDBASED) && (p->image_type & (AVS_IT_BFF | AVS_IT_TFF))); } AVSC_INLINE int avs_is_bff(const AVS_VideoInfo * p) { return !!(p->image_type & AVS_IT_BFF); } AVSC_INLINE int avs_is_tff(const AVS_VideoInfo * p) { return !!(p->image_type & AVS_IT_TFF); } AVSC_INLINE int avs_samples_per_second(const AVS_VideoInfo * p) { return p->audio_samples_per_second; } AVSC_INLINE int avs_bytes_per_channel_sample(const AVS_VideoInfo * p) { switch (p->sample_type) { case AVS_SAMPLE_INT8: return sizeof(signed char); case AVS_SAMPLE_INT16: return sizeof(signed short); case AVS_SAMPLE_INT24: return 3; case AVS_SAMPLE_INT32: return sizeof(signed int); case AVS_SAMPLE_FLOAT: return sizeof(float); default: return 0; } } AVSC_INLINE int avs_bytes_per_audio_sample(const AVS_VideoInfo * p) { return p->nchannels*avs_bytes_per_channel_sample(p);} AVSC_INLINE int64_t avs_audio_samples_from_frames(const AVS_VideoInfo * p, int64_t frames) { return ((int64_t)(frames) * p->audio_samples_per_second * p->fps_denominator / p->fps_numerator); } AVSC_INLINE int avs_frames_from_audio_samples(const AVS_VideoInfo * p, int64_t samples) { return (int)(samples * (int64_t)p->fps_numerator / (int64_t)p->fps_denominator / (int64_t)p->audio_samples_per_second); } AVSC_INLINE int64_t avs_audio_samples_from_bytes(const AVS_VideoInfo * p, int64_t bytes) { return bytes / avs_bytes_per_audio_sample(p); } AVSC_INLINE int64_t avs_bytes_from_audio_samples(const AVS_VideoInfo * p, int64_t samples) { return samples * avs_bytes_per_audio_sample(p); } AVSC_INLINE int avs_audio_channels(const AVS_VideoInfo * p) { return p->nchannels; } AVSC_INLINE int avs_sample_type(const AVS_VideoInfo * p) { return p->sample_type;} // useful mutator // Note: these are video format properties, neither frame properties, nor system properties AVSC_INLINE void avs_set_property(AVS_VideoInfo * p, int property) { p->image_type|=property; } AVSC_INLINE void avs_clear_property(AVS_VideoInfo * p, int property) { p->image_type&=~property; } AVSC_INLINE void avs_set_field_based(AVS_VideoInfo * p, int isfieldbased) { if (isfieldbased) p->image_type|=AVS_IT_FIELDBASED; else p->image_type&=~AVS_IT_FIELDBASED; } AVSC_INLINE void avs_set_fps(AVS_VideoInfo * p, unsigned numerator, unsigned denominator) { unsigned x=numerator, y=denominator; while (y) { // find gcd unsigned t = x%y; x = y; y = t; } p->fps_numerator = numerator/x; p->fps_denominator = denominator/x; } #ifndef AVSC_NO_DECLSPEC // this inline function is calling an API function AVSC_INLINE int avs_is_same_colorspace(const AVS_VideoInfo * x, const AVS_VideoInfo * y) { return (x->pixel_type == y->pixel_type) || (avs_is_yv12(x) && avs_is_yv12(y)); } #endif // AviSynth+ extensions AVSC_API(int, avs_is_rgb48)(const AVS_VideoInfo * p); AVSC_API(int, avs_is_rgb64)(const AVS_VideoInfo * p); AVSC_API(int, avs_is_yuv444p16)(const AVS_VideoInfo * p); // deprecated, use avs_is_yuv444 AVSC_API(int, avs_is_yuv422p16)(const AVS_VideoInfo * p); // deprecated, use avs_is_yuv422 AVSC_API(int, avs_is_yuv420p16)(const AVS_VideoInfo * p); // deprecated, use avs_is_yuv420 AVSC_API(int, avs_is_y16)(const AVS_VideoInfo * p); // deprecated, use avs_is_y AVSC_API(int, avs_is_yuv444ps)(const AVS_VideoInfo * p); // deprecated, use avs_is_yuv444 AVSC_API(int, avs_is_yuv422ps)(const AVS_VideoInfo * p); // deprecated, use avs_is_yuv422 AVSC_API(int, avs_is_yuv420ps)(const AVS_VideoInfo * p); // deprecated, use avs_is_yuv420 AVSC_API(int, avs_is_y32)(const AVS_VideoInfo * p); // deprecated, use avs_is_y AVSC_API(int, avs_is_444)(const AVS_VideoInfo * p); AVSC_API(int, avs_is_422)(const AVS_VideoInfo * p); AVSC_API(int, avs_is_420)(const AVS_VideoInfo * p); AVSC_API(int, avs_is_y)(const AVS_VideoInfo * p); AVSC_API(int, avs_is_yuva)(const AVS_VideoInfo * p); AVSC_API(int, avs_is_planar_rgb)(const AVS_VideoInfo * p); AVSC_API(int, avs_is_planar_rgba)(const AVS_VideoInfo * p); AVSC_API(int, avs_num_components)(const AVS_VideoInfo * p); AVSC_API(int, avs_component_size)(const AVS_VideoInfo * p); AVSC_API(int, avs_bits_per_component)(const AVS_VideoInfo * p); // V10 AVSC_API(bool, avs_is_channel_mask_known)(const AVS_VideoInfo* p); AVSC_API(void, avs_set_channel_mask)(const AVS_VideoInfo* p, bool isChannelMaskKnown, unsigned int dwChannelMask); AVSC_API(unsigned int, avs_get_channel_mask)(const AVS_VideoInfo* p); // end of Avisynth+ specific ///////////////////////////////////////////////////////////////////// // // AVS_VideoFrame // // VideoFrameBuffer holds information about a memory block which is used // for video data. For efficiency, instances of this class are not deleted // when the refcount reaches zero; instead they're stored in a linked list // to be reused. The instances are deleted when the corresponding AVS // file is closed. // AVS_VideoFrameBuffer is laid out identically to VideoFrameBuffer // DO NOT USE THIS STRUCTURE DIRECTLY typedef struct AVS_VideoFrameBuffer { BYTE * data; int data_size; // sequence_number is incremented every time the buffer is changed, so // that stale views can tell they're no longer valid. volatile long sequence_number; volatile long refcount; void* device; // avs+ } AVS_VideoFrameBuffer; // VideoFrame holds a "window" into a VideoFrameBuffer. // AVS_VideoFrame is laid out identically to VideoFrame // DO NOT USE THIS STRUCTURE DIRECTLY typedef struct AVS_VideoFrame { volatile long refcount; AVS_VideoFrameBuffer * vfb; int offset; // DO NOT USE THEM DIRECTLY // Use avs_get_pitch_p, avs_get_row_size_p, avs_get_height_p int pitch, row_size, height; int offsetU, offsetV; int pitchUV; // U&V offsets are from top of picture. int row_sizeUV, heightUV; // for Planar RGB offsetU, offsetV is for the 2nd and 3rd Plane. // for Planar RGB pitchUV and row_sizeUV = 0, because when no VideoInfo (MakeWriteable) // the decision on existence of UV is checked by zero pitch // AVS+ extension, avisynth.h: class does not break plugins if appended here int offsetA; int pitchA, row_sizeA; // 4th alpha plane support, pitch and row_size is 0 is none void* properties; // interface V8: frame properties // DO NOT USE DIRECTLY // Use avs_video_frame_get_pixel_type (and avs_video_frame_amend_pixel_type in special cases) int pixel_type; // Interface V10: an automatically maintained copy from AVS_VideoInfo } AVS_VideoFrame; // Access functions for AVS_VideoFrame AVSC_API(int, avs_get_pitch_p)(const AVS_VideoFrame * p, int plane); AVSC_API(int, avs_get_row_size_p)(const AVS_VideoFrame * p, int plane); AVSC_API(int, avs_get_height_p)(const AVS_VideoFrame * p, int plane); AVSC_API(const BYTE *, avs_get_read_ptr_p)(const AVS_VideoFrame * p, int plane); AVSC_API(int, avs_is_writable)(const AVS_VideoFrame * p); // V9 AVSC_API(int, avs_is_property_writable)(const AVS_VideoFrame* p); AVSC_API(BYTE *, avs_get_write_ptr_p)(const AVS_VideoFrame * p, int plane); AVSC_API(void, avs_release_video_frame)(AVS_VideoFrame *); // makes a shallow copy of a video frame AVSC_API(AVS_VideoFrame *, avs_copy_video_frame)(AVS_VideoFrame *); // V10 AVSC_API(int, avs_video_frame_get_pixel_type)(const AVS_VideoFrame* p); // V10 AVSC_API(void, avs_video_frame_amend_pixel_type)(AVS_VideoFrame* p, int new_pixel_type); // no API for these, inline helper functions #ifndef AVSC_NO_DECLSPEC // this inline function is calling an API function AVSC_INLINE int avs_get_pitch(const AVS_VideoFrame * p) { return avs_get_pitch_p(p, 0); } #endif #ifndef AVSC_NO_DECLSPEC // this inline function is calling an API function AVSC_INLINE int avs_get_row_size(const AVS_VideoFrame * p) { return avs_get_row_size_p(p, 0); } #endif #ifndef AVSC_NO_DECLSPEC // this inline function is calling an API function AVSC_INLINE int avs_get_height(const AVS_VideoFrame * p) { return avs_get_height_p(p, 0); } #endif #ifndef AVSC_NO_DECLSPEC // this inline function is calling an API function AVSC_INLINE const BYTE* avs_get_read_ptr(const AVS_VideoFrame * p) { return avs_get_read_ptr_p(p, 0);} #endif #ifndef AVSC_NO_DECLSPEC // this inline function is calling an API function AVSC_INLINE BYTE* avs_get_write_ptr(const AVS_VideoFrame * p) { return avs_get_write_ptr_p(p, 0);} #endif #ifndef AVSC_NO_DECLSPEC // this inline function is calling an API function AVSC_INLINE void avs_release_frame(AVS_VideoFrame * f) {avs_release_video_frame(f);} #endif #ifndef AVSC_NO_DECLSPEC // this inline function is calling an API function AVSC_INLINE AVS_VideoFrame * avs_copy_frame(AVS_VideoFrame * f) {return avs_copy_video_frame(f);} #endif // Interface V8: frame properties // AVS_Map is just a placeholder for AVSMap typedef struct AVS_Map { void* data; } AVS_Map; ///////////////////////////////////////////////////////////////////// // // AVS_Value // // Treat AVS_Value as a fat pointer. That is use avs_copy_value // and avs_release_value appropriately as you would if AVS_Value was // a pointer. // To maintain source code compatibility with future versions of the // avisynth_c API don't use the AVS_Value directly. Use the helper // functions below. // AVS_Value is laid out identically to AVSValue typedef struct AVS_Value AVS_Value; struct AVS_Value { short type; // 'a'rray, 'c'lip, 'b'ool, 'i'nt, 'f'loat, 's'tring, 'v'oid, or 'l'ong, or fu'n'ction // for some function e'rror short array_size; union { void * clip; // do not use directly, use avs_take_clip char boolean; int integer; float floating_pt; const char * string; const AVS_Value * array; void * function; // not supported on C interface #ifdef X86_64 // if ever, only x64 will support. It breaks struct size on 32 bit int64_t longlong; // 8 bytes double double_pt; // 8 bytes #endif } d; }; // AVS_Value should be initialized with avs_void. // Should also set to avs_void after the value is released // with avs_copy_value. Consider it the equivalent of setting // a pointer to NULL static const AVS_Value avs_void = {'v'}; AVSC_API(void, avs_copy_value)(AVS_Value * dest, AVS_Value src); AVSC_API(void, avs_release_value)(AVS_Value); AVSC_API(AVS_Clip *, avs_take_clip)(AVS_Value, AVS_ScriptEnvironment *); AVSC_API(void, avs_set_to_clip)(AVS_Value *, AVS_Clip *); // no API for these, inline helper functions AVSC_INLINE int avs_defined(AVS_Value v) { return v.type != 'v'; } AVSC_INLINE int avs_is_clip(AVS_Value v) { return v.type == 'c'; } AVSC_INLINE int avs_is_bool(AVS_Value v) { return v.type == 'b'; } AVSC_INLINE int avs_is_int(AVS_Value v) { return v.type == 'i'; } AVSC_INLINE int avs_is_float(AVS_Value v) { return v.type == 'f' || v.type == 'i'; } AVSC_INLINE int avs_is_string(AVS_Value v) { return v.type == 's'; } AVSC_INLINE int avs_is_array(AVS_Value v) { return v.type == 'a'; } AVSC_INLINE int avs_is_error(AVS_Value v) { return v.type == 'e'; } AVSC_INLINE int avs_as_bool(AVS_Value v) { return v.d.boolean; } AVSC_INLINE int avs_as_int(AVS_Value v) { return v.d.integer; } AVSC_INLINE const char * avs_as_string(AVS_Value v) { return avs_is_error(v) || avs_is_string(v) ? v.d.string : 0; } AVSC_INLINE double avs_as_float(AVS_Value v) { return avs_is_int(v) ? v.d.integer : v.d.floating_pt; } AVSC_INLINE const char * avs_as_error(AVS_Value v) { return avs_is_error(v) ? v.d.string : 0; } AVSC_INLINE const AVS_Value * avs_as_array(AVS_Value v) { return v.d.array; } AVSC_INLINE int avs_array_size(AVS_Value v) { return avs_is_array(v) ? v.array_size : 1; } AVSC_INLINE AVS_Value avs_array_elt(AVS_Value v, int index) { return avs_is_array(v) ? v.d.array[index] : v; } // only use these functions on an AVS_Value that does not already have // an active value. Remember, treat AVS_Value as a fat pointer. AVSC_INLINE AVS_Value avs_new_value_bool(int v0) { AVS_Value v; v.type = 'b'; v.d.boolean = v0 == 0 ? 0 : 1; return v; } AVSC_INLINE AVS_Value avs_new_value_int(int v0) { AVS_Value v; v.type = 'i'; v.d.integer = v0; return v; } AVSC_INLINE AVS_Value avs_new_value_string(const char * v0) { AVS_Value v; v.type = 's'; v.d.string = v0; return v; } AVSC_INLINE AVS_Value avs_new_value_float(float v0) { AVS_Value v; v.type = 'f'; v.d.floating_pt = v0; return v;} AVSC_INLINE AVS_Value avs_new_value_error(const char * v0) { AVS_Value v; v.type = 'e'; v.d.string = v0; return v; } #ifndef AVSC_NO_DECLSPEC // this inline function is calling an API function AVSC_INLINE AVS_Value avs_new_value_clip(AVS_Clip * v0) { AVS_Value v; avs_set_to_clip(&v, v0); return v; } #endif AVSC_INLINE AVS_Value avs_new_value_array(AVS_Value * v0, int size) { AVS_Value v; v.type = 'a'; v.d.array = v0; v.array_size = (short)size; return v; } // end of inline helper functions ///////////////////////////////////////////////////////////////////// // // AVS_Clip // AVSC_API(void, avs_release_clip)(AVS_Clip *); AVSC_API(AVS_Clip *, avs_copy_clip)(AVS_Clip *); AVSC_API(const char *, avs_clip_get_error)(AVS_Clip *); // return 0 if no error AVSC_API(const AVS_VideoInfo *, avs_get_video_info)(AVS_Clip *); AVSC_API(int, avs_get_version)(AVS_Clip *); AVSC_API(AVS_VideoFrame *, avs_get_frame)(AVS_Clip *, int n); // The returned video frame must be released with avs_release_video_frame AVSC_API(int, avs_get_parity)(AVS_Clip *, int n); // return field parity if field_based, else parity of first field in frame AVSC_API(int, avs_get_audio)(AVS_Clip *, void * buf, int64_t start, int64_t count); // start and count are in samples AVSC_API(int, avs_set_cache_hints)(AVS_Clip *, int cachehints, int frame_range); // This is the callback type used by avs_add_function typedef AVS_Value (AVSC_CC * AVS_ApplyFunc) (AVS_ScriptEnvironment *, AVS_Value args, void * user_data); typedef struct AVS_FilterInfo AVS_FilterInfo; struct AVS_FilterInfo { // these members should not be modified outside of the AVS_ApplyFunc callback AVS_Clip * child; AVS_VideoInfo vi; AVS_ScriptEnvironment * env; AVS_VideoFrame * (AVSC_CC * get_frame)(AVS_FilterInfo *, int n); int (AVSC_CC * get_parity)(AVS_FilterInfo *, int n); int (AVSC_CC * get_audio)(AVS_FilterInfo *, void * buf, int64_t start, int64_t count); int (AVSC_CC * set_cache_hints)(AVS_FilterInfo *, int cachehints, int frame_range); void (AVSC_CC * free_filter)(AVS_FilterInfo *); // Should be set when ever there is an error to report. // It is cleared before any of the above methods are called const char * error; // this is to store whatever and may be modified at will void * user_data; }; // Create a new filter // fi is set to point to the AVS_FilterInfo so that you can // modify it once it is initialized. // store_child should generally be set to true. If it is not // set than ALL methods (the function pointers) must be defined // If it is set than you do not need to worry about freeing the child // clip. AVSC_API(AVS_Clip *, avs_new_c_filter)(AVS_ScriptEnvironment * e, AVS_FilterInfo * * fi, AVS_Value child, int store_child); ///////////////////////////////////////////////////////////////////// // // AVS_ScriptEnvironment // // For GetCPUFlags. These are backwards-compatible with those in VirtualDub. enum { /* slowest CPU to support extension */ AVS_CPU_FORCE = 0x01, // N/A AVS_CPU_FPU = 0x02, // 386/486DX AVS_CPU_MMX = 0x04, // P55C, K6, PII AVS_CPU_INTEGER_SSE = 0x08, // PIII, Athlon AVS_CPU_SSE = 0x10, // PIII, Athlon XP/MP AVS_CPU_SSE2 = 0x20, // PIV, Hammer AVS_CPU_3DNOW = 0x40, // K6-2 AVS_CPU_3DNOW_EXT = 0x80, // Athlon AVS_CPU_X86_64 = 0xA0, // Hammer (note: equiv. to 3DNow + SSE2, // which only Hammer will have anyway) AVS_CPUF_SSE3 = 0x100, // PIV+, K8 Venice AVS_CPUF_SSSE3 = 0x200, // Core 2 AVS_CPUF_SSE4 = 0x400, // Penryn, Wolfdale, Yorkfield AVS_CPUF_SSE4_1 = 0x400, AVS_CPUF_AVX = 0x800, // Sandy Bridge, Bulldozer AVS_CPUF_SSE4_2 = 0x1000, // Nehalem // AVS+ AVS_CPUF_AVX2 = 0x2000, // Haswell AVS_CPUF_FMA3 = 0x4000, AVS_CPUF_F16C = 0x8000, AVS_CPUF_MOVBE = 0x10000, // Big Endian Move AVS_CPUF_POPCNT = 0x20000, AVS_CPUF_AES = 0x40000, AVS_CPUF_FMA4 = 0x80000, AVS_CPUF_AVX512F = 0x100000, // AVX-512 Foundation. AVS_CPUF_AVX512DQ = 0x200000, // AVX-512 DQ (Double/Quad granular) Instructions AVS_CPUF_AVX512PF = 0x400000, // AVX-512 Prefetch AVS_CPUF_AVX512ER = 0x800000, // AVX-512 Exponential and Reciprocal AVS_CPUF_AVX512CD = 0x1000000, // AVX-512 Conflict Detection AVS_CPUF_AVX512BW = 0x2000000, // AVX-512 BW (Byte/Word granular) Instructions AVS_CPUF_AVX512VL = 0x4000000, // AVX-512 VL (128/256 Vector Length) Extensions AVS_CPUF_AVX512IFMA = 0x8000000, // AVX-512 IFMA integer 52 bit AVS_CPUF_AVX512VBMI = 0x10000000 // AVX-512 VBMI }; AVSC_API(const char *, avs_get_error)(AVS_ScriptEnvironment *); // return 0 if no error AVSC_API(int, avs_get_cpu_flags)(AVS_ScriptEnvironment *); AVSC_API(int, avs_check_version)(AVS_ScriptEnvironment *, int version); AVSC_API(char *, avs_save_string)(AVS_ScriptEnvironment *, const char* s, int length); AVSC_API(char *, avs_sprintf)(AVS_ScriptEnvironment *, const char * fmt, ...); AVSC_API(char *, avs_vsprintf)(AVS_ScriptEnvironment *, const char * fmt, va_list val); AVSC_API(int, avs_add_function)(AVS_ScriptEnvironment *, const char * name, const char * params, AVS_ApplyFunc apply, void * user_data); AVSC_API(int, avs_function_exists)(AVS_ScriptEnvironment *, const char * name); AVSC_API(AVS_Value, avs_invoke)(AVS_ScriptEnvironment *, const char * name, AVS_Value args, const char** arg_names); // The returned value must be be released with avs_release_value AVSC_API(AVS_Value, avs_get_var)(AVS_ScriptEnvironment *, const char* name); // The returned value must be be released with avs_release_value AVSC_API(int, avs_set_var)(AVS_ScriptEnvironment *, const char* name, AVS_Value val); AVSC_API(int, avs_set_global_var)(AVS_ScriptEnvironment *, const char* name, const AVS_Value val); //void avs_push_context(AVS_ScriptEnvironment *, int level=0); //void avs_pop_context(AVS_ScriptEnvironment *); // partially deprecated, from V8 use avs_new_video_frame_p_a (frame property copy) AVSC_API(AVS_VideoFrame *, avs_new_video_frame_a)(AVS_ScriptEnvironment *, const AVS_VideoInfo * vi, int align); // align should be at least 16 for classic Avisynth // Avisynth+: any value, Avs+ ensures a minimum alignment if too small align is provided // no API for these, inline helper functions #ifndef AVSC_NO_DECLSPEC // partially deprecated, from V8 use avs_new_video_frame_p (frame property copy) // this inline function is calling an API function AVSC_INLINE AVS_VideoFrame * avs_new_video_frame(AVS_ScriptEnvironment * env, const AVS_VideoInfo * vi) {return avs_new_video_frame_a(env,vi,AVS_FRAME_ALIGN);} // an older compatibility alias // this inline function is calling an API function AVSC_INLINE AVS_VideoFrame * avs_new_frame(AVS_ScriptEnvironment * env, const AVS_VideoInfo * vi) {return avs_new_video_frame_a(env,vi,AVS_FRAME_ALIGN);} #endif // end of inline helper functions AVSC_API(int, avs_make_writable)(AVS_ScriptEnvironment *, AVS_VideoFrame * * pvf); // V9 AVSC_API(int, avs_make_property_writable)(AVS_ScriptEnvironment*, AVS_VideoFrame** pvf); AVSC_API(void, avs_bit_blt)(AVS_ScriptEnvironment *, BYTE* dstp, int dst_pitch, const BYTE* srcp, int src_pitch, int row_size, int height); typedef void (AVSC_CC *AVS_ShutdownFunc)(void* user_data, AVS_ScriptEnvironment * env); AVSC_API(void, avs_at_exit)(AVS_ScriptEnvironment *, AVS_ShutdownFunc function, void * user_data); AVSC_API(AVS_VideoFrame *, avs_subframe)(AVS_ScriptEnvironment *, AVS_VideoFrame * src, int rel_offset, int new_pitch, int new_row_size, int new_height); // The returned video frame must be be released AVSC_API(AVS_VideoFrame*, avs_subframe_planar)(AVS_ScriptEnvironment*, AVS_VideoFrame* src, int rel_offset, int new_pitch, int new_row_size, int new_height, int rel_offsetU, int rel_offsetV, int new_pitchUV); // The returned video frame must be be released // see also avs_subframe_planar_a in interface V8 AVSC_API(int, avs_set_memory_max)(AVS_ScriptEnvironment *, int mem); AVSC_API(int, avs_set_working_dir)(AVS_ScriptEnvironment *, const char * newdir); // avisynth.dll exports this; it's a way to use it as a library, without // writing an AVS script or without going through AVIFile. AVSC_API(AVS_ScriptEnvironment *, avs_create_script_environment)(int version); // this symbol is the entry point for the plugin and must // be defined AVSC_EXPORT const char * AVSC_CC avisynth_c_plugin_init(AVS_ScriptEnvironment* env); AVSC_API(void, avs_delete_script_environment)(AVS_ScriptEnvironment *); /////////////////////////////////////////////////////////////////////////////// // // Avisynth+ V8 interface elements // AVSC_API(AVS_VideoFrame*, avs_subframe_planar_a)(AVS_ScriptEnvironment*, AVS_VideoFrame* src, int rel_offset, int new_pitch, int new_row_size, int new_height, int rel_offsetU, int rel_offsetV, int new_pitchUV, int rel_offsetA); // The returned video frame must be be released AVSC_API(void, avs_copy_frame_props)(AVS_ScriptEnvironment* p, const AVS_VideoFrame* src, AVS_VideoFrame* dst); AVSC_API(const AVS_Map*, avs_get_frame_props_ro)(AVS_ScriptEnvironment* p, const AVS_VideoFrame* frame); AVSC_API(AVS_Map*, avs_get_frame_props_rw)(AVS_ScriptEnvironment* p, AVS_VideoFrame* frame); AVSC_API(int, avs_prop_num_keys)(AVS_ScriptEnvironment* p, const AVS_Map* map); AVSC_API(const char*, avs_prop_get_key)(AVS_ScriptEnvironment* p, const AVS_Map* map, int index); AVSC_API(int, avs_prop_num_elements)(AVS_ScriptEnvironment* p, const AVS_Map* map, const char* key); // see AVS_PROPTYPE_... enums AVSC_API(char, avs_prop_get_type)(AVS_ScriptEnvironment* p, const AVS_Map* map, const char* key); // see AVS_GETPROPERROR_... enums AVSC_API(int64_t, avs_prop_get_int)(AVS_ScriptEnvironment* p, const AVS_Map* map, const char* key, int index, int* error); AVSC_API(double, avs_prop_get_float)(AVS_ScriptEnvironment* p, const AVS_Map* map, const char* key, int index, int* error); // Note: avs_prop_get_data was fixed in interface V9.1 AVSC_API(const char*, avs_prop_get_data)(AVS_ScriptEnvironment* p, const AVS_Map* map, const char* key, int index, int* error); AVSC_API(int, avs_prop_get_data_size)(AVS_ScriptEnvironment* p, const AVS_Map* map, const char* key, int index, int* error); AVSC_API(AVS_Clip*, avs_prop_get_clip)(AVS_ScriptEnvironment* p, const AVS_Map* map, const char* key, int index, int* error); AVSC_API(const AVS_VideoFrame*, avs_prop_get_frame)(AVS_ScriptEnvironment* p, const AVS_Map* map, const char* key, int index, int* error); AVSC_API(int, avs_prop_delete_key)(AVS_ScriptEnvironment* p, AVS_Map* map, const char* key); // see AVS_PROPAPPENDMODE_... enums AVSC_API(int, avs_prop_set_int)(AVS_ScriptEnvironment* p, AVS_Map* map, const char* key, int64_t i, int append); AVSC_API(int, avs_prop_set_float)(AVS_ScriptEnvironment* p, AVS_Map* map, const char* key, double d, int append); AVSC_API(int, avs_prop_set_data)(AVS_ScriptEnvironment* p, AVS_Map* map, const char* key, const char* d, int length, int append); AVSC_API(int, avs_prop_set_clip)(AVS_ScriptEnvironment* p, AVS_Map* map, const char* key, AVS_Clip* clip, int append); AVSC_API(int, avs_prop_set_frame)(AVS_ScriptEnvironment* p, AVS_Map* map, const char* key, const AVS_VideoFrame* frame, int append); AVSC_API(const int64_t*, avs_prop_get_int_array)(AVS_ScriptEnvironment* p, const AVS_Map* map, const char* key, int* error); AVSC_API(const double*, avs_prop_get_float_array)(AVS_ScriptEnvironment* p, const AVS_Map* map, const char* key, int* error); AVSC_API(int, avs_prop_set_int_array)(AVS_ScriptEnvironment* p, AVS_Map* map, const char* key, const int64_t* i, int size); AVSC_API(int, avs_prop_set_float_array)(AVS_ScriptEnvironment* p, AVS_Map* map, const char* key, const double* d, int size); AVSC_API(void, avs_clear_map)(AVS_ScriptEnvironment* p, AVS_Map* map); // with frame property source AVSC_API(AVS_VideoFrame*, avs_new_video_frame_p)(AVS_ScriptEnvironment*, const AVS_VideoInfo* vi, const AVS_VideoFrame* prop_src); // with frame property source AVSC_API(AVS_VideoFrame*, avs_new_video_frame_p_a)(AVS_ScriptEnvironment*, const AVS_VideoInfo* vi, const AVS_VideoFrame* prop_src, int align); // Generic query to ask for various system properties, see AVS_AEP_xxx enums AVSC_API(size_t, avs_get_env_property)(AVS_ScriptEnvironment*, int avs_aep_prop); // buffer pool, see AVS_ALLOCTYPE enums AVSC_API(void *, avs_pool_allocate)(AVS_ScriptEnvironment*, size_t nBytes, size_t alignment, int avs_alloc_type); AVSC_API(void, avs_pool_free)(AVS_ScriptEnvironment*, void *ptr); // Interface V8 // Returns TRUE (1) and the requested variable. If the method fails, returns 0 (FALSE) and does not touch 'val'. // The returned AVS_Value *val value must be be released with avs_release_value only on success // AVS_Value *val is not caller allocated AVSC_API(int, avs_get_var_try)(AVS_ScriptEnvironment*, const char* name, AVS_Value* val); // Interface V8 // Return the value of the requested variable. // If the variable was not found or had the wrong type, // return the supplied default value. AVSC_API(int, avs_get_var_bool)(AVS_ScriptEnvironment*, const char* name, int def); AVSC_API(int, avs_get_var_int)(AVS_ScriptEnvironment*, const char* name, int def); AVSC_API(double, avs_get_var_double)(AVS_ScriptEnvironment*, const char* name, double def); AVSC_API(const char*, avs_get_var_string)(AVS_ScriptEnvironment*, const char* name, const char* def); AVSC_API(int64_t, avs_get_var_long)(AVS_ScriptEnvironment*, const char* name, int64_t def); #if defined(AVS_WINDOWS) // The following stuff is only relevant for Windows DLL handling; Linux does it completely differently. #ifdef AVSC_NO_DECLSPEC // This part uses LoadLibrary and related functions to dynamically load Avisynth instead of declspec(dllimport) // When AVSC_NO_DECLSPEC is defined, you can use avs_load_library to populate API functions into a struct // AVSC_INLINE functions which call onto an API functions should be treated specially (todo) /* The following functions needs to have been declared, probably from windows.h void* malloc(size_t) void free(void*); HMODULE LoadLibraryA(const char*); void* GetProcAddress(HMODULE, const char*); FreeLibrary(HMODULE); */ typedef struct AVS_Library AVS_Library; #define AVSC_DECLARE_FUNC(name) name##_func name // AVSC_DECLARE_FUNC helps keeping naming convention: type is xxxxx_func, function name is xxxxx // e.g. "AVSC_DECLARE_FUNC(avs_add_function);" // is a shortcut for "avs_add_function_func avs_add_function;" // Note: AVSC_INLINE functions, which call into API, // are guarded by #ifndef AVSC_NO_DECLSPEC. // They should call the appropriate library-> API entry. struct AVS_Library { HMODULE handle; AVSC_DECLARE_FUNC(avs_add_function); AVSC_DECLARE_FUNC(avs_at_exit); AVSC_DECLARE_FUNC(avs_bit_blt); AVSC_DECLARE_FUNC(avs_check_version); AVSC_DECLARE_FUNC(avs_clip_get_error); AVSC_DECLARE_FUNC(avs_copy_clip); AVSC_DECLARE_FUNC(avs_copy_value); AVSC_DECLARE_FUNC(avs_copy_video_frame); AVSC_DECLARE_FUNC(avs_create_script_environment); AVSC_DECLARE_FUNC(avs_delete_script_environment); AVSC_DECLARE_FUNC(avs_function_exists); AVSC_DECLARE_FUNC(avs_get_audio); AVSC_DECLARE_FUNC(avs_get_cpu_flags); AVSC_DECLARE_FUNC(avs_get_frame); AVSC_DECLARE_FUNC(avs_get_parity); AVSC_DECLARE_FUNC(avs_get_var); AVSC_DECLARE_FUNC(avs_get_version); AVSC_DECLARE_FUNC(avs_get_video_info); AVSC_DECLARE_FUNC(avs_invoke); AVSC_DECLARE_FUNC(avs_make_writable); AVSC_DECLARE_FUNC(avs_new_c_filter); AVSC_DECLARE_FUNC(avs_new_video_frame_a); AVSC_DECLARE_FUNC(avs_release_clip); AVSC_DECLARE_FUNC(avs_release_value); AVSC_DECLARE_FUNC(avs_release_video_frame); AVSC_DECLARE_FUNC(avs_save_string); AVSC_DECLARE_FUNC(avs_set_cache_hints); AVSC_DECLARE_FUNC(avs_set_global_var); AVSC_DECLARE_FUNC(avs_set_memory_max); AVSC_DECLARE_FUNC(avs_set_to_clip); AVSC_DECLARE_FUNC(avs_set_var); AVSC_DECLARE_FUNC(avs_set_working_dir); AVSC_DECLARE_FUNC(avs_sprintf); AVSC_DECLARE_FUNC(avs_subframe); AVSC_DECLARE_FUNC(avs_subframe_planar); AVSC_DECLARE_FUNC(avs_take_clip); AVSC_DECLARE_FUNC(avs_vsprintf); AVSC_DECLARE_FUNC(avs_get_error); AVSC_DECLARE_FUNC(avs_is_yv24); AVSC_DECLARE_FUNC(avs_is_yv16); AVSC_DECLARE_FUNC(avs_is_yv12); AVSC_DECLARE_FUNC(avs_is_yv411); AVSC_DECLARE_FUNC(avs_is_y8); AVSC_DECLARE_FUNC(avs_is_color_space); AVSC_DECLARE_FUNC(avs_get_plane_width_subsampling); AVSC_DECLARE_FUNC(avs_get_plane_height_subsampling); AVSC_DECLARE_FUNC(avs_bits_per_pixel); AVSC_DECLARE_FUNC(avs_bytes_from_pixels); AVSC_DECLARE_FUNC(avs_row_size); AVSC_DECLARE_FUNC(avs_bmp_size); AVSC_DECLARE_FUNC(avs_get_pitch_p); AVSC_DECLARE_FUNC(avs_get_row_size_p); AVSC_DECLARE_FUNC(avs_get_height_p); AVSC_DECLARE_FUNC(avs_get_read_ptr_p); AVSC_DECLARE_FUNC(avs_is_writable); AVSC_DECLARE_FUNC(avs_get_write_ptr_p); // Avisynth+ specific // Note: these functions are simulated/use fallback to existing functions AVSC_DECLARE_FUNC(avs_is_rgb48); AVSC_DECLARE_FUNC(avs_is_rgb64); AVSC_DECLARE_FUNC(avs_is_yuv444p16); AVSC_DECLARE_FUNC(avs_is_yuv422p16); AVSC_DECLARE_FUNC(avs_is_yuv420p16); AVSC_DECLARE_FUNC(avs_is_y16); AVSC_DECLARE_FUNC(avs_is_yuv444ps); AVSC_DECLARE_FUNC(avs_is_yuv422ps); AVSC_DECLARE_FUNC(avs_is_yuv420ps); AVSC_DECLARE_FUNC(avs_is_y32); AVSC_DECLARE_FUNC(avs_is_444); AVSC_DECLARE_FUNC(avs_is_422); AVSC_DECLARE_FUNC(avs_is_420); AVSC_DECLARE_FUNC(avs_is_y); AVSC_DECLARE_FUNC(avs_is_yuva); AVSC_DECLARE_FUNC(avs_is_planar_rgb); AVSC_DECLARE_FUNC(avs_is_planar_rgba); AVSC_DECLARE_FUNC(avs_num_components); AVSC_DECLARE_FUNC(avs_component_size); AVSC_DECLARE_FUNC(avs_bits_per_component); /////////////////////////////////////////////////////////////////////////////// // Avisynth+ new interface elements from interface version 8 // avs_subframe_planar with alpha support AVSC_DECLARE_FUNC(avs_subframe_planar_a); // frame properties AVSC_DECLARE_FUNC(avs_copy_frame_props); AVSC_DECLARE_FUNC(avs_get_frame_props_ro); AVSC_DECLARE_FUNC(avs_get_frame_props_rw); AVSC_DECLARE_FUNC(avs_prop_num_keys); AVSC_DECLARE_FUNC(avs_prop_get_key); AVSC_DECLARE_FUNC(avs_prop_num_elements); AVSC_DECLARE_FUNC(avs_prop_get_type); AVSC_DECLARE_FUNC(avs_prop_get_int); AVSC_DECLARE_FUNC(avs_prop_get_float); AVSC_DECLARE_FUNC(avs_prop_get_data); AVSC_DECLARE_FUNC(avs_prop_get_data_size); AVSC_DECLARE_FUNC(avs_prop_get_clip); AVSC_DECLARE_FUNC(avs_prop_get_frame); AVSC_DECLARE_FUNC(avs_prop_delete_key); AVSC_DECLARE_FUNC(avs_prop_set_int); AVSC_DECLARE_FUNC(avs_prop_set_float); AVSC_DECLARE_FUNC(avs_prop_set_data); AVSC_DECLARE_FUNC(avs_prop_set_clip); AVSC_DECLARE_FUNC(avs_prop_set_frame); AVSC_DECLARE_FUNC(avs_prop_get_int_array); AVSC_DECLARE_FUNC(avs_prop_get_float_array); AVSC_DECLARE_FUNC(avs_prop_set_int_array); AVSC_DECLARE_FUNC(avs_prop_set_float_array); AVSC_DECLARE_FUNC(avs_clear_map); // NewVideoFrame with frame properties AVSC_DECLARE_FUNC(avs_new_video_frame_p); AVSC_DECLARE_FUNC(avs_new_video_frame_p_a); AVSC_DECLARE_FUNC(avs_get_env_property); AVSC_DECLARE_FUNC(avs_get_var_try); AVSC_DECLARE_FUNC(avs_get_var_bool); AVSC_DECLARE_FUNC(avs_get_var_int); AVSC_DECLARE_FUNC(avs_get_var_double); AVSC_DECLARE_FUNC(avs_get_var_string); AVSC_DECLARE_FUNC(avs_get_var_long); AVSC_DECLARE_FUNC(avs_pool_allocate); AVSC_DECLARE_FUNC(avs_pool_free); // V9 AVSC_DECLARE_FUNC(avs_is_property_writable); AVSC_DECLARE_FUNC(avs_make_property_writable); // V10 AVSC_DECLARE_FUNC(avs_video_frame_get_pixel_type); AVSC_DECLARE_FUNC(avs_video_frame_amend_pixel_type); // V10 AVSC_DECLARE_FUNC(avs_is_channel_mask_known); AVSC_DECLARE_FUNC(avs_set_channel_mask); AVSC_DECLARE_FUNC(avs_get_channel_mask); }; #undef AVSC_DECLARE_FUNC #ifdef AVS26_FALLBACK_SIMULATION // Helper functions for fallback simulation // Avisynth+ extensions do not exist in classic Avisynth so they are simulated AVSC_INLINE int avs_is_xx_fallback_return_false(const AVS_VideoInfo * p) { return 0; } // Avisynth+ extensions do not exist in classic Avisynth so they are simulated AVSC_INLINE int avs_num_components_fallback(const AVS_VideoInfo * p) { switch (p->pixel_type) { case AVS_CS_UNKNOWN: return 0; case AVS_CS_RAW32: case AVS_CS_Y8: return 1; case AVS_CS_BGR32: return 4; // not planar but return the count default: return 3; } } // Avisynth+ extensions do not exist in classic Avisynth so they are simulated AVSC_INLINE int avs_component_size_fallback(const AVS_VideoInfo * p) { return 1; } // Avisynth+ extensions do not exist in classic Avisynth so they are simulated AVSC_INLINE int avs_bits_per_component_fallback(const AVS_VideoInfo * p) { return 8; } // End of helper functions for fallback simulation #endif // AVS26_FALLBACK_SIMULATION // avs_load_library() allocates an array for API procedure entries // reads and fills the entries with live procedure addresses. // AVSC_INLINE helpers which are calling into API procedures are not treated here (todo) AVSC_INLINE AVS_Library * avs_load_library() { AVS_Library *library = (AVS_Library *)malloc(sizeof(AVS_Library)); if (library == NULL) return NULL; library->handle = LoadLibraryA("avisynth"); if (library->handle == NULL) goto fail; #define __AVSC_STRINGIFY(x) #x #define AVSC_STRINGIFY(x) __AVSC_STRINGIFY(x) #define AVSC_LOAD_FUNC(name) {\ library->name = (name##_func) GetProcAddress(library->handle, AVSC_STRINGIFY(name));\ if (library->name == NULL)\ goto fail;\ } #ifdef AVS26_FALLBACK_SIMULATION // When an API function is not loadable, let's try a replacement // Missing Avisynth+ functions will be substituted with classic Avisynth compatible methods /* Avisynth+ When method is missing (classic Avisynth) avs_is_rgb48 constant false avs_is_rgb64 constant false avs_is_444 avs_is_yv24 avs_is_422 avs_is_yv16 avs_is_420 avs_is_yv12 avs_is_y avs_is_y8 avs_is_yuva constant false avs_is_planar_rgb constant false avs_is_planar_rgba constant false avs_num_components special: avs_num_components_fake Y8:1 RGB32:4 else 3 avs_component_size constant 1 (1 bytes/component) avs_bits_per_component constant 8 (8 bits/component) */ // try to load an alternative function #define AVSC_LOAD_FUNC_FALLBACK(name,name2) {\ library->name = (name##_func) GetProcAddress(library->handle, AVSC_STRINGIFY(name));\ if (library->name == NULL)\ library->name = (name##_func) GetProcAddress(library->handle, AVSC_STRINGIFY(name2));\ if (library->name == NULL)\ goto fail;\ } // try to assign a replacement function #define AVSC_LOAD_FUNC_FALLBACK_SIMULATED(name,name2) {\ library->name = (name##_func) GetProcAddress(library->handle, AVSC_STRINGIFY(name));\ if (library->name == NULL)\ library->name = name2;\ if (library->name == NULL)\ goto fail;\ } #endif // AVS26_FALLBACK_SIMULATION AVSC_LOAD_FUNC(avs_add_function); AVSC_LOAD_FUNC(avs_at_exit); AVSC_LOAD_FUNC(avs_bit_blt); AVSC_LOAD_FUNC(avs_check_version); AVSC_LOAD_FUNC(avs_clip_get_error); AVSC_LOAD_FUNC(avs_copy_clip); AVSC_LOAD_FUNC(avs_copy_value); AVSC_LOAD_FUNC(avs_copy_video_frame); AVSC_LOAD_FUNC(avs_create_script_environment); AVSC_LOAD_FUNC(avs_delete_script_environment); AVSC_LOAD_FUNC(avs_function_exists); AVSC_LOAD_FUNC(avs_get_audio); AVSC_LOAD_FUNC(avs_get_cpu_flags); AVSC_LOAD_FUNC(avs_get_frame); AVSC_LOAD_FUNC(avs_get_parity); AVSC_LOAD_FUNC(avs_get_var); AVSC_LOAD_FUNC(avs_get_version); AVSC_LOAD_FUNC(avs_get_video_info); AVSC_LOAD_FUNC(avs_invoke); AVSC_LOAD_FUNC(avs_make_writable); AVSC_LOAD_FUNC(avs_new_c_filter); AVSC_LOAD_FUNC(avs_new_video_frame_a); AVSC_LOAD_FUNC(avs_release_clip); AVSC_LOAD_FUNC(avs_release_value); AVSC_LOAD_FUNC(avs_release_video_frame); AVSC_LOAD_FUNC(avs_save_string); AVSC_LOAD_FUNC(avs_set_cache_hints); AVSC_LOAD_FUNC(avs_set_global_var); AVSC_LOAD_FUNC(avs_set_memory_max); AVSC_LOAD_FUNC(avs_set_to_clip); AVSC_LOAD_FUNC(avs_set_var); AVSC_LOAD_FUNC(avs_set_working_dir); AVSC_LOAD_FUNC(avs_sprintf); AVSC_LOAD_FUNC(avs_subframe); AVSC_LOAD_FUNC(avs_subframe_planar); AVSC_LOAD_FUNC(avs_take_clip); AVSC_LOAD_FUNC(avs_vsprintf); AVSC_LOAD_FUNC(avs_get_error); AVSC_LOAD_FUNC(avs_is_yv24); AVSC_LOAD_FUNC(avs_is_yv16); AVSC_LOAD_FUNC(avs_is_yv12); AVSC_LOAD_FUNC(avs_is_yv411); AVSC_LOAD_FUNC(avs_is_y8); AVSC_LOAD_FUNC(avs_is_color_space); AVSC_LOAD_FUNC(avs_get_plane_width_subsampling); AVSC_LOAD_FUNC(avs_get_plane_height_subsampling); AVSC_LOAD_FUNC(avs_bits_per_pixel); AVSC_LOAD_FUNC(avs_bytes_from_pixels); AVSC_LOAD_FUNC(avs_row_size); AVSC_LOAD_FUNC(avs_bmp_size); AVSC_LOAD_FUNC(avs_get_pitch_p); AVSC_LOAD_FUNC(avs_get_row_size_p); AVSC_LOAD_FUNC(avs_get_height_p); AVSC_LOAD_FUNC(avs_get_read_ptr_p); AVSC_LOAD_FUNC(avs_is_writable); AVSC_LOAD_FUNC(avs_get_write_ptr_p); // Avisynth+ specific #ifdef AVS26_FALLBACK_SIMULATION // replace with fallback fn when does not exist AVSC_LOAD_FUNC_FALLBACK_SIMULATED(avs_is_rgb48, avs_is_xx_fallback_return_false); AVSC_LOAD_FUNC_FALLBACK_SIMULATED(avs_is_rgb64, avs_is_xx_fallback_return_false); AVSC_LOAD_FUNC_FALLBACK(avs_is_444, avs_is_yv24); AVSC_LOAD_FUNC_FALLBACK(avs_is_422, avs_is_yv16); AVSC_LOAD_FUNC_FALLBACK(avs_is_420, avs_is_yv12); AVSC_LOAD_FUNC_FALLBACK(avs_is_y, avs_is_y8); AVSC_LOAD_FUNC_FALLBACK_SIMULATED(avs_is_yuva, avs_is_xx_fallback_return_false); AVSC_LOAD_FUNC_FALLBACK_SIMULATED(avs_is_planar_rgb, avs_is_xx_fallback_return_false); AVSC_LOAD_FUNC_FALLBACK_SIMULATED(avs_is_planar_rgba, avs_is_xx_fallback_return_false); AVSC_LOAD_FUNC_FALLBACK_SIMULATED(avs_num_components, avs_num_components_fallback); AVSC_LOAD_FUNC_FALLBACK_SIMULATED(avs_component_size, avs_component_size_fallback); AVSC_LOAD_FUNC_FALLBACK_SIMULATED(avs_bits_per_component, avs_bits_per_component_fallback); #else // Avisynth+ specific AVSC_LOAD_FUNC(avs_is_rgb48); AVSC_LOAD_FUNC(avs_is_rgb64); AVSC_LOAD_FUNC(avs_is_444); AVSC_LOAD_FUNC(avs_is_422); AVSC_LOAD_FUNC(avs_is_420); AVSC_LOAD_FUNC(avs_is_y); AVSC_LOAD_FUNC(avs_is_yuva); AVSC_LOAD_FUNC(avs_is_planar_rgb); AVSC_LOAD_FUNC(avs_is_planar_rgba); AVSC_LOAD_FUNC(avs_num_components); AVSC_LOAD_FUNC(avs_component_size); AVSC_LOAD_FUNC(avs_bits_per_component); #endif // Avisynth+ interface V8, no backward compatible simulation AVSC_LOAD_FUNC(avs_subframe_planar_a); // frame properties AVSC_LOAD_FUNC(avs_copy_frame_props); AVSC_LOAD_FUNC(avs_get_frame_props_ro); AVSC_LOAD_FUNC(avs_get_frame_props_rw); AVSC_LOAD_FUNC(avs_prop_num_keys); AVSC_LOAD_FUNC(avs_prop_get_key); AVSC_LOAD_FUNC(avs_prop_num_elements); AVSC_LOAD_FUNC(avs_prop_get_type); AVSC_LOAD_FUNC(avs_prop_get_int); AVSC_LOAD_FUNC(avs_prop_get_float); AVSC_LOAD_FUNC(avs_prop_get_data); AVSC_LOAD_FUNC(avs_prop_get_data_size); AVSC_LOAD_FUNC(avs_prop_get_clip); AVSC_LOAD_FUNC(avs_prop_get_frame); AVSC_LOAD_FUNC(avs_prop_delete_key); AVSC_LOAD_FUNC(avs_prop_set_int); AVSC_LOAD_FUNC(avs_prop_set_float); AVSC_LOAD_FUNC(avs_prop_set_data); AVSC_LOAD_FUNC(avs_prop_set_clip); AVSC_LOAD_FUNC(avs_prop_set_frame); AVSC_LOAD_FUNC(avs_prop_get_int_array); AVSC_LOAD_FUNC(avs_prop_get_float_array); AVSC_LOAD_FUNC(avs_prop_set_int_array); AVSC_LOAD_FUNC(avs_prop_set_float_array); AVSC_LOAD_FUNC(avs_clear_map); // NewVideoFrame with frame properties AVSC_LOAD_FUNC(avs_new_video_frame_p); AVSC_LOAD_FUNC(avs_new_video_frame_p_a); AVSC_LOAD_FUNC(avs_get_env_property); AVSC_LOAD_FUNC(avs_get_var_try); AVSC_LOAD_FUNC(avs_get_var_bool); AVSC_LOAD_FUNC(avs_get_var_int); AVSC_LOAD_FUNC(avs_get_var_double); AVSC_LOAD_FUNC(avs_get_var_string); AVSC_LOAD_FUNC(avs_get_var_long); AVSC_LOAD_FUNC(avs_pool_allocate); AVSC_LOAD_FUNC(avs_pool_free); // V9 AVSC_LOAD_FUNC(avs_make_property_writable); AVSC_LOAD_FUNC(avs_is_property_writable); // V10 AVSC_LOAD_FUNC(avs_video_frame_get_pixel_type); AVSC_LOAD_FUNC(avs_video_frame_amend_pixel_type); // V10 AVSC_LOAD_FUNC(avs_is_channel_mask_known); AVSC_LOAD_FUNC(avs_set_channel_mask); AVSC_LOAD_FUNC(avs_get_channel_mask); #undef __AVSC_STRINGIFY #undef AVSC_STRINGIFY #undef AVSC_LOAD_FUNC #undef AVSC_LOAD_FUNC_FALLBACK #undef AVSC_LOAD_FUNC_FALLBACK_SIMULATED return library; fail: free(library); return NULL; } AVSC_INLINE void avs_free_library(AVS_Library *library) { if (library == NULL) return; FreeLibrary(library->handle); free(library); } #endif #endif // AVS_WINDOWS #endif
71,175
C++
.h
1,394
48.047346
227
0.706413
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
22,423
version.h
Nevcairiel_LAVFilters/thirdparty/32/include/avisynth/avs/version.h
#ifndef _AVS_VERSION_H_ #define _AVS_VERSION_H_ #include "arch.h" #define AVS_PPSTR_(x) #x #define AVS_PPSTR(x) AVS_PPSTR_(x) #define AVS_PROJECT AviSynth+ #define AVS_MAJOR_VER 3 #define AVS_MINOR_VER 7 #define AVS_BUGFIX_VER 3 #ifdef RELEASE_TARBALL #define AVS_FULLVERSION AVS_PPSTR(AVS_PROJECT) " " AVS_PPSTR(AVS_MAJOR_VER) "." AVS_PPSTR(AVS_MINOR_VER) "." AVS_PPSTR(AVS_BUGFIX_VER) " (" AVS_PPSTR(AVS_ARCH) ")" #else #define AVS_DEVNEXT_REV #define AVS_DEV_REVDATE #define AVS_DEV_GITHASH #define AVS_SEQREV // e.g. 1576 #define AVS_BRANCH // e.g. master #define AVS_FULLVERSION AVS_PPSTR(AVS_PROJECT) " " AVS_PPSTR(AVS_MAJOR_VER) "." AVS_PPSTR(AVS_MINOR_VER) "." AVS_PPSTR(AVS_BUGFIX_VER) " (r" AVS_PPSTR(AVS_SEQREV) ", " AVS_PPSTR(AVS_BRANCH) ", " AVS_PPSTR(AVS_ARCH) ")" #endif #endif // _AVS_VERSION_H_
948
C++
.h
20
45.75
224
0.613636
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,424
posix.h
Nevcairiel_LAVFilters/thirdparty/32/include/avisynth/avs/posix.h
// This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit // http://www.gnu.org/copyleft/gpl.html . // // Linking Avisynth statically or dynamically with other modules is making a // combined work based on Avisynth. Thus, the terms and conditions of the GNU // General Public License cover the whole combination. // // As a special exception, the copyright holders of Avisynth give you // permission to link Avisynth with independent modules that communicate with // Avisynth solely through the interfaces defined in avisynth.h, regardless of the license // terms of these independent modules, and to copy and distribute the // resulting combined work under terms of your choice, provided that // every copy of the combined work is accompanied by a complete copy of // the source code of Avisynth (the version of Avisynth used to produce the // combined work), being distributed under the terms of the GNU General // Public License plus this exception. An independent module is a module // which is not derived from or based on Avisynth, such as 3rd-party filters, // import and export plugins, or graphical user interfaces. #ifdef AVS_POSIX #ifndef AVSCORE_POSIX_H #define AVSCORE_POSIX_H #ifdef __cplusplus #include <cstring> #endif #include <strings.h> #include <unistd.h> // Define these MSVC-extension used in Avisynth #define __single_inheritance // These things don't exist in Linux #if defined(AVS_HAIKU) #undef __declspec #endif #define __declspec(x) #define lstrlen strlen #define lstrcmp strcmp #define lstrcmpi strcasecmp #define _stricmp strcasecmp #define _strnicmp strncasecmp #define _strdup strdup #define SetCurrentDirectory(x) chdir(x) #define SetCurrentDirectoryW(x) chdir(x) #define GetCurrentDirectoryW(x) getcwd(x) #define _putenv putenv #define _alloca alloca // Borrowing some compatibility macros from AvxSynth, slightly modified #define UInt32x32To64(a, b) ((uint64_t)(((uint64_t)((uint32_t)(a))) * ((uint32_t)(b)))) #define Int64ShrlMod32(a, b) ((uint64_t)((uint64_t)(a) >> (b))) #define Int32x32To64(a, b) ((int64_t)(((int64_t)((long)(a))) * ((long)(b)))) #define InterlockedIncrement(x) __sync_add_and_fetch((x), 1) #define InterlockedDecrement(x) __sync_sub_and_fetch((x), 1) #define InterlockedExchangeAdd(x, v) __sync_add_and_fetch((x), (v)) #define MulDiv(nNumber, nNumerator, nDenominator) (int32_t) (((int64_t) (nNumber) * (int64_t) (nNumerator) + (int64_t) ((nDenominator)/2)) / (int64_t) (nDenominator)) #ifndef TRUE #define TRUE true #endif #ifndef FALSE #define FALSE false #endif #define S_FALSE (0x00000001) #define E_FAIL (0x80004005) #define FAILED(hr) ((hr) & 0x80000000) #define SUCCEEDED(hr) (!FAILED(hr)) // Statuses copied from comments in exception.cpp #define STATUS_GUARD_PAGE_VIOLATION 0x80000001 #define STATUS_DATATYPE_MISALIGNMENT 0x80000002 #define STATUS_BREAKPOINT 0x80000003 #define STATUS_SINGLE_STEP 0x80000004 #define STATUS_ACCESS_VIOLATION 0xc0000005 #define STATUS_IN_PAGE_ERROR 0xc0000006 #define STATUS_INVALID_HANDLE 0xc0000008 #define STATUS_NO_MEMORY 0xc0000017 #define STATUS_ILLEGAL_INSTRUCTION 0xc000001d #define STATUS_NONCONTINUABLE_EXCEPTION 0xc0000025 #define STATUS_INVALID_DISPOSITION 0xc0000026 #define STATUS_ARRAY_BOUNDS_EXCEEDED 0xc000008c #define STATUS_FLOAT_DENORMAL_OPERAND 0xc000008d #define STATUS_FLOAT_DIVIDE_BY_ZERO 0xc000008e #define STATUS_FLOAT_INEXACT_RESULT 0xc000008f #define STATUS_FLOAT_INVALID_OPERATION 0xc0000090 #define STATUS_FLOAT_OVERFLOW 0xc0000091 #define STATUS_FLOAT_STACK_CHECK 0xc0000092 #define STATUS_FLOAT_UNDERFLOW 0xc0000093 #define STATUS_INTEGER_DIVIDE_BY_ZERO 0xc0000094 #define STATUS_INTEGER_OVERFLOW 0xc0000095 #define STATUS_PRIVILEGED_INSTRUCTION 0xc0000096 #define STATUS_STACK_OVERFLOW 0xc00000fd // Calling convension #ifndef AVS_HAIKU #define __stdcall #define __cdecl #endif // PowerPC OS X is really niche these days, but this painless equivocation // of the function/macro names used in posix_get_available_memory() // is all it takes to let it work. The G5 was 64-bit, and if 10.5 Leopard // can run in native 64-bit, it probably uses the names in that block as-is. #ifdef AVS_MACOS #ifdef PPC32 #define vm_statistics64_data_t vm_statistics_data_t #define HOST_VM_INFO64_COUNT HOST_VM_INFO_COUNT #define HOST_VM_INFO64 HOST_VM_INFO #define host_statistics64 host_statistics #endif // PPC32 #endif // AVS_MACOS #endif // AVSCORE_POSIX_H #endif // AVS_POSIX
5,076
C++
.h
117
42.264957
168
0.786451
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,425
win.h
Nevcairiel_LAVFilters/thirdparty/32/include/avisynth/avs/win.h
// This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit // http://www.gnu.org/copyleft/gpl.html . // // Linking Avisynth statically or dynamically with other modules is making a // combined work based on Avisynth. Thus, the terms and conditions of the GNU // General Public License cover the whole combination. // // As a special exception, the copyright holders of Avisynth give you // permission to link Avisynth with independent modules that communicate with // Avisynth solely through the interfaces defined in avisynth.h, regardless of the license // terms of these independent modules, and to copy and distribute the // resulting combined work under terms of your choice, provided that // every copy of the combined work is accompanied by a complete copy of // the source code of Avisynth (the version of Avisynth used to produce the // combined work), being distributed under the terms of the GNU General // Public License plus this exception. An independent module is a module // which is not derived from or based on Avisynth, such as 3rd-party filters, // import and export plugins, or graphical user interfaces. #ifndef AVSCORE_WIN_H #define AVSCORE_WIN_H // Whenever you need windows headers, start by including this file, then the rest. // WWUUT? We require XP now? #if !defined(NTDDI_VERSION) && !defined(_WIN32_WINNT) #define NTDDI_VERSION 0x05020000 #define _WIN32_WINNT 0x0502 #endif #define WIN32_LEAN_AND_MEAN #define STRICT #if !defined(NOMINMAX) #define NOMINMAX #endif #include <windows.h> // Provision for UTF-8 max 4 bytes per code point #define AVS_MAX_PATH MAX_PATH*4 #endif // AVSCORE_WIN_H
2,286
C++
.h
47
47.319149
90
0.779122
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,427
arch.h
Nevcairiel_LAVFilters/thirdparty/32/include/avisynth/avs/arch.h
#ifndef _AVS_ARCH_H_ #define _AVS_ARCH_H_ #define AVS_ARCH i386 // e.g. i386 #endif // _AVS_ARCH_H_
124
C++
.h
4
29.5
54
0.542373
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,428
types.h
Nevcairiel_LAVFilters/thirdparty/32/include/avisynth/avs/types.h
// Avisynth C Interface Version 0.20 // Copyright 2003 Kevin Atkinson // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit // http://www.gnu.org/copyleft/gpl.html . // // As a special exception, I give you permission to link to the // Avisynth C interface with independent modules that communicate with // the Avisynth C interface solely through the interfaces defined in // avisynth_c.h, regardless of the license terms of these independent // modules, and to copy and distribute the resulting combined work // under terms of your choice, provided that every copy of the // combined work is accompanied by a complete copy of the source code // of the Avisynth C interface and Avisynth itself (with the version // used to produce the combined work), being distributed under the // terms of the GNU General Public License plus this exception. An // independent module is a module which is not derived from or based // on Avisynth C Interface, such as 3rd-party filters, import and // export plugins, or graphical user interfaces. #ifndef AVS_TYPES_H #define AVS_TYPES_H // Define all types necessary for interfacing with avisynth.dll #include <stdint.h> #include <stdbool.h> #ifdef __cplusplus #include <cstddef> #include <cstdarg> #else #include <stddef.h> #include <stdarg.h> #endif // Raster types used by VirtualDub & Avisynth typedef uint32_t Pixel32; typedef uint8_t BYTE; // Audio Sample information typedef float SFLOAT; #endif //AVS_TYPES_H
2,118
C++
.h
48
42.833333
71
0.778101
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,429
capi.h
Nevcairiel_LAVFilters/thirdparty/32/include/avisynth/avs/capi.h
// Avisynth C Interface Version 0.20 // Copyright 2003 Kevin Atkinson // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit // http://www.gnu.org/copyleft/gpl.html . // // As a special exception, I give you permission to link to the // Avisynth C interface with independent modules that communicate with // the Avisynth C interface solely through the interfaces defined in // avisynth_c.h, regardless of the license terms of these independent // modules, and to copy and distribute the resulting combined work // under terms of your choice, provided that every copy of the // combined work is accompanied by a complete copy of the source code // of the Avisynth C interface and Avisynth itself (with the version // used to produce the combined work), being distributed under the // terms of the GNU General Public License plus this exception. An // independent module is a module which is not derived from or based // on Avisynth C Interface, such as 3rd-party filters, import and // export plugins, or graphical user interfaces. #ifndef AVS_CAPI_H #define AVS_CAPI_H #include "config.h" #ifdef AVS_POSIX // this is also defined in avs/posix.h #ifndef AVS_HAIKU #define __declspec(x) #endif #endif #ifdef __cplusplus # define EXTERN_C extern "C" #else # define EXTERN_C #endif #ifdef AVS_WINDOWS #ifdef BUILDING_AVSCORE # if defined(GCC) && defined(X86_32) # define AVSC_CC # else // MSVC builds and 64-bit GCC # ifndef AVSC_USE_STDCALL # define AVSC_CC __cdecl # else # define AVSC_CC __stdcall # endif # endif #else // needed for programs that talk to AviSynth+ # ifndef AVSC_WIN32_GCC32 // see comment below # ifndef AVSC_USE_STDCALL # define AVSC_CC __cdecl # else # define AVSC_CC __stdcall # endif # else # define AVSC_CC # endif #endif # else # define AVSC_CC #endif // On 64-bit Windows, there's only one calling convention, // so there is no difference between MSVC and GCC. On 32-bit, // this isn't true. The convention that GCC needs to use to // even build AviSynth+ as 32-bit makes anything that uses // it incompatible with 32-bit MSVC builds of AviSynth+. // The AVSC_WIN32_GCC32 define is meant to provide a user // switchable way to make builds of FFmpeg to test 32-bit // GCC builds of AviSynth+ without having to screw around // with alternate headers, while still default to the usual // situation of using 32-bit MSVC builds of AviSynth+. // Hopefully, this situation will eventually be resolved // and a broadly compatible solution will arise so the // same 32-bit FFmpeg build can handle either MSVC or GCC // builds of AviSynth+. #define AVSC_INLINE static __inline #ifdef BUILDING_AVSCORE #ifdef AVS_WINDOWS # ifndef AVS_STATIC_LIB # define AVSC_EXPORT __declspec(dllexport) # else # define AVSC_EXPORT # endif # define AVSC_API(ret, name) EXTERN_C AVSC_EXPORT ret AVSC_CC name #else # define AVSC_EXPORT EXTERN_C # define AVSC_API(ret, name) EXTERN_C ret AVSC_CC name #endif #else # define AVSC_EXPORT EXTERN_C __declspec(dllexport) # ifndef AVS_STATIC_LIB # define AVSC_IMPORT __declspec(dllimport) # else # define AVSC_IMPORT # endif # ifndef AVSC_NO_DECLSPEC # define AVSC_API(ret, name) EXTERN_C AVSC_IMPORT ret AVSC_CC name # else # define AVSC_API(ret, name) typedef ret (AVSC_CC *name##_func) # endif #endif #endif //AVS_CAPI_H
4,012
C++
.h
110
35.372727
71
0.753534
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,431
cpuid.h
Nevcairiel_LAVFilters/thirdparty/32/include/avisynth/avs/cpuid.h
// This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit // http://www.gnu.org/copyleft/gpl.html . // // Linking Avisynth statically or dynamically with other modules is making a // combined work based on Avisynth. Thus, the terms and conditions of the GNU // General Public License cover the whole combination. // // As a special exception, the copyright holders of Avisynth give you // permission to link Avisynth with independent modules that communicate with // Avisynth solely through the interfaces defined in avisynth.h, regardless of the license // terms of these independent modules, and to copy and distribute the // resulting combined work under terms of your choice, provided that // every copy of the combined work is accompanied by a complete copy of // the source code of Avisynth (the version of Avisynth used to produce the // combined work), being distributed under the terms of the GNU General // Public License plus this exception. An independent module is a module // which is not derived from or based on Avisynth, such as 3rd-party filters, // import and export plugins, or graphical user interfaces. #ifndef AVSCORE_CPUID_H #define AVSCORE_CPUID_H // For GetCPUFlags. These are backwards-compatible with those in VirtualDub. // ending with SSE4_2 // For emulation see https://software.intel.com/en-us/articles/intel-software-development-emulator enum { /* oldest CPU to support extension */ CPUF_FORCE = 0x01, // N/A CPUF_FPU = 0x02, // 386/486DX CPUF_MMX = 0x04, // P55C, K6, PII CPUF_INTEGER_SSE = 0x08, // PIII, Athlon CPUF_SSE = 0x10, // PIII, Athlon XP/MP CPUF_SSE2 = 0x20, // PIV, K8 CPUF_3DNOW = 0x40, // K6-2 CPUF_3DNOW_EXT = 0x80, // Athlon CPUF_X86_64 = 0xA0, // Hammer (note: equiv. to 3DNow + SSE2, which // only Hammer will have anyway) CPUF_SSE3 = 0x100, // PIV+, K8 Venice CPUF_SSSE3 = 0x200, // Core 2 CPUF_SSE4 = 0x400, CPUF_SSE4_1 = 0x400, // Penryn, Wolfdale, Yorkfield CPUF_AVX = 0x800, // Sandy Bridge, Bulldozer CPUF_SSE4_2 = 0x1000, // Nehalem // AVS+ CPUF_AVX2 = 0x2000, // Haswell CPUF_FMA3 = 0x4000, CPUF_F16C = 0x8000, CPUF_MOVBE = 0x10000, // Big Endian move CPUF_POPCNT = 0x20000, CPUF_AES = 0x40000, CPUF_FMA4 = 0x80000, CPUF_AVX512F = 0x100000, // AVX-512 Foundation. CPUF_AVX512DQ = 0x200000, // AVX-512 DQ (Double/Quad granular) Instructions CPUF_AVX512PF = 0x400000, // AVX-512 Prefetch CPUF_AVX512ER = 0x800000, // AVX-512 Exponential and Reciprocal CPUF_AVX512CD = 0x1000000, // AVX-512 Conflict Detection CPUF_AVX512BW = 0x2000000, // AVX-512 BW (Byte/Word granular) Instructions CPUF_AVX512VL = 0x4000000, // AVX-512 VL (128/256 Vector Length) Extensions CPUF_AVX512IFMA = 0x8000000, // AVX-512 IFMA integer 52 bit CPUF_AVX512VBMI = 0x10000000,// AVX-512 VBMI }; #ifdef BUILDING_AVSCORE int GetCPUFlags(); void SetMaxCPU(int new_flags); #endif #endif // AVSCORE_CPUID_H
3,861
C++
.h
76
48.223684
98
0.685714
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,433
config.h
Nevcairiel_LAVFilters/thirdparty/32/include/avisynth/avs/config.h
// Avisynth C Interface Version 0.20 // Copyright 2003 Kevin Atkinson // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit // http://www.gnu.org/copyleft/gpl.html . // // As a special exception, I give you permission to link to the // Avisynth C interface with independent modules that communicate with // the Avisynth C interface solely through the interfaces defined in // avisynth_c.h, regardless of the license terms of these independent // modules, and to copy and distribute the resulting combined work // under terms of your choice, provided that every copy of the // combined work is accompanied by a complete copy of the source code // of the Avisynth C interface and Avisynth itself (with the version // used to produce the combined work), being distributed under the // terms of the GNU General Public License plus this exception. An // independent module is a module which is not derived from or based // on Avisynth C Interface, such as 3rd-party filters, import and // export plugins, or graphical user interfaces. #ifndef AVS_CONFIG_H #define AVS_CONFIG_H // Undefine this to get cdecl calling convention #define AVSC_USE_STDCALL 1 // NOTE TO PLUGIN AUTHORS: // Because FRAME_ALIGN can be substantially higher than the alignment // a plugin actually needs, plugins should not use FRAME_ALIGN to check for // alignment. They should always request the exact alignment value they need. // This is to make sure that plugins work over the widest range of AviSynth // builds possible. #define FRAME_ALIGN 64 #if defined(_M_AMD64) || defined(__x86_64) # define X86_64 #elif defined(_M_IX86) || defined(__i386__) # define X86_32 // VS2017 introduced _M_ARM64 #elif defined(_M_ARM64) || defined(__aarch64__) # define ARM64 #elif defined(_M_ARM) || defined(__arm__) # define ARM32 #elif defined(__PPC64__) # define PPC64 #elif defined(_M_PPC) || defined(__PPC__) || defined(__POWERPC__) # define PPC32 #elif defined(__riscv) # define RISCV #elif defined(__sparc_v9__) # define SPARC #elif defined(__mips__) # define MIPS #else # error Unsupported CPU architecture. #endif // VC++ LLVM-Clang-cl MinGW-Gnu // MSVC x x // MSVC_PURE x // CLANG x // GCC x #if defined(__clang__) // Check clang first. clang-cl also defines __MSC_VER // We set MSVC because they are mostly compatible # define CLANG #if defined(_MSC_VER) # define MSVC # define AVS_FORCEINLINE __attribute__((always_inline)) #else # define AVS_FORCEINLINE __attribute__((always_inline)) inline #endif #elif defined(_MSC_VER) # define MSVC # define MSVC_PURE # define AVS_FORCEINLINE __forceinline #elif defined(__GNUC__) # define GCC # define AVS_FORCEINLINE __attribute__((always_inline)) inline #elif defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER) // Intel C++ Compilers with MSVC command line interface will not appear here rather at _MSC_VER # define AVS_FORCEINLINE inline # undef __forceinline # define __forceinline inline #else # error Unsupported compiler. # define AVS_FORCEINLINE inline # undef __forceinline # define __forceinline inline #endif #if defined(_WIN32) # define AVS_WINDOWS #elif defined(__linux__) # define AVS_LINUX # define AVS_POSIX #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) # define AVS_BSD # define AVS_POSIX #elif defined(__APPLE__) # define AVS_MACOS # define AVS_POSIX #elif defined(__HAIKU__) # define AVS_HAIKU # define AVS_POSIX #else # error Operating system unsupported. #endif // useful warnings disabler macros for supported compilers #if defined(_MSC_VER) #define DISABLE_WARNING_PUSH __pragma(warning( push )) #define DISABLE_WARNING_POP __pragma(warning( pop )) #define DISABLE_WARNING(warningNumber) __pragma(warning( disable : warningNumber )) #define DISABLE_WARNING_UNREFERENCED_LOCAL_VARIABLE DISABLE_WARNING(4101) #define DISABLE_WARNING_UNREFERENCED_FUNCTION DISABLE_WARNING(4505) // other warnings you want to deactivate... #elif defined(__GNUC__) || defined(__clang__) #define DO_PRAGMA(X) _Pragma(#X) #define DISABLE_WARNING_PUSH DO_PRAGMA(GCC diagnostic push) #define DISABLE_WARNING_POP DO_PRAGMA(GCC diagnostic pop) #define DISABLE_WARNING(warningName) DO_PRAGMA(GCC diagnostic ignored #warningName) #define DISABLE_WARNING_UNREFERENCED_LOCAL_VARIABLE DISABLE_WARNING(-Wunused-variable) #define DISABLE_WARNING_UNREFERENCED_FUNCTION DISABLE_WARNING(-Wunused-function) // other warnings you want to deactivate... #else #define DISABLE_WARNING_PUSH #define DISABLE_WARNING_POP #define DISABLE_WARNING_UNREFERENCED_LOCAL_VARIABLE #define DISABLE_WARNING_UNREFERENCED_FUNCTION // other warnings you want to deactivate... #endif #if defined(AVS_WINDOWS) && defined(_USING_V110_SDK71_) // Windows XP does not have proper initialization for // thread local variables. // Use workaround instead __declspec(thread) #define XP_TLS #endif #ifndef MSVC // GCC and Clang can be used on big endian systems, MSVC can't. # if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ # define AVS_ENDIANNESS "little" # elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ # define AVS_ENDIANNESS "big" # else # define AVS_ENDIANNESS "middle" # endif #else #define AVS_ENDIANNESS "little" #endif #endif //AVS_CONFIG_H
6,087
C++
.h
155
38.154839
99
0.735712
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,434
pkcs12.h
Nevcairiel_LAVFilters/thirdparty/32/include/gnutls/pkcs12.h
/* * Copyright (C) 2003-2012 Free Software Foundation, Inc. * * Author: Nikos Mavrogiannopoulos * * This file is part of GnuTLS. * * The GnuTLS is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <https://www.gnu.org/licenses/> * */ #ifndef GNUTLS_PKCS12_H #define GNUTLS_PKCS12_H #include <gnutls/x509.h> /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { #endif /* *INDENT-ON* */ /* PKCS12 structures handling */ struct gnutls_pkcs12_int; typedef struct gnutls_pkcs12_int *gnutls_pkcs12_t; struct gnutls_pkcs12_bag_int; typedef struct gnutls_pkcs12_bag_int *gnutls_pkcs12_bag_t; int gnutls_pkcs12_init(gnutls_pkcs12_t * pkcs12); void gnutls_pkcs12_deinit(gnutls_pkcs12_t pkcs12); int gnutls_pkcs12_import(gnutls_pkcs12_t pkcs12, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, unsigned int flags); int gnutls_pkcs12_export(gnutls_pkcs12_t pkcs12, gnutls_x509_crt_fmt_t format, void *output_data, size_t * output_data_size); int gnutls_pkcs12_export2(gnutls_pkcs12_t pkcs12, gnutls_x509_crt_fmt_t format, gnutls_datum_t * out); int gnutls_pkcs12_get_bag(gnutls_pkcs12_t pkcs12, int indx, gnutls_pkcs12_bag_t bag); int gnutls_pkcs12_set_bag(gnutls_pkcs12_t pkcs12, gnutls_pkcs12_bag_t bag); int gnutls_pkcs12_generate_mac(gnutls_pkcs12_t pkcs12, const char *pass); int gnutls_pkcs12_generate_mac2(gnutls_pkcs12_t pkcs12, gnutls_mac_algorithm_t mac, const char *pass); int gnutls_pkcs12_verify_mac(gnutls_pkcs12_t pkcs12, const char *pass); int gnutls_pkcs12_bag_decrypt(gnutls_pkcs12_bag_t bag, const char *pass); int gnutls_pkcs12_bag_encrypt(gnutls_pkcs12_bag_t bag, const char *pass, unsigned int flags); int gnutls_pkcs12_bag_enc_info(gnutls_pkcs12_bag_t bag, unsigned int *schema, unsigned int *cipher, void *salt, unsigned int *salt_size, unsigned int *iter_count, char **oid); int gnutls_pkcs12_mac_info(gnutls_pkcs12_t pkcs12, unsigned int *mac, void *salt, unsigned int *salt_size, unsigned int *iter_count, char **oid); #define GNUTLS_PKCS12_SP_INCLUDE_SELF_SIGNED 1 int gnutls_pkcs12_simple_parse(gnutls_pkcs12_t p12, const char *password, gnutls_x509_privkey_t * key, gnutls_x509_crt_t ** chain, unsigned int *chain_len, gnutls_x509_crt_t ** extra_certs, unsigned int *extra_certs_len, gnutls_x509_crl_t * crl, unsigned int flags); /** * gnutls_pkcs12_bag_type_t: * @GNUTLS_BAG_EMPTY: Empty PKCS-12 bag. * @GNUTLS_BAG_PKCS8_ENCRYPTED_KEY: PKCS-12 bag with PKCS-8 encrypted key. * @GNUTLS_BAG_PKCS8_KEY: PKCS-12 bag with PKCS-8 key. * @GNUTLS_BAG_CERTIFICATE: PKCS-12 bag with certificate. * @GNUTLS_BAG_CRL: PKCS-12 bag with CRL. * @GNUTLS_BAG_SECRET: PKCS-12 bag with secret PKCS-9 keys. * @GNUTLS_BAG_ENCRYPTED: Encrypted PKCS-12 bag. * @GNUTLS_BAG_UNKNOWN: Unknown PKCS-12 bag. * * Enumeration of different PKCS 12 bag types. */ typedef enum gnutls_pkcs12_bag_type_t { GNUTLS_BAG_EMPTY = 0, GNUTLS_BAG_PKCS8_ENCRYPTED_KEY = 1, GNUTLS_BAG_PKCS8_KEY = 2, GNUTLS_BAG_CERTIFICATE = 3, GNUTLS_BAG_CRL = 4, GNUTLS_BAG_SECRET = 5, /* Secret data. Underspecified in pkcs-12, * gnutls extension. We use the PKCS-9 * random nonce ID 1.2.840.113549.1.9.25.3 * to store randomly generated keys. */ GNUTLS_BAG_ENCRYPTED = 10, GNUTLS_BAG_UNKNOWN = 20 } gnutls_pkcs12_bag_type_t; int gnutls_pkcs12_bag_get_type(gnutls_pkcs12_bag_t bag, unsigned indx); int gnutls_pkcs12_bag_get_data(gnutls_pkcs12_bag_t bag, unsigned indx, gnutls_datum_t * data); int gnutls_pkcs12_bag_set_data(gnutls_pkcs12_bag_t bag, gnutls_pkcs12_bag_type_t type, const gnutls_datum_t * data); int gnutls_pkcs12_bag_set_crl(gnutls_pkcs12_bag_t bag, gnutls_x509_crl_t crl); int gnutls_pkcs12_bag_set_crt(gnutls_pkcs12_bag_t bag, gnutls_x509_crt_t crt); int gnutls_pkcs12_bag_set_privkey(gnutls_pkcs12_bag_t bag, gnutls_x509_privkey_t privkey, const char *password, unsigned flags); int gnutls_pkcs12_bag_init(gnutls_pkcs12_bag_t * bag); void gnutls_pkcs12_bag_deinit(gnutls_pkcs12_bag_t bag); int gnutls_pkcs12_bag_get_count(gnutls_pkcs12_bag_t bag); int gnutls_pkcs12_bag_get_key_id(gnutls_pkcs12_bag_t bag, unsigned indx, gnutls_datum_t * id); int gnutls_pkcs12_bag_set_key_id(gnutls_pkcs12_bag_t bag, unsigned indx, const gnutls_datum_t * id); int gnutls_pkcs12_bag_get_friendly_name(gnutls_pkcs12_bag_t bag, unsigned indx, char **name); int gnutls_pkcs12_bag_set_friendly_name(gnutls_pkcs12_bag_t bag, unsigned indx, const char *name); /* *INDENT-OFF* */ #ifdef __cplusplus } #endif /* *INDENT-ON* */ #endif /* GNUTLS_PKCS12_H */
5,262
C++
.h
130
37.246154
102
0.729709
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,435
crypto.h
Nevcairiel_LAVFilters/thirdparty/32/include/gnutls/crypto.h
/* * Copyright (C) 2008-2012 Free Software Foundation, Inc. * * Author: Nikos Mavrogiannopoulos * * This file is part of GnuTLS. * * The GnuTLS is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <https://www.gnu.org/licenses/> * */ #ifndef GNUTLS_CRYPTO_H #define GNUTLS_CRYPTO_H #include <gnutls/gnutls.h> /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { #endif /* *INDENT-ON* */ typedef struct api_cipher_hd_st *gnutls_cipher_hd_t; int gnutls_cipher_init(gnutls_cipher_hd_t * handle, gnutls_cipher_algorithm_t cipher, const gnutls_datum_t * key, const gnutls_datum_t * iv); int gnutls_cipher_encrypt(const gnutls_cipher_hd_t handle, void *text, size_t textlen); int gnutls_cipher_decrypt(const gnutls_cipher_hd_t handle, void *ciphertext, size_t ciphertextlen); int gnutls_cipher_decrypt2(gnutls_cipher_hd_t handle, const void *ciphertext, size_t ciphertextlen, void *text, size_t textlen); int gnutls_cipher_encrypt2(gnutls_cipher_hd_t handle, const void *text, size_t textlen, void *ciphertext, size_t ciphertextlen); /** * gnutls_cipher_flags_t: * @GNUTLS_CIPHER_PADDING_PKCS7: Flag to indicate PKCS#7 padding * * Enumeration of flags to control block cipher padding, used by * gnutls_cipher_encrypt3() and gnutls_cipher_decrypt3(). * * Since: 3.7.7 */ typedef enum gnutls_cipher_flags_t { GNUTLS_CIPHER_PADDING_PKCS7 = 1 } gnutls_cipher_flags_t; int gnutls_cipher_encrypt3(gnutls_cipher_hd_t handle, const void *ptext, size_t ptext_len, void *ctext, size_t *ctext_len, unsigned flags); int gnutls_cipher_decrypt3(gnutls_cipher_hd_t handle, const void *ctext, size_t ctext_len, void *ptext, size_t *ptext_len, unsigned flags); void gnutls_cipher_set_iv(gnutls_cipher_hd_t handle, void *iv, size_t ivlen); int gnutls_cipher_tag(gnutls_cipher_hd_t handle, void *tag, size_t tag_size); int gnutls_cipher_add_auth(gnutls_cipher_hd_t handle, const void *text, size_t text_size); void gnutls_cipher_deinit(gnutls_cipher_hd_t handle); unsigned gnutls_cipher_get_block_size(gnutls_cipher_algorithm_t algorithm) __GNUTLS_CONST__; unsigned gnutls_cipher_get_iv_size(gnutls_cipher_algorithm_t algorithm) __GNUTLS_CONST__; unsigned gnutls_cipher_get_tag_size(gnutls_cipher_algorithm_t algorithm) __GNUTLS_CONST__; /* AEAD API */ typedef struct api_aead_cipher_hd_st *gnutls_aead_cipher_hd_t; int gnutls_aead_cipher_init(gnutls_aead_cipher_hd_t * handle, gnutls_cipher_algorithm_t cipher, const gnutls_datum_t * key); int gnutls_aead_cipher_set_key(gnutls_aead_cipher_hd_t handle, const gnutls_datum_t *key); int gnutls_aead_cipher_decrypt(gnutls_aead_cipher_hd_t handle, const void *nonce, size_t nonce_len, const void *auth, size_t auth_len, size_t tag_size, const void *ctext, size_t ctext_len, void *ptext, size_t *ptext_len); int gnutls_aead_cipher_encrypt(gnutls_aead_cipher_hd_t handle, const void *nonce, size_t nonce_len, const void *auth, size_t auth_len, size_t tag_size, const void *ptext, size_t ptext_len, void *ctext, size_t *ctext_len); int gnutls_aead_cipher_encryptv(gnutls_aead_cipher_hd_t handle, const void *nonce, size_t nonce_len, const giovec_t *auth_iov, int auth_iovcnt, size_t tag_size, const giovec_t *iov, int iovcnt, void *ctext, size_t *ctext_len); int gnutls_aead_cipher_encryptv2(gnutls_aead_cipher_hd_t handle, const void *nonce, size_t nonce_len, const giovec_t *auth_iov, int auth_iovcnt, const giovec_t *iov, int iovcnt, void *tag, size_t *tag_size); int gnutls_aead_cipher_decryptv2(gnutls_aead_cipher_hd_t handle, const void *nonce, size_t nonce_len, const giovec_t *auth_iov, int auth_iovcnt, const giovec_t *iov, int iovcnt, void *tag, size_t tag_size); void gnutls_aead_cipher_deinit(gnutls_aead_cipher_hd_t handle); /* Hash - MAC API */ typedef struct hash_hd_st *gnutls_hash_hd_t; typedef struct hmac_hd_st *gnutls_hmac_hd_t; size_t gnutls_mac_get_nonce_size(gnutls_mac_algorithm_t algorithm) __GNUTLS_CONST__; int gnutls_hmac_init(gnutls_hmac_hd_t * dig, gnutls_mac_algorithm_t algorithm, const void *key, size_t keylen); void gnutls_hmac_set_nonce(gnutls_hmac_hd_t handle, const void *nonce, size_t nonce_len); int gnutls_hmac(gnutls_hmac_hd_t handle, const void *text, size_t textlen); void gnutls_hmac_output(gnutls_hmac_hd_t handle, void *digest); void gnutls_hmac_deinit(gnutls_hmac_hd_t handle, void *digest); unsigned gnutls_hmac_get_len(gnutls_mac_algorithm_t algorithm) __GNUTLS_CONST__; unsigned gnutls_hmac_get_key_size(gnutls_mac_algorithm_t algorithm) __GNUTLS_CONST__; int gnutls_hmac_fast(gnutls_mac_algorithm_t algorithm, const void *key, size_t keylen, const void *text, size_t textlen, void *digest); gnutls_hmac_hd_t gnutls_hmac_copy(gnutls_hmac_hd_t handle); int gnutls_hash_init(gnutls_hash_hd_t * dig, gnutls_digest_algorithm_t algorithm); int gnutls_hash(gnutls_hash_hd_t handle, const void *text, size_t textlen); void gnutls_hash_output(gnutls_hash_hd_t handle, void *digest); void gnutls_hash_deinit(gnutls_hash_hd_t handle, void *digest); unsigned gnutls_hash_get_len(gnutls_digest_algorithm_t algorithm) __GNUTLS_CONST__; int gnutls_hash_fast(gnutls_digest_algorithm_t algorithm, const void *text, size_t textlen, void *digest); gnutls_hash_hd_t gnutls_hash_copy(gnutls_hash_hd_t handle); /* KDF API */ int gnutls_hkdf_extract(gnutls_mac_algorithm_t mac, const gnutls_datum_t *key, const gnutls_datum_t *salt, void *output); int gnutls_hkdf_expand(gnutls_mac_algorithm_t mac, const gnutls_datum_t *key, const gnutls_datum_t *info, void *output, size_t length); int gnutls_pbkdf2(gnutls_mac_algorithm_t mac, const gnutls_datum_t *key, const gnutls_datum_t *salt, unsigned iter_count, void *output, size_t length); /* register ciphers */ /** * gnutls_rnd_level_t: * @GNUTLS_RND_NONCE: Non-predictable random number. Fatal in parts * of session if broken, i.e., vulnerable to statistical analysis. * @GNUTLS_RND_RANDOM: Pseudo-random cryptographic random number. * Fatal in session if broken. Example use: temporal keys. * @GNUTLS_RND_KEY: Fatal in many sessions if broken. Example use: * Long-term keys. * * Enumeration of random quality levels. */ typedef enum gnutls_rnd_level { GNUTLS_RND_NONCE = 0, GNUTLS_RND_RANDOM = 1, GNUTLS_RND_KEY = 2 } gnutls_rnd_level_t; int gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len); void gnutls_rnd_refresh(void); /* API to override ciphers and MAC algorithms */ typedef int (*gnutls_cipher_init_func) (gnutls_cipher_algorithm_t, void **ctx, int enc); typedef int (*gnutls_cipher_setkey_func) (void *ctx, const void *key, size_t keysize); /* old style ciphers */ typedef int (*gnutls_cipher_setiv_func) (void *ctx, const void *iv, size_t ivsize); typedef int (*gnutls_cipher_getiv_func) (void *ctx, void *iv, size_t ivsize); typedef int (*gnutls_cipher_encrypt_func) (void *ctx, const void *plain, size_t plainsize, void *encr, size_t encrsize); typedef int (*gnutls_cipher_decrypt_func) (void *ctx, const void *encr, size_t encrsize, void *plain, size_t plainsize); /* aead ciphers */ typedef int (*gnutls_cipher_auth_func) (void *ctx, const void *data, size_t datasize); typedef void (*gnutls_cipher_tag_func) (void *ctx, void *tag, size_t tagsize); typedef int (*gnutls_cipher_aead_encrypt_func) (void *ctx, const void *nonce, size_t noncesize, const void *auth, size_t authsize, size_t tag_size, const void *plain, size_t plainsize, void *encr, size_t encrsize); typedef int (*gnutls_cipher_aead_decrypt_func) (void *ctx, const void *nonce, size_t noncesize, const void *auth, size_t authsize, size_t tag_size, const void *encr, size_t encrsize, void *plain, size_t plainsize); typedef void (*gnutls_cipher_deinit_func) (void *ctx); int gnutls_crypto_register_cipher(gnutls_cipher_algorithm_t algorithm, int priority, gnutls_cipher_init_func init, gnutls_cipher_setkey_func setkey, gnutls_cipher_setiv_func setiv, gnutls_cipher_encrypt_func encrypt, gnutls_cipher_decrypt_func decrypt, gnutls_cipher_deinit_func deinit) _GNUTLS_GCC_ATTR_DEPRECATED; int gnutls_crypto_register_aead_cipher(gnutls_cipher_algorithm_t algorithm, int priority, gnutls_cipher_init_func init, gnutls_cipher_setkey_func setkey, gnutls_cipher_aead_encrypt_func aead_encrypt, gnutls_cipher_aead_decrypt_func aead_decrypt, gnutls_cipher_deinit_func deinit) _GNUTLS_GCC_ATTR_DEPRECATED; typedef int (*gnutls_mac_init_func) (gnutls_mac_algorithm_t, void **ctx); typedef int (*gnutls_mac_setkey_func) (void *ctx, const void *key, size_t keysize); typedef int (*gnutls_mac_setnonce_func) (void *ctx, const void *nonce, size_t noncesize); typedef int (*gnutls_mac_hash_func) (void *ctx, const void *text, size_t textsize); typedef int (*gnutls_mac_output_func) (void *src_ctx, void *digest, size_t digestsize); typedef void (*gnutls_mac_deinit_func) (void *ctx); typedef int (*gnutls_mac_fast_func) (gnutls_mac_algorithm_t, const void *nonce, size_t nonce_size, const void *key, size_t keysize, const void *text, size_t textsize, void *digest); typedef void *(*gnutls_mac_copy_func) (const void *ctx); int gnutls_crypto_register_mac(gnutls_mac_algorithm_t mac, int priority, gnutls_mac_init_func init, gnutls_mac_setkey_func setkey, gnutls_mac_setnonce_func setnonce, gnutls_mac_hash_func hash, gnutls_mac_output_func output, gnutls_mac_deinit_func deinit, gnutls_mac_fast_func hash_fast) _GNUTLS_GCC_ATTR_DEPRECATED; typedef int (*gnutls_digest_init_func) (gnutls_digest_algorithm_t, void **ctx); typedef int (*gnutls_digest_hash_func) (void *ctx, const void *text, size_t textsize); typedef int (*gnutls_digest_output_func) (void *src_ctx, void *digest, size_t digestsize); typedef void (*gnutls_digest_deinit_func) (void *ctx); typedef int (*gnutls_digest_fast_func) (gnutls_digest_algorithm_t, const void *text, size_t textsize, void *digest); typedef void *(*gnutls_digest_copy_func) (const void *ctx); int gnutls_crypto_register_digest(gnutls_digest_algorithm_t digest, int priority, gnutls_digest_init_func init, gnutls_digest_hash_func hash, gnutls_digest_output_func output, gnutls_digest_deinit_func deinit, gnutls_digest_fast_func hash_fast) _GNUTLS_GCC_ATTR_DEPRECATED; /* RSA-PKCS#1 1.5 helper functions */ int gnutls_encode_ber_digest_info(gnutls_digest_algorithm_t hash, const gnutls_datum_t * digest, gnutls_datum_t * output); int gnutls_decode_ber_digest_info(const gnutls_datum_t * info, gnutls_digest_algorithm_t *hash, unsigned char *digest, unsigned int *digest_size); int gnutls_decode_rs_value(const gnutls_datum_t * sig_value, gnutls_datum_t *r, gnutls_datum_t *s); int gnutls_encode_rs_value(gnutls_datum_t * sig_value, const gnutls_datum_t * r, const gnutls_datum_t * s); int gnutls_encode_gost_rs_value(gnutls_datum_t * sig_value, const gnutls_datum_t * r, const gnutls_datum_t *s); int gnutls_decode_gost_rs_value(const gnutls_datum_t * sig_value, gnutls_datum_t * r, gnutls_datum_t * s); /* *INDENT-OFF* */ #ifdef __cplusplus } #endif /* *INDENT-ON* */ #endif /* GNUTLS_CRYPTO_H */
12,187
C++
.h
279
39.731183
112
0.719646
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,436
gnutls.h
Nevcairiel_LAVFilters/thirdparty/32/include/gnutls/gnutls.h
/* -*- c -*- * Copyright (C) 2000-2016 Free Software Foundation, Inc. * Copyright (C) 2015-2017 Red Hat, Inc. * * Author: Nikos Mavrogiannopoulos * * This file is part of GnuTLS. * * The GnuTLS is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <https://www.gnu.org/licenses/> * */ /* This file contains the types and prototypes for all the * high level functionality of the gnutls main library. * * If the optional C++ binding was built, it is available in * gnutls/gnutlsxx.h. * * The openssl compatibility layer (which is under the GNU GPL * license) is in gnutls/openssl.h. * * The low level cipher functionality is in gnutls/crypto.h. */ #ifndef GNUTLS_GNUTLS_H #define GNUTLS_GNUTLS_H /* Get ssize_t. */ #include <sys/types.h> /* Get size_t. */ #include <stddef.h> /* Get time_t. */ #include <time.h> /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { #endif /* *INDENT-ON* */ #define GNUTLS_VERSION "3.7.10" #define GNUTLS_VERSION_MAJOR 3 #define GNUTLS_VERSION_MINOR 7 #define GNUTLS_VERSION_PATCH 10 #define GNUTLS_VERSION_NUMBER 0x03070a #define GNUTLS_CIPHER_RIJNDAEL_128_CBC GNUTLS_CIPHER_AES_128_CBC #define GNUTLS_CIPHER_RIJNDAEL_256_CBC GNUTLS_CIPHER_AES_256_CBC #define GNUTLS_CIPHER_RIJNDAEL_CBC GNUTLS_CIPHER_AES_128_CBC #define GNUTLS_CIPHER_ARCFOUR GNUTLS_CIPHER_ARCFOUR_128 #if !defined(GNUTLS_INTERNAL_BUILD) && defined(_WIN32) # define _SYM_EXPORT __declspec(dllimport) #else # define _SYM_EXPORT #endif #ifdef __GNUC__ # define __GNUTLS_CONST__ __attribute__((const)) # define __GNUTLS_PURE__ __attribute__((pure)) #else # define __GNUTLS_CONST__ # define __GNUTLS_PURE__ #endif /* Use the following definition globally in your program to disable * implicit initialization of gnutls. */ #define GNUTLS_SKIP_GLOBAL_INIT int _gnutls_global_init_skip(void); \ int _gnutls_global_init_skip(void) {return 1;} /** * gnutls_cipher_algorithm_t: * @GNUTLS_CIPHER_UNKNOWN: Value to identify an unknown/unsupported algorithm. * @GNUTLS_CIPHER_NULL: The NULL (identity) encryption algorithm. * @GNUTLS_CIPHER_ARCFOUR_128: ARCFOUR stream cipher with 128-bit keys. * @GNUTLS_CIPHER_3DES_CBC: 3DES in CBC mode. * @GNUTLS_CIPHER_AES_128_CBC: AES in CBC mode with 128-bit keys. * @GNUTLS_CIPHER_AES_192_CBC: AES in CBC mode with 192-bit keys. * @GNUTLS_CIPHER_AES_256_CBC: AES in CBC mode with 256-bit keys. * @GNUTLS_CIPHER_AES_128_CFB8: AES in CFB8 mode with 128-bit keys. * @GNUTLS_CIPHER_AES_192_CFB8: AES in CFB8 mode with 192-bit keys. * @GNUTLS_CIPHER_AES_256_CFB8: AES in CFB8 mode with 256-bit keys. * @GNUTLS_CIPHER_ARCFOUR_40: ARCFOUR stream cipher with 40-bit keys. * @GNUTLS_CIPHER_CAMELLIA_128_CBC: Camellia in CBC mode with 128-bit keys. * @GNUTLS_CIPHER_CAMELLIA_192_CBC: Camellia in CBC mode with 192-bit keys. * @GNUTLS_CIPHER_CAMELLIA_256_CBC: Camellia in CBC mode with 256-bit keys. * @GNUTLS_CIPHER_RC2_40_CBC: RC2 in CBC mode with 40-bit keys. * @GNUTLS_CIPHER_DES_CBC: DES in CBC mode (56-bit keys). * @GNUTLS_CIPHER_AES_128_GCM: AES in GCM mode with 128-bit keys (AEAD). * @GNUTLS_CIPHER_AES_256_GCM: AES in GCM mode with 256-bit keys (AEAD). * @GNUTLS_CIPHER_AES_128_CCM: AES in CCM mode with 128-bit keys (AEAD). * @GNUTLS_CIPHER_AES_256_CCM: AES in CCM mode with 256-bit keys (AEAD). * @GNUTLS_CIPHER_AES_128_CCM_8: AES in CCM mode with 64-bit tag and 128-bit keys (AEAD). * @GNUTLS_CIPHER_AES_256_CCM_8: AES in CCM mode with 64-bit tag and 256-bit keys (AEAD). * @GNUTLS_CIPHER_CAMELLIA_128_GCM: CAMELLIA in GCM mode with 128-bit keys (AEAD). * @GNUTLS_CIPHER_CAMELLIA_256_GCM: CAMELLIA in GCM mode with 256-bit keys (AEAD). * @GNUTLS_CIPHER_SALSA20_256: Salsa20 with 256-bit keys. * @GNUTLS_CIPHER_ESTREAM_SALSA20_256: Estream's Salsa20 variant with 256-bit keys. * @GNUTLS_CIPHER_CHACHA20_32: Chacha20 cipher with 96-bit nonces and 32-bit block counters. * @GNUTLS_CIPHER_CHACHA20_64: Chacha20 cipher with 64-bit nonces and 64-bit block counters. * @GNUTLS_CIPHER_CHACHA20_POLY1305: The Chacha20 cipher with the Poly1305 authenticator (AEAD). * @GNUTLS_CIPHER_GOST28147_TC26Z_CFB: GOST 28147-89 (Magma) cipher in CFB mode with TC26 Z S-box. * @GNUTLS_CIPHER_GOST28147_CPA_CFB: GOST 28147-89 (Magma) cipher in CFB mode with CryptoPro A S-box. * @GNUTLS_CIPHER_GOST28147_CPB_CFB: GOST 28147-89 (Magma) cipher in CFB mode with CryptoPro B S-box. * @GNUTLS_CIPHER_GOST28147_CPC_CFB: GOST 28147-89 (Magma) cipher in CFB mode with CryptoPro C S-box. * @GNUTLS_CIPHER_GOST28147_CPD_CFB: GOST 28147-89 (Magma) cipher in CFB mode with CryptoPro D S-box. * @GNUTLS_CIPHER_AES_128_XTS: AES in XTS mode with 128-bit key + 128bit tweak key. * @GNUTLS_CIPHER_AES_256_XTS: AES in XTS mode with 256-bit key + 256bit tweak key. * Note that the XTS ciphers are message oriented. * The whole message needs to be provided with a single call, because * cipher-stealing requires to know where the message actually terminates * in order to be able to compute where the stealing occurs. * @GNUTLS_CIPHER_GOST28147_TC26Z_CNT: GOST 28147-89 (Magma) cipher in CNT mode with TC26 Z S-box. * @GNUTLS_CIPHER_MAGMA_CTR_ACPKM: GOST R 34.12-2015 (Magma) cipher in CTR-ACPKM mode. * @GNUTLS_CIPHER_KUZNYECHIK_CTR_ACPKM: GOST R 34.12-2015 (Kuznyechik) cipher in CTR-ACPKM mode. * @GNUTLS_CIPHER_IDEA_PGP_CFB: IDEA in CFB mode (placeholder - unsupported). * @GNUTLS_CIPHER_3DES_PGP_CFB: 3DES in CFB mode (placeholder - unsupported). * @GNUTLS_CIPHER_CAST5_PGP_CFB: CAST5 in CFB mode (placeholder - unsupported). * @GNUTLS_CIPHER_BLOWFISH_PGP_CFB: Blowfish in CFB mode (placeholder - unsupported). * @GNUTLS_CIPHER_SAFER_SK128_PGP_CFB: Safer-SK in CFB mode with 128-bit keys (placeholder - unsupported). * @GNUTLS_CIPHER_AES128_PGP_CFB: AES in CFB mode with 128-bit keys (placeholder - unsupported). * @GNUTLS_CIPHER_AES192_PGP_CFB: AES in CFB mode with 192-bit keys (placeholder - unsupported). * @GNUTLS_CIPHER_AES256_PGP_CFB: AES in CFB mode with 256-bit keys (placeholder - unsupported). * @GNUTLS_CIPHER_TWOFISH_PGP_CFB: Twofish in CFB mode (placeholder - unsupported). * @GNUTLS_CIPHER_AES_128_SIV: AES in SIV mode with 128-bit key. * @GNUTLS_CIPHER_AES_256_SIV: AES in SIV mode with 256-bit key. * Note that the SIV ciphers can only be used with * the AEAD interface, and the IV plays a role as * the authentication tag while it is prepended to * the cipher text. * @GNUTLS_CIPHER_AES_192_GCM: AES in GCM mode with 192-bit keys (AEAD). * * Enumeration of different symmetric encryption algorithms. */ typedef enum gnutls_cipher_algorithm { GNUTLS_CIPHER_UNKNOWN = 0, GNUTLS_CIPHER_NULL = 1, GNUTLS_CIPHER_ARCFOUR_128 = 2, GNUTLS_CIPHER_3DES_CBC = 3, GNUTLS_CIPHER_AES_128_CBC = 4, GNUTLS_CIPHER_AES_256_CBC = 5, GNUTLS_CIPHER_ARCFOUR_40 = 6, GNUTLS_CIPHER_CAMELLIA_128_CBC = 7, GNUTLS_CIPHER_CAMELLIA_256_CBC = 8, GNUTLS_CIPHER_AES_192_CBC = 9, GNUTLS_CIPHER_AES_128_GCM = 10, GNUTLS_CIPHER_AES_256_GCM = 11, GNUTLS_CIPHER_CAMELLIA_192_CBC = 12, GNUTLS_CIPHER_SALSA20_256 = 13, GNUTLS_CIPHER_ESTREAM_SALSA20_256 = 14, GNUTLS_CIPHER_CAMELLIA_128_GCM = 15, GNUTLS_CIPHER_CAMELLIA_256_GCM = 16, GNUTLS_CIPHER_RC2_40_CBC = 17, GNUTLS_CIPHER_DES_CBC = 18, GNUTLS_CIPHER_AES_128_CCM = 19, GNUTLS_CIPHER_AES_256_CCM = 20, GNUTLS_CIPHER_AES_128_CCM_8 = 21, GNUTLS_CIPHER_AES_256_CCM_8 = 22, GNUTLS_CIPHER_CHACHA20_POLY1305 = 23, GNUTLS_CIPHER_GOST28147_TC26Z_CFB = 24, GNUTLS_CIPHER_GOST28147_CPA_CFB = 25, GNUTLS_CIPHER_GOST28147_CPB_CFB = 26, GNUTLS_CIPHER_GOST28147_CPC_CFB = 27, GNUTLS_CIPHER_GOST28147_CPD_CFB = 28, GNUTLS_CIPHER_AES_128_CFB8 = 29, GNUTLS_CIPHER_AES_192_CFB8 = 30, GNUTLS_CIPHER_AES_256_CFB8 = 31, GNUTLS_CIPHER_AES_128_XTS = 32, GNUTLS_CIPHER_AES_256_XTS = 33, GNUTLS_CIPHER_GOST28147_TC26Z_CNT = 34, GNUTLS_CIPHER_CHACHA20_64 = 35, GNUTLS_CIPHER_CHACHA20_32 = 36, GNUTLS_CIPHER_AES_128_SIV = 37, GNUTLS_CIPHER_AES_256_SIV = 38, GNUTLS_CIPHER_AES_192_GCM = 39, GNUTLS_CIPHER_MAGMA_CTR_ACPKM = 40, GNUTLS_CIPHER_KUZNYECHIK_CTR_ACPKM = 41, /* used only for PGP internals. Ignored in TLS/SSL */ GNUTLS_CIPHER_IDEA_PGP_CFB = 200, GNUTLS_CIPHER_3DES_PGP_CFB = 201, GNUTLS_CIPHER_CAST5_PGP_CFB = 202, GNUTLS_CIPHER_BLOWFISH_PGP_CFB = 203, GNUTLS_CIPHER_SAFER_SK128_PGP_CFB = 204, GNUTLS_CIPHER_AES128_PGP_CFB = 205, GNUTLS_CIPHER_AES192_PGP_CFB = 206, GNUTLS_CIPHER_AES256_PGP_CFB = 207, GNUTLS_CIPHER_TWOFISH_PGP_CFB = 208 } gnutls_cipher_algorithm_t; /** * gnutls_kx_algorithm_t: * @GNUTLS_KX_UNKNOWN: Unknown key-exchange algorithm. * @GNUTLS_KX_RSA: RSA key-exchange algorithm. * @GNUTLS_KX_DHE_DSS: DHE-DSS key-exchange algorithm. * @GNUTLS_KX_DHE_RSA: DHE-RSA key-exchange algorithm. * @GNUTLS_KX_ECDHE_RSA: ECDHE-RSA key-exchange algorithm. * @GNUTLS_KX_ECDHE_ECDSA: ECDHE-ECDSA key-exchange algorithm. * @GNUTLS_KX_ANON_DH: Anon-DH key-exchange algorithm. * @GNUTLS_KX_ANON_ECDH: Anon-ECDH key-exchange algorithm. * @GNUTLS_KX_SRP: SRP key-exchange algorithm. * @GNUTLS_KX_RSA_EXPORT: RSA-EXPORT key-exchange algorithm (defunc). * @GNUTLS_KX_SRP_RSA: SRP-RSA key-exchange algorithm. * @GNUTLS_KX_SRP_DSS: SRP-DSS key-exchange algorithm. * @GNUTLS_KX_PSK: PSK key-exchange algorithm. * @GNUTLS_KX_DHE_PSK: DHE-PSK key-exchange algorithm. * @GNUTLS_KX_ECDHE_PSK: ECDHE-PSK key-exchange algorithm. * @GNUTLS_KX_RSA_PSK: RSA-PSK key-exchange algorithm. * @GNUTLS_KX_VKO_GOST_12: VKO GOST R 34.10-2012 key-exchange algorithm. * * Enumeration of different key exchange algorithms. */ typedef enum { GNUTLS_KX_UNKNOWN = 0, GNUTLS_KX_RSA = 1, GNUTLS_KX_DHE_DSS = 2, GNUTLS_KX_DHE_RSA = 3, GNUTLS_KX_ANON_DH = 4, GNUTLS_KX_SRP = 5, GNUTLS_KX_RSA_EXPORT = 6, GNUTLS_KX_SRP_RSA = 7, GNUTLS_KX_SRP_DSS = 8, GNUTLS_KX_PSK = 9, GNUTLS_KX_DHE_PSK = 10, GNUTLS_KX_ANON_ECDH = 11, GNUTLS_KX_ECDHE_RSA = 12, GNUTLS_KX_ECDHE_ECDSA = 13, GNUTLS_KX_ECDHE_PSK = 14, GNUTLS_KX_RSA_PSK = 15, GNUTLS_KX_VKO_GOST_12 = 16 } gnutls_kx_algorithm_t; /** * gnutls_params_type_t: * @GNUTLS_PARAMS_RSA_EXPORT: Session RSA-EXPORT parameters (defunc). * @GNUTLS_PARAMS_DH: Session Diffie-Hellman parameters. * @GNUTLS_PARAMS_ECDH: Session Elliptic-Curve Diffie-Hellman parameters. * * Enumeration of different TLS session parameter types. */ typedef enum { GNUTLS_PARAMS_RSA_EXPORT = 1, GNUTLS_PARAMS_DH = 2, GNUTLS_PARAMS_ECDH = 3 } gnutls_params_type_t; /** * gnutls_credentials_type_t: * @GNUTLS_CRD_CERTIFICATE: Certificate credential. * @GNUTLS_CRD_ANON: Anonymous credential. * @GNUTLS_CRD_SRP: SRP credential. * @GNUTLS_CRD_PSK: PSK credential. * @GNUTLS_CRD_IA: IA credential. * * Enumeration of different credential types. */ typedef enum { GNUTLS_CRD_CERTIFICATE = 1, GNUTLS_CRD_ANON, GNUTLS_CRD_SRP, GNUTLS_CRD_PSK, GNUTLS_CRD_IA } gnutls_credentials_type_t; #define GNUTLS_MAC_SHA GNUTLS_MAC_SHA1 #define GNUTLS_DIG_SHA GNUTLS_DIG_SHA1 /** * gnutls_mac_algorithm_t: * @GNUTLS_MAC_UNKNOWN: Unknown MAC algorithm. * @GNUTLS_MAC_NULL: NULL MAC algorithm (empty output). * @GNUTLS_MAC_MD5: HMAC-MD5 algorithm. * @GNUTLS_MAC_SHA1: HMAC-SHA-1 algorithm. * @GNUTLS_MAC_RMD160: HMAC-RMD160 algorithm. * @GNUTLS_MAC_MD2: HMAC-MD2 algorithm. * @GNUTLS_MAC_SHA256: HMAC-SHA-256 algorithm. * @GNUTLS_MAC_SHA384: HMAC-SHA-384 algorithm. * @GNUTLS_MAC_SHA512: HMAC-SHA-512 algorithm. * @GNUTLS_MAC_SHA224: HMAC-SHA-224 algorithm. * @GNUTLS_MAC_MD5_SHA1: Combined MD5+SHA1 MAC placeholder. * @GNUTLS_MAC_GOSTR_94: HMAC GOST R 34.11-94 algorithm. * @GNUTLS_MAC_STREEBOG_256: HMAC GOST R 34.11-2001 (Streebog) algorithm, 256 bit. * @GNUTLS_MAC_STREEBOG_512: HMAC GOST R 34.11-2001 (Streebog) algorithm, 512 bit. * @GNUTLS_MAC_AEAD: MAC implicit through AEAD cipher. * @GNUTLS_MAC_UMAC_96: The UMAC-96 MAC algorithm (requires nonce). * @GNUTLS_MAC_UMAC_128: The UMAC-128 MAC algorithm (requires nonce). * @GNUTLS_MAC_AES_CMAC_128: The AES-CMAC-128 MAC algorithm. * @GNUTLS_MAC_AES_CMAC_256: The AES-CMAC-256 MAC algorithm. * @GNUTLS_MAC_AES_GMAC_128: The AES-GMAC-128 MAC algorithm (requires nonce). * @GNUTLS_MAC_AES_GMAC_192: The AES-GMAC-192 MAC algorithm (requires nonce). * @GNUTLS_MAC_AES_GMAC_256: The AES-GMAC-256 MAC algorithm (requires nonce). * @GNUTLS_MAC_SHA3_224: Reserved; unimplemented. * @GNUTLS_MAC_SHA3_256: Reserved; unimplemented. * @GNUTLS_MAC_SHA3_384: Reserved; unimplemented. * @GNUTLS_MAC_SHA3_512: Reserved; unimplemented. * @GNUTLS_MAC_GOST28147_TC26Z_IMIT: The GOST 28147-89 working in IMIT mode with TC26 Z S-box. * @GNUTLS_MAC_SHAKE_128: Reserved; unimplemented. * @GNUTLS_MAC_SHAKE_256: Reserved; unimplemented. * @GNUTLS_MAC_MAGMA_OMAC: GOST R 34.12-2015 (Magma) in OMAC (CMAC) mode. * @GNUTLS_MAC_KUZNYECHIK_OMAC: GOST R 34.12-2015 (Kuznyechik) in OMAC (CMAC) mode. * * Enumeration of different Message Authentication Code (MAC) * algorithms. */ typedef enum { GNUTLS_MAC_UNKNOWN = 0, GNUTLS_MAC_NULL = 1, GNUTLS_MAC_MD5 = 2, GNUTLS_MAC_SHA1 = 3, GNUTLS_MAC_RMD160 = 4, GNUTLS_MAC_MD2 = 5, GNUTLS_MAC_SHA256 = 6, GNUTLS_MAC_SHA384 = 7, GNUTLS_MAC_SHA512 = 8, GNUTLS_MAC_SHA224 = 9, GNUTLS_MAC_SHA3_224 = 10, /* reserved: no implementation */ GNUTLS_MAC_SHA3_256 = 11, /* reserved: no implementation */ GNUTLS_MAC_SHA3_384 = 12, /* reserved: no implementation */ GNUTLS_MAC_SHA3_512 = 13, /* reserved: no implementation */ GNUTLS_MAC_MD5_SHA1 = 14, /* reserved: no implementation */ GNUTLS_MAC_GOSTR_94 = 15, GNUTLS_MAC_STREEBOG_256 = 16, GNUTLS_MAC_STREEBOG_512 = 17, /* If you add anything here, make sure you align with gnutls_digest_algorithm_t. */ GNUTLS_MAC_AEAD = 200, /* indicates that MAC is on the cipher */ GNUTLS_MAC_UMAC_96 = 201, GNUTLS_MAC_UMAC_128 = 202, GNUTLS_MAC_AES_CMAC_128 = 203, GNUTLS_MAC_AES_CMAC_256 = 204, GNUTLS_MAC_AES_GMAC_128 = 205, GNUTLS_MAC_AES_GMAC_192 = 206, GNUTLS_MAC_AES_GMAC_256 = 207, GNUTLS_MAC_GOST28147_TC26Z_IMIT = 208, GNUTLS_MAC_SHAKE_128 = 209, GNUTLS_MAC_SHAKE_256 = 210, GNUTLS_MAC_MAGMA_OMAC = 211, GNUTLS_MAC_KUZNYECHIK_OMAC = 212 } gnutls_mac_algorithm_t; /** * gnutls_digest_algorithm_t: * @GNUTLS_DIG_UNKNOWN: Unknown hash algorithm. * @GNUTLS_DIG_NULL: NULL hash algorithm (empty output). * @GNUTLS_DIG_MD5: MD5 algorithm. * @GNUTLS_DIG_SHA1: SHA-1 algorithm. * @GNUTLS_DIG_RMD160: RMD160 algorithm. * @GNUTLS_DIG_MD2: MD2 algorithm. * @GNUTLS_DIG_SHA256: SHA-256 algorithm. * @GNUTLS_DIG_SHA384: SHA-384 algorithm. * @GNUTLS_DIG_SHA512: SHA-512 algorithm. * @GNUTLS_DIG_SHA224: SHA-224 algorithm. * @GNUTLS_DIG_SHA3_224: SHA3-224 algorithm. * @GNUTLS_DIG_SHA3_256: SHA3-256 algorithm. * @GNUTLS_DIG_SHA3_384: SHA3-384 algorithm. * @GNUTLS_DIG_SHA3_512: SHA3-512 algorithm. * @GNUTLS_DIG_MD5_SHA1: Combined MD5+SHA1 algorithm. * @GNUTLS_DIG_GOSTR_94: GOST R 34.11-94 algorithm. * @GNUTLS_DIG_STREEBOG_256: GOST R 34.11-2001 (Streebog) algorithm, 256 bit. * @GNUTLS_DIG_STREEBOG_512: GOST R 34.11-2001 (Streebog) algorithm, 512 bit. * @GNUTLS_DIG_SHAKE_128: Reserved; unimplemented. * @GNUTLS_DIG_SHAKE_256: Reserved; unimplemented. * * Enumeration of different digest (hash) algorithms. */ typedef enum { GNUTLS_DIG_UNKNOWN = GNUTLS_MAC_UNKNOWN, GNUTLS_DIG_NULL = GNUTLS_MAC_NULL, GNUTLS_DIG_MD5 = GNUTLS_MAC_MD5, GNUTLS_DIG_SHA1 = GNUTLS_MAC_SHA1, GNUTLS_DIG_RMD160 = GNUTLS_MAC_RMD160, GNUTLS_DIG_MD2 = GNUTLS_MAC_MD2, GNUTLS_DIG_SHA256 = GNUTLS_MAC_SHA256, GNUTLS_DIG_SHA384 = GNUTLS_MAC_SHA384, GNUTLS_DIG_SHA512 = GNUTLS_MAC_SHA512, GNUTLS_DIG_SHA224 = GNUTLS_MAC_SHA224, GNUTLS_DIG_SHA3_224 = GNUTLS_MAC_SHA3_224, GNUTLS_DIG_SHA3_256 = GNUTLS_MAC_SHA3_256, GNUTLS_DIG_SHA3_384 = GNUTLS_MAC_SHA3_384, GNUTLS_DIG_SHA3_512 = GNUTLS_MAC_SHA3_512, GNUTLS_DIG_MD5_SHA1 = GNUTLS_MAC_MD5_SHA1, GNUTLS_DIG_GOSTR_94 = GNUTLS_MAC_GOSTR_94, GNUTLS_DIG_STREEBOG_256 = GNUTLS_MAC_STREEBOG_256, GNUTLS_DIG_STREEBOG_512 = GNUTLS_MAC_STREEBOG_512, GNUTLS_DIG_SHAKE_128 = GNUTLS_MAC_SHAKE_128, GNUTLS_DIG_SHAKE_256 = GNUTLS_MAC_SHAKE_256 /* If you add anything here, make sure you align with gnutls_mac_algorithm_t. */ } gnutls_digest_algorithm_t; /* exported for other gnutls headers. This is the maximum number of * algorithms (ciphers, kx or macs). */ #define GNUTLS_MAX_ALGORITHM_NUM 128 #define GNUTLS_MAX_SESSION_ID_SIZE 32 /** * gnutls_compression_method_t: * @GNUTLS_COMP_UNKNOWN: Unknown compression method. * @GNUTLS_COMP_NULL: The NULL compression method (no compression). * @GNUTLS_COMP_DEFLATE: The DEFLATE compression method from zlib. * @GNUTLS_COMP_ZLIB: Same as %GNUTLS_COMP_DEFLATE. * @GNUTLS_COMP_BROTLI: Brotli compression method. * @GNUTLS_COMP_ZSTD: Zstandard compression method. * * Enumeration of different TLS compression methods. */ typedef enum { GNUTLS_COMP_UNKNOWN = 0, GNUTLS_COMP_NULL = 1, GNUTLS_COMP_DEFLATE = 2, GNUTLS_COMP_ZLIB = GNUTLS_COMP_DEFLATE, GNUTLS_COMP_BROTLI = 3, GNUTLS_COMP_ZSTD = 4 } gnutls_compression_method_t; /** * gnutls_init_flags_t: * * @GNUTLS_SERVER: Connection end is a server. * @GNUTLS_CLIENT: Connection end is a client. * @GNUTLS_DATAGRAM: Connection is datagram oriented (DTLS). Since 3.0.0. * @GNUTLS_NONBLOCK: Connection should not block. Since 3.0.0. * @GNUTLS_NO_SIGNAL: In systems where SIGPIPE is delivered on send, it will be disabled. That flag has effect in systems which support the MSG_NOSIGNAL sockets flag (since 3.4.2). * @GNUTLS_NO_EXTENSIONS: Do not enable any TLS extensions by default (since 3.1.2). As TLS 1.2 and later require extensions this option is considered obsolete and should not be used. * @GNUTLS_NO_REPLAY_PROTECTION: Disable any replay protection in DTLS. This must only be used if replay protection is achieved using other means. Since 3.2.2. * @GNUTLS_ALLOW_ID_CHANGE: Allow the peer to replace its certificate, or change its ID during a rehandshake. This change is often used in attacks and thus prohibited by default. Since 3.5.0. * @GNUTLS_ENABLE_FALSE_START: Enable the TLS false start on client side if the negotiated ciphersuites allow it. This will enable sending data prior to the handshake being complete, and may introduce a risk of crypto failure when combined with certain key exchanged; for that GnuTLS may not enable that option in ciphersuites that are known to be not safe for false start. Since 3.5.0. * @GNUTLS_ENABLE_EARLY_START: Under TLS1.3 allow the server to return earlier than the full handshake * finish; similarly to false start the handshake will be completed once data are received by the * client, while the server is able to transmit sooner. This is not enabled by default as it could * break certain existing server assumptions and use-cases. Since 3.6.4. * @GNUTLS_ENABLE_EARLY_DATA: Under TLS1.3 allow the server to receive early data sent as part of the initial ClientHello (0-RTT). * This can also be used to explicitly indicate that the client will send early data. * This is not enabled by default as early data has weaker security properties than other data. Since 3.6.5. * @GNUTLS_FORCE_CLIENT_CERT: When in client side and only a single cert is specified, send that certificate irrespective of the issuers expected by the server. Since 3.5.0. * @GNUTLS_NO_TICKETS: Flag to indicate that the session should not use resumption with session tickets. * @GNUTLS_NO_TICKETS_TLS12: Flag to indicate that the session should not use resumption with session tickets. This flag only has effect if TLS 1.2 is used. * @GNUTLS_KEY_SHARE_TOP3: Generate key shares for the top-3 different groups which are enabled. * That is, as each group is associated with a key type (EC, finite field, x25519), generate * three keys using %GNUTLS_PK_DH, %GNUTLS_PK_EC, %GNUTLS_PK_ECDH_X25519 if all of them are enabled. * @GNUTLS_KEY_SHARE_TOP2: Generate key shares for the top-2 different groups which are enabled. * For example (ECDH + x25519). This is the default. * @GNUTLS_KEY_SHARE_TOP: Generate key share for the first group which is enabled. * For example x25519. This option is the most performant for client (less CPU spent * generating keys), but if the server doesn't support the advertized option it may * result to more roundtrips needed to discover the server's choice. * @GNUTLS_NO_AUTO_REKEY: Disable auto-rekeying under TLS1.3. If this option is not specified * gnutls will force a rekey after 2^24 records have been sent. * @GNUTLS_POST_HANDSHAKE_AUTH: Enable post handshake authentication for server and client. When set and * a server requests authentication after handshake %GNUTLS_E_REAUTH_REQUEST will be returned * by gnutls_record_recv(). A client should then call gnutls_reauth() to re-authenticate. * @GNUTLS_SAFE_PADDING_CHECK: Flag to indicate that the TLS 1.3 padding check will be done in a * safe way which doesn't leak the pad size based on GnuTLS processing time. This is of use to * applications which hide the length of transferred data via the TLS1.3 padding mechanism and * are already taking steps to hide the data processing time. This comes at a performance * penalty. * @GNUTLS_AUTO_REAUTH: Enable transparent re-authentication in client side when the server * requests to. That is, reauthentication is handled within gnutls_record_recv(), and * the %GNUTLS_E_REHANDSHAKE or %GNUTLS_E_REAUTH_REQUEST are not returned. This must be * enabled with %GNUTLS_POST_HANDSHAKE_AUTH for TLS1.3. Enabling this flag requires to restore * interrupted calls to gnutls_record_recv() based on the output of gnutls_record_get_direction(), * since gnutls_record_recv() could be interrupted when sending when this flag is enabled. * Note this flag may not be used if you are using the same session for sending and receiving * in different threads. * @GNUTLS_ENABLE_RAWPK: Allows raw public-keys to be negotiated during the handshake. Since 3.6.6. * @GNUTLS_NO_AUTO_SEND_TICKET: Under TLS1.3 disable auto-sending of * session tickets during the handshake. * @GNUTLS_NO_END_OF_EARLY_DATA: Under TLS1.3 suppress sending EndOfEarlyData message. Since 3.7.2. * * Enumeration of different flags for gnutls_init() function. All the flags * can be combined except @GNUTLS_SERVER and @GNUTLS_CLIENT which are mutually * exclusive. * * The key share options relate to the TLS 1.3 key share extension * which is a speculative key generation expecting that the server * would support the generated key. */ typedef enum { GNUTLS_SERVER = 1, GNUTLS_CLIENT = (1<<1), GNUTLS_DATAGRAM = (1<<2), GNUTLS_NONBLOCK = (1<<3), GNUTLS_NO_EXTENSIONS = (1<<4), GNUTLS_NO_REPLAY_PROTECTION = (1<<5), GNUTLS_NO_SIGNAL = (1<<6), GNUTLS_ALLOW_ID_CHANGE = (1<<7), GNUTLS_ENABLE_FALSE_START = (1<<8), GNUTLS_FORCE_CLIENT_CERT = (1<<9), GNUTLS_NO_TICKETS = (1<<10), GNUTLS_KEY_SHARE_TOP = (1<<11), GNUTLS_KEY_SHARE_TOP2 = (1<<12), GNUTLS_KEY_SHARE_TOP3 = (1<<13), GNUTLS_POST_HANDSHAKE_AUTH = (1<<14), GNUTLS_NO_AUTO_REKEY = (1<<15), GNUTLS_SAFE_PADDING_CHECK = (1<<16), GNUTLS_ENABLE_EARLY_START = (1<<17), GNUTLS_ENABLE_RAWPK = (1<<18), GNUTLS_AUTO_REAUTH = (1<<19), GNUTLS_ENABLE_EARLY_DATA = (1<<20), GNUTLS_NO_AUTO_SEND_TICKET = (1<<21), GNUTLS_NO_END_OF_EARLY_DATA = (1<<22), GNUTLS_NO_TICKETS_TLS12 = (1<<23) } gnutls_init_flags_t; /* compatibility defines (previous versions of gnutls * used defines instead of enumerated values). */ #define GNUTLS_SERVER (1) #define GNUTLS_CLIENT (1<<1) #define GNUTLS_DATAGRAM (1<<2) #define GNUTLS_NONBLOCK (1<<3) #define GNUTLS_NO_EXTENSIONS (1<<4) #define GNUTLS_NO_REPLAY_PROTECTION (1<<5) #define GNUTLS_NO_SIGNAL (1<<6) #define GNUTLS_ALLOW_ID_CHANGE (1<<7) #define GNUTLS_ENABLE_FALSE_START (1<<8) #define GNUTLS_FORCE_CLIENT_CERT (1<<9) #define GNUTLS_NO_TICKETS (1<<10) #define GNUTLS_ENABLE_CERT_TYPE_NEG 0 // Here for compatibility reasons /** * gnutls_alert_level_t: * @GNUTLS_AL_WARNING: Alert of warning severity. * @GNUTLS_AL_FATAL: Alert of fatal severity. * * Enumeration of different TLS alert severities. */ typedef enum { GNUTLS_AL_WARNING = 1, GNUTLS_AL_FATAL } gnutls_alert_level_t; /** * gnutls_alert_description_t: * @GNUTLS_A_CLOSE_NOTIFY: Close notify. * @GNUTLS_A_UNEXPECTED_MESSAGE: Unexpected message. * @GNUTLS_A_BAD_RECORD_MAC: Bad record MAC. * @GNUTLS_A_DECRYPTION_FAILED: Decryption failed. * @GNUTLS_A_RECORD_OVERFLOW: Record overflow. * @GNUTLS_A_DECOMPRESSION_FAILURE: Decompression failed. * @GNUTLS_A_HANDSHAKE_FAILURE: Handshake failed. * @GNUTLS_A_SSL3_NO_CERTIFICATE: No certificate. * @GNUTLS_A_BAD_CERTIFICATE: Certificate is bad. * @GNUTLS_A_UNSUPPORTED_CERTIFICATE: Certificate is not supported. * @GNUTLS_A_CERTIFICATE_REVOKED: Certificate was revoked. * @GNUTLS_A_CERTIFICATE_EXPIRED: Certificate is expired. * @GNUTLS_A_CERTIFICATE_UNKNOWN: Unknown certificate. * @GNUTLS_A_ILLEGAL_PARAMETER: Illegal parameter. * @GNUTLS_A_UNKNOWN_CA: CA is unknown. * @GNUTLS_A_ACCESS_DENIED: Access was denied. * @GNUTLS_A_DECODE_ERROR: Decode error. * @GNUTLS_A_DECRYPT_ERROR: Decrypt error. * @GNUTLS_A_EXPORT_RESTRICTION: Export restriction. * @GNUTLS_A_PROTOCOL_VERSION: Error in protocol version. * @GNUTLS_A_INSUFFICIENT_SECURITY: Insufficient security. * @GNUTLS_A_INTERNAL_ERROR: Internal error. * @GNUTLS_A_INAPPROPRIATE_FALLBACK: Inappropriate fallback, * @GNUTLS_A_USER_CANCELED: User canceled. * @GNUTLS_A_NO_RENEGOTIATION: No renegotiation is allowed. * @GNUTLS_A_MISSING_EXTENSION: An extension was expected but was not seen * @GNUTLS_A_UNSUPPORTED_EXTENSION: An unsupported extension was * sent. * @GNUTLS_A_CERTIFICATE_UNOBTAINABLE: Could not retrieve the * specified certificate. * @GNUTLS_A_UNRECOGNIZED_NAME: The server name sent was not * recognized. * @GNUTLS_A_UNKNOWN_PSK_IDENTITY: The SRP/PSK username is missing * or not known. * @GNUTLS_A_CERTIFICATE_REQUIRED: Certificate is required. * @GNUTLS_A_NO_APPLICATION_PROTOCOL: The ALPN protocol requested is * not supported by the peer. * * Enumeration of different TLS alerts. */ typedef enum { GNUTLS_A_CLOSE_NOTIFY, GNUTLS_A_UNEXPECTED_MESSAGE = 10, GNUTLS_A_BAD_RECORD_MAC = 20, GNUTLS_A_DECRYPTION_FAILED, GNUTLS_A_RECORD_OVERFLOW, GNUTLS_A_DECOMPRESSION_FAILURE = 30, GNUTLS_A_HANDSHAKE_FAILURE = 40, GNUTLS_A_SSL3_NO_CERTIFICATE = 41, GNUTLS_A_BAD_CERTIFICATE = 42, GNUTLS_A_UNSUPPORTED_CERTIFICATE, GNUTLS_A_CERTIFICATE_REVOKED, GNUTLS_A_CERTIFICATE_EXPIRED, GNUTLS_A_CERTIFICATE_UNKNOWN, GNUTLS_A_ILLEGAL_PARAMETER, GNUTLS_A_UNKNOWN_CA, GNUTLS_A_ACCESS_DENIED, GNUTLS_A_DECODE_ERROR = 50, GNUTLS_A_DECRYPT_ERROR, GNUTLS_A_EXPORT_RESTRICTION = 60, GNUTLS_A_PROTOCOL_VERSION = 70, GNUTLS_A_INSUFFICIENT_SECURITY, GNUTLS_A_INTERNAL_ERROR = 80, GNUTLS_A_INAPPROPRIATE_FALLBACK = 86, GNUTLS_A_USER_CANCELED = 90, GNUTLS_A_NO_RENEGOTIATION = 100, GNUTLS_A_MISSING_EXTENSION = 109, GNUTLS_A_UNSUPPORTED_EXTENSION = 110, GNUTLS_A_CERTIFICATE_UNOBTAINABLE = 111, GNUTLS_A_UNRECOGNIZED_NAME = 112, GNUTLS_A_UNKNOWN_PSK_IDENTITY = 115, GNUTLS_A_CERTIFICATE_REQUIRED = 116, GNUTLS_A_NO_APPLICATION_PROTOCOL = 120, GNUTLS_A_MAX = GNUTLS_A_NO_APPLICATION_PROTOCOL } gnutls_alert_description_t; /** * gnutls_handshake_description_t: * @GNUTLS_HANDSHAKE_HELLO_REQUEST: Hello request. * @GNUTLS_HANDSHAKE_HELLO_VERIFY_REQUEST: DTLS Hello verify request. * @GNUTLS_HANDSHAKE_CLIENT_HELLO: Client hello. * @GNUTLS_HANDSHAKE_SERVER_HELLO: Server hello. * @GNUTLS_HANDSHAKE_END_OF_EARLY_DATA: End of early data. * @GNUTLS_HANDSHAKE_HELLO_RETRY_REQUEST: Hello retry request. * @GNUTLS_HANDSHAKE_NEW_SESSION_TICKET: New session ticket. * @GNUTLS_HANDSHAKE_CERTIFICATE_PKT: Certificate packet. * @GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE: Server key exchange. * @GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST: Certificate request. * @GNUTLS_HANDSHAKE_SERVER_HELLO_DONE: Server hello done. * @GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY: Certificate verify. * @GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE: Client key exchange. * @GNUTLS_HANDSHAKE_FINISHED: Finished. * @GNUTLS_HANDSHAKE_CERTIFICATE_STATUS: Certificate status (OCSP). * @GNUTLS_HANDSHAKE_KEY_UPDATE: TLS1.3 key update message. * @GNUTLS_HANDSHAKE_COMPRESSED_CERTIFICATE_PKT: Compressed certificate packet. * @GNUTLS_HANDSHAKE_SUPPLEMENTAL: Supplemental. * @GNUTLS_HANDSHAKE_CHANGE_CIPHER_SPEC: Change Cipher Spec. * @GNUTLS_HANDSHAKE_CLIENT_HELLO_V2: SSLv2 Client Hello. * @GNUTLS_HANDSHAKE_ENCRYPTED_EXTENSIONS: Encrypted extensions message. * * Enumeration of different TLS handshake packets. */ typedef enum { GNUTLS_HANDSHAKE_HELLO_REQUEST = 0, GNUTLS_HANDSHAKE_CLIENT_HELLO = 1, GNUTLS_HANDSHAKE_SERVER_HELLO = 2, GNUTLS_HANDSHAKE_HELLO_VERIFY_REQUEST = 3, GNUTLS_HANDSHAKE_NEW_SESSION_TICKET = 4, GNUTLS_HANDSHAKE_END_OF_EARLY_DATA = 5, GNUTLS_HANDSHAKE_ENCRYPTED_EXTENSIONS = 8, GNUTLS_HANDSHAKE_CERTIFICATE_PKT = 11, GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE = 12, GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST = 13, GNUTLS_HANDSHAKE_SERVER_HELLO_DONE = 14, GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY = 15, GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE = 16, GNUTLS_HANDSHAKE_FINISHED = 20, GNUTLS_HANDSHAKE_CERTIFICATE_STATUS = 22, GNUTLS_HANDSHAKE_SUPPLEMENTAL = 23, GNUTLS_HANDSHAKE_KEY_UPDATE = 24, GNUTLS_HANDSHAKE_COMPRESSED_CERTIFICATE_PKT = 25, GNUTLS_HANDSHAKE_CHANGE_CIPHER_SPEC = 254, GNUTLS_HANDSHAKE_CLIENT_HELLO_V2 = 1024, GNUTLS_HANDSHAKE_HELLO_RETRY_REQUEST = 1025, } gnutls_handshake_description_t; #define GNUTLS_HANDSHAKE_ANY ((unsigned int)-1) const char *gnutls_handshake_description_get_name(gnutls_handshake_description_t type); /** * gnutls_certificate_status_t: * @GNUTLS_CERT_INVALID: The certificate is not signed by one of the * known authorities or the signature is invalid (deprecated by the flags * %GNUTLS_CERT_SIGNATURE_FAILURE and %GNUTLS_CERT_SIGNER_NOT_FOUND). * @GNUTLS_CERT_SIGNATURE_FAILURE: The signature verification failed. * @GNUTLS_CERT_REVOKED: Certificate is revoked by its authority. In X.509 this will be * set only if CRLs are checked. * @GNUTLS_CERT_SIGNER_NOT_FOUND: The certificate's issuer is not known. * This is the case if the issuer is not included in the trusted certificate list. * @GNUTLS_CERT_SIGNER_NOT_CA: The certificate's signer was not a CA. This * may happen if this was a version 1 certificate, which is common with * some CAs, or a version 3 certificate without the basic constrains extension. * @GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE: The certificate's signer constraints were * violated. * @GNUTLS_CERT_INSECURE_ALGORITHM: The certificate was signed using an insecure * algorithm such as MD2 or MD5. These algorithms have been broken and * should not be trusted. * @GNUTLS_CERT_NOT_ACTIVATED: The certificate is not yet activated. * @GNUTLS_CERT_EXPIRED: The certificate has expired. * @GNUTLS_CERT_REVOCATION_DATA_SUPERSEDED: The revocation data are old and have been superseded. * @GNUTLS_CERT_REVOCATION_DATA_ISSUED_IN_FUTURE: The revocation data have a future issue date. * @GNUTLS_CERT_UNEXPECTED_OWNER: The owner is not the expected one. * @GNUTLS_CERT_MISMATCH: The certificate presented isn't the expected one (TOFU) * @GNUTLS_CERT_PURPOSE_MISMATCH: The certificate or an intermediate does not match the intended purpose (extended key usage). * @GNUTLS_CERT_MISSING_OCSP_STATUS: The certificate requires the server to send the certificate status, but no status was received. * @GNUTLS_CERT_INVALID_OCSP_STATUS: The received OCSP status response is invalid. * @GNUTLS_CERT_UNKNOWN_CRIT_EXTENSIONS: The certificate has extensions marked as critical which are not supported. * * Enumeration of certificate status codes. Note that the status * bits may have different meanings in OpenPGP keys and X.509 * certificate verification. */ typedef enum { GNUTLS_CERT_INVALID = 1 << 1, GNUTLS_CERT_REVOKED = 1 << 5, GNUTLS_CERT_SIGNER_NOT_FOUND = 1 << 6, GNUTLS_CERT_SIGNER_NOT_CA = 1 << 7, GNUTLS_CERT_INSECURE_ALGORITHM = 1 << 8, GNUTLS_CERT_NOT_ACTIVATED = 1 << 9, GNUTLS_CERT_EXPIRED = 1 << 10, GNUTLS_CERT_SIGNATURE_FAILURE = 1 << 11, GNUTLS_CERT_REVOCATION_DATA_SUPERSEDED = 1 << 12, GNUTLS_CERT_UNEXPECTED_OWNER = 1 << 14, GNUTLS_CERT_REVOCATION_DATA_ISSUED_IN_FUTURE = 1 << 15, GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE = 1 << 16, GNUTLS_CERT_MISMATCH = 1 << 17, GNUTLS_CERT_PURPOSE_MISMATCH = 1 << 18, GNUTLS_CERT_MISSING_OCSP_STATUS = 1 << 19, GNUTLS_CERT_INVALID_OCSP_STATUS = 1 << 20, GNUTLS_CERT_UNKNOWN_CRIT_EXTENSIONS = 1 << 21 } gnutls_certificate_status_t; /** * gnutls_certificate_request_t: * @GNUTLS_CERT_IGNORE: Ignore certificate. * @GNUTLS_CERT_REQUEST: Request certificate. * @GNUTLS_CERT_REQUIRE: Require certificate. * * Enumeration of certificate request types. */ typedef enum { GNUTLS_CERT_IGNORE = 0, GNUTLS_CERT_REQUEST = 1, GNUTLS_CERT_REQUIRE = 2 } gnutls_certificate_request_t; /** * gnutls_openpgp_crt_status_t: * @GNUTLS_OPENPGP_CERT: Send entire certificate. * @GNUTLS_OPENPGP_CERT_FINGERPRINT: Send only certificate fingerprint. * * Enumeration of ways to send OpenPGP certificate. */ typedef enum { GNUTLS_OPENPGP_CERT = 0, GNUTLS_OPENPGP_CERT_FINGERPRINT = 1 } gnutls_openpgp_crt_status_t; /** * gnutls_close_request_t: * @GNUTLS_SHUT_RDWR: Disallow further receives/sends. * @GNUTLS_SHUT_WR: Disallow further sends. * * Enumeration of how TLS session should be terminated. See gnutls_bye(). */ typedef enum { GNUTLS_SHUT_RDWR = 0, GNUTLS_SHUT_WR = 1 } gnutls_close_request_t; /** * gnutls_protocol_t: * @GNUTLS_SSL3: SSL version 3.0. * @GNUTLS_TLS1_0: TLS version 1.0. * @GNUTLS_TLS1: Same as %GNUTLS_TLS1_0. * @GNUTLS_TLS1_1: TLS version 1.1. * @GNUTLS_TLS1_2: TLS version 1.2. * @GNUTLS_TLS1_3: TLS version 1.3. * @GNUTLS_DTLS1_0: DTLS version 1.0. * @GNUTLS_DTLS1_2: DTLS version 1.2. * @GNUTLS_DTLS0_9: DTLS version 0.9 (Cisco AnyConnect / OpenSSL 0.9.8e). * @GNUTLS_TLS_VERSION_MAX: Maps to the highest supported TLS version. * @GNUTLS_DTLS_VERSION_MAX: Maps to the highest supported DTLS version. * @GNUTLS_VERSION_UNKNOWN: Unknown SSL/TLS version. * * Enumeration of different SSL/TLS protocol versions. */ typedef enum { GNUTLS_SSL3 = 1, GNUTLS_TLS1_0 = 2, GNUTLS_TLS1 = GNUTLS_TLS1_0, GNUTLS_TLS1_1 = 3, GNUTLS_TLS1_2 = 4, GNUTLS_TLS1_3 = 5, GNUTLS_DTLS0_9 = 200, GNUTLS_DTLS1_0 = 201, /* 201 */ GNUTLS_DTLS1_2 = 202, GNUTLS_DTLS_VERSION_MIN = GNUTLS_DTLS0_9, GNUTLS_DTLS_VERSION_MAX = GNUTLS_DTLS1_2, GNUTLS_TLS_VERSION_MAX = GNUTLS_TLS1_3, GNUTLS_VERSION_UNKNOWN = 0xff /* change it to 0xffff */ } gnutls_protocol_t; #define GNUTLS_CRT_RAW GNUTLS_CRT_RAWPK /** * gnutls_certificate_type_t: * @GNUTLS_CRT_UNKNOWN: Unknown certificate type. * @GNUTLS_CRT_X509: X.509 Certificate. * @GNUTLS_CRT_OPENPGP: OpenPGP certificate. * @GNUTLS_CRT_RAWPK: Raw public-key (SubjectPublicKeyInfo) * * Enumeration of different certificate types. */ typedef enum { GNUTLS_CRT_UNKNOWN = 0, GNUTLS_CRT_X509 = 1, GNUTLS_CRT_OPENPGP = 2, GNUTLS_CRT_RAWPK = 3, GNUTLS_CRT_MAX = GNUTLS_CRT_RAWPK } gnutls_certificate_type_t; /** * gnutls_x509_crt_fmt_t: * @GNUTLS_X509_FMT_DER: X.509 certificate in DER format (binary). * @GNUTLS_X509_FMT_PEM: X.509 certificate in PEM format (text). * * Enumeration of different certificate encoding formats. */ typedef enum { GNUTLS_X509_FMT_DER = 0, GNUTLS_X509_FMT_PEM = 1 } gnutls_x509_crt_fmt_t; /** * gnutls_certificate_print_formats_t: * @GNUTLS_CRT_PRINT_FULL: Full information about certificate. * @GNUTLS_CRT_PRINT_FULL_NUMBERS: Full information about certificate and include easy to parse public key parameters. * @GNUTLS_CRT_PRINT_COMPACT: Information about certificate name in one line, plus identification of the public key. * @GNUTLS_CRT_PRINT_ONELINE: Information about certificate in one line. * @GNUTLS_CRT_PRINT_UNSIGNED_FULL: All info for an unsigned certificate. * * Enumeration of different certificate printing variants. */ typedef enum gnutls_certificate_print_formats { GNUTLS_CRT_PRINT_FULL = 0, GNUTLS_CRT_PRINT_ONELINE = 1, GNUTLS_CRT_PRINT_UNSIGNED_FULL = 2, GNUTLS_CRT_PRINT_COMPACT = 3, GNUTLS_CRT_PRINT_FULL_NUMBERS = 4 } gnutls_certificate_print_formats_t; #define GNUTLS_PK_ECC GNUTLS_PK_ECDSA #define GNUTLS_PK_EC GNUTLS_PK_ECDSA #define GNUTLS_PK_ECDHX GNUTLS_PK_ECDH_X25519 /** * gnutls_pk_algorithm_t: * @GNUTLS_PK_UNKNOWN: Unknown public-key algorithm. * @GNUTLS_PK_RSA: RSA public-key algorithm. * @GNUTLS_PK_RSA_PSS: RSA public-key algorithm, with PSS padding. * @GNUTLS_PK_DSA: DSA public-key algorithm. * @GNUTLS_PK_DH: Diffie-Hellman algorithm. Used to generate parameters. * @GNUTLS_PK_ECDSA: Elliptic curve algorithm. These parameters are compatible with the ECDSA and ECDH algorithm. * @GNUTLS_PK_ECDH_X25519: Elliptic curve algorithm, restricted to ECDH as per rfc7748. * @GNUTLS_PK_EDDSA_ED25519: Edwards curve Digital signature algorithm. Used with SHA512 on signatures. * @GNUTLS_PK_GOST_01: GOST R 34.10-2001 algorithm per rfc5832. * @GNUTLS_PK_GOST_12_256: GOST R 34.10-2012 algorithm, 256-bit key per rfc7091. * @GNUTLS_PK_GOST_12_512: GOST R 34.10-2012 algorithm, 512-bit key per rfc7091. * @GNUTLS_PK_ECDH_X448: Elliptic curve algorithm, restricted to ECDH as per rfc7748. * @GNUTLS_PK_EDDSA_ED448: Edwards curve Digital signature algorithm. Used with SHAKE256 on signatures. * * Enumeration of different public-key algorithms. */ typedef enum { GNUTLS_PK_UNKNOWN = 0, GNUTLS_PK_RSA = 1, GNUTLS_PK_DSA = 2, GNUTLS_PK_DH = 3, GNUTLS_PK_ECDSA = 4, GNUTLS_PK_ECDH_X25519 = 5, GNUTLS_PK_RSA_PSS = 6, GNUTLS_PK_EDDSA_ED25519 = 7, GNUTLS_PK_GOST_01 = 8, GNUTLS_PK_GOST_12_256 = 9, GNUTLS_PK_GOST_12_512 = 10, GNUTLS_PK_ECDH_X448 = 11, GNUTLS_PK_EDDSA_ED448 = 12, GNUTLS_PK_MAX = GNUTLS_PK_EDDSA_ED448 } gnutls_pk_algorithm_t; const char *gnutls_pk_algorithm_get_name(gnutls_pk_algorithm_t algorithm); /** * gnutls_sign_algorithm_t: * @GNUTLS_SIGN_UNKNOWN: Unknown signature algorithm. * @GNUTLS_SIGN_RSA_RAW: Digital signature algorithm RSA with DigestInfo formatted data * @GNUTLS_SIGN_RSA_SHA1: Digital signature algorithm RSA with SHA-1 * @GNUTLS_SIGN_RSA_SHA: Same as %GNUTLS_SIGN_RSA_SHA1. * @GNUTLS_SIGN_DSA_SHA1: Digital signature algorithm DSA with SHA-1 * @GNUTLS_SIGN_DSA_SHA224: Digital signature algorithm DSA with SHA-224 * @GNUTLS_SIGN_DSA_SHA256: Digital signature algorithm DSA with SHA-256 * @GNUTLS_SIGN_DSA_SHA384: Digital signature algorithm DSA with SHA-384 * @GNUTLS_SIGN_DSA_SHA512: Digital signature algorithm DSA with SHA-512 * @GNUTLS_SIGN_DSA_SHA: Same as %GNUTLS_SIGN_DSA_SHA1. * @GNUTLS_SIGN_RSA_MD5: Digital signature algorithm RSA with MD5. * @GNUTLS_SIGN_RSA_MD2: Digital signature algorithm RSA with MD2. * @GNUTLS_SIGN_RSA_RMD160: Digital signature algorithm RSA with RMD-160. * @GNUTLS_SIGN_RSA_SHA256: Digital signature algorithm RSA with SHA-256. * @GNUTLS_SIGN_RSA_SHA384: Digital signature algorithm RSA with SHA-384. * @GNUTLS_SIGN_RSA_SHA512: Digital signature algorithm RSA with SHA-512. * @GNUTLS_SIGN_RSA_SHA224: Digital signature algorithm RSA with SHA-224. * @GNUTLS_SIGN_ECDSA_SHA1: ECDSA with SHA1. * @GNUTLS_SIGN_ECDSA_SHA224: Digital signature algorithm ECDSA with SHA-224. * @GNUTLS_SIGN_ECDSA_SHA256: Digital signature algorithm ECDSA with SHA-256. * @GNUTLS_SIGN_ECDSA_SHA384: Digital signature algorithm ECDSA with SHA-384. * @GNUTLS_SIGN_ECDSA_SHA512: Digital signature algorithm ECDSA with SHA-512. * @GNUTLS_SIGN_ECDSA_SECP256R1_SHA256: Digital signature algorithm ECDSA-SECP256R1 with SHA-256 (used in TLS 1.3 but not PKIX). * @GNUTLS_SIGN_ECDSA_SECP384R1_SHA384: Digital signature algorithm ECDSA-SECP384R1 with SHA-384 (used in TLS 1.3 but not PKIX). * @GNUTLS_SIGN_ECDSA_SECP521R1_SHA512: Digital signature algorithm ECDSA-SECP521R1 with SHA-512 (used in TLS 1.3 but not PKIX). * @GNUTLS_SIGN_ECDSA_SHA3_224: Digital signature algorithm ECDSA with SHA3-224. * @GNUTLS_SIGN_ECDSA_SHA3_256: Digital signature algorithm ECDSA with SHA3-256. * @GNUTLS_SIGN_ECDSA_SHA3_384: Digital signature algorithm ECDSA with SHA3-384. * @GNUTLS_SIGN_ECDSA_SHA3_512: Digital signature algorithm ECDSA with SHA3-512. * @GNUTLS_SIGN_DSA_SHA3_224: Digital signature algorithm DSA with SHA3-224. * @GNUTLS_SIGN_DSA_SHA3_256: Digital signature algorithm DSA with SHA3-256. * @GNUTLS_SIGN_DSA_SHA3_384: Digital signature algorithm DSA with SHA3-384. * @GNUTLS_SIGN_DSA_SHA3_512: Digital signature algorithm DSA with SHA3-512. * @GNUTLS_SIGN_RSA_SHA3_224: Digital signature algorithm RSA with SHA3-224. * @GNUTLS_SIGN_RSA_SHA3_256: Digital signature algorithm RSA with SHA3-256. * @GNUTLS_SIGN_RSA_SHA3_384: Digital signature algorithm RSA with SHA3-384. * @GNUTLS_SIGN_RSA_SHA3_512: Digital signature algorithm RSA with SHA3-512. * @GNUTLS_SIGN_RSA_PSS_RSAE_SHA256: Digital signature algorithm RSA with SHA-256, * with PSS padding (RSA PKCS#1 1.5 certificate). This signature is identical * to #GNUTLS_SIGN_RSA_PSS_SHA256, but they are distinct as the TLS1.3 protocol * treats them differently. * @GNUTLS_SIGN_RSA_PSS_RSAE_SHA384: Digital signature algorithm RSA with SHA-384, * with PSS padding (RSA PKCS#1 1.5 certificate). This signature is identical * to #GNUTLS_SIGN_RSA_PSS_SHA384, but they are distinct as the TLS1.3 protocol * treats them differently. * @GNUTLS_SIGN_RSA_PSS_RSAE_SHA512: Digital signature algorithm RSA with SHA-512, * with PSS padding (RSA PKCS#1 1.5 certificate). This signature is identical * to #GNUTLS_SIGN_RSA_PSS_SHA512, but they are distinct as the TLS1.3 protocol * treats them differently. * @GNUTLS_SIGN_RSA_PSS_SHA256: Digital signature algorithm RSA with SHA-256, with PSS padding (RSA-PSS certificate). * @GNUTLS_SIGN_RSA_PSS_SHA384: Digital signature algorithm RSA with SHA-384, with PSS padding (RSA-PSS certificate). * @GNUTLS_SIGN_RSA_PSS_SHA512: Digital signature algorithm RSA with SHA-512, with PSS padding (RSA-PSS certificate). * @GNUTLS_SIGN_EDDSA_ED25519: Digital signature algorithm EdDSA with Ed25519 curve. * @GNUTLS_SIGN_GOST_94: Digital signature algorithm GOST R 34.10-2001 with GOST R 34.11-94 * @GNUTLS_SIGN_GOST_256: Digital signature algorithm GOST R 34.10-2012 with GOST R 34.11-2012 256 bit * @GNUTLS_SIGN_GOST_512: Digital signature algorithm GOST R 34.10-2012 with GOST R 34.11-2012 512 bit * @GNUTLS_SIGN_EDDSA_ED448: Digital signature algorithm EdDSA with Ed448 curve. * * Enumeration of different digital signature algorithms. */ typedef enum { GNUTLS_SIGN_UNKNOWN = 0, GNUTLS_SIGN_RSA_SHA1 = 1, GNUTLS_SIGN_RSA_SHA = GNUTLS_SIGN_RSA_SHA1, GNUTLS_SIGN_DSA_SHA1 = 2, GNUTLS_SIGN_DSA_SHA = GNUTLS_SIGN_DSA_SHA1, GNUTLS_SIGN_RSA_MD5 = 3, GNUTLS_SIGN_RSA_MD2 = 4, GNUTLS_SIGN_RSA_RMD160 = 5, GNUTLS_SIGN_RSA_SHA256 = 6, GNUTLS_SIGN_RSA_SHA384 = 7, GNUTLS_SIGN_RSA_SHA512 = 8, GNUTLS_SIGN_RSA_SHA224 = 9, GNUTLS_SIGN_DSA_SHA224 = 10, GNUTLS_SIGN_DSA_SHA256 = 11, GNUTLS_SIGN_ECDSA_SHA1 = 12, GNUTLS_SIGN_ECDSA_SHA224 = 13, GNUTLS_SIGN_ECDSA_SHA256 = 14, GNUTLS_SIGN_ECDSA_SHA384 = 15, GNUTLS_SIGN_ECDSA_SHA512 = 16, GNUTLS_SIGN_DSA_SHA384 = 17, GNUTLS_SIGN_DSA_SHA512 = 18, GNUTLS_SIGN_ECDSA_SHA3_224 = 20, GNUTLS_SIGN_ECDSA_SHA3_256 = 21, GNUTLS_SIGN_ECDSA_SHA3_384 = 22, GNUTLS_SIGN_ECDSA_SHA3_512 = 23, GNUTLS_SIGN_DSA_SHA3_224 = 24, GNUTLS_SIGN_DSA_SHA3_256 = 25, GNUTLS_SIGN_DSA_SHA3_384 = 26, GNUTLS_SIGN_DSA_SHA3_512 = 27, GNUTLS_SIGN_RSA_SHA3_224 = 28, GNUTLS_SIGN_RSA_SHA3_256 = 29, GNUTLS_SIGN_RSA_SHA3_384 = 30, GNUTLS_SIGN_RSA_SHA3_512 = 31, GNUTLS_SIGN_RSA_PSS_SHA256 = 32, GNUTLS_SIGN_RSA_PSS_SHA384 = 33, GNUTLS_SIGN_RSA_PSS_SHA512 = 34, GNUTLS_SIGN_EDDSA_ED25519 = 35, GNUTLS_SIGN_RSA_RAW = 36, GNUTLS_SIGN_ECDSA_SECP256R1_SHA256 = 37, GNUTLS_SIGN_ECDSA_SECP384R1_SHA384 = 38, GNUTLS_SIGN_ECDSA_SECP521R1_SHA512 = 39, GNUTLS_SIGN_RSA_PSS_RSAE_SHA256 = 40, GNUTLS_SIGN_RSA_PSS_RSAE_SHA384 = 41, GNUTLS_SIGN_RSA_PSS_RSAE_SHA512 = 42, GNUTLS_SIGN_GOST_94 = 43, GNUTLS_SIGN_GOST_256 = 44, GNUTLS_SIGN_GOST_512 = 45, GNUTLS_SIGN_EDDSA_ED448 = 46, GNUTLS_SIGN_MAX = GNUTLS_SIGN_EDDSA_ED448 } gnutls_sign_algorithm_t; /** * gnutls_ecc_curve_t: * @GNUTLS_ECC_CURVE_INVALID: Cannot be known * @GNUTLS_ECC_CURVE_SECP192R1: the SECP192R1 curve * @GNUTLS_ECC_CURVE_SECP224R1: the SECP224R1 curve * @GNUTLS_ECC_CURVE_SECP256R1: the SECP256R1 curve * @GNUTLS_ECC_CURVE_SECP384R1: the SECP384R1 curve * @GNUTLS_ECC_CURVE_SECP521R1: the SECP521R1 curve * @GNUTLS_ECC_CURVE_X25519: the X25519 curve (ECDH only) * @GNUTLS_ECC_CURVE_ED25519: the Ed25519 curve * @GNUTLS_ECC_CURVE_GOST256CPA: GOST R 34.10 CryptoPro 256 A curve * @GNUTLS_ECC_CURVE_GOST256CPB: GOST R 34.10 CryptoPro 256 B curve * @GNUTLS_ECC_CURVE_GOST256CPC: GOST R 34.10 CryptoPro 256 C curve * @GNUTLS_ECC_CURVE_GOST256CPXA: GOST R 34.10 CryptoPro 256 XchA curve * @GNUTLS_ECC_CURVE_GOST256CPXB: GOST R 34.10 CryptoPro 256 XchB curve * @GNUTLS_ECC_CURVE_GOST512A: GOST R 34.10 TC26 512 A curve * @GNUTLS_ECC_CURVE_GOST512B: GOST R 34.10 TC26 512 B curve * @GNUTLS_ECC_CURVE_GOST512C: GOST R 34.10 TC26 512 C curve * @GNUTLS_ECC_CURVE_GOST256A: GOST R 34.10 TC26 256 A curve * @GNUTLS_ECC_CURVE_GOST256B: GOST R 34.10 TC26 256 B curve * @GNUTLS_ECC_CURVE_GOST256C: GOST R 34.10 TC26 256 C curve * @GNUTLS_ECC_CURVE_GOST256D: GOST R 34.10 TC26 256 D curve * @GNUTLS_ECC_CURVE_X448: the X448 curve (ECDH only) * @GNUTLS_ECC_CURVE_ED448: the Ed448 curve * * Enumeration of ECC curves. */ typedef enum { GNUTLS_ECC_CURVE_INVALID = 0, GNUTLS_ECC_CURVE_SECP224R1, GNUTLS_ECC_CURVE_SECP256R1, GNUTLS_ECC_CURVE_SECP384R1, GNUTLS_ECC_CURVE_SECP521R1, GNUTLS_ECC_CURVE_SECP192R1, GNUTLS_ECC_CURVE_X25519, GNUTLS_ECC_CURVE_ED25519, GNUTLS_ECC_CURVE_GOST256CPA, GNUTLS_ECC_CURVE_GOST256CPB, GNUTLS_ECC_CURVE_GOST256CPC, GNUTLS_ECC_CURVE_GOST256CPXA, GNUTLS_ECC_CURVE_GOST256CPXB, GNUTLS_ECC_CURVE_GOST512A, GNUTLS_ECC_CURVE_GOST512B, GNUTLS_ECC_CURVE_GOST512C, GNUTLS_ECC_CURVE_GOST256A, GNUTLS_ECC_CURVE_GOST256B, GNUTLS_ECC_CURVE_GOST256C, GNUTLS_ECC_CURVE_GOST256D, GNUTLS_ECC_CURVE_X448, GNUTLS_ECC_CURVE_ED448, GNUTLS_ECC_CURVE_MAX = GNUTLS_ECC_CURVE_ED448 } gnutls_ecc_curve_t; /** * gnutls_group_t: * @GNUTLS_GROUP_INVALID: Indicates unknown/invalid group * @GNUTLS_GROUP_SECP192R1: the SECP192R1 curve group (legacy, only for TLS 1.2 compatibility) * @GNUTLS_GROUP_SECP224R1: the SECP224R1 curve group (legacy, only for TLS 1.2 compatibility) * @GNUTLS_GROUP_SECP256R1: the SECP256R1 curve group * @GNUTLS_GROUP_SECP384R1: the SECP384R1 curve group * @GNUTLS_GROUP_SECP521R1: the SECP521R1 curve group * @GNUTLS_GROUP_X25519: the X25519 curve group * @GNUTLS_GROUP_GC256A: the GOST R 34.10 TC26 256 A curve group * @GNUTLS_GROUP_GC256B: the GOST R 34.10 TC26 256 B curve group * @GNUTLS_GROUP_GC256C: the GOST R 34.10 TC26 256 C curve group * @GNUTLS_GROUP_GC256D: the GOST R 34.10 TC26 256 D curve group * @GNUTLS_GROUP_GC512A: the GOST R 34.10 TC26 512 A curve group * @GNUTLS_GROUP_GC512B: the GOST R 34.10 TC26 512 B curve group * @GNUTLS_GROUP_GC512C: the GOST R 34.10 TC26 512 C curve group * @GNUTLS_GROUP_FFDHE2048: the FFDHE2048 group * @GNUTLS_GROUP_FFDHE3072: the FFDHE3072 group * @GNUTLS_GROUP_FFDHE4096: the FFDHE4096 group * @GNUTLS_GROUP_FFDHE6144: the FFDHE6144 group * @GNUTLS_GROUP_FFDHE8192: the FFDHE8192 group * @GNUTLS_GROUP_X448: the X448 curve group * * Enumeration of supported groups. It is intended to be backwards * compatible with the enumerations in %gnutls_ecc_curve_t for the groups * which are valid elliptic curves. */ typedef enum { GNUTLS_GROUP_INVALID = 0, GNUTLS_GROUP_SECP192R1 = GNUTLS_ECC_CURVE_SECP192R1, GNUTLS_GROUP_SECP224R1 = GNUTLS_ECC_CURVE_SECP224R1, GNUTLS_GROUP_SECP256R1 = GNUTLS_ECC_CURVE_SECP256R1, GNUTLS_GROUP_SECP384R1 = GNUTLS_ECC_CURVE_SECP384R1, GNUTLS_GROUP_SECP521R1 = GNUTLS_ECC_CURVE_SECP521R1, GNUTLS_GROUP_X25519 = GNUTLS_ECC_CURVE_X25519, GNUTLS_GROUP_X448 = GNUTLS_ECC_CURVE_X448, GNUTLS_GROUP_GC256A = GNUTLS_ECC_CURVE_GOST256A, GNUTLS_GROUP_GC256B = GNUTLS_ECC_CURVE_GOST256B, GNUTLS_GROUP_GC256C = GNUTLS_ECC_CURVE_GOST256C, GNUTLS_GROUP_GC256D = GNUTLS_ECC_CURVE_GOST256D, GNUTLS_GROUP_GC512A = GNUTLS_ECC_CURVE_GOST512A, GNUTLS_GROUP_GC512B = GNUTLS_ECC_CURVE_GOST512B, GNUTLS_GROUP_GC512C = GNUTLS_ECC_CURVE_GOST512C, GNUTLS_GROUP_FFDHE2048 = 256, GNUTLS_GROUP_FFDHE3072, GNUTLS_GROUP_FFDHE4096, GNUTLS_GROUP_FFDHE8192, GNUTLS_GROUP_FFDHE6144, GNUTLS_GROUP_MAX = GNUTLS_GROUP_FFDHE6144, } gnutls_group_t; /* macros to allow specifying a specific curve in gnutls_privkey_generate() * and gnutls_x509_privkey_generate() */ #define GNUTLS_CURVE_TO_BITS(curve) (unsigned int)(((unsigned int)1<<31)|((unsigned int)(curve))) #define GNUTLS_BITS_TO_CURVE(bits) (((unsigned int)(bits)) & 0x7FFFFFFF) #define GNUTLS_BITS_ARE_CURVE(bits) (((unsigned int)(bits)) & 0x80000000) /** * gnutls_sec_param_t: * @GNUTLS_SEC_PARAM_UNKNOWN: Cannot be known * @GNUTLS_SEC_PARAM_INSECURE: Less than 42 bits of security * @GNUTLS_SEC_PARAM_EXPORT: 42 bits of security * @GNUTLS_SEC_PARAM_VERY_WEAK: 64 bits of security * @GNUTLS_SEC_PARAM_WEAK: 72 bits of security * @GNUTLS_SEC_PARAM_LOW: 80 bits of security * @GNUTLS_SEC_PARAM_LEGACY: 96 bits of security * @GNUTLS_SEC_PARAM_MEDIUM: 112 bits of security (used to be %GNUTLS_SEC_PARAM_NORMAL) * @GNUTLS_SEC_PARAM_HIGH: 128 bits of security * @GNUTLS_SEC_PARAM_ULTRA: 192 bits of security * @GNUTLS_SEC_PARAM_FUTURE: 256 bits of security * * Enumeration of security parameters for passive attacks. */ typedef enum { GNUTLS_SEC_PARAM_UNKNOWN = 0, GNUTLS_SEC_PARAM_INSECURE = 5, GNUTLS_SEC_PARAM_EXPORT = 10, GNUTLS_SEC_PARAM_VERY_WEAK = 15, GNUTLS_SEC_PARAM_WEAK = 20, GNUTLS_SEC_PARAM_LOW = 25, GNUTLS_SEC_PARAM_LEGACY = 30, GNUTLS_SEC_PARAM_MEDIUM = 35, GNUTLS_SEC_PARAM_HIGH = 40, GNUTLS_SEC_PARAM_ULTRA = 45, GNUTLS_SEC_PARAM_FUTURE = 50, GNUTLS_SEC_PARAM_MAX = GNUTLS_SEC_PARAM_FUTURE } gnutls_sec_param_t; /* old name */ #define GNUTLS_SEC_PARAM_NORMAL GNUTLS_SEC_PARAM_MEDIUM /** * gnutls_channel_binding_t: * @GNUTLS_CB_TLS_UNIQUE: "tls-unique" (RFC 5929) channel binding * @GNUTLS_CB_TLS_SERVER_END_POINT: "tls-server-end-point" (RFC 5929) channel binding * @GNUTLS_CB_TLS_EXPORTER: "tls-exporter" (RFC 9266) channel binding * * Enumeration of supported channel binding types. */ typedef enum { GNUTLS_CB_TLS_UNIQUE, GNUTLS_CB_TLS_SERVER_END_POINT, GNUTLS_CB_TLS_EXPORTER } gnutls_channel_binding_t; /** * gnutls_gost_paramset_t: * @GNUTLS_GOST_PARAMSET_UNKNOWN: Unknown/default parameter set * @GNUTLS_GOST_PARAMSET_TC26_Z: Specified by TC26, see rfc7836 * @GNUTLS_GOST_PARAMSET_CP_A: CryptoPro-A, see rfc4357 * @GNUTLS_GOST_PARAMSET_CP_B: CryptoPro-B, see rfc4357 * @GNUTLS_GOST_PARAMSET_CP_C: CryptoPro-C, see rfc4357 * @GNUTLS_GOST_PARAMSET_CP_D: CryptoPro-D, see rfc4357 * * Enumeration of different GOST 28147 parameter sets. */ typedef enum { GNUTLS_GOST_PARAMSET_UNKNOWN = 0, GNUTLS_GOST_PARAMSET_TC26_Z, GNUTLS_GOST_PARAMSET_CP_A, GNUTLS_GOST_PARAMSET_CP_B, GNUTLS_GOST_PARAMSET_CP_C, GNUTLS_GOST_PARAMSET_CP_D } gnutls_gost_paramset_t; /** * gnutls_ctype_target_t: * @GNUTLS_CTYPE_CLIENT: for requesting client certificate type values. * @GNUTLS_CTYPE_SERVER: for requesting server certificate type values. * @GNUTLS_CTYPE_OURS: for requesting our certificate type values. * @GNUTLS_CTYPE_PEERS: for requesting the peers' certificate type values. * * Enumeration of certificate type targets with respect to asymmetric * certificate types as specified in RFC7250 and P2P connection set up * as specified in draft-vanrein-tls-symmetry-02. */ typedef enum { GNUTLS_CTYPE_CLIENT, GNUTLS_CTYPE_SERVER, GNUTLS_CTYPE_OURS, GNUTLS_CTYPE_PEERS } gnutls_ctype_target_t; /* If you want to change this, then also change the define in * gnutls_int.h, and recompile. */ typedef void *gnutls_transport_ptr_t; struct gnutls_session_int; typedef struct gnutls_session_int *gnutls_session_t; struct gnutls_dh_params_int; typedef struct gnutls_dh_params_int *gnutls_dh_params_t; /* XXX ugly. */ struct gnutls_x509_privkey_int; typedef struct gnutls_x509_privkey_int *gnutls_rsa_params_t; struct gnutls_priority_st; typedef struct gnutls_priority_st *gnutls_priority_t; typedef struct { unsigned char *data; unsigned int size; } gnutls_datum_t; typedef struct gnutls_library_config_st { const char *name; const char *value; } gnutls_library_config_st; typedef struct gnutls_params_st { gnutls_params_type_t type; union params { gnutls_dh_params_t dh; gnutls_rsa_params_t rsa_export; } params; int deinit; } gnutls_params_st; typedef int gnutls_params_function(gnutls_session_t, gnutls_params_type_t, gnutls_params_st *); /* internal functions */ int gnutls_init(gnutls_session_t * session, unsigned int flags); void gnutls_deinit(gnutls_session_t session); #define _gnutls_deinit(x) gnutls_deinit(x) int gnutls_bye(gnutls_session_t session, gnutls_close_request_t how); int gnutls_handshake(gnutls_session_t session); int gnutls_reauth(gnutls_session_t session, unsigned int flags); #define GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT ((unsigned int)-1) #define GNUTLS_INDEFINITE_TIMEOUT ((unsigned int)-2) void gnutls_handshake_set_timeout(gnutls_session_t session, unsigned int ms); int gnutls_rehandshake(gnutls_session_t session); #define GNUTLS_KU_PEER 1 int gnutls_session_key_update(gnutls_session_t session, unsigned flags); gnutls_alert_description_t gnutls_alert_get(gnutls_session_t session); int gnutls_alert_send(gnutls_session_t session, gnutls_alert_level_t level, gnutls_alert_description_t desc); int gnutls_alert_send_appropriate(gnutls_session_t session, int err); const char *gnutls_alert_get_name(gnutls_alert_description_t alert); const char *gnutls_alert_get_strname(gnutls_alert_description_t alert); gnutls_sec_param_t gnutls_pk_bits_to_sec_param(gnutls_pk_algorithm_t algo, unsigned int bits); const char *gnutls_sec_param_get_name(gnutls_sec_param_t param); unsigned int gnutls_sec_param_to_pk_bits(gnutls_pk_algorithm_t algo, gnutls_sec_param_t param); unsigned int gnutls_sec_param_to_symmetric_bits(gnutls_sec_param_t param) __GNUTLS_CONST__; /* Elliptic curves */ const char * gnutls_ecc_curve_get_name(gnutls_ecc_curve_t curve) __GNUTLS_CONST__; const char * gnutls_ecc_curve_get_oid(gnutls_ecc_curve_t curve) __GNUTLS_CONST__; const char * gnutls_group_get_name(gnutls_group_t group) __GNUTLS_CONST__; int gnutls_ecc_curve_get_size(gnutls_ecc_curve_t curve) __GNUTLS_CONST__; gnutls_ecc_curve_t gnutls_ecc_curve_get(gnutls_session_t session); gnutls_group_t gnutls_group_get(gnutls_session_t session); /* get information on the current session */ gnutls_cipher_algorithm_t gnutls_cipher_get(gnutls_session_t session); gnutls_cipher_algorithm_t gnutls_early_cipher_get(gnutls_session_t session); gnutls_kx_algorithm_t gnutls_kx_get(gnutls_session_t session); gnutls_mac_algorithm_t gnutls_mac_get(gnutls_session_t session); gnutls_digest_algorithm_t gnutls_prf_hash_get(const gnutls_session_t session); gnutls_digest_algorithm_t gnutls_early_prf_hash_get(const gnutls_session_t session); gnutls_certificate_type_t gnutls_certificate_type_get(gnutls_session_t session); gnutls_certificate_type_t gnutls_certificate_type_get2(gnutls_session_t session, gnutls_ctype_target_t target); int gnutls_sign_algorithm_get(gnutls_session_t session); int gnutls_sign_algorithm_get_client(gnutls_session_t session); int gnutls_sign_algorithm_get_requested(gnutls_session_t session, size_t indx, gnutls_sign_algorithm_t * algo); /* the name of the specified algorithms */ const char * gnutls_cipher_get_name(gnutls_cipher_algorithm_t algorithm) __GNUTLS_CONST__; const char * gnutls_mac_get_name(gnutls_mac_algorithm_t algorithm) __GNUTLS_CONST__; const char * gnutls_digest_get_name(gnutls_digest_algorithm_t algorithm) __GNUTLS_CONST__; const char * gnutls_digest_get_oid(gnutls_digest_algorithm_t algorithm) __GNUTLS_CONST__; const char * gnutls_kx_get_name(gnutls_kx_algorithm_t algorithm) __GNUTLS_CONST__; const char * gnutls_certificate_type_get_name(gnutls_certificate_type_t type) __GNUTLS_CONST__; const char * gnutls_pk_get_name(gnutls_pk_algorithm_t algorithm) __GNUTLS_CONST__; const char * gnutls_pk_get_oid(gnutls_pk_algorithm_t algorithm) __GNUTLS_CONST__; const char * gnutls_sign_get_name(gnutls_sign_algorithm_t algorithm) __GNUTLS_CONST__; const char *gnutls_sign_get_oid(gnutls_sign_algorithm_t sign) __GNUTLS_CONST__; const char * gnutls_gost_paramset_get_name(gnutls_gost_paramset_t param) __GNUTLS_CONST__; const char * gnutls_gost_paramset_get_oid(gnutls_gost_paramset_t param) __GNUTLS_CONST__; size_t gnutls_cipher_get_key_size(gnutls_cipher_algorithm_t algorithm) __GNUTLS_CONST__; size_t gnutls_mac_get_key_size(gnutls_mac_algorithm_t algorithm) __GNUTLS_CONST__; unsigned gnutls_sign_is_secure(gnutls_sign_algorithm_t algorithm) __GNUTLS_CONST__; /* It is possible that a signature algorithm is ok to use for short-lived * data (e.g., to sign a TLS session), but not for data that are long-lived * like certificates. This flag is about checking the security of the algorithm * for long-lived data. */ #define GNUTLS_SIGN_FLAG_SECURE_FOR_CERTS 1 unsigned gnutls_sign_is_secure2(gnutls_sign_algorithm_t algorithm, unsigned int flags) __GNUTLS_CONST__; gnutls_digest_algorithm_t gnutls_sign_get_hash_algorithm(gnutls_sign_algorithm_t sign) __GNUTLS_CONST__; gnutls_pk_algorithm_t gnutls_sign_get_pk_algorithm(gnutls_sign_algorithm_t sign) __GNUTLS_CONST__; gnutls_sign_algorithm_t gnutls_pk_to_sign(gnutls_pk_algorithm_t pk, gnutls_digest_algorithm_t hash) __GNUTLS_CONST__; unsigned gnutls_sign_supports_pk_algorithm(gnutls_sign_algorithm_t sign, gnutls_pk_algorithm_t pk) __GNUTLS_CONST__; #define gnutls_sign_algorithm_get_name gnutls_sign_get_name gnutls_mac_algorithm_t gnutls_mac_get_id(const char *name) __GNUTLS_CONST__; gnutls_digest_algorithm_t gnutls_digest_get_id(const char *name) __GNUTLS_CONST__; gnutls_cipher_algorithm_t gnutls_cipher_get_id(const char *name) __GNUTLS_CONST__; gnutls_kx_algorithm_t gnutls_kx_get_id(const char *name) __GNUTLS_CONST__; gnutls_protocol_t gnutls_protocol_get_id(const char *name) __GNUTLS_CONST__; gnutls_certificate_type_t gnutls_certificate_type_get_id(const char *name) __GNUTLS_CONST__; gnutls_pk_algorithm_t gnutls_pk_get_id(const char *name) __GNUTLS_CONST__; gnutls_sign_algorithm_t gnutls_sign_get_id(const char *name) __GNUTLS_CONST__; gnutls_ecc_curve_t gnutls_ecc_curve_get_id(const char *name) __GNUTLS_CONST__; gnutls_pk_algorithm_t gnutls_ecc_curve_get_pk(gnutls_ecc_curve_t curve) __GNUTLS_CONST__; gnutls_group_t gnutls_group_get_id(const char *name); gnutls_digest_algorithm_t gnutls_oid_to_digest(const char *oid) __GNUTLS_CONST__; gnutls_mac_algorithm_t gnutls_oid_to_mac(const char *oid) __GNUTLS_CONST__; gnutls_pk_algorithm_t gnutls_oid_to_pk(const char *oid) __GNUTLS_CONST__; gnutls_sign_algorithm_t gnutls_oid_to_sign(const char *oid) __GNUTLS_CONST__; gnutls_ecc_curve_t gnutls_oid_to_ecc_curve(const char *oid) __GNUTLS_CONST__; gnutls_gost_paramset_t gnutls_oid_to_gost_paramset(const char *oid) __GNUTLS_CONST__; /* list supported algorithms */ const gnutls_ecc_curve_t * gnutls_ecc_curve_list(void) __GNUTLS_PURE__; const gnutls_group_t * gnutls_group_list(void) __GNUTLS_PURE__; const gnutls_cipher_algorithm_t * gnutls_cipher_list(void) __GNUTLS_PURE__; const gnutls_mac_algorithm_t * gnutls_mac_list(void) __GNUTLS_PURE__; const gnutls_digest_algorithm_t * gnutls_digest_list(void) __GNUTLS_PURE__; const gnutls_protocol_t * gnutls_protocol_list(void) __GNUTLS_PURE__; const gnutls_certificate_type_t * gnutls_certificate_type_list(void) __GNUTLS_PURE__; const gnutls_kx_algorithm_t * gnutls_kx_list(void) __GNUTLS_PURE__; const gnutls_pk_algorithm_t * gnutls_pk_list(void) __GNUTLS_PURE__; const gnutls_sign_algorithm_t * gnutls_sign_list(void) __GNUTLS_PURE__; const char * gnutls_cipher_suite_info(size_t idx, unsigned char *cs_id, gnutls_kx_algorithm_t * kx, gnutls_cipher_algorithm_t * cipher, gnutls_mac_algorithm_t * mac, gnutls_protocol_t * min_version); /* functions for run-time enablement of algorithms */ int gnutls_ecc_curve_set_enabled(gnutls_ecc_curve_t curve, unsigned int enabled); int gnutls_sign_set_secure(gnutls_sign_algorithm_t sign, unsigned int secure); int gnutls_sign_set_secure_for_certs(gnutls_sign_algorithm_t sign, unsigned int secure); int gnutls_digest_set_secure(gnutls_digest_algorithm_t dig, unsigned int secure); int gnutls_protocol_set_enabled(gnutls_protocol_t version, unsigned int enabled); /* error functions */ int gnutls_error_is_fatal(int error) __GNUTLS_CONST__; int gnutls_error_to_alert(int err, int *level); void gnutls_perror(int error); const char * gnutls_strerror(int error) __GNUTLS_CONST__; const char * gnutls_strerror_name(int error) __GNUTLS_CONST__; /* Semi-internal functions. */ void gnutls_handshake_set_private_extensions(gnutls_session_t session, int allow); int gnutls_handshake_set_random(gnutls_session_t session, const gnutls_datum_t * random); gnutls_handshake_description_t gnutls_handshake_get_last_out(gnutls_session_t session); gnutls_handshake_description_t gnutls_handshake_get_last_in(gnutls_session_t session); /* Record layer functions. */ #define GNUTLS_HEARTBEAT_WAIT 1 int gnutls_heartbeat_ping(gnutls_session_t session, size_t data_size, unsigned int max_tries, unsigned int flags); int gnutls_heartbeat_pong(gnutls_session_t session, unsigned int flags); void gnutls_record_set_timeout(gnutls_session_t session, unsigned int ms); void gnutls_record_disable_padding(gnutls_session_t session); void gnutls_record_cork(gnutls_session_t session); #define GNUTLS_RECORD_WAIT 1 int gnutls_record_uncork(gnutls_session_t session, unsigned int flags); size_t gnutls_record_discard_queued(gnutls_session_t session); int gnutls_record_get_state(gnutls_session_t session, unsigned read, gnutls_datum_t *mac_key, gnutls_datum_t *IV, gnutls_datum_t *cipher_key, unsigned char seq_number[8]); int gnutls_record_set_state(gnutls_session_t session, unsigned read, const unsigned char seq_number[8]); typedef struct { size_t low; size_t high; } gnutls_range_st; int gnutls_range_split(gnutls_session_t session, const gnutls_range_st * orig, gnutls_range_st * small_range, gnutls_range_st * rem_range); ssize_t gnutls_record_send(gnutls_session_t session, const void *data, size_t data_size); ssize_t gnutls_record_send2(gnutls_session_t session, const void *data, size_t data_size, size_t pad, unsigned flags); ssize_t gnutls_record_send_range(gnutls_session_t session, const void *data, size_t data_size, const gnutls_range_st * range); ssize_t gnutls_record_send_file(gnutls_session_t session, int fd, off_t *offset, size_t count); ssize_t gnutls_record_recv(gnutls_session_t session, void *data, size_t data_size); typedef struct mbuffer_st *gnutls_packet_t; ssize_t gnutls_record_recv_packet(gnutls_session_t session, gnutls_packet_t *packet); void gnutls_packet_get(gnutls_packet_t packet, gnutls_datum_t *data, unsigned char *sequence); void gnutls_packet_deinit(gnutls_packet_t packet); #define gnutls_read gnutls_record_recv #define gnutls_write gnutls_record_send ssize_t gnutls_record_recv_seq(gnutls_session_t session, void *data, size_t data_size, unsigned char *seq); size_t gnutls_record_overhead_size(gnutls_session_t session); size_t gnutls_est_record_overhead_size(gnutls_protocol_t version, gnutls_cipher_algorithm_t cipher, gnutls_mac_algorithm_t mac, gnutls_compression_method_t comp, unsigned int flags) __GNUTLS_CONST__; void gnutls_session_enable_compatibility_mode(gnutls_session_t session); #define gnutls_record_set_max_empty_records(session, x) unsigned gnutls_record_can_use_length_hiding(gnutls_session_t session); int gnutls_record_get_direction(gnutls_session_t session); size_t gnutls_record_get_max_size(gnutls_session_t session); ssize_t gnutls_record_set_max_size(gnutls_session_t session, size_t size); ssize_t gnutls_record_set_max_recv_size(gnutls_session_t session, size_t size); size_t gnutls_record_check_pending(gnutls_session_t session); size_t gnutls_record_check_corked(gnutls_session_t session); size_t gnutls_record_get_max_early_data_size(gnutls_session_t session); int gnutls_record_set_max_early_data_size(gnutls_session_t session, size_t size); ssize_t gnutls_record_send_early_data(gnutls_session_t session, const void *data, size_t length); ssize_t gnutls_record_recv_early_data(gnutls_session_t session, void *data, size_t data_size); void gnutls_session_force_valid(gnutls_session_t session); int gnutls_prf(gnutls_session_t session, size_t label_size, const char *label, int server_random_first, size_t extra_size, const char *extra, size_t outsize, char *out); int gnutls_prf_rfc5705(gnutls_session_t session, size_t label_size, const char *label, size_t context_size, const char *context, size_t outsize, char *out); int gnutls_prf_early(gnutls_session_t session, size_t label_size, const char *label, size_t context_size, const char *context, size_t outsize, char *out); int gnutls_prf_raw(gnutls_session_t session, size_t label_size, const char *label, size_t seed_size, const char *seed, size_t outsize, char *out); /** * gnutls_server_name_type_t: * @GNUTLS_NAME_DNS: Domain Name System name type. * * Enumeration of different server name types. */ typedef enum { GNUTLS_NAME_DNS = 1 } gnutls_server_name_type_t; int gnutls_server_name_set(gnutls_session_t session, gnutls_server_name_type_t type, const void *name, size_t name_length); int gnutls_server_name_get(gnutls_session_t session, void *data, size_t * data_length, unsigned int *type, unsigned int indx); unsigned int gnutls_heartbeat_get_timeout(gnutls_session_t session); void gnutls_heartbeat_set_timeouts(gnutls_session_t session, unsigned int retrans_timeout, unsigned int total_timeout); #define GNUTLS_HB_PEER_ALLOWED_TO_SEND (1) #define GNUTLS_HB_PEER_NOT_ALLOWED_TO_SEND (1<<1) /* Heartbeat */ void gnutls_heartbeat_enable(gnutls_session_t session, unsigned int type); #define GNUTLS_HB_LOCAL_ALLOWED_TO_SEND (1<<2) unsigned gnutls_heartbeat_allowed(gnutls_session_t session, unsigned int type); /* Safe renegotiation */ unsigned gnutls_safe_renegotiation_status(gnutls_session_t session); unsigned gnutls_session_ext_master_secret_status(gnutls_session_t session); unsigned gnutls_session_etm_status(gnutls_session_t session); /** * gnutls_session_flags_t: * @GNUTLS_SFLAGS_SAFE_RENEGOTIATION: Safe renegotiation (RFC5746) was used * @GNUTLS_SFLAGS_EXT_MASTER_SECRET: The extended master secret (RFC7627) extension was used * @GNUTLS_SFLAGS_ETM: The encrypt then MAC (RFC7366) extension was used * @GNUTLS_SFLAGS_RFC7919: The RFC7919 Diffie-Hellman parameters were negotiated * @GNUTLS_SFLAGS_HB_LOCAL_SEND: The heartbeat negotiation allows the local side to send heartbeat messages * @GNUTLS_SFLAGS_HB_PEER_SEND: The heartbeat negotiation allows the peer to send heartbeat messages * @GNUTLS_SFLAGS_FALSE_START: False start was used in this client session. * @GNUTLS_SFLAGS_SESSION_TICKET: A session ticket has been received by the server. * @GNUTLS_SFLAGS_POST_HANDSHAKE_AUTH: Indicates client capability for post-handshake auth; set only on server side. * @GNUTLS_SFLAGS_EARLY_START: The TLS1.3 server session returned early. * @GNUTLS_SFLAGS_EARLY_DATA: The TLS1.3 early data has been received by the server. * @GNUTLS_SFLAGS_CLI_REQUESTED_OCSP: Set when the client has requested OCSP staple during handshake. * @GNUTLS_SFLAGS_SERV_REQUESTED_OCSP: Set when the server has requested OCSP staple during handshake. * * Enumeration of different session parameters. */ typedef enum { GNUTLS_SFLAGS_SAFE_RENEGOTIATION = 1, GNUTLS_SFLAGS_EXT_MASTER_SECRET = 1<<1, GNUTLS_SFLAGS_ETM = 1<<2, GNUTLS_SFLAGS_HB_LOCAL_SEND = 1<<3, GNUTLS_SFLAGS_HB_PEER_SEND = 1<<4, GNUTLS_SFLAGS_FALSE_START = 1<<5, GNUTLS_SFLAGS_RFC7919 = 1<<6, GNUTLS_SFLAGS_SESSION_TICKET = 1<<7, GNUTLS_SFLAGS_POST_HANDSHAKE_AUTH = 1<<8, GNUTLS_SFLAGS_EARLY_START = 1<<9, GNUTLS_SFLAGS_EARLY_DATA = 1<<10, GNUTLS_SFLAGS_CLI_REQUESTED_OCSP = 1<<11, GNUTLS_SFLAGS_SERV_REQUESTED_OCSP = 1<<12 } gnutls_session_flags_t; unsigned gnutls_session_get_flags(gnutls_session_t session); /** * gnutls_supplemental_data_format_type_t: * @GNUTLS_SUPPLEMENTAL_UNKNOWN: Unknown data format * * Enumeration of different supplemental data types (RFC 4680). */ typedef enum { GNUTLS_SUPPLEMENTAL_UNKNOWN = 0, } gnutls_supplemental_data_format_type_t; const char *gnutls_supplemental_get_name(gnutls_supplemental_data_format_type_t type); /* SessionTicket, RFC 5077. */ int gnutls_session_ticket_key_generate(gnutls_datum_t * key); int gnutls_session_ticket_enable_client(gnutls_session_t session); int gnutls_session_ticket_enable_server(gnutls_session_t session, const gnutls_datum_t * key); int gnutls_session_ticket_send(gnutls_session_t session, unsigned nr, unsigned flags); /* SRTP, RFC 5764 */ /** * gnutls_srtp_profile_t: * @GNUTLS_SRTP_AES128_CM_HMAC_SHA1_80: 128 bit AES with a 80 bit HMAC-SHA1 * @GNUTLS_SRTP_AES128_CM_HMAC_SHA1_32: 128 bit AES with a 32 bit HMAC-SHA1 * @GNUTLS_SRTP_NULL_HMAC_SHA1_80: NULL cipher with a 80 bit HMAC-SHA1 * @GNUTLS_SRTP_NULL_HMAC_SHA1_32: NULL cipher with a 32 bit HMAC-SHA1 * * Enumeration of different SRTP protection profiles. */ typedef enum { GNUTLS_SRTP_AES128_CM_HMAC_SHA1_80 = 0x0001, GNUTLS_SRTP_AES128_CM_HMAC_SHA1_32 = 0x0002, GNUTLS_SRTP_NULL_HMAC_SHA1_80 = 0x0005, GNUTLS_SRTP_NULL_HMAC_SHA1_32 = 0x0006 } gnutls_srtp_profile_t; int gnutls_srtp_set_profile(gnutls_session_t session, gnutls_srtp_profile_t profile); int gnutls_srtp_set_profile_direct(gnutls_session_t session, const char *profiles, const char **err_pos); int gnutls_srtp_get_selected_profile(gnutls_session_t session, gnutls_srtp_profile_t * profile); const char *gnutls_srtp_get_profile_name(gnutls_srtp_profile_t profile); int gnutls_srtp_get_profile_id(const char *name, gnutls_srtp_profile_t * profile); int gnutls_srtp_get_keys(gnutls_session_t session, void *key_material, unsigned int key_material_size, gnutls_datum_t * client_key, gnutls_datum_t * client_salt, gnutls_datum_t * server_key, gnutls_datum_t * server_salt); int gnutls_srtp_set_mki(gnutls_session_t session, const gnutls_datum_t * mki); int gnutls_srtp_get_mki(gnutls_session_t session, gnutls_datum_t * mki); /* COMPRESS_CERTIFICATE extension, RFC8879 */ gnutls_compression_method_t gnutls_compress_certificate_get_selected_method(gnutls_session_t session); int gnutls_compress_certificate_set_methods(gnutls_session_t session, const gnutls_compression_method_t * methods, size_t methods_len); /* ALPN TLS extension */ /** * gnutls_alpn_flags_t: * @GNUTLS_ALPN_MANDATORY: Require ALPN negotiation. The connection will be * aborted if no matching ALPN protocol is found. * @GNUTLS_ALPN_SERVER_PRECEDENCE: The choices set by the server * will take precedence over the client's. * * Enumeration of different ALPN flags. These are used by gnutls_alpn_set_protocols(). */ typedef enum { GNUTLS_ALPN_MANDATORY = 1, GNUTLS_ALPN_SERVER_PRECEDENCE = (1<<1) } gnutls_alpn_flags_t; #define GNUTLS_ALPN_MAND GNUTLS_ALPN_MANDATORY int gnutls_alpn_get_selected_protocol(gnutls_session_t session, gnutls_datum_t * protocol); int gnutls_alpn_set_protocols(gnutls_session_t session, const gnutls_datum_t * protocols, unsigned protocols_size, unsigned flags); int gnutls_key_generate(gnutls_datum_t * key, unsigned int key_size); #define GNUTLS_PRIORITY_INIT_DEF_APPEND 1 int gnutls_priority_init(gnutls_priority_t * priority_cache, const char *priorities, const char **err_pos); int gnutls_priority_init2(gnutls_priority_t * priority_cache, const char *priorities, const char **err_pos, unsigned flags); void gnutls_priority_deinit(gnutls_priority_t priority_cache); int gnutls_priority_get_cipher_suite_index(gnutls_priority_t pcache, unsigned int idx, unsigned int *sidx); #define GNUTLS_PRIORITY_LIST_INIT_KEYWORDS 1 #define GNUTLS_PRIORITY_LIST_SPECIAL 2 const char * gnutls_priority_string_list(unsigned iter, unsigned int flags); int gnutls_priority_set(gnutls_session_t session, gnutls_priority_t priority); int gnutls_priority_set_direct(gnutls_session_t session, const char *priorities, const char **err_pos); int gnutls_priority_certificate_type_list(gnutls_priority_t pcache, const unsigned int **list); int gnutls_priority_certificate_type_list2(gnutls_priority_t pcache, const unsigned int **list, gnutls_ctype_target_t target); int gnutls_priority_sign_list(gnutls_priority_t pcache, const unsigned int **list); int gnutls_priority_protocol_list(gnutls_priority_t pcache, const unsigned int **list); int gnutls_priority_ecc_curve_list(gnutls_priority_t pcache, const unsigned int **list); int gnutls_priority_group_list(gnutls_priority_t pcache, const unsigned int **list); int gnutls_priority_kx_list(gnutls_priority_t pcache, const unsigned int **list); int gnutls_priority_cipher_list(gnutls_priority_t pcache, const unsigned int **list); int gnutls_priority_mac_list(gnutls_priority_t pcache, const unsigned int **list); const char *gnutls_get_system_config_file(void); int gnutls_set_default_priority(gnutls_session_t session); int gnutls_set_default_priority_append(gnutls_session_t session, const char *add_prio, const char **err_pos, unsigned flags); /* Returns the name of a cipher suite */ const char * gnutls_cipher_suite_get_name(gnutls_kx_algorithm_t kx_algorithm, gnutls_cipher_algorithm_t cipher_algorithm, gnutls_mac_algorithm_t mac_algorithm) __GNUTLS_CONST__; const char * gnutls_ciphersuite_get(gnutls_session_t session) __GNUTLS_CONST__; /* get the currently used protocol version */ gnutls_protocol_t gnutls_protocol_get_version(gnutls_session_t session); const char * gnutls_protocol_get_name(gnutls_protocol_t version) __GNUTLS_CONST__; /* get/set session */ int gnutls_session_set_data(gnutls_session_t session, const void *session_data, size_t session_data_size); int gnutls_session_get_data(gnutls_session_t session, void *session_data, size_t * session_data_size); int gnutls_session_get_data2(gnutls_session_t session, gnutls_datum_t * data); void gnutls_session_get_random(gnutls_session_t session, gnutls_datum_t * client, gnutls_datum_t * server); void gnutls_session_get_master_secret(gnutls_session_t session, gnutls_datum_t * secret); char *gnutls_session_get_desc(gnutls_session_t session); typedef int gnutls_certificate_verify_function(gnutls_session_t); void gnutls_session_set_verify_function(gnutls_session_t session, gnutls_certificate_verify_function * func); /** * gnutls_vdata_types_t: * @GNUTLS_DT_UNKNOWN: Unknown data type. * @GNUTLS_DT_DNS_HOSTNAME: The data contain a null-terminated DNS hostname; the hostname will be * matched using the RFC6125 rules. If the data contain a textual IP (v4 or v6) address it will * be marched against the IPAddress Alternative name, unless the verification flag %GNUTLS_VERIFY_DO_NOT_ALLOW_IP_MATCHES * is specified. * @GNUTLS_DT_IP_ADDRESS: The data contain a raw IP address (4 or 16 bytes). If will be matched * against the IPAddress Alternative name; option available since 3.6.0. * @GNUTLS_DT_RFC822NAME: The data contain a null-terminated email address; the email will be * matched against the RFC822Name Alternative name of the certificate, or the EMAIL DN component if the * former isn't available. Prior to matching the email address will be converted to ACE * (ASCII-compatible-encoding). * @GNUTLS_DT_KEY_PURPOSE_OID: The data contain a null-terminated key purpose OID. It will be matched * against the certificate's Extended Key Usage extension. * * Enumeration of different typed-data options. They are used as input to certificate * verification functions to provide information about the name and purpose of the * certificate. Only a single option of a type can be provided to the relevant functions * (i.e., options %GNUTLS_DT_DNS_HOSTNAME, %GNUTLS_DT_IP_ADDRESS and * %GNUTLS_DT_RFC822NAME cannot be combined). */ typedef enum { GNUTLS_DT_UNKNOWN = 0, GNUTLS_DT_DNS_HOSTNAME = 1, GNUTLS_DT_KEY_PURPOSE_OID = 2, GNUTLS_DT_RFC822NAME = 3, GNUTLS_DT_IP_ADDRESS = 4 } gnutls_vdata_types_t; typedef struct { gnutls_vdata_types_t type; unsigned char *data; unsigned int size; } gnutls_typed_vdata_st; void gnutls_session_set_verify_cert(gnutls_session_t session, const char *hostname, unsigned flags); void gnutls_session_set_verify_cert2(gnutls_session_t session, gnutls_typed_vdata_st * data, unsigned elements, unsigned flags); unsigned int gnutls_session_get_verify_cert_status(gnutls_session_t); int gnutls_session_set_premaster(gnutls_session_t session, unsigned int entity, gnutls_protocol_t version, gnutls_kx_algorithm_t kx, gnutls_cipher_algorithm_t cipher, gnutls_mac_algorithm_t mac, gnutls_compression_method_t comp, const gnutls_datum_t * master, const gnutls_datum_t * session_id); /* returns the session ID */ #define GNUTLS_MAX_SESSION_ID 32 int gnutls_session_get_id(gnutls_session_t session, void *session_id, size_t * session_id_size); int gnutls_session_get_id2(gnutls_session_t session, gnutls_datum_t * session_id); int gnutls_session_set_id(gnutls_session_t session, const gnutls_datum_t * sid); int gnutls_session_channel_binding(gnutls_session_t session, gnutls_channel_binding_t cbtype, gnutls_datum_t * cb); /* checks if this session is a resumed one */ int gnutls_session_is_resumed(gnutls_session_t session); int gnutls_session_resumption_requested(gnutls_session_t session); typedef int (*gnutls_db_store_func) (void *, gnutls_datum_t key, gnutls_datum_t data); typedef int (*gnutls_db_remove_func) (void *, gnutls_datum_t key); typedef gnutls_datum_t(*gnutls_db_retr_func) (void *, gnutls_datum_t key); void gnutls_db_set_cache_expiration(gnutls_session_t session, int seconds); unsigned gnutls_db_get_default_cache_expiration(void); void gnutls_db_remove_session(gnutls_session_t session); void gnutls_db_set_retrieve_function(gnutls_session_t session, gnutls_db_retr_func retr_func); void gnutls_db_set_remove_function(gnutls_session_t session, gnutls_db_remove_func rem_func); void gnutls_db_set_store_function(gnutls_session_t session, gnutls_db_store_func store_func); void gnutls_db_set_ptr(gnutls_session_t session, void *ptr); void *gnutls_db_get_ptr(gnutls_session_t session); int gnutls_db_check_entry(gnutls_session_t session, gnutls_datum_t session_entry); time_t gnutls_db_check_entry_time(gnutls_datum_t * entry); time_t gnutls_db_check_entry_expire_time(gnutls_datum_t * entry); /** * gnutls_handshake_hook_func: * @session: the current session * @htype: the type of the handshake message (%gnutls_handshake_description_t) * @when: non zero if this is a post-process/generation call and zero otherwise * @incoming: non zero if this is an incoming message and zero if this is an outgoing message * @msg: the (const) data of the handshake message without the handshake headers. * * Function prototype for handshake hooks. It is set using * gnutls_handshake_set_hook_function(). * * Returns: Non zero on error. */ #define GNUTLS_HOOK_POST (1) #define GNUTLS_HOOK_PRE (0) #define GNUTLS_HOOK_BOTH (-1) typedef int (*gnutls_handshake_hook_func) (gnutls_session_t, unsigned int htype, unsigned when, unsigned int incoming, const gnutls_datum_t *msg); void gnutls_handshake_set_hook_function(gnutls_session_t session, unsigned int htype, int when, gnutls_handshake_hook_func func); #define gnutls_handshake_post_client_hello_func gnutls_handshake_simple_hook_func typedef int (*gnutls_handshake_simple_hook_func) (gnutls_session_t); void gnutls_handshake_set_post_client_hello_function(gnutls_session_t session, gnutls_handshake_simple_hook_func func); void gnutls_handshake_set_max_packet_length(gnutls_session_t session, size_t max); /* returns libgnutls version (call it with a NULL argument) */ const char * gnutls_check_version(const char *req_version) __GNUTLS_CONST__; /* A macro which will allow optimizing out calls to gnutls_check_version() * when the version being compiled with is sufficient. * Used as: * if (gnutls_check_version_numerc(3,3,16)) { */ #define gnutls_check_version_numeric(a,b,c) \ ((GNUTLS_VERSION_MAJOR >= (a)) && \ ((GNUTLS_VERSION_NUMBER >= ( ((a) << 16) + ((b) << 8) + (c) )) || \ gnutls_check_version(#a "." #b "." #c))) /* Functions for setting/clearing credentials */ void gnutls_credentials_clear(gnutls_session_t session); /* cred is a structure defined by the kx algorithm */ int gnutls_credentials_set(gnutls_session_t session, gnutls_credentials_type_t type, void *cred); int gnutls_credentials_get(gnutls_session_t session, gnutls_credentials_type_t type, void **cred); #define gnutls_cred_set gnutls_credentials_set /* x.509 types */ struct gnutls_pubkey_st; typedef struct gnutls_pubkey_st *gnutls_pubkey_t; struct gnutls_privkey_st; typedef struct gnutls_privkey_st *gnutls_privkey_t; struct gnutls_x509_privkey_int; typedef struct gnutls_x509_privkey_int *gnutls_x509_privkey_t; struct gnutls_x509_crl_int; typedef struct gnutls_x509_crl_int *gnutls_x509_crl_t; struct gnutls_x509_crt_int; typedef struct gnutls_x509_crt_int *gnutls_x509_crt_t; struct gnutls_x509_crq_int; typedef struct gnutls_x509_crq_int *gnutls_x509_crq_t; struct gnutls_openpgp_keyring_int; typedef struct gnutls_openpgp_keyring_int *gnutls_openpgp_keyring_t; /* Credential structures - used in gnutls_credentials_set(); */ struct gnutls_certificate_credentials_st; typedef struct gnutls_certificate_credentials_st *gnutls_certificate_credentials_t; typedef gnutls_certificate_credentials_t gnutls_certificate_server_credentials; typedef gnutls_certificate_credentials_t gnutls_certificate_client_credentials; typedef struct gnutls_anon_server_credentials_st *gnutls_anon_server_credentials_t; typedef struct gnutls_anon_client_credentials_st *gnutls_anon_client_credentials_t; void gnutls_anon_free_server_credentials(gnutls_anon_server_credentials_t sc); int gnutls_anon_allocate_server_credentials(gnutls_anon_server_credentials_t * sc); void gnutls_anon_set_server_dh_params(gnutls_anon_server_credentials_t res, gnutls_dh_params_t dh_params); int gnutls_anon_set_server_known_dh_params(gnutls_anon_server_credentials_t res, gnutls_sec_param_t sec_param); void gnutls_anon_set_server_params_function(gnutls_anon_server_credentials_t res, gnutls_params_function * func); void gnutls_anon_free_client_credentials(gnutls_anon_client_credentials_t sc); int gnutls_anon_allocate_client_credentials(gnutls_anon_client_credentials_t * sc); /* CERTFILE is an x509 certificate in PEM form. * KEYFILE is a pkcs-1 private key in PEM form (for RSA keys). */ void gnutls_certificate_free_credentials(gnutls_certificate_credentials_t sc); int gnutls_certificate_allocate_credentials(gnutls_certificate_credentials_t * res); int gnutls_certificate_get_issuer(gnutls_certificate_credentials_t sc, gnutls_x509_crt_t cert, gnutls_x509_crt_t * issuer, unsigned int flags); int gnutls_certificate_get_crt_raw(gnutls_certificate_credentials_t sc, unsigned idx1, unsigned idx2, gnutls_datum_t * cert); void gnutls_certificate_free_keys(gnutls_certificate_credentials_t sc); void gnutls_certificate_free_cas(gnutls_certificate_credentials_t sc); void gnutls_certificate_free_ca_names(gnutls_certificate_credentials_t sc); void gnutls_certificate_free_crls(gnutls_certificate_credentials_t sc); void gnutls_certificate_set_dh_params(gnutls_certificate_credentials_t res, gnutls_dh_params_t dh_params); int gnutls_certificate_set_known_dh_params(gnutls_certificate_credentials_t res, gnutls_sec_param_t sec_param); void gnutls_certificate_set_verify_flags(gnutls_certificate_credentials_t res, unsigned int flags); unsigned int gnutls_certificate_get_verify_flags(gnutls_certificate_credentials_t res); /** * gnutls_certificate_flags: * @GNUTLS_CERTIFICATE_SKIP_KEY_CERT_MATCH: Skip the key and certificate matching check. * @GNUTLS_CERTIFICATE_API_V2: If set the gnutls_certificate_set_*key* functions will return an index of the added key pair instead of zero. * @GNUTLS_CERTIFICATE_SKIP_OCSP_RESPONSE_CHECK: If set, the gnutls_certificate_set_ocsp_status_request_file * function, will not check whether the response set matches any of the certificates. * @GNUTLS_CERTIFICATE_VERIFY_CRLS: This will enable CRL verification when added in the certificate structure. * When used, it requires CAs to be added before CRLs. * * Enumeration of different certificate credentials flags. */ typedef enum gnutls_certificate_flags { GNUTLS_CERTIFICATE_SKIP_KEY_CERT_MATCH = 1, GNUTLS_CERTIFICATE_API_V2 = (1<<1), GNUTLS_CERTIFICATE_SKIP_OCSP_RESPONSE_CHECK = (1<<2), GNUTLS_CERTIFICATE_VERIFY_CRLS = (1<<3) } gnutls_certificate_flags; void gnutls_certificate_set_flags(gnutls_certificate_credentials_t, unsigned flags); void gnutls_certificate_set_verify_limits(gnutls_certificate_credentials_t res, unsigned int max_bits, unsigned int max_depth); int gnutls_certificate_set_x509_system_trust(gnutls_certificate_credentials_t cred); int gnutls_certificate_set_x509_trust_file(gnutls_certificate_credentials_t cred, const char *cafile, gnutls_x509_crt_fmt_t type); int gnutls_certificate_set_x509_trust_dir(gnutls_certificate_credentials_t cred, const char *ca_dir, gnutls_x509_crt_fmt_t type); int gnutls_certificate_set_x509_trust_mem(gnutls_certificate_credentials_t res, const gnutls_datum_t * ca, gnutls_x509_crt_fmt_t type); int gnutls_certificate_set_x509_crl_file(gnutls_certificate_credentials_t res, const char *crlfile, gnutls_x509_crt_fmt_t type); int gnutls_certificate_set_x509_crl_mem(gnutls_certificate_credentials_t res, const gnutls_datum_t * CRL, gnutls_x509_crt_fmt_t type); int gnutls_certificate_set_x509_key_file(gnutls_certificate_credentials_t res, const char *certfile, const char *keyfile, gnutls_x509_crt_fmt_t type); int gnutls_certificate_set_x509_key_file2(gnutls_certificate_credentials_t res, const char *certfile, const char *keyfile, gnutls_x509_crt_fmt_t type, const char *pass, unsigned int flags); int gnutls_certificate_set_x509_key_mem(gnutls_certificate_credentials_t res, const gnutls_datum_t * cert, const gnutls_datum_t * key, gnutls_x509_crt_fmt_t type); int gnutls_certificate_set_x509_key_mem2(gnutls_certificate_credentials_t res, const gnutls_datum_t * cert, const gnutls_datum_t * key, gnutls_x509_crt_fmt_t type, const char *pass, unsigned int flags); void gnutls_certificate_send_x509_rdn_sequence(gnutls_session_t session, int status); int gnutls_certificate_set_x509_simple_pkcs12_file (gnutls_certificate_credentials_t res, const char *pkcs12file, gnutls_x509_crt_fmt_t type, const char *password); int gnutls_certificate_set_x509_simple_pkcs12_mem (gnutls_certificate_credentials_t res, const gnutls_datum_t * p12blob, gnutls_x509_crt_fmt_t type, const char *password); /* New functions to allow setting already parsed X.509 stuff. */ int gnutls_certificate_set_x509_key(gnutls_certificate_credentials_t res, gnutls_x509_crt_t * cert_list, int cert_list_size, gnutls_x509_privkey_t key); int gnutls_certificate_set_x509_trust(gnutls_certificate_credentials_t res, gnutls_x509_crt_t * ca_list, int ca_list_size); int gnutls_certificate_set_x509_crl(gnutls_certificate_credentials_t res, gnutls_x509_crl_t * crl_list, int crl_list_size); int gnutls_certificate_get_x509_key(gnutls_certificate_credentials_t res, unsigned index, gnutls_x509_privkey_t *key); int gnutls_certificate_get_x509_crt(gnutls_certificate_credentials_t res, unsigned index, gnutls_x509_crt_t **crt_list, unsigned *crt_list_size); /* OCSP status request extension, RFC 6066 */ typedef int (*gnutls_status_request_ocsp_func) (gnutls_session_t session, void *ptr, gnutls_datum_t *ocsp_response); void gnutls_certificate_set_ocsp_status_request_function (gnutls_certificate_credentials_t res, gnutls_status_request_ocsp_func ocsp_func, void *ptr); int gnutls_certificate_set_ocsp_status_request_function2 (gnutls_certificate_credentials_t res, unsigned idx, gnutls_status_request_ocsp_func ocsp_func, void *ptr); int gnutls_certificate_set_ocsp_status_request_file (gnutls_certificate_credentials_t res, const char *response_file, unsigned idx); int gnutls_certificate_set_ocsp_status_request_file2 (gnutls_certificate_credentials_t res, const char *response_file, unsigned idx, gnutls_x509_crt_fmt_t fmt); int gnutls_certificate_set_ocsp_status_request_mem (gnutls_certificate_credentials_t res, const gnutls_datum_t *resp, unsigned idx, gnutls_x509_crt_fmt_t fmt); typedef struct gnutls_ocsp_data_st { unsigned int version; /* must be zero */ gnutls_datum_t response; time_t exptime; unsigned char padding[32]; } gnutls_ocsp_data_st; time_t gnutls_certificate_get_ocsp_expiration(gnutls_certificate_credentials_t sc, unsigned idx, int oidx, unsigned flags); int gnutls_ocsp_status_request_enable_client(gnutls_session_t session, gnutls_datum_t * responder_id, size_t responder_id_size, gnutls_datum_t * request_extensions); int gnutls_ocsp_status_request_get(gnutls_session_t session, gnutls_datum_t * response); #define GNUTLS_OCSP_SR_IS_AVAIL 1 unsigned gnutls_ocsp_status_request_is_checked(gnutls_session_t session, unsigned int flags); int gnutls_ocsp_status_request_get2(gnutls_session_t session, unsigned idx, gnutls_datum_t * response); /* RAW public key functions (RFC7250) */ int gnutls_certificate_set_rawpk_key_mem(gnutls_certificate_credentials_t cred, const gnutls_datum_t* spki, const gnutls_datum_t* pkey, gnutls_x509_crt_fmt_t format, const char* pass, unsigned int key_usage, const char **names, unsigned int names_length, unsigned int flags); int gnutls_certificate_set_rawpk_key_file(gnutls_certificate_credentials_t cred, const char* rawpkfile, const char* privkeyfile, gnutls_x509_crt_fmt_t format, const char *pass, unsigned int key_usage, const char **names, unsigned int names_length, unsigned int privkey_flags, unsigned int pkcs11_flags); /* global state functions */ int gnutls_global_init(void); void gnutls_global_deinit(void); const gnutls_library_config_st *gnutls_get_library_config(void); /** * gnutls_time_func: * @t: where to store time. * * Function prototype for time()-like function. Set with * gnutls_global_set_time_function(). * * Returns: Number of seconds since the epoch, or (time_t)-1 on errors. */ typedef time_t(*gnutls_time_func) (time_t * t); typedef int (*mutex_init_func) (void **mutex); typedef int (*mutex_lock_func) (void **mutex); typedef int (*mutex_unlock_func) (void **mutex); typedef int (*mutex_deinit_func) (void **mutex); void gnutls_global_set_mutex(mutex_init_func init, mutex_deinit_func deinit, mutex_lock_func lock, mutex_unlock_func unlock); typedef void *(*gnutls_alloc_function) (size_t); typedef void *(*gnutls_calloc_function) (size_t, size_t); typedef int (*gnutls_is_secure_function) (const void *); typedef void (*gnutls_free_function) (void *); typedef void *(*gnutls_realloc_function) (void *, size_t); void gnutls_global_set_time_function(gnutls_time_func time_func); /* For use in callbacks */ extern _SYM_EXPORT gnutls_alloc_function gnutls_malloc; extern _SYM_EXPORT gnutls_realloc_function gnutls_realloc; extern _SYM_EXPORT gnutls_calloc_function gnutls_calloc; extern _SYM_EXPORT gnutls_free_function gnutls_free; #ifdef GNUTLS_INTERNAL_BUILD #define gnutls_free(a) gnutls_free((void *) (a)), a=NULL #endif extern _SYM_EXPORT char *(*gnutls_strdup) (const char *); /* a variant of memset that doesn't get optimized out */ void gnutls_memset(void *data, int c, size_t size); /* constant time memcmp */ int gnutls_memcmp(const void *s1, const void *s2, size_t n); typedef void (*gnutls_log_func) (int, const char *); typedef void (*gnutls_audit_log_func) (gnutls_session_t, const char *); void gnutls_global_set_log_function(gnutls_log_func log_func); void gnutls_global_set_audit_log_function(gnutls_audit_log_func log_func); void gnutls_global_set_log_level(int level); /** * gnutls_keylog_func: * @session: the current session * @label: the keylog label * @secret: the (const) data of the derived secret. * * Function prototype for keylog hooks. It is set using * gnutls_session_set_keylog_function(). * * Returns: Non zero on error. * Since: 3.6.13 */ typedef int (*gnutls_keylog_func) (gnutls_session_t session, const char *label, const gnutls_datum_t *secret); gnutls_keylog_func gnutls_session_get_keylog_function(const gnutls_session_t session); void gnutls_session_set_keylog_function(gnutls_session_t session, gnutls_keylog_func func); /* Diffie-Hellman parameter handling. */ int gnutls_dh_params_init(gnutls_dh_params_t * dh_params); void gnutls_dh_params_deinit(gnutls_dh_params_t dh_params); int gnutls_dh_params_import_raw(gnutls_dh_params_t dh_params, const gnutls_datum_t * prime, const gnutls_datum_t * generator); int gnutls_dh_params_import_dsa(gnutls_dh_params_t dh_params, gnutls_x509_privkey_t key); int gnutls_dh_params_import_raw2(gnutls_dh_params_t dh_params, const gnutls_datum_t * prime, const gnutls_datum_t * generator, unsigned key_bits); int gnutls_dh_params_import_raw3(gnutls_dh_params_t dh_params, const gnutls_datum_t * prime, const gnutls_datum_t * q, const gnutls_datum_t * generator); int gnutls_dh_params_import_pkcs3(gnutls_dh_params_t params, const gnutls_datum_t * pkcs3_params, gnutls_x509_crt_fmt_t format); int gnutls_dh_params_generate2(gnutls_dh_params_t params, unsigned int bits); int gnutls_dh_params_export_pkcs3(gnutls_dh_params_t params, gnutls_x509_crt_fmt_t format, unsigned char *params_data, size_t * params_data_size); int gnutls_dh_params_export2_pkcs3(gnutls_dh_params_t params, gnutls_x509_crt_fmt_t format, gnutls_datum_t * out); int gnutls_dh_params_export_raw(gnutls_dh_params_t params, gnutls_datum_t * prime, gnutls_datum_t * generator, unsigned int *bits); int gnutls_dh_params_cpy(gnutls_dh_params_t dst, gnutls_dh_params_t src); /* Session stuff */ typedef struct { void *iov_base; size_t iov_len; } giovec_t; typedef ssize_t(*gnutls_pull_func) (gnutls_transport_ptr_t, void *, size_t); typedef ssize_t(*gnutls_push_func) (gnutls_transport_ptr_t, const void *, size_t); int gnutls_system_recv_timeout(gnutls_transport_ptr_t ptr, unsigned int ms); typedef int (*gnutls_pull_timeout_func) (gnutls_transport_ptr_t, unsigned int ms); typedef ssize_t(*gnutls_vec_push_func) (gnutls_transport_ptr_t, const giovec_t * iov, int iovcnt); typedef int (*gnutls_errno_func) (gnutls_transport_ptr_t); #if 0 /* This will be defined as macro. */ void gnutls_transport_set_int (gnutls_session_t session, int r); #endif void gnutls_transport_set_int2(gnutls_session_t session, int r, int s); #define gnutls_transport_set_int(s, i) gnutls_transport_set_int2(s, i, i) void gnutls_transport_get_int2(gnutls_session_t session, int *r, int *s); int gnutls_transport_get_int(gnutls_session_t session); void gnutls_transport_set_ptr(gnutls_session_t session, gnutls_transport_ptr_t ptr); void gnutls_transport_set_ptr2(gnutls_session_t session, gnutls_transport_ptr_t recv_ptr, gnutls_transport_ptr_t send_ptr); gnutls_transport_ptr_t gnutls_transport_get_ptr(gnutls_session_t session); void gnutls_transport_get_ptr2(gnutls_session_t session, gnutls_transport_ptr_t * recv_ptr, gnutls_transport_ptr_t * send_ptr); void gnutls_transport_set_vec_push_function(gnutls_session_t session, gnutls_vec_push_func vec_func); void gnutls_transport_set_push_function(gnutls_session_t session, gnutls_push_func push_func); void gnutls_transport_set_pull_function(gnutls_session_t session, gnutls_pull_func pull_func); void gnutls_transport_set_pull_timeout_function(gnutls_session_t session, gnutls_pull_timeout_func func); void gnutls_transport_set_errno_function(gnutls_session_t session, gnutls_errno_func errno_func); void gnutls_transport_set_errno(gnutls_session_t session, int err); /* session specific */ void gnutls_session_set_ptr(gnutls_session_t session, void *ptr); void *gnutls_session_get_ptr(gnutls_session_t session); void gnutls_openpgp_send_cert(gnutls_session_t session, gnutls_openpgp_crt_status_t status); /* This function returns the hash of the given data. */ int gnutls_fingerprint(gnutls_digest_algorithm_t algo, const gnutls_datum_t * data, void *result, size_t * result_size); /** * gnutls_random_art_t: * @GNUTLS_RANDOM_ART_OPENSSH: OpenSSH-style random art. * * Enumeration of different random art types. */ typedef enum gnutls_random_art { GNUTLS_RANDOM_ART_OPENSSH = 1 } gnutls_random_art_t; int gnutls_random_art(gnutls_random_art_t type, const char *key_type, unsigned int key_size, void *fpr, size_t fpr_size, gnutls_datum_t * art); /* IDNA */ #define GNUTLS_IDNA_FORCE_2008 (1<<1) int gnutls_idna_map(const char * input, unsigned ilen, gnutls_datum_t *out, unsigned flags); int gnutls_idna_reverse_map(const char *input, unsigned ilen, gnutls_datum_t *out, unsigned flags); /* SRP */ typedef struct gnutls_srp_server_credentials_st *gnutls_srp_server_credentials_t; typedef struct gnutls_srp_client_credentials_st *gnutls_srp_client_credentials_t; void gnutls_srp_free_client_credentials(gnutls_srp_client_credentials_t sc); int gnutls_srp_allocate_client_credentials(gnutls_srp_client_credentials_t * sc); int gnutls_srp_set_client_credentials(gnutls_srp_client_credentials_t res, const char *username, const char *password); void gnutls_srp_free_server_credentials(gnutls_srp_server_credentials_t sc); int gnutls_srp_allocate_server_credentials(gnutls_srp_server_credentials_t * sc); int gnutls_srp_set_server_credentials_file(gnutls_srp_server_credentials_t res, const char *password_file, const char *password_conf_file); const char *gnutls_srp_server_get_username(gnutls_session_t session); void gnutls_srp_set_prime_bits(gnutls_session_t session, unsigned int bits); int gnutls_srp_verifier(const char *username, const char *password, const gnutls_datum_t * salt, const gnutls_datum_t * generator, const gnutls_datum_t * prime, gnutls_datum_t * res); /* The static parameters defined in draft-ietf-tls-srp-05 * Those should be used as input to gnutls_srp_verifier(). */ extern _SYM_EXPORT const gnutls_datum_t gnutls_srp_8192_group_prime; extern _SYM_EXPORT const gnutls_datum_t gnutls_srp_8192_group_generator; extern _SYM_EXPORT const gnutls_datum_t gnutls_srp_4096_group_prime; extern _SYM_EXPORT const gnutls_datum_t gnutls_srp_4096_group_generator; extern _SYM_EXPORT const gnutls_datum_t gnutls_srp_3072_group_prime; extern _SYM_EXPORT const gnutls_datum_t gnutls_srp_3072_group_generator; extern _SYM_EXPORT const gnutls_datum_t gnutls_srp_2048_group_prime; extern _SYM_EXPORT const gnutls_datum_t gnutls_srp_2048_group_generator; extern _SYM_EXPORT const gnutls_datum_t gnutls_srp_1536_group_prime; extern _SYM_EXPORT const gnutls_datum_t gnutls_srp_1536_group_generator; extern _SYM_EXPORT const gnutls_datum_t gnutls_srp_1024_group_prime; extern _SYM_EXPORT const gnutls_datum_t gnutls_srp_1024_group_generator; /* The static parameters defined in rfc7919 */ extern _SYM_EXPORT const gnutls_datum_t gnutls_ffdhe_8192_group_prime; extern _SYM_EXPORT const gnutls_datum_t gnutls_ffdhe_8192_group_q; extern _SYM_EXPORT const gnutls_datum_t gnutls_ffdhe_8192_group_generator; extern _SYM_EXPORT const unsigned int gnutls_ffdhe_8192_key_bits; extern _SYM_EXPORT const gnutls_datum_t gnutls_ffdhe_6144_group_prime; extern _SYM_EXPORT const gnutls_datum_t gnutls_ffdhe_6144_group_q; extern _SYM_EXPORT const gnutls_datum_t gnutls_ffdhe_6144_group_generator; extern _SYM_EXPORT const unsigned int gnutls_ffdhe_6144_key_bits; extern _SYM_EXPORT const gnutls_datum_t gnutls_ffdhe_4096_group_prime; extern _SYM_EXPORT const gnutls_datum_t gnutls_ffdhe_4096_group_q; extern _SYM_EXPORT const gnutls_datum_t gnutls_ffdhe_4096_group_generator; extern _SYM_EXPORT const unsigned int gnutls_ffdhe_4096_key_bits; extern _SYM_EXPORT const gnutls_datum_t gnutls_ffdhe_3072_group_prime; extern _SYM_EXPORT const gnutls_datum_t gnutls_ffdhe_3072_group_q; extern _SYM_EXPORT const gnutls_datum_t gnutls_ffdhe_3072_group_generator; extern _SYM_EXPORT const unsigned int gnutls_ffdhe_3072_key_bits; extern _SYM_EXPORT const gnutls_datum_t gnutls_ffdhe_2048_group_prime; extern _SYM_EXPORT const gnutls_datum_t gnutls_ffdhe_2048_group_q; extern _SYM_EXPORT const gnutls_datum_t gnutls_ffdhe_2048_group_generator; extern _SYM_EXPORT const unsigned int gnutls_ffdhe_2048_key_bits; typedef int gnutls_srp_server_credentials_function(gnutls_session_t, const char *username, gnutls_datum_t * salt, gnutls_datum_t * verifier, gnutls_datum_t * generator, gnutls_datum_t * prime); void gnutls_srp_set_server_credentials_function(gnutls_srp_server_credentials_t cred, gnutls_srp_server_credentials_function * func); typedef int gnutls_srp_client_credentials_function(gnutls_session_t, char **, char **); void gnutls_srp_set_client_credentials_function(gnutls_srp_client_credentials_t cred, gnutls_srp_client_credentials_function * func); int gnutls_srp_base64_encode(const gnutls_datum_t * data, char *result, size_t * result_size); int gnutls_srp_base64_encode2(const gnutls_datum_t * data, gnutls_datum_t * result); int gnutls_srp_base64_decode(const gnutls_datum_t * b64_data, char *result, size_t * result_size); int gnutls_srp_base64_decode2(const gnutls_datum_t * b64_data, gnutls_datum_t * result); #define gnutls_srp_base64_encode_alloc gnutls_srp_base64_encode2 #define gnutls_srp_base64_decode_alloc gnutls_srp_base64_decode2 void gnutls_srp_set_server_fake_salt_seed(gnutls_srp_server_credentials_t sc, const gnutls_datum_t * seed, unsigned int salt_length); /* PSK stuff */ typedef struct gnutls_psk_server_credentials_st *gnutls_psk_server_credentials_t; typedef struct gnutls_psk_client_credentials_st *gnutls_psk_client_credentials_t; /** * gnutls_psk_key_flags: * @GNUTLS_PSK_KEY_RAW: PSK-key in raw format. * @GNUTLS_PSK_KEY_HEX: PSK-key in hex format. * * Enumeration of different PSK key flags. */ typedef enum gnutls_psk_key_flags { GNUTLS_PSK_KEY_RAW = 0, GNUTLS_PSK_KEY_HEX } gnutls_psk_key_flags; void gnutls_psk_free_client_credentials(gnutls_psk_client_credentials_t sc); int gnutls_psk_allocate_client_credentials(gnutls_psk_client_credentials_t * sc); int gnutls_psk_set_client_credentials(gnutls_psk_client_credentials_t res, const char *username, const gnutls_datum_t * key, gnutls_psk_key_flags flags); int gnutls_psk_set_client_credentials2(gnutls_psk_client_credentials_t res, const gnutls_datum_t *username, const gnutls_datum_t *key, gnutls_psk_key_flags flags); void gnutls_psk_free_server_credentials(gnutls_psk_server_credentials_t sc); int gnutls_psk_allocate_server_credentials(gnutls_psk_server_credentials_t * sc); int gnutls_psk_set_server_credentials_file(gnutls_psk_server_credentials_t res, const char *password_file); int gnutls_psk_set_server_credentials_hint(gnutls_psk_server_credentials_t res, const char *hint); const char *gnutls_psk_server_get_username(gnutls_session_t session); int gnutls_psk_server_get_username2(gnutls_session_t session, gnutls_datum_t *out); const char *gnutls_psk_client_get_hint(gnutls_session_t session); typedef int gnutls_psk_server_credentials_function(gnutls_session_t, const char *username, gnutls_datum_t * key); typedef int gnutls_psk_server_credentials_function2(gnutls_session_t, const gnutls_datum_t *username, gnutls_datum_t *key); void gnutls_psk_set_server_credentials_function(gnutls_psk_server_credentials_t cred, gnutls_psk_server_credentials_function * func); void gnutls_psk_set_server_credentials_function2(gnutls_psk_server_credentials_t cred, gnutls_psk_server_credentials_function2 *func); typedef int gnutls_psk_client_credentials_function(gnutls_session_t, char **username, gnutls_datum_t * key); typedef int gnutls_psk_client_credentials_function2(gnutls_session_t, gnutls_datum_t *username, gnutls_datum_t *key); void gnutls_psk_set_client_credentials_function(gnutls_psk_client_credentials_t cred, gnutls_psk_client_credentials_function * func); void gnutls_psk_set_client_credentials_function2(gnutls_psk_client_credentials_t cred, gnutls_psk_client_credentials_function2 *func); int gnutls_hex_encode(const gnutls_datum_t * data, char *result, size_t * result_size); int gnutls_hex_decode(const gnutls_datum_t * hex_data, void *result, size_t * result_size); int gnutls_hex_encode2(const gnutls_datum_t * data, gnutls_datum_t *result); int gnutls_hex_decode2(const gnutls_datum_t * data, gnutls_datum_t *result); void gnutls_psk_set_server_dh_params(gnutls_psk_server_credentials_t res, gnutls_dh_params_t dh_params); int gnutls_psk_set_server_known_dh_params(gnutls_psk_server_credentials_t res, gnutls_sec_param_t sec_param); void gnutls_psk_set_server_params_function(gnutls_psk_server_credentials_t res, gnutls_params_function * func); /** * gnutls_x509_subject_alt_name_t: * @GNUTLS_SAN_DNSNAME: DNS-name SAN. * @GNUTLS_SAN_RFC822NAME: E-mail address SAN. * @GNUTLS_SAN_URI: URI SAN. * @GNUTLS_SAN_IPADDRESS: IP address SAN. * @GNUTLS_SAN_OTHERNAME: OtherName SAN. * @GNUTLS_SAN_DN: DN SAN. * @GNUTLS_SAN_REGISTERED_ID: RegisteredID. * @GNUTLS_SAN_OTHERNAME_XMPP: Virtual SAN, used by certain functions for convenience. * @GNUTLS_SAN_OTHERNAME_KRB5PRINCIPAL: Virtual SAN, used by certain functions for convenience. * @GNUTLS_SAN_OTHERNAME_MSUSERPRINCIPAL: Virtual SAN, used by certain functions for convenience. * * Enumeration of different subject alternative names types. */ typedef enum gnutls_x509_subject_alt_name_t { GNUTLS_SAN_DNSNAME = 1, GNUTLS_SAN_RFC822NAME = 2, GNUTLS_SAN_URI = 3, GNUTLS_SAN_IPADDRESS = 4, GNUTLS_SAN_OTHERNAME = 5, GNUTLS_SAN_DN = 6, GNUTLS_SAN_REGISTERED_ID = 7, GNUTLS_SAN_MAX = GNUTLS_SAN_REGISTERED_ID, /* The following are "virtual" subject alternative name types, in that they are represented by an otherName value and an OID. Used by gnutls_x509_crt_get_subject_alt_othername_oid. */ GNUTLS_SAN_OTHERNAME_XMPP = 1000, GNUTLS_SAN_OTHERNAME_KRB5PRINCIPAL, GNUTLS_SAN_OTHERNAME_MSUSERPRINCIPAL } gnutls_x509_subject_alt_name_t; struct gnutls_openpgp_crt_int; typedef struct gnutls_openpgp_crt_int *gnutls_openpgp_crt_t; struct gnutls_openpgp_privkey_int; typedef struct gnutls_openpgp_privkey_int *gnutls_openpgp_privkey_t; struct gnutls_pkcs11_privkey_st; typedef struct gnutls_pkcs11_privkey_st *gnutls_pkcs11_privkey_t; /** * gnutls_privkey_type_t: * @GNUTLS_PRIVKEY_X509: X.509 private key, #gnutls_x509_privkey_t. * @GNUTLS_PRIVKEY_OPENPGP: OpenPGP private key, #gnutls_openpgp_privkey_t. * @GNUTLS_PRIVKEY_PKCS11: PKCS11 private key, #gnutls_pkcs11_privkey_t. * @GNUTLS_PRIVKEY_EXT: External private key, operating using callbacks. * * Enumeration of different private key types. */ typedef enum { GNUTLS_PRIVKEY_X509, GNUTLS_PRIVKEY_OPENPGP, GNUTLS_PRIVKEY_PKCS11, GNUTLS_PRIVKEY_EXT } gnutls_privkey_type_t; typedef struct gnutls_retr2_st { gnutls_certificate_type_t cert_type; gnutls_privkey_type_t key_type; union { gnutls_x509_crt_t *x509; gnutls_openpgp_crt_t pgp; } cert; unsigned int ncerts; /* one for pgp keys */ union { gnutls_x509_privkey_t x509; gnutls_openpgp_privkey_t pgp; gnutls_pkcs11_privkey_t pkcs11; } key; unsigned int deinit_all; /* if non zero all keys will be deinited */ } gnutls_retr2_st; /* Functions that allow auth_info_t structures handling */ gnutls_credentials_type_t gnutls_auth_get_type(gnutls_session_t session); gnutls_credentials_type_t gnutls_auth_server_get_type(gnutls_session_t session); gnutls_credentials_type_t gnutls_auth_client_get_type(gnutls_session_t session); /* DH */ void gnutls_dh_set_prime_bits(gnutls_session_t session, unsigned int bits); int gnutls_dh_get_secret_bits(gnutls_session_t session); int gnutls_dh_get_peers_public_bits(gnutls_session_t session); int gnutls_dh_get_prime_bits(gnutls_session_t session); int gnutls_dh_get_group(gnutls_session_t session, gnutls_datum_t * raw_gen, gnutls_datum_t * raw_prime); int gnutls_dh_get_pubkey(gnutls_session_t session, gnutls_datum_t * raw_key); /* X509PKI */ /* These are set on the credentials structure. */ /* use gnutls_certificate_set_retrieve_function2() in abstract.h * instead. It's much more efficient. */ typedef int gnutls_certificate_retrieve_function(gnutls_session_t, const gnutls_datum_t * req_ca_rdn, int nreqs, const gnutls_pk_algorithm_t * pk_algos, int pk_algos_length, gnutls_retr2_st *); void gnutls_certificate_set_retrieve_function(gnutls_certificate_credentials_t cred, gnutls_certificate_retrieve_function * func); void gnutls_certificate_set_verify_function(gnutls_certificate_credentials_t cred, gnutls_certificate_verify_function * func); void gnutls_certificate_server_set_request(gnutls_session_t session, gnutls_certificate_request_t req); /* get data from the session */ const gnutls_datum_t *gnutls_certificate_get_peers(gnutls_session_t session, unsigned int *list_size); const gnutls_datum_t *gnutls_certificate_get_ours(gnutls_session_t session); int gnutls_certificate_get_peers_subkey_id(gnutls_session_t session, gnutls_datum_t * id); time_t gnutls_certificate_activation_time_peers(gnutls_session_t session); time_t gnutls_certificate_expiration_time_peers(gnutls_session_t session); unsigned gnutls_certificate_client_get_request_status(gnutls_session_t session); int gnutls_certificate_verify_peers2(gnutls_session_t session, unsigned int *status); int gnutls_certificate_verify_peers3(gnutls_session_t session, const char *hostname, unsigned int *status); int gnutls_certificate_verify_peers(gnutls_session_t session, gnutls_typed_vdata_st * data, unsigned int elements, unsigned int *status); int gnutls_certificate_verification_status_print(unsigned int status, gnutls_certificate_type_t type, gnutls_datum_t * out, unsigned int flags); int gnutls_pem_base64_encode(const char *msg, const gnutls_datum_t * data, char *result, size_t * result_size); int gnutls_pem_base64_decode(const char *header, const gnutls_datum_t * b64_data, unsigned char *result, size_t * result_size); int gnutls_pem_base64_encode2(const char *msg, const gnutls_datum_t * data, gnutls_datum_t * result); int gnutls_pem_base64_decode2(const char *header, const gnutls_datum_t * b64_data, gnutls_datum_t * result); int gnutls_base64_encode2(const gnutls_datum_t * data, gnutls_datum_t * result); int gnutls_base64_decode2(const gnutls_datum_t * b64_data, gnutls_datum_t * result); #define gnutls_pem_base64_encode_alloc gnutls_pem_base64_encode2 #define gnutls_pem_base64_decode_alloc gnutls_pem_base64_decode2 /* key_usage will be an OR of the following values: */ /* when the key is to be used for signing: */ #define GNUTLS_KEY_DIGITAL_SIGNATURE 128 #define GNUTLS_KEY_NON_REPUDIATION 64 /* when the key is to be used for encryption: */ #define GNUTLS_KEY_KEY_ENCIPHERMENT 32 #define GNUTLS_KEY_DATA_ENCIPHERMENT 16 #define GNUTLS_KEY_KEY_AGREEMENT 8 #define GNUTLS_KEY_KEY_CERT_SIGN 4 #define GNUTLS_KEY_CRL_SIGN 2 #define GNUTLS_KEY_ENCIPHER_ONLY 1 #define GNUTLS_KEY_DECIPHER_ONLY 32768 void gnutls_certificate_set_params_function(gnutls_certificate_credentials_t res, gnutls_params_function * func); void gnutls_anon_set_params_function(gnutls_anon_server_credentials_t res, gnutls_params_function * func); void gnutls_psk_set_params_function(gnutls_psk_server_credentials_t res, gnutls_params_function * func); int gnutls_hex2bin(const char *hex_data, size_t hex_size, void *bin_data, size_t * bin_size); /* Trust on first use (or ssh like) functions */ /* stores the provided information to a database */ typedef int (*gnutls_tdb_store_func) (const char *db_name, const char *host, const char *service, time_t expiration, const gnutls_datum_t * pubkey); typedef int (*gnutls_tdb_store_commitment_func) (const char *db_name, const char *host, const char *service, time_t expiration, gnutls_digest_algorithm_t hash_algo, const gnutls_datum_t * hash); /* searches for the provided host/service pair that match the * provided public key in the database. */ typedef int (*gnutls_tdb_verify_func) (const char *db_name, const char *host, const char *service, const gnutls_datum_t * pubkey); struct gnutls_tdb_int; typedef struct gnutls_tdb_int *gnutls_tdb_t; int gnutls_tdb_init(gnutls_tdb_t * tdb); void gnutls_tdb_set_store_func(gnutls_tdb_t tdb, gnutls_tdb_store_func store); void gnutls_tdb_set_store_commitment_func(gnutls_tdb_t tdb, gnutls_tdb_store_commitment_func cstore); void gnutls_tdb_set_verify_func(gnutls_tdb_t tdb, gnutls_tdb_verify_func verify); void gnutls_tdb_deinit(gnutls_tdb_t tdb); int gnutls_verify_stored_pubkey(const char *db_name, gnutls_tdb_t tdb, const char *host, const char *service, gnutls_certificate_type_t cert_type, const gnutls_datum_t * cert, unsigned int flags); #define GNUTLS_SCOMMIT_FLAG_ALLOW_BROKEN 1 int gnutls_store_commitment(const char *db_name, gnutls_tdb_t tdb, const char *host, const char *service, gnutls_digest_algorithm_t hash_algo, const gnutls_datum_t * hash, time_t expiration, unsigned int flags); int gnutls_store_pubkey(const char *db_name, gnutls_tdb_t tdb, const char *host, const char *service, gnutls_certificate_type_t cert_type, const gnutls_datum_t * cert, time_t expiration, unsigned int flags); /* Other helper functions */ int gnutls_load_file(const char *filename, gnutls_datum_t * data); unsigned gnutls_url_is_supported(const char *url); /* PIN callback */ /** * gnutls_pin_flag_t: * @GNUTLS_PIN_USER: The PIN for the user. * @GNUTLS_PIN_SO: The PIN for the security officer (admin). * @GNUTLS_PIN_CONTEXT_SPECIFIC: The PIN is for a specific action and key like signing. * @GNUTLS_PIN_FINAL_TRY: This is the final try before blocking. * @GNUTLS_PIN_COUNT_LOW: Few tries remain before token blocks. * @GNUTLS_PIN_WRONG: Last given PIN was not correct. * * Enumeration of different flags that are input to the PIN function. */ typedef enum { GNUTLS_PIN_USER = (1 << 0), GNUTLS_PIN_SO = (1 << 1), GNUTLS_PIN_FINAL_TRY = (1 << 2), GNUTLS_PIN_COUNT_LOW = (1 << 3), GNUTLS_PIN_CONTEXT_SPECIFIC = (1 << 4), GNUTLS_PIN_WRONG = (1 << 5) } gnutls_pin_flag_t; #define GNUTLS_PKCS11_PIN_USER GNUTLS_PIN_USER #define GNUTLS_PKCS11_PIN_SO GNUTLS_PIN_SO #define GNUTLS_PKCS11_PIN_FINAL_TRY GNUTLS_PIN_FINAL_TRY #define GNUTLS_PKCS11_PIN_COUNT_LOW GNUTLS_PIN_COUNT_LOW #define GNUTLS_PKCS11_PIN_CONTEXT_SPECIFIC GNUTLS_PIN_CONTEXT_SPECIFIC #define GNUTLS_PKCS11_PIN_WRONG GNUTLS_PIN_WRONG /** * gnutls_pin_callback_t: * @userdata: user-controlled data from gnutls_pkcs11_set_pin_function(). * @attempt: pin-attempt counter, initially 0. * @token_url: URL of token. * @token_label: label of token. * @flags: a #gnutls_pin_flag_t flag. * @pin: buffer to hold PIN, of size @pin_max. * @pin_max: size of @pin buffer. * * Callback function type for PKCS#11 or TPM PIN entry. It is set by * functions like gnutls_pkcs11_set_pin_function(). * * The callback should provides the PIN code to unlock the token with * label @token_label, specified by the URL @token_url. * * The PIN code, as a NUL-terminated ASCII string, should be copied * into the @pin buffer (of maximum size @pin_max), and return 0 to * indicate success. Alternatively, the callback may return a * negative gnutls error code to indicate failure and cancel PIN entry * (in which case, the contents of the @pin parameter are ignored). * * When a PIN is required, the callback will be invoked repeatedly * (and indefinitely) until either the returned PIN code is correct, * the callback returns failure, or the token refuses login (e.g. when * the token is locked due to too many incorrect PINs!). For the * first such invocation, the @attempt counter will have value zero; * it will increase by one for each subsequent attempt. * * Returns: %GNUTLS_E_SUCCESS (0) on success or a negative error code on error. * * Since: 2.12.0 **/ typedef int (*gnutls_pin_callback_t) (void *userdata, int attempt, const char *token_url, const char *token_label, unsigned int flags, char *pin, size_t pin_max); void gnutls_certificate_set_pin_function(gnutls_certificate_credentials_t, gnutls_pin_callback_t fn, void *userdata); /* Public string related functions */ typedef struct gnutls_buffer_st *gnutls_buffer_t; int gnutls_buffer_append_data(gnutls_buffer_t, const void *data, size_t data_size); #define GNUTLS_UTF8_IGNORE_ERRS 1 int gnutls_utf8_password_normalize(const unsigned char *password, unsigned password_len, gnutls_datum_t *out, unsigned flags); /* Public extensions related functions */ typedef void *gnutls_ext_priv_data_t; void gnutls_ext_set_data(gnutls_session_t session, unsigned type, gnutls_ext_priv_data_t); int gnutls_ext_get_data(gnutls_session_t session, unsigned type, gnutls_ext_priv_data_t *); unsigned gnutls_ext_get_current_msg(gnutls_session_t session); typedef int (*gnutls_ext_recv_func) (gnutls_session_t session, const unsigned char *data, size_t len); typedef int (*gnutls_ext_send_func) (gnutls_session_t session, gnutls_buffer_t extdata); typedef void (*gnutls_ext_deinit_data_func) (gnutls_ext_priv_data_t data); typedef int (*gnutls_ext_pack_func) (gnutls_ext_priv_data_t data, gnutls_buffer_t packed_data); typedef int (*gnutls_ext_unpack_func) (gnutls_buffer_t packed_data, gnutls_ext_priv_data_t *data); #define GNUTLS_EXT_RAW_FLAG_TLS_CLIENT_HELLO 1 #define GNUTLS_EXT_RAW_FLAG_DTLS_CLIENT_HELLO (1<<1) typedef int (*gnutls_ext_raw_process_func)(void *ctx, unsigned tls_id, const unsigned char *data, unsigned data_size); int gnutls_ext_raw_parse(void *ctx, gnutls_ext_raw_process_func cb, const gnutls_datum_t *data, unsigned int flags); /** * gnutls_ext_parse_type_t: * @GNUTLS_EXT_NONE: Never to be parsed * @GNUTLS_EXT_ANY: Any extension type (should not be used as it is used only internally). * @GNUTLS_EXT_VERSION_NEG: Extensions to be parsed first for TLS version negotiation. * @GNUTLS_EXT_MANDATORY: Parsed after @GNUTLS_EXT_VERSION_NEG and even when resuming. * @GNUTLS_EXT_APPLICATION: Parsed after @GNUTLS_EXT_MANDATORY * @GNUTLS_EXT_TLS: TLS-internal extensions, parsed after @GNUTLS_EXT_APPLICATION. * * Enumeration of different TLS extension parsing phases. The @gnutls_ext_parse_type_t * indicates the time/phase an extension is parsed during Client or Server hello parsing. * */ typedef enum { GNUTLS_EXT_ANY = 0, GNUTLS_EXT_APPLICATION = 1, GNUTLS_EXT_TLS = 2, GNUTLS_EXT_MANDATORY = 3, GNUTLS_EXT_NONE = 4, GNUTLS_EXT_VERSION_NEG = 5 } gnutls_ext_parse_type_t; /** * gnutls_ext_flags_t: * @GNUTLS_EXT_FLAG_OVERRIDE_INTERNAL: If specified the extension registered will override the internal; this does not work with extensions existing prior to 3.6.0. * @GNUTLS_EXT_FLAG_CLIENT_HELLO: This extension can be present in a client hello * @GNUTLS_EXT_FLAG_TLS12_SERVER_HELLO: This extension can be present in a TLS1.2 or earlier server hello * @GNUTLS_EXT_FLAG_TLS13_SERVER_HELLO: This extension can be present in a TLS1.3 server hello * @GNUTLS_EXT_FLAG_EE: This extension can be present in encrypted extensions message * @GNUTLS_EXT_FLAG_HRR: This extension can be present in hello retry request message * @GNUTLS_EXT_FLAG_IGNORE_CLIENT_REQUEST: When flag is present, this extension will be send even if the client didn't advertise it. An extension of this type is the Cookie TLS1.3 extension. * @GNUTLS_EXT_FLAG_DTLS: This extension can be present under DTLS; otherwise ignored. * @GNUTLS_EXT_FLAG_TLS: This extension can be present under TLS; otherwise ignored. * * Enumeration of different TLS extension registration flags. */ typedef enum { GNUTLS_EXT_FLAG_OVERRIDE_INTERNAL = 1, GNUTLS_EXT_FLAG_CLIENT_HELLO = (1<<1), GNUTLS_EXT_FLAG_TLS12_SERVER_HELLO = (1<<2), GNUTLS_EXT_FLAG_TLS13_SERVER_HELLO = (1<<3), GNUTLS_EXT_FLAG_EE = (1<<4), /* ENCRYPTED */ GNUTLS_EXT_FLAG_HRR = (1<<5), GNUTLS_EXT_FLAG_IGNORE_CLIENT_REQUEST = (1<<6), GNUTLS_EXT_FLAG_TLS = (1<<7), GNUTLS_EXT_FLAG_DTLS = (1<<8) } gnutls_ext_flags_t; /* Register a custom tls extension */ int gnutls_ext_register(const char *name, int type, gnutls_ext_parse_type_t parse_point, gnutls_ext_recv_func recv_func, gnutls_ext_send_func send_func, gnutls_ext_deinit_data_func deinit_func, gnutls_ext_pack_func pack_func, gnutls_ext_unpack_func unpack_func); int gnutls_session_ext_register(gnutls_session_t, const char *name, int type, gnutls_ext_parse_type_t parse_point, gnutls_ext_recv_func recv_func, gnutls_ext_send_func send_func, gnutls_ext_deinit_data_func deinit_func, gnutls_ext_pack_func pack_func, gnutls_ext_unpack_func unpack_func, unsigned flags); const char *gnutls_ext_get_name(unsigned int ext); const char *gnutls_ext_get_name2(gnutls_session_t session, unsigned int tls_id, gnutls_ext_parse_type_t parse_point); /* Public supplemental data related functions */ typedef int (*gnutls_supp_recv_func) (gnutls_session_t session, const unsigned char * data, size_t data_size); typedef int (*gnutls_supp_send_func) (gnutls_session_t session, gnutls_buffer_t buf); int gnutls_supplemental_register(const char *name, gnutls_supplemental_data_format_type_t type, gnutls_supp_recv_func supp_recv_func, gnutls_supp_send_func supp_send_func); int gnutls_session_supplemental_register(gnutls_session_t session, const char *name, gnutls_supplemental_data_format_type_t type, gnutls_supp_recv_func supp_recv_func, gnutls_supp_send_func supp_send_func, unsigned int flags); void gnutls_supplemental_recv(gnutls_session_t session, unsigned do_recv_supplemental); void gnutls_supplemental_send(gnutls_session_t session, unsigned do_send_supplemental); /* Anti-replay related functions */ typedef struct gnutls_anti_replay_st *gnutls_anti_replay_t; int gnutls_anti_replay_init(gnutls_anti_replay_t *anti_replay); void gnutls_anti_replay_deinit(gnutls_anti_replay_t anti_replay); void gnutls_anti_replay_set_window(gnutls_anti_replay_t anti_replay, unsigned int window); void gnutls_anti_replay_enable(gnutls_session_t session, gnutls_anti_replay_t anti_replay); typedef int (*gnutls_db_add_func) (void *, time_t exp_time, const gnutls_datum_t *key, const gnutls_datum_t *data); void gnutls_anti_replay_set_add_function(gnutls_anti_replay_t, gnutls_db_add_func add_func); void gnutls_anti_replay_set_ptr(gnutls_anti_replay_t, void *ptr); /** * gnutls_record_encryption_level_t: * @GNUTLS_ENCRYPTION_LEVEL_INITIAL: initial level that doesn't involve any * encryption * @GNUTLS_ENCRYPTION_LEVEL_EARLY: early traffic secret is installed * @GNUTLS_ENCRYPTION_LEVEL_HANDSHAKE: handshake traffic secret is installed * @GNUTLS_ENCRYPTION_LEVEL_APPLICATION: application traffic secret is installed * * Enumeration of different levels of record encryption currently in place. * This is used by gnutls_handshake_set_read_function() and * gnutls_handshake_write(). * * Since: 3.7.0 */ typedef enum { GNUTLS_ENCRYPTION_LEVEL_INITIAL, GNUTLS_ENCRYPTION_LEVEL_EARLY, GNUTLS_ENCRYPTION_LEVEL_HANDSHAKE, GNUTLS_ENCRYPTION_LEVEL_APPLICATION } gnutls_record_encryption_level_t; /** * gnutls_handshake_read_func: * @session: the current session * @htype: the type of the handshake message (#gnutls_handshake_description_t) * @level: #gnutls_record_encryption_level_t * @data: the (const) data that was being sent * @data_size: the size of data * * Function prototype for handshake intercepting hooks. It is set using * gnutls_handshake_set_read_function(). * * Returns: Non zero on error. * Since: 3.7.0 */ typedef int (*gnutls_handshake_read_func) (gnutls_session_t session, gnutls_record_encryption_level_t level, gnutls_handshake_description_t htype, const void *data, size_t data_size); void gnutls_handshake_set_read_function(gnutls_session_t session, gnutls_handshake_read_func func); int gnutls_handshake_write(gnutls_session_t session, gnutls_record_encryption_level_t level, const void *data, size_t data_size); /** * gnutls_handshake_secret_func: * @session: the current session * @level: the encryption level * @secret_read: the secret used for reading, can be %NULL if not set * @secret_write: the secret used for writing, can be %NULL if not set * @secret_size: the size of the secrets * * Function prototype for secret hooks. It is set using * gnutls_handshake_set_secret_function(). * * Returns: Non zero on error. * Since: 3.7.0 */ typedef int (*gnutls_handshake_secret_func) (gnutls_session_t session, gnutls_record_encryption_level_t level, const void *secret_read, const void *secret_write, size_t secret_size); void gnutls_handshake_set_secret_function(gnutls_session_t session, gnutls_handshake_secret_func func); /** * gnutls_alert_read_func: * @session: the current session * @level: #gnutls_record_encryption_level_t * @alert_level: the level of the alert * @alert_desc: the alert description * * Function prototype for alert intercepting hooks. It is set using * gnutls_alert_set_read_function(). * * Returns: Non zero on error. * Since: 3.7.0 */ typedef int (*gnutls_alert_read_func) (gnutls_session_t session, gnutls_record_encryption_level_t level, gnutls_alert_level_t alert_level, gnutls_alert_description_t alert_desc); void gnutls_alert_set_read_function(gnutls_session_t session, gnutls_alert_read_func func); /* FIPS140-2 related functions */ unsigned gnutls_fips140_mode_enabled(void); /** * gnutls_fips_mode_t: * @GNUTLS_FIPS140_DISABLED: The FIPS140-2 mode is disabled. * @GNUTLS_FIPS140_STRICT: The default mode; all forbidden operations will cause an * operation failure via error code. * @GNUTLS_FIPS140_LAX: The library still uses the FIPS140-2 relevant algorithms but all * forbidden by FIPS140-2 operations are allowed; this is useful when the * application is aware of the followed security policy, and needs * to utilize disallowed operations for other reasons (e.g., compatibility). * @GNUTLS_FIPS140_LOG: Similarly to %GNUTLS_FIPS140_LAX, it allows forbidden operations; any use of them results * to a message to the audit callback functions. * @GNUTLS_FIPS140_SELFTESTS: A transient state during library initialization. That state * cannot be set or seen by applications. * * Enumeration of different operational modes under FIPS140-2. */ typedef enum gnutls_fips_mode_t { GNUTLS_FIPS140_DISABLED = 0, GNUTLS_FIPS140_STRICT = 1, GNUTLS_FIPS140_SELFTESTS = 2, GNUTLS_FIPS140_LAX = 3, GNUTLS_FIPS140_LOG = 4 } gnutls_fips_mode_t; #define GNUTLS_FIPS140_SET_MODE_THREAD 1 void gnutls_fips140_set_mode(gnutls_fips_mode_t mode, unsigned flags); #define GNUTLS_FIPS140_SET_LAX_MODE() do { \ if (gnutls_fips140_mode_enabled()) \ gnutls_fips140_set_mode(GNUTLS_FIPS140_LAX, GNUTLS_FIPS140_SET_MODE_THREAD); \ } while(0) #define GNUTLS_FIPS140_SET_STRICT_MODE() do { \ if (gnutls_fips140_mode_enabled()) \ gnutls_fips140_set_mode(GNUTLS_FIPS140_STRICT, GNUTLS_FIPS140_SET_MODE_THREAD); \ } while(0) typedef struct gnutls_fips140_context_st *gnutls_fips140_context_t; int gnutls_fips140_context_init(gnutls_fips140_context_t *context); void gnutls_fips140_context_deinit(gnutls_fips140_context_t context); /** * gnutls_fips140_operation_state_t: * @GNUTLS_FIPS140_OP_INITIAL: no previous operation has done * @GNUTLS_FIPS140_OP_APPROVED: the previous operation was FIPS approved * @GNUTLS_FIPS140_OP_NOT_APPROVED: the previous operation was not FIPS approved * @GNUTLS_FIPS140_OP_ERROR: the previous operation caused an error regardless of FIPS * * The FIPS operation state set by the preceding operation. * * There are state transition rules among the enum values: * - When the context is attached to a thread, it will be set to reset * to the %GNUTLS_FIPS140_OP_INITIAL state * - From the %GNUTLS_FIPS140_OP_INITIAL state, the context can * transition to either %GNUTLS_FIPS140_OP_APPROVED, * %GNUTLS_FIPS140_OP_NOT_APPROVED, or %GNUTLS_FIPS140_OP_ERROR * - From the %GNUTLS_FIPS140_OP_APPROVED state, the context can * transition to %GNUTLS_FIPS140_OP_NOT_APPROVED * - All other transitions are prohibited. * * Since: 3.7.3 */ typedef enum { GNUTLS_FIPS140_OP_INITIAL, GNUTLS_FIPS140_OP_APPROVED, GNUTLS_FIPS140_OP_NOT_APPROVED, GNUTLS_FIPS140_OP_ERROR } gnutls_fips140_operation_state_t; gnutls_fips140_operation_state_t gnutls_fips140_get_operation_state(gnutls_fips140_context_t context); int gnutls_fips140_push_context(gnutls_fips140_context_t context); int gnutls_fips140_pop_context(void); int gnutls_fips140_run_self_tests(void); /* Gnutls error codes. The mapping to a TLS alert is also shown in * comments. */ #define GNUTLS_E_SUCCESS 0 #define GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM -3 #define GNUTLS_E_UNKNOWN_CIPHER_TYPE -6 #define GNUTLS_E_LARGE_PACKET -7 #define GNUTLS_E_UNSUPPORTED_VERSION_PACKET -8 /* GNUTLS_A_PROTOCOL_VERSION */ #define GNUTLS_E_TLS_PACKET_DECODING_ERROR GNUTLS_E_UNEXPECTED_PACKET_LENGTH #define GNUTLS_E_UNEXPECTED_PACKET_LENGTH -9 /* GNUTLS_A_DECODE_ERROR */ #define GNUTLS_E_INVALID_SESSION -10 #define GNUTLS_E_FATAL_ALERT_RECEIVED -12 #define GNUTLS_E_UNEXPECTED_PACKET -15 /* GNUTLS_A_UNEXPECTED_MESSAGE */ #define GNUTLS_E_WARNING_ALERT_RECEIVED -16 #define GNUTLS_E_ERROR_IN_FINISHED_PACKET -18 #define GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET -19 #define GNUTLS_E_UNKNOWN_CIPHER_SUITE -21 /* GNUTLS_A_HANDSHAKE_FAILURE */ #define GNUTLS_E_UNWANTED_ALGORITHM -22 #define GNUTLS_E_MPI_SCAN_FAILED -23 #define GNUTLS_E_DECRYPTION_FAILED -24 /* GNUTLS_A_DECRYPTION_FAILED, GNUTLS_A_BAD_RECORD_MAC */ #define GNUTLS_E_MEMORY_ERROR -25 #define GNUTLS_E_DECOMPRESSION_FAILED -26 /* GNUTLS_A_DECOMPRESSION_FAILURE */ #define GNUTLS_E_COMPRESSION_FAILED -27 #define GNUTLS_E_AGAIN -28 #define GNUTLS_E_EXPIRED -29 #define GNUTLS_E_DB_ERROR -30 #define GNUTLS_E_SRP_PWD_ERROR GNUTLS_E_KEYFILE_ERROR #define GNUTLS_E_KEYFILE_ERROR -31 #define GNUTLS_E_INSUFFICIENT_CREDENTIALS -32 #define GNUTLS_E_INSUFICIENT_CREDENTIALS GNUTLS_E_INSUFFICIENT_CREDENTIALS /* for backwards compatibility only */ #define GNUTLS_E_INSUFFICIENT_CRED GNUTLS_E_INSUFFICIENT_CREDENTIALS #define GNUTLS_E_INSUFICIENT_CRED GNUTLS_E_INSUFFICIENT_CREDENTIALS /* for backwards compatibility only */ #define GNUTLS_E_HASH_FAILED -33 #define GNUTLS_E_BASE64_DECODING_ERROR -34 #define GNUTLS_E_MPI_PRINT_FAILED -35 #define GNUTLS_E_REHANDSHAKE -37 /* GNUTLS_A_NO_RENEGOTIATION */ #define GNUTLS_E_GOT_APPLICATION_DATA -38 #define GNUTLS_E_RECORD_LIMIT_REACHED -39 #define GNUTLS_E_ENCRYPTION_FAILED -40 #define GNUTLS_E_PK_ENCRYPTION_FAILED -44 #define GNUTLS_E_PK_DECRYPTION_FAILED -45 #define GNUTLS_E_PK_SIGN_FAILED -46 #define GNUTLS_E_X509_UNSUPPORTED_CRITICAL_EXTENSION -47 #define GNUTLS_E_KEY_USAGE_VIOLATION -48 #define GNUTLS_E_NO_CERTIFICATE_FOUND -49 /* GNUTLS_A_BAD_CERTIFICATE */ #define GNUTLS_E_INVALID_REQUEST -50 #define GNUTLS_E_SHORT_MEMORY_BUFFER -51 #define GNUTLS_E_INTERRUPTED -52 #define GNUTLS_E_PUSH_ERROR -53 #define GNUTLS_E_PULL_ERROR -54 #define GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER -55 /* GNUTLS_A_ILLEGAL_PARAMETER */ #define GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE -56 #define GNUTLS_E_PKCS1_WRONG_PAD -57 #define GNUTLS_E_RECEIVED_ILLEGAL_EXTENSION -58 #define GNUTLS_E_INTERNAL_ERROR -59 #define GNUTLS_E_DH_PRIME_UNACCEPTABLE -63 #define GNUTLS_E_FILE_ERROR -64 #define GNUTLS_E_TOO_MANY_EMPTY_PACKETS -78 #define GNUTLS_E_UNKNOWN_PK_ALGORITHM -80 #define GNUTLS_E_TOO_MANY_HANDSHAKE_PACKETS -81 #define GNUTLS_E_RECEIVED_DISALLOWED_NAME -82 /* GNUTLS_A_ILLEGAL_PARAMETER */ #define GNUTLS_E_CERTIFICATE_REQUIRED -112 /* GNUTLS_A_CERTIFICATE_REQUIRED */ /* returned if you need to generate temporary RSA * parameters. These are needed for export cipher suites. */ #define GNUTLS_E_NO_TEMPORARY_RSA_PARAMS -84 #define GNUTLS_E_NO_COMPRESSION_ALGORITHMS -86 #define GNUTLS_E_NO_CIPHER_SUITES -87 #define GNUTLS_E_OPENPGP_GETKEY_FAILED -88 #define GNUTLS_E_PK_SIG_VERIFY_FAILED -89 #define GNUTLS_E_ILLEGAL_SRP_USERNAME -90 #define GNUTLS_E_SRP_PWD_PARSING_ERROR GNUTLS_E_KEYFILE_PARSING_ERROR #define GNUTLS_E_KEYFILE_PARSING_ERROR -91 #define GNUTLS_E_NO_TEMPORARY_DH_PARAMS -93 /* For certificate and key stuff */ #define GNUTLS_E_ASN1_ELEMENT_NOT_FOUND -67 #define GNUTLS_E_ASN1_IDENTIFIER_NOT_FOUND -68 #define GNUTLS_E_ASN1_DER_ERROR -69 #define GNUTLS_E_ASN1_VALUE_NOT_FOUND -70 #define GNUTLS_E_ASN1_GENERIC_ERROR -71 #define GNUTLS_E_ASN1_VALUE_NOT_VALID -72 #define GNUTLS_E_ASN1_TAG_ERROR -73 #define GNUTLS_E_ASN1_TAG_IMPLICIT -74 #define GNUTLS_E_ASN1_TYPE_ANY_ERROR -75 #define GNUTLS_E_ASN1_SYNTAX_ERROR -76 #define GNUTLS_E_ASN1_DER_OVERFLOW -77 #define GNUTLS_E_OPENPGP_UID_REVOKED -79 #define GNUTLS_E_CERTIFICATE_ERROR -43 #define GNUTLS_E_X509_CERTIFICATE_ERROR GNUTLS_E_CERTIFICATE_ERROR #define GNUTLS_E_CERTIFICATE_KEY_MISMATCH -60 #define GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE -61 /* GNUTLS_A_UNSUPPORTED_CERTIFICATE */ #define GNUTLS_E_X509_UNKNOWN_SAN -62 #define GNUTLS_E_OPENPGP_FINGERPRINT_UNSUPPORTED -94 #define GNUTLS_E_X509_UNSUPPORTED_ATTRIBUTE -95 #define GNUTLS_E_UNKNOWN_HASH_ALGORITHM -96 #define GNUTLS_E_UNKNOWN_PKCS_CONTENT_TYPE -97 #define GNUTLS_E_UNKNOWN_PKCS_BAG_TYPE -98 #define GNUTLS_E_INVALID_PASSWORD -99 #define GNUTLS_E_MAC_VERIFY_FAILED -100 /* for PKCS #12 MAC */ #define GNUTLS_E_CONSTRAINT_ERROR -101 #define GNUTLS_E_WARNING_IA_IPHF_RECEIVED -102 #define GNUTLS_E_WARNING_IA_FPHF_RECEIVED -103 #define GNUTLS_E_IA_VERIFY_FAILED -104 #define GNUTLS_E_UNKNOWN_ALGORITHM -105 #define GNUTLS_E_UNSUPPORTED_SIGNATURE_ALGORITHM -106 #define GNUTLS_E_SAFE_RENEGOTIATION_FAILED -107 #define GNUTLS_E_UNSAFE_RENEGOTIATION_DENIED -108 #define GNUTLS_E_UNKNOWN_SRP_USERNAME -109 #define GNUTLS_E_PREMATURE_TERMINATION -110 #define GNUTLS_E_MALFORMED_CIDR -111 #define GNUTLS_E_BASE64_ENCODING_ERROR -201 #define GNUTLS_E_INCOMPATIBLE_GCRYPT_LIBRARY -202 /* obsolete */ #define GNUTLS_E_INCOMPATIBLE_CRYPTO_LIBRARY -202 #define GNUTLS_E_INCOMPATIBLE_LIBTASN1_LIBRARY -203 #define GNUTLS_E_OPENPGP_KEYRING_ERROR -204 #define GNUTLS_E_X509_UNSUPPORTED_OID -205 #define GNUTLS_E_RANDOM_FAILED -206 #define GNUTLS_E_BASE64_UNEXPECTED_HEADER_ERROR -207 #define GNUTLS_E_OPENPGP_SUBKEY_ERROR -208 #define GNUTLS_E_CRYPTO_ALREADY_REGISTERED GNUTLS_E_ALREADY_REGISTERED #define GNUTLS_E_ALREADY_REGISTERED -209 #define GNUTLS_E_HANDSHAKE_TOO_LARGE -210 #define GNUTLS_E_CRYPTODEV_IOCTL_ERROR -211 #define GNUTLS_E_CRYPTODEV_DEVICE_ERROR -212 #define GNUTLS_E_CHANNEL_BINDING_NOT_AVAILABLE -213 #define GNUTLS_E_BAD_COOKIE -214 #define GNUTLS_E_OPENPGP_PREFERRED_KEY_ERROR -215 #define GNUTLS_E_INCOMPAT_DSA_KEY_WITH_TLS_PROTOCOL -216 #define GNUTLS_E_INSUFFICIENT_SECURITY -217 #define GNUTLS_E_HEARTBEAT_PONG_RECEIVED -292 #define GNUTLS_E_HEARTBEAT_PING_RECEIVED -293 #define GNUTLS_E_UNRECOGNIZED_NAME -294 /* PKCS11 related */ #define GNUTLS_E_PKCS11_ERROR -300 #define GNUTLS_E_PKCS11_LOAD_ERROR -301 #define GNUTLS_E_PARSING_ERROR -302 #define GNUTLS_E_PKCS11_PIN_ERROR -303 #define GNUTLS_E_PKCS11_SLOT_ERROR -305 #define GNUTLS_E_LOCKING_ERROR -306 #define GNUTLS_E_PKCS11_ATTRIBUTE_ERROR -307 #define GNUTLS_E_PKCS11_DEVICE_ERROR -308 #define GNUTLS_E_PKCS11_DATA_ERROR -309 #define GNUTLS_E_PKCS11_UNSUPPORTED_FEATURE_ERROR -310 #define GNUTLS_E_PKCS11_KEY_ERROR -311 #define GNUTLS_E_PKCS11_PIN_EXPIRED -312 #define GNUTLS_E_PKCS11_PIN_LOCKED -313 #define GNUTLS_E_PKCS11_SESSION_ERROR -314 #define GNUTLS_E_PKCS11_SIGNATURE_ERROR -315 #define GNUTLS_E_PKCS11_TOKEN_ERROR -316 #define GNUTLS_E_PKCS11_USER_ERROR -317 #define GNUTLS_E_CRYPTO_INIT_FAILED -318 #define GNUTLS_E_TIMEDOUT -319 #define GNUTLS_E_USER_ERROR -320 #define GNUTLS_E_ECC_NO_SUPPORTED_CURVES -321 #define GNUTLS_E_ECC_UNSUPPORTED_CURVE -322 #define GNUTLS_E_PKCS11_REQUESTED_OBJECT_NOT_AVAILBLE -323 #define GNUTLS_E_CERTIFICATE_LIST_UNSORTED -324 #define GNUTLS_E_ILLEGAL_PARAMETER -325 /* GNUTLS_A_ILLEGAL_PARAMETER */ #define GNUTLS_E_NO_PRIORITIES_WERE_SET -326 #define GNUTLS_E_X509_UNSUPPORTED_EXTENSION -327 #define GNUTLS_E_SESSION_EOF -328 #define GNUTLS_E_TPM_ERROR -329 #define GNUTLS_E_TPM_KEY_PASSWORD_ERROR -330 #define GNUTLS_E_TPM_SRK_PASSWORD_ERROR -331 #define GNUTLS_E_TPM_SESSION_ERROR -332 #define GNUTLS_E_TPM_KEY_NOT_FOUND -333 #define GNUTLS_E_TPM_UNINITIALIZED -334 #define GNUTLS_E_TPM_NO_LIB -335 #define GNUTLS_E_NO_CERTIFICATE_STATUS -340 #define GNUTLS_E_OCSP_RESPONSE_ERROR -341 #define GNUTLS_E_RANDOM_DEVICE_ERROR -342 #define GNUTLS_E_AUTH_ERROR -343 #define GNUTLS_E_NO_APPLICATION_PROTOCOL -344 #define GNUTLS_E_SOCKETS_INIT_ERROR -345 #define GNUTLS_E_KEY_IMPORT_FAILED -346 #define GNUTLS_E_INAPPROPRIATE_FALLBACK -347 /*GNUTLS_A_INAPPROPRIATE_FALLBACK*/ #define GNUTLS_E_CERTIFICATE_VERIFICATION_ERROR -348 #define GNUTLS_E_PRIVKEY_VERIFICATION_ERROR -349 #define GNUTLS_E_UNEXPECTED_EXTENSIONS_LENGTH -350 /*GNUTLS_A_DECODE_ERROR*/ #define GNUTLS_E_ASN1_EMBEDDED_NULL_IN_STRING -351 #define GNUTLS_E_SELF_TEST_ERROR -400 #define GNUTLS_E_NO_SELF_TEST -401 #define GNUTLS_E_LIB_IN_ERROR_STATE -402 #define GNUTLS_E_PK_GENERATION_ERROR -403 #define GNUTLS_E_IDNA_ERROR -404 #define GNUTLS_E_NEED_FALLBACK -405 #define GNUTLS_E_SESSION_USER_ID_CHANGED -406 #define GNUTLS_E_HANDSHAKE_DURING_FALSE_START -407 #define GNUTLS_E_UNAVAILABLE_DURING_HANDSHAKE -408 #define GNUTLS_E_PK_INVALID_PUBKEY -409 #define GNUTLS_E_PK_INVALID_PRIVKEY -410 #define GNUTLS_E_NOT_YET_ACTIVATED -411 #define GNUTLS_E_INVALID_UTF8_STRING -412 #define GNUTLS_E_NO_EMBEDDED_DATA -413 #define GNUTLS_E_INVALID_UTF8_EMAIL -414 #define GNUTLS_E_INVALID_PASSWORD_STRING -415 #define GNUTLS_E_CERTIFICATE_TIME_ERROR -416 #define GNUTLS_E_RECORD_OVERFLOW -417 /* GNUTLS_A_RECORD_OVERFLOW */ #define GNUTLS_E_ASN1_TIME_ERROR -418 #define GNUTLS_E_INCOMPATIBLE_SIG_WITH_KEY -419 #define GNUTLS_E_PK_INVALID_PUBKEY_PARAMS -420 #define GNUTLS_E_PK_NO_VALIDATION_PARAMS -421 #define GNUTLS_E_OCSP_MISMATCH_WITH_CERTS -422 #define GNUTLS_E_NO_COMMON_KEY_SHARE -423 #define GNUTLS_E_REAUTH_REQUEST -424 #define GNUTLS_E_TOO_MANY_MATCHES -425 #define GNUTLS_E_CRL_VERIFICATION_ERROR -426 #define GNUTLS_E_MISSING_EXTENSION -427 #define GNUTLS_E_DB_ENTRY_EXISTS -428 #define GNUTLS_E_EARLY_DATA_REJECTED -429 #define GNUTLS_E_X509_DUPLICATE_EXTENSION -430 #define GNUTLS_E_UNIMPLEMENTED_FEATURE -1250 /* Internal errors of the library; will never be returned * to a calling application */ #define GNUTLS_E_INT_RET_0 -1251 #define GNUTLS_E_INT_CHECK_AGAIN -1252 #define GNUTLS_E_APPLICATION_ERROR_MAX -65000 #define GNUTLS_E_APPLICATION_ERROR_MIN -65500 /* *INDENT-OFF* */ #ifdef __cplusplus } #endif /* *INDENT-ON* */ #include <gnutls/compat.h> #endif /* GNUTLS_GNUTLS_H */
143,664
C++
.h
3,216
41.79291
386
0.750777
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,437
abstract.h
Nevcairiel_LAVFilters/thirdparty/32/include/gnutls/abstract.h
/* * Copyright (C) 2010-2012 Free Software Foundation, Inc. * Copyright (C) 2015-2017 Red Hat, Inc. * * Author: Nikos Mavrogiannopoulos * * This file is part of GnuTLS. * * The GnuTLS is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <https://www.gnu.org/licenses/> * */ #ifndef GNUTLS_ABSTRACT_H #define GNUTLS_ABSTRACT_H #include <gnutls/gnutls.h> #include <gnutls/x509.h> #include <gnutls/pkcs11.h> #include <gnutls/openpgp.h> #include <gnutls/tpm.h> /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { #endif /* *INDENT-ON* */ /* Public key operations */ #define GNUTLS_PUBKEY_VERIFY_FLAG_TLS_RSA GNUTLS_PUBKEY_VERIFY_FLAG_TLS1_RSA /** * gnutls_pubkey_flags: * @GNUTLS_PUBKEY_DISABLE_CALLBACKS: The following flag disables call to PIN callbacks. Only * relevant to TPM keys. * @GNUTLS_PUBKEY_GET_OPENPGP_FINGERPRINT: request an OPENPGP fingerprint instead of the default. * * Enumeration of different certificate import flags. */ typedef enum gnutls_pubkey_flags { GNUTLS_PUBKEY_DISABLE_CALLBACKS = 1 << 2, GNUTLS_PUBKEY_GET_OPENPGP_FINGERPRINT = 1 << 3 } gnutls_pubkey_flags_t; /** * gnutls_abstract_export_flags: * @GNUTLS_EXPORT_FLAG_NO_LZ: do not prepend a leading zero to exported values * * Enumeration of different certificate import flags. */ typedef enum gnutls_abstract_export_flags { GNUTLS_EXPORT_FLAG_NO_LZ = 1 } gnutls_abstract_export_flags_t; #define GNUTLS_PUBKEY_VERIFY_FLAG_TLS1_RSA GNUTLS_VERIFY_USE_TLS1_RSA typedef int (*gnutls_privkey_sign_func) (gnutls_privkey_t key, void *userdata, const gnutls_datum_t *raw_data, gnutls_datum_t * signature); typedef int (*gnutls_privkey_decrypt_func) (gnutls_privkey_t key, void *userdata, const gnutls_datum_t *ciphertext, gnutls_datum_t * plaintext); typedef int (*gnutls_privkey_decrypt_func2) (gnutls_privkey_t key, void *userdata, const gnutls_datum_t *ciphertext, unsigned char * plaintext, size_t plaintext_size); /* to be called to sign pre-hashed data. The input will be * the output of the hash (such as SHA256) corresponding to * the signature algorithm. The algorithm GNUTLS_SIGN_RSA_RAW * will be provided when RSA PKCS#1 DigestInfo structure is provided * as data (when this is called from a TLS 1.0 or 1.1 session). */ typedef int (*gnutls_privkey_sign_hash_func) (gnutls_privkey_t key, gnutls_sign_algorithm_t algo, void *userdata, unsigned int flags, const gnutls_datum_t *hash, gnutls_datum_t * signature); /* to be called to sign data. The input data will be * the data to be signed (and hashed), with the provided * signature algorithm. This function is used for algorithms * like ed25519 which cannot take pre-hashed data as input. */ typedef int (*gnutls_privkey_sign_data_func) (gnutls_privkey_t key, gnutls_sign_algorithm_t algo, void *userdata, unsigned int flags, const gnutls_datum_t *data, gnutls_datum_t * signature); typedef void (*gnutls_privkey_deinit_func) (gnutls_privkey_t key, void *userdata); #define GNUTLS_SIGN_ALGO_TO_FLAGS(sig) (unsigned int)((sig)<<20) #define GNUTLS_FLAGS_TO_SIGN_ALGO(flags) (unsigned int)((flags)>>20) /* Should return the public key algorithm (gnutls_pk_algorithm_t) */ #define GNUTLS_PRIVKEY_INFO_PK_ALGO 1 /* Should return the preferred signature algorithm (gnutls_sign_algorithm_t) or 0. */ #define GNUTLS_PRIVKEY_INFO_SIGN_ALGO (1<<1) /* Should return true (1) or false (0) if the provided sign algorithm * (obtained with GNUTLS_FLAGS_TO_SIGN_ALGO) is supported. */ #define GNUTLS_PRIVKEY_INFO_HAVE_SIGN_ALGO (1<<2) /* Should return the number of bits of the public key algorithm (required for RSA-PSS) * It is the value that should be returned by gnutls_pubkey_get_pk_algorithm() */ #define GNUTLS_PRIVKEY_INFO_PK_ALGO_BITS (1<<3) /* returns information on the public key associated with userdata */ typedef int (*gnutls_privkey_info_func) (gnutls_privkey_t key, unsigned int flags, void *userdata); int gnutls_pubkey_init(gnutls_pubkey_t * key); void gnutls_pubkey_deinit(gnutls_pubkey_t key); int gnutls_pubkey_verify_params(gnutls_pubkey_t key); void gnutls_pubkey_set_pin_function(gnutls_pubkey_t key, gnutls_pin_callback_t fn, void *userdata); int gnutls_pubkey_get_pk_algorithm(gnutls_pubkey_t key, unsigned int *bits); int gnutls_pubkey_set_spki(gnutls_pubkey_t key, const gnutls_x509_spki_t spki, unsigned int flags); int gnutls_pubkey_get_spki(gnutls_pubkey_t key, const gnutls_x509_spki_t spki, unsigned int flags); int gnutls_pubkey_import_x509(gnutls_pubkey_t key, gnutls_x509_crt_t crt, unsigned int flags); int gnutls_pubkey_import_x509_crq(gnutls_pubkey_t key, gnutls_x509_crq_t crq, unsigned int flags); int gnutls_pubkey_import_pkcs11(gnutls_pubkey_t key, gnutls_pkcs11_obj_t obj, unsigned int flags); int gnutls_pubkey_import_openpgp(gnutls_pubkey_t key, gnutls_openpgp_crt_t crt, unsigned int flags); int gnutls_pubkey_import_openpgp_raw(gnutls_pubkey_t pkey, const gnutls_datum_t * data, gnutls_openpgp_crt_fmt_t format, const gnutls_openpgp_keyid_t keyid, unsigned int flags); int gnutls_pubkey_import_x509_raw(gnutls_pubkey_t pkey, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, unsigned int flags); int gnutls_pubkey_import_privkey(gnutls_pubkey_t key, gnutls_privkey_t pkey, unsigned int usage, unsigned int flags); int gnutls_pubkey_import_tpm_url(gnutls_pubkey_t pkey, const char *url, const char *srk_password, unsigned int flags); int gnutls_pubkey_import_url(gnutls_pubkey_t key, const char *url, unsigned int flags); int gnutls_pubkey_import_tpm_raw(gnutls_pubkey_t pkey, const gnutls_datum_t * fdata, gnutls_tpmkey_fmt_t format, const char *srk_password, unsigned int flags); int gnutls_pubkey_get_preferred_hash_algorithm(gnutls_pubkey_t key, gnutls_digest_algorithm_t * hash, unsigned int *mand); #define gnutls_pubkey_get_pk_rsa_raw gnutls_pubkey_export_rsa_raw int gnutls_pubkey_export_rsa_raw(gnutls_pubkey_t key, gnutls_datum_t * m, gnutls_datum_t * e); int gnutls_pubkey_export_rsa_raw2(gnutls_pubkey_t key, gnutls_datum_t * m, gnutls_datum_t * e, unsigned flags); #define gnutls_pubkey_get_pk_dsa_raw gnutls_pubkey_export_dsa_raw int gnutls_pubkey_export_dsa_raw(gnutls_pubkey_t key, gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * g, gnutls_datum_t * y); int gnutls_pubkey_export_dsa_raw2(gnutls_pubkey_t key, gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * g, gnutls_datum_t * y, unsigned flags); int gnutls_pubkey_export_ecc_raw2(gnutls_pubkey_t key, gnutls_ecc_curve_t * curve, gnutls_datum_t * x, gnutls_datum_t * y, unsigned flags); int gnutls_pubkey_export_gost_raw2(gnutls_pubkey_t key, gnutls_ecc_curve_t * curve, gnutls_digest_algorithm_t * digest, gnutls_gost_paramset_t * paramset, gnutls_datum_t * x, gnutls_datum_t * y, unsigned int flags); #define gnutls_pubkey_get_pk_ecc_raw gnutls_pubkey_export_ecc_raw int gnutls_pubkey_export_ecc_raw(gnutls_pubkey_t key, gnutls_ecc_curve_t * curve, gnutls_datum_t * x, gnutls_datum_t * y); #define gnutls_pubkey_get_pk_ecc_x962 gnutls_pubkey_export_ecc_x962 int gnutls_pubkey_export_ecc_x962(gnutls_pubkey_t key, gnutls_datum_t * parameters, gnutls_datum_t * ecpoint); int gnutls_pubkey_export(gnutls_pubkey_t key, gnutls_x509_crt_fmt_t format, void *output_data, size_t * output_data_size); int gnutls_pubkey_export2(gnutls_pubkey_t key, gnutls_x509_crt_fmt_t format, gnutls_datum_t * out); int gnutls_pubkey_get_key_id(gnutls_pubkey_t key, unsigned int flags, unsigned char *output_data, size_t * output_data_size); int gnutls_pubkey_get_openpgp_key_id(gnutls_pubkey_t key, unsigned int flags, unsigned char *output_data, size_t * output_data_size, unsigned int *subkey); int gnutls_pubkey_get_key_usage(gnutls_pubkey_t key, unsigned int *usage); int gnutls_pubkey_set_key_usage(gnutls_pubkey_t key, unsigned int usage); int gnutls_pubkey_import(gnutls_pubkey_t key, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format); #define gnutls_pubkey_import_pkcs11_url(key, url, flags) gnutls_pubkey_import_url(key, url, flags) int gnutls_pubkey_import_dsa_raw(gnutls_pubkey_t key, const gnutls_datum_t * p, const gnutls_datum_t * q, const gnutls_datum_t * g, const gnutls_datum_t * y); int gnutls_pubkey_import_rsa_raw(gnutls_pubkey_t key, const gnutls_datum_t * m, const gnutls_datum_t * e); int gnutls_pubkey_import_ecc_x962(gnutls_pubkey_t key, const gnutls_datum_t * parameters, const gnutls_datum_t * ecpoint); int gnutls_pubkey_import_ecc_raw(gnutls_pubkey_t key, gnutls_ecc_curve_t curve, const gnutls_datum_t * x, const gnutls_datum_t * y); int gnutls_pubkey_import_gost_raw(gnutls_pubkey_t key, gnutls_ecc_curve_t curve, gnutls_digest_algorithm_t digest, gnutls_gost_paramset_t paramset, const gnutls_datum_t * x, const gnutls_datum_t * y); int gnutls_pubkey_encrypt_data(gnutls_pubkey_t key, unsigned int flags, const gnutls_datum_t * plaintext, gnutls_datum_t * ciphertext); int gnutls_x509_crt_set_pubkey(gnutls_x509_crt_t crt, gnutls_pubkey_t key); int gnutls_x509_crq_set_pubkey(gnutls_x509_crq_t crq, gnutls_pubkey_t key); int gnutls_pubkey_verify_hash2(gnutls_pubkey_t key, gnutls_sign_algorithm_t algo, unsigned int flags, const gnutls_datum_t * hash, const gnutls_datum_t * signature); int gnutls_pubkey_verify_data2(gnutls_pubkey_t pubkey, gnutls_sign_algorithm_t algo, unsigned int flags, const gnutls_datum_t * data, const gnutls_datum_t * signature); /* Private key operations */ int gnutls_privkey_init(gnutls_privkey_t * key); void gnutls_privkey_deinit(gnutls_privkey_t key); /* macros to allow specifying a subgroup and group size in gnutls_privkey_generate() * and gnutls_x509_privkey_generate() */ #define GNUTLS_SUBGROUP_TO_BITS(group, subgroup) (unsigned int)((subgroup<<16)|(group)) #define GNUTLS_BITS_TO_SUBGROUP(bits) ((bits >> 16) & 0xFFFF) #define GNUTLS_BITS_TO_GROUP(bits) (bits & 0xFFFF) #define GNUTLS_BITS_HAVE_SUBGROUP(bits) ((bits) & 0xFFFF0000) int gnutls_privkey_generate (gnutls_privkey_t key, gnutls_pk_algorithm_t algo, unsigned int bits, unsigned int flags); int gnutls_privkey_generate2(gnutls_privkey_t pkey, gnutls_pk_algorithm_t algo, unsigned int bits, unsigned int flags, const gnutls_keygen_data_st *data, unsigned data_size); int gnutls_privkey_set_spki(gnutls_privkey_t key, const gnutls_x509_spki_t spki, unsigned int flags); int gnutls_privkey_get_spki(gnutls_privkey_t key, const gnutls_x509_spki_t spki, unsigned int flags); int gnutls_privkey_verify_seed(gnutls_privkey_t key, gnutls_digest_algorithm_t, const void *seed, size_t seed_size); int gnutls_privkey_get_seed(gnutls_privkey_t key, gnutls_digest_algorithm_t*, void *seed, size_t *seed_size); int gnutls_privkey_verify_params(gnutls_privkey_t key); void gnutls_privkey_set_flags(gnutls_privkey_t key, unsigned int flags); void gnutls_privkey_set_pin_function (gnutls_privkey_t key, gnutls_pin_callback_t fn, void *userdata); int gnutls_privkey_get_pk_algorithm(gnutls_privkey_t key, unsigned int *bits); gnutls_privkey_type_t gnutls_privkey_get_type(gnutls_privkey_t key); int gnutls_privkey_status(gnutls_privkey_t key); /** * gnutls_privkey_flags: * @GNUTLS_PRIVKEY_SIGN_FLAG_TLS1_RSA: Make an RSA signature on the hashed data as in the TLS protocol. * @GNUTLS_PRIVKEY_SIGN_FLAG_RSA_PSS: Make an RSA signature on the hashed data with the PSS padding. * @GNUTLS_PRIVKEY_FLAG_REPRODUCIBLE: Make a signature on the hashed data with reproducible parameters. * For RSA-PSS, that means to use empty salt instead of random value. To * verify a signature created using this flag, the corresponding SPKI needs * to be set on the public key. Use gnutls_pubkey_set_spki() for that. * For ECDSA/DSA, it uses the deterministic construction of random parameter * according to RFC 6979. Note that this only supports the NIST curves and DSA * subgroup bits up to 512. * @GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE: When importing a private key, automatically * release it when the structure it was imported is released. * @GNUTLS_PRIVKEY_IMPORT_COPY: Copy required values during import. * @GNUTLS_PRIVKEY_DISABLE_CALLBACKS: The following flag disables call to PIN callbacks etc. * Only relevant to TPM keys. * @GNUTLS_PRIVKEY_FLAG_PROVABLE: When generating a key involving prime numbers, use provable primes; a seed may be required. * @GNUTLS_PRIVKEY_FLAG_CA: The generated private key is going to be used as a CA (relevant for RSA-PSS keys). * @GNUTLS_PRIVKEY_FLAG_EXPORT_COMPAT: Keys generated or imported as provable require an extended format which cannot be read by previous versions * of gnutls or other applications. By setting this flag the key will be exported in a backwards compatible way, * even if the information about the seed used will be lost. * @GNUTLS_PRIVKEY_FLAG_RSA_PSS_FIXED_SALT_LENGTH: When making an RSA-PSS * signature, use the salt whose length is equal to the digest length, as * mandated in RFC 8446 4.2.3. * * Enumeration of different certificate import flags. */ typedef enum gnutls_privkey_flags { GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE = 1, GNUTLS_PRIVKEY_IMPORT_COPY = 1 << 1, GNUTLS_PRIVKEY_DISABLE_CALLBACKS = 1 << 2, GNUTLS_PRIVKEY_SIGN_FLAG_TLS1_RSA = 1 << 4, GNUTLS_PRIVKEY_FLAG_PROVABLE = 1 << 5, GNUTLS_PRIVKEY_FLAG_EXPORT_COMPAT = 1 << 6, GNUTLS_PRIVKEY_SIGN_FLAG_RSA_PSS = 1 << 7, GNUTLS_PRIVKEY_FLAG_REPRODUCIBLE = 1 << 8, GNUTLS_PRIVKEY_FLAG_CA = 1 << 9, GNUTLS_PRIVKEY_FLAG_RSA_PSS_FIXED_SALT_LENGTH = 1 << 10 } gnutls_privkey_flags_t; int gnutls_privkey_import_pkcs11(gnutls_privkey_t pkey, gnutls_pkcs11_privkey_t key, unsigned int flags); int gnutls_privkey_import_x509(gnutls_privkey_t pkey, gnutls_x509_privkey_t key, unsigned int flags); int gnutls_privkey_import_openpgp(gnutls_privkey_t pkey, gnutls_openpgp_privkey_t key, unsigned int flags); int gnutls_privkey_export_x509(gnutls_privkey_t pkey, gnutls_x509_privkey_t * key); int gnutls_privkey_export_openpgp(gnutls_privkey_t pkey, gnutls_openpgp_privkey_t * key); int gnutls_privkey_export_pkcs11(gnutls_privkey_t pkey, gnutls_pkcs11_privkey_t *key); int gnutls_privkey_import_openpgp_raw(gnutls_privkey_t pkey, const gnutls_datum_t * data, gnutls_openpgp_crt_fmt_t format, const gnutls_openpgp_keyid_t keyid, const char *password); int gnutls_privkey_import_x509_raw(gnutls_privkey_t pkey, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, const char *password, unsigned int flags); int gnutls_privkey_import_tpm_raw(gnutls_privkey_t pkey, const gnutls_datum_t * fdata, gnutls_tpmkey_fmt_t format, const char *srk_password, const char *key_password, unsigned int flags); int gnutls_privkey_import_tpm_url(gnutls_privkey_t pkey, const char *url, const char *srk_password, const char *key_password, unsigned int flags); int gnutls_privkey_import_url(gnutls_privkey_t key, const char *url, unsigned int flags); #if 0 /* for documentation purposes */ int gnutls_privkey_import_pkcs11_url(gnutls_privkey_t key, const char *url); #endif #define gnutls_privkey_import_pkcs11_url(key, url) gnutls_privkey_import_url(key, url, 0) int gnutls_privkey_import_ext(gnutls_privkey_t pkey, gnutls_pk_algorithm_t pk, void *userdata, gnutls_privkey_sign_func sign_func, gnutls_privkey_decrypt_func decrypt_func, unsigned int flags); int gnutls_privkey_import_ext2(gnutls_privkey_t pkey, gnutls_pk_algorithm_t pk, void *userdata, gnutls_privkey_sign_func sign_func, gnutls_privkey_decrypt_func decrypt_func, gnutls_privkey_deinit_func deinit_func, unsigned int flags); int gnutls_privkey_import_ext3(gnutls_privkey_t pkey, void *userdata, gnutls_privkey_sign_func sign_func, gnutls_privkey_decrypt_func decrypt_func, gnutls_privkey_deinit_func deinit_func, gnutls_privkey_info_func info_func, unsigned int flags); int gnutls_privkey_import_ext4(gnutls_privkey_t pkey, void *userdata, gnutls_privkey_sign_data_func sign_data_func, gnutls_privkey_sign_hash_func sign_hash_func, gnutls_privkey_decrypt_func decrypt_func, gnutls_privkey_deinit_func deinit_func, gnutls_privkey_info_func info_func, unsigned int flags); int gnutls_privkey_import_dsa_raw(gnutls_privkey_t key, const gnutls_datum_t * p, const gnutls_datum_t * q, const gnutls_datum_t * g, const gnutls_datum_t * y, const gnutls_datum_t * x); int gnutls_privkey_import_rsa_raw(gnutls_privkey_t key, const gnutls_datum_t * m, const gnutls_datum_t * e, const gnutls_datum_t * d, const gnutls_datum_t * p, const gnutls_datum_t * q, const gnutls_datum_t * u, const gnutls_datum_t * e1, const gnutls_datum_t * e2); int gnutls_privkey_import_ecc_raw(gnutls_privkey_t key, gnutls_ecc_curve_t curve, const gnutls_datum_t * x, const gnutls_datum_t * y, const gnutls_datum_t * k); int gnutls_privkey_import_gost_raw(gnutls_privkey_t key, gnutls_ecc_curve_t curve, gnutls_digest_algorithm_t digest, gnutls_gost_paramset_t paramset, const gnutls_datum_t * x, const gnutls_datum_t * y, const gnutls_datum_t * k); int gnutls_privkey_sign_data(gnutls_privkey_t signer, gnutls_digest_algorithm_t hash, unsigned int flags, const gnutls_datum_t * data, gnutls_datum_t * signature); int gnutls_privkey_sign_data2(gnutls_privkey_t signer, gnutls_sign_algorithm_t algo, unsigned int flags, const gnutls_datum_t * data, gnutls_datum_t * signature); #define gnutls_privkey_sign_raw_data(key, flags, data, sig) \ gnutls_privkey_sign_hash ( key, 0, GNUTLS_PRIVKEY_SIGN_FLAG_TLS1_RSA, data, sig) int gnutls_privkey_sign_hash(gnutls_privkey_t signer, gnutls_digest_algorithm_t hash_algo, unsigned int flags, const gnutls_datum_t * hash_data, gnutls_datum_t * signature); int gnutls_privkey_sign_hash2(gnutls_privkey_t signer, gnutls_sign_algorithm_t algo, unsigned int flags, const gnutls_datum_t * hash_data, gnutls_datum_t * signature); int gnutls_privkey_decrypt_data(gnutls_privkey_t key, unsigned int flags, const gnutls_datum_t * ciphertext, gnutls_datum_t * plaintext); int gnutls_privkey_decrypt_data2(gnutls_privkey_t key, unsigned int flags, const gnutls_datum_t * ciphertext, unsigned char * plaintext, size_t plaintext_size); int gnutls_privkey_export_rsa_raw(gnutls_privkey_t key, gnutls_datum_t * m, gnutls_datum_t * e, gnutls_datum_t * d, gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * u, gnutls_datum_t * e1, gnutls_datum_t * e2); int gnutls_privkey_export_rsa_raw2(gnutls_privkey_t key, gnutls_datum_t * m, gnutls_datum_t * e, gnutls_datum_t * d, gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * u, gnutls_datum_t * e1, gnutls_datum_t * e2, unsigned flags); int gnutls_privkey_export_dsa_raw(gnutls_privkey_t key, gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * g, gnutls_datum_t * y, gnutls_datum_t * x); int gnutls_privkey_export_dsa_raw2(gnutls_privkey_t key, gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * g, gnutls_datum_t * y, gnutls_datum_t * x, unsigned flags); int gnutls_privkey_export_ecc_raw(gnutls_privkey_t key, gnutls_ecc_curve_t * curve, gnutls_datum_t * x, gnutls_datum_t * y, gnutls_datum_t * k); int gnutls_privkey_export_ecc_raw2(gnutls_privkey_t key, gnutls_ecc_curve_t * curve, gnutls_datum_t * x, gnutls_datum_t * y, gnutls_datum_t * k, unsigned flags); int gnutls_privkey_export_gost_raw2(gnutls_privkey_t key, gnutls_ecc_curve_t * curve, gnutls_digest_algorithm_t * digest, gnutls_gost_paramset_t * paramset, gnutls_datum_t * x, gnutls_datum_t * y, gnutls_datum_t * k, unsigned flags); int gnutls_x509_crt_privkey_sign(gnutls_x509_crt_t crt, gnutls_x509_crt_t issuer, gnutls_privkey_t issuer_key, gnutls_digest_algorithm_t dig, unsigned int flags); int gnutls_x509_crl_privkey_sign(gnutls_x509_crl_t crl, gnutls_x509_crt_t issuer, gnutls_privkey_t issuer_key, gnutls_digest_algorithm_t dig, unsigned int flags); int gnutls_x509_crq_privkey_sign(gnutls_x509_crq_t crq, gnutls_privkey_t key, gnutls_digest_algorithm_t dig, unsigned int flags); /** * gnutls_pcert_st: * @pubkey: public key of parsed certificate. * @cert: certificate itself of parsed certificate * @type: type of certificate, a #gnutls_certificate_type_t type. * * A parsed certificate. */ typedef struct gnutls_pcert_st { gnutls_pubkey_t pubkey; gnutls_datum_t cert; gnutls_certificate_type_t type; } gnutls_pcert_st; /* This flag is unused/ignored */ #define GNUTLS_PCERT_NO_CERT 1 int gnutls_pcert_import_x509(gnutls_pcert_st * pcert, gnutls_x509_crt_t crt, unsigned int flags); int gnutls_pcert_import_x509_list(gnutls_pcert_st * pcert, gnutls_x509_crt_t *crt, unsigned *ncrt, unsigned int flags); int gnutls_pcert_export_x509(gnutls_pcert_st * pcert, gnutls_x509_crt_t * crt); int gnutls_pcert_list_import_x509_raw(gnutls_pcert_st * pcerts, unsigned int *pcert_max, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, unsigned int flags); int gnutls_pcert_list_import_x509_file(gnutls_pcert_st *pcert_list, unsigned *pcert_list_size, const char *file, gnutls_x509_crt_fmt_t format, gnutls_pin_callback_t pin_fn, void *pin_fn_userdata, unsigned int flags); int gnutls_pcert_import_x509_raw(gnutls_pcert_st * pcert, const gnutls_datum_t * cert, gnutls_x509_crt_fmt_t format, unsigned int flags); int gnutls_pcert_import_openpgp_raw(gnutls_pcert_st * pcert, const gnutls_datum_t * cert, gnutls_openpgp_crt_fmt_t format, gnutls_openpgp_keyid_t keyid, unsigned int flags); int gnutls_pcert_import_openpgp(gnutls_pcert_st * pcert, gnutls_openpgp_crt_t crt, unsigned int flags); int gnutls_pcert_export_openpgp(gnutls_pcert_st * pcert, gnutls_openpgp_crt_t * crt); void gnutls_pcert_deinit(gnutls_pcert_st * pcert); int gnutls_pcert_import_rawpk(gnutls_pcert_st* pcert, gnutls_pubkey_t key, unsigned int flags); int gnutls_pcert_import_rawpk_raw(gnutls_pcert_st* pcert, const gnutls_datum_t* rawpubkey, gnutls_x509_crt_fmt_t format, unsigned int key_usage, unsigned int flags); /* For certificate credentials */ /* This is the same as gnutls_certificate_retrieve_function() * but retrieves a gnutls_pcert_st which requires much less processing * within the library. */ typedef int gnutls_certificate_retrieve_function2(gnutls_session_t, const gnutls_datum_t *req_ca_rdn, int nreqs, const gnutls_pk_algorithm_t *pk_algos, int pk_algos_length, gnutls_pcert_st**, unsigned int *pcert_length, gnutls_privkey_t *privkey); void gnutls_certificate_set_retrieve_function2 (gnutls_certificate_credentials_t cred, gnutls_certificate_retrieve_function2 *func); struct gnutls_cert_retr_st { unsigned version; /* set to 1 */ gnutls_certificate_credentials_t cred; const gnutls_datum_t *req_ca_rdn; unsigned nreqs; const gnutls_pk_algorithm_t *pk_algos; unsigned pk_algos_length; /* other fields may be added if version is > 1 */ unsigned char padding[64]; }; /* When the callback sets this value, gnutls will deinitialize the given * values after use */ #define GNUTLS_CERT_RETR_DEINIT_ALL 1 typedef int gnutls_certificate_retrieve_function3( gnutls_session_t, const struct gnutls_cert_retr_st *info, gnutls_pcert_st **certs, unsigned int *certs_length, gnutls_ocsp_data_st **ocsp, unsigned int *ocsp_length, gnutls_privkey_t *privkey, unsigned int *flags); void gnutls_certificate_set_retrieve_function3 (gnutls_certificate_credentials_t cred, gnutls_certificate_retrieve_function3 *func); int gnutls_certificate_set_key(gnutls_certificate_credentials_t res, const char **names, int names_size, gnutls_pcert_st * pcert_list, int pcert_list_size, gnutls_privkey_t key); int gnutls_pubkey_print(gnutls_pubkey_t pubkey, gnutls_certificate_print_formats_t format, gnutls_datum_t * out); /* *INDENT-OFF* */ #ifdef __cplusplus } #endif /* *INDENT-ON* */ #endif /* GNUTLS_ABSTRACT_H */
26,814
C++
.h
652
35.476994
146
0.696297
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,438
pkcs7.h
Nevcairiel_LAVFilters/thirdparty/32/include/gnutls/pkcs7.h
/* * Copyright (C) 2003-2012 Free Software Foundation, Inc. * Copyright (C) 2015 Red Hat, Inc. * * Author: Nikos Mavrogiannopoulos * * This file is part of GnuTLS. * * The GnuTLS is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <https://www.gnu.org/licenses/> * */ /* This file contains the types and prototypes for the X.509 * certificate and CRL handling functions. */ #ifndef GNUTLS_PKCS7_H #define GNUTLS_PKCS7_H #include <gnutls/gnutls.h> #include <gnutls/x509.h> /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { #endif /* *INDENT-ON* */ /* PKCS7 structures handling */ struct gnutls_pkcs7_int; typedef struct gnutls_pkcs7_int *gnutls_pkcs7_t; int gnutls_pkcs7_init(gnutls_pkcs7_t * pkcs7); void gnutls_pkcs7_deinit(gnutls_pkcs7_t pkcs7); int gnutls_pkcs7_import(gnutls_pkcs7_t pkcs7, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format); int gnutls_pkcs7_export(gnutls_pkcs7_t pkcs7, gnutls_x509_crt_fmt_t format, void *output_data, size_t * output_data_size); int gnutls_pkcs7_export2(gnutls_pkcs7_t pkcs7, gnutls_x509_crt_fmt_t format, gnutls_datum_t * out); int gnutls_pkcs7_get_signature_count(gnutls_pkcs7_t pkcs7); #define GNUTLS_PKCS7_EDATA_GET_RAW (1<<24) int gnutls_pkcs7_get_embedded_data(gnutls_pkcs7_t pkcs7, unsigned flags, gnutls_datum_t *data); const char * gnutls_pkcs7_get_embedded_data_oid(gnutls_pkcs7_t pkcs7); int gnutls_pkcs7_get_crt_count(gnutls_pkcs7_t pkcs7); int gnutls_pkcs7_get_crt_raw(gnutls_pkcs7_t pkcs7, unsigned indx, void *certificate, size_t * certificate_size); int gnutls_pkcs7_set_crt_raw(gnutls_pkcs7_t pkcs7, const gnutls_datum_t * crt); int gnutls_pkcs7_set_crt(gnutls_pkcs7_t pkcs7, gnutls_x509_crt_t crt); int gnutls_pkcs7_delete_crt(gnutls_pkcs7_t pkcs7, int indx); int gnutls_pkcs7_get_crl_raw(gnutls_pkcs7_t pkcs7, unsigned indx, void *crl, size_t * crl_size); int gnutls_pkcs7_get_crl_count(gnutls_pkcs7_t pkcs7); int gnutls_pkcs7_set_crl_raw(gnutls_pkcs7_t pkcs7, const gnutls_datum_t * crl); int gnutls_pkcs7_set_crl(gnutls_pkcs7_t pkcs7, gnutls_x509_crl_t crl); int gnutls_pkcs7_delete_crl(gnutls_pkcs7_t pkcs7, int indx); typedef struct gnutls_pkcs7_attrs_st *gnutls_pkcs7_attrs_t; typedef struct gnutls_pkcs7_signature_info_st { gnutls_sign_algorithm_t algo; gnutls_datum_t sig; gnutls_datum_t issuer_dn; gnutls_datum_t signer_serial; gnutls_datum_t issuer_keyid; time_t signing_time; gnutls_pkcs7_attrs_t signed_attrs; gnutls_pkcs7_attrs_t unsigned_attrs; char pad[64]; } gnutls_pkcs7_signature_info_st; void gnutls_pkcs7_signature_info_deinit(gnutls_pkcs7_signature_info_st *info); int gnutls_pkcs7_get_signature_info(gnutls_pkcs7_t pkcs7, unsigned idx, gnutls_pkcs7_signature_info_st *info); int gnutls_pkcs7_verify_direct(gnutls_pkcs7_t pkcs7, gnutls_x509_crt_t signer, unsigned idx, const gnutls_datum_t *data, unsigned flags); int gnutls_pkcs7_verify(gnutls_pkcs7_t pkcs7, gnutls_x509_trust_list_t tl, gnutls_typed_vdata_st * vdata, unsigned int vdata_size, unsigned idx, const gnutls_datum_t *data, unsigned flags); #define GNUTLS_PKCS7_ATTR_ENCODE_OCTET_STRING 1 int gnutls_pkcs7_add_attr(gnutls_pkcs7_attrs_t *list, const char *oid, gnutls_datum_t *data, unsigned flags); void gnutls_pkcs7_attrs_deinit(gnutls_pkcs7_attrs_t list); int gnutls_pkcs7_get_attr(gnutls_pkcs7_attrs_t list, unsigned idx, char **oid, gnutls_datum_t *data, unsigned flags); /** * gnutls_pkcs7_sign_flags: * @GNUTLS_PKCS7_EMBED_DATA: The signed data will be embedded in the structure. * @GNUTLS_PKCS7_INCLUDE_TIME: The signing time will be included in the structure. * @GNUTLS_PKCS7_INCLUDE_CERT: The signer's certificate will be included in the cert list. * @GNUTLS_PKCS7_WRITE_SPKI: Use the signer's key identifier instead of name. * * Enumeration of the different PKCS #7 signature flags. */ typedef enum gnutls_pkcs7_sign_flags { GNUTLS_PKCS7_EMBED_DATA = 1, GNUTLS_PKCS7_INCLUDE_TIME = (1<<1), GNUTLS_PKCS7_INCLUDE_CERT = (1<<2), GNUTLS_PKCS7_WRITE_SPKI = (1<<3) } gnutls_pkcs7_sign_flags; int gnutls_pkcs7_sign(gnutls_pkcs7_t pkcs7, gnutls_x509_crt_t signer, gnutls_privkey_t signer_key, const gnutls_datum_t *data, gnutls_pkcs7_attrs_t signed_attrs, gnutls_pkcs7_attrs_t unsigned_attrs, gnutls_digest_algorithm_t dig, unsigned flags); int gnutls_pkcs7_get_crt_raw2(gnutls_pkcs7_t pkcs7, unsigned indx, gnutls_datum_t *cert); int gnutls_pkcs7_get_crl_raw2(gnutls_pkcs7_t pkcs7, unsigned indx, gnutls_datum_t *crl); int gnutls_pkcs7_print(gnutls_pkcs7_t pkcs7, gnutls_certificate_print_formats_t format, gnutls_datum_t * out); int gnutls_pkcs7_print_signature_info(gnutls_pkcs7_signature_info_st * info, gnutls_certificate_print_formats_t format, gnutls_datum_t * out); /* *INDENT-OFF* */ #ifdef __cplusplus } #endif /* *INDENT-ON* */ #endif /* GNUTLS_PKCS7_H */
5,520
C++
.h
132
38.984848
117
0.747343
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
22,439
x509.h
Nevcairiel_LAVFilters/thirdparty/32/include/gnutls/x509.h
/* * Copyright (C) 2003-2016 Free Software Foundation, Inc. * Copyright (C) 2015-2016 Red Hat, Inc. * * Author: Nikos Mavrogiannopoulos * * This file is part of GnuTLS. * * The GnuTLS is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <https://www.gnu.org/licenses/> * */ /* This file contains the types and prototypes for the X.509 * certificate and CRL handling functions. */ #ifndef GNUTLS_X509_H #define GNUTLS_X509_H #include <gnutls/gnutls.h> /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { #endif /* *INDENT-ON* */ /* Some OIDs usually found in Distinguished names, or * in Subject Directory Attribute extensions. */ #define GNUTLS_OID_X520_COUNTRY_NAME "2.5.4.6" #define GNUTLS_OID_X520_ORGANIZATION_NAME "2.5.4.10" #define GNUTLS_OID_X520_ORGANIZATIONAL_UNIT_NAME "2.5.4.11" #define GNUTLS_OID_X520_COMMON_NAME "2.5.4.3" #define GNUTLS_OID_X520_LOCALITY_NAME "2.5.4.7" #define GNUTLS_OID_X520_STATE_OR_PROVINCE_NAME "2.5.4.8" #define GNUTLS_OID_X520_INITIALS "2.5.4.43" #define GNUTLS_OID_X520_GENERATION_QUALIFIER "2.5.4.44" #define GNUTLS_OID_X520_SURNAME "2.5.4.4" #define GNUTLS_OID_X520_GIVEN_NAME "2.5.4.42" #define GNUTLS_OID_X520_TITLE "2.5.4.12" #define GNUTLS_OID_X520_DN_QUALIFIER "2.5.4.46" #define GNUTLS_OID_X520_PSEUDONYM "2.5.4.65" #define GNUTLS_OID_X520_POSTALCODE "2.5.4.17" #define GNUTLS_OID_X520_NAME "2.5.4.41" #define GNUTLS_OID_LDAP_DC "0.9.2342.19200300.100.1.25" #define GNUTLS_OID_LDAP_UID "0.9.2342.19200300.100.1.1" /* The following should not be included in DN. */ #define GNUTLS_OID_PKCS9_EMAIL "1.2.840.113549.1.9.1" #define GNUTLS_OID_PKIX_DATE_OF_BIRTH "1.3.6.1.5.5.7.9.1" #define GNUTLS_OID_PKIX_PLACE_OF_BIRTH "1.3.6.1.5.5.7.9.2" #define GNUTLS_OID_PKIX_GENDER "1.3.6.1.5.5.7.9.3" #define GNUTLS_OID_PKIX_COUNTRY_OF_CITIZENSHIP "1.3.6.1.5.5.7.9.4" #define GNUTLS_OID_PKIX_COUNTRY_OF_RESIDENCE "1.3.6.1.5.5.7.9.5" /* Key purpose Object Identifiers. */ #define GNUTLS_KP_TLS_WWW_SERVER "1.3.6.1.5.5.7.3.1" #define GNUTLS_KP_TLS_WWW_CLIENT "1.3.6.1.5.5.7.3.2" #define GNUTLS_KP_CODE_SIGNING "1.3.6.1.5.5.7.3.3" #define GNUTLS_KP_MS_SMART_CARD_LOGON "1.3.6.1.4.1.311.20.2.2" #define GNUTLS_KP_EMAIL_PROTECTION "1.3.6.1.5.5.7.3.4" #define GNUTLS_KP_TIME_STAMPING "1.3.6.1.5.5.7.3.8" #define GNUTLS_KP_OCSP_SIGNING "1.3.6.1.5.5.7.3.9" #define GNUTLS_KP_IPSEC_IKE "1.3.6.1.5.5.7.3.17" #define GNUTLS_KP_ANY "2.5.29.37.0" #define GNUTLS_KP_FLAG_DISALLOW_ANY 1 #define GNUTLS_OID_AIA "1.3.6.1.5.5.7.1.1" #define GNUTLS_OID_AD_OCSP "1.3.6.1.5.5.7.48.1" #define GNUTLS_OID_AD_CAISSUERS "1.3.6.1.5.5.7.48.2" #define GNUTLS_FSAN_SET 0 #define GNUTLS_FSAN_APPEND 1 #define GNUTLS_FSAN_ENCODE_OCTET_STRING (1<<1) #define GNUTLS_FSAN_ENCODE_UTF8_STRING (1<<2) #define GNUTLS_X509EXT_OID_SUBJECT_KEY_ID "2.5.29.14" #define GNUTLS_X509EXT_OID_KEY_USAGE "2.5.29.15" #define GNUTLS_X509EXT_OID_PRIVATE_KEY_USAGE_PERIOD "2.5.29.16" #define GNUTLS_X509EXT_OID_SAN "2.5.29.17" #define GNUTLS_X509EXT_OID_IAN "2.5.29.18" #define GNUTLS_X509EXT_OID_BASIC_CONSTRAINTS "2.5.29.19" #define GNUTLS_X509EXT_OID_NAME_CONSTRAINTS "2.5.29.30" #define GNUTLS_X509EXT_OID_CRL_DIST_POINTS "2.5.29.31" #define GNUTLS_X509EXT_OID_CRT_POLICY "2.5.29.32" #define GNUTLS_X509EXT_OID_AUTHORITY_KEY_ID "2.5.29.35" #define GNUTLS_X509EXT_OID_EXTENDED_KEY_USAGE "2.5.29.37" #define GNUTLS_X509EXT_OID_INHIBIT_ANYPOLICY "2.5.29.52" #define GNUTLS_X509EXT_OID_AUTHORITY_INFO_ACCESS "1.3.6.1.5.5.7.1.1" #define GNUTLS_X509EXT_OID_PROXY_CRT_INFO "1.3.6.1.5.5.7.1.14" #define GNUTLS_X509EXT_OID_TLSFEATURES "1.3.6.1.5.5.7.1.24" #define GNUTLS_X509EXT_OID_CT_SCT_V1 "1.3.6.1.4.1.11129.2.4.2" #define GNUTLS_X509_OID_POLICY_ANY "2.5.29.54" /* Certificate handling functions. */ /** * gnutls_certificate_import_flags: * @GNUTLS_X509_CRT_LIST_IMPORT_FAIL_IF_EXCEED: Fail if the * certificates in the buffer are more than the space allocated for * certificates. The error code will be %GNUTLS_E_SHORT_MEMORY_BUFFER. * @GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTED: Fail if the certificates * in the buffer are not ordered starting from subject to issuer. * The error code will be %GNUTLS_E_CERTIFICATE_LIST_UNSORTED. * @GNUTLS_X509_CRT_LIST_SORT: Sort the certificate chain if unsorted. * * Enumeration of different certificate import flags. */ typedef enum gnutls_certificate_import_flags { GNUTLS_X509_CRT_LIST_IMPORT_FAIL_IF_EXCEED = 1, GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTED = 1<<1, GNUTLS_X509_CRT_LIST_SORT = 1<<2 } gnutls_certificate_import_flags; int gnutls_x509_crt_init(gnutls_x509_crt_t * cert); void gnutls_x509_crt_deinit(gnutls_x509_crt_t cert); /** * gnutls_certificate_import_flags: * @GNUTLS_X509_CRT_FLAG_IGNORE_SANITY: Ignore any sanity checks at the * import of the certificate; i.e., ignore checks such as version/field * matching and strict time field checks. Intended to be used for debugging. * * Enumeration of different certificate flags. */ typedef enum gnutls_x509_crt_flags { GNUTLS_X509_CRT_FLAG_IGNORE_SANITY = 1 } gnutls_x509_crt_flags; void gnutls_x509_crt_set_flags(gnutls_x509_crt_t cert, unsigned flags); unsigned gnutls_x509_crt_equals(gnutls_x509_crt_t cert1, gnutls_x509_crt_t cert2); unsigned gnutls_x509_crt_equals2(gnutls_x509_crt_t cert1, const gnutls_datum_t * der); int gnutls_x509_crt_import(gnutls_x509_crt_t cert, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format); int gnutls_x509_crt_list_import2(gnutls_x509_crt_t ** certs, unsigned int *size, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, unsigned int flags); int gnutls_x509_crt_list_import(gnutls_x509_crt_t * certs, unsigned int *cert_max, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, unsigned int flags); int gnutls_x509_crt_import_url(gnutls_x509_crt_t crt, const char *url, unsigned int flags /* GNUTLS_PKCS11_OBJ_FLAG_* */ ); int gnutls_x509_crt_list_import_url(gnutls_x509_crt_t **certs, unsigned int *size, const char *url, gnutls_pin_callback_t pin_fn, void *pin_fn_userdata, unsigned int flags); int gnutls_x509_crt_export(gnutls_x509_crt_t cert, gnutls_x509_crt_fmt_t format, void *output_data, size_t * output_data_size); int gnutls_x509_crt_export2(gnutls_x509_crt_t cert, gnutls_x509_crt_fmt_t format, gnutls_datum_t * out); int gnutls_x509_crt_get_private_key_usage_period(gnutls_x509_crt_t cert, time_t * activation, time_t * expiration, unsigned int *critical); int gnutls_x509_crt_get_issuer_dn(gnutls_x509_crt_t cert, char *buf, size_t * buf_size); int gnutls_x509_crt_get_issuer_dn2(gnutls_x509_crt_t cert, gnutls_datum_t * dn); int gnutls_x509_crt_get_issuer_dn3(gnutls_x509_crt_t cert, gnutls_datum_t * dn, unsigned flags); int gnutls_x509_crt_get_issuer_dn_oid(gnutls_x509_crt_t cert, unsigned indx, void *oid, size_t * oid_size); int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt_t cert, const char *oid, unsigned indx, unsigned int raw_flag, void *buf, size_t * buf_size); int gnutls_x509_crt_get_dn(gnutls_x509_crt_t cert, char *buf, size_t * buf_size); int gnutls_x509_crt_get_dn2(gnutls_x509_crt_t cert, gnutls_datum_t * dn); int gnutls_x509_crt_get_dn3(gnutls_x509_crt_t cert, gnutls_datum_t * dn, unsigned flags); int gnutls_x509_crt_get_dn_oid(gnutls_x509_crt_t cert, unsigned indx, void *oid, size_t * oid_size); int gnutls_x509_crt_get_dn_by_oid(gnutls_x509_crt_t cert, const char *oid, unsigned indx, unsigned int raw_flag, void *buf, size_t * buf_size); unsigned gnutls_x509_crt_check_hostname(gnutls_x509_crt_t cert, const char *hostname); unsigned gnutls_x509_crt_check_hostname2(gnutls_x509_crt_t cert, const char *hostname, unsigned int flags); unsigned gnutls_x509_crt_check_email(gnutls_x509_crt_t cert, const char *email, unsigned int flags); unsigned gnutls_x509_crt_check_ip(gnutls_x509_crt_t cert, const unsigned char *ip, unsigned int ip_size, unsigned int flags); int gnutls_x509_crt_get_signature_algorithm(gnutls_x509_crt_t cert); int gnutls_x509_crt_get_signature(gnutls_x509_crt_t cert, char *sig, size_t * sizeof_sig); int gnutls_x509_crt_get_version(gnutls_x509_crt_t cert); int gnutls_x509_crt_get_pk_oid(gnutls_x509_crt_t cert, char *oid, size_t *oid_size); int gnutls_x509_crt_get_signature_oid(gnutls_x509_crt_t cert, char *oid, size_t *oid_size); /** * gnutls_keyid_flags_t: * @GNUTLS_KEYID_USE_SHA1: Use SHA1 as the key ID algorithm (default). * @GNUTLS_KEYID_USE_SHA256: Use SHA256 as the key ID algorithm. * @GNUTLS_KEYID_USE_SHA512: Use SHA512 as the key ID algorithm. * @GNUTLS_KEYID_USE_BEST_KNOWN: Use the best known algorithm to calculate key ID. Using that option will make your program behavior depend on the version of gnutls linked with. That option has a cap of 64-bytes key IDs. * * Enumeration of different flags for the key ID functions. */ typedef enum { GNUTLS_KEYID_USE_SHA1 = 0, GNUTLS_KEYID_USE_SHA256 = (1<<0), GNUTLS_KEYID_USE_SHA512 = (1<<1), GNUTLS_KEYID_USE_BEST_KNOWN = (1<<30) } gnutls_keyid_flags_t; int gnutls_x509_crt_get_key_id(gnutls_x509_crt_t crt, unsigned int flags, unsigned char *output_data, size_t * output_data_size); int gnutls_x509_crt_set_private_key_usage_period(gnutls_x509_crt_t crt, time_t activation, time_t expiration); int gnutls_x509_crt_set_authority_key_id(gnutls_x509_crt_t cert, const void *id, size_t id_size); int gnutls_x509_crt_get_authority_key_id(gnutls_x509_crt_t cert, void *id, size_t * id_size, unsigned int *critical); int gnutls_x509_crt_get_authority_key_gn_serial(gnutls_x509_crt_t cert, unsigned int seq, void *alt, size_t * alt_size, unsigned int *alt_type, void *serial, size_t * serial_size, unsigned int *critical); int gnutls_x509_crt_get_subject_key_id(gnutls_x509_crt_t cert, void *ret, size_t * ret_size, unsigned int *critical); int gnutls_x509_crt_get_subject_unique_id(gnutls_x509_crt_t crt, char *buf, size_t * buf_size); int gnutls_x509_crt_get_issuer_unique_id(gnutls_x509_crt_t crt, char *buf, size_t * buf_size); void gnutls_x509_crt_set_pin_function(gnutls_x509_crt_t crt, gnutls_pin_callback_t fn, void *userdata); /** * gnutls_info_access_what_t: * @GNUTLS_IA_ACCESSMETHOD_OID: Get accessMethod OID. * @GNUTLS_IA_ACCESSLOCATION_GENERALNAME_TYPE: Get accessLocation name type. * @GNUTLS_IA_URI: Get accessLocation URI value. * @GNUTLS_IA_OCSP_URI: get accessLocation URI value for OCSP. * @GNUTLS_IA_CAISSUERS_URI: get accessLocation URI value for caIssuers. * * Enumeration of types for the @what parameter of * gnutls_x509_crt_get_authority_info_access(). */ typedef enum gnutls_info_access_what_t { GNUTLS_IA_ACCESSMETHOD_OID = 1, GNUTLS_IA_ACCESSLOCATION_GENERALNAME_TYPE = 2, /* use 100-108 for the generalName types, populate as needed */ GNUTLS_IA_URI = 106, /* quick-access variants that match both OID and name type. */ GNUTLS_IA_UNKNOWN = 10000, GNUTLS_IA_OCSP_URI = 10006, GNUTLS_IA_CAISSUERS_URI = 10106 } gnutls_info_access_what_t; int gnutls_x509_crt_get_authority_info_access(gnutls_x509_crt_t crt, unsigned int seq, int what, gnutls_datum_t * data, unsigned int *critical); typedef struct gnutls_name_constraints_st *gnutls_x509_name_constraints_t; unsigned gnutls_x509_name_constraints_check(gnutls_x509_name_constraints_t nc, gnutls_x509_subject_alt_name_t type, const gnutls_datum_t * name); unsigned gnutls_x509_name_constraints_check_crt(gnutls_x509_name_constraints_t nc, gnutls_x509_subject_alt_name_t type, gnutls_x509_crt_t crt); int gnutls_x509_name_constraints_init(gnutls_x509_name_constraints_t *nc); void gnutls_x509_name_constraints_deinit(gnutls_x509_name_constraints_t nc); #define GNUTLS_EXT_FLAG_APPEND 1 #define GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND GNUTLS_EXT_FLAG_APPEND int gnutls_x509_crt_get_name_constraints(gnutls_x509_crt_t crt, gnutls_x509_name_constraints_t nc, unsigned int flags, unsigned int *critical); int gnutls_x509_name_constraints_add_permitted(gnutls_x509_name_constraints_t nc, gnutls_x509_subject_alt_name_t type, const gnutls_datum_t * name); int gnutls_x509_name_constraints_add_excluded(gnutls_x509_name_constraints_t nc, gnutls_x509_subject_alt_name_t type, const gnutls_datum_t * name); int gnutls_x509_crt_set_name_constraints(gnutls_x509_crt_t crt, gnutls_x509_name_constraints_t nc, unsigned int critical); int gnutls_x509_name_constraints_get_permitted(gnutls_x509_name_constraints_t nc, unsigned idx, unsigned *type, gnutls_datum_t * name); int gnutls_x509_name_constraints_get_excluded(gnutls_x509_name_constraints_t nc, unsigned idx, unsigned *type, gnutls_datum_t * name); int gnutls_x509_cidr_to_rfc5280(const char *cidr, gnutls_datum_t *cidr_rfc5280); #define GNUTLS_CRL_REASON_SUPERSEEDED GNUTLS_CRL_REASON_SUPERSEDED, /** * gnutls_x509_crl_reason_flags_t: * @GNUTLS_CRL_REASON_PRIVILEGE_WITHDRAWN: The privileges were withdrawn from the owner. * @GNUTLS_CRL_REASON_CERTIFICATE_HOLD: The certificate is on hold. * @GNUTLS_CRL_REASON_CESSATION_OF_OPERATION: The end-entity is no longer operating. * @GNUTLS_CRL_REASON_SUPERSEDED: There is a newer certificate of the owner. * @GNUTLS_CRL_REASON_AFFILIATION_CHANGED: The end-entity affiliation has changed. * @GNUTLS_CRL_REASON_CA_COMPROMISE: The CA was compromised. * @GNUTLS_CRL_REASON_KEY_COMPROMISE: The certificate's key was compromised. * @GNUTLS_CRL_REASON_UNUSED: The key was never used. * @GNUTLS_CRL_REASON_AA_COMPROMISE: AA compromised. * * Enumeration of types for the CRL revocation reasons. */ typedef enum gnutls_x509_crl_reason_flags_t { GNUTLS_CRL_REASON_UNSPECIFIED = 0, GNUTLS_CRL_REASON_PRIVILEGE_WITHDRAWN = 1, GNUTLS_CRL_REASON_CERTIFICATE_HOLD = 2, GNUTLS_CRL_REASON_CESSATION_OF_OPERATION = 4, GNUTLS_CRL_REASON_SUPERSEDED = 8, GNUTLS_CRL_REASON_AFFILIATION_CHANGED = 16, GNUTLS_CRL_REASON_CA_COMPROMISE = 32, GNUTLS_CRL_REASON_KEY_COMPROMISE = 64, GNUTLS_CRL_REASON_UNUSED = 128, GNUTLS_CRL_REASON_AA_COMPROMISE = 32768 } gnutls_x509_crl_reason_flags_t; int gnutls_x509_crt_get_crl_dist_points(gnutls_x509_crt_t cert, unsigned int seq, void *ret, size_t * ret_size, unsigned int *reason_flags, unsigned int *critical); int gnutls_x509_crt_set_crl_dist_points2(gnutls_x509_crt_t crt, gnutls_x509_subject_alt_name_t type, const void *data, unsigned int data_size, unsigned int reason_flags); int gnutls_x509_crt_set_crl_dist_points(gnutls_x509_crt_t crt, gnutls_x509_subject_alt_name_t type, const void *data_string, unsigned int reason_flags); int gnutls_x509_crt_cpy_crl_dist_points(gnutls_x509_crt_t dst, gnutls_x509_crt_t src); int gnutls_x509_crl_sign(gnutls_x509_crl_t crl, gnutls_x509_crt_t issuer, gnutls_x509_privkey_t issuer_key); int gnutls_x509_crl_sign2(gnutls_x509_crl_t crl, gnutls_x509_crt_t issuer, gnutls_x509_privkey_t issuer_key, gnutls_digest_algorithm_t dig, unsigned int flags); time_t gnutls_x509_crt_get_activation_time(gnutls_x509_crt_t cert); /* This macro is deprecated and defunc; do not use */ #define GNUTLS_X509_NO_WELL_DEFINED_EXPIRATION ((time_t)4294197631) time_t gnutls_x509_crt_get_expiration_time(gnutls_x509_crt_t cert); int gnutls_x509_crt_get_serial(gnutls_x509_crt_t cert, void *result, size_t * result_size); typedef struct gnutls_x509_spki_st *gnutls_x509_spki_t; int gnutls_x509_spki_init(gnutls_x509_spki_t *spki); void gnutls_x509_spki_deinit(gnutls_x509_spki_t spki); int gnutls_x509_spki_get_rsa_pss_params(gnutls_x509_spki_t spki, gnutls_digest_algorithm_t *dig, unsigned int *salt_size); void gnutls_x509_spki_set_rsa_pss_params(gnutls_x509_spki_t spki, gnutls_digest_algorithm_t dig, unsigned int salt_size); int gnutls_x509_crt_get_pk_algorithm(gnutls_x509_crt_t cert, unsigned int *bits); int gnutls_x509_crt_set_spki(gnutls_x509_crt_t crt, const gnutls_x509_spki_t spki, unsigned int flags); int gnutls_x509_crt_get_spki(gnutls_x509_crt_t cert, gnutls_x509_spki_t spki, unsigned int flags); int gnutls_x509_crt_get_pk_rsa_raw(gnutls_x509_crt_t crt, gnutls_datum_t * m, gnutls_datum_t * e); int gnutls_x509_crt_get_pk_dsa_raw(gnutls_x509_crt_t crt, gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * g, gnutls_datum_t * y); int gnutls_x509_crt_get_pk_ecc_raw(gnutls_x509_crt_t crt, gnutls_ecc_curve_t * curve, gnutls_datum_t * x, gnutls_datum_t * y); int gnutls_x509_crt_get_pk_gost_raw(gnutls_x509_crt_t crt, gnutls_ecc_curve_t * curve, gnutls_digest_algorithm_t * digest, gnutls_gost_paramset_t *paramset, gnutls_datum_t * x, gnutls_datum_t * y); int gnutls_x509_crt_get_subject_alt_name(gnutls_x509_crt_t cert, unsigned int seq, void *san, size_t * san_size, unsigned int *critical); int gnutls_x509_crt_get_subject_alt_name2(gnutls_x509_crt_t cert, unsigned int seq, void *san, size_t * san_size, unsigned int *san_type, unsigned int *critical); int gnutls_x509_crt_get_subject_alt_othername_oid(gnutls_x509_crt_t cert, unsigned int seq, void *oid, size_t * oid_size); int gnutls_x509_crt_get_issuer_alt_name(gnutls_x509_crt_t cert, unsigned int seq, void *ian, size_t * ian_size, unsigned int *critical); int gnutls_x509_crt_get_issuer_alt_name2(gnutls_x509_crt_t cert, unsigned int seq, void *ian, size_t * ian_size, unsigned int *ian_type, unsigned int *critical); int gnutls_x509_crt_get_issuer_alt_othername_oid(gnutls_x509_crt_t cert, unsigned int seq, void *ret, size_t * ret_size); int gnutls_x509_crt_get_ca_status(gnutls_x509_crt_t cert, unsigned int *critical); int gnutls_x509_crt_get_basic_constraints(gnutls_x509_crt_t cert, unsigned int *critical, unsigned int *ca, int *pathlen); /* The key_usage flags are defined in gnutls.h. They are the * GNUTLS_KEY_* definitions. */ int gnutls_x509_crt_get_key_usage(gnutls_x509_crt_t cert, unsigned int *key_usage, unsigned int *critical); int gnutls_x509_crt_set_key_usage(gnutls_x509_crt_t crt, unsigned int usage); int gnutls_x509_crt_set_authority_info_access(gnutls_x509_crt_t crt, int what, gnutls_datum_t * data); int gnutls_x509_crt_get_inhibit_anypolicy(gnutls_x509_crt_t cert, unsigned int *skipcerts, unsigned int *critical); int gnutls_x509_crt_set_inhibit_anypolicy(gnutls_x509_crt_t crt, unsigned int skipcerts); int gnutls_x509_crt_get_proxy(gnutls_x509_crt_t cert, unsigned int *critical, int *pathlen, char **policyLanguage, char **policy, size_t * sizeof_policy); typedef struct gnutls_x509_tlsfeatures_st *gnutls_x509_tlsfeatures_t; int gnutls_x509_tlsfeatures_init(gnutls_x509_tlsfeatures_t *features); void gnutls_x509_tlsfeatures_deinit(gnutls_x509_tlsfeatures_t); int gnutls_x509_tlsfeatures_get(gnutls_x509_tlsfeatures_t f, unsigned idx, unsigned int *feature); int gnutls_x509_crt_set_tlsfeatures(gnutls_x509_crt_t crt, gnutls_x509_tlsfeatures_t features); int gnutls_x509_crt_get_tlsfeatures(gnutls_x509_crt_t cert, gnutls_x509_tlsfeatures_t features, unsigned int flags, unsigned int *critical); unsigned gnutls_x509_tlsfeatures_check_crt(gnutls_x509_tlsfeatures_t feat, gnutls_x509_crt_t crt); #define GNUTLS_MAX_QUALIFIERS 8 /** * gnutls_x509_qualifier_t: * @GNUTLS_X509_QUALIFIER_UNKNOWN: Unknown qualifier. * @GNUTLS_X509_QUALIFIER_URI: A URL * @GNUTLS_X509_QUALIFIER_NOICE: A text notice. * * Enumeration of types for the X.509 qualifiers, of the certificate policy extension. */ typedef enum gnutls_x509_qualifier_t { GNUTLS_X509_QUALIFIER_UNKNOWN = 0, GNUTLS_X509_QUALIFIER_URI, GNUTLS_X509_QUALIFIER_NOTICE } gnutls_x509_qualifier_t; typedef struct gnutls_x509_policy_st { char *oid; unsigned int qualifiers; struct { gnutls_x509_qualifier_t type; char *data; unsigned int size; } qualifier[GNUTLS_MAX_QUALIFIERS]; } gnutls_x509_policy_st; void gnutls_x509_policy_release(struct gnutls_x509_policy_st *policy); int gnutls_x509_crt_get_policy(gnutls_x509_crt_t crt, unsigned indx, struct gnutls_x509_policy_st *policy, unsigned int *critical); int gnutls_x509_crt_set_policy(gnutls_x509_crt_t crt, const struct gnutls_x509_policy_st *policy, unsigned int critical); int gnutls_x509_dn_oid_known(const char *oid); #define GNUTLS_X509_DN_OID_RETURN_OID 1 const char *gnutls_x509_dn_oid_name(const char *oid, unsigned int flags); /* Read extensions by OID. */ int gnutls_x509_crt_get_extension_oid(gnutls_x509_crt_t cert, unsigned indx, void *oid, size_t * oid_size); int gnutls_x509_crt_get_extension_by_oid(gnutls_x509_crt_t cert, const char *oid, unsigned indx, void *buf, size_t * buf_size, unsigned int *critical); int gnutls_x509_crq_get_signature_algorithm(gnutls_x509_crq_t crq); int gnutls_x509_crq_get_extension_by_oid2(gnutls_x509_crq_t crq, const char *oid, unsigned indx, gnutls_datum_t *output, unsigned int *critical); /* Read extensions by sequence number. */ int gnutls_x509_crt_get_extension_info(gnutls_x509_crt_t cert, unsigned indx, void *oid, size_t * oid_size, unsigned int *critical); int gnutls_x509_crt_get_extension_data(gnutls_x509_crt_t cert, unsigned indx, void *data, size_t * sizeof_data); int gnutls_x509_crt_get_extension_data2(gnutls_x509_crt_t cert, unsigned indx, gnutls_datum_t * data); int gnutls_x509_crt_set_extension_by_oid(gnutls_x509_crt_t crt, const char *oid, const void *buf, size_t sizeof_buf, unsigned int critical); /* X.509 Certificate writing. */ int gnutls_x509_crt_set_dn(gnutls_x509_crt_t crt, const char *dn, const char **err); int gnutls_x509_crt_set_dn_by_oid(gnutls_x509_crt_t crt, const char *oid, unsigned int raw_flag, const void *name, unsigned int sizeof_name); int gnutls_x509_crt_set_issuer_dn_by_oid(gnutls_x509_crt_t crt, const char *oid, unsigned int raw_flag, const void *name, unsigned int sizeof_name); int gnutls_x509_crt_set_issuer_dn(gnutls_x509_crt_t crt, const char *dn, const char **err); int gnutls_x509_crt_set_version(gnutls_x509_crt_t crt, unsigned int version); int gnutls_x509_crt_set_key(gnutls_x509_crt_t crt, gnutls_x509_privkey_t key); int gnutls_x509_crt_set_ca_status(gnutls_x509_crt_t crt, unsigned int ca); int gnutls_x509_crt_set_basic_constraints(gnutls_x509_crt_t crt, unsigned int ca, int pathLenConstraint); int gnutls_x509_crt_set_subject_unique_id(gnutls_x509_crt_t cert, const void *id, size_t id_size); int gnutls_x509_crt_set_issuer_unique_id(gnutls_x509_crt_t cert, const void *id, size_t id_size); int gnutls_x509_crt_set_subject_alternative_name(gnutls_x509_crt_t crt, gnutls_x509_subject_alt_name_t type, const char *data_string); int gnutls_x509_crt_set_subject_alt_name(gnutls_x509_crt_t crt, gnutls_x509_subject_alt_name_t type, const void *data, unsigned int data_size, unsigned int flags); int gnutls_x509_crt_set_subject_alt_othername(gnutls_x509_crt_t crt, const char *oid, const void *data, unsigned int data_size, unsigned int flags); int gnutls_x509_crt_set_issuer_alt_name(gnutls_x509_crt_t crt, gnutls_x509_subject_alt_name_t type, const void *data, unsigned int data_size, unsigned int flags); int gnutls_x509_crt_set_issuer_alt_othername(gnutls_x509_crt_t crt, const char *oid, const void *data, unsigned int data_size, unsigned int flags); int gnutls_x509_crt_sign(gnutls_x509_crt_t crt, gnutls_x509_crt_t issuer, gnutls_x509_privkey_t issuer_key); int gnutls_x509_crt_sign2(gnutls_x509_crt_t crt, gnutls_x509_crt_t issuer, gnutls_x509_privkey_t issuer_key, gnutls_digest_algorithm_t dig, unsigned int flags); int gnutls_x509_crt_set_activation_time(gnutls_x509_crt_t cert, time_t act_time); int gnutls_x509_crt_set_expiration_time(gnutls_x509_crt_t cert, time_t exp_time); int gnutls_x509_crt_set_serial(gnutls_x509_crt_t cert, const void *serial, size_t serial_size); int gnutls_x509_crt_set_subject_key_id(gnutls_x509_crt_t cert, const void *id, size_t id_size); int gnutls_x509_crt_set_proxy_dn(gnutls_x509_crt_t crt, gnutls_x509_crt_t eecrt, unsigned int raw_flag, const void *name, unsigned int sizeof_name); int gnutls_x509_crt_set_proxy(gnutls_x509_crt_t crt, int pathLenConstraint, const char *policyLanguage, const char *policy, size_t sizeof_policy); int gnutls_x509_crt_print(gnutls_x509_crt_t cert, gnutls_certificate_print_formats_t format, gnutls_datum_t * out); int gnutls_x509_crl_print(gnutls_x509_crl_t crl, gnutls_certificate_print_formats_t format, gnutls_datum_t * out); /* Access to internal Certificate fields. */ int gnutls_x509_crt_get_raw_issuer_dn(gnutls_x509_crt_t cert, gnutls_datum_t * start); int gnutls_x509_crt_get_raw_dn(gnutls_x509_crt_t cert, gnutls_datum_t * start); /* RDN handling. */ int gnutls_x509_rdn_get(const gnutls_datum_t * idn, char *buf, size_t * sizeof_buf); int gnutls_x509_rdn_get2(const gnutls_datum_t * idn, gnutls_datum_t *str, unsigned flags); int gnutls_x509_rdn_get_oid(const gnutls_datum_t * idn, unsigned indx, void *buf, size_t * sizeof_buf); int gnutls_x509_rdn_get_by_oid(const gnutls_datum_t * idn, const char *oid, unsigned indx, unsigned int raw_flag, void *buf, size_t * sizeof_buf); typedef struct gnutls_x509_dn_st *gnutls_x509_dn_t; typedef struct gnutls_x509_ava_st { gnutls_datum_t oid; gnutls_datum_t value; unsigned long value_tag; } gnutls_x509_ava_st; int gnutls_x509_crt_get_subject(gnutls_x509_crt_t cert, gnutls_x509_dn_t * dn); int gnutls_x509_crt_get_issuer(gnutls_x509_crt_t cert, gnutls_x509_dn_t * dn); int gnutls_x509_dn_get_rdn_ava(gnutls_x509_dn_t dn, int irdn, int iava, gnutls_x509_ava_st * ava); int gnutls_x509_dn_get_str(gnutls_x509_dn_t dn, gnutls_datum_t *str); #define GNUTLS_X509_DN_FLAG_COMPAT 1 int gnutls_x509_dn_get_str2(gnutls_x509_dn_t dn, gnutls_datum_t *str, unsigned flags); int gnutls_x509_dn_set_str(gnutls_x509_dn_t dn, const char *str, const char **err); int gnutls_x509_dn_init(gnutls_x509_dn_t * dn); int gnutls_x509_dn_import(gnutls_x509_dn_t dn, const gnutls_datum_t * data); int gnutls_x509_dn_export(gnutls_x509_dn_t dn, gnutls_x509_crt_fmt_t format, void *output_data, size_t * output_data_size); int gnutls_x509_dn_export2(gnutls_x509_dn_t dn, gnutls_x509_crt_fmt_t format, gnutls_datum_t * out); void gnutls_x509_dn_deinit(gnutls_x509_dn_t dn); /* CRL handling functions. */ int gnutls_x509_crl_init(gnutls_x509_crl_t * crl); void gnutls_x509_crl_deinit(gnutls_x509_crl_t crl); int gnutls_x509_crl_import(gnutls_x509_crl_t crl, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format); int gnutls_x509_crl_export(gnutls_x509_crl_t crl, gnutls_x509_crt_fmt_t format, void *output_data, size_t * output_data_size); int gnutls_x509_crl_export2(gnutls_x509_crl_t crl, gnutls_x509_crt_fmt_t format, gnutls_datum_t * out); int gnutls_x509_crl_get_raw_issuer_dn(gnutls_x509_crl_t crl, gnutls_datum_t * dn); int gnutls_x509_crl_get_issuer_dn(gnutls_x509_crl_t crl, char *buf, size_t * sizeof_buf); int gnutls_x509_crl_get_issuer_dn2(gnutls_x509_crl_t crl, gnutls_datum_t * dn); int gnutls_x509_crl_get_issuer_dn3(gnutls_x509_crl_t crl, gnutls_datum_t * dn, unsigned flags); int gnutls_x509_crl_get_issuer_dn_by_oid(gnutls_x509_crl_t crl, const char *oid, unsigned indx, unsigned int raw_flag, void *buf, size_t * sizeof_buf); int gnutls_x509_crl_get_dn_oid(gnutls_x509_crl_t crl, unsigned indx, void *oid, size_t * sizeof_oid); int gnutls_x509_crl_get_signature_algorithm(gnutls_x509_crl_t crl); int gnutls_x509_crl_get_signature(gnutls_x509_crl_t crl, char *sig, size_t * sizeof_sig); int gnutls_x509_crl_get_version(gnutls_x509_crl_t crl); int gnutls_x509_crl_get_signature_oid(gnutls_x509_crl_t crl, char *oid, size_t *oid_size); time_t gnutls_x509_crl_get_this_update(gnutls_x509_crl_t crl); time_t gnutls_x509_crl_get_next_update(gnutls_x509_crl_t crl); int gnutls_x509_crl_get_crt_count(gnutls_x509_crl_t crl); int gnutls_x509_crl_get_crt_serial(gnutls_x509_crl_t crl, unsigned indx, unsigned char *serial, size_t * serial_size, time_t * t); typedef struct gnutls_x509_crl_iter * gnutls_x509_crl_iter_t; int gnutls_x509_crl_iter_crt_serial(gnutls_x509_crl_t crl, gnutls_x509_crl_iter_t *, unsigned char *serial, size_t * serial_size, time_t * t); void gnutls_x509_crl_iter_deinit(gnutls_x509_crl_iter_t); #define gnutls_x509_crl_get_certificate_count gnutls_x509_crl_get_crt_count #define gnutls_x509_crl_get_certificate gnutls_x509_crl_get_crt_serial unsigned gnutls_x509_crl_check_issuer(gnutls_x509_crl_t crl, gnutls_x509_crt_t issuer); int gnutls_x509_crl_list_import2(gnutls_x509_crl_t ** crls, unsigned int *size, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, unsigned int flags); int gnutls_x509_crl_list_import(gnutls_x509_crl_t * crls, unsigned int *crl_max, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, unsigned int flags); /* CRL writing. */ int gnutls_x509_crl_set_version(gnutls_x509_crl_t crl, unsigned int version); int gnutls_x509_crl_set_this_update(gnutls_x509_crl_t crl, time_t act_time); int gnutls_x509_crl_set_next_update(gnutls_x509_crl_t crl, time_t exp_time); int gnutls_x509_crl_set_crt_serial(gnutls_x509_crl_t crl, const void *serial, size_t serial_size, time_t revocation_time); int gnutls_x509_crl_set_crt(gnutls_x509_crl_t crl, gnutls_x509_crt_t crt, time_t revocation_time); int gnutls_x509_crl_get_authority_key_id(gnutls_x509_crl_t crl, void *id, size_t * id_size, unsigned int *critical); int gnutls_x509_crl_get_authority_key_gn_serial(gnutls_x509_crl_t crl, unsigned int seq, void *alt, size_t * alt_size, unsigned int *alt_type, void *serial, size_t * serial_size, unsigned int *critical); int gnutls_x509_crl_get_number(gnutls_x509_crl_t crl, void *ret, size_t * ret_size, unsigned int *critical); int gnutls_x509_crl_get_extension_oid(gnutls_x509_crl_t crl, unsigned indx, void *oid, size_t * sizeof_oid); int gnutls_x509_crl_get_extension_info(gnutls_x509_crl_t crl, unsigned indx, void *oid, size_t * sizeof_oid, unsigned int *critical); int gnutls_x509_crl_get_extension_data(gnutls_x509_crl_t crl, unsigned indx, void *data, size_t * sizeof_data); int gnutls_x509_crl_get_extension_data2(gnutls_x509_crl_t crl, unsigned indx, gnutls_datum_t * data); int gnutls_x509_crl_set_authority_key_id(gnutls_x509_crl_t crl, const void *id, size_t id_size); int gnutls_x509_crl_set_number(gnutls_x509_crl_t crl, const void *nr, size_t nr_size); /* X.509 Certificate verification functions. */ /** * gnutls_certificate_verify_flags: * @GNUTLS_VERIFY_DISABLE_CA_SIGN: If set a signer does not have to be * a certificate authority. This flag should normally be disabled, * unless you know what this means. * @GNUTLS_VERIFY_DISABLE_TRUSTED_TIME_CHECKS: If set a signer in the trusted * list is never checked for expiration or activation. * @GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT: Do not allow trusted CA * certificates that have version 1. This option is to be used * to deprecate all certificates of version 1. * @GNUTLS_VERIFY_DO_NOT_ALLOW_SAME: If a certificate is not signed by * anyone trusted but exists in the trusted CA list do not treat it * as trusted. * @GNUTLS_VERIFY_ALLOW_UNSORTED_CHAIN: A certificate chain is tolerated * if unsorted (the case with many TLS servers out there). This is the * default since GnuTLS 3.1.4. * @GNUTLS_VERIFY_DO_NOT_ALLOW_UNSORTED_CHAIN: Do not tolerate an unsorted * certificate chain. * @GNUTLS_VERIFY_ALLOW_ANY_X509_V1_CA_CRT: Allow CA certificates that * have version 1 (both root and intermediate). This might be * dangerous since those haven't the basicConstraints * extension. * @GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD2: Allow certificates to be signed * using the broken MD2 algorithm. * @GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5: Allow certificates to be signed * using the broken MD5 algorithm. * @GNUTLS_VERIFY_ALLOW_SIGN_WITH_SHA1: Allow certificates to be signed * using the broken SHA1 hash algorithm. * @GNUTLS_VERIFY_ALLOW_BROKEN: Allow certificates to be signed * using any broken algorithm. * @GNUTLS_VERIFY_DISABLE_TIME_CHECKS: Disable checking of activation * and expiration validity periods of certificate chains. Don't set * this unless you understand the security implications. * @GNUTLS_VERIFY_DISABLE_CRL_CHECKS: Disable checking for validity * using certificate revocation lists or the available OCSP data. * @GNUTLS_VERIFY_DO_NOT_ALLOW_WILDCARDS: When including a hostname * check in the verification, do not consider any wildcards. * @GNUTLS_VERIFY_DO_NOT_ALLOW_IP_MATCHES: When verifying a hostname * prevent textual IP addresses from matching IP addresses in the * certificate. Treat the input only as a DNS name. * @GNUTLS_VERIFY_USE_TLS1_RSA: This indicates that a (raw) RSA signature is provided * as in the TLS 1.0 protocol. Not all functions accept this flag. * @GNUTLS_VERIFY_IGNORE_UNKNOWN_CRIT_EXTENSIONS: This signals the verification * process, not to fail on unknown critical extensions. * @GNUTLS_VERIFY_RSA_PSS_FIXED_SALT_LENGTH: Disallow RSA-PSS signatures made * with mismatching salt length with digest length, as mandated in RFC 8446 * 4.2.3. * * Enumeration of different certificate verify flags. Additional * verification profiles can be set using GNUTLS_PROFILE_TO_VFLAGS() * and %gnutls_certificate_verification_profiles_t. */ typedef enum gnutls_certificate_verify_flags { GNUTLS_VERIFY_DISABLE_CA_SIGN = 1 << 0, GNUTLS_VERIFY_DO_NOT_ALLOW_IP_MATCHES = 1<<1, GNUTLS_VERIFY_DO_NOT_ALLOW_SAME = 1 << 2, GNUTLS_VERIFY_ALLOW_ANY_X509_V1_CA_CRT = 1 << 3, GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD2 = 1 << 4, GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5 = 1 << 5, GNUTLS_VERIFY_DISABLE_TIME_CHECKS = 1 << 6, GNUTLS_VERIFY_DISABLE_TRUSTED_TIME_CHECKS = 1 << 7, GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT = 1 << 8, GNUTLS_VERIFY_DISABLE_CRL_CHECKS = 1 << 9, GNUTLS_VERIFY_ALLOW_UNSORTED_CHAIN = 1 << 10, GNUTLS_VERIFY_DO_NOT_ALLOW_UNSORTED_CHAIN = 1 << 11, GNUTLS_VERIFY_DO_NOT_ALLOW_WILDCARDS = 1 << 12, GNUTLS_VERIFY_USE_TLS1_RSA = 1 << 13, GNUTLS_VERIFY_IGNORE_UNKNOWN_CRIT_EXTENSIONS = 1 << 14, GNUTLS_VERIFY_ALLOW_SIGN_WITH_SHA1 = 1 << 15, GNUTLS_VERIFY_RSA_PSS_FIXED_SALT_LENGTH = 1 << 16 /* cannot exceed 2^24 due to GNUTLS_PROFILE_TO_VFLAGS() */ } gnutls_certificate_verify_flags; #define GNUTLS_VERIFY_ALLOW_BROKEN (GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD2|GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5) /** * gnutls_certificate_verification_profiles_t: * @GNUTLS_PROFILE_UNKNOWN: An invalid/unknown profile. * @GNUTLS_PROFILE_VERY_WEAK: A verification profile that * corresponds to @GNUTLS_SEC_PARAM_VERY_WEAK (64 bits) * @GNUTLS_PROFILE_LOW: A verification profile that * corresponds to @GNUTLS_SEC_PARAM_LOW (80 bits) * @GNUTLS_PROFILE_LEGACY: A verification profile that * corresponds to @GNUTLS_SEC_PARAM_LEGACY (96 bits) * @GNUTLS_PROFILE_MEDIUM: A verification profile that * corresponds to @GNUTLS_SEC_PARAM_MEDIUM (112 bits) * @GNUTLS_PROFILE_HIGH: A verification profile that * corresponds to @GNUTLS_SEC_PARAM_HIGH (128 bits) * @GNUTLS_PROFILE_ULTRA: A verification profile that * corresponds to @GNUTLS_SEC_PARAM_ULTRA (192 bits) * @GNUTLS_PROFILE_FUTURE: A verification profile that * corresponds to @GNUTLS_SEC_PARAM_FUTURE (256 bits) * @GNUTLS_PROFILE_SUITEB128: A verification profile that * applies the SUITEB128 rules * @GNUTLS_PROFILE_SUITEB192: A verification profile that * applies the SUITEB192 rules * * Enumeration of different certificate verification profiles. */ typedef enum gnutls_certificate_verification_profiles_t { GNUTLS_PROFILE_UNKNOWN = 0, GNUTLS_PROFILE_VERY_WEAK = 1, GNUTLS_PROFILE_LOW = 2, GNUTLS_PROFILE_LEGACY = 4, GNUTLS_PROFILE_MEDIUM = 5, GNUTLS_PROFILE_HIGH = 6, GNUTLS_PROFILE_ULTRA = 7, GNUTLS_PROFILE_FUTURE = 8, GNUTLS_PROFILE_SUITEB128=32, GNUTLS_PROFILE_SUITEB192=33 /*GNUTLS_PROFILE_MAX=255*/ } gnutls_certificate_verification_profiles_t; #define GNUTLS_PROFILE_TO_VFLAGS(x) \ (((unsigned)x)<<24) #define GNUTLS_VFLAGS_PROFILE_MASK (0xff000000) #define GNUTLS_VFLAGS_TO_PROFILE(x) \ ((((unsigned)x)>>24)&0xff) const char * gnutls_certificate_verification_profile_get_name(gnutls_certificate_verification_profiles_t id) __GNUTLS_CONST__; gnutls_certificate_verification_profiles_t gnutls_certificate_verification_profile_get_id(const char *name) __GNUTLS_CONST__; unsigned gnutls_x509_crt_check_issuer(gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer); int gnutls_x509_crt_list_verify(const gnutls_x509_crt_t * cert_list, unsigned cert_list_length, const gnutls_x509_crt_t * CA_list, unsigned CA_list_length, const gnutls_x509_crl_t * CRL_list, unsigned CRL_list_length, unsigned int flags, unsigned int *verify); int gnutls_x509_crt_verify(gnutls_x509_crt_t cert, const gnutls_x509_crt_t * CA_list, unsigned CA_list_length, unsigned int flags, unsigned int *verify); int gnutls_x509_crl_verify(gnutls_x509_crl_t crl, const gnutls_x509_crt_t * CA_list, unsigned CA_list_length, unsigned int flags, unsigned int *verify); int gnutls_x509_crt_verify_data2(gnutls_x509_crt_t crt, gnutls_sign_algorithm_t algo, unsigned int flags, const gnutls_datum_t * data, const gnutls_datum_t * signature); int gnutls_x509_crt_check_revocation(gnutls_x509_crt_t cert, const gnutls_x509_crl_t * crl_list, unsigned crl_list_length); int gnutls_x509_crt_get_fingerprint(gnutls_x509_crt_t cert, gnutls_digest_algorithm_t algo, void *buf, size_t * buf_size); int gnutls_x509_crt_get_key_purpose_oid(gnutls_x509_crt_t cert, unsigned indx, void *oid, size_t * oid_size, unsigned int *critical); int gnutls_x509_crt_set_key_purpose_oid(gnutls_x509_crt_t cert, const void *oid, unsigned int critical); unsigned gnutls_x509_crt_check_key_purpose(gnutls_x509_crt_t cert, const char *purpose, unsigned flags); /* Private key handling. */ /* Flags for the gnutls_x509_privkey_export_pkcs8() function. */ #define GNUTLS_PKCS8_PLAIN GNUTLS_PKCS_PLAIN #define GNUTLS_PKCS8_USE_PKCS12_3DES GNUTLS_PKCS_PKCS12_3DES #define GNUTLS_PKCS8_USE_PKCS12_ARCFOUR GNUTLS_PKCS_PKCS12_ARCFOUR #define GNUTLS_PKCS8_USE_PKCS12_RC2_40 GNUTLS_PKCS_PKCS12_RC2_40 /** * gnutls_pkcs_encrypt_flags_t: * @GNUTLS_PKCS_PLAIN: Unencrypted private key. * @GNUTLS_PKCS_NULL_PASSWORD: Some schemas distinguish between an empty and a NULL password. * @GNUTLS_PKCS_PKCS12_3DES: PKCS-12 3DES. * @GNUTLS_PKCS_PKCS12_ARCFOUR: PKCS-12 ARCFOUR. * @GNUTLS_PKCS_PKCS12_RC2_40: PKCS-12 RC2-40. * @GNUTLS_PKCS_PBES2_3DES: PBES2 3DES. * @GNUTLS_PKCS_PBES2_AES_128: PBES2 AES-128. * @GNUTLS_PKCS_PBES2_AES_192: PBES2 AES-192. * @GNUTLS_PKCS_PBES2_AES_256: PBES2 AES-256. * @GNUTLS_PKCS_PBES2_DES: PBES2 single DES. * @GNUTLS_PKCS_PBES1_DES_MD5: PBES1 with single DES; for compatibility with openssl only. * @GNUTLS_PKCS_PBES2_GOST_TC26Z: PBES2 GOST 28147-89 CFB with TC26-Z S-box. * @GNUTLS_PKCS_PBES2_GOST_CPA: PBES2 GOST 28147-89 CFB with CryptoPro-A S-box. * @GNUTLS_PKCS_PBES2_GOST_CPB: PBES2 GOST 28147-89 CFB with CryptoPro-B S-box. * @GNUTLS_PKCS_PBES2_GOST_CPC: PBES2 GOST 28147-89 CFB with CryptoPro-C S-box. * @GNUTLS_PKCS_PBES2_GOST_CPD: PBES2 GOST 28147-89 CFB with CryptoPro-D S-box. * * Enumeration of different PKCS encryption flags. */ typedef enum gnutls_pkcs_encrypt_flags_t { GNUTLS_PKCS_PLAIN = 1, GNUTLS_PKCS_PKCS12_3DES = 1<<1, GNUTLS_PKCS_PKCS12_ARCFOUR = 1<<2, GNUTLS_PKCS_PKCS12_RC2_40 = 1<<3, GNUTLS_PKCS_PBES2_3DES = 1<<4, GNUTLS_PKCS_PBES2_AES_128 = 1<<5, GNUTLS_PKCS_PBES2_AES_192 = 1<<6, GNUTLS_PKCS_PBES2_AES_256 = 1<<7, GNUTLS_PKCS_NULL_PASSWORD = 1<<8, GNUTLS_PKCS_PBES2_DES = 1<<9, GNUTLS_PKCS_PBES1_DES_MD5 = 1<<10, GNUTLS_PKCS_PBES2_GOST_TC26Z = 1<<11, GNUTLS_PKCS_PBES2_GOST_CPA = 1<<12, GNUTLS_PKCS_PBES2_GOST_CPB = 1<<13, GNUTLS_PKCS_PBES2_GOST_CPC = 1<<14, GNUTLS_PKCS_PBES2_GOST_CPD = 1<<15 } gnutls_pkcs_encrypt_flags_t; #define GNUTLS_PKCS_CIPHER_MASK(x) ((x)&(~(GNUTLS_PKCS_NULL_PASSWORD))) #define GNUTLS_PKCS_USE_PKCS12_3DES GNUTLS_PKCS_PKCS12_3DES #define GNUTLS_PKCS_USE_PKCS12_ARCFOUR GNUTLS_PKCS_PKCS12_ARCFOUR #define GNUTLS_PKCS_USE_PKCS12_RC2_40 GNUTLS_PKCS_PKCS12_RC2_40 #define GNUTLS_PKCS_USE_PBES2_3DES GNUTLS_PKCS_PBES2_3DES #define GNUTLS_PKCS_USE_PBES2_AES_128 GNUTLS_PKCS_PBES2_AES_128 #define GNUTLS_PKCS_USE_PBES2_AES_192 GNUTLS_PKCS_PBES2_AES_192 #define GNUTLS_PKCS_USE_PBES2_AES_256 GNUTLS_PKCS_PBES2_AES_256 #define GNUTLS_PKCS_USE_PBES2_GOST_TC26Z GNUTLS_PKCS_PBES2_GOST_TC26Z #define GNUTLS_PKCS_USE_PBES2_GOST_CPA GNUTLS_PKCS_PBES2_GOST_CPA #define GNUTLS_PKCS_USE_PBES2_GOST_CPB GNUTLS_PKCS_PBES2_GOST_CPB #define GNUTLS_PKCS_USE_PBES2_GOST_CPC GNUTLS_PKCS_PBES2_GOST_CPC #define GNUTLS_PKCS_USE_PBES2_GOST_CPD GNUTLS_PKCS_PBES2_GOST_CPD const char *gnutls_pkcs_schema_get_name(unsigned int schema); const char *gnutls_pkcs_schema_get_oid(unsigned int schema); int gnutls_x509_privkey_init(gnutls_x509_privkey_t * key); void gnutls_x509_privkey_deinit(gnutls_x509_privkey_t key); gnutls_sec_param_t gnutls_x509_privkey_sec_param(gnutls_x509_privkey_t key); void gnutls_x509_privkey_set_pin_function(gnutls_x509_privkey_t key, gnutls_pin_callback_t fn, void *userdata); int gnutls_x509_privkey_cpy(gnutls_x509_privkey_t dst, gnutls_x509_privkey_t src); int gnutls_x509_privkey_import(gnutls_x509_privkey_t key, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format); int gnutls_x509_privkey_import_pkcs8(gnutls_x509_privkey_t key, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, const char *password, unsigned int flags); int gnutls_x509_privkey_import_openssl(gnutls_x509_privkey_t key, const gnutls_datum_t * data, const char *password); int gnutls_pkcs8_info(const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, unsigned int *schema, unsigned int *cipher, void *salt, unsigned int *salt_size, unsigned int *iter_count, char **oid); int gnutls_x509_privkey_import2(gnutls_x509_privkey_t key, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, const char *password, unsigned int flags); int gnutls_x509_privkey_import_rsa_raw(gnutls_x509_privkey_t key, const gnutls_datum_t * m, const gnutls_datum_t * e, const gnutls_datum_t * d, const gnutls_datum_t * p, const gnutls_datum_t * q, const gnutls_datum_t * u); int gnutls_x509_privkey_import_rsa_raw2(gnutls_x509_privkey_t key, const gnutls_datum_t * m, const gnutls_datum_t * e, const gnutls_datum_t * d, const gnutls_datum_t * p, const gnutls_datum_t * q, const gnutls_datum_t * u, const gnutls_datum_t * e1, const gnutls_datum_t * e2); int gnutls_x509_privkey_import_ecc_raw(gnutls_x509_privkey_t key, gnutls_ecc_curve_t curve, const gnutls_datum_t * x, const gnutls_datum_t * y, const gnutls_datum_t * k); int gnutls_x509_privkey_import_gost_raw(gnutls_x509_privkey_t key, gnutls_ecc_curve_t curve, gnutls_digest_algorithm_t digest, gnutls_gost_paramset_t paramset, const gnutls_datum_t * x, const gnutls_datum_t * y, const gnutls_datum_t * k); int gnutls_x509_privkey_fix(gnutls_x509_privkey_t key); int gnutls_x509_privkey_export_dsa_raw(gnutls_x509_privkey_t key, gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * g, gnutls_datum_t * y, gnutls_datum_t * x); int gnutls_x509_privkey_import_dsa_raw(gnutls_x509_privkey_t key, const gnutls_datum_t * p, const gnutls_datum_t * q, const gnutls_datum_t * g, const gnutls_datum_t * y, const gnutls_datum_t * x); int gnutls_x509_privkey_get_pk_algorithm(gnutls_x509_privkey_t key); int gnutls_x509_privkey_get_pk_algorithm2(gnutls_x509_privkey_t key, unsigned int *bits); int gnutls_x509_privkey_get_spki(gnutls_x509_privkey_t key, gnutls_x509_spki_t spki, unsigned int flags); int gnutls_x509_privkey_set_spki(gnutls_x509_privkey_t key, const gnutls_x509_spki_t spki, unsigned int flags); int gnutls_x509_privkey_get_key_id(gnutls_x509_privkey_t key, unsigned int flags, unsigned char *output_data, size_t * output_data_size); int gnutls_x509_privkey_generate(gnutls_x509_privkey_t key, gnutls_pk_algorithm_t algo, unsigned int bits, unsigned int flags); void gnutls_x509_privkey_set_flags(gnutls_x509_privkey_t key, unsigned int flags); /** * gnutls_keygen_types_t: * @GNUTLS_KEYGEN_SEED: Specifies the seed to be used in key generation. * @GNUTLS_KEYGEN_DIGEST: The size field specifies the hash algorithm to be used in key generation. * @GNUTLS_KEYGEN_SPKI: data points to a %gnutls_x509_spki_t structure; it is not used after the key generation call. * * Enumeration of different key generation data options. */ typedef enum { GNUTLS_KEYGEN_SEED = 1, GNUTLS_KEYGEN_DIGEST = 2, GNUTLS_KEYGEN_SPKI = 3 } gnutls_keygen_types_t; typedef struct { gnutls_keygen_types_t type; unsigned char *data; unsigned int size; } gnutls_keygen_data_st; int gnutls_x509_privkey_generate2(gnutls_x509_privkey_t key, gnutls_pk_algorithm_t algo, unsigned int bits, unsigned int flags, const gnutls_keygen_data_st *data, unsigned data_size); int gnutls_x509_privkey_verify_seed(gnutls_x509_privkey_t key, gnutls_digest_algorithm_t, const void *seed, size_t seed_size); int gnutls_x509_privkey_get_seed(gnutls_x509_privkey_t key, gnutls_digest_algorithm_t*, void *seed, size_t *seed_size); int gnutls_x509_privkey_verify_params(gnutls_x509_privkey_t key); int gnutls_x509_privkey_export(gnutls_x509_privkey_t key, gnutls_x509_crt_fmt_t format, void *output_data, size_t * output_data_size); int gnutls_x509_privkey_export2(gnutls_x509_privkey_t key, gnutls_x509_crt_fmt_t format, gnutls_datum_t * out); int gnutls_x509_privkey_export_pkcs8(gnutls_x509_privkey_t key, gnutls_x509_crt_fmt_t format, const char *password, unsigned int flags, void *output_data, size_t * output_data_size); int gnutls_x509_privkey_export2_pkcs8(gnutls_x509_privkey_t key, gnutls_x509_crt_fmt_t format, const char *password, unsigned int flags, gnutls_datum_t * out); int gnutls_x509_privkey_export_rsa_raw2(gnutls_x509_privkey_t key, gnutls_datum_t * m, gnutls_datum_t * e, gnutls_datum_t * d, gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * u, gnutls_datum_t * e1, gnutls_datum_t * e2); int gnutls_x509_privkey_export_rsa_raw(gnutls_x509_privkey_t key, gnutls_datum_t * m, gnutls_datum_t * e, gnutls_datum_t * d, gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * u); int gnutls_x509_privkey_export_ecc_raw(gnutls_x509_privkey_t key, gnutls_ecc_curve_t * curve, gnutls_datum_t * x, gnutls_datum_t * y, gnutls_datum_t * k); int gnutls_x509_privkey_export_gost_raw(gnutls_x509_privkey_t key, gnutls_ecc_curve_t * curve, gnutls_digest_algorithm_t * digest, gnutls_gost_paramset_t * paramset, gnutls_datum_t * x, gnutls_datum_t * y, gnutls_datum_t * k); int gnutls_x509_privkey_sign_data(gnutls_x509_privkey_t key, gnutls_digest_algorithm_t digest, unsigned int flags, const gnutls_datum_t * data, void *signature, size_t * signature_size); /* Certificate request stuff. */ int gnutls_x509_crq_sign(gnutls_x509_crq_t crq, gnutls_x509_privkey_t key); int gnutls_x509_crq_sign2(gnutls_x509_crq_t crq, gnutls_x509_privkey_t key, gnutls_digest_algorithm_t dig, unsigned int flags); int gnutls_x509_crq_print(gnutls_x509_crq_t crq, gnutls_certificate_print_formats_t format, gnutls_datum_t * out); int gnutls_x509_crq_verify(gnutls_x509_crq_t crq, unsigned int flags); int gnutls_x509_crq_init(gnutls_x509_crq_t * crq); void gnutls_x509_crq_deinit(gnutls_x509_crq_t crq); int gnutls_x509_crq_import(gnutls_x509_crq_t crq, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format); int gnutls_x509_crq_get_private_key_usage_period(gnutls_x509_crq_t cert, time_t * activation, time_t * expiration, unsigned int *critical); int gnutls_x509_crq_get_dn(gnutls_x509_crq_t crq, char *buf, size_t * sizeof_buf); int gnutls_x509_crq_get_dn2(gnutls_x509_crq_t crq, gnutls_datum_t * dn); int gnutls_x509_crq_get_dn3(gnutls_x509_crq_t crq, gnutls_datum_t * dn, unsigned flags); int gnutls_x509_crq_get_dn_oid(gnutls_x509_crq_t crq, unsigned indx, void *oid, size_t * sizeof_oid); int gnutls_x509_crq_get_dn_by_oid(gnutls_x509_crq_t crq, const char *oid, unsigned indx, unsigned int raw_flag, void *buf, size_t * sizeof_buf); int gnutls_x509_crq_set_dn(gnutls_x509_crq_t crq, const char *dn, const char **err); int gnutls_x509_crq_set_dn_by_oid(gnutls_x509_crq_t crq, const char *oid, unsigned int raw_flag, const void *data, unsigned int sizeof_data); int gnutls_x509_crq_set_version(gnutls_x509_crq_t crq, unsigned int version); int gnutls_x509_crq_get_version(gnutls_x509_crq_t crq); int gnutls_x509_crq_set_key(gnutls_x509_crq_t crq, gnutls_x509_privkey_t key); int gnutls_x509_crq_set_extension_by_oid(gnutls_x509_crq_t crq, const char *oid, const void *buf, size_t sizeof_buf, unsigned int critical); int gnutls_x509_crq_set_challenge_password(gnutls_x509_crq_t crq, const char *pass); int gnutls_x509_crq_get_challenge_password(gnutls_x509_crq_t crq, char *pass, size_t * sizeof_pass); int gnutls_x509_crq_set_attribute_by_oid(gnutls_x509_crq_t crq, const char *oid, void *buf, size_t sizeof_buf); int gnutls_x509_crq_get_attribute_by_oid(gnutls_x509_crq_t crq, const char *oid, unsigned indx, void *buf, size_t * sizeof_buf); int gnutls_x509_crq_export(gnutls_x509_crq_t crq, gnutls_x509_crt_fmt_t format, void *output_data, size_t * output_data_size); int gnutls_x509_crq_export2(gnutls_x509_crq_t crq, gnutls_x509_crt_fmt_t format, gnutls_datum_t * out); int gnutls_x509_crt_set_crq(gnutls_x509_crt_t crt, gnutls_x509_crq_t crq); int gnutls_x509_crt_set_crq_extensions(gnutls_x509_crt_t crt, gnutls_x509_crq_t crq); int gnutls_x509_crt_set_crq_extension_by_oid(gnutls_x509_crt_t crt, gnutls_x509_crq_t crq, const char *oid, unsigned flags); int gnutls_x509_crq_set_private_key_usage_period(gnutls_x509_crq_t crq, time_t activation, time_t expiration); int gnutls_x509_crq_set_key_rsa_raw(gnutls_x509_crq_t crq, const gnutls_datum_t * m, const gnutls_datum_t * e); int gnutls_x509_crq_set_subject_alt_name(gnutls_x509_crq_t crq, gnutls_x509_subject_alt_name_t nt, const void *data, unsigned int data_size, unsigned int flags); int gnutls_x509_crq_set_subject_alt_othername(gnutls_x509_crq_t crq, const char *oid, const void *data, unsigned int data_size, unsigned int flags); int gnutls_x509_crq_set_key_usage(gnutls_x509_crq_t crq, unsigned int usage); int gnutls_x509_crq_set_basic_constraints(gnutls_x509_crq_t crq, unsigned int ca, int pathLenConstraint); int gnutls_x509_crq_set_key_purpose_oid(gnutls_x509_crq_t crq, const void *oid, unsigned int critical); int gnutls_x509_crq_get_key_purpose_oid(gnutls_x509_crq_t crq, unsigned indx, void *oid, size_t * sizeof_oid, unsigned int *critical); int gnutls_x509_crq_get_extension_data(gnutls_x509_crq_t crq, unsigned indx, void *data, size_t * sizeof_data); int gnutls_x509_crq_get_extension_data2(gnutls_x509_crq_t crq, unsigned indx, gnutls_datum_t * data); int gnutls_x509_crq_get_extension_info(gnutls_x509_crq_t crq, unsigned indx, void *oid, size_t * sizeof_oid, unsigned int *critical); int gnutls_x509_crq_get_attribute_data(gnutls_x509_crq_t crq, unsigned indx, void *data, size_t * sizeof_data); int gnutls_x509_crq_get_attribute_info(gnutls_x509_crq_t crq, unsigned indx, void *oid, size_t * sizeof_oid); int gnutls_x509_crq_get_pk_algorithm(gnutls_x509_crq_t crq, unsigned int *bits); int gnutls_x509_crq_get_spki(gnutls_x509_crq_t crq, gnutls_x509_spki_t spki, unsigned int flags); int gnutls_x509_crq_set_spki(gnutls_x509_crq_t crq, const gnutls_x509_spki_t spki, unsigned int flags); int gnutls_x509_crq_get_signature_oid(gnutls_x509_crq_t crq, char *oid, size_t *oid_size); int gnutls_x509_crq_get_pk_oid(gnutls_x509_crq_t crq, char *oid, size_t *oid_size); int gnutls_x509_crq_get_key_id(gnutls_x509_crq_t crq, unsigned int flags, unsigned char *output_data, size_t * output_data_size); int gnutls_x509_crq_get_key_rsa_raw(gnutls_x509_crq_t crq, gnutls_datum_t * m, gnutls_datum_t * e); int gnutls_x509_crq_get_key_usage(gnutls_x509_crq_t crq, unsigned int *key_usage, unsigned int *critical); int gnutls_x509_crq_get_basic_constraints(gnutls_x509_crq_t crq, unsigned int *critical, unsigned int *ca, int *pathlen); int gnutls_x509_crq_get_subject_alt_name(gnutls_x509_crq_t crq, unsigned int seq, void *ret, size_t * ret_size, unsigned int *ret_type, unsigned int *critical); int gnutls_x509_crq_get_subject_alt_othername_oid(gnutls_x509_crq_t crq, unsigned int seq, void *ret, size_t * ret_size); int gnutls_x509_crq_get_extension_by_oid(gnutls_x509_crq_t crq, const char *oid, unsigned indx, void *buf, size_t * sizeof_buf, unsigned int *critical); int gnutls_x509_crq_get_tlsfeatures(gnutls_x509_crq_t crq, gnutls_x509_tlsfeatures_t features, unsigned flags, unsigned int *critical); int gnutls_x509_crq_set_tlsfeatures(gnutls_x509_crq_t crq, gnutls_x509_tlsfeatures_t features); int gnutls_x509_crt_get_extension_by_oid2(gnutls_x509_crt_t cert, const char *oid, unsigned indx, gnutls_datum_t *output, unsigned int *critical); typedef struct gnutls_x509_trust_list_st *gnutls_x509_trust_list_t; typedef struct gnutls_x509_trust_list_iter *gnutls_x509_trust_list_iter_t; int gnutls_x509_trust_list_init(gnutls_x509_trust_list_t * list, unsigned int size); void gnutls_x509_trust_list_deinit(gnutls_x509_trust_list_t list, unsigned int all); int gnutls_x509_trust_list_get_issuer(gnutls_x509_trust_list_t list, gnutls_x509_crt_t cert, gnutls_x509_crt_t * issuer, unsigned int flags); int gnutls_x509_trust_list_get_issuer_by_dn(gnutls_x509_trust_list_t list, const gnutls_datum_t *dn, gnutls_x509_crt_t *issuer, unsigned int flags); int gnutls_x509_trust_list_get_issuer_by_subject_key_id(gnutls_x509_trust_list_t list, const gnutls_datum_t *dn, const gnutls_datum_t *spki, gnutls_x509_crt_t *issuer, unsigned int flags); /** * gnutls_trust_list_flags_t: * @GNUTLS_TL_VERIFY_CRL: If any CRLs are provided they will be verified for validity * prior to be added. The CA certificates that will be used for verification are the * ones already added in the trusted list. * @GNUTLS_TL_USE_IN_TLS: Internal flag used by GnuTLS. If provided the trust list * structure will cache a copy of CA DNs to be used in the certificate request * TLS message. * @GNUTLS_TL_NO_DUPLICATES: If this flag is specified, a function adding certificates * will check and eliminate any duplicates. * @GNUTLS_TL_NO_DUPLICATE_KEY: If this flag is specified, a certificate sharing the * same key as a previously added on will not be added. * @GNUTLS_TL_GET_COPY: The semantics of this flag are documented to the functions which * are applicable. In general, on returned value, the function will provide a copy * if this flag is provided, rather than a pointer to internal data. * @GNUTLS_TL_FAIL_ON_INVALID_CRL: If an CRL is added which cannot be validated return * an error instead of ignoring (must be used with %GNUTLS_TL_VERIFY_CRL). * * Enumeration of different certificate trust list flags. */ typedef enum gnutls_trust_list_flags_t { GNUTLS_TL_VERIFY_CRL = 1, #define GNUTLS_TL_VERIFY_CRL 1 GNUTLS_TL_USE_IN_TLS = (1<<1), #define GNUTLS_TL_USE_IN_TLS (1<<1) GNUTLS_TL_NO_DUPLICATES = (1<<2), #define GNUTLS_TL_NO_DUPLICATES (1<<2) GNUTLS_TL_NO_DUPLICATE_KEY = (1<<3), #define GNUTLS_TL_NO_DUPLICATE_KEY (1<<3) GNUTLS_TL_GET_COPY = (1<<4), #define GNUTLS_TL_GET_COPY (1<<4) GNUTLS_TL_FAIL_ON_INVALID_CRL = (1<<5) #define GNUTLS_TL_FAIL_ON_INVALID_CRL (1<<5) } gnutls_trust_list_flags_t; int gnutls_x509_trust_list_add_cas(gnutls_x509_trust_list_t list, const gnutls_x509_crt_t * clist, unsigned clist_size, unsigned int flags); int gnutls_x509_trust_list_remove_cas(gnutls_x509_trust_list_t list, const gnutls_x509_crt_t * clist, unsigned clist_size); int gnutls_x509_trust_list_add_named_crt(gnutls_x509_trust_list_t list, gnutls_x509_crt_t cert, const void *name, size_t name_size, unsigned int flags); int gnutls_x509_trust_list_add_crls(gnutls_x509_trust_list_t list, const gnutls_x509_crl_t * crl_list, unsigned crl_size, unsigned int flags, unsigned int verification_flags); int gnutls_x509_trust_list_iter_get_ca(gnutls_x509_trust_list_t list, gnutls_x509_trust_list_iter_t *iter, gnutls_x509_crt_t *crt); void gnutls_x509_trust_list_iter_deinit(gnutls_x509_trust_list_iter_t iter); typedef int gnutls_verify_output_function(gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer, /* The issuer if verification failed * because of him. might be null. */ gnutls_x509_crl_t crl, /* The CRL that caused verification failure * if any. Might be null. */ unsigned int verification_output); void gnutls_session_set_verify_output_function(gnutls_session_t session, gnutls_verify_output_function * func); int gnutls_x509_trust_list_verify_named_crt (gnutls_x509_trust_list_t list, gnutls_x509_crt_t cert, const void *name, size_t name_size, unsigned int flags, unsigned int *verify, gnutls_verify_output_function func); int gnutls_x509_trust_list_verify_crt2(gnutls_x509_trust_list_t list, gnutls_x509_crt_t * cert_list, unsigned int cert_list_size, gnutls_typed_vdata_st * data, unsigned int elements, unsigned int flags, unsigned int *voutput, gnutls_verify_output_function func); int gnutls_x509_trust_list_verify_crt(gnutls_x509_trust_list_t list, gnutls_x509_crt_t * cert_list, unsigned int cert_list_size, unsigned int flags, unsigned int *verify, gnutls_verify_output_function func); /* trust list convenience functions */ int gnutls_x509_trust_list_add_trust_mem(gnutls_x509_trust_list_t list, const gnutls_datum_t * cas, const gnutls_datum_t * crls, gnutls_x509_crt_fmt_t type, unsigned int tl_flags, unsigned int tl_vflags); int gnutls_x509_trust_list_add_trust_file(gnutls_x509_trust_list_t list, const char *ca_file, const char *crl_file, gnutls_x509_crt_fmt_t type, unsigned int tl_flags, unsigned int tl_vflags); int gnutls_x509_trust_list_add_trust_dir(gnutls_x509_trust_list_t list, const char *ca_dir, const char *crl_dir, gnutls_x509_crt_fmt_t type, unsigned int tl_flags, unsigned int tl_vflags); int gnutls_x509_trust_list_remove_trust_file(gnutls_x509_trust_list_t list, const char *ca_file, gnutls_x509_crt_fmt_t type); int gnutls_x509_trust_list_remove_trust_mem(gnutls_x509_trust_list_t list, const gnutls_datum_t * cas, gnutls_x509_crt_fmt_t type); int gnutls_x509_trust_list_add_system_trust(gnutls_x509_trust_list_t list, unsigned int tl_flags, unsigned int tl_vflags); typedef int gnutls_x509_trust_list_getissuer_function(gnutls_x509_trust_list_t list, const gnutls_x509_crt_t cert, gnutls_x509_crt_t **issuers, unsigned int *issuers_size); void gnutls_x509_trust_list_set_getissuer_function(gnutls_x509_trust_list_t tlist, gnutls_x509_trust_list_getissuer_function *func); void gnutls_x509_trust_list_set_ptr(gnutls_x509_trust_list_t tlist, void *ptr); void *gnutls_x509_trust_list_get_ptr(gnutls_x509_trust_list_t tlist); void gnutls_certificate_set_trust_list (gnutls_certificate_credentials_t res, gnutls_x509_trust_list_t tlist, unsigned flags); void gnutls_certificate_get_trust_list (gnutls_certificate_credentials_t res, gnutls_x509_trust_list_t *tlist); typedef struct gnutls_x509_ext_st { char *oid; unsigned int critical; gnutls_datum_t data; } gnutls_x509_ext_st; void gnutls_x509_ext_deinit(gnutls_x509_ext_st *ext); int gnutls_x509_ext_print(gnutls_x509_ext_st *exts, unsigned int exts_size, gnutls_certificate_print_formats_t format, gnutls_datum_t * out); #include <gnutls/pkcs7.h> /* *INDENT-OFF* */ #ifdef __cplusplus } #endif /* *INDENT-ON* */ #endif /* GNUTLS_X509_H */
64,429
C++
.h
1,514
37.875165
220
0.708809
Nevcairiel/LAVFilters
7,362
788
84
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false