crash in `sha1_block_data_order_avx`

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

crash in `sha1_block_data_order_avx`

Xiang Ren
Anybody has the same trouble with `sha1_block_data_order_avx`?

I'm using openssl-1.0.2n. This is coredump information:

     # gdb ./channel.old core.58820
     GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-80.1
     Copyright (C) 2013 Free Software Foundation, Inc.
     License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
     This is free software: you are free to change and redistribute it.
     There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
     and "show warranty" for details.
     This GDB was configured as "x86_64-Huawei-linux-gnu".
     For bug reporting instructions, please see:
     <http://www.gnu.org/software/gdb/bugs/>...
     Reading symbols from /home/imax/chuqq/20180207/channel.old...done.

     warning: core file may not match specified executable file.
     [New LWP 59134]
     [New LWP 59135]
     [New LWP 59133]
     [New LWP 59136]
     [New LWP 59115]
     [New LWP 59116]
     [New LWP 59117]
     [New LWP 59118]
     [New LWP 59119]
     [New LWP 59120]
     [New LWP 59121]

     [New LWP 59122]
     [New LWP 59123]
     [New LWP 59125]
     [New LWP 59126]
     [New LWP 59124]
     [New LWP 59128]
     [New LWP 59127]
     [New LWP 59129]
     [New LWP 59130]
     [New LWP 59114]
     [New LWP 59131]
     [New LWP 59132]
     [New LWP 58820]
     [Thread debugging using libthread_db enabled]
     Using host libthread_db library "/lib64/libthread_db.so.1".
     Core was generated by `../channel/channel -configPath /channel/channel-1'.
     Program terminated with signal 11, Segmentation fault.
     #0  0x00000000007d591a in sha1_block_data_order_avx ()
     Missing separate debuginfos, use: debuginfo-install glibc-2.17-111.h23.x86_64 libgcc-4.8.5-4.h2.x86_64 numactl-libs-2.0.9-6.x86_64
     (gdb) bt
     #0  0x00000000007d591a in sha1_block_data_order_avx ()
     #1  0xca62c1d6ca62c1d6 in ?? ()
     #2  0xca62c1d6ca62c1d6 in ?? ()
     #3  0xca62c1d6ca62c1d6 in ?? ()
     #4  0xca62c1d6ca62c1d6 in ?? ()
     #5  0xca62c1d6ca62c1d6 in ?? ()
     #6  0xca62c1d6ca62c1d6 in ?? ()
     #7  0xca62c1d6ca62c1d6 in ?? ()
     #8  0xca62c1d6ca62c1d6 in ?? ()
     #9  0x0000000009c0aeb1 in ?? ()
     #10 0x00007f38d6aac1a4 in malloc () from /lib64/libc.so.6
     #11 0x0000000000773c88 in CRYPTO_malloc ()
     #12 0x00000000007cff2f in SHA1_Update ()
     #13 0x00000000007911e5 in ssleay_rand_bytes ()
     #14 0x000000000078738c in RSA_padding_add_PKCS1_OAEP ()
     #15 0x0000000000784d90 in RSA_eay_public_encrypt ()
     #16 0x000000000048bd35 in rsa_public_encrypt (rsa_input=0x7f369c0190d0 "r\215崀\332\350\202\353^$%\215\300s.kz\301?\207p}\363kz\301?\207p}\363EB5E24258DC0732E[*****5.26.157:39044]", input_len=32,
          enc_out=0x7f369c019120 "", public_key=0x7f369c0193d0 "0\202\001\"0\r\006\t*\206H\206\367\r\001\001\001\005", key_len=294) at /root/1.1.0.11/xchannel-1.1.0.11/channel/mc_util.c:312
     #17 0x0000000000488798 in generate_channel_aeskey_reply_by_device (device=0x7f2e13b6fb30, dev_rand=0x7f369c019290 "r\215崀\332", <incomplete sequence \350\202>,
          dev_aeskey=0x7f369c0192d0 "kz\301?\207p}\363\064.182:9877,122.11.34.183:9877", publickey=0x7f369c0193d0 "0\202\001\"0\r\006\t*\206H\206\367\r\001\001\001\005", type=2, request_id=1966548338)
          at /root/1.1.0.11/xchannel-1.1.0.11/channel/mc_dpdktcp.c:391
     #18 0x000000000049c499 in channel_aeskey_response (device=0x7f2e13b6fb30,
          message=0x7f2e10455380 "^\304\a8\207(\360R\313k\026\205\220\357C\272\f\373\273@|\342xK}\214\267\367y\255f\245\200d\252\030\257\261\021zЗ\v\272\035\332DP2ʟ.\a\357\001\272Aͣ[\335-,\254㲰E\216\273\065\367⥥}\n\344:\215\237\300\037?\331[\"\210ª\230\016\266\243C\362\264Sm\271f\020\373\336Ǩ\024\342,(\265\021\257S\356\236\333\340\031\t5\325I\nQ\002۳\345v!\016\237,\t\365n,\233\065\336)\005`\276`Ss\274<\346\357Qw[D\321J\004\265\362\227p\251p\255\215\324\366\006\225\235\326$\204ݣ\272hP\217\226\245\006\223\274vL\376\201,\017p\037\003\245\310\342", <incomplete sequence \340\206>..., msg_length=403, request_id=1966548338)
          at /root/1.1.0.11/xchannel-1.1.0.11/channel/mc_outer.c:1018
     #19 0x000000000049a07c in outer_process_engine (arg=0x0) at /root/1.1.0.11/xchannel-1.1.0.11/channel/mc_outer.c:217
     #20 0x00000000004e6dc4 in eal_thread_loop ()
     #21 0x00007f38d6df4dc5 in start_thread () from /lib64/libpthread.so.0
     #22 0x00007f38d6b227ed in clone () from /lib64/libc.so.6

     (gdb) i r a
     rax            0x8a53275e     2320705374
     rbx            0xe4a22b4a     3835833162
     rcx            0x9a663701     2590390017
     rdx            0xd734ba54     3610557012
     rsi            0x2cea828c     753566348
     rdi            0x1a453563     440743267
     rbp            0xdd2d0e5d     0xdd2d0e5d
     rsp            0x7f369c018140     0x7f369c018140
     r8             0x7a38cb0     128158896
     r9             0xd1dfd2     13754322
     r10            0xc8d592     13161874
     r11            0x7d7580     8222080
     r12            0xc8d592     13161874
     r13            0xffffffffffffffc0     -64
     r14            0x7f369c0181d8     139872522306008
     r15            0x9c0aeb1     163622577
     rip            0x7d591a     0x7d591a <sha1_block_data_order_avx+2746>
     eflags         0x13202     [ IF #12 #13 RF ]
     cs             0x33     51
     ss             0x2b     43
     ds             0x0     0
     es             0x0     0
     fs             0x0     0
     gs             0x0     0
     st0            *value not available*
     st1            *value not available*
     st2            *value not available*
     st3            *value not available*
     st4            *value not available*
     st5            *value not available*
     st6            *value not available*
     st7            *value not available*
     fctrl          *value not available*
     fstat          *value not available*
     ftag           *value not available*
     fiseg          *value not available*
     fioff          *value not available*
     foseg          *value not available*
     fooff          *value not available*
     fop            *value not available*
     mxcsr          *value not available*
     ymm0           *value not available*
     ymm1           *value not available*
     ymm2           *value not available*
     ymm3           *value not available*
     ymm4           *value not available*
     ymm5           *value not available*
     ymm6           *value not available*
     ---Type <return> to continue, or q <return> to quit---
     ymm7           *value not available*
     ymm8           *value not available*
     ymm9           *value not available*
     ymm10          *value not available*
     ymm11          *value not available*
     ymm12          *value not available*
     ymm13          *value not available*
     ymm14          *value not available*
     ymm15          *value not available*

This is my code in production enviroment:

     struct rte_mbuf *generate_channel_aeskey_reply_by_device(device_t *device, uint8_t *dev_rand, uint8_t *dev_aeskey, uint8_t *publickey, int type, uint32_t request_id)
     {
          char devicestr[DEVICE_STR_LEN] = {0};
          device_str(devicestr, device->id, device->ip, device->port);

          // returned info: RSA(ClientPubKey, ClientRand[8]+DeviceID[8]+AesKey+ServerRand[8])
          // ServerRand is same as aeskey
          uint8_t hybrid_key[CHANNEL_DEVICE_RAND_LEN + CHANNEL_DEVICE_ID_LEN + CHANNEL_AESKEY_LEN + CHANNEL_AESKEY_LEN] = {0};
          xmemcpy(hybrid_key, dev_rand, CHANNEL_DEVICE_RAND_LEN);
          xmemcpy(hybrid_key + CHANNEL_DEVICE_RAND_LEN, device->id, CHANNEL_DEVICE_ID_LEN);
          xmemcpy(hybrid_key + CHANNEL_DEVICE_RAND_LEN + CHANNEL_DEVICE_ID_LEN, dev_aeskey, CHANNEL_AESKEY_LEN);
          xmemcpy(hybrid_key + CHANNEL_DEVICE_RAND_LEN + CHANNEL_DEVICE_ID_LEN + CHANNEL_AESKEY_LEN, dev_aeskey, CHANNEL_AESKEY_LEN);

          // alloc mem for encrypted “head_pub_key + aes_key”
          uint8_t encrypted_hybrid_key[RSA_CLIENT_ENCRYPTED_LEN] = {0};
          int encrypted_length = rsa_public_encrypt(hybrid_key, CHANNEL_DEVICE_RAND_LEN + CHANNEL_DEVICE_ID_LEN + CHANNEL_AESKEY_LEN + CHANNEL_AESKEY_LEN, encrypted_hybrid_key, publickey, CHANNEL_PUBKEY_LEN);
          if (encrypted_length != RSA_CLIENT_ENCRYPTED_LEN)
          {
               TLOGE("generate_channel_aeskey_reply_by_device", "%s", "rsa_public_encrypt failed to encrypted aeskey_reply. encrypted_length : %d",
                      devicestr, encrypted_length);
               return NULL;
          }
          // type=(TYPE_PT_AESKEY_RES|TYPE_PT_AESKEY_UPDATE_REQ)
          struct rte_mbuf *rpl_mbuf = generate_channel_pkt_by_device(device, encrypted_hybrid_key, RSA_CLIENT_ENCRYPTED_LEN, type, request_id);
          if (rpl_mbuf == NULL)
          {
               TLOGE("generate_channel_aeskey_reply_by_device", "%s", "rte_pktmbuf_alloc failed to allocate mbuf.", devicestr);
          }
          return rpl_mbuf;
     }


     int rsa_public_encrypt(const uint8_t *rsa_input, const int input_len, uint8_t *enc_out, uint8_t *public_key, const int key_len)
     {
          uint8_t public_key_wrapper[RSA_PUBKEY_BUFSIZE];
          int wrapper_len = wrapper_rsa_public_key(public_key, key_len, public_key_wrapper);
          if (wrapper_len >= RSA_PUBKEY_BUFSIZE)
          {
               char pkstr[1024]; // for saving publickey(294Byte), length for printing chars is 294*2
               convert_int2string(public_key, key_len, pkstr, sizeof(pkstr));
               TLOGE("rsa_public_encrypt", "", "Failed to wrapper_rsa_public_key. wrapper_len: %d, max_len: %d, pk: %s",
                      wrapper_len, RSA_PUBKEY_BUFSIZE, pkstr);
               return 0;
          }

          RSA *rsa = create_rsa(public_key_wrapper, RSA_KEY_TYPE_PUBLIC);
          if (rsa == NULL)
          {
               char pkstr[1024]; // for saving publickey(294Byte), length for printing chars is 294*2
               convert_int2string(public_key, key_len, pkstr, sizeof(pkstr));
               TLOGE("rsa_public_encrypt", "", "Failed to create RSA. pk: %s", pkstr);
               return 0;
          }

          uint32_t rsa_size = RSA_size(rsa);
          if (input_len >= rsa_size - 41) // less than RSA_size(rsa) - 41 for RSA_PKCS1_OAEP_PADDING
          {
               TLOGE("rsa_public_encrypt", "", "data too long to encrypt, must be less than %d.", RSA_size(rsa) - 41);
               RSA_free(rsa);
               return 0;
          }

          int ret = RSA_public_encrypt(input_len, rsa_input, enc_out, rsa, RSA_PKCS1_OAEP_PADDING);
          if (ret <= 0)
          {
               TLOGE("rsa_public_encrypt", "", "Failed to encrypt with RSA public key.");
               RSA_free(rsa);
               return 0;
          }
          RSA_free(rsa);
          return ret;
     }

I've used arguments in the core to reproduce this issue in development enviroment, but failed. This is the code:

     // gcc test_rsa.c -I./deps/openssl/include/ -L./deps/openssl/lib/ -I./deps/3rd/include/ ./deps/3rd/lib/libbase64.o -lssl -lcrypto -ldl
     #include <stdio.h>
     #include <stdint.h>
     #include <string.h>
     #include <sys/time.h>
     #include <assert.h>
     #include <arpa/inet.h>
     #include <openssl/ssl.h>
     #include <openssl/rsa.h>
     #include <openssl/aes.h>
     #include <fcntl.h>
     #include <unistd.h>

     #include <openssl/ssl.h>
     #include <openssl/rsa.h>
     #include <openssl/aes.h>


     // #define RSA_PUBKEY_BUFSIZE    600
     #define RSA_PUBKEY_BUFSIZE 2048
     #define RSA_KEY_LENPERLINE 64 // RSA Pri and Pub keys in base64 format, number of chars per line

     RSA **private_rsas = NULL;
     uint32_t RSA_SIZE = 0;

     #define RSA_KEY_TYPE_PUBLIC 1
     #define RSA_KEY_TYPE_PRIVATE 0

     #define xmemcpy memcpy
     #define xmemset memset
     #define xsnprintf snprintf


     void convert_int2string(const uint8_t *array, int len, char *str, int dst_len)
     {
          if (dst_len < len * 2 + 1)
          {
               return;
          }
          int i;
          for (i = 0; i < len; i++)
          {
               xsnprintf(&(str[i * 2]), 3, "%02X", *(array + i));
          }
     }


     static RSA *create_rsa(uint8_t *key, int key_type)
     {
          RSA *rsa = NULL;
          BIO *keybio;
          keybio = BIO_new_mem_buf(key, -1);
          if (keybio == NULL)
          {
               // TLOGE("create_rsa", "", "Failed to create key BIO.");
               return NULL;
          }

          if (key_type == RSA_KEY_TYPE_PUBLIC)
          {
               rsa = PEM_read_bio_RSA_PUBKEY(keybio, &rsa, NULL, NULL);
          }
          else
          {
               rsa = PEM_read_bio_RSAPrivateKey(keybio, &rsa, NULL, NULL);
          }
          BIO_free(keybio);
          return rsa;
     }


     static int wrapper_rsa_public_key(uint8_t *key, int key_len, uint8_t *wrapper_key)
     {
          uint8_t temp[RSA_PUBKEY_BUFSIZE];
          uint8_t head[] = "-----BEGIN PUBLIC KEY-----\n";
          uint8_t tail[] = "-----END PUBLIC KEY-----\n";

          uint8_t *p_wapper = wrapper_key;
          uint8_t *p_temp = temp;

          size_t base64_len;
          base64_encode((char *)key, key_len, (char *)temp, &base64_len, 0);

          xmemcpy(p_wapper, head, strlen((const char *)head));
          p_wapper += strlen((const char *)head);

          int times = base64_len / RSA_KEY_LENPERLINE;
          int ret_char_cnt = times;
          int i;
          for (i = 0; i < times; i++)
          {
               xmemcpy(p_wapper, p_temp, RSA_KEY_LENPERLINE);
               p_wapper += RSA_KEY_LENPERLINE;
               p_temp += RSA_KEY_LENPERLINE;
               xmemset(p_wapper, '\n', 1);
               p_wapper++;
          }
          if (base64_len % RSA_KEY_LENPERLINE > 0)
          {
               xmemcpy(p_wapper, p_temp, base64_len % RSA_KEY_LENPERLINE);
               p_wapper += base64_len % RSA_KEY_LENPERLINE;
               xmemset(p_wapper, '\n', 1);
               p_wapper++;
               ret_char_cnt++;
          }
          xmemcpy(p_wapper, tail, strlen((const char *)tail));

          return strlen((const char *)head) + base64_len + ret_char_cnt + strlen((const char *)tail);
     }


     int rsa_public_encrypt(const uint8_t *rsa_input, const int input_len, uint8_t *enc_out, uint8_t *public_key, const int key_len)
     {
          uint8_t public_key_wrapper[RSA_PUBKEY_BUFSIZE];
          int wrapper_len = wrapper_rsa_public_key(public_key, key_len, public_key_wrapper);
          if (wrapper_len >= RSA_PUBKEY_BUFSIZE)
          {
               char pkstr[1024];
               convert_int2string(public_key, key_len, pkstr, sizeof(pkstr));
               // TLOGE("rsa_public_encrypt", "", "Failed to wrapper_rsa_public_key. wrapper_len: %d, max_len: %d, pk: %s",
                    //   wrapper_len, RSA_PUBKEY_BUFSIZE, pkstr);
               return 0;
          }

          RSA *rsa = create_rsa(public_key_wrapper, RSA_KEY_TYPE_PUBLIC);
          if (rsa == NULL)
          {
               char pkstr[1024];
               convert_int2string(public_key, key_len, pkstr, sizeof(pkstr));
               // TLOGE("rsa_public_encrypt", "", "Failed to create RSA. pk: %s", pkstr);
               return 0;
          }

          uint32_t rsa_size = RSA_size(rsa);
          if (input_len >= rsa_size - 41) // less than RSA_size(rsa) - 41 for RSA_PKCS1_OAEP_PADDING
          {
               // TLOGE("rsa_public_encrypt", "", "data too long to encrypt, must be less than %d.", RSA_size(rsa) - 41);
               RSA_free(rsa);
               return 0;
          }

          int ret = RSA_public_encrypt(input_len, rsa_input, enc_out, rsa, RSA_PKCS1_OAEP_PADDING);
          if (ret <= 0)
          {
               // TLOGE("rsa_public_encrypt", "", "Failed to encrypt with RSA public key.");
               RSA_free(rsa);
               return 0;
          }
          RSA_free(rsa);
          return ret;
     }


     int main() {
          uint8_t rsa_input[32] = {0x72, 0x8d, 0xe5, 0xb4, 0x80, 0xda, 0xe8, 0x82, 0xeb, 0x5e, 0x24, 0x25, 0x8d, 0xc0, 0x73, 0x2e, 0x6b, 0x7a, 0xc1, 0x3f, 0x87, 0x70, 0x7d, 0xf3, 0x6b, 0x7a, 0xc1, 0x3f, 0x87, 0x70, 0x7d, 0xf3};
          uint8_t enc_out[256] = {0};
          uint8_t public_key[294] = {0x30, 0x82, 0x1, 0x22, 0x30, 0xd, 0x6, 0x9, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0xd, 0x1, 0x1, 0x1, 0x5, 0x0, 0x3, 0x82, 0x1, 0xf, 0x0, 0x30, 0x82, 0x1, 0xa, 0x2, 0x82, 0x1, 0x1, 0x0, 0xd6, 0xbb, 0x77, 0x7d,
       0x9, 0x25, 0x8e, 0xb, 0xcf, 0x72, 0x34, 0x38, 0x42, 0x6a, 0xe4, 0x26, 0x4c, 0x50, 0xd1, 0x4c, 0x5a, 0x3f, 0x72, 0xc0, 0xa2, 0x0, 0xb1, 0xcf, 0x3d, 0x2a, 0x5, 0xc, 0x8e, 0x3f, 0x23, 0x77, 0x3b, 0x90, 0x86,
       0x3, 0xbe, 0xbd, 0x54, 0xd7, 0x7f, 0x61, 0x8e, 0xd9, 0x4d, 0xe1, 0xcc, 0xbf, 0x9b, 0xa5, 0x70, 0xf1, 0x44, 0x48, 0x13, 0x7c, 0x83, 0x43, 0xd4, 0xc, 0x29, 0x26, 0x44, 0x39, 0x9c, 0x34, 0x53, 0x86, 0xec, 0x20,
       0x9c, 0x33, 0x4d, 0x71, 0x1, 0x47, 0xc, 0xeb, 0x59, 0xcf, 0x4d, 0xd9, 0xda, 0x28, 0xa3, 0xba, 0xb4, 0x5f, 0xc7, 0xed, 0x70, 0xb2, 0x53, 0x10, 0xc2, 0x5c, 0xcf, 0xd4, 0xa0, 0x19, 0x7f, 0xff, 0x17, 0x95, 0x40,
       0xb7, 0xac, 0x6e, 0x1a, 0xda, 0x19, 0xd6, 0xac, 0xf7, 0x57, 0x4d, 0x49, 0x5, 0x82, 0x1d, 0x8e, 0x58, 0x45, 0x2a, 0x62, 0x55, 0x9f, 0x2f, 0x3e, 0x62, 0x2, 0xe1, 0x81, 0xe7, 0xcd, 0x6f, 0xbd, 0x53, 0x7, 0x2d,
       0x79, 0x1, 0xba, 0xc1, 0xaf, 0x57, 0x94, 0x98, 0xe2, 0x14, 0xfa, 0x5c, 0xa0, 0x22, 0xf, 0x45, 0xfc, 0x16, 0x9, 0x1e, 0xb9, 0x50, 0x21, 0x6b, 0xc5, 0x42, 0x19, 0xad, 0xaa, 0x2e, 0xb1, 0x8b, 0x99, 0x68, 0x79, 0x68, 0x46, 0xca, 0x3, 0x1b, 0xb7, 0x9e, 0xfb, 0x5f, 0x58, 0x48, 0x2f, 0x2e, 0x3a, 0xe8, 0xe2, 0x78, 0x9b, 0xf7, 0x2d, 0xe0, 0x75,
       0x71, 0x1, 0x44, 0x1c, 0x21, 0x64, 0x5b, 0x46, 0xb8, 0x79, 0x4c, 0x55, 0x75, 0xf8, 0x9f, 0x42, 0xd4, 0x3d, 0xc3, 0x9f, 0x23, 0xce, 0xeb, 0x90, 0x11, 0x6a, 0x24, 0x7a, 0x7, 0xb0, 0x31, 0x91, 0xa6, 0x75, 0x9a,
       0x83, 0xd8, 0x9b, 0xc6, 0x9, 0xa1, 0x67, 0xbe, 0x4d, 0x6e, 0x9, 0xb2, 0x9b, 0xc2, 0x23, 0x91, 0x54, 0x65, 0x6d, 0xbd, 0x2, 0x3, 0x1, 0x0, 0x1};
          int ret = rsa_public_encrypt(rsa_input, 32, enc_out, public_key, 294);
          printf("ret: %d\n", ret);
          return 0;
     }
     // success output:
     // ret: 256




renxiang0214
邮箱:renxiang0214@...

签名由 网易邮箱大师 定制


--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: crash in `sha1_block_data_order_avx`

OpenSSL - User mailing list
Reply | Threaded
Open this post in threaded view
|

回复: crash in `sha1_block_data_order_avx`

Xiang Ren
Dear all, very appreciate your reply! We have double check the implementation of related functions, and confirm that the input params for the function
int rsa_public_encrypt(const uint8_t *rsa_input, const int input_len, uint8_t *enc_out, uint8_t *public_key, const int key_len)
are all stack variables(say rsa_input, enc_out and public_key), so there should have no problems with alloc;

we find things about threads with openssl here https://www.openssl.org/docs/man1.0.2/crypto/threads.html
and add the lock functions, till now, it seems ok, but we still could not make sure whether it is the safely in multi-thread response for the crash

By the way, the function 'base64_encode' is to encode chars in base64, any function implement this method could be used for compilation.


--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: 回复: crash in `sha1_block_data_order_avx`

Jakob Bohm-7
On 13/02/2018 12:16, Xiang Ren wrote:

> Dear all, very appreciate your reply! We have double check the
> implementation of related functions, and confirm that the input params
> for the function
> int rsa_public_encrypt(const uint8_t *rsa_input, const int input_len,
> uint8_t *enc_out, uint8_t *public_key, const int key_len)
> are all stack variables(say rsa_input, enc_out and public_key), so
> there should have no problems with alloc;
>
> we find things about threads with openssl here
> https://www.openssl.org/docs/man1.0.2/crypto/threads.html
> and add the lock functions, till now, it seems ok, but we still could
> not make sure whether it is the safely in multi-thread response for
> the crash
>
> By the way, the function 'base64_encode' is to encode chars in base64,
> any function implement this method could be used for compilation.
When a program crashes in malloc(), the likely corruption in the
heap may have happened anywhere in the program, at any time before
the crash.  malloc() then crashes when it uses the malloc-internal
data that was corrupted.

That is why the best way to find the cause is to run the program
with a heap corruption detection system such as valgrind.

Enjoy

Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: 回复: crash in `sha1_block_data_order_avx`

OpenSSL - User mailing list
In reply to this post by Xiang Ren

If your program uses threads, then you *have* to set the thread functions.  Glad you got it fixed.


--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: 回复: crash in `sha1_block_data_order_avx`

Sergio NNX
In reply to this post by Xiang Ren

> Dear all, very appreciate your reply! We have double check the implementation of related > functions, and confirm that the input params for the function
> int rsa_public_encrypt(const uint8_t *rsa_input, const int input_len, uint8_t *enc_out,
> uint8_t *public_key, const int key_len)
> are all stack variables(say rsa_input, enc_out and public_key), so there should have no
> problems with alloc;

....

....


Several days ago we emailed you regarding this issue. Never got a response.


--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: 回复: crash in `sha1_block_data_order_avx`

JordanBrown
In reply to this post by OpenSSL - User mailing list
On 2/13/2018 5:31 AM, Salz, Rich via openssl-users wrote:

If your program uses threads, then you *have* to set the thread functions.  Glad you got it fixed.


Why can't OpenSSL do this automatically?  Yes, some applications will need to supply specialty functions, but it could supply defaults.

-- 
Jordan Brown, Oracle Solaris

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: 回复: crash in `sha1_block_data_order_avx`

OpenSSL - User mailing list


> Why can't OpenSSL do this automatically?  Yes, some applications will need to supply specialty functions, but it could supply defaults.

It does in 1.1.0 and later.

 


--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users