| 1 | #!/bin/sh |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | GEN_DUMP="debian/tests/helpers/gen_rsa_dump.sh" |
| 6 | |
| 7 | # Defines the RSA private key-material, used to generate dump |
| 8 | # and to serve as target values |
| 9 | PRIV_EXP="17 e6 c5 42 14 a8 dc dc 75 85 ca 88 34 aa f7 96 a7 97 49 66 07 aa 76 60 15 38 59 d0 2b a3 99 a5" |
| 10 | PRIME_1="00 d0 98 97 8c de 12 b9 e1 01 b5 19 d4 2c a5 4e 7d" |
| 11 | PRIME_2="00 a8 b6 9b 77 f5 93 ca 8a 28 0d cd 7d 75 7d 95 97" |
| 12 | PUB_EXP="01 00 01" |
| 13 | |
| 14 | # Combination of the parameters to feed into the script |
| 15 | KEYSPEC="\ |
| 16 | PRIV_EXP=${PRIV_EXP} |
| 17 | PRIME_1=${PRIME_1} |
| 18 | PRIME_2=${PRIME_2} |
| 19 | PUB_EXP=${PUB_EXP} |
| 20 | " |
| 21 | |
| 22 | # Memory dump to process |
| 23 | DMP="${AUTOPKGTEST_TMP}/rsa-256.dmp" |
| 24 | |
| 25 | # Dump memory of process, which generates key material |
| 26 | sh ${GEN_DUMP} "$KEYSPEC" "$DMP" |
| 27 | |
| 28 | # Performs key extraction |
| 29 | ACTUAL=$(rsakeyfind "${DMP}" | tr -d "\n" ) |
| 30 | |
| 31 | # Checks, compare actual result with target values |
| 32 | echo "${ACTUAL}" | grep -q "${PRIV_EXP}" |
| 33 | echo "${ACTUAL}" | grep -q "${PRIME_1}" |
| 34 | echo "${ACTUAL}" | grep -q "${PRIME_2}" |
| 35 | echo "${ACTUAL}" | grep -q "${PUB_EXP}" |
| 36 | |
| 37 | # Clean up |
| 38 | rm ${DMP} |
| 39 | |
| 40 | exit 0 |