Home | History | Annotate | Download | only in tee_client_api
      1 /**
      2  * Copyright(c) 2011 Trusted Logic.   All rights reserved.
      3  *
      4  * Redistribution and use in source and binary forms, with or without
      5  * modification, are permitted provided that the following conditions
      6  * are met:
      7  *
      8  *  * Redistributions of source code must retain the above copyright
      9  *    notice, this list of conditions and the following disclaimer.
     10  *  * Redistributions in binary form must reproduce the above copyright
     11  *    notice, this list of conditions and the following disclaimer in
     12  *    the documentation and/or other materials provided with the
     13  *    distribution.
     14  *  * Neither the name Trusted Logic nor the names of its
     15  *    contributors may be used to endorse or promote products derived
     16  *    from this software without specific prior written permission.
     17  *
     18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     29  */
     30 
     31 #ifndef __SCHANNEL6_LOGINS_H__
     32 #define __SCHANNEL6_LOGINS_H__
     33 
     34 #define SCX_LOGIN_PUBLIC              0x00000000
     35 #define SCX_LOGIN_USER                0x00000001
     36 #define SCX_LOGIN_GROUP               0x00000002
     37 #define SCX_LOGIN_APPLICATION         0x00000004
     38 #define SCX_LOGIN_APPLICATION_USER    0x00000005
     39 #define SCX_LOGIN_APPLICATION_GROUP   0x00000006
     40 #define SCX_LOGIN_AUTHENTICATION      0x80000000
     41 #define SCX_LOGIN_PRIVILEGED          0x80000002
     42 
     43 /* Login variants */
     44 
     45 #define SCX_LOGIN_VARIANT(mainType, os, variant) \
     46    ((mainType) | (1 << 27) | ((os) << 16) | ((variant) << 8))
     47 
     48 #define SCX_LOGIN_GET_MAIN_TYPE(type) ((type) & ~SCX_LOGIN_VARIANT(0, 0xFF, 0xFF))
     49 
     50 #define SCX_LOGIN_OS_ANY       0x00
     51 #define SCX_LOGIN_OS_LINUX     0x01
     52 #define SCX_LOGIN_OS_WINMOBILE 0x02
     53 #define SCX_LOGIN_OS_SYMBIAN   0x03
     54 #define SCX_LOGIN_OS_ANDROID   0x04
     55 
     56 /* OS-independent variants */
     57 #define SCX_LOGIN_USER_NONE        SCX_LOGIN_VARIANT(SCX_LOGIN_USER, SCX_LOGIN_OS_ANY, 0xFF)
     58 #define SCX_LOGIN_GROUP_NONE       SCX_LOGIN_VARIANT(SCX_LOGIN_GROUP, SCX_LOGIN_OS_ANY, 0xFF)
     59 #define SCX_LOGIN_APPLICATION_USER_NONE \
     60                SCX_LOGIN_VARIANT(SCX_LOGIN_APPLICATION_USER, SCX_LOGIN_OS_ANY, 0xFF)
     61 #define SCX_LOGIN_AUTHENTICATION_BINARY_SHA1_HASH \
     62                SCX_LOGIN_VARIANT(SCX_LOGIN_AUTHENTICATION, SCX_LOGIN_OS_ANY, 0x01)
     63 #define SCX_LOGIN_PRIVILEGED_KERNEL \
     64                SCX_LOGIN_VARIANT(SCX_LOGIN_PRIVILEGED, SCX_LOGIN_OS_ANY, 0x01)
     65 
     66 /* Linux variants */
     67 #define SCX_LOGIN_USER_LINUX_EUID     SCX_LOGIN_VARIANT(SCX_LOGIN_USER, SCX_LOGIN_OS_LINUX, 0x01)
     68 #define SCX_LOGIN_GROUP_LINUX_GID     SCX_LOGIN_VARIANT(SCX_LOGIN_GROUP, SCX_LOGIN_OS_LINUX, 0x01)
     69 #define SCX_LOGIN_APPLICATION_LINUX_PATH_SHA1_HASH \
     70                SCX_LOGIN_VARIANT(SCX_LOGIN_APPLICATION, SCX_LOGIN_OS_LINUX, 0x01)
     71 #define SCX_LOGIN_APPLICATION_USER_LINUX_PATH_EUID_SHA1_HASH \
     72                SCX_LOGIN_VARIANT(SCX_LOGIN_APPLICATION_USER, SCX_LOGIN_OS_LINUX, 0x01)
     73 #define SCX_LOGIN_APPLICATION_GROUP_LINUX_PATH_GID_SHA1_HASH \
     74                SCX_LOGIN_VARIANT(SCX_LOGIN_APPLICATION_GROUP, SCX_LOGIN_OS_LINUX, 0x01)
     75 
     76 /* Android variants */
     77 #define SCX_LOGIN_USER_ANDROID_EUID   SCX_LOGIN_VARIANT(SCX_LOGIN_USER, SCX_LOGIN_OS_ANDROID, 0x01)
     78 #define SCX_LOGIN_GROUP_ANDROID_GID   SCX_LOGIN_VARIANT(SCX_LOGIN_GROUP, SCX_LOGIN_OS_ANDROID, 0x01)
     79 #define SCX_LOGIN_APPLICATION_ANDROID_UID \
     80                SCX_LOGIN_VARIANT(SCX_LOGIN_APPLICATION, SCX_LOGIN_OS_ANDROID, 0x01)
     81 #define SCX_LOGIN_APPLICATION_USER_ANDROID_UID_EUID \
     82                SCX_LOGIN_VARIANT(SCX_LOGIN_APPLICATION_USER, SCX_LOGIN_OS_ANDROID, 0x01)
     83 #define SCX_LOGIN_APPLICATION_GROUP_ANDROID_UID_GID \
     84                SCX_LOGIN_VARIANT(SCX_LOGIN_APPLICATION_GROUP, SCX_LOGIN_OS_ANDROID, 0x01)
     85 
     86 /* Symbian variants */
     87 #define SCX_LOGIN_APPLICATION_SYMBIAN_UIDS \
     88                SCX_LOGIN_VARIANT(SCX_LOGIN_APPLICATION, SCX_LOGIN_OS_SYMBIAN, 0x01)
     89 #define SCX_LOGIN_APPLICATION_USER_SYMBIAN_UIDS \
     90                SCX_LOGIN_VARIANT(SCX_LOGIN_APPLICATION_USER, SCX_LOGIN_OS_SYMBIAN, 0x01)
     91 #define SCX_LOGIN_APPLICATION_GROUP_SYMBIAN_UIDS \
     92                SCX_LOGIN_VARIANT(SCX_LOGIN_APPLICATION_GROUP, SCX_LOGIN_OS_SYMBIAN, 0x01)
     93 #define SCX_LOGIN_AUTHENTICATION_SYMBIAN_UIDS \
     94                SCX_LOGIN_VARIANT(SCX_LOGIN_AUTHENTICATION, SCX_LOGIN_OS_SYMBIAN, 0x01)
     95 
     96 
     97 #endif /* __SCHANNEL6_LOGINS_H__ */
     98