%define _unpackaged_files_terminate_build 0
Name: wifi-efl-ug
Summary: Wi-Fi UI Gadget for TIZEN
-Version: 1.0.177
+Version: 1.0.178
Release: 1
Group: App/Network
License: Flora-1.1
%defattr(-,root,root,-)
%attr(-,inhouse,inhouse)
%{PREFIX}/apps/org.tizen.w-wifi/bin/*
-#%{PREFIX}/res/images/*.png
+%{PREFIX}/apps/org.tizen.w-wifi/res/images/*.png
%{PREFIX}/apps/org.tizen.w-wifi/res/locale/*/LC_MESSAGES/*.mo
%{PREFIX}/apps/org.tizen.w-wifi/res/edje/*
%{_datadir}/packages/org.tizen.w-wifi.xml
SET(SRCS ${SRCS}
src/net/wifi_manager.c
+ src/net/wifi_generate_pin.c
src/net/util/wifi_address.c
src/util/idler.c)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/inc)
--- /dev/null
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __WIFI_GENERATE_PIN_H__
+#define __WIFI_GENERATE_PIN_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <stdint.h>
+
+typedef uint8_t u8;
+typedef uint32_t u32;
+
+struct SHA1Context {
+ u32 state[5];
+ u32 count[2];
+ unsigned char buffer[64];
+};
+
+unsigned int wifi_generate_pin(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
#define TABLE_COLOR_FILE "color_table.xml"
#define TABLE_FONT_FILE "font_table.xml"
-#define EDJ_PATH "/edje"
+#define EDJ_PATH "edje"
#define EDJ_FILE "wifi.edj"
-#define IMAGE_PATH "/images"
+#define IMAGE_PATH "images"
gboolean get_color_table_path(gchar *table_path, gsize table_path_length);
gboolean get_font_table_path(gchar *table_path, gsize table_path_length);
+++ /dev/null
-/*
- * Copyright (c) 2000-2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * PROPRIETARY/CONFIDENTIAL
- *
- * This software is the confidential and proprietary information of
- * SAMSUNG ELECTRONICS ("Confidential Information").
- * You shall not disclose such Confidential Information and shall
- * use it only in accordance with the terms of the license agreement
- * you entered into with SAMSUNG ELECTRONICS.
- * SAMSUNG make no representations or warranties about the suitability
- * of the software, either express or implied, including but not
- * limited to the implied warranties of merchantability, fitness for
- * a particular purpose, or non-infringement.
- * SAMSUNG shall not be liable for any damages suffered by licensee as
- * a result of using, modifying or distributing this software or its derivatives.
-
- */
-
-#define MAIN_H 320
-#define MAIN_W 320
-
-#define LOGS_DEFAULT_COLOR_TRANSPARENCY 0 0 0 0
-#define LOGS_DEFAULT_COLOR_BLACK 0 0 0
-
-#define POPUP_ENTRY_H 66
-#define POPUP_PADDING_H 32
-#define POPUP_ENTRY_HIDDEN_AP_MIN 0 325
-
-collections {
- base_scale: 1.4;
- styles {
- style { name: "textblock_popup_body";
- base: "font=Tizen:style=Regular font_size=28 color=#CCCCCC color_class=T092 wrap=mixed align=center ellipsis=1.0 text_class=T092";
- tag: "br" "\n";
- }
- style { name: "textblock_popup_body_wps";
- base: "font=Tizen:style=Regular font_size=28 color=#CCCCCC color_class=T092 wrap=mixed align=center text_class=T092";
- tag: "br" "\n";
- }
- }
- group {
- name: "bottom_button_layout";
- parts {
- part {
- name: "bottom_padding";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 64;
- max: -1 64;
- rel1.relative: 0.0 1.0;
- rel2.relative: 1.0 1.0;
- fixed: 0 1;
- align: 0.5 1.0;
- }
- }
- part {
- name: "elm.swallow.content";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- rel2 {
- to: "bottom_padding";
- relative: 1.0 0.0;
- }
- }
- }
- part {
- name: "elm.swallow.button";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- rel1.relative: 0.0 1.0;
- rel2.relative: 1.0 1.0;
- fixed: 0 1;
- align: 0.5 1.0;
- }
- }
- }
- }
- group {
- name: "ap_signal_image_layout";
- parts {
- part {
- name: "spacer.base";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 54 54;
- max: 54 54;
- }
- }
- part {
- name: "elm.image.signal";
- type: SWALLOW;
- scale : 1;
- description {
- state: "default" 0.0;
- }
- }
- part {
- name: "elm.image.lock";
- type: SWALLOW;
- scale : 1;
- description {
- state: "default" 0.0;
- }
- }
- }
- }
- group {
- name: "popup_body_button";
- parts {
- part {
- name: "bottom_padding";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 12;
- max: -1 12;
- rel1.relative: 0.0 1.0;
- rel2.relative: 1.0 1.0;
- fixed: 0 1;
- align: 0.5 1.0;
- }
- }
- part {
- name: "elm.text.content";
- type: TEXTBLOCK;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 200;
- max: -1 200;
- rel2 {
- to: "elm.swallow.button";
- relative: 1.0 0.0;
- }
- text {
- style: "textblock_popup_body";
- min: 0 1;
- }
- }
- }
- part {
- name: "elm.swallow.button";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- rel1 {
- to: "bottom_padding";
- relative: 0.0 0.0;
- }
- rel2 {
- to: "bottom_padding";
- relative: 1.0 0.0;
- }
- fixed: 0 1;
- align: 0.5 1.0;
- }
- }
- }
- }
- group {
- name: "wps_progress_layout";
- parts {
- part {
- name: "elm.swallow.content";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 0;
- max: 214 -1;
- }
- }
- }
- }
- group {
- name: "progressbar_layout";
- parts {
- part {
- name: "elm.swallow.content";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 0;
- max: 214 -1;
- }
- }
- }
- }
- group {
- name: "psk_style";
- parts {
- part {
- name: "base";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 0;
- fixed: 1 0;
- }
- }
- part {
- name: "elm.swallow.genlist";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 0;
- fixed: 0 1;
- rel1.to: "base";
- rel2.to: "base";
- }
- }
- }
- }
- group {
- name: "entry_layout";
- parts {
- part {
- name: "top_padding";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 48;
- max: -1 48;
- rel1.relative: 0.0 0.0;
- rel2.relative: 1.0 0.0;
- fixed: 0 1;
- align: 0.5 0.0;
- }
- }
- part {
- name: "left_padding";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 6 0;
- max: 6 -1;
- rel1.relative: 0.0 0.0;
- rel2.relative: 0.0 1.0;
- fixed: 1 0;
- align: 0.0 0.5;
- }
- }
- part {
- name: "right_padding";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 6 0;
- max: 6 -1;
- rel1.relative: 1.0 0.0;
- rel2.relative: 1.0 1.0;
- fixed: 1 0;
- align: 1.0 0.5;
- }
- }
- part {
- name: "elm.swallow.content";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 204 40;
- max: 204 40;
- fixed: 1 1;
- align: 0.5 0.0;
- rel1 {
- to_x: "left_padding";
- to_y: "top_padding";
- relative: 1.0 1.0;
- }
- rel2 {
- to_x: "right_padding";
- relative: 0.0 1.0;
- }
- }
- }
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2000-2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * PROPRIETARY/CONFIDENTIAL
- *
- * This software is the confidential and proprietary information of
- * SAMSUNG ELECTRONICS ("Confidential Information").
- * You shall not disclose such Confidential Information and shall
- * use it only in accordance with the terms of the license agreement
- * you entered into with SAMSUNG ELECTRONICS.
- * SAMSUNG make no representations or warranties about the suitability
- * of the software, either express or implied, including but not
- * limited to the implied warranties of merchantability, fitness for
- * a particular purpose, or non-infringement.
- * SAMSUNG shall not be liable for any damages suffered by licensee as
- * a result of using, modifying or distributing this software or its derivatives.
-
- */
-
-#define MAIN_H 320
-#define MAIN_W 320
-
-#define LOGS_DEFAULT_COLOR_TRANSPARENCY 0 0 0 0
-#define LOGS_DEFAULT_COLOR_BLACK 0 0 0
-
-#define POPUP_ENTRY_H 66
-#define POPUP_PADDING_H 32
-#define POPUP_ENTRY_HIDDEN_AP_MIN 0 325
-
-collections {
- base_scale: 1.3;
- plugins {
- plugin {
- name: "touch_sound";
- source: "feedback";
- param: "FEEDBACK_TYPE_SOUND FEEDBACK_PATTERN_TAP";
- }
- }
- styles {
- style {
- name: "textblock_popup_title";
- base: "font=Tizen:style=Bold font_size=33 align=center color=#FFFFFF color_class=T091 text_class=tizen wrap=mixed";
- }
- style { name: "textblock_popup_body";
- base: "font=Tizen:style=Regular font_size=32 color=#CCCCCC color_class=T092 wrap=mixed align=center ellipsis=1.0 text_class=T092";
- tag: "br" "\n";
- }
- style { name: "textblock_popup_body_wps";
- base: "font=Tizen:style=Regular font_size=32 color=#CCCCCC color_class=T092 wrap=mixed align=center text_class=T092";
- tag: "br" "\n";
- }
- style { name: "check_text_in_password_layout";
- base: "font=Tizen:style=Regular font_size=37 align=left color=#FFFFFF color_class=AT014 text_class=AT014";
- }
- }
- group {
- name: "bottom_button_layout";
- parts {
- part {
- name: "bottom_padding";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 64;
- max: -1 64;
- rel1.relative: 0.0 1.0;
- rel2.relative: 1.0 1.0;
- fixed: 0 1;
- align: 0.5 1.0;
- }
- }
- part {
- name: "elm.swallow.content";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- rel2 {
- to: "bottom_padding";
- relative: 1.0 0.0;
- }
- }
- }
- part {
- name: "elm.swallow.button";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- rel1.relative: 0.0 1.0;
- rel2.relative: 1.0 1.0;
- fixed: 0 1;
- align: 0.5 1.0;
- }
- }
- }
- }
- group {
- name: "ap_signal_image_layout";
- parts {
- part {
- name: "spacer.base";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 76 76;
- max: 76 76;
- }
- }
- part {
- name: "elm.image.signal";
- type: SWALLOW;
- scale : 1;
- description {
- state: "default" 0.0;
- }
- }
- part {
- name: "elm.image.lock";
- type: SWALLOW;
- scale : 1;
- description {
- state: "default" 0.0;
- }
- }
- }
- }
- group {
- name: "popup_body_button";
- parts {
- part { name: "base";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- min: 360 0;
- }
- }
- part { name: "top_left_pad";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- min: 68 76;
- rel1.to: "base";
- rel2 {
- to: "base";
- relative: 0.0 0.0;
- }
- align: 0.0 0.0;
- fixed: 1 1;
- }
- }
- part { name: "bottom_right_pad";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- min: 68 42;
- rel1 {
- to: "base";
- relative: 1.0 1.0;
- }
- rel2.to: "base";
- align: 1.0 1.0;
- fixed: 1 1;
- }
- }
- part { name: "elm.text.content";
- type: TEXTBLOCK;
- scale: 1;
- description { state: "default" 0.0;
- max: -1 3703; // 4000(max height) - (76 + 42 + 19 + 160)
- rel1 {
- to: "top_left_pad";
- relative: 1.0 1.0;
- }
- rel2 {
- to_x: "bottom_right_pad";
- to_y: "top_left_pad";
- relative: 0.0 1.0;
- }
- align: 0.5 0.0;
- fixed: 0 1;
- text {
- style: "textblock_popup_body";
- min: 0 1;
- }
- }
- }
- part { name: "text_bottom_pad";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- min: 0 19;
- rel1 {
- to: "elm.text.content";
- relative: 0.0 1.0;
- }
- rel2.to: "elm.text.content";
- align: 0.5 0.0;
- fixed: 0 1;
- }
- }
- part { name: "elm.swallow.button";
- type: SWALLOW;
- scale: 1;
- description { state: "default" 0.0;
- min: 160 160;
- max: 160 160;
- rel1 {
- to: "text_bottom_pad";
- relative: 0.0 1.0;
- }
- rel2 {
- to: "bottom_right_pad";
- relative: 0.0 0.0;
- }
- }
- }
- }
- }
- group {
- name: "wps_text_block_layout";
- parts {
- part {
- name: "elm.text.content";
- type: TEXTBLOCK;
- description {
- state: "default" 0.0;
- min: 260 200;
- text {
- style: "textblock_popup_body_wps";
- min: 0 1;
- }
- }
- }
- }
- }
- group {
- name: "wps_progress_layout";
- parts {
- part {
- name: "elm.swallow.content";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 360 360;
- max: 360 360;
- }
- }
- part {
- name: "elm.swallow.progressbar";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 360 360;
- max: 360 360;
- }
- }
- }
- }
- group {
- name: "wps_progress_popup_layout";
- parts {
- images {
- image: "wifi_percent_bg.png" COMP;
- }
- part {
- name: "base";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 360 360;
- max: 360 360;
- }
- }
- part {
- name: "top_padding";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 15;
- fixed: 0 1;
- rel1 {
- to: "base";
- relative: 0.0 0.0;
- }
- rel2 {
- to: "base";
- relative: 1.0 0.0;
- }
- }
- }
- part {
- name: "elm.swallow.percent_label";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 32;
- fixed: 0 1;
- align: 0.5 0.0;
- rel1 {
- to: "top_padding";
- relative: 0.0 1.0;
- }
- rel2 {
- to: "top_padding";
- relative: 1.0 1.0;
- }
- }
- }
- part {
- name: "elm.image";
- type: IMAGE;
- scale : 1;
- description {
- color_class: AO017;
- state: "default" 0.0;
- min: 0 50;
- fixed : 1 1;
- align: 0.0 0.0;
- visible: 1;
- image.normal: "wifi_percent_bg.png";
- rel1 {
- to: "base";
- relative: 0.0 0.0;
- }
- rel2 {
- to: "base";
- relative: 1.0 0.0;
- }
- }
- }
- part {
- name: "left_padding";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 50 0;
- fixed: 1 0;
- align: 0.0 0.0;
- rel1 {
- to: "base";
- relative: 0.0 0.0;
- }
- rel2 {
- to: "base";
- relative: 0.0 1.0;
- }
- }
- }
- part {
- name: "right_padding";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 50 0;
- fixed: 1 0;
- align: 1.0 0.0;
- rel1 {
- to: "base";
- relative: 1.0 0.0;
- }
- rel2 {
- to: "base";
- relative: 1.0 1.0;
- }
- }
- }
- part {
- name: "middle_padding";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 0;
- fixed: 0 1;
- align: 0.0 0.0;
- rel1 {
- relative: 1.0 1.0;
- to_x: "left_padding";
- to_y: "elm.image";
- }
- rel2 {
- relative: 0.0 1.0;
- to_x: "right_padding";
- to_y: "elm.image";
- }
- }
- }
- part {
- name: "elm.swallow.label";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 260 50;
- fixed: 0 0;
- align: 0.0 0.0;
- rel1 {
- relative: 1.0 1.0;
- to_x:"left_padding";
- to_y: "middle_padding";
- }
- rel2 {
- relative: 0.0 1.0;
- to_x: "right_padding";
- to_y: "base";
- }
- }
- }
- }
- }
- group {
- name: "progressbar_layout";
- parts {
- part {
- name: "base";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 360 360;
- fixed: 1 0;
- }
- }
- part {
- name: "top_padding";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 108;
- fixed: 0 1;
- align: 0.0 0.0;
- rel1 {
- to: "left_padding";
- relative: 1.0 0.0;
- }
- rel2 {
- to: "right_padding";
- relative: 0.0 0.0;
- }
- }
- }
- part {
- name: "left_padding";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 30 0;
- fixed: 1 0;
- align: 0.0 0.0;
- rel1 {
- to: "base";
- relative: 0.0 0.0;
- }
- rel2 {
- to: "base";
- relative: 0.0 1.0;
- }
- }
- }
- part {
- name: "right_padding";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 30 0;
- fixed: 1 0;
- align: 1.0 0.0;
- rel1 {
- to: "base";
- relative: 1.0 0.0;
- }
- rel2 {
- to: "base";
- relative: 1.0 1.0;
- }
- }
- }
- part {
- name: "content_bg";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 86 86;
- max: 86 86;
- fixed: 1 1;
- align: 0.5 0.0;
- rel1 {
- relative: 0.0 1.0;
- to: "top_padding";
- }
- rel2 {
- relative: 1.0 1.0;
- to: "top_padding";
- }
- }
- }
- part {
- name: "elm.swallow.content";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 86 86;
- fixed: 1 1;
- align: 0.5 0.5;
- rel1.to: "content_bg";
- rel2.to: "content_bg";
- }
- }
- part {
- name: "middle_padding";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 16;
- fixed: 0 1;
- align: 0.5 0.0;
- rel1 {
- relative: 0.0 1.0;
- to: "content_bg";
- }
- rel2 {
- relative: 1.0 1.0;
- to: "content_bg";
- }
- }
- part {
- name: "elm.text.progressbar";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- fixed: 1 1;
- align: 0.5 0.0;
- rel1 {
- relative: 1.0 1.0;
- to_x: "left_padding";
- to_y: "middle_padding";
- }
- rel2 {
- relative: 0.0 1.0;
- to_x: "right_padding";
- to_y: "middle_padding";
- }
- }
- }
- }
- }
-}
- group {
- name: "psk_style";
- parts {
- part {
- name: "base";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 0;
- fixed: 1 0;
- }
- }
- part {
- name: "elm.swallow.genlist";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 0;
- fixed: 0 1;
- rel1.to: "base";
- rel2.to: "base";
- }
- }
- }
- }
- group {
- name: "password_layout";
- parts {
- images {
- image: "b_list_edit_field_bg.png" COMP;
- }
- part {
- name: "base";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 360 0;
- }
- }
- part {
- name: "left_padding";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 36 0;
- fixed: 1 0;
- align: 0.0 0.0;
- rel1 {
- to: "base";
- relative: 0.0 0.0;
- }
- rel2 {
- to: "base";
- relative: 0.0 1.0;
- }
- }
- }
- part {
- name: "right_padding";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 36 0;
- fixed: 1 0;
- align: 1.0 0.0;
- rel1 {
- to: "base";
- relative: 1.0 0.0;
- }
- rel2 {
- to: "base";
- relative: 1.0 1.0;
- }
- }
- }
- part {
- name: "top_padding";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 55;
- fixed: 0 1;
- align: 0.0 0.0;
- rel1 {
- relative: 1.0 0.0;
- to_x: "left_padding";
- }
- rel2 {
- relative: 0.0 0.0;
- to_x: "right_padding";
- }
- }
- }
- part {
- name: "elm.text.title";
- type: TEXTBLOCK;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 44;
- align: 0.0 0.0;
- fixed: 0 1;
- rel1 {
- relative: 1.0 1.0;
- to_x: "left_padding";
- to_y: "top_padding";
- }
- rel2 {
- relative: 0.0 1.0;
- to_x: "right_padding";
- to_y: "top_padding";
- }
- text {
- style: "textblock_popup_title";
- min: 0 1;
- }
- }
- }
- part {
- name: "elm.access.title";
- type: RECT;
- repeat_events: 1;
- description {
- state: "default" 0.0;
- fixed: 1 1;
- rel1 { relative: 0.0 0.0; to: "elm.text.title"; }
- rel2 { relative: 1.0 1.0; to: "elm.text.title"; }
- color: 0 0 0 0;
- }
- }
- part {
- name: "middle_padding0";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 29;
- fixed: 0 1;
- align: 0.0 0.0;
- rel1 {
- relative: 0.0 1.0;
- to: "elm.text.title";
- }
- rel2 {
- relative: 1.0 1.0;
- to: "elm.text.title";
- }
- }
- }
- part {
- name: "magic_spacer";
- type: SPACER;
- scale : 1;
- description {
- state: "default" 0.0;
- min: 36 62;
- fixed: 1 1;
- align: 0.0 0.0;
- rel1 {
- relative: 1.0 1.0;
- to_x: "left_padding";
- to_y: "middle_padding0";
- }
- rel2 {
- relative: 1.0 1.0;
- to_x: "left_padding";
- to_y: "middle_padding0";
- }
- }
- }
- part {
- name: "right_magic_spacer";
- type: SPACER;
- scale : 1;
- description {
- state: "default" 0.0;
- min: 36 62;
- fixed: 1 1;
- align: 1.0 0.0;
- rel1 {
- to_x: "right_padding";
- to_y: "middle_padding0";
- relative: 0.0 1.0;
- }
- rel2 {
- to_x: "right_padding";
- to_y: "middle_padding0";
- relative: 0.0 1.0;
- }
- }
- }
- part {
- name: "entry_spacer";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 62;
- fixed: 1 1;
- align: 0.0 0.0;
- rel1 {
- relative: 1.0 1.0;
- to_x:"magic_spacer";
- to_y:"middle_padding0";
- }
- rel2 {
- relative: 0.0 1.0;
- to_x:"right_magic_spacer";
- to_y:"middle_padding0";
- }
- }
- }
- part {
- name: "elm.image.entry";
- type: IMAGE;
- scale : 1;
- description {
- color_class: B02112;
- state: "default" 0.0;
- min: 0 62;
- fixed : 1 1;
- align: 0.0 0.0;
- visible: 1;
- image.normal: "b_list_edit_field_bg.png";
- image.border: 36 36 0 0;
- rel1 {
- relative: 1.0 1.0;
- to_x:"left_padding";
- to_y:"middle_padding0";
- }
- rel2 {
- relative: 0.0 1.0;
- to_x:"right_padding";
- to_y:"middle_padding0";
- }
- }
- }
- part {
- name: "elm.swallow.entry";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 62;
- fixed: 1 1;
- align: 0.0 0.0;
- rel1.to: "entry_spacer";
- rel2.to: "entry_spacer";
- }
- }
- part {
- name: "middle_spacer";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 16;
- fixed: 0 1;
- align: 0.0 0.0;
- rel1 {
- relative: 0.0 1.0;
- to_x: base;
- to_y: entry_spacer;
- }
- rel2 {
- relative: 1.0 1.0;
- to_x: base;
- to_y: entry_spacer;
- }
- }
- }
- part {
- name: "check.left.padding";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- // (left_padding(20) + check_size(34) + check_spacer(7)) 0
- min: 61 0;
- // (left_padding(20) + check_size(34) + check_spacer(7)) -1
- max: 61 -1;
- fixed: 1 0;
- align: 0 0;
- rel1 {
- relative: 0.0 1.0;
- to_x: base;
- to_y: middle_spacer;
- }
- rel2 {
- relative: 0.0 1.0;
- to_x: base;
- to_y: middle_spacer;
- }
- }
- }
- part {
- name: "check.right.padding";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 20 0; // right_padding(20) 0
- max: 20 -1; // right_padding(20) -1
- fixed: 1 0;
- align: 1 0;
- rel1 {
- relative: 1.0 1.0;
- to_x: base;
- to_y: middle_spacer;
- }
- rel2 {
- relative: 1.0 1.0;
- to_x: base;
- to_y: middle_spacer;
- }
- }
- }
- part {
- name: "elm.text.check";
- type: TEXTBLOCK;
- scale: 1;
- description {
- state: "default" 0.0;
- align: 0.5 0;
- rel1 {
- relative: 1.0 0.0;
- to : "check.left.padding";
- }
- rel2 {
- relative: 0.0 1.0;
- to : "check.right.padding";
- }
- text {
- style: "check_text_in_password_layout";
- min: 0 1;
- max: 1 1;
- ellipsis: -1.0;
- fade_ellipsis: 1.0;
- }
- }
- }
- part {
- name: "elm.spacer.check";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 7 0;
- fixed: 1 0;
- align: 1 0;
- rel1 {
- relative: 0.0 0.0;
- to : "elm.text.check";
- }
- rel2 {
- relative: 0.0 1.0;
- to : "elm.text.check";
- }
- }
- }
- part {
- name: "elm.swallow.check";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- align: 1 0.5;
- rel1 {
- relative: 0.0 0.0;
- to : "elm.spacer.check";
- }
- rel2 {
- relative: 0.0 1.0;
- to : "elm.spacer.check";
- }
- }
- }
- part {
- name: "elm.access.check";
- type: RECT;
- repeat_events: 1;
- description {
- state: "default" 0.0;
- fixed: 1 1;
- rel1 { relative: 0.0 0.0; to: "elm.swallow.check"; }
- rel2 { relative: 1.0 1.0; to: "elm.text.check"; }
- color: 0 0 0 0;
- }
- }
- }
- programs {
- program {
- name: "clicked";
- signal: "mouse,clicked,1";
- source: "elm.text.check";
- script {
- run_program(PROGRAM:"play_touch_sound");
- emit("clicked", "");
- }
- }
- program {
- name: "play_touch_sound";
- action: RUN_PLUGIN "touch_sound";
- }
- }
- }
- group {
- name: "entry_layout";
- parts {
- part {
- name: "base";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 360 0;
- }
- }
- part {
- name: "padding_top";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 27;
- fixed: 0 1;
- align: 0.0 0.0;
- rel1 {
- to_x: "padding_left";
- relative: 1.0 0.0;
- }
- rel2 {
- to_x: "padding_right";
- relative: 0.0 0.0;
- }
- }
- description {
- state: "prediction_off" 0.0;
- min: 0 44;
- fixed: 0 1;
- align: 0.0 0.0;
- rel1 {
- to_x: "padding_left";
- relative: 1.0 0.0;
- }
- rel2 {
- to_x: "padding_right";
- relative: 0.0 0.0;
- }
- }
- }
- part {
- name: "padding_left";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 78 0;
- fixed: 1 0;
- align: 0.0 0.0;
- rel1 {
- to: "base";
- relative: 0.0 0.0;
- }
- rel2 {
- to: "base";
- relative: 0.0 1.0;
- }
- }
- }
- part {
- name: "padding_right";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 78 0;
- fixed: 1 0;
- align: 1.0 0.0;
- rel1 {
- to: "base";
- relative: 1.0 0.0;
- }
- rel2 {
- to: "base";
- relative: 1.0 1.0;
- }
- }
- }
- part {
- name: "content_bg";
- type: SPACER;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 45;
- fixed: 0 1;
- align: 0.0 0.0;
- rel1 {
- to_x: "padding_left";
- to_y: "padding_top";
- relative: 1.0 1.0;
- }
- rel2 {
- to_x: "padding_right";
- to_y: "padding_top";
- relative: 0.0 1.0;
- }
- }
- }
- part {
- name: "elm.swallow.content";
- type: SWALLOW;
- scale: 1;
- description {
- state: "default" 0.0;
- min: 0 45;
- fixed: 1 1;
- align: 0.0 0.0;
- rel1.to: "content_bg";
- rel2.to: "content_bg";
- }
- }
- }
-
- programs {
- program {
- name: "prediction_on";
- signal: "prediction,on,layout";
- source: "";
- action: STATE_SET "default" 0.0;
- target: "padding_top";
- }
- program {
- name: "prediction_off";
- signal: "prediction,off,layout";
- source: "";
- action: STATE_SET "prediction_off" 0.0;
- target: "padding_top";
- }
- }
- }
-}
--- /dev/null
+/*
+ * Wi-Fi
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/time.h>
+
+#include "util.h"
+#include "net/wifi_generate_pin.h"
+
+#define POOL_WORDS 32
+#define POOL_WORDS_MASK (POOL_WORDS - 1)
+#define POOL_TAP1 26
+#define POOL_TAP2 20
+#define POOL_TAP3 14
+#define POOL_TAP4 7
+#define POOL_TAP5 1
+#define EXTRACT_LEN 16
+#define SHA1_MAC_LEN 20
+#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
+
+typedef struct SHA1Context SHA1_CTX;
+
+struct os_time {
+ long sec;
+ long usec;
+};
+
+static u32 pool[POOL_WORDS];
+static unsigned int input_rotate = 0;
+static unsigned int pool_pos = 0;
+static u8 dummy_key[20];
+static unsigned int entropy = 0;
+
+#define blk0(i) block->l[i]
+#define blk(i) (block->l[i & 15] = rol(block->l[(i + 13) & 15] ^ \
+ block->l[(i + 8) & 15] ^ block->l[(i + 2) & 15] ^ block->l[i & 15], 1))
+
+/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
+#define R0(v,w,x,y,z,i) \
+ z += ((w & (x ^ y)) ^ y) + blk0(i) + 0x5A827999 + rol(v, 5); \
+ w = rol(w, 30);
+#define R1(v,w,x,y,z,i) \
+ z += ((w & (x ^ y)) ^ y) + blk(i) + 0x5A827999 + rol(v, 5); \
+ w = rol(w, 30);
+#define R2(v,w,x,y,z,i) \
+ z += (w ^ x ^ y) + blk(i) + 0x6ED9EBA1 + rol(v, 5); w = rol(w, 30);
+#define R3(v,w,x,y,z,i) \
+ z += (((w | x) & y) | (w & x)) + blk(i) + 0x8F1BBCDC + rol(v, 5); \
+ w = rol(w, 30);
+#define R4(v,w,x,y,z,i) \
+ z += (w ^ x ^ y) + blk(i) + 0xCA62C1D6 + rol(v, 5); \
+ w=rol(w, 30);
+
+static void SHA1Init(SHA1_CTX* context)
+{
+ /* SHA1 initialization constants */
+ context->state[0] = 0x67452301;
+ context->state[1] = 0xEFCDAB89;
+ context->state[2] = 0x98BADCFE;
+ context->state[3] = 0x10325476;
+ context->state[4] = 0xC3D2E1F0;
+ context->count[0] = context->count[1] = 0;
+}
+
+static void SHA1Transform(u32 state[5], const unsigned char buffer[64])
+{
+ u32 a, b, c, d, e;
+ typedef union {
+ unsigned char c[64];
+ u32 l[16];
+ } CHAR64LONG16;
+ CHAR64LONG16* block;
+ CHAR64LONG16 workspace;
+ block = &workspace;
+ memcpy(block, buffer, 64);
+
+ /* Copy context->state[] to working vars */
+ a = state[0];
+ b = state[1];
+ c = state[2];
+ d = state[3];
+ e = state[4];
+ /* 4 rounds of 20 operations each. Loop unrolled. */
+ R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
+ R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
+ R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
+ R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
+ R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
+ R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
+ R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
+ R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
+ R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
+ R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
+ R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
+ R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
+ R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
+ R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
+ R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
+ R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
+ R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
+ R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
+ R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
+ R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
+ /* Add the working vars back into context.state[] */
+ state[0] += a;
+ state[1] += b;
+ state[2] += c;
+ state[3] += d;
+ state[4] += e;
+ /* Wipe variables */
+ a = b = c = d = e = 0;
+
+ memset(block, 0, 64);
+}
+
+static void SHA1Update(SHA1_CTX* context, const void *_data, u32 len)
+{
+ u32 i, j;
+ const unsigned char *data = _data;
+
+ j = (context->count[0] >> 3) & 63;
+ if ((context->count[0] += len << 3) < (len << 3)) {
+ context->count[1]++;
+ }
+
+ context->count[1] += (len >> 29);
+ if ((j + len) > 63) {
+ memcpy(&context->buffer[j], data, (i = 64-j));
+ SHA1Transform(context->state, context->buffer);
+ for ( ; i + 63 < len; i += 64) {
+ SHA1Transform(context->state, &data[i]);
+ }
+ j = 0;
+ } else {
+ i = 0;
+ }
+
+ memcpy(&context->buffer[j], &data[i], len - i);
+}
+
+static void SHA1Final(unsigned char digest[20], SHA1_CTX* context)
+{
+ u32 i;
+ unsigned char finalcount[8];
+
+ for (i = 0; i < 8; i++) {
+ finalcount[i] = (unsigned char)
+ ((context->count[(i >= 4 ? 0 : 1)] >>
+ ((3-(i & 3)) * 8) ) & 255); /* Endian independent */
+ }
+ SHA1Update(context, (unsigned char *) "\200", 1);
+ while ((context->count[0] & 504) != 448) {
+ SHA1Update(context, (unsigned char *) "\0", 1);
+ }
+ SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform()
+ */
+ for (i = 0; i < 20; i++) {
+ digest[i] = (unsigned char)
+ ((context->state[i >> 2] >> ((3 - (i & 3)) * 8)) &
+ 255);
+ }
+ /* Wipe variables */
+ i = 0;
+ memset(context->buffer, 0, 64);
+ memset(context->state, 0, 20);
+ memset(context->count, 0, 8);
+ memset(finalcount, 0, 8);
+}
+
+/**
+ * sha1_vector - SHA-1 hash for data vector
+ * @num_elem: Number of elements in the data vector
+ * @addr: Pointers to the data areas
+ * @len: Lengths of the data blocks
+ * @mac: Buffer for the hash
+ * Returns: 0 on success, -1 of failure
+ */
+static int sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
+{
+ SHA1_CTX ctx;
+ size_t i;
+
+ SHA1Init(&ctx);
+ for (i = 0; i < num_elem; i++) {
+ SHA1Update(&ctx, addr[i], len[i]);
+ }
+ SHA1Final(mac, &ctx);
+ return 0;
+}
+
+/**
+ * hmac_sha1_vector - HMAC-SHA1 over data vector (RFC 2104)
+ * @key: Key for HMAC operations
+ * @key_len: Length of the key in bytes
+ * @num_elem: Number of elements in the data vector
+ * @addr: Pointers to the data areas
+ * @len: Lengths of the data blocks
+ * @mac: Buffer for the hash (20 bytes)
+ * Returns: 0 on success, -1 on failure
+ */
+static int hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem,
+ const u8 *addr[], const size_t *len, u8 *mac)
+{
+ unsigned char k_pad[64]; /* padding - key XORd with ipad/opad */
+ unsigned char tk[20];
+ const u8 *_addr[6];
+ size_t _len[6], i;
+
+ if (num_elem > 5) {
+ /*
+ * Fixed limit on the number of fragments to avoid having to
+ * allocate memory (which could fail).
+ */
+ return -1;
+ }
+
+ /* if key is longer than 64 bytes reset it to key = SHA1(key) */
+ if (key_len > 64) {
+ if (sha1_vector(1, &key, &key_len, tk)) {
+ return -1;
+ }
+ key = tk;
+ key_len = 20;
+ }
+
+ /* the HMAC_SHA1 transform looks like:
+ *
+ * SHA1(K XOR opad, SHA1(K XOR ipad, text))
+ *
+ * where K is an n byte key
+ * ipad is the byte 0x36 repeated 64 times
+ * opad is the byte 0x5c repeated 64 times
+ * and text is the data being protected */
+
+ /* start out by storing key in ipad */
+ memset(k_pad, 0, sizeof(k_pad));
+ memcpy(k_pad, key, key_len);
+ /* XOR key with ipad values */
+ for (i = 0; i < 64; i++) {
+ k_pad[i] ^= 0x36;
+ }
+
+ /* perform inner SHA1 */
+ _addr[0] = k_pad;
+ _len[0] = 64;
+ for (i = 0; i < num_elem; i++) {
+ _addr[i + 1] = addr[i];
+ _len[i + 1] = len[i];
+ }
+ if (sha1_vector(1 + num_elem, _addr, _len, mac)) {
+ return -1;
+ }
+
+ memset(k_pad, 0, sizeof(k_pad));
+ memcpy(k_pad, key, key_len);
+ /* XOR key with opad values */
+ for (i = 0; i < 64; i++) {
+ k_pad[i] ^= 0x5c;
+ }
+
+ /* perform outer SHA1 */
+ _addr[0] = k_pad;
+ _len[0] = 64;
+ _addr[1] = mac;
+ _len[1] = SHA1_MAC_LEN;
+ return sha1_vector(2, _addr, _len, mac);
+}
+
+/**
+ * hmac_sha1 - HMAC-SHA1 over data buffer (RFC 2104)
+ * @key: Key for HMAC operations
+ * @key_len: Length of the key in bytes
+ * @data: Pointers to the data area
+ * @data_len: Length of the data area
+ * @mac: Buffer for the hash (20 bytes)
+ * Returns: 0 on success, -1 of failure
+ */
+static int hmac_sha1(const u8 *key, size_t key_len, const u8 *data, size_t data_len,
+ u8 *mac)
+{
+ return hmac_sha1_vector(key, key_len, 1, &data, &data_len, mac);
+}
+
+static int os_get_time(struct os_time *t)
+{
+ int res;
+ struct timeval tv;
+ res = gettimeofday(&tv, NULL);
+ t->sec = tv.tv_sec;
+ t->usec = tv.tv_usec;
+ return res;
+}
+
+static unsigned long os_random(void)
+{
+ return random();
+}
+
+static int os_get_random(unsigned char *buf, size_t len)
+{
+ FILE *f;
+ size_t rc;
+
+ f = fopen("/dev/urandom", "rb");
+ if (f == NULL) {
+ WIFI_LOG_ERR("Could not open /dev/urandom");
+ return -1;
+ }
+
+ rc = fread(buf, 1, len, f);
+ fclose(f);
+
+ return rc != len ? -1 : 0;
+}
+
+static u32 __ROL32(u32 x, u32 y)
+{
+ return (x << (y & 31)) | (x >> (32 - (y & 31)));
+}
+
+static void random_mix_pool(const void *buf, size_t len)
+{
+ static const u32 twist[8] = {
+ 0x00000000, 0x3b6e20c8, 0x76dc4190, 0x4db26158,
+ 0xedb88320, 0xd6d6a3e8, 0x9b64c2b0, 0xa00ae278
+ };
+ const u8 *pos = buf;
+ u32 w;
+
+ while (len--) {
+ w = __ROL32(*pos++, input_rotate & 31);
+ input_rotate += pool_pos ? 7 : 14;
+ pool_pos = (pool_pos - 1) & POOL_WORDS_MASK;
+ w ^= pool[pool_pos];
+ w ^= pool[(pool_pos + POOL_TAP1) & POOL_WORDS_MASK];
+ w ^= pool[(pool_pos + POOL_TAP2) & POOL_WORDS_MASK];
+ w ^= pool[(pool_pos + POOL_TAP3) & POOL_WORDS_MASK];
+ w ^= pool[(pool_pos + POOL_TAP4) & POOL_WORDS_MASK];
+ w ^= pool[(pool_pos + POOL_TAP5) & POOL_WORDS_MASK];
+ pool[pool_pos] = (w >> 3) ^ twist[w & 7];
+ }
+}
+
+static void random_extract(u8 *out)
+{
+ unsigned int i;
+ u8 hash[SHA1_MAC_LEN];
+ u32 *hash_ptr;
+ u32 buf[POOL_WORDS / 2];
+
+ /* First, add hash back to pool to make backtracking more difficult. */
+ hmac_sha1(dummy_key, sizeof(dummy_key), (const u8 *) pool,
+ sizeof(pool), hash);
+ random_mix_pool(hash, sizeof(hash));
+ /* Hash half the pool to extra data */
+ for (i = 0; i < POOL_WORDS / 2; i++) {
+ buf[i] = pool[(pool_pos - i) & POOL_WORDS_MASK];
+ }
+ hmac_sha1(dummy_key, sizeof(dummy_key), (const u8 *) buf,
+ sizeof(buf), hash);
+ /*
+ * Fold the hash to further reduce any potential output pattern.
+ * Though, compromise this to reduce CPU use for the most common output
+ * length (32) and return 16 bytes from instead of only half.
+ */
+ hash_ptr = (u32 *) hash;
+ hash_ptr[0] ^= hash_ptr[4];
+ memcpy(out, hash, EXTRACT_LEN);
+}
+
+static int random_get_bytes(void *buf, size_t len)
+{
+ int ret;
+ u8 *bytes = buf;
+ size_t left;
+
+ /* Start with assumed strong randomness from OS */
+ ret = os_get_random(buf, len);
+
+ /* Mix in additional entropy extracted from the internal pool */
+ left = len;
+ while (left) {
+ size_t siz, i;
+ u8 tmp[EXTRACT_LEN];
+ random_extract(tmp);
+
+ siz = left > EXTRACT_LEN ? EXTRACT_LEN : left;
+ for (i = 0; i < siz; i++) {
+ *bytes++ ^= tmp[i];
+ }
+ left -= siz;
+ }
+
+ if (entropy < len) {
+ entropy = 0;
+ } else {
+ entropy -= len;
+ }
+
+ return ret;
+}
+
+/**
+ * wps_pin_checksum - Compute PIN checksum
+ * @pin: Seven digit PIN (i.e., eight digit PIN without the checksum digit)
+ * Returns: Checksum digit
+ */
+static unsigned int wps_pin_checksum(unsigned int pin)
+{
+ unsigned int accum = 0;
+ while (pin) {
+ accum += 3 * (pin % 10);
+ pin /= 10;
+ accum += pin % 10;
+ pin /= 10;
+ }
+
+ return (10 - accum % 10) % 10;
+}
+
+/**
+ * wifi_generate_pin - Generate a random PIN
+ * Returns: Eight digit PIN (i.e., including the checksum digit)
+ */
+unsigned int wifi_generate_pin(void)
+{
+ unsigned int val;
+
+ /* Generate seven random digits for the PIN */
+ if (random_get_bytes((unsigned char *) &val, sizeof(val)) < 0) {
+ struct os_time now;
+ os_get_time(&now);
+ val = os_random() ^ now.sec ^ now.usec;
+ }
+ val %= 10000000;
+
+ /* Append checksum digit */
+ return val * 10 + wps_pin_checksum(val);
+}
+
+
#include "util.h"
#include "net/util/vconf_helper.h"
#include "net/wifi_manager.h"
+#include "net/wifi_generate_pin.h"
typedef enum {
WIFI_MANAGER_CB_DEVICE_STATE_CHANGED,
return wifi_deinitialize();
}
+wifi_error_e wifi_manager_generate_wps_pin(wifi_manager_object *manager, char **pin)
+{
+ WIFI_RET_VAL_IF_FAIL(manager != NULL, WIFI_ERROR_INVALID_PARAMETER);
+ WIFI_RET_VAL_IF_FAIL(pin != NULL, WIFI_ERROR_INVALID_PARAMETER);
+ unsigned int rpin = 0;
+ char npin[9] = { '\0' };
+ int pin_len = 0;
+
+ rpin = wifi_generate_pin();
+ if (rpin > 0)
+ g_snprintf(npin, sizeof(npin), "%08d", rpin);
+
+ pin_len = strlen(npin);
+ if (pin_len != 8) {
+ WIFI_LOG_ERR("Invalid PIN");
+ return WIFI_ERROR_OPERATION_FAILED;
+ }
+ *pin = g_strdup(npin);
+
+ return WIFI_ERROR_NONE;
+}
+
wifi_manager_object *wifi_manager_new_with_init(wifi_error_e *error)
{
wifi_manager_object *manager = wifi_manager_new();
static layout_scan_object *_scan_create(view_base_object *base_obj, app_object *app_obj);
static void _popup_scanning_show(app_object *app_obj, gboolean is_scanning_for_wifi_activate);
-//static void __popup_scanning_destroy_cb(void *data, Evas_Object *obj, void *event_info);
+static void __popup_scanning_destroy_cb(void *data, Evas_Object *obj, void *event_info);
static void _main_callbacks_init(layout_main_object *main_obj, app_object *app_obj);
static layout_main_object *_main_create(view_base_object *base_obj, app_object *app_obj);
case WIFI_CONNECTION_STATE_CONNECTED:
layout_scan_pop_to(app_obj->scan);
layout_scan_ap_list_item_move_to_top(app_obj->scan, ap_item);
- elm_genlist_item_update(ap_item);
+ //elm_genlist_item_update(ap_item);
+ elm_genlist_item_fields_update(ap_item, "elm.text.sub", ELM_GENLIST_ITEM_FIELD_TEXT);
idler_util_managed_idle_add(_scan_scroll_to_top_for_idle,
app_obj->scan);
static gboolean _is_unable_to_scan_state(wifi_manager_object *manager)
{
- gboolean is_wearable_debuging_mode = vconf_is_wearable_debugging_mode();
-
- WIFI_LOG_INFO("[Wi-Fi] debuging mode = %s",
- is_wearable_debuging_mode ? "Y" : "N");
-
- return !is_wearable_debuging_mode;
+ return false;
}
static void _main_scan_menu_enable_init(layout_main_object *main_obj,
{
if (!g_strcmp0(part, "elm.text")) {
return g_strdup(STR_STATUS);
- } else if (!g_strcmp0(part, "elm.text.1")) {
+ } else if (!g_strcmp0(part, "elm.text.sub")) {
app_object *app_obj = data;
wifi_connection_state_e conn_state;
if (!app_obj) {
{
if (!g_strcmp0(part, "elm.text")) {
return g_strdup(STR_SIGNAL_STRENGTH);
- } else if (!g_strcmp0(part, "elm.text.1")) {
+ } else if (!g_strcmp0(part, "elm.text.sub")) {
app_object *app_obj = data;
if (!app_obj) {
WIFI_LOG_ERR("app object is NULL");
{
if (!g_strcmp0(part, "elm.text")) {
return g_strdup(STR_LINK_SPEED);
- } else if (!g_strcmp0(part, "elm.text.1")) {
+ } else if (!g_strcmp0(part, "elm.text.sub")) {
app_object *app_obj = data;
gint max_speed;
if (!app_obj) {
{
if (!g_strcmp0(part, "elm.text")) {
return g_strdup(STR_IP_ADDRESS);
- } else if (!g_strcmp0(part, "elm.text.1")) {
+ } else if (!g_strcmp0(part, "elm.text.sub")) {
app_object *app_obj = data;
if (!app_obj) {
WIFI_LOG_ERR("app object is NULL");
}
wifi_manager_ap_set_last_connection_error(found_ap, connection_error);
- elm_genlist_item_fields_update(ap_item, "elm.text.1",
- ELM_GENLIST_ITEM_FIELD_TEXT);
+// elm_genlist_item_fields_update(ap_item, "elm.text.sub",
+// ELM_GENLIST_ITEM_FIELD_TEXT);
+ elm_genlist_item_update(ap_item);
}
static void __on_scan_pop_transition_finished_for_forget(void *data,
WIFI_RET_VAL_IF_FAIL(ap_obj != NULL, NULL);
+ WIFI_LOG_ERR("part (%s)", part);
+
if (!g_strcmp0(part, "elm.text")) {
gchar *ssid, *markup_ssid;
ssid = wifi_manager_ap_get_ssid(ap_obj);
markup_ssid = elm_entry_utf8_to_markup(ssid);
g_free(ssid);
return markup_ssid;
- } else if (!g_strcmp0(part, "elm.text.1")) {
+ } else if (!g_strcmp0(part, "elm.text.sub")) {
app_object *app_obj = evas_object_data_get(obj,
LAYOUT_SCAN_DATA_KEY_WIFI_AP_ITEM_SELECT);
wifi_connection_state_e state;
wifi_ap_object *ap_obj = data;
WIFI_RET_VAL_IF_FAIL(ap_obj != NULL, NULL);
- if (!g_strcmp0(part, "elm.icon")) {
+ if (!g_strcmp0(part, "elm.swallow.end")) {
return _get_ap_signal_strength_image_layout(ap_obj, obj);
}
return NULL;
if (!g_strcmp0(part, "elm.text")) {
return g_strdup(STR_EAP_METHOD_MENU);
- } else if (!g_strcmp0(part, "elm.text.1")) {
+ } else if (!g_strcmp0(part, "elm.text.sub")) {
wifi_eap_type_e eap_type =
wifi_address_get_eap_type(app_obj->address_for_connect);
if (eap_type == WIFI_EAP_TYPE_SIM) {
static gchar *_wps_progress_generate_wps_pin_text(wifi_manager_object *manager)
{
gchar *pin = NULL;
+ if (wifi_manager_generate_wps_pin(manager, &pin) != WIFI_ERROR_NONE) {
+ WIFI_LOG_ERR("WPS pin generate failed.");
+ return NULL;
+ }
return pin;
}
if (!g_strcmp0(part, "elm.text")) {
return g_strdup(STR_IP_ADDRESS);
- } else if (!g_strcmp0(part, "elm.text.1")) {
+ } else if (!g_strcmp0(part, "elm.text.sub")) {
return _make_static_ip_menu_text(
wifi_address_get_ip_address(app_obj->address_for_edit),
DEFAULT_GUIDE_IP_ADDRESS);
if (!g_strcmp0(part, "elm.text")) {
return g_strdup(STR_GATYEWAY);
- } else if (!g_strcmp0(part, "elm.text.1")) {
+ } else if (!g_strcmp0(part, "elm.text.sub")) {
return _make_static_ip_menu_text(
wifi_address_get_gateway_address(app_obj->address_for_edit),
DEFAULT_GUIDE_GATEWAY_ADDRESS);
if (!g_strcmp0(part, "elm.text")) {
return g_strdup(STR_SUBNETMASK);
- } else if (!g_strcmp0(part, "elm.text.1")) {
+ } else if (!g_strcmp0(part, "elm.text.sub")) {
return _make_static_ip_menu_text(
wifi_address_get_subnet_mask(app_obj->address_for_edit),
DEFAULT_GUIDE_SUBNET_MASK);
if (!g_strcmp0(part, "elm.text")) {
return g_strdup_printf(STR_DNS, 1);
- } else if (!g_strcmp0(part, "elm.text.1")) {
+ } else if (!g_strcmp0(part, "elm.text.sub")) {
return _make_static_ip_menu_text(
wifi_address_get_dns_address(app_obj->address_for_edit, 1),
DEFAULT_GUIDE_DNS1);
if (!g_strcmp0(part, "elm.text")) {
return g_strdup_printf(STR_DNS, 2);
- } else if (!g_strcmp0(part, "elm.text.1")) {
+ } else if (!g_strcmp0(part, "elm.text.sub")) {
return _make_static_ip_menu_text(
wifi_address_get_dns_address(app_obj->address_for_edit, 2),
DEFAULT_GUIDE_DNS2);
if (!g_strcmp0(part, "elm.text")) {
return g_strdup(STR_PROXY_ADDRESS);
- } else if (!g_strcmp0(part, "elm.text.1")) {
+ } else if (!g_strcmp0(part, "elm.text.sub")) {
return g_strdup(wifi_address_get_proxy_address(app_obj->address_for_edit));
}
return NULL;
if (!g_strcmp0(part, "elm.text")) {
return g_strdup(STR_PROXY_PORT);
- } else if (!g_strcmp0(part, "elm.text.1")) {
+ } else if (!g_strcmp0(part, "elm.text.sub")) {
return g_strdup(wifi_address_get_proxy_port(app_obj->address_for_edit));
}
return NULL;
WIFI_RET_IF_FAIL(app_obj->wearable_input == NULL);
- proxy_text = elm_object_item_part_text_get(item, "elm.text.1");
+ proxy_text = elm_object_item_part_text_get(item, "elm.text.sub");
menu_item_type = layout_proxy_setting_get_menu_type(app_obj->proxy_setting, item);
switch (menu_item_type) {
case PROXY_SETTING_ITEM_ADDRESS:
}
}
-#if 0
static void __popup_scanning_destroy_cb(void *data, Evas_Object *obj, void *event_info)
{
app_object *app_obj = data;
layout_main_activate_rotary_event(app_obj->main);
}
}
-#endif
-
static void _popup_scanning_show(app_object *app_obj, gboolean is_scanning_for_wifi_activate)
{
-#if 0
if (!app_obj->popup_scanning) {
app_obj->popup_scanning = popup_scanning_new(app_obj->base);
WIFI_RET_IF_FAIL(app_obj->popup_scanning != NULL);
}
app_obj->is_scanning_for_wifi_activate = is_scanning_for_wifi_activate;
popup_scanning_show(app_obj->popup_scanning);
-#endif
}
static void __scan_button_tap_cb(void *data, Evas_Object *obj, void *event_info)
elm_check_state_set(checkbox, wifi_manager_is_wifi_use(app_obj->wifi_manager));
elm_access_object_unregister(checkbox);
- //evas_object_smart_callback_add(checkbox, "changed",
- // __main_menu_power_checkbox_changed_cb, app_obj);
+#if 0
+ evas_object_smart_callback_add(checkbox, "changed",
+ __main_menu_power_checkbox_changed_cb, app_obj);
+#endif
app_obj->checkbox_power = checkbox;
return checkbox;
if (!g_strcmp0(part, "elm.text"))
return g_strdup(STR_WIFI_NETWORKS);
- if (!g_strcmp0(part, "elm.text.1")) {
+ if (!g_strcmp0(part, "elm.text.sub")) {
if (!wifi_manager_is_wifi_use(app_obj->wifi_manager))
return g_strdup(STR_TURNED_OFF);
wifi_ap_object *found_ap = elm_object_item_data_get(found_ap_item);
wifi_manager_ap_set_captiveportal(found_ap, TRUE);
- elm_genlist_item_fields_update(found_ap_item, "elm.text.1",
+ elm_genlist_item_fields_update(found_ap_item, "elm.text.sub",
ELM_GENLIST_ITEM_FIELD_TEXT);
+ WIFI_LOG_INFO("update.. text.sub!");
}
}
free(ssid);
-#if 0
+#if 0 /* Not used */
VISIBILITY_DEFAULT int main(int argc, char *argv[])
{
app_object app_obj;
Evas_Object *conformant;
Evas_Object *bg;
Evas_Object *naviframe;
-#ifdef USE_EXTENSION_API
Eext_Circle_Surface *circle_surface;
-#endif
};
static Evas_Object *_create_window(const gchar *name)
elm_win_title_set(window, name);
elm_win_borderless_set(window, EINA_TRUE);
-#ifdef USE_EXTENSION_API
- ecore_x_window_size_get(ecore_x_window_root_first_get(), &width, &height);
-#endif
+ elm_win_screen_size_get(window, NULL, NULL, &width, &height);
evas_object_resize(window, width, height);
if (elm_win_wm_rotation_supported_get(window)) {
return conformant;
}
-#ifdef USE_EXTENSION_API
static Eext_Circle_Surface *_create_circle_surface_from_naviframe(Evas_Object *naviframe)
{
Eext_Circle_Surface *circle_surface;
circle_surface = eext_circle_surface_naviframe_add(naviframe);
return circle_surface;
}
-#endif
+
static Evas_Object *_create_bg(Evas_Object *parent)
{
Evas_Object *bg = elm_bg_add(parent);
}
elm_object_content_set(self->conformant, self->naviframe);
-#ifdef USE_EXTENSION_API
self->circle_surface = _create_circle_surface_from_naviframe(self->naviframe);
if (!self->circle_surface) {
WIFI_LOG_ERR("_create_circle_surface_from_conformant() is failed.");
return FALSE;
}
- ea_theme_changeable_ui_enabled_set(EINA_TRUE);
-#endif
-
return TRUE;
}
{
WIFI_RET_IF_FAIL(self);
-#ifdef USE_EXTENSION_API
if (self->circle_surface) {
eext_circle_surface_del(self->circle_surface);
self->circle_surface = NULL;
}
-#endif
evas_object_del(self->naviframe);
evas_object_del(self->bg);
genlist = view_base_add_genlist(self, parent);
WIFI_RET_VAL_IF_FAIL(genlist, NULL);
-#ifdef USE_EXTENSION_API
+#if 0
uxt_genlist_set_bottom_margin_enabled(genlist, EINA_TRUE);
*circle_genlist = eext_circle_object_genlist_add(genlist, self->circle_surface);
scroller = view_base_add_scroller(self, parent);
WIFI_RET_VAL_IF_FAIL(scroller, NULL);
-#ifdef USE_EXTENSION_API
*circle_scroller = eext_circle_object_scroller_add(scroller, self->circle_surface);
if (!(*circle_scroller)) {
evas_object_del(scroller);
}
eext_circle_object_scroller_policy_set(*circle_scroller,
ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
-#endif
return scroller;
}
return elm_progressbar_add(parent);
}
-#ifdef USE_EXTENSION_API
Evas_Object *view_base_add_progressbar_for_circle(view_base_object *self, Evas_Object *parent)
{
WIFI_RET_VAL_IF_FAIL(self, NULL);
return eext_circle_object_progressbar_add(parent, self->circle_surface);
}
-#endif
Evas_Object *view_base_add_popup(view_base_object *self, Evas_Object *parent)
{
WIFI_RET_VAL_IF_FAIL(popup, NULL);
elm_object_style_set(popup, "circle");
-#ifdef USE_EXTENSION_API
+#if 0
uxt_popup_set_rotary_event_enabled(popup, EINA_TRUE);
#endif
evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
NULL, NULL);
WIFI_RET_VAL_IF_FAIL(menu_item_array[MAIN_MENU_POWER], FALSE);
- menu_item_array[MAIN_MENU_SCAN] = create_genlist_itc("2text",
+ menu_item_array[MAIN_MENU_SCAN] = create_genlist_itc("type1",
obj->menu_cb[MAIN_MENU_SCAN].text_get,
obj->menu_cb[MAIN_MENU_SCAN].content_get,
NULL, NULL);
static gboolean _ap_list_append_title(layout_scan_object *self)
{
- Elm_Genlist_Item_Class *title_itc = create_genlist_itc("title",
+ Elm_Genlist_Item_Class *title_itc = create_genlist_itc("type1",
__title_text_get_cb, NULL,
NULL, NULL);
WIFI_RET_VAL_IF_FAIL(title_itc != NULL, FALSE);
static inline Elm_Genlist_Item_Class *_create_wifi_ap_itc(layout_scan_object *self)
{
- return create_genlist_itc("2text.1icon.1/sub1.multiline",
+ return create_genlist_itc("type1",
self->menu_cb[SCAN_MENU_WIFI_AP_ITEM].text_get,
self->menu_cb[SCAN_MENU_WIFI_AP_ITEM].content_get,
self->menu_cb[SCAN_MENU_WIFI_AP_ITEM].state_get,
evas_object_del(menu_list);
return NULL;
}
- menu_wps_button_itc = create_genlist_itc("1text",
+ menu_wps_button_itc = create_genlist_itc("type1",
__menu_wps_button_text_get_cb, NULL, NULL, NULL);
if (!menu_wps_button_itc) {
WIFI_LOG_ERR("menu wps button itc create failed.");
evas_object_del(menu_list);
return NULL;
}
- menu_wps_pin_itc = create_genlist_itc("1text",
+ menu_wps_pin_itc = create_genlist_itc("type1",
__menu_wps_pin_text_get_cb, NULL, NULL, NULL);
if (!menu_wps_pin_itc) {
WIFI_LOG_ERR("menu wps pin itc create failed.");
static void __response_cb(void *data, Evas_Object *obj, void *event_info)
{
if (!data) return;
- elm_popup_dismiss(data);
+ layout_wps_progress_object *self = data;
+ elm_popup_dismiss(self->popup);
+
+ /* TODO: It will be removed */
+ layout_wps_progress_destroy(self);
}
static Eina_Bool __progress_timer_task_cb(void *data)
{
-#ifdef USE_EXTENSION_API
double progressbar_value, progressbar_interval = 1.2;
gchar percent_text[8];
-#endif
layout_wps_progress_object *wps_progress = data;
__WIFI_FUNC_ENTER__;
WIFI_RET_VAL_IF_FAIL(wps_progress != NULL, ECORE_CALLBACK_CANCEL);
WIFI_RET_VAL_IF_FAIL(wps_progress->progress_timer != NULL, ECORE_CALLBACK_CANCEL);
-#ifdef USE_EXTENSION_API
progressbar_value = eext_circle_object_value_get(wps_progress->progressbar);
if (progressbar_value < 100)
progressbar_value += progressbar_interval;
WIFI_LOG_INFO("progress[%0.2f]", progressbar_value);
if (progressbar_value < 100)
return ECORE_CALLBACK_RENEW;
-#endif
layout_wps_progress_dismiss(wps_progress);
return ECORE_CALLBACK_CANCEL;
Evas_Object *progressbar = NULL;
WIFI_RET_VAL_IF_FAIL(parent, NULL);
-#ifdef USE_EXTENSION_API
progressbar = eext_circle_object_progressbar_add(parent, NULL);
WIFI_RET_VAL_IF_FAIL(progressbar, NULL);
eext_circle_object_value_min_max_set(progressbar, 0.0, 100.0);
evas_object_show(progressbar);
-#endif
return progressbar;
}
evas_object_propagate_events_set(cancel_button, EINA_FALSE);
evas_object_smart_callback_add(cancel_button, "clicked",
- __response_cb, self->popup);
+ __response_cb, self);
return cancel_button;
}
__popup_hide_cb, NULL);
evas_object_smart_callback_add(popup, "dismissed",
self->destroy_cb.func, self->destroy_cb.data);
+
return popup;
}
WIFI_RET_IF_FAIL(self->popup != NULL);
elm_popup_dismiss(self->popup);
+
+ /* TODO: It will be removed. */
+ popup_scanning_destroy(self);
}
void popup_scanning_set_destroy_cb(popup_scanning_object *self,