00001
00002
00003
00004
00005
00006 #include "authRequest.h"
00007 int get64RandomBytes(char *buf);
00008
00009 static char buf[CHALLENGE_LEN+MAX_PASSWORD_LEN+1];
00010
00011 int
00012 rsAuthRequest (rsComm_t *rsComm, authRequestOut_t **authRequestOut)
00013 {
00014 authRequestOut_t *result;
00015 char *bufp;
00016
00017 *authRequestOut = (authRequestOut_t*)malloc(sizeof(authRequestOut_t));
00018 memset((char *)*authRequestOut, 0, sizeof(authRequestOut_t));
00019
00020 memset(buf, 0, sizeof(buf));
00021 get64RandomBytes(buf);
00022 bufp = (char*)malloc(CHALLENGE_LEN+2);
00023 if (bufp == NULL) return(SYS_MALLOC_ERR);
00024 strncpy(bufp, buf, CHALLENGE_LEN+2);
00025 result = *authRequestOut;
00026 result->challenge = bufp;
00027 return(0);
00028 }
00029
00030 char *
00031 _rsAuthRequestGetChallenge()
00032 {
00033 return ((char *)&buf);
00034 }