Imported Upstream version 1.1.1
[platform/upstream/iotivity.git] / extlibs / tinydtls / sha2 / sha2speed.c
index f012f40..77d17af 100644 (file)
@@ -60,9 +60,9 @@ void printspeed(char *caption, unsigned long bytes, double time) {
 
 
 int main(int argc, char **argv) {
-       DTLS_SHA256_CTX c256;
-       DTLS_SHA384_CTX c384;
-       DTLS_SHA512_CTX c512;
+       dtls_sha256_ctx c256;
+       dtls_sha384_ctx c384;
+       dtls_sha512_ctx c512;
        char            buf[BUFSIZE];
        char            md[DTLS_SHA512_DIGEST_STRING_LENGTH];
        int             bytes, blocks, rep, i, j;
@@ -97,18 +97,18 @@ int main(int argc, char **argv) {
        ave256 = ave384 = ave512 = 0;
        best256 = best384 = best512 = 100000;
        for (i = 0; i < rep; i++) {
-               DTLS_SHA256_Init(&c256);
-               DTLS_SHA384_Init(&c384);
-               DTLS_SHA512_Init(&c512);
+               dtls_sha256_init(&c256);
+               dtls_sha384_init(&c384);
+               dtls_sha512_init(&c512);
        
                gettimeofday(&start, (struct timezone*)0);
                for (j = 0; j < blocks; j++) {
-                       DTLS_SHA256_Update(&c256, (unsigned char*)buf, BUFSIZE);
+                       dtls_sha256_update(&c256, (unsigned char*)buf, BUFSIZE);
                }
                if (bytes % BUFSIZE) {
-                       DTLS_SHA256_Update(&c256, (unsigned char*)buf, bytes % BUFSIZE);
+                       dtls_sha256_update(&c256, (unsigned char*)buf, bytes % BUFSIZE);
                }
-               DTLS_SHA256_End(&c256, md);
+               dtls_sha256_end(&c256, md);
                gettimeofday(&end, (struct timezone*)0);
                t = ((end.tv_sec - start.tv_sec) * 1000000.0 + (end.tv_usec - start.tv_usec)) / 1000000.0;
                ave256 += t;
@@ -119,12 +119,12 @@ int main(int argc, char **argv) {
 
                gettimeofday(&start, (struct timezone*)0);
                for (j = 0; j < blocks; j++) {
-                       DTLS_SHA384_Update(&c384, (unsigned char*)buf, BUFSIZE);
+                       dtls_sha384_update(&c384, (unsigned char*)buf, BUFSIZE);
                }
                if (bytes % BUFSIZE) {
-                       DTLS_SHA384_Update(&c384, (unsigned char*)buf, bytes % BUFSIZE);
+                       dtls_sha384_update(&c384, (unsigned char*)buf, bytes % BUFSIZE);
                }
-               DTLS_SHA384_End(&c384, md);
+               dtls_sha384_end(&c384, md);
                gettimeofday(&end, (struct timezone*)0);
                t = ((end.tv_sec - start.tv_sec) * 1000000.0 + (end.tv_usec - start.tv_usec)) / 1000000.0;
                ave384 += t;
@@ -135,12 +135,12 @@ int main(int argc, char **argv) {
 
                gettimeofday(&start, (struct timezone*)0);
                for (j = 0; j < blocks; j++) {
-                       DTLS_SHA512_Update(&c512, (unsigned char*)buf, BUFSIZE);
+                       dtls_sha512_update(&c512, (unsigned char*)buf, BUFSIZE);
                }
                if (bytes % BUFSIZE) {
-                       DTLS_SHA512_Update(&c512, (unsigned char*)buf, bytes % BUFSIZE);
+                       dtls_sha512_update(&c512, (unsigned char*)buf, bytes % BUFSIZE);
                }
-               DTLS_SHA512_End(&c512, md);
+               dtls_sha512_end(&c512, md);
                gettimeofday(&end, (struct timezone*)0);
                t = ((end.tv_sec - start.tv_sec) * 1000000.0 + (end.tv_usec - start.tv_usec)) / 1000000.0;
                ave512 += t;