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>
Sat, 29 Oct 2016 00:57:54 +0000 (00:57 +0000)
commitdb621c173e293728e44f5c5e8986bcf22c495c59
treec59b66969047eb0993e617ecadc1551106063f9c
parent94559bca11dc0718caed4f682d29195193fb08a4
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>
Reviewed-on: https://gerrit.iotivity.org/gerrit/13825
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/src/doxmresource.c
resource/csdk/security/src/oxmpincommon.c