mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge branch 'master' into wallet-app
This commit is contained in:
commit
fe5ccfac26
12
.gitignore
vendored
12
.gitignore
vendored
@ -34,3 +34,15 @@ AppBundle.xcworkspace/*
|
||||
tools/buck
|
||||
*.xcodeproj
|
||||
!*_Xcode.xcodeproj
|
||||
submodules/MtProtoKit/TON/macOS/lib/libtonlibjson.0.5.dylib
|
||||
submodules/MtProtoKit/TON/macOS/lib/libtonlibjson.dylib
|
||||
submodules/MtProtoKit/TON/macOS/lib/cmake/Tonlib/TonlibConfig.cmake
|
||||
submodules/MtProtoKit/TON/macOS/lib/cmake/Tonlib/TonlibConfigVersion.cmake
|
||||
submodules/MtProtoKit/TON/macOS/lib/cmake/Tonlib/TonlibTargets-release.cmake
|
||||
submodules/MtProtoKit/TON/macOS/lib/cmake/Tonlib/TonlibTargets.cmake
|
||||
submodules/MtProtoKit/TON/macOS/lib/fift/Asm.fif
|
||||
submodules/MtProtoKit/TON/macOS/lib/fift/Fift.fif
|
||||
submodules/MtProtoKit/TON/macOS/lib/fift/Lisp.fif
|
||||
submodules/MtProtoKit/TON/macOS/lib/fift/Lists.fif
|
||||
submodules/MtProtoKit/TON/macOS/lib/fift/Stack.fif
|
||||
submodules/MtProtoKit/TON/macOS/lib/fift/TonUtil.fif
|
||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -0,0 +1,3 @@
|
||||
[submodule "submodules/rlottie/rlottie"]
|
||||
path = submodules/rlottie/rlottie
|
||||
url=https://github.com/peter-iakovlev/rlottie.git
|
2
BUCK
2
BUCK
@ -509,4 +509,4 @@ xcode_workspace_config(
|
||||
name = "workspace",
|
||||
workspace_name = "Telegram_Buck",
|
||||
src_target = ":Telegram",
|
||||
)
|
||||
)
|
||||
|
@ -11,6 +11,7 @@ def apple_lib(
|
||||
exported_deps = [],
|
||||
additional_linker_flags = None,
|
||||
frameworks = [],
|
||||
weak_frameworks = [],
|
||||
swift_version = None,
|
||||
modular = True,
|
||||
compiler_flags = None,
|
||||
@ -23,6 +24,8 @@ def apple_lib(
|
||||
swift_version = swift_version or native.read_config('swift', 'version')
|
||||
swift_compiler_flags = swift_compiler_flags or []
|
||||
|
||||
resolved_frameworks = frameworks
|
||||
|
||||
if native.read_config("xcode", "beta") == "True":
|
||||
warning_as_error = False
|
||||
|
||||
@ -59,8 +62,12 @@ def apple_lib(
|
||||
|
||||
if native.read_config("custom", "mode") == "project":
|
||||
resolved_linker_flags = linker_flags + additional_linker_flags + ["-Wl,-install_name,@rpath/lib%s.dylib" % (name)]
|
||||
resolved_frameworks = resolved_frameworks + ["$SDKROOT/System/Library/Frameworks/%s.framework" % x for x in weak_frameworks]
|
||||
else:
|
||||
resolved_linker_flags = linker_flags + additional_linker_flags + ["-Wl,-install_name,@rpath/%s.framework/%s" % (name, name)]
|
||||
for framework in weak_frameworks:
|
||||
resolved_linker_flags = resolved_linker_flags + ["-Wl,-weak_framework,%s" % framework]
|
||||
|
||||
native.apple_library(
|
||||
name = name + "",
|
||||
srcs = srcs,
|
||||
@ -72,7 +79,7 @@ def apple_lib(
|
||||
deps = deps,
|
||||
exported_deps = exported_deps,
|
||||
extra_xcode_files = extra_xcode_files,
|
||||
frameworks = frameworks,
|
||||
frameworks = resolved_frameworks,
|
||||
visibility = visibility,
|
||||
swift_version = swift_version,
|
||||
configs = dynamic_library_configs(),
|
||||
@ -95,6 +102,13 @@ def apple_lib(
|
||||
linker_flags = []
|
||||
|
||||
resolved_exported_linker_flags = linker_flags + additional_linker_flags
|
||||
|
||||
if native.read_config("custom", "mode") == "project":
|
||||
resolved_frameworks = resolved_frameworks + ["$SDKROOT/System/Library/Frameworks/%s.framework" % x for x in weak_frameworks]
|
||||
else:
|
||||
for framework in weak_frameworks:
|
||||
resolved_exported_linker_flags = resolved_exported_linker_flags + ["-Wl,-weak_framework,%s" % framework]
|
||||
|
||||
native.apple_library(
|
||||
name = name,
|
||||
srcs = srcs,
|
||||
@ -104,7 +118,7 @@ def apple_lib(
|
||||
exported_deps = exported_deps,
|
||||
exported_linker_flags = resolved_exported_linker_flags,
|
||||
extra_xcode_files = extra_xcode_files,
|
||||
frameworks = frameworks,
|
||||
frameworks = resolved_frameworks,
|
||||
visibility = visibility,
|
||||
swift_version = swift_version,
|
||||
configs = library_configs(),
|
||||
@ -126,6 +140,7 @@ def static_library(
|
||||
deps = [],
|
||||
additional_linker_flags = None,
|
||||
frameworks = [],
|
||||
weak_frameworks = [],
|
||||
info_plist = None,
|
||||
info_plist_substitutions = {},
|
||||
modular = True,
|
||||
@ -148,6 +163,7 @@ def static_library(
|
||||
deps = deps,
|
||||
additional_linker_flags = additional_linker_flags,
|
||||
frameworks = frameworks,
|
||||
weak_frameworks = weak_frameworks,
|
||||
warning_as_error = warning_as_error,
|
||||
suppress_warnings = suppress_warnings
|
||||
)
|
||||
@ -164,6 +180,7 @@ def framework(
|
||||
exported_deps = [],
|
||||
additional_linker_flags = None,
|
||||
frameworks = [],
|
||||
weak_frameworks = [],
|
||||
info_plist = None,
|
||||
info_plist_substitutions = {},
|
||||
modular = True,
|
||||
@ -187,6 +204,7 @@ def framework(
|
||||
exported_deps = exported_deps,
|
||||
additional_linker_flags = additional_linker_flags,
|
||||
frameworks = frameworks,
|
||||
weak_frameworks = weak_frameworks,
|
||||
warning_as_error = warning_as_error,
|
||||
suppress_warnings = suppress_warnings,
|
||||
framework = True
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
load("//Config:utils.bzl", "config_with_updated_linker_flags", "configs_with_config")
|
||||
load("//Config:app_configuration.bzl", "appConfig")
|
||||
|
||||
@ -403,6 +404,7 @@ def widget_extension_info_plist_substitutions():
|
||||
"APP_SPECIFIC_URL_SCHEME": appConfig()["appSpecificUrlScheme"],
|
||||
"BUILD_NUMBER": get_build_number(),
|
||||
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
|
||||
"MinimumOSVersion": "9.0",
|
||||
}
|
||||
return substitutions
|
||||
|
||||
@ -416,6 +418,7 @@ def notification_content_extension_info_plist_substitutions():
|
||||
"CURRENT_PROJECT_VERSION": "1",
|
||||
"BUILD_NUMBER": get_build_number(),
|
||||
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
|
||||
"MinimumOSVersion": "10.0",
|
||||
}
|
||||
return substitutions
|
||||
|
||||
@ -429,6 +432,7 @@ def notification_service_extension_info_plist_substitutions():
|
||||
"CURRENT_PROJECT_VERSION": "1",
|
||||
"BUILD_NUMBER": get_build_number(),
|
||||
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
|
||||
"MinimumOSVersion": "10.0",
|
||||
}
|
||||
return substitutions
|
||||
|
||||
@ -444,6 +448,7 @@ def intents_extension_info_plist_substitutions():
|
||||
"BUILD_NUMBER": get_build_number(),
|
||||
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
|
||||
"PRODUCT_MODULE_NAME": "SiriIntents",
|
||||
"MinimumOSVersion": "10.0",
|
||||
}
|
||||
return substitutions
|
||||
|
||||
|
78
Makefile
78
Makefile
@ -140,6 +140,32 @@ build_wallet_debug_arm64: check_env
|
||||
//submodules/Display:Display#shared,iphoneos-arm64 \
|
||||
${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS} ${BUCK_THREADS_OPTIONS} ${BUCK_CACHE_OPTIONS}
|
||||
|
||||
build_debug_armv7: check_env
|
||||
$(BUCK) build \
|
||||
//:AppPackage#iphoneos-armv7 \
|
||||
//:Telegram#dwarf-and-dsym,iphoneos-armv7 \
|
||||
//submodules/MtProtoKit:MtProtoKit#dwarf-and-dsym,shared,iphoneos-armv7 \
|
||||
//submodules/MtProtoKit:MtProtoKit#shared,iphoneos-armv7 \
|
||||
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#dwarf-and-dsym,shared,iphoneos-armv7 \
|
||||
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared,iphoneos-armv7 \
|
||||
//submodules/Postbox:Postbox#dwarf-and-dsym,shared,iphoneos-armv7 \
|
||||
//submodules/Postbox:Postbox#shared,iphoneos-armv7 \
|
||||
//submodules/TelegramCore:TelegramCore#dwarf-and-dsym,shared,iphoneos-armv7 \
|
||||
//submodules/TelegramCore:TelegramCore#shared,iphoneos-armv7 \
|
||||
//submodules/AsyncDisplayKit:AsyncDisplayKit#dwarf-and-dsym,shared,iphoneos-armv7 \
|
||||
//submodules/AsyncDisplayKit:AsyncDisplayKit#shared,iphoneos-armv7 \
|
||||
//submodules/Display:Display#dwarf-and-dsym,shared,iphoneos-armv7 \
|
||||
//submodules/Display:Display#shared,iphoneos-armv7 \
|
||||
//submodules/TelegramUI:TelegramUI#dwarf-and-dsym,shared,iphoneos-armv7 \
|
||||
//submodules/TelegramUI:TelegramUI#shared,iphoneos-armv7 \
|
||||
//:WatchAppExtension#dwarf-and-dsym,watchos-armv7_32,watchos-armv7k \
|
||||
//:ShareExtension#dwarf-and-dsym,iphoneos-armv7 \
|
||||
//:WidgetExtension#dwarf-and-dsym,iphoneos-armv7 \
|
||||
//:NotificationContentExtension#dwarf-and-dsym,iphoneos-armv7 \
|
||||
//:NotificationServiceExtension#dwarf-and-dsym,iphoneos-armv7 \
|
||||
//:IntentsExtension#dwarf-and-dsym,iphoneos-armv7 \
|
||||
${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS} ${BUCK_THREADS_OPTIONS} ${BUCK_CACHE_OPTIONS}
|
||||
|
||||
build: check_env
|
||||
$(BUCK) build \
|
||||
//:AppPackage#iphoneos-arm64,iphoneos-armv7 \
|
||||
@ -186,6 +212,26 @@ package_arm64:
|
||||
PACKAGE_BUNDLE_ID="${BUNDLE_ID}" \
|
||||
sh package_app.sh iphoneos-arm64 $(BUCK) $(BUCK_OPTIONS) ${BUCK_RELEASE_OPTIONS}
|
||||
|
||||
package_armv7:
|
||||
PACKAGE_DEVELOPMENT_TEAM="${DEVELOPMENT_TEAM}" \
|
||||
PACKAGE_CODE_SIGN_IDENTITY="${DISTRIBUTION_CODE_SIGN_IDENTITY}" \
|
||||
PACKAGE_PROVISIONING_PROFILE_APP="${DISTRIBUTION_PROVISIONING_PROFILE_APP}" \
|
||||
PACKAGE_ENTITLEMENTS_APP="${ENTITLEMENTS_APP}" \
|
||||
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Share="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_SHARE}" \
|
||||
PACKAGE_ENTITLEMENTS_EXTENSION_Share="${ENTITLEMENTS_EXTENSION_SHARE}" \
|
||||
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Widget="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_WIDGET}" \
|
||||
PACKAGE_ENTITLEMENTS_EXTENSION_Widget="${ENTITLEMENTS_EXTENSION_WIDGET}" \
|
||||
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationService="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE}" \
|
||||
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationService="${ENTITLEMENTS_EXTENSION_NOTIFICATIONSERVICE}" \
|
||||
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationContent="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT}" \
|
||||
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationContent="${ENTITLEMENTS_EXTENSION_NOTIFICATIONCONTENT}" \
|
||||
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Intents="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_INTENTS}" \
|
||||
PACKAGE_ENTITLEMENTS_EXTENSION_Intents="${ENTITLEMENTS_EXTENSION_INTENTS}" \
|
||||
PACKAGE_PROVISIONING_PROFILE_WATCH_APP="${DISTRIBUTION_PROVISIONING_PROFILE_WATCH_APP}" \
|
||||
PACKAGE_PROVISIONING_PROFILE_WATCH_EXTENSION="${DISTRIBUTION_PROVISIONING_PROFILE_WATCH_EXTENSION}" \
|
||||
PACKAGE_BUNDLE_ID="${BUNDLE_ID}" \
|
||||
sh package_app.sh iphoneos-armv7 $(BUCK) $(BUCK_OPTIONS) ${BUCK_RELEASE_OPTIONS}
|
||||
|
||||
package_debug_arm64:
|
||||
PACKAGE_DEVELOPMENT_TEAM="${DEVELOPMENT_TEAM}" \
|
||||
PACKAGE_CODE_SIGN_IDENTITY="${DEVELOPMENT_CODE_SIGN_IDENTITY}" \
|
||||
@ -202,12 +248,34 @@ package_debug_arm64:
|
||||
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Intents="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_INTENTS}" \
|
||||
PACKAGE_ENTITLEMENTS_EXTENSION_Intents="${ENTITLEMENTS_EXTENSION_INTENTS}" \
|
||||
PACKAGE_PROVISIONING_PROFILE_WATCH_APP="${DEVELOPMENT_PROVISIONING_PROFILE_WATCH_APP}" \
|
||||
PACKAGE_PROVISIONING_PROFILE_WATCH_EXTENSION="${DISTRIBUTION_PROVISIONING_PROFILE_WATCH_EXTENSION}" \
|
||||
PACKAGE_PROVISIONING_PROFILE_WATCH_EXTENSION="${DEVELOPMENT_PROVISIONING_PROFILE_WATCH_EXTENSION}" \
|
||||
PACKAGE_BUNDLE_ID="${BUNDLE_ID}" \
|
||||
ENABLE_GET_TASK_ALLOW=1 \
|
||||
ENABLE_GET_TASK_ALLOW=0 \
|
||||
CODESIGNING_PROFILES_VARIANT="development" \
|
||||
sh package_app.sh iphoneos-arm64 $(BUCK) $(BUCK_OPTIONS) ${BUCK_RELEASE_OPTIONS}
|
||||
|
||||
package_debug_armv7:
|
||||
PACKAGE_DEVELOPMENT_TEAM="${DEVELOPMENT_TEAM}" \
|
||||
PACKAGE_CODE_SIGN_IDENTITY="${DEVELOPMENT_CODE_SIGN_IDENTITY}" \
|
||||
PACKAGE_PROVISIONING_PROFILE_APP="${DEVELOPMENT_PROVISIONING_PROFILE_APP}" \
|
||||
PACKAGE_ENTITLEMENTS_APP="${ENTITLEMENTS_APP}" \
|
||||
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Share="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_SHARE}" \
|
||||
PACKAGE_ENTITLEMENTS_EXTENSION_Share="${ENTITLEMENTS_EXTENSION_SHARE}" \
|
||||
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Widget="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_WIDGET}" \
|
||||
PACKAGE_ENTITLEMENTS_EXTENSION_Widget="${ENTITLEMENTS_EXTENSION_WIDGET}" \
|
||||
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationService="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE}" \
|
||||
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationService="${ENTITLEMENTS_EXTENSION_NOTIFICATIONSERVICE}" \
|
||||
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationContent="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT}" \
|
||||
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationContent="${ENTITLEMENTS_EXTENSION_NOTIFICATIONCONTENT}" \
|
||||
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Intents="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_INTENTS}" \
|
||||
PACKAGE_ENTITLEMENTS_EXTENSION_Intents="${ENTITLEMENTS_EXTENSION_INTENTS}" \
|
||||
PACKAGE_PROVISIONING_PROFILE_WATCH_APP="${DEVELOPMENT_PROVISIONING_PROFILE_WATCH_APP}" \
|
||||
PACKAGE_PROVISIONING_PROFILE_WATCH_EXTENSION="${DEVELOPMENT_PROVISIONING_PROFILE_WATCH_EXTENSION}" \
|
||||
PACKAGE_BUNDLE_ID="${BUNDLE_ID}" \
|
||||
ENABLE_GET_TASK_ALLOW=0 \
|
||||
CODESIGNING_PROFILES_VARIANT="development" \
|
||||
sh package_app.sh iphoneos-armv7 $(BUCK) $(BUCK_OPTIONS) ${BUCK_RELEASE_OPTIONS}
|
||||
|
||||
package:
|
||||
PACKAGE_DEVELOPMENT_TEAM="${DEVELOPMENT_TEAM}" \
|
||||
PACKAGE_CODE_SIGN_IDENTITY="${DISTRIBUTION_CODE_SIGN_IDENTITY}" \
|
||||
@ -236,6 +304,8 @@ app_debug_arm64: build_debug_arm64 package_debug_arm64
|
||||
|
||||
wallet_debug_arm64: build_wallet_debug_arm64
|
||||
|
||||
app_debug_armv7: build_debug_armv7 package_debug_armv7
|
||||
|
||||
build_buckdebug: check_env
|
||||
BUCK_DEBUG_MODE=1 $(BUCK) build \
|
||||
//:AppPackage#iphoneos-arm64 \
|
||||
@ -326,6 +396,10 @@ wallet_project: check_env kill_xcode
|
||||
$(BUCK) project //Wallet:workspace --config custom.mode=project ${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS}
|
||||
open Wallet/WalletWorkspace.xcworkspace
|
||||
|
||||
project_opt: check_env kill_xcode
|
||||
$(BUCK) project //:workspace --config custom.mode=project ${BUCK_OPTIONS} ${BUCK_RELEASE_OPTIONS}
|
||||
open Telegram_Buck.xcworkspace
|
||||
|
||||
project_buckdebug: check_env kill_xcode
|
||||
BUCK_DEBUG_MODE=1 $(BUCK) project //:workspace --config custom.mode=project ${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS}
|
||||
open Telegram_Buck.xcworkspace
|
||||
|
@ -4786,8 +4786,7 @@ Any member of this group will be able to see messages in the channel.";
|
||||
"Wallet.Info.TransactionTo" = "to";
|
||||
"Wallet.Info.TransactionFrom" = "from";
|
||||
"Wallet.Info.Updating" = "updating";
|
||||
"Wallet.Info.TransactionStorageFee" = "%@ storage fee";
|
||||
"Wallet.Info.TransactionOtherFee" = "%@ transaction fee";
|
||||
"Wallet.Info.TransactionBlockchainFee" = "%@ blockchain fee";
|
||||
"Wallet.Info.TransactionPendingHeader" = "Pending";
|
||||
"Wallet.Qr.ScanCode" = "Scan QR Code";
|
||||
"Wallet.Qr.Title" = "QR Code";
|
||||
@ -4867,6 +4866,9 @@ Any member of this group will be able to see messages in the channel.";
|
||||
"Wallet.TransactionInfo.CommentHeader" = "COMMENT";
|
||||
"Wallet.TransactionInfo.StorageFeeHeader" = "STORAGE FEE";
|
||||
"Wallet.TransactionInfo.OtherFeeHeader" = "TRANSACTION FEE";
|
||||
"Wallet.TransactionInfo.StorageFeeInfo" = "Blockchain validators collect a tiny fee for storing information about your decentralized wallet. [More info]()";
|
||||
"Wallet.TransactionInfo.OtherFeeInfo" = "Blockchain validators collect a tiny fee for processing your decentralized transactions. [More info]()";
|
||||
"Wallet.TransactionInfo.FeeInfoURL" = "https://telegram.org/wallet/fee";
|
||||
"Wallet.WordCheck.Title" = "Test Time!";
|
||||
"Wallet.WordCheck.Text" = "Let’s check that you wrote them down correctly. Please enter words\n**%1$@**, **%2$@** and **%3$@** below:";
|
||||
"Wallet.WordCheck.Continue" = "Continue";
|
||||
|
@ -130,6 +130,7 @@ else
|
||||
export DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS="-t DAV"
|
||||
if [ "$1" == "appstore" ]; then
|
||||
FASTLANE_PASSWORD="$FASTLANE_PASSWORD" xcrun altool --upload-app --type ios --file "$RESULT_IPA_NAME" --username "$FASTLANE_ITC_USERNAME" --password "@env:FASTLANE_PASSWORD"
|
||||
FASTLANE_PASSWORD="$FASTLANE_PASSWORD" FASTLANE_ITC_TEAM_NAME="$FASTLANE_ITC_TEAM_NAME" fastlane "$FASTLANE_BUILD_CONFIGURATION" build_number:"$BUILD_NUMBER" commit_hash:"$COMMIT_ID" commit_author:"$COMMIT_AUTHOR" skip_build:1 skip_pilot:1
|
||||
else
|
||||
FASTLANE_PASSWORD="$FASTLANE_PASSWORD" FASTLANE_ITC_TEAM_NAME="$FASTLANE_ITC_TEAM_NAME" fastlane "$FASTLANE_BUILD_CONFIGURATION" build_number:"$BUILD_NUMBER" commit_hash:"$COMMIT_ID" commit_author:"$COMMIT_AUTHOR" skip_build:1
|
||||
fi
|
||||
|
@ -187,7 +187,7 @@ for ITEM in $APP_ITEMS_WITH_PROVISIONING_PROFILE; do
|
||||
if [ "$ENABLE_GET_TASK_ALLOW" == "1" ]; then
|
||||
KEY="com.apple.security.get-task-allow"
|
||||
PLUTIL_KEY=$(echo "$KEY" | sed 's/\./\\\./g')
|
||||
plutil -insert "$PLUTIL_KEY" -xml "<false/>" "$PROFILE_ENTITLEMENTS_PATH"
|
||||
plutil -insert "$PLUTIL_KEY" -xml "<true/>" "$PROFILE_ENTITLEMENTS_PATH"
|
||||
fi
|
||||
|
||||
ENTITLEMENTS_VAR=PACKAGE_ENTITLEMENTS_$ITEM
|
||||
|
@ -18,6 +18,8 @@ static_library(
|
||||
],
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
"$SDKROOT/System/Library/Frameworks/Contacts.framework",
|
||||
],
|
||||
weak_frameworks = [
|
||||
"Contacts",
|
||||
],
|
||||
)
|
||||
|
@ -159,7 +159,8 @@ enum BotCheckoutEntry: ItemListNodeEntry {
|
||||
return lhs.stableId < rhs.stableId
|
||||
}
|
||||
|
||||
func item(_ arguments: BotCheckoutControllerArguments) -> ListViewItem {
|
||||
func item(_ arguments: Any) -> ListViewItem {
|
||||
let arguments = arguments as! BotCheckoutControllerArguments
|
||||
switch self {
|
||||
case let .header(theme, invoice, botName):
|
||||
return BotCheckoutHeaderItem(account: arguments.account, theme: theme, invoice: invoice, botName: botName, sectionId: self.section)
|
||||
@ -366,7 +367,7 @@ private func availablePaymentMethods(form: BotPaymentForm, current: BotCheckoutP
|
||||
return methods
|
||||
}
|
||||
|
||||
final class BotCheckoutControllerNode: ItemListControllerNode<BotCheckoutEntry>, PKPaymentAuthorizationViewControllerDelegate {
|
||||
final class BotCheckoutControllerNode: ItemListControllerNode, PKPaymentAuthorizationViewControllerDelegate {
|
||||
private let context: AccountContext
|
||||
private let messageId: MessageId
|
||||
private let present: (ViewController, Any?) -> Void
|
||||
@ -394,7 +395,7 @@ final class BotCheckoutControllerNode: ItemListControllerNode<BotCheckoutEntry>,
|
||||
private var applePayAuthrorizationCompletion: ((PKPaymentAuthorizationStatus) -> Void)?
|
||||
private var applePayController: PKPaymentAuthorizationViewController?
|
||||
|
||||
init(controller: ItemListController<BotCheckoutEntry>?, navigationBar: NavigationBar, updateNavigationOffset: @escaping (CGFloat) -> Void, context: AccountContext, invoice: TelegramMediaInvoice, messageId: MessageId, present: @escaping (ViewController, Any?) -> Void, dismissAnimated: @escaping () -> Void) {
|
||||
init(controller: ItemListController?, navigationBar: NavigationBar, updateNavigationOffset: @escaping (CGFloat) -> Void, context: AccountContext, invoice: TelegramMediaInvoice, messageId: MessageId, present: @escaping (ViewController, Any?) -> Void, dismissAnimated: @escaping () -> Void) {
|
||||
self.context = context
|
||||
self.messageId = messageId
|
||||
self.present = present
|
||||
@ -414,8 +415,8 @@ final class BotCheckoutControllerNode: ItemListControllerNode<BotCheckoutEntry>,
|
||||
openShippingMethodImpl?()
|
||||
})
|
||||
|
||||
let signal: Signal<(PresentationTheme, (ItemListNodeState<BotCheckoutEntry>, BotCheckoutEntry.ItemGenerationArguments)), NoError> = combineLatest(context.sharedContext.presentationData, self.state.get(), paymentFormAndInfo.get(), context.account.postbox.loadedPeerWithId(messageId.peerId))
|
||||
|> map { presentationData, state, paymentFormAndInfo, botPeer -> (PresentationTheme, (ItemListNodeState<BotCheckoutEntry>, BotCheckoutEntry.ItemGenerationArguments)) in
|
||||
let signal: Signal<(PresentationTheme, (ItemListNodeState, Any)), NoError> = combineLatest(context.sharedContext.presentationData, self.state.get(), paymentFormAndInfo.get(), context.account.postbox.loadedPeerWithId(messageId.peerId))
|
||||
|> map { presentationData, state, paymentFormAndInfo, botPeer -> (PresentationTheme, (ItemListNodeState, Any)) in
|
||||
let nodeState = ItemListNodeState(entries: botCheckoutControllerEntries(presentationData: presentationData, state: state, invoice: invoice, paymentForm: paymentFormAndInfo?.0, formInfo: paymentFormAndInfo?.1, validatedFormInfo: paymentFormAndInfo?.2, currentShippingOptionId: paymentFormAndInfo?.3, currentPaymentMethod: paymentFormAndInfo?.4, botPeer: botPeer), style: .plain, focusItemTag: nil, emptyStateItem: nil, animateChanges: false)
|
||||
|
||||
return (presentationData.theme, (nodeState, arguments))
|
||||
|
@ -147,7 +147,8 @@ enum BotReceiptEntry: ItemListNodeEntry {
|
||||
return lhs.stableId < rhs.stableId
|
||||
}
|
||||
|
||||
func item(_ arguments: BotReceiptControllerArguments) -> ListViewItem {
|
||||
func item(_ arguments: Any) -> ListViewItem {
|
||||
let arguments = arguments as! BotReceiptControllerArguments
|
||||
switch self {
|
||||
case let .header(theme, invoice, botName):
|
||||
return BotCheckoutHeaderItem(account: arguments.account, theme: theme, invoice: invoice, botName: botName, sectionId: self.section)
|
||||
@ -253,7 +254,7 @@ private func availablePaymentMethods(current: BotCheckoutPaymentMethod?) -> [Bot
|
||||
return []
|
||||
}
|
||||
|
||||
final class BotReceiptControllerNode: ItemListControllerNode<BotReceiptEntry> {
|
||||
final class BotReceiptControllerNode: ItemListControllerNode {
|
||||
private let context: AccountContext
|
||||
private let dismissAnimated: () -> Void
|
||||
|
||||
@ -264,7 +265,7 @@ final class BotReceiptControllerNode: ItemListControllerNode<BotReceiptEntry> {
|
||||
|
||||
private let actionButton: BotCheckoutActionButton
|
||||
|
||||
init(controller: ItemListController<BotReceiptEntry>?, navigationBar: NavigationBar, updateNavigationOffset: @escaping (CGFloat) -> Void, context: AccountContext, invoice: TelegramMediaInvoice, messageId: MessageId, dismissAnimated: @escaping () -> Void) {
|
||||
init(controller: ItemListController?, navigationBar: NavigationBar, updateNavigationOffset: @escaping (CGFloat) -> Void, context: AccountContext, invoice: TelegramMediaInvoice, messageId: MessageId, dismissAnimated: @escaping () -> Void) {
|
||||
self.context = context
|
||||
self.dismissAnimated = dismissAnimated
|
||||
|
||||
@ -272,8 +273,8 @@ final class BotReceiptControllerNode: ItemListControllerNode<BotReceiptEntry> {
|
||||
|
||||
let arguments = BotReceiptControllerArguments(account: context.account)
|
||||
|
||||
let signal: Signal<(PresentationTheme, (ItemListNodeState<BotReceiptEntry>, BotReceiptEntry.ItemGenerationArguments)), NoError> = combineLatest(context.sharedContext.presentationData, receiptData.get(), context.account.postbox.loadedPeerWithId(messageId.peerId))
|
||||
|> map { presentationData, receiptData, botPeer -> (PresentationTheme, (ItemListNodeState<BotReceiptEntry>, BotReceiptEntry.ItemGenerationArguments)) in
|
||||
let signal: Signal<(PresentationTheme, (ItemListNodeState, Any)), NoError> = combineLatest(context.sharedContext.presentationData, receiptData.get(), context.account.postbox.loadedPeerWithId(messageId.peerId))
|
||||
|> map { presentationData, receiptData, botPeer -> (PresentationTheme, (ItemListNodeState, Any)) in
|
||||
let nodeState = ItemListNodeState(entries: botReceiptControllerEntries(presentationData: presentationData, invoice: invoice, formInvoice: receiptData?.0, formInfo: receiptData?.1, shippingOption: receiptData?.2, paymentMethodTitle: receiptData?.3, botPeer: botPeer), style: .plain, focusItemTag: nil, emptyStateItem: nil, animateChanges: false)
|
||||
|
||||
return (presentationData.theme, (nodeState, arguments))
|
||||
|
@ -12,6 +12,8 @@ static_library(
|
||||
],
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
"$SDKROOT/System/Library/Frameworks/CloudKit.framework",
|
||||
],
|
||||
weak_frameworks = [
|
||||
"CloudKit",
|
||||
],
|
||||
)
|
||||
|
@ -128,7 +128,8 @@ private enum CreatePollEntry: ItemListNodeEntry {
|
||||
return lhs.sortId < rhs.sortId
|
||||
}
|
||||
|
||||
func item(_ arguments: CreatePollControllerArguments) -> ListViewItem {
|
||||
func item(_ arguments: Any) -> ListViewItem {
|
||||
let arguments = arguments as! CreatePollControllerArguments
|
||||
switch self {
|
||||
case let .textHeader(theme, text, accessoryText):
|
||||
return ItemListSectionHeaderItem(theme: theme, text: text, accessoryText: accessoryText, sectionId: self.section)
|
||||
@ -305,7 +306,7 @@ public func createPollController(context: AccountContext, peerId: PeerId, comple
|
||||
|
||||
let limitsKey = PostboxViewKey.preferences(keys: Set([PreferencesKeys.limitsConfiguration]))
|
||||
let signal = combineLatest(context.sharedContext.presentationData, statePromise.get() |> deliverOnMainQueue, context.account.postbox.combinedView(keys: [limitsKey]))
|
||||
|> map { presentationData, state, combinedView -> (ItemListControllerState, (ItemListNodeState<CreatePollEntry>, CreatePollEntry.ItemGenerationArguments)) in
|
||||
|> map { presentationData, state, combinedView -> (ItemListControllerState, (ItemListNodeState, Any)) in
|
||||
let limitsConfiguration: LimitsConfiguration = (combinedView.views[limitsKey] as? PreferencesView)?.values[PreferencesKeys.limitsConfiguration] as? LimitsConfiguration ?? LimitsConfiguration.defaultValue
|
||||
|
||||
var enabled = true
|
||||
@ -453,7 +454,7 @@ public func createPollController(context: AccountContext, peerId: PeerId, comple
|
||||
})
|
||||
}
|
||||
|
||||
controller.reorderEntry = { fromIndex, toIndex, entries in
|
||||
controller.setReorderEntry({ (fromIndex: Int, toIndex: Int, entries: [CreatePollEntry]) -> Void in
|
||||
let fromEntry = entries[fromIndex]
|
||||
guard case let .option(_, _, id, _, _, _, _, _) = fromEntry else {
|
||||
return
|
||||
@ -512,7 +513,7 @@ public func createPollController(context: AccountContext, peerId: PeerId, comple
|
||||
}
|
||||
return state
|
||||
}
|
||||
}
|
||||
})
|
||||
controller.isOpaqueWhenInOverlay = true
|
||||
controller.blocksBackgroundWhenInOverlay = true
|
||||
controller.experimentalSnapScrollToItem = true
|
||||
|
1595
submodules/Crc32/Crc32_Xcode.xcodeproj/project.pbxproj
Normal file
1595
submodules/Crc32/Crc32_Xcode.xcodeproj/project.pbxproj
Normal file
File diff suppressed because it is too large
Load Diff
@ -228,7 +228,16 @@ open class NavigationController: UINavigationController, ContainableController,
|
||||
supportedOrientations = supportedOrientations.intersection(modalContainer.container.combinedSupportedOrientations(currentOrientationToLock: currentOrientationToLock))
|
||||
}
|
||||
for overlayContrainer in self.overlayContainers {
|
||||
supportedOrientations = supportedOrientations.intersection(overlayContrainer.controller.combinedSupportedOrientations(currentOrientationToLock: currentOrientationToLock))
|
||||
let controller = overlayContrainer.controller
|
||||
if controller.lockOrientation {
|
||||
if let lockedOrientation = controller.lockedOrientation {
|
||||
supportedOrientations = supportedOrientations.intersection(ViewControllerSupportedOrientations(regularSize: lockedOrientation, compactSize: lockedOrientation))
|
||||
} else {
|
||||
supportedOrientations = supportedOrientations.intersection(ViewControllerSupportedOrientations(regularSize: currentOrientationToLock, compactSize: currentOrientationToLock))
|
||||
}
|
||||
} else {
|
||||
supportedOrientations = supportedOrientations.intersection(controller.supportedOrientations)
|
||||
}
|
||||
}
|
||||
return supportedOrientations
|
||||
}
|
||||
|
@ -339,7 +339,8 @@ final class NavigationModalContainer: ASDisplayNode, UIScrollViewDelegate, UIGes
|
||||
let verticalInset: CGFloat = 44.0
|
||||
|
||||
let maxSide = max(layout.size.width, layout.size.height)
|
||||
let containerSize = CGSize(width: min(layout.size.width - 20.0, floor(maxSide / 2.0)), height: layout.size.height - verticalInset * 2.0)
|
||||
let minSide = min(layout.size.width, layout.size.height)
|
||||
let containerSize = CGSize(width: min(layout.size.width - 20.0, floor(maxSide / 2.0)), height: min(layout.size.height, minSide) - verticalInset * 2.0)
|
||||
containerFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - containerSize.width) / 2.0), y: floor((layout.size.height - containerSize.height) / 2.0)), size: containerSize)
|
||||
containerScale = 1.0
|
||||
|
||||
@ -407,7 +408,7 @@ final class NavigationModalContainer: ASDisplayNode, UIScrollViewDelegate, UIGes
|
||||
enableScrolling = false
|
||||
break
|
||||
} else {
|
||||
if scrollView.isDecelerating && scrollView.contentOffset.y < scrollView.contentInset.top {
|
||||
if scrollView.isDecelerating && scrollView.contentOffset.y < -scrollView.contentInset.top {
|
||||
return self.scrollNode.view
|
||||
}
|
||||
}
|
||||
|
@ -83,4 +83,11 @@ final class NavigationOverlayContainer: ASDisplayNode {
|
||||
self.controller.setIgnoreAppearanceMethodInvocations(false)
|
||||
self.controller.viewDidAppear(false)
|
||||
}
|
||||
|
||||
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
||||
if let result = self.controller.displayNode.hitTest(point, with: event) {
|
||||
return result
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
@ -92,6 +92,8 @@ open class TooltipController: ViewController, StandalonePresentableController {
|
||||
self.dismissImmediatelyOnLayoutUpdate = dismissImmediatelyOnLayoutUpdate
|
||||
|
||||
super.init(navigationBarPresentationData: nil)
|
||||
|
||||
self.statusBar.statusBarStyle = .Ignore
|
||||
}
|
||||
|
||||
required public init(coder aDecoder: NSCoder) {
|
||||
|
@ -52,7 +52,7 @@ final class ChatVideoGalleryItemScrubberView: UIView {
|
||||
var seek: (Double) -> Void = { _ in }
|
||||
|
||||
override init(frame: CGRect) {
|
||||
self.scrubberNode = MediaPlayerScrubbingNode(content: .standard(lineHeight: 5.0, lineCap: .round, scrubberHandle: .circle, backgroundColor: UIColor(white: 1.0, alpha: 0.42), foregroundColor: .white))
|
||||
self.scrubberNode = MediaPlayerScrubbingNode(content: .standard(lineHeight: 5.0, lineCap: .round, scrubberHandle: .circle, backgroundColor: UIColor(white: 1.0, alpha: 0.42), foregroundColor: .white, bufferingColor: UIColor(rgb: 0xffffff, alpha: 0.5)))
|
||||
|
||||
self.leftTimestampNode = MediaPlayerTimeTextNode(textColor: .white)
|
||||
self.rightTimestampNode = MediaPlayerTimeTextNode(textColor: .white)
|
||||
|
@ -98,7 +98,7 @@ final class InstantPageAudioNode: ASDisplayNode, InstantPageNode {
|
||||
if brightness > 0.5 {
|
||||
backgroundAlpha = 0.4
|
||||
}
|
||||
self.scrubbingNode = MediaPlayerScrubbingNode(content: .standard(lineHeight: 3.0, lineCap: .round, scrubberHandle: .line, backgroundColor: theme.textCategories.paragraph.color.withAlphaComponent(backgroundAlpha), foregroundColor: theme.textCategories.paragraph.color))
|
||||
self.scrubbingNode = MediaPlayerScrubbingNode(content: .standard(lineHeight: 3.0, lineCap: .round, scrubberHandle: .line, backgroundColor: theme.textCategories.paragraph.color.withAlphaComponent(backgroundAlpha), foregroundColor: theme.textCategories.paragraph.color, bufferingColor: theme.textCategories.paragraph.color.withAlphaComponent(0.5)))
|
||||
|
||||
let playlistType: MediaManagerPlayerType
|
||||
if let file = self.media.media as? TelegramMediaFile {
|
||||
|
@ -103,8 +103,8 @@ public struct ItemListControllerState {
|
||||
}
|
||||
}
|
||||
|
||||
open class ItemListController<Entry: ItemListNodeEntry>: ViewController, KeyShortcutResponder, PresentableController {
|
||||
private let state: Signal<(ItemListControllerState, (ItemListNodeState<Entry>, Entry.ItemGenerationArguments)), NoError>
|
||||
open class ItemListController: ViewController, KeyShortcutResponder, PresentableController {
|
||||
private let state: Signal<(ItemListControllerState, (ItemListNodeState, Any)), NoError>
|
||||
|
||||
private var leftNavigationButtonTitleAndStyle: (ItemListNavigationButtonContent, ItemListNavigationButtonStyle)?
|
||||
private var rightNavigationButtonTitleAndStyle: [(ItemListNavigationButtonContent, ItemListNavigationButtonStyle)] = []
|
||||
@ -135,7 +135,7 @@ open class ItemListController<Entry: ItemListNodeEntry>: ViewController, KeyShor
|
||||
public var experimentalSnapScrollToItem: Bool = false {
|
||||
didSet {
|
||||
if self.isNodeLoaded {
|
||||
(self.displayNode as! ItemListControllerNode<Entry>).listNode.experimentalSnapScrollToItem = self.experimentalSnapScrollToItem
|
||||
(self.displayNode as! ItemListControllerNode).listNode.experimentalSnapScrollToItem = self.experimentalSnapScrollToItem
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -143,7 +143,7 @@ open class ItemListController<Entry: ItemListNodeEntry>: ViewController, KeyShor
|
||||
public var enableInteractiveDismiss = false {
|
||||
didSet {
|
||||
if self.isNodeLoaded {
|
||||
(self.displayNode as! ItemListControllerNode<Entry>).enableInteractiveDismiss = self.enableInteractiveDismiss
|
||||
(self.displayNode as! ItemListControllerNode).enableInteractiveDismiss = self.enableInteractiveDismiss
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -151,15 +151,15 @@ open class ItemListController<Entry: ItemListNodeEntry>: ViewController, KeyShor
|
||||
public var alwaysSynchronous = false {
|
||||
didSet {
|
||||
if self.isNodeLoaded {
|
||||
(self.displayNode as! ItemListControllerNode<Entry>).alwaysSynchronous = self.alwaysSynchronous
|
||||
(self.displayNode as! ItemListControllerNode).alwaysSynchronous = self.alwaysSynchronous
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public var visibleEntriesUpdated: ((ItemListNodeVisibleEntries<Entry>) -> Void)? {
|
||||
public var visibleEntriesUpdated: ((ItemListNodeVisibleEntries) -> Void)? {
|
||||
didSet {
|
||||
if self.isNodeLoaded {
|
||||
(self.displayNode as! ItemListControllerNode<Entry>).visibleEntriesUpdated = self.visibleEntriesUpdated
|
||||
(self.displayNode as! ItemListControllerNode).visibleEntriesUpdated = self.visibleEntriesUpdated
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -167,7 +167,7 @@ open class ItemListController<Entry: ItemListNodeEntry>: ViewController, KeyShor
|
||||
public var visibleBottomContentOffsetChanged: ((ListViewVisibleContentOffset) -> Void)? {
|
||||
didSet {
|
||||
if self.isNodeLoaded {
|
||||
(self.displayNode as! ItemListControllerNode<Entry>).visibleBottomContentOffsetChanged = self.visibleBottomContentOffsetChanged
|
||||
(self.displayNode as! ItemListControllerNode).visibleBottomContentOffsetChanged = self.visibleBottomContentOffsetChanged
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -175,7 +175,7 @@ open class ItemListController<Entry: ItemListNodeEntry>: ViewController, KeyShor
|
||||
public var contentOffsetChanged: ((ListViewVisibleContentOffset, Bool) -> Void)? {
|
||||
didSet {
|
||||
if self.isNodeLoaded {
|
||||
(self.displayNode as! ItemListControllerNode<Entry>).contentOffsetChanged = self.contentOffsetChanged
|
||||
(self.displayNode as! ItemListControllerNode).contentOffsetChanged = self.contentOffsetChanged
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -183,7 +183,7 @@ open class ItemListController<Entry: ItemListNodeEntry>: ViewController, KeyShor
|
||||
public var contentScrollingEnded: ((ListView) -> Bool)? {
|
||||
didSet {
|
||||
if self.isNodeLoaded {
|
||||
(self.displayNode as! ItemListControllerNode<Entry>).contentScrollingEnded = self.contentScrollingEnded
|
||||
(self.displayNode as! ItemListControllerNode).contentScrollingEnded = self.contentScrollingEnded
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -191,17 +191,22 @@ open class ItemListController<Entry: ItemListNodeEntry>: ViewController, KeyShor
|
||||
public var searchActivated: ((Bool) -> Void)? {
|
||||
didSet {
|
||||
if self.isNodeLoaded {
|
||||
(self.displayNode as! ItemListControllerNode<Entry>).searchActivated = self.searchActivated
|
||||
(self.displayNode as! ItemListControllerNode).searchActivated = self.searchActivated
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public var willScrollToTop: (() -> Void)?
|
||||
|
||||
public var reorderEntry: ((Int, Int, [Entry]) -> Void)? {
|
||||
public func setReorderEntry<T: ItemListNodeEntry>(_ f: @escaping (Int, Int, [T]) -> Void) {
|
||||
self.reorderEntry = { a, b, list in
|
||||
f(a, b, list.map { $0 as! T })
|
||||
}
|
||||
}
|
||||
private var reorderEntry: ((Int, Int, [ItemListNodeAnyEntry]) -> Void)? {
|
||||
didSet {
|
||||
if self.isNodeLoaded {
|
||||
(self.displayNode as! ItemListControllerNode<Entry>).reorderEntry = self.reorderEntry
|
||||
(self.displayNode as! ItemListControllerNode).reorderEntry = self.reorderEntry
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -212,17 +217,20 @@ open class ItemListController<Entry: ItemListNodeEntry>: ViewController, KeyShor
|
||||
public var willDisappear: ((Bool) -> Void)?
|
||||
public var didDisappear: ((Bool) -> Void)?
|
||||
|
||||
convenience public init(context: AccountContext, state: Signal<(ItemListControllerState, (ItemListNodeState<Entry>, Entry.ItemGenerationArguments)), NoError>, tabBarItem: Signal<ItemListControllerTabBarItem, NoError>? = nil) {
|
||||
convenience public init<ItemGenerationArguments>(context: AccountContext, state: Signal<(ItemListControllerState, (ItemListNodeState, ItemGenerationArguments)), NoError>, tabBarItem: Signal<ItemListControllerTabBarItem, NoError>? = nil) {
|
||||
self.init(sharedContext: context.sharedContext, state: state, tabBarItem: tabBarItem)
|
||||
}
|
||||
|
||||
convenience public init(sharedContext: SharedAccountContext, state: Signal<(ItemListControllerState, (ItemListNodeState<Entry>, Entry.ItemGenerationArguments)), NoError>, tabBarItem: Signal<ItemListControllerTabBarItem, NoError>? = nil) {
|
||||
convenience public init<ItemGenerationArguments>(sharedContext: SharedAccountContext, state: Signal<(ItemListControllerState, (ItemListNodeState, ItemGenerationArguments)), NoError>, tabBarItem: Signal<ItemListControllerTabBarItem, NoError>? = nil) {
|
||||
let presentationData = sharedContext.currentPresentationData.with { $0 }
|
||||
self.init(theme: presentationData.theme, strings: presentationData.strings, updatedPresentationData: sharedContext.presentationData |> map { ($0.theme, $0.strings) }, state: state, tabBarItem: tabBarItem)
|
||||
}
|
||||
|
||||
public init(theme: PresentationTheme, strings: PresentationStrings, updatedPresentationData: Signal<(theme: PresentationTheme, strings: PresentationStrings), NoError>, state: Signal<(ItemListControllerState, (ItemListNodeState<Entry>, Entry.ItemGenerationArguments)), NoError>, tabBarItem: Signal<ItemListControllerTabBarItem, NoError>?) {
|
||||
public init<ItemGenerationArguments>(theme: PresentationTheme, strings: PresentationStrings, updatedPresentationData: Signal<(theme: PresentationTheme, strings: PresentationStrings), NoError>, state: Signal<(ItemListControllerState, (ItemListNodeState, ItemGenerationArguments)), NoError>, tabBarItem: Signal<ItemListControllerTabBarItem, NoError>?) {
|
||||
self.state = state
|
||||
|> map { controllerState, nodeStateAndArgument -> (ItemListControllerState, (ItemListNodeState, Any)) in
|
||||
return (controllerState, (nodeStateAndArgument.0, nodeStateAndArgument.1))
|
||||
}
|
||||
|
||||
self.theme = theme
|
||||
self.strings = strings
|
||||
@ -236,7 +244,7 @@ open class ItemListController<Entry: ItemListNodeEntry>: ViewController, KeyShor
|
||||
|
||||
self.scrollToTop = { [weak self] in
|
||||
self?.willScrollToTop?()
|
||||
(self?.displayNode as! ItemListControllerNode<Entry>).scrollToTop()
|
||||
(self?.displayNode as! ItemListControllerNode).scrollToTop()
|
||||
}
|
||||
|
||||
if let tabBarItem = tabBarItem {
|
||||
@ -418,7 +426,7 @@ open class ItemListController<Entry: ItemListNodeEntry>: ViewController, KeyShor
|
||||
}
|
||||
}
|
||||
} |> map { ($0.theme, $1) }
|
||||
let displayNode = ItemListControllerNode<Entry>(controller: self, navigationBar: self.navigationBar!, updateNavigationOffset: { [weak self] offset in
|
||||
let displayNode = ItemListControllerNode(controller: self, navigationBar: self.navigationBar!, updateNavigationOffset: { [weak self] offset in
|
||||
if let strongSelf = self {
|
||||
strongSelf.navigationOffset = offset
|
||||
}
|
||||
@ -440,7 +448,7 @@ open class ItemListController<Entry: ItemListNodeEntry>: ViewController, KeyShor
|
||||
}
|
||||
self.displayNode = displayNode
|
||||
super.displayNodeDidLoad()
|
||||
self._ready.set((self.displayNode as! ItemListControllerNode<Entry>).ready)
|
||||
self._ready.set((self.displayNode as! ItemListControllerNode).ready)
|
||||
}
|
||||
|
||||
override open func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
|
||||
@ -448,7 +456,7 @@ open class ItemListController<Entry: ItemListNodeEntry>: ViewController, KeyShor
|
||||
|
||||
self.validLayout = layout
|
||||
|
||||
(self.displayNode as! ItemListControllerNode<Entry>).containerLayoutUpdated(layout, navigationBarHeight: self.navigationInsetHeight, transition: transition)
|
||||
(self.displayNode as! ItemListControllerNode).containerLayoutUpdated(layout, navigationBarHeight: self.navigationInsetHeight, transition: transition)
|
||||
}
|
||||
|
||||
@objc func leftNavigationButtonPressed() {
|
||||
@ -470,12 +478,12 @@ open class ItemListController<Entry: ItemListNodeEntry>: ViewController, KeyShor
|
||||
}
|
||||
|
||||
public func viewDidAppear(completion: @escaping () -> Void) {
|
||||
(self.displayNode as! ItemListControllerNode<Entry>).listNode.preloadPages = true
|
||||
(self.displayNode as! ItemListControllerNode).listNode.preloadPages = true
|
||||
|
||||
if let presentationArguments = self.presentationArguments as? ViewControllerPresentationArguments, !self.didPlayPresentationAnimation {
|
||||
self.didPlayPresentationAnimation = true
|
||||
if case .modalSheet = presentationArguments.presentationAnimation {
|
||||
(self.displayNode as! ItemListControllerNode<Entry>).animateIn(completion: {
|
||||
(self.displayNode as! ItemListControllerNode).animateIn(completion: {
|
||||
presentationArguments.completion?()
|
||||
completion()
|
||||
})
|
||||
@ -506,7 +514,7 @@ open class ItemListController<Entry: ItemListNodeEntry>: ViewController, KeyShor
|
||||
|
||||
public func frameForItemNode(_ predicate: (ListViewItemNode) -> Bool) -> CGRect? {
|
||||
var result: CGRect?
|
||||
(self.displayNode as! ItemListControllerNode<Entry>).listNode.forEachItemNode { itemNode in
|
||||
(self.displayNode as! ItemListControllerNode).listNode.forEachItemNode { itemNode in
|
||||
if let itemNode = itemNode as? ListViewItemNode {
|
||||
if predicate(itemNode) {
|
||||
result = itemNode.convert(itemNode.bounds, to: self.displayNode)
|
||||
@ -517,7 +525,7 @@ open class ItemListController<Entry: ItemListNodeEntry>: ViewController, KeyShor
|
||||
}
|
||||
|
||||
public func forEachItemNode(_ f: (ListViewItemNode) -> Void) {
|
||||
(self.displayNode as! ItemListControllerNode<Entry>).listNode.forEachItemNode { itemNode in
|
||||
(self.displayNode as! ItemListControllerNode).listNode.forEachItemNode { itemNode in
|
||||
if let itemNode = itemNode as? ListViewItemNode {
|
||||
f(itemNode)
|
||||
}
|
||||
@ -525,11 +533,11 @@ open class ItemListController<Entry: ItemListNodeEntry>: ViewController, KeyShor
|
||||
}
|
||||
|
||||
public func ensureItemNodeVisible(_ itemNode: ListViewItemNode, animated: Bool = true) {
|
||||
(self.displayNode as! ItemListControllerNode<Entry>).listNode.ensureItemNodeVisible(itemNode, animated: animated)
|
||||
(self.displayNode as! ItemListControllerNode).listNode.ensureItemNodeVisible(itemNode, animated: animated)
|
||||
}
|
||||
|
||||
public func afterLayout(_ f: @escaping () -> Void) {
|
||||
(self.displayNode as! ItemListControllerNode<Entry>).afterLayout(f)
|
||||
(self.displayNode as! ItemListControllerNode).afterLayout(f)
|
||||
}
|
||||
|
||||
public func previewingController(from sourceView: UIView, for location: CGPoint) -> (UIViewController, CGRect)? {
|
||||
@ -546,8 +554,8 @@ open class ItemListController<Entry: ItemListNodeEntry>: ViewController, KeyShor
|
||||
}
|
||||
|
||||
var selectedNode: ItemListItemNode?
|
||||
let listLocation = self.view.convert(location, to: (self.displayNode as! ItemListControllerNode<Entry>).listNode.view)
|
||||
(self.displayNode as! ItemListControllerNode<Entry>).listNode.forEachItemNode { itemNode in
|
||||
let listLocation = self.view.convert(location, to: (self.displayNode as! ItemListControllerNode).listNode.view)
|
||||
(self.displayNode as! ItemListControllerNode).listNode.forEachItemNode { itemNode in
|
||||
if itemNode.frame.contains(listLocation), let itemNode = itemNode as? ItemListItemNode {
|
||||
selectedNode = itemNode
|
||||
}
|
||||
@ -570,7 +578,7 @@ open class ItemListController<Entry: ItemListNodeEntry>: ViewController, KeyShor
|
||||
}
|
||||
|
||||
public func clearItemNodesHighlight(animated: Bool = false) {
|
||||
(self.displayNode as! ItemListControllerNode<Entry>).listNode.clearHighlightAnimated(animated)
|
||||
(self.displayNode as! ItemListControllerNode).listNode.clearHighlightAnimated(animated)
|
||||
}
|
||||
|
||||
public func previewingCommit(_ viewControllerToCommit: UIViewController) {
|
||||
|
@ -9,13 +9,30 @@ import MergeLists
|
||||
|
||||
public typealias ItemListSectionId = Int32
|
||||
|
||||
public protocol ItemListNodeEntry: Comparable, Identifiable {
|
||||
associatedtype ItemGenerationArguments
|
||||
|
||||
var section: ItemListSectionId { get }
|
||||
public protocol ItemListNodeAnyEntry {
|
||||
var anyId: AnyHashable { get }
|
||||
var tag: ItemListItemTag? { get }
|
||||
func isLessThan(_ rhs: ItemListNodeAnyEntry) -> Bool
|
||||
func isEqual(_ rhs: ItemListNodeAnyEntry) -> Bool
|
||||
func item(_ arguments: Any) -> ListViewItem
|
||||
}
|
||||
|
||||
public protocol ItemListNodeEntry: Comparable, Identifiable, ItemListNodeAnyEntry {
|
||||
var section: ItemListSectionId { get }
|
||||
}
|
||||
|
||||
public extension ItemListNodeEntry {
|
||||
var anyId: AnyHashable {
|
||||
return self.stableId
|
||||
}
|
||||
|
||||
func item(_ arguments: ItemGenerationArguments) -> ListViewItem
|
||||
func isLessThan(_ rhs: ItemListNodeAnyEntry) -> Bool {
|
||||
return self < (rhs as! Self)
|
||||
}
|
||||
|
||||
func isEqual(_ rhs: ItemListNodeAnyEntry) -> Bool {
|
||||
return self == (rhs as! Self)
|
||||
}
|
||||
}
|
||||
|
||||
public extension ItemListNodeEntry {
|
||||
@ -28,8 +45,14 @@ private struct ItemListNodeEntryTransition {
|
||||
let updates: [ListViewUpdateItem]
|
||||
}
|
||||
|
||||
private func preparedItemListNodeEntryTransition<Entry: ItemListNodeEntry>(from fromEntries: [Entry], to toEntries: [Entry], arguments: Entry.ItemGenerationArguments) -> ItemListNodeEntryTransition {
|
||||
let (deleteIndices, indicesAndItems, updateIndices) = mergeListsStableWithUpdates(leftList: fromEntries, rightList: toEntries)
|
||||
private func preparedItemListNodeEntryTransition(from fromEntries: [ItemListNodeAnyEntry], to toEntries: [ItemListNodeAnyEntry], arguments: Any) -> ItemListNodeEntryTransition {
|
||||
let (deleteIndices, indicesAndItems, updateIndices) = mergeListsStableWithUpdates(leftList: fromEntries, rightList: toEntries, isLess: { lhs, rhs in
|
||||
return lhs.isLessThan(rhs)
|
||||
}, isEqual: { lhs, rhs in
|
||||
return lhs.isEqual(rhs)
|
||||
}, getId: { value in
|
||||
return value.anyId
|
||||
})
|
||||
|
||||
let deletions = deleteIndices.map { ListViewDeleteItem(index: $0, directionHint: nil) }
|
||||
let insertions = indicesAndItems.map { ListViewInsertItem(index: $0.0, previousIndex: $0.2, item: $0.1.item(arguments), directionHint: nil) }
|
||||
@ -43,7 +66,7 @@ public enum ItemListStyle {
|
||||
case blocks
|
||||
}
|
||||
|
||||
private struct ItemListNodeTransition<Entry: ItemListNodeEntry> {
|
||||
private struct ItemListNodeTransition {
|
||||
let theme: PresentationTheme
|
||||
let entries: ItemListNodeEntryTransition
|
||||
let updateStyle: ItemListStyle?
|
||||
@ -56,12 +79,12 @@ private struct ItemListNodeTransition<Entry: ItemListNodeEntry> {
|
||||
let animated: Bool
|
||||
let animateAlpha: Bool
|
||||
let crossfade: Bool
|
||||
let mergedEntries: [Entry]
|
||||
let mergedEntries: [ItemListNodeAnyEntry]
|
||||
let scrollEnabled: Bool
|
||||
}
|
||||
|
||||
public struct ItemListNodeState<Entry: ItemListNodeEntry> {
|
||||
let entries: [Entry]
|
||||
public final class ItemListNodeState {
|
||||
let entries: [ItemListNodeAnyEntry]
|
||||
let style: ItemListStyle
|
||||
let emptyStateItem: ItemListControllerEmptyStateItem?
|
||||
let searchItem: ItemListControllerSearch?
|
||||
@ -72,8 +95,8 @@ public struct ItemListNodeState<Entry: ItemListNodeEntry> {
|
||||
let ensureVisibleItemTag: ItemListItemTag?
|
||||
let initialScrollToItem: ListViewScrollToItem?
|
||||
|
||||
public init(entries: [Entry], style: ItemListStyle, focusItemTag: ItemListItemTag? = nil, ensureVisibleItemTag: ItemListItemTag? = nil, emptyStateItem: ItemListControllerEmptyStateItem? = nil, searchItem: ItemListControllerSearch? = nil, initialScrollToItem: ListViewScrollToItem? = nil, crossfadeState: Bool = false, animateChanges: Bool = true, scrollEnabled: Bool = true) {
|
||||
self.entries = entries
|
||||
public init<T: ItemListNodeEntry>(entries: [T], style: ItemListStyle, focusItemTag: ItemListItemTag? = nil, ensureVisibleItemTag: ItemListItemTag? = nil, emptyStateItem: ItemListControllerEmptyStateItem? = nil, searchItem: ItemListControllerSearch? = nil, initialScrollToItem: ListViewScrollToItem? = nil, crossfadeState: Bool = false, animateChanges: Bool = true, scrollEnabled: Bool = true) {
|
||||
self.entries = entries.map { $0 }
|
||||
self.style = style
|
||||
self.emptyStateItem = emptyStateItem
|
||||
self.searchItem = searchItem
|
||||
@ -86,32 +109,32 @@ public struct ItemListNodeState<Entry: ItemListNodeEntry> {
|
||||
}
|
||||
}
|
||||
|
||||
private final class ItemListNodeOpaqueState<Entry: ItemListNodeEntry> {
|
||||
let mergedEntries: [Entry]
|
||||
private final class ItemListNodeOpaqueState {
|
||||
let mergedEntries: [ItemListNodeAnyEntry]
|
||||
|
||||
init(mergedEntries: [Entry]) {
|
||||
init(mergedEntries: [ItemListNodeAnyEntry]) {
|
||||
self.mergedEntries = mergedEntries
|
||||
}
|
||||
}
|
||||
|
||||
public final class ItemListNodeVisibleEntries<Entry: ItemListNodeEntry>: Sequence {
|
||||
let iterate: () -> Entry?
|
||||
public final class ItemListNodeVisibleEntries: Sequence {
|
||||
let iterate: () -> ItemListNodeAnyEntry?
|
||||
|
||||
init(iterate: @escaping () -> Entry?) {
|
||||
init(iterate: @escaping () -> ItemListNodeAnyEntry?) {
|
||||
self.iterate = iterate
|
||||
}
|
||||
|
||||
public func makeIterator() -> AnyIterator<Entry> {
|
||||
return AnyIterator { () -> Entry? in
|
||||
public func makeIterator() -> AnyIterator<ItemListNodeAnyEntry> {
|
||||
return AnyIterator { () -> ItemListNodeAnyEntry? in
|
||||
return self.iterate()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final class ItemListControllerNodeView<Entry: ItemListNodeEntry>: UITracingLayerView, PreviewingHostView {
|
||||
public final class ItemListControllerNodeView: UITracingLayerView, PreviewingHostView {
|
||||
var onLayout: (() -> Void)?
|
||||
|
||||
init(controller: ItemListController<Entry>?) {
|
||||
init(controller: ItemListController?) {
|
||||
self.controller = controller
|
||||
|
||||
super.init(frame: CGRect())
|
||||
@ -149,10 +172,10 @@ public final class ItemListControllerNodeView<Entry: ItemListNodeEntry>: UITraci
|
||||
})
|
||||
}
|
||||
|
||||
weak var controller: ItemListController<Entry>?
|
||||
weak var controller: ItemListController?
|
||||
}
|
||||
|
||||
open class ItemListControllerNode<Entry: ItemListNodeEntry>: ASDisplayNode, UIScrollViewDelegate {
|
||||
open class ItemListControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
private var _ready = ValuePromise<Bool>()
|
||||
open var ready: Signal<Bool, NoError> {
|
||||
return self._ready.get()
|
||||
@ -172,7 +195,7 @@ open class ItemListControllerNode<Entry: ItemListNodeEntry>: ASDisplayNode, UISc
|
||||
|
||||
private let transitionDisposable = MetaDisposable()
|
||||
|
||||
private var enqueuedTransitions: [ItemListNodeTransition<Entry>] = []
|
||||
private var enqueuedTransitions: [ItemListNodeTransition] = []
|
||||
private var validLayout: (ContainerViewLayout, CGFloat)?
|
||||
|
||||
private var theme: PresentationTheme?
|
||||
@ -186,12 +209,12 @@ open class ItemListControllerNode<Entry: ItemListNodeEntry>: ASDisplayNode, UISc
|
||||
public let updateNavigationOffset: (CGFloat) -> Void
|
||||
public var dismiss: (() -> Void)?
|
||||
|
||||
public var visibleEntriesUpdated: ((ItemListNodeVisibleEntries<Entry>) -> Void)?
|
||||
public var visibleEntriesUpdated: ((ItemListNodeVisibleEntries) -> Void)?
|
||||
public var visibleBottomContentOffsetChanged: ((ListViewVisibleContentOffset) -> Void)?
|
||||
public var contentOffsetChanged: ((ListViewVisibleContentOffset, Bool) -> Void)?
|
||||
public var contentScrollingEnded: ((ListView) -> Bool)?
|
||||
public var searchActivated: ((Bool) -> Void)?
|
||||
public var reorderEntry: ((Int, Int, [Entry]) -> Void)?
|
||||
public var reorderEntry: ((Int, Int, [ItemListNodeAnyEntry]) -> Void)?
|
||||
public var requestLayout: ((ContainedViewLayoutTransition) -> Void)?
|
||||
|
||||
public var enableInteractiveDismiss = false {
|
||||
@ -201,7 +224,7 @@ open class ItemListControllerNode<Entry: ItemListNodeEntry>: ASDisplayNode, UISc
|
||||
|
||||
var alwaysSynchronous = false
|
||||
|
||||
public init(controller: ItemListController<Entry>?, navigationBar: NavigationBar, updateNavigationOffset: @escaping (CGFloat) -> Void, state: Signal<(PresentationTheme, (ItemListNodeState<Entry>, Entry.ItemGenerationArguments)), NoError>) {
|
||||
public init(controller: ItemListController?, navigationBar: NavigationBar, updateNavigationOffset: @escaping (CGFloat) -> Void, state: Signal<(PresentationTheme, (ItemListNodeState, Any)), NoError>) {
|
||||
self.navigationBar = navigationBar
|
||||
self.updateNavigationOffset = updateNavigationOffset
|
||||
|
||||
@ -212,7 +235,7 @@ open class ItemListControllerNode<Entry: ItemListNodeEntry>: ASDisplayNode, UISc
|
||||
super.init()
|
||||
|
||||
self.setViewBlock({ [weak controller] in
|
||||
return ItemListControllerNodeView<Entry>(controller: controller)
|
||||
return ItemListControllerNodeView(controller: controller)
|
||||
})
|
||||
|
||||
self.backgroundColor = nil
|
||||
@ -221,13 +244,13 @@ open class ItemListControllerNode<Entry: ItemListNodeEntry>: ASDisplayNode, UISc
|
||||
self.addSubnode(self.listNode)
|
||||
|
||||
self.listNode.displayedItemRangeChanged = { [weak self] displayedRange, opaqueTransactionState in
|
||||
if let strongSelf = self, let visibleEntriesUpdated = strongSelf.visibleEntriesUpdated, let mergedEntries = (opaqueTransactionState as? ItemListNodeOpaqueState<Entry>)?.mergedEntries {
|
||||
if let strongSelf = self, let visibleEntriesUpdated = strongSelf.visibleEntriesUpdated, let mergedEntries = (opaqueTransactionState as? ItemListNodeOpaqueState)?.mergedEntries {
|
||||
if let visible = displayedRange.visibleRange {
|
||||
let indexRange = (visible.firstIndex, visible.lastIndex)
|
||||
|
||||
var index = indexRange.0
|
||||
let iterator = ItemListNodeVisibleEntries<Entry>(iterate: {
|
||||
var item: Entry?
|
||||
let iterator = ItemListNodeVisibleEntries(iterate: {
|
||||
var item: ItemListNodeAnyEntry?
|
||||
if index <= indexRange.1 {
|
||||
item = mergedEntries[index]
|
||||
}
|
||||
@ -240,7 +263,7 @@ open class ItemListControllerNode<Entry: ItemListNodeEntry>: ASDisplayNode, UISc
|
||||
}
|
||||
|
||||
self.listNode.reorderItem = { [weak self] fromIndex, toIndex, opaqueTransactionState in
|
||||
if let strongSelf = self, let reorderEntry = strongSelf.reorderEntry, let mergedEntries = (opaqueTransactionState as? ItemListNodeOpaqueState<Entry>)?.mergedEntries {
|
||||
if let strongSelf = self, let reorderEntry = strongSelf.reorderEntry, let mergedEntries = (opaqueTransactionState as? ItemListNodeOpaqueState)?.mergedEntries {
|
||||
if fromIndex >= 0 && fromIndex < mergedEntries.count && toIndex >= 0 && toIndex < mergedEntries.count {
|
||||
reorderEntry(fromIndex, toIndex, mergedEntries)
|
||||
}
|
||||
@ -266,10 +289,14 @@ open class ItemListControllerNode<Entry: ItemListNodeEntry>: ASDisplayNode, UISc
|
||||
}
|
||||
}
|
||||
|
||||
let previousState = Atomic<ItemListNodeState<Entry>?>(value: nil)
|
||||
self.transitionDisposable.set(((state |> map { theme, stateAndArguments -> ItemListNodeTransition<Entry> in
|
||||
let previousState = Atomic<ItemListNodeState?>(value: nil)
|
||||
self.transitionDisposable.set(((state |> map { theme, stateAndArguments -> ItemListNodeTransition in
|
||||
let (state, arguments) = stateAndArguments
|
||||
assert(state.entries == state.entries.sorted())
|
||||
if state.entries.count > 1 {
|
||||
for i in 1 ..< state.entries.count {
|
||||
assert(state.entries[i - 1].isLessThan(state.entries[i]))
|
||||
}
|
||||
}
|
||||
let previous = previousState.swap(state)
|
||||
let transition = preparedItemListNodeEntryTransition(from: previous?.entries ?? [], to: state.entries, arguments: arguments)
|
||||
var updatedStyle: ItemListStyle?
|
||||
@ -297,7 +324,7 @@ open class ItemListControllerNode<Entry: ItemListNodeEntry>: ASDisplayNode, UISc
|
||||
override open func didLoad() {
|
||||
super.didLoad()
|
||||
|
||||
(self.view as? ItemListControllerNodeView<Entry>)?.onLayout = { [weak self] in
|
||||
(self.view as? ItemListControllerNodeView)?.onLayout = { [weak self] in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
@ -310,7 +337,7 @@ open class ItemListControllerNode<Entry: ItemListNodeEntry>: ASDisplayNode, UISc
|
||||
}
|
||||
}
|
||||
|
||||
(self.view as? ItemListControllerNodeView<Entry>)?.hitTestImpl = { [weak self] point, event in
|
||||
(self.view as? ItemListControllerNodeView)?.hitTestImpl = { [weak self] point, event in
|
||||
return self?.hitTest(point, with: event)
|
||||
}
|
||||
}
|
||||
@ -416,7 +443,7 @@ open class ItemListControllerNode<Entry: ItemListNodeEntry>: ASDisplayNode, UISc
|
||||
}
|
||||
}
|
||||
|
||||
private func enqueueTransition(_ transition: ItemListNodeTransition<Entry>) {
|
||||
private func enqueueTransition(_ transition: ItemListNodeTransition) {
|
||||
self.enqueuedTransitions.append(transition)
|
||||
if self.validLayout != nil {
|
||||
self.dequeueTransitions()
|
||||
|
@ -364,6 +364,8 @@ static_library(
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
"$SDKROOT/System/Library/Frameworks/UIKit.framework",
|
||||
"$SDKROOT/System/Library/Frameworks/Vision.framework",
|
||||
],
|
||||
weak_frameworks = [
|
||||
"Vision",
|
||||
],
|
||||
)
|
||||
|
@ -171,14 +171,14 @@ const CGPoint TGLocationPickerPinOffset = { 0.0f, 33.0f };
|
||||
[strongSelf switchToFullscreen];
|
||||
};
|
||||
|
||||
_searchBarOverlay = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.navigationController.view.frame.size.width, 64)];
|
||||
_searchBarOverlay = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.navigationController.view.frame.size.width, 44.0f)];
|
||||
_searchBarOverlay.alpha = 0.0f;
|
||||
_searchBarOverlay.autoresizingMask = UIViewAutoresizingFlexibleWidth;
|
||||
_searchBarOverlay.backgroundColor = self.pallete != nil ? self.pallete.sectionHeaderBackgroundColor : UIColorRGB(0xf7f7f7);
|
||||
_searchBarOverlay.userInteractionEnabled = false;
|
||||
[self.navigationController.view addSubview:_searchBarOverlay];
|
||||
|
||||
CGFloat safeAreaInset = self.controllerSafeAreaInset.top > FLT_EPSILON ? self.controllerSafeAreaInset.top : 20;
|
||||
CGFloat safeAreaInset = self.controllerSafeAreaInset.top > FLT_EPSILON ? self.controllerSafeAreaInset.top : 0.0f;
|
||||
_searchBarWrapper = [[UIView alloc] initWithFrame:CGRectMake(0, -44 - safeAreaInset, self.navigationController.view.frame.size.width, 44 + safeAreaInset)];
|
||||
_searchBarWrapper.autoresizingMask = UIViewAutoresizingFlexibleWidth;
|
||||
_searchBarWrapper.backgroundColor = self.pallete != nil ? self.pallete.backgroundColor : [UIColor whiteColor];
|
||||
|
@ -51,6 +51,10 @@
|
||||
{
|
||||
[super loadView];
|
||||
|
||||
if (self.intrinsicSize.width > FLT_EPSILON) {
|
||||
self.view.frame = CGRectMake(0.0f, 0.0f, self.intrinsicSize.width, self.intrinsicSize.height);
|
||||
}
|
||||
|
||||
self.view.backgroundColor = self.pallete != nil ? self.pallete.backgroundColor : [UIColor whiteColor];
|
||||
|
||||
_wrapperView = [[UIView alloc] initWithFrame:self.view.bounds];
|
||||
@ -262,6 +266,10 @@
|
||||
{
|
||||
UIEdgeInsets contentInset = [self controllerInsetForInterfaceOrientation:self.interfaceOrientation];
|
||||
|
||||
bool hasOnScreenNavigation = false;
|
||||
if (iosMajorVersion() >= 11)
|
||||
hasOnScreenNavigation = (self.viewLoaded && self.view.safeAreaInsets.bottom > FLT_EPSILON) || self.context.safeAreaInset.bottom > FLT_EPSILON;
|
||||
|
||||
CGPoint contentOffset = CGPointMake(0, _collectionView.contentSize.height - _collectionView.frame.size.height + contentInset.bottom);
|
||||
if (contentOffset.y < -contentInset.top)
|
||||
contentOffset.y = -contentInset.top;
|
||||
@ -300,7 +308,7 @@
|
||||
_collectionViewWidth = frame.size.width;
|
||||
_collectionView.frame = frame;
|
||||
|
||||
if (lastInverseOffset < 2)
|
||||
if (lastInverseOffset < 45)
|
||||
{
|
||||
[self _adjustContentOffsetToBottom];
|
||||
}
|
||||
|
@ -108,6 +108,8 @@ typedef enum {
|
||||
|
||||
@property (nonatomic, readonly) UIUserInterfaceSizeClass currentSizeClass;
|
||||
|
||||
@property (nonatomic) CGSize intrinsicSize;
|
||||
|
||||
@property (nonatomic, copy) NSArray<id<UIPreviewActionItem>> *(^externalPreviewActionItems)(void);
|
||||
@property (nonatomic, copy) void (^customRemoveFromParentViewController)(void);
|
||||
@property (nonatomic, copy) void (^customDismissSelf)(void);
|
||||
|
@ -732,7 +732,7 @@ static id<LegacyComponentsContext> _defaultContext = nil;
|
||||
- (UIEdgeInsets)controllerInsetForInterfaceOrientation:(UIInterfaceOrientation)orientation
|
||||
{
|
||||
UIEdgeInsets safeAreaInset = _context.safeAreaInset;
|
||||
CGFloat statusBarHeight = safeAreaInset.top > FLT_EPSILON ? safeAreaInset.top : [TGHacks statusBarHeightForOrientation:orientation];
|
||||
CGFloat statusBarHeight = safeAreaInset.top > FLT_EPSILON ? safeAreaInset.top : 0.0;
|
||||
CGFloat keyboardHeight = [self _currentKeyboardHeight:orientation];
|
||||
|
||||
CGFloat navigationBarHeight = ([self navigationBarShouldBeHidden] || [self shouldIgnoreNavigationBar]) ? 0 : [self navigationBarHeightForInterfaceOrientation:orientation];
|
||||
|
@ -281,6 +281,8 @@ public final class LegacyControllerContext: NSObject, LegacyComponentsContext {
|
||||
}
|
||||
if validLayout.intrinsicInsets.bottom.isEqual(to: 21.0) {
|
||||
safeInsets.bottom = 21.0
|
||||
} else if validLayout.intrinsicInsets.bottom.isEqual(to: 34.0) {
|
||||
safeInsets.bottom = 34.0
|
||||
}
|
||||
if controller.navigationPresentation == .modal {
|
||||
safeInsets.top = 0.0
|
||||
@ -485,6 +487,7 @@ open class LegacyController: ViewController, PresentableController {
|
||||
orientation = .landscapeRight
|
||||
}
|
||||
|
||||
legacyTelegramController.intrinsicSize = layout.size
|
||||
legacyTelegramController._updateInset(for: orientation, force: false, notify: true)
|
||||
if self.enableContainerLayoutUpdates {
|
||||
legacyTelegramController.layoutController(for: layout.size, duration: duration)
|
||||
|
@ -251,6 +251,8 @@ public func legacyLocationController(message: Message?, mapMedia: TelegramMediaM
|
||||
|
||||
controller.onViewDidAppear = { [weak controller] in
|
||||
if let strongController = controller {
|
||||
strongController.view.disablesInteractiveModalDismiss = true
|
||||
strongController.view.disablesInteractiveTransitionGestureRecognizer = true
|
||||
strongController.locationMapView.interactiveTransitionGestureRecognizerTest = { point -> Bool in
|
||||
return point.x > 30.0
|
||||
}
|
||||
|
@ -17,10 +17,13 @@ private func generateClearIcon(color: UIColor) -> UIImage? {
|
||||
public func legacyLocationPickerController(context: AccountContext, selfPeer: Peer, peer: Peer, sendLocation: @escaping (CLLocationCoordinate2D, MapVenue?, String?) -> Void, sendLiveLocation: @escaping (CLLocationCoordinate2D, Int32) -> Void, theme: PresentationTheme, customLocationPicker: Bool = false, hasLiveLocation: Bool = true, presentationCompleted: @escaping () -> Void = {}) -> ViewController {
|
||||
let legacyController = LegacyController(presentation: .navigation, theme: theme)
|
||||
legacyController.navigationPresentation = .modal
|
||||
legacyController.presentationCompleted = {
|
||||
presentationCompleted()
|
||||
}
|
||||
let controller = TGLocationPickerController(context: legacyController.context, intent: customLocationPicker ? TGLocationPickerControllerCustomLocationIntent : TGLocationPickerControllerDefaultIntent)!
|
||||
legacyController.presentationCompleted = { [weak controller] in
|
||||
presentationCompleted()
|
||||
|
||||
controller?.view.disablesInteractiveModalDismiss = true
|
||||
controller?.view.disablesInteractiveTransitionGestureRecognizer = true
|
||||
}
|
||||
controller.peer = makeLegacyPeer(selfPeer)
|
||||
controller.receivingPeer = makeLegacyPeer(peer)
|
||||
controller.pallete = legacyLocationPalette(from: theme)
|
||||
|
@ -703,6 +703,9 @@ public final class MediaPlayerAudioRenderer {
|
||||
public init(audioSession: MediaPlayerAudioSessionControl, playAndRecord: Bool, forceAudioToSpeaker: Bool, baseRate: Double, updatedRate: @escaping () -> Void, audioPaused: @escaping () -> Void) {
|
||||
var audioClock: CMClock?
|
||||
CMAudioClockCreate(allocator: nil, clockOut: &audioClock)
|
||||
if audioClock == nil {
|
||||
audioClock = CMClockGetHostTimeClock()
|
||||
}
|
||||
self.audioClock = audioClock!
|
||||
|
||||
var audioTimebase: CMTimebase?
|
||||
|
@ -18,20 +18,40 @@ private func generateHandleBackground(color: UIColor) -> UIImage? {
|
||||
})?.stretchableImage(withLeftCapWidth: 0, topCapHeight: 2)
|
||||
}
|
||||
|
||||
private final class MediaPlayerScrubbingNodeButton: ASDisplayNode {
|
||||
private final class MediaPlayerScrubbingNodeButton: ASDisplayNode, UIGestureRecognizerDelegate {
|
||||
var beginScrubbing: (() -> Void)?
|
||||
var endScrubbing: ((Bool) -> Void)?
|
||||
var updateScrubbing: ((CGFloat) -> Void)?
|
||||
var updateScrubbing: ((CGFloat, Double) -> Void)?
|
||||
var updateMultiplier: ((Double) -> Void)?
|
||||
|
||||
var highlighted: ((Bool) -> Void)?
|
||||
|
||||
var verticalPanEnabled = false
|
||||
var hapticFeedback = HapticFeedback()
|
||||
|
||||
private var scrubbingMultiplier: Double = 1.0
|
||||
private var scrubbingStartLocation: CGPoint?
|
||||
|
||||
override func didLoad() {
|
||||
super.didLoad()
|
||||
|
||||
self.view.disablesInteractiveTransitionGestureRecognizer = true
|
||||
self.view.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: #selector(self.panGesture(_:))))
|
||||
|
||||
let gestureRecognizer = UIPanGestureRecognizer(target: self, action: #selector(self.panGesture(_:)))
|
||||
gestureRecognizer.delegate = self
|
||||
self.view.addGestureRecognizer(gestureRecognizer)
|
||||
}
|
||||
|
||||
override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
guard let gestureRecognizer = gestureRecognizer as? UIPanGestureRecognizer else {
|
||||
return !self.verticalPanEnabled
|
||||
}
|
||||
let translation = gestureRecognizer.translation(in: gestureRecognizer.view)
|
||||
if self.verticalPanEnabled {
|
||||
return abs(translation.x) > abs(translation.y) || translation.y > 0.0
|
||||
} else {
|
||||
return abs(translation.x) > abs(translation.y)
|
||||
}
|
||||
}
|
||||
|
||||
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||
@ -66,15 +86,38 @@ private final class MediaPlayerScrubbingNodeButton: ASDisplayNode {
|
||||
case .changed:
|
||||
if let scrubbingStartLocation = self.scrubbingStartLocation {
|
||||
let delta = location.x - scrubbingStartLocation.x
|
||||
self.updateScrubbing?(delta / self.bounds.size.width)
|
||||
var multiplier: Double = 1.0
|
||||
var skipUpdate = false
|
||||
if self.verticalPanEnabled, location.y > scrubbingStartLocation.y {
|
||||
let verticalDelta = abs(location.y - scrubbingStartLocation.y)
|
||||
if verticalDelta > 150.0 {
|
||||
multiplier = 0.01
|
||||
} else if verticalDelta > 100.0 {
|
||||
multiplier = 0.25
|
||||
} else if verticalDelta > 50.0 {
|
||||
multiplier = 0.5
|
||||
}
|
||||
if multiplier != self.scrubbingMultiplier {
|
||||
skipUpdate = true
|
||||
self.scrubbingMultiplier = multiplier
|
||||
self.scrubbingStartLocation = CGPoint(x: location.x, y: scrubbingStartLocation.y)
|
||||
self.updateMultiplier?(multiplier)
|
||||
|
||||
self.hapticFeedback.impact()
|
||||
}
|
||||
}
|
||||
if !skipUpdate {
|
||||
self.updateScrubbing?(delta / self.bounds.size.width, multiplier)
|
||||
}
|
||||
}
|
||||
case .ended, .cancelled:
|
||||
if let scrubbingStartLocation = self.scrubbingStartLocation {
|
||||
self.scrubbingStartLocation = nil
|
||||
let delta = location.x - scrubbingStartLocation.x
|
||||
self.updateScrubbing?(delta / self.bounds.size.width)
|
||||
self.updateScrubbing?(delta / self.bounds.size.width, self.scrubbingMultiplier)
|
||||
self.endScrubbing?(recognizer.state == .ended)
|
||||
self.highlighted?(false)
|
||||
self.scrubbingMultiplier = 1.0
|
||||
}
|
||||
default:
|
||||
break
|
||||
@ -106,7 +149,7 @@ public enum MediaPlayerScrubbingNodeHandle {
|
||||
}
|
||||
|
||||
public enum MediaPlayerScrubbingNodeContent {
|
||||
case standard(lineHeight: CGFloat, lineCap: MediaPlayerScrubbingNodeCap, scrubberHandle: MediaPlayerScrubbingNodeHandle, backgroundColor: UIColor, foregroundColor: UIColor)
|
||||
case standard(lineHeight: CGFloat, lineCap: MediaPlayerScrubbingNodeCap, scrubberHandle: MediaPlayerScrubbingNodeHandle, backgroundColor: UIColor, foregroundColor: UIColor, bufferingColor: UIColor)
|
||||
case custom(backgroundNode: ASDisplayNode, foregroundContentNode: ASDisplayNode)
|
||||
}
|
||||
|
||||
@ -194,10 +237,12 @@ private final class MediaPlayerScrubbingBufferingNode: ASDisplayNode {
|
||||
for range in ranges.0.rangeView {
|
||||
let rangeWidth = min(size.width, (CGFloat(range.count) / CGFloat(ranges.1)) * size.width)
|
||||
transition.updateFrame(node: self.containerNode, frame: CGRect(origin: CGPoint(), size: CGSize(width: rangeWidth, height: size.height)))
|
||||
transition.updateAlpha(node: self.foregroundNode, alpha: abs(size.width - rangeWidth) < 1.0 ? 0.0 : 1.0)
|
||||
break
|
||||
}
|
||||
} else {
|
||||
transition.updateFrame(node: self.containerNode, frame: CGRect(origin: CGPoint(), size: CGSize(width: 0.0, height: size.height)))
|
||||
transition.updateAlpha(node: self.foregroundNode, alpha: 0.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,6 +285,17 @@ public final class MediaPlayerScrubbingNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
public var enableFineScrubbing: Bool = false {
|
||||
didSet {
|
||||
switch self.contentNodes {
|
||||
case let .standard(node):
|
||||
node.handleNodeContainer?.verticalPanEnabled = self.enableFineScrubbing
|
||||
case let .custom(node):
|
||||
node.handleNodeContainer?.verticalPanEnabled = self.enableFineScrubbing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var _statusValue: MediaPlayerStatus?
|
||||
private var statusValue: MediaPlayerStatus? {
|
||||
get {
|
||||
@ -293,13 +349,13 @@ public final class MediaPlayerScrubbingNode: ASDisplayNode {
|
||||
|
||||
private static func contentNodesFromContent(_ content: MediaPlayerScrubbingNodeContent, enableScrubbing: Bool) -> MediaPlayerScrubbingNodeContentNodes {
|
||||
switch content {
|
||||
case let .standard(lineHeight, lineCap, scrubberHandle, backgroundColor, foregroundColor):
|
||||
case let .standard(lineHeight, lineCap, scrubberHandle, backgroundColor, foregroundColor, bufferingColor):
|
||||
let backgroundNode = ASImageNode()
|
||||
backgroundNode.isLayerBacked = true
|
||||
backgroundNode.displaysAsynchronously = false
|
||||
backgroundNode.displayWithoutProcessing = true
|
||||
|
||||
let bufferingNode = MediaPlayerScrubbingBufferingNode(color: foregroundColor.withAlphaComponent(0.5), lineCap: lineCap, lineHeight: lineHeight)
|
||||
let bufferingNode = MediaPlayerScrubbingBufferingNode(color: bufferingColor, lineCap: lineCap, lineHeight: lineHeight)
|
||||
|
||||
let foregroundContentNode = ASImageNode()
|
||||
foregroundContentNode.isLayerBacked = true
|
||||
@ -421,7 +477,7 @@ public final class MediaPlayerScrubbingNode: ASDisplayNode {
|
||||
strongSelf.displayLink?.isPaused = true
|
||||
|
||||
var timestamp = statusValue.timestamp
|
||||
if statusValue.generationTimestamp > 0 {
|
||||
if statusValue.generationTimestamp > 0 && statusValue.status == .playing {
|
||||
let currentTimestamp = CACurrentMediaTime()
|
||||
timestamp = timestamp + (currentTimestamp - statusValue.generationTimestamp) * statusValue.baseRate
|
||||
}
|
||||
@ -437,7 +493,6 @@ public final class MediaPlayerScrubbingNode: ASDisplayNode {
|
||||
strongSelf.updateProgressAnimations()
|
||||
|
||||
highlightedHandleNode.layer.animateSpring(from: 1.0 as NSNumber, to: 0.1875 as NSNumber, keyPath: "transform.scale", duration: 0.65, initialVelocity: 0.0, damping: 120.0, removeOnCompletion: false)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -453,10 +508,11 @@ public final class MediaPlayerScrubbingNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
}
|
||||
handleNodeContainer.updateScrubbing = { [weak self] addedFraction in
|
||||
handleNodeContainer.updateScrubbing = { [weak self] addedFraction, multiplier in
|
||||
if let strongSelf = self {
|
||||
if let statusValue = strongSelf.statusValue, let scrubbingBeginTimestamp = strongSelf.scrubbingBeginTimestamp, Double(0.0).isLess(than: statusValue.duration) {
|
||||
let timestampValue = max(0.0, min(statusValue.duration, scrubbingBeginTimestamp + statusValue.duration * Double(addedFraction)))
|
||||
let delta: Double = (statusValue.duration * Double(addedFraction)) * multiplier
|
||||
let timestampValue = max(0.0, min(statusValue.duration, scrubbingBeginTimestamp + delta))
|
||||
strongSelf.scrubbingTimestampValue = timestampValue
|
||||
strongSelf._scrubbingTimestamp.set(.single(strongSelf.scrubbingTimestampValue))
|
||||
strongSelf._scrubbingPosition.set(.single(strongSelf.scrubbingTimestampValue.flatMap { $0 / statusValue.duration }))
|
||||
@ -465,6 +521,13 @@ public final class MediaPlayerScrubbingNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
}
|
||||
handleNodeContainer.updateMultiplier = { [weak self] multiplier in
|
||||
if let strongSelf = self {
|
||||
if let statusValue = strongSelf.statusValue, let scrubbingBeginTimestamp = strongSelf.scrubbingBeginTimestamp, Double(0.0).isLess(than: statusValue.duration) {
|
||||
strongSelf.scrubbingBeginTimestamp = strongSelf.scrubbingTimestampValue
|
||||
}
|
||||
}
|
||||
}
|
||||
handleNodeContainer.endScrubbing = { [weak self] apply in
|
||||
if let strongSelf = self {
|
||||
strongSelf.scrubbingBeginTimestamp = nil
|
||||
@ -513,14 +576,21 @@ public final class MediaPlayerScrubbingNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
}
|
||||
handleNodeContainer.updateScrubbing = { [weak self] addedFraction in
|
||||
handleNodeContainer.updateScrubbing = { [weak self] addedFraction, multiplier in
|
||||
if let strongSelf = self {
|
||||
if let statusValue = strongSelf.statusValue, let scrubbingBeginTimestamp = strongSelf.scrubbingBeginTimestamp, Double(0.0).isLess(than: statusValue.duration) {
|
||||
strongSelf.scrubbingTimestampValue = scrubbingBeginTimestamp + statusValue.duration * Double(addedFraction)
|
||||
strongSelf.scrubbingTimestampValue = scrubbingBeginTimestamp + (statusValue.duration * Double(addedFraction)) * multiplier
|
||||
strongSelf.updateProgressAnimations()
|
||||
}
|
||||
}
|
||||
}
|
||||
handleNodeContainer.updateMultiplier = { [weak self] multiplier in
|
||||
if let strongSelf = self {
|
||||
if let statusValue = strongSelf.statusValue, let scrubbingBeginTimestamp = strongSelf.scrubbingBeginTimestamp, Double(0.0).isLess(than: statusValue.duration) {
|
||||
strongSelf.scrubbingBeginTimestamp = strongSelf.scrubbingTimestampValue
|
||||
}
|
||||
}
|
||||
}
|
||||
handleNodeContainer.endScrubbing = { [weak self] apply in
|
||||
if let strongSelf = self {
|
||||
strongSelf.scrubbingBeginTimestamp = nil
|
||||
|
@ -35,6 +35,20 @@ private struct MediaPlayerTimeTextNodeState: Equatable {
|
||||
}
|
||||
}
|
||||
|
||||
private extension MediaPlayerTimeTextNodeState {
|
||||
var string: String {
|
||||
if let hours = self.hours, let minutes = self.minutes, let seconds = self.seconds {
|
||||
if hours != 0 {
|
||||
return String(format: "%d:%02d:%02d", hours, minutes, seconds)
|
||||
} else {
|
||||
return String(format: "%d:%02d", minutes, seconds)
|
||||
}
|
||||
} else {
|
||||
return "-:--"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final class MediaPlayerTimeTextNodeParameters: NSObject {
|
||||
let state: MediaPlayerTimeTextNodeState
|
||||
let alignment: NSTextAlignment
|
||||
@ -160,6 +174,14 @@ public final class MediaPlayerTimeTextNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
private let digitsSet = CharacterSet(charactersIn: "0123456789")
|
||||
private func widthForString(_ string: String) -> CGFloat {
|
||||
let convertedString = string.components(separatedBy: digitsSet).joined(separator: "8")
|
||||
let text = NSAttributedString(string: convertedString, font: textFont, textColor: .black)
|
||||
let size = text.boundingRect(with: CGSize(width: 200.0, height: 100.0), options: NSStringDrawingOptions.usesLineFragmentOrigin, context: nil).size
|
||||
return size.width
|
||||
}
|
||||
|
||||
override public func drawParameters(forAsyncLayer layer: _ASDisplayLayer) -> NSObjectProtocol? {
|
||||
return MediaPlayerTimeTextNodeParameters(state: self.state, alignment: self.alignment, mode: self.mode, textColor: self.textColor)
|
||||
}
|
||||
@ -174,19 +196,8 @@ public final class MediaPlayerTimeTextNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
if let parameters = parameters as? MediaPlayerTimeTextNodeParameters {
|
||||
let text: String
|
||||
if let hours = parameters.state.hours, let minutes = parameters.state.minutes, let seconds = parameters.state.seconds {
|
||||
if hours != 0 {
|
||||
text = String(format: "%d:%02d:%02d", hours, minutes, seconds)
|
||||
} else {
|
||||
text = String(format: "%d:%02d", minutes, seconds)
|
||||
}
|
||||
} else {
|
||||
text = "-:--"
|
||||
}
|
||||
let string = NSAttributedString(string: text, font: textFont, textColor: parameters.textColor)
|
||||
let string = NSAttributedString(string: parameters.state.string, font: textFont, textColor: parameters.textColor)
|
||||
let size = string.boundingRect(with: CGSize(width: 200.0, height: 100.0), options: NSStringDrawingOptions.usesLineFragmentOrigin, context: nil).size
|
||||
|
||||
if parameters.alignment == .left {
|
||||
string.draw(at: CGPoint())
|
||||
} else {
|
||||
|
@ -4,3 +4,11 @@ public protocol Identifiable {
|
||||
associatedtype T: Hashable
|
||||
var stableId: T { get }
|
||||
}
|
||||
|
||||
public struct AnyIdentifiable {
|
||||
var stableId: AnyHashable
|
||||
|
||||
public init<T>(_ value: T) where T : Identifiable {
|
||||
self.stableId = value.stableId
|
||||
}
|
||||
}
|
||||
|
@ -181,6 +181,190 @@ public func mergeListsStableWithUpdates<T>(leftList: [T], rightList: [T], allUpd
|
||||
return (removeIndices, insertItems, updatedIndices)
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func mergeListsStableWithUpdates<T>(leftList: [T], rightList: [T], isLess: (T, T) -> Bool, isEqual: (T, T) -> Bool, getId: (T) -> AnyHashable, allUpdated: Bool = false) -> ([Int], [(Int, T, Int?)], [(Int, T, Int)]) {
|
||||
var removeIndices: [Int] = []
|
||||
var insertItems: [(Int, T, Int?)] = []
|
||||
var updatedIndices: [(Int, T, Int)] = []
|
||||
|
||||
#if DEBUG
|
||||
var existingStableIds: [AnyHashable: T] = [:]
|
||||
for item in leftList {
|
||||
if let _ = existingStableIds[getId(item)] {
|
||||
assertionFailure()
|
||||
} else {
|
||||
existingStableIds[getId(item)] = item
|
||||
}
|
||||
}
|
||||
existingStableIds.removeAll()
|
||||
for item in rightList {
|
||||
if let other = existingStableIds[getId(item)] {
|
||||
print("\(other) has the same stableId as \(item): \(getId(item))")
|
||||
assertionFailure()
|
||||
} else {
|
||||
existingStableIds[getId(item)] = item
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
var currentList = leftList
|
||||
|
||||
var i = 0
|
||||
var previousIndices: [AnyHashable: Int] = [:]
|
||||
for left in leftList {
|
||||
previousIndices[getId(left)] = i
|
||||
i += 1
|
||||
}
|
||||
|
||||
i = 0
|
||||
var j = 0
|
||||
while true {
|
||||
let left: T? = i < currentList.count ? currentList[i] : nil
|
||||
let right: T? = j < rightList.count ? rightList[j] : nil
|
||||
|
||||
if let left = left, let right = right {
|
||||
if getId(left) == getId(right) && (!isEqual(left, right) || allUpdated) {
|
||||
updatedIndices.append((i, right, previousIndices[getId(left)]!))
|
||||
i += 1
|
||||
j += 1
|
||||
} else {
|
||||
if isEqual(left, right) && !allUpdated {
|
||||
i += 1
|
||||
j += 1
|
||||
} else if isLess(left, right) {
|
||||
removeIndices.append(i)
|
||||
i += 1
|
||||
} else {
|
||||
j += 1
|
||||
}
|
||||
}
|
||||
} else if let _ = left {
|
||||
removeIndices.append(i)
|
||||
i += 1
|
||||
} else if let _ = right {
|
||||
j += 1
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
//print("remove:\n\(removeIndices)")
|
||||
|
||||
for index in removeIndices.reversed() {
|
||||
currentList.remove(at: index)
|
||||
for i in 0 ..< updatedIndices.count {
|
||||
if updatedIndices[i].0 >= index {
|
||||
updatedIndices[i].0 -= 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*print("\n current after removes:\n")
|
||||
m = 0
|
||||
for right in currentList {
|
||||
print("\(m): \(right.stableId)")
|
||||
m += 1
|
||||
}
|
||||
|
||||
print("update:\n\(updatedIndices.map({ "\($0.0), \($0.1.stableId) (was \($0.2)))" }))")*/
|
||||
|
||||
i = 0
|
||||
j = 0
|
||||
var k = 0
|
||||
while true {
|
||||
let left: T?
|
||||
|
||||
//print("i=\(i), j=\(j), k=\(k)")
|
||||
|
||||
if k < updatedIndices.count && updatedIndices[k].0 < i {
|
||||
//print("updated[k=\(k)]=\(updatedIndices[k].0)<i=\(i), k++")
|
||||
k += 1
|
||||
}
|
||||
|
||||
if k < updatedIndices.count {
|
||||
if updatedIndices[k].0 == i {
|
||||
left = updatedIndices[k].1
|
||||
//print("override left = \(updatedIndices[k].1.stableId)")
|
||||
} else {
|
||||
left = i < currentList.count ? currentList[i] : nil
|
||||
}
|
||||
} else {
|
||||
left = i < currentList.count ? currentList[i] : nil
|
||||
}
|
||||
|
||||
let right: T? = j < rightList.count ? rightList[j] : nil
|
||||
|
||||
if let left = left, let right = right {
|
||||
if isEqual(left, right) {
|
||||
//print("\(left.stableId)==\(right.stableId)")
|
||||
//print("i++, j++")
|
||||
i += 1
|
||||
j += 1
|
||||
} else if !isLess(left, right) {
|
||||
//print("\(left.stableId)>\(right.stableId)")
|
||||
//print("insert \(right.stableId) at \(i)")
|
||||
//print("i++, j++")
|
||||
let previousIndex = previousIndices[getId(right)]
|
||||
insertItems.append((i, right, previousIndex))
|
||||
currentList.insert(right, at: i)
|
||||
if k < updatedIndices.count {
|
||||
for l in k ..< updatedIndices.count {
|
||||
updatedIndices[l] = (updatedIndices[l].0 + 1, updatedIndices[l].1, updatedIndices[l].2)
|
||||
}
|
||||
}
|
||||
|
||||
i += 1
|
||||
j += 1
|
||||
} else {
|
||||
//print("\(left.stableId)<\(right.stableId)")
|
||||
//print("i++")
|
||||
i += 1
|
||||
}
|
||||
} else if let _ = left {
|
||||
//print("\(left!.stableId)>nil")
|
||||
//print("i++")
|
||||
i += 1
|
||||
} else if let right = right {
|
||||
//print("nil<\(right.stableId)")
|
||||
//print("insert \(right.stableId) at \(i)")
|
||||
//print("i++")
|
||||
//print("j++")
|
||||
let previousIndex = previousIndices[getId(right)]
|
||||
insertItems.append((i, right, previousIndex))
|
||||
currentList.insert(right, at: i)
|
||||
|
||||
if k < updatedIndices.count {
|
||||
for l in k ..< updatedIndices.count {
|
||||
updatedIndices[l] = (updatedIndices[l].0 + 1, updatedIndices[l].1, updatedIndices[l].2)
|
||||
}
|
||||
}
|
||||
|
||||
i += 1
|
||||
j += 1
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
for (index, item, _) in updatedIndices {
|
||||
currentList[index] = item
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
if currentList.count != rightList.count {
|
||||
precondition(false)
|
||||
} else {
|
||||
for i in 0 ..< currentList.count {
|
||||
if !isEqual(currentList[i], rightList[i]) {
|
||||
precondition(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return (removeIndices, insertItems, updatedIndices)
|
||||
}
|
||||
|
||||
@inlinable
|
||||
public func mergeListsStableWithUpdatesReversed<T>(leftList: [T], rightList: [T], allUpdated: Bool = false) -> ([Int], [(Int, T, Int?)], [(Int, T, Int)]) where T: Comparable, T: Identifiable {
|
||||
var removeIndices: [Int] = []
|
||||
|
@ -37,6 +37,7 @@ static NSData * _Nullable readPublicKey(EVP_PKEY *subject) {
|
||||
}
|
||||
|
||||
+ (MTPKCS * _Nullable)parse:(const unsigned char *)buffer size:(int)size {
|
||||
#if TARGET_OS_IOS
|
||||
MTPKCS * _Nullable result = nil;
|
||||
PKCS7 *pkcs7 = NULL;
|
||||
STACK_OF(X509) *signers = NULL;
|
||||
@ -85,6 +86,10 @@ static NSData * _Nullable readPublicKey(EVP_PKEY *subject) {
|
||||
result = [[MTPKCS alloc] initWithIssuerName:issuerNameString subjectName:subjectNameString data:data];
|
||||
|
||||
return result;
|
||||
#else
|
||||
return nil;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -321,7 +321,9 @@ NSData *MTRsaEncrypt(NSString *publicKey, NSData *data)
|
||||
BIGNUM *a = BN_bin2bn(data.bytes, (int)data.length, NULL);
|
||||
BIGNUM *r = BN_new();
|
||||
|
||||
BN_mod_exp(r, a, rsaKey->e, rsaKey->n, ctx);
|
||||
|
||||
|
||||
BN_mod_exp(r, a, RSA_get0_e(rsaKey), RSA_get0_n(rsaKey), ctx);
|
||||
|
||||
unsigned char *res = malloc((size_t)BN_num_bytes(r));
|
||||
int resLen = BN_bn2bin(r, res);
|
||||
|
@ -75,3 +75,4 @@ FOUNDATION_EXPORT const unsigned char MtProtoKitMacVersionString[];
|
||||
#import <MtProtoKitMac/AFHTTPRequestOperation.h>
|
||||
#import <MTProtoKitMac/MTProxyConnectivity.h>
|
||||
#import <MTProtoKitMac/MTGzip.h>
|
||||
#import <MTProtoKitMac/TON.h>
|
||||
|
6411
submodules/MtProtoKit/MtProtoKit_Xcode.xcodeproj/project.pbxproj
Normal file
6411
submodules/MtProtoKit/MtProtoKit_Xcode.xcodeproj/project.pbxproj
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1030"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "D079AB961AF39B8000076F59"
|
||||
BuildableName = "MtProtoKitMac.framework"
|
||||
BlueprintName = "MtProtoKitMac"
|
||||
ReferencedContainer = "container:MtProtoKit_Xcode.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "D079AB961AF39B8000076F59"
|
||||
BuildableName = "MtProtoKitMac.framework"
|
||||
BlueprintName = "MtProtoKitMac"
|
||||
ReferencedContainer = "container:MtProtoKit_Xcode.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "D079AB961AF39B8000076F59"
|
||||
BuildableName = "MtProtoKitMac.framework"
|
||||
BlueprintName = "MtProtoKitMac"
|
||||
ReferencedContainer = "container:MtProtoKit_Xcode.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
@ -98,6 +98,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (MTSignal *)deleteAllKeys;
|
||||
- (MTSignal *)getTransactionListWithAddress:(NSString * _Nonnull)address lt:(int64_t)lt hash:(NSData * _Nonnull)hash;
|
||||
|
||||
- (NSData *)encrypt:(NSData *)decryptedData secret:(NSData *)data;
|
||||
- (NSData * __nullable)decrypt:(NSData *)encryptedData secret:(NSData *)data;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@ -37,6 +37,14 @@ static NSString * _Nullable readString(std::string &string) {
|
||||
}
|
||||
}
|
||||
|
||||
static NSData * _Nullable readSecureString(td::SecureString &string) {
|
||||
if (string.size() == 0) {
|
||||
return [NSData data];
|
||||
} else {
|
||||
return [[NSData alloc] initWithBytes:string.data() length:string.size()];
|
||||
}
|
||||
}
|
||||
|
||||
static TONTransactionMessage * _Nullable parseTransactionMessage(tonlib_api::object_ptr<tonlib_api::raw_message> &message) {
|
||||
if (message == nullptr) {
|
||||
return nil;
|
||||
@ -326,6 +334,26 @@ typedef enum {
|
||||
#endif
|
||||
}
|
||||
|
||||
- (NSData * __nullable)decrypt:(NSData *)encryptedData secret:(NSData *)data {
|
||||
auto query = make_object<tonlib_api::decrypt>(makeSecureString(encryptedData), makeSecureString(data));
|
||||
tonlib_api::object_ptr<tonlib_api::Object> result = _client->execute({ INT16_MAX + 1, std::move(query) }).object;
|
||||
|
||||
if (result->get_id() == tonlib_api::error::ID) {
|
||||
return nil;
|
||||
} else {
|
||||
tonlib_api::object_ptr<tonlib_api::data> value = tonlib_api::move_object_as<tonlib_api::data>(result);
|
||||
return readSecureString(value->bytes_);
|
||||
}
|
||||
}
|
||||
- (NSData *)encrypt:(NSData *)decryptedData secret:(NSData *)data {
|
||||
auto query = make_object<tonlib_api::encrypt>(makeSecureString(decryptedData), makeSecureString(data));
|
||||
tonlib_api::object_ptr<tonlib_api::Object> result = _client->execute({ INT16_MAX + 1, std::move(query) }).object;
|
||||
|
||||
tonlib_api::object_ptr<tonlib_api::data> value = tonlib_api::move_object_as<tonlib_api::data>(result);
|
||||
|
||||
return readSecureString(value->bytes_);
|
||||
}
|
||||
|
||||
- (MTSignal *)requestInitWithConfigString:(NSString *)configString blockchainName:(NSString *)blockchainName keystoreDirectory:(NSString *)keystoreDirectory enableExternalRequests:(bool)enableExternalRequests {
|
||||
return [[[[MTSignal alloc] initWithGenerator:^id<MTDisposable>(MTSubscriber *subscriber) {
|
||||
uint64_t requestId = _nextRequestId;
|
||||
|
@ -48,6 +48,10 @@ class accountAddress;
|
||||
|
||||
class bip39Hints;
|
||||
|
||||
class config;
|
||||
|
||||
class data;
|
||||
|
||||
class error;
|
||||
|
||||
class exportedEncryptedKey;
|
||||
@ -60,13 +64,25 @@ class inputKey;
|
||||
|
||||
class key;
|
||||
|
||||
class KeyStoreType;
|
||||
|
||||
class LogStream;
|
||||
|
||||
class logTags;
|
||||
|
||||
class logVerbosityLevel;
|
||||
|
||||
class ok;
|
||||
|
||||
class options;
|
||||
|
||||
class generic_AccountState;
|
||||
class sendGramsResult;
|
||||
|
||||
class generic_InitialAccountState;
|
||||
class unpackedAccountAddress;
|
||||
|
||||
class updateSendLiteServerQuery;
|
||||
|
||||
class generic_AccountState;
|
||||
|
||||
class internal_transactionId;
|
||||
|
||||
@ -88,6 +104,10 @@ class testWallet_initialAccountState;
|
||||
|
||||
class uninited_accountState;
|
||||
|
||||
class wallet_accountState;
|
||||
|
||||
class wallet_initialAccountState;
|
||||
|
||||
class Object;
|
||||
|
||||
class Object: public TlObject {
|
||||
@ -130,6 +150,41 @@ class bip39Hints final : public Object {
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class config final : public Object {
|
||||
public:
|
||||
std::string config_;
|
||||
std::string blockchain_name_;
|
||||
bool use_callbacks_for_network_;
|
||||
bool ignore_cache_;
|
||||
|
||||
config();
|
||||
|
||||
config(std::string const &config_, std::string const &blockchain_name_, bool use_callbacks_for_network_, bool ignore_cache_);
|
||||
|
||||
static const std::int32_t ID = -1538391496;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class data final : public Object {
|
||||
public:
|
||||
td::SecureString bytes_;
|
||||
|
||||
data();
|
||||
|
||||
explicit data(td::SecureString &&bytes_);
|
||||
|
||||
static const std::int32_t ID = -414733967;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class error final : public Object {
|
||||
public:
|
||||
std::int32_t code_;
|
||||
@ -229,6 +284,118 @@ class key final : public Object {
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class KeyStoreType: public Object {
|
||||
public:
|
||||
};
|
||||
|
||||
class keyStoreTypeDirectory final : public KeyStoreType {
|
||||
public:
|
||||
std::string directory_;
|
||||
|
||||
keyStoreTypeDirectory();
|
||||
|
||||
explicit keyStoreTypeDirectory(std::string const &directory_);
|
||||
|
||||
static const std::int32_t ID = -378990038;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class keyStoreTypeInMemory final : public KeyStoreType {
|
||||
public:
|
||||
|
||||
keyStoreTypeInMemory();
|
||||
|
||||
static const std::int32_t ID = -2106848825;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class LogStream: public Object {
|
||||
public:
|
||||
};
|
||||
|
||||
class logStreamDefault final : public LogStream {
|
||||
public:
|
||||
|
||||
logStreamDefault();
|
||||
|
||||
static const std::int32_t ID = 1390581436;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class logStreamFile final : public LogStream {
|
||||
public:
|
||||
std::string path_;
|
||||
std::int64_t max_file_size_;
|
||||
|
||||
logStreamFile();
|
||||
|
||||
logStreamFile(std::string const &path_, std::int64_t max_file_size_);
|
||||
|
||||
static const std::int32_t ID = -1880085930;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class logStreamEmpty final : public LogStream {
|
||||
public:
|
||||
|
||||
logStreamEmpty();
|
||||
|
||||
static const std::int32_t ID = -499912244;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class logTags final : public Object {
|
||||
public:
|
||||
std::vector<std::string> tags_;
|
||||
|
||||
logTags();
|
||||
|
||||
explicit logTags(std::vector<std::string> &&tags_);
|
||||
|
||||
static const std::int32_t ID = -1604930601;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class logVerbosityLevel final : public Object {
|
||||
public:
|
||||
std::int32_t verbosity_level_;
|
||||
|
||||
logVerbosityLevel();
|
||||
|
||||
explicit logVerbosityLevel(std::int32_t verbosity_level_);
|
||||
|
||||
static const std::int32_t ID = 1734624234;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class ok final : public Object {
|
||||
public:
|
||||
|
||||
@ -244,14 +411,67 @@ class ok final : public Object {
|
||||
|
||||
class options final : public Object {
|
||||
public:
|
||||
std::string config_;
|
||||
std::string keystore_directory_;
|
||||
object_ptr<config> config_;
|
||||
object_ptr<KeyStoreType> keystore_type_;
|
||||
|
||||
options();
|
||||
|
||||
options(std::string const &config_, std::string const &keystore_directory_);
|
||||
options(object_ptr<config> &&config_, object_ptr<KeyStoreType> &&keystore_type_);
|
||||
|
||||
static const std::int32_t ID = -876766471;
|
||||
static const std::int32_t ID = -1924388359;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class sendGramsResult final : public Object {
|
||||
public:
|
||||
std::int64_t sent_until_;
|
||||
std::string body_hash_;
|
||||
|
||||
sendGramsResult();
|
||||
|
||||
sendGramsResult(std::int64_t sent_until_, std::string const &body_hash_);
|
||||
|
||||
static const std::int32_t ID = 426872238;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class unpackedAccountAddress final : public Object {
|
||||
public:
|
||||
std::int32_t workchain_id_;
|
||||
bool bounceable_;
|
||||
bool testnet_;
|
||||
std::string addr_;
|
||||
|
||||
unpackedAccountAddress();
|
||||
|
||||
unpackedAccountAddress(std::int32_t workchain_id_, bool bounceable_, bool testnet_, std::string const &addr_);
|
||||
|
||||
static const std::int32_t ID = 1892946998;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class updateSendLiteServerQuery final : public Object {
|
||||
public:
|
||||
std::int64_t id_;
|
||||
std::string data_;
|
||||
|
||||
updateSendLiteServerQuery();
|
||||
|
||||
updateSendLiteServerQuery(std::int64_t id_, std::string const &data_);
|
||||
|
||||
static const std::int32_t ID = -1555130916;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
@ -295,6 +515,22 @@ class generic_accountStateTestWallet final : public generic_AccountState {
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class generic_accountStateWallet final : public generic_AccountState {
|
||||
public:
|
||||
object_ptr<wallet_accountState> account_state_;
|
||||
|
||||
generic_accountStateWallet();
|
||||
|
||||
explicit generic_accountStateWallet(object_ptr<wallet_accountState> &&account_state_);
|
||||
|
||||
static const std::int32_t ID = 942582925;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class generic_accountStateTestGiver final : public generic_AccountState {
|
||||
public:
|
||||
object_ptr<testGiver_accountState> account_state_;
|
||||
@ -327,42 +563,6 @@ class generic_accountStateUninited final : public generic_AccountState {
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class generic_InitialAccountState: public Object {
|
||||
public:
|
||||
};
|
||||
|
||||
class generic_initialAccountStateRaw final : public generic_InitialAccountState {
|
||||
public:
|
||||
object_ptr<raw_initialAccountState> initital_account_state_;
|
||||
|
||||
generic_initialAccountStateRaw();
|
||||
|
||||
explicit generic_initialAccountStateRaw(object_ptr<raw_initialAccountState> &&initital_account_state_);
|
||||
|
||||
static const std::int32_t ID = -1178429153;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class generic_initialAccountStateTestWallet final : public generic_InitialAccountState {
|
||||
public:
|
||||
object_ptr<testWallet_initialAccountState> initital_account_state_;
|
||||
|
||||
generic_initialAccountStateTestWallet();
|
||||
|
||||
explicit generic_initialAccountStateTestWallet(object_ptr<testWallet_initialAccountState> &&initital_account_state_);
|
||||
|
||||
static const std::int32_t ID = 710924204;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class internal_transactionId final : public Object {
|
||||
public:
|
||||
std::int64_t lt_;
|
||||
@ -386,12 +586,14 @@ class raw_accountState final : public Object {
|
||||
std::string code_;
|
||||
std::string data_;
|
||||
object_ptr<internal_transactionId> last_transaction_id_;
|
||||
std::string frozen_hash_;
|
||||
std::int64_t sync_utime_;
|
||||
|
||||
raw_accountState();
|
||||
|
||||
raw_accountState(std::int64_t balance_, std::string const &code_, std::string const &data_, object_ptr<internal_transactionId> &&last_transaction_id_);
|
||||
raw_accountState(std::int64_t balance_, std::string const &code_, std::string const &data_, object_ptr<internal_transactionId> &&last_transaction_id_, std::string const &frozen_hash_, std::int64_t sync_utime_);
|
||||
|
||||
static const std::int32_t ID = -550396199;
|
||||
static const std::int32_t ID = 1205935434;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
@ -421,12 +623,17 @@ class raw_message final : public Object {
|
||||
std::string source_;
|
||||
std::string destination_;
|
||||
std::int64_t value_;
|
||||
std::int64_t fwd_fee_;
|
||||
std::int64_t ihr_fee_;
|
||||
std::int64_t created_lt_;
|
||||
std::string body_hash_;
|
||||
std::string message_;
|
||||
|
||||
raw_message();
|
||||
|
||||
raw_message(std::string const &source_, std::string const &destination_, std::int64_t value_);
|
||||
raw_message(std::string const &source_, std::string const &destination_, std::int64_t value_, std::int64_t fwd_fee_, std::int64_t ihr_fee_, std::int64_t created_lt_, std::string const &body_hash_, std::string const &message_);
|
||||
|
||||
static const std::int32_t ID = -1131081640;
|
||||
static const std::int32_t ID = -906281442;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
@ -436,17 +643,20 @@ class raw_message final : public Object {
|
||||
|
||||
class raw_transaction final : public Object {
|
||||
public:
|
||||
std::int64_t utime_;
|
||||
std::string data_;
|
||||
object_ptr<internal_transactionId> previous_transaction_id_;
|
||||
object_ptr<internal_transactionId> transaction_id_;
|
||||
std::int64_t fee_;
|
||||
std::int64_t storage_fee_;
|
||||
std::int64_t other_fee_;
|
||||
object_ptr<raw_message> in_msg_;
|
||||
std::vector<object_ptr<raw_message>> out_msgs_;
|
||||
|
||||
raw_transaction();
|
||||
|
||||
raw_transaction(std::string const &data_, object_ptr<internal_transactionId> &&previous_transaction_id_, std::int64_t fee_, object_ptr<raw_message> &&in_msg_, std::vector<object_ptr<raw_message>> &&out_msgs_);
|
||||
raw_transaction(std::int64_t utime_, std::string const &data_, object_ptr<internal_transactionId> &&transaction_id_, std::int64_t fee_, std::int64_t storage_fee_, std::int64_t other_fee_, object_ptr<raw_message> &&in_msg_, std::vector<object_ptr<raw_message>> &&out_msgs_);
|
||||
|
||||
static const std::int32_t ID = -463758736;
|
||||
static const std::int32_t ID = 1887601793;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
@ -457,12 +667,13 @@ class raw_transaction final : public Object {
|
||||
class raw_transactions final : public Object {
|
||||
public:
|
||||
std::vector<object_ptr<raw_transaction>> transactions_;
|
||||
object_ptr<internal_transactionId> previous_transaction_id_;
|
||||
|
||||
raw_transactions();
|
||||
|
||||
explicit raw_transactions(std::vector<object_ptr<raw_transaction>> &&transactions_);
|
||||
raw_transactions(std::vector<object_ptr<raw_transaction>> &&transactions_, object_ptr<internal_transactionId> &&previous_transaction_id_);
|
||||
|
||||
static const std::int32_t ID = -442987753;
|
||||
static const std::int32_t ID = -2063931155;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
@ -475,12 +686,13 @@ class testGiver_accountState final : public Object {
|
||||
std::int64_t balance_;
|
||||
std::int32_t seqno_;
|
||||
object_ptr<internal_transactionId> last_transaction_id_;
|
||||
std::int64_t sync_utime_;
|
||||
|
||||
testGiver_accountState();
|
||||
|
||||
testGiver_accountState(std::int64_t balance_, std::int32_t seqno_, object_ptr<internal_transactionId> &&last_transaction_id_);
|
||||
testGiver_accountState(std::int64_t balance_, std::int32_t seqno_, object_ptr<internal_transactionId> &&last_transaction_id_, std::int64_t sync_utime_);
|
||||
|
||||
static const std::int32_t ID = 2037609684;
|
||||
static const std::int32_t ID = 860930426;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
@ -493,12 +705,13 @@ class testWallet_accountState final : public Object {
|
||||
std::int64_t balance_;
|
||||
std::int32_t seqno_;
|
||||
object_ptr<internal_transactionId> last_transaction_id_;
|
||||
std::int64_t sync_utime_;
|
||||
|
||||
testWallet_accountState();
|
||||
|
||||
testWallet_accountState(std::int64_t balance_, std::int32_t seqno_, object_ptr<internal_transactionId> &&last_transaction_id_);
|
||||
testWallet_accountState(std::int64_t balance_, std::int32_t seqno_, object_ptr<internal_transactionId> &&last_transaction_id_, std::int64_t sync_utime_);
|
||||
|
||||
static const std::int32_t ID = 105752218;
|
||||
static const std::int32_t ID = 305698744;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
@ -525,12 +738,15 @@ class testWallet_initialAccountState final : public Object {
|
||||
class uninited_accountState final : public Object {
|
||||
public:
|
||||
std::int64_t balance_;
|
||||
object_ptr<internal_transactionId> last_transaction_id_;
|
||||
std::string frozen_hash_;
|
||||
std::int64_t sync_utime_;
|
||||
|
||||
uninited_accountState();
|
||||
|
||||
explicit uninited_accountState(std::int64_t balance_);
|
||||
uninited_accountState(std::int64_t balance_, object_ptr<internal_transactionId> &&last_transaction_id_, std::string const &frozen_hash_, std::int64_t sync_utime_);
|
||||
|
||||
static const std::int32_t ID = -1992757598;
|
||||
static const std::int32_t ID = -918880075;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
@ -538,6 +754,60 @@ class uninited_accountState final : public Object {
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class wallet_accountState final : public Object {
|
||||
public:
|
||||
std::int64_t balance_;
|
||||
std::int32_t seqno_;
|
||||
object_ptr<internal_transactionId> last_transaction_id_;
|
||||
std::int64_t sync_utime_;
|
||||
|
||||
wallet_accountState();
|
||||
|
||||
wallet_accountState(std::int64_t balance_, std::int32_t seqno_, object_ptr<internal_transactionId> &&last_transaction_id_, std::int64_t sync_utime_);
|
||||
|
||||
static const std::int32_t ID = -1919815977;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class wallet_initialAccountState final : public Object {
|
||||
public:
|
||||
std::string public_key_;
|
||||
|
||||
wallet_initialAccountState();
|
||||
|
||||
explicit wallet_initialAccountState(std::string const &public_key_);
|
||||
|
||||
static const std::int32_t ID = -1079249978;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class addLogMessage final : public Function {
|
||||
public:
|
||||
std::int32_t verbosity_level_;
|
||||
std::string text_;
|
||||
|
||||
addLogMessage();
|
||||
|
||||
addLogMessage(std::int32_t verbosity_level_, std::string const &text_);
|
||||
|
||||
static const std::int32_t ID = 1597427692;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<ok>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class changeLocalPassword final : public Function {
|
||||
public:
|
||||
object_ptr<inputKey> input_key_;
|
||||
@ -592,15 +862,31 @@ class createNewKey final : public Function {
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class deleteKey final : public Function {
|
||||
class decrypt final : public Function {
|
||||
public:
|
||||
std::string public_key_;
|
||||
td::SecureString encrypted_data_;
|
||||
td::SecureString secret_;
|
||||
|
||||
deleteKey();
|
||||
decrypt();
|
||||
|
||||
explicit deleteKey(std::string const &public_key_);
|
||||
decrypt(td::SecureString &&encrypted_data_, td::SecureString &&secret_);
|
||||
|
||||
static const std::int32_t ID = 917647652;
|
||||
static const std::int32_t ID = 357991854;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<data>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class deleteAllKeys final : public Function {
|
||||
public:
|
||||
|
||||
deleteAllKeys();
|
||||
|
||||
static const std::int32_t ID = 1608776483;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
@ -610,6 +896,43 @@ class deleteKey final : public Function {
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class deleteKey final : public Function {
|
||||
public:
|
||||
object_ptr<key> key_;
|
||||
|
||||
deleteKey();
|
||||
|
||||
explicit deleteKey(object_ptr<key> &&key_);
|
||||
|
||||
static const std::int32_t ID = -1579595571;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<ok>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class encrypt final : public Function {
|
||||
public:
|
||||
td::SecureString decrypted_data_;
|
||||
td::SecureString secret_;
|
||||
|
||||
encrypt();
|
||||
|
||||
encrypt(td::SecureString &&decrypted_data_, td::SecureString &&secret_);
|
||||
|
||||
static const std::int32_t ID = -1821422820;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<data>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class exportEncryptedKey final : public Function {
|
||||
public:
|
||||
object_ptr<inputKey> input_key_;
|
||||
@ -690,17 +1013,20 @@ class generic_sendGrams final : public Function {
|
||||
object_ptr<accountAddress> source_;
|
||||
object_ptr<accountAddress> destination_;
|
||||
std::int64_t amount_;
|
||||
std::int32_t timeout_;
|
||||
bool allow_send_to_uninited_;
|
||||
std::string message_;
|
||||
|
||||
generic_sendGrams();
|
||||
|
||||
generic_sendGrams(object_ptr<inputKey> &&private_key_, object_ptr<accountAddress> &&source_, object_ptr<accountAddress> &&destination_, std::int64_t amount_);
|
||||
generic_sendGrams(object_ptr<inputKey> &&private_key_, object_ptr<accountAddress> &&source_, object_ptr<accountAddress> &&destination_, std::int64_t amount_, std::int32_t timeout_, bool allow_send_to_uninited_, std::string const &message_);
|
||||
|
||||
static const std::int32_t ID = 799772985;
|
||||
static const std::int32_t ID = -758801136;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<ok>;
|
||||
using ReturnType = object_ptr<sendGramsResult>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
@ -723,6 +1049,69 @@ class getBip39Hints final : public Function {
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class getLogStream final : public Function {
|
||||
public:
|
||||
|
||||
getLogStream();
|
||||
|
||||
static const std::int32_t ID = 1167608667;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<LogStream>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class getLogTagVerbosityLevel final : public Function {
|
||||
public:
|
||||
std::string tag_;
|
||||
|
||||
getLogTagVerbosityLevel();
|
||||
|
||||
explicit getLogTagVerbosityLevel(std::string const &tag_);
|
||||
|
||||
static const std::int32_t ID = 951004547;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<logVerbosityLevel>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class getLogTags final : public Function {
|
||||
public:
|
||||
|
||||
getLogTags();
|
||||
|
||||
static const std::int32_t ID = -254449190;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<logTags>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class getLogVerbosityLevel final : public Function {
|
||||
public:
|
||||
|
||||
getLogVerbosityLevel();
|
||||
|
||||
static const std::int32_t ID = 594057956;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<logVerbosityLevel>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class importEncryptedKey final : public Function {
|
||||
public:
|
||||
td::SecureString local_password_;
|
||||
@ -801,15 +1190,36 @@ class init final : public Function {
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class options_setConfig final : public Function {
|
||||
class kdf final : public Function {
|
||||
public:
|
||||
std::string config_;
|
||||
td::SecureString password_;
|
||||
td::SecureString salt_;
|
||||
std::int32_t iterations_;
|
||||
|
||||
options_setConfig();
|
||||
kdf();
|
||||
|
||||
explicit options_setConfig(std::string const &config_);
|
||||
kdf(td::SecureString &&password_, td::SecureString &&salt_, std::int32_t iterations_);
|
||||
|
||||
static const std::int32_t ID = 21225546;
|
||||
static const std::int32_t ID = -1667861635;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<data>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class onLiteServerQueryError final : public Function {
|
||||
public:
|
||||
std::int64_t id_;
|
||||
object_ptr<error> error_;
|
||||
|
||||
onLiteServerQueryError();
|
||||
|
||||
onLiteServerQueryError(std::int64_t id_, object_ptr<error> &&error_);
|
||||
|
||||
static const std::int32_t ID = -677427533;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
@ -819,6 +1229,61 @@ class options_setConfig final : public Function {
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class onLiteServerQueryResult final : public Function {
|
||||
public:
|
||||
std::int64_t id_;
|
||||
std::string bytes_;
|
||||
|
||||
onLiteServerQueryResult();
|
||||
|
||||
onLiteServerQueryResult(std::int64_t id_, std::string const &bytes_);
|
||||
|
||||
static const std::int32_t ID = 2056444510;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<ok>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class options_setConfig final : public Function {
|
||||
public:
|
||||
object_ptr<config> config_;
|
||||
|
||||
options_setConfig();
|
||||
|
||||
explicit options_setConfig(object_ptr<config> &&config_);
|
||||
|
||||
static const std::int32_t ID = 646497241;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<ok>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class packAccountAddress final : public Function {
|
||||
public:
|
||||
object_ptr<unpackedAccountAddress> account_address_;
|
||||
|
||||
packAccountAddress();
|
||||
|
||||
explicit packAccountAddress(object_ptr<unpackedAccountAddress> &&account_address_);
|
||||
|
||||
static const std::int32_t ID = -1388561940;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<accountAddress>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class raw_getAccountAddress final : public Function {
|
||||
public:
|
||||
object_ptr<raw_initialAccountState> initital_account_state_;
|
||||
@ -912,6 +1377,61 @@ class runTests final : public Function {
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class setLogStream final : public Function {
|
||||
public:
|
||||
object_ptr<LogStream> log_stream_;
|
||||
|
||||
setLogStream();
|
||||
|
||||
explicit setLogStream(object_ptr<LogStream> &&log_stream_);
|
||||
|
||||
static const std::int32_t ID = -1364199535;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<ok>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class setLogTagVerbosityLevel final : public Function {
|
||||
public:
|
||||
std::string tag_;
|
||||
std::int32_t new_verbosity_level_;
|
||||
|
||||
setLogTagVerbosityLevel();
|
||||
|
||||
setLogTagVerbosityLevel(std::string const &tag_, std::int32_t new_verbosity_level_);
|
||||
|
||||
static const std::int32_t ID = -2095589738;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<ok>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class setLogVerbosityLevel final : public Function {
|
||||
public:
|
||||
std::int32_t new_verbosity_level_;
|
||||
|
||||
setLogVerbosityLevel();
|
||||
|
||||
explicit setLogVerbosityLevel(std::int32_t new_verbosity_level_);
|
||||
|
||||
static const std::int32_t ID = -303429678;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<ok>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class testGiver_getAccountAddress final : public Function {
|
||||
public:
|
||||
|
||||
@ -947,17 +1467,18 @@ class testGiver_sendGrams final : public Function {
|
||||
object_ptr<accountAddress> destination_;
|
||||
std::int32_t seqno_;
|
||||
std::int64_t amount_;
|
||||
std::string message_;
|
||||
|
||||
testGiver_sendGrams();
|
||||
|
||||
testGiver_sendGrams(object_ptr<accountAddress> &&destination_, std::int32_t seqno_, std::int64_t amount_);
|
||||
testGiver_sendGrams(object_ptr<accountAddress> &&destination_, std::int32_t seqno_, std::int64_t amount_, std::string const &message_);
|
||||
|
||||
static const std::int32_t ID = -178493799;
|
||||
static const std::int32_t ID = -1785750375;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<ok>;
|
||||
using ReturnType = object_ptr<sendGramsResult>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
@ -1022,12 +1543,85 @@ class testWallet_sendGrams final : public Function {
|
||||
object_ptr<accountAddress> destination_;
|
||||
std::int32_t seqno_;
|
||||
std::int64_t amount_;
|
||||
std::string message_;
|
||||
|
||||
testWallet_sendGrams();
|
||||
|
||||
testWallet_sendGrams(object_ptr<inputKey> &&private_key_, object_ptr<accountAddress> &&destination_, std::int32_t seqno_, std::int64_t amount_);
|
||||
testWallet_sendGrams(object_ptr<inputKey> &&private_key_, object_ptr<accountAddress> &&destination_, std::int32_t seqno_, std::int64_t amount_, std::string const &message_);
|
||||
|
||||
static const std::int32_t ID = -1716705044;
|
||||
static const std::int32_t ID = 1290131585;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<sendGramsResult>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class unpackAccountAddress final : public Function {
|
||||
public:
|
||||
std::string account_address_;
|
||||
|
||||
unpackAccountAddress();
|
||||
|
||||
explicit unpackAccountAddress(std::string const &account_address_);
|
||||
|
||||
static const std::int32_t ID = -682459063;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<unpackedAccountAddress>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class wallet_getAccountAddress final : public Function {
|
||||
public:
|
||||
object_ptr<wallet_initialAccountState> initital_account_state_;
|
||||
|
||||
wallet_getAccountAddress();
|
||||
|
||||
explicit wallet_getAccountAddress(object_ptr<wallet_initialAccountState> &&initital_account_state_);
|
||||
|
||||
static const std::int32_t ID = -1004103180;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<accountAddress>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class wallet_getAccountState final : public Function {
|
||||
public:
|
||||
object_ptr<accountAddress> account_address_;
|
||||
|
||||
wallet_getAccountState();
|
||||
|
||||
explicit wallet_getAccountState(object_ptr<accountAddress> &&account_address_);
|
||||
|
||||
static const std::int32_t ID = 462294850;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<wallet_accountState>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class wallet_init final : public Function {
|
||||
public:
|
||||
object_ptr<inputKey> private_key_;
|
||||
|
||||
wallet_init();
|
||||
|
||||
explicit wallet_init(object_ptr<inputKey> &&private_key_);
|
||||
|
||||
static const std::int32_t ID = 1528056782;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
@ -1037,5 +1631,28 @@ class testWallet_sendGrams final : public Function {
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
class wallet_sendGrams final : public Function {
|
||||
public:
|
||||
object_ptr<inputKey> private_key_;
|
||||
object_ptr<accountAddress> destination_;
|
||||
std::int32_t seqno_;
|
||||
std::int64_t valid_until_;
|
||||
std::int64_t amount_;
|
||||
std::string message_;
|
||||
|
||||
wallet_sendGrams();
|
||||
|
||||
wallet_sendGrams(object_ptr<inputKey> &&private_key_, object_ptr<accountAddress> &&destination_, std::int32_t seqno_, std::int64_t valid_until_, std::int64_t amount_, std::string const &message_);
|
||||
|
||||
static const std::int32_t ID = -1837893526;
|
||||
std::int32_t get_id() const final {
|
||||
return ID;
|
||||
}
|
||||
|
||||
using ReturnType = object_ptr<sendGramsResult>;
|
||||
|
||||
void store(td::TlStorerToString &s, const char *field_name) const final;
|
||||
};
|
||||
|
||||
} // namespace tonlib_api
|
||||
} // namespace ton
|
||||
|
BIN
submodules/MtProtoKit/TON/macOS/lib/libadnllite.a
Normal file
BIN
submodules/MtProtoKit/TON/macOS/lib/libadnllite.a
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
submodules/MtProtoKit/TON/macOS/lib/libtl_api.a
Normal file
BIN
submodules/MtProtoKit/TON/macOS/lib/libtl_api.a
Normal file
Binary file not shown.
BIN
submodules/MtProtoKit/TON/macOS/lib/libtl_lite_api.a
Normal file
BIN
submodules/MtProtoKit/TON/macOS/lib/libtl_lite_api.a
Normal file
Binary file not shown.
BIN
submodules/MtProtoKit/TON/macOS/lib/libtl_tonlib_api.a
Normal file
BIN
submodules/MtProtoKit/TON/macOS/lib/libtl_tonlib_api.a
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
submodules/MtProtoKit/TON/macOS/lib/libtonlib.a
Normal file
BIN
submodules/MtProtoKit/TON/macOS/lib/libtonlib.a
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,52 +1,10 @@
|
||||
/* crypto/aes/aes.h */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* openssl-core@openssl.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
/*
|
||||
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_AES_H
|
||||
@ -54,11 +12,10 @@
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifdef OPENSSL_NO_AES
|
||||
# error AES is disabled.
|
||||
# endif
|
||||
|
||||
# include <stddef.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# define AES_ENCRYPT 1
|
||||
# define AES_DECRYPT 0
|
||||
@ -70,10 +27,6 @@
|
||||
# define AES_MAXNR 14
|
||||
# define AES_BLOCK_SIZE 16
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This should be a hidden type, but EVP requires that the size be known */
|
||||
struct aes_key_st {
|
||||
# ifdef AES_LONG
|
||||
@ -92,11 +45,6 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key);
|
||||
|
||||
int private_AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key);
|
||||
int private_AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key);
|
||||
|
||||
void AES_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key);
|
||||
void AES_decrypt(const unsigned char *in, unsigned char *out,
|
||||
@ -119,11 +67,6 @@ void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
|
||||
void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num);
|
||||
void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char ivec[AES_BLOCK_SIZE],
|
||||
unsigned char ecount_buf[AES_BLOCK_SIZE],
|
||||
unsigned int *num);
|
||||
/* NB: the IV is _two_ blocks long */
|
||||
void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
@ -142,8 +85,8 @@ int AES_unwrap_key(AES_KEY *key, const unsigned char *iv,
|
||||
const unsigned char *in, unsigned int inlen);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#endif /* !HEADER_AES_H */
|
||||
#endif
|
||||
|
@ -1,59 +1,10 @@
|
||||
/* crypto/asn1/asn1.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_ASN1_H
|
||||
@ -61,16 +12,14 @@
|
||||
|
||||
# include <time.h>
|
||||
# include <openssl/e_os2.h>
|
||||
# ifndef OPENSSL_NO_BIO
|
||||
# include <openssl/bio.h>
|
||||
# endif
|
||||
# include <openssl/stack.h>
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/safestack.h>
|
||||
|
||||
# include <openssl/asn1err.h>
|
||||
# include <openssl/symhacks.h>
|
||||
|
||||
# include <openssl/ossl_typ.h>
|
||||
# ifndef OPENSSL_NO_DEPRECATED
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# include <openssl/bn.h>
|
||||
# endif
|
||||
|
||||
@ -90,19 +39,17 @@ extern "C" {
|
||||
|
||||
# define V_ASN1_CONSTRUCTED 0x20
|
||||
# define V_ASN1_PRIMITIVE_TAG 0x1f
|
||||
# define V_ASN1_PRIMATIVE_TAG 0x1f
|
||||
# define V_ASN1_PRIMATIVE_TAG /*compat*/ V_ASN1_PRIMITIVE_TAG
|
||||
|
||||
# define V_ASN1_APP_CHOOSE -2/* let the recipient choose */
|
||||
# define V_ASN1_OTHER -3/* used in ASN1_TYPE */
|
||||
# define V_ASN1_ANY -4/* used in ASN1 template code */
|
||||
|
||||
# define V_ASN1_NEG 0x100/* negative flag */
|
||||
|
||||
# define V_ASN1_UNDEF -1
|
||||
/* ASN.1 tag values */
|
||||
# define V_ASN1_EOC 0
|
||||
# define V_ASN1_BOOLEAN 1 /**/
|
||||
# define V_ASN1_INTEGER 2
|
||||
# define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG)
|
||||
# define V_ASN1_BIT_STRING 3
|
||||
# define V_ASN1_OCTET_STRING 4
|
||||
# define V_ASN1_NULL 5
|
||||
@ -111,7 +58,6 @@ extern "C" {
|
||||
# define V_ASN1_EXTERNAL 8
|
||||
# define V_ASN1_REAL 9
|
||||
# define V_ASN1_ENUMERATED 10
|
||||
# define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG)
|
||||
# define V_ASN1_UTF8STRING 12
|
||||
# define V_ASN1_SEQUENCE 16
|
||||
# define V_ASN1_SET 17
|
||||
@ -129,6 +75,17 @@ extern "C" {
|
||||
# define V_ASN1_GENERALSTRING 27 /**/
|
||||
# define V_ASN1_UNIVERSALSTRING 28 /**/
|
||||
# define V_ASN1_BMPSTRING 30
|
||||
|
||||
/*
|
||||
* NB the constants below are used internally by ASN1_INTEGER
|
||||
* and ASN1_ENUMERATED to indicate the sign. They are *not* on
|
||||
* the wire tag values.
|
||||
*/
|
||||
|
||||
# define V_ASN1_NEG 0x100
|
||||
# define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG)
|
||||
# define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG)
|
||||
|
||||
/* For use with d2i_ASN1_type_bytes() */
|
||||
# define B_ASN1_NUMERICSTRING 0x0001
|
||||
# define B_ASN1_PRINTABLESTRING 0x0002
|
||||
@ -159,61 +116,7 @@ extern "C" {
|
||||
# define SMIME_CRLFEOL 0x800
|
||||
# define SMIME_STREAM 0x1000
|
||||
struct X509_algor_st;
|
||||
DECLARE_STACK_OF(X509_ALGOR)
|
||||
|
||||
# define DECLARE_ASN1_SET_OF(type)/* filled in by mkstack.pl */
|
||||
# define IMPLEMENT_ASN1_SET_OF(type)/* nothing, no longer needed */
|
||||
|
||||
/*
|
||||
* We MUST make sure that, except for constness, asn1_ctx_st and
|
||||
* asn1_const_ctx are exactly the same. Fortunately, as soon as the old ASN1
|
||||
* parsing macros are gone, we can throw this away as well...
|
||||
*/
|
||||
typedef struct asn1_ctx_st {
|
||||
unsigned char *p; /* work char pointer */
|
||||
int eos; /* end of sequence read for indefinite
|
||||
* encoding */
|
||||
int error; /* error code to use when returning an error */
|
||||
int inf; /* constructed if 0x20, indefinite is 0x21 */
|
||||
int tag; /* tag from last 'get object' */
|
||||
int xclass; /* class from last 'get object' */
|
||||
long slen; /* length of last 'get object' */
|
||||
unsigned char *max; /* largest value of p allowed */
|
||||
unsigned char *q; /* temporary variable */
|
||||
unsigned char **pp; /* variable */
|
||||
int line; /* used in error processing */
|
||||
} ASN1_CTX;
|
||||
|
||||
typedef struct asn1_const_ctx_st {
|
||||
const unsigned char *p; /* work char pointer */
|
||||
int eos; /* end of sequence read for indefinite
|
||||
* encoding */
|
||||
int error; /* error code to use when returning an error */
|
||||
int inf; /* constructed if 0x20, indefinite is 0x21 */
|
||||
int tag; /* tag from last 'get object' */
|
||||
int xclass; /* class from last 'get object' */
|
||||
long slen; /* length of last 'get object' */
|
||||
const unsigned char *max; /* largest value of p allowed */
|
||||
const unsigned char *q; /* temporary variable */
|
||||
const unsigned char **pp; /* variable */
|
||||
int line; /* used in error processing */
|
||||
} ASN1_const_CTX;
|
||||
|
||||
/*
|
||||
* These are used internally in the ASN1_OBJECT to keep track of whether the
|
||||
* names and data need to be free()ed
|
||||
*/
|
||||
# define ASN1_OBJECT_FLAG_DYNAMIC 0x01/* internal use */
|
||||
# define ASN1_OBJECT_FLAG_CRITICAL 0x02/* critical x509v3 object id */
|
||||
# define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04/* internal use */
|
||||
# define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08/* internal use */
|
||||
struct asn1_object_st {
|
||||
const char *sn, *ln;
|
||||
int nid;
|
||||
int length;
|
||||
const unsigned char *data; /* data remains const after init */
|
||||
int flags; /* Should we free this one */
|
||||
};
|
||||
DEFINE_STACK_OF(X509_ALGOR)
|
||||
|
||||
# define ASN1_STRING_FLAG_BITS_LEFT 0x08/* Set if 0x07 has bits left value */
|
||||
/*
|
||||
@ -235,6 +138,10 @@ struct asn1_object_st {
|
||||
* type.
|
||||
*/
|
||||
# define ASN1_STRING_FLAG_MSTRING 0x040
|
||||
/* String is embedded and only content should be freed */
|
||||
# define ASN1_STRING_FLAG_EMBED 0x080
|
||||
/* String should be parsed in RFC 5280's time format */
|
||||
# define ASN1_STRING_FLAG_X509_TIME 0x100
|
||||
/* This is the base type that holds just about everything :-) */
|
||||
struct asn1_string_st {
|
||||
int length;
|
||||
@ -264,6 +171,13 @@ typedef struct ASN1_ENCODING_st {
|
||||
# define ASN1_LONG_UNDEF 0x7fffffffL
|
||||
|
||||
# define STABLE_FLAGS_MALLOC 0x01
|
||||
/*
|
||||
* A zero passed to ASN1_STRING_TABLE_new_add for the flags is interpreted
|
||||
* as "don't change" and STABLE_FLAGS_MALLOC is always set. By setting
|
||||
* STABLE_FLAGS_MALLOC only we can clear the existing value. Use the alias
|
||||
* STABLE_FLAGS_CLEAR to reflect this.
|
||||
*/
|
||||
# define STABLE_FLAGS_CLEAR STABLE_FLAGS_MALLOC
|
||||
# define STABLE_NO_MASK 0x02
|
||||
# define DIRSTRING_TYPE \
|
||||
(B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING)
|
||||
@ -277,7 +191,7 @@ typedef struct asn1_string_table_st {
|
||||
unsigned long flags;
|
||||
} ASN1_STRING_TABLE;
|
||||
|
||||
DECLARE_STACK_OF(ASN1_STRING_TABLE)
|
||||
DEFINE_STACK_OF(ASN1_STRING_TABLE)
|
||||
|
||||
/* size limits: this stuff is taken straight from RFC2459 */
|
||||
|
||||
@ -504,6 +418,11 @@ typedef const ASN1_ITEM *ASN1_ITEM_EXP (void);
|
||||
|
||||
# define ASN1_STRFLGS_DUMP_DER 0x200
|
||||
|
||||
/*
|
||||
* This flag specifies that RC2254 escaping shall be performed.
|
||||
*/
|
||||
#define ASN1_STRFLGS_ESC_2254 0x400
|
||||
|
||||
/*
|
||||
* All the string flags consistent with RFC2253, escaping control characters
|
||||
* isn't essential in RFC2253 but it is advisable anyway.
|
||||
@ -516,10 +435,11 @@ typedef const ASN1_ITEM *ASN1_ITEM_EXP (void);
|
||||
ASN1_STRFLGS_DUMP_UNKNOWN | \
|
||||
ASN1_STRFLGS_DUMP_DER)
|
||||
|
||||
DECLARE_STACK_OF(ASN1_INTEGER)
|
||||
DECLARE_ASN1_SET_OF(ASN1_INTEGER)
|
||||
DEFINE_STACK_OF(ASN1_INTEGER)
|
||||
|
||||
DECLARE_STACK_OF(ASN1_GENERALSTRING)
|
||||
DEFINE_STACK_OF(ASN1_GENERALSTRING)
|
||||
|
||||
DEFINE_STACK_OF(ASN1_UTF8STRING)
|
||||
|
||||
typedef struct asn1_type_st {
|
||||
int type;
|
||||
@ -552,19 +472,13 @@ typedef struct asn1_type_st {
|
||||
} value;
|
||||
} ASN1_TYPE;
|
||||
|
||||
DECLARE_STACK_OF(ASN1_TYPE)
|
||||
DECLARE_ASN1_SET_OF(ASN1_TYPE)
|
||||
DEFINE_STACK_OF(ASN1_TYPE)
|
||||
|
||||
typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY;
|
||||
|
||||
DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY)
|
||||
DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY)
|
||||
|
||||
typedef struct NETSCAPE_X509_st {
|
||||
ASN1_OCTET_STRING *header;
|
||||
X509 *cert;
|
||||
} NETSCAPE_X509;
|
||||
|
||||
/* This is used to contain a list of bit names */
|
||||
typedef struct BIT_STRING_BITNAME_st {
|
||||
int bitnum;
|
||||
@ -572,50 +486,6 @@ typedef struct BIT_STRING_BITNAME_st {
|
||||
const char *sname;
|
||||
} BIT_STRING_BITNAME;
|
||||
|
||||
# define M_ASN1_STRING_length(x) ((x)->length)
|
||||
# define M_ASN1_STRING_length_set(x, n) ((x)->length = (n))
|
||||
# define M_ASN1_STRING_type(x) ((x)->type)
|
||||
# define M_ASN1_STRING_data(x) ((x)->data)
|
||||
|
||||
/* Macros for string operations */
|
||||
# define M_ASN1_BIT_STRING_new() (ASN1_BIT_STRING *)\
|
||||
ASN1_STRING_type_new(V_ASN1_BIT_STRING)
|
||||
# define M_ASN1_BIT_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
|
||||
# define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\
|
||||
ASN1_STRING_dup((const ASN1_STRING *)a)
|
||||
# define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\
|
||||
(const ASN1_STRING *)a,(const ASN1_STRING *)b)
|
||||
# define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)
|
||||
|
||||
# define M_ASN1_INTEGER_new() (ASN1_INTEGER *)\
|
||||
ASN1_STRING_type_new(V_ASN1_INTEGER)
|
||||
# define M_ASN1_INTEGER_free(a) ASN1_STRING_free((ASN1_STRING *)a)
|
||||
# define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)\
|
||||
ASN1_STRING_dup((const ASN1_STRING *)a)
|
||||
# define M_ASN1_INTEGER_cmp(a,b) ASN1_STRING_cmp(\
|
||||
(const ASN1_STRING *)a,(const ASN1_STRING *)b)
|
||||
|
||||
# define M_ASN1_ENUMERATED_new() (ASN1_ENUMERATED *)\
|
||||
ASN1_STRING_type_new(V_ASN1_ENUMERATED)
|
||||
# define M_ASN1_ENUMERATED_free(a) ASN1_STRING_free((ASN1_STRING *)a)
|
||||
# define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)\
|
||||
ASN1_STRING_dup((const ASN1_STRING *)a)
|
||||
# define M_ASN1_ENUMERATED_cmp(a,b) ASN1_STRING_cmp(\
|
||||
(const ASN1_STRING *)a,(const ASN1_STRING *)b)
|
||||
|
||||
# define M_ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\
|
||||
ASN1_STRING_type_new(V_ASN1_OCTET_STRING)
|
||||
# define M_ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
|
||||
# define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\
|
||||
ASN1_STRING_dup((const ASN1_STRING *)a)
|
||||
# define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\
|
||||
(const ASN1_STRING *)a,(const ASN1_STRING *)b)
|
||||
# define M_ASN1_OCTET_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)
|
||||
# define M_ASN1_OCTET_STRING_print(a,b) ASN1_STRING_print(a,(ASN1_STRING *)b)
|
||||
# define M_i2d_ASN1_OCTET_STRING(a,pp) \
|
||||
i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\
|
||||
V_ASN1_UNIVERSAL)
|
||||
|
||||
# define B_ASN1_TIME \
|
||||
B_ASN1_UTCTIME | \
|
||||
B_ASN1_GENERALIZEDTIME
|
||||
@ -645,153 +515,25 @@ typedef struct BIT_STRING_BITNAME_st {
|
||||
B_ASN1_BMPSTRING|\
|
||||
B_ASN1_UTF8STRING
|
||||
|
||||
# define M_ASN1_PRINTABLE_new() ASN1_STRING_type_new(V_ASN1_T61STRING)
|
||||
# define M_ASN1_PRINTABLE_free(a) ASN1_STRING_free((ASN1_STRING *)a)
|
||||
# define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
|
||||
pp,a->type,V_ASN1_UNIVERSAL)
|
||||
# define M_d2i_ASN1_PRINTABLE(a,pp,l) \
|
||||
d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
|
||||
B_ASN1_PRINTABLE)
|
||||
|
||||
# define M_DIRECTORYSTRING_new() ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)
|
||||
# define M_DIRECTORYSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
|
||||
# define M_i2d_DIRECTORYSTRING(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
|
||||
pp,a->type,V_ASN1_UNIVERSAL)
|
||||
# define M_d2i_DIRECTORYSTRING(a,pp,l) \
|
||||
d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
|
||||
B_ASN1_DIRECTORYSTRING)
|
||||
|
||||
# define M_DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING)
|
||||
# define M_DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING *)a)
|
||||
# define M_i2d_DISPLAYTEXT(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
|
||||
pp,a->type,V_ASN1_UNIVERSAL)
|
||||
# define M_d2i_DISPLAYTEXT(a,pp,l) \
|
||||
d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
|
||||
B_ASN1_DISPLAYTEXT)
|
||||
|
||||
# define M_ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING *)\
|
||||
ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)
|
||||
# define M_ASN1_PRINTABLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
|
||||
# define M_i2d_ASN1_PRINTABLESTRING(a,pp) \
|
||||
i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_PRINTABLESTRING,\
|
||||
V_ASN1_UNIVERSAL)
|
||||
# define M_d2i_ASN1_PRINTABLESTRING(a,pp,l) \
|
||||
(ASN1_PRINTABLESTRING *)d2i_ASN1_type_bytes\
|
||||
((ASN1_STRING **)a,pp,l,B_ASN1_PRINTABLESTRING)
|
||||
|
||||
# define M_ASN1_T61STRING_new() (ASN1_T61STRING *)\
|
||||
ASN1_STRING_type_new(V_ASN1_T61STRING)
|
||||
# define M_ASN1_T61STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
|
||||
# define M_i2d_ASN1_T61STRING(a,pp) \
|
||||
i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_T61STRING,\
|
||||
V_ASN1_UNIVERSAL)
|
||||
# define M_d2i_ASN1_T61STRING(a,pp,l) \
|
||||
(ASN1_T61STRING *)d2i_ASN1_type_bytes\
|
||||
((ASN1_STRING **)a,pp,l,B_ASN1_T61STRING)
|
||||
|
||||
# define M_ASN1_IA5STRING_new() (ASN1_IA5STRING *)\
|
||||
ASN1_STRING_type_new(V_ASN1_IA5STRING)
|
||||
# define M_ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
|
||||
# define M_ASN1_IA5STRING_dup(a) \
|
||||
(ASN1_IA5STRING *)ASN1_STRING_dup((const ASN1_STRING *)a)
|
||||
# define M_i2d_ASN1_IA5STRING(a,pp) \
|
||||
i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\
|
||||
V_ASN1_UNIVERSAL)
|
||||
# define M_d2i_ASN1_IA5STRING(a,pp,l) \
|
||||
(ASN1_IA5STRING *)d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l,\
|
||||
B_ASN1_IA5STRING)
|
||||
|
||||
# define M_ASN1_UTCTIME_new() (ASN1_UTCTIME *)\
|
||||
ASN1_STRING_type_new(V_ASN1_UTCTIME)
|
||||
# define M_ASN1_UTCTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
|
||||
# define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)\
|
||||
ASN1_STRING_dup((const ASN1_STRING *)a)
|
||||
|
||||
# define M_ASN1_GENERALIZEDTIME_new() (ASN1_GENERALIZEDTIME *)\
|
||||
ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME)
|
||||
# define M_ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
|
||||
# define M_ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\
|
||||
(const ASN1_STRING *)a)
|
||||
|
||||
# define M_ASN1_TIME_new() (ASN1_TIME *)\
|
||||
ASN1_STRING_type_new(V_ASN1_UTCTIME)
|
||||
# define M_ASN1_TIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
|
||||
# define M_ASN1_TIME_dup(a) (ASN1_TIME *)\
|
||||
ASN1_STRING_dup((const ASN1_STRING *)a)
|
||||
|
||||
# define M_ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\
|
||||
ASN1_STRING_type_new(V_ASN1_GENERALSTRING)
|
||||
# define M_ASN1_GENERALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
|
||||
# define M_i2d_ASN1_GENERALSTRING(a,pp) \
|
||||
i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_GENERALSTRING,\
|
||||
V_ASN1_UNIVERSAL)
|
||||
# define M_d2i_ASN1_GENERALSTRING(a,pp,l) \
|
||||
(ASN1_GENERALSTRING *)d2i_ASN1_type_bytes\
|
||||
((ASN1_STRING **)a,pp,l,B_ASN1_GENERALSTRING)
|
||||
|
||||
# define M_ASN1_UNIVERSALSTRING_new() (ASN1_UNIVERSALSTRING *)\
|
||||
ASN1_STRING_type_new(V_ASN1_UNIVERSALSTRING)
|
||||
# define M_ASN1_UNIVERSALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
|
||||
# define M_i2d_ASN1_UNIVERSALSTRING(a,pp) \
|
||||
i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UNIVERSALSTRING,\
|
||||
V_ASN1_UNIVERSAL)
|
||||
# define M_d2i_ASN1_UNIVERSALSTRING(a,pp,l) \
|
||||
(ASN1_UNIVERSALSTRING *)d2i_ASN1_type_bytes\
|
||||
((ASN1_STRING **)a,pp,l,B_ASN1_UNIVERSALSTRING)
|
||||
|
||||
# define M_ASN1_BMPSTRING_new() (ASN1_BMPSTRING *)\
|
||||
ASN1_STRING_type_new(V_ASN1_BMPSTRING)
|
||||
# define M_ASN1_BMPSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
|
||||
# define M_i2d_ASN1_BMPSTRING(a,pp) \
|
||||
i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_BMPSTRING,\
|
||||
V_ASN1_UNIVERSAL)
|
||||
# define M_d2i_ASN1_BMPSTRING(a,pp,l) \
|
||||
(ASN1_BMPSTRING *)d2i_ASN1_type_bytes\
|
||||
((ASN1_STRING **)a,pp,l,B_ASN1_BMPSTRING)
|
||||
|
||||
# define M_ASN1_VISIBLESTRING_new() (ASN1_VISIBLESTRING *)\
|
||||
ASN1_STRING_type_new(V_ASN1_VISIBLESTRING)
|
||||
# define M_ASN1_VISIBLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
|
||||
# define M_i2d_ASN1_VISIBLESTRING(a,pp) \
|
||||
i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_VISIBLESTRING,\
|
||||
V_ASN1_UNIVERSAL)
|
||||
# define M_d2i_ASN1_VISIBLESTRING(a,pp,l) \
|
||||
(ASN1_VISIBLESTRING *)d2i_ASN1_type_bytes\
|
||||
((ASN1_STRING **)a,pp,l,B_ASN1_VISIBLESTRING)
|
||||
|
||||
# define M_ASN1_UTF8STRING_new() (ASN1_UTF8STRING *)\
|
||||
ASN1_STRING_type_new(V_ASN1_UTF8STRING)
|
||||
# define M_ASN1_UTF8STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
|
||||
# define M_i2d_ASN1_UTF8STRING(a,pp) \
|
||||
i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UTF8STRING,\
|
||||
V_ASN1_UNIVERSAL)
|
||||
# define M_d2i_ASN1_UTF8STRING(a,pp,l) \
|
||||
(ASN1_UTF8STRING *)d2i_ASN1_type_bytes\
|
||||
((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING)
|
||||
|
||||
/* for the is_set parameter to i2d_ASN1_SET */
|
||||
# define IS_SEQUENCE 0
|
||||
# define IS_SET 1
|
||||
|
||||
DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)
|
||||
|
||||
int ASN1_TYPE_get(ASN1_TYPE *a);
|
||||
int ASN1_TYPE_get(const ASN1_TYPE *a);
|
||||
void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
|
||||
int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);
|
||||
int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b);
|
||||
|
||||
ASN1_TYPE *ASN1_TYPE_pack_sequence(const ASN1_ITEM *it, void *s, ASN1_TYPE **t);
|
||||
void *ASN1_TYPE_unpack_sequence(const ASN1_ITEM *it, const ASN1_TYPE *t);
|
||||
|
||||
ASN1_OBJECT *ASN1_OBJECT_new(void);
|
||||
void ASN1_OBJECT_free(ASN1_OBJECT *a);
|
||||
int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp);
|
||||
ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
|
||||
long length);
|
||||
int i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp);
|
||||
ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
|
||||
long length);
|
||||
|
||||
DECLARE_ASN1_ITEM(ASN1_OBJECT)
|
||||
|
||||
DECLARE_STACK_OF(ASN1_OBJECT)
|
||||
DECLARE_ASN1_SET_OF(ASN1_OBJECT)
|
||||
DEFINE_STACK_OF(ASN1_OBJECT)
|
||||
|
||||
ASN1_STRING *ASN1_STRING_new(void);
|
||||
void ASN1_STRING_free(ASN1_STRING *a);
|
||||
@ -808,34 +550,24 @@ int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
|
||||
void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len);
|
||||
int ASN1_STRING_length(const ASN1_STRING *x);
|
||||
void ASN1_STRING_length_set(ASN1_STRING *x, int n);
|
||||
int ASN1_STRING_type(ASN1_STRING *x);
|
||||
unsigned char *ASN1_STRING_data(ASN1_STRING *x);
|
||||
int ASN1_STRING_type(const ASN1_STRING *x);
|
||||
DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x))
|
||||
const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x);
|
||||
|
||||
DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING)
|
||||
int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp);
|
||||
ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
|
||||
const unsigned char **pp, long length);
|
||||
int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length);
|
||||
int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
|
||||
int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
|
||||
int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
|
||||
unsigned char *flags, int flags_len);
|
||||
int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n);
|
||||
int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a,
|
||||
const unsigned char *flags, int flags_len);
|
||||
|
||||
# ifndef OPENSSL_NO_BIO
|
||||
int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
|
||||
BIT_STRING_BITNAME *tbl, int indent);
|
||||
# endif
|
||||
int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl);
|
||||
int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
|
||||
int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl);
|
||||
int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value,
|
||||
BIT_STRING_BITNAME *tbl);
|
||||
|
||||
int i2d_ASN1_BOOLEAN(int a, unsigned char **pp);
|
||||
int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, long length);
|
||||
|
||||
DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER)
|
||||
int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp);
|
||||
ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp,
|
||||
long length);
|
||||
ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
|
||||
long length);
|
||||
ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x);
|
||||
@ -849,9 +581,6 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
|
||||
int offset_day, long offset_sec);
|
||||
int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);
|
||||
int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);
|
||||
# if 0
|
||||
time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s);
|
||||
# endif
|
||||
|
||||
int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a);
|
||||
ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
|
||||
@ -860,6 +589,7 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
|
||||
time_t t, int offset_day,
|
||||
long offset_sec);
|
||||
int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str);
|
||||
|
||||
int ASN1_TIME_diff(int *pday, int *psec,
|
||||
const ASN1_TIME *from, const ASN1_TIME *to);
|
||||
|
||||
@ -896,59 +626,53 @@ DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF)
|
||||
ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t);
|
||||
ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t,
|
||||
int offset_day, long offset_sec);
|
||||
int ASN1_TIME_check(ASN1_TIME *t);
|
||||
ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME
|
||||
**out);
|
||||
int ASN1_TIME_check(const ASN1_TIME *t);
|
||||
ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t,
|
||||
ASN1_GENERALIZEDTIME **out);
|
||||
int ASN1_TIME_set_string(ASN1_TIME *s, const char *str);
|
||||
int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str);
|
||||
int ASN1_TIME_to_tm(const ASN1_TIME *s, struct tm *tm);
|
||||
int ASN1_TIME_normalize(ASN1_TIME *s);
|
||||
int ASN1_TIME_cmp_time_t(const ASN1_TIME *s, time_t t);
|
||||
int ASN1_TIME_compare(const ASN1_TIME *a, const ASN1_TIME *b);
|
||||
|
||||
int i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp,
|
||||
i2d_of_void *i2d, int ex_tag, int ex_class, int is_set);
|
||||
STACK_OF(OPENSSL_BLOCK) *d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a,
|
||||
const unsigned char **pp,
|
||||
long length, d2i_of_void *d2i,
|
||||
void (*free_func) (OPENSSL_BLOCK),
|
||||
int ex_tag, int ex_class);
|
||||
|
||||
# ifndef OPENSSL_NO_BIO
|
||||
int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a);
|
||||
int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a);
|
||||
int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size);
|
||||
int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a);
|
||||
int i2a_ASN1_ENUMERATED(BIO *bp, const ASN1_ENUMERATED *a);
|
||||
int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size);
|
||||
int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a);
|
||||
int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a);
|
||||
int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size);
|
||||
int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type);
|
||||
# endif
|
||||
int i2t_ASN1_OBJECT(char *buf, int buf_len, ASN1_OBJECT *a);
|
||||
int i2a_ASN1_STRING(BIO *bp, const ASN1_STRING *a, int type);
|
||||
int i2t_ASN1_OBJECT(char *buf, int buf_len, const ASN1_OBJECT *a);
|
||||
|
||||
int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num);
|
||||
ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len,
|
||||
const char *sn, const char *ln);
|
||||
|
||||
int ASN1_INTEGER_get_int64(int64_t *pr, const ASN1_INTEGER *a);
|
||||
int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r);
|
||||
int ASN1_INTEGER_get_uint64(uint64_t *pr, const ASN1_INTEGER *a);
|
||||
int ASN1_INTEGER_set_uint64(ASN1_INTEGER *a, uint64_t r);
|
||||
|
||||
int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
|
||||
long ASN1_INTEGER_get(const ASN1_INTEGER *a);
|
||||
ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai);
|
||||
BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn);
|
||||
|
||||
int ASN1_ENUMERATED_get_int64(int64_t *pr, const ASN1_ENUMERATED *a);
|
||||
int ASN1_ENUMERATED_set_int64(ASN1_ENUMERATED *a, int64_t r);
|
||||
|
||||
|
||||
int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);
|
||||
long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a);
|
||||
ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai);
|
||||
BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai, BIGNUM *bn);
|
||||
long ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a);
|
||||
ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai);
|
||||
BIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai, BIGNUM *bn);
|
||||
|
||||
/* General */
|
||||
/* given a string, return the correct type, max is the maximum length */
|
||||
int ASN1_PRINTABLE_type(const unsigned char *s, int max);
|
||||
|
||||
int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass);
|
||||
ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp,
|
||||
long length, int Ptag, int Pclass);
|
||||
unsigned long ASN1_tag2bit(int tag);
|
||||
/* type is one or more of the B_ASN1_ values. */
|
||||
ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, const unsigned char **pp,
|
||||
long length, int type);
|
||||
|
||||
/* PARSING */
|
||||
int asn1_Finish(ASN1_CTX *c);
|
||||
int asn1_const_Finish(ASN1_const_CTX *c);
|
||||
|
||||
/* SPECIALS */
|
||||
int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
|
||||
@ -981,7 +705,7 @@ void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
|
||||
# define M_ASN1_free_of(x, type) \
|
||||
ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type))
|
||||
|
||||
# ifndef OPENSSL_NO_FP_API
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
void *ASN1_d2i_fp(void *(*xnew) (void), d2i_of_void *d2i, FILE *in, void **x);
|
||||
|
||||
# define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \
|
||||
@ -1004,12 +728,11 @@ int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x);
|
||||
CHECKED_PTR_OF(const type, x)))
|
||||
|
||||
int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x);
|
||||
int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);
|
||||
int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str, unsigned long flags);
|
||||
# endif
|
||||
|
||||
int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in);
|
||||
int ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in);
|
||||
|
||||
# ifndef OPENSSL_NO_BIO
|
||||
void *ASN1_d2i_bio(void *(*xnew) (void), d2i_of_void *d2i, BIO *in, void **x);
|
||||
|
||||
# define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \
|
||||
@ -1036,42 +759,27 @@ int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a);
|
||||
int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a);
|
||||
int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a);
|
||||
int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v);
|
||||
int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags);
|
||||
int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags);
|
||||
int ASN1_buf_print(BIO *bp, const unsigned char *buf, size_t buflen, int off);
|
||||
int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,
|
||||
unsigned char *buf, int off);
|
||||
int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent);
|
||||
int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent,
|
||||
int dump);
|
||||
# endif
|
||||
const char *ASN1_tag2str(int tag);
|
||||
|
||||
/* Used to load and write netscape format cert */
|
||||
|
||||
DECLARE_ASN1_FUNCTIONS(NETSCAPE_X509)
|
||||
/* Used to load and write Netscape format cert */
|
||||
|
||||
int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
|
||||
|
||||
int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len);
|
||||
int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data, int max_len);
|
||||
int ASN1_TYPE_get_octetstring(const ASN1_TYPE *a, unsigned char *data, int max_len);
|
||||
int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num,
|
||||
unsigned char *data, int len);
|
||||
int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num,
|
||||
int ASN1_TYPE_get_int_octetstring(const ASN1_TYPE *a, long *num,
|
||||
unsigned char *data, int max_len);
|
||||
|
||||
STACK_OF(OPENSSL_BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len,
|
||||
d2i_of_void *d2i,
|
||||
void (*free_func) (OPENSSL_BLOCK));
|
||||
unsigned char *ASN1_seq_pack(STACK_OF(OPENSSL_BLOCK) *safes, i2d_of_void *i2d,
|
||||
unsigned char **buf, int *len);
|
||||
void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i);
|
||||
void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
|
||||
ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
|
||||
ASN1_OCTET_STRING **oct);
|
||||
|
||||
# define ASN1_pack_string_of(type,obj,i2d,oct) \
|
||||
(ASN1_pack_string(CHECKED_PTR_OF(type, obj), \
|
||||
CHECKED_I2D_OF(type, i2d), \
|
||||
oct))
|
||||
void *ASN1_item_unpack(const ASN1_STRING *oct, const ASN1_ITEM *it);
|
||||
|
||||
ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it,
|
||||
ASN1_OCTET_STRING **oct);
|
||||
@ -1104,9 +812,11 @@ int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out,
|
||||
const ASN1_ITEM *it);
|
||||
|
||||
void ASN1_add_oid_module(void);
|
||||
void ASN1_add_stable_module(void);
|
||||
|
||||
ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf);
|
||||
ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);
|
||||
ASN1_TYPE *ASN1_generate_nconf(const char *str, CONF *nconf);
|
||||
ASN1_TYPE *ASN1_generate_v3(const char *str, X509V3_CTX *cnf);
|
||||
int ASN1_str2mask(const char *str, unsigned long *pmask);
|
||||
|
||||
/* ASN1 Print flags */
|
||||
|
||||
@ -1133,18 +843,26 @@ int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent,
|
||||
const ASN1_ITEM *it, const ASN1_PCTX *pctx);
|
||||
ASN1_PCTX *ASN1_PCTX_new(void);
|
||||
void ASN1_PCTX_free(ASN1_PCTX *p);
|
||||
unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p);
|
||||
unsigned long ASN1_PCTX_get_flags(const ASN1_PCTX *p);
|
||||
void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags);
|
||||
unsigned long ASN1_PCTX_get_nm_flags(ASN1_PCTX *p);
|
||||
unsigned long ASN1_PCTX_get_nm_flags(const ASN1_PCTX *p);
|
||||
void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags);
|
||||
unsigned long ASN1_PCTX_get_cert_flags(ASN1_PCTX *p);
|
||||
unsigned long ASN1_PCTX_get_cert_flags(const ASN1_PCTX *p);
|
||||
void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags);
|
||||
unsigned long ASN1_PCTX_get_oid_flags(ASN1_PCTX *p);
|
||||
unsigned long ASN1_PCTX_get_oid_flags(const ASN1_PCTX *p);
|
||||
void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags);
|
||||
unsigned long ASN1_PCTX_get_str_flags(ASN1_PCTX *p);
|
||||
unsigned long ASN1_PCTX_get_str_flags(const ASN1_PCTX *p);
|
||||
void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags);
|
||||
|
||||
BIO_METHOD *BIO_f_asn1(void);
|
||||
ASN1_SCTX *ASN1_SCTX_new(int (*scan_cb) (ASN1_SCTX *ctx));
|
||||
void ASN1_SCTX_free(ASN1_SCTX *p);
|
||||
const ASN1_ITEM *ASN1_SCTX_get_item(ASN1_SCTX *p);
|
||||
const ASN1_TEMPLATE *ASN1_SCTX_get_template(ASN1_SCTX *p);
|
||||
unsigned long ASN1_SCTX_get_flags(ASN1_SCTX *p);
|
||||
void ASN1_SCTX_set_app_data(ASN1_SCTX *p, void *data);
|
||||
void *ASN1_SCTX_get_app_data(ASN1_SCTX *p);
|
||||
|
||||
const BIO_METHOD *BIO_f_asn1(void);
|
||||
|
||||
BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it);
|
||||
|
||||
@ -1159,261 +877,10 @@ ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it);
|
||||
int SMIME_crlf_copy(BIO *in, BIO *out, int flags);
|
||||
int SMIME_text(BIO *in, BIO *out);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_ASN1_strings(void);
|
||||
const ASN1_ITEM *ASN1_ITEM_lookup(const char *name);
|
||||
const ASN1_ITEM *ASN1_ITEM_get(size_t i);
|
||||
|
||||
/* Error codes for the ASN1 functions. */
|
||||
|
||||
/* Function codes. */
|
||||
# define ASN1_F_A2D_ASN1_OBJECT 100
|
||||
# define ASN1_F_A2I_ASN1_ENUMERATED 101
|
||||
# define ASN1_F_A2I_ASN1_INTEGER 102
|
||||
# define ASN1_F_A2I_ASN1_STRING 103
|
||||
# define ASN1_F_APPEND_EXP 176
|
||||
# define ASN1_F_ASN1_BIT_STRING_SET_BIT 183
|
||||
# define ASN1_F_ASN1_CB 177
|
||||
# define ASN1_F_ASN1_CHECK_TLEN 104
|
||||
# define ASN1_F_ASN1_COLLATE_PRIMITIVE 105
|
||||
# define ASN1_F_ASN1_COLLECT 106
|
||||
# define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108
|
||||
# define ASN1_F_ASN1_D2I_FP 109
|
||||
# define ASN1_F_ASN1_D2I_READ_BIO 107
|
||||
# define ASN1_F_ASN1_DIGEST 184
|
||||
# define ASN1_F_ASN1_DO_ADB 110
|
||||
# define ASN1_F_ASN1_DUP 111
|
||||
# define ASN1_F_ASN1_ENUMERATED_SET 112
|
||||
# define ASN1_F_ASN1_ENUMERATED_TO_BN 113
|
||||
# define ASN1_F_ASN1_EX_C2I 204
|
||||
# define ASN1_F_ASN1_FIND_END 190
|
||||
# define ASN1_F_ASN1_GENERALIZEDTIME_ADJ 216
|
||||
# define ASN1_F_ASN1_GENERALIZEDTIME_SET 185
|
||||
# define ASN1_F_ASN1_GENERATE_V3 178
|
||||
# define ASN1_F_ASN1_GET_OBJECT 114
|
||||
# define ASN1_F_ASN1_HEADER_NEW 115
|
||||
# define ASN1_F_ASN1_I2D_BIO 116
|
||||
# define ASN1_F_ASN1_I2D_FP 117
|
||||
# define ASN1_F_ASN1_INTEGER_SET 118
|
||||
# define ASN1_F_ASN1_INTEGER_TO_BN 119
|
||||
# define ASN1_F_ASN1_ITEM_D2I_FP 206
|
||||
# define ASN1_F_ASN1_ITEM_DUP 191
|
||||
# define ASN1_F_ASN1_ITEM_EX_COMBINE_NEW 121
|
||||
# define ASN1_F_ASN1_ITEM_EX_D2I 120
|
||||
# define ASN1_F_ASN1_ITEM_I2D_BIO 192
|
||||
# define ASN1_F_ASN1_ITEM_I2D_FP 193
|
||||
# define ASN1_F_ASN1_ITEM_PACK 198
|
||||
# define ASN1_F_ASN1_ITEM_SIGN 195
|
||||
# define ASN1_F_ASN1_ITEM_SIGN_CTX 220
|
||||
# define ASN1_F_ASN1_ITEM_UNPACK 199
|
||||
# define ASN1_F_ASN1_ITEM_VERIFY 197
|
||||
# define ASN1_F_ASN1_MBSTRING_NCOPY 122
|
||||
# define ASN1_F_ASN1_OBJECT_NEW 123
|
||||
# define ASN1_F_ASN1_OUTPUT_DATA 214
|
||||
# define ASN1_F_ASN1_PACK_STRING 124
|
||||
# define ASN1_F_ASN1_PCTX_NEW 205
|
||||
# define ASN1_F_ASN1_PKCS5_PBE_SET 125
|
||||
# define ASN1_F_ASN1_SEQ_PACK 126
|
||||
# define ASN1_F_ASN1_SEQ_UNPACK 127
|
||||
# define ASN1_F_ASN1_SIGN 128
|
||||
# define ASN1_F_ASN1_STR2TYPE 179
|
||||
# define ASN1_F_ASN1_STRING_SET 186
|
||||
# define ASN1_F_ASN1_STRING_TABLE_ADD 129
|
||||
# define ASN1_F_ASN1_STRING_TYPE_NEW 130
|
||||
# define ASN1_F_ASN1_TEMPLATE_EX_D2I 132
|
||||
# define ASN1_F_ASN1_TEMPLATE_NEW 133
|
||||
# define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 131
|
||||
# define ASN1_F_ASN1_TIME_ADJ 217
|
||||
# define ASN1_F_ASN1_TIME_SET 175
|
||||
# define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134
|
||||
# define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135
|
||||
# define ASN1_F_ASN1_UNPACK_STRING 136
|
||||
# define ASN1_F_ASN1_UTCTIME_ADJ 218
|
||||
# define ASN1_F_ASN1_UTCTIME_SET 187
|
||||
# define ASN1_F_ASN1_VERIFY 137
|
||||
# define ASN1_F_B64_READ_ASN1 209
|
||||
# define ASN1_F_B64_WRITE_ASN1 210
|
||||
# define ASN1_F_BIO_NEW_NDEF 208
|
||||
# define ASN1_F_BITSTR_CB 180
|
||||
# define ASN1_F_BN_TO_ASN1_ENUMERATED 138
|
||||
# define ASN1_F_BN_TO_ASN1_INTEGER 139
|
||||
# define ASN1_F_C2I_ASN1_BIT_STRING 189
|
||||
# define ASN1_F_C2I_ASN1_INTEGER 194
|
||||
# define ASN1_F_C2I_ASN1_OBJECT 196
|
||||
# define ASN1_F_COLLECT_DATA 140
|
||||
# define ASN1_F_D2I_ASN1_BIT_STRING 141
|
||||
# define ASN1_F_D2I_ASN1_BOOLEAN 142
|
||||
# define ASN1_F_D2I_ASN1_BYTES 143
|
||||
# define ASN1_F_D2I_ASN1_GENERALIZEDTIME 144
|
||||
# define ASN1_F_D2I_ASN1_HEADER 145
|
||||
# define ASN1_F_D2I_ASN1_INTEGER 146
|
||||
# define ASN1_F_D2I_ASN1_OBJECT 147
|
||||
# define ASN1_F_D2I_ASN1_SET 148
|
||||
# define ASN1_F_D2I_ASN1_TYPE_BYTES 149
|
||||
# define ASN1_F_D2I_ASN1_UINTEGER 150
|
||||
# define ASN1_F_D2I_ASN1_UTCTIME 151
|
||||
# define ASN1_F_D2I_AUTOPRIVATEKEY 207
|
||||
# define ASN1_F_D2I_NETSCAPE_RSA 152
|
||||
# define ASN1_F_D2I_NETSCAPE_RSA_2 153
|
||||
# define ASN1_F_D2I_PRIVATEKEY 154
|
||||
# define ASN1_F_D2I_PUBLICKEY 155
|
||||
# define ASN1_F_D2I_RSA_NET 200
|
||||
# define ASN1_F_D2I_RSA_NET_2 201
|
||||
# define ASN1_F_D2I_X509 156
|
||||
# define ASN1_F_D2I_X509_CINF 157
|
||||
# define ASN1_F_D2I_X509_PKEY 159
|
||||
# define ASN1_F_I2D_ASN1_BIO_STREAM 211
|
||||
# define ASN1_F_I2D_ASN1_SET 188
|
||||
# define ASN1_F_I2D_ASN1_TIME 160
|
||||
# define ASN1_F_I2D_DSA_PUBKEY 161
|
||||
# define ASN1_F_I2D_EC_PUBKEY 181
|
||||
# define ASN1_F_I2D_PRIVATEKEY 163
|
||||
# define ASN1_F_I2D_PUBLICKEY 164
|
||||
# define ASN1_F_I2D_RSA_NET 162
|
||||
# define ASN1_F_I2D_RSA_PUBKEY 165
|
||||
# define ASN1_F_LONG_C2I 166
|
||||
# define ASN1_F_OID_MODULE_INIT 174
|
||||
# define ASN1_F_PARSE_TAGGING 182
|
||||
# define ASN1_F_PKCS5_PBE2_SET_IV 167
|
||||
# define ASN1_F_PKCS5_PBE_SET 202
|
||||
# define ASN1_F_PKCS5_PBE_SET0_ALGOR 215
|
||||
# define ASN1_F_PKCS5_PBKDF2_SET 219
|
||||
# define ASN1_F_SMIME_READ_ASN1 212
|
||||
# define ASN1_F_SMIME_TEXT 213
|
||||
# define ASN1_F_X509_CINF_NEW 168
|
||||
# define ASN1_F_X509_CRL_ADD0_REVOKED 169
|
||||
# define ASN1_F_X509_INFO_NEW 170
|
||||
# define ASN1_F_X509_NAME_ENCODE 203
|
||||
# define ASN1_F_X509_NAME_EX_D2I 158
|
||||
# define ASN1_F_X509_NAME_EX_NEW 171
|
||||
# define ASN1_F_X509_NEW 172
|
||||
# define ASN1_F_X509_PKEY_NEW 173
|
||||
|
||||
/* Reason codes. */
|
||||
# define ASN1_R_ADDING_OBJECT 171
|
||||
# define ASN1_R_ASN1_PARSE_ERROR 203
|
||||
# define ASN1_R_ASN1_SIG_PARSE_ERROR 204
|
||||
# define ASN1_R_AUX_ERROR 100
|
||||
# define ASN1_R_BAD_CLASS 101
|
||||
# define ASN1_R_BAD_OBJECT_HEADER 102
|
||||
# define ASN1_R_BAD_PASSWORD_READ 103
|
||||
# define ASN1_R_BAD_TAG 104
|
||||
# define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 214
|
||||
# define ASN1_R_BN_LIB 105
|
||||
# define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106
|
||||
# define ASN1_R_BUFFER_TOO_SMALL 107
|
||||
# define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 108
|
||||
# define ASN1_R_CONTEXT_NOT_INITIALISED 217
|
||||
# define ASN1_R_DATA_IS_WRONG 109
|
||||
# define ASN1_R_DECODE_ERROR 110
|
||||
# define ASN1_R_DECODING_ERROR 111
|
||||
# define ASN1_R_DEPTH_EXCEEDED 174
|
||||
# define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED 198
|
||||
# define ASN1_R_ENCODE_ERROR 112
|
||||
# define ASN1_R_ERROR_GETTING_TIME 173
|
||||
# define ASN1_R_ERROR_LOADING_SECTION 172
|
||||
# define ASN1_R_ERROR_PARSING_SET_ELEMENT 113
|
||||
# define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114
|
||||
# define ASN1_R_EXPECTING_AN_INTEGER 115
|
||||
# define ASN1_R_EXPECTING_AN_OBJECT 116
|
||||
# define ASN1_R_EXPECTING_A_BOOLEAN 117
|
||||
# define ASN1_R_EXPECTING_A_TIME 118
|
||||
# define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119
|
||||
# define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120
|
||||
# define ASN1_R_FIELD_MISSING 121
|
||||
# define ASN1_R_FIRST_NUM_TOO_LARGE 122
|
||||
# define ASN1_R_HEADER_TOO_LONG 123
|
||||
# define ASN1_R_ILLEGAL_BITSTRING_FORMAT 175
|
||||
# define ASN1_R_ILLEGAL_BOOLEAN 176
|
||||
# define ASN1_R_ILLEGAL_CHARACTERS 124
|
||||
# define ASN1_R_ILLEGAL_FORMAT 177
|
||||
# define ASN1_R_ILLEGAL_HEX 178
|
||||
# define ASN1_R_ILLEGAL_IMPLICIT_TAG 179
|
||||
# define ASN1_R_ILLEGAL_INTEGER 180
|
||||
# define ASN1_R_ILLEGAL_NESTED_TAGGING 181
|
||||
# define ASN1_R_ILLEGAL_NULL 125
|
||||
# define ASN1_R_ILLEGAL_NULL_VALUE 182
|
||||
# define ASN1_R_ILLEGAL_OBJECT 183
|
||||
# define ASN1_R_ILLEGAL_OPTIONAL_ANY 126
|
||||
# define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170
|
||||
# define ASN1_R_ILLEGAL_TAGGED_ANY 127
|
||||
# define ASN1_R_ILLEGAL_TIME_VALUE 184
|
||||
# define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185
|
||||
# define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128
|
||||
# define ASN1_R_INVALID_BIT_STRING_BITS_LEFT 220
|
||||
# define ASN1_R_INVALID_BMPSTRING_LENGTH 129
|
||||
# define ASN1_R_INVALID_DIGIT 130
|
||||
# define ASN1_R_INVALID_MIME_TYPE 205
|
||||
# define ASN1_R_INVALID_MODIFIER 186
|
||||
# define ASN1_R_INVALID_NUMBER 187
|
||||
# define ASN1_R_INVALID_OBJECT_ENCODING 216
|
||||
# define ASN1_R_INVALID_SEPARATOR 131
|
||||
# define ASN1_R_INVALID_TIME_FORMAT 132
|
||||
# define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133
|
||||
# define ASN1_R_INVALID_UTF8STRING 134
|
||||
# define ASN1_R_IV_TOO_LARGE 135
|
||||
# define ASN1_R_LENGTH_ERROR 136
|
||||
# define ASN1_R_LIST_ERROR 188
|
||||
# define ASN1_R_MIME_NO_CONTENT_TYPE 206
|
||||
# define ASN1_R_MIME_PARSE_ERROR 207
|
||||
# define ASN1_R_MIME_SIG_PARSE_ERROR 208
|
||||
# define ASN1_R_MISSING_EOC 137
|
||||
# define ASN1_R_MISSING_SECOND_NUMBER 138
|
||||
# define ASN1_R_MISSING_VALUE 189
|
||||
# define ASN1_R_MSTRING_NOT_UNIVERSAL 139
|
||||
# define ASN1_R_MSTRING_WRONG_TAG 140
|
||||
# define ASN1_R_NESTED_ASN1_STRING 197
|
||||
# define ASN1_R_NON_HEX_CHARACTERS 141
|
||||
# define ASN1_R_NOT_ASCII_FORMAT 190
|
||||
# define ASN1_R_NOT_ENOUGH_DATA 142
|
||||
# define ASN1_R_NO_CONTENT_TYPE 209
|
||||
# define ASN1_R_NO_DEFAULT_DIGEST 201
|
||||
# define ASN1_R_NO_MATCHING_CHOICE_TYPE 143
|
||||
# define ASN1_R_NO_MULTIPART_BODY_FAILURE 210
|
||||
# define ASN1_R_NO_MULTIPART_BOUNDARY 211
|
||||
# define ASN1_R_NO_SIG_CONTENT_TYPE 212
|
||||
# define ASN1_R_NULL_IS_WRONG_LENGTH 144
|
||||
# define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191
|
||||
# define ASN1_R_ODD_NUMBER_OF_CHARS 145
|
||||
# define ASN1_R_PRIVATE_KEY_HEADER_MISSING 146
|
||||
# define ASN1_R_SECOND_NUMBER_TOO_LARGE 147
|
||||
# define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148
|
||||
# define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149
|
||||
# define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192
|
||||
# define ASN1_R_SHORT_LINE 150
|
||||
# define ASN1_R_SIG_INVALID_MIME_TYPE 213
|
||||
# define ASN1_R_STREAMING_NOT_SUPPORTED 202
|
||||
# define ASN1_R_STRING_TOO_LONG 151
|
||||
# define ASN1_R_STRING_TOO_SHORT 152
|
||||
# define ASN1_R_TAG_VALUE_TOO_HIGH 153
|
||||
# define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154
|
||||
# define ASN1_R_TIME_NOT_ASCII_FORMAT 193
|
||||
# define ASN1_R_TOO_LONG 155
|
||||
# define ASN1_R_TYPE_NOT_CONSTRUCTED 156
|
||||
# define ASN1_R_TYPE_NOT_PRIMITIVE 218
|
||||
# define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 157
|
||||
# define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 158
|
||||
# define ASN1_R_UNEXPECTED_EOC 159
|
||||
# define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 215
|
||||
# define ASN1_R_UNKNOWN_FORMAT 160
|
||||
# define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161
|
||||
# define ASN1_R_UNKNOWN_OBJECT_TYPE 162
|
||||
# define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163
|
||||
# define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM 199
|
||||
# define ASN1_R_UNKNOWN_TAG 194
|
||||
# define ASN1_R_UNKOWN_FORMAT 195
|
||||
# define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164
|
||||
# define ASN1_R_UNSUPPORTED_CIPHER 165
|
||||
# define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 166
|
||||
# define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167
|
||||
# define ASN1_R_UNSUPPORTED_TYPE 196
|
||||
# define ASN1_R_WRONG_PUBLIC_KEY_TYPE 200
|
||||
# define ASN1_R_WRONG_TAG 168
|
||||
# define ASN1_R_WRONG_TYPE 169
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
@ -1,579 +1,10 @@
|
||||
/* crypto/asn1/asn1_mac.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef HEADER_ASN1_MAC_H
|
||||
# define HEADER_ASN1_MAC_H
|
||||
|
||||
# include <openssl/asn1.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# ifndef ASN1_MAC_ERR_LIB
|
||||
# define ASN1_MAC_ERR_LIB ERR_LIB_ASN1
|
||||
# endif
|
||||
|
||||
# define ASN1_MAC_H_err(f,r,line) \
|
||||
ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line))
|
||||
|
||||
# define M_ASN1_D2I_vars(a,type,func) \
|
||||
ASN1_const_CTX c; \
|
||||
type ret=NULL; \
|
||||
\
|
||||
c.pp=(const unsigned char **)pp; \
|
||||
c.q= *(const unsigned char **)pp; \
|
||||
c.error=ERR_R_NESTED_ASN1_ERROR; \
|
||||
if ((a == NULL) || ((*a) == NULL)) \
|
||||
{ if ((ret=(type)func()) == NULL) \
|
||||
{ c.line=__LINE__; goto err; } } \
|
||||
else ret=(*a);
|
||||
|
||||
# define M_ASN1_D2I_Init() \
|
||||
c.p= *(const unsigned char **)pp; \
|
||||
c.max=(length == 0)?0:(c.p+length);
|
||||
|
||||
# define M_ASN1_D2I_Finish_2(a) \
|
||||
if (!asn1_const_Finish(&c)) \
|
||||
{ c.line=__LINE__; goto err; } \
|
||||
*(const unsigned char **)pp=c.p; \
|
||||
if (a != NULL) (*a)=ret; \
|
||||
return(ret);
|
||||
|
||||
# define M_ASN1_D2I_Finish(a,func,e) \
|
||||
M_ASN1_D2I_Finish_2(a); \
|
||||
err:\
|
||||
ASN1_MAC_H_err((e),c.error,c.line); \
|
||||
asn1_add_error(*(const unsigned char **)pp,(int)(c.q- *pp)); \
|
||||
if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \
|
||||
return(NULL)
|
||||
|
||||
# define M_ASN1_D2I_start_sequence() \
|
||||
if (!asn1_GetSequence(&c,&length)) \
|
||||
{ c.line=__LINE__; goto err; }
|
||||
/* Begin reading ASN1 without a surrounding sequence */
|
||||
# define M_ASN1_D2I_begin() \
|
||||
c.slen = length;
|
||||
|
||||
/* End reading ASN1 with no check on length */
|
||||
# define M_ASN1_D2I_Finish_nolen(a, func, e) \
|
||||
*pp=c.p; \
|
||||
if (a != NULL) (*a)=ret; \
|
||||
return(ret); \
|
||||
err:\
|
||||
ASN1_MAC_H_err((e),c.error,c.line); \
|
||||
asn1_add_error(*pp,(int)(c.q- *pp)); \
|
||||
if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \
|
||||
return(NULL)
|
||||
|
||||
# define M_ASN1_D2I_end_sequence() \
|
||||
(((c.inf&1) == 0)?(c.slen <= 0): \
|
||||
(c.eos=ASN1_const_check_infinite_end(&c.p,c.slen)))
|
||||
|
||||
/* Don't use this with d2i_ASN1_BOOLEAN() */
|
||||
# define M_ASN1_D2I_get(b, func) \
|
||||
c.q=c.p; \
|
||||
if (func(&(b),&c.p,c.slen) == NULL) \
|
||||
{c.line=__LINE__; goto err; } \
|
||||
c.slen-=(c.p-c.q);
|
||||
|
||||
/* Don't use this with d2i_ASN1_BOOLEAN() */
|
||||
# define M_ASN1_D2I_get_x(type,b,func) \
|
||||
c.q=c.p; \
|
||||
if (((D2I_OF(type))func)(&(b),&c.p,c.slen) == NULL) \
|
||||
{c.line=__LINE__; goto err; } \
|
||||
c.slen-=(c.p-c.q);
|
||||
|
||||
/* use this instead () */
|
||||
# define M_ASN1_D2I_get_int(b,func) \
|
||||
c.q=c.p; \
|
||||
if (func(&(b),&c.p,c.slen) < 0) \
|
||||
{c.line=__LINE__; goto err; } \
|
||||
c.slen-=(c.p-c.q);
|
||||
|
||||
# define M_ASN1_D2I_get_opt(b,func,type) \
|
||||
if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) \
|
||||
== (V_ASN1_UNIVERSAL|(type)))) \
|
||||
{ \
|
||||
M_ASN1_D2I_get(b,func); \
|
||||
}
|
||||
|
||||
# define M_ASN1_D2I_get_int_opt(b,func,type) \
|
||||
if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) \
|
||||
== (V_ASN1_UNIVERSAL|(type)))) \
|
||||
{ \
|
||||
M_ASN1_D2I_get_int(b,func); \
|
||||
}
|
||||
|
||||
# define M_ASN1_D2I_get_imp(b,func, type) \
|
||||
M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \
|
||||
c.q=c.p; \
|
||||
if (func(&(b),&c.p,c.slen) == NULL) \
|
||||
{c.line=__LINE__; M_ASN1_next_prev = _tmp; goto err; } \
|
||||
c.slen-=(c.p-c.q);\
|
||||
M_ASN1_next_prev=_tmp;
|
||||
|
||||
# define M_ASN1_D2I_get_IMP_opt(b,func,tag,type) \
|
||||
if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) == \
|
||||
(V_ASN1_CONTEXT_SPECIFIC|(tag)))) \
|
||||
{ \
|
||||
unsigned char _tmp = M_ASN1_next; \
|
||||
M_ASN1_D2I_get_imp(b,func, type);\
|
||||
}
|
||||
|
||||
# define M_ASN1_D2I_get_set(r,func,free_func) \
|
||||
M_ASN1_D2I_get_imp_set(r,func,free_func, \
|
||||
V_ASN1_SET,V_ASN1_UNIVERSAL);
|
||||
|
||||
# define M_ASN1_D2I_get_set_type(type,r,func,free_func) \
|
||||
M_ASN1_D2I_get_imp_set_type(type,r,func,free_func, \
|
||||
V_ASN1_SET,V_ASN1_UNIVERSAL);
|
||||
|
||||
# define M_ASN1_D2I_get_set_opt(r,func,free_func) \
|
||||
if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
|
||||
V_ASN1_CONSTRUCTED|V_ASN1_SET)))\
|
||||
{ M_ASN1_D2I_get_set(r,func,free_func); }
|
||||
|
||||
# define M_ASN1_D2I_get_set_opt_type(type,r,func,free_func) \
|
||||
if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
|
||||
V_ASN1_CONSTRUCTED|V_ASN1_SET)))\
|
||||
{ M_ASN1_D2I_get_set_type(type,r,func,free_func); }
|
||||
|
||||
# define M_ASN1_I2D_len_SET_opt(a,f) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
M_ASN1_I2D_len_SET(a,f);
|
||||
|
||||
# define M_ASN1_I2D_put_SET_opt(a,f) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
M_ASN1_I2D_put_SET(a,f);
|
||||
|
||||
# define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
M_ASN1_I2D_put_SEQUENCE(a,f);
|
||||
|
||||
# define M_ASN1_I2D_put_SEQUENCE_opt_type(type,a,f) \
|
||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
||||
M_ASN1_I2D_put_SEQUENCE_type(type,a,f);
|
||||
|
||||
# define M_ASN1_D2I_get_IMP_set_opt(b,func,free_func,tag) \
|
||||
if ((c.slen != 0) && \
|
||||
(M_ASN1_next == \
|
||||
(V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\
|
||||
{ \
|
||||
M_ASN1_D2I_get_imp_set(b,func,free_func,\
|
||||
tag,V_ASN1_CONTEXT_SPECIFIC); \
|
||||
}
|
||||
|
||||
# define M_ASN1_D2I_get_IMP_set_opt_type(type,b,func,free_func,tag) \
|
||||
if ((c.slen != 0) && \
|
||||
(M_ASN1_next == \
|
||||
(V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\
|
||||
{ \
|
||||
M_ASN1_D2I_get_imp_set_type(type,b,func,free_func,\
|
||||
tag,V_ASN1_CONTEXT_SPECIFIC); \
|
||||
}
|
||||
|
||||
# define M_ASN1_D2I_get_seq(r,func,free_func) \
|
||||
M_ASN1_D2I_get_imp_set(r,func,free_func,\
|
||||
V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
|
||||
|
||||
# define M_ASN1_D2I_get_seq_type(type,r,func,free_func) \
|
||||
M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\
|
||||
V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL)
|
||||
|
||||
# define M_ASN1_D2I_get_seq_opt(r,func,free_func) \
|
||||
if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
|
||||
V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\
|
||||
{ M_ASN1_D2I_get_seq(r,func,free_func); }
|
||||
|
||||
# define M_ASN1_D2I_get_seq_opt_type(type,r,func,free_func) \
|
||||
if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
|
||||
V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\
|
||||
{ M_ASN1_D2I_get_seq_type(type,r,func,free_func); }
|
||||
|
||||
# define M_ASN1_D2I_get_IMP_set(r,func,free_func,x) \
|
||||
M_ASN1_D2I_get_imp_set(r,func,free_func,\
|
||||
x,V_ASN1_CONTEXT_SPECIFIC);
|
||||
|
||||
# define M_ASN1_D2I_get_IMP_set_type(type,r,func,free_func,x) \
|
||||
M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\
|
||||
x,V_ASN1_CONTEXT_SPECIFIC);
|
||||
|
||||
# define M_ASN1_D2I_get_imp_set(r,func,free_func,a,b) \
|
||||
c.q=c.p; \
|
||||
if (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,\
|
||||
(void (*)())free_func,a,b) == NULL) \
|
||||
{ c.line=__LINE__; goto err; } \
|
||||
c.slen-=(c.p-c.q);
|
||||
|
||||
# define M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,a,b) \
|
||||
c.q=c.p; \
|
||||
if (d2i_ASN1_SET_OF_##type(&(r),&c.p,c.slen,func,\
|
||||
free_func,a,b) == NULL) \
|
||||
{ c.line=__LINE__; goto err; } \
|
||||
c.slen-=(c.p-c.q);
|
||||
|
||||
# define M_ASN1_D2I_get_set_strings(r,func,a,b) \
|
||||
c.q=c.p; \
|
||||
if (d2i_ASN1_STRING_SET(&(r),&c.p,c.slen,a,b) == NULL) \
|
||||
{ c.line=__LINE__; goto err; } \
|
||||
c.slen-=(c.p-c.q);
|
||||
|
||||
# define M_ASN1_D2I_get_EXP_opt(r,func,tag) \
|
||||
if ((c.slen != 0L) && (M_ASN1_next == \
|
||||
(V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
|
||||
{ \
|
||||
int Tinf,Ttag,Tclass; \
|
||||
long Tlen; \
|
||||
\
|
||||
c.q=c.p; \
|
||||
Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
|
||||
if (Tinf & 0x80) \
|
||||
{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
|
||||
c.line=__LINE__; goto err; } \
|
||||
if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
|
||||
Tlen = c.slen - (c.p - c.q) - 2; \
|
||||
if (func(&(r),&c.p,Tlen) == NULL) \
|
||||
{ c.line=__LINE__; goto err; } \
|
||||
if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
|
||||
Tlen = c.slen - (c.p - c.q); \
|
||||
if(!ASN1_const_check_infinite_end(&c.p, Tlen)) \
|
||||
{ c.error=ERR_R_MISSING_ASN1_EOS; \
|
||||
c.line=__LINE__; goto err; } \
|
||||
}\
|
||||
c.slen-=(c.p-c.q); \
|
||||
}
|
||||
|
||||
# define M_ASN1_D2I_get_EXP_set_opt(r,func,free_func,tag,b) \
|
||||
if ((c.slen != 0) && (M_ASN1_next == \
|
||||
(V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
|
||||
{ \
|
||||
int Tinf,Ttag,Tclass; \
|
||||
long Tlen; \
|
||||
\
|
||||
c.q=c.p; \
|
||||
Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
|
||||
if (Tinf & 0x80) \
|
||||
{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
|
||||
c.line=__LINE__; goto err; } \
|
||||
if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
|
||||
Tlen = c.slen - (c.p - c.q) - 2; \
|
||||
if (d2i_ASN1_SET(&(r),&c.p,Tlen,(char *(*)())func, \
|
||||
(void (*)())free_func, \
|
||||
b,V_ASN1_UNIVERSAL) == NULL) \
|
||||
{ c.line=__LINE__; goto err; } \
|
||||
if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
|
||||
Tlen = c.slen - (c.p - c.q); \
|
||||
if(!ASN1_check_infinite_end(&c.p, Tlen)) \
|
||||
{ c.error=ERR_R_MISSING_ASN1_EOS; \
|
||||
c.line=__LINE__; goto err; } \
|
||||
}\
|
||||
c.slen-=(c.p-c.q); \
|
||||
}
|
||||
|
||||
# define M_ASN1_D2I_get_EXP_set_opt_type(type,r,func,free_func,tag,b) \
|
||||
if ((c.slen != 0) && (M_ASN1_next == \
|
||||
(V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
|
||||
{ \
|
||||
int Tinf,Ttag,Tclass; \
|
||||
long Tlen; \
|
||||
\
|
||||
c.q=c.p; \
|
||||
Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
|
||||
if (Tinf & 0x80) \
|
||||
{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
|
||||
c.line=__LINE__; goto err; } \
|
||||
if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
|
||||
Tlen = c.slen - (c.p - c.q) - 2; \
|
||||
if (d2i_ASN1_SET_OF_##type(&(r),&c.p,Tlen,func, \
|
||||
free_func,b,V_ASN1_UNIVERSAL) == NULL) \
|
||||
{ c.line=__LINE__; goto err; } \
|
||||
if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
|
||||
Tlen = c.slen - (c.p - c.q); \
|
||||
if(!ASN1_check_infinite_end(&c.p, Tlen)) \
|
||||
{ c.error=ERR_R_MISSING_ASN1_EOS; \
|
||||
c.line=__LINE__; goto err; } \
|
||||
}\
|
||||
c.slen-=(c.p-c.q); \
|
||||
}
|
||||
|
||||
/* New macros */
|
||||
# define M_ASN1_New_Malloc(ret,type) \
|
||||
if ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \
|
||||
{ c.line=__LINE__; goto err2; }
|
||||
|
||||
# define M_ASN1_New(arg,func) \
|
||||
if (((arg)=func()) == NULL) return(NULL)
|
||||
|
||||
# define M_ASN1_New_Error(a) \
|
||||
/*- err: ASN1_MAC_H_err((a),ERR_R_NESTED_ASN1_ERROR,c.line); \
|
||||
return(NULL);*/ \
|
||||
err2: ASN1_MAC_H_err((a),ERR_R_MALLOC_FAILURE,c.line); \
|
||||
return(NULL)
|
||||
|
||||
/*
|
||||
* BIG UGLY WARNING! This is so damn ugly I wanna puke. Unfortunately, some
|
||||
* macros that use ASN1_const_CTX still insist on writing in the input
|
||||
* stream. ARGH! ARGH! ARGH! Let's get rid of this macro package. Please? --
|
||||
* Richard Levitte
|
||||
* Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
# define M_ASN1_next (*((unsigned char *)(c.p)))
|
||||
# define M_ASN1_next_prev (*((unsigned char *)(c.q)))
|
||||
|
||||
/*************************************************/
|
||||
|
||||
# define M_ASN1_I2D_vars(a) int r=0,ret=0; \
|
||||
unsigned char *p; \
|
||||
if (a == NULL) return(0)
|
||||
|
||||
/* Length Macros */
|
||||
# define M_ASN1_I2D_len(a,f) ret+=f(a,NULL)
|
||||
# define M_ASN1_I2D_len_IMP_opt(a,f) if (a != NULL) M_ASN1_I2D_len(a,f)
|
||||
|
||||
# define M_ASN1_I2D_len_SET(a,f) \
|
||||
ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET);
|
||||
|
||||
# define M_ASN1_I2D_len_SET_type(type,a,f) \
|
||||
ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SET, \
|
||||
V_ASN1_UNIVERSAL,IS_SET);
|
||||
|
||||
# define M_ASN1_I2D_len_SEQUENCE(a,f) \
|
||||
ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \
|
||||
IS_SEQUENCE);
|
||||
|
||||
# define M_ASN1_I2D_len_SEQUENCE_type(type,a,f) \
|
||||
ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SEQUENCE, \
|
||||
V_ASN1_UNIVERSAL,IS_SEQUENCE)
|
||||
|
||||
# define M_ASN1_I2D_len_SEQUENCE_opt(a,f) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
M_ASN1_I2D_len_SEQUENCE(a,f);
|
||||
|
||||
# define M_ASN1_I2D_len_SEQUENCE_opt_type(type,a,f) \
|
||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
||||
M_ASN1_I2D_len_SEQUENCE_type(type,a,f);
|
||||
|
||||
# define M_ASN1_I2D_len_IMP_SET(a,f,x) \
|
||||
ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET);
|
||||
|
||||
# define M_ASN1_I2D_len_IMP_SET_type(type,a,f,x) \
|
||||
ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
|
||||
V_ASN1_CONTEXT_SPECIFIC,IS_SET);
|
||||
|
||||
# define M_ASN1_I2D_len_IMP_SET_opt(a,f,x) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
|
||||
IS_SET);
|
||||
|
||||
# define M_ASN1_I2D_len_IMP_SET_opt_type(type,a,f,x) \
|
||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
||||
ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
|
||||
V_ASN1_CONTEXT_SPECIFIC,IS_SET);
|
||||
|
||||
# define M_ASN1_I2D_len_IMP_SEQUENCE(a,f,x) \
|
||||
ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
|
||||
IS_SEQUENCE);
|
||||
|
||||
# define M_ASN1_I2D_len_IMP_SEQUENCE_opt(a,f,x) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
|
||||
IS_SEQUENCE);
|
||||
|
||||
# define M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(type,a,f,x) \
|
||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
||||
ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
|
||||
V_ASN1_CONTEXT_SPECIFIC, \
|
||||
IS_SEQUENCE);
|
||||
|
||||
# define M_ASN1_I2D_len_EXP_opt(a,f,mtag,v) \
|
||||
if (a != NULL)\
|
||||
{ \
|
||||
v=f(a,NULL); \
|
||||
ret+=ASN1_object_size(1,v,mtag); \
|
||||
}
|
||||
|
||||
# define M_ASN1_I2D_len_EXP_SET_opt(a,f,mtag,tag,v) \
|
||||
if ((a != NULL) && (sk_num(a) != 0))\
|
||||
{ \
|
||||
v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL,IS_SET); \
|
||||
ret+=ASN1_object_size(1,v,mtag); \
|
||||
}
|
||||
|
||||
# define M_ASN1_I2D_len_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \
|
||||
if ((a != NULL) && (sk_num(a) != 0))\
|
||||
{ \
|
||||
v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL, \
|
||||
IS_SEQUENCE); \
|
||||
ret+=ASN1_object_size(1,v,mtag); \
|
||||
}
|
||||
|
||||
# define M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \
|
||||
if ((a != NULL) && (sk_##type##_num(a) != 0))\
|
||||
{ \
|
||||
v=i2d_ASN1_SET_OF_##type(a,NULL,f,tag, \
|
||||
V_ASN1_UNIVERSAL, \
|
||||
IS_SEQUENCE); \
|
||||
ret+=ASN1_object_size(1,v,mtag); \
|
||||
}
|
||||
|
||||
/* Put Macros */
|
||||
# define M_ASN1_I2D_put(a,f) f(a,&p)
|
||||
|
||||
# define M_ASN1_I2D_put_IMP_opt(a,f,t) \
|
||||
if (a != NULL) \
|
||||
{ \
|
||||
unsigned char *q=p; \
|
||||
f(a,&p); \
|
||||
*q=(V_ASN1_CONTEXT_SPECIFIC|t|(*q&V_ASN1_CONSTRUCTED));\
|
||||
}
|
||||
|
||||
# define M_ASN1_I2D_put_SET(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SET,\
|
||||
V_ASN1_UNIVERSAL,IS_SET)
|
||||
# define M_ASN1_I2D_put_SET_type(type,a,f) \
|
||||
i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET)
|
||||
# define M_ASN1_I2D_put_IMP_SET(a,f,x) i2d_ASN1_SET(a,&p,f,x,\
|
||||
V_ASN1_CONTEXT_SPECIFIC,IS_SET)
|
||||
# define M_ASN1_I2D_put_IMP_SET_type(type,a,f,x) \
|
||||
i2d_ASN1_SET_OF_##type(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET)
|
||||
# define M_ASN1_I2D_put_IMP_SEQUENCE(a,f,x) i2d_ASN1_SET(a,&p,f,x,\
|
||||
V_ASN1_CONTEXT_SPECIFIC,IS_SEQUENCE)
|
||||
|
||||
# define M_ASN1_I2D_put_SEQUENCE(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SEQUENCE,\
|
||||
V_ASN1_UNIVERSAL,IS_SEQUENCE)
|
||||
|
||||
# define M_ASN1_I2D_put_SEQUENCE_type(type,a,f) \
|
||||
i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \
|
||||
IS_SEQUENCE)
|
||||
|
||||
# define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
M_ASN1_I2D_put_SEQUENCE(a,f);
|
||||
|
||||
# define M_ASN1_I2D_put_IMP_SET_opt(a,f,x) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
{ i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \
|
||||
IS_SET); }
|
||||
|
||||
# define M_ASN1_I2D_put_IMP_SET_opt_type(type,a,f,x) \
|
||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
||||
{ i2d_ASN1_SET_OF_##type(a,&p,f,x, \
|
||||
V_ASN1_CONTEXT_SPECIFIC, \
|
||||
IS_SET); }
|
||||
|
||||
# define M_ASN1_I2D_put_IMP_SEQUENCE_opt(a,f,x) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
{ i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \
|
||||
IS_SEQUENCE); }
|
||||
|
||||
# define M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(type,a,f,x) \
|
||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
||||
{ i2d_ASN1_SET_OF_##type(a,&p,f,x, \
|
||||
V_ASN1_CONTEXT_SPECIFIC, \
|
||||
IS_SEQUENCE); }
|
||||
|
||||
# define M_ASN1_I2D_put_EXP_opt(a,f,tag,v) \
|
||||
if (a != NULL) \
|
||||
{ \
|
||||
ASN1_put_object(&p,1,v,tag,V_ASN1_CONTEXT_SPECIFIC); \
|
||||
f(a,&p); \
|
||||
}
|
||||
|
||||
# define M_ASN1_I2D_put_EXP_SET_opt(a,f,mtag,tag,v) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
{ \
|
||||
ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
|
||||
i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SET); \
|
||||
}
|
||||
|
||||
# define M_ASN1_I2D_put_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
{ \
|
||||
ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
|
||||
i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SEQUENCE); \
|
||||
}
|
||||
|
||||
# define M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \
|
||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
||||
{ \
|
||||
ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
|
||||
i2d_ASN1_SET_OF_##type(a,&p,f,tag,V_ASN1_UNIVERSAL, \
|
||||
IS_SEQUENCE); \
|
||||
}
|
||||
|
||||
# define M_ASN1_I2D_seq_total() \
|
||||
r=ASN1_object_size(1,ret,V_ASN1_SEQUENCE); \
|
||||
if (pp == NULL) return(r); \
|
||||
p= *pp; \
|
||||
ASN1_put_object(&p,1,ret,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL)
|
||||
|
||||
# define M_ASN1_I2D_INF_seq_start(tag,ctx) \
|
||||
*(p++)=(V_ASN1_CONSTRUCTED|(tag)|(ctx)); \
|
||||
*(p++)=0x80
|
||||
|
||||
# define M_ASN1_I2D_INF_seq_end() *(p++)=0x00; *(p++)=0x00
|
||||
|
||||
# define M_ASN1_I2D_finish() *pp=p; \
|
||||
return(r);
|
||||
|
||||
int asn1_GetSequence(ASN1_const_CTX *c, long *length);
|
||||
void asn1_add_error(const unsigned char *address, int offset);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#error "This file is obsolete; please update your software."
|
||||
|
256
submodules/MtProtoKit/openssl/openssl/asn1err.h
Normal file
256
submodules/MtProtoKit/openssl/openssl/asn1err.h
Normal file
@ -0,0 +1,256 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_ASN1ERR_H
|
||||
# define HEADER_ASN1ERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_ASN1_strings(void);
|
||||
|
||||
/*
|
||||
* ASN1 function codes.
|
||||
*/
|
||||
# define ASN1_F_A2D_ASN1_OBJECT 100
|
||||
# define ASN1_F_A2I_ASN1_INTEGER 102
|
||||
# define ASN1_F_A2I_ASN1_STRING 103
|
||||
# define ASN1_F_APPEND_EXP 176
|
||||
# define ASN1_F_ASN1_BIO_INIT 113
|
||||
# define ASN1_F_ASN1_BIT_STRING_SET_BIT 183
|
||||
# define ASN1_F_ASN1_CB 177
|
||||
# define ASN1_F_ASN1_CHECK_TLEN 104
|
||||
# define ASN1_F_ASN1_COLLECT 106
|
||||
# define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108
|
||||
# define ASN1_F_ASN1_D2I_FP 109
|
||||
# define ASN1_F_ASN1_D2I_READ_BIO 107
|
||||
# define ASN1_F_ASN1_DIGEST 184
|
||||
# define ASN1_F_ASN1_DO_ADB 110
|
||||
# define ASN1_F_ASN1_DO_LOCK 233
|
||||
# define ASN1_F_ASN1_DUP 111
|
||||
# define ASN1_F_ASN1_ENC_SAVE 115
|
||||
# define ASN1_F_ASN1_EX_C2I 204
|
||||
# define ASN1_F_ASN1_FIND_END 190
|
||||
# define ASN1_F_ASN1_GENERALIZEDTIME_ADJ 216
|
||||
# define ASN1_F_ASN1_GENERATE_V3 178
|
||||
# define ASN1_F_ASN1_GET_INT64 224
|
||||
# define ASN1_F_ASN1_GET_OBJECT 114
|
||||
# define ASN1_F_ASN1_GET_UINT64 225
|
||||
# define ASN1_F_ASN1_I2D_BIO 116
|
||||
# define ASN1_F_ASN1_I2D_FP 117
|
||||
# define ASN1_F_ASN1_ITEM_D2I_FP 206
|
||||
# define ASN1_F_ASN1_ITEM_DUP 191
|
||||
# define ASN1_F_ASN1_ITEM_EMBED_D2I 120
|
||||
# define ASN1_F_ASN1_ITEM_EMBED_NEW 121
|
||||
# define ASN1_F_ASN1_ITEM_FLAGS_I2D 118
|
||||
# define ASN1_F_ASN1_ITEM_I2D_BIO 192
|
||||
# define ASN1_F_ASN1_ITEM_I2D_FP 193
|
||||
# define ASN1_F_ASN1_ITEM_PACK 198
|
||||
# define ASN1_F_ASN1_ITEM_SIGN 195
|
||||
# define ASN1_F_ASN1_ITEM_SIGN_CTX 220
|
||||
# define ASN1_F_ASN1_ITEM_UNPACK 199
|
||||
# define ASN1_F_ASN1_ITEM_VERIFY 197
|
||||
# define ASN1_F_ASN1_MBSTRING_NCOPY 122
|
||||
# define ASN1_F_ASN1_OBJECT_NEW 123
|
||||
# define ASN1_F_ASN1_OUTPUT_DATA 214
|
||||
# define ASN1_F_ASN1_PCTX_NEW 205
|
||||
# define ASN1_F_ASN1_PRIMITIVE_NEW 119
|
||||
# define ASN1_F_ASN1_SCTX_NEW 221
|
||||
# define ASN1_F_ASN1_SIGN 128
|
||||
# define ASN1_F_ASN1_STR2TYPE 179
|
||||
# define ASN1_F_ASN1_STRING_GET_INT64 227
|
||||
# define ASN1_F_ASN1_STRING_GET_UINT64 230
|
||||
# define ASN1_F_ASN1_STRING_SET 186
|
||||
# define ASN1_F_ASN1_STRING_TABLE_ADD 129
|
||||
# define ASN1_F_ASN1_STRING_TO_BN 228
|
||||
# define ASN1_F_ASN1_STRING_TYPE_NEW 130
|
||||
# define ASN1_F_ASN1_TEMPLATE_EX_D2I 132
|
||||
# define ASN1_F_ASN1_TEMPLATE_NEW 133
|
||||
# define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 131
|
||||
# define ASN1_F_ASN1_TIME_ADJ 217
|
||||
# define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134
|
||||
# define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135
|
||||
# define ASN1_F_ASN1_UTCTIME_ADJ 218
|
||||
# define ASN1_F_ASN1_VERIFY 137
|
||||
# define ASN1_F_B64_READ_ASN1 209
|
||||
# define ASN1_F_B64_WRITE_ASN1 210
|
||||
# define ASN1_F_BIO_NEW_NDEF 208
|
||||
# define ASN1_F_BITSTR_CB 180
|
||||
# define ASN1_F_BN_TO_ASN1_STRING 229
|
||||
# define ASN1_F_C2I_ASN1_BIT_STRING 189
|
||||
# define ASN1_F_C2I_ASN1_INTEGER 194
|
||||
# define ASN1_F_C2I_ASN1_OBJECT 196
|
||||
# define ASN1_F_C2I_IBUF 226
|
||||
# define ASN1_F_C2I_UINT64_INT 101
|
||||
# define ASN1_F_COLLECT_DATA 140
|
||||
# define ASN1_F_D2I_ASN1_OBJECT 147
|
||||
# define ASN1_F_D2I_ASN1_UINTEGER 150
|
||||
# define ASN1_F_D2I_AUTOPRIVATEKEY 207
|
||||
# define ASN1_F_D2I_PRIVATEKEY 154
|
||||
# define ASN1_F_D2I_PUBLICKEY 155
|
||||
# define ASN1_F_DO_BUF 142
|
||||
# define ASN1_F_DO_CREATE 124
|
||||
# define ASN1_F_DO_DUMP 125
|
||||
# define ASN1_F_DO_TCREATE 222
|
||||
# define ASN1_F_I2A_ASN1_OBJECT 126
|
||||
# define ASN1_F_I2D_ASN1_BIO_STREAM 211
|
||||
# define ASN1_F_I2D_ASN1_OBJECT 143
|
||||
# define ASN1_F_I2D_DSA_PUBKEY 161
|
||||
# define ASN1_F_I2D_EC_PUBKEY 181
|
||||
# define ASN1_F_I2D_PRIVATEKEY 163
|
||||
# define ASN1_F_I2D_PUBLICKEY 164
|
||||
# define ASN1_F_I2D_RSA_PUBKEY 165
|
||||
# define ASN1_F_LONG_C2I 166
|
||||
# define ASN1_F_NDEF_PREFIX 127
|
||||
# define ASN1_F_NDEF_SUFFIX 136
|
||||
# define ASN1_F_OID_MODULE_INIT 174
|
||||
# define ASN1_F_PARSE_TAGGING 182
|
||||
# define ASN1_F_PKCS5_PBE2_SET_IV 167
|
||||
# define ASN1_F_PKCS5_PBE2_SET_SCRYPT 231
|
||||
# define ASN1_F_PKCS5_PBE_SET 202
|
||||
# define ASN1_F_PKCS5_PBE_SET0_ALGOR 215
|
||||
# define ASN1_F_PKCS5_PBKDF2_SET 219
|
||||
# define ASN1_F_PKCS5_SCRYPT_SET 232
|
||||
# define ASN1_F_SMIME_READ_ASN1 212
|
||||
# define ASN1_F_SMIME_TEXT 213
|
||||
# define ASN1_F_STABLE_GET 138
|
||||
# define ASN1_F_STBL_MODULE_INIT 223
|
||||
# define ASN1_F_UINT32_C2I 105
|
||||
# define ASN1_F_UINT32_NEW 139
|
||||
# define ASN1_F_UINT64_C2I 112
|
||||
# define ASN1_F_UINT64_NEW 141
|
||||
# define ASN1_F_X509_CRL_ADD0_REVOKED 169
|
||||
# define ASN1_F_X509_INFO_NEW 170
|
||||
# define ASN1_F_X509_NAME_ENCODE 203
|
||||
# define ASN1_F_X509_NAME_EX_D2I 158
|
||||
# define ASN1_F_X509_NAME_EX_NEW 171
|
||||
# define ASN1_F_X509_PKEY_NEW 173
|
||||
|
||||
/*
|
||||
* ASN1 reason codes.
|
||||
*/
|
||||
# define ASN1_R_ADDING_OBJECT 171
|
||||
# define ASN1_R_ASN1_PARSE_ERROR 203
|
||||
# define ASN1_R_ASN1_SIG_PARSE_ERROR 204
|
||||
# define ASN1_R_AUX_ERROR 100
|
||||
# define ASN1_R_BAD_OBJECT_HEADER 102
|
||||
# define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 214
|
||||
# define ASN1_R_BN_LIB 105
|
||||
# define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106
|
||||
# define ASN1_R_BUFFER_TOO_SMALL 107
|
||||
# define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 108
|
||||
# define ASN1_R_CONTEXT_NOT_INITIALISED 217
|
||||
# define ASN1_R_DATA_IS_WRONG 109
|
||||
# define ASN1_R_DECODE_ERROR 110
|
||||
# define ASN1_R_DEPTH_EXCEEDED 174
|
||||
# define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED 198
|
||||
# define ASN1_R_ENCODE_ERROR 112
|
||||
# define ASN1_R_ERROR_GETTING_TIME 173
|
||||
# define ASN1_R_ERROR_LOADING_SECTION 172
|
||||
# define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114
|
||||
# define ASN1_R_EXPECTING_AN_INTEGER 115
|
||||
# define ASN1_R_EXPECTING_AN_OBJECT 116
|
||||
# define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119
|
||||
# define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120
|
||||
# define ASN1_R_FIELD_MISSING 121
|
||||
# define ASN1_R_FIRST_NUM_TOO_LARGE 122
|
||||
# define ASN1_R_HEADER_TOO_LONG 123
|
||||
# define ASN1_R_ILLEGAL_BITSTRING_FORMAT 175
|
||||
# define ASN1_R_ILLEGAL_BOOLEAN 176
|
||||
# define ASN1_R_ILLEGAL_CHARACTERS 124
|
||||
# define ASN1_R_ILLEGAL_FORMAT 177
|
||||
# define ASN1_R_ILLEGAL_HEX 178
|
||||
# define ASN1_R_ILLEGAL_IMPLICIT_TAG 179
|
||||
# define ASN1_R_ILLEGAL_INTEGER 180
|
||||
# define ASN1_R_ILLEGAL_NEGATIVE_VALUE 226
|
||||
# define ASN1_R_ILLEGAL_NESTED_TAGGING 181
|
||||
# define ASN1_R_ILLEGAL_NULL 125
|
||||
# define ASN1_R_ILLEGAL_NULL_VALUE 182
|
||||
# define ASN1_R_ILLEGAL_OBJECT 183
|
||||
# define ASN1_R_ILLEGAL_OPTIONAL_ANY 126
|
||||
# define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170
|
||||
# define ASN1_R_ILLEGAL_PADDING 221
|
||||
# define ASN1_R_ILLEGAL_TAGGED_ANY 127
|
||||
# define ASN1_R_ILLEGAL_TIME_VALUE 184
|
||||
# define ASN1_R_ILLEGAL_ZERO_CONTENT 222
|
||||
# define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185
|
||||
# define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128
|
||||
# define ASN1_R_INVALID_BIT_STRING_BITS_LEFT 220
|
||||
# define ASN1_R_INVALID_BMPSTRING_LENGTH 129
|
||||
# define ASN1_R_INVALID_DIGIT 130
|
||||
# define ASN1_R_INVALID_MIME_TYPE 205
|
||||
# define ASN1_R_INVALID_MODIFIER 186
|
||||
# define ASN1_R_INVALID_NUMBER 187
|
||||
# define ASN1_R_INVALID_OBJECT_ENCODING 216
|
||||
# define ASN1_R_INVALID_SCRYPT_PARAMETERS 227
|
||||
# define ASN1_R_INVALID_SEPARATOR 131
|
||||
# define ASN1_R_INVALID_STRING_TABLE_VALUE 218
|
||||
# define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133
|
||||
# define ASN1_R_INVALID_UTF8STRING 134
|
||||
# define ASN1_R_INVALID_VALUE 219
|
||||
# define ASN1_R_LIST_ERROR 188
|
||||
# define ASN1_R_MIME_NO_CONTENT_TYPE 206
|
||||
# define ASN1_R_MIME_PARSE_ERROR 207
|
||||
# define ASN1_R_MIME_SIG_PARSE_ERROR 208
|
||||
# define ASN1_R_MISSING_EOC 137
|
||||
# define ASN1_R_MISSING_SECOND_NUMBER 138
|
||||
# define ASN1_R_MISSING_VALUE 189
|
||||
# define ASN1_R_MSTRING_NOT_UNIVERSAL 139
|
||||
# define ASN1_R_MSTRING_WRONG_TAG 140
|
||||
# define ASN1_R_NESTED_ASN1_STRING 197
|
||||
# define ASN1_R_NESTED_TOO_DEEP 201
|
||||
# define ASN1_R_NON_HEX_CHARACTERS 141
|
||||
# define ASN1_R_NOT_ASCII_FORMAT 190
|
||||
# define ASN1_R_NOT_ENOUGH_DATA 142
|
||||
# define ASN1_R_NO_CONTENT_TYPE 209
|
||||
# define ASN1_R_NO_MATCHING_CHOICE_TYPE 143
|
||||
# define ASN1_R_NO_MULTIPART_BODY_FAILURE 210
|
||||
# define ASN1_R_NO_MULTIPART_BOUNDARY 211
|
||||
# define ASN1_R_NO_SIG_CONTENT_TYPE 212
|
||||
# define ASN1_R_NULL_IS_WRONG_LENGTH 144
|
||||
# define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191
|
||||
# define ASN1_R_ODD_NUMBER_OF_CHARS 145
|
||||
# define ASN1_R_SECOND_NUMBER_TOO_LARGE 147
|
||||
# define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148
|
||||
# define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149
|
||||
# define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192
|
||||
# define ASN1_R_SHORT_LINE 150
|
||||
# define ASN1_R_SIG_INVALID_MIME_TYPE 213
|
||||
# define ASN1_R_STREAMING_NOT_SUPPORTED 202
|
||||
# define ASN1_R_STRING_TOO_LONG 151
|
||||
# define ASN1_R_STRING_TOO_SHORT 152
|
||||
# define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154
|
||||
# define ASN1_R_TIME_NOT_ASCII_FORMAT 193
|
||||
# define ASN1_R_TOO_LARGE 223
|
||||
# define ASN1_R_TOO_LONG 155
|
||||
# define ASN1_R_TOO_SMALL 224
|
||||
# define ASN1_R_TYPE_NOT_CONSTRUCTED 156
|
||||
# define ASN1_R_TYPE_NOT_PRIMITIVE 195
|
||||
# define ASN1_R_UNEXPECTED_EOC 159
|
||||
# define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 215
|
||||
# define ASN1_R_UNKNOWN_FORMAT 160
|
||||
# define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161
|
||||
# define ASN1_R_UNKNOWN_OBJECT_TYPE 162
|
||||
# define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163
|
||||
# define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM 199
|
||||
# define ASN1_R_UNKNOWN_TAG 194
|
||||
# define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164
|
||||
# define ASN1_R_UNSUPPORTED_CIPHER 228
|
||||
# define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167
|
||||
# define ASN1_R_UNSUPPORTED_TYPE 196
|
||||
# define ASN1_R_WRONG_INTEGER_TYPE 225
|
||||
# define ASN1_R_WRONG_PUBLIC_KEY_TYPE 200
|
||||
# define ASN1_R_WRONG_TAG 168
|
||||
|
||||
#endif
|
@ -1,61 +1,12 @@
|
||||
/* asn1t.h */
|
||||
/*
|
||||
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
|
||||
* 2000.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* licensing@OpenSSL.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_ASN1T_H
|
||||
# define HEADER_ASN1T_H
|
||||
|
||||
@ -82,15 +33,18 @@ extern "C" {
|
||||
/* Macros for start and end of ASN1_ITEM definition */
|
||||
|
||||
# define ASN1_ITEM_start(itname) \
|
||||
OPENSSL_GLOBAL const ASN1_ITEM itname##_it = {
|
||||
const ASN1_ITEM itname##_it = {
|
||||
|
||||
# define ASN1_ITEM_end(itname) \
|
||||
# define static_ASN1_ITEM_start(itname) \
|
||||
static const ASN1_ITEM itname##_it = {
|
||||
|
||||
# define ASN1_ITEM_end(itname) \
|
||||
};
|
||||
|
||||
# else
|
||||
|
||||
/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */
|
||||
# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr()))
|
||||
# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)((iptr)()))
|
||||
|
||||
/* Macros for start and end of ASN1_ITEM definition */
|
||||
|
||||
@ -99,6 +53,9 @@ extern "C" {
|
||||
{ \
|
||||
static const ASN1_ITEM local_it = {
|
||||
|
||||
# define static_ASN1_ITEM_start(itname) \
|
||||
static ASN1_ITEM_start(itname)
|
||||
|
||||
# define ASN1_ITEM_end(itname) \
|
||||
}; \
|
||||
return &local_it; \
|
||||
@ -122,6 +79,17 @@ extern "C" {
|
||||
0,\
|
||||
#tname \
|
||||
ASN1_ITEM_end(tname)
|
||||
# define static_ASN1_ITEM_TEMPLATE_END(tname) \
|
||||
;\
|
||||
static_ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_PRIMITIVE,\
|
||||
-1,\
|
||||
&tname##_item_tt,\
|
||||
0,\
|
||||
NULL,\
|
||||
0,\
|
||||
#tname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
/* This is a ASN1 type which just embeds a template */
|
||||
|
||||
@ -151,9 +119,23 @@ extern "C" {
|
||||
|
||||
# define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname)
|
||||
|
||||
# define static_ASN1_SEQUENCE_END(stname) static_ASN1_SEQUENCE_END_name(stname, stname)
|
||||
|
||||
# define ASN1_SEQUENCE_END_name(stname, tname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
NULL,\
|
||||
sizeof(stname),\
|
||||
#tname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
# define static_ASN1_SEQUENCE_END_name(stname, tname) \
|
||||
;\
|
||||
static_ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
@ -177,8 +159,8 @@ extern "C" {
|
||||
static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
# define ASN1_SEQUENCE_ref(tname, cb, lck) \
|
||||
static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \
|
||||
# define ASN1_SEQUENCE_ref(tname, cb) \
|
||||
static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), offsetof(tname, lock), cb, 0}; \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
# define ASN1_SEQUENCE_enc(tname, enc, cb) \
|
||||
@ -196,16 +178,41 @@ extern "C" {
|
||||
sizeof(tname),\
|
||||
#tname \
|
||||
ASN1_ITEM_end(tname)
|
||||
# define static_ASN1_NDEF_SEQUENCE_END(tname) \
|
||||
;\
|
||||
static_ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_NDEF_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
NULL,\
|
||||
sizeof(tname),\
|
||||
#tname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
# define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname)
|
||||
# define static_ASN1_BROKEN_SEQUENCE_END(stname) \
|
||||
static_ASN1_SEQUENCE_END_ref(stname, stname)
|
||||
|
||||
# define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
|
||||
|
||||
# define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
|
||||
# define static_ASN1_SEQUENCE_END_cb(stname, tname) static_ASN1_SEQUENCE_END_ref(stname, tname)
|
||||
|
||||
# define ASN1_SEQUENCE_END_ref(stname, tname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
&tname##_aux,\
|
||||
sizeof(stname),\
|
||||
#tname \
|
||||
ASN1_ITEM_end(tname)
|
||||
# define static_ASN1_SEQUENCE_END_ref(stname, tname) \
|
||||
;\
|
||||
static_ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
@ -259,8 +266,12 @@ extern "C" {
|
||||
|
||||
# define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname)
|
||||
|
||||
# define static_ASN1_CHOICE_END(stname) static_ASN1_CHOICE_END_name(stname, stname)
|
||||
|
||||
# define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type)
|
||||
|
||||
# define static_ASN1_CHOICE_END_name(stname, tname) static_ASN1_CHOICE_END_selector(stname, tname, type)
|
||||
|
||||
# define ASN1_CHOICE_END_selector(stname, tname, selname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
@ -273,6 +284,18 @@ extern "C" {
|
||||
#stname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
# define static_ASN1_CHOICE_END_selector(stname, tname, selname) \
|
||||
;\
|
||||
static_ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_CHOICE,\
|
||||
offsetof(stname,selname) ,\
|
||||
tname##_ch_tt,\
|
||||
sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
NULL,\
|
||||
sizeof(stname),\
|
||||
#stname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
# define ASN1_CHOICE_END_cb(stname, tname, selname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
@ -299,18 +322,13 @@ extern "C" {
|
||||
(flags), (tag), offsetof(stname, field),\
|
||||
#field, ASN1_ITEM_ref(type) }
|
||||
|
||||
/* used when the structure is combined with the parent */
|
||||
|
||||
# define ASN1_EX_COMBINE(flags, tag, type) { \
|
||||
(flags)|ASN1_TFLG_COMBINE, (tag), 0, NULL, ASN1_ITEM_ref(type) }
|
||||
|
||||
/* implicit and explicit helper macros */
|
||||
|
||||
# define ASN1_IMP_EX(stname, field, type, tag, ex) \
|
||||
ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | ex, tag, stname, field, type)
|
||||
ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | (ex), tag, stname, field, type)
|
||||
|
||||
# define ASN1_EXP_EX(stname, field, type, tag, ex) \
|
||||
ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | ex, tag, stname, field, type)
|
||||
ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | (ex), tag, stname, field, type)
|
||||
|
||||
/* Any defined by macros: the field used is in the table itself */
|
||||
|
||||
@ -323,20 +341,27 @@ extern "C" {
|
||||
# endif
|
||||
/* Plain simple type */
|
||||
# define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type)
|
||||
/* Embedded simple type */
|
||||
# define ASN1_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_EMBED,0, stname, field, type)
|
||||
|
||||
/* OPTIONAL simple type */
|
||||
# define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type)
|
||||
# define ASN1_OPT_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED, 0, stname, field, type)
|
||||
|
||||
/* IMPLICIT tagged simple type */
|
||||
# define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0)
|
||||
# define ASN1_IMP_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_EMBED)
|
||||
|
||||
/* IMPLICIT tagged OPTIONAL simple type */
|
||||
# define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL)
|
||||
# define ASN1_IMP_OPT_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED)
|
||||
|
||||
/* Same as above but EXPLICIT */
|
||||
|
||||
# define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0)
|
||||
# define ASN1_EXP_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_EMBED)
|
||||
# define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL)
|
||||
# define ASN1_EXP_OPT_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED)
|
||||
|
||||
/* SEQUENCE OF type */
|
||||
# define ASN1_SEQUENCE_OF(stname, field, type) \
|
||||
@ -395,12 +420,12 @@ extern "C" {
|
||||
|
||||
# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
|
||||
|
||||
# define ASN1_ADB_END(name, flags, field, app_table, def, none) \
|
||||
# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \
|
||||
;\
|
||||
static const ASN1_ADB name##_adb = {\
|
||||
flags,\
|
||||
offsetof(name, field),\
|
||||
app_table,\
|
||||
adb_cb,\
|
||||
name##_adbtbl,\
|
||||
sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
|
||||
def,\
|
||||
@ -409,7 +434,7 @@ extern "C" {
|
||||
|
||||
# else
|
||||
|
||||
# define ASN1_ADB_END(name, flags, field, app_table, def, none) \
|
||||
# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \
|
||||
;\
|
||||
static const ASN1_ITEM *name##_adb(void) \
|
||||
{ \
|
||||
@ -417,7 +442,7 @@ extern "C" {
|
||||
{\
|
||||
flags,\
|
||||
offsetof(name, field),\
|
||||
app_table,\
|
||||
adb_cb,\
|
||||
name##_adbtbl,\
|
||||
sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
|
||||
def,\
|
||||
@ -444,9 +469,7 @@ struct ASN1_TEMPLATE_st {
|
||||
unsigned long flags; /* Various flags */
|
||||
long tag; /* tag, not used if no tagging */
|
||||
unsigned long offset; /* Offset of this field in structure */
|
||||
# ifndef NO_ASN1_FIELD_NAMES
|
||||
const char *field_name; /* Field name */
|
||||
# endif
|
||||
ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */
|
||||
};
|
||||
|
||||
@ -461,7 +484,7 @@ typedef struct ASN1_ADB_st ASN1_ADB;
|
||||
struct ASN1_ADB_st {
|
||||
unsigned long flags; /* Various flags */
|
||||
unsigned long offset; /* Offset of selector field */
|
||||
STACK_OF(ASN1_ADB_TABLE) **app_items; /* Application defined items */
|
||||
int (*adb_cb)(long *psel); /* Application callback */
|
||||
const ASN1_ADB_TABLE *tbl; /* Table of possible types */
|
||||
long tblcount; /* Number of entries in tbl */
|
||||
const ASN1_TEMPLATE *default_tt; /* Type to use if no match */
|
||||
@ -508,10 +531,10 @@ struct ASN1_ADB_TABLE_st {
|
||||
# define ASN1_TFLG_TAG_MASK (0x3 << 3)
|
||||
|
||||
/* context specific IMPLICIT */
|
||||
# define ASN1_TFLG_IMPLICIT ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT
|
||||
# define ASN1_TFLG_IMPLICIT (ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT)
|
||||
|
||||
/* context specific EXPLICIT */
|
||||
# define ASN1_TFLG_EXPLICIT ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT
|
||||
# define ASN1_TFLG_EXPLICIT (ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT)
|
||||
|
||||
/*
|
||||
* If tagging is in force these determine the type of tag to use. Otherwise
|
||||
@ -542,15 +565,6 @@ struct ASN1_ADB_TABLE_st {
|
||||
|
||||
# define ASN1_TFLG_ADB_INT (0x1<<9)
|
||||
|
||||
/*
|
||||
* This flag means a parent structure is passed instead of the field: this is
|
||||
* useful is a SEQUENCE is being combined with a CHOICE for example. Since
|
||||
* this means the structure and item name will differ we need to use the
|
||||
* ASN1_CHOICE_END_name() macro for example.
|
||||
*/
|
||||
|
||||
# define ASN1_TFLG_COMBINE (0x1<<10)
|
||||
|
||||
/*
|
||||
* This flag when present in a SEQUENCE OF, SET OF or EXPLICIT causes
|
||||
* indefinite length constructed encoding to be used if required.
|
||||
@ -558,6 +572,9 @@ struct ASN1_ADB_TABLE_st {
|
||||
|
||||
# define ASN1_TFLG_NDEF (0x1<<11)
|
||||
|
||||
/* Field is embedded and not a pointer */
|
||||
# define ASN1_TFLG_EMBED (0x1 << 12)
|
||||
|
||||
/* This is the actual ASN1 item itself */
|
||||
|
||||
struct ASN1_ITEM_st {
|
||||
@ -569,9 +586,7 @@ struct ASN1_ITEM_st {
|
||||
long tcount; /* Number of templates if SEQUENCE or CHOICE */
|
||||
const void *funcs; /* functions that handle this type */
|
||||
long size; /* Structure size (usually) */
|
||||
# ifndef NO_ASN1_FIELD_NAMES
|
||||
const char *sname; /* Structure name */
|
||||
# endif
|
||||
};
|
||||
|
||||
/*-
|
||||
@ -597,10 +612,6 @@ struct ASN1_ITEM_st {
|
||||
* The 'funcs' field is used for application
|
||||
* specific functions.
|
||||
*
|
||||
* For COMPAT types the funcs field gives a
|
||||
* set of functions that handle this type, this
|
||||
* supports the old d2i, i2d convention.
|
||||
*
|
||||
* The EXTERN type uses a new style d2i/i2d.
|
||||
* The new style should be used where possible
|
||||
* because it avoids things like the d2i IMPLICIT
|
||||
@ -625,8 +636,6 @@ struct ASN1_ITEM_st {
|
||||
|
||||
# define ASN1_ITYPE_CHOICE 0x2
|
||||
|
||||
# define ASN1_ITYPE_COMPAT 0x3
|
||||
|
||||
# define ASN1_ITYPE_EXTERN 0x4
|
||||
|
||||
# define ASN1_ITYPE_MSTRING 0x5
|
||||
@ -648,13 +657,6 @@ struct ASN1_TLC_st {
|
||||
};
|
||||
|
||||
/* Typedefs for ASN1 function pointers */
|
||||
|
||||
typedef ASN1_VALUE *ASN1_new_func(void);
|
||||
typedef void ASN1_free_func(ASN1_VALUE *a);
|
||||
typedef ASN1_VALUE *ASN1_d2i_func(ASN1_VALUE **a, const unsigned char **in,
|
||||
long length);
|
||||
typedef int ASN1_i2d_func(ASN1_VALUE *a, unsigned char **in);
|
||||
|
||||
typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
|
||||
const ASN1_ITEM *it, int tag, int aclass, char opt,
|
||||
ASN1_TLC *ctx);
|
||||
@ -677,13 +679,6 @@ typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval,
|
||||
const ASN1_ITEM *it, int indent,
|
||||
const ASN1_PCTX *pctx);
|
||||
|
||||
typedef struct ASN1_COMPAT_FUNCS_st {
|
||||
ASN1_new_func *asn1_new;
|
||||
ASN1_free_func *asn1_free;
|
||||
ASN1_d2i_func *asn1_d2i;
|
||||
ASN1_i2d_func *asn1_i2d;
|
||||
} ASN1_COMPAT_FUNCS;
|
||||
|
||||
typedef struct ASN1_EXTERN_FUNCS_st {
|
||||
void *app_data;
|
||||
ASN1_ex_new_func *asn1_ex_new;
|
||||
@ -786,27 +781,6 @@ typedef struct ASN1_STREAM_ARG_st {
|
||||
ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \
|
||||
ASN1_ITEM_end(itname)
|
||||
|
||||
/* Macro to implement an ASN1_ITEM in terms of old style funcs */
|
||||
|
||||
# define IMPLEMENT_COMPAT_ASN1(sname) IMPLEMENT_COMPAT_ASN1_type(sname, V_ASN1_SEQUENCE)
|
||||
|
||||
# define IMPLEMENT_COMPAT_ASN1_type(sname, tag) \
|
||||
static const ASN1_COMPAT_FUNCS sname##_ff = { \
|
||||
(ASN1_new_func *)sname##_new, \
|
||||
(ASN1_free_func *)sname##_free, \
|
||||
(ASN1_d2i_func *)d2i_##sname, \
|
||||
(ASN1_i2d_func *)i2d_##sname, \
|
||||
}; \
|
||||
ASN1_ITEM_start(sname) \
|
||||
ASN1_ITYPE_COMPAT, \
|
||||
tag, \
|
||||
NULL, \
|
||||
0, \
|
||||
&sname##_ff, \
|
||||
0, \
|
||||
#sname \
|
||||
ASN1_ITEM_end(sname)
|
||||
|
||||
# define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \
|
||||
ASN1_ITEM_start(sname) \
|
||||
ASN1_ITYPE_EXTERN, \
|
||||
@ -873,6 +847,19 @@ typedef struct ASN1_STREAM_ARG_st {
|
||||
return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\
|
||||
}
|
||||
|
||||
# define IMPLEMENT_STATIC_ASN1_ENCODE_FUNCTIONS(stname) \
|
||||
static stname *d2i_##stname(stname **a, \
|
||||
const unsigned char **in, long len) \
|
||||
{ \
|
||||
return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, \
|
||||
ASN1_ITEM_rptr(stname)); \
|
||||
} \
|
||||
static int i2d_##stname(stname *a, unsigned char **out) \
|
||||
{ \
|
||||
return ASN1_item_i2d((ASN1_VALUE *)a, out, \
|
||||
ASN1_ITEM_rptr(stname)); \
|
||||
}
|
||||
|
||||
/*
|
||||
* This includes evil casts to remove const: they will go away when full ASN1
|
||||
* constification is done.
|
||||
@ -919,53 +906,38 @@ DECLARE_ASN1_ITEM(ASN1_FBOOLEAN)
|
||||
DECLARE_ASN1_ITEM(ASN1_SEQUENCE)
|
||||
DECLARE_ASN1_ITEM(CBIGNUM)
|
||||
DECLARE_ASN1_ITEM(BIGNUM)
|
||||
DECLARE_ASN1_ITEM(INT32)
|
||||
DECLARE_ASN1_ITEM(ZINT32)
|
||||
DECLARE_ASN1_ITEM(UINT32)
|
||||
DECLARE_ASN1_ITEM(ZUINT32)
|
||||
DECLARE_ASN1_ITEM(INT64)
|
||||
DECLARE_ASN1_ITEM(ZINT64)
|
||||
DECLARE_ASN1_ITEM(UINT64)
|
||||
DECLARE_ASN1_ITEM(ZUINT64)
|
||||
|
||||
# if OPENSSL_API_COMPAT < 0x10200000L
|
||||
/*
|
||||
* LONG and ZLONG are strongly discouraged for use as stored data, as the
|
||||
* underlying C type (long) differs in size depending on the architecture.
|
||||
* They are designed with 32-bit longs in mind.
|
||||
*/
|
||||
DECLARE_ASN1_ITEM(LONG)
|
||||
DECLARE_ASN1_ITEM(ZLONG)
|
||||
# endif
|
||||
|
||||
DECLARE_STACK_OF(ASN1_VALUE)
|
||||
DEFINE_STACK_OF(ASN1_VALUE)
|
||||
|
||||
/* Functions used internally by the ASN1 code */
|
||||
|
||||
int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
|
||||
int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
|
||||
void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
|
||||
int ASN1_template_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
|
||||
const ASN1_TEMPLATE *tt);
|
||||
int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
|
||||
const ASN1_ITEM *it, int tag, int aclass, char opt,
|
||||
ASN1_TLC *ctx);
|
||||
|
||||
int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
|
||||
const ASN1_ITEM *it, int tag, int aclass);
|
||||
int ASN1_template_i2d(ASN1_VALUE **pval, unsigned char **out,
|
||||
const ASN1_TEMPLATE *tt);
|
||||
void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
|
||||
int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype,
|
||||
const ASN1_ITEM *it);
|
||||
int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
|
||||
int utype, char *free_cont, const ASN1_ITEM *it);
|
||||
|
||||
int asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
int asn1_set_choice_selector(ASN1_VALUE **pval, int value,
|
||||
const ASN1_ITEM *it);
|
||||
|
||||
ASN1_VALUE **asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
|
||||
|
||||
const ASN1_TEMPLATE *asn1_do_adb(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt,
|
||||
int nullerr);
|
||||
|
||||
int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it);
|
||||
|
||||
void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||
int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval,
|
||||
const ASN1_ITEM *it);
|
||||
int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen,
|
||||
const ASN1_ITEM *it);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@ -22,6 +22,7 @@
|
||||
#define OSSL_ASYNC_FD int
|
||||
#define OSSL_BAD_ASYNC_FD -1
|
||||
#endif
|
||||
# include <openssl/asyncerr.h>
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
@ -68,29 +69,6 @@ ASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job);
|
||||
void ASYNC_block_pause(void);
|
||||
void ASYNC_unblock_pause(void);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
|
||||
int ERR_load_ASYNC_strings(void);
|
||||
|
||||
/* Error codes for the ASYNC functions. */
|
||||
|
||||
/* Function codes. */
|
||||
# define ASYNC_F_ASYNC_CTX_NEW 100
|
||||
# define ASYNC_F_ASYNC_INIT_THREAD 101
|
||||
# define ASYNC_F_ASYNC_JOB_NEW 102
|
||||
# define ASYNC_F_ASYNC_PAUSE_JOB 103
|
||||
# define ASYNC_F_ASYNC_START_FUNC 104
|
||||
# define ASYNC_F_ASYNC_START_JOB 105
|
||||
|
||||
/* Reason codes. */
|
||||
# define ASYNC_R_FAILED_TO_SET_POOL 101
|
||||
# define ASYNC_R_FAILED_TO_SWAP_CONTEXT 102
|
||||
# define ASYNC_R_INIT_FAILED 105
|
||||
# define ASYNC_R_INVALID_POOL_SIZE 103
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
|
42
submodules/MtProtoKit/openssl/openssl/asyncerr.h
Normal file
42
submodules/MtProtoKit/openssl/openssl/asyncerr.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_ASYNCERR_H
|
||||
# define HEADER_ASYNCERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_ASYNC_strings(void);
|
||||
|
||||
/*
|
||||
* ASYNC function codes.
|
||||
*/
|
||||
# define ASYNC_F_ASYNC_CTX_NEW 100
|
||||
# define ASYNC_F_ASYNC_INIT_THREAD 101
|
||||
# define ASYNC_F_ASYNC_JOB_NEW 102
|
||||
# define ASYNC_F_ASYNC_PAUSE_JOB 103
|
||||
# define ASYNC_F_ASYNC_START_FUNC 104
|
||||
# define ASYNC_F_ASYNC_START_JOB 105
|
||||
# define ASYNC_F_ASYNC_WAIT_CTX_SET_WAIT_FD 106
|
||||
|
||||
/*
|
||||
* ASYNC reason codes.
|
||||
*/
|
||||
# define ASYNC_R_FAILED_TO_SET_POOL 101
|
||||
# define ASYNC_R_FAILED_TO_SWAP_CONTEXT 102
|
||||
# define ASYNC_R_INIT_FAILED 105
|
||||
# define ASYNC_R_INVALID_POOL_SIZE 103
|
||||
|
||||
#endif
|
@ -1,59 +1,10 @@
|
||||
/* crypto/bio/bio.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_BIO_H
|
||||
@ -61,58 +12,52 @@
|
||||
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
# ifndef OPENSSL_NO_FP_API
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
# include <stdio.h>
|
||||
# endif
|
||||
# include <stdarg.h>
|
||||
|
||||
# include <openssl/crypto.h>
|
||||
|
||||
# ifndef OPENSSL_NO_SCTP
|
||||
# ifndef OPENSSL_SYS_VMS
|
||||
# include <stdint.h>
|
||||
# else
|
||||
# include <inttypes.h>
|
||||
# endif
|
||||
# endif
|
||||
# include <openssl/bioerr.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* These are the 'types' of BIOs */
|
||||
# define BIO_TYPE_NONE 0
|
||||
# define BIO_TYPE_MEM (1|0x0400)
|
||||
# define BIO_TYPE_FILE (2|0x0400)
|
||||
|
||||
# define BIO_TYPE_FD (4|0x0400|0x0100)
|
||||
# define BIO_TYPE_SOCKET (5|0x0400|0x0100)
|
||||
# define BIO_TYPE_NULL (6|0x0400)
|
||||
# define BIO_TYPE_SSL (7|0x0200)
|
||||
# define BIO_TYPE_MD (8|0x0200)/* passive filter */
|
||||
# define BIO_TYPE_BUFFER (9|0x0200)/* filter */
|
||||
# define BIO_TYPE_CIPHER (10|0x0200)/* filter */
|
||||
# define BIO_TYPE_BASE64 (11|0x0200)/* filter */
|
||||
# define BIO_TYPE_CONNECT (12|0x0400|0x0100)/* socket - connect */
|
||||
# define BIO_TYPE_ACCEPT (13|0x0400|0x0100)/* socket for accept */
|
||||
# define BIO_TYPE_PROXY_CLIENT (14|0x0200)/* client proxy BIO */
|
||||
# define BIO_TYPE_PROXY_SERVER (15|0x0200)/* server proxy BIO */
|
||||
# define BIO_TYPE_NBIO_TEST (16|0x0200)/* server proxy BIO */
|
||||
# define BIO_TYPE_NULL_FILTER (17|0x0200)
|
||||
# define BIO_TYPE_BER (18|0x0200)/* BER -> bin filter */
|
||||
# define BIO_TYPE_BIO (19|0x0400)/* (half a) BIO pair */
|
||||
# define BIO_TYPE_LINEBUFFER (20|0x0200)/* filter */
|
||||
# define BIO_TYPE_DGRAM (21|0x0400|0x0100)
|
||||
# ifndef OPENSSL_NO_SCTP
|
||||
# define BIO_TYPE_DGRAM_SCTP (24|0x0400|0x0100)
|
||||
# endif
|
||||
# define BIO_TYPE_ASN1 (22|0x0200)/* filter */
|
||||
# define BIO_TYPE_COMP (23|0x0200)/* filter */
|
||||
|
||||
# define BIO_TYPE_DESCRIPTOR 0x0100/* socket, fd, connect or accept */
|
||||
/* There are the classes of BIOs */
|
||||
# define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */
|
||||
# define BIO_TYPE_FILTER 0x0200
|
||||
# define BIO_TYPE_SOURCE_SINK 0x0400
|
||||
|
||||
/* These are the 'types' of BIOs */
|
||||
# define BIO_TYPE_NONE 0
|
||||
# define BIO_TYPE_MEM ( 1|BIO_TYPE_SOURCE_SINK)
|
||||
# define BIO_TYPE_FILE ( 2|BIO_TYPE_SOURCE_SINK)
|
||||
|
||||
# define BIO_TYPE_FD ( 4|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR)
|
||||
# define BIO_TYPE_SOCKET ( 5|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR)
|
||||
# define BIO_TYPE_NULL ( 6|BIO_TYPE_SOURCE_SINK)
|
||||
# define BIO_TYPE_SSL ( 7|BIO_TYPE_FILTER)
|
||||
# define BIO_TYPE_MD ( 8|BIO_TYPE_FILTER)
|
||||
# define BIO_TYPE_BUFFER ( 9|BIO_TYPE_FILTER)
|
||||
# define BIO_TYPE_CIPHER (10|BIO_TYPE_FILTER)
|
||||
# define BIO_TYPE_BASE64 (11|BIO_TYPE_FILTER)
|
||||
# define BIO_TYPE_CONNECT (12|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR)
|
||||
# define BIO_TYPE_ACCEPT (13|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR)
|
||||
|
||||
# define BIO_TYPE_NBIO_TEST (16|BIO_TYPE_FILTER)/* server proxy BIO */
|
||||
# define BIO_TYPE_NULL_FILTER (17|BIO_TYPE_FILTER)
|
||||
# define BIO_TYPE_BIO (19|BIO_TYPE_SOURCE_SINK)/* half a BIO pair */
|
||||
# define BIO_TYPE_LINEBUFFER (20|BIO_TYPE_FILTER)
|
||||
# define BIO_TYPE_DGRAM (21|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR)
|
||||
# define BIO_TYPE_ASN1 (22|BIO_TYPE_FILTER)
|
||||
# define BIO_TYPE_COMP (23|BIO_TYPE_FILTER)
|
||||
# ifndef OPENSSL_NO_SCTP
|
||||
# define BIO_TYPE_DGRAM_SCTP (24|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR)
|
||||
# endif
|
||||
|
||||
#define BIO_TYPE_START 128
|
||||
|
||||
/*
|
||||
* BIO_FILENAME_READ|BIO_CLOSE to open or close on free.
|
||||
* BIO_set_fp(in,stdin,BIO_NOCLOSE);
|
||||
@ -136,10 +81,10 @@ extern "C" {
|
||||
# define BIO_CTRL_FLUSH 11/* opt - 'flush' buffered output */
|
||||
# define BIO_CTRL_DUP 12/* man - extra stuff for 'duped' BIO */
|
||||
# define BIO_CTRL_WPENDING 13/* opt - number of bytes still to write */
|
||||
/* callback is int cb(BIO *bio,state,ret); */
|
||||
# define BIO_CTRL_SET_CALLBACK 14/* opt - set callback function */
|
||||
# define BIO_CTRL_GET_CALLBACK 15/* opt - set callback function */
|
||||
|
||||
# define BIO_CTRL_PEEK 29/* BIO_f_buffer special */
|
||||
# define BIO_CTRL_SET_FILENAME 30/* BIO_s_file special */
|
||||
|
||||
/* dgram BIO stuff */
|
||||
@ -178,9 +123,10 @@ extern "C" {
|
||||
|
||||
# define BIO_CTRL_DGRAM_GET_MTU_OVERHEAD 49
|
||||
|
||||
/* Deliberately outside of OPENSSL_NO_SCTP - used in bss_dgram.c */
|
||||
# define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE 50
|
||||
# ifndef OPENSSL_NO_SCTP
|
||||
/* SCTP stuff */
|
||||
# define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE 50
|
||||
# define BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY 51
|
||||
# define BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY 52
|
||||
# define BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD 53
|
||||
@ -193,6 +139,8 @@ extern "C" {
|
||||
# define BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN 70
|
||||
# endif
|
||||
|
||||
# define BIO_CTRL_DGRAM_SET_PEEK_MODE 71
|
||||
|
||||
/* modifiers */
|
||||
# define BIO_FP_READ 0x02
|
||||
# define BIO_FP_WRITE 0x04
|
||||
@ -212,31 +160,20 @@ extern "C" {
|
||||
# define BIO_FLAGS_UPLINK 0
|
||||
# endif
|
||||
|
||||
/* Used in BIO_gethostbyname() */
|
||||
# define BIO_GHBN_CTRL_HITS 1
|
||||
# define BIO_GHBN_CTRL_MISSES 2
|
||||
# define BIO_GHBN_CTRL_CACHE_SIZE 3
|
||||
# define BIO_GHBN_CTRL_GET_ENTRY 4
|
||||
# define BIO_GHBN_CTRL_FLUSH 5
|
||||
|
||||
/* Mostly used in the SSL BIO */
|
||||
/*-
|
||||
* Not used anymore
|
||||
* #define BIO_FLAGS_PROTOCOL_DELAYED_READ 0x10
|
||||
* #define BIO_FLAGS_PROTOCOL_DELAYED_WRITE 0x20
|
||||
* #define BIO_FLAGS_PROTOCOL_STARTUP 0x40
|
||||
*/
|
||||
|
||||
# define BIO_FLAGS_BASE64_NO_NL 0x100
|
||||
|
||||
/*
|
||||
* This is used with memory BIOs: it means we shouldn't free up or change the
|
||||
* data in any way.
|
||||
* This is used with memory BIOs:
|
||||
* BIO_FLAGS_MEM_RDONLY means we shouldn't free up or change the data in any way;
|
||||
* BIO_FLAGS_NONCLEAR_RST means we shouldn't clear data on reset.
|
||||
*/
|
||||
# define BIO_FLAGS_MEM_RDONLY 0x200
|
||||
# define BIO_FLAGS_NONCLEAR_RST 0x400
|
||||
|
||||
typedef struct bio_st BIO;
|
||||
typedef union bio_addr_st BIO_ADDR;
|
||||
typedef struct bio_addrinfo_st BIO_ADDRINFO;
|
||||
|
||||
int BIO_get_new_index(void);
|
||||
void BIO_set_flags(BIO *b, int flags);
|
||||
int BIO_test_flags(const BIO *b, int flags);
|
||||
void BIO_clear_flags(BIO *b, int flags);
|
||||
@ -295,76 +232,29 @@ void BIO_clear_flags(BIO *b, int flags);
|
||||
# define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN))
|
||||
# define BIO_cb_post(a) ((a)&BIO_CB_RETURN)
|
||||
|
||||
long (*BIO_get_callback(const BIO *b)) (struct bio_st *, int, const char *,
|
||||
int, long, long);
|
||||
void BIO_set_callback(BIO *b,
|
||||
long (*callback) (struct bio_st *, int, const char *,
|
||||
int, long, long));
|
||||
typedef long (*BIO_callback_fn)(BIO *b, int oper, const char *argp, int argi,
|
||||
long argl, long ret);
|
||||
typedef long (*BIO_callback_fn_ex)(BIO *b, int oper, const char *argp,
|
||||
size_t len, int argi,
|
||||
long argl, int ret, size_t *processed);
|
||||
BIO_callback_fn BIO_get_callback(const BIO *b);
|
||||
void BIO_set_callback(BIO *b, BIO_callback_fn callback);
|
||||
|
||||
BIO_callback_fn_ex BIO_get_callback_ex(const BIO *b);
|
||||
void BIO_set_callback_ex(BIO *b, BIO_callback_fn_ex callback);
|
||||
|
||||
char *BIO_get_callback_arg(const BIO *b);
|
||||
void BIO_set_callback_arg(BIO *b, char *arg);
|
||||
|
||||
typedef struct bio_method_st BIO_METHOD;
|
||||
|
||||
const char *BIO_method_name(const BIO *b);
|
||||
int BIO_method_type(const BIO *b);
|
||||
|
||||
typedef void bio_info_cb (struct bio_st *, int, const char *, int, long,
|
||||
long);
|
||||
typedef int BIO_info_cb(BIO *, int, int);
|
||||
typedef BIO_info_cb bio_info_cb; /* backward compatibility */
|
||||
|
||||
typedef struct bio_method_st {
|
||||
int type;
|
||||
const char *name;
|
||||
int (*bwrite) (BIO *, const char *, int);
|
||||
int (*bread) (BIO *, char *, int);
|
||||
int (*bputs) (BIO *, const char *);
|
||||
int (*bgets) (BIO *, char *, int);
|
||||
long (*ctrl) (BIO *, int, long, void *);
|
||||
int (*create) (BIO *);
|
||||
int (*destroy) (BIO *);
|
||||
long (*callback_ctrl) (BIO *, int, bio_info_cb *);
|
||||
} BIO_METHOD;
|
||||
|
||||
struct bio_st {
|
||||
BIO_METHOD *method;
|
||||
/* bio, mode, argp, argi, argl, ret */
|
||||
long (*callback) (struct bio_st *, int, const char *, int, long, long);
|
||||
char *cb_arg; /* first argument for the callback */
|
||||
int init;
|
||||
int shutdown;
|
||||
int flags; /* extra storage */
|
||||
int retry_reason;
|
||||
int num;
|
||||
void *ptr;
|
||||
struct bio_st *next_bio; /* used by filter BIOs */
|
||||
struct bio_st *prev_bio; /* used by filter BIOs */
|
||||
int references;
|
||||
unsigned long num_read;
|
||||
unsigned long num_write;
|
||||
CRYPTO_EX_DATA ex_data;
|
||||
};
|
||||
|
||||
DECLARE_STACK_OF(BIO)
|
||||
|
||||
typedef struct bio_f_buffer_ctx_struct {
|
||||
/*-
|
||||
* Buffers are setup like this:
|
||||
*
|
||||
* <---------------------- size ----------------------->
|
||||
* +---------------------------------------------------+
|
||||
* | consumed | remaining | free space |
|
||||
* +---------------------------------------------------+
|
||||
* <-- off --><------- len ------->
|
||||
*/
|
||||
/*- BIO *bio; *//*
|
||||
* this is now in the BIO struct
|
||||
*/
|
||||
int ibuf_size; /* how big is the input buffer */
|
||||
int obuf_size; /* how big is the output buffer */
|
||||
char *ibuf; /* the char array */
|
||||
int ibuf_len; /* how many bytes are in it */
|
||||
int ibuf_off; /* write/read offset */
|
||||
char *obuf; /* the char array */
|
||||
int obuf_len; /* how many bytes are in it */
|
||||
int obuf_off; /* write/read offset */
|
||||
} BIO_F_BUFFER_CTX;
|
||||
DEFINE_STACK_OF(BIO)
|
||||
|
||||
/* Prefix and suffix callback in ASN1 BIO */
|
||||
typedef int asn1_ps_func (BIO *b, unsigned char **pbuf, int *plen,
|
||||
@ -395,15 +285,6 @@ struct bio_dgram_sctp_prinfo {
|
||||
};
|
||||
# endif
|
||||
|
||||
/* connect BIO stuff */
|
||||
# define BIO_CONN_S_BEFORE 1
|
||||
# define BIO_CONN_S_GET_IP 2
|
||||
# define BIO_CONN_S_GET_PORT 3
|
||||
# define BIO_CONN_S_CREATE_SOCKET 4
|
||||
# define BIO_CONN_S_CONNECT 5
|
||||
# define BIO_CONN_S_OK 6
|
||||
# define BIO_CONN_S_BLOCKED_CONNECT 7
|
||||
# define BIO_CONN_S_NBIO 8
|
||||
/*
|
||||
* #define BIO_CONN_get_param_hostname BIO_ctrl
|
||||
*/
|
||||
@ -411,7 +292,7 @@ struct bio_dgram_sctp_prinfo {
|
||||
# define BIO_C_SET_CONNECT 100
|
||||
# define BIO_C_DO_STATE_MACHINE 101
|
||||
# define BIO_C_SET_NBIO 102
|
||||
# define BIO_C_SET_PROXY_PARAM 103
|
||||
/* # define BIO_C_SET_PROXY_PARAM 103 */
|
||||
# define BIO_C_SET_FD 104
|
||||
# define BIO_C_GET_FD 105
|
||||
# define BIO_C_SET_FILE_PTR 106
|
||||
@ -429,7 +310,7 @@ struct bio_dgram_sctp_prinfo {
|
||||
# define BIO_C_SET_ACCEPT 118
|
||||
# define BIO_C_SSL_MODE 119
|
||||
# define BIO_C_GET_MD_CTX 120
|
||||
# define BIO_C_GET_PROXY_PARAM 121
|
||||
/* # define BIO_C_GET_PROXY_PARAM 121 */
|
||||
# define BIO_C_SET_BUFF_READ_DATA 122/* data to read first */
|
||||
# define BIO_C_GET_CONNECT 123
|
||||
# define BIO_C_GET_ACCEPT 124
|
||||
@ -468,61 +349,71 @@ struct bio_dgram_sctp_prinfo {
|
||||
# define BIO_C_SET_EX_ARG 153
|
||||
# define BIO_C_GET_EX_ARG 154
|
||||
|
||||
# define BIO_C_SET_CONNECT_MODE 155
|
||||
|
||||
# define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg)
|
||||
# define BIO_get_app_data(s) BIO_get_ex_data(s,0)
|
||||
|
||||
/* BIO_s_connect() and BIO_s_socks4a_connect() */
|
||||
# define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0,(char *)name)
|
||||
# define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1,(char *)port)
|
||||
# define BIO_set_conn_ip(b,ip) BIO_ctrl(b,BIO_C_SET_CONNECT,2,(char *)ip)
|
||||
# define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)port)
|
||||
# define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0)
|
||||
# define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1)
|
||||
# define BIO_get_conn_ip(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2)
|
||||
# define BIO_get_conn_int_port(b) BIO_ctrl(b,BIO_C_GET_CONNECT,3,NULL)
|
||||
# define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL)
|
||||
|
||||
# define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL)
|
||||
# ifndef OPENSSL_NO_SOCK
|
||||
/* IP families we support, for BIO_s_connect() and BIO_s_accept() */
|
||||
/* Note: the underlying operating system may not support some of them */
|
||||
# define BIO_FAMILY_IPV4 4
|
||||
# define BIO_FAMILY_IPV6 6
|
||||
# define BIO_FAMILY_IPANY 256
|
||||
|
||||
/* BIO_s_connect() */
|
||||
# define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0, \
|
||||
(char *)(name))
|
||||
# define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1, \
|
||||
(char *)(port))
|
||||
# define BIO_set_conn_address(b,addr) BIO_ctrl(b,BIO_C_SET_CONNECT,2, \
|
||||
(char *)(addr))
|
||||
# define BIO_set_conn_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_CONNECT,3,f)
|
||||
# define BIO_get_conn_hostname(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0))
|
||||
# define BIO_get_conn_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1))
|
||||
# define BIO_get_conn_address(b) ((const BIO_ADDR *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2))
|
||||
# define BIO_get_conn_ip_family(b) BIO_ctrl(b,BIO_C_GET_CONNECT,3,NULL)
|
||||
# define BIO_set_conn_mode(b,n) BIO_ctrl(b,BIO_C_SET_CONNECT_MODE,(n),NULL)
|
||||
|
||||
/* BIO_s_accept() */
|
||||
# define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name)
|
||||
# define BIO_get_accept_port(b) BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0)
|
||||
# define BIO_set_accept_name(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0, \
|
||||
(char *)(name))
|
||||
# define BIO_set_accept_port(b,port) BIO_ctrl(b,BIO_C_SET_ACCEPT,1, \
|
||||
(char *)(port))
|
||||
# define BIO_get_accept_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0))
|
||||
# define BIO_get_accept_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,1))
|
||||
# define BIO_get_peer_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,2))
|
||||
# define BIO_get_peer_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,3))
|
||||
/* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */
|
||||
# define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?(void *)"a":NULL)
|
||||
# define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(char *)bio)
|
||||
# define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(n)?(void *)"a":NULL)
|
||||
# define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,3, \
|
||||
(char *)(bio))
|
||||
# define BIO_set_accept_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_ACCEPT,4,f)
|
||||
# define BIO_get_accept_ip_family(b) BIO_ctrl(b,BIO_C_GET_ACCEPT,4,NULL)
|
||||
|
||||
# define BIO_BIND_NORMAL 0
|
||||
# define BIO_BIND_REUSEADDR_IF_UNUSED 1
|
||||
# define BIO_BIND_REUSEADDR 2
|
||||
# define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL)
|
||||
# define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL)
|
||||
/* Aliases kept for backward compatibility */
|
||||
# define BIO_BIND_NORMAL 0
|
||||
# define BIO_BIND_REUSEADDR BIO_SOCK_REUSEADDR
|
||||
# define BIO_BIND_REUSEADDR_IF_UNUSED BIO_SOCK_REUSEADDR
|
||||
# define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL)
|
||||
# define BIO_get_bind_mode(b) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL)
|
||||
|
||||
/* BIO_s_accept() and BIO_s_connect() */
|
||||
# define BIO_do_connect(b) BIO_do_handshake(b)
|
||||
# define BIO_do_accept(b) BIO_do_handshake(b)
|
||||
# define BIO_do_connect(b) BIO_do_handshake(b)
|
||||
# define BIO_do_accept(b) BIO_do_handshake(b)
|
||||
# endif /* OPENSSL_NO_SOCK */
|
||||
|
||||
# define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL)
|
||||
|
||||
/* BIO_s_proxy_client() */
|
||||
# define BIO_set_url(b,url) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,0,(char *)(url))
|
||||
# define BIO_set_proxies(b,p) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,1,(char *)(p))
|
||||
/* BIO_set_nbio(b,n) */
|
||||
# define BIO_set_filter_bio(b,s) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,2,(char *)(s))
|
||||
/* BIO *BIO_get_filter_bio(BIO *bio); */
|
||||
# define BIO_set_proxy_cb(b,cb) BIO_callback_ctrl(b,BIO_C_SET_PROXY_PARAM,3,(void *(*cb)()))
|
||||
# define BIO_set_proxy_header(b,sk) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,4,(char *)sk)
|
||||
# define BIO_set_no_connect_return(b,bool) BIO_int_ctrl(b,BIO_C_SET_PROXY_PARAM,5,bool)
|
||||
|
||||
# define BIO_get_proxy_header(b,skp) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,0,(char *)skp)
|
||||
# define BIO_get_proxies(b,pxy_p) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,1,(char *)(pxy_p))
|
||||
# define BIO_get_url(b,url) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(char *)(url))
|
||||
# define BIO_get_no_connect_return(b) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,5,NULL)
|
||||
|
||||
/* BIO_s_datagram(), BIO_s_fd(), BIO_s_socket(), BIO_s_accept() and BIO_s_connect() */
|
||||
# define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd)
|
||||
# define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c)
|
||||
# define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)(c))
|
||||
|
||||
/* BIO_s_file() */
|
||||
# define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp)
|
||||
# define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp)
|
||||
# define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)(fp))
|
||||
# define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)(fpp))
|
||||
|
||||
/* BIO_s_fd() and BIO_s_file() */
|
||||
# define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL)
|
||||
@ -539,14 +430,14 @@ struct bio_dgram_sctp_prinfo {
|
||||
*/
|
||||
int BIO_read_filename(BIO *b, const char *name);
|
||||
# else
|
||||
# define BIO_read_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
|
||||
BIO_CLOSE|BIO_FP_READ,(char *)name)
|
||||
# define BIO_read_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \
|
||||
BIO_CLOSE|BIO_FP_READ,(char *)(name))
|
||||
# endif
|
||||
# define BIO_write_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
|
||||
# define BIO_write_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \
|
||||
BIO_CLOSE|BIO_FP_WRITE,name)
|
||||
# define BIO_append_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
|
||||
# define BIO_append_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \
|
||||
BIO_CLOSE|BIO_FP_APPEND,name)
|
||||
# define BIO_rw_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
|
||||
# define BIO_rw_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \
|
||||
BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name)
|
||||
|
||||
/*
|
||||
@ -555,22 +446,23 @@ int BIO_read_filename(BIO *b, const char *name);
|
||||
* next_bio field in the bio. So when you free the BIO, make sure you are
|
||||
* doing a BIO_free_all() to catch the underlying BIO.
|
||||
*/
|
||||
# define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl)
|
||||
# define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp)
|
||||
# define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)(ssl))
|
||||
# define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)(sslp))
|
||||
# define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL)
|
||||
# define BIO_set_ssl_renegotiate_bytes(b,num) \
|
||||
BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL);
|
||||
BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL)
|
||||
# define BIO_get_num_renegotiates(b) \
|
||||
BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL);
|
||||
BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL)
|
||||
# define BIO_set_ssl_renegotiate_timeout(b,seconds) \
|
||||
BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL);
|
||||
BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL)
|
||||
|
||||
/* defined in evp.h */
|
||||
/* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)md) */
|
||||
/* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)(md)) */
|
||||
|
||||
# define BIO_get_mem_data(b,pp) BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)pp)
|
||||
# define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)bm)
|
||||
# define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0,(char *)pp)
|
||||
# define BIO_get_mem_data(b,pp) BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)(pp))
|
||||
# define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)(bm))
|
||||
# define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0, \
|
||||
(char *)(pp))
|
||||
# define BIO_set_mem_eof_return(b,v) \
|
||||
BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL)
|
||||
|
||||
@ -600,6 +492,7 @@ size_t BIO_ctrl_wpending(BIO *b);
|
||||
|
||||
/* For the BIO_f_buffer() type */
|
||||
# define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL)
|
||||
# define BIO_buffer_peek(b,s,l) BIO_ctrl(b,BIO_CTRL_PEEK,(l),(s))
|
||||
|
||||
/* For BIO_s_bio() */
|
||||
# define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL)
|
||||
@ -616,29 +509,26 @@ int BIO_ctrl_reset_read_request(BIO *b);
|
||||
|
||||
/* ctrl macros for dgram */
|
||||
# define BIO_ctrl_dgram_connect(b,peer) \
|
||||
(int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)peer)
|
||||
# define BIO_ctrl_set_connected(b, state, peer) \
|
||||
(int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, state, (char *)peer)
|
||||
(int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)(peer))
|
||||
# define BIO_ctrl_set_connected(b,peer) \
|
||||
(int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, 0, (char *)(peer))
|
||||
# define BIO_dgram_recv_timedout(b) \
|
||||
(int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL)
|
||||
# define BIO_dgram_send_timedout(b) \
|
||||
(int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL)
|
||||
# define BIO_dgram_get_peer(b,peer) \
|
||||
(int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)peer)
|
||||
(int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)(peer))
|
||||
# define BIO_dgram_set_peer(b,peer) \
|
||||
(int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)peer)
|
||||
(int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)(peer))
|
||||
# define BIO_dgram_get_mtu_overhead(b) \
|
||||
(unsigned int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_MTU_OVERHEAD, 0, NULL)
|
||||
|
||||
/* These two aren't currently implemented */
|
||||
/* int BIO_get_ex_num(BIO *bio); */
|
||||
/* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */
|
||||
#define BIO_get_ex_new_index(l, p, newf, dupf, freef) \
|
||||
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_BIO, l, p, newf, dupf, freef)
|
||||
int BIO_set_ex_data(BIO *bio, int idx, void *data);
|
||||
void *BIO_get_ex_data(BIO *bio, int idx);
|
||||
int BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
|
||||
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
|
||||
unsigned long BIO_number_read(BIO *bio);
|
||||
unsigned long BIO_number_written(BIO *bio);
|
||||
uint64_t BIO_number_read(BIO *bio);
|
||||
uint64_t BIO_number_written(BIO *bio);
|
||||
|
||||
/* For BIO_f_asn1() */
|
||||
int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix,
|
||||
@ -650,34 +540,41 @@ int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix,
|
||||
int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix,
|
||||
asn1_ps_func **psuffix_free);
|
||||
|
||||
# ifndef OPENSSL_NO_FP_API
|
||||
BIO_METHOD *BIO_s_file(void);
|
||||
const BIO_METHOD *BIO_s_file(void);
|
||||
BIO *BIO_new_file(const char *filename, const char *mode);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
BIO *BIO_new_fp(FILE *stream, int close_flag);
|
||||
# define BIO_s_file_internal BIO_s_file
|
||||
# endif
|
||||
BIO *BIO_new(BIO_METHOD *type);
|
||||
int BIO_set(BIO *a, BIO_METHOD *type);
|
||||
BIO *BIO_new(const BIO_METHOD *type);
|
||||
int BIO_free(BIO *a);
|
||||
void BIO_set_data(BIO *a, void *ptr);
|
||||
void *BIO_get_data(BIO *a);
|
||||
void BIO_set_init(BIO *a, int init);
|
||||
int BIO_get_init(BIO *a);
|
||||
void BIO_set_shutdown(BIO *a, int shut);
|
||||
int BIO_get_shutdown(BIO *a);
|
||||
void BIO_vfree(BIO *a);
|
||||
int BIO_read(BIO *b, void *data, int len);
|
||||
int BIO_up_ref(BIO *a);
|
||||
int BIO_read(BIO *b, void *data, int dlen);
|
||||
int BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *readbytes);
|
||||
int BIO_gets(BIO *bp, char *buf, int size);
|
||||
int BIO_write(BIO *b, const void *data, int len);
|
||||
int BIO_write(BIO *b, const void *data, int dlen);
|
||||
int BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written);
|
||||
int BIO_puts(BIO *bp, const char *buf);
|
||||
int BIO_indent(BIO *b, int indent, int max);
|
||||
long BIO_ctrl(BIO *bp, int cmd, long larg, void *parg);
|
||||
long BIO_callback_ctrl(BIO *b, int cmd,
|
||||
void (*fp) (struct bio_st *, int, const char *, int,
|
||||
long, long));
|
||||
char *BIO_ptr_ctrl(BIO *bp, int cmd, long larg);
|
||||
long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp);
|
||||
void *BIO_ptr_ctrl(BIO *bp, int cmd, long larg);
|
||||
long BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg);
|
||||
BIO *BIO_push(BIO *b, BIO *append);
|
||||
BIO *BIO_pop(BIO *b);
|
||||
void BIO_free_all(BIO *a);
|
||||
BIO *BIO_find_type(BIO *b, int bio_type);
|
||||
BIO *BIO_next(BIO *b);
|
||||
void BIO_set_next(BIO *b, BIO *next);
|
||||
BIO *BIO_get_retry_BIO(BIO *bio, int *reason);
|
||||
int BIO_get_retry_reason(BIO *bio);
|
||||
void BIO_set_retry_reason(BIO *bio, int reason);
|
||||
BIO *BIO_dup_chain(BIO *in);
|
||||
|
||||
int BIO_nread0(BIO *bio, char **buf);
|
||||
@ -688,35 +585,44 @@ int BIO_nwrite(BIO *bio, char **buf, int num);
|
||||
long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi,
|
||||
long argl, long ret);
|
||||
|
||||
BIO_METHOD *BIO_s_mem(void);
|
||||
const BIO_METHOD *BIO_s_mem(void);
|
||||
const BIO_METHOD *BIO_s_secmem(void);
|
||||
BIO *BIO_new_mem_buf(const void *buf, int len);
|
||||
BIO_METHOD *BIO_s_socket(void);
|
||||
BIO_METHOD *BIO_s_connect(void);
|
||||
BIO_METHOD *BIO_s_accept(void);
|
||||
BIO_METHOD *BIO_s_fd(void);
|
||||
# ifndef OPENSSL_SYS_OS2
|
||||
BIO_METHOD *BIO_s_log(void);
|
||||
# ifndef OPENSSL_NO_SOCK
|
||||
const BIO_METHOD *BIO_s_socket(void);
|
||||
const BIO_METHOD *BIO_s_connect(void);
|
||||
const BIO_METHOD *BIO_s_accept(void);
|
||||
# endif
|
||||
BIO_METHOD *BIO_s_bio(void);
|
||||
BIO_METHOD *BIO_s_null(void);
|
||||
BIO_METHOD *BIO_f_null(void);
|
||||
BIO_METHOD *BIO_f_buffer(void);
|
||||
# ifdef OPENSSL_SYS_VMS
|
||||
BIO_METHOD *BIO_f_linebuffer(void);
|
||||
# endif
|
||||
BIO_METHOD *BIO_f_nbio_test(void);
|
||||
const BIO_METHOD *BIO_s_fd(void);
|
||||
const BIO_METHOD *BIO_s_log(void);
|
||||
const BIO_METHOD *BIO_s_bio(void);
|
||||
const BIO_METHOD *BIO_s_null(void);
|
||||
const BIO_METHOD *BIO_f_null(void);
|
||||
const BIO_METHOD *BIO_f_buffer(void);
|
||||
const BIO_METHOD *BIO_f_linebuffer(void);
|
||||
const BIO_METHOD *BIO_f_nbio_test(void);
|
||||
# ifndef OPENSSL_NO_DGRAM
|
||||
BIO_METHOD *BIO_s_datagram(void);
|
||||
const BIO_METHOD *BIO_s_datagram(void);
|
||||
int BIO_dgram_non_fatal_error(int error);
|
||||
BIO *BIO_new_dgram(int fd, int close_flag);
|
||||
# ifndef OPENSSL_NO_SCTP
|
||||
BIO_METHOD *BIO_s_datagram_sctp(void);
|
||||
const BIO_METHOD *BIO_s_datagram_sctp(void);
|
||||
BIO *BIO_new_dgram_sctp(int fd, int close_flag);
|
||||
int BIO_dgram_is_sctp(BIO *bio);
|
||||
int BIO_dgram_sctp_notification_cb(BIO *b,
|
||||
void (*handle_notifications) (BIO *bio,
|
||||
void *context,
|
||||
void *buf),
|
||||
void *context);
|
||||
int BIO_dgram_sctp_wait_for_dry(BIO *b);
|
||||
int BIO_dgram_sctp_msg_waiting(BIO *b);
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* BIO_METHOD *BIO_f_ber(void); */
|
||||
|
||||
# ifndef OPENSSL_NO_SOCK
|
||||
int BIO_sock_should_retry(int i);
|
||||
int BIO_sock_non_fatal_error(int error);
|
||||
int BIO_dgram_non_fatal_error(int error);
|
||||
# endif
|
||||
|
||||
int BIO_fd_should_retry(int i);
|
||||
int BIO_fd_non_fatal_error(int error);
|
||||
@ -726,51 +632,90 @@ int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u),
|
||||
void *u, const char *s, int len, int indent);
|
||||
int BIO_dump(BIO *b, const char *bytes, int len);
|
||||
int BIO_dump_indent(BIO *b, const char *bytes, int len, int indent);
|
||||
# ifndef OPENSSL_NO_FP_API
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int BIO_dump_fp(FILE *fp, const char *s, int len);
|
||||
int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent);
|
||||
# endif
|
||||
int BIO_hex_string(BIO *out, int indent, int width, unsigned char *data,
|
||||
int datalen);
|
||||
|
||||
struct hostent *BIO_gethostbyname(const char *name);
|
||||
/*-
|
||||
* We might want a thread-safe interface too:
|
||||
* struct hostent *BIO_gethostbyname_r(const char *name,
|
||||
* struct hostent *result, void *buffer, size_t buflen);
|
||||
* or something similar (caller allocates a struct hostent,
|
||||
* pointed to by "result", and additional buffer space for the various
|
||||
* substructures; if the buffer does not suffice, NULL is returned
|
||||
* and an appropriate error code is set).
|
||||
*/
|
||||
# ifndef OPENSSL_NO_SOCK
|
||||
BIO_ADDR *BIO_ADDR_new(void);
|
||||
int BIO_ADDR_rawmake(BIO_ADDR *ap, int family,
|
||||
const void *where, size_t wherelen, unsigned short port);
|
||||
void BIO_ADDR_free(BIO_ADDR *);
|
||||
void BIO_ADDR_clear(BIO_ADDR *ap);
|
||||
int BIO_ADDR_family(const BIO_ADDR *ap);
|
||||
int BIO_ADDR_rawaddress(const BIO_ADDR *ap, void *p, size_t *l);
|
||||
unsigned short BIO_ADDR_rawport(const BIO_ADDR *ap);
|
||||
char *BIO_ADDR_hostname_string(const BIO_ADDR *ap, int numeric);
|
||||
char *BIO_ADDR_service_string(const BIO_ADDR *ap, int numeric);
|
||||
char *BIO_ADDR_path_string(const BIO_ADDR *ap);
|
||||
|
||||
const BIO_ADDRINFO *BIO_ADDRINFO_next(const BIO_ADDRINFO *bai);
|
||||
int BIO_ADDRINFO_family(const BIO_ADDRINFO *bai);
|
||||
int BIO_ADDRINFO_socktype(const BIO_ADDRINFO *bai);
|
||||
int BIO_ADDRINFO_protocol(const BIO_ADDRINFO *bai);
|
||||
const BIO_ADDR *BIO_ADDRINFO_address(const BIO_ADDRINFO *bai);
|
||||
void BIO_ADDRINFO_free(BIO_ADDRINFO *bai);
|
||||
|
||||
enum BIO_hostserv_priorities {
|
||||
BIO_PARSE_PRIO_HOST, BIO_PARSE_PRIO_SERV
|
||||
};
|
||||
int BIO_parse_hostserv(const char *hostserv, char **host, char **service,
|
||||
enum BIO_hostserv_priorities hostserv_prio);
|
||||
enum BIO_lookup_type {
|
||||
BIO_LOOKUP_CLIENT, BIO_LOOKUP_SERVER
|
||||
};
|
||||
int BIO_lookup(const char *host, const char *service,
|
||||
enum BIO_lookup_type lookup_type,
|
||||
int family, int socktype, BIO_ADDRINFO **res);
|
||||
int BIO_lookup_ex(const char *host, const char *service,
|
||||
int lookup_type, int family, int socktype, int protocol,
|
||||
BIO_ADDRINFO **res);
|
||||
int BIO_sock_error(int sock);
|
||||
int BIO_socket_ioctl(int fd, long type, void *arg);
|
||||
int BIO_socket_nbio(int fd, int mode);
|
||||
int BIO_get_port(const char *str, unsigned short *port_ptr);
|
||||
int BIO_get_host_ip(const char *str, unsigned char *ip);
|
||||
int BIO_get_accept_socket(char *host_port, int mode);
|
||||
int BIO_accept(int sock, char **ip_port);
|
||||
int BIO_sock_init(void);
|
||||
void BIO_sock_cleanup(void);
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define BIO_sock_cleanup() while(0) continue
|
||||
# endif
|
||||
int BIO_set_tcp_ndelay(int sock, int turn_on);
|
||||
|
||||
DEPRECATEDIN_1_1_0(struct hostent *BIO_gethostbyname(const char *name))
|
||||
DEPRECATEDIN_1_1_0(int BIO_get_port(const char *str, unsigned short *port_ptr))
|
||||
DEPRECATEDIN_1_1_0(int BIO_get_host_ip(const char *str, unsigned char *ip))
|
||||
DEPRECATEDIN_1_1_0(int BIO_get_accept_socket(char *host_port, int mode))
|
||||
DEPRECATEDIN_1_1_0(int BIO_accept(int sock, char **ip_port))
|
||||
|
||||
union BIO_sock_info_u {
|
||||
BIO_ADDR *addr;
|
||||
};
|
||||
enum BIO_sock_info_type {
|
||||
BIO_SOCK_INFO_ADDRESS
|
||||
};
|
||||
int BIO_sock_info(int sock,
|
||||
enum BIO_sock_info_type type, union BIO_sock_info_u *info);
|
||||
|
||||
# define BIO_SOCK_REUSEADDR 0x01
|
||||
# define BIO_SOCK_V6_ONLY 0x02
|
||||
# define BIO_SOCK_KEEPALIVE 0x04
|
||||
# define BIO_SOCK_NONBLOCK 0x08
|
||||
# define BIO_SOCK_NODELAY 0x10
|
||||
|
||||
int BIO_socket(int domain, int socktype, int protocol, int options);
|
||||
int BIO_connect(int sock, const BIO_ADDR *addr, int options);
|
||||
int BIO_bind(int sock, const BIO_ADDR *addr, int options);
|
||||
int BIO_listen(int sock, const BIO_ADDR *addr, int options);
|
||||
int BIO_accept_ex(int accept_sock, BIO_ADDR *addr, int options);
|
||||
int BIO_closesocket(int sock);
|
||||
|
||||
BIO *BIO_new_socket(int sock, int close_flag);
|
||||
BIO *BIO_new_dgram(int fd, int close_flag);
|
||||
# ifndef OPENSSL_NO_SCTP
|
||||
BIO *BIO_new_dgram_sctp(int fd, int close_flag);
|
||||
int BIO_dgram_is_sctp(BIO *bio);
|
||||
int BIO_dgram_sctp_notification_cb(BIO *b,
|
||||
void (*handle_notifications) (BIO *bio,
|
||||
void
|
||||
*context,
|
||||
void *buf),
|
||||
void *context);
|
||||
int BIO_dgram_sctp_wait_for_dry(BIO *b);
|
||||
int BIO_dgram_sctp_msg_waiting(BIO *b);
|
||||
# endif
|
||||
BIO *BIO_new_fd(int fd, int close_flag);
|
||||
BIO *BIO_new_connect(const char *host_port);
|
||||
BIO *BIO_new_accept(const char *host_port);
|
||||
# endif /* OPENSSL_NO_SOCK*/
|
||||
|
||||
BIO *BIO_new_fd(int fd, int close_flag);
|
||||
|
||||
int BIO_new_bio_pair(BIO **bio1, size_t writebuf1,
|
||||
BIO **bio2, size_t writebuf2);
|
||||
@ -786,98 +731,70 @@ void BIO_copy_next_retry(BIO *b);
|
||||
* long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);
|
||||
*/
|
||||
|
||||
# ifdef __GNUC__
|
||||
# define __bio_h__attr__ __attribute__
|
||||
# else
|
||||
# define __bio_h__attr__(x)
|
||||
# define ossl_bio__attr__(x)
|
||||
# if defined(__GNUC__) && defined(__STDC_VERSION__) \
|
||||
&& !defined(__APPLE__)
|
||||
/*
|
||||
* Because we support the 'z' modifier, which made its appearance in C99,
|
||||
* we can't use __attribute__ with pre C99 dialects.
|
||||
*/
|
||||
# if __STDC_VERSION__ >= 199901L
|
||||
# undef ossl_bio__attr__
|
||||
# define ossl_bio__attr__ __attribute__
|
||||
# if __GNUC__*10 + __GNUC_MINOR__ >= 44
|
||||
# define ossl_bio__printf__ __gnu_printf__
|
||||
# else
|
||||
# define ossl_bio__printf__ __printf__
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
int BIO_printf(BIO *bio, const char *format, ...)
|
||||
__bio_h__attr__((__format__(__printf__, 2, 3)));
|
||||
ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 3)));
|
||||
int BIO_vprintf(BIO *bio, const char *format, va_list args)
|
||||
__bio_h__attr__((__format__(__printf__, 2, 0)));
|
||||
ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 0)));
|
||||
int BIO_snprintf(char *buf, size_t n, const char *format, ...)
|
||||
__bio_h__attr__((__format__(__printf__, 3, 4)));
|
||||
ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 4)));
|
||||
int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
|
||||
__bio_h__attr__((__format__(__printf__, 3, 0)));
|
||||
# undef __bio_h__attr__
|
||||
ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 0)));
|
||||
# undef ossl_bio__attr__
|
||||
# undef ossl_bio__printf__
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_BIO_strings(void);
|
||||
|
||||
/* Error codes for the BIO functions. */
|
||||
BIO_METHOD *BIO_meth_new(int type, const char *name);
|
||||
void BIO_meth_free(BIO_METHOD *biom);
|
||||
int (*BIO_meth_get_write(const BIO_METHOD *biom)) (BIO *, const char *, int);
|
||||
int (*BIO_meth_get_write_ex(const BIO_METHOD *biom)) (BIO *, const char *, size_t,
|
||||
size_t *);
|
||||
int BIO_meth_set_write(BIO_METHOD *biom,
|
||||
int (*write) (BIO *, const char *, int));
|
||||
int BIO_meth_set_write_ex(BIO_METHOD *biom,
|
||||
int (*bwrite) (BIO *, const char *, size_t, size_t *));
|
||||
int (*BIO_meth_get_read(const BIO_METHOD *biom)) (BIO *, char *, int);
|
||||
int (*BIO_meth_get_read_ex(const BIO_METHOD *biom)) (BIO *, char *, size_t, size_t *);
|
||||
int BIO_meth_set_read(BIO_METHOD *biom,
|
||||
int (*read) (BIO *, char *, int));
|
||||
int BIO_meth_set_read_ex(BIO_METHOD *biom,
|
||||
int (*bread) (BIO *, char *, size_t, size_t *));
|
||||
int (*BIO_meth_get_puts(const BIO_METHOD *biom)) (BIO *, const char *);
|
||||
int BIO_meth_set_puts(BIO_METHOD *biom,
|
||||
int (*puts) (BIO *, const char *));
|
||||
int (*BIO_meth_get_gets(const BIO_METHOD *biom)) (BIO *, char *, int);
|
||||
int BIO_meth_set_gets(BIO_METHOD *biom,
|
||||
int (*gets) (BIO *, char *, int));
|
||||
long (*BIO_meth_get_ctrl(const BIO_METHOD *biom)) (BIO *, int, long, void *);
|
||||
int BIO_meth_set_ctrl(BIO_METHOD *biom,
|
||||
long (*ctrl) (BIO *, int, long, void *));
|
||||
int (*BIO_meth_get_create(const BIO_METHOD *bion)) (BIO *);
|
||||
int BIO_meth_set_create(BIO_METHOD *biom, int (*create) (BIO *));
|
||||
int (*BIO_meth_get_destroy(const BIO_METHOD *biom)) (BIO *);
|
||||
int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy) (BIO *));
|
||||
long (*BIO_meth_get_callback_ctrl(const BIO_METHOD *biom))
|
||||
(BIO *, int, BIO_info_cb *);
|
||||
int BIO_meth_set_callback_ctrl(BIO_METHOD *biom,
|
||||
long (*callback_ctrl) (BIO *, int,
|
||||
BIO_info_cb *));
|
||||
|
||||
/* Function codes. */
|
||||
# define BIO_F_ACPT_STATE 100
|
||||
# define BIO_F_BIO_ACCEPT 101
|
||||
# define BIO_F_BIO_BER_GET_HEADER 102
|
||||
# define BIO_F_BIO_CALLBACK_CTRL 131
|
||||
# define BIO_F_BIO_CTRL 103
|
||||
# define BIO_F_BIO_GETHOSTBYNAME 120
|
||||
# define BIO_F_BIO_GETS 104
|
||||
# define BIO_F_BIO_GET_ACCEPT_SOCKET 105
|
||||
# define BIO_F_BIO_GET_HOST_IP 106
|
||||
# define BIO_F_BIO_GET_PORT 107
|
||||
# define BIO_F_BIO_MAKE_PAIR 121
|
||||
# define BIO_F_BIO_NEW 108
|
||||
# define BIO_F_BIO_NEW_FILE 109
|
||||
# define BIO_F_BIO_NEW_MEM_BUF 126
|
||||
# define BIO_F_BIO_NREAD 123
|
||||
# define BIO_F_BIO_NREAD0 124
|
||||
# define BIO_F_BIO_NWRITE 125
|
||||
# define BIO_F_BIO_NWRITE0 122
|
||||
# define BIO_F_BIO_PUTS 110
|
||||
# define BIO_F_BIO_READ 111
|
||||
# define BIO_F_BIO_SOCK_INIT 112
|
||||
# define BIO_F_BIO_WRITE 113
|
||||
# define BIO_F_BUFFER_CTRL 114
|
||||
# define BIO_F_CONN_CTRL 127
|
||||
# define BIO_F_CONN_STATE 115
|
||||
# define BIO_F_DGRAM_SCTP_READ 132
|
||||
# define BIO_F_DGRAM_SCTP_WRITE 133
|
||||
# define BIO_F_FILE_CTRL 116
|
||||
# define BIO_F_FILE_READ 130
|
||||
# define BIO_F_LINEBUFFER_CTRL 129
|
||||
# define BIO_F_MEM_READ 128
|
||||
# define BIO_F_MEM_WRITE 117
|
||||
# define BIO_F_SSL_NEW 118
|
||||
# define BIO_F_WSASTARTUP 119
|
||||
|
||||
/* Reason codes. */
|
||||
# define BIO_R_ACCEPT_ERROR 100
|
||||
# define BIO_R_BAD_FOPEN_MODE 101
|
||||
# define BIO_R_BAD_HOSTNAME_LOOKUP 102
|
||||
# define BIO_R_BROKEN_PIPE 124
|
||||
# define BIO_R_CONNECT_ERROR 103
|
||||
# define BIO_R_EOF_ON_MEMORY_BIO 127
|
||||
# define BIO_R_ERROR_SETTING_NBIO 104
|
||||
# define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET 105
|
||||
# define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET 106
|
||||
# define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107
|
||||
# define BIO_R_INVALID_ARGUMENT 125
|
||||
# define BIO_R_INVALID_IP_ADDRESS 108
|
||||
# define BIO_R_IN_USE 123
|
||||
# define BIO_R_KEEPALIVE 109
|
||||
# define BIO_R_NBIO_CONNECT_ERROR 110
|
||||
# define BIO_R_NO_ACCEPT_PORT_SPECIFIED 111
|
||||
# define BIO_R_NO_HOSTNAME_SPECIFIED 112
|
||||
# define BIO_R_NO_PORT_DEFINED 113
|
||||
# define BIO_R_NO_PORT_SPECIFIED 114
|
||||
# define BIO_R_NO_SUCH_FILE 128
|
||||
# define BIO_R_NULL_PARAMETER 115
|
||||
# define BIO_R_TAG_MISMATCH 116
|
||||
# define BIO_R_UNABLE_TO_BIND_SOCKET 117
|
||||
# define BIO_R_UNABLE_TO_CREATE_SOCKET 118
|
||||
# define BIO_R_UNABLE_TO_LISTEN_SOCKET 119
|
||||
# define BIO_R_UNINITIALIZED 120
|
||||
# define BIO_R_UNSUPPORTED_METHOD 121
|
||||
# define BIO_R_WRITE_TO_READ_ONLY_BIO 126
|
||||
# define BIO_R_WSASTARTUP 122
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
124
submodules/MtProtoKit/openssl/openssl/bioerr.h
Normal file
124
submodules/MtProtoKit/openssl/openssl/bioerr.h
Normal file
@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_BIOERR_H
|
||||
# define HEADER_BIOERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_BIO_strings(void);
|
||||
|
||||
/*
|
||||
* BIO function codes.
|
||||
*/
|
||||
# define BIO_F_ACPT_STATE 100
|
||||
# define BIO_F_ADDRINFO_WRAP 148
|
||||
# define BIO_F_ADDR_STRINGS 134
|
||||
# define BIO_F_BIO_ACCEPT 101
|
||||
# define BIO_F_BIO_ACCEPT_EX 137
|
||||
# define BIO_F_BIO_ACCEPT_NEW 152
|
||||
# define BIO_F_BIO_ADDR_NEW 144
|
||||
# define BIO_F_BIO_BIND 147
|
||||
# define BIO_F_BIO_CALLBACK_CTRL 131
|
||||
# define BIO_F_BIO_CONNECT 138
|
||||
# define BIO_F_BIO_CONNECT_NEW 153
|
||||
# define BIO_F_BIO_CTRL 103
|
||||
# define BIO_F_BIO_GETS 104
|
||||
# define BIO_F_BIO_GET_HOST_IP 106
|
||||
# define BIO_F_BIO_GET_NEW_INDEX 102
|
||||
# define BIO_F_BIO_GET_PORT 107
|
||||
# define BIO_F_BIO_LISTEN 139
|
||||
# define BIO_F_BIO_LOOKUP 135
|
||||
# define BIO_F_BIO_LOOKUP_EX 143
|
||||
# define BIO_F_BIO_MAKE_PAIR 121
|
||||
# define BIO_F_BIO_METH_NEW 146
|
||||
# define BIO_F_BIO_NEW 108
|
||||
# define BIO_F_BIO_NEW_DGRAM_SCTP 145
|
||||
# define BIO_F_BIO_NEW_FILE 109
|
||||
# define BIO_F_BIO_NEW_MEM_BUF 126
|
||||
# define BIO_F_BIO_NREAD 123
|
||||
# define BIO_F_BIO_NREAD0 124
|
||||
# define BIO_F_BIO_NWRITE 125
|
||||
# define BIO_F_BIO_NWRITE0 122
|
||||
# define BIO_F_BIO_PARSE_HOSTSERV 136
|
||||
# define BIO_F_BIO_PUTS 110
|
||||
# define BIO_F_BIO_READ 111
|
||||
# define BIO_F_BIO_READ_EX 105
|
||||
# define BIO_F_BIO_READ_INTERN 120
|
||||
# define BIO_F_BIO_SOCKET 140
|
||||
# define BIO_F_BIO_SOCKET_NBIO 142
|
||||
# define BIO_F_BIO_SOCK_INFO 141
|
||||
# define BIO_F_BIO_SOCK_INIT 112
|
||||
# define BIO_F_BIO_WRITE 113
|
||||
# define BIO_F_BIO_WRITE_EX 119
|
||||
# define BIO_F_BIO_WRITE_INTERN 128
|
||||
# define BIO_F_BUFFER_CTRL 114
|
||||
# define BIO_F_CONN_CTRL 127
|
||||
# define BIO_F_CONN_STATE 115
|
||||
# define BIO_F_DGRAM_SCTP_NEW 149
|
||||
# define BIO_F_DGRAM_SCTP_READ 132
|
||||
# define BIO_F_DGRAM_SCTP_WRITE 133
|
||||
# define BIO_F_DOAPR_OUTCH 150
|
||||
# define BIO_F_FILE_CTRL 116
|
||||
# define BIO_F_FILE_READ 130
|
||||
# define BIO_F_LINEBUFFER_CTRL 129
|
||||
# define BIO_F_LINEBUFFER_NEW 151
|
||||
# define BIO_F_MEM_WRITE 117
|
||||
# define BIO_F_NBIOF_NEW 154
|
||||
# define BIO_F_SLG_WRITE 155
|
||||
# define BIO_F_SSL_NEW 118
|
||||
|
||||
/*
|
||||
* BIO reason codes.
|
||||
*/
|
||||
# define BIO_R_ACCEPT_ERROR 100
|
||||
# define BIO_R_ADDRINFO_ADDR_IS_NOT_AF_INET 141
|
||||
# define BIO_R_AMBIGUOUS_HOST_OR_SERVICE 129
|
||||
# define BIO_R_BAD_FOPEN_MODE 101
|
||||
# define BIO_R_BROKEN_PIPE 124
|
||||
# define BIO_R_CONNECT_ERROR 103
|
||||
# define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107
|
||||
# define BIO_R_GETSOCKNAME_ERROR 132
|
||||
# define BIO_R_GETSOCKNAME_TRUNCATED_ADDRESS 133
|
||||
# define BIO_R_GETTING_SOCKTYPE 134
|
||||
# define BIO_R_INVALID_ARGUMENT 125
|
||||
# define BIO_R_INVALID_SOCKET 135
|
||||
# define BIO_R_IN_USE 123
|
||||
# define BIO_R_LENGTH_TOO_LONG 102
|
||||
# define BIO_R_LISTEN_V6_ONLY 136
|
||||
# define BIO_R_LOOKUP_RETURNED_NOTHING 142
|
||||
# define BIO_R_MALFORMED_HOST_OR_SERVICE 130
|
||||
# define BIO_R_NBIO_CONNECT_ERROR 110
|
||||
# define BIO_R_NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED 143
|
||||
# define BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED 144
|
||||
# define BIO_R_NO_PORT_DEFINED 113
|
||||
# define BIO_R_NO_SUCH_FILE 128
|
||||
# define BIO_R_NULL_PARAMETER 115
|
||||
# define BIO_R_UNABLE_TO_BIND_SOCKET 117
|
||||
# define BIO_R_UNABLE_TO_CREATE_SOCKET 118
|
||||
# define BIO_R_UNABLE_TO_KEEPALIVE 137
|
||||
# define BIO_R_UNABLE_TO_LISTEN_SOCKET 119
|
||||
# define BIO_R_UNABLE_TO_NODELAY 138
|
||||
# define BIO_R_UNABLE_TO_REUSEADDR 139
|
||||
# define BIO_R_UNAVAILABLE_IP_FAMILY 145
|
||||
# define BIO_R_UNINITIALIZED 120
|
||||
# define BIO_R_UNKNOWN_INFO_TYPE 140
|
||||
# define BIO_R_UNSUPPORTED_IP_FAMILY 146
|
||||
# define BIO_R_UNSUPPORTED_METHOD 121
|
||||
# define BIO_R_UNSUPPORTED_PROTOCOL_FAMILY 131
|
||||
# define BIO_R_WRITE_TO_READ_ONLY_BIO 126
|
||||
# define BIO_R_WSASTARTUP 122
|
||||
|
||||
#endif
|
@ -1,72 +1,21 @@
|
||||
/* crypto/bf/blowfish.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_BLOWFISH_H
|
||||
# define HEADER_BLOWFISH_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_BF
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# ifdef OPENSSL_NO_BF
|
||||
# error BF is disabled.
|
||||
# endif
|
||||
|
||||
# define BF_ENCRYPT 1
|
||||
@ -74,26 +23,10 @@ extern "C" {
|
||||
|
||||
/*-
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* ! BF_LONG has to be at least 32 bits wide. If it's wider, then !
|
||||
* ! BF_LONG_LOG2 has to be defined along. !
|
||||
* ! BF_LONG has to be at least 32 bits wide. !
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
*/
|
||||
|
||||
# if defined(__LP32__)
|
||||
# define BF_LONG unsigned long
|
||||
# elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
|
||||
# define BF_LONG unsigned long
|
||||
# define BF_LONG_LOG2 3
|
||||
/*
|
||||
* _CRAY note. I could declare short, but I have no idea what impact
|
||||
* does it have on performance on none-T3E machines. I could declare
|
||||
* int, but at least on C90 sizeof(int) can be chosen at compile time.
|
||||
* So I've chosen long...
|
||||
* <appro@fy.chalmers.se>
|
||||
*/
|
||||
# else
|
||||
# define BF_LONG unsigned int
|
||||
# endif
|
||||
# define BF_LONG unsigned int
|
||||
|
||||
# define BF_ROUNDS 16
|
||||
# define BF_BLOCK 8
|
||||
@ -103,9 +36,6 @@ typedef struct bf_key_st {
|
||||
BF_LONG S[4 * 256];
|
||||
} BF_KEY;
|
||||
|
||||
# ifdef OPENSSL_FIPS
|
||||
void private_BF_set_key(BF_KEY *key, int len, const unsigned char *data);
|
||||
# endif
|
||||
void BF_set_key(BF_KEY *key, int len, const unsigned char *data);
|
||||
|
||||
void BF_encrypt(BF_LONG *data, const BF_KEY *key);
|
||||
@ -123,8 +53,9 @@ void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
unsigned char *ivec, int *num);
|
||||
const char *BF_options(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
@ -1,263 +1,53 @@
|
||||
/* crypto/bn/bn.h */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* openssl-core@openssl.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
|
||||
*
|
||||
* Portions of the attached software ("Contribution") are developed by
|
||||
* SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
|
||||
*
|
||||
* The Contribution is licensed pursuant to the Eric Young open source
|
||||
* license provided above.
|
||||
*
|
||||
* The binary polynomial arithmetic software is originally written by
|
||||
* Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_BN_H
|
||||
# define HEADER_BN_H
|
||||
|
||||
# include <limits.h>
|
||||
# include <openssl/e_os2.h>
|
||||
# ifndef OPENSSL_NO_FP_API
|
||||
# include <stdio.h> /* FILE */
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
# include <stdio.h>
|
||||
# endif
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/ossl_typ.h>
|
||||
# include <openssl/crypto.h>
|
||||
# include <openssl/bnerr.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These preprocessor symbols control various aspects of the bignum headers
|
||||
* and library code. They're not defined by any "normal" configuration, as
|
||||
* they are intended for development and testing purposes. NB: defining all
|
||||
* three can be useful for debugging application code as well as openssl
|
||||
* itself. BN_DEBUG - turn on various debugging alterations to the bignum
|
||||
* code BN_DEBUG_RAND - uses random poisoning of unused words to trip up
|
||||
* mismanagement of bignum internals. You must also define BN_DEBUG.
|
||||
*/
|
||||
/* #define BN_DEBUG */
|
||||
/* #define BN_DEBUG_RAND */
|
||||
|
||||
# ifndef OPENSSL_SMALL_FOOTPRINT
|
||||
# define BN_MUL_COMBA
|
||||
# define BN_SQR_COMBA
|
||||
# define BN_RECURSION
|
||||
# endif
|
||||
|
||||
/*
|
||||
* This next option uses the C libraries (2 word)/(1 word) function. If it is
|
||||
* not defined, I use my C version (which is slower). The reason for this
|
||||
* flag is that when the particular C compiler library routine is used, and
|
||||
* the library is linked with a different compiler, the library is missing.
|
||||
* This mostly happens when the library is built with gcc and then linked
|
||||
* using normal cc. This would be a common occurrence because gcc normally
|
||||
* produces code that is 2 times faster than system compilers for the big
|
||||
* number stuff. For machines with only one compiler (or shared libraries),
|
||||
* this should be on. Again this in only really a problem on machines using
|
||||
* "long long's", are 32bit, and are not using my assembler code.
|
||||
*/
|
||||
# if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || \
|
||||
defined(OPENSSL_SYS_WIN32) || defined(linux)
|
||||
# ifndef BN_DIV2W
|
||||
# define BN_DIV2W
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/*
|
||||
* assuming long is 64bit - this is the DEC Alpha unsigned long long is only
|
||||
* 64 bits :-(, don't define BN_LLONG for the DEC Alpha
|
||||
* 64-bit processor with LP64 ABI
|
||||
*/
|
||||
# ifdef SIXTY_FOUR_BIT_LONG
|
||||
# define BN_ULLONG unsigned long long
|
||||
# define BN_ULONG unsigned long
|
||||
# define BN_LONG long
|
||||
# define BN_BITS 128
|
||||
# define BN_BYTES 8
|
||||
# define BN_BITS2 64
|
||||
# define BN_BITS4 32
|
||||
# define BN_MASK (0xffffffffffffffffffffffffffffffffLL)
|
||||
# define BN_MASK2 (0xffffffffffffffffL)
|
||||
# define BN_MASK2l (0xffffffffL)
|
||||
# define BN_MASK2h (0xffffffff00000000L)
|
||||
# define BN_MASK2h1 (0xffffffff80000000L)
|
||||
# define BN_TBIT (0x8000000000000000L)
|
||||
# define BN_DEC_CONV (10000000000000000000UL)
|
||||
# define BN_DEC_FMT1 "%lu"
|
||||
# define BN_DEC_FMT2 "%019lu"
|
||||
# define BN_DEC_NUM 19
|
||||
# define BN_HEX_FMT1 "%lX"
|
||||
# define BN_HEX_FMT2 "%016lX"
|
||||
# endif
|
||||
|
||||
/*
|
||||
* This is where the long long data type is 64 bits, but long is 32. For
|
||||
* machines where there are 64bit registers, this is the mode to use. IRIX,
|
||||
* on R4000 and above should use this mode, along with the relevant assembler
|
||||
* code :-). Do NOT define BN_LLONG.
|
||||
* 64-bit processor other than LP64 ABI
|
||||
*/
|
||||
# ifdef SIXTY_FOUR_BIT
|
||||
# undef BN_LLONG
|
||||
# undef BN_ULLONG
|
||||
# define BN_ULONG unsigned long long
|
||||
# define BN_LONG long long
|
||||
# define BN_BITS 128
|
||||
# define BN_BYTES 8
|
||||
# define BN_BITS2 64
|
||||
# define BN_BITS4 32
|
||||
# define BN_MASK2 (0xffffffffffffffffLL)
|
||||
# define BN_MASK2l (0xffffffffL)
|
||||
# define BN_MASK2h (0xffffffff00000000LL)
|
||||
# define BN_MASK2h1 (0xffffffff80000000LL)
|
||||
# define BN_TBIT (0x8000000000000000LL)
|
||||
# define BN_DEC_CONV (10000000000000000000ULL)
|
||||
# define BN_DEC_FMT1 "%llu"
|
||||
# define BN_DEC_FMT2 "%019llu"
|
||||
# define BN_DEC_NUM 19
|
||||
# define BN_HEX_FMT1 "%llX"
|
||||
# define BN_HEX_FMT2 "%016llX"
|
||||
# endif
|
||||
|
||||
# ifdef THIRTY_TWO_BIT
|
||||
# ifdef BN_LLONG
|
||||
# if defined(_WIN32) && !defined(__GNUC__)
|
||||
# define BN_ULLONG unsigned __int64
|
||||
# define BN_MASK (0xffffffffffffffffI64)
|
||||
# else
|
||||
# define BN_ULLONG unsigned long long
|
||||
# define BN_MASK (0xffffffffffffffffLL)
|
||||
# endif
|
||||
# endif
|
||||
# define BN_ULONG unsigned int
|
||||
# define BN_LONG int
|
||||
# define BN_BITS 64
|
||||
# define BN_BYTES 4
|
||||
# define BN_BITS2 32
|
||||
# define BN_BITS4 16
|
||||
# define BN_MASK2 (0xffffffffL)
|
||||
# define BN_MASK2l (0xffff)
|
||||
# define BN_MASK2h1 (0xffff8000L)
|
||||
# define BN_MASK2h (0xffff0000L)
|
||||
# define BN_TBIT (0x80000000L)
|
||||
# define BN_DEC_CONV (1000000000L)
|
||||
# define BN_DEC_FMT1 "%u"
|
||||
# define BN_DEC_FMT2 "%09u"
|
||||
# define BN_DEC_NUM 9
|
||||
# define BN_HEX_FMT1 "%X"
|
||||
# define BN_HEX_FMT2 "%08X"
|
||||
# endif
|
||||
|
||||
# define BN_DEFAULT_BITS 1280
|
||||
# define BN_BITS2 (BN_BYTES * 8)
|
||||
# define BN_BITS (BN_BITS2 * 2)
|
||||
# define BN_TBIT ((BN_ULONG)1 << (BN_BITS2 - 1))
|
||||
|
||||
# define BN_FLG_MALLOCED 0x01
|
||||
# define BN_FLG_STATIC_DATA 0x02
|
||||
@ -269,150 +59,138 @@ extern "C" {
|
||||
* BN_mod_inverse() will call BN_mod_inverse_no_branch.
|
||||
*/
|
||||
# define BN_FLG_CONSTTIME 0x04
|
||||
# define BN_FLG_SECURE 0x08
|
||||
|
||||
# ifdef OPENSSL_NO_DEPRECATED
|
||||
# if OPENSSL_API_COMPAT < 0x00908000L
|
||||
/* deprecated name for the flag */
|
||||
# define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME
|
||||
/*
|
||||
* avoid leaking exponent information through timings
|
||||
* (BN_mod_exp_mont() will call BN_mod_exp_mont_consttime)
|
||||
*/
|
||||
# define BN_FLG_FREE 0x8000 /* used for debugging */
|
||||
# endif
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED
|
||||
# define BN_FLG_FREE 0x8000
|
||||
/* used for debuging */
|
||||
# endif
|
||||
# define BN_set_flags(b,n) ((b)->flags|=(n))
|
||||
# define BN_get_flags(b,n) ((b)->flags&(n))
|
||||
void BN_set_flags(BIGNUM *b, int n);
|
||||
int BN_get_flags(const BIGNUM *b, int n);
|
||||
|
||||
/* Values for |top| in BN_rand() */
|
||||
#define BN_RAND_TOP_ANY -1
|
||||
#define BN_RAND_TOP_ONE 0
|
||||
#define BN_RAND_TOP_TWO 1
|
||||
|
||||
/* Values for |bottom| in BN_rand() */
|
||||
#define BN_RAND_BOTTOM_ANY 0
|
||||
#define BN_RAND_BOTTOM_ODD 1
|
||||
|
||||
/*
|
||||
* get a clone of a BIGNUM with changed flags, for *temporary* use only (the
|
||||
* two BIGNUMs cannot not be used in parallel!)
|
||||
* two BIGNUMs cannot be used in parallel!). Also only for *read only* use. The
|
||||
* value |dest| should be a newly allocated BIGNUM obtained via BN_new() that
|
||||
* has not been otherwise initialised or used.
|
||||
*/
|
||||
# define BN_with_flags(dest,b,n) ((dest)->d=(b)->d, \
|
||||
(dest)->top=(b)->top, \
|
||||
(dest)->dmax=(b)->dmax, \
|
||||
(dest)->neg=(b)->neg, \
|
||||
(dest)->flags=(((dest)->flags & BN_FLG_MALLOCED) \
|
||||
| ((b)->flags & ~BN_FLG_MALLOCED) \
|
||||
| BN_FLG_STATIC_DATA \
|
||||
| (n)))
|
||||
void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags);
|
||||
|
||||
/* Already declared in ossl_typ.h */
|
||||
# if 0
|
||||
typedef struct bignum_st BIGNUM;
|
||||
/* Used for temp variables (declaration hidden in bn_lcl.h) */
|
||||
typedef struct bignum_ctx BN_CTX;
|
||||
typedef struct bn_blinding_st BN_BLINDING;
|
||||
typedef struct bn_mont_ctx_st BN_MONT_CTX;
|
||||
typedef struct bn_recp_ctx_st BN_RECP_CTX;
|
||||
typedef struct bn_gencb_st BN_GENCB;
|
||||
# endif
|
||||
|
||||
struct bignum_st {
|
||||
BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit
|
||||
* chunks. */
|
||||
int top; /* Index of last used d +1. */
|
||||
/* The next are internal book keeping for bn_expand. */
|
||||
int dmax; /* Size of the d array. */
|
||||
int neg; /* one if the number is negative */
|
||||
int flags;
|
||||
};
|
||||
|
||||
/* Used for montgomery multiplication */
|
||||
struct bn_mont_ctx_st {
|
||||
int ri; /* number of bits in R */
|
||||
BIGNUM RR; /* used to convert to montgomery form */
|
||||
BIGNUM N; /* The modulus */
|
||||
BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1 (Ni is only
|
||||
* stored for bignum algorithm) */
|
||||
BN_ULONG n0[2]; /* least significant word(s) of Ni; (type
|
||||
* changed with 0.9.9, was "BN_ULONG n0;"
|
||||
* before) */
|
||||
int flags;
|
||||
};
|
||||
|
||||
/*
|
||||
* Used for reciprocal division/mod functions It cannot be shared between
|
||||
* threads
|
||||
*/
|
||||
struct bn_recp_ctx_st {
|
||||
BIGNUM N; /* the divisor */
|
||||
BIGNUM Nr; /* the reciprocal */
|
||||
int num_bits;
|
||||
int shift;
|
||||
int flags;
|
||||
};
|
||||
|
||||
/* Used for slow "generation" functions. */
|
||||
struct bn_gencb_st {
|
||||
unsigned int ver; /* To handle binary (in)compatibility */
|
||||
void *arg; /* callback-specific data */
|
||||
union {
|
||||
/* if(ver==1) - handles old style callbacks */
|
||||
void (*cb_1) (int, int, void *);
|
||||
/* if(ver==2) - new callback style */
|
||||
int (*cb_2) (int, int, BN_GENCB *);
|
||||
} cb;
|
||||
};
|
||||
/* Wrapper function to make using BN_GENCB easier, */
|
||||
/* Wrapper function to make using BN_GENCB easier */
|
||||
int BN_GENCB_call(BN_GENCB *cb, int a, int b);
|
||||
/* Macro to populate a BN_GENCB structure with an "old"-style callback */
|
||||
# define BN_GENCB_set_old(gencb, callback, cb_arg) { \
|
||||
BN_GENCB *tmp_gencb = (gencb); \
|
||||
tmp_gencb->ver = 1; \
|
||||
tmp_gencb->arg = (cb_arg); \
|
||||
tmp_gencb->cb.cb_1 = (callback); }
|
||||
/* Macro to populate a BN_GENCB structure with a "new"-style callback */
|
||||
# define BN_GENCB_set(gencb, callback, cb_arg) { \
|
||||
BN_GENCB *tmp_gencb = (gencb); \
|
||||
tmp_gencb->ver = 2; \
|
||||
tmp_gencb->arg = (cb_arg); \
|
||||
tmp_gencb->cb.cb_2 = (callback); }
|
||||
|
||||
BN_GENCB *BN_GENCB_new(void);
|
||||
void BN_GENCB_free(BN_GENCB *cb);
|
||||
|
||||
/* Populate a BN_GENCB structure with an "old"-style callback */
|
||||
void BN_GENCB_set_old(BN_GENCB *gencb, void (*callback) (int, int, void *),
|
||||
void *cb_arg);
|
||||
|
||||
/* Populate a BN_GENCB structure with a "new"-style callback */
|
||||
void BN_GENCB_set(BN_GENCB *gencb, int (*callback) (int, int, BN_GENCB *),
|
||||
void *cb_arg);
|
||||
|
||||
void *BN_GENCB_get_arg(BN_GENCB *cb);
|
||||
|
||||
# define BN_prime_checks 0 /* default: select number of iterations based
|
||||
* on the size of the number */
|
||||
|
||||
/*
|
||||
* number of Miller-Rabin iterations for an error rate of less than 2^-80 for
|
||||
* random 'b'-bit input, b >= 100 (taken from table 4.4 in the Handbook of
|
||||
* Applied Cryptography [Menezes, van Oorschot, Vanstone; CRC Press 1996];
|
||||
* original paper: Damgaard, Landrock, Pomerance: Average case error
|
||||
* estimates for the strong probable prime test. -- Math. Comp. 61 (1993)
|
||||
* 177-194)
|
||||
* BN_prime_checks_for_size() returns the number of Miller-Rabin iterations
|
||||
* that will be done for checking that a random number is probably prime. The
|
||||
* error rate for accepting a composite number as prime depends on the size of
|
||||
* the prime |b|. The error rates used are for calculating an RSA key with 2 primes,
|
||||
* and so the level is what you would expect for a key of double the size of the
|
||||
* prime.
|
||||
*
|
||||
* This table is generated using the algorithm of FIPS PUB 186-4
|
||||
* Digital Signature Standard (DSS), section F.1, page 117.
|
||||
* (https://dx.doi.org/10.6028/NIST.FIPS.186-4)
|
||||
*
|
||||
* The following magma script was used to generate the output:
|
||||
* securitybits:=125;
|
||||
* k:=1024;
|
||||
* for t:=1 to 65 do
|
||||
* for M:=3 to Floor(2*Sqrt(k-1)-1) do
|
||||
* S:=0;
|
||||
* // Sum over m
|
||||
* for m:=3 to M do
|
||||
* s:=0;
|
||||
* // Sum over j
|
||||
* for j:=2 to m do
|
||||
* s+:=(RealField(32)!2)^-(j+(k-1)/j);
|
||||
* end for;
|
||||
* S+:=2^(m-(m-1)*t)*s;
|
||||
* end for;
|
||||
* A:=2^(k-2-M*t);
|
||||
* B:=8*(Pi(RealField(32))^2-6)/3*2^(k-2)*S;
|
||||
* pkt:=2.00743*Log(2)*k*2^-k*(A+B);
|
||||
* seclevel:=Floor(-Log(2,pkt));
|
||||
* if seclevel ge securitybits then
|
||||
* printf "k: %5o, security: %o bits (t: %o, M: %o)\n",k,seclevel,t,M;
|
||||
* break;
|
||||
* end if;
|
||||
* end for;
|
||||
* if seclevel ge securitybits then break; end if;
|
||||
* end for;
|
||||
*
|
||||
* It can be run online at:
|
||||
* http://magma.maths.usyd.edu.au/calc
|
||||
*
|
||||
* And will output:
|
||||
* k: 1024, security: 129 bits (t: 6, M: 23)
|
||||
*
|
||||
* k is the number of bits of the prime, securitybits is the level we want to
|
||||
* reach.
|
||||
*
|
||||
* prime length | RSA key size | # MR tests | security level
|
||||
* -------------+--------------|------------+---------------
|
||||
* (b) >= 6394 | >= 12788 | 3 | 256 bit
|
||||
* (b) >= 3747 | >= 7494 | 3 | 192 bit
|
||||
* (b) >= 1345 | >= 2690 | 4 | 128 bit
|
||||
* (b) >= 1080 | >= 2160 | 5 | 128 bit
|
||||
* (b) >= 852 | >= 1704 | 5 | 112 bit
|
||||
* (b) >= 476 | >= 952 | 5 | 80 bit
|
||||
* (b) >= 400 | >= 800 | 6 | 80 bit
|
||||
* (b) >= 347 | >= 694 | 7 | 80 bit
|
||||
* (b) >= 308 | >= 616 | 8 | 80 bit
|
||||
* (b) >= 55 | >= 110 | 27 | 64 bit
|
||||
* (b) >= 6 | >= 12 | 34 | 64 bit
|
||||
*/
|
||||
# define BN_prime_checks_for_size(b) ((b) >= 1300 ? 2 : \
|
||||
(b) >= 850 ? 3 : \
|
||||
(b) >= 650 ? 4 : \
|
||||
(b) >= 550 ? 5 : \
|
||||
(b) >= 450 ? 6 : \
|
||||
(b) >= 400 ? 7 : \
|
||||
(b) >= 350 ? 8 : \
|
||||
(b) >= 300 ? 9 : \
|
||||
(b) >= 250 ? 12 : \
|
||||
(b) >= 200 ? 15 : \
|
||||
(b) >= 150 ? 18 : \
|
||||
/* b >= 100 */ 27)
|
||||
|
||||
# define BN_prime_checks_for_size(b) ((b) >= 3747 ? 3 : \
|
||||
(b) >= 1345 ? 4 : \
|
||||
(b) >= 476 ? 5 : \
|
||||
(b) >= 400 ? 6 : \
|
||||
(b) >= 347 ? 7 : \
|
||||
(b) >= 308 ? 8 : \
|
||||
(b) >= 55 ? 27 : \
|
||||
/* b >= 6 */ 34)
|
||||
|
||||
# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
|
||||
|
||||
/* Note that BN_abs_is_word didn't work reliably for w == 0 until 0.9.8 */
|
||||
# define BN_abs_is_word(a,w) ((((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w))) || \
|
||||
(((w) == 0) && ((a)->top == 0)))
|
||||
# define BN_is_zero(a) ((a)->top == 0)
|
||||
# define BN_is_one(a) (BN_abs_is_word((a),1) && !(a)->neg)
|
||||
# define BN_is_word(a,w) (BN_abs_is_word((a),(w)) && (!(w) || !(a)->neg))
|
||||
# define BN_is_odd(a) (((a)->top > 0) && ((a)->d[0] & 1))
|
||||
int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w);
|
||||
int BN_is_zero(const BIGNUM *a);
|
||||
int BN_is_one(const BIGNUM *a);
|
||||
int BN_is_word(const BIGNUM *a, const BN_ULONG w);
|
||||
int BN_is_odd(const BIGNUM *a);
|
||||
|
||||
# define BN_one(a) (BN_set_word((a),1))
|
||||
# define BN_zero_ex(a) \
|
||||
do { \
|
||||
BIGNUM *_tmp_bn = (a); \
|
||||
_tmp_bn->top = 0; \
|
||||
_tmp_bn->neg = 0; \
|
||||
} while(0)
|
||||
# ifdef OPENSSL_NO_DEPRECATED
|
||||
|
||||
void BN_zero_ex(BIGNUM *a);
|
||||
|
||||
# if OPENSSL_API_COMPAT >= 0x00908000L
|
||||
# define BN_zero(a) BN_zero_ex(a)
|
||||
# else
|
||||
# define BN_zero(a) (BN_set_word((a),0))
|
||||
@ -421,26 +199,30 @@ int BN_GENCB_call(BN_GENCB *cb, int a, int b);
|
||||
const BIGNUM *BN_value_one(void);
|
||||
char *BN_options(void);
|
||||
BN_CTX *BN_CTX_new(void);
|
||||
# ifndef OPENSSL_NO_DEPRECATED
|
||||
void BN_CTX_init(BN_CTX *c);
|
||||
# endif
|
||||
BN_CTX *BN_CTX_secure_new(void);
|
||||
void BN_CTX_free(BN_CTX *c);
|
||||
void BN_CTX_start(BN_CTX *ctx);
|
||||
BIGNUM *BN_CTX_get(BN_CTX *ctx);
|
||||
void BN_CTX_end(BN_CTX *ctx);
|
||||
int BN_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||
int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||
int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||
int BN_rand_range(BIGNUM *rnd, const BIGNUM *range);
|
||||
int BN_priv_rand_range(BIGNUM *rnd, const BIGNUM *range);
|
||||
int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||
int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range);
|
||||
int BN_num_bits(const BIGNUM *a);
|
||||
int BN_num_bits_word(BN_ULONG);
|
||||
int BN_num_bits_word(BN_ULONG l);
|
||||
int BN_security_bits(int L, int N);
|
||||
BIGNUM *BN_new(void);
|
||||
void BN_init(BIGNUM *);
|
||||
BIGNUM *BN_secure_new(void);
|
||||
void BN_clear_free(BIGNUM *a);
|
||||
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b);
|
||||
void BN_swap(BIGNUM *a, BIGNUM *b);
|
||||
BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||
int BN_bn2bin(const BIGNUM *a, unsigned char *to);
|
||||
int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen);
|
||||
BIGNUM *BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||
int BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen);
|
||||
BIGNUM *BN_mpi2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||
int BN_bn2mpi(const BIGNUM *a, unsigned char *to);
|
||||
int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||
@ -455,10 +237,10 @@ int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx);
|
||||
*/
|
||||
void BN_set_negative(BIGNUM *b, int n);
|
||||
/** BN_is_negative returns 1 if the BIGNUM is negative
|
||||
* \param a pointer to the BIGNUM object
|
||||
* \param b pointer to the BIGNUM object
|
||||
* \return 1 if a < 0 and 0 otherwise
|
||||
*/
|
||||
# define BN_is_negative(a) ((a)->neg != 0)
|
||||
int BN_is_negative(const BIGNUM *b);
|
||||
|
||||
int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
|
||||
BN_CTX *ctx);
|
||||
@ -512,14 +294,10 @@ int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx);
|
||||
|
||||
int BN_mask_bits(BIGNUM *a, int n);
|
||||
# ifndef OPENSSL_NO_FP_API
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int BN_print_fp(FILE *fp, const BIGNUM *a);
|
||||
# endif
|
||||
# ifdef HEADER_BIO_H
|
||||
int BN_print(BIO *fp, const BIGNUM *a);
|
||||
# else
|
||||
int BN_print(void *fp, const BIGNUM *a);
|
||||
# endif
|
||||
int BN_print(BIO *bio, const BIGNUM *a);
|
||||
int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx);
|
||||
int BN_rshift(BIGNUM *r, const BIGNUM *a, int n);
|
||||
int BN_rshift1(BIGNUM *r, const BIGNUM *a);
|
||||
@ -545,17 +323,21 @@ BIGNUM *BN_mod_sqrt(BIGNUM *ret,
|
||||
void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);
|
||||
|
||||
/* Deprecated versions */
|
||||
# ifndef OPENSSL_NO_DEPRECATED
|
||||
BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe,
|
||||
const BIGNUM *add, const BIGNUM *rem,
|
||||
void (*callback) (int, int, void *), void *cb_arg);
|
||||
int BN_is_prime(const BIGNUM *p, int nchecks,
|
||||
void (*callback) (int, int, void *),
|
||||
BN_CTX *ctx, void *cb_arg);
|
||||
int BN_is_prime_fasttest(const BIGNUM *p, int nchecks,
|
||||
void (*callback) (int, int, void *), BN_CTX *ctx,
|
||||
void *cb_arg, int do_trial_division);
|
||||
# endif /* !defined(OPENSSL_NO_DEPRECATED) */
|
||||
DEPRECATEDIN_0_9_8(BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe,
|
||||
const BIGNUM *add,
|
||||
const BIGNUM *rem,
|
||||
void (*callback) (int, int,
|
||||
void *),
|
||||
void *cb_arg))
|
||||
DEPRECATEDIN_0_9_8(int
|
||||
BN_is_prime(const BIGNUM *p, int nchecks,
|
||||
void (*callback) (int, int, void *),
|
||||
BN_CTX *ctx, void *cb_arg))
|
||||
DEPRECATEDIN_0_9_8(int
|
||||
BN_is_prime_fasttest(const BIGNUM *p, int nchecks,
|
||||
void (*callback) (int, int, void *),
|
||||
BN_CTX *ctx, void *cb_arg,
|
||||
int do_trial_division))
|
||||
|
||||
/* Newer versions */
|
||||
int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add,
|
||||
@ -575,17 +357,16 @@ int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, BIGNUM *Xp1,
|
||||
BN_CTX *ctx, BN_GENCB *cb);
|
||||
|
||||
BN_MONT_CTX *BN_MONT_CTX_new(void);
|
||||
void BN_MONT_CTX_init(BN_MONT_CTX *ctx);
|
||||
int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
BN_MONT_CTX *mont, BN_CTX *ctx);
|
||||
# define BN_to_montgomery(r,a,mont,ctx) BN_mod_mul_montgomery(\
|
||||
(r),(a),&((mont)->RR),(mont),(ctx))
|
||||
int BN_from_montgomery(BIGNUM *r, const BIGNUM *a,
|
||||
BN_MONT_CTX *mont, BN_CTX *ctx);
|
||||
int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
|
||||
BN_CTX *ctx);
|
||||
int BN_from_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
|
||||
BN_CTX *ctx);
|
||||
void BN_MONT_CTX_free(BN_MONT_CTX *mont);
|
||||
int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx);
|
||||
BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from);
|
||||
BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock,
|
||||
BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock,
|
||||
const BIGNUM *mod, BN_CTX *ctx);
|
||||
|
||||
/* BN_BLINDING flags */
|
||||
@ -600,11 +381,12 @@ int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
|
||||
int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *);
|
||||
int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b,
|
||||
BN_CTX *);
|
||||
# ifndef OPENSSL_NO_DEPRECATED
|
||||
unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *);
|
||||
void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long);
|
||||
# endif
|
||||
CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *);
|
||||
|
||||
int BN_BLINDING_is_current_thread(BN_BLINDING *b);
|
||||
void BN_BLINDING_set_current_thread(BN_BLINDING *b);
|
||||
int BN_BLINDING_lock(BN_BLINDING *b);
|
||||
int BN_BLINDING_unlock(BN_BLINDING *b);
|
||||
|
||||
unsigned long BN_BLINDING_get_flags(const BN_BLINDING *);
|
||||
void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);
|
||||
BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
|
||||
@ -617,12 +399,10 @@ BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
|
||||
BN_MONT_CTX *m_ctx),
|
||||
BN_MONT_CTX *m_ctx);
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED
|
||||
void BN_set_params(int mul, int high, int low, int mont);
|
||||
int BN_get_params(int which); /* 0, mul, 1 high, 2 low, 3 mont */
|
||||
# endif
|
||||
DEPRECATEDIN_0_9_8(void BN_set_params(int mul, int high, int low, int mont))
|
||||
DEPRECATEDIN_0_9_8(int BN_get_params(int which)) /* 0, mul, 1 high, 2 low, 3
|
||||
* mont */
|
||||
|
||||
void BN_RECP_CTX_init(BN_RECP_CTX *recp);
|
||||
BN_RECP_CTX *BN_RECP_CTX_new(void);
|
||||
void BN_RECP_CTX_free(BN_RECP_CTX *recp);
|
||||
int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *rdiv, BN_CTX *ctx);
|
||||
@ -720,230 +500,40 @@ const BIGNUM *BN_get0_nist_prime_256(void);
|
||||
const BIGNUM *BN_get0_nist_prime_384(void);
|
||||
const BIGNUM *BN_get0_nist_prime_521(void);
|
||||
|
||||
/* library internal functions */
|
||||
int (*BN_nist_mod_func(const BIGNUM *p)) (BIGNUM *r, const BIGNUM *a,
|
||||
const BIGNUM *field, BN_CTX *ctx);
|
||||
|
||||
# define bn_expand(a,bits) \
|
||||
( \
|
||||
bits > (INT_MAX - BN_BITS2 + 1) ? \
|
||||
NULL \
|
||||
: \
|
||||
(((bits+BN_BITS2-1)/BN_BITS2) <= (a)->dmax) ? \
|
||||
(a) \
|
||||
: \
|
||||
bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2) \
|
||||
)
|
||||
|
||||
# define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words)))
|
||||
BIGNUM *bn_expand2(BIGNUM *a, int words);
|
||||
# ifndef OPENSSL_NO_DEPRECATED
|
||||
BIGNUM *bn_dup_expand(const BIGNUM *a, int words); /* unused */
|
||||
# endif
|
||||
|
||||
/*-
|
||||
* Bignum consistency macros
|
||||
* There is one "API" macro, bn_fix_top(), for stripping leading zeroes from
|
||||
* bignum data after direct manipulations on the data. There is also an
|
||||
* "internal" macro, bn_check_top(), for verifying that there are no leading
|
||||
* zeroes. Unfortunately, some auditing is required due to the fact that
|
||||
* bn_fix_top() has become an overabused duct-tape because bignum data is
|
||||
* occasionally passed around in an inconsistent state. So the following
|
||||
* changes have been made to sort this out;
|
||||
* - bn_fix_top()s implementation has been moved to bn_correct_top()
|
||||
* - if BN_DEBUG isn't defined, bn_fix_top() maps to bn_correct_top(), and
|
||||
* bn_check_top() is as before.
|
||||
* - if BN_DEBUG *is* defined;
|
||||
* - bn_check_top() tries to pollute unused words even if the bignum 'top' is
|
||||
* consistent. (ed: only if BN_DEBUG_RAND is defined)
|
||||
* - bn_fix_top() maps to bn_check_top() rather than "fixing" anything.
|
||||
* The idea is to have debug builds flag up inconsistent bignums when they
|
||||
* occur. If that occurs in a bn_fix_top(), we examine the code in question; if
|
||||
* the use of bn_fix_top() was appropriate (ie. it follows directly after code
|
||||
* that manipulates the bignum) it is converted to bn_correct_top(), and if it
|
||||
* was not appropriate, we convert it permanently to bn_check_top() and track
|
||||
* down the cause of the bug. Eventually, no internal code should be using the
|
||||
* bn_fix_top() macro. External applications and libraries should try this with
|
||||
* their own code too, both in terms of building against the openssl headers
|
||||
* with BN_DEBUG defined *and* linking with a version of OpenSSL built with it
|
||||
* defined. This not only improves external code, it provides more test
|
||||
* coverage for openssl's own code.
|
||||
*/
|
||||
|
||||
# ifdef BN_DEBUG
|
||||
|
||||
/* We only need assert() when debugging */
|
||||
# include <assert.h>
|
||||
|
||||
# ifdef BN_DEBUG_RAND
|
||||
/* To avoid "make update" cvs wars due to BN_DEBUG, use some tricks */
|
||||
# ifndef RAND_pseudo_bytes
|
||||
int RAND_pseudo_bytes(unsigned char *buf, int num);
|
||||
# define BN_DEBUG_TRIX
|
||||
# endif
|
||||
# define bn_pollute(a) \
|
||||
do { \
|
||||
const BIGNUM *_bnum1 = (a); \
|
||||
if(_bnum1->top < _bnum1->dmax) { \
|
||||
unsigned char _tmp_char; \
|
||||
/* We cast away const without the compiler knowing, any \
|
||||
* *genuinely* constant variables that aren't mutable \
|
||||
* wouldn't be constructed with top!=dmax. */ \
|
||||
BN_ULONG *_not_const; \
|
||||
memcpy(&_not_const, &_bnum1->d, sizeof(BN_ULONG*)); \
|
||||
/* Debug only - safe to ignore error return */ \
|
||||
RAND_pseudo_bytes(&_tmp_char, 1); \
|
||||
memset((unsigned char *)(_not_const + _bnum1->top), _tmp_char, \
|
||||
(_bnum1->dmax - _bnum1->top) * sizeof(BN_ULONG)); \
|
||||
} \
|
||||
} while(0)
|
||||
# ifdef BN_DEBUG_TRIX
|
||||
# undef RAND_pseudo_bytes
|
||||
# endif
|
||||
# else
|
||||
# define bn_pollute(a)
|
||||
# endif
|
||||
# define bn_check_top(a) \
|
||||
do { \
|
||||
const BIGNUM *_bnum2 = (a); \
|
||||
if (_bnum2 != NULL) { \
|
||||
assert((_bnum2->top == 0) || \
|
||||
(_bnum2->d[_bnum2->top - 1] != 0)); \
|
||||
bn_pollute(_bnum2); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
# define bn_fix_top(a) bn_check_top(a)
|
||||
|
||||
# define bn_check_size(bn, bits) bn_wcheck_size(bn, ((bits+BN_BITS2-1))/BN_BITS2)
|
||||
# define bn_wcheck_size(bn, words) \
|
||||
do { \
|
||||
const BIGNUM *_bnum2 = (bn); \
|
||||
assert((words) <= (_bnum2)->dmax && (words) >= (_bnum2)->top); \
|
||||
/* avoid unused variable warning with NDEBUG */ \
|
||||
(void)(_bnum2); \
|
||||
} while(0)
|
||||
|
||||
# else /* !BN_DEBUG */
|
||||
|
||||
# define bn_pollute(a)
|
||||
# define bn_check_top(a)
|
||||
# define bn_fix_top(a) bn_correct_top(a)
|
||||
# define bn_check_size(bn, bits)
|
||||
# define bn_wcheck_size(bn, words)
|
||||
|
||||
# endif
|
||||
|
||||
# define bn_correct_top(a) \
|
||||
{ \
|
||||
BN_ULONG *ftl; \
|
||||
int tmp_top = (a)->top; \
|
||||
if (tmp_top > 0) \
|
||||
{ \
|
||||
for (ftl= &((a)->d[tmp_top-1]); tmp_top > 0; tmp_top--) \
|
||||
if (*(ftl--)) break; \
|
||||
(a)->top = tmp_top; \
|
||||
} \
|
||||
bn_pollute(a); \
|
||||
}
|
||||
|
||||
BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num,
|
||||
BN_ULONG w);
|
||||
BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w);
|
||||
void bn_sqr_words(BN_ULONG *rp, const BN_ULONG *ap, int num);
|
||||
BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d);
|
||||
BN_ULONG bn_add_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
|
||||
int num);
|
||||
BN_ULONG bn_sub_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
|
||||
int num);
|
||||
int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range,
|
||||
const BIGNUM *priv, const unsigned char *message,
|
||||
size_t message_len, BN_CTX *ctx);
|
||||
|
||||
/* Primes from RFC 2409 */
|
||||
BIGNUM *get_rfc2409_prime_768(BIGNUM *bn);
|
||||
BIGNUM *get_rfc2409_prime_1024(BIGNUM *bn);
|
||||
BIGNUM *BN_get_rfc2409_prime_768(BIGNUM *bn);
|
||||
BIGNUM *BN_get_rfc2409_prime_1024(BIGNUM *bn);
|
||||
|
||||
/* Primes from RFC 3526 */
|
||||
BIGNUM *get_rfc3526_prime_1536(BIGNUM *bn);
|
||||
BIGNUM *get_rfc3526_prime_2048(BIGNUM *bn);
|
||||
BIGNUM *get_rfc3526_prime_3072(BIGNUM *bn);
|
||||
BIGNUM *get_rfc3526_prime_4096(BIGNUM *bn);
|
||||
BIGNUM *get_rfc3526_prime_6144(BIGNUM *bn);
|
||||
BIGNUM *get_rfc3526_prime_8192(BIGNUM *bn);
|
||||
BIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn);
|
||||
BIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn);
|
||||
BIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn);
|
||||
BIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn);
|
||||
BIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn);
|
||||
BIGNUM *BN_get_rfc3526_prime_8192(BIGNUM *bn);
|
||||
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define get_rfc2409_prime_768 BN_get_rfc2409_prime_768
|
||||
# define get_rfc2409_prime_1024 BN_get_rfc2409_prime_1024
|
||||
# define get_rfc3526_prime_1536 BN_get_rfc3526_prime_1536
|
||||
# define get_rfc3526_prime_2048 BN_get_rfc3526_prime_2048
|
||||
# define get_rfc3526_prime_3072 BN_get_rfc3526_prime_3072
|
||||
# define get_rfc3526_prime_4096 BN_get_rfc3526_prime_4096
|
||||
# define get_rfc3526_prime_6144 BN_get_rfc3526_prime_6144
|
||||
# define get_rfc3526_prime_8192 BN_get_rfc3526_prime_8192
|
||||
# endif
|
||||
|
||||
int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_BN_strings(void);
|
||||
|
||||
/* Error codes for the BN functions. */
|
||||
|
||||
/* Function codes. */
|
||||
# define BN_F_BNRAND 127
|
||||
# define BN_F_BN_BLINDING_CONVERT_EX 100
|
||||
# define BN_F_BN_BLINDING_CREATE_PARAM 128
|
||||
# define BN_F_BN_BLINDING_INVERT_EX 101
|
||||
# define BN_F_BN_BLINDING_NEW 102
|
||||
# define BN_F_BN_BLINDING_UPDATE 103
|
||||
# define BN_F_BN_BN2DEC 104
|
||||
# define BN_F_BN_BN2HEX 105
|
||||
# define BN_F_BN_CTX_GET 116
|
||||
# define BN_F_BN_CTX_NEW 106
|
||||
# define BN_F_BN_CTX_START 129
|
||||
# define BN_F_BN_DIV 107
|
||||
# define BN_F_BN_DIV_NO_BRANCH 138
|
||||
# define BN_F_BN_DIV_RECP 130
|
||||
# define BN_F_BN_EXP 123
|
||||
# define BN_F_BN_EXPAND2 108
|
||||
# define BN_F_BN_EXPAND_INTERNAL 120
|
||||
# define BN_F_BN_GF2M_MOD 131
|
||||
# define BN_F_BN_GF2M_MOD_EXP 132
|
||||
# define BN_F_BN_GF2M_MOD_MUL 133
|
||||
# define BN_F_BN_GF2M_MOD_SOLVE_QUAD 134
|
||||
# define BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR 135
|
||||
# define BN_F_BN_GF2M_MOD_SQR 136
|
||||
# define BN_F_BN_GF2M_MOD_SQRT 137
|
||||
# define BN_F_BN_LSHIFT 145
|
||||
# define BN_F_BN_MOD_EXP2_MONT 118
|
||||
# define BN_F_BN_MOD_EXP_MONT 109
|
||||
# define BN_F_BN_MOD_EXP_MONT_CONSTTIME 124
|
||||
# define BN_F_BN_MOD_EXP_MONT_WORD 117
|
||||
# define BN_F_BN_MOD_EXP_RECP 125
|
||||
# define BN_F_BN_MOD_EXP_SIMPLE 126
|
||||
# define BN_F_BN_MOD_INVERSE 110
|
||||
# define BN_F_BN_MOD_INVERSE_NO_BRANCH 139
|
||||
# define BN_F_BN_MOD_LSHIFT_QUICK 119
|
||||
# define BN_F_BN_MOD_MUL_RECIPROCAL 111
|
||||
# define BN_F_BN_MOD_SQRT 121
|
||||
# define BN_F_BN_MPI2BN 112
|
||||
# define BN_F_BN_NEW 113
|
||||
# define BN_F_BN_RAND 114
|
||||
# define BN_F_BN_RAND_RANGE 122
|
||||
# define BN_F_BN_RSHIFT 146
|
||||
# define BN_F_BN_USUB 115
|
||||
|
||||
/* Reason codes. */
|
||||
# define BN_R_ARG2_LT_ARG3 100
|
||||
# define BN_R_BAD_RECIPROCAL 101
|
||||
# define BN_R_BIGNUM_TOO_LONG 114
|
||||
# define BN_R_BITS_TOO_SMALL 118
|
||||
# define BN_R_CALLED_WITH_EVEN_MODULUS 102
|
||||
# define BN_R_DIV_BY_ZERO 103
|
||||
# define BN_R_ENCODING_ERROR 104
|
||||
# define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105
|
||||
# define BN_R_INPUT_NOT_REDUCED 110
|
||||
# define BN_R_INVALID_LENGTH 106
|
||||
# define BN_R_INVALID_RANGE 115
|
||||
# define BN_R_INVALID_SHIFT 119
|
||||
# define BN_R_NOT_A_SQUARE 111
|
||||
# define BN_R_NOT_INITIALIZED 107
|
||||
# define BN_R_NO_INVERSE 108
|
||||
# define BN_R_NO_SOLUTION 116
|
||||
# define BN_R_P_IS_NOT_PRIME 112
|
||||
# define BN_R_TOO_MANY_ITERATIONS 113
|
||||
# define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
100
submodules/MtProtoKit/openssl/openssl/bnerr.h
Normal file
100
submodules/MtProtoKit/openssl/openssl/bnerr.h
Normal file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_BNERR_H
|
||||
# define HEADER_BNERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_BN_strings(void);
|
||||
|
||||
/*
|
||||
* BN function codes.
|
||||
*/
|
||||
# define BN_F_BNRAND 127
|
||||
# define BN_F_BNRAND_RANGE 138
|
||||
# define BN_F_BN_BLINDING_CONVERT_EX 100
|
||||
# define BN_F_BN_BLINDING_CREATE_PARAM 128
|
||||
# define BN_F_BN_BLINDING_INVERT_EX 101
|
||||
# define BN_F_BN_BLINDING_NEW 102
|
||||
# define BN_F_BN_BLINDING_UPDATE 103
|
||||
# define BN_F_BN_BN2DEC 104
|
||||
# define BN_F_BN_BN2HEX 105
|
||||
# define BN_F_BN_COMPUTE_WNAF 142
|
||||
# define BN_F_BN_CTX_GET 116
|
||||
# define BN_F_BN_CTX_NEW 106
|
||||
# define BN_F_BN_CTX_START 129
|
||||
# define BN_F_BN_DIV 107
|
||||
# define BN_F_BN_DIV_RECP 130
|
||||
# define BN_F_BN_EXP 123
|
||||
# define BN_F_BN_EXPAND_INTERNAL 120
|
||||
# define BN_F_BN_GENCB_NEW 143
|
||||
# define BN_F_BN_GENERATE_DSA_NONCE 140
|
||||
# define BN_F_BN_GENERATE_PRIME_EX 141
|
||||
# define BN_F_BN_GF2M_MOD 131
|
||||
# define BN_F_BN_GF2M_MOD_EXP 132
|
||||
# define BN_F_BN_GF2M_MOD_MUL 133
|
||||
# define BN_F_BN_GF2M_MOD_SOLVE_QUAD 134
|
||||
# define BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR 135
|
||||
# define BN_F_BN_GF2M_MOD_SQR 136
|
||||
# define BN_F_BN_GF2M_MOD_SQRT 137
|
||||
# define BN_F_BN_LSHIFT 145
|
||||
# define BN_F_BN_MOD_EXP2_MONT 118
|
||||
# define BN_F_BN_MOD_EXP_MONT 109
|
||||
# define BN_F_BN_MOD_EXP_MONT_CONSTTIME 124
|
||||
# define BN_F_BN_MOD_EXP_MONT_WORD 117
|
||||
# define BN_F_BN_MOD_EXP_RECP 125
|
||||
# define BN_F_BN_MOD_EXP_SIMPLE 126
|
||||
# define BN_F_BN_MOD_INVERSE 110
|
||||
# define BN_F_BN_MOD_INVERSE_NO_BRANCH 139
|
||||
# define BN_F_BN_MOD_LSHIFT_QUICK 119
|
||||
# define BN_F_BN_MOD_SQRT 121
|
||||
# define BN_F_BN_MONT_CTX_NEW 149
|
||||
# define BN_F_BN_MPI2BN 112
|
||||
# define BN_F_BN_NEW 113
|
||||
# define BN_F_BN_POOL_GET 147
|
||||
# define BN_F_BN_RAND 114
|
||||
# define BN_F_BN_RAND_RANGE 122
|
||||
# define BN_F_BN_RECP_CTX_NEW 150
|
||||
# define BN_F_BN_RSHIFT 146
|
||||
# define BN_F_BN_SET_WORDS 144
|
||||
# define BN_F_BN_STACK_PUSH 148
|
||||
# define BN_F_BN_USUB 115
|
||||
|
||||
/*
|
||||
* BN reason codes.
|
||||
*/
|
||||
# define BN_R_ARG2_LT_ARG3 100
|
||||
# define BN_R_BAD_RECIPROCAL 101
|
||||
# define BN_R_BIGNUM_TOO_LONG 114
|
||||
# define BN_R_BITS_TOO_SMALL 118
|
||||
# define BN_R_CALLED_WITH_EVEN_MODULUS 102
|
||||
# define BN_R_DIV_BY_ZERO 103
|
||||
# define BN_R_ENCODING_ERROR 104
|
||||
# define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105
|
||||
# define BN_R_INPUT_NOT_REDUCED 110
|
||||
# define BN_R_INVALID_LENGTH 106
|
||||
# define BN_R_INVALID_RANGE 115
|
||||
# define BN_R_INVALID_SHIFT 119
|
||||
# define BN_R_NOT_A_SQUARE 111
|
||||
# define BN_R_NOT_INITIALIZED 107
|
||||
# define BN_R_NO_INVERSE 108
|
||||
# define BN_R_NO_SOLUTION 116
|
||||
# define BN_R_PRIVATE_KEY_TOO_LARGE 117
|
||||
# define BN_R_P_IS_NOT_PRIME 112
|
||||
# define BN_R_TOO_MANY_ITERATIONS 113
|
||||
# define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109
|
||||
|
||||
#endif
|
@ -1,125 +1,58 @@
|
||||
/* crypto/buffer/buffer.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_BUFFER_H
|
||||
# define HEADER_BUFFER_H
|
||||
|
||||
# include <openssl/ossl_typ.h>
|
||||
# ifndef HEADER_CRYPTO_H
|
||||
# include <openssl/crypto.h>
|
||||
# endif
|
||||
# include <openssl/buffererr.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# include <stddef.h>
|
||||
# include <sys/types.h>
|
||||
|
||||
# if !defined(NO_SYS_TYPES_H)
|
||||
# include <sys/types.h>
|
||||
# endif
|
||||
|
||||
/* Already declared in ossl_typ.h */
|
||||
/* typedef struct buf_mem_st BUF_MEM; */
|
||||
/*
|
||||
* These names are outdated as of OpenSSL 1.1; a future release
|
||||
* will move them to be deprecated.
|
||||
*/
|
||||
# define BUF_strdup(s) OPENSSL_strdup(s)
|
||||
# define BUF_strndup(s, size) OPENSSL_strndup(s, size)
|
||||
# define BUF_memdup(data, size) OPENSSL_memdup(data, size)
|
||||
# define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size)
|
||||
# define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size)
|
||||
# define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen)
|
||||
|
||||
struct buf_mem_st {
|
||||
size_t length; /* current number of bytes */
|
||||
char *data;
|
||||
size_t max; /* size of buffer */
|
||||
unsigned long flags;
|
||||
};
|
||||
|
||||
# define BUF_MEM_FLAG_SECURE 0x01
|
||||
|
||||
BUF_MEM *BUF_MEM_new(void);
|
||||
BUF_MEM *BUF_MEM_new_ex(unsigned long flags);
|
||||
void BUF_MEM_free(BUF_MEM *a);
|
||||
int BUF_MEM_grow(BUF_MEM *str, size_t len);
|
||||
int BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
|
||||
size_t BUF_strnlen(const char *str, size_t maxlen);
|
||||
char *BUF_strdup(const char *str);
|
||||
|
||||
/*
|
||||
* Like strndup, but in addition, explicitly guarantees to never read past the
|
||||
* first |siz| bytes of |str|.
|
||||
*/
|
||||
char *BUF_strndup(const char *str, size_t siz);
|
||||
|
||||
void *BUF_memdup(const void *data, size_t siz);
|
||||
size_t BUF_MEM_grow(BUF_MEM *str, size_t len);
|
||||
size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
|
||||
void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz);
|
||||
|
||||
/* safe string functions */
|
||||
size_t BUF_strlcpy(char *dst, const char *src, size_t siz);
|
||||
size_t BUF_strlcat(char *dst, const char *src, size_t siz);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_BUF_strings(void);
|
||||
|
||||
/* Error codes for the BUF functions. */
|
||||
|
||||
/* Function codes. */
|
||||
# define BUF_F_BUF_MEMDUP 103
|
||||
# define BUF_F_BUF_MEM_GROW 100
|
||||
# define BUF_F_BUF_MEM_GROW_CLEAN 105
|
||||
# define BUF_F_BUF_MEM_NEW 101
|
||||
# define BUF_F_BUF_STRDUP 102
|
||||
# define BUF_F_BUF_STRNDUP 104
|
||||
|
||||
/* Reason codes. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
34
submodules/MtProtoKit/openssl/openssl/buffererr.h
Normal file
34
submodules/MtProtoKit/openssl/openssl/buffererr.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_BUFERR_H
|
||||
# define HEADER_BUFERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_BUF_strings(void);
|
||||
|
||||
/*
|
||||
* BUF function codes.
|
||||
*/
|
||||
# define BUF_F_BUF_MEM_GROW 100
|
||||
# define BUF_F_BUF_MEM_GROW_CLEAN 105
|
||||
# define BUF_F_BUF_MEM_NEW 101
|
||||
|
||||
/*
|
||||
* BUF reason codes.
|
||||
*/
|
||||
|
||||
#endif
|
@ -1,52 +1,10 @@
|
||||
/* crypto/camellia/camellia.h */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 2006 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* openssl-core@openssl.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
/*
|
||||
* Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CAMELLIA_H
|
||||
@ -54,11 +12,11 @@
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifdef OPENSSL_NO_CAMELLIA
|
||||
# error CAMELLIA is disabled.
|
||||
# endif
|
||||
|
||||
# ifndef OPENSSL_NO_CAMELLIA
|
||||
# include <stddef.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# define CAMELLIA_ENCRYPT 1
|
||||
# define CAMELLIA_DECRYPT 0
|
||||
@ -68,10 +26,6 @@
|
||||
* Both sizes are in bytes.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This should be a hidden type, but EVP requires that the size be known */
|
||||
|
||||
# define CAMELLIA_BLOCK_SIZE 16
|
||||
@ -90,10 +44,6 @@ struct camellia_key_st {
|
||||
};
|
||||
typedef struct camellia_key_st CAMELLIA_KEY;
|
||||
|
||||
# ifdef OPENSSL_FIPS
|
||||
int private_Camellia_set_key(const unsigned char *userKey, const int bits,
|
||||
CAMELLIA_KEY *key);
|
||||
# endif
|
||||
int Camellia_set_key(const unsigned char *userKey, const int bits,
|
||||
CAMELLIA_KEY *key);
|
||||
|
||||
@ -125,8 +75,9 @@ void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE],
|
||||
unsigned int *num);
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif /* !HEADER_Camellia_H */
|
||||
#endif
|
||||
|
@ -1,72 +1,20 @@
|
||||
/* crypto/cast/cast.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CAST_H
|
||||
# define HEADER_CAST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifdef OPENSSL_NO_CAST
|
||||
# error CAST is disabled.
|
||||
# ifndef OPENSSL_NO_CAST
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# define CAST_ENCRYPT 1
|
||||
@ -82,9 +30,6 @@ typedef struct cast_key_st {
|
||||
int short_key; /* Use reduced rounds for short key */
|
||||
} CAST_KEY;
|
||||
|
||||
# ifdef OPENSSL_FIPS
|
||||
void private_CAST_set_key(CAST_KEY *key, int len, const unsigned char *data);
|
||||
# endif
|
||||
void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data);
|
||||
void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const CAST_KEY *key, int enc);
|
||||
@ -100,8 +45,9 @@ void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, const CAST_KEY *schedule,
|
||||
unsigned char *ivec, int *num);
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
@ -1,60 +1,17 @@
|
||||
/* crypto/cmac/cmac.h */
|
||||
/*
|
||||
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
|
||||
* project.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 2010 The OpenSSL Project. All rights reserved.
|
||||
* Copyright 2010-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* licensing@OpenSSL.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CMAC_H
|
||||
# define HEADER_CMAC_H
|
||||
|
||||
# ifndef OPENSSL_NO_CMAC
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -79,4 +36,6 @@ int CMAC_resume(CMAC_CTX *ctx);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
@ -1,69 +1,24 @@
|
||||
/* crypto/cms/cms.h */
|
||||
/*
|
||||
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
|
||||
* project.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 2008 The OpenSSL Project. All rights reserved.
|
||||
* Copyright 2008-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* licensing@OpenSSL.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CMS_H
|
||||
# define HEADER_CMS_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_CMS
|
||||
# include <openssl/x509.h>
|
||||
|
||||
# ifdef OPENSSL_NO_CMS
|
||||
# error CMS is disabled.
|
||||
# endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
# include <openssl/x509v3.h>
|
||||
# include <openssl/cmserr.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# endif
|
||||
|
||||
typedef struct CMS_ContentInfo_st CMS_ContentInfo;
|
||||
typedef struct CMS_SignerInfo_st CMS_SignerInfo;
|
||||
@ -75,9 +30,10 @@ typedef struct CMS_Receipt_st CMS_Receipt;
|
||||
typedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey;
|
||||
typedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute;
|
||||
|
||||
DECLARE_STACK_OF(CMS_SignerInfo)
|
||||
DECLARE_STACK_OF(GENERAL_NAMES)
|
||||
DECLARE_STACK_OF(CMS_RecipientEncryptedKey)
|
||||
DEFINE_STACK_OF(CMS_SignerInfo)
|
||||
DEFINE_STACK_OF(CMS_RecipientEncryptedKey)
|
||||
DEFINE_STACK_OF(CMS_RecipientInfo)
|
||||
DEFINE_STACK_OF(CMS_RevocationInfoChoice)
|
||||
DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo)
|
||||
DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest)
|
||||
DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
|
||||
@ -116,8 +72,9 @@ DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
|
||||
# define CMS_USE_KEYID 0x10000
|
||||
# define CMS_DEBUG_DECRYPT 0x20000
|
||||
# define CMS_KEY_PARAM 0x40000
|
||||
# define CMS_ASCIICRLF 0x80000
|
||||
|
||||
const ASN1_OBJECT *CMS_get0_type(CMS_ContentInfo *cms);
|
||||
const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms);
|
||||
|
||||
BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont);
|
||||
int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio);
|
||||
@ -188,7 +145,7 @@ int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert,
|
||||
int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert);
|
||||
int CMS_decrypt_set1_key(CMS_ContentInfo *cms,
|
||||
unsigned char *key, size_t keylen,
|
||||
unsigned char *id, size_t idlen);
|
||||
const unsigned char *id, size_t idlen);
|
||||
int CMS_decrypt_set1_password(CMS_ContentInfo *cms,
|
||||
unsigned char *pass, ossl_ssize_t passlen);
|
||||
|
||||
@ -290,7 +247,7 @@ int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap);
|
||||
int CMS_signed_get_attr_count(const CMS_SignerInfo *si);
|
||||
int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
|
||||
int lastpos);
|
||||
int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, ASN1_OBJECT *obj,
|
||||
int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj,
|
||||
int lastpos);
|
||||
X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc);
|
||||
X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc);
|
||||
@ -304,14 +261,14 @@ int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si,
|
||||
int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si,
|
||||
const char *attrname, int type,
|
||||
const void *bytes, int len);
|
||||
void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,
|
||||
void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *oid,
|
||||
int lastpos, int type);
|
||||
|
||||
int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si);
|
||||
int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
|
||||
int lastpos);
|
||||
int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si, ASN1_OBJECT *obj,
|
||||
int lastpos);
|
||||
int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si,
|
||||
const ASN1_OBJECT *obj, int lastpos);
|
||||
X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc);
|
||||
X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc);
|
||||
int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
|
||||
@ -327,8 +284,6 @@ int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si,
|
||||
void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,
|
||||
int lastpos, int type);
|
||||
|
||||
# ifdef HEADER_X509V3_H
|
||||
|
||||
int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr);
|
||||
CMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int idlen,
|
||||
int allorfirst,
|
||||
@ -341,7 +296,6 @@ void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr,
|
||||
int *pallorfirst,
|
||||
STACK_OF(GENERAL_NAMES) **plist,
|
||||
STACK_OF(GENERAL_NAMES) **prto);
|
||||
# endif
|
||||
int CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri,
|
||||
X509_ALGOR **palg,
|
||||
ASN1_OCTET_STRING **pukm);
|
||||
@ -373,183 +327,13 @@ int CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms,
|
||||
int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg,
|
||||
ASN1_OCTET_STRING *ukm, int keylen);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_CMS_strings(void);
|
||||
/* Backward compatibility for spelling errors. */
|
||||
# define CMS_R_UNKNOWN_DIGEST_ALGORITM CMS_R_UNKNOWN_DIGEST_ALGORITHM
|
||||
# define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE \
|
||||
CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE
|
||||
|
||||
/* Error codes for the CMS functions. */
|
||||
|
||||
/* Function codes. */
|
||||
# define CMS_F_CHECK_CONTENT 99
|
||||
# define CMS_F_CMS_ADD0_CERT 164
|
||||
# define CMS_F_CMS_ADD0_RECIPIENT_KEY 100
|
||||
# define CMS_F_CMS_ADD0_RECIPIENT_PASSWORD 165
|
||||
# define CMS_F_CMS_ADD1_RECEIPTREQUEST 158
|
||||
# define CMS_F_CMS_ADD1_RECIPIENT_CERT 101
|
||||
# define CMS_F_CMS_ADD1_SIGNER 102
|
||||
# define CMS_F_CMS_ADD1_SIGNINGTIME 103
|
||||
# define CMS_F_CMS_COMPRESS 104
|
||||
# define CMS_F_CMS_COMPRESSEDDATA_CREATE 105
|
||||
# define CMS_F_CMS_COMPRESSEDDATA_INIT_BIO 106
|
||||
# define CMS_F_CMS_COPY_CONTENT 107
|
||||
# define CMS_F_CMS_COPY_MESSAGEDIGEST 108
|
||||
# define CMS_F_CMS_DATA 109
|
||||
# define CMS_F_CMS_DATAFINAL 110
|
||||
# define CMS_F_CMS_DATAINIT 111
|
||||
# define CMS_F_CMS_DECRYPT 112
|
||||
# define CMS_F_CMS_DECRYPT_SET1_KEY 113
|
||||
# define CMS_F_CMS_DECRYPT_SET1_PASSWORD 166
|
||||
# define CMS_F_CMS_DECRYPT_SET1_PKEY 114
|
||||
# define CMS_F_CMS_DIGESTALGORITHM_FIND_CTX 115
|
||||
# define CMS_F_CMS_DIGESTALGORITHM_INIT_BIO 116
|
||||
# define CMS_F_CMS_DIGESTEDDATA_DO_FINAL 117
|
||||
# define CMS_F_CMS_DIGEST_VERIFY 118
|
||||
# define CMS_F_CMS_ENCODE_RECEIPT 161
|
||||
# define CMS_F_CMS_ENCRYPT 119
|
||||
# define CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO 120
|
||||
# define CMS_F_CMS_ENCRYPTEDDATA_DECRYPT 121
|
||||
# define CMS_F_CMS_ENCRYPTEDDATA_ENCRYPT 122
|
||||
# define CMS_F_CMS_ENCRYPTEDDATA_SET1_KEY 123
|
||||
# define CMS_F_CMS_ENVELOPEDDATA_CREATE 124
|
||||
# define CMS_F_CMS_ENVELOPEDDATA_INIT_BIO 125
|
||||
# define CMS_F_CMS_ENVELOPED_DATA_INIT 126
|
||||
# define CMS_F_CMS_ENV_ASN1_CTRL 171
|
||||
# define CMS_F_CMS_FINAL 127
|
||||
# define CMS_F_CMS_GET0_CERTIFICATE_CHOICES 128
|
||||
# define CMS_F_CMS_GET0_CONTENT 129
|
||||
# define CMS_F_CMS_GET0_ECONTENT_TYPE 130
|
||||
# define CMS_F_CMS_GET0_ENVELOPED 131
|
||||
# define CMS_F_CMS_GET0_REVOCATION_CHOICES 132
|
||||
# define CMS_F_CMS_GET0_SIGNED 133
|
||||
# define CMS_F_CMS_MSGSIGDIGEST_ADD1 162
|
||||
# define CMS_F_CMS_RECEIPTREQUEST_CREATE0 159
|
||||
# define CMS_F_CMS_RECEIPT_VERIFY 160
|
||||
# define CMS_F_CMS_RECIPIENTINFO_DECRYPT 134
|
||||
# define CMS_F_CMS_RECIPIENTINFO_ENCRYPT 169
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KARI_ENCRYPT 178
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ALG 175
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ORIG_ID 173
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_REKS 172
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KARI_ORIG_ID_CMP 174
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KEKRI_DECRYPT 135
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KEKRI_ENCRYPT 136
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KEKRI_GET0_ID 137
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KEKRI_ID_CMP 138
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KTRI_CERT_CMP 139
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT 140
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT 141
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_ALGS 142
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_SIGNER_ID 143
|
||||
# define CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT 167
|
||||
# define CMS_F_CMS_RECIPIENTINFO_SET0_KEY 144
|
||||
# define CMS_F_CMS_RECIPIENTINFO_SET0_PASSWORD 168
|
||||
# define CMS_F_CMS_RECIPIENTINFO_SET0_PKEY 145
|
||||
# define CMS_F_CMS_SD_ASN1_CTRL 170
|
||||
# define CMS_F_CMS_SET1_IAS 176
|
||||
# define CMS_F_CMS_SET1_KEYID 177
|
||||
# define CMS_F_CMS_SET1_SIGNERIDENTIFIER 146
|
||||
# define CMS_F_CMS_SET_DETACHED 147
|
||||
# define CMS_F_CMS_SIGN 148
|
||||
# define CMS_F_CMS_SIGNED_DATA_INIT 149
|
||||
# define CMS_F_CMS_SIGNERINFO_CONTENT_SIGN 150
|
||||
# define CMS_F_CMS_SIGNERINFO_SIGN 151
|
||||
# define CMS_F_CMS_SIGNERINFO_VERIFY 152
|
||||
# define CMS_F_CMS_SIGNERINFO_VERIFY_CERT 153
|
||||
# define CMS_F_CMS_SIGNERINFO_VERIFY_CONTENT 154
|
||||
# define CMS_F_CMS_SIGN_RECEIPT 163
|
||||
# define CMS_F_CMS_STREAM 155
|
||||
# define CMS_F_CMS_UNCOMPRESS 156
|
||||
# define CMS_F_CMS_VERIFY 157
|
||||
|
||||
/* Reason codes. */
|
||||
# define CMS_R_ADD_SIGNER_ERROR 99
|
||||
# define CMS_R_CERTIFICATE_ALREADY_PRESENT 175
|
||||
# define CMS_R_CERTIFICATE_HAS_NO_KEYID 160
|
||||
# define CMS_R_CERTIFICATE_VERIFY_ERROR 100
|
||||
# define CMS_R_CIPHER_INITIALISATION_ERROR 101
|
||||
# define CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR 102
|
||||
# define CMS_R_CMS_DATAFINAL_ERROR 103
|
||||
# define CMS_R_CMS_LIB 104
|
||||
# define CMS_R_CONTENTIDENTIFIER_MISMATCH 170
|
||||
# define CMS_R_CONTENT_NOT_FOUND 105
|
||||
# define CMS_R_CONTENT_TYPE_MISMATCH 171
|
||||
# define CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA 106
|
||||
# define CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA 107
|
||||
# define CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA 108
|
||||
# define CMS_R_CONTENT_VERIFY_ERROR 109
|
||||
# define CMS_R_CTRL_ERROR 110
|
||||
# define CMS_R_CTRL_FAILURE 111
|
||||
# define CMS_R_DECRYPT_ERROR 112
|
||||
# define CMS_R_DIGEST_ERROR 161
|
||||
# define CMS_R_ERROR_GETTING_PUBLIC_KEY 113
|
||||
# define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE 114
|
||||
# define CMS_R_ERROR_SETTING_KEY 115
|
||||
# define CMS_R_ERROR_SETTING_RECIPIENTINFO 116
|
||||
# define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH 117
|
||||
# define CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER 176
|
||||
# define CMS_R_INVALID_KEY_LENGTH 118
|
||||
# define CMS_R_MD_BIO_INIT_ERROR 119
|
||||
# define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH 120
|
||||
# define CMS_R_MESSAGEDIGEST_WRONG_LENGTH 121
|
||||
# define CMS_R_MSGSIGDIGEST_ERROR 172
|
||||
# define CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE 162
|
||||
# define CMS_R_MSGSIGDIGEST_WRONG_LENGTH 163
|
||||
# define CMS_R_NEED_ONE_SIGNER 164
|
||||
# define CMS_R_NOT_A_SIGNED_RECEIPT 165
|
||||
# define CMS_R_NOT_ENCRYPTED_DATA 122
|
||||
# define CMS_R_NOT_KEK 123
|
||||
# define CMS_R_NOT_KEY_AGREEMENT 181
|
||||
# define CMS_R_NOT_KEY_TRANSPORT 124
|
||||
# define CMS_R_NOT_PWRI 177
|
||||
# define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 125
|
||||
# define CMS_R_NO_CIPHER 126
|
||||
# define CMS_R_NO_CONTENT 127
|
||||
# define CMS_R_NO_CONTENT_TYPE 173
|
||||
# define CMS_R_NO_DEFAULT_DIGEST 128
|
||||
# define CMS_R_NO_DIGEST_SET 129
|
||||
# define CMS_R_NO_KEY 130
|
||||
# define CMS_R_NO_KEY_OR_CERT 174
|
||||
# define CMS_R_NO_MATCHING_DIGEST 131
|
||||
# define CMS_R_NO_MATCHING_RECIPIENT 132
|
||||
# define CMS_R_NO_MATCHING_SIGNATURE 166
|
||||
# define CMS_R_NO_MSGSIGDIGEST 167
|
||||
# define CMS_R_NO_PASSWORD 178
|
||||
# define CMS_R_NO_PRIVATE_KEY 133
|
||||
# define CMS_R_NO_PUBLIC_KEY 134
|
||||
# define CMS_R_NO_RECEIPT_REQUEST 168
|
||||
# define CMS_R_NO_SIGNERS 135
|
||||
# define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 136
|
||||
# define CMS_R_RECEIPT_DECODE_ERROR 169
|
||||
# define CMS_R_RECIPIENT_ERROR 137
|
||||
# define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND 138
|
||||
# define CMS_R_SIGNFINAL_ERROR 139
|
||||
# define CMS_R_SMIME_TEXT_ERROR 140
|
||||
# define CMS_R_STORE_INIT_ERROR 141
|
||||
# define CMS_R_TYPE_NOT_COMPRESSED_DATA 142
|
||||
# define CMS_R_TYPE_NOT_DATA 143
|
||||
# define CMS_R_TYPE_NOT_DIGESTED_DATA 144
|
||||
# define CMS_R_TYPE_NOT_ENCRYPTED_DATA 145
|
||||
# define CMS_R_TYPE_NOT_ENVELOPED_DATA 146
|
||||
# define CMS_R_UNABLE_TO_FINALIZE_CONTEXT 147
|
||||
# define CMS_R_UNKNOWN_CIPHER 148
|
||||
# define CMS_R_UNKNOWN_DIGEST_ALGORIHM 149
|
||||
# define CMS_R_UNKNOWN_ID 150
|
||||
# define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM 151
|
||||
# define CMS_R_UNSUPPORTED_CONTENT_TYPE 152
|
||||
# define CMS_R_UNSUPPORTED_KEK_ALGORITHM 153
|
||||
# define CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM 179
|
||||
# define CMS_R_UNSUPPORTED_RECIPIENT_TYPE 154
|
||||
# define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE 155
|
||||
# define CMS_R_UNSUPPORTED_TYPE 156
|
||||
# define CMS_R_UNWRAP_ERROR 157
|
||||
# define CMS_R_UNWRAP_FAILURE 180
|
||||
# define CMS_R_VERIFICATION_FAILURE 158
|
||||
# define CMS_R_WRAP_ERROR 159
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
202
submodules/MtProtoKit/openssl/openssl/cmserr.h
Normal file
202
submodules/MtProtoKit/openssl/openssl/cmserr.h
Normal file
@ -0,0 +1,202 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CMSERR_H
|
||||
# define HEADER_CMSERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_CMS
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_CMS_strings(void);
|
||||
|
||||
/*
|
||||
* CMS function codes.
|
||||
*/
|
||||
# define CMS_F_CHECK_CONTENT 99
|
||||
# define CMS_F_CMS_ADD0_CERT 164
|
||||
# define CMS_F_CMS_ADD0_RECIPIENT_KEY 100
|
||||
# define CMS_F_CMS_ADD0_RECIPIENT_PASSWORD 165
|
||||
# define CMS_F_CMS_ADD1_RECEIPTREQUEST 158
|
||||
# define CMS_F_CMS_ADD1_RECIPIENT_CERT 101
|
||||
# define CMS_F_CMS_ADD1_SIGNER 102
|
||||
# define CMS_F_CMS_ADD1_SIGNINGTIME 103
|
||||
# define CMS_F_CMS_COMPRESS 104
|
||||
# define CMS_F_CMS_COMPRESSEDDATA_CREATE 105
|
||||
# define CMS_F_CMS_COMPRESSEDDATA_INIT_BIO 106
|
||||
# define CMS_F_CMS_COPY_CONTENT 107
|
||||
# define CMS_F_CMS_COPY_MESSAGEDIGEST 108
|
||||
# define CMS_F_CMS_DATA 109
|
||||
# define CMS_F_CMS_DATAFINAL 110
|
||||
# define CMS_F_CMS_DATAINIT 111
|
||||
# define CMS_F_CMS_DECRYPT 112
|
||||
# define CMS_F_CMS_DECRYPT_SET1_KEY 113
|
||||
# define CMS_F_CMS_DECRYPT_SET1_PASSWORD 166
|
||||
# define CMS_F_CMS_DECRYPT_SET1_PKEY 114
|
||||
# define CMS_F_CMS_DIGESTALGORITHM_FIND_CTX 115
|
||||
# define CMS_F_CMS_DIGESTALGORITHM_INIT_BIO 116
|
||||
# define CMS_F_CMS_DIGESTEDDATA_DO_FINAL 117
|
||||
# define CMS_F_CMS_DIGEST_VERIFY 118
|
||||
# define CMS_F_CMS_ENCODE_RECEIPT 161
|
||||
# define CMS_F_CMS_ENCRYPT 119
|
||||
# define CMS_F_CMS_ENCRYPTEDCONTENT_INIT 179
|
||||
# define CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO 120
|
||||
# define CMS_F_CMS_ENCRYPTEDDATA_DECRYPT 121
|
||||
# define CMS_F_CMS_ENCRYPTEDDATA_ENCRYPT 122
|
||||
# define CMS_F_CMS_ENCRYPTEDDATA_SET1_KEY 123
|
||||
# define CMS_F_CMS_ENVELOPEDDATA_CREATE 124
|
||||
# define CMS_F_CMS_ENVELOPEDDATA_INIT_BIO 125
|
||||
# define CMS_F_CMS_ENVELOPED_DATA_INIT 126
|
||||
# define CMS_F_CMS_ENV_ASN1_CTRL 171
|
||||
# define CMS_F_CMS_FINAL 127
|
||||
# define CMS_F_CMS_GET0_CERTIFICATE_CHOICES 128
|
||||
# define CMS_F_CMS_GET0_CONTENT 129
|
||||
# define CMS_F_CMS_GET0_ECONTENT_TYPE 130
|
||||
# define CMS_F_CMS_GET0_ENVELOPED 131
|
||||
# define CMS_F_CMS_GET0_REVOCATION_CHOICES 132
|
||||
# define CMS_F_CMS_GET0_SIGNED 133
|
||||
# define CMS_F_CMS_MSGSIGDIGEST_ADD1 162
|
||||
# define CMS_F_CMS_RECEIPTREQUEST_CREATE0 159
|
||||
# define CMS_F_CMS_RECEIPT_VERIFY 160
|
||||
# define CMS_F_CMS_RECIPIENTINFO_DECRYPT 134
|
||||
# define CMS_F_CMS_RECIPIENTINFO_ENCRYPT 169
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KARI_ENCRYPT 178
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ALG 175
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ORIG_ID 173
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_REKS 172
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KARI_ORIG_ID_CMP 174
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KEKRI_DECRYPT 135
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KEKRI_ENCRYPT 136
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KEKRI_GET0_ID 137
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KEKRI_ID_CMP 138
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KTRI_CERT_CMP 139
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT 140
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT 141
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_ALGS 142
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_SIGNER_ID 143
|
||||
# define CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT 167
|
||||
# define CMS_F_CMS_RECIPIENTINFO_SET0_KEY 144
|
||||
# define CMS_F_CMS_RECIPIENTINFO_SET0_PASSWORD 168
|
||||
# define CMS_F_CMS_RECIPIENTINFO_SET0_PKEY 145
|
||||
# define CMS_F_CMS_SD_ASN1_CTRL 170
|
||||
# define CMS_F_CMS_SET1_IAS 176
|
||||
# define CMS_F_CMS_SET1_KEYID 177
|
||||
# define CMS_F_CMS_SET1_SIGNERIDENTIFIER 146
|
||||
# define CMS_F_CMS_SET_DETACHED 147
|
||||
# define CMS_F_CMS_SIGN 148
|
||||
# define CMS_F_CMS_SIGNED_DATA_INIT 149
|
||||
# define CMS_F_CMS_SIGNERINFO_CONTENT_SIGN 150
|
||||
# define CMS_F_CMS_SIGNERINFO_SIGN 151
|
||||
# define CMS_F_CMS_SIGNERINFO_VERIFY 152
|
||||
# define CMS_F_CMS_SIGNERINFO_VERIFY_CERT 153
|
||||
# define CMS_F_CMS_SIGNERINFO_VERIFY_CONTENT 154
|
||||
# define CMS_F_CMS_SIGN_RECEIPT 163
|
||||
# define CMS_F_CMS_SI_CHECK_ATTRIBUTES 183
|
||||
# define CMS_F_CMS_STREAM 155
|
||||
# define CMS_F_CMS_UNCOMPRESS 156
|
||||
# define CMS_F_CMS_VERIFY 157
|
||||
# define CMS_F_KEK_UNWRAP_KEY 180
|
||||
|
||||
/*
|
||||
* CMS reason codes.
|
||||
*/
|
||||
# define CMS_R_ADD_SIGNER_ERROR 99
|
||||
# define CMS_R_ATTRIBUTE_ERROR 161
|
||||
# define CMS_R_CERTIFICATE_ALREADY_PRESENT 175
|
||||
# define CMS_R_CERTIFICATE_HAS_NO_KEYID 160
|
||||
# define CMS_R_CERTIFICATE_VERIFY_ERROR 100
|
||||
# define CMS_R_CIPHER_INITIALISATION_ERROR 101
|
||||
# define CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR 102
|
||||
# define CMS_R_CMS_DATAFINAL_ERROR 103
|
||||
# define CMS_R_CMS_LIB 104
|
||||
# define CMS_R_CONTENTIDENTIFIER_MISMATCH 170
|
||||
# define CMS_R_CONTENT_NOT_FOUND 105
|
||||
# define CMS_R_CONTENT_TYPE_MISMATCH 171
|
||||
# define CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA 106
|
||||
# define CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA 107
|
||||
# define CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA 108
|
||||
# define CMS_R_CONTENT_VERIFY_ERROR 109
|
||||
# define CMS_R_CTRL_ERROR 110
|
||||
# define CMS_R_CTRL_FAILURE 111
|
||||
# define CMS_R_DECRYPT_ERROR 112
|
||||
# define CMS_R_ERROR_GETTING_PUBLIC_KEY 113
|
||||
# define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE 114
|
||||
# define CMS_R_ERROR_SETTING_KEY 115
|
||||
# define CMS_R_ERROR_SETTING_RECIPIENTINFO 116
|
||||
# define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH 117
|
||||
# define CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER 176
|
||||
# define CMS_R_INVALID_KEY_LENGTH 118
|
||||
# define CMS_R_MD_BIO_INIT_ERROR 119
|
||||
# define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH 120
|
||||
# define CMS_R_MESSAGEDIGEST_WRONG_LENGTH 121
|
||||
# define CMS_R_MSGSIGDIGEST_ERROR 172
|
||||
# define CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE 162
|
||||
# define CMS_R_MSGSIGDIGEST_WRONG_LENGTH 163
|
||||
# define CMS_R_NEED_ONE_SIGNER 164
|
||||
# define CMS_R_NOT_A_SIGNED_RECEIPT 165
|
||||
# define CMS_R_NOT_ENCRYPTED_DATA 122
|
||||
# define CMS_R_NOT_KEK 123
|
||||
# define CMS_R_NOT_KEY_AGREEMENT 181
|
||||
# define CMS_R_NOT_KEY_TRANSPORT 124
|
||||
# define CMS_R_NOT_PWRI 177
|
||||
# define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 125
|
||||
# define CMS_R_NO_CIPHER 126
|
||||
# define CMS_R_NO_CONTENT 127
|
||||
# define CMS_R_NO_CONTENT_TYPE 173
|
||||
# define CMS_R_NO_DEFAULT_DIGEST 128
|
||||
# define CMS_R_NO_DIGEST_SET 129
|
||||
# define CMS_R_NO_KEY 130
|
||||
# define CMS_R_NO_KEY_OR_CERT 174
|
||||
# define CMS_R_NO_MATCHING_DIGEST 131
|
||||
# define CMS_R_NO_MATCHING_RECIPIENT 132
|
||||
# define CMS_R_NO_MATCHING_SIGNATURE 166
|
||||
# define CMS_R_NO_MSGSIGDIGEST 167
|
||||
# define CMS_R_NO_PASSWORD 178
|
||||
# define CMS_R_NO_PRIVATE_KEY 133
|
||||
# define CMS_R_NO_PUBLIC_KEY 134
|
||||
# define CMS_R_NO_RECEIPT_REQUEST 168
|
||||
# define CMS_R_NO_SIGNERS 135
|
||||
# define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 136
|
||||
# define CMS_R_RECEIPT_DECODE_ERROR 169
|
||||
# define CMS_R_RECIPIENT_ERROR 137
|
||||
# define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND 138
|
||||
# define CMS_R_SIGNFINAL_ERROR 139
|
||||
# define CMS_R_SMIME_TEXT_ERROR 140
|
||||
# define CMS_R_STORE_INIT_ERROR 141
|
||||
# define CMS_R_TYPE_NOT_COMPRESSED_DATA 142
|
||||
# define CMS_R_TYPE_NOT_DATA 143
|
||||
# define CMS_R_TYPE_NOT_DIGESTED_DATA 144
|
||||
# define CMS_R_TYPE_NOT_ENCRYPTED_DATA 145
|
||||
# define CMS_R_TYPE_NOT_ENVELOPED_DATA 146
|
||||
# define CMS_R_UNABLE_TO_FINALIZE_CONTEXT 147
|
||||
# define CMS_R_UNKNOWN_CIPHER 148
|
||||
# define CMS_R_UNKNOWN_DIGEST_ALGORITHM 149
|
||||
# define CMS_R_UNKNOWN_ID 150
|
||||
# define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM 151
|
||||
# define CMS_R_UNSUPPORTED_CONTENT_TYPE 152
|
||||
# define CMS_R_UNSUPPORTED_KEK_ALGORITHM 153
|
||||
# define CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM 179
|
||||
# define CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE 155
|
||||
# define CMS_R_UNSUPPORTED_RECIPIENT_TYPE 154
|
||||
# define CMS_R_UNSUPPORTED_TYPE 156
|
||||
# define CMS_R_UNWRAP_ERROR 157
|
||||
# define CMS_R_UNWRAP_FAILURE 180
|
||||
# define CMS_R_VERIFICATION_FAILURE 158
|
||||
# define CMS_R_WRAP_ERROR 159
|
||||
|
||||
# endif
|
||||
#endif
|
@ -1,83 +1,53 @@
|
||||
/*
|
||||
* Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_COMP_H
|
||||
# define HEADER_COMP_H
|
||||
|
||||
# include <openssl/crypto.h>
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifdef OPENSSL_NO_COMP
|
||||
# error COMP is disabled.
|
||||
# ifndef OPENSSL_NO_COMP
|
||||
# include <openssl/crypto.h>
|
||||
# include <openssl/comperr.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct comp_ctx_st COMP_CTX;
|
||||
|
||||
typedef struct comp_method_st {
|
||||
int type; /* NID for compression library */
|
||||
const char *name; /* A text string to identify the library */
|
||||
int (*init) (COMP_CTX *ctx);
|
||||
void (*finish) (COMP_CTX *ctx);
|
||||
int (*compress) (COMP_CTX *ctx,
|
||||
unsigned char *out, unsigned int olen,
|
||||
unsigned char *in, unsigned int ilen);
|
||||
int (*expand) (COMP_CTX *ctx,
|
||||
unsigned char *out, unsigned int olen,
|
||||
unsigned char *in, unsigned int ilen);
|
||||
/*
|
||||
* The following two do NOTHING, but are kept for backward compatibility
|
||||
*/
|
||||
long (*ctrl) (void);
|
||||
long (*callback_ctrl) (void);
|
||||
} COMP_METHOD;
|
||||
|
||||
struct comp_ctx_st {
|
||||
COMP_METHOD *meth;
|
||||
unsigned long compress_in;
|
||||
unsigned long compress_out;
|
||||
unsigned long expand_in;
|
||||
unsigned long expand_out;
|
||||
CRYPTO_EX_DATA ex_data;
|
||||
};
|
||||
|
||||
COMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
|
||||
const COMP_METHOD *COMP_CTX_get_method(const COMP_CTX *ctx);
|
||||
int COMP_CTX_get_type(const COMP_CTX* comp);
|
||||
int COMP_get_type(const COMP_METHOD *meth);
|
||||
const char *COMP_get_name(const COMP_METHOD *meth);
|
||||
void COMP_CTX_free(COMP_CTX *ctx);
|
||||
|
||||
int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
|
||||
unsigned char *in, int ilen);
|
||||
int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
|
||||
unsigned char *in, int ilen);
|
||||
COMP_METHOD *COMP_rle(void);
|
||||
|
||||
COMP_METHOD *COMP_zlib(void);
|
||||
void COMP_zlib_cleanup(void);
|
||||
|
||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||
#define COMP_zlib_cleanup() while(0) continue
|
||||
#endif
|
||||
|
||||
# ifdef HEADER_BIO_H
|
||||
# ifdef ZLIB
|
||||
BIO_METHOD *BIO_f_zlib(void);
|
||||
const BIO_METHOD *BIO_f_zlib(void);
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_COMP_strings(void);
|
||||
|
||||
/* Error codes for the COMP functions. */
|
||||
|
||||
/* Function codes. */
|
||||
# define COMP_F_BIO_ZLIB_FLUSH 99
|
||||
# define COMP_F_BIO_ZLIB_NEW 100
|
||||
# define COMP_F_BIO_ZLIB_READ 101
|
||||
# define COMP_F_BIO_ZLIB_WRITE 102
|
||||
|
||||
/* Reason codes. */
|
||||
# define COMP_R_ZLIB_DEFLATE_ERROR 99
|
||||
# define COMP_R_ZLIB_INFLATE_ERROR 100
|
||||
# define COMP_R_ZLIB_NOT_SUPPORTED 101
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
44
submodules/MtProtoKit/openssl/openssl/comperr.h
Normal file
44
submodules/MtProtoKit/openssl/openssl/comperr.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_COMPERR_H
|
||||
# define HEADER_COMPERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_COMP
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_COMP_strings(void);
|
||||
|
||||
/*
|
||||
* COMP function codes.
|
||||
*/
|
||||
# define COMP_F_BIO_ZLIB_FLUSH 99
|
||||
# define COMP_F_BIO_ZLIB_NEW 100
|
||||
# define COMP_F_BIO_ZLIB_READ 101
|
||||
# define COMP_F_BIO_ZLIB_WRITE 102
|
||||
# define COMP_F_COMP_CTX_NEW 103
|
||||
|
||||
/*
|
||||
* COMP reason codes.
|
||||
*/
|
||||
# define COMP_R_ZLIB_DEFLATE_ERROR 99
|
||||
# define COMP_R_ZLIB_INFLATE_ERROR 100
|
||||
# define COMP_R_ZLIB_NOT_SUPPORTED 101
|
||||
|
||||
# endif
|
||||
#endif
|
@ -1,59 +1,10 @@
|
||||
/* crypto/conf/conf.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CONF_H
|
||||
@ -61,11 +12,10 @@
|
||||
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/lhash.h>
|
||||
# include <openssl/stack.h>
|
||||
# include <openssl/safestack.h>
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
# include <openssl/ossl_typ.h>
|
||||
# include <openssl/conferr.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -77,8 +27,8 @@ typedef struct {
|
||||
char *value;
|
||||
} CONF_VALUE;
|
||||
|
||||
DECLARE_STACK_OF(CONF_VALUE)
|
||||
DECLARE_LHASH_OF(CONF_VALUE);
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
DEFINE_LHASH_OF(CONF_VALUE);
|
||||
|
||||
struct conf_st;
|
||||
struct conf_method_st;
|
||||
@ -102,8 +52,8 @@ struct conf_method_st {
|
||||
typedef struct conf_imodule_st CONF_IMODULE;
|
||||
typedef struct conf_module_st CONF_MODULE;
|
||||
|
||||
DECLARE_STACK_OF(CONF_MODULE)
|
||||
DECLARE_STACK_OF(CONF_IMODULE)
|
||||
DEFINE_STACK_OF(CONF_MODULE)
|
||||
DEFINE_STACK_OF(CONF_IMODULE)
|
||||
|
||||
/* DSO module function typedefs */
|
||||
typedef int conf_init_func (CONF_IMODULE *md, const CONF *cnf);
|
||||
@ -120,7 +70,7 @@ int CONF_set_default_method(CONF_METHOD *meth);
|
||||
void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash);
|
||||
LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
|
||||
long *eline);
|
||||
# ifndef OPENSSL_NO_FP_API
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
|
||||
long *eline);
|
||||
# endif
|
||||
@ -133,11 +83,17 @@ char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group,
|
||||
long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group,
|
||||
const char *name);
|
||||
void CONF_free(LHASH_OF(CONF_VALUE) *conf);
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out);
|
||||
#endif
|
||||
int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out);
|
||||
|
||||
void OPENSSL_config(const char *config_name);
|
||||
void OPENSSL_no_config(void);
|
||||
DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name))
|
||||
|
||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define OPENSSL_no_config() \
|
||||
OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* New conf code. The semantics are different from the functions above. If
|
||||
@ -153,15 +109,11 @@ struct conf_st {
|
||||
CONF *NCONF_new(CONF_METHOD *meth);
|
||||
CONF_METHOD *NCONF_default(void);
|
||||
CONF_METHOD *NCONF_WIN32(void);
|
||||
# if 0 /* Just to give you an idea of what I have in
|
||||
* mind */
|
||||
CONF_METHOD *NCONF_XML(void);
|
||||
# endif
|
||||
void NCONF_free(CONF *conf);
|
||||
void NCONF_free_data(CONF *conf);
|
||||
|
||||
int NCONF_load(CONF *conf, const char *file, long *eline);
|
||||
# ifndef OPENSSL_NO_FP_API
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int NCONF_load_fp(CONF *conf, FILE *fp, long *eline);
|
||||
# endif
|
||||
int NCONF_load_bio(CONF *conf, BIO *bp, long *eline);
|
||||
@ -170,15 +122,12 @@ STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,
|
||||
char *NCONF_get_string(const CONF *conf, const char *group, const char *name);
|
||||
int NCONF_get_number_e(const CONF *conf, const char *group, const char *name,
|
||||
long *result);
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
int NCONF_dump_fp(const CONF *conf, FILE *out);
|
||||
#endif
|
||||
int NCONF_dump_bio(const CONF *conf, BIO *out);
|
||||
|
||||
# if 0 /* The following function has no error
|
||||
* checking, and should therefore be avoided */
|
||||
long NCONF_get_number(CONF *conf, char *group, char *name);
|
||||
# else
|
||||
# define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r)
|
||||
# endif
|
||||
#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r)
|
||||
|
||||
/* Module functions */
|
||||
|
||||
@ -188,7 +137,9 @@ int CONF_modules_load_file(const char *filename, const char *appname,
|
||||
unsigned long flags);
|
||||
void CONF_modules_unload(int all);
|
||||
void CONF_modules_finish(void);
|
||||
void CONF_modules_free(void);
|
||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define CONF_modules_free() while(0) continue
|
||||
#endif
|
||||
int CONF_module_add(const char *name, conf_init_func *ifunc,
|
||||
conf_finish_func *ffunc);
|
||||
|
||||
@ -210,58 +161,8 @@ int CONF_parse_list(const char *list, int sep, int nospc,
|
||||
|
||||
void OPENSSL_load_builtin_modules(void);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_CONF_strings(void);
|
||||
|
||||
/* Error codes for the CONF functions. */
|
||||
|
||||
/* Function codes. */
|
||||
# define CONF_F_CONF_DUMP_FP 104
|
||||
# define CONF_F_CONF_LOAD 100
|
||||
# define CONF_F_CONF_LOAD_BIO 102
|
||||
# define CONF_F_CONF_LOAD_FP 103
|
||||
# define CONF_F_CONF_MODULES_LOAD 116
|
||||
# define CONF_F_CONF_PARSE_LIST 119
|
||||
# define CONF_F_DEF_LOAD 120
|
||||
# define CONF_F_DEF_LOAD_BIO 121
|
||||
# define CONF_F_MODULE_INIT 115
|
||||
# define CONF_F_MODULE_LOAD_DSO 117
|
||||
# define CONF_F_MODULE_RUN 118
|
||||
# define CONF_F_NCONF_DUMP_BIO 105
|
||||
# define CONF_F_NCONF_DUMP_FP 106
|
||||
# define CONF_F_NCONF_GET_NUMBER 107
|
||||
# define CONF_F_NCONF_GET_NUMBER_E 112
|
||||
# define CONF_F_NCONF_GET_SECTION 108
|
||||
# define CONF_F_NCONF_GET_STRING 109
|
||||
# define CONF_F_NCONF_LOAD 113
|
||||
# define CONF_F_NCONF_LOAD_BIO 110
|
||||
# define CONF_F_NCONF_LOAD_FP 114
|
||||
# define CONF_F_NCONF_NEW 111
|
||||
# define CONF_F_STR_COPY 101
|
||||
|
||||
/* Reason codes. */
|
||||
# define CONF_R_ERROR_LOADING_DSO 110
|
||||
# define CONF_R_LIST_CANNOT_BE_NULL 115
|
||||
# define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100
|
||||
# define CONF_R_MISSING_EQUAL_SIGN 101
|
||||
# define CONF_R_MISSING_FINISH_FUNCTION 111
|
||||
# define CONF_R_MISSING_INIT_FUNCTION 112
|
||||
# define CONF_R_MODULE_INITIALIZATION_ERROR 109
|
||||
# define CONF_R_NO_CLOSE_BRACE 102
|
||||
# define CONF_R_NO_CONF 105
|
||||
# define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106
|
||||
# define CONF_R_NO_SECTION 107
|
||||
# define CONF_R_NO_SUCH_FILE 114
|
||||
# define CONF_R_NO_VALUE 108
|
||||
# define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103
|
||||
# define CONF_R_UNKNOWN_MODULE_NAME 113
|
||||
# define CONF_R_VARIABLE_HAS_NO_VALUE 104
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
@ -1,59 +1,10 @@
|
||||
/* conf_api.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CONF_API_H
|
||||
|
76
submodules/MtProtoKit/openssl/openssl/conferr.h
Normal file
76
submodules/MtProtoKit/openssl/openssl/conferr.h
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CONFERR_H
|
||||
# define HEADER_CONFERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_CONF_strings(void);
|
||||
|
||||
/*
|
||||
* CONF function codes.
|
||||
*/
|
||||
# define CONF_F_CONF_DUMP_FP 104
|
||||
# define CONF_F_CONF_LOAD 100
|
||||
# define CONF_F_CONF_LOAD_FP 103
|
||||
# define CONF_F_CONF_PARSE_LIST 119
|
||||
# define CONF_F_DEF_LOAD 120
|
||||
# define CONF_F_DEF_LOAD_BIO 121
|
||||
# define CONF_F_GET_NEXT_FILE 107
|
||||
# define CONF_F_MODULE_ADD 122
|
||||
# define CONF_F_MODULE_INIT 115
|
||||
# define CONF_F_MODULE_LOAD_DSO 117
|
||||
# define CONF_F_MODULE_RUN 118
|
||||
# define CONF_F_NCONF_DUMP_BIO 105
|
||||
# define CONF_F_NCONF_DUMP_FP 106
|
||||
# define CONF_F_NCONF_GET_NUMBER_E 112
|
||||
# define CONF_F_NCONF_GET_SECTION 108
|
||||
# define CONF_F_NCONF_GET_STRING 109
|
||||
# define CONF_F_NCONF_LOAD 113
|
||||
# define CONF_F_NCONF_LOAD_BIO 110
|
||||
# define CONF_F_NCONF_LOAD_FP 114
|
||||
# define CONF_F_NCONF_NEW 111
|
||||
# define CONF_F_PROCESS_INCLUDE 116
|
||||
# define CONF_F_SSL_MODULE_INIT 123
|
||||
# define CONF_F_STR_COPY 101
|
||||
|
||||
/*
|
||||
* CONF reason codes.
|
||||
*/
|
||||
# define CONF_R_ERROR_LOADING_DSO 110
|
||||
# define CONF_R_LIST_CANNOT_BE_NULL 115
|
||||
# define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100
|
||||
# define CONF_R_MISSING_EQUAL_SIGN 101
|
||||
# define CONF_R_MISSING_INIT_FUNCTION 112
|
||||
# define CONF_R_MODULE_INITIALIZATION_ERROR 109
|
||||
# define CONF_R_NO_CLOSE_BRACE 102
|
||||
# define CONF_R_NO_CONF 105
|
||||
# define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106
|
||||
# define CONF_R_NO_SECTION 107
|
||||
# define CONF_R_NO_SUCH_FILE 114
|
||||
# define CONF_R_NO_VALUE 108
|
||||
# define CONF_R_NUMBER_TOO_LARGE 121
|
||||
# define CONF_R_RECURSIVE_DIRECTORY_INCLUDE 111
|
||||
# define CONF_R_SSL_COMMAND_SECTION_EMPTY 117
|
||||
# define CONF_R_SSL_COMMAND_SECTION_NOT_FOUND 118
|
||||
# define CONF_R_SSL_SECTION_EMPTY 119
|
||||
# define CONF_R_SSL_SECTION_NOT_FOUND 120
|
||||
# define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103
|
||||
# define CONF_R_UNKNOWN_MODULE_NAME 113
|
||||
# define CONF_R_VARIABLE_EXPANSION_TOO_LONG 116
|
||||
# define CONF_R_VARIABLE_HAS_NO_VALUE 104
|
||||
|
||||
#endif
|
@ -1,134 +1,30 @@
|
||||
/* crypto/crypto.h */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* openssl-core@openssl.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*/
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
|
||||
* ECDH support in OpenSSL originally developed by
|
||||
* SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CRYPTO_H
|
||||
# define HEADER_CRYPTO_H
|
||||
|
||||
# include <stdlib.h>
|
||||
# include <time.h>
|
||||
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
# ifndef OPENSSL_NO_FP_API
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
# include <stdio.h>
|
||||
# endif
|
||||
|
||||
# include <openssl/stack.h>
|
||||
# include <openssl/safestack.h>
|
||||
# include <openssl/opensslv.h>
|
||||
# include <openssl/ossl_typ.h>
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/cryptoerr.h>
|
||||
|
||||
# ifdef CHARSET_EBCDIC
|
||||
# include <openssl/ebcdic.h>
|
||||
@ -140,487 +36,313 @@
|
||||
*/
|
||||
# include <openssl/symhacks.h>
|
||||
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# include <openssl/opensslv.h>
|
||||
# endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Backward compatibility to SSLeay */
|
||||
/*
|
||||
* This is more to be used to check the correct DLL is being used in the MS
|
||||
* world.
|
||||
*/
|
||||
# define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER
|
||||
# define SSLEAY_VERSION 0
|
||||
/* #define SSLEAY_OPTIONS 1 no longer supported */
|
||||
# define SSLEAY_CFLAGS 2
|
||||
# define SSLEAY_BUILT_ON 3
|
||||
# define SSLEAY_PLATFORM 4
|
||||
# define SSLEAY_DIR 5
|
||||
|
||||
/* Already declared in ossl_typ.h */
|
||||
# if 0
|
||||
typedef struct crypto_ex_data_st CRYPTO_EX_DATA;
|
||||
/* Called when a new object is created */
|
||||
typedef int CRYPTO_EX_new (void *parent, void *ptr, CRYPTO_EX_DATA *ad,
|
||||
int idx, long argl, void *argp);
|
||||
/* Called when an object is free()ed */
|
||||
typedef void CRYPTO_EX_free (void *parent, void *ptr, CRYPTO_EX_DATA *ad,
|
||||
int idx, long argl, void *argp);
|
||||
/* Called when we need to dup an object */
|
||||
typedef int CRYPTO_EX_dup (CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from,
|
||||
void *from_d, int idx, long argl, void *argp);
|
||||
# endif
|
||||
|
||||
/* A generic structure to pass assorted data in a expandable way */
|
||||
typedef struct openssl_item_st {
|
||||
int code;
|
||||
void *value; /* Not used for flag attributes */
|
||||
size_t value_size; /* Max size of value for output, length for
|
||||
* input */
|
||||
size_t *value_length; /* Returned length of value for output */
|
||||
} OPENSSL_ITEM;
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define SSLeay OpenSSL_version_num
|
||||
# define SSLeay_version OpenSSL_version
|
||||
# define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER
|
||||
# define SSLEAY_VERSION OPENSSL_VERSION
|
||||
# define SSLEAY_CFLAGS OPENSSL_CFLAGS
|
||||
# define SSLEAY_BUILT_ON OPENSSL_BUILT_ON
|
||||
# define SSLEAY_PLATFORM OPENSSL_PLATFORM
|
||||
# define SSLEAY_DIR OPENSSL_DIR
|
||||
|
||||
/*
|
||||
* When changing the CRYPTO_LOCK_* list, be sure to maintin the text lock
|
||||
* names in cryptlib.c
|
||||
* Old type for allocating dynamic locks. No longer used. Use the new thread
|
||||
* API instead.
|
||||
*/
|
||||
|
||||
# define CRYPTO_LOCK_ERR 1
|
||||
# define CRYPTO_LOCK_EX_DATA 2
|
||||
# define CRYPTO_LOCK_X509 3
|
||||
# define CRYPTO_LOCK_X509_INFO 4
|
||||
# define CRYPTO_LOCK_X509_PKEY 5
|
||||
# define CRYPTO_LOCK_X509_CRL 6
|
||||
# define CRYPTO_LOCK_X509_REQ 7
|
||||
# define CRYPTO_LOCK_DSA 8
|
||||
# define CRYPTO_LOCK_RSA 9
|
||||
# define CRYPTO_LOCK_EVP_PKEY 10
|
||||
# define CRYPTO_LOCK_X509_STORE 11
|
||||
# define CRYPTO_LOCK_SSL_CTX 12
|
||||
# define CRYPTO_LOCK_SSL_CERT 13
|
||||
# define CRYPTO_LOCK_SSL_SESSION 14
|
||||
# define CRYPTO_LOCK_SSL_SESS_CERT 15
|
||||
# define CRYPTO_LOCK_SSL 16
|
||||
# define CRYPTO_LOCK_SSL_METHOD 17
|
||||
# define CRYPTO_LOCK_RAND 18
|
||||
# define CRYPTO_LOCK_RAND2 19
|
||||
# define CRYPTO_LOCK_MALLOC 20
|
||||
# define CRYPTO_LOCK_BIO 21
|
||||
# define CRYPTO_LOCK_GETHOSTBYNAME 22
|
||||
# define CRYPTO_LOCK_GETSERVBYNAME 23
|
||||
# define CRYPTO_LOCK_READDIR 24
|
||||
# define CRYPTO_LOCK_RSA_BLINDING 25
|
||||
# define CRYPTO_LOCK_DH 26
|
||||
# define CRYPTO_LOCK_MALLOC2 27
|
||||
# define CRYPTO_LOCK_DSO 28
|
||||
# define CRYPTO_LOCK_DYNLOCK 29
|
||||
# define CRYPTO_LOCK_ENGINE 30
|
||||
# define CRYPTO_LOCK_UI 31
|
||||
# define CRYPTO_LOCK_ECDSA 32
|
||||
# define CRYPTO_LOCK_EC 33
|
||||
# define CRYPTO_LOCK_ECDH 34
|
||||
# define CRYPTO_LOCK_BN 35
|
||||
# define CRYPTO_LOCK_EC_PRE_COMP 36
|
||||
# define CRYPTO_LOCK_STORE 37
|
||||
# define CRYPTO_LOCK_COMP 38
|
||||
# define CRYPTO_LOCK_FIPS 39
|
||||
# define CRYPTO_LOCK_FIPS2 40
|
||||
# define CRYPTO_NUM_LOCKS 41
|
||||
|
||||
# define CRYPTO_LOCK 1
|
||||
# define CRYPTO_UNLOCK 2
|
||||
# define CRYPTO_READ 4
|
||||
# define CRYPTO_WRITE 8
|
||||
|
||||
# ifndef OPENSSL_NO_LOCKING
|
||||
# ifndef CRYPTO_w_lock
|
||||
# define CRYPTO_w_lock(type) \
|
||||
CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
|
||||
# define CRYPTO_w_unlock(type) \
|
||||
CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
|
||||
# define CRYPTO_r_lock(type) \
|
||||
CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__)
|
||||
# define CRYPTO_r_unlock(type) \
|
||||
CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)
|
||||
# define CRYPTO_add(addr,amount,type) \
|
||||
CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)
|
||||
# endif
|
||||
# else
|
||||
# define CRYPTO_w_lock(a)
|
||||
# define CRYPTO_w_unlock(a)
|
||||
# define CRYPTO_r_lock(a)
|
||||
# define CRYPTO_r_unlock(a)
|
||||
# define CRYPTO_add(a,b,c) ((*(a))+=(b))
|
||||
# endif
|
||||
|
||||
/*
|
||||
* Some applications as well as some parts of OpenSSL need to allocate and
|
||||
* deallocate locks in a dynamic fashion. The following typedef makes this
|
||||
* possible in a type-safe manner.
|
||||
*/
|
||||
/* struct CRYPTO_dynlock_value has to be defined by the application. */
|
||||
typedef struct {
|
||||
int references;
|
||||
struct CRYPTO_dynlock_value *data;
|
||||
int dummy;
|
||||
} CRYPTO_dynlock;
|
||||
|
||||
# endif /* OPENSSL_API_COMPAT */
|
||||
|
||||
typedef void CRYPTO_RWLOCK;
|
||||
|
||||
CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void);
|
||||
int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock);
|
||||
int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock);
|
||||
int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock);
|
||||
void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock);
|
||||
|
||||
int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock);
|
||||
|
||||
/*
|
||||
* The following can be used to detect memory leaks in the SSLeay library. It
|
||||
* The following can be used to detect memory leaks in the library. If
|
||||
* used, it turns on malloc checking
|
||||
*/
|
||||
|
||||
# define CRYPTO_MEM_CHECK_OFF 0x0/* an enume */
|
||||
# define CRYPTO_MEM_CHECK_ON 0x1/* a bit */
|
||||
# define CRYPTO_MEM_CHECK_ENABLE 0x2/* a bit */
|
||||
# define CRYPTO_MEM_CHECK_DISABLE 0x3/* an enume */
|
||||
|
||||
/*
|
||||
* The following are bit values to turn on or off options connected to the
|
||||
* malloc checking functionality
|
||||
*/
|
||||
|
||||
/* Adds time to the memory checking information */
|
||||
# define V_CRYPTO_MDEBUG_TIME 0x1/* a bit */
|
||||
/* Adds thread number to the memory checking information */
|
||||
# define V_CRYPTO_MDEBUG_THREAD 0x2/* a bit */
|
||||
|
||||
# define V_CRYPTO_MDEBUG_ALL (V_CRYPTO_MDEBUG_TIME | V_CRYPTO_MDEBUG_THREAD)
|
||||
|
||||
/* predec of the BIO type */
|
||||
typedef struct bio_st BIO_dummy;
|
||||
# define CRYPTO_MEM_CHECK_OFF 0x0 /* Control only */
|
||||
# define CRYPTO_MEM_CHECK_ON 0x1 /* Control and mode bit */
|
||||
# define CRYPTO_MEM_CHECK_ENABLE 0x2 /* Control and mode bit */
|
||||
# define CRYPTO_MEM_CHECK_DISABLE 0x3 /* Control only */
|
||||
|
||||
struct crypto_ex_data_st {
|
||||
STACK_OF(void) *sk;
|
||||
/* gcc is screwing up this data structure :-( */
|
||||
int dummy;
|
||||
};
|
||||
DECLARE_STACK_OF(void)
|
||||
DEFINE_STACK_OF(void)
|
||||
|
||||
/*
|
||||
* This stuff is basically class callback functions The current classes are
|
||||
* SSL_CTX, SSL, SSL_SESSION, and a few more
|
||||
* Per class, we have a STACK of function pointers.
|
||||
*/
|
||||
|
||||
typedef struct crypto_ex_data_func_st {
|
||||
long argl; /* Arbitary long */
|
||||
void *argp; /* Arbitary void * */
|
||||
CRYPTO_EX_new *new_func;
|
||||
CRYPTO_EX_free *free_func;
|
||||
CRYPTO_EX_dup *dup_func;
|
||||
} CRYPTO_EX_DATA_FUNCS;
|
||||
|
||||
DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS)
|
||||
|
||||
/*
|
||||
* Per class, we have a STACK of CRYPTO_EX_DATA_FUNCS for each CRYPTO_EX_DATA
|
||||
* entry.
|
||||
*/
|
||||
|
||||
# define CRYPTO_EX_INDEX_BIO 0
|
||||
# define CRYPTO_EX_INDEX_SSL 1
|
||||
# define CRYPTO_EX_INDEX_SSL_CTX 2
|
||||
# define CRYPTO_EX_INDEX_SSL_SESSION 3
|
||||
# define CRYPTO_EX_INDEX_X509_STORE 4
|
||||
# define CRYPTO_EX_INDEX_X509_STORE_CTX 5
|
||||
# define CRYPTO_EX_INDEX_RSA 6
|
||||
# define CRYPTO_EX_INDEX_DSA 7
|
||||
# define CRYPTO_EX_INDEX_DH 8
|
||||
# define CRYPTO_EX_INDEX_ENGINE 9
|
||||
# define CRYPTO_EX_INDEX_X509 10
|
||||
# define CRYPTO_EX_INDEX_SSL 0
|
||||
# define CRYPTO_EX_INDEX_SSL_CTX 1
|
||||
# define CRYPTO_EX_INDEX_SSL_SESSION 2
|
||||
# define CRYPTO_EX_INDEX_X509 3
|
||||
# define CRYPTO_EX_INDEX_X509_STORE 4
|
||||
# define CRYPTO_EX_INDEX_X509_STORE_CTX 5
|
||||
# define CRYPTO_EX_INDEX_DH 6
|
||||
# define CRYPTO_EX_INDEX_DSA 7
|
||||
# define CRYPTO_EX_INDEX_EC_KEY 8
|
||||
# define CRYPTO_EX_INDEX_RSA 9
|
||||
# define CRYPTO_EX_INDEX_ENGINE 10
|
||||
# define CRYPTO_EX_INDEX_UI 11
|
||||
# define CRYPTO_EX_INDEX_ECDSA 12
|
||||
# define CRYPTO_EX_INDEX_ECDH 13
|
||||
# define CRYPTO_EX_INDEX_COMP 14
|
||||
# define CRYPTO_EX_INDEX_STORE 15
|
||||
# define CRYPTO_EX_INDEX_BIO 12
|
||||
# define CRYPTO_EX_INDEX_APP 13
|
||||
# define CRYPTO_EX_INDEX_UI_METHOD 14
|
||||
# define CRYPTO_EX_INDEX_DRBG 15
|
||||
# define CRYPTO_EX_INDEX__COUNT 16
|
||||
|
||||
/*
|
||||
* Dynamically assigned indexes start from this value (don't use directly,
|
||||
* use via CRYPTO_ex_data_new_class).
|
||||
*/
|
||||
# define CRYPTO_EX_INDEX_USER 100
|
||||
|
||||
/*
|
||||
* This is the default callbacks, but we can have others as well: this is
|
||||
* needed in Win32 where the application malloc and the library malloc may
|
||||
* not be the same.
|
||||
*/
|
||||
# define CRYPTO_malloc_init() CRYPTO_set_mem_functions(\
|
||||
malloc, realloc, free)
|
||||
|
||||
# if defined CRYPTO_MDEBUG_ALL || defined CRYPTO_MDEBUG_TIME || defined CRYPTO_MDEBUG_THREAD
|
||||
# ifndef CRYPTO_MDEBUG /* avoid duplicate #define */
|
||||
# define CRYPTO_MDEBUG
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/*
|
||||
* Set standard debugging functions (not done by default unless CRYPTO_MDEBUG
|
||||
* is defined)
|
||||
*/
|
||||
# define CRYPTO_malloc_debug_init() do {\
|
||||
CRYPTO_set_mem_debug_functions(\
|
||||
CRYPTO_dbg_malloc,\
|
||||
CRYPTO_dbg_realloc,\
|
||||
CRYPTO_dbg_free,\
|
||||
CRYPTO_dbg_set_options,\
|
||||
CRYPTO_dbg_get_options);\
|
||||
} while(0)
|
||||
/* No longer needed, so this is a no-op */
|
||||
#define OPENSSL_malloc_init() while(0) continue
|
||||
|
||||
int CRYPTO_mem_ctrl(int mode);
|
||||
int CRYPTO_is_mem_check_on(void);
|
||||
|
||||
/* for applications */
|
||||
# define MemCheck_start() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON)
|
||||
# define MemCheck_stop() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF)
|
||||
# define OPENSSL_malloc(num) \
|
||||
CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_zalloc(num) \
|
||||
CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_realloc(addr, num) \
|
||||
CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_clear_realloc(addr, old_num, num) \
|
||||
CRYPTO_clear_realloc(addr, old_num, num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_clear_free(addr, num) \
|
||||
CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_free(addr) \
|
||||
CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_memdup(str, s) \
|
||||
CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_strdup(str) \
|
||||
CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_strndup(str, n) \
|
||||
CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_secure_malloc(num) \
|
||||
CRYPTO_secure_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_secure_zalloc(num) \
|
||||
CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_secure_free(addr) \
|
||||
CRYPTO_secure_free(addr, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_secure_clear_free(addr, num) \
|
||||
CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_secure_actual_size(ptr) \
|
||||
CRYPTO_secure_actual_size(ptr)
|
||||
|
||||
/* for library-internal use */
|
||||
# define MemCheck_on() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE)
|
||||
# define MemCheck_off() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE)
|
||||
# define is_MemCheck_on() CRYPTO_is_mem_check_on()
|
||||
size_t OPENSSL_strlcpy(char *dst, const char *src, size_t siz);
|
||||
size_t OPENSSL_strlcat(char *dst, const char *src, size_t siz);
|
||||
size_t OPENSSL_strnlen(const char *str, size_t maxlen);
|
||||
char *OPENSSL_buf2hexstr(const unsigned char *buffer, long len);
|
||||
unsigned char *OPENSSL_hexstr2buf(const char *str, long *len);
|
||||
int OPENSSL_hexchar2int(unsigned char c);
|
||||
|
||||
# define OPENSSL_malloc(num) CRYPTO_malloc((int)num,__FILE__,__LINE__)
|
||||
# define OPENSSL_strdup(str) CRYPTO_strdup((str),__FILE__,__LINE__)
|
||||
# define OPENSSL_realloc(addr,num) \
|
||||
CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__)
|
||||
# define OPENSSL_realloc_clean(addr,old_num,num) \
|
||||
CRYPTO_realloc_clean(addr,old_num,num,__FILE__,__LINE__)
|
||||
# define OPENSSL_remalloc(addr,num) \
|
||||
CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__)
|
||||
# define OPENSSL_freeFunc CRYPTO_free
|
||||
# define OPENSSL_free(addr) CRYPTO_free(addr)
|
||||
# define OPENSSL_MALLOC_MAX_NELEMS(type) (((1U<<(sizeof(int)*8-1))-1)/sizeof(type))
|
||||
|
||||
# define OPENSSL_malloc_locked(num) \
|
||||
CRYPTO_malloc_locked((int)num,__FILE__,__LINE__)
|
||||
# define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr)
|
||||
|
||||
const char *SSLeay_version(int type);
|
||||
unsigned long SSLeay(void);
|
||||
unsigned long OpenSSL_version_num(void);
|
||||
const char *OpenSSL_version(int type);
|
||||
# define OPENSSL_VERSION 0
|
||||
# define OPENSSL_CFLAGS 1
|
||||
# define OPENSSL_BUILT_ON 2
|
||||
# define OPENSSL_PLATFORM 3
|
||||
# define OPENSSL_DIR 4
|
||||
# define OPENSSL_ENGINES_DIR 5
|
||||
|
||||
int OPENSSL_issetugid(void);
|
||||
|
||||
/* An opaque type representing an implementation of "ex_data" support */
|
||||
typedef struct st_CRYPTO_EX_DATA_IMPL CRYPTO_EX_DATA_IMPL;
|
||||
/* Return an opaque pointer to the current "ex_data" implementation */
|
||||
const CRYPTO_EX_DATA_IMPL *CRYPTO_get_ex_data_implementation(void);
|
||||
/* Sets the "ex_data" implementation to be used (if it's not too late) */
|
||||
int CRYPTO_set_ex_data_implementation(const CRYPTO_EX_DATA_IMPL *i);
|
||||
/* Get a new "ex_data" class, and return the corresponding "class_index" */
|
||||
int CRYPTO_ex_data_new_class(void);
|
||||
/* Within a given class, get/register a new index */
|
||||
int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
|
||||
typedef void CRYPTO_EX_new (void *parent, void *ptr, CRYPTO_EX_DATA *ad,
|
||||
int idx, long argl, void *argp);
|
||||
typedef void CRYPTO_EX_free (void *parent, void *ptr, CRYPTO_EX_DATA *ad,
|
||||
int idx, long argl, void *argp);
|
||||
typedef int CRYPTO_EX_dup (CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from,
|
||||
void *from_d, int idx, long argl, void *argp);
|
||||
__owur int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
|
||||
CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func,
|
||||
CRYPTO_EX_free *free_func);
|
||||
/* No longer use an index. */
|
||||
int CRYPTO_free_ex_index(int class_index, int idx);
|
||||
|
||||
/*
|
||||
* Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a
|
||||
* given class (invokes whatever per-class callbacks are applicable)
|
||||
*/
|
||||
int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
|
||||
int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
|
||||
CRYPTO_EX_DATA *from);
|
||||
const CRYPTO_EX_DATA *from);
|
||||
|
||||
void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
|
||||
|
||||
/*
|
||||
* Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular
|
||||
* index (relative to the class type involved)
|
||||
*/
|
||||
int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val);
|
||||
void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx);
|
||||
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
/*
|
||||
* This function cleans up all "ex_data" state. It mustn't be called under
|
||||
* potential race-conditions.
|
||||
*/
|
||||
void CRYPTO_cleanup_all_ex_data(void);
|
||||
|
||||
int CRYPTO_get_new_lockid(char *name);
|
||||
|
||||
int CRYPTO_num_locks(void); /* return CRYPTO_NUM_LOCKS (shared libs!) */
|
||||
void CRYPTO_lock(int mode, int type, const char *file, int line);
|
||||
void CRYPTO_set_locking_callback(void (*func) (int mode, int type,
|
||||
const char *file, int line));
|
||||
void (*CRYPTO_get_locking_callback(void)) (int mode, int type,
|
||||
const char *file, int line);
|
||||
void CRYPTO_set_add_lock_callback(int (*func)
|
||||
(int *num, int mount, int type,
|
||||
const char *file, int line));
|
||||
int (*CRYPTO_get_add_lock_callback(void)) (int *num, int mount, int type,
|
||||
const char *file, int line);
|
||||
|
||||
/* Don't use this structure directly. */
|
||||
typedef struct crypto_threadid_st {
|
||||
void *ptr;
|
||||
unsigned long val;
|
||||
} CRYPTO_THREADID;
|
||||
/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */
|
||||
void CRYPTO_THREADID_set_numeric(CRYPTO_THREADID *id, unsigned long val);
|
||||
void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr);
|
||||
int CRYPTO_THREADID_set_callback(void (*threadid_func) (CRYPTO_THREADID *));
|
||||
void (*CRYPTO_THREADID_get_callback(void)) (CRYPTO_THREADID *);
|
||||
void CRYPTO_THREADID_current(CRYPTO_THREADID *id);
|
||||
int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a, const CRYPTO_THREADID *b);
|
||||
void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest, const CRYPTO_THREADID *src);
|
||||
unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id);
|
||||
# ifndef OPENSSL_NO_DEPRECATED
|
||||
void CRYPTO_set_id_callback(unsigned long (*func) (void));
|
||||
unsigned long (*CRYPTO_get_id_callback(void)) (void);
|
||||
unsigned long CRYPTO_thread_id(void);
|
||||
# endif
|
||||
|
||||
const char *CRYPTO_get_lock_name(int type);
|
||||
int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
|
||||
int line);
|
||||
|
||||
int CRYPTO_get_new_dynlockid(void);
|
||||
void CRYPTO_destroy_dynlockid(int i);
|
||||
struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i);
|
||||
void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value
|
||||
*(*dyn_create_function) (const char
|
||||
*file,
|
||||
int line));
|
||||
void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function)
|
||||
(int mode,
|
||||
struct CRYPTO_dynlock_value *l,
|
||||
const char *file, int line));
|
||||
void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function)
|
||||
(struct CRYPTO_dynlock_value *l,
|
||||
const char *file, int line));
|
||||
struct CRYPTO_dynlock_value
|
||||
*(*CRYPTO_get_dynlock_create_callback(void)) (const char *file, int line);
|
||||
void (*CRYPTO_get_dynlock_lock_callback(void)) (int mode,
|
||||
struct CRYPTO_dynlock_value
|
||||
*l, const char *file,
|
||||
int line);
|
||||
void (*CRYPTO_get_dynlock_destroy_callback(void)) (struct CRYPTO_dynlock_value
|
||||
*l, const char *file,
|
||||
int line);
|
||||
# define CRYPTO_cleanup_all_ex_data() while(0) continue
|
||||
|
||||
/*
|
||||
* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions -- call
|
||||
* the latter last if you need different functions
|
||||
* The old locking functions have been removed completely without compatibility
|
||||
* macros. This is because the old functions either could not properly report
|
||||
* errors, or the returned error values were not clearly documented.
|
||||
* Replacing the locking functions with no-ops would cause race condition
|
||||
* issues in the affected applications. It is far better for them to fail at
|
||||
* compile time.
|
||||
* On the other hand, the locking callbacks are no longer used. Consequently,
|
||||
* the callback management functions can be safely replaced with no-op macros.
|
||||
*/
|
||||
int CRYPTO_set_mem_functions(void *(*m) (size_t), void *(*r) (void *, size_t),
|
||||
void (*f) (void *));
|
||||
int CRYPTO_set_locked_mem_functions(void *(*m) (size_t),
|
||||
void (*free_func) (void *));
|
||||
int CRYPTO_set_mem_ex_functions(void *(*m) (size_t, const char *, int),
|
||||
void *(*r) (void *, size_t, const char *,
|
||||
int), void (*f) (void *));
|
||||
int CRYPTO_set_locked_mem_ex_functions(void *(*m) (size_t, const char *, int),
|
||||
void (*free_func) (void *));
|
||||
int CRYPTO_set_mem_debug_functions(void (*m)
|
||||
(void *, int, const char *, int, int),
|
||||
void (*r) (void *, void *, int,
|
||||
const char *, int, int),
|
||||
void (*f) (void *, int), void (*so) (long),
|
||||
long (*go) (void));
|
||||
void CRYPTO_get_mem_functions(void *(**m) (size_t),
|
||||
void *(**r) (void *, size_t),
|
||||
void (**f) (void *));
|
||||
void CRYPTO_get_locked_mem_functions(void *(**m) (size_t),
|
||||
void (**f) (void *));
|
||||
void CRYPTO_get_mem_ex_functions(void *(**m) (size_t, const char *, int),
|
||||
void *(**r) (void *, size_t, const char *,
|
||||
int), void (**f) (void *));
|
||||
void CRYPTO_get_locked_mem_ex_functions(void
|
||||
*(**m) (size_t, const char *, int),
|
||||
void (**f) (void *));
|
||||
void CRYPTO_get_mem_debug_functions(void (**m)
|
||||
(void *, int, const char *, int, int),
|
||||
void (**r) (void *, void *, int,
|
||||
const char *, int, int),
|
||||
void (**f) (void *, int),
|
||||
void (**so) (long), long (**go) (void));
|
||||
# define CRYPTO_num_locks() (1)
|
||||
# define CRYPTO_set_locking_callback(func)
|
||||
# define CRYPTO_get_locking_callback() (NULL)
|
||||
# define CRYPTO_set_add_lock_callback(func)
|
||||
# define CRYPTO_get_add_lock_callback() (NULL)
|
||||
|
||||
void *CRYPTO_malloc_locked(int num, const char *file, int line);
|
||||
void CRYPTO_free_locked(void *ptr);
|
||||
void *CRYPTO_malloc(int num, const char *file, int line);
|
||||
/*
|
||||
* These defines where used in combination with the old locking callbacks,
|
||||
* they are not called anymore, but old code that's not called might still
|
||||
* use them.
|
||||
*/
|
||||
# define CRYPTO_LOCK 1
|
||||
# define CRYPTO_UNLOCK 2
|
||||
# define CRYPTO_READ 4
|
||||
# define CRYPTO_WRITE 8
|
||||
|
||||
/* This structure is no longer used */
|
||||
typedef struct crypto_threadid_st {
|
||||
int dummy;
|
||||
} CRYPTO_THREADID;
|
||||
/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */
|
||||
# define CRYPTO_THREADID_set_numeric(id, val)
|
||||
# define CRYPTO_THREADID_set_pointer(id, ptr)
|
||||
# define CRYPTO_THREADID_set_callback(threadid_func) (0)
|
||||
# define CRYPTO_THREADID_get_callback() (NULL)
|
||||
# define CRYPTO_THREADID_current(id)
|
||||
# define CRYPTO_THREADID_cmp(a, b) (-1)
|
||||
# define CRYPTO_THREADID_cpy(dest, src)
|
||||
# define CRYPTO_THREADID_hash(id) (0UL)
|
||||
|
||||
# if OPENSSL_API_COMPAT < 0x10000000L
|
||||
# define CRYPTO_set_id_callback(func)
|
||||
# define CRYPTO_get_id_callback() (NULL)
|
||||
# define CRYPTO_thread_id() (0UL)
|
||||
# endif /* OPENSSL_API_COMPAT < 0x10000000L */
|
||||
|
||||
# define CRYPTO_set_dynlock_create_callback(dyn_create_function)
|
||||
# define CRYPTO_set_dynlock_lock_callback(dyn_lock_function)
|
||||
# define CRYPTO_set_dynlock_destroy_callback(dyn_destroy_function)
|
||||
# define CRYPTO_get_dynlock_create_callback() (NULL)
|
||||
# define CRYPTO_get_dynlock_lock_callback() (NULL)
|
||||
# define CRYPTO_get_dynlock_destroy_callback() (NULL)
|
||||
# endif /* OPENSSL_API_COMPAT < 0x10100000L */
|
||||
|
||||
int CRYPTO_set_mem_functions(
|
||||
void *(*m) (size_t, const char *, int),
|
||||
void *(*r) (void *, size_t, const char *, int),
|
||||
void (*f) (void *, const char *, int));
|
||||
int CRYPTO_set_mem_debug(int flag);
|
||||
void CRYPTO_get_mem_functions(
|
||||
void *(**m) (size_t, const char *, int),
|
||||
void *(**r) (void *, size_t, const char *, int),
|
||||
void (**f) (void *, const char *, int));
|
||||
|
||||
void *CRYPTO_malloc(size_t num, const char *file, int line);
|
||||
void *CRYPTO_zalloc(size_t num, const char *file, int line);
|
||||
void *CRYPTO_memdup(const void *str, size_t siz, const char *file, int line);
|
||||
char *CRYPTO_strdup(const char *str, const char *file, int line);
|
||||
void CRYPTO_free(void *ptr);
|
||||
void *CRYPTO_realloc(void *addr, int num, const char *file, int line);
|
||||
void *CRYPTO_realloc_clean(void *addr, int old_num, int num, const char *file,
|
||||
int line);
|
||||
void *CRYPTO_remalloc(void *addr, int num, const char *file, int line);
|
||||
char *CRYPTO_strndup(const char *str, size_t s, const char *file, int line);
|
||||
void CRYPTO_free(void *ptr, const char *file, int line);
|
||||
void CRYPTO_clear_free(void *ptr, size_t num, const char *file, int line);
|
||||
void *CRYPTO_realloc(void *addr, size_t num, const char *file, int line);
|
||||
void *CRYPTO_clear_realloc(void *addr, size_t old_num, size_t num,
|
||||
const char *file, int line);
|
||||
|
||||
int CRYPTO_secure_malloc_init(size_t sz, int minsize);
|
||||
int CRYPTO_secure_malloc_done(void);
|
||||
void *CRYPTO_secure_malloc(size_t num, const char *file, int line);
|
||||
void *CRYPTO_secure_zalloc(size_t num, const char *file, int line);
|
||||
void CRYPTO_secure_free(void *ptr, const char *file, int line);
|
||||
void CRYPTO_secure_clear_free(void *ptr, size_t num,
|
||||
const char *file, int line);
|
||||
int CRYPTO_secure_allocated(const void *ptr);
|
||||
int CRYPTO_secure_malloc_initialized(void);
|
||||
size_t CRYPTO_secure_actual_size(void *ptr);
|
||||
size_t CRYPTO_secure_used(void);
|
||||
|
||||
void OPENSSL_cleanse(void *ptr, size_t len);
|
||||
|
||||
void CRYPTO_set_mem_debug_options(long bits);
|
||||
long CRYPTO_get_mem_debug_options(void);
|
||||
# ifndef OPENSSL_NO_CRYPTO_MDEBUG
|
||||
# define OPENSSL_mem_debug_push(info) \
|
||||
CRYPTO_mem_debug_push(info, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_mem_debug_pop() \
|
||||
CRYPTO_mem_debug_pop()
|
||||
int CRYPTO_mem_debug_push(const char *info, const char *file, int line);
|
||||
int CRYPTO_mem_debug_pop(void);
|
||||
void CRYPTO_get_alloc_counts(int *mcount, int *rcount, int *fcount);
|
||||
|
||||
# define CRYPTO_push_info(info) \
|
||||
CRYPTO_push_info_(info, __FILE__, __LINE__);
|
||||
int CRYPTO_push_info_(const char *info, const char *file, int line);
|
||||
int CRYPTO_pop_info(void);
|
||||
int CRYPTO_remove_all_info(void);
|
||||
|
||||
/*
|
||||
* Default debugging functions (enabled by CRYPTO_malloc_debug_init() macro;
|
||||
* used as default in CRYPTO_MDEBUG compilations):
|
||||
*/
|
||||
/*-
|
||||
* The last argument has the following significance:
|
||||
*
|
||||
* 0: called before the actual memory allocation has taken place
|
||||
* 1: called after the actual memory allocation has taken place
|
||||
* Debugging functions (enabled by CRYPTO_set_mem_debug(1))
|
||||
* The flag argument has the following significance:
|
||||
* 0: called before the actual memory allocation has taken place
|
||||
* 1: called after the actual memory allocation has taken place
|
||||
*/
|
||||
void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line,
|
||||
int before_p);
|
||||
void CRYPTO_dbg_realloc(void *addr1, void *addr2, int num, const char *file,
|
||||
int line, int before_p);
|
||||
void CRYPTO_dbg_free(void *addr, int before_p);
|
||||
/*-
|
||||
* Tell the debugging code about options. By default, the following values
|
||||
* apply:
|
||||
*
|
||||
* 0: Clear all options.
|
||||
* V_CRYPTO_MDEBUG_TIME (1): Set the "Show Time" option.
|
||||
* V_CRYPTO_MDEBUG_THREAD (2): Set the "Show Thread Number" option.
|
||||
* V_CRYPTO_MDEBUG_ALL (3): 1 + 2
|
||||
*/
|
||||
void CRYPTO_dbg_set_options(long bits);
|
||||
long CRYPTO_dbg_get_options(void);
|
||||
void CRYPTO_mem_debug_malloc(void *addr, size_t num, int flag,
|
||||
const char *file, int line);
|
||||
void CRYPTO_mem_debug_realloc(void *addr1, void *addr2, size_t num, int flag,
|
||||
const char *file, int line);
|
||||
void CRYPTO_mem_debug_free(void *addr, int flag,
|
||||
const char *file, int line);
|
||||
|
||||
# ifndef OPENSSL_NO_FP_API
|
||||
void CRYPTO_mem_leaks_fp(FILE *);
|
||||
int CRYPTO_mem_leaks_cb(int (*cb) (const char *str, size_t len, void *u),
|
||||
void *u);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int CRYPTO_mem_leaks_fp(FILE *);
|
||||
# endif
|
||||
int CRYPTO_mem_leaks(BIO *bio);
|
||||
# endif
|
||||
void CRYPTO_mem_leaks(struct bio_st *bio);
|
||||
/* unsigned long order, char *file, int line, int num_bytes, char *addr */
|
||||
typedef void *CRYPTO_MEM_LEAK_CB (unsigned long, const char *, int, int,
|
||||
void *);
|
||||
void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);
|
||||
|
||||
/* die if we have to */
|
||||
void OpenSSLDie(const char *file, int line, const char *assertion);
|
||||
# define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1))
|
||||
ossl_noreturn void OPENSSL_die(const char *assertion, const char *file, int line);
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define OpenSSLDie(f,l,a) OPENSSL_die((a),(f),(l))
|
||||
# endif
|
||||
# define OPENSSL_assert(e) \
|
||||
(void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
|
||||
|
||||
unsigned long *OPENSSL_ia32cap_loc(void);
|
||||
# define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc()))
|
||||
int OPENSSL_isservice(void);
|
||||
|
||||
int FIPS_mode(void);
|
||||
int FIPS_mode_set(int r);
|
||||
|
||||
void OPENSSL_init(void);
|
||||
|
||||
# define fips_md_init(alg) fips_md_init_ctx(alg, alg)
|
||||
|
||||
# ifdef OPENSSL_FIPS
|
||||
# define fips_md_init_ctx(alg, cx) \
|
||||
int alg##_Init(cx##_CTX *c) \
|
||||
{ \
|
||||
if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \
|
||||
"Low level API call to digest " #alg " forbidden in FIPS mode!"); \
|
||||
return private_##alg##_Init(c); \
|
||||
} \
|
||||
int private_##alg##_Init(cx##_CTX *c)
|
||||
|
||||
# define fips_cipher_abort(alg) \
|
||||
if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \
|
||||
"Low level API call to cipher " #alg " forbidden in FIPS mode!")
|
||||
|
||||
# else
|
||||
# define fips_md_init_ctx(alg, cx) \
|
||||
int alg##_Init(cx##_CTX *c)
|
||||
# define fips_cipher_abort(alg) while(0)
|
||||
# ifdef OPENSSL_SYS_UNIX
|
||||
void OPENSSL_fork_prepare(void);
|
||||
void OPENSSL_fork_parent(void);
|
||||
void OPENSSL_fork_child(void);
|
||||
# endif
|
||||
|
||||
struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result);
|
||||
int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec);
|
||||
int OPENSSL_gmtime_diff(int *pday, int *psec,
|
||||
const struct tm *from, const struct tm *to);
|
||||
|
||||
/*
|
||||
* CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal.
|
||||
* It takes an amount of time dependent on |len|, but independent of the
|
||||
@ -628,34 +350,96 @@ void OPENSSL_init(void);
|
||||
* into a defined order as the return value when a != b is undefined, other
|
||||
* than to be non-zero.
|
||||
*/
|
||||
int CRYPTO_memcmp(const volatile void *a, const volatile void *b, size_t len);
|
||||
int CRYPTO_memcmp(const void * in_a, const void * in_b, size_t len);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_CRYPTO_strings(void);
|
||||
/* Standard initialisation options */
|
||||
# define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0x00000001L
|
||||
# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS 0x00000002L
|
||||
# define OPENSSL_INIT_ADD_ALL_CIPHERS 0x00000004L
|
||||
# define OPENSSL_INIT_ADD_ALL_DIGESTS 0x00000008L
|
||||
# define OPENSSL_INIT_NO_ADD_ALL_CIPHERS 0x00000010L
|
||||
# define OPENSSL_INIT_NO_ADD_ALL_DIGESTS 0x00000020L
|
||||
# define OPENSSL_INIT_LOAD_CONFIG 0x00000040L
|
||||
# define OPENSSL_INIT_NO_LOAD_CONFIG 0x00000080L
|
||||
# define OPENSSL_INIT_ASYNC 0x00000100L
|
||||
# define OPENSSL_INIT_ENGINE_RDRAND 0x00000200L
|
||||
# define OPENSSL_INIT_ENGINE_DYNAMIC 0x00000400L
|
||||
# define OPENSSL_INIT_ENGINE_OPENSSL 0x00000800L
|
||||
# define OPENSSL_INIT_ENGINE_CRYPTODEV 0x00001000L
|
||||
# define OPENSSL_INIT_ENGINE_CAPI 0x00002000L
|
||||
# define OPENSSL_INIT_ENGINE_PADLOCK 0x00004000L
|
||||
# define OPENSSL_INIT_ENGINE_AFALG 0x00008000L
|
||||
/* OPENSSL_INIT_ZLIB 0x00010000L */
|
||||
# define OPENSSL_INIT_ATFORK 0x00020000L
|
||||
/* OPENSSL_INIT_BASE_ONLY 0x00040000L */
|
||||
# define OPENSSL_INIT_NO_ATEXIT 0x00080000L
|
||||
/* OPENSSL_INIT flag range 0xfff00000 reserved for OPENSSL_init_ssl() */
|
||||
/* Max OPENSSL_INIT flag value is 0x80000000 */
|
||||
|
||||
/* Error codes for the CRYPTO functions. */
|
||||
/* openssl and dasync not counted as builtin */
|
||||
# define OPENSSL_INIT_ENGINE_ALL_BUILTIN \
|
||||
(OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \
|
||||
| OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \
|
||||
OPENSSL_INIT_ENGINE_PADLOCK)
|
||||
|
||||
/* Function codes. */
|
||||
# define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100
|
||||
# define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID 103
|
||||
# define CRYPTO_F_CRYPTO_GET_NEW_LOCKID 101
|
||||
# define CRYPTO_F_CRYPTO_SET_EX_DATA 102
|
||||
# define CRYPTO_F_DEF_ADD_INDEX 104
|
||||
# define CRYPTO_F_DEF_GET_CLASS 105
|
||||
# define CRYPTO_F_FIPS_MODE_SET 109
|
||||
# define CRYPTO_F_INT_DUP_EX_DATA 106
|
||||
# define CRYPTO_F_INT_FREE_EX_DATA 107
|
||||
# define CRYPTO_F_INT_NEW_EX_DATA 108
|
||||
|
||||
/* Reason codes. */
|
||||
# define CRYPTO_R_FIPS_MODE_NOT_SUPPORTED 101
|
||||
# define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK 100
|
||||
/* Library initialisation functions */
|
||||
void OPENSSL_cleanup(void);
|
||||
int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings);
|
||||
int OPENSSL_atexit(void (*handler)(void));
|
||||
void OPENSSL_thread_stop(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* Low-level control of initialization */
|
||||
OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings,
|
||||
const char *config_filename);
|
||||
void OPENSSL_INIT_set_config_file_flags(OPENSSL_INIT_SETTINGS *settings,
|
||||
unsigned long flags);
|
||||
int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *settings,
|
||||
const char *config_appname);
|
||||
# endif
|
||||
void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings);
|
||||
|
||||
# if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG)
|
||||
# if defined(_WIN32)
|
||||
# if defined(BASETYPES) || defined(_WINDEF_H)
|
||||
/* application has to include <windows.h> in order to use this */
|
||||
typedef DWORD CRYPTO_THREAD_LOCAL;
|
||||
typedef DWORD CRYPTO_THREAD_ID;
|
||||
|
||||
typedef LONG CRYPTO_ONCE;
|
||||
# define CRYPTO_ONCE_STATIC_INIT 0
|
||||
# endif
|
||||
# else
|
||||
# include <pthread.h>
|
||||
typedef pthread_once_t CRYPTO_ONCE;
|
||||
typedef pthread_key_t CRYPTO_THREAD_LOCAL;
|
||||
typedef pthread_t CRYPTO_THREAD_ID;
|
||||
|
||||
# define CRYPTO_ONCE_STATIC_INIT PTHREAD_ONCE_INIT
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if !defined(CRYPTO_ONCE_STATIC_INIT)
|
||||
typedef unsigned int CRYPTO_ONCE;
|
||||
typedef unsigned int CRYPTO_THREAD_LOCAL;
|
||||
typedef unsigned int CRYPTO_THREAD_ID;
|
||||
# define CRYPTO_ONCE_STATIC_INIT 0
|
||||
# endif
|
||||
|
||||
int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void));
|
||||
|
||||
int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *));
|
||||
void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key);
|
||||
int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val);
|
||||
int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key);
|
||||
|
||||
CRYPTO_THREAD_ID CRYPTO_THREAD_get_current_id(void);
|
||||
int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b);
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
57
submodules/MtProtoKit/openssl/openssl/cryptoerr.h
Normal file
57
submodules/MtProtoKit/openssl/openssl/cryptoerr.h
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CRYPTOERR_H
|
||||
# define HEADER_CRYPTOERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_CRYPTO_strings(void);
|
||||
|
||||
/*
|
||||
* CRYPTO function codes.
|
||||
*/
|
||||
# define CRYPTO_F_CMAC_CTX_NEW 120
|
||||
# define CRYPTO_F_CRYPTO_DUP_EX_DATA 110
|
||||
# define CRYPTO_F_CRYPTO_FREE_EX_DATA 111
|
||||
# define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100
|
||||
# define CRYPTO_F_CRYPTO_MEMDUP 115
|
||||
# define CRYPTO_F_CRYPTO_NEW_EX_DATA 112
|
||||
# define CRYPTO_F_CRYPTO_OCB128_COPY_CTX 121
|
||||
# define CRYPTO_F_CRYPTO_OCB128_INIT 122
|
||||
# define CRYPTO_F_CRYPTO_SET_EX_DATA 102
|
||||
# define CRYPTO_F_FIPS_MODE_SET 109
|
||||
# define CRYPTO_F_GET_AND_LOCK 113
|
||||
# define CRYPTO_F_OPENSSL_ATEXIT 114
|
||||
# define CRYPTO_F_OPENSSL_BUF2HEXSTR 117
|
||||
# define CRYPTO_F_OPENSSL_FOPEN 119
|
||||
# define CRYPTO_F_OPENSSL_HEXSTR2BUF 118
|
||||
# define CRYPTO_F_OPENSSL_INIT_CRYPTO 116
|
||||
# define CRYPTO_F_OPENSSL_LH_NEW 126
|
||||
# define CRYPTO_F_OPENSSL_SK_DEEP_COPY 127
|
||||
# define CRYPTO_F_OPENSSL_SK_DUP 128
|
||||
# define CRYPTO_F_PKEY_HMAC_INIT 123
|
||||
# define CRYPTO_F_PKEY_POLY1305_INIT 124
|
||||
# define CRYPTO_F_PKEY_SIPHASH_INIT 125
|
||||
# define CRYPTO_F_SK_RESERVE 129
|
||||
|
||||
/*
|
||||
* CRYPTO reason codes.
|
||||
*/
|
||||
# define CRYPTO_R_FIPS_MODE_NOT_SUPPORTED 101
|
||||
# define CRYPTO_R_ILLEGAL_HEX_DIGIT 102
|
||||
# define CRYPTO_R_ODD_NUMBER_OF_DIGITS 103
|
||||
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@ -16,6 +16,7 @@
|
||||
# include <openssl/ossl_typ.h>
|
||||
# include <openssl/safestack.h>
|
||||
# include <openssl/x509.h>
|
||||
# include <openssl/cterr.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
@ -98,6 +99,21 @@ const CTLOG_STORE *CT_POLICY_EVAL_CTX_get0_log_store(const CT_POLICY_EVAL_CTX *c
|
||||
void CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(CT_POLICY_EVAL_CTX *ctx,
|
||||
CTLOG_STORE *log_store);
|
||||
|
||||
/*
|
||||
* Gets the time, in milliseconds since the Unix epoch, that will be used as the
|
||||
* current time when checking whether an SCT was issued in the future.
|
||||
* Such SCTs will fail validation, as required by RFC6962.
|
||||
*/
|
||||
uint64_t CT_POLICY_EVAL_CTX_get_time(const CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
/*
|
||||
* Sets the time to evaluate SCTs against, in milliseconds since the Unix epoch.
|
||||
* If an SCT's timestamp is after this time, it will be interpreted as having
|
||||
* been issued in the future. RFC6962 states that "TLS clients MUST reject SCTs
|
||||
* whose timestamp is in the future", so an SCT will not validate in this case.
|
||||
*/
|
||||
void CT_POLICY_EVAL_CTX_set_time(CT_POLICY_EVAL_CTX *ctx, uint64_t time_in_ms);
|
||||
|
||||
/*****************
|
||||
* SCT functions *
|
||||
*****************/
|
||||
@ -453,64 +469,6 @@ __owur int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file);
|
||||
*/
|
||||
__owur int CTLOG_STORE_load_default_file(CTLOG_STORE *store);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
|
||||
int ERR_load_CT_strings(void);
|
||||
|
||||
/* Error codes for the CT functions. */
|
||||
|
||||
/* Function codes. */
|
||||
# define CT_F_CTLOG_NEW 117
|
||||
# define CT_F_CTLOG_NEW_FROM_BASE64 118
|
||||
# define CT_F_CTLOG_NEW_FROM_CONF 119
|
||||
# define CT_F_CTLOG_NEW_NULL 120
|
||||
# define CT_F_CTLOG_STORE_LOAD_CTX_NEW 122
|
||||
# define CT_F_CTLOG_STORE_LOAD_FILE 123
|
||||
# define CT_F_CTLOG_STORE_LOAD_LOG 130
|
||||
# define CT_F_CTLOG_STORE_NEW 131
|
||||
# define CT_F_CT_BASE64_DECODE 124
|
||||
# define CT_F_CT_POLICY_EVAL_CTX_NEW 133
|
||||
# define CT_F_CT_V1_LOG_ID_FROM_PKEY 125
|
||||
# define CT_F_I2O_SCT 107
|
||||
# define CT_F_I2O_SCT_LIST 108
|
||||
# define CT_F_I2O_SCT_SIGNATURE 109
|
||||
# define CT_F_O2I_SCT 110
|
||||
# define CT_F_O2I_SCT_LIST 111
|
||||
# define CT_F_O2I_SCT_SIGNATURE 112
|
||||
# define CT_F_SCT_CTX_NEW 126
|
||||
# define CT_F_SCT_NEW 100
|
||||
# define CT_F_SCT_NEW_FROM_BASE64 127
|
||||
# define CT_F_SCT_SET0_LOG_ID 101
|
||||
# define CT_F_SCT_SET1_EXTENSIONS 114
|
||||
# define CT_F_SCT_SET1_LOG_ID 115
|
||||
# define CT_F_SCT_SET1_SIGNATURE 116
|
||||
# define CT_F_SCT_SET_LOG_ENTRY_TYPE 102
|
||||
# define CT_F_SCT_SET_SIGNATURE_NID 103
|
||||
# define CT_F_SCT_SET_VERSION 104
|
||||
# define CT_F_SCT_CTX_VERIFY 128
|
||||
|
||||
/* Reason codes. */
|
||||
# define CT_R_BASE64_DECODE_ERROR 108
|
||||
# define CT_R_INVALID_LOG_ID_LENGTH 100
|
||||
# define CT_R_LOG_CONF_INVALID 109
|
||||
# define CT_R_LOG_CONF_INVALID_KEY 110
|
||||
# define CT_R_LOG_CONF_MISSING_DESCRIPTION 111
|
||||
# define CT_R_LOG_CONF_MISSING_KEY 112
|
||||
# define CT_R_LOG_KEY_INVALID 113
|
||||
# define CT_R_SCT_INVALID 104
|
||||
# define CT_R_SCT_INVALID_SIGNATURE 107
|
||||
# define CT_R_SCT_LIST_INVALID 105
|
||||
# define CT_R_SCT_LOG_ID_MISMATCH 114
|
||||
# define CT_R_SCT_NOT_SET 106
|
||||
# define CT_R_SCT_UNSUPPORTED_VERSION 115
|
||||
# define CT_R_UNRECOGNIZED_SIGNATURE_NID 101
|
||||
# define CT_R_UNSUPPORTED_ENTRY_TYPE 102
|
||||
# define CT_R_UNSUPPORTED_VERSION 103
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
80
submodules/MtProtoKit/openssl/openssl/cterr.h
Normal file
80
submodules/MtProtoKit/openssl/openssl/cterr.h
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CTERR_H
|
||||
# define HEADER_CTERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_CT
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_CT_strings(void);
|
||||
|
||||
/*
|
||||
* CT function codes.
|
||||
*/
|
||||
# define CT_F_CTLOG_NEW 117
|
||||
# define CT_F_CTLOG_NEW_FROM_BASE64 118
|
||||
# define CT_F_CTLOG_NEW_FROM_CONF 119
|
||||
# define CT_F_CTLOG_STORE_LOAD_CTX_NEW 122
|
||||
# define CT_F_CTLOG_STORE_LOAD_FILE 123
|
||||
# define CT_F_CTLOG_STORE_LOAD_LOG 130
|
||||
# define CT_F_CTLOG_STORE_NEW 131
|
||||
# define CT_F_CT_BASE64_DECODE 124
|
||||
# define CT_F_CT_POLICY_EVAL_CTX_NEW 133
|
||||
# define CT_F_CT_V1_LOG_ID_FROM_PKEY 125
|
||||
# define CT_F_I2O_SCT 107
|
||||
# define CT_F_I2O_SCT_LIST 108
|
||||
# define CT_F_I2O_SCT_SIGNATURE 109
|
||||
# define CT_F_O2I_SCT 110
|
||||
# define CT_F_O2I_SCT_LIST 111
|
||||
# define CT_F_O2I_SCT_SIGNATURE 112
|
||||
# define CT_F_SCT_CTX_NEW 126
|
||||
# define CT_F_SCT_CTX_VERIFY 128
|
||||
# define CT_F_SCT_NEW 100
|
||||
# define CT_F_SCT_NEW_FROM_BASE64 127
|
||||
# define CT_F_SCT_SET0_LOG_ID 101
|
||||
# define CT_F_SCT_SET1_EXTENSIONS 114
|
||||
# define CT_F_SCT_SET1_LOG_ID 115
|
||||
# define CT_F_SCT_SET1_SIGNATURE 116
|
||||
# define CT_F_SCT_SET_LOG_ENTRY_TYPE 102
|
||||
# define CT_F_SCT_SET_SIGNATURE_NID 103
|
||||
# define CT_F_SCT_SET_VERSION 104
|
||||
|
||||
/*
|
||||
* CT reason codes.
|
||||
*/
|
||||
# define CT_R_BASE64_DECODE_ERROR 108
|
||||
# define CT_R_INVALID_LOG_ID_LENGTH 100
|
||||
# define CT_R_LOG_CONF_INVALID 109
|
||||
# define CT_R_LOG_CONF_INVALID_KEY 110
|
||||
# define CT_R_LOG_CONF_MISSING_DESCRIPTION 111
|
||||
# define CT_R_LOG_CONF_MISSING_KEY 112
|
||||
# define CT_R_LOG_KEY_INVALID 113
|
||||
# define CT_R_SCT_FUTURE_TIMESTAMP 116
|
||||
# define CT_R_SCT_INVALID 104
|
||||
# define CT_R_SCT_INVALID_SIGNATURE 107
|
||||
# define CT_R_SCT_LIST_INVALID 105
|
||||
# define CT_R_SCT_LOG_ID_MISMATCH 114
|
||||
# define CT_R_SCT_NOT_SET 106
|
||||
# define CT_R_SCT_UNSUPPORTED_VERSION 115
|
||||
# define CT_R_UNRECOGNIZED_SIGNATURE_NID 101
|
||||
# define CT_R_UNSUPPORTED_ENTRY_TYPE 102
|
||||
# define CT_R_UNSUPPORTED_VERSION 103
|
||||
|
||||
# endif
|
||||
#endif
|
@ -1,80 +1,30 @@
|
||||
/* crypto/des/des.h */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_NEW_DES_H
|
||||
# define HEADER_NEW_DES_H
|
||||
#ifndef HEADER_DES_H
|
||||
# define HEADER_DES_H
|
||||
|
||||
# include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG
|
||||
* (via openssl/opensslconf.h */
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifdef OPENSSL_NO_DES
|
||||
# error DES is disabled.
|
||||
# ifndef OPENSSL_NO_DES
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
typedef unsigned int DES_LONG;
|
||||
|
||||
# ifdef OPENSSL_BUILD_SHLIBCRYPTO
|
||||
# undef OPENSSL_EXTERN
|
||||
# define OPENSSL_EXTERN OPENSSL_EXPORT
|
||||
# endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef unsigned char DES_cblock[8];
|
||||
typedef /* const */ unsigned char const_DES_cblock[8];
|
||||
/*
|
||||
@ -92,16 +42,6 @@ typedef struct DES_ks {
|
||||
} ks[16];
|
||||
} DES_key_schedule;
|
||||
|
||||
# ifndef OPENSSL_DISABLE_OLD_DES_SUPPORT
|
||||
# ifndef OPENSSL_ENABLE_OLD_DES_SUPPORT
|
||||
# define OPENSSL_ENABLE_OLD_DES_SUPPORT
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef OPENSSL_ENABLE_OLD_DES_SUPPORT
|
||||
# include <openssl/des_old.h>
|
||||
# endif
|
||||
|
||||
# define DES_KEY_SZ (sizeof(DES_cblock))
|
||||
# define DES_SCHEDULE_SZ (sizeof(DES_key_schedule))
|
||||
|
||||
@ -125,8 +65,6 @@ typedef struct DES_ks {
|
||||
|
||||
OPENSSL_DECLARE_GLOBAL(int, DES_check_key); /* defaults to false */
|
||||
# define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key)
|
||||
OPENSSL_DECLARE_GLOBAL(int, DES_rw_mode); /* defaults to DES_PCBC_MODE */
|
||||
# define DES_rw_mode OPENSSL_GLOBAL_REF(DES_rw_mode)
|
||||
|
||||
const char *DES_options(void);
|
||||
void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,
|
||||
@ -182,11 +120,6 @@ void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output,
|
||||
long length,
|
||||
DES_key_schedule *ks1, DES_key_schedule *ks2,
|
||||
DES_key_schedule *ks3, DES_cblock *ivec, int enc);
|
||||
void DES_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length,
|
||||
DES_key_schedule *ks1, DES_key_schedule *ks2,
|
||||
DES_key_schedule *ks3,
|
||||
DES_cblock *ivec1, DES_cblock *ivec2, int enc);
|
||||
void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, DES_key_schedule *ks1,
|
||||
DES_key_schedule *ks2, DES_key_schedule *ks3,
|
||||
@ -199,15 +132,6 @@ void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, DES_key_schedule *ks1,
|
||||
DES_key_schedule *ks2, DES_key_schedule *ks3,
|
||||
DES_cblock *ivec, int *num);
|
||||
# if 0
|
||||
void DES_xwhite_in2out(const_DES_cblock *DES_key, const_DES_cblock *in_white,
|
||||
DES_cblock *out_white);
|
||||
# endif
|
||||
|
||||
int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched,
|
||||
DES_cblock *iv);
|
||||
int DES_enc_write(int fd, const void *buf, int len, DES_key_schedule *sched,
|
||||
DES_cblock *iv);
|
||||
char *DES_fcrypt(const char *buf, const char *salt, char *ret);
|
||||
char *DES_crypt(const char *buf, const char *salt);
|
||||
void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits,
|
||||
@ -231,10 +155,6 @@ int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule);
|
||||
int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule);
|
||||
int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule);
|
||||
void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule);
|
||||
# ifdef OPENSSL_FIPS
|
||||
void private_DES_set_key_unchecked(const_DES_cblock *key,
|
||||
DES_key_schedule *schedule);
|
||||
# endif
|
||||
void DES_string_to_key(const char *str, DES_cblock *key);
|
||||
void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2);
|
||||
void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
@ -244,14 +164,11 @@ void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, DES_key_schedule *schedule,
|
||||
DES_cblock *ivec, int *num);
|
||||
|
||||
int DES_read_password(DES_cblock *key, const char *prompt, int verify);
|
||||
int DES_read_2passwords(DES_cblock *key1, DES_cblock *key2,
|
||||
const char *prompt, int verify);
|
||||
|
||||
# define DES_fixup_key_parity DES_set_odd_parity
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
@ -1,98 +1,50 @@
|
||||
/* crypto/dh/dh.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_DH_H
|
||||
# define HEADER_DH_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_DH
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
# ifdef OPENSSL_NO_DH
|
||||
# error DH is disabled.
|
||||
# endif
|
||||
|
||||
# ifndef OPENSSL_NO_BIO
|
||||
# include <openssl/bio.h>
|
||||
# endif
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/asn1.h>
|
||||
# include <openssl/ossl_typ.h>
|
||||
# ifndef OPENSSL_NO_DEPRECATED
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# include <openssl/bn.h>
|
||||
# endif
|
||||
# include <openssl/dherr.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# ifndef OPENSSL_DH_MAX_MODULUS_BITS
|
||||
# define OPENSSL_DH_MAX_MODULUS_BITS 10000
|
||||
# endif
|
||||
|
||||
# define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024
|
||||
|
||||
# define DH_FLAG_CACHE_MONT_P 0x01
|
||||
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
/*
|
||||
* new with 0.9.7h; the built-in DH
|
||||
* implementation now uses constant time
|
||||
* modular exponentiation for secret exponents
|
||||
* by default. This flag causes the
|
||||
* faster variable sliding window method to
|
||||
* be used for all exponents.
|
||||
* Does nothing. Previously this switched off constant time behaviour.
|
||||
*/
|
||||
# define DH_FLAG_NO_EXP_CONSTTIME 0x02
|
||||
# define DH_FLAG_NO_EXP_CONSTTIME 0x00
|
||||
# endif
|
||||
|
||||
/*
|
||||
* If this flag is set the DH method is FIPS compliant and can be used in
|
||||
* FIPS mode. This is set in the validated module method. If an application
|
||||
* sets this flag in its own methods it is its reposibility to ensure the
|
||||
* sets this flag in its own methods it is its responsibility to ensure the
|
||||
* result is compliant.
|
||||
*/
|
||||
|
||||
@ -106,57 +58,11 @@
|
||||
|
||||
# define DH_FLAG_NON_FIPS_ALLOW 0x0400
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Already defined in ossl_typ.h */
|
||||
/* typedef struct dh_st DH; */
|
||||
/* typedef struct dh_method DH_METHOD; */
|
||||
|
||||
struct dh_method {
|
||||
const char *name;
|
||||
/* Methods here */
|
||||
int (*generate_key) (DH *dh);
|
||||
int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh);
|
||||
/* Can be null */
|
||||
int (*bn_mod_exp) (const DH *dh, BIGNUM *r, const BIGNUM *a,
|
||||
const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
|
||||
BN_MONT_CTX *m_ctx);
|
||||
int (*init) (DH *dh);
|
||||
int (*finish) (DH *dh);
|
||||
int flags;
|
||||
char *app_data;
|
||||
/* If this is non-NULL, it will be used to generate parameters */
|
||||
int (*generate_params) (DH *dh, int prime_len, int generator,
|
||||
BN_GENCB *cb);
|
||||
};
|
||||
|
||||
struct dh_st {
|
||||
/*
|
||||
* This first argument is used to pick up errors when a DH is passed
|
||||
* instead of a EVP_PKEY
|
||||
*/
|
||||
int pad;
|
||||
int version;
|
||||
BIGNUM *p;
|
||||
BIGNUM *g;
|
||||
long length; /* optional */
|
||||
BIGNUM *pub_key; /* g^x % p */
|
||||
BIGNUM *priv_key; /* x */
|
||||
int flags;
|
||||
BN_MONT_CTX *method_mont_p;
|
||||
/* Place holders if we want to do X9.42 DH */
|
||||
BIGNUM *q;
|
||||
BIGNUM *j;
|
||||
unsigned char *seed;
|
||||
int seedlen;
|
||||
BIGNUM *counter;
|
||||
int references;
|
||||
CRYPTO_EX_DATA ex_data;
|
||||
const DH_METHOD *meth;
|
||||
ENGINE *engine;
|
||||
};
|
||||
DECLARE_ASN1_ITEM(DHparams)
|
||||
|
||||
# define DH_GENERATOR_2 2
|
||||
/* #define DH_GENERATOR_3 3 */
|
||||
@ -182,12 +88,29 @@ struct dh_st {
|
||||
*/
|
||||
# define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME
|
||||
|
||||
# define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \
|
||||
(char *(*)())d2i_DHparams,(fp),(unsigned char **)(x))
|
||||
# define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \
|
||||
(unsigned char *)(x))
|
||||
# define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x)
|
||||
# define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x)
|
||||
# define d2i_DHparams_fp(fp,x) \
|
||||
(DH *)ASN1_d2i_fp((char *(*)())DH_new, \
|
||||
(char *(*)())d2i_DHparams, \
|
||||
(fp), \
|
||||
(unsigned char **)(x))
|
||||
# define i2d_DHparams_fp(fp,x) \
|
||||
ASN1_i2d_fp(i2d_DHparams,(fp), (unsigned char *)(x))
|
||||
# define d2i_DHparams_bio(bp,x) \
|
||||
ASN1_d2i_bio_of(DH, DH_new, d2i_DHparams, bp, x)
|
||||
# define i2d_DHparams_bio(bp,x) \
|
||||
ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x)
|
||||
|
||||
# define d2i_DHxparams_fp(fp,x) \
|
||||
(DH *)ASN1_d2i_fp((char *(*)())DH_new, \
|
||||
(char *(*)())d2i_DHxparams, \
|
||||
(fp), \
|
||||
(unsigned char **)(x))
|
||||
# define i2d_DHxparams_fp(fp,x) \
|
||||
ASN1_i2d_fp(i2d_DHxparams,(fp), (unsigned char *)(x))
|
||||
# define d2i_DHxparams_bio(bp,x) \
|
||||
ASN1_d2i_bio_of(DH, DH_new, d2i_DHxparams, bp, x)
|
||||
# define i2d_DHxparams_bio(bp,x) \
|
||||
ASN1_i2d_bio_of_const(DH, i2d_DHxparams, bp, x)
|
||||
|
||||
DH *DHparams_dup(DH *);
|
||||
|
||||
@ -201,22 +124,28 @@ DH *DH_new_method(ENGINE *engine);
|
||||
DH *DH_new(void);
|
||||
void DH_free(DH *dh);
|
||||
int DH_up_ref(DH *dh);
|
||||
int DH_bits(const DH *dh);
|
||||
int DH_size(const DH *dh);
|
||||
int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
|
||||
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
|
||||
int DH_security_bits(const DH *dh);
|
||||
#define DH_get_ex_new_index(l, p, newf, dupf, freef) \
|
||||
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DH, l, p, newf, dupf, freef)
|
||||
int DH_set_ex_data(DH *d, int idx, void *arg);
|
||||
void *DH_get_ex_data(DH *d, int idx);
|
||||
|
||||
/* Deprecated version */
|
||||
# ifndef OPENSSL_NO_DEPRECATED
|
||||
DH *DH_generate_parameters(int prime_len, int generator,
|
||||
void (*callback) (int, int, void *), void *cb_arg);
|
||||
# endif /* !defined(OPENSSL_NO_DEPRECATED) */
|
||||
DEPRECATEDIN_0_9_8(DH *DH_generate_parameters(int prime_len, int generator,
|
||||
void (*callback) (int, int,
|
||||
void *),
|
||||
void *cb_arg))
|
||||
|
||||
/* New version */
|
||||
int DH_generate_parameters_ex(DH *dh, int prime_len, int generator,
|
||||
BN_GENCB *cb);
|
||||
|
||||
int DH_check_params_ex(const DH *dh);
|
||||
int DH_check_ex(const DH *dh);
|
||||
int DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key);
|
||||
int DH_check_params(const DH *dh, int *ret);
|
||||
int DH_check(const DH *dh, int *codes);
|
||||
int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *codes);
|
||||
int DH_generate_key(DH *dh);
|
||||
@ -226,25 +155,76 @@ DH *d2i_DHparams(DH **a, const unsigned char **pp, long length);
|
||||
int i2d_DHparams(const DH *a, unsigned char **pp);
|
||||
DH *d2i_DHxparams(DH **a, const unsigned char **pp, long length);
|
||||
int i2d_DHxparams(const DH *a, unsigned char **pp);
|
||||
# ifndef OPENSSL_NO_FP_API
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int DHparams_print_fp(FILE *fp, const DH *x);
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_BIO
|
||||
int DHparams_print(BIO *bp, const DH *x);
|
||||
# else
|
||||
int DHparams_print(char *bp, const DH *x);
|
||||
# endif
|
||||
|
||||
/* RFC 5114 parameters */
|
||||
DH *DH_get_1024_160(void);
|
||||
DH *DH_get_2048_224(void);
|
||||
DH *DH_get_2048_256(void);
|
||||
|
||||
/* Named parameters, currently RFC7919 */
|
||||
DH *DH_new_by_nid(int nid);
|
||||
int DH_get_nid(const DH *dh);
|
||||
|
||||
# ifndef OPENSSL_NO_CMS
|
||||
/* RFC2631 KDF */
|
||||
int DH_KDF_X9_42(unsigned char *out, size_t outlen,
|
||||
const unsigned char *Z, size_t Zlen,
|
||||
ASN1_OBJECT *key_oid,
|
||||
const unsigned char *ukm, size_t ukmlen, const EVP_MD *md);
|
||||
# endif
|
||||
|
||||
void DH_get0_pqg(const DH *dh,
|
||||
const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);
|
||||
int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
|
||||
void DH_get0_key(const DH *dh,
|
||||
const BIGNUM **pub_key, const BIGNUM **priv_key);
|
||||
int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key);
|
||||
const BIGNUM *DH_get0_p(const DH *dh);
|
||||
const BIGNUM *DH_get0_q(const DH *dh);
|
||||
const BIGNUM *DH_get0_g(const DH *dh);
|
||||
const BIGNUM *DH_get0_priv_key(const DH *dh);
|
||||
const BIGNUM *DH_get0_pub_key(const DH *dh);
|
||||
void DH_clear_flags(DH *dh, int flags);
|
||||
int DH_test_flags(const DH *dh, int flags);
|
||||
void DH_set_flags(DH *dh, int flags);
|
||||
ENGINE *DH_get0_engine(DH *d);
|
||||
long DH_get_length(const DH *dh);
|
||||
int DH_set_length(DH *dh, long length);
|
||||
|
||||
DH_METHOD *DH_meth_new(const char *name, int flags);
|
||||
void DH_meth_free(DH_METHOD *dhm);
|
||||
DH_METHOD *DH_meth_dup(const DH_METHOD *dhm);
|
||||
const char *DH_meth_get0_name(const DH_METHOD *dhm);
|
||||
int DH_meth_set1_name(DH_METHOD *dhm, const char *name);
|
||||
int DH_meth_get_flags(const DH_METHOD *dhm);
|
||||
int DH_meth_set_flags(DH_METHOD *dhm, int flags);
|
||||
void *DH_meth_get0_app_data(const DH_METHOD *dhm);
|
||||
int DH_meth_set0_app_data(DH_METHOD *dhm, void *app_data);
|
||||
int (*DH_meth_get_generate_key(const DH_METHOD *dhm)) (DH *);
|
||||
int DH_meth_set_generate_key(DH_METHOD *dhm, int (*generate_key) (DH *));
|
||||
int (*DH_meth_get_compute_key(const DH_METHOD *dhm))
|
||||
(unsigned char *key, const BIGNUM *pub_key, DH *dh);
|
||||
int DH_meth_set_compute_key(DH_METHOD *dhm,
|
||||
int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh));
|
||||
int (*DH_meth_get_bn_mod_exp(const DH_METHOD *dhm))
|
||||
(const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||
BN_CTX *, BN_MONT_CTX *);
|
||||
int DH_meth_set_bn_mod_exp(DH_METHOD *dhm,
|
||||
int (*bn_mod_exp) (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||
const BIGNUM *, BN_CTX *, BN_MONT_CTX *));
|
||||
int (*DH_meth_get_init(const DH_METHOD *dhm))(DH *);
|
||||
int DH_meth_set_init(DH_METHOD *dhm, int (*init)(DH *));
|
||||
int (*DH_meth_get_finish(const DH_METHOD *dhm)) (DH *);
|
||||
int DH_meth_set_finish(DH_METHOD *dhm, int (*finish) (DH *));
|
||||
int (*DH_meth_get_generate_params(const DH_METHOD *dhm))
|
||||
(DH *, int, int, BN_GENCB *);
|
||||
int DH_meth_set_generate_params(DH_METHOD *dhm,
|
||||
int (*generate_params) (DH *, int, int, BN_GENCB *));
|
||||
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \
|
||||
@ -270,6 +250,15 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen,
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \
|
||||
EVP_PKEY_CTRL_DH_RFC5114, gen, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_nid(ctx, nid) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, \
|
||||
EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN, \
|
||||
EVP_PKEY_CTRL_DH_NID, nid, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_pad(ctx, pad) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_DH_PAD, pad, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_kdf_type(ctx, kdf) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
@ -283,22 +272,22 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen,
|
||||
# define EVP_PKEY_CTX_set0_dh_kdf_oid(ctx, oid) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_DH_KDF_OID, 0, (void *)oid)
|
||||
EVP_PKEY_CTRL_DH_KDF_OID, 0, (void *)(oid))
|
||||
|
||||
# define EVP_PKEY_CTX_get0_dh_kdf_oid(ctx, poid) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_GET_DH_KDF_OID, 0, (void *)poid)
|
||||
EVP_PKEY_CTRL_GET_DH_KDF_OID, 0, (void *)(poid))
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_kdf_md(ctx, md) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_DH_KDF_MD, 0, (void *)md)
|
||||
EVP_PKEY_CTRL_DH_KDF_MD, 0, (void *)(md))
|
||||
|
||||
# define EVP_PKEY_CTX_get_dh_kdf_md(ctx, pmd) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_GET_DH_KDF_MD, 0, (void *)pmd)
|
||||
EVP_PKEY_CTRL_GET_DH_KDF_MD, 0, (void *)(pmd))
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_kdf_outlen(ctx, len) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
@ -308,17 +297,17 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen,
|
||||
# define EVP_PKEY_CTX_get_dh_kdf_outlen(ctx, plen) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN, 0, (void *)plen)
|
||||
EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN, 0, (void *)(plen))
|
||||
|
||||
# define EVP_PKEY_CTX_set0_dh_kdf_ukm(ctx, p, plen) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_DH_KDF_UKM, plen, (void *)p)
|
||||
EVP_PKEY_CTRL_DH_KDF_UKM, plen, (void *)(p))
|
||||
|
||||
# define EVP_PKEY_CTX_get0_dh_kdf_ukm(ctx, p) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_GET_DH_KDF_UKM, 0, (void *)p)
|
||||
EVP_PKEY_CTRL_GET_DH_KDF_UKM, 0, (void *)(p))
|
||||
|
||||
# define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN (EVP_PKEY_ALG_CTRL + 1)
|
||||
# define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR (EVP_PKEY_ALG_CTRL + 2)
|
||||
@ -334,60 +323,18 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen,
|
||||
# define EVP_PKEY_CTRL_GET_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 12)
|
||||
# define EVP_PKEY_CTRL_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 13)
|
||||
# define EVP_PKEY_CTRL_GET_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 14)
|
||||
# define EVP_PKEY_CTRL_DH_NID (EVP_PKEY_ALG_CTRL + 15)
|
||||
# define EVP_PKEY_CTRL_DH_PAD (EVP_PKEY_ALG_CTRL + 16)
|
||||
|
||||
/* KDF types */
|
||||
# define EVP_PKEY_DH_KDF_NONE 1
|
||||
# ifndef OPENSSL_NO_CMS
|
||||
# define EVP_PKEY_DH_KDF_X9_42 2
|
||||
# endif
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_DH_strings(void);
|
||||
|
||||
/* Error codes for the DH functions. */
|
||||
|
||||
/* Function codes. */
|
||||
# define DH_F_COMPUTE_KEY 102
|
||||
# define DH_F_DHPARAMS_PRINT_FP 101
|
||||
# define DH_F_DH_BUILTIN_GENPARAMS 106
|
||||
# define DH_F_DH_CMS_DECRYPT 117
|
||||
# define DH_F_DH_CMS_SET_PEERKEY 118
|
||||
# define DH_F_DH_CMS_SET_SHARED_INFO 119
|
||||
# define DH_F_DH_COMPUTE_KEY 114
|
||||
# define DH_F_DH_GENERATE_KEY 115
|
||||
# define DH_F_DH_GENERATE_PARAMETERS_EX 116
|
||||
# define DH_F_DH_NEW_METHOD 105
|
||||
# define DH_F_DH_PARAM_DECODE 107
|
||||
# define DH_F_DH_PRIV_DECODE 110
|
||||
# define DH_F_DH_PRIV_ENCODE 111
|
||||
# define DH_F_DH_PUB_DECODE 108
|
||||
# define DH_F_DH_PUB_ENCODE 109
|
||||
# define DH_F_DO_DH_PRINT 100
|
||||
# define DH_F_GENERATE_KEY 103
|
||||
# define DH_F_GENERATE_PARAMETERS 104
|
||||
# define DH_F_PKEY_DH_DERIVE 112
|
||||
# define DH_F_PKEY_DH_KEYGEN 113
|
||||
|
||||
/* Reason codes. */
|
||||
# define DH_R_BAD_GENERATOR 101
|
||||
# define DH_R_BN_DECODE_ERROR 109
|
||||
# define DH_R_BN_ERROR 106
|
||||
# define DH_R_DECODE_ERROR 104
|
||||
# define DH_R_INVALID_PUBKEY 102
|
||||
# define DH_R_KDF_PARAMETER_ERROR 112
|
||||
# define DH_R_KEYS_NOT_SET 108
|
||||
# define DH_R_KEY_SIZE_TOO_SMALL 110
|
||||
# define DH_R_MODULUS_TOO_LARGE 103
|
||||
# define DH_R_NON_FIPS_METHOD 111
|
||||
# define DH_R_NO_PARAMETERS_SET 107
|
||||
# define DH_R_NO_PRIVATE_VALUE 100
|
||||
# define DH_R_PARAMETER_ENCODING_ERROR 105
|
||||
# define DH_R_PEER_KEY_ERROR 113
|
||||
# define DH_R_SHARED_INFO_ERROR 114
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
88
submodules/MtProtoKit/openssl/openssl/dherr.h
Normal file
88
submodules/MtProtoKit/openssl/openssl/dherr.h
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_DHERR_H
|
||||
# define HEADER_DHERR_H
|
||||
|
||||
# ifndef HEADER_SYMHACKS_H
|
||||
# include <openssl/symhacks.h>
|
||||
# endif
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_DH
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int ERR_load_DH_strings(void);
|
||||
|
||||
/*
|
||||
* DH function codes.
|
||||
*/
|
||||
# define DH_F_COMPUTE_KEY 102
|
||||
# define DH_F_DHPARAMS_PRINT_FP 101
|
||||
# define DH_F_DH_BUILTIN_GENPARAMS 106
|
||||
# define DH_F_DH_CHECK_EX 121
|
||||
# define DH_F_DH_CHECK_PARAMS_EX 122
|
||||
# define DH_F_DH_CHECK_PUB_KEY_EX 123
|
||||
# define DH_F_DH_CMS_DECRYPT 114
|
||||
# define DH_F_DH_CMS_SET_PEERKEY 115
|
||||
# define DH_F_DH_CMS_SET_SHARED_INFO 116
|
||||
# define DH_F_DH_METH_DUP 117
|
||||
# define DH_F_DH_METH_NEW 118
|
||||
# define DH_F_DH_METH_SET1_NAME 119
|
||||
# define DH_F_DH_NEW_BY_NID 104
|
||||
# define DH_F_DH_NEW_METHOD 105
|
||||
# define DH_F_DH_PARAM_DECODE 107
|
||||
# define DH_F_DH_PKEY_PUBLIC_CHECK 124
|
||||
# define DH_F_DH_PRIV_DECODE 110
|
||||
# define DH_F_DH_PRIV_ENCODE 111
|
||||
# define DH_F_DH_PUB_DECODE 108
|
||||
# define DH_F_DH_PUB_ENCODE 109
|
||||
# define DH_F_DO_DH_PRINT 100
|
||||
# define DH_F_GENERATE_KEY 103
|
||||
# define DH_F_PKEY_DH_CTRL_STR 120
|
||||
# define DH_F_PKEY_DH_DERIVE 112
|
||||
# define DH_F_PKEY_DH_INIT 125
|
||||
# define DH_F_PKEY_DH_KEYGEN 113
|
||||
|
||||
/*
|
||||
* DH reason codes.
|
||||
*/
|
||||
# define DH_R_BAD_GENERATOR 101
|
||||
# define DH_R_BN_DECODE_ERROR 109
|
||||
# define DH_R_BN_ERROR 106
|
||||
# define DH_R_CHECK_INVALID_J_VALUE 115
|
||||
# define DH_R_CHECK_INVALID_Q_VALUE 116
|
||||
# define DH_R_CHECK_PUBKEY_INVALID 122
|
||||
# define DH_R_CHECK_PUBKEY_TOO_LARGE 123
|
||||
# define DH_R_CHECK_PUBKEY_TOO_SMALL 124
|
||||
# define DH_R_CHECK_P_NOT_PRIME 117
|
||||
# define DH_R_CHECK_P_NOT_SAFE_PRIME 118
|
||||
# define DH_R_CHECK_Q_NOT_PRIME 119
|
||||
# define DH_R_DECODE_ERROR 104
|
||||
# define DH_R_INVALID_PARAMETER_NAME 110
|
||||
# define DH_R_INVALID_PARAMETER_NID 114
|
||||
# define DH_R_INVALID_PUBKEY 102
|
||||
# define DH_R_KDF_PARAMETER_ERROR 112
|
||||
# define DH_R_KEYS_NOT_SET 108
|
||||
# define DH_R_MISSING_PUBKEY 125
|
||||
# define DH_R_MODULUS_TOO_LARGE 103
|
||||
# define DH_R_NOT_SUITABLE_GENERATOR 120
|
||||
# define DH_R_NO_PARAMETERS_SET 107
|
||||
# define DH_R_NO_PRIVATE_VALUE 100
|
||||
# define DH_R_PARAMETER_ENCODING_ERROR 105
|
||||
# define DH_R_PEER_KEY_ERROR 111
|
||||
# define DH_R_SHARED_INFO_ERROR 113
|
||||
# define DH_R_UNABLE_TO_CHECK_GENERATOR 121
|
||||
|
||||
# endif
|
||||
#endif
|
@ -1,105 +1,49 @@
|
||||
/* crypto/dsa/dsa.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
/*
|
||||
* The DSS routines are based on patches supplied by
|
||||
* Steven Schoch <schoch@sheba.arc.nasa.gov>. He basically did the
|
||||
* work and I have just tweaked them a little to fit into my
|
||||
* stylistic vision for SSLeay :-) */
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_DSA_H
|
||||
# define HEADER_DSA_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_DSA
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
# ifdef OPENSSL_NO_DSA
|
||||
# error DSA is disabled.
|
||||
# endif
|
||||
|
||||
# ifndef OPENSSL_NO_BIO
|
||||
# include <openssl/bio.h>
|
||||
# endif
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/crypto.h>
|
||||
# include <openssl/ossl_typ.h>
|
||||
|
||||
# ifndef OPENSSL_NO_DEPRECATED
|
||||
# include <openssl/bn.h>
|
||||
# ifndef OPENSSL_NO_DH
|
||||
# include <openssl/dh.h>
|
||||
# endif
|
||||
# include <openssl/bn.h>
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# include <openssl/dh.h>
|
||||
# endif
|
||||
# include <openssl/dsaerr.h>
|
||||
|
||||
# ifndef OPENSSL_DSA_MAX_MODULUS_BITS
|
||||
# define OPENSSL_DSA_MAX_MODULUS_BITS 10000
|
||||
# endif
|
||||
|
||||
# define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS 1024
|
||||
|
||||
# define DSA_FLAG_CACHE_MONT_P 0x01
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
/*
|
||||
* new with 0.9.7h; the built-in DSA implementation now uses constant time
|
||||
* modular exponentiation for secret exponents by default. This flag causes
|
||||
* the faster variable sliding window method to be used for all exponents.
|
||||
* Does nothing. Previously this switched off constant time behaviour.
|
||||
*/
|
||||
# define DSA_FLAG_NO_EXP_CONSTTIME 0x02
|
||||
# define DSA_FLAG_NO_EXP_CONSTTIME 0x00
|
||||
# endif
|
||||
|
||||
/*
|
||||
* If this flag is set the DSA method is FIPS compliant and can be used in
|
||||
* FIPS mode. This is set in the validated module method. If an application
|
||||
* sets this flag in its own methods it is its reposibility to ensure the
|
||||
* sets this flag in its own methods it is its responsibility to ensure the
|
||||
* result is compliant.
|
||||
*/
|
||||
|
||||
@ -112,70 +56,13 @@
|
||||
*/
|
||||
|
||||
# define DSA_FLAG_NON_FIPS_ALLOW 0x0400
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# define DSA_FLAG_FIPS_CHECKED 0x0800
|
||||
|
||||
/* Already defined in ossl_typ.h */
|
||||
/* typedef struct dsa_st DSA; */
|
||||
/* typedef struct dsa_method DSA_METHOD; */
|
||||
|
||||
typedef struct DSA_SIG_st {
|
||||
BIGNUM *r;
|
||||
BIGNUM *s;
|
||||
} DSA_SIG;
|
||||
|
||||
struct dsa_method {
|
||||
const char *name;
|
||||
DSA_SIG *(*dsa_do_sign) (const unsigned char *dgst, int dlen, DSA *dsa);
|
||||
int (*dsa_sign_setup) (DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp,
|
||||
BIGNUM **rp);
|
||||
int (*dsa_do_verify) (const unsigned char *dgst, int dgst_len,
|
||||
DSA_SIG *sig, DSA *dsa);
|
||||
int (*dsa_mod_exp) (DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,
|
||||
BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx,
|
||||
BN_MONT_CTX *in_mont);
|
||||
/* Can be null */
|
||||
int (*bn_mod_exp) (DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
|
||||
int (*init) (DSA *dsa);
|
||||
int (*finish) (DSA *dsa);
|
||||
int flags;
|
||||
char *app_data;
|
||||
/* If this is non-NULL, it is used to generate DSA parameters */
|
||||
int (*dsa_paramgen) (DSA *dsa, int bits,
|
||||
const unsigned char *seed, int seed_len,
|
||||
int *counter_ret, unsigned long *h_ret,
|
||||
BN_GENCB *cb);
|
||||
/* If this is non-NULL, it is used to generate DSA keys */
|
||||
int (*dsa_keygen) (DSA *dsa);
|
||||
};
|
||||
|
||||
struct dsa_st {
|
||||
/*
|
||||
* This first variable is used to pick up errors where a DSA is passed
|
||||
* instead of of a EVP_PKEY
|
||||
*/
|
||||
int pad;
|
||||
long version;
|
||||
int write_params;
|
||||
BIGNUM *p;
|
||||
BIGNUM *q; /* == 20 */
|
||||
BIGNUM *g;
|
||||
BIGNUM *pub_key; /* y public key */
|
||||
BIGNUM *priv_key; /* x private key */
|
||||
BIGNUM *kinv; /* Signing pre-calc */
|
||||
BIGNUM *r; /* Signing pre-calc */
|
||||
int flags;
|
||||
/* Normally used to cache montgomery values */
|
||||
BN_MONT_CTX *method_mont_p;
|
||||
int references;
|
||||
CRYPTO_EX_DATA ex_data;
|
||||
const DSA_METHOD *meth;
|
||||
/* functional reference if 'meth' is ENGINE-provided */
|
||||
ENGINE *engine;
|
||||
};
|
||||
typedef struct DSA_SIG_st DSA_SIG;
|
||||
|
||||
# define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \
|
||||
(char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x))
|
||||
@ -189,6 +76,8 @@ DSA_SIG *DSA_SIG_new(void);
|
||||
void DSA_SIG_free(DSA_SIG *a);
|
||||
int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp);
|
||||
DSA_SIG *d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length);
|
||||
void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps);
|
||||
int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s);
|
||||
|
||||
DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa);
|
||||
int DSA_do_verify(const unsigned char *dgst, int dgst_len,
|
||||
@ -199,6 +88,7 @@ const DSA_METHOD *DSA_OpenSSL(void);
|
||||
void DSA_set_default_method(const DSA_METHOD *);
|
||||
const DSA_METHOD *DSA_get_default_method(void);
|
||||
int DSA_set_method(DSA *dsa, const DSA_METHOD *);
|
||||
const DSA_METHOD *DSA_get_method(DSA *d);
|
||||
|
||||
DSA *DSA_new(void);
|
||||
DSA *DSA_new_method(ENGINE *engine);
|
||||
@ -206,14 +96,16 @@ void DSA_free(DSA *r);
|
||||
/* "up" the DSA object's reference count */
|
||||
int DSA_up_ref(DSA *r);
|
||||
int DSA_size(const DSA *);
|
||||
int DSA_bits(const DSA *d);
|
||||
int DSA_security_bits(const DSA *d);
|
||||
/* next 4 return -1 on error */
|
||||
int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp);
|
||||
DEPRECATEDIN_1_2_0(int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp))
|
||||
int DSA_sign(int type, const unsigned char *dgst, int dlen,
|
||||
unsigned char *sig, unsigned int *siglen, DSA *dsa);
|
||||
int DSA_verify(int type, const unsigned char *dgst, int dgst_len,
|
||||
const unsigned char *sigbuf, int siglen, DSA *dsa);
|
||||
int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
|
||||
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
|
||||
#define DSA_get_ex_new_index(l, p, newf, dupf, freef) \
|
||||
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DSA, l, p, newf, dupf, freef)
|
||||
int DSA_set_ex_data(DSA *d, int idx, void *arg);
|
||||
void *DSA_get_ex_data(DSA *d, int idx);
|
||||
|
||||
@ -222,12 +114,14 @@ DSA *d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length);
|
||||
DSA *d2i_DSAparams(DSA **a, const unsigned char **pp, long length);
|
||||
|
||||
/* Deprecated version */
|
||||
# ifndef OPENSSL_NO_DEPRECATED
|
||||
DSA *DSA_generate_parameters(int bits,
|
||||
unsigned char *seed, int seed_len,
|
||||
int *counter_ret, unsigned long *h_ret, void
|
||||
(*callback) (int, int, void *), void *cb_arg);
|
||||
# endif /* !defined(OPENSSL_NO_DEPRECATED) */
|
||||
DEPRECATEDIN_0_9_8(DSA *DSA_generate_parameters(int bits,
|
||||
unsigned char *seed,
|
||||
int seed_len,
|
||||
int *counter_ret,
|
||||
unsigned long *h_ret, void
|
||||
(*callback) (int, int,
|
||||
void *),
|
||||
void *cb_arg))
|
||||
|
||||
/* New version */
|
||||
int DSA_generate_parameters_ex(DSA *dsa, int bits,
|
||||
@ -240,19 +134,19 @@ int i2d_DSAPublicKey(const DSA *a, unsigned char **pp);
|
||||
int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp);
|
||||
int i2d_DSAparams(const DSA *a, unsigned char **pp);
|
||||
|
||||
# ifndef OPENSSL_NO_BIO
|
||||
int DSAparams_print(BIO *bp, const DSA *x);
|
||||
int DSA_print(BIO *bp, const DSA *x, int off);
|
||||
# endif
|
||||
# ifndef OPENSSL_NO_FP_API
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int DSAparams_print_fp(FILE *fp, const DSA *x);
|
||||
int DSA_print_fp(FILE *bp, const DSA *x, int off);
|
||||
# endif
|
||||
|
||||
# define DSS_prime_checks 50
|
||||
# define DSS_prime_checks 64
|
||||
/*
|
||||
* Primality test according to FIPS PUB 186[-1], Appendix 2.1: 50 rounds of
|
||||
* Rabin-Miller
|
||||
* Primality test according to FIPS PUB 186-4, Appendix C.3. Since we only
|
||||
* have one value here we set the number of checks to 64 which is the 128 bit
|
||||
* security level that is the highest level and valid for creating a 3072 bit
|
||||
* DSA key.
|
||||
*/
|
||||
# define DSA_is_prime(n, callback, cb_arg) \
|
||||
BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg)
|
||||
@ -273,60 +167,72 @@ DH *DSA_dup_DH(const DSA *r);
|
||||
# define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS (EVP_PKEY_ALG_CTRL + 2)
|
||||
# define EVP_PKEY_CTRL_DSA_PARAMGEN_MD (EVP_PKEY_ALG_CTRL + 3)
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_DSA_strings(void);
|
||||
void DSA_get0_pqg(const DSA *d,
|
||||
const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);
|
||||
int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g);
|
||||
void DSA_get0_key(const DSA *d,
|
||||
const BIGNUM **pub_key, const BIGNUM **priv_key);
|
||||
int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key);
|
||||
const BIGNUM *DSA_get0_p(const DSA *d);
|
||||
const BIGNUM *DSA_get0_q(const DSA *d);
|
||||
const BIGNUM *DSA_get0_g(const DSA *d);
|
||||
const BIGNUM *DSA_get0_pub_key(const DSA *d);
|
||||
const BIGNUM *DSA_get0_priv_key(const DSA *d);
|
||||
void DSA_clear_flags(DSA *d, int flags);
|
||||
int DSA_test_flags(const DSA *d, int flags);
|
||||
void DSA_set_flags(DSA *d, int flags);
|
||||
ENGINE *DSA_get0_engine(DSA *d);
|
||||
|
||||
/* Error codes for the DSA functions. */
|
||||
DSA_METHOD *DSA_meth_new(const char *name, int flags);
|
||||
void DSA_meth_free(DSA_METHOD *dsam);
|
||||
DSA_METHOD *DSA_meth_dup(const DSA_METHOD *dsam);
|
||||
const char *DSA_meth_get0_name(const DSA_METHOD *dsam);
|
||||
int DSA_meth_set1_name(DSA_METHOD *dsam, const char *name);
|
||||
int DSA_meth_get_flags(const DSA_METHOD *dsam);
|
||||
int DSA_meth_set_flags(DSA_METHOD *dsam, int flags);
|
||||
void *DSA_meth_get0_app_data(const DSA_METHOD *dsam);
|
||||
int DSA_meth_set0_app_data(DSA_METHOD *dsam, void *app_data);
|
||||
DSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam))
|
||||
(const unsigned char *, int, DSA *);
|
||||
int DSA_meth_set_sign(DSA_METHOD *dsam,
|
||||
DSA_SIG *(*sign) (const unsigned char *, int, DSA *));
|
||||
int (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam))
|
||||
(DSA *, BN_CTX *, BIGNUM **, BIGNUM **);
|
||||
int DSA_meth_set_sign_setup(DSA_METHOD *dsam,
|
||||
int (*sign_setup) (DSA *, BN_CTX *, BIGNUM **, BIGNUM **));
|
||||
int (*DSA_meth_get_verify(const DSA_METHOD *dsam))
|
||||
(const unsigned char *, int, DSA_SIG *, DSA *);
|
||||
int DSA_meth_set_verify(DSA_METHOD *dsam,
|
||||
int (*verify) (const unsigned char *, int, DSA_SIG *, DSA *));
|
||||
int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam))
|
||||
(DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||
const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *);
|
||||
int DSA_meth_set_mod_exp(DSA_METHOD *dsam,
|
||||
int (*mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||
const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *,
|
||||
BN_MONT_CTX *));
|
||||
int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam))
|
||||
(DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||
BN_CTX *, BN_MONT_CTX *);
|
||||
int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam,
|
||||
int (*bn_mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||
const BIGNUM *, BN_CTX *, BN_MONT_CTX *));
|
||||
int (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *);
|
||||
int DSA_meth_set_init(DSA_METHOD *dsam, int (*init)(DSA *));
|
||||
int (*DSA_meth_get_finish(const DSA_METHOD *dsam)) (DSA *);
|
||||
int DSA_meth_set_finish(DSA_METHOD *dsam, int (*finish) (DSA *));
|
||||
int (*DSA_meth_get_paramgen(const DSA_METHOD *dsam))
|
||||
(DSA *, int, const unsigned char *, int, int *, unsigned long *,
|
||||
BN_GENCB *);
|
||||
int DSA_meth_set_paramgen(DSA_METHOD *dsam,
|
||||
int (*paramgen) (DSA *, int, const unsigned char *, int, int *,
|
||||
unsigned long *, BN_GENCB *));
|
||||
int (*DSA_meth_get_keygen(const DSA_METHOD *dsam)) (DSA *);
|
||||
int DSA_meth_set_keygen(DSA_METHOD *dsam, int (*keygen) (DSA *));
|
||||
|
||||
/* Function codes. */
|
||||
# define DSA_F_D2I_DSA_SIG 110
|
||||
# define DSA_F_DO_DSA_PRINT 104
|
||||
# define DSA_F_DSAPARAMS_PRINT 100
|
||||
# define DSA_F_DSAPARAMS_PRINT_FP 101
|
||||
# define DSA_F_DSA_BUILTIN_PARAMGEN2 126
|
||||
# define DSA_F_DSA_DO_SIGN 112
|
||||
# define DSA_F_DSA_DO_VERIFY 113
|
||||
# define DSA_F_DSA_GENERATE_KEY 124
|
||||
# define DSA_F_DSA_GENERATE_PARAMETERS_EX 123
|
||||
# define DSA_F_DSA_NEW_METHOD 103
|
||||
# define DSA_F_DSA_PARAM_DECODE 119
|
||||
# define DSA_F_DSA_PRINT_FP 105
|
||||
# define DSA_F_DSA_PRIV_DECODE 115
|
||||
# define DSA_F_DSA_PRIV_ENCODE 116
|
||||
# define DSA_F_DSA_PUB_DECODE 117
|
||||
# define DSA_F_DSA_PUB_ENCODE 118
|
||||
# define DSA_F_DSA_SIGN 106
|
||||
# define DSA_F_DSA_SIGN_SETUP 107
|
||||
# define DSA_F_DSA_SIG_NEW 109
|
||||
# define DSA_F_DSA_SIG_PRINT 125
|
||||
# define DSA_F_DSA_VERIFY 108
|
||||
# define DSA_F_I2D_DSA_SIG 111
|
||||
# define DSA_F_OLD_DSA_PRIV_DECODE 122
|
||||
# define DSA_F_PKEY_DSA_CTRL 120
|
||||
# define DSA_F_PKEY_DSA_KEYGEN 121
|
||||
# define DSA_F_SIG_CB 114
|
||||
|
||||
/* Reason codes. */
|
||||
# define DSA_R_BAD_Q_VALUE 102
|
||||
# define DSA_R_BN_DECODE_ERROR 108
|
||||
# define DSA_R_BN_ERROR 109
|
||||
# define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 100
|
||||
# define DSA_R_DECODE_ERROR 104
|
||||
# define DSA_R_INVALID_DIGEST_TYPE 106
|
||||
# define DSA_R_INVALID_PARAMETERS 112
|
||||
# define DSA_R_MISSING_PARAMETERS 101
|
||||
# define DSA_R_MODULUS_TOO_LARGE 103
|
||||
# define DSA_R_NEED_NEW_SETUP_VALUES 110
|
||||
# define DSA_R_NON_FIPS_DSA_METHOD 111
|
||||
# define DSA_R_NO_PARAMETERS_SET 107
|
||||
# define DSA_R_PARAMETER_ENCODING_ERROR 105
|
||||
# define DSA_R_Q_NOT_PRIME 113
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user