Update the random PIN generator module to provide high entropy.
authorChul Lee <chuls.lee@samsung.com>
Thu, 8 Sep 2016 13:26:01 +0000 (22:26 +0900)
committerRandeep Singh <randeep.s@samsung.com>
Fri, 28 Oct 2016 11:43:35 +0000 (11:43 +0000)
commitb7cc28c51fe7c134aef3409f3e5fabba273475b2
tree0d463474793f1a7997ee2859bb800ad461a32b0a
parente5cdc836f5d4f422e2df5ba86d003a3e5fc8d534
Update the random PIN generator module to provide high entropy.

After this patch,
Server developer can choose the policy of random PIN generation
through SetRandomPinPolicy API.

Updated Random PIN module provides flexibility
in the PIN length and PIN type as following :
  PIN length : 4 bytes ~ 32 bytes
  PIN Type : Bitmask :
             NUM_PIN            = (0x1 << 0),    //Numeric PIN
             UPPERCASE_CHAR_PIN = (0x1 << 1),    //uppercase character PIN
             LOWERCASE_CHAR_PIN = (0x1 << 2)     //lowercase character PIN

Here is example for SetRandomPinPolicy API :

    //Now, Server will generate the 10 bytes PIN
    //which is nummeric and lowercase mixed PIN.
    if(OC_STACK_OK != SetRandomPinPolicy(10, NUM_PIN | LOWERCASE_CAHR_PIN))
    {
        OIC_LOG(ERROR, TAG, "Failed to setting PIN policy");
        return 0;
    }

Change-Id: I0f6b56a037a85a0d7c8e6d1db85f4a9808989964
Signed-off-by: Chul Lee <chuls.lee@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/11607
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Randeep Singh <randeep.s@samsung.com>
resource/csdk/octbstack_product_secured.def
resource/csdk/security/include/pinoxmcommon.h
resource/csdk/security/provisioning/sample/provisioningclient.c
resource/csdk/security/provisioning/sample/sampleserver_randompin.cpp
resource/csdk/security/provisioning/sample/subownerclient.c
resource/csdk/security/provisioning/src/multipleownershiptransfermanager.c
resource/csdk/security/provisioning/src/oxmrandompin.c
resource/csdk/security/provisioning/src/pmutility.c
resource/csdk/security/src/doxmresource.c
resource/csdk/security/src/oxmpincommon.c