📄 serialtest.c
字号:
/* <LIC_AMD_STD> * Copyright (C) 2003-2005 Advanced Micro Devices, Inc. All Rights Reserved. * * Unless otherwise designated in writing, this software and any related * documentation are the confidential proprietary information of AMD. * THESE MATERIALS ARE PROVIDED "AS IS" WITHOUT ANY * UNLESS OTHERWISE NOTED IN WRITING, EXPRESS OR IMPLIED WARRANTY OF ANY * KIND, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, * NONINFRINGEMENT, TITLE, FITNESS FOR ANY PARTICULAR PURPOSE AND IN NO * EVENT SHALL AMD OR ITS LICENSORS BE LIABLE FOR ANY DAMAGES WHATSOEVER. * * AMD does not assume any responsibility for any errors which may appear * in the Materials nor any responsibility to support or update the * Materials. AMD retains the right to modify the Materials at any time, * without notice, and is not obligated to provide such modified * Materials to you. AMD is not obligated to furnish, support, or make * any further information available to you. * </LIC_AMD_STD> *//* <CTL_AMD_STD> * </CTL_AMD_STD> *//* <DOC_AMD_STD> * </DOC_AMD_STD> */#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <string.h>#include <stdlib.h>#include <sys/ioctl.h>#define NEED_HW_SECRET#include "mae_interface.h"#include "base64.h"#include "secure_serial.h"#include "secure_serial_priv.h"int main(int argc, char *argv[]){ char *foo; int count=1; int i; int rc; u_int8_t *key; int j; int errorCode; int fd; uint32 drm[8]; unsigned char *tDrm; unsigned char divxStore[48]; for(i=0;i<48;i++) divxStore[i] = i; rc = saveDivxStore(divxStore); fprintf(stderr,"save to divxstore rc = %d\n",rc); rc = loadDivxStore(divxStore); fprintf(stderr,"load to divxstore rc = %d\n",rc); // compare store for(i=0;i<48;i++) if (divxStore[i] != i) fprintf(stderr,"divxStore[%d] = %d\n",i,divxStore[i]); rc = getHwSecret(&tDrm,&errorCode); for(i=0;i<HARDWARE_SECRET_SIZE;i++) { fprintf(stderr,"%02x",tDrm[i]); } fprintf(stderr,"\n"); fd = open("/dev/mae",O_RDONLY); if (fd < 0) { perror("open"); return(1); } rc = ioctl(fd,AU1XXXMAE_GETDIVXSTR,drm); for (i=0;i<8;i++) drm[i] = drm[i] ^ salt[i]; printf("%08x%08x%08x%08x%08x%08x%08x%08x\n",drm[0],drm[1],drm[2],drm[3], drm[4],drm[5],drm[6],drm[7]); if (argc == 2) count = atoi(argv[1]); printf("Model: %s\n",getModelStr(&errorCode)); printf("Manufacture: %s\n",getManufStr(&errorCode)); rc = getDivxKey(&key,&errorCode); if (rc) fprintf(stderr,"getDivxKey returned error: %d\n",errorCode); for(i=0;i<SHA1_DIGEST_LENGTH;i++) fprintf(stderr,"%x",key[i]); fprintf(stderr,"\n"); fprintf(stderr,"Count: %d\n",count); for(i=0;i<count;i++) { rc = getDivxKey((u_int8_t **)&key,&errorCode); if (rc) fprintf(stderr,"getDivxKey returned error: %d\n",errorCode); fprintf(stderr,"DivX Key: "); for(j=0;j<SHA1_DIGEST_LENGTH;j++) fprintf(stderr,"%x",key[j]); fprintf(stderr,"\n"); foo = getSerialNum(&errorCode); if (foo == NULL) { fprintf(stderr,"getSerial returns Null (errorCode: %d)\n",errorCode); return(-1); } fprintf(stderr,"serial Number: %s\n",foo); } return(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -