diff options
author | Saturneric <[email protected]> | 2021-05-26 09:52:06 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-05-26 09:52:06 +0000 |
commit | 4f39afa8078be2bcfdd4d0f54d8a203cbb7f58c9 (patch) | |
tree | 2c40ec2a3da6978cd65a8006a6cc7427b01b7536 | |
parent | Fix some problems caused by negligence. (diff) | |
download | GpgFrontend-4f39afa8078be2bcfdd4d0f54d8a203cbb7f58c9.tar.gz GpgFrontend-4f39afa8078be2bcfdd4d0f54d8a203cbb7f58c9.zip |
Remove the self-compiled GpgME package
Modify the compilation settings so that the project can be compiled on MacOS.
Complete .gitignore
Diffstat (limited to '')
-rw-r--r-- | .gitignore | 110 | ||||
-rw-r--r-- | CMakeLists.txt | 47 | ||||
-rw-r--r-- | release/bin/COPYING.txt | 676 | ||||
-rw-r--r-- | release/bin/README.txt | 822 | ||||
-rw-r--r-- | src/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/gpg/CMakeLists.txt | 4 | ||||
-rw-r--r-- | utils/gpgme/include/assuan.h | 709 | ||||
-rw-r--r-- | utils/gpgme/include/gpg-error.h | 2005 | ||||
-rw-r--r-- | utils/gpgme/include/gpgme.h | 2841 |
9 files changed, 145 insertions, 7073 deletions
@@ -1,9 +1,103 @@ -mocfiles -objectfiles -qrc_gpg4usb.cpp -release/conf -release/gpg4usb +# Configure Files +*/conf/* + + +# Clangd +.cache/ +test/ + + +# C++ + +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + + + + + +# CMake + +# CLion +cmake-build-debug/ +cmake-build-release/ + +# Unix +build/ + +# General +CMakeLists.txt.user +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing Makefile -release/keydb/pubring.gpg -release/keydb/trustdb.gpg -cmake-build-debug +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_deps + + + + +# Qt + +# Qt-es +object_script.*.Release +object_script.*.Debug +*_plugin_import.cpp +/.qmake.cache +/.qmake.stash +*.pro.user +*.pro.user.* +*.qbs.user +*.qbs.user.* +*.moc +moc_*.cpp +moc_*.h +qrc_*.cpp +ui_*.h +*.qmlc +*.jsc +Makefile* +*build-* +*.qm +*.prl + +# Qt unit tests +target_wrapper.* + +# QtCreator +*.autosave + diff --git a/CMakeLists.txt b/CMakeLists.txt index d501bfff..7c83be0b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,17 +11,48 @@ set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) -find_package(Qt5 COMPONENTS Core Test Widgets PrintSupport Network REQUIRED) +set( CMAKE_EXPORT_COMPILE_COMMANDS ON ) + + +if(APPLE) -message("${Qt5Widgets_INCLUDE_DIRS}") + message("OS Platform MacOS") -include_directories( + set(ENV{Qt5_DIR} /usr/local/opt/qt5/lib/cmake) + + # for MacOS X or iOS, watchOS, tvOS (since 3.10.3) + include_directories( include - ${CMAKE_SOURCE_DIR}/utils/gpgme/include -) -link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib/) -link_directories(/usr/local/lib/) -link_directories(/lib/) + /usr/local/include + ) + link_directories( + /usr/local/lib + ) +endif() + +if(UNIX AND NOT APPLE) + set(LINUX TRUE) +endif() + +if(LINUX) + + message("OS Platform LINUX") + + include_directories( + include + /usr/include + /usr/local/include + ) + link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib/) + link_directories( + /lib/ + /usr/lib/ + /usr/local/lib/ + ) + +endif() + +find_package(Qt5 COMPONENTS Core Test Widgets PrintSupport Network REQUIRED) add_subdirectory(src) diff --git a/release/bin/COPYING.txt b/release/bin/COPYING.txt deleted file mode 100644 index 44325404..00000000 --- a/release/bin/COPYING.txt +++ /dev/null @@ -1,676 +0,0 @@ - - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - 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 3 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, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. - diff --git a/release/bin/README.txt b/release/bin/README.txt deleted file mode 100644 index a690f3f5..00000000 --- a/release/bin/README.txt +++ /dev/null @@ -1,822 +0,0 @@ - - GnuPG - The GNU Privacy Guard - ------------------------------- - Version 1.4.9 - - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008 Free Software Foundation, Inc. - - This file is free software; as a special exception the author - gives unlimited permission to copy and/or distribute it, with or - without modifications, as long as this notice is preserved. - - This file is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY, to the extent permitted by law; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A - PARTICULAR PURPOSE. - - - Intro - ----- - - GnuPG is GNU's tool for secure communication and data storage. - It can be used to encrypt data and to create digital signatures. - It includes an advanced key management facility and is compliant - with the proposed OpenPGP Internet standard as described in RFC2440. - - GnuPG works best on GNU/Linux or *BSD systems. Most other Unices - are also supported but are not as well tested as the Free Unices. - See http://www.gnupg.org/download/supported_systems.html for a - list of systems which are known to work. - - See the file COPYING for copyright and warranty information. - - Because GnuPG does not use use any patented algorithms it is not - by default fully compatible with PGP 2.x, which uses the patented - IDEA algorithm. See http://www.gnupg.org/why-not-idea.html for - more information on this subject, including what to do if you are - legally entitled to use IDEA. - - The default public key algorithms are DSA and Elgamal, but RSA is - also supported. Symmetric algorithms available are AES (with 128, - 192, and 256 bit keys), 3DES, Blowfish, CAST5 and Twofish. Digest - algorithms available are MD5, RIPEMD/160, SHA-1, SHA-256, SHA-384, - and SHA-512. Compression algorithms available are ZIP, ZLIB, and - BZIP2 (with libbz2 installed). - - - Installation - ------------ - - Please read the file INSTALL and the sections in this file - related to the installation. Here is a quick summary: - - 1) Check that you have unmodified sources. See below on how to do - this. Don't skip it - this is an important step! - - 2) Unpack the tarball. With GNU tar you can do it this way: - "tar xzvf gnupg-x.y.z.tar.gz". If got a bzip2 compressed - tarball you need to use: "tar xjvf gnupg-x.y.z.tar.bz2". - - 3) "cd gnupg-x.y.z" - - 4) "./configure" - - 5) "make" - - 6) "make install" - - 7) You end up with a "gpg" binary in /usr/local/bin. - - 8) To avoid swapping out of sensitive data, you can install "gpg" - setuid root. If you don't do so, you may want to add the - option "no-secmem-warning" to ~/.gnupg/gpg.conf - - - How to Verify the Source - ------------------------ - - In order to check that the version of GnuPG which you are going to - install is an original and unmodified one, you can do it in one of - the following ways: - - a) If you already have a trusted Version of GnuPG installed, you - can simply check the supplied signature: - - $ gpg --verify gnupg-x.y.z.tar.gz.sig - - This checks that the detached signature gnupg-x.y.z.tar.gz.sig - is indeed a signature of gnupg-x.y.z.tar.gz. The key currently - used to create this signature is: - - "pub 1024R/1CE0C630 2006-01-01 Werner Koch (dist sig) <[email protected]>" - - If you do not have this key, you can get it from the source in - the file doc/samplekeys.asc (use "gpg --import doc/samplekeys.asc" - to add it to the keyring) or from any keyserver. You have to - make sure that this is really the key and not a faked one. You - can do this by comparing the output of: - - $ gpg --fingerprint 0x1CE0C630 - - with the fingerprint published elsewhere. - - Please note, that you have to use an old version of GnuPG to - do all this stuff. *Never* use the version which you are going - to check! - - - b) If you don't have any of the above programs, you have to verify - the SHA1 checksum: - - $ sha1sum gnupg-x.y.z.tar.gz - - This should yield an output _similar_ to this: - - fd9351b26b3189c1d577f0970f9dcadc1234abcd gnupg-x.y.z.tar.gz - - Now check that this checksum is _exactly_ the same as the one - published via the announcement list and probably via Usenet. - - - Documentation - ------------- - - The manual will be distributed separately under the name "gph". - An online version of the latest manual draft is available at the - GnuPG web pages: - - http://www.gnupg.org/documentation/ - - A list of frequently asked questions is available in the GnuPG - distribution in the file doc/FAQ and online as: - - http://www.gnupg.org/documentation/faqs.html - - A couple of HOWTO documents are available online; for a listing see: - - http://www.gnupg.org/documentation/howtos.html - - A man page with a description of all commands and options gets installed - along with the program. - - - Introduction - ------------ - - Here is a brief overview on how to use GnuPG - it is strongly suggested - that you read the manual and other information about the use of - cryptography. GnuPG is only a tool, secure usage requires that - YOU KNOW WHAT YOU ARE DOING. - - The first time you run gpg, it will create a .gnupg directory in - your home directory and populate it with a default configuration - file. Once this is done, you may create a new key, or if you - already have keyrings from PGP, you can import them into GnuPG - with: - - gpg --import path/to/pgp/keyring/pubring.pkr - and - gpg --import path/to/pgp/keyring/secring.skr - - The normal way to create a key is - - gpg --gen-key - - This asks some questions and then starts key generation. To create - good random numbers for the key parameters, GnuPG needs to gather - enough noise (entropy) from your system. If you see no progress - during key generation you should start some other activities such - as moving the mouse or hitting the CTRL and SHIFT keys. - - Generate a key ONLY on a machine where you have direct physical - access - don't do it over the network or on a machine also used - by others, especially if you have no access to the root account. - - When you are asked for a passphrase use a good one which you can - easily remember. Don't make the passphrase too long because you - have to type it for every decryption or signing; but, - AND THIS - IS VERY IMPORTANT - use a good one that is not easily to guess - because the security of the whole system relies on your secret key - and the passphrase that protects it when someone gains access to - your secret keyring. One good way to select a passphrase is to - figure out a short nonsense sentence which makes some sense for - you and modify it by inserting extra spaces, non-letters and - changing the case of some characters - this is really easy to - remember especially if you associate some pictures with it. - - Next, you should create a revocation certificate in case someone - gets knowledge of your secret key or you forgot your passphrase - - gpg --gen-revoke your_user_id - - Run this command and store the revocation certificate away. The output - is always ASCII armored, so that you can print it and (hopefully - never) re-create it if your electronic media fails. - - Now you can use your key to create digital signatures - - gpg -s file - - This creates a file "file.gpg" which is compressed and has a - signature attached. - - gpg -sa file - - Same as above, but creates a file "file.asc" which is ASCII armored - and and ready for sending by mail. It is better to use your - mailers features to create signatures (The mailer uses GnuPG to do - this) because the mailer has the ability to MIME encode such - signatures - but this is not a security issue. - - gpg -s -o out file - - Creates a signature of "file", but writes the output to the file - "out". - - Everyone who knows your public key (you can and should publish - your key by putting it on a key server, a web page or in your .plan - file) is now able to check whether you really signed this text - - gpg --verify file - - GnuPG now checks whether the signature is valid and prints an - appropriate message. If the signature is good, you know at least - that the person (or machine) has access to the secret key which - corresponds to the published public key. - - If you run gpg without an option it will verify the signature and - create a new file that is identical to the original. gpg can also - run as a filter, so that you can pipe data to verify trough it - - cat signed-file | gpg | wc -l - - which will check the signature of signed-file and then display the - number of lines in the original file. - - To send a message encrypted to someone you can use - - gpg -e -r heine file - - This encrypts "file" with the public key of the user "heine" and - writes it to "file.gpg" - - echo "hello" | gpg -ea -r heine | mail heine - - Ditto, but encrypts "hello\n" and mails it as ASCII armored message - to the user with the mail address heine. - - gpg -se -r heine file - - This encrypts "file" with the public key of "heine" and writes it - to "file.gpg" after signing it with your user id. - - gpg -se -r heine -u Suttner file - - Ditto, but sign the file with your alternative user id "Suttner" - - - GnuPG has some options to help you publish public keys. This is - called "exporting" a key, thus - - gpg --export >all-my-keys - - exports all the keys in the keyring and writes them (in a binary - format) to "all-my-keys". You may then mail "all-my-keys" as an - MIME attachment to someone else or put it on an FTP server. To - export only some user IDs, you give them as arguments on the command - line. - - To mail a public key or put it on a web page you have to create - the key in ASCII armored format - - gpg --export --armor | mail [email protected] - - This will send all your public keys to your friend panther. - - If you have received a key from someone else you can put it - into your public keyring. This is called "importing" - - gpg --import [filenames] - - New keys are appended to your keyring and already existing - keys are updated. Note that GnuPG does not import keys that - are not self-signed. - - Because anyone can claim that a public key belongs to her - we must have some way to check that a public key really belongs - to the owner. This can be achieved by comparing the key during - a phone call. Sure, it is not very easy to compare a binary file - by reading the complete hex dump of the file - GnuPG (and nearly - every other program used for management of cryptographic keys) - provides other solutions. - - gpg --fingerprint <username> - - prints the so called "fingerprint" of the given username which - is a sequence of hex bytes (which you may have noticed in mail - sigs or on business cards) that uniquely identifies the public - key - different keys will always have different fingerprints. - It is easy to compare fingerprints by phone and I suggest - that you print your fingerprint on the back of your business - card. To see the fingerprints of the secondary keys, you can - give the command twice; but this is normally not needed. - - If you don't know the owner of the public key you are in trouble. - Suppose however that friend of yours knows someone who knows someone - who has met the owner of the public key at some computer conference. - Suppose that all the people between you and the public key holder - may now act as introducers to you. Introducers signing keys thereby - certify that they know the owner of the keys they sign. If you then - trust all the introducers to have correctly signed other keys, you - can be be sure that the other key really belongs to the one who - claims to own it. - - There are 2 steps to validate a key: - 1. First check that there is a complete chain - of signed keys from the public key you want to use - and your key and verify each signature. - 2. Make sure that you have full trust in the certificates - of all the introduces between the public key holder and - you. - Step 2 is the more complicated part because there is no easy way - for a computer to decide who is trustworthy and who is not. GnuPG - leaves this decision to you and will ask you for a trust value - (here also referenced as the owner-trust of a key) for every key - needed to check the chain of certificates. You may choose from: - a) "I don't know" - then it is not possible to use any - of the chains of certificates, in which this key is used - as an introducer, to validate the target key. Use this if - you don't know the introducer. - b) "I do not trust" - Use this if you know that the introducer - does not do a good job in certifying other keys. The effect - is the same as with a) but for a) you may later want to - change the value because you got new information about this - introducer. - c) "I trust marginally" - Use this if you assume that the - introducer knows what he is doing. Together with some - other marginally trusted keys, GnuPG validates the target - key then as good. - d) "I fully trust" - Use this if you really know that this - introducer does a good job when certifying other keys. - If all the introducer are of this trust value, GnuPG - normally needs only one chain of signatures to validate - a target key okay. (But this may be adjusted with the help - of some options). - This information is confidential because it gives your personal - opinion on the trustworthiness of someone else. Therefore this data - is not stored in the keyring but in the "trustdb" - (~/.gnupg/trustdb.gpg). Do not assign a high trust value just - because the introducer is a friend of yours - decide how well she - understands the implications of key signatures and you may want to - tell her more about public key cryptography so you can later change - the trust value you assigned. - - Okay, here is how GnuPG helps you with key management. Most stuff - is done with the --edit-key command - - gpg --edit-key <keyid or username> - - GnuPG displays some information about the key and then prompts - for a command (enter "help" to see a list of commands and see - the man page for a more detailed explanation). To sign a key - you select the user ID you want to sign by entering the number - that is displayed in the leftmost column (or do nothing if the - key has only one user ID) and then enter the command "sign" and - follow all the prompts. When you are ready, give the command - "save" (or use "quit" to cancel your actions). - - If you want to sign the key with another of your user IDs, you - must give an "-u" option on the command line together with the - "--edit-key". - - Normally you want to sign only one user ID because GnuPG - uses only one and this keeps the public key certificate - small. Because such key signatures are very important you - should make sure that the signatories of your key sign a user ID - which is very likely to stay for a long time - choose one with an - email address you have full control of or do not enter an email - address at all. In future GnuPG will have a way to tell which - user ID is the one with an email address you prefer - because - you have no signatures on this email address it is easy to change - this address. Remember, your signatories sign your public key (the - primary one) together with one of your user IDs - so it is not possible - to change the user ID later without voiding all the signatures. - - Tip: If you hear about a key signing party on a computer conference - join it because this is a very convenient way to get your key - certified (But remember that signatures have nothing to to with the - trust you assign to a key). - - - 8 Ways to Specify a User ID - ---------=----------------- - - There are several ways to specify a user ID, here are some examples. - - * Only by the short keyid (prepend a zero if it begins with A..F): - - "234567C4" - "0F34E556E" - "01347A56A" - "0xAB123456 - - * By a complete keyid: - - "234AABBCC34567C4" - "0F323456784E56EAB" - "01AB3FED1347A5612" - "0x234AABBCC34567C4" - - * By a fingerprint: - - "1234343434343434C434343434343434" - "123434343434343C3434343434343734349A3434" - "0E12343434343434343434EAB3484343434343434" - - The first one is a short fingerprint for PGP 2.x style keys. - The others are long fingerprints for OpenPGP keys. - - * By an exact string: - - "=Heinrich Heine <[email protected]>" - - * By an email address: - - "<[email protected]>" - - * By word match - - "+Heinrich Heine duesseldorf" - - All words must match exactly (not case sensitive) and appear in - any order in the user ID. Words are any sequences of letters, - digits, the underscore and characters with bit 7 set. - - * Or by the usual substring: - - "Heine" - "*Heine" - - The '*' indicates substring search explicitly. - - - Batch mode - ---------- - - If you use the option "--batch", GnuPG runs in non-interactive mode and - never prompts for input data. This does not even allow entering the - passphrase. Until we have a better solution (something like ssh-agent), - you can use the option "--passphrase-fd n", which works like PGP's - PGPPASSFD. - - Batch mode also causes GnuPG to terminate as soon as a BAD signature is - detected. - - - Exit status - ----------- - - GnuPG returns with an exit status of 1 if in batch mode and a bad signature - has been detected or 2 or higher for all other errors. You should parse - stderr or, better, the output of the fd specified with --status-fd to get - detailed information about the errors. - - - Configure options - ----------------- - - Here is a list of configure options which are sometime useful - for installation. - - --enable-static-rnd=<name> - Force the use of the random byte gathering - module <name>. Default is either to use /dev/random - or the auto mode. Value for name: - egd - Use the module which accesses the - Entropy Gathering Daemon. See the webpages - for more information about it. - unix - Use the standard Unix module which does not - have a very good performance. - linux - Use the module which accesses /dev/random. - This is the first choice and the default one - for GNU/Linux or *BSD. - auto - Compile linux, egd and unix in and - automagically select at runtime. - - --with-egd-socket=<name> - This is only used when EGD is used as random - gatherer. GnuPG uses by default "~/.gnupg/entropy" - as the socket to connect EGD. Using this option the - socket name can be changed. You may use any filename - here with 2 exceptions: a filename starting with - "~/" uses the socket in the home directory of the user - and one starting with a "=" uses a socket in the - GnuPG home directory which is "~/.gnupg" by default. - - --without-readline - Do not include support for the readline library - even if it is available. The default is to check - whether the readline library is a available and - use it to allow fancy command line editing. - - --with-included-zlib - Forces usage of the local zlib sources. Default is - to use the (shared) library of the system. - - --with-zlib=<DIR> - Look for the system zlib in DIR. - - --with-bzip2=<DIR> - Look for the system libbz2 in DIR. - - --without-bzip2 - Disable the BZIP2 compression algorithm. - - --with-included-gettext - Forces usage of the local gettext sources instead of - the one provided by your system. - - --disable-nls - Disable NLS support (See the file ABOUT-NLS) - - --enable-m-guard - Enable the integrated malloc checking code. Please - note that this feature does not work on all CPUs - (e.g. SunOS 5.7 on UltraSparc-2) and might give - you a bus error. - - --disable-dynload - If you have problems with dynamic loading, this - option disables all dynamic loading stuff. Note - that the use of dynamic linking is very limited. - - --disable-asm - Do not use assembler modules. It is not possible - to use this on some CPU types. - - --disable-exec - Disable all remote program execution. This - disables photo ID viewing as well as all keyserver - access. - - --disable-photo-viewers - Disable only photo ID viewing. - - --disable-keyserver-helpers - Disable only keyserver helpers. - - --disable-keyserver-path - Disables the user's ability to use the exec-path - feature to add additional search directories when - executing a keyserver helper. - - --with-photo-viewer=FIXED_VIEWER - Force the photo viewer to be FIXED_VIEWER and - disable any ability for the user to change it in - their options file. - - --disable-rsa - Removes support for the RSA public key algorithm. - This can give a smaller gpg binary for places - where space is tight. - - --disable-idea - --disable-cast5 - --disable-blowfish - --disable-aes - --disable-twofish - --disable-sha256 - --disable-sha512 - Removes support for the selected symmetric or hash - algorithm. This can give a smaller gpg binary for - places where space is tight. - - **** Note that if there are existing keys that - have one of these algorithms as a preference, - messages may be received that use one of these - algorithms and you will not be able to decrypt the - message! **** - - The public key preference list can be updated to - match the list of available algorithms by using - "gpg --edit-key (thekey)", and running the - "setpref" command. - - --enable-minimal - Build the smallest gpg binary possible (disables - all optional algorithms, disables keyserver - access, and disables photo IDs). Specifically, - this means --disable-rsa --disable-idea, - --disable-cast5, --disable-blowfish, - --disable-aes, --disable-twofish, - --disable-sha256, --disable-sha512, - --without-bzip2, --disable-exec, - --disable-card-support and - --disable-agent-support. - Configure command lines are read from left to - right, so if you want to have an "almost minimal" - configuration, you can do (for example) - "--enable-minimal --enable-rsa" to have RSA added - to the minimal build. - - --enable-key-cache=SIZE - Set the internal key and UID cache size. This has - a significant impact on performance with large - keyrings. The default is 4096, but for use on - platforms where memory is an issue, it can be set - as low as 5. - - --disable-card-support - Do not include smartcard support. The default is - to include support if all required libraries are - available. - - --disable-agent-support - Do not include support for the gpg-agent. The - default is to include support. - - --enable-selinux-support - This prevents access to certain files and won't - allow import or export of secret keys. - - --enable-noexecstack - Pass option --noexecstack to as. Autdetect wether - the tool chain actually support this. - - --disable-gnupg-iconv - If iconv is available it is used to convert - between utf-8 and the system character set. This - is in general the preferable solution. However - the code is new and under some cirumstances it may - give different output than with the limited old - support. This option allows to explicity disable - the use of iconv. Note, that iconv is also - disabled if gettext has been disabled. - - - Installation Problems - --------------------- - - If you get unresolved externals "gettext" you should run configure - again with the option "--with-included-gettext"; this is version - 0.12.1 which is available at ftp.gnu.org. - - If you have other compile problems, try the configure options - "--with-included-zlib" or "--disable-nls" (See ABOUT-NLS) or - --disable-dynload. - - We can't check all assembler files, so if you have problems - assembling them (or the program crashes) use --disable-asm with - ./configure. If you opt to delete individual replacement files in - hopes of using the remaining ones, be aware that the configure - scripts may consider several subdirectories to get all available - assembler files; be sure to delete the correct ones. The assembler - replacements are in C and in mpi/generic; never delete - udiv-qrnnd.S in any CPU directory, because there may be no C - substitute. Don't forget to delete "config.cache" and run - "./config.status --recheck". We have also heard reports of - problems when using versions of gcc earlier than 2.96 along with a - non-GNU assembler (as). If this applies to your platform, you can - either upgrade gcc to a more recent version, or use the GNU - assembler. - - Some make tools are broken - the best solution is to use GNU's - make. Try gmake or grab the sources from a GNU archive and - install them. - - On some OSF systems you may get unresolved externals. This is a - libtool problem and the workaround is to manually remove all the - "-lc -lz" but the last one from the linker line and execute them - manually. - - On some architectures you see warnings like: - longlong.h:175: warning: function declaration isn't a prototype - or - http.c:647: warning: cast increases required alignment of target type - This doesn't matter and we know about it (actually it is due to - some warning options which we have enabled for gcc) - - If you are cross-compiling and you get an error either building a - tool called "yat2m" or running that tool, the problem is most - likely a bad or missing native compiler. We require a standard - C-89 compiler to produce an executable to be run on the build - platform. You can explicitly set such a compiler with configure - arguments. On HP/UX you might want to try: "CC_FOR_BUILD=c89". - - - - Specific problems on some machines - ---------------------------------- - - * Apple Darwin 6.1: - - ./configure --with-libiconv-prefix=/sw - - * IBM RS/6000 running AIX: - - Due to a change in gcc (since version 2.8) the MPI stuff may - not build. In this case try to run configure using: - CFLAGS="-g -O2 -mcpu=powerpc" ./configure - - * SVR4.2 (ESIX V4.2 cc) - - Due to problems with the ESIX as, you probably want to do - CFLAGS="-O -K pentium" ./configure --disable-asm - - * SunOS 4.1.4 - - ./configure ac_cv_sys_symbol_underscore=yes - - - The Random Device - ----------------- - - Random devices are available in Linux, FreeBSD and OpenBSD. - Operating systems without a random devices must use another - entropy collector. - - This collector works by running a lot of commands that yield more - or less unpredictable output and feds this as entropy into the - random generator - It should work reliably but you should check - whether it produces good output for your version of Unix. There - are some debug options to help you (see cipher/rndunix.c). - - - Creating an RPM package - ----------------------- - - The file scripts/gnupg.spec is used to build a RPM package (both - binary and src): - 1. copy the spec file into /usr/src/redhat/SPECS - 2. copy the tar file into /usr/src/redhat/SOURCES - 3. type: rpm -ba SPECS/gnupg.spec - - Or use the -t (--tarbuild) option of rpm: - 1. rpm -ta gnupg-x.x.x.tar.gz - - The binary rpm file can now be found in /usr/src/redhat/RPMS, source - rpm in /usr/src/redhat/SRPMS - - - Building Universal Binaries on Apple OS X - ----------------------------------------- - - You can build a universal ("fat") binary that will work on both - PPC and Intel Macs with something like: - - ./configure CFLAGS="-arch ppc -arch i386" --disable-endian-check \ - --disable-dependency-tracking --disable-asm - - If you are doing the build on a OS X 10.4 (Tiger) PPC machine you - may need to add "-isysroot /Developer/SDKs/MacOSX10.4u.sdk" to - those CFLAGS. This additional isysroot is not necessary on Intel - Tiger boxes, or any OS X 10.5 (Leopard) or later boxes. - - Note that when building a universal binary, any third-party - libraries you may link with need to be universal as well. All - Apple-supplied libraries (even libraries not originally written by - Apple like curl, zip, and BZ2) are universal. - - - GnuPG 1.4 and GnuPG 2.0 - ----------------------- - - GnuPG 2.0 is a newer version of GnuPG with additional support for - S/MIME. It has a different design philosophy that splits - functionality up into several modules. Both versions may be - installed simultaneously without any conflict (gpg is called gpg2 - in GnuPG 2). In fact, the gpg version from GnuPG 1.4 is able to - make use of the gpg-agent as included in GnuPG 2 and allows for - seamless passphrase caching. The advantage of GnupG 1.4 is its - smaller size and no dependency on other modules at run and build - time. - - - How to Get More Information - --------------------------- - - The primary WWW page is "http://www.gnupg.org" - The primary FTP site is "ftp://ftp.gnupg.org/gcrypt/" - - See http://www.gnupg.org/download/mirrors.html for a list of - mirrors and use them if possible. You may also find GnuPG - mirrored on some of the regular GNU mirrors. - - We have some mailing lists dedicated to GnuPG: - - [email protected] For important announcements like - new versions and such stuff. - This is a moderated list and has - very low traffic. Do not post to - this list. - - [email protected] For general user discussion and - help (English). - - [email protected] German speaking counterpart of - gnupg-users. - - [email protected] Russian speaking counterpart of - gnupg-users. - - [email protected] GnuPG developers main forum. - - You subscribe to one of the list by sending mail with a subject - of "subscribe" to [email protected], where x is the name of the - mailing list (gnupg-announce, gnupg-users, etc.). An archive of - the mailing lists are available at - http://www.gnupg.org/documentation/mailing-lists.html - - Please direct bug reports to http://bugs.gnupg.org or post - them direct to the mailing list <[email protected]>. - - Please direct questions about GnuPG to the users mailing list or - one of the pgp newsgroups; please do not direct questions to one - of the authors directly as we are busy working on improvements and - bug fixes. The English and German mailing lists are watched by - the authors and we try to answer questions when time allows us to - do so. - - Commercial grade support for GnuPG is available; please see - http://www.gnupg.org/service.html . diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ada40b82..0158ef6c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,8 +6,8 @@ aux_source_directory(. BASE_SOURCE) file(GLOB_RECURSE GPG4USB_HEADER_FILES RELACTIVE ../include/* *.h) qt5_wrap_cpp(QT5_MOCS ${GPG4USB_HEADER_FILES} TARGET gpg4usb) -add_executable(gpg4usb ${BASE_SOURCE} ../gpg4usb.qrc ${QT5_MOCS} ../include/gpg/GpgGenKeyInfo.h) +add_executable(gpg4usb ${BASE_SOURCE} ../gpg4usb.qrc ${QT5_MOCS}) target_link_libraries(gpg4usb qtui gpg - Qt5::Network Qt5::PrintSupport Qt5::Widgets Qt5::Test Qt5::Core)
\ No newline at end of file + Qt5::Network Qt5::PrintSupport Qt5::Widgets Qt5::Test Qt5::Core) diff --git a/src/gpg/CMakeLists.txt b/src/gpg/CMakeLists.txt index 7e3df7de..0c164844 100644 --- a/src/gpg/CMakeLists.txt +++ b/src/gpg/CMakeLists.txt @@ -7,5 +7,5 @@ set(UTILS_DIR ${CMAKE_SOURCE_DIR}/utils) set(GPGME_LIB_DIR ${UTILS_DIR}/gpgme/lib) target_link_libraries(gpg - ${GPGME_LIB_DIR}/libgpgme.a ${GPGME_LIB_DIR}/libgpg-error.a ${GPGME_LIB_DIR}/libassuan.a - Qt5::Network Qt5::PrintSupport Qt5::Widgets Qt5::Test Qt5::Core)
\ No newline at end of file + gpgme gpg-error assuan + Qt5::Network Qt5::PrintSupport Qt5::Widgets Qt5::Test Qt5::Core) diff --git a/utils/gpgme/include/assuan.h b/utils/gpgme/include/assuan.h deleted file mode 100644 index 6a072aa8..00000000 --- a/utils/gpgme/include/assuan.h +++ /dev/null @@ -1,709 +0,0 @@ -/* assuan.h - Definitions for the Assuan IPC library -*- c -*- - * Copyright (C) 2001-2013 Free Software Foundation, Inc. - * Copyright (C) 2001-2021 g10 Code GmbH - * - * This file is part of Assuan. - * - * Assuan 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. - * - * Assuan 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 <http://www.gnu.org/licenses/>. - * SPDX-License-Identifier: LGPL-2.1-or-later - * - * Do not edit. Generated from assuan.h.in by mkheader for linux-gnu. - */ - -/* Compile time configuration: - * - * #define _ASSUAN_NO_SOCKET_WRAPPER - * - * Do not include the definitions for the socket wrapper feature. - */ - -#ifndef ASSUAN_H -#define ASSUAN_H - -#include <stdio.h> -#include <sys/types.h> -#include <unistd.h> -#include <stdarg.h> - -#ifndef _ASSUAN_NO_SOCKET_WRAPPER -#include <sys/socket.h> -#endif /*!_ASSUAN_NO_SOCKET_WRAPPER*/ - -typedef struct msghdr *assuan_msghdr_t; - -#include <gpg-error.h> - -#ifdef __cplusplus -extern "C" -{ -#if 0 -} -#endif -#endif - -/* The version of this header should match the one of the library. Do - * not use this symbol in your application; use assuan_check_version - * instead. */ -#define ASSUAN_VERSION "2.5.5" - -/* The version number of this header. It may be used to handle minor - * API incompatibilities. */ -#define ASSUAN_VERSION_NUMBER 0x020505 - - -/* Check for compiler features. */ -#if __GNUC__ -#define _ASSUAN_GCC_VERSION (__GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__) - -#if _ASSUAN_GCC_VERSION > 30100 -#define _ASSUAN_DEPRECATED __attribute__ ((__deprecated__)) -#endif -#endif -#ifndef _ASSUAN_DEPRECATED -#define _ASSUAN_DEPRECATED -#endif - - -#define ASSUAN_LINELENGTH 1002 /* 1000 + [CR,]LF */ - -struct assuan_context_s; -typedef struct assuan_context_s *assuan_context_t; - -typedef int assuan_fd_t; -#define ASSUAN_INVALID_FD (-1) -#define ASSUAN_INVALID_PID ((pid_t) -1) -static GPG_ERR_INLINE assuan_fd_t -assuan_fd_from_posix_fd (int fd) -{ - return fd; -} - - -assuan_fd_t assuan_fdopen (int fd); - -/* Under Windows Assuan features an emulation of Unix domain sockets - based on a local TCP connections. To implement access permissions - based on file permissions a nonce is used which is expected by the - server as the first bytes received. On POSIX systems this is a - dummy structure. */ -struct assuan_sock_nonce_s -{ - size_t length; -}; -typedef struct assuan_sock_nonce_s assuan_sock_nonce_t; - - -/* - * Global interface. - */ - -struct assuan_malloc_hooks -{ - void *(*malloc) (size_t cnt); - void *(*realloc) (void *ptr, size_t cnt); - void (*free) (void *ptr); -}; -typedef struct assuan_malloc_hooks *assuan_malloc_hooks_t; - -/* Categories for log messages. */ -#define ASSUAN_LOG_INIT 1 -#define ASSUAN_LOG_CTX 2 -#define ASSUAN_LOG_ENGINE 3 -#define ASSUAN_LOG_DATA 4 -#define ASSUAN_LOG_SYSIO 5 -#define ASSUAN_LOG_CONTROL 8 - -/* If MSG is NULL, return true/false depending on if this category is - * logged. This is used to probe before expensive log message - * generation (buffer dumps). */ -typedef int (*assuan_log_cb_t) (assuan_context_t ctx, void *hook, - unsigned int cat, const char *msg); - -/* Return or check the version number. */ -const char *assuan_check_version (const char *req_version); - -/* Set the default gpg error source. */ -void assuan_set_gpg_err_source (gpg_err_source_t errsource); - -/* Get the default gpg error source. */ -gpg_err_source_t assuan_get_gpg_err_source (void); - - -/* Set the default malloc hooks. */ -void assuan_set_malloc_hooks (assuan_malloc_hooks_t malloc_hooks); - -/* Get the default malloc hooks. */ -assuan_malloc_hooks_t assuan_get_malloc_hooks (void); - - -/* Set the default log callback handler. */ -void assuan_set_log_cb (assuan_log_cb_t log_cb, void *log_cb_data); - -/* Get the default log callback handler. */ -void assuan_get_log_cb (assuan_log_cb_t *log_cb, void **log_cb_data); - - -/* Create a new Assuan context. The initial parameters are all needed - * in the creation of the context. */ -gpg_error_t assuan_new_ext (assuan_context_t *ctx, gpg_err_source_t errsource, - assuan_malloc_hooks_t malloc_hooks, - assuan_log_cb_t log_cb, void *log_cb_data); - -/* Create a new context with default arguments. */ -gpg_error_t assuan_new (assuan_context_t *ctx); - -/* Release all resources associated with the given context. */ -void assuan_release (assuan_context_t ctx); - -/* Release the memory at PTR using the allocation handler of the - * context CTX. This is a convenience function. */ -void assuan_free (assuan_context_t ctx, void *ptr); - - -/* Set user-data in a context. */ -void assuan_set_pointer (assuan_context_t ctx, void *pointer); - -/* Get user-data in a context. */ -void *assuan_get_pointer (assuan_context_t ctx); - - -/* Definitions of flags for assuan_set_flag(). */ -typedef unsigned int assuan_flag_t; - -/* When using a pipe server, by default Assuan will wait for the - * forked process to die in assuan_release. In certain cases this - * is not desirable. By setting this flag, the waitpid will be - * skipped and the caller is responsible to cleanup a forked - * process. */ -#define ASSUAN_NO_WAITPID 1 - -/* This flag indicates whether Assuan logging is in confidential mode. - You can use assuan_{begin,end}_condidential to change the mode. */ -#define ASSUAN_CONFIDENTIAL 2 - -/* This flag suppresses fix up of signal handlers for pipes. */ -#define ASSUAN_NO_FIXSIGNALS 3 - -/* This flag changes assuan_transact to return comment lines via the - * status callback. The default is to skip comment lines. */ -#define ASSUAN_CONVEY_COMMENTS 4 - -/* This flag disables logging for one context. */ -#define ASSUAN_NO_LOGGING 5 - -/* This flag forces a connection close. */ -#define ASSUAN_FORCE_CLOSE 6 - - -/* For context CTX, set the flag FLAG to VALUE. Values for flags - * are usually 1 or 0 but certain flags might allow for other values; - * see the description of the type assuan_flag_t for details. */ -void assuan_set_flag (assuan_context_t ctx, assuan_flag_t flag, int value); - -/* Return the VALUE of FLAG in context CTX. */ -int assuan_get_flag (assuan_context_t ctx, assuan_flag_t flag); - -/* Same as assuan_set_flag (ctx, ASSUAN_CONFIDENTIAL, 1). */ -void assuan_begin_confidential (assuan_context_t ctx); - -/* Same as assuan_set_flag (ctx, ASSUAN_CONFIDENTIAL, 0). */ -void assuan_end_confidential (assuan_context_t ctx); - - -/* Direction values for assuan_set_io_monitor. */ -#define ASSUAN_IO_FROM_PEER 0 -#define ASSUAN_IO_TO_PEER 1 - -/* Return flags of I/O monitor. */ -#define ASSUAN_IO_MONITOR_NOLOG 1 -#define ASSUAN_IO_MONITOR_IGNORE 2 - -/* The IO monitor gets to see all I/O on the context, and can return - * ASSUAN_IO_MONITOR_* bits to control actions on it. */ -typedef unsigned int (*assuan_io_monitor_t) (assuan_context_t ctx, void *hook, - int inout, const char *line, - size_t linelen); - -/* Set the IO monitor function. */ -void assuan_set_io_monitor (assuan_context_t ctx, - assuan_io_monitor_t io_monitor, void *hook_data); - -/* The system hooks. See assuan_set_system_hooks et al. */ -#define ASSUAN_SYSTEM_HOOKS_VERSION 2 -#define ASSUAN_SPAWN_DETACHED 128 -struct assuan_system_hooks -{ - /* Always set to ASSUAN_SYTEM_HOOKS_VERSION. */ - int version; - - /* Sleep for the given number of microseconds. */ - void (*usleep) (assuan_context_t ctx, unsigned int usec); - - /* Create a pipe with an inheritable end. */ - int (*pipe) (assuan_context_t ctx, assuan_fd_t fd[2], int inherit_idx); - - /* Close the given file descriptor, created with _assuan_pipe or one - of the socket functions. */ - int (*close) (assuan_context_t ctx, assuan_fd_t fd); - - - ssize_t (*read) (assuan_context_t ctx, assuan_fd_t fd, void *buffer, - size_t size); - ssize_t (*write) (assuan_context_t ctx, assuan_fd_t fd, - const void *buffer, size_t size); - - int (*recvmsg) (assuan_context_t ctx, assuan_fd_t fd, assuan_msghdr_t msg, - int flags); - int (*sendmsg) (assuan_context_t ctx, assuan_fd_t fd, - const assuan_msghdr_t msg, int flags); - - /* If NAME is NULL, don't exec, just fork. FD_CHILD_LIST is - modified to reflect the value of the FD in the peer process (on - Windows). */ - int (*spawn) (assuan_context_t ctx, pid_t *r_pid, const char *name, - const char **argv, - assuan_fd_t fd_in, assuan_fd_t fd_out, - assuan_fd_t *fd_child_list, - void (*atfork) (void *opaque, int reserved), - void *atforkvalue, unsigned int flags); - - /* If action is 0, like waitpid. If action is 1, just release the PID? */ - pid_t (*waitpid) (assuan_context_t ctx, pid_t pid, - int action, int *status, int options); - int (*socketpair) (assuan_context_t ctx, int _namespace, int style, - int protocol, assuan_fd_t filedes[2]); - int (*socket) (assuan_context_t ctx, int _namespace, int style, int protocol); - int (*connect) (assuan_context_t ctx, int sock, struct sockaddr *addr, socklen_t length); -}; -typedef struct assuan_system_hooks *assuan_system_hooks_t; - - - -/* - * Configuration of the default log handler. - */ - -/* Set the prefix to be used at the start of a line emitted by assuan - * on the log stream. The default is the empty string. Note, that - * this function is not thread-safe and should in general be used - * right at startup. */ -void assuan_set_assuan_log_prefix (const char *text); - -/* Return a prefix to be used at the start of a line emitted by assuan - * on the log stream. The default implementation returns the empty - * string, i.e. "". */ -const char *assuan_get_assuan_log_prefix (void); - -/* Global default log stream. */ -void assuan_set_assuan_log_stream (FILE *fp); - -/* Set the per context log stream for the default log handler. */ -void assuan_set_log_stream (assuan_context_t ctx, FILE *fp); - - -/* The type for assuan command handlers. */ -typedef gpg_error_t (*assuan_handler_t) (assuan_context_t, char *); - -/*-- assuan-handler.c --*/ -gpg_error_t assuan_register_command (assuan_context_t ctx, - const char *cmd_string, - assuan_handler_t handler, - const char *help_string); -gpg_error_t assuan_register_pre_cmd_notify (assuan_context_t ctx, - gpg_error_t (*fnc)(assuan_context_t, - const char *cmd)); - -gpg_error_t assuan_register_post_cmd_notify (assuan_context_t ctx, - void (*fnc)(assuan_context_t, - gpg_error_t)); -gpg_error_t assuan_register_bye_notify (assuan_context_t ctx, - assuan_handler_t handler); -gpg_error_t assuan_register_reset_notify (assuan_context_t ctx, - assuan_handler_t handler); -gpg_error_t assuan_register_cancel_notify (assuan_context_t ctx, - assuan_handler_t handler); -gpg_error_t assuan_register_input_notify (assuan_context_t ctx, - assuan_handler_t handler); -gpg_error_t assuan_register_output_notify (assuan_context_t ctx, - assuan_handler_t handler); - -gpg_error_t assuan_register_option_handler (assuan_context_t ctx, - gpg_error_t (*fnc)(assuan_context_t, - const char*, - const char*)); - -gpg_error_t assuan_process (assuan_context_t ctx); -gpg_error_t assuan_process_next (assuan_context_t ctx, int *done); -gpg_error_t assuan_process_done (assuan_context_t ctx, gpg_error_t rc); -int assuan_get_active_fds (assuan_context_t ctx, int what, - assuan_fd_t *fdarray, int fdarraysize); - -const char *assuan_get_command_name (assuan_context_t ctx); - -FILE *assuan_get_data_fp (assuan_context_t ctx); -gpg_error_t assuan_set_okay_line (assuan_context_t ctx, const char *line); -gpg_error_t assuan_write_status (assuan_context_t ctx, - const char *keyword, const char *text); - -/* Negotiate a file descriptor. If LINE contains "FD=N", returns N - * assuming a local file descriptor. If LINE contains "FD" reads a - * file descriptor via CTX and stores it in *RDF (the CTX must be - * capable of passing file descriptors). Under Windows the returned - * FD is a libc-type one. */ -gpg_error_t assuan_command_parse_fd (assuan_context_t ctx, char *line, - assuan_fd_t *rfd); - - -/*-- assuan-listen.c --*/ -gpg_error_t assuan_set_hello_line (assuan_context_t ctx, const char *line); -gpg_error_t assuan_accept (assuan_context_t ctx); -assuan_fd_t assuan_get_input_fd (assuan_context_t ctx); -assuan_fd_t assuan_get_output_fd (assuan_context_t ctx); -gpg_error_t assuan_close_input_fd (assuan_context_t ctx); -gpg_error_t assuan_close_output_fd (assuan_context_t ctx); - - -/*-- assuan-pipe-server.c --*/ -gpg_error_t assuan_init_pipe_server (assuan_context_t ctx, - assuan_fd_t filedes[2]); - -/*-- assuan-socket-server.c --*/ -#define ASSUAN_SOCKET_SERVER_FDPASSING 1 -#define ASSUAN_SOCKET_SERVER_ACCEPTED 2 -gpg_error_t assuan_init_socket_server (assuan_context_t ctx, - assuan_fd_t listen_fd, - unsigned int flags); -void assuan_set_sock_nonce (assuan_context_t ctx, assuan_sock_nonce_t *nonce); - -/*-- assuan-pipe-connect.c --*/ -#define ASSUAN_PIPE_CONNECT_FDPASSING 1 -#define ASSUAN_PIPE_CONNECT_DETACHED 128 -gpg_error_t assuan_pipe_connect (assuan_context_t ctx, - const char *name, - const char *argv[], - assuan_fd_t *fd_child_list, - void (*atfork) (void *, int), - void *atforkvalue, - unsigned int flags); - -/*-- assuan-socket-connect.c --*/ -#define ASSUAN_SOCKET_CONNECT_FDPASSING 1 -gpg_error_t assuan_socket_connect (assuan_context_t ctx, const char *name, - pid_t server_pid, unsigned int flags); - -/*-- assuan-socket-connect.c --*/ -gpg_error_t assuan_socket_connect_fd (assuan_context_t ctx, int fd, - unsigned int flags); - -/*-- context.c --*/ -pid_t assuan_get_pid (assuan_context_t ctx); -struct _assuan_peercred -{ -#ifdef _WIN32 - /* Empty struct not allowed on some compilers, so, put this (not valid). */ - pid_t pid; -#else - pid_t pid; - uid_t uid; - gid_t gid; -#endif -}; -typedef struct _assuan_peercred *assuan_peercred_t; - -gpg_error_t assuan_get_peercred (assuan_context_t ctx, - assuan_peercred_t *peercred); - - - -/* - * Client interface. - */ - -/* Client response codes. */ -#define ASSUAN_RESPONSE_ERROR 0 -#define ASSUAN_RESPONSE_OK 1 -#define ASSUAN_RESPONSE_DATA 2 -#define ASSUAN_RESPONSE_INQUIRE 3 -#define ASSUAN_RESPONSE_STATUS 4 -#define ASSUAN_RESPONSE_END 5 -#define ASSUAN_RESPONSE_COMMENT 6 -typedef int assuan_response_t; - -/* This already de-escapes data lines. */ -gpg_error_t assuan_client_read_response (assuan_context_t ctx, - char **line, int *linelen); - -gpg_error_t assuan_client_parse_response (assuan_context_t ctx, - char *line, int linelen, - assuan_response_t *response, - int *off); - -/*-- assuan-client.c --*/ -gpg_error_t -assuan_transact (assuan_context_t ctx, - const char *command, - gpg_error_t (*data_cb)(void *, const void *, size_t), - void *data_cb_arg, - gpg_error_t (*inquire_cb)(void*, const char *), - void *inquire_cb_arg, - gpg_error_t (*status_cb)(void*, const char *), - void *status_cb_arg); - - -/*-- assuan-inquire.c --*/ -gpg_error_t assuan_inquire (assuan_context_t ctx, const char *keyword, - unsigned char **r_buffer, size_t *r_length, - size_t maxlen); -gpg_error_t assuan_inquire_ext (assuan_context_t ctx, const char *keyword, - size_t maxlen, - gpg_error_t (*cb) (void *cb_data, - gpg_error_t rc, - unsigned char *buf, - size_t buf_len), - void *cb_data); -/*-- assuan-buffer.c --*/ -gpg_error_t assuan_read_line (assuan_context_t ctx, - char **line, size_t *linelen); -int assuan_pending_line (assuan_context_t ctx); -gpg_error_t assuan_write_line (assuan_context_t ctx, const char *line); -gpg_error_t assuan_send_data (assuan_context_t ctx, - const void *buffer, size_t length); - -/* The file descriptor must be pending before assuan_receivefd is - * called. This means that assuan_sendfd should be called *before* the - * trigger is sent (normally via assuan_write_line ("INPUT FD")). */ -gpg_error_t assuan_sendfd (assuan_context_t ctx, assuan_fd_t fd); -gpg_error_t assuan_receivefd (assuan_context_t ctx, assuan_fd_t *fd); - - -/*-- assuan-util.c --*/ -gpg_error_t assuan_set_error (assuan_context_t ctx, gpg_error_t err, - const char *text); - - - -/*-- assuan-socket.c --*/ - -/* This flag is used with assuan_sock_connect_byname to - * connect via SOCKS. */ -#define ASSUAN_SOCK_SOCKS 1 - -/* This flag is used with assuan_sock_connect_byname to force a - connection via Tor even if the socket subsystem has not been - swicthed into Tor mode. This flags overrides ASSUAN_SOCK_SOCKS. */ -#define ASSUAN_SOCK_TOR 2 - -/* These are socket wrapper functions to support an emulation of Unix - * domain sockets on Windows. */ -gpg_error_t assuan_sock_init (void); -void assuan_sock_deinit (void); -int assuan_sock_close (assuan_fd_t fd); -assuan_fd_t assuan_sock_new (int domain, int type, int proto); -int assuan_sock_set_flag (assuan_fd_t sockfd, const char *name, int value); -int assuan_sock_get_flag (assuan_fd_t sockfd, const char *name, int *r_value); -int assuan_sock_connect (assuan_fd_t sockfd, - struct sockaddr *addr, int addrlen); -assuan_fd_t assuan_sock_connect_byname (const char *host, unsigned short port, - int reserved, - const char *credentials, - unsigned int flags); -int assuan_sock_bind (assuan_fd_t sockfd, struct sockaddr *addr, int addrlen); -int assuan_sock_set_sockaddr_un (const char *fname, struct sockaddr *addr, - int *r_redirected); -int assuan_sock_get_nonce (struct sockaddr *addr, int addrlen, - assuan_sock_nonce_t *nonce); -int assuan_sock_check_nonce (assuan_fd_t fd, assuan_sock_nonce_t *nonce); -void assuan_sock_set_system_hooks (assuan_system_hooks_t system_hooks); - - -/* Set the default system callbacks. This is irreversible. */ -void assuan_set_system_hooks (assuan_system_hooks_t system_hooks); - -/* Set the per context system callbacks. This is irreversible. */ -void assuan_ctx_set_system_hooks (assuan_context_t ctx, - assuan_system_hooks_t system_hooks); - -/* Change the system hooks for the socket interface. - * This is not thread-safe. */ -void assuan_sock_set_system_hooks (assuan_system_hooks_t system_hooks); - -void __assuan_usleep (assuan_context_t ctx, unsigned int usec); -int __assuan_pipe (assuan_context_t ctx, assuan_fd_t fd[2], int inherit_idx); -int __assuan_close (assuan_context_t ctx, assuan_fd_t fd); -int __assuan_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name, - const char **argv, assuan_fd_t fd_in, assuan_fd_t fd_out, - assuan_fd_t *fd_child_list, - void (*atfork) (void *opaque, int reserved), - void *atforkvalue, unsigned int flags); -int __assuan_socketpair (assuan_context_t ctx, int _namespace, int style, - int protocol, assuan_fd_t filedes[2]); -int __assuan_socket (assuan_context_t ctx, int _namespace, int style, int protocol); -int __assuan_connect (assuan_context_t ctx, int sock, struct sockaddr *addr, socklen_t length); -ssize_t __assuan_read (assuan_context_t ctx, assuan_fd_t fd, void *buffer, size_t size); -ssize_t __assuan_write (assuan_context_t ctx, assuan_fd_t fd, const void *buffer, size_t size); -int __assuan_recvmsg (assuan_context_t ctx, assuan_fd_t fd, assuan_msghdr_t msg, int flags); -int __assuan_sendmsg (assuan_context_t ctx, assuan_fd_t fd, const assuan_msghdr_t msg, int flags); -pid_t __assuan_waitpid (assuan_context_t ctx, pid_t pid, int nowait, int *status, int options); - -/* Standard system hooks for the legacy GNU Pth. */ -#define ASSUAN_SYSTEM_PTH_IMPL \ - static void _assuan_pth_usleep (assuan_context_t ctx, unsigned int usec) \ - { (void) ctx; pth_usleep (usec); } \ - static ssize_t _assuan_pth_read (assuan_context_t ctx, assuan_fd_t fd, \ - void *buffer, size_t size) \ - { (void) ctx; return pth_read (fd, buffer, size); } \ - static ssize_t _assuan_pth_write (assuan_context_t ctx, assuan_fd_t fd, \ - const void *buffer, size_t size) \ - { (void) ctx; return pth_write (fd, buffer, size); } \ - static int _assuan_pth_recvmsg (assuan_context_t ctx, assuan_fd_t fd, \ - assuan_msghdr_t msg, int flags) \ - { \ - /* Pth does not provide a recvmsg function. We implement it. */ \ - int ret; \ - int fdmode; \ - \ - (void) ctx; \ - fdmode = pth_fdmode (fd, PTH_FDMODE_POLL); \ - if (fdmode == PTH_FDMODE_ERROR) \ - { \ - errno = EBADF; \ - return -1; \ - } \ - if (fdmode == PTH_FDMODE_BLOCK) \ - { \ - fd_set fds; \ - \ - FD_ZERO (&fds); \ - FD_SET (fd, &fds); \ - while ((ret = pth_select (fd + 1, &fds, NULL, NULL, NULL)) < 0 \ - && errno == EINTR) \ - ; \ - if (ret < 0) \ - return -1; \ - } \ - \ - while ((ret = recvmsg (fd, msg, flags)) == -1 && errno == EINTR) \ - ; \ - return ret; \ - } \ - static int _assuan_pth_sendmsg (assuan_context_t ctx, assuan_fd_t fd, \ - const assuan_msghdr_t msg, int flags) \ - { \ - /* Pth does not provide a sendmsg function. We implement it. */ \ - int ret; \ - int fdmode; \ - \ - (void) ctx; \ - fdmode = pth_fdmode (fd, PTH_FDMODE_POLL); \ - if (fdmode == PTH_FDMODE_ERROR) \ - { \ - errno = EBADF; \ - return -1; \ - } \ - if (fdmode == PTH_FDMODE_BLOCK) \ - { \ - fd_set fds; \ - \ - FD_ZERO (&fds); \ - FD_SET (fd, &fds); \ - while ((ret = pth_select (fd + 1, NULL, &fds, NULL, NULL)) < 0 \ - && errno == EINTR) \ - ; \ - if (ret < 0) \ - return -1; \ - } \ - \ - while ((ret = sendmsg (fd, msg, flags)) == -1 && errno == EINTR) \ - ; \ - return ret; \ - } \ - static pid_t _assuan_pth_waitpid (assuan_context_t ctx, pid_t pid, \ - int nowait, int *status, int options) \ - { (void) ctx; \ - if (!nowait) return pth_waitpid (pid, status, options); \ - else return 0; } \ - \ - struct assuan_system_hooks _assuan_system_pth = \ - { ASSUAN_SYSTEM_HOOKS_VERSION, _assuan_pth_usleep, __assuan_pipe, \ - __assuan_close, _assuan_pth_read, _assuan_pth_write, \ - _assuan_pth_recvmsg, _assuan_pth_sendmsg, \ - __assuan_spawn, _assuan_pth_waitpid, __assuan_socketpair, \ - __assuan_socket, __assuan_connect } - -extern struct assuan_system_hooks _assuan_system_pth; -#define ASSUAN_SYSTEM_PTH &_assuan_system_pth - -/* Standard system hooks for nPth. */ -#define ASSUAN_SYSTEM_NPTH_IMPL \ - static void _assuan_npth_usleep (assuan_context_t ctx, unsigned int usec) \ - { npth_unprotect(); \ - __assuan_usleep (ctx, usec); \ - npth_protect(); } \ - static ssize_t _assuan_npth_read (assuan_context_t ctx, assuan_fd_t fd, \ - void *buffer, size_t size) \ - { ssize_t res; (void) ctx; npth_unprotect(); \ - res = __assuan_read (ctx, fd, buffer, size); \ - npth_protect(); return res; } \ - static ssize_t _assuan_npth_write (assuan_context_t ctx, assuan_fd_t fd, \ - const void *buffer, size_t size) \ - { ssize_t res; (void) ctx; npth_unprotect(); \ - res = __assuan_write (ctx, fd, buffer, size); \ - npth_protect(); return res; } \ - static int _assuan_npth_recvmsg (assuan_context_t ctx, assuan_fd_t fd, \ - assuan_msghdr_t msg, int flags) \ - { int res; (void) ctx; npth_unprotect(); \ - res = __assuan_recvmsg (ctx, fd, msg, flags); \ - npth_protect(); return res; } \ - static int _assuan_npth_sendmsg (assuan_context_t ctx, assuan_fd_t fd, \ - const assuan_msghdr_t msg, int flags) \ - { int res; (void) ctx; npth_unprotect(); \ - res = __assuan_sendmsg (ctx, fd, msg, flags); \ - npth_protect(); return res; } \ - static pid_t _assuan_npth_waitpid (assuan_context_t ctx, pid_t pid, \ - int nowait, int *status, int options) \ - { pid_t res; (void) ctx; npth_unprotect(); \ - res = __assuan_waitpid (ctx, pid, nowait, status, options); \ - npth_protect(); return res; } \ - static int _assuan_npth_connect (assuan_context_t ctx, int sock, \ - struct sockaddr *addr, socklen_t len)\ - { int res; npth_unprotect(); \ - res = __assuan_connect (ctx, sock, addr, len); \ - npth_protect(); return res; } \ - static int _assuan_npth_close (assuan_context_t ctx, assuan_fd_t fd) \ - { int res; npth_unprotect(); \ - res = __assuan_close (ctx, fd); \ - npth_protect(); return res; } \ - \ - struct assuan_system_hooks _assuan_system_npth = \ - { ASSUAN_SYSTEM_HOOKS_VERSION, _assuan_npth_usleep, __assuan_pipe, \ - _assuan_npth_close, _assuan_npth_read, _assuan_npth_write, \ - _assuan_npth_recvmsg, _assuan_npth_sendmsg, \ - __assuan_spawn, _assuan_npth_waitpid, __assuan_socketpair, \ - __assuan_socket, _assuan_npth_connect } - -extern struct assuan_system_hooks _assuan_system_npth; -#define ASSUAN_SYSTEM_NPTH &_assuan_system_npth - - -#ifdef __cplusplus -} -#endif -#endif /* ASSUAN_H */ -/* -Local Variables: -buffer-read-only: t -End: -*/ diff --git a/utils/gpgme/include/gpg-error.h b/utils/gpgme/include/gpg-error.h deleted file mode 100644 index f5325cf5..00000000 --- a/utils/gpgme/include/gpg-error.h +++ /dev/null @@ -1,2005 +0,0 @@ -/* gpg-error.h or gpgrt.h - Common code for GnuPG and others. -*- c -*- - * Copyright (C) 2001-2020 g10 Code GmbH - * - * This file is part of libgpg-error (aka libgpgrt). - * - * libgpg-error 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. - * - * libgpg-error 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/>. - * SPDX-License-Identifier: LGPL-2.1+ - * - * Do not edit. Generated from gpg-error.h.in for: - x86_64-unknown-linux-gnu (x86_64-pc-linux-gnu) - */ - -/* The GnuPG project consists of many components. Error codes are - * exchanged between all components. The common error codes and their - * user-presentable descriptions are kept into a shared library to - * allow adding new error codes and components without recompiling any - * of the other components. In addition to error codes this library - * also features several other groups of functions which are common to - * all GnuPG components. They may be used by independet project as - * well. The interfaces will not change in a backward incompatible way. - * - * An error code together with an error source build up an error - * value. As the error value is been passed from one component to - * another, it preserves the information about the source and nature - * of the error. - * - * A component of the GnuPG project can define the following macros to - * tune the behaviour of the library: - * - * GPG_ERR_SOURCE_DEFAULT: Define to an error source of type - * gpg_err_source_t to make that source the default for gpg_error(). - * Otherwise GPG_ERR_SOURCE_UNKNOWN is used as default. - * - * GPG_ERR_ENABLE_GETTEXT_MACROS: Define to provide macros to map the - * internal gettext API to standard names. This has only an effect on - * Windows platforms. - * - * GPGRT_ENABLE_ES_MACROS: Define to provide "es_" macros for the - * estream functions. - * - * GPGRT_ENABLE_LOG_MACROS: Define to provide short versions of the - * log functions. - * - * GPGRT_ENABLE_ARGPARSE_MACROS: Needs to be defined to provide the - * mandatory macros of the argparse interface. - */ - -#ifndef GPG_ERROR_H -#define GPG_ERROR_H 1 -#ifndef GPGRT_H -#define GPGRT_H 1 - -#include <stddef.h> -#include <stdio.h> -#include <stdarg.h> - -/* The version string of this header. */ -#define GPG_ERROR_VERSION "1.42" -#define GPGRT_VERSION "1.42" - -/* The version number of this header. */ -#define GPG_ERROR_VERSION_NUMBER 0x012a00 -#define GPGRT_VERSION_NUMBER 0x012a00 - - -#ifdef __GNUC__ -# define GPG_ERR_INLINE __inline__ -#elif defined(_MSC_VER) && _MSC_VER >= 1300 -# define GPG_ERR_INLINE __inline -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -# define GPG_ERR_INLINE inline -#else -# ifndef GPG_ERR_INLINE -# define GPG_ERR_INLINE -# endif -#endif - -#ifdef __cplusplus -extern "C" { -#if 0 /* just to make Emacs auto-indent happy */ -} -#endif -#endif /* __cplusplus */ - - - -/* The error source type gpg_err_source_t. - * - * Where as the Poo out of a welle small - * Taketh his firste springing and his sours. - * --Chaucer. - */ - -/* Only use free slots, never change or reorder the existing - * entries. */ -typedef enum - { - GPG_ERR_SOURCE_UNKNOWN = 0, - GPG_ERR_SOURCE_GCRYPT = 1, - GPG_ERR_SOURCE_GPG = 2, - GPG_ERR_SOURCE_GPGSM = 3, - GPG_ERR_SOURCE_GPGAGENT = 4, - GPG_ERR_SOURCE_PINENTRY = 5, - GPG_ERR_SOURCE_SCD = 6, - GPG_ERR_SOURCE_GPGME = 7, - GPG_ERR_SOURCE_KEYBOX = 8, - GPG_ERR_SOURCE_KSBA = 9, - GPG_ERR_SOURCE_DIRMNGR = 10, - GPG_ERR_SOURCE_GSTI = 11, - GPG_ERR_SOURCE_GPA = 12, - GPG_ERR_SOURCE_KLEO = 13, - GPG_ERR_SOURCE_G13 = 14, - GPG_ERR_SOURCE_ASSUAN = 15, - GPG_ERR_SOURCE_TPM2D = 16, - GPG_ERR_SOURCE_TLS = 17, - GPG_ERR_SOURCE_ANY = 31, - GPG_ERR_SOURCE_USER_1 = 32, - GPG_ERR_SOURCE_USER_2 = 33, - GPG_ERR_SOURCE_USER_3 = 34, - GPG_ERR_SOURCE_USER_4 = 35, - - /* This is one more than the largest allowed entry. */ - GPG_ERR_SOURCE_DIM = 128 - } gpg_err_source_t; - - -/* The error code type gpg_err_code_t. */ - -/* Only use free slots, never change or reorder the existing - * entries. */ -typedef enum - { - GPG_ERR_NO_ERROR = 0, - GPG_ERR_GENERAL = 1, - GPG_ERR_UNKNOWN_PACKET = 2, - GPG_ERR_UNKNOWN_VERSION = 3, - GPG_ERR_PUBKEY_ALGO = 4, - GPG_ERR_DIGEST_ALGO = 5, - GPG_ERR_BAD_PUBKEY = 6, - GPG_ERR_BAD_SECKEY = 7, - GPG_ERR_BAD_SIGNATURE = 8, - GPG_ERR_NO_PUBKEY = 9, - GPG_ERR_CHECKSUM = 10, - GPG_ERR_BAD_PASSPHRASE = 11, - GPG_ERR_CIPHER_ALGO = 12, - GPG_ERR_KEYRING_OPEN = 13, - GPG_ERR_INV_PACKET = 14, - GPG_ERR_INV_ARMOR = 15, - GPG_ERR_NO_USER_ID = 16, - GPG_ERR_NO_SECKEY = 17, - GPG_ERR_WRONG_SECKEY = 18, - GPG_ERR_BAD_KEY = 19, - GPG_ERR_COMPR_ALGO = 20, - GPG_ERR_NO_PRIME = 21, - GPG_ERR_NO_ENCODING_METHOD = 22, - GPG_ERR_NO_ENCRYPTION_SCHEME = 23, - GPG_ERR_NO_SIGNATURE_SCHEME = 24, - GPG_ERR_INV_ATTR = 25, - GPG_ERR_NO_VALUE = 26, - GPG_ERR_NOT_FOUND = 27, - GPG_ERR_VALUE_NOT_FOUND = 28, - GPG_ERR_SYNTAX = 29, - GPG_ERR_BAD_MPI = 30, - GPG_ERR_INV_PASSPHRASE = 31, - GPG_ERR_SIG_CLASS = 32, - GPG_ERR_RESOURCE_LIMIT = 33, - GPG_ERR_INV_KEYRING = 34, - GPG_ERR_TRUSTDB = 35, - GPG_ERR_BAD_CERT = 36, - GPG_ERR_INV_USER_ID = 37, - GPG_ERR_UNEXPECTED = 38, - GPG_ERR_TIME_CONFLICT = 39, - GPG_ERR_KEYSERVER = 40, - GPG_ERR_WRONG_PUBKEY_ALGO = 41, - GPG_ERR_TRIBUTE_TO_D_A = 42, - GPG_ERR_WEAK_KEY = 43, - GPG_ERR_INV_KEYLEN = 44, - GPG_ERR_INV_ARG = 45, - GPG_ERR_BAD_URI = 46, - GPG_ERR_INV_URI = 47, - GPG_ERR_NETWORK = 48, - GPG_ERR_UNKNOWN_HOST = 49, - GPG_ERR_SELFTEST_FAILED = 50, - GPG_ERR_NOT_ENCRYPTED = 51, - GPG_ERR_NOT_PROCESSED = 52, - GPG_ERR_UNUSABLE_PUBKEY = 53, - GPG_ERR_UNUSABLE_SECKEY = 54, - GPG_ERR_INV_VALUE = 55, - GPG_ERR_BAD_CERT_CHAIN = 56, - GPG_ERR_MISSING_CERT = 57, - GPG_ERR_NO_DATA = 58, - GPG_ERR_BUG = 59, - GPG_ERR_NOT_SUPPORTED = 60, - GPG_ERR_INV_OP = 61, - GPG_ERR_TIMEOUT = 62, - GPG_ERR_INTERNAL = 63, - GPG_ERR_EOF_GCRYPT = 64, - GPG_ERR_INV_OBJ = 65, - GPG_ERR_TOO_SHORT = 66, - GPG_ERR_TOO_LARGE = 67, - GPG_ERR_NO_OBJ = 68, - GPG_ERR_NOT_IMPLEMENTED = 69, - GPG_ERR_CONFLICT = 70, - GPG_ERR_INV_CIPHER_MODE = 71, - GPG_ERR_INV_FLAG = 72, - GPG_ERR_INV_HANDLE = 73, - GPG_ERR_TRUNCATED = 74, - GPG_ERR_INCOMPLETE_LINE = 75, - GPG_ERR_INV_RESPONSE = 76, - GPG_ERR_NO_AGENT = 77, - GPG_ERR_AGENT = 78, - GPG_ERR_INV_DATA = 79, - GPG_ERR_ASSUAN_SERVER_FAULT = 80, - GPG_ERR_ASSUAN = 81, - GPG_ERR_INV_SESSION_KEY = 82, - GPG_ERR_INV_SEXP = 83, - GPG_ERR_UNSUPPORTED_ALGORITHM = 84, - GPG_ERR_NO_PIN_ENTRY = 85, - GPG_ERR_PIN_ENTRY = 86, - GPG_ERR_BAD_PIN = 87, - GPG_ERR_INV_NAME = 88, - GPG_ERR_BAD_DATA = 89, - GPG_ERR_INV_PARAMETER = 90, - GPG_ERR_WRONG_CARD = 91, - GPG_ERR_NO_DIRMNGR = 92, - GPG_ERR_DIRMNGR = 93, - GPG_ERR_CERT_REVOKED = 94, - GPG_ERR_NO_CRL_KNOWN = 95, - GPG_ERR_CRL_TOO_OLD = 96, - GPG_ERR_LINE_TOO_LONG = 97, - GPG_ERR_NOT_TRUSTED = 98, - GPG_ERR_CANCELED = 99, - GPG_ERR_BAD_CA_CERT = 100, - GPG_ERR_CERT_EXPIRED = 101, - GPG_ERR_CERT_TOO_YOUNG = 102, - GPG_ERR_UNSUPPORTED_CERT = 103, - GPG_ERR_UNKNOWN_SEXP = 104, - GPG_ERR_UNSUPPORTED_PROTECTION = 105, - GPG_ERR_CORRUPTED_PROTECTION = 106, - GPG_ERR_AMBIGUOUS_NAME = 107, - GPG_ERR_CARD = 108, - GPG_ERR_CARD_RESET = 109, - GPG_ERR_CARD_REMOVED = 110, - GPG_ERR_INV_CARD = 111, - GPG_ERR_CARD_NOT_PRESENT = 112, - GPG_ERR_NO_PKCS15_APP = 113, - GPG_ERR_NOT_CONFIRMED = 114, - GPG_ERR_CONFIGURATION = 115, - GPG_ERR_NO_POLICY_MATCH = 116, - GPG_ERR_INV_INDEX = 117, - GPG_ERR_INV_ID = 118, - GPG_ERR_NO_SCDAEMON = 119, - GPG_ERR_SCDAEMON = 120, - GPG_ERR_UNSUPPORTED_PROTOCOL = 121, - GPG_ERR_BAD_PIN_METHOD = 122, - GPG_ERR_CARD_NOT_INITIALIZED = 123, - GPG_ERR_UNSUPPORTED_OPERATION = 124, - GPG_ERR_WRONG_KEY_USAGE = 125, - GPG_ERR_NOTHING_FOUND = 126, - GPG_ERR_WRONG_BLOB_TYPE = 127, - GPG_ERR_MISSING_VALUE = 128, - GPG_ERR_HARDWARE = 129, - GPG_ERR_PIN_BLOCKED = 130, - GPG_ERR_USE_CONDITIONS = 131, - GPG_ERR_PIN_NOT_SYNCED = 132, - GPG_ERR_INV_CRL = 133, - GPG_ERR_BAD_BER = 134, - GPG_ERR_INV_BER = 135, - GPG_ERR_ELEMENT_NOT_FOUND = 136, - GPG_ERR_IDENTIFIER_NOT_FOUND = 137, - GPG_ERR_INV_TAG = 138, - GPG_ERR_INV_LENGTH = 139, - GPG_ERR_INV_KEYINFO = 140, - GPG_ERR_UNEXPECTED_TAG = 141, - GPG_ERR_NOT_DER_ENCODED = 142, - GPG_ERR_NO_CMS_OBJ = 143, - GPG_ERR_INV_CMS_OBJ = 144, - GPG_ERR_UNKNOWN_CMS_OBJ = 145, - GPG_ERR_UNSUPPORTED_CMS_OBJ = 146, - GPG_ERR_UNSUPPORTED_ENCODING = 147, - GPG_ERR_UNSUPPORTED_CMS_VERSION = 148, - GPG_ERR_UNKNOWN_ALGORITHM = 149, - GPG_ERR_INV_ENGINE = 150, - GPG_ERR_PUBKEY_NOT_TRUSTED = 151, - GPG_ERR_DECRYPT_FAILED = 152, - GPG_ERR_KEY_EXPIRED = 153, - GPG_ERR_SIG_EXPIRED = 154, - GPG_ERR_ENCODING_PROBLEM = 155, - GPG_ERR_INV_STATE = 156, - GPG_ERR_DUP_VALUE = 157, - GPG_ERR_MISSING_ACTION = 158, - GPG_ERR_MODULE_NOT_FOUND = 159, - GPG_ERR_INV_OID_STRING = 160, - GPG_ERR_INV_TIME = 161, - GPG_ERR_INV_CRL_OBJ = 162, - GPG_ERR_UNSUPPORTED_CRL_VERSION = 163, - GPG_ERR_INV_CERT_OBJ = 164, - GPG_ERR_UNKNOWN_NAME = 165, - GPG_ERR_LOCALE_PROBLEM = 166, - GPG_ERR_NOT_LOCKED = 167, - GPG_ERR_PROTOCOL_VIOLATION = 168, - GPG_ERR_INV_MAC = 169, - GPG_ERR_INV_REQUEST = 170, - GPG_ERR_UNKNOWN_EXTN = 171, - GPG_ERR_UNKNOWN_CRIT_EXTN = 172, - GPG_ERR_LOCKED = 173, - GPG_ERR_UNKNOWN_OPTION = 174, - GPG_ERR_UNKNOWN_COMMAND = 175, - GPG_ERR_NOT_OPERATIONAL = 176, - GPG_ERR_NO_PASSPHRASE = 177, - GPG_ERR_NO_PIN = 178, - GPG_ERR_NOT_ENABLED = 179, - GPG_ERR_NO_ENGINE = 180, - GPG_ERR_MISSING_KEY = 181, - GPG_ERR_TOO_MANY = 182, - GPG_ERR_LIMIT_REACHED = 183, - GPG_ERR_NOT_INITIALIZED = 184, - GPG_ERR_MISSING_ISSUER_CERT = 185, - GPG_ERR_NO_KEYSERVER = 186, - GPG_ERR_INV_CURVE = 187, - GPG_ERR_UNKNOWN_CURVE = 188, - GPG_ERR_DUP_KEY = 189, - GPG_ERR_AMBIGUOUS = 190, - GPG_ERR_NO_CRYPT_CTX = 191, - GPG_ERR_WRONG_CRYPT_CTX = 192, - GPG_ERR_BAD_CRYPT_CTX = 193, - GPG_ERR_CRYPT_CTX_CONFLICT = 194, - GPG_ERR_BROKEN_PUBKEY = 195, - GPG_ERR_BROKEN_SECKEY = 196, - GPG_ERR_MAC_ALGO = 197, - GPG_ERR_FULLY_CANCELED = 198, - GPG_ERR_UNFINISHED = 199, - GPG_ERR_BUFFER_TOO_SHORT = 200, - GPG_ERR_SEXP_INV_LEN_SPEC = 201, - GPG_ERR_SEXP_STRING_TOO_LONG = 202, - GPG_ERR_SEXP_UNMATCHED_PAREN = 203, - GPG_ERR_SEXP_NOT_CANONICAL = 204, - GPG_ERR_SEXP_BAD_CHARACTER = 205, - GPG_ERR_SEXP_BAD_QUOTATION = 206, - GPG_ERR_SEXP_ZERO_PREFIX = 207, - GPG_ERR_SEXP_NESTED_DH = 208, - GPG_ERR_SEXP_UNMATCHED_DH = 209, - GPG_ERR_SEXP_UNEXPECTED_PUNC = 210, - GPG_ERR_SEXP_BAD_HEX_CHAR = 211, - GPG_ERR_SEXP_ODD_HEX_NUMBERS = 212, - GPG_ERR_SEXP_BAD_OCT_CHAR = 213, - GPG_ERR_SUBKEYS_EXP_OR_REV = 217, - GPG_ERR_DB_CORRUPTED = 218, - GPG_ERR_SERVER_FAILED = 219, - GPG_ERR_NO_NAME = 220, - GPG_ERR_NO_KEY = 221, - GPG_ERR_LEGACY_KEY = 222, - GPG_ERR_REQUEST_TOO_SHORT = 223, - GPG_ERR_REQUEST_TOO_LONG = 224, - GPG_ERR_OBJ_TERM_STATE = 225, - GPG_ERR_NO_CERT_CHAIN = 226, - GPG_ERR_CERT_TOO_LARGE = 227, - GPG_ERR_INV_RECORD = 228, - GPG_ERR_BAD_MAC = 229, - GPG_ERR_UNEXPECTED_MSG = 230, - GPG_ERR_COMPR_FAILED = 231, - GPG_ERR_WOULD_WRAP = 232, - GPG_ERR_FATAL_ALERT = 233, - GPG_ERR_NO_CIPHER = 234, - GPG_ERR_MISSING_CLIENT_CERT = 235, - GPG_ERR_CLOSE_NOTIFY = 236, - GPG_ERR_TICKET_EXPIRED = 237, - GPG_ERR_BAD_TICKET = 238, - GPG_ERR_UNKNOWN_IDENTITY = 239, - GPG_ERR_BAD_HS_CERT = 240, - GPG_ERR_BAD_HS_CERT_REQ = 241, - GPG_ERR_BAD_HS_CERT_VER = 242, - GPG_ERR_BAD_HS_CHANGE_CIPHER = 243, - GPG_ERR_BAD_HS_CLIENT_HELLO = 244, - GPG_ERR_BAD_HS_SERVER_HELLO = 245, - GPG_ERR_BAD_HS_SERVER_HELLO_DONE = 246, - GPG_ERR_BAD_HS_FINISHED = 247, - GPG_ERR_BAD_HS_SERVER_KEX = 248, - GPG_ERR_BAD_HS_CLIENT_KEX = 249, - GPG_ERR_BOGUS_STRING = 250, - GPG_ERR_FORBIDDEN = 251, - GPG_ERR_KEY_DISABLED = 252, - GPG_ERR_KEY_ON_CARD = 253, - GPG_ERR_INV_LOCK_OBJ = 254, - GPG_ERR_TRUE = 255, - GPG_ERR_FALSE = 256, - GPG_ERR_ASS_GENERAL = 257, - GPG_ERR_ASS_ACCEPT_FAILED = 258, - GPG_ERR_ASS_CONNECT_FAILED = 259, - GPG_ERR_ASS_INV_RESPONSE = 260, - GPG_ERR_ASS_INV_VALUE = 261, - GPG_ERR_ASS_INCOMPLETE_LINE = 262, - GPG_ERR_ASS_LINE_TOO_LONG = 263, - GPG_ERR_ASS_NESTED_COMMANDS = 264, - GPG_ERR_ASS_NO_DATA_CB = 265, - GPG_ERR_ASS_NO_INQUIRE_CB = 266, - GPG_ERR_ASS_NOT_A_SERVER = 267, - GPG_ERR_ASS_NOT_A_CLIENT = 268, - GPG_ERR_ASS_SERVER_START = 269, - GPG_ERR_ASS_READ_ERROR = 270, - GPG_ERR_ASS_WRITE_ERROR = 271, - GPG_ERR_ASS_TOO_MUCH_DATA = 273, - GPG_ERR_ASS_UNEXPECTED_CMD = 274, - GPG_ERR_ASS_UNKNOWN_CMD = 275, - GPG_ERR_ASS_SYNTAX = 276, - GPG_ERR_ASS_CANCELED = 277, - GPG_ERR_ASS_NO_INPUT = 278, - GPG_ERR_ASS_NO_OUTPUT = 279, - GPG_ERR_ASS_PARAMETER = 280, - GPG_ERR_ASS_UNKNOWN_INQUIRE = 281, - GPG_ERR_ENGINE_TOO_OLD = 300, - GPG_ERR_WINDOW_TOO_SMALL = 301, - GPG_ERR_WINDOW_TOO_LARGE = 302, - GPG_ERR_MISSING_ENVVAR = 303, - GPG_ERR_USER_ID_EXISTS = 304, - GPG_ERR_NAME_EXISTS = 305, - GPG_ERR_DUP_NAME = 306, - GPG_ERR_TOO_YOUNG = 307, - GPG_ERR_TOO_OLD = 308, - GPG_ERR_UNKNOWN_FLAG = 309, - GPG_ERR_INV_ORDER = 310, - GPG_ERR_ALREADY_FETCHED = 311, - GPG_ERR_TRY_LATER = 312, - GPG_ERR_WRONG_NAME = 313, - GPG_ERR_NO_AUTH = 314, - GPG_ERR_BAD_AUTH = 315, - GPG_ERR_NO_KEYBOXD = 316, - GPG_ERR_KEYBOXD = 317, - GPG_ERR_NO_SERVICE = 318, - GPG_ERR_SERVICE = 319, - GPG_ERR_SYSTEM_BUG = 666, - GPG_ERR_DNS_UNKNOWN = 711, - GPG_ERR_DNS_SECTION = 712, - GPG_ERR_DNS_ADDRESS = 713, - GPG_ERR_DNS_NO_QUERY = 714, - GPG_ERR_DNS_NO_ANSWER = 715, - GPG_ERR_DNS_CLOSED = 716, - GPG_ERR_DNS_VERIFY = 717, - GPG_ERR_DNS_TIMEOUT = 718, - GPG_ERR_LDAP_GENERAL = 721, - GPG_ERR_LDAP_ATTR_GENERAL = 722, - GPG_ERR_LDAP_NAME_GENERAL = 723, - GPG_ERR_LDAP_SECURITY_GENERAL = 724, - GPG_ERR_LDAP_SERVICE_GENERAL = 725, - GPG_ERR_LDAP_UPDATE_GENERAL = 726, - GPG_ERR_LDAP_E_GENERAL = 727, - GPG_ERR_LDAP_X_GENERAL = 728, - GPG_ERR_LDAP_OTHER_GENERAL = 729, - GPG_ERR_LDAP_X_CONNECTING = 750, - GPG_ERR_LDAP_REFERRAL_LIMIT = 751, - GPG_ERR_LDAP_CLIENT_LOOP = 752, - GPG_ERR_LDAP_NO_RESULTS = 754, - GPG_ERR_LDAP_CONTROL_NOT_FOUND = 755, - GPG_ERR_LDAP_NOT_SUPPORTED = 756, - GPG_ERR_LDAP_CONNECT = 757, - GPG_ERR_LDAP_NO_MEMORY = 758, - GPG_ERR_LDAP_PARAM = 759, - GPG_ERR_LDAP_USER_CANCELLED = 760, - GPG_ERR_LDAP_FILTER = 761, - GPG_ERR_LDAP_AUTH_UNKNOWN = 762, - GPG_ERR_LDAP_TIMEOUT = 763, - GPG_ERR_LDAP_DECODING = 764, - GPG_ERR_LDAP_ENCODING = 765, - GPG_ERR_LDAP_LOCAL = 766, - GPG_ERR_LDAP_SERVER_DOWN = 767, - GPG_ERR_LDAP_SUCCESS = 768, - GPG_ERR_LDAP_OPERATIONS = 769, - GPG_ERR_LDAP_PROTOCOL = 770, - GPG_ERR_LDAP_TIMELIMIT = 771, - GPG_ERR_LDAP_SIZELIMIT = 772, - GPG_ERR_LDAP_COMPARE_FALSE = 773, - GPG_ERR_LDAP_COMPARE_TRUE = 774, - GPG_ERR_LDAP_UNSUPPORTED_AUTH = 775, - GPG_ERR_LDAP_STRONG_AUTH_RQRD = 776, - GPG_ERR_LDAP_PARTIAL_RESULTS = 777, - GPG_ERR_LDAP_REFERRAL = 778, - GPG_ERR_LDAP_ADMINLIMIT = 779, - GPG_ERR_LDAP_UNAVAIL_CRIT_EXTN = 780, - GPG_ERR_LDAP_CONFIDENT_RQRD = 781, - GPG_ERR_LDAP_SASL_BIND_INPROG = 782, - GPG_ERR_LDAP_NO_SUCH_ATTRIBUTE = 784, - GPG_ERR_LDAP_UNDEFINED_TYPE = 785, - GPG_ERR_LDAP_BAD_MATCHING = 786, - GPG_ERR_LDAP_CONST_VIOLATION = 787, - GPG_ERR_LDAP_TYPE_VALUE_EXISTS = 788, - GPG_ERR_LDAP_INV_SYNTAX = 789, - GPG_ERR_LDAP_NO_SUCH_OBJ = 800, - GPG_ERR_LDAP_ALIAS_PROBLEM = 801, - GPG_ERR_LDAP_INV_DN_SYNTAX = 802, - GPG_ERR_LDAP_IS_LEAF = 803, - GPG_ERR_LDAP_ALIAS_DEREF = 804, - GPG_ERR_LDAP_X_PROXY_AUTH_FAIL = 815, - GPG_ERR_LDAP_BAD_AUTH = 816, - GPG_ERR_LDAP_INV_CREDENTIALS = 817, - GPG_ERR_LDAP_INSUFFICIENT_ACC = 818, - GPG_ERR_LDAP_BUSY = 819, - GPG_ERR_LDAP_UNAVAILABLE = 820, - GPG_ERR_LDAP_UNWILL_TO_PERFORM = 821, - GPG_ERR_LDAP_LOOP_DETECT = 822, - GPG_ERR_LDAP_NAMING_VIOLATION = 832, - GPG_ERR_LDAP_OBJ_CLS_VIOLATION = 833, - GPG_ERR_LDAP_NOT_ALLOW_NONLEAF = 834, - GPG_ERR_LDAP_NOT_ALLOW_ON_RDN = 835, - GPG_ERR_LDAP_ALREADY_EXISTS = 836, - GPG_ERR_LDAP_NO_OBJ_CLASS_MODS = 837, - GPG_ERR_LDAP_RESULTS_TOO_LARGE = 838, - GPG_ERR_LDAP_AFFECTS_MULT_DSAS = 839, - GPG_ERR_LDAP_VLV = 844, - GPG_ERR_LDAP_OTHER = 848, - GPG_ERR_LDAP_CUP_RESOURCE_LIMIT = 881, - GPG_ERR_LDAP_CUP_SEC_VIOLATION = 882, - GPG_ERR_LDAP_CUP_INV_DATA = 883, - GPG_ERR_LDAP_CUP_UNSUP_SCHEME = 884, - GPG_ERR_LDAP_CUP_RELOAD = 885, - GPG_ERR_LDAP_CANCELLED = 886, - GPG_ERR_LDAP_NO_SUCH_OPERATION = 887, - GPG_ERR_LDAP_TOO_LATE = 888, - GPG_ERR_LDAP_CANNOT_CANCEL = 889, - GPG_ERR_LDAP_ASSERTION_FAILED = 890, - GPG_ERR_LDAP_PROX_AUTH_DENIED = 891, - GPG_ERR_USER_1 = 1024, - GPG_ERR_USER_2 = 1025, - GPG_ERR_USER_3 = 1026, - GPG_ERR_USER_4 = 1027, - GPG_ERR_USER_5 = 1028, - GPG_ERR_USER_6 = 1029, - GPG_ERR_USER_7 = 1030, - GPG_ERR_USER_8 = 1031, - GPG_ERR_USER_9 = 1032, - GPG_ERR_USER_10 = 1033, - GPG_ERR_USER_11 = 1034, - GPG_ERR_USER_12 = 1035, - GPG_ERR_USER_13 = 1036, - GPG_ERR_USER_14 = 1037, - GPG_ERR_USER_15 = 1038, - GPG_ERR_USER_16 = 1039, - GPG_ERR_SQL_OK = 1500, - GPG_ERR_SQL_ERROR = 1501, - GPG_ERR_SQL_INTERNAL = 1502, - GPG_ERR_SQL_PERM = 1503, - GPG_ERR_SQL_ABORT = 1504, - GPG_ERR_SQL_BUSY = 1505, - GPG_ERR_SQL_LOCKED = 1506, - GPG_ERR_SQL_NOMEM = 1507, - GPG_ERR_SQL_READONLY = 1508, - GPG_ERR_SQL_INTERRUPT = 1509, - GPG_ERR_SQL_IOERR = 1510, - GPG_ERR_SQL_CORRUPT = 1511, - GPG_ERR_SQL_NOTFOUND = 1512, - GPG_ERR_SQL_FULL = 1513, - GPG_ERR_SQL_CANTOPEN = 1514, - GPG_ERR_SQL_PROTOCOL = 1515, - GPG_ERR_SQL_EMPTY = 1516, - GPG_ERR_SQL_SCHEMA = 1517, - GPG_ERR_SQL_TOOBIG = 1518, - GPG_ERR_SQL_CONSTRAINT = 1519, - GPG_ERR_SQL_MISMATCH = 1520, - GPG_ERR_SQL_MISUSE = 1521, - GPG_ERR_SQL_NOLFS = 1522, - GPG_ERR_SQL_AUTH = 1523, - GPG_ERR_SQL_FORMAT = 1524, - GPG_ERR_SQL_RANGE = 1525, - GPG_ERR_SQL_NOTADB = 1526, - GPG_ERR_SQL_NOTICE = 1527, - GPG_ERR_SQL_WARNING = 1528, - GPG_ERR_SQL_ROW = 1600, - GPG_ERR_SQL_DONE = 1601, - GPG_ERR_MISSING_ERRNO = 16381, - GPG_ERR_UNKNOWN_ERRNO = 16382, - GPG_ERR_EOF = 16383, - - /* The following error codes are used to map system errors. */ -#define GPG_ERR_SYSTEM_ERROR (1 << 15) - GPG_ERR_E2BIG = GPG_ERR_SYSTEM_ERROR | 0, - GPG_ERR_EACCES = GPG_ERR_SYSTEM_ERROR | 1, - GPG_ERR_EADDRINUSE = GPG_ERR_SYSTEM_ERROR | 2, - GPG_ERR_EADDRNOTAVAIL = GPG_ERR_SYSTEM_ERROR | 3, - GPG_ERR_EADV = GPG_ERR_SYSTEM_ERROR | 4, - GPG_ERR_EAFNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 5, - GPG_ERR_EAGAIN = GPG_ERR_SYSTEM_ERROR | 6, - GPG_ERR_EALREADY = GPG_ERR_SYSTEM_ERROR | 7, - GPG_ERR_EAUTH = GPG_ERR_SYSTEM_ERROR | 8, - GPG_ERR_EBACKGROUND = GPG_ERR_SYSTEM_ERROR | 9, - GPG_ERR_EBADE = GPG_ERR_SYSTEM_ERROR | 10, - GPG_ERR_EBADF = GPG_ERR_SYSTEM_ERROR | 11, - GPG_ERR_EBADFD = GPG_ERR_SYSTEM_ERROR | 12, - GPG_ERR_EBADMSG = GPG_ERR_SYSTEM_ERROR | 13, - GPG_ERR_EBADR = GPG_ERR_SYSTEM_ERROR | 14, - GPG_ERR_EBADRPC = GPG_ERR_SYSTEM_ERROR | 15, - GPG_ERR_EBADRQC = GPG_ERR_SYSTEM_ERROR | 16, - GPG_ERR_EBADSLT = GPG_ERR_SYSTEM_ERROR | 17, - GPG_ERR_EBFONT = GPG_ERR_SYSTEM_ERROR | 18, - GPG_ERR_EBUSY = GPG_ERR_SYSTEM_ERROR | 19, - GPG_ERR_ECANCELED = GPG_ERR_SYSTEM_ERROR | 20, - GPG_ERR_ECHILD = GPG_ERR_SYSTEM_ERROR | 21, - GPG_ERR_ECHRNG = GPG_ERR_SYSTEM_ERROR | 22, - GPG_ERR_ECOMM = GPG_ERR_SYSTEM_ERROR | 23, - GPG_ERR_ECONNABORTED = GPG_ERR_SYSTEM_ERROR | 24, - GPG_ERR_ECONNREFUSED = GPG_ERR_SYSTEM_ERROR | 25, - GPG_ERR_ECONNRESET = GPG_ERR_SYSTEM_ERROR | 26, - GPG_ERR_ED = GPG_ERR_SYSTEM_ERROR | 27, - GPG_ERR_EDEADLK = GPG_ERR_SYSTEM_ERROR | 28, - GPG_ERR_EDEADLOCK = GPG_ERR_SYSTEM_ERROR | 29, - GPG_ERR_EDESTADDRREQ = GPG_ERR_SYSTEM_ERROR | 30, - GPG_ERR_EDIED = GPG_ERR_SYSTEM_ERROR | 31, - GPG_ERR_EDOM = GPG_ERR_SYSTEM_ERROR | 32, - GPG_ERR_EDOTDOT = GPG_ERR_SYSTEM_ERROR | 33, - GPG_ERR_EDQUOT = GPG_ERR_SYSTEM_ERROR | 34, - GPG_ERR_EEXIST = GPG_ERR_SYSTEM_ERROR | 35, - GPG_ERR_EFAULT = GPG_ERR_SYSTEM_ERROR | 36, - GPG_ERR_EFBIG = GPG_ERR_SYSTEM_ERROR | 37, - GPG_ERR_EFTYPE = GPG_ERR_SYSTEM_ERROR | 38, - GPG_ERR_EGRATUITOUS = GPG_ERR_SYSTEM_ERROR | 39, - GPG_ERR_EGREGIOUS = GPG_ERR_SYSTEM_ERROR | 40, - GPG_ERR_EHOSTDOWN = GPG_ERR_SYSTEM_ERROR | 41, - GPG_ERR_EHOSTUNREACH = GPG_ERR_SYSTEM_ERROR | 42, - GPG_ERR_EIDRM = GPG_ERR_SYSTEM_ERROR | 43, - GPG_ERR_EIEIO = GPG_ERR_SYSTEM_ERROR | 44, - GPG_ERR_EILSEQ = GPG_ERR_SYSTEM_ERROR | 45, - GPG_ERR_EINPROGRESS = GPG_ERR_SYSTEM_ERROR | 46, - GPG_ERR_EINTR = GPG_ERR_SYSTEM_ERROR | 47, - GPG_ERR_EINVAL = GPG_ERR_SYSTEM_ERROR | 48, - GPG_ERR_EIO = GPG_ERR_SYSTEM_ERROR | 49, - GPG_ERR_EISCONN = GPG_ERR_SYSTEM_ERROR | 50, - GPG_ERR_EISDIR = GPG_ERR_SYSTEM_ERROR | 51, - GPG_ERR_EISNAM = GPG_ERR_SYSTEM_ERROR | 52, - GPG_ERR_EL2HLT = GPG_ERR_SYSTEM_ERROR | 53, - GPG_ERR_EL2NSYNC = GPG_ERR_SYSTEM_ERROR | 54, - GPG_ERR_EL3HLT = GPG_ERR_SYSTEM_ERROR | 55, - GPG_ERR_EL3RST = GPG_ERR_SYSTEM_ERROR | 56, - GPG_ERR_ELIBACC = GPG_ERR_SYSTEM_ERROR | 57, - GPG_ERR_ELIBBAD = GPG_ERR_SYSTEM_ERROR | 58, - GPG_ERR_ELIBEXEC = GPG_ERR_SYSTEM_ERROR | 59, - GPG_ERR_ELIBMAX = GPG_ERR_SYSTEM_ERROR | 60, - GPG_ERR_ELIBSCN = GPG_ERR_SYSTEM_ERROR | 61, - GPG_ERR_ELNRNG = GPG_ERR_SYSTEM_ERROR | 62, - GPG_ERR_ELOOP = GPG_ERR_SYSTEM_ERROR | 63, - GPG_ERR_EMEDIUMTYPE = GPG_ERR_SYSTEM_ERROR | 64, - GPG_ERR_EMFILE = GPG_ERR_SYSTEM_ERROR | 65, - GPG_ERR_EMLINK = GPG_ERR_SYSTEM_ERROR | 66, - GPG_ERR_EMSGSIZE = GPG_ERR_SYSTEM_ERROR | 67, - GPG_ERR_EMULTIHOP = GPG_ERR_SYSTEM_ERROR | 68, - GPG_ERR_ENAMETOOLONG = GPG_ERR_SYSTEM_ERROR | 69, - GPG_ERR_ENAVAIL = GPG_ERR_SYSTEM_ERROR | 70, - GPG_ERR_ENEEDAUTH = GPG_ERR_SYSTEM_ERROR | 71, - GPG_ERR_ENETDOWN = GPG_ERR_SYSTEM_ERROR | 72, - GPG_ERR_ENETRESET = GPG_ERR_SYSTEM_ERROR | 73, - GPG_ERR_ENETUNREACH = GPG_ERR_SYSTEM_ERROR | 74, - GPG_ERR_ENFILE = GPG_ERR_SYSTEM_ERROR | 75, - GPG_ERR_ENOANO = GPG_ERR_SYSTEM_ERROR | 76, - GPG_ERR_ENOBUFS = GPG_ERR_SYSTEM_ERROR | 77, - GPG_ERR_ENOCSI = GPG_ERR_SYSTEM_ERROR | 78, - GPG_ERR_ENODATA = GPG_ERR_SYSTEM_ERROR | 79, - GPG_ERR_ENODEV = GPG_ERR_SYSTEM_ERROR | 80, - GPG_ERR_ENOENT = GPG_ERR_SYSTEM_ERROR | 81, - GPG_ERR_ENOEXEC = GPG_ERR_SYSTEM_ERROR | 82, - GPG_ERR_ENOLCK = GPG_ERR_SYSTEM_ERROR | 83, - GPG_ERR_ENOLINK = GPG_ERR_SYSTEM_ERROR | 84, - GPG_ERR_ENOMEDIUM = GPG_ERR_SYSTEM_ERROR | 85, - GPG_ERR_ENOMEM = GPG_ERR_SYSTEM_ERROR | 86, - GPG_ERR_ENOMSG = GPG_ERR_SYSTEM_ERROR | 87, - GPG_ERR_ENONET = GPG_ERR_SYSTEM_ERROR | 88, - GPG_ERR_ENOPKG = GPG_ERR_SYSTEM_ERROR | 89, - GPG_ERR_ENOPROTOOPT = GPG_ERR_SYSTEM_ERROR | 90, - GPG_ERR_ENOSPC = GPG_ERR_SYSTEM_ERROR | 91, - GPG_ERR_ENOSR = GPG_ERR_SYSTEM_ERROR | 92, - GPG_ERR_ENOSTR = GPG_ERR_SYSTEM_ERROR | 93, - GPG_ERR_ENOSYS = GPG_ERR_SYSTEM_ERROR | 94, - GPG_ERR_ENOTBLK = GPG_ERR_SYSTEM_ERROR | 95, - GPG_ERR_ENOTCONN = GPG_ERR_SYSTEM_ERROR | 96, - GPG_ERR_ENOTDIR = GPG_ERR_SYSTEM_ERROR | 97, - GPG_ERR_ENOTEMPTY = GPG_ERR_SYSTEM_ERROR | 98, - GPG_ERR_ENOTNAM = GPG_ERR_SYSTEM_ERROR | 99, - GPG_ERR_ENOTSOCK = GPG_ERR_SYSTEM_ERROR | 100, - GPG_ERR_ENOTSUP = GPG_ERR_SYSTEM_ERROR | 101, - GPG_ERR_ENOTTY = GPG_ERR_SYSTEM_ERROR | 102, - GPG_ERR_ENOTUNIQ = GPG_ERR_SYSTEM_ERROR | 103, - GPG_ERR_ENXIO = GPG_ERR_SYSTEM_ERROR | 104, - GPG_ERR_EOPNOTSUPP = GPG_ERR_SYSTEM_ERROR | 105, - GPG_ERR_EOVERFLOW = GPG_ERR_SYSTEM_ERROR | 106, - GPG_ERR_EPERM = GPG_ERR_SYSTEM_ERROR | 107, - GPG_ERR_EPFNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 108, - GPG_ERR_EPIPE = GPG_ERR_SYSTEM_ERROR | 109, - GPG_ERR_EPROCLIM = GPG_ERR_SYSTEM_ERROR | 110, - GPG_ERR_EPROCUNAVAIL = GPG_ERR_SYSTEM_ERROR | 111, - GPG_ERR_EPROGMISMATCH = GPG_ERR_SYSTEM_ERROR | 112, - GPG_ERR_EPROGUNAVAIL = GPG_ERR_SYSTEM_ERROR | 113, - GPG_ERR_EPROTO = GPG_ERR_SYSTEM_ERROR | 114, - GPG_ERR_EPROTONOSUPPORT = GPG_ERR_SYSTEM_ERROR | 115, - GPG_ERR_EPROTOTYPE = GPG_ERR_SYSTEM_ERROR | 116, - GPG_ERR_ERANGE = GPG_ERR_SYSTEM_ERROR | 117, - GPG_ERR_EREMCHG = GPG_ERR_SYSTEM_ERROR | 118, - GPG_ERR_EREMOTE = GPG_ERR_SYSTEM_ERROR | 119, - GPG_ERR_EREMOTEIO = GPG_ERR_SYSTEM_ERROR | 120, - GPG_ERR_ERESTART = GPG_ERR_SYSTEM_ERROR | 121, - GPG_ERR_EROFS = GPG_ERR_SYSTEM_ERROR | 122, - GPG_ERR_ERPCMISMATCH = GPG_ERR_SYSTEM_ERROR | 123, - GPG_ERR_ESHUTDOWN = GPG_ERR_SYSTEM_ERROR | 124, - GPG_ERR_ESOCKTNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 125, - GPG_ERR_ESPIPE = GPG_ERR_SYSTEM_ERROR | 126, - GPG_ERR_ESRCH = GPG_ERR_SYSTEM_ERROR | 127, - GPG_ERR_ESRMNT = GPG_ERR_SYSTEM_ERROR | 128, - GPG_ERR_ESTALE = GPG_ERR_SYSTEM_ERROR | 129, - GPG_ERR_ESTRPIPE = GPG_ERR_SYSTEM_ERROR | 130, - GPG_ERR_ETIME = GPG_ERR_SYSTEM_ERROR | 131, - GPG_ERR_ETIMEDOUT = GPG_ERR_SYSTEM_ERROR | 132, - GPG_ERR_ETOOMANYREFS = GPG_ERR_SYSTEM_ERROR | 133, - GPG_ERR_ETXTBSY = GPG_ERR_SYSTEM_ERROR | 134, - GPG_ERR_EUCLEAN = GPG_ERR_SYSTEM_ERROR | 135, - GPG_ERR_EUNATCH = GPG_ERR_SYSTEM_ERROR | 136, - GPG_ERR_EUSERS = GPG_ERR_SYSTEM_ERROR | 137, - GPG_ERR_EWOULDBLOCK = GPG_ERR_SYSTEM_ERROR | 138, - GPG_ERR_EXDEV = GPG_ERR_SYSTEM_ERROR | 139, - GPG_ERR_EXFULL = GPG_ERR_SYSTEM_ERROR | 140, - - /* This is one more than the largest allowed entry. */ - GPG_ERR_CODE_DIM = 65536 - } gpg_err_code_t; - - -/* The error value type gpg_error_t. */ - -/* We would really like to use bit-fields in a struct, but using - * structs as return values can cause binary compatibility issues, in - * particular if you want to do it efficiently (also see - * -freg-struct-return option to GCC). */ -typedef unsigned int gpg_error_t; - -/* We use the lowest 16 bits of gpg_error_t for error codes. The 16th - * bit indicates system errors. */ -#define GPG_ERR_CODE_MASK (GPG_ERR_CODE_DIM - 1) - -/* Bits 17 to 24 are reserved. */ - -/* We use the upper 7 bits of gpg_error_t for error sources. */ -#define GPG_ERR_SOURCE_MASK (GPG_ERR_SOURCE_DIM - 1) -#define GPG_ERR_SOURCE_SHIFT 24 - -/* The highest bit is reserved. It shouldn't be used to prevent - * potential negative numbers when transmitting error values as - * text. */ - - -/* - * GCC feature test. - */ -#if __GNUC__ -# define _GPG_ERR_GCC_VERSION (__GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__) -#else -# define _GPG_ERR_GCC_VERSION 0 -#endif - -#undef _GPG_ERR_HAVE_CONSTRUCTOR -#if _GPG_ERR_GCC_VERSION > 30100 -# define _GPG_ERR_CONSTRUCTOR __attribute__ ((__constructor__)) -# define _GPG_ERR_HAVE_CONSTRUCTOR -#else -# define _GPG_ERR_CONSTRUCTOR -#endif - -#define GPGRT_GCC_VERSION _GPG_ERR_GCC_VERSION - -#if _GPG_ERR_GCC_VERSION >= 29200 -# define _GPGRT__RESTRICT __restrict__ -#else -# define _GPGRT__RESTRICT -#endif - -/* The noreturn attribute. */ -#if _GPG_ERR_GCC_VERSION >= 20500 -# define GPGRT_ATTR_NORETURN __attribute__ ((__noreturn__)) -#else -# define GPGRT_ATTR_NORETURN -#endif - -/* The printf attributes. */ -#if _GPG_ERR_GCC_VERSION >= 40400 -# define GPGRT_ATTR_PRINTF(f, a) \ - __attribute__ ((format(__gnu_printf__,f,a))) -# define GPGRT_ATTR_NR_PRINTF(f, a) \ - __attribute__ ((__noreturn__, format(__gnu_printf__,f,a))) -#elif _GPG_ERR_GCC_VERSION >= 20500 -# define GPGRT_ATTR_PRINTF(f, a) \ - __attribute__ ((format(printf,f,a))) -# define GPGRT_ATTR_NR_PRINTF(f, a) \ - __attribute__ ((__noreturn__, format(printf,f,a))) -#else -# define GPGRT_ATTR_PRINTF(f, a) -# define GPGRT_ATTR_NR_PRINTF(f, a) -#endif -#if _GPG_ERR_GCC_VERSION >= 20800 -# define GPGRT_ATTR_FORMAT_ARG(a) __attribute__ ((__format_arg__ (a))) -#else -# define GPGRT_ATTR_FORMAT_ARG(a) -#endif - -/* The sentinel attribute. */ -#if _GPG_ERR_GCC_VERSION >= 40000 -# define GPGRT_ATTR_SENTINEL(a) __attribute__ ((sentinel(a))) -#else -# define GPGRT_ATTR_SENTINEL(a) -#endif - -/* The used and unused attributes. - * I am not sure since when the unused attribute is really supported. - * In any case it it only needed for gcc versions which print a - * warning. Thus let us require gcc >= 3.5. */ -#if _GPG_ERR_GCC_VERSION >= 40000 -# define GPGRT_ATTR_USED __attribute__ ((used)) -#else -# define GPGRT_ATTR_USED -#endif -#if _GPG_ERR_GCC_VERSION >= 30500 -# define GPGRT_ATTR_UNUSED __attribute__ ((unused)) -#else -# define GPGRT_ATTR_UNUSED -#endif - -/* The deprecated attribute. */ -#if _GPG_ERR_GCC_VERSION >= 30100 -# define GPGRT_ATTR_DEPRECATED __attribute__ ((__deprecated__)) -#else -# define GPGRT_ATTR_DEPRECATED -#endif - -/* The pure attribute. */ -#if _GPG_ERR_GCC_VERSION >= 29600 -# define GPGRT_ATTR_PURE __attribute__ ((__pure__)) -#else -# define GPGRT_ATTR_PURE -#endif - -/* The malloc attribute. */ -#if _GPG_ERR_GCC_VERSION >= 30200 -# define GPGRT_ATTR_MALLOC __attribute__ ((__malloc__)) -#else -# define GPGRT_ATTR_MALLOC -#endif - -/* A macro defined if a GCC style __FUNCTION__ macro is available. */ -#undef GPGRT_HAVE_MACRO_FUNCTION -#if _GPG_ERR_GCC_VERSION >= 20500 -# define GPGRT_HAVE_MACRO_FUNCTION 1 -#endif - -/* A macro defined if the pragma GCC push_options is available. */ -#undef GPGRT_HAVE_PRAGMA_GCC_PUSH -#if _GPG_ERR_GCC_VERSION >= 40400 -# define GPGRT_HAVE_PRAGMA_GCC_PUSH 1 -#endif - -/* Detect LeakSanitizer (LSan) support for GCC and Clang based on - * whether AddressSanitizer (ASAN) is enabled via -fsanitize=address). - * Note that -fsanitize=leak just affect the linker options which - * cannot be detected here. In that case you have to define the - * GPGRT_HAVE_LEAK_SANITIZER macro manually. */ -#ifdef __GNUC__ -# ifdef __SANITIZE_ADDRESS__ -# define GPGRT_HAVE_LEAK_SANITIZER -# elif defined(__has_feature) -# if __has_feature(address_sanitizer) -# define GPGRT_HAVE_LEAK_SANITIZER -# endif -# endif -#endif - - -/* The new name for the inline macro. */ -#define GPGRT_INLINE GPG_ERR_INLINE - -#ifdef GPGRT_HAVE_LEAK_SANITIZER -# include <sanitizer/lsan_interface.h> -#endif - -/* Mark heap objects as non-leaked memory. */ -static GPGRT_INLINE void -gpgrt_annotate_leaked_object (const void *p) -{ -#ifdef GPGRT_HAVE_LEAK_SANITIZER - __lsan_ignore_object(p); -#else - (void)p; -#endif -} - - -/* - * Initialization function. - */ - -/* Initialize the library. This function should be run early. */ -gpg_error_t gpg_err_init (void) _GPG_ERR_CONSTRUCTOR; - -/* If this is defined, the library is already initialized by the - constructor and does not need to be initialized explicitely. */ -#undef GPG_ERR_INITIALIZED -#ifdef _GPG_ERR_HAVE_CONSTRUCTOR -# define GPG_ERR_INITIALIZED 1 -# define gpgrt_init() do { gpg_err_init (); } while (0) -#else -# define gpgrt_init() do { ; } while (0) -#endif - -/* See the source on how to use the deinit function; it is usually not - required. */ -void gpg_err_deinit (int mode); - -/* Register blocking system I/O clamping functions. */ -void gpgrt_set_syscall_clamp (void (*pre)(void), void (*post)(void)); - -/* Get current I/O clamping functions. */ -void gpgrt_get_syscall_clamp (void (**r_pre)(void), void (**r_post)(void)); - -/* Register a custom malloc/realloc/free function. */ -void gpgrt_set_alloc_func (void *(*f)(void *a, size_t n)); - -/* Register an emergency cleanup handler. */ -void gpgrt_add_emergency_cleanup (void (*f)(void)); - -/* Wrapper around abort to make sure emergency cleanups are run. */ -void gpgrt_abort (void) GPGRT_ATTR_NORETURN; - - - -/* - * Constructor and accessor functions. - */ - -/* Construct an error value from an error code and source. Within a - * subsystem, use gpg_error. */ -static GPG_ERR_INLINE gpg_error_t -gpg_err_make (gpg_err_source_t source, gpg_err_code_t code) -{ - return code == GPG_ERR_NO_ERROR ? GPG_ERR_NO_ERROR - : (((source & GPG_ERR_SOURCE_MASK) << GPG_ERR_SOURCE_SHIFT) - | (code & GPG_ERR_CODE_MASK)); -} - - -/* The user should define GPG_ERR_SOURCE_DEFAULT before including this - * file to specify a default source for gpg_error. */ -#ifndef GPG_ERR_SOURCE_DEFAULT -#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_UNKNOWN -#endif - -static GPG_ERR_INLINE gpg_error_t -gpg_error (gpg_err_code_t code) -{ - return gpg_err_make (GPG_ERR_SOURCE_DEFAULT, code); -} - - -/* Retrieve the error code from an error value. */ -static GPG_ERR_INLINE gpg_err_code_t -gpg_err_code (gpg_error_t err) -{ - return (gpg_err_code_t) (err & GPG_ERR_CODE_MASK); -} - - -/* Retrieve the error source from an error value. */ -static GPG_ERR_INLINE gpg_err_source_t -gpg_err_source (gpg_error_t err) -{ - return (gpg_err_source_t) ((err >> GPG_ERR_SOURCE_SHIFT) - & GPG_ERR_SOURCE_MASK); -} - - -/* String functions. */ - -/* Return a pointer to a string containing a description of the error - * code in the error value ERR. This function is not thread-safe. */ -const char *gpg_strerror (gpg_error_t err); - -/* Return the error string for ERR in the user-supplied buffer BUF of - * size BUFLEN. This function is, in contrast to gpg_strerror, - * thread-safe if a thread-safe strerror_r() function is provided by - * the system. If the function succeeds, 0 is returned and BUF - * contains the string describing the error. If the buffer was not - * large enough, ERANGE is returned and BUF contains as much of the - * beginning of the error string as fits into the buffer. */ -int gpg_strerror_r (gpg_error_t err, char *buf, size_t buflen); - -/* Return a pointer to a string containing a description of the error - * source in the error value ERR. */ -const char *gpg_strsource (gpg_error_t err); - - -/* - * Mapping of system errors (errno). - */ - -/* Retrieve the error code for the system error ERR. This returns - * GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report - * this). */ -gpg_err_code_t gpg_err_code_from_errno (int err); - -/* Retrieve the system error for the error code CODE. This returns 0 - * if CODE is not a system error code. */ -int gpg_err_code_to_errno (gpg_err_code_t code); - -/* Retrieve the error code directly from the ERRNO variable. This - * returns GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped - * (report this) and GPG_ERR_MISSING_ERRNO if ERRNO has the value 0. */ -gpg_err_code_t gpg_err_code_from_syserror (void); - -/* Mapper for SQLite primary error codes. */ -static GPG_ERR_INLINE gpg_error_t -gpg_err_code_from_sqlite (int sqlres) -{ - return sqlres? GPG_ERR_SQL_OK + (sqlres & 0xff) : 0; -} - - -/* Set the ERRNO variable. This function is the preferred way to set - * ERRNO due to peculiarities on WindowsCE. */ -void gpg_err_set_errno (int err); - -/* Return or check the version. Both functions are identical. */ -const char *gpgrt_check_version (const char *req_version); -const char *gpg_error_check_version (const char *req_version); - -/* System specific type definitions. */ -#include <sys/types.h> - -typedef ssize_t gpgrt_ssize_t; - -typedef long gpgrt_off_t; - - - - -/* Self-documenting convenience functions. */ - -static GPG_ERR_INLINE gpg_error_t -gpg_err_make_from_errno (gpg_err_source_t source, int err) -{ - return gpg_err_make (source, gpg_err_code_from_errno (err)); -} - - -static GPG_ERR_INLINE gpg_error_t -gpg_error_from_errno (int err) -{ - return gpg_error (gpg_err_code_from_errno (err)); -} - -static GPG_ERR_INLINE gpg_error_t -gpg_error_from_syserror (void) -{ - return gpg_error (gpg_err_code_from_syserror ()); -} - - - -/* - * Malloc and friends - */ - -void *gpgrt_realloc (void *a, size_t n); -void *gpgrt_reallocarray (void *a, size_t oldnmemb, size_t nmemb, size_t size); -void *gpgrt_malloc (size_t n); -void *gpgrt_calloc (size_t n, size_t m); -char *gpgrt_strdup (const char *string); -char *gpgrt_strconcat (const char *s1, ...) GPGRT_ATTR_SENTINEL(0); -void gpgrt_free (void *a); - - -/* - * System specific function wrappers. - */ - -/* A getenv replacement which mallocs the returned string. */ -char *gpgrt_getenv (const char *name); - -/* A setenv and a unsetenv replacement.*/ -gpg_err_code_t gpgrt_setenv (const char *name, - const char *value, int overwrite); -#define gpgrt_unsetenv(n) gpgrt_setenv ((n), NULL, 1) - -/* A wrapper around mkdir using a string for the mode. */ -gpg_err_code_t gpgrt_mkdir (const char *name, const char *modestr); - -/* A simple wrapper around chdir. */ -gpg_err_code_t gpgrt_chdir (const char *name); - -/* Return the current WD as a malloced string. */ -char *gpgrt_getcwd (void); - -/* A wrapper around access to handle UTF-8 on Windows. */ -gpg_err_code_t gpgrt_access (const char *fname, int mode); - - - - -/* - * Lock functions. - */ - - -typedef struct -{ - long _vers; - union { - volatile char _priv[40]; - long _x_align; - long *_xp_align; - } u; -} gpgrt_lock_t; - -#define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ - 0,0,0,0,0,0,0,0, \ - 0,0,0,0,0,0,0,0, \ - 0,0,0,0,0,0,0,0, \ - 0,0,0,0,0,0,0,0}}} - - -#define GPGRT_LOCK_DEFINE(name) \ - static gpgrt_lock_t name = GPGRT_LOCK_INITIALIZER - -/* NB: If GPGRT_LOCK_DEFINE is not used, zero out the lock variable - before passing it to gpgrt_lock_init. */ -gpg_err_code_t gpgrt_lock_init (gpgrt_lock_t *lockhd); -gpg_err_code_t gpgrt_lock_lock (gpgrt_lock_t *lockhd); -gpg_err_code_t gpgrt_lock_trylock (gpgrt_lock_t *lockhd); -gpg_err_code_t gpgrt_lock_unlock (gpgrt_lock_t *lockhd); -gpg_err_code_t gpgrt_lock_destroy (gpgrt_lock_t *lockhd); - - - -/* - * Thread functions. - */ - -gpg_err_code_t gpgrt_yield (void); - - - - -/* - * Estream - */ - -/* The definition of this struct is entirely private. You must not - use it for anything. It is only here so some functions can be - implemented as macros. */ -struct _gpgrt_stream_internal; -struct _gpgrt__stream -{ - /* The layout of this struct must never change. It may be grown, - but only if all functions which access the new members are - versioned. */ - - /* Various flags. */ - struct { - unsigned int magic: 16; - unsigned int writing: 1; - unsigned int reserved: 15; - } flags; - - /* A pointer to the stream buffer. */ - unsigned char *buffer; - - /* The size of the buffer in bytes. */ - size_t buffer_size; - - /* The length of the usable data in the buffer, only valid when in - read mode (see flags). */ - size_t data_len; - - /* The current position of the offset pointer, valid in read and - write mode. */ - size_t data_offset; - - size_t data_flushed; - unsigned char *unread_buffer; - size_t unread_buffer_size; - - /* The number of unread bytes. */ - size_t unread_data_len; - - /* A pointer to our internal data for this stream. */ - struct _gpgrt_stream_internal *intern; -}; - -/* The opaque type for an estream. */ -typedef struct _gpgrt__stream *gpgrt_stream_t; -#ifdef GPGRT_ENABLE_ES_MACROS -typedef struct _gpgrt__stream *estream_t; -#endif - -typedef ssize_t (*gpgrt_cookie_read_function_t) (void *cookie, - void *buffer, size_t size); -typedef ssize_t (*gpgrt_cookie_write_function_t) (void *cookie, - const void *buffer, - size_t size); -typedef int (*gpgrt_cookie_seek_function_t) (void *cookie, - gpgrt_off_t *pos, int whence); -typedef int (*gpgrt_cookie_close_function_t) (void *cookie); - -struct _gpgrt_cookie_io_functions -{ - gpgrt_cookie_read_function_t func_read; - gpgrt_cookie_write_function_t func_write; - gpgrt_cookie_seek_function_t func_seek; - gpgrt_cookie_close_function_t func_close; -}; -typedef struct _gpgrt_cookie_io_functions gpgrt_cookie_io_functions_t; -#ifdef GPGRT_ENABLE_ES_MACROS -typedef struct _gpgrt_cookie_io_functions es_cookie_io_functions_t; -#define es_cookie_read_function_t gpgrt_cookie_read_function_t -#define es_cookie_write_function_t gpgrt_cookie_read_function_t -#define es_cookie_seek_function_t gpgrt_cookie_read_function_t -#define es_cookie_close_function_t gpgrt_cookie_read_function_t -#endif - -enum gpgrt_syshd_types - { - GPGRT_SYSHD_NONE = 0, /* No system handle available. */ - GPGRT_SYSHD_FD = 1, /* A file descriptor as returned by open(). */ - GPGRT_SYSHD_SOCK = 2, /* A socket as returned by socket(). */ - GPGRT_SYSHD_RVID = 3, /* A rendezvous id (see libassuan's gpgcedev.c). */ - GPGRT_SYSHD_HANDLE = 4 /* A HANDLE object (Windows). */ - }; - -struct _gpgrt_syshd -{ - enum gpgrt_syshd_types type; - union { - int fd; - int sock; - int rvid; - void *handle; - } u; -}; -typedef struct _gpgrt_syshd gpgrt_syshd_t; -#ifdef GPGRT_ENABLE_ES_MACROS -typedef struct _gpgrt_syshd es_syshd_t; -#define ES_SYSHD_NONE GPGRT_SYSHD_NONE -#define ES_SYSHD_FD GPGRT_SYSHD_FD -#define ES_SYSHD_SOCK GPGRT_SYSHD_SOCK -#define ES_SYSHD_RVID GPGRT_SYSHD_RVID -#define ES_SYSHD_HANDLE GPGRT_SYSHD_HANDLE -#endif - -/* The object used with gpgrt_poll. */ -struct _gpgrt_poll_s -{ - gpgrt_stream_t stream; - unsigned int want_read:1; - unsigned int want_write:1; - unsigned int want_oob:1; - unsigned int want_rdhup:1; - unsigned int _reserv1:4; - unsigned int got_read:1; - unsigned int got_write:1; - unsigned int got_oob:1; - unsigned int got_rdhup:1; - unsigned int _reserv2:4; - unsigned int got_err:1; - unsigned int got_hup:1; - unsigned int got_nval:1; - unsigned int _reserv3:4; - unsigned int ignore:1; - unsigned int user:8; /* For application use. */ -}; -typedef struct _gpgrt_poll_s gpgrt_poll_t; -#ifdef GPGRT_ENABLE_ES_MACROS -typedef struct _gpgrt_poll_s es_poll_t; -#endif - -/* The type of the string filter function as used by fprintf_sf et al. */ -typedef char *(*gpgrt_string_filter_t) (const char *s, int n, void *opaque); - - - -gpgrt_stream_t gpgrt_fopen (const char *_GPGRT__RESTRICT path, - const char *_GPGRT__RESTRICT mode); -gpgrt_stream_t gpgrt_mopen (void *_GPGRT__RESTRICT data, - size_t data_n, size_t data_len, - unsigned int grow, - void *(*func_realloc) (void *mem, size_t size), - void (*func_free) (void *mem), - const char *_GPGRT__RESTRICT mode); -gpgrt_stream_t gpgrt_fopenmem (size_t memlimit, - const char *_GPGRT__RESTRICT mode); -gpgrt_stream_t gpgrt_fopenmem_init (size_t memlimit, - const char *_GPGRT__RESTRICT mode, - const void *data, size_t datalen); -gpgrt_stream_t gpgrt_fdopen (int filedes, const char *mode); -gpgrt_stream_t gpgrt_fdopen_nc (int filedes, const char *mode); -gpgrt_stream_t gpgrt_sysopen (gpgrt_syshd_t *syshd, const char *mode); -gpgrt_stream_t gpgrt_sysopen_nc (gpgrt_syshd_t *syshd, const char *mode); -gpgrt_stream_t gpgrt_fpopen (FILE *fp, const char *mode); -gpgrt_stream_t gpgrt_fpopen_nc (FILE *fp, const char *mode); -gpgrt_stream_t gpgrt_freopen (const char *_GPGRT__RESTRICT path, - const char *_GPGRT__RESTRICT mode, - gpgrt_stream_t _GPGRT__RESTRICT stream); -gpgrt_stream_t gpgrt_fopencookie (void *_GPGRT__RESTRICT cookie, - const char *_GPGRT__RESTRICT mode, - gpgrt_cookie_io_functions_t functions); -int gpgrt_fclose (gpgrt_stream_t stream); -int gpgrt_fcancel (gpgrt_stream_t stream); -int gpgrt_fclose_snatch (gpgrt_stream_t stream, - void **r_buffer, size_t *r_buflen); -int gpgrt_onclose (gpgrt_stream_t stream, int mode, - void (*fnc) (gpgrt_stream_t, void*), void *fnc_value); -int gpgrt_fileno (gpgrt_stream_t stream); -int gpgrt_fileno_unlocked (gpgrt_stream_t stream); -int gpgrt_syshd (gpgrt_stream_t stream, gpgrt_syshd_t *syshd); -int gpgrt_syshd_unlocked (gpgrt_stream_t stream, gpgrt_syshd_t *syshd); - -void _gpgrt_set_std_fd (int no, int fd); -gpgrt_stream_t _gpgrt_get_std_stream (int fd); - -#define gpgrt_stdin _gpgrt_get_std_stream (0) -#define gpgrt_stdout _gpgrt_get_std_stream (1) -#define gpgrt_stderr _gpgrt_get_std_stream (2) - - -void gpgrt_flockfile (gpgrt_stream_t stream); -int gpgrt_ftrylockfile (gpgrt_stream_t stream); -void gpgrt_funlockfile (gpgrt_stream_t stream); - -int gpgrt_feof (gpgrt_stream_t stream); -int gpgrt_feof_unlocked (gpgrt_stream_t stream); -int gpgrt_ferror (gpgrt_stream_t stream); -int gpgrt_ferror_unlocked (gpgrt_stream_t stream); -void gpgrt_clearerr (gpgrt_stream_t stream); -void gpgrt_clearerr_unlocked (gpgrt_stream_t stream); - -int _gpgrt_pending (gpgrt_stream_t stream); /* (private) */ -int _gpgrt_pending_unlocked (gpgrt_stream_t stream); /* (private) */ - -#define gpgrt_pending(stream) _gpgrt_pending (stream) - -#define gpgrt_pending_unlocked(stream) \ - (((!(stream)->flags.writing) \ - && (((stream)->data_offset < (stream)->data_len) \ - || ((stream)->unread_data_len))) \ - ? 1 : _gpgrt_pending_unlocked ((stream))) - -int gpgrt_fflush (gpgrt_stream_t stream); -int gpgrt_fseek (gpgrt_stream_t stream, long int offset, int whence); -int gpgrt_fseeko (gpgrt_stream_t stream, gpgrt_off_t offset, int whence); -int gpgrt_ftruncate (gpgrt_stream_t stream, gpgrt_off_t length); -long int gpgrt_ftell (gpgrt_stream_t stream); -gpgrt_off_t gpgrt_ftello (gpgrt_stream_t stream); -void gpgrt_rewind (gpgrt_stream_t stream); - -int gpgrt_fgetc (gpgrt_stream_t stream); -int gpgrt_fputc (int c, gpgrt_stream_t stream); - -int _gpgrt_getc_underflow (gpgrt_stream_t stream); /* (private) */ -int _gpgrt_putc_overflow (int c, gpgrt_stream_t stream); /* (private) */ - -#define gpgrt_getc_unlocked(stream) \ - (((!(stream)->flags.writing) \ - && ((stream)->data_offset < (stream)->data_len) \ - && (! (stream)->unread_data_len)) \ - ? ((int) (stream)->buffer[((stream)->data_offset)++]) \ - : _gpgrt_getc_underflow ((stream))) - -#define gpgrt_putc_unlocked(c, stream) \ - (((stream)->flags.writing \ - && ((stream)->data_offset < (stream)->buffer_size) \ - && (c != '\n')) \ - ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c))) \ - : _gpgrt_putc_overflow ((c), (stream))) - -#define gpgrt_getc(stream) gpgrt_fgetc (stream) -#define gpgrt_putc(c, stream) gpgrt_fputc (c, stream) - -int gpgrt_ungetc (int c, gpgrt_stream_t stream); - -int gpgrt_read (gpgrt_stream_t _GPGRT__RESTRICT stream, - void *_GPGRT__RESTRICT buffer, size_t bytes_to_read, - size_t *_GPGRT__RESTRICT bytes_read); -int gpgrt_write (gpgrt_stream_t _GPGRT__RESTRICT stream, - const void *_GPGRT__RESTRICT buffer, size_t bytes_to_write, - size_t *_GPGRT__RESTRICT bytes_written); -int gpgrt_write_sanitized (gpgrt_stream_t _GPGRT__RESTRICT stream, - const void *_GPGRT__RESTRICT buffer, size_t length, - const char *delimiters, - size_t *_GPGRT__RESTRICT bytes_written); -int gpgrt_write_hexstring (gpgrt_stream_t _GPGRT__RESTRICT stream, - const void *_GPGRT__RESTRICT buffer, size_t length, - int reserved, - size_t *_GPGRT__RESTRICT bytes_written); - -size_t gpgrt_fread (void *_GPGRT__RESTRICT ptr, size_t size, size_t nitems, - gpgrt_stream_t _GPGRT__RESTRICT stream); -size_t gpgrt_fwrite (const void *_GPGRT__RESTRICT ptr, size_t size, - size_t nitems, gpgrt_stream_t _GPGRT__RESTRICT stream); - -char *gpgrt_fgets (char *_GPGRT__RESTRICT s, int n, - gpgrt_stream_t _GPGRT__RESTRICT stream); -int gpgrt_fputs (const char *_GPGRT__RESTRICT s, - gpgrt_stream_t _GPGRT__RESTRICT stream); -int gpgrt_fputs_unlocked (const char *_GPGRT__RESTRICT s, - gpgrt_stream_t _GPGRT__RESTRICT stream); - -ssize_t gpgrt_getline (char *_GPGRT__RESTRICT *_GPGRT__RESTRICT lineptr, - size_t *_GPGRT__RESTRICT n, - gpgrt_stream_t stream); -ssize_t gpgrt_read_line (gpgrt_stream_t stream, - char **addr_of_buffer, size_t *length_of_buffer, - size_t *max_length); - -int gpgrt_fprintf (gpgrt_stream_t _GPGRT__RESTRICT stream, - const char *_GPGRT__RESTRICT format, ...) - GPGRT_ATTR_PRINTF(2,3); -int gpgrt_fprintf_unlocked (gpgrt_stream_t _GPGRT__RESTRICT stream, - const char *_GPGRT__RESTRICT format, ...) - GPGRT_ATTR_PRINTF(2,3); - -int gpgrt_fprintf_sf (gpgrt_stream_t _GPGRT__RESTRICT stream, - gpgrt_string_filter_t sf, void *sfvalue, - const char *_GPGRT__RESTRICT format, - ...) GPGRT_ATTR_PRINTF(4,5); -int gpgrt_fprintf_sf_unlocked (gpgrt_stream_t _GPGRT__RESTRICT stream, - gpgrt_string_filter_t sf, void *sfvalue, - const char *_GPGRT__RESTRICT format, - ...) GPGRT_ATTR_PRINTF(4,5); - -int gpgrt_printf (const char *_GPGRT__RESTRICT format, ...) - GPGRT_ATTR_PRINTF(1,2); -int gpgrt_printf_unlocked (const char *_GPGRT__RESTRICT format, ...) - GPGRT_ATTR_PRINTF(1,2); - -int gpgrt_vfprintf (gpgrt_stream_t _GPGRT__RESTRICT stream, - const char *_GPGRT__RESTRICT format, va_list ap) - GPGRT_ATTR_PRINTF(2,0); -int gpgrt_vfprintf_unlocked (gpgrt_stream_t _GPGRT__RESTRICT stream, - const char *_GPGRT__RESTRICT format, va_list ap) - GPGRT_ATTR_PRINTF(2,0); - -int gpgrt_setvbuf (gpgrt_stream_t _GPGRT__RESTRICT stream, - char *_GPGRT__RESTRICT buf, int mode, size_t size); -void gpgrt_setbuf (gpgrt_stream_t _GPGRT__RESTRICT stream, - char *_GPGRT__RESTRICT buf); - -void gpgrt_set_binary (gpgrt_stream_t stream); -int gpgrt_set_nonblock (gpgrt_stream_t stream, int onoff); -int gpgrt_get_nonblock (gpgrt_stream_t stream); - -int gpgrt_poll (gpgrt_poll_t *fdlist, unsigned int nfds, int timeout); - -gpgrt_stream_t gpgrt_tmpfile (void); - -void gpgrt_opaque_set (gpgrt_stream_t _GPGRT__RESTRICT stream, - void *_GPGRT__RESTRICT opaque); -void *gpgrt_opaque_get (gpgrt_stream_t stream); - -void gpgrt_fname_set (gpgrt_stream_t stream, const char *fname); -const char *gpgrt_fname_get (gpgrt_stream_t stream); - -int gpgrt_asprintf (char **r_buf, const char * _GPGRT__RESTRICT format, ...) - GPGRT_ATTR_PRINTF(2,3); -int gpgrt_vasprintf (char **r_buf, const char * _GPGRT__RESTRICT format, - va_list ap) - GPGRT_ATTR_PRINTF(2,0); -char *gpgrt_bsprintf (const char * _GPGRT__RESTRICT format, ...) - GPGRT_ATTR_PRINTF(1,2); -char *gpgrt_vbsprintf (const char * _GPGRT__RESTRICT format, va_list ap) - GPGRT_ATTR_PRINTF(1,0); -int gpgrt_snprintf (char *buf, size_t bufsize, - const char * _GPGRT__RESTRICT format, ...) - GPGRT_ATTR_PRINTF(3,4); -int gpgrt_vsnprintf (char *buf,size_t bufsize, - const char * _GPGRT__RESTRICT format, va_list arg_ptr) - GPGRT_ATTR_PRINTF(3,0); - - -#ifdef GPGRT_ENABLE_ES_MACROS -# define es_fopen gpgrt_fopen -# define es_mopen gpgrt_mopen -# define es_fopenmem gpgrt_fopenmem -# define es_fopenmem_init gpgrt_fopenmem_init -# define es_fdopen gpgrt_fdopen -# define es_fdopen_nc gpgrt_fdopen_nc -# define es_sysopen gpgrt_sysopen -# define es_sysopen_nc gpgrt_sysopen_nc -# define es_fpopen gpgrt_fpopen -# define es_fpopen_nc gpgrt_fpopen_nc -# define es_freopen gpgrt_freopen -# define es_fopencookie gpgrt_fopencookie -# define es_fclose gpgrt_fclose -# define es_fclose_snatch gpgrt_fclose_snatch -# define es_onclose gpgrt_onclose -# define es_fileno gpgrt_fileno -# define es_fileno_unlocked gpgrt_fileno_unlocked -# define es_syshd gpgrt_syshd -# define es_syshd_unlocked gpgrt_syshd_unlocked -# define es_stdin _gpgrt_get_std_stream (0) -# define es_stdout _gpgrt_get_std_stream (1) -# define es_stderr _gpgrt_get_std_stream (2) -# define es_flockfile gpgrt_flockfile -# define es_ftrylockfile gpgrt_ftrylockfile -# define es_funlockfile gpgrt_funlockfile -# define es_feof gpgrt_feof -# define es_feof_unlocked gpgrt_feof_unlocked -# define es_ferror gpgrt_ferror -# define es_ferror_unlocked gpgrt_ferror_unlocked -# define es_clearerr gpgrt_clearerr -# define es_clearerr_unlocked gpgrt_clearerr_unlocked -# define es_pending gpgrt_pending -# define es_pending_unlocked gpgrt_pending_unlocked -# define es_fflush gpgrt_fflush -# define es_fseek gpgrt_fseek -# define es_fseeko gpgrt_fseeko -# define es_ftruncate gpgrt_ftruncate -# define es_ftell gpgrt_ftell -# define es_ftello gpgrt_ftello -# define es_rewind gpgrt_rewind -# define es_fgetc gpgrt_fgetc -# define es_fputc gpgrt_fputc -# define es_getc_unlocked gpgrt_getc_unlocked -# define es_putc_unlocked gpgrt_putc_unlocked -# define es_getc gpgrt_getc -# define es_putc gpgrt_putc -# define es_ungetc gpgrt_ungetc -# define es_read gpgrt_read -# define es_write gpgrt_write -# define es_write_sanitized gpgrt_write_sanitized -# define es_write_hexstring gpgrt_write_hexstring -# define es_fread gpgrt_fread -# define es_fwrite gpgrt_fwrite -# define es_fgets gpgrt_fgets -# define es_fputs gpgrt_fputs -# define es_fputs_unlocked gpgrt_fputs_unlocked -# define es_getline gpgrt_getline -# define es_read_line gpgrt_read_line -# define es_free gpgrt_free -# define es_fprintf gpgrt_fprintf -# define es_fprintf_unlocked gpgrt_fprintf_unlocked -# define es_printf gpgrt_printf -# define es_printf_unlocked gpgrt_printf_unlocked -# define es_vfprintf gpgrt_vfprintf -# define es_vfprintf_unlocked gpgrt_vfprintf_unlocked -# define es_setvbuf gpgrt_setvbuf -# define es_setbuf gpgrt_setbuf -# define es_set_binary gpgrt_set_binary -# define es_set_nonblock gpgrt_set_nonblock -# define es_get_nonblock gpgrt_get_nonblock -# define es_poll gpgrt_poll -# define es_tmpfile gpgrt_tmpfile -# define es_opaque_set gpgrt_opaque_set -# define es_opaque_get gpgrt_opaque_get -# define es_fname_set gpgrt_fname_set -# define es_fname_get gpgrt_fname_get -# define es_asprintf gpgrt_asprintf -# define es_vasprintf gpgrt_vasprintf -# define es_bsprintf gpgrt_bsprintf -# define es_vbsprintf gpgrt_vbsprintf -#endif /*GPGRT_ENABLE_ES_MACROS*/ - - - -/* - * Base64 encode and decode functions. - */ - -struct _gpgrt_b64state; -typedef struct _gpgrt_b64state *gpgrt_b64state_t; - -gpgrt_b64state_t gpgrt_b64enc_start (gpgrt_stream_t stream, const char *title); -gpg_err_code_t gpgrt_b64enc_write (gpgrt_b64state_t state, - const void *buffer, size_t nbytes); -gpg_err_code_t gpgrt_b64enc_finish (gpgrt_b64state_t state); - -gpgrt_b64state_t gpgrt_b64dec_start (const char *title); -gpg_error_t gpgrt_b64dec_proc (gpgrt_b64state_t state, - void *buffer, size_t length, - size_t *r_nbytes); -gpg_error_t gpgrt_b64dec_finish (gpgrt_b64state_t state); - - - -/* - * Logging functions - */ - -/* Flag values for gpgrt_log_set_prefix. */ -#define GPGRT_LOG_WITH_PREFIX 1 -#define GPGRT_LOG_WITH_TIME 2 -#define GPGRT_LOG_WITH_PID 4 -#define GPGRT_LOG_RUN_DETACHED 256 -#define GPGRT_LOG_NO_REGISTRY 512 - -/* Log levels as used by gpgrt_log. */ -enum gpgrt_log_levels - { - GPGRT_LOGLVL_BEGIN, - GPGRT_LOGLVL_CONT, - GPGRT_LOGLVL_INFO, - GPGRT_LOGLVL_WARN, - GPGRT_LOGLVL_ERROR, - GPGRT_LOGLVL_FATAL, - GPGRT_LOGLVL_BUG, - GPGRT_LOGLVL_DEBUG - }; - - -/* The next 4 functions are not thread-safe - call them early. */ -void gpgrt_log_set_sink (const char *name, gpgrt_stream_t stream, int fd); -void gpgrt_log_set_socket_dir_cb (const char *(*fnc)(void)); -void gpgrt_log_set_pid_suffix_cb (int (*cb)(unsigned long *r_value)); -void gpgrt_log_set_prefix (const char *text, unsigned int flags); - -int gpgrt_get_errorcount (int clear); -void gpgrt_inc_errorcount (void); -const char *gpgrt_log_get_prefix (unsigned int *flags); -int gpgrt_log_test_fd (int fd); -int gpgrt_log_get_fd (void); -gpgrt_stream_t gpgrt_log_get_stream (void); - -void gpgrt_log (int level, const char *fmt, ...) GPGRT_ATTR_PRINTF(2,3); -void gpgrt_logv (int level, const char *fmt, va_list arg_ptr); -void gpgrt_logv_prefix (int level, const char *prefix, - const char *fmt, va_list arg_ptr); -void gpgrt_log_string (int level, const char *string); -void gpgrt_log_bug (const char *fmt, ...) GPGRT_ATTR_NR_PRINTF(1,2); -void gpgrt_log_fatal (const char *fmt, ...) GPGRT_ATTR_NR_PRINTF(1,2); -void gpgrt_log_error (const char *fmt, ...) GPGRT_ATTR_PRINTF(1,2); -void gpgrt_log_info (const char *fmt, ...) GPGRT_ATTR_PRINTF(1,2); -void gpgrt_log_debug (const char *fmt, ...) GPGRT_ATTR_PRINTF(1,2); -void gpgrt_log_debug_string (const char *string, - const char *fmt, ...) GPGRT_ATTR_PRINTF(2,3); -void gpgrt_log_printf (const char *fmt, ...) GPGRT_ATTR_PRINTF(1,2); -void gpgrt_log_printhex (const void *buffer, size_t length, - const char *fmt, ...) GPGRT_ATTR_PRINTF(3,4); -void gpgrt_log_clock (const char *fmt, ...) GPGRT_ATTR_PRINTF(1,2); -void gpgrt_log_flush (void); -void _gpgrt_log_assert (const char *expr, const char *file, int line, - const char *func) GPGRT_ATTR_NORETURN; - -#ifdef GPGRT_HAVE_MACRO_FUNCTION -# define gpgrt_assert(expr) \ - ((expr) \ - ? (void) 0 \ - : _gpgrt_log_assert (#expr, __FILE__, __LINE__, __FUNCTION__)) -#else /*!GPGRT_HAVE_MACRO_FUNCTION*/ -# define gpgrt_assert(expr) \ - ((expr) \ - ? (void) 0 \ - : _gpgrt_log_assert (#expr, __FILE__, __LINE__, NULL)) -#endif /*!GPGRT_HAVE_MACRO_FUNCTION*/ - -#ifdef GPGRT_ENABLE_LOG_MACROS -# define log_get_errorcount gpgrt_get_errorcount -# define log_inc_errorcount gpgrt_inc_errorcount -# define log_set_file(a) gpgrt_log_set_sink ((a), NULL, -1) -# define log_set_fd(a) gpgrt_log_set_sink (NULL, NULL, (a)) -# define log_set_stream(a) gpgrt_log_set_sink (NULL, (a), -1) -# define log_set_socket_dir_cb gpgrt_log_set_socket_dir_cb -# define log_set_pid_suffix_cb gpgrt_log_set_pid_suffix_cb -# define log_set_prefix gpgrt_log_set_prefix -# define log_get_prefix gpgrt_log_get_prefix -# define log_test_fd gpgrt_log_test_fd -# define log_get_fd gpgrt_log_get_fd -# define log_get_stream gpgrt_log_get_stream -# define log_log gpgrt_log -# define log_logv gpgrt_logv -# define log_logv_prefix gpgrt_logv_prefix -# define log_string gpgrt_log_string -# define log_bug gpgrt_log_bug -# define log_fatal gpgrt_log_fatal -# define log_error gpgrt_log_error -# define log_info gpgrt_log_info -# define log_debug gpgrt_log_debug -# define log_debug_string gpgrt_log_debug_string -# define log_printf gpgrt_log_printf -# define log_printhex gpgrt_log_printhex -# define log_clock gpgrt_log_clock -# define log_flush gpgrt_log_flush -# ifdef GPGRT_HAVE_MACRO_FUNCTION -# define log_assert(expr) \ - ((expr) \ - ? (void) 0 \ - : _gpgrt_log_assert (#expr, __FILE__, __LINE__, __FUNCTION__)) -# else /*!GPGRT_HAVE_MACRO_FUNCTION*/ -# define log_assert(expr) \ - ((expr) \ - ? (void) 0 \ - : _gpgrt_log_assert (#expr, __FILE__, __LINE__, NULL)) -# endif /*!GPGRT_HAVE_MACRO_FUNCTION*/ - -#endif /*GPGRT_ENABLE_LOG_MACROS*/ - - -/* - * Spawn functions (Not yet available) - */ -#define GPGRT_SPAWN_NONBLOCK 16 /* Set the streams to non-blocking. */ -#define GPGRT_SPAWN_RUN_ASFW 64 /* Use AllowSetForegroundWindow on W32. */ -#define GPGRT_SPAWN_DETACHED 128 /* Start the process in the background. */ - -#if 0 - -/* Function and convenience macros to create pipes. */ -gpg_err_code_t gpgrt_make_pipe (int filedes[2], gpgrt_stream_t *r_fp, - int direction, int nonblock); -#define gpgrt_create_pipe(a) gpgrt_make_pipe ((a),NULL, 0, 0); -#define gpgrt_create_inbound_pipe(a,b,c) gpgrt_make_pipe ((a), (b), -1,(c)); -#define gpgrt_create_outbound_pipe(a,b,c) gpgrt_make_pipe ((a), (b), 1,(c)); - - -/* Fork and exec PGMNAME. */ -gpg_err_code_t gpgrt_spawn_process (const char *pgmname, const char *argv[], - int *execpt, void (*preexec)(void), - unsigned int flags, - gpgrt_stream_t *r_infp, - gpgrt_stream_t *r_outfp, - gpgrt_stream_t *r_errfp, - pid_t *pid); - -/* Fork and exec PGNNAME and connect the process to the given FDs. */ -gpg_err_code_t gpgrt_spawn_process_fd (const char *pgmname, const char *argv[], - int infd, int outfd, int errfd, - pid_t *pid); - -/* Fork and exec PGMNAME as a detached process. */ -gpg_err_code_t gpgrt_spawn_process_detached (const char *pgmname, - const char *argv[], - const char *envp[] ); - -/* Wait for a single process. */ -gpg_err_code_t gpgrt_wait_process (const char *pgmname, pid_t pid, int hang, - int *r_exitcode); - -/* Wait for a multiple processes. */ -gpg_err_code_t gpgrt_wait_processes (const char **pgmnames, pid_t *pids, - size_t count, int hang, int *r_exitcodes); - -/* Kill the process identified by PID. */ -void gpgrt_kill_process (pid_t pid); - -/* Release process resources identified by PID. */ -void gpgrt_release_process (pid_t pid); - -#endif /*0*/ - - - -/* - * Option parsing. - */ - -struct _gpgrt_argparse_internal_s; -typedef struct -{ - int *argc; /* Pointer to ARGC (value subject to change). */ - char ***argv; /* Pointer to ARGV (value subject to change). */ - unsigned int flags; /* Global flags. May be set prior to calling the - parser. The parser may change the value. */ - int err; /* Print error description for last option. - Either 0, ARGPARSE_PRINT_WARNING or - ARGPARSE_PRINT_ERROR. */ - unsigned int lineno;/* The current line number. */ - int r_opt; /* Returns option code. */ - int r_type; /* Returns type of option value. */ - union { - int ret_int; - long ret_long; - unsigned long ret_ulong; - char *ret_str; - } r; /* Return values */ - - struct _gpgrt_argparse_internal_s *internal; -} gpgrt_argparse_t; - - -typedef struct -{ - int short_opt; - const char *long_opt; - unsigned int flags; - const char *description; /* Optional description. */ -} gpgrt_opt_t; - - -#ifdef GPGRT_ENABLE_ARGPARSE_MACROS - -/* Global flags for (gpgrt_argparse_t).flags. */ -#define ARGPARSE_FLAG_KEEP 1 /* Do not remove options form argv. */ -#define ARGPARSE_FLAG_ALL 2 /* Do not stop at last option but return - remaining args with R_OPT set to -1. */ -#define ARGPARSE_FLAG_MIXED 4 /* Assume options and args are mixed. */ -#define ARGPARSE_FLAG_NOSTOP 8 /* Do not stop processing at "--". */ -#define ARGPARSE_FLAG_ARG0 16 /* Do not skip the first arg. */ -#define ARGPARSE_FLAG_ONEDASH 32 /* Allow long options with one dash. */ -#define ARGPARSE_FLAG_NOVERSION 64 /* No output for "--version". */ -#define ARGPARSE_FLAG_RESET 128 /* Request to reset the internal state. */ -#define ARGPARSE_FLAG_STOP_SEEN 256 /* Set to true if a "--" has been seen. */ -#define ARGPARSE_FLAG_NOLINENO 512 /* Do not zero the lineno field. */ -#define ARGPARSE_FLAG_SYS 1024 /* Use system config file. */ -#define ARGPARSE_FLAG_USER 2048 /* Use user config file. */ -#define ARGPARSE_FLAG_VERBOSE 4096 /* Print additional argparser info. */ -#define ARGPARSE_FLAG_USERVERS 8192 /* Try version-ed user config files. */ -#define ARGPARSE_FLAG_WITHATTR 16384 /* Return attribute bits. */ - -/* Constants for (gpgrt_argparse_t).err. */ -#define ARGPARSE_PRINT_WARNING 1 /* Print a diagnostic. */ -#define ARGPARSE_PRINT_ERROR 2 /* Print a diagnostic and call exit. */ - -/* Special return values of gpgrt_argparse. */ -#define ARGPARSE_IS_ARG (-1) -#define ARGPARSE_INVALID_OPTION (-2) -#define ARGPARSE_MISSING_ARG (-3) -#define ARGPARSE_KEYWORD_TOO_LONG (-4) -#define ARGPARSE_READ_ERROR (-5) -#define ARGPARSE_UNEXPECTED_ARG (-6) -#define ARGPARSE_INVALID_COMMAND (-7) -#define ARGPARSE_AMBIGUOUS_OPTION (-8) -#define ARGPARSE_AMBIGUOUS_COMMAND (-9) -#define ARGPARSE_INVALID_ALIAS (-10) -#define ARGPARSE_OUT_OF_CORE (-11) -#define ARGPARSE_INVALID_ARG (-12) -#define ARGPARSE_PERMISSION_ERROR (-13) -#define ARGPARSE_NO_CONFFILE (-14) -#define ARGPARSE_CONFFILE (-15) -#define ARGPARSE_INVALID_META (-16) -#define ARGPARSE_UNKNOWN_META (-17) -#define ARGPARSE_UNEXPECTED_META (-18) - -/* Flags for the option descriptor (gpgrt_opt_t)->flags. Note that a - * TYPE constant may be or-ed with the OPT constants but when used as - * return value in r_type these OPT constants are normally not - * included. However with ARGPARSE_FLAG_WITHATTR used and an option - * would normally not be returned, it is returned but - * ARGPARSE_OPT_IGNORE is then set; further ARPARSE_ATTR_* are set. - */ -#define ARGPARSE_TYPE_MASK 0x0007 /* Mask for the type bits. */ -#define ARGPARSE_TYPE_NONE 0 /* Does not take an argument. */ -#define ARGPARSE_TYPE_INT 1 /* Takes an int argument. */ -#define ARGPARSE_TYPE_STRING 2 /* Takes a string argument. */ -#define ARGPARSE_TYPE_LONG 3 /* Takes a long argument. */ -#define ARGPARSE_TYPE_ULONG 4 /* Takes an unsigned long argument. */ -#define ARGPARSE_OPT_OPTIONAL (1<<3) /* Argument is optional. */ -#define ARGPARSE_OPT_PREFIX (1<<4) /* Allow 0x etc. prefixed values. */ -#define ARGPARSE_OPT_IGNORE (1<<6) /* Ignore command or option. */ -#define ARGPARSE_OPT_COMMAND (1<<7) /* The argument is a command. */ -#define ARGPARSE_OPT_CONFFILE (1<<8) /* The value is a conffile. */ -#define ARGPARSE_OPT_HEADER (1<<9) /* The value is printed as a header. */ -#define ARGPARSE_OPT_VERBATIM (1<<10)/* The value is printed verbatim. */ -#define ARGPARSE_ATTR_FORCE (1<<14)/* Attribute force is set. */ -#define ARGPARSE_ATTR_IGNORE (1<<15)/* Attribute ignore is set. */ - -/* A set of macros to make option definitions easier to read. */ -#define ARGPARSE_x(s,l,t,f,d) \ - { (s), (l), ARGPARSE_TYPE_ ## t | (f), (d) } - -#define ARGPARSE_s(s,l,t,d) \ - { (s), (l), ARGPARSE_TYPE_ ## t, (d) } -#define ARGPARSE_s_n(s,l,d) \ - { (s), (l), ARGPARSE_TYPE_NONE, (d) } -#define ARGPARSE_s_i(s,l,d) \ - { (s), (l), ARGPARSE_TYPE_INT, (d) } -#define ARGPARSE_s_s(s,l,d) \ - { (s), (l), ARGPARSE_TYPE_STRING, (d) } -#define ARGPARSE_s_l(s,l,d) \ - { (s), (l), ARGPARSE_TYPE_LONG, (d) } -#define ARGPARSE_s_u(s,l,d) \ - { (s), (l), ARGPARSE_TYPE_ULONG, (d) } - -#define ARGPARSE_o(s,l,t,d) \ - { (s), (l), (ARGPARSE_TYPE_ ## t | ARGPARSE_OPT_OPTIONAL), (d) } -#define ARGPARSE_o_n(s,l,d) \ - { (s), (l), (ARGPARSE_TYPE_NONE | ARGPARSE_OPT_OPTIONAL), (d) } -#define ARGPARSE_o_i(s,l,d) \ - { (s), (l), (ARGPARSE_TYPE_INT | ARGPARSE_OPT_OPTIONAL), (d) } -#define ARGPARSE_o_s(s,l,d) \ - { (s), (l), (ARGPARSE_TYPE_STRING | ARGPARSE_OPT_OPTIONAL), (d) } -#define ARGPARSE_o_l(s,l,d) \ - { (s), (l), (ARGPARSE_TYPE_LONG | ARGPARSE_OPT_OPTIONAL), (d) } -#define ARGPARSE_o_u(s,l,d) \ - { (s), (l), (ARGPARSE_TYPE_ULONG | ARGPARSE_OPT_OPTIONAL), (d) } - -#define ARGPARSE_p(s,l,t,d) \ - { (s), (l), (ARGPARSE_TYPE_ ## t | ARGPARSE_OPT_PREFIX), (d) } -#define ARGPARSE_p_n(s,l,d) \ - { (s), (l), (ARGPARSE_TYPE_NONE | ARGPARSE_OPT_PREFIX), (d) } -#define ARGPARSE_p_i(s,l,d) \ - { (s), (l), (ARGPARSE_TYPE_INT | ARGPARSE_OPT_PREFIX), (d) } -#define ARGPARSE_p_s(s,l,d) \ - { (s), (l), (ARGPARSE_TYPE_STRING | ARGPARSE_OPT_PREFIX), (d) } -#define ARGPARSE_p_l(s,l,d) \ - { (s), (l), (ARGPARSE_TYPE_LONG | ARGPARSE_OPT_PREFIX), (d) } -#define ARGPARSE_p_u(s,l,d) \ - { (s), (l), (ARGPARSE_TYPE_ULONG | ARGPARSE_OPT_PREFIX), (d) } - -#define ARGPARSE_op(s,l,t,d) \ - { (s), (l), (ARGPARSE_TYPE_ ## t \ - | ARGPARSE_OPT_OPTIONAL | ARGPARSE_OPT_PREFIX), (d) } -#define ARGPARSE_op_n(s,l,d) \ - { (s), (l), (ARGPARSE_TYPE_NONE \ - | ARGPARSE_OPT_OPTIONAL | ARGPARSE_OPT_PREFIX), (d) } -#define ARGPARSE_op_i(s,l,d) \ - { (s), (l), (ARGPARSE_TYPE_INT \ - | ARGPARSE_OPT_OPTIONAL | ARGPARSE_OPT_PREFIX), (d) } -#define ARGPARSE_op_s(s,l,d) \ - { (s), (l), (ARGPARSE_TYPE_STRING \ - | ARGPARSE_OPT_OPTIONAL | ARGPARSE_OPT_PREFIX), (d) } -#define ARGPARSE_op_l(s,l,d) \ - { (s), (l), (ARGPARSE_TYPE_LONG \ - | ARGPARSE_OPT_OPTIONAL | ARGPARSE_OPT_PREFIX), (d) } -#define ARGPARSE_op_u(s,l,d) \ - { (s), (l), (ARGPARSE_TYPE_ULONG \ - | ARGPARSE_OPT_OPTIONAL | ARGPARSE_OPT_PREFIX), (d) } - -#define ARGPARSE_c(s,l,d) \ - { (s), (l), (ARGPARSE_TYPE_NONE | ARGPARSE_OPT_COMMAND), (d) } - -#define ARGPARSE_conffile(s,l,d) \ - { (s), (l), (ARGPARSE_TYPE_STRING|ARGPARSE_OPT_CONFFILE), (d) } - -#define ARGPARSE_noconffile(s,l,d) \ - { (s), (l), (ARGPARSE_TYPE_NONE|ARGPARSE_OPT_CONFFILE), (d) } - -/* This macro is for stub or obsolete options. */ -#define ARGPARSE_ignore(s,l) \ - { (s), (l), (ARGPARSE_OPT_IGNORE), "@" } - -/* This is a legacy version of ARGPARSE_verbatim which really does - * verbatim printing. */ -#define ARGPARSE_group(s,d) \ - { (s), NULL, 0, (d) } - -/* Verbatim print the string D in the help output. It does not make - * use of the "@" hack as ARGPARSE_group does. */ -#define ARGPARSE_verbatim(d) \ - { 1, NULL, (ARGPARSE_OPT_VERBATIM), (d) } - -/* Same as ARGPARSE_verbatim but also print a colon and a LF. N can - * be used give a symbolic name to the header. Nothing is printed if - * D is the empty string. */ -#define ARGPARSE_header(n,d) \ - { 1, (n), (ARGPARSE_OPT_HEADER), (d) } - -/* Mark the end of the list (mandatory). */ -#define ARGPARSE_end() \ - { 0, NULL, 0, NULL } - -#endif /* GPGRT_ENABLE_ARGPARSE_MACROS */ - -/* Values used for gpgrt_set_confdir. */ -#define GPGRT_CONFDIR_USER 1 /* The user's configuration dir. */ -#define GPGRT_CONFDIR_SYS 2 /* The systems's configuration dir. */ - -/* Take care: gpgrt_argparse keeps state in ARG and requires that - * either ARGPARSE_FLAG_RESET is used after OPTS has been changed or - * gpgrt_argparse (NULL, ARG, NULL) is called first. */ -int gpgrt_argparse (gpgrt_stream_t fp, - gpgrt_argparse_t *arg, gpgrt_opt_t *opts); -int gpgrt_argparser (gpgrt_argparse_t *arg, gpgrt_opt_t *opts, - const char *confname); -void gpgrt_usage (int level); -const char *gpgrt_strusage (int level); -void gpgrt_set_strusage (const char *(*f)(int)); -void gpgrt_set_usage_outfnc (int (*f)(int, const char *)); -void gpgrt_set_fixed_string_mapper (const char *(*f)(const char*)); -void gpgrt_set_confdir (int what, const char *name); - - -/* - * Various helper functions - */ - -/* Compare arbitrary version strings. For the standard m.n.o version - * numbering scheme a LEVEL of 3 is suitable; see the manual. */ -int gpgrt_cmp_version (const char *a, const char *b, int level); - -/* Construct a filename from the NULL terminated list of parts. Tilde - * expansion is done for the first argument. The caller must release - * the result using gpgrt_free; on error ERRNO is set and NULL - * returned. The second function returns an absolute filename. */ -char *gpgrt_fnameconcat (const char *first, ...) GPGRT_ATTR_SENTINEL(0); -char *gpgrt_absfnameconcat (const char *first, ...) GPGRT_ATTR_SENTINEL(0); - - -#ifdef __cplusplus -} -#endif -#endif /* GPGRT_H */ -#endif /* GPG_ERROR_H */ -/* -Local Variables: -buffer-read-only: t -End: -*/ diff --git a/utils/gpgme/include/gpgme.h b/utils/gpgme/include/gpgme.h deleted file mode 100644 index 91c54c83..00000000 --- a/utils/gpgme/include/gpgme.h +++ /dev/null @@ -1,2841 +0,0 @@ -/* gpgme.h - Public interface to GnuPG Made Easy. -*- c -*- - * Copyright (C) 2000 Werner Koch (dd9jn) - * Copyright (C) 2001-2018 g10 Code GmbH - * - * This file is part of GPGME. - * - * GPGME 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. - * - * GPGME 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://gnu.org/licenses/>. - * SPDX-License-Identifier: LGPL-2.1-or-later - * - * Generated from gpgme.h.in for x86_64-pc-linux-gnu. - */ - -#ifndef GPGME_H -#define GPGME_H - -/* Include stdio.h for the FILE type definition. */ -#include <stdio.h> -#include <time.h> -#include <gpg-error.h> - -#ifdef __cplusplus -extern "C" { -#if 0 /*(Make Emacsen's auto-indent happy.)*/ -} -#endif -#endif /* __cplusplus */ - - -/* The version of this header should match the one of the library. Do - * not use this symbol in your application, use gpgme_check_version - * instead. The purpose of this macro is to let autoconf (using the - * AM_PATH_GPGME macro) check that this header matches the installed - * library. */ -#define GPGME_VERSION "1.15.2-unknown" - -/* The version number of this header. It may be used to handle minor - * API incompatibilities. */ -#define GPGME_VERSION_NUMBER 0x010f02 - - -/* System specific typedefs. */ - -#include <sys/types.h> -typedef off_t gpgme_off_t; -typedef ssize_t gpgme_ssize_t; - - - -/* - * Check for compiler features. - */ -#ifdef GPGRT_INLINE -# define _GPGME_INLINE GPGRT_INLINE -#elif defined(__GNUC__) -# define _GPGME_INLINE __inline__ -#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -# define _GPGME_INLINE inline -#else -# define _GPGME_INLINE -#endif - - -/* The deprecated macro takes the version number of GPGME which - * introduced the deprecation as parameter for documentation. */ -#ifdef GPGRT_ATTR_DEPRECATED -# define _GPGME_DEPRECATED(a,b) GPGRT_ATTR_DEPRECATED -#elif defined(__GNUC__) -# define _GPGME_GCC_VERSION (__GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__) - -# if _GPGME_GCC_VERSION > 30100 -# define _GPGME_DEPRECATED(a,b) __attribute__ ((__deprecated__)) -# else -# define _GPGME_DEPRECATED(a,b) -# endif -#else -# define _GPGME_DEPRECATED(a,b) -#endif - - -/* The macro _GPGME_DEPRECATED_OUTSIDE_GPGME suppresses warnings for - * fields we must access in GPGME for ABI compatibility. */ -#ifdef _GPGME_IN_GPGME -#define _GPGME_DEPRECATED_OUTSIDE_GPGME(a,b) -#else -#define _GPGME_DEPRECATED_OUTSIDE_GPGME(a,b) _GPGME_DEPRECATED(a,b) -#endif - -/* We used to use some symbols which clash with keywords in some - * languages. This macro is used to obsolete them. */ -#if defined(__cplusplus) || defined(SWIGPYTHON) -# define _GPGME_OBSOLETE_SOME_SYMBOLS 1 -#endif - - -/* Check for a matching _FILE_OFFSET_BITS definition. */ -#if 0 -#ifndef _FILE_OFFSET_BITS -#error GPGME was compiled with _FILE_OFFSET_BITS = 0, please see the section "Largefile support (LFS)" in the GPGME manual. -#else -#if (_FILE_OFFSET_BITS) != (0) -#error GPGME was compiled with a different value for _FILE_OFFSET_BITS, namely 0, please see the section "Largefile support (LFS)" in the GPGME manual. -#endif -#endif -#endif - - - -/* - * Some opaque data types used by GPGME. - */ - -/* The context holds some global state and configuration options, as - * well as the results of a crypto operation. */ -struct gpgme_context; -typedef struct gpgme_context *gpgme_ctx_t; - -/* The data object is used by GPGME to exchange arbitrary data. */ -struct gpgme_data; -typedef struct gpgme_data *gpgme_data_t; - - - -/* - * Wrappers for the libgpg-error library. They are generally not - * needed and the gpg-error versions may be used instead. - */ - -typedef gpg_error_t gpgme_error_t; -typedef gpg_err_code_t gpgme_err_code_t; -typedef gpg_err_source_t gpgme_err_source_t; - - -static _GPGME_INLINE gpgme_error_t -gpgme_err_make (gpgme_err_source_t source, gpgme_err_code_t code) -{ - return gpg_err_make (source, code); -} - - -/* The user can define GPGME_ERR_SOURCE_DEFAULT before including this - * file to specify a default source for gpgme_error. */ -#ifndef GPGME_ERR_SOURCE_DEFAULT -#define GPGME_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_USER_1 -#endif - -static _GPGME_INLINE gpgme_error_t -gpgme_error (gpgme_err_code_t code) -{ - return gpgme_err_make (GPGME_ERR_SOURCE_DEFAULT, code); -} - - -static _GPGME_INLINE gpgme_err_code_t -gpgme_err_code (gpgme_error_t err) -{ - return gpg_err_code (err); -} - - -static _GPGME_INLINE gpgme_err_source_t -gpgme_err_source (gpgme_error_t err) -{ - return gpg_err_source (err); -} - - -/* Return a pointer to a string containing a description of the error - * code in the error value ERR. This function is not thread safe. */ -const char *gpgme_strerror (gpgme_error_t err); - -/* Return the error string for ERR in the user-supplied buffer BUF of - * size BUFLEN. This function is, in contrast to gpg_strerror, - * thread-safe if a thread-safe strerror_r() function is provided by - * the system. If the function succeeds, 0 is returned and BUF - * contains the string describing the error. If the buffer was not - * large enough, ERANGE is returned and BUF contains as much of the - * beginning of the error string as fits into the buffer. */ -int gpgme_strerror_r (gpg_error_t err, char *buf, size_t buflen); - -/* Return a pointer to a string containing a description of the error - * source in the error value ERR. */ -const char *gpgme_strsource (gpgme_error_t err); - -/* Retrieve the error code for the system error ERR. This returns - * GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report - * this). */ -gpgme_err_code_t gpgme_err_code_from_errno (int err); - -/* Retrieve the system error for the error code CODE. This returns 0 - * if CODE is not a system error code. */ -int gpgme_err_code_to_errno (gpgme_err_code_t code); - -/* Retrieve the error code directly from the ERRNO variable. This - * returns GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped - * (report this) and GPG_ERR_MISSING_ERRNO if ERRNO has the value 0. */ -gpgme_err_code_t gpgme_err_code_from_syserror (void); - -/* Set the ERRNO variable. This function is the preferred way to set - * ERRNO due to peculiarities on WindowsCE. */ -void gpgme_err_set_errno (int err); - -/* Return an error value with the error source SOURCE and the system - * error ERR. FIXME: Should be inline. */ -gpgme_error_t gpgme_err_make_from_errno (gpgme_err_source_t source, int err); - -/* Return an error value with the system error ERR. - * inline. */ -gpgme_error_t gpgme_error_from_errno (int err); - - -static _GPGME_INLINE gpgme_error_t -gpgme_error_from_syserror (void) -{ - return gpgme_error (gpgme_err_code_from_syserror ()); -} - - - -/* - * Various constants and types - */ - -/* The possible encoding mode of gpgme_data_t objects. */ -typedef enum - { - GPGME_DATA_ENCODING_NONE = 0, /* Not specified. */ - GPGME_DATA_ENCODING_BINARY = 1, - GPGME_DATA_ENCODING_BASE64 = 2, - GPGME_DATA_ENCODING_ARMOR = 3, /* Either PEM or OpenPGP Armor. */ - GPGME_DATA_ENCODING_URL = 4, /* LF delimited URL list. */ - GPGME_DATA_ENCODING_URLESC = 5, /* Ditto, but percent escaped. */ - GPGME_DATA_ENCODING_URL0 = 6, /* Nul delimited URL list. */ - GPGME_DATA_ENCODING_MIME = 7 /* Data is a MIME part. */ - } -gpgme_data_encoding_t; - - -/* Known data types. */ -typedef enum - { - GPGME_DATA_TYPE_INVALID = 0, /* Not detected. */ - GPGME_DATA_TYPE_UNKNOWN = 1, - GPGME_DATA_TYPE_PGP_SIGNED = 0x10, - GPGME_DATA_TYPE_PGP_ENCRYPTED= 0x11, - GPGME_DATA_TYPE_PGP_OTHER = 0x12, - GPGME_DATA_TYPE_PGP_KEY = 0x13, - GPGME_DATA_TYPE_PGP_SIGNATURE= 0x18, /* Detached signature */ - GPGME_DATA_TYPE_CMS_SIGNED = 0x20, - GPGME_DATA_TYPE_CMS_ENCRYPTED= 0x21, - GPGME_DATA_TYPE_CMS_OTHER = 0x22, - GPGME_DATA_TYPE_X509_CERT = 0x23, - GPGME_DATA_TYPE_PKCS12 = 0x24, - } -gpgme_data_type_t; - - -/* Public key algorithms. */ -typedef enum - { - GPGME_PK_RSA = 1, - GPGME_PK_RSA_E = 2, - GPGME_PK_RSA_S = 3, - GPGME_PK_ELG_E = 16, - GPGME_PK_DSA = 17, - GPGME_PK_ECC = 18, - GPGME_PK_ELG = 20, - GPGME_PK_ECDSA = 301, - GPGME_PK_ECDH = 302, - GPGME_PK_EDDSA = 303 - } -gpgme_pubkey_algo_t; - - -/* Hash algorithms (the values match those from libgcrypt). */ -typedef enum - { - GPGME_MD_NONE = 0, - GPGME_MD_MD5 = 1, - GPGME_MD_SHA1 = 2, - GPGME_MD_RMD160 = 3, - GPGME_MD_MD2 = 5, - GPGME_MD_TIGER = 6, /* TIGER/192. */ - GPGME_MD_HAVAL = 7, /* HAVAL, 5 pass, 160 bit. */ - GPGME_MD_SHA256 = 8, - GPGME_MD_SHA384 = 9, - GPGME_MD_SHA512 = 10, - GPGME_MD_SHA224 = 11, - GPGME_MD_MD4 = 301, - GPGME_MD_CRC32 = 302, - GPGME_MD_CRC32_RFC1510 = 303, - GPGME_MD_CRC24_RFC2440 = 304 - } -gpgme_hash_algo_t; - - -/* The available signature modes. */ -typedef enum - { - GPGME_SIG_MODE_NORMAL = 0, - GPGME_SIG_MODE_DETACH = 1, - GPGME_SIG_MODE_CLEAR = 2 - } -gpgme_sig_mode_t; - - -/* The available validities for a key. */ -typedef enum - { - GPGME_VALIDITY_UNKNOWN = 0, - GPGME_VALIDITY_UNDEFINED = 1, - GPGME_VALIDITY_NEVER = 2, - GPGME_VALIDITY_MARGINAL = 3, - GPGME_VALIDITY_FULL = 4, - GPGME_VALIDITY_ULTIMATE = 5 - } -gpgme_validity_t; - - -/* The TOFU policies. */ -typedef enum - { - GPGME_TOFU_POLICY_NONE = 0, - GPGME_TOFU_POLICY_AUTO = 1, - GPGME_TOFU_POLICY_GOOD = 2, - GPGME_TOFU_POLICY_UNKNOWN = 3, - GPGME_TOFU_POLICY_BAD = 4, - GPGME_TOFU_POLICY_ASK = 5 - } -gpgme_tofu_policy_t; - - -/* The key origin values. */ -typedef enum - { - GPGME_KEYORG_UNKNOWN = 0, - GPGME_KEYORG_KS = 1, - GPGME_KEYORG_DANE = 3, - GPGME_KEYORG_WKD = 4, - GPGME_KEYORG_URL = 5, - GPGME_KEYORG_FILE = 6, - GPGME_KEYORG_SELF = 7, - GPGME_KEYORG_OTHER = 31 - } -gpgme_keyorg_t; - - -/* The available protocols. */ -typedef enum - { - GPGME_PROTOCOL_OpenPGP = 0, /* The default mode. */ - GPGME_PROTOCOL_CMS = 1, - GPGME_PROTOCOL_GPGCONF = 2, /* Special code for gpgconf. */ - GPGME_PROTOCOL_ASSUAN = 3, /* Low-level access to an Assuan server. */ - GPGME_PROTOCOL_G13 = 4, - GPGME_PROTOCOL_UISERVER= 5, - GPGME_PROTOCOL_SPAWN = 6, /* Direct access to any program. */ - GPGME_PROTOCOL_DEFAULT = 254, - GPGME_PROTOCOL_UNKNOWN = 255 - } -gpgme_protocol_t; -/* Convenience macro for the surprisingly mixed spelling. */ -#define GPGME_PROTOCOL_OPENPGP GPGME_PROTOCOL_OpenPGP - - -/* The available keylist mode flags. */ -#define GPGME_KEYLIST_MODE_LOCAL 1 -#define GPGME_KEYLIST_MODE_EXTERN 2 -#define GPGME_KEYLIST_MODE_SIGS 4 -#define GPGME_KEYLIST_MODE_SIG_NOTATIONS 8 -#define GPGME_KEYLIST_MODE_WITH_SECRET 16 -#define GPGME_KEYLIST_MODE_WITH_TOFU 32 -#define GPGME_KEYLIST_MODE_WITH_KEYGRIP 64 -#define GPGME_KEYLIST_MODE_EPHEMERAL 128 -#define GPGME_KEYLIST_MODE_VALIDATE 256 - -#define GPGME_KEYLIST_MODE_LOCATE (1|2) - -typedef unsigned int gpgme_keylist_mode_t; - - -/* The pinentry modes. */ -typedef enum - { - GPGME_PINENTRY_MODE_DEFAULT = 0, - GPGME_PINENTRY_MODE_ASK = 1, - GPGME_PINENTRY_MODE_CANCEL = 2, - GPGME_PINENTRY_MODE_ERROR = 3, - GPGME_PINENTRY_MODE_LOOPBACK = 4 - } -gpgme_pinentry_mode_t; - - -/* The available export mode flags. */ -#define GPGME_EXPORT_MODE_EXTERN 2 -#define GPGME_EXPORT_MODE_MINIMAL 4 -#define GPGME_EXPORT_MODE_SECRET 16 -#define GPGME_EXPORT_MODE_RAW 32 -#define GPGME_EXPORT_MODE_PKCS12 64 -#define GPGME_EXPORT_MODE_SSH 256 - -typedef unsigned int gpgme_export_mode_t; - - -/* Flags for the audit log functions. */ -#define GPGME_AUDITLOG_DEFAULT 0 -#define GPGME_AUDITLOG_HTML 1 -#define GPGME_AUDITLOG_DIAG 2 -#define GPGME_AUDITLOG_WITH_HELP 128 - - -/* The available signature notation flags. */ -#define GPGME_SIG_NOTATION_HUMAN_READABLE 1 -#define GPGME_SIG_NOTATION_CRITICAL 2 - -typedef unsigned int gpgme_sig_notation_flags_t; - -/* An object to hold information about notation data. This structure - * shall be considered read-only and an application must not allocate - * such a structure on its own. */ -struct _gpgme_sig_notation -{ - struct _gpgme_sig_notation *next; - - /* If NAME is a null pointer, then VALUE contains a policy URL - * rather than a notation. */ - char *name; - - /* The value of the notation data. */ - char *value; - - /* The length of the name of the notation data. */ - int name_len; - - /* The length of the value of the notation data. */ - int value_len; - - /* The accumulated flags. */ - gpgme_sig_notation_flags_t flags; - - /* Notation data is human-readable. */ - unsigned int human_readable : 1; - - /* Notation data is critical. */ - unsigned int critical : 1; - - /* Internal to GPGME, do not use. */ - int _unused : 30; -}; -typedef struct _gpgme_sig_notation *gpgme_sig_notation_t; - - - -/* - * Public structures. - */ - -/* The engine information structure. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -struct _gpgme_engine_info -{ - struct _gpgme_engine_info *next; - - /* The protocol ID. */ - gpgme_protocol_t protocol; - - /* The file name of the engine binary. */ - char *file_name; - - /* The version string of the installed engine. */ - char *version; - - /* The minimum version required for GPGME. */ - const char *req_version; - - /* The home directory used, or NULL if default. */ - char *home_dir; -}; -typedef struct _gpgme_engine_info *gpgme_engine_info_t; - - -/* An object with TOFU information. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -struct _gpgme_tofu_info -{ - struct _gpgme_tofu_info *next; - - /* The TOFU validity: - * 0 := conflict - * 1 := key without history - * 2 := key with too little history - * 3 := key with enough history for basic trust - * 4 := key with a lot of history - */ - unsigned int validity : 3; - - /* The TOFU policy (gpgme_tofu_policy_t). */ - unsigned int policy : 4; - - unsigned int _rfu : 25; - - /* Number of signatures seen for this binding. Capped at USHRT_MAX. */ - unsigned short signcount; - /* Number of encryptions done with this binding. Capped at USHRT_MAX. */ - unsigned short encrcount; - - /* Number of seconds since Epoch when the first and the most - * recently seen message were verified/decrypted. 0 means unknown. */ - unsigned long signfirst; - unsigned long signlast; - unsigned long encrfirst; - unsigned long encrlast; - - /* If non-NULL a human readable string summarizing the TOFU data. */ - char *description; -}; -typedef struct _gpgme_tofu_info *gpgme_tofu_info_t; - - -/* A subkey from a key. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -struct _gpgme_subkey -{ - struct _gpgme_subkey *next; - - /* True if subkey is revoked. */ - unsigned int revoked : 1; - - /* True if subkey is expired. */ - unsigned int expired : 1; - - /* True if subkey is disabled. */ - unsigned int disabled : 1; - - /* True if subkey is invalid. */ - unsigned int invalid : 1; - - /* True if subkey can be used for encryption. */ - unsigned int can_encrypt : 1; - - /* True if subkey can be used for signing. */ - unsigned int can_sign : 1; - - /* True if subkey can be used for certification. */ - unsigned int can_certify : 1; - - /* True if subkey is secret. */ - unsigned int secret : 1; - - /* True if subkey can be used for authentication. */ - unsigned int can_authenticate : 1; - - /* True if subkey is qualified for signatures according to German law. */ - unsigned int is_qualified : 1; - - /* True if the secret key is stored on a smart card. */ - unsigned int is_cardkey : 1; - - /* True if the key is compliant to the de-vs mode. */ - unsigned int is_de_vs : 1; - - /* Internal to GPGME, do not use. */ - unsigned int _unused : 20; - - /* Public key algorithm supported by this subkey. */ - gpgme_pubkey_algo_t pubkey_algo; - - /* Length of the subkey. */ - unsigned int length; - - /* The key ID of the subkey. */ - char *keyid; - - /* Internal to GPGME, do not use. */ - char _keyid[16 + 1]; - - /* The fingerprint of the subkey in hex digit form. */ - char *fpr; - - /* The creation timestamp, -1 if invalid, 0 if not available. */ - long int timestamp; - - /* The expiration timestamp, 0 if the subkey does not expire. */ - long int expires; - - /* The serial number of a smart card holding this key or NULL. */ - char *card_number; - - /* The name of the curve for ECC algorithms or NULL. */ - char *curve; - - /* The keygrip of the subkey in hex digit form or NULL if not available. */ - char *keygrip; -}; -typedef struct _gpgme_subkey *gpgme_subkey_t; - - -/* A signature on a user ID. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -struct _gpgme_key_sig -{ - struct _gpgme_key_sig *next; - - /* True if the signature is a revocation signature. */ - unsigned int revoked : 1; - - /* True if the signature is expired. */ - unsigned int expired : 1; - - /* True if the signature is invalid. */ - unsigned int invalid : 1; - - /* True if the signature should be exported. */ - unsigned int exportable : 1; - - /* Internal to GPGME, do not use. */ - unsigned int _unused : 12; - - /* The depth of a trust signature, 0 if no trust signature. */ - unsigned int trust_depth : 8; - - /* The trust value of a trust signature, 0 if no trust signature. */ - unsigned int trust_value : 8; - - /* The public key algorithm used to create the signature. */ - gpgme_pubkey_algo_t pubkey_algo; - - /* The key ID of key used to create the signature. */ - char *keyid; - - /* Internal to GPGME, do not use. */ - char _keyid[16 + 1]; - - /* The creation timestamp, -1 if invalid, 0 if not available. */ - long int timestamp; - - /* The expiration timestamp, 0 if the subkey does not expire. */ - long int expires; - - /* The scope of a trust signature. Might be NULL. */ - char *trust_scope; - - /* Same as in gpgme_signature_t. */ - gpgme_error_t status; - - /* Deprecated; use SIG_CLASS instead. */ -#ifdef _GPGME_OBSOLETE_SOME_SYMBOLS - unsigned int _obsolete_class _GPGME_DEPRECATED(0,4); -#else - unsigned int class _GPGME_DEPRECATED_OUTSIDE_GPGME(0,4); -#endif - - /* The user ID string. */ - char *uid; - - /* The name part of the user ID. */ - char *name; - - /* The email part of the user ID. */ - char *email; - - /* The comment part of the user ID. */ - char *comment; - - /* Crypto backend specific signature class. */ - unsigned int sig_class; - - /* Notation data and policy URLs. */ - gpgme_sig_notation_t notations; - - /* Internal to GPGME, do not use. */ - gpgme_sig_notation_t _last_notation; -}; -typedef struct _gpgme_key_sig *gpgme_key_sig_t; - - -/* An user ID from a key. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -struct _gpgme_user_id -{ - struct _gpgme_user_id *next; - - /* True if the user ID is revoked. */ - unsigned int revoked : 1; - - /* True if the user ID is invalid. */ - unsigned int invalid : 1; - - /* Internal to GPGME, do not use. */ - unsigned int _unused : 25; - - /* Origin of this user ID. */ - unsigned int origin : 5; - - /* The validity of the user ID. */ - gpgme_validity_t validity; - - /* The user ID string. */ - char *uid; - - /* The name part of the user ID. */ - char *name; - - /* The email part of the user ID. */ - char *email; - - /* The comment part of the user ID. */ - char *comment; - - /* The signatures of the user ID. */ - gpgme_key_sig_t signatures; - - /* Internal to GPGME, do not use. */ - gpgme_key_sig_t _last_keysig; - - /* The mail address (addr-spec from RFC5322) of the UID string. - * This is general the same as the EMAIL part of this struct but - * might be slightly different. If no mail address is available - * NULL is stored. */ - char *address; - - /* The malloced TOFU information or NULL. */ - gpgme_tofu_info_t tofu; - - /* Time of the last refresh of this user id. 0 if unknown. */ - unsigned long last_update; - - /* The string to exactly identify a userid. Might be NULL. */ - char *uidhash; -}; -typedef struct _gpgme_user_id *gpgme_user_id_t; - - -/* A key from the keyring. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -struct _gpgme_key -{ - /* Internal to GPGME, do not use. */ - unsigned int _refs; - - /* True if key is revoked. */ - unsigned int revoked : 1; - - /* True if key is expired. */ - unsigned int expired : 1; - - /* True if key is disabled. */ - unsigned int disabled : 1; - - /* True if key is invalid. */ - unsigned int invalid : 1; - - /* True if key can be used for encryption. */ - unsigned int can_encrypt : 1; - - /* True if key can be used for signing. */ - unsigned int can_sign : 1; - - /* True if key can be used for certification. */ - unsigned int can_certify : 1; - - /* True if key is secret. */ - unsigned int secret : 1; - - /* True if key can be used for authentication. */ - unsigned int can_authenticate : 1; - - /* True if subkey is qualified for signatures according to German law. */ - unsigned int is_qualified : 1; - - /* Internal to GPGME, do not use. */ - unsigned int _unused : 17; - - /* Origin of this key. */ - unsigned int origin : 5; - - /* This is the protocol supported by this key. */ - gpgme_protocol_t protocol; - - /* If protocol is GPGME_PROTOCOL_CMS, this string contains the - issuer serial. */ - char *issuer_serial; - - /* If protocol is GPGME_PROTOCOL_CMS, this string contains the - issuer name. */ - char *issuer_name; - - /* If protocol is GPGME_PROTOCOL_CMS, this string contains the chain - ID. */ - char *chain_id; - - /* If protocol is GPGME_PROTOCOL_OpenPGP, this field contains the - owner trust. */ - gpgme_validity_t owner_trust; - - /* The subkeys of the key. */ - gpgme_subkey_t subkeys; - - /* The user IDs of the key. */ - gpgme_user_id_t uids; - - /* Internal to GPGME, do not use. */ - gpgme_subkey_t _last_subkey; - - /* Internal to GPGME, do not use. */ - gpgme_user_id_t _last_uid; - - /* The keylist mode that was active when listing the key. */ - gpgme_keylist_mode_t keylist_mode; - - /* This field gives the fingerprint of the primary key. Note that - * this is a copy of the FPR of the first subkey. We need it here - * to allow for an incomplete key object. */ - char *fpr; - - /* Time of the last refresh of the entire key. 0 if unknown. */ - unsigned long last_update; -}; -typedef struct _gpgme_key *gpgme_key_t; - - -/* An invalid key object. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -struct _gpgme_invalid_key -{ - struct _gpgme_invalid_key *next; - - /* The string used to request the key. Despite the name this may - * not be a fingerprint. */ - char *fpr; - - /* The error code. */ - gpgme_error_t reason; -}; -typedef struct _gpgme_invalid_key *gpgme_invalid_key_t; - - - -/* - * Types for callback functions. - */ - -/* Request a passphrase from the user. */ -typedef gpgme_error_t (*gpgme_passphrase_cb_t) (void *hook, - const char *uid_hint, - const char *passphrase_info, - int prev_was_bad, int fd); - -/* Inform the user about progress made. */ -typedef void (*gpgme_progress_cb_t) (void *opaque, const char *what, - int type, int current, int total); - -/* Status messages from gpg. */ -typedef gpgme_error_t (*gpgme_status_cb_t) (void *opaque, const char *keyword, - const char *args); - -/* Interact with the user about an edit operation. */ -typedef gpgme_error_t (*gpgme_interact_cb_t) (void *opaque, - const char *keyword, - const char *args, int fd); - - - -/* - * Context management functions. - */ - -/* Create a new context and return it in CTX. */ -gpgme_error_t gpgme_new (gpgme_ctx_t *ctx); - -/* Release the context CTX. */ -void gpgme_release (gpgme_ctx_t ctx); - -/* Set the flag NAME for CTX to VALUE. */ -gpgme_error_t gpgme_set_ctx_flag (gpgme_ctx_t ctx, - const char *name, const char *value); - -/* Get the value of the flag NAME from CTX. */ -const char *gpgme_get_ctx_flag (gpgme_ctx_t ctx, const char *name); - -/* Set the protocol to be used by CTX to PROTO. */ -gpgme_error_t gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t proto); - -/* Get the protocol used with CTX */ -gpgme_protocol_t gpgme_get_protocol (gpgme_ctx_t ctx); - -/* Set the crypto protocol to be used by CTX to PROTO. - * gpgme_set_protocol actually sets the backend engine. This sets the - * crypto protocol used in engines that support more than one crypto - * prococol (for example, an UISERVER can support OpenPGP and CMS). - * This is reset to the default with gpgme_set_protocol. */ -gpgme_error_t gpgme_set_sub_protocol (gpgme_ctx_t ctx, - gpgme_protocol_t proto); - -/* Get the sub protocol. */ -gpgme_protocol_t gpgme_get_sub_protocol (gpgme_ctx_t ctx); - -/* Get the string describing protocol PROTO, or NULL if invalid. */ -const char *gpgme_get_protocol_name (gpgme_protocol_t proto); - -/* If YES is non-zero, enable armor mode in CTX, disable it otherwise. */ -void gpgme_set_armor (gpgme_ctx_t ctx, int yes); - -/* Return non-zero if armor mode is set in CTX. */ -int gpgme_get_armor (gpgme_ctx_t ctx); - -/* If YES is non-zero, enable text mode in CTX, disable it otherwise. */ -void gpgme_set_textmode (gpgme_ctx_t ctx, int yes); - -/* Return non-zero if text mode is set in CTX. */ -int gpgme_get_textmode (gpgme_ctx_t ctx); - -/* If YES is non-zero, enable offline mode in CTX, disable it otherwise. */ -void gpgme_set_offline (gpgme_ctx_t ctx, int yes); - -/* Return non-zero if offline mode is set in CTX. */ -int gpgme_get_offline (gpgme_ctx_t ctx); - -/* Use whatever the default of the backend crypto engine is. */ -#define GPGME_INCLUDE_CERTS_DEFAULT -256 - -/* Include up to NR_OF_CERTS certificates in an S/MIME message. */ -void gpgme_set_include_certs (gpgme_ctx_t ctx, int nr_of_certs); - -/* Return the number of certs to include in an S/MIME message. */ -int gpgme_get_include_certs (gpgme_ctx_t ctx); - -/* Set keylist mode in CTX to MODE. */ -gpgme_error_t gpgme_set_keylist_mode (gpgme_ctx_t ctx, - gpgme_keylist_mode_t mode); - -/* Get keylist mode in CTX. */ -gpgme_keylist_mode_t gpgme_get_keylist_mode (gpgme_ctx_t ctx); - -/* Set the pinentry mode for CTX to MODE. */ -gpgme_error_t gpgme_set_pinentry_mode (gpgme_ctx_t ctx, - gpgme_pinentry_mode_t mode); - -/* Get the pinentry mode of CTX. */ -gpgme_pinentry_mode_t gpgme_get_pinentry_mode (gpgme_ctx_t ctx); - -/* Set the passphrase callback function in CTX to CB. HOOK_VALUE is - * passed as first argument to the passphrase callback function. */ -void gpgme_set_passphrase_cb (gpgme_ctx_t ctx, - gpgme_passphrase_cb_t cb, void *hook_value); - -/* Get the current passphrase callback function in *CB and the current - * hook value in *HOOK_VALUE. */ -void gpgme_get_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t *cb, - void **hook_value); - -/* Set the progress callback function in CTX to CB. HOOK_VALUE is - * passed as first argument to the progress callback function. */ -void gpgme_set_progress_cb (gpgme_ctx_t c, gpgme_progress_cb_t cb, - void *hook_value); - -/* Get the current progress callback function in *CB and the current - * hook value in *HOOK_VALUE. */ -void gpgme_get_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t *cb, - void **hook_value); - -/* Set the status callback function in CTX to CB. HOOK_VALUE is - * passed as first argument to the status callback function. */ -void gpgme_set_status_cb (gpgme_ctx_t c, gpgme_status_cb_t cb, - void *hook_value); - -/* Get the current status callback function in *CB and the current - * hook value in *HOOK_VALUE. */ -void gpgme_get_status_cb (gpgme_ctx_t ctx, gpgme_status_cb_t *cb, - void **hook_value); - -/* This function sets the locale for the context CTX, or the default - * locale if CTX is a null pointer. */ -gpgme_error_t gpgme_set_locale (gpgme_ctx_t ctx, int category, - const char *value); - -/* Get the information about the configured engines. A pointer to the - * first engine in the statically allocated linked list is returned. - * The returned data is valid until the next gpgme_ctx_set_engine_info. */ -gpgme_engine_info_t gpgme_ctx_get_engine_info (gpgme_ctx_t ctx); - -/* Set the engine info for the context CTX, protocol PROTO, to the - * file name FILE_NAME and the home directory HOME_DIR. */ -gpgme_error_t gpgme_ctx_set_engine_info (gpgme_ctx_t ctx, - gpgme_protocol_t proto, - const char *file_name, - const char *home_dir); - -/* Delete all signers from CTX. */ -void gpgme_signers_clear (gpgme_ctx_t ctx); - -/* Add KEY to list of signers in CTX. */ -gpgme_error_t gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key); - -/* Return the number of signers in CTX. */ -unsigned int gpgme_signers_count (const gpgme_ctx_t ctx); - -/* Return the SEQth signer's key in CTX. */ -gpgme_key_t gpgme_signers_enum (const gpgme_ctx_t ctx, int seq); - -/* Clear all notation data from the context. */ -void gpgme_sig_notation_clear (gpgme_ctx_t ctx); - -/* Add the human-readable notation data with name NAME and value VALUE - * to the context CTX, using the flags FLAGS. If NAME is NULL, then - * VALUE should be a policy URL. The flag - * GPGME_SIG_NOTATION_HUMAN_READABLE is forced to be true for notation - * data, and false for policy URLs. */ -gpgme_error_t gpgme_sig_notation_add (gpgme_ctx_t ctx, const char *name, - const char *value, - gpgme_sig_notation_flags_t flags); - -/* Get the sig notations for this context. */ -gpgme_sig_notation_t gpgme_sig_notation_get (gpgme_ctx_t ctx); - -/* Store a sender address in the context. */ -gpgme_error_t gpgme_set_sender (gpgme_ctx_t ctx, const char *address); - -/* Get the sender address from the context. */ -const char *gpgme_get_sender (gpgme_ctx_t ctx); - - - -/* - * Run control. - */ - -/* The type of an I/O callback function. */ -typedef gpgme_error_t (*gpgme_io_cb_t) (void *data, int fd); - -/* The type of a function that can register FNC as the I/O callback - * function for the file descriptor FD with direction dir (0: for writing, - * 1: for reading). FNC_DATA should be passed as DATA to FNC. The - * function should return a TAG suitable for the corresponding - * gpgme_remove_io_cb_t, and an error value. */ -typedef gpgme_error_t (*gpgme_register_io_cb_t) (void *data, int fd, int dir, - gpgme_io_cb_t fnc, - void *fnc_data, void **tag); - -/* The type of a function that can remove a previously registered I/O - * callback function given TAG as returned by the register - * function. */ -typedef void (*gpgme_remove_io_cb_t) (void *tag); - -typedef enum - { - GPGME_EVENT_START, - GPGME_EVENT_DONE, - GPGME_EVENT_NEXT_KEY, - GPGME_EVENT_NEXT_TRUSTITEM /* NOT USED. */ - } -gpgme_event_io_t; - -struct gpgme_io_event_done_data -{ - /* A fatal IPC error or an operational error in state-less - * protocols. */ - gpgme_error_t err; - - /* An operational errors in session-based protocols. */ - gpgme_error_t op_err; -}; -typedef struct gpgme_io_event_done_data *gpgme_io_event_done_data_t; - -/* The type of a function that is called when a context finished an - * operation. */ -typedef void (*gpgme_event_io_cb_t) (void *data, gpgme_event_io_t type, - void *type_data); - -struct gpgme_io_cbs -{ - gpgme_register_io_cb_t add; - void *add_priv; - gpgme_remove_io_cb_t remove; - gpgme_event_io_cb_t event; - void *event_priv; -}; -typedef struct gpgme_io_cbs *gpgme_io_cbs_t; - -/* Set the I/O callback functions in CTX to IO_CBS. */ -void gpgme_set_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs); - -/* Get the current I/O callback functions. */ -void gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs); - -/* Wrappers around the internal I/O functions for use with - * gpgme_passphrase_cb_t and gpgme_interact_cb_t. */ -ssize_t gpgme_io_read (int fd, void *buffer, size_t count); -ssize_t gpgme_io_write (int fd, const void *buffer, size_t count); -int gpgme_io_writen (int fd, const void *buffer, size_t count); - -/* Process the pending operation and, if HANG is non-zero, wait for - * the pending operation to finish. */ -gpgme_ctx_t gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang); - -gpgme_ctx_t gpgme_wait_ext (gpgme_ctx_t ctx, gpgme_error_t *status, - gpgme_error_t *op_err, int hang); - -/* Cancel a pending asynchronous operation. */ -gpgme_error_t gpgme_cancel (gpgme_ctx_t ctx); - -/* Cancel a pending operation asynchronously. */ -gpgme_error_t gpgme_cancel_async (gpgme_ctx_t ctx); - - - -/* - * Functions to handle data objects. - */ - -/* Read up to SIZE bytes into buffer BUFFER from the data object with - * the handle HANDLE. Return the number of characters read, 0 on EOF - * and -1 on error. If an error occurs, errno is set. */ -typedef ssize_t (*gpgme_data_read_cb_t) (void *handle, void *buffer, - size_t size); - -/* Write up to SIZE bytes from buffer BUFFER to the data object with - * the handle HANDLE. Return the number of characters written, or -1 - * on error. If an error occurs, errno is set. */ -typedef ssize_t (*gpgme_data_write_cb_t) (void *handle, const void *buffer, - size_t size); - -/* Set the current position from where the next read or write starts - * in the data object with the handle HANDLE to OFFSET, relativ to - * WHENCE. Returns the new offset in bytes from the beginning of the - * data object. */ -typedef off_t (*gpgme_data_seek_cb_t) (void *handle, - off_t offset, int whence); - -/* Close the data object with the handle HANDLE. */ -typedef void (*gpgme_data_release_cb_t) (void *handle); - -struct gpgme_data_cbs -{ - gpgme_data_read_cb_t read; - gpgme_data_write_cb_t write; - gpgme_data_seek_cb_t seek; - gpgme_data_release_cb_t release; -}; -typedef struct gpgme_data_cbs *gpgme_data_cbs_t; - -/* Read up to SIZE bytes into buffer BUFFER from the data object with - * the handle DH. Return the number of characters read, 0 on EOF and - * -1 on error. If an error occurs, errno is set. */ -ssize_t gpgme_data_read (gpgme_data_t dh, void *buffer, size_t size); - -/* Write up to SIZE bytes from buffer BUFFER to the data object with - * the handle DH. Return the number of characters written, or -1 on - * error. If an error occurs, errno is set. */ -ssize_t gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size); - -/* Set the current position from where the next read or write starts - * in the data object with the handle DH to OFFSET, relativ to WHENCE. - * Returns the new offset in bytes from the beginning of the data - * object. */ -off_t gpgme_data_seek (gpgme_data_t dh, off_t offset, int whence); - -/* Create a new data buffer and return it in R_DH. */ -gpgme_error_t gpgme_data_new (gpgme_data_t *r_dh); - -/* Destroy the data buffer DH. */ -void gpgme_data_release (gpgme_data_t dh); - -/* Create a new data buffer filled with SIZE bytes starting from - * BUFFER. If COPY is zero, copying is delayed until necessary, and - * the data is taken from the original location when needed. */ -gpgme_error_t gpgme_data_new_from_mem (gpgme_data_t *r_dh, - const char *buffer, size_t size, - int copy); - -/* Destroy the data buffer DH and return a pointer to its content. - * The memory has be to released with gpgme_free() by the user. It's - * size is returned in R_LEN. */ -char *gpgme_data_release_and_get_mem (gpgme_data_t dh, size_t *r_len); - -/* Release the memory returned by gpgme_data_release_and_get_mem() and - * some other functions. */ -void gpgme_free (void *buffer); - -gpgme_error_t gpgme_data_new_from_cbs (gpgme_data_t *dh, - gpgme_data_cbs_t cbs, - void *handle); - -gpgme_error_t gpgme_data_new_from_fd (gpgme_data_t *dh, int fd); - -gpgme_error_t gpgme_data_new_from_stream (gpgme_data_t *dh, FILE *stream); -gpgme_error_t gpgme_data_new_from_estream (gpgme_data_t *r_dh, - gpgrt_stream_t stream); - -/* Return the encoding attribute of the data buffer DH */ -gpgme_data_encoding_t gpgme_data_get_encoding (gpgme_data_t dh); - -/* Set the encoding attribute of data buffer DH to ENC */ -gpgme_error_t gpgme_data_set_encoding (gpgme_data_t dh, - gpgme_data_encoding_t enc); - -/* Get the file name associated with the data object with handle DH, or - * NULL if there is none. */ -char *gpgme_data_get_file_name (gpgme_data_t dh); - -/* Set the file name associated with the data object with handle DH to - * FILE_NAME. */ -gpgme_error_t gpgme_data_set_file_name (gpgme_data_t dh, - const char *file_name); - -/* Set a flag for the data object DH. See the manual for details. */ -gpg_error_t gpgme_data_set_flag (gpgme_data_t dh, - const char *name, const char *value); - -/* Try to identify the type of the data in DH. */ -gpgme_data_type_t gpgme_data_identify (gpgme_data_t dh, int reserved); - - -/* Create a new data buffer filled with the content of file FNAME. - * COPY must be non-zero. For delayed read, please use - * gpgme_data_new_from_fd or gpgme_data_new_from_stream instead. */ -gpgme_error_t gpgme_data_new_from_file (gpgme_data_t *r_dh, - const char *fname, - int copy); - -/* Create a new data buffer filled with LENGTH bytes starting from - * OFFSET within the file FNAME or stream FP (exactly one must be - * non-zero). */ -gpgme_error_t gpgme_data_new_from_filepart (gpgme_data_t *r_dh, - const char *fname, FILE *fp, - off_t offset, size_t length); - -/* Convenience function to do a gpgme_data_seek (dh, 0, SEEK_SET). */ -gpgme_error_t gpgme_data_rewind (gpgme_data_t dh); - - - -/* - * Key and trust functions. - */ - -/* Get the key with the fingerprint FPR from the crypto backend. If - * SECRET is true, get the secret key. */ -gpgme_error_t gpgme_get_key (gpgme_ctx_t ctx, const char *fpr, - gpgme_key_t *r_key, int secret); - -/* Create a dummy key to specify an email address. */ -gpgme_error_t gpgme_key_from_uid (gpgme_key_t *key, const char *name); - -/* Acquire a reference to KEY. */ -void gpgme_key_ref (gpgme_key_t key); - -/* Release a reference to KEY. If this was the last one the key is - * destroyed. */ -void gpgme_key_unref (gpgme_key_t key); -void gpgme_key_release (gpgme_key_t key); - - - -/* - * Encryption. - */ - -/* An object to return results from an encryption operation. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -struct _gpgme_op_encrypt_result -{ - /* The list of invalid recipients. */ - gpgme_invalid_key_t invalid_recipients; -}; -typedef struct _gpgme_op_encrypt_result *gpgme_encrypt_result_t; - -/* Retrieve a pointer to the result of the encrypt operation. */ -gpgme_encrypt_result_t gpgme_op_encrypt_result (gpgme_ctx_t ctx); - -/* The valid encryption flags. */ -typedef enum - { - GPGME_ENCRYPT_ALWAYS_TRUST = 1, - GPGME_ENCRYPT_NO_ENCRYPT_TO = 2, - GPGME_ENCRYPT_PREPARE = 4, - GPGME_ENCRYPT_EXPECT_SIGN = 8, - GPGME_ENCRYPT_NO_COMPRESS = 16, - GPGME_ENCRYPT_SYMMETRIC = 32, - GPGME_ENCRYPT_THROW_KEYIDS = 64, - GPGME_ENCRYPT_WRAP = 128, - GPGME_ENCRYPT_WANT_ADDRESS = 256 - } -gpgme_encrypt_flags_t; - -/* Encrypt plaintext PLAIN within CTX for the recipients RECP and - * store the resulting ciphertext in CIPHER. */ -gpgme_error_t gpgme_op_encrypt_start (gpgme_ctx_t ctx, gpgme_key_t recp[], - gpgme_encrypt_flags_t flags, - gpgme_data_t plain, - gpgme_data_t cipher); -gpgme_error_t gpgme_op_encrypt (gpgme_ctx_t ctx, gpgme_key_t recp[], - gpgme_encrypt_flags_t flags, - gpgme_data_t plain, - gpgme_data_t cipher); -gpgme_error_t gpgme_op_encrypt_ext_start (gpgme_ctx_t ctx, gpgme_key_t recp[], - const char *recpstring, - gpgme_encrypt_flags_t flags, - gpgme_data_t plain, - gpgme_data_t cipher); -gpgme_error_t gpgme_op_encrypt_ext (gpgme_ctx_t ctx, gpgme_key_t recp[], - const char *recpstring, - gpgme_encrypt_flags_t flags, - gpgme_data_t plain, - gpgme_data_t cipher); - -/* Encrypt plaintext PLAIN within CTX for the recipients RECP and - * store the resulting ciphertext in CIPHER. Also sign the ciphertext - * with the signers in CTX. */ -gpgme_error_t gpgme_op_encrypt_sign_start (gpgme_ctx_t ctx, - gpgme_key_t recp[], - gpgme_encrypt_flags_t flags, - gpgme_data_t plain, - gpgme_data_t cipher); -gpgme_error_t gpgme_op_encrypt_sign (gpgme_ctx_t ctx, gpgme_key_t recp[], - gpgme_encrypt_flags_t flags, - gpgme_data_t plain, - gpgme_data_t cipher); -gpgme_error_t gpgme_op_encrypt_sign_ext_start (gpgme_ctx_t ctx, - gpgme_key_t recp[], - const char *recpstring, - gpgme_encrypt_flags_t flags, - gpgme_data_t plain, - gpgme_data_t cipher); -gpgme_error_t gpgme_op_encrypt_sign_ext (gpgme_ctx_t ctx, gpgme_key_t recp[], - const char *recpstring, - gpgme_encrypt_flags_t flags, - gpgme_data_t plain, - gpgme_data_t cipher); - - -/* - * Decryption. - */ - -/* An object to hold information about a recipient. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -struct _gpgme_recipient -{ - struct _gpgme_recipient *next; - - /* The key ID of key for which the text was encrypted. */ - char *keyid; - - /* Internal to GPGME, do not use. */ - char _keyid[16 + 1]; - - /* The public key algorithm of the recipient key. */ - gpgme_pubkey_algo_t pubkey_algo; - - /* The status of the recipient. */ - gpgme_error_t status; -}; -typedef struct _gpgme_recipient *gpgme_recipient_t; - - -/* An object to return results from a decryption operation. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -struct _gpgme_op_decrypt_result -{ - char *unsupported_algorithm; - - /* Key should not have been used for encryption. */ - unsigned int wrong_key_usage : 1; - - /* True if the message was encrypted in compliance to the de-vs - * mode. */ - unsigned int is_de_vs : 1; - - /* The message claims that the content is a MIME object. */ - unsigned int is_mime : 1; - - /* The message was made by a legacy algorithm without any integrity - * protection. This might be an old but legitimate message. */ - unsigned int legacy_cipher_nomdc : 1; - - /* Internal to GPGME, do not use. */ - int _unused : 28; - - gpgme_recipient_t recipients; - - /* The original file name of the plaintext message, if - * available. */ - char *file_name; - - /* A textual representation of the session key used to decrypt the - * message, if available */ - char *session_key; - - /* A string with the symmetric encryption algorithm and mode using - * the format "<algo>.<mode>". */ - char *symkey_algo; -}; -typedef struct _gpgme_op_decrypt_result *gpgme_decrypt_result_t; - - -/* Retrieve a pointer to the result of the decrypt operation. */ -gpgme_decrypt_result_t gpgme_op_decrypt_result (gpgme_ctx_t ctx); - - -/* The valid decryption flags. */ -typedef enum - { - GPGME_DECRYPT_VERIFY = 1, - GPGME_DECRYPT_UNWRAP = 128 - } -gpgme_decrypt_flags_t; - - -/* Decrypt ciphertext CIPHER within CTX and store the resulting - * plaintext in PLAIN. */ -gpgme_error_t gpgme_op_decrypt_start (gpgme_ctx_t ctx, gpgme_data_t cipher, - gpgme_data_t plain); -gpgme_error_t gpgme_op_decrypt (gpgme_ctx_t ctx, - gpgme_data_t cipher, gpgme_data_t plain); - -/* Decrypt ciphertext CIPHER and make a signature verification within - * CTX and store the resulting plaintext in PLAIN. */ -gpgme_error_t gpgme_op_decrypt_verify_start (gpgme_ctx_t ctx, - gpgme_data_t cipher, - gpgme_data_t plain); -gpgme_error_t gpgme_op_decrypt_verify (gpgme_ctx_t ctx, gpgme_data_t cipher, - gpgme_data_t plain); - -/* Decrypt ciphertext CIPHER within CTX and store the resulting - * plaintext in PLAIN. With the flag GPGME_DECRYPT_VERIFY also do a - * signature verification pn the plaintext. */ -gpgme_error_t gpgme_op_decrypt_ext_start (gpgme_ctx_t ctx, - gpgme_decrypt_flags_t flags, - gpgme_data_t cipher, - gpgme_data_t plain); -gpgme_error_t gpgme_op_decrypt_ext (gpgme_ctx_t ctx, - gpgme_decrypt_flags_t flags, - gpgme_data_t cipher, - gpgme_data_t plain); - - - -/* - * Signing. - */ - -/* An object with signatures data. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -struct _gpgme_new_signature -{ - struct _gpgme_new_signature *next; - - /* The type of the signature. */ - gpgme_sig_mode_t type; - - /* The public key algorithm used to create the signature. */ - gpgme_pubkey_algo_t pubkey_algo; - - /* The hash algorithm used to create the signature. */ - gpgme_hash_algo_t hash_algo; - - /* Internal to GPGME, do not use. Must be set to the same value as - * CLASS below. */ - unsigned long _obsolete_class; - - /* Signature creation time. */ - long int timestamp; - - /* The fingerprint of the signature. */ - char *fpr; - - /* Deprecated; use SIG_CLASS instead. */ -#ifdef _GPGME_OBSOLETE_SOME_SYMBOLS - unsigned int _obsolete_class_2; -#else - unsigned int class _GPGME_DEPRECATED_OUTSIDE_GPGME(0,4); -#endif - - /* Crypto backend specific signature class. */ - unsigned int sig_class; -}; -typedef struct _gpgme_new_signature *gpgme_new_signature_t; - - -/* An object to return results from a signing operation. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -struct _gpgme_op_sign_result -{ - /* The list of invalid signers. */ - gpgme_invalid_key_t invalid_signers; - gpgme_new_signature_t signatures; -}; -typedef struct _gpgme_op_sign_result *gpgme_sign_result_t; - - -/* Retrieve a pointer to the result of the signing operation. */ -gpgme_sign_result_t gpgme_op_sign_result (gpgme_ctx_t ctx); - -/* Sign the plaintext PLAIN and store the signature in SIG. */ -gpgme_error_t gpgme_op_sign_start (gpgme_ctx_t ctx, - gpgme_data_t plain, gpgme_data_t sig, - gpgme_sig_mode_t mode); -gpgme_error_t gpgme_op_sign (gpgme_ctx_t ctx, - gpgme_data_t plain, gpgme_data_t sig, - gpgme_sig_mode_t mode); - - -/* - * Verify. - */ - -/* Flags used for the SUMMARY field in a gpgme_signature_t. */ -typedef enum - { - GPGME_SIGSUM_VALID = 0x0001, /* The signature is fully valid. */ - GPGME_SIGSUM_GREEN = 0x0002, /* The signature is good. */ - GPGME_SIGSUM_RED = 0x0004, /* The signature is bad. */ - GPGME_SIGSUM_KEY_REVOKED = 0x0010, /* One key has been revoked. */ - GPGME_SIGSUM_KEY_EXPIRED = 0x0020, /* One key has expired. */ - GPGME_SIGSUM_SIG_EXPIRED = 0x0040, /* The signature has expired. */ - GPGME_SIGSUM_KEY_MISSING = 0x0080, /* Can't verify: key missing. */ - GPGME_SIGSUM_CRL_MISSING = 0x0100, /* CRL not available. */ - GPGME_SIGSUM_CRL_TOO_OLD = 0x0200, /* Available CRL is too old. */ - GPGME_SIGSUM_BAD_POLICY = 0x0400, /* A policy was not met. */ - GPGME_SIGSUM_SYS_ERROR = 0x0800, /* A system error occurred. */ - GPGME_SIGSUM_TOFU_CONFLICT=0x1000 /* Tofu conflict detected. */ - } -gpgme_sigsum_t; - - -/* An object to hold the verification status of a signature. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -struct _gpgme_signature -{ - struct _gpgme_signature *next; - - /* A summary of the signature status. */ - gpgme_sigsum_t summary; - - /* The fingerprint of the signature. This can be a subkey. */ - char *fpr; - - /* The status of the signature. */ - gpgme_error_t status; - - /* Notation data and policy URLs. */ - gpgme_sig_notation_t notations; - - /* Signature creation time. */ - unsigned long timestamp; - - /* Signature expiration time or 0. */ - unsigned long exp_timestamp; - - /* Key should not have been used for signing. */ - unsigned int wrong_key_usage : 1; - - /* PKA status: 0 = not available, 1 = bad, 2 = okay, 3 = RFU. */ - unsigned int pka_trust : 2; - - /* Validity has been verified using the chain model. */ - unsigned int chain_model : 1; - - /* True if the signature is in compliance to the de-vs mode. */ - unsigned int is_de_vs : 1; - - /* Internal to GPGME, do not use. */ - int _unused : 27; - - gpgme_validity_t validity; - gpgme_error_t validity_reason; - - /* The public key algorithm used to create the signature. */ - gpgme_pubkey_algo_t pubkey_algo; - - /* The hash algorithm used to create the signature. */ - gpgme_hash_algo_t hash_algo; - - /* The mailbox from the PKA information or NULL. */ - char *pka_address; - - /* If non-NULL, a possible incomplete key object with the data - * available for the signature. */ - gpgme_key_t key; -}; -typedef struct _gpgme_signature *gpgme_signature_t; - - -/* An object to return the results of a verify operation. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -struct _gpgme_op_verify_result -{ - gpgme_signature_t signatures; - - /* The original file name of the plaintext message, if available. - * Warning: This information is not covered by the signature. */ - char *file_name; - - /* The message claims that the content is a MIME object. */ - /* Warning: This flag is not covered by the signature. */ - unsigned int is_mime : 1; - - /* Internal to GPGME; do not use. */ - unsigned int _unused : 31; -}; -typedef struct _gpgme_op_verify_result *gpgme_verify_result_t; - - -/* Retrieve a pointer to the result of the verify operation. */ -gpgme_verify_result_t gpgme_op_verify_result (gpgme_ctx_t ctx); - -/* Verify within CTX that SIG is a valid signature for TEXT. */ -gpgme_error_t gpgme_op_verify_start (gpgme_ctx_t ctx, gpgme_data_t sig, - gpgme_data_t signed_text, - gpgme_data_t plaintext); -gpgme_error_t gpgme_op_verify (gpgme_ctx_t ctx, gpgme_data_t sig, - gpgme_data_t signed_text, - gpgme_data_t plaintext); - - -/* - * Import/Export - */ - -#define GPGME_IMPORT_NEW 1 /* The key was new. */ -#define GPGME_IMPORT_UID 2 /* The key contained new user IDs. */ -#define GPGME_IMPORT_SIG 4 /* The key contained new signatures. */ -#define GPGME_IMPORT_SUBKEY 8 /* The key contained new sub keys. */ -#define GPGME_IMPORT_SECRET 16 /* The key contained a secret key. */ - - -/* An object to hold results for one imported key. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -struct _gpgme_import_status -{ - struct _gpgme_import_status *next; - - /* Fingerprint. */ - char *fpr; - - /* If a problem occurred, the reason why the key could not be - imported. Otherwise GPGME_No_Error. */ - gpgme_error_t result; - - /* The result of the import, the GPGME_IMPORT_* values bit-wise - ORed. 0 means the key was already known and no new components - have been added. */ - unsigned int status; -}; -typedef struct _gpgme_import_status *gpgme_import_status_t; - - -/* Import result object. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -struct _gpgme_op_import_result -{ - /* Number of considered keys. */ - int considered; - - /* Keys without user ID. */ - int no_user_id; - - /* Imported keys. */ - int imported; - - /* Imported RSA keys. */ - int imported_rsa; - - /* Unchanged keys. */ - int unchanged; - - /* Number of new user ids. */ - int new_user_ids; - - /* Number of new sub keys. */ - int new_sub_keys; - - /* Number of new signatures. */ - int new_signatures; - - /* Number of new revocations. */ - int new_revocations; - - /* Number of secret keys read. */ - int secret_read; - - /* Number of secret keys imported. */ - int secret_imported; - - /* Number of secret keys unchanged. */ - int secret_unchanged; - - /* Number of new keys skipped. */ - int skipped_new_keys; - - /* Number of keys not imported. */ - int not_imported; - - /* List of keys for which an import was attempted. */ - gpgme_import_status_t imports; - - /* Number of v3 keys skipped. */ - int skipped_v3_keys; -}; -typedef struct _gpgme_op_import_result *gpgme_import_result_t; - - -/* Retrieve a pointer to the result of the import operation. */ -gpgme_import_result_t gpgme_op_import_result (gpgme_ctx_t ctx); - -/* Import the key in KEYDATA into the keyring. */ -gpgme_error_t gpgme_op_import_start (gpgme_ctx_t ctx, gpgme_data_t keydata); -gpgme_error_t gpgme_op_import (gpgme_ctx_t ctx, gpgme_data_t keydata); - -/* Import the keys from the array KEYS into the keyring. */ -gpgme_error_t gpgme_op_import_keys_start (gpgme_ctx_t ctx, gpgme_key_t keys[]); -gpgme_error_t gpgme_op_import_keys (gpgme_ctx_t ctx, gpgme_key_t keys[]); - - -/* Export the keys found by PATTERN into KEYDATA. */ -gpgme_error_t gpgme_op_export_start (gpgme_ctx_t ctx, const char *pattern, - gpgme_export_mode_t mode, - gpgme_data_t keydata); -gpgme_error_t gpgme_op_export (gpgme_ctx_t ctx, const char *pattern, - gpgme_export_mode_t mode, - gpgme_data_t keydata); - -gpgme_error_t gpgme_op_export_ext_start (gpgme_ctx_t ctx, - const char *pattern[], - gpgme_export_mode_t mode, - gpgme_data_t keydata); -gpgme_error_t gpgme_op_export_ext (gpgme_ctx_t ctx, const char *pattern[], - gpgme_export_mode_t mode, - gpgme_data_t keydata); - -/* Export the keys from the array KEYS into KEYDATA. */ -gpgme_error_t gpgme_op_export_keys_start (gpgme_ctx_t ctx, - gpgme_key_t keys[], - gpgme_export_mode_t mode, - gpgme_data_t keydata); -gpgme_error_t gpgme_op_export_keys (gpgme_ctx_t ctx, - gpgme_key_t keys[], - gpgme_export_mode_t mode, - gpgme_data_t keydata); - - - -/* - * Key generation. - */ - -/* Flags for the key creation functions. */ -#define GPGME_CREATE_SIGN (1 << 0) /* Allow usage: signing. */ -#define GPGME_CREATE_ENCR (1 << 1) /* Allow usage: encryption. */ -#define GPGME_CREATE_CERT (1 << 2) /* Allow usage: certification. */ -#define GPGME_CREATE_AUTH (1 << 3) /* Allow usage: authentication. */ -#define GPGME_CREATE_NOPASSWD (1 << 7) /* Create w/o passphrase. */ -#define GPGME_CREATE_SELFSIGNED (1 << 8) /* Create self-signed cert. */ -#define GPGME_CREATE_NOSTORE (1 << 9) /* Do not store the key. */ -#define GPGME_CREATE_WANTPUB (1 << 10) /* Return the public key. */ -#define GPGME_CREATE_WANTSEC (1 << 11) /* Return the secret key. */ -#define GPGME_CREATE_FORCE (1 << 12) /* Force creation. */ -#define GPGME_CREATE_NOEXPIRE (1 << 13) /* Create w/o expiration. */ - - -/* An object to return result from a key generation. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -struct _gpgme_op_genkey_result -{ - /* A primary key was generated. */ - unsigned int primary : 1; - - /* A sub key was generated. */ - unsigned int sub : 1; - - /* A user id was generated. */ - unsigned int uid : 1; - - /* Internal to GPGME, do not use. */ - unsigned int _unused : 29; - - /* The fingerprint of the generated key. */ - char *fpr; - - /* A memory data object with the created public key. Only set when - * GPGME_CREATE_WANTPUB has been used. */ - gpgme_data_t pubkey; - - /* A memory data object with the created secret key. Only set when - * GPGME_CREATE_WANTSEC has been used. */ - gpgme_data_t seckey; -}; -typedef struct _gpgme_op_genkey_result *gpgme_genkey_result_t; - - -/* Generate a new keypair and add it to the keyring. PUBKEY and - * SECKEY should be null for now. PARMS specifies what keys should be - * generated. */ -gpgme_error_t gpgme_op_genkey_start (gpgme_ctx_t ctx, const char *parms, - gpgme_data_t pubkey, gpgme_data_t seckey); -gpgme_error_t gpgme_op_genkey (gpgme_ctx_t ctx, const char *parms, - gpgme_data_t pubkey, gpgme_data_t seckey); - -/* Generate a key pair using the modern interface. */ -gpgme_error_t gpgme_op_createkey_start (gpgme_ctx_t ctx, - const char *userid, - const char *algo, - unsigned long reserved, - unsigned long expires, - gpgme_key_t certkey, - unsigned int flags); -gpgme_error_t gpgme_op_createkey (gpgme_ctx_t ctx, - const char *userid, - const char *algo, - unsigned long reserved, - unsigned long expires, - gpgme_key_t certkey, - unsigned int flags); -/* Add a new subkey to KEY. */ -gpgme_error_t gpgme_op_createsubkey_start (gpgme_ctx_t ctx, - gpgme_key_t key, - const char *algo, - unsigned long reserved, - unsigned long expires, - unsigned int flags); -gpgme_error_t gpgme_op_createsubkey (gpgme_ctx_t ctx, - gpgme_key_t key, - const char *algo, - unsigned long reserved, - unsigned long expires, - unsigned int flags); - -/* Add USERID to an existing KEY. */ -gpgme_error_t gpgme_op_adduid_start (gpgme_ctx_t ctx, - gpgme_key_t key, const char *userid, - unsigned int reserved); -gpgme_error_t gpgme_op_adduid (gpgme_ctx_t ctx, - gpgme_key_t key, const char *userid, - unsigned int reserved); - -/* Revoke a USERID from a KEY. */ -gpgme_error_t gpgme_op_revuid_start (gpgme_ctx_t ctx, - gpgme_key_t key, const char *userid, - unsigned int reserved); -gpgme_error_t gpgme_op_revuid (gpgme_ctx_t ctx, - gpgme_key_t key, const char *userid, - unsigned int reserved); - -/* Set a flag on the USERID of KEY. See the manual for supported flags. */ -gpgme_error_t gpgme_op_set_uid_flag_start (gpgme_ctx_t ctx, - gpgme_key_t key, const char *userid, - const char *name, const char *value); -gpgme_error_t gpgme_op_set_uid_flag (gpgme_ctx_t ctx, - gpgme_key_t key, const char *userid, - const char *name, const char *value); - -/* Change the expiry of a key. */ -gpgme_error_t gpgme_op_setexpire_start (gpgme_ctx_t ctx, - gpgme_key_t key, unsigned long expires, - const char *subfprs, unsigned int reserved); -gpgme_error_t gpgme_op_setexpire (gpgme_ctx_t ctx, - gpgme_key_t key, unsigned long expires, - const char *subfprs, unsigned int reserved); - -/* Retrieve a pointer to the result of a genkey, createkey, or - * createsubkey operation. */ -gpgme_genkey_result_t gpgme_op_genkey_result (gpgme_ctx_t ctx); - - -/* Delete KEY from the keyring. If ALLOW_SECRET is non-zero, secret - * keys are also deleted. */ -gpgme_error_t gpgme_op_delete_start (gpgme_ctx_t ctx, const gpgme_key_t key, - int allow_secret); -gpgme_error_t gpgme_op_delete (gpgme_ctx_t ctx, const gpgme_key_t key, - int allow_secret); - -/* Flags for the key delete functions. */ -#define GPGME_DELETE_ALLOW_SECRET (1 << 0) /* Also delete secret key. */ -#define GPGME_DELETE_FORCE (1 << 1) /* Do not ask user to confirm. */ - -gpgme_error_t gpgme_op_delete_ext_start (gpgme_ctx_t ctx, const gpgme_key_t key, - unsigned int flags); -gpgme_error_t gpgme_op_delete_ext (gpgme_ctx_t ctx, const gpgme_key_t key, - unsigned int flags); - - -/* - * Key signing interface - */ - -/* Flags for the key signing functions. */ -#define GPGME_KEYSIGN_LOCAL (1 << 7) /* Create a local signature. */ -#define GPGME_KEYSIGN_LFSEP (1 << 8) /* Indicate LF separated user ids. */ -#define GPGME_KEYSIGN_NOEXPIRE (1 << 9) /* Force no expiration. */ -#define GPGME_KEYSIGN_FORCE (1 << 10) /* Force creation. */ - - -/* Sign the USERID of KEY using the current set of signers. */ -gpgme_error_t gpgme_op_keysign_start (gpgme_ctx_t ctx, - gpgme_key_t key, const char *userid, - unsigned long expires, - unsigned int flags); -gpgme_error_t gpgme_op_keysign (gpgme_ctx_t ctx, - gpgme_key_t key, const char *userid, - unsigned long expires, - unsigned int flags); - - -/* Flags for the signature revoking functions. */ -#define GPGME_REVSIG_LFSEP (1 << 8) /* Indicate LF separated user ids. */ - -/* Revoke the signatures made with SIGNING_KEY on the USERID(s) of KEY. */ -gpgme_error_t gpgme_op_revsig_start (gpgme_ctx_t ctx, - gpgme_key_t key, - gpgme_key_t signing_key, - const char *userid, - unsigned int flags); -gpgme_error_t gpgme_op_revsig (gpgme_ctx_t ctx, - gpgme_key_t key, - gpgme_key_t signing_key, - const char *userid, - unsigned int flags); - - -/* - * Key edit interface - */ - -/* Flags to select the mode of the interact. */ -#define GPGME_INTERACT_CARD (1 << 0) /* Use --card-edit mode. */ - - -/* Edit the KEY. Send status and command requests to FNC and - output of edit commands to OUT. */ -gpgme_error_t gpgme_op_interact_start (gpgme_ctx_t ctx, - gpgme_key_t key, - unsigned int flags, - gpgme_interact_cb_t fnc, - void *fnc_value, - gpgme_data_t out); -gpgme_error_t gpgme_op_interact (gpgme_ctx_t ctx, gpgme_key_t key, - unsigned int flags, - gpgme_interact_cb_t fnc, - void *fnc_value, - gpgme_data_t out); - - -/* Set the Tofu policy of KEY to POLCIY. */ -gpgme_error_t gpgme_op_tofu_policy_start (gpgme_ctx_t ctx, - gpgme_key_t key, - gpgme_tofu_policy_t policy); -gpgme_error_t gpgme_op_tofu_policy (gpgme_ctx_t ctx, - gpgme_key_t key, - gpgme_tofu_policy_t policy); - - - - -/* - * Key listing - */ - -/* An object to return results from a key listing operation. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -struct _gpgme_op_keylist_result -{ - unsigned int truncated : 1; - - /* Internal to GPGME, do not use. */ - unsigned int _unused : 31; -}; -typedef struct _gpgme_op_keylist_result *gpgme_keylist_result_t; - -/* Retrieve a pointer to the result of the key listing operation. */ -gpgme_keylist_result_t gpgme_op_keylist_result (gpgme_ctx_t ctx); - -/* Start a keylist operation within CTX, searching for keys which - * match PATTERN. If SECRET_ONLY is true, only secret keys are - * returned. */ -gpgme_error_t gpgme_op_keylist_start (gpgme_ctx_t ctx, const char *pattern, - int secret_only); -gpgme_error_t gpgme_op_keylist_ext_start (gpgme_ctx_t ctx, - const char *pattern[], - int secret_only, int reserved); - -/* List the keys contained in DATA. */ -gpgme_error_t gpgme_op_keylist_from_data_start (gpgme_ctx_t ctx, - gpgme_data_t data, - int reserved); - -/* Return the next key from the keylist in R_KEY. */ -gpgme_error_t gpgme_op_keylist_next (gpgme_ctx_t ctx, gpgme_key_t *r_key); - -/* Terminate a pending keylist operation within CTX. */ -gpgme_error_t gpgme_op_keylist_end (gpgme_ctx_t ctx); - - - -/* - * Protecting keys - */ - -/* Change the passphrase for KEY. FLAGS is reserved for future use - * and must be passed as 0. */ -gpgme_error_t gpgme_op_passwd_start (gpgme_ctx_t ctx, gpgme_key_t key, - unsigned int flags); -gpgme_error_t gpgme_op_passwd (gpgme_ctx_t ctx, gpgme_key_t key, - unsigned int flags); - - - -/* - * Trust items and operations. DO NOT USE. - * Note: This does not work because the experimental support in the - * GnuPG engine has been removed a very long time; for API and ABI - * compatibilty we keep the functions but let them return an error. - * See https://dev.gnupg.org/T4834 - */ -struct _gpgme_trust_item -{ - unsigned int _refs; - char *keyid; - char _keyid[16 + 1]; - int type; - int level; - char *owner_trust; - char _owner_trust[2]; - char *validity; - char _validity[2]; - char *name; -}; -typedef struct _gpgme_trust_item *gpgme_trust_item_t; -gpgme_error_t gpgme_op_trustlist_start (gpgme_ctx_t ctx, - const char *pattern, int max_level); -gpgme_error_t gpgme_op_trustlist_next (gpgme_ctx_t ctx, - gpgme_trust_item_t *r_item); -gpgme_error_t gpgme_op_trustlist_end (gpgme_ctx_t ctx); -void gpgme_trust_item_ref (gpgme_trust_item_t item); -void gpgme_trust_item_unref (gpgme_trust_item_t item); - - - -/* - * Audit log - */ - -/* Return the auditlog for the current session. This may be called - after a successful or failed operation. If no audit log is - available GPG_ERR_NO_DATA is returned. */ -gpgme_error_t gpgme_op_getauditlog_start (gpgme_ctx_t ctx, gpgme_data_t output, - unsigned int flags); -gpgme_error_t gpgme_op_getauditlog (gpgme_ctx_t ctx, gpgme_data_t output, - unsigned int flags); - - - -/* - * Spawn interface - */ - -/* Flags for the spawn operations. */ -#define GPGME_SPAWN_DETACHED 1 -#define GPGME_SPAWN_ALLOW_SET_FG 2 -#define GPGME_SPAWN_SHOW_WINDOW 4 - - -/* Run the command FILE with the arguments in ARGV. Connect stdin to - * DATAIN, stdout to DATAOUT, and STDERR to DATAERR. If one the data - * streams is NULL, connect to /dev/null instead. */ -gpgme_error_t gpgme_op_spawn_start (gpgme_ctx_t ctx, - const char *file, const char *argv[], - gpgme_data_t datain, - gpgme_data_t dataout, gpgme_data_t dataerr, - unsigned int flags); -gpgme_error_t gpgme_op_spawn (gpgme_ctx_t ctx, - const char *file, const char *argv[], - gpgme_data_t datain, - gpgme_data_t dataout, gpgme_data_t dataerr, - unsigned int flags); - - -/* - * Low-level Assuan protocol access. - */ - -typedef gpgme_error_t (*gpgme_assuan_data_cb_t) - (void *opaque, const void *data, size_t datalen); - -typedef gpgme_error_t (*gpgme_assuan_inquire_cb_t) - (void *opaque, const char *name, const char *args, - gpgme_data_t *r_data); - -typedef gpgme_error_t (*gpgme_assuan_status_cb_t) - (void *opaque, const char *status, const char *args); - -/* Send the Assuan COMMAND and return results via the callbacks. - * Asynchronous variant. */ -gpgme_error_t gpgme_op_assuan_transact_start (gpgme_ctx_t ctx, - const char *command, - gpgme_assuan_data_cb_t data_cb, - void *data_cb_value, - gpgme_assuan_inquire_cb_t inq_cb, - void *inq_cb_value, - gpgme_assuan_status_cb_t stat_cb, - void *stat_cb_value); - -/* Send the Assuan COMMAND and return results via the callbacks. - * Synchronous variant. */ -gpgme_error_t gpgme_op_assuan_transact_ext (gpgme_ctx_t ctx, - const char *command, - gpgme_assuan_data_cb_t data_cb, - void *data_cb_value, - gpgme_assuan_inquire_cb_t inq_cb, - void *inq_cb_value, - gpgme_assuan_status_cb_t stat_cb, - void *stat_cb_value, - gpgme_error_t *op_err); - - -/* - * Crypto container support. - */ - -/* An object to return results from a VFS mount operation. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -struct _gpgme_op_vfs_mount_result -{ - char *mount_dir; -}; -typedef struct _gpgme_op_vfs_mount_result *gpgme_vfs_mount_result_t; - -gpgme_vfs_mount_result_t gpgme_op_vfs_mount_result (gpgme_ctx_t ctx); - -/* The container is automatically unmounted when the context is reset - * or destroyed. Transmission errors are returned directly, - * operational errors are returned in OP_ERR. */ -gpgme_error_t gpgme_op_vfs_mount (gpgme_ctx_t ctx, const char *container_file, - const char *mount_dir, unsigned int flags, - gpgme_error_t *op_err); - -gpgme_error_t gpgme_op_vfs_create (gpgme_ctx_t ctx, gpgme_key_t recp[], - const char *container_file, - unsigned int flags, gpgme_error_t *op_err); - - -/* - * Interface to gpgconf(1). - */ - -/* The expert level at which a configuration option or group of - * options should be displayed. See the gpgconf(1) documentation for - * more details. */ -typedef enum - { - GPGME_CONF_BASIC = 0, - GPGME_CONF_ADVANCED = 1, - GPGME_CONF_EXPERT = 2, - GPGME_CONF_INVISIBLE = 3, - GPGME_CONF_INTERNAL = 4 - } -gpgme_conf_level_t; - - -/* The data type of a configuration option argument. See the gpgconf(1) - * documentation for more details. */ -typedef enum - { - /* Basic types. */ - GPGME_CONF_NONE = 0, - GPGME_CONF_STRING = 1, - GPGME_CONF_INT32 = 2, - GPGME_CONF_UINT32 = 3, - - /* Complex types. */ - GPGME_CONF_FILENAME = 32, - GPGME_CONF_LDAP_SERVER = 33, - GPGME_CONF_KEY_FPR = 34, - GPGME_CONF_PUB_KEY = 35, - GPGME_CONF_SEC_KEY = 36, - GPGME_CONF_ALIAS_LIST = 37 - } -gpgme_conf_type_t; - -/* For now, compatibility. */ -#define GPGME_CONF_PATHNAME GPGME_CONF_FILENAME - - -/* This represents a single argument for a configuration option. - * Which of the members of value is used depends on the ALT_TYPE. */ -typedef struct gpgme_conf_arg -{ - struct gpgme_conf_arg *next; - /* True if the option appears without an (optional) argument. */ - unsigned int no_arg; - union - { - unsigned int count; - unsigned int uint32; - int int32; - char *string; - } value; -} *gpgme_conf_arg_t; - - -/* The flags of a configuration option. See the gpgconf - * documentation for details. */ -#define GPGME_CONF_GROUP (1 << 0) -#define GPGME_CONF_OPTIONAL (1 << 1) -#define GPGME_CONF_LIST (1 << 2) -#define GPGME_CONF_RUNTIME (1 << 3) -#define GPGME_CONF_DEFAULT (1 << 4) -#define GPGME_CONF_DEFAULT_DESC (1 << 5) -#define GPGME_CONF_NO_ARG_DESC (1 << 6) -#define GPGME_CONF_NO_CHANGE (1 << 7) - - -/* The representation of a single configuration option. See the - * gpg-conf documentation for details. */ -typedef struct gpgme_conf_opt -{ - struct gpgme_conf_opt *next; - - /* The option name. */ - char *name; - - /* The flags for this option. */ - unsigned int flags; - - /* The level of this option. */ - gpgme_conf_level_t level; - - /* The localized description of this option. */ - char *description; - - /* The type and alternate type of this option. */ - gpgme_conf_type_t type; - gpgme_conf_type_t alt_type; - - /* The localized (short) name of the argument, if any. */ - char *argname; - - /* The default value. */ - gpgme_conf_arg_t default_value; - char *default_description; - - /* The default value if the option is not set. */ - gpgme_conf_arg_t no_arg_value; - char *no_arg_description; - - /* The current value if the option is set. */ - gpgme_conf_arg_t value; - - /* The new value, if any. NULL means reset to default. */ - int change_value; - gpgme_conf_arg_t new_value; - - /* Free for application use. */ - void *user_data; -} *gpgme_conf_opt_t; - - -/* The representation of a component that can be configured. See the - * gpg-conf documentation for details. */ -typedef struct gpgme_conf_comp -{ - struct gpgme_conf_comp *next; - - /* Internal to GPGME, do not use! */ - gpgme_conf_opt_t *_last_opt_p; - - /* The component name. */ - char *name; - - /* A human-readable description for the component. */ - char *description; - - /* The program name (an absolute path to the program). */ - char *program_name; - - /* A linked list of options for this component. */ - struct gpgme_conf_opt *options; -} *gpgme_conf_comp_t; - - -/* Allocate a new gpgme_conf_arg_t. If VALUE is NULL, a "no arg - * default" is prepared. If type is a string type, VALUE should point - * to the string. Else, it should point to an unsigned or signed - * integer respectively. */ -gpgme_error_t gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p, - gpgme_conf_type_t type, const void *value); - -/* This also releases all chained argument structures! */ -void gpgme_conf_arg_release (gpgme_conf_arg_t arg, gpgme_conf_type_t type); - -/* Register a change for the value of OPT to ARG. If RESET is 1 (do - * not use any values but 0 or 1), ARG is ignored and the option is - * not changed (reverting a previous change). Otherwise, if ARG is - * NULL, the option is cleared or reset to its default. The change - * is done with gpgconf's --runtime option to immediately take effect. */ -gpgme_error_t gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset, - gpgme_conf_arg_t arg); - -/* Release a set of configurations. */ -void gpgme_conf_release (gpgme_conf_comp_t conf); - -/* Retrieve the current configurations. */ -gpgme_error_t gpgme_op_conf_load (gpgme_ctx_t ctx, gpgme_conf_comp_t *conf_p); - -/* Save the configuration of component comp. This function does not - follow chained components! */ -gpgme_error_t gpgme_op_conf_save (gpgme_ctx_t ctx, gpgme_conf_comp_t comp); - -/* Retrieve the configured directory. */ -gpgme_error_t gpgme_op_conf_dir(gpgme_ctx_t ctx, const char *what, - char **result); - - -/* Information about software versions. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -typedef struct _gpgme_op_query_swdb_result -{ - /* RFU */ - struct _gpgme_op_query_swdb_result *next; - - /* The name of the package (e.g. "gpgme", "gnupg") */ - char *name; - - /* The version number of the installed version. */ - char *iversion; - - /* The time the online info was created. */ - unsigned long created; - - /* The time the online info was retrieved. */ - unsigned long retrieved; - - /* This bit is set if an error occured or some of the information - * in this structure may not be set. */ - unsigned int warning : 1; - - /* An update is available. */ - unsigned int update : 1; - - /* The update is important. */ - unsigned int urgent : 1; - - /* No information at all available. */ - unsigned int noinfo : 1; - - /* The package name is not known. */ - unsigned int unknown : 1; - - /* The information here is too old. */ - unsigned int tooold : 1; - - /* Other error. */ - unsigned int error : 1; - - unsigned int _reserved : 25; - - /* The version number of the latest released version. */ - char *version; - - /* The release date of that version. */ - unsigned long reldate; - -} *gpgme_query_swdb_result_t; - - -/* Run the gpgconf --query-swdb command. */ -gpgme_error_t gpgme_op_query_swdb (gpgme_ctx_t ctx, - const char *name, const char *iversion, - unsigned int reserved); - -/* Return the result from the last query_swdb operation. */ -gpgme_query_swdb_result_t gpgme_op_query_swdb_result (gpgme_ctx_t ctx); - - - - -/* - * Various functions. - */ - -/* Set special global flags; consult the manual before use. */ -int gpgme_set_global_flag (const char *name, const char *value); - -/* Check that the library fulfills the version requirement. Note: - * This is here only for the case where a user takes a pointer from - * the old version of this function. The new version and macro for - * run-time checks are below. */ -const char *gpgme_check_version (const char *req_version); - -/* Do not call this directly; use the macro below. */ -const char *gpgme_check_version_internal (const char *req_version, - size_t offset_sig_validity); - -/* Check that the library fulfills the version requirement and check - * for struct layout mismatch involving bitfields. */ -#define gpgme_check_version(req_version) \ - gpgme_check_version_internal (req_version, \ - offsetof (struct _gpgme_signature, validity)) - -/* Return the default values for various directories. */ -const char *gpgme_get_dirinfo (const char *what); - -/* Get the information about the configured and installed engines. A - * pointer to the first engine in the statically allocated linked list - * is returned in *INFO. If an error occurs, it is returned. The - * returned data is valid until the next gpgme_set_engine_info. */ -gpgme_error_t gpgme_get_engine_info (gpgme_engine_info_t *engine_info); - -/* Set the default engine info for the protocol PROTO to the file name - * FILE_NAME and the home directory HOME_DIR. */ -gpgme_error_t gpgme_set_engine_info (gpgme_protocol_t proto, - const char *file_name, - const char *home_dir); - -/* Verify that the engine implementing PROTO is installed and - * available. */ -gpgme_error_t gpgme_engine_check_version (gpgme_protocol_t proto); - - -/* Reference counting for result objects. */ -void gpgme_result_ref (void *result); -void gpgme_result_unref (void *result); - -/* Return a public key algorithm string (e.g. "rsa2048"). Caller must - * free using gpgme_free. */ -char *gpgme_pubkey_algo_string (gpgme_subkey_t subkey); - -/* Return a statically allocated string with the name of the public - * key algorithm ALGO, or NULL if that name is not known. */ -const char *gpgme_pubkey_algo_name (gpgme_pubkey_algo_t algo); - -/* Return a statically allocated string with the name of the hash - * algorithm ALGO, or NULL if that name is not known. */ -const char *gpgme_hash_algo_name (gpgme_hash_algo_t algo); - -/* Return the addr-spec from a user id. Caller must free the result - * with gpgme_free. */ -char *gpgme_addrspec_from_uid (const char *uid); - - - -/* - * Deprecated types, constants and functions. - */ - -/* This is a former experimental only features. The constant is - * provided to not break existing code in the compiler phase. */ -#define GPGME_EXPORT_MODE_NOUID 128 /* Do not use! */ - - -/* The possible stati for gpgme_op_edit. The use of that function and - * these status codes are deprecated in favor of gpgme_op_interact. */ -typedef enum - { - GPGME_STATUS_EOF = 0, - /* mkstatus processing starts here */ - GPGME_STATUS_ENTER = 1, - GPGME_STATUS_LEAVE = 2, - GPGME_STATUS_ABORT = 3, - - GPGME_STATUS_GOODSIG = 4, - GPGME_STATUS_BADSIG = 5, - GPGME_STATUS_ERRSIG = 6, - - GPGME_STATUS_BADARMOR = 7, - - GPGME_STATUS_RSA_OR_IDEA = 8, /* (legacy) */ - GPGME_STATUS_KEYEXPIRED = 9, - GPGME_STATUS_KEYREVOKED = 10, - - GPGME_STATUS_TRUST_UNDEFINED = 11, - GPGME_STATUS_TRUST_NEVER = 12, - GPGME_STATUS_TRUST_MARGINAL = 13, - GPGME_STATUS_TRUST_FULLY = 14, - GPGME_STATUS_TRUST_ULTIMATE = 15, - - GPGME_STATUS_SHM_INFO = 16, /* (legacy) */ - GPGME_STATUS_SHM_GET = 17, /* (legacy) */ - GPGME_STATUS_SHM_GET_BOOL = 18, /* (legacy) */ - GPGME_STATUS_SHM_GET_HIDDEN = 19, /* (legacy) */ - - GPGME_STATUS_NEED_PASSPHRASE = 20, - GPGME_STATUS_VALIDSIG = 21, - GPGME_STATUS_SIG_ID = 22, - GPGME_STATUS_ENC_TO = 23, - GPGME_STATUS_NODATA = 24, - GPGME_STATUS_BAD_PASSPHRASE = 25, - GPGME_STATUS_NO_PUBKEY = 26, - GPGME_STATUS_NO_SECKEY = 27, - GPGME_STATUS_NEED_PASSPHRASE_SYM = 28, - GPGME_STATUS_DECRYPTION_FAILED = 29, - GPGME_STATUS_DECRYPTION_OKAY = 30, - GPGME_STATUS_MISSING_PASSPHRASE = 31, - GPGME_STATUS_GOOD_PASSPHRASE = 32, - GPGME_STATUS_GOODMDC = 33, - GPGME_STATUS_BADMDC = 34, - GPGME_STATUS_ERRMDC = 35, - GPGME_STATUS_IMPORTED = 36, - GPGME_STATUS_IMPORT_OK = 37, - GPGME_STATUS_IMPORT_PROBLEM = 38, - GPGME_STATUS_IMPORT_RES = 39, - GPGME_STATUS_FILE_START = 40, - GPGME_STATUS_FILE_DONE = 41, - GPGME_STATUS_FILE_ERROR = 42, - - GPGME_STATUS_BEGIN_DECRYPTION = 43, - GPGME_STATUS_END_DECRYPTION = 44, - GPGME_STATUS_BEGIN_ENCRYPTION = 45, - GPGME_STATUS_END_ENCRYPTION = 46, - - GPGME_STATUS_DELETE_PROBLEM = 47, - GPGME_STATUS_GET_BOOL = 48, - GPGME_STATUS_GET_LINE = 49, - GPGME_STATUS_GET_HIDDEN = 50, - GPGME_STATUS_GOT_IT = 51, - GPGME_STATUS_PROGRESS = 52, - GPGME_STATUS_SIG_CREATED = 53, - GPGME_STATUS_SESSION_KEY = 54, - GPGME_STATUS_NOTATION_NAME = 55, - GPGME_STATUS_NOTATION_DATA = 56, - GPGME_STATUS_POLICY_URL = 57, - GPGME_STATUS_BEGIN_STREAM = 58, /* (legacy) */ - GPGME_STATUS_END_STREAM = 59, /* (legacy) */ - GPGME_STATUS_KEY_CREATED = 60, - GPGME_STATUS_USERID_HINT = 61, - GPGME_STATUS_UNEXPECTED = 62, - GPGME_STATUS_INV_RECP = 63, - GPGME_STATUS_NO_RECP = 64, - GPGME_STATUS_ALREADY_SIGNED = 65, - GPGME_STATUS_SIGEXPIRED = 66, /* (legacy) */ - GPGME_STATUS_EXPSIG = 67, - GPGME_STATUS_EXPKEYSIG = 68, - GPGME_STATUS_TRUNCATED = 69, - GPGME_STATUS_ERROR = 70, - GPGME_STATUS_NEWSIG = 71, - GPGME_STATUS_REVKEYSIG = 72, - GPGME_STATUS_SIG_SUBPACKET = 73, - GPGME_STATUS_NEED_PASSPHRASE_PIN = 74, - GPGME_STATUS_SC_OP_FAILURE = 75, - GPGME_STATUS_SC_OP_SUCCESS = 76, - GPGME_STATUS_CARDCTRL = 77, - GPGME_STATUS_BACKUP_KEY_CREATED = 78, - GPGME_STATUS_PKA_TRUST_BAD = 79, - GPGME_STATUS_PKA_TRUST_GOOD = 80, - GPGME_STATUS_PLAINTEXT = 81, - GPGME_STATUS_INV_SGNR = 82, - GPGME_STATUS_NO_SGNR = 83, - GPGME_STATUS_SUCCESS = 84, - GPGME_STATUS_DECRYPTION_INFO = 85, - GPGME_STATUS_PLAINTEXT_LENGTH = 86, - GPGME_STATUS_MOUNTPOINT = 87, - GPGME_STATUS_PINENTRY_LAUNCHED = 88, - GPGME_STATUS_ATTRIBUTE = 89, - GPGME_STATUS_BEGIN_SIGNING = 90, - GPGME_STATUS_KEY_NOT_CREATED = 91, - GPGME_STATUS_INQUIRE_MAXLEN = 92, - GPGME_STATUS_FAILURE = 93, - GPGME_STATUS_KEY_CONSIDERED = 94, - GPGME_STATUS_TOFU_USER = 95, - GPGME_STATUS_TOFU_STATS = 96, - GPGME_STATUS_TOFU_STATS_LONG = 97, - GPGME_STATUS_NOTATION_FLAGS = 98, - GPGME_STATUS_DECRYPTION_COMPLIANCE_MODE = 99, - GPGME_STATUS_VERIFICATION_COMPLIANCE_MODE = 100, - GPGME_STATUS_CANCELED_BY_USER = 101 - } -gpgme_status_code_t; - -/* The callback type used by the deprecated functions gpgme_op_edit - * and gpgme_op_card_edit. */ -typedef gpgme_error_t (*gpgme_edit_cb_t) (void *opaque, - gpgme_status_code_t status, - const char *args, int fd); - -gpgme_error_t gpgme_op_edit_start (gpgme_ctx_t ctx, gpgme_key_t key, - gpgme_edit_cb_t fnc, void *fnc_value, - gpgme_data_t out) _GPGME_DEPRECATED(1,7); -gpgme_error_t gpgme_op_edit (gpgme_ctx_t ctx, gpgme_key_t key, - gpgme_edit_cb_t fnc, void *fnc_value, - gpgme_data_t out) _GPGME_DEPRECATED(1,7); -gpgme_error_t gpgme_op_card_edit_start (gpgme_ctx_t ctx, gpgme_key_t key, - gpgme_edit_cb_t fnc, void *fnc_value, - gpgme_data_t out) - _GPGME_DEPRECATED(1,7); -gpgme_error_t gpgme_op_card_edit (gpgme_ctx_t ctx, gpgme_key_t key, - gpgme_edit_cb_t fnc, void *fnc_value, - gpgme_data_t out) - _GPGME_DEPRECATED(1,7); - -/* The possible signature stati. Deprecated, use error value in sig - * status. */ -typedef enum - { - GPGME_SIG_STAT_NONE = 0, - GPGME_SIG_STAT_GOOD = 1, - GPGME_SIG_STAT_BAD = 2, - GPGME_SIG_STAT_NOKEY = 3, - GPGME_SIG_STAT_NOSIG = 4, - GPGME_SIG_STAT_ERROR = 5, - GPGME_SIG_STAT_DIFF = 6, - GPGME_SIG_STAT_GOOD_EXP = 7, - GPGME_SIG_STAT_GOOD_EXPKEY = 8 - } -_gpgme_sig_stat_t; -typedef _gpgme_sig_stat_t gpgme_sig_stat_t _GPGME_DEPRECATED(0,4); - -/* The available key and signature attributes. Deprecated, use the - * individual result structures instead. */ -typedef enum - { - GPGME_ATTR_KEYID = 1, - GPGME_ATTR_FPR = 2, - GPGME_ATTR_ALGO = 3, - GPGME_ATTR_LEN = 4, - GPGME_ATTR_CREATED = 5, - GPGME_ATTR_EXPIRE = 6, - GPGME_ATTR_OTRUST = 7, - GPGME_ATTR_USERID = 8, - GPGME_ATTR_NAME = 9, - GPGME_ATTR_EMAIL = 10, - GPGME_ATTR_COMMENT = 11, - GPGME_ATTR_VALIDITY = 12, - GPGME_ATTR_LEVEL = 13, - GPGME_ATTR_TYPE = 14, - GPGME_ATTR_IS_SECRET = 15, - GPGME_ATTR_KEY_REVOKED = 16, - GPGME_ATTR_KEY_INVALID = 17, - GPGME_ATTR_UID_REVOKED = 18, - GPGME_ATTR_UID_INVALID = 19, - GPGME_ATTR_KEY_CAPS = 20, - GPGME_ATTR_CAN_ENCRYPT = 21, - GPGME_ATTR_CAN_SIGN = 22, - GPGME_ATTR_CAN_CERTIFY = 23, - GPGME_ATTR_KEY_EXPIRED = 24, - GPGME_ATTR_KEY_DISABLED = 25, - GPGME_ATTR_SERIAL = 26, - GPGME_ATTR_ISSUER = 27, - GPGME_ATTR_CHAINID = 28, - GPGME_ATTR_SIG_STATUS = 29, - GPGME_ATTR_ERRTOK = 30, - GPGME_ATTR_SIG_SUMMARY = 31, - GPGME_ATTR_SIG_CLASS = 32 - } -_gpgme_attr_t; -typedef _gpgme_attr_t gpgme_attr_t _GPGME_DEPRECATED(0,4); - -/* Retrieve the signature status of signature IDX in CTX after a - * successful verify operation in R_STAT (if non-null). The creation - * time stamp of the signature is returned in R_CREATED (if non-null). - * The function returns a string containing the fingerprint. - * Deprecated, use verify result directly. */ -const char *gpgme_get_sig_status (gpgme_ctx_t ctx, int idx, - _gpgme_sig_stat_t *r_stat, - time_t *r_created) _GPGME_DEPRECATED(0,4); - -/* Retrieve certain attributes of a signature. IDX is the index - * number of the signature after a successful verify operation. WHAT - * is an attribute where GPGME_ATTR_EXPIRE is probably the most useful - * one. WHATIDX is to be passed as 0 for most attributes . */ -unsigned long gpgme_get_sig_ulong_attr (gpgme_ctx_t c, int idx, - _gpgme_attr_t what, int whatidx) - _GPGME_DEPRECATED(0,4); -const char *gpgme_get_sig_string_attr (gpgme_ctx_t c, int idx, - _gpgme_attr_t what, int whatidx) - _GPGME_DEPRECATED(0,4); - - -/* Get the key used to create signature IDX in CTX and return it in - * R_KEY. */ -gpgme_error_t gpgme_get_sig_key (gpgme_ctx_t ctx, int idx, gpgme_key_t *r_key) - _GPGME_DEPRECATED(0,4); - -/* Create a new data buffer which retrieves the data from the callback - * function READ_CB. Deprecated, please use gpgme_data_new_from_cbs - * instead. */ -gpgme_error_t gpgme_data_new_with_read_cb (gpgme_data_t *r_dh, - int (*read_cb) (void*,char *, - size_t,size_t*), - void *read_cb_value) - _GPGME_DEPRECATED(0,4); - -/* Return the value of the attribute WHAT of KEY, which has to be - * representable by a string. IDX specifies the sub key or user ID - * for attributes related to sub keys or user IDs. Deprecated, use - * key structure directly instead. */ -const char *gpgme_key_get_string_attr (gpgme_key_t key, _gpgme_attr_t what, - const void *reserved, int idx) - _GPGME_DEPRECATED(0,4); - -/* Return the value of the attribute WHAT of KEY, which has to be - * representable by an unsigned integer. IDX specifies the sub key or - * user ID for attributes related to sub keys or user IDs. - * Deprecated, use key structure directly instead. */ -unsigned long gpgme_key_get_ulong_attr (gpgme_key_t key, _gpgme_attr_t what, - const void *reserved, int idx) - _GPGME_DEPRECATED(0,4); - -/* Return the value of the attribute WHAT of a signature on user ID - * UID_IDX in KEY, which has to be representable by a string. IDX - * specifies the signature. Deprecated, use key structure directly - * instead. */ -const char *gpgme_key_sig_get_string_attr (gpgme_key_t key, int uid_idx, - _gpgme_attr_t what, - const void *reserved, int idx) - _GPGME_DEPRECATED(0,4); - -/* Return the value of the attribute WHAT of a signature on user ID - * UID_IDX in KEY, which has to be representable by an unsigned - * integer string. IDX specifies the signature. Deprecated, use key - * structure directly instead. */ -unsigned long gpgme_key_sig_get_ulong_attr (gpgme_key_t key, int uid_idx, - _gpgme_attr_t what, - const void *reserved, int idx) - _GPGME_DEPRECATED(0,4); - - -gpgme_error_t gpgme_op_import_ext (gpgme_ctx_t ctx, gpgme_data_t keydata, - int *nr) _GPGME_DEPRECATED(0,4); - -/* DO NOT USE. */ -void gpgme_trust_item_release (gpgme_trust_item_t item) _GPGME_DEPRECATED(0,4); - -/* DO NOT USE. */ -const char *gpgme_trust_item_get_string_attr (gpgme_trust_item_t item, - _gpgme_attr_t what, - const void *reserved, int idx) - _GPGME_DEPRECATED(0,4); - -/* DO NOT USE. */ -int gpgme_trust_item_get_int_attr (gpgme_trust_item_t item, _gpgme_attr_t what, - const void *reserved, int idx) - _GPGME_DEPRECATED(0,4); - -/* Compat. - * This structure shall be considered read-only and an application - * must not allocate such a structure on its own. */ -struct _gpgme_op_assuan_result -{ - /* Deprecated. Use the second value in a DONE event or the - synchronous variant gpgme_op_assuan_transact_ext. */ - gpgme_error_t err _GPGME_DEPRECATED_OUTSIDE_GPGME(1,2); -}; -typedef struct _gpgme_op_assuan_result *gpgme_assuan_result_t; - - -/* Return the result of the last Assuan command. */ -gpgme_assuan_result_t gpgme_op_assuan_result (gpgme_ctx_t ctx) - _GPGME_DEPRECATED(1,2); - -gpgme_error_t -gpgme_op_assuan_transact (gpgme_ctx_t ctx, - const char *command, - gpgme_assuan_data_cb_t data_cb, - void *data_cb_value, - gpgme_assuan_inquire_cb_t inq_cb, - void *inq_cb_value, - gpgme_assuan_status_cb_t status_cb, - void *status_cb_value) _GPGME_DEPRECATED(1,2); - - - -typedef gpgme_ctx_t GpgmeCtx _GPGME_DEPRECATED(0,4); -typedef gpgme_data_t GpgmeData _GPGME_DEPRECATED(0,4); -typedef gpgme_error_t GpgmeError _GPGME_DEPRECATED(0,4); -typedef gpgme_data_encoding_t GpgmeDataEncoding _GPGME_DEPRECATED(0,4); -typedef gpgme_pubkey_algo_t GpgmePubKeyAlgo _GPGME_DEPRECATED(0,4); -typedef gpgme_hash_algo_t GpgmeHashAlgo _GPGME_DEPRECATED(0,4); -typedef gpgme_sig_stat_t GpgmeSigStat _GPGME_DEPRECATED(0,4); -typedef gpgme_sig_mode_t GpgmeSigMode _GPGME_DEPRECATED(0,4); -typedef gpgme_attr_t GpgmeAttr _GPGME_DEPRECATED(0,4); -typedef gpgme_validity_t GpgmeValidity _GPGME_DEPRECATED(0,4); -typedef gpgme_protocol_t GpgmeProtocol _GPGME_DEPRECATED(0,4); -typedef gpgme_engine_info_t GpgmeEngineInfo _GPGME_DEPRECATED(0,4); -typedef gpgme_subkey_t GpgmeSubkey _GPGME_DEPRECATED(0,4); -typedef gpgme_key_sig_t GpgmeKeySig _GPGME_DEPRECATED(0,4); -typedef gpgme_user_id_t GpgmeUserID _GPGME_DEPRECATED(0,4); -typedef gpgme_key_t GpgmeKey _GPGME_DEPRECATED(0,4); -typedef gpgme_passphrase_cb_t GpgmePassphraseCb _GPGME_DEPRECATED(0,4); -typedef gpgme_progress_cb_t GpgmeProgressCb _GPGME_DEPRECATED(0,4); -typedef gpgme_io_cb_t GpgmeIOCb _GPGME_DEPRECATED(0,4); -typedef gpgme_register_io_cb_t GpgmeRegisterIOCb _GPGME_DEPRECATED(0,4); -typedef gpgme_remove_io_cb_t GpgmeRemoveIOCb _GPGME_DEPRECATED(0,4); -typedef gpgme_event_io_t GpgmeEventIO _GPGME_DEPRECATED(0,4); -typedef gpgme_event_io_cb_t GpgmeEventIOCb _GPGME_DEPRECATED(0,4); -#define GpgmeIOCbs gpgme_io_cbs -typedef gpgme_data_read_cb_t GpgmeDataReadCb _GPGME_DEPRECATED(0,4); -typedef gpgme_data_write_cb_t GpgmeDataWriteCb _GPGME_DEPRECATED(0,4); -typedef gpgme_data_seek_cb_t GpgmeDataSeekCb _GPGME_DEPRECATED(0,4); -typedef gpgme_data_release_cb_t GpgmeDataReleaseCb _GPGME_DEPRECATED(0,4); -#define GpgmeDataCbs gpgme_data_cbs -typedef gpgme_encrypt_result_t GpgmeEncryptResult _GPGME_DEPRECATED(0,4); -typedef gpgme_sig_notation_t GpgmeSigNotation _GPGME_DEPRECATED(0,4); -typedef gpgme_signature_t GpgmeSignature _GPGME_DEPRECATED(0,4); -typedef gpgme_verify_result_t GpgmeVerifyResult _GPGME_DEPRECATED(0,4); -typedef gpgme_import_status_t GpgmeImportStatus _GPGME_DEPRECATED(0,4); -typedef gpgme_import_result_t GpgmeImportResult _GPGME_DEPRECATED(0,4); -typedef gpgme_genkey_result_t GpgmeGenKeyResult _GPGME_DEPRECATED(0,4); -typedef gpgme_trust_item_t GpgmeTrustItem _GPGME_DEPRECATED(0,4); -typedef gpgme_status_code_t GpgmeStatusCode _GPGME_DEPRECATED(0,4); - -#ifdef __cplusplus -} -#endif -#endif /* GPGME_H */ -/* -Local Variables: -buffer-read-only: t -End: -*/ |