rho-tau-extensions 5.5.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +2 -0
- data/LICENSE +21 -0
- data/README.md +6 -0
- data/Rakefile +90 -0
- data/libs/crosswalk.rb +2 -0
- data/libs/crosswalk/crosswalk.rb +2 -0
- data/libs/crosswalk/ext.yml +21 -0
- data/libs/crosswalk/ext/Crosswalk.xml +27 -0
- data/libs/crosswalk/ext/build +19 -0
- data/libs/crosswalk/ext/build.bat +29 -0
- data/libs/crosswalk/ext/platform/android/AndroidManifest.xml +9 -0
- data/libs/crosswalk/ext/platform/android/Rakefile +141 -0
- data/libs/crosswalk/ext/platform/android/adds/lib/armeabi/libxwalkcore.so +0 -0
- data/libs/crosswalk/ext/platform/android/adds/lib/armeabi/libxwalkdummy.so +0 -0
- data/libs/crosswalk/ext/platform/android/adds/lib/x86/libxwalkcore.so +0 -0
- data/libs/crosswalk/ext/platform/android/adds/lib/x86/libxwalkdummy.so +0 -0
- data/libs/crosswalk/ext/platform/android/adds/lib/xwalk_core_library_java.jar +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/bubble.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/bubble_arrow_up.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/color_picker_advanced_select_handle.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/crosswalk.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/dropdown_popup_background_down.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/dropdown_popup_background_up.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/ic_menu_share_holo_light.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/ic_search.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/ic_warning.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/ondemand_overlay.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-hdpi/verify_checkmark.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-ldpi/crosswalk.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-mdpi/crosswalk.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-v21/button_borderless_compat.xml +10 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-v21/button_compat.xml +9 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/bubble.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/bubble_arrow_up.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/color_picker_advanced_select_handle.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/crosswalk.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/dropdown_popup_background_down.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/dropdown_popup_background_up.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/ic_menu_share_holo_light.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/ic_search.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/ic_warning.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/ondemand_overlay.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xhdpi/verify_checkmark.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxhdpi/ic_menu_share_holo_light.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxhdpi/ic_search.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxhdpi/ic_warning.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxhdpi/verify_checkmark.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxxhdpi/ic_menu_share_holo_light.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxxhdpi/ic_search.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxxhdpi/ic_warning.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable-xxxhdpi/verify_checkmark.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/autofill_chip_inset.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/bubble.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/bubble_arrow_up.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/button_compat_shape.xml +9 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/color_button_background.xml +36 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/color_picker_advanced_select_handle.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/color_picker_border.xml +12 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/dropdown_label_color.xml +11 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/dropdown_popup_background.xml +13 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/dropdown_popup_background_down.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/dropdown_popup_background_up.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/ic_menu_share_holo_light.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/ic_search.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/ic_warning.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/launchscreen_bg.xml +19 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/ondemand_overlay.9.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/drawable/verify_checkmark.png +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-land/date_time_picker_dialog.xml +42 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/autofill_keyboard_accessory_item.xml +40 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/autofill_suggestion_item.xml +18 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/color_picker_advanced_component.xml +46 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/color_picker_dialog_content.xml +51 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/color_picker_dialog_title.xml +41 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/date_time_suggestion.xml +35 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/dropdown_item.xml +58 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/multi_field_time_picker_dialog.xml +122 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/two_field_date_picker.xml +38 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout-v17/validation_message_bubble.xml +72 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/autofill_keyboard_accessory_icon.xml +13 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/autofill_keyboard_accessory_item.xml +17 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/autofill_suggestion_item.xml +7 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/color_picker_advanced_component.xml +30 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/color_picker_dialog_content.xml +36 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/color_picker_dialog_title.xml +25 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/date_time_picker_dialog.xml +42 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/date_time_suggestion.xml +16 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/dropdown_item.xml +34 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/multi_field_time_picker_dialog.xml +50 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/two_field_date_picker.xml +26 -0
- data/libs/crosswalk/ext/platform/android/adds/res/layout/validation_message_bubble.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/menu/select_action_menu.xml +54 -0
- data/libs/crosswalk/ext/platform/android/adds/res/raw/contacts_api.js +206 -0
- data/libs/crosswalk/ext/platform/android/adds/res/raw/device_capabilities_api.js +231 -0
- data/libs/crosswalk/ext/platform/android/adds/res/raw/empty.wav +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/raw/icudtl.dat +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/raw/launch_screen_api.js +9 -0
- data/libs/crosswalk/ext/platform/android/adds/res/raw/messaging_api.js +359 -0
- data/libs/crosswalk/ext/platform/android/adds/res/raw/presentation_api.js +144 -0
- data/libs/crosswalk/ext/platform/android/adds/res/raw/wifidirect_api.js +227 -0
- data/libs/crosswalk/ext/platform/android/adds/res/raw/xwalk.pak +0 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-am/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-am/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ar/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ar/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-bg/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-bg/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ca/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ca/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-cs/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-cs/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-da/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-da/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-de/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-de/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-el/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-el/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-en-rGB/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-en-rGB/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-es-rUS/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-es-rUS/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-es/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-es/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-fa/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-fa/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-fi/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-fi/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-fr/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-fr/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-hi/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-hi/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-hr/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-hr/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-hu/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-hu/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-in/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-in/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-it/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-it/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-iw/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-iw/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ja/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ja/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ko/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ko/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-lt/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-lt/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-lv/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-lv/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-nb/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-nb/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-nl/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-nl/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-pl/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-pl/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-pt-rBR/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-pt-rBR/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-pt-rPT/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-pt-rPT/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ro/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ro/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ru/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-ru/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-sk/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-sk/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-sl/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-sl/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-sr/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-sr/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-sv/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-sv/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-sw/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-sw/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-th/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-th/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-tl/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-tl/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-tr/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-tr/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-uk/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-uk/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-v14/theme.xml +16 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-v17/styles.xml +19 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-v17/ui_java_styles.xml +41 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-v21/styles.xml +14 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-v21/ui_java_styles.xml +14 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-vi/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-vi/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-zh-rCN/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-zh-rCN/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-zh-rTW/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values-zh-rTW/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/android_content_strings.xml +15 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/android_ui_strings.xml +47 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/android_xwalk_strings.xml +17 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/ui_java_attrs.xml +9 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/ui_java_dimens.xml +31 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/ui_java_strings.xml +16 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/ui_java_styles.xml +101 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_app_strings.xml +28 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_attrs.xml +11 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_colors.xml +13 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_core_internal_java_strings.xml +16 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_core_java_strings.xml +16 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_dimens.xml +11 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_resources_list.xml +7 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_styles.xml +40 -0
- data/libs/crosswalk/ext/platform/android/adds/res/values/xwalk_values.xml +10 -0
- data/libs/crosswalk/ext/platform/android/ext_java.files +14 -0
- data/libs/crosswalk/ext/platform/android/ext_native.files +7 -0
- data/libs/crosswalk/ext/platform/android/jni/Crosswalk_impl.cpp +61 -0
- data/libs/crosswalk/ext/platform/android/src/com/rho/crosswalk/Crosswalk.java +14 -0
- data/libs/crosswalk/ext/platform/android/src/com/rho/crosswalk/CrosswalkFactory.java +18 -0
- data/libs/crosswalk/ext/platform/android/src/com/rho/crosswalk/CrosswalkSingleton.java +24 -0
- data/libs/crosswalk/ext/platform/android/src/com/tautechnologies/tau/crosswalk/CrosswalkExtension.java +16 -0
- data/libs/crosswalk/ext/platform/android/src/com/tautechnologies/tau/crosswalk/RhodesListener.java +18 -0
- data/libs/crosswalk/ext/platform/android/src/com/tautechnologies/tau/crosswalk/TauXWResourceClient.java +182 -0
- data/libs/crosswalk/ext/platform/android/src/com/tautechnologies/tau/crosswalk/TauXWUIClient.java +125 -0
- data/libs/crosswalk/ext/platform/android/src/com/tautechnologies/tau/crosswalk/TauXWalkWebView.java +368 -0
- data/libs/crosswalk/ext/platform/iphone/Crosswalk.xcodeproj/project.pbxproj +368 -0
- data/libs/crosswalk/ext/platform/iphone/Crosswalk_Prefix.pch +7 -0
- data/libs/crosswalk/ext/platform/iphone/Rakefile +73 -0
- data/libs/crosswalk/ext/platform/iphone/impl/Crosswalk.h +14 -0
- data/libs/crosswalk/ext/platform/iphone/impl/Crosswalk.m +24 -0
- data/libs/crosswalk/ext/platform/iphone/impl/CrosswalkFactorySingleton.m +16 -0
- data/libs/crosswalk/ext/platform/iphone/impl/CrosswalkSetup.m +9 -0
- data/libs/crosswalk/ext/platform/iphone/impl/CrosswalkSingleton.h +17 -0
- data/libs/crosswalk/ext/platform/iphone/impl/CrosswalkSingleton.m +23 -0
- data/libs/crosswalk/ext/platform/iphone/impl/readme.txt +7 -0
- data/libs/crosswalk/ext/platform/qt/Crosswalk.pro +66 -0
- data/libs/crosswalk/ext/platform/qt/Rakefile +35 -0
- data/libs/crosswalk/ext/platform/qt/src/Crosswalk_impl.cpp +77 -0
- data/libs/crosswalk/ext/platform/wm/Crosswalk.sln +52 -0
- data/libs/crosswalk/ext/platform/wm/Crosswalk.vcproj +714 -0
- data/libs/crosswalk/ext/platform/wm/Crosswalk.vsprops +15 -0
- data/libs/crosswalk/ext/platform/wm/src/Crosswalk_impl.cpp +77 -0
- data/libs/crosswalk/ext/platform/wp8/Crosswalk.props +18 -0
- data/libs/crosswalk/ext/platform/wp8/Crosswalk.vcxproj +170 -0
- data/libs/crosswalk/ext/platform/wp8/Crosswalk.vcxproj.filters +50 -0
- data/libs/crosswalk/ext/platform/wp8/CrosswalkImpl.csproj +119 -0
- data/libs/crosswalk/ext/platform/wp8/CrosswalkImpl.props +8 -0
- data/libs/crosswalk/ext/platform/wp8/CrosswalkImpl.targets +7 -0
- data/libs/crosswalk/ext/platform/wp8/CrosswalkLib.props +18 -0
- data/libs/crosswalk/ext/platform/wp8/CrosswalkLib.vcxproj +185 -0
- data/libs/crosswalk/ext/platform/wp8/CrosswalkLib.vcxproj.filters +58 -0
- data/libs/crosswalk/ext/platform/wp8/src/Crosswalk_impl.cpp +76 -0
- data/libs/crosswalk/ext/platform/wp8/src/Crosswalk_impl.cs +69 -0
- data/libs/crosswalk/ext/platform/wp8/src/Properties/AssemblyInfo.cs +37 -0
- data/libs/enterprise-barcode/ext.yml +13 -0
- data/libs/enterprise-barcode/ext/barcode.xml +2144 -0
- data/libs/enterprise-barcode/ext/build +17 -0
- data/libs/enterprise-barcode/ext/build.bat +29 -0
- data/libs/enterprise-barcode/ext/platform/android/AndroidManifest.xml +31 -0
- data/libs/enterprise-barcode/ext/platform/android/ZXing_Info/AUTHORS +58 -0
- data/libs/enterprise-barcode/ext/platform/android/ZXing_Info/CHANGES +266 -0
- data/libs/enterprise-barcode/ext/platform/android/ZXing_Info/COPYING +201 -0
- data/libs/enterprise-barcode/ext/platform/android/ZXing_Info/README +11 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/drawable-hdpi/cancel_icon.png +0 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/drawable-hdpi/ok_icon.png +0 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/drawable-hdpi/retake_icon.png +0 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/drawable/cancel_icon.png +0 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/drawable/ok_icon.png +0 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/drawable/retake_icon.png +0 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/layout/capture.xml +122 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/raw/beep.ogg +0 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/values/attrs.xml +20 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/values/colors.xml +42 -0
- data/libs/enterprise-barcode/ext/platform/android/additional_files/res/values/ids.xml +31 -0
- data/libs/enterprise-barcode/ext/platform/android/adds/lib/armeabi/liballbarcode.a +0 -0
- data/libs/enterprise-barcode/ext/platform/android/adds/lib/x86/liballbarcode.a +0 -0
- data/libs/enterprise-barcode/ext/platform/android/allbarcode.jar +0 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Barcode.xcodeproj/project.pbxproj +524 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Barcode_Prefix.pch +7 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeCallbackHelper.h +27 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeCallbackHelper.mm +231 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewController.h +95 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewController.m +1017 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewFactory.h +7 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewFactory.mm +58 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewFactoryRegister.mm +18 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewManager.h +16 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/BarcodeViewManager.mm +32 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/ImageProvider.cpp +25 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/ImageProvider.h +15 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/ImageProvider.mm +159 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Classes/barcode.m +123 -0
- data/libs/enterprise-barcode/ext/platform/iphone/Rakefile +69 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/COPYING +27 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarCameraSimulator.h +45 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarCaptureReader.h +111 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarHelpController.h +60 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarImage.h +69 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarImageScanner.h +51 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderController.h +142 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderView.h +135 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderViewController.h +130 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarSDK.h +34 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarSymbol.h +71 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar.h +1497 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Decoder.h +202 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Exception.h +187 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Image.h +321 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/ImageScanner.h +130 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Processor.h +223 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Scanner.h +162 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Symbol.h +528 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Video.h +170 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Window.h +136 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/LICENSE +504 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/README +59 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Resources/zbar-back.png +0 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Resources/zbar-help.html +88 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Resources/zbar-helpicons.png +0 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/Resources/zbar-samples.png +0 -0
- data/libs/enterprise-barcode/ext/platform/iphone/ZBarSDK/libzbar.a +0 -0
- data/libs/enterprise-barcode/ext/platform/iphone/impl/Barcode.h +21 -0
- data/libs/enterprise-barcode/ext/platform/iphone/impl/Barcode.m +132 -0
- data/libs/enterprise-barcode/ext/platform/iphone/impl/BarcodeFactory.h +10 -0
- data/libs/enterprise-barcode/ext/platform/iphone/impl/BarcodeFactory.m +16 -0
- data/libs/enterprise-barcode/ext/platform/iphone/impl/BarcodeFactorySingleton.m +16 -0
- data/libs/enterprise-barcode/ext/platform/iphone/impl/BarcodeSetup.m +8 -0
- data/libs/enterprise-barcode/ext/platform/iphone/impl/BarcodeSingleton.h +17 -0
- data/libs/enterprise-barcode/ext/platform/iphone/impl/BarcodeSingleton.m +22 -0
- data/libs/enterprise-barcode/ext/platform/iphone/impl/readme.txt +7 -0
- data/libs/enterprise-barcode/ext/platform/wm/Barcode.sln +44 -0
- data/libs/enterprise-barcode/ext/platform/wm/Barcode.vcproj +836 -0
- data/libs/enterprise-barcode/ext/platform/wm/Barcode.vsprops +15 -0
- data/libs/enterprise-barcode/ext/platform/wm/readme.txt +0 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/Barcode_impl.cpp +376 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/DecodeNotifier.cpp +173 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/DecodeNotifier.h +149 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/EMDKInterfaceAbstraction.cpp +476 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/GetDecoderProperties.cpp +1195 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/GetScannerProperties.cpp +553 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/KeyInjector.cpp +177 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/KeyInjector.h +40 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/NotificationLoader.cpp +76 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/NotificationLoader.h +44 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/RSM.cpp +1211 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/Scanner.cpp +2609 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/Scanner.h +1099 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/ScannerDefines.h +322 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/SetDecoderProperties.cpp +2106 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/SetScannerProperties.cpp +1060 -0
- data/libs/enterprise-barcode/ext/platform/wm/src/Utilities.cpp +184 -0
- data/libs/enterprise-barcode/ext/platform/wp8/BarcodeImpl.csproj +119 -0
- data/libs/enterprise-barcode/ext/platform/wp8/BarcodeImpl.props +8 -0
- data/libs/enterprise-barcode/ext/platform/wp8/BarcodeImpl.targets +35 -0
- data/libs/enterprise-barcode/ext/platform/wp8/BarcodeLib.props +18 -0
- data/libs/enterprise-barcode/ext/platform/wp8/BarcodeLib.vcxproj +185 -0
- data/libs/enterprise-barcode/ext/platform/wp8/BarcodeLib.vcxproj.filters +58 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/Nokia.Graphics.Imaging.dll +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/Nokia.Graphics.Imaging.winmd +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/Nokia.Graphics.Imaging.xml +4813 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/Nokia.InteropServices.WindowsRuntime.dll +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/Nokia.InteropServices.WindowsRuntime.winmd +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/Nokia.InteropServices.WindowsRuntime.xml +41 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/ARM/OpticalReaderLib.dll +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib.XML +68 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib.dll +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib/BarcodeReaderLib.csproj +120 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib/BarcodeReaderLib.sln +34 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib/CameraNavigatePage.xaml +32 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib/CameraNavigatePage.xaml.cs +235 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib/OpticalReaderTask.cs +182 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/BarcodeReaderLib/Properties/AssemblyInfo.cs +37 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/Nokia.Graphics.Imaging.Managed.dll +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/Nokia.Graphics.Imaging.Managed.xml +341 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/Nokia.Graphics.Imaging.dll +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/Nokia.Graphics.Imaging.winmd +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/Nokia.Graphics.Imaging.xml +4813 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/Nokia.InteropServices.WindowsRuntime.dll +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/Nokia.InteropServices.WindowsRuntime.winmd +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/Nokia.InteropServices.WindowsRuntime.xml +41 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/x86/OpticalReaderLib.dll +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/zxing.wp8.0.XML +10324 -0
- data/libs/enterprise-barcode/ext/platform/wp8/lib/zxing.wp8.0.dll +0 -0
- data/libs/enterprise-barcode/ext/platform/wp8/src/Barcode_impl.cs +630 -0
- data/libs/enterprise-barcode/ext/platform/wp8/src/Properties/AssemblyInfo.cs +37 -0
- data/libs/enterprise-barcode/public/api/generated/Rho.Barcode.js +772 -0
- data/libs/ie/rhobrowser.dll +0 -0
- data/libs/nodejs.rb +2 -0
- data/libs/nodejs/ext.yml +25 -0
- data/libs/nodejs/ext/Nodejs.xml +37 -0
- data/libs/nodejs/ext/build +19 -0
- data/libs/nodejs/ext/build.bat +29 -0
- data/libs/nodejs/ext/platform/android/Rakefile +161 -0
- data/libs/nodejs/ext/platform/android/ext_native.files +8 -0
- data/libs/nodejs/ext/platform/android/jxCore/jx.h +134 -0
- data/libs/nodejs/ext/platform/android/jxCore/jx_result.h +221 -0
- data/libs/nodejs/ext/platform/android/jxCore/libcares_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libcares_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libcares_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libchrome_zlib_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libchrome_zlib_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libchrome_zlib_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libhttp_parser_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libhttp_parser_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libhttp_parser_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libjx_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libjx_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libjx_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libopenssl_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libopenssl_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libopenssl_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libsqlite3_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libsqlite3_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libsqlite3_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libuv_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libuv_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libuv_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libv8_base_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libv8_base_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libv8_base_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libv8_nosnapshot_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libv8_nosnapshot_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libv8_nosnapshot_x64.a +0 -0
- data/libs/nodejs/ext/platform/iphone/Nodejs.xcodeproj/project.pbxproj +350 -0
- data/libs/nodejs/ext/platform/iphone/Nodejs_Prefix.pch +7 -0
- data/libs/nodejs/ext/platform/iphone/Rakefile +73 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/jx.h +134 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/jx_result.h +221 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libcares.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libchrome_zlib.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libhttp_parser.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libjx.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libmozjs.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libopenssl.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libsqlite3.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libuv.a +0 -0
- data/libs/nodejs/ext/shared/jxcore/jx.h +134 -0
- data/libs/nodejs/ext/shared/jxcore/jx_result.h +221 -0
- data/libs/nodejs/ext/shared/jxcoretau.cpp +454 -0
- data/libs/nodejs/ext/shared/jxcoretau.h +20 -0
- data/libs/nodejs/ext/shared/nodejs_impl.cpp +106 -0
- data/libs/nodejs/nodejs.rb +2 -0
- data/libs/openssl-edge.rb +2 -0
- data/libs/openssl-edge/ext.yml +4 -0
- data/libs/openssl-edge/ext/Rakefile +145 -0
- data/libs/openssl-edge/ext/android/Rakefile +107 -0
- data/libs/openssl-edge/ext/android/ext_native.files +32 -0
- data/libs/openssl-edge/ext/android/extconf.h +91 -0
- data/libs/openssl-edge/ext/build +12 -0
- data/libs/openssl-edge/ext/build.bat +5 -0
- data/libs/openssl-edge/ext/extconf.rb +141 -0
- data/libs/openssl-edge/ext/openssl.pro +109 -0
- data/libs/openssl-edge/ext/openssl.sln +52 -0
- data/libs/openssl-edge/ext/openssl.vcproj +1010 -0
- data/libs/openssl-edge/ext/openssl_missing.c +1163 -0
- data/libs/openssl-edge/ext/openssl_missing.h +537 -0
- data/libs/openssl-edge/ext/ossl.c +1203 -0
- data/libs/openssl-edge/ext/ossl.h +242 -0
- data/libs/openssl-edge/ext/ossl_asn1.c +2008 -0
- data/libs/openssl-edge/ext/ossl_asn1.h +66 -0
- data/libs/openssl-edge/ext/ossl_bio.c +118 -0
- data/libs/openssl-edge/ext/ossl_bio.h +19 -0
- data/libs/openssl-edge/ext/ossl_bn.c +1153 -0
- data/libs/openssl-edge/ext/ossl_bn.h +23 -0
- data/libs/openssl-edge/ext/ossl_cipher.c +1085 -0
- data/libs/openssl-edge/ext/ossl_cipher.h +20 -0
- data/libs/openssl-edge/ext/ossl_config.c +89 -0
- data/libs/openssl-edge/ext/ossl_config.h +19 -0
- data/libs/openssl-edge/ext/ossl_digest.c +453 -0
- data/libs/openssl-edge/ext/ossl_digest.h +20 -0
- data/libs/openssl-edge/ext/ossl_engine.c +580 -0
- data/libs/openssl-edge/ext/ossl_engine.h +19 -0
- data/libs/openssl-edge/ext/ossl_hmac.c +398 -0
- data/libs/openssl-edge/ext/ossl_hmac.h +18 -0
- data/libs/openssl-edge/ext/ossl_ns_spki.c +406 -0
- data/libs/openssl-edge/ext/ossl_ns_spki.h +19 -0
- data/libs/openssl-edge/ext/ossl_ocsp.c +2013 -0
- data/libs/openssl-edge/ext/ossl_ocsp.h +23 -0
- data/libs/openssl-edge/ext/ossl_pkcs12.c +261 -0
- data/libs/openssl-edge/ext/ossl_pkcs12.h +13 -0
- data/libs/openssl-edge/ext/ossl_pkcs5.c +180 -0
- data/libs/openssl-edge/ext/ossl_pkcs5.h +6 -0
- data/libs/openssl-edge/ext/ossl_pkcs7.c +1157 -0
- data/libs/openssl-edge/ext/ossl_pkcs7.h +20 -0
- data/libs/openssl-edge/ext/ossl_pkey.c +469 -0
- data/libs/openssl-edge/ext/ossl_pkey.h +245 -0
- data/libs/openssl-edge/ext/ossl_pkey_dh.c +650 -0
- data/libs/openssl-edge/ext/ossl_pkey_dsa.c +672 -0
- data/libs/openssl-edge/ext/ossl_pkey_ec.c +1806 -0
- data/libs/openssl-edge/ext/ossl_pkey_rsa.c +768 -0
- data/libs/openssl-edge/ext/ossl_rand.c +238 -0
- data/libs/openssl-edge/ext/ossl_rand.h +18 -0
- data/libs/openssl-edge/ext/ossl_ssl.c +2724 -0
- data/libs/openssl-edge/ext/ossl_ssl.h +41 -0
- data/libs/openssl-edge/ext/ossl_ssl_session.c +352 -0
- data/libs/openssl-edge/ext/ossl_version.h +15 -0
- data/libs/openssl-edge/ext/ossl_x509.c +186 -0
- data/libs/openssl-edge/ext/ossl_x509.h +119 -0
- data/libs/openssl-edge/ext/ossl_x509attr.c +328 -0
- data/libs/openssl-edge/ext/ossl_x509cert.c +863 -0
- data/libs/openssl-edge/ext/ossl_x509crl.c +565 -0
- data/libs/openssl-edge/ext/ossl_x509ext.c +480 -0
- data/libs/openssl-edge/ext/ossl_x509name.c +547 -0
- data/libs/openssl-edge/ext/ossl_x509req.c +492 -0
- data/libs/openssl-edge/ext/ossl_x509revoked.c +279 -0
- data/libs/openssl-edge/ext/ossl_x509store.c +846 -0
- data/libs/openssl-edge/ext/ruby_missing.h +32 -0
- data/libs/openssl-edge/openssl-edge.rb +2 -0
- data/libs/openssl-edge/openssl.rb +24 -0
- data/libs/openssl-edge/openssl/bn.rb +35 -0
- data/libs/openssl-edge/openssl/buffering.rb +341 -0
- data/libs/openssl-edge/openssl/cipher.rb +65 -0
- data/libs/openssl-edge/openssl/digest.rb +61 -0
- data/libs/openssl-edge/openssl/ssl-internal.rb +180 -0
- data/libs/openssl-edge/openssl/ssl.rb +1 -0
- data/libs/openssl-edge/openssl/x509-internal.rb +153 -0
- data/libs/openssl-edge/openssl/x509.rb +1 -0
- data/libs/openssl.so-edge.rb +2 -0
- data/libs/openssl.so-edge/ext.yml +8 -0
- data/libs/openssl.so-edge/ext/Rakefile +140 -0
- data/libs/openssl.so-edge/ext/android/armeabi/libcrypto.a +0 -0
- data/libs/openssl.so-edge/ext/android/armeabi/libssl.a +0 -0
- data/libs/openssl.so-edge/ext/android/x86/libcrypto.a +0 -0
- data/libs/openssl.so-edge/ext/android/x86/libssl.a +0 -0
- data/libs/openssl.so-edge/ext/build +12 -0
- data/libs/openssl.so-edge/ext/build.bat +1 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/dh/dh_locl.h +56 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/dsa/dsa_locl.h +76 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/evp/evp_locl.h +66 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/hmac/hmac_lcl.h +33 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/asn1_int.h +94 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/async.h +14 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/bn_conf.h +28 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/bn_dh.h +17 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/bn_int.h +82 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/bn_srp.h +32 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/chacha.h +49 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/cryptlib.h +81 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/cryptlib_int.h +31 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/dso_conf.h +16 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/engine.h +20 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/err_int.h +17 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/evp_int.h +382 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/md32_common.h +383 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/objects.h +12 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/poly1305.h +19 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/rand.h +20 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/include/internal/x509_int.h +267 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/ocsp/ocsp_lcl.h +216 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/rsa/rsa_locl.h +96 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/crypto/x509/x509_lcl.h +142 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/e_os.h +520 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/bio.h +26 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/comp.h +12 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/conf.h +32 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/constant_time_locl.h +185 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/dane.h +103 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/dso.h +216 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/err.h +15 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/numbers.h +68 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/o_dir.h +63 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/o_str.h +17 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/internal/thread_once.h +42 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/__DECC_INCLUDE_EPILOGUE.H +16 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/__DECC_INCLUDE_PROLOGUE.H +20 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/aes.h +92 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/asn1.h +1096 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/asn1_mac.h +10 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/asn1t.h +924 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/async.h +98 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/bio.h +854 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/blowfish.h +61 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/bn.h +575 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/buffer.h +76 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/camellia.h +83 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/cast.h +53 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/cmac.h +41 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/cms.h +512 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/comp.h +72 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/conf.h +216 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/conf_api.h +40 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/crypto.h +463 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ct.h +518 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/des.h +174 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/dh.h +343 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/dsa.h +282 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/dtls1.h +56 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/e_os2.h +311 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ebcdic.h +33 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ec.h +1581 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ecdh.h +10 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ecdsa.h +10 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/engine.h +842 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/err.h +259 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/evp.h +1586 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/hmac.h +49 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/idea.h +64 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/kdf.h +75 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/lhash.h +204 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/md2.h +44 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/md4.h +51 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/md5.h +50 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/mdc2.h +42 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/modes.h +203 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/obj_mac.h +4577 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/objects.h +1097 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ocsp.h +409 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/opensslconf.h +169 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/opensslconf.h.in +141 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/opensslv.h +105 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ossl_typ.h +190 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/pem.h +501 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/pem2.h +20 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/pkcs12.h +282 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/pkcs7.h +404 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/rand.h +89 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/rc2.h +51 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/rc4.h +36 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/rc5.h +63 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ripemd.h +47 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/rsa.h +588 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/safestack.h +164 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/seed.h +98 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/sha.h +119 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/srp.h +131 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/srtp.h +50 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ssl.h +2527 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ssl2.h +24 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ssl3.h +307 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/stack.h +78 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/symhacks.h +52 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/tls1.h +972 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ts.h +643 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/txt_db.h +57 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/ui.h +368 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/whrlpool.h +48 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/x509.h +1123 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/x509_vfy.h +539 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/openssl/x509v3.h +1005 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/ssl/packet_locl.h +555 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/ssl/record/record.h +240 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/ssl/record/record_locl.h +114 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/ssl/ssl_locl.h +2127 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/ssl/statem/statem.h +123 -0
- data/libs/openssl.so-edge/ext/openssl-1-1-0-stable/include/ssl/statem/statem_locl.h +124 -0
- data/libs/openssl.so-edge/openssl.so.rb +2 -0
- data/libs/webkit.rb +2 -0
- data/libs/webkit/ext.yml +4 -0
- data/libs/webkit/ext/build +12 -0
- data/libs/webkit/ext/build.bat +7 -0
- data/libs/webkit/ext/wm/Rakefile +61 -0
- data/libs/webkit/ext/wm/RhoMsgs.cpp +17 -0
- data/libs/webkit/ext/wm/RhoMsgs.h +14 -0
- data/libs/webkit/ext/wm/RhoWKBrowserEngine.cpp +736 -0
- data/libs/webkit/ext/wm/RhoWKBrowserEngine.h +105 -0
- data/libs/webkit/ext/wm/lib/npapi/rhobridge.dll +0 -0
- data/libs/webkit/ext/wm/lib/rhoengine_defs.h +80 -0
- data/libs/webkit/ext/wm/lib/rhowebkit.dll +0 -0
- data/libs/webkit/ext/wm/webkit.sln +36 -0
- data/libs/webkit/ext/wm/webkit.suo +0 -0
- data/libs/webkit/ext/wm/webkit.vcproj +800 -0
- data/libs/webkit/ext/wm/webkit.vsprops +20 -0
- data/libs/webkit/webkit.rb +2 -0
- data/rho-tau-extensions.gemspec +23 -0
- data/version +1 -0
- metadata +705 -0
@@ -0,0 +1,1806 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2006-2007 Technorama Ltd. <oss-ruby@technorama.net>
|
3
|
+
*/
|
4
|
+
|
5
|
+
#include "ossl.h"
|
6
|
+
|
7
|
+
#if !defined(OPENSSL_NO_EC) && (OPENSSL_VERSION_NUMBER >= 0x0090802fL)
|
8
|
+
|
9
|
+
#define EXPORT_PEM 0
|
10
|
+
#define EXPORT_DER 1
|
11
|
+
|
12
|
+
static const rb_data_type_t ossl_ec_group_type;
|
13
|
+
static const rb_data_type_t ossl_ec_point_type;
|
14
|
+
|
15
|
+
#define GetPKeyEC(obj, pkey) do { \
|
16
|
+
GetPKey((obj), (pkey)); \
|
17
|
+
if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC) { \
|
18
|
+
ossl_raise(rb_eRuntimeError, "THIS IS NOT A EC PKEY!"); \
|
19
|
+
} \
|
20
|
+
} while (0)
|
21
|
+
#define GetEC(obj, key) do { \
|
22
|
+
EVP_PKEY *_pkey; \
|
23
|
+
GetPKeyEC(obj, _pkey); \
|
24
|
+
(key) = EVP_PKEY_get0_EC_KEY(_pkey); \
|
25
|
+
} while (0)
|
26
|
+
#define SafeGetEC(obj, key) do { \
|
27
|
+
OSSL_Check_Kind(obj, cEC); \
|
28
|
+
GetEC(obj, key); \
|
29
|
+
} while (0)
|
30
|
+
|
31
|
+
#define GetECGroup(obj, group) do { \
|
32
|
+
TypedData_Get_Struct(obj, EC_GROUP, &ossl_ec_group_type, group); \
|
33
|
+
if ((group) == NULL) \
|
34
|
+
ossl_raise(eEC_GROUP, "EC_GROUP is not initialized"); \
|
35
|
+
} while (0)
|
36
|
+
#define SafeGetECGroup(obj, group) do { \
|
37
|
+
OSSL_Check_Kind((obj), cEC_GROUP); \
|
38
|
+
GetECGroup(obj, group); \
|
39
|
+
} while (0)
|
40
|
+
|
41
|
+
#define GetECPoint(obj, point) do { \
|
42
|
+
TypedData_Get_Struct(obj, EC_POINT, &ossl_ec_point_type, point); \
|
43
|
+
if ((point) == NULL) \
|
44
|
+
ossl_raise(eEC_POINT, "EC_POINT is not initialized"); \
|
45
|
+
} while (0)
|
46
|
+
#define SafeGetECPoint(obj, point) do { \
|
47
|
+
OSSL_Check_Kind((obj), cEC_POINT); \
|
48
|
+
GetECPoint(obj, point); \
|
49
|
+
} while(0)
|
50
|
+
#define GetECPointGroup(obj, group) do { \
|
51
|
+
VALUE _group = rb_attr_get(obj, id_i_group); \
|
52
|
+
SafeGetECGroup(_group, group); \
|
53
|
+
} while (0)
|
54
|
+
|
55
|
+
VALUE cEC;
|
56
|
+
VALUE eECError;
|
57
|
+
VALUE cEC_GROUP;
|
58
|
+
VALUE eEC_GROUP;
|
59
|
+
VALUE cEC_POINT;
|
60
|
+
VALUE eEC_POINT;
|
61
|
+
|
62
|
+
static ID s_GFp;
|
63
|
+
static ID s_GFp_simple;
|
64
|
+
static ID s_GFp_mont;
|
65
|
+
static ID s_GFp_nist;
|
66
|
+
static ID s_GF2m;
|
67
|
+
static ID s_GF2m_simple;
|
68
|
+
|
69
|
+
static ID ID_uncompressed;
|
70
|
+
static ID ID_compressed;
|
71
|
+
static ID ID_hybrid;
|
72
|
+
|
73
|
+
static ID id_i_group;
|
74
|
+
|
75
|
+
static VALUE ec_group_new(const EC_GROUP *group);
|
76
|
+
static VALUE ec_point_new(const EC_POINT *point, const EC_GROUP *group);
|
77
|
+
|
78
|
+
static VALUE ec_instance(VALUE klass, EC_KEY *ec)
|
79
|
+
{
|
80
|
+
EVP_PKEY *pkey;
|
81
|
+
VALUE obj;
|
82
|
+
|
83
|
+
if (!ec) {
|
84
|
+
return Qfalse;
|
85
|
+
}
|
86
|
+
obj = NewPKey(klass);
|
87
|
+
if (!(pkey = EVP_PKEY_new())) {
|
88
|
+
return Qfalse;
|
89
|
+
}
|
90
|
+
if (!EVP_PKEY_assign_EC_KEY(pkey, ec)) {
|
91
|
+
EVP_PKEY_free(pkey);
|
92
|
+
return Qfalse;
|
93
|
+
}
|
94
|
+
SetPKey(obj, pkey);
|
95
|
+
|
96
|
+
return obj;
|
97
|
+
}
|
98
|
+
|
99
|
+
VALUE ossl_ec_new(EVP_PKEY *pkey)
|
100
|
+
{
|
101
|
+
VALUE obj;
|
102
|
+
|
103
|
+
if (!pkey) {
|
104
|
+
obj = ec_instance(cEC, EC_KEY_new());
|
105
|
+
} else {
|
106
|
+
obj = NewPKey(cEC);
|
107
|
+
if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC) {
|
108
|
+
ossl_raise(rb_eTypeError, "Not a EC key!");
|
109
|
+
}
|
110
|
+
SetPKey(obj, pkey);
|
111
|
+
}
|
112
|
+
if (obj == Qfalse) {
|
113
|
+
ossl_raise(eECError, NULL);
|
114
|
+
}
|
115
|
+
|
116
|
+
return obj;
|
117
|
+
}
|
118
|
+
|
119
|
+
/*
|
120
|
+
* Creates a new EC_KEY on the EC group obj. arg can be an EC::Group or a String
|
121
|
+
* representing an OID.
|
122
|
+
*/
|
123
|
+
static EC_KEY *
|
124
|
+
ec_key_new_from_group(VALUE arg)
|
125
|
+
{
|
126
|
+
EC_KEY *ec;
|
127
|
+
|
128
|
+
if (rb_obj_is_kind_of(arg, cEC_GROUP)) {
|
129
|
+
EC_GROUP *group;
|
130
|
+
|
131
|
+
SafeGetECGroup(arg, group);
|
132
|
+
if (!(ec = EC_KEY_new()))
|
133
|
+
ossl_raise(eECError, NULL);
|
134
|
+
|
135
|
+
if (!EC_KEY_set_group(ec, group)) {
|
136
|
+
EC_KEY_free(ec);
|
137
|
+
ossl_raise(eECError, NULL);
|
138
|
+
}
|
139
|
+
} else {
|
140
|
+
int nid = OBJ_sn2nid(StringValueCStr(arg));
|
141
|
+
|
142
|
+
if (nid == NID_undef)
|
143
|
+
ossl_raise(eECError, "invalid curve name");
|
144
|
+
|
145
|
+
if (!(ec = EC_KEY_new_by_curve_name(nid)))
|
146
|
+
ossl_raise(eECError, NULL);
|
147
|
+
|
148
|
+
EC_KEY_set_asn1_flag(ec, OPENSSL_EC_NAMED_CURVE);
|
149
|
+
EC_KEY_set_conv_form(ec, POINT_CONVERSION_UNCOMPRESSED);
|
150
|
+
}
|
151
|
+
|
152
|
+
return ec;
|
153
|
+
}
|
154
|
+
|
155
|
+
/*
|
156
|
+
* call-seq:
|
157
|
+
* EC.generate(ec_group) -> ec
|
158
|
+
* EC.generate(string) -> ec
|
159
|
+
*
|
160
|
+
* Creates a new EC instance with a new random private and public key.
|
161
|
+
*/
|
162
|
+
static VALUE
|
163
|
+
ossl_ec_key_s_generate(VALUE klass, VALUE arg)
|
164
|
+
{
|
165
|
+
EC_KEY *ec;
|
166
|
+
VALUE obj;
|
167
|
+
|
168
|
+
ec = ec_key_new_from_group(arg);
|
169
|
+
|
170
|
+
obj = ec_instance(klass, ec);
|
171
|
+
if (obj == Qfalse) {
|
172
|
+
EC_KEY_free(ec);
|
173
|
+
ossl_raise(eECError, NULL);
|
174
|
+
}
|
175
|
+
|
176
|
+
if (!EC_KEY_generate_key(ec))
|
177
|
+
ossl_raise(eECError, "EC_KEY_generate_key");
|
178
|
+
|
179
|
+
return obj;
|
180
|
+
}
|
181
|
+
|
182
|
+
/*
|
183
|
+
* call-seq:
|
184
|
+
* OpenSSL::PKey::EC.new
|
185
|
+
* OpenSSL::PKey::EC.new(ec_key)
|
186
|
+
* OpenSSL::PKey::EC.new(ec_group)
|
187
|
+
* OpenSSL::PKey::EC.new("secp112r1")
|
188
|
+
* OpenSSL::PKey::EC.new(pem_string [, pwd])
|
189
|
+
* OpenSSL::PKey::EC.new(der_string)
|
190
|
+
*
|
191
|
+
* Creates a new EC object from given arguments.
|
192
|
+
*/
|
193
|
+
static VALUE ossl_ec_key_initialize(int argc, VALUE *argv, VALUE self)
|
194
|
+
{
|
195
|
+
EVP_PKEY *pkey;
|
196
|
+
EC_KEY *ec;
|
197
|
+
VALUE arg, pass;
|
198
|
+
|
199
|
+
GetPKey(self, pkey);
|
200
|
+
if (EVP_PKEY_base_id(pkey) != EVP_PKEY_NONE)
|
201
|
+
ossl_raise(eECError, "EC_KEY already initialized");
|
202
|
+
|
203
|
+
rb_scan_args(argc, argv, "02", &arg, &pass);
|
204
|
+
|
205
|
+
if (NIL_P(arg)) {
|
206
|
+
if (!(ec = EC_KEY_new()))
|
207
|
+
ossl_raise(eECError, NULL);
|
208
|
+
} else if (rb_obj_is_kind_of(arg, cEC)) {
|
209
|
+
EC_KEY *other_ec = NULL;
|
210
|
+
|
211
|
+
SafeGetEC(arg, other_ec);
|
212
|
+
if (!(ec = EC_KEY_dup(other_ec)))
|
213
|
+
ossl_raise(eECError, NULL);
|
214
|
+
} else if (rb_obj_is_kind_of(arg, cEC_GROUP)) {
|
215
|
+
ec = ec_key_new_from_group(arg);
|
216
|
+
} else {
|
217
|
+
BIO *in;
|
218
|
+
|
219
|
+
pass = ossl_pem_passwd_value(pass);
|
220
|
+
in = ossl_obj2bio(arg);
|
221
|
+
|
222
|
+
ec = PEM_read_bio_ECPrivateKey(in, NULL, ossl_pem_passwd_cb, (void *)pass);
|
223
|
+
if (!ec) {
|
224
|
+
OSSL_BIO_reset(in);
|
225
|
+
ec = PEM_read_bio_EC_PUBKEY(in, NULL, ossl_pem_passwd_cb, (void *)pass);
|
226
|
+
}
|
227
|
+
if (!ec) {
|
228
|
+
OSSL_BIO_reset(in);
|
229
|
+
ec = d2i_ECPrivateKey_bio(in, NULL);
|
230
|
+
}
|
231
|
+
if (!ec) {
|
232
|
+
OSSL_BIO_reset(in);
|
233
|
+
ec = d2i_EC_PUBKEY_bio(in, NULL);
|
234
|
+
}
|
235
|
+
BIO_free(in);
|
236
|
+
|
237
|
+
if (!ec) {
|
238
|
+
ossl_clear_error();
|
239
|
+
ec = ec_key_new_from_group(arg);
|
240
|
+
}
|
241
|
+
}
|
242
|
+
|
243
|
+
if (!EVP_PKEY_assign_EC_KEY(pkey, ec)) {
|
244
|
+
EC_KEY_free(ec);
|
245
|
+
ossl_raise(eECError, "EVP_PKEY_assign_EC_KEY");
|
246
|
+
}
|
247
|
+
|
248
|
+
return self;
|
249
|
+
}
|
250
|
+
|
251
|
+
static VALUE
|
252
|
+
ossl_ec_key_initialize_copy(VALUE self, VALUE other)
|
253
|
+
{
|
254
|
+
EVP_PKEY *pkey;
|
255
|
+
EC_KEY *ec, *ec_new;
|
256
|
+
|
257
|
+
GetPKey(self, pkey);
|
258
|
+
if (EVP_PKEY_base_id(pkey) != EVP_PKEY_NONE)
|
259
|
+
ossl_raise(eECError, "EC already initialized");
|
260
|
+
SafeGetEC(other, ec);
|
261
|
+
|
262
|
+
ec_new = EC_KEY_dup(ec);
|
263
|
+
if (!ec_new)
|
264
|
+
ossl_raise(eECError, "EC_KEY_dup");
|
265
|
+
if (!EVP_PKEY_assign_EC_KEY(pkey, ec_new)) {
|
266
|
+
EC_KEY_free(ec_new);
|
267
|
+
ossl_raise(eECError, "EVP_PKEY_assign_EC_KEY");
|
268
|
+
}
|
269
|
+
|
270
|
+
return self;
|
271
|
+
}
|
272
|
+
|
273
|
+
/*
|
274
|
+
* call-seq:
|
275
|
+
* key.group => group
|
276
|
+
*
|
277
|
+
* Returns the EC::Group that the key is associated with. Modifying the returned
|
278
|
+
* group does not affect +key+.
|
279
|
+
*/
|
280
|
+
static VALUE
|
281
|
+
ossl_ec_key_get_group(VALUE self)
|
282
|
+
{
|
283
|
+
EC_KEY *ec;
|
284
|
+
const EC_GROUP *group;
|
285
|
+
|
286
|
+
GetEC(self, ec);
|
287
|
+
group = EC_KEY_get0_group(ec);
|
288
|
+
if (!group)
|
289
|
+
return Qnil;
|
290
|
+
|
291
|
+
return ec_group_new(group);
|
292
|
+
}
|
293
|
+
|
294
|
+
/*
|
295
|
+
* call-seq:
|
296
|
+
* key.group = group
|
297
|
+
*
|
298
|
+
* Sets the EC::Group for the key. The group structure is internally copied so
|
299
|
+
* modifition to +group+ after assigning to a key has no effect on the key.
|
300
|
+
*/
|
301
|
+
static VALUE
|
302
|
+
ossl_ec_key_set_group(VALUE self, VALUE group_v)
|
303
|
+
{
|
304
|
+
EC_KEY *ec;
|
305
|
+
EC_GROUP *group;
|
306
|
+
|
307
|
+
GetEC(self, ec);
|
308
|
+
SafeGetECGroup(group_v, group);
|
309
|
+
|
310
|
+
if (EC_KEY_set_group(ec, group) != 1)
|
311
|
+
ossl_raise(eECError, "EC_KEY_set_group");
|
312
|
+
|
313
|
+
return group_v;
|
314
|
+
}
|
315
|
+
|
316
|
+
/*
|
317
|
+
* call-seq:
|
318
|
+
* key.private_key => OpenSSL::BN
|
319
|
+
*
|
320
|
+
* See the OpenSSL documentation for EC_KEY_get0_private_key()
|
321
|
+
*/
|
322
|
+
static VALUE ossl_ec_key_get_private_key(VALUE self)
|
323
|
+
{
|
324
|
+
EC_KEY *ec;
|
325
|
+
const BIGNUM *bn;
|
326
|
+
|
327
|
+
GetEC(self, ec);
|
328
|
+
if ((bn = EC_KEY_get0_private_key(ec)) == NULL)
|
329
|
+
return Qnil;
|
330
|
+
|
331
|
+
return ossl_bn_new(bn);
|
332
|
+
}
|
333
|
+
|
334
|
+
/*
|
335
|
+
* call-seq:
|
336
|
+
* key.private_key = openssl_bn
|
337
|
+
*
|
338
|
+
* See the OpenSSL documentation for EC_KEY_set_private_key()
|
339
|
+
*/
|
340
|
+
static VALUE ossl_ec_key_set_private_key(VALUE self, VALUE private_key)
|
341
|
+
{
|
342
|
+
EC_KEY *ec;
|
343
|
+
BIGNUM *bn = NULL;
|
344
|
+
|
345
|
+
GetEC(self, ec);
|
346
|
+
if (!NIL_P(private_key))
|
347
|
+
bn = GetBNPtr(private_key);
|
348
|
+
|
349
|
+
switch (EC_KEY_set_private_key(ec, bn)) {
|
350
|
+
case 1:
|
351
|
+
break;
|
352
|
+
case 0:
|
353
|
+
if (bn == NULL)
|
354
|
+
break;
|
355
|
+
default:
|
356
|
+
ossl_raise(eECError, "EC_KEY_set_private_key");
|
357
|
+
}
|
358
|
+
|
359
|
+
return private_key;
|
360
|
+
}
|
361
|
+
|
362
|
+
/*
|
363
|
+
* call-seq:
|
364
|
+
* key.public_key => OpenSSL::PKey::EC::Point
|
365
|
+
*
|
366
|
+
* See the OpenSSL documentation for EC_KEY_get0_public_key()
|
367
|
+
*/
|
368
|
+
static VALUE ossl_ec_key_get_public_key(VALUE self)
|
369
|
+
{
|
370
|
+
EC_KEY *ec;
|
371
|
+
const EC_POINT *point;
|
372
|
+
|
373
|
+
GetEC(self, ec);
|
374
|
+
if ((point = EC_KEY_get0_public_key(ec)) == NULL)
|
375
|
+
return Qnil;
|
376
|
+
|
377
|
+
return ec_point_new(point, EC_KEY_get0_group(ec));
|
378
|
+
}
|
379
|
+
|
380
|
+
/*
|
381
|
+
* call-seq:
|
382
|
+
* key.public_key = ec_point
|
383
|
+
*
|
384
|
+
* See the OpenSSL documentation for EC_KEY_set_public_key()
|
385
|
+
*/
|
386
|
+
static VALUE ossl_ec_key_set_public_key(VALUE self, VALUE public_key)
|
387
|
+
{
|
388
|
+
EC_KEY *ec;
|
389
|
+
EC_POINT *point = NULL;
|
390
|
+
|
391
|
+
GetEC(self, ec);
|
392
|
+
if (!NIL_P(public_key))
|
393
|
+
SafeGetECPoint(public_key, point);
|
394
|
+
|
395
|
+
switch (EC_KEY_set_public_key(ec, point)) {
|
396
|
+
case 1:
|
397
|
+
break;
|
398
|
+
case 0:
|
399
|
+
if (point == NULL)
|
400
|
+
break;
|
401
|
+
default:
|
402
|
+
ossl_raise(eECError, "EC_KEY_set_public_key");
|
403
|
+
}
|
404
|
+
|
405
|
+
return public_key;
|
406
|
+
}
|
407
|
+
|
408
|
+
/*
|
409
|
+
* call-seq:
|
410
|
+
* key.public? => true or false
|
411
|
+
*
|
412
|
+
* Returns whether this EC instance has a public key. The public key
|
413
|
+
* (EC::Point) can be retrieved with EC#public_key.
|
414
|
+
*/
|
415
|
+
static VALUE ossl_ec_key_is_public(VALUE self)
|
416
|
+
{
|
417
|
+
EC_KEY *ec;
|
418
|
+
|
419
|
+
GetEC(self, ec);
|
420
|
+
|
421
|
+
return EC_KEY_get0_public_key(ec) ? Qtrue : Qfalse;
|
422
|
+
}
|
423
|
+
|
424
|
+
/*
|
425
|
+
* call-seq:
|
426
|
+
* key.private? => true or false
|
427
|
+
*
|
428
|
+
* Returns whether this EC instance has a private key. The private key (BN) can
|
429
|
+
* be retrieved with EC#private_key.
|
430
|
+
*/
|
431
|
+
static VALUE ossl_ec_key_is_private(VALUE self)
|
432
|
+
{
|
433
|
+
EC_KEY *ec;
|
434
|
+
|
435
|
+
GetEC(self, ec);
|
436
|
+
|
437
|
+
return EC_KEY_get0_private_key(ec) ? Qtrue : Qfalse;
|
438
|
+
}
|
439
|
+
|
440
|
+
static VALUE ossl_ec_key_to_string(VALUE self, VALUE ciph, VALUE pass, int format)
|
441
|
+
{
|
442
|
+
EC_KEY *ec;
|
443
|
+
BIO *out;
|
444
|
+
int i = -1;
|
445
|
+
int private = 0;
|
446
|
+
VALUE str;
|
447
|
+
const EVP_CIPHER *cipher = NULL;
|
448
|
+
|
449
|
+
GetEC(self, ec);
|
450
|
+
|
451
|
+
if (EC_KEY_get0_public_key(ec) == NULL)
|
452
|
+
ossl_raise(eECError, "can't export - no public key set");
|
453
|
+
|
454
|
+
if (EC_KEY_check_key(ec) != 1)
|
455
|
+
ossl_raise(eECError, "can't export - EC_KEY_check_key failed");
|
456
|
+
|
457
|
+
if (EC_KEY_get0_private_key(ec))
|
458
|
+
private = 1;
|
459
|
+
|
460
|
+
if (!NIL_P(ciph)) {
|
461
|
+
cipher = GetCipherPtr(ciph);
|
462
|
+
pass = ossl_pem_passwd_value(pass);
|
463
|
+
}
|
464
|
+
|
465
|
+
if (!(out = BIO_new(BIO_s_mem())))
|
466
|
+
ossl_raise(eECError, "BIO_new(BIO_s_mem())");
|
467
|
+
|
468
|
+
switch(format) {
|
469
|
+
case EXPORT_PEM:
|
470
|
+
if (private) {
|
471
|
+
i = PEM_write_bio_ECPrivateKey(out, ec, cipher, NULL, 0, ossl_pem_passwd_cb, (void *)pass);
|
472
|
+
} else {
|
473
|
+
i = PEM_write_bio_EC_PUBKEY(out, ec);
|
474
|
+
}
|
475
|
+
|
476
|
+
break;
|
477
|
+
case EXPORT_DER:
|
478
|
+
if (private) {
|
479
|
+
i = i2d_ECPrivateKey_bio(out, ec);
|
480
|
+
} else {
|
481
|
+
i = i2d_EC_PUBKEY_bio(out, ec);
|
482
|
+
}
|
483
|
+
|
484
|
+
break;
|
485
|
+
default:
|
486
|
+
BIO_free(out);
|
487
|
+
ossl_raise(rb_eRuntimeError, "unknown format (internal error)");
|
488
|
+
}
|
489
|
+
|
490
|
+
if (i != 1) {
|
491
|
+
BIO_free(out);
|
492
|
+
ossl_raise(eECError, "outlen=%d", i);
|
493
|
+
}
|
494
|
+
|
495
|
+
str = ossl_membio2str(out);
|
496
|
+
|
497
|
+
return str;
|
498
|
+
}
|
499
|
+
|
500
|
+
/*
|
501
|
+
* call-seq:
|
502
|
+
* key.export([cipher, pass_phrase]) => String
|
503
|
+
* key.to_pem([cipher, pass_phrase]) => String
|
504
|
+
*
|
505
|
+
* Outputs the EC key in PEM encoding. If +cipher+ and +pass_phrase+ are given
|
506
|
+
* they will be used to encrypt the key. +cipher+ must be an OpenSSL::Cipher
|
507
|
+
* instance. Note that encryption will only be effective for a private key,
|
508
|
+
* public keys will always be encoded in plain text.
|
509
|
+
*/
|
510
|
+
static VALUE ossl_ec_key_export(int argc, VALUE *argv, VALUE self)
|
511
|
+
{
|
512
|
+
VALUE cipher, passwd;
|
513
|
+
rb_scan_args(argc, argv, "02", &cipher, &passwd);
|
514
|
+
return ossl_ec_key_to_string(self, cipher, passwd, EXPORT_PEM);
|
515
|
+
}
|
516
|
+
|
517
|
+
/*
|
518
|
+
* call-seq:
|
519
|
+
* key.to_der => String
|
520
|
+
*
|
521
|
+
* See the OpenSSL documentation for i2d_ECPrivateKey_bio()
|
522
|
+
*/
|
523
|
+
static VALUE ossl_ec_key_to_der(VALUE self)
|
524
|
+
{
|
525
|
+
return ossl_ec_key_to_string(self, Qnil, Qnil, EXPORT_DER);
|
526
|
+
}
|
527
|
+
|
528
|
+
/*
|
529
|
+
* call-seq:
|
530
|
+
* key.to_text => String
|
531
|
+
*
|
532
|
+
* See the OpenSSL documentation for EC_KEY_print()
|
533
|
+
*/
|
534
|
+
static VALUE ossl_ec_key_to_text(VALUE self)
|
535
|
+
{
|
536
|
+
EC_KEY *ec;
|
537
|
+
BIO *out;
|
538
|
+
VALUE str;
|
539
|
+
|
540
|
+
GetEC(self, ec);
|
541
|
+
if (!(out = BIO_new(BIO_s_mem()))) {
|
542
|
+
ossl_raise(eECError, "BIO_new(BIO_s_mem())");
|
543
|
+
}
|
544
|
+
if (!EC_KEY_print(out, ec, 0)) {
|
545
|
+
BIO_free(out);
|
546
|
+
ossl_raise(eECError, "EC_KEY_print");
|
547
|
+
}
|
548
|
+
str = ossl_membio2str(out);
|
549
|
+
|
550
|
+
return str;
|
551
|
+
}
|
552
|
+
|
553
|
+
/*
|
554
|
+
* call-seq:
|
555
|
+
* key.generate_key! => self
|
556
|
+
*
|
557
|
+
* Generates a new random private and public key.
|
558
|
+
*
|
559
|
+
* See also the OpenSSL documentation for EC_KEY_generate_key()
|
560
|
+
*
|
561
|
+
* === Example
|
562
|
+
* ec = OpenSSL::PKey::EC.new("prime256v1")
|
563
|
+
* p ec.private_key # => nil
|
564
|
+
* ec.generate_key!
|
565
|
+
* p ec.private_key # => #<OpenSSL::BN XXXXXX>
|
566
|
+
*/
|
567
|
+
static VALUE ossl_ec_key_generate_key(VALUE self)
|
568
|
+
{
|
569
|
+
EC_KEY *ec;
|
570
|
+
|
571
|
+
GetEC(self, ec);
|
572
|
+
if (EC_KEY_generate_key(ec) != 1)
|
573
|
+
ossl_raise(eECError, "EC_KEY_generate_key");
|
574
|
+
|
575
|
+
return self;
|
576
|
+
}
|
577
|
+
|
578
|
+
/*
|
579
|
+
* call-seq:
|
580
|
+
* key.check_key => true
|
581
|
+
*
|
582
|
+
* Raises an exception if the key is invalid.
|
583
|
+
*
|
584
|
+
* See the OpenSSL documentation for EC_KEY_check_key()
|
585
|
+
*/
|
586
|
+
static VALUE ossl_ec_key_check_key(VALUE self)
|
587
|
+
{
|
588
|
+
EC_KEY *ec;
|
589
|
+
|
590
|
+
GetEC(self, ec);
|
591
|
+
if (EC_KEY_check_key(ec) != 1)
|
592
|
+
ossl_raise(eECError, "EC_KEY_check_key");
|
593
|
+
|
594
|
+
return Qtrue;
|
595
|
+
}
|
596
|
+
|
597
|
+
/*
|
598
|
+
* call-seq:
|
599
|
+
* key.dh_compute_key(pubkey) => String
|
600
|
+
*
|
601
|
+
* See the OpenSSL documentation for ECDH_compute_key()
|
602
|
+
*/
|
603
|
+
static VALUE ossl_ec_key_dh_compute_key(VALUE self, VALUE pubkey)
|
604
|
+
{
|
605
|
+
EC_KEY *ec;
|
606
|
+
EC_POINT *point;
|
607
|
+
int buf_len;
|
608
|
+
VALUE str;
|
609
|
+
|
610
|
+
GetEC(self, ec);
|
611
|
+
SafeGetECPoint(pubkey, point);
|
612
|
+
|
613
|
+
/* BUG: need a way to figure out the maximum string size */
|
614
|
+
buf_len = 1024;
|
615
|
+
str = rb_str_new(0, buf_len);
|
616
|
+
/* BUG: take KDF as a block */
|
617
|
+
buf_len = ECDH_compute_key(RSTRING_PTR(str), buf_len, point, ec, NULL);
|
618
|
+
if (buf_len < 0)
|
619
|
+
ossl_raise(eECError, "ECDH_compute_key");
|
620
|
+
|
621
|
+
rb_str_resize(str, buf_len);
|
622
|
+
|
623
|
+
return str;
|
624
|
+
}
|
625
|
+
|
626
|
+
/* sign_setup */
|
627
|
+
|
628
|
+
/*
|
629
|
+
* call-seq:
|
630
|
+
* key.dsa_sign_asn1(data) => String
|
631
|
+
*
|
632
|
+
* See the OpenSSL documentation for ECDSA_sign()
|
633
|
+
*/
|
634
|
+
static VALUE ossl_ec_key_dsa_sign_asn1(VALUE self, VALUE data)
|
635
|
+
{
|
636
|
+
EC_KEY *ec;
|
637
|
+
unsigned int buf_len;
|
638
|
+
VALUE str;
|
639
|
+
|
640
|
+
GetEC(self, ec);
|
641
|
+
StringValue(data);
|
642
|
+
|
643
|
+
if (EC_KEY_get0_private_key(ec) == NULL)
|
644
|
+
ossl_raise(eECError, "Private EC key needed!");
|
645
|
+
|
646
|
+
str = rb_str_new(0, ECDSA_size(ec) + 16);
|
647
|
+
if (ECDSA_sign(0, (unsigned char *) RSTRING_PTR(data), RSTRING_LENINT(data), (unsigned char *) RSTRING_PTR(str), &buf_len, ec) != 1)
|
648
|
+
ossl_raise(eECError, "ECDSA_sign");
|
649
|
+
|
650
|
+
rb_str_resize(str, buf_len);
|
651
|
+
|
652
|
+
return str;
|
653
|
+
}
|
654
|
+
|
655
|
+
/*
|
656
|
+
* call-seq:
|
657
|
+
* key.dsa_verify_asn1(data, sig) => true or false
|
658
|
+
*
|
659
|
+
* See the OpenSSL documentation for ECDSA_verify()
|
660
|
+
*/
|
661
|
+
static VALUE ossl_ec_key_dsa_verify_asn1(VALUE self, VALUE data, VALUE sig)
|
662
|
+
{
|
663
|
+
EC_KEY *ec;
|
664
|
+
|
665
|
+
GetEC(self, ec);
|
666
|
+
StringValue(data);
|
667
|
+
StringValue(sig);
|
668
|
+
|
669
|
+
switch (ECDSA_verify(0, (unsigned char *) RSTRING_PTR(data), RSTRING_LENINT(data), (unsigned char *) RSTRING_PTR(sig), (int)RSTRING_LEN(sig), ec)) {
|
670
|
+
case 1: return Qtrue;
|
671
|
+
case 0: return Qfalse;
|
672
|
+
default: break;
|
673
|
+
}
|
674
|
+
|
675
|
+
ossl_raise(eECError, "ECDSA_verify");
|
676
|
+
|
677
|
+
UNREACHABLE;
|
678
|
+
}
|
679
|
+
|
680
|
+
/*
|
681
|
+
* OpenSSL::PKey::EC::Group
|
682
|
+
*/
|
683
|
+
static void
|
684
|
+
ossl_ec_group_free(void *ptr)
|
685
|
+
{
|
686
|
+
EC_GROUP_clear_free(ptr);
|
687
|
+
}
|
688
|
+
|
689
|
+
static const rb_data_type_t ossl_ec_group_type = {
|
690
|
+
"OpenSSL/ec_group",
|
691
|
+
{
|
692
|
+
0, ossl_ec_group_free,
|
693
|
+
},
|
694
|
+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
|
695
|
+
};
|
696
|
+
|
697
|
+
static VALUE
|
698
|
+
ossl_ec_group_alloc(VALUE klass)
|
699
|
+
{
|
700
|
+
return TypedData_Wrap_Struct(klass, &ossl_ec_group_type, NULL);
|
701
|
+
}
|
702
|
+
|
703
|
+
static VALUE
|
704
|
+
ec_group_new(const EC_GROUP *group)
|
705
|
+
{
|
706
|
+
VALUE obj;
|
707
|
+
EC_GROUP *group_new;
|
708
|
+
|
709
|
+
obj = ossl_ec_group_alloc(cEC_GROUP);
|
710
|
+
group_new = EC_GROUP_dup(group);
|
711
|
+
if (!group_new)
|
712
|
+
ossl_raise(eEC_GROUP, "EC_GROUP_dup");
|
713
|
+
RTYPEDDATA_DATA(obj) = group_new;
|
714
|
+
|
715
|
+
return obj;
|
716
|
+
}
|
717
|
+
|
718
|
+
/*
|
719
|
+
* call-seq:
|
720
|
+
* OpenSSL::PKey::EC::Group.new(ec_group)
|
721
|
+
* OpenSSL::PKey::EC::Group.new(pem_or_der_encoded)
|
722
|
+
* OpenSSL::PKey::EC::Group.new(ec_method)
|
723
|
+
* OpenSSL::PKey::EC::Group.new(:GFp, bignum_p, bignum_a, bignum_b)
|
724
|
+
* OpenSSL::PKey::EC::Group.new(:GF2m, bignum_p, bignum_a, bignum_b)
|
725
|
+
*
|
726
|
+
* Creates a new EC::Group object.
|
727
|
+
*
|
728
|
+
* +ec_method+ is a symbol that represents an EC_METHOD. Currently the following
|
729
|
+
* are supported:
|
730
|
+
*
|
731
|
+
* * :GFp_simple
|
732
|
+
* * :GFp_mont
|
733
|
+
* * :GFp_nist
|
734
|
+
* * :GF2m_simple
|
735
|
+
*
|
736
|
+
* If the first argument is :GFp or :GF2m, creates a new curve with given
|
737
|
+
* parameters.
|
738
|
+
*/
|
739
|
+
static VALUE ossl_ec_group_initialize(int argc, VALUE *argv, VALUE self)
|
740
|
+
{
|
741
|
+
VALUE arg1, arg2, arg3, arg4;
|
742
|
+
EC_GROUP *group;
|
743
|
+
|
744
|
+
TypedData_Get_Struct(self, EC_GROUP, &ossl_ec_group_type, group);
|
745
|
+
if (group)
|
746
|
+
ossl_raise(rb_eRuntimeError, "EC_GROUP is already initialized");
|
747
|
+
|
748
|
+
switch (rb_scan_args(argc, argv, "13", &arg1, &arg2, &arg3, &arg4)) {
|
749
|
+
case 1:
|
750
|
+
if (SYMBOL_P(arg1)) {
|
751
|
+
const EC_METHOD *method = NULL;
|
752
|
+
ID id = SYM2ID(arg1);
|
753
|
+
|
754
|
+
if (id == s_GFp_simple) {
|
755
|
+
method = EC_GFp_simple_method();
|
756
|
+
} else if (id == s_GFp_mont) {
|
757
|
+
method = EC_GFp_mont_method();
|
758
|
+
} else if (id == s_GFp_nist) {
|
759
|
+
method = EC_GFp_nist_method();
|
760
|
+
#if !defined(OPENSSL_NO_EC2M)
|
761
|
+
} else if (id == s_GF2m_simple) {
|
762
|
+
method = EC_GF2m_simple_method();
|
763
|
+
#endif
|
764
|
+
}
|
765
|
+
|
766
|
+
if (method) {
|
767
|
+
if ((group = EC_GROUP_new(method)) == NULL)
|
768
|
+
ossl_raise(eEC_GROUP, "EC_GROUP_new");
|
769
|
+
} else {
|
770
|
+
ossl_raise(rb_eArgError, "unknown symbol, must be :GFp_simple, :GFp_mont, :GFp_nist or :GF2m_simple");
|
771
|
+
}
|
772
|
+
} else if (rb_obj_is_kind_of(arg1, cEC_GROUP)) {
|
773
|
+
const EC_GROUP *arg1_group;
|
774
|
+
|
775
|
+
SafeGetECGroup(arg1, arg1_group);
|
776
|
+
if ((group = EC_GROUP_dup(arg1_group)) == NULL)
|
777
|
+
ossl_raise(eEC_GROUP, "EC_GROUP_dup");
|
778
|
+
} else {
|
779
|
+
BIO *in = ossl_obj2bio(arg1);
|
780
|
+
|
781
|
+
group = PEM_read_bio_ECPKParameters(in, NULL, NULL, NULL);
|
782
|
+
if (!group) {
|
783
|
+
OSSL_BIO_reset(in);
|
784
|
+
group = d2i_ECPKParameters_bio(in, NULL);
|
785
|
+
}
|
786
|
+
|
787
|
+
BIO_free(in);
|
788
|
+
|
789
|
+
if (!group) {
|
790
|
+
const char *name = StringValueCStr(arg1);
|
791
|
+
int nid = OBJ_sn2nid(name);
|
792
|
+
|
793
|
+
ossl_clear_error(); /* ignore errors in d2i_ECPKParameters_bio() */
|
794
|
+
if (nid == NID_undef)
|
795
|
+
ossl_raise(eEC_GROUP, "unknown curve name (%"PRIsVALUE")", arg1);
|
796
|
+
|
797
|
+
group = EC_GROUP_new_by_curve_name(nid);
|
798
|
+
if (group == NULL)
|
799
|
+
ossl_raise(eEC_GROUP, "unable to create curve (%"PRIsVALUE")", arg1);
|
800
|
+
|
801
|
+
EC_GROUP_set_asn1_flag(group, OPENSSL_EC_NAMED_CURVE);
|
802
|
+
EC_GROUP_set_point_conversion_form(group, POINT_CONVERSION_UNCOMPRESSED);
|
803
|
+
}
|
804
|
+
}
|
805
|
+
|
806
|
+
break;
|
807
|
+
case 4:
|
808
|
+
if (SYMBOL_P(arg1)) {
|
809
|
+
ID id = SYM2ID(arg1);
|
810
|
+
EC_GROUP *(*new_curve)(const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *) = NULL;
|
811
|
+
const BIGNUM *p = GetBNPtr(arg2);
|
812
|
+
const BIGNUM *a = GetBNPtr(arg3);
|
813
|
+
const BIGNUM *b = GetBNPtr(arg4);
|
814
|
+
|
815
|
+
if (id == s_GFp) {
|
816
|
+
new_curve = EC_GROUP_new_curve_GFp;
|
817
|
+
#if !defined(OPENSSL_NO_EC2M)
|
818
|
+
} else if (id == s_GF2m) {
|
819
|
+
new_curve = EC_GROUP_new_curve_GF2m;
|
820
|
+
#endif
|
821
|
+
} else {
|
822
|
+
ossl_raise(rb_eArgError, "unknown symbol, must be :GFp or :GF2m");
|
823
|
+
}
|
824
|
+
|
825
|
+
if ((group = new_curve(p, a, b, ossl_bn_ctx)) == NULL)
|
826
|
+
ossl_raise(eEC_GROUP, "EC_GROUP_new_by_GF*");
|
827
|
+
} else {
|
828
|
+
ossl_raise(rb_eArgError, "unknown argument, must be :GFp or :GF2m");
|
829
|
+
}
|
830
|
+
|
831
|
+
break;
|
832
|
+
default:
|
833
|
+
ossl_raise(rb_eArgError, "wrong number of arguments");
|
834
|
+
}
|
835
|
+
|
836
|
+
if (group == NULL)
|
837
|
+
ossl_raise(eEC_GROUP, "");
|
838
|
+
RTYPEDDATA_DATA(self) = group;
|
839
|
+
|
840
|
+
return self;
|
841
|
+
}
|
842
|
+
|
843
|
+
static VALUE
|
844
|
+
ossl_ec_group_initialize_copy(VALUE self, VALUE other)
|
845
|
+
{
|
846
|
+
EC_GROUP *group, *group_new;
|
847
|
+
|
848
|
+
TypedData_Get_Struct(self, EC_GROUP, &ossl_ec_group_type, group_new);
|
849
|
+
if (group_new)
|
850
|
+
ossl_raise(eEC_GROUP, "EC::Group already initialized");
|
851
|
+
SafeGetECGroup(other, group);
|
852
|
+
|
853
|
+
group_new = EC_GROUP_dup(group);
|
854
|
+
if (!group_new)
|
855
|
+
ossl_raise(eEC_GROUP, "EC_GROUP_dup");
|
856
|
+
RTYPEDDATA_DATA(self) = group_new;
|
857
|
+
|
858
|
+
return self;
|
859
|
+
}
|
860
|
+
|
861
|
+
/*
|
862
|
+
* call-seq:
|
863
|
+
* group1.eql?(group2) => true | false
|
864
|
+
* group1 == group2 => true | false
|
865
|
+
*
|
866
|
+
* Returns true if the two groups use the same curve and have the same
|
867
|
+
* parameters, false otherwise.
|
868
|
+
*/
|
869
|
+
static VALUE ossl_ec_group_eql(VALUE a, VALUE b)
|
870
|
+
{
|
871
|
+
EC_GROUP *group1 = NULL, *group2 = NULL;
|
872
|
+
|
873
|
+
GetECGroup(a, group1);
|
874
|
+
SafeGetECGroup(b, group2);
|
875
|
+
|
876
|
+
if (EC_GROUP_cmp(group1, group2, ossl_bn_ctx) == 1)
|
877
|
+
return Qfalse;
|
878
|
+
|
879
|
+
return Qtrue;
|
880
|
+
}
|
881
|
+
|
882
|
+
/*
|
883
|
+
* call-seq:
|
884
|
+
* group.generator => ec_point
|
885
|
+
*
|
886
|
+
* Returns the generator of the group.
|
887
|
+
*
|
888
|
+
* See the OpenSSL documentation for EC_GROUP_get0_generator()
|
889
|
+
*/
|
890
|
+
static VALUE ossl_ec_group_get_generator(VALUE self)
|
891
|
+
{
|
892
|
+
EC_GROUP *group;
|
893
|
+
const EC_POINT *generator;
|
894
|
+
|
895
|
+
GetECGroup(self, group);
|
896
|
+
generator = EC_GROUP_get0_generator(group);
|
897
|
+
if (!generator)
|
898
|
+
return Qnil;
|
899
|
+
|
900
|
+
return ec_point_new(generator, group);
|
901
|
+
}
|
902
|
+
|
903
|
+
/*
|
904
|
+
* call-seq:
|
905
|
+
* group.set_generator(generator, order, cofactor) => self
|
906
|
+
*
|
907
|
+
* Sets the curve parameters. +generator+ must be an instance of EC::Point that
|
908
|
+
* is on the curve. +order+ and +cofactor+ are integers.
|
909
|
+
*
|
910
|
+
* See the OpenSSL documentation for EC_GROUP_set_generator()
|
911
|
+
*/
|
912
|
+
static VALUE ossl_ec_group_set_generator(VALUE self, VALUE generator, VALUE order, VALUE cofactor)
|
913
|
+
{
|
914
|
+
EC_GROUP *group = NULL;
|
915
|
+
const EC_POINT *point;
|
916
|
+
const BIGNUM *o, *co;
|
917
|
+
|
918
|
+
GetECGroup(self, group);
|
919
|
+
SafeGetECPoint(generator, point);
|
920
|
+
o = GetBNPtr(order);
|
921
|
+
co = GetBNPtr(cofactor);
|
922
|
+
|
923
|
+
if (EC_GROUP_set_generator(group, point, o, co) != 1)
|
924
|
+
ossl_raise(eEC_GROUP, "EC_GROUP_set_generator");
|
925
|
+
|
926
|
+
return self;
|
927
|
+
}
|
928
|
+
|
929
|
+
/*
|
930
|
+
* call-seq:
|
931
|
+
* group.get_order => order_bn
|
932
|
+
*
|
933
|
+
* Returns the order of the group.
|
934
|
+
*
|
935
|
+
* See the OpenSSL documentation for EC_GROUP_get_order()
|
936
|
+
*/
|
937
|
+
static VALUE ossl_ec_group_get_order(VALUE self)
|
938
|
+
{
|
939
|
+
VALUE bn_obj;
|
940
|
+
BIGNUM *bn;
|
941
|
+
EC_GROUP *group = NULL;
|
942
|
+
|
943
|
+
GetECGroup(self, group);
|
944
|
+
|
945
|
+
bn_obj = ossl_bn_new(NULL);
|
946
|
+
bn = GetBNPtr(bn_obj);
|
947
|
+
|
948
|
+
if (EC_GROUP_get_order(group, bn, ossl_bn_ctx) != 1)
|
949
|
+
ossl_raise(eEC_GROUP, "EC_GROUP_get_order");
|
950
|
+
|
951
|
+
return bn_obj;
|
952
|
+
}
|
953
|
+
|
954
|
+
/*
|
955
|
+
* call-seq:
|
956
|
+
* group.get_cofactor => cofactor_bn
|
957
|
+
*
|
958
|
+
* Returns the cofactor of the group.
|
959
|
+
*
|
960
|
+
* See the OpenSSL documentation for EC_GROUP_get_cofactor()
|
961
|
+
*/
|
962
|
+
static VALUE ossl_ec_group_get_cofactor(VALUE self)
|
963
|
+
{
|
964
|
+
VALUE bn_obj;
|
965
|
+
BIGNUM *bn;
|
966
|
+
EC_GROUP *group = NULL;
|
967
|
+
|
968
|
+
GetECGroup(self, group);
|
969
|
+
|
970
|
+
bn_obj = ossl_bn_new(NULL);
|
971
|
+
bn = GetBNPtr(bn_obj);
|
972
|
+
|
973
|
+
if (EC_GROUP_get_cofactor(group, bn, ossl_bn_ctx) != 1)
|
974
|
+
ossl_raise(eEC_GROUP, "EC_GROUP_get_cofactor");
|
975
|
+
|
976
|
+
return bn_obj;
|
977
|
+
}
|
978
|
+
|
979
|
+
/*
|
980
|
+
* call-seq:
|
981
|
+
* group.curve_name => String
|
982
|
+
*
|
983
|
+
* Returns the curve name (sn).
|
984
|
+
*
|
985
|
+
* See the OpenSSL documentation for EC_GROUP_get_curve_name()
|
986
|
+
*/
|
987
|
+
static VALUE ossl_ec_group_get_curve_name(VALUE self)
|
988
|
+
{
|
989
|
+
EC_GROUP *group = NULL;
|
990
|
+
int nid;
|
991
|
+
|
992
|
+
GetECGroup(self, group);
|
993
|
+
if (group == NULL)
|
994
|
+
return Qnil;
|
995
|
+
|
996
|
+
nid = EC_GROUP_get_curve_name(group);
|
997
|
+
|
998
|
+
/* BUG: an nid or asn1 object should be returned, maybe. */
|
999
|
+
return rb_str_new2(OBJ_nid2sn(nid));
|
1000
|
+
}
|
1001
|
+
|
1002
|
+
/*
|
1003
|
+
* call-seq:
|
1004
|
+
* EC.builtin_curves => [[sn, comment], ...]
|
1005
|
+
*
|
1006
|
+
* Obtains a list of all predefined curves by the OpenSSL. Curve names are
|
1007
|
+
* returned as sn.
|
1008
|
+
*
|
1009
|
+
* See the OpenSSL documentation for EC_get_builtin_curves().
|
1010
|
+
*/
|
1011
|
+
static VALUE ossl_s_builtin_curves(VALUE self)
|
1012
|
+
{
|
1013
|
+
EC_builtin_curve *curves = NULL;
|
1014
|
+
int n;
|
1015
|
+
int crv_len = rb_long2int(EC_get_builtin_curves(NULL, 0));
|
1016
|
+
VALUE ary, ret;
|
1017
|
+
|
1018
|
+
curves = ALLOCA_N(EC_builtin_curve, crv_len);
|
1019
|
+
if (curves == NULL)
|
1020
|
+
return Qnil;
|
1021
|
+
if (!EC_get_builtin_curves(curves, crv_len))
|
1022
|
+
ossl_raise(rb_eRuntimeError, "EC_get_builtin_curves");
|
1023
|
+
|
1024
|
+
ret = rb_ary_new2(crv_len);
|
1025
|
+
|
1026
|
+
for (n = 0; n < crv_len; n++) {
|
1027
|
+
const char *sname = OBJ_nid2sn(curves[n].nid);
|
1028
|
+
const char *comment = curves[n].comment;
|
1029
|
+
|
1030
|
+
ary = rb_ary_new2(2);
|
1031
|
+
rb_ary_push(ary, rb_str_new2(sname));
|
1032
|
+
rb_ary_push(ary, comment ? rb_str_new2(comment) : Qnil);
|
1033
|
+
rb_ary_push(ret, ary);
|
1034
|
+
}
|
1035
|
+
|
1036
|
+
return ret;
|
1037
|
+
}
|
1038
|
+
|
1039
|
+
/*
|
1040
|
+
* call-seq:
|
1041
|
+
* group.asn1_flag -> Integer
|
1042
|
+
*
|
1043
|
+
* Returns the flags set on the group.
|
1044
|
+
*
|
1045
|
+
* See also #asn1_flag=.
|
1046
|
+
*/
|
1047
|
+
static VALUE ossl_ec_group_get_asn1_flag(VALUE self)
|
1048
|
+
{
|
1049
|
+
EC_GROUP *group = NULL;
|
1050
|
+
int flag;
|
1051
|
+
|
1052
|
+
GetECGroup(self, group);
|
1053
|
+
flag = EC_GROUP_get_asn1_flag(group);
|
1054
|
+
|
1055
|
+
return INT2NUM(flag);
|
1056
|
+
}
|
1057
|
+
|
1058
|
+
/*
|
1059
|
+
* call-seq:
|
1060
|
+
* group.asn1_flag = flags
|
1061
|
+
*
|
1062
|
+
* Sets flags on the group. The flag value is used to determine how to encode
|
1063
|
+
* the group: encode explicit parameters or named curve using an OID.
|
1064
|
+
*
|
1065
|
+
* The flag value can be either of:
|
1066
|
+
*
|
1067
|
+
* * EC::NAMED_CURVE
|
1068
|
+
* * EC::EXPLICIT_CURVE
|
1069
|
+
*
|
1070
|
+
* See the OpenSSL documentation for EC_GROUP_set_asn1_flag().
|
1071
|
+
*/
|
1072
|
+
static VALUE ossl_ec_group_set_asn1_flag(VALUE self, VALUE flag_v)
|
1073
|
+
{
|
1074
|
+
EC_GROUP *group = NULL;
|
1075
|
+
|
1076
|
+
GetECGroup(self, group);
|
1077
|
+
EC_GROUP_set_asn1_flag(group, NUM2INT(flag_v));
|
1078
|
+
|
1079
|
+
return flag_v;
|
1080
|
+
}
|
1081
|
+
|
1082
|
+
/*
|
1083
|
+
* call-seq:
|
1084
|
+
* group.point_conversion_form -> Symbol
|
1085
|
+
*
|
1086
|
+
* Returns the form how EC::Point data is encoded as ASN.1.
|
1087
|
+
*
|
1088
|
+
* See also #point_conversion_form=.
|
1089
|
+
*/
|
1090
|
+
static VALUE ossl_ec_group_get_point_conversion_form(VALUE self)
|
1091
|
+
{
|
1092
|
+
EC_GROUP *group = NULL;
|
1093
|
+
point_conversion_form_t form;
|
1094
|
+
VALUE ret;
|
1095
|
+
|
1096
|
+
GetECGroup(self, group);
|
1097
|
+
form = EC_GROUP_get_point_conversion_form(group);
|
1098
|
+
|
1099
|
+
switch (form) {
|
1100
|
+
case POINT_CONVERSION_UNCOMPRESSED: ret = ID_uncompressed; break;
|
1101
|
+
case POINT_CONVERSION_COMPRESSED: ret = ID_compressed; break;
|
1102
|
+
case POINT_CONVERSION_HYBRID: ret = ID_hybrid; break;
|
1103
|
+
default: ossl_raise(eEC_GROUP, "unsupported point conversion form: %d, this module should be updated", form);
|
1104
|
+
}
|
1105
|
+
|
1106
|
+
return ID2SYM(ret);
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
/*
|
1110
|
+
* call-seq:
|
1111
|
+
* group.point_conversion_form = form
|
1112
|
+
*
|
1113
|
+
* Sets the form how EC::Point data is encoded as ASN.1 as defined in X9.62.
|
1114
|
+
*
|
1115
|
+
* +format+ can be one of these:
|
1116
|
+
*
|
1117
|
+
* :compressed::
|
1118
|
+
* Encoded as z||x, where z is an octet indicating which solution of the
|
1119
|
+
* equation y is. z will be 0x02 or 0x03.
|
1120
|
+
* :uncompressed::
|
1121
|
+
* Encoded as z||x||y, where z is an octet 0x04.
|
1122
|
+
* :hybrid::
|
1123
|
+
* Encodes as z||x||y, where z is an octet indicating which solution of the
|
1124
|
+
* equation y is. z will be 0x06 or 0x07.
|
1125
|
+
*
|
1126
|
+
* See the OpenSSL documentation for EC_GROUP_set_point_conversion_form()
|
1127
|
+
*/
|
1128
|
+
static VALUE ossl_ec_group_set_point_conversion_form(VALUE self, VALUE form_v)
|
1129
|
+
{
|
1130
|
+
EC_GROUP *group = NULL;
|
1131
|
+
point_conversion_form_t form;
|
1132
|
+
ID form_id = SYM2ID(form_v);
|
1133
|
+
|
1134
|
+
GetECGroup(self, group);
|
1135
|
+
|
1136
|
+
if (form_id == ID_uncompressed) {
|
1137
|
+
form = POINT_CONVERSION_UNCOMPRESSED;
|
1138
|
+
} else if (form_id == ID_compressed) {
|
1139
|
+
form = POINT_CONVERSION_COMPRESSED;
|
1140
|
+
} else if (form_id == ID_hybrid) {
|
1141
|
+
form = POINT_CONVERSION_HYBRID;
|
1142
|
+
} else {
|
1143
|
+
ossl_raise(rb_eArgError, "form must be :compressed, :uncompressed, or :hybrid");
|
1144
|
+
}
|
1145
|
+
|
1146
|
+
EC_GROUP_set_point_conversion_form(group, form);
|
1147
|
+
|
1148
|
+
return form_v;
|
1149
|
+
}
|
1150
|
+
|
1151
|
+
/*
|
1152
|
+
* call-seq:
|
1153
|
+
* group.seed => String or nil
|
1154
|
+
*
|
1155
|
+
* See the OpenSSL documentation for EC_GROUP_get0_seed()
|
1156
|
+
*/
|
1157
|
+
static VALUE ossl_ec_group_get_seed(VALUE self)
|
1158
|
+
{
|
1159
|
+
EC_GROUP *group = NULL;
|
1160
|
+
size_t seed_len;
|
1161
|
+
|
1162
|
+
GetECGroup(self, group);
|
1163
|
+
seed_len = EC_GROUP_get_seed_len(group);
|
1164
|
+
|
1165
|
+
if (seed_len == 0)
|
1166
|
+
return Qnil;
|
1167
|
+
|
1168
|
+
return rb_str_new((const char *)EC_GROUP_get0_seed(group), seed_len);
|
1169
|
+
}
|
1170
|
+
|
1171
|
+
/*
|
1172
|
+
* call-seq:
|
1173
|
+
* group.seed = seed => seed
|
1174
|
+
*
|
1175
|
+
* See the OpenSSL documentation for EC_GROUP_set_seed()
|
1176
|
+
*/
|
1177
|
+
static VALUE ossl_ec_group_set_seed(VALUE self, VALUE seed)
|
1178
|
+
{
|
1179
|
+
EC_GROUP *group = NULL;
|
1180
|
+
|
1181
|
+
GetECGroup(self, group);
|
1182
|
+
StringValue(seed);
|
1183
|
+
|
1184
|
+
if (EC_GROUP_set_seed(group, (unsigned char *)RSTRING_PTR(seed), RSTRING_LEN(seed)) != (size_t)RSTRING_LEN(seed))
|
1185
|
+
ossl_raise(eEC_GROUP, "EC_GROUP_set_seed");
|
1186
|
+
|
1187
|
+
return seed;
|
1188
|
+
}
|
1189
|
+
|
1190
|
+
/* get/set curve GFp, GF2m */
|
1191
|
+
|
1192
|
+
/*
|
1193
|
+
* call-seq:
|
1194
|
+
* group.degree => Fixnum
|
1195
|
+
*
|
1196
|
+
* See the OpenSSL documentation for EC_GROUP_get_degree()
|
1197
|
+
*/
|
1198
|
+
static VALUE ossl_ec_group_get_degree(VALUE self)
|
1199
|
+
{
|
1200
|
+
EC_GROUP *group = NULL;
|
1201
|
+
|
1202
|
+
GetECGroup(self, group);
|
1203
|
+
|
1204
|
+
return INT2NUM(EC_GROUP_get_degree(group));
|
1205
|
+
}
|
1206
|
+
|
1207
|
+
static VALUE ossl_ec_group_to_string(VALUE self, int format)
|
1208
|
+
{
|
1209
|
+
EC_GROUP *group;
|
1210
|
+
BIO *out;
|
1211
|
+
int i = -1;
|
1212
|
+
VALUE str;
|
1213
|
+
|
1214
|
+
GetECGroup(self, group);
|
1215
|
+
|
1216
|
+
if (!(out = BIO_new(BIO_s_mem())))
|
1217
|
+
ossl_raise(eEC_GROUP, "BIO_new(BIO_s_mem())");
|
1218
|
+
|
1219
|
+
switch(format) {
|
1220
|
+
case EXPORT_PEM:
|
1221
|
+
i = PEM_write_bio_ECPKParameters(out, group);
|
1222
|
+
break;
|
1223
|
+
case EXPORT_DER:
|
1224
|
+
i = i2d_ECPKParameters_bio(out, group);
|
1225
|
+
break;
|
1226
|
+
default:
|
1227
|
+
BIO_free(out);
|
1228
|
+
ossl_raise(rb_eRuntimeError, "unknown format (internal error)");
|
1229
|
+
}
|
1230
|
+
|
1231
|
+
if (i != 1) {
|
1232
|
+
BIO_free(out);
|
1233
|
+
ossl_raise(eECError, NULL);
|
1234
|
+
}
|
1235
|
+
|
1236
|
+
str = ossl_membio2str(out);
|
1237
|
+
|
1238
|
+
return str;
|
1239
|
+
}
|
1240
|
+
|
1241
|
+
/*
|
1242
|
+
* call-seq:
|
1243
|
+
* group.to_pem => String
|
1244
|
+
*
|
1245
|
+
* See the OpenSSL documentation for PEM_write_bio_ECPKParameters()
|
1246
|
+
*/
|
1247
|
+
static VALUE ossl_ec_group_to_pem(VALUE self)
|
1248
|
+
{
|
1249
|
+
return ossl_ec_group_to_string(self, EXPORT_PEM);
|
1250
|
+
}
|
1251
|
+
|
1252
|
+
/*
|
1253
|
+
* call-seq:
|
1254
|
+
* group.to_der => String
|
1255
|
+
*
|
1256
|
+
* See the OpenSSL documentation for i2d_ECPKParameters_bio()
|
1257
|
+
*/
|
1258
|
+
static VALUE ossl_ec_group_to_der(VALUE self)
|
1259
|
+
{
|
1260
|
+
return ossl_ec_group_to_string(self, EXPORT_DER);
|
1261
|
+
}
|
1262
|
+
|
1263
|
+
/*
|
1264
|
+
* call-seq:
|
1265
|
+
* group.to_text => String
|
1266
|
+
*
|
1267
|
+
* See the OpenSSL documentation for ECPKParameters_print()
|
1268
|
+
*/
|
1269
|
+
static VALUE ossl_ec_group_to_text(VALUE self)
|
1270
|
+
{
|
1271
|
+
EC_GROUP *group;
|
1272
|
+
BIO *out;
|
1273
|
+
VALUE str;
|
1274
|
+
|
1275
|
+
GetECGroup(self, group);
|
1276
|
+
if (!(out = BIO_new(BIO_s_mem()))) {
|
1277
|
+
ossl_raise(eEC_GROUP, "BIO_new(BIO_s_mem())");
|
1278
|
+
}
|
1279
|
+
if (!ECPKParameters_print(out, group, 0)) {
|
1280
|
+
BIO_free(out);
|
1281
|
+
ossl_raise(eEC_GROUP, NULL);
|
1282
|
+
}
|
1283
|
+
str = ossl_membio2str(out);
|
1284
|
+
|
1285
|
+
return str;
|
1286
|
+
}
|
1287
|
+
|
1288
|
+
|
1289
|
+
/*
|
1290
|
+
* OpenSSL::PKey::EC::Point
|
1291
|
+
*/
|
1292
|
+
static void
|
1293
|
+
ossl_ec_point_free(void *ptr)
|
1294
|
+
{
|
1295
|
+
EC_POINT_clear_free(ptr);
|
1296
|
+
}
|
1297
|
+
|
1298
|
+
static const rb_data_type_t ossl_ec_point_type = {
|
1299
|
+
"OpenSSL/EC_POINT",
|
1300
|
+
{
|
1301
|
+
0, ossl_ec_point_free,
|
1302
|
+
},
|
1303
|
+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
|
1304
|
+
};
|
1305
|
+
|
1306
|
+
static VALUE
|
1307
|
+
ossl_ec_point_alloc(VALUE klass)
|
1308
|
+
{
|
1309
|
+
return TypedData_Wrap_Struct(klass, &ossl_ec_point_type, NULL);
|
1310
|
+
}
|
1311
|
+
|
1312
|
+
static VALUE
|
1313
|
+
ec_point_new(const EC_POINT *point, const EC_GROUP *group)
|
1314
|
+
{
|
1315
|
+
EC_POINT *point_new;
|
1316
|
+
VALUE obj;
|
1317
|
+
|
1318
|
+
obj = ossl_ec_point_alloc(cEC_POINT);
|
1319
|
+
point_new = EC_POINT_dup(point, group);
|
1320
|
+
if (!point_new)
|
1321
|
+
ossl_raise(eEC_POINT, "EC_POINT_dup");
|
1322
|
+
RTYPEDDATA_DATA(obj) = point_new;
|
1323
|
+
rb_ivar_set(obj, id_i_group, ec_group_new(group));
|
1324
|
+
|
1325
|
+
return obj;
|
1326
|
+
}
|
1327
|
+
|
1328
|
+
/*
|
1329
|
+
* call-seq:
|
1330
|
+
* OpenSSL::PKey::EC::Point.new(point)
|
1331
|
+
* OpenSSL::PKey::EC::Point.new(group)
|
1332
|
+
* OpenSSL::PKey::EC::Point.new(group, bn)
|
1333
|
+
*
|
1334
|
+
* See the OpenSSL documentation for EC_POINT_*
|
1335
|
+
*/
|
1336
|
+
static VALUE ossl_ec_point_initialize(int argc, VALUE *argv, VALUE self)
|
1337
|
+
{
|
1338
|
+
EC_POINT *point;
|
1339
|
+
VALUE arg1, arg2;
|
1340
|
+
VALUE group_v = Qnil;
|
1341
|
+
const EC_GROUP *group = NULL;
|
1342
|
+
|
1343
|
+
TypedData_Get_Struct(self, EC_POINT, &ossl_ec_point_type, point);
|
1344
|
+
if (point)
|
1345
|
+
ossl_raise(eEC_POINT, "EC_POINT already initialized");
|
1346
|
+
|
1347
|
+
switch (rb_scan_args(argc, argv, "11", &arg1, &arg2)) {
|
1348
|
+
case 1:
|
1349
|
+
if (rb_obj_is_kind_of(arg1, cEC_POINT)) {
|
1350
|
+
const EC_POINT *arg_point;
|
1351
|
+
|
1352
|
+
group_v = rb_attr_get(arg1, id_i_group);
|
1353
|
+
SafeGetECGroup(group_v, group);
|
1354
|
+
SafeGetECPoint(arg1, arg_point);
|
1355
|
+
|
1356
|
+
point = EC_POINT_dup(arg_point, group);
|
1357
|
+
} else if (rb_obj_is_kind_of(arg1, cEC_GROUP)) {
|
1358
|
+
group_v = arg1;
|
1359
|
+
SafeGetECGroup(group_v, group);
|
1360
|
+
|
1361
|
+
point = EC_POINT_new(group);
|
1362
|
+
} else {
|
1363
|
+
ossl_raise(eEC_POINT, "wrong argument type: must be OpenSSL::PKey::EC::Point or OpenSSL::Pkey::EC::Group");
|
1364
|
+
}
|
1365
|
+
|
1366
|
+
break;
|
1367
|
+
case 2:
|
1368
|
+
if (!rb_obj_is_kind_of(arg1, cEC_GROUP))
|
1369
|
+
ossl_raise(rb_eArgError, "1st argument must be OpenSSL::PKey::EC::Group");
|
1370
|
+
group_v = arg1;
|
1371
|
+
SafeGetECGroup(group_v, group);
|
1372
|
+
|
1373
|
+
if (rb_obj_is_kind_of(arg2, cBN)) {
|
1374
|
+
const BIGNUM *bn = GetBNPtr(arg2);
|
1375
|
+
|
1376
|
+
point = EC_POINT_bn2point(group, bn, NULL, ossl_bn_ctx);
|
1377
|
+
} else {
|
1378
|
+
BIO *in = ossl_obj2bio(arg1);
|
1379
|
+
|
1380
|
+
/* BUG: finish me */
|
1381
|
+
|
1382
|
+
BIO_free(in);
|
1383
|
+
|
1384
|
+
if (point == NULL) {
|
1385
|
+
ossl_raise(eEC_POINT, "unknown type for 2nd arg");
|
1386
|
+
}
|
1387
|
+
}
|
1388
|
+
break;
|
1389
|
+
default:
|
1390
|
+
ossl_raise(rb_eArgError, "wrong number of arguments");
|
1391
|
+
}
|
1392
|
+
|
1393
|
+
if (point == NULL)
|
1394
|
+
ossl_raise(eEC_POINT, NULL);
|
1395
|
+
|
1396
|
+
if (NIL_P(group_v))
|
1397
|
+
ossl_raise(rb_eRuntimeError, "missing group (internal error)");
|
1398
|
+
|
1399
|
+
RTYPEDDATA_DATA(self) = point;
|
1400
|
+
rb_ivar_set(self, id_i_group, group_v);
|
1401
|
+
|
1402
|
+
return self;
|
1403
|
+
}
|
1404
|
+
|
1405
|
+
static VALUE
|
1406
|
+
ossl_ec_point_initialize_copy(VALUE self, VALUE other)
|
1407
|
+
{
|
1408
|
+
EC_POINT *point, *point_new;
|
1409
|
+
EC_GROUP *group;
|
1410
|
+
VALUE group_v;
|
1411
|
+
|
1412
|
+
TypedData_Get_Struct(self, EC_POINT, &ossl_ec_point_type, point_new);
|
1413
|
+
if (point_new)
|
1414
|
+
ossl_raise(eEC_POINT, "EC::Point already initialized");
|
1415
|
+
SafeGetECPoint(other, point);
|
1416
|
+
|
1417
|
+
group_v = rb_obj_dup(rb_attr_get(other, id_i_group));
|
1418
|
+
SafeGetECGroup(group_v, group);
|
1419
|
+
|
1420
|
+
point_new = EC_POINT_dup(point, group);
|
1421
|
+
if (!point_new)
|
1422
|
+
ossl_raise(eEC_POINT, "EC_POINT_dup");
|
1423
|
+
RTYPEDDATA_DATA(self) = point_new;
|
1424
|
+
rb_ivar_set(self, id_i_group, group_v);
|
1425
|
+
|
1426
|
+
return self;
|
1427
|
+
}
|
1428
|
+
|
1429
|
+
/*
|
1430
|
+
* call-seq:
|
1431
|
+
* point1.eql?(point2) => true | false
|
1432
|
+
* point1 == point2 => true | false
|
1433
|
+
*/
|
1434
|
+
static VALUE ossl_ec_point_eql(VALUE a, VALUE b)
|
1435
|
+
{
|
1436
|
+
EC_POINT *point1, *point2;
|
1437
|
+
VALUE group_v1 = rb_attr_get(a, id_i_group);
|
1438
|
+
VALUE group_v2 = rb_attr_get(b, id_i_group);
|
1439
|
+
const EC_GROUP *group;
|
1440
|
+
|
1441
|
+
if (ossl_ec_group_eql(group_v1, group_v2) == Qfalse)
|
1442
|
+
return Qfalse;
|
1443
|
+
|
1444
|
+
GetECPoint(a, point1);
|
1445
|
+
SafeGetECPoint(b, point2);
|
1446
|
+
SafeGetECGroup(group_v1, group);
|
1447
|
+
|
1448
|
+
if (EC_POINT_cmp(group, point1, point2, ossl_bn_ctx) == 1)
|
1449
|
+
return Qfalse;
|
1450
|
+
|
1451
|
+
return Qtrue;
|
1452
|
+
}
|
1453
|
+
|
1454
|
+
/*
|
1455
|
+
* call-seq:
|
1456
|
+
* point.infinity? => true | false
|
1457
|
+
*/
|
1458
|
+
static VALUE ossl_ec_point_is_at_infinity(VALUE self)
|
1459
|
+
{
|
1460
|
+
EC_POINT *point;
|
1461
|
+
const EC_GROUP *group;
|
1462
|
+
|
1463
|
+
GetECPoint(self, point);
|
1464
|
+
GetECPointGroup(self, group);
|
1465
|
+
|
1466
|
+
switch (EC_POINT_is_at_infinity(group, point)) {
|
1467
|
+
case 1: return Qtrue;
|
1468
|
+
case 0: return Qfalse;
|
1469
|
+
default: ossl_raise(cEC_POINT, "EC_POINT_is_at_infinity");
|
1470
|
+
}
|
1471
|
+
|
1472
|
+
UNREACHABLE;
|
1473
|
+
}
|
1474
|
+
|
1475
|
+
/*
|
1476
|
+
* call-seq:
|
1477
|
+
* point.on_curve? => true | false
|
1478
|
+
*/
|
1479
|
+
static VALUE ossl_ec_point_is_on_curve(VALUE self)
|
1480
|
+
{
|
1481
|
+
EC_POINT *point;
|
1482
|
+
const EC_GROUP *group;
|
1483
|
+
|
1484
|
+
GetECPoint(self, point);
|
1485
|
+
GetECPointGroup(self, group);
|
1486
|
+
|
1487
|
+
switch (EC_POINT_is_on_curve(group, point, ossl_bn_ctx)) {
|
1488
|
+
case 1: return Qtrue;
|
1489
|
+
case 0: return Qfalse;
|
1490
|
+
default: ossl_raise(cEC_POINT, "EC_POINT_is_on_curve");
|
1491
|
+
}
|
1492
|
+
|
1493
|
+
UNREACHABLE;
|
1494
|
+
}
|
1495
|
+
|
1496
|
+
/*
|
1497
|
+
* call-seq:
|
1498
|
+
* point.make_affine! => self
|
1499
|
+
*/
|
1500
|
+
static VALUE ossl_ec_point_make_affine(VALUE self)
|
1501
|
+
{
|
1502
|
+
EC_POINT *point;
|
1503
|
+
const EC_GROUP *group;
|
1504
|
+
|
1505
|
+
GetECPoint(self, point);
|
1506
|
+
GetECPointGroup(self, group);
|
1507
|
+
|
1508
|
+
if (EC_POINT_make_affine(group, point, ossl_bn_ctx) != 1)
|
1509
|
+
ossl_raise(cEC_POINT, "EC_POINT_make_affine");
|
1510
|
+
|
1511
|
+
return self;
|
1512
|
+
}
|
1513
|
+
|
1514
|
+
/*
|
1515
|
+
* call-seq:
|
1516
|
+
* point.invert! => self
|
1517
|
+
*/
|
1518
|
+
static VALUE ossl_ec_point_invert(VALUE self)
|
1519
|
+
{
|
1520
|
+
EC_POINT *point;
|
1521
|
+
const EC_GROUP *group;
|
1522
|
+
|
1523
|
+
GetECPoint(self, point);
|
1524
|
+
GetECPointGroup(self, group);
|
1525
|
+
|
1526
|
+
if (EC_POINT_invert(group, point, ossl_bn_ctx) != 1)
|
1527
|
+
ossl_raise(cEC_POINT, "EC_POINT_invert");
|
1528
|
+
|
1529
|
+
return self;
|
1530
|
+
}
|
1531
|
+
|
1532
|
+
/*
|
1533
|
+
* call-seq:
|
1534
|
+
* point.set_to_infinity! => self
|
1535
|
+
*/
|
1536
|
+
static VALUE ossl_ec_point_set_to_infinity(VALUE self)
|
1537
|
+
{
|
1538
|
+
EC_POINT *point;
|
1539
|
+
const EC_GROUP *group;
|
1540
|
+
|
1541
|
+
GetECPoint(self, point);
|
1542
|
+
GetECPointGroup(self, group);
|
1543
|
+
|
1544
|
+
if (EC_POINT_set_to_infinity(group, point) != 1)
|
1545
|
+
ossl_raise(cEC_POINT, "EC_POINT_set_to_infinity");
|
1546
|
+
|
1547
|
+
return self;
|
1548
|
+
}
|
1549
|
+
|
1550
|
+
/*
|
1551
|
+
* call-seq:
|
1552
|
+
* point.to_bn => OpenSSL::BN
|
1553
|
+
*
|
1554
|
+
* See the OpenSSL documentation for EC_POINT_point2bn()
|
1555
|
+
*/
|
1556
|
+
static VALUE ossl_ec_point_to_bn(VALUE self)
|
1557
|
+
{
|
1558
|
+
EC_POINT *point;
|
1559
|
+
VALUE bn_obj;
|
1560
|
+
const EC_GROUP *group;
|
1561
|
+
point_conversion_form_t form;
|
1562
|
+
BIGNUM *bn;
|
1563
|
+
|
1564
|
+
GetECPoint(self, point);
|
1565
|
+
GetECPointGroup(self, group);
|
1566
|
+
|
1567
|
+
form = EC_GROUP_get_point_conversion_form(group);
|
1568
|
+
|
1569
|
+
bn_obj = rb_obj_alloc(cBN);
|
1570
|
+
bn = GetBNPtr(bn_obj);
|
1571
|
+
|
1572
|
+
if (EC_POINT_point2bn(group, point, form, bn, ossl_bn_ctx) == NULL)
|
1573
|
+
ossl_raise(eEC_POINT, "EC_POINT_point2bn");
|
1574
|
+
|
1575
|
+
return bn_obj;
|
1576
|
+
}
|
1577
|
+
|
1578
|
+
/*
|
1579
|
+
* call-seq:
|
1580
|
+
* point.mul(bn1 [, bn2]) => point
|
1581
|
+
* point.mul(bns, points [, bn2]) => point
|
1582
|
+
*
|
1583
|
+
* Performs elliptic curve point multiplication.
|
1584
|
+
*
|
1585
|
+
* The first form calculates <tt>bn1 * point + bn2 * G</tt>, where +G+ is the
|
1586
|
+
* generator of the group of +point+. +bn2+ may be ommitted, and in that case,
|
1587
|
+
* the result is just <tt>bn1 * point</tt>.
|
1588
|
+
*
|
1589
|
+
* The second form calculates <tt>bns[0] * point + bns[1] * points[0] + ...
|
1590
|
+
* + bns[-1] * points[-1] + bn2 * G</tt>. +bn2+ may be ommitted. +bns+ must be
|
1591
|
+
* an array of OpenSSL::BN. +points+ must be an array of
|
1592
|
+
* OpenSSL::PKey::EC::Point. Please note that <tt>points[0]</tt> is not
|
1593
|
+
* multiplied by <tt>bns[0]</tt>, but <tt>bns[1]</tt>.
|
1594
|
+
*/
|
1595
|
+
static VALUE ossl_ec_point_mul(int argc, VALUE *argv, VALUE self)
|
1596
|
+
{
|
1597
|
+
EC_POINT *point_self, *point_result;
|
1598
|
+
const EC_GROUP *group;
|
1599
|
+
VALUE group_v = rb_attr_get(self, id_i_group);
|
1600
|
+
VALUE arg1, arg2, arg3, result;
|
1601
|
+
const BIGNUM *bn_g = NULL;
|
1602
|
+
|
1603
|
+
GetECPoint(self, point_self);
|
1604
|
+
SafeGetECGroup(group_v, group);
|
1605
|
+
|
1606
|
+
result = rb_obj_alloc(cEC_POINT);
|
1607
|
+
ossl_ec_point_initialize(1, &group_v, result);
|
1608
|
+
GetECPoint(result, point_result);
|
1609
|
+
|
1610
|
+
rb_scan_args(argc, argv, "12", &arg1, &arg2, &arg3);
|
1611
|
+
if (!RB_TYPE_P(arg1, T_ARRAY)) {
|
1612
|
+
BIGNUM *bn = GetBNPtr(arg1);
|
1613
|
+
|
1614
|
+
if (!NIL_P(arg2))
|
1615
|
+
bn_g = GetBNPtr(arg2);
|
1616
|
+
if (EC_POINT_mul(group, point_result, bn_g, point_self, bn, ossl_bn_ctx) != 1)
|
1617
|
+
ossl_raise(eEC_POINT, NULL);
|
1618
|
+
} else {
|
1619
|
+
/*
|
1620
|
+
* bignums | arg1[0] | arg1[1] | arg1[2] | ...
|
1621
|
+
* points | self | arg2[0] | arg2[1] | ...
|
1622
|
+
*/
|
1623
|
+
long i, num;
|
1624
|
+
VALUE tmp_p, tmp_b;
|
1625
|
+
const EC_POINT **points;
|
1626
|
+
const BIGNUM **bignums;
|
1627
|
+
|
1628
|
+
Check_Type(arg1, T_ARRAY);
|
1629
|
+
Check_Type(arg2, T_ARRAY);
|
1630
|
+
if (RARRAY_LEN(arg1) != RARRAY_LEN(arg2) + 1) /* arg2 must be 1 larger */
|
1631
|
+
ossl_raise(rb_eArgError, "bns must be 1 longer than points; see the documentation");
|
1632
|
+
|
1633
|
+
num = RARRAY_LEN(arg1);
|
1634
|
+
bignums = ALLOCV_N(const BIGNUM *, tmp_b, num);
|
1635
|
+
for (i = 0; i < num; i++)
|
1636
|
+
bignums[i] = GetBNPtr(RARRAY_AREF(arg1, i));
|
1637
|
+
|
1638
|
+
points = ALLOCV_N(const EC_POINT *, tmp_p, num);
|
1639
|
+
points[0] = point_self; /* self */
|
1640
|
+
for (i = 0; i < num - 1; i++)
|
1641
|
+
SafeGetECPoint(RARRAY_AREF(arg2, i), points[i + 1]);
|
1642
|
+
|
1643
|
+
if (!NIL_P(arg3))
|
1644
|
+
bn_g = GetBNPtr(arg3);
|
1645
|
+
|
1646
|
+
if (EC_POINTs_mul(group, point_result, bn_g, num, points, bignums, ossl_bn_ctx) != 1) {
|
1647
|
+
ALLOCV_END(tmp_b);
|
1648
|
+
ALLOCV_END(tmp_p);
|
1649
|
+
ossl_raise(eEC_POINT, NULL);
|
1650
|
+
}
|
1651
|
+
|
1652
|
+
ALLOCV_END(tmp_b);
|
1653
|
+
ALLOCV_END(tmp_p);
|
1654
|
+
}
|
1655
|
+
|
1656
|
+
return result;
|
1657
|
+
}
|
1658
|
+
|
1659
|
+
void Init_ossl_ec(void)
|
1660
|
+
{
|
1661
|
+
#if 0
|
1662
|
+
mPKey = rb_define_module_under(mOSSL, "PKey");
|
1663
|
+
cPKey = rb_define_class_under(mPKey, "PKey", rb_cObject);
|
1664
|
+
eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError);
|
1665
|
+
ePKeyError = rb_define_class_under(mPKey, "PKeyError", eOSSLError);
|
1666
|
+
#endif
|
1667
|
+
|
1668
|
+
eECError = rb_define_class_under(mPKey, "ECError", ePKeyError);
|
1669
|
+
|
1670
|
+
/*
|
1671
|
+
* Document-class: OpenSSL::PKey::EC
|
1672
|
+
*
|
1673
|
+
* OpenSSL::PKey::EC provides access to Elliptic Curve Digital Signature
|
1674
|
+
* Algorithm (ECDSA) and Elliptic Curve Diffie-Hellman (ECDH).
|
1675
|
+
*
|
1676
|
+
* === Key exchange
|
1677
|
+
* ec1 = OpenSSL::PKey::EC.generate("prime256v1")
|
1678
|
+
* ec2 = OpenSSL::PKey::EC.generate("prime256v1")
|
1679
|
+
* # ec1 and ec2 have own private key respectively
|
1680
|
+
* shared_key1 = ec1.dh_compute_key(ec2.public_key)
|
1681
|
+
* shared_key2 = ec2.dh_compute_key(ec1.public_key)
|
1682
|
+
*
|
1683
|
+
* p shared_key1 == shared_key2 #=> true
|
1684
|
+
*/
|
1685
|
+
cEC = rb_define_class_under(mPKey, "EC", cPKey);
|
1686
|
+
cEC_GROUP = rb_define_class_under(cEC, "Group", rb_cObject);
|
1687
|
+
cEC_POINT = rb_define_class_under(cEC, "Point", rb_cObject);
|
1688
|
+
eEC_GROUP = rb_define_class_under(cEC_GROUP, "Error", eOSSLError);
|
1689
|
+
eEC_POINT = rb_define_class_under(cEC_POINT, "Error", eOSSLError);
|
1690
|
+
|
1691
|
+
s_GFp = rb_intern("GFp");
|
1692
|
+
s_GF2m = rb_intern("GF2m");
|
1693
|
+
s_GFp_simple = rb_intern("GFp_simple");
|
1694
|
+
s_GFp_mont = rb_intern("GFp_mont");
|
1695
|
+
s_GFp_nist = rb_intern("GFp_nist");
|
1696
|
+
s_GF2m_simple = rb_intern("GF2m_simple");
|
1697
|
+
|
1698
|
+
ID_uncompressed = rb_intern("uncompressed");
|
1699
|
+
ID_compressed = rb_intern("compressed");
|
1700
|
+
ID_hybrid = rb_intern("hybrid");
|
1701
|
+
|
1702
|
+
rb_define_const(cEC, "NAMED_CURVE", INT2NUM(OPENSSL_EC_NAMED_CURVE));
|
1703
|
+
#if defined(OPENSSL_EC_EXPLICIT_CURVE)
|
1704
|
+
rb_define_const(cEC, "EXPLICIT_CURVE", INT2NUM(OPENSSL_EC_EXPLICIT_CURVE));
|
1705
|
+
#endif
|
1706
|
+
|
1707
|
+
rb_define_singleton_method(cEC, "builtin_curves", ossl_s_builtin_curves, 0);
|
1708
|
+
|
1709
|
+
rb_define_singleton_method(cEC, "generate", ossl_ec_key_s_generate, 1);
|
1710
|
+
rb_define_method(cEC, "initialize", ossl_ec_key_initialize, -1);
|
1711
|
+
rb_define_copy_func(cEC, ossl_ec_key_initialize_copy);
|
1712
|
+
/* copy/dup/cmp */
|
1713
|
+
|
1714
|
+
rb_define_method(cEC, "group", ossl_ec_key_get_group, 0);
|
1715
|
+
rb_define_method(cEC, "group=", ossl_ec_key_set_group, 1);
|
1716
|
+
rb_define_method(cEC, "private_key", ossl_ec_key_get_private_key, 0);
|
1717
|
+
rb_define_method(cEC, "private_key=", ossl_ec_key_set_private_key, 1);
|
1718
|
+
rb_define_method(cEC, "public_key", ossl_ec_key_get_public_key, 0);
|
1719
|
+
rb_define_method(cEC, "public_key=", ossl_ec_key_set_public_key, 1);
|
1720
|
+
rb_define_method(cEC, "private?", ossl_ec_key_is_private, 0);
|
1721
|
+
rb_define_method(cEC, "public?", ossl_ec_key_is_public, 0);
|
1722
|
+
rb_define_alias(cEC, "private_key?", "private?");
|
1723
|
+
rb_define_alias(cEC, "public_key?", "public?");
|
1724
|
+
/* rb_define_method(cEC, "", ossl_ec_key_get_, 0);
|
1725
|
+
rb_define_method(cEC, "=", ossl_ec_key_set_ 1);
|
1726
|
+
set/get enc_flags
|
1727
|
+
set/get _conv_from
|
1728
|
+
set/get asn1_flag (can use ruby to call self.group.asn1_flag)
|
1729
|
+
set/get precompute_mult
|
1730
|
+
*/
|
1731
|
+
rb_define_method(cEC, "generate_key!", ossl_ec_key_generate_key, 0);
|
1732
|
+
rb_define_alias(cEC, "generate_key", "generate_key!");
|
1733
|
+
rb_define_method(cEC, "check_key", ossl_ec_key_check_key, 0);
|
1734
|
+
|
1735
|
+
rb_define_method(cEC, "dh_compute_key", ossl_ec_key_dh_compute_key, 1);
|
1736
|
+
rb_define_method(cEC, "dsa_sign_asn1", ossl_ec_key_dsa_sign_asn1, 1);
|
1737
|
+
rb_define_method(cEC, "dsa_verify_asn1", ossl_ec_key_dsa_verify_asn1, 2);
|
1738
|
+
/* do_sign/do_verify */
|
1739
|
+
|
1740
|
+
rb_define_method(cEC, "export", ossl_ec_key_export, -1);
|
1741
|
+
rb_define_alias(cEC, "to_pem", "export");
|
1742
|
+
rb_define_method(cEC, "to_der", ossl_ec_key_to_der, 0);
|
1743
|
+
rb_define_method(cEC, "to_text", ossl_ec_key_to_text, 0);
|
1744
|
+
|
1745
|
+
|
1746
|
+
rb_define_alloc_func(cEC_GROUP, ossl_ec_group_alloc);
|
1747
|
+
rb_define_method(cEC_GROUP, "initialize", ossl_ec_group_initialize, -1);
|
1748
|
+
rb_define_copy_func(cEC_GROUP, ossl_ec_group_initialize_copy);
|
1749
|
+
rb_define_method(cEC_GROUP, "eql?", ossl_ec_group_eql, 1);
|
1750
|
+
rb_define_alias(cEC_GROUP, "==", "eql?");
|
1751
|
+
/* copy/dup/cmp */
|
1752
|
+
|
1753
|
+
rb_define_method(cEC_GROUP, "generator", ossl_ec_group_get_generator, 0);
|
1754
|
+
rb_define_method(cEC_GROUP, "set_generator", ossl_ec_group_set_generator, 3);
|
1755
|
+
rb_define_method(cEC_GROUP, "order", ossl_ec_group_get_order, 0);
|
1756
|
+
rb_define_method(cEC_GROUP, "cofactor", ossl_ec_group_get_cofactor, 0);
|
1757
|
+
|
1758
|
+
rb_define_method(cEC_GROUP, "curve_name", ossl_ec_group_get_curve_name, 0);
|
1759
|
+
/* rb_define_method(cEC_GROUP, "curve_name=", ossl_ec_group_set_curve_name, 1); */
|
1760
|
+
|
1761
|
+
rb_define_method(cEC_GROUP, "asn1_flag", ossl_ec_group_get_asn1_flag, 0);
|
1762
|
+
rb_define_method(cEC_GROUP, "asn1_flag=", ossl_ec_group_set_asn1_flag, 1);
|
1763
|
+
|
1764
|
+
rb_define_method(cEC_GROUP, "point_conversion_form", ossl_ec_group_get_point_conversion_form, 0);
|
1765
|
+
rb_define_method(cEC_GROUP, "point_conversion_form=", ossl_ec_group_set_point_conversion_form, 1);
|
1766
|
+
|
1767
|
+
rb_define_method(cEC_GROUP, "seed", ossl_ec_group_get_seed, 0);
|
1768
|
+
rb_define_method(cEC_GROUP, "seed=", ossl_ec_group_set_seed, 1);
|
1769
|
+
|
1770
|
+
/* get/set GFp, GF2m */
|
1771
|
+
|
1772
|
+
rb_define_method(cEC_GROUP, "degree", ossl_ec_group_get_degree, 0);
|
1773
|
+
|
1774
|
+
/* check* */
|
1775
|
+
|
1776
|
+
|
1777
|
+
rb_define_method(cEC_GROUP, "to_pem", ossl_ec_group_to_pem, 0);
|
1778
|
+
rb_define_method(cEC_GROUP, "to_der", ossl_ec_group_to_der, 0);
|
1779
|
+
rb_define_method(cEC_GROUP, "to_text", ossl_ec_group_to_text, 0);
|
1780
|
+
|
1781
|
+
|
1782
|
+
rb_define_alloc_func(cEC_POINT, ossl_ec_point_alloc);
|
1783
|
+
rb_define_method(cEC_POINT, "initialize", ossl_ec_point_initialize, -1);
|
1784
|
+
rb_define_copy_func(cEC_POINT, ossl_ec_point_initialize_copy);
|
1785
|
+
rb_attr(cEC_POINT, rb_intern("group"), 1, 0, 0);
|
1786
|
+
rb_define_method(cEC_POINT, "eql?", ossl_ec_point_eql, 1);
|
1787
|
+
rb_define_alias(cEC_POINT, "==", "eql?");
|
1788
|
+
|
1789
|
+
rb_define_method(cEC_POINT, "infinity?", ossl_ec_point_is_at_infinity, 0);
|
1790
|
+
rb_define_method(cEC_POINT, "on_curve?", ossl_ec_point_is_on_curve, 0);
|
1791
|
+
rb_define_method(cEC_POINT, "make_affine!", ossl_ec_point_make_affine, 0);
|
1792
|
+
rb_define_method(cEC_POINT, "invert!", ossl_ec_point_invert, 0);
|
1793
|
+
rb_define_method(cEC_POINT, "set_to_infinity!", ossl_ec_point_set_to_infinity, 0);
|
1794
|
+
/* all the other methods */
|
1795
|
+
|
1796
|
+
rb_define_method(cEC_POINT, "to_bn", ossl_ec_point_to_bn, 0);
|
1797
|
+
rb_define_method(cEC_POINT, "mul", ossl_ec_point_mul, -1);
|
1798
|
+
|
1799
|
+
id_i_group = rb_intern("@group");
|
1800
|
+
}
|
1801
|
+
|
1802
|
+
#else /* defined NO_EC */
|
1803
|
+
void Init_ossl_ec(void)
|
1804
|
+
{
|
1805
|
+
}
|
1806
|
+
#endif /* NO_EC */
|